mirror of
https://github.com/darksaid98/AntiCheatReloaded.git
synced 2026-12-02 06:28:52 +00:00
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:
1 parent
fd1e5232e0
commit
e5a2051aee
15 files changed
+150
-163
No files matched your search
@@ -21,6 +21,7 @@ package net.gravitydevelopment.anticheat.util.rule;
|
||||
import net.gravitydevelopment.anticheat.AntiCheat;
|
||||
import net.gravitydevelopment.anticheat.manage.CheckType;
|
||||
import net.gravitydevelopment.anticheat.manage.User;
|
||||
import net.gravitydevelopment.anticheat.util.Group;
|
||||
import net.gravitydevelopment.anticheat.util.Utilities;
|
||||
|
||||
import java.lang.reflect.Constructor;
|
||||
@@ -139,6 +140,8 @@ public class Rule {
|
||||
SortedMap<String, Object> map = new TreeMap<String, Object>();
|
||||
map.put("player_check", type.name().toLowerCase());
|
||||
map.put("player_level", user.getLevel());
|
||||
map.put("player_group", user.getGroup().getName());
|
||||
map.put("player_name", user.getName());
|
||||
for (CheckType t : CheckType.values()) {
|
||||
map.put("check_" + t.name().toLowerCase(), t.getUses(user.getName()));
|
||||
}
|
||||
@@ -150,6 +153,12 @@ public class Rule {
|
||||
// others wouldn't make any sense to set
|
||||
if (variable.equals("player_level") && Utilities.isInt(value)) {
|
||||
user.setLevel(Integer.parseInt(value));
|
||||
} else if (variable.equals("player_group") && Utilities.isInt(value)) {
|
||||
for (Group group : AntiCheat.getManager().getConfiguration().getGroups().getGroups()) {
|
||||
if (group.getName().equalsIgnoreCase(value)) {
|
||||
user.setLevel(group.getLevel());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user