mirror of
https://github.com/GeorgH93/Minepacks.git
synced 2024-12-31 18:17:49 +01:00
Use getConfig() instead of protected variable config
this chance should prepare for the next update of the PluginLib
This commit is contained in:
parent
8a91a3539e
commit
270e22f7d0
@ -63,42 +63,42 @@ protected void doUpgrade(at.pcgamingfreaks.Configuration oldConfig)
|
|||||||
//region Database getter
|
//region Database getter
|
||||||
public int getAutoCleanupMaxInactiveDays()
|
public int getAutoCleanupMaxInactiveDays()
|
||||||
{
|
{
|
||||||
return config.getInt("Database.AutoCleanup.MaxInactiveDays", -1);
|
return getConfig().getInt("Database.AutoCleanup.MaxInactiveDays", -1);
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getDatabaseType()
|
public String getDatabaseType()
|
||||||
{
|
{
|
||||||
return config.getString("Database.Type", "sqlite");
|
return getConfig().getString("Database.Type", "sqlite");
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getSQLHost()
|
public String getSQLHost()
|
||||||
{
|
{
|
||||||
return config.getString("Database.SQL.Host", "localhost");
|
return getConfig().getString("Database.SQL.Host", "localhost");
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getSQLDatabase()
|
public String getSQLDatabase()
|
||||||
{
|
{
|
||||||
return config.getString("Database.SQL.Database", "minecraft");
|
return getConfig().getString("Database.SQL.Database", "minecraft");
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getSQLUser()
|
public String getSQLUser()
|
||||||
{
|
{
|
||||||
return config.getString("Database.SQL.User", "minecraft");
|
return getConfig().getString("Database.SQL.User", "minecraft");
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getSQLPassword()
|
public String getSQLPassword()
|
||||||
{
|
{
|
||||||
return config.getString("Database.SQL.Password", "");
|
return getConfig().getString("Database.SQL.Password", "");
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getSQLMaxConnections()
|
public int getSQLMaxConnections()
|
||||||
{
|
{
|
||||||
return config.getInt("Database.SQL.MaxConnections", 2);
|
return getConfig().getInt("Database.SQL.MaxConnections", 2);
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getSQLProperties()
|
public String getSQLProperties()
|
||||||
{
|
{
|
||||||
List<String> list = config.getStringList("Database.MySQL.Properties", null);
|
List<String> list = getConfig().getStringList("Database.MySQL.Properties", null);
|
||||||
StringBuilder str = new StringBuilder();
|
StringBuilder str = new StringBuilder();
|
||||||
if(list == null) return "";
|
if(list == null) return "";
|
||||||
for(String s : list)
|
for(String s : list)
|
||||||
@ -110,99 +110,99 @@ public String getSQLProperties()
|
|||||||
|
|
||||||
public String getUserTable()
|
public String getUserTable()
|
||||||
{
|
{
|
||||||
return config.getString("Database.Tables.User", "backpack_players");
|
return getConfig().getString("Database.Tables.User", "backpack_players");
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getBackpackTable()
|
public String getBackpackTable()
|
||||||
{
|
{
|
||||||
return config.getString("Database.Tables.Backpack", "backpacks");
|
return getConfig().getString("Database.Tables.Backpack", "backpacks");
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getCooldownTable()
|
public String getCooldownTable()
|
||||||
{
|
{
|
||||||
return config.getString("Database.Tables.Cooldown", "backpack_cooldowns");
|
return getConfig().getString("Database.Tables.Cooldown", "backpack_cooldowns");
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getDBFields(String sub, String def)
|
public String getDBFields(String sub, String def)
|
||||||
{
|
{
|
||||||
return config.getString("Database.Tables.Fields." + sub, def);
|
return getConfig().getString("Database.Tables.Fields." + sub, def);
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean getUpdatePlayer()
|
public boolean getUpdatePlayer()
|
||||||
{
|
{
|
||||||
return config.getBoolean("Database.UpdatePlayer", true);
|
return getConfig().getBoolean("Database.UpdatePlayer", true);
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean getUseUUIDs()
|
public boolean getUseUUIDs()
|
||||||
{
|
{
|
||||||
return config.getBoolean("Database.UseUUIDs", true);
|
return getConfig().getBoolean("Database.UseUUIDs", true);
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean getUseUUIDSeparators()
|
public boolean getUseUUIDSeparators()
|
||||||
{
|
{
|
||||||
return config.getBoolean("Database.UseUUIDSeparators", false);
|
return getConfig().getBoolean("Database.UseUUIDSeparators", false);
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getUnCacheStrategie()
|
public String getUnCacheStrategie()
|
||||||
{
|
{
|
||||||
return config.getString("Database.Cache.UnCache.Strategie", "interval").toLowerCase();
|
return getConfig().getString("Database.Cache.UnCache.Strategie", "interval").toLowerCase();
|
||||||
}
|
}
|
||||||
|
|
||||||
public long getUnCacheInterval()
|
public long getUnCacheInterval()
|
||||||
{
|
{
|
||||||
return config.getLong("Database.Cache.UnCache.Interval", 600) * 20L;
|
return getConfig().getLong("Database.Cache.UnCache.Interval", 600) * 20L;
|
||||||
}
|
}
|
||||||
|
|
||||||
public long getUnCacheDelay()
|
public long getUnCacheDelay()
|
||||||
{
|
{
|
||||||
return config.getLong("Database.Cache.UnCache.Delay", 600) * 20L;
|
return getConfig().getLong("Database.Cache.UnCache.Delay", 600) * 20L;
|
||||||
}
|
}
|
||||||
//endregion
|
//endregion
|
||||||
|
|
||||||
public String getBPTitleOther()
|
public String getBPTitleOther()
|
||||||
{
|
{
|
||||||
return ChatColor.translateAlternateColorCodes('&', config.getString("BackpackTitleOther", "{OwnerName} Backpack").replaceAll("%", "%%").replaceAll("\\{OwnerName}", "%s"));
|
return ChatColor.translateAlternateColorCodes('&', getConfig().getString("BackpackTitleOther", "{OwnerName} Backpack").replaceAll("%", "%%").replaceAll("\\{OwnerName}", "%s"));
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getBPTitle()
|
public String getBPTitle()
|
||||||
{
|
{
|
||||||
return ChatColor.translateAlternateColorCodes('&', config.getString("BackpackTitle", "Backpack"));
|
return ChatColor.translateAlternateColorCodes('&', getConfig().getString("BackpackTitle", "Backpack"));
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean getDropOnDeath()
|
public boolean getDropOnDeath()
|
||||||
{
|
{
|
||||||
return config.getBoolean("DropOnDeath", true);
|
return getConfig().getBoolean("DropOnDeath", true);
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getBackpackMaxSize()
|
public int getBackpackMaxSize()
|
||||||
{
|
{
|
||||||
return config.getInt("MaxSize", 6);
|
return getConfig().getInt("MaxSize", 6);
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean getAutoUpdate()
|
public boolean getAutoUpdate()
|
||||||
{
|
{
|
||||||
return config.getBoolean("Misc.AutoUpdate", true);
|
return getConfig().getBoolean("Misc.AutoUpdate", true);
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isBungeeCordModeEnabled()
|
public boolean isBungeeCordModeEnabled()
|
||||||
{
|
{
|
||||||
return config.getBoolean("Misc.UseBungeeCord", false);
|
return getConfig().getBoolean("Misc.UseBungeeCord", false);
|
||||||
}
|
}
|
||||||
|
|
||||||
public long getCommandCooldown()
|
public long getCommandCooldown()
|
||||||
{
|
{
|
||||||
return config.getInt("CommandCooldown", -1) * 1000L;
|
return getConfig().getInt("CommandCooldown", -1) * 1000L;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isCommandCooldownSyncEnabled()
|
public boolean isCommandCooldownSyncEnabled()
|
||||||
{
|
{
|
||||||
return config.getBoolean("SyncCooldown", false);
|
return getConfig().getBoolean("SyncCooldown", false);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Collection<GameMode> getAllowedGameModes()
|
public Collection<GameMode> getAllowedGameModes()
|
||||||
{
|
{
|
||||||
Collection<GameMode> gameModes = new HashSet<>();
|
Collection<GameMode> gameModes = new HashSet<>();
|
||||||
for(String string : config.getStringList("AllowedGameModes", new LinkedList<>()))
|
for(String string : getConfig().getStringList("AllowedGameModes", new LinkedList<>()))
|
||||||
{
|
{
|
||||||
GameMode gm = null;
|
GameMode gm = null;
|
||||||
try
|
try
|
||||||
@ -238,51 +238,51 @@ public Collection<GameMode> getAllowedGameModes()
|
|||||||
//region Full inventory handling
|
//region Full inventory handling
|
||||||
public boolean getFullInvCollect()
|
public boolean getFullInvCollect()
|
||||||
{
|
{
|
||||||
return config.getBoolean("FullInventory.CollectItems", false);
|
return getConfig().getBoolean("FullInventory.CollectItems", false);
|
||||||
}
|
}
|
||||||
|
|
||||||
public long getFullInvCheckInterval()
|
public long getFullInvCheckInterval()
|
||||||
{
|
{
|
||||||
return config.getInt("FullInventory.CheckInterval", 1) * 20L; // in seconds
|
return getConfig().getInt("FullInventory.CheckInterval", 1) * 20L; // in seconds
|
||||||
}
|
}
|
||||||
|
|
||||||
public double getFullInvRadius()
|
public double getFullInvRadius()
|
||||||
{
|
{
|
||||||
return config.getDouble("FullInventory.CollectRadius", 1.5); // in blocks
|
return getConfig().getDouble("FullInventory.CollectRadius", 1.5); // in blocks
|
||||||
}
|
}
|
||||||
//endregion
|
//endregion
|
||||||
|
|
||||||
//region Shulkerboxes
|
//region Shulkerboxes
|
||||||
public boolean isShulkerboxesPreventInBackpackEnabled()
|
public boolean isShulkerboxesPreventInBackpackEnabled()
|
||||||
{
|
{
|
||||||
return config.getBoolean("Shulkerboxes.PreventInBackpack", true);
|
return getConfig().getBoolean("Shulkerboxes.PreventInBackpack", true);
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isShulkerboxesDisable()
|
public boolean isShulkerboxesDisable()
|
||||||
{
|
{
|
||||||
return config.getBoolean("Shulkerboxes.DisableShulkerboxes", false);
|
return getConfig().getBoolean("Shulkerboxes.DisableShulkerboxes", false);
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isShulkerboxesExistingRemoveEnabled()
|
public boolean isShulkerboxesExistingRemoveEnabled()
|
||||||
{
|
{
|
||||||
return config.getBoolean("Shulkerboxes.Existing.Remove", true);
|
return getConfig().getBoolean("Shulkerboxes.Existing.Remove", true);
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isShulkerboxesExistingDestroyEnabled()
|
public boolean isShulkerboxesExistingDestroyEnabled()
|
||||||
{
|
{
|
||||||
return config.getBoolean("Shulkerboxes.Existing.Destroy", true);
|
return getConfig().getBoolean("Shulkerboxes.Existing.Destroy", true);
|
||||||
}
|
}
|
||||||
//endregion
|
//endregion
|
||||||
|
|
||||||
//region Item filter
|
//region Item filter
|
||||||
public boolean isItemFilterEnabled()
|
public boolean isItemFilterEnabled()
|
||||||
{
|
{
|
||||||
return config.getBoolean("ItemFilter.Enable", false) || config.getBoolean("Shulkerboxes.PreventInBackpack", true);
|
return getConfig().getBoolean("ItemFilter.Enable", false) || getConfig().getBoolean("Shulkerboxes.PreventInBackpack", true);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Collection<MinecraftMaterial> getItemFilterBlacklist()
|
public Collection<MinecraftMaterial> getItemFilterBlacklist()
|
||||||
{
|
{
|
||||||
List<String> stringBlacklist = config.getStringList("ItemFilter.Blacklist", new LinkedList<>());
|
List<String> stringBlacklist = getConfig().getStringList("ItemFilter.Blacklist", new LinkedList<>());
|
||||||
Collection<MinecraftMaterial> blacklist = new LinkedList<>();
|
Collection<MinecraftMaterial> blacklist = new LinkedList<>();
|
||||||
for(String item : stringBlacklist)
|
for(String item : stringBlacklist)
|
||||||
{
|
{
|
||||||
@ -296,12 +296,12 @@ public Collection<MinecraftMaterial> getItemFilterBlacklist()
|
|||||||
//region World settings
|
//region World settings
|
||||||
public Collection<String> getWorldBlacklist()
|
public Collection<String> getWorldBlacklist()
|
||||||
{
|
{
|
||||||
return new HashSet<>(config.getStringList("WorldSettings.Blacklist", new LinkedList<>()));
|
return new HashSet<>(getConfig().getStringList("WorldSettings.Blacklist", new LinkedList<>()));
|
||||||
}
|
}
|
||||||
|
|
||||||
public WorldBlacklistMode getWorldBlacklistMode()
|
public WorldBlacklistMode getWorldBlacklistMode()
|
||||||
{
|
{
|
||||||
String mode = config.getString("WorldSettings.BlacklistMode", "Message");
|
String mode = getConfig().getString("WorldSettings.BlacklistMode", "Message");
|
||||||
WorldBlacklistMode blacklistMode = WorldBlacklistMode.Message;
|
WorldBlacklistMode blacklistMode = WorldBlacklistMode.Message;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (C) 2016-2017 GeorgH93
|
* Copyright (C) 2016-2018 GeorgH93
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
@ -85,10 +85,7 @@ public void onClick(InventoryClickEvent event)
|
|||||||
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
|
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
|
||||||
public void onPlayerLeaveEvent(PlayerQuitEvent event)
|
public void onPlayerLeaveEvent(PlayerQuitEvent event)
|
||||||
{
|
{
|
||||||
if(plugin.cooldowns.containsKey(event.getPlayer().getUniqueId()))
|
plugin.cooldowns.remove(event.getPlayer().getUniqueId());
|
||||||
{
|
|
||||||
plugin.cooldowns.remove(event.getPlayer().getUniqueId());
|
|
||||||
}
|
|
||||||
Backpack backpack = plugin.getDb().getBackpack(event.getPlayer());
|
Backpack backpack = plugin.getDb().getBackpack(event.getPlayer());
|
||||||
if(backpack != null) backpack.save();
|
if(backpack != null) backpack.save();
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user