mirror of
https://github.com/darksaid98/AntiCheatReloaded.git
synced 2026-12-02 14:38:45 +00:00
Run through new formatter.
This commit is contained in:
1 parent
b48e97a799
commit
170f4dd946
34 files changed
+5636
-7150
No files matched your search
@@ -2,136 +2,131 @@ package net.h31ix.anticheat.util;
|
||||
|
||||
import org.bukkit.Material;
|
||||
|
||||
public enum BlockHardness
|
||||
{
|
||||
STONE(Material.STONE, 1.50D),
|
||||
GRASS(Material.GRASS, 0.60D),
|
||||
DIRT(Material.DIRT, 0.50D),
|
||||
COBBLESTONE(Material.COBBLESTONE, 2.00D),
|
||||
WOOD(Material.WOOD, 2.00D),
|
||||
SAPLING(Material.SAPLING, 0.00D),
|
||||
WATER(Material.WATER, 100.00D),
|
||||
STATIONARY_WATER(Material.STATIONARY_WATER, 100.00D),
|
||||
LAVA(Material.LAVA, 0.00D),
|
||||
STATIONARY_LAVA(Material.STATIONARY_LAVA, 100.00D),
|
||||
SAND(Material.SAND, 0.50D),
|
||||
GRAVEL(Material.GRAVEL, 0.60D),
|
||||
GOLD_ORE(Material.GOLD_ORE, 3.00D),
|
||||
IRON_ORE(Material.IRON_ORE, 3.00D),
|
||||
COAL_ORE(Material.COAL_ORE, 3.00D),
|
||||
LOG(Material.LOG, 2.00D),
|
||||
LEAVES(Material.LEAVES, 0.20D),
|
||||
SPONGE(Material.SPONGE, 0.60D),
|
||||
GLASS(Material.GLASS, 0.30D),
|
||||
LAPIS_ORE(Material.LAPIS_ORE, 3.00D),
|
||||
LAPIS_BLOCK(Material.LAPIS_BLOCK, 3.00D),
|
||||
DISPENSER(Material.DISPENSER, 3.50D),
|
||||
SANDSTONE(Material.SANDSTONE, 0.80D),
|
||||
NOTE_BLOCK(Material.NOTE_BLOCK, 0.80D),
|
||||
BED(Material.BED, 0.20D),
|
||||
DETECTOR_RAIL(Material.DETECTOR_RAIL, 0.70D),
|
||||
WEB(Material.WEB, 4.00D),
|
||||
LONG_GRASS(Material.LONG_GRASS, 0.00D),
|
||||
DEAD_BUSH(Material.DEAD_BUSH, 0.00D),
|
||||
WOOL(Material.WOOL, 0.80D),
|
||||
YELLOW_FLOWER(Material.YELLOW_FLOWER, 0.00D),
|
||||
RED_ROSE(Material.RED_ROSE, 0.00D),
|
||||
BROWN_MUSHROOM(Material.BROWN_MUSHROOM, 0.00D),
|
||||
RED_MUSHROOM(Material.RED_MUSHROOM, 0.00D),
|
||||
GOLD_BLOCK(Material.GOLD_BLOCK, 3.00D),
|
||||
IRON_BLOCK(Material.IRON_BLOCK, 5.00D),
|
||||
DOUBLE_STEP(Material.DOUBLE_STEP, 2.00D),
|
||||
STEP(Material.STEP, 2.00D),
|
||||
BRICK(Material.BRICK, 2.00D),
|
||||
TNT(Material.TNT, 0.00D),
|
||||
BOOKSHELF(Material.BOOKSHELF, 1.50D),
|
||||
MOSSY_COBBLESTONE(Material.MOSSY_COBBLESTONE, 2.00D),
|
||||
OBSIDIAN(Material.OBSIDIAN, 50.00D),
|
||||
TORCH(Material.TORCH, 0.00D),
|
||||
FIRE(Material.FIRE, 0.00D),
|
||||
MOB_SPAWNER(Material.MOB_SPAWNER, 5.00D),
|
||||
CHEST(Material.CHEST, 2.50D),
|
||||
REDSTONE_WIRE(Material.REDSTONE_WIRE, 0.00D),
|
||||
DIAMOND_ORE(Material.DIAMOND_ORE, 3.00D),
|
||||
DIAMOND_BLOCK(Material.DIAMOND_BLOCK, 5.00D),
|
||||
WORKBENCH(Material.WORKBENCH, 2.50D),
|
||||
SOIL(Material.SOIL, 0.60D),
|
||||
FURNACE(Material.FURNACE, 3.50D),
|
||||
BURNING_FURNACE(Material.BURNING_FURNACE, 3.50D),
|
||||
WOODEN_DOOR(Material.WOODEN_DOOR, 3.00D),
|
||||
LADDER(Material.LADDER, 0.40D),
|
||||
RAILS(Material.RAILS, 0.70D),
|
||||
LEVER(Material.LEVER, 0.50D),
|
||||
STONE_PLATE(Material.STONE_PLATE, 0.50D),
|
||||
IRON_DOOR_BLOCK(Material.IRON_DOOR_BLOCK, 5.00D),
|
||||
WOOD_PLATE(Material.WOOD_PLATE, 0.50D),
|
||||
REDSTONE_ORE(Material.REDSTONE_ORE, 3.00D),
|
||||
GLOWING_REDSTONE_ORE(Material.GLOWING_REDSTONE_ORE, 3.00D),
|
||||
REDSTONE_TORCH_OFF(Material.REDSTONE_TORCH_OFF, 0.00D),
|
||||
REDSTONE_TORCH_ON(Material.REDSTONE_TORCH_ON, 0.00D),
|
||||
STONE_BUTTON(Material.STONE_BUTTON, 0.50D),
|
||||
SNOW(Material.SNOW, 0.10D),
|
||||
ICE(Material.ICE, 0.50D),
|
||||
SNOW_BLOCK(Material.SNOW_BLOCK, 0.20D),
|
||||
CACTUS(Material.CACTUS, 0.40D),
|
||||
CLAY(Material.CLAY, 0.60D),
|
||||
SUGAR_CANE_BLOCK(Material.SUGAR_CANE_BLOCK, 0.00D),
|
||||
JUKEBOX(Material.JUKEBOX, 2.00D),
|
||||
FENCE(Material.FENCE, 2.00D),
|
||||
NETHERRACK(Material.NETHERRACK, 0.40D),
|
||||
SOUL_SAND(Material.SOUL_SAND, 0.50D),
|
||||
GLOWSTONE(Material.GLOWSTONE, 0.30D),
|
||||
PORTAL(Material.PORTAL, -1.00D),
|
||||
CAKE_BLOCK(Material.CAKE_BLOCK, 0.50D),
|
||||
LOCKED_CHEST(Material.LOCKED_CHEST, 0.00D),
|
||||
TRAP_DOOR(Material.TRAP_DOOR, 3.00D),
|
||||
MONSTER_EGGS(Material.MONSTER_EGGS, 0.750D),
|
||||
SMOOTH_BRICK(Material.SMOOTH_BRICK, 1.50D),
|
||||
IRON_FENCE(Material.IRON_FENCE, 5.00D),
|
||||
THIN_GLASS(Material.THIN_GLASS, 0.30D),
|
||||
PUMPKIN_STEM(Material.PUMPKIN_STEM, 0.00D),
|
||||
MELON_STEM(Material.MELON_STEM, 0.00D),
|
||||
VINE(Material.VINE, 0.20D),
|
||||
FENCE_GATE(Material.FENCE_GATE, 2.00D),
|
||||
MYCEL(Material.MYCEL, 0.60D),
|
||||
WATER_LILY(Material.WATER_LILY, 0.00D),
|
||||
NETHER_BRICK(Material.NETHER_BRICK, 2.00D),
|
||||
NETHER_FENCE(Material.NETHER_FENCE, 2.00D),
|
||||
ENCHANTMENT_TABLE(Material.ENCHANTMENT_TABLE, 5.00D),
|
||||
BREWING_STAND(Material.BREWING_STAND, 0.50D),
|
||||
CAULDRON(Material.CAULDRON, 2.00D),
|
||||
ENDER_PORTAL(Material.ENDER_PORTAL, -1.00D),
|
||||
ENDER_PORTAL_FRAME(Material.ENDER_PORTAL_FRAME, -1.00D),
|
||||
DRAGON_EGG(Material.DRAGON_EGG, 3.00D),
|
||||
REDSTONE_LAMP_OFF(Material.REDSTONE_LAMP_OFF, 0.30D),
|
||||
REDSTONE_LAMP_ON(Material.REDSTONE_LAMP_ON, 0.30D),
|
||||
WOOD_DOUBLE_STEP(Material.WOOD_DOUBLE_STEP, 2.00D),
|
||||
WOOD_STEP(Material.WOOD_STEP, 2.00D),
|
||||
COCOA(Material.COCOA, 0.20D),
|
||||
EMERALD_ORE(Material.EMERALD_ORE, 3.00D),
|
||||
ENDER_CHEST(Material.ENDER_CHEST, 22.50D),
|
||||
EMERALD_BLOCK(Material.EMERALD_BLOCK, 5.00D),
|
||||
FLOWER_POT(Material.FLOWER_POT, 0.00D),
|
||||
WOOD_BUTTON(Material.WOOD_BUTTON, 0.50D),
|
||||
ANVIL(Material.ANVIL, 5.00D);
|
||||
|
||||
Material mat;
|
||||
double hardness;
|
||||
|
||||
BlockHardness(Material m, double hard)
|
||||
{
|
||||
mat = m;
|
||||
hardness = hard;
|
||||
}
|
||||
|
||||
public static double getBlockHardness(Material m)
|
||||
{
|
||||
for (BlockHardness e : BlockHardness.values())
|
||||
{
|
||||
if (e.mat.equals(m))
|
||||
return e.hardness;
|
||||
}
|
||||
|
||||
return 1.0D;
|
||||
}
|
||||
public enum BlockHardness {
|
||||
STONE(Material.STONE, 1.50D),
|
||||
GRASS(Material.GRASS, 0.60D),
|
||||
DIRT(Material.DIRT, 0.50D),
|
||||
COBBLESTONE(Material.COBBLESTONE, 2.00D),
|
||||
WOOD(Material.WOOD, 2.00D),
|
||||
SAPLING(Material.SAPLING, 0.00D),
|
||||
WATER(Material.WATER, 100.00D),
|
||||
STATIONARY_WATER(Material.STATIONARY_WATER, 100.00D),
|
||||
LAVA(Material.LAVA, 0.00D),
|
||||
STATIONARY_LAVA(Material.STATIONARY_LAVA, 100.00D),
|
||||
SAND(Material.SAND, 0.50D),
|
||||
GRAVEL(Material.GRAVEL, 0.60D),
|
||||
GOLD_ORE(Material.GOLD_ORE, 3.00D),
|
||||
IRON_ORE(Material.IRON_ORE, 3.00D),
|
||||
COAL_ORE(Material.COAL_ORE, 3.00D),
|
||||
LOG(Material.LOG, 2.00D),
|
||||
LEAVES(Material.LEAVES, 0.20D),
|
||||
SPONGE(Material.SPONGE, 0.60D),
|
||||
GLASS(Material.GLASS, 0.30D),
|
||||
LAPIS_ORE(Material.LAPIS_ORE, 3.00D),
|
||||
LAPIS_BLOCK(Material.LAPIS_BLOCK, 3.00D),
|
||||
DISPENSER(Material.DISPENSER, 3.50D),
|
||||
SANDSTONE(Material.SANDSTONE, 0.80D),
|
||||
NOTE_BLOCK(Material.NOTE_BLOCK, 0.80D),
|
||||
BED(Material.BED, 0.20D),
|
||||
DETECTOR_RAIL(Material.DETECTOR_RAIL, 0.70D),
|
||||
WEB(Material.WEB, 4.00D),
|
||||
LONG_GRASS(Material.LONG_GRASS, 0.00D),
|
||||
DEAD_BUSH(Material.DEAD_BUSH, 0.00D),
|
||||
WOOL(Material.WOOL, 0.80D),
|
||||
YELLOW_FLOWER(Material.YELLOW_FLOWER, 0.00D),
|
||||
RED_ROSE(Material.RED_ROSE, 0.00D),
|
||||
BROWN_MUSHROOM(Material.BROWN_MUSHROOM, 0.00D),
|
||||
RED_MUSHROOM(Material.RED_MUSHROOM, 0.00D),
|
||||
GOLD_BLOCK(Material.GOLD_BLOCK, 3.00D),
|
||||
IRON_BLOCK(Material.IRON_BLOCK, 5.00D),
|
||||
DOUBLE_STEP(Material.DOUBLE_STEP, 2.00D),
|
||||
STEP(Material.STEP, 2.00D),
|
||||
BRICK(Material.BRICK, 2.00D),
|
||||
TNT(Material.TNT, 0.00D),
|
||||
BOOKSHELF(Material.BOOKSHELF, 1.50D),
|
||||
MOSSY_COBBLESTONE(Material.MOSSY_COBBLESTONE, 2.00D),
|
||||
OBSIDIAN(Material.OBSIDIAN, 50.00D),
|
||||
TORCH(Material.TORCH, 0.00D),
|
||||
FIRE(Material.FIRE, 0.00D),
|
||||
MOB_SPAWNER(Material.MOB_SPAWNER, 5.00D),
|
||||
CHEST(Material.CHEST, 2.50D),
|
||||
REDSTONE_WIRE(Material.REDSTONE_WIRE, 0.00D),
|
||||
DIAMOND_ORE(Material.DIAMOND_ORE, 3.00D),
|
||||
DIAMOND_BLOCK(Material.DIAMOND_BLOCK, 5.00D),
|
||||
WORKBENCH(Material.WORKBENCH, 2.50D),
|
||||
SOIL(Material.SOIL, 0.60D),
|
||||
FURNACE(Material.FURNACE, 3.50D),
|
||||
BURNING_FURNACE(Material.BURNING_FURNACE, 3.50D),
|
||||
WOODEN_DOOR(Material.WOODEN_DOOR, 3.00D),
|
||||
LADDER(Material.LADDER, 0.40D),
|
||||
RAILS(Material.RAILS, 0.70D),
|
||||
LEVER(Material.LEVER, 0.50D),
|
||||
STONE_PLATE(Material.STONE_PLATE, 0.50D),
|
||||
IRON_DOOR_BLOCK(Material.IRON_DOOR_BLOCK, 5.00D),
|
||||
WOOD_PLATE(Material.WOOD_PLATE, 0.50D),
|
||||
REDSTONE_ORE(Material.REDSTONE_ORE, 3.00D),
|
||||
GLOWING_REDSTONE_ORE(Material.GLOWING_REDSTONE_ORE, 3.00D),
|
||||
REDSTONE_TORCH_OFF(Material.REDSTONE_TORCH_OFF, 0.00D),
|
||||
REDSTONE_TORCH_ON(Material.REDSTONE_TORCH_ON, 0.00D),
|
||||
STONE_BUTTON(Material.STONE_BUTTON, 0.50D),
|
||||
SNOW(Material.SNOW, 0.10D),
|
||||
ICE(Material.ICE, 0.50D),
|
||||
SNOW_BLOCK(Material.SNOW_BLOCK, 0.20D),
|
||||
CACTUS(Material.CACTUS, 0.40D),
|
||||
CLAY(Material.CLAY, 0.60D),
|
||||
SUGAR_CANE_BLOCK(Material.SUGAR_CANE_BLOCK, 0.00D),
|
||||
JUKEBOX(Material.JUKEBOX, 2.00D),
|
||||
FENCE(Material.FENCE, 2.00D),
|
||||
NETHERRACK(Material.NETHERRACK, 0.40D),
|
||||
SOUL_SAND(Material.SOUL_SAND, 0.50D),
|
||||
GLOWSTONE(Material.GLOWSTONE, 0.30D),
|
||||
PORTAL(Material.PORTAL, -1.00D),
|
||||
CAKE_BLOCK(Material.CAKE_BLOCK, 0.50D),
|
||||
LOCKED_CHEST(Material.LOCKED_CHEST, 0.00D),
|
||||
TRAP_DOOR(Material.TRAP_DOOR, 3.00D),
|
||||
MONSTER_EGGS(Material.MONSTER_EGGS, 0.750D),
|
||||
SMOOTH_BRICK(Material.SMOOTH_BRICK, 1.50D),
|
||||
IRON_FENCE(Material.IRON_FENCE, 5.00D),
|
||||
THIN_GLASS(Material.THIN_GLASS, 0.30D),
|
||||
PUMPKIN_STEM(Material.PUMPKIN_STEM, 0.00D),
|
||||
MELON_STEM(Material.MELON_STEM, 0.00D),
|
||||
VINE(Material.VINE, 0.20D),
|
||||
FENCE_GATE(Material.FENCE_GATE, 2.00D),
|
||||
MYCEL(Material.MYCEL, 0.60D),
|
||||
WATER_LILY(Material.WATER_LILY, 0.00D),
|
||||
NETHER_BRICK(Material.NETHER_BRICK, 2.00D),
|
||||
NETHER_FENCE(Material.NETHER_FENCE, 2.00D),
|
||||
ENCHANTMENT_TABLE(Material.ENCHANTMENT_TABLE, 5.00D),
|
||||
BREWING_STAND(Material.BREWING_STAND, 0.50D),
|
||||
CAULDRON(Material.CAULDRON, 2.00D),
|
||||
ENDER_PORTAL(Material.ENDER_PORTAL, -1.00D),
|
||||
ENDER_PORTAL_FRAME(Material.ENDER_PORTAL_FRAME, -1.00D),
|
||||
DRAGON_EGG(Material.DRAGON_EGG, 3.00D),
|
||||
REDSTONE_LAMP_OFF(Material.REDSTONE_LAMP_OFF, 0.30D),
|
||||
REDSTONE_LAMP_ON(Material.REDSTONE_LAMP_ON, 0.30D),
|
||||
WOOD_DOUBLE_STEP(Material.WOOD_DOUBLE_STEP, 2.00D),
|
||||
WOOD_STEP(Material.WOOD_STEP, 2.00D),
|
||||
COCOA(Material.COCOA, 0.20D),
|
||||
EMERALD_ORE(Material.EMERALD_ORE, 3.00D),
|
||||
ENDER_CHEST(Material.ENDER_CHEST, 22.50D),
|
||||
EMERALD_BLOCK(Material.EMERALD_BLOCK, 5.00D),
|
||||
FLOWER_POT(Material.FLOWER_POT, 0.00D),
|
||||
WOOD_BUTTON(Material.WOOD_BUTTON, 0.50D),
|
||||
ANVIL(Material.ANVIL, 5.00D);
|
||||
|
||||
Material mat;
|
||||
double hardness;
|
||||
|
||||
BlockHardness(Material m, double hard) {
|
||||
mat = m;
|
||||
hardness = hard;
|
||||
}
|
||||
|
||||
public static double getBlockHardness(Material m) {
|
||||
for (BlockHardness e : BlockHardness.values()) {
|
||||
if (e.mat.equals(m)) return e.hardness;
|
||||
}
|
||||
|
||||
return 1.0D;
|
||||
}
|
||||
}
|
||||
@@ -14,292 +14,226 @@ import org.bukkit.event.player.PlayerDropItemEvent;
|
||||
import org.bukkit.event.player.PlayerInteractEvent;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
public class Calibrator implements Listener
|
||||
{
|
||||
private final Player player;
|
||||
private int step = 0;
|
||||
private static final int TOTAL = 30;
|
||||
private long lastLong;
|
||||
private int lastInt;
|
||||
private int lastDouble;
|
||||
private long [] longs = new long[10];
|
||||
private double [] doubles = new double[10];
|
||||
private int [] ints = new int[10];
|
||||
private int times = 0;
|
||||
|
||||
// Value-specific calculations
|
||||
private long projectileTime;
|
||||
private long dropItemTime;
|
||||
private long punchAvg;
|
||||
private double blockBreakMax;
|
||||
private double blockPlaceMax;
|
||||
|
||||
public Calibrator(Player player)
|
||||
{
|
||||
this.player = player;
|
||||
player.sendMessage(ChatColor.GREEN+"----You have entered calibration mode.----");
|
||||
// Wait for listener to be registered and calibrate method called.
|
||||
}
|
||||
|
||||
public void calibrate()
|
||||
{
|
||||
switch(step)
|
||||
{
|
||||
case 0:
|
||||
sendStep();
|
||||
player.getInventory().setItemInHand(new ItemStack(Material.BOW));
|
||||
player.getInventory().addItem(new ItemStack(Material.ARROW, 64));
|
||||
player.sendMessage("Fire arrows as fast as possible (don't pull all the way back)");
|
||||
break;
|
||||
case 2:
|
||||
player.getInventory().clear();
|
||||
player.getInventory().setItemInHand(new ItemStack(Material.DIRT, 64));
|
||||
player.sendMessage("Drop items as fast as possible.");
|
||||
/*case 0:
|
||||
sendStep();
|
||||
player.sendMessage("Spam the left mouse button as fast as possible.");
|
||||
break;
|
||||
case 2:
|
||||
player.setGameMode(GameMode.CREATIVE);
|
||||
player.sendMessage("Break blocks from as far away as you can possibly get from them.");
|
||||
break;
|
||||
case 3:
|
||||
player.sendMessage("Place blocks from as far away as you can possibly get from them.");
|
||||
break;*/
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private int getLongCount()
|
||||
{
|
||||
int fill = 0;
|
||||
for(long l : longs)
|
||||
{
|
||||
if(l != 0)
|
||||
{
|
||||
fill++;
|
||||
}
|
||||
}
|
||||
return fill;
|
||||
}
|
||||
|
||||
private int getDoubleCount()
|
||||
{
|
||||
int fill = 0;
|
||||
for(double d : doubles)
|
||||
{
|
||||
if(d != 0)
|
||||
{
|
||||
fill++;
|
||||
}
|
||||
}
|
||||
return fill;
|
||||
}
|
||||
|
||||
private void clear()
|
||||
{
|
||||
for(int i =0;i<longs.length;i++)
|
||||
{
|
||||
longs[i] = 0;
|
||||
}
|
||||
for(int i =0;i<ints.length;i++)
|
||||
{
|
||||
ints[i] = 0;
|
||||
}
|
||||
for(int i =0;i<doubles.length;i++)
|
||||
{
|
||||
doubles[i] = 0;
|
||||
}
|
||||
lastInt = 0;
|
||||
lastDouble = 0;
|
||||
lastLong = 0;
|
||||
times = 0;
|
||||
|
||||
}
|
||||
|
||||
private void sendStep()
|
||||
{
|
||||
step++;
|
||||
player.sendMessage(ChatColor.GREEN+"Step "+step+"/"+TOTAL);
|
||||
}
|
||||
|
||||
// Find the average time it takes to do a task
|
||||
private long getAvgLong()
|
||||
{
|
||||
int count = getLongCount();
|
||||
if(count < 10)
|
||||
{
|
||||
if(lastLong == 0)
|
||||
{
|
||||
lastLong = System.currentTimeMillis();
|
||||
}
|
||||
else
|
||||
{
|
||||
longs[count] = System.currentTimeMillis()-lastLong;
|
||||
lastLong = System.currentTimeMillis();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
long avg = 0;
|
||||
for(long l : longs)
|
||||
{
|
||||
avg+=l;
|
||||
}
|
||||
clear();
|
||||
avg/=10;
|
||||
player.sendMessage(ChatColor.AQUA+"Done. Average calculated at "+ChatColor.WHITE+avg);
|
||||
sendStep();
|
||||
calibrate();
|
||||
return avg;
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
// Find the maximum time it takes to do a task
|
||||
private double getMaxDouble(double length)
|
||||
{
|
||||
int count = getDoubleCount();
|
||||
if(count < 10)
|
||||
{
|
||||
doubles[count] = length;
|
||||
}
|
||||
else
|
||||
{
|
||||
double max = 0;
|
||||
for(double d : doubles)
|
||||
{
|
||||
if(max == 0 || d > max)
|
||||
{
|
||||
max = d;
|
||||
}
|
||||
}
|
||||
clear();
|
||||
player.sendMessage(ChatColor.AQUA+"Done. Maximum calculated at "+ChatColor.WHITE+max);
|
||||
sendStep();
|
||||
calibrate();
|
||||
return max;
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
// Get the absolute time it takes to do something X times
|
||||
private long getAbsoluteLong()
|
||||
{
|
||||
int count = getLongCount();
|
||||
if(count < 10)
|
||||
{
|
||||
if(lastLong == 0)
|
||||
{
|
||||
lastLong = System.currentTimeMillis();
|
||||
}
|
||||
else
|
||||
{
|
||||
longs[count] = System.currentTimeMillis();
|
||||
lastLong = System.currentTimeMillis();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
long val = longs[9]-longs[0];
|
||||
clear();
|
||||
player.sendMessage(ChatColor.AQUA+"Done. Value calculated at "+ChatColor.WHITE+val);
|
||||
sendStep();
|
||||
calibrate();
|
||||
return val;
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
|
||||
// Begin event listeners
|
||||
|
||||
@EventHandler
|
||||
public void onPlayerDropItem(PlayerDropItemEvent event)
|
||||
{
|
||||
if(event.getPlayer() == player)
|
||||
{
|
||||
if(step == 2)
|
||||
{
|
||||
long v = getAbsoluteLong();
|
||||
if(v != -1)
|
||||
{
|
||||
dropItemTime = v;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onEntityShootBow(EntityShootBowEvent event)
|
||||
{
|
||||
if(event.getEntity() instanceof Player && ((Player)event.getEntity()) == player)
|
||||
{
|
||||
if(step == 1)
|
||||
{
|
||||
long v = getAbsoluteLong();
|
||||
if(v != -1)
|
||||
{
|
||||
projectileTime = v;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onPlayerInteract(PlayerInteractEvent event)
|
||||
{
|
||||
if(event.getPlayer() == player)
|
||||
{
|
||||
if(step == -1)
|
||||
{
|
||||
long v = getAvgLong();
|
||||
if(v != -1)
|
||||
{
|
||||
punchAvg = v;
|
||||
}
|
||||
}
|
||||
else if(step == 1)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onBlockBreak(BlockBreakEvent event)
|
||||
{
|
||||
if(event.getPlayer() == player)
|
||||
{
|
||||
if(step == -1)
|
||||
{
|
||||
double lengthX = Math.abs(event.getBlock().getX()-event.getPlayer().getLocation().getX());
|
||||
double lengthZ = Math.abs(event.getBlock().getZ()-event.getPlayer().getLocation().getZ());
|
||||
double v = getMaxDouble(lengthX >= lengthZ ? lengthX : lengthZ);
|
||||
if(v != -1)
|
||||
{
|
||||
blockBreakMax = v;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onBlockPlace(BlockPlaceEvent event)
|
||||
{
|
||||
if(event.getPlayer() == player)
|
||||
{
|
||||
if(step == -1)
|
||||
{
|
||||
double lengthX = Math.abs(event.getBlock().getX()-event.getPlayer().getLocation().getX());
|
||||
double lengthZ = Math.abs(event.getBlock().getZ()-event.getPlayer().getLocation().getZ());
|
||||
double v = getMaxDouble(lengthX >= lengthZ ? lengthX : lengthZ);
|
||||
if(v != -1)
|
||||
{
|
||||
blockPlaceMax = v;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
public class Calibrator implements Listener {
|
||||
private final Player player;
|
||||
private int step = 0;
|
||||
private static final int TOTAL = 30;
|
||||
private long lastLong;
|
||||
private int lastInt;
|
||||
private int lastDouble;
|
||||
private long[] longs = new long[10];
|
||||
private double[] doubles = new double[10];
|
||||
private int[] ints = new int[10];
|
||||
private int times = 0;
|
||||
|
||||
// Value-specific calculations
|
||||
private long projectileTime;
|
||||
private long dropItemTime;
|
||||
private long punchAvg;
|
||||
private double blockBreakMax;
|
||||
private double blockPlaceMax;
|
||||
|
||||
public Calibrator(Player player) {
|
||||
this.player = player;
|
||||
player.sendMessage(ChatColor.GREEN + "----You have entered calibration mode.----");
|
||||
// Wait for listener to be registered and calibrate method called.
|
||||
}
|
||||
|
||||
public void calibrate() {
|
||||
switch (step) {
|
||||
case 0:
|
||||
sendStep();
|
||||
player.getInventory().setItemInHand(new ItemStack(Material.BOW));
|
||||
player.getInventory().addItem(new ItemStack(Material.ARROW, 64));
|
||||
player.sendMessage("Fire arrows as fast as possible (don't pull all the way back)");
|
||||
break;
|
||||
case 2:
|
||||
player.getInventory().clear();
|
||||
player.getInventory().setItemInHand(new ItemStack(Material.DIRT, 64));
|
||||
player.sendMessage("Drop items as fast as possible.");
|
||||
/*
|
||||
* case 0: sendStep(); player.sendMessage("Spam the left mouse button as fast as possible."); break; case 2: player.setGameMode(GameMode.CREATIVE); player.sendMessage("Break blocks from as far away as you can possibly get from them."); break; case 3:
|
||||
* player.sendMessage("Place blocks from as far away as you can possibly get from them."); break;
|
||||
*/
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private int getLongCount() {
|
||||
int fill = 0;
|
||||
for (long l : longs) {
|
||||
if (l != 0) {
|
||||
fill++;
|
||||
}
|
||||
}
|
||||
return fill;
|
||||
}
|
||||
|
||||
private int getDoubleCount() {
|
||||
int fill = 0;
|
||||
for (double d : doubles) {
|
||||
if (d != 0) {
|
||||
fill++;
|
||||
}
|
||||
}
|
||||
return fill;
|
||||
}
|
||||
|
||||
private void clear() {
|
||||
for (int i = 0; i < longs.length; i++) {
|
||||
longs[i] = 0;
|
||||
}
|
||||
for (int i = 0; i < ints.length; i++) {
|
||||
ints[i] = 0;
|
||||
}
|
||||
for (int i = 0; i < doubles.length; i++) {
|
||||
doubles[i] = 0;
|
||||
}
|
||||
lastInt = 0;
|
||||
lastDouble = 0;
|
||||
lastLong = 0;
|
||||
times = 0;
|
||||
|
||||
}
|
||||
|
||||
private void sendStep() {
|
||||
step++;
|
||||
player.sendMessage(ChatColor.GREEN + "Step " + step + "/" + TOTAL);
|
||||
}
|
||||
|
||||
// Find the average time it takes to do a task
|
||||
private long getAvgLong() {
|
||||
int count = getLongCount();
|
||||
if (count < 10) {
|
||||
if (lastLong == 0) {
|
||||
lastLong = System.currentTimeMillis();
|
||||
} else {
|
||||
longs[count] = System.currentTimeMillis() - lastLong;
|
||||
lastLong = System.currentTimeMillis();
|
||||
}
|
||||
} else {
|
||||
long avg = 0;
|
||||
for (long l : longs) {
|
||||
avg += l;
|
||||
}
|
||||
clear();
|
||||
avg /= 10;
|
||||
player.sendMessage(ChatColor.AQUA + "Done. Average calculated at " + ChatColor.WHITE + avg);
|
||||
sendStep();
|
||||
calibrate();
|
||||
return avg;
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
// Find the maximum time it takes to do a task
|
||||
private double getMaxDouble(double length) {
|
||||
int count = getDoubleCount();
|
||||
if (count < 10) {
|
||||
doubles[count] = length;
|
||||
} else {
|
||||
double max = 0;
|
||||
for (double d : doubles) {
|
||||
if (max == 0 || d > max) {
|
||||
max = d;
|
||||
}
|
||||
}
|
||||
clear();
|
||||
player.sendMessage(ChatColor.AQUA + "Done. Maximum calculated at " + ChatColor.WHITE + max);
|
||||
sendStep();
|
||||
calibrate();
|
||||
return max;
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
// Get the absolute time it takes to do something X times
|
||||
private long getAbsoluteLong() {
|
||||
int count = getLongCount();
|
||||
if (count < 10) {
|
||||
if (lastLong == 0) {
|
||||
lastLong = System.currentTimeMillis();
|
||||
} else {
|
||||
longs[count] = System.currentTimeMillis();
|
||||
lastLong = System.currentTimeMillis();
|
||||
}
|
||||
} else {
|
||||
long val = longs[9] - longs[0];
|
||||
clear();
|
||||
player.sendMessage(ChatColor.AQUA + "Done. Value calculated at " + ChatColor.WHITE + val);
|
||||
sendStep();
|
||||
calibrate();
|
||||
return val;
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
// Begin event listeners
|
||||
|
||||
@EventHandler
|
||||
public void onPlayerDropItem(PlayerDropItemEvent event) {
|
||||
if (event.getPlayer() == player) {
|
||||
if (step == 2) {
|
||||
long v = getAbsoluteLong();
|
||||
if (v != -1) {
|
||||
dropItemTime = v;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onEntityShootBow(EntityShootBowEvent event) {
|
||||
if (event.getEntity() instanceof Player && ((Player) event.getEntity()) == player) {
|
||||
if (step == 1) {
|
||||
long v = getAbsoluteLong();
|
||||
if (v != -1) {
|
||||
projectileTime = v;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onPlayerInteract(PlayerInteractEvent event) {
|
||||
if (event.getPlayer() == player) {
|
||||
if (step == -1) {
|
||||
long v = getAvgLong();
|
||||
if (v != -1) {
|
||||
punchAvg = v;
|
||||
}
|
||||
} else if (step == 1) {
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onBlockBreak(BlockBreakEvent event) {
|
||||
if (event.getPlayer() == player) {
|
||||
if (step == -1) {
|
||||
double lengthX = Math.abs(event.getBlock().getX() - event.getPlayer().getLocation().getX());
|
||||
double lengthZ = Math.abs(event.getBlock().getZ() - event.getPlayer().getLocation().getZ());
|
||||
double v = getMaxDouble(lengthX >= lengthZ ? lengthX : lengthZ);
|
||||
if (v != -1) {
|
||||
blockBreakMax = v;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onBlockPlace(BlockPlaceEvent event) {
|
||||
if (event.getPlayer() == player) {
|
||||
if (step == -1) {
|
||||
double lengthX = Math.abs(event.getBlock().getX() - event.getPlayer().getLocation().getX());
|
||||
double lengthZ = Math.abs(event.getBlock().getZ() - event.getPlayer().getLocation().getZ());
|
||||
double v = getMaxDouble(lengthX >= lengthZ ? lengthX : lengthZ);
|
||||
if (v != -1) {
|
||||
blockPlaceMax = v;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -31,337 +31,272 @@ import org.bukkit.World;
|
||||
import org.bukkit.configuration.file.FileConfiguration;
|
||||
import org.bukkit.configuration.file.YamlConfiguration;
|
||||
|
||||
public class Configuration
|
||||
{
|
||||
private AnticheatManager micromanage = null;
|
||||
private File configFile = null;
|
||||
private File levelFile = null;
|
||||
private File langFile = null;
|
||||
private File magicFile = null;
|
||||
private CommentedConfiguration config;
|
||||
private FileConfiguration level;
|
||||
private FileConfiguration magic;
|
||||
private boolean logConsole;
|
||||
private boolean logXRay;
|
||||
private boolean alertXRay;
|
||||
private boolean autoUpdate;
|
||||
private boolean verboseStartup;
|
||||
private boolean chatSpam;
|
||||
private boolean commandSpam;
|
||||
private boolean silentMode;
|
||||
private boolean opExempt;
|
||||
private boolean trackCreativeXRay;
|
||||
private int fileLogLevel = 0;
|
||||
private int medThreshold = 0;
|
||||
private int highThreshold = 0;
|
||||
private String updateFolder;
|
||||
private String eventMed;
|
||||
private String eventHigh;
|
||||
private String chatActionKick;
|
||||
private String chatActionBan;
|
||||
private static Language language;
|
||||
private List<String> exemptWorlds = new ArrayList<String>();
|
||||
|
||||
public Configuration(AnticheatManager instance)
|
||||
{
|
||||
micromanage = instance;
|
||||
configFile = new File(micromanage.getPlugin().getDataFolder() + "/config.yml");
|
||||
levelFile = new File(micromanage.getPlugin().getDataFolder() + "/data/level.yml");
|
||||
langFile = new File(micromanage.getPlugin().getDataFolder() + "/lang.yml");
|
||||
magicFile = new File(micromanage.getPlugin().getDataFolder() + "/magic.yml");
|
||||
load();
|
||||
}
|
||||
|
||||
private void save()
|
||||
{
|
||||
try
|
||||
{
|
||||
config.save(configFile);
|
||||
}
|
||||
catch (IOException ex)
|
||||
{
|
||||
Logger.getLogger(Configuration.class.getName()).log(Level.SEVERE, null, ex);
|
||||
}
|
||||
}
|
||||
|
||||
public boolean logConsole()
|
||||
{
|
||||
return logConsole;
|
||||
}
|
||||
|
||||
public boolean logXRay()
|
||||
{
|
||||
return logXRay;
|
||||
}
|
||||
|
||||
public boolean alertXRay()
|
||||
{
|
||||
return alertXRay;
|
||||
}
|
||||
|
||||
public boolean autoUpdate()
|
||||
{
|
||||
return autoUpdate;
|
||||
}
|
||||
|
||||
public boolean verboseStartup()
|
||||
{
|
||||
return verboseStartup;
|
||||
}
|
||||
|
||||
public boolean chatSpam()
|
||||
{
|
||||
return chatSpam;
|
||||
}
|
||||
|
||||
public boolean commandSpam()
|
||||
{
|
||||
return commandSpam;
|
||||
}
|
||||
|
||||
public String updateFolder()
|
||||
{
|
||||
return updateFolder;
|
||||
}
|
||||
|
||||
public boolean silentMode()
|
||||
{
|
||||
return silentMode;
|
||||
}
|
||||
|
||||
public boolean opExempt()
|
||||
{
|
||||
return opExempt;
|
||||
}
|
||||
|
||||
public boolean trackCreativeXRay()
|
||||
{
|
||||
return trackCreativeXRay;
|
||||
}
|
||||
|
||||
public int medThreshold()
|
||||
{
|
||||
return medThreshold;
|
||||
}
|
||||
|
||||
public int highThreshold()
|
||||
{
|
||||
return highThreshold;
|
||||
}
|
||||
|
||||
public String mediumEvent()
|
||||
{
|
||||
return eventMed;
|
||||
}
|
||||
|
||||
public String highEvent()
|
||||
{
|
||||
return eventHigh;
|
||||
}
|
||||
|
||||
public String chatActionKick()
|
||||
{
|
||||
return chatActionKick;
|
||||
}
|
||||
|
||||
public String chatActionBan()
|
||||
{
|
||||
return chatActionBan;
|
||||
}
|
||||
|
||||
public int getFileLogLevel()
|
||||
{
|
||||
return fileLogLevel;
|
||||
}
|
||||
|
||||
public Language getLang()
|
||||
{
|
||||
return language;
|
||||
}
|
||||
|
||||
public final void load()
|
||||
{
|
||||
micromanage.getPlugin().checkConfigs();
|
||||
config = CommentedConfiguration.loadConfig(configFile);
|
||||
level = YamlConfiguration.loadConfiguration(levelFile);
|
||||
magic = YamlConfiguration.loadConfiguration(magicFile);
|
||||
language = new Language(YamlConfiguration.loadConfiguration(langFile), langFile);
|
||||
updateFolder = Bukkit.getUpdateFolder();
|
||||
|
||||
// Begin pulling values from config.
|
||||
logConsole = getBoolean("System.Log to console", false);
|
||||
logXRay = getBoolean ("XRay.Log xray stats", true);
|
||||
autoUpdate = getBoolean ("System.Auto update", true);
|
||||
verboseStartup = getBoolean ("System.Verbose startup", false);
|
||||
alertXRay = getBoolean("XRay.Alert when xray is found", false);
|
||||
fileLogLevel = getInt("System.File log level", 1);
|
||||
silentMode = getBoolean("System.Silent mode", false);
|
||||
medThreshold = getInt("Events.Medium threshold", 20);
|
||||
highThreshold = getInt("Events.High threshold", 50);
|
||||
opExempt = getBoolean("System.Exempt op", false);
|
||||
trackCreativeXRay = getBoolean("XRay.Track creative", true);
|
||||
eventMed = getString("Events.Level Medium", "WARN");
|
||||
eventHigh = getString("Events.Level High", "KICK");
|
||||
chatActionKick = getString("Chat.Kick Action", "KICK");
|
||||
chatActionBan = getString("Chat.Ban Action", "BAN");
|
||||
chatSpam = getBoolean("Chat.Block chat spam", true);
|
||||
commandSpam = getBoolean("Chat.Block command spam", false);
|
||||
// Cleanup old values
|
||||
if(config.getString("System.Block command spam") != null)
|
||||
{
|
||||
config.set("System.Block command spam", null);
|
||||
}
|
||||
if(config.getString("System.Block chat spam") != null)
|
||||
{
|
||||
config.set("System.Block chat spam", null);
|
||||
}
|
||||
|
||||
// Worlds
|
||||
List<String> list = new ArrayList<String>();
|
||||
list.add("example-world");
|
||||
list.add("example-world-2");
|
||||
|
||||
if (config.getList("Enable in") != null)
|
||||
{
|
||||
List<String> list2 = config.getStringList("Enable in");
|
||||
List<String> list3 = new ArrayList<String>();
|
||||
for(World world : micromanage.getPlugin().getServer().getWorlds())
|
||||
{
|
||||
if(!list2.contains(world.getName()))
|
||||
{
|
||||
list3.add(world.getName());
|
||||
}
|
||||
}
|
||||
if(!list3.isEmpty())
|
||||
{
|
||||
list = list3;
|
||||
}
|
||||
config.set("Enable in", null);
|
||||
}
|
||||
if (config.getList("Disable in") == null)
|
||||
{
|
||||
config.set("Disable in", list);
|
||||
}
|
||||
|
||||
exemptWorlds = config.getStringList("Disable in");
|
||||
// End pulling values from config
|
||||
save();
|
||||
}
|
||||
|
||||
private boolean getBoolean(String entry, boolean d)
|
||||
{
|
||||
if (config.getString(entry) == null)
|
||||
{
|
||||
config.set(entry, d);
|
||||
return d;
|
||||
}
|
||||
else
|
||||
{
|
||||
return config.getBoolean(entry);
|
||||
}
|
||||
}
|
||||
|
||||
private int getInt(String entry, int d)
|
||||
{
|
||||
if (config.getString(entry) == null)
|
||||
{
|
||||
config.set(entry, d);
|
||||
return d;
|
||||
}
|
||||
else
|
||||
{
|
||||
return config.getInt(entry);
|
||||
}
|
||||
}
|
||||
|
||||
private String getString(String entry, String d)
|
||||
{
|
||||
if (config.getString(entry) == null)
|
||||
{
|
||||
config.set(entry, d);
|
||||
return d;
|
||||
}
|
||||
else
|
||||
{
|
||||
return config.getString(entry);
|
||||
}
|
||||
}
|
||||
|
||||
public void setLog(boolean b)
|
||||
{
|
||||
config.set("System.Log to console", b);
|
||||
this.logConsole = b;
|
||||
try
|
||||
{
|
||||
config.save(configFile);
|
||||
}
|
||||
catch (IOException ex)
|
||||
{
|
||||
Logger.getLogger(Configuration.class.getName()).log(Level.SEVERE, null, ex);
|
||||
}
|
||||
}
|
||||
|
||||
public List<String> getWorldsExempt()
|
||||
{
|
||||
return exemptWorlds;
|
||||
}
|
||||
|
||||
public File getConfigFile()
|
||||
{
|
||||
return configFile;
|
||||
}
|
||||
|
||||
public File getLevelFile()
|
||||
{
|
||||
return levelFile;
|
||||
}
|
||||
|
||||
public FileConfiguration getMagic()
|
||||
{
|
||||
return magic;
|
||||
}
|
||||
|
||||
public boolean checkInWorld(World world)
|
||||
{
|
||||
return !exemptWorlds.contains(world.getName());
|
||||
}
|
||||
|
||||
public int getLevel(String player)
|
||||
{
|
||||
int x = -1;
|
||||
if (level.getString(player) != null)
|
||||
{
|
||||
x = level.getInt(player);
|
||||
}
|
||||
return x;
|
||||
}
|
||||
|
||||
public void saveLevel(String user, int x)
|
||||
{
|
||||
level.set(user, x);
|
||||
}
|
||||
|
||||
public void saveLevels()
|
||||
{
|
||||
try
|
||||
{
|
||||
level.save(levelFile);
|
||||
}
|
||||
catch (IOException ex)
|
||||
{
|
||||
Logger.getLogger(Configuration.class.getName()).log(Level.SEVERE, null, ex);
|
||||
}
|
||||
}
|
||||
|
||||
public void saveMagic(FileConfiguration newMagic)
|
||||
{
|
||||
try
|
||||
{
|
||||
newMagic.save(magicFile);
|
||||
}
|
||||
catch (IOException ex)
|
||||
{
|
||||
Logger.getLogger(Configuration.class.getName()).log(Level.SEVERE, null, ex);
|
||||
}
|
||||
}
|
||||
public class Configuration {
|
||||
private AnticheatManager micromanage = null;
|
||||
private File configFile = null;
|
||||
private File levelFile = null;
|
||||
private File langFile = null;
|
||||
private File magicFile = null;
|
||||
private CommentedConfiguration config;
|
||||
private FileConfiguration level;
|
||||
private FileConfiguration magic;
|
||||
private boolean logConsole;
|
||||
private boolean logXRay;
|
||||
private boolean alertXRay;
|
||||
private boolean autoUpdate;
|
||||
private boolean verboseStartup;
|
||||
private boolean chatSpam;
|
||||
private boolean commandSpam;
|
||||
private boolean silentMode;
|
||||
private boolean opExempt;
|
||||
private boolean trackCreativeXRay;
|
||||
private int fileLogLevel = 0;
|
||||
private int medThreshold = 0;
|
||||
private int highThreshold = 0;
|
||||
private String updateFolder;
|
||||
private String eventMed;
|
||||
private String eventHigh;
|
||||
private String chatActionKick;
|
||||
private String chatActionBan;
|
||||
private static Language language;
|
||||
private List<String> exemptWorlds = new ArrayList<String>();
|
||||
|
||||
public Configuration(AnticheatManager instance) {
|
||||
micromanage = instance;
|
||||
configFile = new File(micromanage.getPlugin().getDataFolder() + "/config.yml");
|
||||
levelFile = new File(micromanage.getPlugin().getDataFolder() + "/data/level.yml");
|
||||
langFile = new File(micromanage.getPlugin().getDataFolder() + "/lang.yml");
|
||||
magicFile = new File(micromanage.getPlugin().getDataFolder() + "/magic.yml");
|
||||
load();
|
||||
}
|
||||
|
||||
private void save() {
|
||||
try {
|
||||
config.save(configFile);
|
||||
} catch (IOException ex) {
|
||||
Logger.getLogger(Configuration.class.getName()).log(Level.SEVERE, null, ex);
|
||||
}
|
||||
}
|
||||
|
||||
public boolean logConsole() {
|
||||
return logConsole;
|
||||
}
|
||||
|
||||
public boolean logXRay() {
|
||||
return logXRay;
|
||||
}
|
||||
|
||||
public boolean alertXRay() {
|
||||
return alertXRay;
|
||||
}
|
||||
|
||||
public boolean autoUpdate() {
|
||||
return autoUpdate;
|
||||
}
|
||||
|
||||
public boolean verboseStartup() {
|
||||
return verboseStartup;
|
||||
}
|
||||
|
||||
public boolean chatSpam() {
|
||||
return chatSpam;
|
||||
}
|
||||
|
||||
public boolean commandSpam() {
|
||||
return commandSpam;
|
||||
}
|
||||
|
||||
public String updateFolder() {
|
||||
return updateFolder;
|
||||
}
|
||||
|
||||
public boolean silentMode() {
|
||||
return silentMode;
|
||||
}
|
||||
|
||||
public boolean opExempt() {
|
||||
return opExempt;
|
||||
}
|
||||
|
||||
public boolean trackCreativeXRay() {
|
||||
return trackCreativeXRay;
|
||||
}
|
||||
|
||||
public int medThreshold() {
|
||||
return medThreshold;
|
||||
}
|
||||
|
||||
public int highThreshold() {
|
||||
return highThreshold;
|
||||
}
|
||||
|
||||
public String mediumEvent() {
|
||||
return eventMed;
|
||||
}
|
||||
|
||||
public String highEvent() {
|
||||
return eventHigh;
|
||||
}
|
||||
|
||||
public String chatActionKick() {
|
||||
return chatActionKick;
|
||||
}
|
||||
|
||||
public String chatActionBan() {
|
||||
return chatActionBan;
|
||||
}
|
||||
|
||||
public int getFileLogLevel() {
|
||||
return fileLogLevel;
|
||||
}
|
||||
|
||||
public Language getLang() {
|
||||
return language;
|
||||
}
|
||||
|
||||
public final void load() {
|
||||
micromanage.getPlugin().checkConfigs();
|
||||
config = CommentedConfiguration.loadConfig(configFile);
|
||||
level = YamlConfiguration.loadConfiguration(levelFile);
|
||||
magic = YamlConfiguration.loadConfiguration(magicFile);
|
||||
language = new Language(YamlConfiguration.loadConfiguration(langFile), langFile);
|
||||
updateFolder = Bukkit.getUpdateFolder();
|
||||
|
||||
// Begin pulling values from config.
|
||||
logConsole = getBoolean("System.Log to console", false);
|
||||
logXRay = getBoolean("XRay.Log xray stats", true);
|
||||
autoUpdate = getBoolean("System.Auto update", true);
|
||||
verboseStartup = getBoolean("System.Verbose startup", false);
|
||||
alertXRay = getBoolean("XRay.Alert when xray is found", false);
|
||||
fileLogLevel = getInt("System.File log level", 1);
|
||||
silentMode = getBoolean("System.Silent mode", false);
|
||||
medThreshold = getInt("Events.Medium threshold", 20);
|
||||
highThreshold = getInt("Events.High threshold", 50);
|
||||
opExempt = getBoolean("System.Exempt op", false);
|
||||
trackCreativeXRay = getBoolean("XRay.Track creative", true);
|
||||
eventMed = getString("Events.Level Medium", "WARN");
|
||||
eventHigh = getString("Events.Level High", "KICK");
|
||||
chatActionKick = getString("Chat.Kick Action", "KICK");
|
||||
chatActionBan = getString("Chat.Ban Action", "BAN");
|
||||
chatSpam = getBoolean("Chat.Block chat spam", true);
|
||||
commandSpam = getBoolean("Chat.Block command spam", false);
|
||||
// Cleanup old values
|
||||
if (config.getString("System.Block command spam") != null) {
|
||||
config.set("System.Block command spam", null);
|
||||
}
|
||||
if (config.getString("System.Block chat spam") != null) {
|
||||
config.set("System.Block chat spam", null);
|
||||
}
|
||||
|
||||
// Worlds
|
||||
List<String> list = new ArrayList<String>();
|
||||
list.add("example-world");
|
||||
list.add("example-world-2");
|
||||
|
||||
if (config.getList("Enable in") != null) {
|
||||
List<String> list2 = config.getStringList("Enable in");
|
||||
List<String> list3 = new ArrayList<String>();
|
||||
for (World world : micromanage.getPlugin().getServer().getWorlds()) {
|
||||
if (!list2.contains(world.getName())) {
|
||||
list3.add(world.getName());
|
||||
}
|
||||
}
|
||||
if (!list3.isEmpty()) {
|
||||
list = list3;
|
||||
}
|
||||
config.set("Enable in", null);
|
||||
}
|
||||
if (config.getList("Disable in") == null) {
|
||||
config.set("Disable in", list);
|
||||
}
|
||||
|
||||
exemptWorlds = config.getStringList("Disable in");
|
||||
// End pulling values from config
|
||||
save();
|
||||
}
|
||||
|
||||
private boolean getBoolean(String entry, boolean d) {
|
||||
if (config.getString(entry) == null) {
|
||||
config.set(entry, d);
|
||||
return d;
|
||||
} else {
|
||||
return config.getBoolean(entry);
|
||||
}
|
||||
}
|
||||
|
||||
private int getInt(String entry, int d) {
|
||||
if (config.getString(entry) == null) {
|
||||
config.set(entry, d);
|
||||
return d;
|
||||
} else {
|
||||
return config.getInt(entry);
|
||||
}
|
||||
}
|
||||
|
||||
private String getString(String entry, String d) {
|
||||
if (config.getString(entry) == null) {
|
||||
config.set(entry, d);
|
||||
return d;
|
||||
} else {
|
||||
return config.getString(entry);
|
||||
}
|
||||
}
|
||||
|
||||
public void setLog(boolean b) {
|
||||
config.set("System.Log to console", b);
|
||||
this.logConsole = b;
|
||||
try {
|
||||
config.save(configFile);
|
||||
} catch (IOException ex) {
|
||||
Logger.getLogger(Configuration.class.getName()).log(Level.SEVERE, null, ex);
|
||||
}
|
||||
}
|
||||
|
||||
public List<String> getWorldsExempt() {
|
||||
return exemptWorlds;
|
||||
}
|
||||
|
||||
public File getConfigFile() {
|
||||
return configFile;
|
||||
}
|
||||
|
||||
public File getLevelFile() {
|
||||
return levelFile;
|
||||
}
|
||||
|
||||
public FileConfiguration getMagic() {
|
||||
return magic;
|
||||
}
|
||||
|
||||
public boolean checkInWorld(World world) {
|
||||
return !exemptWorlds.contains(world.getName());
|
||||
}
|
||||
|
||||
public int getLevel(String player) {
|
||||
int x = -1;
|
||||
if (level.getString(player) != null) {
|
||||
x = level.getInt(player);
|
||||
}
|
||||
return x;
|
||||
}
|
||||
|
||||
public void saveLevel(String user, int x) {
|
||||
level.set(user, x);
|
||||
}
|
||||
|
||||
public void saveLevels() {
|
||||
try {
|
||||
level.save(levelFile);
|
||||
} catch (IOException ex) {
|
||||
Logger.getLogger(Configuration.class.getName()).log(Level.SEVERE, null, ex);
|
||||
}
|
||||
}
|
||||
|
||||
public void saveMagic(FileConfiguration newMagic) {
|
||||
try {
|
||||
newMagic.save(magicFile);
|
||||
} catch (IOException ex) {
|
||||
Logger.getLogger(Configuration.class.getName()).log(Level.SEVERE, null, ex);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -21,13 +21,11 @@ package net.h31ix.anticheat.util;
|
||||
import java.util.logging.Formatter;
|
||||
import java.util.logging.LogRecord;
|
||||
|
||||
public class ConsoleFormatter extends Formatter
|
||||
{
|
||||
|
||||
@Override
|
||||
public String format(LogRecord record)
|
||||
{
|
||||
StringBuilder output = new StringBuilder().append(record.getMessage()).append(' ');
|
||||
return output.toString();
|
||||
}
|
||||
public class ConsoleFormatter extends Formatter {
|
||||
|
||||
@Override
|
||||
public String format(LogRecord record) {
|
||||
StringBuilder output = new StringBuilder().append(record.getMessage()).append(' ');
|
||||
return output.toString();
|
||||
}
|
||||
}
|
||||
@@ -20,38 +20,31 @@ package net.h31ix.anticheat.util;
|
||||
|
||||
import org.bukkit.Location;
|
||||
|
||||
public class Distance
|
||||
{
|
||||
private final Location l1, l2;
|
||||
|
||||
public Distance(Location from, Location to)
|
||||
{
|
||||
l1 = to;
|
||||
l2 = from;
|
||||
}
|
||||
|
||||
public double fromY()
|
||||
{
|
||||
return l2.getY();
|
||||
}
|
||||
|
||||
public double toY()
|
||||
{
|
||||
return l1.getY();
|
||||
}
|
||||
|
||||
public double getXDifference()
|
||||
{
|
||||
return Math.abs(l1.getX() - l2.getX());
|
||||
}
|
||||
|
||||
public double getZDifference()
|
||||
{
|
||||
return Math.abs(l1.getZ() - l2.getZ());
|
||||
}
|
||||
|
||||
public double getYDifference()
|
||||
{
|
||||
return Math.abs(l1.getY() - l2.getY());
|
||||
}
|
||||
public class Distance {
|
||||
private final Location l1, l2;
|
||||
|
||||
public Distance(Location from, Location to) {
|
||||
l1 = to;
|
||||
l2 = from;
|
||||
}
|
||||
|
||||
public double fromY() {
|
||||
return l2.getY();
|
||||
}
|
||||
|
||||
public double toY() {
|
||||
return l1.getY();
|
||||
}
|
||||
|
||||
public double getXDifference() {
|
||||
return Math.abs(l1.getX() - l2.getX());
|
||||
}
|
||||
|
||||
public double getZDifference() {
|
||||
return Math.abs(l1.getZ() - l2.getZ());
|
||||
}
|
||||
|
||||
public double getYDifference() {
|
||||
return Math.abs(l1.getY() - l2.getY());
|
||||
}
|
||||
}
|
||||
@@ -24,15 +24,13 @@ import java.util.Date;
|
||||
import java.util.logging.Formatter;
|
||||
import java.util.logging.LogRecord;
|
||||
|
||||
public class FileFormatter extends Formatter
|
||||
{
|
||||
private static final DateFormat FORMAT = new SimpleDateFormat("h:mm:ss");
|
||||
private static final String LINE_SEP = System.getProperty("line.separator");
|
||||
|
||||
@Override
|
||||
public String format(LogRecord record)
|
||||
{
|
||||
StringBuilder output = new StringBuilder().append("[").append(record.getLevel()).append('|').append(FORMAT.format(new Date(record.getMillis()))).append("]: ").append(record.getMessage()).append(' ').append(LINE_SEP);
|
||||
return output.toString();
|
||||
}
|
||||
public class FileFormatter extends Formatter {
|
||||
private static final DateFormat FORMAT = new SimpleDateFormat("h:mm:ss");
|
||||
private static final String LINE_SEP = System.getProperty("line.separator");
|
||||
|
||||
@Override
|
||||
public String format(LogRecord record) {
|
||||
StringBuilder output = new StringBuilder().append("[").append(record.getLevel()).append('|').append(FORMAT.format(new Date(record.getMillis()))).append("]: ").append(record.getMessage()).append(' ').append(LINE_SEP);
|
||||
return output.toString();
|
||||
}
|
||||
}
|
||||
@@ -28,135 +28,112 @@ import java.util.logging.Logger;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.configuration.file.FileConfiguration;
|
||||
|
||||
public class Language
|
||||
{
|
||||
private static String[] medAlert = null;
|
||||
private static String[] highAlert = null;
|
||||
private static String[] warning = null;
|
||||
private static String banReason = null;
|
||||
private static String banBroadcast = null;
|
||||
private static String kickReason = null;
|
||||
private static String kickBroadcast = null;
|
||||
private static String chatWarning = null;
|
||||
private static String chatKickBroadcast = null;
|
||||
private static String chatKickReason = null;
|
||||
private static String chatBanBroadcast = null;
|
||||
private static String chatBanReason = null;
|
||||
|
||||
private static final ChatColor GOLD = ChatColor.GOLD;
|
||||
private static final ChatColor GRAY = ChatColor.GRAY;
|
||||
private FileConfiguration file;
|
||||
|
||||
public Language(FileConfiguration file, File f)
|
||||
{
|
||||
this.file = file;
|
||||
String [] temp = file.getList("alert.medium_alert").toArray(new String[file.getList("alert.medium_alert").size()]);
|
||||
medAlert = new String [temp.length+2];
|
||||
medAlert[0] = GOLD + "----------------------[" + GRAY + "AntiCheat" + GOLD + "]----------------------";
|
||||
for(int i=0;i<temp.length;i++)
|
||||
{
|
||||
medAlert[i+1] = GRAY + temp[i];
|
||||
}
|
||||
medAlert[medAlert.length-1] = GOLD + "-----------------------------------------------------";
|
||||
temp = file.getList("alert.high_alert").toArray(new String[file.getList("alert.high_alert").size()]);
|
||||
highAlert = new String [temp.length+2];
|
||||
highAlert[0] = GOLD + "----------------------[" + GRAY + "AntiCheat" + GOLD + "]----------------------";
|
||||
for(int i=0;i<temp.length;i++)
|
||||
{
|
||||
highAlert[i+1] = GRAY + temp[i];
|
||||
}
|
||||
highAlert[highAlert.length-1] = GOLD + "-----------------------------------------------------";
|
||||
|
||||
warning = file.getList("warning.player_warning").toArray(new String[file.getList("warning.player_warning").size()]);
|
||||
banReason = getString("ban.ban_reason", "Banned by AntiCheat");
|
||||
banBroadcast = getString("ban.ban_broadcast", "[AntiCheat] &player was banned for hacking.");
|
||||
kickReason = getString("kick.kick_reason", "Kicked by AntiCheat");
|
||||
kickBroadcast = getString("kick.kick_broadcast", "[AntiCheat] &player was kicked for hacking.");
|
||||
chatWarning = getString("chat.warning", "Stop spamming the server or you will be kicked!");
|
||||
chatKickReason = getString("chat.kick_reason", "Kicked for spamming");
|
||||
chatBanReason = getString("chat.ban_reason", "Banned for spamming");
|
||||
chatKickBroadcast = getString("chat.kick_broadcast", "[AntiCheat] &player was kicked for spamming");
|
||||
chatBanBroadcast = getString("chat.ban_broadcast", "[AntiCheat] &player was banned for spamming");
|
||||
try
|
||||
{
|
||||
file.save(f);
|
||||
}
|
||||
catch (IOException ex)
|
||||
{
|
||||
Logger.getLogger(Language.class.getName()).log(Level.SEVERE, null, ex);
|
||||
}
|
||||
}
|
||||
|
||||
public List<String> getMediumAlert()
|
||||
{
|
||||
return new ArrayList<String>(Arrays.asList(medAlert));
|
||||
}
|
||||
|
||||
public List<String> getHighAlert()
|
||||
{
|
||||
return new ArrayList<String>(Arrays.asList(highAlert));
|
||||
}
|
||||
|
||||
public List<String> getWarning()
|
||||
{
|
||||
return new ArrayList<String>(Arrays.asList(warning));
|
||||
}
|
||||
|
||||
public String getBanReason()
|
||||
{
|
||||
return banReason;
|
||||
}
|
||||
|
||||
public String getBanBroadcast()
|
||||
{
|
||||
return banBroadcast;
|
||||
}
|
||||
|
||||
public String getKickReason()
|
||||
{
|
||||
return kickReason;
|
||||
}
|
||||
|
||||
public String getKickBroadcast()
|
||||
{
|
||||
return kickBroadcast;
|
||||
}
|
||||
|
||||
public String getChatKickReason()
|
||||
{
|
||||
return chatKickReason;
|
||||
}
|
||||
|
||||
public String getChatKickBroadcast()
|
||||
{
|
||||
return chatKickBroadcast;
|
||||
}
|
||||
|
||||
public String getChatBanReason()
|
||||
{
|
||||
return chatBanReason;
|
||||
}
|
||||
|
||||
public String getChatBanBroadcast()
|
||||
{
|
||||
return chatBanBroadcast;
|
||||
}
|
||||
|
||||
public String getChatWarning()
|
||||
{
|
||||
return chatWarning;
|
||||
}
|
||||
|
||||
private String getString(String entry, String d)
|
||||
{
|
||||
if (file.getString(entry) == null)
|
||||
{
|
||||
file.set(entry, d);
|
||||
return d;
|
||||
}
|
||||
else
|
||||
{
|
||||
return file.getString(entry);
|
||||
}
|
||||
}
|
||||
public class Language {
|
||||
private static String[] medAlert = null;
|
||||
private static String[] highAlert = null;
|
||||
private static String[] warning = null;
|
||||
private static String banReason = null;
|
||||
private static String banBroadcast = null;
|
||||
private static String kickReason = null;
|
||||
private static String kickBroadcast = null;
|
||||
private static String chatWarning = null;
|
||||
private static String chatKickBroadcast = null;
|
||||
private static String chatKickReason = null;
|
||||
private static String chatBanBroadcast = null;
|
||||
private static String chatBanReason = null;
|
||||
|
||||
private static final ChatColor GOLD = ChatColor.GOLD;
|
||||
private static final ChatColor GRAY = ChatColor.GRAY;
|
||||
private FileConfiguration file;
|
||||
|
||||
public Language(FileConfiguration file, File f) {
|
||||
this.file = file;
|
||||
String[] temp = file.getList("alert.medium_alert").toArray(new String[file.getList("alert.medium_alert").size()]);
|
||||
medAlert = new String[temp.length + 2];
|
||||
medAlert[0] = GOLD + "----------------------[" + GRAY + "AntiCheat" + GOLD + "]----------------------";
|
||||
for (int i = 0; i < temp.length; i++) {
|
||||
medAlert[i + 1] = GRAY + temp[i];
|
||||
}
|
||||
medAlert[medAlert.length - 1] = GOLD + "-----------------------------------------------------";
|
||||
temp = file.getList("alert.high_alert").toArray(new String[file.getList("alert.high_alert").size()]);
|
||||
highAlert = new String[temp.length + 2];
|
||||
highAlert[0] = GOLD + "----------------------[" + GRAY + "AntiCheat" + GOLD + "]----------------------";
|
||||
for (int i = 0; i < temp.length; i++) {
|
||||
highAlert[i + 1] = GRAY + temp[i];
|
||||
}
|
||||
highAlert[highAlert.length - 1] = GOLD + "-----------------------------------------------------";
|
||||
|
||||
warning = file.getList("warning.player_warning").toArray(new String[file.getList("warning.player_warning").size()]);
|
||||
banReason = getString("ban.ban_reason", "Banned by AntiCheat");
|
||||
banBroadcast = getString("ban.ban_broadcast", "[AntiCheat] &player was banned for hacking.");
|
||||
kickReason = getString("kick.kick_reason", "Kicked by AntiCheat");
|
||||
kickBroadcast = getString("kick.kick_broadcast", "[AntiCheat] &player was kicked for hacking.");
|
||||
chatWarning = getString("chat.warning", "Stop spamming the server or you will be kicked!");
|
||||
chatKickReason = getString("chat.kick_reason", "Kicked for spamming");
|
||||
chatBanReason = getString("chat.ban_reason", "Banned for spamming");
|
||||
chatKickBroadcast = getString("chat.kick_broadcast", "[AntiCheat] &player was kicked for spamming");
|
||||
chatBanBroadcast = getString("chat.ban_broadcast", "[AntiCheat] &player was banned for spamming");
|
||||
try {
|
||||
file.save(f);
|
||||
} catch (IOException ex) {
|
||||
Logger.getLogger(Language.class.getName()).log(Level.SEVERE, null, ex);
|
||||
}
|
||||
}
|
||||
|
||||
public List<String> getMediumAlert() {
|
||||
return new ArrayList<String>(Arrays.asList(medAlert));
|
||||
}
|
||||
|
||||
public List<String> getHighAlert() {
|
||||
return new ArrayList<String>(Arrays.asList(highAlert));
|
||||
}
|
||||
|
||||
public List<String> getWarning() {
|
||||
return new ArrayList<String>(Arrays.asList(warning));
|
||||
}
|
||||
|
||||
public String getBanReason() {
|
||||
return banReason;
|
||||
}
|
||||
|
||||
public String getBanBroadcast() {
|
||||
return banBroadcast;
|
||||
}
|
||||
|
||||
public String getKickReason() {
|
||||
return kickReason;
|
||||
}
|
||||
|
||||
public String getKickBroadcast() {
|
||||
return kickBroadcast;
|
||||
}
|
||||
|
||||
public String getChatKickReason() {
|
||||
return chatKickReason;
|
||||
}
|
||||
|
||||
public String getChatKickBroadcast() {
|
||||
return chatKickBroadcast;
|
||||
}
|
||||
|
||||
public String getChatBanReason() {
|
||||
return chatBanReason;
|
||||
}
|
||||
|
||||
public String getChatBanBroadcast() {
|
||||
return chatBanBroadcast;
|
||||
}
|
||||
|
||||
public String getChatWarning() {
|
||||
return chatWarning;
|
||||
}
|
||||
|
||||
private String getString(String entry, String d) {
|
||||
if (file.getString(entry) == null) {
|
||||
file.set(entry, d);
|
||||
return d;
|
||||
} else {
|
||||
return file.getString(entry);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -23,451 +23,431 @@ import org.bukkit.configuration.file.FileConfiguration;
|
||||
/**
|
||||
* Magic number class. Modifications to values in magic.yml will be accepted here.
|
||||
* <p>
|
||||
* Note that although each value is documented, changing it may have unintended side-effects. For instance, setting something to 0 that the plugin then uses as a dividend will result in an error.
|
||||
* <br>
|
||||
* Note that although each value is documented, changing it may have unintended side-effects. For instance, setting something to 0 that the plugin then uses as a dividend will result in an error. <br>
|
||||
* Also realize that the smaller a value is, the less you should change it; it's probably small for a reason. The larger a value is, the safer it is to probably change it.
|
||||
* <p>
|
||||
* <b>How to read the value documentation:</b>
|
||||
* <br>
|
||||
* First, you will see a description of the value. Then, you will see a type:
|
||||
* <br>
|
||||
* <b>Type SYSTEM:</b> This is a 'long' value, measured in milliseconds, used to compare past and future events with the current system time. Remember, 1000 ms = 1 second.
|
||||
* <br>
|
||||
* <b>Type INTEGER:</b> This is a regular number. It's typically used as something trivial, such as how many times X event can occur.
|
||||
* <br>
|
||||
* <b>How to read the value documentation:</b> <br>
|
||||
* First, you will see a description of the value. Then, you will see a type: <br>
|
||||
* <b>Type SYSTEM:</b> This is a 'long' value, measured in milliseconds, used to compare past and future events with the current system time. Remember, 1000 ms = 1 second. <br>
|
||||
* <b>Type INTEGER:</b> This is a regular number. It's typically used as something trivial, such as how many times X event can occur. <br>
|
||||
* <b>Type DOUBLE:</b> This is a number that has a decimal in it. It's typically used to evaluate speed or distance.
|
||||
* <p>
|
||||
* After the type, you may see a recommendation labeled as '+Leniency'. This means 'In order to add leniency to this value, do X'
|
||||
* <br>
|
||||
* After the type, you may see a recommendation labeled as '+Leniency'. This means 'In order to add leniency to this value, do X' <br>
|
||||
* The suggestion for adding leniency will either be to INCREASE or DECREASE the variable. Doing what it suggests will cause the system to not judge the people being checked so vigorously.
|
||||
*/
|
||||
|
||||
public class Magic
|
||||
{
|
||||
/**
|
||||
* Time to exempt a player from moving because of entering/exiting a vehicle; Type=system, +Leniency=Increase.
|
||||
*/
|
||||
public final int ENTERED_EXITED_TIME;
|
||||
/**
|
||||
* Time to exempt a player from moving because of entering/exiting sneak mode; Type=system, +Leniency=Increase.
|
||||
*/
|
||||
public final int SNEAK_TIME;
|
||||
/**
|
||||
* Time to exempt a player from moving because of teleporting; Type=system, +Leniency=Increase.
|
||||
*/
|
||||
public final int TELEPORT_TIME;
|
||||
/**
|
||||
* Time to exempt a player from moving because of exiting fly mode; Type=system, +Leniency=Increase.
|
||||
*/
|
||||
public final int EXIT_FLY_TIME;
|
||||
/**
|
||||
* Time to exempt a player from moving because of joining the server; Type=system, +Leniency=Increase.
|
||||
*/
|
||||
public final int JOIN_TIME;
|
||||
/**
|
||||
* Time to exempt a player from fastbreak check because of using instant break; Type=seconds, +Leniency=Increase.
|
||||
*/
|
||||
public final int INSTANT_BREAK_TIME;
|
||||
/**
|
||||
* Time to exempt a player from moving because of taking damage; Type=system, +Leniency=Increase.
|
||||
*/
|
||||
public final long DAMAGE_TIME;
|
||||
/**
|
||||
* Time to exempt a player from moving because of taking damage with knockback effects; Type=system, +Leniency=Increase.
|
||||
*/
|
||||
public final long KNOCKBACK_DAMAGE_TIME;
|
||||
/**
|
||||
* Time to exempt a player from moving because of taking damage from an explosion; Type=system, +Leniency=Increase.
|
||||
*/
|
||||
public final long EXPLOSION_DAMAGE_TIME;
|
||||
/**
|
||||
* Minimum time it takes to fire X projectiles; Type=system, +Leniency=Decrease.
|
||||
*/
|
||||
public final int PROJECTILE_TIME_MIN;
|
||||
/**
|
||||
* Number of projectiles to wait for before checking how long they took to fire off; Type=integer.
|
||||
*/
|
||||
public final int PROJECTILE_CHECK;
|
||||
/**
|
||||
* Minimum time it takes to drop X items; Type=system, +Leniency=Decrease.
|
||||
*/
|
||||
public final int DROP_TIME_MIN;
|
||||
/**
|
||||
* Number of item drops to wait for before checking how long they took to drop; Type=integer.
|
||||
*/
|
||||
public final int DROP_CHECK;
|
||||
/**
|
||||
* Max number of blocks that can be broken in a given time; Type=integer, +Leniency=Increase.
|
||||
*/
|
||||
public final int FASTBREAK_LIMIT;
|
||||
/**
|
||||
* Time to wait before checking block breaks; Type=system, +Leniency=Increase.
|
||||
*/
|
||||
public final int FASTBREAK_TIMEMAX;
|
||||
/**
|
||||
* Time to wait before checking block breaks in creative mode; Type=system, +Leniency=Increase.
|
||||
*/
|
||||
public final int FASTBREAK_TIMEMAX_CREATIVE;
|
||||
/**
|
||||
* Number of times fastbreak can be observed before taking action; Type=integer, +Leniency=Increase.
|
||||
*/
|
||||
public final int FASTBREAK_MAXVIOLATIONS;
|
||||
/**
|
||||
* Number of times fastbreak can be observed before taking action in creative mode; Type=integer, +Leniency=Increase.
|
||||
*/
|
||||
public final int FASTBREAK_MAXVIOLATIONS_CREATIVE;
|
||||
/**
|
||||
* Time a player is forced to wait after fastbreak has been detected; Type=system, +Leniency=Decrease.
|
||||
*/
|
||||
public final int FASTBREAK_MAXVIOLATIONTIME;
|
||||
/**
|
||||
* Number of blocks that can be broken without being hit before taking action; Type=integer, +Leniency=Increase.
|
||||
*/
|
||||
public final int FASTPLACE_ZEROLIMIT;
|
||||
/**
|
||||
* Time to wait before checking block places; Type=system, +Leniency=Increase.
|
||||
*/
|
||||
public final int FASTPLACE_TIMEMAX;
|
||||
/**
|
||||
* Number of times fastplace can be observed before taking action; Type=integer, +Leniency=Increase.
|
||||
*/
|
||||
public final int FASTPLACE_MAXVIOLATIONS;
|
||||
/**
|
||||
* Number of times fastplace can be observed before taking action in creative mode; Type=integer, +Leniency=Increase.
|
||||
*/
|
||||
public final int FASTPLACE_MAXVIOLATIONS_CREATIVE;
|
||||
/**
|
||||
* Time a player is forced to wait after fastplace has been detected; Type=system, +Leniency=Decrease.
|
||||
*/
|
||||
public final int FASTPLACE_MAXVIOLATIONTIME;
|
||||
/**
|
||||
* Number of times required to punch a block before it breaks; Type=integer, +Leniency=Decrease.
|
||||
*/
|
||||
public final int BLOCK_PUNCH_MIN;
|
||||
/**
|
||||
* Number of chat spam violations before a player is warned; Type=integer, +Leniency=Increase.
|
||||
*/
|
||||
public final int CHAT_WARN_LEVEL;
|
||||
/**
|
||||
* Number of chat spam violations before a player is kicked; Type=integer, +Leniency=Increase.
|
||||
*/
|
||||
public final int CHAT_KICK_LEVEL;
|
||||
/**
|
||||
* Number of kicks for chat violation before a player is banned; Type=integer, +Leniency=Increase.
|
||||
*/
|
||||
public final int CHAT_BAN_LEVEL;
|
||||
/**
|
||||
* Number of times a player can be caught in-flight before action is taken; Type=integer, +Leniency=Increase.
|
||||
*/
|
||||
public final int FLIGHT_LIMIT;
|
||||
/**
|
||||
* How many blocks you can travel before action is taken; Type=integer, +Leniency=Increase.
|
||||
*/
|
||||
public final double FLIGHT_BLOCK_LIMIT;
|
||||
/**
|
||||
* Maximum speed that a player can climb a waterfall; Type=double, +Leniency=Increase.
|
||||
*/
|
||||
public final double WATER_CLIMB_MAX;
|
||||
/**
|
||||
* Number of times a player can fly on the y-axis before action is taken; Type=integer, +Leniency=Increase.
|
||||
*/
|
||||
public final int Y_MAXVIOLATIONS;
|
||||
/**
|
||||
* Time a player is forced to wait after flying on the y-axis; Type=system, +Leniency=Decrease.
|
||||
*/
|
||||
public final int Y_MAXVIOTIME;
|
||||
/**
|
||||
* Number of times a player can fail a velocity check before action is taken; Type=integer, +Leniency=Increase.
|
||||
*/
|
||||
public final int VELOCITY_TIME;
|
||||
/**
|
||||
* Time used to schedule increasing a players velocity count - probably not touching this would be good; Type=integer.
|
||||
*/
|
||||
public final long VELOCITY_SCHETIME;
|
||||
/**
|
||||
* Maximum time a player is considered to have a change in velocity; Type=system, +Leniency=Increase.
|
||||
*/
|
||||
public final long VELOCITY_CHECKTIME;
|
||||
/**
|
||||
* Time to extend a player's velocity count by; Type=system, +Leniency=Increase.
|
||||
*/
|
||||
public final long VELOCITY_PREVENT;
|
||||
/**
|
||||
* Number of times a player can fail the velocity check before action is taken; Type=integer, +Leniency=Increase.
|
||||
*/
|
||||
public final int VELOCITY_MAXTIMES;
|
||||
/**
|
||||
* Number of times a player can fail the nofall check before action is taken; Type=integer, +Leniency=Increase.
|
||||
*/
|
||||
public final int NOFALL_LIMIT;
|
||||
/**
|
||||
* Number of times a player can fail the ascension check before action is taken; Type=integer, +Leniency=Increase.
|
||||
*/
|
||||
public final int ASCENSION_COUNT_MAX;
|
||||
/**
|
||||
* Number of times a player can fail the ascension check while in water before action is taken; Type=integer, +Leniency=Increase.
|
||||
*/
|
||||
public final int WATER_ASCENSION_VIOLATION_MAX;
|
||||
/**
|
||||
* Number of times a player can be caught speeding in water before action is taken; Type=integer, +Leniency=Increase.
|
||||
*/
|
||||
public final int WATER_SPEED_VIOLATION_MAX;
|
||||
/**
|
||||
* Number of times a player can sprint without proper food level before action is taken; Type=integer, +Leniency=Increase.
|
||||
*/
|
||||
public final int SPRINT_FOOD_MIN;
|
||||
/**
|
||||
* Minimum time between animations; Type=system, +Leniency=Increase.
|
||||
*/
|
||||
public final int ANIMATION_MIN;
|
||||
/**
|
||||
* Minimum time between chats; Type=system, +Leniency=Increase.
|
||||
*/
|
||||
public final int CHAT_MIN;
|
||||
/**
|
||||
* Minimum time between repeating yourself in the chat; Type=system, +Leniency=Increase.
|
||||
*/
|
||||
public final int CHAT_REPEAT_MIN;
|
||||
/**
|
||||
* Maximum speed you can travel while sprinting; Type=double, +Leniency=Increase.
|
||||
*/
|
||||
public final double SPRINT_MIN;
|
||||
/**
|
||||
* Minimum time in between block breaks; Type=seconds, +Leniency=Decrease.
|
||||
*/
|
||||
public final double BLOCK_BREAK_MIN;
|
||||
/**
|
||||
* Minimum time in between block placing; Type=seconds, +Leniency=Decrease.
|
||||
*/
|
||||
public final double BLOCK_PLACE_MIN;
|
||||
/**
|
||||
* Minimum time in between healing; Type=system, +Leniency=Decrease.
|
||||
*/
|
||||
public final long HEAL_TIME_MIN;
|
||||
/**
|
||||
* Minimum time in between eating; Type=system, +Leniency=Decrease.
|
||||
*/
|
||||
public final long EAT_TIME_MIN;
|
||||
/**
|
||||
* Maximum percent error between predicted bow force and actual bow force; Type=double, +Leniency=Increase.
|
||||
*/
|
||||
public final double BOW_ERROR;
|
||||
/**
|
||||
* Minimum distance a player can break a block from; Type=double, +Leniency=Increase.
|
||||
*/
|
||||
public final double BLOCK_MAX_DISTANCE;
|
||||
/**
|
||||
* Minimum distance a player can damage an entity from; Type=double, +Leniency=Increase.
|
||||
*/
|
||||
public final double ENTITY_MAX_DISTANCE;
|
||||
/**
|
||||
* Maximum speed a player on a ladder can travel; Type=double, +Leniency=Increase.
|
||||
*/
|
||||
public final double LADDER_Y_MAX;
|
||||
/**
|
||||
* Minimum speed a player on a ladder can travel; Type=double, +Leniency=Decrease.
|
||||
*/
|
||||
public final double LADDER_Y_MIN;
|
||||
/**
|
||||
* Maximum speed a player can travel up; Type=double, +Leniency=Increase.
|
||||
*/
|
||||
public final double Y_SPEED_MAX;
|
||||
/**
|
||||
* Maximum difference between the player's last 2 Y values when traveling up; Type=double, +Leniency=Increase.
|
||||
*/
|
||||
public final double Y_MAXDIFF;
|
||||
/**
|
||||
* Time in between Y difference measures; Type=system, +Leniency=Decrease.
|
||||
*/
|
||||
public final long Y_TIME;
|
||||
/**
|
||||
* Maximum speed a player can travel forwards or backwards; Type=double, +Leniency=Increase.
|
||||
*/
|
||||
public final double XZ_SPEED_MAX;
|
||||
/**
|
||||
* Maximum speed a player can travel forwards or backwards while sprinting; Type=double, +Leniency=Increase.
|
||||
*/
|
||||
public final double XZ_SPEED_MAX_SPRINT;
|
||||
/**
|
||||
* Maximum speed a player can travel forwards or backwards while flying; Type=double, +Leniency=Increase.
|
||||
*/
|
||||
public final double XZ_SPEED_MAX_FLY;
|
||||
/**
|
||||
* Maximum speed a player can travel forwards or backwards while under the influence; Type=double, +Leniency=Increase.
|
||||
*/
|
||||
public final double XZ_SPEED_MAX_POTION;
|
||||
/**
|
||||
* Maximum speed a player can travel forwards or backwards while sneaking; Type=double, +Leniency=Increase.
|
||||
*/
|
||||
public final double XZ_SPEED_MAX_SNEAK;
|
||||
/**
|
||||
* Maximum speed a player can travel forwards or backwards in water; Type=double, +Leniency=Increase.
|
||||
*/
|
||||
public final double XZ_SPEED_MAX_WATER;
|
||||
/**
|
||||
* Maximum speed a player can travel forwards or backwards in water while sprinting; Type=double, +Leniency=Increase.
|
||||
*/
|
||||
public final double XZ_SPEED_MAX_WATER_SPRINT;
|
||||
/**
|
||||
* Maximum speed a player can travel forwards or backwards on soul sand; Type=double, +Leniency=Increase.
|
||||
*/
|
||||
public final double XZ_SPEED_MAX_SOULSAND;
|
||||
/**
|
||||
* Maximum speed a player can travel forwards or backwards on soul sand while sprinting; Type=double, +Leniency=Increase.
|
||||
*/
|
||||
public final double XZ_SPEED_MAX_SOULSAND_SPRINT;
|
||||
/**
|
||||
* Maximum times a player can fail the speed check before action is taken; Type=integer, +Leniency=Increase.
|
||||
*/
|
||||
public final int SPEED_MAX;
|
||||
/**
|
||||
* The number of clicks we should wait before checking if the player has used fast inventory; Type=integer; +Leniency=Increase.
|
||||
*/
|
||||
public final int INVENTORY_CHECK;
|
||||
/**
|
||||
* The minimum time it should have taken for the player to click X times; Type=integer; +Leniency=Increase.
|
||||
*/
|
||||
public final long INVENTORY_TIMEMIN;
|
||||
/**
|
||||
* The number of steps we should wait before checking if the player has used timer cheating; Type=integer; +Leniency=Increase.
|
||||
*/
|
||||
public final int TIMER_STEP_CHECK;
|
||||
/**
|
||||
* The minimum time it should have taken for the player to travel X steps; Type=system; +Leniency=Decrease.
|
||||
*/
|
||||
public final long TIMER_TIMEMIN;
|
||||
|
||||
private FileConfiguration defaults;
|
||||
private FileConfiguration magic;
|
||||
private Configuration config;
|
||||
|
||||
public Magic(FileConfiguration magic, Configuration config, FileConfiguration defaults)
|
||||
{
|
||||
this.magic = magic;
|
||||
this.config = config;
|
||||
this.defaults = defaults;
|
||||
|
||||
//
|
||||
|
||||
ENTERED_EXITED_TIME = getInt("ENTERED_EXITED_TIME");
|
||||
SNEAK_TIME = getInt("SNEAK_TIME");
|
||||
TELEPORT_TIME = getInt("TELEPORT_TIME");
|
||||
EXIT_FLY_TIME = getInt("EXIT_FLY_TIME");
|
||||
JOIN_TIME = getInt("JOIN_TIME");
|
||||
INSTANT_BREAK_TIME = getInt("INSTANT_BREAK_TIME");
|
||||
DAMAGE_TIME = getLong("DAMAGE_TIME");
|
||||
KNOCKBACK_DAMAGE_TIME = getLong("KNOCKBACK_DAMAGE_TIME");
|
||||
EXPLOSION_DAMAGE_TIME = getLong("EXPLOSION_DAMAGE_TIME");
|
||||
PROJECTILE_TIME_MIN = getInt("PROJECTILE_TIME_MIN");
|
||||
PROJECTILE_CHECK = getInt("PROJECTILE_CHECK");
|
||||
DROP_TIME_MIN = getInt("DROP_TIME_MIN");
|
||||
DROP_CHECK = getInt("DROP_CHECK");
|
||||
FASTBREAK_LIMIT = getInt("FASTBREAK_LIMIT");
|
||||
FASTBREAK_TIMEMAX = getInt("FASTBREAK_TIMEMAX");
|
||||
FASTBREAK_TIMEMAX_CREATIVE = getInt("FASTBREAK_TIMEMAX_CREATIVE");
|
||||
FASTBREAK_MAXVIOLATIONS = getInt("FASTBREAK_MAXVIOLATIONS");
|
||||
FASTBREAK_MAXVIOLATIONS_CREATIVE = getInt("FASTBREAK_MAXVIOLATIONS_CREATIVE");
|
||||
FASTBREAK_MAXVIOLATIONTIME = getInt("FASTBREAK_MAXVIOLATIONTIME");
|
||||
FASTPLACE_ZEROLIMIT = getInt("FASTPLACE_ZEROLIMIT");
|
||||
FASTPLACE_TIMEMAX = getInt("FASTPLACE_TIMEMAX");
|
||||
FASTPLACE_MAXVIOLATIONS = getInt("FASTPLACE_MAXVIOLATIONS");
|
||||
FASTPLACE_MAXVIOLATIONS_CREATIVE = getInt("FASTPLACE_MAXVIOLATIONS_CREATIVE");
|
||||
FASTPLACE_MAXVIOLATIONTIME = getInt("FASTPLACE_MAXVIOLATIONTIME");
|
||||
BLOCK_PUNCH_MIN = getInt("BLOCK_PUNCH_MIN");
|
||||
CHAT_WARN_LEVEL = getInt("CHAT_WARN_LEVEL");
|
||||
CHAT_KICK_LEVEL = getInt("CHAT_KICK_LEVEL");
|
||||
CHAT_BAN_LEVEL = getInt("CHAT_BAN_LEVEL");
|
||||
FLIGHT_LIMIT = getInt("FLIGHT_LIMIT");
|
||||
FLIGHT_BLOCK_LIMIT = getDouble("FLIGHT_BLOCK_LIMIT");
|
||||
WATER_CLIMB_MAX = getDouble("WATER_CLIMB_MAX");
|
||||
Y_MAXVIOLATIONS = getInt("Y_MAXVIOLATIONS");
|
||||
Y_MAXVIOTIME = getInt("Y_MAXVIOTIME");
|
||||
VELOCITY_TIME = getInt("VELOCITY_TIME");
|
||||
VELOCITY_SCHETIME = getLong("VELOCITY_SCHETIME");
|
||||
VELOCITY_CHECKTIME = getLong("VELOCITY_CHECKTIME");
|
||||
VELOCITY_PREVENT = getLong("VELOCITY_PREVENT");
|
||||
VELOCITY_MAXTIMES = getInt("VELOCITY_MAXTIMES");
|
||||
NOFALL_LIMIT = getInt("NOFALL_LIMIT");
|
||||
ASCENSION_COUNT_MAX = getInt("ASCENSION_COUNT_MAX");
|
||||
WATER_ASCENSION_VIOLATION_MAX = getInt("WATER_ASCENSION_VIOLATION_MAX");
|
||||
WATER_SPEED_VIOLATION_MAX = getInt("WATER_SPEED_VIOLATION_MAX");
|
||||
SPRINT_FOOD_MIN = getInt("SPRINT_FOOD_MIN");
|
||||
ANIMATION_MIN = getInt("ANIMATION_MIN");
|
||||
CHAT_MIN = getInt("CHAT_MIN");
|
||||
CHAT_REPEAT_MIN = getInt("CHAT_REPEAT_MIN");
|
||||
SPRINT_MIN = getDouble("SPRINT_MIN");
|
||||
BLOCK_BREAK_MIN = getDouble("BLOCK_BREAK_MIN");
|
||||
BLOCK_PLACE_MIN = getDouble("BLOCK_PLACE_MIN");
|
||||
HEAL_TIME_MIN = getLong("HEAL_TIME_MIN");
|
||||
EAT_TIME_MIN = getLong("EAT_TIME_MIN");
|
||||
BOW_ERROR = getDouble("BOW_ERROR");
|
||||
BLOCK_MAX_DISTANCE = getDouble("BLOCK_MAX_DISTANCE");
|
||||
ENTITY_MAX_DISTANCE = getDouble("ENTITY_MAX_DISTANCE");
|
||||
LADDER_Y_MAX = getDouble("LADDER_Y_MAX");
|
||||
LADDER_Y_MIN = getDouble("LADDER_Y_MIN");
|
||||
Y_SPEED_MAX = getDouble("Y_SPEED_MAX");
|
||||
Y_MAXDIFF = getDouble("Y_MAXDIFF");
|
||||
Y_TIME = getLong("Y_TIME");
|
||||
XZ_SPEED_MAX = getDouble("XZ_SPEED_MAX");
|
||||
XZ_SPEED_MAX_SPRINT = getDouble("XZ_SPEED_MAX_SPRINT");
|
||||
XZ_SPEED_MAX_FLY = getDouble("XZ_SPEED_MAX_FLY");
|
||||
XZ_SPEED_MAX_POTION = getDouble("XZ_SPEED_MAX_POTION");
|
||||
XZ_SPEED_MAX_SNEAK = getDouble("XZ_SPEED_MAX_SNEAK");
|
||||
XZ_SPEED_MAX_WATER = getDouble("XZ_SPEED_MAX_WATER");
|
||||
XZ_SPEED_MAX_SOULSAND = getDouble("XZ_SPEED_MAX_SOULSAND");
|
||||
XZ_SPEED_MAX_SOULSAND_SPRINT = getDouble("XZ_SPEED_MAX_SOULSAND_SPRINT");
|
||||
XZ_SPEED_MAX_WATER_SPRINT = getDouble("XZ_SPEED_MAX_WATER_SPRINT");
|
||||
SPEED_MAX = getInt("SPEED_MAX");
|
||||
INVENTORY_CHECK = getInt("INVENTORY_CHECK");
|
||||
INVENTORY_TIMEMIN = getInt("INVENTORY_TIMEMIN");
|
||||
TIMER_STEP_CHECK = getInt("TIMER_STEP_CHECK");
|
||||
TIMER_TIMEMIN = getLong("TIMER_TIMEMIN");
|
||||
}
|
||||
|
||||
private int getInt(String path)
|
||||
{
|
||||
if(magic.contains(path))
|
||||
{
|
||||
return magic.getInt(path);
|
||||
}
|
||||
else
|
||||
{
|
||||
int i = defaults.getInt(path);
|
||||
magic.set(path, i);
|
||||
config.saveMagic(magic);
|
||||
return i;
|
||||
}
|
||||
}
|
||||
|
||||
private double getDouble(String path)
|
||||
{
|
||||
if(magic.contains(path))
|
||||
{
|
||||
return magic.getDouble(path);
|
||||
}
|
||||
else
|
||||
{
|
||||
double i = defaults.getDouble(path);
|
||||
magic.set(path, i);
|
||||
config.saveMagic(magic);
|
||||
return i;
|
||||
}
|
||||
}
|
||||
|
||||
private long getLong(String path)
|
||||
{
|
||||
if(magic.contains(path))
|
||||
{
|
||||
return magic.getLong(path);
|
||||
}
|
||||
else
|
||||
{
|
||||
long i = defaults.getLong(path);
|
||||
magic.set(path, i);
|
||||
config.saveMagic(magic);
|
||||
return i;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public class Magic {
|
||||
/**
|
||||
* Time to exempt a player from moving because of entering/exiting a vehicle; Type=system, +Leniency=Increase.
|
||||
*/
|
||||
public final int ENTERED_EXITED_TIME;
|
||||
/**
|
||||
* Time to exempt a player from moving because of entering/exiting sneak mode; Type=system, +Leniency=Increase.
|
||||
*/
|
||||
public final int SNEAK_TIME;
|
||||
/**
|
||||
* Time to exempt a player from moving because of teleporting; Type=system, +Leniency=Increase.
|
||||
*/
|
||||
public final int TELEPORT_TIME;
|
||||
/**
|
||||
* Time to exempt a player from moving because of exiting fly mode; Type=system, +Leniency=Increase.
|
||||
*/
|
||||
public final int EXIT_FLY_TIME;
|
||||
/**
|
||||
* Time to exempt a player from moving because of joining the server; Type=system, +Leniency=Increase.
|
||||
*/
|
||||
public final int JOIN_TIME;
|
||||
/**
|
||||
* Time to exempt a player from fastbreak check because of using instant break; Type=seconds, +Leniency=Increase.
|
||||
*/
|
||||
public final int INSTANT_BREAK_TIME;
|
||||
/**
|
||||
* Time to exempt a player from moving because of taking damage; Type=system, +Leniency=Increase.
|
||||
*/
|
||||
public final long DAMAGE_TIME;
|
||||
/**
|
||||
* Time to exempt a player from moving because of taking damage with knockback effects; Type=system, +Leniency=Increase.
|
||||
*/
|
||||
public final long KNOCKBACK_DAMAGE_TIME;
|
||||
/**
|
||||
* Time to exempt a player from moving because of taking damage from an explosion; Type=system, +Leniency=Increase.
|
||||
*/
|
||||
public final long EXPLOSION_DAMAGE_TIME;
|
||||
/**
|
||||
* Minimum time it takes to fire X projectiles; Type=system, +Leniency=Decrease.
|
||||
*/
|
||||
public final int PROJECTILE_TIME_MIN;
|
||||
/**
|
||||
* Number of projectiles to wait for before checking how long they took to fire off; Type=integer.
|
||||
*/
|
||||
public final int PROJECTILE_CHECK;
|
||||
/**
|
||||
* Minimum time it takes to drop X items; Type=system, +Leniency=Decrease.
|
||||
*/
|
||||
public final int DROP_TIME_MIN;
|
||||
/**
|
||||
* Number of item drops to wait for before checking how long they took to drop; Type=integer.
|
||||
*/
|
||||
public final int DROP_CHECK;
|
||||
/**
|
||||
* Max number of blocks that can be broken in a given time; Type=integer, +Leniency=Increase.
|
||||
*/
|
||||
public final int FASTBREAK_LIMIT;
|
||||
/**
|
||||
* Time to wait before checking block breaks; Type=system, +Leniency=Increase.
|
||||
*/
|
||||
public final int FASTBREAK_TIMEMAX;
|
||||
/**
|
||||
* Time to wait before checking block breaks in creative mode; Type=system, +Leniency=Increase.
|
||||
*/
|
||||
public final int FASTBREAK_TIMEMAX_CREATIVE;
|
||||
/**
|
||||
* Number of times fastbreak can be observed before taking action; Type=integer, +Leniency=Increase.
|
||||
*/
|
||||
public final int FASTBREAK_MAXVIOLATIONS;
|
||||
/**
|
||||
* Number of times fastbreak can be observed before taking action in creative mode; Type=integer, +Leniency=Increase.
|
||||
*/
|
||||
public final int FASTBREAK_MAXVIOLATIONS_CREATIVE;
|
||||
/**
|
||||
* Time a player is forced to wait after fastbreak has been detected; Type=system, +Leniency=Decrease.
|
||||
*/
|
||||
public final int FASTBREAK_MAXVIOLATIONTIME;
|
||||
/**
|
||||
* Number of blocks that can be broken without being hit before taking action; Type=integer, +Leniency=Increase.
|
||||
*/
|
||||
public final int FASTPLACE_ZEROLIMIT;
|
||||
/**
|
||||
* Time to wait before checking block places; Type=system, +Leniency=Increase.
|
||||
*/
|
||||
public final int FASTPLACE_TIMEMAX;
|
||||
/**
|
||||
* Number of times fastplace can be observed before taking action; Type=integer, +Leniency=Increase.
|
||||
*/
|
||||
public final int FASTPLACE_MAXVIOLATIONS;
|
||||
/**
|
||||
* Number of times fastplace can be observed before taking action in creative mode; Type=integer, +Leniency=Increase.
|
||||
*/
|
||||
public final int FASTPLACE_MAXVIOLATIONS_CREATIVE;
|
||||
/**
|
||||
* Time a player is forced to wait after fastplace has been detected; Type=system, +Leniency=Decrease.
|
||||
*/
|
||||
public final int FASTPLACE_MAXVIOLATIONTIME;
|
||||
/**
|
||||
* Number of times required to punch a block before it breaks; Type=integer, +Leniency=Decrease.
|
||||
*/
|
||||
public final int BLOCK_PUNCH_MIN;
|
||||
/**
|
||||
* Number of chat spam violations before a player is warned; Type=integer, +Leniency=Increase.
|
||||
*/
|
||||
public final int CHAT_WARN_LEVEL;
|
||||
/**
|
||||
* Number of chat spam violations before a player is kicked; Type=integer, +Leniency=Increase.
|
||||
*/
|
||||
public final int CHAT_KICK_LEVEL;
|
||||
/**
|
||||
* Number of kicks for chat violation before a player is banned; Type=integer, +Leniency=Increase.
|
||||
*/
|
||||
public final int CHAT_BAN_LEVEL;
|
||||
/**
|
||||
* Number of times a player can be caught in-flight before action is taken; Type=integer, +Leniency=Increase.
|
||||
*/
|
||||
public final int FLIGHT_LIMIT;
|
||||
/**
|
||||
* How many blocks you can travel before action is taken; Type=integer, +Leniency=Increase.
|
||||
*/
|
||||
public final double FLIGHT_BLOCK_LIMIT;
|
||||
/**
|
||||
* Maximum speed that a player can climb a waterfall; Type=double, +Leniency=Increase.
|
||||
*/
|
||||
public final double WATER_CLIMB_MAX;
|
||||
/**
|
||||
* Number of times a player can fly on the y-axis before action is taken; Type=integer, +Leniency=Increase.
|
||||
*/
|
||||
public final int Y_MAXVIOLATIONS;
|
||||
/**
|
||||
* Time a player is forced to wait after flying on the y-axis; Type=system, +Leniency=Decrease.
|
||||
*/
|
||||
public final int Y_MAXVIOTIME;
|
||||
/**
|
||||
* Number of times a player can fail a velocity check before action is taken; Type=integer, +Leniency=Increase.
|
||||
*/
|
||||
public final int VELOCITY_TIME;
|
||||
/**
|
||||
* Time used to schedule increasing a players velocity count - probably not touching this would be good; Type=integer.
|
||||
*/
|
||||
public final long VELOCITY_SCHETIME;
|
||||
/**
|
||||
* Maximum time a player is considered to have a change in velocity; Type=system, +Leniency=Increase.
|
||||
*/
|
||||
public final long VELOCITY_CHECKTIME;
|
||||
/**
|
||||
* Time to extend a player's velocity count by; Type=system, +Leniency=Increase.
|
||||
*/
|
||||
public final long VELOCITY_PREVENT;
|
||||
/**
|
||||
* Number of times a player can fail the velocity check before action is taken; Type=integer, +Leniency=Increase.
|
||||
*/
|
||||
public final int VELOCITY_MAXTIMES;
|
||||
/**
|
||||
* Number of times a player can fail the nofall check before action is taken; Type=integer, +Leniency=Increase.
|
||||
*/
|
||||
public final int NOFALL_LIMIT;
|
||||
/**
|
||||
* Number of times a player can fail the ascension check before action is taken; Type=integer, +Leniency=Increase.
|
||||
*/
|
||||
public final int ASCENSION_COUNT_MAX;
|
||||
/**
|
||||
* Number of times a player can fail the ascension check while in water before action is taken; Type=integer, +Leniency=Increase.
|
||||
*/
|
||||
public final int WATER_ASCENSION_VIOLATION_MAX;
|
||||
/**
|
||||
* Number of times a player can be caught speeding in water before action is taken; Type=integer, +Leniency=Increase.
|
||||
*/
|
||||
public final int WATER_SPEED_VIOLATION_MAX;
|
||||
/**
|
||||
* Number of times a player can sprint without proper food level before action is taken; Type=integer, +Leniency=Increase.
|
||||
*/
|
||||
public final int SPRINT_FOOD_MIN;
|
||||
/**
|
||||
* Minimum time between animations; Type=system, +Leniency=Increase.
|
||||
*/
|
||||
public final int ANIMATION_MIN;
|
||||
/**
|
||||
* Minimum time between chats; Type=system, +Leniency=Increase.
|
||||
*/
|
||||
public final int CHAT_MIN;
|
||||
/**
|
||||
* Minimum time between repeating yourself in the chat; Type=system, +Leniency=Increase.
|
||||
*/
|
||||
public final int CHAT_REPEAT_MIN;
|
||||
/**
|
||||
* Maximum speed you can travel while sprinting; Type=double, +Leniency=Increase.
|
||||
*/
|
||||
public final double SPRINT_MIN;
|
||||
/**
|
||||
* Minimum time in between block breaks; Type=seconds, +Leniency=Decrease.
|
||||
*/
|
||||
public final double BLOCK_BREAK_MIN;
|
||||
/**
|
||||
* Minimum time in between block placing; Type=seconds, +Leniency=Decrease.
|
||||
*/
|
||||
public final double BLOCK_PLACE_MIN;
|
||||
/**
|
||||
* Minimum time in between healing; Type=system, +Leniency=Decrease.
|
||||
*/
|
||||
public final long HEAL_TIME_MIN;
|
||||
/**
|
||||
* Minimum time in between eating; Type=system, +Leniency=Decrease.
|
||||
*/
|
||||
public final long EAT_TIME_MIN;
|
||||
/**
|
||||
* Maximum percent error between predicted bow force and actual bow force; Type=double, +Leniency=Increase.
|
||||
*/
|
||||
public final double BOW_ERROR;
|
||||
/**
|
||||
* Minimum distance a player can break a block from; Type=double, +Leniency=Increase.
|
||||
*/
|
||||
public final double BLOCK_MAX_DISTANCE;
|
||||
/**
|
||||
* Minimum distance a player can damage an entity from; Type=double, +Leniency=Increase.
|
||||
*/
|
||||
public final double ENTITY_MAX_DISTANCE;
|
||||
/**
|
||||
* Maximum speed a player on a ladder can travel; Type=double, +Leniency=Increase.
|
||||
*/
|
||||
public final double LADDER_Y_MAX;
|
||||
/**
|
||||
* Minimum speed a player on a ladder can travel; Type=double, +Leniency=Decrease.
|
||||
*/
|
||||
public final double LADDER_Y_MIN;
|
||||
/**
|
||||
* Maximum speed a player can travel up; Type=double, +Leniency=Increase.
|
||||
*/
|
||||
public final double Y_SPEED_MAX;
|
||||
/**
|
||||
* Maximum difference between the player's last 2 Y values when traveling up; Type=double, +Leniency=Increase.
|
||||
*/
|
||||
public final double Y_MAXDIFF;
|
||||
/**
|
||||
* Time in between Y difference measures; Type=system, +Leniency=Decrease.
|
||||
*/
|
||||
public final long Y_TIME;
|
||||
/**
|
||||
* Maximum speed a player can travel forwards or backwards; Type=double, +Leniency=Increase.
|
||||
*/
|
||||
public final double XZ_SPEED_MAX;
|
||||
/**
|
||||
* Maximum speed a player can travel forwards or backwards while sprinting; Type=double, +Leniency=Increase.
|
||||
*/
|
||||
public final double XZ_SPEED_MAX_SPRINT;
|
||||
/**
|
||||
* Maximum speed a player can travel forwards or backwards while flying; Type=double, +Leniency=Increase.
|
||||
*/
|
||||
public final double XZ_SPEED_MAX_FLY;
|
||||
/**
|
||||
* Maximum speed a player can travel forwards or backwards while under the influence; Type=double, +Leniency=Increase.
|
||||
*/
|
||||
public final double XZ_SPEED_MAX_POTION;
|
||||
/**
|
||||
* Maximum speed a player can travel forwards or backwards while sneaking; Type=double, +Leniency=Increase.
|
||||
*/
|
||||
public final double XZ_SPEED_MAX_SNEAK;
|
||||
/**
|
||||
* Maximum speed a player can travel forwards or backwards in water; Type=double, +Leniency=Increase.
|
||||
*/
|
||||
public final double XZ_SPEED_MAX_WATER;
|
||||
/**
|
||||
* Maximum speed a player can travel forwards or backwards in water while sprinting; Type=double, +Leniency=Increase.
|
||||
*/
|
||||
public final double XZ_SPEED_MAX_WATER_SPRINT;
|
||||
/**
|
||||
* Maximum speed a player can travel forwards or backwards on soul sand; Type=double, +Leniency=Increase.
|
||||
*/
|
||||
public final double XZ_SPEED_MAX_SOULSAND;
|
||||
/**
|
||||
* Maximum speed a player can travel forwards or backwards on soul sand while sprinting; Type=double, +Leniency=Increase.
|
||||
*/
|
||||
public final double XZ_SPEED_MAX_SOULSAND_SPRINT;
|
||||
/**
|
||||
* Maximum times a player can fail the speed check before action is taken; Type=integer, +Leniency=Increase.
|
||||
*/
|
||||
public final int SPEED_MAX;
|
||||
/**
|
||||
* The number of clicks we should wait before checking if the player has used fast inventory; Type=integer; +Leniency=Increase.
|
||||
*/
|
||||
public final int INVENTORY_CHECK;
|
||||
/**
|
||||
* The minimum time it should have taken for the player to click X times; Type=integer; +Leniency=Increase.
|
||||
*/
|
||||
public final long INVENTORY_TIMEMIN;
|
||||
/**
|
||||
* The number of steps we should wait before checking if the player has used timer cheating; Type=integer; +Leniency=Increase.
|
||||
*/
|
||||
public final int TIMER_STEP_CHECK;
|
||||
/**
|
||||
* The minimum time it should have taken for the player to travel X steps; Type=system; +Leniency=Decrease.
|
||||
*/
|
||||
public final long TIMER_TIMEMIN;
|
||||
|
||||
private FileConfiguration defaults;
|
||||
private FileConfiguration magic;
|
||||
private Configuration config;
|
||||
|
||||
public Magic(FileConfiguration magic, Configuration config, FileConfiguration defaults) {
|
||||
this.magic = magic;
|
||||
this.config = config;
|
||||
this.defaults = defaults;
|
||||
|
||||
//
|
||||
|
||||
ENTERED_EXITED_TIME = getInt("ENTERED_EXITED_TIME");
|
||||
SNEAK_TIME = getInt("SNEAK_TIME");
|
||||
TELEPORT_TIME = getInt("TELEPORT_TIME");
|
||||
EXIT_FLY_TIME = getInt("EXIT_FLY_TIME");
|
||||
JOIN_TIME = getInt("JOIN_TIME");
|
||||
INSTANT_BREAK_TIME = getInt("INSTANT_BREAK_TIME");
|
||||
DAMAGE_TIME = getLong("DAMAGE_TIME");
|
||||
KNOCKBACK_DAMAGE_TIME = getLong("KNOCKBACK_DAMAGE_TIME");
|
||||
EXPLOSION_DAMAGE_TIME = getLong("EXPLOSION_DAMAGE_TIME");
|
||||
PROJECTILE_TIME_MIN = getInt("PROJECTILE_TIME_MIN");
|
||||
PROJECTILE_CHECK = getInt("PROJECTILE_CHECK");
|
||||
DROP_TIME_MIN = getInt("DROP_TIME_MIN");
|
||||
DROP_CHECK = getInt("DROP_CHECK");
|
||||
FASTBREAK_LIMIT = getInt("FASTBREAK_LIMIT");
|
||||
FASTBREAK_TIMEMAX = getInt("FASTBREAK_TIMEMAX");
|
||||
FASTBREAK_TIMEMAX_CREATIVE = getInt("FASTBREAK_TIMEMAX_CREATIVE");
|
||||
FASTBREAK_MAXVIOLATIONS = getInt("FASTBREAK_MAXVIOLATIONS");
|
||||
FASTBREAK_MAXVIOLATIONS_CREATIVE = getInt("FASTBREAK_MAXVIOLATIONS_CREATIVE");
|
||||
FASTBREAK_MAXVIOLATIONTIME = getInt("FASTBREAK_MAXVIOLATIONTIME");
|
||||
FASTPLACE_ZEROLIMIT = getInt("FASTPLACE_ZEROLIMIT");
|
||||
FASTPLACE_TIMEMAX = getInt("FASTPLACE_TIMEMAX");
|
||||
FASTPLACE_MAXVIOLATIONS = getInt("FASTPLACE_MAXVIOLATIONS");
|
||||
FASTPLACE_MAXVIOLATIONS_CREATIVE = getInt("FASTPLACE_MAXVIOLATIONS_CREATIVE");
|
||||
FASTPLACE_MAXVIOLATIONTIME = getInt("FASTPLACE_MAXVIOLATIONTIME");
|
||||
BLOCK_PUNCH_MIN = getInt("BLOCK_PUNCH_MIN");
|
||||
CHAT_WARN_LEVEL = getInt("CHAT_WARN_LEVEL");
|
||||
CHAT_KICK_LEVEL = getInt("CHAT_KICK_LEVEL");
|
||||
CHAT_BAN_LEVEL = getInt("CHAT_BAN_LEVEL");
|
||||
FLIGHT_LIMIT = getInt("FLIGHT_LIMIT");
|
||||
FLIGHT_BLOCK_LIMIT = getDouble("FLIGHT_BLOCK_LIMIT");
|
||||
WATER_CLIMB_MAX = getDouble("WATER_CLIMB_MAX");
|
||||
Y_MAXVIOLATIONS = getInt("Y_MAXVIOLATIONS");
|
||||
Y_MAXVIOTIME = getInt("Y_MAXVIOTIME");
|
||||
VELOCITY_TIME = getInt("VELOCITY_TIME");
|
||||
VELOCITY_SCHETIME = getLong("VELOCITY_SCHETIME");
|
||||
VELOCITY_CHECKTIME = getLong("VELOCITY_CHECKTIME");
|
||||
VELOCITY_PREVENT = getLong("VELOCITY_PREVENT");
|
||||
VELOCITY_MAXTIMES = getInt("VELOCITY_MAXTIMES");
|
||||
NOFALL_LIMIT = getInt("NOFALL_LIMIT");
|
||||
ASCENSION_COUNT_MAX = getInt("ASCENSION_COUNT_MAX");
|
||||
WATER_ASCENSION_VIOLATION_MAX = getInt("WATER_ASCENSION_VIOLATION_MAX");
|
||||
WATER_SPEED_VIOLATION_MAX = getInt("WATER_SPEED_VIOLATION_MAX");
|
||||
SPRINT_FOOD_MIN = getInt("SPRINT_FOOD_MIN");
|
||||
ANIMATION_MIN = getInt("ANIMATION_MIN");
|
||||
CHAT_MIN = getInt("CHAT_MIN");
|
||||
CHAT_REPEAT_MIN = getInt("CHAT_REPEAT_MIN");
|
||||
SPRINT_MIN = getDouble("SPRINT_MIN");
|
||||
BLOCK_BREAK_MIN = getDouble("BLOCK_BREAK_MIN");
|
||||
BLOCK_PLACE_MIN = getDouble("BLOCK_PLACE_MIN");
|
||||
HEAL_TIME_MIN = getLong("HEAL_TIME_MIN");
|
||||
EAT_TIME_MIN = getLong("EAT_TIME_MIN");
|
||||
BOW_ERROR = getDouble("BOW_ERROR");
|
||||
BLOCK_MAX_DISTANCE = getDouble("BLOCK_MAX_DISTANCE");
|
||||
ENTITY_MAX_DISTANCE = getDouble("ENTITY_MAX_DISTANCE");
|
||||
LADDER_Y_MAX = getDouble("LADDER_Y_MAX");
|
||||
LADDER_Y_MIN = getDouble("LADDER_Y_MIN");
|
||||
Y_SPEED_MAX = getDouble("Y_SPEED_MAX");
|
||||
Y_MAXDIFF = getDouble("Y_MAXDIFF");
|
||||
Y_TIME = getLong("Y_TIME");
|
||||
XZ_SPEED_MAX = getDouble("XZ_SPEED_MAX");
|
||||
XZ_SPEED_MAX_SPRINT = getDouble("XZ_SPEED_MAX_SPRINT");
|
||||
XZ_SPEED_MAX_FLY = getDouble("XZ_SPEED_MAX_FLY");
|
||||
XZ_SPEED_MAX_POTION = getDouble("XZ_SPEED_MAX_POTION");
|
||||
XZ_SPEED_MAX_SNEAK = getDouble("XZ_SPEED_MAX_SNEAK");
|
||||
XZ_SPEED_MAX_WATER = getDouble("XZ_SPEED_MAX_WATER");
|
||||
XZ_SPEED_MAX_SOULSAND = getDouble("XZ_SPEED_MAX_SOULSAND");
|
||||
XZ_SPEED_MAX_SOULSAND_SPRINT = getDouble("XZ_SPEED_MAX_SOULSAND_SPRINT");
|
||||
XZ_SPEED_MAX_WATER_SPRINT = getDouble("XZ_SPEED_MAX_WATER_SPRINT");
|
||||
SPEED_MAX = getInt("SPEED_MAX");
|
||||
INVENTORY_CHECK = getInt("INVENTORY_CHECK");
|
||||
INVENTORY_TIMEMIN = getInt("INVENTORY_TIMEMIN");
|
||||
TIMER_STEP_CHECK = getInt("TIMER_STEP_CHECK");
|
||||
TIMER_TIMEMIN = getLong("TIMER_TIMEMIN");
|
||||
}
|
||||
|
||||
private int getInt(String path) {
|
||||
if (magic.contains(path)) {
|
||||
return magic.getInt(path);
|
||||
} else {
|
||||
int i = defaults.getInt(path);
|
||||
magic.set(path, i);
|
||||
config.saveMagic(magic);
|
||||
return i;
|
||||
}
|
||||
}
|
||||
|
||||
private double getDouble(String path) {
|
||||
if (magic.contains(path)) {
|
||||
return magic.getDouble(path);
|
||||
} else {
|
||||
double i = defaults.getDouble(path);
|
||||
magic.set(path, i);
|
||||
config.saveMagic(magic);
|
||||
return i;
|
||||
}
|
||||
}
|
||||
|
||||
private long getLong(String path) {
|
||||
if (magic.contains(path)) {
|
||||
return magic.getLong(path);
|
||||
} else {
|
||||
long i = defaults.getLong(path);
|
||||
magic.set(path, i);
|
||||
config.saveMagic(magic);
|
||||
return i;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -30,145 +30,115 @@ import org.bukkit.ChatColor;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
public class PastebinReport
|
||||
{
|
||||
private StringBuilder report = new StringBuilder();
|
||||
private String url = "";
|
||||
private Date date = new Date();
|
||||
private SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd kk:mm Z");
|
||||
|
||||
public PastebinReport(CommandSender cs)
|
||||
{
|
||||
Player player = null;
|
||||
try
|
||||
{
|
||||
player = (Player) cs;
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
cs.sendMessage(ChatColor.RED + "We were unable to detect a player when making this report. Skipping permstester");
|
||||
}
|
||||
|
||||
createReport(player);
|
||||
try
|
||||
{
|
||||
writeReport();
|
||||
}
|
||||
catch (IOException e)
|
||||
{
|
||||
}
|
||||
postReport();
|
||||
}
|
||||
|
||||
public String getURL()
|
||||
{
|
||||
return url;
|
||||
}
|
||||
|
||||
private void appendPermissionsTester(Player player)
|
||||
{
|
||||
if (player == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// alrighty then noobs.
|
||||
for(Permission node : Permission.values())
|
||||
{
|
||||
report.append(player.getName() + ": " + node.toString() + " " + node.get(player) + '\n');
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void createReport(Player player)
|
||||
{
|
||||
report.append("------------ AntiCheat Report - " + format.format(date) + " ------------" + '\n');
|
||||
report.append("Version: " + Anticheat.getVersion() + '\n');
|
||||
report.append("CraftBukkit: " + Bukkit.getVersion() + '\n');
|
||||
report.append("Plugin Count: " + Bukkit.getPluginManager().getPlugins().length + '\n');
|
||||
appendSystemInfo();
|
||||
report.append("------------Last 30 logs------------" + '\n');
|
||||
for (String log : Anticheat.getManager().getLastLogs())
|
||||
{
|
||||
report.append("[AntiCheat] " + log + '\n');
|
||||
}
|
||||
report.append("------------Permission Tester------------" + '\n');
|
||||
appendPermissionsTester(player);
|
||||
report.append("-----------End Of Report------------");
|
||||
}
|
||||
|
||||
private void appendSystemInfo()
|
||||
{
|
||||
Runtime runtime = Runtime.getRuntime();
|
||||
report.append("Java: " + System.getProperty("java.vendor") + " " + System.getProperty("java.version") + '\n');
|
||||
report.append("OS: " + System.getProperty("os.name") + " " + System.getProperty("os.version") + '\n');
|
||||
report.append("Free Memory: " + runtime.freeMemory() / 1024 / 1024 + "MB" + '\n');
|
||||
report.append("Max Memory: " + runtime.maxMemory() / 1024 / 1024 + "MB" + '\n');
|
||||
report.append("Total Memory: " + runtime.totalMemory() / 1024 / 1024 + "MB" + '\n');
|
||||
report.append("Server ID + Name: " + Bukkit.getServerId() + " - " + Bukkit.getName() + '\n');
|
||||
report.append("Players: " + Bukkit.getOnlinePlayers().length + "/" + Bukkit.getMaxPlayers() + '\n');
|
||||
}
|
||||
|
||||
private void writeReport() throws IOException
|
||||
{
|
||||
File f = new File(Anticheat.getPlugin().getDataFolder() + "/report.txt");
|
||||
FileWriter r = new FileWriter(f);
|
||||
BufferedWriter writer = new BufferedWriter(r);
|
||||
writer.write(report.toString());
|
||||
writer.close();
|
||||
}
|
||||
|
||||
private void postReport()
|
||||
{
|
||||
try
|
||||
{
|
||||
URL urls = new URL("http://pastebin.com/api/api_post.php");
|
||||
HttpURLConnection conn = (HttpURLConnection) urls.openConnection();
|
||||
conn.setConnectTimeout(5000);
|
||||
conn.setReadTimeout(5000);
|
||||
conn.setRequestMethod("POST");
|
||||
conn.addRequestProperty("Content-type", "application/x-www-form-urlencoded");
|
||||
conn.setInstanceFollowRedirects(false);
|
||||
conn.setDoOutput(true);
|
||||
OutputStream out = conn.getOutputStream();
|
||||
|
||||
out.write(("api_option=paste" + "&api_dev_key=" + URLEncoder.encode("c0616def494dcb5b7632304f8c52c0f1", "utf-8") + "&api_paste_code=" + URLEncoder.encode(report.toString(), "utf-8") + "&api_paste_private=" + URLEncoder.encode("1", "utf-8") + "&api_paste_name=" + URLEncoder.encode("", "utf-8") + "&api_paste_expire_date=" + URLEncoder.encode("1M", "utf-8") + "&api_paste_format=" + URLEncoder.encode("text", "utf-8") + "&api_user_key=" + URLEncoder.encode("", "utf-8")).getBytes());
|
||||
out.flush();
|
||||
out.close();
|
||||
|
||||
if (conn.getResponseCode() == 200)
|
||||
{
|
||||
InputStream receive = conn.getInputStream();
|
||||
BufferedReader reader = new BufferedReader(new InputStreamReader(receive));
|
||||
String line;
|
||||
StringBuffer response = new StringBuffer();
|
||||
while ((line = reader.readLine()) != null)
|
||||
{
|
||||
response.append(line);
|
||||
response.append("\r\n");
|
||||
}
|
||||
reader.close();
|
||||
|
||||
String result = response.toString().trim();
|
||||
|
||||
if (!result.contains("http://"))
|
||||
{
|
||||
url = "Failed to post. Check report.txt";
|
||||
}
|
||||
else
|
||||
{
|
||||
url = result.trim();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
url = "Failed to post. Check report.txt";
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
url = "Failed to post. Check report.txt";
|
||||
}
|
||||
}
|
||||
|
||||
public class PastebinReport {
|
||||
private StringBuilder report = new StringBuilder();
|
||||
private String url = "";
|
||||
private Date date = new Date();
|
||||
private SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd kk:mm Z");
|
||||
|
||||
public PastebinReport(CommandSender cs) {
|
||||
Player player = null;
|
||||
try {
|
||||
player = (Player) cs;
|
||||
} catch (Exception e) {
|
||||
cs.sendMessage(ChatColor.RED + "We were unable to detect a player when making this report. Skipping permstester");
|
||||
}
|
||||
|
||||
createReport(player);
|
||||
try {
|
||||
writeReport();
|
||||
} catch (IOException e) {}
|
||||
postReport();
|
||||
}
|
||||
|
||||
public String getURL() {
|
||||
return url;
|
||||
}
|
||||
|
||||
private void appendPermissionsTester(Player player) {
|
||||
if (player == null) { return; }
|
||||
|
||||
// alrighty then noobs.
|
||||
for (Permission node : Permission.values()) {
|
||||
report.append(player.getName() + ": " + node.toString() + " " + node.get(player) + '\n');
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void createReport(Player player) {
|
||||
report.append("------------ AntiCheat Report - " + format.format(date) + " ------------" + '\n');
|
||||
report.append("Version: " + Anticheat.getVersion() + '\n');
|
||||
report.append("CraftBukkit: " + Bukkit.getVersion() + '\n');
|
||||
report.append("Plugin Count: " + Bukkit.getPluginManager().getPlugins().length + '\n');
|
||||
appendSystemInfo();
|
||||
report.append("------------Last 30 logs------------" + '\n');
|
||||
for (String log : Anticheat.getManager().getLastLogs()) {
|
||||
report.append("[AntiCheat] " + log + '\n');
|
||||
}
|
||||
report.append("------------Permission Tester------------" + '\n');
|
||||
appendPermissionsTester(player);
|
||||
report.append("-----------End Of Report------------");
|
||||
}
|
||||
|
||||
private void appendSystemInfo() {
|
||||
Runtime runtime = Runtime.getRuntime();
|
||||
report.append("Java: " + System.getProperty("java.vendor") + " " + System.getProperty("java.version") + '\n');
|
||||
report.append("OS: " + System.getProperty("os.name") + " " + System.getProperty("os.version") + '\n');
|
||||
report.append("Free Memory: " + runtime.freeMemory() / 1024 / 1024 + "MB" + '\n');
|
||||
report.append("Max Memory: " + runtime.maxMemory() / 1024 / 1024 + "MB" + '\n');
|
||||
report.append("Total Memory: " + runtime.totalMemory() / 1024 / 1024 + "MB" + '\n');
|
||||
report.append("Server ID + Name: " + Bukkit.getServerId() + " - " + Bukkit.getName() + '\n');
|
||||
report.append("Players: " + Bukkit.getOnlinePlayers().length + "/" + Bukkit.getMaxPlayers() + '\n');
|
||||
}
|
||||
|
||||
private void writeReport() throws IOException {
|
||||
File f = new File(Anticheat.getPlugin().getDataFolder() + "/report.txt");
|
||||
FileWriter r = new FileWriter(f);
|
||||
BufferedWriter writer = new BufferedWriter(r);
|
||||
writer.write(report.toString());
|
||||
writer.close();
|
||||
}
|
||||
|
||||
private void postReport() {
|
||||
try {
|
||||
URL urls = new URL("http://pastebin.com/api/api_post.php");
|
||||
HttpURLConnection conn = (HttpURLConnection) urls.openConnection();
|
||||
conn.setConnectTimeout(5000);
|
||||
conn.setReadTimeout(5000);
|
||||
conn.setRequestMethod("POST");
|
||||
conn.addRequestProperty("Content-type", "application/x-www-form-urlencoded");
|
||||
conn.setInstanceFollowRedirects(false);
|
||||
conn.setDoOutput(true);
|
||||
OutputStream out = conn.getOutputStream();
|
||||
|
||||
out.write(("api_option=paste" + "&api_dev_key=" + URLEncoder.encode("c0616def494dcb5b7632304f8c52c0f1", "utf-8") + "&api_paste_code=" + URLEncoder.encode(report.toString(), "utf-8") + "&api_paste_private=" + URLEncoder.encode("1", "utf-8") + "&api_paste_name=" + URLEncoder.encode("", "utf-8") + "&api_paste_expire_date=" + URLEncoder.encode("1M", "utf-8") + "&api_paste_format=" + URLEncoder.encode("text", "utf-8") + "&api_user_key=" + URLEncoder.encode("", "utf-8")).getBytes());
|
||||
out.flush();
|
||||
out.close();
|
||||
|
||||
if (conn.getResponseCode() == 200) {
|
||||
InputStream receive = conn.getInputStream();
|
||||
BufferedReader reader = new BufferedReader(new InputStreamReader(receive));
|
||||
String line;
|
||||
StringBuffer response = new StringBuffer();
|
||||
while ((line = reader.readLine()) != null) {
|
||||
response.append(line);
|
||||
response.append("\r\n");
|
||||
}
|
||||
reader.close();
|
||||
|
||||
String result = response.toString().trim();
|
||||
|
||||
if (!result.contains("http://")) {
|
||||
url = "Failed to post. Check report.txt";
|
||||
} else {
|
||||
url = result.trim();
|
||||
}
|
||||
} else {
|
||||
url = "Failed to post. Check report.txt";
|
||||
}
|
||||
} catch (Exception e) {
|
||||
url = "Failed to post. Check report.txt";
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -20,57 +20,54 @@ package net.h31ix.anticheat.util;
|
||||
|
||||
import org.bukkit.command.CommandSender;
|
||||
|
||||
public enum Permission
|
||||
{
|
||||
/* Check Nodes */
|
||||
CHECK_ZOMBE_FLY,
|
||||
CHECK_ZOMBE_NOCLIP,
|
||||
CHECK_ZOMBE_CHEAT,
|
||||
CHECK_FLY,
|
||||
CHECK_WATERWALK,
|
||||
CHECK_NOSWING,
|
||||
CHECK_FASTBREAK,
|
||||
CHECK_FASTPLACE,
|
||||
CHECK_SPAM,
|
||||
CHECK_SPRINT,
|
||||
CHECK_SNEAK,
|
||||
CHECK_SPEED,
|
||||
CHECK_VCLIP,
|
||||
CHECK_SPIDER,
|
||||
CHECK_NOFALL,
|
||||
CHECK_FASTBOW,
|
||||
CHECK_FASTEAT,
|
||||
CHECK_FASTHEAL,
|
||||
CHECK_FORCEFIELD,
|
||||
CHECK_XRAY,
|
||||
CHECK_LONGREACH,
|
||||
CHECK_FASTPROJECTILE,
|
||||
CHECK_ITEMSPAM,
|
||||
CHECK_VISUAL,
|
||||
CHECK_FASTINVENTORY,
|
||||
CHECK_AUTOTOOL,
|
||||
|
||||
/* System Nodes */
|
||||
SYSTEM_LOG,
|
||||
SYSTEM_XRAY,
|
||||
SYSTEM_RESET,
|
||||
SYSTEM_SPY,
|
||||
SYSTEM_HELP,
|
||||
SYSTEM_UPDATE,
|
||||
SYSTEM_REPORT,
|
||||
SYSTEM_ALERT,
|
||||
SYSTEM_CALIBRATE,
|
||||
SYSTEM_RELOAD;
|
||||
|
||||
public boolean get(CommandSender cs)
|
||||
{
|
||||
return cs.hasPermission(toString());
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString()
|
||||
{
|
||||
return "anticheat." + this.name().toLowerCase().replace("_", ".");
|
||||
}
|
||||
|
||||
public enum Permission {
|
||||
/* Check Nodes */
|
||||
CHECK_ZOMBE_FLY,
|
||||
CHECK_ZOMBE_NOCLIP,
|
||||
CHECK_ZOMBE_CHEAT,
|
||||
CHECK_FLY,
|
||||
CHECK_WATERWALK,
|
||||
CHECK_NOSWING,
|
||||
CHECK_FASTBREAK,
|
||||
CHECK_FASTPLACE,
|
||||
CHECK_SPAM,
|
||||
CHECK_SPRINT,
|
||||
CHECK_SNEAK,
|
||||
CHECK_SPEED,
|
||||
CHECK_VCLIP,
|
||||
CHECK_SPIDER,
|
||||
CHECK_NOFALL,
|
||||
CHECK_FASTBOW,
|
||||
CHECK_FASTEAT,
|
||||
CHECK_FASTHEAL,
|
||||
CHECK_FORCEFIELD,
|
||||
CHECK_XRAY,
|
||||
CHECK_LONGREACH,
|
||||
CHECK_FASTPROJECTILE,
|
||||
CHECK_ITEMSPAM,
|
||||
CHECK_VISUAL,
|
||||
CHECK_FASTINVENTORY,
|
||||
CHECK_AUTOTOOL,
|
||||
|
||||
/* System Nodes */
|
||||
SYSTEM_LOG,
|
||||
SYSTEM_XRAY,
|
||||
SYSTEM_RESET,
|
||||
SYSTEM_SPY,
|
||||
SYSTEM_HELP,
|
||||
SYSTEM_UPDATE,
|
||||
SYSTEM_REPORT,
|
||||
SYSTEM_ALERT,
|
||||
SYSTEM_CALIBRATE,
|
||||
SYSTEM_RELOAD;
|
||||
|
||||
public boolean get(CommandSender cs) {
|
||||
return cs.hasPermission(toString());
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "anticheat." + this.name().toLowerCase().replace("_", ".");
|
||||
}
|
||||
|
||||
}
|
||||
@@ -20,31 +20,26 @@ package net.h31ix.anticheat.util;
|
||||
|
||||
import org.bukkit.Location;
|
||||
|
||||
public class SpyState
|
||||
{
|
||||
private boolean allowFlight;
|
||||
private boolean flying;
|
||||
private Location location;
|
||||
|
||||
public SpyState(boolean allowFlight, boolean flying, Location location)
|
||||
{
|
||||
this.allowFlight = allowFlight;
|
||||
this.flying = flying;
|
||||
this.location = location;
|
||||
}
|
||||
|
||||
public boolean getAllowFlight()
|
||||
{
|
||||
return this.allowFlight;
|
||||
}
|
||||
|
||||
public boolean getFlying()
|
||||
{
|
||||
return this.flying;
|
||||
}
|
||||
|
||||
public Location getLocation()
|
||||
{
|
||||
return this.location;
|
||||
}
|
||||
public class SpyState {
|
||||
private boolean allowFlight;
|
||||
private boolean flying;
|
||||
private Location location;
|
||||
|
||||
public SpyState(boolean allowFlight, boolean flying, Location location) {
|
||||
this.allowFlight = allowFlight;
|
||||
this.flying = flying;
|
||||
this.location = location;
|
||||
}
|
||||
|
||||
public boolean getAllowFlight() {
|
||||
return this.allowFlight;
|
||||
}
|
||||
|
||||
public boolean getFlying() {
|
||||
return this.flying;
|
||||
}
|
||||
|
||||
public Location getLocation() {
|
||||
return this.location;
|
||||
}
|
||||
}
|
||||
@@ -2,34 +2,27 @@ package net.h31ix.anticheat.util;
|
||||
|
||||
import org.bukkit.Material;
|
||||
|
||||
public enum ToolHardness
|
||||
{
|
||||
|
||||
//NOTHING(null, 1.5)
|
||||
WOOD(0.75D),
|
||||
STONE(0.40D),
|
||||
IRON(0.25D),
|
||||
DIAMOND(0.20D),
|
||||
SHEARS(0.55D),
|
||||
GOLD(0.15D);
|
||||
|
||||
double hardness;
|
||||
|
||||
ToolHardness(double hard)
|
||||
{
|
||||
hardness = hard;
|
||||
}
|
||||
|
||||
public static double getToolHardness(Material tool)
|
||||
{
|
||||
for (ToolHardness e : ToolHardness.values())
|
||||
{
|
||||
if (tool.name().contains(e.name()))
|
||||
{
|
||||
return e.hardness;
|
||||
}
|
||||
}
|
||||
|
||||
return 1.50D;
|
||||
}
|
||||
public enum ToolHardness {
|
||||
|
||||
// NOTHING(null, 1.5)
|
||||
WOOD(0.75D),
|
||||
STONE(0.40D),
|
||||
IRON(0.25D),
|
||||
DIAMOND(0.20D),
|
||||
SHEARS(0.55D),
|
||||
GOLD(0.15D);
|
||||
|
||||
double hardness;
|
||||
|
||||
ToolHardness(double hard) {
|
||||
hardness = hard;
|
||||
}
|
||||
|
||||
public static double getToolHardness(Material tool) {
|
||||
for (ToolHardness e : ToolHardness.values()) {
|
||||
if (tool.name().contains(e.name())) { return e.hardness; }
|
||||
}
|
||||
|
||||
return 1.50D;
|
||||
}
|
||||
}
|
||||
@@ -31,248 +31,205 @@ import org.bukkit.entity.Player;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.util.NumberConversions;
|
||||
|
||||
public final class Utilities
|
||||
{
|
||||
private static final List<Material> INSTANT_BREAK = new ArrayList<Material>();
|
||||
private static final List<Material> FOOD = new ArrayList<Material>();
|
||||
private static final List<Material> INTERACTABLE = new ArrayList<Material>();
|
||||
private static final List<Material> AXES = new ArrayList<Material>();
|
||||
private static final List<Material> PICKAXES = new ArrayList<Material>();
|
||||
private static final List<Material> SHEARS = new ArrayList<Material>();
|
||||
private static final List<Material> SHOVELS = new ArrayList<Material>();
|
||||
private static final List<Material> ANY = new ArrayList<Material>();
|
||||
|
||||
public static void alert(List<String> message)
|
||||
{
|
||||
for (Player player : Bukkit.getOnlinePlayers())
|
||||
{
|
||||
if (Permission.SYSTEM_ALERT.get(player))
|
||||
{
|
||||
for (String msg : message)
|
||||
{
|
||||
player.sendMessage(msg);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (Anticheat.getManager().getConfiguration().logConsole())
|
||||
{
|
||||
for (String msg : message)
|
||||
{
|
||||
Anticheat.getManager().log(msg);
|
||||
}
|
||||
}
|
||||
if (Anticheat.getManager().getConfiguration().getFileLogLevel() != 0)
|
||||
{
|
||||
for (String msg : message)
|
||||
{
|
||||
Anticheat.getManager().log(msg, 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static boolean cantStandAt(Block block)
|
||||
{
|
||||
return !canStand(block) && cantStandClose(block) && cantStandFar(block);
|
||||
}
|
||||
|
||||
public static boolean cantStandAtExp(Location block)
|
||||
{
|
||||
// This is a experimental check for checking whether you can't stand at or whatever.
|
||||
Block nblock = new Location(block.getWorld(), fixXAxis(block.getX()), block.getY() - 0.01D, block.getBlockZ()).getBlock();
|
||||
return cantStandAt(nblock);
|
||||
}
|
||||
|
||||
public static boolean cantStandClose(Block block)
|
||||
{
|
||||
return !canStand(block.getRelative(BlockFace.NORTH)) && !canStand(block.getRelative(BlockFace.EAST)) && !canStand(block.getRelative(BlockFace.SOUTH)) && !canStand(block.getRelative(BlockFace.WEST));
|
||||
}
|
||||
|
||||
public static boolean cantStandFar(Block block)
|
||||
{
|
||||
return !canStand(block.getRelative(BlockFace.NORTH_WEST)) && !canStand(block.getRelative(BlockFace.NORTH_EAST)) && !canStand(block.getRelative(BlockFace.SOUTH_WEST)) && !canStand(block.getRelative(BlockFace.SOUTH_EAST));
|
||||
}
|
||||
|
||||
public static boolean canStand(Block block)
|
||||
{
|
||||
return !(block.isLiquid() || block.getType() == Material.AIR);
|
||||
}
|
||||
|
||||
public static boolean isFullyInWater(Location player)
|
||||
{
|
||||
double touchedX = fixXAxis(player.getX());
|
||||
|
||||
// Yes, this doesn't make sense, but it's supposed to fix some false positives in water walk.
|
||||
// Think of it as 2 negatives = a positive :)
|
||||
if(!(new Location(player.getWorld(), touchedX, player.getY(), player.getBlockZ()).getBlock()).isLiquid() && !(new Location(player.getWorld(), touchedX, Math.round(player.getY()), player.getBlockZ()).getBlock()).isLiquid())
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
return (new Location(player.getWorld(), touchedX, player.getY(), player.getBlockZ()).getBlock()).isLiquid() && (new Location(player.getWorld(), touchedX, Math.round(player.getY()), player.getBlockZ()).getBlock()).isLiquid();
|
||||
}
|
||||
|
||||
public static double fixXAxis(double x)
|
||||
{
|
||||
/* Really really really useful function for those who are on the edges of blocks */
|
||||
/* For Z axis, just use Math.round(xaxis); */
|
||||
double touchedX = x;
|
||||
double rem = touchedX - Math.round(touchedX) + 0.01D;
|
||||
if (rem < 0.30D)
|
||||
{
|
||||
touchedX = NumberConversions.floor(x) - 1;
|
||||
}
|
||||
return touchedX;
|
||||
}
|
||||
|
||||
public static boolean isHoveringOverWater(Location player, int blocks)
|
||||
{
|
||||
for(int i = player.getBlockY(); i > player.getBlockY() - blocks; i--)
|
||||
{
|
||||
Block newloc = (new Location(player.getWorld(), player.getBlockX(), i, player.getBlockZ())).getBlock();
|
||||
if(newloc.getTypeId() != 0 && newloc.isLiquid())
|
||||
return true;
|
||||
else if (newloc.getTypeId() != 0)
|
||||
return false;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public static boolean isHoveringOverWater(Location player)
|
||||
{
|
||||
return isHoveringOverWater(player, 25);
|
||||
}
|
||||
|
||||
public static boolean isInstantBreak(Material m)
|
||||
{
|
||||
return INSTANT_BREAK.contains(m);
|
||||
}
|
||||
|
||||
public static boolean isFood(Material m)
|
||||
{
|
||||
return FOOD.contains(m);
|
||||
}
|
||||
|
||||
public static boolean isSlab(Block block)
|
||||
{
|
||||
int id = block.getTypeId();
|
||||
return id == 43 || id == 44 || id == 125 || id == 126;
|
||||
}
|
||||
|
||||
public static boolean isStair(Block block)
|
||||
{
|
||||
int id = block.getTypeId();
|
||||
return id == 53 || id == 67 || id == 108 || id == 109 || id == 114 || id == 128 || id == 134 || id == 135 || id == 136;
|
||||
}
|
||||
|
||||
public static boolean isInteractable(Material m)
|
||||
{
|
||||
return INTERACTABLE.contains(m);
|
||||
}
|
||||
|
||||
public static boolean sprintFly(Player player)
|
||||
{
|
||||
return player.isSprinting() || player.isFlying();
|
||||
}
|
||||
|
||||
public static boolean isOnLilyPad(Player player)
|
||||
{
|
||||
Block block = player.getLocation().getBlock();
|
||||
Material lily = Material.WATER_LILY;
|
||||
return block.getType() == lily || block.getRelative(BlockFace.NORTH).getType() == lily || block.getRelative(BlockFace.SOUTH).getType() == lily || block.getRelative(BlockFace.EAST).getType() == lily || block.getRelative(BlockFace.WEST).getType() == lily;
|
||||
}
|
||||
|
||||
public static boolean isSubmersed(Player player)
|
||||
{
|
||||
return player.getLocation().getBlock().isLiquid() && player.getLocation().getBlock().getRelative(BlockFace.UP).isLiquid();
|
||||
}
|
||||
|
||||
public static boolean isInWater(Player player)
|
||||
{
|
||||
return player.getLocation().getBlock().isLiquid() || player.getLocation().getBlock().getRelative(BlockFace.DOWN).isLiquid() || player.getLocation().getBlock().getRelative(BlockFace.UP).isLiquid();
|
||||
}
|
||||
|
||||
public static boolean isClimbableBlock(Block block)
|
||||
{
|
||||
return block.getType() == Material.VINE || block.getType() == Material.LADDER;
|
||||
}
|
||||
|
||||
public static boolean isOnVine(Player player)
|
||||
{
|
||||
return player.getLocation().getBlock().getType() == Material.VINE;
|
||||
}
|
||||
|
||||
public static boolean isInt(String string)
|
||||
{
|
||||
boolean x = false;
|
||||
try
|
||||
{
|
||||
Integer.parseInt(string);
|
||||
x = true;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
}
|
||||
return x;
|
||||
}
|
||||
|
||||
public static long calcSurvivalFastBreak(ItemStack tool, Material block)
|
||||
{
|
||||
double bhardness = BlockHardness.getBlockHardness(block);
|
||||
double thardness = ToolHardness.getToolHardness(tool.getType());
|
||||
|
||||
long result = (long) ((long) Math.round((bhardness * thardness) * 0.10 * 10000));
|
||||
result += 150;
|
||||
|
||||
if (result > 25000)
|
||||
result = 25000;
|
||||
else if (result < 0)
|
||||
result = 0;
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
static
|
||||
{
|
||||
INSTANT_BREAK.add(Material.RED_MUSHROOM);
|
||||
INSTANT_BREAK.add(Material.RED_ROSE);
|
||||
INSTANT_BREAK.add(Material.BROWN_MUSHROOM);
|
||||
INSTANT_BREAK.add(Material.YELLOW_FLOWER);
|
||||
INSTANT_BREAK.add(Material.REDSTONE);
|
||||
INSTANT_BREAK.add(Material.REDSTONE_TORCH_OFF);
|
||||
INSTANT_BREAK.add(Material.REDSTONE_TORCH_ON);
|
||||
INSTANT_BREAK.add(Material.REDSTONE_WIRE);
|
||||
INSTANT_BREAK.add(Material.LONG_GRASS);
|
||||
INSTANT_BREAK.add(Material.PAINTING);
|
||||
INSTANT_BREAK.add(Material.WHEAT);
|
||||
INSTANT_BREAK.add(Material.SUGAR_CANE);
|
||||
INSTANT_BREAK.add(Material.SUGAR_CANE_BLOCK);
|
||||
INSTANT_BREAK.add(Material.DIODE);
|
||||
INSTANT_BREAK.add(Material.DIODE_BLOCK_OFF);
|
||||
INSTANT_BREAK.add(Material.DIODE_BLOCK_ON);
|
||||
INSTANT_BREAK.add(Material.SAPLING);
|
||||
INSTANT_BREAK.add(Material.TORCH);
|
||||
INSTANT_BREAK.add(Material.CROPS);
|
||||
INSTANT_BREAK.add(Material.SNOW);
|
||||
INSTANT_BREAK.add(Material.TNT);
|
||||
INTERACTABLE.add(Material.STONE_BUTTON);
|
||||
INTERACTABLE.add(Material.LEVER);
|
||||
INTERACTABLE.add(Material.CHEST);
|
||||
FOOD.add(Material.COOKED_BEEF);
|
||||
FOOD.add(Material.COOKED_CHICKEN);
|
||||
FOOD.add(Material.COOKED_FISH);
|
||||
FOOD.add(Material.GRILLED_PORK);
|
||||
FOOD.add(Material.PORK);
|
||||
FOOD.add(Material.MUSHROOM_SOUP);
|
||||
FOOD.add(Material.RAW_BEEF);
|
||||
FOOD.add(Material.RAW_CHICKEN);
|
||||
FOOD.add(Material.RAW_FISH);
|
||||
FOOD.add(Material.APPLE);
|
||||
FOOD.add(Material.GOLDEN_APPLE);
|
||||
FOOD.add(Material.MELON);
|
||||
FOOD.add(Material.COOKIE);
|
||||
FOOD.add(Material.BREAD);
|
||||
FOOD.add(Material.SPIDER_EYE);
|
||||
FOOD.add(Material.ROTTEN_FLESH);
|
||||
}
|
||||
public final class Utilities {
|
||||
private static final List<Material> INSTANT_BREAK = new ArrayList<Material>();
|
||||
private static final List<Material> FOOD = new ArrayList<Material>();
|
||||
private static final List<Material> INTERACTABLE = new ArrayList<Material>();
|
||||
private static final List<Material> AXES = new ArrayList<Material>();
|
||||
private static final List<Material> PICKAXES = new ArrayList<Material>();
|
||||
private static final List<Material> SHEARS = new ArrayList<Material>();
|
||||
private static final List<Material> SHOVELS = new ArrayList<Material>();
|
||||
private static final List<Material> ANY = new ArrayList<Material>();
|
||||
|
||||
public static void alert(List<String> message) {
|
||||
for (Player player : Bukkit.getOnlinePlayers()) {
|
||||
if (Permission.SYSTEM_ALERT.get(player)) {
|
||||
for (String msg : message) {
|
||||
player.sendMessage(msg);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (Anticheat.getManager().getConfiguration().logConsole()) {
|
||||
for (String msg : message) {
|
||||
Anticheat.getManager().log(msg);
|
||||
}
|
||||
}
|
||||
if (Anticheat.getManager().getConfiguration().getFileLogLevel() != 0) {
|
||||
for (String msg : message) {
|
||||
Anticheat.getManager().log(msg, 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static boolean cantStandAt(Block block) {
|
||||
return !canStand(block) && cantStandClose(block) && cantStandFar(block);
|
||||
}
|
||||
|
||||
public static boolean cantStandAtExp(Location block) {
|
||||
// This is a experimental check for checking whether you can't stand at or whatever.
|
||||
Block nblock = new Location(block.getWorld(), fixXAxis(block.getX()), block.getY() - 0.01D, block.getBlockZ()).getBlock();
|
||||
return cantStandAt(nblock);
|
||||
}
|
||||
|
||||
public static boolean cantStandClose(Block block) {
|
||||
return !canStand(block.getRelative(BlockFace.NORTH)) && !canStand(block.getRelative(BlockFace.EAST)) && !canStand(block.getRelative(BlockFace.SOUTH)) && !canStand(block.getRelative(BlockFace.WEST));
|
||||
}
|
||||
|
||||
public static boolean cantStandFar(Block block) {
|
||||
return !canStand(block.getRelative(BlockFace.NORTH_WEST)) && !canStand(block.getRelative(BlockFace.NORTH_EAST)) && !canStand(block.getRelative(BlockFace.SOUTH_WEST)) && !canStand(block.getRelative(BlockFace.SOUTH_EAST));
|
||||
}
|
||||
|
||||
public static boolean canStand(Block block) {
|
||||
return !(block.isLiquid() || block.getType() == Material.AIR);
|
||||
}
|
||||
|
||||
public static boolean isFullyInWater(Location player) {
|
||||
double touchedX = fixXAxis(player.getX());
|
||||
|
||||
// Yes, this doesn't make sense, but it's supposed to fix some false positives in water walk.
|
||||
// Think of it as 2 negatives = a positive :)
|
||||
if (!(new Location(player.getWorld(), touchedX, player.getY(), player.getBlockZ()).getBlock()).isLiquid() && !(new Location(player.getWorld(), touchedX, Math.round(player.getY()), player.getBlockZ()).getBlock()).isLiquid()) { return true; }
|
||||
|
||||
return (new Location(player.getWorld(), touchedX, player.getY(), player.getBlockZ()).getBlock()).isLiquid() && (new Location(player.getWorld(), touchedX, Math.round(player.getY()), player.getBlockZ()).getBlock()).isLiquid();
|
||||
}
|
||||
|
||||
public static double fixXAxis(double x) {
|
||||
/* Really really really useful function for those who are on the edges of blocks */
|
||||
/* For Z axis, just use Math.round(xaxis); */
|
||||
double touchedX = x;
|
||||
double rem = touchedX - Math.round(touchedX) + 0.01D;
|
||||
if (rem < 0.30D) {
|
||||
touchedX = NumberConversions.floor(x) - 1;
|
||||
}
|
||||
return touchedX;
|
||||
}
|
||||
|
||||
public static boolean isHoveringOverWater(Location player, int blocks) {
|
||||
for (int i = player.getBlockY(); i > player.getBlockY() - blocks; i--) {
|
||||
Block newloc = (new Location(player.getWorld(), player.getBlockX(), i, player.getBlockZ())).getBlock();
|
||||
if (newloc.getTypeId() != 0 && newloc.isLiquid())
|
||||
return true;
|
||||
else if (newloc.getTypeId() != 0) return false;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public static boolean isHoveringOverWater(Location player) {
|
||||
return isHoveringOverWater(player, 25);
|
||||
}
|
||||
|
||||
public static boolean isInstantBreak(Material m) {
|
||||
return INSTANT_BREAK.contains(m);
|
||||
}
|
||||
|
||||
public static boolean isFood(Material m) {
|
||||
return FOOD.contains(m);
|
||||
}
|
||||
|
||||
public static boolean isSlab(Block block) {
|
||||
int id = block.getTypeId();
|
||||
return id == 43 || id == 44 || id == 125 || id == 126;
|
||||
}
|
||||
|
||||
public static boolean isStair(Block block) {
|
||||
int id = block.getTypeId();
|
||||
return id == 53 || id == 67 || id == 108 || id == 109 || id == 114 || id == 128 || id == 134 || id == 135 || id == 136;
|
||||
}
|
||||
|
||||
public static boolean isInteractable(Material m) {
|
||||
return INTERACTABLE.contains(m);
|
||||
}
|
||||
|
||||
public static boolean sprintFly(Player player) {
|
||||
return player.isSprinting() || player.isFlying();
|
||||
}
|
||||
|
||||
public static boolean isOnLilyPad(Player player) {
|
||||
Block block = player.getLocation().getBlock();
|
||||
Material lily = Material.WATER_LILY;
|
||||
return block.getType() == lily || block.getRelative(BlockFace.NORTH).getType() == lily || block.getRelative(BlockFace.SOUTH).getType() == lily || block.getRelative(BlockFace.EAST).getType() == lily || block.getRelative(BlockFace.WEST).getType() == lily;
|
||||
}
|
||||
|
||||
public static boolean isSubmersed(Player player) {
|
||||
return player.getLocation().getBlock().isLiquid() && player.getLocation().getBlock().getRelative(BlockFace.UP).isLiquid();
|
||||
}
|
||||
|
||||
public static boolean isInWater(Player player) {
|
||||
return player.getLocation().getBlock().isLiquid() || player.getLocation().getBlock().getRelative(BlockFace.DOWN).isLiquid() || player.getLocation().getBlock().getRelative(BlockFace.UP).isLiquid();
|
||||
}
|
||||
|
||||
public static boolean isClimbableBlock(Block block) {
|
||||
return block.getType() == Material.VINE || block.getType() == Material.LADDER;
|
||||
}
|
||||
|
||||
public static boolean isOnVine(Player player) {
|
||||
return player.getLocation().getBlock().getType() == Material.VINE;
|
||||
}
|
||||
|
||||
public static boolean isInt(String string) {
|
||||
boolean x = false;
|
||||
try {
|
||||
Integer.parseInt(string);
|
||||
x = true;
|
||||
} catch (Exception ex) {}
|
||||
return x;
|
||||
}
|
||||
|
||||
public static long calcSurvivalFastBreak(ItemStack tool, Material block) {
|
||||
double bhardness = BlockHardness.getBlockHardness(block);
|
||||
double thardness = ToolHardness.getToolHardness(tool.getType());
|
||||
|
||||
long result = (long) ((long) Math.round((bhardness * thardness) * 0.10 * 10000));
|
||||
result += 150;
|
||||
|
||||
if (result > 25000)
|
||||
result = 25000;
|
||||
else if (result < 0) result = 0;
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
static {
|
||||
INSTANT_BREAK.add(Material.RED_MUSHROOM);
|
||||
INSTANT_BREAK.add(Material.RED_ROSE);
|
||||
INSTANT_BREAK.add(Material.BROWN_MUSHROOM);
|
||||
INSTANT_BREAK.add(Material.YELLOW_FLOWER);
|
||||
INSTANT_BREAK.add(Material.REDSTONE);
|
||||
INSTANT_BREAK.add(Material.REDSTONE_TORCH_OFF);
|
||||
INSTANT_BREAK.add(Material.REDSTONE_TORCH_ON);
|
||||
INSTANT_BREAK.add(Material.REDSTONE_WIRE);
|
||||
INSTANT_BREAK.add(Material.LONG_GRASS);
|
||||
INSTANT_BREAK.add(Material.PAINTING);
|
||||
INSTANT_BREAK.add(Material.WHEAT);
|
||||
INSTANT_BREAK.add(Material.SUGAR_CANE);
|
||||
INSTANT_BREAK.add(Material.SUGAR_CANE_BLOCK);
|
||||
INSTANT_BREAK.add(Material.DIODE);
|
||||
INSTANT_BREAK.add(Material.DIODE_BLOCK_OFF);
|
||||
INSTANT_BREAK.add(Material.DIODE_BLOCK_ON);
|
||||
INSTANT_BREAK.add(Material.SAPLING);
|
||||
INSTANT_BREAK.add(Material.TORCH);
|
||||
INSTANT_BREAK.add(Material.CROPS);
|
||||
INSTANT_BREAK.add(Material.SNOW);
|
||||
INSTANT_BREAK.add(Material.TNT);
|
||||
INTERACTABLE.add(Material.STONE_BUTTON);
|
||||
INTERACTABLE.add(Material.LEVER);
|
||||
INTERACTABLE.add(Material.CHEST);
|
||||
FOOD.add(Material.COOKED_BEEF);
|
||||
FOOD.add(Material.COOKED_CHICKEN);
|
||||
FOOD.add(Material.COOKED_FISH);
|
||||
FOOD.add(Material.GRILLED_PORK);
|
||||
FOOD.add(Material.PORK);
|
||||
FOOD.add(Material.MUSHROOM_SOUP);
|
||||
FOOD.add(Material.RAW_BEEF);
|
||||
FOOD.add(Material.RAW_CHICKEN);
|
||||
FOOD.add(Material.RAW_FISH);
|
||||
FOOD.add(Material.APPLE);
|
||||
FOOD.add(Material.GOLDEN_APPLE);
|
||||
FOOD.add(Material.MELON);
|
||||
FOOD.add(Material.COOKIE);
|
||||
FOOD.add(Material.BREAD);
|
||||
FOOD.add(Material.SPIDER_EYE);
|
||||
FOOD.add(Material.ROTTEN_FLESH);
|
||||
}
|
||||
}
|
||||
@@ -33,115 +33,105 @@ import org.yaml.snakeyaml.DumperOptions;
|
||||
import org.yaml.snakeyaml.Yaml;
|
||||
import org.yaml.snakeyaml.representer.Representer;
|
||||
|
||||
public class CommentedConfiguration extends YamlConfiguration
|
||||
{
|
||||
private Map<String, String> comments = new HashMap<String, String>();
|
||||
|
||||
private final DumperOptions yamlOptions = new DumperOptions();
|
||||
private final Representer yamlRepresenter = new YamlRepresenter();
|
||||
private final Yaml yaml = new Yaml(new YamlConstructor(), yamlRepresenter, yamlOptions);
|
||||
private String lastLine = null;
|
||||
|
||||
public CommentedConfiguration()
|
||||
{
|
||||
// Val 1 = line comment should be under
|
||||
// Val 2 = comment
|
||||
comments.put("XRay:", " # Should AntiCheat use calculations to try and find xrayers?");
|
||||
comments.put("Log xray stats:", " # Should a warning be sent to admins when a person is found that could be xraying?");
|
||||
comments.put("Alert when xray is found:", " # Should players in creative mode be tracked for possible xray usage?");
|
||||
comments.put("Chat:", " # Should AntiCheat block players spamming messages in chat?");
|
||||
comments.put("Block chat spam:", " # Should AntiCheat block players spamming commands in chat?");
|
||||
comments.put("Block command spam:", " # Valid actions = NONE,KICK,BAN,COMMAND[command]");
|
||||
comments.put("Ban Action:", "# Events occur when a player's hack level changes. You may configure reactions to these events here.");
|
||||
comments.put("# Events occur when a player's hack level changes. You may configure reactions to these events here.", "# Valid events = NONE,WARN,KICK,BAN,COMMAND[command]");
|
||||
comments.put("# Valid events = NONE,WARN,KICK,BAN,COMMAND[command]", "# Use commands like so: COMMAND[ban &player 30] or COMMAND[kick &player hacking] or COMMAND[jail &player 10]");
|
||||
comments.put("# Use commands like so: COMMAND[ban &player 30] or COMMAND[kick &player hacking] or COMMAND[jail &player 10]", "# &player will be replaced with player's name, and &world will be replaced with the player's world");
|
||||
comments.put("Level High:", " # How many warnings should the player get before entering medium?");
|
||||
comments.put("Medium threshold:", " # How many warnings should the player get before entering high?");
|
||||
comments.put("System:", " # Turning auto-update off is a _BAD_ idea. You will no longer be protected by the latest hacks/cheats if you do so, and will have to update manually.");
|
||||
comments.put("# Turning auto-update off is a _BAD_ idea. You will no longer be protected by the latest hacks/cheats if you do so, and will have to update manually.", " # Should AntiCheat log ALL failed checks to console?");
|
||||
comments.put("Log to console:", " # Should AntiCheat log to files?");
|
||||
comments.put("# Should AntiCheat log to files?", " # 0 = off, 1 = log only when an event takes place, 2 = more detailed logs, 3 = most detailed logs");
|
||||
comments.put("File log level:", " # Should AntiCheat display extra debug information when starting?");
|
||||
comments.put("Verbose startup:", " # If silent mode is on, players will not be stopped when they try to hack, and AntiCheat will do everything possible to keep them unaware of their rising hack level.");
|
||||
comments.put("# If silent mode is on, players will not be stopped when they try to hack, and AntiCheat will do everything possible to keep them unaware of their rising hack level.", " # However, alerts will still be sent to console and to admins online, and events will still take place.");
|
||||
comments.put("Silent mode:", " # Should ops be exempt from all checks?");
|
||||
}
|
||||
|
||||
@Override
|
||||
public String saveToString() {
|
||||
yamlOptions.setIndent(options().indent());
|
||||
yamlOptions.setDefaultFlowStyle(DumperOptions.FlowStyle.BLOCK);
|
||||
yamlRepresenter.setDefaultFlowStyle(DumperOptions.FlowStyle.BLOCK);
|
||||
|
||||
String dump = yaml.dump(getValues(false));
|
||||
|
||||
if (dump.equals(BLANK_CONFIG)) {
|
||||
dump = "";
|
||||
} else {
|
||||
StringBuilder builder = new StringBuilder();
|
||||
String [] lines = dump.split("\n");
|
||||
int i =0;
|
||||
|
||||
while(i < lines.length) {
|
||||
if(containsLine(lines[i])) {
|
||||
builder.append(lines[i]);
|
||||
builder.append("\n");
|
||||
builder.append(getComment(lines[i]));
|
||||
builder.append("\n");
|
||||
lastLine = getComment(getComment(lines[i]));
|
||||
i++;
|
||||
} else if(containsLine(lastLine)) {
|
||||
builder.append(getComment(lastLine));
|
||||
builder.append("\n");
|
||||
lastLine = getComment(lastLine);
|
||||
} else {
|
||||
builder.append(lines[i]);
|
||||
builder.append("\n");
|
||||
i++;
|
||||
}
|
||||
}
|
||||
dump = "# AntiCheat configuration file\n# Please report any bugs: http://dev.bukkit.org/server-mods/anticheat/\n"+builder.toString();
|
||||
}
|
||||
|
||||
return dump;
|
||||
}
|
||||
|
||||
private boolean containsLine(String line)
|
||||
{
|
||||
if(line != null)
|
||||
{
|
||||
for(String string : comments.keySet()) {
|
||||
if(string.replaceAll(" ", "").split(":")[0].equalsIgnoreCase(line.replaceAll(" ", "").split(":")[0])) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
private String getComment(String line)
|
||||
{
|
||||
for(String string : comments.keySet()) {
|
||||
if(string.replaceAll(" ", "").split(":")[0].equalsIgnoreCase(line.replaceAll(" ", "").split(":")[0])) {
|
||||
return comments.get(string);
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public static CommentedConfiguration loadConfig(File file) {
|
||||
|
||||
CommentedConfiguration config = new CommentedConfiguration();
|
||||
try {
|
||||
config.load(file);
|
||||
} catch (FileNotFoundException ex) {
|
||||
} catch (IOException ex) {
|
||||
Bukkit.getLogger().log(Level.SEVERE, "Cannot load " + file, ex);
|
||||
} catch (InvalidConfigurationException ex) {
|
||||
Bukkit.getLogger().log(Level.SEVERE, "Cannot load " + file , ex);
|
||||
}
|
||||
|
||||
return config;
|
||||
}
|
||||
public class CommentedConfiguration extends YamlConfiguration {
|
||||
private Map<String, String> comments = new HashMap<String, String>();
|
||||
|
||||
private final DumperOptions yamlOptions = new DumperOptions();
|
||||
private final Representer yamlRepresenter = new YamlRepresenter();
|
||||
private final Yaml yaml = new Yaml(new YamlConstructor(), yamlRepresenter, yamlOptions);
|
||||
private String lastLine = null;
|
||||
|
||||
public CommentedConfiguration() {
|
||||
// Val 1 = line comment should be under
|
||||
// Val 2 = comment
|
||||
comments.put("XRay:", " # Should AntiCheat use calculations to try and find xrayers?");
|
||||
comments.put("Log xray stats:", " # Should a warning be sent to admins when a person is found that could be xraying?");
|
||||
comments.put("Alert when xray is found:", " # Should players in creative mode be tracked for possible xray usage?");
|
||||
comments.put("Chat:", " # Should AntiCheat block players spamming messages in chat?");
|
||||
comments.put("Block chat spam:", " # Should AntiCheat block players spamming commands in chat?");
|
||||
comments.put("Block command spam:", " # Valid actions = NONE,KICK,BAN,COMMAND[command]");
|
||||
comments.put("Ban Action:", "# Events occur when a player's hack level changes. You may configure reactions to these events here.");
|
||||
comments.put("# Events occur when a player's hack level changes. You may configure reactions to these events here.", "# Valid events = NONE,WARN,KICK,BAN,COMMAND[command]");
|
||||
comments.put("# Valid events = NONE,WARN,KICK,BAN,COMMAND[command]", "# Use commands like so: COMMAND[ban &player 30] or COMMAND[kick &player hacking] or COMMAND[jail &player 10]");
|
||||
comments.put("# Use commands like so: COMMAND[ban &player 30] or COMMAND[kick &player hacking] or COMMAND[jail &player 10]", "# &player will be replaced with player's name, and &world will be replaced with the player's world");
|
||||
comments.put("Level High:", " # How many warnings should the player get before entering medium?");
|
||||
comments.put("Medium threshold:", " # How many warnings should the player get before entering high?");
|
||||
comments.put("System:", " # Turning auto-update off is a _BAD_ idea. You will no longer be protected by the latest hacks/cheats if you do so, and will have to update manually.");
|
||||
comments.put("# Turning auto-update off is a _BAD_ idea. You will no longer be protected by the latest hacks/cheats if you do so, and will have to update manually.", " # Should AntiCheat log ALL failed checks to console?");
|
||||
comments.put("Log to console:", " # Should AntiCheat log to files?");
|
||||
comments.put("# Should AntiCheat log to files?", " # 0 = off, 1 = log only when an event takes place, 2 = more detailed logs, 3 = most detailed logs");
|
||||
comments.put("File log level:", " # Should AntiCheat display extra debug information when starting?");
|
||||
comments.put("Verbose startup:", " # If silent mode is on, players will not be stopped when they try to hack, and AntiCheat will do everything possible to keep them unaware of their rising hack level.");
|
||||
comments.put("# If silent mode is on, players will not be stopped when they try to hack, and AntiCheat will do everything possible to keep them unaware of their rising hack level.", " # However, alerts will still be sent to console and to admins online, and events will still take place.");
|
||||
comments.put("Silent mode:", " # Should ops be exempt from all checks?");
|
||||
}
|
||||
|
||||
@Override
|
||||
public String saveToString() {
|
||||
yamlOptions.setIndent(options().indent());
|
||||
yamlOptions.setDefaultFlowStyle(DumperOptions.FlowStyle.BLOCK);
|
||||
yamlRepresenter.setDefaultFlowStyle(DumperOptions.FlowStyle.BLOCK);
|
||||
|
||||
String dump = yaml.dump(getValues(false));
|
||||
|
||||
if (dump.equals(BLANK_CONFIG)) {
|
||||
dump = "";
|
||||
} else {
|
||||
StringBuilder builder = new StringBuilder();
|
||||
String[] lines = dump.split("\n");
|
||||
int i = 0;
|
||||
|
||||
while (i < lines.length) {
|
||||
if (containsLine(lines[i])) {
|
||||
builder.append(lines[i]);
|
||||
builder.append("\n");
|
||||
builder.append(getComment(lines[i]));
|
||||
builder.append("\n");
|
||||
lastLine = getComment(getComment(lines[i]));
|
||||
i++;
|
||||
} else if (containsLine(lastLine)) {
|
||||
builder.append(getComment(lastLine));
|
||||
builder.append("\n");
|
||||
lastLine = getComment(lastLine);
|
||||
} else {
|
||||
builder.append(lines[i]);
|
||||
builder.append("\n");
|
||||
i++;
|
||||
}
|
||||
}
|
||||
dump = "# AntiCheat configuration file\n# Please report any bugs: http://dev.bukkit.org/server-mods/anticheat/\n" + builder.toString();
|
||||
}
|
||||
|
||||
return dump;
|
||||
}
|
||||
|
||||
private boolean containsLine(String line) {
|
||||
if (line != null) {
|
||||
for (String string : comments.keySet()) {
|
||||
if (string.replaceAll(" ", "").split(":")[0].equalsIgnoreCase(line.replaceAll(" ", "").split(":")[0])) { return true; }
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
private String getComment(String line) {
|
||||
for (String string : comments.keySet()) {
|
||||
if (string.replaceAll(" ", "").split(":")[0].equalsIgnoreCase(line.replaceAll(" ", "").split(":")[0])) { return comments.get(string); }
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public static CommentedConfiguration loadConfig(File file) {
|
||||
|
||||
CommentedConfiguration config = new CommentedConfiguration();
|
||||
try {
|
||||
config.load(file);
|
||||
} catch (FileNotFoundException ex) {} catch (IOException ex) {
|
||||
Bukkit.getLogger().log(Level.SEVERE, "Cannot load " + file, ex);
|
||||
} catch (InvalidConfigurationException ex) {
|
||||
Bukkit.getLogger().log(Level.SEVERE, "Cannot load " + file, ex);
|
||||
}
|
||||
|
||||
return config;
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user