Fix Permission for SignEdit and other stuff
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful
Dieser Commit ist enthalten in:
Ursprung
a61f1e2c8c
Commit
6305453e15
@ -32,10 +32,10 @@ public enum Permission {
|
||||
|
||||
OWNER(bauweltMember -> false),
|
||||
SUPERVISOR(bauweltMember -> {
|
||||
return false; // TODO: Needs to be changed later on
|
||||
return bauweltMember.isWorld();
|
||||
}),
|
||||
BUILD(bauweltMember -> {
|
||||
return bauweltMember.isWorld() || bauweltMember.isWorldEdit() || SUPERVISOR.permissionPredicate.test(bauweltMember);
|
||||
return bauweltMember.isWorldEdit() || SUPERVISOR.permissionPredicate.test(bauweltMember);
|
||||
}),
|
||||
SPECTATOR(bauweltMember -> {
|
||||
return !BUILD.permissionPredicate.test(bauweltMember);
|
||||
|
@ -43,24 +43,27 @@ public class InfoCommand extends SWCommand {
|
||||
}
|
||||
}
|
||||
|
||||
if (Permission.BUILD.hasPermission(p)) {
|
||||
List<BauweltMember> members = BauweltMember.getMembers(bauServer.getOwnerID());
|
||||
StringBuilder membermessage = new StringBuilder();
|
||||
membermessage.append(BauSystem.MESSAGE.parsePrefixed("BAU_INFO_COMMAND_MEMBER", p, members.size()));
|
||||
|
||||
for (int i = 0; i < members.size(); i++) {
|
||||
if (i != 0) {
|
||||
membermessage.append(", ");
|
||||
membermessage.append("§8, ");
|
||||
}
|
||||
BauweltMember member = members.get(i);
|
||||
if (Permission.SUPERVISOR.hasPermission(member)) {
|
||||
membermessage.append("§c").append(SteamwarUser.get(member.getMemberID()).getUserName());
|
||||
membermessage.append("§e");
|
||||
} else if (Permission.BUILD.hasPermission(member)) {
|
||||
membermessage.append("§e").append(SteamwarUser.get(member.getMemberID()).getUserName());
|
||||
membermessage.append("§6");
|
||||
} else {
|
||||
membermessage.append("§7").append(SteamwarUser.get(member.getMemberID()).getUserName());
|
||||
membermessage.append("§7");
|
||||
}
|
||||
membermessage.append(SteamwarUser.get(member.getMemberID()).getUserName());
|
||||
}
|
||||
p.sendMessage(membermessage.toString());
|
||||
}
|
||||
|
||||
StringBuilder tpsMessage = new StringBuilder();
|
||||
tpsMessage.append(BauSystem.MESSAGE.parsePrefixed("BAU_INFO_COMMAND_TPS", p));
|
||||
|
@ -22,6 +22,7 @@ package de.steamwar.bausystem.features.world;
|
||||
import com.comphenix.tinyprotocol.Reflection;
|
||||
import com.comphenix.tinyprotocol.TinyProtocol;
|
||||
import de.steamwar.bausystem.BauSystem;
|
||||
import de.steamwar.bausystem.Permission;
|
||||
import de.steamwar.bausystem.utils.PlaceItemUtils;
|
||||
import de.steamwar.linkage.Linked;
|
||||
import de.steamwar.linkage.MinVersion;
|
||||
@ -81,6 +82,7 @@ public class SignEditFrom20 implements Listener {
|
||||
}
|
||||
|
||||
private void edit(Player player, Block block) {
|
||||
if (Permission.SPECTATOR.hasPermission(player)) return;
|
||||
Sign sign = (Sign) block.getState();
|
||||
Side side = signSide(player, block);
|
||||
SignSide signSide = sign.getSide(side);
|
||||
|
@ -22,6 +22,7 @@ package de.steamwar.bausystem.features.world;
|
||||
import com.comphenix.tinyprotocol.Reflection;
|
||||
import com.comphenix.tinyprotocol.TinyProtocol;
|
||||
import de.steamwar.bausystem.BauSystem;
|
||||
import de.steamwar.bausystem.Permission;
|
||||
import de.steamwar.linkage.Linked;
|
||||
import de.steamwar.linkage.MaxVersion;
|
||||
import org.bukkit.Bukkit;
|
||||
@ -68,6 +69,7 @@ public class SignEditUntil19 implements Listener {
|
||||
}
|
||||
|
||||
private void edit(Player player, Block block) {
|
||||
if (Permission.SPECTATOR.hasPermission(player)) return;
|
||||
Sign sign = (org.bukkit.block.Sign) block.getState();
|
||||
String[] lines = sign.getLines();
|
||||
for (int i = 0; i < lines.length; i++) {
|
||||
|
@ -27,10 +27,11 @@ import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.EventPriority;
|
||||
import org.bukkit.event.Listener;
|
||||
import org.bukkit.event.block.BlockBreakEvent;
|
||||
import org.bukkit.event.block.BlockCanBuildEvent;
|
||||
import org.bukkit.event.block.BlockMultiPlaceEvent;
|
||||
import org.bukkit.event.block.BlockPlaceEvent;
|
||||
import org.bukkit.event.block.*;
|
||||
import org.bukkit.event.entity.EntityChangeBlockEvent;
|
||||
import org.bukkit.event.entity.EntityEnterBlockEvent;
|
||||
import org.bukkit.event.entity.EntityInteractEvent;
|
||||
import org.bukkit.event.entity.EntityPickupItemEvent;
|
||||
import org.bukkit.event.inventory.InventoryClickEvent;
|
||||
import org.bukkit.event.player.*;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
@ -73,7 +74,7 @@ public class SpectatorListener implements Listener {
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.LOWEST, ignoreCancelled = true)
|
||||
@EventHandler
|
||||
public void onInventoryClick(InventoryClickEvent event) {
|
||||
ItemStack itemStack = event.getCurrentItem();
|
||||
if (itemStack == null || !itemStack.hasItemMeta()) {
|
||||
@ -161,4 +162,19 @@ public class SpectatorListener implements Listener {
|
||||
event.setCancelled(true);
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.LOWEST, ignoreCancelled = true)
|
||||
public void onPlayerDropItem(PlayerDropItemEvent event) {
|
||||
if (Permission.SPECTATOR.hasPermission(event.getPlayer())) {
|
||||
event.setCancelled(true);
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.LOWEST, ignoreCancelled = true)
|
||||
public void onEntityPickupItem(EntityPickupItemEvent event) {
|
||||
if (!(event.getEntity() instanceof Player)) return;
|
||||
if (Permission.SPECTATOR.hasPermission((Player) event.getEntity())) {
|
||||
event.setCancelled(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
In neuem Issue referenzieren
Einen Benutzer sperren