+ Added isSign check to prevent joining on non BlockHunt sign.
This commit is contained in:
parent
a40a56fbb3
commit
872cd6aef0
@ -2,6 +2,7 @@ package nl.Steffion.BlockHunt.Listeners;
|
||||
|
||||
import nl.Steffion.BlockHunt.Arena;
|
||||
import nl.Steffion.BlockHunt.ArenaHandler;
|
||||
import nl.Steffion.BlockHunt.SignsHandler;
|
||||
import nl.Steffion.BlockHunt.W;
|
||||
import nl.Steffion.BlockHunt.Managers.ConfigC;
|
||||
import nl.Steffion.BlockHunt.Managers.MessageM;
|
||||
@ -86,21 +87,25 @@ public class OnPlayerInteractEvent implements Listener {
|
||||
.equals(Material.SIGN_POST)
|
||||
|| event.getClickedBlock().getType()
|
||||
.equals(Material.WALL_SIGN)) {
|
||||
Sign sign = (Sign) event.getClickedBlock().getState();
|
||||
if (sign.getLine(1) != null) {
|
||||
if (sign.getLine(1).contains("LEAVE")) {
|
||||
if (PlayerM.hasPerm(player, PermsC.joinsign, true)) {
|
||||
ArenaHandler.playerLeaveArena(player, true,
|
||||
true);
|
||||
}
|
||||
} else {
|
||||
for (Arena arena : W.arenaList) {
|
||||
if (sign.getLines()[1]
|
||||
.contains(arena.arenaName)) {
|
||||
if (PlayerM.hasPerm(player,
|
||||
PermsC.joinsign, true)) {
|
||||
ArenaHandler.playerJoinArena(player,
|
||||
arena.arenaName);
|
||||
if (SignsHandler.isSign(new LocationSerializable(event
|
||||
.getClickedBlock().getLocation()))) {
|
||||
Sign sign = (Sign) event.getClickedBlock().getState();
|
||||
if (sign.getLine(1) != null) {
|
||||
if (sign.getLine(1).contains("LEAVE")) {
|
||||
if (PlayerM.hasPerm(player, PermsC.joinsign,
|
||||
true)) {
|
||||
ArenaHandler.playerLeaveArena(player, true,
|
||||
true);
|
||||
}
|
||||
} else {
|
||||
for (Arena arena : W.arenaList) {
|
||||
if (sign.getLines()[1]
|
||||
.contains(arena.arenaName)) {
|
||||
if (PlayerM.hasPerm(player,
|
||||
PermsC.joinsign, true)) {
|
||||
ArenaHandler.playerJoinArena(
|
||||
player, arena.arenaName);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -68,6 +68,19 @@ public class SignsHandler {
|
||||
}
|
||||
}
|
||||
|
||||
public static boolean isSign(LocationSerializable location) {
|
||||
for (String sign : W.signs.getFile().getKeys(false)) {
|
||||
LocationSerializable loc = new LocationSerializable(
|
||||
(LocationSerializable) W.signs.getFile().get(
|
||||
sign + ".location"));
|
||||
if (loc.equals(location)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public static void updateSigns() {
|
||||
W.signs.load();
|
||||
|
Loading…
x
Reference in New Issue
Block a user