mirror of
https://github.com/IntellectualSites/PlotSquared.git
synced 2024-11-04 09:10:17 +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();
|
||||
PS.debug(StringMan.getString(Bukkit.getBukkitVersion()));
|
||||
PS.debug(StringMan.getString(Bukkit.getBukkitVersion().split("-")[0].split("\\.")));
|
||||
return new int[]{1, 10, 0};
|
||||
return new int[]{1, 13, 0};
|
||||
}
|
||||
}
|
||||
return this.version;
|
||||
@ -680,6 +680,9 @@ public final class BukkitMain extends JavaPlugin implements Listener, IPlotMain
|
||||
} catch (ClassNotFoundException | NoSuchFieldException | NoSuchMethodException e) {
|
||||
PS.debug(SendChunk.class + " does not support " + StringMan.getString(getServerVersion()));
|
||||
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)) {
|
||||
return QueueProvider.of(BukkitLocalQueue_1_9.class, BukkitLocalQueue.class);
|
||||
|
@ -1,6 +1,7 @@
|
||||
package com.plotsquared.bukkit.util;
|
||||
|
||||
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_0 = {1, 12, 0};
|
||||
public static int[] v1_11_0 = {1, 11, 0};
|
||||
|
@ -73,11 +73,12 @@ public class NbtFactory {
|
||||
ClassLoader loader = NbtFactory.class.getClassLoader();
|
||||
|
||||
String packageName = getPackageName();
|
||||
String craftpackageName = getCraftPackageName();
|
||||
Class<?> offlinePlayer = loader.loadClass(packageName + ".CraftOfflinePlayer");
|
||||
|
||||
// Prepare NBT
|
||||
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_CREATE_TAG = getMethod(Modifier.STATIC, 0, this.BASE_CLASS, "createTag", byte.class);
|
||||
|
||||
@ -400,10 +401,15 @@ public class NbtFactory {
|
||||
return name;
|
||||
} else {
|
||||
// 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")
|
||||
private Map<String, Object> getDataMap(Object handle) {
|
||||
return (Map<String, Object>) getFieldValue(getDataField(NbtType.TAG_COMPOUND, handle), handle);
|
||||
|
@ -8,6 +8,7 @@ import com.intellectualcrafters.plot.util.block.ScopedLocalBlockQueue;
|
||||
import com.plotsquared.bukkit.util.BukkitUtil;
|
||||
import java.util.Arrays;
|
||||
import org.bukkit.Chunk;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.block.Biome;
|
||||
import org.bukkit.generator.ChunkGenerator.BiomeGrid;
|
||||
@ -115,7 +116,7 @@ public class GenChunk extends ScopedLocalBlockQueue {
|
||||
@Override
|
||||
public boolean setBlock(int x, int y, int z, int id, int data) {
|
||||
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;
|
||||
}
|
||||
int i = MainUtil.CACHE_I[y][x][z];
|
||||
|
Loading…
Reference in New Issue
Block a user