mirror of
https://github.com/Xiao-MoMi/Custom-Fishing.git
synced 2025-12-28 19:39:06 +00:00
optimize
This commit is contained in:
@@ -0,0 +1,8 @@
|
||||
package net.momirealms.customfishing.gui;
|
||||
|
||||
import org.bukkit.configuration.ConfigurationSection;
|
||||
|
||||
public interface SectionPage extends YamlPage {
|
||||
|
||||
ConfigurationSection getSection();
|
||||
}
|
||||
@@ -2,7 +2,7 @@ package net.momirealms.customfishing.gui.icon.property.item;
|
||||
|
||||
import net.momirealms.customfishing.adventure.AdventureManagerImpl;
|
||||
import net.momirealms.customfishing.adventure.component.ShadedAdventureComponentWrapper;
|
||||
import net.momirealms.customfishing.gui.ItemPage;
|
||||
import net.momirealms.customfishing.gui.SectionPage;
|
||||
import net.momirealms.customfishing.gui.page.property.AmountEditor;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.entity.Player;
|
||||
@@ -15,9 +15,9 @@ import xyz.xenondevs.invui.item.impl.AbstractItem;
|
||||
|
||||
public class AmountItem extends AbstractItem {
|
||||
|
||||
private final ItemPage itemPage;
|
||||
private final SectionPage itemPage;
|
||||
|
||||
public AmountItem(ItemPage itemPage) {
|
||||
public AmountItem(SectionPage itemPage) {
|
||||
this.itemPage = itemPage;
|
||||
}
|
||||
|
||||
@@ -51,7 +51,7 @@ public class AmountItem extends AbstractItem {
|
||||
@Override
|
||||
public void handleClick(@NotNull ClickType clickType, @NotNull Player player, @NotNull InventoryClickEvent event) {
|
||||
if (clickType.isLeftClick()) {
|
||||
new AmountEditor(player, itemPage, itemPage.getSection());
|
||||
new AmountEditor(player, itemPage);
|
||||
} else if (clickType.isRightClick()) {
|
||||
itemPage.getSection().set("amount", null);
|
||||
itemPage.save();
|
||||
|
||||
@@ -2,7 +2,7 @@ package net.momirealms.customfishing.gui.icon.property.item;
|
||||
|
||||
import net.momirealms.customfishing.adventure.AdventureManagerImpl;
|
||||
import net.momirealms.customfishing.adventure.component.ShadedAdventureComponentWrapper;
|
||||
import net.momirealms.customfishing.gui.ItemPage;
|
||||
import net.momirealms.customfishing.gui.SectionPage;
|
||||
import net.momirealms.customfishing.gui.page.property.CustomModelDataEditor;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.entity.Player;
|
||||
@@ -15,9 +15,9 @@ import xyz.xenondevs.invui.item.impl.AbstractItem;
|
||||
|
||||
public class CMDItem extends AbstractItem {
|
||||
|
||||
private final ItemPage itemPage;
|
||||
private final SectionPage itemPage;
|
||||
|
||||
public CMDItem(ItemPage itemPage) {
|
||||
public CMDItem(SectionPage itemPage) {
|
||||
this.itemPage = itemPage;
|
||||
}
|
||||
|
||||
@@ -50,7 +50,7 @@ public class CMDItem extends AbstractItem {
|
||||
@Override
|
||||
public void handleClick(@NotNull ClickType clickType, @NotNull Player player, @NotNull InventoryClickEvent event) {
|
||||
if (clickType.isLeftClick()) {
|
||||
new CustomModelDataEditor(player, itemPage, itemPage.getSection());
|
||||
new CustomModelDataEditor(player, itemPage);
|
||||
} else if (clickType.isRightClick()) {
|
||||
itemPage.getSection().set("custom-model-data", null);
|
||||
itemPage.save();
|
||||
|
||||
@@ -2,7 +2,7 @@ package net.momirealms.customfishing.gui.icon.property.item;
|
||||
|
||||
import net.momirealms.customfishing.adventure.AdventureManagerImpl;
|
||||
import net.momirealms.customfishing.adventure.component.ShadedAdventureComponentWrapper;
|
||||
import net.momirealms.customfishing.gui.ItemPage;
|
||||
import net.momirealms.customfishing.gui.SectionPage;
|
||||
import net.momirealms.customfishing.gui.page.property.DisplayNameEditor;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.entity.Player;
|
||||
@@ -15,9 +15,9 @@ import xyz.xenondevs.invui.item.impl.AbstractItem;
|
||||
|
||||
public class DisplayNameItem extends AbstractItem {
|
||||
|
||||
private final ItemPage itemPage;
|
||||
private final SectionPage itemPage;
|
||||
|
||||
public DisplayNameItem(ItemPage itemPage) {
|
||||
public DisplayNameItem(SectionPage itemPage) {
|
||||
this.itemPage = itemPage;
|
||||
}
|
||||
|
||||
@@ -50,7 +50,7 @@ public class DisplayNameItem extends AbstractItem {
|
||||
@Override
|
||||
public void handleClick(@NotNull ClickType clickType, @NotNull Player player, @NotNull InventoryClickEvent event) {
|
||||
if (clickType.isLeftClick()) {
|
||||
new DisplayNameEditor(player, itemPage, itemPage.getSection());
|
||||
new DisplayNameEditor(player, itemPage);
|
||||
} else if (clickType.isRightClick()) {
|
||||
itemPage.getSection().set("display.name", null);
|
||||
itemPage.save();
|
||||
|
||||
@@ -2,7 +2,7 @@ package net.momirealms.customfishing.gui.icon.property.item;
|
||||
|
||||
import net.momirealms.customfishing.adventure.AdventureManagerImpl;
|
||||
import net.momirealms.customfishing.adventure.component.ShadedAdventureComponentWrapper;
|
||||
import net.momirealms.customfishing.gui.ItemPage;
|
||||
import net.momirealms.customfishing.gui.SectionPage;
|
||||
import net.momirealms.customfishing.gui.page.property.DurabilityEditor;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.entity.Player;
|
||||
@@ -15,9 +15,9 @@ import xyz.xenondevs.invui.item.impl.AbstractItem;
|
||||
|
||||
public class DurabilityItem extends AbstractItem {
|
||||
|
||||
private final ItemPage itemPage;
|
||||
private final SectionPage itemPage;
|
||||
|
||||
public DurabilityItem(ItemPage itemPage) {
|
||||
public DurabilityItem(SectionPage itemPage) {
|
||||
this.itemPage = itemPage;
|
||||
}
|
||||
|
||||
@@ -50,7 +50,7 @@ public class DurabilityItem extends AbstractItem {
|
||||
@Override
|
||||
public void handleClick(@NotNull ClickType clickType, @NotNull Player player, @NotNull InventoryClickEvent event) {
|
||||
if (clickType.isLeftClick()) {
|
||||
new DurabilityEditor(player, itemPage, itemPage.getSection());
|
||||
new DurabilityEditor(player, itemPage);
|
||||
} else if (clickType.isRightClick()) {
|
||||
itemPage.getSection().set("max-durability", null);
|
||||
itemPage.save();
|
||||
|
||||
@@ -2,9 +2,8 @@ package net.momirealms.customfishing.gui.icon.property.item;
|
||||
|
||||
import net.momirealms.customfishing.adventure.AdventureManagerImpl;
|
||||
import net.momirealms.customfishing.adventure.component.ShadedAdventureComponentWrapper;
|
||||
import net.momirealms.customfishing.gui.ItemPage;
|
||||
import net.momirealms.customfishing.gui.SectionPage;
|
||||
import net.momirealms.customfishing.gui.page.property.EnchantmentEditor;
|
||||
import net.momirealms.customfishing.gui.page.property.SizeEditor;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.enchantments.Enchantment;
|
||||
import org.bukkit.entity.Player;
|
||||
@@ -20,9 +19,9 @@ import java.util.Map;
|
||||
|
||||
public class EnchantmentItem extends AbstractItem {
|
||||
|
||||
private final ItemPage itemPage;
|
||||
private final SectionPage itemPage;
|
||||
|
||||
public EnchantmentItem(ItemPage itemPage) {
|
||||
public EnchantmentItem(SectionPage itemPage) {
|
||||
this.itemPage = itemPage;
|
||||
}
|
||||
|
||||
@@ -63,7 +62,7 @@ public class EnchantmentItem extends AbstractItem {
|
||||
@Override
|
||||
public void handleClick(@NotNull ClickType clickType, @NotNull Player player, @NotNull InventoryClickEvent event) {
|
||||
if (clickType.isLeftClick()) {
|
||||
new EnchantmentEditor(player, itemPage, itemPage.getSection(), false);
|
||||
new EnchantmentEditor(player, itemPage, false);
|
||||
} else if (clickType.isRightClick()) {
|
||||
itemPage.getSection().set("enchantments", null);
|
||||
itemPage.save();
|
||||
|
||||
@@ -4,7 +4,7 @@ import net.momirealms.customfishing.CustomFishingPluginImpl;
|
||||
import net.momirealms.customfishing.adventure.AdventureManagerImpl;
|
||||
import net.momirealms.customfishing.adventure.component.ShadedAdventureComponentWrapper;
|
||||
import net.momirealms.customfishing.api.CustomFishingPlugin;
|
||||
import net.momirealms.customfishing.gui.ItemPage;
|
||||
import net.momirealms.customfishing.gui.SectionPage;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.inventory.ClickType;
|
||||
@@ -18,9 +18,9 @@ import java.util.ArrayList;
|
||||
|
||||
public class Head64Item extends AbstractItem {
|
||||
|
||||
private final ItemPage itemPage;
|
||||
private final SectionPage itemPage;
|
||||
|
||||
public Head64Item(ItemPage itemPage) {
|
||||
public Head64Item(SectionPage itemPage) {
|
||||
this.itemPage = itemPage;
|
||||
}
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@ package net.momirealms.customfishing.gui.icon.property.item;
|
||||
|
||||
import net.momirealms.customfishing.adventure.AdventureManagerImpl;
|
||||
import net.momirealms.customfishing.adventure.component.ShadedAdventureComponentWrapper;
|
||||
import net.momirealms.customfishing.gui.ItemPage;
|
||||
import net.momirealms.customfishing.gui.SectionPage;
|
||||
import net.momirealms.customfishing.gui.page.property.ItemFlagEditor;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.entity.Player;
|
||||
@@ -15,9 +15,9 @@ import xyz.xenondevs.invui.item.impl.AbstractItem;
|
||||
|
||||
public class ItemFlagItem extends AbstractItem {
|
||||
|
||||
private final ItemPage itemPage;
|
||||
private final SectionPage itemPage;
|
||||
|
||||
public ItemFlagItem(ItemPage itemPage) {
|
||||
public ItemFlagItem(SectionPage itemPage) {
|
||||
this.itemPage = itemPage;
|
||||
}
|
||||
|
||||
@@ -55,7 +55,7 @@ public class ItemFlagItem extends AbstractItem {
|
||||
@Override
|
||||
public void handleClick(@NotNull ClickType clickType, @NotNull Player player, @NotNull InventoryClickEvent event) {
|
||||
if (clickType.isLeftClick()) {
|
||||
new ItemFlagEditor(player, itemPage, itemPage.getSection());
|
||||
new ItemFlagEditor(player, itemPage);
|
||||
} else if (clickType.isRightClick()) {
|
||||
itemPage.getSection().set("item-flags", null);
|
||||
itemPage.save();
|
||||
|
||||
@@ -2,7 +2,7 @@ package net.momirealms.customfishing.gui.icon.property.item;
|
||||
|
||||
import net.momirealms.customfishing.adventure.AdventureManagerImpl;
|
||||
import net.momirealms.customfishing.adventure.component.ShadedAdventureComponentWrapper;
|
||||
import net.momirealms.customfishing.gui.ItemPage;
|
||||
import net.momirealms.customfishing.gui.SectionPage;
|
||||
import net.momirealms.customfishing.gui.page.property.LoreEditor;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.entity.Player;
|
||||
@@ -15,9 +15,9 @@ import xyz.xenondevs.invui.item.impl.AbstractItem;
|
||||
|
||||
public class LoreItem extends AbstractItem {
|
||||
|
||||
private final ItemPage itemPage;
|
||||
private final SectionPage itemPage;
|
||||
|
||||
public LoreItem(ItemPage itemPage) {
|
||||
public LoreItem(SectionPage itemPage) {
|
||||
this.itemPage = itemPage;
|
||||
}
|
||||
|
||||
@@ -55,7 +55,7 @@ public class LoreItem extends AbstractItem {
|
||||
@Override
|
||||
public void handleClick(@NotNull ClickType clickType, @NotNull Player player, @NotNull InventoryClickEvent event) {
|
||||
if (clickType.isLeftClick()) {
|
||||
new LoreEditor(player, itemPage, itemPage.getSection());
|
||||
new LoreEditor(player, itemPage);
|
||||
} else if (clickType.isRightClick()) {
|
||||
itemPage.getSection().set("display.lore", null);
|
||||
itemPage.save();
|
||||
|
||||
@@ -2,7 +2,7 @@ package net.momirealms.customfishing.gui.icon.property.item;
|
||||
|
||||
import net.momirealms.customfishing.adventure.AdventureManagerImpl;
|
||||
import net.momirealms.customfishing.adventure.component.ShadedAdventureComponentWrapper;
|
||||
import net.momirealms.customfishing.gui.ItemPage;
|
||||
import net.momirealms.customfishing.gui.SectionPage;
|
||||
import net.momirealms.customfishing.gui.page.property.MaterialEditor;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.entity.Player;
|
||||
@@ -15,9 +15,9 @@ import xyz.xenondevs.invui.item.impl.AbstractItem;
|
||||
|
||||
public class MaterialItem extends AbstractItem {
|
||||
|
||||
private final ItemPage itemPage;
|
||||
private final SectionPage itemPage;
|
||||
|
||||
public MaterialItem(ItemPage itemPage) {
|
||||
public MaterialItem(SectionPage itemPage) {
|
||||
this.itemPage = itemPage;
|
||||
}
|
||||
|
||||
@@ -50,7 +50,7 @@ public class MaterialItem extends AbstractItem {
|
||||
@Override
|
||||
public void handleClick(@NotNull ClickType clickType, @NotNull Player player, @NotNull InventoryClickEvent event) {
|
||||
if (clickType.isLeftClick()) {
|
||||
new MaterialEditor(player, itemPage, itemPage.getSection());
|
||||
new MaterialEditor(player, itemPage);
|
||||
} else if (clickType.isRightClick()) {
|
||||
itemPage.getSection().set("material", null);
|
||||
itemPage.save();
|
||||
|
||||
@@ -2,7 +2,7 @@ package net.momirealms.customfishing.gui.icon.property.item;
|
||||
|
||||
import net.momirealms.customfishing.adventure.AdventureManagerImpl;
|
||||
import net.momirealms.customfishing.adventure.component.ShadedAdventureComponentWrapper;
|
||||
import net.momirealms.customfishing.gui.ItemPage;
|
||||
import net.momirealms.customfishing.gui.SectionPage;
|
||||
import net.momirealms.customfishing.gui.page.property.NBTEditor;
|
||||
import net.momirealms.customfishing.util.ConfigUtils;
|
||||
import org.bukkit.Material;
|
||||
@@ -16,9 +16,9 @@ import xyz.xenondevs.invui.item.impl.AbstractItem;
|
||||
|
||||
public class NBTItem extends AbstractItem {
|
||||
|
||||
private final ItemPage itemPage;
|
||||
private final SectionPage itemPage;
|
||||
|
||||
public NBTItem(ItemPage itemPage) {
|
||||
public NBTItem(SectionPage itemPage) {
|
||||
this.itemPage = itemPage;
|
||||
}
|
||||
|
||||
@@ -56,7 +56,7 @@ public class NBTItem extends AbstractItem {
|
||||
@Override
|
||||
public void handleClick(@NotNull ClickType clickType, @NotNull Player player, @NotNull InventoryClickEvent event) {
|
||||
if (clickType.isLeftClick()) {
|
||||
new NBTEditor(player, itemPage, itemPage.getSection());
|
||||
new NBTEditor(player, itemPage);
|
||||
} else if (clickType.isRightClick()) {
|
||||
itemPage.getSection().set("nbt", null);
|
||||
itemPage.save();
|
||||
|
||||
@@ -2,7 +2,7 @@ package net.momirealms.customfishing.gui.icon.property.item;
|
||||
|
||||
import net.momirealms.customfishing.adventure.AdventureManagerImpl;
|
||||
import net.momirealms.customfishing.adventure.component.ShadedAdventureComponentWrapper;
|
||||
import net.momirealms.customfishing.gui.ItemPage;
|
||||
import net.momirealms.customfishing.gui.SectionPage;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.inventory.ClickType;
|
||||
@@ -14,9 +14,9 @@ import xyz.xenondevs.invui.item.impl.AbstractItem;
|
||||
|
||||
public class PreventGrabItem extends AbstractItem {
|
||||
|
||||
private final ItemPage itemPage;
|
||||
private final SectionPage itemPage;
|
||||
|
||||
public PreventGrabItem(ItemPage itemPage) {
|
||||
public PreventGrabItem(SectionPage itemPage) {
|
||||
this.itemPage = itemPage;
|
||||
}
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@ package net.momirealms.customfishing.gui.icon.property.item;
|
||||
|
||||
import net.momirealms.customfishing.adventure.AdventureManagerImpl;
|
||||
import net.momirealms.customfishing.adventure.component.ShadedAdventureComponentWrapper;
|
||||
import net.momirealms.customfishing.gui.ItemPage;
|
||||
import net.momirealms.customfishing.gui.SectionPage;
|
||||
import net.momirealms.customfishing.gui.page.property.PriceEditor;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.entity.Player;
|
||||
@@ -15,9 +15,9 @@ import xyz.xenondevs.invui.item.impl.AbstractItem;
|
||||
|
||||
public class PriceItem extends AbstractItem {
|
||||
|
||||
private final ItemPage itemPage;
|
||||
private final SectionPage itemPage;
|
||||
|
||||
public PriceItem(ItemPage itemPage) {
|
||||
public PriceItem(SectionPage itemPage) {
|
||||
this.itemPage = itemPage;
|
||||
}
|
||||
|
||||
@@ -56,7 +56,7 @@ public class PriceItem extends AbstractItem {
|
||||
@Override
|
||||
public void handleClick(@NotNull ClickType clickType, @NotNull Player player, @NotNull InventoryClickEvent event) {
|
||||
if (clickType.isLeftClick()) {
|
||||
new PriceEditor(player, itemPage, itemPage.getSection());
|
||||
new PriceEditor(player, itemPage);
|
||||
} else if (clickType.isRightClick()) {
|
||||
itemPage.getSection().set("price", null);
|
||||
itemPage.save();
|
||||
|
||||
@@ -2,7 +2,7 @@ package net.momirealms.customfishing.gui.icon.property.item;
|
||||
|
||||
import net.momirealms.customfishing.adventure.AdventureManagerImpl;
|
||||
import net.momirealms.customfishing.adventure.component.ShadedAdventureComponentWrapper;
|
||||
import net.momirealms.customfishing.gui.ItemPage;
|
||||
import net.momirealms.customfishing.gui.SectionPage;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.inventory.ClickType;
|
||||
@@ -14,9 +14,9 @@ import xyz.xenondevs.invui.item.impl.AbstractItem;
|
||||
|
||||
public class RandomDurabilityItem extends AbstractItem {
|
||||
|
||||
private final ItemPage itemPage;
|
||||
private final SectionPage itemPage;
|
||||
|
||||
public RandomDurabilityItem(ItemPage itemPage) {
|
||||
public RandomDurabilityItem(SectionPage itemPage) {
|
||||
this.itemPage = itemPage;
|
||||
}
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@ package net.momirealms.customfishing.gui.icon.property.item;
|
||||
|
||||
import net.momirealms.customfishing.adventure.AdventureManagerImpl;
|
||||
import net.momirealms.customfishing.adventure.component.ShadedAdventureComponentWrapper;
|
||||
import net.momirealms.customfishing.gui.ItemPage;
|
||||
import net.momirealms.customfishing.gui.SectionPage;
|
||||
import net.momirealms.customfishing.gui.page.property.SizeEditor;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.entity.Player;
|
||||
@@ -15,9 +15,9 @@ import xyz.xenondevs.invui.item.impl.AbstractItem;
|
||||
|
||||
public class SizeItem extends AbstractItem {
|
||||
|
||||
private final ItemPage itemPage;
|
||||
private final SectionPage itemPage;
|
||||
|
||||
public SizeItem(ItemPage itemPage) {
|
||||
public SizeItem(SectionPage itemPage) {
|
||||
this.itemPage = itemPage;
|
||||
}
|
||||
|
||||
@@ -50,7 +50,7 @@ public class SizeItem extends AbstractItem {
|
||||
@Override
|
||||
public void handleClick(@NotNull ClickType clickType, @NotNull Player player, @NotNull InventoryClickEvent event) {
|
||||
if (clickType.isLeftClick()) {
|
||||
new SizeEditor(player, itemPage, itemPage.getSection());
|
||||
new SizeEditor(player, itemPage);
|
||||
} else if (clickType.isRightClick()) {
|
||||
itemPage.getSection().set("size", null);
|
||||
itemPage.save();
|
||||
|
||||
@@ -2,7 +2,7 @@ package net.momirealms.customfishing.gui.icon.property.item;
|
||||
|
||||
import net.momirealms.customfishing.adventure.AdventureManagerImpl;
|
||||
import net.momirealms.customfishing.adventure.component.ShadedAdventureComponentWrapper;
|
||||
import net.momirealms.customfishing.gui.ItemPage;
|
||||
import net.momirealms.customfishing.gui.SectionPage;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.inventory.ClickType;
|
||||
@@ -14,9 +14,9 @@ import xyz.xenondevs.invui.item.impl.AbstractItem;
|
||||
|
||||
public class StackableItem extends AbstractItem {
|
||||
|
||||
private final ItemPage itemPage;
|
||||
private final SectionPage itemPage;
|
||||
|
||||
public StackableItem(ItemPage itemPage) {
|
||||
public StackableItem(SectionPage itemPage) {
|
||||
this.itemPage = itemPage;
|
||||
}
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@ package net.momirealms.customfishing.gui.icon.property.item;
|
||||
|
||||
import net.momirealms.customfishing.adventure.AdventureManagerImpl;
|
||||
import net.momirealms.customfishing.adventure.component.ShadedAdventureComponentWrapper;
|
||||
import net.momirealms.customfishing.gui.ItemPage;
|
||||
import net.momirealms.customfishing.gui.SectionPage;
|
||||
import net.momirealms.customfishing.gui.page.property.EnchantmentEditor;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.enchantments.Enchantment;
|
||||
@@ -19,9 +19,9 @@ import java.util.Map;
|
||||
|
||||
public class StoredEnchantmentItem extends AbstractItem {
|
||||
|
||||
private final ItemPage itemPage;
|
||||
private final SectionPage itemPage;
|
||||
|
||||
public StoredEnchantmentItem(ItemPage itemPage) {
|
||||
public StoredEnchantmentItem(SectionPage itemPage) {
|
||||
this.itemPage = itemPage;
|
||||
}
|
||||
|
||||
@@ -62,7 +62,7 @@ public class StoredEnchantmentItem extends AbstractItem {
|
||||
@Override
|
||||
public void handleClick(@NotNull ClickType clickType, @NotNull Player player, @NotNull InventoryClickEvent event) {
|
||||
if (clickType.isLeftClick()) {
|
||||
new EnchantmentEditor(player, itemPage, itemPage.getSection(), true);
|
||||
new EnchantmentEditor(player, itemPage, true);
|
||||
} else if (clickType.isRightClick()) {
|
||||
itemPage.getSection().set("stored-enchantments", null);
|
||||
itemPage.save();
|
||||
|
||||
@@ -2,7 +2,7 @@ package net.momirealms.customfishing.gui.icon.property.item;
|
||||
|
||||
import net.momirealms.customfishing.adventure.AdventureManagerImpl;
|
||||
import net.momirealms.customfishing.adventure.component.ShadedAdventureComponentWrapper;
|
||||
import net.momirealms.customfishing.gui.ItemPage;
|
||||
import net.momirealms.customfishing.gui.SectionPage;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.inventory.ClickType;
|
||||
@@ -14,9 +14,9 @@ import xyz.xenondevs.invui.item.impl.AbstractItem;
|
||||
|
||||
public class TagItem extends AbstractItem {
|
||||
|
||||
private final ItemPage itemPage;
|
||||
private final SectionPage itemPage;
|
||||
|
||||
public TagItem(ItemPage itemPage) {
|
||||
public TagItem(SectionPage itemPage) {
|
||||
this.itemPage = itemPage;
|
||||
}
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@ package net.momirealms.customfishing.gui.icon.property.item;
|
||||
|
||||
import net.momirealms.customfishing.adventure.AdventureManagerImpl;
|
||||
import net.momirealms.customfishing.adventure.component.ShadedAdventureComponentWrapper;
|
||||
import net.momirealms.customfishing.gui.ItemPage;
|
||||
import net.momirealms.customfishing.gui.SectionPage;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.inventory.ClickType;
|
||||
@@ -14,9 +14,9 @@ import xyz.xenondevs.invui.item.impl.AbstractItem;
|
||||
|
||||
public class UnbreakableItem extends AbstractItem {
|
||||
|
||||
private final ItemPage itemPage;
|
||||
private final SectionPage itemPage;
|
||||
|
||||
public UnbreakableItem(ItemPage itemPage) {
|
||||
public UnbreakableItem(SectionPage itemPage) {
|
||||
this.itemPage = itemPage;
|
||||
}
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@ package net.momirealms.customfishing.gui.icon.property.loot;
|
||||
|
||||
import net.momirealms.customfishing.adventure.AdventureManagerImpl;
|
||||
import net.momirealms.customfishing.adventure.component.ShadedAdventureComponentWrapper;
|
||||
import net.momirealms.customfishing.gui.ItemPage;
|
||||
import net.momirealms.customfishing.gui.SectionPage;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.inventory.ClickType;
|
||||
@@ -14,9 +14,9 @@ import xyz.xenondevs.invui.item.impl.AbstractItem;
|
||||
|
||||
public class DisableGameItem extends AbstractItem {
|
||||
|
||||
private final ItemPage itemPage;
|
||||
private final SectionPage itemPage;
|
||||
|
||||
public DisableGameItem(ItemPage itemPage) {
|
||||
public DisableGameItem(SectionPage itemPage) {
|
||||
this.itemPage = itemPage;
|
||||
}
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@ package net.momirealms.customfishing.gui.icon.property.loot;
|
||||
|
||||
import net.momirealms.customfishing.adventure.AdventureManagerImpl;
|
||||
import net.momirealms.customfishing.adventure.component.ShadedAdventureComponentWrapper;
|
||||
import net.momirealms.customfishing.gui.ItemPage;
|
||||
import net.momirealms.customfishing.gui.SectionPage;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.inventory.ClickType;
|
||||
@@ -14,9 +14,9 @@ import xyz.xenondevs.invui.item.impl.AbstractItem;
|
||||
|
||||
public class DisableStatsItem extends AbstractItem {
|
||||
|
||||
private final ItemPage itemPage;
|
||||
private final SectionPage itemPage;
|
||||
|
||||
public DisableStatsItem(ItemPage itemPage) {
|
||||
public DisableStatsItem(SectionPage itemPage) {
|
||||
this.itemPage = itemPage;
|
||||
}
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@ package net.momirealms.customfishing.gui.icon.property.loot;
|
||||
|
||||
import net.momirealms.customfishing.adventure.AdventureManagerImpl;
|
||||
import net.momirealms.customfishing.adventure.component.ShadedAdventureComponentWrapper;
|
||||
import net.momirealms.customfishing.gui.ItemPage;
|
||||
import net.momirealms.customfishing.gui.SectionPage;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.inventory.ClickType;
|
||||
@@ -14,9 +14,9 @@ import xyz.xenondevs.invui.item.impl.AbstractItem;
|
||||
|
||||
public class InstantGameItem extends AbstractItem {
|
||||
|
||||
private final ItemPage itemPage;
|
||||
private final SectionPage itemPage;
|
||||
|
||||
public InstantGameItem(ItemPage itemPage) {
|
||||
public InstantGameItem(SectionPage itemPage) {
|
||||
this.itemPage = itemPage;
|
||||
}
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@ package net.momirealms.customfishing.gui.icon.property.loot;
|
||||
|
||||
import net.momirealms.customfishing.adventure.AdventureManagerImpl;
|
||||
import net.momirealms.customfishing.adventure.component.ShadedAdventureComponentWrapper;
|
||||
import net.momirealms.customfishing.gui.ItemPage;
|
||||
import net.momirealms.customfishing.gui.SectionPage;
|
||||
import net.momirealms.customfishing.gui.page.property.NickEditor;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.entity.Player;
|
||||
@@ -15,9 +15,9 @@ import xyz.xenondevs.invui.item.impl.AbstractItem;
|
||||
|
||||
public class NickItem extends AbstractItem {
|
||||
|
||||
private final ItemPage itemPage;
|
||||
private final SectionPage itemPage;
|
||||
|
||||
public NickItem(ItemPage itemPage) {
|
||||
public NickItem(SectionPage itemPage) {
|
||||
this.itemPage = itemPage;
|
||||
}
|
||||
|
||||
@@ -50,7 +50,7 @@ public class NickItem extends AbstractItem {
|
||||
@Override
|
||||
public void handleClick(@NotNull ClickType clickType, @NotNull Player player, @NotNull InventoryClickEvent event) {
|
||||
if (clickType.isLeftClick()) {
|
||||
new NickEditor(player, itemPage, itemPage.getSection());
|
||||
new NickEditor(player, itemPage);
|
||||
} else if (clickType.isRightClick()) {
|
||||
itemPage.getSection().set("nick", null);
|
||||
itemPage.save();
|
||||
|
||||
@@ -2,7 +2,7 @@ package net.momirealms.customfishing.gui.icon.property.loot;
|
||||
|
||||
import net.momirealms.customfishing.adventure.AdventureManagerImpl;
|
||||
import net.momirealms.customfishing.adventure.component.ShadedAdventureComponentWrapper;
|
||||
import net.momirealms.customfishing.gui.ItemPage;
|
||||
import net.momirealms.customfishing.gui.SectionPage;
|
||||
import net.momirealms.customfishing.gui.page.property.ScoreEditor;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.entity.Player;
|
||||
@@ -15,9 +15,9 @@ import xyz.xenondevs.invui.item.impl.AbstractItem;
|
||||
|
||||
public class ScoreItem extends AbstractItem {
|
||||
|
||||
private final ItemPage itemPage;
|
||||
private final SectionPage itemPage;
|
||||
|
||||
public ScoreItem(ItemPage itemPage) {
|
||||
public ScoreItem(SectionPage itemPage) {
|
||||
this.itemPage = itemPage;
|
||||
}
|
||||
|
||||
@@ -50,7 +50,7 @@ public class ScoreItem extends AbstractItem {
|
||||
@Override
|
||||
public void handleClick(@NotNull ClickType clickType, @NotNull Player player, @NotNull InventoryClickEvent event) {
|
||||
if (clickType.isLeftClick()) {
|
||||
new ScoreEditor(player, itemPage, itemPage.getSection());
|
||||
new ScoreEditor(player, itemPage);
|
||||
} else if (clickType.isRightClick()) {
|
||||
itemPage.getSection().set("score", null);
|
||||
itemPage.save();
|
||||
|
||||
@@ -2,7 +2,7 @@ package net.momirealms.customfishing.gui.icon.property.loot;
|
||||
|
||||
import net.momirealms.customfishing.adventure.AdventureManagerImpl;
|
||||
import net.momirealms.customfishing.adventure.component.ShadedAdventureComponentWrapper;
|
||||
import net.momirealms.customfishing.gui.ItemPage;
|
||||
import net.momirealms.customfishing.gui.SectionPage;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.inventory.ClickType;
|
||||
@@ -14,9 +14,9 @@ import xyz.xenondevs.invui.item.impl.AbstractItem;
|
||||
|
||||
public class ShowInFinderItem extends AbstractItem {
|
||||
|
||||
private final ItemPage itemPage;
|
||||
private final SectionPage itemPage;
|
||||
|
||||
public ShowInFinderItem(ItemPage itemPage) {
|
||||
public ShowInFinderItem(SectionPage itemPage) {
|
||||
this.itemPage = itemPage;
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,46 @@
|
||||
package net.momirealms.customfishing.gui.icon.property.requirement;
|
||||
|
||||
import net.momirealms.customfishing.adventure.AdventureManagerImpl;
|
||||
import net.momirealms.customfishing.adventure.component.ShadedAdventureComponentWrapper;
|
||||
import net.momirealms.customfishing.gui.SectionPage;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.configuration.ConfigurationSection;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.inventory.ClickType;
|
||||
import org.bukkit.event.inventory.InventoryClickEvent;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import xyz.xenondevs.invui.item.ItemProvider;
|
||||
import xyz.xenondevs.invui.item.builder.ItemBuilder;
|
||||
import xyz.xenondevs.invui.item.impl.AbstractItem;
|
||||
|
||||
public class RequirementEditorIcon extends AbstractItem {
|
||||
|
||||
private final SectionPage sectionPage;
|
||||
|
||||
public RequirementEditorIcon(SectionPage sectionPage) {
|
||||
this.sectionPage = sectionPage;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemProvider getItemProvider() {
|
||||
ItemBuilder itemBuilder = new ItemBuilder(Material.COMPASS)
|
||||
.setDisplayName(new ShadedAdventureComponentWrapper(AdventureManagerImpl.getInstance().getComponentFromMiniMessage(
|
||||
"<#B0E0E6>● Requirements"
|
||||
)))
|
||||
.addLoreLines("")
|
||||
.addLoreLines(new ShadedAdventureComponentWrapper(AdventureManagerImpl.getInstance().getComponentFromMiniMessage(
|
||||
"<#00FF7F> -> Click to edit requirements"
|
||||
)));
|
||||
|
||||
return itemBuilder;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void handleClick(@NotNull ClickType clickType, @NotNull Player player, @NotNull InventoryClickEvent event) {
|
||||
ConfigurationSection reqSection = sectionPage.getSection().getConfigurationSection("requirements");
|
||||
if (reqSection == null)
|
||||
reqSection = sectionPage.getSection().createSection("requirements");
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,106 @@
|
||||
package net.momirealms.customfishing.gui.page.item;
|
||||
|
||||
import net.momirealms.customfishing.adventure.AdventureManagerImpl;
|
||||
import net.momirealms.customfishing.adventure.component.ShadedAdventureComponentWrapper;
|
||||
import net.momirealms.customfishing.api.CustomFishingPlugin;
|
||||
import net.momirealms.customfishing.gui.SectionPage;
|
||||
import net.momirealms.customfishing.gui.icon.BackGroundItem;
|
||||
import net.momirealms.customfishing.gui.icon.BackToPageItem;
|
||||
import net.momirealms.customfishing.gui.icon.NextPageItem;
|
||||
import net.momirealms.customfishing.gui.icon.PreviousPageItem;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.configuration.ConfigurationSection;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.inventory.ClickType;
|
||||
import org.bukkit.event.inventory.InventoryClickEvent;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import xyz.xenondevs.invui.gui.Gui;
|
||||
import xyz.xenondevs.invui.gui.PagedGui;
|
||||
import xyz.xenondevs.invui.gui.structure.Markers;
|
||||
import xyz.xenondevs.invui.item.Item;
|
||||
import xyz.xenondevs.invui.item.ItemProvider;
|
||||
import xyz.xenondevs.invui.item.builder.ItemBuilder;
|
||||
import xyz.xenondevs.invui.item.impl.AbstractItem;
|
||||
import xyz.xenondevs.invui.item.impl.SimpleItem;
|
||||
import xyz.xenondevs.invui.window.AnvilWindow;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public abstract class AbstractSectionEditor implements SectionPage {
|
||||
|
||||
protected final Player player;
|
||||
protected final ItemSelector itemSelector;
|
||||
protected final ConfigurationSection section;
|
||||
protected final String key;
|
||||
|
||||
public AbstractSectionEditor(Player player, ItemSelector itemSelector, ConfigurationSection section, String key) {
|
||||
this.player = player;
|
||||
this.itemSelector = itemSelector;
|
||||
this.section = section;
|
||||
this.key = key;
|
||||
this.reOpen();
|
||||
}
|
||||
|
||||
@Override
|
||||
public ConfigurationSection getSection() {
|
||||
return section;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void reOpen() {
|
||||
Item border = new SimpleItem(new ItemBuilder(Material.AIR));
|
||||
Gui upperGui = Gui.normal()
|
||||
.setStructure(
|
||||
"# a #"
|
||||
)
|
||||
.addIngredient('a', new RefreshExample())
|
||||
.addIngredient('#', border)
|
||||
.build();
|
||||
|
||||
var gui = PagedGui.items()
|
||||
.setStructure(
|
||||
"x x x x x x x x x",
|
||||
"x x x x x x x x x",
|
||||
"x x x x x x x x x",
|
||||
"# # a # c # b # #"
|
||||
)
|
||||
.addIngredient('x', Markers.CONTENT_LIST_SLOT_HORIZONTAL)
|
||||
.addIngredient('#', new BackGroundItem())
|
||||
.addIngredient('a', new PreviousPageItem())
|
||||
.addIngredient('b', new NextPageItem())
|
||||
.addIngredient('c', new BackToPageItem(itemSelector))
|
||||
.setContent(getItemList())
|
||||
.build();
|
||||
|
||||
var window = AnvilWindow.split()
|
||||
.setViewer(player)
|
||||
.setTitle(new ShadedAdventureComponentWrapper(
|
||||
AdventureManagerImpl.getInstance().getComponentFromMiniMessage("Edit " + key)
|
||||
))
|
||||
.setUpperGui(upperGui)
|
||||
.setLowerGui(gui)
|
||||
.build();
|
||||
|
||||
window.open();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void save() {
|
||||
itemSelector.save();
|
||||
}
|
||||
|
||||
public class RefreshExample extends AbstractItem {
|
||||
|
||||
@Override
|
||||
public ItemProvider getItemProvider() {
|
||||
return new ItemBuilder(CustomFishingPlugin.get().getItemManager().getItemBuilder(section, "bait", key).build(player));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void handleClick(@NotNull ClickType clickType, @NotNull Player player, @NotNull InventoryClickEvent event) {
|
||||
notifyWindows();
|
||||
}
|
||||
}
|
||||
|
||||
public abstract List<Item> getItemList();
|
||||
}
|
||||
@@ -1,104 +1,21 @@
|
||||
package net.momirealms.customfishing.gui.page.item;
|
||||
|
||||
import net.momirealms.customfishing.adventure.AdventureManagerImpl;
|
||||
import net.momirealms.customfishing.adventure.component.ShadedAdventureComponentWrapper;
|
||||
import net.momirealms.customfishing.api.CustomFishingPlugin;
|
||||
import net.momirealms.customfishing.gui.ItemPage;
|
||||
import net.momirealms.customfishing.gui.icon.BackGroundItem;
|
||||
import net.momirealms.customfishing.gui.icon.BackToPageItem;
|
||||
import net.momirealms.customfishing.gui.icon.NextPageItem;
|
||||
import net.momirealms.customfishing.gui.icon.PreviousPageItem;
|
||||
import net.momirealms.customfishing.gui.icon.property.item.*;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.configuration.ConfigurationSection;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.inventory.ClickType;
|
||||
import org.bukkit.event.inventory.InventoryClickEvent;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import xyz.xenondevs.invui.gui.Gui;
|
||||
import xyz.xenondevs.invui.gui.PagedGui;
|
||||
import xyz.xenondevs.invui.gui.structure.Markers;
|
||||
import xyz.xenondevs.invui.item.Item;
|
||||
import xyz.xenondevs.invui.item.ItemProvider;
|
||||
import xyz.xenondevs.invui.item.builder.ItemBuilder;
|
||||
import xyz.xenondevs.invui.item.impl.AbstractItem;
|
||||
import xyz.xenondevs.invui.item.impl.SimpleItem;
|
||||
import xyz.xenondevs.invui.window.AnvilWindow;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class BaitEditor implements ItemPage {
|
||||
|
||||
private final Player player;
|
||||
private final ItemSelector itemSelector;
|
||||
private final ConfigurationSection section;
|
||||
private final String key;
|
||||
@SuppressWarnings("DuplicatedCode")
|
||||
public class BaitEditor extends AbstractSectionEditor {
|
||||
|
||||
public BaitEditor(Player player, String key, ItemSelector itemSelector, ConfigurationSection section) {
|
||||
this.player = player;
|
||||
this.section = section;
|
||||
this.itemSelector = itemSelector;
|
||||
this.key = key;
|
||||
this.reOpen();
|
||||
super(player, itemSelector, section, key);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void reOpen() {
|
||||
Item border = new SimpleItem(new ItemBuilder(Material.AIR));
|
||||
Gui upperGui = Gui.normal()
|
||||
.setStructure(
|
||||
"# a #"
|
||||
)
|
||||
.addIngredient('a', new RefreshExample())
|
||||
.addIngredient('#', border)
|
||||
.build();
|
||||
|
||||
var gui = PagedGui.items()
|
||||
.setStructure(
|
||||
"x x x x x x x x x",
|
||||
"x x x x x x x x x",
|
||||
"x x x x x x x x x",
|
||||
"# # a # c # b # #"
|
||||
)
|
||||
.addIngredient('x', Markers.CONTENT_LIST_SLOT_HORIZONTAL)
|
||||
.addIngredient('#', new BackGroundItem())
|
||||
.addIngredient('a', new PreviousPageItem())
|
||||
.addIngredient('b', new NextPageItem())
|
||||
.addIngredient('c', new BackToPageItem(itemSelector))
|
||||
.setContent(getItemList())
|
||||
.build();
|
||||
|
||||
var window = AnvilWindow.split()
|
||||
.setViewer(player)
|
||||
.setTitle(new ShadedAdventureComponentWrapper(
|
||||
AdventureManagerImpl.getInstance().getComponentFromMiniMessage("Edit " + key)
|
||||
))
|
||||
.setUpperGui(upperGui)
|
||||
.setLowerGui(gui)
|
||||
.build();
|
||||
|
||||
window.open();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void save() {
|
||||
itemSelector.save();
|
||||
}
|
||||
|
||||
public class RefreshExample extends AbstractItem {
|
||||
|
||||
@Override
|
||||
public ItemProvider getItemProvider() {
|
||||
return new ItemBuilder(CustomFishingPlugin.get().getItemManager().getItemBuilder(section, "bait", key).build(player));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void handleClick(@NotNull ClickType clickType, @NotNull Player player, @NotNull InventoryClickEvent event) {
|
||||
notifyWindows();
|
||||
}
|
||||
}
|
||||
|
||||
public List<Item> getItemList() {
|
||||
ArrayList<Item> items = new ArrayList<>();
|
||||
items.add(new MaterialItem(this));
|
||||
@@ -117,9 +34,4 @@ public class BaitEditor implements ItemPage {
|
||||
items.add(new StoredEnchantmentItem(this));
|
||||
return items;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ConfigurationSection getSection() {
|
||||
return section;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,104 +1,21 @@
|
||||
package net.momirealms.customfishing.gui.page.item;
|
||||
|
||||
import net.momirealms.customfishing.adventure.AdventureManagerImpl;
|
||||
import net.momirealms.customfishing.adventure.component.ShadedAdventureComponentWrapper;
|
||||
import net.momirealms.customfishing.api.CustomFishingPlugin;
|
||||
import net.momirealms.customfishing.gui.ItemPage;
|
||||
import net.momirealms.customfishing.gui.icon.BackGroundItem;
|
||||
import net.momirealms.customfishing.gui.icon.BackToPageItem;
|
||||
import net.momirealms.customfishing.gui.icon.NextPageItem;
|
||||
import net.momirealms.customfishing.gui.icon.PreviousPageItem;
|
||||
import net.momirealms.customfishing.gui.icon.property.item.*;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.configuration.ConfigurationSection;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.inventory.ClickType;
|
||||
import org.bukkit.event.inventory.InventoryClickEvent;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import xyz.xenondevs.invui.gui.Gui;
|
||||
import xyz.xenondevs.invui.gui.PagedGui;
|
||||
import xyz.xenondevs.invui.gui.structure.Markers;
|
||||
import xyz.xenondevs.invui.item.Item;
|
||||
import xyz.xenondevs.invui.item.ItemProvider;
|
||||
import xyz.xenondevs.invui.item.builder.ItemBuilder;
|
||||
import xyz.xenondevs.invui.item.impl.AbstractItem;
|
||||
import xyz.xenondevs.invui.item.impl.SimpleItem;
|
||||
import xyz.xenondevs.invui.window.AnvilWindow;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class HookEditor implements ItemPage {
|
||||
|
||||
private final Player player;
|
||||
private final ItemSelector itemSelector;
|
||||
private final ConfigurationSection section;
|
||||
private final String key;
|
||||
@SuppressWarnings("DuplicatedCode")
|
||||
public class HookEditor extends AbstractSectionEditor {
|
||||
|
||||
public HookEditor(Player player, String key, ItemSelector itemSelector, ConfigurationSection section) {
|
||||
this.player = player;
|
||||
this.section = section;
|
||||
this.itemSelector = itemSelector;
|
||||
this.key = key;
|
||||
this.reOpen();
|
||||
super(player, itemSelector, section, key);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void reOpen() {
|
||||
Item border = new SimpleItem(new ItemBuilder(Material.AIR));
|
||||
Gui upperGui = Gui.normal()
|
||||
.setStructure(
|
||||
"# a #"
|
||||
)
|
||||
.addIngredient('a', new RefreshExample())
|
||||
.addIngredient('#', border)
|
||||
.build();
|
||||
|
||||
var gui = PagedGui.items()
|
||||
.setStructure(
|
||||
"x x x x x x x x x",
|
||||
"x x x x x x x x x",
|
||||
"x x x x x x x x x",
|
||||
"# # a # c # b # #"
|
||||
)
|
||||
.addIngredient('x', Markers.CONTENT_LIST_SLOT_HORIZONTAL)
|
||||
.addIngredient('#', new BackGroundItem())
|
||||
.addIngredient('a', new PreviousPageItem())
|
||||
.addIngredient('b', new NextPageItem())
|
||||
.addIngredient('c', new BackToPageItem(itemSelector))
|
||||
.setContent(getItemList())
|
||||
.build();
|
||||
|
||||
var window = AnvilWindow.split()
|
||||
.setViewer(player)
|
||||
.setTitle(new ShadedAdventureComponentWrapper(
|
||||
AdventureManagerImpl.getInstance().getComponentFromMiniMessage("Edit " + key)
|
||||
))
|
||||
.setUpperGui(upperGui)
|
||||
.setLowerGui(gui)
|
||||
.build();
|
||||
|
||||
window.open();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void save() {
|
||||
itemSelector.save();
|
||||
}
|
||||
|
||||
public class RefreshExample extends AbstractItem {
|
||||
|
||||
@Override
|
||||
public ItemProvider getItemProvider() {
|
||||
return new ItemBuilder(CustomFishingPlugin.get().getItemManager().getItemBuilder(section, "item", key).build(player));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void handleClick(@NotNull ClickType clickType, @NotNull Player player, @NotNull InventoryClickEvent event) {
|
||||
notifyWindows();
|
||||
}
|
||||
}
|
||||
|
||||
public List<Item> getItemList() {
|
||||
ArrayList<Item> items = new ArrayList<>();
|
||||
items.add(new MaterialItem(this));
|
||||
@@ -117,9 +34,4 @@ public class HookEditor implements ItemPage {
|
||||
items.add(new StoredEnchantmentItem(this));
|
||||
return items;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ConfigurationSection getSection() {
|
||||
return section;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -131,7 +131,7 @@ public class ItemSelector implements YamlPage {
|
||||
public void openEditor(String key) {
|
||||
switch (type) {
|
||||
case "item" -> {
|
||||
new ItemEditor(player, key, this, yaml.getConfigurationSection(key));
|
||||
new SectionEditor(player, key, this, yaml.getConfigurationSection(key));
|
||||
}
|
||||
case "rod" -> {
|
||||
new RodEditor(player, key, this, yaml.getConfigurationSection(key));
|
||||
|
||||
@@ -1,104 +1,21 @@
|
||||
package net.momirealms.customfishing.gui.page.item;
|
||||
|
||||
import net.momirealms.customfishing.adventure.AdventureManagerImpl;
|
||||
import net.momirealms.customfishing.adventure.component.ShadedAdventureComponentWrapper;
|
||||
import net.momirealms.customfishing.api.CustomFishingPlugin;
|
||||
import net.momirealms.customfishing.gui.ItemPage;
|
||||
import net.momirealms.customfishing.gui.icon.BackGroundItem;
|
||||
import net.momirealms.customfishing.gui.icon.BackToPageItem;
|
||||
import net.momirealms.customfishing.gui.icon.NextPageItem;
|
||||
import net.momirealms.customfishing.gui.icon.PreviousPageItem;
|
||||
import net.momirealms.customfishing.gui.icon.property.item.*;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.configuration.ConfigurationSection;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.inventory.ClickType;
|
||||
import org.bukkit.event.inventory.InventoryClickEvent;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import xyz.xenondevs.invui.gui.Gui;
|
||||
import xyz.xenondevs.invui.gui.PagedGui;
|
||||
import xyz.xenondevs.invui.gui.structure.Markers;
|
||||
import xyz.xenondevs.invui.item.Item;
|
||||
import xyz.xenondevs.invui.item.ItemProvider;
|
||||
import xyz.xenondevs.invui.item.builder.ItemBuilder;
|
||||
import xyz.xenondevs.invui.item.impl.AbstractItem;
|
||||
import xyz.xenondevs.invui.item.impl.SimpleItem;
|
||||
import xyz.xenondevs.invui.window.AnvilWindow;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class RodEditor implements ItemPage {
|
||||
|
||||
private final Player player;
|
||||
private final ItemSelector itemSelector;
|
||||
private final ConfigurationSection section;
|
||||
private final String key;
|
||||
@SuppressWarnings("DuplicatedCode")
|
||||
public class RodEditor extends AbstractSectionEditor {
|
||||
|
||||
public RodEditor(Player player, String key, ItemSelector itemSelector, ConfigurationSection section) {
|
||||
this.player = player;
|
||||
this.section = section;
|
||||
this.itemSelector = itemSelector;
|
||||
this.key = key;
|
||||
this.reOpen();
|
||||
super(player, itemSelector, section, key);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void reOpen() {
|
||||
Item border = new SimpleItem(new ItemBuilder(Material.AIR));
|
||||
Gui upperGui = Gui.normal()
|
||||
.setStructure(
|
||||
"# a #"
|
||||
)
|
||||
.addIngredient('a', new RefreshExample())
|
||||
.addIngredient('#', border)
|
||||
.build();
|
||||
|
||||
var gui = PagedGui.items()
|
||||
.setStructure(
|
||||
"x x x x x x x x x",
|
||||
"x x x x x x x x x",
|
||||
"x x x x x x x x x",
|
||||
"# # a # c # b # #"
|
||||
)
|
||||
.addIngredient('x', Markers.CONTENT_LIST_SLOT_HORIZONTAL)
|
||||
.addIngredient('#', new BackGroundItem())
|
||||
.addIngredient('a', new PreviousPageItem())
|
||||
.addIngredient('b', new NextPageItem())
|
||||
.addIngredient('c', new BackToPageItem(itemSelector))
|
||||
.setContent(getItemList())
|
||||
.build();
|
||||
|
||||
var window = AnvilWindow.split()
|
||||
.setViewer(player)
|
||||
.setTitle(new ShadedAdventureComponentWrapper(
|
||||
AdventureManagerImpl.getInstance().getComponentFromMiniMessage("Edit " + key)
|
||||
))
|
||||
.setUpperGui(upperGui)
|
||||
.setLowerGui(gui)
|
||||
.build();
|
||||
|
||||
window.open();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void save() {
|
||||
itemSelector.save();
|
||||
}
|
||||
|
||||
public class RefreshExample extends AbstractItem {
|
||||
|
||||
@Override
|
||||
public ItemProvider getItemProvider() {
|
||||
return new ItemBuilder(CustomFishingPlugin.get().getItemManager().getItemBuilder(section, "rod", key).build(player));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void handleClick(@NotNull ClickType clickType, @NotNull Player player, @NotNull InventoryClickEvent event) {
|
||||
notifyWindows();
|
||||
}
|
||||
}
|
||||
|
||||
public List<Item> getItemList() {
|
||||
ArrayList<Item> items = new ArrayList<>();
|
||||
items.add(new MaterialItem(this));
|
||||
@@ -114,9 +31,4 @@ public class RodEditor implements ItemPage {
|
||||
items.add(new EnchantmentItem(this));
|
||||
return items;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ConfigurationSection getSection() {
|
||||
return section;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,47 @@
|
||||
package net.momirealms.customfishing.gui.page.item;
|
||||
|
||||
import net.momirealms.customfishing.gui.icon.property.item.*;
|
||||
import net.momirealms.customfishing.gui.icon.property.loot.*;
|
||||
import org.bukkit.configuration.ConfigurationSection;
|
||||
import org.bukkit.entity.Player;
|
||||
import xyz.xenondevs.invui.item.Item;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class SectionEditor extends AbstractSectionEditor {
|
||||
|
||||
public SectionEditor(Player player, String key, ItemSelector itemSelector, ConfigurationSection section) {
|
||||
super(player, itemSelector, section, key);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Item> getItemList() {
|
||||
ArrayList<Item> items = new ArrayList<>();
|
||||
items.add(new MaterialItem(this));
|
||||
items.add(new NickItem(this));
|
||||
items.add(new DisplayNameItem(this));
|
||||
items.add(new LoreItem(this));
|
||||
items.add(new CMDItem(this));
|
||||
items.add(new AmountItem(this));
|
||||
items.add(new TagItem(this));
|
||||
items.add(new UnbreakableItem(this));
|
||||
items.add(new DurabilityItem(this));
|
||||
items.add(new RandomDurabilityItem(this));
|
||||
items.add(new StackableItem(this));
|
||||
items.add(new PreventGrabItem(this));
|
||||
items.add(new PriceItem(this));
|
||||
items.add(new ShowInFinderItem(this));
|
||||
items.add(new DisableStatsItem(this));
|
||||
items.add(new DisableGameItem(this));
|
||||
items.add(new InstantGameItem(this));
|
||||
items.add(new ScoreItem(this));
|
||||
items.add(new SizeItem(this));
|
||||
items.add(new ItemFlagItem(this));
|
||||
items.add(new Head64Item(this));
|
||||
items.add(new NBTItem(this));
|
||||
items.add(new EnchantmentItem(this));
|
||||
items.add(new StoredEnchantmentItem(this));
|
||||
return items;
|
||||
}
|
||||
}
|
||||
@@ -2,6 +2,7 @@ package net.momirealms.customfishing.gui.page.property;
|
||||
|
||||
import net.momirealms.customfishing.adventure.AdventureManagerImpl;
|
||||
import net.momirealms.customfishing.adventure.component.ShadedAdventureComponentWrapper;
|
||||
import net.momirealms.customfishing.gui.SectionPage;
|
||||
import net.momirealms.customfishing.gui.YamlPage;
|
||||
import net.momirealms.customfishing.gui.icon.BackGroundItem;
|
||||
import org.bukkit.Material;
|
||||
@@ -22,15 +23,13 @@ import xyz.xenondevs.invui.window.AnvilWindow;
|
||||
|
||||
public class AmountEditor {
|
||||
|
||||
private final Player player;
|
||||
private final YamlPage parentPage;
|
||||
private final SectionPage parentPage;
|
||||
private String amount;
|
||||
private final ConfigurationSection section;
|
||||
|
||||
public AmountEditor(Player player, YamlPage parentPage, ConfigurationSection section) {
|
||||
this.player = player;
|
||||
public AmountEditor(Player player, SectionPage parentPage) {
|
||||
this.parentPage = parentPage;
|
||||
this.section = section;
|
||||
this.section = parentPage.getSection();
|
||||
|
||||
Item border = new SimpleItem(new ItemBuilder(Material.AIR));
|
||||
var confirm = new ConfirmIcon();
|
||||
|
||||
@@ -3,6 +3,7 @@ package net.momirealms.customfishing.gui.page.property;
|
||||
import net.momirealms.customfishing.adventure.AdventureManagerImpl;
|
||||
import net.momirealms.customfishing.adventure.component.ShadedAdventureComponentWrapper;
|
||||
import net.momirealms.customfishing.api.CustomFishingPlugin;
|
||||
import net.momirealms.customfishing.gui.SectionPage;
|
||||
import net.momirealms.customfishing.gui.YamlPage;
|
||||
import net.momirealms.customfishing.gui.icon.BackGroundItem;
|
||||
import org.bukkit.Material;
|
||||
@@ -24,15 +25,15 @@ import xyz.xenondevs.invui.window.AnvilWindow;
|
||||
public class CustomModelDataEditor {
|
||||
|
||||
private final Player player;
|
||||
private final YamlPage parentPage;
|
||||
private final SectionPage parentPage;
|
||||
private String cmd;
|
||||
private final ConfigurationSection section;
|
||||
private final String material;
|
||||
|
||||
public CustomModelDataEditor(Player player, YamlPage parentPage, ConfigurationSection section) {
|
||||
public CustomModelDataEditor(Player player, SectionPage parentPage) {
|
||||
this.player = player;
|
||||
this.parentPage = parentPage;
|
||||
this.section = section;
|
||||
this.section = parentPage.getSection();
|
||||
this.material = section.getString("material");
|
||||
|
||||
Item border = new SimpleItem(new ItemBuilder(Material.AIR));
|
||||
|
||||
@@ -2,6 +2,7 @@ package net.momirealms.customfishing.gui.page.property;
|
||||
|
||||
import net.momirealms.customfishing.adventure.AdventureManagerImpl;
|
||||
import net.momirealms.customfishing.adventure.component.ShadedAdventureComponentWrapper;
|
||||
import net.momirealms.customfishing.gui.SectionPage;
|
||||
import net.momirealms.customfishing.gui.YamlPage;
|
||||
import net.momirealms.customfishing.gui.icon.BackGroundItem;
|
||||
import org.bukkit.Material;
|
||||
@@ -22,15 +23,13 @@ import xyz.xenondevs.invui.window.AnvilWindow;
|
||||
|
||||
public class DisplayNameEditor {
|
||||
|
||||
private final Player player;
|
||||
private final YamlPage parentPage;
|
||||
private final SectionPage parentPage;
|
||||
private String name;
|
||||
private final ConfigurationSection section;
|
||||
|
||||
public DisplayNameEditor(Player player, YamlPage parentPage, ConfigurationSection section) {
|
||||
this.player = player;
|
||||
public DisplayNameEditor(Player player, SectionPage parentPage) {
|
||||
this.parentPage = parentPage;
|
||||
this.section = section;
|
||||
this.section = parentPage.getSection();
|
||||
|
||||
Item border = new SimpleItem(new ItemBuilder(Material.AIR));
|
||||
var confirm = new ConfirmIcon();
|
||||
|
||||
@@ -2,6 +2,7 @@ package net.momirealms.customfishing.gui.page.property;
|
||||
|
||||
import net.momirealms.customfishing.adventure.AdventureManagerImpl;
|
||||
import net.momirealms.customfishing.adventure.component.ShadedAdventureComponentWrapper;
|
||||
import net.momirealms.customfishing.gui.SectionPage;
|
||||
import net.momirealms.customfishing.gui.YamlPage;
|
||||
import net.momirealms.customfishing.gui.icon.BackGroundItem;
|
||||
import org.bukkit.Material;
|
||||
@@ -22,15 +23,13 @@ import xyz.xenondevs.invui.window.AnvilWindow;
|
||||
|
||||
public class DurabilityEditor {
|
||||
|
||||
private final Player player;
|
||||
private final YamlPage parentPage;
|
||||
private final SectionPage parentPage;
|
||||
private String dur;
|
||||
private final ConfigurationSection section;
|
||||
|
||||
public DurabilityEditor(Player player, YamlPage parentPage, ConfigurationSection section) {
|
||||
this.player = player;
|
||||
public DurabilityEditor(Player player, SectionPage parentPage) {
|
||||
this.parentPage = parentPage;
|
||||
this.section = section;
|
||||
this.section = parentPage.getSection();
|
||||
|
||||
Item border = new SimpleItem(new ItemBuilder(Material.AIR));
|
||||
var confirm = new ConfirmIcon();
|
||||
|
||||
@@ -2,6 +2,7 @@ package net.momirealms.customfishing.gui.page.property;
|
||||
|
||||
import net.momirealms.customfishing.adventure.AdventureManagerImpl;
|
||||
import net.momirealms.customfishing.adventure.component.ShadedAdventureComponentWrapper;
|
||||
import net.momirealms.customfishing.gui.SectionPage;
|
||||
import net.momirealms.customfishing.gui.YamlPage;
|
||||
import net.momirealms.customfishing.gui.icon.BackGroundItem;
|
||||
import org.bukkit.Material;
|
||||
@@ -27,16 +28,16 @@ import java.util.Map;
|
||||
public class EnchantmentEditor {
|
||||
|
||||
private final Player player;
|
||||
private final YamlPage parentPage;
|
||||
private final SectionPage parentPage;
|
||||
private final ArrayList<String> enchantments;
|
||||
private final ConfigurationSection section;
|
||||
private int index;
|
||||
private boolean store;
|
||||
private final boolean store;
|
||||
|
||||
public EnchantmentEditor(Player player, YamlPage parentPage, ConfigurationSection section, boolean store) {
|
||||
public EnchantmentEditor(Player player, SectionPage parentPage, boolean store) {
|
||||
this.player = player;
|
||||
this.parentPage = parentPage;
|
||||
this.section = section;
|
||||
this.section = parentPage.getSection();
|
||||
this.store = store;
|
||||
this.index = 0;
|
||||
this.enchantments = new ArrayList<>();
|
||||
|
||||
@@ -3,6 +3,7 @@ package net.momirealms.customfishing.gui.page.property;
|
||||
import net.momirealms.customfishing.adventure.AdventureManagerImpl;
|
||||
import net.momirealms.customfishing.adventure.component.ShadedAdventureComponentWrapper;
|
||||
import net.momirealms.customfishing.api.CustomFishingPlugin;
|
||||
import net.momirealms.customfishing.gui.SectionPage;
|
||||
import net.momirealms.customfishing.gui.YamlPage;
|
||||
import net.momirealms.customfishing.gui.icon.BackGroundItem;
|
||||
import org.bukkit.Material;
|
||||
@@ -28,15 +29,14 @@ import java.util.List;
|
||||
public class ItemFlagEditor {
|
||||
|
||||
private final Player player;
|
||||
private final YamlPage parentPage;
|
||||
private final SectionPage parentPage;
|
||||
private final List<String> flags;
|
||||
private final ConfigurationSection section;
|
||||
|
||||
public ItemFlagEditor(Player player, YamlPage parentPage, ConfigurationSection section) {
|
||||
public ItemFlagEditor(Player player, SectionPage parentPage) {
|
||||
this.player = player;
|
||||
this.parentPage = parentPage;
|
||||
this.section = section;
|
||||
int index = 0;
|
||||
this.section = parentPage.getSection();
|
||||
this.flags = section.getStringList("item-flags");
|
||||
reOpen();
|
||||
}
|
||||
|
||||
@@ -2,6 +2,7 @@ package net.momirealms.customfishing.gui.page.property;
|
||||
|
||||
import net.momirealms.customfishing.adventure.AdventureManagerImpl;
|
||||
import net.momirealms.customfishing.adventure.component.ShadedAdventureComponentWrapper;
|
||||
import net.momirealms.customfishing.gui.SectionPage;
|
||||
import net.momirealms.customfishing.gui.YamlPage;
|
||||
import net.momirealms.customfishing.gui.icon.BackGroundItem;
|
||||
import org.bukkit.Material;
|
||||
@@ -26,15 +27,15 @@ import java.util.List;
|
||||
public class LoreEditor {
|
||||
|
||||
private final Player player;
|
||||
private final YamlPage parentPage;
|
||||
private final SectionPage parentPage;
|
||||
private final ArrayList<String> lore;
|
||||
private final ConfigurationSection section;
|
||||
private int index;
|
||||
|
||||
public LoreEditor(Player player, YamlPage parentPage, ConfigurationSection section) {
|
||||
public LoreEditor(Player player, SectionPage parentPage) {
|
||||
this.player = player;
|
||||
this.parentPage = parentPage;
|
||||
this.section = section;
|
||||
this.section = parentPage.getSection();
|
||||
this.index = 0;
|
||||
this.lore = new ArrayList<>(section.getStringList("display.lore"));
|
||||
this.lore.add(0, "Select one line");
|
||||
|
||||
@@ -3,6 +3,7 @@ package net.momirealms.customfishing.gui.page.property;
|
||||
import net.momirealms.customfishing.adventure.AdventureManagerImpl;
|
||||
import net.momirealms.customfishing.adventure.component.ShadedAdventureComponentWrapper;
|
||||
import net.momirealms.customfishing.api.CustomFishingPlugin;
|
||||
import net.momirealms.customfishing.gui.SectionPage;
|
||||
import net.momirealms.customfishing.gui.YamlPage;
|
||||
import net.momirealms.customfishing.gui.icon.BackGroundItem;
|
||||
import net.momirealms.customfishing.mechanic.item.ItemManagerImpl;
|
||||
@@ -28,14 +29,14 @@ import java.util.List;
|
||||
public class MaterialEditor {
|
||||
|
||||
private final Player player;
|
||||
private final YamlPage parentPage;
|
||||
private final SectionPage parentPage;
|
||||
private String material;
|
||||
private final ConfigurationSection section;
|
||||
|
||||
public MaterialEditor(Player player, YamlPage parentPage, ConfigurationSection section) {
|
||||
public MaterialEditor(Player player, SectionPage parentPage) {
|
||||
this.player = player;
|
||||
this.parentPage = parentPage;
|
||||
this.section = section;
|
||||
this.section = parentPage.getSection();
|
||||
this.material = section.getString("material");
|
||||
|
||||
Item border = new SimpleItem(new ItemBuilder(Material.AIR));
|
||||
|
||||
@@ -2,6 +2,7 @@ package net.momirealms.customfishing.gui.page.property;
|
||||
|
||||
import net.momirealms.customfishing.adventure.AdventureManagerImpl;
|
||||
import net.momirealms.customfishing.adventure.component.ShadedAdventureComponentWrapper;
|
||||
import net.momirealms.customfishing.gui.SectionPage;
|
||||
import net.momirealms.customfishing.gui.YamlPage;
|
||||
import net.momirealms.customfishing.gui.icon.BackGroundItem;
|
||||
import net.momirealms.customfishing.util.ConfigUtils;
|
||||
@@ -28,18 +29,18 @@ import java.util.*;
|
||||
public class NBTEditor {
|
||||
|
||||
private final Player player;
|
||||
private final YamlPage parentPage;
|
||||
private final SectionPage parentPage;
|
||||
private ConfigurationSection nbtSection;
|
||||
private ConfigurationSection currentSection;
|
||||
private String value;
|
||||
private String currentNode;
|
||||
|
||||
public NBTEditor(Player player, YamlPage parentPage, ConfigurationSection section) {
|
||||
public NBTEditor(Player player, SectionPage parentPage) {
|
||||
this.player = player;
|
||||
this.parentPage = parentPage;
|
||||
this.nbtSection = section.getConfigurationSection("nbt");
|
||||
this.nbtSection = parentPage.getSection().getConfigurationSection("nbt");
|
||||
if (this.nbtSection == null)
|
||||
this.nbtSection = section.createSection("nbt");
|
||||
this.nbtSection = parentPage.getSection().createSection("nbt");
|
||||
this.currentSection = nbtSection;
|
||||
this.currentNode = "";
|
||||
reOpenMain();
|
||||
|
||||
@@ -2,6 +2,7 @@ package net.momirealms.customfishing.gui.page.property;
|
||||
|
||||
import net.momirealms.customfishing.adventure.AdventureManagerImpl;
|
||||
import net.momirealms.customfishing.adventure.component.ShadedAdventureComponentWrapper;
|
||||
import net.momirealms.customfishing.gui.SectionPage;
|
||||
import net.momirealms.customfishing.gui.YamlPage;
|
||||
import net.momirealms.customfishing.gui.icon.BackGroundItem;
|
||||
import org.bukkit.Material;
|
||||
@@ -22,15 +23,13 @@ import xyz.xenondevs.invui.window.AnvilWindow;
|
||||
|
||||
public class NickEditor {
|
||||
|
||||
private final Player player;
|
||||
private final YamlPage parentPage;
|
||||
private final SectionPage parentPage;
|
||||
private String nick;
|
||||
private final ConfigurationSection section;
|
||||
|
||||
public NickEditor(Player player, YamlPage parentPage, ConfigurationSection section) {
|
||||
this.player = player;
|
||||
public NickEditor(Player player, SectionPage parentPage) {
|
||||
this.parentPage = parentPage;
|
||||
this.section = section;
|
||||
this.section = parentPage.getSection();
|
||||
|
||||
Item border = new SimpleItem(new ItemBuilder(Material.AIR));
|
||||
var confirm = new ConfirmIcon();
|
||||
|
||||
@@ -2,6 +2,7 @@ package net.momirealms.customfishing.gui.page.property;
|
||||
|
||||
import net.momirealms.customfishing.adventure.AdventureManagerImpl;
|
||||
import net.momirealms.customfishing.adventure.component.ShadedAdventureComponentWrapper;
|
||||
import net.momirealms.customfishing.gui.SectionPage;
|
||||
import net.momirealms.customfishing.gui.YamlPage;
|
||||
import net.momirealms.customfishing.gui.icon.BackGroundItem;
|
||||
import org.bukkit.Material;
|
||||
@@ -23,15 +24,15 @@ import xyz.xenondevs.invui.window.AnvilWindow;
|
||||
public class PriceEditor {
|
||||
|
||||
private final Player player;
|
||||
private final YamlPage parentPage;
|
||||
private final SectionPage parentPage;
|
||||
private final String[] price;
|
||||
private int index;
|
||||
private final ConfigurationSection section;
|
||||
|
||||
public PriceEditor(Player player, YamlPage parentPage, ConfigurationSection section) {
|
||||
public PriceEditor(Player player, SectionPage parentPage) {
|
||||
this.player = player;
|
||||
this.parentPage = parentPage;
|
||||
this.section = section;
|
||||
this.section = parentPage.getSection();
|
||||
this.index = 0;
|
||||
this.price = new String[]{section.getString("price.base","0"), section.getString("price.bonus","0")};
|
||||
reOpen();
|
||||
|
||||
@@ -2,6 +2,7 @@ package net.momirealms.customfishing.gui.page.property;
|
||||
|
||||
import net.momirealms.customfishing.adventure.AdventureManagerImpl;
|
||||
import net.momirealms.customfishing.adventure.component.ShadedAdventureComponentWrapper;
|
||||
import net.momirealms.customfishing.gui.SectionPage;
|
||||
import net.momirealms.customfishing.gui.YamlPage;
|
||||
import net.momirealms.customfishing.gui.icon.BackGroundItem;
|
||||
import org.bukkit.Material;
|
||||
@@ -22,15 +23,13 @@ import xyz.xenondevs.invui.window.AnvilWindow;
|
||||
|
||||
public class ScoreEditor {
|
||||
|
||||
private final Player player;
|
||||
private final YamlPage parentPage;
|
||||
private final SectionPage parentPage;
|
||||
private String score;
|
||||
private final ConfigurationSection section;
|
||||
|
||||
public ScoreEditor(Player player, YamlPage parentPage, ConfigurationSection section) {
|
||||
this.player = player;
|
||||
public ScoreEditor(Player player, SectionPage parentPage) {
|
||||
this.parentPage = parentPage;
|
||||
this.section = section;
|
||||
this.section = parentPage.getSection();
|
||||
|
||||
Item border = new SimpleItem(new ItemBuilder(Material.AIR));
|
||||
var confirm = new ConfirmIcon();
|
||||
|
||||
@@ -2,6 +2,7 @@ package net.momirealms.customfishing.gui.page.property;
|
||||
|
||||
import net.momirealms.customfishing.adventure.AdventureManagerImpl;
|
||||
import net.momirealms.customfishing.adventure.component.ShadedAdventureComponentWrapper;
|
||||
import net.momirealms.customfishing.gui.SectionPage;
|
||||
import net.momirealms.customfishing.gui.YamlPage;
|
||||
import net.momirealms.customfishing.gui.icon.BackGroundItem;
|
||||
import org.bukkit.Material;
|
||||
@@ -23,15 +24,15 @@ import xyz.xenondevs.invui.window.AnvilWindow;
|
||||
public class SizeEditor {
|
||||
|
||||
private final Player player;
|
||||
private final YamlPage parentPage;
|
||||
private final SectionPage parentPage;
|
||||
private final String[] size;
|
||||
private int index;
|
||||
private final ConfigurationSection section;
|
||||
|
||||
public SizeEditor(Player player, YamlPage parentPage, ConfigurationSection section) {
|
||||
public SizeEditor(Player player, SectionPage parentPage) {
|
||||
this.player = player;
|
||||
this.parentPage = parentPage;
|
||||
this.section = section;
|
||||
this.section = parentPage.getSection();
|
||||
this.index = 0;
|
||||
this.size = section.contains("size") ? section.getString("size").split("~") : new String[]{"0","0"};
|
||||
reOpen();
|
||||
|
||||
@@ -59,6 +59,7 @@ import org.bukkit.event.player.PlayerAttemptPickupItemEvent;
|
||||
import org.bukkit.event.player.PlayerInteractEvent;
|
||||
import org.bukkit.event.player.PlayerItemConsumeEvent;
|
||||
import org.bukkit.event.player.PlayerItemMendEvent;
|
||||
import org.bukkit.inventory.EquipmentSlot;
|
||||
import org.bukkit.inventory.ItemFlag;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.inventory.meta.Damageable;
|
||||
@@ -857,12 +858,13 @@ public class ItemManagerImpl implements ItemManager, Listener {
|
||||
public void onInteractWithUtils(PlayerInteractEvent event) {
|
||||
if (event.useItemInHand() == Event.Result.DENY)
|
||||
return;
|
||||
if (event.getHand() != EquipmentSlot.HAND)
|
||||
return;
|
||||
ItemStack itemStack = event.getPlayer().getInventory().getItemInMainHand();
|
||||
if (itemStack.getType() == Material.AIR)
|
||||
return;
|
||||
if (event.getAction() != org.bukkit.event.block.Action.RIGHT_CLICK_AIR || event.getAction() != org.bukkit.event.block.Action.RIGHT_CLICK_BLOCK)
|
||||
if (event.getAction() != org.bukkit.event.block.Action.RIGHT_CLICK_AIR && event.getAction() != org.bukkit.event.block.Action.RIGHT_CLICK_BLOCK)
|
||||
return;
|
||||
|
||||
String id = getAnyPluginItemID(itemStack);
|
||||
EffectCarrier carrier = plugin.getEffectManager().getEffectCarrier("util", id);
|
||||
if (carrier == null)
|
||||
|
||||
@@ -19,7 +19,7 @@ package net.momirealms.customfishing.mechanic.misc;
|
||||
|
||||
import net.momirealms.customfishing.api.CustomFishingPlugin;
|
||||
import net.momirealms.customfishing.api.common.Pair;
|
||||
import net.momirealms.customfishing.gui.ItemPage;
|
||||
import net.momirealms.customfishing.gui.SectionPage;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
@@ -34,7 +34,7 @@ import java.util.concurrent.ConcurrentHashMap;
|
||||
public class ChatCatcherManager implements Listener {
|
||||
|
||||
private final CustomFishingPlugin plugin;
|
||||
private final ConcurrentHashMap<UUID, Pair<String, ItemPage>> pageMap;
|
||||
private final ConcurrentHashMap<UUID, Pair<String, SectionPage>> pageMap;
|
||||
|
||||
public ChatCatcherManager(CustomFishingPlugin plugin) {
|
||||
this.pageMap = new ConcurrentHashMap<>();
|
||||
@@ -54,7 +54,7 @@ public class ChatCatcherManager implements Listener {
|
||||
unload();
|
||||
}
|
||||
|
||||
public void catchMessage(Player player, String key, ItemPage page) {
|
||||
public void catchMessage(Player player, String key, SectionPage page) {
|
||||
this.pageMap.put(player.getUniqueId(), Pair.of(key, page));
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user