mirror of
https://github.com/plexusorg/Plex-FAWE.git
synced 2025-06-11 20:13:55 +00:00
cfi packet listener
This commit is contained in:
@ -45,6 +45,7 @@ import java.util.concurrent.Executors;
|
||||
import java.util.concurrent.Future;
|
||||
import java.util.concurrent.ThreadPoolExecutor;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import java.util.concurrent.atomic.AtomicBoolean;
|
||||
import java.util.function.Supplier;
|
||||
|
||||
import static com.google.common.base.Preconditions.checkNotNull;
|
||||
@ -104,6 +105,7 @@ public enum FaweCache implements Trimable {
|
||||
|
||||
@Override
|
||||
public synchronized boolean trim(boolean aggressive) {
|
||||
CHUNK_FLAG.clean();
|
||||
BYTE_BUFFER_8192.clean();
|
||||
BLOCK_TO_PALETTE.clean();
|
||||
PALETTE_TO_BLOCK.clean();
|
||||
@ -205,6 +207,7 @@ public enum FaweCache implements Trimable {
|
||||
/*
|
||||
thread cache
|
||||
*/
|
||||
public final CleanableThreadLocal<AtomicBoolean> CHUNK_FLAG = new CleanableThreadLocal<>(AtomicBoolean::new); // resets to false
|
||||
|
||||
public final CleanableThreadLocal<byte[]> BYTE_BUFFER_8192 = new CleanableThreadLocal<>(() -> new byte[8192]);
|
||||
|
||||
|
@ -289,12 +289,10 @@ public class HeightMapMCAGenerator extends MCAWriter implements StreamChange, Dr
|
||||
int lenCX = (getWidth() + 15) >> 4;
|
||||
int lenCZ = (getLength() + 15) >> 4;
|
||||
|
||||
int OX = chunkOffset.getBlockX();
|
||||
int OZ = chunkOffset.getBlockZ();
|
||||
|
||||
Location position = player.getLocation();
|
||||
int pcx = (position.getBlockX() >> 4) - OX;
|
||||
int pcz = (position.getBlockZ() >> 4) - OZ;
|
||||
int pcx = (position.getBlockX() >> 4) - chunkOffset.getBlockX();
|
||||
int pcz = (position.getBlockZ() >> 4) - chunkOffset.getBlockZ();
|
||||
|
||||
int scx = Math.max(0, pcx - 15);
|
||||
int scz = Math.max(0, pcz - 15);
|
||||
@ -303,21 +301,23 @@ public class HeightMapMCAGenerator extends MCAWriter implements StreamChange, Dr
|
||||
|
||||
for (int chunkZ = scz; chunkZ <= ecz; chunkZ++) {
|
||||
for (int chunkX = scx; chunkX <= ecx; chunkX++) {
|
||||
int finalChunkX = chunkX;
|
||||
int finalChunkZ = chunkZ;
|
||||
|
||||
int realWorldX = chunkX + OX;
|
||||
int realWorldZ = chunkZ + OZ;
|
||||
|
||||
Supplier<IBlocks> blocksSupplier = () -> getChunk(finalChunkX, finalChunkZ);
|
||||
|
||||
ChunkPacket packet = new ChunkPacket(realWorldX, realWorldZ, blocksSupplier, true);
|
||||
world.sendFakeChunk(player, packet);
|
||||
refreshChunk(world, chunkX, chunkZ);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void refreshChunk(World world, int chunkX, int chunkZ) {
|
||||
Supplier<IBlocks> blocksSupplier = () -> getChunk(chunkX, chunkZ);
|
||||
|
||||
int realChunkX = chunkX + chunkOffset.getBlockX();
|
||||
int realChunkZ = chunkZ + chunkOffset.getBlockZ();
|
||||
|
||||
ChunkPacket packet = new ChunkPacket(realChunkX, realChunkZ, blocksSupplier, true);
|
||||
world.sendFakeChunk(player, packet);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void sendFakeChunk(@Nullable Player player, ChunkPacket packet) {
|
||||
if (this.player != null) {
|
||||
@ -328,7 +328,7 @@ public class HeightMapMCAGenerator extends MCAWriter implements StreamChange, Dr
|
||||
@Override
|
||||
public void refreshChunk(int chunkX, int chunkZ) {
|
||||
if (chunkOffset != null && player != null) {
|
||||
player.getWorld().refreshChunk(chunkX, chunkZ);
|
||||
refreshChunk(player.getWorld(), chunkX, chunkZ);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -10,10 +10,10 @@ import java.util.Base64;
|
||||
|
||||
public enum Jars {
|
||||
|
||||
MM_v1_4_0("https://github.com/InventivetalentDev/MapManager/releases/download/1.7.3-SNAPSHOT/MapManager_v1.7.3-SNAPSHOT.jar",
|
||||
MM_v1_7_3("https://github.com/InventivetalentDev/MapManager/releases/download/1.7.3-SNAPSHOT/MapManager_v1.7.3-SNAPSHOT.jar",
|
||||
"M3YLUQZZ66K2DMVDCYLEU38U3ZKRKHRAXQGGPVKFO6G=", 554831),
|
||||
|
||||
PL_v3_6_0("https://github.com/InventivetalentDev/PacketListenerAPI/releases/download/3.7.3-SNAPSHOT/PacketListenerAPI_v3.7.3-SNAPSHOT.jar",
|
||||
PL_v3_7_3("https://github.com/InventivetalentDev/PacketListenerAPI/releases/download/3.7.3-SNAPSHOT/PacketListenerAPI_v3.7.3-SNAPSHOT.jar",
|
||||
"ETDBRZLN5PRVDFR/MSQDPM6JJER3WQOKHCN8FUXO5ZM=", 167205),
|
||||
|
||||
;
|
||||
|
@ -39,6 +39,7 @@ import com.boydti.fawe.util.StringMan;
|
||||
import com.boydti.fawe.util.TextureHolder;
|
||||
import com.boydti.fawe.util.TextureUtil;
|
||||
import com.boydti.fawe.wrappers.WorldWrapper;
|
||||
import com.google.common.collect.Maps;
|
||||
import com.sk89q.jchronic.Chronic;
|
||||
import com.sk89q.jchronic.Options;
|
||||
import com.sk89q.jchronic.utils.Span;
|
||||
@ -90,7 +91,9 @@ import java.io.FileOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.time.ZoneId;
|
||||
import java.util.Calendar;
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.IdentityHashMap;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
@ -167,6 +170,7 @@ public class LocalSession implements TextureHolder {
|
||||
private boolean useServerCUI = false; // Save this to not annoy players.
|
||||
private ItemType wandItem;
|
||||
private ItemType navWandItem;
|
||||
private Map<String, String> macros = new HashMap<>();
|
||||
|
||||
/**
|
||||
* Construct the object.
|
||||
@ -296,6 +300,19 @@ public class LocalSession implements TextureHolder {
|
||||
}
|
||||
}
|
||||
|
||||
public Map<String, String> getMacros() {
|
||||
return Collections.unmodifiableMap(this.macros);
|
||||
}
|
||||
|
||||
public void setMacro(String key, String value) {
|
||||
this.macros.put(key, value);
|
||||
setDirty();
|
||||
}
|
||||
|
||||
public String getMacro(String key) {
|
||||
return this.macros.get(key);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get whether this session is "dirty" and has changes that needs to
|
||||
* be committed.
|
||||
|
@ -111,6 +111,15 @@ public class UtilityCommands {
|
||||
this.we = we;
|
||||
}
|
||||
|
||||
@Command(
|
||||
name = "/macro",
|
||||
desc = "Generate or run a macro"
|
||||
)
|
||||
@CommandPermissions("worldedit.macro")
|
||||
public void macro(Player player, LocalSession session, String name, String argument) throws IOException {
|
||||
|
||||
}
|
||||
|
||||
@Command(
|
||||
name = "/heightmapinterface",
|
||||
desc = "Generate the heightmap interface: https://github.com/boy0001/HeightMap"
|
||||
|
Reference in New Issue
Block a user