Adapt to CommonDB #366
@ -42,6 +42,7 @@ 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.Config;
|
import de.steamwar.fightsystem.Config;
|
||||||
import de.steamwar.fightsystem.FightSystem;
|
import de.steamwar.fightsystem.FightSystem;
|
||||||
|
import de.steamwar.sql.SchematicData;
|
||||||
import de.steamwar.sql.SchematicNode;
|
import de.steamwar.sql.SchematicNode;
|
||||||
import org.bukkit.DyeColor;
|
import org.bukkit.DyeColor;
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
@ -143,6 +144,6 @@ public class WorldeditWrapper14 implements WorldeditWrapper {
|
|||||||
throw new SecurityException(e);
|
throw new SecurityException(e);
|
||||||
}
|
}
|
||||||
|
|
||||||
schem.saveFromBytes(outputStream.toByteArray(), true);
|
new SchematicData(schem).saveFromBytes(outputStream.toByteArray(), true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -39,6 +39,7 @@ import com.sk89q.worldedit.session.ClipboardHolder;
|
|||||||
import com.sk89q.worldedit.world.World;
|
import com.sk89q.worldedit.world.World;
|
||||||
import de.steamwar.fightsystem.Config;
|
import de.steamwar.fightsystem.Config;
|
||||||
import de.steamwar.fightsystem.FightSystem;
|
import de.steamwar.fightsystem.FightSystem;
|
||||||
|
import de.steamwar.sql.SchematicData;
|
||||||
import de.steamwar.sql.SchematicNode;
|
import de.steamwar.sql.SchematicNode;
|
||||||
import org.bukkit.DyeColor;
|
import org.bukkit.DyeColor;
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
@ -141,6 +142,6 @@ public class WorldeditWrapper8 implements WorldeditWrapper {
|
|||||||
throw new SecurityException(e);
|
throw new SecurityException(e);
|
||||||
}
|
}
|
||||||
|
|
||||||
schem.saveFromBytes(outputStream.toByteArray(), false);
|
new SchematicData(schem).saveFromBytes(outputStream.toByteArray(), false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -31,6 +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.SchematicData;
|
||||||
import de.steamwar.sql.SchematicNode;
|
import de.steamwar.sql.SchematicNode;
|
||||||
import org.bukkit.*;
|
import org.bukkit.*;
|
||||||
import org.bukkit.block.Block;
|
import org.bukkit.block.Block;
|
||||||
@ -70,7 +71,7 @@ public class FightSchematic extends StateDependent {
|
|||||||
public void setSchematic(SchematicNode schem) {
|
public void setSchematic(SchematicNode schem) {
|
||||||
schematic = schem.getId();
|
schematic = schem.getId();
|
||||||
try {
|
try {
|
||||||
clipboard = schem.load();
|
clipboard = new SchematicData(schem).load();
|
||||||
|
|
||||||
if(schem.replaceColor())
|
if(schem.replaceColor())
|
||||||
replaceTeamColor(clipboard);
|
replaceTeamColor(clipboard);
|
||||||
|
@ -20,10 +20,11 @@
|
|||||||
package de.steamwar.fightsystem.record;
|
package de.steamwar.fightsystem.record;
|
||||||
|
|
||||||
import de.steamwar.fightsystem.Config;
|
import de.steamwar.fightsystem.Config;
|
||||||
|
import de.steamwar.sql.Replay;
|
||||||
|
|
||||||
import java.io.*;
|
import java.io.File;
|
||||||
import java.nio.file.Files;
|
import java.io.FileInputStream;
|
||||||
import java.nio.file.StandardCopyOption;
|
import java.io.IOException;
|
||||||
import java.util.zip.GZIPInputStream;
|
import java.util.zip.GZIPInputStream;
|
||||||
|
|
||||||
public class FileSource extends PacketSource {
|
public class FileSource extends PacketSource {
|
||||||
@ -39,19 +40,8 @@ public class FileSource extends PacketSource {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if(Config.ReplayID > 0) {
|
if(Config.ReplayID > 0) {
|
||||||
de.steamwar.sql.Fight.getReplay(Config.ReplayID, input -> {
|
|
||||||
try {
|
try {
|
||||||
Files.copy(
|
new FileSource(Replay.get(Config.ReplayID).getReplay());
|
||||||
input,
|
|
||||||
FileRecorder.getFile().toPath(),
|
|
||||||
StandardCopyOption.REPLACE_EXISTING);
|
|
||||||
} catch (IOException e) {
|
|
||||||
throw new SecurityException("Could not start replay", e);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
try {
|
|
||||||
new FileSource(FileRecorder.getFile());
|
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
throw new SecurityException("Could not start replay", e);
|
throw new SecurityException("Could not start replay", e);
|
||||||
}
|
}
|
||||||
|
@ -31,6 +31,7 @@ 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.SchematicData;
|
||||||
import de.steamwar.sql.SchematicNode;
|
import de.steamwar.sql.SchematicNode;
|
||||||
import de.steamwar.sql.Team;
|
import de.steamwar.sql.Team;
|
||||||
import de.steamwar.techhider.BlockIds;
|
import de.steamwar.techhider.BlockIds;
|
||||||
@ -430,7 +431,7 @@ public class PacketProcessor {
|
|||||||
|
|
||||||
private void pasteEmbeddedSchem(FightTeam team) throws IOException {
|
private void pasteEmbeddedSchem(FightTeam team) throws IOException {
|
||||||
int schemId = source.readInt();
|
int schemId = source.readInt();
|
||||||
Clipboard clipboard = SchematicNode.clipboardFromStream(new FilterInputStream(source) {
|
Clipboard clipboard = SchematicData.clipboardFromStream(new FilterInputStream(source) {
|
||||||
@Override
|
@Override
|
||||||
public void close() {
|
public void close() {
|
||||||
// FAWE 1.12 calls close...
|
// FAWE 1.12 calls close...
|
||||||
|
@ -29,6 +29,7 @@ import de.steamwar.fightsystem.utils.BlockIdWrapper;
|
|||||||
import de.steamwar.fightsystem.utils.CraftbukkitWrapper;
|
import de.steamwar.fightsystem.utils.CraftbukkitWrapper;
|
||||||
import de.steamwar.fightsystem.utils.Message;
|
import de.steamwar.fightsystem.utils.Message;
|
||||||
import de.steamwar.fightsystem.utils.SWSound;
|
import de.steamwar.fightsystem.utils.SWSound;
|
||||||
|
import de.steamwar.sql.SchematicData;
|
||||||
import de.steamwar.sql.SchematicNode;
|
import de.steamwar.sql.SchematicNode;
|
||||||
import de.steamwar.sql.SteamwarUser;
|
import de.steamwar.sql.SteamwarUser;
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
@ -275,7 +276,7 @@ public interface Recorder {
|
|||||||
|
|
||||||
ByteArrayOutputStream buffer = new ByteArrayOutputStream();
|
ByteArrayOutputStream buffer = new ByteArrayOutputStream();
|
||||||
try{
|
try{
|
||||||
copy(SchematicNode.getSchematicNode(schemId).schemData(), buffer);
|
copy(new SchematicData(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) {
|
||||||
|
@ -32,18 +32,17 @@ import de.steamwar.fightsystem.states.OneShotStateDependent;
|
|||||||
import de.steamwar.fightsystem.winconditions.Wincondition;
|
import de.steamwar.fightsystem.winconditions.Wincondition;
|
||||||
import de.steamwar.network.NetworkSender;
|
import de.steamwar.network.NetworkSender;
|
||||||
import de.steamwar.network.packets.common.FightEndsPacket;
|
import de.steamwar.network.packets.common.FightEndsPacket;
|
||||||
|
import de.steamwar.sql.Replay;
|
||||||
import de.steamwar.sql.SchematicNode;
|
import de.steamwar.sql.SchematicNode;
|
||||||
import de.steamwar.sql.SteamwarUser;
|
import de.steamwar.sql.SteamwarUser;
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
|
|
||||||
import java.io.FileInputStream;
|
|
||||||
import java.sql.Timestamp;
|
import java.sql.Timestamp;
|
||||||
import java.time.Instant;
|
import java.time.Instant;
|
||||||
import java.util.logging.Level;
|
import java.util.logging.Level;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
import static de.steamwar.sql.Fight.create;
|
import static de.steamwar.sql.Fight.create;
|
||||||
import static de.steamwar.sql.Fight.setReplay;
|
|
||||||
|
|
||||||
public class FightStatistics {
|
public class FightStatistics {
|
||||||
|
|
||||||
@ -123,7 +122,7 @@ public class FightStatistics {
|
|||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
setReplay(fightId, new FileInputStream(FileRecorder.getFile()));
|
Replay.save(fightId, FileRecorder.getFile());
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
Bukkit.getLogger().log(Level.INFO, "Failed to save replay", e);
|
Bukkit.getLogger().log(Level.INFO, "Failed to save replay", e);
|
||||||
}
|
}
|
||||||
@ -132,7 +131,7 @@ public class FightStatistics {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!Bukkit.getOnlinePlayers().isEmpty() && !unranked) {
|
if (!Bukkit.getOnlinePlayers().isEmpty() && !unranked) {
|
||||||
NetworkSender.send(new FightEndsPacket((byte) win, blueSchem == null ? 0 : blueSchem, redSchem == null ? 0 : redSchem, Fight.getBlueTeam().getPlayers().stream().map(FightPlayer::getPlayer).map(SteamwarUser::get).map(SteamwarUser::getId).collect(Collectors.toList()), Fight.getRedTeam().getPlayers().stream().map(FightPlayer::getPlayer).map(SteamwarUser::get).map(SteamwarUser::getId).collect(Collectors.toList()), gameMode));
|
NetworkSender.send(new FightEndsPacket((byte) win, blueSchem == null ? 0 : blueSchem, redSchem == null ? 0 : redSchem, Fight.getBlueTeam().getPlayers().stream().map(FightPlayer::getPlayer).map(p -> SteamwarUser.get(p.getUniqueId())).map(SteamwarUser::getId).collect(Collectors.toList()), Fight.getRedTeam().getPlayers().stream().map(FightPlayer::getPlayer).map(p -> SteamwarUser.get(p.getUniqueId())).map(SteamwarUser::getId).collect(Collectors.toList()), gameMode));
|
||||||
}
|
}
|
||||||
|
|
||||||
unranked = false;
|
unranked = false;
|
||||||
|
In neuem Issue referenzieren
Einen Benutzer sperren