Remove unneeded changes and add back support for 1.9 through 1.12

This commit is contained in:
Speentie8081 2018-07-21 10:32:38 -05:00
parent d5b01aced2
commit bbee2debff
2 changed files with 761 additions and 765 deletions

View File

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

View File

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