diff --git a/FightSystem_9/src/de/steamwar/fightsystem/utils/BountifulWrapper9.java b/FightSystem_9/src/de/steamwar/fightsystem/utils/BountifulWrapper9.java
index 20c7aa4..e625d1e 100644
--- a/FightSystem_9/src/de/steamwar/fightsystem/utils/BountifulWrapper9.java
+++ b/FightSystem_9/src/de/steamwar/fightsystem/utils/BountifulWrapper9.java
@@ -20,6 +20,7 @@
package de.steamwar.fightsystem.utils;
import com.comphenix.tinyprotocol.Reflection;
+import de.steamwar.fightsystem.fight.Fight;
import de.steamwar.fightsystem.fight.FightTeam;
import de.steamwar.fightsystem.listener.Recording;
import de.steamwar.fightsystem.record.GlobalRecorder;
@@ -76,7 +77,8 @@ public class BountifulWrapper9 implements BountifulWrapper.IBountifulWrapper {
return new Listener() {
@EventHandler
public void onArrowPickup(PlayerPickupArrowEvent e){
- e.setCancelled(true);
+ if(Fight.fighting(e.getPlayer()))
+ e.setCancelled(true);
}
};
}
@@ -86,7 +88,8 @@ public class BountifulWrapper9 implements BountifulWrapper.IBountifulWrapper {
return new Listener() {
@EventHandler
public void onSwapItems(PlayerSwapHandItemsEvent event) {
- event.setCancelled(true);
+ if(Fight.fighting(event.getPlayer()))
+ event.setCancelled(true);
}
};
}
diff --git a/FightSystem_Core/src/config.yml b/FightSystem_Core/src/config.yml
index 0df080e..f87f00c 100644
--- a/FightSystem_Core/src/config.yml
+++ b/FightSystem_Core/src/config.yml
@@ -43,6 +43,8 @@ Arena:
GroundWalkable: true # defaults to true if missing
# Disable snow and ice melting
DisableSnowMelt: false # defaults to false if missing
+ # Allow leaving the arena area as spectator
+ Leaveable: false # defaults to false if missing
Schematic:
# The size of the schematics
diff --git a/FightSystem_Core/src/de/steamwar/fightsystem/Config.java b/FightSystem_Core/src/de/steamwar/fightsystem/Config.java
index 1292a70..9e1dd53 100644
--- a/FightSystem_Core/src/de/steamwar/fightsystem/Config.java
+++ b/FightSystem_Core/src/de/steamwar/fightsystem/Config.java
@@ -70,6 +70,7 @@ public class Config {
public static final int WaterDepth;
public static final boolean GroundWalkable;
public static final boolean DisableSnowMelt;
+ public static final boolean ArenaLeaveable;
//schematic parameter
public static final boolean RanksEnabled;
@@ -166,6 +167,7 @@ public class Config {
PreperationArea = config.getInt("Arena.BorderFromSchematic", 12);
GroundWalkable = config.getBoolean("Arena.GroundWalkable", true);
DisableSnowMelt = config.getBoolean("Arena.DisableSnowMelt", false);
+ ArenaLeaveable = config.getBoolean("Arena.Leaveable", false);
int schemsizeX = config.getInt("Schematic.Size.x");
int schemsizeY = config.getInt("Schematic.Size.y");
diff --git a/FightSystem_Core/src/de/steamwar/fightsystem/fight/Fight.java b/FightSystem_Core/src/de/steamwar/fightsystem/fight/Fight.java
index 431cbc6..a62ea3f 100644
--- a/FightSystem_Core/src/de/steamwar/fightsystem/fight/Fight.java
+++ b/FightSystem_Core/src/de/steamwar/fightsystem/fight/Fight.java
@@ -75,6 +75,10 @@ public class Fight {
return null;
}
+ public static boolean fighting(Player player) {
+ return getPlayerTeam(player) != null;
+ }
+
public static FightTeam getRedTeam() {
return redTeam;
}
diff --git a/FightSystem_Core/src/de/steamwar/fightsystem/listener/ArenaBorder.java b/FightSystem_Core/src/de/steamwar/fightsystem/listener/ArenaBorder.java
index 0527c5e..600a798 100644
--- a/FightSystem_Core/src/de/steamwar/fightsystem/listener/ArenaBorder.java
+++ b/FightSystem_Core/src/de/steamwar/fightsystem/listener/ArenaBorder.java
@@ -43,6 +43,9 @@ public class ArenaBorder implements Listener {
@EventHandler
public void arenaBorder(PlayerMoveEvent event){
Player player = event.getPlayer();
+ if(Config.ArenaLeaveable && !Fight.fighting(player))
+ return;
+
Location to = event.getTo();
assert to != null;
diff --git a/FightSystem_Core/src/de/steamwar/fightsystem/listener/ArrowStopper.java b/FightSystem_Core/src/de/steamwar/fightsystem/listener/ArrowStopper.java
index 1e286e9..5e51e65 100644
--- a/FightSystem_Core/src/de/steamwar/fightsystem/listener/ArrowStopper.java
+++ b/FightSystem_Core/src/de/steamwar/fightsystem/listener/ArrowStopper.java
@@ -87,10 +87,11 @@ public class ArrowStopper {
}
private boolean invalidEntity(Arrow entity) {
+ Location location = entity.getLocation();
boolean teamFrom = entity.getVelocity().getZ() > 0;
- boolean overMid = entity.getLocation().getZ() > Config.SpecSpawn.getZ();
+ boolean overMid = location.getZ() > Config.SpecSpawn.getZ();
boolean otherSide = teamFrom == overMid;
- return otherSide ||
+ return otherSide || !Config.ArenaRegion.inRegion(location) ||
WorldOfColorWrapper.impl.isInBlock(entity) ||
entity.getVelocity().equals(NULL_VECTOR);
}
diff --git a/FightSystem_Core/src/de/steamwar/fightsystem/listener/BasicListener.java b/FightSystem_Core/src/de/steamwar/fightsystem/listener/BasicListener.java
deleted file mode 100644
index 0a32205..0000000
--- a/FightSystem_Core/src/de/steamwar/fightsystem/listener/BasicListener.java
+++ /dev/null
@@ -1,31 +0,0 @@
-/*
- 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.fightsystem.listener;
-
-import de.steamwar.fightsystem.fight.Fight;
-import org.bukkit.entity.Player;
-
-public class BasicListener {
- private BasicListener(){}
-
- public static boolean notFighting(Player p){
- return Fight.getFightPlayer(p) == null;
- }
-}
diff --git a/FightSystem_Core/src/de/steamwar/fightsystem/listener/BlockFadeListener.java b/FightSystem_Core/src/de/steamwar/fightsystem/listener/BlockFadeListener.java
index 5edd1c2..51b5b94 100644
--- a/FightSystem_Core/src/de/steamwar/fightsystem/listener/BlockFadeListener.java
+++ b/FightSystem_Core/src/de/steamwar/fightsystem/listener/BlockFadeListener.java
@@ -1,6 +1,5 @@
package de.steamwar.fightsystem.listener;
-import de.steamwar.fightsystem.ArenaMode;
import de.steamwar.fightsystem.Config;
import de.steamwar.fightsystem.states.FightState;
import de.steamwar.fightsystem.states.StateDependentListener;
@@ -17,7 +16,7 @@ public class BlockFadeListener implements Listener {
@EventHandler
public void onBlockFade(BlockFadeEvent event) {
- if (event.getBlock().getType() == Material.SNOW_BLOCK || event.getBlock().getType() == Material.SNOW || event.getBlock().getType() == Material.ICE) {
+ if (Config.ArenaRegion.inRegion(event.getBlock()) && (event.getBlock().getType() == Material.SNOW_BLOCK || event.getBlock().getType() == Material.SNOW || event.getBlock().getType() == Material.ICE)) {
event.setCancelled(true);
}
}
diff --git a/FightSystem_Core/src/de/steamwar/fightsystem/listener/DenyWorldInteraction.java b/FightSystem_Core/src/de/steamwar/fightsystem/listener/DenyWorldInteraction.java
index efc6cd8..8371567 100644
--- a/FightSystem_Core/src/de/steamwar/fightsystem/listener/DenyWorldInteraction.java
+++ b/FightSystem_Core/src/de/steamwar/fightsystem/listener/DenyWorldInteraction.java
@@ -20,7 +20,9 @@
package de.steamwar.fightsystem.listener;
import de.steamwar.fightsystem.ArenaMode;
+import de.steamwar.fightsystem.Config;
import de.steamwar.fightsystem.FightSystem;
+import de.steamwar.fightsystem.fight.Fight;
import de.steamwar.fightsystem.states.FightState;
import de.steamwar.fightsystem.states.StateDependentListener;
import net.md_5.bungee.api.ChatMessageType;
@@ -43,20 +45,25 @@ public class DenyWorldInteraction implements Listener {
@EventHandler
public void handleBlockBreak(BlockBreakEvent event) {
Player player = event.getPlayer();
- event.setCancelled(true);
- FightSystem.getMessage().sendPrefixless("NO_BLOCK_BREAK", player, ChatMessageType.ACTION_BAR);
+ if(Fight.fighting(player)) {
+ event.setCancelled(true);
+ FightSystem.getMessage().sendPrefixless("NO_BLOCK_BREAK", player, ChatMessageType.ACTION_BAR);
+ }
}
@EventHandler
public void handleBlockPlace(BlockPlaceEvent event) {
Player player = event.getPlayer();
- event.setCancelled(true);
- FightSystem.getMessage().sendPrefixless("NO_BLOCK_PLACE", player, ChatMessageType.ACTION_BAR);
+ if(Fight.fighting(player)) {
+ event.setCancelled(true);
+ FightSystem.getMessage().sendPrefixless("NO_BLOCK_PLACE", player, ChatMessageType.ACTION_BAR);
+ }
}
@EventHandler
public void handleEntityExplode(EntityExplodeEvent event) {
- event.setCancelled(true);
+ if(Config.ArenaRegion.inRegion(event.getLocation()))
+ event.setCancelled(true);
}
@EventHandler
@@ -67,10 +74,12 @@ public class DenyWorldInteraction implements Listener {
@EventHandler
public void handleProjectileLaunch(ProjectileLaunchEvent event) {
- event.setCancelled(true);
- if(event.getEntity().getShooter() instanceof Player){
+ if(event.getEntity().getShooter() instanceof Player) {
Player player = (Player) event.getEntity().getShooter();
- FightSystem.getMessage().sendPrefixless("NO_BOW_USAGE", player, ChatMessageType.ACTION_BAR);
+ if(Fight.fighting(player)) {
+ event.setCancelled(true);
+ FightSystem.getMessage().sendPrefixless("NO_BOW_USAGE", player, ChatMessageType.ACTION_BAR);
+ }
}
}
}
diff --git a/FightSystem_Core/src/de/steamwar/fightsystem/listener/EntityDamage.java b/FightSystem_Core/src/de/steamwar/fightsystem/listener/EntityDamage.java
index fb9ae04..7644eb6 100644
--- a/FightSystem_Core/src/de/steamwar/fightsystem/listener/EntityDamage.java
+++ b/FightSystem_Core/src/de/steamwar/fightsystem/listener/EntityDamage.java
@@ -20,6 +20,7 @@
package de.steamwar.fightsystem.listener;
import de.steamwar.fightsystem.ArenaMode;
+import de.steamwar.fightsystem.Config;
import de.steamwar.fightsystem.states.FightState;
import de.steamwar.fightsystem.states.StateDependentListener;
import org.bukkit.event.EventHandler;
@@ -35,11 +36,13 @@ public class EntityDamage implements Listener {
@EventHandler
public void handleEntityDamage(EntityDamageEvent event) {
- event.setCancelled(true);
+ if(Config.ArenaRegion.inRegion(event.getEntity().getLocation()))
+ event.setCancelled(true);
}
@EventHandler
public void handleEntityDamageByEntity(EntityDamageByEntityEvent event) {
- event.setCancelled(true);
+ if(Config.ArenaRegion.inRegion(event.getEntity().getLocation()))
+ event.setCancelled(true);
}
}
diff --git a/FightSystem_Core/src/de/steamwar/fightsystem/listener/InFightDamage.java b/FightSystem_Core/src/de/steamwar/fightsystem/listener/InFightDamage.java
index 921a2a8..09ec33a 100644
--- a/FightSystem_Core/src/de/steamwar/fightsystem/listener/InFightDamage.java
+++ b/FightSystem_Core/src/de/steamwar/fightsystem/listener/InFightDamage.java
@@ -30,7 +30,6 @@ import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.entity.EntityDamageByEntityEvent;
-import org.bukkit.event.entity.EntityDamageEvent;
import java.util.Objects;
@@ -40,15 +39,6 @@ public class InFightDamage implements Listener {
new StateDependentListener(ArenaMode.AntiReplay, FightState.Running, this);
}
- @EventHandler
- public void handleEntityDamage(EntityDamageEvent event) {
- if(!(event.getEntity() instanceof Player))
- return;
-
- if(BasicListener.notFighting((Player)event.getEntity()))
- event.setCancelled(true);
- }
-
@EventHandler
public void handleEntityDamageByEntity(EntityDamageByEntityEvent event) {
if(!(event.getEntity() instanceof Player))
@@ -56,6 +46,9 @@ public class InFightDamage implements Listener {
return;
Player player = ((Player) event.getEntity());
+ if(!Fight.fighting(player))
+ return;
+
Player damager;
if(event.getDamager() instanceof Player) {
@@ -72,7 +65,7 @@ public class InFightDamage implements Listener {
return;
}
- if(BasicListener.notFighting(damager)){
+ if(!Fight.fighting(damager)){
event.setCancelled(true);
//Damager is not fighting
return;
diff --git a/FightSystem_Core/src/de/steamwar/fightsystem/listener/InFightInventory.java b/FightSystem_Core/src/de/steamwar/fightsystem/listener/InFightInventory.java
index eb0534a..85eb983 100644
--- a/FightSystem_Core/src/de/steamwar/fightsystem/listener/InFightInventory.java
+++ b/FightSystem_Core/src/de/steamwar/fightsystem/listener/InFightInventory.java
@@ -20,9 +20,12 @@
package de.steamwar.fightsystem.listener;
import de.steamwar.fightsystem.ArenaMode;
+import de.steamwar.fightsystem.Config;
+import de.steamwar.fightsystem.fight.Fight;
import de.steamwar.fightsystem.states.FightState;
import de.steamwar.fightsystem.states.StateDependentListener;
import org.bukkit.Material;
+import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.block.BlockDispenseEvent;
@@ -44,6 +47,9 @@ public class InFightInventory implements Listener {
@EventHandler
public void onInventoryClick(InventoryClickEvent event) {
+ if(!Fight.fighting((Player) event.getWhoClicked()))
+ return;
+
InventoryType top = event.getView().getTopInventory().getType();
if(top == InventoryType.CRAFTING)
return;
@@ -54,6 +60,9 @@ public class InFightInventory implements Listener {
@EventHandler
public void onInventoryDrag(InventoryDragEvent event) {
+ if(!Fight.fighting((Player) event.getWhoClicked()))
+ return;
+
if (event.getInventory().getType() != InventoryType.PLAYER) {
int inventorySize = event.getInventory().getSize();
@@ -68,7 +77,7 @@ public class InFightInventory implements Listener {
@EventHandler
public void onBlockDispense(BlockDispenseEvent e) {
- if(e.getItem().getType() == Material.TNT)
+ if(Config.ArenaRegion.inRegion(e.getBlock()) && e.getItem().getType() == Material.TNT)
e.setCancelled(true);
}
}
diff --git a/FightSystem_Core/src/de/steamwar/fightsystem/listener/LeaveableArena.java b/FightSystem_Core/src/de/steamwar/fightsystem/listener/LeaveableArena.java
new file mode 100644
index 0000000..7ff9884
--- /dev/null
+++ b/FightSystem_Core/src/de/steamwar/fightsystem/listener/LeaveableArena.java
@@ -0,0 +1,87 @@
+/*
+ This file is a part of the SteamWar software.
+
+ Copyright (C) 2022 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.fightsystem.listener;
+
+import de.steamwar.fightsystem.Config;
+import de.steamwar.fightsystem.fight.Fight;
+import de.steamwar.fightsystem.states.FightState;
+import de.steamwar.fightsystem.states.StateDependentListener;
+import org.bukkit.GameMode;
+import org.bukkit.entity.Player;
+import org.bukkit.event.EventHandler;
+import org.bukkit.event.EventPriority;
+import org.bukkit.event.Listener;
+import org.bukkit.event.player.PlayerMoveEvent;
+import org.bukkit.event.player.PlayerRespawnEvent;
+import org.spigotmc.event.player.PlayerSpawnLocationEvent;
+
+import java.util.HashMap;
+import java.util.Map;
+
+public class LeaveableArena implements Listener {
+
+ private final Map spectatorsInArena = new HashMap<>();
+
+ public LeaveableArena() {
+ new StateDependentListener(Config.ArenaLeaveable, FightState.All, this);
+ }
+
+ @EventHandler(priority = EventPriority.MONITOR)
+ public void onJoin(PlayerSpawnLocationEvent event) {
+ Player player = event.getPlayer();
+ if(Fight.fighting(player))
+ return;
+
+ if(Config.ArenaRegion.inRegion(event.getSpawnLocation())) {
+ markInArena(player);
+ }
+ }
+
+ @EventHandler(priority = EventPriority.MONITOR)
+ public void onRespawn(PlayerRespawnEvent event) {
+ Player player = event.getPlayer();
+ if(Config.ArenaRegion.inRegion(event.getRespawnLocation())) {
+ markInArena(player);
+ } else {
+ spectatorsInArena.remove(player);
+ }
+ }
+
+ @EventHandler
+ public void arenaBorder(PlayerMoveEvent event){
+ Player player = event.getPlayer();
+ if(Fight.fighting(player))
+ return;
+
+ boolean inArena = Config.ArenaRegion.inRegion(event.getTo());
+ boolean spectator = spectatorsInArena.containsKey(player);
+
+ if(inArena && !spectator) {
+ markInArena(player);
+ } else if(!inArena && spectator) {
+ player.setGameMode(spectatorsInArena.remove(player));
+ }
+ }
+
+ private void markInArena(Player player) {
+ spectatorsInArena.put(player, player.getGameMode());
+ Fight.setPlayerGamemode(player, GameMode.SPECTATOR);
+ }
+}
diff --git a/FightSystem_Core/src/de/steamwar/fightsystem/listener/Permanent.java b/FightSystem_Core/src/de/steamwar/fightsystem/listener/Permanent.java
index c411722..bb6e72d 100644
--- a/FightSystem_Core/src/de/steamwar/fightsystem/listener/Permanent.java
+++ b/FightSystem_Core/src/de/steamwar/fightsystem/listener/Permanent.java
@@ -52,10 +52,12 @@ public class Permanent implements Listener {
@EventHandler
public void handlePlayerRespawn(PlayerRespawnEvent event){
Player player = event.getPlayer();
- Fight.setPlayerGamemode(player, GameMode.SPECTATOR);
+ if(Fight.fighting(player)) {
+ Fight.setPlayerGamemode(player, GameMode.SPECTATOR);
- FightTeam team = Fight.getPlayerTeam(player);
- event.setRespawnLocation(team == null ? Config.SpecSpawn : team.getSpawn());
+ FightTeam team = Fight.getPlayerTeam(player);
+ event.setRespawnLocation(team == null ? Config.SpecSpawn : team.getSpawn());
+ }
}
@EventHandler
@@ -72,9 +74,8 @@ public class Permanent implements Listener {
event.setJoinMessage(null);
Player player = event.getPlayer();
- FightTeam fightTeam = Fight.getPlayerTeam(player);
- if (fightTeam == null) {
+ if (!Config.ArenaLeaveable && !Fight.fighting(player)) {
Fight.setPlayerGamemode(player, GameMode.SPECTATOR);
player.teleport(Config.SpecSpawn);
}
@@ -84,56 +85,66 @@ public class Permanent implements Listener {
@EventHandler(priority = EventPriority.MONITOR)
public void handlePlayerDeath(PlayerDeathEvent event) {
- event.setDeathMessage(null);
+ if(Fight.fighting(event.getEntity()))
+ event.setDeathMessage(null);
}
@EventHandler(priority = EventPriority.MONITOR)
public void handlePlayerLeave(PlayerQuitEvent event) {
- event.setQuitMessage(null);
+ if(Fight.fighting(event.getPlayer()))
+ event.setQuitMessage(null);
}
@EventHandler
public void handleFoodLevelChange(FoodLevelChangeEvent event) {
- event.setCancelled(true);
+ if(Fight.fighting((Player) event.getEntity()))
+ event.setCancelled(true);
}
@EventHandler
- public void onWeatherChange(WeatherChangeEvent event){
+ public void onWeatherChange(WeatherChangeEvent event) {
event.setCancelled(true);
}
@EventHandler
public void onSpawnerSpawn(SpawnerSpawnEvent e){
- e.setCancelled(true);
+ if(Config.ArenaRegion.inRegion(e.getSpawner().getBlock()))
+ e.setCancelled(true);
}
@EventHandler
public void onSleep(PlayerBedEnterEvent e) {
- e.setCancelled(true);
+ if(Fight.fighting(e.getPlayer()))
+ e.setCancelled(true);
}
@EventHandler
public void onCrafting(CraftItemEvent e){
- e.setCancelled(true);
+ if(Fight.fighting((Player) e.getWhoClicked()))
+ e.setCancelled(true);
}
@EventHandler
public void onFurnace(FurnaceSmeltEvent e){
- e.setCancelled(true);
+ if(Config.ArenaRegion.inRegion(e.getBlock()))
+ e.setCancelled(true);
}
@EventHandler
public void onDropPickup(InventoryPickupItemEvent e){
- e.setCancelled(true);
+ if(Config.ArenaRegion.inRegion(e.getItem().getLocation()))
+ e.setCancelled(true);
}
@EventHandler
public void onDropping(PlayerDropItemEvent e){
- e.setCancelled(true);
+ if(Fight.fighting(e.getPlayer()))
+ e.setCancelled(true);
}
@EventHandler
public void onWorldLoad(WorldLoadEvent e) {
- e.getWorld().setAutoSave(false);
+ if(!Config.ArenaLeaveable)
+ e.getWorld().setAutoSave(false);
}
}
diff --git a/FightSystem_Core/src/de/steamwar/fightsystem/listener/PistonListener.java b/FightSystem_Core/src/de/steamwar/fightsystem/listener/PistonListener.java
index 1587f24..43848ba 100644
--- a/FightSystem_Core/src/de/steamwar/fightsystem/listener/PistonListener.java
+++ b/FightSystem_Core/src/de/steamwar/fightsystem/listener/PistonListener.java
@@ -43,6 +43,9 @@ public class PistonListener implements Listener {
@EventHandler
public void handlePistonExtend(BlockPistonExtendEvent e){
+ if(!Config.ArenaRegion.inRegion(e.getBlock()))
+ return;
+
BlockFace face = e.getDirection();
for(Block block : e.getBlocks()){
Block target = block.getRelative(face);
@@ -55,6 +58,9 @@ public class PistonListener implements Listener {
@EventHandler
public void handlePistonRetract(BlockPistonRetractEvent e){
+ if(!Config.ArenaRegion.inRegion(e.getBlock()))
+ return;
+
for(Block block : e.getBlocks()){
if(!Config.BlueExtendRegion.inRegion(block) && !Config.RedExtendRegion.inRegion(block)) {
e.setCancelled(true);
diff --git a/FightSystem_Core/src/de/steamwar/fightsystem/listener/Recording.java b/FightSystem_Core/src/de/steamwar/fightsystem/listener/Recording.java
index 6d961a4..04d697a 100644
--- a/FightSystem_Core/src/de/steamwar/fightsystem/listener/Recording.java
+++ b/FightSystem_Core/src/de/steamwar/fightsystem/listener/Recording.java
@@ -120,7 +120,7 @@ public class Recording implements Listener {
private static final Reflection.FieldAccessor> blockDigType = Reflection.getField(blockDigPacket, playerDigType, 0);
private static final Object releaseUseItem = playerDigType.getEnumConstants()[5];
private Object blockDig(Player p, Object packet) {
- if(blockDigType.get(packet) == releaseUseItem)
+ if(!isNotSent(p) && blockDigType.get(packet) == releaseUseItem)
GlobalRecorder.getInstance().bowSpan(p, false, false);
return packet;
}
@@ -128,7 +128,7 @@ public class Recording implements Listener {
public static final Class> blockPlacePacket = Reflection.getClass("{nms.network.protocol.game}.PacketPlayInBlockPlace");
private Object blockPlace(Player p, Object packet) {
boolean mainHand = BountifulWrapper.impl.mainHand(packet);
- if(BountifulWrapper.impl.bowInHand(mainHand, p))
+ if(!isNotSent(p) && BountifulWrapper.impl.bowInHand(mainHand, p))
GlobalRecorder.getInstance().bowSpan(p, true, !mainHand);
return packet;
}
@@ -143,6 +143,9 @@ public class Recording implements Listener {
@EventHandler
public void onPlayerDeath(PlayerDeathEvent e) {
+ if(isNotSent(e.getEntity()))
+ return;
+
GlobalRecorder.getInstance().entityDespawns(e.getEntity());
}
@@ -157,7 +160,7 @@ public class Recording implements Listener {
@EventHandler(priority = EventPriority.HIGH, ignoreCancelled = true)
public void onBlockPhysics(BlockPhysicsEvent e){
if(FlatteningWrapper.impl.doRecord(e))
- GlobalRecorder.getInstance().blockChange(e.getBlock());
+ GlobalRecorder.getInstance().blockChange(e.getBlock()); //TODO ?
}
@EventHandler(priority = EventPriority.HIGH, ignoreCancelled = true)
diff --git a/FightSystem_Core/src/de/steamwar/fightsystem/listener/RunningWorldInteraction.java b/FightSystem_Core/src/de/steamwar/fightsystem/listener/RunningWorldInteraction.java
index 828fb31..a2a9067 100644
--- a/FightSystem_Core/src/de/steamwar/fightsystem/listener/RunningWorldInteraction.java
+++ b/FightSystem_Core/src/de/steamwar/fightsystem/listener/RunningWorldInteraction.java
@@ -43,6 +43,9 @@ public class RunningWorldInteraction implements Listener {
@EventHandler
public void onBlockBreak(BlockBreakEvent event) {
+ if(!Fight.fighting(event.getPlayer()))
+ return;
+
Inventory inventory = event.getPlayer().getInventory();
ItemStack stack = FlatteningWrapper.impl.onBreak(event.getBlock());
diff --git a/FightSystem_Core/src/de/steamwar/fightsystem/listener/Shutdown.java b/FightSystem_Core/src/de/steamwar/fightsystem/listener/Shutdown.java
index a13be40..82057e9 100644
--- a/FightSystem_Core/src/de/steamwar/fightsystem/listener/Shutdown.java
+++ b/FightSystem_Core/src/de/steamwar/fightsystem/listener/Shutdown.java
@@ -36,7 +36,7 @@ public class Shutdown implements Listener {
@EventHandler
public void handlePlayerQuit(PlayerQuitEvent event) {
- if(Config.replayserver())
+ if(Config.replayserver() || Config.ArenaLeaveable)
return;
//Shutdown server if nobody online