mirror of
https://github.com/darksaid98/AntiCheatReloaded.git
synced 2026-12-04 06:28:52 +00:00
Begin work on Enterprise
AntiCheat Enterprise is a powerful new system to allow owners of large servers to efficiently run the plugin on their networks. I've ended the commit here because there are significant changes to the configuration methods I'd like to revise before continuing with development.
This commit is contained in:
1 parent
045ac99e81
commit
1e42d58926
5 files changed
+112
-1
No files matched your search
@@ -103,7 +103,7 @@ public class Anticheat extends JavaPlugin {
|
|||||||
cleanup();
|
cleanup();
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean save(InputStream in, File file) {
|
public boolean save(InputStream in, File file) {
|
||||||
if (!file.exists()) {
|
if (!file.exists()) {
|
||||||
file.getParentFile().mkdirs();
|
file.getParentFile().mkdirs();
|
||||||
try {
|
try {
|
||||||
|
|||||||
@@ -36,15 +36,20 @@ import org.bukkit.configuration.file.YamlConfiguration;
|
|||||||
public class Configuration {
|
public class Configuration {
|
||||||
private AnticheatManager micromanage = null;
|
private AnticheatManager micromanage = null;
|
||||||
private Anticheat plugin;
|
private Anticheat plugin;
|
||||||
|
|
||||||
private File configFile = null;
|
private File configFile = null;
|
||||||
private File levelFile = null;
|
private File levelFile = null;
|
||||||
private File langFile = null;
|
private File langFile = null;
|
||||||
private File magicFile = null;
|
private File magicFile = null;
|
||||||
private File eventsFile = null;
|
private File eventsFile = null;
|
||||||
|
private File enterpriseFile = null;
|
||||||
|
|
||||||
private CommentedConfiguration config;
|
private CommentedConfiguration config;
|
||||||
private FileConfiguration level;
|
private FileConfiguration level;
|
||||||
private FileConfiguration magic;
|
private FileConfiguration magic;
|
||||||
private FileConfiguration events;
|
private FileConfiguration events;
|
||||||
|
private FileConfiguration enterprise;
|
||||||
|
|
||||||
private boolean logConsole;
|
private boolean logConsole;
|
||||||
private boolean logXRay;
|
private boolean logXRay;
|
||||||
private boolean alertXRay;
|
private boolean alertXRay;
|
||||||
@@ -56,6 +61,8 @@ public class Configuration {
|
|||||||
private boolean opExempt;
|
private boolean opExempt;
|
||||||
private boolean trackCreativeXRay;
|
private boolean trackCreativeXRay;
|
||||||
private boolean eventChains;
|
private boolean eventChains;
|
||||||
|
private boolean isEnterprise;
|
||||||
|
|
||||||
private int fileLogLevel = 0;
|
private int fileLogLevel = 0;
|
||||||
private String updateFolder;
|
private String updateFolder;
|
||||||
private String chatActionKick;
|
private String chatActionKick;
|
||||||
@@ -76,6 +83,7 @@ public class Configuration {
|
|||||||
langFile = new File(micromanage.getPlugin().getDataFolder() + "/lang.yml");
|
langFile = new File(micromanage.getPlugin().getDataFolder() + "/lang.yml");
|
||||||
magicFile = new File(micromanage.getPlugin().getDataFolder() + "/magic.yml");
|
magicFile = new File(micromanage.getPlugin().getDataFolder() + "/magic.yml");
|
||||||
eventsFile = new File(micromanage.getPlugin().getDataFolder() + "/events.yml");
|
eventsFile = new File(micromanage.getPlugin().getDataFolder() + "/events.yml");
|
||||||
|
enterpriseFile = new File(micromanage.getPlugin().getDataFolder() + "/enterprise.yml");
|
||||||
|
|
||||||
//
|
//
|
||||||
language = new Language(YamlConfiguration.loadConfiguration(langFile), langFile);
|
language = new Language(YamlConfiguration.loadConfiguration(langFile), langFile);
|
||||||
@@ -87,6 +95,9 @@ public class Configuration {
|
|||||||
events.save(eventsFile);
|
events.save(eventsFile);
|
||||||
level.save(levelFile);
|
level.save(levelFile);
|
||||||
magic.save(magicFile);
|
magic.save(magicFile);
|
||||||
|
if(isEnterprise) {
|
||||||
|
enterprise.save(enterpriseFile);
|
||||||
|
}
|
||||||
} catch (IOException ex) {
|
} catch (IOException ex) {
|
||||||
Logger.getLogger(Configuration.class.getName()).severe(ex.getMessage());
|
Logger.getLogger(Configuration.class.getName()).severe(ex.getMessage());
|
||||||
}
|
}
|
||||||
@@ -140,6 +151,10 @@ public class Configuration {
|
|||||||
return eventChains;
|
return eventChains;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean enterprise() {
|
||||||
|
return isEnterprise;
|
||||||
|
}
|
||||||
|
|
||||||
public String chatActionKick() {
|
public String chatActionKick() {
|
||||||
return chatActionKick;
|
return chatActionKick;
|
||||||
}
|
}
|
||||||
@@ -282,6 +297,7 @@ public class Configuration {
|
|||||||
opExempt = getBoolean("System.Exempt op", false);
|
opExempt = getBoolean("System.Exempt op", false);
|
||||||
trackCreativeXRay = getBoolean("XRay.Track creative", true);
|
trackCreativeXRay = getBoolean("XRay.Track creative", true);
|
||||||
eventChains = getBoolean("System.Event Chains", true);
|
eventChains = getBoolean("System.Event Chains", true);
|
||||||
|
isEnterprise = getBoolean("System.Enterprise", false);
|
||||||
chatActionKick = getString("Chat.Kick Action", "KICK");
|
chatActionKick = getString("Chat.Kick Action", "KICK");
|
||||||
chatActionBan = getString("Chat.Ban Action", "BAN");
|
chatActionBan = getString("Chat.Ban Action", "BAN");
|
||||||
chatSpam = getBoolean("Chat.Block chat spam", true);
|
chatSpam = getBoolean("Chat.Block chat spam", true);
|
||||||
@@ -335,6 +351,13 @@ public class Configuration {
|
|||||||
version = magic.getString("VERSION");
|
version = magic.getString("VERSION");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(isEnterprise) {
|
||||||
|
if(!enterpriseFile.exists()) {
|
||||||
|
micromanage.getPlugin().save(micromanage.getPlugin().getResource("enterprise.yml"), enterpriseFile);
|
||||||
|
}
|
||||||
|
enterprise = YamlConfiguration.loadConfiguration(enterpriseFile);
|
||||||
|
}
|
||||||
|
|
||||||
save();
|
save();
|
||||||
magicInstance = new Magic(getMagic(), this, CommentedConfiguration.loadConfiguration(micromanage.getPlugin().getResource("magic.yml")), Double.parseDouble(version));
|
magicInstance = new Magic(getMagic(), this, CommentedConfiguration.loadConfiguration(micromanage.getPlugin().getResource("magic.yml")), Double.parseDouble(version));
|
||||||
if(micromanage.getBackend() != null) { // If this is first run, backend may not be setup yet (this is for reloads)
|
if(micromanage.getBackend() != null) { // If this is first run, backend may not be setup yet (this is for reloads)
|
||||||
|
|||||||
@@ -0,0 +1,44 @@
|
|||||||
|
/*
|
||||||
|
* AntiCheat for Bukkit.
|
||||||
|
* Copyright (C) 2012-2013 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.h31ix.anticheat.util.enterprise;
|
||||||
|
|
||||||
|
public class Database {
|
||||||
|
|
||||||
|
public enum DatabaseType {
|
||||||
|
MYSQL,
|
||||||
|
}
|
||||||
|
|
||||||
|
private DatabaseType type;
|
||||||
|
private String hostname;
|
||||||
|
private int port;
|
||||||
|
private String username;
|
||||||
|
private String password;
|
||||||
|
private String schema;
|
||||||
|
private String prefix;
|
||||||
|
|
||||||
|
public Database(DatabaseType type, String hostname, int port, String username, String password, String schema, String prefix) {
|
||||||
|
this.type = type;
|
||||||
|
this.hostname = hostname;
|
||||||
|
this.port = port;
|
||||||
|
this.username = username;
|
||||||
|
this.password = password;
|
||||||
|
this.schema = schema;
|
||||||
|
this.prefix = prefix;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -32,3 +32,5 @@ System:
|
|||||||
Exempt op: false
|
Exempt op: false
|
||||||
# Should AntiCheat track plugins in its own registered events?
|
# Should AntiCheat track plugins in its own registered events?
|
||||||
Event Chains: true
|
Event Chains: true
|
||||||
|
# Should Enterprise options be enabled? Only set this to true if you're an advanced user.
|
||||||
|
Enterprise: false
|
||||||
@@ -0,0 +1,42 @@
|
|||||||
|
# AntiCheat configuration file
|
||||||
|
# Please report any bugs: http://dev.bukkit.org/server-mods/anticheat/
|
||||||
|
|
||||||
|
# Server-specific settings
|
||||||
|
server:
|
||||||
|
# An identifiable name for this server
|
||||||
|
name: 'server-1'
|
||||||
|
|
||||||
|
# Database settings
|
||||||
|
database:
|
||||||
|
# Type of database.
|
||||||
|
type: MySQL
|
||||||
|
|
||||||
|
# Address of the server
|
||||||
|
hostname: ''
|
||||||
|
|
||||||
|
# Port of the server
|
||||||
|
port: 3306
|
||||||
|
|
||||||
|
# Username to connect with
|
||||||
|
username: ''
|
||||||
|
|
||||||
|
# Password for the user
|
||||||
|
password: ''
|
||||||
|
|
||||||
|
# Prefix for the tables
|
||||||
|
prefix: 'ac_'
|
||||||
|
|
||||||
|
# Database/Schema to use
|
||||||
|
database: 'minecraft'
|
||||||
|
|
||||||
|
logging:
|
||||||
|
# Keep events in the database?
|
||||||
|
enable: true
|
||||||
|
# Time for actions logged to stay in the database (in days)
|
||||||
|
life: 2
|
||||||
|
|
||||||
|
users:
|
||||||
|
# Synchronize user's levels in the database?
|
||||||
|
enable: true
|
||||||
|
# How often to query the databse for synchronization? (in seconds)
|
||||||
|
interval: 60
|
||||||
Reference in new issue
Block a user