From fb03e9adecf36085782f4238ea88dd5f27f0d9e1 Mon Sep 17 00:00:00 2001 From: LCastr0 Date: Wed, 26 Apr 2017 11:14:43 -0300 Subject: [PATCH] Respawn holograms since setText doesn't work, and actually send the correct information to the event --- .../gadget/gadgets/particle/king/CastleManager.java | 12 ++++++++---- .../gadget/gadgets/particle/king/ParticleKing.java | 7 +++++-- 2 files changed, 13 insertions(+), 6 deletions(-) diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/particle/king/CastleManager.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/particle/king/CastleManager.java index d81419bcd..b9ee81ca9 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/particle/king/CastleManager.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/particle/king/CastleManager.java @@ -175,16 +175,20 @@ public class CastleManager extends MiniPlugin */ private void updateHologram() { - if (_hologram == null) - return; + if (_hologram != null) + { + _hologram.stop(); + } if (_king != null && _king.getKing().isOnline()) { - _hologram.setText("Mineplex Castle", "Current King: " + F.name(_king.getKing().getName()) + "!"); + _hologram = new Hologram(_hologramManager, _hologramLocation, "Mineplex Castle", "Current King: " + F.name(_king.getKing().getName()) + "!"); + _hologram.start(); } else { - _hologram.setText("Mineplex Castle", "Current King: " + F.name("No one") + "!"); + _hologram = new Hologram(_hologramManager, _hologramLocation, "Mineplex Castle", "Current King: " + F.name("No one") + "!"); + _hologram.start(); } } } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/particle/king/ParticleKing.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/particle/king/ParticleKing.java index ea6fc2e0d..8598ef2da 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/particle/king/ParticleKing.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/particle/king/ParticleKing.java @@ -200,6 +200,9 @@ public class ParticleKing extends ParticleGadget { if (_kings.size() == 0) return null; + else if (_kings.size() == 1) + return _kings.get(0); + King lobbyKing = null; int peasants = 0; for (King king : _kings) @@ -222,11 +225,11 @@ public class ParticleKing extends ParticleGadget { if (!king.equals(oldKing)) { - Bukkit.getPluginManager().callEvent(new UpdateKingEvent(oldKing, king)); + Bukkit.getPluginManager().callEvent(new UpdateKingEvent(king, oldKing)); } } else { - Bukkit.getPluginManager().callEvent(new UpdateKingEvent(oldKing, king)); + Bukkit.getPluginManager().callEvent(new UpdateKingEvent(king, oldKing)); } } }