Allow old Material names using bukkit:name

Spigot 1.13 has a compatabilty layer for old bukkit names, this will allow you to take advantage of that.

1.12: `bukkit:grass` -> `minecraft:grass`
1.13: `bukkit:grass` -> `minecraft:grass_block`
1.13: `grass` -> `minecraft:grass`
This commit is contained in:
ME1312 2018-07-15 14:07:22 -04:00
parent 8f6d3e5527
commit 0ade35f544
No known key found for this signature in database
GPG Key ID: FEFFE2F698E88FA8
23 changed files with 34 additions and 17 deletions

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -2,4 +2,4 @@ Manifest-Version: 1.0
Class-Path: BungeeCord.jar Waterfall.jar
Main-Class: net.ME1312.SubServers.Bungee.Launch
Implementation-Title: SubServers.Bungee
Specification-Title: 18w29m
Specification-Title: 18w29s

View File

@ -58,8 +58,8 @@ public final class SubPlugin extends BungeeCord implements Listener {
public final SubAPI api = new SubAPI(this);
public SubDataServer subdata = null;
public SubServer sudo = null;
public static final Version version = Version.fromString("2.13a/pr4");
//public static final Version version = new Version(Version.fromString("2.13a/pr5"), VersionType.SNAPSHOT, (SubPlugin.class.getPackage().getSpecificationTitle() == null)?"?":SubPlugin.class.getPackage().getSpecificationTitle()); // TODO Snapshot Version
//public static final Version version = Version.fromString("2.13a/pr4");
public static final Version version = new Version(Version.fromString("2.13a/pr5"), VersionType.SNAPSHOT, (SubPlugin.class.getPackage().getSpecificationTitle() == null)?"?":SubPlugin.class.getPackage().getSpecificationTitle()); // TODO Snapshot Version
public boolean redis = false;
public boolean canSudo = true;

Binary file not shown.

View File

@ -1,3 +1,3 @@
Manifest-Version: 1.0
Implementation-Title: SubServers.Client.Bukkit
Specification-Title: 18w29m
Specification-Title: 18w29s

View File

@ -224,11 +224,28 @@ public abstract class UIRenderer {
// minecraft:name
if (item.get().toLowerCase().startsWith("minecraft:")) {
item.set(item.get().substring(10));
}
// bukkit name
} else
// bukkit:name
if (item.get().toLowerCase().startsWith("bukkit:")) {
item.set(item.get().substring(7));
if (!Util.isException(() -> Material.valueOf(item.get().toUpperCase()))) {
return new ItemStack(Material.valueOf(item.get().toUpperCase()), 1);
}
}
// material name
if (plugin.api.getGameVersion().compareTo(new Version("1.13")) < 0) {
if (!Util.isException(() -> Material.valueOf(item.get().toUpperCase()))) {
return new ItemStack(Material.valueOf(item.get().toUpperCase()), 1);
}
} else try {
if (Material.class.getMethod("getMaterial", String.class, boolean.class).invoke(null, item.get().toUpperCase(), false) != null) {
return new ItemStack((Material) Material.class.getMethod("getMaterial", String.class, boolean.class).invoke(null, item.get().toUpperCase(), false), 1);
}
} catch (Exception e) {}
// vault name
if (!Util.isException(() -> Class.forName("net.milkbowl.vault.item.Items"))) {
net.milkbowl.vault.item.ItemInfo info = net.milkbowl.vault.item.Items.itemByString(item.get());

View File

@ -46,8 +46,8 @@ public final class SubPlugin extends JavaPlugin {
public SubPlugin() {
super();
version = Version.fromString(getDescription().getVersion());
//version = new Version(Version.fromString(getDescription().getVersion()), VersionType.SNAPSHOT, (SubPlugin.class.getPackage().getSpecificationTitle() == null)?"?":SubPlugin.class.getPackage().getSpecificationTitle()); // TODO Snapshot Version
//version = Version.fromString(getDescription().getVersion());
version = new Version(Version.fromString(getDescription().getVersion()), VersionType.SNAPSHOT, (SubPlugin.class.getPackage().getSpecificationTitle() == null)?"?":SubPlugin.class.getPackage().getSpecificationTitle()); // TODO Snapshot Version
}
/**

View File

@ -1,6 +1,6 @@
name: 'SubServers-Client-Bukkit'
main: 'net.ME1312.SubServers.Client.Bukkit.SubPlugin'
version: '2.13a/pr4'
version: '2.13a/pr5'
authors: [ME1312]
softdepend: [Vault, TitleManager]
website: 'http://www.ME1312.net/'

Binary file not shown.

View File

@ -1,4 +1,4 @@
Manifest-Version: 1.0
Main-Class: net.ME1312.SubServers.Host.ExHost
Implementation-Title: SubServers.Host
Specification-Title: 18w29m
Specification-Title: 18w29s

View File

@ -54,8 +54,8 @@ public final class ExHost {
public SubDataClient subdata = null;
public final SubAPI api = new SubAPI(this);
public static final Version version = Version.fromString("2.13a/pr4");
//public static final Version version = new Version(Version.fromString("2.13a/pr5"), VersionType.SNAPSHOT, (ExHost.class.getPackage().getSpecificationTitle() == null)?"?":ExHost.class.getPackage().getSpecificationTitle()); // TODO Snapshot Version
//public static final Version version = Version.fromString("2.13a/pr4");
public static final Version version = new Version(Version.fromString("2.13a/pr5"), VersionType.SNAPSHOT, (ExHost.class.getPackage().getSpecificationTitle() == null)?"?":ExHost.class.getPackage().getSpecificationTitle()); // TODO Snapshot Version
private ConsoleReader jline;
private boolean running = false;

Binary file not shown.

View File

@ -2,4 +2,4 @@ Manifest-Version: 1.0
Class-Path: BungeeCord.jar Waterfall.jar
Main-Class: net.ME1312.SubServers.Sync.Launch
Implementation-Title: SubServers.Sync
Specification-Title: 18w29m
Specification-Title: 18w29s

View File

@ -48,8 +48,8 @@ public final class SubPlugin extends BungeeCord implements Listener {
public boolean redis = false;
public final SubAPI api = new SubAPI(this);
public SubDataClient subdata = null;
public static final Version version = Version.fromString("2.13a/pr4");
//public static final Version version = new Version(Version.fromString("2.13a/pr5"), VersionType.SNAPSHOT, (SubPlugin.class.getPackage().getSpecificationTitle() == null)?"?":SubPlugin.class.getPackage().getSpecificationTitle()); // TODO Snapshot Version
//public static final Version version = Version.fromString("2.13a/pr4");
public static final Version version = new Version(Version.fromString("2.13a/pr5"), VersionType.SNAPSHOT, (SubPlugin.class.getPackage().getSpecificationTitle() == null)?"?":SubPlugin.class.getPackage().getSpecificationTitle()); // TODO Snapshot Version
public final boolean isPatched;
public long lastReload = -1;