diff --git a/resources/config.yml b/resources/config.yml index c133b10..7e4220d 100644 --- a/resources/config.yml +++ b/resources/config.yml @@ -20,6 +20,8 @@ command_cooldown: -1 drop_on_death: true # Defines if the message that the backpack has been closed should be shown show_close_message: flase +# Defines the max amount of colums for a backpack +max_size: 6 # Controlls for the auto pickup on full inventory function full_inventory: @@ -86,4 +88,4 @@ Database: auto-update: true # Config file version. Don't touch it! -Version: 11 \ No newline at end of file +Version: 12 \ No newline at end of file diff --git a/src/at/pcgamingfreaks/MinePacks/Database/Config.java b/src/at/pcgamingfreaks/MinePacks/Database/Config.java index 72c76d9..9b458d0 100644 --- a/src/at/pcgamingfreaks/MinePacks/Database/Config.java +++ b/src/at/pcgamingfreaks/MinePacks/Database/Config.java @@ -27,7 +27,7 @@ public class Config extends Configuration { - private static final int CONFIG_VERSION = 11; + private static final int CONFIG_VERSION = 12; public Config(JavaPlugin plugin) { @@ -161,6 +161,11 @@ public boolean getDropOnDeath() return config.getBoolean("drop_on_death", true); } + public int getBackpackMaxSize() + { + return config.getInt("max_size", 6); + } + public boolean getAutoUpdate() { return config.getBoolean("auto-update", true); diff --git a/src/at/pcgamingfreaks/MinePacks/MinePacks.java b/src/at/pcgamingfreaks/MinePacks/MinePacks.java index 884b5a1..67940e7 100644 --- a/src/at/pcgamingfreaks/MinePacks/MinePacks.java +++ b/src/at/pcgamingfreaks/MinePacks/MinePacks.java @@ -45,7 +45,9 @@ public class MinePacks extends JavaPlugin public HashMap cooldowns = new HashMap<>(); public static String backpackTitleOther, backpackTitle; - public String Message_InvalidBackpack; + public String messageInvalidBackpack; + + private static int maxSize; public static MinePacks getInstance() { @@ -69,7 +71,6 @@ public void onEnable() //endregion config = new Config(this); lang = new Language(this); - lang.load(config.getLanguage(), config.getLanguageUpdateMode()); DB = Database.getDatabase(this); getCommand("backpack").setExecutor(new OnCommand(this)); @@ -80,9 +81,10 @@ public void onEnable() (new ItemsCollector(this)).runTaskTimer(this, config.getFullInvCheckInterval(), config.getFullInvCheckInterval()); } + maxSize = config.getBackpackMaxSize(); backpackTitleOther = config.getBPTitleOther(); backpackTitle = Utils.limitLength(config.getBPTitle(), 32); - Message_InvalidBackpack = lang.getTranslated("Ingame.InvalidBackpack"); + messageInvalidBackpack = lang.getTranslated("Ingame.InvalidBackpack"); getServer().getServicesManager().register(MinePacks.class, this, this, ServicePriority.Normal); log.info(lang.get("Console.Enabled")); } @@ -141,7 +143,7 @@ public void openBackpack(Player opener, Backpack backpack, boolean editable) { if(backpack == null) { - opener.sendMessage(Message_InvalidBackpack); + opener.sendMessage(messageInvalidBackpack); return; } backpack.open(opener, editable); @@ -149,7 +151,7 @@ public void openBackpack(Player opener, Backpack backpack, boolean editable) public static int getBackpackPermSize(Player player) { - for(int i = 9; i > 1; i--) + for(int i = maxSize; i > 1; i--) { if(player.hasPermission("backpack.size." + i)) { diff --git a/src/at/pcgamingfreaks/MinePacks/OnCommand.java b/src/at/pcgamingfreaks/MinePacks/OnCommand.java index ec98931..9d1ac69 100644 --- a/src/at/pcgamingfreaks/MinePacks/OnCommand.java +++ b/src/at/pcgamingfreaks/MinePacks/OnCommand.java @@ -133,14 +133,14 @@ public void onResult(Backpack backpack) } else { - player.sendMessage(plugin.Message_InvalidBackpack); + player.sendMessage(plugin.messageInvalidBackpack); } } @Override public void onFail() { - player.sendMessage(plugin.Message_InvalidBackpack); + player.sendMessage(plugin.messageInvalidBackpack); } }); }