Fixed command-on-exit & console-command-on-exit executes on entry (also removed it from oping idk wth that was doing there)

This commit is contained in:
isokissa3 2017-07-24 09:49:54 +03:00
parent 0a15fa5dff
commit d58e90ffe5
4 changed files with 10 additions and 21 deletions

View file

@ -3,7 +3,7 @@
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
<groupId>net.goldtreeservers</groupId> <groupId>net.goldtreeservers</groupId>
<artifactId>worldguardextraflags</artifactId> <artifactId>worldguardextraflags</artifactId>
<version>2.14.1</version> <version>2.14.2</version>
<name>WorldGuardExtraFlags</name> <name>WorldGuardExtraFlags</name>
<build> <build>
<finalName>WorldGuardExtraFlagsPlugin</finalName> <finalName>WorldGuardExtraFlagsPlugin</finalName>

View file

@ -63,9 +63,9 @@ public class CommandOnExitFlag extends Handler
} }
} }
for(Set<String> commands_ : commands) for(Set<String> commands_ : this.lastCommands)
{ {
if (!this.lastCommands.contains(commands_)) if (!commands.contains(commands_))
{ {
boolean isOp = player.isOp(); boolean isOp = player.isOp();

View file

@ -63,29 +63,18 @@ public class ConsoleCommandOnExitFlag extends Handler
} }
} }
boolean isOp = player.isOp(); for(Set<String> commands_ : this.lastCommands)
try
{ {
player.setOp(true); if (!commands.contains(commands_))
for(Set<String> commands_ : commands)
{ {
if (!this.lastCommands.contains(commands_)) for(String command : commands_)
{ {
for(String command : commands_) WorldGuardExtraFlagsPlugin.getPlugin().getServer().dispatchCommand(WorldGuardExtraFlagsPlugin.getPlugin().getServer().getConsoleSender(), command.substring(1).replace("%username%", player.getName())); //TODO: Make this better
{
WorldGuardExtraFlagsPlugin.getPlugin().getServer().dispatchCommand(WorldGuardExtraFlagsPlugin.getPlugin().getServer().getConsoleSender(), command.substring(1).replace("%username%", player.getName())); //TODO: Make this better
}
break;
} }
break;
} }
} }
finally
{
player.setOp(isOp);
}
this.lastCommands = commands; this.lastCommands = commands;
} }

View file

@ -1,5 +1,5 @@
name: WorldGuardExtraFlags name: WorldGuardExtraFlags
version: 2.14.1 version: 2.14.2
description: Adds more flags to worldguard to help manage your server easily! description: Adds more flags to worldguard to help manage your server easily!
author: isokissa3 author: isokissa3
website: https://goldtreevers.net website: https://goldtreevers.net