mirror of
https://github.com/IntellectualSites/PlotSquared.git
synced 2024-11-22 13:16:45 +01:00
Merge pull request #2029 from Speentie8081/master
Add support for spigot 1.13 and spigot 1.13-pre7
This commit is contained in:
commit
1b08d54be0
@ -177,7 +177,7 @@ public final class BukkitMain extends JavaPlugin implements Listener, IPlotMain
|
|||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
PS.debug(StringMan.getString(Bukkit.getBukkitVersion()));
|
PS.debug(StringMan.getString(Bukkit.getBukkitVersion()));
|
||||||
PS.debug(StringMan.getString(Bukkit.getBukkitVersion().split("-")[0].split("\\.")));
|
PS.debug(StringMan.getString(Bukkit.getBukkitVersion().split("-")[0].split("\\.")));
|
||||||
return new int[]{1, 10, 0};
|
return new int[]{1, 13, 0};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return this.version;
|
return this.version;
|
||||||
@ -680,6 +680,9 @@ public final class BukkitMain extends JavaPlugin implements Listener, IPlotMain
|
|||||||
} catch (ClassNotFoundException | NoSuchFieldException | NoSuchMethodException e) {
|
} catch (ClassNotFoundException | NoSuchFieldException | NoSuchMethodException e) {
|
||||||
PS.debug(SendChunk.class + " does not support " + StringMan.getString(getServerVersion()));
|
PS.debug(SendChunk.class + " does not support " + StringMan.getString(getServerVersion()));
|
||||||
MainUtil.canSendChunk = false;
|
MainUtil.canSendChunk = false;
|
||||||
|
}
|
||||||
|
if (PS.get().checkVersion(getServerVersion(), BukkitVersion.v1_13_0)) {
|
||||||
|
return QueueProvider.of(BukkitLocalQueue.class, BukkitLocalQueue.class);
|
||||||
}
|
}
|
||||||
if (PS.get().checkVersion(getServerVersion(), BukkitVersion.v1_9_0)) {
|
if (PS.get().checkVersion(getServerVersion(), BukkitVersion.v1_9_0)) {
|
||||||
return QueueProvider.of(BukkitLocalQueue_1_9.class, BukkitLocalQueue.class);
|
return QueueProvider.of(BukkitLocalQueue_1_9.class, BukkitLocalQueue.class);
|
||||||
@ -918,4 +921,4 @@ public final class BukkitMain extends JavaPlugin implements Listener, IPlotMain
|
|||||||
}
|
}
|
||||||
return names;
|
return names;
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -1,6 +1,7 @@
|
|||||||
package com.plotsquared.bukkit.util;
|
package com.plotsquared.bukkit.util;
|
||||||
|
|
||||||
public class BukkitVersion {
|
public class BukkitVersion {
|
||||||
|
public static int[] v1_13_0 = {1, 13, 0};
|
||||||
public static int[] v1_12_1 = {1, 12, 1};
|
public static int[] v1_12_1 = {1, 12, 1};
|
||||||
public static int[] v1_12_0 = {1, 12, 0};
|
public static int[] v1_12_0 = {1, 12, 0};
|
||||||
public static int[] v1_11_0 = {1, 11, 0};
|
public static int[] v1_11_0 = {1, 11, 0};
|
||||||
|
@ -73,11 +73,12 @@ public class NbtFactory {
|
|||||||
ClassLoader loader = NbtFactory.class.getClassLoader();
|
ClassLoader loader = NbtFactory.class.getClassLoader();
|
||||||
|
|
||||||
String packageName = getPackageName();
|
String packageName = getPackageName();
|
||||||
|
String craftpackageName = getCraftPackageName();
|
||||||
Class<?> offlinePlayer = loader.loadClass(packageName + ".CraftOfflinePlayer");
|
Class<?> offlinePlayer = loader.loadClass(packageName + ".CraftOfflinePlayer");
|
||||||
|
|
||||||
// Prepare NBT
|
// Prepare NBT
|
||||||
this.COMPOUND_CLASS = getMethod(0, Modifier.STATIC, offlinePlayer, "getData").getReturnType();
|
this.COMPOUND_CLASS = getMethod(0, Modifier.STATIC, offlinePlayer, "getData").getReturnType();
|
||||||
this.BASE_CLASS = this.COMPOUND_CLASS.getSuperclass();
|
this.BASE_CLASS = loader.loadClass(craftpackageName + ".NBTBase");
|
||||||
this.NBT_GET_TYPE = getMethod(0, Modifier.STATIC, this.BASE_CLASS, "getTypeId");
|
this.NBT_GET_TYPE = getMethod(0, Modifier.STATIC, this.BASE_CLASS, "getTypeId");
|
||||||
this.NBT_CREATE_TAG = getMethod(Modifier.STATIC, 0, this.BASE_CLASS, "createTag", byte.class);
|
this.NBT_CREATE_TAG = getMethod(Modifier.STATIC, 0, this.BASE_CLASS, "createTag", byte.class);
|
||||||
|
|
||||||
@ -400,9 +401,14 @@ public class NbtFactory {
|
|||||||
return name;
|
return name;
|
||||||
} else {
|
} else {
|
||||||
// Fallback
|
// Fallback
|
||||||
return "org.bukkit.craftbukkit.v1_7_R3";
|
return "org.bukkit.craftbukkit.v1_13_R1";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private String getCraftPackageName() {
|
||||||
|
String version = Bukkit.getServer().getClass().getPackage().getName().replace(".", ",").split(",")[3];
|
||||||
|
return "net.minecraft.server." + version;
|
||||||
|
}
|
||||||
|
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
private Map<String, Object> getDataMap(Object handle) {
|
private Map<String, Object> getDataMap(Object handle) {
|
||||||
|
@ -8,6 +8,7 @@ import com.intellectualcrafters.plot.util.block.ScopedLocalBlockQueue;
|
|||||||
import com.plotsquared.bukkit.util.BukkitUtil;
|
import com.plotsquared.bukkit.util.BukkitUtil;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import org.bukkit.Chunk;
|
import org.bukkit.Chunk;
|
||||||
|
import org.bukkit.Material;
|
||||||
import org.bukkit.World;
|
import org.bukkit.World;
|
||||||
import org.bukkit.block.Biome;
|
import org.bukkit.block.Biome;
|
||||||
import org.bukkit.generator.ChunkGenerator.BiomeGrid;
|
import org.bukkit.generator.ChunkGenerator.BiomeGrid;
|
||||||
@ -115,7 +116,7 @@ public class GenChunk extends ScopedLocalBlockQueue {
|
|||||||
@Override
|
@Override
|
||||||
public boolean setBlock(int x, int y, int z, int id, int data) {
|
public boolean setBlock(int x, int y, int z, int id, int data) {
|
||||||
if (this.result == null) {
|
if (this.result == null) {
|
||||||
this.cd.setBlock(x, y, z, id, (byte) data);
|
this.cd.setBlock(x, y, z, new MaterialData(Material.getMaterial(id), (byte) data));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
int i = MainUtil.CACHE_I[y][x][z];
|
int i = MainUtil.CACHE_I[y][x][z];
|
||||||
|
Loading…
Reference in New Issue
Block a user