Code: public boolean getLoc(Location loc) { return (loc.getX() >= minx && loc.getX() <= maxx && loc.getY() >= miny && loc.getY() <= maxy && loc.getZ() >= minz && loc.getZ() <= maxz); } I have a Boolean check for a player loc stepping in/out of a region. if true it welcomes the player with a message but it's spamming. I know why this is happening and it's because each time the player moves while it's true, its going to spam, but I cant find a way around this! heres the listener: Code: public Main pl; public Protection(Main ins) { pl = ins; } @EventHandler public void onProtect(PlayerMoveEvent e) { Player p = (Player)e.getPlayer(); if (pl.cube.getLoc(p.getLocation())) { p.sendMessage("welcome to spawn"); return; } return; }
I used this, but my Boolean method is confusing me, it returns the players location but when using the method in the listener I get confused, would an if statement be saying: “if the player loc is inside the min/max, then return true?” Sent from my iPhone using Tapatalk