mirror of
https://github.com/TotalFreedomMC/TF-WorldGuardExtraFlagsPlugin.git
synced 2024-12-28 10:04:50 +00:00
Fixed opping & deopping players even when it's not needed
This commit is contained in:
parent
92216b055e
commit
0a15fa5dff
4 changed files with 41 additions and 30 deletions
2
pom.xml
2
pom.xml
|
@ -3,7 +3,7 @@
|
|||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>net.goldtreeservers</groupId>
|
||||
<artifactId>worldguardextraflags</artifactId>
|
||||
<version>2.14</version>
|
||||
<version>2.14.1</version>
|
||||
<name>WorldGuardExtraFlags</name>
|
||||
<build>
|
||||
<finalName>WorldGuardExtraFlagsPlugin</finalName>
|
||||
|
|
|
@ -45,29 +45,35 @@ public class CommandOnEntryFlag extends Handler
|
|||
{
|
||||
Collection<Set<String>> commands = toSet.queryAllValues(WorldGuardUtils.wrapPlayer(player), FlagUtils.COMMAND_ON_ENTRY);
|
||||
|
||||
boolean isOp = player.isOp();
|
||||
|
||||
try
|
||||
for(Set<String> commands_ : commands)
|
||||
{
|
||||
player.setOp(true);
|
||||
|
||||
for(Set<String> commands_ : commands)
|
||||
if (!this.lastCommands.contains(commands_))
|
||||
{
|
||||
if (!this.lastCommands.contains(commands_))
|
||||
boolean isOp = player.isOp();
|
||||
|
||||
try
|
||||
{
|
||||
if (!isOp)
|
||||
{
|
||||
player.setOp(true);
|
||||
}
|
||||
|
||||
for(String command : commands_)
|
||||
{
|
||||
WorldGuardExtraFlagsPlugin.getPlugin().getServer().dispatchCommand(player, command.substring(1).replace("%username%", player.getName())); //TODO: Make this better
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
finally
|
||||
{
|
||||
if (!isOp)
|
||||
{
|
||||
player.setOp(isOp);
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
finally
|
||||
{
|
||||
player.setOp(isOp);
|
||||
}
|
||||
|
||||
this.lastCommands = new ArrayList<Set<String>>(commands);
|
||||
|
||||
|
|
|
@ -63,29 +63,35 @@ public class CommandOnExitFlag extends Handler
|
|||
}
|
||||
}
|
||||
|
||||
boolean isOp = player.isOp();
|
||||
|
||||
try
|
||||
for(Set<String> commands_ : commands)
|
||||
{
|
||||
player.setOp(true);
|
||||
|
||||
for(Set<String> commands_ : commands)
|
||||
if (!this.lastCommands.contains(commands_))
|
||||
{
|
||||
if (!this.lastCommands.contains(commands_))
|
||||
boolean isOp = player.isOp();
|
||||
|
||||
try
|
||||
{
|
||||
if (!isOp)
|
||||
{
|
||||
player.setOp(true);
|
||||
}
|
||||
|
||||
for(String command : commands_)
|
||||
{
|
||||
WorldGuardExtraFlagsPlugin.getPlugin().getServer().dispatchCommand(player, command.substring(1).replace("%username%", player.getName())); //TODO: Make this better
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
finally
|
||||
{
|
||||
if (!isOp)
|
||||
{
|
||||
player.setOp(isOp);
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
finally
|
||||
{
|
||||
player.setOp(isOp);
|
||||
}
|
||||
|
||||
this.lastCommands = commands;
|
||||
}
|
||||
|
|
|
@ -1,8 +1,7 @@
|
|||
name: WorldGuardExtraFlags
|
||||
version: 2.14
|
||||
description: Add more flags to worldguard to help manage your server easily!
|
||||
version: 2.14.1
|
||||
description: Adds more flags to worldguard to help manage your server easily!
|
||||
author: isokissa3
|
||||
authors: [isokissa3]
|
||||
website: https://goldtreevers.net
|
||||
depend: [ WorldGuard ]
|
||||
softdepend: [ MythicMobs, FastAsyncWorldEdit, Essentials ]
|
||||
|
|
Loading…
Reference in a new issue