SteamWar/FightSystem
Archiviert
13
1

Embedded Schem + Arena relative replay

Signed-off-by: Lixfel <agga-games@gmx.de>
Dieser Commit ist enthalten in:
Lixfel 2021-08-24 08:16:57 +02:00
Ursprung 7d1c34d31e
Commit 0357a7a307
9 geänderte Dateien mit 246 neuen und 229 gelöschten Zeilen

Datei anzeigen

@ -63,7 +63,7 @@ public class Config {
private static final int BlueToRedX;
private static final int BlueToRedY;
public static final int BlueToRedZ;
private static final int BlueToRedZ;
public static final int PreperationArea;
public static final int WaterDepth;
@ -390,4 +390,7 @@ public class Config {
public static boolean replayserver(){
return ReplayID == -1;
}
public static boolean blueNegZ(){
return BlueToRedZ > 0;
}
}

Datei anzeigen

@ -85,6 +85,11 @@ public class FightSchematic extends StateDependent {
}
}
public void setSchematic(int schemId, Clipboard clipboard) {
this.schematic = schemId;
this.clipboard = clipboard;
}
public void reset(){
schematic = 0;
clipboard = null;

Datei anzeigen

@ -19,6 +19,7 @@
package de.steamwar.fightsystem.fight;
import com.sk89q.worldedit.extent.clipboard.Clipboard;
import de.steamwar.comms.packets.TablistNamePacket;
import de.steamwar.core.VersionedRunnable;
import de.steamwar.fightsystem.ArenaMode;
@ -299,7 +300,15 @@ public class FightTeam implements IFightTeam{
public void pasteSchem(Schematic schematic){
setSchem(schematic);
testPasteAction();
}
public void pasteSchem(int schemId, Clipboard clipboard){
this.schematic.setSchematic(schemId, clipboard);
testPasteAction();
}
private void testPasteAction(){
if(Config.test())
this.schematic.enable();
else if(Fight.getOpposite(this).hasSchematic()){

Datei anzeigen

@ -46,13 +46,13 @@ public class FileSource extends PacketSource {
}
public FileSource(File fightFile) throws IOException {
super(new DataInputStream(new GZIPInputStream(new FileInputStream(fightFile))));
super(new GZIPInputStream(new FileInputStream(fightFile)));
}
@Override
boolean isClosed() {
try{
return inputStream.available() == 0;
return available() == 0;
}catch (IOException e){
return true;
}

Datei anzeigen

@ -21,7 +21,6 @@ package de.steamwar.fightsystem.record;
import org.bukkit.Bukkit;
import java.io.DataInputStream;
import java.io.IOException;
import java.net.Socket;
import java.util.logging.Level;
@ -30,7 +29,7 @@ public class LiveSource extends PacketSource {
private final Socket socket;
protected LiveSource(Socket socket) throws IOException {
super(new DataInputStream(socket.getInputStream()));
super(socket.getInputStream());
this.socket = socket;
}

Datei anzeigen

@ -19,6 +19,8 @@
package de.steamwar.fightsystem.record;
import com.sk89q.worldedit.extent.clipboard.Clipboard;
import de.steamwar.core.Core;
import de.steamwar.core.VersionedRunnable;
import de.steamwar.fightsystem.ArenaMode;
import de.steamwar.fightsystem.Config;
@ -55,6 +57,8 @@ public class PacketProcessor {
private static final World world = Bukkit.getWorlds().get(0);
private final PacketParser[] packetDecoder = new PacketParser[256];
private final PacketSource source;
private final BukkitTask task;
private final LinkedList<Runnable> syncList = new LinkedList<>();
@ -62,10 +66,50 @@ public class PacketProcessor {
private final int obfuscateWith = TechHider.getObfuscateWith();
private final FreezeWorld freezer = new FreezeWorld();
private boolean rotateZ = false;
private int arenaMinX = Config.ArenaRegion.getMinX();
private int arenaMinY = Config.BluePasteRegion.getMinY();
private int arenaMinZ = Config.ArenaRegion.getMinZ();
private boolean tickFinished = false;
public PacketProcessor(PacketSource source){
this.source = source;
replaying = true;
packetDecoder[0x00] = this::playerJoins;
packetDecoder[0x01] = this::entityMoves;
packetDecoder[0x02] = this::entityDespawns;
packetDecoder[0x03] = this::entitySneak;
packetDecoder[0x04] = this::entityAnimation;
packetDecoder[0x05] = this::tntSpawn;
packetDecoder[0x06] = this::entityVelocity;
packetDecoder[0x07] = this::playerItem;
packetDecoder[0x08] = this::arrowSpawn;
packetDecoder[0x09] = this::fireballSpawn;
packetDecoder[0x0a] = this::bow;
packetDecoder[0x0b] = this::damage;
packetDecoder[0x0c] = this::fireTick;
packetDecoder[0x20] = this::arenaInfo;
packetDecoder[0x30] = this::block;
packetDecoder[0x31] = this::particle;
packetDecoder[0x32] = this::sound;
packetDecoder[0x33] = this::shortBlock;
packetDecoder[0x34] = this::soundAtPlayer;
packetDecoder[0x35] = this::shortRelativeBlock;
packetDecoder[0xa0] = () -> send(ChatMessageType.CHAT);
packetDecoder[0xa1] = () -> send(ChatMessageType.ACTION_BAR);
packetDecoder[0xa2] = () -> send(ChatMessageType.SYSTEM);
packetDecoder[0xb0] = () -> pasteSchem(Fight.getBlueTeam());
packetDecoder[0xb1] = () -> pasteSchem(Fight.getRedTeam());
packetDecoder[0xb2] = this::teams;
packetDecoder[0xb3] = () -> pasteEmbeddedSchem(Fight.getBlueTeam());
packetDecoder[0xb4] = () -> pasteEmbeddedSchem(Fight.getRedTeam());
packetDecoder[0xc0] = this::scoreboardTitle;
packetDecoder[0xc1] = this::scoreboardData;
packetDecoder[0xef] = source::readUTF;
packetDecoder[0xff] = this::tick;
if(source.async()) {
Bukkit.getScheduler().runTaskAsynchronously(FightSystem.getPlugin(), this::process);
task = Bukkit.getScheduler().runTaskTimer(FightSystem.getPlugin(), this::runSync, 1, 1);
@ -98,56 +142,59 @@ public class PacketProcessor {
}
private void playerJoins() throws IOException {
int entityId = source.rInt();
int userId = source.rInt();
int entityId = source.readInt();
int userId = source.readInt();
execSync(() -> new REntity(entityId, userId));
}
private void entityMoves() throws IOException {
int entityId = source.rInt();
double locX = source.rDouble();
double locY = source.rDouble();
double locZ = source.rDouble();
float pitch = source.rFloat();
float yaw = source.rFloat();
byte headYaw = source.rByte();
int entityId = source.readInt();
double locX = source.readDouble() - arenaMinX + Config.ArenaRegion.getMinX();
double locY = source.readDouble() - arenaMinY + Config.BluePasteRegion.getMinY();
double z = source.readDouble() - arenaMinZ;
if(rotateZ)
z = Config.ArenaRegion.getSizeZ() - z;
double locZ = z + Config.ArenaRegion.getMinZ();
float pitch = source.readFloat();
float yaw = source.readFloat() + (rotateZ ? 360 : 0);
byte headYaw = (byte)((source.readByte() + (rotateZ ? 128 : 0)) % 256);
execSync(() -> REntity.getEntity(entityId).move(locX, locY, locZ, pitch, yaw, headYaw));
}
private void entityDespawns() throws IOException {
int entityId = source.rInt();
int entityId = source.readInt();
execSync(() -> REntity.getEntity(entityId).die());
}
private void entitySneak() throws IOException {
int entityId = source.rInt();
boolean sneaking = source.rBoolean();
int entityId = source.readInt();
boolean sneaking = source.readBoolean();
execSync(() -> REntity.getEntity(entityId).sneak(sneaking));
}
private void entityAnimation() throws IOException {
int entityId = source.rInt();
byte animation = source.rByte();
int entityId = source.readInt();
byte animation = source.readByte();
execSync(() -> REntity.getEntity(entityId).animation(animation));
}
private void tntSpawn() throws IOException {
int entityId = source.rInt();
int entityId = source.readInt();
execSync(() -> new REntity(entityId, EntityType.PRIMED_TNT));
}
private void entityVelocity() throws IOException {
int entityId = source.rInt();
int entityId = source.readInt();
double dX = source.rDouble();
double dY = source.rDouble();
double dZ = source.rDouble();
double dX = source.readDouble();
double dY = source.readDouble();
double dZ = rotateZ ? -source.readDouble() : source.readDouble();
execSync(() -> {
REntity entity = REntity.getEntity(entityId);
@ -157,49 +204,71 @@ public class PacketProcessor {
}
private void playerItem() throws IOException {
int entityId = source.rInt();
String item = source.rString();
boolean enchanted = source.rBoolean();
String slot = source.rString();
int entityId = source.readInt();
String item = source.readUTF();
boolean enchanted = source.readBoolean();
String slot = source.readUTF();
execSync(() -> REntity.getEntity(entityId).setItem(item, enchanted, slot));
}
private void arrowSpawn() throws IOException {
int entityId = source.rInt();
int entityId = source.readInt();
execSync(() -> new REntity(entityId, EntityType.ARROW));
}
private void fireballSpawn() throws IOException {
int entityId = source.rInt();
int entityId = source.readInt();
execSync(() -> new REntity(entityId, EntityType.FIREBALL));
}
private void send(ChatMessageType type) throws IOException {
String message = source.rString();
String message = source.readUTF();
BaseComponent[] text = TextComponent.fromLegacyText(message);
Bukkit.getOnlinePlayers().forEach(p -> p.spigot().sendMessage(type, text));
}
private void arenaInfo() throws IOException {
rotateZ = source.readBoolean() != Config.blueNegZ();
arenaMinY = Byte.toUnsignedInt(source.readByte());
arenaMinX = source.readInt();
arenaMinZ = source.readInt();
}
private void shortBlock() throws IOException {
int x = Byte.toUnsignedInt(source.rByte()) + Config.ArenaRegion.getMinX();
int y = Byte.toUnsignedInt(source.rByte());
int z = Byte.toUnsignedInt(source.rByte()) + Config.ArenaRegion.getMinZ();
int blockState = source.rShort();
int x = Byte.toUnsignedInt(source.readByte()) + Config.ArenaRegion.getMinX();
int y = Byte.toUnsignedInt(source.readByte());
int z = Byte.toUnsignedInt(source.readByte()) + Config.ArenaRegion.getMinZ();
int blockState = source.readShort();
setBlock(x, y, z, blockState);
}
private void block() throws IOException {
int x = source.rInt();
int y = Byte.toUnsignedInt(source.rByte());
int z = source.rInt();
int blockState = source.rInt();
private void shortRelativeBlock() throws IOException {
int x = Byte.toUnsignedInt(source.readByte());
int y = Byte.toUnsignedInt(source.readByte());
int z = Byte.toUnsignedInt(source.readByte());
int blockState = source.readShort();
setBlock(x, y, z, blockState);
if(rotateZ)
z = Config.ArenaRegion.getSizeZ() - z;
setBlock(x + Config.ArenaRegion.getMinX(), y + Config.BluePasteRegion.getMinY(), z + Config.ArenaRegion.getMinZ(), blockState);
}
private void block() throws IOException {
int x = source.readInt() - arenaMinX;
int y = Byte.toUnsignedInt(source.readByte()) - arenaMinY;
int z = source.readInt() - arenaMinZ;
int blockState = source.readInt();
if(rotateZ)
z = Config.ArenaRegion.getSizeZ() - z;
setBlock(x + Config.ArenaRegion.getMinX(), y + Config.BluePasteRegion.getMinY(), z + Config.ArenaRegion.getMinZ(), blockState);
}
private void setBlock(int x, int y, int z, int blockState){
@ -210,25 +279,25 @@ public class PacketProcessor {
}
private void particle() throws IOException {
double x = source.rDouble();
double y = source.rDouble();
double z = source.rDouble();
double x = source.readDouble();
double y = source.readDouble();
double z = source.readDouble();
String particleName = source.rString();
String particleName = source.readUTF();
execSync(() -> world.spawnParticle(Particle.valueOf(particleName), x, y, z, 1));
}
private void sound() throws IOException {
int x = source.rInt();
int y = source.rInt();
int z = source.rInt();
int x = source.readInt();
int y = source.readInt();
int z = source.readInt();
String soundName = source.rString();
String soundCategory = source.rString();
String soundName = source.readUTF();
String soundCategory = source.readUTF();
float volume = source.rFloat();
float pitch = source.rFloat();
float volume = source.readFloat();
float pitch = source.readFloat();
Sound sound = Sound.valueOf(soundName);
SoundCategory sCategory = SoundCategory.valueOf(soundCategory);
@ -237,10 +306,10 @@ public class PacketProcessor {
}
private void soundAtPlayer() throws IOException {
String soundName = source.rString();
String soundName = source.readUTF();
float volume = source.rFloat();
float pitch = source.rFloat();
float volume = source.readFloat();
float pitch = source.readFloat();
Sound sound = Sound.valueOf(soundName);
@ -252,14 +321,21 @@ public class PacketProcessor {
}
private void pasteSchem(FightTeam team) throws IOException {
int schemId = source.rInt();
int schemId = source.readInt();
execSync(() -> team.pasteSchem(Schematic.getSchemFromDB(schemId)));
}
private void pasteEmbeddedSchem(FightTeam team) throws IOException {
int schemId = source.readInt();
Clipboard clipboard = Schematic.clipboardFromStream(source, Core.getVersion() > 12);
execSync(() -> team.pasteSchem(schemId, clipboard));
}
private void teams() throws IOException {
int blueId = source.rInt();
int redId = source.rInt();
int blueId = source.readInt();
int redId = source.readInt();
execSync(() -> {
pasteForTeam(blueId, Fight.getBlueTeam());
@ -274,14 +350,14 @@ public class PacketProcessor {
}
private void scoreboardTitle() throws IOException {
String title = source.rString();
String title = source.readUTF();
FightScoreboard.getScoreboard().setTitle(title);
}
private void scoreboardData() throws IOException {
String key = source.rString();
int value = source.rInt();
String key = source.readUTF();
int value = source.readInt();
FightScoreboard.getScoreboard().addScore(key, value);
}
@ -299,123 +375,43 @@ public class PacketProcessor {
}
private void bow() throws IOException {
int entityId = source.rInt();
boolean drawn = source.rBoolean();
boolean offHand = source.rBoolean();
int entityId = source.readInt();
boolean drawn = source.readBoolean();
boolean offHand = source.readBoolean();
execSync(() -> REntity.getEntity(entityId).setBowDrawn(drawn, offHand));
}
private void damage() throws IOException {
int entityId = source.rInt();
int entityId = source.readInt();
execSync(() -> REntity.getEntity(entityId).damage());
}
private void fireTick() throws IOException {
int entityId = source.rInt();
boolean perma = source.rBoolean();
int entityId = source.readInt();
boolean perma = source.readBoolean();
execSync(() -> REntity.getEntity(entityId).setOnFire(perma));
}
private void tick(){
execSync(REntity::tickFire);
if(!source.async())
tickFinished = true;
}
private void process(){
tickFinished = false;
try{
boolean tickFinished = false;
while(!source.isClosed() && !tickFinished){
byte packetType = source.rByte();
switch(packetType){
case 0x00:
playerJoins();
break;
case 0x01:
entityMoves();
break;
case 0x02:
entityDespawns();
break;
case 0x03:
entitySneak();
break;
case 0x04:
entityAnimation();
break;
case 0x05:
tntSpawn();
break;
case 0x06:
entityVelocity();
break;
case 0x07:
playerItem();
break;
case 0x08:
arrowSpawn();
break;
case 0x09:
fireballSpawn();
break;
case 0x0A:
bow();
break;
case 0x0B:
damage();
break;
case 0x0C:
fireTick();
break;
case 0x30:
block();
break;
case 0x31:
particle();
break;
case 0x32:
sound();
break;
case 0x33:
shortBlock();
break;
case 0x34:
soundAtPlayer();
break;
case (byte) 0xA0:
send(ChatMessageType.CHAT);
break;
case (byte) 0xA1:
send(ChatMessageType.ACTION_BAR);
break;
case (byte) 0xA2:
send(ChatMessageType.SYSTEM);
break;
case (byte) 0xB0:
pasteSchem(Fight.getBlueTeam());
break;
case (byte) 0xB1:
pasteSchem(Fight.getRedTeam());
break;
case (byte) 0xB2:
teams();
break;
case (byte) 0xC0:
scoreboardTitle();
break;
case (byte) 0xC1:
scoreboardData();
break;
case (byte) 0xEF:
// Comment
source.rString();
break;
case (byte) 0xFF:
//Tick
execSync(REntity::tickFire);
if(!source.async())
tickFinished = true;
break;
default:
Bukkit.getLogger().log(Level.SEVERE, "Unknown packet {} recieved, closing.", packetType);
source.close();
int packetType = Byte.toUnsignedInt(source.readByte());
PacketParser parser = packetDecoder[packetType];
if(parser != null){
parser.process();
}else{
Bukkit.getLogger().log(Level.SEVERE, "Unknown packet " + packetType + " recieved, closing.");
source.close();
}
}
} catch (EOFException e) {
@ -437,4 +433,8 @@ public class PacketProcessor {
new VersionedRunnable(() -> RecordSystem_14.setBlock(world, x, y, z, blockState), 14),
new VersionedRunnable(() -> RecordSystem_15.setBlock(world, x, y, z, blockState), 15));
}
private interface PacketParser{
void process() throws IOException;
}
}

Datei anzeigen

@ -23,52 +23,20 @@ import org.bukkit.Bukkit;
import java.io.DataInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.util.logging.Level;
public abstract class PacketSource {
public abstract class PacketSource extends DataInputStream {
protected final DataInputStream inputStream;
protected PacketSource(DataInputStream inputStream){
this.inputStream = inputStream;
protected PacketSource(InputStream inputStream){
super(inputStream);
new PacketProcessor(this);
}
public byte rByte() throws IOException {
return inputStream.readByte();
}
public boolean rBoolean() throws IOException {
return inputStream.readBoolean();
}
public short rShort() throws IOException {
return inputStream.readShort();
}
public int rInt() throws IOException {
return inputStream.readInt();
}
public long rLong() throws IOException {
return inputStream.readLong();
}
public float rFloat() throws IOException {
return inputStream.readFloat();
}
public double rDouble() throws IOException {
return inputStream.readDouble();
}
public String rString() throws IOException {
return inputStream.readUTF();
}
@Override
public void close(){
try {
inputStream.close();
super.close();
} catch (IOException e) {
Bukkit.getLogger().log(Level.SEVERE, "IOException on disable", e);
}

Datei anzeigen

@ -24,6 +24,7 @@ import de.steamwar.fightsystem.ArenaMode;
import de.steamwar.fightsystem.Config;
import de.steamwar.fightsystem.fight.*;
import de.steamwar.fightsystem.states.FightState;
import de.steamwar.sql.Schematic;
import de.steamwar.sql.SteamwarUser;
import org.bukkit.Bukkit;
import org.bukkit.Location;
@ -35,6 +36,8 @@ import org.bukkit.util.Vector;
import java.io.DataOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.util.logging.Level;
public interface Recorder {
@ -47,6 +50,7 @@ public interface Recorder {
teamIds(Config.EventTeamBlueID, Config.EventTeamRedID);
}
arenaInfo();
enableTeam(Fight.getBlueTeam());
enableTeam(Fight.getRedTeam());
}
@ -92,20 +96,26 @@ public interface Recorder {
* PlayerDamagePacket (0x0B) + int EntityId
* SetOnFire (0x0C) + int EntityId + boolean perma
*
* ArenaInfo (0x20) + bool blueNegZ + byte arenaY + int arenaMinX + int arenaMinZ
*
* BlockPacket (0x30) + pos int, byte, int + int BlockState
* ParticlePacket (0x31) + double x, y, z + string particleType
* SoundPacket (0x32) + int x, y, z + string soundType + string soundCategory + float volume, pitch
* ShortBlockPacket (0x33) + pos relative to ArenaMinX,ArenaMinZ byte, byte, byte + short BlockState
* SoundAtPlayerPacket (0x34) + string (soundType, soundCategory) + float volume, pitch
* ShortBlockPacket (0x35) + pos relative to ArenaMinX,BluePasteY,ArenaMinZ byte, byte, byte + short BlockState
*
*
* ChatPacket (0xA0) + String message
* ActionBarPacket (0xA1) + String message
* SystemPacket (0xA2) + String message
*
* BlueSchemPacket (0xB0) + int blueSchemId
* RedSchemPacket (0xB1) + int redSchemId
* TeamIDPacket (0xB2) + int blueTeamId, redTeamId
* BlueEmbeddedSchemPacket (0xB3) + int blueSchemId + gzipt NBT blob
* RedEmbeddedSchemPacket (0xB4) + int redSchemId + gzipt NBT blob
*
* ScoreboardTitlePacket (0xC0) + String scoreboardTitle
* ScoreboardDataPacket (0xC1) + String key + int value
*
@ -185,16 +195,22 @@ public interface Recorder {
write(0x0c, e.getEntityId(), perma);
}
default void arenaInfo(){
write(0x20, Config.blueNegZ(), (byte)Config.BluePasteRegion.getMinY(),
Config.ArenaRegion.getMinX(), Config.ArenaRegion.getMinZ());
}
default void blockChange(Block block){
int blockState = VersionedCallable.call(new VersionedCallable<>(() -> RecordSystem_8.blockToId(block), 8),
new VersionedCallable<>(() -> RecordSystem_14.blockToId(block), 14),
new VersionedCallable<>(() -> RecordSystem_15.blockToId(block), 15));
int shortX = block.getX() - Config.ArenaRegion.getMinX();
int shortY = block.getY() - Config.BluePasteRegion.getMinY();
int shortZ = block.getZ() - Config.ArenaRegion.getMinZ();
if((short)blockState == blockState && shortX > 0 && shortX < 256 && shortZ > 0 && shortZ < 256){
if((short)blockState == blockState && shortX >= 0 && shortX < 256 && shortY >= 0 && shortZ >= 0 && shortZ < 256){
//Short block packet
write(0x33, (byte)shortX, (byte)block.getY(), (byte)shortZ, (short)blockState);
write(0x35, (byte)shortX, (byte)shortY, (byte)shortZ, (short)blockState);
}else{
//Block packet
write(0x30, block.getX(), (byte)block.getY(), block.getZ(), blockState);
@ -225,16 +241,26 @@ public interface Recorder {
write(0xa2, s);
}
default void teamIds(int blueTeamId, int redTeamId) {
write(0xb2, blueTeamId, redTeamId);
}
default void blueSchem(int schemId) {
write(0xb0, schemId);
try {
write(0xb3, schemId, Schematic.getSchemFromDB(schemId).schemData());
} catch (IOException e) {
Bukkit.getLogger().log(Level.SEVERE, "Could not embed schematic", e);
write(0xb0, schemId);
}
}
default void redSchem(int schemId) {
write(0xb1, schemId);
}
default void teamIds(int blueTeamId, int redTeamId) {
write(0xb2, blueTeamId, redTeamId);
try {
write(0xb4, schemId, Schematic.getSchemFromDB(schemId).schemData());
} catch (IOException e) {
Bukkit.getLogger().log(Level.SEVERE, "Could not embed schematic", e);
write(0xb1, schemId);
}
}
default void scoreboardTitle(String title){
@ -252,28 +278,28 @@ public interface Recorder {
default void write(int id, Object... objects){
DataOutputStream stream = getStream();
try {
synchronized (stream) {
stream.writeByte(id);
for(Object o : objects){
if(o instanceof Boolean)
stream.writeBoolean((Boolean)o);
else if(o instanceof Byte)
stream.writeByte((Byte)o);
else if(o instanceof Short)
stream.writeShort((Short)o);
else if(o instanceof Integer)
stream.writeInt((Integer)o);
else if(o instanceof Float)
stream.writeFloat((Float)o);
else if(o instanceof Double)
stream.writeDouble((Double)o);
else if(o instanceof String)
stream.writeUTF((String)o);
else
throw new SecurityException("Undefined write for: " + o.getClass().getName());
}
stream.flush();
stream.writeByte(id);
for(Object o : objects){
if(o instanceof Boolean)
stream.writeBoolean((Boolean)o);
else if(o instanceof Byte)
stream.writeByte((Byte)o);
else if(o instanceof Short)
stream.writeShort((Short)o);
else if(o instanceof Integer)
stream.writeInt((Integer)o);
else if(o instanceof Float)
stream.writeFloat((Float)o);
else if(o instanceof Double)
stream.writeDouble((Double)o);
else if(o instanceof String)
stream.writeUTF((String)o);
else if(o instanceof InputStream)
copy((InputStream) o, stream);
else
throw new SecurityException("Undefined write for: " + o.getClass().getName());
}
stream.flush();
} catch (IOException e) {
Bukkit.getLogger().log(Level.SEVERE, "Could not write", e);
try {
@ -283,4 +309,11 @@ public interface Recorder {
}
}
}
static void copy(InputStream var0, OutputStream var1) throws IOException {
int var5;
for(byte[] var4 = new byte[8192]; (var5 = var0.read(var4)) > 0;) {
var1.write(var4, 0, var5);
}
}
}

Datei anzeigen

@ -52,7 +52,7 @@ public class WinconditionTimeTechKO extends Wincondition {
public WinconditionTimeTechKO(){
super("TechKO");
if(Config.BlueToRedZ > 0) {
if(Config.blueNegZ()) {
smallerZteam = Fight.getBlueTeam();
biggerZteam = Fight.getRedTeam();
}else{