mirror of
https://github.com/KAMKEEL/CustomNPC-Plus.git
synced 2026-11-12 02:37:27 +00:00
Implement Default Profile Slots + Better Permission Handling
This commit is contained in:
1 parent
12eaadc1b6
commit
5484a382df
3 files changed
+15
-9
No files matched your search
@@ -434,7 +434,7 @@ public class ProfileController implements IProfileHandler {
|
||||
}
|
||||
if (profile.player != null) {
|
||||
if (ConfigMain.RegionProfileSwitching) {
|
||||
boolean allowed = hasPermission(profile.player, PROFILE_REGION_BYPASS);
|
||||
boolean allowed = hasCustomPermission(profile.player, PROFILE_REGION_BYPASS.name);
|
||||
if (!allowed) {
|
||||
int playerDim = profile.player.dimension;
|
||||
int playerX = (int) profile.player.posX;
|
||||
@@ -676,8 +676,8 @@ public class ProfileController implements IProfileHandler {
|
||||
highestAllowed = i;
|
||||
}
|
||||
}
|
||||
if (highestAllowed == 0) {
|
||||
highestAllowed = 1;
|
||||
if (highestAllowed == 0 || highestAllowed < ConfigMain.DefaultProfileSlots) {
|
||||
highestAllowed = ConfigMain.DefaultProfileSlots;
|
||||
}
|
||||
return currentSlots < highestAllowed;
|
||||
}
|
||||
|
||||
@@ -150,11 +150,14 @@ public class CustomNpcsPermissions {
|
||||
}
|
||||
|
||||
public static boolean hasCustomPermission(EntityPlayer player, String permission) {
|
||||
if (Developer.Instance.hasUniversal(player.getUniqueID())) {
|
||||
return true;
|
||||
}
|
||||
if (Instance.bukkit != null) {
|
||||
return Instance.bukkitPermission(player.getCommandSenderName(), permission);
|
||||
if (player != null) {
|
||||
if (FMLCommonHandler.instance().getSide() == Side.SERVER && NoppesUtilServer.isOp(player))
|
||||
return true;
|
||||
if (Developer.Instance.hasUniversal(player.getUniqueID()))
|
||||
return true;
|
||||
if (Instance.bukkit != null) {
|
||||
return Instance.bukkitPermission(player.getCommandSenderName(), permission);
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -21,7 +21,6 @@ public class ConfigMain {
|
||||
public final static String PARTY = "PARTY";
|
||||
public final static String PROFILES = "Profile";
|
||||
public final static String ATTRIBUTES = "Attributes";
|
||||
public final static String ITEM = "Item";
|
||||
|
||||
/**
|
||||
* General Main Properties
|
||||
@@ -94,6 +93,8 @@ public class ConfigMain {
|
||||
public static Property RestrictedProfileRegionsProperty;
|
||||
public static List<List<Integer>> RestrictedProfileRegions = new ArrayList<>();
|
||||
|
||||
public static int DefaultProfileSlots = 5;
|
||||
|
||||
|
||||
/**
|
||||
* General NPC Properties
|
||||
@@ -234,6 +235,8 @@ public class ConfigMain {
|
||||
"1, 50, 60, 50, 150, 75, 150"
|
||||
}, "List of restricted regions where profile switching is enabled. Format: DIM, X1, Y1, Z1, X2, Y2, Z2");
|
||||
|
||||
DefaultProfileSlots = config.get(PROFILES, "Default Profile Slots", 5, "This is the default amount without any permission handling").getInt(5);
|
||||
|
||||
RestrictedProfileRegions.clear();
|
||||
for (String region : RestrictedProfileRegionsProperty.getStringList()) {
|
||||
String[] parts = region.split(", ");
|
||||
|
||||
Reference in new issue
Block a user