mirror of
https://github.com/sekwah41/Advanced-Portals.git
synced 2024-11-16 23:55:23 +01:00
Started adding material list for forge
This commit is contained in:
parent
e6062dc778
commit
5c0aa56f94
@ -119,8 +119,6 @@ public class DataStorage {
|
||||
/**
|
||||
* A method to try to grab the files from the plugin and if its in the plugin folder load from there instead.
|
||||
* <p>
|
||||
* TODO add loading from the plugin folder first rather than straight from the plugin.
|
||||
*
|
||||
* @param location
|
||||
* @return
|
||||
*/
|
||||
|
@ -1,5 +1,7 @@
|
||||
package com.sekwah.advancedportals.coreconnector.info;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Gets info from the specific implementation
|
||||
*/
|
||||
@ -7,4 +9,6 @@ public interface DataCollector {
|
||||
|
||||
boolean materialExists(String materialName);
|
||||
|
||||
List<String> getMaterials();
|
||||
|
||||
}
|
||||
|
@ -1,10 +1,34 @@
|
||||
package com.sekwah.advancedportals.forge.coreconnector.info;
|
||||
|
||||
import com.sekwah.advancedportals.coreconnector.info.DataCollector;
|
||||
import net.minecraft.block.Block;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class ForgeDataCollector implements DataCollector {
|
||||
|
||||
private final List<String> blockMaterialList = new ArrayList<>();
|
||||
|
||||
public ForgeDataCollector() {
|
||||
/**
|
||||
* TODO Look at
|
||||
* {@link net.minecraft.command.CommandGive#getTabCompletions}
|
||||
* for inspiration for both spigot and forge versions
|
||||
*/
|
||||
//Block.REGISTRY.getKeys()
|
||||
}
|
||||
|
||||
/**
|
||||
* @param materialName this is given in the format minecraft:material
|
||||
* @return
|
||||
*/
|
||||
public boolean materialExists(String materialName) {
|
||||
return false;
|
||||
return Block.getBlockFromName(materialName) != null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> getMaterials() {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
@ -41,7 +41,6 @@ public class AdvancedPortalsPlugin extends JavaPlugin {
|
||||
this.getLogger().warning("Could not parse mc version from: " + Bukkit.getVersion());
|
||||
this.setEnabled(false);
|
||||
}
|
||||
// TODO actually get the minecraft version
|
||||
//injector = Guice.createInjector(new RepositoryModule(this.portalsCore));
|
||||
this.getServer().getPluginManager().registerEvents(new Listeners(), this);
|
||||
}
|
||||
|
@ -3,10 +3,26 @@ package com.sekwah.advancedportals.spigot.coreconnector.info;
|
||||
import com.sekwah.advancedportals.coreconnector.info.DataCollector;
|
||||
import org.bukkit.Material;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class SpigotDataCollector implements DataCollector {
|
||||
|
||||
private final List<String> blockMaterialList = new ArrayList<>();
|
||||
|
||||
public SpigotDataCollector() {
|
||||
for(Material material : Material.values()) {
|
||||
this.blockMaterialList.add(material.name());
|
||||
}
|
||||
}
|
||||
|
||||
public boolean materialExists(String materialName) {
|
||||
String sameCase = materialName.toUpperCase();
|
||||
return Material.getMaterial(sameCase) != null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> getMaterials() {
|
||||
return blockMaterialList;
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user