Commit recent changes
Signed-off-by: Lixfel <agga-games@gmx.de>
Dieser Commit ist enthalten in:
Ursprung
6db5d46af3
Commit
bef28a99b2
@ -0,0 +1,31 @@
|
|||||||
|
/*
|
||||||
|
This file is a part of the SteamWar software.
|
||||||
|
|
||||||
|
Copyright (C) 2020 SteamWar.de-Serverteam
|
||||||
|
|
||||||
|
This program is free software: you can redistribute it and/or modify
|
||||||
|
it under the terms of the GNU Affero General Public License as published by
|
||||||
|
the Free Software Foundation, either version 3 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
This program is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
GNU Affero General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU Affero General Public License
|
||||||
|
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package de.steamwar.fightsystem.record;
|
||||||
|
|
||||||
|
import org.bukkit.block.Block;
|
||||||
|
import org.bukkit.craftbukkit.v1_15_R1.block.CraftBlock;
|
||||||
|
|
||||||
|
class RecordSystem_15 {
|
||||||
|
private RecordSystem_15(){}
|
||||||
|
|
||||||
|
static int blockToId(Block block){
|
||||||
|
return net.minecraft.server.v1_15_R1.Block.REGISTRY_ID.getId(((CraftBlock)block).getNMS());
|
||||||
|
}
|
||||||
|
}
|
31
FightSystem_8/src/de/steamwar/fightsystem/record/RecordSystem_8.java
Normale Datei
31
FightSystem_8/src/de/steamwar/fightsystem/record/RecordSystem_8.java
Normale Datei
@ -0,0 +1,31 @@
|
|||||||
|
/*
|
||||||
|
This file is a part of the SteamWar software.
|
||||||
|
|
||||||
|
Copyright (C) 2020 SteamWar.de-Serverteam
|
||||||
|
|
||||||
|
This program is free software: you can redistribute it and/or modify
|
||||||
|
it under the terms of the GNU Affero General Public License as published by
|
||||||
|
the Free Software Foundation, either version 3 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
This program is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
GNU Affero General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU Affero General Public License
|
||||||
|
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package de.steamwar.fightsystem.record;
|
||||||
|
|
||||||
|
import org.bukkit.block.Block;
|
||||||
|
|
||||||
|
class RecordSystem_8 {
|
||||||
|
private RecordSystem_8(){}
|
||||||
|
|
||||||
|
@SuppressWarnings("deprecation")
|
||||||
|
static int blockToId(Block block){
|
||||||
|
return block.getTypeId() << 4 + block.getData();
|
||||||
|
}
|
||||||
|
}
|
@ -19,16 +19,15 @@
|
|||||||
|
|
||||||
package de.steamwar.fightsystem.record;
|
package de.steamwar.fightsystem.record;
|
||||||
|
|
||||||
|
import de.steamwar.core.Core;
|
||||||
import de.steamwar.fightsystem.Config;
|
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.sql.SteamwarUser;
|
import de.steamwar.sql.SteamwarUser;
|
||||||
import net.minecraft.server.v1_15_R1.BlockPosition;
|
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
import org.bukkit.World;
|
import org.bukkit.World;
|
||||||
import org.bukkit.block.Block;
|
import org.bukkit.block.Block;
|
||||||
import org.bukkit.craftbukkit.v1_15_R1.block.CraftBlock;
|
|
||||||
import org.bukkit.craftbukkit.v1_15_R1.entity.CraftEntity;
|
import org.bukkit.craftbukkit.v1_15_R1.entity.CraftEntity;
|
||||||
import org.bukkit.entity.Entity;
|
import org.bukkit.entity.Entity;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
@ -164,22 +163,24 @@ public class RecordSystem {
|
|||||||
spawnEntity(e);
|
spawnEntity(e);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static synchronized void blockChange(BlockPosition pos, int blockState){
|
public static synchronized void blockChange(Block block){
|
||||||
int shortX = pos.getX() - Config.ArenaMinX;
|
int blockState = blockToId(block);
|
||||||
int shortZ = pos.getZ() - Config.ArenaMinZ;
|
|
||||||
|
int shortX = block.getX() - Config.ArenaMinX;
|
||||||
|
int shortZ = block.getZ() - Config.ArenaMinZ;
|
||||||
if((short)blockState == blockState && shortX > 0 && shortX < 256 && shortZ > 0 && shortZ < 256){
|
if((short)blockState == blockState && shortX > 0 && shortX < 256 && shortZ > 0 && shortZ < 256){
|
||||||
//Short block packet
|
//Short block packet
|
||||||
Recorder.rByte(0x33);
|
Recorder.rByte(0x33);
|
||||||
Recorder.rByte(shortX);
|
Recorder.rByte(shortX);
|
||||||
Recorder.rByte(pos.getY());
|
Recorder.rByte(block.getY());
|
||||||
Recorder.rByte(shortZ);
|
Recorder.rByte(shortZ);
|
||||||
Recorder.rShort((short)blockState);
|
Recorder.rShort((short)blockState);
|
||||||
}else{
|
}else{
|
||||||
//Block packet
|
//Block packet
|
||||||
Recorder.rByte(0x30);
|
Recorder.rByte(0x30);
|
||||||
Recorder.rInt(pos.getX());
|
Recorder.rInt(block.getX());
|
||||||
Recorder.rByte(pos.getY());
|
Recorder.rByte(block.getY());
|
||||||
Recorder.rInt(pos.getZ());
|
Recorder.rInt(block.getZ());
|
||||||
Recorder.rInt(blockState);
|
Recorder.rInt(blockState);
|
||||||
}
|
}
|
||||||
Recorder.flush();
|
Recorder.flush();
|
||||||
@ -269,10 +270,6 @@ public class RecordSystem {
|
|||||||
Recorder.flush();
|
Recorder.flush();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static synchronized void blockChange(Block block){
|
|
||||||
blockChange(((CraftBlock)block).getPosition(), net.minecraft.server.v1_15_R1.Block.REGISTRY_ID.getId(((CraftBlock)block).getNMS()));
|
|
||||||
}
|
|
||||||
|
|
||||||
private static void checkWorldState(){
|
private static void checkWorldState(){
|
||||||
tick();
|
tick();
|
||||||
|
|
||||||
@ -290,4 +287,17 @@ public class RecordSystem {
|
|||||||
entityMoves(e);
|
entityMoves(e);
|
||||||
entitySpeed(e);
|
entitySpeed(e);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static int blockToId(Block block){
|
||||||
|
switch(Core.getVersion()){
|
||||||
|
case 8:
|
||||||
|
case 9:
|
||||||
|
case 10:
|
||||||
|
case 12:
|
||||||
|
return RecordSystem_8.blockToId(block);
|
||||||
|
case 15:
|
||||||
|
default:
|
||||||
|
return RecordSystem_15.blockToId(block);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
In neuem Issue referenzieren
Einen Benutzer sperren