diff --git a/config.yml b/config.yml
index 5d89cba..cedfca0 100644
--- a/config.yml
+++ b/config.yml
@@ -1,3 +1,3 @@
# Set to false to disable the auto updater
-autoUpdate: true
-testMode: false
\ No newline at end of file
+autoUpdate: false
+testMode: false
diff --git a/plugin.yml b/plugin.yml
index 05131a1..f89025e 100644
--- a/plugin.yml
+++ b/plugin.yml
@@ -2,4 +2,3 @@ main: me.confuser.barapi.BarAPI
name: ${project.name}
version: ${project.version}
description: ${project.description}
-depend: [ProtocolLib]
\ No newline at end of file
diff --git a/pom.xml b/pom.xml
index 0414a7f..2bc497c 100644
--- a/pom.xml
+++ b/pom.xml
@@ -1,106 +1,47 @@
- 4.0.0
- BarAPI
- Allows plugins to control the boss health bar message
- me.confuser
- BarAPI
- 3.1
-
- BarAPI
-
-
- .
- true
- ${basedir}
-
- *.yml
-
-
-
- src
-
-
- maven-compiler-plugin
- 3.1
-
- 1.6
- 1.6
-
-
-
- org.apache.maven.plugins
- maven-shade-plugin
- 1.5
-
-
- package
-
- shade
-
-
- true
-
-
- net.gravitydevelopment.updater
- me.confuser.barapi.updater
-
-
- org.mcstats
- me.confuser.barapi.mcstats
-
-
-
-
-
-
-
-
-
-
- bukkit-repo
- http://repo.bukkit.org/content/groups/public
-
-
- gravity-repo
- http://repo.gravitydevelopment.net
-
-
- Plugin Metrics
- http://repo.mcstats.org/content/repositories/public
-
-
- comphenix-rep
- Comphenix Repository
- http://repo.comphenix.net/content/groups/public
-
-
+ 4.0.0
+ BarAPI
+ Allows plugins to control the boss health bar message
+ me.confuser
+ BarAPI
+ 3.1
+
+ BarAPI
+
+
+ .
+ true
+ ${basedir}
+
+ *.yml
+
+
+
+ src
+
+
+ maven-compiler-plugin
+ 3.1
+
+ 1.6
+ 1.6
+
+
+
+
+
+ spigot-repo
- http://repo.md-5.net/content/groups/public/
+ https://hub.spigotmc.org/nexus/content/groups/public/
-
-
-
- com.comphenix.protocol
- ProtocolLib
- 3.1.0
-
-
- net.gravitydevelopment.updater
- updater
- 2.1
-
-
- org.mcstats.bukkit
- metrics-lite
- R6
- compile
-
-
+
+
+ org.spigotmc
- spigot
- LATEST
+ spigot-api
+ 1.8-R0.1-SNAPSHOTjar
-
+
diff --git a/src/com/comphenix/packetwrapper/AbstractPacket.java b/src/com/comphenix/packetwrapper/AbstractPacket.java
deleted file mode 100644
index 2e0a0da..0000000
--- a/src/com/comphenix/packetwrapper/AbstractPacket.java
+++ /dev/null
@@ -1,82 +0,0 @@
-/*
- * PacketWrapper - Contains wrappers for each packet in Minecraft.
- * Copyright (C) 2012 Kristian S. Stangeland
- *
- * This program is free software; you can redistribute it and/or modify it under the terms of the
- * GNU Lesser General Public License as published by the Free Software Foundation; either version 2 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
- * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- * See the GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along with this program;
- * if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
- * 02111-1307 USA
- */
-
-package com.comphenix.packetwrapper;
-
-import java.lang.reflect.InvocationTargetException;
-
-import org.bukkit.entity.Player;
-
-import com.comphenix.protocol.PacketType;
-import com.comphenix.protocol.ProtocolLibrary;
-import com.comphenix.protocol.events.PacketContainer;
-import com.google.common.base.Objects;
-
-public abstract class AbstractPacket {
- // The packet we will be modifying
- protected PacketContainer handle;
-
- /**
- * Constructs a new strongly typed wrapper for the given packet.
- * @param handle - handle to the raw packet data.
- * @param type - the packet type.
- */
- protected AbstractPacket(PacketContainer handle, PacketType type) {
- // Make sure we're given a valid packet
- if (handle == null)
- throw new IllegalArgumentException("Packet handle cannot be NULL.");
- if (!Objects.equal(handle.getType(), type))
- throw new IllegalArgumentException(
- handle.getHandle() + " is not a packet of type " + type);
-
- this.handle = handle;
- }
-
- /**
- * Retrieve a handle to the raw packet data.
- * @return Raw packet data.
- */
- public PacketContainer getHandle() {
- return handle;
- }
-
- /**
- * Send the current packet to the given receiver.
- * @param receiver - the receiver.
- * @throws RuntimeException If the packet cannot be sent.
- */
- public void sendPacket(Player receiver) {
- try {
- ProtocolLibrary.getProtocolManager().sendServerPacket(receiver, getHandle());
- } catch (InvocationTargetException e) {
- throw new RuntimeException("Cannot send packet.", e);
- }
- }
-
- /**
- * Simulate receiving the current packet from the given sender.
- * @param sender - the sender.
- * @throws RuntimeException If the packet cannot be received.
- */
- public void recievePacket(Player sender) {
- try {
- ProtocolLibrary.getProtocolManager().recieveClientPacket(sender, getHandle());
- } catch (Exception e) {
- throw new RuntimeException("Cannot recieve packet.", e);
- }
- }
-}
diff --git a/src/com/comphenix/packetwrapper/WrapperHandshakeClientSetProtocol.java b/src/com/comphenix/packetwrapper/WrapperHandshakeClientSetProtocol.java
deleted file mode 100644
index 3863c30..0000000
--- a/src/com/comphenix/packetwrapper/WrapperHandshakeClientSetProtocol.java
+++ /dev/null
@@ -1,88 +0,0 @@
-package com.comphenix.packetwrapper;
-
-import com.comphenix.protocol.PacketType;
-import com.comphenix.protocol.PacketType.Protocol;
-import com.comphenix.protocol.events.PacketContainer;
-
-public class WrapperHandshakeClientSetProtocol extends AbstractPacket {
- public static final PacketType TYPE = PacketType.Handshake.Client.SET_PROTOCOL;
-
- public WrapperHandshakeClientSetProtocol() {
- super(new PacketContainer(TYPE), TYPE);
- handle.getModifier().writeDefaults();
- }
-
- public WrapperHandshakeClientSetProtocol(PacketContainer packet) {
- super(packet, TYPE);
- }
-
- /**
- * Retrieve the new protocol version.
- *
- * This is 4 as of 1.7.2. Note to be confused with the old protocol versions.
- * @return The current Protocol Version
- */
- public int getProtocolVersion() {
- return handle.getIntegers().read(0);
- }
-
- /**
- * Set the new protocol version.
- *
- * This is 4 as of 1.7.2.
- * @param value - new value.
- */
- public void setProtocolVersion(int value) {
- handle.getIntegers().write(0, value);
- }
-
- /**
- * Retrieve the server hostname or IP.
- * @return The current server hostname.
- */
- public String getServerHostname() {
- return handle.getStrings().read(0);
- }
-
- /**
- * Set the server hostname.
- * @param value - new value.
- */
- public void setServerHostname(String value) {
- handle.getStrings().write(0, value);
- }
-
- /**
- * Retrieve the TCP port number, typically 25565.
- * @return The current server port
- */
- public short getServerPort() {
- return handle.getIntegers().read(1).shortValue();
- }
-
- /**
- * Set the TCP port number.
- * @param value - new value.
- */
- public void setServerPort(short value) {
- handle.getIntegers().write(1, (int) value);
- }
-
- /**
- * Retrieve the next protocol to use.
- * @return The next protocol.
- */
- public Protocol getNextProtocol() {
- return handle.getProtocols().read(0);
- }
-
- /**
- * Set the next protocol to use.
- * @param value - new protocll.
- */
- public void setNextProtocol(Protocol value) {
- handle.getProtocols().write(0, value);
- }
-}
-
-
diff --git a/src/com/comphenix/packetwrapper/WrapperPlayServerAttachEntity.java b/src/com/comphenix/packetwrapper/WrapperPlayServerAttachEntity.java
deleted file mode 100644
index fe53d39..0000000
--- a/src/com/comphenix/packetwrapper/WrapperPlayServerAttachEntity.java
+++ /dev/null
@@ -1,123 +0,0 @@
-/*
- * PacketWrapper - Contains wrappers for each packet in Minecraft.
- * Copyright (C) 2012 Kristian S. Stangeland
- *
- * This program is free software; you can redistribute it and/or modify it under the terms of the
- * GNU Lesser General Public License as published by the Free Software Foundation; either version 2 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
- * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- * See the GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along with this program;
- * if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
- * 02111-1307 USA
- */
-
-package com.comphenix.packetwrapper;
-
-import org.bukkit.World;
-import org.bukkit.entity.Entity;
-
-import com.comphenix.protocol.PacketType;
-import com.comphenix.protocol.events.PacketContainer;
-import com.comphenix.protocol.events.PacketEvent;
-
-public class WrapperPlayServerAttachEntity extends AbstractPacket {
- public static final PacketType TYPE = PacketType.Play.Server.ATTACH_ENTITY;
-
- public WrapperPlayServerAttachEntity() {
- super(new PacketContainer(TYPE), TYPE);
- handle.getModifier().writeDefaults();
- }
-
- public WrapperPlayServerAttachEntity(PacketContainer packet) {
- super(packet, TYPE);
- }
-
- /**
- * Retrieve whether or not the entity is leached onto the vehicle.
- * @return TRUE if it is, FALSE otherwise.
- */
- public boolean getLeached() {
- return handle.getIntegers().read(0) != 0;
- }
-
- /**
- * Set whether or not the entity is leached onto the vehicle.
- * @param value - TRUE if it is leached, FALSE otherwise.
- */
- public void setLeached(boolean value) {
- handle.getIntegers().write(0, value ? 1 : 0);
- }
-
- /**
- * Retrieve the player entity ID being attached.
- * @return The current Entity ID
- */
- public int getEntityId() {
- return handle.getIntegers().read(1);
- }
-
- /**
- * Set the player entity ID being attached.
- * @param value - new value.
- */
- public void setEntityId(int value) {
- handle.getIntegers().write(1, value);
- }
-
- /**
- * Retrieve the entity being attached.
- * @param world - the current world of the entity.
- * @return The entity.
- */
- public Entity getEntity(World world) {
- return handle.getEntityModifier(world).read(1);
- }
-
- /**
- * Retrieve the entity being attached.
- * @param event - the packet event.
- * @return The entity.
- */
- public Entity getEntity(PacketEvent event) {
- return getEntity(event.getPlayer().getWorld());
- }
-
- /**
- * Retrieve the vehicle entity ID attached to (-1 for unattaching).
- * @return The current Vehicle ID
- */
- public int getVehicleId() {
- return handle.getIntegers().read(2);
- }
-
- /**
- * Set the vehicle entity ID attached to (-1 for unattaching).
- * @param value - new value.
- */
- public void setVehicleId(int value) {
- handle.getIntegers().write(2, value);
- }
-
- /**
- * Retrieve the vehicle entity attached to (NULL for unattaching).
- * @param world - the current world of the entity.
- * @return The vehicle.
- */
- public Entity getVehicle(World world) {
- return handle.getEntityModifier(world).read(2);
- }
-
- /**
- * Retrieve the vehicle entity attached to (NULL for unattaching).
- * @param event - the packet event.
- * @return The vehicle.
- */
- public Entity getVehicle(PacketEvent event) {
- return getVehicle(event.getPlayer().getWorld());
- }
-}
-
diff --git a/src/com/comphenix/packetwrapper/WrapperPlayServerEntity.java b/src/com/comphenix/packetwrapper/WrapperPlayServerEntity.java
deleted file mode 100644
index e39f1f9..0000000
--- a/src/com/comphenix/packetwrapper/WrapperPlayServerEntity.java
+++ /dev/null
@@ -1,76 +0,0 @@
-/*
- * PacketWrapper - Contains wrappers for each packet in Minecraft.
- * Copyright (C) 2012 Kristian S. Stangeland
- *
- * This program is free software; you can redistribute it and/or modify it under the terms of the
- * GNU Lesser General Public License as published by the Free Software Foundation; either version 2 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
- * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- * See the GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along with this program;
- * if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
- * 02111-1307 USA
- */
-
-package com.comphenix.packetwrapper;
-
-import org.bukkit.World;
-import org.bukkit.entity.Entity;
-
-import com.comphenix.protocol.PacketType;
-import com.comphenix.protocol.events.PacketContainer;
-import com.comphenix.protocol.events.PacketEvent;
-
-public class WrapperPlayServerEntity extends AbstractPacket {
- public static final PacketType TYPE = PacketType.Play.Server.ENTITY;
-
- public WrapperPlayServerEntity() {
- super(new PacketContainer(TYPE), TYPE);
- handle.getModifier().writeDefaults();
- }
-
- public WrapperPlayServerEntity(PacketContainer packet) {
- super(packet, TYPE);
- }
-
- protected WrapperPlayServerEntity(PacketContainer packet, PacketType type) {
- super(packet, type);
- }
-
- /**
- * Retrieve entity ID.
- * @return The current EID
- */
- public int getEntityID() {
- return handle.getIntegers().read(0);
- }
-
- /**
- * Set entity ID.
- * @param value - new value.
- */
- public void setEntityID(int value) {
- handle.getIntegers().write(0, value);
- }
-
- /**
- * Retrieve the entity.
- * @param world - the current world of the entity.
- * @return The entity.
- */
- public Entity getEntity(World world) {
- return handle.getEntityModifier(world).read(0);
- }
-
- /**
- * Retrieve the entity.
- * @param event - the packet event.
- * @return The entity.
- */
- public Entity getEntity(PacketEvent event) {
- return getEntity(event.getPlayer().getWorld());
- }
-}
\ No newline at end of file
diff --git a/src/com/comphenix/packetwrapper/WrapperPlayServerEntityMetadata.java b/src/com/comphenix/packetwrapper/WrapperPlayServerEntityMetadata.java
deleted file mode 100644
index 38dfa59..0000000
--- a/src/com/comphenix/packetwrapper/WrapperPlayServerEntityMetadata.java
+++ /dev/null
@@ -1,96 +0,0 @@
-/*
- * PacketWrapper - Contains wrappers for each packet in Minecraft.
- * Copyright (C) 2012 Kristian S. Stangeland
- *
- * This program is free software; you can redistribute it and/or modify it under the terms of the
- * GNU Lesser General Public License as published by the Free Software Foundation; either version 2 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
- * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- * See the GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along with this program;
- * if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
- * 02111-1307 USA
- */
-
-package com.comphenix.packetwrapper;
-
-import java.util.List;
-
-import org.bukkit.World;
-import org.bukkit.entity.Entity;
-
-import com.comphenix.protocol.PacketType;
-import com.comphenix.protocol.events.PacketContainer;
-import com.comphenix.protocol.events.PacketEvent;
-import com.comphenix.protocol.wrappers.WrappedDataWatcher;
-import com.comphenix.protocol.wrappers.WrappedWatchableObject;
-
-public class WrapperPlayServerEntityMetadata extends AbstractPacket {
- public static final PacketType TYPE = PacketType.Play.Server.ENTITY_METADATA;
-
- public WrapperPlayServerEntityMetadata() {
- super(new PacketContainer(TYPE), TYPE);
- handle.getModifier().writeDefaults();
- }
-
- public WrapperPlayServerEntityMetadata(PacketContainer packet) {
- super(packet, TYPE);
- }
-
- /**
- * Retrieve unique entity ID to update.
- * @return The current Entity ID
- */
- public int getEntityId() {
- return handle.getIntegers().read(0);
- }
-
- /**
- * Set unique entity ID to update.
- * @param value - new value.
- */
- public void setEntityId(int value) {
- handle.getIntegers().write(0, value);
- }
-
- /**
- * Retrieve the entity.
- * @param world - the current world of the entity.
- * @return The entity.
- */
- public Entity getEntity(World world) {
- return handle.getEntityModifier(world).read(0);
- }
-
- /**
- * Retrieve the entity.
- * @param event - the packet event.
- * @return The entity.
- */
- public Entity getEntity(PacketEvent event) {
- return getEntity(event.getPlayer().getWorld());
- }
-
- /**
- * Retrieve a list of all the watchable objects.
- *
- * This can be converted to a data watcher using {@link WrappedDataWatcher#WrappedDataWatcher(List) WrappedDataWatcher(List)}
- * @return The current metadata
- */
- public List getEntityMetadata() {
- return handle.getWatchableCollectionModifier().read(0);
- }
-
- /**
- * Set the list of the watchable objects (meta data).
- * @param value - new value.
- */
- public void setEntityMetadata(List value) {
- handle.getWatchableCollectionModifier().write(0, value);
- }
-}
-
-
diff --git a/src/com/comphenix/packetwrapper/WrapperPlayServerEntityTeleport.java b/src/com/comphenix/packetwrapper/WrapperPlayServerEntityTeleport.java
deleted file mode 100644
index 789086a..0000000
--- a/src/com/comphenix/packetwrapper/WrapperPlayServerEntityTeleport.java
+++ /dev/null
@@ -1,160 +0,0 @@
-/*
- * PacketWrapper - Contains wrappers for each packet in Minecraft.
- * Copyright (C) 2012 Kristian S. Stangeland
- *
- * This program is free software; you can redistribute it and/or modify it under the terms of the
- * GNU Lesser General Public License as published by the Free Software Foundation; either version 2 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
- * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- * See the GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along with this program;
- * if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
- * 02111-1307 USA
- */
-
-package com.comphenix.packetwrapper;
-
-import org.bukkit.World;
-import org.bukkit.entity.Entity;
-
-import com.comphenix.protocol.PacketType;
-import com.comphenix.protocol.events.PacketContainer;
-import com.comphenix.protocol.events.PacketEvent;
-
-public class WrapperPlayServerEntityTeleport extends AbstractPacket {
- public static final PacketType TYPE = PacketType.Play.Server.ENTITY_TELEPORT;
-
- public WrapperPlayServerEntityTeleport() {
- super(new PacketContainer(TYPE), TYPE);
- handle.getModifier().writeDefaults();
- }
-
- public WrapperPlayServerEntityTeleport(PacketContainer packet) {
- super(packet, TYPE);
- }
-
- /**
- * Retrieve entity ID.
- * @return The current EID
- */
- public int getEntityID() {
- return handle.getIntegers().read(0);
- }
-
- /**
- * Set entity ID.
- * @param value - new value.
- */
- public void setEntityID(int value) {
- handle.getIntegers().write(0, value);
- }
-
- /**
- * Retrieve the entity.
- * @param world - the current world of the entity.
- * @return The entity.
- */
- public Entity getEntity(World world) {
- return handle.getEntityModifier(world).read(0);
- }
-
- /**
- * Retrieve the entity.
- * @param event - the packet event.
- * @return The entity.
- */
- public Entity getEntity(PacketEvent event) {
- return getEntity(event.getPlayer().getWorld());
- }
-
- /**
- * Retrieve the x axis of the new position.
- *
- * Note that the coordinate is rounded off to the nearest 1/32 of a meter.
- * @return The current X
- */
- public double getX() {
- return handle.getIntegers().read(1) / 32.0D;
- }
-
- /**
- * Set the x axis of the new position.
- * @param value - new value.
- */
- public void setX(double value) {
- handle.getIntegers().write(1, (int) Math.floor(value * 32.0D));
- }
-
- /**
- * Retrieve the y axis of the new position.
- *
- * Note that the coordinate is rounded off to the nearest 1/32 of a meter.
- * @return The current y
- */
- public double getY() {
- return handle.getIntegers().read(2) / 32.0D;
- }
-
- /**
- * Set the y axis of the new position.
- * @param value - new value.
- */
- public void setY(double value) {
- handle.getIntegers().write(2, (int) Math.floor(value * 32.0D));
- }
-
- /**
- * Retrieve the z axis of the new position.
- *
- * Note that the coordinate is rounded off to the nearest 1/32 of a meter.
- * @return The current z
- */
- public double getZ() {
- return handle.getIntegers().read(3) / 32.0D;
- }
-
- /**
- * Set the z axis of the new position.
- * @param value - new value.
- */
- public void setZ(double value) {
- handle.getIntegers().write(3, (int) Math.floor(value * 32.0D));
- }
-
- /**
- * Retrieve the yaw of the current entity.
- * @return The current Yaw
- */
- public float getYaw() {
- return (handle.getBytes().read(0) * 360.F) / 256.0F;
- }
-
- /**
- * Set the yaw of the current entity.
- * @param value - new yaw.
- */
- public void setYaw(float value) {
- handle.getBytes().write(0, (byte) (value * 256.0F / 360.0F));
- }
-
- /**
- * Retrieve the pitch of the current entity.
- * @return The current pitch
- */
- public float getPitch() {
- return (handle.getBytes().read(1) * 360.F) / 256.0F;
- }
-
- /**
- * Set the pitch of the current entity.
- * @param value - new pitch.
- */
- public void setPitch(float value) {
- handle.getBytes().write(1, (byte) (value * 256.0F / 360.0F));
- }
-}
-
-
diff --git a/src/com/comphenix/packetwrapper/WrapperPlayServerSpawnEntity.java b/src/com/comphenix/packetwrapper/WrapperPlayServerSpawnEntity.java
deleted file mode 100644
index 8047931..0000000
--- a/src/com/comphenix/packetwrapper/WrapperPlayServerSpawnEntity.java
+++ /dev/null
@@ -1,334 +0,0 @@
-/*
- * PacketWrapper - Contains wrappers for each packet in Minecraft.
- * Copyright (C) 2012 Kristian S. Stangeland
- *
- * This program is free software; you can redistribute it and/or modify it under the terms of the
- * GNU Lesser General Public License as published by the Free Software Foundation; either version 2 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
- * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- * See the GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along with this program;
- * if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
- * 02111-1307 USA
- */
-
-package com.comphenix.packetwrapper;
-import org.bukkit.World;
-import org.bukkit.entity.Entity;
-
-import com.comphenix.protocol.PacketType;
-import com.comphenix.protocol.ProtocolLibrary;
-import com.comphenix.protocol.events.PacketContainer;
-import com.comphenix.protocol.events.PacketEvent;
-import com.comphenix.protocol.injector.PacketConstructor;
-import com.comphenix.protocol.reflect.IntEnum;
-
-public class WrapperPlayServerSpawnEntity extends AbstractPacket {
- public static final PacketType TYPE = PacketType.Play.Server.SPAWN_ENTITY;
-
- private static PacketConstructor entityConstructor;
-
- /**
- * Represents the different object types.
- *
- * @author Kristian
- */
- public static class ObjectTypes extends IntEnum {
- public static final int BOAT = 1;
- public static final int ITEM_STACK = 2;
- public static final int MINECART = 10;
- public static final int MINECART_STORAGE = 11;
- public static final int MINECART_POWERED = 12;
- public static final int ACTIVATED_TNT = 50;
- public static final int ENDER_CRYSTAL = 51;
- public static final int ARROW_PROJECTILE = 60;
- public static final int SNOWBALL_PROJECTILE = 61;
- public static final int EGG_PROJECTILE = 62;
- public static final int FIRE_BALL_GHAST = 63;
- public static final int FIRE_BALL_BLAZE = 64;
- public static final int THROWN_ENDERPEARL = 65;
- public static final int WITHER_SKULL = 66;
- public static final int FALLING_BLOCK = 70;
- public static final int ITEM_FRAME = 71;
- public static final int EYE_OF_ENDER = 72;
- public static final int THROWN_POTION = 73;
- public static final int FALLING_DRAGON_EGG = 74;
- public static final int THROWN_EXP_BOTTLE = 75;
- public static final int FIREWORK = 76;
- public static final int FISHING_FLOAT = 90;
-
- /**
- * The singleton instance. Can also be retrieved from the parent class.
- */
- private static ObjectTypes INSTANCE = new ObjectTypes();
-
- /**
- * Retrieve an instance of the object types enum.
- * @return Object type enum.
- */
- public static ObjectTypes getInstance() {
- return INSTANCE;
- }
- }
-
- public WrapperPlayServerSpawnEntity() {
- super(new PacketContainer(TYPE), TYPE);
- handle.getModifier().writeDefaults();
- }
-
- public WrapperPlayServerSpawnEntity(PacketContainer packet) {
- super(packet, TYPE);
- }
-
- public WrapperPlayServerSpawnEntity(Entity entity, int type, int objectData) {
- super(fromEntity(entity, type, objectData), TYPE);
- }
-
- // Useful constructor
- private static PacketContainer fromEntity(Entity entity, int type, int objectData) {
- if (entityConstructor == null)
- entityConstructor = ProtocolLibrary.getProtocolManager().createPacketConstructor(TYPE, entity, type, objectData);
- return entityConstructor.createPacket(entity, type, objectData);
- }
-
- /**
- * Retrieve entity ID of the Object.
- * @return The current EID
- */
- public int getEntityID() {
- return handle.getIntegers().read(0);
- }
-
- /**
- * Retrieve the entity that will be spawned.
- * @param world - the current world of the entity.
- * @return The spawned entity.
- */
- public Entity getEntity(World world) {
- return handle.getEntityModifier(world).read(0);
- }
-
- /**
- * Retrieve the entity that will be spawned.
- * @param event - the packet event.
- * @return The spawned entity.
- */
- public Entity getEntity(PacketEvent event) {
- return getEntity(event.getPlayer().getWorld());
- }
-
- /**
- * Set entity ID of the Object.
- * @param value - new value.
- */
- public void setEntityID(int value) {
- handle.getIntegers().write(0, value);
- }
-
- /**
- * Retrieve the type of object. See {@link ObjectTypes}
- * @return The current Type
- */
- public int getType() {
- return handle.getIntegers().read(9);
- }
-
- /**
- * Set the type of object. See {@link ObjectTypes}.
- * @param value - new value.
- */
- public void setType(int value) {
- handle.getIntegers().write(9, value);
- }
-
- /**
- * Retrieve the x position of the object.
- *
- * Note that the coordinate is rounded off to the nearest 1/32 of a meter.
- * @return The current X
- */
- public double getX() {
- return handle.getIntegers().read(1) / 32.0D;
- }
-
- /**
- * Set the x position of the object.
- * @param value - new value.
- */
- public void setX(double value) {
- handle.getIntegers().write(1, (int) Math.floor(value * 32.0D));
- }
-
- /**
- * Retrieve the y position of the object.
- *
- * Note that the coordinate is rounded off to the nearest 1/32 of a meter.
- * @return The current y
- */
- public double getY() {
- return handle.getIntegers().read(2) / 32.0D;
- }
-
- /**
- * Set the y position of the object.
- * @param value - new value.
- */
- public void setY(double value) {
- handle.getIntegers().write(2, (int) Math.floor(value * 32.0D));
- }
-
- /**
- * Retrieve the z position of the object.
- *
- * Note that the coordinate is rounded off to the nearest 1/32 of a meter.
- * @return The current z
- */
- public double getZ() {
- return handle.getIntegers().read(3) / 32.0D;
- }
-
- /**
- * Set the z position of the object.
- * @param value - new value.
- */
- public void setZ(double value) {
- handle.getIntegers().write(3, (int) Math.floor(value * 32.0D));
- }
-
- /**
- * Retrieve the optional speed x.
- *
- * This is ignored if {@link #getObjectData()} is zero.
- * @return The optional speed x.
- */
- public double getOptionalSpeedX() {
- return handle.getIntegers().read(4) / 8000.0D;
- }
-
- /**
- * Set the optional speed x.
- * @param value - new value.
- */
- public void setOptionalSpeedX(double value) {
- handle.getIntegers().write(4, (int) (value * 8000.0D));
- }
-
- /**
- * Retrieve the optional speed y.
- *
- * This is ignored if {@link #getObjectData()} is zero.
- * @return The optional speed y.
- */
- public double getOptionalSpeedY() {
- return handle.getIntegers().read(5) / 8000.0D;
- }
-
- /**
- * Set the optional speed y.
- * @param value - new value.
- */
- public void setOptionalSpeedY(double value) {
- handle.getIntegers().write(5, (int) (value * 8000.0D));
- }
-
- /**
- * Retrieve the optional speed z.
- *
- * This is ignored if {@link #getObjectData()} is zero.
- * @return The optional speed z.
- */
- public double getOptionalSpeedZ() {
- return handle.getIntegers().read(6) / 8000.0D;
- }
-
- /**
- * Set the optional speed z.
- * @param value - new value.
- */
- public void setOptionalSpeedZ(double value) {
- handle.getIntegers().write(6, (int) (value * 8000.0D));
- }
-
- /**
- * Retrieve the yaw.
- * @return The current Yaw
- */
- public float getYaw() {
- return (handle.getIntegers().read(7) * 360.F) / 256.0F;
- }
-
- /**
- * Set the yaw of the object spawned.
- * @param value - new yaw.
- */
- public void setYaw(float value) {
- handle.getIntegers().write(7, (int) (value * 256.0F / 360.0F));
- }
-
- /**
- * Retrieve the pitch.
- * @return The current pitch.
- */
- public float getPitch() {
- return (handle.getIntegers().read(8) * 360.F) / 256.0F;
- }
-
- /**
- * Set the pitch.
- * @param value - new pitch.
- */
- public void setPitch(float value) {
- handle.getIntegers().write(8, (int) (value * 256.0F / 360.0F));
- }
-
- /**
- * Retrieve object data.
- *
- * The content depends on the object type:
- *
- *
- *
Object Type:
- *
Name:
- *
Description
- *
- *
- *
ITEM_FRAME
- *
Orientation
- *
0-3: South, West, North, East
- *
- *
- *
FALLING_BLOCK
- *
Block Type
- *
BlockID | (Metadata << 0xC)
- *
- *
- *
Projectiles
- *
Entity ID
- *
The entity ID of the thrower
- *
- *
- *
Splash Potions
- *
Data Value
- *
Potion data value.
- *
- *
- * @return The current object Data
- */
- public int getObjectData() {
- return handle.getIntegers().read(10);
- }
-
- /**
- * Set object Data.
- *
- * The content depends on the object type. See {@link #getObjectData()} for more information.
- * @param value - new object data.
- */
- public void setObjectData(int value) {
- handle.getIntegers().write(10, value);
- }
-}
-
diff --git a/src/com/comphenix/packetwrapper/WrapperPlayServerSpawnEntityLiving.java b/src/com/comphenix/packetwrapper/WrapperPlayServerSpawnEntityLiving.java
deleted file mode 100644
index 8f96994..0000000
--- a/src/com/comphenix/packetwrapper/WrapperPlayServerSpawnEntityLiving.java
+++ /dev/null
@@ -1,283 +0,0 @@
-/*
- * PacketWrapper - Contains wrappers for each packet in Minecraft.
- * Copyright (C) 2012 Kristian S. Stangeland
- *
- * This program is free software; you can redistribute it and/or modify it under the terms of the
- * GNU Lesser General Public License as published by the Free Software Foundation; either version 2 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
- * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- * See the GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along with this program;
- * if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
- * 02111-1307 USA
- */
-
-package com.comphenix.packetwrapper;
-
-import org.bukkit.World;
-import org.bukkit.entity.Entity;
-import org.bukkit.entity.EntityType;
-
-import com.comphenix.protocol.PacketType;
-import com.comphenix.protocol.ProtocolLibrary;
-import com.comphenix.protocol.events.PacketContainer;
-import com.comphenix.protocol.events.PacketEvent;
-import com.comphenix.protocol.injector.PacketConstructor;
-import com.comphenix.protocol.wrappers.WrappedDataWatcher;
-
-public class WrapperPlayServerSpawnEntityLiving extends AbstractPacket {
- public static final PacketType TYPE = PacketType.Play.Server.SPAWN_ENTITY_LIVING;
-
- private static PacketConstructor entityConstructor;
-
- public WrapperPlayServerSpawnEntityLiving() {
- super(new PacketContainer(TYPE), TYPE);
- handle.getModifier().writeDefaults();
- }
-
- public WrapperPlayServerSpawnEntityLiving(PacketContainer packet) {
- super(packet, TYPE);
- }
-
- public WrapperPlayServerSpawnEntityLiving(Entity entity) {
- super(fromEntity(entity), TYPE);
- }
-
- // Useful constructor
- private static PacketContainer fromEntity(Entity entity) {
- if (entityConstructor == null)
- entityConstructor = ProtocolLibrary.getProtocolManager().createPacketConstructor(TYPE, entity);
- return entityConstructor.createPacket(entity);
- }
-
- /**
- * Retrieve entity ID.
- * @return The current EID
- */
- public int getEntityID() {
- return handle.getIntegers().read(0);
- }
-
- /**
- * Retrieve the entity that will be spawned.
- * @param world - the current world of the entity.
- * @return The spawned entity.
- */
- public Entity getEntity(World world) {
- return handle.getEntityModifier(world).read(0);
- }
-
- /**
- * Retrieve the entity that will be spawned.
- * @param event - the packet event.
- * @return The spawned entity.
- */
- public Entity getEntity(PacketEvent event) {
- return getEntity(event.getPlayer().getWorld());
- }
-
- /**
- * Set entity ID.
- * @param value - new value.
- */
- public void setEntityID(int value) {
- handle.getIntegers().write(0, value);
- }
-
- /**
- * Retrieve the type of mob.
- * @return The current Type
- */
- @SuppressWarnings("deprecation")
- public EntityType getType() {
- return EntityType.fromId(handle.getIntegers().read(1));
- }
-
- /**
- * Set the type of mob.
- * @param value - new value.
- */
- @SuppressWarnings("deprecation")
- public void setType(EntityType value) {
- handle.getIntegers().write(1, (int) value.getTypeId());
- }
-
- /**
- * Set the type of mob.
- * @param value - new value.
- */
- public void setType(int value) {
- handle.getIntegers().write(1, value);
- }
-
- /**
- * Retrieve the x position of the object.
- *
- * Note that the coordinate is rounded off to the nearest 1/32 of a meter.
- * @return The current X
- */
- public double getX() {
- return handle.getIntegers().read(2) / 32.0D;
- }
-
- /**
- * Set the x position of the object.
- * @param value - new value.
- */
- public void setX(double value) {
- handle.getIntegers().write(2, (int) Math.floor(value * 32.0D));
- }
-
- /**
- * Retrieve the y position of the object.
- *
- * Note that the coordinate is rounded off to the nearest 1/32 of a meter.
- * @return The current y
- */
- public double getY() {
- return handle.getIntegers().read(3) / 32.0D;
- }
-
- /**
- * Set the y position of the object.
- * @param value - new value.
- */
- public void setY(double value) {
- handle.getIntegers().write(3, (int) Math.floor(value * 32.0D));
- }
-
- /**
- * Retrieve the z position of the object.
- *
- * Note that the coordinate is rounded off to the nearest 1/32 of a meter.
- * @return The current z
- */
- public double getZ() {
- return handle.getIntegers().read(4) / 32.0D;
- }
-
- /**
- * Set the z position of the object.
- * @param value - new value.
- */
- public void setZ(double value) {
- handle.getIntegers().write(4, (int) Math.floor(value * 32.0D));
- }
-
- /**
- * Retrieve the yaw.
- * @return The current Yaw
- */
- public float getYaw() {
- return (handle.getBytes().read(0) * 360.F) / 256.0F;
- }
-
- /**
- * Set the yaw of the spawned mob.
- * @param value - new yaw.
- */
- public void setYaw(float value) {
- handle.getBytes().write(0, (byte) (value * 256.0F / 360.0F));
- }
-
- /**
- * Retrieve the pitch.
- * @return The current pitch
- */
- public float getHeadPitch() {
- return (handle.getBytes().read(1) * 360.F) / 256.0F;
- }
-
- /**
- * Set the pitch of the spawned mob.
- * @param value - new pitch.
- */
- public void setHeadPitch(float value) {
- handle.getBytes().write(1, (byte) (value * 256.0F / 360.0F));
- }
-
- /**
- * Retrieve the yaw of the mob's head.
- * @return The current yaw.
- */
- public float getHeadYaw() {
- return (handle.getBytes().read(2) * 360.F) / 256.0F;
- }
-
- /**
- * Set the yaw of the mob's head.
- * @param value - new yaw.
- */
- public void setHeadYaw(float value) {
- handle.getBytes().write(2, (byte) (value * 256.0F / 360.0F));
- }
-
- /**
- * Retrieve the velocity in the x axis.
- * @return The current velocity X
- */
- public double getVelocityX() {
- return handle.getIntegers().read(5) / 8000.0D;
- }
-
- /**
- * Set the velocity in the x axis.
- * @param value - new value.
- */
- public void setVelocityX(double value) {
- handle.getIntegers().write(5, (int) (value * 8000.0D));
- }
-
- /**
- * Retrieve the velocity in the y axis.
- * @return The current velocity y
- */
- public double getVelocityY() {
- return handle.getIntegers().read(6) / 8000.0D;
- }
-
- /**
- * Set the velocity in the y axis.
- * @param value - new value.
- */
- public void setVelocityY(double value) {
- handle.getIntegers().write(6, (int) (value * 8000.0D));
- }
-
- /**
- * Retrieve the velocity in the z axis.
- * @return The current velocity z
- */
- public double getVelocityZ() {
- return handle.getIntegers().read(7) / 8000.0D;
- }
-
- /**
- * Set the velocity in the z axis.
- * @param value - new value.
- */
- public void setVelocityZ(double value) {
- handle.getIntegers().write(7, (int) (value * 8000.0D));
- }
-
- /**
- * Retrieve the data watcher.
- *
- * Content varies by mob, see Entities.
- * @return The current Metadata
- */
- public WrappedDataWatcher getMetadata() {
- return handle.getDataWatcherModifier().read(0);
- }
-
- /**
- * Set the data watcher.
- * @param value - new value.
- */
- public void setMetadata(WrappedDataWatcher value) {
- handle.getDataWatcherModifier().write(0, value);
- }
-}
\ No newline at end of file
diff --git a/src/me/confuser/barapi/BarAPI.java b/src/me/confuser/barapi/BarAPI.java
index 56b25bf..54fee1c 100644
--- a/src/me/confuser/barapi/BarAPI.java
+++ b/src/me/confuser/barapi/BarAPI.java
@@ -1,12 +1,10 @@
package me.confuser.barapi;
-import java.io.IOException;
import java.util.HashMap;
import java.util.UUID;
import me.confuser.barapi.nms.FakeDragon;
import me.confuser.barapi.nms.FakeWither;
-import net.gravitydevelopment.updater.Updater;
import org.apache.commons.lang.Validate;
import org.bukkit.Bukkit;
@@ -21,9 +19,7 @@
import org.bukkit.event.player.PlayerRespawnEvent;
import org.bukkit.event.player.PlayerTeleportEvent;
import org.bukkit.plugin.java.JavaPlugin;
-import org.mcstats.MetricsLite;
-
-import com.comphenix.protocol.ProtocolLibrary;
+import org.bukkit.scheduler.BukkitRunnable;
/**
* Allows plugins to safely set a health bar message.
@@ -36,25 +32,13 @@ public class BarAPI extends JavaPlugin implements Listener {
private static HashMap wither_players = new HashMap();
private static HashMap timers = new HashMap();
- private static HandshakeListener handshakeListener;
private static BarAPI plugin;
+ @Override
public void onEnable() {
getConfig().options().copyDefaults(true);
saveConfig();
- if (getConfig().getBoolean("autoUpdate"))
- new Updater(this, 64876, getFile(), Updater.UpdateType.DEFAULT, false);
-
- try {
- MetricsLite metrics = new MetricsLite(this);
- metrics.start();
- } catch (IOException e) {
- // Failed to submit the stats :-(
- }
-
- handshakeListener = new HandshakeListener(this);
- ProtocolLibrary.getProtocolManager().addPacketListener(handshakeListener);
getServer().getPluginManager().registerEvents(this, this);
getLogger().info("Loaded");
@@ -74,8 +58,21 @@ public void run() {
}, 30L, 300L);
}
+
+ // Continuously fix for 1.8 clients
+ new BukkitRunnable() {
+ @Override
+ public void run() {
+ for (Player p : getServer().getOnlinePlayers()) {
+ if (Util.hasNewProtocol(p)) {
+ handleTeleport(p, p.getLocation());
+ }
+ }
+ }
+ }.runTaskTimer(this, 0, 10);
}
+ @Override
public void onDisable() {
for (Player player : plugin.getServer().getOnlinePlayers()) {
quit(player);
@@ -91,10 +88,6 @@ public void onDisable() {
timers.clear();
}
- public static HandshakeListener getHandshakeListener(){
- return handshakeListener;
- }
-
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
public void PlayerLoggout(PlayerQuitEvent event) {
quit(event.getPlayer());
@@ -164,9 +157,6 @@ public void run() {
private void quit(Player player) {
removeBar(player);
-
- // Incase they decide to switch versions lol.
- handshakeListener.clear(player);
}
/**
@@ -199,7 +189,7 @@ public static void setMessage(String message) {
* It will be cut to that size automatically.
*/
public static void setMessage(Player player, String message) {
- if(handshakeListener.hasNewProtocol(player)){
+ if(Util.hasNewProtocol(player)){
FakeWither wither = getWither(player, message);
wither.name = cleanMessage(message);
@@ -262,7 +252,7 @@ public static void setMessage(String message, float percent) {
public static void setMessage(Player player, String message, float percent) {
Validate.isTrue(0F <= percent && percent <= 100F, "Percent must be between 0F and 100F, but was: ", percent);
- if(handshakeListener.hasNewProtocol(player)){
+ if(Util.hasNewProtocol(player)){
FakeWither wither = getWither(player, message);
wither.name = cleanMessage(message);
@@ -329,7 +319,7 @@ public static void setMessage(String message, int seconds) {
public static void setMessage(final Player player, String message, int seconds) {
Validate.isTrue(seconds > 0, "Seconds must be above 1 but was: ", seconds);
- if(handshakeListener.hasNewProtocol(player)){
+ if(Util.hasNewProtocol(player)){
FakeWither wither = getWither(player, message);
wither.name = cleanMessage(message);
@@ -528,7 +518,7 @@ private static void cancelTimer(Player player) {
private static void sendDragon(FakeDragon dragon, Player player) {
Util.sendPacket(player, dragon.getMetaPacket(dragon.getWatcher()));
- if(handshakeListener.hasNewProtocol(player)){
+ if(Util.hasNewProtocol(player)){
Util.sendPacket(player, dragon.getTeleportPacket(player.getLocation().add(player.getEyeLocation().getDirection().multiply(20))));
} else {
Util.sendPacket(player, dragon.getTeleportPacket(player.getLocation().add(0, -300, 0)));
@@ -538,7 +528,7 @@ private static void sendDragon(FakeDragon dragon, Player player) {
private static void sendWither(FakeWither wither, Player player) {
Util.sendPacket(player, wither.getMetaPacket(wither.getWatcher()));
- if(handshakeListener.hasNewProtocol(player)){
+ if(Util.hasNewProtocol(player)){
Util.sendPacket(player, wither.getTeleportPacket(player.getLocation().add(player.getEyeLocation().getDirection().multiply(20))));
} else {
Util.sendPacket(player, wither.getTeleportPacket(player.getLocation().add(0, -300, 0)));
@@ -579,7 +569,7 @@ private static FakeWither addWither(Player player, Location loc, String message)
}
private static FakeDragon addDragon(Player player, String message) {
- boolean ver_1_8 = BarAPI.getHandshakeListener().hasNewProtocol(player) ? true : false;
+ boolean ver_1_8 = Util.hasNewProtocol(player) ? true : false;
FakeDragon dragon = null;
FakeWither wither = null;
@@ -597,7 +587,7 @@ private static FakeDragon addDragon(Player player, String message) {
}
private static FakeDragon addDragon(Player player, Location loc, String message) {
- boolean ver_1_8 = BarAPI.getHandshakeListener().hasNewProtocol(player) ? true : false;
+ boolean ver_1_8 = Util.hasNewProtocol(player) ? true : false;
FakeDragon dragon = null;
FakeWither wither = null;
diff --git a/src/me/confuser/barapi/HandshakeListener.java b/src/me/confuser/barapi/HandshakeListener.java
deleted file mode 100644
index 84a75dc..0000000
--- a/src/me/confuser/barapi/HandshakeListener.java
+++ /dev/null
@@ -1,48 +0,0 @@
-package me.confuser.barapi;
-
-import java.util.HashSet;
-import java.util.UUID;
-
-import org.bukkit.Bukkit;
-import org.bukkit.entity.Player;
-import org.bukkit.plugin.Plugin;
-
-import com.comphenix.packetwrapper.WrapperHandshakeClientSetProtocol;
-import com.comphenix.protocol.PacketType;
-import com.comphenix.protocol.events.ListenerPriority;
-import com.comphenix.protocol.events.PacketAdapter;
-import com.comphenix.protocol.events.PacketEvent;
-
-public class HandshakeListener extends PacketAdapter {
-
- private static HashSet newProtocolIPs;
-
- public HandshakeListener(Plugin plugin) {
- super(plugin, ListenerPriority.MONITOR, PacketType.Handshake.Client.SET_PROTOCOL);
- newProtocolIPs = new HashSet();
- }
-
- @Override
- public void onPacketReceiving(PacketEvent event) {
-
- WrapperHandshakeClientSetProtocol handshakePacket = new WrapperHandshakeClientSetProtocol(event.getPacket());
- int protocolVersion = handshakePacket.getProtocolVersion();
-
- if (protocolVersion > 5) { // 1.8
- Bukkit.getLogger().info("Set " + getIP(event.getPlayer()) + " protocol ID to 1.8");
- newProtocolIPs.add(getIP(event.getPlayer()));
- }
- }
-
- private String getIP(Player player) {
- return player.getAddress().getAddress().getHostAddress();
- }
-
- public boolean hasNewProtocol(Player player) {
- return newProtocolIPs.contains(getIP(player));
- }
-
- public void clear(Player player) {
- newProtocolIPs.remove(getIP(player));
- }
-}
diff --git a/src/me/confuser/barapi/Util.java b/src/me/confuser/barapi/Util.java
index d5c81af..8d9c6de 100644
--- a/src/me/confuser/barapi/Util.java
+++ b/src/me/confuser/barapi/Util.java
@@ -34,7 +34,7 @@ public class Util {
String mcVersion = name.substring(name.lastIndexOf('.') + 1);
String[] versions = mcVersion.split("_");
- if (versions[0].equals("v1") && Integer.parseInt(versions[1]) == 7) {
+ if (versions[0].equals("v1") && Integer.parseInt(versions[1]) == 8) {
newProtocol = true;
// fakeDragonClass = v1_7.class;
}
@@ -203,4 +203,7 @@ public static boolean ClassListEqual(Class>[] l1, Class>[] l2) {
return equal;
}
+ public static boolean hasNewProtocol(Player player) {
+ return true;
+ }
}
\ No newline at end of file
diff --git a/src/me/confuser/barapi/nms/legacy/DataWatcherLegacy.java b/src/me/confuser/barapi/nms/legacy/DataWatcherLegacy.java
deleted file mode 100644
index 7904025..0000000
--- a/src/me/confuser/barapi/nms/legacy/DataWatcherLegacy.java
+++ /dev/null
@@ -1,316 +0,0 @@
-package me.confuser.barapi.nms.legacy;
-
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-import java.util.concurrent.locks.ReadWriteLock;
-import java.util.concurrent.locks.ReentrantReadWriteLock;
-
-import net.minecraft.server.v1_7_R4.ChunkCoordinates;
-import net.minecraft.server.v1_7_R4.CrashReport;
-import net.minecraft.server.v1_7_R4.CrashReportSystemDetails;
-import net.minecraft.server.v1_7_R4.Entity;
-import net.minecraft.server.v1_7_R4.ItemStack;
-import net.minecraft.server.v1_7_R4.PacketDataSerializer;
-import net.minecraft.server.v1_7_R4.ReportedException;
-import net.minecraft.util.org.apache.commons.lang3.ObjectUtils;
-
-public class DataWatcherLegacy {
-
- private final Entity a;
- private boolean b = true;
- private static final HashMap c = new HashMap();
- private final Map d = new HashMap();
- private boolean e;
- private ReadWriteLock f = new ReentrantReadWriteLock();
-
- public DataWatcherLegacy(Entity entity) {
- this.a = entity;
- }
-
- public void a(int i, Object object) {
- Integer integer = (Integer) c.get(object.getClass());
-
- if (integer == null) {
- throw new IllegalArgumentException("Unknown data type: " + object.getClass());
- } else if (i > 31) {
- throw new IllegalArgumentException("Data value id is too big with " + i + "! (Max is " + 31 + ")");
- } else if (this.d.containsKey(Integer.valueOf(i))) {
- throw new IllegalArgumentException("Duplicate id value for " + i + "!");
- } else {
- WatchableObjectLegacy WatchableObjectLegacy = new WatchableObjectLegacy(integer.intValue(), i, object);
-
- this.f.writeLock().lock();
- this.d.put(Integer.valueOf(i), WatchableObjectLegacy);
- this.f.writeLock().unlock();
- this.b = false;
- }
- }
-
- public void add(int i, int j) {
- WatchableObjectLegacy WatchableObjectLegacy = new WatchableObjectLegacy(j, i, null);
-
- this.f.writeLock().lock();
- this.d.put(Integer.valueOf(i), WatchableObjectLegacy);
- this.f.writeLock().unlock();
- this.b = false;
- }
-
- public byte getByte(int i) {
- return ((Byte) this.i(i).b()).byteValue();
- }
-
- public short getShort(int i) {
- return ((Short) this.i(i).b()).shortValue();
- }
-
- public int getInt(int i) {
- return ((Integer) this.i(i).b()).intValue();
- }
-
- public float getFloat(int i) {
- return ((Float) this.i(i).b()).floatValue();
- }
-
- public String getString(int i) {
- return (String) this.i(i).b();
- }
-
- public ItemStack getItemStack(int i) {
- return (ItemStack) this.i(i).b();
- }
-
- private WatchableObjectLegacy i(int i) {
- this.f.readLock().lock();
-
- WatchableObjectLegacy WatchableObjectLegacy;
-
- try {
- WatchableObjectLegacy = (WatchableObjectLegacy) this.d.get(Integer.valueOf(i));
- } catch (Throwable throwable) {
- CrashReport crashreport = CrashReport.a(throwable, "Getting synched entity data");
- CrashReportSystemDetails crashreportsystemdetails = crashreport.a("Synched entity data");
-
- crashreportsystemdetails.a("Data ID", Integer.valueOf(i));
- throw new ReportedException(crashreport);
- }
-
- this.f.readLock().unlock();
- return WatchableObjectLegacy;
- }
-
- public void watch(int i, Object object) {
- WatchableObjectLegacy WatchableObjectLegacy = this.i(i);
-
- if (ObjectUtils.notEqual(object, WatchableObjectLegacy.b())) {
- WatchableObjectLegacy.a(object);
- this.a.i(i);
- WatchableObjectLegacy.a(true);
- this.e = true;
- }
- }
-
- public void update(int i) {
- WatchableObjectLegacy.a(this.i(i), true);
- this.e = true;
- }
-
- public boolean a() {
- return this.e;
- }
-
- public static void a(List list, PacketDataSerializerLegacy packetdataserializer) {
- if (list != null) {
- Iterator iterator = list.iterator();
-
- while (iterator.hasNext()) {
- WatchableObjectLegacy WatchableObjectLegacy = (WatchableObjectLegacy) iterator.next();
-
- a(packetdataserializer, WatchableObjectLegacy);
- }
- }
-
- packetdataserializer.writeByte(127);
- }
-
- public List b() {
- ArrayList arraylist = null;
-
- if (this.e) {
- this.f.readLock().lock();
- Iterator iterator = this.d.values().iterator();
-
- while (iterator.hasNext()) {
- WatchableObjectLegacy WatchableObjectLegacy = (WatchableObjectLegacy) iterator.next();
-
- if (WatchableObjectLegacy.d()) {
- WatchableObjectLegacy.a(false);
- if (arraylist == null) {
- arraylist = new ArrayList();
- }
-
- arraylist.add(WatchableObjectLegacy);
- }
- }
-
- this.f.readLock().unlock();
- }
-
- this.e = false;
- return arraylist;
- }
-
- public void a(PacketDataSerializerLegacy packetdataserializer) {
- this.f.readLock().lock();
- Iterator iterator = this.d.values().iterator();
-
- while (iterator.hasNext()) {
- WatchableObjectLegacy WatchableObjectLegacy = (WatchableObjectLegacy) iterator.next();
-
- a(packetdataserializer, WatchableObjectLegacy);
- }
-
- this.f.readLock().unlock();
- packetdataserializer.writeByte(127);
- }
-
- public List c() {
- ArrayList arraylist = null;
-
- this.f.readLock().lock();
-
- WatchableObjectLegacy WatchableObjectLegacy;
-
- for (Iterator iterator = this.d.values().iterator(); iterator.hasNext(); arraylist.add(WatchableObjectLegacy)) {
- WatchableObjectLegacy = (WatchableObjectLegacy) iterator.next();
- if (arraylist == null) {
- arraylist = new ArrayList();
- }
- }
-
- this.f.readLock().unlock();
- return arraylist;
- }
-
- private static void a(PacketDataSerializerLegacy packetdataserializer, WatchableObjectLegacy WatchableObjectLegacy) {
- int i = (WatchableObjectLegacy.c() << 5 | WatchableObjectLegacy.a() & 31) & 255;
-
- packetdataserializer.writeByte(i);
- switch (WatchableObjectLegacy.c()) {
- case 0:
- packetdataserializer.writeByte(((Byte) WatchableObjectLegacy.b()).byteValue());
- break;
-
- case 1:
- packetdataserializer.writeShort(((Short) WatchableObjectLegacy.b()).shortValue());
- break;
-
- case 2:
- packetdataserializer.writeInt(((Integer) WatchableObjectLegacy.b()).intValue());
- break;
-
- case 3:
- packetdataserializer.writeFloat(((Float) WatchableObjectLegacy.b()).floatValue());
- break;
-
- case 4:
- try {
- packetdataserializer.a((String) WatchableObjectLegacy.b());
- } catch (IOException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
- break;
-
- case 5:
- ItemStack itemstack = (ItemStack) WatchableObjectLegacy.b();
-
- packetdataserializer.a(itemstack);
- break;
-
- case 6:
- ChunkCoordinates chunkcoordinates = (ChunkCoordinates) WatchableObjectLegacy.b();
-
- packetdataserializer.writeInt(chunkcoordinates.x);
- packetdataserializer.writeInt(chunkcoordinates.y);
- packetdataserializer.writeInt(chunkcoordinates.z);
- }
- }
-
- public static List b(PacketDataSerializerLegacy packetdataserializer) {
- ArrayList arraylist = null;
-
- for (byte b0 = packetdataserializer.readByte(); b0 != 127; b0 = packetdataserializer.readByte()) {
- if (arraylist == null) {
- arraylist = new ArrayList();
- }
-
- int i = (b0 & 224) >> 5;
- int j = b0 & 31;
- WatchableObjectLegacy WatchableObjectLegacy = null;
-
- switch (i) {
- case 0:
- WatchableObjectLegacy = new WatchableObjectLegacy(i, j, Byte.valueOf(packetdataserializer.readByte()));
- break;
-
- case 1:
- WatchableObjectLegacy = new WatchableObjectLegacy(i, j, Short.valueOf(packetdataserializer.readShort()));
- break;
-
- case 2:
- WatchableObjectLegacy = new WatchableObjectLegacy(i, j, Integer.valueOf(packetdataserializer.readInt()));
- break;
-
- case 3:
- WatchableObjectLegacy = new WatchableObjectLegacy(i, j, Float.valueOf(packetdataserializer.readFloat()));
- break;
-
- case 4:
- try {
- WatchableObjectLegacy = new WatchableObjectLegacy(i, j, packetdataserializer.c(32767));
- } catch (IOException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
- break;
-
- case 5:
- WatchableObjectLegacy = new WatchableObjectLegacy(i, j, packetdataserializer.c());
- break;
-
- case 6:
- int k = packetdataserializer.readInt();
- int l = packetdataserializer.readInt();
- int i1 = packetdataserializer.readInt();
-
- WatchableObjectLegacy = new WatchableObjectLegacy(i, j, new ChunkCoordinates(k, l, i1));
- }
-
- arraylist.add(WatchableObjectLegacy);
- }
-
- return arraylist;
- }
-
- public boolean d() {
- return this.b;
- }
-
- public void e() {
- this.e = false;
- }
-
- static {
- c.put(Byte.class, Integer.valueOf(0));
- c.put(Short.class, Integer.valueOf(1));
- c.put(Integer.class, Integer.valueOf(2));
- c.put(Float.class, Integer.valueOf(3));
- c.put(String.class, Integer.valueOf(4));
- c.put(ItemStack.class, Integer.valueOf(5));
- c.put(ChunkCoordinates.class, Integer.valueOf(6));
- }
-}
\ No newline at end of file
diff --git a/src/me/confuser/barapi/nms/legacy/PacketDataSerializerLegacy.java b/src/me/confuser/barapi/nms/legacy/PacketDataSerializerLegacy.java
deleted file mode 100644
index 52ab166..0000000
--- a/src/me/confuser/barapi/nms/legacy/PacketDataSerializerLegacy.java
+++ /dev/null
@@ -1,738 +0,0 @@
-package me.confuser.barapi.nms.legacy;
-
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.OutputStream;
-import java.nio.ByteBuffer;
-import java.nio.ByteOrder;
-import java.nio.channels.GatheringByteChannel;
-import java.nio.channels.ScatteringByteChannel;
-import java.nio.charset.Charset;
-
-import net.minecraft.server.v1_7_R4.Item;
-import net.minecraft.server.v1_7_R4.ItemStack;
-import net.minecraft.server.v1_7_R4.NBTCompressedStreamTools;
-import net.minecraft.server.v1_7_R4.NBTReadLimiter;
-import net.minecraft.server.v1_7_R4.NBTTagCompound;
-import net.minecraft.util.com.google.common.base.Charsets;
-import net.minecraft.util.io.netty.buffer.ByteBuf;
-import net.minecraft.util.io.netty.buffer.ByteBufAllocator;
-import net.minecraft.util.io.netty.buffer.ByteBufProcessor;
-
-public class PacketDataSerializerLegacy extends ByteBuf {
-
- private final ByteBuf a;
-
- public PacketDataSerializerLegacy(ByteBuf bytebuf) {
- this.a = bytebuf;
- }
-
- public static int a(int i) {
- return (i & -128) == 0 ? 1 : ((i & -16384) == 0 ? 2 : ((i & -2097152) == 0 ? 3 : ((i & -268435456) == 0 ? 4 : 5)));
- }
-
- public int a() {
- int i = 0;
- int j = 0;
-
- byte b0;
-
- do {
- b0 = this.readByte();
- i |= (b0 & 127) << j++ * 7;
- if (j > 5) {
- throw new RuntimeException("VarInt too big");
- }
- } while ((b0 & 128) == 128);
-
- return i;
- }
-
- public void b(int i) {
- while ((i & -128) != 0) {
- this.writeByte(i & 127 | 128);
- i >>>= 7;
- }
-
- this.writeByte(i);
- }
-
- public void a(NBTTagCompound nbttagcompound) {
- if (nbttagcompound == null) {
- this.writeShort(-1);
- } else {
- byte[] abyte = NBTCompressedStreamTools.a(nbttagcompound);
-
- this.writeShort((short) abyte.length);
- this.writeBytes(abyte);
- }
- }
-
- public NBTTagCompound b() {
- short short1 = this.readShort();
-
- if (short1 < 0) {
- return null;
- } else {
- byte[] abyte = new byte[short1];
-
- this.readBytes(abyte);
- return NBTCompressedStreamTools.a(abyte, new NBTReadLimiter(2097152L));
- }
- }
-
- public void a(ItemStack itemstack) {
- if (itemstack == null) {
- this.writeShort(-1);
- } else {
- this.writeShort(Item.getId(itemstack.getItem()));
- this.writeByte(itemstack.count);
- this.writeShort(itemstack.getData());
- NBTTagCompound nbttagcompound = null;
-
- if (itemstack.getItem().usesDurability() || itemstack.getItem().s()) {
- nbttagcompound = itemstack.tag;
- }
-
- this.a(nbttagcompound);
- }
- }
-
- public ItemStack c() {
- ItemStack itemstack = null;
- short short1 = this.readShort();
-
- if (short1 >= 0) {
- byte b0 = this.readByte();
- short short2 = this.readShort();
-
- itemstack = new ItemStack(Item.getById(short1), b0, short2);
- itemstack.tag = this.b();
- }
-
- return itemstack;
- }
-
- public String c(int i) throws IOException {
- int j = this.a();
-
- if (j > i * 4) {
- throw new IOException("The received encoded string buffer length is longer than maximum allowed (" + j + " > " + i * 4 + ")");
- } else if (j < 0) {
- throw new IOException("The received encoded string buffer length is less than zero! Weird string!");
- } else {
- String s = new String(this.readBytes(j).array(), Charsets.UTF_8);
-
- if (s.length() > i) {
- throw new IOException("The received string length is longer than maximum allowed (" + j + " > " + i + ")");
- } else {
- return s;
- }
- }
- }
-
- public void a(String s) throws IOException {
- byte[] abyte = s.getBytes(Charsets.UTF_8);
-
- if (abyte.length > 32767) {
- throw new IOException("String too big (was " + s.length() + " bytes encoded, max " + 32767 + ")");
- } else {
- this.b(abyte.length);
- this.writeBytes(abyte);
- }
- }
-
- public int capacity() {
- return this.a.capacity();
- }
-
- public ByteBuf capacity(int i) {
- return this.a.capacity(i);
- }
-
- public int maxCapacity() {
- return this.a.maxCapacity();
- }
-
- public ByteBufAllocator alloc() {
- return this.a.alloc();
- }
-
- public ByteOrder order() {
- return this.a.order();
- }
-
- public ByteBuf order(ByteOrder byteorder) {
- return this.a.order(byteorder);
- }
-
- public ByteBuf unwrap() {
- return this.a.unwrap();
- }
-
- public boolean isDirect() {
- return this.a.isDirect();
- }
-
- public int readerIndex() {
- return this.a.readerIndex();
- }
-
- public ByteBuf readerIndex(int i) {
- return this.a.readerIndex(i);
- }
-
- public int writerIndex() {
- return this.a.writerIndex();
- }
-
- public ByteBuf writerIndex(int i) {
- return this.a.writerIndex(i);
- }
-
- public ByteBuf setIndex(int i, int j) {
- return this.a.setIndex(i, j);
- }
-
- public int readableBytes() {
- return this.a.readableBytes();
- }
-
- public int writableBytes() {
- return this.a.writableBytes();
- }
-
- public int maxWritableBytes() {
- return this.a.maxWritableBytes();
- }
-
- public boolean isReadable() {
- return this.a.isReadable();
- }
-
- public boolean isReadable(int i) {
- return this.a.isReadable(i);
- }
-
- public boolean isWritable() {
- return this.a.isWritable();
- }
-
- public boolean isWritable(int i) {
- return this.a.isWritable(i);
- }
-
- public ByteBuf clear() {
- return this.a.clear();
- }
-
- public ByteBuf markReaderIndex() {
- return this.a.markReaderIndex();
- }
-
- public ByteBuf resetReaderIndex() {
- return this.a.resetReaderIndex();
- }
-
- public ByteBuf markWriterIndex() {
- return this.a.markWriterIndex();
- }
-
- public ByteBuf resetWriterIndex() {
- return this.a.resetWriterIndex();
- }
-
- public ByteBuf discardReadBytes() {
- return this.a.discardReadBytes();
- }
-
- public ByteBuf discardSomeReadBytes() {
- return this.a.discardSomeReadBytes();
- }
-
- public ByteBuf ensureWritable(int i) {
- return this.a.ensureWritable(i);
- }
-
- public int ensureWritable(int i, boolean flag) {
- return this.a.ensureWritable(i, flag);
- }
-
- public boolean getBoolean(int i) {
- return this.a.getBoolean(i);
- }
-
- public byte getByte(int i) {
- return this.a.getByte(i);
- }
-
- public short getUnsignedByte(int i) {
- return this.a.getUnsignedByte(i);
- }
-
- public short getShort(int i) {
- return this.a.getShort(i);
- }
-
- public int getUnsignedShort(int i) {
- return this.a.getUnsignedShort(i);
- }
-
- public int getMedium(int i) {
- return this.a.getMedium(i);
- }
-
- public int getUnsignedMedium(int i) {
- return this.a.getUnsignedMedium(i);
- }
-
- public int getInt(int i) {
- return this.a.getInt(i);
- }
-
- public long getUnsignedInt(int i) {
- return this.a.getUnsignedInt(i);
- }
-
- public long getLong(int i) {
- return this.a.getLong(i);
- }
-
- public char getChar(int i) {
- return this.a.getChar(i);
- }
-
- public float getFloat(int i) {
- return this.a.getFloat(i);
- }
-
- public double getDouble(int i) {
- return this.a.getDouble(i);
- }
-
- public ByteBuf getBytes(int i, ByteBuf bytebuf) {
- return this.a.getBytes(i, bytebuf);
- }
-
- public ByteBuf getBytes(int i, ByteBuf bytebuf, int j) {
- return this.a.getBytes(i, bytebuf, j);
- }
-
- public ByteBuf getBytes(int i, ByteBuf bytebuf, int j, int k) {
- return this.a.getBytes(i, bytebuf, j, k);
- }
-
- public ByteBuf getBytes(int i, byte[] abyte) {
- return this.a.getBytes(i, abyte);
- }
-
- public ByteBuf getBytes(int i, byte[] abyte, int j, int k) {
- return this.a.getBytes(i, abyte, j, k);
- }
-
- public ByteBuf getBytes(int i, ByteBuffer bytebuffer) {
- return this.a.getBytes(i, bytebuffer);
- }
-
- public ByteBuf getBytes(int i, OutputStream outputstream, int j) {
- try {
- return this.a.getBytes(i, outputstream, j);
- } catch (IOException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
-
- return null;
- }
-
- public int getBytes(int i, GatheringByteChannel gatheringbytechannel, int j) {
- try {
- return this.a.getBytes(i, gatheringbytechannel, j);
- } catch (IOException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
-
- return 0;
- }
-
- public ByteBuf setBoolean(int i, boolean flag) {
- return this.a.setBoolean(i, flag);
- }
-
- public ByteBuf setByte(int i, int j) {
- return this.a.setByte(i, j);
- }
-
- public ByteBuf setShort(int i, int j) {
- return this.a.setShort(i, j);
- }
-
- public ByteBuf setMedium(int i, int j) {
- return this.a.setMedium(i, j);
- }
-
- public ByteBuf setInt(int i, int j) {
- return this.a.setInt(i, j);
- }
-
- public ByteBuf setLong(int i, long j) {
- return this.a.setLong(i, j);
- }
-
- public ByteBuf setChar(int i, int j) {
- return this.a.setChar(i, j);
- }
-
- public ByteBuf setFloat(int i, float f) {
- return this.a.setFloat(i, f);
- }
-
- public ByteBuf setDouble(int i, double d0) {
- return this.a.setDouble(i, d0);
- }
-
- public ByteBuf setBytes(int i, ByteBuf bytebuf) {
- return this.a.setBytes(i, bytebuf);
- }
-
- public ByteBuf setBytes(int i, ByteBuf bytebuf, int j) {
- return this.a.setBytes(i, bytebuf, j);
- }
-
- public ByteBuf setBytes(int i, ByteBuf bytebuf, int j, int k) {
- return this.a.setBytes(i, bytebuf, j, k);
- }
-
- public ByteBuf setBytes(int i, byte[] abyte) {
- return this.a.setBytes(i, abyte);
- }
-
- public ByteBuf setBytes(int i, byte[] abyte, int j, int k) {
- return this.a.setBytes(i, abyte, j, k);
- }
-
- public ByteBuf setBytes(int i, ByteBuffer bytebuffer) {
- return this.a.setBytes(i, bytebuffer);
- }
-
- public int setBytes(int i, InputStream inputstream, int j) throws IOException {
- return this.a.setBytes(i, inputstream, j);
- }
-
- public int setBytes(int i, ScatteringByteChannel scatteringbytechannel, int j) throws IOException {
- return this.a.setBytes(i, scatteringbytechannel, j);
- }
-
- public ByteBuf setZero(int i, int j) {
- return this.a.setZero(i, j);
- }
-
- public boolean readBoolean() {
- return this.a.readBoolean();
- }
-
- public byte readByte() {
- return this.a.readByte();
- }
-
- public short readUnsignedByte() {
- return this.a.readUnsignedByte();
- }
-
- public short readShort() {
- return this.a.readShort();
- }
-
- public int readUnsignedShort() {
- return this.a.readUnsignedShort();
- }
-
- public int readMedium() {
- return this.a.readMedium();
- }
-
- public int readUnsignedMedium() {
- return this.a.readUnsignedMedium();
- }
-
- public int readInt() {
- return this.a.readInt();
- }
-
- public long readUnsignedInt() {
- return this.a.readUnsignedInt();
- }
-
- public long readLong() {
- return this.a.readLong();
- }
-
- public char readChar() {
- return this.a.readChar();
- }
-
- public float readFloat() {
- return this.a.readFloat();
- }
-
- public double readDouble() {
- return this.a.readDouble();
- }
-
- public ByteBuf readBytes(int i) {
- return this.a.readBytes(i);
- }
-
- public ByteBuf readSlice(int i) {
- return this.a.readSlice(i);
- }
-
- public ByteBuf readBytes(ByteBuf bytebuf) {
- return this.a.readBytes(bytebuf);
- }
-
- public ByteBuf readBytes(ByteBuf bytebuf, int i) {
- return this.a.readBytes(bytebuf, i);
- }
-
- public ByteBuf readBytes(ByteBuf bytebuf, int i, int j) {
- return this.a.readBytes(bytebuf, i, j);
- }
-
- public ByteBuf readBytes(byte[] abyte) {
- return this.a.readBytes(abyte);
- }
-
- public ByteBuf readBytes(byte[] abyte, int i, int j) {
- return this.a.readBytes(abyte, i, j);
- }
-
- public ByteBuf readBytes(ByteBuffer bytebuffer) {
- return this.a.readBytes(bytebuffer);
- }
-
- public ByteBuf readBytes(OutputStream outputstream, int i) throws IOException {
- return this.a.readBytes(outputstream, i);
- }
-
- public int readBytes(GatheringByteChannel gatheringbytechannel, int i) throws IOException {
- return this.a.readBytes(gatheringbytechannel, i);
- }
-
- public ByteBuf skipBytes(int i) {
- return this.a.skipBytes(i);
- }
-
- public ByteBuf writeBoolean(boolean flag) {
- return this.a.writeBoolean(flag);
- }
-
- public ByteBuf writeByte(int i) {
- return this.a.writeByte(i);
- }
-
- public ByteBuf writeShort(int i) {
- return this.a.writeShort(i);
- }
-
- public ByteBuf writeMedium(int i) {
- return this.a.writeMedium(i);
- }
-
- public ByteBuf writeInt(int i) {
- return this.a.writeInt(i);
- }
-
- public ByteBuf writeLong(long i) {
- return this.a.writeLong(i);
- }
-
- public ByteBuf writeChar(int i) {
- return this.a.writeChar(i);
- }
-
- public ByteBuf writeFloat(float f) {
- return this.a.writeFloat(f);
- }
-
- public ByteBuf writeDouble(double d0) {
- return this.a.writeDouble(d0);
- }
-
- public ByteBuf writeBytes(ByteBuf bytebuf) {
- return this.a.writeBytes(bytebuf);
- }
-
- public ByteBuf writeBytes(ByteBuf bytebuf, int i) {
- return this.a.writeBytes(bytebuf, i);
- }
-
- public ByteBuf writeBytes(ByteBuf bytebuf, int i, int j) {
- return this.a.writeBytes(bytebuf, i, j);
- }
-
- public ByteBuf writeBytes(byte[] abyte) {
- return this.a.writeBytes(abyte);
- }
-
- public ByteBuf writeBytes(byte[] abyte, int i, int j) {
- return this.a.writeBytes(abyte, i, j);
- }
-
- public ByteBuf writeBytes(ByteBuffer bytebuffer) {
- return this.a.writeBytes(bytebuffer);
- }
-
- public int writeBytes(InputStream inputstream, int i) throws IOException {
- return this.a.writeBytes(inputstream, i);
- }
-
- public int writeBytes(ScatteringByteChannel scatteringbytechannel, int i) throws IOException {
- return this.a.writeBytes(scatteringbytechannel, i);
- }
-
- public ByteBuf writeZero(int i) {
- return this.a.writeZero(i);
- }
-
- public int indexOf(int i, int j, byte b0) {
- return this.a.indexOf(i, j, b0);
- }
-
- public int bytesBefore(byte b0) {
- return this.a.bytesBefore(b0);
- }
-
- public int bytesBefore(int i, byte b0) {
- return this.a.bytesBefore(i, b0);
- }
-
- public int bytesBefore(int i, int j, byte b0) {
- return this.a.bytesBefore(i, j, b0);
- }
-
- public int forEachByte(ByteBufProcessor bytebufprocessor) {
- return this.a.forEachByte(bytebufprocessor);
- }
-
- public int forEachByte(int i, int j, ByteBufProcessor bytebufprocessor) {
- return this.a.forEachByte(i, j, bytebufprocessor);
- }
-
- public int forEachByteDesc(ByteBufProcessor bytebufprocessor) {
- return this.a.forEachByteDesc(bytebufprocessor);
- }
-
- public int forEachByteDesc(int i, int j, ByteBufProcessor bytebufprocessor) {
- return this.a.forEachByteDesc(i, j, bytebufprocessor);
- }
-
- public ByteBuf copy() {
- return this.a.copy();
- }
-
- public ByteBuf copy(int i, int j) {
- return this.a.copy(i, j);
- }
-
- public ByteBuf slice() {
- return this.a.slice();
- }
-
- public ByteBuf slice(int i, int j) {
- return this.a.slice(i, j);
- }
-
- public ByteBuf duplicate() {
- return this.a.duplicate();
- }
-
- public int nioBufferCount() {
- return this.a.nioBufferCount();
- }
-
- public ByteBuffer nioBuffer() {
- return this.a.nioBuffer();
- }
-
- public ByteBuffer nioBuffer(int i, int j) {
- return this.a.nioBuffer(i, j);
- }
-
- public ByteBuffer internalNioBuffer(int i, int j) {
- return this.a.internalNioBuffer(i, j);
- }
-
- public ByteBuffer[] nioBuffers() {
- return this.a.nioBuffers();
- }
-
- public ByteBuffer[] nioBuffers(int i, int j) {
- return this.a.nioBuffers(i, j);
- }
-
- public boolean hasArray() {
- return this.a.hasArray();
- }
-
- public byte[] array() {
- return this.a.array();
- }
-
- public int arrayOffset() {
- return this.a.arrayOffset();
- }
-
- public boolean hasMemoryAddress() {
- return this.a.hasMemoryAddress();
- }
-
- public long memoryAddress() {
- return this.a.memoryAddress();
- }
-
- public String toString(Charset charset) {
- return this.a.toString(charset);
- }
-
- public String toString(int i, int j, Charset charset) {
- return this.a.toString(i, j, charset);
- }
-
- public int hashCode() {
- return this.a.hashCode();
- }
-
- public boolean equals(Object object) {
- return this.a.equals(object);
- }
-
- public int compareTo(ByteBuf bytebuf) {
- return this.a.compareTo(bytebuf);
- }
-
- public String toString() {
- return this.a.toString();
- }
-
- public ByteBuf retain(int i) {
- return this.a.retain(i);
- }
-
- public ByteBuf retain() {
- return this.a.retain();
- }
-
- public int refCnt() {
- return this.a.refCnt();
- }
-
- public boolean release() {
- return this.a.release();
- }
-
- public boolean release(int i) {
- return this.a.release(i);
- }
-}
\ No newline at end of file
diff --git a/src/me/confuser/barapi/nms/legacy/PacketPlayOutEntityMetadataLegacy.java b/src/me/confuser/barapi/nms/legacy/PacketPlayOutEntityMetadataLegacy.java
deleted file mode 100644
index 7c0ee6c..0000000
--- a/src/me/confuser/barapi/nms/legacy/PacketPlayOutEntityMetadataLegacy.java
+++ /dev/null
@@ -1,42 +0,0 @@
-package me.confuser.barapi.nms.legacy;
-
-import java.util.List;
-
-import net.minecraft.server.v1_7_R4.DataWatcher;
-import net.minecraft.server.v1_7_R4.PacketDataSerializer;
-import net.minecraft.server.v1_7_R4.PacketListener;
-import net.minecraft.server.v1_7_R4.PacketPlayOutEntityMetadata;
-import net.minecraft.server.v1_7_R4.PacketPlayOutListener;
-
-public class PacketPlayOutEntityMetadataLegacy extends PacketPlayOutEntityMetadata {
-
- private int a;
- private List b;
-
- public PacketPlayOutEntityMetadataLegacy(int i, DataWatcherLegacy datawatcher, boolean flag) {
- this.a = i;
- if (flag) {
- this.b = datawatcher.c();
- } else {
- this.b = datawatcher.b();
- }
- }
-
- public void a(PacketDataSerializerLegacy packetdataserializer) {
- this.a = packetdataserializer.readInt();
- this.b = DataWatcherLegacy.b(packetdataserializer);
- }
-
- public void b(PacketDataSerializerLegacy packetdataserializer) {
- packetdataserializer.writeInt(this.a);
- DataWatcherLegacy.a(this.b, packetdataserializer);
- }
-
- public void a(PacketPlayOutListener packetplayoutlistener) {
- packetplayoutlistener.a(this);
- }
-
- public void handle(PacketListener packetlistener) {
- this.a((PacketPlayOutListener) packetlistener);
- }
-}
diff --git a/src/me/confuser/barapi/nms/legacy/PacketPlayOutEntityTeleportLegacy.java b/src/me/confuser/barapi/nms/legacy/PacketPlayOutEntityTeleportLegacy.java
deleted file mode 100644
index c125c53..0000000
--- a/src/me/confuser/barapi/nms/legacy/PacketPlayOutEntityTeleportLegacy.java
+++ /dev/null
@@ -1,78 +0,0 @@
-package me.confuser.barapi.nms.legacy;
-
-import net.minecraft.server.v1_7_R4.Entity;
-import net.minecraft.server.v1_7_R4.MathHelper;
-import net.minecraft.server.v1_7_R4.PacketDataSerializer;
-import net.minecraft.server.v1_7_R4.PacketListener;
-import net.minecraft.server.v1_7_R4.PacketPlayOutEntityTeleport;
-import net.minecraft.server.v1_7_R4.PacketPlayOutListener;
-
-public class PacketPlayOutEntityTeleportLegacy extends PacketPlayOutEntityTeleport {
-
- private int a;
- private int b;
- private int c;
- private int d;
- private byte e;
- private byte f;
-
- public PacketPlayOutEntityTeleportLegacy() {}
-
- public PacketPlayOutEntityTeleportLegacy(Entity entity) {
- this.a = entity.getId();
- this.b = MathHelper.floor(entity.locX * 32.0D);
- this.c = MathHelper.floor(entity.locY * 32.0D);
- this.d = MathHelper.floor(entity.locZ * 32.0D);
- this.e = (byte) ((int) (entity.yaw * 256.0F / 360.0F));
- this.f = (byte) ((int) (entity.pitch * 256.0F / 360.0F));
- }
-
- public PacketPlayOutEntityTeleportLegacy(int i, int j, int k, int l, byte b0, byte b1) {
- this.a = i;
- this.b = j;
- this.c = k;
- this.d = l;
- this.e = b0;
- this.f = b1;
- }
-
- public void a(PacketDataSerializer packetdataserializer) {
- this.a = packetdataserializer.readInt();
- this.b = packetdataserializer.readInt();
- this.c = packetdataserializer.readInt();
- this.d = packetdataserializer.readInt();
- this.e = packetdataserializer.readByte();
- this.f = packetdataserializer.readByte();
- }
-
- public void b(PacketDataSerializer packetdataserializer) {
- // Spigot start - protocol
- if ( packetdataserializer.version < 16 ){
- packetdataserializer.writeInt( this.a );
- } else{
- packetdataserializer.b( a );
- }
- // Spigot end
-
- packetdataserializer.writeInt(this.a);
- packetdataserializer.writeInt(this.b);
- packetdataserializer.writeInt(this.c);
- packetdataserializer.writeInt(this.d);
- packetdataserializer.writeByte(this.e);
- packetdataserializer.writeByte(this.f);
-
- // Spigot start - protocol patch
- /*if ( packetdataserializer.version >= 22 ) {
- packetdataserializer.writeBoolean( onGround );
- }*/
- // Spigot end
- }
-
- public void a(PacketPlayOutListener packetplayoutlistener) {
- packetplayoutlistener.a(this);
- }
-
- public void handle(PacketListener packetlistener) {
- this.a((PacketPlayOutListener) packetlistener);
- }
-}
diff --git a/src/me/confuser/barapi/nms/legacy/PacketPlayOutMetadataLegacy.java b/src/me/confuser/barapi/nms/legacy/PacketPlayOutMetadataLegacy.java
deleted file mode 100644
index 4cb65d9..0000000
--- a/src/me/confuser/barapi/nms/legacy/PacketPlayOutMetadataLegacy.java
+++ /dev/null
@@ -1,64 +0,0 @@
-package me.confuser.barapi.nms.legacy;
-
-import net.minecraft.server.v1_7_R4.Entity;
-import net.minecraft.server.v1_7_R4.MathHelper;
-import net.minecraft.server.v1_7_R4.PacketDataSerializer;
-import net.minecraft.server.v1_7_R4.PacketListener;
-import net.minecraft.server.v1_7_R4.PacketPlayOutEntityTeleport;
-import net.minecraft.server.v1_7_R4.PacketPlayOutListener;
-
-public class PacketPlayOutMetadataLegacy extends PacketPlayOutEntityTeleport {
-
- private int a;
- private int b;
- private int c;
- private int d;
- private byte e;
- private byte f;
-
- public PacketPlayOutMetadataLegacy() {}
-
- public PacketPlayOutMetadataLegacy(Entity entity) {
- this.a = entity.getId();
- this.b = MathHelper.floor(entity.locX * 32.0D);
- this.c = MathHelper.floor(entity.locY * 32.0D);
- this.d = MathHelper.floor(entity.locZ * 32.0D);
- this.e = (byte) ((int) (entity.yaw * 256.0F / 360.0F));
- this.f = (byte) ((int) (entity.pitch * 256.0F / 360.0F));
- }
-
- public PacketPlayOutMetadataLegacy(int i, int j, int k, int l, byte b0, byte b1) {
- this.a = i;
- this.b = j;
- this.c = k;
- this.d = l;
- this.e = b0;
- this.f = b1;
- }
-
- public void a(PacketDataSerializerLegacy packetdataserializer) {
- this.a = packetdataserializer.readInt();
- this.b = packetdataserializer.readInt();
- this.c = packetdataserializer.readInt();
- this.d = packetdataserializer.readInt();
- this.e = packetdataserializer.readByte();
- this.f = packetdataserializer.readByte();
- }
-
- public void b(PacketDataSerializerLegacy packetdataserializer) {
- packetdataserializer.writeInt(this.a);
- packetdataserializer.writeInt(this.b);
- packetdataserializer.writeInt(this.c);
- packetdataserializer.writeInt(this.d);
- packetdataserializer.writeByte(this.e);
- packetdataserializer.writeByte(this.f);
- }
-
- public void a(PacketPlayOutListener packetplayoutlistener) {
- packetplayoutlistener.a(this);
- }
-
- public void handle(PacketListener packetlistener) {
- this.a((PacketPlayOutListener) packetlistener);
- }
-}
diff --git a/src/me/confuser/barapi/nms/legacy/WatchableObjectLegacy.java b/src/me/confuser/barapi/nms/legacy/WatchableObjectLegacy.java
deleted file mode 100644
index 09f16bd..0000000
--- a/src/me/confuser/barapi/nms/legacy/WatchableObjectLegacy.java
+++ /dev/null
@@ -1,44 +0,0 @@
-package me.confuser.barapi.nms.legacy;
-
-public class WatchableObjectLegacy {
-
- private final int a;
- private final int b;
- private Object c;
- private boolean d;
-
- public WatchableObjectLegacy(int i, int j, Object object) {
- this.b = j;
- this.c = object;
- this.a = i;
- this.d = true;
- }
-
- public int a() {
- return this.b;
- }
-
- public void a(Object object) {
- this.c = object;
- }
-
- public Object b() {
- return this.c;
- }
-
- public int c() {
- return this.a;
- }
-
- public boolean d() {
- return this.d;
- }
-
- public void a(boolean flag) {
- this.d = flag;
- }
-
- static boolean a(WatchableObjectLegacy watchableobject, boolean flag) {
- return watchableobject.d = flag;
- }
-}
diff --git a/src/me/confuser/barapi/nms/v1_7.java b/src/me/confuser/barapi/nms/v1_7.java
index 3de71b5..dcea005 100644
--- a/src/me/confuser/barapi/nms/v1_7.java
+++ b/src/me/confuser/barapi/nms/v1_7.java
@@ -139,14 +139,14 @@ public Object getTeleportPacket(Location loc) {
try {
packet = PacketPlayOutEntityTeleport.getConstructor(new Class>[] {
- int.class, int.class, int.class, int.class, byte.class, byte.class, boolean.class })
+ int.class, int.class, int.class, int.class, byte.class, byte.class, boolean.class, boolean.class })
.newInstance(this.id,
loc.getBlockX() * 32,
loc.getBlockY() * 32,
loc.getBlockZ() * 32,
(byte) ((int) loc.getYaw() * 256 / 360),
(byte) ((int) loc.getPitch() * 256 / 360),
- (boolean)false);
+ false, false);
} catch (IllegalArgumentException e) {
e.printStackTrace();
diff --git a/src/me/confuser/barapi/nms/v1_8.java b/src/me/confuser/barapi/nms/v1_8.java
index c124f23..73cb73d 100644
--- a/src/me/confuser/barapi/nms/v1_8.java
+++ b/src/me/confuser/barapi/nms/v1_8.java
@@ -146,7 +146,7 @@ public Object getTeleportPacket(Location loc) {
loc.getBlockZ() * 32,
(byte) ((int) loc.getYaw() * 256 / 360),
(byte) ((int) loc.getPitch() * 256 / 360),
- (boolean)false);
+ false);
} catch (IllegalArgumentException e) {
e.printStackTrace();