Revert migration of FaweCache to Kotlin

This commit is contained in:
MattBDev
2020-01-29 15:01:38 -05:00
parent 7d4acbdcac
commit 020c674c01
58 changed files with 647 additions and 673 deletions

View File

@ -382,7 +382,7 @@
// int z = location.getBlockZ();
//
// org.bukkit.block.Block bukkitBlock = location.getBlock();
// BaseBlock block = FaweCache.INSTANCE.getBlock(bukkitBlock.getTypeId(), bukkitBlock.getData());
// BaseBlock block = FaweCache.IMP.getBlock(bukkitBlock.getTypeId(), bukkitBlock.getData());
//
// // Read the NBT data
// Object nmsWorld = getHandleWorld.invoke(craftWorld);

View File

@ -201,10 +201,10 @@ public final class BukkitAdapter_1_14 extends NMSAdapter {
if (set == null) {
return newChunkSection(layer);
}
final int[] blockToPalette = FaweCache.INSTANCE.getBLOCK_TO_PALETTE().get();
final int[] paletteToBlock = FaweCache.INSTANCE.getPALETTE_TO_BLOCK().get();
final long[] blockStates = FaweCache.INSTANCE.getBLOCK_STATES().get();
final int[] blocksCopy = FaweCache.INSTANCE.getSECTION_BLOCKS().get();
final int[] blockToPalette = FaweCache.IMP.BLOCK_TO_PALETTE.get();
final int[] paletteToBlock = FaweCache.IMP.PALETTE_TO_BLOCK.get();
final long[] blockStates = FaweCache.IMP.BLOCK_STATES.get();
final int[] blocksCopy = FaweCache.IMP.SECTION_BLOCKS.get();
try {
int[] num_palette_buffer = new int[1];
int air;

View File

@ -490,9 +490,9 @@ public class BukkitGetBlocks_1_14 extends CharGetBlocks {
ChunkSection section = getSections()[layer];
// Section is null, return empty array
if (section == null) {
return FaweCache.INSTANCE.getEMPTY_CHAR_4096();
return FaweCache.IMP.EMPTY_CHAR_4096;
}
if (data == null || data == FaweCache.INSTANCE.getEMPTY_CHAR_4096()) {
if (data == null || data == FaweCache.IMP.EMPTY_CHAR_4096) {
data = new char[4096];
}
DelegateLock lock = BukkitAdapter_1_14.applyLock(section);
@ -519,8 +519,8 @@ public class BukkitGetBlocks_1_14 extends CharGetBlocks {
num_palette = ((DataPaletteHash<IBlockData>) palette).b();
} else {
num_palette = 0;
int[] paletteToBlockInts = FaweCache.INSTANCE.getPALETTE_TO_BLOCK().get();
char[] paletteToBlockChars = FaweCache.INSTANCE.getPALETTE_TO_BLOCK_CHAR().get();
int[] paletteToBlockInts = FaweCache.IMP.PALETTE_TO_BLOCK.get();
char[] paletteToBlockChars = FaweCache.IMP.PALETTE_TO_BLOCK_CHAR.get();
try {
for (int i = 0; i < 4096; i++) {
char paletteVal = data[i];
@ -546,7 +546,7 @@ public class BukkitGetBlocks_1_14 extends CharGetBlocks {
return data;
}
char[] paletteToOrdinal = FaweCache.INSTANCE.getPALETTE_TO_BLOCK_CHAR().get();
char[] paletteToOrdinal = FaweCache.IMP.PALETTE_TO_BLOCK_CHAR.get();
try {
if (num_palette != 1) {
for (int i = 0; i < num_palette; i++) {

View File

@ -179,10 +179,10 @@ public final class BukkitAdapter_1_15 extends NMSAdapter {
if (set == null) {
return newChunkSection(layer);
}
final int[] blockToPalette = FaweCache.INSTANCE.getBLOCK_TO_PALETTE().get();
final int[] paletteToBlock = FaweCache.INSTANCE.getPALETTE_TO_BLOCK().get();
final long[] blockStates = FaweCache.INSTANCE.getBLOCK_STATES().get();
final int[] blocksCopy = FaweCache.INSTANCE.getSECTION_BLOCKS().get();
final int[] blockToPalette = FaweCache.IMP.BLOCK_TO_PALETTE.get();
final int[] paletteToBlock = FaweCache.IMP.PALETTE_TO_BLOCK.get();
final long[] blockStates = FaweCache.IMP.BLOCK_STATES.get();
final int[] blocksCopy = FaweCache.IMP.SECTION_BLOCKS.get();
try {
int[] num_palette_buffer = new int[1];
int air;

View File

@ -96,7 +96,7 @@ public class BukkitGetBlocks_1_15 extends CharGetBlocks {
BiomeStorage index = getChunk().getBiomeIndex();
BiomeBase base = null;
if (y == -1) {
for (y = 0; y < FaweCache.WORLD_HEIGHT; y++) {
for (y = 0; y < FaweCache.IMP.WORLD_HEIGHT; y++) {
base = index.getBiome(x, y, z);
if (base != null) break;
}
@ -324,7 +324,7 @@ public class BukkitGetBlocks_1_15 extends CharGetBlocks {
if (biome != null) {
final Biome craftBiome = BukkitAdapter.adapt(biome);
BiomeBase nmsBiome = CraftBlock.biomeToBiomeBase(craftBiome);
for (int y = 0; y < FaweCache.WORLD_HEIGHT; y++) {
for (int y = 0; y < FaweCache.IMP.WORLD_HEIGHT; y++) {
currentBiomes.setBiome(x, y, z, nmsBiome);
}
}
@ -502,9 +502,9 @@ public class BukkitGetBlocks_1_15 extends CharGetBlocks {
ChunkSection section = getSections()[layer];
// Section is null, return empty array
if (section == null) {
return FaweCache.INSTANCE.getEMPTY_CHAR_4096();
return FaweCache.IMP.EMPTY_CHAR_4096;
}
if (data == null || data == FaweCache.INSTANCE.getEMPTY_CHAR_4096()) {
if (data == null || data == FaweCache.IMP.EMPTY_CHAR_4096) {
data = new char[4096];
}
DelegateLock lock = BukkitAdapter_1_15.applyLock(section);
@ -531,8 +531,8 @@ public class BukkitGetBlocks_1_15 extends CharGetBlocks {
num_palette = ((DataPaletteHash<IBlockData>) palette).b();
} else {
num_palette = 0;
int[] paletteToBlockInts = FaweCache.INSTANCE.getPALETTE_TO_BLOCK().get();
char[] paletteToBlockChars = FaweCache.INSTANCE.getPALETTE_TO_BLOCK_CHAR().get();
int[] paletteToBlockInts = FaweCache.IMP.PALETTE_TO_BLOCK.get();
char[] paletteToBlockChars = FaweCache.IMP.PALETTE_TO_BLOCK_CHAR.get();
try {
for (int i = 0; i < 4096; i++) {
char paletteVal = data[i];
@ -558,7 +558,7 @@ public class BukkitGetBlocks_1_15 extends CharGetBlocks {
return data;
}
char[] paletteToOrdinal = FaweCache.INSTANCE.getPALETTE_TO_BLOCK_CHAR().get();
char[] paletteToOrdinal = FaweCache.IMP.PALETTE_TO_BLOCK_CHAR.get();
try {
if (num_palette != 1) {
for (int i = 0; i < num_palette; i++) {

View File

@ -123,7 +123,7 @@ public class CFIPacketListener implements Listener {
protocolmanager.addPacketListener(new PacketAdapter(plugin, ListenerPriority.NORMAL, PacketType.Play.Server.MAP_CHUNK) {
@Override
public void onPacketSending(PacketEvent event) {
if (!event.isServerPacket() || FaweCache.INSTANCE.getCHUNK_FLAG().get().get()) return;
if (!event.isServerPacket() || FaweCache.IMP.CHUNK_FLAG.get().get()) return;
VirtualWorld gen = getGenerator(event);
if (gen != null) {
BlockVector3 origin = gen.getOrigin().toBlockPoint();

View File

@ -54,7 +54,7 @@ public final class AsyncDataContainer implements PersistentDataContainer {
Validate.notNull(key, "The provided key for the custom value was null");
Validate.notNull(type, "The provided type for the custom value was null");
Validate.notNull(value, "The provided value for the custom value was null");
get().put(key.toString(), FaweCache.INSTANCE.asTag(type.toPrimitive(value, null)));
get().put(key.toString(), FaweCache.IMP.asTag(type.toPrimitive(value, null)));
}
public <T, Z> boolean has(NamespacedKey key, PersistentDataType<T, Z> type) {

View File

@ -347,10 +347,10 @@ public final class FAWE_Spigot_v1_14_R4 extends CachedBukkitAdapter implements I
packet.setNativePacket(nmsPacket);
}
try {
FaweCache.INSTANCE.getCHUNK_FLAG().get().set(true);
FaweCache.IMP.CHUNK_FLAG.get().set(true);
entityPlayer.playerConnection.sendPacket(nmsPacket);
} finally {
FaweCache.INSTANCE.getCHUNK_FLAG().get().set(false);
FaweCache.IMP.CHUNK_FLAG.get().set(false);
}
}
});

View File

@ -345,10 +345,10 @@ public final class FAWE_Spigot_v1_15_R1 extends CachedBukkitAdapter implements I
packet.setNativePacket(nmsPacket);
}
try {
FaweCache.INSTANCE.getCHUNK_FLAG().get().set(true);
FaweCache.IMP.CHUNK_FLAG.get().set(true);
entityPlayer.playerConnection.sendPacket(nmsPacket);
} finally {
FaweCache.INSTANCE.getCHUNK_FLAG().get().set(false);
FaweCache.IMP.CHUNK_FLAG.get().set(false);
}
}
});