Merge pull request 'Adapt to CommonDB' (#366) from commonDB into master
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful
Reviewed-on: #366 Reviewed-by: Chaoscaot <chaoscaot@zohomail.eu>
Dieser Commit ist enthalten in:
Commit
6d574bd89d
@ -42,6 +42,7 @@ import com.sk89q.worldedit.world.block.BaseBlock;
|
||||
import com.sk89q.worldedit.world.block.BlockTypes;
|
||||
import de.steamwar.fightsystem.Config;
|
||||
import de.steamwar.fightsystem.FightSystem;
|
||||
import de.steamwar.sql.SchematicData;
|
||||
import de.steamwar.sql.SchematicNode;
|
||||
import org.bukkit.DyeColor;
|
||||
import org.bukkit.Location;
|
||||
@ -143,6 +144,6 @@ public class WorldeditWrapper14 implements WorldeditWrapper {
|
||||
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 de.steamwar.fightsystem.Config;
|
||||
import de.steamwar.fightsystem.FightSystem;
|
||||
import de.steamwar.sql.SchematicData;
|
||||
import de.steamwar.sql.SchematicNode;
|
||||
import org.bukkit.DyeColor;
|
||||
import org.bukkit.Location;
|
||||
@ -141,6 +142,6 @@ public class WorldeditWrapper8 implements WorldeditWrapper {
|
||||
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.Region;
|
||||
import de.steamwar.fightsystem.utils.WorldeditWrapper;
|
||||
import de.steamwar.sql.SchematicData;
|
||||
import de.steamwar.sql.SchematicNode;
|
||||
import org.bukkit.*;
|
||||
import org.bukkit.block.Block;
|
||||
@ -70,7 +71,7 @@ public class FightSchematic extends StateDependent {
|
||||
public void setSchematic(SchematicNode schem) {
|
||||
schematic = schem.getId();
|
||||
try {
|
||||
clipboard = schem.load();
|
||||
clipboard = new SchematicData(schem).load();
|
||||
|
||||
if(schem.replaceColor())
|
||||
replaceTeamColor(clipboard);
|
||||
|
@ -20,10 +20,11 @@
|
||||
package de.steamwar.fightsystem.record;
|
||||
|
||||
import de.steamwar.fightsystem.Config;
|
||||
import de.steamwar.sql.Replay;
|
||||
|
||||
import java.io.*;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.StandardCopyOption;
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.IOException;
|
||||
import java.util.zip.GZIPInputStream;
|
||||
|
||||
public class FileSource extends PacketSource {
|
||||
@ -39,19 +40,8 @@ public class FileSource extends PacketSource {
|
||||
}
|
||||
|
||||
if(Config.ReplayID > 0) {
|
||||
de.steamwar.sql.Fight.getReplay(Config.ReplayID, input -> {
|
||||
try {
|
||||
Files.copy(
|
||||
input,
|
||||
FileRecorder.getFile().toPath(),
|
||||
StandardCopyOption.REPLACE_EXISTING);
|
||||
} catch (IOException e) {
|
||||
throw new SecurityException("Could not start replay", e);
|
||||
}
|
||||
});
|
||||
|
||||
try {
|
||||
new FileSource(FileRecorder.getFile());
|
||||
new FileSource(Replay.get(Config.ReplayID).getReplay());
|
||||
} catch (IOException 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.states.FightState;
|
||||
import de.steamwar.fightsystem.utils.*;
|
||||
import de.steamwar.sql.SchematicData;
|
||||
import de.steamwar.sql.SchematicNode;
|
||||
import de.steamwar.sql.Team;
|
||||
import de.steamwar.techhider.BlockIds;
|
||||
@ -430,7 +431,7 @@ public class PacketProcessor {
|
||||
|
||||
private void pasteEmbeddedSchem(FightTeam team) throws IOException {
|
||||
int schemId = source.readInt();
|
||||
Clipboard clipboard = SchematicNode.clipboardFromStream(new FilterInputStream(source) {
|
||||
Clipboard clipboard = SchematicData.clipboardFromStream(new FilterInputStream(source) {
|
||||
@Override
|
||||
public void 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.Message;
|
||||
import de.steamwar.fightsystem.utils.SWSound;
|
||||
import de.steamwar.sql.SchematicData;
|
||||
import de.steamwar.sql.SchematicNode;
|
||||
import de.steamwar.sql.SteamwarUser;
|
||||
import org.bukkit.Bukkit;
|
||||
@ -275,7 +276,7 @@ public interface Recorder {
|
||||
|
||||
ByteArrayOutputStream buffer = new ByteArrayOutputStream();
|
||||
try{
|
||||
copy(SchematicNode.getSchematicNode(schemId).schemData(), buffer);
|
||||
copy(new SchematicData(SchematicNode.getSchematicNode(schemId)).schemData(), buffer);
|
||||
}catch (EOFException e) {
|
||||
Bukkit.getLogger().log(Level.INFO, "EOFException ignored");
|
||||
} catch (IOException e) {
|
||||
|
@ -32,18 +32,17 @@ import de.steamwar.fightsystem.states.OneShotStateDependent;
|
||||
import de.steamwar.fightsystem.winconditions.Wincondition;
|
||||
import de.steamwar.network.NetworkSender;
|
||||
import de.steamwar.network.packets.common.FightEndsPacket;
|
||||
import de.steamwar.sql.Replay;
|
||||
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.util.logging.Level;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import static de.steamwar.sql.Fight.create;
|
||||
import static de.steamwar.sql.Fight.setReplay;
|
||||
|
||||
public class FightStatistics {
|
||||
|
||||
@ -123,7 +122,7 @@ public class FightStatistics {
|
||||
}
|
||||
|
||||
try {
|
||||
setReplay(fightId, new FileInputStream(FileRecorder.getFile()));
|
||||
Replay.save(fightId, FileRecorder.getFile());
|
||||
} catch (Exception e) {
|
||||
Bukkit.getLogger().log(Level.INFO, "Failed to save replay", e);
|
||||
}
|
||||
@ -132,7 +131,7 @@ public class FightStatistics {
|
||||
}
|
||||
|
||||
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;
|
||||
|
In neuem Issue referenzieren
Einen Benutzer sperren