SteamWar/FightSystem
Archiviert
13
1

Reenable Items #373

Zusammengeführt
Lixfel hat 8 Commits von items nach master 2023-05-09 16:43:14 +02:00 zusammengeführt
8 geänderte Dateien mit 31 neuen und 28 gelöschten Zeilen
Nur Änderungen aus Commit fe915ba85d werden angezeigt - Alle Commits anzeigen

Datei anzeigen

@ -25,6 +25,7 @@ import org.bukkit.World;
import org.bukkit.block.Block; import org.bukkit.block.Block;
import org.bukkit.block.data.BlockData; import org.bukkit.block.data.BlockData;
import org.bukkit.block.data.Waterlogged; import org.bukkit.block.data.Waterlogged;
import org.bukkit.block.data.type.Dispenser;
import org.bukkit.event.block.BlockPhysicsEvent; import org.bukkit.event.block.BlockPhysicsEvent;
import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.meta.BlockDataMeta; import org.bukkit.inventory.meta.BlockDataMeta;
@ -94,4 +95,9 @@ public class FlatteningWrapper14 implements FlatteningWrapper {
public boolean checkPistonMoving(Block block) { public boolean checkPistonMoving(Block block) {
return block.getType() == Material.MOVING_PISTON; 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) { public boolean checkPistonMoving(Block block) {
return block.getType() == Material.PISTON_MOVING_PIECE; 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: Times:
# Time in seconds the server stops after starting if nobody joins # 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 # Time in seconds the team leaders have to choose their schematic
PreSchemPasteDuration: 120 # defaults to 120 if missing PreSchemPasteDuration: 120 # defaults to 120 if missing
# Time in seconds for preparing # Time in seconds for preparing

Datei anzeigen

@ -155,7 +155,7 @@ public class Config {
} }
FileConfiguration worldconfig = YamlConfiguration.loadConfiguration(worldConfigFile); FileConfiguration worldconfig = YamlConfiguration.loadConfiguration(worldConfigFile);
NoPlayerOnlineDuration = config.getInt("Times.NoPlayersOnlineDuration", 30); NoPlayerOnlineDuration = config.getInt("Times.NoPlayersOnlineDuration", 300);
PreSchemPasteDuration = config.getInt("Times.PreSchemPasteDuration", 120); PreSchemPasteDuration = config.getInt("Times.PreSchemPasteDuration", 120);
SetupDuration = config.getInt("Times.SetupDuration", 300); SetupDuration = config.getInt("Times.SetupDuration", 300);
PreFightDuration = config.getInt("Times.PreFightDuration", 30); 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.Config;
import de.steamwar.fightsystem.states.FightState; import de.steamwar.fightsystem.states.FightState;
import de.steamwar.fightsystem.states.StateDependentCountdown; import de.steamwar.fightsystem.states.StateDependentCountdown;
import de.steamwar.fightsystem.states.StateDependentListener;
import de.steamwar.fightsystem.utils.Message; import de.steamwar.fightsystem.utils.Message;
import org.bukkit.Bukkit; 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() { public NoPlayersOnlineCountdown() {
super(Config.NoPlayerOnlineDuration, new Message("SHUTDOWN_COUNTDOWN"), null, false); super(Config.NoPlayerOnlineDuration, new Message("SHUTDOWN_COUNTDOWN"), null, false);
new StateDependentListener(ArenaMode.AntiReplay, FightState.PreLeaderSetup, this); if (!Config.ArenaLeaveable)
new StateDependentCountdown(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();
} }
@Override @Override

Datei anzeigen

@ -20,7 +20,6 @@
package de.steamwar.fightsystem.listener; package de.steamwar.fightsystem.listener;
import de.steamwar.fightsystem.ArenaMode; import de.steamwar.fightsystem.ArenaMode;
import de.steamwar.fightsystem.Config;
import de.steamwar.fightsystem.fight.Fight; import de.steamwar.fightsystem.fight.Fight;
import de.steamwar.fightsystem.states.FightState; import de.steamwar.fightsystem.states.FightState;
import de.steamwar.fightsystem.states.StateDependentListener; import de.steamwar.fightsystem.states.StateDependentListener;
@ -28,7 +27,6 @@ import org.bukkit.Material;
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.BlockDispenseEvent;
import org.bukkit.event.inventory.InventoryClickEvent; import org.bukkit.event.inventory.InventoryClickEvent;
import org.bukkit.event.inventory.InventoryDragEvent; import org.bukkit.event.inventory.InventoryDragEvent;
import org.bukkit.event.inventory.InventoryType; 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.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.utils.FlatteningWrapper;
import net.md_5.bungee.api.ChatMessageType; import net.md_5.bungee.api.ChatMessageType;
import org.bukkit.GameMode; import org.bukkit.GameMode;
import org.bukkit.Material; import org.bukkit.Material;
@ -37,6 +38,7 @@ import org.bukkit.event.EventPriority;
import org.bukkit.event.Listener; import org.bukkit.event.Listener;
import org.bukkit.event.entity.EntityExplodeEvent; import org.bukkit.event.entity.EntityExplodeEvent;
import org.bukkit.event.entity.EntityPickupItemEvent; import org.bukkit.event.entity.EntityPickupItemEvent;
import org.bukkit.event.block.BlockDispenseEvent;
import org.bukkit.event.block.BlockFromToEvent; import org.bukkit.event.block.BlockFromToEvent;
import org.bukkit.event.entity.FoodLevelChangeEvent; import org.bukkit.event.entity.FoodLevelChangeEvent;
import org.bukkit.event.entity.PlayerDeathEvent; import org.bukkit.event.entity.PlayerDeathEvent;
@ -183,4 +185,15 @@ public class Permanent implements Listener {
event.setCancelled(true); 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); void forceLoadChunk(World world, int cX, int cZ);
boolean checkPistonMoving(Block block); boolean checkPistonMoving(Block block);
boolean isFacingWater(Block dispenser);
} }