Load config just like custom one so reload will work
This commit is contained in:
parent
e605cdeed1
commit
05c4ae027f
@ -1,5 +1,6 @@
|
|||||||
package com.cnaude.chairs;
|
package com.cnaude.chairs;
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
@ -12,6 +13,8 @@ import org.bukkit.ChatColor;
|
|||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
import org.bukkit.block.Block;
|
import org.bukkit.block.Block;
|
||||||
|
import org.bukkit.configuration.file.FileConfiguration;
|
||||||
|
import org.bukkit.configuration.file.YamlConfiguration;
|
||||||
import org.bukkit.entity.Entity;
|
import org.bukkit.entity.Entity;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.event.HandlerList;
|
import org.bukkit.event.HandlerList;
|
||||||
@ -140,35 +143,36 @@ public class Chairs extends JavaPlugin {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void loadConfig() {
|
public void loadConfig() {
|
||||||
autoRotate = getConfig().getBoolean("auto-rotate");
|
FileConfiguration config = YamlConfiguration.loadConfiguration(new File(this.getDataFolder(),"config.yml"));
|
||||||
signCheck = getConfig().getBoolean("sign-check");
|
autoRotate = config.getBoolean("auto-rotate");
|
||||||
sittingHeightAdj = getConfig().getDouble("sitting-height-adj");
|
signCheck = config.getBoolean("sign-check");
|
||||||
distance = getConfig().getDouble("distance");
|
sittingHeightAdj = config.getDouble("sitting-height-adj");
|
||||||
maxChairWidth = getConfig().getInt("max-chair-width");
|
distance = config.getDouble("distance");
|
||||||
notifyplayer = getConfig().getBoolean("notify-player");
|
maxChairWidth = config.getInt("max-chair-width");
|
||||||
invertedStairCheck = getConfig().getBoolean("upside-down-check");
|
notifyplayer = config.getBoolean("notify-player");
|
||||||
invertedStepCheck = getConfig().getBoolean("upper-step-check");
|
invertedStairCheck = config.getBoolean("upside-down-check");
|
||||||
ignoreIfBlockInHand = getConfig().getBoolean("ignore-if-item-in-hand");
|
invertedStepCheck = config.getBoolean("upper-step-check");
|
||||||
|
ignoreIfBlockInHand = config.getBoolean("ignore-if-item-in-hand");
|
||||||
|
|
||||||
disabledRegions = new HashSet<String>(getConfig().getStringList("disabledWGRegions"));
|
disabledRegions = new HashSet<String>(config.getStringList("disabledWGRegions"));
|
||||||
|
|
||||||
sitEffectsEnabled = getConfig().getBoolean("sit-effects.enabled", false);
|
sitEffectsEnabled = config.getBoolean("sit-effects.enabled", false);
|
||||||
sitEffectInterval = getConfig().getInt("sit-effects.interval",20);
|
sitEffectInterval = config.getInt("sit-effects.interval",20);
|
||||||
sitMaxHealth = getConfig().getInt("sit-effects.healing.max-percent",100);
|
sitMaxHealth = config.getInt("sit-effects.healing.max-percent",100);
|
||||||
sitHealthPerInterval = getConfig().getInt("sit-effects.healing.amount",1);
|
sitHealthPerInterval = config.getInt("sit-effects.healing.amount",1);
|
||||||
|
|
||||||
msgSitting = ChatColor.translateAlternateColorCodes('&',getConfig().getString("messages.sitting"));
|
msgSitting = ChatColor.translateAlternateColorCodes('&',config.getString("messages.sitting"));
|
||||||
msgStanding = ChatColor.translateAlternateColorCodes('&',getConfig().getString("messages.standing"));
|
msgStanding = ChatColor.translateAlternateColorCodes('&',config.getString("messages.standing"));
|
||||||
msgOccupied = ChatColor.translateAlternateColorCodes('&',getConfig().getString("messages.occupied"));
|
msgOccupied = ChatColor.translateAlternateColorCodes('&',config.getString("messages.occupied"));
|
||||||
msgNoPerm = ChatColor.translateAlternateColorCodes('&',getConfig().getString("messages.no-permission"));
|
msgNoPerm = ChatColor.translateAlternateColorCodes('&',config.getString("messages.no-permission"));
|
||||||
msgEnabled = ChatColor.translateAlternateColorCodes('&',getConfig().getString("messages.enabled"));
|
msgEnabled = ChatColor.translateAlternateColorCodes('&',config.getString("messages.enabled"));
|
||||||
msgDisabled = ChatColor.translateAlternateColorCodes('&',getConfig().getString("messages.disabled"));
|
msgDisabled = ChatColor.translateAlternateColorCodes('&',config.getString("messages.disabled"));
|
||||||
msgReloaded = ChatColor.translateAlternateColorCodes('&',getConfig().getString("messages.reloaded"));
|
msgReloaded = ChatColor.translateAlternateColorCodes('&',config.getString("messages.reloaded"));
|
||||||
|
|
||||||
allowedBlocks = new ArrayList<ChairBlock>();
|
allowedBlocks = new ArrayList<ChairBlock>();
|
||||||
for (String s : getConfig().getStringList("sit-block-settings")) {
|
for (String s : config.getStringList("sit-block-settings")) {
|
||||||
String type;
|
String type;
|
||||||
double sh = 0.7;
|
double sh = 0.7;
|
||||||
String tmp[] = s.split("[:]");
|
String tmp[] = s.split("[:]");
|
||||||
@ -191,7 +195,7 @@ public class Chairs extends JavaPlugin {
|
|||||||
}
|
}
|
||||||
|
|
||||||
validSigns = new ArrayList<Material>();
|
validSigns = new ArrayList<Material>();
|
||||||
for (String type : getConfig().getStringList("valid-signs")) {
|
for (String type : config.getStringList("valid-signs")) {
|
||||||
try {
|
try {
|
||||||
validSigns.add(Material.matchMaterial(type));
|
validSigns.add(Material.matchMaterial(type));
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user