Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
Maciej Mionskowski committed Apr 26, 2014
0 parents commit 5924dad
Show file tree
Hide file tree
Showing 11 changed files with 1,521 additions and 0 deletions.
16 changes: 16 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
.classpath
.project
.settings/
nbproject/
nbactions.xml
target/
build/
bin/
dist/
manifest.mf
.DS_Store/
*.iml
*.ipr
*.iws
.idea/
*.log*
674 changes: 674 additions & 0 deletions COPYING

Large diffs are not rendered by default.

3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
AntiAura (checkaura) is a simple plugin that allows you to check if someone has killaura.

It needs ProtocolLib as dependency.
58 changes: 58 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 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.1-SNAPSHOT</version>
<groupId>tk.maciekmm</groupId>
<name>AntiAura</name>
<description>Simple aura hack checker.</description>
<packaging>jar</packaging>

<properties>
<main.class>tk.maciekmm.antiaura.AntiAura</main.class>
</properties>

<repositories>
<repository>
<id>bukkit-repo</id>
<url>http://repo.bukkit.org/content/groups/public/</url>
</repository>
<repository>
<id>comphenix-rep</id>
<name>Comphenix Repository</name>
<url>http://repo.comphenix.net/content/groups/public</url>
</repository>
</repositories>

<dependencies>
<dependency>
<groupId>org.bukkit</groupId>
<artifactId>bukkit</artifactId>
<version>1.7.2-R0.3-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>com.comphenix.protocol</groupId>
<artifactId>ProtocolLib</artifactId>
<version>3.3.1</version>
</dependency>
</dependencies>

<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.0.2</version>
<configuration>
<source>7</source>
<target>7</target>
</configuration>
</plugin>
</plugins>
<resources>
<resource>
<filtering>true</filtering>
<directory>${basedir}/src/main/resources/</directory>
</resource>
</resources>
</build>
</project>
82 changes: 82 additions & 0 deletions src/main/java/com/comphenix/packetwrapper/AbstractPacket.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
/*
* 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);
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
/*
* 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;
import com.comphenix.protocol.wrappers.EnumWrappers.EntityUseAction;

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 the entity ID the player is interacting with.
* @return The current Target
*/
public int getTargetID() {
return handle.getIntegers().read(0);
}

/**
* Retrieve the entity the player is interacting with.
* @param event - the world this event occured in.
* @return The target entity.
*/
public Entity getTarget(World world) {
return handle.getEntityModifier(world).read(0);
}

/**
* Retrieve the entity the player is interacting with.
* @param event - the current packet event.
* @return The target entity.
*/
public Entity getTarget(PacketEvent event) {
return getTarget(event.getPlayer().getWorld());
}

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

/**
* Retrieve the use action.
* @return The action.
*/
public EntityUseAction getMouse() {
return handle.getEntityUseActions().read(0);
}

/**
* Set the use action.
* @param value - new action.
*/
public void setMouse(EntityUseAction value) {
handle.getEntityUseActions().write(0, value);
}
}


Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
/*
* 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 com.comphenix.protocol.PacketType;
import com.comphenix.protocol.events.PacketContainer;
import com.google.common.primitives.Ints;

public class WrapperPlayServerEntityDestroy extends AbstractPacket {
public static final PacketType TYPE = PacketType.Play.Server.ENTITY_DESTROY;

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

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

/**
* Retrieve the IDs of the entities that will be destroyed.
* @return The current entities.
*/
public List<Integer> getEntities() {
return Ints.asList(handle.getIntegerArrays().read(0));
}

/**
* Set the entities that will be destroyed.
* @param value - new value.
*/
public void setEntities(int[] entities) {
handle.getIntegerArrays().write(0, entities);
}

/**
* Set the entities that will be destroyed.
* @param value - new value.
*/
public void setEntities(List<Integer> entities) {
setEntities(Ints.toArray(entities));
}
}


Loading

0 comments on commit 5924dad

Please sign in to comment.