Implement Profile Regions

This commit is contained in:
Kam committed 2025-02-19 18:15:05 -05:00
1 parent db330d0038
commit cf6e6dd655
14 files changed
+486 -283

No files matched your search

@@ -94,6 +94,7 @@ public class CustomNpcsPermissions{
public static final Permission PROFILE_DELETE = new Permission("customnpcs.profile.delete");
public static final Permission PROFILE_RENAME = new Permission("customnpcs.profile.rename");
public static final Permission PROFILE_CHANGE = new Permission("customnpcs.profile.change");
public static final Permission PROFILE_REGION_BYPASS = new Permission("customnpcs.profile.region-bypass");
public static final Permission PROFILE_MAX = new Permission("customnpcs.profile.max.*");
public static CustomNpcsPermissions Instance;
@@ -8,6 +8,8 @@ import noppes.npcs.config.legacy.LegacyConfig;
import org.apache.logging.log4j.Level;
import java.io.File;
import java.util.ArrayList;
import java.util.List;
public class ConfigMain
{
@@ -87,6 +89,11 @@ public class ConfigMain
public static boolean AllowProfileBackups = true;
public static int ProfileBackupAmount = 5;
public static Property RegionProfileSwitchingProperty;
public static boolean RegionProfileSwitching = false;
public static Property RestrictedProfileRegionsProperty;
public static List<List<Integer>> RestrictedProfileRegions = new ArrayList<>();
/**
* General NPC Properties
@@ -230,6 +237,24 @@ public class ConfigMain
AllowProfileBackups = config.get(PROFILES, "Enable Profile Backups", true, "Will create backups of profile changes").getBoolean(true);
ProfileBackupAmount = config.get(PROFILES, "Number of Backups", 5, "How many backups per player to save").getInt(5);
RegionProfileSwitchingProperty = config.get(PROFILES, "Region Profile Switching", false, "If true, only allows profile switching in certain regions.");
RegionProfileSwitching = RegionProfileSwitchingProperty.getBoolean(false);
RestrictedProfileRegionsProperty = config.get(PROFILES, "Restricted Profile Regions", new String[]{
"0, 100, 64, 100, 200, 80, 200",
"1, 50, 60, 50, 150, 75, 150"
}, "List of restricted regions where profile switching is enabled. Format: DIM, X1, Y1, Z1, X2, Y2, Z2");
RestrictedProfileRegions.clear();
for (String region : RestrictedProfileRegionsProperty.getStringList()) {
String[] parts = region.split(", ");
List<Integer> regionList = new ArrayList<>();
for (String part : parts) {
regionList.add(Integer.parseInt(part));
}
RestrictedProfileRegions.add(regionList);
}
// Convert to Legacy
if(CustomNpcs.legacyExist){
EnableUpdateChecker = LegacyConfig.EnableUpdateChecker;