diff --git a/src/com/cnaude/chairs/commands/ChairsCommand.java b/src/com/cnaude/chairs/commands/ChairsCommand.java index 014ea90..a0dd8c2 100644 --- a/src/com/cnaude/chairs/commands/ChairsCommand.java +++ b/src/com/cnaude/chairs/commands/ChairsCommand.java @@ -38,6 +38,16 @@ public class ChairsCommand implements CommandExecutor { sender.sendMessage(plugin.msgNoPerm); } } + if (sender instanceof Player) { + Player player = (Player) sender; + if (args[0].equalsIgnoreCase("off")) { + plugin.sitDisabled.add(player.getName()); + player.sendMessage("Disabled sitting"); + } else if (args[0].equalsIgnoreCase("on")) { + plugin.sitDisabled.remove(player.getName()); + player.sendMessage("Enabled sitting"); + } + } return true; } diff --git a/src/com/cnaude/chairs/core/Chairs.java b/src/com/cnaude/chairs/core/Chairs.java index fca9270..5b76dcc 100644 --- a/src/com/cnaude/chairs/core/Chairs.java +++ b/src/com/cnaude/chairs/core/Chairs.java @@ -25,6 +25,7 @@ import com.cnaude.chairs.vehiclearrow.NMSAccess; public class Chairs extends JavaPlugin { + public HashSet sitDisabled = new HashSet(); public ChairEffects chairEffects; public List allowedBlocks; public List validSigns; diff --git a/src/com/cnaude/chairs/listeners/TrySitEventListener.java b/src/com/cnaude/chairs/listeners/TrySitEventListener.java index 2aa9016..9951890 100644 --- a/src/com/cnaude/chairs/listeners/TrySitEventListener.java +++ b/src/com/cnaude/chairs/listeners/TrySitEventListener.java @@ -42,6 +42,12 @@ public class TrySitEventListener implements Listener { } private boolean sitAllowed(Player player, Block block) { + + // Check for sitting disabled + if (plugin.sitDisabled.contains(player.getName())) { + return false; + } + // Check for permissions if (!player.hasPermission("chairs.sit")) { return false;