|
|
@ -2,6 +2,7 @@ package cx.sfy.TheBridge.listeners; |
|
|
|
|
|
|
|
import java.util.ArrayList; |
|
|
|
import java.util.HashMap; |
|
|
|
import java.util.List; |
|
|
|
|
|
|
|
import org.bukkit.Bukkit; |
|
|
|
import org.bukkit.ChatColor; |
|
|
@ -26,6 +27,7 @@ import org.bukkit.event.inventory.InventoryClickEvent; |
|
|
|
import org.bukkit.event.inventory.InventoryCloseEvent; |
|
|
|
import org.bukkit.event.inventory.InventoryType.SlotType; |
|
|
|
import org.bukkit.event.player.AsyncPlayerChatEvent; |
|
|
|
import org.bukkit.event.player.PlayerCommandPreprocessEvent; |
|
|
|
import org.bukkit.event.player.PlayerDropItemEvent; |
|
|
|
import org.bukkit.event.player.PlayerInteractEvent; |
|
|
|
import org.bukkit.event.player.PlayerItemConsumeEvent; |
|
|
@ -73,6 +75,22 @@ public class PlayerListener implements Listener { |
|
|
|
Utils.setPlayerExperience(p, PlayerStat.getPlayerStat(p).getXP()); |
|
|
|
} |
|
|
|
|
|
|
|
@EventHandler |
|
|
|
public void onCommand(PlayerCommandPreprocessEvent e) { |
|
|
|
if (plugin.getGM().getGameByPlayer(e.getPlayer()) != null |
|
|
|
|| plugin.getGM().getGameFourByPlayer(e.getPlayer()) != null) { |
|
|
|
final List<String> cmds = plugin.getConfig().getStringList("commands.list"); |
|
|
|
if (e.getMessage().contains("/bridges")) |
|
|
|
return; |
|
|
|
if (plugin.getConfig().getBoolean("commands.whitelist") == true) { |
|
|
|
if (cmds.contains(e.getMessage())) |
|
|
|
return; |
|
|
|
} else if (plugin.getConfig().getBoolean("commands.whitelist") == false) |
|
|
|
if (!cmds.contains(e.getMessage())) |
|
|
|
e.setCancelled(true); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
public void givePlayerItems(Player p) { |
|
|
|
final ItemStack select = ItemBuilder.item(Material.valueOf(plugin.getConfig().getString("items.menu.material")), |
|
|
|
plugin.getConfig().getInt("items.menu.amount"), (short) plugin.getConfig().getInt("items.menu.data"), |
|
|
@ -1187,8 +1205,7 @@ public class PlayerListener implements Listener { |
|
|
|
if (plugin.getGM().getGameByPlayer(p) != null) { |
|
|
|
final Game game = plugin.getGM().getGameByPlayer(p); |
|
|
|
if (game.isState(State.WAITING) || game.isState(State.STARTING) || game.isState(State.PREGAME) |
|
|
|
|| game.isState(State.PREGAME) |
|
|
|
|| game.isState(State.FINISH) || game.isState(State.RESTARTING)) |
|
|
|
|| game.isState(State.PREGAME) || game.isState(State.FINISH) || game.isState(State.RESTARTING)) |
|
|
|
e.setCancelled(true); |
|
|
|
if (game.isState(State.INGAME)) |
|
|
|
if (!game.getPlaced().contains(e.getBlock().getLocation())) { |
|
|
@ -1201,8 +1218,7 @@ public class PlayerListener implements Listener { |
|
|
|
if (plugin.getGM().getGameFourByPlayer(p) != null) { |
|
|
|
final GameFour game = plugin.getGM().getGameFourByPlayer(p); |
|
|
|
if (game.isState(FState.WAITING) || game.isState(FState.STARTING) || game.isState(FState.PREGAME) |
|
|
|
|| game.isState(FState.PREGAME) |
|
|
|
|| game.isState(FState.FINISH) || game.isState(FState.RESTARTING)) |
|
|
|
|| game.isState(FState.PREGAME) || game.isState(FState.FINISH) || game.isState(FState.RESTARTING)) |
|
|
|
e.setCancelled(true); |
|
|
|
if (game.isState(FState.INGAME)) |
|
|
|
if (!game.getPlaced().contains(e.getBlock().getLocation())) { |
|
|
@ -1235,8 +1251,7 @@ public class PlayerListener implements Listener { |
|
|
|
if (plugin.getGM().getGameFourByPlayer(p) != null) { |
|
|
|
final GameFour game = plugin.getGM().getGameFourByPlayer(p); |
|
|
|
if (game.isState(FState.WAITING) || game.isState(FState.STARTING) || game.isState(FState.PREGAME) |
|
|
|
|| game.isState(FState.PREGAME) |
|
|
|
|| game.isState(FState.FINISH) || game.isState(FState.RESTARTING)) |
|
|
|
|| game.isState(FState.PREGAME) || game.isState(FState.FINISH) || game.isState(FState.RESTARTING)) |
|
|
|
e.setCancelled(true); |
|
|
|
if (game.isState(FState.INGAME)) |
|
|
|
if (!game.getBuild().contains(e.getBlockPlaced().getLocation())) { |
|
|
|