Fix reload command.

This commit is contained in:
cnaude 2013-06-27 21:44:07 -07:00
parent 2566addf8d
commit e659eca5be
3 changed files with 7 additions and 5 deletions

View File

@ -26,8 +26,8 @@ import org.bukkit.plugin.java.JavaPlugin;
public class Chairs extends JavaPlugin { public class Chairs extends JavaPlugin {
private static Chairs instance = null; private static Chairs instance = null;
public static ChairEffects chairEffects; public static ChairEffects chairEffects;
public List<ChairBlock> allowedBlocks = new ArrayList<ChairBlock>(); public List<ChairBlock> allowedBlocks;
public List<Material> validSigns = new ArrayList<Material>(); public List<Material> validSigns;
public boolean sneaking, autoRotate, signCheck, permissions, notifyplayer, opsOverridePerms; public boolean sneaking, autoRotate, signCheck, permissions, notifyplayer, opsOverridePerms;
public boolean invertedStairCheck, seatOccupiedCheck, invertedStepCheck, perItemPerms, ignoreIfBlockInHand; public boolean invertedStairCheck, seatOccupiedCheck, invertedStepCheck, perItemPerms, ignoreIfBlockInHand;
public boolean sitEffectsEnabled; public boolean sitEffectsEnabled;
@ -57,7 +57,7 @@ public class Chairs extends JavaPlugin {
pluginFolder = getDataFolder(); pluginFolder = getDataFolder();
configFile = new File(pluginFolder, "config.yml"); configFile = new File(pluginFolder, "config.yml");
createConfig(); createConfig();
this.getConfig().options().copyDefaults(true); getConfig().options().copyDefaults(true);
saveConfig(); saveConfig();
loadConfig(); loadConfig();
getServer().getPluginManager().registerEvents(new EventListener(this, ignoreList), this); getServer().getPluginManager().registerEvents(new EventListener(this, ignoreList), this);
@ -149,6 +149,7 @@ public class Chairs extends JavaPlugin {
msgDisabled = ChatColor.translateAlternateColorCodes('&',getConfig().getString("messages.disabled")); msgDisabled = ChatColor.translateAlternateColorCodes('&',getConfig().getString("messages.disabled"));
msgReloaded = ChatColor.translateAlternateColorCodes('&',getConfig().getString("messages.reloaded")); msgReloaded = ChatColor.translateAlternateColorCodes('&',getConfig().getString("messages.reloaded"));
allowedBlocks = new ArrayList<ChairBlock>();
for (String s : getConfig().getStringList("allowed-blocks")) { for (String s : getConfig().getStringList("allowed-blocks")) {
String type; String type;
double sh = sittingHeight; double sh = sittingHeight;
@ -184,6 +185,7 @@ public class Chairs extends JavaPlugin {
} }
} }
validSigns = new ArrayList<Material>();
for (String type : getConfig().getStringList("valid-signs")) { for (String type : getConfig().getStringList("valid-signs")) {
try { try {
if (type.matches("\\d+")) { if (type.matches("\\d+")) {

View File

@ -30,7 +30,7 @@ public class ChairsCommand implements CommandExecutor {
} }
if (args[0].equalsIgnoreCase("reload")) { if (args[0].equalsIgnoreCase("reload")) {
if (sender.hasPermission("chairs.reload") || !(sender instanceof Player)) { if (sender.hasPermission("chairs.reload") || !(sender instanceof Player)) {
plugin.reloadConfig(); //plugin.reloadConfig();
plugin.loadConfig(); plugin.loadConfig();
plugin.restartEffectsTask(); plugin.restartEffectsTask();
if (!plugin.msgReloaded.isEmpty()) { if (!plugin.msgReloaded.isEmpty()) {

View File

@ -1,5 +1,5 @@
name: Chairs name: Chairs
version: 2.1.3 version: 2.1.4
description: Let players sit on blocks. description: Let players sit on blocks.
website: http://dev.bukkit.org/bukkit-plugins/chairsreloaded/ website: http://dev.bukkit.org/bukkit-plugins/chairsreloaded/
authors: authors: