Removed automatic shop reloading

+ Fixed config reload after entering "/shop reload"
This commit is contained in:
Eric 2017-05-06 15:25:42 +02:00
parent 58892f73a5
commit f95122daaa
3 changed files with 2 additions and 32 deletions

View File

@ -249,20 +249,6 @@ public class ShopChest extends JavaPlugin {
} }
} }
if (config.auto_reload_time > 0) {
Bukkit.getScheduler().runTaskTimer(this, new Runnable() {
@Override
public void run() {
debug("Auto reloading shops...");
ShopReloadEvent event = new ShopReloadEvent(Bukkit.getConsoleSender());
Bukkit.getServer().getPluginManager().callEvent(event);
if (!event.isCancelled()) shopUtils.reloadShops(true, false, null);
}
}, config.auto_reload_time * 20, config.auto_reload_time * 20);
}
Bukkit.getScheduler().runTaskAsynchronously(this, new Runnable() { Bukkit.getScheduler().runTaskAsynchronously(this, new Runnable() {
@Override @Override
public void run() { public void run() {

View File

@ -194,9 +194,6 @@ public class Config {
/** The default shop limit for players whose limit is not set via a permission **/ /** The default shop limit for players whose limit is not set via a permission **/
public int default_limit; public int default_limit;
/** The time between automatic shop reloads (if set to 0, the timer will be disabled) **/
public int auto_reload_time;
/** The main command of ShopChest <i>(default: shop)</i> **/ /** The main command of ShopChest <i>(default: shop)</i> **/
public String main_command_name; public String main_command_name;
@ -208,7 +205,6 @@ public class Config {
this.plugin = plugin; this.plugin = plugin;
plugin.saveDefaultConfig(); plugin.saveDefaultConfig();
plugin.reloadConfig();
reload(true, true, true); reload(true, true, true);
} }
@ -227,7 +223,6 @@ public class Config {
plugin.getConfig().set(property, intValue); plugin.getConfig().set(property, intValue);
plugin.saveConfig(); plugin.saveConfig();
plugin.reloadConfig();
reload(false, langChange, false); reload(false, langChange, false);
return; return;
@ -238,7 +233,6 @@ public class Config {
plugin.getConfig().set(property, doubleValue); plugin.getConfig().set(property, doubleValue);
plugin.saveConfig(); plugin.saveConfig();
plugin.reloadConfig();
reload(false, langChange, false); reload(false, langChange, false);
return; return;
@ -252,7 +246,6 @@ public class Config {
} }
plugin.saveConfig(); plugin.saveConfig();
plugin.reloadConfig();
reload(false, langChange, false); reload(false, langChange, false);
} }
@ -271,7 +264,6 @@ public class Config {
list.add(intValue); list.add(intValue);
plugin.saveConfig(); plugin.saveConfig();
plugin.reloadConfig();
reload(false, false, false); reload(false, false, false);
return; return;
@ -282,7 +274,6 @@ public class Config {
list.add(doubleValue); list.add(doubleValue);
plugin.saveConfig(); plugin.saveConfig();
plugin.reloadConfig();
reload(false, false, false); reload(false, false, false);
return; return;
@ -296,7 +287,6 @@ public class Config {
} }
plugin.saveConfig(); plugin.saveConfig();
plugin.reloadConfig();
reload(false, false, false); reload(false, false, false);
} }
@ -309,7 +299,6 @@ public class Config {
list.remove(intValue); list.remove(intValue);
plugin.saveConfig(); plugin.saveConfig();
plugin.reloadConfig();
reload(false, false, false); reload(false, false, false);
return; return;
@ -320,7 +309,6 @@ public class Config {
list.remove(doubleValue); list.remove(doubleValue);
plugin.saveConfig(); plugin.saveConfig();
plugin.reloadConfig();
reload(false, false, false); reload(false, false, false);
return; return;
@ -334,7 +322,6 @@ public class Config {
} }
plugin.saveConfig(); plugin.saveConfig();
plugin.reloadConfig();
reload(false, false, false); reload(false, false, false);
} }
@ -343,6 +330,8 @@ public class Config {
* Reload the configuration values from config.yml * Reload the configuration values from config.yml
*/ */
public void reload(boolean firstLoad, boolean langReload, boolean showMessages) { public void reload(boolean firstLoad, boolean langReload, boolean showMessages) {
plugin.reloadConfig();
update_quality = ShopUpdateEvent.UpdateQuality.valueOf(plugin.getConfig().getString("update-quality")); update_quality = ShopUpdateEvent.UpdateQuality.valueOf(plugin.getConfig().getString("update-quality"));
wg_allow_create_shop_default = plugin.getConfig().getBoolean("worldguard-default-flag-values.create-shop"); wg_allow_create_shop_default = plugin.getConfig().getBoolean("worldguard-default-flag-values.create-shop");
wg_allow_use_admin_shop_default = plugin.getConfig().getBoolean("worldguard-default-flag-values.use-admin-shop"); wg_allow_use_admin_shop_default = plugin.getConfig().getBoolean("worldguard-default-flag-values.use-admin-shop");
@ -394,7 +383,6 @@ public class Config {
shop_creation_price_normal = plugin.getConfig().getDouble("shop-creation-price.normal"); shop_creation_price_normal = plugin.getConfig().getDouble("shop-creation-price.normal");
shop_creation_price_admin = plugin.getConfig().getDouble("shop-creation-price.admin"); shop_creation_price_admin = plugin.getConfig().getDouble("shop-creation-price.admin");
default_limit = plugin.getConfig().getInt("shop-limits.default"); default_limit = plugin.getConfig().getInt("shop-limits.default");
auto_reload_time = plugin.getConfig().getInt("auto-reload-time");
main_command_name = plugin.getConfig().getString("main-command-name"); main_command_name = plugin.getConfig().getString("main-command-name");
language_file = plugin.getConfig().getString("language-file"); language_file = plugin.getConfig().getString("language-file");

View File

@ -153,10 +153,6 @@ maximal-distance: 2
# player can see the floating shop item. # player can see the floating shop item.
maximal-item-distance: 40 maximal-item-distance: 40
# Set the time in seconds between automatic shop reloads.
# You can set this to 0 to disable automatic shop reloads.
auto-reload-time: 0
# Set the price a player has to pay in order to create... # Set the price a player has to pay in order to create...
# You can set this to 0 to disable costs. # You can set this to 0 to disable costs.
# Value MUST be a number (e.g. 1, 1.5, 2.75, ...) # Value MUST be a number (e.g. 1, 1.5, 2.75, ...)