From 0691e44148de8d6a021c127724aa29cada53ac94 Mon Sep 17 00:00:00 2001 From: jojo Date: Wed, 13 Jan 2021 13:36:28 +0100 Subject: [PATCH] Add BlockBreakFix --- src/de/steamwar/misslewars/MissileWars.java | 1 + .../misslewars/listener/BreakListener.java | 41 +++++++++++++++++++ 2 files changed, 42 insertions(+) create mode 100644 src/de/steamwar/misslewars/listener/BreakListener.java diff --git a/src/de/steamwar/misslewars/MissileWars.java b/src/de/steamwar/misslewars/MissileWars.java index a4f67d2..535b6c9 100644 --- a/src/de/steamwar/misslewars/MissileWars.java +++ b/src/de/steamwar/misslewars/MissileWars.java @@ -53,6 +53,7 @@ public class MissileWars extends JavaPlugin { public void onEnable() { redTeam = new MWTeam(ChatColor.RED, Config.RedSpawn, "Rot", Config.RedPortalZ); blueTeam = new MWTeam(ChatColor.BLUE, Config.BlueSpawn, "Blau", Config.BluePortalZ); + new BreakListener(); new DeathListener(); new ItemListener(); new ArenaListener(); diff --git a/src/de/steamwar/misslewars/listener/BreakListener.java b/src/de/steamwar/misslewars/listener/BreakListener.java new file mode 100644 index 0000000..bbaf1a6 --- /dev/null +++ b/src/de/steamwar/misslewars/listener/BreakListener.java @@ -0,0 +1,41 @@ +/* + * + * 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.misslewars.listener; + +import de.steamwar.misslewars.FightState; +import org.bukkit.event.EventHandler; +import org.bukkit.event.block.BlockBreakEvent; + +import java.util.EnumSet; + +public class BreakListener extends BasicListener { + + public BreakListener() { + super(EnumSet.of(FightState.WAITING)); + } + + @EventHandler(ignoreCancelled = true) + public void onBlockBreak(BlockBreakEvent event) { + event.setCancelled(true); + } + +}