Add back chairs on/off command

This commit is contained in:
Shevchik 2015-05-18 14:53:42 +04:00
parent cd44f2f5b1
commit 9f5efa2e6e
3 changed files with 17 additions and 0 deletions

View File

@ -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;
}

View File

@ -25,6 +25,7 @@ import com.cnaude.chairs.vehiclearrow.NMSAccess;
public class Chairs extends JavaPlugin {
public HashSet<String> sitDisabled = new HashSet<String>();
public ChairEffects chairEffects;
public List<ChairBlock> allowedBlocks;
public List<Material> validSigns;

View File

@ -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;