Add support for disabling chairs in specific worlds

This commit is contained in:
Shevchik 2016-12-25 00:28:16 +03:00
parent af220912be
commit 8d371df8f5
3 changed files with 9 additions and 2 deletions

View File

@ -36,6 +36,7 @@ public class Chairs extends JavaPlugin {
public final HashMap<Material, Double> validChairs = new HashMap<>();
public final List<Material> validSigns = new ArrayList<Material>();
public final HashSet<String> sitDisabledCommands = new HashSet<>();
public final HashSet<String> disabledWorlds = new HashSet<>();
public boolean autoRotate, signCheck, notifyplayer;
public boolean ignoreIfBlockInHand;
public double distance;
@ -130,6 +131,9 @@ public class Chairs extends JavaPlugin {
sitDisabledCommands.clear();
sitDisabledCommands.addAll(config.getStringList("sit-restrictions.commands.list"));
disabledWorlds.clear();
disabledWorlds.addAll(config.getStringList("disabled-worlds"));
msgSitting = ChatColor.translateAlternateColorCodes('&',config.getString("messages.sitting"));
msgStanding = ChatColor.translateAlternateColorCodes('&',config.getString("messages.standing"));
msgOccupied = ChatColor.translateAlternateColorCodes('&',config.getString("messages.occupied"));

View File

@ -48,6 +48,9 @@ public class TrySitEventListener implements Listener {
if (plugin.sitDisabled.contains(player.getUniqueId())) {
return false;
}
if (plugin.disabledWorlds.contains(player.getWorld().getName())) {
return false;
}
// Check for permissions
if (!player.hasPermission("chairs.sit")) {

View File

@ -21,7 +21,7 @@
# commands:
# all: If set to true, restricts using all commands while sitting
# list: List of commands which player can't use while sitting
# notify-player: If set to true, messages are sent to players to notify about sit/leave/occupied/...
# disabled-worlds: List of worlds in which sitting is disabled
# ------
sit-blocks:
- WOOD_STAIRS:0.7
@ -61,7 +61,7 @@ sit-restrictions:
all: false
list:
- /examplecommand
notify-player: true
disabled-worlds: []
messages:
sitting: '&7You are now sitting.'
standing: '&7You are no longer sitting.'