Mirror von
https://github.com/IntellectualSites/FastAsyncWorldEdit.git
synchronisiert 2024-11-09 13:00:05 +01:00
Fix toggle permission (#644)
* Fixes #529 * fix superperms perm toggling Co-authored-by: @weaondara <wea_ondara@alpenblock.net>
Dieser Commit ist enthalten in:
Ursprung
806916d6e8
Commit
3b2fe2ffde
@ -60,6 +60,7 @@ import org.bukkit.entity.Player;
|
|||||||
import org.bukkit.event.player.PlayerDropItemEvent;
|
import org.bukkit.event.player.PlayerDropItemEvent;
|
||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.ItemStack;
|
||||||
import org.bukkit.inventory.PlayerInventory;
|
import org.bukkit.inventory.PlayerInventory;
|
||||||
|
import org.bukkit.permissions.PermissionAttachment;
|
||||||
|
|
||||||
import java.util.concurrent.ConcurrentHashMap;
|
import java.util.concurrent.ConcurrentHashMap;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
@ -73,16 +74,19 @@ public class BukkitPlayer extends AbstractPlayerActor {
|
|||||||
|
|
||||||
private Player player;
|
private Player player;
|
||||||
private WorldEditPlugin plugin;
|
private WorldEditPlugin plugin;
|
||||||
|
private PermissionAttachment permAttachment;
|
||||||
|
|
||||||
public BukkitPlayer(Player player) {
|
public BukkitPlayer(Player player) {
|
||||||
super(getExistingMap(WorldEditPlugin.getInstance(), player));
|
super(getExistingMap(WorldEditPlugin.getInstance(), player));
|
||||||
this.plugin = WorldEditPlugin.getInstance();
|
this.plugin = WorldEditPlugin.getInstance();
|
||||||
this.player = player;
|
this.player = player;
|
||||||
|
this.permAttachment = player.addAttachment(plugin);
|
||||||
}
|
}
|
||||||
|
|
||||||
public BukkitPlayer(WorldEditPlugin plugin, Player player) {
|
public BukkitPlayer(WorldEditPlugin plugin, Player player) {
|
||||||
this.plugin = plugin;
|
this.plugin = plugin;
|
||||||
this.player = player;
|
this.player = player;
|
||||||
|
this.permAttachment = player.addAttachment(plugin);
|
||||||
if (Settings.IMP.CLIPBOARD.USE_DISK) {
|
if (Settings.IMP.CLIPBOARD.USE_DISK) {
|
||||||
loadClipboardFromDisk();
|
loadClipboardFromDisk();
|
||||||
}
|
}
|
||||||
@ -239,16 +243,20 @@ public class BukkitPlayer extends AbstractPlayerActor {
|
|||||||
* Permissions are used to managing WorldEdit region restrictions
|
* Permissions are used to managing WorldEdit region restrictions
|
||||||
* - The `/wea` command will give/remove the required bypass permission
|
* - The `/wea` command will give/remove the required bypass permission
|
||||||
*/
|
*/
|
||||||
|
boolean usesuperperms = VaultResolver.perms == null;
|
||||||
if (VaultResolver.perms != null) {
|
if (VaultResolver.perms != null) {
|
||||||
if (value) {
|
if (value) {
|
||||||
if (!VaultResolver.perms.playerAdd(player, permission)) {
|
if (!VaultResolver.perms.playerAdd(player, permission)) {
|
||||||
player.addAttachment(plugin).setPermission(permission, value);
|
usesuperperms = true;
|
||||||
}
|
|
||||||
} else if (!VaultResolver.perms.playerRemove(player, permission)) {
|
|
||||||
player.addAttachment(plugin).setPermission(permission, value);
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
player.addAttachment(plugin).setPermission(permission, value);
|
if (!VaultResolver.perms.playerRemove(player, permission)) {
|
||||||
|
usesuperperms = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (usesuperperms) {
|
||||||
|
permAttachment.setPermission(permission, value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -174,11 +174,13 @@ public class PlayerProxy extends AbstractPlayerActor {
|
|||||||
return permActor.hasPermission(perm);
|
return permActor.hasPermission(perm);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override public boolean togglePermission(String permission) {
|
@Override
|
||||||
return permActor.hasPermission(permission);
|
public boolean togglePermission(String permission) {
|
||||||
|
return permActor.togglePermission(permission);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override public void setPermission(String permission, boolean value) {
|
@Override
|
||||||
|
public void setPermission(String permission, boolean value) {
|
||||||
permActor.setPermission(permission, value);
|
permActor.setPermission(permission, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren