Skip to content

Commit

Permalink
Update to 1.9
Browse files Browse the repository at this point in the history
  • Loading branch information
Spirit55555 committed May 26, 2016
1 parent 2778c15 commit 1a30975
Show file tree
Hide file tree
Showing 10 changed files with 639 additions and 474 deletions.
26 changes: 13 additions & 13 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,39 +2,39 @@
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<artifactId>antiaura</artifactId>
<version>0.3-SNAPSHOT</version>
<version>0.4-SNAPSHOT</version>
<groupId>tk.maciekmm</groupId>
<name>AntiAura</name>
<description>Simple aura hack checker.</description>
<url>http://maciekmm.net</url>
<packaging>jar</packaging>

<properties>
<main.class>tk.maciekmm.antiaura.AntiAura</main.class>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
</properties>

<repositories>
<repository>
<id>spigot-repo</id>
<url>https://hub.spigotmc.org/nexus/content/groups/public/</url>
<url>https://hub.spigotmc.org/nexus/content/repositories/snapshots/</url>
</repository>
<repository>
<id>shadowvolt-repo</id>
<url>http://ci.shadowvolt.com/plugin/repository/everything/</url>
<id>dmulloy2-repo</id>
<url>http://repo.dmulloy2.net/content/groups/public/</url>
</repository>
</repositories>

<dependencies>
<dependency>
<groupId>org.bukkit</groupId>
<artifactId>bukkit</artifactId>
<version>1.8-R0.1-SNAPSHOT</version>
<groupId>org.spigotmc</groupId>
<artifactId>spigot-api</artifactId>
<version>1.9-R0.1-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>com.comphenix.protocol</groupId>
<artifactId>ProtocolLib</artifactId>
<version>3.6.3-SNAPSHOT</version>
</dependency>
<artifactId>ProtocolLib-API</artifactId>
<version>4.0</version>
</dependency>
</dependencies>

<build>
Expand Down
71 changes: 47 additions & 24 deletions src/main/java/com/comphenix/packetwrapper/AbstractPacket.java
Original file line number Diff line number Diff line change
@@ -1,37 +1,37 @@
/*
* PacketWrapper - Contains wrappers for each packet in Minecraft.
* Copyright (C) 2012 Kristian S. Stangeland
/**
* PacketWrapper - ProtocolLib wrappers for Minecraft packets
* Copyright (C) dmulloy2 <http://dmulloy2.net>
* Copyright (C) Kristian S. Strangeland
*
* 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 free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 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.
* 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
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/

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;
import java.lang.reflect.InvocationTargetException;
import org.bukkit.entity.Player;

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.
*/
Expand All @@ -40,41 +40,64 @@ protected AbstractPacket(PacketContainer handle, PacketType type) {
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);
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());
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.
* @deprecated Misspelled. recieve -> receive
* @see #receivePacket(Player)
*/
@Deprecated
public void recievePacket(Player sender) {
try {
ProtocolLibrary.getProtocolManager().recieveClientPacket(sender, getHandle());
ProtocolLibrary.getProtocolManager().recieveClientPacket(sender,
getHandle());
} catch (Exception e) {
throw new RuntimeException("Cannot recieve 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 receivePacket(Player sender) {
try {
ProtocolLibrary.getProtocolManager().recieveClientPacket(sender,
getHandle());
} catch (Exception e) {
throw new RuntimeException("Cannot recieve packet.", e);
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,63 +1,116 @@
/**
* PacketWrapper - ProtocolLib wrappers for Minecraft packets
* Copyright (C) dmulloy2 <http://dmulloy2.net>
* Copyright (C) Kristian S. Strangeland
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 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, see <http://www.gnu.org/licenses/>.
*/
package com.comphenix.packetwrapper;

import org.bukkit.util.Vector;

import com.comphenix.protocol.PacketType;
import com.comphenix.protocol.events.PacketContainer;
import com.comphenix.protocol.events.PacketEvent;
import com.comphenix.protocol.wrappers.EnumWrappers.EntityUseAction;
import org.bukkit.World;
import org.bukkit.entity.Entity;
import org.bukkit.util.Vector;

public class WrapperPlayClientUseEntity extends AbstractPacket {
public static final PacketType TYPE = PacketType.Play.Client.USE_ENTITY;

public WrapperPlayClientUseEntity() {
super(new PacketContainer(TYPE), TYPE);
handle.getModifier().writeDefaults();
}

public WrapperPlayClientUseEntity(PacketContainer packet) {
super(packet, TYPE);
}

/**
* Retrieve Target.
* @return The current Target
*/
public int getTarget() {
return handle.getIntegers().read(0);
}

/**
* Set Target.
* @param value - new value.
*/
public void setTarget(int value) {
handle.getIntegers().write(0, value);
}

/**
* Retrieve Type.
* <p>
* Notes: 0 = INTERACT, 1 = ATTACK, 2 = INTERACT_AT
* @return The current Type
*/
public EntityUseAction getType() {
return handle.getEntityUseActions().read(0);
}

/**
* Set Type.
* @param value - new value.
*/
public void setType(EntityUseAction value) {
handle.getEntityUseActions().write(0, value);
}

public Vector getTargetVector() {
return handle.getVectors().read(0);
}

public void setTargetVector(Vector value) {
handle.getVectors().write(0, value);
}

}
public static final PacketType TYPE = PacketType.Play.Client.USE_ENTITY;

public WrapperPlayClientUseEntity() {
super(new PacketContainer(TYPE), TYPE);
handle.getModifier().writeDefaults();
}

public WrapperPlayClientUseEntity(PacketContainer packet) {
super(packet, TYPE);
}

/**
* Retrieve entity ID of the target.
*
* @return The current entity ID
*/
public int getTargetID() {
return handle.getIntegers().read(0);
}

/**
* Retrieve the entity that was targeted.
*
* @param world - the current world of the entity.
* @return The targeted entity.
*/
public Entity getTarget(World world) {
return handle.getEntityModifier(world).read(0);
}

/**
* Retrieve the entity that was targeted.
*
* @param event - the packet event.
* @return The targeted entity.
*/
public Entity getTarget(PacketEvent event) {
return getTarget(event.getPlayer().getWorld());
}

/**
* Set entity ID of the target.
*
* @param value - new value.
*/
public void setTargetID(int value) {
handle.getIntegers().write(0, value);
}

/**
* Retrieve Type.
*
* @return The current Type
*/
public EntityUseAction getType() {
return handle.getEntityUseActions().read(0);
}

/**
* Set Type.
*
* @param value - new value.
*/
public void setType(EntityUseAction value) {
handle.getEntityUseActions().write(0, value);
}

/**
* Retrieve the target vector.
* <p>
* Notes: Only if {@link #getType()} is {@link EntityUseAction#INTERACT_AT}.
*
* @return The target vector or null
*/
public Vector getTargetVector() {
return handle.getVectors().read(0);
}

/**
* Set the target vector.
*
* @param value - new value.
*/
public void setTargetVector(Vector value) {
handle.getVectors().write(0, value);
}
}
Loading

0 comments on commit 1a30975

Please sign in to comment.