Add support for spigot 1.13-pre7

This commit is contained in:
Speentie8081 2018-07-20 23:51:09 -05:00
parent aaa70888bd
commit f533efb2c8
3 changed files with 766 additions and 758 deletions

View File

@ -153,7 +153,8 @@ public final class BukkitMain extends JavaPlugin implements Listener, IPlotMain
};
lookupNamesField.set(manager, pluginMap);
}
} catch (Throwable ignore) {}
} catch (Throwable ignore) {
}
}
public static WorldEdit worldEdit;
@ -177,7 +178,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;
@ -234,11 +235,11 @@ public final class BukkitMain extends JavaPlugin implements Listener, IPlotMain
if (manager instanceof SinglePlotAreaManager) {
long start = System.currentTimeMillis();
SinglePlotArea area = ((SinglePlotAreaManager) manager).getArea();
outer:
for (World world : Bukkit.getWorlds()) {
outer: for (World world : Bukkit.getWorlds()) {
String name = world.getName();
char char0 = name.charAt(0);
if (!Character.isDigit(char0) && char0 != '-') continue;
if (!Character.isDigit(char0) && char0 != '-')
continue;
if (!world.getPlayers().isEmpty()) {
continue;
}
@ -318,10 +319,11 @@ public final class BukkitMain extends JavaPlugin implements Listener, IPlotMain
ver = ver.split("-")[0];
}
String[] split = ver.split("\\.");
return new int[]{Integer.parseInt(split[0]), Integer.parseInt(split[1]), Integer.parseInt(split[2])};
return new int[] { Integer.parseInt(split[0]), Integer.parseInt(split[1]), Integer.parseInt(split[2]) };
}
@Override public String getPluginVersionString() {
@Override
public String getPluginVersionString() {
return getDescription().getVersion();
}
@ -529,10 +531,12 @@ public final class BukkitMain extends JavaPlugin implements Listener, IPlotMain
LivingEntity livingEntity = (LivingEntity) entity;
List<MetadataValue> meta = entity.getMetadata("plot");
if (meta != null && !meta.isEmpty()) {
if (livingEntity.isLeashed()) continue;
if (livingEntity.isLeashed())
continue;
List<MetadataValue> keep = entity.getMetadata("keep");
if (keep != null && !keep.isEmpty()) continue;
if (keep != null && !keep.isEmpty())
continue;
PlotId originalPlotId = (PlotId) meta.get(0).value();
if (originalPlotId != null) {
@ -547,7 +551,8 @@ public final class BukkitMain extends JavaPlugin implements Listener, IPlotMain
}
}
} else {
//This is to apply the metadata to already spawned shulkers (see EntitySpawnListener.java)
// This is to apply the metadata to already spawned shulkers (see
// EntitySpawnListener.java)
com.intellectualcrafters.plot.object.Location pLoc = BukkitUtil.getLocation(entity.getLocation());
PlotArea area = pLoc.getPlotArea();
if (area != null) {
@ -681,6 +686,9 @@ public final class BukkitMain extends JavaPlugin implements Listener, IPlotMain
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);
}
@ -741,7 +749,8 @@ public final class BukkitMain extends JavaPlugin implements Listener, IPlotMain
try {
OfflinePlayer.class.getDeclaredMethod("getUniqueId");
checkVersion = true;
} catch (Throwable ignore) {}
} catch (Throwable ignore) {
}
UUIDWrapper wrapper;
if (Settings.UUID.OFFLINE) {
if (Settings.UUID.FORCE_LOWERCASE) {
@ -771,9 +780,7 @@ public final class BukkitMain extends JavaPlugin implements Listener, IPlotMain
}
}
if (Settings.UUID.OFFLINE) {
PS.log(C.PREFIX
+ " &6" + getPluginName() + " is using Offline Mode UUIDs either because of user preference, or because you are using an old version of "
+ "Bukkit");
PS.log(C.PREFIX + " &6" + getPluginName() + " is using Offline Mode UUIDs either because of user preference, or because you are using an old version of " + "Bukkit");
} else {
PS.log(C.PREFIX + " &6" + getPluginName() + " is using online UUIDs");
}

View File

@ -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};

View File

@ -51,7 +51,7 @@ public class BukkitLocalQueue_1_9 extends BukkitLocalQueue<char[]> {
ReflectionUtils.RefClass classWorld = getRefClass("{nms}.World");
this.tileEntityListTick = classWorld.getField("tileEntityListTick");
this.methodGetWorld = classChunk.getMethod("getWorld");
this.methodW = classWorld.getMethod("w", classBlockPosition.getRealClass());
this.methodW = classWorld.getMethod("r", classBlockPosition.getRealClass());
this.fieldSections = classChunk.getField("sections");
this.fieldWorld = classChunk.getField("world");
ReflectionUtils.RefClass classBlock = getRefClass("{nms}.Block");