Better WorldReset and faster blockplacement
Dieser Commit ist enthalten in:
Ursprung
61af402960
Commit
4116f32256
@ -32,8 +32,11 @@ import net.md_5.bungee.api.ChatMessageType;
|
||||
import net.md_5.bungee.api.chat.BaseComponent;
|
||||
import net.md_5.bungee.api.chat.TextComponent;
|
||||
import net.minecraft.server.v1_15_R1.Block;
|
||||
import net.minecraft.server.v1_15_R1.BlockPosition;
|
||||
import net.minecraft.server.v1_15_R1.IBlockData;
|
||||
import net.minecraft.server.v1_15_R1.WorldServer;
|
||||
import org.bukkit.*;
|
||||
import org.bukkit.craftbukkit.v1_15_R1.block.data.CraftBlockData;
|
||||
import org.bukkit.craftbukkit.v1_15_R1.CraftWorld;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.scheduler.BukkitTask;
|
||||
|
||||
@ -252,8 +255,14 @@ class PacketProcessor {
|
||||
if (Config.TechhiderActive && Config.HiddenBlocks.contains(blockState)) {
|
||||
blockState = Config.ObfuscateWith;
|
||||
}
|
||||
CraftBlockData craftBlockData = CraftBlockData.fromData(Objects.requireNonNull(Block.REGISTRY_ID.fromId(blockState)));
|
||||
Bukkit.getScheduler().runTask(SpectateSystem.get(), () -> world.getBlockAt(x, y, z).setBlockData(craftBlockData));
|
||||
IBlockData blockData = Objects.requireNonNull(Block.REGISTRY_ID.fromId(blockState));
|
||||
Bukkit.getScheduler().runTask(SpectateSystem.get(), () -> {
|
||||
WorldServer cworld = ((CraftWorld)world).getHandle();
|
||||
BlockPosition pos = new BlockPosition(x, y, z);
|
||||
cworld.removeTileEntity(pos);
|
||||
cworld.setTypeAndData(pos, blockData, 1042);
|
||||
cworld.getChunkProvider().flagDirty(pos);
|
||||
});
|
||||
}
|
||||
|
||||
private void endSpectating(){
|
||||
|
@ -23,6 +23,7 @@ import de.steamwar.spectatesystem.Config;
|
||||
import de.steamwar.spectatesystem.SpectateSystem;
|
||||
import de.steamwar.spectatesystem.elements.REntity;
|
||||
import net.minecraft.server.v1_15_R1.BlockPosition;
|
||||
import net.minecraft.server.v1_15_R1.Blocks;
|
||||
import net.minecraft.server.v1_15_R1.IBlockData;
|
||||
import net.minecraft.server.v1_15_R1.WorldServer;
|
||||
import org.bukkit.Bukkit;
|
||||
@ -52,7 +53,10 @@ public class WorldLoader {
|
||||
REntity.removeAll();
|
||||
World backupWorld = new WorldCreator(world.getName() + "-backup").createWorld();
|
||||
|
||||
int delay = 0;
|
||||
int delay = 1;
|
||||
Bukkit.getScheduler().runTaskLater(SpectateSystem.get(), () -> fillTeamArea(Config.TeamBlueCornerX, Config.TeamBlueCornerY, Config.TeamBlueCornerZ, Config.SchemsizeX, Config.SchemsizeY, Config.SchemsizeZ), delay++);
|
||||
Bukkit.getScheduler().runTaskLater(SpectateSystem.get(), () -> fillTeamArea(Config.TeamRedCornerX, Config.TeamRedCornerY, Config.TeamRedCornerZ, Config.SchemsizeX, Config.SchemsizeY, Config.SchemsizeZ), delay++);
|
||||
|
||||
for(int cX = (int) Math.floor(Config.ArenaMinX / 16.0); cX <= (int) Math.floor(Config.ArenaMaxX / 16.0); cX++){
|
||||
for(int cZ = (int) Math.floor(Config.ArenaMinZ / 16.0); cZ <= (int) Math.floor(Config.ArenaMaxZ / 16.0); cZ++){
|
||||
int finalCX = cX;
|
||||
@ -65,6 +69,20 @@ public class WorldLoader {
|
||||
});
|
||||
}
|
||||
|
||||
public static void fillTeamArea(int teamX, int teamY, int teamZ, int sizeX, int sizeY, int sizeZ){
|
||||
WorldServer cworld = ((CraftWorld)world).getHandle();
|
||||
for(int x = teamX; x < teamX + sizeX; x++){
|
||||
for(int y = teamY; y < teamY + sizeY; y++){
|
||||
for(int z = teamZ; z < teamZ + sizeZ; z++){
|
||||
BlockPosition pos = new BlockPosition(x, y, z);
|
||||
cworld.removeTileEntity(pos);
|
||||
cworld.setTypeAndData(pos, Blocks.AIR.getBlockData(), 1042);
|
||||
cworld.getChunkProvider().flagDirty(pos);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static void reloadChunk(World backupWorld, int cX, int cZ){
|
||||
WorldServer cworld = ((CraftWorld)world).getHandle();
|
||||
WorldServer backup = ((CraftWorld) backupWorld).getHandle();
|
||||
|
In neuem Issue referenzieren
Einen Benutzer sperren