Refactored policy system, fixed config file parsing inconsistencies.
- LocationPolicy is now an extension of Policy - Policy.parse() is now PolicyParser mapped in PolicyParsers. - NodeValueParser was merged with DataShifter - More code small changes to enable the project to work with this new configuration.
This commit is contained in:
parent
41af1fc1cf
commit
e64b563190
23 changed files with 358 additions and 258 deletions
|
|
@ -1,19 +1,21 @@
|
|||
package io.github.adrianvic.nemesiseye;
|
||||
|
||||
import io.github.adrianvic.nemesiseye.policy.LocationPolicy;
|
||||
import io.github.adrianvic.nemesiseye.policy.Policy;
|
||||
import io.github.adrianvic.nemesiseye.policy.PolicyParser;
|
||||
import io.github.adrianvic.nemesiseye.policy.PolicyParsers;
|
||||
import org.bukkit.configuration.file.YamlConfiguration;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
public class Config {
|
||||
private final static Config instance = new Config();
|
||||
private File file;
|
||||
private YamlConfiguration config;
|
||||
|
||||
private List<LocationPolicy> locationPolicies;
|
||||
// private List<PermissionPolicy> permissionPolicies;
|
||||
// private List<PlayerNamePolicy> playerNamePolicies;
|
||||
private List<Policy> policies = new ArrayList<>();
|
||||
|
||||
private Config() {
|
||||
}
|
||||
|
|
@ -33,7 +35,15 @@ public class Config {
|
|||
e.printStackTrace();
|
||||
}
|
||||
|
||||
locationPolicies = LocationPolicy.parseLocationPolicy(config.getMapList("Policies.Location"));
|
||||
List<Map<?, ?>> rawPolicies = config.getMapList("Policies");
|
||||
for (Map<?, ?> map : rawPolicies) {
|
||||
for (Map.Entry<?, ?> entry : map.entrySet()) {
|
||||
if (entry.getKey() instanceof String k && entry.getValue() instanceof List<?> v) {
|
||||
List<Policy> parsed = PolicyParsers.get(k).parse(v);
|
||||
policies.addAll(parsed);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void save() {
|
||||
|
|
@ -49,8 +59,8 @@ public class Config {
|
|||
save();
|
||||
}
|
||||
|
||||
public List<LocationPolicy> getLocationPolicies() {
|
||||
return locationPolicies;
|
||||
public List<Policy> getPolicies() {
|
||||
return policies;
|
||||
}
|
||||
|
||||
public static Config getInstance() {
|
||||
|
|
|
|||
|
|
@ -1,5 +1,9 @@
|
|||
package io.github.adrianvic.nemesiseye;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
public class DataShifter {
|
||||
|
|
@ -8,4 +12,38 @@ public class DataShifter {
|
|||
Pattern pattern = Pattern.compile(cleanPattern, Pattern.CASE_INSENSITIVE);
|
||||
return pattern.matcher(against).matches();
|
||||
}
|
||||
|
||||
public static List<String> parseValueToStringList(List<Object> values) {
|
||||
List<String> result = new ArrayList<>();
|
||||
for (Object o : values) {
|
||||
if (o instanceof String) result.add((String) o);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
public static Map<String, String> parseValueToStringMap(List<Object> values) {
|
||||
Map<String, String> result = new HashMap<>();
|
||||
|
||||
for (Object o : values) {
|
||||
if (o instanceof Map<?, ?> raw) {
|
||||
for (Map.Entry<?, ?> e : raw.entrySet()) {
|
||||
if (e.getKey() instanceof String k && e.getValue() instanceof String v) {
|
||||
result.put(k, v);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
public static List<Map<?, ?>> parseValueToListOfMaps(List<?> values) {
|
||||
List<Map<?, ?>> result = new ArrayList<>();
|
||||
|
||||
for (Object o : values) {
|
||||
if (o instanceof Map<?, ?> raw) {
|
||||
result.add(raw);
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,7 +1,8 @@
|
|||
package io.github.adrianvic.nemesiseye;
|
||||
|
||||
import io.github.adrianvic.nemesiseye.policy.Action;
|
||||
import io.github.adrianvic.nemesiseye.policy.LocationPolicy;
|
||||
import io.github.adrianvic.nemesiseye.policy.policies.LocationPolicy;
|
||||
import io.github.adrianvic.nemesiseye.policy.Policy;
|
||||
import io.github.adrianvic.nemesiseye.policy.PolicyNode;
|
||||
import org.bukkit.entity.HumanEntity;
|
||||
import org.bukkit.util.BoundingBox;
|
||||
|
|
@ -38,22 +39,24 @@ public class Validator {
|
|||
return node.isWhitelist() != allowed;
|
||||
}
|
||||
|
||||
public static List<PolicyNode> getNodesForPolicies(List<LocationPolicy> policies) {
|
||||
public static List<PolicyNode> getNodesForPolicies(List<Policy> policies) {
|
||||
List<PolicyNode> nodes = new ArrayList<>();
|
||||
for (LocationPolicy p : policies) {
|
||||
for (Policy p : policies) {
|
||||
nodes.addAll(p.nodes());
|
||||
}
|
||||
return nodes;
|
||||
}
|
||||
|
||||
public static List<LocationPolicy> getPoliciesForEntity(HumanEntity entity) {
|
||||
List<LocationPolicy> lps = Config.getInstance().getLocationPolicies();
|
||||
List<LocationPolicy> applyingLPS = new ArrayList<>();
|
||||
for (LocationPolicy lp : lps) {
|
||||
for (ArrayList<BoundingBox> boxes : lp.locations()) {
|
||||
for (BoundingBox box : boxes) {
|
||||
if (box.contains(entity.getLocation().toVector())) {
|
||||
applyingLPS.add(lp);
|
||||
public static List<Policy> getPoliciesForEntity(HumanEntity entity) {
|
||||
List<Policy> ps = Config.getInstance().getPolicies();
|
||||
List<Policy> applyingLPS = new ArrayList<>();
|
||||
for (Policy p : ps) {
|
||||
if (p instanceof LocationPolicy lp) {
|
||||
for (ArrayList<BoundingBox> boxes : lp.locations()) {
|
||||
for (BoundingBox box : boxes) {
|
||||
if (box.contains(entity.getLocation().toVector())) {
|
||||
applyingLPS.add(lp);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
package io.github.adrianvic.nemesiseye.commands.sub;
|
||||
|
||||
import io.github.adrianvic.nemesiseye.Validator;
|
||||
import io.github.adrianvic.nemesiseye.policy.LocationPolicy;
|
||||
import io.github.adrianvic.nemesiseye.policy.Policy;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.HumanEntity;
|
||||
|
||||
|
|
@ -16,9 +16,9 @@ public class CurrentPolicies implements Subcommand {
|
|||
|
||||
@Override
|
||||
public boolean execute(CommandSender commandSender, String[] args) {
|
||||
List<LocationPolicy> policies = Validator.getPoliciesForEntity((HumanEntity) commandSender);
|
||||
List<Policy> policies = Validator.getPoliciesForEntity((HumanEntity) commandSender);
|
||||
List<String> pstrings = new ArrayList<>();
|
||||
for (LocationPolicy p : policies) {
|
||||
for (Policy p : policies) {
|
||||
pstrings.add(" %s (%s nodes)".formatted(p.name(), p.nodes().size()));
|
||||
}
|
||||
if (pstrings.isEmpty()) {
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
package io.github.adrianvic.nemesiseye.commands.sub;
|
||||
|
||||
import io.github.adrianvic.nemesiseye.Config;
|
||||
import io.github.adrianvic.nemesiseye.policy.LocationPolicy;
|
||||
import io.github.adrianvic.nemesiseye.policy.Policy;
|
||||
import org.bukkit.command.CommandSender;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
|
@ -17,7 +17,7 @@ public class ListPolicies implements Subcommand {
|
|||
@Override
|
||||
public boolean execute(CommandSender commandSender, String[] args) {
|
||||
List<String> rstr = new ArrayList<>();
|
||||
for (LocationPolicy p : Config.getInstance().getLocationPolicies()) {
|
||||
for (Policy p : Config.getInstance().getPolicies()) {
|
||||
rstr.add(p.name());
|
||||
}
|
||||
commandSender.sendMessage(String.join(", ", rstr) + ".");
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
package io.github.adrianvic.nemesiseye.commands.sub;
|
||||
|
||||
import io.github.adrianvic.nemesiseye.Config;
|
||||
import io.github.adrianvic.nemesiseye.policy.LocationPolicy;
|
||||
import io.github.adrianvic.nemesiseye.policy.Policy;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.command.CommandSender;
|
||||
|
||||
|
|
@ -16,18 +16,15 @@ public class PolicyInfo implements Subcommand {
|
|||
|
||||
@Override
|
||||
public boolean execute(CommandSender commandSender, String[] strings) {
|
||||
List<LocationPolicy> policies = Config.getInstance().getLocationPolicies();
|
||||
for (LocationPolicy lp : policies) {
|
||||
if (lp.name().equals(strings[0])) {
|
||||
String locations = lp.locations().toString();
|
||||
|
||||
List<Policy> policies = Config.getInstance().getPolicies();
|
||||
for (Policy policy : policies) {
|
||||
if (policy.name().equals(strings[0])) {
|
||||
commandSender.sendMessage(String.format("""
|
||||
Showing info for policy "%s%s%s":
|
||||
Type: %s
|
||||
Locations: %s
|
||||
Nodes: %s
|
||||
%s
|
||||
""", ChatColor.UNDERLINE, lp.name(), ChatColor.RESET, "location", locations, lp.nodes().size(), lp.allowlist() ? "Is allowlist" : "Is blacklist"));
|
||||
""", ChatColor.UNDERLINE, policy.name(), ChatColor.RESET, "location", policy.nodes().size(), policy.allowlist() ? "Is allowlist" : "Is blacklist"));
|
||||
}
|
||||
}
|
||||
return true;
|
||||
|
|
@ -36,7 +33,7 @@ public class PolicyInfo implements Subcommand {
|
|||
@Override
|
||||
public List<String> onTabComplete(CommandSender sender, String[] args) {
|
||||
List<String> rstr = new ArrayList<>();
|
||||
for (LocationPolicy p : Config.getInstance().getLocationPolicies()) {
|
||||
for (Policy p : Config.getInstance().getPolicies()) {
|
||||
rstr.add(p.name());
|
||||
}
|
||||
return rstr;
|
||||
|
|
|
|||
|
|
@ -1,65 +0,0 @@
|
|||
package io.github.adrianvic.nemesiseye.policy;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.util.BoundingBox;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
public record LocationPolicy(String name, List<ArrayList<BoundingBox>> locations, List<PolicyNode> nodes, boolean allowlist) {
|
||||
public static List<LocationPolicy> parseLocationPolicy(List<Map<?,?>> raw) {
|
||||
List<LocationPolicy> out = new ArrayList<>(raw.size());
|
||||
for (Map<?,?> m : raw) {
|
||||
String name = (String) m.get("name");
|
||||
boolean allowlist = Boolean.TRUE.equals(m.get("allowList"));
|
||||
|
||||
// Nodes
|
||||
Object rawNodes = m.get("nodes");
|
||||
List<Map<String, Object>> nodeList = new ArrayList<>();
|
||||
if (rawNodes instanceof List<?> list) {
|
||||
for (Object o : list) {
|
||||
if (o instanceof Map<?, ?> map)
|
||||
nodeList.add((Map<String, Object>) map);
|
||||
}
|
||||
}
|
||||
|
||||
List<PolicyNode> nodes = PolicyNode.parseNodes(nodeList, allowlist);
|
||||
|
||||
// Parsing locations
|
||||
List<ArrayList<BoundingBox>> locations = new ArrayList<>();
|
||||
Object rawGroups = m.get("locations");
|
||||
List<?> groups = rawGroups instanceof List ? (List<?>) rawGroups : List.of();
|
||||
|
||||
// Getting groups
|
||||
for (Object gObj : groups) {
|
||||
List<?> group = (List<?>) gObj;
|
||||
ArrayList<BoundingBox> boxes = new ArrayList<>(group.size());
|
||||
|
||||
// Now iterate over regions inside the group
|
||||
for (Object rObj : group) {
|
||||
Map<?,?> region = (Map<?, ?>) rObj;
|
||||
Map<?,?> c1 = (Map<?, ?>) region.get("corner1");
|
||||
Map<?,?> c2 = (Map<?, ?>) region.get("corner2");
|
||||
|
||||
double x1 = ((Number) c1.get("x")).doubleValue();
|
||||
double y1 = ((Number) c1.get("y")).doubleValue();
|
||||
double z1 = ((Number) c1.get("z")).doubleValue();
|
||||
|
||||
double x2 = ((Number) c2.get("x")).doubleValue();
|
||||
double y2 = ((Number) c2.get("y")).doubleValue();
|
||||
double z2 = ((Number) c2.get("z")).doubleValue();
|
||||
|
||||
Location loc1 = new Location(Bukkit.getWorlds().getFirst(), x1, y1, z1);
|
||||
Location loc2 = new Location(Bukkit.getWorlds().getFirst(), x2, y2, z2);
|
||||
|
||||
boxes.add(BoundingBox.of(loc1, loc2));
|
||||
}
|
||||
locations.add(boxes);
|
||||
}
|
||||
out.add(new LocationPolicy(name, locations, nodes, allowlist));
|
||||
}
|
||||
return out;
|
||||
}
|
||||
}
|
||||
|
|
@ -1,28 +0,0 @@
|
|||
package io.github.adrianvic.nemesiseye.policy;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
public class NodeValueParser {
|
||||
public static List<String> parseValueToStringList(List<Object> values) {
|
||||
List<String> result = new ArrayList<>();
|
||||
for (Object o : values) {
|
||||
if (o instanceof String) result.add((String) o);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
public static Map<String, String> parseValueToStringMap(List<Object> values) {
|
||||
Map<String, String> result = new HashMap<>();
|
||||
|
||||
for (Object o : values) {
|
||||
if (o instanceof Map<?, ?> raw) {
|
||||
for (Map.Entry<?, ?> e : raw.entrySet()) {
|
||||
if (e.getKey() instanceof String k && e.getValue() instanceof String v) {
|
||||
result.put(k, v);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,13 @@
|
|||
package io.github.adrianvic.nemesiseye.policy;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface Policy {
|
||||
String name();
|
||||
List<PolicyNode> nodes();
|
||||
boolean allowlist();
|
||||
|
||||
default PolicyParser getParser() {
|
||||
return PolicyParsers.get("");
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,7 @@
|
|||
package io.github.adrianvic.nemesiseye.policy;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface PolicyParser {
|
||||
List<Policy> parse(List<?> raw);
|
||||
}
|
||||
|
|
@ -0,0 +1,18 @@
|
|||
package io.github.adrianvic.nemesiseye.policy;
|
||||
|
||||
import io.github.adrianvic.nemesiseye.policy.parser.LocationPolicyParser;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
public class PolicyParsers {
|
||||
private static final Map<String, PolicyParser> handlers = new HashMap<>();
|
||||
|
||||
static {
|
||||
handlers.put("Location", new LocationPolicyParser());
|
||||
}
|
||||
|
||||
public static PolicyParser get(String type) {
|
||||
return handlers.get(type);
|
||||
}
|
||||
}
|
||||
|
|
@ -3,7 +3,6 @@ package io.github.adrianvic.nemesiseye.policy.handlers;
|
|||
import io.github.adrianvic.nemesiseye.DataShifter;
|
||||
import io.github.adrianvic.nemesiseye.policy.Action;
|
||||
import io.github.adrianvic.nemesiseye.policy.NodeHandler;
|
||||
import io.github.adrianvic.nemesiseye.policy.NodeValueParser;
|
||||
import io.github.adrianvic.nemesiseye.policy.PolicyNode;
|
||||
import org.bukkit.entity.HumanEntity;
|
||||
|
||||
|
|
@ -12,7 +11,7 @@ public class attackWith implements NodeHandler {
|
|||
@Override
|
||||
public boolean allows(HumanEntity entity, PolicyNode node, Action action) {
|
||||
if (action == Action.HIT) {
|
||||
for (String s : NodeValueParser.parseValueToStringList(node.values())) {
|
||||
for (String s : DataShifter.parseValueToStringList(node.values())) {
|
||||
if (DataShifter.safeMatches(s, entity.getInventory().getItemInMainHand().getType().toString())) return false;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,7 +3,6 @@ package io.github.adrianvic.nemesiseye.policy.handlers;
|
|||
import io.github.adrianvic.nemesiseye.DataShifter;
|
||||
import io.github.adrianvic.nemesiseye.policy.Action;
|
||||
import io.github.adrianvic.nemesiseye.policy.NodeHandler;
|
||||
import io.github.adrianvic.nemesiseye.policy.NodeValueParser;
|
||||
import io.github.adrianvic.nemesiseye.policy.PolicyNode;
|
||||
import org.bukkit.enchantments.Enchantment;
|
||||
import org.bukkit.entity.HumanEntity;
|
||||
|
|
@ -25,7 +24,7 @@ public class useEnchantment implements NodeHandler {
|
|||
return !node.isWhitelist();
|
||||
}
|
||||
|
||||
Map<String, String> valuesmap = NodeValueParser.parseValueToStringMap(node.values());
|
||||
Map<String, String> valuesmap = DataShifter.parseValueToStringMap(node.values());
|
||||
|
||||
for (Map.Entry<Enchantment, Integer> e : enchants.entrySet()) {
|
||||
String enchantment = e.getKey().getKey().getKey();
|
||||
|
|
|
|||
|
|
@ -3,7 +3,6 @@ package io.github.adrianvic.nemesiseye.policy.handlers;
|
|||
import io.github.adrianvic.nemesiseye.DataShifter;
|
||||
import io.github.adrianvic.nemesiseye.policy.Action;
|
||||
import io.github.adrianvic.nemesiseye.policy.NodeHandler;
|
||||
import io.github.adrianvic.nemesiseye.policy.NodeValueParser;
|
||||
import io.github.adrianvic.nemesiseye.policy.PolicyNode;
|
||||
import org.bukkit.entity.HumanEntity;
|
||||
|
||||
|
|
@ -13,7 +12,7 @@ public class useItem implements NodeHandler {
|
|||
public boolean allows(HumanEntity entity, PolicyNode node, Action action) {
|
||||
String type = entity.getInventory().getItemInMainHand().getType().toString();
|
||||
|
||||
for (String s : NodeValueParser.parseValueToStringList(node.values())) {
|
||||
for (String s : DataShifter.parseValueToStringList(node.values())) {
|
||||
if (DataShifter.safeMatches(s, type)) {
|
||||
return false;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,68 @@
|
|||
package io.github.adrianvic.nemesiseye.policy.parser;
|
||||
|
||||
import io.github.adrianvic.nemesiseye.DataShifter;
|
||||
import io.github.adrianvic.nemesiseye.policy.*;
|
||||
import io.github.adrianvic.nemesiseye.policy.policies.LocationPolicy;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.util.BoundingBox;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
public class LocationPolicyParser implements PolicyParser {
|
||||
public List<Policy> parse(List<?> raw) {
|
||||
List<Policy> out = new ArrayList<>(raw.size());
|
||||
List<Map<?, ?>> parsedRawMap = DataShifter.parseValueToListOfMaps(raw);
|
||||
|
||||
for (Map<?, ?> m : parsedRawMap) {
|
||||
String name = (String) m.get("name");
|
||||
boolean allowlist = Boolean.TRUE.equals(m.get("allowList"));
|
||||
|
||||
// Nodes
|
||||
Object rawNodes = m.get("nodes");
|
||||
List<Map<String, Object>> nodeList = new ArrayList<>();
|
||||
if (rawNodes instanceof List<?> list) {
|
||||
for (Object o : list) {
|
||||
if (o instanceof Map<?, ?> map)
|
||||
nodeList.add((Map<String, Object>) map);
|
||||
}
|
||||
}
|
||||
|
||||
List<PolicyNode> nodes = PolicyNode.parseNodes(nodeList, allowlist);
|
||||
|
||||
// Parsing locations
|
||||
List<ArrayList<BoundingBox>> locations = new ArrayList<>();
|
||||
|
||||
Object rawLocations = m.get("locations");
|
||||
List<?> groups = rawLocations instanceof List ? (List<?>) rawLocations : List.of();
|
||||
|
||||
ArrayList<BoundingBox> boxes = new ArrayList<>(groups.size());
|
||||
|
||||
// Now iterate over regions
|
||||
for (Object rObj : groups) {
|
||||
Map<?, ?> region = (Map<?, ?>) rObj;
|
||||
Map<?, ?> c1 = (Map<?, ?>) region.get("corner1");
|
||||
Map<?, ?> c2 = (Map<?, ?>) region.get("corner2");
|
||||
|
||||
double x1 = ((Number) c1.get("x")).doubleValue();
|
||||
double y1 = ((Number) c1.get("y")).doubleValue();
|
||||
double z1 = ((Number) c1.get("z")).doubleValue();
|
||||
|
||||
double x2 = ((Number) c2.get("x")).doubleValue();
|
||||
double y2 = ((Number) c2.get("y")).doubleValue();
|
||||
double z2 = ((Number) c2.get("z")).doubleValue();
|
||||
|
||||
Location loc1 = new Location(Bukkit.getWorlds().getFirst(), x1, y1, z1);
|
||||
Location loc2 = new Location(Bukkit.getWorlds().getFirst(), x2, y2, z2);
|
||||
|
||||
boxes.add(BoundingBox.of(loc1, loc2));
|
||||
}
|
||||
locations.add(boxes);
|
||||
|
||||
out.add(new LocationPolicy(name, locations, nodes, allowlist));
|
||||
}
|
||||
return out;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,10 @@
|
|||
package io.github.adrianvic.nemesiseye.policy.policies;
|
||||
|
||||
import io.github.adrianvic.nemesiseye.policy.Policy;
|
||||
import io.github.adrianvic.nemesiseye.policy.PolicyNode;
|
||||
import org.bukkit.util.BoundingBox;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public record LocationPolicy(String name, List<ArrayList<BoundingBox>> locations, List<PolicyNode> nodes, boolean allowlist) implements Policy {}
|
||||
|
|
@ -1,5 +1,6 @@
|
|||
package io.github.adrianvic.nemesiseye.policy;
|
||||
package io.github.adrianvic.nemesiseye.policy.policies;
|
||||
|
||||
import io.github.adrianvic.nemesiseye.policy.PolicyNode;
|
||||
import org.bukkit.permissions.Permission;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
|
@ -1,4 +1,6 @@
|
|||
package io.github.adrianvic.nemesiseye.policy;
|
||||
package io.github.adrianvic.nemesiseye.policy.policies;
|
||||
|
||||
import io.github.adrianvic.nemesiseye.policy.PolicyNode;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
|
|
@ -1,5 +1,5 @@
|
|||
name: "Eye-of-Nemesis"
|
||||
version: '1.0.1-SNAPSHOT'
|
||||
version: '1.0.2-SNAPSHOT'
|
||||
main: io.github.adrianvic.nemesiseye.Nemesis
|
||||
api-version: '1.21'
|
||||
author: 'Adrian Victor'
|
||||
|
|
|
|||
|
|
@ -1,122 +1,121 @@
|
|||
Policies:
|
||||
Location:
|
||||
# NO SPACES
|
||||
- name: "Beta-1.7.3-items-only"
|
||||
# Will deny anything that's not allowed by the nodes if set to true
|
||||
allowList: true
|
||||
nodes:
|
||||
- useItem:
|
||||
- AIR
|
||||
- STONE
|
||||
- COBBLESTONE
|
||||
- "^(OAK|SPRUCE|BIRCH)_(LOG|SAPLING|PLANKS|LEAVES)$"
|
||||
- "^(DIAMOND|GOLD|IRON|COAL|LAPIS|REDSTONE)_ORE$"
|
||||
- "^(DIAMOND|GOLD|IRON|LAPIS)_BLOCK$"
|
||||
- GRAVEL
|
||||
- BEDROCK
|
||||
- SAND
|
||||
- SPONGE
|
||||
- WET_SPONGE
|
||||
- GLASS
|
||||
- LAPIS_LAZULI
|
||||
- COBWEB
|
||||
- PISTON
|
||||
- STICKY_PISTON
|
||||
- GRASS
|
||||
- DISPENSER
|
||||
- NOTE_BLOCK
|
||||
- SANDSTONE
|
||||
- RED_BED
|
||||
- "^(POWERED|DETECTOR)_RAIL$"
|
||||
- RAIL
|
||||
- SHORT_GRASS
|
||||
- "^(WHITE|BLACK|GREEN|YELLOW|PINK|PURPLE|CYAN|BLUE|RED|LIME|BROWN|LIGHT_GRAY|GRAY)_(WOOL|DYE)$"
|
||||
- POPPY
|
||||
- DANDELION
|
||||
- "^(RED|BROWN)_MUSHROOM$"
|
||||
- "^(OAK|COBBLESTONE)_SLAB$"
|
||||
- BRICK_BLOCK
|
||||
- TNT
|
||||
- BOOKSHELF
|
||||
- OBSIDIAN
|
||||
- MOSSY_COBBLESTONE
|
||||
- TORCH
|
||||
- SPAWNER
|
||||
- REDSTONE
|
||||
- CHEST
|
||||
- CRAFTING_TABLE
|
||||
- FARMLAND
|
||||
- FURNACE
|
||||
- SIGN
|
||||
- LADDER
|
||||
- "^(COBBLESTONE|OAK)_STAIRS$"
|
||||
- LEVER
|
||||
- "^(OAK|STONE)_PRESSURE_PLATE$"
|
||||
- "^(OAK|IRON)_DOOR$"
|
||||
- BLUE_ICE
|
||||
- REDSTONE_TORCH
|
||||
- STONE_BUTTON
|
||||
- SNOW
|
||||
- SNOW_BLOCK
|
||||
- CLAY
|
||||
- SUGAR_CANE
|
||||
- JUKEBOX
|
||||
- OAK_FENCE
|
||||
- PUMPKIN
|
||||
- NETHERRACK
|
||||
- SOUL_SAND
|
||||
- GLOWSTONE
|
||||
- JACK_O_LANTERN
|
||||
- CAKE
|
||||
- REPEATER
|
||||
- OAK_TRAPDOOR
|
||||
- "^(IRON|STONE|DIAMOND|WOODEN|GOLDEN)_(SHOVEL|AXE|PICKAXE|SWORD|HOE)$"
|
||||
- "^(IRON|LEATHER|DIAMOND|GOLDEN)_(HELMET|CHESTPLATE|LEGGINGS|BOOTS)$"
|
||||
- STICK
|
||||
- BOWL
|
||||
- MUSHROOM_STEW
|
||||
- FEATHER
|
||||
- STRING
|
||||
- GUNPOWDER
|
||||
- WHEAT_SEEDS
|
||||
- WHEAT
|
||||
- FLINT
|
||||
- FLINT_AND_STEEL
|
||||
- PORKCHOP
|
||||
- "^(COOKED|RAW)_(PORKCHOP|FISH)$"
|
||||
- PAINTING
|
||||
- GOLDEN_APPLE
|
||||
- BUCKET
|
||||
- "^(LAVA|MILK|WATER)_BUCKET$"
|
||||
- MINECART
|
||||
- SADDLE
|
||||
- SNOWBALL
|
||||
- OAK_BOAT
|
||||
- LEATHER
|
||||
- "^(FURNACE|CHEST)_MINECART$"
|
||||
- EGG
|
||||
- BOOK
|
||||
- PAPER
|
||||
- BRICK
|
||||
- SLIME_BALL
|
||||
- COMPASS
|
||||
- FISHING_ROD
|
||||
- CLOCK
|
||||
- GLOWSTONE_DUST
|
||||
- INK_SAC
|
||||
- BONE_MEAL
|
||||
- SUGAR
|
||||
- COOKIE
|
||||
- MAP
|
||||
- FILLED_MAP
|
||||
- SHEARS
|
||||
- MUSIC_DISK_CAT
|
||||
- MUSIC_DISK_13
|
||||
- DIRT
|
||||
- BREAD
|
||||
- useEnchantment:
|
||||
"gibberish": 999999
|
||||
locations:
|
||||
-
|
||||
- Location:
|
||||
# NO SPACES
|
||||
- name: "Beta-1.7.3-items-only"
|
||||
# Will deny anything that's not allowed by the nodes if set to true
|
||||
allowList: true
|
||||
nodes:
|
||||
- useItem:
|
||||
- AIR
|
||||
- STONE
|
||||
- COBBLESTONE
|
||||
- "^(OAK|SPRUCE|BIRCH)_(LOG|SAPLING|PLANKS|LEAVES)$"
|
||||
- "^(DIAMOND|GOLD|IRON|COAL|LAPIS|REDSTONE)_ORE$"
|
||||
- "^(DIAMOND|GOLD|IRON|LAPIS)_BLOCK$"
|
||||
- GRAVEL
|
||||
- BEDROCK
|
||||
- SAND
|
||||
- SPONGE
|
||||
- WET_SPONGE
|
||||
- GLASS
|
||||
- LAPIS_LAZULI
|
||||
- COBWEB
|
||||
- PISTON
|
||||
- STICKY_PISTON
|
||||
- GRASS
|
||||
- DISPENSER
|
||||
- NOTE_BLOCK
|
||||
- SANDSTONE
|
||||
- RED_BED
|
||||
- "^(POWERED|DETECTOR)_RAIL$"
|
||||
- RAIL
|
||||
- SHORT_GRASS
|
||||
- "^(WHITE|BLACK|GREEN|YELLOW|PINK|PURPLE|CYAN|BLUE|RED|LIME|BROWN|LIGHT_GRAY|GRAY)_(WOOL|DYE)$"
|
||||
- POPPY
|
||||
- DANDELION
|
||||
- "^(RED|BROWN)_MUSHROOM$"
|
||||
- "^(OAK|COBBLESTONE)_SLAB$"
|
||||
- BRICK_BLOCK
|
||||
- TNT
|
||||
- BOOKSHELF
|
||||
- OBSIDIAN
|
||||
- MOSSY_COBBLESTONE
|
||||
- TORCH
|
||||
- SPAWNER
|
||||
- REDSTONE
|
||||
- CHEST
|
||||
- CRAFTING_TABLE
|
||||
- FARMLAND
|
||||
- FURNACE
|
||||
- SIGN
|
||||
- LADDER
|
||||
- "^(COBBLESTONE|OAK)_STAIRS$"
|
||||
- LEVER
|
||||
- "^(OAK|STONE)_PRESSURE_PLATE$"
|
||||
- "^(OAK|IRON)_DOOR$"
|
||||
- BLUE_ICE
|
||||
- REDSTONE_TORCH
|
||||
- STONE_BUTTON
|
||||
- SNOW
|
||||
- SNOW_BLOCK
|
||||
- CLAY
|
||||
- SUGAR_CANE
|
||||
- JUKEBOX
|
||||
- OAK_FENCE
|
||||
- PUMPKIN
|
||||
- NETHERRACK
|
||||
- SOUL_SAND
|
||||
- GLOWSTONE
|
||||
- JACK_O_LANTERN
|
||||
- CAKE
|
||||
- REPEATER
|
||||
- OAK_TRAPDOOR
|
||||
- "^(IRON|STONE|DIAMOND|WOODEN|GOLDEN)_(SHOVEL|AXE|PICKAXE|SWORD|HOE)$"
|
||||
- "^(IRON|LEATHER|DIAMOND|GOLDEN)_(HELMET|CHESTPLATE|LEGGINGS|BOOTS)$"
|
||||
- STICK
|
||||
- BOWL
|
||||
- MUSHROOM_STEW
|
||||
- FEATHER
|
||||
- STRING
|
||||
- GUNPOWDER
|
||||
- WHEAT_SEEDS
|
||||
- WHEAT
|
||||
- FLINT
|
||||
- FLINT_AND_STEEL
|
||||
- PORKCHOP
|
||||
- "^(COOKED|RAW)_(PORKCHOP|FISH)$"
|
||||
- PAINTING
|
||||
- GOLDEN_APPLE
|
||||
- BUCKET
|
||||
- "^(LAVA|MILK|WATER)_BUCKET$"
|
||||
- MINECART
|
||||
- SADDLE
|
||||
- SNOWBALL
|
||||
- OAK_BOAT
|
||||
- LEATHER
|
||||
- "^(FURNACE|CHEST)_MINECART$"
|
||||
- EGG
|
||||
- BOOK
|
||||
- PAPER
|
||||
- BRICK
|
||||
- SLIME_BALL
|
||||
- COMPASS
|
||||
- FISHING_ROD
|
||||
- CLOCK
|
||||
- GLOWSTONE_DUST
|
||||
- INK_SAC
|
||||
- BONE_MEAL
|
||||
- SUGAR
|
||||
- COOKIE
|
||||
- MAP
|
||||
- FILLED_MAP
|
||||
- SHEARS
|
||||
- MUSIC_DISK_CAT
|
||||
- MUSIC_DISK_13
|
||||
- DIRT
|
||||
- BREAD
|
||||
- useEnchantment:
|
||||
"gibberish": 999999
|
||||
locations:
|
||||
- corner1: { x: 2100, y: 256, z: 1400 }
|
||||
corner2: { x: 1000, y: -64, z: 2200 }
|
||||
corner2: { x: 1000, y: -64, z: 2200 }
|
||||
Loading…
Add table
Add a link
Reference in a new issue