mirror of
https://github.com/alexcrea/CustomAnvil.git
synced 2026-06-23 08:14:00 +02:00
add lore & message to int setting & more
This commit is contained in:
parent
f23d818cf3
commit
48f60bc38e
4 changed files with 16 additions and 5 deletions
|
|
@ -7,6 +7,7 @@ import com.github.stefvanschie.inventoryframework.pane.util.Pattern;
|
|||
import io.delilaheve.CustomAnvil;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.inventory.meta.ItemMeta;
|
||||
import xyz.alexcrea.cuanvil.gui.config.BasicConfigGui;
|
||||
|
||||
public class MainConfigGui extends ChestGui {
|
||||
|
|
@ -49,6 +50,10 @@ public class MainConfigGui extends ChestGui {
|
|||
|
||||
// quit item
|
||||
ItemStack quitItemstack = new ItemStack(Material.BARRIER);
|
||||
ItemMeta quitMeta = quitItemstack.getItemMeta();
|
||||
quitMeta.setDisplayName("\u00A7cQuit");
|
||||
quitItemstack.setItemMeta(quitMeta);
|
||||
|
||||
GuiItem quitItem = new GuiItem(quitItemstack, event -> {
|
||||
event.setCancelled(true);
|
||||
event.getWhoClicked().closeInventory();
|
||||
|
|
|
|||
|
|
@ -10,8 +10,13 @@ import io.delilaheve.CustomAnvil;
|
|||
import org.jetbrains.annotations.NotNull;
|
||||
import xyz.alexcrea.cuanvil.gui.GuiGlobalItems;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
public abstract class AbstractSettingGui extends ChestGui {
|
||||
|
||||
protected final static List<String> CLICK_LORE = Collections.singletonList("\u00A77Click Here to change the value");
|
||||
|
||||
public AbstractSettingGui(int rows, @NotNull TextHolder title, Gui parent) {
|
||||
super(rows, title, CustomAnvil.instance);
|
||||
initBase(parent);
|
||||
|
|
|
|||
|
|
@ -12,7 +12,6 @@ import org.bukkit.inventory.ItemStack;
|
|||
import org.bukkit.inventory.meta.ItemMeta;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.function.Consumer;
|
||||
|
||||
public class BoolSettingsGui extends AbstractSettingGui{
|
||||
|
|
@ -56,7 +55,7 @@ public class BoolSettingsGui extends AbstractSettingGui{
|
|||
ItemStack valueItemStack = new ItemStack(displayedMat);
|
||||
ItemMeta valueMeta = valueItemStack.getItemMeta();
|
||||
valueMeta.setDisplayName(displayedName);
|
||||
valueMeta.setLore(Collections.singletonList("\u00A77Click Here to change the value"));
|
||||
valueMeta.setLore(AbstractSettingGui.CLICK_LORE);
|
||||
valueItemStack.setItemMeta(valueMeta);
|
||||
GuiItem resultItem = new GuiItem(valueItemStack, inverseNowConsumer(), CustomAnvil.instance);
|
||||
|
||||
|
|
|
|||
|
|
@ -52,7 +52,8 @@ public class IntSettingsGui extends AbstractSettingGui{
|
|||
int planned = Math.max(holder.min, now - step);
|
||||
ItemStack item = new ItemStack(Material.RED_TERRACOTTA);
|
||||
ItemMeta meta = item.getItemMeta();
|
||||
meta.setDisplayName(planned + " (-"+(now-planned)+")"); //TODO add color
|
||||
meta.setDisplayName("\u00A7e"+planned + " \u00A7r(\u00A7c-"+(now-planned)+"\u00A7r)");
|
||||
meta.setLore(AbstractSettingGui.CLICK_LORE);
|
||||
item.setItemMeta(meta);
|
||||
|
||||
minusItem = new GuiItem(item, updateNowConsumer(planned), CustomAnvil.instance);
|
||||
|
|
@ -68,7 +69,8 @@ public class IntSettingsGui extends AbstractSettingGui{
|
|||
int planned = Math.min(holder.max, now + step);
|
||||
ItemStack item = new ItemStack(Material.GREEN_TERRACOTTA);
|
||||
ItemMeta meta = item.getItemMeta();
|
||||
meta.setDisplayName(planned + " (+"+(planned-now)+")"); //TODO add color
|
||||
meta.setDisplayName("\u00A7e"+planned + " \u00A7r(\u00A7a+"+(planned-now)+"\u00A7r)");
|
||||
meta.setLore(AbstractSettingGui.CLICK_LORE);
|
||||
item.setItemMeta(meta);
|
||||
|
||||
plusItem = new GuiItem(item, updateNowConsumer(planned), CustomAnvil.instance);
|
||||
|
|
@ -80,7 +82,7 @@ public class IntSettingsGui extends AbstractSettingGui{
|
|||
// "result" display
|
||||
ItemStack resultPaper = new ItemStack(Material.PAPER);
|
||||
ItemMeta resultMeta = resultPaper.getItemMeta();
|
||||
resultMeta.setDisplayName(""+now); //TODO color and text
|
||||
resultMeta.setDisplayName("\u00A7e"+now);
|
||||
resultPaper.setItemMeta(resultMeta);
|
||||
GuiItem resultItem = new GuiItem(resultPaper, GuiGlobalActions.stayInPlace, CustomAnvil.instance);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue