Finished conversion.

This commit is contained in:
Jonathan Williams 2014-03-19 04:09:40 -07:00
parent 515a01fd7d
commit f24f81b7c3
51 changed files with 241 additions and 607 deletions

View File

@ -108,6 +108,7 @@
<zipfileset src="../Libraries/httpmime-4.2.jar" />
<zipfileset src="../Libraries/gson-2.2.1.jar" />
<zipfileset src="../Libraries/commons-logging-1.1.1.jar" />
<zipfileset src="../Libraries/commons-io-2.4" />
<zipfileset src="../Libraries/commons-codec-1.6.jar" />
</jar>
<copy file="../bin/Hub.jar" todir="../../Testing/Hub/plugins"/>

Binary file not shown.

View File

@ -9,7 +9,7 @@ import net.minecraft.server.v1_7_R1.Packet;
import net.minecraft.server.v1_7_R1.PacketPlayInClientCommand;
import net.minecraft.server.v1_7_R1.PacketPlayOutEntityDestroy;
import net.minecraft.server.v1_7_R1.PacketPlayOutEntityMetadata;
import net.minecraft.server.v1_7_R1.PacketPlayOutSpawnEntity;
import net.minecraft.server.v1_7_R1.PacketPlayOutSpawnEntityLiving;
import org.bukkit.Bukkit;
import org.bukkit.Location;
@ -32,8 +32,8 @@ public class UtilDisplay
}
//Accessing packets
public static PacketPlayOutSpawnEntity getMobPacket(String text, double healthPercent, Location loc){
PacketPlayOutSpawnEntity mobPacket = new PacketPlayOutSpawnEntity();
public static PacketPlayOutSpawnEntityLiving getMobPacket(String text, double healthPercent, Location loc){
PacketPlayOutSpawnEntityLiving mobPacket = new PacketPlayOutSpawnEntityLiving();
mobPacket.a = (int) ENTITY_ID; //Entity ID
mobPacket.b = (byte) EntityType.ENDER_DRAGON.getTypeId(); //Mob type (ID: 64)
@ -49,22 +49,13 @@ public class UtilDisplay
DataWatcher watcher = getWatcher(text, healthPercent * 200);
try{
Field t = PacketPlayOutSpawnEntity.class.getDeclaredField("t");
t.setAccessible(true);
t.set(mobPacket, watcher);
} catch(Exception e){
e.printStackTrace();
}
mobPacket.l = watcher;
return mobPacket;
}
public static PacketPlayOutEntityDestroy getDestroyEntityPacket(){
PacketPlayOutEntityDestroy packet = new PacketPlayOutEntityDestroy();
packet.a = new int[]{ENTITY_ID};
PacketPlayOutEntityDestroy packet = new PacketPlayOutEntityDestroy(ENTITY_ID);
return packet;
}
@ -86,16 +77,8 @@ public class UtilDisplay
return metaPacket;
}
public static PacketPlayInClientCommand getRespawnPacket(){
PacketPlayInClientCommand packet = new PacketPlayInClientCommand();
packet.a = (int) 1;
return packet;
}
public static DataWatcher getWatcher(String text, double health){
DataWatcher watcher = new DataWatcher();
DataWatcher watcher = new DataWatcher(null);
watcher.a(0, (Byte) (byte) 0x20); //Flags, 0x20 = invisible
watcher.a(6, (Float) (float) health);
@ -109,7 +92,7 @@ public class UtilDisplay
//Other methods
public static void displayTextBar(JavaPlugin plugin, final Player player, double healthPercent, String text)
{
PacketPlayOutSpawnEntity mobPacket = getMobPacket(text, healthPercent, player.getLocation());
PacketPlayOutSpawnEntityLiving mobPacket = getMobPacket(text, healthPercent, player.getLocation());
sendPacket(player, mobPacket);
hasHealthBar.put(player.getName(), true);
@ -126,7 +109,7 @@ public class UtilDisplay
}
public static void displayLoadingBar(final String text, final String completeText, final Player player, final int healthAdd, final long delay, final boolean loadUp, final JavaPlugin plugin){
PacketPlayOutSpawnEntity mobPacket = getMobPacket(text, 0, player.getLocation());
PacketPlayOutSpawnEntityLiving mobPacket = getMobPacket(text, 0, player.getLocation());
sendPacket(player, mobPacket);
hasHealthBar.put(player.getName(), true);
@ -157,7 +140,7 @@ public class UtilDisplay
hasHealthBar.put(player.getName(), false);
//Complete text
PacketPlayOutSpawnEntity mobPacket = getMobPacket(completeText, 100, player.getLocation());
PacketPlayOutSpawnEntityLiving mobPacket = getMobPacket(completeText, 100, player.getLocation());
sendPacket(player, mobPacket);
hasHealthBar.put(player.getName(), true);

View File

@ -32,7 +32,7 @@ public class Blood extends MiniPlugin
@EventHandler
public void Death(PlayerDeathEvent event)
{
Effects(event.getEntity().getEyeLocation(), 10, 0.5, Sound.HURT, 1f, 1f, Material.INK_SACK, (byte)1, true);
Effects(event.getEntity().getEyeLocation(), 10, 0.5, Sound.HURT_FLESH, 1f, 1f, Material.INK_SACK, (byte)1, true);
}
public void Effects(Location loc, int particles, double velMult, Sound sound,

View File

@ -8,18 +8,19 @@ import java.util.List;
import net.minecraft.server.v1_7_R1.ChunkAddEntityEvent;
import net.minecraft.server.v1_7_R1.EntityPlayer;
import net.minecraft.server.v1_7_R1.Packet;
import net.minecraft.server.v1_7_R1.Packet18ArmAnimation;
import net.minecraft.server.v1_7_R1.Packet20NamedEntitySpawn;
import net.minecraft.server.v1_7_R1.Packet24MobSpawn;
import net.minecraft.server.v1_7_R1.Packet28EntityVelocity;
import net.minecraft.server.v1_7_R1.Packet29DestroyEntity;
import net.minecraft.server.v1_7_R1.Packet31RelEntityMove;
import net.minecraft.server.v1_7_R1.Packet33RelEntityMoveLook;
import net.minecraft.server.v1_7_R1.Packet34EntityTeleport;
import net.minecraft.server.v1_7_R1.Packet40EntityMetadata;
import net.minecraft.server.v1_7_R1.Packet44UpdateAttributes;
import net.minecraft.server.v1_7_R1.Packet5EntityEquipment;
import net.minecraft.server.v1_7_R1.Packet62NamedSoundEffect;
import net.minecraft.server.v1_7_R1.PacketPlayOutAnimation;
import net.minecraft.server.v1_7_R1.PacketPlayOutNamedEntitySpawn;
import net.minecraft.server.v1_7_R1.PacketPlayOutSpawnEntity;
import net.minecraft.server.v1_7_R1.PacketPlayOutEntityVelocity;
import net.minecraft.server.v1_7_R1.PacketPlayOutEntityDestroy;
import net.minecraft.server.v1_7_R1.PacketPlayOutRelEntityMove;
import net.minecraft.server.v1_7_R1.PacketPlayOutRelEntityMoveLook;
import net.minecraft.server.v1_7_R1.PacketPlayOutEntityTeleport;
import net.minecraft.server.v1_7_R1.PacketPlayOutEntityMetadata;
import net.minecraft.server.v1_7_R1.PacketPlayOutSpawnEntityLiving;
import net.minecraft.server.v1_7_R1.PacketPlayOutUpdateAttributes;
import net.minecraft.server.v1_7_R1.PacketPlayOutEntityEquipment;
import net.minecraft.server.v1_7_R1.PacketPlayOutNamedSoundEffect;
import org.bukkit.Bukkit;
import org.bukkit.craftbukkit.v1_7_R1.entity.CraftLivingEntity;
@ -50,8 +51,8 @@ import mineplex.core.updater.event.UpdateEvent;
public class DisguiseManager extends MiniPlugin implements IPacketRunnable
{
private NautHashMap<Integer, DisguiseBase> _spawnPacketMap = new NautHashMap<Integer, DisguiseBase>();
private NautHashMap<Integer, Packet28EntityVelocity> _movePacketMap = new NautHashMap<Integer, Packet28EntityVelocity>();
private NautHashMap<Integer, Packet28EntityVelocity> _moveTempMap = new NautHashMap<Integer, Packet28EntityVelocity>();
private NautHashMap<Integer, PacketPlayOutEntityVelocity> _movePacketMap = new NautHashMap<Integer, PacketPlayOutEntityVelocity>();
private NautHashMap<Integer, PacketPlayOutEntityVelocity> _moveTempMap = new NautHashMap<Integer, PacketPlayOutEntityVelocity>();
private HashSet<Integer> _goingUp = new HashSet<Integer>();
private NautHashMap<String, DisguiseBase> _entityDisguiseMap = new NautHashMap<String, DisguiseBase>();
private NautHashMap<String, EntityType> _addTempList = new NautHashMap<String, EntityType>();
@ -70,13 +71,13 @@ public class DisguiseManager extends MiniPlugin implements IPacketRunnable
try
{
_attributesA = Packet44UpdateAttributes.class.getDeclaredField("a");
_attributesA = PacketPlayOutUpdateAttributes.class.getDeclaredField("a");
_attributesA.setAccessible(true);
_soundB = Packet62NamedSoundEffect.class.getDeclaredField("b");
_soundB = PacketPlayOutNamedSoundEffect.class.getDeclaredField("b");
_soundB.setAccessible(true);
_soundC = Packet62NamedSoundEffect.class.getDeclaredField("c");
_soundC = PacketPlayOutNamedSoundEffect.class.getDeclaredField("c");
_soundC.setAccessible(true);
_soundD = Packet62NamedSoundEffect.class.getDeclaredField("d");
_soundD = PacketPlayOutNamedSoundEffect.class.getDeclaredField("d");
_soundD.setAccessible(true);
}
catch (IllegalArgumentException e)
@ -124,7 +125,7 @@ public class DisguiseManager extends MiniPlugin implements IPacketRunnable
continue;
EntityPlayer entityPlayer = ((CraftPlayer)player).getHandle();
entityPlayer.playerConnection.sendPacket(new Packet29DestroyEntity(entity.getEntityId()));
entityPlayer.playerConnection.sendPacket(new PacketPlayOutEntityDestroy(entity.getEntityId()));
if (entity instanceof Player)
{
@ -132,7 +133,7 @@ public class DisguiseManager extends MiniPlugin implements IPacketRunnable
}
else
{
entityPlayer.playerConnection.sendPacket(new Packet24MobSpawn(((CraftLivingEntity)entity).getHandle()));
entityPlayer.playerConnection.sendPacket(new PacketPlayOutSpawnEntityLiving(((CraftLivingEntity)entity).getHandle()));
}
}
@ -150,7 +151,7 @@ public class DisguiseManager extends MiniPlugin implements IPacketRunnable
EntityPlayer entityPlayer = ((CraftPlayer)player).getHandle();
entityPlayer.playerConnection.sendPacket(new Packet29DestroyEntity(disguise.GetEntityId()));
entityPlayer.playerConnection.sendPacket(new PacketPlayOutEntityDestroy(disguise.GetEntityId()));
}
List<Packet> tempArmor = new ArrayList<Packet>();
@ -240,7 +241,7 @@ public class DisguiseManager extends MiniPlugin implements IPacketRunnable
continue;
if (otherPlayer.getLocation().subtract(0, .5, 0).getBlock().getTypeId() != 0)
((CraftPlayer)player).getHandle().playerConnection.sendPacket(new Packet34EntityTeleport(((CraftPlayer)otherPlayer).getHandle()));
((CraftPlayer)player).getHandle().playerConnection.sendPacket(new PacketPlayOutEntityTeleport(((CraftPlayer)otherPlayer).getHandle()));
}
}
}
@ -265,9 +266,9 @@ public class DisguiseManager extends MiniPlugin implements IPacketRunnable
@Override
public boolean run(Packet packet, Player owner, final PacketArrayList packetList)
{
if (packet instanceof Packet20NamedEntitySpawn)
if (packet instanceof PacketPlayOutNamedEntitySpawn)
{
int entityId = ((Packet20NamedEntitySpawn)packet).a;
int entityId = ((PacketPlayOutNamedEntitySpawn)packet).a;
if (_spawnPacketMap.containsKey(entityId))
{
@ -275,9 +276,9 @@ public class DisguiseManager extends MiniPlugin implements IPacketRunnable
return false;
}
}
else if (packet instanceof Packet24MobSpawn)
else if (packet instanceof PacketPlayOutSpawnEntity)
{
int entityId = ((Packet24MobSpawn)packet).a;
int entityId = ((PacketPlayOutSpawnEntity)packet).a;
if (_spawnPacketMap.containsKey(entityId))
{
@ -285,13 +286,13 @@ public class DisguiseManager extends MiniPlugin implements IPacketRunnable
return false;
}
}
else if (packet instanceof Packet44UpdateAttributes)
else if (packet instanceof PacketPlayOutUpdateAttributes)
{
int entityId = -1;
try
{
entityId = (int)_attributesA.get((Packet44UpdateAttributes)packet);
entityId = (int)_attributesA.get((PacketPlayOutUpdateAttributes)packet);
}
catch (IllegalArgumentException e)
{
@ -309,18 +310,18 @@ public class DisguiseManager extends MiniPlugin implements IPacketRunnable
return false;
}
}
else if (packet instanceof Packet18ArmAnimation)
else if (packet instanceof PacketPlayOutAnimation)
{
int entityId = ((Packet18ArmAnimation)packet).a;
int entityId = ((PacketPlayOutAnimation)packet).a;
if (_spawnPacketMap.containsKey(entityId) && owner.getEntityId() != entityId)
{
return false;
}
}
else if (packet instanceof Packet40EntityMetadata)
else if (packet instanceof PacketPlayOutEntityMetadata)
{
int entityId = ((Packet40EntityMetadata)packet).a;
int entityId = ((PacketPlayOutEntityMetadata)packet).a;
if (_spawnPacketMap.containsKey(entityId) && owner.getEntityId() != entityId)
{
@ -328,21 +329,21 @@ public class DisguiseManager extends MiniPlugin implements IPacketRunnable
return false;
}
}
else if (packet instanceof Packet5EntityEquipment)
else if (packet instanceof PacketPlayOutEntityEquipment)
{
int entityId = ((Packet5EntityEquipment)packet).a;
int entityId = ((PacketPlayOutEntityEquipment)packet).a;
if (_spawnPacketMap.containsKey(entityId) && _spawnPacketMap.get(entityId) instanceof DisguiseInsentient)
{
if (!((DisguiseInsentient)_spawnPacketMap.get(entityId)).armorVisible() && ((Packet5EntityEquipment)packet).b != 0)
if (!((DisguiseInsentient)_spawnPacketMap.get(entityId)).armorVisible() && ((PacketPlayOutEntityEquipment)packet).b != 0)
{
return false;
}
}
}
else if (packet instanceof Packet28EntityVelocity)
else if (packet instanceof PacketPlayOutEntityVelocity)
{
Packet28EntityVelocity velocityPacket = (Packet28EntityVelocity)packet;
PacketPlayOutEntityVelocity velocityPacket = (PacketPlayOutEntityVelocity)packet;
// Only for viewers
if (velocityPacket.a == owner.getEntityId())
@ -359,9 +360,9 @@ public class DisguiseManager extends MiniPlugin implements IPacketRunnable
return false;
}
}
else if (packet instanceof Packet31RelEntityMove)
else if (packet instanceof PacketPlayOutRelEntityMove)
{
final Packet31RelEntityMove movePacket = (Packet31RelEntityMove)packet;
final PacketPlayOutRelEntityMove movePacket = (PacketPlayOutRelEntityMove)packet;
// Only for viewers
if (movePacket.a == owner.getEntityId())
@ -376,7 +377,7 @@ public class DisguiseManager extends MiniPlugin implements IPacketRunnable
if (!_spawnPacketMap.containsKey(movePacket.a))
return true;
final Packet28EntityVelocity velocityPacket = new Packet28EntityVelocity();
final PacketPlayOutEntityVelocity velocityPacket = new PacketPlayOutEntityVelocity();
velocityPacket.a = movePacket.a;
velocityPacket.b = movePacket.b * 100;
velocityPacket.c = movePacket.c * 100;
@ -384,7 +385,7 @@ public class DisguiseManager extends MiniPlugin implements IPacketRunnable
if (_movePacketMap.containsKey(movePacket.a))
{
Packet28EntityVelocity lastVelocityPacket = _movePacketMap.get(movePacket.a);
PacketPlayOutEntityVelocity lastVelocityPacket = _movePacketMap.get(movePacket.a);
velocityPacket.b = (int) (.8 * lastVelocityPacket.b);
velocityPacket.c = (int) (.8 * lastVelocityPacket.c);
@ -411,9 +412,9 @@ public class DisguiseManager extends MiniPlugin implements IPacketRunnable
}
}
else if (packet instanceof Packet33RelEntityMoveLook)
else if (packet instanceof PacketPlayOutRelEntityMoveLook)
{
final Packet33RelEntityMoveLook movePacket = (Packet33RelEntityMoveLook)packet;
final PacketPlayOutRelEntityMoveLook movePacket = (PacketPlayOutRelEntityMoveLook)packet;
// Only for viewers
if (movePacket.a == owner.getEntityId())
@ -428,7 +429,7 @@ public class DisguiseManager extends MiniPlugin implements IPacketRunnable
if (!_spawnPacketMap.containsKey(movePacket.a))
return true;
final Packet28EntityVelocity velocityPacket = new Packet28EntityVelocity();
final PacketPlayOutEntityVelocity velocityPacket = new PacketPlayOutEntityVelocity();
velocityPacket.a = movePacket.a;
velocityPacket.b = movePacket.b * 100;
velocityPacket.c = movePacket.c * 100;
@ -436,7 +437,7 @@ public class DisguiseManager extends MiniPlugin implements IPacketRunnable
if (_movePacketMap.containsKey(movePacket.a))
{
Packet28EntityVelocity lastVelocityPacket = _movePacketMap.get(movePacket.a);
PacketPlayOutEntityVelocity lastVelocityPacket = _movePacketMap.get(movePacket.a);
velocityPacket.b = (int) (.8 * lastVelocityPacket.b);
velocityPacket.c = (int) (.8 * lastVelocityPacket.c);
@ -458,13 +459,13 @@ public class DisguiseManager extends MiniPlugin implements IPacketRunnable
});
}
}
else if (packet instanceof Packet62NamedSoundEffect)
else if (packet instanceof PacketPlayOutNamedSoundEffect)
{
try
{
int x = (int) _soundB.get((Packet62NamedSoundEffect)packet) / 8;
int y = (int) _soundC.get((Packet62NamedSoundEffect)packet) / 8;
int z = (int) _soundD.get((Packet62NamedSoundEffect)packet) / 8;
int x = (int) _soundB.get((PacketPlayOutNamedSoundEffect)packet) / 8;
int y = (int) _soundC.get((PacketPlayOutNamedSoundEffect)packet) / 8;
int z = (int) _soundD.get((PacketPlayOutNamedSoundEffect)packet) / 8;
for (DisguiseBase disguise : _spawnPacketMap.values())
{

View File

@ -6,7 +6,7 @@ import org.bukkit.craftbukkit.v1_7_R1.entity.CraftEntity;
import net.minecraft.server.v1_7_R1.DataWatcher;
import net.minecraft.server.v1_7_R1.Entity;
import net.minecraft.server.v1_7_R1.Packet;
import net.minecraft.server.v1_7_R1.Packet40EntityMetadata;
import net.minecraft.server.v1_7_R1.PacketPlayOutEntityMetadata;
public abstract class DisguiseBase
{
@ -18,7 +18,7 @@ public abstract class DisguiseBase
public DisguiseBase(org.bukkit.entity.Entity entity)
{
Entity = ((CraftEntity)entity).getHandle();
DataWatcher = new DataWatcher();
DataWatcher = new DataWatcher(null);
DataWatcher.a(0, Byte.valueOf((byte)0));
DataWatcher.a(1, Short.valueOf((short)300));
@ -42,7 +42,7 @@ public abstract class DisguiseBase
public Packet GetMetaDataPacket()
{
UpdateDataWatcher();
return new Packet40EntityMetadata(Entity.id, DataWatcher, true);
return new PacketPlayOutEntityMetadata(Entity.getId(), DataWatcher, true);
}
public void setSoundDisguise(DisguiseBase soundDisguise)
@ -75,7 +75,7 @@ public abstract class DisguiseBase
public int GetEntityId()
{
return Entity.id;
return Entity.getId();
}
protected abstract String getHurtSound();

View File

@ -4,7 +4,7 @@ import java.util.Random;
import net.minecraft.server.v1_7_R1.MathHelper;
import net.minecraft.server.v1_7_R1.Packet;
import net.minecraft.server.v1_7_R1.Packet23VehicleSpawn;
import net.minecraft.server.v1_7_R1.PacketPlayOutSpawnEntity;
public class DisguiseBlock extends DisguiseBase
{
@ -34,8 +34,8 @@ public class DisguiseBlock extends DisguiseBase
@Override
public Packet GetSpawnPacket()
{
Packet23VehicleSpawn packet = new Packet23VehicleSpawn();
packet.a = Entity.id;
PacketPlayOutSpawnEntity packet = new PacketPlayOutSpawnEntity();
packet.a = Entity.getId();
packet.b = MathHelper.floor(Entity.locX * 32.0D);
packet.c = MathHelper.floor(Entity.locY * 32.0D);
packet.d = MathHelper.floor(Entity.locZ * 32.0D);

View File

@ -1,31 +1,23 @@
package mineplex.core.disguise.disguises;
import java.lang.reflect.Field;
import net.minecraft.server.v1_7_R1.EnumEntitySize;
import net.minecraft.server.v1_7_R1.MathHelper;
import net.minecraft.server.v1_7_R1.Packet;
import net.minecraft.server.v1_7_R1.Packet24MobSpawn;
import net.minecraft.server.v1_7_R1.PacketPlayOutSpawnEntityLiving;
public abstract class DisguiseCreature extends DisguiseInsentient
{
private static Field _spawnDataWatcherField;
private static Field _spawnListField;
public DisguiseCreature(org.bukkit.entity.Entity entity)
{
super(entity);
SetSpawnDataWatcherField();
SetSpawnListField();
}
protected abstract int GetEntityTypeId();
public Packet GetSpawnPacket()
{
Packet24MobSpawn packet = new Packet24MobSpawn();
packet.a = Entity.id;
PacketPlayOutSpawnEntityLiving packet = new PacketPlayOutSpawnEntityLiving();
packet.a = Entity.getId();
packet.b = (byte) GetEntityTypeId();
packet.c = (int)EnumEntitySize.SIZE_2.a(Entity.locX);
packet.d = (int)MathHelper.floor(Entity.locY * 32.0D);
@ -73,72 +65,9 @@ public abstract class DisguiseCreature extends DisguiseInsentient
packet.g = (int)(var6 * 8000.0D);
packet.h = (int)(var8 * 8000.0D);
try
{
_spawnDataWatcherField.set(packet, DataWatcher);
}
catch (IllegalArgumentException e)
{
e.printStackTrace();
}
catch (IllegalAccessException e)
{
e.printStackTrace();
}
try
{
_spawnListField.set(packet, DataWatcher.b());
}
catch (IllegalArgumentException e)
{
e.printStackTrace();
}
catch (IllegalAccessException e)
{
e.printStackTrace();
}
packet.l = DataWatcher;
packet.m = DataWatcher.b();
return packet;
}
private void SetSpawnListField()
{
if (_spawnListField == null)
{
try
{
_spawnListField = Packet24MobSpawn.class.getDeclaredField("u");
_spawnListField.setAccessible(true);
}
catch (NoSuchFieldException e)
{
e.printStackTrace();
}
catch (SecurityException e)
{
e.printStackTrace();
}
}
}
private void SetSpawnDataWatcherField()
{
if (_spawnDataWatcherField == null)
{
try
{
_spawnDataWatcherField = Packet24MobSpawn.class.getDeclaredField("t");
_spawnDataWatcherField.setAccessible(true);
}
catch (NoSuchFieldException e)
{
e.printStackTrace();
}
catch (SecurityException e)
{
e.printStackTrace();
}
}
}
}

View File

@ -4,7 +4,7 @@ import java.util.ArrayList;
import java.util.List;
import net.minecraft.server.v1_7_R1.Packet;
import net.minecraft.server.v1_7_R1.Packet5EntityEquipment;
import net.minecraft.server.v1_7_R1.PacketPlayOutEntityEquipment;
public abstract class DisguiseInsentient extends DisguiseLiving
{
@ -55,7 +55,7 @@ public abstract class DisguiseInsentient extends DisguiseLiving
public List<Packet> getArmorPackets()
{
List<Packet5EntityEquipment> p5 = new ArrayList<Packet5EntityEquipment>();
List<PacketPlayOutEntityEquipment> p5 = new ArrayList<PacketPlayOutEntityEquipment>();
net.minecraft.server.v1_7_R1.ItemStack[] armorContents = Entity.getEquipment();
for (short i=0; i < armorContents.length; i++)
@ -64,7 +64,7 @@ public abstract class DisguiseInsentient extends DisguiseLiving
if (armorSlot != null)
{
p5.add(new Packet5EntityEquipment(Entity.id, i, armorSlot));
p5.add(new PacketPlayOutEntityEquipment(Entity.getId(), i, armorSlot));
}
}

View File

@ -1,25 +1,17 @@
package mineplex.core.disguise.disguises;
import java.lang.reflect.Field;
import net.minecraft.server.v1_7_R1.EnumEntitySize;
import net.minecraft.server.v1_7_R1.MathHelper;
import net.minecraft.server.v1_7_R1.Packet;
import net.minecraft.server.v1_7_R1.Packet24MobSpawn;
import net.minecraft.server.v1_7_R1.PacketPlayOutSpawnEntityLiving;
public class DisguiseMagmaCube extends DisguiseInsentient
{
private static Field _spawnDataWatcherField;
private static Field _spawnListField;
public DisguiseMagmaCube(org.bukkit.entity.Entity entity)
{
super(entity);
DataWatcher.a(16, new Byte((byte)1));
SetSpawnDataWatcherField();
SetSpawnListField();
}
public void SetSize(int i)
@ -34,8 +26,8 @@ public class DisguiseMagmaCube extends DisguiseInsentient
public Packet GetSpawnPacket()
{
Packet24MobSpawn packet = new Packet24MobSpawn();
packet.a = Entity.id;
PacketPlayOutSpawnEntityLiving packet = new PacketPlayOutSpawnEntityLiving();
packet.a = Entity.getId();
packet.b = (byte) 62;
packet.c = (int)EnumEntitySize.SIZE_2.a(Entity.locX);
packet.d = (int)MathHelper.floor(Entity.locY * 32.0D);
@ -83,75 +75,12 @@ public class DisguiseMagmaCube extends DisguiseInsentient
packet.g = (int)(var6 * 8000.0D);
packet.h = (int)(var8 * 8000.0D);
try
{
_spawnDataWatcherField.set(packet, DataWatcher);
}
catch (IllegalArgumentException e)
{
e.printStackTrace();
}
catch (IllegalAccessException e)
{
e.printStackTrace();
}
try
{
_spawnListField.set(packet, DataWatcher.b());
}
catch (IllegalArgumentException e)
{
e.printStackTrace();
}
catch (IllegalAccessException e)
{
e.printStackTrace();
}
packet.l = DataWatcher;
packet.m = DataWatcher.b();
return packet;
}
private void SetSpawnListField()
{
if (_spawnListField == null)
{
try
{
_spawnListField = Packet24MobSpawn.class.getDeclaredField("u");
_spawnListField.setAccessible(true);
}
catch (NoSuchFieldException e)
{
e.printStackTrace();
}
catch (SecurityException e)
{
e.printStackTrace();
}
}
}
private void SetSpawnDataWatcherField()
{
if (_spawnDataWatcherField == null)
{
try
{
_spawnDataWatcherField = Packet24MobSpawn.class.getDeclaredField("t");
_spawnDataWatcherField.setAccessible(true);
}
catch (NoSuchFieldException e)
{
e.printStackTrace();
}
catch (SecurityException e)
{
e.printStackTrace();
}
}
}
protected String getHurtSound()
{
return "mob.slime." + (GetSize() > 1 ? "big" : "small");

View File

@ -1,15 +1,12 @@
package mineplex.core.disguise.disguises;
import java.lang.reflect.Field;
import net.minecraft.server.v1_7_R1.MathHelper;
import net.minecraft.server.v1_7_R1.Packet;
import net.minecraft.server.v1_7_R1.Packet20NamedEntitySpawn;
import net.minecraft.server.v1_7_R1.PacketPlayOutNamedEntitySpawn;
import net.minecraft.util.com.mojang.authlib.GameProfile;
public class DisguisePlayer extends DisguiseHuman
{
private static Field _spawnDataWatcherField;
private String _name;
public DisguisePlayer(org.bukkit.entity.Entity entity, String name)
@ -22,55 +19,21 @@ public class DisguisePlayer extends DisguiseHuman
}
_name = name;
SetSpawnDataWatcherField();
}
@Override
public Packet GetSpawnPacket()
{
Packet20NamedEntitySpawn packet = new Packet20NamedEntitySpawn();
packet.a = Entity.id;
packet.b = _name;
PacketPlayOutNamedEntitySpawn packet = new PacketPlayOutNamedEntitySpawn();
packet.a = Entity.getId();
packet.b = new GameProfile("1", _name);
packet.c = MathHelper.floor(Entity.locX * 32.0D);
packet.d = MathHelper.floor(Entity.locY * 32.0D);
packet.e = MathHelper.floor(Entity.locZ * 32.0D);
packet.f = (byte) ((int) (Entity.yaw * 256.0F / 360.0F));
packet.g = (byte) ((int) (Entity.pitch * 256.0F / 360.0F));
try
{
_spawnDataWatcherField.set(packet, DataWatcher);
}
catch (IllegalArgumentException e)
{
e.printStackTrace();
}
catch (IllegalAccessException e)
{
e.printStackTrace();
}
packet.i = DataWatcher;
return packet;
}
private void SetSpawnDataWatcherField()
{
if (_spawnDataWatcherField == null)
{
try
{
_spawnDataWatcherField = Packet20NamedEntitySpawn.class.getDeclaredField("i");
_spawnDataWatcherField.setAccessible(true);
}
catch (NoSuchFieldException e)
{
e.printStackTrace();
}
catch (SecurityException e)
{
e.printStackTrace();
}
}
}
}

View File

@ -1,25 +1,17 @@
package mineplex.core.disguise.disguises;
import java.lang.reflect.Field;
import net.minecraft.server.v1_7_R1.EnumEntitySize;
import net.minecraft.server.v1_7_R1.MathHelper;
import net.minecraft.server.v1_7_R1.Packet;
import net.minecraft.server.v1_7_R1.Packet24MobSpawn;
import net.minecraft.server.v1_7_R1.PacketPlayOutSpawnEntityLiving;
public class DisguiseSlime extends DisguiseInsentient
{
private static Field _spawnDataWatcherField;
private static Field _spawnListField;
public DisguiseSlime(org.bukkit.entity.Entity entity)
{
super(entity);
DataWatcher.a(16, new Byte((byte)1));
SetSpawnDataWatcherField();
SetSpawnListField();
}
public void SetSize(int i)
@ -34,8 +26,8 @@ public class DisguiseSlime extends DisguiseInsentient
public Packet GetSpawnPacket()
{
Packet24MobSpawn packet = new Packet24MobSpawn();
packet.a = Entity.id;
PacketPlayOutSpawnEntityLiving packet = new PacketPlayOutSpawnEntityLiving();
packet.a = Entity.getId();
packet.b = (byte) 55;
packet.c = (int)EnumEntitySize.SIZE_2.a(Entity.locX);
packet.d = (int)MathHelper.floor(Entity.locY * 32.0D);
@ -82,76 +74,12 @@ public class DisguiseSlime extends DisguiseInsentient
packet.f = (int)(var4 * 8000.0D);
packet.g = (int)(var6 * 8000.0D);
packet.h = (int)(var8 * 8000.0D);
try
{
_spawnDataWatcherField.set(packet, DataWatcher);
}
catch (IllegalArgumentException e)
{
e.printStackTrace();
}
catch (IllegalAccessException e)
{
e.printStackTrace();
}
try
{
_spawnListField.set(packet, DataWatcher.b());
}
catch (IllegalArgumentException e)
{
e.printStackTrace();
}
catch (IllegalAccessException e)
{
e.printStackTrace();
}
packet.l = DataWatcher;
packet.m = DataWatcher.b();
return packet;
}
private void SetSpawnListField()
{
if (_spawnListField == null)
{
try
{
_spawnListField = Packet24MobSpawn.class.getDeclaredField("u");
_spawnListField.setAccessible(true);
}
catch (NoSuchFieldException e)
{
e.printStackTrace();
}
catch (SecurityException e)
{
e.printStackTrace();
}
}
}
private void SetSpawnDataWatcherField()
{
if (_spawnDataWatcherField == null)
{
try
{
_spawnDataWatcherField = Packet24MobSpawn.class.getDeclaredField("t");
_spawnDataWatcherField.setAccessible(true);
}
catch (NoSuchFieldException e)
{
e.printStackTrace();
}
catch (SecurityException e)
{
e.printStackTrace();
}
}
}
protected String getHurtSound()
{
return "mob.slime." + (GetSize() > 1 ? "big" : "small");

View File

@ -10,7 +10,7 @@ public class DisguiseWolf extends DisguiseTameableAnimal
DataWatcher.a(18, new Float(20F));
DataWatcher.a(19, new Byte((byte)0));
DataWatcher.a(20, new Byte((byte)BlockCloth.j_(1)));
DataWatcher.a(20, new Byte((byte)BlockCloth.b(1)));
}
public boolean isAngry()

View File

@ -4,15 +4,20 @@ import java.lang.reflect.Field;
import net.minecraft.server.v1_7_R1.BlockCloth;
import net.minecraft.server.v1_7_R1.DataWatcher;
import net.minecraft.server.v1_7_R1.Entity;
import net.minecraft.server.v1_7_R1.EntityLiving;
import net.minecraft.server.v1_7_R1.EntitySlime;
import net.minecraft.server.v1_7_R1.EnumEntitySize;
import net.minecraft.server.v1_7_R1.MathHelper;
import net.minecraft.server.v1_7_R1.Packet;
import net.minecraft.server.v1_7_R1.Packet24MobSpawn;
import net.minecraft.server.v1_7_R1.Packet29DestroyEntity;
import net.minecraft.server.v1_7_R1.Packet39AttachEntity;
import net.minecraft.server.v1_7_R1.Packet40EntityMetadata;
import net.minecraft.server.v1_7_R1.PacketPlayOutSpawnEntityLiving;
import net.minecraft.server.v1_7_R1.PacketPlayOutEntityDestroy;
import net.minecraft.server.v1_7_R1.PacketPlayOutAttachEntity;
import net.minecraft.server.v1_7_R1.PacketPlayOutEntityMetadata;
import org.bukkit.Bukkit;
import org.bukkit.Location;
import org.bukkit.craftbukkit.v1_7_R1.CraftWorld;
import org.bukkit.entity.EntityType;
public class FakeEntity
@ -63,15 +68,12 @@ public class FakeEntity
public Packet Destroy()
{
Packet29DestroyEntity packet = new Packet29DestroyEntity();
packet.a = new int[] { GetEntityId() };
return packet;
return new PacketPlayOutEntityDestroy(new int[] { GetEntityId() });
}
public Packet Spawn(int id)
{
Packet24MobSpawn packet = new Packet24MobSpawn();
PacketPlayOutSpawnEntityLiving packet = new PacketPlayOutSpawnEntityLiving();
packet.a = id;
packet.b = (byte) _entityType.getTypeId();
packet.c = (int)EnumEntitySize.SIZE_2.a(_location.getX());
@ -119,8 +121,8 @@ public class FakeEntity
packet.f = (int)(var4 * 8000.0D);
packet.g = (int)(var6 * 8000.0D);
packet.h = (int)(var8 * 8000.0D);
DataWatcher dataWatcher = new DataWatcher();
DataWatcher dataWatcher = new DataWatcher(new EntitySlime(((CraftWorld)Bukkit.getWorlds().get(0)).getHandle()));
UpdateDataWatcher(dataWatcher);
@ -160,27 +162,27 @@ public class FakeEntity
public Packet Hide(int entityId)
{
DataWatcher dataWatcher = new DataWatcher();
DataWatcher dataWatcher = new DataWatcher(new EntitySlime(((CraftWorld)Bukkit.getWorlds().get(0)).getHandle()));
UpdateDataWatcher(dataWatcher);
dataWatcher.watch(0, Byte.valueOf((byte) 32));
return new Packet40EntityMetadata(entityId, dataWatcher, false);
return new PacketPlayOutEntityMetadata(entityId, dataWatcher, false);
}
public Packet Show()
{
DataWatcher dataWatcher = new DataWatcher();
DataWatcher dataWatcher = new DataWatcher(new EntitySlime(((CraftWorld)Bukkit.getWorlds().get(0)).getHandle()));
UpdateDataWatcher(dataWatcher);
return new Packet40EntityMetadata(_entityId, dataWatcher, true);
return new PacketPlayOutEntityMetadata(_entityId, dataWatcher, true);
}
public Packet SetVehicle(int vehicleId)
{
Packet39AttachEntity vehiclePacket = new Packet39AttachEntity();
PacketPlayOutAttachEntity vehiclePacket = new PacketPlayOutAttachEntity();
vehiclePacket.a = 0;
vehiclePacket.b = _entityId;
vehiclePacket.c = vehicleId;
@ -195,7 +197,7 @@ public class FakeEntity
public Packet SetPassenger(int passengerId, int entityId)
{
Packet39AttachEntity vehiclePacket = new Packet39AttachEntity();
PacketPlayOutAttachEntity vehiclePacket = new PacketPlayOutAttachEntity();
vehiclePacket.a = 0;
vehiclePacket.b = passengerId;
vehiclePacket.c = entityId;
@ -244,7 +246,7 @@ public class FakeEntity
case WOLF:
dataWatcher.a(18, new Integer(20));
dataWatcher.a(19, new Byte((byte) 0));
dataWatcher.a(20, new Byte((byte) BlockCloth.j_(1)));
dataWatcher.a(20, new Byte((byte) BlockCloth.b(1)));
case SKELETON:
dataWatcher.a(13, new Byte((byte) 0));
break;
@ -277,17 +279,15 @@ public class FakeEntity
{
try
{
_spawnListField = Packet24MobSpawn.class.getDeclaredField("u");
_spawnListField = PacketPlayOutSpawnEntityLiving.class.getDeclaredField("m");
_spawnListField.setAccessible(true);
}
catch (NoSuchFieldException e)
{
// TODO Auto-generated catch block
e.printStackTrace();
}
catch (SecurityException e)
{
// TODO Auto-generated catch block
e.printStackTrace();
}
}
@ -299,19 +299,17 @@ public class FakeEntity
{
try
{
_spawnDataWatcherField = Packet24MobSpawn.class.getDeclaredField("t");
_spawnDataWatcherField = PacketPlayOutSpawnEntityLiving.class.getDeclaredField("l");
_spawnDataWatcherField.setAccessible(true);
}
catch (NoSuchFieldException e)
{
// TODO Auto-generated catch block
e.printStackTrace();
}
catch (SecurityException e)
{
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}
}
}

View File

@ -3,7 +3,7 @@ package mineplex.core.fakeEntity;
import net.minecraft.server.v1_7_R1.EnumEntitySize;
import net.minecraft.server.v1_7_R1.MathHelper;
import net.minecraft.server.v1_7_R1.Packet;
import net.minecraft.server.v1_7_R1.Packet23VehicleSpawn;
import net.minecraft.server.v1_7_R1.PacketPlayOutSpawnEntity;
import org.bukkit.Location;
import org.bukkit.entity.EntityType;
@ -23,7 +23,7 @@ public class FakeFallingBlock extends FakeEntity
public Packet Spawn(int id)
{
Packet23VehicleSpawn packet = new Packet23VehicleSpawn();
PacketPlayOutSpawnEntity packet = new PacketPlayOutSpawnEntity();
packet.a = id;
packet.b = (int)EnumEntitySize.SIZE_2.a(GetLocation().getX());
packet.c = (int)MathHelper.floor(GetLocation().getY() * 32.0D);

View File

@ -4,7 +4,7 @@ import net.minecraft.server.v1_7_R1.DataWatcher;
import net.minecraft.server.v1_7_R1.ItemStack;
import net.minecraft.server.v1_7_R1.MathHelper;
import net.minecraft.server.v1_7_R1.Packet;
import net.minecraft.server.v1_7_R1.Packet23VehicleSpawn;
import net.minecraft.server.v1_7_R1.PacketPlayOutSpawnEntity;
import org.bukkit.Location;
import org.bukkit.craftbukkit.v1_7_R1.inventory.CraftItemStack;
@ -23,7 +23,7 @@ public class FakeItemDrop extends FakeEntity
public Packet Spawn()
{
Packet23VehicleSpawn packet = new Packet23VehicleSpawn();
PacketPlayOutSpawnEntity packet = new PacketPlayOutSpawnEntity();
packet.a = GetEntityId();
packet.b = MathHelper.floor(GetLocation().getX() * 32.0D);
packet.c = MathHelper.floor(GetLocation().getY() * 32.0D);

View File

@ -3,11 +3,15 @@ package mineplex.core.fakeEntity;
import java.lang.reflect.Field;
import net.minecraft.server.v1_7_R1.DataWatcher;
import net.minecraft.server.v1_7_R1.EntitySlime;
import net.minecraft.server.v1_7_R1.MathHelper;
import net.minecraft.server.v1_7_R1.Packet;
import net.minecraft.server.v1_7_R1.Packet20NamedEntitySpawn;
import net.minecraft.server.v1_7_R1.PacketPlayOutNamedEntitySpawn;
import net.minecraft.util.com.mojang.authlib.GameProfile;
import org.bukkit.Bukkit;
import org.bukkit.Location;
import org.bukkit.craftbukkit.v1_7_R1.CraftWorld;
import org.bukkit.entity.EntityType;
public class FakePlayer extends FakeEntity
@ -21,55 +25,25 @@ public class FakePlayer extends FakeEntity
super(EntityType.PLAYER, location);
_name = name;
if (_spawnDataWatcherField == null)
{
try
{
_spawnDataWatcherField = Packet20NamedEntitySpawn.class.getDeclaredField("i");
_spawnDataWatcherField.setAccessible(true);
}
catch (NoSuchFieldException e)
{
// TODO Auto-generated catch block
e.printStackTrace();
}
catch (SecurityException e)
{
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}
public Packet Spawn(int id)
{
Packet20NamedEntitySpawn packet = new Packet20NamedEntitySpawn();
PacketPlayOutNamedEntitySpawn packet = new PacketPlayOutNamedEntitySpawn();
packet.a = id;
packet.b = _name;
packet.b = new GameProfile("1", _name);
packet.c = MathHelper.floor(GetLocation().getX() * 32.0D);
packet.d = MathHelper.floor(GetLocation().getY() * 32.0D);
packet.e = MathHelper.floor(GetLocation().getZ() * 32.0D);
packet.f = (byte) ((int) (GetLocation().getYaw() * 256.0F / 360.0F));
packet.g = (byte) ((int) (GetLocation().getPitch() * 256.0F / 360.0F));
DataWatcher dataWatcher = new DataWatcher();
DataWatcher dataWatcher = new DataWatcher(new EntitySlime(((CraftWorld)Bukkit.getWorlds().get(0)).getHandle()));
UpdateDataWatcher(dataWatcher);
try
{
_spawnDataWatcherField.set(packet, dataWatcher);
}
catch (IllegalArgumentException e)
{
e.printStackTrace();
}
catch (IllegalAccessException e)
{
e.printStackTrace();
}
packet.i = dataWatcher;
return packet;
}
}

View File

@ -1,18 +1,18 @@
package mineplex.core.packethandler;
import java.lang.reflect.Field;
import java.util.ArrayList;
import java.util.concurrent.ConcurrentLinkedQueue;
import net.minecraft.server.v1_7_R1.Packet;
import net.minecraft.server.v1_7_R1.Packet28EntityVelocity;
import net.minecraft.server.v1_7_R1.Packet31RelEntityMove;
import net.minecraft.server.v1_7_R1.Packet33RelEntityMoveLook;
import net.minecraft.server.v1_7_R1.Packet34EntityTeleport;
import net.minecraft.server.v1_7_R1.Packet40EntityMetadata;
import net.minecraft.server.v1_7_R1.PacketPlayOutEntityVelocity;
import net.minecraft.server.v1_7_R1.PacketPlayOutRelEntityMove;
import net.minecraft.server.v1_7_R1.PacketPlayOutRelEntityMoveLook;
import net.minecraft.server.v1_7_R1.PacketPlayOutEntityTeleport;
import net.minecraft.server.v1_7_R1.PacketPlayOutEntityMetadata;
import org.bukkit.entity.Player;
public class PacketArrayList extends ArrayList<Packet>
public class PacketArrayList extends ConcurrentLinkedQueue<Packet>
{
private static final long serialVersionUID = 1L;
private Player _owner;
@ -26,7 +26,7 @@ public class PacketArrayList extends ArrayList<Packet>
try
{
_packet40Metadata = Packet40EntityMetadata.class.getDeclaredField("b");
_packet40Metadata = PacketPlayOutEntityMetadata.class.getDeclaredField("b");
}
catch (NoSuchFieldException e)
{
@ -43,59 +43,22 @@ public class PacketArrayList extends ArrayList<Packet>
@Override
public boolean add(Packet o)
{
/*
else if (o instanceof Packet201PlayerInfo)
if (o instanceof PacketPlayOutEntityTeleport)
{
if (!_handler.IsTracked((Packet201PlayerInfo)o))
return false;
//if (( && _packetHandler.IsPlayerTracked(((Packet201PlayerInfo)o).a) )
//{
// return false;
//}
}
else if (o instanceof Packet40EntityMetadata)
{
List<WatchableObject> objects = null;
try
{
objects = (List<WatchableObject>)_packet40Metadata.get(((Packet40EntityMetadata)o));
} catch (IllegalArgumentException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (IllegalAccessException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
System.out.println("Packet40EntityMetadata for " + ((Packet40EntityMetadata)o).a);
if (objects != null)
{
for (WatchableObject watched : objects)
{
System.out.println("a(" + watched.a() + ", " + watched.b() + ") " + GetDataType(watched.c()));
}
}
System.out.println("End Packet40EntityMetadata");
}
*/
if (o instanceof Packet34EntityTeleport)
{
Packet34EntityTeleport packet = (Packet34EntityTeleport)o;
PacketPlayOutEntityTeleport packet = (PacketPlayOutEntityTeleport)o;
//System.out.println("Packet34EntityTeleport (" + packet.b + ", " + packet.c + ", " + packet.d + ")");
if (_handler.IsForwarding(_owner) && _handler.IsForwarded(_owner, packet.a))
{
return super.add(new Packet34EntityTeleport(_handler.GetForwardId(_owner, packet.a), packet.b, packet.c, packet.d, packet.e, packet.f));
return super.add(new PacketPlayOutEntityTeleport(_handler.GetForwardId(_owner, packet.a), packet.b, packet.c, packet.d, packet.e, packet.f));
}
else if (_handler.IsBlocked(_owner, packet.a))
return false;
}
else if (o instanceof Packet28EntityVelocity)
else if (o instanceof PacketPlayOutEntityVelocity)
{
Packet28EntityVelocity packet = (Packet28EntityVelocity)o;
PacketPlayOutEntityVelocity packet = (PacketPlayOutEntityVelocity)o;
//System.out.println("Packet28EntityVelocity (" + packet.b / 8000.0D + ", " + packet.c / 8000.0D + ", " + packet.d / 8000.0D + ") for " + packet.a + " to " + _owner.getName());
@ -107,38 +70,32 @@ public class PacketArrayList extends ArrayList<Packet>
else if (_handler.IsBlocked(_owner, packet.a))
return false;
}
else if (o instanceof Packet31RelEntityMove)
else if (o instanceof PacketPlayOutRelEntityMove)
{
Packet31RelEntityMove packet = (Packet31RelEntityMove)o;
PacketPlayOutRelEntityMove packet = (PacketPlayOutRelEntityMove)o;
//System.out.println("Packet31RelEntityMove (" + packet.b + ", " + packet.c + ", " + packet.d + ")");
if (_handler.IsForwarding(_owner) && _handler.IsForwarded(_owner, packet.a))
{
return super.add(new Packet31RelEntityMove(_handler.GetForwardId(_owner, packet.a), packet.b, packet.c, packet.d));
return super.add(new PacketPlayOutRelEntityMove(_handler.GetForwardId(_owner, packet.a), packet.b, packet.c, packet.d));
}
else if (_handler.IsBlocked(_owner, packet.a))
return false;
}
else if (o instanceof Packet33RelEntityMoveLook)
else if (o instanceof PacketPlayOutRelEntityMoveLook)
{
Packet33RelEntityMoveLook packet = (Packet33RelEntityMoveLook)o;
PacketPlayOutRelEntityMoveLook packet = (PacketPlayOutRelEntityMoveLook)o;
//System.out.println("Packet33RelEntityMoveLook (" + packet.b + ", " + packet.c + ", " + packet.d + ")");
if (_handler.IsForwarding(_owner) && _handler.IsForwarded(_owner, packet.a))
{
return super.add(new Packet33RelEntityMoveLook(_handler.GetForwardId(_owner, packet.a), packet.b, packet.c, packet.d, packet.e, packet.f));
return super.add(new PacketPlayOutRelEntityMoveLook(_handler.GetForwardId(_owner, packet.a), packet.b, packet.c, packet.d, packet.e, packet.f));
}
else if (_handler.IsBlocked(_owner, packet.a))
return false;
}
/*
else if (!(o instanceof Packet206SetScoreboardObjective) && !(o instanceof Packet207SetScoreboardScore) && !(o instanceof Packet208SetScoreboardDisplayObjective) && !(o instanceof Packet56MapChunkBulk) && !(o instanceof Packet0KeepAlive) && !(o instanceof Packet4UpdateTime) && !(o instanceof Packet43SetExperience) && !(o instanceof Packet35EntityHeadRotation) && !(o instanceof Packet32EntityLook))
{
System.out.println(o.getClass());
}
*/
if (_handler.FireRunnables(o, _owner, this))
{

View File

@ -5,6 +5,8 @@ import java.util.ArrayList;
import java.util.Collections;
import java.util.HashSet;
import java.util.List;
import java.util.Queue;
import java.util.concurrent.ConcurrentLinkedQueue;
import java.util.logging.Level;
import mineplex.core.MiniPlugin;
@ -23,7 +25,6 @@ import org.bukkit.plugin.java.JavaPlugin;
@SuppressWarnings( { "rawtypes", "unchecked" } )
public class PacketHandler extends MiniPlugin
{
private Field syncField;
private Field highField;
private NautHashMap<String, NautHashMap<Integer, Integer>> _forwardMap;
@ -42,17 +43,15 @@ public class PacketHandler extends MiniPlugin
_fakePassengerMap = new NautHashMap<String, NautHashMap<Integer, Packet>>();
_packetRunnables = new ArrayList<IPacketRunnable>();
try
{
this.syncField = NetworkManager.class.getDeclaredField("h");
this.syncField.setAccessible(true);
this.highField = NetworkManager.class.getDeclaredField("highPriorityQueue");
this.highField.setAccessible(true);
}
catch (final Exception e)
{
System.out.println("Error initializing " + GetName() + " NetworkManager fields...");
}
try
{
highField = NetworkManager.class.getDeclaredField("i");
highField.setAccessible(true);
}
catch (NoSuchFieldException | SecurityException e)
{
e.printStackTrace();
}
}
public String GetDataType(int c)
@ -143,7 +142,7 @@ public class PacketHandler extends MiniPlugin
{
try
{
this.nom(this.getManager(player), Collections.synchronizedList(new PacketArrayList(player, this)));
this.nom(this.getManager(player), new PacketArrayList(player, this));
}
catch (final Exception e)
@ -156,7 +155,7 @@ public class PacketHandler extends MiniPlugin
{
try
{
this.nom(this.getManager(player), Collections.synchronizedList(new ArrayList()), true);
this.nom(this.getManager(player), new ConcurrentLinkedQueue(), true);
}
catch (final Exception e)
{
@ -180,14 +179,15 @@ public class PacketHandler extends MiniPlugin
return (NetworkManager) ((CraftPlayer) player).getHandle().playerConnection.networkManager;
}
private void nom(NetworkManager nm, List list) throws IllegalArgumentException, IllegalAccessException
private void nom(NetworkManager nm, Queue queue) throws IllegalArgumentException, IllegalAccessException
{
this.nom(nm, list, false);
this.nom(nm, queue, false);
}
private void nom(NetworkManager nm, List list, boolean onlyIfOldIsHacked) throws IllegalArgumentException, IllegalAccessException
private void nom(NetworkManager nm, Queue queue, boolean onlyIfOldIsHacked) throws IllegalArgumentException, IllegalAccessException
{
final List old = (List) this.highField.get(nm);
System.out.println("highField == null? : " + (highField == null));
final Queue old = (Queue) this.highField.get(nm);
boolean copy = true;
if (onlyIfOldIsHacked)
@ -203,18 +203,16 @@ public class PacketHandler extends MiniPlugin
}
}
synchronized (this.syncField.get(nm))
{
if (copy)
{
for (final Object object : old)
{
list.add(object);
}
}
this.highField.set(nm, list);
}
if (copy)
{
for (final Object object : old)
{
queue.add(object);
}
}
this.highField.set(nm, queue);
}
public void ForwardMovement(Player viewer, int travellerId, int entityId)

View File

@ -26,6 +26,7 @@ import net.minecraft.server.v1_7_R1.PathfinderGoalSelector;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.Location;

View File

@ -4,10 +4,12 @@ import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import net.minecraft.server.v1_7_R1.Block;
import net.minecraft.server.v1_7_R1.EntityPlayer;
import net.minecraft.server.v1_7_R1.Item;
import net.minecraft.server.v1_7_R1.Packet100OpenWindow;
import net.minecraft.server.v1_7_R1.Packet103SetSlot;
import net.minecraft.server.v1_7_R1.Items;
import net.minecraft.server.v1_7_R1.PacketPlayOutOpenWindow;
import net.minecraft.server.v1_7_R1.PacketPlayOutSetSlot;
import org.bukkit.Material;
import org.bukkit.craftbukkit.v1_7_R1.entity.CraftPlayer;
@ -110,11 +112,11 @@ public class PetPage extends ShopPageBase<PetManager, PetShop>
PetTagPage petTagPage = new PetTagPage(Plugin, Shop, ClientManager, DonationManager, "Repairing", Player, pet, petPurchase);
EntityPlayer entityPlayer = ((CraftPlayer)Player).getHandle();
int containerCounter = entityPlayer.nextContainerCounter();
entityPlayer.playerConnection.sendPacket(new Packet100OpenWindow(containerCounter, 8, "Repairing", 9, true));
entityPlayer.playerConnection.sendPacket(new PacketPlayOutOpenWindow(containerCounter, 8, "Repairing", 9, true));
entityPlayer.activeContainer = new AnvilContainer(entityPlayer.inventory, petTagPage.getInventory());
entityPlayer.activeContainer.windowId = containerCounter;
entityPlayer.activeContainer.addSlotListener(entityPlayer);
entityPlayer.playerConnection.sendPacket(new Packet103SetSlot(containerCounter, 0, new net.minecraft.server.v1_7_R1.ItemStack(Item.NAME_TAG)));
entityPlayer.playerConnection.sendPacket(new PacketPlayOutSetSlot(containerCounter, 0, new net.minecraft.server.v1_7_R1.ItemStack(Items.NAME_TAG)));
Shop.SetCurrentPageForPlayer(Player, petTagPage);
}

View File

@ -16,6 +16,7 @@ import mineplex.core.shop.page.ConfirmationPage;
import mineplex.core.shop.page.ShopPageBase;
import net.minecraft.server.v1_7_R1.Item;
import net.minecraft.server.v1_7_R1.ItemStack;
import net.minecraft.server.v1_7_R1.Items;
import org.bukkit.ChatColor;
import org.bukkit.Material;
@ -42,7 +43,7 @@ public class PetTagPage extends ShopPageBase<PetManager, PetShop>
@Override
protected void BuildPage()
{
inventory.setItem(0, new ItemStack(Item.NAME_TAG));
inventory.setItem(0, new ItemStack(Items.NAME_TAG));
ButtonMap.put(0, new CloseButton());
ButtonMap.put(1, new CloseButton());

View File

@ -390,7 +390,7 @@ public class PunishPage extends CraftInventoryCustom implements Listener
@EventHandler
public void OnInventoryClick(InventoryClickEvent event)
{
if (inventory.getName().equalsIgnoreCase(event.getInventory().getTitle()) && event.getWhoClicked() == _player)
if (inventory.getInventoryName().equalsIgnoreCase(event.getInventory().getTitle()) && event.getWhoClicked() == _player)
{
if (_buttonMap.containsKey(event.getRawSlot()))
{
@ -407,7 +407,7 @@ public class PunishPage extends CraftInventoryCustom implements Listener
@EventHandler
public void OnInventoryClose(InventoryCloseEvent event)
{
if (inventory.getName().equalsIgnoreCase(event.getInventory().getTitle()) && event.getPlayer() == _player)
if (inventory.getInventoryName().equalsIgnoreCase(event.getInventory().getTitle()) && event.getPlayer() == _player)
{
ClosePunish();
}

View File

@ -66,8 +66,8 @@ public class ShopItem extends CraftItemStack
UpdateVisual(false);
// Fix for temp save junk(fixes problem when disconnecting and trying to return)
if (getHandle().tag != null)
getHandle().tag.setName("tag");
//if (getHandle().tag != null)
// getHandle().tag.setName("tag");
getHandle().tag.setByte("Count", (byte)Math.max(deliveryAmount, 1));
getHandle().tag.set("AttributeModifiers", new NBTTagList());
@ -120,14 +120,14 @@ public class ShopItem extends CraftItemStack
}
}
NBTTagList lore = new NBTTagList("Lore");
NBTTagList lore = new NBTTagList();
if (_lore != null)
{
for (String line : _lore)
{
if (line != null && !line.isEmpty())
lore.add(new NBTTagString("Test", line));
lore.add(new NBTTagString(line));
}
}
@ -159,14 +159,14 @@ public class ShopItem extends CraftItemStack
{
_lore = string;
NBTTagList lore = new NBTTagList("Lore");
NBTTagList lore = new NBTTagList();
if (_lore != null)
{
for (String line : _lore)
{
if (line != null && !line.isEmpty())
lore.add(new NBTTagString("Test", line));
lore.add(new NBTTagString(line));
}
}

View File

@ -10,5 +10,6 @@
<classpathentry combineaccessrules="false" kind="src" path="/Mineplex.Minecraft.Game.ClassCombat"/>
<classpathentry kind="var" path="REPO_DIR/Plugins/Libraries/commons-codec-1.6.jar"/>
<classpathentry combineaccessrules="false" kind="src" path="/Mineplex.Core.Common"/>
<classpathentry kind="var" path="REPO_DIR/Plugins/Libraries/commons-io-2.4.jar"/>
<classpathentry kind="output" path="bin"/>
</classpath>

View File

@ -264,7 +264,7 @@ public class StackerManager extends MiniPlugin implements IThrown
UtilPlayer.message(target, F.main("Stacker", F.name(UtilEnt.getName(data.GetThrower())) + " hit you with " + F.name(UtilEnt.getName(data.GetThrown()))));
//Effect
data.GetThrown().getWorld().playSound(data.GetThrown().getLocation(), Sound.HURT, 1f, 1f);
data.GetThrown().getWorld().playSound(data.GetThrown().getLocation(), Sound.HURT_FLESH, 1f, 1f);
//Portal Delay
Manager.SetPortalDelay(target);

View File

@ -68,7 +68,7 @@ public class BackStab extends Skill
event.AddMod(damager.getName(), GetName(), 1 + level, true);
//Effect
damagee.getWorld().playSound(damagee.getLocation(), Sound.HURT, 1f, 2f);
damagee.getWorld().playSound(damagee.getLocation(), Sound.HURT_FLESH, 1f, 2f);
return;
}

View File

@ -75,7 +75,7 @@ public class MarkedForDeath extends SkillActive
UtilPlayer.message(player, F.main(GetClassType().name(), "You prepared " + F.skill(GetName(level)) + "."));
//Effect
player.getWorld().playSound(player.getLocation(), Sound.BREATH, 2.5f, 2.0f);
player.getWorld().playSound(player.getLocation(), Sound.BLAZE_BREATH, 2.5f, 2.0f);
}
@EventHandler
@ -125,7 +125,7 @@ public class MarkedForDeath extends SkillActive
if (level == 0) return;
//Effect
damagee.getWorld().playSound(damagee.getLocation(), Sound.BREATH, 2.5f, 2.0f);
damagee.getWorld().playSound(damagee.getLocation(), Sound.BLAZE_BREATH, 2.5f, 2.0f);
//Inform
UtilPlayer.message(event.GetDamageePlayer(), F.main(GetClassType().name(), F.name(damager.getName()) +" hit you with " + F.skill(GetName(level)) + "."));

View File

@ -73,7 +73,7 @@ public class SilencingArrow extends SkillActive
UtilPlayer.message(player, F.main(GetClassType().name(), "You prepared " + F.skill(GetName(level)) + "."));
//Effect
player.getWorld().playSound(player.getLocation(), Sound.BREATH, 2.5f, 2.0f);
player.getWorld().playSound(player.getLocation(), Sound.BLAZE_BREATH, 2.5f, 2.0f);
}
@EventHandler
@ -126,7 +126,7 @@ public class SilencingArrow extends SkillActive
Factory.Condition().Factory().Silence(GetName(), damagee, damager, confuseDur, true, true);
//Effect
damagee.getWorld().playSound(damagee.getLocation(), Sound.BREATH, 2.5f, 2.0f);
damagee.getWorld().playSound(damagee.getLocation(), Sound.BLAZE_BREATH, 2.5f, 2.0f);
//Inform
UtilPlayer.message(event.GetDamageePlayer(), F.main(GetClassType().name(), F.name(damager.getName()) +" hit you with " + F.skill(GetName(level)) + "."));

View File

@ -107,7 +107,7 @@ public class Stealth extends Skill
Factory.Condition().Factory().Vulnerable(GetName(), player, player, 120000, 3, false, true, true);
//Sound
player.getWorld().playSound(player.getLocation(), Sound.BREATH, 0.5f, 0.5f);
player.getWorld().playSound(player.getLocation(), Sound.BLAZE_BREATH, 0.5f, 0.5f);
}
public void Remove(Player player, LivingEntity source)

View File

@ -73,7 +73,7 @@ public class ToxicArrow extends SkillActive
UtilPlayer.message(player, F.main(GetClassType().name(), "You prepared " + F.skill(GetName(level)) + "."));
//Effect
player.getWorld().playSound(player.getLocation(), Sound.BREATH, 2.5f, 2.0f);
player.getWorld().playSound(player.getLocation(), Sound.BLAZE_BREATH, 2.5f, 2.0f);
}
@EventHandler
@ -126,7 +126,7 @@ public class ToxicArrow extends SkillActive
Factory.Condition().Factory().Confuse(GetName(), damagee, damager, confuseDur, 0, true, true, true);
//Effect
damagee.getWorld().playSound(damagee.getLocation(), Sound.BREATH, 2.5f, 2.0f);
damagee.getWorld().playSound(damagee.getLocation(), Sound.BLAZE_BREATH, 2.5f, 2.0f);
//Inform
UtilPlayer.message(event.GetDamageePlayer(), F.main(GetClassType().name(), F.name(damager.getName()) +" hit you with " + F.skill(GetName(level)) + "."));

View File

@ -56,7 +56,7 @@ public class NullBlade extends Skill
event.AddMod(damager.getName(), GetName(), 0, true);
//Effect
damager.getWorld().playSound(damager.getLocation(), Sound.BREATH, 0.6f, 0.6f);
damager.getWorld().playSound(damager.getLocation(), Sound.BLAZE_BREATH, 0.6f, 0.6f);
}
@Override

View File

@ -117,7 +117,7 @@ public class Void extends Skill
return;
for (Player cur : _active)
cur.getWorld().playSound(cur.getLocation(), Sound.BREATH, 0.5f, 0.5f);
cur.getWorld().playSound(cur.getLocation(), Sound.BLAZE_BREATH, 0.5f, 0.5f);
}
@EventHandler
@ -173,7 +173,7 @@ public class Void extends Skill
event.SetKnockback(false);
//Effect
damagee.getWorld().playSound(damagee.getLocation(), Sound.BREATH, 2f, 1f);
damagee.getWorld().playSound(damagee.getLocation(), Sound.BLAZE_BREATH, 2f, 1f);
}

View File

@ -80,7 +80,7 @@ public class HealingShot extends SkillActive
UtilPlayer.message(player, F.main(GetClassType().name(), "You prepared " + F.skill(GetName(level)) + "."));
//Effect
player.getWorld().playSound(player.getLocation(), Sound.BREATH, 2.5f, 2.0f);
player.getWorld().playSound(player.getLocation(), Sound.BLAZE_BREATH, 2.5f, 2.0f);
}
@EventHandler

View File

@ -74,7 +74,7 @@ public class IncendiaryShot extends SkillActive
UtilPlayer.message(player, F.main(GetClassType().name(), "You prepared " + F.skill(GetName(level)) + "."));
//Effect
player.getWorld().playSound(player.getLocation(), Sound.BREATH, 2.5f, 2.0f);
player.getWorld().playSound(player.getLocation(), Sound.BLAZE_BREATH, 2.5f, 2.0f);
}
@EventHandler

View File

@ -74,7 +74,7 @@ public class NapalmShot extends SkillActive
UtilPlayer.message(player, F.main(GetClassType().name(), "You prepared " + F.skill(GetName(level)) + "."));
//Effect
player.getWorld().playSound(player.getLocation(), Sound.BREATH, 2.5f, 2.0f);
player.getWorld().playSound(player.getLocation(), Sound.BLAZE_BREATH, 2.5f, 2.0f);
}
@EventHandler

View File

@ -68,7 +68,7 @@ public class RopedArrow extends SkillActive
UtilPlayer.message(player, F.main(GetClassType().name(), "You prepared " + F.skill(GetName(level)) + "."));
//Effect
player.getWorld().playSound(player.getLocation(), Sound.BREATH, 2.5f, 2.0f);
player.getWorld().playSound(player.getLocation(), Sound.BLAZE_BREATH, 2.5f, 2.0f);
}
@EventHandler
@ -117,7 +117,7 @@ public class RopedArrow extends SkillActive
0.4 + mult, false, 0, 0.3 * mult, 1.2 * mult, true);
//Effect
proj.getWorld().playSound(proj.getLocation(), Sound.BREATH, 2.5f, 2.0f);
proj.getWorld().playSound(proj.getLocation(), Sound.BLAZE_BREATH, 2.5f, 2.0f);
}
@EventHandler

View File

@ -195,7 +195,7 @@ public class ItemFactory extends MiniPlugin implements IItemFactory
try
{
_itemMaxDurability.setInt(net.minecraft.server.v1_7_R1.Item.byId[newItem.GetType().getId()], 56);
_itemMaxDurability.setInt(net.minecraft.server.v1_7_R1.Item.d(newItem.GetType().getId()), 56);
}
catch (IllegalArgumentException e)
{

View File

@ -446,7 +446,7 @@ public class DamageManager extends MiniPlugin
{
if (!ignoreArmor)
{
int j = 25 - entityLiving.aQ();
int j = 25 - entityLiving.aV();
float k = damage * (float)j;
_k.invoke(entityLiving, damage);

View File

@ -501,7 +501,7 @@ public class ArcadeManager extends MiniPlugin implements IRelation
player.setExp(0f);
((CraftPlayer)player).getHandle().spectating = false;
((CraftPlayer)player).getHandle().m = true;
((CraftPlayer)player).getHandle().l = true;
GetCondition().EndCondition(player, ConditionType.CLOAK, null);

View File

@ -758,7 +758,7 @@ public abstract class Game implements Listener
player.setFlying(true);
player.setFlySpeed(0.1f);
((CraftPlayer)player).getHandle().spectating = true;
((CraftPlayer)player).getHandle().m = false;
((CraftPlayer)player).getHandle().l = false;
Manager.GetCondition().Factory().Cloak("Spectator", player, player, 7777, true, true);

View File

@ -3,23 +3,15 @@ package nautilus.game.arcade.game.games.christmas;
import mineplex.core.common.util.C;
import mineplex.core.common.util.UtilEnt;
import mineplex.core.common.util.UtilMath;
import mineplex.core.common.util.UtilServer;
import net.minecraft.server.v1_7_R1.MobEffect;
import net.minecraft.server.v1_7_R1.MobEffectList;
import net.minecraft.server.v1_7_R1.Packet40EntityMetadata;
import org.bukkit.Color;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.craftbukkit.v1_7_R1.entity.CraftEntity;
import org.bukkit.craftbukkit.v1_7_R1.entity.CraftFallingSand;
import org.bukkit.craftbukkit.v1_7_R1.entity.CraftLivingEntity;
import org.bukkit.craftbukkit.v1_7_R1.entity.CraftPlayer;
import org.bukkit.entity.Chicken;
import org.bukkit.entity.Entity;
import org.bukkit.entity.FallingBlock;
import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Player;
import org.bukkit.entity.Skeleton;
import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.meta.LeatherArmorMeta;
@ -77,7 +69,7 @@ public class SleighPart
ent = ent.getPassenger();
if (ent instanceof FallingBlock)
((CraftFallingSand)ent).getHandle().c = 1;
((CraftFallingSand)ent).getHandle().b = 1;
}
}

View File

@ -311,7 +311,7 @@ public class Gravity extends SoloGame
//Dont Disappear
if (obj.Ent instanceof FallingBlock)
((CraftFallingSand)obj.Ent).getHandle().c = 1;
((CraftFallingSand)obj.Ent).getHandle().b = 1;
HashMap<Block, Double> blocks = UtilBlock.getInRadius(obj.Ent.getLocation(), 1.2);

View File

@ -36,7 +36,7 @@ public class GravityPlayer extends GravityObject
@Override
public void PlayCollideSound(double power)
{
Ent.getWorld().playSound(Ent.getLocation(), Sound.HURT, 0.8f, 0.75f);
Ent.getWorld().playSound(Ent.getLocation(), Sound.HURT_FLESH, 0.8f, 0.75f);
}
public boolean NearBlock()

View File

@ -686,7 +686,7 @@ public class HideSeek extends TeamGame
UtilPlayer.message(player, F.main("Game", "You used " + F.elem("Basic Boost") + "!"));
//Sound
player.getWorld().playSound(player.getLocation(), Sound.BREATH, 1f, 1f);
player.getWorld().playSound(player.getLocation(), Sound.BLAZE_BREATH, 1f, 1f);
}
else if (UtilGear.isMat(player.getItemInHand(), Material.STONE_AXE))
{
@ -696,7 +696,7 @@ public class HideSeek extends TeamGame
UtilPlayer.message(player, F.main("Game", "You used " + F.elem("Ultra Boost") + "!"));
//Sound
player.getWorld().playSound(player.getLocation(), Sound.BREATH, 1f, 1f);
player.getWorld().playSound(player.getLocation(), Sound.BLAZE_BREATH, 1f, 1f);
}
else if (UtilGear.isMat(player.getItemInHand(), Material.IRON_AXE))
{
@ -707,7 +707,7 @@ public class HideSeek extends TeamGame
UtilPlayer.message(player, F.main("Game", "You used " + F.elem("Mega Boost") + "!"));
//Sound
player.getWorld().playSound(player.getLocation(), Sound.BREATH, 1f, 1f);
player.getWorld().playSound(player.getLocation(), Sound.BLAZE_BREATH, 1f, 1f);
}
else if (UtilGear.isMat(player.getItemInHand(), Material.DIAMOND_AXE))
{
@ -718,7 +718,7 @@ public class HideSeek extends TeamGame
UtilPlayer.message(player, F.main("Game", "You used " + F.elem("Hyper Boost") + "!"));
//Sound
player.getWorld().playSound(player.getLocation(), Sound.BREATH, 1f, 1f);
player.getWorld().playSound(player.getLocation(), Sound.BLAZE_BREATH, 1f, 1f);
}
}

View File

@ -234,7 +234,7 @@ public class BlockForm extends Form
//Ensure Falling doesnt Despawn
else
{
((CraftFallingSand)Player.getPassenger()).getHandle().c = 1;
((CraftFallingSand)Player.getPassenger()).getHandle().b = 1;
Player.getPassenger().setTicksLived(1);
}

View File

@ -281,7 +281,7 @@ public class Paintball extends TeamGame
player.setGameMode(GameMode.CREATIVE);
player.setFlying(true);
((CraftPlayer)player).getHandle().spectating = true;
((CraftPlayer)player).getHandle().m = false;
((CraftPlayer)player).getHandle().l = false;
player.setVelocity(new Vector(0,1.2,0));
@ -387,7 +387,7 @@ public class Paintball extends TeamGame
player.setGameMode(GameMode.SURVIVAL);
player.setFlying(false);
((CraftPlayer)player).getHandle().spectating = false;
((CraftPlayer)player).getHandle().m = true;
((CraftPlayer)player).getHandle().l = true;
//Items
player.getInventory().remove(Material.WATCH);

View File

@ -194,7 +194,7 @@ public class Stacker extends SoloGame implements IThrown
UtilPlayer.message(target, F.main("Game", F.name(UtilEnt.getName(data.GetThrower())) + " hit you with " + F.name(UtilEnt.getName(data.GetThrown()))));
//Effect
data.GetThrown().getWorld().playSound(data.GetThrown().getLocation(), Sound.HURT, 1f, 1f);
data.GetThrown().getWorld().playSound(data.GetThrown().getLocation(), Sound.HURT_FLESH, 1f, 1f);
}
@Override

View File

@ -58,7 +58,7 @@ public class PerkBackstab extends Perk
event.AddMod(damager.getName(), GetName(), 2, true);
//Effect
damagee.getWorld().playSound(damagee.getLocation(), Sound.HURT, 1f, 2f);
damagee.getWorld().playSound(damagee.getLocation(), Sound.HURT_FLESH, 1f, 2f);
return;
}
}

View File

@ -63,8 +63,8 @@ import nautilus.game.arcade.kit.Kit;
import nautilus.game.arcade.kit.KitAvailability;
import net.minecraft.server.v1_7_R1.DataWatcher;
import net.minecraft.server.v1_7_R1.Packet;
import net.minecraft.server.v1_7_R1.Packet24MobSpawn;
import net.minecraft.server.v1_7_R1.Packet40EntityMetadata;
import net.minecraft.server.v1_7_R1.PacketPlayOutSpawnEntityLiving;
import net.minecraft.server.v1_7_R1.PacketPlayOutEntityMetadata;
import net.minecraft.server.v1_7_R1.WatchableObject;
public class GameLobbyManager implements IPacketRunnable, Listener
@ -97,9 +97,6 @@ public class GameLobbyManager implements IPacketRunnable, Listener
private NautHashMap<Player, Integer> _gemMap = new NautHashMap<Player, Integer>();
private NautHashMap<Player, String> _kitMap = new NautHashMap<Player, String>();
private Field _packet40Metadata;
private Field _packet24MobSpawn;
private int _oldPlayerCount = 0;
public GameLobbyManager(ArcadeManager manager, PacketHandler packetHandler)
@ -119,23 +116,6 @@ public class GameLobbyManager implements IPacketRunnable, Listener
_kitDisplay = new Location(world, -17, 101, 0);
_teamDisplay = new Location(world, 18, 101, 0);
try
{
_packet40Metadata = Packet40EntityMetadata.class.getDeclaredField("b");
_packet24MobSpawn = Packet24MobSpawn.class.getDeclaredField("t");
}
catch (NoSuchFieldException e)
{
e.printStackTrace();
}
catch (SecurityException e)
{
e.printStackTrace();
}
_packet40Metadata.setAccessible(true);
_packet24MobSpawn.setAccessible(true);
Manager.GetPluginManager().registerEvents(this, Manager.GetPlugin());
}
@ -1014,11 +994,11 @@ public class GameLobbyManager implements IPacketRunnable, Listener
{
int entityId = -1;
if (packet instanceof Packet40EntityMetadata)
if (packet instanceof PacketPlayOutEntityMetadata)
{
entityId = ((Packet40EntityMetadata)packet).a;
entityId = ((PacketPlayOutEntityMetadata)packet).a;
}
else if (packet instanceof Packet24MobSpawn)
else if (packet instanceof PacketPlayOutSpawnEntityLiving)
{
//entityId = ((Packet24MobSpawn)packet).a;
}
@ -1041,11 +1021,11 @@ public class GameLobbyManager implements IPacketRunnable, Listener
{
try
{
if (packet instanceof Packet40EntityMetadata)
if (packet instanceof PacketPlayOutEntityMetadata)
{
List<WatchableObject> watchables = new ArrayList<WatchableObject>();
for (WatchableObject watchableObject : (List<WatchableObject>)_packet40Metadata.get(packet))
for (WatchableObject watchableObject : (List<WatchableObject>)((PacketPlayOutEntityMetadata) packet).b)
{
WatchableObject newWatch = new WatchableObject(watchableObject.c(), watchableObject.a(), watchableObject.b());
@ -1057,17 +1037,17 @@ public class GameLobbyManager implements IPacketRunnable, Listener
watchables.add(newWatch);
}
Packet40EntityMetadata newPacket = new Packet40EntityMetadata();
PacketPlayOutEntityMetadata newPacket = new PacketPlayOutEntityMetadata();
newPacket.a = entityId;
_packet40Metadata.set(newPacket, watchables);
newPacket.b = watchables;
packetList.forceAdd(newPacket);
return false;
}
else if (packet instanceof Packet24MobSpawn)
else if (packet instanceof PacketPlayOutSpawnEntityLiving)
{
DataWatcher watcher = (DataWatcher)_packet24MobSpawn.get((Packet24MobSpawn)packet);
DataWatcher watcher = ((PacketPlayOutSpawnEntityLiving)packet).l;
watcher.watch(10, customName);
watcher.watch(11, Byte.valueOf((byte)1));
}
@ -1076,10 +1056,6 @@ public class GameLobbyManager implements IPacketRunnable, Listener
{
e.printStackTrace();
}
catch (IllegalAccessException e)
{
e.printStackTrace();
}
}
}

View File

@ -21,7 +21,7 @@ import nautilus.game.arcade.kit.Kit;
import nautilus.game.arcade.kit.KitAvailability;
import nautilus.game.arcade.shop.ArcadeShop;
import nautilus.game.arcade.shop.KitPackage;
import net.minecraft.server.v1_7_R1.Packet40EntityMetadata;
import net.minecraft.server.v1_7_R1.PacketPlayOutEntityMetadata;
import org.bukkit.ChatColor;
import org.bukkit.Location;
@ -301,7 +301,7 @@ public class GamePlayerManager implements Listener
if (player.isOnline())
{
Manager.GetGame().SetKit(player, kit, true);
((CraftPlayer)player).getHandle().playerConnection.sendPacket(new Packet40EntityMetadata(entity.getEntityId(), ((CraftEntity)entity).getHandle().getDataWatcher(), true));
((CraftPlayer)player).getHandle().playerConnection.sendPacket(new PacketPlayOutEntityMetadata(entity.getEntityId(), ((CraftEntity)entity).getHandle().getDataWatcher(), true));
}
}
}, null, new KitPackage(Manager.GetGame().GetName(), kit), CurrencyType.Gems, player));