From ad58d7b609b64b2d9361863d961c46edb0bbcbd4 Mon Sep 17 00:00:00 2001 From: Sn0wStorm Date: Thu, 4 Jul 2019 16:28:44 +0200 Subject: [PATCH] Potion Effects have different durations now --- resources/plugin.yml | 2 +- src/com/dre/brewery/BEffect.java | 4 +++- src/com/dre/brewery/BIngredients.java | 1 + src/com/dre/brewery/BPlayer.java | 32 ++++++++++++++++++--------- src/com/dre/brewery/BRecipe.java | 1 + src/com/dre/brewery/Brew.java | 6 ++++- 6 files changed, 33 insertions(+), 13 deletions(-) diff --git a/resources/plugin.yml b/resources/plugin.yml index b024677..46c4e30 100644 --- a/resources/plugin.yml +++ b/resources/plugin.yml @@ -1,5 +1,5 @@ name: Brewery -version: 1.7.1 +version: 1.7.2 main: com.dre.brewery.P softdepend: [LWC, LogBlock, WorldGuard, GriefPrevention, Vault, Citadel] authors: [Milan Albrecht, Frank Baumann, ProgrammerDan, Daniel Saukel] diff --git a/src/com/dre/brewery/BEffect.java b/src/com/dre/brewery/BEffect.java index 9e4fcc7..39e68f1 100644 --- a/src/com/dre/brewery/BEffect.java +++ b/src/com/dre/brewery/BEffect.java @@ -90,7 +90,9 @@ public class BEffect { } duration *= 20; - duration /= type.getDurationModifier(); + if (!P.use1_14) { + duration /= type.getDurationModifier(); + } type.createEffect(duration, lvl - 1).apply(player); } diff --git a/src/com/dre/brewery/BIngredients.java b/src/com/dre/brewery/BIngredients.java index cb249ed..6034d34 100644 --- a/src/com/dre/brewery/BIngredients.java +++ b/src/com/dre/brewery/BIngredients.java @@ -110,6 +110,7 @@ public class BIngredients { potionMeta.setDisplayName(P.p.color("&f" + cookedName)); if (!P.use1_14) { // Before 1.14 the effects duration would strangely be only a quarter of what we tell it to be + // This is due to the Duration Modifier, that is removed in 1.14 uid *= 4; } // This effect stores the UID in its Duration diff --git a/src/com/dre/brewery/BPlayer.java b/src/com/dre/brewery/BPlayer.java index aca7864..bbd9fae 100644 --- a/src/com/dre/brewery/BPlayer.java +++ b/src/com/dre/brewery/BPlayer.java @@ -469,11 +469,14 @@ public class BPlayer { public void drunkEffects(Player player) { int duration = 10 - getQuality(); duration += drunkeness / 2; - duration *= 20; - if (duration > 960) { + duration *= 5; + if (duration > 240) { duration *= 5; - } else if (duration < 460) { - duration = 460; + } else if (duration < 115) { + duration = 115; + } + if (!P.use1_14) { + duration *= 4; } PotionEffectType.CONFUSION.createEffect(duration, 0).apply(player); } @@ -481,15 +484,18 @@ public class BPlayer { public static void addQualityEffects(int quality, int brewAlc, Player player) { int duration = 7 - quality; if (quality == 0) { - duration *= 500; + duration *= 125; } else if (quality <= 5) { - duration *= 250; + duration *= 62; } else { - duration = 100; + duration = 25; if (brewAlc <= 10) { duration = 0; } } + if (!P.use1_14) { + duration *= 4; + } if (duration > 0) { PotionEffectType.POISON.createEffect(duration, 0).apply(player); } @@ -498,9 +504,12 @@ public class BPlayer { if (quality <= 5) { duration = 10 - quality; duration += brewAlc; - duration *= 60; + duration *= 15; } else { - duration = 120; + duration = 30; + } + if (!P.use1_14) { + duration *= 4; } PotionEffectType.BLINDNESS.createEffect(duration, 0).apply(player); } @@ -516,7 +525,10 @@ public class BPlayer { } public void hangoverEffects(final Player player) { - int duration = offlineDrunk * 50 * getHangoverQuality(); + int duration = offlineDrunk * 25 * getHangoverQuality(); + if (!P.use1_14) { + duration *= 2; + } int amplifier = getHangoverQuality() / 3; PotionEffectType.SLOW.createEffect(duration, amplifier).apply(player); diff --git a/src/com/dre/brewery/BRecipe.java b/src/com/dre/brewery/BRecipe.java index 64716c3..8978a1d 100644 --- a/src/com/dre/brewery/BRecipe.java +++ b/src/com/dre/brewery/BRecipe.java @@ -267,6 +267,7 @@ public class BRecipe { potionMeta.setDisplayName(P.p.color("&f" + getName(quality))); if (!P.use1_14) { // Before 1.14 the effects duration would strangely be only a quarter of what we tell it to be + // This is due to the Duration Modifier, that is removed in 1.14 uid *= 4; } // This effect stores the UID in its Duration diff --git a/src/com/dre/brewery/Brew.java b/src/com/dre/brewery/Brew.java index 4bc312a..c26fa3c 100644 --- a/src/com/dre/brewery/Brew.java +++ b/src/com/dre/brewery/Brew.java @@ -160,7 +160,11 @@ public class Brew { int uid = generateUID(); clone(uid); PotionMeta meta = (PotionMeta) copy.getItemMeta(); - meta.addCustomEffect((PotionEffectType.REGENERATION).createEffect((uid * 4), 0), true); + if (!P.use1_14) { + // This is due to the Duration Modifier, that is removed in 1.14 + uid *= 4; + } + meta.addCustomEffect((PotionEffectType.REGENERATION).createEffect(uid, 0), true); copy.setItemMeta(meta); return copy; }