Added code to check if the material exists

This commit is contained in:
sekwah 2018-02-22 04:16:57 +00:00
parent 3435e508b6
commit cb0d388251
2 changed files with 6 additions and 2 deletions

View File

@ -1,11 +1,14 @@
package com.sekwah.advancedportals.coreconnector; package com.sekwah.advancedportals.coreconnector;
import org.bukkit.Material;
/** /**
* Gets info from the specific implementation * Gets info from the specific implementation
*/ */
public class ConnectorDataCollector { public class ConnectorDataCollector {
public boolean materialExists(String materialName) { public boolean materialExists(String materialName) {
return false; String sameCase = materialName.toUpperCase();
return Material.getMaterial(sameCase) != null;
} }
} }

View File

@ -2,6 +2,7 @@ package com.sekwah.advancedportals.spigot;
import com.sekwah.advancedportals.core.AdvancedPortalsCore; import com.sekwah.advancedportals.core.AdvancedPortalsCore;
import com.sekwah.advancedportals.core.util.DataStorage; import com.sekwah.advancedportals.core.util.DataStorage;
import com.sekwah.advancedportals.coreconnector.ConnectorDataCollector;
import com.sekwah.advancedportals.coreconnector.command.CommandRegister; import com.sekwah.advancedportals.coreconnector.command.CommandRegister;
import org.bukkit.plugin.java.JavaPlugin; import org.bukkit.plugin.java.JavaPlugin;
@ -12,7 +13,7 @@ public class AdvancedPortalsPlugin extends JavaPlugin {
public void onEnable() { public void onEnable() {
// TODO actually get the minecraft version // TODO actually get the minecraft version
this.portalsCore = new AdvancedPortalsCore(new DataStorage(this.getDataFolder()), 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); this.getServer().getPluginManager().registerEvents(new Listeners(this), this);
} }