Skip to content

Commit 5924dad

Browse files
author
Maciej Mionskowski
committed
Initial commit
0 parents  commit 5924dad

11 files changed

+1521
-0
lines changed

.gitignore

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
.classpath
2+
.project
3+
.settings/
4+
nbproject/
5+
nbactions.xml
6+
target/
7+
build/
8+
bin/
9+
dist/
10+
manifest.mf
11+
.DS_Store/
12+
*.iml
13+
*.ipr
14+
*.iws
15+
.idea/
16+
*.log*

COPYING

+674
Large diffs are not rendered by default.

README.md

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
AntiAura (checkaura) is a simple plugin that allows you to check if someone has killaura.
2+
3+
It needs ProtocolLib as dependency.

pom.xml

+58
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
<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">
2+
<modelVersion>4.0.0</modelVersion>
3+
<artifactId>antiaura</artifactId>
4+
<version>0.1-SNAPSHOT</version>
5+
<groupId>tk.maciekmm</groupId>
6+
<name>AntiAura</name>
7+
<description>Simple aura hack checker.</description>
8+
<packaging>jar</packaging>
9+
10+
<properties>
11+
<main.class>tk.maciekmm.antiaura.AntiAura</main.class>
12+
</properties>
13+
14+
<repositories>
15+
<repository>
16+
<id>bukkit-repo</id>
17+
<url>http://repo.bukkit.org/content/groups/public/</url>
18+
</repository>
19+
<repository>
20+
<id>comphenix-rep</id>
21+
<name>Comphenix Repository</name>
22+
<url>http://repo.comphenix.net/content/groups/public</url>
23+
</repository>
24+
</repositories>
25+
26+
<dependencies>
27+
<dependency>
28+
<groupId>org.bukkit</groupId>
29+
<artifactId>bukkit</artifactId>
30+
<version>1.7.2-R0.3-SNAPSHOT</version>
31+
</dependency>
32+
<dependency>
33+
<groupId>com.comphenix.protocol</groupId>
34+
<artifactId>ProtocolLib</artifactId>
35+
<version>3.3.1</version>
36+
</dependency>
37+
</dependencies>
38+
39+
<build>
40+
<plugins>
41+
<plugin>
42+
<groupId>org.apache.maven.plugins</groupId>
43+
<artifactId>maven-compiler-plugin</artifactId>
44+
<version>2.0.2</version>
45+
<configuration>
46+
<source>7</source>
47+
<target>7</target>
48+
</configuration>
49+
</plugin>
50+
</plugins>
51+
<resources>
52+
<resource>
53+
<filtering>true</filtering>
54+
<directory>${basedir}/src/main/resources/</directory>
55+
</resource>
56+
</resources>
57+
</build>
58+
</project>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
1+
/*
2+
* PacketWrapper - Contains wrappers for each packet in Minecraft.
3+
* Copyright (C) 2012 Kristian S. Stangeland
4+
*
5+
* This program is free software; you can redistribute it and/or modify it under the terms of the
6+
* GNU Lesser General Public License as published by the Free Software Foundation; either version 2 of
7+
* the License, or (at your option) any later version.
8+
*
9+
* This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
10+
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
11+
* See the GNU General Public License for more details.
12+
*
13+
* You should have received a copy of the GNU General Public License along with this program;
14+
* if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
15+
* 02111-1307 USA
16+
*/
17+
18+
package com.comphenix.packetwrapper;
19+
20+
import java.lang.reflect.InvocationTargetException;
21+
22+
import org.bukkit.entity.Player;
23+
24+
import com.comphenix.protocol.PacketType;
25+
import com.comphenix.protocol.ProtocolLibrary;
26+
import com.comphenix.protocol.events.PacketContainer;
27+
import com.google.common.base.Objects;
28+
29+
public abstract class AbstractPacket {
30+
// The packet we will be modifying
31+
protected PacketContainer handle;
32+
33+
/**
34+
* Constructs a new strongly typed wrapper for the given packet.
35+
* @param handle - handle to the raw packet data.
36+
* @param type - the packet type.
37+
*/
38+
protected AbstractPacket(PacketContainer handle, PacketType type) {
39+
// Make sure we're given a valid packet
40+
if (handle == null)
41+
throw new IllegalArgumentException("Packet handle cannot be NULL.");
42+
if (!Objects.equal(handle.getType(), type))
43+
throw new IllegalArgumentException(
44+
handle.getHandle() + " is not a packet of type " + type);
45+
46+
this.handle = handle;
47+
}
48+
49+
/**
50+
* Retrieve a handle to the raw packet data.
51+
* @return Raw packet data.
52+
*/
53+
public PacketContainer getHandle() {
54+
return handle;
55+
}
56+
57+
/**
58+
* Send the current packet to the given receiver.
59+
* @param receiver - the receiver.
60+
* @throws RuntimeException If the packet cannot be sent.
61+
*/
62+
public void sendPacket(Player receiver) {
63+
try {
64+
ProtocolLibrary.getProtocolManager().sendServerPacket(receiver, getHandle());
65+
} catch (InvocationTargetException e) {
66+
throw new RuntimeException("Cannot send packet.", e);
67+
}
68+
}
69+
70+
/**
71+
* Simulate receiving the current packet from the given sender.
72+
* @param sender - the sender.
73+
* @throws RuntimeException If the packet cannot be received.
74+
*/
75+
public void recievePacket(Player sender) {
76+
try {
77+
ProtocolLibrary.getProtocolManager().recieveClientPacket(sender, getHandle());
78+
} catch (Exception e) {
79+
throw new RuntimeException("Cannot recieve packet.", e);
80+
}
81+
}
82+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,91 @@
1+
/*
2+
* PacketWrapper - Contains wrappers for each packet in Minecraft.
3+
* Copyright (C) 2012 Kristian S. Stangeland
4+
*
5+
* This program is free software; you can redistribute it and/or modify it under the terms of the
6+
* GNU Lesser General Public License as published by the Free Software Foundation; either version 2 of
7+
* the License, or (at your option) any later version.
8+
*
9+
* This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
10+
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
11+
* See the GNU General Public License for more details.
12+
*
13+
* You should have received a copy of the GNU General Public License along with this program;
14+
* if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
15+
* 02111-1307 USA
16+
*/
17+
18+
package com.comphenix.packetwrapper;
19+
20+
import org.bukkit.World;
21+
import org.bukkit.entity.Entity;
22+
23+
import com.comphenix.protocol.PacketType;
24+
import com.comphenix.protocol.events.PacketContainer;
25+
import com.comphenix.protocol.events.PacketEvent;
26+
import com.comphenix.protocol.wrappers.EnumWrappers.EntityUseAction;
27+
28+
public class WrapperPlayClientUseEntity extends AbstractPacket {
29+
public static final PacketType TYPE = PacketType.Play.Client.USE_ENTITY;
30+
31+
public WrapperPlayClientUseEntity() {
32+
super(new PacketContainer(TYPE), TYPE);
33+
handle.getModifier().writeDefaults();
34+
}
35+
36+
public WrapperPlayClientUseEntity(PacketContainer packet) {
37+
super(packet, TYPE);
38+
}
39+
40+
/**
41+
* Retrieve the entity ID the player is interacting with.
42+
* @return The current Target
43+
*/
44+
public int getTargetID() {
45+
return handle.getIntegers().read(0);
46+
}
47+
48+
/**
49+
* Retrieve the entity the player is interacting with.
50+
* @param event - the world this event occured in.
51+
* @return The target entity.
52+
*/
53+
public Entity getTarget(World world) {
54+
return handle.getEntityModifier(world).read(0);
55+
}
56+
57+
/**
58+
* Retrieve the entity the player is interacting with.
59+
* @param event - the current packet event.
60+
* @return The target entity.
61+
*/
62+
public Entity getTarget(PacketEvent event) {
63+
return getTarget(event.getPlayer().getWorld());
64+
}
65+
66+
/**
67+
* Set the entity ID the player is interacting with.
68+
* @param value - new value.
69+
*/
70+
public void setTargetID(int value) {
71+
handle.getIntegers().write(0, value);
72+
}
73+
74+
/**
75+
* Retrieve the use action.
76+
* @return The action.
77+
*/
78+
public EntityUseAction getMouse() {
79+
return handle.getEntityUseActions().read(0);
80+
}
81+
82+
/**
83+
* Set the use action.
84+
* @param value - new action.
85+
*/
86+
public void setMouse(EntityUseAction value) {
87+
handle.getEntityUseActions().write(0, value);
88+
}
89+
}
90+
91+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
/*
2+
* PacketWrapper - Contains wrappers for each packet in Minecraft.
3+
* Copyright (C) 2012 Kristian S. Stangeland
4+
*
5+
* This program is free software; you can redistribute it and/or modify it under the terms of the
6+
* GNU Lesser General Public License as published by the Free Software Foundation; either version 2 of
7+
* the License, or (at your option) any later version.
8+
*
9+
* This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
10+
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
11+
* See the GNU General Public License for more details.
12+
*
13+
* You should have received a copy of the GNU General Public License along with this program;
14+
* if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
15+
* 02111-1307 USA
16+
*/
17+
18+
package com.comphenix.packetwrapper;
19+
20+
import java.util.List;
21+
22+
import com.comphenix.protocol.PacketType;
23+
import com.comphenix.protocol.events.PacketContainer;
24+
import com.google.common.primitives.Ints;
25+
26+
public class WrapperPlayServerEntityDestroy extends AbstractPacket {
27+
public static final PacketType TYPE = PacketType.Play.Server.ENTITY_DESTROY;
28+
29+
public WrapperPlayServerEntityDestroy() {
30+
super(new PacketContainer(TYPE), TYPE);
31+
handle.getModifier().writeDefaults();
32+
}
33+
34+
public WrapperPlayServerEntityDestroy(PacketContainer packet) {
35+
super(packet, TYPE);
36+
}
37+
38+
/**
39+
* Retrieve the IDs of the entities that will be destroyed.
40+
* @return The current entities.
41+
*/
42+
public List<Integer> getEntities() {
43+
return Ints.asList(handle.getIntegerArrays().read(0));
44+
}
45+
46+
/**
47+
* Set the entities that will be destroyed.
48+
* @param value - new value.
49+
*/
50+
public void setEntities(int[] entities) {
51+
handle.getIntegerArrays().write(0, entities);
52+
}
53+
54+
/**
55+
* Set the entities that will be destroyed.
56+
* @param value - new value.
57+
*/
58+
public void setEntities(List<Integer> entities) {
59+
setEntities(Ints.toArray(entities));
60+
}
61+
}
62+
63+

0 commit comments

Comments
 (0)