mirror of
https://github.com/darksaid98/AntiCheatReloaded.git
synced 2026-12-01 14:38:56 +00:00
Update for 1.6.4, add ProtocolLib softdepend. More on this later.
This commit is contained in:
1 parent
48d661c8ab
commit
1b9b5ef520
7 files changed
+90
-14
No files matched your search
@@ -10,6 +10,11 @@
|
||||
<id>bukkit-repo</id>
|
||||
<url>http://repo.bukkit.org/content/repositories/public/</url>
|
||||
</repository>
|
||||
<repository>
|
||||
<id>comphenix-rep</id>
|
||||
<name>Comphenix Repository</name>
|
||||
<url>http://repo.comphenix.net/content/groups/public</url>
|
||||
</repository>
|
||||
</repositories>
|
||||
<build>
|
||||
<sourceDirectory>${basedir}/src/main/java</sourceDirectory>
|
||||
@@ -52,7 +57,7 @@
|
||||
<dependency>
|
||||
<groupId>org.bukkit</groupId>
|
||||
<artifactId>bukkit</artifactId>
|
||||
<version>1.6.2-R0.1-SNAPSHOT</version>
|
||||
<version>1.6.4-R0.1-SNAPSHOT</version>
|
||||
<type>jar</type>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
@@ -63,6 +68,11 @@
|
||||
<type>jar</type>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.comphenix.protocol</groupId>
|
||||
<artifactId>ProtocolLib</artifactId>
|
||||
<version>2.7.0</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
<distributionManagement>
|
||||
<repository>
|
||||
@@ -70,4 +80,4 @@
|
||||
<url>file:///var/lib/jenkins/repo</url>
|
||||
</repository>
|
||||
</distributionManagement>
|
||||
</project>
|
||||
</project>
|
||||
@@ -18,17 +18,15 @@
|
||||
|
||||
package net.h31ix.anticheat;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.InputStream;
|
||||
import java.io.OutputStream;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.logging.Level;
|
||||
|
||||
import com.comphenix.protocol.ProtocolLibrary;
|
||||
import net.h31ix.anticheat.config.Configuration;
|
||||
import net.h31ix.anticheat.event.*;
|
||||
import net.h31ix.anticheat.manage.AnticheatManager;
|
||||
import net.h31ix.anticheat.manage.PacketManager;
|
||||
import net.h31ix.anticheat.manage.User;
|
||||
import net.h31ix.anticheat.update.Updater;
|
||||
import net.h31ix.anticheat.util.Utilities;
|
||||
@@ -49,6 +47,8 @@ public class AntiCheat extends JavaPlugin {
|
||||
private static boolean verbose;
|
||||
private static boolean developer;
|
||||
private static final long XRAY_TIME = 1200;
|
||||
private static PacketManager packetManager;
|
||||
private static boolean protocolLib = false;
|
||||
|
||||
@Override
|
||||
public void onEnable() {
|
||||
@@ -65,6 +65,7 @@ public class AntiCheat extends JavaPlugin {
|
||||
setupEvents();
|
||||
setupCommands();
|
||||
setupUpdater();
|
||||
setupProtocol();
|
||||
restoreLevels();
|
||||
// Check if NoCheatPlus is installed
|
||||
Bukkit.getScheduler().runTaskLater(this, new Runnable() {
|
||||
@@ -93,6 +94,16 @@ public class AntiCheat extends JavaPlugin {
|
||||
cleanup();
|
||||
}
|
||||
|
||||
private void setupProtocol() {
|
||||
if (Bukkit.getPluginManager().getPlugin("ProtocolLib") != null) {
|
||||
protocolLib = true;
|
||||
packetManager = new PacketManager(ProtocolLibrary.getProtocolManager(), this, manager);
|
||||
if (verbose) {
|
||||
getLogger().log(Level.INFO, "Hooked into ProtocolLib");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void setupXray() {
|
||||
final XRayTracker xtracker = manager.getXRayTracker();
|
||||
if (config.getConfig().logXRayStats.getValue()) {
|
||||
@@ -198,6 +209,10 @@ public class AntiCheat extends JavaPlugin {
|
||||
developer = b;
|
||||
}
|
||||
|
||||
public static boolean isUsingProtocolLib() {
|
||||
return protocolLib;
|
||||
}
|
||||
|
||||
public static void debugLog(final String string) {
|
||||
Bukkit.getScheduler().runTask(getPlugin(), new Runnable() {
|
||||
public void run() {
|
||||
|
||||
@@ -915,6 +915,7 @@ public class Backend {
|
||||
}
|
||||
|
||||
public void logAnimation(final Player player) {
|
||||
System.out.println("Log animation");
|
||||
animated.put(player.getName(), System.currentTimeMillis());
|
||||
increment(player, blockPunches, magic.BLOCK_PUNCH_MIN);
|
||||
itemInHand.put(player.getName(), player.getItemInHand().getType());
|
||||
|
||||
@@ -0,0 +1,37 @@
|
||||
package net.h31ix.anticheat.manage;
|
||||
|
||||
import com.comphenix.protocol.Packets;
|
||||
import com.comphenix.protocol.ProtocolManager;
|
||||
import com.comphenix.protocol.events.*;
|
||||
import net.h31ix.anticheat.AntiCheat;
|
||||
|
||||
public class PacketManager {
|
||||
|
||||
private ProtocolManager protocolManager;
|
||||
private AntiCheat plugin;
|
||||
private AnticheatManager manager;
|
||||
|
||||
public PacketManager(ProtocolManager protocolManager, AntiCheat plugin, AnticheatManager manager) {
|
||||
this.protocolManager = protocolManager;
|
||||
this.plugin = plugin;
|
||||
this.manager = manager;
|
||||
addListeners();
|
||||
}
|
||||
|
||||
private void addListeners() {
|
||||
// Arm Animation
|
||||
protocolManager.addPacketListener(new PacketAdapter(plugin,
|
||||
ConnectionSide.CLIENT_SIDE,
|
||||
ListenerPriority.NORMAL,
|
||||
Packets.Client.ARM_ANIMATION) {
|
||||
|
||||
@Override
|
||||
public void onPacketReceiving(PacketEvent event) {
|
||||
if (event.getPacketID() == Packets.Client.ARM_ANIMATION) {
|
||||
PacketContainer packet = event.getPacket();
|
||||
//System.out.println("Arm animation from "+packet.getIntegers().read(0));
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -33,6 +33,7 @@ import java.util.*;
|
||||
|
||||
public class User {
|
||||
private final String name;
|
||||
private final int id;
|
||||
private int level = 0;
|
||||
private Location goodLocation;
|
||||
private List<ItemStack> inventorySnapshot = null;
|
||||
@@ -59,6 +60,7 @@ public class User {
|
||||
public User(String name, int level) {
|
||||
this.name = name;
|
||||
this.level = level;
|
||||
this.id = getPlayer().getEntityId();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -70,6 +72,15 @@ public class User {
|
||||
return name;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the player's entity ID
|
||||
*
|
||||
* @return Entity id
|
||||
*/
|
||||
public int getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the Bukkit player
|
||||
*
|
||||
@@ -164,7 +175,7 @@ public class User {
|
||||
if (goodLocation == null) {
|
||||
return location;
|
||||
}
|
||||
|
||||
|
||||
return goodLocation;
|
||||
}
|
||||
|
||||
@@ -178,7 +189,7 @@ public class User {
|
||||
if (Utilities.cantStandAtExp(location) || (location.getBlock().isLiquid() && !Utilities.isFullyInWater(location))) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
goodLocation = location;
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -1,12 +1,14 @@
|
||||
/*
|
||||
* Updater for Bukkit.
|
||||
*
|
||||
* This class provides the means to safetly and easily update a plugin, or check to see if it is updated using dev.bukkit.org
|
||||
* This class provides the means to safely and easily update a plugin, or check to see if it is updated using dev.bukkit.org
|
||||
*/
|
||||
|
||||
package net.h31ix.anticheat.update;
|
||||
|
||||
import java.io.*;
|
||||
import java.lang.Runnable;
|
||||
import java.lang.Thread;
|
||||
import java.net.MalformedURLException;
|
||||
import java.net.URL;
|
||||
import java.net.URLConnection;
|
||||
@@ -51,7 +53,7 @@ public class Updater
|
||||
private File file; // The plugin's file
|
||||
private Thread thread; // Updater thread
|
||||
private static final String DBOUrl = "http://dev.bukkit.org/server-mods/"; // Slugs will be appended to this to get to the project's RSS feed
|
||||
private String [] noUpdateTag = {"-DEV","-PRE"}; // If the version number contains one of these, don't update.
|
||||
private String [] noUpdateTag = {"-DEV","-PRE","-SNAPSHOT"}; // If the version number contains one of these, don't update.
|
||||
private static final int BYTE_SIZE = 1024; // Used for downloading files
|
||||
private String updateFolder = YamlConfiguration.loadConfiguration(new File("bukkit.yml")).getString("settings.update-folder"); // The folder that downloads will be placed in
|
||||
private Updater.UpdateResult result = Updater.UpdateResult.SUCCESS; // Used for determining the outcome of the update process
|
||||
@@ -186,7 +188,7 @@ public class Updater
|
||||
try {
|
||||
thread.join();
|
||||
} catch (InterruptedException e) {
|
||||
e.printStackTrace(); //To change body of catch statement use File | Settings | File Templates.
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
author: H31IX
|
||||
author: Gravity
|
||||
database: false
|
||||
description: Prevention of hacks and other malicious tinkering on a Minecraft server.
|
||||
main: net.h31ix.anticheat.AntiCheat
|
||||
name: AntiCheat
|
||||
softdepend: [AntiCheat]
|
||||
softdepend: [ProtocolLib]
|
||||
startup: postworld
|
||||
url: http://gravitydevelopment.net
|
||||
version: ${project.version}-b${BUILD_NUMBER}
|
||||
@@ -11,7 +11,7 @@ commands:
|
||||
anticheat:
|
||||
description: Control and view info about AntiCheat
|
||||
usage: /anticheat help
|
||||
aliases: anti
|
||||
aliases: [anti, ac]
|
||||
permissions:
|
||||
anticheat.alert:
|
||||
description: Get alerts
|
||||
|
||||
Reference in new issue
Block a user