add 'time till despawn' hologram on outposts and the owner clan of the outpopsts above doors
This commit is contained in:
parent
205e3885b8
commit
deb22fd4e7
@ -44,6 +44,7 @@ import mineplex.core.common.util.UtilPlayer;
|
||||
import mineplex.core.common.util.UtilServer;
|
||||
import mineplex.core.common.util.UtilText;
|
||||
import mineplex.core.common.util.UtilTextMiddle;
|
||||
import mineplex.core.common.util.UtilTime;
|
||||
import mineplex.core.hologram.Hologram;
|
||||
import mineplex.core.itemstack.ItemBuilder;
|
||||
import mineplex.core.updater.UpdateType;
|
||||
@ -100,6 +101,8 @@ public class Outpost implements Listener
|
||||
|
||||
private List<Hologram> _nameHolograms;
|
||||
|
||||
private Hologram _lifetimeLeft;
|
||||
|
||||
public Outpost(OutpostManager outpostManager, OutpostToken token)
|
||||
{
|
||||
_outpostManager = outpostManager;
|
||||
@ -127,6 +130,8 @@ public class Outpost implements Listener
|
||||
_preHologram = new Hologram(outpostManager.getClansManager().getHologramManager(), _origin.clone().add(0.5, 2.3, 0.5), F.elem(_ownerClan.getName()) + C.cWhite + "'s Outpost block (Right-Click to activate)");
|
||||
_preHologram2 = new Hologram(outpostManager.getClansManager().getHologramManager(), _origin.clone().add(0.5, 3, 0.5), "Despawning: " + UtilText.getProgress(null, 0, null, true));
|
||||
|
||||
_lifetimeLeft = new Hologram(outpostManager.getClansManager().getHologramManager(), _origin.clone().add(0.5, 1.5, 0.5), "Despawning in " + F.time(UtilTime.MakeStr(MAX_LIFETIME)));
|
||||
|
||||
if (token.OutpostState == OutpostState.AWAITING)
|
||||
{
|
||||
_preHologram.start();
|
||||
@ -151,6 +156,8 @@ public class Outpost implements Listener
|
||||
_nameHolograms.add(new Hologram(outpostManager.getClansManager().getHologramManager(), _origin.clone().subtract(0, -2, (_type._size / 2) + 1), C.cGreen + _ownerClan.getName()));
|
||||
|
||||
_nameHolograms.forEach(Hologram::start);
|
||||
|
||||
_lifetimeLeft.start();
|
||||
}
|
||||
}
|
||||
|
||||
@ -175,6 +182,7 @@ public class Outpost implements Listener
|
||||
_timeSpawned = System.currentTimeMillis();
|
||||
|
||||
_core = _type.getCoreLocation(_origin);
|
||||
_nameHolograms = new ArrayList<>();
|
||||
|
||||
_preHologram = new Hologram(_ownerClan.Clans.getHologramManager(), _origin.clone().add(0.5, 2.3, 0.5), F.elem(_ownerClan.getName()) + C.cWhite + "'s Outpost block (Right-Click to activate)");
|
||||
_preHologram2 = new Hologram(_ownerClan.Clans.getHologramManager(), _origin.clone().add(0.5, 3, 0.5), "Despawning: " + UtilText.getProgress(null, 0, null, true));
|
||||
@ -194,10 +202,12 @@ public class Outpost implements Listener
|
||||
|
||||
UtilServer.registerEvents(this);
|
||||
|
||||
_nameHolograms.add(new Hologram(outpostManager.getClansManager().getHologramManager(), _origin.clone().add((_type._size / 2) + 1, 2, 0), C.cGreen + _ownerClan.getName()));
|
||||
_nameHolograms.add(new Hologram(outpostManager.getClansManager().getHologramManager(), _origin.clone().subtract((_type._size / 2) + 1, -2, 0), C.cGreen + _ownerClan.getName()));
|
||||
_nameHolograms.add(new Hologram(outpostManager.getClansManager().getHologramManager(), _origin.clone().add(0, 2, (_type._size / 2) + 1), C.cGreen + _ownerClan.getName()));
|
||||
_nameHolograms.add(new Hologram(outpostManager.getClansManager().getHologramManager(), _origin.clone().subtract(0, -2, (_type._size / 2) + 1), C.cGreen + _ownerClan.getName()));
|
||||
_lifetimeLeft = new Hologram(outpostManager.getClansManager().getHologramManager(), _origin.clone().add(0.5, 1.5, 0.5), "Despawning in " + F.time(UtilTime.MakeStr(MAX_LIFETIME)));
|
||||
|
||||
_nameHolograms.add(new Hologram(outpostManager.getClansManager().getHologramManager(), _origin.clone().add((_type._size / 2) + 1, 2, 0).add(1, 0, 0).add(.5, 0, .5), C.cGreen + _ownerClan.getName()));
|
||||
_nameHolograms.add(new Hologram(outpostManager.getClansManager().getHologramManager(), _origin.clone().subtract((_type._size / 2) + 1, -2, 0).subtract(1, 0, 0).add(.5, 0, .5), C.cGreen + _ownerClan.getName()));
|
||||
_nameHolograms.add(new Hologram(outpostManager.getClansManager().getHologramManager(), _origin.clone().add(0, 2, (_type._size / 2) + 1).add(0, 0, 1).add(.5, 0, .5), C.cGreen + _ownerClan.getName()));
|
||||
_nameHolograms.add(new Hologram(outpostManager.getClansManager().getHologramManager(), _origin.clone().subtract(0, -2, (_type._size / 2) + 1).subtract(0, 0, 1).add(.5, 0, .5), C.cGreen + _ownerClan.getName()));
|
||||
}
|
||||
|
||||
private void cleanup()
|
||||
@ -394,6 +404,11 @@ public class Outpost implements Listener
|
||||
return;
|
||||
}
|
||||
|
||||
if (_lifetimeLeft != null)
|
||||
{
|
||||
_lifetimeLeft.setText("Despawning in " + F.time(UtilTime.MakeStr(MAX_LIFETIME - (System.currentTimeMillis() - _timeSpawned))));
|
||||
}
|
||||
|
||||
if (_state == OutpostState.CONSTRUCTING)
|
||||
{
|
||||
if (_buildQueue.isEmpty())
|
||||
@ -479,6 +494,8 @@ public class Outpost implements Listener
|
||||
_preHologram = null;
|
||||
_preHologram = null;
|
||||
|
||||
_lifetimeLeft.start();
|
||||
|
||||
_state = OutpostState.CONSTRUCTING;
|
||||
_blocks = new LinkedHashMap<>(_buildQueue = _type.createBuildQueue(_origin, _ownerClan.Clans));
|
||||
|
||||
@ -556,6 +573,10 @@ public class Outpost implements Listener
|
||||
cleanup();
|
||||
}, wait.get() + 5L);
|
||||
|
||||
if (_lifetimeLeft != null) _lifetimeLeft.stop();
|
||||
|
||||
_lifetimeLeft = null;
|
||||
|
||||
_ownerClan.inform("Your Clan's Outpost has been destroyed.", null);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user