mirror of
https://github.com/GeorgH93/Minepacks.git
synced 2024-11-14 10:45:23 +01:00
New upgrade code
This commit is contained in:
parent
53f27ee07a
commit
886b73de28
@ -16,6 +16,8 @@ command_cooldown: -1
|
||||
# Defines if the content of the backpack get droped on the death of a player.
|
||||
# If enabled, it can be disabled for individual players with the "backpack.KeepOnDeath" permission.
|
||||
drop_on_death: true
|
||||
# Defines if the message that the backpack has been closed should be shown
|
||||
show_close_message: true
|
||||
|
||||
# Controlls for the auto pickup on full inventory function
|
||||
full_inventory:
|
||||
|
@ -23,6 +23,8 @@
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.plugin.java.JavaPlugin;
|
||||
|
||||
import java.util.Set;
|
||||
|
||||
public class Config extends Configuration
|
||||
{
|
||||
private static final int CONFIG_VERSION = 9;
|
||||
@ -45,6 +47,18 @@ protected void doUpdate(int version)
|
||||
// Nothing to update yet
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void doUpgrade(Configuration oldConfiguration)
|
||||
{
|
||||
Set<String> keys = oldConfiguration.getConfig().getKeys(true);
|
||||
for(String key : keys)
|
||||
{
|
||||
if(key.equals("Database.UseUUIDs") || key.equals("UseUUIDs")) continue;
|
||||
config.set(key, oldConfiguration.getConfig().get(key));
|
||||
}
|
||||
config.set("Database.UseUUIDs", Bukkit.getServer().getOnlineMode() && isBukkitVersionUUIDCompatible());
|
||||
}
|
||||
|
||||
// Getter
|
||||
public int getAutoCleanupMaxInactiveDays()
|
||||
{
|
||||
@ -96,13 +110,9 @@ public boolean getUpdatePlayer()
|
||||
return config.getBoolean("Database.UpdatePlayer", true);
|
||||
}
|
||||
|
||||
public boolean UseUUIDs()
|
||||
public boolean getUseUUIDs()
|
||||
{
|
||||
if(config.isSet("Database.UseUUIDs"))
|
||||
{
|
||||
return config.getBoolean("Database.UseUUIDs");
|
||||
}
|
||||
return config.getBoolean("UseUUIDs");
|
||||
return config.getBoolean("Database.UseUUIDs");
|
||||
}
|
||||
|
||||
public boolean getUseUUIDSeparators()
|
||||
|
@ -40,7 +40,7 @@ public Database(MinePacks mp)
|
||||
{
|
||||
plugin = mp;
|
||||
UseUUIDSeparators = plugin.config.getUseUUIDSeparators();
|
||||
UseUUIDs = plugin.config.UseUUIDs();
|
||||
UseUUIDs = plugin.config.getUseUUIDs();
|
||||
maxAge = plugin.config.getAutoCleanupMaxInactiveDays();
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user