Add lever toggleability in frozen region
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful
Signed-off-by: yoyosource <yoyosource@nidido.de>
Dieser Commit ist enthalten in:
Ursprung
2edc08943a
Commit
32ab629a81
@ -9,6 +9,8 @@ import de.steamwar.bausystem.region.flags.flagvalues.FreezeMode;
|
|||||||
import de.steamwar.core.Core;
|
import de.steamwar.core.Core;
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
|
import org.bukkit.block.Block;
|
||||||
|
import org.bukkit.block.data.type.Switch;
|
||||||
import org.bukkit.entity.EntityType;
|
import org.bukkit.entity.EntityType;
|
||||||
import org.bukkit.event.EventHandler;
|
import org.bukkit.event.EventHandler;
|
||||||
import org.bukkit.event.Listener;
|
import org.bukkit.event.Listener;
|
||||||
@ -16,6 +18,7 @@ import org.bukkit.event.block.*;
|
|||||||
import org.bukkit.event.entity.EntityChangeBlockEvent;
|
import org.bukkit.event.entity.EntityChangeBlockEvent;
|
||||||
import org.bukkit.event.entity.EntitySpawnEvent;
|
import org.bukkit.event.entity.EntitySpawnEvent;
|
||||||
import org.bukkit.event.inventory.InventoryMoveItemEvent;
|
import org.bukkit.event.inventory.InventoryMoveItemEvent;
|
||||||
|
import org.bukkit.event.player.PlayerInteractEvent;
|
||||||
|
|
||||||
@Linked(LinkageType.LISTENER)
|
@Linked(LinkageType.LISTENER)
|
||||||
public class FreezeListener implements Listener {
|
public class FreezeListener implements Listener {
|
||||||
@ -158,4 +161,17 @@ public class FreezeListener implements Listener {
|
|||||||
e.setCancelled(true);
|
e.setCancelled(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@EventHandler
|
||||||
|
public void onPlayerInteract(PlayerInteractEvent e) {
|
||||||
|
if (e.getAction() != Action.RIGHT_CLICK_BLOCK) return;
|
||||||
|
if (Region.getRegion(e.getClickedBlock().getLocation()).get(Flag.FREEZE) == FreezeMode.ACTIVE) {
|
||||||
|
Block block = e.getClickedBlock();
|
||||||
|
if (block.getType() == Material.LEVER) {
|
||||||
|
Switch data = ((Switch) block.getBlockData());
|
||||||
|
data.setPowered(!data.isPowered());
|
||||||
|
block.setBlockData(data, false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
In neuem Issue referenzieren
Einen Benutzer sperren