Support Lang configuration from enterprise

This commit is contained in:
gravitylow committed 2014-01-28 23:30:06 -05:00
1 parent 46b089d1e6
commit 3ddf3ddc09
12 files changed
+386 -120

No files matched your search

@@ -19,7 +19,8 @@
package net.gravitydevelopment.anticheat.check;
import net.gravitydevelopment.anticheat.AntiCheat;
import net.gravitydevelopment.anticheat.config.files.Lang;
import net.gravitydevelopment.anticheat.config.Configuration;
import net.gravitydevelopment.anticheat.config.providers.Lang;
import net.gravitydevelopment.anticheat.config.providers.Magic;
import net.gravitydevelopment.anticheat.manage.AntiCheatManager;
import net.gravitydevelopment.anticheat.util.User;
@@ -100,8 +101,9 @@ public class Backend {
transparent.add((byte) -1);
}
public void updateMagic(Magic magic) {
this.magic = magic;
public void updateConfig(Configuration config) {
magic = config.getMagic();
lang = config.getLang();
}
public void resetChatLevel(User user) {
@@ -768,10 +770,10 @@ public class Backend {
} else {
if (manager.getConfiguration().getConfig().blockChatSpamRepetition.getValue() && m.equalsIgnoreCase(msg) && i == 1) {
manager.getLoggingManager().logFineInfo(player.getName() + " spam-repeated \"" + msg + "\"");
return new CheckResult(CheckResult.Result.FAILED, lang.spamWarning.getValue());
return new CheckResult(CheckResult.Result.FAILED, lang.SPAM_WARNING());
} else if (manager.getConfiguration().getConfig().blockChatSpamSpeed.getValue() && System.currentTimeMillis() - user.getLastCommandTime() < magic.COMMAND_MIN() * 2) {
manager.getLoggingManager().logFineInfo(player.getName() + " spammed quickly \"" + msg + "\"");
return new CheckResult(CheckResult.Result.FAILED, lang.spamWarning.getValue());
return new CheckResult(CheckResult.Result.FAILED, lang.SPAM_WARNING());
}
}
}
@@ -796,9 +798,9 @@ public class Backend {
break;
} else {
if (manager.getConfiguration().getConfig().blockCommandSpamRepetition.getValue() && m.equalsIgnoreCase(cmd) && i == 1) {
return new CheckResult(CheckResult.Result.FAILED, lang.spamWarning.getValue());
return new CheckResult(CheckResult.Result.FAILED, lang.SPAM_WARNING());
} else if (manager.getConfiguration().getConfig().blockCommandSpamSpeed.getValue() && System.currentTimeMillis() - user.getLastCommandTime() < magic.COMMAND_MIN() * 2) {
return new CheckResult(CheckResult.Result.FAILED, lang.spamWarning.getValue());
return new CheckResult(CheckResult.Result.FAILED, lang.SPAM_WARNING());
}
}
}
@@ -1069,7 +1071,7 @@ public class Backend {
int level = chatLevel.containsKey(user.getName()) ? chatLevel.get(user.getName()) : 0;
if (player != null && player.isOnline() && level >= magic.CHAT_ACTION_ONE_LEVEL()) {
String event = level >= magic.CHAT_ACTION_TWO_LEVEL() ? manager.getConfiguration().getConfig().chatSpamActionTwo.getValue() : manager.getConfiguration().getConfig().chatSpamActionOne.getValue();
manager.getUserManager().execute(manager.getUserManager().getUser(player.getName()), Utilities.stringToList(event), CheckType.CHAT_SPAM, lang.spamKickReason.getValue(), Utilities.stringToList(lang.spamWarning.getValue()), lang.spamBanReason.getValue());
manager.getUserManager().execute(manager.getUserManager().getUser(player.getName()), Utilities.stringToList(event), CheckType.CHAT_SPAM, lang.SPAM_KICK_REASON(), Utilities.stringToList(lang.SPAM_WARNING()), lang.SPAM_BAN_REASON());
}
chatLevel.put(user.getName(), level + 1);
}
@@ -1079,7 +1081,7 @@ public class Backend {
int level = commandLevel.containsKey(user.getName()) ? commandLevel.get(user.getName()) : 0;
if (player != null && player.isOnline() && level >= magic.COMMAND_ACTION_ONE_LEVEL()) {
String event = level >= magic.COMMAND_ACTION_TWO_LEVEL() ? manager.getConfiguration().getConfig().commandSpamActionTwo.getValue() : manager.getConfiguration().getConfig().commandSpamActionOne.getValue();
manager.getUserManager().execute(manager.getUserManager().getUser(player.getName()), Utilities.stringToList(event), CheckType.COMMAND_SPAM, lang.spamKickReason.getValue(), Utilities.stringToList(lang.spamWarning.getValue()), lang.spamBanReason.getValue());
manager.getUserManager().execute(manager.getUserManager().getUser(player.getName()), Utilities.stringToList(event), CheckType.COMMAND_SPAM, lang.SPAM_KICK_REASON(), Utilities.stringToList(lang.SPAM_WARNING()), lang.SPAM_BAN_REASON());
}
commandLevel.put(user.getName(), level + 1);
}
@@ -21,19 +21,9 @@ package net.gravitydevelopment.anticheat.config;
import net.gravitydevelopment.anticheat.AntiCheat;
import net.gravitydevelopment.anticheat.config.files.Config;
import net.gravitydevelopment.anticheat.config.files.Enterprise;
import net.gravitydevelopment.anticheat.config.files.Lang;
import net.gravitydevelopment.anticheat.config.holders.mysql.MySQLGroupsHolder;
import net.gravitydevelopment.anticheat.config.holders.mysql.MySQLLevelsHolder;
import net.gravitydevelopment.anticheat.config.holders.mysql.MySQLMagicHolder;
import net.gravitydevelopment.anticheat.config.holders.mysql.MySQLRulesHolder;
import net.gravitydevelopment.anticheat.config.holders.yaml.YamlGroupsHolder;
import net.gravitydevelopment.anticheat.config.holders.yaml.YamlLevelsHolder;
import net.gravitydevelopment.anticheat.config.holders.yaml.YamlMagicHolder;
import net.gravitydevelopment.anticheat.config.holders.yaml.YamlRulesHolder;
import net.gravitydevelopment.anticheat.config.providers.Groups;
import net.gravitydevelopment.anticheat.config.providers.Levels;
import net.gravitydevelopment.anticheat.config.providers.Magic;
import net.gravitydevelopment.anticheat.config.providers.Rules;
import net.gravitydevelopment.anticheat.config.holders.mysql.*;
import net.gravitydevelopment.anticheat.config.holders.yaml.*;
import net.gravitydevelopment.anticheat.config.providers.*;
import net.gravitydevelopment.anticheat.manage.AntiCheatManager;
import org.bukkit.configuration.file.YamlConfiguration;
@@ -47,8 +37,8 @@ public class Configuration {
private AntiCheatManager manager;
private Config config;
private Enterprise enterprise;
private Lang lang;
private Lang lang;
private Magic magic;
private Groups groups;
private Levels levels;
@@ -64,12 +54,10 @@ public class Configuration {
plugin.setVerbose(config.verboseStartup.getValue());
// Now load others
enterprise = new Enterprise(plugin, this);
lang = new Lang(plugin, this);
flatfiles = new ArrayList<ConfigurationFile>() {{
add(config);
add(enterprise);
add(lang);
}};
dbfiles = new ArrayList<ConfigurationTable>();
@@ -106,6 +94,20 @@ public class Configuration {
flatfiles.add((YamlMagicHolder) handler);
}
if (config.enterprise.getValue() && enterprise.configLang.getValue()) {
handler = new MySQLLangHolder(this);
lang = (Lang) Proxy.newProxyInstance(Lang.class.getClassLoader(),
new Class[] { Lang.class },
handler);
dbfiles.add((MySQLLangHolder) handler);
} else {
handler = new YamlLangHolder(plugin, this);
lang = (Lang) Proxy.newProxyInstance(Lang.class.getClassLoader(),
new Class[] { Lang.class },
handler);
flatfiles.add((YamlLangHolder) handler);
}
if (config.enterprise.getValue() && enterprise.syncLevels.getValue()) {
levels = new MySQLLevelsHolder(this);
dbfiles.add((MySQLLevelsHolder) levels);
@@ -130,7 +132,7 @@ public class Configuration {
table.load();
}
if (manager.getBackend() != null) {
manager.getBackend().updateMagic(magic);
manager.getBackend().updateConfig(this);
}
}
@@ -18,7 +18,9 @@
package net.gravitydevelopment.anticheat.config;
import net.gravitydevelopment.anticheat.AntiCheat;
import net.gravitydevelopment.anticheat.util.enterprise.Database;
import org.bukkit.Bukkit;
import java.sql.Connection;
import java.sql.DatabaseMetaData;
@@ -53,6 +55,16 @@ public class ConfigurationTable {
// Nothing to do
}
public void reload() {
// For after sql inserts have been made
Bukkit.getScheduler().runTask(AntiCheat.getPlugin(), new Runnable() {
@Override
public void run() {
load();
}
});
}
public Database getDatabase() {
return database;
}
@@ -39,6 +39,7 @@ public class Enterprise extends ConfigurationFile {
public ConfigValue<Boolean> configGroups;
public ConfigValue<Boolean> configRules;
public ConfigValue<Boolean> configMagic;
public ConfigValue<Boolean> configLang;
public Database database;
@@ -60,6 +61,7 @@ public class Enterprise extends ConfigurationFile {
configGroups = new ConfigValue<Boolean>("config.groups");
configRules = new ConfigValue<Boolean>("config.rules");
configMagic = new ConfigValue<Boolean>("config.magic");
configLang = new ConfigValue<Boolean>("config.lang");
ConfigValue<String> databaseType = new ConfigValue<String>("database.type");
ConfigValue<String> databaseHostname = new ConfigValue<String>("database.hostname");
@@ -1,61 +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.config.files;
import net.gravitydevelopment.anticheat.AntiCheat;
import net.gravitydevelopment.anticheat.config.Configuration;
import net.gravitydevelopment.anticheat.config.ConfigurationFile;
import java.util.List;
public class Lang extends ConfigurationFile {
public static final String FILENAME = "lang.yml";
public ConfigValue<List<String>> alert;
public ConfigValue<List<String>> playerWarning;
public ConfigValue<String> spamWarning;
public ConfigValue<String> spamKickReason;
public ConfigValue<String> spamBanReason;
public ConfigValue<String> spamKickBroadcast;
public ConfigValue<String> spamBanBroadcast;
public ConfigValue<String> banReason;
public ConfigValue<String> banBroadcast;
public ConfigValue<String> kickReason;
public ConfigValue<String> kickBroadcast;
public Lang(AntiCheat plugin, Configuration config) {
super(plugin, config, FILENAME);
}
@Override
public void open() {
alert = new ConfigValue<List<String>>("alert");
playerWarning = new ConfigValue<List<String>>("warning.player_warning");
spamWarning = new ConfigValue<String>("chat.warning");
spamKickReason = new ConfigValue<String>("chat.kick_reason");
spamBanReason = new ConfigValue<String>("chat.ban_reason");
spamKickBroadcast = new ConfigValue<String>("chat.kick_broadcast");
spamBanBroadcast = new ConfigValue<String>("chat.ban_broadcast");
banReason = new ConfigValue<String>("ban.ban_reason");
banBroadcast = new ConfigValue<String>("ban.ban_broadcast");
kickReason = new ConfigValue<String>("kick.kick_reason");
kickBroadcast = new ConfigValue<String>("kick.kick_broadcast");
}
}
@@ -0,0 +1,156 @@
/*
* 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.config.holders.mysql;
import net.gravitydevelopment.anticheat.AntiCheat;
import net.gravitydevelopment.anticheat.config.Configuration;
import net.gravitydevelopment.anticheat.config.ConfigurationTable;
import net.gravitydevelopment.anticheat.config.providers.Lang;
import org.bukkit.configuration.file.FileConfiguration;
import org.bukkit.configuration.file.YamlConfiguration;
import java.lang.reflect.InvocationHandler;
import java.lang.reflect.Method;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
public class MySQLLangHolder extends ConfigurationTable implements InvocationHandler {
private static final String TABLE = "lang";
private HashMap<String, String> stringValues;
private HashMap<String, List<String>> listValues;
private FileConfiguration defaults;
public MySQLLangHolder(Configuration config) {
super(config, TABLE);
}
@Override
public void open() {
defaults = YamlConfiguration.loadConfiguration(AntiCheat.getPlugin().getResource("lang.yml"));
stringValues = new HashMap<String, String>();
listValues = new HashMap<String, List<String>>();
String sqlCreate = "CREATE TABLE " + getFullTable() + "(" +
" `id` INT NOT NULL AUTO_INCREMENT," +
" `key` VARCHAR(45) NOT NULL," +
" `value` TEXT," +
" PRIMARY KEY (`id`));";
String sqlPopulate = "INSERT INTO " + getFullTable() +
" (`key`, `value`) " +
"SELECT t.*" +
"FROM (";
Method[] methods = Lang.class.getMethods();
for (int i=1;i<=methods.length;i++) {
sqlPopulate += "(SELECT ? as `key`, ? as `value`)";
if (i < methods.length) sqlPopulate += " UNION ALL ";
}
sqlPopulate += ") t;";
String sqlLoad = "SELECT * FROM " + getFullTable();
try {
PreparedStatement insert = getConnection().prepareStatement(sqlPopulate);
int strings = 1;
for (int i=1;i<=methods.length;i++) {
String key = methods[i-1].getName();
String value = defaults.getString(key);
insert.setString(strings, key);
strings++;
insert.setString(strings, value);
strings++;
}
if (!tableExists()) {
getConnection().prepareStatement(sqlCreate).executeUpdate();
insert.executeUpdate();
getConnection().commit();
}
ResultSet set = getConnection().prepareStatement(sqlLoad).executeQuery();
while (set.next()) {
String key = set.getString("key");
String value = set.getString("value");
if (value.matches("^\\[.*\\]$")) {
listValues.put(key, getList(value));
} else {
stringValues.put(key, value);
}
}
} catch (SQLException e) {
e.printStackTrace();
}
}
public Object invoke(Object proxy, Method method, Object[] args) {
String key = method.getName();
if (method.getReturnType() == List.class) {
if (listValues.containsKey(key)) {
return listValues.get(key);
} else if (defaults.getString(key) != null) {
String value = defaults.getString(key);
try {
PreparedStatement s = getConnection().prepareStatement("INSERT INTO " + getFullTable() + " (key, value) VALUES (?, ?)");
s.setString(1, key);
s.setString(2, value);
} catch (SQLException e) {
e.printStackTrace();
}
reload();
return getList(value);
}
} else {
if (stringValues.containsKey(key)) {
return stringValues.get(key);
} else if (defaults.getString(key) != null) {
String value = defaults.getString(key);
try {
PreparedStatement s = getConnection().prepareStatement("INSERT INTO " + getFullTable() + " (key, value) VALUES (?, ?)");
s.setString(1, key);
s.setString(2, value);
} catch (SQLException e) {
e.printStackTrace();
}
reload();
return value;
}
}
AntiCheat.getPlugin().getLogger().severe("The lang value " + key + " couldn't be found.");
return "Language error. See console for details.";
}
private List<String> getList(String value) {
value = value.substring(1, value.length() - 1);
ArrayList<String> list = new ArrayList<String>();
for (String s : value.split(", ")) {
list.add(s);
}
return list;
}
}
@@ -59,8 +59,9 @@ public class MySQLMagicHolder extends ConfigurationTable implements InvocationHa
" PRIMARY KEY (`id`));";
String sqlPopulate = "INSERT INTO " + getFullTable() +
" SELECT t.*" +
" FROM (";
" (`key`, `value_int`, `value_double`) " +
"SELECT t.*" +
"FROM (";
Method[] methods = Magic.class.getMethods();
for (int i=1;i<=methods.length;i++) {
@@ -68,8 +69,8 @@ public class MySQLMagicHolder extends ConfigurationTable implements InvocationHa
Object value = defaults.get(key);
String type1 = methods[i-1].getReturnType().getSimpleName();
String type2 = type1.equals("int") ? "double" : "int";
sqlPopulate += "(SELECT " + i + " as id, '" + key + "' as `key`, " + (type1.equals("int") ? value : "null") + " as value_" + type1 + ", " + (type1.equals("double") ? value : "null") + " as value_" + type2 + ") ";
if (i < methods.length) sqlPopulate += "UNION ALL ";
sqlPopulate += "(SELECT '" + key + "' as `key`, " + (type1.equals("int") ? value : "null") + " as value_" + type1 + ", " + (type1.equals("double") ? value : "null") + " as value_" + type2 + ")";
if (i < methods.length) sqlPopulate += " UNION ALL ";
}
sqlPopulate += ") t;";
@@ -114,29 +115,32 @@ public class MySQLMagicHolder extends ConfigurationTable implements InvocationHa
public Object invoke(Object proxy, Method method, Object[] args) {
String key = method.getName();
if (ints.containsKey(key)) return ints.get(key).intValue();
else if (doubles.containsKey(key)) return doubles.get(key).doubleValue();
else {
if (ints.containsKey(key)) {
return ints.get(key).intValue();
} else if (doubles.containsKey(key)) {
return doubles.get(key).doubleValue();
} else if (defaults.getString(key) != null ) {
if (method.getReturnType().getSimpleName().equals("int")) {
int value = defaults.getInt(key);
try {
getConnection().prepareStatement("INSERT INTO " + getFullTable() + " (value_int) VALUES (" + value + ")").executeUpdate();
getConnection().prepareStatement("INSERT INTO " + getFullTable() + " (key, value_int) VALUES ('" + key + "' , '" + value + "')").executeUpdate();
} catch (SQLException e) {
e.printStackTrace();
}
reload();
return value;
} else if (method.getReturnType().getSimpleName().equals("double")) {
double value = defaults.getDouble(key);
try {
getConnection().prepareStatement("INSERT INTO " + getFullTable() + " (key, value_double) VALUES (" + key + " , " + value + ")").executeUpdate();
getConnection().prepareStatement("INSERT INTO " + getFullTable() + " (key, value_double) VALUES ('" + key + "' , '" + value + "')").executeUpdate();
} catch (SQLException e) {
e.printStackTrace();
}
reload();
return value;
} else {
AntiCheat.getPlugin().getLogger().severe("The magic value " + key + " couldn't be found.");
return -1;
}
}
AntiCheat.getPlugin().getLogger().severe("The magic value " + key + " couldn't be found.");
return 0;
}
}
@@ -0,0 +1,68 @@
/*
* 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.config.holders.yaml;
import net.gravitydevelopment.anticheat.AntiCheat;
import net.gravitydevelopment.anticheat.config.Configuration;
import net.gravitydevelopment.anticheat.config.ConfigurationFile;
import java.lang.reflect.InvocationHandler;
import java.lang.reflect.Method;
import java.util.List;
public class YamlLangHolder extends ConfigurationFile implements InvocationHandler {
public static final String FILENAME = "lang.yml";
public YamlLangHolder(AntiCheat plugin, Configuration config) {
super(plugin, config, FILENAME);
}
@Override
public void open() {
if (new ConfigValue<String>("chat.ban_broadcast").getValue() != null) {
update();
}
}
private void update() {
new ConfigValue<List<String>>("ALERT").setValue(new ConfigValue<List<String>>("alert").getValue());
new ConfigValue<List<String>>("WARNING").setValue(new ConfigValue<List<String>>("warning.player_warning").getValue());
new ConfigValue<List<String>>("alert").setValue(null);
new ConfigValue<List<String>>("warning.player_warning").setValue(null);
updateValue("ban.ban_reason", "BAN_REASON");
updateValue("ban.ban_broadcast", "BAN_BROADCAST");
updateValue("kick.kick_reason", "KICK_REASON");
updateValue("kick.kick_broadcast", "KICK_BROADCAST");
updateValue("chat.warning", "SPAM_WARNING");
updateValue("chat.kick_reason", "SPAM_KICK_REASON");
updateValue("chat.kick_broadcast", "SPAM_KICK_BROADCAST");
updateValue("chat.ban_reason", "SPAM_BAN_REASON");
updateValue("chat.ban_broadcast", "SPAM_BAN_BROADCAST");
}
private void updateValue(String oldValue, String newValue) {
new ConfigValue<String>(newValue).setValue(new ConfigValue<String>(oldValue).getValue());
new ConfigValue<String>(oldValue).setValue(null);
}
public Object invoke(Object proxy, Method method, Object[] args) {
return new ConfigValue<String>(method.getName()).getValue();
}
}
@@ -0,0 +1,83 @@
package net.gravitydevelopment.anticheat.config.providers;
import java.util.List;
public interface Lang {
/**
* Get the alert to send when a player's hack group changes.
*
* @return Alert
*/
public List<String> ALERT();
/**
* Get the warning to send players when they enter a group.
*
* @return Warning.
*/
public List<String> WARNING();
/**
* Get the warning to send players for spamming.
*
* @return Spam warning.
*/
public String SPAM_WARNING();
/**
* Get the reason for kicking a player for spam.
*
* @return Spam kicking reason.
*/
public String SPAM_KICK_REASON();
/**
* Get the reason for banning a player for spam.
*
* @return Spam banning reason.
*/
public String SPAM_BAN_REASON();
/**
* Get the broadcast for kicking a player for spam.
*
* @return Spam kicking broadcast.
*/
public String SPAM_KICK_BROADCAST();
/**
* Get the broadcast for banning a player for spam.
*
* @return Spam banning broadcast.
*/
public String SPAM_BAN_BROADCAST();
/**
* Get the reason for banning a player.
*
* @return Banning reason.
*/
public String BAN_REASON();
/**
* Get the broadcast for banning a player.
*
* @return Banning broadcast.
*/
public String BAN_BROADCAST();
/**
* Get the reason for kicking a player.
*
* @return Kicking reason.
*/
public String KICK_REASON();
/**
* Get the broadcast for kicking a player.
*
* @return Kicking broadcast.
*/
public String KICK_BROADCAST();
}
@@ -164,7 +164,7 @@ public class UserManager {
* @return check fail alert message
*/
public List<String> getAlert() {
return config.getLang().alert.getValue();
return config.getLang().ALERT();
}
/**
@@ -199,7 +199,7 @@ public class UserManager {
* @param type The CheckType that triggered the alert
*/
public void execute(User user, List<String> actions, CheckType type) {
execute(user, actions, type, config.getLang().kickReason.getValue(), config.getLang().playerWarning.getValue(), config.getLang().banReason.getValue());
execute(user, actions, type, config.getLang().KICK_REASON(), config.getLang().WARNING(), config.getLang().BAN_REASON());
}
/**
@@ -227,7 +227,7 @@ public class UserManager {
}
} else if (event.equalsIgnoreCase("KICK")) {
user.getPlayer().kickPlayer(RED + kickReason);
String msg = RED + config.getLang().kickBroadcast.getValue().replaceAll("&player", name) + " (" + CheckType.getName(type) + ")";
String msg = RED + config.getLang().KICK_BROADCAST().replaceAll("&player", name) + " (" + CheckType.getName(type) + ")";
if (!msg.equals("")) {
manager.log(msg);
manager.playerLog(msg);
@@ -242,7 +242,7 @@ public class UserManager {
} else if (event.equalsIgnoreCase("BAN")) {
user.getPlayer().setBanned(true);
user.getPlayer().kickPlayer(RED + banReason);
String msg = RED + config.getLang().banBroadcast.getValue().replaceAll("&player", name) + " (" + CheckType.getName(type) + ")";
String msg = RED + config.getLang().BAN_BROADCAST().replaceAll("&player", name) + " (" + CheckType.getName(type) + ")";
if (!msg.equals("")) {
manager.log(msg);
manager.playerLog(msg);
+2
View File
@@ -42,3 +42,5 @@ config:
rules: true
# Load magic configuration from the database?
magic: false
# Load language configuration from the database?
lang: false
+13 -17
View File
@@ -1,22 +1,18 @@
# AntiCheat language file
# Please report any bugs: https://github.com/gravitylow/AntiCheat/issues
alert:
ALERT:
- '&player has just entered the &group hack group.'
- '&player''s last failed check was: &check.'
- 'Type ''/anticheat report &player'' for more information.'
warning:
player_warning:
- '[AntiCheat] Hacking is not permitted.'
- '[AntiCheat] If you continue to hack, action will be taken.'
chat:
warning: 'Stop spamming the server or you will be kicked!'
kick_reason: 'Kicked for spamming'
ban_reason: 'Banned for spamming'
kick_broadcast: '&player was kicked for spamming'
ban_broadcast: '&player was banned for spamming'
ban:
ban_reason: 'Banned by AntiCheat'
ban_broadcast: '&player was banned for hacking.'
kick:
kick_reason: 'Kicked by AntiCheat'
kick_broadcast: '&player was kicked for hacking.'
WARNING:
- '[AntiCheat] Hacking is not permitted.'
- '[AntiCheat] If you continue to hack, action will be taken.'
BAN_REASON: 'Banned by AntiCheat'
BAN_BROADCAST: '&player was banned for hacking.'
KICK_REASON: 'Kicked by AntiCheat'
KICK_BROADCAST: '&player was kicked for hacking.'
SPAM_WARNING: 'Stop spamming the server or you will be kicked!'
SPAM_KICK_REASON: 'Kicked for spamming'
SPAM_KICK_BROADCAST: '&player was kicked for spamming'
SPAM_BAN_REASON: 'Banned for spamming'
SPAM_BAN_BROADCAST: '&player was banned for spamming'