SteamWar/BauSystem2.0
Archiviert
12
0

Add dynamic spectator disable
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful

Dieser Commit ist enthalten in:
yoyosource 2023-12-23 14:18:32 +01:00
Ursprung 0ac735c30f
Commit 2a55f607d3
23 geänderte Dateien mit 118 neuen und 129 gelöschten Zeilen

Datei anzeigen

@ -804,8 +804,6 @@ REGION_REGION_HELP_RESTORE=§8/§eregion restore §8- §7Resets the region, with
REGION_REGION_HELP_RESTORE_SCHEMATIC=§8/§eregion restore §8[§7Schematic§8] §8- §7Resets the region, withoout removing your builds
REGION_REGION_HELP_COPYPOINT=§8/§eregion copypoint §8- §7Teleport to the regions copy point
REGION_REGION_HELP_TESTBLOCKPOINT=§8/§eregion testblockpoint §8- §7Teleport to the regions dummy point
REGION_REGION_HELP_CHANGETYPE_INFO=§8/§eregion changetype §8- §7Returns the region type
REGION_REGION_HELP_CHANGETYPE=§8/§eregion changetype §8[§7Type§8] §8- §8Sets the region type
REGION_REGION_HELP_CHANGESKIN_INFO=§8/§eregion changeskin §8- §7Returns the region skin
REGION_REGION_HELP_CHANGESKIN=§8/§eregion changeskin §8[§7Skin§8] §8- §8Sets the region skin
REGION_REGION_NOTHING_UNDO=§cNothing left to undo
@ -821,12 +819,6 @@ REGION_REGION_TP_COPY=§7Teleported to the copy point
REGION_REGION_TP_TEST_BLOCK=§7Teleported to the tesblock
REGION_REGION_TP_UNKNOWN=§cUndefined teleport point
REGION_REGION_NO_REGION=§cYou are not inside any region
REGION_REGION_CHANGETYPE_INFO=§7RRegion type is §e{0}
REGION_REGION_CHANGETYPE_UNKNOWN=§cRegion type is invalid
REGION_REGION_CHANGETYPE_INVALID=§cRegion type is not allowed here
REGION_REGION_CHANGETYPE_CHANGE=§7Region type changed to §e{0}
REGION_REGION_CHANGETYPE_CHANGE_UPDATE=§7Click §e§lHERE §7to change the region type
REGION_REGION_CHANGETYPE_CHANGE_UPDATE_HOVER=§8/§ereset
REGION_REGION_CHANGESKIN_INFO=§7Region skin is §e{0}
REGION_REGION_CHANGESKIN_INFO_CREATOR=§7Skin created by §e{0}
REGION_REGION_CHANGESKIN_UNKNOWN=§cRegion skin is invalid

Datei anzeigen

@ -767,8 +767,6 @@ REGION_REGION_HELP_RESTORE=§8/§eregion restore §8- §7Setzte die Region zurü
REGION_REGION_HELP_RESTORE_SCHEMATIC=§8/§eregion restore §8[§7Schematic§8] §8- §7Setzte die Region zurück, ohne das Gebaute zu löschen
REGION_REGION_HELP_COPYPOINT=§8/§eregion copypoint §8- §7Teleportiere dich zum Regions Kopierpunkt
REGION_REGION_HELP_TESTBLOCKPOINT=§8/§eregion testblockpoint §8- §7Teleportiere dich zum Regions Testblockpunkt
REGION_REGION_HELP_CHANGETYPE_INFO=§8/§eregion changetype §8- §7Gebe den Regions Type aus
REGION_REGION_HELP_CHANGETYPE=§8/§eregion changetype §8[§7Type§8] §8- §8Setzte den Regions Type
REGION_REGION_HELP_CHANGESKIN_INFO=§8/§eregion changeskin §8- §7Gebe den Regions Skin aus
REGION_REGION_HELP_CHANGESKIN=§8/§eregion changeskin §8[§7Skin§8] §8- §8Setzte den Regions Skin
REGION_REGION_NOTHING_UNDO=§cNichts zum rückgängig machen
@ -784,12 +782,6 @@ REGION_REGION_TP_COPY=§7Zum Kopierpunkt teleportiert
REGION_REGION_TP_TEST_BLOCK=§7Zum Testblock teleportiert
REGION_REGION_TP_UNKNOWN=§cNicht definierter Teleportierpunkt
REGION_REGION_NO_REGION=§cDu bist in keiner Region
REGION_REGION_CHANGETYPE_INFO=§7Regions Type ist §e{0}
REGION_REGION_CHANGETYPE_UNKNOWN=§cRegions Type ist nicht valide
REGION_REGION_CHANGETYPE_INVALID=§cRegions Type ist nicht erlaubt hier
REGION_REGION_CHANGETYPE_CHANGE=§7Regions Type ist auf §e{0}§7 geändert
REGION_REGION_CHANGETYPE_CHANGE_UPDATE=§7Klicke §e§lHIER §7um den Type anzuwenden
REGION_REGION_CHANGETYPE_CHANGE_UPDATE_HOVER=§8/§ereset
REGION_REGION_CHANGESKIN_INFO=§7Regions Skin ist §e{0}
REGION_REGION_CHANGESKIN_INFO_CREATOR=§7Skin erstellt von §e{0}
REGION_REGION_CHANGESKIN_UNKNOWN=§cRegions Skin ist nicht valide

