More fixes, along with a fix for Block Hunt

This commit is contained in:
libraryaddict 2015-10-19 06:21:16 +13:00
parent 6f91827d57
commit 55f97ef984
15 changed files with 618 additions and 530 deletions

Binary file not shown.

View File

@ -53,7 +53,7 @@ public class UtilBlock
*/
public static HashSet<Byte> fullSolid = new HashSet<Byte>();
/**
* A list of blocks that are non-solid, but offer resistance. Eg lily, fence gate, portal
* A list of blocks that are non-solid, but can't be moved through. Eg lily, fence gate, portal
*/
public static HashSet<Byte> blockPassSet = new HashSet<Byte>();
/**
@ -62,188 +62,224 @@ public class UtilBlock
public static HashSet<Byte> blockAirFoliageSet = new HashSet<Byte>();
static {
blockAirFoliageSet.add((byte)0);
blockAirFoliageSet.add((byte)6);
blockAirFoliageSet.add((byte)31);
blockAirFoliageSet.add((byte)32);
blockAirFoliageSet.add((byte)37);
blockAirFoliageSet.add((byte)38);
blockAirFoliageSet.add((byte)39);
blockAirFoliageSet.add((byte)40);
blockAirFoliageSet.add((byte)51);
blockAirFoliageSet.add((byte)59);
blockAirFoliageSet.add((byte)104);
blockAirFoliageSet.add((byte)105);
blockAirFoliageSet.add((byte)115);
blockAirFoliageSet.add((byte)141);
blockAirFoliageSet.add((byte)142);
blockPassSet.add((byte)0);
blockPassSet.add((byte)6);
blockPassSet.add((byte)8);
blockPassSet.add((byte)9);
blockPassSet.add((byte)10);
blockPassSet.add((byte)11);
blockPassSet.add((byte)26);
blockPassSet.add((byte)27);
blockPassSet.add((byte)28);
blockPassSet.add((byte)30);
blockPassSet.add((byte)31);
blockPassSet.add((byte)32);
blockPassSet.add((byte)37);
blockPassSet.add((byte)38);
blockPassSet.add((byte)39);
blockPassSet.add((byte)40);
blockPassSet.add((byte)50);
blockPassSet.add((byte)51);
blockPassSet.add((byte)55);
blockPassSet.add((byte)59);
blockPassSet.add((byte)63);
blockPassSet.add((byte)64);
blockPassSet.add((byte)65);
blockPassSet.add((byte)66);
blockPassSet.add((byte)68);
blockPassSet.add((byte)69);
blockPassSet.add((byte)70);
blockPassSet.add((byte)71);
blockPassSet.add((byte)72);
blockPassSet.add((byte)75);
blockPassSet.add((byte)76);
blockPassSet.add((byte)77);
blockPassSet.add((byte)78);
blockPassSet.add((byte)83);
blockPassSet.add((byte)90);
blockPassSet.add((byte)92);
blockPassSet.add((byte)93);
blockPassSet.add((byte)94);
blockPassSet.add((byte)96);
blockPassSet.add((byte)101);
blockPassSet.add((byte)102);
blockPassSet.add((byte)104);
blockPassSet.add((byte)105);
blockPassSet.add((byte)106);
blockPassSet.add((byte)107);
blockPassSet.add((byte)111);
blockPassSet.add((byte)115);
blockPassSet.add((byte)116);
blockPassSet.add((byte)117);
blockPassSet.add((byte)118);
blockPassSet.add((byte)119);
blockPassSet.add((byte)120);
blockPassSet.add((byte)171);
fullSolid.add((byte)1); //
fullSolid.add((byte)2); //
fullSolid.add((byte)3); //
fullSolid.add((byte)4); //
fullSolid.add((byte)5); //
fullSolid.add((byte)7); //
fullSolid.add((byte)12); //
fullSolid.add((byte)13); //
fullSolid.add((byte)14); //
fullSolid.add((byte)15); //
fullSolid.add((byte)16); //
fullSolid.add((byte)17); //
fullSolid.add((byte)19); //
fullSolid.add((byte)20); //
fullSolid.add((byte)21); //
fullSolid.add((byte)22); //
fullSolid.add((byte)23); //
fullSolid.add((byte)24); //
fullSolid.add((byte)25); //
fullSolid.add((byte)29); //
fullSolid.add((byte)33); //
fullSolid.add((byte)35); //
fullSolid.add((byte)41); //
fullSolid.add((byte)42); //
fullSolid.add((byte)43); //
fullSolid.add((byte)44); //
fullSolid.add((byte)45); //
fullSolid.add((byte)46); //
fullSolid.add((byte)47); //
fullSolid.add((byte)48); //
fullSolid.add((byte)49); //
fullSolid.add((byte)56); //
fullSolid.add((byte)57); //
fullSolid.add((byte)58); //
fullSolid.add((byte)60); //
fullSolid.add((byte)61); //
fullSolid.add((byte)62); //
fullSolid.add((byte)73); //
fullSolid.add((byte)74); //
fullSolid.add((byte)79); //
fullSolid.add((byte)80); //
fullSolid.add((byte)82); //
fullSolid.add((byte)84); //
fullSolid.add((byte)86); //
fullSolid.add((byte)87); //
fullSolid.add((byte)88); //
fullSolid.add((byte)89); //
fullSolid.add((byte)91); //
fullSolid.add((byte)95); //
fullSolid.add((byte)97); //
fullSolid.add((byte)98); //
fullSolid.add((byte)99); //
fullSolid.add((byte)100); //
fullSolid.add((byte)103); //
fullSolid.add((byte)110); //
fullSolid.add((byte)112); //
fullSolid.add((byte)121); //
fullSolid.add((byte)123); //
fullSolid.add((byte)124); //
fullSolid.add((byte)125); //
fullSolid.add((byte)126); //
fullSolid.add((byte)129); //
fullSolid.add((byte)133); //
fullSolid.add((byte)137); //
fullSolid.add((byte)138); //
fullSolid.add((byte)152); //
fullSolid.add((byte)153); //
fullSolid.add((byte)155); //
fullSolid.add((byte)158); //
blockUseSet.add((byte)23); //Dispenser
blockUseSet.add((byte)26); //Bed
blockUseSet.add((byte)33); //Piston
blockUseSet.add((byte)47); //Bookcase
blockUseSet.add((byte)54); //Chest
blockUseSet.add((byte)58); //Workbench
blockUseSet.add((byte)61); //Furnace
blockUseSet.add((byte)62); //Furnace
blockUseSet.add((byte)64); //Wood Door
blockUseSet.add((byte)69); //Lever
blockUseSet.add((byte)71); //Iron Door
blockUseSet.add((byte)77); //Button
blockUseSet.add((byte)85); //Fence (stupid minecraft)
blockUseSet.add((byte)93); //Repeater
blockUseSet.add((byte)94); //Repeater
blockUseSet.add((byte)96); //Trapdoor
blockUseSet.add((byte)107); //Fence Gate
blockUseSet.add((byte)113); //Nether Fence (stupid minecraft)
blockUseSet.add((byte)116); //Enchantment Table
blockUseSet.add((byte)117); //Brewing Stand
blockUseSet.add((byte)130); //Ender Chest
blockUseSet.add((byte)145); //Anvil
blockUseSet.add((byte)146); //Trapped Chest
blockUseSet.add((byte)154); //Hopper
blockUseSet.add((byte)158); //Dropper
blockUseSet.add((byte)184); //Fences/Gates
blockUseSet.add((byte)185); //Fences/Gates
blockUseSet.add((byte)186); //Fences/Gates
blockUseSet.add((byte)187); //Fences/Gates
blockUseSet.add((byte)188); //Fences/Gates
blockUseSet.add((byte)189); //Fences/Gates
blockUseSet.add((byte)190); //Fences/Gates
blockUseSet.add((byte)191); //Fences/Gates
blockUseSet.add((byte)192); //Fences/Gates
blockUseSet.add((byte)193); //Wood Doors
blockUseSet.add((byte)194); //Wood Doors
blockUseSet.add((byte)195); //Wood Doors
blockUseSet.add((byte)196); //Wood Doors
blockUseSet.add((byte)197); //Wood Doors
blockAirFoliageSet.add((byte) Material.AIR.getId());
blockAirFoliageSet.add((byte) Material.SAPLING.getId());
blockAirFoliageSet.add((byte) Material.LONG_GRASS.getId());
blockAirFoliageSet.add((byte) Material.DEAD_BUSH.getId());
blockAirFoliageSet.add((byte) Material.YELLOW_FLOWER.getId());
blockAirFoliageSet.add((byte) Material.RED_ROSE.getId());
blockAirFoliageSet.add((byte) Material.BROWN_MUSHROOM.getId());
blockAirFoliageSet.add((byte) Material.RED_MUSHROOM.getId());
blockAirFoliageSet.add((byte) Material.FIRE.getId());
blockAirFoliageSet.add((byte) Material.CROPS.getId());
blockAirFoliageSet.add((byte) Material.PUMPKIN_STEM.getId());
blockAirFoliageSet.add((byte) Material.MELON_STEM.getId());
blockAirFoliageSet.add((byte) Material.NETHER_WARTS.getId());
blockAirFoliageSet.add((byte) Material.TRIPWIRE_HOOK.getId());
blockAirFoliageSet.add((byte) Material.TRIPWIRE.getId());
blockAirFoliageSet.add((byte) Material.CARROT.getId());
blockAirFoliageSet.add((byte) Material.POTATO.getId());
blockAirFoliageSet.add((byte) Material.DOUBLE_PLANT.getId());
blockAirFoliageSet.add((byte) Material.STANDING_BANNER.getId());
blockAirFoliageSet.add((byte) Material.WALL_BANNER.getId());
blockPassSet.add((byte) Material.AIR.getId());
blockPassSet.add((byte) Material.SAPLING.getId());
blockPassSet.add((byte) Material.WATER.getId());
blockPassSet.add((byte) Material.STATIONARY_WATER.getId());
blockPassSet.add((byte) Material.LAVA.getId());
blockPassSet.add((byte) Material.STATIONARY_LAVA.getId());
blockPassSet.add((byte) Material.BED_BLOCK.getId());
blockPassSet.add((byte) Material.POWERED_RAIL.getId());
blockPassSet.add((byte) Material.DETECTOR_RAIL.getId());
blockPassSet.add((byte) Material.WEB.getId());
blockPassSet.add((byte) Material.LONG_GRASS.getId());
blockPassSet.add((byte) Material.DEAD_BUSH.getId());
blockPassSet.add((byte) Material.YELLOW_FLOWER.getId());
blockPassSet.add((byte) Material.RED_ROSE.getId());
blockPassSet.add((byte) Material.BROWN_MUSHROOM.getId());
blockPassSet.add((byte) Material.RED_MUSHROOM.getId());
blockPassSet.add((byte) Material.TORCH.getId());
blockPassSet.add((byte) Material.FIRE.getId());
blockPassSet.add((byte) Material.REDSTONE_WIRE.getId());
blockPassSet.add((byte) Material.CROPS.getId());
blockPassSet.add((byte) Material.SIGN_POST.getId());
blockPassSet.add((byte) Material.WOODEN_DOOR.getId());
blockPassSet.add((byte) Material.LADDER.getId());
blockPassSet.add((byte) Material.RAILS.getId());
blockPassSet.add((byte) Material.WALL_SIGN.getId());
blockPassSet.add((byte) Material.LEVER.getId());
blockPassSet.add((byte) Material.STONE_PLATE.getId());
blockPassSet.add((byte) Material.IRON_DOOR_BLOCK.getId());
blockPassSet.add((byte) Material.WOOD_PLATE.getId());
blockPassSet.add((byte) Material.REDSTONE_TORCH_OFF.getId());
blockPassSet.add((byte) Material.REDSTONE_TORCH_ON.getId());
blockPassSet.add((byte) Material.STONE_BUTTON.getId());
blockPassSet.add((byte) Material.SNOW.getId());
blockPassSet.add((byte) Material.SUGAR_CANE_BLOCK.getId());
blockPassSet.add((byte) Material.PORTAL.getId());
blockPassSet.add((byte) Material.CAKE_BLOCK.getId());
blockPassSet.add((byte) Material.DIODE_BLOCK_OFF.getId());
blockPassSet.add((byte) Material.DIODE_BLOCK_ON.getId());
blockPassSet.add((byte) Material.TRAP_DOOR.getId());
blockPassSet.add((byte) Material.IRON_FENCE.getId());
blockPassSet.add((byte) Material.THIN_GLASS.getId());
blockPassSet.add((byte) Material.PUMPKIN_STEM.getId());
blockPassSet.add((byte) Material.MELON_STEM.getId());
blockPassSet.add((byte) Material.VINE.getId());
blockPassSet.add((byte) Material.FENCE_GATE.getId());
blockPassSet.add((byte) Material.WATER_LILY.getId());
blockPassSet.add((byte) Material.NETHER_WARTS.getId());
blockPassSet.add((byte) Material.ENCHANTMENT_TABLE.getId());
blockPassSet.add((byte) Material.BREWING_STAND.getId());
blockPassSet.add((byte) Material.CAULDRON.getId());
blockPassSet.add((byte) Material.ENDER_PORTAL.getId());
blockPassSet.add((byte) Material.ENDER_PORTAL_FRAME.getId());
blockPassSet.add((byte) Material.DAYLIGHT_DETECTOR.getId());
blockPassSet.add((byte) Material.STAINED_GLASS_PANE.getId());
blockPassSet.add((byte) Material.IRON_TRAPDOOR.getId());
blockPassSet.add((byte) Material.DAYLIGHT_DETECTOR_INVERTED.getId());
blockPassSet.add((byte) Material.BIRCH_FENCE_GATE.getId());
blockPassSet.add((byte) Material.JUNGLE_FENCE_GATE.getId());
blockPassSet.add((byte) Material.DARK_OAK_FENCE_GATE.getId());
blockPassSet.add((byte) Material.ACACIA_FENCE_GATE.getId());
blockPassSet.add((byte) Material.SPRUCE_FENCE.getId());
blockPassSet.add((byte) Material.BIRCH_FENCE.getId());
blockPassSet.add((byte) Material.JUNGLE_FENCE.getId());
blockPassSet.add((byte) Material.DARK_OAK_FENCE.getId());
blockPassSet.add((byte) Material.ACACIA_FENCE.getId());
blockPassSet.add((byte) Material.SPRUCE_DOOR.getId());
blockPassSet.add((byte) Material.BIRCH_DOOR.getId());
blockPassSet.add((byte) Material.JUNGLE_DOOR.getId());
blockPassSet.add((byte) Material.ACACIA_DOOR.getId());
blockPassSet.add((byte) Material.DARK_OAK_DOOR.getId());
fullSolid.add((byte) Material.STONE.getId());
fullSolid.add((byte) Material.GRASS.getId());
fullSolid.add((byte) Material.DIRT.getId());
fullSolid.add((byte) Material.COBBLESTONE.getId());
fullSolid.add((byte) Material.WOOD.getId());
fullSolid.add((byte) Material.BEDROCK.getId());
fullSolid.add((byte) Material.SAND.getId());
fullSolid.add((byte) Material.GRAVEL.getId());
fullSolid.add((byte) Material.GOLD_ORE.getId());
fullSolid.add((byte) Material.IRON_ORE.getId());
fullSolid.add((byte) Material.COAL_ORE.getId());
fullSolid.add((byte) Material.LOG.getId());
fullSolid.add((byte) Material.LEAVES.getId());
fullSolid.add((byte) Material.SPONGE.getId());
fullSolid.add((byte) Material.GLASS.getId());
fullSolid.add((byte) Material.LAPIS_ORE.getId());
fullSolid.add((byte) Material.LAPIS_BLOCK.getId());
fullSolid.add((byte) Material.DISPENSER.getId());
fullSolid.add((byte) Material.SANDSTONE.getId());
fullSolid.add((byte) Material.NOTE_BLOCK.getId());
fullSolid.add((byte) Material.PISTON_STICKY_BASE.getId());
fullSolid.add((byte) Material.PISTON_BASE.getId());
fullSolid.add((byte) Material.WOOL.getId());
fullSolid.add((byte) Material.GOLD_BLOCK.getId());
fullSolid.add((byte) Material.IRON_BLOCK.getId());
fullSolid.add((byte) Material.DOUBLE_STEP.getId());
fullSolid.add((byte) Material.STEP.getId());
fullSolid.add((byte) Material.BRICK.getId());
fullSolid.add((byte) Material.TNT.getId());
fullSolid.add((byte) Material.BOOKSHELF.getId());
fullSolid.add((byte) Material.MOSSY_COBBLESTONE.getId());
fullSolid.add((byte) Material.OBSIDIAN.getId());
fullSolid.add((byte) Material.DIAMOND_ORE.getId());
fullSolid.add((byte) Material.DIAMOND_BLOCK.getId());
fullSolid.add((byte) Material.WORKBENCH.getId());
fullSolid.add((byte) Material.SOIL.getId());
fullSolid.add((byte) Material.FURNACE.getId());
fullSolid.add((byte) Material.BURNING_FURNACE.getId());
fullSolid.add((byte) Material.REDSTONE_ORE.getId());
fullSolid.add((byte) Material.GLOWING_REDSTONE_ORE.getId());
fullSolid.add((byte) Material.ICE.getId());
fullSolid.add((byte) Material.SNOW_BLOCK.getId());
fullSolid.add((byte) Material.CLAY.getId());
fullSolid.add((byte) Material.JUKEBOX.getId());
fullSolid.add((byte) Material.PUMPKIN.getId());
fullSolid.add((byte) Material.NETHERRACK.getId());
fullSolid.add((byte) Material.SOUL_SAND.getId());
fullSolid.add((byte) Material.GLOWSTONE.getId());
fullSolid.add((byte) Material.JACK_O_LANTERN.getId());
fullSolid.add((byte) Material.STAINED_GLASS.getId());
fullSolid.add((byte) Material.MONSTER_EGGS.getId());
fullSolid.add((byte) Material.SMOOTH_BRICK.getId());
fullSolid.add((byte) Material.HUGE_MUSHROOM_1.getId());
fullSolid.add((byte) Material.HUGE_MUSHROOM_2.getId());
fullSolid.add((byte) Material.MELON_BLOCK.getId());
fullSolid.add((byte) Material.MYCEL.getId());
fullSolid.add((byte) Material.NETHER_BRICK.getId());
fullSolid.add((byte) Material.ENDER_STONE.getId());
fullSolid.add((byte) Material.REDSTONE_LAMP_OFF.getId());
fullSolid.add((byte) Material.REDSTONE_LAMP_ON.getId());
fullSolid.add((byte) Material.WOOD_DOUBLE_STEP.getId());
fullSolid.add((byte) Material.WOOD_STEP.getId());
fullSolid.add((byte) Material.EMERALD_ORE.getId());
fullSolid.add((byte) Material.EMERALD_BLOCK.getId());
fullSolid.add((byte) Material.COMMAND.getId());
fullSolid.add((byte) Material.BEACON.getId());
fullSolid.add((byte) Material.REDSTONE_BLOCK.getId());
fullSolid.add((byte) Material.QUARTZ_ORE.getId());
fullSolid.add((byte) Material.QUARTZ_BLOCK.getId());
fullSolid.add((byte) Material.DROPPER.getId());
fullSolid.add((byte) Material.STAINED_CLAY.getId());
fullSolid.add((byte) Material.LEAVES_2.getId());
fullSolid.add((byte) Material.LOG_2.getId());
fullSolid.add((byte) Material.PRISMARINE.getId());
fullSolid.add((byte) Material.SEA_LANTERN.getId());
fullSolid.add((byte) Material.HAY_BLOCK.getId());
fullSolid.add((byte) Material.HARD_CLAY.getId());
fullSolid.add((byte) Material.COAL_BLOCK.getId());
fullSolid.add((byte) Material.PACKED_ICE.getId());
fullSolid.add((byte) Material.RED_SANDSTONE.getId());
fullSolid.add((byte) Material.DOUBLE_STONE_SLAB2.getId());
blockUseSet.add((byte) Material.DISPENSER.getId());
blockUseSet.add((byte) Material.BED_BLOCK.getId());
blockUseSet.add((byte) Material.PISTON_BASE.getId());
blockUseSet.add((byte) Material.BOOKSHELF.getId());
blockUseSet.add((byte) Material.CHEST.getId());
blockUseSet.add((byte) Material.WORKBENCH.getId());
blockUseSet.add((byte) Material.FURNACE.getId());
blockUseSet.add((byte) Material.BURNING_FURNACE.getId());
blockUseSet.add((byte) Material.WOODEN_DOOR.getId());
blockUseSet.add((byte) Material.LEVER.getId());
blockUseSet.add((byte) Material.IRON_DOOR_BLOCK.getId());
blockUseSet.add((byte) Material.STONE_BUTTON.getId());
blockUseSet.add((byte) Material.FENCE.getId());
blockUseSet.add((byte) Material.DIODE_BLOCK_OFF.getId());
blockUseSet.add((byte) Material.DIODE_BLOCK_ON.getId());
blockUseSet.add((byte) Material.TRAP_DOOR.getId());
blockUseSet.add((byte) Material.FENCE_GATE.getId());
blockUseSet.add((byte) Material.NETHER_FENCE.getId());
blockUseSet.add((byte) Material.ENCHANTMENT_TABLE.getId());
blockUseSet.add((byte) Material.BREWING_STAND.getId());
blockUseSet.add((byte) Material.ENDER_CHEST.getId());
blockUseSet.add((byte) Material.ANVIL.getId());
blockUseSet.add((byte) Material.TRAPPED_CHEST.getId());
blockUseSet.add((byte) Material.HOPPER.getId());
blockUseSet.add((byte) Material.DROPPER.getId());
blockUseSet.add((byte) Material.BIRCH_FENCE_GATE.getId());
blockUseSet.add((byte) Material.JUNGLE_FENCE_GATE.getId());
blockUseSet.add((byte) Material.DARK_OAK_FENCE_GATE.getId());
blockUseSet.add((byte) Material.ACACIA_FENCE_GATE.getId());
blockUseSet.add((byte) Material.SPRUCE_FENCE.getId());
blockUseSet.add((byte) Material.BIRCH_FENCE.getId());
blockUseSet.add((byte) Material.JUNGLE_FENCE.getId());
blockUseSet.add((byte) Material.DARK_OAK_FENCE.getId());
blockUseSet.add((byte) Material.ACACIA_FENCE.getId());
blockUseSet.add((byte) Material.SPRUCE_DOOR.getId());
blockUseSet.add((byte) Material.BIRCH_DOOR.getId());
blockUseSet.add((byte) Material.JUNGLE_DOOR.getId());
blockUseSet.add((byte) Material.ACACIA_DOOR.getId());
blockUseSet.add((byte) Material.DARK_OAK_DOOR.getId());
}
public static boolean solid(Block block)

View File

@ -601,6 +601,9 @@ public class UtilPlayer
for (Packet packet : packets)
{
if (packet == null)
continue;
connection.sendPacket(packet);
}
}

View File

@ -54,27 +54,14 @@ public class CustomTagFix extends MiniPlugin implements IPacketHandler, NCPHook
private NautHashMap<UUID, Long> _exemptTimeMap = new NautHashMap<UUID, Long>();
private NautHashMap<UUID, NautHashMap<CheckType, Long>> _doubleStrike = new NautHashMap<UUID, NautHashMap<CheckType, Long>>();
private Field _destroyId;
public CustomTagFix(JavaPlugin plugin, PacketHandler packetHandler)
{
super("Custom Tag Fix", plugin);
packetHandler.addPacketHandler(this, PacketPlayOutAttachEntity.class, PacketPlayOutEntityDestroy.class,
PacketPlayOutEntityMetadata.class, PacketPlayOutSpawnEntity.class, PacketPlayOutSpawnEntityLiving.class);
try
{
_destroyId = PacketPlayOutEntityDestroy.class.getDeclaredField("a");
_destroyId.setAccessible(true);
}
catch (Exception exception)
{
System.out.println("Field exception in CustomTagFix : ");
exception.printStackTrace();
}
NCPHookManager.addHook(CheckType.MOVING_SURVIVALFLY, this);
NCPHookManager.addHook(CheckType.MOVING_PASSABLE, this);
NCPHookManager.addHook(CheckType.ALL, this);
@ -287,7 +274,7 @@ public class CustomTagFix extends MiniPlugin implements IPacketHandler, NCPHook
{
try
{
for (int id : (int[])_destroyId.get(packet))
for (int id : ((PacketPlayOutEntityDestroy) packet).a)
{
if (_entityMap.get(owner.getName()).containsKey(id))
{

View File

@ -403,7 +403,7 @@ public class BonusManager extends MiniClientPlugin<BonusClientData> implements I
if (!_enabled)
return;
((CraftEntity)_carlNpc.getEntity()).getHandle().getDataWatcher().watch(16, -1);
((CraftEntity)_carlNpc.getEntity()).getHandle().getDataWatcher().watch(16, (byte) -1);
}
public void IncreaseSize(Entity player)
@ -411,7 +411,7 @@ public class BonusManager extends MiniClientPlugin<BonusClientData> implements I
if (!_enabled)
return;
((CraftEntity)_carlNpc.getEntity()).getHandle().getDataWatcher().watch(16, 1);
((CraftEntity)_carlNpc.getEntity()).getHandle().getDataWatcher().watch(16, (byte) 1);
}
// DAILY BONUS

View File

@ -5,7 +5,6 @@ import mineplex.core.common.util.UtilPlayer;
import org.bukkit.Location;
import org.bukkit.craftbukkit.v1_8_R3.entity.CraftEntity;
import net.minecraft.server.v1_8_R3.DataWatcher;
import net.minecraft.server.v1_8_R3.Entity;
import net.minecraft.server.v1_8_R3.EntityPlayer;
@ -38,7 +37,7 @@ public abstract class DisguiseBase
_soundDisguise = this;
}
public void setEntity(org.bukkit.entity.Entity entity)
{
Entity = ((CraftEntity) entity).getHandle();

View File

@ -27,7 +27,7 @@ public class ParticleLegend extends ParticleGadget
C.cGreen + "Unlocked with Legend Rank",
},
-2,
Material.ENDER_PORTAL, (byte)0);
Material.ENDER_PORTAL_FRAME, (byte)0);
}
@EventHandler

View File

@ -22,7 +22,7 @@ public enum GameDisplay
Draw("Draw My Thing", Material.BOOK_AND_QUILL, (byte)0, GameCategory.CLASSICS, 15),
Evolution("Evolution", Material.EMERALD, (byte)0, GameCategory.ARCADE, 16),
//FlappyBird(FlappyBird.class, "Flappy Bird", Material.FEATHER, (byte)0, GameCategory.ARCADE, 17),
Gravity("Gravity", Material.ENDER_PORTAL, (byte)0, GameCategory.EXTRA, 18),
Gravity("Gravity", Material.SEA_LANTERN, (byte)0, GameCategory.EXTRA, 18),
Halloween("Halloween Horror", Material.PUMPKIN, (byte)0, GameCategory.CLASSICS, 19),
HideSeek("Block Hunt", Material.GRASS, (byte)0, GameCategory.CLASSICS, 20),
HoleInTheWall("Hole in the Wall", Material.STAINED_GLASS, (byte) 2, GameCategory.ARCADE, 52),

View File

@ -308,7 +308,6 @@ public abstract class Game implements Listener
public int DeadBodiesExpire = -1;
private IPacketHandler _useEntityPacketHandler;
protected Field TeamNameTagVisibility;
protected Field PacketTeam;
private int _deadBodyCount;
private NautHashMap<String, Entity> _deadBodies = new NautHashMap<String, Entity>();
@ -395,10 +394,6 @@ public abstract class Game implements Listener
"org.bukkit.craftbukkit.v1_8_R3.scoreboard.CraftTeam")
.getDeclaredField("team");
PacketTeam.setAccessible(true);
TeamNameTagVisibility = PacketPlayOutScoreboardTeam.class
.getDeclaredField("e");
TeamNameTagVisibility.setAccessible(true);
}
catch (Exception ex)
{

View File

@ -93,9 +93,7 @@ public class Christmas extends SoloGame
try
{
PacketPlayOutEntityDestroy destroyPacket = (PacketPlayOutEntityDestroy) packetInfo.getPacket();
Field f = destroyPacket.getClass().getDeclaredField("a");
f.setAccessible(true);
int[] entityIds = (int[]) f.get(destroyPacket);
int[] entityIds = destroyPacket.a;
int origLength = entityIds.length;
for (int a = 0; a < entityIds.length; a++)
{
@ -115,7 +113,7 @@ public class Christmas extends SoloGame
}
if (entityIds.length != origLength)
{
f.set(destroyPacket, entityIds);
destroyPacket.a = entityIds;
}
}
catch (Exception ex)

View File

@ -4,6 +4,7 @@ import java.util.ArrayList;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.Map.Entry;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
@ -98,7 +99,10 @@ import nautilus.game.arcade.stats.MeowStatTracker;
import net.minecraft.server.v1_8_R3.EntityCreature;
import net.minecraft.server.v1_8_R3.Navigation;
import net.minecraft.server.v1_8_R3.NavigationAbstract;
import net.minecraft.server.v1_8_R3.PacketPlayInUseEntity;
import net.minecraft.server.v1_8_R3.PacketPlayOutEntityDestroy;
import net.minecraft.server.v1_8_R3.PacketPlayOutSpawnEntity;
import net.minecraft.server.v1_8_R3.PacketPlayOutSpawnEntityLiving;
@SuppressWarnings("deprecation")
public class HideSeek extends TeamGame
@ -196,24 +200,99 @@ public class HideSeek extends TeamGame
private ArrayList<Material> _allowedBlocks;
private ArrayList<EntityType> _allowedEnts;
private IPacketHandler _preventSpawnSent = new IPacketHandler()
{
private IPacketHandler _useEntity = new IPacketHandler()
{
@Override
public void handle(PacketInfo packetInfo)
{
if (packetInfo.getPacket() instanceof PacketPlayInUseEntity)
{
int id = ((PacketPlayInUseEntity) packetInfo.getPacket()).a;
@Override
public void handle(PacketInfo packetInfo)
{
if (packetInfo.getPacket() instanceof PacketPlayOutSpawnEntity)
{
Form form = _forms.get(packetInfo.getPlayer());
if (form != null && form instanceof BlockForm
&& ((BlockForm) form).getEntityId() == ((PacketPlayOutSpawnEntity) packetInfo.getPacket()).a)
{
packetInfo.setCancelled(true);
}
}
}
for (Entry<Player, Form> entry : _forms.entrySet())
{
if (entry.getValue() instanceof BlockForm)
{
BlockForm blockForm = (BlockForm) entry.getValue();
};
if (blockForm.getBlockId() == id)
{
((PacketPlayInUseEntity) packetInfo.getPacket()).a = blockForm.Player
.getEntityId();
break;
}
}
}
}
}
};
private IPacketHandler _blockDisguise = new IPacketHandler()
{
@Override
public void handle(PacketInfo packetInfo)
{
if (packetInfo.getPacket() instanceof PacketPlayOutSpawnEntityLiving)
{
int id = ((PacketPlayOutSpawnEntityLiving) packetInfo
.getPacket()).a;
for (Entry<Player, Form> entry : _forms.entrySet())
{
if (entry.getValue() instanceof BlockForm)
{
final BlockForm blockForm = (BlockForm) entry
.getValue();
if (blockForm.Player.getEntityId() == id
&& blockForm.Player != packetInfo.getPlayer())
{
final Player player = packetInfo.getPlayer();
Bukkit.getScheduler().scheduleSyncDelayedTask(
Manager.getPlugin(), new Runnable()
{
public void run()
{
UtilPlayer
.sendPacket(
player,
blockForm
.getBlockPackets());
}
});
break;
}
}
}
}
else if (packetInfo.getPacket() instanceof PacketPlayOutEntityDestroy)
{
for (int i : ((PacketPlayOutEntityDestroy) packetInfo
.getPacket()).a)
{
for (Entry<Player, Form> entry : _forms.entrySet())
{
if (entry.getValue() instanceof BlockForm)
{
BlockForm blockForm = (BlockForm) entry.getValue();
if (blockForm.Player.getEntityId() == i)
{
UtilPlayer.sendPacket(packetInfo.getPlayer(),
new PacketPlayOutEntityDestroy(
new int[]
{
blockForm.getBlockId()
}));
}
}
}
}
}
}
};
public HideSeek(ArcadeManager manager)
{
@ -271,11 +350,13 @@ public class HideSeek extends TeamGame
{
if (event.GetState() == GameState.Prepare)
{
this.getArcadeManager().getPacketHandler().addPacketHandler(_preventSpawnSent, PacketPlayOutSpawnEntity.class);
this.getArcadeManager().getPacketHandler().addPacketHandler(_blockDisguise, PacketPlayOutSpawnEntityLiving.class, PacketPlayOutEntityDestroy.class);
this.getArcadeManager().getPacketHandler().addPacketHandler(_useEntity, true, PacketPlayInUseEntity.class);
}
else if (event.GetState() == GameState.End)
else if (event.GetState() == GameState.Dead)
{
this.getArcadeManager().getPacketHandler().removePacketHandler(_preventSpawnSent);
this.getArcadeManager().getPacketHandler().removePacketHandler(_blockDisguise);
this.getArcadeManager().getPacketHandler().removePacketHandler(_useEntity);
}
}

View File

@ -16,6 +16,7 @@ import nautilus.game.arcade.game.games.hideseek.HideSeek;
import nautilus.game.arcade.game.games.hideseek.kits.KitHiderQuick;
import net.minecraft.server.v1_8_R3.DataWatcher;
import net.minecraft.server.v1_8_R3.EntityPlayer;
import net.minecraft.server.v1_8_R3.EntityTrackerEntry;
import net.minecraft.server.v1_8_R3.Packet;
import net.minecraft.server.v1_8_R3.PacketPlayOutAttachEntity;
import net.minecraft.server.v1_8_R3.PacketPlayOutEntity.PacketPlayOutRelEntityMove;
@ -23,6 +24,7 @@ import net.minecraft.server.v1_8_R3.PacketPlayOutEntityDestroy;
import net.minecraft.server.v1_8_R3.PacketPlayOutEntityTeleport;
import net.minecraft.server.v1_8_R3.PacketPlayOutSpawnEntity;
import net.minecraft.server.v1_8_R3.PacketPlayOutSpawnEntityLiving;
import net.minecraft.server.v1_8_R3.WorldServer;
import org.bukkit.Bukkit;
import org.bukkit.Effect;
@ -42,38 +44,35 @@ import org.bukkit.util.Vector;
public class BlockForm extends Form
{
private Material _mat;
private Material _mat;
private Block _block;
private int _entityId;
private Block _block;
private int _entityId;
private Location _loc;
private int _selfEntityId1;
private int _selfEntityId2;
private Vector _lastSaw;
private Vector _sawDiff = new Vector();
private boolean _is18;
private Location _loc;
private int _selfEntityId1;
private int _selfEntityId2;
private Vector _lastSaw;
private Vector _sawDiff = new Vector();
private int _blockId = UtilEnt.getNewEntityId();
public BlockForm(HideSeek host, Player player, Material mat)
{
super(host, player);
public BlockForm(HideSeek host, Player player, Material mat)
{
super(host, player);
_is18 = UtilPlayer.is1_8(player);
_mat = mat;
_loc = player.getLocation();
_selfEntityId1 = UtilEnt.getNewEntityId();
_selfEntityId2 = UtilEnt.getNewEntityId();
System.out.println("Block Form: " + _mat + " " + _mat.getId());
}
_mat = mat;
_loc = player.getLocation();
_selfEntityId1 = UtilEnt.getNewEntityId();
_selfEntityId2 = UtilEnt.getNewEntityId();
System.out.println("Block Form: " + _mat + " " + _mat.getId());
}
@Override
@Override
public void Apply()
{
// Remove Old
if (Player.getPassenger() != null)
{
Recharge.Instance.useForce(Player, "PassengerChange", 100);
Player.getPassenger().remove();
Player.eject();
}
@ -85,52 +84,44 @@ public class BlockForm extends Form
DisguiseChicken disguise = new DisguiseChicken(Player);
disguise.setBaby();
// disguise.setInvisible(true);
disguise.setSoundDisguise(new DisguiseCat(Player));
Host.Manager.GetDisguise().disguise(disguise);
disguise.setInvisible(true);
disguise.setSoundDisguise(new DisguiseCat(Player));
Host.Manager.GetDisguise().disguise(disguise);
// Apply Falling Block
FallingBlockCheck();
// Apply Falling Block
FallingBlockCheck();
// Spawn the falling block that's visible to the disguised player only.
Packet[] packets = new Packet[3];
// Spawn the falling block that's visible to the disguised player only.
if (_is18)
{
PacketPlayOutSpawnEntityLiving packet1 = new PacketPlayOutSpawnEntityLiving();
packet1.a = _selfEntityId1;
packet1.b = EntityType.SILVERFISH.getTypeId();
packet1.c = (int) Math.floor(_lastSaw.getX() * 32);
packet1.d = (int) Math.floor(_lastSaw.getY() * 32);
packet1.e = (int) Math.floor(_lastSaw.getZ() * 32);
DataWatcher watcher = new DataWatcher(null);
watcher.a(0, (byte) 32);
watcher.a(1, 0);
packet1.l = watcher;
packets[0] = packet1;
Packet[] packets = new Packet[3];
PacketPlayOutAttachEntity packet3 = new PacketPlayOutAttachEntity();
PacketPlayOutSpawnEntityLiving packet1 = new PacketPlayOutSpawnEntityLiving();
packet1.a = _selfEntityId1;
packet1.b = EntityType.SILVERFISH.getTypeId();
packet1.c = (int) Math.floor(_lastSaw.getX() * 32);
packet1.d = (int) Math.floor(_lastSaw.getY() * 32);
packet1.e = (int) Math.floor(_lastSaw.getZ() * 32);
DataWatcher watcher = new DataWatcher(null);
watcher.a(0, (byte) 32);
watcher.a(1, 0);
packet1.l = watcher;
packets[0] = packet1;
packet3.b = _selfEntityId2;
packet3.c = _selfEntityId1;
packets[2] = packet3;
}
PacketPlayOutAttachEntity packet3 = new PacketPlayOutAttachEntity();
PacketPlayOutSpawnEntity packet2 = new PacketPlayOutSpawnEntity(player, 70, _mat.getId());
packet2.a = _is18 ? _selfEntityId2 : _selfEntityId1;
packets[1] = packet2;
packet3.b = _selfEntityId2;
packet3.c = _selfEntityId1;
packets[2] = packet3;
for (Packet packet : packets)
{
if (packet != null)
{
player.playerConnection.sendPacket(packet);
}
}
PacketPlayOutSpawnEntity packet2 = new PacketPlayOutSpawnEntity(player,
70, _mat.getId());
packet2.a = _selfEntityId2;
packets[1] = packet2;
// Inform
String blockName = F.elem(ItemStackFactory.Instance.GetName(_mat, (byte) 0, false));
UtilPlayer.sendPacket(Player, packets);
// Inform
String blockName = F.elem(ItemStackFactory.Instance.GetName(_mat, (byte) 0, false));
if (!blockName.contains("Block"))
UtilPlayer.message(
Player,
@ -151,264 +142,285 @@ public class BlockForm extends Form
Player.playSound(Player.getLocation(), Sound.ZOMBIE_UNFECT, 2f, 2f);
}
@Override
public void Remove()
{
SolidifyRemove();
public Packet[] getBlockPackets()
{
PacketPlayOutSpawnEntity packet2 = new PacketPlayOutSpawnEntity(((CraftPlayer) Player).getHandle(),
70, _mat.getId());
packet2.a = _blockId;
Host.Manager.GetDisguise().undisguise(Player);
PacketPlayOutAttachEntity packet3 = new PacketPlayOutAttachEntity();
// Remove FB
if (Player.getPassenger() != null)
{
Recharge.Instance.useForce(Player, "PassengerChange", 100);
packet3.b = _blockId;
packet3.c = Player.getEntityId();
Player.getPassenger().remove();
Player.eject();
return new Packet[] {packet2, packet3};
}
public int getBlockId()
{
return _blockId;
}
@Override
public void Remove()
{
SolidifyRemove();
((CraftPlayer) Player).getHandle().playerConnection.sendPacket(new PacketPlayOutEntityDestroy(new int[]
{
_selfEntityId1, _selfEntityId2
}));
}
Host.Manager.GetDisguise().undisguise(Player);
((CraftEntity) Player).getHandle().getDataWatcher().watch(0, Byte.valueOf((byte) 0));
}
UtilPlayer.sendPacket(Player, new PacketPlayOutEntityDestroy(new int[]
{
_selfEntityId1, _selfEntityId2, _blockId
}));
public void SolidifyUpdate()
{
if (!Player.isSprinting())
((CraftEntity) Player).getHandle().getDataWatcher().watch(0, Byte.valueOf((byte) 32));
((CraftEntity) Player).getHandle().getDataWatcher()
.watch(0, Byte.valueOf((byte) 0));
}
// Not a Block
if (_block == null)
{
// Moved
if (!_loc.getBlock().equals(Player.getLocation().getBlock()))
{
Player.setExp(0);
_loc = Player.getLocation();
}
// Unmoved
else
{
double hideBoost = 0.025;
if (Host.GetKit(Player) instanceof KitHiderQuick)
hideBoost = 0.1;
public void SolidifyUpdate()
{
if (!Player.isSprinting())
((CraftEntity) Player).getHandle().getDataWatcher()
.watch(0, Byte.valueOf((byte) 32));
Player.setExp((float) Math.min(0.999f, Player.getExp() + hideBoost));
// Not a Block
if (_block == null)
{
// Moved
if (!_loc.getBlock().equals(Player.getLocation().getBlock()))
{
Player.setExp(0);
_loc = Player.getLocation();
}
// Unmoved
else
{
double hideBoost = 0.025;
if (Host.GetKit(Player) instanceof KitHiderQuick)
hideBoost = 0.1;
// Set Block
if (Player.getExp() >= 0.999f)
{
Block block = Player.getLocation().getBlock();
Player.setExp((float) Math.min(0.999f, Player.getExp()
+ hideBoost));
// Not Able
if (block.getType() != Material.AIR || !UtilBlock.solid(block.getRelative(BlockFace.DOWN)))
{
UtilPlayer.message(Player, F.main("Game", "You cannot become a Solid Block here."));
Player.setExp(0f);
return;
}
// Set Block
if (Player.getExp() >= 0.999f)
{
Block block = Player.getLocation().getBlock();
Bukkit.getPluginManager().callEvent(new HideSeek.PlayerSolidifyEvent(Player));
// Not Able
if (block.getType() != Material.AIR
|| !UtilBlock.solid(block
.getRelative(BlockFace.DOWN)))
{
UtilPlayer.message(Player, F.main("Game",
"You cannot become a Solid Block here."));
Player.setExp(0f);
return;
}
// Set Block
_block = block;
Bukkit.getPluginManager().callEvent(
new HideSeek.PlayerSolidifyEvent(Player));
// Effect
Player.playEffect(Player.getLocation(), Effect.STEP_SOUND, _mat);
// block.getWorld().playEffect(block.getLocation(), Effect.STEP_SOUND, _mat);
// Set Block
_block = block;
// Display
SolidifyVisual();
// Effect
Player.playEffect(Player.getLocation(), Effect.STEP_SOUND,
_mat);
// block.getWorld().playEffect(block.getLocation(),
// Effect.STEP_SOUND, _mat);
// Invisible
// Host.Manager.GetCondition().Factory().Cloak("Disguised as Block", Player, Player, 60000, false, false);
// Display
SolidifyVisual();
// Sound
Player.playSound(Player.getLocation(), Sound.NOTE_PLING, 1f, 2f);
// Invisible
// Host.Manager.GetCondition().Factory().Cloak("Disguised as Block",
// Player, Player, 60000, false, false);
// Teleport falling block to the position.
Vector blockLoc = _block.getLocation().add(0.5, _is18 ? -.21875 : 0, 0.5).toVector();
// Sound
Player.playSound(Player.getLocation(), Sound.NOTE_PLING,
1f, 2f);
_sawDiff.add(blockLoc.clone().subtract(_lastSaw));
// Teleport falling block to the position.
Vector blockLoc = _block.getLocation()
.add(0.5, -.21875, 0.5).toVector();
Packet packet = this.getPacket(_sawDiff, blockLoc);
_sawDiff.add(blockLoc.clone().subtract(_lastSaw));
_lastSaw = Player.getLocation().toVector().subtract(new Vector(0, _is18 ? 0.15625 : 0, 0));
_sawDiff = _lastSaw.clone().subtract(blockLoc);
Packet packet = this.getPacket(_sawDiff, blockLoc);
if (packet != null)
{
if (packet instanceof PacketPlayOutEntityTeleport)
{
_sawDiff = new Vector();
}
_lastSaw = Player.getLocation().toVector()
.subtract(new Vector(0, 0.15625, 0));
_sawDiff = _lastSaw.clone().subtract(blockLoc);
((CraftPlayer) Player).getHandle().playerConnection.sendPacket(packet);
}
}
}
}
// Is a Block
else
{
// Moved
if (!_loc.getBlock().equals(Player.getLocation().getBlock()))
{
SolidifyRemove();
}
// Send Packets
else
{
SolidifyVisual();
}
}
}
if (packet != null)
{
if (packet instanceof PacketPlayOutEntityTeleport)
{
_sawDiff = new Vector();
}
public void SolidifyRemove()
{
if (_block != null)
{
MapUtil.QuickChangeBlockAt(_block.getLocation(), 0, (byte) 0);
_block = null;
}
((CraftPlayer) Player).getHandle().playerConnection
.sendPacket(packet);
}
Player.setExp(0f);
for (Player player : UtilServer.getPlayers())
{
UtilPlayer.sendPacket(player,
new PacketPlayOutEntityDestroy(new int[]
{
getBlockId()
}));
}
}
}
}
// Is a Block
else
{
// Moved
if (!_loc.getBlock().equals(Player.getLocation().getBlock()))
{
SolidifyRemove();
}
// Send Packets
else
{
SolidifyVisual();
}
}
}
// Host.Manager.GetCondition().EndCondition(Player, null, "Disguised as Block");
public void SolidifyRemove()
{
if (_block != null)
{
MapUtil.QuickChangeBlockAt(_block.getLocation(), 0, (byte) 0);
_block = null;
// Inform
Player.playSound(Player.getLocation(), Sound.NOTE_PLING, 1f, 0.5f);
EntityTrackerEntry tracker = (EntityTrackerEntry) ((WorldServer) ((CraftEntity) Player)
.getHandle().world).tracker.trackedEntities.get(Player
.getEntityId());
FallingBlockCheck();
}
if (tracker != null)
{
for (EntityPlayer entity : tracker.trackedPlayers)
{
UtilPlayer.sendPacket(entity.getBukkitEntity(),
getBlockPackets());
}
}
}
@SuppressWarnings("deprecation")
public void SolidifyVisual()
{
if (_block == null)
return;
Player.setExp(0f);
// Remove Old
if (Player.getPassenger() != null)
{
Recharge.Instance.useForce(Player, "PassengerChange", 100);
// Host.Manager.GetCondition().EndCondition(Player, null,
// "Disguised as Block");
Player.getPassenger().remove();
Player.eject();
}
// Inform
Player.playSound(Player.getLocation(), Sound.NOTE_PLING, 1f, 0.5f);
// Others
for (Player other : UtilServer.getPlayers())
if (!other.equals(Player))
other.sendBlockChange(Player.getLocation(), _mat, (byte) 0);
FallingBlockCheck();
}
// Self
Player.sendBlockChange(Player.getLocation(), 36, (byte) 0);
@SuppressWarnings("deprecation")
public void SolidifyVisual()
{
if (_block == null)
return;
}
// Others
for (Player other : UtilServer.getPlayers())
if (!other.equals(Player))
other.sendBlockChange(Player.getLocation(), _mat, (byte) 0);
public void FallingBlockCheck()
{
// Self
Player.sendBlockChange(Player.getLocation(), 36, (byte) 0);
EntityPlayer player = ((CraftPlayer) Player).getHandle();
}
// Block Form (Hide Falling)
if (_block == null)
{
// Recreate Falling
if (Player.getPassenger() == null || !Player.getPassenger().isValid())
{
if (Recharge.Instance.use(Player, "PassengerChange", 100, false, false))
{
_entityId = UtilEnt.getNewEntityId(false);
// Falling Block
FallingBlock block = Player.getWorld().spawnFallingBlock(Player.getEyeLocation(), _mat, (byte) 0);
public void FallingBlockCheck()
{
// No Arrow Collision
((CraftFallingSand) block).getHandle().spectating = true;
EntityPlayer player = ((CraftPlayer) Player).getHandle();
Player.setPassenger(block);
}
}
else
{
// Ensure Falling doesnt Despawn
((CraftFallingSand) Player.getPassenger()).getHandle().ticksLived = 1;
Player.getPassenger().setTicksLived(1);
}
// Block Form (Hide Falling)
if (_block == null)
{
// Tell falling block to move around
// Tell falling block to move around
if (_lastSaw != null)
{
this._sawDiff.add(Player.getLocation().subtract(0, _is18 ? 0.15625 : 0, 0).toVector().subtract(_lastSaw));
}
if (_lastSaw != null)
{
this._sawDiff.add(Player.getLocation()
.subtract(0, 0.15625, 0).toVector()
.subtract(_lastSaw));
}
_lastSaw = Player.getLocation().subtract(0, _is18 ? 0.15625 : 0, 0).toVector();
_lastSaw = Player.getLocation().subtract(0, 0.15625, 0)
.toVector();
Packet packet = this.getPacket(_sawDiff, _lastSaw);
Packet packet = this.getPacket(_sawDiff, _lastSaw);
if (packet != null)
{
if (packet instanceof PacketPlayOutRelEntityMove)
{
PacketPlayOutRelEntityMove relPacket = (PacketPlayOutRelEntityMove) packet;
_sawDiff.subtract(new Vector(relPacket.b / 32D, relPacket.c / 32D, relPacket.d / 32D));
}
else
{
_sawDiff = new Vector();
}
if (packet != null)
{
if (packet instanceof PacketPlayOutRelEntityMove)
{
PacketPlayOutRelEntityMove relPacket = (PacketPlayOutRelEntityMove) packet;
_sawDiff.subtract(new Vector(relPacket.b / 32D,
relPacket.c / 32D, relPacket.d / 32D));
}
else
{
_sawDiff = new Vector();
}
player.playerConnection.sendPacket(packet);
}
player.playerConnection.sendPacket(packet);
}
}
}
}
}
private Packet getPacket(Vector blocksFromNewPosition, Vector newPosition)
{
int x = (int) Math.floor(blocksFromNewPosition.getX() * 32);
int y = (int) Math.floor(blocksFromNewPosition.getY() * 32);
int z = (int) Math.floor(blocksFromNewPosition.getZ() * 32);
private Packet getPacket(Vector blocksFromNewPosition, Vector newPosition)
{
int x = (int) Math.floor(blocksFromNewPosition.getX() * 32);
int y = (int) Math.floor(blocksFromNewPosition.getY() * 32);
int z = (int) Math.floor(blocksFromNewPosition.getZ() * 32);
if (x != 0 || y != 0 || z != 0)
{
if (x >= -128 && x <= 127 && y >= -128 && y <= 127 && z >= -128 && z <= 127)
{
PacketPlayOutRelEntityMove relMove = new PacketPlayOutRelEntityMove();
relMove.a = this._selfEntityId1;
relMove.b = (byte) x;
relMove.c = (byte) y;
relMove.d = (byte) z;
if (x != 0 || y != 0 || z != 0)
{
if (x >= -128 && x <= 127 && y >= -128 && y <= 127 && z >= -128
&& z <= 127)
{
PacketPlayOutRelEntityMove relMove = new PacketPlayOutRelEntityMove();
relMove.a = this._selfEntityId1;
relMove.b = (byte) x;
relMove.c = (byte) y;
relMove.d = (byte) z;
return relMove;
}
else
{
PacketPlayOutEntityTeleport teleportPacket = new PacketPlayOutEntityTeleport();
teleportPacket.a = _selfEntityId1;
teleportPacket.b = (int) Math.floor(32 * newPosition.getX());
teleportPacket.c = (int) Math.floor(32 * newPosition.getY());
teleportPacket.d = (int) Math.floor(32 * newPosition.getZ());
return relMove;
}
else
{
PacketPlayOutEntityTeleport teleportPacket = new PacketPlayOutEntityTeleport();
teleportPacket.a = _selfEntityId1;
teleportPacket.b = (int) Math.floor(32 * newPosition.getX());
teleportPacket.c = (int) Math.floor(32 * newPosition.getY());
teleportPacket.d = (int) Math.floor(32 * newPosition.getZ());
return teleportPacket;
}
}
return teleportPacket;
}
}
return null;
}
return null;
}
public Block GetBlock()
{
return _block;
}
public Block GetBlock()
{
return _block;
}
public int getEntityId()
{
return _entityId;
}
public int getEntityId()
{
return _entityId;
}
}

View File

@ -139,7 +139,6 @@ public abstract class SurvivalGames extends Game
private boolean _informedDeathmatchCommand;
private int _gameEndTime = 3 * 60;
private Field _nameTagVisibility;
private Field _packetTeam;
private int _chestRefillTime = 60 * 7;
@ -250,9 +249,6 @@ public abstract class SurvivalGames extends Game
_packetTeam = Class.forName("org.bukkit.craftbukkit.v1_8_R3.scoreboard.CraftTeam").getDeclaredField("team");
_packetTeam.setAccessible(true);
_nameTagVisibility = PacketPlayOutScoreboardTeam.class.getDeclaredField("e");
_nameTagVisibility.setAccessible(true);
}
catch (Exception ex)
{
@ -1386,7 +1382,7 @@ public abstract class SurvivalGames extends Game
WorldBorder border = new WorldBorder();
border.transitionSizeBetween(_currentBorder * 2, _previousBorder,
border.transitionSizeBetween(_currentBorder * 2, _previousBorder * 2,
_currentBorder != _previousBorder ? 1000 : 0);
PacketPlayOutWorldBorder packet = new PacketPlayOutWorldBorder(border,
@ -1407,7 +1403,7 @@ public abstract class SurvivalGames extends Game
border.transitionSizeBetween(
_currentBorder * 2,
_previousBorder,
_previousBorder * 2,
_currentBorder != _previousBorder ? 1000 - Math.min(1000,
(System.currentTimeMillis() - _borderStartedMoving))
: 0);
@ -1922,14 +1918,7 @@ public abstract class SurvivalGames extends Game
_hiddenNames.get(player).add(target.getName());
}
try
{
_nameTagVisibility.set(packet, hideName ? "never" : "always");
}
catch (Exception ex)
{
ex.printStackTrace();
}
packet.e = hideName ? "never" : "always";
UtilPlayer.sendPacket(player, packet);
}

View File

@ -281,7 +281,7 @@ public class UHC extends TeamGame
{
WorldBorder border = new WorldBorder();
border.transitionSizeBetween(_currentBorder * 2, _previousBorder,
border.transitionSizeBetween(_currentBorder * 2, _previousBorder * 2,
_currentBorder != _previousBorder ? 1000 : 0);
PacketPlayOutWorldBorder packet = new PacketPlayOutWorldBorder(border,
@ -377,7 +377,7 @@ public class UHC extends TeamGame
border.transitionSizeBetween(
_currentBorder * 2,
_previousBorder,
_previousBorder * 2,
_currentBorder != _previousBorder ? 1000 - Math.min(1000,
(System.currentTimeMillis() - _borderStartedMoving))
: 0);

View File

@ -124,7 +124,6 @@ public class Wizards extends SoloGame
private NautHashMap<SpellType, Spell> _spells = new NautHashMap<SpellType, Spell>();
private WizardSpellMenu _wizard;
private NautHashMap<String, Wizard> _wizards = new NautHashMap<String, Wizard>();
private Field _itemField;
private IPacketHandler _wizardSpellLevelHandler;
public Wizards(ArcadeManager manager)
@ -168,16 +167,6 @@ public class Wizards extends SoloGame
DamageTeamSelf = true;
VersionRequire1_8 = true;
try
{
_itemField = PacketPlayOutSetSlot.class.getDeclaredField("c");
_itemField.setAccessible(true);
}
catch (Exception ex)
{
ex.printStackTrace();
}
Manager.getCosmeticManager().setHideParticles(true);
// Manager.GetDamage().GetCombatManager().setUseWeaponName(AttackReason.DefaultWeaponName);
@ -257,8 +246,7 @@ public class Wizards extends SoloGame
try
{
item = CraftItemStack.asBukkitCopy((net.minecraft.server.v1_8_R3.ItemStack) _itemField
.get(packet));
item = CraftItemStack.asBukkitCopy(packet.c);
}
catch (Exception ex)
{