Refactor Level to Group for sanity and allow custom groups in commands.

This is a breaking configuration change. There will continue to be breaking configurations until I'm satisfied with the overall sanity of the system. I'm not providing upgrade scripts at this time, and won't promise them in the future. Please stay aware of the fact that these are dev builds, and are subject to change at any time.
This commit is contained in:
h31ix committed 2013-10-13 22:49:32 -04:00
1 parent fd1e5232e0
commit e5a2051aee
15 files changed
+150 -163

No files matched your search

@@ -20,8 +20,8 @@ package net.gravitydevelopment.anticheat.config.holders.mysql;
import net.gravitydevelopment.anticheat.config.Configuration;
import net.gravitydevelopment.anticheat.config.ConfigurationTable;
import net.gravitydevelopment.anticheat.config.providers.Events;
import net.gravitydevelopment.anticheat.util.Level;
import net.gravitydevelopment.anticheat.config.providers.Groups;
import net.gravitydevelopment.anticheat.util.Group;
import java.sql.ResultSet;
import java.sql.SQLException;
@@ -29,21 +29,21 @@ import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
public class MySQLEventsHolder extends ConfigurationTable implements Events {
public class MySQLGroupsHolder extends ConfigurationTable implements Groups {
private static final String TABLE = "events";
private static final String TABLE = "groups";
private List<Level> levels;
private List<Group> groups;
private int highestLevel;
public MySQLEventsHolder(Configuration config) {
public MySQLGroupsHolder(Configuration config) {
super(config, TABLE);
}
@Override
public void open() {
highestLevel = 0;
levels = new ArrayList<Level>();
groups = new ArrayList<Group>();
String sqlCreate = "CREATE TABLE IF NOT EXISTS " + getFullTable() + "(" +
" `id` INT NOT NULL," +
@@ -65,7 +65,7 @@ public class MySQLEventsHolder extends ConfigurationTable implements Events {
String color = set.getString("color");
List<String> actions = Arrays.asList(set.getString("actions").split(","));
levels.add(new Level(name, level, color, actions));
groups.add(new Group(name, level, color, actions));
if (level > highestLevel) {
highestLevel = level;
}
@@ -76,8 +76,8 @@ public class MySQLEventsHolder extends ConfigurationTable implements Events {
}
@Override
public List<Level> getLevels() {
return levels;
public List<Group> getGroups() {
return groups;
}
@Override