From c4f0ea16d1848d07534ff907829584cbc00855e8 Mon Sep 17 00:00:00 2001 From: Brianna Date: Wed, 24 Apr 2019 04:47:24 -0400 Subject: [PATCH] 1.14 Support. Fixed upgrade sound order. Fixed particle effects. --- core/pom.xml | 12 ------- .../songoda/epicfurnaces/EpicFurnaces.java | 6 ++-- .../epicfurnaces/menus/OverviewMenu.java | 6 ++-- .../epicfurnaces/objects/FurnaceObject.java | 10 +++--- .../epicfurnaces/tasks/FurnaceTask.java | 4 ++- hooks/craftbukkit-1-13/pom.xml | 29 ----------------- .../hooks/CraftBukkitHook113.java | 31 ------------------- hooks/craftbukkit-1-8/pom.xml | 27 ---------------- .../epicfurnaces/hooks/CraftBukkitHook18.java | 24 -------------- 9 files changed, 11 insertions(+), 138 deletions(-) delete mode 100644 hooks/craftbukkit-1-13/pom.xml delete mode 100644 hooks/craftbukkit-1-13/src/main/java/com/songoda/epicfurnaces/hooks/CraftBukkitHook113.java delete mode 100644 hooks/craftbukkit-1-8/pom.xml delete mode 100644 hooks/craftbukkit-1-8/src/main/java/com/songoda/epicfurnaces/hooks/CraftBukkitHook18.java diff --git a/core/pom.xml b/core/pom.xml index e53b92f..02f285d 100644 --- a/core/pom.xml +++ b/core/pom.xml @@ -92,18 +92,6 @@ 2.3.2 provided - - com.songoda - craftbukkit-1-13 - 4.1.3 - compile - - - com.songoda - craftbukkit-1-8 - 4.1.3 - compile - com.songoda askyblock diff --git a/core/src/main/java/com/songoda/epicfurnaces/EpicFurnaces.java b/core/src/main/java/com/songoda/epicfurnaces/EpicFurnaces.java index 2501c8b..8ac575b 100644 --- a/core/src/main/java/com/songoda/epicfurnaces/EpicFurnaces.java +++ b/core/src/main/java/com/songoda/epicfurnaces/EpicFurnaces.java @@ -53,7 +53,6 @@ public class EpicFurnaces extends JavaPlugin { private Storage storage; private HologramManager hologramManager; private Economy economy; - private CraftBukkitHook craftBukkitHook; private int currentVersion; @Override @@ -264,7 +263,6 @@ public class EpicFurnaces extends JavaPlugin { private boolean checkVersion() { String version = getServer().getClass().getPackage().getName().split("\\.")[3]; currentVersion = Integer.parseInt(version.split("_")[1]); - craftBukkitHook = currentVersion >= 13 ? new CraftBukkitHook113() : new CraftBukkitHook18(); int workingVersion = 8; if (currentVersion < workingVersion) { @@ -342,7 +340,7 @@ public class EpicFurnaces extends JavaPlugin { return economy; } - public CraftBukkitHook getCraftBukkitHook() { - return craftBukkitHook; + public int getCurrentVersion() { + return currentVersion; } } \ No newline at end of file diff --git a/core/src/main/java/com/songoda/epicfurnaces/menus/OverviewMenu.java b/core/src/main/java/com/songoda/epicfurnaces/menus/OverviewMenu.java index db01c73..52f5a98 100644 --- a/core/src/main/java/com/songoda/epicfurnaces/menus/OverviewMenu.java +++ b/core/src/main/java/com/songoda/epicfurnaces/menus/OverviewMenu.java @@ -53,8 +53,6 @@ public class OverviewMenu extends FastInv { for (String line : parts) { currentLevel.addLore(StringUtils.formatText(line)); } - - } fill(Methods.getGlass()); @@ -199,13 +197,13 @@ public class OverviewMenu extends FastInv { if (instance.getConfig().getBoolean("Main.Upgrade With XP") && accessor.hasPermission("EpicFurnaces.Upgrade.XP")) { addItem(11, xp.build(), event -> { furnace.upgrade("XP", event.getPlayer()); - event.getPlayer().closeInventory(); + furnace.openOverview(event.getPlayer()); }); } if (instance.getConfig().getBoolean("Main.Upgrade With Economy") && accessor.hasPermission("EpicFurnaces.Upgrade.ECO")) { addItem(15, eco.build(), event -> { furnace.upgrade("ECO", event.getPlayer()); - event.getPlayer().closeInventory(); + furnace.openOverview(event.getPlayer()); }); } diff --git a/core/src/main/java/com/songoda/epicfurnaces/objects/FurnaceObject.java b/core/src/main/java/com/songoda/epicfurnaces/objects/FurnaceObject.java index bb62111..ca93b95 100644 --- a/core/src/main/java/com/songoda/epicfurnaces/objects/FurnaceObject.java +++ b/core/src/main/java/com/songoda/epicfurnaces/objects/FurnaceObject.java @@ -110,10 +110,6 @@ public class FurnaceObject { BoostData boostData = instance.getBoostManager().getBoost(placedBy); r = r * (boostData == null ? 1 : boostData.getMultiplier()); - if (e.getResult() == null) { - return; - } - e.getResult().setAmount(e.getResult().getAmount() + r); } @@ -155,10 +151,12 @@ public class FurnaceObject { } Location loc = location.clone().add(.5, .5, .5); - instance.getCraftBukkitHook().broadcastParticle(loc, instance.getConfig().getString("Main.Upgrade Particle Type"), 200); + + if (instance.getCurrentVersion() > 8) + location.getWorld().spawnParticle(Particle.valueOf(instance.getConfig().getString("Main.Upgrade Particle Type")), loc.getX(), loc.getY(), loc.getZ(), 200, .5, .5, .5); if (instance.getConfig().getBoolean("Main.Sounds Enabled")) { - if (instance.getLevelManager().getHighestLevel() == level) { + if (instance.getLevelManager().getHighestLevel() != level) { player.playSound(player.getLocation(), instance.getBukkitEnums().getSound("ENTITY_PLAYER_LEVELUP"), 0.6F, 15.0F); } else { player.playSound(player.getLocation(), instance.getBukkitEnums().getSound("ENTITY_PLAYER_LEVELUP"), 2F, 25.0F); diff --git a/core/src/main/java/com/songoda/epicfurnaces/tasks/FurnaceTask.java b/core/src/main/java/com/songoda/epicfurnaces/tasks/FurnaceTask.java index 11efc2e..97cec2f 100644 --- a/core/src/main/java/com/songoda/epicfurnaces/tasks/FurnaceTask.java +++ b/core/src/main/java/com/songoda/epicfurnaces/tasks/FurnaceTask.java @@ -5,6 +5,7 @@ import com.songoda.epicfurnaces.objects.FurnaceObject; import com.songoda.epicfurnaces.objects.FurnaceObject.BoostType; import org.bukkit.Location; import org.bukkit.Material; +import org.bukkit.Particle; import org.bukkit.block.Block; import org.bukkit.block.BlockFace; import org.bukkit.block.Furnace; @@ -163,7 +164,8 @@ public class FurnaceTask extends BukkitRunnable { private void broadcastParticles(Location location) { if (instance.getConfig().getBoolean("Main.Overheat Particles")) { - instance.getCraftBukkitHook().broadcastParticle(location, "SMOKE", 25, "SMOKE_NORMAL"); + if (instance.getCurrentVersion() > 8) + location.getWorld().spawnParticle(Particle.SMOKE_NORMAL, location.getX(), location.getY(), location.getZ(), 25, 0, 0, 0, 0); } } } \ No newline at end of file diff --git a/hooks/craftbukkit-1-13/pom.xml b/hooks/craftbukkit-1-13/pom.xml deleted file mode 100644 index 1de1a93..0000000 --- a/hooks/craftbukkit-1-13/pom.xml +++ /dev/null @@ -1,29 +0,0 @@ - - - - hooks - com.songoda - 4.1.3 - - 4.0.0 - - craftbukkit-1-13 - - - com.songoda - manager - 4.1.3 - compile - - - org.spigotmc - spigot - 1.13.2 - provided - - - - - \ No newline at end of file diff --git a/hooks/craftbukkit-1-13/src/main/java/com/songoda/epicfurnaces/hooks/CraftBukkitHook113.java b/hooks/craftbukkit-1-13/src/main/java/com/songoda/epicfurnaces/hooks/CraftBukkitHook113.java deleted file mode 100644 index c67adef..0000000 --- a/hooks/craftbukkit-1-13/src/main/java/com/songoda/epicfurnaces/hooks/CraftBukkitHook113.java +++ /dev/null @@ -1,31 +0,0 @@ -package com.songoda.epicfurnaces.hooks; - -import org.bukkit.Effect; -import org.bukkit.Location; -import org.bukkit.Particle; -import org.bukkit.craftbukkit.v1_13_R2.CraftWorld; - -public class CraftBukkitHook113 implements CraftBukkitHook { - @Override - public void broadcastParticle(Location location, String name, int amount, String... optional) { - if (optional.length != 0) { - try { - ((CraftWorld) location.getWorld()).spawnParticle(Particle.valueOf(optional[0]), location.getX(), location.getY(), location.getZ(), amount, 0, 0, 0, 0); - return; - } catch (Exception ignore) { - } - } - - try { - location.getWorld().playEffect(location, Effect.valueOf(name), amount); - return; - } catch (Exception ignore) { - } - - try { - ((CraftWorld) location.getWorld()).spawnParticle(Particle.valueOf(name), location.getX(), location.getY(), location.getZ(), amount, 0, 0, 0, 0); - } catch (Exception ignore) { - } - - } -} diff --git a/hooks/craftbukkit-1-8/pom.xml b/hooks/craftbukkit-1-8/pom.xml deleted file mode 100644 index 94e2a65..0000000 --- a/hooks/craftbukkit-1-8/pom.xml +++ /dev/null @@ -1,27 +0,0 @@ - - - - hooks - com.songoda - 4.1.3 - - 4.0.0 - - craftbukkit-1-8 - - - com.songoda - manager - 4.1.3 - compile - - - org.spigotmc - spigot - 1.8.8 - provided - - - \ No newline at end of file diff --git a/hooks/craftbukkit-1-8/src/main/java/com/songoda/epicfurnaces/hooks/CraftBukkitHook18.java b/hooks/craftbukkit-1-8/src/main/java/com/songoda/epicfurnaces/hooks/CraftBukkitHook18.java deleted file mode 100644 index 8fe707c..0000000 --- a/hooks/craftbukkit-1-8/src/main/java/com/songoda/epicfurnaces/hooks/CraftBukkitHook18.java +++ /dev/null @@ -1,24 +0,0 @@ -package com.songoda.epicfurnaces.hooks; - -import org.bukkit.Effect; -import org.bukkit.Location; - -public class CraftBukkitHook18 implements CraftBukkitHook { - @Override - public void broadcastParticle(Location location, String name, int amount, String... optional) { - if (Effect.getByName(name) == null) { - return; - } - - String[] split = name.split("_"); - String type; - - if (split.length != 1 && Effect.getByName(name.split("_")[0]) != null) { - type = name.split("_")[0]; - } else { - type = name; - } - - location.getWorld().playEffect(location, Effect.getByName(type), amount); - } -}