mirror of
https://github.com/darksaid98/AntiCheatReloaded.git
synced 2026-12-03 22:15:28 +00:00
Ready for Minecraft 1.12
This commit is contained in:
1 parent
2d064ee849
commit
f609758d28
9 files changed
+73
-29
No files matched your search
@@ -93,7 +93,7 @@
|
|||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.bukkit</groupId>
|
<groupId>org.bukkit</groupId>
|
||||||
<artifactId>craftbukkit</artifactId>
|
<artifactId>craftbukkit</artifactId>
|
||||||
<version>1.11.2-R0.1-SNAPSHOT</version>
|
<version>1.12.2-R0.1-SNAPSHOT</version>
|
||||||
<scope>provided</scope>
|
<scope>provided</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ import com.rammelkast.anticheatreloaded.AntiCheat;
|
|||||||
import com.rammelkast.anticheatreloaded.check.CheckResult;
|
import com.rammelkast.anticheatreloaded.check.CheckResult;
|
||||||
import com.rammelkast.anticheatreloaded.check.CheckType;
|
import com.rammelkast.anticheatreloaded.check.CheckType;
|
||||||
import com.rammelkast.anticheatreloaded.event.EventListener;
|
import com.rammelkast.anticheatreloaded.event.EventListener;
|
||||||
import com.rammelkast.anticheatreloaded.util.NPC_1_11;
|
import com.rammelkast.anticheatreloaded.util.NPC_1_12;
|
||||||
import com.rammelkast.anticheatreloaded.util.VersionUtil;
|
import com.rammelkast.anticheatreloaded.util.VersionUtil;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -24,7 +24,7 @@ import com.rammelkast.anticheatreloaded.util.VersionUtil;
|
|||||||
*/
|
*/
|
||||||
public class KillAuraCheck {
|
public class KillAuraCheck {
|
||||||
|
|
||||||
private static final Map<UUID, NPC_1_11> NPC_LIST = new HashMap<UUID, NPC_1_11>();
|
private static final Map<UUID, NPC_1_12> NPC_LIST = new HashMap<UUID, NPC_1_12>();
|
||||||
private static final Map<UUID, Integer> VL_COUNT = new HashMap<UUID, Integer>();
|
private static final Map<UUID, Integer> VL_COUNT = new HashMap<UUID, Integer>();
|
||||||
|
|
||||||
public static void cleanPlayer(Player p) {
|
public static void cleanPlayer(Player p) {
|
||||||
@@ -72,7 +72,7 @@ public class KillAuraCheck {
|
|||||||
if (NPC_LIST.containsKey(p.getUniqueId()))
|
if (NPC_LIST.containsKey(p.getUniqueId()))
|
||||||
NPC_LIST.get(p.getUniqueId()).damage(e, p);
|
NPC_LIST.get(p.getUniqueId()).damage(e, p);
|
||||||
else {
|
else {
|
||||||
NPC_1_11 npc = new NPC_1_11(p);
|
NPC_1_12 npc = new NPC_1_12(p);
|
||||||
NPC_LIST.put(p.getUniqueId(), npc);
|
NPC_LIST.put(p.getUniqueId(), npc);
|
||||||
npc.spawn();
|
npc.spawn();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,17 @@
|
|||||||
|
package com.rammelkast.anticheatreloaded.check.player;
|
||||||
|
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.UUID;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author Rammelkast
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public class GhosthandCheck {
|
||||||
|
|
||||||
|
public static final Map<UUID, Integer> FLAG_COUNT = new HashMap<UUID, Integer>();
|
||||||
|
public static final int MAX_FLAGS = 3; // TODO config?
|
||||||
|
|
||||||
|
}
|
||||||
@@ -26,6 +26,7 @@ import com.rammelkast.anticheatreloaded.config.yaml.CommentedConfiguration;
|
|||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
import java.io.InputStreamReader;
|
||||||
|
|
||||||
public class ConfigurationFile {
|
public class ConfigurationFile {
|
||||||
|
|
||||||
@@ -59,7 +60,13 @@ public class ConfigurationFile {
|
|||||||
this.saveDefault = saveDefault;
|
this.saveDefault = saveDefault;
|
||||||
|
|
||||||
if (saveDefault) {
|
if (saveDefault) {
|
||||||
defaultConfigFile = YamlConfiguration.loadConfiguration(plugin.getResource(fileName));
|
InputStreamReader reader = new InputStreamReader(plugin.getResource(fileName));
|
||||||
|
defaultConfigFile = YamlConfiguration.loadConfiguration(reader);
|
||||||
|
try {
|
||||||
|
reader.close();
|
||||||
|
} catch (IOException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
load();
|
load();
|
||||||
}
|
}
|
||||||
|
|||||||
+9
-1
@@ -26,6 +26,8 @@ import com.rammelkast.anticheatreloaded.config.Configuration;
|
|||||||
import com.rammelkast.anticheatreloaded.config.ConfigurationTable;
|
import com.rammelkast.anticheatreloaded.config.ConfigurationTable;
|
||||||
import com.rammelkast.anticheatreloaded.config.providers.Lang;
|
import com.rammelkast.anticheatreloaded.config.providers.Lang;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.io.InputStreamReader;
|
||||||
import java.lang.reflect.InvocationHandler;
|
import java.lang.reflect.InvocationHandler;
|
||||||
import java.lang.reflect.Method;
|
import java.lang.reflect.Method;
|
||||||
import java.sql.PreparedStatement;
|
import java.sql.PreparedStatement;
|
||||||
@@ -50,7 +52,13 @@ public class MySQLLangHolder extends ConfigurationTable implements InvocationHan
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void open() {
|
public void open() {
|
||||||
defaults = YamlConfiguration.loadConfiguration(AntiCheat.getPlugin().getResource("lang.yml"));
|
InputStreamReader reader = new InputStreamReader(AntiCheat.getPlugin().getResource("lang.yml"));
|
||||||
|
defaults = YamlConfiguration.loadConfiguration(reader);
|
||||||
|
try {
|
||||||
|
reader.close();
|
||||||
|
} catch (IOException e1) {
|
||||||
|
e1.printStackTrace();
|
||||||
|
}
|
||||||
|
|
||||||
stringValues = new HashMap<String, String>();
|
stringValues = new HashMap<String, String>();
|
||||||
listValues = new HashMap<String, List<String>>();
|
listValues = new HashMap<String, List<String>>();
|
||||||
|
|||||||
+9
-1
@@ -26,6 +26,8 @@ import com.rammelkast.anticheatreloaded.config.Configuration;
|
|||||||
import com.rammelkast.anticheatreloaded.config.ConfigurationTable;
|
import com.rammelkast.anticheatreloaded.config.ConfigurationTable;
|
||||||
import com.rammelkast.anticheatreloaded.config.providers.Magic;
|
import com.rammelkast.anticheatreloaded.config.providers.Magic;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.io.InputStreamReader;
|
||||||
import java.lang.reflect.InvocationHandler;
|
import java.lang.reflect.InvocationHandler;
|
||||||
import java.lang.reflect.Method;
|
import java.lang.reflect.Method;
|
||||||
import java.sql.ResultSet;
|
import java.sql.ResultSet;
|
||||||
@@ -47,7 +49,13 @@ public class MySQLMagicHolder extends ConfigurationTable implements InvocationHa
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void open() {
|
public void open() {
|
||||||
defaults = YamlConfiguration.loadConfiguration(AntiCheat.getPlugin().getResource("magic.yml"));
|
InputStreamReader reader = new InputStreamReader(AntiCheat.getPlugin().getResource("magic.yml"));
|
||||||
|
defaults = YamlConfiguration.loadConfiguration(reader);
|
||||||
|
try {
|
||||||
|
reader.close();
|
||||||
|
} catch (IOException e1) {
|
||||||
|
e1.printStackTrace();
|
||||||
|
}
|
||||||
|
|
||||||
ints = new HashMap<String, Integer>();
|
ints = new HashMap<String, Integer>();
|
||||||
doubles = new HashMap<String, Double>();
|
doubles = new HashMap<String, Double>();
|
||||||
|
|||||||
+4
-1
@@ -33,6 +33,7 @@ import java.io.File;
|
|||||||
import java.io.FileNotFoundException;
|
import java.io.FileNotFoundException;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
|
import java.io.InputStreamReader;
|
||||||
import java.util.ArrayDeque;
|
import java.util.ArrayDeque;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
@@ -188,7 +189,9 @@ public class CommentedConfiguration extends YamlConfiguration {
|
|||||||
CommentedConfiguration config = new CommentedConfiguration();
|
CommentedConfiguration config = new CommentedConfiguration();
|
||||||
|
|
||||||
try {
|
try {
|
||||||
config.load(stream);
|
InputStreamReader reader = new InputStreamReader(stream);
|
||||||
|
config.load(reader);
|
||||||
|
reader.close();
|
||||||
} catch (IOException ex) {
|
} catch (IOException ex) {
|
||||||
Bukkit.getLogger().log(Level.SEVERE, "Cannot load configuration from stream", ex);
|
Bukkit.getLogger().log(Level.SEVERE, "Cannot load configuration from stream", ex);
|
||||||
} catch (InvalidConfigurationException ex) {
|
} catch (InvalidConfigurationException ex) {
|
||||||
|
|||||||
@@ -18,6 +18,11 @@
|
|||||||
|
|
||||||
package com.rammelkast.anticheatreloaded.manage;
|
package com.rammelkast.anticheatreloaded.manage;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.UUID;
|
||||||
|
|
||||||
|
import org.bukkit.BanList.Type;
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.ChatColor;
|
import org.bukkit.ChatColor;
|
||||||
|
|
||||||
@@ -28,10 +33,6 @@ import com.rammelkast.anticheatreloaded.util.Group;
|
|||||||
import com.rammelkast.anticheatreloaded.util.User;
|
import com.rammelkast.anticheatreloaded.util.User;
|
||||||
import com.rammelkast.anticheatreloaded.util.Utilities;
|
import com.rammelkast.anticheatreloaded.util.Utilities;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.UUID;
|
|
||||||
|
|
||||||
public class UserManager {
|
public class UserManager {
|
||||||
private List<User> users = new ArrayList<User>();
|
private List<User> users = new ArrayList<User>();
|
||||||
private static AntiCheatManager manager;
|
private static AntiCheatManager manager;
|
||||||
@@ -243,7 +244,7 @@ public class UserManager {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (event.equalsIgnoreCase("BAN")) {
|
} else if (event.equalsIgnoreCase("BAN")) {
|
||||||
user.getPlayer().setBanned(true);
|
Bukkit.getBanList(Type.NAME).addBan(user.getPlayer().getName(), RED + banReason, null, null);
|
||||||
user.getPlayer().kickPlayer(RED + banReason);
|
user.getPlayer().kickPlayer(RED + banReason);
|
||||||
String msg = RED + config.getLang().BAN_BROADCAST().replaceAll("&player", name) + " (" + CheckType.getName(type) + ")";
|
String msg = RED + config.getLang().BAN_BROADCAST().replaceAll("&player", name) + " (" + CheckType.getName(type) + ")";
|
||||||
if (!msg.equals("")) {
|
if (!msg.equals("")) {
|
||||||
|
|||||||
+16
-16
@@ -5,9 +5,9 @@ import java.util.UUID;
|
|||||||
|
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
import org.bukkit.craftbukkit.v1_11_R1.CraftServer;
|
import org.bukkit.craftbukkit.v1_12_R1.CraftServer;
|
||||||
import org.bukkit.craftbukkit.v1_11_R1.CraftWorld;
|
import org.bukkit.craftbukkit.v1_12_R1.CraftWorld;
|
||||||
import org.bukkit.craftbukkit.v1_11_R1.entity.CraftPlayer;
|
import org.bukkit.craftbukkit.v1_12_R1.entity.CraftPlayer;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.event.entity.EntityDamageByEntityEvent;
|
import org.bukkit.event.entity.EntityDamageByEntityEvent;
|
||||||
import org.bukkit.event.player.PlayerMoveEvent;
|
import org.bukkit.event.player.PlayerMoveEvent;
|
||||||
@@ -17,19 +17,19 @@ import org.bukkit.util.Vector;
|
|||||||
import com.mojang.authlib.GameProfile;
|
import com.mojang.authlib.GameProfile;
|
||||||
import com.rammelkast.anticheatreloaded.AntiCheat;
|
import com.rammelkast.anticheatreloaded.AntiCheat;
|
||||||
|
|
||||||
import net.minecraft.server.v1_11_R1.EntityHuman;
|
import net.minecraft.server.v1_12_R1.EntityHuman;
|
||||||
import net.minecraft.server.v1_11_R1.EntityPlayer;
|
import net.minecraft.server.v1_12_R1.EntityPlayer;
|
||||||
import net.minecraft.server.v1_11_R1.MinecraftServer;
|
import net.minecraft.server.v1_12_R1.MinecraftServer;
|
||||||
import net.minecraft.server.v1_11_R1.PacketPlayOutEntityMetadata;
|
import net.minecraft.server.v1_12_R1.PacketPlayOutEntityMetadata;
|
||||||
import net.minecraft.server.v1_11_R1.PacketPlayOutEntityTeleport;
|
import net.minecraft.server.v1_12_R1.PacketPlayOutEntityTeleport;
|
||||||
import net.minecraft.server.v1_11_R1.PacketPlayOutNamedEntitySpawn;
|
import net.minecraft.server.v1_12_R1.PacketPlayOutNamedEntitySpawn;
|
||||||
import net.minecraft.server.v1_11_R1.PacketPlayOutPlayerInfo;
|
import net.minecraft.server.v1_12_R1.PacketPlayOutPlayerInfo;
|
||||||
import net.minecraft.server.v1_11_R1.PlayerConnection;
|
import net.minecraft.server.v1_12_R1.PlayerConnection;
|
||||||
import net.minecraft.server.v1_11_R1.PlayerInteractManager;
|
import net.minecraft.server.v1_12_R1.PlayerInteractManager;
|
||||||
import net.minecraft.server.v1_11_R1.World;
|
import net.minecraft.server.v1_12_R1.World;
|
||||||
import net.minecraft.server.v1_11_R1.WorldServer;
|
import net.minecraft.server.v1_12_R1.WorldServer;
|
||||||
|
|
||||||
public class NPC_1_11 {
|
public class NPC_1_12 {
|
||||||
|
|
||||||
private final UUID owner;
|
private final UUID owner;
|
||||||
private final String name;
|
private final String name;
|
||||||
@@ -42,7 +42,7 @@ public class NPC_1_11 {
|
|||||||
return this.entityId;
|
return this.entityId;
|
||||||
}
|
}
|
||||||
|
|
||||||
public NPC_1_11(Player owner) {
|
public NPC_1_12(Player owner) {
|
||||||
this.owner = owner.getUniqueId();
|
this.owner = owner.getUniqueId();
|
||||||
this.name = NameGenerator.generateName();
|
this.name = NameGenerator.generateName();
|
||||||
Location eyelocation = owner.getEyeLocation();
|
Location eyelocation = owner.getEyeLocation();
|
||||||
Reference in new issue
Block a user