Dieser Commit ist enthalten in:
Commit
34ff467261
@ -43,6 +43,7 @@ public enum ArenaMode {
|
|||||||
public static final Set<ArenaMode> AntiReplay = Collections.unmodifiableSet(EnumSet.complementOf(EnumSet.of(REPLAY)));
|
public static final Set<ArenaMode> AntiReplay = Collections.unmodifiableSet(EnumSet.complementOf(EnumSet.of(REPLAY)));
|
||||||
public static final Set<ArenaMode> AntiTest = Collections.unmodifiableSet(EnumSet.complementOf(EnumSet.of(TEST, CHECK)));
|
public static final Set<ArenaMode> AntiTest = Collections.unmodifiableSet(EnumSet.complementOf(EnumSet.of(TEST, CHECK)));
|
||||||
public static final Set<ArenaMode> AntiEvent = Collections.unmodifiableSet(EnumSet.complementOf(EnumSet.of(EVENT)));
|
public static final Set<ArenaMode> AntiEvent = Collections.unmodifiableSet(EnumSet.complementOf(EnumSet.of(EVENT)));
|
||||||
|
public static final Set<ArenaMode> AntiTestCheckPrepare = Collections.unmodifiableSet(EnumSet.complementOf(EnumSet.of(TEST, CHECK, PREPARE)));
|
||||||
public static final Set<ArenaMode> AntiPrepare = Collections.unmodifiableSet(EnumSet.complementOf(EnumSet.of(PREPARE)));
|
public static final Set<ArenaMode> AntiPrepare = Collections.unmodifiableSet(EnumSet.complementOf(EnumSet.of(PREPARE)));
|
||||||
public static final Set<ArenaMode> VariableTeams = Collections.unmodifiableSet(EnumSet.complementOf(EnumSet.of(EVENT, REPLAY)));
|
public static final Set<ArenaMode> VariableTeams = Collections.unmodifiableSet(EnumSet.complementOf(EnumSet.of(EVENT, REPLAY)));
|
||||||
public static final Set<ArenaMode> RankedEvent = Collections.unmodifiableSet(EnumSet.of(EVENT, REPLAY));
|
public static final Set<ArenaMode> RankedEvent = Collections.unmodifiableSet(EnumSet.of(EVENT, REPLAY));
|
||||||
|
@ -61,6 +61,7 @@ public class Config {
|
|||||||
public static final Region BlueExtendRegion;
|
public static final Region BlueExtendRegion;
|
||||||
public static final Region RedExtendRegion;
|
public static final Region RedExtendRegion;
|
||||||
public static final Region ArenaRegion;
|
public static final Region ArenaRegion;
|
||||||
|
public static final Region PlayerRegion;
|
||||||
|
|
||||||
public static final Location TeamBlueSpawn;
|
public static final Location TeamBlueSpawn;
|
||||||
public static final Location TeamRedSpawn;
|
public static final Location TeamRedSpawn;
|
||||||
@ -300,14 +301,13 @@ public class Config {
|
|||||||
RedRotate = teamRedRotate;
|
RedRotate = teamRedRotate;
|
||||||
BlueRotate = teamBlueRotate;
|
BlueRotate = teamBlueRotate;
|
||||||
|
|
||||||
int arenaYSize = blueCornerY - underBorder + schemsizeY + PreperationArea;
|
|
||||||
|
|
||||||
RedPasteRegion = new Region(teamRedCornerX, teamRedCornerY, teamRedCornerZ, schemsizeX, schemsizeY, schemsizeZ);
|
RedPasteRegion = new Region(teamRedCornerX, teamRedCornerY, teamRedCornerZ, schemsizeX, schemsizeY, schemsizeZ);
|
||||||
BluePasteRegion = new Region(blueCornerX, blueCornerY, blueCornerZ, schemsizeX, schemsizeY, schemsizeZ);
|
BluePasteRegion = new Region(blueCornerX, blueCornerY, blueCornerZ, schemsizeX, schemsizeY, schemsizeZ);
|
||||||
|
|
||||||
RedExtendRegion = new Region(teamRedCornerX, underBorder, teamRedCornerZ, schemsizeX, arenaYSize, schemsizeZ, PreperationArea, PreperationArea);
|
RedExtendRegion = new Region(teamRedCornerX, teamRedCornerY, teamRedCornerZ, schemsizeX, schemsizeY, schemsizeZ, PreperationArea, PreperationArea, PreperationArea);
|
||||||
BlueExtendRegion = new Region(blueCornerX, underBorder, blueCornerZ, schemsizeX, arenaYSize, schemsizeZ, PreperationArea, PreperationArea);
|
BlueExtendRegion = new Region(blueCornerX, blueCornerY, blueCornerZ, schemsizeX, schemsizeY, schemsizeZ, PreperationArea, PreperationArea, PreperationArea);
|
||||||
ArenaRegion = new Region(arenaMinX, underBorder, arenaMinZ, arenaMaxX - arenaMinX, arenaYSize, arenaMaxZ - arenaMinZ);
|
ArenaRegion = new Region(arenaMinX, blueCornerY, arenaMinZ, arenaMaxX - arenaMinX, schemsizeY, arenaMaxZ - arenaMinZ, 0, PreperationArea, 0);
|
||||||
|
PlayerRegion = new Region(arenaMinX, underBorder, arenaMinZ, arenaMaxX - arenaMinX, world.getMaxHeight() - underBorder, arenaMaxZ - arenaMinZ);
|
||||||
|
|
||||||
EventKampfID = Integer.parseInt(System.getProperty("fightID", "0"));
|
EventKampfID = Integer.parseInt(System.getProperty("fightID", "0"));
|
||||||
if(EventKampfID >= 1){
|
if(EventKampfID >= 1){
|
||||||
|
@ -67,7 +67,12 @@ public class FightSystem extends JavaPlugin {
|
|||||||
new EntityDamage();
|
new EntityDamage();
|
||||||
new WaterRemover();
|
new WaterRemover();
|
||||||
new Permanent();
|
new Permanent();
|
||||||
new PistonListener();
|
new PistonListener(ArenaMode.AntiTestCheckPrepare, e -> e.setCancelled(true));
|
||||||
|
new PistonListener(ArenaMode.Test, e -> getMessage().broadcastActionbar("PISTON_PUSHED_OUTSIDE"));
|
||||||
|
new PistonListener(ArenaMode.Prepare, e -> {
|
||||||
|
getMessage().broadcast("PISTON_PUSHED_OUTSIDE");
|
||||||
|
shutdown();
|
||||||
|
});
|
||||||
new Chat();
|
new Chat();
|
||||||
new ArenaBorder();
|
new ArenaBorder();
|
||||||
new TeamArea();
|
new TeamArea();
|
||||||
|
@ -156,6 +156,7 @@ PREPARE_SENT_IN=§aA team member will review the schematic soon
|
|||||||
PARTICIPANT_CHAT={0} {1}§8» §7{2}
|
PARTICIPANT_CHAT={0} {1}§8» §7{2}
|
||||||
FIGHTLEADER_CHAT=§e{0}§8» §e{1}
|
FIGHTLEADER_CHAT=§e{0}§8» §e{1}
|
||||||
SPECTATOR_CHAT=§7{0}§8» §7{1}
|
SPECTATOR_CHAT=§7{0}§8» §7{1}
|
||||||
|
PISTON_PUSHED_OUTSIDE=§cA piston pushed a block outside the allowed area!
|
||||||
|
|
||||||
|
|
||||||
# Replay
|
# Replay
|
||||||
|
@ -150,6 +150,7 @@ PREPARE_SCHEM_EXISTS=§cEs existiert bereits eine Schem mit Namenszusatz -prepar
|
|||||||
PREPARE_ACTIVE_PISTON=§cIm Teambereich wurden sich noch bewegende Pistons gefunden, Einsenden wird abgebrochen.
|
PREPARE_ACTIVE_PISTON=§cIm Teambereich wurden sich noch bewegende Pistons gefunden, Einsenden wird abgebrochen.
|
||||||
PREPARE_FAILED_SAVING=§cDie Schematic konnte nicht gespeichert werden, Einsenden wird abgebrochen.
|
PREPARE_FAILED_SAVING=§cDie Schematic konnte nicht gespeichert werden, Einsenden wird abgebrochen.
|
||||||
PREPARE_SENT_IN=§aDie Schematic wird nun zeitnah von einem Teammitglied überprüft
|
PREPARE_SENT_IN=§aDie Schematic wird nun zeitnah von einem Teammitglied überprüft
|
||||||
|
PISTON_PUSHED_OUTSIDE=§cEin Kolben hat einen Block aus dem erlaubten Bereich geschoben!
|
||||||
|
|
||||||
|
|
||||||
# Replay
|
# Replay
|
||||||
|
@ -26,6 +26,7 @@ import de.steamwar.fightsystem.FightSystem;
|
|||||||
import de.steamwar.fightsystem.listener.PersonalKitCreator;
|
import de.steamwar.fightsystem.listener.PersonalKitCreator;
|
||||||
import de.steamwar.fightsystem.states.FightState;
|
import de.steamwar.fightsystem.states.FightState;
|
||||||
import de.steamwar.fightsystem.states.StateDependentListener;
|
import de.steamwar.fightsystem.states.StateDependentListener;
|
||||||
|
import de.steamwar.fightsystem.states.StateDependentTask;
|
||||||
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;
|
||||||
@ -37,7 +38,9 @@ import org.bukkit.inventory.meta.ItemMeta;
|
|||||||
import org.bukkit.potion.PotionEffect;
|
import org.bukkit.potion.PotionEffect;
|
||||||
|
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
|
import java.util.HashSet;
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
|
import java.util.Set;
|
||||||
import java.util.function.Consumer;
|
import java.util.function.Consumer;
|
||||||
|
|
||||||
public class HotbarKit extends Kit {
|
public class HotbarKit extends Kit {
|
||||||
@ -81,8 +84,11 @@ public class HotbarKit extends Kit {
|
|||||||
|
|
||||||
public static class HotbarKitListener implements Listener {
|
public static class HotbarKitListener implements Listener {
|
||||||
|
|
||||||
|
private static final Set<Player> clicked = new HashSet<>();
|
||||||
|
|
||||||
public HotbarKitListener() {
|
public HotbarKitListener() {
|
||||||
new StateDependentListener(ArenaMode.AntiReplay, FightState.Setup, this);
|
new StateDependentListener(ArenaMode.AntiReplay, FightState.Setup, this);
|
||||||
|
new StateDependentTask(ArenaMode.AntiReplay, FightState.Setup, clicked::clear, 10, 10);
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
@ -97,6 +103,9 @@ public class HotbarKit extends Kit {
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
|
if(!clicked.add(player))
|
||||||
|
return;
|
||||||
|
|
||||||
((HotbarKit)activeKit).onClicks[slot].accept(player);
|
((HotbarKit)activeKit).onClicks[slot].accept(player);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -26,7 +26,9 @@ import de.steamwar.fightsystem.fight.Fight;
|
|||||||
import de.steamwar.fightsystem.fight.FightTeam;
|
import de.steamwar.fightsystem.fight.FightTeam;
|
||||||
import de.steamwar.fightsystem.states.FightState;
|
import de.steamwar.fightsystem.states.FightState;
|
||||||
import de.steamwar.fightsystem.states.StateDependentListener;
|
import de.steamwar.fightsystem.states.StateDependentListener;
|
||||||
|
import de.steamwar.fightsystem.states.StateDependentTask;
|
||||||
import net.md_5.bungee.api.ChatMessageType;
|
import net.md_5.bungee.api.ChatMessageType;
|
||||||
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.GameMode;
|
import org.bukkit.GameMode;
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
@ -38,40 +40,39 @@ public class ArenaBorder implements Listener {
|
|||||||
|
|
||||||
public ArenaBorder() {
|
public ArenaBorder() {
|
||||||
new StateDependentListener(ArenaMode.All, FightState.All, this);
|
new StateDependentListener(ArenaMode.All, FightState.All, this);
|
||||||
|
new StateDependentTask(ArenaMode.All, FightState.Running, this::damage, 2, 2);
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void arenaBorder(PlayerMoveEvent event){
|
public void arenaBorder(PlayerMoveEvent event){
|
||||||
Player player = event.getPlayer();
|
Player player = event.getPlayer();
|
||||||
if(Config.ArenaLeaveable && !Fight.fighting(player))
|
FightTeam team = Fight.getPlayerTeam(player);
|
||||||
|
|
||||||
|
if(Config.ArenaLeaveable && team == null)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
Location to = event.getTo();
|
Location to = event.getTo();
|
||||||
assert to != null;
|
assert to != null;
|
||||||
|
|
||||||
if(!Config.ArenaRegion.in2dRegion(to)){
|
if(Config.PlayerRegion.inRegion(to))
|
||||||
reset(event);
|
|
||||||
return;
|
return;
|
||||||
}
|
|
||||||
|
|
||||||
FightTeam team = Fight.getPlayerTeam(player);
|
if(to.getY() <= Config.PlayerRegion.getMinY() && player.getGameMode() != GameMode.SPECTATOR && team != null) {
|
||||||
if(team == null || player.getGameMode() == GameMode.SPECTATOR){
|
if(!Config.GroundWalkable && !FightState.infight())
|
||||||
if(to.getY() <= Config.ArenaRegion.getMinY())
|
|
||||||
reset(event);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if(to.getY() <= Config.ArenaRegion.getMinY()) {
|
|
||||||
if(FightState.infight())
|
|
||||||
player.damage(2);
|
|
||||||
else if(!Config.GroundWalkable)
|
|
||||||
player.teleport(team.getSpawn());
|
player.teleport(team.getSpawn());
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void reset(PlayerMoveEvent event){
|
return;
|
||||||
Player player = event.getPlayer();
|
}
|
||||||
|
|
||||||
player.teleport(event.getFrom());
|
player.teleport(event.getFrom());
|
||||||
FightSystem.getMessage().sendPrefixless("NO_ARENA_LEAVING", player, ChatMessageType.ACTION_BAR);
|
FightSystem.getMessage().sendPrefixless("NO_ARENA_LEAVING", player, ChatMessageType.ACTION_BAR);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void damage() {
|
||||||
|
for(Player player : Bukkit.getServer().getOnlinePlayers()) {
|
||||||
|
FightTeam team = Fight.getPlayerTeam(player);
|
||||||
|
if(team != null && player.getLocation().getY() <= Config.PlayerRegion.getMinY())
|
||||||
|
player.damage(1);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -37,6 +37,7 @@ import org.bukkit.event.Listener;
|
|||||||
import org.bukkit.event.inventory.InventoryAction;
|
import org.bukkit.event.inventory.InventoryAction;
|
||||||
import org.bukkit.event.inventory.InventoryClickEvent;
|
import org.bukkit.event.inventory.InventoryClickEvent;
|
||||||
import org.bukkit.event.inventory.InventoryCloseEvent;
|
import org.bukkit.event.inventory.InventoryCloseEvent;
|
||||||
|
import org.bukkit.event.inventory.InventoryOpenEvent;
|
||||||
import org.bukkit.event.player.PlayerMoveEvent;
|
import org.bukkit.event.player.PlayerMoveEvent;
|
||||||
import org.bukkit.event.player.PlayerQuitEvent;
|
import org.bukkit.event.player.PlayerQuitEvent;
|
||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.ItemStack;
|
||||||
@ -108,6 +109,15 @@ public class PersonalKitCreator implements Listener {
|
|||||||
backup.close();
|
backup.close();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@EventHandler
|
||||||
|
public void onOpenEvent(InventoryOpenEvent e){
|
||||||
|
InventoryBackup backup = openKitCreators.get(e.getPlayer());
|
||||||
|
if(backup == null)
|
||||||
|
return;
|
||||||
|
|
||||||
|
backup.close();
|
||||||
|
}
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void onInventoryClose(InventoryCloseEvent e) {
|
public void onInventoryClose(InventoryCloseEvent e) {
|
||||||
InventoryBackup backup = openKitCreators.get(e.getPlayer());
|
InventoryBackup backup = openKitCreators.get(e.getPlayer());
|
||||||
|
@ -28,17 +28,25 @@ import org.bukkit.block.BlockFace;
|
|||||||
import org.bukkit.block.PistonMoveReaction;
|
import org.bukkit.block.PistonMoveReaction;
|
||||||
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.BlockPistonEvent;
|
||||||
import org.bukkit.event.block.BlockPistonExtendEvent;
|
import org.bukkit.event.block.BlockPistonExtendEvent;
|
||||||
import org.bukkit.event.block.BlockPistonRetractEvent;
|
import org.bukkit.event.block.BlockPistonRetractEvent;
|
||||||
|
|
||||||
|
import java.util.Set;
|
||||||
|
import java.util.function.Consumer;
|
||||||
|
|
||||||
public class PistonListener implements Listener {
|
public class PistonListener implements Listener {
|
||||||
|
|
||||||
public PistonListener() {
|
private final Consumer<BlockPistonEvent> leftAreaHandler;
|
||||||
|
|
||||||
|
public PistonListener(Set<ArenaMode> condition, Consumer<BlockPistonEvent> leftAreaHandler) {
|
||||||
|
this.leftAreaHandler = leftAreaHandler;
|
||||||
|
if(!condition.contains(Config.mode))
|
||||||
|
return;
|
||||||
|
|
||||||
//Wenn Entern aktiv ist, sollen Raketen etc. entern können
|
//Wenn Entern aktiv ist, sollen Raketen etc. entern können
|
||||||
if(!ArenaMode.Check.contains(Config.mode)) {
|
new StateDependentListener(!Config.AllowMissiles, FightState.All, this);
|
||||||
new StateDependentListener(!Config.AllowMissiles, FightState.All, this);
|
new StateDependentListener(Config.AllowMissiles, FightState.Setup, this);
|
||||||
new StateDependentListener(Config.AllowMissiles, FightState.Setup, this);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
@ -50,7 +58,7 @@ public class PistonListener implements Listener {
|
|||||||
for(Block block : e.getBlocks()){
|
for(Block block : e.getBlocks()){
|
||||||
Block target = block.getRelative(face);
|
Block target = block.getRelative(face);
|
||||||
if(!Config.BlueExtendRegion.inRegion(target) && !Config.RedExtendRegion.inRegion(target) && block.getPistonMoveReaction() != PistonMoveReaction.BREAK) {
|
if(!Config.BlueExtendRegion.inRegion(target) && !Config.RedExtendRegion.inRegion(target) && block.getPistonMoveReaction() != PistonMoveReaction.BREAK) {
|
||||||
e.setCancelled(true);
|
leftAreaHandler.accept(e);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -63,7 +71,7 @@ public class PistonListener implements Listener {
|
|||||||
|
|
||||||
for(Block block : e.getBlocks()){
|
for(Block block : e.getBlocks()){
|
||||||
if(!Config.BlueExtendRegion.inRegion(block) && !Config.RedExtendRegion.inRegion(block)) {
|
if(!Config.BlueExtendRegion.inRegion(block) && !Config.RedExtendRegion.inRegion(block)) {
|
||||||
e.setCancelled(true);
|
leftAreaHandler.accept(e);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -80,7 +80,7 @@ public class TeamArea implements Listener {
|
|||||||
@EventHandler
|
@EventHandler
|
||||||
public void blockBreak(BlockBreakEvent event) {
|
public void blockBreak(BlockBreakEvent event) {
|
||||||
Block block = event.getBlock();
|
Block block = event.getBlock();
|
||||||
if(Config.BluePasteRegion.getMinY() <= block.getY())
|
if(Config.BlueExtendRegion.getMinY() <= block.getY())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
|
@ -29,7 +29,7 @@ import de.steamwar.fightsystem.utils.BlockIdWrapper;
|
|||||||
import de.steamwar.fightsystem.utils.CraftbukkitWrapper;
|
import de.steamwar.fightsystem.utils.CraftbukkitWrapper;
|
||||||
import de.steamwar.fightsystem.utils.Message;
|
import de.steamwar.fightsystem.utils.Message;
|
||||||
import de.steamwar.fightsystem.utils.SWSound;
|
import de.steamwar.fightsystem.utils.SWSound;
|
||||||
import de.steamwar.sql.SchematicData;
|
import de.steamwar.sql.NodeData;
|
||||||
import de.steamwar.sql.SchematicNode;
|
import de.steamwar.sql.SchematicNode;
|
||||||
import de.steamwar.sql.SteamwarUser;
|
import de.steamwar.sql.SteamwarUser;
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
@ -276,7 +276,7 @@ public interface Recorder {
|
|||||||
|
|
||||||
ByteArrayOutputStream buffer = new ByteArrayOutputStream();
|
ByteArrayOutputStream buffer = new ByteArrayOutputStream();
|
||||||
try{
|
try{
|
||||||
copy(new SchematicData(SchematicNode.getSchematicNode(schemId)).schemData(), buffer);
|
copy(NodeData.get(SchematicNode.getSchematicNode(schemId)).schemData(), buffer);
|
||||||
}catch (EOFException e) {
|
}catch (EOFException e) {
|
||||||
Bukkit.getLogger().log(Level.INFO, "EOFException ignored");
|
Bukkit.getLogger().log(Level.INFO, "EOFException ignored");
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
|
@ -33,9 +33,9 @@ public class Region {
|
|||||||
private final int maxY;
|
private final int maxY;
|
||||||
private final int maxZ;
|
private final int maxZ;
|
||||||
|
|
||||||
public Region(int minX, int minY, int minZ, int sizeX, int sizeY, int sizeZ, int extendX, int extendZ) {
|
public Region(int minX, int minY, int minZ, int sizeX, int sizeY, int sizeZ, int extendX, int extendY, int extendZ) {
|
||||||
this(minX - extendX, minY, minZ - extendZ,
|
this(minX - extendX, minY - extendY, minZ - extendZ,
|
||||||
sizeX + extendX * 2, sizeY, sizeZ + extendZ * 2);
|
sizeX + extendX * 2, sizeY + extendY * 2, sizeZ + extendZ * 2);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Region(int minX, int minY, int minZ, int sizeX, int sizeY, int sizeZ) {
|
public Region(int minX, int minY, int minZ, int sizeX, int sizeY, int sizeZ) {
|
||||||
|
In neuem Issue referenzieren
Einen Benutzer sperren