diff --git a/src/main/java/hu/jgj52/wolfFFA/Listeners/KitListener.java b/src/main/java/hu/jgj52/wolfFFA/Listeners/KitListener.java index b5c8599..cc59479 100644 --- a/src/main/java/hu/jgj52/wolfFFA/Listeners/KitListener.java +++ b/src/main/java/hu/jgj52/wolfFFA/Listeners/KitListener.java @@ -27,16 +27,17 @@ public class KitListener implements Listener { @EventHandler public void onJoin(PlayerJoinEvent event) { Player player = event.getPlayer(); - if (!player.hasPlayedBefore()) { - Map swordkit = new HashMap<>(); - swordkit.put("sword", 0); - plugin.getConfig().set("kits.sword." + player.getUniqueId(), swordkit); + if (plugin.getConfig().get("kits.sword." + player.getUniqueId()) == null) { + Map swordKit = new HashMap<>(); + swordKit.put("sword", 0); + plugin.getConfig().set("kits.sword." + player.getUniqueId(), swordKit); plugin.saveConfig(); - plugin.reloadConfig(); - Map uhcKit = new HashMap<>(); - int[] uhcshield = new int[] {13, 40}; - int[] uhcwater = new int[] {6, 22, 23, 24}; - int[] uhclava = new int[] {2, 21}; + } + if (plugin.getConfig().get("kits.uhc." + player.getUniqueId()) == null) { + Map uhcKit = new HashMap<>(); + int[] uhcshield = new int[]{13, 40}; + int[] uhcwater = new int[]{6, 22, 23, 24}; + int[] uhclava = new int[]{2, 21}; uhcKit.put("axe", 0); uhcKit.put("sword", 1); uhcKit.put("lava", uhclava); @@ -52,13 +53,14 @@ public class KitListener implements Listener { uhcKit.put("shield", uhcshield); plugin.getConfig().set("kits.uhc." + player.getUniqueId(), uhcKit); plugin.saveConfig(); - plugin.reloadConfig(); - Map boxcartKit = new HashMap<>(); - int[] boxcartstrenght = new int[] {16, 25, 34}; - int[] boxcartspeed = new int[] {17, 26, 35}; - int[] boxcartfireresistance = new int[] {18, 27}; - int[] boxcartcart = new int[] {4, 12, 21, 30, 13, 22, 31, 14, 23, 32, 15, 24, 33}; - int[] boxcartenderpearl = new int[] {2, 11, 20, 29}; + } + if (plugin.getConfig().get("kits.boxcart." + player.getUniqueId()) == null) { + Map boxcartKit = new HashMap<>(); + int[] boxcartstrenght = new int[]{16, 25, 34}; + int[] boxcartspeed = new int[]{17, 26, 35}; + int[] boxcartfireresistance = new int[]{18, 27}; + int[] boxcartcart = new int[]{4, 12, 21, 30, 13, 22, 31, 14, 23, 32, 15, 24, 33}; + int[] boxcartenderpearl = new int[]{2, 11, 20, 29}; boxcartKit.put("axe", 0); boxcartKit.put("sword", 1); boxcartKit.put("enderpearl", boxcartenderpearl); @@ -78,8 +80,8 @@ public class KitListener implements Listener { boxcartKit.put("totem", 40); plugin.getConfig().set("kits.boxcart." + player.getUniqueId(), boxcartKit); plugin.saveConfig(); - plugin.reloadConfig(); } + } @EventHandler