SteamWar/FightSystem
Archiviert
13
1

1.18 #323

Zusammengeführt
Lixfel hat 8 Commits von 1.18 nach master 2022-02-19 19:38:32 +01:00 zusammengeführt
37 geänderte Dateien mit 226 neuen und 187 gelöschten Zeilen
Nur Änderungen aus Commit 55b4dad1e4 werden angezeigt - Alle Commits anzeigen

Datei anzeigen

@ -19,10 +19,8 @@
package de.steamwar.fightsystem.utils; package de.steamwar.fightsystem.utils;
import de.steamwar.core.events.ChunkListener;
import de.steamwar.fightsystem.fight.FightWorld; import de.steamwar.fightsystem.fight.FightWorld;
import net.minecraft.server.v1_10_R1.Chunk; import net.minecraft.server.v1_10_R1.Chunk;
import org.bukkit.Bukkit;
import org.bukkit.World; import org.bukkit.World;
import org.bukkit.craftbukkit.v1_10_R1.CraftWorld; import org.bukkit.craftbukkit.v1_10_R1.CraftWorld;
import org.bukkit.craftbukkit.v1_10_R1.entity.CraftEntity; import org.bukkit.craftbukkit.v1_10_R1.entity.CraftEntity;
@ -50,9 +48,6 @@ public class CraftbukkitWrapper10 implements CraftbukkitWrapper.ICraftbukkitWrap
} }
chunk.tileEntities.clear(); chunk.tileEntities.clear();
chunk.tileEntities.putAll(backupChunk.tileEntities); chunk.tileEntities.putAll(backupChunk.tileEntities);
for(Player p : Bukkit.getOnlinePlayers()){
ChunkListener.sendChunk(p, x, z);
}
} }
@Override @Override

Datei anzeigen

@ -19,10 +19,8 @@
package de.steamwar.fightsystem.utils; package de.steamwar.fightsystem.utils;
import de.steamwar.core.events.ChunkListener;
import de.steamwar.fightsystem.fight.FightWorld; import de.steamwar.fightsystem.fight.FightWorld;
import net.minecraft.server.v1_12_R1.Chunk; import net.minecraft.server.v1_12_R1.Chunk;
import org.bukkit.Bukkit;
import org.bukkit.World; import org.bukkit.World;
import org.bukkit.craftbukkit.v1_12_R1.CraftWorld; import org.bukkit.craftbukkit.v1_12_R1.CraftWorld;
import org.bukkit.craftbukkit.v1_12_R1.entity.CraftEntity; import org.bukkit.craftbukkit.v1_12_R1.entity.CraftEntity;
@ -50,9 +48,6 @@ public class CraftbukkitWrapper12 implements CraftbukkitWrapper.ICraftbukkitWrap
} }
chunk.tileEntities.clear(); chunk.tileEntities.clear();
chunk.tileEntities.putAll(backupChunk.tileEntities); chunk.tileEntities.putAll(backupChunk.tileEntities);
for(Player p : Bukkit.getOnlinePlayers()){
ChunkListener.sendChunk(p, x, z);
}
} }
@Override @Override

Datei anzeigen

@ -19,10 +19,8 @@
package de.steamwar.fightsystem.utils; package de.steamwar.fightsystem.utils;
import de.steamwar.core.events.ChunkListener;
import de.steamwar.fightsystem.fight.FightWorld; import de.steamwar.fightsystem.fight.FightWorld;
import net.minecraft.server.v1_14_R1.Chunk; import net.minecraft.server.v1_14_R1.Chunk;
import org.bukkit.Bukkit;
import org.bukkit.World; import org.bukkit.World;
import org.bukkit.craftbukkit.v1_14_R1.CraftWorld; import org.bukkit.craftbukkit.v1_14_R1.CraftWorld;
import org.bukkit.craftbukkit.v1_14_R1.entity.CraftEntity; 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.tileEntities.putAll(backupChunk.tileEntities);
chunk.heightMap.clear(); chunk.heightMap.clear();
chunk.heightMap.putAll(backupChunk.heightMap); chunk.heightMap.putAll(backupChunk.heightMap);
for(Player p : Bukkit.getOnlinePlayers()){
ChunkListener.sendChunk(p, x, z);
}
} }
@Override @Override

Datei anzeigen

@ -41,7 +41,7 @@ import com.sk89q.worldedit.world.World;
import com.sk89q.worldedit.world.block.BaseBlock; import com.sk89q.worldedit.world.block.BaseBlock;
import com.sk89q.worldedit.world.block.BlockTypes; import com.sk89q.worldedit.world.block.BlockTypes;
import de.steamwar.fightsystem.FightSystem; import de.steamwar.fightsystem.FightSystem;
import de.steamwar.sql.Schematic; import de.steamwar.sql.SchematicNode;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
import org.bukkit.DyeColor; import org.bukkit.DyeColor;
import org.bukkit.Location; import org.bukkit.Location;
@ -122,7 +122,7 @@ public class WorldeditWrapper14 implements WorldeditWrapper.IWorldeditWrapper {
} }
@Override @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)); World w = new BukkitWorld(Bukkit.getWorlds().get(0));
BlockVector3 min = BlockVector3.at(region.getMinX(), minY, region.getMinZ()); 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)); CuboidRegion cuboidRegion = new CuboidRegion(w, min, BlockVector3.at(region.getMaxX(), region.getMaxY(), region.getMaxZ()).subtract(BlockVector3.ONE));

Datei anzeigen

@ -19,10 +19,8 @@
package de.steamwar.fightsystem.utils; package de.steamwar.fightsystem.utils;
import de.steamwar.core.events.ChunkListener;
import de.steamwar.fightsystem.fight.FightWorld; import de.steamwar.fightsystem.fight.FightWorld;
import net.minecraft.server.v1_15_R1.Chunk; import net.minecraft.server.v1_15_R1.Chunk;
import org.bukkit.Bukkit;
import org.bukkit.World; import org.bukkit.World;
import org.bukkit.craftbukkit.v1_15_R1.CraftWorld; import org.bukkit.craftbukkit.v1_15_R1.CraftWorld;
import org.bukkit.craftbukkit.v1_15_R1.entity.CraftEntity; 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.tileEntities.putAll(backupChunk.tileEntities);
chunk.heightMap.clear(); chunk.heightMap.clear();
chunk.heightMap.putAll(backupChunk.heightMap); chunk.heightMap.putAll(backupChunk.heightMap);
for(Player p : Bukkit.getOnlinePlayers()){
ChunkListener.sendChunk(p, x, z);
}
} }
@Override @Override

Datei anzeigen

