Hi. I have a trouble in follow code:
@Listener public void OnZoneEnter(MoveEntityEvent event, @First Player player) { int guildId = -1; for(int i = 0; i < Main.guilds.size(); i++) { if (Main.guilds.get(i).IsInGuild(player.getName())) { guildId = Main.guilds.get(i).GetId(); break; } } for(int i = 0; i < Main.halls.size(); i++) { GuildHall hall = Main.halls.get(i); boolean IsInX = hall.CheckExistance(hall.getFirstPos().getX(), hall.getSecondPos().getX(), player.getLocation().getX()); boolean IsInY = hall.CheckExistance(hall.getFirstPos().getY(), hall.getSecondPos().getY() , player.getLocation().getY()); boolean IsInZ = hall.CheckExistance(hall.getFirstPos().getZ(), hall.getSecondPos().getZ(), player.getLocation().getZ()); if (hall.getMasterGuild() != 0 && guildId != hall.getMasterGuild() && IsInX && IsInY && IsInZ) { Location<World> loc = new Location<World>(Sponge.getServer().getWorld(Sponge.getServer().getDefaultWorldName()).get(), 0,0,0); player.sendMessage(Text.of(TextColors.RED, "[Guild] You don't have permission to visit this guild hall.")); player.setLocation(loc); event.setCancelled(true); } } }
When I try to enter to the zone must occured teleport but I recieve error:
So, I have two question:
- How to fix that error?
- Is there any way to get has player permission or not?