fixed bugs with the new features

This commit is contained in:
Alastair Hawkes 2017-04-20 03:55:14 +01:00
parent 160d1e4cc3
commit 1bf886e909
5 changed files with 22 additions and 9 deletions

View File

@ -79,10 +79,12 @@ ThrowbackAmount: 0.7 # How fast to throw them back, 0 or lower to disable throwb
# Remember enabling this means potentially admins could leave a portal lying around which could let them reop themselves. # Remember enabling this means potentially admins could leave a portal lying around which could let them reop themselves.
# If you think this may be an issue use a permission plugin and specifically give the users you trust permissions. # If you think this may be an issue use a permission plugin and specifically give the users you trust permissions.
# #
# n Disabled (none # n Disabled none, best just put this to really make sure the fact none are here is specified. It disables any others too
# o Admin Heighten Enabled Permission advancedportals.createportal.commandlevel.op # o Admin Heighten Enabled Permission advancedportals.createportal.commandlevel.op
# p Perm Heighten Enabled Permission advancedportals.createportal.commandlevel.perms
# c Console Heighten Enabled Permission advancedportals.createportal.commandlevel.console # c Console Heighten Enabled Permission advancedportals.createportal.commandlevel.console
# p Ops can create admin commands without special perms # h Ops can create admin commands without special perms
# e Ops can create all perm commands without special perms
# k Ops can create console commands without special perms # k Ops can create console commands without special perms
# #
CommandLevels: n CommandLevels: n

View File

@ -29,10 +29,14 @@ permissions:
default: false default: false
children: children:
advancedportals.createportal.commandlevel.op: true advancedportals.createportal.commandlevel.op: true
advancedportals.createportal.commandlevel.perms: true
advancedportals.createportal.commandlevel.console: true advancedportals.createportal.commandlevel.console: true
advancedportals.createportal.commandlevel.op: advancedportals.createportal.commandlevel.op:
description: Allows you to increase the users level temporaily to op description: Allows you to increase the users level temporaily to op
default: false default: false
advancedportals.createportal.commandlevel.perms:
description: Allows you to increase the users level temporaily to have all perms
default: false
advancedportals.createportal.commandlevel.console: advancedportals.createportal.commandlevel.console:
description: Executes command in the console description: Executes command in the console
default: false default: false

View File

@ -126,20 +126,27 @@ public class AdvancedPortalsCommand implements CommandExecutor, TabCompleter {
executesCommand = true; executesCommand = true;
portalCommand = parseArgVariable(args, i, "command:"); portalCommand = parseArgVariable(args, i, "command:");
i += this.portalArgsStringLength - 1; i += this.portalArgsStringLength - 1;
if(!( portalCommand.startsWith("#") if(portalCommand.startsWith("#")
&& this.plugin.getSettings().hasCommandLevel("c") && !(this.plugin.getSettings().hasCommandLevel("c")
&& (sender.hasPermission("advancedportals.createportal.commandlevel.console") && (sender.hasPermission("advancedportals.createportal.commandlevel.console")
|| (this.plugin.getSettings().hasCommandLevel("k") && sender.isOp()) ) )){ || (this.plugin.getSettings().hasCommandLevel("k") && sender.isOp()) ) )){
player.sendMessage(PluginMessages.customPrefixFail + " You need permission to make a console command portal!"); player.sendMessage(PluginMessages.customPrefixFail + " You need permission to make a console command portal!");
return true; return true;
} }
else if(!( portalCommand.startsWith("!") else if(portalCommand.startsWith("!")
&& this.plugin.getSettings().hasCommandLevel("o") && !(this.plugin.getSettings().hasCommandLevel("o")
&& (sender.hasPermission("advancedportals.createportal.commandlevel.op") && (sender.hasPermission("advancedportals.createportal.commandlevel.op")
|| (this.plugin.getSettings().hasCommandLevel("p") && sender.isOp()) ) )){ || (this.plugin.getSettings().hasCommandLevel("h") && sender.isOp()) ) )){
player.sendMessage(PluginMessages.customPrefixFail + " You need permission to make a op command portal!"); player.sendMessage(PluginMessages.customPrefixFail + " You need permission to make a op command portal!");
return true; return true;
} }
else if(portalCommand.startsWith("^")
&& !(this.plugin.getSettings().hasCommandLevel("p")
&& (sender.hasPermission("advancedportals.createportal.commandlevel.perms")
|| (this.plugin.getSettings().hasCommandLevel("e") && sender.isOp()) ) )){
player.sendMessage(PluginMessages.customPrefixFail + " You need permission to make a all perms command portal!");
return true;
}
extraData.add(new PortalArg("command.1", portalCommand)); extraData.add(new PortalArg("command.1", portalCommand));
} }
} }

View File

@ -17,7 +17,7 @@ public class Settings {
currentWarpSound = config.getConfig().getInt("WarpSound"); currentWarpSound = config.getConfig().getInt("WarpSound");
commandLevels = config.getConfig().getString("CommandLevels", "n"); commandLevels = config.getConfig().getString("CommandLevels", "n");
if(commandLevels.equals("")){ if(commandLevels.contains("n") || commandLevels.equals("")) {
commandLevels = "n"; commandLevels = "n";
} }
} }

View File

@ -414,7 +414,7 @@ public class Portal {
} }
} }
if (!portal.hasArg("command.1")) { if (portal.hasArg("command.1")) {
int commandLine = 1; int commandLine = 1;
String command = portal.getArg("command." + commandLine);//portalData.getConfig().getString(portal.portalName+ ".portalArgs.command." + commandLine); String command = portal.getArg("command." + commandLine);//portalData.getConfig().getString(portal.portalName+ ".portalArgs.command." + commandLine);
do { do {