Merge branch 'master' into 1.18
Dieser Commit ist enthalten in:
Commit
55b4dad1e4
@ -19,10 +19,8 @@
|
||||
|
||||
package de.steamwar.fightsystem.utils;
|
||||
|
||||
import de.steamwar.core.events.ChunkListener;
|
||||
import de.steamwar.fightsystem.fight.FightWorld;
|
||||
import net.minecraft.server.v1_10_R1.Chunk;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.craftbukkit.v1_10_R1.CraftWorld;
|
||||
import org.bukkit.craftbukkit.v1_10_R1.entity.CraftEntity;
|
||||
@ -50,9 +48,6 @@ public class CraftbukkitWrapper10 implements CraftbukkitWrapper.ICraftbukkitWrap
|
||||
}
|
||||
chunk.tileEntities.clear();
|
||||
chunk.tileEntities.putAll(backupChunk.tileEntities);
|
||||
for(Player p : Bukkit.getOnlinePlayers()){
|
||||
ChunkListener.sendChunk(p, x, z);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -19,10 +19,8 @@
|
||||
|
||||
package de.steamwar.fightsystem.utils;
|
||||
|
||||
import de.steamwar.core.events.ChunkListener;
|
||||
import de.steamwar.fightsystem.fight.FightWorld;
|
||||
import net.minecraft.server.v1_12_R1.Chunk;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.craftbukkit.v1_12_R1.CraftWorld;
|
||||
import org.bukkit.craftbukkit.v1_12_R1.entity.CraftEntity;
|
||||
@ -50,9 +48,6 @@ public class CraftbukkitWrapper12 implements CraftbukkitWrapper.ICraftbukkitWrap
|
||||
}
|
||||
chunk.tileEntities.clear();
|
||||
chunk.tileEntities.putAll(backupChunk.tileEntities);
|
||||
for(Player p : Bukkit.getOnlinePlayers()){
|
||||
ChunkListener.sendChunk(p, x, z);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -19,10 +19,8 @@
|
||||
|
||||
package de.steamwar.fightsystem.utils;
|
||||
|
||||
import de.steamwar.core.events.ChunkListener;
|
||||
import de.steamwar.fightsystem.fight.FightWorld;
|
||||
import net.minecraft.server.v1_14_R1.Chunk;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.craftbukkit.v1_14_R1.CraftWorld;
|
||||
import org.bukkit.craftbukkit.v1_14_R1.entity.CraftEntity;
|
||||
@ -51,9 +49,6 @@ public class CraftbukkitWrapper14 implements CraftbukkitWrapper.ICraftbukkitWrap
|
||||
chunk.tileEntities.putAll(backupChunk.tileEntities);
|
||||
chunk.heightMap.clear();
|
||||
chunk.heightMap.putAll(backupChunk.heightMap);
|
||||
for(Player p : Bukkit.getOnlinePlayers()){
|
||||
ChunkListener.sendChunk(p, x, z);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -41,7 +41,7 @@ import com.sk89q.worldedit.world.World;
|
||||
import com.sk89q.worldedit.world.block.BaseBlock;
|
||||
import com.sk89q.worldedit.world.block.BlockTypes;
|
||||
import de.steamwar.fightsystem.FightSystem;
|
||||
import de.steamwar.sql.Schematic;
|
||||
import de.steamwar.sql.SchematicNode;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.DyeColor;
|
||||
import org.bukkit.Location;
|
||||
@ -122,7 +122,7 @@ public class WorldeditWrapper14 implements WorldeditWrapper.IWorldeditWrapper {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void saveSchem(Schematic schem, Region region, int minY) throws WorldEditException {
|
||||
public void saveSchem(SchematicNode schem, Region region, int minY) throws WorldEditException {
|
||||
World w = new BukkitWorld(Bukkit.getWorlds().get(0));
|
||||
BlockVector3 min = BlockVector3.at(region.getMinX(), minY, region.getMinZ());
|
||||
CuboidRegion cuboidRegion = new CuboidRegion(w, min, BlockVector3.at(region.getMaxX(), region.getMaxY(), region.getMaxZ()).subtract(BlockVector3.ONE));
|
||||
|
@ -19,10 +19,8 @@
|
||||
|
||||
package de.steamwar.fightsystem.utils;
|
||||
|
||||
import de.steamwar.core.events.ChunkListener;
|
||||
import de.steamwar.fightsystem.fight.FightWorld;
|
||||
import net.minecraft.server.v1_15_R1.Chunk;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.craftbukkit.v1_15_R1.CraftWorld;
|
||||
import org.bukkit.craftbukkit.v1_15_R1.entity.CraftEntity;
|
||||
@ -51,9 +49,6 @@ public class CraftbukkitWrapper15 implements CraftbukkitWrapper.ICraftbukkitWrap
|
||||
chunk.tileEntities.putAll(backupChunk.tileEntities);
|
||||
chunk.heightMap.clear();
|
||||
chunk.heightMap.putAll(backupChunk.heightMap);
|
||||
for(Player p : Bukkit.getOnlinePlayers()){
|
||||
ChunkListener.sendChunk(p, x, z);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -19,9 +19,7 @@
|
||||
|
||||
package de.steamwar.fightsystem.utils;
|
||||
|
||||
import de.steamwar.core.events.ChunkListener;
|
||||
import net.minecraft.server.v1_8_R3.Chunk;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.craftbukkit.v1_8_R3.CraftWorld;
|
||||
import org.bukkit.craftbukkit.v1_8_R3.entity.CraftEntity;
|
||||
@ -47,9 +45,6 @@ public class CraftbukkitWrapper8 implements CraftbukkitWrapper.ICraftbukkitWrapp
|
||||
w.tileEntityList.removeAll(chunk.tileEntities.values());
|
||||
chunk.tileEntities.clear();
|
||||
chunk.tileEntities.putAll(backupChunk.tileEntities);
|
||||
for(Player p : Bukkit.getOnlinePlayers()){
|
||||
ChunkListener.sendChunk(p, x, z);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -38,7 +38,7 @@ import com.sk89q.worldedit.regions.CuboidRegion;
|
||||
import com.sk89q.worldedit.session.ClipboardHolder;
|
||||
import com.sk89q.worldedit.world.World;
|
||||
import de.steamwar.fightsystem.FightSystem;
|
||||
import de.steamwar.sql.Schematic;
|
||||
import de.steamwar.sql.SchematicNode;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.DyeColor;
|
||||
import org.bukkit.Location;
|
||||
@ -121,7 +121,7 @@ public class WorldeditWrapper8 implements WorldeditWrapper.IWorldeditWrapper {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void saveSchem(Schematic schem, Region region, int minY) throws WorldEditException {
|
||||
public void saveSchem(SchematicNode schem, Region region, int minY) throws WorldEditException {
|
||||
World w = new BukkitWorld(Bukkit.getWorlds().get(0));
|
||||
Vector min = new Vector(region.getMinX(), minY, region.getMinZ());
|
||||
CuboidRegion cuboidRegion = new CuboidRegion(w, min, new Vector(region.getMaxX(), region.getMaxY(), region.getMaxZ()).subtract(Vector.ONE));
|
||||
|
@ -19,10 +19,8 @@
|
||||
|
||||
package de.steamwar.fightsystem.utils;
|
||||
|
||||
import de.steamwar.core.events.ChunkListener;
|
||||
import de.steamwar.fightsystem.fight.FightWorld;
|
||||
import net.minecraft.server.v1_9_R2.Chunk;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.craftbukkit.v1_9_R2.CraftWorld;
|
||||
import org.bukkit.craftbukkit.v1_9_R2.entity.CraftEntity;
|
||||
@ -50,9 +48,6 @@ public class CraftbukkitWrapper9 implements CraftbukkitWrapper.ICraftbukkitWrapp
|
||||
}
|
||||
chunk.tileEntities.clear();
|
||||
chunk.tileEntities.putAll(backupChunk.tileEntities);
|
||||
for(Player p : Bukkit.getOnlinePlayers()){
|
||||
ChunkListener.sendChunk(p, x, z);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -41,6 +41,8 @@ Arena:
|
||||
BorderFromSchematic: 12 # defaults to 12 if missing
|
||||
# If ground walkable, teams can walk below the lower arena border during setup
|
||||
GroundWalkable: true # defaults to true if missing
|
||||
# Disable snow and ice melting
|
||||
DisableSnowMelt: false # defaults to false if missing
|
||||
|
||||
Schematic:
|
||||
# The size of the schematics
|
||||
@ -52,6 +54,8 @@ Schematic:
|
||||
Type: Normal # defaults to Normal if missing
|
||||
# Shortcut of the schematic type
|
||||
Shortcut: "" # defaults to "" if missing
|
||||
# Spigot (1.8) material for GUIs
|
||||
Material: STONE_BUTTON # defaults to STONE_BUTTON if missing
|
||||
# If the schematics should be rotated during pasting
|
||||
Rotate: true # defaults to true if missing
|
||||
# If the schematics should be pasted aligned to the borders instead of centered
|
||||
|
@ -43,13 +43,13 @@ public enum ArenaMode {
|
||||
public static final Set<ArenaMode> Replay = Collections.unmodifiableSet(EnumSet.of(REPLAY));
|
||||
|
||||
public static final Set<ArenaMode> AntiReplay = Collections.unmodifiableSet(EnumSet.complementOf(EnumSet.of(REPLAY)));
|
||||
public static final Set<ArenaMode> Replayable = Collections.unmodifiableSet(EnumSet.of(REPLAY, TEST));
|
||||
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> AntiPrepare = Collections.unmodifiableSet(EnumSet.complementOf(EnumSet.of(PREPARE)));
|
||||
public static final Set<ArenaMode> VariableTeams = Collections.unmodifiableSet(EnumSet.complementOf(EnumSet.of(RANKED, EVENT, REPLAY)));
|
||||
public static final Set<ArenaMode> RankedEvent = Collections.unmodifiableSet(EnumSet.of(RANKED, EVENT, REPLAY));
|
||||
public static final Set<ArenaMode> Restartable = Collections.unmodifiableSet(EnumSet.of(NORMAL, RANKED, REPLAY));
|
||||
public static final Set<ArenaMode> NotRestartable = Collections.unmodifiableSet(EnumSet.of(EVENT, REPLAY));
|
||||
public static final Set<ArenaMode> SoloLeader = Collections.unmodifiableSet(EnumSet.of(TEST, CHECK, PREPARE));
|
||||
public static final Set<ArenaMode> NotOnBau = Collections.unmodifiableSet(EnumSet.complementOf(EnumSet.of(TEST, CHECK, PREPARE, REPLAY)));
|
||||
public static final Set<ArenaMode> SeriousFight = Collections.unmodifiableSet(EnumSet.complementOf(EnumSet.of(TEST, CHECK, REPLAY)));
|
||||
|
@ -69,6 +69,7 @@ public class Config {
|
||||
public static final int PreperationArea;
|
||||
public static final int WaterDepth;
|
||||
public static final boolean GroundWalkable;
|
||||
public static final boolean DisableSnowMelt;
|
||||
|
||||
//schematic parameter
|
||||
public static final boolean RanksEnabled;
|
||||
@ -164,6 +165,7 @@ public class Config {
|
||||
int schem2BorderZ = config.getInt("Arena.Schem2Border.z", 24);
|
||||
PreperationArea = config.getInt("Arena.BorderFromSchematic", 12);
|
||||
GroundWalkable = config.getBoolean("Arena.GroundWalkable", true);
|
||||
DisableSnowMelt = config.getBoolean("Arena.DisableSnowMelt", false);
|
||||
|
||||
int schemsizeX = config.getInt("Schematic.Size.x");
|
||||
int schemsizeY = config.getInt("Schematic.Size.y");
|
||||
|
@ -33,7 +33,7 @@ import de.steamwar.fightsystem.utils.*;
|
||||
import de.steamwar.fightsystem.winconditions.*;
|
||||
import de.steamwar.message.Message;
|
||||
import de.steamwar.sql.EventFight;
|
||||
import de.steamwar.sql.Schematic;
|
||||
import de.steamwar.sql.SchematicNode;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.plugin.java.JavaPlugin;
|
||||
@ -84,6 +84,7 @@ public class FightSystem extends JavaPlugin {
|
||||
new PersonalKitCreator();
|
||||
new ArrowStopper();
|
||||
new ArrowPickup();
|
||||
new BlockFadeListener();
|
||||
|
||||
new EnterHandler();
|
||||
new TechHider();
|
||||
@ -127,7 +128,7 @@ public class FightSystem extends JavaPlugin {
|
||||
new AkCommand();
|
||||
new LeaderCommand();
|
||||
new LockschemCommand();
|
||||
new ReplayCommand();
|
||||
new LockReplayCommand();
|
||||
new StateCommand();
|
||||
new SkipCommand();
|
||||
new WinCommand();
|
||||
@ -140,9 +141,9 @@ public class FightSystem extends JavaPlugin {
|
||||
if(Config.mode == ArenaMode.EVENT) {
|
||||
setPreSchemState();
|
||||
}else if(Config.mode == ArenaMode.CHECK){
|
||||
Fight.getBlueTeam().setSchem(Schematic.getSchemFromDB(Config.CheckSchemID));
|
||||
Fight.getBlueTeam().setSchem(SchematicNode.getSchematicNode(Config.CheckSchemID));
|
||||
}else if(Config.mode == ArenaMode.PREPARE) {
|
||||
Fight.getUnrotated().setSchem(Schematic.getSchemFromDB(Config.PrepareSchemID));
|
||||
Fight.getUnrotated().setSchem(SchematicNode.getSchematicNode(Config.PrepareSchemID));
|
||||
}else if(Config.mode == ArenaMode.REPLAY) {
|
||||
FightWorld.forceLoad();
|
||||
FileSource.startReplay();
|
||||
@ -151,7 +152,6 @@ public class FightSystem extends JavaPlugin {
|
||||
|
||||
@Override
|
||||
public void onDisable() {
|
||||
ProtocolAPI.tinyProtocol.close();
|
||||
GlobalRecorder.getInstance().close();
|
||||
}
|
||||
|
||||
|
@ -53,7 +53,7 @@ LOCKSCHEM_LOCKED_BY=
|
||||
|
||||
REMOVE_HELP=§8/§eremove §8[§eSpieler§8]
|
||||
|
||||
REPLAY_UNAVAILABLE=§cReplay derzeit nicht verfügbar
|
||||
REPLAY_LOCKED=§7Replaywiedergabe für 1 Monat gesperrt
|
||||
|
||||
NOT_FIGHTLEADER=§cDu bist nicht Kampfleiter
|
||||
WIN_HELP=§8/§7win §8[§eTeam §8or §etie§8]
|
||||
|
@ -63,7 +63,7 @@ public class Commands {
|
||||
return fightPlayer;
|
||||
}
|
||||
|
||||
private static FightPlayer checkGetLeader(Player p){
|
||||
public static FightPlayer checkGetLeader(Player p){
|
||||
FightPlayer fightPlayer = checkGetPlayer(p);
|
||||
if(fightPlayer != null && !fightPlayer.isLeader()){
|
||||
FightSystem.getMessage().sendPrefixless("NOT_LEADER", p, ChatMessageType.ACTION_BAR);
|
||||
@ -72,7 +72,7 @@ public class Commands {
|
||||
return fightPlayer;
|
||||
}
|
||||
|
||||
private static FightTeam checkGetTeam(Player p){
|
||||
public static FightTeam checkGetTeam(Player p){
|
||||
FightTeam fightTeam = Fight.getPlayerTeam(p);
|
||||
if(fightTeam == null){
|
||||
errNoTeam(p);
|
||||
|
@ -27,13 +27,10 @@ import de.steamwar.fightsystem.fight.FightTeam;
|
||||
import de.steamwar.fightsystem.fight.Kit;
|
||||
import de.steamwar.fightsystem.listener.PersonalKitCreator;
|
||||
import de.steamwar.fightsystem.states.FightState;
|
||||
import de.steamwar.inventory.SWAnvilInv;
|
||||
import de.steamwar.inventory.SWInventory;
|
||||
import de.steamwar.inventory.SWItem;
|
||||
import de.steamwar.inventory.SWListInv;
|
||||
import de.steamwar.inventory.*;
|
||||
import de.steamwar.message.Message;
|
||||
import de.steamwar.sql.PersonalKit;
|
||||
import de.steamwar.sql.Schematic;
|
||||
import de.steamwar.sql.SchematicNode;
|
||||
import de.steamwar.sql.SteamwarUser;
|
||||
import net.md_5.bungee.api.ChatMessageType;
|
||||
import org.bukkit.Bukkit;
|
||||
@ -173,7 +170,7 @@ public class GUI {
|
||||
});
|
||||
if(Fight.getMaxRank() == 0){
|
||||
inv.setItem(0, SWItem.getDye(8), (byte)8, msg.parse("SCHEM_PRIVATE_FORBIDDEN", p, Config.GameName), (ClickType click)->{});
|
||||
}else if(Schematic.getSchemsOfType(p.getUniqueId(), Config.SchematicType).isEmpty() && !Config.test()){
|
||||
}else if(SchematicNode.getAllAccessibleSchematicsOfType(SteamwarUser.get(p.getUniqueId()).getId(), Config.SchematicType.toDB()).isEmpty() && !Config.test()){
|
||||
inv.setItem(0, SWItem.getDye(8), (byte)8, msg.parse("SCHEM_NO_PRIVATE", p, Config.GameName), (ClickType click)->{});
|
||||
}else{
|
||||
inv.setItem(0, SWItem.getMaterial("CAULDRON_ITEM"), msg.parse("SCHEM_PRIVATE", p, Config.GameName), (ClickType click) -> {
|
||||
@ -186,25 +183,15 @@ public class GUI {
|
||||
}
|
||||
|
||||
private static void schemDialog(Player p, boolean publicSchems){
|
||||
List<SWListInv.SWListEntry<Schematic>> schems;
|
||||
if(publicSchems)
|
||||
schems = SWListInv.getSchemList(Config.SchematicType, 0);
|
||||
else if(Config.test())
|
||||
schems = SWListInv.getSchemList(null, SteamwarUser.get(p.getUniqueId()).getId());
|
||||
else{
|
||||
schems = SWListInv.getSchemList(Config.SchematicType, SteamwarUser.get(p.getUniqueId()).getId());
|
||||
schems.removeIf(schem -> schem.getObject().getRank() > Fight.getMaxRank());
|
||||
}
|
||||
|
||||
SWListInv<Schematic> inv = new SWListInv<>(p, msg.parse("SCHEM_TITLE", p, Config.GameName), schems, (ClickType click, Schematic s) -> {
|
||||
SchematicSelector selector = new SchematicSelector(p, Config.test()?SchematicSelector.selectSchematic():SchematicSelector.selectSchematicTypeWithRank(Config.SchematicType, Fight.getMaxRank()), node -> {
|
||||
FightTeam fightTeam = Fight.getPlayerTeam(p);
|
||||
if(fightTeam == null)
|
||||
return;
|
||||
if(Config.test() || FightState.getFightState() != FightState.POST_SCHEM_SETUP)
|
||||
fightTeam.pasteSchem(s);
|
||||
fightTeam.pasteSchem(node);
|
||||
p.closeInventory();
|
||||
});
|
||||
inv.setCallback(-999, (ClickType click) -> p.closeInventory());
|
||||
inv.open();
|
||||
selector.setPublicMode(publicSchems?SchematicSelector.PublicMode.PUBLIC_ONLY:SchematicSelector.PublicMode.PRIVATE_ONLY);
|
||||
selector.open();
|
||||
}
|
||||
}
|
||||
|
@ -20,26 +20,19 @@
|
||||
package de.steamwar.fightsystem.commands;
|
||||
|
||||
import de.steamwar.fightsystem.ArenaMode;
|
||||
import de.steamwar.fightsystem.Config;
|
||||
import de.steamwar.fightsystem.FightSystem;
|
||||
import de.steamwar.fightsystem.record.FileRecorder;
|
||||
import de.steamwar.fightsystem.record.FileSource;
|
||||
import de.steamwar.fightsystem.states.FightState;
|
||||
import de.steamwar.fightsystem.states.StateDependentCommand;
|
||||
import de.steamwar.sql.SteamwarUser;
|
||||
import net.md_5.bungee.api.ChatMessageType;
|
||||
import de.steamwar.fightsystem.utils.FightStatistics;
|
||||
import de.steamwar.fightsystem.utils.FightUI;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandExecutor;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.logging.Level;
|
||||
public class LockReplayCommand implements CommandExecutor {
|
||||
|
||||
public class ReplayCommand implements CommandExecutor {
|
||||
|
||||
public ReplayCommand() {
|
||||
new StateDependentCommand(ArenaMode.Replayable, FightState.All, "replay", this);
|
||||
public LockReplayCommand() {
|
||||
new StateDependentCommand(ArenaMode.AntiReplay, FightState.Schem, "lockreplay", this);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -49,25 +42,11 @@ public class ReplayCommand implements CommandExecutor {
|
||||
}
|
||||
Player player = (Player) sender;
|
||||
|
||||
if(!Config.test()){
|
||||
SteamwarUser user = SteamwarUser.get(player.getUniqueId());
|
||||
if(!user.getUserGroup().isTeamGroup()){
|
||||
FightSystem.getMessage().sendPrefixless("REPLAY_UNAVAILABLE", sender, ChatMessageType.ACTION_BAR);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
if(!FileRecorder.getFile().exists()){
|
||||
FightSystem.getMessage().sendPrefixless("REPLAY_UNAVAILABLE", sender, ChatMessageType.ACTION_BAR);
|
||||
if(Commands.checkGetLeader(player) == null)
|
||||
return false;
|
||||
}
|
||||
|
||||
try {
|
||||
new FileSource(FileRecorder.getFile());
|
||||
} catch (IOException e) {
|
||||
FightSystem.getMessage().sendPrefixless("REPLAY_UNAVAILABLE", sender, ChatMessageType.ACTION_BAR);
|
||||
FightSystem.getPlugin().getLogger().log(Level.SEVERE, "Replay could not be started", e);
|
||||
}
|
||||
FightStatistics.lockReplay();
|
||||
FightUI.addSubtitle("REPLAY_LOCKED");
|
||||
return false;
|
||||
}
|
||||
}
|
@ -25,7 +25,7 @@ import de.steamwar.fightsystem.fight.Fight;
|
||||
import de.steamwar.fightsystem.fight.FightTeam;
|
||||
import de.steamwar.fightsystem.states.FightState;
|
||||
import de.steamwar.fightsystem.states.StateDependentCommand;
|
||||
import de.steamwar.sql.Schematic;
|
||||
import de.steamwar.sql.SchematicNode;
|
||||
import de.steamwar.sql.SchematicType;
|
||||
import de.steamwar.sql.SteamwarUser;
|
||||
import de.steamwar.sql.UserGroup;
|
||||
@ -67,7 +67,7 @@ public class LockschemCommand implements CommandExecutor {
|
||||
return false;
|
||||
}
|
||||
|
||||
Schematic.getSchemFromDB(fightTeam.getSchematic()).setSchemType(SchematicType.Normal);
|
||||
SchematicNode.getSchematicNode(fightTeam.getSchematic()).setSchemtype(SchematicType.Normal);
|
||||
FightSystem.getMessage().sendPrefixless("LOCKSCHEM_LOCKED", player, ChatMessageType.ACTION_BAR);
|
||||
fightTeam.broadcastSystem("LOCKSCHEM_LOCKED_BY", player.getName());
|
||||
return false;
|
||||
|
@ -31,7 +31,7 @@ public class EventSpectateCountdown extends Countdown {
|
||||
|
||||
public EventSpectateCountdown() {
|
||||
super(Config.SpectatorDuration, new Message("SHUTDOWN_COUNTDOWN"), SWSound.BLOCK_NOTE_PLING, false);
|
||||
new StateDependentCountdown(ArenaMode.Event, FightState.Spectate, this);
|
||||
new StateDependentCountdown(ArenaMode.NotRestartable.contains(Config.mode) && !Config.replayserver(), FightState.Spectate, this);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -31,7 +31,7 @@ public class SpectateOverCountdown extends Countdown {
|
||||
|
||||
public SpectateOverCountdown() {
|
||||
super(Config.SpectatorDuration, new Message("SPECTATE_COUNTDOWN"), SWSound.BLOCK_NOTE_PLING, false);
|
||||
new StateDependentCountdown(ArenaMode.Restartable, FightState.Spectate, this);
|
||||
new StateDependentCountdown(ArenaMode.Restartable.contains(Config.mode) || Config.replayserver(), FightState.Spectate, this);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -20,13 +20,13 @@
|
||||
package de.steamwar.fightsystem.fight;
|
||||
|
||||
import com.comphenix.tinyprotocol.Reflection;
|
||||
import com.comphenix.tinyprotocol.TinyProtocol;
|
||||
import com.mojang.authlib.GameProfile;
|
||||
import de.steamwar.core.Core;
|
||||
import de.steamwar.fightsystem.ArenaMode;
|
||||
import de.steamwar.fightsystem.Config;
|
||||
import de.steamwar.fightsystem.FightSystem;
|
||||
import de.steamwar.fightsystem.record.GlobalRecorder;
|
||||
import de.steamwar.fightsystem.utils.ProtocolAPI;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.GameMode;
|
||||
import org.bukkit.Sound;
|
||||
@ -146,7 +146,7 @@ public class Fight {
|
||||
|
||||
private static final Reflection.ConstructorInvoker playerInfoDataConstructor = Reflection.getConstructor(playerInfoDataClass, playerInfoPacket, GameProfile.class, int.class, enumGamemode, iChatBaseComponent);
|
||||
public static void pseudoSpectator(Player player, boolean enable) {
|
||||
ProtocolAPI.tinyProtocol.sendPacket(player, playerInfoPacket(updateGamemode, new GameProfile(player.getUniqueId(), player.getName()), enable ? creative : spectator));
|
||||
TinyProtocol.instance.sendPacket(player, playerInfoPacket(updateGamemode, new GameProfile(player.getUniqueId(), player.getName()), enable ? creative : spectator));
|
||||
}
|
||||
|
||||
public static Object playerInfoPacket(Object action, GameProfile profile, Object mode) {
|
||||
|
@ -31,7 +31,7 @@ import de.steamwar.fightsystem.states.StateDependent;
|
||||
import de.steamwar.fightsystem.utils.ColorConverter;
|
||||
import de.steamwar.fightsystem.utils.Region;
|
||||
import de.steamwar.fightsystem.utils.WorldeditWrapper;
|
||||
import de.steamwar.sql.Schematic;
|
||||
import de.steamwar.sql.SchematicNode;
|
||||
import org.bukkit.*;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.event.HandlerList;
|
||||
@ -67,13 +67,13 @@ public class FightSchematic extends StateDependent {
|
||||
return schematic;
|
||||
}
|
||||
|
||||
public void setSchematic(Schematic schem) {
|
||||
schematic = schem.getSchemID();
|
||||
public void setSchematic(SchematicNode schem) {
|
||||
schematic = schem.getId();
|
||||
try {
|
||||
clipboard = schem.load();
|
||||
} catch (IOException e) {
|
||||
team.broadcastSystem("SCHEMATIC_UNLOADABLE");
|
||||
Bukkit.getLogger().log(Level.SEVERE, e, () -> "Couldn't load Schematic " + schem.getSchemName());
|
||||
Bukkit.getLogger().log(Level.SEVERE, e, () -> "Couldn't load Schematic " + schem.getName());
|
||||
}
|
||||
}
|
||||
|
||||
@ -93,7 +93,7 @@ public class FightSchematic extends StateDependent {
|
||||
return;
|
||||
|
||||
if(clipboard == null){
|
||||
List<Schematic> publics = Schematic.getSchemsOfType(0, Config.SchematicType);
|
||||
List<SchematicNode> publics = SchematicNode.getAllSchematicsOfType(0, Config.SchematicType.toDB());
|
||||
if(publics.isEmpty())
|
||||
return;
|
||||
|
||||
@ -106,10 +106,12 @@ public class FightSchematic extends StateDependent {
|
||||
leader.getPlayer().getInventory().clear(0);
|
||||
}
|
||||
|
||||
if(team.isBlue())
|
||||
GlobalRecorder.getInstance().blueSchem(schematic);
|
||||
else
|
||||
GlobalRecorder.getInstance().redSchem(schematic);
|
||||
if(ArenaMode.AntiReplay.contains(Config.mode)) {
|
||||
if(team.isBlue())
|
||||
GlobalRecorder.getInstance().blueSchem(schematic);
|
||||
else
|
||||
GlobalRecorder.getInstance().redSchem(schematic);
|
||||
}
|
||||
|
||||
Bukkit.getScheduler().runTask(FightSystem.getPlugin(), this::paste);
|
||||
}
|
||||
|
@ -32,7 +32,8 @@ import de.steamwar.fightsystem.states.OneShotStateDependent;
|
||||
import de.steamwar.fightsystem.states.StateDependent;
|
||||
import de.steamwar.fightsystem.utils.*;
|
||||
import de.steamwar.inventory.SWItem;
|
||||
import de.steamwar.sql.Schematic;
|
||||
import de.steamwar.sql.SchematicNode;
|
||||
import de.steamwar.sql.SteamwarUser;
|
||||
import net.md_5.bungee.api.ChatMessageType;
|
||||
import org.bukkit.*;
|
||||
import org.bukkit.enchantments.Enchantment;
|
||||
@ -281,7 +282,7 @@ public class FightTeam {
|
||||
if(!silent)
|
||||
FightUI.addSubtitle("UI_LEADER_JOINS", prefix, leader.getPlayer().getName());
|
||||
|
||||
Optional<Integer> maxRank = Schematic.getSchemsOfType(leader.getPlayer().getUniqueId(), Config.SchematicType).stream().map(Schematic::getRank).max(Integer::compare);
|
||||
Optional<Integer> maxRank = SchematicNode.getAllAccessibleSchematicsOfType(SteamwarUser.get(leader.getPlayer().getUniqueId()).getId(), Config.SchematicType.toDB()).stream().map(SchematicNode::getRank).max(Integer::compare);
|
||||
if(Config.RanksEnabled)
|
||||
schemRank = maxRank.orElse(1);
|
||||
else
|
||||
@ -320,7 +321,7 @@ public class FightTeam {
|
||||
return ready;
|
||||
}
|
||||
|
||||
public void pasteSchem(Schematic schematic){
|
||||
public void pasteSchem(SchematicNode schematic){
|
||||
setSchem(schematic);
|
||||
testPasteAction();
|
||||
}
|
||||
@ -342,9 +343,9 @@ public class FightTeam {
|
||||
schematic.pasteTeamName();
|
||||
}
|
||||
|
||||
public void setSchem(Schematic schematic){
|
||||
public void setSchem(SchematicNode schematic){
|
||||
this.schematic.setSchematic(schematic);
|
||||
broadcast("SCHEMATIC_CHOSEN", Config.GameName, schematic.getSchemName());
|
||||
broadcast("SCHEMATIC_CHOSEN", Config.GameName, schematic.getName());
|
||||
}
|
||||
|
||||
public void setReady(boolean ready) {
|
||||
|
@ -30,6 +30,7 @@ import org.bukkit.World;
|
||||
import org.bukkit.WorldCreator;
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.entity.EntityType;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
public class FightWorld extends StateDependent {
|
||||
|
||||
@ -72,7 +73,12 @@ public class FightWorld extends StateDependent {
|
||||
|
||||
World backup = new WorldCreator(world.getName() + "/backup").createWorld();
|
||||
assert backup != null;
|
||||
Config.ArenaRegion.forEachChunk((x, z) -> CraftbukkitWrapper.impl.resetChunk(world, backup, x, z));
|
||||
Config.ArenaRegion.forEachChunk((x, z) -> {
|
||||
CraftbukkitWrapper.impl.resetChunk(world, backup, x, z);
|
||||
for(Player p : Bukkit.getOnlinePlayers()) {
|
||||
de.steamwar.core.CraftbukkitWrapper.impl.sendChunk(p, x, z);
|
||||
}
|
||||
});
|
||||
Bukkit.unloadWorld(backup, false);
|
||||
}
|
||||
}
|
@ -0,0 +1,25 @@
|
||||
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.Material;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.Listener;
|
||||
import org.bukkit.event.block.BlockFadeEvent;
|
||||
|
||||
public class BlockFadeListener implements Listener {
|
||||
|
||||
public BlockFadeListener() {
|
||||
new StateDependentListener(Config.DisableSnowMelt, FightState.All, this);
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onBlockFade(BlockFadeEvent event) {
|
||||
if (event.getBlock().getType() == Material.SNOW_BLOCK || event.getBlock().getType() == Material.SNOW || event.getBlock().getType() == Material.ICE) {
|
||||
event.setCancelled(true);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
@ -24,7 +24,7 @@ import de.steamwar.fightsystem.Config;
|
||||
import de.steamwar.fightsystem.FightSystem;
|
||||
import de.steamwar.fightsystem.states.FightState;
|
||||
import de.steamwar.fightsystem.states.StateDependentListener;
|
||||
import de.steamwar.sql.Schematic;
|
||||
import de.steamwar.sql.SchematicNode;
|
||||
import de.steamwar.sql.SteamwarUser;
|
||||
import de.steamwar.sql.UserGroup;
|
||||
import org.bukkit.Bukkit;
|
||||
@ -50,8 +50,8 @@ public class Check implements Listener {
|
||||
if(allowedToCheck(user))
|
||||
return;
|
||||
|
||||
Schematic schem = Schematic.getSchemFromDB(Config.CheckSchemID);
|
||||
if(user.getId() == schem.getSchemOwner())
|
||||
SchematicNode schem = SchematicNode.getSchematicNode(Config.CheckSchemID);
|
||||
if(user.getId() == schem.getOwner())
|
||||
return;
|
||||
|
||||
FightSystem.getMessage().send("CHECK_JOIN_DENIED", player);
|
||||
|
@ -24,6 +24,8 @@ import de.steamwar.fightsystem.Config;
|
||||
import de.steamwar.fightsystem.states.FightState;
|
||||
import de.steamwar.fightsystem.states.StateDependentListener;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.block.BlockFace;
|
||||
import org.bukkit.block.PistonMoveReaction;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.Listener;
|
||||
import org.bukkit.event.block.BlockPistonExtendEvent;
|
||||
@ -41,8 +43,10 @@ public class PistonListener implements Listener {
|
||||
|
||||
@EventHandler
|
||||
public void handlePistonExtend(BlockPistonExtendEvent e){
|
||||
BlockFace face = e.getDirection();
|
||||
for(Block block : e.getBlocks()){
|
||||
if(!Config.BlueExtendRegion.inRegion(block) && !Config.RedExtendRegion.inRegion(block)){
|
||||
Block target = block.getRelative(face);
|
||||
if(!Config.BlueExtendRegion.inRegion(target) && !Config.RedExtendRegion.inRegion(target) && block.getPistonMoveReaction() != PistonMoveReaction.BREAK) {
|
||||
e.setCancelled(true);
|
||||
return;
|
||||
}
|
||||
|
@ -26,21 +26,37 @@ import de.steamwar.fightsystem.FightSystem;
|
||||
import de.steamwar.fightsystem.fight.Fight;
|
||||
import de.steamwar.fightsystem.fight.FightTeam;
|
||||
import de.steamwar.fightsystem.states.FightState;
|
||||
import de.steamwar.fightsystem.states.OneShotStateDependent;
|
||||
import de.steamwar.fightsystem.states.StateDependentListener;
|
||||
import de.steamwar.fightsystem.utils.FlatteningWrapper;
|
||||
import de.steamwar.fightsystem.utils.Region;
|
||||
import de.steamwar.fightsystem.utils.WorldeditWrapper;
|
||||
import de.steamwar.sql.Schematic;
|
||||
import de.steamwar.sql.SchematicNode;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.Listener;
|
||||
import org.bukkit.event.player.PlayerJoinEvent;
|
||||
import org.bukkit.util.Vector;
|
||||
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
|
||||
public class PrepareSchem implements Listener {
|
||||
|
||||
private final Set<Vector> stationaryMovingPistons = new HashSet<>();
|
||||
|
||||
public PrepareSchem() {
|
||||
new OneShotStateDependent(ArenaMode.Prepare, FightState.PostSchemSetup, () -> Bukkit.getScheduler().runTaskLater(FightSystem.getPlugin(), () -> {
|
||||
stationaryMovingPistons.clear();
|
||||
World world = Bukkit.getWorlds().get(0);
|
||||
Fight.getUnrotated().getSchemRegion().forEach((x, y, z) -> {
|
||||
if(FlatteningWrapper.impl.checkPistonMoving(world.getBlockAt(x, y, z)))
|
||||
stationaryMovingPistons.add(new Vector(x, y, z));
|
||||
});
|
||||
}, 1));
|
||||
|
||||
new StateDependentListener(ArenaMode.Prepare, FightState.Setup, this){
|
||||
@Override
|
||||
public void disable() {
|
||||
@ -49,9 +65,9 @@ public class PrepareSchem implements Listener {
|
||||
Region region = Fight.getUnrotated().getExtendRegion();
|
||||
int minY = Fight.getUnrotated().getSchemRegion().getMinY();
|
||||
|
||||
Schematic schem;
|
||||
SchematicNode schem;
|
||||
try{
|
||||
schem = Schematic.getSchemFromDB(Config.PrepareSchemID);
|
||||
schem = SchematicNode.getSchematicNode(Config.PrepareSchemID);
|
||||
}catch(SecurityException e){
|
||||
FightSystem.getMessage().broadcast("PREPARE_SCHEM_DELETED");
|
||||
Bukkit.shutdown();
|
||||
@ -60,7 +76,7 @@ public class PrepareSchem implements Listener {
|
||||
|
||||
try{
|
||||
region.forEach((x, y, z) -> {
|
||||
if(FlatteningWrapper.impl.checkPistonMoving(world.getBlockAt(x, y, z))){
|
||||
if(FlatteningWrapper.impl.checkPistonMoving(world.getBlockAt(x, y, z)) && !stationaryMovingPistons.contains(new Vector(x, y, z))){
|
||||
FightSystem.getMessage().broadcast("PREPARE_ACTIVE_PISTON");
|
||||
Bukkit.shutdown();
|
||||
throw new IllegalStateException();
|
||||
@ -78,7 +94,7 @@ public class PrepareSchem implements Listener {
|
||||
throw new SecurityException("Could not save schem", e);
|
||||
}
|
||||
|
||||
schem.setSchemType(Config.SchematicType.checkType());
|
||||
schem.setSchemtype(Config.SchematicType.checkType());
|
||||
FightSystem.getMessage().broadcast("PREPARE_SENT_IN");
|
||||
Bukkit.shutdown();
|
||||
}
|
||||
|
@ -34,6 +34,7 @@ import org.bukkit.block.Block;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.Listener;
|
||||
import org.bukkit.event.block.BlockBreakEvent;
|
||||
import org.bukkit.event.block.BlockPlaceEvent;
|
||||
import org.bukkit.event.player.PlayerMoveEvent;
|
||||
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);
|
||||
}
|
||||
|
||||
@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) {
|
||||
boolean spectator = player.getGameMode() == GameMode.SPECTATOR;
|
||||
if(!spectator && playerTeam != null && playerTeam.canPlayerEntern(player))
|
||||
|
@ -21,18 +21,16 @@ package de.steamwar.fightsystem.record;
|
||||
|
||||
import com.sk89q.worldedit.extent.clipboard.Clipboard;
|
||||
import de.steamwar.core.Core;
|
||||
import de.steamwar.fightsystem.ArenaMode;
|
||||
import de.steamwar.fightsystem.Config;
|
||||
import de.steamwar.fightsystem.FightSystem;
|
||||
import de.steamwar.fightsystem.countdown.Countdown;
|
||||
import de.steamwar.fightsystem.countdown.EventSpectateCountdown;
|
||||
import de.steamwar.fightsystem.fight.Fight;
|
||||
import de.steamwar.fightsystem.fight.FightTeam;
|
||||
import de.steamwar.fightsystem.fight.FreezeWorld;
|
||||
import de.steamwar.fightsystem.listener.FightScoreboard;
|
||||
import de.steamwar.fightsystem.states.FightState;
|
||||
import de.steamwar.fightsystem.utils.*;
|
||||
import de.steamwar.sql.Schematic;
|
||||
import de.steamwar.sql.SchematicNode;
|
||||
import de.steamwar.sql.Team;
|
||||
import net.md_5.bungee.api.ChatMessageType;
|
||||
import net.md_5.bungee.api.chat.BaseComponent;
|
||||
@ -54,6 +52,7 @@ import java.util.logging.Level;
|
||||
|
||||
public class PacketProcessor {
|
||||
|
||||
|
||||
static boolean replaying = false;
|
||||
|
||||
public static boolean isReplaying(){
|
||||
@ -142,12 +141,7 @@ public class PacketProcessor {
|
||||
else if(team == 0x02)
|
||||
winner = Fight.getRedTeam();
|
||||
|
||||
if(Config.replayserver() || ArenaMode.AntiReplay.contains(Config.mode)) {
|
||||
FightSystem.setSpectateState(winner, "Replay ends", message.getMsg(), message.getParams());
|
||||
}else{
|
||||
FightUI.printWin(winner, message.getMsg(), message.getParams());
|
||||
new EventSpectateCountdown().enable();
|
||||
}
|
||||
FightSystem.setSpectateState(winner, "Replay ends", message.getMsg(), message.getParams());
|
||||
});
|
||||
}
|
||||
|
||||
@ -199,14 +193,17 @@ public class PacketProcessor {
|
||||
|
||||
private void entityMoves() throws IOException {
|
||||
int entityId = source.readInt();
|
||||
double locX = source.readDouble() - arenaMinX + Config.ArenaRegion.getMinX();
|
||||
double x = source.readDouble() - arenaMinX;
|
||||
double locY = source.readDouble() - arenaMinY + Config.BluePasteRegion.getMinY();
|
||||
double z = source.readDouble() - arenaMinZ;
|
||||
if(rotateZ)
|
||||
if(rotateZ) {
|
||||
x = Config.ArenaRegion.getSizeX() - x;
|
||||
z = Config.ArenaRegion.getSizeZ() - z;
|
||||
}
|
||||
double locX = x + Config.ArenaRegion.getMinX();
|
||||
double locZ = z + Config.ArenaRegion.getMinZ();
|
||||
float pitch = source.readFloat();
|
||||
float yaw = source.readFloat() + (rotateZ ? 360 : 0);
|
||||
float yaw = source.readFloat() + (rotateZ ? 180 : 0);
|
||||
byte headYaw = (byte)((source.readByte() + (rotateZ ? 128 : 0)) % 256);
|
||||
|
||||
execSync(() -> REntity.getEntity(entityId).move(locX, locY, locZ, pitch, yaw, headYaw));
|
||||
@ -241,7 +238,7 @@ public class PacketProcessor {
|
||||
private void entityVelocity() throws IOException {
|
||||
int entityId = source.readInt();
|
||||
|
||||
double dX = source.readDouble();
|
||||
double dX = rotateZ ? -source.readDouble() : source.readDouble();
|
||||
double dY = source.readDouble();
|
||||
double dZ = rotateZ ? -source.readDouble() : source.readDouble();
|
||||
|
||||
@ -310,8 +307,10 @@ public class PacketProcessor {
|
||||
int z = Byte.toUnsignedInt(source.readByte());
|
||||
int blockState = source.readShort();
|
||||
|
||||
if(rotateZ)
|
||||
if(rotateZ) {
|
||||
x = Config.ArenaRegion.getSizeX() - x;
|
||||
z = Config.ArenaRegion.getSizeZ() - z;
|
||||
}
|
||||
|
||||
setBlock(x + Config.ArenaRegion.getMinX(), y + Config.BluePasteRegion.getMinY(), z + Config.ArenaRegion.getMinZ(), blockState);
|
||||
}
|
||||
@ -322,8 +321,10 @@ public class PacketProcessor {
|
||||
int z = source.readInt() - arenaMinZ;
|
||||
int blockState = source.readInt();
|
||||
|
||||
if(rotateZ)
|
||||
if(rotateZ) {
|
||||
x = Config.ArenaRegion.getSizeX() - x;
|
||||
z = Config.ArenaRegion.getSizeZ() - z;
|
||||
}
|
||||
|
||||
setBlock(x + Config.ArenaRegion.getMinX(), y + Config.BluePasteRegion.getMinY(), z + Config.ArenaRegion.getMinZ(), blockState);
|
||||
}
|
||||
@ -336,18 +337,33 @@ public class PacketProcessor {
|
||||
}
|
||||
|
||||
private void particle() throws IOException {
|
||||
double x = source.readDouble();
|
||||
double y = source.readDouble();
|
||||
double z = source.readDouble();
|
||||
double x = source.readDouble() - arenaMinX;
|
||||
double y = source.readDouble() - arenaMinY;
|
||||
double z = source.readDouble() - arenaMinZ;
|
||||
String particleName = source.readUTF();
|
||||
|
||||
execSync(() -> BountifulWrapper.impl.spawnParticle(world, particleName, x, y, z));
|
||||
if(rotateZ) {
|
||||
x = Config.ArenaRegion.getSizeX() - x;
|
||||
z = Config.ArenaRegion.getSizeZ() - z;
|
||||
}
|
||||
|
||||
double finalX = x;
|
||||
double finalZ = z;
|
||||
execSync(() -> BountifulWrapper.impl.spawnParticle(world, particleName, finalX + Config.ArenaRegion.getMinX(), y + Config.BluePasteRegion.getMinY(), finalZ + Config.ArenaRegion.getMinZ()));
|
||||
}
|
||||
|
||||
private void sound() throws IOException {
|
||||
int x = source.readInt();
|
||||
int y = source.readInt();
|
||||
int z = source.readInt();
|
||||
int rawX = source.readInt() - arenaMinX + Config.ArenaRegion.getMinX();
|
||||
int y = source.readInt() - arenaMinY + Config.BluePasteRegion.getMinY();
|
||||
int rawZ = source.readInt() - arenaMinZ;
|
||||
|
||||
if(rotateZ) {
|
||||
rawX = Config.ArenaRegion.getSizeX() - rawX;
|
||||
rawZ = Config.ArenaRegion.getSizeZ() - rawZ;
|
||||
}
|
||||
|
||||
int x = rawX + Config.ArenaRegion.getMinX();
|
||||
int z = rawZ + Config.ArenaRegion.getMinZ();
|
||||
|
||||
String soundName = source.readUTF();
|
||||
String soundCategory = source.readUTF();
|
||||
@ -374,12 +390,12 @@ public class PacketProcessor {
|
||||
private void pasteSchem(FightTeam team) throws IOException {
|
||||
int schemId = source.readInt();
|
||||
|
||||
execSync(() -> team.pasteSchem(Schematic.getSchemFromDB(schemId)));
|
||||
execSync(() -> team.pasteSchem(SchematicNode.getSchematicNode(schemId)));
|
||||
}
|
||||
|
||||
private void pasteEmbeddedSchem(FightTeam team) throws IOException {
|
||||
int schemId = source.readInt();
|
||||
Clipboard clipboard = Schematic.clipboardFromStream(source, Core.getVersion() > 12);
|
||||
Clipboard clipboard = SchematicNode.clipboardFromStream(source, Core.getVersion() > 12);
|
||||
|
||||
execSync(() -> team.pasteSchem(schemId, clipboard));
|
||||
}
|
||||
@ -445,17 +461,13 @@ public class PacketProcessor {
|
||||
p.resetTitle();
|
||||
WorldOfColorWrapper.impl.sendTitle(p, title, subtitle, 5, 40, 5);
|
||||
});
|
||||
if(Config.replayserver() || ArenaMode.AntiReplay.contains(Config.mode)) {
|
||||
FightState.setFightState(FightState.SPECTATE);
|
||||
}else{
|
||||
new EventSpectateCountdown().enable();
|
||||
}
|
||||
}
|
||||
|
||||
private void endReplay() {
|
||||
REntity.dieAll();
|
||||
freezer.disable();
|
||||
FightSystem.getMessage().broadcast("REPLAY_ENDS");
|
||||
FightState.setFightState(FightState.SPECTATE);
|
||||
replaying = false;
|
||||
}
|
||||
|
||||
@ -502,7 +514,7 @@ public class PacketProcessor {
|
||||
} catch (EOFException e) {
|
||||
Bukkit.getLogger().log(Level.INFO, "The FightServer is offline");
|
||||
source.close();
|
||||
} catch(IOException e) {
|
||||
} catch(Exception e) {
|
||||
Bukkit.getLogger().log(Level.WARNING, "Could not recieve packet", e);
|
||||
source.close();
|
||||
}
|
||||
|
@ -20,8 +20,10 @@
|
||||
package de.steamwar.fightsystem.record;
|
||||
|
||||
import com.comphenix.tinyprotocol.Reflection;
|
||||
import com.comphenix.tinyprotocol.TinyProtocol;
|
||||
import com.mojang.authlib.GameProfile;
|
||||
import de.steamwar.core.Core;
|
||||
import de.steamwar.fightsystem.FightSystem;
|
||||
import de.steamwar.fightsystem.fight.Fight;
|
||||
import de.steamwar.fightsystem.listener.FightScoreboard;
|
||||
import de.steamwar.fightsystem.utils.BlockIdWrapper;
|
||||
@ -38,6 +40,7 @@ import org.bukkit.scoreboard.NameTagVisibility;
|
||||
import org.bukkit.scoreboard.Team;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.logging.Level;
|
||||
|
||||
public class REntity {
|
||||
|
||||
@ -72,22 +75,22 @@ public class REntity {
|
||||
public static void playerJoins(Player player) {
|
||||
for(REntity entity : entities.values()){
|
||||
if(entity.entityType == EntityType.PLAYER){
|
||||
ProtocolAPI.tinyProtocol.sendPacket(player, entity.getPlayerInfoPacket());
|
||||
ProtocolAPI.tinyProtocol.sendPacket(player, entity.getNamedSpawnPacket());
|
||||
TinyProtocol.instance.sendPacket(player, entity.getPlayerInfoPacket());
|
||||
TinyProtocol.instance.sendPacket(player, entity.getNamedSpawnPacket());
|
||||
for (Map.Entry<String, ItemStack> entry : entity.itemSlots.entrySet()) {
|
||||
ProtocolAPI.tinyProtocol.sendPacket(player, entity.getEquipmentPacket(entry.getKey(), entry.getValue()));
|
||||
TinyProtocol.instance.sendPacket(player, entity.getEquipmentPacket(entry.getKey(), entry.getValue()));
|
||||
}
|
||||
}else{
|
||||
ProtocolAPI.tinyProtocol.sendPacket(player, entity.getSpawnEntityPacket());
|
||||
TinyProtocol.instance.sendPacket(player, entity.getSpawnEntityPacket());
|
||||
}
|
||||
ProtocolAPI.tinyProtocol.sendPacket(player, entity.getTeleportPacket());
|
||||
ProtocolAPI.tinyProtocol.sendPacket(player, entity.getHeadRotationPacket());
|
||||
TinyProtocol.instance.sendPacket(player, entity.getTeleportPacket());
|
||||
TinyProtocol.instance.sendPacket(player, entity.getHeadRotationPacket());
|
||||
|
||||
if(entity.fireTick != 0) {
|
||||
ProtocolAPI.tinyProtocol.sendPacket(player, entity.getDataWatcherPacket(entityStatusWatcher, (byte) 1));
|
||||
TinyProtocol.instance.sendPacket(player, entity.getDataWatcherPacket(entityStatusWatcher, (byte) 1));
|
||||
}
|
||||
if(entity.sneaks) {
|
||||
ProtocolAPI.tinyProtocol.sendPacket(player, entity.getDataWatcherPacket(sneakingDataWatcher, BlockIdWrapper.impl.getPose(true)));
|
||||
TinyProtocol.instance.sendPacket(player, entity.getDataWatcherPacket(sneakingDataWatcher, BlockIdWrapper.impl.getPose(true)));
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -132,7 +135,14 @@ public class REntity {
|
||||
this.entityType = EntityType.PLAYER;
|
||||
this.entityId = entityCount--;
|
||||
|
||||
SteamwarUser user = SteamwarUser.get(userId);
|
||||
SteamwarUser user;
|
||||
try {
|
||||
user = SteamwarUser.get(userId);
|
||||
} catch (SecurityException e) {
|
||||
FightSystem.getPlugin().getLogger().log(Level.SEVERE, "Could not load user " + userId);
|
||||
throw e;
|
||||
}
|
||||
|
||||
this.uuid = user.getUUID();
|
||||
this.name = user.getUserName();
|
||||
entities.put(internalId, this);
|
||||
|
@ -29,7 +29,7 @@ import de.steamwar.fightsystem.utils.BlockIdWrapper;
|
||||
import de.steamwar.fightsystem.utils.CraftbukkitWrapper;
|
||||
import de.steamwar.fightsystem.utils.Message;
|
||||
import de.steamwar.fightsystem.utils.SWSound;
|
||||
import de.steamwar.sql.Schematic;
|
||||
import de.steamwar.sql.SchematicNode;
|
||||
import de.steamwar.sql.SteamwarUser;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Location;
|
||||
@ -275,7 +275,7 @@ public interface Recorder {
|
||||
|
||||
ByteArrayOutputStream buffer = new ByteArrayOutputStream();
|
||||
try{
|
||||
copy(Schematic.getSchemFromDB(schemId).schemData(), buffer);
|
||||
copy(SchematicNode.getSchematicNode(schemId).schemData(), buffer);
|
||||
}catch (EOFException e) {
|
||||
Bukkit.getLogger().log(Level.INFO, "EOFException ignored");
|
||||
} catch (IOException e) {
|
||||
|
@ -43,7 +43,11 @@ public class StateDependentCountdown extends StateDependent {
|
||||
}
|
||||
|
||||
public StateDependentCountdown(Winconditions wincondition, Set<FightState> states, Countdown countdown) {
|
||||
super(Config.ActiveWinconditions.contains(wincondition), states);
|
||||
this(Config.ActiveWinconditions.contains(wincondition), states, countdown);
|
||||
}
|
||||
|
||||
public StateDependentCountdown(boolean active, Set<FightState> states, Countdown countdown) {
|
||||
super(active, states);
|
||||
this.countdown = countdown;
|
||||
register();
|
||||
}
|
||||
|
@ -31,13 +31,14 @@ import de.steamwar.fightsystem.states.FightState;
|
||||
import de.steamwar.fightsystem.states.OneShotStateDependent;
|
||||
import de.steamwar.fightsystem.winconditions.Wincondition;
|
||||
import de.steamwar.sql.Elo;
|
||||
import de.steamwar.sql.Schematic;
|
||||
import de.steamwar.sql.SchematicNode;
|
||||
import de.steamwar.sql.SteamwarUser;
|
||||
import org.bukkit.Bukkit;
|
||||
|
||||
import java.io.FileInputStream;
|
||||
import java.sql.Timestamp;
|
||||
import java.time.Instant;
|
||||
import java.time.temporal.ChronoUnit;
|
||||
import java.util.logging.Level;
|
||||
|
||||
import static de.steamwar.sql.Fight.create;
|
||||
@ -46,9 +47,14 @@ import static de.steamwar.sql.Fight.setReplay;
|
||||
public class FightStatistics {
|
||||
|
||||
private static final int K = 20;
|
||||
private static boolean replayLock = false;
|
||||
|
||||
private Timestamp starttime = Timestamp.from(Instant.now());
|
||||
|
||||
public static void lockReplay() {
|
||||
replayLock = true;
|
||||
}
|
||||
|
||||
public FightStatistics() {
|
||||
new OneShotStateDependent(ArenaMode.SeriousFight, FightState.Running, this::enable);
|
||||
new OneShotStateDependent(ArenaMode.Event, FightState.Spectate, this::setEventResult);
|
||||
@ -91,12 +97,12 @@ public class FightStatistics {
|
||||
Integer blueSchem;
|
||||
Integer redSchem;
|
||||
try{
|
||||
blueSchem = Schematic.getSchemFromDB(Fight.getBlueTeam().getSchematic()).getSchemID();
|
||||
blueSchem = SchematicNode.getSchematicNode(Fight.getBlueTeam().getSchematic()).getId();
|
||||
}catch(SecurityException e){
|
||||
blueSchem = null;
|
||||
}
|
||||
try{
|
||||
redSchem = Schematic.getSchemFromDB(Fight.getRedTeam().getSchematic()).getSchemID();
|
||||
redSchem = SchematicNode.getSchematicNode(Fight.getRedTeam().getSchematic()).getId();
|
||||
}catch(SecurityException e){
|
||||
redSchem = null;
|
||||
}
|
||||
@ -109,21 +115,26 @@ public class FightStatistics {
|
||||
|
||||
try {
|
||||
int fightId = create(gameMode, Bukkit.getWorlds().get(0).getName(), starttime, remainingTime,
|
||||
blueLeader, redLeader, blueSchem, redSchem, win, windescription);
|
||||
blueLeader, redLeader, blueSchem, redSchem, win, windescription, Timestamp.from(Instant.now().plus(replayLock ? 30 : 0, ChronoUnit.DAYS)));
|
||||
|
||||
for (FightPlayer fp : Fight.getBlueTeam().getPlayers())
|
||||
savePlayerStats(fp, fightId);
|
||||
for (FightPlayer fp : Fight.getRedTeam().getPlayers())
|
||||
savePlayerStats(fp, fightId);
|
||||
|
||||
setReplay(fightId, new FileInputStream(FileRecorder.getFile()));
|
||||
|
||||
if(ArenaMode.Event.contains(Config.mode)) {
|
||||
FightSystem.getEventFight().setFight(fightId);
|
||||
}
|
||||
|
||||
try {
|
||||
setReplay(fightId, new FileInputStream(FileRecorder.getFile()));
|
||||
}catch(Exception e){
|
||||
Bukkit.getLogger().log(Level.INFO, "Failed to save replay", e);
|
||||
}
|
||||
}catch(Exception e){
|
||||
Bukkit.getLogger().log(Level.SEVERE, "Failed to save statistics", e);
|
||||
}
|
||||
replayLock = false;
|
||||
|
||||
if(Config.Ranked){
|
||||
int blueElo = Elo.getElo(blueLeader, gameMode);
|
||||
|
@ -20,8 +20,6 @@
|
||||
package de.steamwar.fightsystem.utils;
|
||||
|
||||
import com.comphenix.tinyprotocol.TinyProtocol;
|
||||
import de.steamwar.fightsystem.FightSystem;
|
||||
import io.netty.channel.Channel;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
@ -42,23 +40,20 @@ public class ProtocolAPI {
|
||||
private static final Map<Class<?>, BiFunction<Player, Object, Object>> outgoingHandler = new HashMap<>();
|
||||
private static final Map<Class<?>, BiFunction<Player, Object, Object>> incomingHandler = new HashMap<>();
|
||||
|
||||
public static final TinyProtocol tinyProtocol = new TinyProtocol(FightSystem.getPlugin()) {
|
||||
@Override
|
||||
public Object onPacketOutAsync(Player receiver, Channel channel, Object packet) {
|
||||
static {
|
||||
TinyProtocol.instance.setOutFilter((receiver, channel, packet) -> {
|
||||
BiFunction<Player, Object, Object> handler = outgoingHandler.get(packet.getClass());
|
||||
if(handler == null)
|
||||
return packet;
|
||||
return handler.apply(receiver, packet);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object onPacketInAsync(Player sender, Channel channel, Object packet) {
|
||||
});
|
||||
TinyProtocol.instance.setInFilter((sender, channel, packet) -> {
|
||||
BiFunction<Player, Object, Object> handler = incomingHandler.get(packet.getClass());
|
||||
if(handler == null)
|
||||
return packet;
|
||||
return handler.apply(sender, packet);
|
||||
}
|
||||
};
|
||||
});
|
||||
}
|
||||
|
||||
public static void setOutgoingHandler(Class<?> packetClass, BiFunction<Player, Object, Object> handler) {
|
||||
outgoingHandler.put(packetClass, handler);
|
||||
@ -77,7 +72,7 @@ public class ProtocolAPI {
|
||||
}
|
||||
|
||||
public static void broadcastPacket(Object packet) {
|
||||
Bukkit.getOnlinePlayers().stream().map(tinyProtocol::getChannel).filter(tinyProtocol::hasInjected).forEach(channel -> tinyProtocol.sendPacket(channel, packet));
|
||||
Bukkit.getOnlinePlayers().stream().map(TinyProtocol.instance::getChannel).filter(TinyProtocol.instance::hasInjected).forEach(channel -> TinyProtocol.instance.sendPacket(channel, packet));
|
||||
}
|
||||
|
||||
public static BiFunction<Object, UnaryOperator<Object>, Object> arrayCloneGenerator(Class<?> elementClass) {
|
||||
|
@ -22,8 +22,8 @@ package de.steamwar.fightsystem.utils;
|
||||
import com.comphenix.tinyprotocol.Reflection;
|
||||
import com.google.common.primitives.Bytes;
|
||||
import de.steamwar.core.Core;
|
||||
import de.steamwar.core.CraftbukkitWrapper;
|
||||
import de.steamwar.core.VersionDependent;
|
||||
import de.steamwar.core.events.ChunkListener;
|
||||
import de.steamwar.fightsystem.Config;
|
||||
import de.steamwar.fightsystem.FightSystem;
|
||||
import de.steamwar.fightsystem.fight.Fight;
|
||||
@ -236,7 +236,7 @@ public class TechHider extends StateDependent {
|
||||
Bukkit.getScheduler().runTaskLater(FightSystem.getPlugin(), () -> {
|
||||
for(ChunkPos chunk : chunksToReload){
|
||||
if(bypass(p, chunk.x(), chunk.z()) != hide)
|
||||
ChunkListener.sendChunk(p, chunk.x(), chunk.z());
|
||||
CraftbukkitWrapper.impl.sendChunk(p, chunk.x(), chunk.z());
|
||||
}
|
||||
}, 40);
|
||||
}
|
||||
|
@ -24,7 +24,7 @@ import com.sk89q.worldedit.extent.clipboard.Clipboard;
|
||||
import com.sk89q.worldedit.math.transform.AffineTransform;
|
||||
import de.steamwar.core.VersionDependent;
|
||||
import de.steamwar.fightsystem.FightSystem;
|
||||
import de.steamwar.sql.Schematic;
|
||||
import de.steamwar.sql.SchematicNode;
|
||||
import org.bukkit.DyeColor;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.util.Vector;
|
||||
@ -42,6 +42,6 @@ public class WorldeditWrapper {
|
||||
void pasteClipboard(Clipboard clipboard, Location position, Vector offset, AffineTransform aT);
|
||||
Vector getDimensions(Clipboard clipboard);
|
||||
Clipboard loadChar(String charName) throws IOException;
|
||||
void saveSchem(Schematic schem, Region region, int minY) throws WorldEditException;
|
||||
void saveSchem(SchematicNode schem, Region region, int minY) throws WorldEditException;
|
||||
}
|
||||
}
|
||||
|
@ -18,7 +18,7 @@ commands:
|
||||
remove:
|
||||
leader:
|
||||
lockschem:
|
||||
replay:
|
||||
lockreplay:
|
||||
state:
|
||||
skip:
|
||||
win:
|
In neuem Issue referenzieren
Einen Benutzer sperren