@ -19,9 +19,7 @@
package de.steamwar.fightsystem.utils; package de.steamwar.fightsystem.utils;
import de.steamwar.core.events.ChunkListener;
import net.minecraft.server.v1_8_R3.Chunk; import net.minecraft.server.v1_8_R3.Chunk;
import org.bukkit.Bukkit;
import org.bukkit.World; import org.bukkit.World;
import org.bukkit.craftbukkit.v1_8_R3.CraftWorld; import org.bukkit.craftbukkit.v1_8_R3.CraftWorld;
import org.bukkit.craftbukkit.v1_8_R3.entity.CraftEntity; 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()); w.tileEntityList.removeAll(chunk.tileEntities.values());
chunk.tileEntities.clear(); chunk.tileEntities.clear();
chunk.tileEntities.putAll(backupChunk.tileEntities); chunk.tileEntities.putAll(backupChunk.tileEntities);
for(Player p : Bukkit.getOnlinePlayers()){
ChunkListener.sendChunk(p, x, z);
}
} }
@Override @Override

Datei anzeigen

@ -38,7 +38,7 @@ import com.sk89q.worldedit.regions.CuboidRegion;
import com.sk89q.worldedit.session.ClipboardHolder; import com.sk89q.worldedit.session.ClipboardHolder;
import com.sk89q.worldedit.world.World; import com.sk89q.worldedit.world.World;
import de.steamwar.fightsystem.FightSystem; import de.steamwar.fightsystem.FightSystem;
import de.steamwar.sql.Schematic; import de.steamwar.sql.SchematicNode;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
import org.bukkit.DyeColor; import org.bukkit.DyeColor;
import org.bukkit.Location; import org.bukkit.Location;
@ -121,7 +121,7 @@ public class WorldeditWrapper8 implements WorldeditWrapper.IWorldeditWrapper {
} }
@Override @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)); World w = new BukkitWorld(Bukkit.getWorlds().get(0));
Vector min = new Vector(region.getMinX(), minY, region.getMinZ()); 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)); CuboidRegion cuboidRegion = new CuboidRegion(w, min, new Vector(region.getMaxX(), region.getMaxY(), region.getMaxZ()).subtract(Vector.ONE));

Datei anzeigen

@ -19,10 +19,8 @@
package de.steamwar.fightsystem.utils; package de.steamwar.fightsystem.utils;
import de.steamwar.core.events.ChunkListener;
import de.steamwar.fightsystem.fight.FightWorld; import de.steamwar.fightsystem.fight.FightWorld;
import net.minecraft.server.v1_9_R2.Chunk; import net.minecraft.server.v1_9_R2.Chunk;
import org.bukkit.Bukkit;
import org.bukkit.World; import org.bukkit.World;
import org.bukkit.craftbukkit.v1_9_R2.CraftWorld; import org.bukkit.craftbukkit.v1_9_R2.CraftWorld;
import org.bukkit.craftbukkit.v1_9_R2.entity.CraftEntity; import org.bukkit.craftbukkit.v1_9_R2.entity.CraftEntity;
@ -50,9 +48,6 @@ public class CraftbukkitWrapper9 implements CraftbukkitWrapper.ICraftbukkitWrapp
} }
chunk.tileEntities.clear(); chunk.tileEntities.clear();
chunk.tileEntities.putAll(backupChunk.tileEntities); chunk.tileEntities.putAll(backupChunk.tileEntities);
for(Player p : Bukkit.getOnlinePlayers()){
ChunkListener.sendChunk(p, x, z);
}
} }
@Override @Override

Datei anzeigen

@ -41,6 +41,8 @@ Arena:
BorderFromSchematic: 12 # defaults to 12 if missing BorderFromSchematic: 12 # defaults to 12 if missing
# If ground walkable, teams can walk below the lower arena border during setup # If ground walkable, teams can walk below the lower arena border during setup
GroundWalkable: true # defaults to true if missing GroundWalkable: true # defaults to true if missing
# Disable snow and ice melting
DisableSnowMelt: false # defaults to false if missing
Schematic: Schematic:
# The size of the schematics # The size of the schematics
@ -52,6 +54,8 @@ Schematic:
Type: Normal # defaults to Normal if missing Type: Normal # defaults to Normal if missing
# Shortcut of the schematic type # Shortcut of the schematic type
Shortcut: "" # defaults to "" if missing 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 # If the schematics should be rotated during pasting
Rotate: true # defaults to true if missing Rotate: true # defaults to true if missing
# If the schematics should be pasted aligned to the borders instead of centered # If the schematics should be pasted aligned to the borders instead of centered

Datei anzeigen

@ -43,13 +43,13 @@ public enum ArenaMode {
public static final Set<ArenaMode> Replay = Collections.unmodifiableSet(EnumSet.of(REPLAY)); 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> 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> 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> 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(RANKED, EVENT, REPLAY))); 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> 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> 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> 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> 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))); public static final Set<ArenaMode> SeriousFight = Collections.unmodifiableSet(EnumSet.complementOf(EnumSet.of(TEST, CHECK, REPLAY)));

Datei anzeigen

