This commit is contained in:
parent
abebe358dc
commit
2ea919a947
|
@ -0,0 +1,11 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<classpath>
|
||||||
|
<classpathentry kind="src" path="src"/>
|
||||||
|
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8"/>
|
||||||
|
<classpathentry kind="lib" path="C:/Users/Matej/Desktop/All/Coding/Workspace/Vault.jar"/>
|
||||||
|
<classpathentry kind="lib" path="C:/Users/Matej/Desktop/All/Coding/Workspace/lombok.jar"/>
|
||||||
|
<classpathentry kind="lib" path="C:/Users/Matej/Desktop/All/Coding/Git/pSpigot-SecondLife/PaperSpigot-API/target/paperspigot-api-1.7.10-R0.1-SNAPSHOT.jar"/>
|
||||||
|
<classpathentry kind="lib" path="C:/Users/Matej/Desktop/All/Coding/Git/pSpigot-SecondLife/PaperSpigot-Server/target/paperspigot-1.7.10-R0.1-SNAPSHOT.jar"/>
|
||||||
|
<classpathentry kind="lib" path="C:/Users/Matej/Desktop/All/Coding/Workspace/ProtocolLib-3-1.jar"/>
|
||||||
|
<classpathentry kind="output" path="bin"/>
|
||||||
|
</classpath>
|
|
@ -0,0 +1,17 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<projectDescription>
|
||||||
|
<name>Paik</name>
|
||||||
|
<comment></comment>
|
||||||
|
<projects>
|
||||||
|
</projects>
|
||||||
|
<buildSpec>
|
||||||
|
<buildCommand>
|
||||||
|
<name>org.eclipse.jdt.core.javabuilder</name>
|
||||||
|
<arguments>
|
||||||
|
</arguments>
|
||||||
|
</buildCommand>
|
||||||
|
</buildSpec>
|
||||||
|
<natures>
|
||||||
|
<nature>org.eclipse.jdt.core.javanature</nature>
|
||||||
|
</natures>
|
||||||
|
</projectDescription>
|
|
@ -0,0 +1,11 @@
|
||||||
|
eclipse.preferences.version=1
|
||||||
|
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
|
||||||
|
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
|
||||||
|
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
|
||||||
|
org.eclipse.jdt.core.compiler.compliance=1.8
|
||||||
|
org.eclipse.jdt.core.compiler.debug.lineNumber=generate
|
||||||
|
org.eclipse.jdt.core.compiler.debug.localVariable=generate
|
||||||
|
org.eclipse.jdt.core.compiler.debug.sourceFile=generate
|
||||||
|
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
|
||||||
|
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
|
||||||
|
org.eclipse.jdt.core.compiler.source=1.8
|
|
@ -0,0 +1,3 @@
|
||||||
|
Manifest-Version: 1.0
|
||||||
|
Main-Class: Paik
|
||||||
|
|
|
@ -0,0 +1,3 @@
|
||||||
|
Manifest-Version: 1.0
|
||||||
|
Main-Class: secondlife.network.paik.Paik
|
||||||
|
|
|
@ -0,0 +1,39 @@
|
||||||
|
enabled: true
|
||||||
|
test-mode: false
|
||||||
|
autobans: true
|
||||||
|
checks:
|
||||||
|
reach: true
|
||||||
|
autoclicker: true
|
||||||
|
fastbow: true
|
||||||
|
killaura:
|
||||||
|
dead: true
|
||||||
|
bot: true
|
||||||
|
packet: true
|
||||||
|
angle: true
|
||||||
|
wall: true
|
||||||
|
regen: true
|
||||||
|
flyA: true
|
||||||
|
flyB: true
|
||||||
|
fasteat: true
|
||||||
|
groundspoof: true
|
||||||
|
inventory:
|
||||||
|
move: true
|
||||||
|
killaura: true
|
||||||
|
autopotion: true
|
||||||
|
noslowdown:
|
||||||
|
shooting: true
|
||||||
|
eating: true
|
||||||
|
sneak: true
|
||||||
|
speed: true
|
||||||
|
timer:
|
||||||
|
standing: true
|
||||||
|
moving: true
|
||||||
|
looking: true
|
||||||
|
crash: true
|
||||||
|
custompayload: true
|
||||||
|
pingspoof: true
|
||||||
|
impossiblepitch: true
|
||||||
|
autoblock: true
|
||||||
|
refill: true
|
||||||
|
morepackets: true
|
||||||
|
invalidinteract: true
|
|
@ -0,0 +1,26 @@
|
||||||
|
name: Paik
|
||||||
|
main: secondlife.network.paik.Paik
|
||||||
|
author: ItsNature
|
||||||
|
version: 1.0
|
||||||
|
depend: [ProtocolLib]
|
||||||
|
|
||||||
|
commands:
|
||||||
|
autobans:
|
||||||
|
description: Autobans command
|
||||||
|
aliases: [enableautobans, disableautobans]
|
||||||
|
killaura:
|
||||||
|
description: Killaura command
|
||||||
|
aliases: [ff, forcefield, ka]
|
||||||
|
ocmc:
|
||||||
|
description: OCMC command
|
||||||
|
logs:
|
||||||
|
description: Logs command
|
||||||
|
aliases: [log, aclogs, anticheatlogs]
|
||||||
|
paik:
|
||||||
|
description: Paik command
|
||||||
|
aliases: [ac, anticheat]
|
||||||
|
paikban:
|
||||||
|
description: Paik ban command
|
||||||
|
aliases: [pban, acban, anticheatban]
|
||||||
|
ping:
|
||||||
|
description: Ping command
|
|
@ -0,0 +1,3 @@
|
||||||
|
Manifest-Version: 1.0
|
||||||
|
Main-Class: secondlife.network.paik.Paik
|
||||||
|
|
|
@ -0,0 +1,39 @@
|
||||||
|
enabled: true
|
||||||
|
test-mode: false
|
||||||
|
autobans: true
|
||||||
|
checks:
|
||||||
|
reach: true
|
||||||
|
autoclicker: true
|
||||||
|
fastbow: true
|
||||||
|
killaura:
|
||||||
|
dead: true
|
||||||
|
bot: true
|
||||||
|
packet: true
|
||||||
|
angle: true
|
||||||
|
wall: true
|
||||||
|
regen: true
|
||||||
|
flyA: true
|
||||||
|
flyB: true
|
||||||
|
fasteat: true
|
||||||
|
groundspoof: true
|
||||||
|
inventory:
|
||||||
|
move: true
|
||||||
|
killaura: true
|
||||||
|
autopotion: true
|
||||||
|
noslowdown:
|
||||||
|
shooting: true
|
||||||
|
eating: true
|
||||||
|
sneak: true
|
||||||
|
speed: true
|
||||||
|
timer:
|
||||||
|
standing: true
|
||||||
|
moving: true
|
||||||
|
looking: true
|
||||||
|
crash: true
|
||||||
|
custompayload: true
|
||||||
|
pingspoof: true
|
||||||
|
impossiblepitch: true
|
||||||
|
autoblock: true
|
||||||
|
refill: true
|
||||||
|
morepackets: true
|
||||||
|
invalidinteract: true
|
|
@ -0,0 +1,26 @@
|
||||||
|
name: Paik
|
||||||
|
main: secondlife.network.paik.Paik
|
||||||
|
author: ItsNature
|
||||||
|
version: 1.0
|
||||||
|
depend: [ProtocolLib]
|
||||||
|
|
||||||
|
commands:
|
||||||
|
autobans:
|
||||||
|
description: Autobans command
|
||||||
|
aliases: [enableautobans, disableautobans]
|
||||||
|
killaura:
|
||||||
|
description: Killaura command
|
||||||
|
aliases: [ff, forcefield, ka]
|
||||||
|
ocmc:
|
||||||
|
description: OCMC command
|
||||||
|
logs:
|
||||||
|
description: Logs command
|
||||||
|
aliases: [log, aclogs, anticheatlogs]
|
||||||
|
paik:
|
||||||
|
description: Paik command
|
||||||
|
aliases: [ac, anticheat]
|
||||||
|
paikban:
|
||||||
|
description: Paik ban command
|
||||||
|
aliases: [pban, acban, anticheatban]
|
||||||
|
ping:
|
||||||
|
description: Ping command
|
|
@ -0,0 +1,71 @@
|
||||||
|
package secondlife.network.paik;
|
||||||
|
|
||||||
|
import com.comphenix.protocol.ProtocolLibrary;
|
||||||
|
import lombok.Getter;
|
||||||
|
import org.bukkit.Bukkit;
|
||||||
|
import org.bukkit.plugin.java.JavaPlugin;
|
||||||
|
import secondlife.network.paik.checks.combat.AutoClicker;
|
||||||
|
import secondlife.network.paik.checks.combat.Killaura;
|
||||||
|
import secondlife.network.paik.checks.movement.Speed;
|
||||||
|
import secondlife.network.paik.checks.movement.Timer;
|
||||||
|
import secondlife.network.paik.checks.movement.fly.FlyA;
|
||||||
|
import secondlife.network.paik.handlers.*;
|
||||||
|
import secondlife.network.paik.handlers.data.PlayerStatsHandler;
|
||||||
|
import secondlife.network.paik.handlers.fixes.BookExploitHandler;
|
||||||
|
import secondlife.network.paik.handlers.fixes.FenceGlitchHandler;
|
||||||
|
import secondlife.network.paik.utils.DirectoryUtils;
|
||||||
|
import secondlife.network.paik.utils.PasteUtils;
|
||||||
|
import secondlife.network.paik.utils.file.ConfigFile;
|
||||||
|
|
||||||
|
public class Paik extends JavaPlugin {
|
||||||
|
|
||||||
|
@Getter private static Paik instance;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onEnable() {
|
||||||
|
instance = this;
|
||||||
|
|
||||||
|
this.registerOther();
|
||||||
|
this.registerHandlers();
|
||||||
|
this.registerChecks();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onDisable() {
|
||||||
|
CheatHandler.clear();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void registerOther() {
|
||||||
|
|
||||||
|
new ConfigFile(this);
|
||||||
|
|
||||||
|
Bukkit.getMessenger().registerOutgoingPluginChannel(this, "AutoBan");
|
||||||
|
Bukkit.getMessenger().registerOutgoingPluginChannel(this, "Alerts");
|
||||||
|
|
||||||
|
DirectoryUtils.registerDirectory();
|
||||||
|
|
||||||
|
PasteUtils.setDeveloperKey("8f3898360d2fe368a723d12839fa8374");
|
||||||
|
}
|
||||||
|
|
||||||
|
private void registerChecks() {
|
||||||
|
new AutoClicker(this);
|
||||||
|
new Killaura(this);
|
||||||
|
new FlyA(this);
|
||||||
|
new Speed(this);
|
||||||
|
new Timer(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void registerHandlers() {
|
||||||
|
new PlayerStatsHandler(this);
|
||||||
|
|
||||||
|
new BookExploitHandler(this);
|
||||||
|
new FenceGlitchHandler(this);
|
||||||
|
|
||||||
|
new AlertsHandler(this);
|
||||||
|
new CheatHandler(this);
|
||||||
|
new CommandHandler(this);
|
||||||
|
new PlayerHandler(this);
|
||||||
|
|
||||||
|
ProtocolLibrary.getProtocolManager().addPacketListener(new PacketHandler(this));
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,78 @@
|
||||||
|
package secondlife.network.paik.checks.combat;
|
||||||
|
|
||||||
|
import org.bukkit.Bukkit;
|
||||||
|
import org.bukkit.Material;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
import org.bukkit.event.secondlife.PlayerCheatEvent;
|
||||||
|
import org.bukkit.inventory.ItemStack;
|
||||||
|
import secondlife.network.paik.handlers.data.PlayerStats;
|
||||||
|
import secondlife.network.paik.utils.LocationUtils;
|
||||||
|
import secondlife.network.paik.utils.ServerUtils;
|
||||||
|
import secondlife.network.paik.utils.file.ConfigFile;
|
||||||
|
|
||||||
|
public class AutoBlock {
|
||||||
|
|
||||||
|
public static void handleAutoBlockPlace(Player player, PlayerStats stats) {
|
||||||
|
if(stats.getAutoblock() > 0) {
|
||||||
|
stats.setAutoblock(stats.getAutoblock() - 1);
|
||||||
|
//Message.sendMessage("§cverbose -1 (BLOCK PLACE)");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void handleAutoBlockDig(Player player, PlayerStats stats) {
|
||||||
|
if(ConfigFile.configuration.getBoolean("enabled") && ConfigFile.configuration.getBoolean("checks.autoblock")) {
|
||||||
|
if (ServerUtils.isServerLagging()) return;
|
||||||
|
|
||||||
|
if(stats.getAutoblock() > 15) {
|
||||||
|
stats.setAutoblock(0);
|
||||||
|
Bukkit.getPluginManager().callEvent(new PlayerCheatEvent(player, LocationUtils.getLocation(player), "AutoBlock (Damage)", player.getPing(), Bukkit.spigot().getTPS()[0]));
|
||||||
|
}
|
||||||
|
|
||||||
|
if(System.currentTimeMillis() - stats.getLastUseEntityPacket() < 250) {
|
||||||
|
ItemStack item = player.getItemInHand();
|
||||||
|
|
||||||
|
if(item == null) return;
|
||||||
|
|
||||||
|
if(item.getType() == Material.DIAMOND_SWORD
|
||||||
|
|| item.getType() == Material.GOLD_SWORD
|
||||||
|
|| item.getType() == Material.IRON_SWORD
|
||||||
|
|| item.getType() == Material.STONE_SWORD
|
||||||
|
|| item.getType() == Material.WOOD_SWORD) {
|
||||||
|
stats.setAutoblock(stats.getAutoblock() + 1);
|
||||||
|
//Message.sendMessage("§averbose +1");
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if(stats.getAutoblock() > 0) {
|
||||||
|
stats.setAutoblock(stats.getAutoblock() - 1);
|
||||||
|
//Message.sendMessage("§cverbose -1 (USE ENTITY)");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void handleAutoBlock(Player player, PlayerStats stats) {
|
||||||
|
if(ConfigFile.configuration.getBoolean("enabled") && ConfigFile.configuration.getBoolean("checks.autoblock")) {
|
||||||
|
if (ServerUtils.isServerLagging()) return;
|
||||||
|
|
||||||
|
ItemStack item = player.getItemInHand();
|
||||||
|
|
||||||
|
if(item == null) return;
|
||||||
|
|
||||||
|
if(item.getType() == Material.DIAMOND_SWORD
|
||||||
|
|| item.getType() == Material.GOLD_SWORD
|
||||||
|
|| item.getType() == Material.IRON_SWORD
|
||||||
|
|| item.getType() == Material.STONE_SWORD
|
||||||
|
|| item.getType() == Material.WOOD_SWORD) {
|
||||||
|
|
||||||
|
if (player.isBlocking() && player.isSprinting()) {
|
||||||
|
if(stats.getAutoblock2() > 50) {
|
||||||
|
stats.setAutoblock2(0);
|
||||||
|
Bukkit.getPluginManager().callEvent(new PlayerCheatEvent(player, LocationUtils.getLocation(player), "AutoBlock (Walk)", player.getPing(), Bukkit.spigot().getTPS()[0]));
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
stats.setAutoblock2(0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,158 @@
|
||||||
|
package secondlife.network.paik.checks.combat;
|
||||||
|
|
||||||
|
import org.bukkit.Bukkit;
|
||||||
|
import org.bukkit.Material;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
import org.bukkit.event.block.Action;
|
||||||
|
import org.bukkit.event.secondlife.PlayerCheatEvent;
|
||||||
|
import org.bukkit.inventory.ItemStack;
|
||||||
|
import org.bukkit.scheduler.BukkitRunnable;
|
||||||
|
import secondlife.network.paik.Paik;
|
||||||
|
import secondlife.network.paik.handlers.CheatHandler;
|
||||||
|
import secondlife.network.paik.handlers.data.PlayerStats;
|
||||||
|
import secondlife.network.paik.handlers.data.PlayerStatsHandler;
|
||||||
|
import secondlife.network.paik.utils.Handler;
|
||||||
|
import secondlife.network.paik.utils.LocationUtils;
|
||||||
|
import secondlife.network.paik.utils.ServerUtils;
|
||||||
|
import secondlife.network.paik.utils.file.ConfigFile;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.text.DecimalFormat;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
|
||||||
|
public class AutoClicker extends Handler {
|
||||||
|
|
||||||
|
public static ArrayList<String> butterfly;
|
||||||
|
|
||||||
|
public AutoClicker(Paik plugin) {
|
||||||
|
super(plugin);
|
||||||
|
|
||||||
|
butterfly = new ArrayList<String>();
|
||||||
|
|
||||||
|
butterfly.add("ghostclienterr");
|
||||||
|
|
||||||
|
this.getClicks();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void handleAutoClickInteract(Player player, PlayerStats stats, Action action) {
|
||||||
|
if(ConfigFile.configuration.getBoolean("enabled") && ConfigFile.configuration.getBoolean("checks.autoclicker")) {
|
||||||
|
if(ServerUtils.isServerLagging() || action != Action.LEFT_CLICK_AIR) return;
|
||||||
|
|
||||||
|
handleAutoClick(player, stats);
|
||||||
|
handleConstantCPS(player, stats);
|
||||||
|
handleDoubleClick(player, stats);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void getClicks() {
|
||||||
|
new BukkitRunnable() {
|
||||||
|
public void run() {
|
||||||
|
if(!ConfigFile.configuration.getBoolean("enabled")) return;
|
||||||
|
if (ServerUtils.isServerLagging()) return;
|
||||||
|
|
||||||
|
for(Player player : Bukkit.getOnlinePlayers()) {
|
||||||
|
PlayerStats stats = PlayerStatsHandler.getStats(player);
|
||||||
|
|
||||||
|
if(stats != null) {
|
||||||
|
int cps = stats.getLeftClickCPS();
|
||||||
|
|
||||||
|
if (cps >= 50 && ConfigFile.configuration.getBoolean("autobans")) {
|
||||||
|
try {
|
||||||
|
Bukkit.getPluginManager().callEvent(new PlayerCheatEvent(player, LocationUtils.getLocation(player), "AutoClicker &c[&4" + cps + " &cCPS]", player.getPing(), Bukkit.spigot().getTPS()[0]));
|
||||||
|
CheatHandler.log(player, "WAS AUTOBANNED FOR HAVING MORE THAN 50 CPS [" + cps + " CPS] ", "AutoClicker", LocationUtils.getLocation(player), player.getPing(), new DecimalFormat("##.##").format(Bukkit.spigot().getTPS()[0]));
|
||||||
|
} catch (IOException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
CheatHandler.handleBan(player);
|
||||||
|
} else if (cps >= 30) {
|
||||||
|
stats.setAutoclickerVL(stats.getAutoclickerVL() + 1);
|
||||||
|
Bukkit.getPluginManager().callEvent(new PlayerCheatEvent(player, LocationUtils.getLocation(player), "AutoClicker &c[&4" + cps + " &cCPS]", player.getPing(), Bukkit.spigot().getTPS()[0]));
|
||||||
|
} else if (cps >= 27 && butterfly.contains(player.getUniqueId())) {
|
||||||
|
Bukkit.getPluginManager().callEvent(new PlayerCheatEvent(player, LocationUtils.getLocation(player), "AutoClicker &c[&4" + cps + " &cCPS]", player.getPing(), Bukkit.spigot().getTPS()[0]));
|
||||||
|
} else if (cps >= 20) {
|
||||||
|
Bukkit.getPluginManager().callEvent(new PlayerCheatEvent(player, LocationUtils.getLocation(player), "AutoClicker &c[&4" + cps + " &cCPS]", player.getPing(), Bukkit.spigot().getTPS()[0]));
|
||||||
|
} else if (cps >= 10 && cps < 30) {
|
||||||
|
stats.setConstantCPS(stats.getConstantCPS() + 1);
|
||||||
|
|
||||||
|
ItemStack item = player.getItemInHand();
|
||||||
|
|
||||||
|
if(item != null && stats.getLastUseEntityPacket() < 2500) {
|
||||||
|
if(item.getType() == Material.POTION || item.getType() == Material.ENDER_PEARL || item.getType() == Material.COOKED_BEEF || item.getType() == Material.BAKED_POTATO) {
|
||||||
|
Bukkit.getPluginManager().callEvent(new PlayerCheatEvent(player, LocationUtils.getLocation(player), "AutoClicker (Item Swing)", player.getPing(), Bukkit.spigot().getTPS()[0]));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if(stats.getAutoclickerVL() > 0) {
|
||||||
|
stats.setAutoclickerVL(stats.getAutoclickerVL() - 1);
|
||||||
|
}
|
||||||
|
stats.setConstantCPS(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
stats.setLeftClickCPS(0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}.runTaskTimer(this.getInstance(), 20L, 20L);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void handleDoubleClick(Player player, PlayerStats stats) {
|
||||||
|
if(stats.getDoubleclick() > 25) {
|
||||||
|
stats.setDoubleclick(0);
|
||||||
|
Bukkit.getPluginManager().callEvent(new PlayerCheatEvent(player, LocationUtils.getLocation(player), "DoubleClick", player.getPing(), Bukkit.spigot().getTPS()[0]));
|
||||||
|
}
|
||||||
|
|
||||||
|
if(stats.getClick1() != 0) {
|
||||||
|
stats.setClick2(System.currentTimeMillis());
|
||||||
|
//Message.sendMessage("set click 2 " + time);
|
||||||
|
}
|
||||||
|
|
||||||
|
if(stats.getClick1() == 0) {
|
||||||
|
stats.setClick1(System.currentTimeMillis());
|
||||||
|
//Message.sendMessage("set click 1 " + time);
|
||||||
|
}
|
||||||
|
|
||||||
|
if(stats.getClick1() == 0 || stats.getClick2() == 0) return;
|
||||||
|
|
||||||
|
long difference = (stats.getClick2() - stats.getClick1());
|
||||||
|
|
||||||
|
if(difference <= 5) {
|
||||||
|
if(!butterfly.contains(player.getUniqueId()) && player.getPing() < 200) {
|
||||||
|
stats.setDoubleclick(stats.getDoubleclick() + 1);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
stats.setDoubleclick(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
stats.setClick1(0);
|
||||||
|
stats.setClick2(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void handleConstantCPS(Player player, PlayerStats stats) {
|
||||||
|
if(ConfigFile.configuration.getBoolean("autobans") && stats.getAutoclickerVL() > 10) {
|
||||||
|
try {
|
||||||
|
Bukkit.getPluginManager().callEvent(new PlayerCheatEvent(player, LocationUtils.getLocation(player), "AutoClicker (Constant - 30+)", player.getPing(), Bukkit.spigot().getTPS()[0]));
|
||||||
|
CheatHandler.log(player, "WAS AUTOBANNED FOR CONSTANT 30+ CPS", "AutoClicker", LocationUtils.getLocation(player), player.getPing(), new DecimalFormat("##.##").format(Bukkit.spigot().getTPS()[0]));
|
||||||
|
} catch (IOException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
CheatHandler.handleBan(player);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(stats.getConstantCPS() > 25) {
|
||||||
|
stats.setConstantCPS(0);
|
||||||
|
Bukkit.getPluginManager().callEvent(new PlayerCheatEvent(player, LocationUtils.getLocation(player), "AutoClicker (Constant - 10-30)", player.getPing(), Bukkit.spigot().getTPS()[0]));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void handleAutoClick(Player player, PlayerStats stats) {
|
||||||
|
if(player.getPing() > 350
|
||||||
|
|| !player.getLocation().getChunk().isLoaded()
|
||||||
|
|| player.isDead()
|
||||||
|
|| System.currentTimeMillis() - stats.getJoined() < 1000
|
||||||
|
|| System.currentTimeMillis() - stats.getLastBlockBreak() < 500)
|
||||||
|
return;
|
||||||
|
|
||||||
|
stats.setLeftClickCPS(stats.getLeftClickCPS() + 1);
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,52 @@
|
||||||
|
package secondlife.network.paik.checks.combat;
|
||||||
|
|
||||||
|
import org.bukkit.Bukkit;
|
||||||
|
import org.bukkit.Material;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
import org.bukkit.event.secondlife.PlayerCheatEvent;
|
||||||
|
import secondlife.network.paik.handlers.CheatHandler;
|
||||||
|
import secondlife.network.paik.handlers.data.PlayerStats;
|
||||||
|
import secondlife.network.paik.utils.LocationUtils;
|
||||||
|
import secondlife.network.paik.utils.ServerUtils;
|
||||||
|
import secondlife.network.paik.utils.file.ConfigFile;
|
||||||
|
|
||||||
|
public class FastBow {
|
||||||
|
|
||||||
|
public static void handleFastBowInteract(Player player, PlayerStats stats) {
|
||||||
|
if(ConfigFile.configuration.getBoolean("enabled") && ConfigFile.configuration.getBoolean("checks.fastbow")) {
|
||||||
|
if(ServerUtils.isServerLagging()
|
||||||
|
|| player.getItemInHand() == null
|
||||||
|
|| player.getItemInHand().getType() != Material.BOW
|
||||||
|
|| player.getAllowFlight()
|
||||||
|
|| player.isDead()) return;
|
||||||
|
|
||||||
|
stats.setPull(System.currentTimeMillis());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void handleFastBowShoot(Player player, PlayerStats stats, double power) {
|
||||||
|
if(ServerUtils.isServerLagging() || player.getPing() > 200) return;
|
||||||
|
|
||||||
|
if(stats.getBowVL() > 7) {
|
||||||
|
stats.setBowVL(0);
|
||||||
|
Bukkit.getPluginManager().callEvent(new PlayerCheatEvent(player, LocationUtils.getLocation(player), "FastBow", player.getPing(), Bukkit.spigot().getTPS()[0]));
|
||||||
|
|
||||||
|
if(!ConfigFile.configuration.getBoolean("autobans") || player.hasPermission("secondlife.staff")) return;
|
||||||
|
|
||||||
|
CheatHandler.handleBan(player);
|
||||||
|
}
|
||||||
|
|
||||||
|
Long time = System.currentTimeMillis() - stats.getPull();
|
||||||
|
Long timeLimit = 300L;
|
||||||
|
|
||||||
|
if(power > 2.5 && time < timeLimit) {
|
||||||
|
stats.setBowVL(stats.getBowVL() + 1);
|
||||||
|
} else {
|
||||||
|
if(stats.getBowVL() > 0) {
|
||||||
|
stats.setBowVL(stats.getBowVL() - 1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
stats.setPull(0);
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,45 @@
|
||||||
|
package secondlife.network.paik.checks.combat;
|
||||||
|
|
||||||
|
import org.bukkit.Bukkit;
|
||||||
|
import org.bukkit.GameMode;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
import org.bukkit.event.secondlife.PlayerCheatEvent;
|
||||||
|
import secondlife.network.paik.handlers.CheatHandler;
|
||||||
|
import secondlife.network.paik.handlers.data.PlayerStats;
|
||||||
|
import secondlife.network.paik.utils.LocationUtils;
|
||||||
|
import secondlife.network.paik.utils.ServerUtils;
|
||||||
|
import secondlife.network.paik.utils.file.ConfigFile;
|
||||||
|
|
||||||
|
public class FastEat {
|
||||||
|
|
||||||
|
public static void handleFastEat(Player player, PlayerStats stats) {
|
||||||
|
if(ConfigFile.configuration.getBoolean("enabled") && ConfigFile.configuration.getBoolean("checks.fasteat")) {
|
||||||
|
if(ServerUtils.isServerLagging()
|
||||||
|
|| player.isDead()
|
||||||
|
|| player.getVehicle() != null
|
||||||
|
|| player.getAllowFlight()
|
||||||
|
|| player.getGameMode() == GameMode.CREATIVE
|
||||||
|
|| player.getPing() > 350)
|
||||||
|
return;;
|
||||||
|
|
||||||
|
if(stats.getFastEatVL() > 4) {
|
||||||
|
stats.setFastEatVL(0);
|
||||||
|
Bukkit.getPluginManager().callEvent(new PlayerCheatEvent(player, LocationUtils.getLocation(player), "FastEat", player.getPing(), Bukkit.spigot().getTPS()[0]));
|
||||||
|
|
||||||
|
if(!ConfigFile.configuration.getBoolean("autobans") || player.hasPermission("secondlife.staff")) return;
|
||||||
|
|
||||||
|
CheatHandler.handleBan(player);
|
||||||
|
}
|
||||||
|
|
||||||
|
if(System.currentTimeMillis() - stats.getLastEat() < 1000) {
|
||||||
|
stats.setFastEatVL(stats.getFastEatVL() + 1);
|
||||||
|
} else {
|
||||||
|
if(stats.getFastEatVL() > 0) {
|
||||||
|
stats.setFastEatVL(stats.getFastEatVL() - 1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
stats.setLastEat(System.currentTimeMillis());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,195 @@
|
||||||
|
package secondlife.network.paik.checks.combat;
|
||||||
|
|
||||||
|
import net.minecraft.server.v1_7_R4.*;
|
||||||
|
import net.minecraft.util.com.mojang.authlib.GameProfile;
|
||||||
|
import org.bukkit.Bukkit;
|
||||||
|
import org.bukkit.GameMode;
|
||||||
|
import org.bukkit.Location;
|
||||||
|
import org.bukkit.Material;
|
||||||
|
import org.bukkit.block.Block;
|
||||||
|
import org.bukkit.craftbukkit.v1_7_R4.CraftServer;
|
||||||
|
import org.bukkit.craftbukkit.v1_7_R4.CraftWorld;
|
||||||
|
import org.bukkit.craftbukkit.v1_7_R4.entity.CraftPlayer;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
import org.bukkit.event.secondlife.PlayerCheatEvent;
|
||||||
|
import org.bukkit.scheduler.BukkitRunnable;
|
||||||
|
import secondlife.network.paik.Paik;
|
||||||
|
import secondlife.network.paik.handlers.CheatHandler;
|
||||||
|
import secondlife.network.paik.handlers.data.PlayerStats;
|
||||||
|
import secondlife.network.paik.utils.CheatUtils;
|
||||||
|
import secondlife.network.paik.utils.Handler;
|
||||||
|
import secondlife.network.paik.utils.LocationUtils;
|
||||||
|
import secondlife.network.paik.utils.ServerUtils;
|
||||||
|
import secondlife.network.paik.utils.file.ConfigFile;
|
||||||
|
|
||||||
|
import java.util.UUID;
|
||||||
|
|
||||||
|
public class Killaura extends Handler {
|
||||||
|
|
||||||
|
public static EntityPlayer npc;
|
||||||
|
|
||||||
|
public Killaura(Paik plugin) {
|
||||||
|
super(plugin);
|
||||||
|
|
||||||
|
npc = new EntityPlayer(((CraftServer) Bukkit.getServer()).getServer(), ((CraftWorld) Bukkit.getWorld("world")).getHandle(),
|
||||||
|
new GameProfile(UUID.randomUUID(), UUID.randomUUID().toString().substring(0, 14).replace("-", "")),
|
||||||
|
new PlayerInteractManager(((CraftWorld) Bukkit.getWorld("world")).getHandle()));
|
||||||
|
npc.viewDistance = 1;
|
||||||
|
npc.setSprinting(true);
|
||||||
|
npc.onGround = true;
|
||||||
|
npc.ping = CheatUtils.random(30, 100);
|
||||||
|
npc.expLevel = CheatUtils.random(3, 100);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void handleKillaura(Player player, PlayerStats stats) {
|
||||||
|
if(!ConfigFile.configuration.getBoolean("enabled") || ServerUtils.isServerLagging()) return;
|
||||||
|
|
||||||
|
if(ConfigFile.configuration.getBoolean("checks.killaura.packet")) {
|
||||||
|
handleKillauraPacket(player, stats);
|
||||||
|
}
|
||||||
|
|
||||||
|
if(ConfigFile.configuration.getBoolean("checks.killaura.dead")) {
|
||||||
|
handleKillauraDead(player, stats);
|
||||||
|
}
|
||||||
|
|
||||||
|
if(ConfigFile.configuration.getBoolean("checks.inventory.killaura")) {
|
||||||
|
handleKillauraInventory(player, stats);
|
||||||
|
}
|
||||||
|
|
||||||
|
if(ConfigFile.configuration.getBoolean("checks.killaura.bot")) {
|
||||||
|
handleTeleportBot(player, stats);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void handleKillauraBotCheck(Player player, int entityID) {
|
||||||
|
if(entityID == npc.getBukkitEntity().getEntityId()) {
|
||||||
|
Bukkit.getPluginManager().callEvent(new PlayerCheatEvent(player, LocationUtils.getLocation(player), "KillAura (Bot)", player.getPing(), Bukkit.spigot().getTPS()[0]));
|
||||||
|
|
||||||
|
if(ConfigFile.configuration.getBoolean("autobans") || !player.hasPermission("secondlife.staff")) return;
|
||||||
|
|
||||||
|
CheatHandler.handleBan(player);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void handleTeleportBot(Player player, PlayerStats stats) {
|
||||||
|
if(Bukkit.getOnlinePlayers().size() > 100 || player.getPing() > 300 || player.isDead()) return;
|
||||||
|
|
||||||
|
stats.setHits(stats.getHits() + 1);
|
||||||
|
|
||||||
|
if(stats.getHits() > 20) {
|
||||||
|
stats.setHits(0);
|
||||||
|
teleportBot(player);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void handleKillauraPacket(Player player, PlayerStats stats) {
|
||||||
|
if(player.getPing() > 300) return;
|
||||||
|
|
||||||
|
if(stats.getLastArmPacket() == 0 || stats.getLastUseEntityPacket() == 0) return;
|
||||||
|
|
||||||
|
if(stats.getNoSwingDamageVL() > 3) {
|
||||||
|
stats.setNoSwingDamageVL(0);
|
||||||
|
Bukkit.getPluginManager().callEvent(new PlayerCheatEvent(player, LocationUtils.getLocation(player), "KillAura (Swing)", player.getPing(), Bukkit.spigot().getTPS()[0]));
|
||||||
|
}
|
||||||
|
|
||||||
|
if(stats.getLastUseEntityPacket() - stats.getLastArmPacket() > 500) {
|
||||||
|
stats.setNoSwingDamageVL(stats.getNoSwingDamageVL() + 1);
|
||||||
|
} else {
|
||||||
|
stats.setNoSwingDamageVL(0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void handleKillauraDead(Player player, PlayerStats stats) {
|
||||||
|
if(stats.getHitsWhileDead() > 3) {
|
||||||
|
stats.setHitsWhileDead(0);
|
||||||
|
Bukkit.getPluginManager().callEvent(new PlayerCheatEvent(player, LocationUtils.getLocation(player), "KillAura (Dead)", player.getPing(), Bukkit.spigot().getTPS()[0]));
|
||||||
|
}
|
||||||
|
|
||||||
|
if(player.isDead()) {
|
||||||
|
stats.setHitsWhileDead(stats.getHitsWhileDead() + 1);
|
||||||
|
} else {
|
||||||
|
stats.setHitsWhileDead(0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void handleKillauraInventory(Player player, PlayerStats stats) {
|
||||||
|
if(player.getGameMode() != GameMode.SURVIVAL || System.currentTimeMillis() - stats.getJoined() < 1500) return;
|
||||||
|
|
||||||
|
if(stats.getHitsWhileInventoryOpen() > 3) {
|
||||||
|
stats.setHitsWhileInventoryOpen(0);
|
||||||
|
Bukkit.getPluginManager().callEvent(new PlayerCheatEvent(player, LocationUtils.getLocation(player), "Inventory Killaura", player.getPing(), Bukkit.spigot().getTPS()[0]));
|
||||||
|
}
|
||||||
|
|
||||||
|
if(!stats.isInventoryOpen()) return;
|
||||||
|
|
||||||
|
stats.setHitsWhileInventoryOpen(stats.getHitsWhileInventoryOpen() + 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void handleKillauraAngle(Player player, PlayerStats stats, float yaw, float pitch) {
|
||||||
|
if(ConfigFile.configuration.getBoolean("enabled") && ConfigFile.configuration.getBoolean("checks.killaura.angle")) {
|
||||||
|
if(stats.getAngle() > 20) {
|
||||||
|
stats.setAngle(0);
|
||||||
|
Bukkit.getPluginManager().callEvent(new PlayerCheatEvent(player, LocationUtils.getLocation(player), "Killaura (Angle)", player.getPing(), Bukkit.spigot().getTPS()[0]));
|
||||||
|
}
|
||||||
|
|
||||||
|
float diff = Math.abs((stats.getLastYaw() - yaw) + (stats.getLastPitch() - pitch));
|
||||||
|
|
||||||
|
if(diff < 35) {
|
||||||
|
if(stats.getAngle() > 0) {
|
||||||
|
stats.setAngle(stats.getAngle() - 1);
|
||||||
|
//Message.sendMessage(Color.translate("&cVerbose -1"));
|
||||||
|
}
|
||||||
|
} else if(diff >= 35 && diff < 500 && System.currentTimeMillis() - stats.getJoined() > 1500 && System.currentTimeMillis() - stats.getLastUseEntityPacket() < 1000) {
|
||||||
|
//Message.sendMessage(Color.translate("&aVerbose +1"));
|
||||||
|
stats.setAngle(stats.getAngle() + 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
stats.setLastYaw(yaw);
|
||||||
|
stats.setLastPitch(pitch);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void handleKillauraWall(Player player, PlayerStats stats) {
|
||||||
|
if(ConfigFile.configuration.getBoolean("enabled") && ConfigFile.configuration.getBoolean("checks.killaura.wall")) {
|
||||||
|
if(stats.getSwingAngle() > 7) {
|
||||||
|
stats.setSwingAngle(0);
|
||||||
|
Bukkit.getPluginManager().callEvent(new PlayerCheatEvent(player, LocationUtils.getLocation(player), "Killaura (Wall)", player.getPing(), Bukkit.spigot().getTPS()[0]));
|
||||||
|
}
|
||||||
|
|
||||||
|
if(stats.getLastEntity() == null || player.hasLineOfSight(stats.getLastEntity())) return;
|
||||||
|
|
||||||
|
Block block = player.getTargetBlock(null, 4);
|
||||||
|
|
||||||
|
if(block == null || block.getType() == Material.AIR || !block.getType().isSolid()) return;
|
||||||
|
|
||||||
|
if(System.currentTimeMillis() - stats.getLastBlockDigPacket() > 1000) {
|
||||||
|
if(System.currentTimeMillis() - stats.getLastUseEntityPacket() < 100) {
|
||||||
|
stats.setSwingAngle(stats.getSwingAngle() + 1);
|
||||||
|
//Message.sendMessage(Color.translate("&aVerbose +1"));
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
stats.setSwingAngle(0);
|
||||||
|
//Message.sendMessage(Color.translate("&cVerbose 0"));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void teleportBot(Player player) {
|
||||||
|
if(player.getLocation().getPitch() < -20.0) return;
|
||||||
|
|
||||||
|
npc.setInvisible(false);
|
||||||
|
PlayerConnection connection = ((CraftPlayer) player).getHandle().playerConnection;
|
||||||
|
Location loc = player.getLocation();
|
||||||
|
npc.setLocation(loc.getX(), loc.getY() + 4.5, loc.getZ(), loc.getPitch(), loc.getYaw());
|
||||||
|
connection.sendPacket(new PacketPlayOutPlayerInfo().addPlayer(npc));
|
||||||
|
connection.sendPacket(new PacketPlayOutNamedEntitySpawn((EntityHuman) npc));
|
||||||
|
|
||||||
|
new BukkitRunnable() {
|
||||||
|
public void run() {
|
||||||
|
npc.setInvisible(true);
|
||||||
|
connection.sendPacket(new PacketPlayOutPlayerInfo().removePlayer(npc));
|
||||||
|
connection.sendPacket(new PacketPlayOutEntityDestroy(npc.getBukkitEntity().getEntityId()));
|
||||||
|
}
|
||||||
|
}.runTaskLater(Paik.getInstance(), 2L);
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,77 @@
|
||||||
|
package secondlife.network.paik.checks.combat;
|
||||||
|
|
||||||
|
import org.bukkit.Bukkit;
|
||||||
|
import org.bukkit.GameMode;
|
||||||
|
import org.bukkit.entity.Entity;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
import org.bukkit.event.secondlife.PlayerCheatEvent;
|
||||||
|
import secondlife.network.paik.handlers.data.PlayerStats;
|
||||||
|
import secondlife.network.paik.utils.CheatUtils;
|
||||||
|
import secondlife.network.paik.utils.LocationUtils;
|
||||||
|
import secondlife.network.paik.utils.ServerUtils;
|
||||||
|
import secondlife.network.paik.utils.file.ConfigFile;
|
||||||
|
|
||||||
|
public class Reach {
|
||||||
|
|
||||||
|
public static void handleReachCheck(Player player, PlayerStats stats, int entityID) {
|
||||||
|
if(!ConfigFile.configuration.getBoolean("enabled")) return;
|
||||||
|
if(!ConfigFile.configuration.getBoolean("checks.reach")) return;
|
||||||
|
|
||||||
|
if(ServerUtils.isServerLagging()) return;
|
||||||
|
|
||||||
|
if(player.isDead()
|
||||||
|
|| player.getVehicle() != null
|
||||||
|
|| player.getAllowFlight()
|
||||||
|
|| player.getGameMode() == GameMode.CREATIVE
|
||||||
|
|| player.getPing() > 300)
|
||||||
|
return;
|
||||||
|
|
||||||
|
Entity hit = null;
|
||||||
|
|
||||||
|
if(player.getWorld().getEntities().size() > 0) {
|
||||||
|
for(Entity entity : player.getWorld().getEntities()) {
|
||||||
|
if(entity.getEntityId() == entityID) {
|
||||||
|
hit = entity;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if(hit == null) return;
|
||||||
|
if(!(hit instanceof Player)) return;
|
||||||
|
|
||||||
|
Player target = (Player) hit;
|
||||||
|
|
||||||
|
if(target.isDead()
|
||||||
|
|| target.getVehicle() != null
|
||||||
|
|| target.getAllowFlight()
|
||||||
|
|| target.getGameMode() == GameMode.CREATIVE
|
||||||
|
|| target.getPing() > 300)
|
||||||
|
return;
|
||||||
|
|
||||||
|
if(CheatUtils.direction(player) == CheatUtils.direction(target)) return;
|
||||||
|
|
||||||
|
if(stats.getReachVL() > 9) {
|
||||||
|
stats.setReachVL(0);
|
||||||
|
Bukkit.getPluginManager().callEvent(new PlayerCheatEvent(player, LocationUtils.getLocation(player), "Reach", player.getPing(), Bukkit.spigot().getTPS()[0]));
|
||||||
|
}
|
||||||
|
|
||||||
|
double reach = CheatUtils.getHorizontalDistance(player.getLocation(), target.getLocation()) - CheatUtils.getYDifference(player.getLocation(), target.getLocation());
|
||||||
|
double maxReach = 3.4;
|
||||||
|
double playerPing = player.getPing();
|
||||||
|
double entityPing = target.getPing();
|
||||||
|
double deltaXZ = stats.getDelta();
|
||||||
|
double entityDeltaXZ = target.getVelocity().length() > 0 ? target.getVelocity().length() : 0;
|
||||||
|
|
||||||
|
maxReach += (playerPing + entityPing) * 0.004;
|
||||||
|
maxReach += (deltaXZ + entityDeltaXZ) * 0.9;
|
||||||
|
maxReach += Math.abs(player.getEyeLocation().getYaw() - target.getLocation().getYaw()) * 0.004;
|
||||||
|
|
||||||
|
if(reach > maxReach) {
|
||||||
|
stats.setReachVL(stats.getReachVL() + 1);
|
||||||
|
} else {
|
||||||
|
if(stats.getReachVL() > 0) {
|
||||||
|
stats.setReachVL(stats.getReachVL() - 1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,40 @@
|
||||||
|
package secondlife.network.paik.checks.combat;
|
||||||
|
|
||||||
|
import org.bukkit.Bukkit;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
import org.bukkit.event.secondlife.PlayerCheatEvent;
|
||||||
|
import org.bukkit.potion.PotionEffectType;
|
||||||
|
import secondlife.network.paik.handlers.data.PlayerStats;
|
||||||
|
import secondlife.network.paik.utils.LocationUtils;
|
||||||
|
import secondlife.network.paik.utils.ServerUtils;
|
||||||
|
import secondlife.network.paik.utils.file.ConfigFile;
|
||||||
|
|
||||||
|
public class Regen {
|
||||||
|
|
||||||
|
public static void handleRegen(Player player, PlayerStats stats) {
|
||||||
|
if(ConfigFile.configuration.getBoolean("enabled") && ConfigFile.configuration.getBoolean("checks.regen")) {
|
||||||
|
if(ServerUtils.isServerLagging()) return;
|
||||||
|
|
||||||
|
if(player.getPing() > 250
|
||||||
|
|| player.hasPotionEffect(PotionEffectType.REGENERATION)
|
||||||
|
|| player.hasPotionEffect(PotionEffectType.HEAL))
|
||||||
|
return;
|
||||||
|
|
||||||
|
long now = System.currentTimeMillis();
|
||||||
|
|
||||||
|
if(stats.getRegenVL() > 2) {
|
||||||
|
stats.setRegenVL(0);
|
||||||
|
Bukkit.getPluginManager().callEvent(new PlayerCheatEvent(player, LocationUtils.getLocation(player), "Regen (Normal)", player.getPing(), Bukkit.spigot().getTPS()[0]));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (now - stats.getLastRegen() < 1000L) {
|
||||||
|
stats.setRegenVL(stats.getRegenVL() + 1);
|
||||||
|
} else {
|
||||||
|
stats.setLastRegen(now);
|
||||||
|
if(stats.getRegenVL() > 0) {
|
||||||
|
stats.setRegenVL(stats.getRegenVL() - 1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,47 @@
|
||||||
|
package secondlife.network.paik.checks.movement;
|
||||||
|
|
||||||
|
import org.bukkit.Bukkit;
|
||||||
|
import org.bukkit.GameMode;
|
||||||
|
import org.bukkit.Location;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
import org.bukkit.event.secondlife.PlayerCheatEvent;
|
||||||
|
import secondlife.network.paik.handlers.CheatHandler;
|
||||||
|
import secondlife.network.paik.handlers.data.PlayerStats;
|
||||||
|
import secondlife.network.paik.handlers.events.PlayerMoveByBlockEvent;
|
||||||
|
import secondlife.network.paik.utils.CheatUtils;
|
||||||
|
import secondlife.network.paik.utils.LocationUtils;
|
||||||
|
import secondlife.network.paik.utils.ServerUtils;
|
||||||
|
import secondlife.network.paik.utils.file.ConfigFile;
|
||||||
|
|
||||||
|
public class GroundSpoof {
|
||||||
|
|
||||||
|
public static void handleGroundSpoof(Player player, PlayerStats stats, PlayerMoveByBlockEvent event) {
|
||||||
|
if(ConfigFile.configuration.getBoolean("enabled") && ConfigFile.configuration.getBoolean("checks.groundspoof")) {
|
||||||
|
if(ServerUtils.isServerLagging()) return;
|
||||||
|
|
||||||
|
if(player.getGameMode() == GameMode.CREATIVE
|
||||||
|
|| player.getAllowFlight()
|
||||||
|
|| player.getVehicle() != null
|
||||||
|
|| player.getPing() > 200
|
||||||
|
|| !player.isOnGround()
|
||||||
|
|| !CheatUtils.isInAir(player)
|
||||||
|
|| CheatUtils.blocksNear(player))
|
||||||
|
return;
|
||||||
|
|
||||||
|
Location a = player.getLocation().subtract(0.0D, 1.0D, 0.0D);
|
||||||
|
|
||||||
|
if(CheatUtils.blocksNear(a) || CheatHandler.ignore.containsKey(player.getUniqueId()) && System.currentTimeMillis() < CheatHandler.ignore.get(player.getUniqueId())) return;
|
||||||
|
|
||||||
|
if(stats.getNofallVL() > 10) {
|
||||||
|
stats.setNofallVL(0);
|
||||||
|
Bukkit.getPluginManager().callEvent(new PlayerCheatEvent(player, LocationUtils.getLocation(player), "GroundSpoof", player.getPing(), Bukkit.spigot().getTPS()[0]));
|
||||||
|
}
|
||||||
|
|
||||||
|
if(player.getFallDistance() == 0.0 && event.getFrom().getY() > event.getTo().getY()) {
|
||||||
|
stats.setNofallVL(stats.getNofallVL() + 1);
|
||||||
|
} else {
|
||||||
|
stats.setNofallVL(0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,84 @@
|
||||||
|
package secondlife.network.paik.checks.movement;
|
||||||
|
|
||||||
|
import org.bukkit.Bukkit;
|
||||||
|
import org.bukkit.GameMode;
|
||||||
|
import org.bukkit.Location;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
import org.bukkit.event.secondlife.PlayerCheatEvent;
|
||||||
|
import org.bukkit.scheduler.BukkitRunnable;
|
||||||
|
import secondlife.network.paik.Paik;
|
||||||
|
import secondlife.network.paik.handlers.CheatHandler;
|
||||||
|
import secondlife.network.paik.handlers.data.PlayerStats;
|
||||||
|
import secondlife.network.paik.handlers.events.PlayerMoveByBlockEvent;
|
||||||
|
import secondlife.network.paik.utils.LocationUtils;
|
||||||
|
import secondlife.network.paik.utils.ServerUtils;
|
||||||
|
import secondlife.network.paik.utils.file.ConfigFile;
|
||||||
|
|
||||||
|
public class Inventory {
|
||||||
|
|
||||||
|
public static void handleInventoryClose(Player player, PlayerStats stats) {
|
||||||
|
stats.setInventoryOpen(false);
|
||||||
|
stats.setMovesWhileInventoryClosed(0);
|
||||||
|
stats.setHitsWhileInventoryOpen(0);
|
||||||
|
|
||||||
|
new BukkitRunnable() {
|
||||||
|
public void run() {
|
||||||
|
if(stats.isInventoryOpen()) {
|
||||||
|
stats.setInventoryOpen(false);
|
||||||
|
stats.setMovesWhileInventoryClosed(0);
|
||||||
|
stats.setHitsWhileInventoryOpen(0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}.runTaskLaterAsynchronously(Paik.getInstance(), 2L);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void handleInventoryMove(Player player, PlayerStats stats, PlayerMoveByBlockEvent event) {
|
||||||
|
if(ConfigFile.configuration.getBoolean("enabled") && ConfigFile.configuration.getBoolean("checks.inventory.move")) {
|
||||||
|
if(player.getPing() > 250
|
||||||
|
|| player.getAllowFlight()
|
||||||
|
|| player.getGameMode() == GameMode.CREATIVE)
|
||||||
|
return;
|
||||||
|
|
||||||
|
if(CheatHandler.ignore.containsKey(player.getUniqueId()) && System.currentTimeMillis() < CheatHandler.ignore.get(player.getUniqueId())) return;
|
||||||
|
|
||||||
|
if(System.currentTimeMillis() - stats.getJoined() < 1500) return;
|
||||||
|
|
||||||
|
if(stats.getMovesWhileInventoryClosed() > 10) {
|
||||||
|
stats.setMovesWhileInventoryClosed(0);
|
||||||
|
Bukkit.getPluginManager().callEvent(new PlayerCheatEvent(player, LocationUtils.getLocation(player), "Inventory Move", player.getPing(), Bukkit.spigot().getTPS()[0]));
|
||||||
|
}
|
||||||
|
|
||||||
|
if(!stats.isInventoryOpen()) return;
|
||||||
|
|
||||||
|
Location from = event.getFrom().clone();
|
||||||
|
Location to = event.getTo().clone();
|
||||||
|
|
||||||
|
from.setY(0.0D);
|
||||||
|
to.setY(0.0D);
|
||||||
|
|
||||||
|
Double distance = Double.valueOf(from.distance(to));
|
||||||
|
|
||||||
|
if(distance.doubleValue() > 0.25) {
|
||||||
|
stats.setMovesWhileInventoryClosed(stats.getMovesWhileInventoryClosed() + 1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void handleAutoPotion(Player player, PlayerStats stats) {
|
||||||
|
if(ConfigFile.configuration.getBoolean("enabled") && ConfigFile.configuration.getBoolean("checks.inventory.autopotion")) {
|
||||||
|
if(ServerUtils.isServerLagging()) return;
|
||||||
|
|
||||||
|
if(player.getGameMode() != GameMode.SURVIVAL) return;
|
||||||
|
|
||||||
|
if(stats.getPotionsSplashedWhileInventoryOpen() > 1) {
|
||||||
|
stats.setPotionsSplashedWhileInventoryOpen(0);
|
||||||
|
Bukkit.getPluginManager().callEvent(new PlayerCheatEvent(player, LocationUtils.getLocation(player), "AutoPotion", player.getPing(), Bukkit.spigot().getTPS()[0]));
|
||||||
|
}
|
||||||
|
|
||||||
|
if(!stats.isInventoryOpen()) return;
|
||||||
|
|
||||||
|
stats.setPotionsSplashedWhileInventoryOpen(stats.getPotionsSplashedWhileInventoryOpen() + 1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -0,0 +1,59 @@
|
||||||
|
package secondlife.network.paik.checks.movement;
|
||||||
|
|
||||||
|
import org.bukkit.Bukkit;
|
||||||
|
import org.bukkit.GameMode;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
import org.bukkit.event.secondlife.PlayerCheatEvent;
|
||||||
|
import secondlife.network.paik.handlers.data.PlayerStats;
|
||||||
|
import secondlife.network.paik.utils.LocationUtils;
|
||||||
|
import secondlife.network.paik.utils.ServerUtils;
|
||||||
|
import secondlife.network.paik.utils.file.ConfigFile;
|
||||||
|
|
||||||
|
public class NoSlowdown {
|
||||||
|
|
||||||
|
public static void handleNoSlowdownEating(Player player, PlayerStats stats) {
|
||||||
|
if(ConfigFile.configuration.getBoolean("enabled") && ConfigFile.configuration.getBoolean("checks.noslowdown.eating")) {
|
||||||
|
if(ServerUtils.isServerLagging()
|
||||||
|
|| player.isDead()
|
||||||
|
|| player.getVehicle() != null
|
||||||
|
|| player.getAllowFlight()
|
||||||
|
|| player.getGameMode() == GameMode.CREATIVE
|
||||||
|
|| player.getPing() > 350)
|
||||||
|
return;
|
||||||
|
|
||||||
|
if(stats.getNoslowFoodVl() > 2) {
|
||||||
|
stats.setNoslowFoodVl(0);
|
||||||
|
Bukkit.getPluginManager().callEvent(new PlayerCheatEvent(player, LocationUtils.getLocation(player), "NoSlowdown (Eating)", player.getPing(), Bukkit.spigot().getTPS()[0]));
|
||||||
|
}
|
||||||
|
|
||||||
|
if(player.isSprinting()) {
|
||||||
|
stats.setNoslowFoodVl(stats.getNoslowFoodVl() + 1);
|
||||||
|
} else {
|
||||||
|
stats.setNoslowFoodVl(0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void handleNoSlowdownShooting(Player player, PlayerStats stats) {
|
||||||
|
if(ConfigFile.configuration.getBoolean("enabled") && ConfigFile.configuration.getBoolean("checks.noslowdown.shooting")) {
|
||||||
|
if(ServerUtils.isServerLagging()
|
||||||
|
|| player.isDead()
|
||||||
|
|| player.getVehicle() != null
|
||||||
|
|| player.getAllowFlight()
|
||||||
|
|| player.getGameMode() == GameMode.CREATIVE
|
||||||
|
|| player.getPing() > 350)
|
||||||
|
return;
|
||||||
|
|
||||||
|
if(stats.getNoslowBowVl() > 2) {
|
||||||
|
stats.setNoslowBowVl(0);
|
||||||
|
Bukkit.getPluginManager().callEvent(new PlayerCheatEvent(player, LocationUtils.getLocation(player), "NoSlowdown (Shooting)", player.getPing(), Bukkit.spigot().getTPS()[0]));
|
||||||
|
}
|
||||||
|
|
||||||
|
if(player.isSprinting()) {
|
||||||
|
stats.setNoslowBowVl(stats.getNoslowBowVl() + 1);
|
||||||
|
} else {
|
||||||
|
stats.setNoslowBowVl(0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,50 @@
|
||||||
|
package secondlife.network.paik.checks.movement;
|
||||||
|
|
||||||
|
import org.bukkit.Bukkit;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
import org.bukkit.event.secondlife.PlayerCheatEvent;
|
||||||
|
import secondlife.network.paik.handlers.data.PlayerStats;
|
||||||
|
import secondlife.network.paik.utils.LocationUtils;
|
||||||
|
import secondlife.network.paik.utils.ServerUtils;
|
||||||
|
import secondlife.network.paik.utils.file.ConfigFile;
|
||||||
|
|
||||||
|
public class Sneak {
|
||||||
|
|
||||||
|
public static void handleSneak(Player player, PlayerStats stats) {
|
||||||
|
if(ConfigFile.configuration.getBoolean("enabled") && ConfigFile.configuration.getBoolean("checks.sneak")) {
|
||||||
|
if(ServerUtils.isServerLagging()
|
||||||
|
|| player.isDead()
|
||||||
|
|| System.currentTimeMillis() - stats.getLastBlockPlace() < 1000
|
||||||
|
|| System.currentTimeMillis() - stats.getJoined() < 1500)
|
||||||
|
return;
|
||||||
|
|
||||||
|
if(stats.getSneakVL() > 50) {
|
||||||
|
stats.setSneakVL(0);
|
||||||
|
Bukkit.getPluginManager().callEvent(new PlayerCheatEvent(player, LocationUtils.getLocation(player), "Sneak", player.getPing(), Bukkit.spigot().getTPS()[0]));
|
||||||
|
}
|
||||||
|
|
||||||
|
if(player.isSneaking()) {
|
||||||
|
if(stats.getSneak1() != 0) {
|
||||||
|
stats.setSneak2(System.currentTimeMillis());
|
||||||
|
}
|
||||||
|
|
||||||
|
if(stats.getSneak1() == 0) {
|
||||||
|
stats.setSneak1(System.currentTimeMillis());
|
||||||
|
}
|
||||||
|
|
||||||
|
if(stats.getSneak1() == 0 || stats.getSneak2() == 0) return;
|
||||||
|
|
||||||
|
long diff = (stats.getSneak2() - stats.getSneak1());
|
||||||
|
|
||||||
|
if(diff < 150) {
|
||||||
|
stats.setSneakVL(stats.getSneakVL() + 1);
|
||||||
|
} else {
|
||||||
|
stats.setSneakVL(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
stats.setSneak1(0);
|
||||||
|
stats.setSneak2(0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,513 @@
|
||||||
|
package secondlife.network.paik.checks.movement;
|
||||||
|
|
||||||
|
import net.minecraft.server.v1_7_R4.EntityPlayer;
|
||||||
|
import net.minecraft.server.v1_7_R4.MobEffectList;
|
||||||
|
import org.bukkit.Bukkit;
|
||||||
|
import org.bukkit.GameMode;
|
||||||
|
import org.bukkit.Location;
|
||||||
|
import org.bukkit.craftbukkit.v1_7_R4.entity.CraftPlayer;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
import org.bukkit.event.secondlife.PlayerCheatEvent;
|
||||||
|
import org.bukkit.potion.PotionEffect;
|
||||||
|
import org.bukkit.potion.PotionEffectType;
|
||||||
|
import secondlife.network.paik.Paik;
|
||||||
|
import secondlife.network.paik.handlers.CheatHandler;
|
||||||
|
import secondlife.network.paik.handlers.data.PlayerStats;
|
||||||
|
import secondlife.network.paik.handlers.data.PlayerStatsHandler;
|
||||||
|
import secondlife.network.paik.handlers.events.PlayerMoveByBlockEvent;
|
||||||
|
import secondlife.network.paik.utils.CheatUtils;
|
||||||
|
import secondlife.network.paik.utils.Handler;
|
||||||
|
import secondlife.network.paik.utils.LocationUtils;
|
||||||
|
import secondlife.network.paik.utils.ServerUtils;
|
||||||
|
import secondlife.network.paik.utils.file.ConfigFile;
|
||||||
|
|
||||||
|
import java.text.DecimalFormat;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
|
||||||
|
public class Speed extends Handler {
|
||||||
|
|
||||||
|
public static ArrayList<Double> speeds;
|
||||||
|
public static ArrayList<Double> speeds1;
|
||||||
|
public static ArrayList<Double> speeds2;
|
||||||
|
public static ArrayList<Double> speeds3;
|
||||||
|
public static ArrayList<Double> speeds4;
|
||||||
|
public static ArrayList<Double> speeds5;
|
||||||
|
|
||||||
|
public Speed(Paik plugin) {
|
||||||
|
super(plugin);
|
||||||
|
|
||||||
|
speeds = new ArrayList<Double>();
|
||||||
|
speeds1 = new ArrayList<Double>();
|
||||||
|
speeds2 = new ArrayList<Double>();
|
||||||
|
speeds3 = new ArrayList<Double>();
|
||||||
|
speeds4 = new ArrayList<Double>();
|
||||||
|
speeds5 = new ArrayList<Double>();
|
||||||
|
|
||||||
|
// ARTIX - MINEMEN
|
||||||
|
speeds.add(0.5274);
|
||||||
|
speeds1.add(0.5529);
|
||||||
|
speeds2.add(0.5783);
|
||||||
|
speeds3.add(0.6038);
|
||||||
|
speeds4.add(0.6293);
|
||||||
|
speeds5.add(0.6548);
|
||||||
|
|
||||||
|
// ARTIX - SLOWHOP
|
||||||
|
speeds.add(0.2870);
|
||||||
|
speeds1.add(0.3444);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void handleSpeed(Player player, PlayerStats stats, PlayerMoveByBlockEvent event) {
|
||||||
|
if(ConfigFile.configuration.getBoolean("enabled") && ConfigFile.configuration.getBoolean("checks.speed")) {
|
||||||
|
if(ServerUtils.isServerLagging()) {
|
||||||
|
if(!CheatHandler.ignore.isEmpty()) {
|
||||||
|
CheatHandler.ignore.clear();
|
||||||
|
}
|
||||||
|
if(!CheatHandler.ignoreJump.isEmpty()) {
|
||||||
|
CheatHandler.ignoreJump.clear();
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(player.getWalkSpeed() != 0.2F
|
||||||
|
|| player.getGameMode() == GameMode.CREATIVE
|
||||||
|
|| player.getAllowFlight()
|
||||||
|
|| player.getVehicle() != null
|
||||||
|
|| CheatUtils.isUnderBlock(player)
|
||||||
|
|| CheatUtils.isInLiquid(player)
|
||||||
|
|| CheatUtils.isOnHalfBlocks(player)
|
||||||
|
|| !CheatUtils.isOnSolidBlock(player)
|
||||||
|
|| !CheatUtils.isOnSolidBlocks(player)
|
||||||
|
|| CheatUtils.isOnSnow(player)
|
||||||
|
|| CheatUtils.isInAir(player))
|
||||||
|
return;
|
||||||
|
|
||||||
|
if(CheatHandler.ignore.containsKey(player.getUniqueId()) && System.currentTimeMillis() < CheatHandler.ignore.get(player.getUniqueId())) return;
|
||||||
|
|
||||||
|
if(CheatUtils.isOnIce(player)) {
|
||||||
|
CheatHandler.ignore.put(player.getUniqueId(), System.currentTimeMillis() + 1000);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
for(PotionEffect potionEffect : player.getActivePotionEffects()) {
|
||||||
|
if((potionEffect.getType().equals(PotionEffectType.SPEED)) && (potionEffect.getAmplifier() >= 5)) return;
|
||||||
|
}
|
||||||
|
|
||||||
|
Location from = event.getFrom().clone();
|
||||||
|
Location to = event.getTo().clone();
|
||||||
|
|
||||||
|
if(to.getX() == from.getX() || to.getZ() == from.getZ()) return;
|
||||||
|
|
||||||
|
from.setY(0);
|
||||||
|
to.setY(0);
|
||||||
|
|
||||||
|
Double distance = Double.valueOf(from.distance(to));
|
||||||
|
|
||||||
|
if(stats.getSpeedFast() > 1) {
|
||||||
|
stats.setSpeedFast(0);
|
||||||
|
Bukkit.getPluginManager().callEvent(new PlayerCheatEvent(player, LocationUtils.getLocation(player), "Speed (Fast)", player.getPing(), Bukkit.spigot().getTPS()[0]));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(distance > 4.25) {
|
||||||
|
stats.setSpeedFast(stats.getSpeedFast() + 1);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(player.getPing() > 200) {
|
||||||
|
removeJumpOne(player);
|
||||||
|
removeOne(player);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
DecimalFormat dc = new DecimalFormat("#.####");
|
||||||
|
|
||||||
|
/*if(player.isOnGround()) {
|
||||||
|
Message.sendMessage("<EFBFBD>c" + player.getName() + " GROUND " + String.valueOf(dc.format(distance)));
|
||||||
|
} else {
|
||||||
|
Message.sendMessage("<EFBFBD>a" + player.getName() + " AIR " + String.valueOf(dc.format(distance)));
|
||||||
|
}*/
|
||||||
|
|
||||||
|
if(stats.getSpeedJumpVL() > 20) {
|
||||||
|
stats.setSpeedJumpVL(0);
|
||||||
|
Bukkit.getPluginManager().callEvent(new PlayerCheatEvent(player, LocationUtils.getLocation(player), "Speed (Ground)", player.getPing(), Bukkit.spigot().getTPS()[0]));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(stats.getSpeedVL() > 10) {
|
||||||
|
stats.setSpeedVL(0);
|
||||||
|
Bukkit.getPluginManager().callEvent(new PlayerCheatEvent(player, LocationUtils.getLocation(player), "Speed (Hop / Air)", player.getPing(), Bukkit.spigot().getTPS()[0]));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(stats.getSpeedOtherVL() > 10) {
|
||||||
|
stats.setSpeedOtherVL(0);
|
||||||
|
Bukkit.getPluginManager().callEvent(new PlayerCheatEvent(player, LocationUtils.getLocation(player), "Speed (Hop / Air)", player.getPing(), Bukkit.spigot().getTPS()[0]));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(stats.getSpeedSlowhopVL() > 10) {
|
||||||
|
stats.setSpeedSlowhopVL(0);
|
||||||
|
Bukkit.getPluginManager().callEvent(new PlayerCheatEvent(player, LocationUtils.getLocation(player), "Speed (Slow / Packet)", player.getPing(), Bukkit.spigot().getTPS()[0]));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*if(stats.getSpritingandblockingVL() > 5) {
|
||||||
|
stats.setSpritingandblockingVL(0);
|
||||||
|
Bukkit.getPluginManager().callEvent(new PlayerCheatEvent(player, LocationUtils.getLocation(player), "Speed (AutoBlock)", player.getPing(), Bukkit.spigot().getTPS()[0]));
|
||||||
|
return;
|
||||||
|
}*/
|
||||||
|
|
||||||
|
if(player.isSprinting()) {
|
||||||
|
if(player.getFoodLevel() <= 5) {
|
||||||
|
Bukkit.getPluginManager().callEvent(new PlayerCheatEvent(player, LocationUtils.getLocation(player), "Speed (Fake Sprint)", player.getPing(), Bukkit.spigot().getTPS()[0]));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
/*if(player.isBlocking()) {
|
||||||
|
stats.setSpritingandblockingVL(stats.getSpritingandblockingVL() + 1);
|
||||||
|
return;
|
||||||
|
} else {
|
||||||
|
if(stats.getSpritingandblockingVL() > 0) {
|
||||||
|
stats.setSpritingandblockingVL(stats.getSpritingandblockingVL() - 1);
|
||||||
|
}
|
||||||
|
}*/
|
||||||
|
}
|
||||||
|
|
||||||
|
/*if(stats.getSpeedSneak() > 10) {
|
||||||
|
stats.setSpeedSneak(0);
|
||||||
|
Bukkit.getPluginManager().callEvent(new PlayerCheatEvent(player, LocationUtils.getLocation(player), "Speed (Sneak)", player.getPing(), Bukkit.spigot().getTPS()[0]));
|
||||||
|
return;
|
||||||
|
}*/
|
||||||
|
|
||||||
|
if(player.isOnGround() && from.getY() == to.getY()) {
|
||||||
|
if((!CheatHandler.ignoreJump.containsKey(player.getUniqueId())) || (CheatHandler.ignoreJump.containsKey(player.getUniqueId()) && System.currentTimeMillis() > CheatHandler.ignoreJump.get(player.getUniqueId()))) {
|
||||||
|
if(isGroundSpeeding(player, distance)) {
|
||||||
|
stats.setSpeedJumpVL(stats.getSpeedJumpVL() + 1);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/*if(player.isSneaking()) {
|
||||||
|
if(this.isSneakSpeeding(player, distance)) {
|
||||||
|
stats.setSpeedSneak(stats.getSpeedSneak() + 1);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
stats.setSpeedSneak(0);
|
||||||
|
}*/
|
||||||
|
|
||||||
|
if(!player.isOnGround() && isAirSpeeding(player, distance)) {
|
||||||
|
stats.setSpeedVL(stats.getSpeedVL() + 1);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(player.isOnGround() && isOtherSpeeding(player, distance)) {
|
||||||
|
stats.setSpeedOtherVL(stats.getSpeedOtherVL() + 1);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(isBypassingSpeeding(player, distance) || isSlowHopSpeeding(player, distance)) {
|
||||||
|
stats.setSpeedSlowhopVL(stats.getSpeedSlowhopVL() + 1);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void removeOne(Player player) {
|
||||||
|
PlayerStats stats = PlayerStatsHandler.getStats(player);
|
||||||
|
|
||||||
|
if(stats.getSpeedVL() > 0) {
|
||||||
|
stats.setSpeedVL(stats.getSpeedVL() - 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
if(stats.getSpeedOtherVL() > 0) {
|
||||||
|
stats.setSpeedOtherVL(stats.getSpeedOtherVL() - 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
if(stats.getSpeedSlowhopVL() > 0) {
|
||||||
|
stats.setSpeedSlowhopVL(stats.getSpeedSlowhopVL() - 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
/*if(stats.getSpeedSneak() > 0) {
|
||||||
|
stats.setSpeedSneak(stats.getSpeedSneak() - 1);
|
||||||
|
}*/
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void removeJumpOne(Player player) {
|
||||||
|
PlayerStats stats = PlayerStatsHandler.getStats(player);
|
||||||
|
|
||||||
|
stats.setSpeedJumpVL(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static boolean isGroundSpeeding(Player player, double distance) {
|
||||||
|
EntityPlayer mcPlayer = ((CraftPlayer) player).getHandle();
|
||||||
|
boolean hasSpeed = mcPlayer.hasEffect(MobEffectList.FASTER_MOVEMENT);
|
||||||
|
|
||||||
|
double limit = 10;
|
||||||
|
|
||||||
|
if(hasSpeed) {
|
||||||
|
//Message.sendMessage(String.valueOf(player.getName() + " " + mcPlayer.getEffect(MobEffectList.FASTER_MOVEMENT).getAmplifier()));
|
||||||
|
switch(mcPlayer.getEffect(MobEffectList.FASTER_MOVEMENT).getAmplifier()) {
|
||||||
|
case 0:
|
||||||
|
limit = 0.3467;
|
||||||
|
break;
|
||||||
|
case 1:
|
||||||
|
limit = 0.4029;
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
limit = 0.4590;
|
||||||
|
break;
|
||||||
|
case 3:
|
||||||
|
limit = 0.5151;
|
||||||
|
break;
|
||||||
|
case 4:
|
||||||
|
limit = 0.5712;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
limit = 0.2906;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(distance > limit) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static boolean isBypassingSpeeding(Player player, double distance) {
|
||||||
|
double limit = 10;
|
||||||
|
double limit2 = 10;
|
||||||
|
|
||||||
|
DecimalFormat dc = new DecimalFormat("#.####");
|
||||||
|
|
||||||
|
Double moved = Double.valueOf(dc.format(distance).replaceAll(",", "."));
|
||||||
|
|
||||||
|
EntityPlayer mcPlayer = ((CraftPlayer) player).getHandle();
|
||||||
|
boolean hasSpeed = mcPlayer.hasEffect(MobEffectList.FASTER_MOVEMENT);
|
||||||
|
|
||||||
|
if(hasSpeed) {
|
||||||
|
//Message.sendMessage(String.valueOf(player.getName() + " " + mcPlayer.getEffect(MobEffectList.FASTER_MOVEMENT).getAmplifier()));
|
||||||
|
switch(mcPlayer.getEffect(MobEffectList.FASTER_MOVEMENT).getAmplifier()) {
|
||||||
|
case 0:
|
||||||
|
if(speeds1.contains(moved)) {
|
||||||
|
limit = (speeds1.get((int) moved.doubleValue()) - 0.0001);
|
||||||
|
limit2 = (speeds1.get((int) moved.doubleValue()) + 0.0001);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case 1:
|
||||||
|
if(speeds2.contains(moved)) {
|
||||||
|
limit = (speeds2.get((int) moved.doubleValue()) - 0.0001);
|
||||||
|
limit2 = (speeds2.get((int) moved.doubleValue()) + 0.0001);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
if(speeds3.contains(moved)) {
|
||||||
|
limit = (speeds3.get((int) moved.doubleValue()) - 0.0001);
|
||||||
|
limit2 = (speeds3.get((int) moved.doubleValue()) + 0.0001);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case 3:
|
||||||
|
if(speeds4.contains(moved)) {
|
||||||
|
limit = (speeds4.get((int) moved.doubleValue()) - 0.0001);
|
||||||
|
limit2 = (speeds4.get((int) moved.doubleValue()) + 0.0001);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case 4:
|
||||||
|
if(speeds5.contains(moved)) {
|
||||||
|
limit = (speeds5.get((int) moved.doubleValue()) - 0.0001);
|
||||||
|
limit2 = (speeds5.get((int) moved.doubleValue()) + 0.0001);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if(speeds.contains(moved)) {
|
||||||
|
limit = (speeds.get((int) moved.doubleValue()) - 0.0001);
|
||||||
|
limit2 = (speeds.get((int) moved.doubleValue()) + 0.0001);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if((distance > limit) && (distance < limit2)) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*public boolean isSneakSpeeding(Player player, double distance) {
|
||||||
|
double limit = 10;
|
||||||
|
|
||||||
|
EntityPlayer mcPlayer = ((CraftPlayer) player).getHandle();
|
||||||
|
boolean hasSpeed = mcPlayer.hasEffect(MobEffectList.FASTER_MOVEMENT);
|
||||||
|
|
||||||
|
if(hasSpeed) {
|
||||||
|
//Message.sendMessage(String.valueOf(player.getName() + " " + mcPlayer.getEffect(MobEffectList.FASTER_MOVEMENT).getAmplifier()));
|
||||||
|
switch(mcPlayer.getEffect(MobEffectList.FASTER_MOVEMENT).getAmplifier()) {
|
||||||
|
case 0:
|
||||||
|
limit = 0.0877;
|
||||||
|
break;
|
||||||
|
case 1:
|
||||||
|
limit = 0.1007;
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
limit = 0.1036;
|
||||||
|
break;
|
||||||
|
case 3:
|
||||||
|
limit = 0.1266;
|
||||||
|
break;
|
||||||
|
case 4:
|
||||||
|
limit = 0.1395;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
limit = 0.0748;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(distance > limit) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}*/
|
||||||
|
|
||||||
|
|
||||||
|
public static boolean isAirSpeeding(Player player, double distance) {
|
||||||
|
double limit = 10;
|
||||||
|
|
||||||
|
EntityPlayer mcPlayer = ((CraftPlayer) player).getHandle();
|
||||||
|
boolean hasSpeed = mcPlayer.hasEffect(MobEffectList.FASTER_MOVEMENT);
|
||||||
|
|
||||||
|
if(hasSpeed) {
|
||||||
|
//Message.sendMessage(String.valueOf(player.getName() + " " + mcPlayer.getEffect(MobEffectList.FASTER_MOVEMENT).getAmplifier()));
|
||||||
|
switch(mcPlayer.getEffect(MobEffectList.FASTER_MOVEMENT).getAmplifier()) {
|
||||||
|
case 0:
|
||||||
|
limit = 0.3869;
|
||||||
|
break;
|
||||||
|
case 1:
|
||||||
|
limit = 0.4042;
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
limit = 0.4215;
|
||||||
|
break;
|
||||||
|
case 3:
|
||||||
|
limit = 0.4387;
|
||||||
|
break;
|
||||||
|
case 4:
|
||||||
|
limit = 0.4513;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
limit = 0.3696;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(distance > limit) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static boolean isOtherSpeeding(Player player, double distance) {
|
||||||
|
double limit = 10;
|
||||||
|
|
||||||
|
EntityPlayer mcPlayer = ((CraftPlayer) player).getHandle();
|
||||||
|
boolean hasSpeed = mcPlayer.hasEffect(MobEffectList.FASTER_MOVEMENT);
|
||||||
|
|
||||||
|
if(hasSpeed) {
|
||||||
|
//Message.sendMessage(String.valueOf(player.getName() + " " + mcPlayer.getEffect(MobEffectList.FASTER_MOVEMENT).getAmplifier()));
|
||||||
|
switch(mcPlayer.getEffect(MobEffectList.FASTER_MOVEMENT).getAmplifier()) {
|
||||||
|
case 0:
|
||||||
|
limit = 0.6538;
|
||||||
|
break;
|
||||||
|
case 1:
|
||||||
|
limit = 0.6854;
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
limit = 0.7170;
|
||||||
|
break;
|
||||||
|
case 3:
|
||||||
|
limit = 0.7485;
|
||||||
|
break;
|
||||||
|
case 4:
|
||||||
|
limit = 0.7801;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
limit = 0.6222;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(distance > limit) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static boolean isSlowHopSpeeding(Player player, double distance) {
|
||||||
|
double limit = 10;
|
||||||
|
double limit2 = 10;
|
||||||
|
|
||||||
|
EntityPlayer mcPlayer = ((CraftPlayer) player).getHandle();
|
||||||
|
boolean hasSpeed = mcPlayer.hasEffect(MobEffectList.FASTER_MOVEMENT);
|
||||||
|
|
||||||
|
if(hasSpeed) {
|
||||||
|
//Message.sendMessage(String.valueOf(player.getName() + " " + mcPlayer.getEffect(MobEffectList.FASTER_MOVEMENT).getAmplifier()));
|
||||||
|
switch(mcPlayer.getEffect(MobEffectList.FASTER_MOVEMENT).getAmplifier()) {
|
||||||
|
case 0:
|
||||||
|
limit = 0.3443;
|
||||||
|
limit2 = 0.3445;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
limit = 0.2869;
|
||||||
|
limit2 = 0.2871;
|
||||||
|
}
|
||||||
|
|
||||||
|
if((distance > limit) && (distance < limit2)) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*public boolean isMinemenSpeeding(Player player, double distance) {
|
||||||
|
double limit = 10;
|
||||||
|
double limit2 = 10;
|
||||||
|
|
||||||
|
if(player.hasPotionEffect(PotionEffectType.SPEED)) {
|
||||||
|
for(PotionEffect potionEffect : player.getActivePotionEffects()) {
|
||||||
|
switch(potionEffect.getAmplifier()) {
|
||||||
|
case 0:
|
||||||
|
limit = 0.5528;
|
||||||
|
limit2 = 0.5530;
|
||||||
|
break;
|
||||||
|
case 1:
|
||||||
|
limit = 0.5782;
|
||||||
|
limit2 = 0.5784;
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
limit = 0.6037;
|
||||||
|
limit2 = 0.6039;
|
||||||
|
break;
|
||||||
|
case 3:
|
||||||
|
limit = 0.6292;
|
||||||
|
limit2 = 0.6294;
|
||||||
|
break;
|
||||||
|
case 4:
|
||||||
|
limit = 0.6547;
|
||||||
|
limit2 = 0.6549;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
limit = 0.5273;
|
||||||
|
limit2 = 0.5275;
|
||||||
|
}
|
||||||
|
|
||||||
|
if((distance > limit) && (distance < limit2)) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}*/
|
||||||
|
}
|
|
@ -0,0 +1,176 @@
|
||||||
|
package secondlife.network.paik.checks.movement;
|
||||||
|
|
||||||
|
import org.bukkit.Bukkit;
|
||||||
|
import org.bukkit.GameMode;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
import org.bukkit.event.secondlife.PlayerCheatEvent;
|
||||||
|
import org.bukkit.scheduler.BukkitRunnable;
|
||||||
|
import secondlife.network.paik.Paik;
|
||||||
|
import secondlife.network.paik.handlers.CheatHandler;
|
||||||
|
import secondlife.network.paik.handlers.data.PlayerStats;
|
||||||
|
import secondlife.network.paik.handlers.data.PlayerStatsHandler;
|
||||||
|
import secondlife.network.paik.utils.Handler;
|
||||||
|
import secondlife.network.paik.utils.LocationUtils;
|
||||||
|
import secondlife.network.paik.utils.ServerUtils;
|
||||||
|
import secondlife.network.paik.utils.file.ConfigFile;
|
||||||
|
|
||||||
|
public class Timer extends Handler {
|
||||||
|
|
||||||
|
public Timer(Paik plugin) {
|
||||||
|
super(plugin);
|
||||||
|
|
||||||
|
this.getPackets();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void handleTimerFlying(Player player, PlayerStats stats) {
|
||||||
|
if(!ConfigFile.configuration.getBoolean("enabled")) return;
|
||||||
|
if(!ConfigFile.configuration.getBoolean("checks.timer.standing")) return;
|
||||||
|
|
||||||
|
if(ServerUtils.isServerLagging()) return;
|
||||||
|
|
||||||
|
if(CheatHandler.ignore.containsKey(player.getUniqueId()) && System.currentTimeMillis() < CheatHandler.ignore.get(player.getUniqueId())) return;
|
||||||
|
|
||||||
|
if(player.getPing() > 175
|
||||||
|
|| player.getAllowFlight()
|
||||||
|
|| player.getGameMode() == GameMode.CREATIVE)
|
||||||
|
return;
|
||||||
|
|
||||||
|
if(System.currentTimeMillis() - stats.getJoined() < 1500) return;
|
||||||
|
|
||||||
|
stats.setFlyingPackets(stats.getFlyingPackets() + 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void handleTimerPosition(Player player, PlayerStats stats) {
|
||||||
|
if(!ConfigFile.configuration.getBoolean("enabled")) return;
|
||||||
|
if(!ConfigFile.configuration.getBoolean("checks.timer.moving")) return;
|
||||||
|
|
||||||
|
if(ServerUtils.isServerLagging()) return;
|
||||||
|
|
||||||
|
if(player.getPing() > 250
|
||||||
|
|| player.getAllowFlight()
|
||||||
|
|| player.getGameMode() == GameMode.CREATIVE)
|
||||||
|
return;
|
||||||
|
|
||||||
|
if(CheatHandler.ignore.containsKey(player.getUniqueId()) && System.currentTimeMillis() < CheatHandler.ignore.get(player.getUniqueId())) return;
|
||||||
|
|
||||||
|
if(System.currentTimeMillis() - stats.getJoined() < 1500) return;
|
||||||
|
|
||||||
|
stats.setPositionPackets(stats.getPositionPackets() + 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void handleTimerPositionLook(Player player, PlayerStats stats) {
|
||||||
|
if(!ConfigFile.configuration.getBoolean("enabled")) return;
|
||||||
|
if(!ConfigFile.configuration.getBoolean("checks.timer.looking")) return;
|
||||||
|
|
||||||
|
if(ServerUtils.isServerLagging()) return;
|
||||||
|
|
||||||
|
if(player.getPing() > 250
|
||||||
|
|| player.getAllowFlight()
|
||||||
|
|| player.getGameMode() == GameMode.CREATIVE)
|
||||||
|
return;
|
||||||
|
|
||||||
|
if(CheatHandler.ignore.containsKey(player.getUniqueId()) && System.currentTimeMillis() < CheatHandler.ignore.get(player.getUniqueId())) return;
|
||||||
|
|
||||||
|
if(System.currentTimeMillis() - stats.getJoined() < 1500) return;
|
||||||
|
|
||||||
|
stats.setPositionLookPackets(stats.getPositionLookPackets() + 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void getPackets() {
|
||||||
|
new BukkitRunnable() {
|
||||||
|
public void run() {
|
||||||
|
if(!ConfigFile.configuration.getBoolean("enabled")) return;
|
||||||
|
if (ServerUtils.isServerLagging()) return;
|
||||||
|
|
||||||
|
for (Player player : Bukkit.getOnlinePlayers()) {
|
||||||
|
PlayerStats stats = PlayerStatsHandler.getStats(player);
|
||||||
|
|
||||||
|
if (stats != null) {
|
||||||
|
// FLYING PACKET
|
||||||
|
if(ConfigFile.configuration.getBoolean("checks.timer.standing")) {
|
||||||
|
int packets = stats.getFlyingPackets();
|
||||||
|
|
||||||
|
if(stats.getTimerAVL() > 20) {
|
||||||
|
stats.setTimerAVL(0);
|
||||||
|
Bukkit.getPluginManager().callEvent(new PlayerCheatEvent(player, LocationUtils.getLocation(player), "Timer (Standing)", player.getPing(), Bukkit.spigot().getTPS()[0]));
|
||||||
|
}
|
||||||
|
|
||||||
|
if(packets > 23) {
|
||||||
|
stats.setTimerAVL(stats.getTimerAVL() + 6);
|
||||||
|
//Message.sendMessage(Color.translate("&aVerbose: +6"));
|
||||||
|
} else if(packets > 19 && packets <= 23) {
|
||||||
|
stats.setTimerAVL(stats.getTimerAVL() + 3);
|
||||||
|
//Message.sendMessage(Color.translate("&aVerbose: +3"));
|
||||||
|
} else if(packets <= 19){
|
||||||
|
if(stats.getTimerAVL() > 0) {
|
||||||
|
stats.setTimerAVL(stats.getTimerAVL() - 1);
|
||||||
|
//Message.sendMessage(Color.translate("&cVerbose: -1"));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
stats.setFlyingPackets(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
// POSITION PACKET
|
||||||
|
if(ConfigFile.configuration.getBoolean("checks.timer.moving")) {
|
||||||
|
int packets = stats.getPositionPackets();
|
||||||
|
|
||||||
|
if(stats.getTimerBVL() > 20) {
|
||||||
|
stats.setTimerBVL(0);
|
||||||
|
Bukkit.getPluginManager().callEvent(new PlayerCheatEvent(player, LocationUtils.getLocation(player), "Timer (Moving)", player.getPing(), Bukkit.spigot().getTPS()[0]));
|
||||||
|
}
|
||||||
|
|
||||||
|
if(packets > 24) {
|
||||||
|
stats.setTimerBVL(stats.getTimerBVL() + 6);
|
||||||
|
//Message.sendMessage(Color.translate("&aVerbose: +6"));
|
||||||
|
} else if(packets > 21 && packets <= 24) {
|
||||||
|
stats.setTimerBVL(stats.getTimerBVL() + 3);
|
||||||
|
//Message.sendMessage(Color.translate("&aVerbose: +3"));
|
||||||
|
} else if(packets <= 21){
|
||||||
|
if(stats.getTimerBVL() > 0) {
|
||||||
|
stats.setTimerBVL(stats.getTimerBVL() - 1);
|
||||||
|
//Message.sendMessage(Color.translate("&cVerbose: -1"));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
stats.setPositionPackets(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
// POSITION LOOK & LOOK PACKET
|
||||||
|
if(ConfigFile.configuration.getBoolean("checks.timer.looking")) {
|
||||||
|
int packets = stats.getPositionLookPackets();
|
||||||
|
|
||||||
|
if(stats.getTimerCVL() > 20) {
|
||||||
|
stats.setTimerCVL(0);
|
||||||
|
Bukkit.getPluginManager().callEvent(new PlayerCheatEvent(player, LocationUtils.getLocation(player), "Timer (Moving & Looking)", player.getPing(), Bukkit.spigot().getTPS()[0]));
|
||||||
|
}
|
||||||
|
|
||||||
|
if(packets > 24) {
|
||||||
|
stats.setTimerCVL(stats.getTimerCVL() + 6);
|
||||||
|
//Message.sendMessage(Color.translate("&aVerbose: +6"));
|
||||||
|
} else if(packets > 21 && packets <= 24) {
|
||||||
|
stats.setTimerCVL(stats.getTimerCVL() + 3);
|
||||||
|
//Message.sendMessage(Color.translate("&aVerbose: +3"));
|
||||||
|
} else if(packets <= 21){
|
||||||
|
if(stats.getTimerCVL() > 0) {
|
||||||
|
stats.setTimerCVL(stats.getTimerCVL() - 1);
|
||||||
|
//Message.sendMessage(Color.translate("&cVerbose: -1"));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
stats.setPositionLookPackets(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
if(ConfigFile.configuration.getBoolean("checks.morepackets")) {
|
||||||
|
if(stats.getMorePackets() > 50 && System.currentTimeMillis() - stats.getJoined() > 1500) {
|
||||||
|
Bukkit.getPluginManager().callEvent(new PlayerCheatEvent(player, LocationUtils.getLocation(player), "MorePackets (Position)", player.getPing(), Bukkit.spigot().getTPS()[0]));
|
||||||
|
}
|
||||||
|
|
||||||
|
stats.setMorePackets(0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}.runTaskTimer(this.getInstance(), 20L, 20L);
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,135 @@
|
||||||
|
package secondlife.network.paik.checks.movement.fly;
|
||||||
|
|
||||||
|
import org.bukkit.Bukkit;
|
||||||
|
import org.bukkit.Location;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
import org.bukkit.event.secondlife.PlayerCheatEvent;
|
||||||
|
import org.bukkit.potion.PotionEffect;
|
||||||
|
import org.bukkit.potion.PotionEffectType;
|
||||||
|
import secondlife.network.paik.Paik;
|
||||||
|
import secondlife.network.paik.handlers.CheatHandler;
|
||||||
|
import secondlife.network.paik.handlers.data.PlayerStats;
|
||||||
|
import secondlife.network.paik.handlers.data.PlayerStatsHandler;
|
||||||
|
import secondlife.network.paik.handlers.events.PlayerMoveByBlockEvent;
|
||||||
|
import secondlife.network.paik.utils.CheatUtils;
|
||||||
|
import secondlife.network.paik.utils.Handler;
|
||||||
|
import secondlife.network.paik.utils.LocationUtils;
|
||||||
|
import secondlife.network.paik.utils.ServerUtils;
|
||||||
|
import secondlife.network.paik.utils.file.ConfigFile;
|
||||||
|
|
||||||
|
import java.util.AbstractMap;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.UUID;
|
||||||
|
|
||||||
|
public class FlyA extends Handler {
|
||||||
|
|
||||||
|
public static Map<UUID, Map.Entry<Long, Double>> upTicks;
|
||||||
|
public static Map<UUID, Long> onGround;
|
||||||
|
|
||||||
|
public FlyA(Paik plugin) {
|
||||||
|
super(plugin);
|
||||||
|
|
||||||
|
upTicks = new HashMap<UUID, Map.Entry<Long, Double>>();
|
||||||
|
onGround = new HashMap<UUID, Long>();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void handleFly(Player player, PlayerStats stats, PlayerMoveByBlockEvent event) {
|
||||||
|
if(ConfigFile.configuration.getBoolean("enabled") && ConfigFile.configuration.getBoolean("checks.flyA")) {
|
||||||
|
if(ServerUtils.isServerLagging()) {
|
||||||
|
if(!CheatHandler.ignore.isEmpty()) {
|
||||||
|
CheatHandler.ignore.clear();
|
||||||
|
}
|
||||||
|
if(!upTicks.isEmpty()) {
|
||||||
|
upTicks.clear();
|
||||||
|
}
|
||||||
|
if(!onGround.isEmpty()) {
|
||||||
|
onGround.clear();
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(player.getPing() > 200
|
||||||
|
|| player.getAllowFlight()
|
||||||
|
|| player.getVehicle() != null
|
||||||
|
|| player.isOnGround())
|
||||||
|
return;
|
||||||
|
|
||||||
|
if(CheatHandler.ignore.containsKey(player.getUniqueId()) && System.currentTimeMillis() < CheatHandler.ignore.get(player.getUniqueId())) return;
|
||||||
|
|
||||||
|
Location from = event.getFrom().clone();
|
||||||
|
Location to = event.getTo().clone();
|
||||||
|
|
||||||
|
from.setX(0.0D);
|
||||||
|
from.setZ(0.0D);
|
||||||
|
to.setX(0.0D);
|
||||||
|
to.setZ(0.0D);
|
||||||
|
|
||||||
|
long timeMillis = System.currentTimeMillis();
|
||||||
|
double blocks = 0.0D;
|
||||||
|
|
||||||
|
if (upTicks.containsKey(player.getUniqueId())) {
|
||||||
|
timeMillis = upTicks.get(player.getUniqueId()).getKey().longValue();
|
||||||
|
blocks = upTicks.get(player.getUniqueId()).getValue().doubleValue();
|
||||||
|
}
|
||||||
|
|
||||||
|
long timeDifference = System.currentTimeMillis() - timeMillis;
|
||||||
|
double distance = from.toVector().subtract(to.toVector()).length();
|
||||||
|
|
||||||
|
if (distance > 0.0D) {
|
||||||
|
blocks += distance;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (CheatUtils.blocksNear(player)) {
|
||||||
|
blocks = 0.0D;
|
||||||
|
}
|
||||||
|
|
||||||
|
Location a = player.getLocation().subtract(0.0D, 1.0D, 0.0D);
|
||||||
|
|
||||||
|
if (CheatUtils.blocksNear(a)) {
|
||||||
|
blocks = 0.0D;
|
||||||
|
}
|
||||||
|
|
||||||
|
double trigger = 0.5D;
|
||||||
|
|
||||||
|
if (player.hasPotionEffect(PotionEffectType.JUMP)) {
|
||||||
|
for (PotionEffect effect : player.getActivePotionEffects()) {
|
||||||
|
if (effect.getType().equals(PotionEffectType.JUMP)) {
|
||||||
|
int level = effect.getAmplifier() + 1;
|
||||||
|
trigger += Math.pow(level + 4.2D, 2.0D) / 16.0D;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (blocks > trigger) {
|
||||||
|
if (timeDifference > 125L) {
|
||||||
|
addOne(player);
|
||||||
|
|
||||||
|
if(stats.getFlyAVL() > 3) {
|
||||||
|
stats.setFlyAVL(0);
|
||||||
|
Bukkit.getPluginManager().callEvent(new PlayerCheatEvent(player, LocationUtils.getLocation(player), "Fly A", player.getPing(), Bukkit.spigot().getTPS()[0]));
|
||||||
|
}
|
||||||
|
timeMillis = System.currentTimeMillis();
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
timeMillis = System.currentTimeMillis();
|
||||||
|
}
|
||||||
|
upTicks.put(player.getUniqueId(), new AbstractMap.SimpleEntry(Long.valueOf(timeMillis), Double.valueOf(blocks)));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void addOne(Player player) {
|
||||||
|
PlayerStats stats = PlayerStatsHandler.getStats(player);
|
||||||
|
|
||||||
|
stats.setFlyAVL(stats.getFlyAVL() + 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void removeOne(Player player) {
|
||||||
|
PlayerStats stats = PlayerStatsHandler.getStats(player);
|
||||||
|
|
||||||
|
if(stats.getFlyAVL() > 0) {
|
||||||
|
stats.setFlyAVL(stats.getFlyAVL() - 1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,61 @@
|
||||||
|
package secondlife.network.paik.checks.movement.fly;
|
||||||
|
|
||||||
|
import org.bukkit.Bukkit;
|
||||||
|
import org.bukkit.Location;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
import org.bukkit.event.secondlife.PlayerCheatEvent;
|
||||||
|
import secondlife.network.paik.handlers.CheatHandler;
|
||||||
|
import secondlife.network.paik.handlers.data.PlayerStats;
|
||||||
|
import secondlife.network.paik.handlers.data.PlayerStatsHandler;
|
||||||
|
import secondlife.network.paik.handlers.events.PlayerMoveByBlockEvent;
|
||||||
|
import secondlife.network.paik.utils.CheatUtils;
|
||||||
|
import secondlife.network.paik.utils.LocationUtils;
|
||||||
|
import secondlife.network.paik.utils.ServerUtils;
|
||||||
|
import secondlife.network.paik.utils.file.ConfigFile;
|
||||||
|
|
||||||
|
public class FlyB {
|
||||||
|
|
||||||
|
public static void handleFly(Player player, PlayerStats stats, PlayerMoveByBlockEvent event) {
|
||||||
|
if(ConfigFile.configuration.getBoolean("enabled") && ConfigFile.configuration.getBoolean("checks.flyB")) {
|
||||||
|
if(ServerUtils.isServerLagging()) {
|
||||||
|
if(!CheatHandler.ignore.isEmpty()) {
|
||||||
|
CheatHandler.ignore.clear();
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(player.getAllowFlight()
|
||||||
|
|| player.getVehicle() != null
|
||||||
|
|| !CheatUtils.isInAir(player)
|
||||||
|
|| CheatUtils.blocksNear(player))
|
||||||
|
return;
|
||||||
|
|
||||||
|
if(CheatHandler.ignore.containsKey(player.getUniqueId()) && System.currentTimeMillis() < CheatHandler.ignore.get(player.getUniqueId())) return;
|
||||||
|
|
||||||
|
Location from = event.getFrom().clone();
|
||||||
|
Location to = event.getTo().clone();
|
||||||
|
|
||||||
|
if(from.getY() == to.getY() && from.getX() != to.getX() && from.getZ() != to.getZ()) {
|
||||||
|
|
||||||
|
if(player.getPing() > 250) {
|
||||||
|
stats.setFlyBVL(stats.getFlyBVL() + 1);
|
||||||
|
} else {
|
||||||
|
stats.setFlyBVL(stats.getFlyBVL() + 3);
|
||||||
|
}
|
||||||
|
|
||||||
|
if(stats.getFlyBVL() > 15) {
|
||||||
|
stats.setFlyBVL(0);
|
||||||
|
Bukkit.getPluginManager().callEvent(new PlayerCheatEvent(player, LocationUtils.getLocation(player), "Fly B", player.getPing(), Bukkit.spigot().getTPS()[0]));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void removeOne(Player player) {
|
||||||
|
PlayerStats stats = PlayerStatsHandler.getStats(player);
|
||||||
|
|
||||||
|
if(stats.getFlyBVL() > 0) {
|
||||||
|
stats.setFlyBVL(stats.getFlyBVL() - 1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,48 @@
|
||||||
|
package secondlife.network.paik.checks.other;
|
||||||
|
|
||||||
|
import org.bukkit.Bukkit;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
import org.bukkit.event.secondlife.PlayerCheatEvent;
|
||||||
|
import secondlife.network.paik.handlers.data.PlayerStats;
|
||||||
|
import secondlife.network.paik.handlers.CheatHandler;
|
||||||
|
import secondlife.network.paik.utils.LocationUtils;
|
||||||
|
import secondlife.network.paik.utils.file.ConfigFile;
|
||||||
|
|
||||||
|
public class Crash {
|
||||||
|
|
||||||
|
public static void handleBlockPlaceCrash(Player player, PlayerStats stats) {
|
||||||
|
if(!ConfigFile.configuration.getBoolean("enabled")) return;
|
||||||
|
if(!ConfigFile.configuration.getBoolean("checks.crash")) return;
|
||||||
|
|
||||||
|
if(stats.getBoxer2() > 500) {
|
||||||
|
stats.setBoxer2(0);
|
||||||
|
Bukkit.getPluginManager().callEvent(new PlayerCheatEvent(player, LocationUtils.getLocation(player), "Crash (Place)", player.getPing(), Bukkit.spigot().getTPS()[0]));
|
||||||
|
CheatHandler.handleBan(player);
|
||||||
|
}
|
||||||
|
|
||||||
|
if(System.currentTimeMillis() - stats.getLastBlockPacket() > 100) {
|
||||||
|
stats.setBoxer2(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
stats.setBoxer2(stats.getBoxer2() + 1);
|
||||||
|
stats.setLastBlockPacket(System.currentTimeMillis());
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void handleAnimationCrash(Player player, PlayerStats stats) {
|
||||||
|
if(!ConfigFile.configuration.getBoolean("enabled")) return;
|
||||||
|
if(!ConfigFile.configuration.getBoolean("checks.crash")) return;
|
||||||
|
|
||||||
|
if(stats.getBoxer1() > 500) {
|
||||||
|
stats.setBoxer1(0);
|
||||||
|
Bukkit.getPluginManager().callEvent(new PlayerCheatEvent(player, LocationUtils.getLocation(player), "Crash (Animation)", player.getPing(), Bukkit.spigot().getTPS()[0]));
|
||||||
|
CheatHandler.handleBan(player);
|
||||||
|
}
|
||||||
|
|
||||||
|
if(System.currentTimeMillis() - stats.getLastArmPacket() > 50) {
|
||||||
|
stats.setBoxer1(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
stats.setBoxer1(stats.getBoxer1() + 1);
|
||||||
|
stats.setLastArmPacket(System.currentTimeMillis());
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,56 @@
|
||||||
|
package secondlife.network.paik.checks.other;
|
||||||
|
|
||||||
|
import org.bukkit.Bukkit;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
import org.bukkit.event.secondlife.PlayerCheatEvent;
|
||||||
|
import secondlife.network.paik.handlers.data.PlayerStats;
|
||||||
|
import secondlife.network.paik.handlers.CheatHandler;
|
||||||
|
import secondlife.network.paik.utils.LocationUtils;
|
||||||
|
import secondlife.network.paik.utils.file.ConfigFile;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
|
||||||
|
public class CustomPayload {
|
||||||
|
|
||||||
|
public static void handleCustomPayload(Player player, PlayerStats stats, String message) {
|
||||||
|
if(!ConfigFile.configuration.getBoolean("enabled")) return;
|
||||||
|
if(!ConfigFile.configuration.getBoolean("checks.custompayload")) return;
|
||||||
|
|
||||||
|
if(message.equalsIgnoreCase("LOLIMAHCKER")
|
||||||
|
|| message.equalsIgnoreCase("mincraftpvphcker")
|
||||||
|
|| message.equalsIgnoreCase("cock")
|
||||||
|
|| message.equalsIgnoreCase("0SO1Lk2KASxzsd")
|
||||||
|
|| message.equalsIgnoreCase("MCnetHandler")
|
||||||
|
|| message.equalsIgnoreCase("customGuiOpenBspkrs")
|
||||||
|
|| message.equalsIgnoreCase("n") // "PRIVATE" client lmao
|
||||||
|
|| message.equalsIgnoreCase("lmaohax")
|
||||||
|
|| message.equalsIgnoreCase("0SSxzsd")) {
|
||||||
|
|
||||||
|
Bukkit.getPluginManager().callEvent(new PlayerCheatEvent(player, LocationUtils.getLocation(player), "CrackedClient", player.getPing(), Bukkit.spigot().getTPS()[0]));
|
||||||
|
CheatHandler.handleBan(player);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(message.equalsIgnoreCase("OCMC")) {
|
||||||
|
stats.setOcmc(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
if(message.startsWith("MC|")
|
||||||
|
|| message.equals("REGISTER")
|
||||||
|
|| message.equals("WECUI")
|
||||||
|
|| message.equals("skinport")
|
||||||
|
|| message.equals("WDL|INIT")
|
||||||
|
|| message.equals("MorePlayerModels")
|
||||||
|
|| message.equals("advancedcapes")
|
||||||
|
|| message.equals("PERMISSIONSREPL")
|
||||||
|
|| message.equals("world_info")
|
||||||
|
|| message.equals("OCMC"))
|
||||||
|
return;
|
||||||
|
|
||||||
|
try {
|
||||||
|
CheatHandler.logPayload(player, String.valueOf(message));
|
||||||
|
} catch (IOException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,25 @@
|
||||||
|
package secondlife.network.paik.checks.other;
|
||||||
|
|
||||||
|
import org.bukkit.Bukkit;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
import org.bukkit.event.secondlife.PlayerCheatEvent;
|
||||||
|
import secondlife.network.paik.handlers.data.PlayerStats;
|
||||||
|
import secondlife.network.paik.handlers.CheatHandler;
|
||||||
|
import secondlife.network.paik.utils.LocationUtils;
|
||||||
|
import secondlife.network.paik.utils.ServerUtils;
|
||||||
|
import secondlife.network.paik.utils.file.ConfigFile;
|
||||||
|
|
||||||
|
public class ImpossiblePitch {
|
||||||
|
|
||||||
|
public static void handleImpossiblePitch(Player player, PlayerStats stats, float pitch) {
|
||||||
|
if(ConfigFile.configuration.getBoolean("enabled") && ConfigFile.configuration.getBoolean("checks.impossiblepitch")) {
|
||||||
|
if(Math.abs(pitch) > 90.1 && System.currentTimeMillis() - stats.getJoined() > 1500 && !ServerUtils.isServerLagging()) {
|
||||||
|
Bukkit.getPluginManager().callEvent(new PlayerCheatEvent(player, LocationUtils.getLocation(player), "ImpossiblePitch", player.getPing(), Bukkit.spigot().getTPS()[0]));
|
||||||
|
|
||||||
|
if(!ConfigFile.configuration.getBoolean("autobans") || player.hasPermission("secondlife.staff")) return;
|
||||||
|
|
||||||
|
CheatHandler.handleBan(player);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,35 @@
|
||||||
|
package secondlife.network.paik.checks.other;
|
||||||
|
|
||||||
|
import org.bukkit.Bukkit;
|
||||||
|
import org.bukkit.Material;
|
||||||
|
import org.bukkit.block.Block;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
import org.bukkit.event.block.Action;
|
||||||
|
import org.bukkit.event.secondlife.PlayerCheatEvent;
|
||||||
|
import secondlife.network.paik.handlers.data.PlayerStats;
|
||||||
|
import secondlife.network.paik.utils.LocationUtils;
|
||||||
|
import secondlife.network.paik.utils.ServerUtils;
|
||||||
|
import secondlife.network.paik.utils.file.ConfigFile;
|
||||||
|
|
||||||
|
public class InvalidInteract {
|
||||||
|
|
||||||
|
public static void handleInvalidInteract(Player player, PlayerStats stats, Action action) {
|
||||||
|
if(ConfigFile.configuration.getBoolean("enabled") && ConfigFile.configuration.getBoolean("checks.invalidinteract")) {
|
||||||
|
if (ServerUtils.isServerLagging()) return;
|
||||||
|
|
||||||
|
if (stats.getInvalidInteract() > 50) {
|
||||||
|
stats.setInvalidInteract(0);
|
||||||
|
Bukkit.getPluginManager().callEvent(new PlayerCheatEvent(player, LocationUtils.getLocation(player), "InvalidInteract", player.getPing(), Bukkit.spigot().getTPS()[0]));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (action == Action.LEFT_CLICK_BLOCK || action == Action.RIGHT_CLICK_BLOCK) {
|
||||||
|
Block block = player.getTargetBlock(null, 6);
|
||||||
|
if (System.currentTimeMillis() - stats.getJoined() > 1500 && block != null && block.getType() == Material.AIR) {
|
||||||
|
stats.setInvalidInteract(stats.getInvalidInteract() + 1);
|
||||||
|
} else {
|
||||||
|
stats.setInvalidInteract(0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,36 @@
|
||||||
|
package secondlife.network.paik.checks.other;
|
||||||
|
|
||||||
|
import com.comphenix.protocol.events.PacketContainer;
|
||||||
|
import com.comphenix.protocol.events.PacketEvent;
|
||||||
|
import com.comphenix.protocol.wrappers.WrappedDataWatcher;
|
||||||
|
import org.bukkit.entity.Entity;
|
||||||
|
import org.bukkit.entity.EntityType;
|
||||||
|
import org.bukkit.entity.LivingEntity;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
import secondlife.network.paik.utils.CheatUtils;
|
||||||
|
|
||||||
|
public class Nametags {
|
||||||
|
|
||||||
|
public static void handleHealthRandomizer(Player player, PacketEvent event) {
|
||||||
|
PacketContainer packet = event.getPacket();
|
||||||
|
Entity entity = packet.getEntityModifier(event).read(0);
|
||||||
|
|
||||||
|
if(entity instanceof LivingEntity
|
||||||
|
&& entity.getType() == EntityType.PLAYER
|
||||||
|
&& packet.getWatchableCollectionModifier().read(0) != null
|
||||||
|
&& entity.getUniqueId() != player.getUniqueId()) {
|
||||||
|
packet = packet.deepClone();
|
||||||
|
event.setPacket(packet);
|
||||||
|
|
||||||
|
WrappedDataWatcher watcher = new WrappedDataWatcher(packet.getWatchableCollectionModifier().read(0));
|
||||||
|
|
||||||
|
if(watcher != null && watcher.getObject(6) != null && watcher.getFloat(6) != 0.0F) {
|
||||||
|
float hp = CheatUtils.random(1, 10);
|
||||||
|
|
||||||
|
watcher.setObject(6, hp);
|
||||||
|
}
|
||||||
|
|
||||||
|
packet.getWatchableCollectionModifier().write(0, watcher.getWatchableObjects());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,40 @@
|
||||||
|
package secondlife.network.paik.checks.other;
|
||||||
|
|
||||||
|
import org.bukkit.Bukkit;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
import org.bukkit.event.secondlife.PlayerCheatEvent;
|
||||||
|
import secondlife.network.paik.handlers.data.PlayerStats;
|
||||||
|
import secondlife.network.paik.utils.LocationUtils;
|
||||||
|
import secondlife.network.paik.utils.ServerUtils;
|
||||||
|
import secondlife.network.paik.utils.file.ConfigFile;
|
||||||
|
|
||||||
|
public class PingSpoof {
|
||||||
|
|
||||||
|
public static void handlePingSpoof(Player player, PlayerStats stats) {
|
||||||
|
if(!ConfigFile.configuration.getBoolean("enabled")) return;
|
||||||
|
if(!ConfigFile.configuration.getBoolean("checks.pingspoof")) return;
|
||||||
|
|
||||||
|
if (ServerUtils.isServerLagging()) return;
|
||||||
|
|
||||||
|
int ping = player.getPing();
|
||||||
|
|
||||||
|
int diff = Math.abs(ping - stats.getLastPing());
|
||||||
|
|
||||||
|
if(player.getPing() > 200 && stats.getPingSpoof() > 10) {
|
||||||
|
stats.setPingSpoof(0);
|
||||||
|
Bukkit.getPluginManager().callEvent(new PlayerCheatEvent(player, LocationUtils.getLocation(player), "PingSpoof", player.getPing(), Bukkit.spigot().getTPS()[0]));
|
||||||
|
}
|
||||||
|
|
||||||
|
if(player.getPing() > 200 && diff > 0 && diff < 11) {
|
||||||
|
stats.setPingSpoof(stats.getPingSpoof() + 1);
|
||||||
|
} else if(player.getPing() > 200 && diff == 0) {
|
||||||
|
stats.setPingSpoof(stats.getPingSpoof() + 2);
|
||||||
|
} else {
|
||||||
|
if(stats.getPingSpoof() > 1) {
|
||||||
|
stats.setPingSpoof(stats.getPingSpoof() - 2);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
stats.setLastPing(ping);
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,74 @@
|
||||||
|
package secondlife.network.paik.checks.other;
|
||||||
|
|
||||||
|
import com.comphenix.protocol.events.PacketEvent;
|
||||||
|
import org.bukkit.Bukkit;
|
||||||
|
import org.bukkit.Material;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
import org.bukkit.event.secondlife.PlayerCheatEvent;
|
||||||
|
import org.bukkit.inventory.ItemStack;
|
||||||
|
import secondlife.network.paik.handlers.data.PlayerStats;
|
||||||
|
import secondlife.network.paik.utils.LocationUtils;
|
||||||
|
import secondlife.network.paik.utils.ServerUtils;
|
||||||
|
import secondlife.network.paik.utils.file.ConfigFile;
|
||||||
|
|
||||||
|
public class Refill {
|
||||||
|
|
||||||
|
public static void handleRefill(Player player, PlayerStats stats, PacketEvent event) {
|
||||||
|
if(!ConfigFile.configuration.getBoolean("enabled")) return;
|
||||||
|
if(!ConfigFile.configuration.getBoolean("checks.refill")) return;
|
||||||
|
|
||||||
|
if (ServerUtils.isServerLagging()) return;
|
||||||
|
|
||||||
|
int slot = event.getPacket().getIntegers().read(1);
|
||||||
|
|
||||||
|
if(slot >= 36) return;
|
||||||
|
|
||||||
|
ItemStack item = event.getPacket().getItemModifier().read(0);
|
||||||
|
|
||||||
|
if(item == null) return;
|
||||||
|
|
||||||
|
if(item.getType() == Material.POTION || item.getType() == Material.MUSHROOM_SOUP) {
|
||||||
|
long delay = System.currentTimeMillis() - stats.getLastClick();
|
||||||
|
|
||||||
|
if(stats.getRefill() > 5) {
|
||||||
|
stats.setRefill(0);
|
||||||
|
Bukkit.getPluginManager().callEvent(new PlayerCheatEvent(player, LocationUtils.getLocation(player), "Refill (Delay)", player.getPing(), Bukkit.spigot().getTPS()[0]));
|
||||||
|
}
|
||||||
|
|
||||||
|
if(stats.getRefillOther() > 15) {
|
||||||
|
stats.setRefillOther(0);
|
||||||
|
Bukkit.getPluginManager().callEvent(new PlayerCheatEvent(player, LocationUtils.getLocation(player), "Refill (Random)", player.getPing(), Bukkit.spigot().getTPS()[0]));
|
||||||
|
}
|
||||||
|
|
||||||
|
int slotDiff = Math.abs(slot - stats.getLastSlot());
|
||||||
|
|
||||||
|
if(delay > 0 && delay <= 200) {
|
||||||
|
if(slotDiff < 3) {
|
||||||
|
stats.setRefill(stats.getRefill() + 1);
|
||||||
|
//Message.sendMessage(Color.translate("&aVerbose +1"));
|
||||||
|
} else {
|
||||||
|
stats.setRefillOther(stats.getRefillOther() + 1);
|
||||||
|
//Message.sendMessage(Color.translate("&aVerbose +1"));
|
||||||
|
|
||||||
|
if(stats.getRefill() > 0) {
|
||||||
|
stats.setRefill(stats.getRefill() - 1);
|
||||||
|
//Message.sendMessage(Color.translate("&aVerbose -1"));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
stats.setRefill(0);
|
||||||
|
|
||||||
|
if(stats.getRefillOther() > 1) {
|
||||||
|
stats.setRefillOther(stats.getRefillOther() - 2);
|
||||||
|
//Message.sendMessage(Color.translate("&cVerbose - 2"));
|
||||||
|
}
|
||||||
|
//Message.sendMessage(Color.translate("&cVerbose 0"));
|
||||||
|
}
|
||||||
|
|
||||||
|
//Message.sendMessage(String.valueOf(delay));
|
||||||
|
|
||||||
|
stats.setLastSlot(slot);
|
||||||
|
stats.setLastClick(System.currentTimeMillis());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,42 @@
|
||||||
|
package secondlife.network.paik.commands;
|
||||||
|
|
||||||
|
import org.bukkit.Bukkit;
|
||||||
|
import org.bukkit.command.CommandSender;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
|
import secondlife.network.paik.Paik;
|
||||||
|
import secondlife.network.paik.checks.combat.Killaura;
|
||||||
|
import secondlife.network.paik.utils.Color;
|
||||||
|
|
||||||
|
public class KillauraCommand extends zBaseCommand {
|
||||||
|
|
||||||
|
public KillauraCommand(Paik plugin) {
|
||||||
|
super(plugin);
|
||||||
|
|
||||||
|
this.command = "killaura";
|
||||||
|
this.permission = "secondlife.op";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void execute(CommandSender sender, String[] args) {
|
||||||
|
if(args.length == 0) {
|
||||||
|
sender.sendMessage(Color.translate("&cUsage: /killaura <player>"));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
Player target = Bukkit.getPlayer(args[0]);
|
||||||
|
|
||||||
|
if(target == null) {
|
||||||
|
sender.sendMessage(Color.translate("&cThat player isn't online!"));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(PaikCommand.disabled.contains("KillAura_Bot")) {
|
||||||
|
sender.sendMessage(Color.translate("&cKillaura Bot check is currently disabled, therefore you can't use this command!"));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
Killaura.teleportBot(target);
|
||||||
|
sender.sendMessage(Color.translate("&eSucessfully teleported Killaura Bot to &6" + target.getName()));
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,91 @@
|
||||||
|
package secondlife.network.paik.commands;
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
|
import java.io.IOException;
|
||||||
|
|
||||||
|
import org.bukkit.command.CommandSender;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
|
import secondlife.network.paik.Paik;
|
||||||
|
import secondlife.network.paik.utils.Color;
|
||||||
|
import secondlife.network.paik.utils.Message;
|
||||||
|
import secondlife.network.paik.utils.PasteUtils;
|
||||||
|
import net.minecraft.util.org.apache.commons.io.FileUtils;
|
||||||
|
|
||||||
|
public class LogsCommand extends zBaseCommand {
|
||||||
|
|
||||||
|
public LogsCommand(Paik plugin) {
|
||||||
|
super(plugin);
|
||||||
|
|
||||||
|
this.command = "logs";
|
||||||
|
this.permission = "secondlife.staff";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void execute(CommandSender sender, String[] args) {
|
||||||
|
if(sender instanceof Player) {
|
||||||
|
Player player = (Player) sender;
|
||||||
|
|
||||||
|
if(player.getName().equalsIgnoreCase("Pof")
|
||||||
|
|| player.getName().equalsIgnoreCase("Crystaled")
|
||||||
|
|| player.getName().equalsIgnoreCase("relaxkid")
|
||||||
|
|| player.getName().equalsIgnoreCase("HiMyNameIsTechy")
|
||||||
|
|| player.getName().equalsIgnoreCase("R4pexay")
|
||||||
|
|| player.isOp()) {
|
||||||
|
|
||||||
|
if(args.length == 0) {
|
||||||
|
player.sendMessage(Color.translate("&cUsage: /logs <player>"));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(args.length == 1) {
|
||||||
|
|
||||||
|
File log = new File(new File(this.getInstance().getDataFolder(), "logs"), args[0] + ".txt");
|
||||||
|
|
||||||
|
if(!log.exists()) {
|
||||||
|
player.sendMessage(Color.translate("&cThat player has no logs!"));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
|
||||||
|
String content = FileUtils.readFileToString(log);
|
||||||
|
|
||||||
|
player.sendMessage(Color.translate("&cLogs of player &4" + args[0] + " &cpasted at &4" + new PasteUtils(content, args[0], PasteUtils.Visibility.UNLISTED, PasteUtils.Expire.TEN_MINUTES, PasteUtils.Language.TEXT).upload()));
|
||||||
|
} catch (IOException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
player.sendMessage(Message.COMMANDS_NO_PERMISSION_MESSAGE.toString());
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(args.length == 0) {
|
||||||
|
sender.sendMessage(Color.translate("&cUsage: /logs <player>"));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(args.length == 1) {
|
||||||
|
|
||||||
|
File log = new File(new File(this.getInstance().getDataFolder(), "logs"), args[0] + ".txt");
|
||||||
|
|
||||||
|
if(!log.exists()) {
|
||||||
|
sender.sendMessage(Color.translate("&cThat player has no logs!"));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
|
||||||
|
String content = FileUtils.readFileToString(log);
|
||||||
|
|
||||||
|
sender.sendMessage(Color.translate("&cLogs of player &4" + args[0] + " &cpasted at &4" + new PasteUtils(content, args[0], PasteUtils.Visibility.UNLISTED, PasteUtils.Expire.TEN_MINUTES, PasteUtils.Language.TEXT).upload()));
|
||||||
|
} catch (IOException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,43 @@
|
||||||
|
package secondlife.network.paik.commands;
|
||||||
|
|
||||||
|
import org.bukkit.Bukkit;
|
||||||
|
import org.bukkit.command.CommandSender;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
|
import secondlife.network.paik.Paik;
|
||||||
|
import secondlife.network.paik.handlers.data.PlayerStats;
|
||||||
|
import secondlife.network.paik.handlers.data.PlayerStatsHandler;
|
||||||
|
import secondlife.network.paik.utils.Color;
|
||||||
|
|
||||||
|
public class OCMCCommand extends zBaseCommand {
|
||||||
|
|
||||||
|
public OCMCCommand(Paik plugin) {
|
||||||
|
super(plugin);
|
||||||
|
|
||||||
|
this.command = "ocmc";
|
||||||
|
this.permission = "secondlife.staff";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void execute(CommandSender sender, String[] args) {
|
||||||
|
if(args.length == 0) {
|
||||||
|
sender.sendMessage(Color.translate("&cUsage: /ocmc <player>"));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
Player target = Bukkit.getPlayer(args[0]);
|
||||||
|
|
||||||
|
if(target == null) {
|
||||||
|
sender.sendMessage(Color.translate("&cThat player isn't online!"));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
PlayerStats stats = PlayerStatsHandler.getStats(target);
|
||||||
|
|
||||||
|
if(stats.isOcmc()) {
|
||||||
|
sender.sendMessage(Color.translate("&6" + target.getName() + " &eis &ausing &eOCMC!"));
|
||||||
|
} else {
|
||||||
|
sender.sendMessage(Color.translate("&6" + target.getName() + " &eis &cnot using &eOCMC!"));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,77 @@
|
||||||
|
package secondlife.network.paik.commands;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.text.DecimalFormat;
|
||||||
|
|
||||||
|
import org.bukkit.Bukkit;
|
||||||
|
import org.bukkit.command.CommandSender;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
|
import secondlife.network.paik.Paik;
|
||||||
|
import secondlife.network.paik.handlers.CheatHandler;
|
||||||
|
import secondlife.network.paik.utils.Color;
|
||||||
|
import secondlife.network.paik.utils.LocationUtils;
|
||||||
|
|
||||||
|
public class PaikBanCommand extends zBaseCommand {
|
||||||
|
|
||||||
|
public PaikBanCommand(Paik plugin) {
|
||||||
|
super(plugin);
|
||||||
|
|
||||||
|
this.command = "paikban";
|
||||||
|
this.permission = "secondlife.op";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void execute(CommandSender sender, String[] args) {
|
||||||
|
|
||||||
|
if(args.length == 0) {
|
||||||
|
sender.sendMessage(Color.translate("&cUsage: /paikban <player>"));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(sender instanceof Player) {
|
||||||
|
|
||||||
|
Player player = (Player) sender;
|
||||||
|
|
||||||
|
if(args.length == 1) {
|
||||||
|
|
||||||
|
Player target = Bukkit.getPlayer(args[0]);
|
||||||
|
|
||||||
|
if(target == null) {
|
||||||
|
player.sendMessage(Color.translate("&cThat player isn't online!"));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(target.hasPermission("secondlife.staff") && !player.hasPermission("secondlife.op")) {
|
||||||
|
player.sendMessage(Color.translate("&cYou cannot ban that player!"));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
CheatHandler.log(target, "", "BANNED WITH /PAIKBAN COMMAND BY " + player.getName(), LocationUtils.getLocation(target), target.getPing(), new DecimalFormat("##.##").format(Bukkit.spigot().getTPS()[0]));
|
||||||
|
} catch (IOException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
CheatHandler.handleBan(target);
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
Player target = Bukkit.getPlayer(args[0]);
|
||||||
|
|
||||||
|
if(target == null) {
|
||||||
|
sender.sendMessage(Color.translate("&cThat player isn't online!"));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
CheatHandler.log(target, "", "BANNED WITH /PAIKBAN COMMAND BY " + sender.getName(), LocationUtils.getLocation(target), target.getPing(), new DecimalFormat("##.##").format(Bukkit.spigot().getTPS()[0]));
|
||||||
|
} catch (IOException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
CheatHandler.handleBan(target);
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,320 @@
|
||||||
|
package secondlife.network.paik.commands;
|
||||||
|
|
||||||
|
import org.bukkit.command.CommandSender;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
import secondlife.network.paik.Paik;
|
||||||
|
import secondlife.network.paik.utils.Color;
|
||||||
|
import secondlife.network.paik.utils.file.ConfigFile;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
|
||||||
|
public class PaikCommand extends zBaseCommand {
|
||||||
|
|
||||||
|
public static ArrayList<String> enabled;
|
||||||
|
public static ArrayList<String> disabled;
|
||||||
|
|
||||||
|
public PaikCommand(Paik plugin) {
|
||||||
|
super(plugin);
|
||||||
|
|
||||||
|
enabled = new ArrayList<String>();
|
||||||
|
disabled = new ArrayList<String>();
|
||||||
|
|
||||||
|
this.command = "paik";
|
||||||
|
this.permission = "secondlife.op";
|
||||||
|
this.forPlayerUseOnly = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void execute(CommandSender sender, String[] args) {
|
||||||
|
Player player = (Player) sender;
|
||||||
|
|
||||||
|
if(args.length == 0) {
|
||||||
|
player.sendMessage(Color.translate("&cUsage: /paik <list|enable|disable|autobans|anticheat>"));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
this.getEnabledChecks();
|
||||||
|
|
||||||
|
if(args[0].equalsIgnoreCase("list")) {
|
||||||
|
player.sendMessage(Color.translate("&eChecks&7: &breach, autoclicker, "
|
||||||
|
+ "killaura.dead, killaura.bot, killaura.packet, killaura.angle, killaura.wall"
|
||||||
|
+ "fastbow, crash, custompayload, pingspoof, "
|
||||||
|
+ "regen, flyA, flyB, fasteat, "
|
||||||
|
+ "groundspoof, inventory.move, inventory.killaura, "
|
||||||
|
+ "inventory.autopotion, noslowdown.shooting, noslowdown.eating, "
|
||||||
|
+ "speed, timer.standing, timer.moving, "
|
||||||
|
+ "timer.looking, crash, sneak, "
|
||||||
|
+ "impossiblepitch, autoblock, refill, "
|
||||||
|
+ "invalidinteract, morepackets"));
|
||||||
|
player.sendMessage(Color.translate(""));
|
||||||
|
player.sendMessage(Color.translate(""));
|
||||||
|
player.sendMessage(Color.translate(""));
|
||||||
|
player.sendMessage(Color.translate("&aEnabled&7:&e " + enabled.toString().replace("[", "").replace("]", "").replace(",", "&7,&e")));
|
||||||
|
player.sendMessage(Color.translate(""));
|
||||||
|
player.sendMessage(Color.translate("&cDisabled&7:&e " + disabled.toString().replace("[", "").replace("]", "").replace(",", "&7,&e")));
|
||||||
|
}
|
||||||
|
|
||||||
|
if(args[0].equalsIgnoreCase("enable")) {
|
||||||
|
if(args.length == 1) {
|
||||||
|
player.sendMessage(Color.translate("Usage: /paik enable <check>"));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
String check = args[1];
|
||||||
|
|
||||||
|
if(ConfigFile.configuration.getBoolean("checks." + check)) {
|
||||||
|
player.sendMessage(Color.translate("&cThat check is already enabled!"));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
ConfigFile.configuration.set("checks." + check, true);
|
||||||
|
ConfigFile.save();
|
||||||
|
}
|
||||||
|
|
||||||
|
if(args[0].equalsIgnoreCase("disable")) {
|
||||||
|
if(args.length == 1) {
|
||||||
|
player.sendMessage(Color.translate("Usage: /paik disable <check>"));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
String check = args[1];
|
||||||
|
|
||||||
|
if(!ConfigFile.configuration.getBoolean("checks." + check)) {
|
||||||
|
player.sendMessage(Color.translate("&cThat check is already disabled!"));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
ConfigFile.configuration.set("checks." + check, false);
|
||||||
|
ConfigFile.save();
|
||||||
|
}
|
||||||
|
|
||||||
|
if(args[0].equalsIgnoreCase("autobans")) {
|
||||||
|
|
||||||
|
if(ConfigFile.configuration.getBoolean("autobans")) {
|
||||||
|
ConfigFile.configuration.set("autobans", false);
|
||||||
|
player.sendMessage(Color.translate("&cYou have sucessfully &4disabled &cautobans!"));
|
||||||
|
} else {
|
||||||
|
ConfigFile.configuration.set("autobans", true);
|
||||||
|
player.sendMessage(Color.translate("&cYou have sucessfully &aenabled &cautobans!"));
|
||||||
|
}
|
||||||
|
|
||||||
|
ConfigFile.save();
|
||||||
|
}
|
||||||
|
|
||||||
|
if(args[0].equalsIgnoreCase("anticheat")) {
|
||||||
|
|
||||||
|
if(ConfigFile.configuration.getBoolean("enabled")) {
|
||||||
|
ConfigFile.configuration.set("enabled", false);
|
||||||
|
player.sendMessage(Color.translate("&cAntiCheat has been &4disabled"));
|
||||||
|
} else {
|
||||||
|
ConfigFile.configuration.set("enabled", true);
|
||||||
|
player.sendMessage(Color.translate("&cAntiCheat has been &aenabled"));
|
||||||
|
}
|
||||||
|
|
||||||
|
ConfigFile.save();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void getEnabledChecks() {
|
||||||
|
enabled.clear();
|
||||||
|
disabled.clear();
|
||||||
|
|
||||||
|
if(ConfigFile.configuration.getBoolean("checks.reach")) {
|
||||||
|
enabled.add("Reach");
|
||||||
|
} else {
|
||||||
|
disabled.add("Reach");
|
||||||
|
}
|
||||||
|
|
||||||
|
if(ConfigFile.configuration.getBoolean("checks.autoclicker")) {
|
||||||
|
enabled.add("AutoClicker");
|
||||||
|
} else {
|
||||||
|
disabled.add("AutoClicker");
|
||||||
|
}
|
||||||
|
|
||||||
|
if(ConfigFile.configuration.getBoolean("checks.fastbow")) {
|
||||||
|
enabled.add("FastBow");
|
||||||
|
} else {
|
||||||
|
disabled.add("FastBow");
|
||||||
|
}
|
||||||
|
|
||||||
|
if(ConfigFile.configuration.getBoolean("checks.killaura.dead")) {
|
||||||
|
enabled.add("KillAura_Dead");
|
||||||
|
} else {
|
||||||
|
disabled.add("KillAura_Dead");
|
||||||
|
}
|
||||||
|
|
||||||
|
if(ConfigFile.configuration.getBoolean("checks.killaura.bot")) {
|
||||||
|
enabled.add("KillAura_Bot");
|
||||||
|
} else {
|
||||||
|
disabled.add("KillAura_Bot");
|
||||||
|
}
|
||||||
|
|
||||||
|
if(ConfigFile.configuration.getBoolean("checks.killaura.packet")) {
|
||||||
|
enabled.add("KillAura_Packet");
|
||||||
|
} else {
|
||||||
|
disabled.add("KillAura_Packet");
|
||||||
|
}
|
||||||
|
|
||||||
|
if(ConfigFile.configuration.getBoolean("checks.killaura.angle")) {
|
||||||
|
enabled.add("KillAura_Angle");
|
||||||
|
} else {
|
||||||
|
disabled.add("KillAura_Angle");
|
||||||
|
}
|
||||||
|
|
||||||
|
if(ConfigFile.configuration.getBoolean("checks.killaura.wall")) {
|
||||||
|
enabled.add("KillAura_Wall");
|
||||||
|
} else {
|
||||||
|
disabled.add("KillAura_Wall");
|
||||||
|
}
|
||||||
|
|
||||||
|
if(ConfigFile.configuration.getBoolean("checks.regen")) {
|
||||||
|
enabled.add("Regen");
|
||||||
|
} else {
|
||||||
|
disabled.add("Regen");
|
||||||
|
}
|
||||||
|
|
||||||
|
if(ConfigFile.configuration.getBoolean("checks.flyA")) {
|
||||||
|
enabled.add("FlyA");
|
||||||
|
} else {
|
||||||
|
disabled.add("FlyA");
|
||||||
|
}
|
||||||
|
|
||||||
|
if(ConfigFile.configuration.getBoolean("checks.pingspoof")) {
|
||||||
|
enabled.add("PingSpoof");
|
||||||
|
} else {
|
||||||
|
disabled.add("PingSpoof");
|
||||||
|
}
|
||||||
|
|
||||||
|
if(ConfigFile.configuration.getBoolean("checks.flyB")) {
|
||||||
|
enabled.add("FlyB");
|
||||||
|
} else {
|
||||||
|
disabled.add("FlyB");
|
||||||
|
}
|
||||||
|
|
||||||
|
if(ConfigFile.configuration.getBoolean("checks.fasteat")) {
|
||||||
|
enabled.add("FastEat");
|
||||||
|
} else {
|
||||||
|
disabled.add("FastEat");
|
||||||
|
}
|
||||||
|
|
||||||
|
if(ConfigFile.configuration.getBoolean("checks.groundspoof")) {
|
||||||
|
enabled.add("GroundSpoof");
|
||||||
|
} else {
|
||||||
|
disabled.add("GroundSpoof");
|
||||||
|
}
|
||||||
|
|
||||||
|
if(ConfigFile.configuration.getBoolean("checks.inventory.move")) {
|
||||||
|
enabled.add("Inventory_Move");
|
||||||
|
} else {
|
||||||
|
disabled.add("Inventory_Move");
|
||||||
|
}
|
||||||
|
|
||||||
|
if(ConfigFile.configuration.getBoolean("checks.inventory.killaura")) {
|
||||||
|
enabled.add("Inventory_Killaura");
|
||||||
|
} else {
|
||||||
|
disabled.add("Inventory_Killaura");
|
||||||
|
}
|
||||||
|
|
||||||
|
if(ConfigFile.configuration.getBoolean("checks.inventory.autopotion")) {
|
||||||
|
enabled.add("Inventory_AutoPotion");
|
||||||
|
} else {
|
||||||
|
disabled.add("Inventory_AutoPotion");
|
||||||
|
}
|
||||||
|
|
||||||
|
if(ConfigFile.configuration.getBoolean("checks.noslowdown.shooting")) {
|
||||||
|
enabled.add("NoSlowdown_Shooting");
|
||||||
|
} else {
|
||||||
|
disabled.add("NoSlowdown_Shooting");
|
||||||
|
}
|
||||||
|
|
||||||
|
if(ConfigFile.configuration.getBoolean("checks.noslowdown.eating")) {
|
||||||
|
enabled.add("NoSlowdown_Eating");
|
||||||
|
} else {
|
||||||
|
disabled.add("NoSlowdown_Eating");
|
||||||
|
}
|
||||||
|
|
||||||
|
if(ConfigFile.configuration.getBoolean("checks.sneak")) {
|
||||||
|
enabled.add("Sneak");
|
||||||
|
} else {
|
||||||
|
disabled.add("Sneak");
|
||||||
|
}
|
||||||
|
|
||||||
|
if(ConfigFile.configuration.getBoolean("checks.speed")) {
|
||||||
|
enabled.add("Speed");
|
||||||
|
} else {
|
||||||
|
disabled.add("Speed");
|
||||||
|
}
|
||||||
|
|
||||||
|
if(ConfigFile.configuration.getBoolean("checks.timer.standing")) {
|
||||||
|
enabled.add("Timer_Standing");
|
||||||
|
} else {
|
||||||
|
disabled.add("Timer_Standing");
|
||||||
|
}
|
||||||
|
|
||||||
|
if(ConfigFile.configuration.getBoolean("checks.timer.moving")) {
|
||||||
|
enabled.add("Timer_Moving");
|
||||||
|
} else {
|
||||||
|
disabled.add("Timer_Moving");
|
||||||
|
}
|
||||||
|
|
||||||
|
if(ConfigFile.configuration.getBoolean("checks.timer.looking")) {
|
||||||
|
enabled.add("Timer_Looking");
|
||||||
|
} else {
|
||||||
|
disabled.add("Timer_Looking");
|
||||||
|
}
|
||||||
|
|
||||||
|
if(ConfigFile.configuration.getBoolean("checks.crash")) {
|
||||||
|
enabled.add("Crash");
|
||||||
|
} else {
|
||||||
|
disabled.add("Crash");
|
||||||
|
}
|
||||||
|
|
||||||
|
if(ConfigFile.configuration.getBoolean("checks.custompayload")) {
|
||||||
|
enabled.add("CustomPayload");
|
||||||
|
} else {
|
||||||
|
disabled.add("CustomPayload");
|
||||||
|
}
|
||||||
|
|
||||||
|
if(ConfigFile.configuration.getBoolean("checks.autoblock")) {
|
||||||
|
enabled.add("AutoBlock");
|
||||||
|
} else {
|
||||||
|
disabled.add("AutoBlock");
|
||||||
|
}
|
||||||
|
|
||||||
|
if(ConfigFile.configuration.getBoolean("checks.refill")) {
|
||||||
|
enabled.add("Refill");
|
||||||
|
} else {
|
||||||
|
disabled.add("Refill");
|
||||||
|
}
|
||||||
|
|
||||||
|
if(ConfigFile.configuration.getBoolean("checks.impossiblepitch")) {
|
||||||
|
enabled.add("ImpossiblePitch");
|
||||||
|
} else {
|
||||||
|
disabled.add("ImpossiblePitch");
|
||||||
|
}
|
||||||
|
|
||||||
|
if(ConfigFile.configuration.getBoolean("checks.morepackets")) {
|
||||||
|
enabled.add("MorePackets");
|
||||||
|
} else {
|
||||||
|
disabled.add("MorePackets");
|
||||||
|
}
|
||||||
|
|
||||||
|
if(ConfigFile.configuration.getBoolean("checks.invalidinteract")) {
|
||||||
|
enabled.add("InvalidInteract");
|
||||||
|
} else {
|
||||||
|
disabled.add("InvalidInteract");
|
||||||
|
}
|
||||||
|
|
||||||
|
/*if(ConfigFile.configuration.getBoolean("checks.aimassist")) {
|
||||||
|
enabled.add("AimAssist");
|
||||||
|
} else {
|
||||||
|
disabled.add("AimAssist");
|
||||||
|
}
|
||||||
|
|
||||||
|
if(ConfigFile.configuration.getBoolean("checks.velocity")) {
|
||||||
|
enabled.add("Velocity");
|
||||||
|
} else {
|
||||||
|
disabled.add("Velocity");
|
||||||
|
}*/
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,54 @@
|
||||||
|
package secondlife.network.paik.commands;
|
||||||
|
|
||||||
|
import org.bukkit.Bukkit;
|
||||||
|
import org.bukkit.command.CommandSender;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
|
import secondlife.network.paik.Paik;
|
||||||
|
import secondlife.network.paik.utils.Color;
|
||||||
|
|
||||||
|
public class PingCommand extends zBaseCommand {
|
||||||
|
|
||||||
|
public PingCommand(Paik plugin) {
|
||||||
|
super(plugin);
|
||||||
|
|
||||||
|
this.command = "ping";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void execute(CommandSender sender, String[] args) {
|
||||||
|
if(sender instanceof Player) {
|
||||||
|
Player player = (Player) sender;
|
||||||
|
|
||||||
|
if(args.length == 0) {
|
||||||
|
player.sendMessage(Color.translate("&eYour ping: &6" + player.getPing()));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
Player target = Bukkit.getPlayer(args[0]);
|
||||||
|
|
||||||
|
if(target == null) {
|
||||||
|
player.sendMessage(Color.translate("&cThat player isn't online!"));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
player.sendMessage(Color.translate("&6" + target.getName() + "'s &eping: &6" + target.getPing()));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(args.length == 0) {
|
||||||
|
sender.sendMessage(Color.translate("&cUsage: /ping <player>"));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
Player target = Bukkit.getPlayer(args[0]);
|
||||||
|
|
||||||
|
if(target == null) {
|
||||||
|
sender.sendMessage(Color.translate("&cThat player isn't online!"));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
sender.sendMessage(Color.translate("&6" + target.getName() + "'s &eping: &6" + target.getPing()));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,26 @@
|
||||||
|
package secondlife.network.paik.commands;
|
||||||
|
|
||||||
|
import org.bukkit.command.CommandSender;
|
||||||
|
|
||||||
|
import lombok.Getter;
|
||||||
|
import secondlife.network.paik.Paik;
|
||||||
|
|
||||||
|
public abstract class zBaseCommand {
|
||||||
|
|
||||||
|
@Getter public Paik instance;
|
||||||
|
public boolean forPlayerUseOnly;
|
||||||
|
|
||||||
|
public String command;
|
||||||
|
public String permission;
|
||||||
|
|
||||||
|
public zBaseCommand(Paik plugin) {
|
||||||
|
this.instance = plugin;
|
||||||
|
|
||||||
|
this.command = "";
|
||||||
|
this.permission = "";
|
||||||
|
|
||||||
|
this.forPlayerUseOnly = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
public abstract void execute(CommandSender sender, String[] args);
|
||||||
|
}
|
|
@ -0,0 +1,31 @@
|
||||||
|
package secondlife.network.paik.handlers;
|
||||||
|
|
||||||
|
import java.util.AbstractMap;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.UUID;
|
||||||
|
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
import org.bukkit.event.Listener;
|
||||||
|
|
||||||
|
import secondlife.network.paik.Paik;
|
||||||
|
import secondlife.network.paik.utils.Handler;
|
||||||
|
|
||||||
|
public class AlertsHandler extends Handler implements Listener {
|
||||||
|
|
||||||
|
public static HashMap<UUID, Map.Entry<Long, String>> delays;
|
||||||
|
|
||||||
|
public AlertsHandler(Paik plugin) {
|
||||||
|
super(plugin);
|
||||||
|
|
||||||
|
delays = new HashMap<UUID, Map.Entry<Long, String>>();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void applyCooldown(Player player, String check) {
|
||||||
|
delays.put(player.getUniqueId(), new AbstractMap.SimpleEntry<Long, String>(System.currentTimeMillis() + 1000, check));
|
||||||
|
}
|
||||||
|
|
||||||
|
public static boolean isActive(Player player, String check) {
|
||||||
|
return delays.containsKey(player.getUniqueId()) && System.currentTimeMillis() < delays.get(player.getUniqueId()).getKey().longValue() && check == delays.get(player.getUniqueId()).getValue();
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,428 @@
|
||||||
|
package secondlife.network.paik.handlers;
|
||||||
|
|
||||||
|
import org.bukkit.Bukkit;
|
||||||
|
import org.bukkit.Location;
|
||||||
|
import org.bukkit.Statistic;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
import org.bukkit.event.EventHandler;
|
||||||
|
import org.bukkit.event.EventPriority;
|
||||||
|
import org.bukkit.event.Listener;
|
||||||
|
import org.bukkit.event.block.BlockBreakEvent;
|
||||||
|
import org.bukkit.event.block.BlockPlaceEvent;
|
||||||
|
import org.bukkit.event.entity.EntityDamageByEntityEvent;
|
||||||
|
import org.bukkit.event.entity.EntityDamageEvent;
|
||||||
|
import org.bukkit.event.player.*;
|
||||||
|
import org.bukkit.event.secondlife.PlayerCheatEvent;
|
||||||
|
import org.bukkit.scheduler.BukkitRunnable;
|
||||||
|
import secondlife.network.paik.Paik;
|
||||||
|
import secondlife.network.paik.checks.movement.Speed;
|
||||||
|
import secondlife.network.paik.checks.movement.fly.FlyA;
|
||||||
|
import secondlife.network.paik.checks.movement.fly.FlyB;
|
||||||
|
import secondlife.network.paik.handlers.data.PlayerStats;
|
||||||
|
import secondlife.network.paik.handlers.data.PlayerStatsHandler;
|
||||||
|
import secondlife.network.paik.handlers.events.PlayerMoveByBlockEvent;
|
||||||
|
import secondlife.network.paik.utils.*;
|
||||||
|
import secondlife.network.paik.utils.file.ConfigFile;
|
||||||
|
|
||||||
|
import java.io.*;
|
||||||
|
import java.text.DecimalFormat;
|
||||||
|
import java.text.SimpleDateFormat;
|
||||||
|
import java.util.Date;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.UUID;
|
||||||
|
|
||||||
|
public class CheatHandler extends Handler implements Listener {
|
||||||
|
|
||||||
|
public static HashMap<UUID, Long> ignore;
|
||||||
|
public static HashMap<UUID, Long> ignoreJump;
|
||||||
|
public static File logsDirecotry;
|
||||||
|
public static DecimalFormat dc;
|
||||||
|
public static SimpleDateFormat sdf = new SimpleDateFormat("dd-MM-yyyy - HH:mm:ss");
|
||||||
|
public static Date date = new Date();
|
||||||
|
|
||||||
|
// TEST KURAC 123
|
||||||
|
|
||||||
|
public CheatHandler(Paik plugin) {
|
||||||
|
super(plugin);
|
||||||
|
|
||||||
|
ignore = new HashMap<UUID, Long>();
|
||||||
|
ignoreJump = new HashMap<UUID, Long>();
|
||||||
|
logsDirecotry = new File(this.getInstance().getDataFolder(), "logs");
|
||||||
|
dc = new DecimalFormat("##.##");
|
||||||
|
|
||||||
|
refresh();
|
||||||
|
|
||||||
|
Bukkit.getPluginManager().registerEvents(this, plugin);
|
||||||
|
}
|
||||||
|
|
||||||
|
@EventHandler
|
||||||
|
public void onPlayerCheat(PlayerCheatEvent event) {
|
||||||
|
if (!ConfigFile.configuration.getBoolean("enabled")) return;
|
||||||
|
|
||||||
|
if (ConfigFile.configuration.getBoolean("test-mode")) {
|
||||||
|
Message.sendMessage(Color.translate("&c" + event.getPlayer().getName() + "&4 " + event.getCheck()));
|
||||||
|
event.setCancelled(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (event.isCancelled()) return;
|
||||||
|
|
||||||
|
Player player = event.getPlayer();
|
||||||
|
|
||||||
|
if (AlertsHandler.isActive(player, event.getCheck())) return;
|
||||||
|
|
||||||
|
AlertsHandler.applyCooldown(player, event.getCheck());
|
||||||
|
|
||||||
|
if ( event.getCheck().equalsIgnoreCase("PingSpoof")
|
||||||
|
|| event.getCheck().equalsIgnoreCase("AutoPotion")
|
||||||
|
|| event.getCheck().equalsIgnoreCase("DoubleClick")
|
||||||
|
|| event.getCheck().toLowerCase().startsWith("autoblock")
|
||||||
|
|| event.getCheck().toLowerCase().startsWith("timer")
|
||||||
|
|| event.getCheck().toLowerCase().startsWith("refill")
|
||||||
|
|| event.getCheck().toLowerCase().startsWith("inventory")) {
|
||||||
|
handleAlertNoVL(player, event.getCheck() + " (Experimental)", event.getLocation(), event.getPing(), event.getTps());
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
log(player, "", event.getCheck(), event.getLocation(), event.getPing(), dc.format(event.getTps()));
|
||||||
|
} catch (IOException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (event.getCheck().equalsIgnoreCase("VClip")
|
||||||
|
|| event.getCheck().equalsIgnoreCase("Phase")
|
||||||
|
|| event.getCheck().equalsIgnoreCase("CrackedClient")
|
||||||
|
|| event.getCheck().equalsIgnoreCase("ImpossiblePitch")
|
||||||
|
|| event.getCheck().toLowerCase().startsWith("autoclicker")) {
|
||||||
|
handleAlertNoVL(player, event.getCheck(), event.getLocation(), event.getPing(), event.getTps());
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
PlayerStats stats = PlayerStatsHandler.getStats(player);
|
||||||
|
|
||||||
|
stats.setVl(stats.getVl() + 1);
|
||||||
|
|
||||||
|
handleAlert(player, event.getCheck(), event.getLocation(), stats.getVl(), event.getPing(), event.getTps());
|
||||||
|
|
||||||
|
if (!ConfigFile.configuration.getBoolean("autobans") || player.hasPermission("secondlife.staff")) return;
|
||||||
|
|
||||||
|
if (event.getCheck().equalsIgnoreCase("Killaura (Invalid Swing)")) {
|
||||||
|
handleBan(player);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (stats.getVl() > 4) {
|
||||||
|
try {
|
||||||
|
log(player, event.getCheck(), "WAS AUTOBANNED FOR", LocationUtils.getLocation(player), player.getPing(), new DecimalFormat("##.##").format(Bukkit.spigot().getTPS()[0]));
|
||||||
|
} catch (IOException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (player.getName().equalsIgnoreCase("Zidovcina")) return;
|
||||||
|
|
||||||
|
handleBan(player);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void handleBan(Player player) {
|
||||||
|
PlayerStats stats = PlayerStatsHandler.getStats(player);
|
||||||
|
|
||||||
|
if (stats.isBanned()) return;
|
||||||
|
|
||||||
|
ByteArrayOutputStream b = new ByteArrayOutputStream();
|
||||||
|
DataOutputStream out = new DataOutputStream(b);
|
||||||
|
try {
|
||||||
|
out.writeUTF("BanChannel");
|
||||||
|
out.writeUTF(player.getName());
|
||||||
|
} catch (IOException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
player.sendPluginMessage(Paik.getInstance(), "AutoBan", b.toByteArray());
|
||||||
|
|
||||||
|
Bukkit.dispatchCommand(Bukkit.getConsoleSender(), "banip " + player.getName() + "[Paik] Unfair Advantage -s");
|
||||||
|
|
||||||
|
stats.setBanned(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void handleAlert(Player player, String check, String location, int vl, int ping, double tps) {
|
||||||
|
ByteArrayOutputStream b = new ByteArrayOutputStream();
|
||||||
|
DataOutputStream out = new DataOutputStream(b);
|
||||||
|
try {
|
||||||
|
out.writeUTF("AlertsChannel");
|
||||||
|
out.writeUTF(player.getName());
|
||||||
|
out.writeUTF(check);
|
||||||
|
out.writeUTF(location);
|
||||||
|
out.writeInt(vl);
|
||||||
|
out.writeInt(ping);
|
||||||
|
out.writeDouble(tps);
|
||||||
|
} catch (IOException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
player.sendPluginMessage(Paik.getInstance(), "Alerts", b.toByteArray());
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void handleAlertNoVL(Player player, String check, String location, int ping, double tps) {
|
||||||
|
ByteArrayOutputStream b = new ByteArrayOutputStream();
|
||||||
|
DataOutputStream out = new DataOutputStream(b);
|
||||||
|
try {
|
||||||
|
out.writeUTF("AlertsNoVLChannel");
|
||||||
|
out.writeUTF(player.getName());
|
||||||
|
out.writeUTF(check);
|
||||||
|
out.writeUTF(location);
|
||||||
|
out.writeInt(ping);
|
||||||
|
out.writeDouble(tps);
|
||||||
|
} catch (IOException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
player.sendPluginMessage(Paik.getInstance(), "Alerts", b.toByteArray());
|
||||||
|
}
|
||||||
|
|
||||||
|
@EventHandler
|
||||||
|
public void onPlayerMove(PlayerMoveEvent event) {
|
||||||
|
Player player = event.getPlayer();
|
||||||
|
|
||||||
|
PlayerStats stats = PlayerStatsHandler.getStats(player);
|
||||||
|
|
||||||
|
if (stats == null) return;
|
||||||
|
|
||||||
|
Location from = event.getFrom();
|
||||||
|
Location to = event.getTo();
|
||||||
|
|
||||||
|
double horizontal = Math.sqrt(Math.pow(to.getX() - from.getX(), 2.0D) + Math.pow(to.getZ() - from.getZ(), 2.0D));
|
||||||
|
|
||||||
|
stats.setDelta(horizontal);
|
||||||
|
|
||||||
|
if (from.getBlockX() == to.getBlockX() && from.getBlockY() == to.getBlockY() && from.getBlockZ() == to.getBlockZ()) return;
|
||||||
|
|
||||||
|
Bukkit.getPluginManager().callEvent(new PlayerMoveByBlockEvent(player, to, from));
|
||||||
|
}
|
||||||
|
|
||||||
|
@EventHandler(priority = EventPriority.LOWEST)
|
||||||
|
public void onPlayerQuit(PlayerQuitEvent event) {
|
||||||
|
Player player = event.getPlayer();
|
||||||
|
|
||||||
|
if (AlertsHandler.delays.containsKey(player.getUniqueId())) {
|
||||||
|
AlertsHandler.delays.remove(player.getUniqueId());
|
||||||
|
}
|
||||||
|
|
||||||
|
if (FlyA.onGround.containsKey(player.getUniqueId())) {
|
||||||
|
FlyA.onGround.remove(player.getUniqueId());
|
||||||
|
}
|
||||||
|
|
||||||
|
if (FlyA.upTicks.containsKey(player.getUniqueId())) {
|
||||||
|
FlyA.upTicks.remove(player.getUniqueId());
|
||||||
|
}
|
||||||
|
|
||||||
|
if (ignoreJump.containsKey(player.getUniqueId())) {
|
||||||
|
ignoreJump.remove(player.getUniqueId());
|
||||||
|
}
|
||||||
|
|
||||||
|
if (ignore.containsKey(player.getUniqueId())) {
|
||||||
|
ignore.remove(player.getUniqueId());
|
||||||
|
}
|
||||||
|
|
||||||
|
// lOGGING
|
||||||
|
|
||||||
|
PlayerStats stats = PlayerStatsHandler.getStats(player);
|
||||||
|
|
||||||
|
if(stats != null && !stats.getLogs().isEmpty()) {
|
||||||
|
File log = new File(logsDirecotry, player.getName() + ".txt");
|
||||||
|
|
||||||
|
if(!log.exists()) {
|
||||||
|
try {
|
||||||
|
log.createNewFile();
|
||||||
|
} catch (IOException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
FileWriter fw = new FileWriter(log, false);
|
||||||
|
BufferedWriter bw = new BufferedWriter(fw);
|
||||||
|
|
||||||
|
for(String string : stats.getLogs()) {
|
||||||
|
bw.write(string);
|
||||||
|
bw.newLine();
|
||||||
|
}
|
||||||
|
|
||||||
|
bw.close();
|
||||||
|
fw.close();
|
||||||
|
stats.getLogs().clear();
|
||||||
|
} catch (IOException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@EventHandler
|
||||||
|
public void onBlockBreak(BlockBreakEvent event) {
|
||||||
|
PlayerStats stats = PlayerStatsHandler.getStats(event.getPlayer());
|
||||||
|
|
||||||
|
stats.setLastBlockBreak(System.currentTimeMillis());
|
||||||
|
}
|
||||||
|
|
||||||
|
@EventHandler
|
||||||
|
public void onPlayerJoin(PlayerJoinEvent event) {
|
||||||
|
this.clearList();
|
||||||
|
|
||||||
|
Player player = event.getPlayer();
|
||||||
|
|
||||||
|
PlayerStats stats = PlayerStatsHandler.getStats(player);
|
||||||
|
|
||||||
|
stats.setJoined(System.currentTimeMillis());
|
||||||
|
|
||||||
|
this.ignore(player);
|
||||||
|
}
|
||||||
|
|
||||||
|
@EventHandler
|
||||||
|
public void onPlayerTeleport(PlayerTeleportEvent event) {
|
||||||
|
this.clearList();
|
||||||
|
this.ignore(event.getPlayer());
|
||||||
|
}
|
||||||
|
|
||||||
|
@EventHandler
|
||||||
|
public void onPlayerWorldChanged(PlayerChangedWorldEvent event) {
|
||||||
|
this.clearList();
|
||||||
|
|
||||||
|
Player player = event.getPlayer();
|
||||||
|
|
||||||
|
this.ignore(player);
|
||||||
|
|
||||||
|
player.setSneaking(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
@EventHandler
|
||||||
|
public void onBlockPlace(BlockPlaceEvent event) {
|
||||||
|
this.clearList();
|
||||||
|
|
||||||
|
Player player = event.getPlayer();
|
||||||
|
|
||||||
|
this.ignore(player);
|
||||||
|
|
||||||
|
PlayerStats stats = PlayerStatsHandler.getStats(player);
|
||||||
|
|
||||||
|
stats.setLastBlockPlace(System.currentTimeMillis());
|
||||||
|
}
|
||||||
|
|
||||||
|
@EventHandler(priority = EventPriority.MONITOR)
|
||||||
|
public void onEntityDamageByEntityEvent(EntityDamageByEntityEvent event) {
|
||||||
|
this.clearList();
|
||||||
|
|
||||||
|
if (event.isCancelled()) return;
|
||||||
|
|
||||||
|
if (!(event.getEntity() instanceof Player)) return;
|
||||||
|
|
||||||
|
Player player = (Player) event.getEntity();
|
||||||
|
|
||||||
|
this.ignore(player);
|
||||||
|
}
|
||||||
|
|
||||||
|
@EventHandler
|
||||||
|
public void onEntityDamage(EntityDamageEvent event) {
|
||||||
|
this.clearList();
|
||||||
|
|
||||||
|
if (event.isCancelled()) return;
|
||||||
|
|
||||||
|
if (!(event.getEntity() instanceof Player)) return;
|
||||||
|
|
||||||
|
Player player = (Player) event.getEntity();
|
||||||
|
|
||||||
|
this.ignore(player);
|
||||||
|
}
|
||||||
|
|
||||||
|
@EventHandler
|
||||||
|
public void onPlayerToggleFlight(PlayerToggleFlightEvent event) {
|
||||||
|
this.clearList();
|
||||||
|
this.ignore(event.getPlayer());
|
||||||
|
}
|
||||||
|
|
||||||
|
@EventHandler
|
||||||
|
public void onPlayerStatisticIncreamentEvent(PlayerStatisticIncrementEvent event) {
|
||||||
|
this.clearList();
|
||||||
|
|
||||||
|
if (event.getStatistic() != Statistic.JUMP) return;
|
||||||
|
|
||||||
|
Player player = event.getPlayer();
|
||||||
|
|
||||||
|
Speed.removeJumpOne(player);
|
||||||
|
ignoreJump.put(player.getUniqueId(), System.currentTimeMillis() + 1000);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void clearList() {
|
||||||
|
if (ServerUtils.isServerLagging()) {
|
||||||
|
if (!ignore.isEmpty()) {
|
||||||
|
ignore.clear();
|
||||||
|
}
|
||||||
|
if (!ignoreJump.isEmpty()) {
|
||||||
|
ignoreJump.clear();
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void ignore(Player player) {
|
||||||
|
Speed.removeOne(player);
|
||||||
|
FlyA.removeOne(player);
|
||||||
|
FlyB.removeOne(player);
|
||||||
|
ignore.put(player.getUniqueId(), System.currentTimeMillis() + 3000);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void log(Player player, String message, String check, String location, int ping, String tps) throws IOException {
|
||||||
|
PlayerStats stats = PlayerStatsHandler.getStats(player);
|
||||||
|
|
||||||
|
if(stats == null) return;
|
||||||
|
|
||||||
|
String line = sdf.format(date) + " " + player.getName() + " " + check.toUpperCase() + " " + message + " LOCATION: " + location + " PING: " + ping + " TPS: " + tps;
|
||||||
|
|
||||||
|
stats.getLogs().add(line);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void logPayload(Player player, String message) throws IOException {
|
||||||
|
File log = new File(Paik.getInstance().getDataFolder(), "payload.txt");
|
||||||
|
|
||||||
|
if (!log.exists()) {
|
||||||
|
try {
|
||||||
|
log.createNewFile();
|
||||||
|
} catch (IOException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
BufferedWriter bw = new BufferedWriter(new FileWriter(log, true));
|
||||||
|
try {
|
||||||
|
bw.write(sdf.format(date) + " " + player.getName() + ": " + message);
|
||||||
|
bw.newLine();
|
||||||
|
} catch (IOException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
} finally {
|
||||||
|
bw.flush();
|
||||||
|
bw.close();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void clear() {
|
||||||
|
AlertsHandler.delays.clear();
|
||||||
|
|
||||||
|
CommandHandler.commands.clear();
|
||||||
|
|
||||||
|
FlyA.onGround.clear();
|
||||||
|
FlyA.upTicks.clear();
|
||||||
|
ignoreJump.clear();
|
||||||
|
ignore.clear();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void clearNormal() {
|
||||||
|
AlertsHandler.delays.clear();
|
||||||
|
|
||||||
|
FlyA.onGround.clear();
|
||||||
|
FlyA.upTicks.clear();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void refresh() {
|
||||||
|
new BukkitRunnable() {
|
||||||
|
public void run() {
|
||||||
|
clearNormal();
|
||||||
|
}
|
||||||
|
}.runTaskTimerAsynchronously(Paik.getInstance(), 3600L, 3600L);
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,60 @@
|
||||||
|
package secondlife.network.paik.handlers;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import org.bukkit.command.Command;
|
||||||
|
import org.bukkit.command.CommandExecutor;
|
||||||
|
import org.bukkit.command.CommandSender;
|
||||||
|
import org.bukkit.command.ConsoleCommandSender;
|
||||||
|
|
||||||
|
import secondlife.network.paik.Paik;
|
||||||
|
import secondlife.network.paik.commands.KillauraCommand;
|
||||||
|
import secondlife.network.paik.commands.LogsCommand;
|
||||||
|
import secondlife.network.paik.commands.OCMCCommand;
|
||||||
|
import secondlife.network.paik.commands.PaikBanCommand;
|
||||||
|
import secondlife.network.paik.commands.PaikCommand;
|
||||||
|
import secondlife.network.paik.commands.PingCommand;
|
||||||
|
import secondlife.network.paik.commands.zBaseCommand;
|
||||||
|
import secondlife.network.paik.utils.Handler;
|
||||||
|
import secondlife.network.paik.utils.Message;
|
||||||
|
|
||||||
|
public class CommandHandler extends Handler implements CommandExecutor {
|
||||||
|
|
||||||
|
public static List<zBaseCommand> commands;
|
||||||
|
|
||||||
|
public CommandHandler(Paik plugin) {
|
||||||
|
super(plugin);
|
||||||
|
|
||||||
|
commands = new ArrayList<zBaseCommand>();
|
||||||
|
|
||||||
|
commands.add(new KillauraCommand(plugin));
|
||||||
|
commands.add(new LogsCommand(plugin));
|
||||||
|
commands.add(new OCMCCommand(plugin));
|
||||||
|
commands.add(new PaikBanCommand(plugin));
|
||||||
|
commands.add(new PaikCommand(plugin));
|
||||||
|
commands.add(new PingCommand(plugin));
|
||||||
|
|
||||||
|
for (zBaseCommand command : commands) {
|
||||||
|
this.getInstance().getCommand(command.command).setExecutor(this);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {
|
||||||
|
for (zBaseCommand command : commands) {
|
||||||
|
if (cmd.getName().equalsIgnoreCase(command.command)) {
|
||||||
|
if (((sender instanceof ConsoleCommandSender)) && (command.forPlayerUseOnly)) {
|
||||||
|
sender.sendMessage(Message.COMMANDS_FOR_PLAYER_USE_ONLY.toString());
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
if ((!sender.hasPermission(command.permission)) && (!command.permission.equals(""))) {
|
||||||
|
sender.sendMessage(Message.COMMANDS_NO_PERMISSION_MESSAGE.toString());
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
command.execute(sender, args);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,217 @@
|
||||||
|
package secondlife.network.paik.handlers;
|
||||||
|
|
||||||
|
import com.comphenix.protocol.PacketType;
|
||||||
|
import com.comphenix.protocol.events.ListenerPriority;
|
||||||
|
import com.comphenix.protocol.events.PacketAdapter;
|
||||||
|
import com.comphenix.protocol.events.PacketEvent;
|
||||||
|
import com.comphenix.protocol.wrappers.EnumWrappers;
|
||||||
|
import com.comphenix.protocol.wrappers.EnumWrappers.EntityUseAction;
|
||||||
|
import org.bukkit.entity.Entity;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
import secondlife.network.paik.Paik;
|
||||||
|
import secondlife.network.paik.checks.combat.AutoBlock;
|
||||||
|
import secondlife.network.paik.checks.combat.Killaura;
|
||||||
|
import secondlife.network.paik.checks.combat.Reach;
|
||||||
|
import secondlife.network.paik.checks.movement.Inventory;
|
||||||
|
import secondlife.network.paik.checks.movement.Sneak;
|
||||||
|
import secondlife.network.paik.checks.movement.Timer;
|
||||||
|
import secondlife.network.paik.checks.other.*;
|
||||||
|
import secondlife.network.paik.handlers.data.PlayerStats;
|
||||||
|
import secondlife.network.paik.handlers.data.PlayerStatsHandler;
|
||||||
|
|
||||||
|
public class PacketHandler extends PacketAdapter {
|
||||||
|
|
||||||
|
public PacketHandler(Paik plugin) {
|
||||||
|
super(plugin, ListenerPriority.HIGH, new PacketType[] {
|
||||||
|
PacketType.Play.Client.USE_ENTITY, PacketType.Play.Client.KEEP_ALIVE, PacketType.Play.Client.CLOSE_WINDOW,
|
||||||
|
PacketType.Play.Client.CUSTOM_PAYLOAD, PacketType.Play.Client.BLOCK_PLACE, PacketType.Play.Client.BLOCK_DIG,
|
||||||
|
PacketType.Play.Client.LOOK, PacketType.Play.Client.POSITION_LOOK, PacketType.Play.Client.ARM_ANIMATION,
|
||||||
|
PacketType.Play.Client.POSITION, PacketType.Play.Client.FLYING, PacketType.Play.Client.WINDOW_CLICK,
|
||||||
|
PacketType.Play.Client.ENTITY_ACTION,
|
||||||
|
|
||||||
|
PacketType.Play.Server.ENTITY_METADATA });
|
||||||
|
}
|
||||||
|
|
||||||
|
public void onPacketReceiving(PacketEvent event) {
|
||||||
|
Player player = event.getPlayer();
|
||||||
|
if(player == null) return;
|
||||||
|
|
||||||
|
PlayerStats stats = PlayerStatsHandler.getStats(player);
|
||||||
|
if(stats == null) return;
|
||||||
|
|
||||||
|
PacketType PACKET_TYPE = event.getPacketType();
|
||||||
|
|
||||||
|
if(PACKET_TYPE == PacketType.Play.Client.ENTITY_ACTION) {
|
||||||
|
this.handleEntityActionPacket(player, stats, event);
|
||||||
|
}
|
||||||
|
|
||||||
|
if(PACKET_TYPE == PacketType.Play.Client.USE_ENTITY) {
|
||||||
|
this.handleUseEntityPacket(player, stats, event);
|
||||||
|
}
|
||||||
|
|
||||||
|
if(PACKET_TYPE == PacketType.Play.Client.KEEP_ALIVE) {
|
||||||
|
this.handleKeepAlivePacket(player, stats);
|
||||||
|
}
|
||||||
|
|
||||||
|
if(PACKET_TYPE == PacketType.Play.Client.CLOSE_WINDOW) {
|
||||||
|
this.handleWindowClosePacket(player, stats);
|
||||||
|
}
|
||||||
|
|
||||||
|
if(PACKET_TYPE == PacketType.Play.Client.CUSTOM_PAYLOAD) {
|
||||||
|
this.handleCustomPayloadPacket(player, stats, event);
|
||||||
|
}
|
||||||
|
|
||||||
|
if(PACKET_TYPE == PacketType.Play.Client.BLOCK_PLACE) {
|
||||||
|
this.handleBlockPlacePacket(player, stats);
|
||||||
|
}
|
||||||
|
|
||||||
|
if(PACKET_TYPE == PacketType.Play.Client.BLOCK_DIG) {
|
||||||
|
this.handleBlockDigPacket(player, stats);
|
||||||
|
}
|
||||||
|
|
||||||
|
if(PACKET_TYPE == PacketType.Play.Client.LOOK) {
|
||||||
|
this.handleLookAndPositionLookPacket(player, stats, event);
|
||||||
|
this.handlePositionLookPacket(player, stats);
|
||||||
|
}
|
||||||
|
|
||||||
|
if(PACKET_TYPE == PacketType.Play.Client.POSITION_LOOK) {
|
||||||
|
this.handleLookAndPositionLookPacket(player, stats, event);
|
||||||
|
this.handlePositionLookPacket(player, stats);
|
||||||
|
}
|
||||||
|
|
||||||
|
if(PACKET_TYPE == PacketType.Play.Client.POSITION) {
|
||||||
|
this.handlePositionPacket(player, stats);
|
||||||
|
}
|
||||||
|
|
||||||
|
if(PACKET_TYPE == PacketType.Play.Client.FLYING) {
|
||||||
|
this.handleFlyingPacket(player, stats);
|
||||||
|
}
|
||||||
|
|
||||||
|
if(PACKET_TYPE == PacketType.Play.Client.ARM_ANIMATION) {
|
||||||
|
this.handleArmAnimationPacket(player, stats);
|
||||||
|
}
|
||||||
|
|
||||||
|
if(PACKET_TYPE == PacketType.Play.Client.WINDOW_CLICK) {
|
||||||
|
this.handleWindowClickPacket(player, stats, event);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void onPacketSending(PacketEvent event) {
|
||||||
|
Player player = event.getPlayer();
|
||||||
|
if(player == null) return;
|
||||||
|
|
||||||
|
PlayerStats stats = PlayerStatsHandler.getStats(player);
|
||||||
|
if(stats == null) return;
|
||||||
|
|
||||||
|
PacketType PACKET_TYPE = event.getPacketType();
|
||||||
|
|
||||||
|
if(PACKET_TYPE == PacketType.Play.Server.ENTITY_METADATA) {
|
||||||
|
this.handleEntityMetadataPacket(player, event);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void handleWindowClosePacket(Player player, PlayerStats stats) {
|
||||||
|
Inventory.handleInventoryClose(player, stats);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void handleUseEntityPacket(Player player, PlayerStats stats, PacketEvent event) {
|
||||||
|
EnumWrappers.EntityUseAction type;
|
||||||
|
try {
|
||||||
|
type = event.getPacket().getEntityUseActions().read(0);
|
||||||
|
} catch (Exception ex) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(type != EntityUseAction.ATTACK) return;
|
||||||
|
|
||||||
|
int entityID = event.getPacket().getIntegers().read(0);
|
||||||
|
|
||||||
|
stats.setLastUseEntityPacket(System.currentTimeMillis());
|
||||||
|
|
||||||
|
Reach.handleReachCheck(player, stats, entityID);
|
||||||
|
Killaura.handleKillauraBotCheck(player, entityID);
|
||||||
|
|
||||||
|
Entity hit = null;
|
||||||
|
|
||||||
|
if(player.getWorld().getEntities().size() > 0) {
|
||||||
|
for(Entity entity : player.getWorld().getEntities()) {
|
||||||
|
if(entity.getEntityId() == entityID) {
|
||||||
|
hit = entity;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if(hit == null) return;
|
||||||
|
|
||||||
|
stats.setLastEntity(hit);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void handleKeepAlivePacket(Player player, PlayerStats stats) {
|
||||||
|
PingSpoof.handlePingSpoof(player, stats);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void handleCustomPayloadPacket(Player player, PlayerStats stats, PacketEvent event) {
|
||||||
|
String message = event.getPacket().getStrings().read(0);
|
||||||
|
|
||||||
|
CustomPayload.handleCustomPayload(player, stats, message);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void handleBlockPlacePacket(Player player, PlayerStats stats) {
|
||||||
|
stats.setLastBlockPlacePacket(System.currentTimeMillis());
|
||||||
|
stats.setAutoblock2(stats.getAutoblock2() + 1);
|
||||||
|
|
||||||
|
AutoBlock.handleAutoBlockPlace(player, stats);
|
||||||
|
Crash.handleBlockPlaceCrash(player, stats);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void handleBlockDigPacket(Player player, PlayerStats stats) {
|
||||||
|
stats.setLastBlockDigPacket(System.currentTimeMillis());
|
||||||
|
stats.setAutoblock2(stats.getAutoblock2() + 1);
|
||||||
|
|
||||||
|
AutoBlock.handleAutoBlockDig(player, stats);
|
||||||
|
AutoBlock.handleAutoBlock(player, stats);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void handleLookAndPositionLookPacket(Player player, PlayerStats stats, PacketEvent event) {
|
||||||
|
float yaw = event.getPacket().getFloat().read(0);
|
||||||
|
float pitch = event.getPacket().getFloat().read(1);
|
||||||
|
|
||||||
|
ImpossiblePitch.handleImpossiblePitch(player, stats, pitch);
|
||||||
|
Killaura.handleKillauraAngle(player, stats, yaw, pitch);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void handlePositionLookPacket(Player player, PlayerStats stats) {
|
||||||
|
Timer.handleTimerPositionLook(player, stats);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void handlePositionPacket(Player player, PlayerStats stats) {
|
||||||
|
stats.setMorePackets(stats.getMorePackets() + 1);
|
||||||
|
|
||||||
|
Timer.handleTimerPosition(player, stats);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void handleFlyingPacket(Player player, PlayerStats stats) {
|
||||||
|
Timer.handleTimerFlying(player, stats);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void handleArmAnimationPacket(Player player, PlayerStats stats) {
|
||||||
|
Crash.handleAnimationCrash(player, stats);
|
||||||
|
Killaura.handleKillauraWall(player, stats);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void handleWindowClickPacket(Player player, PlayerStats stats, PacketEvent event) {
|
||||||
|
Refill.handleRefill(player, stats, event);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void handleEntityActionPacket(Player player, PlayerStats stats, PacketEvent event) {
|
||||||
|
int actionId = event.getPacket().getIntegers().read(1);
|
||||||
|
|
||||||
|
if(actionId == 1 || actionId == 2) {
|
||||||
|
Sneak.handleSneak(player, stats);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void handleEntityMetadataPacket(Player player, PacketEvent event) {
|
||||||
|
Nametags.handleHealthRandomizer(player, event);
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,180 @@
|
||||||
|
package secondlife.network.paik.handlers;
|
||||||
|
|
||||||
|
import org.bukkit.Achievement;
|
||||||
|
import org.bukkit.Bukkit;
|
||||||
|
import org.bukkit.GameMode;
|
||||||
|
import org.bukkit.entity.Arrow;
|
||||||
|
import org.bukkit.entity.EntityType;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
import org.bukkit.event.EventHandler;
|
||||||
|
import org.bukkit.event.EventPriority;
|
||||||
|
import org.bukkit.event.Listener;
|
||||||
|
import org.bukkit.event.block.Action;
|
||||||
|
import org.bukkit.event.entity.*;
|
||||||
|
import org.bukkit.event.inventory.InventoryOpenEvent;
|
||||||
|
import org.bukkit.event.player.*;
|
||||||
|
import secondlife.network.paik.Paik;
|
||||||
|
import secondlife.network.paik.checks.combat.*;
|
||||||
|
import secondlife.network.paik.checks.movement.GroundSpoof;
|
||||||
|
import secondlife.network.paik.checks.movement.Inventory;
|
||||||
|
import secondlife.network.paik.checks.movement.NoSlowdown;
|
||||||
|
import secondlife.network.paik.checks.movement.Speed;
|
||||||
|
import secondlife.network.paik.checks.movement.fly.FlyA;
|
||||||
|
import secondlife.network.paik.checks.movement.fly.FlyB;
|
||||||
|
import secondlife.network.paik.checks.other.InvalidInteract;
|
||||||
|
import secondlife.network.paik.handlers.data.PlayerStats;
|
||||||
|
import secondlife.network.paik.handlers.data.PlayerStatsHandler;
|
||||||
|
import secondlife.network.paik.handlers.events.PlayerMoveByBlockEvent;
|
||||||
|
import secondlife.network.paik.utils.Handler;
|
||||||
|
import secondlife.network.paik.utils.ServerUtils;
|
||||||
|
|
||||||
|
public class PlayerHandler extends Handler implements Listener {
|
||||||
|
|
||||||
|
public PlayerHandler(Paik plugin) {
|
||||||
|
super(plugin);
|
||||||
|
|
||||||
|
Bukkit.getPluginManager().registerEvents(this, plugin);
|
||||||
|
}
|
||||||
|
|
||||||
|
@EventHandler
|
||||||
|
public void onPlayerInteract(PlayerInteractEvent event) {
|
||||||
|
Player player = event.getPlayer();
|
||||||
|
PlayerStats stats = PlayerStatsHandler.getStats(player);
|
||||||
|
Action action = event.getAction();
|
||||||
|
|
||||||
|
AutoClicker.handleAutoClickInteract(player, stats, action);
|
||||||
|
FastBow.handleFastBowInteract(player, stats);
|
||||||
|
InvalidInteract.handleInvalidInteract(player, stats, action);
|
||||||
|
}
|
||||||
|
|
||||||
|
@EventHandler
|
||||||
|
public void onEntityShootBow(EntityShootBowEvent event) {
|
||||||
|
if(event.isCancelled()) return;
|
||||||
|
if(!(event.getEntity() instanceof Player)) return;
|
||||||
|
|
||||||
|
Arrow arrow = (Arrow) event.getProjectile();
|
||||||
|
Player player = (Player) arrow.getShooter();
|
||||||
|
PlayerStats stats = PlayerStatsHandler.getStats(player);
|
||||||
|
|
||||||
|
double power = arrow.getVelocity().length();
|
||||||
|
|
||||||
|
FastBow.handleFastBowShoot(player, stats, power);
|
||||||
|
NoSlowdown.handleNoSlowdownShooting(player, stats);
|
||||||
|
}
|
||||||
|
@EventHandler
|
||||||
|
public void onPlayerItemConsume(PlayerItemConsumeEvent event) {
|
||||||
|
if(event.isCancelled()) return;
|
||||||
|
|
||||||
|
Player player = event.getPlayer();
|
||||||
|
PlayerStats stats = PlayerStatsHandler.getStats(player);
|
||||||
|
|
||||||
|
FastEat.handleFastEat(player, stats);
|
||||||
|
NoSlowdown.handleNoSlowdownEating(player, stats);
|
||||||
|
}
|
||||||
|
|
||||||
|
@EventHandler(priority = EventPriority.MONITOR)
|
||||||
|
public void onEntityDamageByEntity(EntityDamageByEntityEvent event) {
|
||||||
|
if(!(event.getDamager() instanceof Player)) return;
|
||||||
|
|
||||||
|
Player player = (Player) event.getDamager();
|
||||||
|
PlayerStats stats = PlayerStatsHandler.getStats(player);
|
||||||
|
|
||||||
|
Killaura.handleKillaura(player, stats);
|
||||||
|
}
|
||||||
|
|
||||||
|
@EventHandler
|
||||||
|
public void onEntityRegainHealth(EntityRegainHealthEvent event) {
|
||||||
|
if(event.isCancelled()
|
||||||
|
|| event.getEntityType() != EntityType.PLAYER
|
||||||
|
|| event.getRegainReason() != EntityRegainHealthEvent.RegainReason.SATIATED)
|
||||||
|
return;
|
||||||
|
|
||||||
|
Player player = (Player) event.getEntity();
|
||||||
|
PlayerStats stats = PlayerStatsHandler.getStats(player);
|
||||||
|
|
||||||
|
Regen.handleRegen(player, stats);
|
||||||
|
}
|
||||||
|
|
||||||
|
@EventHandler
|
||||||
|
public void onPlayerMoveByBlockEvent(PlayerMoveByBlockEvent event) {
|
||||||
|
Player player = event.getPlayer();
|
||||||
|
PlayerStats stats = PlayerStatsHandler.getStats(player);
|
||||||
|
|
||||||
|
FlyA.handleFly(player, stats, event);
|
||||||
|
FlyB.handleFly(player, stats, event);
|
||||||
|
GroundSpoof.handleGroundSpoof(player, stats, event);
|
||||||
|
Inventory.handleInventoryMove(player, stats, event);
|
||||||
|
Speed.handleSpeed(player, stats, event);
|
||||||
|
}
|
||||||
|
|
||||||
|
@EventHandler
|
||||||
|
public void onPlayerJoin(PlayerJoinEvent event) {
|
||||||
|
Player player = event.getPlayer();
|
||||||
|
|
||||||
|
if(!player.hasAchievement(Achievement.OPEN_INVENTORY)) return;
|
||||||
|
|
||||||
|
player.removeAchievement(Achievement.OPEN_INVENTORY);
|
||||||
|
}
|
||||||
|
|
||||||
|
@EventHandler
|
||||||
|
public void onPlayerDeath(PlayerDeathEvent event) {
|
||||||
|
PlayerStats stats = PlayerStatsHandler.getStats(event.getEntity());
|
||||||
|
|
||||||
|
stats.setInventoryOpen(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
@EventHandler
|
||||||
|
public void onPlayerAchievementAwarded(PlayerAchievementAwardedEvent event) {
|
||||||
|
if(event.getAchievement() != Achievement.OPEN_INVENTORY) return;
|
||||||
|
|
||||||
|
event.setCancelled(true);
|
||||||
|
|
||||||
|
Player player = event.getPlayer();
|
||||||
|
|
||||||
|
if(ServerUtils.isServerLagging()
|
||||||
|
|| player.getGameMode() == GameMode.CREATIVE
|
||||||
|
|| player.getAllowFlight())
|
||||||
|
return;
|
||||||
|
|
||||||
|
PlayerStats stats = PlayerStatsHandler.getStats(player);
|
||||||
|
|
||||||
|
stats.setInventoryOpen(true);
|
||||||
|
|
||||||
|
Killaura.teleportBot(player);
|
||||||
|
}
|
||||||
|
|
||||||
|
@EventHandler
|
||||||
|
public void onInventoryOpen(InventoryOpenEvent event) {
|
||||||
|
Player player = (Player) event.getPlayer();
|
||||||
|
PlayerStats stats = PlayerStatsHandler.getStats(player);
|
||||||
|
|
||||||
|
stats.setInventoryOpen(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
@EventHandler
|
||||||
|
public void onPlayerWorldChange(PlayerChangedWorldEvent event) {
|
||||||
|
PlayerStats stats = PlayerStatsHandler.getStats(event.getPlayer());
|
||||||
|
|
||||||
|
stats.setInventoryOpen(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
@EventHandler
|
||||||
|
public void onPlayerTeleport(PlayerTeleportEvent event) {
|
||||||
|
if(event.getCause() == PlayerTeleportEvent.TeleportCause.ENDER_PEARL) return;
|
||||||
|
|
||||||
|
PlayerStats stats = PlayerStatsHandler.getStats(event.getPlayer());
|
||||||
|
|
||||||
|
stats.setInventoryOpen(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
@EventHandler
|
||||||
|
public void onPotionSplash(PotionSplashEvent event) {
|
||||||
|
if(event.isCancelled()) return;
|
||||||
|
if(!(event.getEntity() instanceof Player)) return;
|
||||||
|
|
||||||
|
Player player = (Player) event.getEntity();
|
||||||
|
PlayerStats stats = PlayerStatsHandler.getStats(player);
|
||||||
|
|
||||||
|
Inventory.handleAutoPotion(player, stats);
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,119 @@
|
||||||
|
package secondlife.network.paik.handlers.data;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.UUID;
|
||||||
|
|
||||||
|
import org.bukkit.entity.Entity;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
|
import lombok.Getter;
|
||||||
|
import lombok.Setter;
|
||||||
|
|
||||||
|
@Getter
|
||||||
|
@Setter
|
||||||
|
public class PlayerStats {
|
||||||
|
|
||||||
|
private UUID uuid;
|
||||||
|
|
||||||
|
private ArrayList<String> logs = new ArrayList<String>();
|
||||||
|
|
||||||
|
private Entity lastEntity;
|
||||||
|
|
||||||
|
private int leftClickCPS = 0;
|
||||||
|
private int autoclickerVL = 0;
|
||||||
|
private int constantCPS = 0;
|
||||||
|
private int doubleclick = 0;
|
||||||
|
|
||||||
|
private long click1 = 0;
|
||||||
|
private long click2 = 0;
|
||||||
|
|
||||||
|
private int regenVL = 0;
|
||||||
|
|
||||||
|
private long bowVL = 0;
|
||||||
|
private long pull;
|
||||||
|
|
||||||
|
private int swingAngle = 0;
|
||||||
|
private int botHits = 0;
|
||||||
|
private int hits = 0;
|
||||||
|
private long lastUseEntityPacket;
|
||||||
|
private int hitsInvalidPacket = 0;
|
||||||
|
private int hitsWhileDead = 0;
|
||||||
|
private int noSwingDamageVL = 0;
|
||||||
|
|
||||||
|
private int reachVL;
|
||||||
|
private double delta;
|
||||||
|
|
||||||
|
private long lastRegen;
|
||||||
|
|
||||||
|
private int flyAVL = 0;
|
||||||
|
private int flyBVL = 0;
|
||||||
|
|
||||||
|
private int fastEatVL = 0;
|
||||||
|
private long lastEat;
|
||||||
|
|
||||||
|
private boolean inventoryOpen = false;
|
||||||
|
private int movesWhileInventoryClosed = 0;
|
||||||
|
private int hitsWhileInventoryOpen = 0;
|
||||||
|
private int potionsSplashedWhileInventoryOpen = 0;
|
||||||
|
|
||||||
|
private int nofallVL = 0;
|
||||||
|
|
||||||
|
private int noslowFoodVl = 0;
|
||||||
|
private int noslowBowVl = 0;
|
||||||
|
|
||||||
|
private long sneak1;
|
||||||
|
private long sneak2;
|
||||||
|
private int sneakVL = 0;
|
||||||
|
|
||||||
|
private int speedVL = 0;
|
||||||
|
private int speedJumpVL = 0;
|
||||||
|
private int speedOtherVL = 0;
|
||||||
|
private int speedSlowhopVL = 0;
|
||||||
|
private int speedFast = 0;
|
||||||
|
|
||||||
|
private int morePackets = 0;
|
||||||
|
private int flyingPackets = 0;
|
||||||
|
private int positionPackets = 0;
|
||||||
|
private int positionLookPackets = 0;
|
||||||
|
private int timerAVL = 0;
|
||||||
|
private int timerBVL = 0;
|
||||||
|
private int timerCVL = 0;
|
||||||
|
|
||||||
|
private int boxer1 = 0;
|
||||||
|
private int boxer2 = 0;
|
||||||
|
|
||||||
|
private int lastPing;
|
||||||
|
private int pingSpoof = 0;
|
||||||
|
|
||||||
|
private long lastClick;
|
||||||
|
private int refill;
|
||||||
|
private int refillOther;
|
||||||
|
private int lastSlot;
|
||||||
|
|
||||||
|
private int autoblock = 0;
|
||||||
|
private int autoblock2 = 0;
|
||||||
|
|
||||||
|
private float lastYaw;
|
||||||
|
private float lastPitch;
|
||||||
|
private int angle;
|
||||||
|
|
||||||
|
private int invalidInteract = 0;
|
||||||
|
|
||||||
|
private long joined;
|
||||||
|
private long lastBlockPlace;
|
||||||
|
private long lastBlockBreak;
|
||||||
|
private long lastBlockPlacePacket;
|
||||||
|
private long lastArmPacket = 0;
|
||||||
|
private long lastBlockPacket = 0;
|
||||||
|
private long lastBlockDigPacket = 0;
|
||||||
|
|
||||||
|
private int vl = 0;
|
||||||
|
|
||||||
|
private boolean ocmc = false;
|
||||||
|
private boolean banned = false;
|
||||||
|
|
||||||
|
|
||||||
|
public PlayerStats(Player player) {
|
||||||
|
this.uuid = player.getUniqueId();
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,57 @@
|
||||||
|
package secondlife.network.paik.handlers.data;
|
||||||
|
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.UUID;
|
||||||
|
|
||||||
|
import org.bukkit.Bukkit;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
import org.bukkit.event.EventHandler;
|
||||||
|
import org.bukkit.event.Listener;
|
||||||
|
import org.bukkit.event.player.PlayerJoinEvent;
|
||||||
|
import org.bukkit.event.player.PlayerQuitEvent;
|
||||||
|
|
||||||
|
import secondlife.network.paik.Paik;
|
||||||
|
import secondlife.network.paik.utils.Handler;
|
||||||
|
|
||||||
|
public class PlayerStatsHandler extends Handler implements Listener {
|
||||||
|
|
||||||
|
public static HashMap<UUID, PlayerStats> statsMap;
|
||||||
|
|
||||||
|
public PlayerStatsHandler(Paik plugin) {
|
||||||
|
super(plugin);
|
||||||
|
|
||||||
|
statsMap = new HashMap<UUID, PlayerStats>();
|
||||||
|
|
||||||
|
for(Player player : Bukkit.getOnlinePlayers()) {
|
||||||
|
addStats(player);
|
||||||
|
}
|
||||||
|
|
||||||
|
Bukkit.getPluginManager().registerEvents(this, plugin);
|
||||||
|
}
|
||||||
|
|
||||||
|
@EventHandler
|
||||||
|
public void onPlayerJoin(PlayerJoinEvent event) {
|
||||||
|
Player player = event.getPlayer();
|
||||||
|
|
||||||
|
addStats(player);
|
||||||
|
}
|
||||||
|
|
||||||
|
@EventHandler
|
||||||
|
public void onPlayerQuit(PlayerQuitEvent event) {
|
||||||
|
Player player = event.getPlayer();
|
||||||
|
|
||||||
|
destroyStats(player);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void addStats(Player player) {
|
||||||
|
statsMap.put(player.getUniqueId(), new PlayerStats(player));
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void destroyStats(Player player) {
|
||||||
|
statsMap.remove(player.getUniqueId());
|
||||||
|
}
|
||||||
|
|
||||||
|
public static PlayerStats getStats(Player player) {
|
||||||
|
return statsMap.get(player.getUniqueId());
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,36 @@
|
||||||
|
package secondlife.network.paik.handlers.events;
|
||||||
|
|
||||||
|
import org.bukkit.Location;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
import org.bukkit.event.Event;
|
||||||
|
import org.bukkit.event.HandlerList;
|
||||||
|
|
||||||
|
import lombok.Getter;
|
||||||
|
import lombok.Setter;
|
||||||
|
|
||||||
|
@Getter
|
||||||
|
@Setter
|
||||||
|
public class PlayerMoveByBlockEvent extends Event {
|
||||||
|
|
||||||
|
private Player player;
|
||||||
|
private Location to;
|
||||||
|
private Location from;
|
||||||
|
|
||||||
|
private boolean cancelled;
|
||||||
|
|
||||||
|
public PlayerMoveByBlockEvent(Player player, Location to, Location from) {
|
||||||
|
this.player = player;
|
||||||
|
this.to = to;
|
||||||
|
this.from = from;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static final HandlerList handlers = new HandlerList();
|
||||||
|
|
||||||
|
public HandlerList getHandlers() {
|
||||||
|
return handlers;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static HandlerList getHandlerList() {
|
||||||
|
return handlers;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,52 @@
|
||||||
|
package secondlife.network.paik.handlers.fixes;
|
||||||
|
|
||||||
|
import org.bukkit.Bukkit;
|
||||||
|
import org.bukkit.Material;
|
||||||
|
import org.bukkit.enchantments.Enchantment;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
import org.bukkit.event.EventHandler;
|
||||||
|
import org.bukkit.event.Listener;
|
||||||
|
import org.bukkit.event.player.PlayerEditBookEvent;
|
||||||
|
import org.bukkit.event.player.PlayerInteractEvent;
|
||||||
|
import org.bukkit.inventory.ItemStack;
|
||||||
|
|
||||||
|
import secondlife.network.paik.Paik;
|
||||||
|
import secondlife.network.paik.utils.Handler;
|
||||||
|
|
||||||
|
public class BookExploitHandler extends Handler implements Listener {
|
||||||
|
|
||||||
|
public BookExploitHandler(Paik plugin) {
|
||||||
|
super(plugin);
|
||||||
|
|
||||||
|
Bukkit.getPluginManager().registerEvents(this, plugin);
|
||||||
|
}
|
||||||
|
|
||||||
|
@EventHandler
|
||||||
|
public void onPlayerInteract(PlayerInteractEvent event) {
|
||||||
|
Player player = event.getPlayer();
|
||||||
|
ItemStack item = player.getItemInHand();
|
||||||
|
|
||||||
|
if(item == null) return;
|
||||||
|
if((item.getType() != Material.BOOK_AND_QUILL) && (item.getType() != Material.WRITTEN_BOOK)) return;
|
||||||
|
|
||||||
|
if(item.getEnchantments().size() > 0) {
|
||||||
|
for(Enchantment enchant : item.getEnchantments().keySet()) {
|
||||||
|
item.removeEnchantment(enchant);
|
||||||
|
}
|
||||||
|
|
||||||
|
event.setCancelled(true);
|
||||||
|
player.getInventory().removeItem(new ItemStack[] { item });
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@EventHandler
|
||||||
|
public void onPlayerEditBook(PlayerEditBookEvent event) {
|
||||||
|
if (event.getNewBookMeta().getEnchants().size() > 0) {
|
||||||
|
event.setCancelled(true);
|
||||||
|
|
||||||
|
Player player = event.getPlayer();
|
||||||
|
|
||||||
|
player.getInventory().remove(Material.BOOK_AND_QUILL);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,63 @@
|
||||||
|
package secondlife.network.paik.handlers.fixes;
|
||||||
|
|
||||||
|
import org.bukkit.Bukkit;
|
||||||
|
import org.bukkit.Material;
|
||||||
|
import org.bukkit.block.Block;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
import org.bukkit.event.EventHandler;
|
||||||
|
import org.bukkit.event.Listener;
|
||||||
|
import org.bukkit.event.player.PlayerInteractEvent;
|
||||||
|
import org.bukkit.inventory.ItemStack;
|
||||||
|
|
||||||
|
import secondlife.network.paik.Paik;
|
||||||
|
import secondlife.network.paik.utils.Handler;
|
||||||
|
|
||||||
|
public class FenceGlitchHandler extends Handler implements Listener {
|
||||||
|
|
||||||
|
public static Material[] materials;
|
||||||
|
|
||||||
|
public FenceGlitchHandler(Paik plugin) {
|
||||||
|
super(plugin);
|
||||||
|
|
||||||
|
materials = new Material[] {
|
||||||
|
Material.POTION,
|
||||||
|
Material.GOLDEN_APPLE,
|
||||||
|
Material.DIAMOND_SWORD,
|
||||||
|
Material.GOLD_SWORD,
|
||||||
|
Material.IRON_SWORD,
|
||||||
|
Material.STONE_SWORD,
|
||||||
|
Material.WOOD_SWORD,
|
||||||
|
Material.COOKED_BEEF,
|
||||||
|
Material.RAW_BEEF,
|
||||||
|
Material.COOKED_CHICKEN,
|
||||||
|
Material.RAW_CHICKEN,
|
||||||
|
Material.BAKED_POTATO,
|
||||||
|
Material.GOLDEN_CARROT,
|
||||||
|
Material.PORK,
|
||||||
|
Material.GRILLED_PORK,
|
||||||
|
Material.PUMPKIN_PIE,
|
||||||
|
Material.BOW };
|
||||||
|
|
||||||
|
Bukkit.getPluginManager().registerEvents(this, plugin);
|
||||||
|
}
|
||||||
|
|
||||||
|
@EventHandler
|
||||||
|
public void onPlayerInteract(PlayerInteractEvent event) {
|
||||||
|
if(event.isCancelled()) return;
|
||||||
|
|
||||||
|
Player player = event.getPlayer();
|
||||||
|
ItemStack item = player.getItemInHand();
|
||||||
|
|
||||||
|
if(item == null) return;
|
||||||
|
|
||||||
|
Block block = event.getClickedBlock();
|
||||||
|
|
||||||
|
if(block.getType() == Material.FENCE || block.getType() == Material.NETHER_FENCE || block.getType() == Material.CAULDRON) {
|
||||||
|
for(Material material : materials) {
|
||||||
|
if(item.getType() == material) {
|
||||||
|
event.setCancelled(true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,260 @@
|
||||||
|
package secondlife.network.paik.utils;
|
||||||
|
|
||||||
|
import org.bukkit.Location;
|
||||||
|
import org.bukkit.Material;
|
||||||
|
import org.bukkit.block.Block;
|
||||||
|
import org.bukkit.block.BlockFace;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Random;
|
||||||
|
|
||||||
|
public class CheatUtils {
|
||||||
|
|
||||||
|
public static int random(int min, int max) {
|
||||||
|
Random rand = new Random();
|
||||||
|
int randomNum = rand.nextInt(max - min + 1) + min;
|
||||||
|
return randomNum;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static boolean isOnIce(Player player) {
|
||||||
|
|
||||||
|
Location location = player.getLocation();
|
||||||
|
location.setY(location.getY() - 1.0);
|
||||||
|
|
||||||
|
if(location.getBlock().getType() == Material.ICE && location.subtract(0, 1, 0).getBlock().getType() == Material.ICE) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(location.getBlock().getType() == Material.PACKED_ICE && location.subtract(0, 1, 0).getBlock().getType() == Material.PACKED_ICE) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static boolean isOnSolidBlock(Player player) {
|
||||||
|
|
||||||
|
Location location = player.getLocation();
|
||||||
|
|
||||||
|
if(location.getBlock().getType().isSolid()) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
location.setY(location.getY() - 1.0);
|
||||||
|
|
||||||
|
if(location.getBlock().getType().isSolid()) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static boolean isOnSnow(Player player) {
|
||||||
|
|
||||||
|
Location location = player.getLocation();
|
||||||
|
location.setY(location.getY() - 0.1);
|
||||||
|
|
||||||
|
if(location.getBlock().getType() == Material.SNOW) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static boolean isInAir(Player player) {
|
||||||
|
|
||||||
|
Location location = player.getLocation();
|
||||||
|
location.setY(location.getY() - 1);
|
||||||
|
|
||||||
|
if(location.getBlock().getType() == Material.AIR && location.subtract(0, 1, 0).getBlock().getType() == Material.AIR) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static boolean isOnHalfBlocks(Player player) {
|
||||||
|
|
||||||
|
Location location = player.getLocation();
|
||||||
|
location.setY(location.getY() - 0.5);
|
||||||
|
|
||||||
|
if(location.getBlock().getType() == Material.STEP
|
||||||
|
|| location.getBlock().getType() == Material.WOOD_STEP
|
||||||
|
|| location.getBlock().getType() == Material.TRAP_DOOR
|
||||||
|
|| location.getBlock().getType() == Material.DAYLIGHT_DETECTOR
|
||||||
|
|| location.getBlock().getType() == Material.SNOW) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static Byte direction(Player player) {
|
||||||
|
double rotation = (player.getLocation().getYaw() - 90) % 360;
|
||||||
|
if (rotation < 0) {
|
||||||
|
rotation += 360.0;
|
||||||
|
}
|
||||||
|
if (0 <= rotation && rotation < 22.5) {
|
||||||
|
return 0xC; // S > E
|
||||||
|
} else if (22.5 <= rotation && rotation < 67.5) {
|
||||||
|
return 0xE; // SW > SE
|
||||||
|
} else if (67.5 <= rotation && rotation < 112.5) {
|
||||||
|
return 0x0; // W > E
|
||||||
|
} else if (112.5 <= rotation && rotation < 157.5) {
|
||||||
|
return 0x2; // NW > SW
|
||||||
|
} else if (157.5 <= rotation && rotation < 202.5) {
|
||||||
|
return 0x4; // N > W
|
||||||
|
} else if (202.5 <= rotation && rotation < 247.5) {
|
||||||
|
return 0x6; // NE > NW
|
||||||
|
} else if (247.5 <= rotation && rotation < 292.5) {
|
||||||
|
return 0x8; // E > N
|
||||||
|
} else if (292.5 <= rotation && rotation < 337.5) {
|
||||||
|
return 0xA; // SE > NE
|
||||||
|
} else if (337.5 <= rotation && rotation < 360.0) {
|
||||||
|
return 0xC; // S > E
|
||||||
|
} else {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static boolean isInLiquid(Player player) {
|
||||||
|
|
||||||
|
Location location = player.getLocation();
|
||||||
|
|
||||||
|
if(location.getBlock().getType() == Material.WATER
|
||||||
|
|| location.getBlock().getType() == Material.STATIONARY_WATER
|
||||||
|
|| location.getBlock().getType() == Material.LAVA
|
||||||
|
|| location.getBlock().getType() == Material.STATIONARY_LAVA) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static boolean isOnSolidBlocks(Player player) {
|
||||||
|
|
||||||
|
Location location = player.getLocation();
|
||||||
|
location.setY(location.getY() - 1);
|
||||||
|
|
||||||
|
if(location.getBlock().getType() == Material.ACACIA_STAIRS || location.getBlock().getType() == Material.BIRCH_WOOD_STAIRS
|
||||||
|
|| location.getBlock().getType() == Material.BRICK_STAIRS || location.getBlock().getType() == Material.COBBLESTONE_STAIRS
|
||||||
|
|| location.getBlock().getType() == Material.DARK_OAK_STAIRS || location.getBlock().getType() == Material.JUNGLE_WOOD_STAIRS
|
||||||
|
|| location.getBlock().getType() == Material.NETHER_BRICK_STAIRS || location.getBlock().getType() == Material.QUARTZ_STAIRS
|
||||||
|
|| location.getBlock().getType() == Material.SANDSTONE_STAIRS || location.getBlock().getType() == Material.SMOOTH_STAIRS
|
||||||
|
|| location.getBlock().getType() == Material.SPRUCE_WOOD_STAIRS || location.getBlock().getType() == Material.WOOD_STAIRS
|
||||||
|
|| location.getBlock().getType() == Material.CHEST || location.getBlock().getType() == Material.TRAPPED_CHEST
|
||||||
|
|| location.getBlock().getType() == Material.FENCE || location.getBlock().getType() == Material.IRON_FENCE
|
||||||
|
|| location.getBlock().getType() == Material.NETHER_FENCE || location.getBlock().getType() == Material.FENCE_GATE
|
||||||
|
|| location.getBlock().getType() == Material.SIGN_POST || location.getBlock().getType() == Material.WALL_SIGN
|
||||||
|
|| location.getBlock().getType() == Material.COBBLE_WALL || location.getBlock().getType() == Material.ENCHANTMENT_TABLE
|
||||||
|
|| location.getBlock().getType() == Material.ENDER_PORTAL_FRAME || location.getBlock().getType() == Material.ENDER_CHEST
|
||||||
|
|| location.getBlock().getType() == Material.BREWING_STAND || location.getBlock().getType() == Material.CAULDRON
|
||||||
|
|| location.getBlock().getType() == Material.HOPPER || location.getBlock().getType() == Material.ANVIL
|
||||||
|
|| location.getBlock().getType() == Material.BED_BLOCK || location.getBlock().getType() == Material.SOUL_SAND
|
||||||
|
|| location.getBlock().getType() == Material.STAINED_GLASS_PANE || location.getBlock().getType() == Material.THIN_GLASS
|
||||||
|
|| location.getBlock().getType() == Material.CACTUS || location.getBlock().getType() == Material.DRAGON_EGG
|
||||||
|
|| location.getBlock().getType() == Material.WEB) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static boolean isUnderBlock(Player player) {
|
||||||
|
|
||||||
|
Location location = player.getLocation();
|
||||||
|
location.setY(location.getY() + 2.0);
|
||||||
|
|
||||||
|
if (location.getBlock().getType() != Material.AIR) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static boolean blocksNear(Player player) {
|
||||||
|
return blocksNear(player.getLocation());
|
||||||
|
}
|
||||||
|
|
||||||
|
public static boolean blocksNear(Location location) {
|
||||||
|
|
||||||
|
boolean nearBlocks = false;
|
||||||
|
|
||||||
|
for (Block block : getSurrounding(location.getBlock(), true)) {
|
||||||
|
if (block.getType() != Material.AIR) {
|
||||||
|
nearBlocks = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
for (Block block : getSurrounding(location.getBlock(), false)) {
|
||||||
|
if (block.getType() != Material.AIR) {
|
||||||
|
nearBlocks = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
location.setY(location.getY() - 0.5D);
|
||||||
|
|
||||||
|
if (location.getBlock().getType() != Material.AIR) {
|
||||||
|
nearBlocks = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (isBlock(location.getBlock().getRelative(BlockFace.DOWN), new Material[] { Material.FENCE, Material.FENCE_GATE, Material.COBBLE_WALL, Material.LADDER })) {
|
||||||
|
nearBlocks = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return nearBlocks;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static ArrayList<Block> getSurrounding(Block block, boolean diagonals) {
|
||||||
|
ArrayList<Block> blocks = new ArrayList();
|
||||||
|
if (diagonals) {
|
||||||
|
for (int x = -1; x <= 1; x++) {
|
||||||
|
for (int y = -1; y <= 1; y++) {
|
||||||
|
for (int z = -1; z <= 1; z++) {
|
||||||
|
if ((x != 0) || (y != 0) || (z != 0)) {
|
||||||
|
blocks.add(block.getRelative(x, y, z));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
blocks.add(block.getRelative(BlockFace.UP));
|
||||||
|
blocks.add(block.getRelative(BlockFace.DOWN));
|
||||||
|
blocks.add(block.getRelative(BlockFace.NORTH));
|
||||||
|
blocks.add(block.getRelative(BlockFace.SOUTH));
|
||||||
|
blocks.add(block.getRelative(BlockFace.EAST));
|
||||||
|
blocks.add(block.getRelative(BlockFace.WEST));
|
||||||
|
}
|
||||||
|
return blocks;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static ArrayList<Block> getSurroundingXZ(Block block) {
|
||||||
|
ArrayList<Block> blocks = new ArrayList();
|
||||||
|
blocks.add(block.getRelative(BlockFace.NORTH));
|
||||||
|
blocks.add(block.getRelative(BlockFace.NORTH_EAST));
|
||||||
|
blocks.add(block.getRelative(BlockFace.NORTH_WEST));
|
||||||
|
blocks.add(block.getRelative(BlockFace.SOUTH));
|
||||||
|
blocks.add(block.getRelative(BlockFace.SOUTH_EAST));
|
||||||
|
blocks.add(block.getRelative(BlockFace.SOUTH_WEST));
|
||||||
|
blocks.add(block.getRelative(BlockFace.EAST));
|
||||||
|
blocks.add(block.getRelative(BlockFace.WEST));
|
||||||
|
return blocks;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static boolean isBlock(Block block, Material[] materials) {
|
||||||
|
Material type = block.getType();
|
||||||
|
for (Material m : materials) {
|
||||||
|
if (m == type) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static double getHorizontalDistance(Location to, Location from) {
|
||||||
|
double x = Math.abs(Math.abs(to.getX()) - Math.abs(from.getX()));
|
||||||
|
double z = Math.abs(Math.abs(to.getZ()) - Math.abs(from.getZ()));
|
||||||
|
|
||||||
|
return Math.sqrt(x * x + z * z);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static double getYDifference(Location to, Location from) {
|
||||||
|
return Math.abs(to.getY() - from.getY());
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,10 @@
|
||||||
|
package secondlife.network.paik.utils;
|
||||||
|
|
||||||
|
import org.bukkit.ChatColor;
|
||||||
|
|
||||||
|
public class Color {
|
||||||
|
|
||||||
|
public static String translate(String text) {
|
||||||
|
return ChatColor.translateAlternateColorCodes('&', text);
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,19 @@
|
||||||
|
package secondlife.network.paik.utils;
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
|
|
||||||
|
import secondlife.network.paik.Paik;
|
||||||
|
|
||||||
|
public class DirectoryUtils {
|
||||||
|
|
||||||
|
public static void registerDirectory() {
|
||||||
|
if(!Paik.getInstance().getDataFolder().exists()) {
|
||||||
|
Paik.getInstance().getDataFolder().mkdir();
|
||||||
|
}
|
||||||
|
|
||||||
|
File logs = new File(Paik.getInstance().getDataFolder(), "logs");
|
||||||
|
if(!logs.exists()) {
|
||||||
|
logs.mkdir();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,13 @@
|
||||||
|
package secondlife.network.paik.utils;
|
||||||
|
|
||||||
|
import lombok.Getter;
|
||||||
|
import secondlife.network.paik.Paik;
|
||||||
|
|
||||||
|
public class Handler {
|
||||||
|
|
||||||
|
@Getter private Paik instance;
|
||||||
|
|
||||||
|
public Handler(Paik instance) {
|
||||||
|
this.instance = instance;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,10 @@
|
||||||
|
package secondlife.network.paik.utils;
|
||||||
|
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
|
public class LocationUtils {
|
||||||
|
|
||||||
|
public static String getLocation(Player player) {
|
||||||
|
return player.getWorld().getName() + ", " + player.getLocation().getBlockX() + ", " + player.getLocation().getBlockY() + ", " + player.getLocation().getBlockZ();
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,25 @@
|
||||||
|
package secondlife.network.paik.utils;
|
||||||
|
|
||||||
|
import org.bukkit.Bukkit;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
|
@SuppressWarnings("deprecation")
|
||||||
|
public class Message {
|
||||||
|
|
||||||
|
public static String COMMANDS_FOR_PLAYER_USE_ONLY = Color.translate("&cSorry. For Player use only!");
|
||||||
|
public static String COMMANDS_NO_PERMISSION_MESSAGE = Color.translate("&cNo Permission!");
|
||||||
|
|
||||||
|
public static void sendMessage(String message) {
|
||||||
|
for(Player online : Bukkit.getOnlinePlayers()) {
|
||||||
|
online.sendMessage(message);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void sendMessage(String message, String permission) {
|
||||||
|
for(Player online : Bukkit.getOnlinePlayers()) {
|
||||||
|
if(online.hasPermission(permission)) {
|
||||||
|
online.sendMessage(message);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,582 @@
|
||||||
|
package secondlife.network.paik.utils;
|
||||||
|
|
||||||
|
import java.io.BufferedReader;
|
||||||
|
import java.io.DataOutputStream;
|
||||||
|
import java.io.File;
|
||||||
|
import java.io.FileReader;
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.io.InputStreamReader;
|
||||||
|
import java.net.HttpURLConnection;
|
||||||
|
import java.net.URL;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
public class PasteUtils {
|
||||||
|
|
||||||
|
private final static String POST_URL = "http://pastebin.com/api/api_post.php";
|
||||||
|
private final static String USER_AGENT = "Mozilla/5.0";
|
||||||
|
private static String developer_key = "Set your key there!";
|
||||||
|
|
||||||
|
private String code = "";
|
||||||
|
private String fileName = "";
|
||||||
|
private Expire expire;
|
||||||
|
private Visibility visibility;
|
||||||
|
private Language language;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create new paste
|
||||||
|
*
|
||||||
|
* @param code
|
||||||
|
* Text inside the paste
|
||||||
|
* @param fileName
|
||||||
|
* Paste text
|
||||||
|
* @param visibility
|
||||||
|
* Paste visibility
|
||||||
|
* @param expire
|
||||||
|
* Paste expire time
|
||||||
|
* @param language
|
||||||
|
* Paste language
|
||||||
|
*/
|
||||||
|
public PasteUtils(String code, String fileName, Visibility visibility, Expire expire, Language language) {
|
||||||
|
this.code = code;
|
||||||
|
this.fileName = fileName;
|
||||||
|
this.visibility = visibility;
|
||||||
|
this.expire = expire;
|
||||||
|
this.language = language;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Upload the paste with all info into pastebin.com
|
||||||
|
*
|
||||||
|
* @return {@link PasteResult}
|
||||||
|
* @throws IOException
|
||||||
|
* @see {@link PasteResult}
|
||||||
|
*/
|
||||||
|
public PasteResult upload() throws IOException {
|
||||||
|
String response = "";
|
||||||
|
URL url = new URL(POST_URL);
|
||||||
|
HttpURLConnection conn = (HttpURLConnection) url.openConnection();
|
||||||
|
|
||||||
|
conn.setRequestMethod("POST");
|
||||||
|
conn.setRequestProperty("User-Agent", USER_AGENT);
|
||||||
|
conn.setRequestProperty("Accept-Language", "en-US,en;q=0.5");
|
||||||
|
|
||||||
|
conn.setDoOutput(true);
|
||||||
|
DataOutputStream wr = new DataOutputStream(conn.getOutputStream());
|
||||||
|
wr.writeBytes(getURLParameters());
|
||||||
|
wr.flush();
|
||||||
|
wr.close();
|
||||||
|
|
||||||
|
BufferedReader in = new BufferedReader(new InputStreamReader(conn.getInputStream()));
|
||||||
|
String line;
|
||||||
|
while ((line = in.readLine()) != null) {
|
||||||
|
response += line;
|
||||||
|
}
|
||||||
|
in.close();
|
||||||
|
if (response.contains("pastebin.com")) {
|
||||||
|
return new PasteResult("", response, true);
|
||||||
|
}
|
||||||
|
return new PasteResult(response, "", false);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get final url parameters
|
||||||
|
*
|
||||||
|
* <br>
|
||||||
|
*
|
||||||
|
* POST URL:
|
||||||
|
* http://pastebin.com/api/api_post.php?{@link Paste#getURLParameters()}
|
||||||
|
*
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public String getURLParameters() {
|
||||||
|
String param = "api_option=paste" + "&api_dev_key=" + developer_key + "" + "&api_paste_private=" + visibility.id
|
||||||
|
+ "" + "&api_paste_name=" + fileName + "" + "&api_paste_format=" + language.apiName + ""
|
||||||
|
+ "&api_paste_code=" + code;
|
||||||
|
|
||||||
|
if (expire != Expire.NEVER) {
|
||||||
|
param += "&api_expire_date=" + expire.apiName;
|
||||||
|
}
|
||||||
|
|
||||||
|
return param;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set paste format
|
||||||
|
*
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public Language getLanguage() {
|
||||||
|
return language;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set paste format
|
||||||
|
*
|
||||||
|
* @param language
|
||||||
|
*/
|
||||||
|
public void setLanguage(Language language) {
|
||||||
|
this.language = language;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set visibility
|
||||||
|
*
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public Visibility getVisibility() {
|
||||||
|
return visibility;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set visibility
|
||||||
|
*
|
||||||
|
* @param visibility
|
||||||
|
*/
|
||||||
|
public void setVisibility(Visibility visibility) {
|
||||||
|
this.visibility = visibility;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get expire time
|
||||||
|
*
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public Expire getExpire() {
|
||||||
|
return expire;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set expire time
|
||||||
|
*
|
||||||
|
* @param expire
|
||||||
|
*/
|
||||||
|
public void setExpire(Expire expire) {
|
||||||
|
this.expire = expire;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the paste name
|
||||||
|
*
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public String getFileName() {
|
||||||
|
return fileName;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set the paste name
|
||||||
|
*
|
||||||
|
* @param fileName
|
||||||
|
*/
|
||||||
|
public void setFileName(String fileName) {
|
||||||
|
this.fileName = fileName;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the paste
|
||||||
|
*
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public String getCode() {
|
||||||
|
return code;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set the text in your paste
|
||||||
|
*
|
||||||
|
* <br>
|
||||||
|
*
|
||||||
|
* Use: \n for line break
|
||||||
|
*
|
||||||
|
* @param code
|
||||||
|
*/
|
||||||
|
public void setCode(String code) {
|
||||||
|
this.code = code;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set the text in your paste
|
||||||
|
*
|
||||||
|
* @param code
|
||||||
|
* File to paste
|
||||||
|
* @throws IOException
|
||||||
|
*/
|
||||||
|
public void setCode(File code) throws IOException {
|
||||||
|
BufferedReader reader = new BufferedReader(new FileReader(code));
|
||||||
|
String ln;
|
||||||
|
while ((ln = reader.readLine()) != null) {
|
||||||
|
this.code += ln + "\n";
|
||||||
|
}
|
||||||
|
reader.close();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set your static developer key
|
||||||
|
*
|
||||||
|
* @param developerKey
|
||||||
|
* Developer key generated there: http://pastebin.com/api (You
|
||||||
|
* have to login and then copy the text on "Your Unique Developer
|
||||||
|
* API Key")
|
||||||
|
*/
|
||||||
|
public static void setDeveloperKey(String developerKey) {
|
||||||
|
developer_key = developerKey;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Paste Language
|
||||||
|
*
|
||||||
|
* @author rodel77
|
||||||
|
*/
|
||||||
|
public enum Language {
|
||||||
|
CS("4cs"), ACME("6502acme"), KICKASS("6502kickass"), TASM("6502tasm"), ABAP("abap"), ACTIONSCRIPT(
|
||||||
|
"actionscript"), ACTIONSCRIPT3("actionscript3"), ADA("ada"), AIMMS("aimms"), ALGOL68("algol68"), APACHE(
|
||||||
|
"apache"), APPLESCRIPT("applescript"), APT_SOURCES("apt_sources"), ARM("arm"), ASM("asm"), ASP(
|
||||||
|
"asp"), ASYMPTOTE("asymptote"), AUTOCONF("autoconf"), AUTOHOTKEY("autohotkey"), AUTOIT(
|
||||||
|
"autoit"), AVISYNTH("avisynth"), AWK("awk"), BASCOMAVR("bascomavr"), BASH(
|
||||||
|
"bash"), BASIC4GL("basic4gl"), DOS("dos"), BIBTEX("bibtex"), BLITZBASIC(
|
||||||
|
"blitzbasic"), B3D("b3d"), BMX("bmx"), BNF("bnf"), BOO(
|
||||||
|
"boo"), BF("bf"), C("c"), C_WINAPI("c_winapi"), C_MAC(
|
||||||
|
"c_mac"), CIL("cil"), CSHARP("csharp"), CPP(
|
||||||
|
"cpp"), CPPWINAPI("cpp-winapi"), CPPQT(
|
||||||
|
"cpp-qt"), C_LOADRUNNER(
|
||||||
|
"c_loadrunner"), CADDCL(
|
||||||
|
"caddcl"), CADLISP(
|
||||||
|
"cadlisp"), CEYLON(
|
||||||
|
"ceylon"), CFDG(
|
||||||
|
"cfdg"), CHAISCRIPT(
|
||||||
|
"chaiscript"), CHAPEL(
|
||||||
|
"chapel"), CLOJURE(
|
||||||
|
"clojure"), KLONEC(
|
||||||
|
"klonec"), KLONECPP(
|
||||||
|
"klonecpp"), CMAKE(
|
||||||
|
"cmake"), COBOL(
|
||||||
|
"cobol"), COFFEESCRIPT(
|
||||||
|
"coffeescript"), CFM(
|
||||||
|
"cfm"), CSS(
|
||||||
|
"css"), CUESHEET(
|
||||||
|
"cuesheet"), D(
|
||||||
|
"d"), DART(
|
||||||
|
"dart"), DCL(
|
||||||
|
"dcl"), DCPU16(
|
||||||
|
"dcpu16"), DCS(
|
||||||
|
"dcs"), DELPHI(
|
||||||
|
"delphi"), OXYGENE(
|
||||||
|
"oxygene"), DIFF(
|
||||||
|
"diff"), DIV(
|
||||||
|
"div"), DOT(
|
||||||
|
"dot"), E(
|
||||||
|
"e"), EZT(
|
||||||
|
"ezt"), ECMASCRIPT(
|
||||||
|
"ecmascript"), EIFFEL(
|
||||||
|
"eiffel"), EMAIL(
|
||||||
|
"email"), EPC(
|
||||||
|
"epc"), ERLANG(
|
||||||
|
"erlang"), EUPHORIA(
|
||||||
|
"euphoria"), FSHARP(
|
||||||
|
"fsharp"), FALCON(
|
||||||
|
"falcon"), FILEMAKER(
|
||||||
|
"filemaker"), FO(
|
||||||
|
"fo"), F1(
|
||||||
|
"f1"), FORTRAN(
|
||||||
|
"fortran"), FREEBASIC(
|
||||||
|
"freebasic"), FREESWITCH(
|
||||||
|
"freeswitch"), GAMBAS(
|
||||||
|
"gambas"), GML(
|
||||||
|
"gml"), GDB(
|
||||||
|
"gdb"), GENERO(
|
||||||
|
"genero"), GENIE(
|
||||||
|
"genie"), GETTEXT(
|
||||||
|
"gettext"), GO(
|
||||||
|
"go"), GROOVY(
|
||||||
|
"groovy"), GWBASIC(
|
||||||
|
"gwbasic"), HASKELL(
|
||||||
|
"haskell"), HAXE(
|
||||||
|
"haxe"), HICEST(
|
||||||
|
"hicest"), HQ9PLUS(
|
||||||
|
"hq9plus"), HTML4STRICT(
|
||||||
|
"html4strict"), HTML5(
|
||||||
|
"html5"), ICON(
|
||||||
|
"icon"), IDL(
|
||||||
|
"idl"), INI(
|
||||||
|
"ini"), INNO(
|
||||||
|
"inno"), INTERCAL(
|
||||||
|
"intercal"), IO(
|
||||||
|
"io"), ISPFPANEL(
|
||||||
|
"ispfpanel"), J(
|
||||||
|
"j"), JAVA(
|
||||||
|
"java"), JAVA5(
|
||||||
|
"java5"), JAVASCRIPT(
|
||||||
|
"javascript"), JCL(
|
||||||
|
"jcl"), JQUERY(
|
||||||
|
"jquery"), JSON(
|
||||||
|
"json"), JULIA(
|
||||||
|
"julia"), KIXTART(
|
||||||
|
"kixtart"), KOTLIN(
|
||||||
|
"kotlin"), LATEX(
|
||||||
|
"latex"), LDIF(
|
||||||
|
"ldif"), LB(
|
||||||
|
"lb"), LSL2(
|
||||||
|
"lsl2"), LISP(
|
||||||
|
"lisp"), LLVM(
|
||||||
|
"llvm"), LOCOBASIC(
|
||||||
|
"locobasic"), LOGTALK(
|
||||||
|
"logtalk"), LOLCODE(
|
||||||
|
"lolcode"), LOTUSFORMULAS(
|
||||||
|
"lotusformulas"), LOTUSSCRIPT(
|
||||||
|
"lotusscript"), LSCRIPT(
|
||||||
|
"lscript"), LUA(
|
||||||
|
"lua"), M68K(
|
||||||
|
"m68k"), MAGIKSF(
|
||||||
|
"magiksf"), MAKE(
|
||||||
|
"make"), MAPBASIC(
|
||||||
|
"mapbasic"), MARKDOWN(
|
||||||
|
"markdown"), MATLAB(
|
||||||
|
"matlab"), MIRC(
|
||||||
|
"mirc"), MMIX(
|
||||||
|
"mmix"), MODULA2(
|
||||||
|
"modula2"), MODULA3(
|
||||||
|
"modula3"), EVPAC(
|
||||||
|
"68000devpac"), MPASM(
|
||||||
|
"mpasm"), MXML(
|
||||||
|
"mxml"), MYSQL(
|
||||||
|
"mysql"), NAGIOS(
|
||||||
|
"nagios"), NETREXX(
|
||||||
|
"netrexx"), NEWLISP(
|
||||||
|
"newlisp"), NGINX(
|
||||||
|
"nginx"), NIMROD(
|
||||||
|
"nimrod"), TEXT(
|
||||||
|
"text"), NSIS(
|
||||||
|
"nsis"), OBERON2(
|
||||||
|
"oberon2"), OBJECK(
|
||||||
|
"objeck"), OBJC(
|
||||||
|
"objc"), OCAMLBRIEF(
|
||||||
|
"ocaml-brief"), OCAML(
|
||||||
|
"ocaml"), OCTAVE(
|
||||||
|
"octave"), OOREXX(
|
||||||
|
"oorexx"), PF(
|
||||||
|
"pf"), GLSL(
|
||||||
|
"glsl"), OOBAS(
|
||||||
|
"oobas"), ORACLE11(
|
||||||
|
"oracle11"), ORACLE8(
|
||||||
|
"oracle8"), OZ(
|
||||||
|
"oz"), PARASAIL(
|
||||||
|
"parasail"), PARIGP(
|
||||||
|
"parigp"), PASCAL(
|
||||||
|
"pascal"), PAWN(
|
||||||
|
"pawn"), PCRE(
|
||||||
|
"pcre"), PER(
|
||||||
|
"per"), PERL(
|
||||||
|
"perl"), PERL6(
|
||||||
|
"perl6"), PHP(
|
||||||
|
"php"), PHPBRIEF(
|
||||||
|
"php-brief"), PIC16(
|
||||||
|
"pic16"), PIKE(
|
||||||
|
"pike"), PIXELBENDER(
|
||||||
|
"pixelbender"), PLI(
|
||||||
|
"pli"), PLSQL(
|
||||||
|
"plsql"), POSTGRESQL(
|
||||||
|
"postgresql"), POSTSCRIPT(
|
||||||
|
"postscript"), POVRAY(
|
||||||
|
"povray"), POWERSHELL(
|
||||||
|
"powershell"), POWERBUILDER(
|
||||||
|
"powerbuilder"), PROFTPD(
|
||||||
|
"proftpd"), PROGRESS(
|
||||||
|
"progress"), PROLOG(
|
||||||
|
"prolog"), PROPERTIES(
|
||||||
|
"properties"), PROVIDEX(
|
||||||
|
"providex"), PUPPET(
|
||||||
|
"puppet"), PUREBASIC(
|
||||||
|
"purebasic"), PYCON(
|
||||||
|
"pycon"), PYTHON(
|
||||||
|
"python"), PYS60(
|
||||||
|
"pys60"), Q(
|
||||||
|
"q"), QBASIC(
|
||||||
|
"qbasic"), QML(
|
||||||
|
"qml"), RSPLUS(
|
||||||
|
"rsplus"), RACKET(
|
||||||
|
"racket"), RAILS(
|
||||||
|
"rails"), RBS(
|
||||||
|
"rbs"), REBOL(
|
||||||
|
"rebol"), REG(
|
||||||
|
"reg"), REXX(
|
||||||
|
"rexx"), ROBOTS(
|
||||||
|
"robots"), RPMSPEC(
|
||||||
|
"rpmspec"), RUBY(
|
||||||
|
"ruby"), GNUPLOT(
|
||||||
|
"gnuplot"), RUST(
|
||||||
|
"rust"), SAS(
|
||||||
|
"sas"), SCALA(
|
||||||
|
"scala"), SCHEME(
|
||||||
|
"scheme"), SCILAB(
|
||||||
|
"scilab"), SCL(
|
||||||
|
"scl"), SDLBASIC(
|
||||||
|
"sdlbasic"), SMALLTALK(
|
||||||
|
"smalltalk"), SMARTY(
|
||||||
|
"smarty"), SPARK(
|
||||||
|
"spark"), SPARQL(
|
||||||
|
"sparql"), SQF(
|
||||||
|
"sqf"), SQL(
|
||||||
|
"sql"), STANDARDML(
|
||||||
|
"standardml"), STONESCRIPT(
|
||||||
|
"stonescript"), SCLANG(
|
||||||
|
"sclang"), SWIFT(
|
||||||
|
"swift"), SYSTEMVERILOG(
|
||||||
|
"systemverilog"), TSQL(
|
||||||
|
"tsql"), TCL(
|
||||||
|
"tcl"), TERATERM(
|
||||||
|
"teraterm"), THINBASIC(
|
||||||
|
"thinbasic"), TYPOSCRIPT(
|
||||||
|
"typoscript"), UNICON(
|
||||||
|
"unicon"), USCRIPT(
|
||||||
|
"uscript"), UPC(
|
||||||
|
"upc"), URBI(
|
||||||
|
"urbi"), VALA(
|
||||||
|
"vala"), VBNET(
|
||||||
|
"vbnet"), VBSCRIPT(
|
||||||
|
"vbscript"), VEDIT(
|
||||||
|
"vedit"), VERILOG(
|
||||||
|
"verilog"), VHDL(
|
||||||
|
"vhdl"), VIM(
|
||||||
|
"vim"), VISUALPROLOG(
|
||||||
|
"visualprolog"), VB(
|
||||||
|
"vb"), VISUALFOXPRO(
|
||||||
|
"visualfoxpro"), WHITESPACE(
|
||||||
|
"whitespace"), WHOIS(
|
||||||
|
"whois"), WINBATCH(
|
||||||
|
"winbatch"), XBASIC(
|
||||||
|
"xbasic"), XML(
|
||||||
|
"xml"), XORG_CONF(
|
||||||
|
"xorg_conf"), XPP(
|
||||||
|
"xpp"), YAML(
|
||||||
|
"yaml"), Z80(
|
||||||
|
"z80"), ZXBASIC(
|
||||||
|
"zxbasic");
|
||||||
|
|
||||||
|
private String apiName;
|
||||||
|
|
||||||
|
private Language(String apiName) {
|
||||||
|
this.apiName = apiName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getAPIName() {
|
||||||
|
return apiName;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Paste Visibility
|
||||||
|
*
|
||||||
|
* @author rodel77
|
||||||
|
*/
|
||||||
|
public enum Visibility {
|
||||||
|
PUBLIC(0), UNLISTED(1), PRIVATE(2);
|
||||||
|
|
||||||
|
private int id;
|
||||||
|
|
||||||
|
private Visibility(int id) {
|
||||||
|
this.id = id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getID() {
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Paste expire
|
||||||
|
*
|
||||||
|
* @author rodel77
|
||||||
|
*/
|
||||||
|
public enum Expire {
|
||||||
|
NEVER("N"), TEN_MINUTES("10M"), ONE_HOUR("1H"), ONE_DAY("1D"), ONE_WEEK("1W"), TWO_WEEKS("2W"), ONE_MONTH("1M");
|
||||||
|
|
||||||
|
private String apiName;
|
||||||
|
|
||||||
|
private Expire(String apiName) {
|
||||||
|
this.apiName = apiName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getAPIName() {
|
||||||
|
return apiName;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Paste Result
|
||||||
|
*
|
||||||
|
* @author rodel77
|
||||||
|
*/
|
||||||
|
public class PasteResult {
|
||||||
|
private String errorMessage = "";
|
||||||
|
private String pasteURL = "";
|
||||||
|
private boolean valid = false;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create PasteResult (Only for internal API)
|
||||||
|
*
|
||||||
|
* @param errorMessage
|
||||||
|
* @param pasteURL
|
||||||
|
* @param valid
|
||||||
|
*/
|
||||||
|
public PasteResult(String errorMessage, String pasteURL, boolean valid) {
|
||||||
|
this.errorMessage = errorMessage;
|
||||||
|
this.pasteURL = pasteURL;
|
||||||
|
this.valid = valid;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get error message <br>
|
||||||
|
* <b>Note: First check {@link PasteResult#isValid()}</b>
|
||||||
|
*
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public String getErrorMessage() {
|
||||||
|
return errorMessage;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get paste URL <br>
|
||||||
|
* <b>Note: First check {@link PasteResult#isValid()}</b>
|
||||||
|
*
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public String getPasteURL() {
|
||||||
|
return pasteURL;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Check if valid
|
||||||
|
*
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public boolean isValid() {
|
||||||
|
return valid;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* If valid return paste url otherwise error message
|
||||||
|
*
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
if (valid) {
|
||||||
|
return pasteURL;
|
||||||
|
} else {
|
||||||
|
return errorMessage;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
Map<String, String> vals = new HashMap<>();
|
||||||
|
vals.put("code", code);
|
||||||
|
vals.put("name", fileName);
|
||||||
|
vals.put("expire", expire.name());
|
||||||
|
vals.put("visibility", visibility.name());
|
||||||
|
vals.put("language", language.name());
|
||||||
|
return "Pastebin" + vals.toString();
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,13 @@
|
||||||
|
package secondlife.network.paik.utils;
|
||||||
|
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
|
public class PlayerUtils {
|
||||||
|
|
||||||
|
public static boolean isPlayerBypassing(Player player) {
|
||||||
|
if(player.hasPermission("secondlife.staff")) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,10 @@
|
||||||
|
package secondlife.network.paik.utils;
|
||||||
|
|
||||||
|
import org.bukkit.Bukkit;
|
||||||
|
|
||||||
|
public class ServerUtils {
|
||||||
|
|
||||||
|
public static boolean isServerLagging() {
|
||||||
|
return Bukkit.spigot().getTPS()[0] < 18.5;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,92 @@
|
||||||
|
package secondlife.network.paik.utils.file;
|
||||||
|
|
||||||
|
import lombok.Getter;
|
||||||
|
import secondlife.network.paik.Paik;
|
||||||
|
import org.bukkit.ChatColor;
|
||||||
|
import org.bukkit.configuration.file.YamlConfiguration;
|
||||||
|
import secondlife.network.paik.utils.Handler;
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@Getter
|
||||||
|
public class ConfigFile extends Handler {
|
||||||
|
|
||||||
|
public static File file;
|
||||||
|
public static YamlConfiguration configuration;
|
||||||
|
|
||||||
|
public ConfigFile(Paik plugin) {
|
||||||
|
super(plugin);
|
||||||
|
|
||||||
|
file = new File(plugin.getDataFolder(), "config.yml");
|
||||||
|
|
||||||
|
if(!file.exists()) {
|
||||||
|
plugin.saveResource("config.yml", false);
|
||||||
|
}
|
||||||
|
|
||||||
|
configuration = YamlConfiguration.loadConfiguration(file);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void load() {
|
||||||
|
file = new File(Paik.getInstance().getDataFolder(), "config.yml");
|
||||||
|
|
||||||
|
if(!file.exists()) {
|
||||||
|
Paik.getInstance().saveResource("config.yml", false);
|
||||||
|
}
|
||||||
|
|
||||||
|
configuration = YamlConfiguration.loadConfiguration(file);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void save() {
|
||||||
|
try {
|
||||||
|
configuration.save(file);
|
||||||
|
} catch(IOException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public static double getDouble(String path) {
|
||||||
|
if(configuration.contains(path)) {
|
||||||
|
return configuration.getDouble(path);
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0.0;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static int getInt(String path) {
|
||||||
|
if (configuration.contains(path)) {
|
||||||
|
return configuration.getInt(path);
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static boolean getBoolean(String path) {
|
||||||
|
return configuration.contains(path) && configuration.getBoolean(path);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static String getString(String path) {
|
||||||
|
if(configuration.contains(path)) {
|
||||||
|
return ChatColor.translateAlternateColorCodes('&', configuration.getString(path));
|
||||||
|
}
|
||||||
|
|
||||||
|
return "String at path: " + path + " not found!";
|
||||||
|
}
|
||||||
|
|
||||||
|
public static List<String> getStringList(String path) {
|
||||||
|
if(configuration.contains(path)) {
|
||||||
|
ArrayList<String> strings = new ArrayList<String>();
|
||||||
|
|
||||||
|
for(String string : configuration.getStringList(path)) {
|
||||||
|
strings.add(ChatColor.translateAlternateColorCodes('&', string));
|
||||||
|
}
|
||||||
|
|
||||||
|
return strings;
|
||||||
|
}
|
||||||
|
|
||||||
|
return Arrays.asList("String List at path: " + path + " not found!");
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,89 @@
|
||||||
|
package secondlife.network.paik.utils.file;
|
||||||
|
|
||||||
|
import java.io.BufferedReader;
|
||||||
|
import java.io.BufferedWriter;
|
||||||
|
import java.io.File;
|
||||||
|
import java.io.FileReader;
|
||||||
|
import java.io.FileWriter;
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import org.bukkit.plugin.java.JavaPlugin;
|
||||||
|
|
||||||
|
import secondlife.network.paik.Paik;
|
||||||
|
|
||||||
|
public class LogFile {
|
||||||
|
|
||||||
|
private File file;
|
||||||
|
private String name;
|
||||||
|
private List<String> lines = new ArrayList<String>();
|
||||||
|
|
||||||
|
public LogFile(JavaPlugin plugin, String path, String name) {
|
||||||
|
this.file = new File(Paik.getInstance().getDataFolder() + path, name + ".txt");
|
||||||
|
try {
|
||||||
|
this.file.createNewFile();
|
||||||
|
} catch (IOException e) {
|
||||||
|
}
|
||||||
|
this.name = name;
|
||||||
|
|
||||||
|
readTxtFile();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void clear() {
|
||||||
|
this.lines.clear();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void addLine(String line) {
|
||||||
|
this.lines.add(line);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void write() {
|
||||||
|
try {
|
||||||
|
FileWriter fw = new FileWriter(this.file, false);
|
||||||
|
BufferedWriter bw = new BufferedWriter(fw);
|
||||||
|
for (String line : this.lines) {
|
||||||
|
bw.write(line);
|
||||||
|
bw.newLine();
|
||||||
|
}
|
||||||
|
bw.close();
|
||||||
|
fw.close();
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void readTxtFile() {
|
||||||
|
this.lines.clear();
|
||||||
|
try {
|
||||||
|
FileReader fr = new FileReader(this.file);
|
||||||
|
BufferedReader br = new BufferedReader(fr);
|
||||||
|
String line;
|
||||||
|
while ((line = br.readLine()) != null) {
|
||||||
|
this.lines.add(line);
|
||||||
|
}
|
||||||
|
br.close();
|
||||||
|
fr.close();
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getName() {
|
||||||
|
return this.name;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getText() {
|
||||||
|
String text = "";
|
||||||
|
for (int i = 0; i < this.lines.size(); i++) {
|
||||||
|
String line = (String) this.lines.get(i);
|
||||||
|
|
||||||
|
text = text + line + (this.lines.size() - 1 == i ? "" : "\n");
|
||||||
|
}
|
||||||
|
return text;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<String> getLines() {
|
||||||
|
return this.lines;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,9 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<classpath>
|
||||||
|
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8"/>
|
||||||
|
<classpathentry kind="src" path="src"/>
|
||||||
|
<classpathentry kind="lib" path="C:/Users/Matej/Desktop/All/Coding/SL - Workspace/PowerfulPerms.jar"/>
|
||||||
|
<classpathentry kind="lib" path="C:/Users/Matej/Desktop/All/Coding/Git/HexaCord-SecondLife/bootstrap/target/BungeeCord.jar"/>
|
||||||
|
<classpathentry kind="lib" path="C:/Users/Matej/Desktop/All/Coding/SL - Workspace/lombok.jar"/>
|
||||||
|
<classpathentry kind="output" path="bin"/>
|
||||||
|
</classpath>
|
|
@ -0,0 +1,17 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<projectDescription>
|
||||||
|
<name>SL - Bungee</name>
|
||||||
|
<comment></comment>
|
||||||
|
<projects>
|
||||||
|
</projects>
|
||||||
|
<buildSpec>
|
||||||
|
<buildCommand>
|
||||||
|
<name>org.eclipse.jdt.core.javabuilder</name>
|
||||||
|
<arguments>
|
||||||
|
</arguments>
|
||||||
|
</buildCommand>
|
||||||
|
</buildSpec>
|
||||||
|
<natures>
|
||||||
|
<nature>org.eclipse.jdt.core.javanature</nature>
|
||||||
|
</natures>
|
||||||
|
</projectDescription>
|
|
@ -0,0 +1,11 @@
|
||||||
|
eclipse.preferences.version=1
|
||||||
|
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
|
||||||
|
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
|
||||||
|
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
|
||||||
|
org.eclipse.jdt.core.compiler.compliance=1.8
|
||||||
|
org.eclipse.jdt.core.compiler.debug.lineNumber=generate
|
||||||
|
org.eclipse.jdt.core.compiler.debug.localVariable=generate
|
||||||
|
org.eclipse.jdt.core.compiler.debug.sourceFile=generate
|
||||||
|
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
|
||||||
|
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
|
||||||
|
org.eclipse.jdt.core.compiler.source=1.8
|
|
@ -0,0 +1,3 @@
|
||||||
|
Manifest-Version: 1.0
|
||||||
|
Main-Class: Bungee
|
||||||
|
|
|
@ -0,0 +1,13 @@
|
||||||
|
whitelisted: false
|
||||||
|
|
||||||
|
server_motd: "&5&lSecondLife Network"
|
||||||
|
|
||||||
|
auto_message:
|
||||||
|
active_messages:
|
||||||
|
- msg1
|
||||||
|
- msg2
|
||||||
|
messages:
|
||||||
|
msg1:
|
||||||
|
message: "If you find a hacker kill him idiot!"
|
||||||
|
msg2:
|
||||||
|
message: "If you are staff kill your self because this is bullshit server!"
|
|
@ -0,0 +1,4 @@
|
||||||
|
name: Bungee
|
||||||
|
version: 1.0
|
||||||
|
author: SecondLife Development Team
|
||||||
|
main: secondlife.network.bungee.Bungee
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue