Override VaultAPI Permission extra methods #playerAdd and @playerRemove to ignore the current player world when another plugin changes permissions
This commit is contained in:
parent
07af67b33f
commit
50e21896ba
@ -7,6 +7,7 @@ import net.milkbowl.vault.chat.Chat;
|
|||||||
import net.milkbowl.vault.permission.Permission;
|
import net.milkbowl.vault.permission.Permission;
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.OfflinePlayer;
|
import org.bukkit.OfflinePlayer;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.plugin.ServicePriority;
|
import org.bukkit.plugin.ServicePriority;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@ -120,6 +121,13 @@ import java.util.List;
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean playerAdd(Player player, String permission) {
|
||||||
|
// override because the super class sets the permission on the current world of the player, that is probably
|
||||||
|
// not intended by the calling plugin
|
||||||
|
return playerAdd(null, player, permission);
|
||||||
|
}
|
||||||
|
|
||||||
@Deprecated
|
@Deprecated
|
||||||
@Override
|
@Override
|
||||||
public boolean playerRemove(String world, String player, String permission) {
|
public boolean playerRemove(String world, String player, String permission) {
|
||||||
@ -136,6 +144,14 @@ import java.util.List;
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean playerRemove(Player player, String permission) {
|
||||||
|
// to stay coherent with the override of #playerAdd(Player, String), we also override this method.
|
||||||
|
// Will try first to remove the permission on the world itself (like super-method), then if it doesn't exist,
|
||||||
|
// removes on the server level.
|
||||||
|
return super.playerRemove(player, permission) || playerRemove(null, player, permission);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean groupHas(String world, String group, String permission) {
|
public boolean groupHas(String world, String group, String permission) {
|
||||||
checkEnabled();
|
checkEnabled();
|
||||||
|
Loading…
Reference in New Issue
Block a user