Merge branch 'master' of ssh://184.154.0.242:7999/min/Mineplex
This commit is contained in:
commit
bf901b2280
@ -212,6 +212,11 @@ public class CustomTagFix extends MiniPlugin implements IPacketHandler, NCPHook
|
||||
// Ignore Armor stand packets
|
||||
if (spawnPacket.b == 30 || spawnPacket.l == null || spawnPacket.l.c() == null || spawnPacket.a == 777777)
|
||||
{
|
||||
if (spawnPacket.b == 30)
|
||||
{
|
||||
_ignoreSkulls.add(spawnPacket.a);
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -36,29 +36,28 @@ public class Hologram
|
||||
|
||||
private Packet _destroy1_7;
|
||||
private Packet _destroy1_8;
|
||||
private boolean _destroyPackets = true;
|
||||
/**
|
||||
* 1.7 packets uses both EntityIDs while 1.8 uses only the first.
|
||||
*/
|
||||
private ArrayList<Entry<Integer, Integer>> _entityIds = new ArrayList<Entry<Integer, Integer>>();
|
||||
private Entity _followEntity;
|
||||
private HologramManager _hologramManager;
|
||||
private boolean _isWitherSkull;
|
||||
private String[] _hologramText = new String[0];
|
||||
/**
|
||||
* Keeps track of the holograms movements. This fixes offset that occasionally happens when moving a hologram around.
|
||||
*/
|
||||
private Vector _lastMovement;
|
||||
private Location _location;
|
||||
private boolean _makePackets = true;
|
||||
private boolean _makeDestroyPackets = true;
|
||||
private boolean _makeSpawnPackets = true;
|
||||
private Packet[] _packets1_7;
|
||||
private Packet[] _packets1_8;
|
||||
private HashSet<String> _playersInList = new HashSet<String>();
|
||||
private ArrayList<Player> _playersTracking = new ArrayList<Player>();
|
||||
private boolean _removeEntityDeath;
|
||||
private HologramTarget _target = HologramTarget.BLACKLIST;
|
||||
private String[] _text = new String[0];
|
||||
private int _viewDistance = 70;
|
||||
protected Vector relativeToEntity;
|
||||
private boolean _removeEntityDeath;
|
||||
|
||||
public Hologram(HologramManager hologramManager, Location location, String... text)
|
||||
{
|
||||
@ -67,15 +66,6 @@ public class Hologram
|
||||
setText(text);
|
||||
}
|
||||
|
||||
public boolean isRemoveOnEntityDeath() {
|
||||
return _removeEntityDeath;
|
||||
}
|
||||
|
||||
public Hologram setRemoveOnEntityDeath() {
|
||||
_removeEntityDeath = true;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds the player to the Hologram to be effected by Whitelist or Blacklist
|
||||
*/
|
||||
@ -111,11 +101,12 @@ public class Hologram
|
||||
|
||||
protected Packet getDestroyPacket(Player player)
|
||||
{
|
||||
if (_destroyPackets)
|
||||
if (_makeDestroyPackets)
|
||||
{
|
||||
makeDestroyPacket();
|
||||
_destroyPackets = false;
|
||||
_makeDestroyPackets = false;
|
||||
}
|
||||
|
||||
return UtilPlayer.is1_8(player) ? _destroy1_8 : _destroy1_7;
|
||||
}
|
||||
|
||||
@ -146,6 +137,7 @@ public class Hologram
|
||||
protected ArrayList<Player> getNearbyPlayers()
|
||||
{
|
||||
ArrayList<Player> nearbyPlayers = new ArrayList<Player>();
|
||||
|
||||
for (Player player : getLocation().getWorld().getPlayers())
|
||||
{
|
||||
if (isVisible(player))
|
||||
@ -163,11 +155,12 @@ public class Hologram
|
||||
|
||||
protected Packet[] getSpawnPackets(Player player)
|
||||
{
|
||||
if (_makePackets)
|
||||
if (_makeSpawnPackets)
|
||||
{
|
||||
makeSpawnPackets();
|
||||
_makePackets = false;
|
||||
_makeSpawnPackets = false;
|
||||
}
|
||||
|
||||
return UtilPlayer.is1_8(player) ? _packets1_8 : _packets1_7;
|
||||
}
|
||||
|
||||
@ -177,11 +170,13 @@ public class Hologram
|
||||
public String[] getText()
|
||||
{
|
||||
// We reverse it again as the hologram would otherwise display the text from the bottom row to the top row
|
||||
String[] reversed = new String[_text.length];
|
||||
String[] reversed = new String[_hologramText.length];
|
||||
|
||||
for (int i = 0; i < reversed.length; i++)
|
||||
{
|
||||
reversed[i] = _text[reversed.length - (i + 1)];
|
||||
reversed[i] = _hologramText[reversed.length - (i + 1)];
|
||||
}
|
||||
|
||||
return reversed;
|
||||
}
|
||||
|
||||
@ -201,12 +196,9 @@ public class Hologram
|
||||
return _lastMovement != null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Does the hologram use the wither skull for 1.8 clients?
|
||||
*/
|
||||
public boolean isUsingWitherSkull()
|
||||
public boolean isRemoveOnEntityDeath()
|
||||
{
|
||||
return _isWitherSkull;
|
||||
return _removeEntityDeath;
|
||||
}
|
||||
|
||||
public boolean isVisible(Player player)
|
||||
@ -221,6 +213,7 @@ public class Hologram
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -228,50 +221,60 @@ public class Hologram
|
||||
{
|
||||
int[] entityIds1_7 = new int[_entityIds.size() * 2];
|
||||
int[] entityIds1_8 = new int[_entityIds.size()];
|
||||
|
||||
for (int i = 0; i < _entityIds.size(); i++)
|
||||
{
|
||||
Entry<Integer, Integer> entry = _entityIds.get(i);
|
||||
|
||||
entityIds1_7[i * 2] = entry.getKey();
|
||||
entityIds1_7[(i * 2) + 1] = entry.getValue();
|
||||
|
||||
entityIds1_8[i] = entry.getKey();
|
||||
}
|
||||
|
||||
_destroy1_7 = new PacketPlayOutEntityDestroy(entityIds1_7);
|
||||
_destroy1_8 = new PacketPlayOutEntityDestroy(entityIds1_8);
|
||||
}
|
||||
|
||||
private void makeSpawnPackets()
|
||||
{
|
||||
_packets1_7 = new Packet[_text.length * 3];
|
||||
_packets1_8 = new Packet[_text.length * (isUsingWitherSkull() ? 2 : 1)];
|
||||
if (_entityIds.size() < _text.length)
|
||||
_packets1_7 = new Packet[_hologramText.length * 3];
|
||||
_packets1_8 = new Packet[_hologramText.length * 1];
|
||||
|
||||
if (_entityIds.size() < _hologramText.length)
|
||||
{
|
||||
_destroyPackets = true;
|
||||
for (int i = _entityIds.size(); i < _text.length; i++)
|
||||
_makeDestroyPackets = true;
|
||||
|
||||
for (int i = _entityIds.size(); i < _hologramText.length; i++)
|
||||
{
|
||||
_entityIds.add(new HashMap.SimpleEntry(UtilEnt.getNewEntityId(), UtilEnt.getNewEntityId()));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
_destroyPackets = true;
|
||||
while (_entityIds.size() > _text.length)
|
||||
_makeDestroyPackets = true;
|
||||
|
||||
while (_entityIds.size() > _hologramText.length)
|
||||
{
|
||||
_entityIds.remove(_text.length);
|
||||
_entityIds.remove(_hologramText.length);
|
||||
}
|
||||
}
|
||||
for (int textRow = 0; textRow < _text.length; textRow++)
|
||||
for (int textRow = 0; textRow < _hologramText.length; textRow++)
|
||||
{
|
||||
Entry<Integer, Integer> entityIds = this._entityIds.get(textRow);
|
||||
Packet[] packets1_7 = makeSpawnPackets1_7(textRow, entityIds.getKey(), entityIds.getValue(), _text[textRow]);
|
||||
|
||||
Packet[] packets1_7 = makeSpawnPackets1_7(textRow, entityIds.getKey(), entityIds.getValue(), _hologramText[textRow]);
|
||||
|
||||
for (int i = 0; i < packets1_7.length; i++)
|
||||
{
|
||||
_packets1_7[(textRow * 3) + i] = packets1_7[i];
|
||||
}
|
||||
|
||||
Packet[] packets1_8 = makeSpawnPackets1_8(textRow, entityIds.getKey(), _text[textRow]);
|
||||
Packet[] packets1_8 = makeSpawnPackets1_8(textRow, entityIds.getKey(), _hologramText[textRow]);
|
||||
|
||||
for (int i = 0; i < packets1_8.length; i++)
|
||||
{
|
||||
_packets1_8[(textRow * (isUsingWitherSkull() ? 2 : 1)) + i] = packets1_8[i];
|
||||
_packets1_8[textRow + i] = packets1_8[i];
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -280,30 +283,37 @@ public class Hologram
|
||||
{
|
||||
// Spawn wither skull
|
||||
PacketPlayOutSpawnEntity spawnWitherSkull = new PacketPlayOutSpawnEntity();
|
||||
|
||||
spawnWitherSkull.a = witherId;
|
||||
spawnWitherSkull.b = (int) (getLocation().getX() * 32);
|
||||
spawnWitherSkull.c = (int) ((getLocation().getY() + 54.6 + ((double) height * 0.285D)) * 32);
|
||||
spawnWitherSkull.d = (int) (getLocation().getZ() * 32);
|
||||
spawnWitherSkull.j = 66;
|
||||
|
||||
// Spawn horse
|
||||
PacketPlayOutSpawnEntityLiving spawnHorse = new PacketPlayOutSpawnEntityLiving();
|
||||
DataWatcher watcher = new DataWatcher(null);
|
||||
|
||||
spawnHorse.a = horseId;
|
||||
spawnHorse.b = 100;
|
||||
spawnHorse.c = (int) (getLocation().getX() * 32);
|
||||
spawnHorse.d = (int) ((getLocation().getY() + 54.83 + ((double) height * 0.285D) + 0.23D) * 32);
|
||||
spawnHorse.e = (int) (getLocation().getZ() * 32);
|
||||
spawnHorse.l = watcher;
|
||||
|
||||
// Setup datawatcher
|
||||
DataWatcher watcher = new DataWatcher(null);
|
||||
watcher.a(0, (byte) 0);
|
||||
watcher.a(1, (short) 300);
|
||||
watcher.a(10, horseName);
|
||||
watcher.a(11, (byte) 1);
|
||||
watcher.a(12, -1700000);
|
||||
spawnHorse.l = watcher;
|
||||
|
||||
// Make horse ride wither
|
||||
PacketPlayOutAttachEntity attachEntity = new PacketPlayOutAttachEntity();
|
||||
|
||||
attachEntity.b = horseId;
|
||||
attachEntity.c = witherId;
|
||||
|
||||
return new Packet[]
|
||||
{
|
||||
spawnWitherSkull, spawnHorse, attachEntity
|
||||
@ -311,51 +321,29 @@ public class Hologram
|
||||
}
|
||||
|
||||
private Packet[] makeSpawnPackets1_8(int textRow, int entityId, String lineOfText)
|
||||
{
|
||||
if (this.isUsingWitherSkull())
|
||||
{
|
||||
PacketPlayOutSpawnEntity spawnPacket = new PacketPlayOutSpawnEntity();
|
||||
spawnPacket.a = entityId;
|
||||
spawnPacket.b = (int) (getLocation().getX() * 32);
|
||||
spawnPacket.c = (int) ((getLocation().getY() + -0.55 + ((double) textRow * 0.285)) * 32);
|
||||
spawnPacket.d = (int) (getLocation().getZ() * 32);
|
||||
spawnPacket.j = 66;
|
||||
// Setup datawatcher for wither skull
|
||||
PacketPlayOutEntityMetadata metadataPacket = new PacketPlayOutEntityMetadata();
|
||||
metadataPacket.a = entityId;
|
||||
DataWatcher watcher = new DataWatcher(null);
|
||||
watcher.a(0, (byte) 0);
|
||||
watcher.a(2, lineOfText);
|
||||
watcher.a(3, (byte) 1);
|
||||
metadataPacket.b = watcher.c();
|
||||
return new Packet[]
|
||||
{
|
||||
spawnPacket, metadataPacket
|
||||
};
|
||||
}
|
||||
else
|
||||
{
|
||||
PacketPlayOutSpawnEntityLiving packet = new PacketPlayOutSpawnEntityLiving();
|
||||
DataWatcher watcher = new DataWatcher(null);
|
||||
|
||||
packet.a = entityId;
|
||||
packet.b = 30;
|
||||
packet.c = (int) (getLocation().getX() * 32);
|
||||
packet.d = (int) ((getLocation().getY() + -2.1 + ((double) textRow * 0.285)) * 32);
|
||||
packet.e = (int) (getLocation().getZ() * 32);
|
||||
packet.l = watcher;
|
||||
|
||||
// Setup datawatcher for armor stand
|
||||
DataWatcher watcher = new DataWatcher(null);
|
||||
watcher.a(0, (byte) 32);
|
||||
watcher.a(2, lineOfText);
|
||||
watcher.a(3, (byte) 1);
|
||||
// watcher.a(10, (byte) 10); TODO Uncomment after a new MC version is released (1.8.2?)
|
||||
// It uses the marker value which mojang indicates will be usable to hide the bounding box.
|
||||
// Currently it hides the bounding box and the entity itself..
|
||||
packet.l = watcher;
|
||||
// watcher.a(10, (byte) 16); // TODO Uncomment after we can enforce 1.8.3
|
||||
// Also correct hologram positioning
|
||||
|
||||
return new Packet[]
|
||||
{
|
||||
packet
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Removes the player from the Hologram so they are no longer effected by Whitelist or Blacklist
|
||||
@ -384,6 +372,7 @@ public class Hologram
|
||||
_followEntity = entityToFollow;
|
||||
relativeToEntity = entityToFollow == null ? null : this._location.clone().subtract(entityToFollow.getLocation())
|
||||
.toVector();
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
@ -404,9 +393,11 @@ public class Hologram
|
||||
*/
|
||||
public Hologram setLocation(Location newLocation)
|
||||
{
|
||||
_makePackets = true;
|
||||
_makeSpawnPackets = true;
|
||||
|
||||
Location oldLocation = getLocation();
|
||||
_location = newLocation.clone();
|
||||
|
||||
if (getEntityFollowing() != null)
|
||||
{
|
||||
relativeToEntity = _location.clone().subtract(getEntityFollowing().getLocation()).toVector();
|
||||
@ -415,12 +406,14 @@ public class Hologram
|
||||
{
|
||||
ArrayList<Player> canSee = getNearbyPlayers();
|
||||
Iterator<Player> itel = _playersTracking.iterator();
|
||||
|
||||
while (itel.hasNext())
|
||||
{
|
||||
Player player = itel.next();
|
||||
if (!canSee.contains(player))
|
||||
{
|
||||
itel.remove();
|
||||
|
||||
if (player.getWorld() == getLocation().getWorld())
|
||||
{
|
||||
((CraftPlayer) player).getHandle().playerConnection.sendPacket(getDestroyPacket(player));
|
||||
@ -431,10 +424,12 @@ public class Hologram
|
||||
while (itel.hasNext())
|
||||
{
|
||||
Player player = itel.next();
|
||||
|
||||
if (!_playersTracking.contains(player))
|
||||
{
|
||||
_playersTracking.add(player);
|
||||
itel.remove();
|
||||
|
||||
for (Packet packet : getSpawnPackets(player))
|
||||
{
|
||||
((CraftPlayer) player).getHandle().playerConnection.sendPacket(packet);
|
||||
@ -445,22 +440,28 @@ public class Hologram
|
||||
{
|
||||
_lastMovement.add(new Vector(newLocation.getX() - oldLocation.getX(), newLocation.getY() - oldLocation.getY(),
|
||||
newLocation.getZ() - oldLocation.getZ()));
|
||||
|
||||
int x = (int) Math.floor(32 * _lastMovement.getX());
|
||||
int y = (int) Math.floor(32 * _lastMovement.getY());
|
||||
int z = (int) Math.floor(32 * _lastMovement.getZ());
|
||||
Packet[] packets1_7 = new Packet[_text.length];
|
||||
Packet[] packets1_8 = new Packet[_text.length];
|
||||
|
||||
Packet[] packets1_7 = new Packet[_hologramText.length];
|
||||
Packet[] packets1_8 = new Packet[_hologramText.length];
|
||||
|
||||
int i = 0;
|
||||
|
||||
if (x >= -128 && x <= 127 && y >= -128 && y <= 127 && z >= -128 && z <= 127)
|
||||
{
|
||||
_lastMovement.subtract(new Vector(x / 32D, y / 32D, z / 32D));
|
||||
for (Entry<Integer, Integer> entityId : this._entityIds)
|
||||
{
|
||||
PacketPlayOutRelEntityMove relMove = new PacketPlayOutRelEntityMove();
|
||||
|
||||
relMove.a = entityId.getKey();
|
||||
relMove.b = (byte) x;
|
||||
relMove.c = (byte) y;
|
||||
relMove.d = (byte) z;
|
||||
|
||||
packets1_7[i] = relMove;
|
||||
packets1_8[i] = relMove;
|
||||
i++;
|
||||
@ -470,7 +471,9 @@ public class Hologram
|
||||
{
|
||||
x = (int) Math.floor(32 * newLocation.getX());
|
||||
z = (int) Math.floor(32 * newLocation.getZ());
|
||||
|
||||
_lastMovement = new Vector(newLocation.getX() - (x / 32D), 0, newLocation.getZ() - (z / 32D));
|
||||
|
||||
for (Entry<Integer, Integer> entityId : this._entityIds)
|
||||
{
|
||||
for (int b = 0; b < 2; b++)
|
||||
@ -478,9 +481,10 @@ public class Hologram
|
||||
PacketPlayOutEntityTeleport teleportPacket = new PacketPlayOutEntityTeleport();
|
||||
teleportPacket.a = entityId.getKey();
|
||||
teleportPacket.b = x;
|
||||
teleportPacket.c = (int) Math.floor((oldLocation.getY()
|
||||
+ (b == 0 ? 54.6 : isUsingWitherSkull() ? -0.55 : -2.1) + ((double) i * 0.285)) * 32);
|
||||
teleportPacket.c = (int) Math
|
||||
.floor((oldLocation.getY() + (b == 0 ? 54.6 : -2.1) + ((double) i * 0.285)) * 32);
|
||||
teleportPacket.d = z;
|
||||
|
||||
if (b == 0)
|
||||
{
|
||||
packets1_7[i] = teleportPacket;
|
||||
@ -490,9 +494,11 @@ public class Hologram
|
||||
packets1_8[i] = teleportPacket;
|
||||
}
|
||||
}
|
||||
|
||||
i++;
|
||||
}
|
||||
}
|
||||
|
||||
for (Player player : canSee)
|
||||
{
|
||||
for (Packet packet : UtilPlayer.is1_8(player) ? packets1_8 : packets1_7)
|
||||
@ -505,85 +511,117 @@ public class Hologram
|
||||
return this;
|
||||
}
|
||||
|
||||
public Hologram setRemoveOnEntityDeath()
|
||||
{
|
||||
_removeEntityDeath = true;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the hologram text
|
||||
*/
|
||||
public Hologram setText(String... newText)
|
||||
public Hologram setText(String... newLines)
|
||||
{
|
||||
String[] reversed = new String[newText.length];
|
||||
for (int i = 0; i < reversed.length; i++)
|
||||
String[] newText = new String[newLines.length];
|
||||
|
||||
for (int i = 0; i < newText.length; i++)
|
||||
{
|
||||
reversed[i] = newText[reversed.length - (i + 1)];
|
||||
newText[i] = newLines[newText.length - (i + 1)];
|
||||
}
|
||||
if (reversed.equals(_text))
|
||||
|
||||
if (newText.equals(_hologramText))
|
||||
return this;
|
||||
_makePackets = true;
|
||||
|
||||
_makeSpawnPackets = true;
|
||||
|
||||
if (isInUse())
|
||||
{
|
||||
ArrayList<Packet> packets1_7 = new ArrayList<Packet>();
|
||||
int[] destroy1_7 = new int[0];
|
||||
int[] destroy1_8 = new int[0];
|
||||
|
||||
ArrayList<Packet> packets1_7 = new ArrayList<Packet>();
|
||||
ArrayList<Packet> packets1_8 = new ArrayList<Packet>();
|
||||
if (_text.length != reversed.length)
|
||||
|
||||
if (_hologramText.length != newText.length)
|
||||
{
|
||||
_destroyPackets = true;
|
||||
_makeDestroyPackets = true;
|
||||
}
|
||||
for (int textRow = 0; textRow < Math.max(_text.length, reversed.length); textRow++)
|
||||
|
||||
for (int i = 0; i < Math.max(_hologramText.length, newText.length); i++)
|
||||
{
|
||||
// You can safely assume that _entityIds here is containing _text.length amount as this code is inside isInUse
|
||||
if (textRow >= _text.length)
|
||||
// If more lines than previously
|
||||
if (i >= _hologramText.length)
|
||||
{
|
||||
// Add entity id and send spawn packets
|
||||
// You add a entity id because the new hologram needs
|
||||
Entry<Integer, Integer> entry = new HashMap.SimpleEntry(UtilEnt.getNewEntityId(), UtilEnt.getNewEntityId());
|
||||
_entityIds.add(entry);
|
||||
packets1_7.addAll(Arrays.asList(makeSpawnPackets1_7(textRow, entry.getKey(), entry.getValue(),
|
||||
reversed[textRow])));
|
||||
packets1_8.addAll(Arrays.asList(makeSpawnPackets1_8(textRow, entry.getKey(), reversed[textRow])));
|
||||
|
||||
packets1_7.addAll(Arrays.asList(makeSpawnPackets1_7(i, entry.getKey(), entry.getValue(), newText[i])));
|
||||
|
||||
packets1_8.addAll(Arrays.asList(makeSpawnPackets1_8(i, entry.getKey(), newText[i])));
|
||||
}
|
||||
else if (textRow >= reversed.length)
|
||||
// If less lines than previously
|
||||
else if (i >= newText.length)
|
||||
{
|
||||
// Remove entity id and send destroy packets
|
||||
Entry<Integer, Integer> entry = _entityIds.remove(reversed.length);
|
||||
Entry<Integer, Integer> entry = _entityIds.remove(newText.length);
|
||||
|
||||
destroy1_7 = Arrays.copyOf(destroy1_7, destroy1_7.length + 2);
|
||||
|
||||
destroy1_7[destroy1_7.length - 2] = entry.getKey();
|
||||
destroy1_7[destroy1_7.length - 1] = entry.getValue();
|
||||
|
||||
destroy1_8 = Arrays.copyOf(destroy1_8, destroy1_8.length + 1);
|
||||
destroy1_8[destroy1_8.length - 1] = entry.getKey();
|
||||
}
|
||||
else if (!reversed[textRow].equals(_text[textRow]))
|
||||
else if (!newText[i].equals(_hologramText[i]))
|
||||
{
|
||||
// Send update metadata packets
|
||||
Entry<Integer, Integer> entry = _entityIds.get(textRow);
|
||||
Entry<Integer, Integer> entry = _entityIds.get(i);
|
||||
PacketPlayOutEntityMetadata metadata1_7 = new PacketPlayOutEntityMetadata();
|
||||
|
||||
metadata1_7.a = entry.getValue();
|
||||
|
||||
DataWatcher watcher1_7 = new DataWatcher(null);
|
||||
|
||||
watcher1_7.a(0, (byte) 0);
|
||||
watcher1_7.a(1, (short) 300);
|
||||
watcher1_7.a(10, reversed[textRow]);
|
||||
watcher1_7.a(10, newText[i]);
|
||||
watcher1_7.a(11, (byte) 1);
|
||||
watcher1_7.a(12, -1700000);
|
||||
|
||||
metadata1_7.b = watcher1_7.c();
|
||||
|
||||
packets1_7.add(metadata1_7);
|
||||
|
||||
PacketPlayOutEntityMetadata metadata1_8 = new PacketPlayOutEntityMetadata();
|
||||
|
||||
metadata1_8.a = entry.getKey();
|
||||
|
||||
DataWatcher watcher1_8 = new DataWatcher(null);
|
||||
watcher1_8.a(0, (byte) 0);
|
||||
watcher1_8.a(2, reversed[textRow]);
|
||||
|
||||
watcher1_8.a(0, (byte) 32);
|
||||
watcher1_8.a(2, newText[i]);
|
||||
watcher1_8.a(3, (byte) 1);
|
||||
// watcher1_8.a(10, (byte) 16);// TODO Uncomment after we can enforce 1.8.3
|
||||
// Also correct hologram positioning
|
||||
metadata1_8.b = watcher1_8.c();
|
||||
|
||||
packets1_8.add(metadata1_8);
|
||||
}
|
||||
}
|
||||
|
||||
if (destroy1_7.length > 0)
|
||||
{
|
||||
packets1_7.add(new PacketPlayOutEntityDestroy(destroy1_7));
|
||||
}
|
||||
|
||||
if (destroy1_8.length > 0)
|
||||
{
|
||||
packets1_8.add(new PacketPlayOutEntityDestroy(destroy1_8));
|
||||
}
|
||||
|
||||
for (Player player : _playersTracking)
|
||||
{
|
||||
for (Packet packet : UtilPlayer.is1_8(player) ? packets1_8 : packets1_7)
|
||||
@ -592,16 +630,9 @@ public class Hologram
|
||||
}
|
||||
}
|
||||
}
|
||||
_text = reversed;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Tells the hologram to use the wither skull instead of armorstand for 1.8 clients
|
||||
*/
|
||||
public Hologram setUsesWitherSkull()
|
||||
{
|
||||
_isWitherSkull = true;
|
||||
_hologramText = newText;
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
@ -623,6 +654,7 @@ public class Hologram
|
||||
{
|
||||
_hologramManager.addHologram(this);
|
||||
_playersTracking.addAll(getNearbyPlayers());
|
||||
|
||||
for (Player player : _playersTracking)
|
||||
{
|
||||
for (Packet packet : getSpawnPackets(player))
|
||||
@ -630,6 +662,7 @@ public class Hologram
|
||||
((CraftPlayer) player).getHandle().playerConnection.sendPacket(packet);
|
||||
}
|
||||
}
|
||||
|
||||
_lastMovement = new Vector();
|
||||
}
|
||||
return this;
|
||||
@ -643,10 +676,12 @@ public class Hologram
|
||||
if (isInUse())
|
||||
{
|
||||
_hologramManager.removeHologram(this);
|
||||
|
||||
for (Player player : _playersTracking)
|
||||
{
|
||||
((CraftPlayer) player).getHandle().playerConnection.sendPacket(getDestroyPacket(player));
|
||||
}
|
||||
|
||||
_playersTracking.clear();
|
||||
_lastMovement = null;
|
||||
}
|
||||
|
@ -315,8 +315,7 @@ class TeamBomb implements Comparable<TeamBomb>
|
||||
|
||||
public void setupHologram()
|
||||
{
|
||||
_hologram = new Hologram(this._game.getArcadeManager().getHologramManager(), getBlockLocation().clone().add(0, 1, 0))
|
||||
.setUsesWitherSkull();
|
||||
_hologram = new Hologram(this._game.getArcadeManager().getHologramManager(), getBlockLocation().clone().add(0, 1, 0));
|
||||
_hologram.setText(getTeam().GetColor() + C.Bold + getTeam().GetName() + " Team's Bomb");
|
||||
_hologram.start();
|
||||
}
|
||||
|
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue
Block a user