mirror of
https://github.com/darksaid98/AntiCheatReloaded.git
synced 2026-12-04 06:28:52 +00:00
More small changes
This commit is contained in:
1 parent
1a64403223
commit
8e92077bb6
22 files changed
+355
-728
No files matched your search
@@ -39,7 +39,8 @@ public enum CheckType {
|
|||||||
ZOMBE_FLY(Permission.CHECK_ZOMBE_FLY),
|
ZOMBE_FLY(Permission.CHECK_ZOMBE_FLY),
|
||||||
ZOMBE_NOCLIP(Permission.CHECK_ZOMBE_NOCLIP),
|
ZOMBE_NOCLIP(Permission.CHECK_ZOMBE_NOCLIP),
|
||||||
ZOMBE_CHEAT(Permission.CHECK_ZOMBE_CHEAT),
|
ZOMBE_CHEAT(Permission.CHECK_ZOMBE_CHEAT),
|
||||||
FLY(Permission.CHECK_FLY),
|
FLIGHT(Permission.CHECK_FLIGHT),
|
||||||
|
ELYTRA(Permission.CHECK_FLIGHT),
|
||||||
WATER_WALK(Permission.CHECK_WATERWALK),
|
WATER_WALK(Permission.CHECK_WATERWALK),
|
||||||
NO_SWING(Permission.CHECK_NOSWING),
|
NO_SWING(Permission.CHECK_NOSWING),
|
||||||
FAST_BREAK(Permission.CHECK_FASTBREAK),
|
FAST_BREAK(Permission.CHECK_FASTBREAK),
|
||||||
|
|||||||
+20
-1
@@ -19,19 +19,38 @@
|
|||||||
|
|
||||||
package com.rammelkast.anticheatreloaded.check.movement;
|
package com.rammelkast.anticheatreloaded.check.movement;
|
||||||
|
|
||||||
|
import org.bukkit.Material;
|
||||||
|
import org.bukkit.block.BlockFace;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
|
import com.rammelkast.anticheatreloaded.AntiCheatReloaded;
|
||||||
import com.rammelkast.anticheatreloaded.check.CheckResult;
|
import com.rammelkast.anticheatreloaded.check.CheckResult;
|
||||||
import com.rammelkast.anticheatreloaded.util.Distance;
|
import com.rammelkast.anticheatreloaded.util.Distance;
|
||||||
|
import com.rammelkast.anticheatreloaded.util.Utilities;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* TODO
|
* TODO
|
||||||
*/
|
*/
|
||||||
public class ElytraFly {
|
public class ElytraCheck {
|
||||||
|
|
||||||
private static final CheckResult PASS = new CheckResult(CheckResult.Result.PASSED);
|
private static final CheckResult PASS = new CheckResult(CheckResult.Result.PASSED);
|
||||||
|
|
||||||
public static CheckResult runCheck(Player player, Distance distance) {
|
public static CheckResult runCheck(Player player, Distance distance) {
|
||||||
|
if (distance.getYDifference() > AntiCheatReloaded.getManager().getBackend().getMagic().TELEPORT_MIN()) {
|
||||||
|
// This was a teleport, so skip check.
|
||||||
|
return PASS;
|
||||||
|
}
|
||||||
|
if (!FlightCheck.isMovingExempt(player) && !Utilities.isHoveringOverWater(player.getLocation(), 1)
|
||||||
|
&& Utilities.cantStandAtExp(player.getLocation())
|
||||||
|
&& Utilities.blockIsnt(player.getLocation().getBlock().getRelative(BlockFace.DOWN),
|
||||||
|
new Material[] { Material.FENCE, Material.FENCE_GATE, Material.COBBLE_WALL,
|
||||||
|
Material.ACACIA_FENCE, Material.ACACIA_FENCE_GATE, Material.BIRCH_FENCE,
|
||||||
|
Material.BIRCH_FENCE_GATE, Material.DARK_OAK_FENCE, Material.DARK_OAK_FENCE_GATE,
|
||||||
|
Material.IRON_FENCE, Material.JUNGLE_FENCE, Material.JUNGLE_FENCE_GATE,
|
||||||
|
Material.NETHER_FENCE, Material.SPRUCE_FENCE, Material.SPRUCE_FENCE_GATE, Material.IRON_BARDING })) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
return PASS;
|
return PASS;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -56,7 +56,11 @@ public class FlightCheck {
|
|||||||
if (!isMovingExempt(player) && !Utilities.isHoveringOverWater(player.getLocation(), 1)
|
if (!isMovingExempt(player) && !Utilities.isHoveringOverWater(player.getLocation(), 1)
|
||||||
&& Utilities.cantStandAtExp(player.getLocation())
|
&& Utilities.cantStandAtExp(player.getLocation())
|
||||||
&& Utilities.blockIsnt(player.getLocation().getBlock().getRelative(BlockFace.DOWN),
|
&& Utilities.blockIsnt(player.getLocation().getBlock().getRelative(BlockFace.DOWN),
|
||||||
new Material[] { Material.FENCE, Material.FENCE_GATE, Material.COBBLE_WALL })) {
|
new Material[] { Material.FENCE, Material.FENCE_GATE, Material.COBBLE_WALL,
|
||||||
|
Material.ACACIA_FENCE, Material.ACACIA_FENCE_GATE, Material.BIRCH_FENCE,
|
||||||
|
Material.BIRCH_FENCE_GATE, Material.DARK_OAK_FENCE, Material.DARK_OAK_FENCE_GATE,
|
||||||
|
Material.IRON_FENCE, Material.JUNGLE_FENCE, Material.JUNGLE_FENCE_GATE,
|
||||||
|
Material.NETHER_FENCE, Material.SPRUCE_FENCE, Material.SPRUCE_FENCE_GATE, Material.IRON_BARDING })) {
|
||||||
|
|
||||||
if (!blocksOverFlight.containsKey(uuid)) {
|
if (!blocksOverFlight.containsKey(uuid)) {
|
||||||
blocksOverFlight.put(uuid, 0D);
|
blocksOverFlight.put(uuid, 0D);
|
||||||
|
|||||||
@@ -56,7 +56,7 @@ import com.rammelkast.anticheatreloaded.AntiCheatReloaded;
|
|||||||
import com.rammelkast.anticheatreloaded.check.CheckResult;
|
import com.rammelkast.anticheatreloaded.check.CheckResult;
|
||||||
import com.rammelkast.anticheatreloaded.check.CheckType;
|
import com.rammelkast.anticheatreloaded.check.CheckType;
|
||||||
import com.rammelkast.anticheatreloaded.check.combat.KillAuraCheck;
|
import com.rammelkast.anticheatreloaded.check.combat.KillAuraCheck;
|
||||||
import com.rammelkast.anticheatreloaded.check.movement.ElytraFly;
|
import com.rammelkast.anticheatreloaded.check.movement.ElytraCheck;
|
||||||
import com.rammelkast.anticheatreloaded.check.movement.FlightCheck;
|
import com.rammelkast.anticheatreloaded.check.movement.FlightCheck;
|
||||||
import com.rammelkast.anticheatreloaded.check.movement.GlideCheck;
|
import com.rammelkast.anticheatreloaded.check.movement.GlideCheck;
|
||||||
import com.rammelkast.anticheatreloaded.check.movement.SpeedCheck;
|
import com.rammelkast.anticheatreloaded.check.movement.SpeedCheck;
|
||||||
@@ -153,7 +153,7 @@ public class PlayerListener extends EventListener {
|
|||||||
@EventHandler
|
@EventHandler
|
||||||
public void onPlayerVelocity(PlayerVelocityEvent event) {
|
public void onPlayerVelocity(PlayerVelocityEvent event) {
|
||||||
Player player = event.getPlayer();
|
Player player = event.getPlayer();
|
||||||
if (getCheckManager().willCheck(player, CheckType.FLY)) {
|
if (getCheckManager().willCheck(player, CheckType.FLIGHT)) {
|
||||||
if (getBackend().justVelocity(player) && getBackend().extendVelocityTime(player)) {
|
if (getBackend().justVelocity(player) && getBackend().extendVelocityTime(player)) {
|
||||||
event.setCancelled(!silentMode());
|
event.setCancelled(!silentMode());
|
||||||
return;
|
return;
|
||||||
@@ -332,26 +332,26 @@ public class PlayerListener extends EventListener {
|
|||||||
log(result.getMessage(), player, CheckType.SPRINT);
|
log(result.getMessage(), player, CheckType.SPRINT);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (getCheckManager().willCheckQuick(player, CheckType.FLY) && !VersionUtil.isFlying(player)) {
|
if (getCheckManager().willCheckQuick(player, CheckType.FLIGHT) && !VersionUtil.isFlying(player)) {
|
||||||
CheckResult result = FlightCheck.runCheck(player, distance);
|
CheckResult result = FlightCheck.runCheck(player, distance);
|
||||||
if (result.failed()) {
|
if (result.failed()) {
|
||||||
if (!silentMode()) {
|
if (!silentMode()) {
|
||||||
event.setTo(user.getGoodLocation(from.clone()));
|
event.setTo(user.getGoodLocation(from.clone()));
|
||||||
}
|
}
|
||||||
log(result.getMessage(), player, CheckType.FLY);
|
log(result.getMessage(), player, CheckType.FLIGHT);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (getCheckManager().willCheckQuick(player, CheckType.FLY) && !VersionUtil.isFlying(player)) {
|
if (getCheckManager().willCheckQuick(player, CheckType.FLIGHT) && !VersionUtil.isFlying(player)) {
|
||||||
CheckResult result = GlideCheck.runCheck(player, distance);
|
CheckResult result = GlideCheck.runCheck(player, distance);
|
||||||
if (result.failed()) {
|
if (result.failed()) {
|
||||||
// NO TELEPORT NEEDED HERE, HANDLED BY CHECK ITSELF
|
// NO TELEPORT NEEDED HERE, HANDLED BY CHECK ITSELF
|
||||||
log(result.getMessage(), player, CheckType.FLY);
|
log(result.getMessage(), player, CheckType.FLIGHT);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (getCheckManager().willCheckQuick(player, CheckType.FLY)) {
|
if (getCheckManager().willCheckQuick(player, CheckType.ELYTRA)) {
|
||||||
CheckResult result = ElytraFly.runCheck(player, distance);
|
CheckResult result = ElytraCheck.runCheck(player, distance);
|
||||||
if (result.failed()) {
|
if (result.failed()) {
|
||||||
log(result.getMessage(), player, CheckType.FLY);
|
log(result.getMessage(), player, CheckType.ELYTRA);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (getCheckManager().willCheckQuick(player, CheckType.VCLIP) && event.getFrom().getY() > event.getTo().getY()) {
|
if (getCheckManager().willCheckQuick(player, CheckType.VCLIP) && event.getFrom().getY() > event.getTo().getY()) {
|
||||||
@@ -370,7 +370,7 @@ public class PlayerListener extends EventListener {
|
|||||||
log(result.getMessage(), player, CheckType.VCLIP);
|
log(result.getMessage(), player, CheckType.VCLIP);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (getCheckManager().willCheckQuick(player, CheckType.NOFALL) && getCheckManager().willCheck(player, CheckType.FLY) && !Utilities.isClimbableBlock(player.getLocation().getBlock()) && event.getFrom().getY() > event.getTo().getY()) {
|
if (getCheckManager().willCheckQuick(player, CheckType.NOFALL) && getCheckManager().willCheck(player, CheckType.FLIGHT) && !Utilities.isClimbableBlock(player.getLocation().getBlock()) && event.getFrom().getY() > event.getTo().getY()) {
|
||||||
CheckResult result = getBackend().checkNoFall(player, y);
|
CheckResult result = getBackend().checkNoFall(player, y);
|
||||||
if (result.failed()) {
|
if (result.failed()) {
|
||||||
if (!silentMode()) {
|
if (!silentMode()) {
|
||||||
@@ -385,7 +385,7 @@ public class PlayerListener extends EventListener {
|
|||||||
if (event.getTo() != event.getFrom()) {
|
if (event.getTo() != event.getFrom()) {
|
||||||
double x = distance.getXDifference();
|
double x = distance.getXDifference();
|
||||||
double z = distance.getZDifference();
|
double z = distance.getZDifference();
|
||||||
if (getCheckManager().willCheckQuick(player, CheckType.SPEED) && getCheckManager().willCheck(player, CheckType.FLY)) {
|
if (getCheckManager().willCheckQuick(player, CheckType.SPEED) && getCheckManager().willCheck(player, CheckType.FLIGHT)) {
|
||||||
if (event.getFrom().getY() < event.getTo().getY()) {
|
if (event.getFrom().getY() < event.getTo().getY()) {
|
||||||
CheckResult result = getBackend().checkYSpeed(player, y);
|
CheckResult result = getBackend().checkYSpeed(player, y);
|
||||||
if (result.failed()) {
|
if (result.failed()) {
|
||||||
@@ -462,7 +462,7 @@ public class PlayerListener extends EventListener {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (getCheckManager().willCheck(player, CheckType.FLY) && !player.isFlying()) {
|
if (getCheckManager().willCheck(player, CheckType.FLIGHT) && !player.isFlying()) {
|
||||||
CheckResult result1 = YAxisCheck.runCheck(player, new Distance(from, to));
|
CheckResult result1 = YAxisCheck.runCheck(player, new Distance(from, to));
|
||||||
CheckResult result2 = getBackend().checkAscension(player, from.getY(), to.getY());
|
CheckResult result2 = getBackend().checkAscension(player, from.getY(), to.getY());
|
||||||
String log = result1.failed() ? result1.getMessage() : result2.failed() ? result2.getMessage() : "";
|
String log = result1.failed() ? result1.getMessage() : result2.failed() ? result2.getMessage() : "";
|
||||||
@@ -470,7 +470,7 @@ public class PlayerListener extends EventListener {
|
|||||||
if (!silentMode()) {
|
if (!silentMode()) {
|
||||||
event.setTo(user.getGoodLocation(from.clone()));
|
event.setTo(user.getGoodLocation(from.clone()));
|
||||||
}
|
}
|
||||||
log(log, player, CheckType.FLY);
|
log(log, player, CheckType.FLIGHT);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -19,6 +19,7 @@
|
|||||||
|
|
||||||
package com.rammelkast.anticheatreloaded.event;
|
package com.rammelkast.anticheatreloaded.event;
|
||||||
|
|
||||||
|
import org.bukkit.entity.Entity;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.event.EventHandler;
|
import org.bukkit.event.EventHandler;
|
||||||
import org.bukkit.event.vehicle.VehicleDestroyEvent;
|
import org.bukkit.event.vehicle.VehicleDestroyEvent;
|
||||||
@@ -48,12 +49,20 @@ public class VehicleListener extends EventListener {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Deprecated
|
|
||||||
@EventHandler(ignoreCancelled = true)
|
@EventHandler(ignoreCancelled = true)
|
||||||
public void onVehicleDestroy(VehicleDestroyEvent event) {
|
public void onVehicleDestroy(VehicleDestroyEvent event) {
|
||||||
// TODO fix deprecations
|
// TODO fix deprecations
|
||||||
if (event.getVehicle().getPassenger() != null && event.getVehicle().getPassenger() instanceof Player) {
|
//if (event.getVehicle().getPassenger() != null && event.getVehicle().getPassenger() instanceof Player) {
|
||||||
getBackend().logEnterExit((Player) event.getVehicle().getPassenger());
|
// getBackend().logEnterExit((Player) event.getVehicle().getPassenger());
|
||||||
|
//}
|
||||||
|
|
||||||
|
// TODO this should work, untested though.
|
||||||
|
if (!event.getVehicle().getPassengers().isEmpty()) {
|
||||||
|
for (Entity entity: event.getVehicle().getPassengers()) {
|
||||||
|
if (entity instanceof Player) {
|
||||||
|
getBackend().logEnterExit((Player) entity);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
AntiCheatReloaded.getManager().addEvent(event.getEventName(), event.getHandlers().getRegisteredListeners());
|
AntiCheatReloaded.getManager().addEvent(event.getEventName(), event.getHandlers().getRegisteredListeners());
|
||||||
|
|||||||
@@ -25,6 +25,7 @@ import org.bukkit.entity.Player;
|
|||||||
import com.rammelkast.anticheatreloaded.AntiCheatReloaded;
|
import com.rammelkast.anticheatreloaded.AntiCheatReloaded;
|
||||||
import com.rammelkast.anticheatreloaded.check.CheckType;
|
import com.rammelkast.anticheatreloaded.check.CheckType;
|
||||||
import com.rammelkast.anticheatreloaded.config.Configuration;
|
import com.rammelkast.anticheatreloaded.config.Configuration;
|
||||||
|
import com.rammelkast.anticheatreloaded.util.VersionUtil;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
@@ -177,8 +178,7 @@ public class CheckManager {
|
|||||||
&& !type.checkPermission(player)
|
&& !type.checkPermission(player)
|
||||||
&& !isOpExempt(player);
|
&& !isOpExempt(player);
|
||||||
AntiCheatReloaded.debugLog("Check " + type + (check ? " run " : " not run ") + "on " + player.getName());
|
AntiCheatReloaded.debugLog("Check " + type + (check ? " run " : " not run ") + "on " + player.getName());
|
||||||
// TODO temp fix
|
if ((type == CheckType.FLIGHT || type == CheckType.SPEED) && VersionUtil.isFlying(player))
|
||||||
if ((type == CheckType.FLY || type == CheckType.SPEED) && player.isFlying())
|
|
||||||
return false;
|
return false;
|
||||||
return check;
|
return check;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,58 +0,0 @@
|
|||||||
/*
|
|
||||||
* AntiCheatReloaded for Bukkit and Spigot.
|
|
||||||
* Copyright (c) 2012-2015 AntiCheat Team | http://gravitydevelopment.net
|
|
||||||
* Copyright (c) 2016-2018 Rammelkast | https://rammelkast.com
|
|
||||||
*
|
|
||||||
* This program is free software: you can redistribute it and/or modify
|
|
||||||
* it under the terms of the GNU General Public License as published by
|
|
||||||
* the Free Software Foundation, either version 3 of the License, or
|
|
||||||
* (at your option) any later version.
|
|
||||||
*
|
|
||||||
* This program is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License
|
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
|
|
||||||
package com.rammelkast.anticheatreloaded.manage;
|
|
||||||
|
|
||||||
import com.comphenix.protocol.PacketType;
|
|
||||||
import com.comphenix.protocol.ProtocolManager;
|
|
||||||
import com.comphenix.protocol.events.ListenerPriority;
|
|
||||||
import com.comphenix.protocol.events.PacketAdapter;
|
|
||||||
import com.comphenix.protocol.events.PacketContainer;
|
|
||||||
import com.comphenix.protocol.events.PacketEvent;
|
|
||||||
import com.rammelkast.anticheatreloaded.AntiCheatReloaded;
|
|
||||||
|
|
||||||
public class PacketManager {
|
|
||||||
|
|
||||||
private ProtocolManager protocolManager;
|
|
||||||
private AntiCheatReloaded plugin;
|
|
||||||
private AntiCheatManager manager;
|
|
||||||
|
|
||||||
public PacketManager(ProtocolManager protocolManager, AntiCheatReloaded plugin, AntiCheatManager manager) {
|
|
||||||
this.protocolManager = protocolManager;
|
|
||||||
this.plugin = plugin;
|
|
||||||
this.manager = manager;
|
|
||||||
addListeners();
|
|
||||||
}
|
|
||||||
|
|
||||||
private void addListeners() {
|
|
||||||
// Arm Animation
|
|
||||||
protocolManager.addPacketListener(new PacketAdapter(plugin,
|
|
||||||
ListenerPriority.NORMAL,
|
|
||||||
PacketType.Play.Client.ARM_ANIMATION) {
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onPacketReceiving(PacketEvent event) {
|
|
||||||
if (event.getPacketType() == PacketType.Play.Client.ARM_ANIMATION) {
|
|
||||||
PacketContainer packet = event.getPacket();
|
|
||||||
//System.out.println("Arm animation from "+packet.getIntegers().read(0));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -94,14 +94,15 @@ public class Metrics {
|
|||||||
|
|
||||||
// Inform the server owners about bStats
|
// Inform the server owners about bStats
|
||||||
config.options().header(
|
config.options().header(
|
||||||
"bStats collects some data for plugin authors like how many servers are using their plugins.\n" +
|
"bStats collects some data for plugin authors like how many servers are using their plugins.\n"
|
||||||
"To honor their work, you should not disable it.\n" +
|
+ "To honor their work, you should not disable it.\n"
|
||||||
"This has nearly no effect on the server performance!\n" +
|
+ "This has nearly no effect on the server performance!\n"
|
||||||
"Check out https://bStats.org/ to learn more :)"
|
+ "Check out https://bStats.org/ to learn more :)")
|
||||||
).copyDefaults(true);
|
.copyDefaults(true);
|
||||||
try {
|
try {
|
||||||
config.save(configFile);
|
config.save(configFile);
|
||||||
} catch (IOException ignored) { }
|
} catch (IOException ignored) {
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Load the data
|
// Load the data
|
||||||
@@ -115,7 +116,8 @@ public class Metrics {
|
|||||||
service.getField("B_STATS_VERSION"); // Our identifier :)
|
service.getField("B_STATS_VERSION"); // Our identifier :)
|
||||||
found = true; // We aren't the first
|
found = true; // We aren't the first
|
||||||
break;
|
break;
|
||||||
} catch (NoSuchFieldException ignored) { }
|
} catch (NoSuchFieldException ignored) {
|
||||||
|
}
|
||||||
}
|
}
|
||||||
// Register our service
|
// Register our service
|
||||||
Bukkit.getServicesManager().register(Metrics.class, this, plugin, ServicePriority.Normal);
|
Bukkit.getServicesManager().register(Metrics.class, this, plugin, ServicePriority.Normal);
|
||||||
@@ -150,8 +152,10 @@ public class Metrics {
|
|||||||
timer.cancel();
|
timer.cancel();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
// Nevertheless we want our code to run in the Bukkit main thread, so we have to use the Bukkit scheduler
|
// Nevertheless we want our code to run in the Bukkit main thread, so we have to
|
||||||
// Don't be afraid! The connection to the bStats server is still async, only the stats collection is sync ;)
|
// use the Bukkit scheduler
|
||||||
|
// Don't be afraid! The connection to the bStats server is still async, only the
|
||||||
|
// stats collection is sync ;)
|
||||||
Bukkit.getScheduler().runTask(plugin, new Runnable() {
|
Bukkit.getScheduler().runTask(plugin, new Runnable() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
@@ -159,15 +163,16 @@ public class Metrics {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}, 1000*60*5, 1000*60*30);
|
}, 1000 * 60 * 5, 1000 * 60 * 30);
|
||||||
// Submit the data every 30 minutes, first time after 5 minutes to give other plugins enough time to start
|
// Submit the data every 30 minutes, first time after 5 minutes to give other
|
||||||
// WARNING: Changing the frequency has no effect but your plugin WILL be blocked/deleted!
|
// plugins enough time to start
|
||||||
|
// WARNING: Changing the frequency has no effect but your plugin WILL be
|
||||||
|
// blocked/deleted!
|
||||||
// WARNING: Just don't do it!
|
// WARNING: Just don't do it!
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the plugin specific data.
|
* Gets the plugin specific data. This method is called using Reflection.
|
||||||
* This method is called using Reflection.
|
|
||||||
*
|
*
|
||||||
* @return The plugin specific data.
|
* @return The plugin specific data.
|
||||||
*/
|
*/
|
||||||
@@ -246,7 +251,8 @@ public class Metrics {
|
|||||||
// Found one!
|
// Found one!
|
||||||
try {
|
try {
|
||||||
pluginData.add(service.getMethod("getPluginData").invoke(Bukkit.getServicesManager().load(service)));
|
pluginData.add(service.getMethod("getPluginData").invoke(Bukkit.getServicesManager().load(service)));
|
||||||
} catch (NoSuchMethodException | IllegalAccessException | InvocationTargetException ignored) { }
|
} catch (NoSuchMethodException | IllegalAccessException | InvocationTargetException ignored) {
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
data.put("plugins", pluginData);
|
data.put("plugins", pluginData);
|
||||||
@@ -261,7 +267,8 @@ public class Metrics {
|
|||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
// Something went wrong! :(
|
// Something went wrong! :(
|
||||||
if (logFailedRequests) {
|
if (logFailedRequests) {
|
||||||
plugin.getLogger().log(Level.WARNING, "Could not submit plugin stats of " + plugin.getName(), e);
|
plugin.getLogger().log(Level.WARNING, "Could not submit plugin stats of " + plugin.getName(),
|
||||||
|
e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -418,8 +425,8 @@ public class Metrics {
|
|||||||
/**
|
/**
|
||||||
* Gets the values of the pie.
|
* Gets the values of the pie.
|
||||||
*
|
*
|
||||||
* @param valueMap Just an empty map. The only reason it exists is to make your life easier.
|
* @param valueMap Just an empty map. The only reason it exists is to make your
|
||||||
* You don't have to create a map yourself!
|
* life easier. You don't have to create a map yourself!
|
||||||
* @return The values of the pie.
|
* @return The values of the pie.
|
||||||
*/
|
*/
|
||||||
public abstract HashMap<String, Integer> getValues(HashMap<String, Integer> valueMap);
|
public abstract HashMap<String, Integer> getValues(HashMap<String, Integer> valueMap);
|
||||||
@@ -502,8 +509,8 @@ public class Metrics {
|
|||||||
/**
|
/**
|
||||||
* Gets the values of the chart.
|
* Gets the values of the chart.
|
||||||
*
|
*
|
||||||
* @param valueMap Just an empty map. The only reason it exists is to make your life easier.
|
* @param valueMap Just an empty map. The only reason it exists is to make your
|
||||||
* You don't have to create a map yourself!
|
* life easier. You don't have to create a map yourself!
|
||||||
* @return The values of the chart.
|
* @return The values of the chart.
|
||||||
*/
|
*/
|
||||||
public abstract HashMap<String, Integer> getValues(HashMap<String, Integer> valueMap);
|
public abstract HashMap<String, Integer> getValues(HashMap<String, Integer> valueMap);
|
||||||
@@ -552,8 +559,8 @@ public class Metrics {
|
|||||||
/**
|
/**
|
||||||
* Gets the value of the chart.
|
* Gets the value of the chart.
|
||||||
*
|
*
|
||||||
* @param valueMap Just an empty map. The only reason it exists is to make your life easier.
|
* @param valueMap Just an empty map. The only reason it exists is to make your
|
||||||
* You don't have to create a map yourself!
|
* life easier. You don't have to create a map yourself!
|
||||||
* @return The value of the chart.
|
* @return The value of the chart.
|
||||||
*/
|
*/
|
||||||
public abstract HashMap<String, Integer> getValues(HashMap<String, Integer> valueMap);
|
public abstract HashMap<String, Integer> getValues(HashMap<String, Integer> valueMap);
|
||||||
@@ -595,8 +602,8 @@ public class Metrics {
|
|||||||
/**
|
/**
|
||||||
* Gets the value of the chart.
|
* Gets the value of the chart.
|
||||||
*
|
*
|
||||||
* @param valueMap Just an empty map. The only reason it exists is to make your life easier.
|
* @param valueMap Just an empty map. The only reason it exists is to make your
|
||||||
* You don't have to create a map yourself!
|
* life easier. You don't have to create a map yourself!
|
||||||
* @return The value of the chart.
|
* @return The value of the chart.
|
||||||
*/
|
*/
|
||||||
public abstract HashMap<String, int[]> getValues(HashMap<String, int[]> valueMap);
|
public abstract HashMap<String, int[]> getValues(HashMap<String, int[]> valueMap);
|
||||||
@@ -685,8 +692,8 @@ public class Metrics {
|
|||||||
/**
|
/**
|
||||||
* Gets the value of the chart.
|
* Gets the value of the chart.
|
||||||
*
|
*
|
||||||
* @param valueMap Just an empty map. The only reason it exists is to make your life easier.
|
* @param valueMap Just an empty map. The only reason it exists is to make your
|
||||||
* You don't have to create a map yourself!
|
* life easier. You don't have to create a map yourself!
|
||||||
* @return The value of the chart.
|
* @return The value of the chart.
|
||||||
*/
|
*/
|
||||||
public abstract HashMap<Country, Integer> getValues(HashMap<Country, Integer> valueMap);
|
public abstract HashMap<Country, Integer> getValues(HashMap<Country, Integer> valueMap);
|
||||||
@@ -728,255 +735,89 @@ public class Metrics {
|
|||||||
*/
|
*/
|
||||||
AUTO_DETECT("AUTO", "Auto Detected"),
|
AUTO_DETECT("AUTO", "Auto Detected"),
|
||||||
|
|
||||||
ANDORRA("AD", "Andorra"),
|
ANDORRA("AD", "Andorra"), UNITED_ARAB_EMIRATES("AE", "United Arab Emirates"), AFGHANISTAN("AF", "Afghanistan"),
|
||||||
UNITED_ARAB_EMIRATES("AE", "United Arab Emirates"),
|
ANTIGUA_AND_BARBUDA("AG", "Antigua and Barbuda"), ANGUILLA("AI", "Anguilla"), ALBANIA("AL", "Albania"),
|
||||||
AFGHANISTAN("AF", "Afghanistan"),
|
ARMENIA("AM", "Armenia"), NETHERLANDS_ANTILLES("AN", "Netherlands Antilles"), ANGOLA("AO", "Angola"),
|
||||||
ANTIGUA_AND_BARBUDA("AG", "Antigua and Barbuda"),
|
ANTARCTICA("AQ", "Antarctica"), ARGENTINA("AR", "Argentina"), AMERICAN_SAMOA("AS", "American Samoa"),
|
||||||
ANGUILLA("AI", "Anguilla"),
|
AUSTRIA("AT", "Austria"), AUSTRALIA("AU", "Australia"), ARUBA("AW", "Aruba"),
|
||||||
ALBANIA("AL", "Albania"),
|
ÅLAND_ISLANDS("AX", "Åland Islands"), AZERBAIJAN("AZ", "Azerbaijan"),
|
||||||
ARMENIA("AM", "Armenia"),
|
BOSNIA_AND_HERZEGOVINA("BA", "Bosnia and Herzegovina"), BARBADOS("BB", "Barbados"),
|
||||||
NETHERLANDS_ANTILLES("AN", "Netherlands Antilles"),
|
BANGLADESH("BD", "Bangladesh"), BELGIUM("BE", "Belgium"), BURKINA_FASO("BF", "Burkina Faso"),
|
||||||
ANGOLA("AO", "Angola"),
|
BULGARIA("BG", "Bulgaria"), BAHRAIN("BH", "Bahrain"), BURUNDI("BI", "Burundi"), BENIN("BJ", "Benin"),
|
||||||
ANTARCTICA("AQ", "Antarctica"),
|
SAINT_BARTHÉLEMY("BL", "Saint Barthélemy"), BERMUDA("BM", "Bermuda"), BRUNEI("BN", "Brunei"),
|
||||||
ARGENTINA("AR", "Argentina"),
|
BOLIVIA("BO", "Bolivia"), BONAIRE_SINT_EUSTATIUS_AND_SABA("BQ", "Bonaire, Sint Eustatius and Saba"),
|
||||||
AMERICAN_SAMOA("AS", "American Samoa"),
|
BRAZIL("BR", "Brazil"), BAHAMAS("BS", "Bahamas"), BHUTAN("BT", "Bhutan"), BOUVET_ISLAND("BV", "Bouvet Island"),
|
||||||
AUSTRIA("AT", "Austria"),
|
BOTSWANA("BW", "Botswana"), BELARUS("BY", "Belarus"), BELIZE("BZ", "Belize"), CANADA("CA", "Canada"),
|
||||||
AUSTRALIA("AU", "Australia"),
|
|
||||||
ARUBA("AW", "Aruba"),
|
|
||||||
ÅLAND_ISLANDS("AX", "Åland Islands"),
|
|
||||||
AZERBAIJAN("AZ", "Azerbaijan"),
|
|
||||||
BOSNIA_AND_HERZEGOVINA("BA", "Bosnia and Herzegovina"),
|
|
||||||
BARBADOS("BB", "Barbados"),
|
|
||||||
BANGLADESH("BD", "Bangladesh"),
|
|
||||||
BELGIUM("BE", "Belgium"),
|
|
||||||
BURKINA_FASO("BF", "Burkina Faso"),
|
|
||||||
BULGARIA("BG", "Bulgaria"),
|
|
||||||
BAHRAIN("BH", "Bahrain"),
|
|
||||||
BURUNDI("BI", "Burundi"),
|
|
||||||
BENIN("BJ", "Benin"),
|
|
||||||
SAINT_BARTHÉLEMY("BL", "Saint Barthélemy"),
|
|
||||||
BERMUDA("BM", "Bermuda"),
|
|
||||||
BRUNEI("BN", "Brunei"),
|
|
||||||
BOLIVIA("BO", "Bolivia"),
|
|
||||||
BONAIRE_SINT_EUSTATIUS_AND_SABA("BQ", "Bonaire, Sint Eustatius and Saba"),
|
|
||||||
BRAZIL("BR", "Brazil"),
|
|
||||||
BAHAMAS("BS", "Bahamas"),
|
|
||||||
BHUTAN("BT", "Bhutan"),
|
|
||||||
BOUVET_ISLAND("BV", "Bouvet Island"),
|
|
||||||
BOTSWANA("BW", "Botswana"),
|
|
||||||
BELARUS("BY", "Belarus"),
|
|
||||||
BELIZE("BZ", "Belize"),
|
|
||||||
CANADA("CA", "Canada"),
|
|
||||||
COCOS_ISLANDS("CC", "Cocos Islands"),
|
COCOS_ISLANDS("CC", "Cocos Islands"),
|
||||||
THE_DEMOCRATIC_REPUBLIC_OF_CONGO("CD", "The Democratic Republic Of Congo"),
|
THE_DEMOCRATIC_REPUBLIC_OF_CONGO("CD", "The Democratic Republic Of Congo"),
|
||||||
CENTRAL_AFRICAN_REPUBLIC("CF", "Central African Republic"),
|
CENTRAL_AFRICAN_REPUBLIC("CF", "Central African Republic"), CONGO("CG", "Congo"),
|
||||||
CONGO("CG", "Congo"),
|
SWITZERLAND("CH", "Switzerland"), CÔTE_D_IVOIRE("CI", "Côte d'Ivoire"), COOK_ISLANDS("CK", "Cook Islands"),
|
||||||
SWITZERLAND("CH", "Switzerland"),
|
CHILE("CL", "Chile"), CAMEROON("CM", "Cameroon"), CHINA("CN", "China"), COLOMBIA("CO", "Colombia"),
|
||||||
CÔTE_D_IVOIRE("CI", "Côte d'Ivoire"),
|
COSTA_RICA("CR", "Costa Rica"), CUBA("CU", "Cuba"), CAPE_VERDE("CV", "Cape Verde"), CURAÇAO("CW", "Curaçao"),
|
||||||
COOK_ISLANDS("CK", "Cook Islands"),
|
CHRISTMAS_ISLAND("CX", "Christmas Island"), CYPRUS("CY", "Cyprus"), CZECH_REPUBLIC("CZ", "Czech Republic"),
|
||||||
CHILE("CL", "Chile"),
|
GERMANY("DE", "Germany"), DJIBOUTI("DJ", "Djibouti"), DENMARK("DK", "Denmark"), DOMINICA("DM", "Dominica"),
|
||||||
CAMEROON("CM", "Cameroon"),
|
DOMINICAN_REPUBLIC("DO", "Dominican Republic"), ALGERIA("DZ", "Algeria"), ECUADOR("EC", "Ecuador"),
|
||||||
CHINA("CN", "China"),
|
ESTONIA("EE", "Estonia"), EGYPT("EG", "Egypt"), WESTERN_SAHARA("EH", "Western Sahara"),
|
||||||
COLOMBIA("CO", "Colombia"),
|
ERITREA("ER", "Eritrea"), SPAIN("ES", "Spain"), ETHIOPIA("ET", "Ethiopia"), FINLAND("FI", "Finland"),
|
||||||
COSTA_RICA("CR", "Costa Rica"),
|
FIJI("FJ", "Fiji"), FALKLAND_ISLANDS("FK", "Falkland Islands"), MICRONESIA("FM", "Micronesia"),
|
||||||
CUBA("CU", "Cuba"),
|
FAROE_ISLANDS("FO", "Faroe Islands"), FRANCE("FR", "France"), GABON("GA", "Gabon"),
|
||||||
CAPE_VERDE("CV", "Cape Verde"),
|
UNITED_KINGDOM("GB", "United Kingdom"), GRENADA("GD", "Grenada"), GEORGIA("GE", "Georgia"),
|
||||||
CURAÇAO("CW", "Curaçao"),
|
FRENCH_GUIANA("GF", "French Guiana"), GUERNSEY("GG", "Guernsey"), GHANA("GH", "Ghana"),
|
||||||
CHRISTMAS_ISLAND("CX", "Christmas Island"),
|
GIBRALTAR("GI", "Gibraltar"), GREENLAND("GL", "Greenland"), GAMBIA("GM", "Gambia"), GUINEA("GN", "Guinea"),
|
||||||
CYPRUS("CY", "Cyprus"),
|
GUADELOUPE("GP", "Guadeloupe"), EQUATORIAL_GUINEA("GQ", "Equatorial Guinea"), GREECE("GR", "Greece"),
|
||||||
CZECH_REPUBLIC("CZ", "Czech Republic"),
|
|
||||||
GERMANY("DE", "Germany"),
|
|
||||||
DJIBOUTI("DJ", "Djibouti"),
|
|
||||||
DENMARK("DK", "Denmark"),
|
|
||||||
DOMINICA("DM", "Dominica"),
|
|
||||||
DOMINICAN_REPUBLIC("DO", "Dominican Republic"),
|
|
||||||
ALGERIA("DZ", "Algeria"),
|
|
||||||
ECUADOR("EC", "Ecuador"),
|
|
||||||
ESTONIA("EE", "Estonia"),
|
|
||||||
EGYPT("EG", "Egypt"),
|
|
||||||
WESTERN_SAHARA("EH", "Western Sahara"),
|
|
||||||
ERITREA("ER", "Eritrea"),
|
|
||||||
SPAIN("ES", "Spain"),
|
|
||||||
ETHIOPIA("ET", "Ethiopia"),
|
|
||||||
FINLAND("FI", "Finland"),
|
|
||||||
FIJI("FJ", "Fiji"),
|
|
||||||
FALKLAND_ISLANDS("FK", "Falkland Islands"),
|
|
||||||
MICRONESIA("FM", "Micronesia"),
|
|
||||||
FAROE_ISLANDS("FO", "Faroe Islands"),
|
|
||||||
FRANCE("FR", "France"),
|
|
||||||
GABON("GA", "Gabon"),
|
|
||||||
UNITED_KINGDOM("GB", "United Kingdom"),
|
|
||||||
GRENADA("GD", "Grenada"),
|
|
||||||
GEORGIA("GE", "Georgia"),
|
|
||||||
FRENCH_GUIANA("GF", "French Guiana"),
|
|
||||||
GUERNSEY("GG", "Guernsey"),
|
|
||||||
GHANA("GH", "Ghana"),
|
|
||||||
GIBRALTAR("GI", "Gibraltar"),
|
|
||||||
GREENLAND("GL", "Greenland"),
|
|
||||||
GAMBIA("GM", "Gambia"),
|
|
||||||
GUINEA("GN", "Guinea"),
|
|
||||||
GUADELOUPE("GP", "Guadeloupe"),
|
|
||||||
EQUATORIAL_GUINEA("GQ", "Equatorial Guinea"),
|
|
||||||
GREECE("GR", "Greece"),
|
|
||||||
SOUTH_GEORGIA_AND_THE_SOUTH_SANDWICH_ISLANDS("GS", "South Georgia And The South Sandwich Islands"),
|
SOUTH_GEORGIA_AND_THE_SOUTH_SANDWICH_ISLANDS("GS", "South Georgia And The South Sandwich Islands"),
|
||||||
GUATEMALA("GT", "Guatemala"),
|
GUATEMALA("GT", "Guatemala"), GUAM("GU", "Guam"), GUINEA_BISSAU("GW", "Guinea-Bissau"), GUYANA("GY", "Guyana"),
|
||||||
GUAM("GU", "Guam"),
|
HONG_KONG("HK", "Hong Kong"), HEARD_ISLAND_AND_MCDONALD_ISLANDS("HM", "Heard Island And McDonald Islands"),
|
||||||
GUINEA_BISSAU("GW", "Guinea-Bissau"),
|
HONDURAS("HN", "Honduras"), CROATIA("HR", "Croatia"), HAITI("HT", "Haiti"), HUNGARY("HU", "Hungary"),
|
||||||
GUYANA("GY", "Guyana"),
|
INDONESIA("ID", "Indonesia"), IRELAND("IE", "Ireland"), ISRAEL("IL", "Israel"),
|
||||||
HONG_KONG("HK", "Hong Kong"),
|
ISLE_OF_MAN("IM", "Isle Of Man"), INDIA("IN", "India"),
|
||||||
HEARD_ISLAND_AND_MCDONALD_ISLANDS("HM", "Heard Island And McDonald Islands"),
|
BRITISH_INDIAN_OCEAN_TERRITORY("IO", "British Indian Ocean Territory"), IRAQ("IQ", "Iraq"), IRAN("IR", "Iran"),
|
||||||
HONDURAS("HN", "Honduras"),
|
ICELAND("IS", "Iceland"), ITALY("IT", "Italy"), JERSEY("JE", "Jersey"), JAMAICA("JM", "Jamaica"),
|
||||||
CROATIA("HR", "Croatia"),
|
JORDAN("JO", "Jordan"), JAPAN("JP", "Japan"), KENYA("KE", "Kenya"), KYRGYZSTAN("KG", "Kyrgyzstan"),
|
||||||
HAITI("HT", "Haiti"),
|
CAMBODIA("KH", "Cambodia"), KIRIBATI("KI", "Kiribati"), COMOROS("KM", "Comoros"),
|
||||||
HUNGARY("HU", "Hungary"),
|
SAINT_KITTS_AND_NEVIS("KN", "Saint Kitts And Nevis"), NORTH_KOREA("KP", "North Korea"),
|
||||||
INDONESIA("ID", "Indonesia"),
|
SOUTH_KOREA("KR", "South Korea"), KUWAIT("KW", "Kuwait"), CAYMAN_ISLANDS("KY", "Cayman Islands"),
|
||||||
IRELAND("IE", "Ireland"),
|
KAZAKHSTAN("KZ", "Kazakhstan"), LAOS("LA", "Laos"), LEBANON("LB", "Lebanon"), SAINT_LUCIA("LC", "Saint Lucia"),
|
||||||
ISRAEL("IL", "Israel"),
|
LIECHTENSTEIN("LI", "Liechtenstein"), SRI_LANKA("LK", "Sri Lanka"), LIBERIA("LR", "Liberia"),
|
||||||
ISLE_OF_MAN("IM", "Isle Of Man"),
|
LESOTHO("LS", "Lesotho"), LITHUANIA("LT", "Lithuania"), LUXEMBOURG("LU", "Luxembourg"), LATVIA("LV", "Latvia"),
|
||||||
INDIA("IN", "India"),
|
LIBYA("LY", "Libya"), MOROCCO("MA", "Morocco"), MONACO("MC", "Monaco"), MOLDOVA("MD", "Moldova"),
|
||||||
BRITISH_INDIAN_OCEAN_TERRITORY("IO", "British Indian Ocean Territory"),
|
MONTENEGRO("ME", "Montenegro"), SAINT_MARTIN("MF", "Saint Martin"), MADAGASCAR("MG", "Madagascar"),
|
||||||
IRAQ("IQ", "Iraq"),
|
MARSHALL_ISLANDS("MH", "Marshall Islands"), MACEDONIA("MK", "Macedonia"), MALI("ML", "Mali"),
|
||||||
IRAN("IR", "Iran"),
|
MYANMAR("MM", "Myanmar"), MONGOLIA("MN", "Mongolia"), MACAO("MO", "Macao"),
|
||||||
ICELAND("IS", "Iceland"),
|
NORTHERN_MARIANA_ISLANDS("MP", "Northern Mariana Islands"), MARTINIQUE("MQ", "Martinique"),
|
||||||
ITALY("IT", "Italy"),
|
MAURITANIA("MR", "Mauritania"), MONTSERRAT("MS", "Montserrat"), MALTA("MT", "Malta"),
|
||||||
JERSEY("JE", "Jersey"),
|
MAURITIUS("MU", "Mauritius"), MALDIVES("MV", "Maldives"), MALAWI("MW", "Malawi"), MEXICO("MX", "Mexico"),
|
||||||
JAMAICA("JM", "Jamaica"),
|
MALAYSIA("MY", "Malaysia"), MOZAMBIQUE("MZ", "Mozambique"), NAMIBIA("NA", "Namibia"),
|
||||||
JORDAN("JO", "Jordan"),
|
NEW_CALEDONIA("NC", "New Caledonia"), NIGER("NE", "Niger"), NORFOLK_ISLAND("NF", "Norfolk Island"),
|
||||||
JAPAN("JP", "Japan"),
|
NIGERIA("NG", "Nigeria"), NICARAGUA("NI", "Nicaragua"), NETHERLANDS("NL", "Netherlands"),
|
||||||
KENYA("KE", "Kenya"),
|
NORWAY("NO", "Norway"), NEPAL("NP", "Nepal"), NAURU("NR", "Nauru"), NIUE("NU", "Niue"),
|
||||||
KYRGYZSTAN("KG", "Kyrgyzstan"),
|
NEW_ZEALAND("NZ", "New Zealand"), OMAN("OM", "Oman"), PANAMA("PA", "Panama"), PERU("PE", "Peru"),
|
||||||
CAMBODIA("KH", "Cambodia"),
|
FRENCH_POLYNESIA("PF", "French Polynesia"), PAPUA_NEW_GUINEA("PG", "Papua New Guinea"),
|
||||||
KIRIBATI("KI", "Kiribati"),
|
PHILIPPINES("PH", "Philippines"), PAKISTAN("PK", "Pakistan"), POLAND("PL", "Poland"),
|
||||||
COMOROS("KM", "Comoros"),
|
SAINT_PIERRE_AND_MIQUELON("PM", "Saint Pierre And Miquelon"), PITCAIRN("PN", "Pitcairn"),
|
||||||
SAINT_KITTS_AND_NEVIS("KN", "Saint Kitts And Nevis"),
|
PUERTO_RICO("PR", "Puerto Rico"), PALESTINE("PS", "Palestine"), PORTUGAL("PT", "Portugal"),
|
||||||
NORTH_KOREA("KP", "North Korea"),
|
PALAU("PW", "Palau"), PARAGUAY("PY", "Paraguay"), QATAR("QA", "Qatar"), REUNION("RE", "Reunion"),
|
||||||
SOUTH_KOREA("KR", "South Korea"),
|
ROMANIA("RO", "Romania"), SERBIA("RS", "Serbia"), RUSSIA("RU", "Russia"), RWANDA("RW", "Rwanda"),
|
||||||
KUWAIT("KW", "Kuwait"),
|
SAUDI_ARABIA("SA", "Saudi Arabia"), SOLOMON_ISLANDS("SB", "Solomon Islands"), SEYCHELLES("SC", "Seychelles"),
|
||||||
CAYMAN_ISLANDS("KY", "Cayman Islands"),
|
SUDAN("SD", "Sudan"), SWEDEN("SE", "Sweden"), SINGAPORE("SG", "Singapore"), SAINT_HELENA("SH", "Saint Helena"),
|
||||||
KAZAKHSTAN("KZ", "Kazakhstan"),
|
SLOVENIA("SI", "Slovenia"), SVALBARD_AND_JAN_MAYEN("SJ", "Svalbard And Jan Mayen"), SLOVAKIA("SK", "Slovakia"),
|
||||||
LAOS("LA", "Laos"),
|
SIERRA_LEONE("SL", "Sierra Leone"), SAN_MARINO("SM", "San Marino"), SENEGAL("SN", "Senegal"),
|
||||||
LEBANON("LB", "Lebanon"),
|
SOMALIA("SO", "Somalia"), SURINAME("SR", "Suriname"), SOUTH_SUDAN("SS", "South Sudan"),
|
||||||
SAINT_LUCIA("LC", "Saint Lucia"),
|
SAO_TOME_AND_PRINCIPE("ST", "Sao Tome And Principe"), EL_SALVADOR("SV", "El Salvador"),
|
||||||
LIECHTENSTEIN("LI", "Liechtenstein"),
|
SINT_MAARTEN_DUTCH_PART("SX", "Sint Maarten (Dutch part)"), SYRIA("SY", "Syria"), SWAZILAND("SZ", "Swaziland"),
|
||||||
SRI_LANKA("LK", "Sri Lanka"),
|
TURKS_AND_CAICOS_ISLANDS("TC", "Turks And Caicos Islands"), CHAD("TD", "Chad"),
|
||||||
LIBERIA("LR", "Liberia"),
|
FRENCH_SOUTHERN_TERRITORIES("TF", "French Southern Territories"), TOGO("TG", "Togo"),
|
||||||
LESOTHO("LS", "Lesotho"),
|
THAILAND("TH", "Thailand"), TAJIKISTAN("TJ", "Tajikistan"), TOKELAU("TK", "Tokelau"),
|
||||||
LITHUANIA("LT", "Lithuania"),
|
TIMOR_LESTE("TL", "Timor-Leste"), TURKMENISTAN("TM", "Turkmenistan"), TUNISIA("TN", "Tunisia"),
|
||||||
LUXEMBOURG("LU", "Luxembourg"),
|
TONGA("TO", "Tonga"), TURKEY("TR", "Turkey"), TRINIDAD_AND_TOBAGO("TT", "Trinidad and Tobago"),
|
||||||
LATVIA("LV", "Latvia"),
|
TUVALU("TV", "Tuvalu"), TAIWAN("TW", "Taiwan"), TANZANIA("TZ", "Tanzania"), UKRAINE("UA", "Ukraine"),
|
||||||
LIBYA("LY", "Libya"),
|
UGANDA("UG", "Uganda"), UNITED_STATES_MINOR_OUTLYING_ISLANDS("UM", "United States Minor Outlying Islands"),
|
||||||
MOROCCO("MA", "Morocco"),
|
UNITED_STATES("US", "United States"), URUGUAY("UY", "Uruguay"), UZBEKISTAN("UZ", "Uzbekistan"),
|
||||||
MONACO("MC", "Monaco"),
|
VATICAN("VA", "Vatican"), SAINT_VINCENT_AND_THE_GRENADINES("VC", "Saint Vincent And The Grenadines"),
|
||||||
MOLDOVA("MD", "Moldova"),
|
VENEZUELA("VE", "Venezuela"), BRITISH_VIRGIN_ISLANDS("VG", "British Virgin Islands"),
|
||||||
MONTENEGRO("ME", "Montenegro"),
|
U_S__VIRGIN_ISLANDS("VI", "U.S. Virgin Islands"), VIETNAM("VN", "Vietnam"), VANUATU("VU", "Vanuatu"),
|
||||||
SAINT_MARTIN("MF", "Saint Martin"),
|
WALLIS_AND_FUTUNA("WF", "Wallis And Futuna"), SAMOA("WS", "Samoa"), YEMEN("YE", "Yemen"),
|
||||||
MADAGASCAR("MG", "Madagascar"),
|
MAYOTTE("YT", "Mayotte"), SOUTH_AFRICA("ZA", "South Africa"), ZAMBIA("ZM", "Zambia"),
|
||||||
MARSHALL_ISLANDS("MH", "Marshall Islands"),
|
|
||||||
MACEDONIA("MK", "Macedonia"),
|
|
||||||
MALI("ML", "Mali"),
|
|
||||||
MYANMAR("MM", "Myanmar"),
|
|
||||||
MONGOLIA("MN", "Mongolia"),
|
|
||||||
MACAO("MO", "Macao"),
|
|
||||||
NORTHERN_MARIANA_ISLANDS("MP", "Northern Mariana Islands"),
|
|
||||||
MARTINIQUE("MQ", "Martinique"),
|
|
||||||
MAURITANIA("MR", "Mauritania"),
|
|
||||||
MONTSERRAT("MS", "Montserrat"),
|
|
||||||
MALTA("MT", "Malta"),
|
|
||||||
MAURITIUS("MU", "Mauritius"),
|
|
||||||
MALDIVES("MV", "Maldives"),
|
|
||||||
MALAWI("MW", "Malawi"),
|
|
||||||
MEXICO("MX", "Mexico"),
|
|
||||||
MALAYSIA("MY", "Malaysia"),
|
|
||||||
MOZAMBIQUE("MZ", "Mozambique"),
|
|
||||||
NAMIBIA("NA", "Namibia"),
|
|
||||||
NEW_CALEDONIA("NC", "New Caledonia"),
|
|
||||||
NIGER("NE", "Niger"),
|
|
||||||
NORFOLK_ISLAND("NF", "Norfolk Island"),
|
|
||||||
NIGERIA("NG", "Nigeria"),
|
|
||||||
NICARAGUA("NI", "Nicaragua"),
|
|
||||||
NETHERLANDS("NL", "Netherlands"),
|
|
||||||
NORWAY("NO", "Norway"),
|
|
||||||
NEPAL("NP", "Nepal"),
|
|
||||||
NAURU("NR", "Nauru"),
|
|
||||||
NIUE("NU", "Niue"),
|
|
||||||
NEW_ZEALAND("NZ", "New Zealand"),
|
|
||||||
OMAN("OM", "Oman"),
|
|
||||||
PANAMA("PA", "Panama"),
|
|
||||||
PERU("PE", "Peru"),
|
|
||||||
FRENCH_POLYNESIA("PF", "French Polynesia"),
|
|
||||||
PAPUA_NEW_GUINEA("PG", "Papua New Guinea"),
|
|
||||||
PHILIPPINES("PH", "Philippines"),
|
|
||||||
PAKISTAN("PK", "Pakistan"),
|
|
||||||
POLAND("PL", "Poland"),
|
|
||||||
SAINT_PIERRE_AND_MIQUELON("PM", "Saint Pierre And Miquelon"),
|
|
||||||
PITCAIRN("PN", "Pitcairn"),
|
|
||||||
PUERTO_RICO("PR", "Puerto Rico"),
|
|
||||||
PALESTINE("PS", "Palestine"),
|
|
||||||
PORTUGAL("PT", "Portugal"),
|
|
||||||
PALAU("PW", "Palau"),
|
|
||||||
PARAGUAY("PY", "Paraguay"),
|
|
||||||
QATAR("QA", "Qatar"),
|
|
||||||
REUNION("RE", "Reunion"),
|
|
||||||
ROMANIA("RO", "Romania"),
|
|
||||||
SERBIA("RS", "Serbia"),
|
|
||||||
RUSSIA("RU", "Russia"),
|
|
||||||
RWANDA("RW", "Rwanda"),
|
|
||||||
SAUDI_ARABIA("SA", "Saudi Arabia"),
|
|
||||||
SOLOMON_ISLANDS("SB", "Solomon Islands"),
|
|
||||||
SEYCHELLES("SC", "Seychelles"),
|
|
||||||
SUDAN("SD", "Sudan"),
|
|
||||||
SWEDEN("SE", "Sweden"),
|
|
||||||
SINGAPORE("SG", "Singapore"),
|
|
||||||
SAINT_HELENA("SH", "Saint Helena"),
|
|
||||||
SLOVENIA("SI", "Slovenia"),
|
|
||||||
SVALBARD_AND_JAN_MAYEN("SJ", "Svalbard And Jan Mayen"),
|
|
||||||
SLOVAKIA("SK", "Slovakia"),
|
|
||||||
SIERRA_LEONE("SL", "Sierra Leone"),
|
|
||||||
SAN_MARINO("SM", "San Marino"),
|
|
||||||
SENEGAL("SN", "Senegal"),
|
|
||||||
SOMALIA("SO", "Somalia"),
|
|
||||||
SURINAME("SR", "Suriname"),
|
|
||||||
SOUTH_SUDAN("SS", "South Sudan"),
|
|
||||||
SAO_TOME_AND_PRINCIPE("ST", "Sao Tome And Principe"),
|
|
||||||
EL_SALVADOR("SV", "El Salvador"),
|
|
||||||
SINT_MAARTEN_DUTCH_PART("SX", "Sint Maarten (Dutch part)"),
|
|
||||||
SYRIA("SY", "Syria"),
|
|
||||||
SWAZILAND("SZ", "Swaziland"),
|
|
||||||
TURKS_AND_CAICOS_ISLANDS("TC", "Turks And Caicos Islands"),
|
|
||||||
CHAD("TD", "Chad"),
|
|
||||||
FRENCH_SOUTHERN_TERRITORIES("TF", "French Southern Territories"),
|
|
||||||
TOGO("TG", "Togo"),
|
|
||||||
THAILAND("TH", "Thailand"),
|
|
||||||
TAJIKISTAN("TJ", "Tajikistan"),
|
|
||||||
TOKELAU("TK", "Tokelau"),
|
|
||||||
TIMOR_LESTE("TL", "Timor-Leste"),
|
|
||||||
TURKMENISTAN("TM", "Turkmenistan"),
|
|
||||||
TUNISIA("TN", "Tunisia"),
|
|
||||||
TONGA("TO", "Tonga"),
|
|
||||||
TURKEY("TR", "Turkey"),
|
|
||||||
TRINIDAD_AND_TOBAGO("TT", "Trinidad and Tobago"),
|
|
||||||
TUVALU("TV", "Tuvalu"),
|
|
||||||
TAIWAN("TW", "Taiwan"),
|
|
||||||
TANZANIA("TZ", "Tanzania"),
|
|
||||||
UKRAINE("UA", "Ukraine"),
|
|
||||||
UGANDA("UG", "Uganda"),
|
|
||||||
UNITED_STATES_MINOR_OUTLYING_ISLANDS("UM", "United States Minor Outlying Islands"),
|
|
||||||
UNITED_STATES("US", "United States"),
|
|
||||||
URUGUAY("UY", "Uruguay"),
|
|
||||||
UZBEKISTAN("UZ", "Uzbekistan"),
|
|
||||||
VATICAN("VA", "Vatican"),
|
|
||||||
SAINT_VINCENT_AND_THE_GRENADINES("VC", "Saint Vincent And The Grenadines"),
|
|
||||||
VENEZUELA("VE", "Venezuela"),
|
|
||||||
BRITISH_VIRGIN_ISLANDS("VG", "British Virgin Islands"),
|
|
||||||
U_S__VIRGIN_ISLANDS("VI", "U.S. Virgin Islands"),
|
|
||||||
VIETNAM("VN", "Vietnam"),
|
|
||||||
VANUATU("VU", "Vanuatu"),
|
|
||||||
WALLIS_AND_FUTUNA("WF", "Wallis And Futuna"),
|
|
||||||
SAMOA("WS", "Samoa"),
|
|
||||||
YEMEN("YE", "Yemen"),
|
|
||||||
MAYOTTE("YT", "Mayotte"),
|
|
||||||
SOUTH_AFRICA("ZA", "South Africa"),
|
|
||||||
ZAMBIA("ZM", "Zambia"),
|
|
||||||
ZIMBABWE("ZW", "Zimbabwe");
|
ZIMBABWE("ZW", "Zimbabwe");
|
||||||
|
|
||||||
private String isoTag;
|
private String isoTag;
|
||||||
@@ -1024,8 +865,8 @@ public class Metrics {
|
|||||||
* Gets a country by a locale.
|
* Gets a country by a locale.
|
||||||
*
|
*
|
||||||
* @param locale The locale.
|
* @param locale The locale.
|
||||||
* @return The country from the giben locale or <code>null</code> if unknown country or
|
* @return The country from the giben locale or <code>null</code> if unknown
|
||||||
* if the locale does not contain a country.
|
* country or if the locale does not contain a country.
|
||||||
*/
|
*/
|
||||||
public static Country byLocale(Locale locale) {
|
public static Country byLocale(Locale locale) {
|
||||||
return byIsoTag(locale.getCountry());
|
return byIsoTag(locale.getCountry());
|
||||||
|
|||||||
@@ -22,177 +22,37 @@ package com.rammelkast.anticheatreloaded.util;
|
|||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
|
|
||||||
public enum BlockHardness {
|
public enum BlockHardness {
|
||||||
STONE(1.50D),
|
STONE(1.50D), GRASS(0.60D), DIRT(0.50D), COBBLESTONE(2.00D), WOOD(2.00D), SAPLING(0.00D), WATER(100.00D),
|
||||||
GRASS(0.60D),
|
STATIONARY_WATER(100.00D), LAVA(0.00D), STATIONARY_LAVA(100.00D), SAND(0.50D), GRAVEL(0.60D), GOLD_ORE(3.00D),
|
||||||
DIRT(0.50D),
|
IRON_ORE(3.00D), COAL_ORE(3.00D), LOG(2.00D), LOG_2(2.00D), LEAVES(0.20D), LEAVES_2(0.20D), SPONGE(0.60D),
|
||||||
COBBLESTONE(2.00D),
|
GLASS(0.30D), LAPIS_ORE(3.00D), LAPIS_BLOCK(3.00D), DISPENSER(3.50D), DROPPER(3.50D), SANDSTONE(0.80D),
|
||||||
WOOD(2.00D),
|
NOTE_BLOCK(0.80D), BED(0.20D), RAILS(0.70D), DETECTOR_RAIL(0.70D), POWERED_RAIL(0.70D), ACTIVATOR_RAIL(0.70D),
|
||||||
SAPLING(0.00D),
|
WEB(4.00D), LONG_GRASS(0.00D), DOUBLE_PLANT(0.00D), DEAD_BUSH(0.00D), WOOL(0.80D), YELLOW_FLOWER(0.00D),
|
||||||
WATER(100.00D),
|
RED_ROSE(0.00D), BROWN_MUSHROOM(0.00D), RED_MUSHROOM(0.00D), GOLD_BLOCK(3.00D), IRON_BLOCK(5.00D),
|
||||||
STATIONARY_WATER(100.00D),
|
DOUBLE_STEP(2.00D), STEP(2.00D), BRICK(2.00D), TNT(0.00D), BOOKSHELF(1.50D), MOSSY_COBBLESTONE(2.00D),
|
||||||
LAVA(0.00D),
|
OBSIDIAN(50.00D), TORCH(0.00D), FIRE(0.00D), MOB_SPAWNER(5.00D), CHEST(2.50D), TRAPPED_CHEST(2.50D),
|
||||||
STATIONARY_LAVA(100.00D),
|
REDSTONE_WIRE(0.00D), DIAMOND_ORE(3.00D), DIAMOND_BLOCK(5.00D), WORKBENCH(2.50D), SOIL(0.60D), FURNACE(3.50D),
|
||||||
SAND(0.50D),
|
BURNING_FURNACE(3.50D), WOODEN_DOOR(3.00D), LADDER(0.40D), LEVER(0.50D), IRON_DOOR_BLOCK(5.00D), HOPPER(2.00D),
|
||||||
GRAVEL(0.60D),
|
STONE_PLATE(0.50D), WOOD_PLATE(0.50D), GOLD_PLATE(0.50D), IRON_PLATE(0.50D), QUARTZ_BLOCK(0.80D), QUARTZ_ORE(3.00D),
|
||||||
GOLD_ORE(3.00D),
|
REDSTONE_BLOCK(5.00D), REDSTONE_ORE(3.00D), GLOWING_REDSTONE_ORE(3.00D), REDSTONE_TORCH_OFF(0.00D),
|
||||||
IRON_ORE(3.00D),
|
REDSTONE_TORCH_ON(0.00D), REDSTONE_COMPARATOR_OFF(0.00D), REDSTONE_COMPARATOR_ON(0.00D), DAYLIGHT_DETECTOR(0.20D),
|
||||||
COAL_ORE(3.00D),
|
STONE_BUTTON(0.50D), SNOW(0.10D), ICE(0.50D), PACKED_ICE(0.50D), SNOW_BLOCK(0.20D), CACTUS(0.40D), CLAY(0.60D),
|
||||||
LOG(2.00D),
|
HARD_CLAY(1.25D), STAINED_CLAY(1.25D), SUGAR_CANE_BLOCK(0.00D), JUKEBOX(2.00D), FENCE(2.00D), NETHERRACK(0.40D),
|
||||||
LOG_2(2.00D),
|
SOUL_SAND(0.50D), GLOWSTONE(0.30D), PORTAL(-1.00D), CAKE_BLOCK(0.50D), LOCKED_CHEST(0.00D), TRAP_DOOR(3.00D),
|
||||||
LEAVES(0.20D),
|
MONSTER_EGGS(0.750D), SMOOTH_BRICK(1.50D), IRON_FENCE(5.00D), THIN_GLASS(0.30D), STAINED_GLASS(0.30D),
|
||||||
LEAVES_2(0.20D),
|
STAINED_GLASS_PANE(0.30D), PUMPKIN_STEM(0.00D), MELON_STEM(0.00D), VINE(0.20D), FENCE_GATE(2.00D), MYCEL(0.60D),
|
||||||
SPONGE(0.60D),
|
WATER_LILY(0.00D), NETHER_BRICK(2.00D), NETHER_FENCE(2.00D), ENCHANTMENT_TABLE(5.00D), BREWING_STAND(0.50D),
|
||||||
GLASS(0.30D),
|
CAULDRON(2.00D), ENDER_PORTAL(-1.00D), ENDER_PORTAL_FRAME(-1.00D), DRAGON_EGG(3.00D), REDSTONE_LAMP_OFF(0.30D),
|
||||||
LAPIS_ORE(3.00D),
|
REDSTONE_LAMP_ON(0.30D), WOOD_DOUBLE_STEP(2.00D), WOOD_STEP(2.00D), COCOA(0.20D), EMERALD_ORE(3.00D),
|
||||||
LAPIS_BLOCK(3.00D),
|
ENDER_CHEST(22.50D), EMERALD_BLOCK(5.00D), FLOWER_POT(0.00D), WOOD_BUTTON(0.50D), ANVIL(5.00D),
|
||||||
DISPENSER(3.50D),
|
HUGE_MUSHROOM_1(0.20D), HUGE_MUSHROOM_2(0.20D), BED_BLOCK(0.20D), WOOD_STAIRS(2.00D), COBBLESTONE_STAIRS(2.00D),
|
||||||
DROPPER(3.50D),
|
BRICK_STAIRS(2.00D), SMOOTH_STAIRS(1.50D), NETHER_BRICK_STAIRS(2.00D), SPRUCE_WOOD_STAIRS(2.00D),
|
||||||
SANDSTONE(0.80D),
|
BIRCH_WOOD_STAIRS(2.00D), JUNGLE_WOOD_STAIRS(2.00D), DARK_OAK_STAIRS(2.00D), ACACIA_STAIRS(2.00D),
|
||||||
NOTE_BLOCK(0.80D),
|
QUARTZ_STAIRS(0.80D), SANDSTONE_STAIRS(0.80D), COMMAND(0.00D), BEACON(3.00D), COBBLE_WALL(2.00D), CROPS(0.00D),
|
||||||
BED(0.20D),
|
CARROT(0.00D), POTATO(0.00D), SKULL(1.00D), NETHER_WARTS(0.00D), SIGN_POST(1.00D), WALL_SIGN(1.00D), PUMPKIN(1.00D),
|
||||||
RAILS(0.70D),
|
JACK_O_LANTERN(1.00D), DIODE_BLOCK_ON(0.00D), DIODE_BLOCK_OFF(0.00D), MELON_BLOCK(1.00D), ENDER_STONE(3.00D),
|
||||||
DETECTOR_RAIL(0.70D),
|
TRIPWIRE(0.00D), TRIPWIRE_HOOK(0.00D), HAY_BLOCK(0.50D), CARPET(0.10D), COAL_BLOCK(5.00D), PISTON_BASE(0.70D),
|
||||||
POWERED_RAIL(0.70D),
|
PISTON_EXTENSION(0.70D), PISTON_MOVING_PIECE(0.70D), PISTON_STICKY_BASE(0.70D);
|
||||||
ACTIVATOR_RAIL(0.70D),
|
|
||||||
WEB(4.00D),
|
|
||||||
LONG_GRASS(0.00D),
|
|
||||||
DOUBLE_PLANT(0.00D),
|
|
||||||
DEAD_BUSH(0.00D),
|
|
||||||
WOOL(0.80D),
|
|
||||||
YELLOW_FLOWER(0.00D),
|
|
||||||
RED_ROSE(0.00D),
|
|
||||||
BROWN_MUSHROOM(0.00D),
|
|
||||||
RED_MUSHROOM(0.00D),
|
|
||||||
GOLD_BLOCK(3.00D),
|
|
||||||
IRON_BLOCK(5.00D),
|
|
||||||
DOUBLE_STEP(2.00D),
|
|
||||||
STEP(2.00D),
|
|
||||||
BRICK(2.00D),
|
|
||||||
TNT(0.00D),
|
|
||||||
BOOKSHELF(1.50D),
|
|
||||||
MOSSY_COBBLESTONE(2.00D),
|
|
||||||
OBSIDIAN(50.00D),
|
|
||||||
TORCH(0.00D),
|
|
||||||
FIRE(0.00D),
|
|
||||||
MOB_SPAWNER(5.00D),
|
|
||||||
CHEST(2.50D),
|
|
||||||
TRAPPED_CHEST(2.50D),
|
|
||||||
REDSTONE_WIRE(0.00D),
|
|
||||||
DIAMOND_ORE(3.00D),
|
|
||||||
DIAMOND_BLOCK(5.00D),
|
|
||||||
WORKBENCH(2.50D),
|
|
||||||
SOIL(0.60D),
|
|
||||||
FURNACE(3.50D),
|
|
||||||
BURNING_FURNACE(3.50D),
|
|
||||||
WOODEN_DOOR(3.00D),
|
|
||||||
LADDER(0.40D),
|
|
||||||
LEVER(0.50D),
|
|
||||||
IRON_DOOR_BLOCK(5.00D),
|
|
||||||
HOPPER(2.00D),
|
|
||||||
STONE_PLATE(0.50D),
|
|
||||||
WOOD_PLATE(0.50D),
|
|
||||||
GOLD_PLATE(0.50D),
|
|
||||||
IRON_PLATE(0.50D),
|
|
||||||
QUARTZ_BLOCK(0.80D),
|
|
||||||
QUARTZ_ORE(3.00D),
|
|
||||||
REDSTONE_BLOCK(5.00D),
|
|
||||||
REDSTONE_ORE(3.00D),
|
|
||||||
GLOWING_REDSTONE_ORE(3.00D),
|
|
||||||
REDSTONE_TORCH_OFF(0.00D),
|
|
||||||
REDSTONE_TORCH_ON(0.00D),
|
|
||||||
REDSTONE_COMPARATOR_OFF(0.00D),
|
|
||||||
REDSTONE_COMPARATOR_ON(0.00D),
|
|
||||||
DAYLIGHT_DETECTOR(0.20D),
|
|
||||||
STONE_BUTTON(0.50D),
|
|
||||||
SNOW(0.10D),
|
|
||||||
ICE(0.50D),
|
|
||||||
PACKED_ICE(0.50D),
|
|
||||||
SNOW_BLOCK(0.20D),
|
|
||||||
CACTUS(0.40D),
|
|
||||||
CLAY(0.60D),
|
|
||||||
HARD_CLAY(1.25D),
|
|
||||||
STAINED_CLAY(1.25D),
|
|
||||||
SUGAR_CANE_BLOCK(0.00D),
|
|
||||||
JUKEBOX(2.00D),
|
|
||||||
FENCE(2.00D),
|
|
||||||
NETHERRACK(0.40D),
|
|
||||||
SOUL_SAND(0.50D),
|
|
||||||
GLOWSTONE(0.30D),
|
|
||||||
PORTAL(-1.00D),
|
|
||||||
CAKE_BLOCK(0.50D),
|
|
||||||
LOCKED_CHEST(0.00D),
|
|
||||||
TRAP_DOOR(3.00D),
|
|
||||||
MONSTER_EGGS(0.750D),
|
|
||||||
SMOOTH_BRICK(1.50D),
|
|
||||||
IRON_FENCE(5.00D),
|
|
||||||
THIN_GLASS(0.30D),
|
|
||||||
STAINED_GLASS(0.30D),
|
|
||||||
STAINED_GLASS_PANE(0.30D),
|
|
||||||
PUMPKIN_STEM(0.00D),
|
|
||||||
MELON_STEM(0.00D),
|
|
||||||
VINE(0.20D),
|
|
||||||
FENCE_GATE(2.00D),
|
|
||||||
MYCEL(0.60D),
|
|
||||||
WATER_LILY(0.00D),
|
|
||||||
NETHER_BRICK(2.00D),
|
|
||||||
NETHER_FENCE(2.00D),
|
|
||||||
ENCHANTMENT_TABLE(5.00D),
|
|
||||||
BREWING_STAND(0.50D),
|
|
||||||
CAULDRON(2.00D),
|
|
||||||
ENDER_PORTAL(-1.00D),
|
|
||||||
ENDER_PORTAL_FRAME(-1.00D),
|
|
||||||
DRAGON_EGG(3.00D),
|
|
||||||
REDSTONE_LAMP_OFF(0.30D),
|
|
||||||
REDSTONE_LAMP_ON(0.30D),
|
|
||||||
WOOD_DOUBLE_STEP(2.00D),
|
|
||||||
WOOD_STEP(2.00D),
|
|
||||||
COCOA(0.20D),
|
|
||||||
EMERALD_ORE(3.00D),
|
|
||||||
ENDER_CHEST(22.50D),
|
|
||||||
EMERALD_BLOCK(5.00D),
|
|
||||||
FLOWER_POT(0.00D),
|
|
||||||
WOOD_BUTTON(0.50D),
|
|
||||||
ANVIL(5.00D),
|
|
||||||
HUGE_MUSHROOM_1(0.20D),
|
|
||||||
HUGE_MUSHROOM_2(0.20D),
|
|
||||||
BED_BLOCK(0.20D),
|
|
||||||
WOOD_STAIRS(2.00D),
|
|
||||||
COBBLESTONE_STAIRS(2.00D),
|
|
||||||
BRICK_STAIRS(2.00D),
|
|
||||||
SMOOTH_STAIRS(1.50D),
|
|
||||||
NETHER_BRICK_STAIRS(2.00D),
|
|
||||||
SPRUCE_WOOD_STAIRS(2.00D),
|
|
||||||
BIRCH_WOOD_STAIRS(2.00D),
|
|
||||||
JUNGLE_WOOD_STAIRS(2.00D),
|
|
||||||
DARK_OAK_STAIRS(2.00D),
|
|
||||||
ACACIA_STAIRS(2.00D),
|
|
||||||
QUARTZ_STAIRS(0.80D),
|
|
||||||
SANDSTONE_STAIRS(0.80D),
|
|
||||||
COMMAND(0.00D),
|
|
||||||
BEACON(3.00D),
|
|
||||||
COBBLE_WALL(2.00D),
|
|
||||||
CROPS(0.00D),
|
|
||||||
CARROT(0.00D),
|
|
||||||
POTATO(0.00D),
|
|
||||||
SKULL(1.00D),
|
|
||||||
NETHER_WARTS(0.00D),
|
|
||||||
SIGN_POST(1.00D),
|
|
||||||
WALL_SIGN(1.00D),
|
|
||||||
PUMPKIN(1.00D),
|
|
||||||
JACK_O_LANTERN(1.00D),
|
|
||||||
DIODE_BLOCK_ON(0.00D),
|
|
||||||
DIODE_BLOCK_OFF(0.00D),
|
|
||||||
MELON_BLOCK(1.00D),
|
|
||||||
ENDER_STONE(3.00D),
|
|
||||||
TRIPWIRE(0.00D),
|
|
||||||
TRIPWIRE_HOOK(0.00D),
|
|
||||||
HAY_BLOCK(0.50D),
|
|
||||||
CARPET(0.10D),
|
|
||||||
COAL_BLOCK(5.00D),
|
|
||||||
PISTON_BASE(0.70D),
|
|
||||||
PISTON_EXTENSION(0.70D),
|
|
||||||
PISTON_MOVING_PIECE(0.70D),
|
|
||||||
PISTON_STICKY_BASE(0.70D);
|
|
||||||
|
|
||||||
Material mat;
|
Material mat;
|
||||||
double hardness;
|
double hardness;
|
||||||
@@ -206,7 +66,7 @@ public enum BlockHardness {
|
|||||||
try {
|
try {
|
||||||
BlockHardness h = getHardness(m);
|
BlockHardness h = getHardness(m);
|
||||||
return h == null ? 0D : h.hardness;
|
return h == null ? 0D : h.hardness;
|
||||||
}catch(Exception e) {
|
} catch (Exception e) {
|
||||||
return 0D;
|
return 0D;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -31,7 +31,9 @@ public class FileFormatter extends Formatter {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String format(LogRecord record) {
|
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);
|
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();
|
return output.toString();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -42,12 +42,15 @@ public class Group {
|
|||||||
|
|
||||||
ChatColor c = ChatColor.valueOf(color);
|
ChatColor c = ChatColor.valueOf(color);
|
||||||
if (c == null) {
|
if (c == null) {
|
||||||
AntiCheatReloaded.getPlugin().getLogger().warning("Event '" + name + "' was initialized with the color '" + color + "' which is invalid.");
|
AntiCheatReloaded.getPlugin().getLogger()
|
||||||
AntiCheatReloaded.getPlugin().getLogger().warning("This event will not run properly. See http://jd.bukkit.org/apidocs/org/bukkit/ChatColor.html#enum_constant_summary for a list of valid colors");
|
.warning("Event '" + name + "' was initialized with the color '" + color + "' which is invalid.");
|
||||||
|
AntiCheatReloaded.getPlugin().getLogger().warning(
|
||||||
|
"This event will not run properly. See http://jd.bukkit.org/apidocs/org/bukkit/ChatColor.html#enum_constant_summary for a list of valid colors");
|
||||||
} else {
|
} else {
|
||||||
this.color = c;
|
this.color = c;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getName() {
|
public String getName() {
|
||||||
return name;
|
return name;
|
||||||
}
|
}
|
||||||
@@ -76,8 +79,10 @@ public class Group {
|
|||||||
throw new Exception();
|
throw new Exception();
|
||||||
}
|
}
|
||||||
} catch (Exception ex) {
|
} catch (Exception ex) {
|
||||||
AntiCheatReloaded.getPlugin().getLogger().warning("An event was initialized with an invalid string: '" + string + "'");
|
AntiCheatReloaded.getPlugin().getLogger()
|
||||||
AntiCheatReloaded.getPlugin().getLogger().warning("The proper format is: 'name : threshold : color : action' such as 'High : 50 : RED : KICK'");
|
.warning("An event was initialized with an invalid string: '" + string + "'");
|
||||||
|
AntiCheatReloaded.getPlugin().getLogger().warning(
|
||||||
|
"The proper format is: 'name : threshold : color : action' such as 'High : 50 : RED : KICK'");
|
||||||
AntiCheatReloaded.getPlugin().getLogger().warning("This event will NOT run. (" + ex.getMessage() + ")");
|
AntiCheatReloaded.getPlugin().getLogger().warning("This event will NOT run. (" + ex.getMessage() + ")");
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -29,11 +29,11 @@ import org.bukkit.potion.PotionEffectType;
|
|||||||
|
|
||||||
public class NMS_1_9_PLUS {
|
public class NMS_1_9_PLUS {
|
||||||
|
|
||||||
static final EnumSet<Material> MOVE_UP_BLOCKS_1_9 = EnumSet.of(Material.ACACIA_STAIRS,
|
static final EnumSet<Material> MOVE_UP_BLOCKS_1_9 = EnumSet.of(Material.ACACIA_STAIRS, Material.BIRCH_WOOD_STAIRS,
|
||||||
Material.BIRCH_WOOD_STAIRS, Material.BRICK_STAIRS, Material.COBBLESTONE_STAIRS, Material.DARK_OAK_STAIRS,
|
Material.BRICK_STAIRS, Material.COBBLESTONE_STAIRS, Material.DARK_OAK_STAIRS, Material.JUNGLE_WOOD_STAIRS,
|
||||||
Material.JUNGLE_WOOD_STAIRS, Material.NETHER_BRICK_STAIRS, Material.QUARTZ_STAIRS,
|
Material.NETHER_BRICK_STAIRS, Material.QUARTZ_STAIRS, Material.RED_SANDSTONE_STAIRS,
|
||||||
Material.RED_SANDSTONE_STAIRS, Material.SANDSTONE_STAIRS, Material.SMOOTH_STAIRS,
|
Material.SANDSTONE_STAIRS, Material.SMOOTH_STAIRS, Material.SPRUCE_WOOD_STAIRS, Material.WOOD_STAIRS,
|
||||||
Material.SPRUCE_WOOD_STAIRS, Material.WOOD_STAIRS, Material.PURPUR_STAIRS);
|
Material.PURPUR_STAIRS);
|
||||||
|
|
||||||
static final PotionEffectType LEVITATION = PotionEffectType.LEVITATION;
|
static final PotionEffectType LEVITATION = PotionEffectType.LEVITATION;
|
||||||
|
|
||||||
|
|||||||
@@ -85,8 +85,14 @@ public class NPC_1_12 {
|
|||||||
this.location.getZ(), 0.0f, 0.0f);
|
this.location.getZ(), 0.0f, 0.0f);
|
||||||
this.npc.collides = false;
|
this.npc.collides = false;
|
||||||
this.npc.setInvisible(true);
|
this.npc.setInvisible(true);
|
||||||
this.npc.setEquipment(EnumItemSlot.CHEST, AntiCheatReloaded.getRandom().nextBoolean() ? CraftItemStack.asNMSCopy(new ItemStack(Material.DIAMOND_CHESTPLATE)) : CraftItemStack.asNMSCopy(new ItemStack(Material.CHAINMAIL_CHESTPLATE)));
|
this.npc.setEquipment(EnumItemSlot.CHEST,
|
||||||
this.npc.setEquipment(EnumItemSlot.FEET, AntiCheatReloaded.getRandom().nextBoolean() ? CraftItemStack.asNMSCopy(new ItemStack(Material.CHAINMAIL_BOOTS)) : CraftItemStack.asNMSCopy(new ItemStack(Material.DIAMOND_BOOTS)));
|
AntiCheatReloaded.getRandom().nextBoolean()
|
||||||
|
? CraftItemStack.asNMSCopy(new ItemStack(Material.DIAMOND_CHESTPLATE))
|
||||||
|
: CraftItemStack.asNMSCopy(new ItemStack(Material.CHAINMAIL_CHESTPLATE)));
|
||||||
|
this.npc.setEquipment(EnumItemSlot.FEET,
|
||||||
|
AntiCheatReloaded.getRandom().nextBoolean()
|
||||||
|
? CraftItemStack.asNMSCopy(new ItemStack(Material.CHAINMAIL_BOOTS))
|
||||||
|
: CraftItemStack.asNMSCopy(new ItemStack(Material.DIAMOND_BOOTS)));
|
||||||
this.entityId = this.npc.getId();
|
this.entityId = this.npc.getId();
|
||||||
final PlayerConnection connection = ((CraftPlayer) this.getOwner()).getHandle().playerConnection;
|
final PlayerConnection connection = ((CraftPlayer) this.getOwner()).getHandle().playerConnection;
|
||||||
connection.sendPacket(new PacketPlayOutPlayerInfo(PacketPlayOutPlayerInfo.EnumPlayerInfoAction.ADD_PLAYER,
|
connection.sendPacket(new PacketPlayOutPlayerInfo(PacketPlayOutPlayerInfo.EnumPlayerInfoAction.ADD_PLAYER,
|
||||||
@@ -106,11 +112,14 @@ public class NPC_1_12 {
|
|||||||
vec.setZ(-3 * vec.getZ());
|
vec.setZ(-3 * vec.getZ());
|
||||||
Location back = eyelocation.add(vec);
|
Location back = eyelocation.add(vec);
|
||||||
this.location = back; // TODO
|
this.location = back; // TODO
|
||||||
this.npc.setPositionRotation(back.getX(), back.getY(), back.getZ(), (float)new Random().nextFloat() * 20, (float)new Random().nextFloat() * 20);
|
this.npc.setPositionRotation(back.getX(), back.getY(), back.getZ(),
|
||||||
((CraftPlayer) this.getOwner()).getHandle().playerConnection.sendPacket(new PacketPlayOutEntityTeleport(npc));
|
(float) new Random().nextFloat() * 20, (float) new Random().nextFloat() * 20);
|
||||||
|
((CraftPlayer) this.getOwner()).getHandle().playerConnection
|
||||||
|
.sendPacket(new PacketPlayOutEntityTeleport(npc));
|
||||||
if (new Random().nextInt(50) == 25 && this.npc.isInvisible()) {
|
if (new Random().nextInt(50) == 25 && this.npc.isInvisible()) {
|
||||||
this.npc.setInvisible(false);
|
this.npc.setInvisible(false);
|
||||||
((CraftPlayer) this.getOwner()).getHandle().playerConnection.sendPacket(new PacketPlayOutEntityMetadata(entityId, npc.getDataWatcher(), false));
|
((CraftPlayer) this.getOwner()).getHandle().playerConnection
|
||||||
|
.sendPacket(new PacketPlayOutEntityMetadata(entityId, npc.getDataWatcher(), false));
|
||||||
new BukkitRunnable() {
|
new BukkitRunnable() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
@@ -118,11 +127,12 @@ public class NPC_1_12 {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
npc.setInvisible(true);
|
npc.setInvisible(true);
|
||||||
((CraftPlayer) getOwner()).getHandle().playerConnection.sendPacket(new PacketPlayOutEntityMetadata(entityId, npc.getDataWatcher(), false));
|
((CraftPlayer) getOwner()).getHandle().playerConnection
|
||||||
|
.sendPacket(new PacketPlayOutEntityMetadata(entityId, npc.getDataWatcher(), false));
|
||||||
}
|
}
|
||||||
}.runTaskLater(AntiCheatReloaded.getPlugin(), 4);
|
}.runTaskLater(AntiCheatReloaded.getPlugin(), 4);
|
||||||
}
|
}
|
||||||
}else {
|
} else {
|
||||||
Location eyelocation = e.getPlayer().getEyeLocation();
|
Location eyelocation = e.getPlayer().getEyeLocation();
|
||||||
Vector vec = e.getPlayer().getLocation().getDirection();
|
Vector vec = e.getPlayer().getLocation().getDirection();
|
||||||
vec.setX(-3 * vec.getX());
|
vec.setX(-3 * vec.getX());
|
||||||
@@ -130,8 +140,10 @@ public class NPC_1_12 {
|
|||||||
vec.setZ(-3 * vec.getZ());
|
vec.setZ(-3 * vec.getZ());
|
||||||
Location back = eyelocation.add(vec);
|
Location back = eyelocation.add(vec);
|
||||||
this.location = back; // TODO
|
this.location = back; // TODO
|
||||||
this.npc.setPositionRotation(back.getX(), back.getY(), back.getZ(), (float)new Random().nextFloat() * 20, (float)new Random().nextFloat() * 20);
|
this.npc.setPositionRotation(back.getX(), back.getY(), back.getZ(),
|
||||||
((CraftPlayer) this.getOwner()).getHandle().playerConnection.sendPacket(new PacketPlayOutEntityTeleport(npc));
|
(float) new Random().nextFloat() * 20, (float) new Random().nextFloat() * 20);
|
||||||
|
((CraftPlayer) this.getOwner()).getHandle().playerConnection
|
||||||
|
.sendPacket(new PacketPlayOutEntityTeleport(npc));
|
||||||
}
|
}
|
||||||
} else if (e.getTo().getPitch() >= 22) {
|
} else if (e.getTo().getPitch() >= 22) {
|
||||||
Location eyelocation = e.getPlayer().getEyeLocation();
|
Location eyelocation = e.getPlayer().getEyeLocation();
|
||||||
@@ -141,8 +153,10 @@ public class NPC_1_12 {
|
|||||||
vec.setZ(-3 * vec.getZ());
|
vec.setZ(-3 * vec.getZ());
|
||||||
Location back = eyelocation.add(vec);
|
Location back = eyelocation.add(vec);
|
||||||
this.location = back; // TODO
|
this.location = back; // TODO
|
||||||
this.npc.setPositionRotation(back.getX(), back.getY(), back.getZ(), (float)new Random().nextFloat() * 20, (float)new Random().nextFloat() * 20);
|
this.npc.setPositionRotation(back.getX(), back.getY(), back.getZ(), (float) new Random().nextFloat() * 20,
|
||||||
((CraftPlayer) this.getOwner()).getHandle().playerConnection.sendPacket(new PacketPlayOutEntityTeleport(npc));
|
(float) new Random().nextFloat() * 20);
|
||||||
|
((CraftPlayer) this.getOwner()).getHandle().playerConnection
|
||||||
|
.sendPacket(new PacketPlayOutEntityTeleport(npc));
|
||||||
} else {
|
} else {
|
||||||
Location eyelocation = e.getPlayer().getEyeLocation();
|
Location eyelocation = e.getPlayer().getEyeLocation();
|
||||||
Vector vec = e.getPlayer().getLocation().getDirection();
|
Vector vec = e.getPlayer().getLocation().getDirection();
|
||||||
@@ -156,12 +170,14 @@ public class NPC_1_12 {
|
|||||||
vec.setZ(-1.95 * vec.getZ());
|
vec.setZ(-1.95 * vec.getZ());
|
||||||
Location back = eyelocation.add(vec);
|
Location back = eyelocation.add(vec);
|
||||||
this.location = back; // TODO
|
this.location = back; // TODO
|
||||||
this.npc.setPositionRotation(back.getX(), back.getY(), back.getZ(), (float)new Random().nextFloat() * 20, (float)new Random().nextFloat() * 20);
|
this.npc.setPositionRotation(back.getX(), back.getY(), back.getZ(), (float) new Random().nextFloat() * 20,
|
||||||
|
(float) new Random().nextFloat() * 20);
|
||||||
((CraftPlayer) this.getOwner()).getHandle().playerConnection
|
((CraftPlayer) this.getOwner()).getHandle().playerConnection
|
||||||
.sendPacket(new PacketPlayOutEntityTeleport(npc));
|
.sendPacket(new PacketPlayOutEntityTeleport(npc));
|
||||||
if (new Random().nextInt(1000) == 500 && this.npc.isInvisible()) {
|
if (new Random().nextInt(1000) == 500 && this.npc.isInvisible()) {
|
||||||
this.npc.setInvisible(false);
|
this.npc.setInvisible(false);
|
||||||
((CraftPlayer) this.getOwner()).getHandle().playerConnection.sendPacket(new PacketPlayOutEntityMetadata(entityId, npc.getDataWatcher(), false));
|
((CraftPlayer) this.getOwner()).getHandle().playerConnection
|
||||||
|
.sendPacket(new PacketPlayOutEntityMetadata(entityId, npc.getDataWatcher(), false));
|
||||||
new BukkitRunnable() {
|
new BukkitRunnable() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
@@ -169,7 +185,8 @@ public class NPC_1_12 {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
npc.setInvisible(true);
|
npc.setInvisible(true);
|
||||||
((CraftPlayer) getOwner()).getHandle().playerConnection.sendPacket(new PacketPlayOutEntityMetadata(entityId, npc.getDataWatcher(), false));
|
((CraftPlayer) getOwner()).getHandle().playerConnection
|
||||||
|
.sendPacket(new PacketPlayOutEntityMetadata(entityId, npc.getDataWatcher(), false));
|
||||||
}
|
}
|
||||||
}.runTaskLater(AntiCheatReloaded.getPlugin(), 6);
|
}.runTaskLater(AntiCheatReloaded.getPlugin(), 6);
|
||||||
}
|
}
|
||||||
@@ -186,7 +203,8 @@ public class NPC_1_12 {
|
|||||||
}
|
}
|
||||||
if (new Random().nextBoolean() && this.npc.isInvisible()) {
|
if (new Random().nextBoolean() && this.npc.isInvisible()) {
|
||||||
this.npc.setInvisible(false);
|
this.npc.setInvisible(false);
|
||||||
((CraftPlayer) this.getOwner()).getHandle().playerConnection.sendPacket(new PacketPlayOutEntityMetadata(entityId, npc.getDataWatcher(), false));
|
((CraftPlayer) this.getOwner()).getHandle().playerConnection
|
||||||
|
.sendPacket(new PacketPlayOutEntityMetadata(entityId, npc.getDataWatcher(), false));
|
||||||
new BukkitRunnable() {
|
new BukkitRunnable() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
@@ -194,7 +212,8 @@ public class NPC_1_12 {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
npc.setInvisible(true);
|
npc.setInvisible(true);
|
||||||
((CraftPlayer) getOwner()).getHandle().playerConnection.sendPacket(new PacketPlayOutEntityMetadata(entityId, npc.getDataWatcher(), false));
|
((CraftPlayer) getOwner()).getHandle().playerConnection
|
||||||
|
.sendPacket(new PacketPlayOutEntityMetadata(entityId, npc.getDataWatcher(), false));
|
||||||
}
|
}
|
||||||
}.runTaskLater(AntiCheatReloaded.getPlugin(), 6 + new Random().nextInt(7));
|
}.runTaskLater(AntiCheatReloaded.getPlugin(), 6 + new Random().nextInt(7));
|
||||||
}
|
}
|
||||||
@@ -206,7 +225,8 @@ public class NPC_1_12 {
|
|||||||
}
|
}
|
||||||
if (new Random().nextBoolean() && this.npc.isInvisible()) {
|
if (new Random().nextBoolean() && this.npc.isInvisible()) {
|
||||||
this.npc.setInvisible(false);
|
this.npc.setInvisible(false);
|
||||||
((CraftPlayer) this.getOwner()).getHandle().playerConnection.sendPacket(new PacketPlayOutEntityMetadata(entityId, npc.getDataWatcher(), false));
|
((CraftPlayer) this.getOwner()).getHandle().playerConnection
|
||||||
|
.sendPacket(new PacketPlayOutEntityMetadata(entityId, npc.getDataWatcher(), false));
|
||||||
new BukkitRunnable() {
|
new BukkitRunnable() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
@@ -214,7 +234,8 @@ public class NPC_1_12 {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
npc.setInvisible(true);
|
npc.setInvisible(true);
|
||||||
((CraftPlayer) getOwner()).getHandle().playerConnection.sendPacket(new PacketPlayOutEntityMetadata(entityId, npc.getDataWatcher(), false));
|
((CraftPlayer) getOwner()).getHandle().playerConnection
|
||||||
|
.sendPacket(new PacketPlayOutEntityMetadata(entityId, npc.getDataWatcher(), false));
|
||||||
}
|
}
|
||||||
}.runTaskLater(AntiCheatReloaded.getPlugin(), 6 + new Random().nextInt(8));
|
}.runTaskLater(AntiCheatReloaded.getPlugin(), 6 + new Random().nextInt(8));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -25,31 +25,11 @@ import java.util.Random;
|
|||||||
|
|
||||||
public class NameGenerator {
|
public class NameGenerator {
|
||||||
|
|
||||||
private static final List<String> BEGIN = Arrays.asList(new String[]{
|
private static final List<String> BEGIN = Arrays.asList(new String[] { "Pixel", "Pro", "NoHax", "Just", "That",
|
||||||
"Pixel",
|
"New", "Ultra", "Killer", "Swift", "Anarchy", "Yolo", "Rammel" });
|
||||||
"Pro",
|
|
||||||
"NoHax",
|
|
||||||
"Just",
|
|
||||||
"That",
|
|
||||||
"New",
|
|
||||||
"Ultra",
|
|
||||||
"Killer",
|
|
||||||
"Swift",
|
|
||||||
"Yolo",
|
|
||||||
"Rammel"
|
|
||||||
});
|
|
||||||
|
|
||||||
private static final List<String> END = Arrays.asList(new String[]{
|
private static final List<String> END = Arrays.asList(new String[] { "Gamer", "PvP", "JustYolo", "Gaming",
|
||||||
"Gamer",
|
"Minecraft", "Games", "Bawz", "Tech", "Noob", "Extra", "kast", "" + new Random().nextInt(100) });
|
||||||
"PvP",
|
|
||||||
"JustYolo",
|
|
||||||
"Gaming",
|
|
||||||
"Minecraft",
|
|
||||||
"Games",
|
|
||||||
"Bawz",
|
|
||||||
"kast",
|
|
||||||
"" + new Random().nextInt(100)
|
|
||||||
});
|
|
||||||
|
|
||||||
public static String generateName() {
|
public static String generateName() {
|
||||||
Random r = new Random();
|
Random r = new Random();
|
||||||
|
|||||||
@@ -1,56 +0,0 @@
|
|||||||
/*
|
|
||||||
* AntiCheatReloaded for Bukkit and Spigot.
|
|
||||||
* Copyright (c) 2012-2015 AntiCheat Team | http://gravitydevelopment.net
|
|
||||||
* Copyright (c) 2016-2018 Rammelkast | https://rammelkast.com
|
|
||||||
*
|
|
||||||
* This program is free software: you can redistribute it and/or modify
|
|
||||||
* it under the terms of the GNU General Public License as published by
|
|
||||||
* the Free Software Foundation, either version 3 of the License, or
|
|
||||||
* (at your option) any later version.
|
|
||||||
*
|
|
||||||
* This program is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License
|
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
|
|
||||||
package com.rammelkast.anticheatreloaded.util;
|
|
||||||
|
|
||||||
import java.util.Random;
|
|
||||||
|
|
||||||
public class NameUtil {
|
|
||||||
|
|
||||||
private static String[] firstParts = new String[] {
|
|
||||||
"Gamer",
|
|
||||||
"Pixel",
|
|
||||||
"Derp",
|
|
||||||
"Random",
|
|
||||||
"That",
|
|
||||||
"NoHaxJust",
|
|
||||||
"Derp",
|
|
||||||
"Fun",
|
|
||||||
"Luigi"
|
|
||||||
};
|
|
||||||
|
|
||||||
private static String[] secondParts = new String[] {
|
|
||||||
"01",
|
|
||||||
"Boy",
|
|
||||||
"Guy",
|
|
||||||
"Mario",
|
|
||||||
"Plain",
|
|
||||||
"Simple",
|
|
||||||
"NotHacking",
|
|
||||||
"Random",
|
|
||||||
"11",
|
|
||||||
"06"
|
|
||||||
};
|
|
||||||
|
|
||||||
private static Random theRandom = new Random();
|
|
||||||
|
|
||||||
public static String getRandomName() {
|
|
||||||
return firstParts[theRandom.nextInt(firstParts.length - 1)] + secondParts[theRandom.nextInt(secondParts.length - 1)];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -23,46 +23,14 @@ import org.bukkit.command.CommandSender;
|
|||||||
|
|
||||||
public enum Permission {
|
public enum Permission {
|
||||||
/* Check Nodes */
|
/* Check Nodes */
|
||||||
CHECK_ZOMBE_FLY,
|
CHECK_ZOMBE_FLY, CHECK_ZOMBE_NOCLIP, CHECK_ZOMBE_CHEAT, CHECK_FLIGHT, CHECK_ELYTRA, CHECK_WATERWALK, CHECK_NOSWING, CHECK_FASTBREAK,
|
||||||
CHECK_ZOMBE_NOCLIP,
|
CHECK_FASTPLACE, CHECK_CHATSPAM, CHECK_COMMANDSPAM, CHECK_SPRINT, CHECK_SNEAK, CHECK_SPEED, CHECK_VCLIP,
|
||||||
CHECK_ZOMBE_CHEAT,
|
CHECK_SPIDER, CHECK_NOFALL, CHECK_FASTBOW, CHECK_FASTEAT, CHECK_FASTHEAL, CHECK_FORCEFIELD, CHECK_LONGREACH,
|
||||||
CHECK_FLY,
|
CHECK_FASTPROJECTILE, CHECK_ITEMSPAM, CHECK_VISUAL, CHECK_FASTINVENTORY, CHECK_AUTOTOOL,
|
||||||
CHECK_WATERWALK,
|
|
||||||
CHECK_NOSWING,
|
|
||||||
CHECK_FASTBREAK,
|
|
||||||
CHECK_FASTPLACE,
|
|
||||||
CHECK_CHATSPAM,
|
|
||||||
CHECK_COMMANDSPAM,
|
|
||||||
CHECK_SPRINT,
|
|
||||||
CHECK_SNEAK,
|
|
||||||
CHECK_SPEED,
|
|
||||||
CHECK_VCLIP,
|
|
||||||
CHECK_SPIDER,
|
|
||||||
CHECK_NOFALL,
|
|
||||||
CHECK_FASTBOW,
|
|
||||||
CHECK_FASTEAT,
|
|
||||||
CHECK_FASTHEAL,
|
|
||||||
CHECK_FORCEFIELD,
|
|
||||||
CHECK_LONGREACH,
|
|
||||||
CHECK_FASTPROJECTILE,
|
|
||||||
CHECK_ITEMSPAM,
|
|
||||||
CHECK_VISUAL,
|
|
||||||
CHECK_FASTINVENTORY,
|
|
||||||
CHECK_AUTOTOOL,
|
|
||||||
|
|
||||||
/* System Nodes */
|
/* System Nodes */
|
||||||
SYSTEM_LOG,
|
SYSTEM_LOG, SYSTEM_RESET, SYSTEM_SPY, SYSTEM_HELP, SYSTEM_UPDATE, SYSTEM_REPORT, SYSTEM_ALERT, SYSTEM_NOTICE,
|
||||||
SYSTEM_RESET,
|
SYSTEM_CALIBRATE, SYSTEM_CHECK, SYSTEM_DEBUG, SYSTEM_RELOAD, CHECK_KILLAURA, CHECK_BLINK, VELOCITY, CRITICALS;
|
||||||
SYSTEM_SPY,
|
|
||||||
SYSTEM_HELP,
|
|
||||||
SYSTEM_UPDATE,
|
|
||||||
SYSTEM_REPORT,
|
|
||||||
SYSTEM_ALERT,
|
|
||||||
SYSTEM_NOTICE,
|
|
||||||
SYSTEM_CALIBRATE,
|
|
||||||
SYSTEM_CHECK,
|
|
||||||
SYSTEM_DEBUG,
|
|
||||||
SYSTEM_RELOAD, CHECK_KILLAURA, CHECK_BLINK, VELOCITY, CRITICALS;
|
|
||||||
|
|
||||||
private static final String PERMISSION_ALL = "anticheat.*";
|
private static final String PERMISSION_ALL = "anticheat.*";
|
||||||
private static final String PERMISSION_SPAM = "anticheat.check.spam";
|
private static final String PERMISSION_SPAM = "anticheat.check.spam";
|
||||||
@@ -73,7 +41,8 @@ public enum Permission {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public boolean get(CommandSender cs) {
|
public boolean get(CommandSender cs) {
|
||||||
if ((this == CHECK_CHATSPAM || this == CHECK_COMMANDSPAM) && cs.hasPermission(PERMISSION_SPAM)) return true;
|
if ((this == CHECK_CHATSPAM || this == CHECK_COMMANDSPAM) && cs.hasPermission(PERMISSION_SPAM))
|
||||||
|
return true;
|
||||||
return cs.hasPermission(toString()) || cs.hasPermission(getBase()) || cs.hasPermission(PERMISSION_ALL);
|
return cs.hasPermission(toString()) || cs.hasPermission(getBase()) || cs.hasPermission(PERMISSION_ALL);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -82,7 +51,7 @@ public enum Permission {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public String whichPermission(CommandSender cs) {
|
public String whichPermission(CommandSender cs) {
|
||||||
for (String s : new String[]{PERMISSION_ALL, getBase(), toString()}) {
|
for (String s : new String[] { PERMISSION_ALL, getBase(), toString() }) {
|
||||||
if (cs.hasPermission(s)) {
|
if (cs.hasPermission(s)) {
|
||||||
return s;
|
return s;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -24,12 +24,7 @@ import org.bukkit.Material;
|
|||||||
public enum ToolHardness {
|
public enum ToolHardness {
|
||||||
|
|
||||||
// NOTHING(null, 1.5)
|
// NOTHING(null, 1.5)
|
||||||
WOOD(0.75D),
|
WOOD(0.75D), STONE(0.40D), IRON(0.25D), DIAMOND(0.20D), SHEARS(0.55D), GOLD(0.15D);
|
||||||
STONE(0.40D),
|
|
||||||
IRON(0.25D),
|
|
||||||
DIAMOND(0.20D),
|
|
||||||
SHEARS(0.55D),
|
|
||||||
GOLD(0.15D);
|
|
||||||
|
|
||||||
double hardness;
|
double hardness;
|
||||||
|
|
||||||
|
|||||||
@@ -68,12 +68,11 @@ public class User {
|
|||||||
*
|
*
|
||||||
* @param name Player's name
|
* @param name Player's name
|
||||||
*/
|
*/
|
||||||
/* public User(String name) {
|
/*
|
||||||
this.uuid = Bukkit.getPlayer(name).getUniqueId();
|
* public User(String name) { this.uuid = Bukkit.getPlayer(name).getUniqueId();
|
||||||
this.name = name;
|
* this.name = name; this.id = getPlayer() != null && getPlayer().isOnline() ?
|
||||||
this.id = getPlayer() != null && getPlayer().isOnline() ? getPlayer().getEntityId() : -1;
|
* getPlayer().getEntityId() : -1; }
|
||||||
}
|
*/
|
||||||
*/
|
|
||||||
/**
|
/**
|
||||||
* Get the player's UUID
|
* Get the player's UUID
|
||||||
*
|
*
|
||||||
@@ -127,9 +126,12 @@ public class User {
|
|||||||
public Group getGroup() {
|
public Group getGroup() {
|
||||||
List<Group> groups = config.getGroups().getGroups();
|
List<Group> groups = config.getGroups().getGroups();
|
||||||
for (int i = 0; i < groups.size(); i++) {
|
for (int i = 0; i < groups.size(); i++) {
|
||||||
if (i == 0 && level < groups.get(i).getLevel()) break;
|
if (i == 0 && level < groups.get(i).getLevel())
|
||||||
else if (i == groups.size() - 1) return groups.get(i);
|
break;
|
||||||
else if (level >= groups.get(i).getLevel() && level < groups.get(i + 1).getLevel()) return groups.get(i);
|
else if (i == groups.size() - 1)
|
||||||
|
return groups.get(i);
|
||||||
|
else if (level >= groups.get(i).getLevel() && level < groups.get(i + 1).getLevel())
|
||||||
|
return groups.get(i);
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
@@ -180,7 +182,8 @@ public class User {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set the users level to a specific value. Must be 0 < level < config-defined highest level
|
* Set the users level to a specific value. Must be 0 < level < config-defined
|
||||||
|
* highest level
|
||||||
*
|
*
|
||||||
* @param level level to set
|
* @param level level to set
|
||||||
* @return true if the level was valid and set properly
|
* @return true if the level was valid and set properly
|
||||||
@@ -231,7 +234,8 @@ public class User {
|
|||||||
* @return true if the location was valid and set properly
|
* @return true if the location was valid and set properly
|
||||||
*/
|
*/
|
||||||
public boolean setGoodLocation(Location location) {
|
public boolean setGoodLocation(Location location) {
|
||||||
if (Utilities.cantStandAtExp(location) || (location.getBlock().isLiquid() && !Utilities.isFullyInWater(location))) {
|
if (Utilities.cantStandAtExp(location)
|
||||||
|
|| (location.getBlock().isLiquid() && !Utilities.isFullyInWater(location))) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -66,11 +66,11 @@ public final class Utilities {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Check if only the block beneath them is standable (includes water + lava)
|
* Check if only the block beneath them is standable (includes water + lava)
|
||||||
|
*
|
||||||
* @param block the block to check (under)
|
* @param block the block to check (under)
|
||||||
* @return true if they cannot stand there
|
* @return true if they cannot stand there
|
||||||
*/
|
*/
|
||||||
public static boolean cantStandAtSingle(Block block)
|
public static boolean cantStandAtSingle(Block block) {
|
||||||
{
|
|
||||||
// TODO: Implement Better to reduce false positives (done? lets test...)
|
// TODO: Implement Better to reduce false positives (done? lets test...)
|
||||||
Block otherBlock = block.getLocation().add(0, -0.5, 0).getBlock();
|
Block otherBlock = block.getLocation().add(0, -0.5, 0).getBlock();
|
||||||
boolean center = otherBlock.getType() == Material.AIR;
|
boolean center = otherBlock.getType() == Material.AIR;
|
||||||
@@ -94,17 +94,20 @@ public final class Utilities {
|
|||||||
* @return true if the player should be unable to stand here
|
* @return true if the player should be unable to stand here
|
||||||
*/
|
*/
|
||||||
public static boolean cantStandAtExp(Location location) {
|
public static boolean cantStandAtExp(Location location) {
|
||||||
return cantStandAt(new Location(location.getWorld(), fixXAxis(location.getX()), location.getY() - 0.01D, location.getBlockZ()).getBlock());
|
return cantStandAt(new Location(location.getWorld(), fixXAxis(location.getX()), location.getY() - 0.01D,
|
||||||
|
location.getBlockZ()).getBlock());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Determine whether cannot stand on the block's immediately surroundings (North, East, South, West)
|
* Determine whether cannot stand on the block's immediately surroundings
|
||||||
|
* (North, East, South, West)
|
||||||
*
|
*
|
||||||
* @param block the block to check
|
* @param block the block to check
|
||||||
* @return true if a player cannot stand in the immediate vicinity
|
* @return true if a player cannot stand in the immediate vicinity
|
||||||
*/
|
*/
|
||||||
public static boolean cantStandClose(Block block) {
|
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));
|
return !canStand(block.getRelative(BlockFace.NORTH)) && !canStand(block.getRelative(BlockFace.EAST))
|
||||||
|
&& !canStand(block.getRelative(BlockFace.SOUTH)) && !canStand(block.getRelative(BlockFace.WEST));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -114,7 +117,9 @@ public final class Utilities {
|
|||||||
* @return true if a player cannot stand in areas further away from the block
|
* @return true if a player cannot stand in areas further away from the block
|
||||||
*/
|
*/
|
||||||
public static boolean cantStandFar(Block block) {
|
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));
|
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));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -136,17 +141,23 @@ public final class Utilities {
|
|||||||
public static boolean isFullyInWater(Location player) {
|
public static boolean isFullyInWater(Location player) {
|
||||||
double touchedX = fixXAxis(player.getX());
|
double touchedX = fixXAxis(player.getX());
|
||||||
|
|
||||||
// Yes, this doesn't make sense, but it's supposed to fix some false positives in water walk.
|
// 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 :)
|
// 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()) {
|
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 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();
|
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();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Fixes a player's X position to determine the block they are on, even if they're on the edge
|
* Fixes a player's X position to determine the block they are on, even if
|
||||||
|
* they're on the edge
|
||||||
*
|
*
|
||||||
* @param x player's x position
|
* @param x player's x position
|
||||||
* @return fixed x position
|
* @return fixed x position
|
||||||
@@ -282,7 +293,10 @@ public final class Utilities {
|
|||||||
Block block = player.getLocation().getBlock();
|
Block block = player.getLocation().getBlock();
|
||||||
Material lily = Material.WATER_LILY;
|
Material lily = Material.WATER_LILY;
|
||||||
// TODO: Can we fix X this?
|
// TODO: Can we fix X this?
|
||||||
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;
|
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;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -292,7 +306,8 @@ public final class Utilities {
|
|||||||
* @return true if submersed
|
* @return true if submersed
|
||||||
*/
|
*/
|
||||||
public static boolean isSubmersed(Player player) {
|
public static boolean isSubmersed(Player player) {
|
||||||
return player.getLocation().getBlock().isLiquid() && player.getLocation().getBlock().getRelative(BlockFace.UP).isLiquid();
|
return player.getLocation().getBlock().isLiquid()
|
||||||
|
&& player.getLocation().getBlock().getRelative(BlockFace.UP).isLiquid();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -302,7 +317,9 @@ public final class Utilities {
|
|||||||
* @return true if in water
|
* @return true if in water
|
||||||
*/
|
*/
|
||||||
public static boolean isInWater(Player player) {
|
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();
|
return player.getLocation().getBlock().isLiquid()
|
||||||
|
|| player.getLocation().getBlock().getRelative(BlockFace.DOWN).isLiquid()
|
||||||
|
|| player.getLocation().getBlock().getRelative(BlockFace.UP).isLiquid();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -312,7 +329,9 @@ public final class Utilities {
|
|||||||
* @return true if in web
|
* @return true if in web
|
||||||
*/
|
*/
|
||||||
public static boolean isInWeb(Player player) {
|
public static boolean isInWeb(Player player) {
|
||||||
return player.getLocation().getBlock().getType() == Material.WEB || player.getLocation().getBlock().getRelative(BlockFace.DOWN).getType() == Material.WEB || player.getLocation().getBlock().getRelative(BlockFace.UP).getType() == Material.WEB;
|
return player.getLocation().getBlock().getType() == Material.WEB
|
||||||
|
|| player.getLocation().getBlock().getRelative(BlockFace.DOWN).getType() == Material.WEB
|
||||||
|
|| player.getLocation().getBlock().getRelative(BlockFace.UP).getType() == Material.WEB;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -322,7 +341,8 @@ public final class Utilities {
|
|||||||
* @return true if climbable
|
* @return true if climbable
|
||||||
*/
|
*/
|
||||||
public static boolean isClimbableBlock(Block block) {
|
public static boolean isClimbableBlock(Block block) {
|
||||||
return block.getType() == Material.VINE || block.getType() == Material.LADDER || block.getType() == Material.WATER || block.getType() == Material.STATIONARY_WATER;
|
return block.getType() == Material.VINE || block.getType() == Material.LADDER
|
||||||
|
|| block.getType() == Material.WATER || block.getType() == Material.STATIONARY_WATER;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -366,7 +386,8 @@ public final class Utilities {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Calculate the time in milliseconds that it should take to break the given block with the given tool
|
* Calculate the time in milliseconds that it should take to break the given
|
||||||
|
* block with the given tool
|
||||||
*
|
*
|
||||||
* @param tool tool to check
|
* @param tool tool to check
|
||||||
* @param block block to check
|
* @param block block to check
|
||||||
@@ -396,7 +417,8 @@ public final class Utilities {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Determine whether the given tool is a combination that makes the breaking of this block faster
|
* Determine whether the given tool is a combination that makes the breaking of
|
||||||
|
* this block faster
|
||||||
*
|
*
|
||||||
* @param tool tool to check
|
* @param tool tool to check
|
||||||
* @param block block to check
|
* @param block block to check
|
||||||
@@ -471,7 +493,11 @@ public final class Utilities {
|
|||||||
* @return ArrayList with string
|
* @return ArrayList with string
|
||||||
*/
|
*/
|
||||||
public static ArrayList<String> stringToList(final String string) {
|
public static ArrayList<String> stringToList(final String string) {
|
||||||
return new ArrayList<String>() {{ add(string); }};
|
return new ArrayList<String>() {
|
||||||
|
{
|
||||||
|
add(string);
|
||||||
|
}
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -493,16 +519,18 @@ public final class Utilities {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Parse a string in the format of "XdXhXmXs" to seconds
|
* Parse a string in the format of "XdXhXmXs" to seconds
|
||||||
|
*
|
||||||
* @param string The string to parse
|
* @param string The string to parse
|
||||||
* @return seconds
|
* @return seconds
|
||||||
*/
|
*/
|
||||||
public static long lifeToSeconds(String string) {
|
public static long lifeToSeconds(String string) {
|
||||||
if (string.equals("0") || string.equals("")) return 0;
|
if (string.equals("0") || string.equals(""))
|
||||||
String[] lifeMatch = new String[]{ "d", "h", "m", "s" };
|
return 0;
|
||||||
int[] lifeInterval = new int[]{ 86400, 3600, 60, 1 };
|
String[] lifeMatch = new String[] { "d", "h", "m", "s" };
|
||||||
|
int[] lifeInterval = new int[] { 86400, 3600, 60, 1 };
|
||||||
long seconds = 0L;
|
long seconds = 0L;
|
||||||
|
|
||||||
for (int i=0;i<lifeMatch.length;i++) {
|
for (int i = 0; i < lifeMatch.length; i++) {
|
||||||
Matcher matcher = Pattern.compile("([0-9]*)" + lifeMatch[i]).matcher(string);
|
Matcher matcher = Pattern.compile("([0-9]*)" + lifeMatch[i]).matcher(string);
|
||||||
while (matcher.find()) {
|
while (matcher.find()) {
|
||||||
seconds += Integer.parseInt(matcher.group(1)) * lifeInterval[i];
|
seconds += Integer.parseInt(matcher.group(1)) * lifeInterval[i];
|
||||||
@@ -512,7 +540,6 @@ public final class Utilities {
|
|||||||
return seconds;
|
return seconds;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static {
|
static {
|
||||||
// START INSTANT BREAK MATERIALS
|
// START INSTANT BREAK MATERIALS
|
||||||
INSTANT_BREAK.add(Material.RED_MUSHROOM);
|
INSTANT_BREAK.add(Material.RED_MUSHROOM);
|
||||||
|
|||||||
@@ -30,13 +30,8 @@ import org.bukkit.inventory.ItemStack;
|
|||||||
|
|
||||||
public class VersionUtil {
|
public class VersionUtil {
|
||||||
|
|
||||||
private static final List<String> SUPPORTED_VERSIONS = Arrays.asList(new String[] {
|
private static final List<String> SUPPORTED_VERSIONS = Arrays
|
||||||
"v1_8",
|
.asList(new String[] { "v1_8", "v1_9", "v1_10", "v1_11", "v1_12" });
|
||||||
"v1_9",
|
|
||||||
"v1_10",
|
|
||||||
"v1_11",
|
|
||||||
"v1_12"
|
|
||||||
});
|
|
||||||
|
|
||||||
public static String getVersion() {
|
public static String getVersion() {
|
||||||
return Bukkit.getServer().getClass().getPackage().getName().replace(".", ",").split(",")[3];
|
return Bukkit.getServer().getClass().getPackage().getName().replace(".", ",").split(",")[3];
|
||||||
@@ -58,7 +53,8 @@ public class VersionUtil {
|
|||||||
Material.SPRUCE_WOOD_STAIRS, Material.WOOD_STAIRS);
|
Material.SPRUCE_WOOD_STAIRS, Material.WOOD_STAIRS);
|
||||||
|
|
||||||
public static boolean isFlying(Player p) {
|
public static boolean isFlying(Player p) {
|
||||||
if (getVersion().startsWith("v1_9") || getVersion().startsWith("v1_10") || getVersion().startsWith("v1_11") || getVersion().startsWith("v1_12")) {
|
if (getVersion().startsWith("v1_9") || getVersion().startsWith("v1_10") || getVersion().startsWith("v1_11")
|
||||||
|
|| getVersion().startsWith("v1_12")) {
|
||||||
return p.isFlying() || p.isGliding() || p.hasPotionEffect(NMS_1_9_PLUS.LEVITATION);
|
return p.isFlying() || p.isGliding() || p.hasPotionEffect(NMS_1_9_PLUS.LEVITATION);
|
||||||
} else {
|
} else {
|
||||||
return p.isFlying();
|
return p.isFlying();
|
||||||
@@ -66,7 +62,8 @@ public class VersionUtil {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static EnumSet<Material> getMoveUpBlocks() {
|
public static EnumSet<Material> getMoveUpBlocks() {
|
||||||
if (getVersion().startsWith("v1_9") || getVersion().startsWith("v1_10") || getVersion().startsWith("v1_11") || getVersion().startsWith("v1_12")) {
|
if (getVersion().startsWith("v1_9") || getVersion().startsWith("v1_10") || getVersion().startsWith("v1_11")
|
||||||
|
|| getVersion().startsWith("v1_12")) {
|
||||||
return NMS_1_9_PLUS.MOVE_UP_BLOCKS_1_9;
|
return NMS_1_9_PLUS.MOVE_UP_BLOCKS_1_9;
|
||||||
} else {
|
} else {
|
||||||
return MOVE_UP_BLOCKS_1_8;
|
return MOVE_UP_BLOCKS_1_8;
|
||||||
@@ -74,7 +71,8 @@ public class VersionUtil {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static boolean isNewYSpeed() {
|
public static boolean isNewYSpeed() {
|
||||||
if (getVersion().startsWith("v1_9") || getVersion().startsWith("v1_10") || getVersion().startsWith("v1_11") || getVersion().startsWith("v1_12")) {
|
if (getVersion().startsWith("v1_9") || getVersion().startsWith("v1_10") || getVersion().startsWith("v1_11")
|
||||||
|
|| getVersion().startsWith("v1_12")) {
|
||||||
return true;
|
return true;
|
||||||
} else {
|
} else {
|
||||||
return false;
|
return false;
|
||||||
@@ -82,7 +80,8 @@ public class VersionUtil {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static long getHealTime() {
|
public static long getHealTime() {
|
||||||
if (getVersion().startsWith("v1_9") || getVersion().startsWith("v1_10") || getVersion().startsWith("v1_11") || getVersion().startsWith("v1_12")) {
|
if (getVersion().startsWith("v1_9") || getVersion().startsWith("v1_10") || getVersion().startsWith("v1_11")
|
||||||
|
|| getVersion().startsWith("v1_12")) {
|
||||||
return 495;
|
return 495;
|
||||||
} else {
|
} else {
|
||||||
return 1995;
|
return 1995;
|
||||||
@@ -90,7 +89,8 @@ public class VersionUtil {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static boolean isFrostWalk(Player player) {
|
public static boolean isFrostWalk(Player player) {
|
||||||
if (getVersion().startsWith("v1_9") || getVersion().startsWith("v1_10") || getVersion().startsWith("v1_11") || getVersion().startsWith("v1_12")) {
|
if (getVersion().startsWith("v1_9") || getVersion().startsWith("v1_10") || getVersion().startsWith("v1_11")
|
||||||
|
|| getVersion().startsWith("v1_12")) {
|
||||||
if (player.getInventory().getBoots() == null) {
|
if (player.getInventory().getBoots() == null) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -101,7 +101,8 @@ public class VersionUtil {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static ItemStack getItemInHand(Player player) {
|
public static ItemStack getItemInHand(Player player) {
|
||||||
if (getVersion().startsWith("v1_9") || getVersion().startsWith("v1_10") || getVersion().startsWith("v1_11") || getVersion().startsWith("v1_12")) {
|
if (getVersion().startsWith("v1_9") || getVersion().startsWith("v1_10") || getVersion().startsWith("v1_11")
|
||||||
|
|| getVersion().startsWith("v1_12")) {
|
||||||
return NMS_1_9_PLUS.getItemInHand(player);
|
return NMS_1_9_PLUS.getItemInHand(player);
|
||||||
} else {
|
} else {
|
||||||
return player.getItemInHand();
|
return player.getItemInHand();
|
||||||
|
|||||||
@@ -88,7 +88,7 @@ public class Rule {
|
|||||||
private Type type;
|
private Type type;
|
||||||
|
|
||||||
public enum Type {
|
public enum Type {
|
||||||
CONDITIONAL(".*[?]*.*:.*", "net.gravitydevelopment.anticheat.util.rule.ConditionalRule");
|
CONDITIONAL(".*[?]*.*:.*", "com.rammelkast.anticheatreloaded.util.rule.ConditionalRule");
|
||||||
|
|
||||||
private String regex;
|
private String regex;
|
||||||
private String c;
|
private String c;
|
||||||
|
|||||||
@@ -60,9 +60,12 @@ permissions:
|
|||||||
anticheat.check.zombe.cheat:
|
anticheat.check.zombe.cheat:
|
||||||
description: Allow players to use zombe cheat hack
|
description: Allow players to use zombe cheat hack
|
||||||
default: false
|
default: false
|
||||||
anticheat.check.fly:
|
anticheat.check.flight:
|
||||||
description: Allow players to fly
|
description: Allow players to fly
|
||||||
default: false
|
default: false
|
||||||
|
anticheat.check.elytra:
|
||||||
|
description: Allow players to fly when using elytra
|
||||||
|
default: false
|
||||||
anticheat.check.waterwalk:
|
anticheat.check.waterwalk:
|
||||||
description: Allow players to walk on water
|
description: Allow players to walk on water
|
||||||
default: false
|
default: false
|
||||||
|
|||||||
Reference in new issue
Block a user