Rename database getter

This commit is contained in:
GeorgH93 2018-06-04 17:18:14 +02:00
parent b6a8d372f5
commit 042941a4e7
No known key found for this signature in database
GPG Key ID: D1630D37F9E4B3C8
4 changed files with 7 additions and 12 deletions

View File

@ -231,7 +231,7 @@ public void save()
{
if(hasChanged())
{
Minepacks.getInstance().getDb().saveBackpack(this);
Minepacks.getInstance().getDatabase().saveBackpack(this);
hasChanged = false;
}
}

View File

@ -108,7 +108,7 @@ public boolean onCommand(CommandSender sender, Command cmd, String arg, String[]
final long cooldownTime = System.currentTimeMillis() + cooldown;
if(syncCooldown)
{
plugin.getDb().syncCooldown(player, cooldownTime);
plugin.getDatabase().syncCooldown(player, cooldownTime);
}
plugin.cooldowns.put(player.getUniqueId(), cooldownTime);
}

View File

@ -86,7 +86,7 @@ public void onClick(InventoryClickEvent event)
public void onPlayerLeaveEvent(PlayerQuitEvent event)
{
plugin.cooldowns.remove(event.getPlayer().getUniqueId());
Backpack backpack = plugin.getDb().getBackpack(event.getPlayer());
Backpack backpack = plugin.getDatabase().getBackpack(event.getPlayer());
if(backpack != null) backpack.save();
}
}

View File

@ -185,6 +185,7 @@ private void unload()
getServer().getScheduler().cancelTasks(this); // Kill all running task
database.close(); // Close the DB connection, we won't need them any longer
instance = null;
cooldowns.clear();
}
public void reload()
@ -208,7 +209,7 @@ public Config getConfiguration()
return config;
}
public Database getDb()
public Database getDatabase()
{
return database;
}
@ -268,10 +269,7 @@ public int getBackpackPermSize(Player player)
{
for(int i = maxSize; i > 1; i--)
{
if(player.hasPermission("backpack.size." + i))
{
return i * 9;
}
if(player.hasPermission("backpack.size." + i)) return i * 9;
}
return 9;
}
@ -279,10 +277,7 @@ public int getBackpackPermSize(Player player)
public WorldBlacklistMode isDisabled(Player player)
{
if(worldBlacklistMode == WorldBlacklistMode.None || (worldBlacklistMode != WorldBlacklistMode.NoPlugin && player.hasPermission("backpack.ignoreWorldBlacklist"))) return WorldBlacklistMode.None;
if(worldBlacklist.contains(player.getWorld().getName().toLowerCase()))
{
return worldBlacklistMode;
}
if(worldBlacklist.contains(player.getWorld().getName().toLowerCase())) return worldBlacklistMode;
return WorldBlacklistMode.None;
}
}