1.12 "compatability update"

Now only loads the CustomBlockListener if running 1.13+
Block editing menu is now disabled completely on 1.12
Added a small lore indicator to the Block option in MI browse
This commit is contained in:
Aria 2019-11-25 16:27:24 +01:00
parent 66a27dcb10
commit ad3736a1a6
3 changed files with 18 additions and 4 deletions

View File

@ -166,14 +166,15 @@ public class MMOItems extends JavaPlugin {
Bukkit.getPluginManager().registerEvents(new ItemUse(), this);
Bukkit.getPluginManager().registerEvents(new PlayerListener(), this);
Bukkit.getPluginManager().registerEvents(new MitigationListener(), this);
Bukkit.getPluginManager().registerEvents(new CustomBlockListener(), this);
Bukkit.getPluginManager().registerEvents(new CustomSoundListener(), this);
Bukkit.getPluginManager().registerEvents(new CustomDurability(), this);
Bukkit.getPluginManager().registerEvents(new DisableInteractions(), this);
Bukkit.getPluginManager().registerEvents(new GuiListener(), this);
Bukkit.getPluginManager().registerEvents(new ElementListener(), this);
if (version.isStrictlyHigher(1, 12))
if (version.isStrictlyHigher(1, 12)) {
Bukkit.getPluginManager().registerEvents(new CustomBlockListener(), this);
Bukkit.getPluginManager().registerEvents(new Listener_v1_13(), this);
}
/*
* this class implements the Listener, if the option

View File

@ -91,7 +91,9 @@ public class MMOItemsCommand implements CommandExecutor {
return true;
}
if (args[1].equalsIgnoreCase("blocks")) {
new BlockBrowser((Player) sender).open();
if (MMOItems.plugin.getVersion().isStrictlyHigher(1, 12))
new BlockBrowser((Player) sender).open();
else sender.sendMessage(ChatColor.RED + "Blocks are only for 1.13+.");
return true;
}
if (!Type.isValid(args[1])) {

View File

@ -93,6 +93,15 @@ public class ItemBrowser extends PluginInventory {
ItemStack switchBrowse = new ItemStack(Material.STONE);
ItemMeta switchMeta = switchBrowse.getItemMeta();
switchMeta.setDisplayName(ChatColor.GREEN + "Switch to Block Explorer");
if(!MMOItems.plugin.getVersion().isStrictlyHigher(1, 12)) {
List<String> lore = new ArrayList<String>();
lore.add("");
lore.add("&cThis feature is disabled.");
lore.add("&cUpdating to 1.13+ is recommended.");
switchMeta.setLore(lore);
}
switchBrowse.setItemMeta(switchMeta);
while (n < slots.length)
@ -220,7 +229,9 @@ public class ItemBrowser extends PluginInventory {
if (item.getItemMeta().getDisplayName().equals(ChatColor.GREEN + "Switch to Block Explorer")) {
new BlockBrowser(player).open();
if (MMOItems.plugin.getVersion().isStrictlyHigher(1, 12))
new BlockBrowser(player).open();
else player.sendMessage(ChatColor.RED + "Blocks are only for 1.13+.");
return;
}