Add first steps for gui
This commit is contained in:
@@ -1,5 +1,10 @@
|
||||
package nl.interestingcorner.coordinates.db;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.inventory.meta.ItemMeta;
|
||||
|
||||
import nl.interestingcorner.core.MinecraftColor;
|
||||
|
||||
/**
|
||||
@@ -110,6 +115,27 @@ public class Coordinate {
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
public ItemStack toItem()
|
||||
{
|
||||
ItemStack itemStack = new ItemStack(this.color.toMaterial());
|
||||
ItemMeta meta = itemStack.getItemMeta();
|
||||
if (meta == null) {
|
||||
return itemStack;
|
||||
}
|
||||
meta.setDisplayName(this.color.toColorCode() + this.name);
|
||||
meta.setLore(List.of(
|
||||
MinecraftColor.WHITE.toColorCode() + this.description,
|
||||
this.nether ? MinecraftColor.RED.toColorCode() + "Nether Coordinate" : "Overworld Coordinate",
|
||||
"X: " + this.position.x(),
|
||||
"Y: " + this.position.y(),
|
||||
"Z: " + this.position.z(),
|
||||
"World: " + this.world
|
||||
));
|
||||
itemStack.setItemMeta(meta);
|
||||
|
||||
return itemStack;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if (this == obj)
|
||||
|
||||
@@ -11,6 +11,7 @@ import java.util.logging.Level;
|
||||
import org.bukkit.plugin.java.JavaPlugin;
|
||||
|
||||
import nl.interestingcorner.core.MinecraftColor;
|
||||
import nl.interestingcorner.core.db.DatabaseManager;
|
||||
|
||||
public enum CoordinatesDatabaseManager implements nl.interestingcorner.core.db.DatabaseInitializeListener{
|
||||
|
||||
@@ -21,6 +22,7 @@ public enum CoordinatesDatabaseManager implements nl.interestingcorner.core.db.D
|
||||
|
||||
public void initialize(JavaPlugin app) {
|
||||
this.app = app;
|
||||
DatabaseManager.INSTANCE.registerDatabaseInitializeListener(this);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -156,6 +158,7 @@ public enum CoordinatesDatabaseManager implements nl.interestingcorner.core.db.D
|
||||
if (!initializeTables()) {
|
||||
this.app.getLogger().severe("Could not initialize coordinates database tables");
|
||||
}
|
||||
this.app.getLogger().info("Coordinates database tables initialized");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user