From cb0d38825145f4d54ae596dd44bb25734686d16c Mon Sep 17 00:00:00 2001 From: sekwah Date: Thu, 22 Feb 2018 04:16:57 +0000 Subject: [PATCH] Added code to check if the material exists --- .../coreconnector/ConnectorDataCollector.java | 5 ++++- .../sekwah/advancedportals/spigot/AdvancedPortalsPlugin.java | 3 ++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/com/sekwah/advancedportals/coreconnector/ConnectorDataCollector.java b/src/com/sekwah/advancedportals/coreconnector/ConnectorDataCollector.java index 6841627..e978454 100644 --- a/src/com/sekwah/advancedportals/coreconnector/ConnectorDataCollector.java +++ b/src/com/sekwah/advancedportals/coreconnector/ConnectorDataCollector.java @@ -1,11 +1,14 @@ package com.sekwah.advancedportals.coreconnector; +import org.bukkit.Material; + /** * Gets info from the specific implementation */ public class ConnectorDataCollector { public boolean materialExists(String materialName) { - return false; + String sameCase = materialName.toUpperCase(); + return Material.getMaterial(sameCase) != null; } } diff --git a/src/com/sekwah/advancedportals/spigot/AdvancedPortalsPlugin.java b/src/com/sekwah/advancedportals/spigot/AdvancedPortalsPlugin.java index 0ce606b..acf9d1b 100644 --- a/src/com/sekwah/advancedportals/spigot/AdvancedPortalsPlugin.java +++ b/src/com/sekwah/advancedportals/spigot/AdvancedPortalsPlugin.java @@ -2,6 +2,7 @@ package com.sekwah.advancedportals.spigot; import com.sekwah.advancedportals.core.AdvancedPortalsCore; import com.sekwah.advancedportals.core.util.DataStorage; +import com.sekwah.advancedportals.coreconnector.ConnectorDataCollector; import com.sekwah.advancedportals.coreconnector.command.CommandRegister; import org.bukkit.plugin.java.JavaPlugin; @@ -12,7 +13,7 @@ public class AdvancedPortalsPlugin extends JavaPlugin { public void onEnable() { // TODO actually get the minecraft version this.portalsCore = new AdvancedPortalsCore(new DataStorage(this.getDataFolder()), - new SpigotInfoLogger(this), new CommandRegister(this), new int[]{1,12,2}); + new SpigotInfoLogger(this), new CommandRegister(this), new ConnectorDataCollector(), new int[]{1,12,2}); this.getServer().getPluginManager().registerEvents(new Listeners(this), this); }