Respawn holograms since setText doesn't work, and actually send the correct information to the event

This commit is contained in:
LCastr0 2017-04-26 11:14:43 -03:00
parent 56f19ec937
commit fb03e9adec
2 changed files with 13 additions and 6 deletions

View File

@ -175,16 +175,20 @@ public class CastleManager extends MiniPlugin
*/ */
private void updateHologram() private void updateHologram()
{ {
if (_hologram == null) if (_hologram != null)
return; {
_hologram.stop();
}
if (_king != null && _king.getKing().isOnline()) 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 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();
} }
} }
} }

View File

@ -200,6 +200,9 @@ public class ParticleKing extends ParticleGadget
{ {
if (_kings.size() == 0) if (_kings.size() == 0)
return null; return null;
else if (_kings.size() == 1)
return _kings.get(0);
King lobbyKing = null; King lobbyKing = null;
int peasants = 0; int peasants = 0;
for (King king : _kings) for (King king : _kings)
@ -222,11 +225,11 @@ public class ParticleKing extends ParticleGadget
{ {
if (!king.equals(oldKing)) if (!king.equals(oldKing))
{ {
Bukkit.getPluginManager().callEvent(new UpdateKingEvent(oldKing, king)); Bukkit.getPluginManager().callEvent(new UpdateKingEvent(king, oldKing));
} }
} else } else
{ {
Bukkit.getPluginManager().callEvent(new UpdateKingEvent(oldKing, king)); Bukkit.getPluginManager().callEvent(new UpdateKingEvent(king, oldKing));
} }
} }
} }