SteamWar/FightSystem
Archiviert
13
1

Merge branch 'master' into items
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful

# Conflicts:
#	FightSystem_Core/src/de/steamwar/fightsystem/listener/Permanent.java
Dieser Commit ist enthalten in:
Lixfel 2023-01-23 16:28:32 +01:00
Commit fe915ba85d
8 geänderte Dateien mit 31 neuen und 28 gelöschten Zeilen

Datei anzeigen

@ -25,6 +25,7 @@ import org.bukkit.World;
import org.bukkit.block.Block;
import org.bukkit.block.data.BlockData;
import org.bukkit.block.data.Waterlogged;
import org.bukkit.block.data.type.Dispenser;
import org.bukkit.event.block.BlockPhysicsEvent;
import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.meta.BlockDataMeta;
@ -94,4 +95,9 @@ public class FlatteningWrapper14 implements FlatteningWrapper {
public boolean checkPistonMoving(Block block) {
return block.getType() == Material.MOVING_PISTON;
}
@Override
public boolean isFacingWater(Block dispenser) {
return dispenser.getRelative(((Dispenser) dispenser.getBlockData()).getFacing()).isLiquid();
}
}

Datei anzeigen

@ -72,4 +72,9 @@ public class FlatteningWrapper8 implements FlatteningWrapper {
public boolean checkPistonMoving(Block block) {
return block.getType() == Material.PISTON_MOVING_PIECE;
}
@Override
public boolean isFacingWater(Block dispenser) {
return false;
}
}

Datei anzeigen

@ -20,7 +20,7 @@ Ranks: [] # Disables ranks for this schematic type if missing
Times:
# Time in seconds the server stops after starting if nobody joins
NoPlayersOnlineDuration: 30 # defaults to 30 if missing
NoPlayersOnlineDuration: 300 # defaults to 300 if missing
# Time in seconds the team leaders have to choose their schematic
PreSchemPasteDuration: 120 # defaults to 120 if missing
# Time in seconds for preparing

Datei anzeigen

@ -155,7 +155,7 @@ public class Config {
}
FileConfiguration worldconfig = YamlConfiguration.loadConfiguration(worldConfigFile);
NoPlayerOnlineDuration = config.getInt("Times.NoPlayersOnlineDuration", 30);
NoPlayerOnlineDuration = config.getInt("Times.NoPlayersOnlineDuration", 300);
PreSchemPasteDuration = config.getInt("Times.PreSchemPasteDuration", 120);
SetupDuration = config.getInt("Times.SetupDuration", 300);
PreFightDuration = config.getInt("Times.PreFightDuration", 30);

Datei anzeigen

@ -23,31 +23,16 @@ import de.steamwar.fightsystem.ArenaMode;
import de.steamwar.fightsystem.Config;
import de.steamwar.fightsystem.states.FightState;
import de.steamwar.fightsystem.states.StateDependentCountdown;
import de.steamwar.fightsystem.states.StateDependentListener;
import de.steamwar.fightsystem.utils.Message;
import org.bukkit.Bukkit;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.player.PlayerJoinEvent;
public class NoPlayersOnlineCountdown extends Countdown implements Listener {
public class NoPlayersOnlineCountdown extends Countdown {
public NoPlayersOnlineCountdown() {
super(Config.NoPlayerOnlineDuration, new Message("SHUTDOWN_COUNTDOWN"), null, false);
new StateDependentListener(ArenaMode.AntiReplay, FightState.PreLeaderSetup, this);
new StateDependentCountdown(ArenaMode.AntiReplay, FightState.PreLeaderSetup, this) {
@Override
public void enable() {
if(Bukkit.getOnlinePlayers().isEmpty())
super.enable();
}
};
}
@EventHandler
public void handlePlayerJoin(PlayerJoinEvent event) {
disable();
if (!Config.ArenaLeaveable)
new StateDependentCountdown(ArenaMode.AntiReplay, FightState.PreLeaderSetup, this);
}
@Override

Datei anzeigen

@ -20,7 +20,6 @@
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;
@ -28,7 +27,6 @@ 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;
import org.bukkit.event.inventory.InventoryClickEvent;
import org.bukkit.event.inventory.InventoryDragEvent;
import org.bukkit.event.inventory.InventoryType;
@ -74,10 +72,4 @@ public class InFightInventory implements Listener {
}
}
}
@EventHandler
public void onBlockDispense(BlockDispenseEvent e) {
if(Config.ArenaRegion.inRegion(e.getBlock()) && e.getItem().getType() == Material.TNT)
e.setCancelled(true);
}
}

Datei anzeigen

@ -27,6 +27,7 @@ import de.steamwar.fightsystem.fight.FightPlayer;
import de.steamwar.fightsystem.fight.FightTeam;
import de.steamwar.fightsystem.states.FightState;
import de.steamwar.fightsystem.states.StateDependentListener;
import de.steamwar.fightsystem.utils.FlatteningWrapper;
import net.md_5.bungee.api.ChatMessageType;
import org.bukkit.GameMode;
import org.bukkit.Material;
@ -37,6 +38,7 @@ import org.bukkit.event.EventPriority;
import org.bukkit.event.Listener;
import org.bukkit.event.entity.EntityExplodeEvent;
import org.bukkit.event.entity.EntityPickupItemEvent;
import org.bukkit.event.block.BlockDispenseEvent;
import org.bukkit.event.block.BlockFromToEvent;
import org.bukkit.event.entity.FoodLevelChangeEvent;
import org.bukkit.event.entity.PlayerDeathEvent;
@ -183,4 +185,15 @@ public class Permanent implements Listener {
event.setCancelled(true);
}
@EventHandler
public void onBlockDispense(BlockDispenseEvent e) {
Block block = e.getBlock();
if(!Config.ArenaRegion.inRegion(block))
return;
if(e.getItem().getType() == Material.TNT || FlatteningWrapper.impl.isFacingWater(block))
e.setCancelled(true);
}
}

Datei anzeigen

@ -44,4 +44,6 @@ public interface FlatteningWrapper {
void forceLoadChunk(World world, int cX, int cZ);
boolean checkPistonMoving(Block block);
boolean isFacingWater(Block dispenser);
}