Creeper visual!
This commit is contained in:
parent
c177307f70
commit
13e7e58986
@ -120,6 +120,7 @@ public class BonusManager extends MiniClientPlugin<BonusClientData> implements I
|
||||
public boolean _enabled;
|
||||
private Npc _carlNpc;
|
||||
private AnimationCarl _animation;
|
||||
private int _visualTick;
|
||||
|
||||
// Streak
|
||||
private StreakRecord _dailyStreak;
|
||||
@ -397,7 +398,7 @@ public class BonusManager extends MiniClientPlugin<BonusClientData> implements I
|
||||
{
|
||||
incrementDailyStreak(player);
|
||||
awardBonus(player, amount);
|
||||
updateCreeperVisual(player);
|
||||
updateCreeperVisual(player, true, C.cAqua);
|
||||
}
|
||||
|
||||
result.run(r);
|
||||
@ -436,7 +437,7 @@ public class BonusManager extends MiniClientPlugin<BonusClientData> implements I
|
||||
if (aBoolean)
|
||||
{
|
||||
awardBonus(player, getRankBonusAmount(player));
|
||||
updateCreeperVisual(player);
|
||||
updateCreeperVisual(player, true, C.cAqua);
|
||||
}
|
||||
|
||||
result.run(aBoolean);
|
||||
@ -822,12 +823,12 @@ public class BonusManager extends MiniClientPlugin<BonusClientData> implements I
|
||||
public void run()
|
||||
{
|
||||
if (event.getPlayer().isOnline())
|
||||
updateCreeperVisual(event.getPlayer());
|
||||
updateCreeperVisual(event.getPlayer(), true, C.cAqua);
|
||||
}
|
||||
}, 10);
|
||||
}
|
||||
|
||||
public void updateCreeperVisual(Player player)
|
||||
public void updateCreeperVisual(Player player, boolean updateDataWatcher, String rewardPrefix)
|
||||
{
|
||||
if (!_enabled)
|
||||
return;
|
||||
@ -846,10 +847,12 @@ public class BonusManager extends MiniClientPlugin<BonusClientData> implements I
|
||||
|
||||
if (client.getHologram() == null)
|
||||
{
|
||||
hologram = new Hologram(_hologramManager, _carlNpc.getLocation().clone().add(0, 2.75 - 0.285 - 0.285, 0), "");
|
||||
double yAdd = UtilPlayer.is1_8(player) ? 2.18 : 2.3;
|
||||
hologram = new Hologram(_hologramManager, _carlNpc.getLocation().clone().add(0, yAdd, 0), "");
|
||||
hologram.setHologramTarget(Hologram.HologramTarget.WHITELIST);
|
||||
hologram.addPlayer(player);
|
||||
client.setHologram(hologram);
|
||||
hologram.start();
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -860,34 +863,53 @@ public class BonusManager extends MiniClientPlugin<BonusClientData> implements I
|
||||
{
|
||||
// Hologram
|
||||
// String name = "Carl the Creeper";
|
||||
String text = C.cAqua + availableRewards + " Reward" + (availableRewards > 1 ? "s" : "") + " to Claim";
|
||||
String text = rewardPrefix + availableRewards + " Reward" + (availableRewards > 1 ? "s" : "") + " to Claim";
|
||||
hologram.setText(text);
|
||||
hologram.start();
|
||||
|
||||
// Charged
|
||||
DataWatcher watcher = new DataWatcher(null);
|
||||
watcher.a(0, (byte) 0);
|
||||
watcher.a(1, (short) 300);
|
||||
watcher.a(17, (byte) 1);
|
||||
PacketPlayOutEntityMetadata packet = new PacketPlayOutEntityMetadata();
|
||||
packet.a = _carlNpc.getEntity().getEntityId();
|
||||
packet.b = watcher.c();
|
||||
if (updateDataWatcher)
|
||||
{
|
||||
// Charged
|
||||
DataWatcher watcher = new DataWatcher(null);
|
||||
watcher.a(0, (byte) 0);
|
||||
watcher.a(1, (short) 300);
|
||||
watcher.a(17, (byte) 1);
|
||||
PacketPlayOutEntityMetadata packet = new PacketPlayOutEntityMetadata();
|
||||
packet.a = _carlNpc.getEntity().getEntityId();
|
||||
packet.b = watcher.c();
|
||||
|
||||
UtilPlayer.sendPacket(player, packet);
|
||||
UtilPlayer.sendPacket(player, packet);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// Hologram
|
||||
hologram.stop();
|
||||
String text = C.cGray + "No Rewards";
|
||||
hologram.setText(text);
|
||||
|
||||
// Charged
|
||||
DataWatcher watcher = new DataWatcher(null);
|
||||
watcher.a(17, (byte) 0);
|
||||
PacketPlayOutEntityMetadata packet = new PacketPlayOutEntityMetadata();
|
||||
packet.a = _carlNpc.getEntity().getEntityId();
|
||||
packet.b = watcher.c();
|
||||
if (updateDataWatcher)
|
||||
{
|
||||
// Charged
|
||||
DataWatcher watcher = new DataWatcher(null);
|
||||
watcher.a(17, (byte) 0);
|
||||
PacketPlayOutEntityMetadata packet = new PacketPlayOutEntityMetadata();
|
||||
packet.a = _carlNpc.getEntity().getEntityId();
|
||||
packet.b = watcher.c();
|
||||
|
||||
UtilPlayer.sendPacket(player, packet);
|
||||
UtilPlayer.sendPacket(player, packet);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void updateCreeper(UpdateEvent event)
|
||||
{
|
||||
if (event.getType() != UpdateType.SEC || !_enabled)
|
||||
return;
|
||||
|
||||
for (Player player : UtilServer.getPlayers())
|
||||
{
|
||||
String prefix = _visualTick % 2 == 0 ? C.cAqua : C.cDAqua;
|
||||
updateCreeperVisual(player, false, prefix);
|
||||
_visualTick++;
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user