Merge branch 'master' of ssh://184.154.0.242:7999/min/Mineplex
This commit is contained in:
commit
23de2f735d
@ -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;
|
||||
}
|
||||
|
||||
|
@ -2,6 +2,8 @@ package mineplex.core.gadget.types;
|
||||
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.entity.PlayerDeathEvent;
|
||||
|
||||
import mineplex.core.common.util.F;
|
||||
import mineplex.core.common.util.UtilPlayer;
|
||||
@ -29,4 +31,10 @@ public abstract class MorphGadget extends Gadget
|
||||
if (_active.remove(player))
|
||||
UtilPlayer.message(player, F.main("Gadget", "You unmorphed from " + F.elem(GetName()) + "."));
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void playerDeath(PlayerDeathEvent event)
|
||||
{
|
||||
Disable(event.getEntity());
|
||||
}
|
||||
}
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -155,10 +155,12 @@ public abstract class Game implements Listener
|
||||
public boolean DamageTeamOther = true;
|
||||
|
||||
public boolean BlockBreak = false;
|
||||
public boolean BlockBreakCreative = false;
|
||||
public HashSet<Integer> BlockBreakAllow = new HashSet<Integer>();
|
||||
public HashSet<Integer> BlockBreakDeny = new HashSet<Integer>();
|
||||
|
||||
public boolean BlockPlace = false;
|
||||
public boolean BlockPlaceCreative = false;
|
||||
public HashSet<Integer> BlockPlaceAllow = new HashSet<Integer>();
|
||||
public HashSet<Integer> BlockPlaceDeny = new HashSet<Integer>();
|
||||
|
||||
|
@ -1,20 +1,39 @@
|
||||
package nautilus.game.arcade.game.games.event;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.LinkedList;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Effect;
|
||||
import org.bukkit.GameMode;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.OfflinePlayer;
|
||||
import org.bukkit.Sound;
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.block.BlockFace;
|
||||
import org.bukkit.craftbukkit.v1_7_R4.entity.CraftLivingEntity;
|
||||
import org.bukkit.craftbukkit.v1_7_R4.entity.CraftPlayer;
|
||||
import org.bukkit.entity.Ageable;
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.entity.EntityType;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.entity.Skeleton;
|
||||
import org.bukkit.entity.Slime;
|
||||
import org.bukkit.entity.Villager;
|
||||
import org.bukkit.entity.Wolf;
|
||||
import org.bukkit.entity.Zombie;
|
||||
import org.bukkit.entity.Skeleton.SkeletonType;
|
||||
import org.bukkit.entity.Villager.Profession;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.EventPriority;
|
||||
import org.bukkit.event.entity.EntityExplodeEvent;
|
||||
import org.bukkit.event.player.PlayerCommandPreprocessEvent;
|
||||
import org.bukkit.event.player.PlayerJoinEvent;
|
||||
import org.bukkit.event.player.PlayerToggleFlightEvent;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
import mineplex.core.command.CommandCenter;
|
||||
import mineplex.core.common.Rank;
|
||||
import mineplex.core.common.util.C;
|
||||
import mineplex.core.common.util.F;
|
||||
@ -23,6 +42,7 @@ import mineplex.core.common.util.UtilAction;
|
||||
import mineplex.core.common.util.UtilAlg;
|
||||
import mineplex.core.common.util.UtilBlock;
|
||||
import mineplex.core.common.util.UtilEnt;
|
||||
import mineplex.core.common.util.UtilInv;
|
||||
import mineplex.core.common.util.UtilMath;
|
||||
import mineplex.core.common.util.UtilPlayer;
|
||||
import mineplex.core.common.util.UtilServer;
|
||||
@ -32,10 +52,12 @@ import mineplex.core.disguise.disguises.DisguiseChicken;
|
||||
import mineplex.core.disguise.disguises.DisguiseEnderman;
|
||||
import mineplex.core.disguise.disguises.DisguiseWither;
|
||||
import mineplex.core.gadget.event.GadgetActivateEvent;
|
||||
import mineplex.core.itemstack.ItemStackFactory;
|
||||
import mineplex.core.mount.event.MountActivateEvent;
|
||||
import mineplex.core.recharge.Recharge;
|
||||
import mineplex.core.updater.UpdateType;
|
||||
import mineplex.core.updater.event.UpdateEvent;
|
||||
import nautilus.game.arcade.events.GameStateChangeEvent;
|
||||
import nautilus.game.arcade.game.GameTeam.PlayerState;
|
||||
import nautilus.game.arcade.game.games.event.kits.*;
|
||||
import nautilus.game.arcade.ArcadeManager;
|
||||
@ -56,6 +78,8 @@ public class EventGame extends SoloGame
|
||||
private boolean _gadgetsEnabled = true;
|
||||
private NautHashMap<String, Integer> _radius = new NautHashMap<String, Integer>();
|
||||
|
||||
private NautHashMap<Material, Integer> _kitItems = new NautHashMap<Material, Integer>();
|
||||
|
||||
public EventGame(ArcadeManager manager)
|
||||
{
|
||||
super(manager, GameType.Event,
|
||||
@ -84,6 +108,9 @@ public class EventGame extends SoloGame
|
||||
|
||||
this.PrepareFreeze = false;
|
||||
|
||||
this.BlockPlaceCreative = true;
|
||||
this.BlockBreakCreative = true;
|
||||
|
||||
//Dont timeout
|
||||
this.GameTimeout = -1;
|
||||
|
||||
@ -158,6 +185,25 @@ public class EventGame extends SoloGame
|
||||
UtilPlayer.message(player, F.value("/e scoreboard <Line #> [Text]", "Sets Scoreboard Text"));
|
||||
}
|
||||
|
||||
private void commandHelpSettings(Player player)
|
||||
{
|
||||
UtilPlayer.message(player, F.main("Event", "Displaying Settings Commands;"));
|
||||
UtilPlayer.message(player, F.value("/e damage all", "Toggles All Damage"));
|
||||
UtilPlayer.message(player, F.value("/e damage pvp", "Toggles PvP Damage"));
|
||||
UtilPlayer.message(player, F.value("/e damage pve", "Toggles PvE Damage"));
|
||||
UtilPlayer.message(player, F.value("/e damage pve", "Toggles EvP Damage"));
|
||||
UtilPlayer.message(player, F.value("/e health <-1 to 20>", "Locks Players Health"));
|
||||
UtilPlayer.message(player, F.value("/e hunger <-1 to 20>", "Locks Players Hunger"));
|
||||
UtilPlayer.message(player, F.value("/e item drop", "Toggles Item Drop"));
|
||||
UtilPlayer.message(player, F.value("/e item pickup", "Toggles Item Pickup"));
|
||||
UtilPlayer.message(player, F.value("/e blockplace", "Toggles Block Placing (On/Off)"));
|
||||
UtilPlayer.message(player, F.value("/e blockplace whitelist <id>", "Whitelists Block Place"));
|
||||
UtilPlayer.message(player, F.value("/e blockplace blacklist <id>", "Whitelists Block Place"));
|
||||
UtilPlayer.message(player, F.value("/e blockbreak", "Toggles Block Breaking (On/Off)"));
|
||||
UtilPlayer.message(player, F.value("/e blockbreak whitelist <id>", "Whitelists Block Break"));
|
||||
UtilPlayer.message(player, F.value("/e blockbreak blacklist <id>", "Blacklists Block Break"));
|
||||
}
|
||||
|
||||
//Command Handler
|
||||
@EventHandler(priority = EventPriority.LOWEST)
|
||||
public void commandHandler(PlayerCommandPreprocessEvent event)
|
||||
@ -176,10 +222,16 @@ public class EventGame extends SoloGame
|
||||
//Trim off /e and split to args
|
||||
String[] args = event.getMessage().substring(3, event.getMessage().length()).split(" ");
|
||||
|
||||
if (args.length == 0)
|
||||
if (args.length == 0 || args[0].equalsIgnoreCase("help"))
|
||||
{
|
||||
commandHelp(event.getPlayer());
|
||||
}
|
||||
else if (args[0].equalsIgnoreCase("settings"))
|
||||
{
|
||||
commandHelpSettings(event.getPlayer());
|
||||
}
|
||||
|
||||
//XXX Commands
|
||||
else if (args[0].equalsIgnoreCase("tp"))
|
||||
{
|
||||
commandTeleport(event.getPlayer(), args);
|
||||
@ -208,6 +260,221 @@ public class EventGame extends SoloGame
|
||||
{
|
||||
commandScoreboard(event.getPlayer(), args);
|
||||
}
|
||||
else if (args[0].equalsIgnoreCase("whitelist"))
|
||||
{
|
||||
commandWhitelist(event.getPlayer(), args);
|
||||
}
|
||||
|
||||
|
||||
//XXX Settings
|
||||
else if (event.getMessage().toLowerCase().equals("/e damage all"))
|
||||
{
|
||||
Damage = !Damage;
|
||||
Announce(F.main("Event Settings", F.value("Damage All", F.tf(Damage))));
|
||||
}
|
||||
else if (event.getMessage().toLowerCase().equals("/e damage pvp"))
|
||||
{
|
||||
DamagePvP = !DamagePvP;
|
||||
Announce(F.main("Event Settings", F.value("Damage PvP", F.tf(DamagePvP))));
|
||||
}
|
||||
else if (event.getMessage().toLowerCase().equals("/e damage pve"))
|
||||
{
|
||||
DamagePvE = !DamagePvE;
|
||||
Announce(F.main("Event Settings", F.value("Damage PvE", F.tf(DamagePvE))));
|
||||
}
|
||||
else if (event.getMessage().toLowerCase().equals("/e damage evp"))
|
||||
{
|
||||
DamageEvP = !DamageEvP;
|
||||
Announce(F.main("Event Settings", F.value("Damage EvP", F.tf(DamageEvP))));
|
||||
}
|
||||
else if (args[0].equalsIgnoreCase("health"))
|
||||
{
|
||||
commandHealth(event.getPlayer(), args);
|
||||
}
|
||||
else if (args[0].equalsIgnoreCase("hunger"))
|
||||
{
|
||||
commandHunger(event.getPlayer(), args);
|
||||
}
|
||||
else if (event.getMessage().toLowerCase().equals("/e item drop"))
|
||||
{
|
||||
ItemDrop = !ItemDrop;
|
||||
Announce(F.main("Event Settings", F.value("Item Drop", F.tf(ItemDrop))));
|
||||
}
|
||||
else if (event.getMessage().toLowerCase().equals("/e item pickup"))
|
||||
{
|
||||
ItemPickup = !ItemPickup;
|
||||
Announce(F.main("Event Settings", F.value("Item Pickup", F.tf(ItemPickup))));
|
||||
}
|
||||
else if (event.getMessage().toLowerCase().equals("/e blockplace"))
|
||||
{
|
||||
BlockPlace = !BlockPlace;
|
||||
Announce(F.main("Event Settings", F.value("Block Place", F.tf(BlockPlace))));
|
||||
}
|
||||
else if (args.length >= 4 && args[0].equalsIgnoreCase("blockplace")
|
||||
&& (args[1].equalsIgnoreCase("whitelist") || args[1].equalsIgnoreCase("blacklist"))
|
||||
&& (args[2].equalsIgnoreCase("add") || args[2].equalsIgnoreCase("remove")))
|
||||
{
|
||||
commandBlockPlace(event.getPlayer(), args, args[1].equalsIgnoreCase("whitelist"), args[2].equalsIgnoreCase("add"));
|
||||
}
|
||||
else if (event.getMessage().toLowerCase().equals("/e blockbreak"))
|
||||
{
|
||||
BlockBreak = !BlockBreak;
|
||||
Announce(F.main("Event Settings", F.value("Block Break", F.tf(BlockBreak))));
|
||||
}
|
||||
else if (args.length >= 4 && args[0].equalsIgnoreCase("blockbreak")
|
||||
&& (args[1].equalsIgnoreCase("whitelist") || args[1].equalsIgnoreCase("blacklist"))
|
||||
&& (args[2].equalsIgnoreCase("add") || args[2].equalsIgnoreCase("remove")))
|
||||
{
|
||||
commandBlockBreak(event.getPlayer(), args, args[1].equalsIgnoreCase("whitelist"), args[2].equalsIgnoreCase("add"));
|
||||
}
|
||||
}
|
||||
|
||||
private void commandBlockPlace(Player player, String[] args, boolean whitelist, boolean add)
|
||||
{
|
||||
try
|
||||
{
|
||||
int blockId = Integer.parseInt(args[3]);
|
||||
|
||||
if (whitelist)
|
||||
{
|
||||
if (add)
|
||||
{
|
||||
BlockPlaceAllow.add(blockId);
|
||||
UtilPlayer.message(player, F.main("Event Settings", F.value("Block Place Whitelist", "Added " + blockId)));
|
||||
}
|
||||
else
|
||||
{
|
||||
BlockPlaceAllow.remove(blockId);
|
||||
UtilPlayer.message(player, F.main("Event Settings", F.value("Block Place Whitelist", "Removed " + blockId)));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (add)
|
||||
{
|
||||
BlockPlaceDeny.add(blockId);
|
||||
UtilPlayer.message(player, F.main("Event Settings", F.value("Block Place Blacklist", "Added " + blockId)));
|
||||
}
|
||||
else
|
||||
{
|
||||
BlockPlaceDeny.remove(blockId);
|
||||
UtilPlayer.message(player, F.main("Event Settings", F.value("Block Place Blacklist", "Removed " + blockId)));
|
||||
}
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
commandHelpSettings(player);
|
||||
}
|
||||
|
||||
private void commandBlockBreak(Player player, String[] args, boolean whitelist, boolean add)
|
||||
{
|
||||
try
|
||||
{
|
||||
int blockId = Integer.parseInt(args[3]);
|
||||
|
||||
if (whitelist)
|
||||
{
|
||||
if (add)
|
||||
{
|
||||
BlockBreakAllow.add(blockId);
|
||||
UtilPlayer.message(player, F.main("Event Settings", F.value("Block Break Whitelist", "Added " + blockId)));
|
||||
}
|
||||
else
|
||||
{
|
||||
BlockBreakAllow.remove(blockId);
|
||||
UtilPlayer.message(player, F.main("Event Settings", F.value("Block Break Whitelist", "Removed " + blockId)));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (add)
|
||||
{
|
||||
BlockBreakDeny.add(blockId);
|
||||
UtilPlayer.message(player, F.main("Event Settings", F.value("Block Break Blacklist", "Added " + blockId)));
|
||||
}
|
||||
else
|
||||
{
|
||||
BlockBreakDeny.remove(blockId);
|
||||
UtilPlayer.message(player, F.main("Event Settings", F.value("Block Break Blacklist", "Removed " + blockId)));
|
||||
}
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
commandHelpSettings(player);
|
||||
}
|
||||
|
||||
private void commandHealth(Player player, String[] args)
|
||||
{
|
||||
try
|
||||
{
|
||||
if (args.length >= 2)
|
||||
{
|
||||
int health = Integer.parseInt(args[1]);
|
||||
|
||||
if (health <= 0)
|
||||
health = -1;
|
||||
if (health > 20)
|
||||
health = 20;
|
||||
|
||||
HealthSet = health;
|
||||
|
||||
if (HealthSet == -1)
|
||||
Announce(F.main("Event Settings", F.value("Health Set", "Disabled")));
|
||||
else
|
||||
Announce(F.main("Event Settings", F.value("Health Set", HealthSet + "")));
|
||||
|
||||
return;
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
commandHelpSettings(player);
|
||||
}
|
||||
|
||||
private void commandHunger(Player player, String[] args)
|
||||
{
|
||||
try
|
||||
{
|
||||
if (args.length >= 2)
|
||||
{
|
||||
int hunger = Integer.parseInt(args[1]);
|
||||
|
||||
if (hunger <= 0)
|
||||
hunger = -1;
|
||||
if (hunger > 20)
|
||||
hunger = 20;
|
||||
|
||||
HungerSet = hunger;
|
||||
|
||||
if (HungerSet == -1)
|
||||
Announce(F.main("Event Settings", F.value("Hunger Set", "Disabled")));
|
||||
else
|
||||
Announce(F.main("Event Settings", F.value("Hunger Set", HungerSet + "")));
|
||||
|
||||
return;
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
commandHelpSettings(player);
|
||||
}
|
||||
|
||||
//Teleport Command (To, Here, All)
|
||||
@ -359,13 +626,6 @@ public class EventGame extends SoloGame
|
||||
|
||||
}
|
||||
|
||||
//Game Settings - PvP, Blocks, etc
|
||||
@EventHandler
|
||||
public void commandSetting(Player player, String[] args)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
//Double Jump
|
||||
@EventHandler
|
||||
public void commandDoubleJump(Player player, String[] args)
|
||||
@ -448,6 +708,255 @@ public class EventGame extends SoloGame
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void commandWhitelist(Player player, String[] args)
|
||||
{
|
||||
//On and Off
|
||||
if (args.length >= 2)
|
||||
{
|
||||
if (args[1].equalsIgnoreCase("on") || args[1].equalsIgnoreCase("of"))
|
||||
{
|
||||
UtilServer.getServer().setWhitelist(args[1].equalsIgnoreCase("on"));
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
//Add and Remove
|
||||
if (args.length >= 3)
|
||||
{
|
||||
if (args[1].equalsIgnoreCase("add") || args[1].equalsIgnoreCase("remove"))
|
||||
{
|
||||
OfflinePlayer target = Bukkit.getOfflinePlayer(args[2]);
|
||||
|
||||
if (args[1].equalsIgnoreCase("add"))
|
||||
UtilServer.getServer().getWhitelistedPlayers().add(target);
|
||||
else
|
||||
UtilServer.getServer().getWhitelistedPlayers().remove(target);
|
||||
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
commandHelp(player);
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
protected void commandMob(Player caller, String[] args)
|
||||
{
|
||||
if (args.length == 1)
|
||||
{
|
||||
HashMap<EntityType, Integer> entMap = new HashMap<EntityType, Integer>();
|
||||
|
||||
int count = 0;
|
||||
for (World world : UtilServer.getServer().getWorlds())
|
||||
{
|
||||
for (Entity ent : world.getEntities())
|
||||
{
|
||||
if (!entMap.containsKey(ent.getType()))
|
||||
entMap.put(ent.getType(), 0);
|
||||
|
||||
entMap.put(ent.getType(), 1 + entMap.get(ent.getType()));
|
||||
count++;
|
||||
}
|
||||
}
|
||||
|
||||
UtilPlayer.message(caller, F.main("Creature", "Listing Entities:"));
|
||||
for (EntityType cur : entMap.keySet())
|
||||
{
|
||||
UtilPlayer.message(caller, F.desc(UtilEnt.getName(cur), entMap.get(cur)+""));
|
||||
}
|
||||
|
||||
UtilPlayer.message(caller, F.desc("Total", count+""));
|
||||
}
|
||||
else
|
||||
{
|
||||
EntityType type = UtilEnt.searchEntity(caller, args[1], true);
|
||||
|
||||
if (type == null)
|
||||
return;
|
||||
|
||||
UtilPlayer.message(caller, F.main("Creature", "Spawning Creature(s);"));
|
||||
|
||||
//Store Args
|
||||
HashSet<String> argSet = new HashSet<String>();
|
||||
for (int i = 2 ; i < args.length ; i++)
|
||||
if (args[i].length() > 0)
|
||||
argSet.add(args[i]);
|
||||
|
||||
|
||||
//Search Count
|
||||
int count = 1;
|
||||
HashSet<String> argHandle = new HashSet<String>();
|
||||
for (String arg : argSet)
|
||||
{
|
||||
try
|
||||
{
|
||||
int newCount = Integer.parseInt(arg);
|
||||
|
||||
if (newCount <= 0)
|
||||
continue;
|
||||
|
||||
//Set Count
|
||||
count = newCount;
|
||||
UtilPlayer.message(caller, F.desc("Amount", count+""));
|
||||
|
||||
//Flag Arg
|
||||
argHandle.add(arg);
|
||||
break;
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
//None
|
||||
}
|
||||
}
|
||||
for (String arg : argHandle)
|
||||
argSet.remove(arg);
|
||||
|
||||
//Spawn
|
||||
HashSet<Entity> entSet = new HashSet<Entity>();
|
||||
for (int i = 0 ; i < count ; i++)
|
||||
{
|
||||
CreatureAllowOverride = true;
|
||||
entSet.add(Manager.GetCreature().SpawnEntity(caller.getTargetBlock(null, 0).getLocation().add(0.5, 1, 0.5), type));
|
||||
CreatureAllowOverride = false;
|
||||
}
|
||||
|
||||
//Search Vars
|
||||
for (String arg : argSet)
|
||||
{
|
||||
if (arg.length() == 0)
|
||||
continue;
|
||||
|
||||
//Baby
|
||||
else if (arg.equalsIgnoreCase("baby") || arg.equalsIgnoreCase("b"))
|
||||
{
|
||||
for (Entity ent : entSet)
|
||||
{
|
||||
if (ent instanceof Ageable)
|
||||
((Ageable)ent).setBaby();
|
||||
else if (ent instanceof Zombie)
|
||||
((Zombie)ent).setBaby(true);
|
||||
}
|
||||
|
||||
UtilPlayer.message(caller, F.desc("Baby", "True"));
|
||||
argHandle.add(arg);
|
||||
}
|
||||
|
||||
//Lock
|
||||
else if (arg.equalsIgnoreCase("age") || arg.equalsIgnoreCase("lock"))
|
||||
{
|
||||
for (Entity ent : entSet)
|
||||
if (ent instanceof Ageable)
|
||||
{
|
||||
((Ageable)ent).setAgeLock(true);
|
||||
UtilPlayer.message(caller, F.desc("Age", "False"));
|
||||
}
|
||||
|
||||
argHandle.add(arg);
|
||||
}
|
||||
|
||||
//Angry
|
||||
else if (arg.equalsIgnoreCase("angry") || arg.equalsIgnoreCase("a"))
|
||||
{
|
||||
for (Entity ent : entSet)
|
||||
if (ent instanceof Wolf)
|
||||
((Wolf)ent).setAngry(true);
|
||||
|
||||
for (Entity ent : entSet)
|
||||
if (ent instanceof Skeleton)
|
||||
((Skeleton)ent).setSkeletonType(SkeletonType.WITHER);
|
||||
|
||||
UtilPlayer.message(caller, F.desc("Angry", "True"));
|
||||
argHandle.add(arg);
|
||||
}
|
||||
|
||||
//Profession
|
||||
else if (arg.toLowerCase().charAt(0) == 'p')
|
||||
{
|
||||
try
|
||||
{
|
||||
String prof = arg.substring(1, arg.length());
|
||||
|
||||
Profession profession = null;
|
||||
for (Profession cur : Profession.values())
|
||||
if (cur.name().toLowerCase().contains(prof.toLowerCase()))
|
||||
profession = cur;
|
||||
|
||||
UtilPlayer.message(caller, F.desc("Profession", profession.name()));
|
||||
|
||||
for (Entity ent : entSet)
|
||||
if (ent instanceof Villager)
|
||||
((Villager)ent).setProfession(profession);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
UtilPlayer.message(caller, F.desc("Profession", "Invalid [" + arg + "] on " + type.name()));
|
||||
}
|
||||
argHandle.add(arg);
|
||||
}
|
||||
|
||||
//Size
|
||||
else if (arg.toLowerCase().charAt(0) == 's')
|
||||
{
|
||||
try
|
||||
{
|
||||
String size = arg.substring(1, arg.length());
|
||||
|
||||
UtilPlayer.message(caller, F.desc("Size", Integer.parseInt(size)+""));
|
||||
|
||||
for (Entity ent : entSet)
|
||||
if (ent instanceof Slime)
|
||||
((Slime)ent).setSize(Integer.parseInt(size));
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
UtilPlayer.message(caller, F.desc("Size", "Invalid [" + arg + "] on " + type.name()));
|
||||
}
|
||||
argHandle.add(arg);
|
||||
}
|
||||
|
||||
else if (arg.toLowerCase().charAt(0) == 'n' && arg.length() > 1)
|
||||
{
|
||||
try
|
||||
{
|
||||
String name = "";
|
||||
|
||||
for (char c : arg.substring(1, arg.length()).toCharArray())
|
||||
{
|
||||
if (c != '_')
|
||||
name += c;
|
||||
else
|
||||
name += " ";
|
||||
}
|
||||
|
||||
for (Entity ent : entSet)
|
||||
{
|
||||
if (ent instanceof CraftLivingEntity)
|
||||
{
|
||||
CraftLivingEntity cEnt = (CraftLivingEntity)ent;
|
||||
cEnt.setCustomName(name);
|
||||
cEnt.setCustomNameVisible(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
UtilPlayer.message(caller, F.desc("Size", "Invalid [" + arg + "] on " + type.name()));
|
||||
}
|
||||
argHandle.add(arg);
|
||||
}
|
||||
}
|
||||
for (String arg : argHandle)
|
||||
argSet.remove(arg);
|
||||
|
||||
for (String arg : argSet)
|
||||
UtilPlayer.message(caller, F.desc("Unhandled", arg));
|
||||
|
||||
//Inform
|
||||
UtilPlayer.message(caller, F.main("Creature", "Spawned " + count + " " + UtilEnt.getName(type) + "."));
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void doubleJumpTrigger(PlayerToggleFlightEvent event)
|
||||
{
|
||||
@ -556,6 +1065,12 @@ public class EventGame extends SoloGame
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.LOW)
|
||||
public void explosionBlocks(EntityExplodeEvent event)
|
||||
{
|
||||
event.blockList().clear();
|
||||
}
|
||||
|
||||
// @EventHandler
|
||||
// public void updateVisibility(UpdateEvent event)
|
||||
// {
|
||||
@ -630,9 +1145,20 @@ public class EventGame extends SoloGame
|
||||
|
||||
//This re-enables cosmetic hotbar, because MPS disables it
|
||||
@EventHandler(priority = EventPriority.MONITOR)
|
||||
public void fixHotbarItemTemp(PlayerCommandPreprocessEvent event)
|
||||
public void fixHotbarItemTemp(GameStateChangeEvent event)
|
||||
{
|
||||
if (event.getMessage().toLowerCase().startsWith("/sethost"))
|
||||
Manager.GetServerConfig().HotbarInventory = true;
|
||||
}
|
||||
|
||||
public void giveItems(Player player)
|
||||
{
|
||||
UtilInv.Clear(player);
|
||||
|
||||
for (Material mat : _kitItems.keySet())
|
||||
{
|
||||
int amount = _kitItems.get(mat);
|
||||
|
||||
player.getInventory().addItem(new ItemStack(mat, amount));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -6,6 +6,7 @@ import org.bukkit.entity.Player;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
import nautilus.game.arcade.ArcadeManager;
|
||||
import nautilus.game.arcade.game.games.event.EventGame;
|
||||
import nautilus.game.arcade.kit.Kit;
|
||||
import nautilus.game.arcade.kit.KitAvailability;
|
||||
import nautilus.game.arcade.kit.Perk;
|
||||
@ -32,6 +33,6 @@ public class KitPlayer extends Kit
|
||||
@Override
|
||||
public void GiveItems(Player player)
|
||||
{
|
||||
|
||||
((EventGame)Manager.GetGame()).giveItems(player);
|
||||
}
|
||||
}
|
||||
|
@ -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
@ -7,6 +7,7 @@ import mineplex.core.common.util.C;
|
||||
import mineplex.core.common.util.F;
|
||||
import mineplex.core.party.Party;
|
||||
import nautilus.game.arcade.ArcadeManager;
|
||||
import nautilus.game.arcade.GameType;
|
||||
import nautilus.game.arcade.game.GameTeam;
|
||||
import nautilus.game.arcade.game.Game.GameState;
|
||||
|
||||
@ -68,10 +69,16 @@ public class GameChatManager implements Listener
|
||||
//Rank Prefix & MPS Host Prefix
|
||||
if (Manager.GetGameHostManager().isHost(event.getPlayer()))
|
||||
{
|
||||
if (Manager.GetGame() != null && Manager.GetGame().GetType() == GameType.Event)
|
||||
rankStr = C.cDGreen + C.Bold + "Event Host ";
|
||||
else
|
||||
rankStr = C.cDGreen + C.Bold + "MPS Host ";
|
||||
}
|
||||
else if (Manager.GetGameHostManager().isAdmin(event.getPlayer(), false))
|
||||
{
|
||||
if (Manager.GetGame() != null && Manager.GetGame().GetType() == GameType.Event)
|
||||
rankStr = C.cDGreen + C.Bold + "Event Admin ";
|
||||
else
|
||||
rankStr = C.cDGreen + C.Bold + "MPS Admin ";
|
||||
}
|
||||
else
|
||||
|
@ -319,6 +319,10 @@ public class GameFlagManager implements Listener
|
||||
if (!player.isOp() || player.getGameMode() != GameMode.CREATIVE)
|
||||
event.setCancelled(true);
|
||||
}
|
||||
else if (game.BlockPlaceCreative && player.getGameMode() == GameMode.CREATIVE) // Event Server Allowance
|
||||
{
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (game.BlockPlace)
|
||||
@ -356,6 +360,10 @@ public class GameFlagManager implements Listener
|
||||
{
|
||||
event.setCancelled(true);
|
||||
}
|
||||
else if (game.BlockBreakCreative && player.getGameMode() == GameMode.CREATIVE) // Event Server Allowance
|
||||
{
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (game.BlockBreak)
|
||||
|
Loading…
Reference in New Issue
Block a user