Datei anzeigen

@ -44,7 +44,6 @@ public class DesignEndStone {
private REntityServer entityServer = new REntityServer();
private List<REntity> entities = new ArrayList<>();
private Set<Location> locations = new HashSet<>();
private List<Player> players = new ArrayList<>();
public DesignEndStone(Region region) {
this.minX = region.getMinPointBuild().getX();
@ -95,12 +94,10 @@ public class DesignEndStone {
}
public void toggle(Player player) {
if (players.contains(player)) {
players.remove(player);
if (entityServer.getPlayers().contains(player)) {
entityServer.removePlayer(player);
BauSystem.MESSAGE.sendPrefixless("DESIGN_ENDSTONE_DISABLE", player, ChatMessageType.ACTION_BAR);
} else {
players.add(player);
entityServer.addPlayer(player);
calc();
BauSystem.MESSAGE.sendPrefixless("DESIGN_ENDSTONE_ENABLE", player, ChatMessageType.ACTION_BAR);
@ -108,7 +105,7 @@ public class DesignEndStone {
}
public boolean removePlayer(Player player) {
players.remove(player);
return players.isEmpty();
entityServer.removePlayer(player);
return entityServer.getPlayers().isEmpty();
}
}

Datei anzeigen

@ -22,6 +22,7 @@ package de.steamwar.bausystem.features.design.endstone;
import de.steamwar.bausystem.BauSystem;
import de.steamwar.bausystem.region.Region;
import de.steamwar.bausystem.region.utils.RegionType;
import de.steamwar.bausystem.utils.BauMemberUpdateEvent;
import de.steamwar.command.SWCommand;
import de.steamwar.linkage.Linked;
import org.bukkit.Location;
@ -33,6 +34,7 @@ import org.bukkit.event.block.BlockPlaceEvent;
import org.bukkit.event.player.PlayerQuitEvent;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
@Linked
@ -56,14 +58,20 @@ public class DesignEndStoneCommand extends SWCommand implements Listener {
@EventHandler
public void onPlayerQuit(PlayerQuitEvent event) {
Region region = Region.getRegion(event.getPlayer().getLocation());
DesignEndStone designEndStone = designEndStoneMap.get(region);
if (designEndStone == null) {
return;
}
if (designEndStone.removePlayer(event.getPlayer())) {
designEndStoneMap.remove(region);
}
disableDesignEndStone(event.getPlayer());
}
@EventHandler
public void onBauMemberUpdate(BauMemberUpdateEvent event) {
event.getNewSpectator().forEach(this::disableDesignEndStone);
}
private void disableDesignEndStone(Player player) {
new HashSet<>(designEndStoneMap.entrySet()).forEach(regionDesignEndStoneEntry -> {
if (regionDesignEndStoneEntry.getValue().removePlayer(player)) {
designEndStoneMap.remove(regionDesignEndStoneEntry.getKey());
}
});
}
@EventHandler

Datei anzeigen

@ -92,8 +92,7 @@ public class DetonatorListener implements Listener {
@EventHandler(ignoreCancelled = true)
public void onPlayerMove(PlayerMoveEvent event) {
if(!Permission.BUILD.hasPermission(event.getPlayer())) return;
if (!Detonator.isDetonator(event.getPlayer().getInventory().getItemInMainHand())) {
if (!Permission.BUILD.hasPermission(event.getPlayer()) ||!Detonator.isDetonator(event.getPlayer().getInventory().getItemInMainHand())) {
if (Detonator.hasActiveDetonatorShow(event.getPlayer())) {
Detonator.hideDetonator(event.getPlayer());
}

Datei anzeigen

@ -21,6 +21,7 @@ package de.steamwar.bausystem.features.killchecker;
import de.steamwar.bausystem.BauSystem;
import de.steamwar.bausystem.region.Region;
import de.steamwar.bausystem.utils.BauMemberUpdateEvent;
import de.steamwar.bausystem.utils.bossbar.BossBarService;
import de.steamwar.command.SWCommand;
import de.steamwar.linkage.Linked;
@ -74,16 +75,22 @@ public class KillcheckerCommand extends SWCommand implements Listener {
BauSystem.MESSAGE.send("KILLCHECKER_DISABLE", player);
}
@EventHandler
public void onBauMemberUpdate(BauMemberUpdateEvent event) {
event.getNewSpectator().forEach(this::hide);
}
@EventHandler
public void onPlayerQuit(PlayerQuitEvent event) {
Player player = event.getPlayer();
Set<Region> regions = new HashSet<>();
visualizers.forEach((region, visualizer) -> {
if (visualizer.disconnect(player)) {
regions.add(region);
hide(event.getPlayer());
}
private void hide(Player player) {
new HashSet<>(visualizers.entrySet()).forEach(regionKillcheckerVisualizerEntry -> {
if (regionKillcheckerVisualizerEntry.getValue().hide(player)) {
visualizers.remove(regionKillcheckerVisualizerEntry.getKey());
}
});
regions.forEach(visualizers::remove);
}
private void recalc(Block block) {

Datei anzeigen

@ -57,9 +57,6 @@ public class KillcheckerVisualizer {
private final int zArea;
private final int xArea;
private final Set<Player> players = new HashSet<>();
private final Set<Player> areaPlayers = new HashSet<>();
private final Region region;
private final BossBarService bossBarService;
@ -261,7 +258,7 @@ public class KillcheckerVisualizer {
double zPercent = xCount / (double) zArea;
percent = (xPercent + yPercent + zPercent) / 3;
kills = zKills + yKills + xKills;
players.forEach(this::updateBossBar);
outline.getPlayers().forEach(this::updateBossBar);
Set<Point> pointSet = new HashSet<>(killCount.keySet());
Set<Point> outlinePointsCacheLast = new HashSet<>(outlinePointsCache);
@ -356,40 +353,21 @@ public class KillcheckerVisualizer {
return new Cuboid(minX, minY, minZ, maxX, maxY, maxZ);
}
public boolean show(Player player, boolean onlyOutline) {
public void show(Player player, boolean onlyOutline) {
outline.addPlayer(player);
if (!onlyOutline) {
inner.addPlayer(player);
areaPlayers.add(player);
} else if (areaPlayers.contains(player)) {
} else {
inner.removePlayer(player);
areaPlayers.remove(player);
}
updateBossBar(player);
return players.add(player);
}
public boolean hide(Player player) {
outline.removePlayer(player);
if (areaPlayers.contains(player)) {
inner.removePlayer(player);
}
players.remove(player);
areaPlayers.remove(player);
inner.removePlayer(player);
bossBarService.remove(player, region, "killchecker");
if (players.isEmpty()) {
outline.close();
inner.close();
return true;
}
return false;
}
public boolean disconnect(Player player) {
players.remove(player);
areaPlayers.remove(player);
bossBarService.remove(player, region, "killchecker");
if (players.isEmpty()) {
if (outline.getPlayers().isEmpty() && inner.getPlayers().isEmpty()) {
outline.close();
inner.close();
return true;

Datei anzeigen

@ -21,13 +21,16 @@ package de.steamwar.bausystem.features.loader;
import de.steamwar.bausystem.BauSystem;
import de.steamwar.bausystem.Permission;
import de.steamwar.bausystem.utils.BauMemberUpdateEvent;
import de.steamwar.command.SWCommand;
import de.steamwar.command.TypeValidator;
import de.steamwar.linkage.Linked;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
@Linked
public class LoaderCommand extends SWCommand {
public class LoaderCommand extends SWCommand implements Listener {
public LoaderCommand() {
super("loader");
@ -101,4 +104,13 @@ public class LoaderCommand extends SWCommand {
BauSystem.MESSAGE.send("LOADER_NEW_LOAD_TIME", p, delay);
loader.setTicksBetweenBlocks(delay);
}
@EventHandler
public void onBauMemberUpdate(BauMemberUpdateEvent event) {
event.getNewSpectator().forEach(player -> {
Loader loader = Loader.getLoader(player);
if (loader == null) return;
loader.stop();
});
}
}

Datei anzeigen

@ -47,7 +47,7 @@ public class ObserverTracerCommand extends SWCommand {
}
@Register(value = "delete", description = "OBSERVER_HELP_DELETE")
public void delete(Player p) {
public void delete(@Validator Player p) {
ObserverTracerListener.observerTracerMap.remove(p);
BauSystem.MESSAGE.send("OBSERVER_DELETE", p);
}

Datei anzeigen

@ -21,6 +21,7 @@ package de.steamwar.bausystem.features.observer;
import de.steamwar.bausystem.BauSystem;
import de.steamwar.bausystem.Permission;
import de.steamwar.bausystem.utils.BauMemberUpdateEvent;
import de.steamwar.linkage.Linked;
import org.bukkit.Bukkit;
import org.bukkit.GameMode;
@ -89,6 +90,11 @@ public class ObserverTracerListener implements Listener {
}
}
@EventHandler
public void onBauMemberUpdate(BauMemberUpdateEvent event) {
event.getNewSpectator().forEach(observerTracerMap::remove);
}
@EventHandler
public void onPlayerJoin(PlayerJoinEvent event) {
enabled.add(event.getPlayer());

Datei anzeigen

@ -164,36 +164,6 @@ public class RegionCommand extends SWCommand {
BauSystem.MESSAGE.send("REGION_REGION_TP_TEST_BLOCK", p);
}
@Register(value = "changetype", description = "REGION_REGION_HELP_CHANGETYPE_INFO")
@Register("type")
public void changeTypeCommand(Player p) {
Region region = Region.getRegion(p.getLocation());
if (checkGlobalRegion(region, p)) {
return;
}
BauSystem.MESSAGE.send("REGION_REGION_CHANGETYPE_INFO", p, region.getPrototype().getDisplayName());
}
@Register(value = "changetype", description = "REGION_REGION_HELP_CHANGETYPE")
@Register("type")
public void changeTypeCommand(@Validator Player p, @Mapper("regionTypeMapper") String s) {
Region region = Region.getRegion(p.getLocation());
if (checkGlobalRegion(region, p)) {
return;
}
Prototype prototype = Prototype.getByDisplayName(s);
if (prototype == null) {
BauSystem.MESSAGE.send("REGION_REGION_CHANGETYPE_UNKNOWN", p);
} else {
if (region.setPrototype(prototype)) {
BauSystem.MESSAGE.send("REGION_REGION_CHANGETYPE_CHANGE", p, s);
BauSystem.MESSAGE.send("REGION_REGION_CHANGETYPE_CHANGE_UPDATE", p, BauSystem.MESSAGE.parse("REGION_REGION_CHANGETYPE_CHANGE_UPDATE_HOVER", p), new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/reset"));
} else {
BauSystem.MESSAGE.send("REGION_REGION_CHANGETYPE_INVALID", p);
}
}
}
@Register(value = "changeskin", description = "REGION_REGION_HELP_CHANGESKIN_INFO")
@Register("skin")
public void changeSkinCommand(Player p) {
@ -227,26 +197,6 @@ public class RegionCommand extends SWCommand {
}
}
@Mapper(value = "regionTypeMapper", local = true)
private TypeMapper<String> regionTypeMapper() {
return new TypeMapper<String>() {
@Override
public List<String> tabCompletes(CommandSender commandSender, PreviousArguments previousArguments, String s) {
Player p = (Player) commandSender;
Region region = Region.getRegion(p.getLocation());
if (region.isGlobal()) {
return Collections.emptyList();
}
return region.getPrototypes().stream().map(Prototype::getByName).map(Prototype::getDisplayName).map(c -> c.replace(' ', '_')).collect(Collectors.toList());
}
@Override
public String map(CommandSender commandSender, PreviousArguments previousArguments, String s) {
return s.replace('_', ' ');
}
};
}
@Mapper(value = "skinTypeMapper", local = true)
private TypeMapper<String> skinTypeMapper() {
return new TypeMapper<String>() {

Datei anzeigen

@ -20,6 +20,7 @@
package de.steamwar.bausystem.features.script;
import de.steamwar.bausystem.Permission;
import de.steamwar.bausystem.utils.BauMemberUpdateEvent;
import de.steamwar.bausystem.utils.FlatteningWrapper;
import de.steamwar.linkage.Linked;
import org.bukkit.entity.Player;
@ -74,4 +75,10 @@ public class ScriptListener implements Listener {
if(!Permission.BUILD.hasPermission(event.getPlayer())) return;
ScriptRunner.updateGlobalScript(event.getPlayer());
}
@EventHandler
public void onBauMemberUpdate(BauMemberUpdateEvent event) {
event.getNewSpectator().forEach(ScriptRunner::remove);
event.getNewBuilder().forEach(ScriptRunner::updateGlobalScript);
}
}

Datei anzeigen

@ -22,6 +22,7 @@ package de.steamwar.bausystem.features.shieldprinting;
import de.steamwar.bausystem.BauSystem;
import de.steamwar.bausystem.features.shieldprinting.impl.*;
import de.steamwar.bausystem.region.Region;
import de.steamwar.bausystem.utils.BauMemberUpdateEvent;
import de.steamwar.bausystem.utils.bossbar.BauSystemBossbar;
import de.steamwar.bausystem.utils.bossbar.BossBarService;
import de.steamwar.inventory.SWItem;
@ -273,6 +274,12 @@ public class ShieldPrinting implements Listener {
updateBossbar(event.getPlayer());
}
@EventHandler
public void onBauMemberUpdate(BauMemberUpdateEvent event) {
event.getNewSpectator().forEach(player -> BossBarService.instance.remove(player, region, "shieldprinting"));
event.getNewBuilder().forEach(this::updateBossbar);
}
private void updateBossbars() {
for (Player player : Bukkit.getOnlinePlayers()) {
updateBossbar(player);

Datei anzeigen

@ -35,6 +35,7 @@ import de.steamwar.bausystem.features.simulator.execute.SimulatorExecutor;
import de.steamwar.bausystem.features.simulator.gui.SimulatorGroupGui;
import de.steamwar.bausystem.features.simulator.gui.SimulatorGui;
import de.steamwar.bausystem.features.simulator.gui.base.SimulatorBaseGui;
import de.steamwar.bausystem.utils.BauMemberUpdateEvent;
import de.steamwar.bausystem.utils.ItemUtils;
import de.steamwar.bausystem.utils.RayTraceUtils;
import de.steamwar.entity.REntity;
@ -95,6 +96,7 @@ public class SimulatorCursor implements Listener {
@EventHandler
public void onPlayerJoin(PlayerJoinEvent event) {
if (Permission.SPECTATOR.hasPermission(event.getPlayer())) return;
Bukkit.getScheduler().runTaskLater(BauSystem.getInstance(), () -> {
calcCursor(event.getPlayer());
}, 0);
@ -102,16 +104,23 @@ public class SimulatorCursor implements Listener {
@EventHandler
public void onPlayerDropItem(PlayerDropItemEvent event) {
if (Permission.SPECTATOR.hasPermission(event.getPlayer())) return;
calcCursor(event.getPlayer());
}
@EventHandler
public void onPlayerItemHeld(PlayerItemHeldEvent event) {
if (Permission.SPECTATOR.hasPermission(event.getPlayer())) return;
Bukkit.getScheduler().runTaskLater(BauSystem.getInstance(), () -> {
calcCursor(event.getPlayer());
}, 1);
}
@EventHandler
public void onBauMemberUpdate(BauMemberUpdateEvent event) {
event.getChanged().forEach(this::calcCursor);
}
@EventHandler
public void onPlayerQuit(PlayerQuitEvent event) {
cursorType.remove(event.getPlayer());
@ -143,13 +152,12 @@ public class SimulatorCursor implements Listener {
}
public synchronized void calcCursor(Player player) {
if (!isSimulatorItem(player.getInventory().getItemInMainHand()) && !isSimulatorItem(player.getInventory().getItemInOffHand())) {
if (Permission.SPECTATOR.hasPermission(player) || (!isSimulatorItem(player.getInventory().getItemInMainHand()) && !isSimulatorItem(player.getInventory().getItemInOffHand()))) {
if (removeCursor(player) || SimulatorWatcher.show(null, player)) {
SWUtils.sendToActionbar(player, "");
}
return;
}
if(!Permission.BUILD.hasPermission(player)) return;
Simulator simulator = SimulatorStorage.getSimulator(player);
SimulatorWatcher.show(simulator, player);
@ -316,6 +324,7 @@ public class SimulatorCursor implements Listener {
@EventHandler
public void onPlayerInteract(PlayerInteractEvent event) {
if (Permission.SPECTATOR.hasPermission(event.getPlayer())) return;
if (!ItemUtils.isItem(event.getItem(), "simulator")) {
return;
}

Datei anzeigen

@ -23,6 +23,7 @@ import de.steamwar.bausystem.BauSystem;
import de.steamwar.bausystem.features.tracer.TNTPosition;
import de.steamwar.bausystem.region.Region;
import de.steamwar.bausystem.shared.ShowMode;
import de.steamwar.bausystem.utils.BauMemberUpdateEvent;
import org.bukkit.Bukkit;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
@ -131,12 +132,21 @@ public class TraceShowManager implements Listener {
@EventHandler
public void onLeave(PlayerQuitEvent event) {
hideComplete(event.getPlayer());
}
@EventHandler
public void onBauMemberUpdate(BauMemberUpdateEvent event) {
event.getNewSpectator().forEach(this::hideComplete);
}
private void hideComplete(Player player) {
showModes.forEach((region, playerShowModeMap) -> {
ShowMode<TNTPosition> showMode = playerShowModeMap.remove(event.getPlayer());
ShowMode<TNTPosition> showMode = playerShowModeMap.remove(player);
if (showMode != null) showMode.hide();
});
showFilters.forEach((region, playerPredicateMap) -> {
playerPredicateMap.remove(event.getPlayer());
playerPredicateMap.remove(player);
});
}
}

Datei anzeigen

@ -24,6 +24,7 @@ import com.comphenix.tinyprotocol.TinyProtocol;
import com.mojang.authlib.GameProfile;
import de.steamwar.bausystem.BauSystem;
import de.steamwar.bausystem.features.tpslimit.TPSUtils;
import de.steamwar.bausystem.utils.BauMemberUpdateEvent;
import de.steamwar.bausystem.utils.NMSWrapper;
import de.steamwar.command.SWCommand;
import de.steamwar.core.ProtocolWrapper;
@ -97,7 +98,7 @@ public class NoClipCommand extends SWCommand implements Listener {
}
@Register(help = true)
public void genericCommand(Player player, String... args) {
public void genericCommand(@Validator Player player) {
if (NOCLIPS.contains(player)) {
NOCLIPS.remove(player);
player.setGameMode(GameMode.CREATIVE);
@ -116,6 +117,16 @@ public class NoClipCommand extends SWCommand implements Listener {
}
}
@EventHandler
public void onBauMemberUpdate(BauMemberUpdateEvent event) {
event.getNewSpectator().forEach(player -> {
if (NOCLIPS.contains(player)) {
NOCLIPS.remove(player);
player.setGameMode(GameMode.CREATIVE);
}
});
}
@EventHandler(ignoreCancelled = true)
public void onPlayerGameModeChange(PlayerGameModeChangeEvent event) {
if (NOCLIPS.contains(event.getPlayer())) {

Datei anzeigen

@ -20,6 +20,7 @@
package de.steamwar.bausystem.features.util;
import de.steamwar.bausystem.BauSystem;
import de.steamwar.bausystem.Permission;
import de.steamwar.entity.REntityServer;
import de.steamwar.entity.RFallingBlockEntity;
import de.steamwar.linkage.Linked;
@ -49,6 +50,7 @@ public class PistonCalculator implements Listener {
@EventHandler
public void onPlayerInteract(PlayerInteractEvent event) {
if (Permission.SPECTATOR.hasPermission(event.getPlayer())) return;
if (event.getAction() != Action.RIGHT_CLICK_BLOCK) return;
if (!event.hasItem() || event.getItem().getType() != Material.SLIME_BALL) return;
if (event.getClickedBlock() == null) return;

Datei anzeigen

@ -32,7 +32,7 @@ public class PistonCalculatorCommand extends SWCommand {
}
@Register
public void help(Player player) {
public void help(@Validator Player player) {
BauSystem.MESSAGE.send("PISTON_HELP_1", player);
BauSystem.MESSAGE.send("PISTON_HELP_2", player);
BauSystem.MESSAGE.send("PISTON_HELP_3", player);

Datei anzeigen

@ -41,7 +41,7 @@ public class SlotCommand extends SWCommand {
}
@Register
public void slotCommand(Player player, Integer slot) {
public void slotCommand(@Validator Player player, Integer slot) {
if (slot < 1 || slot > 9) {
BauSystem.MESSAGE.send("OTHER_SLOT_INVALID_SLOT", player);
return;
@ -50,7 +50,7 @@ public class SlotCommand extends SWCommand {
}
@Register(value = "pick", description = "OTHER_NOCLIP_SLOT_HELP_PICK")
public void eyedropBlock(Player player) {
public void eyedropBlock(@Validator Player player) {
Block block = player.getTargetBlockExact(6);
ItemStack itemStack;
if (block == null) {
@ -61,7 +61,7 @@ public class SlotCommand extends SWCommand {
}
@Register(value = "drop", description = "OTHER_NOCLIP_SLOT_HELP_DROP")
public void dropBlock(Player player) {
public void dropBlock(@Validator Player player) {
player.getInventory().setItemInMainHand(new ItemStack(Material.AIR));
}

Datei anzeigen

@ -35,8 +35,8 @@ public class TNTClickListener implements Listener {
@EventHandler
public void onPlayerInteractEntity(PlayerInteractEntityEvent event) {
if (Permission.SPECTATOR.hasPermission(event.getPlayer())) return;
if (event.getHand() != EquipmentSlot.HAND) return;
if (!Permission.BUILD.hasPermission(event.getPlayer()));
Entity entity = event.getRightClicked();
if (event.getRightClicked() instanceof TNTPrimed) {

Datei anzeigen

@ -81,6 +81,8 @@ public class BauMemberUpdate extends PacketHandler implements Listener {
if (Permission.SPECTATOR.hasPermission(event.getPlayer())) {
SPECTATORS.add(event.getPlayer());
event.getPlayer().addPotionEffect(new PotionEffect(PotionEffectType.GLOWING, -1, 1, false,false, false));
} else {
event.getPlayer().removePotionEffect(PotionEffectType.GLOWING);
}
}

Datei anzeigen

@ -42,7 +42,7 @@ public class ItemFrameListener implements Listener {
return;
}
if(!Permission.BUILD.hasPermission((Player) event.getDamager())) return;
if(Permission.SPECTATOR.hasPermission((Player) event.getDamager())) return;
event.setCancelled(true);
ItemFrame itemFrame = (ItemFrame) event.getEntity();

Datei anzeigen

@ -40,7 +40,7 @@ public class WorldEditListener implements Listener {
if (!isWorldEditCommand(e.getMessage().split(" ")[0])) return;
Player p = e.getPlayer();
if (!Permission.BUILD.hasPermission(e.getPlayer())) {
if (Permission.SPECTATOR.hasPermission(e.getPlayer())) {
BauSystem.MESSAGE.send("NO_PERMISSION", p);
e.setCancelled(true);
e.setMessage("/");