diff --git a/src/at/pcgamingfreaks/Minepacks/Bukkit/Command/ClearCommand.java b/src/at/pcgamingfreaks/Minepacks/Bukkit/Command/ClearCommand.java index 644a1c7..4e7ca85 100644 --- a/src/at/pcgamingfreaks/Minepacks/Bukkit/Command/ClearCommand.java +++ b/src/at/pcgamingfreaks/Minepacks/Bukkit/Command/ClearCommand.java @@ -41,7 +41,7 @@ public class ClearCommand extends MinepacksCommand public ClearCommand(Minepacks plugin) { super(plugin, "clear", plugin.getLanguage().getTranslated("Commands.Description.Clean"), "backpack.clean", plugin.getLanguage().getCommandAliases("Clean")); - messageBackpackCleaned = plugin.lang.getMessage("Ingame.Clean.BackpackCleaned"); + messageBackpackCleaned = plugin.getLanguage().getMessage("Ingame.Clean.BackpackCleaned"); descriptionCleanOthers = plugin.getLanguage().getTranslated("Commands.Description.CleanOthers"); helpParam = "<" + plugin.getLanguage().get("Commands.PlayerNameVariable") + ">"; } diff --git a/src/at/pcgamingfreaks/Minepacks/Bukkit/Command/OpenCommand.java b/src/at/pcgamingfreaks/Minepacks/Bukkit/Command/OpenCommand.java index 5027cab..c36bbb3 100644 --- a/src/at/pcgamingfreaks/Minepacks/Bukkit/Command/OpenCommand.java +++ b/src/at/pcgamingfreaks/Minepacks/Bukkit/Command/OpenCommand.java @@ -41,16 +41,16 @@ public class OpenCommand extends MinepacksCommand public OpenCommand(Minepacks plugin) { - super(plugin, "open", plugin.lang.getTranslated("Commands.Description.Backpack"), "backpack.use", true, plugin.getLanguage().getCommandAliases("Open")); + super(plugin, "open", plugin.getLanguage().getTranslated("Commands.Description.Backpack"), "backpack.use", true, plugin.getLanguage().getCommandAliases("Open")); this.plugin = plugin; - messageCooldown = plugin.lang.getMessage("Ingame.Open.Cooldown").replaceAll("\\{TimeLeft}", "%1\\$.1f"); - messageWrongGameMode = plugin.lang.getMessage("Ingame.Open.WrongGameMode").replaceAll("\\{CurrentGameMode}", "%1\\$s").replaceAll("\\{AllowedGameModes}", "%1\\$s"); - descriptionOpenOthers = plugin.lang.getTranslated("Commands.Description.OpenOthers"); + messageCooldown = plugin.getLanguage().getMessage("Ingame.Open.Cooldown").replaceAll("\\{TimeLeft}", "%1\\$.1f"); + messageWrongGameMode = plugin.getLanguage().getMessage("Ingame.Open.WrongGameMode").replaceAll("\\{CurrentGameMode}", "%1\\$s").replaceAll("\\{AllowedGameModes}", "%1\\$s"); + descriptionOpenOthers = plugin.getLanguage().getTranslated("Commands.Description.OpenOthers"); helpParam = "<" + plugin.getLanguage().get("Commands.PlayerNameVariable") + ">"; - cooldown = plugin.config.getCommandCooldown(); - syncCooldown = plugin.config.isCommandCooldownSyncEnabled(); + cooldown = plugin.getConfiguration().getCommandCooldown(); + syncCooldown = plugin.getConfiguration().isCommandCooldownSyncEnabled(); StringBuilder allowedGameModesBuilder = new StringBuilder(); for(GameMode gameMode : plugin.getConfiguration().getAllowedGameModes()) diff --git a/src/at/pcgamingfreaks/Minepacks/Bukkit/Database/Database.java b/src/at/pcgamingfreaks/Minepacks/Bukkit/Database/Database.java index 37e7824..83f3b25 100644 --- a/src/at/pcgamingfreaks/Minepacks/Bukkit/Database/Database.java +++ b/src/at/pcgamingfreaks/Minepacks/Bukkit/Database/Database.java @@ -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 * it under the terms of the GNU General Public License as published by @@ -54,10 +54,10 @@ public abstract class Database implements Listener public Database(Minepacks mp) { plugin = mp; - useUUIDSeparators = plugin.config.getUseUUIDSeparators(); - useUUIDs = plugin.config.getUseUUIDs(); - bungeeCordMode = plugin.config.isBungeeCordModeEnabled(); - maxAge = plugin.config.getAutoCleanupMaxInactiveDays(); + useUUIDSeparators = plugin.getConfiguration().getUseUUIDSeparators(); + useUUIDs = plugin.getConfiguration().getUseUUIDs(); + bungeeCordMode = plugin.getConfiguration().isBungeeCordModeEnabled(); + maxAge = plugin.getConfiguration().getAutoCleanupMaxInactiveDays(); unCacheStrategie = bungeeCordMode ? new OnDisconnect(this) : UnCacheStrategie.getUnCacheStrategie(this); } @@ -77,7 +77,7 @@ public void close() public static Database getDatabase(Minepacks plugin) { Database database; - switch(plugin.config.getDatabaseType().toLowerCase()) + switch(plugin.getConfiguration().getDatabaseType().toLowerCase()) { case "mysql": database = new MySQL(plugin); break; diff --git a/src/at/pcgamingfreaks/Minepacks/Bukkit/Database/MySQL.java b/src/at/pcgamingfreaks/Minepacks/Bukkit/Database/MySQL.java index 8b228e1..eb97beb 100644 --- a/src/at/pcgamingfreaks/Minepacks/Bukkit/Database/MySQL.java +++ b/src/at/pcgamingfreaks/Minepacks/Bukkit/Database/MySQL.java @@ -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 * it under the terms of the GNU General Public License as published by @@ -37,11 +37,11 @@ public MySQL(Minepacks mp) protected HikariConfig getPoolConfig() { HikariConfig poolConfig = new HikariConfig(); - poolConfig.setJdbcUrl("jdbc:mysql://" + plugin.config.getSQLHost() + "/" + plugin.config.getSQLDatabase() + "?allowMultiQueries=true&autoReconnect=true" + plugin.config.getSQLProperties()); - poolConfig.setUsername(plugin.config.getSQLUser()); - poolConfig.setPassword(plugin.config.getSQLPassword()); + poolConfig.setJdbcUrl("jdbc:mysql://" + plugin.getConfiguration().getSQLHost() + "/" + plugin.getConfiguration().getSQLDatabase() + "?allowMultiQueries=true&autoReconnect=true" + plugin.getConfiguration().getSQLProperties()); + poolConfig.setUsername(plugin.getConfiguration().getSQLUser()); + poolConfig.setPassword(plugin.getConfiguration().getSQLPassword()); poolConfig.setMinimumIdle(1); - poolConfig.setMaximumPoolSize(plugin.config.getSQLMaxConnections()); + poolConfig.setMaximumPoolSize(plugin.getConfiguration().getSQLMaxConnections()); return poolConfig; } diff --git a/src/at/pcgamingfreaks/Minepacks/Bukkit/Database/SQL.java b/src/at/pcgamingfreaks/Minepacks/Bukkit/Database/SQL.java index 13b9d98..141ae18 100644 --- a/src/at/pcgamingfreaks/Minepacks/Bukkit/Database/SQL.java +++ b/src/at/pcgamingfreaks/Minepacks/Bukkit/Database/SQL.java @@ -103,20 +103,20 @@ public SQL(Minepacks mp) protected void loadSettings() { // Load table and field names - tablePlayers = plugin.config.getUserTable(); - tableBackpacks = plugin.config.getBackpackTable(); - tableCooldowns = plugin.config.getCooldownTable(); - fieldPlayerID = plugin.config.getDBFields("User.Player_ID", "id"); - fieldPlayerName = plugin.config.getDBFields("User.Name", "name"); - fieldPlayerUUID = plugin.config.getDBFields("User.UUID", "uuid"); - fieldBpOwner = plugin.config.getDBFields("Backpack.Owner_ID", "owner"); - fieldBpIts = plugin.config.getDBFields("Backpack.ItemStacks", "its"); - fieldBpVersion = plugin.config.getDBFields("Backpack.Version", "version"); - fieldBpLastUpdate = plugin.config.getDBFields("Backpack.LastUpdate", "lastUpdate"); - fieldCdPlayer = plugin.config.getDBFields("Cooldown.Player_ID", "id"); - fieldCdTime = plugin.config.getDBFields("Cooldown.Time", "time"); - updatePlayer = plugin.config.getUpdatePlayer(); - syncCooldown = plugin.config.isCommandCooldownSyncEnabled(); + tablePlayers = plugin.getConfiguration().getUserTable(); + tableBackpacks = plugin.getConfiguration().getBackpackTable(); + tableCooldowns = plugin.getConfiguration().getCooldownTable(); + fieldPlayerID = plugin.getConfiguration().getDBFields("User.Player_ID", "id"); + fieldPlayerName = plugin.getConfiguration().getDBFields("User.Name", "name"); + fieldPlayerUUID = plugin.getConfiguration().getDBFields("User.UUID", "uuid"); + fieldBpOwner = plugin.getConfiguration().getDBFields("Backpack.Owner_ID", "owner"); + fieldBpIts = plugin.getConfiguration().getDBFields("Backpack.ItemStacks", "its"); + fieldBpVersion = plugin.getConfiguration().getDBFields("Backpack.Version", "version"); + fieldBpLastUpdate = plugin.getConfiguration().getDBFields("Backpack.LastUpdate", "lastUpdate"); + fieldCdPlayer = plugin.getConfiguration().getDBFields("Cooldown.Player_ID", "id"); + fieldCdTime = plugin.getConfiguration().getDBFields("Cooldown.Time", "time"); + updatePlayer = plugin.getConfiguration().getUpdatePlayer(); + syncCooldown = plugin.getConfiguration().isCommandCooldownSyncEnabled(); } @Override diff --git a/src/at/pcgamingfreaks/Minepacks/Bukkit/ItemsCollector.java b/src/at/pcgamingfreaks/Minepacks/Bukkit/ItemsCollector.java index bdefdf9..8b2689a 100644 --- a/src/at/pcgamingfreaks/Minepacks/Bukkit/ItemsCollector.java +++ b/src/at/pcgamingfreaks/Minepacks/Bukkit/ItemsCollector.java @@ -37,7 +37,7 @@ public class ItemsCollector extends BukkitRunnable public ItemsCollector(Minepacks plugin) { this.plugin = plugin; - this.radius = plugin.config.getFullInvRadius(); + this.radius = plugin.getConfiguration().getFullInvRadius(); } @Override diff --git a/src/at/pcgamingfreaks/Minepacks/Bukkit/Listener/DisableShulkerboxes.java b/src/at/pcgamingfreaks/Minepacks/Bukkit/Listener/DisableShulkerboxes.java index 0159b9a..4eda2f9 100644 --- a/src/at/pcgamingfreaks/Minepacks/Bukkit/Listener/DisableShulkerboxes.java +++ b/src/at/pcgamingfreaks/Minepacks/Bukkit/Listener/DisableShulkerboxes.java @@ -65,8 +65,8 @@ public class DisableShulkerboxes extends MinepacksListener public DisableShulkerboxes(final Minepacks plugin) { super(plugin); - removeExisting = plugin.config.isShulkerboxesExistingDestroyEnabled(); - dropExistingContent = plugin.config.isShulkerboxesExistingDropEnabled(); + removeExisting = plugin.getConfiguration().isShulkerboxesExistingDestroyEnabled(); + dropExistingContent = plugin.getConfiguration().isShulkerboxesExistingDropEnabled(); } @EventHandler(ignoreCancelled = true) diff --git a/src/at/pcgamingfreaks/Minepacks/Bukkit/Listener/EventListener.java b/src/at/pcgamingfreaks/Minepacks/Bukkit/Listener/EventListener.java index aa9ebc6..c9fe358 100644 --- a/src/at/pcgamingfreaks/Minepacks/Bukkit/Listener/EventListener.java +++ b/src/at/pcgamingfreaks/Minepacks/Bukkit/Listener/EventListener.java @@ -37,8 +37,8 @@ public class EventListener extends MinepacksListener public EventListener(Minepacks plugin) { super(plugin); - messageOwnBackpackClose = plugin.lang.getMessage("Ingame.OwnBackpackClose"); - messageOtherBackpackClose = plugin.lang.getMessage("Ingame.PlayerBackpackClose").replaceAll("\\{OwnerName\\}", "%1\\$s").replaceAll("\\{OwnerDisplayName\\}", "%2\\$s"); + messageOwnBackpackClose = plugin.getLanguage().getMessage("Ingame.OwnBackpackClose"); + messageOtherBackpackClose = plugin.getLanguage().getMessage("Ingame.PlayerBackpackClose").replaceAll("\\{OwnerName\\}", "%1\\$s").replaceAll("\\{OwnerDisplayName\\}", "%2\\$s"); } @EventHandler diff --git a/src/at/pcgamingfreaks/Minepacks/Bukkit/Listener/ItemFilter.java b/src/at/pcgamingfreaks/Minepacks/Bukkit/Listener/ItemFilter.java index 52c98e2..4216ce1 100644 --- a/src/at/pcgamingfreaks/Minepacks/Bukkit/Listener/ItemFilter.java +++ b/src/at/pcgamingfreaks/Minepacks/Bukkit/Listener/ItemFilter.java @@ -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 * it under the terms of the GNU General Public License as published by @@ -53,7 +53,7 @@ public ItemFilter(final Minepacks plugin) } blockedMaterials.addAll(plugin.getConfiguration().getItemFilterBlacklist()); - messageNotAllowedInBackpack = plugin.lang.getMessage("Ingame.NotAllowedInBackpack").replaceAll("\\{ItemName}", "%s"); + messageNotAllowedInBackpack = plugin.getLanguage().getMessage("Ingame.NotAllowedInBackpack").replaceAll("\\{ItemName}", "%s"); } @EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true) diff --git a/src/at/pcgamingfreaks/Minepacks/Bukkit/Minepacks.java b/src/at/pcgamingfreaks/Minepacks/Bukkit/Minepacks.java index a1d93c3..0936212 100644 --- a/src/at/pcgamingfreaks/Minepacks/Bukkit/Minepacks.java +++ b/src/at/pcgamingfreaks/Minepacks/Bukkit/Minepacks.java @@ -65,8 +65,8 @@ public class Minepacks extends JavaPlugin implements MinepacksPlugin private static final String JENKINS_URL = "https://ci.pcgamingfreaks.at", JENKINS_JOB = "Minepacks V2"; private static Minepacks instance = null; - public Config config; //TODO Make private - public Language lang; //TODO Make private + private Config config; + private Language lang; private Database database; public final Map cooldowns = new HashMap<>();