@ -69,6 +69,7 @@ public class Config {
public static final int PreperationArea; public static final int PreperationArea;
public static final int WaterDepth; public static final int WaterDepth;
public static final boolean GroundWalkable; public static final boolean GroundWalkable;
public static final boolean DisableSnowMelt;
//schematic parameter //schematic parameter
public static final boolean RanksEnabled; public static final boolean RanksEnabled;
@ -164,6 +165,7 @@ public class Config {
int schem2BorderZ = config.getInt("Arena.Schem2Border.z", 24); int schem2BorderZ = config.getInt("Arena.Schem2Border.z", 24);
PreperationArea = config.getInt("Arena.BorderFromSchematic", 12); PreperationArea = config.getInt("Arena.BorderFromSchematic", 12);
GroundWalkable = config.getBoolean("Arena.GroundWalkable", true); GroundWalkable = config.getBoolean("Arena.GroundWalkable", true);
DisableSnowMelt = config.getBoolean("Arena.DisableSnowMelt", false);
int schemsizeX = config.getInt("Schematic.Size.x"); int schemsizeX = config.getInt("Schematic.Size.x");
int schemsizeY = config.getInt("Schematic.Size.y"); int schemsizeY = config.getInt("Schematic.Size.y");

Datei anzeigen

@ -33,7 +33,7 @@ import de.steamwar.fightsystem.utils.*;
import de.steamwar.fightsystem.winconditions.*; import de.steamwar.fightsystem.winconditions.*;
import de.steamwar.message.Message; import de.steamwar.message.Message;
import de.steamwar.sql.EventFight; import de.steamwar.sql.EventFight;
import de.steamwar.sql.Schematic; import de.steamwar.sql.SchematicNode;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.plugin.java.JavaPlugin; import org.bukkit.plugin.java.JavaPlugin;
@ -84,6 +84,7 @@ public class FightSystem extends JavaPlugin {
new PersonalKitCreator(); new PersonalKitCreator();
new ArrowStopper(); new ArrowStopper();
new ArrowPickup(); new ArrowPickup();
new BlockFadeListener();
new EnterHandler(); new EnterHandler();
new TechHider(); new TechHider();
@ -127,7 +128,7 @@ public class FightSystem extends JavaPlugin {
new AkCommand(); new AkCommand();
new LeaderCommand(); new LeaderCommand();
new LockschemCommand(); new LockschemCommand();
new ReplayCommand(); new LockReplayCommand();
new StateCommand(); new StateCommand();
new SkipCommand(); new SkipCommand();
new WinCommand(); new WinCommand();
@ -140,9 +141,9 @@ public class FightSystem extends JavaPlugin {
if(Config.mode == ArenaMode.EVENT) { if(Config.mode == ArenaMode.EVENT) {
setPreSchemState(); setPreSchemState();
}else if(Config.mode == ArenaMode.CHECK){ }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) { }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) { }else if(Config.mode == ArenaMode.REPLAY) {
FightWorld.forceLoad(); FightWorld.forceLoad();
FileSource.startReplay(); FileSource.startReplay();
@ -151,7 +152,6 @@ public class FightSystem extends JavaPlugin {
@Override @Override
public void onDisable() { public void onDisable() {
ProtocolAPI.tinyProtocol.close();
GlobalRecorder.getInstance().close(); GlobalRecorder.getInstance().close();
} }

Datei anzeigen

@ -53,7 +53,7 @@ LOCKSCHEM_LOCKED_BY=
REMOVE_HELP=§8/§eremove §8[§eSpieler§8] 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 NOT_FIGHTLEADER=§cDu bist nicht Kampfleiter
WIN_HELP=§8/§7win §8[§eTeam §8or §etie§8] WIN_HELP=§8/§7win §8[§eTeam §8or §etie§8]

Datei anzeigen

@ -63,7 +63,7 @@ public class Commands {
return fightPlayer; return fightPlayer;
} }
private static FightPlayer checkGetLeader(Player p){ public static FightPlayer checkGetLeader(Player p){
FightPlayer fightPlayer = checkGetPlayer(p); FightPlayer fightPlayer = checkGetPlayer(p);
if(fightPlayer != null && !fightPlayer.isLeader()){ if(fightPlayer != null && !fightPlayer.isLeader()){
FightSystem.getMessage().sendPrefixless("NOT_LEADER", p, ChatMessageType.ACTION_BAR); FightSystem.getMessage().sendPrefixless("NOT_LEADER", p, ChatMessageType.ACTION_BAR);
@ -72,7 +72,7 @@ public class Commands {
return fightPlayer; return fightPlayer;
} }
private static FightTeam checkGetTeam(Player p){ public static FightTeam checkGetTeam(Player p){
FightTeam fightTeam = Fight.getPlayerTeam(p); FightTeam fightTeam = Fight.getPlayerTeam(p);
if(fightTeam == null){ if(fightTeam == null){
errNoTeam(p); errNoTeam(p);

Datei anzeigen

@ -27,13 +27,10 @@ import de.steamwar.fightsystem.fight.FightTeam;
import de.steamwar.fightsystem.fight.Kit; import de.steamwar.fightsystem.fight.Kit;
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.inventory.SWAnvilInv; import de.steamwar.inventory.*;
import de.steamwar.inventory.SWInventory;
import de.steamwar.inventory.SWItem;
import de.steamwar.inventory.SWListInv;
import de.steamwar.message.Message; import de.steamwar.message.Message;
import de.steamwar.sql.PersonalKit; import de.steamwar.sql.PersonalKit;
import de.steamwar.sql.Schematic; import de.steamwar.sql.SchematicNode;
import de.steamwar.sql.SteamwarUser; import de.steamwar.sql.SteamwarUser;
import net.md_5.bungee.api.ChatMessageType; import net.md_5.bungee.api.ChatMessageType;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
@ -173,7 +170,7 @@ public class GUI {
}); });
if(Fight.getMaxRank() == 0){ if(Fight.getMaxRank() == 0){
inv.setItem(0, SWItem.getDye(8), (byte)8, msg.parse("SCHEM_PRIVATE_FORBIDDEN", p, Config.GameName), (ClickType click)->{}); 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)->{}); inv.setItem(0, SWItem.getDye(8), (byte)8, msg.parse("SCHEM_NO_PRIVATE", p, Config.GameName), (ClickType click)->{});
}else{ }else{
inv.setItem(0, SWItem.getMaterial("CAULDRON_ITEM"), msg.parse("SCHEM_PRIVATE", p, Config.GameName), (ClickType click) -> { 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){ private static void schemDialog(Player p, boolean publicSchems){
List<SWListInv.SWListEntry<Schematic>> schems; SchematicSelector selector = new SchematicSelector(p, Config.test()?SchematicSelector.selectSchematic():SchematicSelector.selectSchematicTypeWithRank(Config.SchematicType, Fight.getMaxRank()), node -> {
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) -> {
FightTeam fightTeam = Fight.getPlayerTeam(p); FightTeam fightTeam = Fight.getPlayerTeam(p);
if(fightTeam == null) if(fightTeam == null)
return; return;
if(Config.test() || FightState.getFightState() != FightState.POST_SCHEM_SETUP) if(Config.test() || FightState.getFightState() != FightState.POST_SCHEM_SETUP)
fightTeam.pasteSchem(s); fightTeam.pasteSchem(node);
p.closeInventory(); p.closeInventory();
}); });
inv.setCallback(-999, (ClickType click) -> p.closeInventory()); selector.setPublicMode(publicSchems?SchematicSelector.PublicMode.PUBLIC_ONLY:SchematicSelector.PublicMode.PRIVATE_ONLY);
inv.open(); selector.open();
} }
} }

Datei anzeigen

@ -20,26 +20,19 @@
package de.steamwar.fightsystem.commands; package de.steamwar.fightsystem.commands;
import de.steamwar.fightsystem.ArenaMode; 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.FightState;
import de.steamwar.fightsystem.states.StateDependentCommand; import de.steamwar.fightsystem.states.StateDependentCommand;
import de.steamwar.sql.SteamwarUser; import de.steamwar.fightsystem.utils.FightStatistics;
import net.md_5.bungee.api.ChatMessageType; import de.steamwar.fightsystem.utils.FightUI;
import org.bukkit.command.Command; import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor; import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender; import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import java.io.IOException; public class LockReplayCommand implements CommandExecutor {
import java.util.logging.Level;
public class ReplayCommand implements CommandExecutor { public LockReplayCommand() {
new StateDependentCommand(ArenaMode.AntiReplay, FightState.Schem, "lockreplay", this);
public ReplayCommand() {
new StateDependentCommand(ArenaMode.Replayable, FightState.All, "replay", this);
} }
@Override @Override
@ -49,25 +42,11 @@ public class ReplayCommand implements CommandExecutor {
} }
Player player = (Player) sender; Player player = (Player) sender;
if(!Config.test()){ if(Commands.checkGetLeader(player) == null)
SteamwarUser user = SteamwarUser.get(player.getUniqueId());
if(!user.getUserGroup().isTeamGroup()){
FightSystem.getMessage().sendPrefixless("REPLAY_UNAVAILABLE", sender, ChatMessageType.ACTION_BAR);
return false; return false;
}
}
if(!FileRecorder.getFile().exists()){ FightStatistics.lockReplay();
FightSystem.getMessage().sendPrefixless("REPLAY_UNAVAILABLE", sender, ChatMessageType.ACTION_BAR); FightUI.addSubtitle("REPLAY_LOCKED");
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);
}
return false; return false;
} }
} }

Datei anzeigen

@ -25,7 +25,7 @@ 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.StateDependentCommand; 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.SchematicType;
import de.steamwar.sql.SteamwarUser; import de.steamwar.sql.SteamwarUser;
import de.steamwar.sql.UserGroup; import de.steamwar.sql.UserGroup;
@ -67,7 +67,7 @@ public class LockschemCommand implements CommandExecutor {
return false; 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); FightSystem.getMessage().sendPrefixless("LOCKSCHEM_LOCKED", player, ChatMessageType.ACTION_BAR);
fightTeam.broadcastSystem("LOCKSCHEM_LOCKED_BY", player.getName()); fightTeam.broadcastSystem("LOCKSCHEM_LOCKED_BY", player.getName());
return false; return false;

Datei anzeigen

@ -31,7 +31,7 @@ public class EventSpectateCountdown extends Countdown {
public EventSpectateCountdown() { public EventSpectateCountdown() {
super(Config.SpectatorDuration, new Message("SHUTDOWN_COUNTDOWN"), SWSound.BLOCK_NOTE_PLING, false); 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 @Override

Datei anzeigen

@ -31,7 +31,7 @@ public class SpectateOverCountdown extends Countdown {
public SpectateOverCountdown() { public SpectateOverCountdown() {
super(Config.SpectatorDuration, new Message("SPECTATE_COUNTDOWN"), SWSound.BLOCK_NOTE_PLING, false); 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 @Override

Datei anzeigen

@ -20,13 +20,13 @@
package de.steamwar.fightsystem.fight; package de.steamwar.fightsystem.fight;
import com.comphenix.tinyprotocol.Reflection; import com.comphenix.tinyprotocol.Reflection;
import com.comphenix.tinyprotocol.TinyProtocol;
import com.mojang.authlib.GameProfile; import com.mojang.authlib.GameProfile;
import de.steamwar.core.Core; import de.steamwar.core.Core;
import de.steamwar.fightsystem.ArenaMode; import de.steamwar.fightsystem.ArenaMode;
import de.steamwar.fightsystem.Config; import de.steamwar.fightsystem.Config;
import de.steamwar.fightsystem.FightSystem; import de.steamwar.fightsystem.FightSystem;
import de.steamwar.fightsystem.record.GlobalRecorder; import de.steamwar.fightsystem.record.GlobalRecorder;
import de.steamwar.fightsystem.utils.ProtocolAPI;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
import org.bukkit.GameMode; import org.bukkit.GameMode;
import org.bukkit.Sound; 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); private static final Reflection.ConstructorInvoker playerInfoDataConstructor = Reflection.getConstructor(playerInfoDataClass, playerInfoPacket, GameProfile.class, int.class, enumGamemode, iChatBaseComponent);
public static void pseudoSpectator(Player player, boolean enable) { 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) { public static Object playerInfoPacket(Object action, GameProfile profile, Object mode) {

Datei anzeigen

@ -31,7 +31,7 @@ import de.steamwar.fightsystem.states.StateDependent;
import de.steamwar.fightsystem.utils.ColorConverter; import de.steamwar.fightsystem.utils.ColorConverter;
import de.steamwar.fightsystem.utils.Region; import de.steamwar.fightsystem.utils.Region;
import de.steamwar.fightsystem.utils.WorldeditWrapper; import de.steamwar.fightsystem.utils.WorldeditWrapper;
import de.steamwar.sql.Schematic; import de.steamwar.sql.SchematicNode;
import org.bukkit.*; import org.bukkit.*;
import org.bukkit.block.Block; import org.bukkit.block.Block;
import org.bukkit.event.HandlerList; import org.bukkit.event.HandlerList;
@ -67,13 +67,13 @@ public class FightSchematic extends StateDependent {
return schematic; return schematic;
} }
public void setSchematic(Schematic schem) { public void setSchematic(SchematicNode schem) {
schematic = schem.getSchemID(); schematic = schem.getId();
try { try {
clipboard = schem.load(); clipboard = schem.load();
} catch (IOException e) { } catch (IOException e) {
team.broadcastSystem("SCHEMATIC_UNLOADABLE"); 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; return;
if(clipboard == null){ if(clipboard == null){
List<Schematic> publics = Schematic.getSchemsOfType(0, Config.SchematicType); List<SchematicNode> publics = SchematicNode.getAllSchematicsOfType(0, Config.SchematicType.toDB());
if(publics.isEmpty()) if(publics.isEmpty())
return; return;
@ -106,10 +106,12 @@ public class FightSchematic extends StateDependent {
leader.getPlayer().getInventory().clear(0); leader.getPlayer().getInventory().clear(0);
} }
if(ArenaMode.AntiReplay.contains(Config.mode)) {
if(team.isBlue()) if(team.isBlue())
GlobalRecorder.getInstance().blueSchem(schematic); GlobalRecorder.getInstance().blueSchem(schematic);
else else
GlobalRecorder.getInstance().redSchem(schematic); GlobalRecorder.getInstance().redSchem(schematic);
}
Bukkit.getScheduler().runTask(FightSystem.getPlugin(), this::paste); Bukkit.getScheduler().runTask(FightSystem.getPlugin(), this::paste);
} }

Datei anzeigen

@ -32,7 +32,8 @@ import de.steamwar.fightsystem.states.OneShotStateDependent;
import de.steamwar.fightsystem.states.StateDependent; import de.steamwar.fightsystem.states.StateDependent;
import de.steamwar.fightsystem.utils.*; import de.steamwar.fightsystem.utils.*;
import de.steamwar.inventory.SWItem; 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 net.md_5.bungee.api.ChatMessageType;
import org.bukkit.*; import org.bukkit.*;
import org.bukkit.enchantments.Enchantment; import org.bukkit.enchantments.Enchantment;
@ -281,7 +282,7 @@ public class FightTeam {
if(!silent) if(!silent)
FightUI.addSubtitle("UI_LEADER_JOINS", prefix, leader.getPlayer().getName()); 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) if(Config.RanksEnabled)
schemRank = maxRank.orElse(1); schemRank = maxRank.orElse(1);
else else
@ -320,7 +321,7 @@ public class FightTeam {
return ready; return ready;
} }
public void pasteSchem(Schematic schematic){ public void pasteSchem(SchematicNode schematic){
setSchem(schematic); setSchem(schematic);
testPasteAction(); testPasteAction();
} }
@ -342,9 +343,9 @@ public class FightTeam {
schematic.pasteTeamName(); schematic.pasteTeamName();
} }
public void setSchem(Schematic schematic){ public void setSchem(SchematicNode schematic){
this.schematic.setSchematic(schematic); this.schematic.setSchematic(schematic);
broadcast("SCHEMATIC_CHOSEN", Config.GameName, schematic.getSchemName()); broadcast("SCHEMATIC_CHOSEN", Config.GameName, schematic.getName());
} }
public void setReady(boolean ready) { public void setReady(boolean ready) {

Datei anzeigen

@ -30,6 +30,7 @@ import org.bukkit.World;
import org.bukkit.WorldCreator; import org.bukkit.WorldCreator;
import org.bukkit.entity.Entity; import org.bukkit.entity.Entity;
import org.bukkit.entity.EntityType; import org.bukkit.entity.EntityType;
import org.bukkit.entity.Player;
public class FightWorld extends StateDependent { public class FightWorld extends StateDependent {
@ -72,7 +73,12 @@ public class FightWorld extends StateDependent {
World backup = new WorldCreator(world.getName() + "/backup").createWorld(); World backup = new WorldCreator(world.getName() + "/backup").createWorld();
assert backup != null; 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); Bukkit.unloadWorld(backup, false);
} }
} }

Datei anzeigen

@ -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);
}
}
}

Datei anzeigen

@ -24,7 +24,7 @@ import de.steamwar.fightsystem.Config;
import de.steamwar.fightsystem.FightSystem; import de.steamwar.fightsystem.FightSystem;
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.sql.Schematic; import de.steamwar.sql.SchematicNode;
import de.steamwar.sql.SteamwarUser; import de.steamwar.sql.SteamwarUser;
import de.steamwar.sql.UserGroup; import de.steamwar.sql.UserGroup;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
@ -50,8 +50,8 @@ public class Check implements Listener {
if(allowedToCheck(user)) if(allowedToCheck(user))
return; return;
Schematic schem = Schematic.getSchemFromDB(Config.CheckSchemID); SchematicNode schem = SchematicNode.getSchematicNode(Config.CheckSchemID);
if(user.getId() == schem.getSchemOwner()) if(user.getId() == schem.getOwner())
return; return;
FightSystem.getMessage().send("CHECK_JOIN_DENIED", player); FightSystem.getMessage().send("CHECK_JOIN_DENIED", player);

Datei anzeigen

@ -24,6 +24,8 @@ import de.steamwar.fightsystem.Config;
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 org.bukkit.block.Block; import org.bukkit.block.Block;
import org.bukkit.block.BlockFace;
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.BlockPistonExtendEvent; import org.bukkit.event.block.BlockPistonExtendEvent;
@ -41,8 +43,10 @@ public class PistonListener implements Listener {
@EventHandler @EventHandler
public void handlePistonExtend(BlockPistonExtendEvent e){ public void handlePistonExtend(BlockPistonExtendEvent e){
BlockFace face = e.getDirection();
for(Block block : e.getBlocks()){ 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); e.setCancelled(true);
return; return;
} }

Datei anzeigen

@ -26,21 +26,37 @@ import de.steamwar.fightsystem.FightSystem;
import de.steamwar.fightsystem.fight.Fight; 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.OneShotStateDependent;
import de.steamwar.fightsystem.states.StateDependentListener; import de.steamwar.fightsystem.states.StateDependentListener;
import de.steamwar.fightsystem.utils.FlatteningWrapper; import de.steamwar.fightsystem.utils.FlatteningWrapper;
import de.steamwar.fightsystem.utils.Region; import de.steamwar.fightsystem.utils.Region;
import de.steamwar.fightsystem.utils.WorldeditWrapper; import de.steamwar.fightsystem.utils.WorldeditWrapper;
import de.steamwar.sql.Schematic; import de.steamwar.sql.SchematicNode;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
import org.bukkit.World; import org.bukkit.World;
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.player.PlayerJoinEvent; import org.bukkit.event.player.PlayerJoinEvent;
import org.bukkit.util.Vector;
import java.util.HashSet;
import java.util.Set;
public class PrepareSchem implements Listener { public class PrepareSchem implements Listener {
private final Set<Vector> stationaryMovingPistons = new HashSet<>();
public PrepareSchem() { 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){ new StateDependentListener(ArenaMode.Prepare, FightState.Setup, this){
@Override @Override
public void disable() { public void disable() {
@ -49,9 +65,9 @@ public class PrepareSchem implements Listener {
Region region = Fight.getUnrotated().getExtendRegion(); Region region = Fight.getUnrotated().getExtendRegion();
int minY = Fight.getUnrotated().getSchemRegion().getMinY(); int minY = Fight.getUnrotated().getSchemRegion().getMinY();
Schematic schem; SchematicNode schem;
try{ try{
schem = Schematic.getSchemFromDB(Config.PrepareSchemID); schem = SchematicNode.getSchematicNode(Config.PrepareSchemID);
}catch(SecurityException e){ }catch(SecurityException e){
FightSystem.getMessage().broadcast("PREPARE_SCHEM_DELETED"); FightSystem.getMessage().broadcast("PREPARE_SCHEM_DELETED");
Bukkit.shutdown(); Bukkit.shutdown();
@ -60,7 +76,7 @@ public class PrepareSchem implements Listener {
try{ try{
region.forEach((x, y, z) -> { 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"); FightSystem.getMessage().broadcast("PREPARE_ACTIVE_PISTON");
Bukkit.shutdown(); Bukkit.shutdown();
throw new IllegalStateException(); throw new IllegalStateException();
@ -78,7 +94,7 @@ public class PrepareSchem implements Listener {
throw new SecurityException("Could not save schem", e); throw new SecurityException("Could not save schem", e);
} }
schem.setSchemType(Config.SchematicType.checkType()); schem.setSchemtype(Config.SchematicType.checkType());
FightSystem.getMessage().broadcast("PREPARE_SENT_IN"); FightSystem.getMessage().broadcast("PREPARE_SENT_IN");
Bukkit.shutdown(); Bukkit.shutdown();
} }

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))

Datei anzeigen

@ -21,18 +21,16 @@ package de.steamwar.fightsystem.record;
import com.sk89q.worldedit.extent.clipboard.Clipboard; import com.sk89q.worldedit.extent.clipboard.Clipboard;
import de.steamwar.core.Core; import de.steamwar.core.Core;
import de.steamwar.fightsystem.ArenaMode;
import de.steamwar.fightsystem.Config; import de.steamwar.fightsystem.Config;
import de.steamwar.fightsystem.FightSystem; import de.steamwar.fightsystem.FightSystem;
import de.steamwar.fightsystem.countdown.Countdown; import de.steamwar.fightsystem.countdown.Countdown;
import de.steamwar.fightsystem.countdown.EventSpectateCountdown;
import de.steamwar.fightsystem.fight.Fight; import de.steamwar.fightsystem.fight.Fight;
import de.steamwar.fightsystem.fight.FightTeam; import de.steamwar.fightsystem.fight.FightTeam;
import de.steamwar.fightsystem.fight.FreezeWorld; import de.steamwar.fightsystem.fight.FreezeWorld;
import de.steamwar.fightsystem.listener.FightScoreboard; import de.steamwar.fightsystem.listener.FightScoreboard;
import de.steamwar.fightsystem.states.FightState; import de.steamwar.fightsystem.states.FightState;
import de.steamwar.fightsystem.utils.*; import de.steamwar.fightsystem.utils.*;
import de.steamwar.sql.Schematic; import de.steamwar.sql.SchematicNode;
import de.steamwar.sql.Team; import de.steamwar.sql.Team;
import net.md_5.bungee.api.ChatMessageType; import net.md_5.bungee.api.ChatMessageType;
import net.md_5.bungee.api.chat.BaseComponent; import net.md_5.bungee.api.chat.BaseComponent;
@ -54,6 +52,7 @@ import java.util.logging.Level;
public class PacketProcessor { public class PacketProcessor {
static boolean replaying = false; static boolean replaying = false;
public static boolean isReplaying(){ public static boolean isReplaying(){
@ -142,12 +141,7 @@ public class PacketProcessor {
else if(team == 0x02) else if(team == 0x02)
winner = Fight.getRedTeam(); winner = Fight.getRedTeam();
if(Config.replayserver() || ArenaMode.AntiReplay.contains(Config.mode)) {
FightSystem.setSpectateState(winner, "Replay ends", message.getMsg(), message.getParams()); FightSystem.setSpectateState(winner, "Replay ends", message.getMsg(), message.getParams());
}else{
FightUI.printWin(winner, message.getMsg(), message.getParams());
new EventSpectateCountdown().enable();
}
}); });
} }
@ -199,14 +193,17 @@ public class PacketProcessor {
private void entityMoves() throws IOException { private void entityMoves() throws IOException {
int entityId = source.readInt(); 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 locY = source.readDouble() - arenaMinY + Config.BluePasteRegion.getMinY();
double z = source.readDouble() - arenaMinZ; double z = source.readDouble() - arenaMinZ;
if(rotateZ) if(rotateZ) {
x = Config.ArenaRegion.getSizeX() - x;
z = Config.ArenaRegion.getSizeZ() - z; z = Config.ArenaRegion.getSizeZ() - z;
}
double locX = x + Config.ArenaRegion.getMinX();
double locZ = z + Config.ArenaRegion.getMinZ(); double locZ = z + Config.ArenaRegion.getMinZ();
float pitch = source.readFloat(); 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); byte headYaw = (byte)((source.readByte() + (rotateZ ? 128 : 0)) % 256);
execSync(() -> REntity.getEntity(entityId).move(locX, locY, locZ, pitch, yaw, headYaw)); execSync(() -> REntity.getEntity(entityId).move(locX, locY, locZ, pitch, yaw, headYaw));
@ -241,7 +238,7 @@ public class PacketProcessor {
private void entityVelocity() throws IOException { private void entityVelocity() throws IOException {
int entityId = source.readInt(); int entityId = source.readInt();
double dX = source.readDouble(); double dX = rotateZ ? -source.readDouble() : source.readDouble();
double dY = source.readDouble(); double dY = source.readDouble();
double dZ = rotateZ ? -source.readDouble() : source.readDouble(); double dZ = rotateZ ? -source.readDouble() : source.readDouble();
@ -310,8 +307,10 @@ public class PacketProcessor {
int z = Byte.toUnsignedInt(source.readByte()); int z = Byte.toUnsignedInt(source.readByte());
int blockState = source.readShort(); int blockState = source.readShort();
if(rotateZ) if(rotateZ) {
x = Config.ArenaRegion.getSizeX() - x;
z = Config.ArenaRegion.getSizeZ() - z; z = Config.ArenaRegion.getSizeZ() - z;
}
setBlock(x + Config.ArenaRegion.getMinX(), y + Config.BluePasteRegion.getMinY(), z + Config.ArenaRegion.getMinZ(), blockState); 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 z = source.readInt() - arenaMinZ;
int blockState = source.readInt(); int blockState = source.readInt();
if(rotateZ) if(rotateZ) {
x = Config.ArenaRegion.getSizeX() - x;
z = Config.ArenaRegion.getSizeZ() - z; z = Config.ArenaRegion.getSizeZ() - z;
}
setBlock(x + Config.ArenaRegion.getMinX(), y + Config.BluePasteRegion.getMinY(), z + Config.ArenaRegion.getMinZ(), blockState); 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 { private void particle() throws IOException {
double x = source.readDouble(); double x = source.readDouble() - arenaMinX;
double y = source.readDouble(); double y = source.readDouble() - arenaMinY;
double z = source.readDouble(); double z = source.readDouble() - arenaMinZ;
String particleName = source.readUTF(); 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 { private void sound() throws IOException {
int x = source.readInt(); int rawX = source.readInt() - arenaMinX + Config.ArenaRegion.getMinX();
int y = source.readInt(); int y = source.readInt() - arenaMinY + Config.BluePasteRegion.getMinY();
int z = source.readInt(); 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 soundName = source.readUTF();
String soundCategory = source.readUTF(); String soundCategory = source.readUTF();
@ -374,12 +390,12 @@ public class PacketProcessor {
private void pasteSchem(FightTeam team) throws IOException { private void pasteSchem(FightTeam team) throws IOException {
int schemId = source.readInt(); int schemId = source.readInt();
execSync(() -> team.pasteSchem(Schematic.getSchemFromDB(schemId))); execSync(() -> team.pasteSchem(SchematicNode.getSchematicNode(schemId)));
} }
private void pasteEmbeddedSchem(FightTeam team) throws IOException { private void pasteEmbeddedSchem(FightTeam team) throws IOException {
int schemId = source.readInt(); 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)); execSync(() -> team.pasteSchem(schemId, clipboard));
} }
@ -445,17 +461,13 @@ public class PacketProcessor {
p.resetTitle(); p.resetTitle();
WorldOfColorWrapper.impl.sendTitle(p, title, subtitle, 5, 40, 5); 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() { private void endReplay() {
REntity.dieAll(); REntity.dieAll();
freezer.disable(); freezer.disable();
FightSystem.getMessage().broadcast("REPLAY_ENDS"); FightSystem.getMessage().broadcast("REPLAY_ENDS");
FightState.setFightState(FightState.SPECTATE);
replaying = false; replaying = false;
} }
@ -502,7 +514,7 @@ public class PacketProcessor {
} catch (EOFException e) { } catch (EOFException e) {
Bukkit.getLogger().log(Level.INFO, "The FightServer is offline"); Bukkit.getLogger().log(Level.INFO, "The FightServer is offline");
source.close(); source.close();
} catch(IOException e) { } catch(Exception e) {
Bukkit.getLogger().log(Level.WARNING, "Could not recieve packet", e); Bukkit.getLogger().log(Level.WARNING, "Could not recieve packet", e);
source.close(); source.close();
} }

Datei anzeigen

@ -20,8 +20,10 @@
package de.steamwar.fightsystem.record; package de.steamwar.fightsystem.record;
import com.comphenix.tinyprotocol.Reflection; import com.comphenix.tinyprotocol.Reflection;
import com.comphenix.tinyprotocol.TinyProtocol;
import com.mojang.authlib.GameProfile; import com.mojang.authlib.GameProfile;
import de.steamwar.core.Core; import de.steamwar.core.Core;
import de.steamwar.fightsystem.FightSystem;
import de.steamwar.fightsystem.fight.Fight; import de.steamwar.fightsystem.fight.Fight;
import de.steamwar.fightsystem.listener.FightScoreboard; import de.steamwar.fightsystem.listener.FightScoreboard;
import de.steamwar.fightsystem.utils.BlockIdWrapper; import de.steamwar.fightsystem.utils.BlockIdWrapper;
@ -38,6 +40,7 @@ import org.bukkit.scoreboard.NameTagVisibility;
import org.bukkit.scoreboard.Team; import org.bukkit.scoreboard.Team;
import java.util.*; import java.util.*;
import java.util.logging.Level;
public class REntity { public class REntity {
@ -72,22 +75,22 @@ public class REntity {
public static void playerJoins(Player player) { public static void playerJoins(Player player) {
for(REntity entity : entities.values()){ for(REntity entity : entities.values()){
if(entity.entityType == EntityType.PLAYER){ if(entity.entityType == EntityType.PLAYER){
ProtocolAPI.tinyProtocol.sendPacket(player, entity.getPlayerInfoPacket()); TinyProtocol.instance.sendPacket(player, entity.getPlayerInfoPacket());
ProtocolAPI.tinyProtocol.sendPacket(player, entity.getNamedSpawnPacket()); TinyProtocol.instance.sendPacket(player, entity.getNamedSpawnPacket());
for (Map.Entry<String, ItemStack> entry : entity.itemSlots.entrySet()) { 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{ }else{
ProtocolAPI.tinyProtocol.sendPacket(player, entity.getSpawnEntityPacket()); TinyProtocol.instance.sendPacket(player, entity.getSpawnEntityPacket());
} }
ProtocolAPI.tinyProtocol.sendPacket(player, entity.getTeleportPacket()); TinyProtocol.instance.sendPacket(player, entity.getTeleportPacket());
ProtocolAPI.tinyProtocol.sendPacket(player, entity.getHeadRotationPacket()); TinyProtocol.instance.sendPacket(player, entity.getHeadRotationPacket());
if(entity.fireTick != 0) { 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) { 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.entityType = EntityType.PLAYER;
this.entityId = entityCount--; 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.uuid = user.getUUID();
this.name = user.getUserName(); this.name = user.getUserName();
entities.put(internalId, this); entities.put(internalId, this);

Datei anzeigen

@ -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.Schematic; import de.steamwar.sql.SchematicNode;
import de.steamwar.sql.SteamwarUser; import de.steamwar.sql.SteamwarUser;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
import org.bukkit.Location; import org.bukkit.Location;
@ -275,7 +275,7 @@ public interface Recorder {
ByteArrayOutputStream buffer = new ByteArrayOutputStream(); ByteArrayOutputStream buffer = new ByteArrayOutputStream();
try{ try{
copy(Schematic.getSchemFromDB(schemId).schemData(), buffer); copy(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) {

Datei anzeigen

@ -43,7 +43,11 @@ public class StateDependentCountdown extends StateDependent {
} }
public StateDependentCountdown(Winconditions wincondition, Set<FightState> states, Countdown countdown) { 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; this.countdown = countdown;
register(); register();
} }

Datei anzeigen

@ -31,13 +31,14 @@ import de.steamwar.fightsystem.states.FightState;
import de.steamwar.fightsystem.states.OneShotStateDependent; import de.steamwar.fightsystem.states.OneShotStateDependent;
import de.steamwar.fightsystem.winconditions.Wincondition; import de.steamwar.fightsystem.winconditions.Wincondition;
import de.steamwar.sql.Elo; import de.steamwar.sql.Elo;
import de.steamwar.sql.Schematic; import de.steamwar.sql.SchematicNode;
import de.steamwar.sql.SteamwarUser; import de.steamwar.sql.SteamwarUser;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
import java.io.FileInputStream; import java.io.FileInputStream;
import java.sql.Timestamp; import java.sql.Timestamp;
import java.time.Instant; import java.time.Instant;
import java.time.temporal.ChronoUnit;
import java.util.logging.Level; import java.util.logging.Level;
import static de.steamwar.sql.Fight.create; import static de.steamwar.sql.Fight.create;
@ -46,9 +47,14 @@ import static de.steamwar.sql.Fight.setReplay;
public class FightStatistics { public class FightStatistics {
private static final int K = 20; private static final int K = 20;
private static boolean replayLock = false;
private Timestamp starttime = Timestamp.from(Instant.now()); private Timestamp starttime = Timestamp.from(Instant.now());
public static void lockReplay() {
replayLock = true;
}
public FightStatistics() { public FightStatistics() {
new OneShotStateDependent(ArenaMode.SeriousFight, FightState.Running, this::enable); new OneShotStateDependent(ArenaMode.SeriousFight, FightState.Running, this::enable);
new OneShotStateDependent(ArenaMode.Event, FightState.Spectate, this::setEventResult); new OneShotStateDependent(ArenaMode.Event, FightState.Spectate, this::setEventResult);
@ -91,12 +97,12 @@ public class FightStatistics {
Integer blueSchem; Integer blueSchem;
Integer redSchem; Integer redSchem;
try{ try{
blueSchem = Schematic.getSchemFromDB(Fight.getBlueTeam().getSchematic()).getSchemID(); blueSchem = SchematicNode.getSchematicNode(Fight.getBlueTeam().getSchematic()).getId();
}catch(SecurityException e){ }catch(SecurityException e){
blueSchem = null; blueSchem = null;
} }
try{ try{
redSchem = Schematic.getSchemFromDB(Fight.getRedTeam().getSchematic()).getSchemID(); redSchem = SchematicNode.getSchematicNode(Fight.getRedTeam().getSchematic()).getId();
}catch(SecurityException e){ }catch(SecurityException e){
redSchem = null; redSchem = null;
} }
@ -109,21 +115,26 @@ public class FightStatistics {
try { try {
int fightId = create(gameMode, Bukkit.getWorlds().get(0).getName(), starttime, remainingTime, 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()) for (FightPlayer fp : Fight.getBlueTeam().getPlayers())
savePlayerStats(fp, fightId); savePlayerStats(fp, fightId);
for (FightPlayer fp : Fight.getRedTeam().getPlayers()) for (FightPlayer fp : Fight.getRedTeam().getPlayers())
savePlayerStats(fp, fightId); savePlayerStats(fp, fightId);
setReplay(fightId, new FileInputStream(FileRecorder.getFile()));
if(ArenaMode.Event.contains(Config.mode)) { if(ArenaMode.Event.contains(Config.mode)) {
FightSystem.getEventFight().setFight(fightId); 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){ }catch(Exception e){
Bukkit.getLogger().log(Level.SEVERE, "Failed to save statistics", e); Bukkit.getLogger().log(Level.SEVERE, "Failed to save statistics", e);
} }
replayLock = false;
if(Config.Ranked){ if(Config.Ranked){
int blueElo = Elo.getElo(blueLeader, gameMode); int blueElo = Elo.getElo(blueLeader, gameMode);

Datei anzeigen

@ -20,8 +20,6 @@
package de.steamwar.fightsystem.utils; package de.steamwar.fightsystem.utils;
import com.comphenix.tinyprotocol.TinyProtocol; import com.comphenix.tinyprotocol.TinyProtocol;
import de.steamwar.fightsystem.FightSystem;
import io.netty.channel.Channel;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
import org.bukkit.entity.Player; 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>> outgoingHandler = new HashMap<>();
private static final Map<Class<?>, BiFunction<Player, Object, Object>> incomingHandler = new HashMap<>(); private static final Map<Class<?>, BiFunction<Player, Object, Object>> incomingHandler = new HashMap<>();
public static final TinyProtocol tinyProtocol = new TinyProtocol(FightSystem.getPlugin()) { static {
@Override TinyProtocol.instance.setOutFilter((receiver, channel, packet) -> {
public Object onPacketOutAsync(Player receiver, Channel channel, Object packet) {
BiFunction<Player, Object, Object> handler = outgoingHandler.get(packet.getClass()); BiFunction<Player, Object, Object> handler = outgoingHandler.get(packet.getClass());
if(handler == null) if(handler == null)
return packet; return packet;
return handler.apply(receiver, packet); return handler.apply(receiver, packet);
} });
TinyProtocol.instance.setInFilter((sender, channel, packet) -> {
@Override
public Object onPacketInAsync(Player sender, Channel channel, Object packet) {
BiFunction<Player, Object, Object> handler = incomingHandler.get(packet.getClass()); BiFunction<Player, Object, Object> handler = incomingHandler.get(packet.getClass());
if(handler == null) if(handler == null)
return packet; return packet;
return handler.apply(sender, packet); return handler.apply(sender, packet);
});
} }
};
public static void setOutgoingHandler(Class<?> packetClass, BiFunction<Player, Object, Object> handler) { public static void setOutgoingHandler(Class<?> packetClass, BiFunction<Player, Object, Object> handler) {
outgoingHandler.put(packetClass, handler); outgoingHandler.put(packetClass, handler);
@ -77,7 +72,7 @@ public class ProtocolAPI {
} }
public static void broadcastPacket(Object packet) { 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) { public static BiFunction<Object, UnaryOperator<Object>, Object> arrayCloneGenerator(Class<?> elementClass) {

Datei anzeigen

@ -22,8 +22,8 @@ package de.steamwar.fightsystem.utils;
import com.comphenix.tinyprotocol.Reflection; import com.comphenix.tinyprotocol.Reflection;
import com.google.common.primitives.Bytes; import com.google.common.primitives.Bytes;
import de.steamwar.core.Core; import de.steamwar.core.Core;
import de.steamwar.core.CraftbukkitWrapper;
import de.steamwar.core.VersionDependent; import de.steamwar.core.VersionDependent;
import de.steamwar.core.events.ChunkListener;
import de.steamwar.fightsystem.Config; import de.steamwar.fightsystem.Config;
import de.steamwar.fightsystem.FightSystem; import de.steamwar.fightsystem.FightSystem;
import de.steamwar.fightsystem.fight.Fight; import de.steamwar.fightsystem.fight.Fight;
@ -236,7 +236,7 @@ public class TechHider extends StateDependent {
Bukkit.getScheduler().runTaskLater(FightSystem.getPlugin(), () -> { Bukkit.getScheduler().runTaskLater(FightSystem.getPlugin(), () -> {
for(ChunkPos chunk : chunksToReload){ for(ChunkPos chunk : chunksToReload){
if(bypass(p, chunk.x(), chunk.z()) != hide) if(bypass(p, chunk.x(), chunk.z()) != hide)
ChunkListener.sendChunk(p, chunk.x(), chunk.z()); CraftbukkitWrapper.impl.sendChunk(p, chunk.x(), chunk.z());
} }
}, 40); }, 40);
} }

Datei anzeigen

@ -24,7 +24,7 @@ import com.sk89q.worldedit.extent.clipboard.Clipboard;
import com.sk89q.worldedit.math.transform.AffineTransform; import com.sk89q.worldedit.math.transform.AffineTransform;
import de.steamwar.core.VersionDependent; import de.steamwar.core.VersionDependent;
import de.steamwar.fightsystem.FightSystem; import de.steamwar.fightsystem.FightSystem;
import de.steamwar.sql.Schematic; import de.steamwar.sql.SchematicNode;
import org.bukkit.DyeColor; import org.bukkit.DyeColor;
import org.bukkit.Location; import org.bukkit.Location;
import org.bukkit.util.Vector; import org.bukkit.util.Vector;
@ -42,6 +42,6 @@ public class WorldeditWrapper {
void pasteClipboard(Clipboard clipboard, Location position, Vector offset, AffineTransform aT); void pasteClipboard(Clipboard clipboard, Location position, Vector offset, AffineTransform aT);
Vector getDimensions(Clipboard clipboard); Vector getDimensions(Clipboard clipboard);
Clipboard loadChar(String charName) throws IOException; 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;
} }
} }

Datei anzeigen

@ -18,7 +18,7 @@ commands:
remove: remove:
leader: leader:
lockschem: lockschem:
replay: lockreplay:
state: state:
skip: skip:
win: win: