mirror of
https://github.com/darksaid98/AntiCheatReloaded.git
synced 2026-12-01 22:14:49 +00:00
Improve command system
This commit is contained in:
1 parent
732ac8c78e
commit
706a9df225
15 files changed
+988
-497
No files matched your search
@@ -19,6 +19,7 @@
|
||||
package net.gravitydevelopment.anticheat;
|
||||
|
||||
import com.comphenix.protocol.ProtocolLibrary;
|
||||
import net.gravitydevelopment.anticheat.command.CommandHandler;
|
||||
import net.gravitydevelopment.anticheat.config.Configuration;
|
||||
import net.gravitydevelopment.anticheat.event.*;
|
||||
import net.gravitydevelopment.anticheat.manage.AntiCheatManager;
|
||||
@@ -45,6 +46,7 @@ public class AntiCheat extends JavaPlugin {
|
||||
private static AntiCheat plugin;
|
||||
private static List<Listener> eventList = new ArrayList<Listener>();
|
||||
private static boolean update = false;
|
||||
private static String updateDetails = null;
|
||||
private static Configuration config;
|
||||
private static boolean verbose;
|
||||
private static boolean developer;
|
||||
@@ -156,6 +158,9 @@ public class AntiCheat extends JavaPlugin {
|
||||
Updater updater = new Updater(plugin, PROJECT_ID, file, Updater.UpdateType.DEFAULT, false);
|
||||
update = updater.getResult() == Updater.UpdateResult.SUCCESS;
|
||||
verboseLog("Update available: " + update);
|
||||
if (update) {
|
||||
updateDetails = updater.getLatestName() + " for " + updater.getLatestGameVersion();
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -199,6 +204,10 @@ public class AntiCheat extends JavaPlugin {
|
||||
return !update;
|
||||
}
|
||||
|
||||
public static String getUpdateDetails() {
|
||||
return updateDetails;
|
||||
}
|
||||
|
||||
public static String getVersion() {
|
||||
return manager.getPlugin().getDescription().getVersion();
|
||||
}
|
||||
|
||||
@@ -1,497 +0,0 @@
|
||||
/*
|
||||
* AntiCheat for Bukkit.
|
||||
* Copyright (C) 2012-2014 AntiCheat Team | http://gravitydevelopment.net
|
||||
*
|
||||
* 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 net.gravitydevelopment.anticheat;
|
||||
|
||||
import net.gravitydevelopment.anticheat.config.Configuration;
|
||||
import net.gravitydevelopment.anticheat.config.ConfigurationFile;
|
||||
import net.gravitydevelopment.anticheat.manage.CheckManager;
|
||||
import net.gravitydevelopment.anticheat.check.CheckType;
|
||||
import net.gravitydevelopment.anticheat.util.User;
|
||||
import net.gravitydevelopment.anticheat.manage.UserManager;
|
||||
import net.gravitydevelopment.anticheat.util.*;
|
||||
import net.gravitydevelopment.anticheat.xray.XRayTracker;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.Server;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandExecutor;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.metadata.FixedMetadataValue;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class CommandHandler implements CommandExecutor {
|
||||
private static final Configuration CONFIG = AntiCheat.getManager().getConfiguration();
|
||||
private static final UserManager USER_MANAGER = AntiCheat.getManager().getUserManager();
|
||||
private static final XRayTracker XRAY_TRACKER = AntiCheat.getManager().getXRayTracker();
|
||||
private static final ChatColor RED = ChatColor.RED;
|
||||
private static final ChatColor YELLOW = ChatColor.YELLOW;
|
||||
private static final ChatColor GREEN = ChatColor.GREEN;
|
||||
private static final ChatColor WHITE = ChatColor.WHITE;
|
||||
private static final ChatColor GRAY = ChatColor.GRAY;
|
||||
private static final Server SERVER = Bukkit.getServer();
|
||||
private static final String PERMISSIONS_ERROR = RED + "Insufficient Permissions.";
|
||||
private static final String MENU_END = "-----------------------------------------------------";
|
||||
|
||||
public void handleLog(CommandSender cs, String[] args) {
|
||||
if (hasPermission(cs, Permission.SYSTEM_LOG)) {
|
||||
|
||||
ConfigurationFile.ConfigValue<Boolean> value;
|
||||
String name;
|
||||
if (args[1].equalsIgnoreCase("file")) {
|
||||
value = CONFIG.getConfig().logToFile;
|
||||
name = "File logging";
|
||||
} else if (args[1].equalsIgnoreCase("console")) {
|
||||
value = CONFIG.getConfig().logToConsole;
|
||||
name = "Console logging";
|
||||
} else {
|
||||
cs.sendMessage(RED + "Usage: /anticheat log [file/console] [on/off]");
|
||||
return;
|
||||
}
|
||||
|
||||
boolean newValue;
|
||||
if (args[2].equalsIgnoreCase("on") || args[2].equalsIgnoreCase("enable")) {
|
||||
newValue = true;
|
||||
} else if (args[2].equalsIgnoreCase("off") || args[2].equalsIgnoreCase("disable")) {
|
||||
newValue = false;
|
||||
} else {
|
||||
cs.sendMessage(RED + "Usage: /anticheat log [file/console] [on/off]");
|
||||
return;
|
||||
}
|
||||
|
||||
if (value.getValue() == newValue) {
|
||||
cs.sendMessage(GREEN + name + " is already enabled!");
|
||||
} else {
|
||||
value.setValue(newValue);
|
||||
cs.sendMessage(GREEN + name + (newValue ? " enabled." : " disabled."));
|
||||
CONFIG.getConfig().reload();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void handleDebug(CommandSender cs) {
|
||||
handleDebug(cs, null);
|
||||
}
|
||||
|
||||
public void handleDebug(CommandSender cs, Player tp) {
|
||||
if (hasPermission(cs, Permission.SYSTEM_REPORT)) {
|
||||
cs.sendMessage(GRAY + "Please wait while I collect some data...");
|
||||
PastebinReport report = new PastebinReport(cs, tp);
|
||||
cs.sendMessage(GREEN + "Debug information posted to: " + WHITE + report.getURL());
|
||||
cs.sendMessage(GREEN + "Please include this link when making bug reports.");
|
||||
}
|
||||
}
|
||||
|
||||
public void handleXRay(CommandSender cs, String[] args) {
|
||||
if (hasPermission(cs, Permission.SYSTEM_XRAY)) {
|
||||
if (CONFIG.getConfig().checkXRay.getValue()) {
|
||||
List<Player> list = SERVER.matchPlayer(args[1]);
|
||||
if (list.size() == 1) {
|
||||
Player player = list.get(0);
|
||||
if (XRAY_TRACKER.sufficientData(player.getName())) {
|
||||
XRAY_TRACKER.sendStats(cs, player.getName());
|
||||
} else {
|
||||
cs.sendMessage(RED + "Insufficient data collected from " + WHITE + args[1] + RED + ".");
|
||||
cs.sendMessage(RED + "Please wait until more info is collected before predictions are calculated.");
|
||||
}
|
||||
} else if (list.size() > 1) {
|
||||
cs.sendMessage(RED + "Multiple players found by name: " + WHITE + args[1] + RED + ".");
|
||||
} else if (XRAY_TRACKER.sufficientData(args[1])) {
|
||||
XRAY_TRACKER.sendStats(cs, args[1]);
|
||||
} else {
|
||||
cs.sendMessage(RED + "Insufficient data collected from " + WHITE + args[1] + RED + ".");
|
||||
cs.sendMessage(RED + "Please wait until more info is collected before predictions are calculated.");
|
||||
}
|
||||
} else {
|
||||
cs.sendMessage(RED + "XRay logging is off in the config.");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void handleReset(CommandSender cs, String[] args) {
|
||||
if (hasPermission(cs, Permission.SYSTEM_RESET)) {
|
||||
List<Player> list = SERVER.matchPlayer(args[1]);
|
||||
if (list.size() == 1) {
|
||||
Player player = list.get(0);
|
||||
User user = USER_MANAGER.getUser(player.getName());
|
||||
if (user != null) {
|
||||
user.resetLevel();
|
||||
XRAY_TRACKER.reset(player.getName());
|
||||
user.clearMessages();
|
||||
AntiCheat.getManager().getBackend().resetChatLevel(player);
|
||||
cs.sendMessage(player.getName() + GREEN + " has been reset.");
|
||||
} else {
|
||||
|
||||
}
|
||||
} else if (list.size() > 1) {
|
||||
cs.sendMessage(RED + "Multiple players found by name: " + WHITE + args[1] + RED + ".");
|
||||
} else {
|
||||
cs.sendMessage(RED + "Player: " + WHITE + args[1] + RED + " not found.");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void handleSpy(CommandSender cs, String[] args) {
|
||||
if (cs instanceof Player) {
|
||||
if (hasPermission(cs, Permission.SYSTEM_SPY)) {
|
||||
Player sender = (Player) cs;
|
||||
if (!args[1].equalsIgnoreCase("off")) {
|
||||
List<Player> list = SERVER.matchPlayer(args[1]);
|
||||
if (list.size() == 1) {
|
||||
Player player = list.get(0);
|
||||
for (Player p : cs.getServer().getOnlinePlayers()) {
|
||||
if (!Permission.SYSTEM_SPY.get(p)) {
|
||||
p.hidePlayer(sender);
|
||||
}
|
||||
}
|
||||
if (!sender.hasMetadata(Utilities.SPY_METADATA)) // Maintain ORIGINAL location and other data
|
||||
{
|
||||
SpyState state = new SpyState(sender.getAllowFlight(), sender.isFlying(), sender.getLocation());
|
||||
sender.setMetadata(Utilities.SPY_METADATA, new FixedMetadataValue(AntiCheat.getPlugin(), state));
|
||||
}
|
||||
sender.setAllowFlight(true);
|
||||
sender.setFlying(true);
|
||||
sender.teleport(player);
|
||||
sender.sendMessage(GREEN + "You have been teleported to " + player.getName() + " and made invisible.");
|
||||
sender.sendMessage(GREEN + "To stop spying, type " + WHITE + " /AntiCheat spy off");
|
||||
} else if (list.size() > 1) {
|
||||
cs.sendMessage(RED + "Multiple players found by name: " + WHITE + args[1] + RED + ".");
|
||||
} else {
|
||||
cs.sendMessage(RED + "Player: " + WHITE + args[1] + RED + " not found.");
|
||||
}
|
||||
} else {
|
||||
if (sender.hasMetadata(Utilities.SPY_METADATA)) {
|
||||
SpyState state = ((SpyState) sender.getMetadata(Utilities.SPY_METADATA).get(0).value());
|
||||
sender.setAllowFlight(state.getAllowFlight());
|
||||
sender.setFlying(state.getFlying());
|
||||
sender.teleport(state.getLocation());
|
||||
sender.removeMetadata(Utilities.SPY_METADATA, AntiCheat.getPlugin());
|
||||
for (Player p : cs.getServer().getOnlinePlayers()) {
|
||||
p.showPlayer(sender);
|
||||
}
|
||||
sender.sendMessage(GREEN + "Done spying! Brought you back to where you started!");
|
||||
} else {
|
||||
sender.sendMessage(RED + "You were not spying.");
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
cs.sendMessage(RED + "Sorry, but you can't spy on a player from the console.");
|
||||
}
|
||||
}
|
||||
|
||||
public void handleHelp(CommandSender cs) {
|
||||
if (hasPermission(cs, Permission.SYSTEM_HELP)) {
|
||||
String base = "/AntiCheat ";
|
||||
String[] lines = {
|
||||
"log [file/console] [on/off]" + WHITE + " - toggle logging",
|
||||
"report [group]" + WHITE + " - show users in groups",
|
||||
"report [user]" + WHITE + " - get a player's cheat report",
|
||||
"reload" + WHITE + " - reload AntiCheat configuration",
|
||||
"reset [user]" + WHITE + " - reset user's hack level",
|
||||
"xray [user]" + WHITE + " - check user's xray levels",
|
||||
"spy [user]" + WHITE + " - spy on a user in secret",
|
||||
"help" + WHITE + " - access this page",
|
||||
"debug" + WHITE + " - post debug information",
|
||||
"update" + WHITE + " - check update status",
|
||||
};
|
||||
|
||||
cs.sendMessage("----------------------[" + GREEN + "AntiCheat" + WHITE + "]----------------------");
|
||||
for (String s : lines) {
|
||||
cs.sendMessage(base + GREEN + s);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void handleUpdate(CommandSender cs) {
|
||||
if (hasPermission(cs, Permission.SYSTEM_UPDATE)) {
|
||||
cs.sendMessage(GRAY + "Running AntiCheat v" + GREEN + AntiCheat.getVersion());
|
||||
cs.sendMessage(MENU_END);
|
||||
if (!AntiCheat.isUpdated()) {
|
||||
cs.sendMessage(GRAY + "There " + GREEN + "IS" + GRAY + " a newer version available.");
|
||||
if (CONFIG.getConfig().autoUpdate.getValue()) {
|
||||
cs.sendMessage(GRAY + "It will be installed automatically for you on next launch.");
|
||||
} else {
|
||||
cs.sendMessage(GRAY + "Due to your config settings, we " + RED + "can not" + GRAY + " auto update.");
|
||||
cs.sendMessage(GRAY + "Please visit http://dev.bukkit.org/server-mods/anticheat/");
|
||||
}
|
||||
} else {
|
||||
cs.sendMessage(GRAY + "AntiCheat is " + GREEN + "UP TO DATE!");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void handleCalibrate(CommandSender cs) {
|
||||
if (cs instanceof Player) {
|
||||
if (hasPermission(cs, Permission.SYSTEM_CALIBRATE)) {
|
||||
Calibrator c = new Calibrator((Player) cs);
|
||||
SERVER.getPluginManager().registerEvents(c, AntiCheat.getPlugin());
|
||||
c.calibrate();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void handleReport(CommandSender cs, String[] args) {
|
||||
if (hasPermission(cs, Permission.SYSTEM_REPORT)) {
|
||||
if (args.length > 1) {
|
||||
String group = args[1];
|
||||
int num = getReportPageNum(args);
|
||||
if (group.equalsIgnoreCase("low")) {
|
||||
if (num > 0) {
|
||||
sendReport(cs, null, num);
|
||||
} else {
|
||||
cs.sendMessage(RED + "Not a valid page number: " + WHITE + args[2]);
|
||||
}
|
||||
} else if (group.equalsIgnoreCase("all")) {
|
||||
cs.sendMessage(GREEN + "Low: " + WHITE + USER_MANAGER.getUsersInGroup(null).size() + " players");
|
||||
for (Group g : CONFIG.getGroups().getGroups()) {
|
||||
int numPlayers = USER_MANAGER.getUsersInGroup(g).size();
|
||||
cs.sendMessage(g.getColor() + g.getName() + WHITE + ": " + numPlayers + " players");
|
||||
}
|
||||
cs.sendMessage("Use /anticheat report [group] for a list of players in each group.");
|
||||
} else {
|
||||
boolean sent = false;
|
||||
for (Group g : CONFIG.getGroups().getGroups()) {
|
||||
if (g.getName().equalsIgnoreCase(group)) {
|
||||
sendReport(cs, g, num);
|
||||
sent = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!sent) {
|
||||
cs.sendMessage(RED + "Not a valid group: " + WHITE + group);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public int getReportPageNum(String[] args) {
|
||||
if (args.length == 2) {
|
||||
return 1;
|
||||
} else if (Utilities.isInt(args[2])) {
|
||||
return Integer.parseInt(args[2]);
|
||||
} else {
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
public void sendReport(CommandSender cs, Group group, int page) {
|
||||
List<User> users = USER_MANAGER.getUsersInGroup(group);
|
||||
ChatColor color = group == null ? GREEN : group.getColor();
|
||||
String groupName = group == null ? "Low" : group.getName();
|
||||
int pages = (int) Math.ceil(((float) users.size()) / 7);
|
||||
if (page <= pages && page > 0) {
|
||||
cs.sendMessage("--------------------[" + GREEN + "REPORT[" + page + "/" + pages + "]" + WHITE + "]---------------------");
|
||||
cs.sendMessage(GRAY + "Group: " + color + groupName);
|
||||
for (int x = 0; x < 7; x++) {
|
||||
int index = ((page - 1) * 6) + (x + ((page - 1) * 1));
|
||||
if (index < users.size()) {
|
||||
String player = users.get(index).getName();
|
||||
cs.sendMessage(GRAY + player);
|
||||
}
|
||||
}
|
||||
cs.sendMessage(MENU_END);
|
||||
} else {
|
||||
if (pages == 0) {
|
||||
cs.sendMessage("--------------------[" + GREEN + "REPORT[1/1]" + WHITE + "]---------------------");
|
||||
cs.sendMessage(GRAY + "Group: " + color + groupName);
|
||||
cs.sendMessage(GRAY + "There are no users in this group.");
|
||||
cs.sendMessage(MENU_END);
|
||||
} else {
|
||||
cs.sendMessage(RED + "Page not found. Requested " + WHITE + page + RED + ", Max " + WHITE + pages);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void handlePlayerReport(CommandSender cs, String[] args) {
|
||||
if (hasPermission(cs, Permission.SYSTEM_REPORT)) {
|
||||
User user = AntiCheat.getManager().getUserManager().getUser(args[1]);
|
||||
boolean cont = false;
|
||||
if (user == null) {
|
||||
if ((user = AntiCheat.getManager().getUserManager().getUser(args[1])) == null) {
|
||||
cs.sendMessage(RED + "Player: " + WHITE + args[1] + RED + " not found.");
|
||||
} else {
|
||||
cont = true;
|
||||
}
|
||||
} else {
|
||||
cont = true;
|
||||
}
|
||||
if (cont) {
|
||||
List<CheckType> l = new ArrayList<CheckType>();
|
||||
for (CheckType type : CheckType.values()) {
|
||||
if (type.getUses(user.getName()) > 0) {
|
||||
l.add(type);
|
||||
}
|
||||
}
|
||||
if (args.length == 2) {
|
||||
sendPlayerReport(cs, l, user, 1);
|
||||
} else if (Utilities.isInt(args[2])) {
|
||||
int num = Integer.parseInt(args[2]);
|
||||
sendPlayerReport(cs, l, user, num);
|
||||
} else {
|
||||
cs.sendMessage(RED + "Not a valid page number: " + WHITE + args[2]);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void handleDeveloper(CommandSender cs) {
|
||||
if (hasPermission(cs, Permission.SYSTEM_DEBUG)) {
|
||||
AntiCheat.setDeveloperMode(!AntiCheat.developerMode());
|
||||
cs.sendMessage(GREEN + "Developer mode " + (AntiCheat.developerMode() ? "ON" : "OFF"));
|
||||
}
|
||||
}
|
||||
|
||||
public void sendPlayerReport(CommandSender cs, List<CheckType> types, User user, int page) {
|
||||
String name = user.getName();
|
||||
int pages = (int) Math.ceil(((float) types.size()) / 6);
|
||||
|
||||
Group group = user.getGroup();
|
||||
String groupString = GREEN + "Low";
|
||||
|
||||
if (group != null) {
|
||||
groupString = group.getColor() + group.getName();
|
||||
}
|
||||
groupString += " (" + user.getLevel() + ")";
|
||||
|
||||
if (page <= pages && page > 0) {
|
||||
cs.sendMessage("--------------------[" + GREEN + "REPORT[" + page + "/" + pages + "]" + WHITE + "]---------------------");
|
||||
cs.sendMessage(GRAY + "Player: " + WHITE + name);
|
||||
cs.sendMessage(GRAY + "Group: " + groupString);
|
||||
for (int x = 0; x < 6; x++) {
|
||||
int index = ((page - 1) * 5) + (x + ((page - 1)));
|
||||
if (index < types.size()) {
|
||||
CheckType type = types.get(index);
|
||||
int use = type.getUses(name);
|
||||
ChatColor color = WHITE;
|
||||
if (use >= 20) {
|
||||
color = YELLOW;
|
||||
} else if (use > 50) {
|
||||
color = RED;
|
||||
}
|
||||
cs.sendMessage(GRAY + CheckType.getName(type) + ": " + color + use);
|
||||
}
|
||||
}
|
||||
cs.sendMessage(MENU_END);
|
||||
} else {
|
||||
if (pages == 0) {
|
||||
cs.sendMessage("--------------------[" + GREEN + "REPORT[1/1]" + WHITE + "]---------------------");
|
||||
cs.sendMessage(GRAY + "Player: " + WHITE + name);
|
||||
cs.sendMessage(GRAY + "Group: " + groupString);
|
||||
cs.sendMessage(GRAY + "This user has not failed any checks.");
|
||||
cs.sendMessage(MENU_END);
|
||||
} else {
|
||||
cs.sendMessage(RED + "Page not found. Requested " + WHITE + page + RED + ", Max " + WHITE + pages);
|
||||
}
|
||||
}
|
||||
|
||||
if (AntiCheat.developerMode()) {
|
||||
int permission = 0;
|
||||
int check = 0;
|
||||
for (Permission perm : Permission.values()) {
|
||||
if (perm.get(user.getPlayer())) permission++;
|
||||
}
|
||||
CheckManager manager = AntiCheat.getManager().getCheckManager();
|
||||
for (CheckType type : CheckType.values()) {
|
||||
if (manager.willCheck(user.getPlayer(), type)) check++;
|
||||
}
|
||||
cs.sendMessage(ChatColor.GOLD + "User has " + permission + "/" + Permission.values().length + " permissions");
|
||||
cs.sendMessage(ChatColor.GOLD + "User will be checked for " + check + "/" + CheckType.values().length + " checks");
|
||||
}
|
||||
}
|
||||
|
||||
public void handleReload(CommandSender cs) {
|
||||
if (hasPermission(cs, Permission.SYSTEM_RELOAD)) {
|
||||
CONFIG.load();
|
||||
cs.sendMessage(GREEN + "AntiCheat configuration reloaded.");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onCommand(CommandSender cs, Command cmd, String alias, String[] args) {
|
||||
if (args.length == 3) {
|
||||
if (args[0].equalsIgnoreCase("report")) {
|
||||
for (Group group : CONFIG.getGroups().getGroups()) {
|
||||
if (args[1].equalsIgnoreCase(group.getName())) {
|
||||
handleReport(cs, args);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
handlePlayerReport(cs, args);
|
||||
}
|
||||
if (args[0].equalsIgnoreCase("log")) {
|
||||
handleLog(cs, args);
|
||||
}
|
||||
} else if (args.length == 2) {
|
||||
if (args[0].equalsIgnoreCase("xray")) {
|
||||
handleXRay(cs, args);
|
||||
} else if (args[0].equalsIgnoreCase("debug")) {
|
||||
handleDebug(cs, Bukkit.getPlayer(args[1]));
|
||||
} else if (args[0].equalsIgnoreCase("reset")) {
|
||||
handleReset(cs, args);
|
||||
} else if (args[0].equalsIgnoreCase("spy")) {
|
||||
handleSpy(cs, args);
|
||||
} else if (args[0].equalsIgnoreCase("report")) {
|
||||
if (args[1].equalsIgnoreCase("low") || args[1].equalsIgnoreCase("medium") || args[1].equalsIgnoreCase("high") || args[1].equalsIgnoreCase("all")) {
|
||||
handleReport(cs, args);
|
||||
} else {
|
||||
handlePlayerReport(cs, args);
|
||||
}
|
||||
} else {
|
||||
cs.sendMessage(RED + "Unrecognized command.");
|
||||
}
|
||||
} else if (args.length == 1) {
|
||||
if (args[0].equalsIgnoreCase("help")) {
|
||||
handleHelp(cs);
|
||||
} else if (args[0].equalsIgnoreCase("debug")) {
|
||||
handleDebug(cs);
|
||||
} else if (args[0].equalsIgnoreCase("report")) {
|
||||
cs.sendMessage(GREEN + "To see a user's report, use " + WHITE + "/anticheat report [user]");
|
||||
cs.sendMessage(GREEN + "To see all users in a group, use " + WHITE + "/anticheat report [group]");
|
||||
} else if (args[0].equalsIgnoreCase("reload")) {
|
||||
handleReload(cs);
|
||||
} else if (args[0].equalsIgnoreCase("update")) {
|
||||
handleUpdate(cs);
|
||||
} else if (args[0].equalsIgnoreCase("developer")) {
|
||||
handleDeveloper(cs);
|
||||
}
|
||||
/**
|
||||
* else if (args[0].equalsIgnoreCase("calibrate")) { handleCalibrate(cs); }
|
||||
*/
|
||||
else {
|
||||
cs.sendMessage(RED + "Unrecognized command.");
|
||||
}
|
||||
} else {
|
||||
handleHelp(cs); // Handle no args as alias of help
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public boolean hasPermission(CommandSender cs, Permission perm) {
|
||||
if (perm.get(cs)) {
|
||||
return true;
|
||||
} else {
|
||||
cs.sendMessage(PERMISSIONS_ERROR + " (" + WHITE + perm.toString() + RED + ")");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,111 @@
|
||||
/*
|
||||
* AntiCheat for Bukkit.
|
||||
* Copyright (C) 2012-2014 AntiCheat Team | http://gravitydevelopment.net
|
||||
*
|
||||
* 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 net.gravitydevelopment.anticheat.command;
|
||||
|
||||
import net.gravitydevelopment.anticheat.AntiCheat;
|
||||
import net.gravitydevelopment.anticheat.config.Configuration;
|
||||
import net.gravitydevelopment.anticheat.manage.UserManager;
|
||||
import net.gravitydevelopment.anticheat.util.Permission;
|
||||
import net.gravitydevelopment.anticheat.xray.XRayTracker;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.Server;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
public class CommandBase {
|
||||
|
||||
public static final Configuration CONFIG = AntiCheat.getManager().getConfiguration();
|
||||
public static final UserManager USER_MANAGER = AntiCheat.getManager().getUserManager();
|
||||
public static final XRayTracker XRAY_TRACKER = AntiCheat.getManager().getXRayTracker();
|
||||
public static final ChatColor RED = ChatColor.RED;
|
||||
public static final ChatColor YELLOW = ChatColor.YELLOW;
|
||||
public static final ChatColor GREEN = ChatColor.GREEN;
|
||||
public static final ChatColor WHITE = ChatColor.WHITE;
|
||||
public static final ChatColor GRAY = ChatColor.GRAY;
|
||||
public static final ChatColor GOLD = ChatColor.GOLD;
|
||||
public static final ChatColor AQUA = ChatColor.AQUA;
|
||||
public static final Server SERVER = Bukkit.getServer();
|
||||
public static final String PERMISSIONS_ERROR = RED + "Insufficient Permissions.";
|
||||
public static final String MENU_END = "-----------------------------------------------------";
|
||||
|
||||
private final String name;
|
||||
private final String command;
|
||||
private final String usage;
|
||||
private final String[] help;
|
||||
private final Permission permission;
|
||||
|
||||
public CommandBase(String name, String command, String usage, String help[], Permission permission) {
|
||||
this.name = name;
|
||||
this.command = command;
|
||||
this.usage = usage;
|
||||
this.help = help;
|
||||
this.permission = permission;
|
||||
}
|
||||
|
||||
public void run(CommandSender cs, String[] args) {
|
||||
if (permission.get(cs)) {
|
||||
execute(cs, args);
|
||||
} else {
|
||||
cs.sendMessage(PERMISSIONS_ERROR + " (" + WHITE + permission.toString() + RED + ")");
|
||||
}
|
||||
}
|
||||
|
||||
protected void execute(CommandSender cs, String[] args) {
|
||||
return; // Stub
|
||||
}
|
||||
|
||||
public void sendHelp(CommandSender cs) {
|
||||
cs.sendMessage(GREEN + "== " + GRAY + getName() + GREEN + " ==");
|
||||
cs.sendMessage(GREEN + "Usage: " + GRAY + (cs instanceof Player ? "/" : "") + getUsage());
|
||||
cs.sendMessage(GREEN + "Permission: " + GRAY + getPermission().toString());
|
||||
for (String string : getHelp()) {
|
||||
cs.sendMessage(string);
|
||||
}
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public String getCommand() {
|
||||
return command;
|
||||
}
|
||||
|
||||
public String getUsage() {
|
||||
return usage;
|
||||
}
|
||||
|
||||
public String[] getHelp() {
|
||||
return help;
|
||||
}
|
||||
|
||||
public Permission getPermission() {
|
||||
return permission;
|
||||
}
|
||||
|
||||
public boolean hasPermission(CommandSender cs) {
|
||||
if (permission.get(cs)) {
|
||||
return true;
|
||||
} else {
|
||||
cs.sendMessage(PERMISSIONS_ERROR + " (" + WHITE + permission.toString() + RED + ")");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,67 @@
|
||||
/*
|
||||
* AntiCheat for Bukkit.
|
||||
* Copyright (C) 2012-2014 AntiCheat Team | http://gravitydevelopment.net
|
||||
*
|
||||
* 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 net.gravitydevelopment.anticheat.command;
|
||||
|
||||
import net.gravitydevelopment.anticheat.command.executors.*;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandExecutor;
|
||||
import org.bukkit.command.CommandSender;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class CommandHandler implements CommandExecutor {
|
||||
|
||||
private List<CommandBase> commands = new ArrayList<CommandBase>();
|
||||
|
||||
public CommandHandler() {
|
||||
commands.add(new CommandHelp());
|
||||
commands.add(new CommandCalibrate());
|
||||
commands.add(new CommandDebug());
|
||||
commands.add(new CommandDeveloper());
|
||||
commands.add(new CommandLog());
|
||||
commands.add(new CommandReload());
|
||||
commands.add(new CommandReport());
|
||||
commands.add(new CommandReset());
|
||||
commands.add(new CommandSpy());
|
||||
commands.add(new CommandUpdate());
|
||||
commands.add(new CommandXray());
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onCommand(CommandSender cs, Command cmd, String alias, String[] args) {
|
||||
if (args.length >= 1) {
|
||||
String command = args[0];
|
||||
// Shift args down
|
||||
String[] newArgs = new String[args.length-1];
|
||||
for (int i=1;i<args.length;i++) {
|
||||
newArgs[i-1] = args[i];
|
||||
}
|
||||
for (CommandBase base : commands) {
|
||||
if (base.getCommand().equalsIgnoreCase(command)) {
|
||||
base.execute(cs, newArgs);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
// Send help
|
||||
commands.get(0).execute(cs, null);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
+48
@@ -0,0 +1,48 @@
|
||||
/*
|
||||
* AntiCheat for Bukkit.
|
||||
* Copyright (C) 2012-2014 AntiCheat Team | http://gravitydevelopment.net
|
||||
*
|
||||
* 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 net.gravitydevelopment.anticheat.command.executors;
|
||||
|
||||
import net.gravitydevelopment.anticheat.AntiCheat;
|
||||
import net.gravitydevelopment.anticheat.command.CommandBase;
|
||||
import net.gravitydevelopment.anticheat.util.Calibrator;
|
||||
import net.gravitydevelopment.anticheat.util.Permission;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
public class CommandCalibrate extends CommandBase {
|
||||
|
||||
private static final String NAME = "AntiCheat Calibration";
|
||||
private static final String COMMAND = "calibrate";
|
||||
private static final String USAGE = "anticheat calibrate";
|
||||
private static final Permission PERMISSION = Permission.SYSTEM_CALIBRATE;
|
||||
private static final String[] HELP = {
|
||||
GRAY + "Use: " + AQUA + "/anticheat calibrate" + GRAY + " to calibrate AntiCheat settings",
|
||||
};
|
||||
|
||||
public CommandCalibrate() {
|
||||
super(NAME, COMMAND, USAGE, HELP, PERMISSION);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void execute(CommandSender cs, String[] args) {
|
||||
Calibrator c = new Calibrator((Player) cs);
|
||||
SERVER.getPluginManager().registerEvents(c, AntiCheat.getPlugin());
|
||||
c.calibrate();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,56 @@
|
||||
/*
|
||||
* AntiCheat for Bukkit.
|
||||
* Copyright (C) 2012-2014 AntiCheat Team | http://gravitydevelopment.net
|
||||
*
|
||||
* 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 net.gravitydevelopment.anticheat.command.executors;
|
||||
|
||||
import net.gravitydevelopment.anticheat.command.CommandBase;
|
||||
import net.gravitydevelopment.anticheat.config.ConfigurationFile;
|
||||
import net.gravitydevelopment.anticheat.util.PastebinReport;
|
||||
import net.gravitydevelopment.anticheat.util.Permission;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
public class CommandDebug extends CommandBase {
|
||||
|
||||
private static final String NAME = "AntiCheat Debug Reporting";
|
||||
private static final String COMMAND = "debug";
|
||||
private static final String USAGE = "anticheat debug <user>";
|
||||
private static final Permission PERMISSION = Permission.SYSTEM_DEBUG;
|
||||
private static final String[] HELP = {
|
||||
GRAY + "Use: " + AQUA + "/anticheat debug" + GRAY + " to create a debug report",
|
||||
GRAY + "Use: " + AQUA + "/anticheat debug <user>" + GRAY + " to create a debug report for a user",
|
||||
};
|
||||
|
||||
public CommandDebug() {
|
||||
super(NAME, COMMAND, USAGE, HELP, PERMISSION);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void execute(CommandSender cs, String[] args) {
|
||||
Player player = null;
|
||||
if (args.length == 1) {
|
||||
player = Bukkit.getPlayer(args[0]);
|
||||
}
|
||||
|
||||
cs.sendMessage(GRAY + "Please wait while I collect some data...");
|
||||
PastebinReport report = new PastebinReport(cs, player);
|
||||
cs.sendMessage(GREEN + "Debug information posted to: " + WHITE + report.getURL());
|
||||
cs.sendMessage(GREEN + "Please include this link when making bug reports.");
|
||||
}
|
||||
}
|
||||
+48
@@ -0,0 +1,48 @@
|
||||
/*
|
||||
* AntiCheat for Bukkit.
|
||||
* Copyright (C) 2012-2014 AntiCheat Team | http://gravitydevelopment.net
|
||||
*
|
||||
* 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 net.gravitydevelopment.anticheat.command.executors;
|
||||
|
||||
import net.gravitydevelopment.anticheat.AntiCheat;
|
||||
import net.gravitydevelopment.anticheat.command.CommandBase;
|
||||
import net.gravitydevelopment.anticheat.util.PastebinReport;
|
||||
import net.gravitydevelopment.anticheat.util.Permission;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
public class CommandDeveloper extends CommandBase {
|
||||
|
||||
private static final String NAME = "AntiCheat Developer Mode";
|
||||
private static final String COMMAND = "developer";
|
||||
private static final String USAGE = "anticheat developer";
|
||||
private static final Permission PERMISSION = Permission.SYSTEM_DEBUG;
|
||||
private static final String[] HELP = {
|
||||
GRAY + "Use: " + AQUA + "/anticheat developer" + GRAY + " to turn on developer mode",
|
||||
};
|
||||
|
||||
public CommandDeveloper() {
|
||||
super(NAME, COMMAND, USAGE, HELP, PERMISSION);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void execute(CommandSender cs, String[] args) {
|
||||
AntiCheat.setDeveloperMode(!AntiCheat.developerMode());
|
||||
cs.sendMessage(GREEN + "Developer mode " + (AntiCheat.developerMode() ? "ON" : "OFF"));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,52 @@
|
||||
/*
|
||||
* AntiCheat for Bukkit.
|
||||
* Copyright (C) 2012-2014 AntiCheat Team | http://gravitydevelopment.net
|
||||
*
|
||||
* 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 net.gravitydevelopment.anticheat.command.executors;
|
||||
|
||||
import net.gravitydevelopment.anticheat.command.CommandBase;
|
||||
import net.gravitydevelopment.anticheat.util.Permission;
|
||||
import org.bukkit.command.CommandSender;
|
||||
|
||||
public class CommandHelp extends CommandBase {
|
||||
|
||||
private static final String NAME = "AntiCheat Help";
|
||||
private static final String COMMAND = "help";
|
||||
private static final String USAGE = "anticheat help";
|
||||
private static final Permission PERMISSION = Permission.SYSTEM_HELP;
|
||||
private static final String[] HELP = {
|
||||
GRAY + "/anti " + AQUA + "help",
|
||||
GRAY + "/anti " + AQUA + "reload",
|
||||
GRAY + "/anti " + AQUA + "update",
|
||||
GRAY + "/anti " + AQUA + "debug " + AQUA + "<user>",
|
||||
GRAY + "/anti " + AQUA + "log " + GOLD + "[file/console] [on/off]",
|
||||
GRAY + "/anti " + AQUA + "report " + GOLD + "[group/user]",
|
||||
GRAY + "/anti " + AQUA + "reload",
|
||||
GRAY + "/anti " + AQUA + "reset " + GOLD + "[user]",
|
||||
GRAY + "/anti " + AQUA + "xray " + GOLD + "[user]",
|
||||
GRAY + "/anti " + AQUA + "spy " + GOLD + "[user]",
|
||||
};
|
||||
|
||||
public CommandHelp() {
|
||||
super(NAME, COMMAND, USAGE, HELP, PERMISSION);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void execute(CommandSender cs, String[] args) {
|
||||
sendHelp(cs);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,78 @@
|
||||
/*
|
||||
* AntiCheat for Bukkit.
|
||||
* Copyright (C) 2012-2014 AntiCheat Team | http://gravitydevelopment.net
|
||||
*
|
||||
* 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 net.gravitydevelopment.anticheat.command.executors;
|
||||
|
||||
import net.gravitydevelopment.anticheat.command.CommandBase;
|
||||
import net.gravitydevelopment.anticheat.config.ConfigurationFile;
|
||||
import net.gravitydevelopment.anticheat.util.Permission;
|
||||
import org.bukkit.command.CommandSender;
|
||||
|
||||
public class CommandLog extends CommandBase {
|
||||
|
||||
private static final String NAME = "AntiCheat Logging";
|
||||
private static final String COMMAND = "log";
|
||||
private static final String USAGE = "anticheat log [file/console] [on/off]";
|
||||
private static final Permission PERMISSION = Permission.SYSTEM_LOG;
|
||||
private static final String[] HELP = {
|
||||
GRAY + "Use: " + AQUA + "/anticheat log console on" + GRAY + " to enable console logging",
|
||||
GRAY + "Use: " + AQUA + "/anticheat log file off" + GRAY + " to disable file logging",
|
||||
};
|
||||
|
||||
public CommandLog() {
|
||||
super(NAME, COMMAND, USAGE, HELP, PERMISSION);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void execute(CommandSender cs, String[] args) {
|
||||
if (args.length == 2) {
|
||||
ConfigurationFile.ConfigValue<Boolean> value;
|
||||
String name;
|
||||
if (args[0].equalsIgnoreCase("file")) {
|
||||
value = CONFIG.getConfig().logToFile;
|
||||
name = "File logging";
|
||||
} else if (args[0].equalsIgnoreCase("console")) {
|
||||
value = CONFIG.getConfig().logToConsole;
|
||||
name = "Console logging";
|
||||
} else {
|
||||
sendHelp(cs);
|
||||
return;
|
||||
}
|
||||
|
||||
boolean newValue;
|
||||
if (args[1].equalsIgnoreCase("on") || args[1].equalsIgnoreCase("enable")) {
|
||||
newValue = true;
|
||||
} else if (args[1].equalsIgnoreCase("off") || args[1].equalsIgnoreCase("disable")) {
|
||||
newValue = false;
|
||||
} else {
|
||||
sendHelp(cs);
|
||||
return;
|
||||
}
|
||||
|
||||
if (value.getValue() == newValue) {
|
||||
cs.sendMessage(GREEN + name + " is already enabled!");
|
||||
} else {
|
||||
value.setValue(newValue);
|
||||
cs.sendMessage(GREEN + name + (newValue ? " enabled." : " disabled."));
|
||||
CONFIG.getConfig().reload();
|
||||
}
|
||||
} else {
|
||||
sendHelp(cs);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,47 @@
|
||||
/*
|
||||
* AntiCheat for Bukkit.
|
||||
* Copyright (C) 2012-2014 AntiCheat Team | http://gravitydevelopment.net
|
||||
*
|
||||
* 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 net.gravitydevelopment.anticheat.command.executors;
|
||||
|
||||
import net.gravitydevelopment.anticheat.command.CommandBase;
|
||||
import net.gravitydevelopment.anticheat.util.PastebinReport;
|
||||
import net.gravitydevelopment.anticheat.util.Permission;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
public class CommandReload extends CommandBase {
|
||||
|
||||
private static final String NAME = "AntiCheat Reload";
|
||||
private static final String COMMAND = "reload";
|
||||
private static final String USAGE = "anticheat reload";
|
||||
private static final Permission PERMISSION = Permission.SYSTEM_RELOAD;
|
||||
private static final String[] HELP = {
|
||||
GRAY + "Use: " + AQUA + "/anticheat reload" + GRAY + " to reload AntiCheat settings",
|
||||
};
|
||||
|
||||
public CommandReload() {
|
||||
super(NAME, COMMAND, USAGE, HELP, PERMISSION);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void execute(CommandSender cs, String[] args) {
|
||||
CONFIG.load();
|
||||
cs.sendMessage(GREEN + "AntiCheat configuration reloaded.");
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,190 @@
|
||||
/*
|
||||
* AntiCheat for Bukkit.
|
||||
* Copyright (C) 2012-2014 AntiCheat Team | http://gravitydevelopment.net
|
||||
*
|
||||
* 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 net.gravitydevelopment.anticheat.command.executors;
|
||||
|
||||
import net.gravitydevelopment.anticheat.AntiCheat;
|
||||
import net.gravitydevelopment.anticheat.check.CheckType;
|
||||
import net.gravitydevelopment.anticheat.command.CommandBase;
|
||||
import net.gravitydevelopment.anticheat.manage.CheckManager;
|
||||
import net.gravitydevelopment.anticheat.util.*;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class CommandReport extends CommandBase {
|
||||
|
||||
private static final String NAME = "AntiCheat Reports";
|
||||
private static final String COMMAND = "report";
|
||||
private static final String USAGE = "anticheat report [group/user]";
|
||||
private static final Permission PERMISSION = Permission.SYSTEM_REPORT;
|
||||
private static final String[] HELP = {
|
||||
GRAY + "Use: " + AQUA + "/anticheat report [group]" + GRAY + " to see all users in a given group",
|
||||
GRAY + "Use: " + AQUA + "/anticheat report [user]" + GRAY + " to see a single user's report",
|
||||
GRAY + "Use: " + AQUA + "/anticheat report [user/group] [num]" + GRAY + " to see pages of a report",
|
||||
};
|
||||
|
||||
public CommandReport() {
|
||||
super(NAME, COMMAND, USAGE, HELP, PERMISSION);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void execute(CommandSender cs, String[] args) {
|
||||
if (args.length >= 1) {
|
||||
int page = 1;
|
||||
if (args.length == 2) {
|
||||
if (Utilities.isInt(args[1])) {
|
||||
page = Integer.parseInt(args[1]);
|
||||
} else {
|
||||
cs.sendMessage(RED + "Not a valid page number: " + WHITE + args[1]);
|
||||
}
|
||||
}
|
||||
|
||||
if ("low".equalsIgnoreCase(args[0])) {
|
||||
groupReport(cs, null, page);
|
||||
}
|
||||
else if ("all".equalsIgnoreCase(args[0])) {
|
||||
cs.sendMessage(GREEN + "Low: " + WHITE + USER_MANAGER.getUsersInGroup(null).size() + " players");
|
||||
for (Group g : CONFIG.getGroups().getGroups()) {
|
||||
int numPlayers = USER_MANAGER.getUsersInGroup(g).size();
|
||||
cs.sendMessage(g.getColor() + g.getName() + WHITE + ": " + numPlayers + " players");
|
||||
}
|
||||
cs.sendMessage(GRAY + "Use " + AQUA + "/anticheat report [group]" + GRAY + " for a list of players in each group.");
|
||||
} else {
|
||||
// Test groups
|
||||
for (Group group : CONFIG.getGroups().getGroups()) {
|
||||
if (group.getName().equalsIgnoreCase(args[0]) || "low".equalsIgnoreCase(args[0]) || "all".equalsIgnoreCase(args[0])) {
|
||||
groupReport(cs, group, page);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
// Test users
|
||||
for (Player player : Bukkit.getOnlinePlayers()) {
|
||||
if (player.getName().equalsIgnoreCase(args[0])) {
|
||||
User user = AntiCheat.getManager().getUserManager().getUser(args[0]);
|
||||
playerReport(cs, user, page);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
// Neither of these
|
||||
cs.sendMessage(RED + "Not a valid group or user: " + WHITE + args[0]);
|
||||
}
|
||||
} else {
|
||||
sendHelp(cs);
|
||||
}
|
||||
}
|
||||
|
||||
private void groupReport(CommandSender cs, Group group, int page) {
|
||||
List<User> users = USER_MANAGER.getUsersInGroup(group);
|
||||
ChatColor color = group == null ? GREEN : group.getColor();
|
||||
String groupName = group == null ? "Low" : group.getName();
|
||||
int pages = (int) Math.ceil(((float) users.size()) / 7);
|
||||
if (page <= pages && page > 0) {
|
||||
cs.sendMessage("--------------------[" + GREEN + "REPORT[" + page + "/" + pages + "]" + WHITE + "]---------------------");
|
||||
cs.sendMessage(GRAY + "Group: " + color + groupName);
|
||||
for (int x = 0; x < 7; x++) {
|
||||
int index = ((page - 1) * 6) + (x + ((page - 1) * 1));
|
||||
if (index < users.size()) {
|
||||
String player = users.get(index).getName();
|
||||
cs.sendMessage(GRAY + player);
|
||||
}
|
||||
}
|
||||
cs.sendMessage(MENU_END);
|
||||
} else {
|
||||
if (pages == 0) {
|
||||
cs.sendMessage("--------------------[" + GREEN + "REPORT[1/1]" + WHITE + "]---------------------");
|
||||
cs.sendMessage(GRAY + "Group: " + color + groupName);
|
||||
cs.sendMessage(GRAY + "There are no users in this group.");
|
||||
cs.sendMessage(MENU_END);
|
||||
} else {
|
||||
cs.sendMessage(RED + "Page not found. Requested " + WHITE + page + RED + ", Max " + WHITE + pages);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void playerReport(CommandSender cs, User user, int page) {
|
||||
List<CheckType> types = new ArrayList<CheckType>();
|
||||
for (CheckType type : CheckType.values()) {
|
||||
if (type.getUses(user.getName()) > 0) {
|
||||
types.add(type);
|
||||
}
|
||||
}
|
||||
|
||||
String name = user.getName();
|
||||
int pages = (int) Math.ceil(((float) types.size()) / 6);
|
||||
|
||||
Group group = user.getGroup();
|
||||
String groupString = GREEN + "Low";
|
||||
|
||||
if (group != null) {
|
||||
groupString = group.getColor() + group.getName();
|
||||
}
|
||||
groupString += " (" + user.getLevel() + ")";
|
||||
|
||||
if (page <= pages && page > 0) {
|
||||
cs.sendMessage("--------------------[" + GREEN + "REPORT[" + page + "/" + pages + "]" + WHITE + "]---------------------");
|
||||
cs.sendMessage(GRAY + "Player: " + WHITE + name);
|
||||
cs.sendMessage(GRAY + "Group: " + groupString);
|
||||
for (int x = 0; x < 6; x++) {
|
||||
int index = ((page - 1) * 5) + (x + ((page - 1)));
|
||||
if (index < types.size()) {
|
||||
CheckType type = types.get(index);
|
||||
int use = type.getUses(name);
|
||||
ChatColor color = WHITE;
|
||||
if (use >= 20) {
|
||||
color = YELLOW;
|
||||
} else if (use > 50) {
|
||||
color = RED;
|
||||
}
|
||||
cs.sendMessage(GRAY + CheckType.getName(type) + ": " + color + use);
|
||||
}
|
||||
}
|
||||
cs.sendMessage(MENU_END);
|
||||
} else {
|
||||
if (pages == 0 && page == 1) {
|
||||
cs.sendMessage("--------------------[" + GREEN + "REPORT[1/1]" + WHITE + "]---------------------");
|
||||
cs.sendMessage(GRAY + "Player: " + WHITE + name);
|
||||
cs.sendMessage(GRAY + "Group: " + groupString);
|
||||
cs.sendMessage(GRAY + "This user has not failed any checks.");
|
||||
cs.sendMessage(MENU_END);
|
||||
} else {
|
||||
cs.sendMessage(RED + "Page not found. Requested " + WHITE + page + RED + ", Max " + WHITE + pages + 1);
|
||||
}
|
||||
}
|
||||
|
||||
if (AntiCheat.developerMode()) {
|
||||
int permission = 0;
|
||||
int check = 0;
|
||||
for (Permission perm : Permission.values()) {
|
||||
if (perm.get(user.getPlayer())) permission++;
|
||||
}
|
||||
CheckManager manager = AntiCheat.getManager().getCheckManager();
|
||||
for (CheckType type : CheckType.values()) {
|
||||
if (manager.willCheck(user.getPlayer(), type)) check++;
|
||||
}
|
||||
cs.sendMessage(ChatColor.GOLD + "User has " + permission + "/" + Permission.values().length + " permissions");
|
||||
cs.sendMessage(ChatColor.GOLD + "User will be checked for " + check + "/" + CheckType.values().length + " checks");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,61 @@
|
||||
/*
|
||||
* AntiCheat for Bukkit.
|
||||
* Copyright (C) 2012-2014 AntiCheat Team | http://gravitydevelopment.net
|
||||
*
|
||||
* 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 net.gravitydevelopment.anticheat.command.executors;
|
||||
|
||||
import net.gravitydevelopment.anticheat.AntiCheat;
|
||||
import net.gravitydevelopment.anticheat.command.CommandBase;
|
||||
import net.gravitydevelopment.anticheat.util.PastebinReport;
|
||||
import net.gravitydevelopment.anticheat.util.Permission;
|
||||
import net.gravitydevelopment.anticheat.util.User;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
public class CommandReset extends CommandBase {
|
||||
|
||||
private static final String NAME = "AntiCheat Resetting";
|
||||
private static final String COMMAND = "reset";
|
||||
private static final String USAGE = "anticheat reset [user]";
|
||||
private static final Permission PERMISSION = Permission.SYSTEM_RESET;
|
||||
private static final String[] HELP = {
|
||||
GRAY + "Use: " + AQUA + "/anticheat reset [user]" + GRAY + " to reset this user's hack level",
|
||||
};
|
||||
|
||||
public CommandReset() {
|
||||
super(NAME, COMMAND, USAGE, HELP, PERMISSION);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void execute(CommandSender cs, String[] args) {
|
||||
if (args.length == 1) {
|
||||
User user = USER_MANAGER.getUser(args[0]);
|
||||
if (user != null) {
|
||||
user.resetLevel();
|
||||
XRAY_TRACKER.reset(args[0]);
|
||||
user.clearMessages();
|
||||
AntiCheat.getManager().getBackend().resetChatLevel(user.getPlayer());
|
||||
cs.sendMessage(args[0] + GREEN + " has been reset.");
|
||||
} else {
|
||||
cs.sendMessage(RED + "Player: " +args[0] + " not found.");
|
||||
}
|
||||
} else {
|
||||
sendHelp(cs);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,95 @@
|
||||
/*
|
||||
* AntiCheat for Bukkit.
|
||||
* Copyright (C) 2012-2014 AntiCheat Team | http://gravitydevelopment.net
|
||||
*
|
||||
* 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 net.gravitydevelopment.anticheat.command.executors;
|
||||
|
||||
import net.gravitydevelopment.anticheat.AntiCheat;
|
||||
import net.gravitydevelopment.anticheat.command.CommandBase;
|
||||
import net.gravitydevelopment.anticheat.util.Permission;
|
||||
import net.gravitydevelopment.anticheat.util.SpyState;
|
||||
import net.gravitydevelopment.anticheat.util.Utilities;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.metadata.FixedMetadataValue;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class CommandSpy extends CommandBase {
|
||||
|
||||
private static final String NAME = "AntiCheat Spying";
|
||||
private static final String COMMAND = "spy";
|
||||
private static final String USAGE = "anticheat spy [user]";
|
||||
private static final Permission PERMISSION = Permission.SYSTEM_SPY;
|
||||
private static final String[] HELP = {
|
||||
GRAY + "Use: " + AQUA + "/anticheat spy [user]" + GRAY + " to spy on a user",
|
||||
};
|
||||
|
||||
public CommandSpy() {
|
||||
super(NAME, COMMAND, USAGE, HELP, PERMISSION);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void execute(CommandSender cs, String[] args) {
|
||||
if (args.length == 1) {
|
||||
if (cs instanceof Player) {
|
||||
Player sender = (Player) cs;
|
||||
if (!args[0].equalsIgnoreCase("off")) {
|
||||
Player player = Bukkit.getPlayer(args[0]);
|
||||
if (player != null) {
|
||||
for (Player p : cs.getServer().getOnlinePlayers()) {
|
||||
if (!Permission.SYSTEM_SPY.get(p)) {
|
||||
p.hidePlayer(sender);
|
||||
}
|
||||
}
|
||||
if (!sender.hasMetadata(Utilities.SPY_METADATA)) // Maintain ORIGINAL location and other data
|
||||
{
|
||||
SpyState state = new SpyState(sender.getAllowFlight(), sender.isFlying(), sender.getLocation());
|
||||
sender.setMetadata(Utilities.SPY_METADATA, new FixedMetadataValue(AntiCheat.getPlugin(), state));
|
||||
}
|
||||
sender.setAllowFlight(true);
|
||||
sender.setFlying(true);
|
||||
sender.teleport(player);
|
||||
sender.sendMessage(GREEN + "You have been teleported to " + player.getName() + " and made invisible.");
|
||||
sender.sendMessage(GREEN + "To stop spying, type " + WHITE + " /anti spy off");
|
||||
} else {
|
||||
cs.sendMessage(RED + "Player: " +args[0] + " not found.");
|
||||
}
|
||||
} else {
|
||||
if (sender.hasMetadata(Utilities.SPY_METADATA)) {
|
||||
SpyState state = ((SpyState) sender.getMetadata(Utilities.SPY_METADATA).get(0).value());
|
||||
sender.setAllowFlight(state.getAllowFlight());
|
||||
sender.setFlying(state.getFlying());
|
||||
sender.teleport(state.getLocation());
|
||||
sender.removeMetadata(Utilities.SPY_METADATA, AntiCheat.getPlugin());
|
||||
for (Player p : cs.getServer().getOnlinePlayers()) {
|
||||
p.showPlayer(sender);
|
||||
}
|
||||
sender.sendMessage(GREEN + "Done spying! Brought you back to where you started!");
|
||||
} else {
|
||||
sender.sendMessage(RED + "You were not spying.");
|
||||
}
|
||||
}
|
||||
} else {
|
||||
cs.sendMessage(RED + "Sorry, but you can't spy on a player from the console.");
|
||||
}
|
||||
} else {
|
||||
sendHelp(cs);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,57 @@
|
||||
/*
|
||||
* AntiCheat for Bukkit.
|
||||
* Copyright (C) 2012-2014 AntiCheat Team | http://gravitydevelopment.net
|
||||
*
|
||||
* 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 net.gravitydevelopment.anticheat.command.executors;
|
||||
|
||||
import net.gravitydevelopment.anticheat.AntiCheat;
|
||||
import net.gravitydevelopment.anticheat.command.CommandBase;
|
||||
import net.gravitydevelopment.anticheat.util.PastebinReport;
|
||||
import net.gravitydevelopment.anticheat.util.Permission;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
public class CommandUpdate extends CommandBase {
|
||||
|
||||
private static final String NAME = "AntiCheat Update Checking";
|
||||
private static final String COMMAND = "update";
|
||||
private static final String USAGE = "anticheat update";
|
||||
private static final Permission PERMISSION = Permission.SYSTEM_UPDATE;
|
||||
private static final String[] HELP = {
|
||||
GRAY + "Use: " + AQUA + "/anticheat update" + GRAY + " to view the system's update status",
|
||||
};
|
||||
|
||||
public CommandUpdate() {
|
||||
super(NAME, COMMAND, USAGE, HELP, PERMISSION);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void execute(CommandSender cs, String[] args) {
|
||||
cs.sendMessage(GRAY + "Running AntiCheat v" + GREEN + AntiCheat.getVersion());
|
||||
if (CONFIG.getConfig().autoUpdate.getValue()) {
|
||||
cs.sendMessage(GRAY + "Up to date: " + (AntiCheat.isUpdated() ? GREEN + "YES" : RED + "NO"));
|
||||
if (!AntiCheat.isUpdated()) {
|
||||
cs.sendMessage(GRAY + "Newest version: " + GREEN + AntiCheat.getUpdateDetails());
|
||||
cs.sendMessage(GOLD + "The newest version will be automatically installed on next launch.");
|
||||
}
|
||||
} else {
|
||||
cs.sendMessage(GRAY + "Your config settings have disabled update checking.");
|
||||
cs.sendMessage(GRAY + "Please enable this setting or visit http://dev.bukkit.org/bukkit-plugins/anticheat/");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,69 @@
|
||||
/*
|
||||
* AntiCheat for Bukkit.
|
||||
* Copyright (C) 2012-2014 AntiCheat Team | http://gravitydevelopment.net
|
||||
*
|
||||
* 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 net.gravitydevelopment.anticheat.command.executors;
|
||||
|
||||
import net.gravitydevelopment.anticheat.command.CommandBase;
|
||||
import net.gravitydevelopment.anticheat.util.PastebinReport;
|
||||
import net.gravitydevelopment.anticheat.util.Permission;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class CommandXray extends CommandBase {
|
||||
|
||||
private static final String NAME = "AntiCheat XRAY Stats";
|
||||
private static final String COMMAND = "xray";
|
||||
private static final String USAGE = "anticheat xray [user]";
|
||||
private static final Permission PERMISSION = Permission.SYSTEM_UPDATE;
|
||||
private static final String[] HELP = {
|
||||
GRAY + "Use: " + AQUA + "/anticheat xray [user]" + GRAY + " to view xray statistics for a user",
|
||||
};
|
||||
|
||||
public CommandXray() {
|
||||
super(NAME, COMMAND, USAGE, HELP, PERMISSION);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void execute(CommandSender cs, String[] args) {
|
||||
if (args.length == 1) {
|
||||
if (CONFIG.getConfig().checkXRay.getValue()) {
|
||||
Player player = Bukkit.getPlayer(args[0]);
|
||||
if (player != null) {
|
||||
if (XRAY_TRACKER.sufficientData(player.getName())) {
|
||||
XRAY_TRACKER.sendStats(cs, player.getName());
|
||||
} else {
|
||||
cs.sendMessage(RED + "Insufficient data collected from " + WHITE + args[0] + RED + ".");
|
||||
cs.sendMessage(RED + "Please wait until more info is collected before predictions are calculated.");
|
||||
}
|
||||
} else if (XRAY_TRACKER.sufficientData(args[0])) {
|
||||
XRAY_TRACKER.sendStats(cs, args[1]);
|
||||
} else {
|
||||
cs.sendMessage(RED + "Insufficient data collected from " + WHITE + args[0] + RED + ".");
|
||||
cs.sendMessage(RED + "Please wait until more info is collected before predictions are calculated.");
|
||||
}
|
||||
} else {
|
||||
cs.sendMessage(RED + "XRay logging is off in the config.");
|
||||
}
|
||||
} else {
|
||||
sendHelp(cs);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user