Deny actions and conditions not installed

This commit is contained in:
PikaMug 2023-02-26 17:01:28 -05:00
parent 858c81bcd6
commit 4a428c014f
2 changed files with 26 additions and 14 deletions

View File

@ -213,11 +213,15 @@ public class ActionMainPrompt extends ActionsEditorNumericPrompt {
case 6:
return new ActionMobListPrompt(context);
case 7:
if (!plugin.hasLimitedAccess(context.getForWhom())) {
return new ActionDenizenPrompt(context);
if (plugin.getDependencies().getDenizenApi() != null) {
if (!plugin.hasLimitedAccess(context.getForWhom())) {
return new ActionDenizenPrompt(context);
} else {
context.getForWhom().sendRawMessage(ChatColor.RED + Lang.get("modeDeny")
.replace("<mode>", Lang.get("trialMode")));
return new ActionMainPrompt(context);
}
} else {
context.getForWhom().sendRawMessage(ChatColor.RED + Lang.get("modeDeny")
.replace("<mode>", Lang.get("trialMode")));
return new ActionMainPrompt(context);
}
case 8:

View File

@ -188,7 +188,11 @@ public class WorldPrompt extends ConditionsEditorNumericPrompt {
case 3:
return new BiomesPrompt(context);
case 4:
return new RegionsPrompt(context);
if (plugin.getDependencies().getWorldGuardApi() != null) {
return new RegionsPrompt(context);
} else {
return new WorldPrompt(context);
}
case 5:
try {
return new ConditionMainPrompt(context);
@ -361,8 +365,10 @@ public class WorldPrompt extends ConditionsEditorNumericPrompt {
context.setSessionData(CK.C_WHILE_WITHIN_TICKS_END, null);
return new WorldPrompt(context);
case 4:
if (context.getSessionData(CK.C_WHILE_WITHIN_TICKS_START) != null
&& context.getSessionData(CK.C_WHILE_WITHIN_TICKS_END) != null) {
if ((context.getSessionData(CK.C_WHILE_WITHIN_TICKS_START) != null
&& context.getSessionData(CK.C_WHILE_WITHIN_TICKS_END) != null)
|| (context.getSessionData(CK.C_WHILE_WITHIN_TICKS_START) == null
&& context.getSessionData(CK.C_WHILE_WITHIN_TICKS_END) == null)) {
return new ConditionMainPrompt(context);
} else {
context.getForWhom().sendRawMessage(ChatColor.RED + Lang.get("listsNotSameSize"));
@ -562,13 +568,15 @@ public class WorldPrompt extends ConditionsEditorNumericPrompt {
StringBuilder regions = new StringBuilder(ChatColor.LIGHT_PURPLE + getTitle(context) + "\n");
boolean any = false;
for (final World world : plugin.getServer().getWorlds()) {
final WorldGuardAPI api = plugin.getDependencies().getWorldGuardApi();
final RegionManager regionManager = api.getRegionManager(world);
if (regionManager != null) {
for (final String region : regionManager.getRegions().keySet()) {
any = true;
regions.append(ChatColor.GREEN).append(region).append(", ");
final WorldGuardAPI api = plugin.getDependencies().getWorldGuardApi();
if (api != null) {
for (final World world : plugin.getServer().getWorlds()) {
final RegionManager regionManager = api.getRegionManager(world);
if (regionManager != null) {
for (final String region : regionManager.getRegions().keySet()) {
any = true;
regions.append(ChatColor.GREEN).append(region).append(", ");
}
}
}
}