/* This file is a part of the SteamWar software. Copyright (C) 2020 SteamWar.de-Serverteam This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details. You should have received a copy of the GNU Affero General Public License along with this program. If not, see . */ package de.steamwar.bausystem.commands; import org.bukkit.event.EventHandler; import org.bukkit.event.block.*; import org.bukkit.event.inventory.InventoryMoveItemEvent; public class CommandFreeze extends ToggleCommand { public CommandFreeze(){ super(false); } public static ToggleCommand getInstance(){ return getInstance(CommandFreeze.class); } @Override String getNoPermMessage() { return "§cDu darfst diese Welt nicht einfrieren"; } @Override String getEnableMessage(){ return "§cWelt eingefroren"; } @Override String getDisableMessage(){ return "§aWelt aufgetaut"; } @EventHandler public void onPhysicsEvent(BlockPhysicsEvent e){ e.setCancelled(true); } @EventHandler public void onPistonExtend(BlockPistonExtendEvent e){ e.setCancelled(true); } @EventHandler public void onPistonRetract(BlockPistonRetractEvent e){ e.setCancelled(true); } @EventHandler public void onBlockGrow(BlockGrowEvent e){ e.setCancelled(true); } @EventHandler public void onRedstoneEvent(BlockRedstoneEvent e){ e.setNewCurrent(e.getOldCurrent()); } @EventHandler public void onBlockDispense(BlockDispenseEvent e){ e.setCancelled(true); } @EventHandler public void onInventoryMoveEvent(InventoryMoveItemEvent e){ e.setCancelled(true); } }