Signed-off-by: MattBDev <mattbdev@outlook.com>
This commit is contained in:
MattBDev
2016-09-14 12:16:22 -04:00
parent 56227a6d7d
commit 8e7e5dcb25
21 changed files with 1122 additions and 1289 deletions

View File

@ -12,8 +12,6 @@ import com.intellectualcrafters.plot.util.TaskManager;
import com.intellectualcrafters.plot.util.block.GlobalBlockQueue;
import com.intellectualcrafters.plot.util.block.LocalBlockQueue;
import com.intellectualcrafters.plot.util.expiry.PlotAnalysis;
import java.util.HashSet;
import java.util.Random;
import org.bukkit.Bukkit;
import org.bukkit.Material;
import org.bukkit.World;
@ -23,6 +21,9 @@ import org.bukkit.generator.ChunkGenerator.BiomeGrid;
import org.bukkit.material.Directional;
import org.bukkit.material.MaterialData;
import java.util.HashSet;
import java.util.Random;
public class BukkitHybridUtils extends HybridUtils {
@Override
@ -50,7 +51,8 @@ public class BukkitHybridUtils extends HybridUtils {
}
final BiomeGrid nullBiomeGrid = new BiomeGrid() {
@Override
public void setBiome(int a, int b, Biome c) {}
public void setBiome(int a, int b, Biome c) {
}
@Override
public Biome getBiome(int a, int b) {

View File

@ -0,0 +1,13 @@
package com.plotsquared.bukkit.util;
public class BukkitVersion {
public static int[] v1_10_2 = {1, 10, 2};
public static int[] v1_10_0 = {1, 10, 0};
public static int[] v1_9_4 = {1, 9, 4};
public static int[] v1_9_0 = {1, 9, 0};
public static int[] v1_8_3 = {1, 8, 3};
public static int[] v1_8_0 = {1, 8, 0};
public static int[] v1_7_6 = {1, 7, 6};
public static int[] v1_7_0 = {1, 7, 0};
public static int[] v1_6_0 = {1, 6, 0};
}

View File

@ -8,7 +8,6 @@ import com.google.common.collect.MapMaker;
import com.google.common.io.ByteSink;
import com.google.common.io.ByteSource;
import com.google.common.io.Closeables;
import com.google.common.io.Files;
import com.google.common.primitives.Primitives;
import org.bukkit.Bukkit;
import org.bukkit.Material;
@ -20,7 +19,6 @@ import java.io.DataInput;
import java.io.DataInputStream;
import java.io.DataOutput;
import java.io.DataOutputStream;
import java.io.File;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
@ -161,7 +159,6 @@ public class NbtFactory {
/**
* Load the content of a file from a stream.
*
* Use {@link Files#newInputStreamSupplier(File)} to provide a stream from a file.
* @param stream - the stream supplier.
* @param option - whether or not to decompress the input stream.
* @return The decoded NBT compound.
@ -196,7 +193,6 @@ public class NbtFactory {
/**
* Save the content of a NBT compound to a stream.
*
* Use {@link Files#newOutputStreamSupplier(File)} to provide a stream supplier to a file.
* @param source - the NBT compound to save.
* @param stream - the stream.
* @param option - whether or not to compress the output.
@ -445,8 +441,7 @@ public class NbtFactory {
/**
* Convert a given NBT element to a primitive wrapper or List/Map equivalent.
* <p>
* All changes to any mutable objects will be reflected in the underlying NBT element(s).
* <p> All changes to any mutable objects will be reflected in the underlying NBT element(s).
* @param nms - the NBT element.
* @return The wrapper equivalent.
*/
@ -605,7 +600,7 @@ public class NbtFactory {
*/
private static class LoadMethodWorldUpdate extends LoadCompoundMethod {
public LoadMethodWorldUpdate(Class<?> streamClass) {
LoadMethodWorldUpdate(Class<?> streamClass) {
setMethod(getMethod(Modifier.STATIC, 0, streamClass, null, DataInput.class));
}
@ -622,7 +617,7 @@ public class NbtFactory {
private Object readLimiter;
public LoadMethodSkinUpdate(Class<?> streamClass, Class<?> readLimiterClass) {
LoadMethodSkinUpdate(Class<?> streamClass, Class<?> readLimiterClass) {
setMethod(getMethod(Modifier.STATIC, 0, streamClass, null, DataInput.class, readLimiterClass));
// Find the unlimited read limiter
@ -645,8 +640,7 @@ public class NbtFactory {
/**
* Represents a root NBT compound.
* <p>
* All changes to this map will be reflected in the underlying NBT compound. Values may only be one of the following:
* <p> All changes to this map will be reflected in the underlying NBT compound. Values may only be one of the following:
* <ul>
* <li>Primitive types</li>
* <li>{@link String String}</li>
@ -769,8 +763,6 @@ public class NbtFactory {
/**
* Save the content of a NBT compound to a stream.
* <p>
* Use {@link Files#newOutputStreamSupplier(File)} to provide a stream supplier to a file.
* @param stream - the output stream.
* @param option - whether or not to compress the output.
* @throws IOException If anything went wrong.

View File

@ -50,7 +50,7 @@ public class SendChunk {
RefClass classChunk = getRefClass("{nms}.Chunk");
this.methodInitLighting = classChunk.getMethod("initLighting");
RefClass classMapChunk = getRefClass("{nms}.PacketPlayOutMapChunk");
if (PS.get().checkVersion(PS.get().IMP.getServerVersion(), 1, 9, 4)) {
if (PS.get().checkVersion(PS.get().IMP.getServerVersion(), BukkitVersion.v1_9_4)) {
//this works for 1.9.4 and 1.10
tempMapChunk = classMapChunk.getConstructor(classChunk.getRealClass(),int.class);
} else {
@ -116,7 +116,7 @@ public class SendChunk {
chunks.remove(chunk);
Object con = this.connection.of(entity).get();
Object packet = null;
if (PS.get().checkVersion(PS.get().IMP.getServerVersion(), 1, 9, 4)) {
if (PS.get().checkVersion(PS.get().IMP.getServerVersion(), BukkitVersion.v1_9_4)) {
try {
packet = this.mapChunk.create(c,65535);
} catch (Exception ignored) {}

View File

@ -1,5 +1,7 @@
package com.plotsquared.bukkit.util.block;
import static com.intellectualcrafters.plot.util.ReflectionUtils.getRefClass;
import com.intellectualcrafters.plot.object.ChunkLoc;
import com.intellectualcrafters.plot.object.ChunkWrapper;
import com.intellectualcrafters.plot.object.PseudoRandom;
@ -9,6 +11,11 @@ import com.intellectualcrafters.plot.util.ReflectionUtils;
import com.intellectualcrafters.plot.util.TaskManager;
import com.intellectualcrafters.plot.util.block.BasicLocalBlockQueue;
import com.plotsquared.bukkit.util.SendChunk;
import org.bukkit.Bukkit;
import org.bukkit.Chunk;
import org.bukkit.Material;
import org.bukkit.World;
import java.lang.reflect.Field;
import java.lang.reflect.Method;
import java.util.ArrayList;
@ -18,13 +25,6 @@ import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
import java.util.Set;
import org.bukkit.Bukkit;
import org.bukkit.Chunk;
import org.bukkit.Material;
import org.bukkit.World;
import static com.intellectualcrafters.plot.util.ReflectionUtils.getRefClass;
public class BukkitLocalQueue_1_8_3 extends BukkitLocalQueue<char[]> {
@ -403,11 +403,11 @@ public class BukkitLocalQueue_1_8_3 extends BukkitLocalQueue<char[]> {
}
}
}
/*
/*
if (!(boolean) methodAreNeighborsLoaded.of(c).call(1)) {
return false;
}
*/
*/
}
this.methodInitLighting.of(c).call();