SteamWar/FightSystem
Archiviert
13
1

Merge pull request 'Limit block breaking to team area' (#311) from blockBreakLimiter into master
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful

Reviewed-on: #311
Reviewed-by: YoyoNow <jwsteam@nidido.de>
Dieser Commit ist enthalten in:
Lixfel 2021-12-23 12:13:58 +01:00
Commit 49c2793297

Datei anzeigen

@ -34,6 +34,7 @@ import org.bukkit.block.Block;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler; import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener; import org.bukkit.event.Listener;
import org.bukkit.event.block.BlockBreakEvent;
import org.bukkit.event.block.BlockPlaceEvent; import org.bukkit.event.block.BlockPlaceEvent;
import org.bukkit.event.player.PlayerMoveEvent; import org.bukkit.event.player.PlayerMoveEvent;
import org.bukkit.event.player.PlayerQuitEvent; import org.bukkit.event.player.PlayerQuitEvent;
@ -77,6 +78,16 @@ public class TeamArea implements Listener {
FightSystem.getMessage().sendPrefixless("NO_BLOCK_PLACE", player, ChatMessageType.ACTION_BAR); FightSystem.getMessage().sendPrefixless("NO_BLOCK_PLACE", player, ChatMessageType.ACTION_BAR);
} }
@EventHandler
public void blockBreak(BlockBreakEvent event) {
Block block = event.getBlock();
if(Config.BluePasteRegion.getMinY() <= block.getY())
return;
event.setCancelled(true);
FightSystem.getMessage().sendPrefixless("NO_BLOCK_BREAK", event.getPlayer(), ChatMessageType.ACTION_BAR);
}
private void checkInTeamRegion(PlayerMoveEvent event, FightTeam team, Player player, FightTeam playerTeam) { private void checkInTeamRegion(PlayerMoveEvent event, FightTeam team, Player player, FightTeam playerTeam) {
boolean spectator = player.getGameMode() == GameMode.SPECTATOR; boolean spectator = player.getGameMode() == GameMode.SPECTATOR;
if(!spectator && playerTeam != null && playerTeam.canPlayerEntern(player)) if(!spectator && playerTeam != null && playerTeam.canPlayerEntern(player))