diff --git a/plugin/pom.xml b/plugin/pom.xml index 61904b7..e3927d2 100644 --- a/plugin/pom.xml +++ b/plugin/pom.xml @@ -20,11 +20,16 @@ ${minecraft.version}-${bukkit.version}-SNAPSHOT provided - + + org.spigotmc + spigot + 1.12-R0.1-SNAPSHOT + provided + org.bukkit - bukkit - ${minecraft.version}-${bukkit.version}-SNAPSHOT + craftbukkit + 1.12-R0.1-SNAPSHOT provided @@ -55,11 +60,11 @@ + org.apache.maven.plugins maven-compiler-plugin - 3.1 - 1.7 - 1.7 + 1.8 + 1.8 diff --git a/plugin/src/main/java/cz/boosik/boosCooldown/Managers/BoosConfigManager.java b/plugin/src/main/java/cz/boosik/boosCooldown/Managers/BoosConfigManager.java index 63cff09..148ac17 100644 --- a/plugin/src/main/java/cz/boosik/boosCooldown/Managers/BoosConfigManager.java +++ b/plugin/src/main/java/cz/boosik/boosCooldown/Managers/BoosConfigManager.java @@ -3,7 +3,9 @@ package cz.boosik.boosCooldown.Managers; import java.io.File; import java.io.FileNotFoundException; import java.io.IOException; +import java.util.HashMap; import java.util.List; +import java.util.Map; import java.util.Set; import java.util.UUID; @@ -313,30 +315,19 @@ public class BoosConfigManager { return conf.getString("options.messages.paid_for_command", "Price of &command& was %s and you now have %s"); } - static String getPotionEffect(String regexCommand, Player player) { - String effect = ""; - String temp; - String[] command; + static Map getPotionEffects(String regexCommand, Player player) { String group = getCommandGroup(player); - temp = conf.getString("commands.groups." + group + "." + regexCommand + ".potion", ""); - command = temp.split(","); - if (command.length == 2) { - effect = command[0]; - } - return effect; - } + Map result = new HashMap<>(); + List temp = conf.getStringList("commands.groups." + group + "." + regexCommand + ".potion"); + temp.forEach(entry -> { + String[] item; + item = entry.split(","); + if (item.length == 2) { + result.put(item[0], Integer.valueOf(item[1])); + } + }); - static int getPotionEffectStrength(String regexCommand, Player player) { - int effect = 0; - String temp; - String[] command; - String group = getCommandGroup(player); - temp = conf.getString("commands.groups." + group + "." + regexCommand + ".potion", ""); - command = temp.split(","); - if (command.length == 2) { - effect = Integer.valueOf(command[1]); - } - return effect; + return result; } public static double getPrice(String regexCommand, Player player) { diff --git a/plugin/src/main/java/cz/boosik/boosCooldown/Managers/BoosWarmUpManager.java b/plugin/src/main/java/cz/boosik/boosCooldown/Managers/BoosWarmUpManager.java index 49adc18..8df5e0d 100644 --- a/plugin/src/main/java/cz/boosik/boosCooldown/Managers/BoosWarmUpManager.java +++ b/plugin/src/main/java/cz/boosik/boosCooldown/Managers/BoosWarmUpManager.java @@ -16,21 +16,13 @@ public class BoosWarmUpManager { private static final ConcurrentHashMap playercommands = new ConcurrentHashMap<>(); - private static void applyPotionEffect(Player player, String regexCommand, - int warmUpSeconds) { - String potion = BoosConfigManager.getPotionEffect(regexCommand, player); - if (potion.equals("")) { - return; - } - int potionStrength = BoosConfigManager.getPotionEffectStrength( - regexCommand, player); - if (potionStrength == 0) { - return; - } - PotionEffectType effect = PotionEffectType.getByName(potion); - player.addPotionEffect( - effect.createEffect(warmUpSeconds * 40, potionStrength - 1), - true); + private static void applyPotionEffect(Player player, String regexCommand, int warmUpSeconds) { + BoosConfigManager.getPotionEffects(regexCommand, player).forEach((potion, potionStrength) -> { + PotionEffectType effect = PotionEffectType.getByName(potion); + player.addPotionEffect( + effect.createEffect(warmUpSeconds * 20, potionStrength - 1), + true); + }); } public static void cancelWarmUps(Player player) { diff --git a/plugin/src/main/resources/config.yml b/plugin/src/main/resources/config.yml index e99d1fb..c002cda 100644 --- a/plugin/src/main/resources/config.yml +++ b/plugin/src/main/resources/config.yml @@ -147,7 +147,9 @@ commands: price: 10.0 limit: 5 #potion effect and its strength that will affect player for the warmup time (5 seconds here) has to be one from this list: https://hub.spigotmc.org/javadocs/spigot/org/bukkit/potion/PotionEffectType.html - potion: WEAKNESS,3 + potion: + - WEAKNESS,3 + - SLOW,5 /test: #message that is sent to player when he uses this command message: You just used /test! diff --git a/plugin/src/main/resources/plugin.yml b/plugin/src/main/resources/plugin.yml index 54891c0..4ec9f2d 100644 --- a/plugin/src/main/resources/plugin.yml +++ b/plugin/src/main/resources/plugin.yml @@ -1,6 +1,6 @@ name: boosCooldowns main: cz.boosik.boosCooldown.BoosCoolDown -version: 3.13.4 +version: 3.14.0 authors: [LordBoos (boosik)] softdepend: [Vault, PlayerPoints] description: > diff --git a/pom.xml b/pom.xml index 72f348d..e07bd71 100644 --- a/pom.xml +++ b/pom.xml @@ -11,12 +11,12 @@ pom http://maven.apache.org - 3.13.4 + 3.14.0 UTF-8 UTF-8 - 1.11 + 1.12 R0.1 - v1_11_R1 + v1_12_R1 @@ -45,9 +45,13 @@ http://nexus.hc.to/content/repositories/pub_releases - spigot-repo + spigot-repo-old http://repo.md-5.net/content/repositories/snapshots/ + + spigot-repo + https://hub.spigotmc.org/nexus/content/repositories/snapshots/ + elmakers-spigot-repo http://maven.elmakers.com/repository/