For-each loops, remove unused method parameters

This commit is contained in:
riking 2014-06-03 18:21:10 -07:00
parent 5dce8a22e8
commit 6d6b766823
3 changed files with 10 additions and 15 deletions

View File

@ -215,7 +215,7 @@ public class DisguiseUtilities {
disguiseBox = disguiseValues.getBabyBox(); disguiseBox = disguiseValues.getBabyBox();
} }
} }
ReflectionManager.setBoundingBox(entity, disguiseBox, disguiseValues.getEntitySize()); ReflectionManager.setBoundingBox(entity, disguiseBox);
} else { } else {
DisguiseValues entityValues = DisguiseValues.getDisguiseValues(DisguiseType.getType(entity.getType())); DisguiseValues entityValues = DisguiseValues.getDisguiseValues(DisguiseType.getType(entity.getType()));
FakeBoundingBox entityBox = entityValues.getAdultBox(); FakeBoundingBox entityBox = entityValues.getAdultBox();
@ -225,7 +225,7 @@ public class DisguiseUtilities {
entityBox = entityValues.getBabyBox(); entityBox = entityValues.getBabyBox();
} }
} }
ReflectionManager.setBoundingBox(entity, entityBox, entityValues.getEntitySize()); ReflectionManager.setBoundingBox(entity, entityBox);
} }
} }
} }
@ -325,7 +325,7 @@ public class DisguiseUtilities {
public void onLookup(Object gameProfile) { public void onLookup(Object gameProfile) {
getAddedByPlugins().remove(disguise.getName()); getAddedByPlugins().remove(disguise.getName());
if (DisguiseAPI.isDisguiseInUse(disguise)) { if (DisguiseAPI.isDisguiseInUse(disguise)) {
DisguiseUtilities.refreshTrackers((TargetedDisguise) disguise); DisguiseUtilities.refreshTrackers(disguise);
if (disguise.getEntity() instanceof Player && disguise.isSelfDisguiseVisible()) { if (disguise.getEntity() instanceof Player && disguise.isSelfDisguiseVisible()) {
DisguiseUtilities.sendSelfDisguise((Player) disguise.getEntity(), disguise); DisguiseUtilities.sendSelfDisguise((Player) disguise.getEntity(), disguise);
} }
@ -720,9 +720,7 @@ public class DisguiseUtilities {
} }
// Resend any active potion effects // Resend any active potion effects
Iterator iterator = player.getActivePotionEffects().iterator(); for (Object potionEffect : player.getActivePotionEffects()) {
while (iterator.hasNext()) {
PotionEffect potionEffect = (PotionEffect) iterator.next();
sendSelfPacket(player, sendSelfPacket(player,
manager.createPacketConstructor(PacketType.Play.Server.ENTITY_EFFECT, player.getEntityId(), potionEffect) manager.createPacketConstructor(PacketType.Play.Server.ENTITY_EFFECT, player.getEntityId(), potionEffect)
.createPacket(player.getEntityId(), potionEffect), fakeId); .createPacket(player.getEntityId(), potionEffect), fakeId);

View File

@ -94,7 +94,7 @@ public class PacketsManager {
/** /**
* Construct the packets I need to spawn in the disguise * Construct the packets I need to spawn in the disguise
*/ */
public static PacketContainer[] constructSpawnPackets(Disguise disguise, Entity disguisedEntity, Player observer) { public static PacketContainer[] constructSpawnPackets(Disguise disguise, Entity disguisedEntity) {
if (disguise.getEntity() == null) if (disguise.getEntity() == null)
disguise.setEntity(disguisedEntity); disguise.setEntity(disguisedEntity);
Object nmsEntity = ReflectionManager.getNmsEntity(disguisedEntity); Object nmsEntity = ReflectionManager.getNmsEntity(disguisedEntity);
@ -703,8 +703,8 @@ public class PacketsManager {
if (packets == null) { if (packets == null) {
packets = new PacketContainer[] { event.getPacket() }; packets = new PacketContainer[] { event.getPacket() };
} }
for (int i = 0; i < packets.length; i++) { for (PacketContainer packet1 : packets) {
PacketContainer packet = packets[i]; PacketContainer packet = packet1;
if (packet.equals(event.getPacket())) { if (packet.equals(event.getPacket())) {
packet = packet.deepClone(); packet = packet.deepClone();
} }
@ -717,10 +717,7 @@ public class PacketsManager {
} }
if (event.getPacketType() == PacketType.Play.Server.ENTITY_METADATA) { if (event.getPacketType() == PacketType.Play.Server.ENTITY_METADATA) {
event.setPacket(event.getPacket().deepClone()); event.setPacket(event.getPacket().deepClone());
Iterator<WrappedWatchableObject> itel = event.getPacket().getWatchableCollectionModifier().read(0) for (WrappedWatchableObject watch : event.getPacket().getWatchableCollectionModifier().read(0)) {
.iterator();
while (itel.hasNext()) {
WrappedWatchableObject watch = itel.next();
if (watch.getIndex() == 0) { if (watch.getIndex() == 0) {
byte b = (Byte) watch.getValue(); byte b = (Byte) watch.getValue();
byte a = (byte) (b | 1 << 5); byte a = (byte) (b | 1 << 5);
@ -1232,7 +1229,7 @@ public class PacketsManager {
|| sentPacket.getType() == PacketType.Play.Server.SPAWN_ENTITY_EXPERIENCE_ORB || sentPacket.getType() == PacketType.Play.Server.SPAWN_ENTITY_EXPERIENCE_ORB
|| sentPacket.getType() == PacketType.Play.Server.SPAWN_ENTITY || sentPacket.getType() == PacketType.Play.Server.SPAWN_ENTITY
|| sentPacket.getType() == PacketType.Play.Server.SPAWN_ENTITY_PAINTING) { || sentPacket.getType() == PacketType.Play.Server.SPAWN_ENTITY_PAINTING) {
packets = constructSpawnPackets(disguise, entity, observer); packets = constructSpawnPackets(disguise, entity);
} }
// Else if the disguise is attempting to send players a forbidden packet // Else if the disguise is attempting to send players a forbidden packet

View File

@ -384,7 +384,7 @@ public class ReflectionManager {
} }
} }
public static void setBoundingBox(Entity entity, FakeBoundingBox newBox, float[] entitySize) { public static void setBoundingBox(Entity entity, FakeBoundingBox newBox) {
try { try {
Object boundingBox = getNmsClass("Entity").getField("boundingBox").get(getNmsEntity(entity)); Object boundingBox = getNmsClass("Entity").getField("boundingBox").get(getNmsEntity(entity));
int stage = 0; int stage = 0;