feat(global): rename, restructure

in prepartion for the I18N of the GUI.
This commit is contained in:
ineanto 2023-07-03 18:20:42 +02:00
parent 48257e2028
commit 4abcf7647f
55 changed files with 218 additions and 208 deletions

View file

@ -11,8 +11,7 @@ import xyz.atnrch.nicko.config.Configuration;
import xyz.atnrch.nicko.config.ConfigurationManager;
import xyz.atnrch.nicko.event.PlayerJoinListener;
import xyz.atnrch.nicko.event.PlayerQuitListener;
import xyz.atnrch.nicko.gui.items.common.OptionUnavailable;
import xyz.atnrch.nicko.gui.items.main.ExitGUI;
import xyz.atnrch.nicko.gui.items.common.UnavailableItem;
import xyz.atnrch.nicko.i18n.Locale;
import xyz.atnrch.nicko.i18n.LocaleFileManager;
import xyz.atnrch.nicko.mojang.MojangAPI;
@ -38,7 +37,9 @@ public class NickoBukkit extends JavaPlugin {
private LocaleFileManager localeFileManager;
private PlayerNameStore nameStore;
public NickoBukkit() { this.unitTesting = false; }
public NickoBukkit() {
this.unitTesting = false;
}
/**
* Used by MockBukkit
@ -96,8 +97,7 @@ public class NickoBukkit extends JavaPlugin {
Structure.addGlobalIngredient('#', new SimpleItem(new ItemBuilder(Material.AIR)));
Structure.addGlobalIngredient('%', new SimpleItem(new ItemBuilder(Material.BLACK_STAINED_GLASS_PANE).setDisplayName(" ")));
Structure.addGlobalIngredient('U', new OptionUnavailable());
Structure.addGlobalIngredient('E', new ExitGUI());
Structure.addGlobalIngredient('U', new UnavailableItem());
if (Bukkit.getPluginManager().getPlugin("PlaceholderAPI") != null) {
getLogger().info("Enabling PlaceHolderAPI support...");
@ -106,9 +106,9 @@ public class NickoBukkit extends JavaPlugin {
getServer().getPluginManager().registerEvents(new PlayerJoinListener(), this);
getServer().getPluginManager().registerEvents(new PlayerQuitListener(), this);
getLogger().info("Nicko (Bukkit) has been enabled.");
}
getLogger().info("Nicko (Bukkit) has been enabled.");
}
@Override

View file

@ -1,8 +1,8 @@
package xyz.atnrch.nicko.anvil;
import xyz.atnrch.nicko.NickoBukkit;
import xyz.atnrch.nicko.disguise.AppearanceManager;
import xyz.atnrch.nicko.disguise.ActionResult;
import xyz.atnrch.nicko.appearance.AppearanceManager;
import xyz.atnrch.nicko.appearance.ActionResult;
import xyz.atnrch.nicko.i18n.I18N;
import xyz.atnrch.nicko.i18n.I18NDict;
import xyz.atnrch.nicko.mojang.MojangUtils;
@ -99,10 +99,10 @@ public class AnvilManager {
private List<AnvilGUI.ResponseAction> sendResultAndClose(ActionResult actionResult) {
final I18N i18n = new I18N(player);
if (!actionResult.isError()) {
player.sendMessage(i18n.translate(I18NDict.Event.Disguise.SUCCESS));
player.sendMessage(i18n.translate(I18NDict.Event.Appearance.Set.OK));
} else {
// TODO (Ineanto, 6/28/23): Check weirdness with error message not being translated sometimes
player.sendMessage(i18n.translate(I18NDict.Event.Disguise.FAIL, i18n.translateWithoutPrefix(actionResult.getErrorKey())));
player.sendMessage(i18n.translate(I18NDict.Event.Appearance.Set.ERROR, i18n.translateWithoutPrefix(actionResult.getErrorKey())));
}
return Collections.singletonList(AnvilGUI.ResponseAction.close());
}

View file

@ -1,4 +1,4 @@
package xyz.atnrch.nicko.disguise;
package xyz.atnrch.nicko.appearance;
public class ActionResult {
private final String errorKey;

View file

@ -1,4 +1,4 @@
package xyz.atnrch.nicko.disguise;
package xyz.atnrch.nicko.appearance;
import com.comphenix.protocol.utility.MinecraftVersion;
import com.comphenix.protocol.wrappers.*;

View file

@ -1,4 +1,4 @@
package xyz.atnrch.nicko.disguise;
package xyz.atnrch.nicko.appearance;
import xyz.atnrch.nicko.i18n.Locale;

View file

@ -3,7 +3,7 @@ package xyz.atnrch.nicko.command;
import xyz.atnrch.nicko.NickoBukkit;
import xyz.atnrch.nicko.command.sub.NickoCheckSubCmd;
import xyz.atnrch.nicko.command.sub.NickoDebugSubCmd;
import xyz.atnrch.nicko.gui.MainGUI;
import xyz.atnrch.nicko.gui.HomeGUI;
import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;
@ -33,7 +33,7 @@ public class NickoCommand implements CommandExecutor {
return false;
}
new MainGUI(player).open();
new HomeGUI(player).open();
return false;
}

View file

@ -1,7 +1,7 @@
package xyz.atnrch.nicko.command.sub;
import xyz.atnrch.nicko.NickoBukkit;
import xyz.atnrch.nicko.disguise.AppearanceManager;
import xyz.atnrch.nicko.appearance.AppearanceManager;
import xyz.atnrch.nicko.i18n.I18N;
import xyz.atnrch.nicko.i18n.I18NDict;
import xyz.atnrch.nicko.mojang.MojangUtils;

View file

@ -1,8 +1,8 @@
package xyz.atnrch.nicko.command.sub;
import xyz.atnrch.nicko.NickoBukkit;
import xyz.atnrch.nicko.disguise.ActionResult;
import xyz.atnrch.nicko.disguise.AppearanceManager;
import xyz.atnrch.nicko.appearance.ActionResult;
import xyz.atnrch.nicko.appearance.AppearanceManager;
import xyz.atnrch.nicko.i18n.I18N;
import xyz.atnrch.nicko.mojang.MojangUtils;
import org.bukkit.Bukkit;

View file

@ -6,8 +6,8 @@ import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.player.PlayerJoinEvent;
import xyz.atnrch.nicko.NickoBukkit;
import xyz.atnrch.nicko.disguise.ActionResult;
import xyz.atnrch.nicko.disguise.AppearanceManager;
import xyz.atnrch.nicko.appearance.ActionResult;
import xyz.atnrch.nicko.appearance.AppearanceManager;
import xyz.atnrch.nicko.i18n.I18N;
import xyz.atnrch.nicko.i18n.I18NDict;
import xyz.atnrch.nicko.storage.name.PlayerNameStore;
@ -27,9 +27,9 @@ public class PlayerJoinListener implements Listener {
if (appearanceManager.hasData()) {
final ActionResult actionResult = appearanceManager.updatePlayer(appearanceManager.needsASkinChange(), false);
if (!actionResult.isError()) {
player.sendMessage(i18n.translate(I18NDict.Event.PreviousSkin.SUCCESS));
player.sendMessage(i18n.translate(I18NDict.Event.Appearance.Restore.OK));
} else {
player.sendMessage(i18n.translate(I18NDict.Event.PreviousSkin.FAIL, i18n.translateWithoutPrefix(actionResult.getErrorKey())));
player.sendMessage(i18n.translate(I18NDict.Event.Appearance.Restore.ERROR, i18n.translateWithoutPrefix(actionResult.getErrorKey())));
}
}
}, 20L);

View file

@ -1,7 +1,7 @@
package xyz.atnrch.nicko.event;
import xyz.atnrch.nicko.NickoBukkit;
import xyz.atnrch.nicko.disguise.ActionResult;
import xyz.atnrch.nicko.appearance.ActionResult;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;

View file

@ -1,7 +1,7 @@
package xyz.atnrch.nicko.gui;
import xyz.atnrch.nicko.gui.items.admin.ManageCache;
import xyz.atnrch.nicko.gui.items.common.GoBack;
import xyz.atnrch.nicko.gui.items.admin.ManageCacheItem;
import xyz.atnrch.nicko.gui.items.common.GoBackItem;
import org.bukkit.entity.Player;
import xyz.xenondevs.invui.gui.Gui;
import xyz.xenondevs.invui.window.Window;
@ -12,15 +12,15 @@ public class AdminGUI {
private final Gui gui;
public AdminGUI(Player player) {
final MainGUI parent = new MainGUI(player);
final HomeGUI parent = new HomeGUI(player);
this.gui = Gui.normal()
.setStructure(
"# # # # # # # # #",
"# # # S U U # # #",
"B # # # # # # # #"
)
.addIngredient('S', new ManageCache())
.addIngredient('B', new GoBack(parent.getGUI(), parent.getTitle()))
.addIngredient('S', new ManageCacheItem())
.addIngredient('B', new GoBackItem(parent.getGUI(), parent.getTitle()))
.build();
this.player = player;
}

View file

@ -1,16 +1,15 @@
package xyz.atnrch.nicko.gui.admin.cache;
package xyz.atnrch.nicko.gui;
import xyz.atnrch.nicko.gui.items.common.GoBack;
import xyz.atnrch.nicko.gui.items.common.ScrollUp;
import xyz.atnrch.nicko.gui.items.common.GoBackItem;
import xyz.atnrch.nicko.gui.items.common.ScrollUpItem;
import xyz.atnrch.nicko.mojang.MojangSkin;
import xyz.xenondevs.invui.gui.Gui;
import xyz.xenondevs.invui.gui.ScrollGui;
import xyz.xenondevs.invui.gui.structure.Markers;
import xyz.xenondevs.invui.item.Item;
import xyz.atnrch.nicko.NickoBukkit;
import xyz.atnrch.nicko.gui.items.admin.cache.CacheEntry;
import xyz.atnrch.nicko.gui.admin.CacheManagementGUI;
import xyz.atnrch.nicko.gui.items.common.ScrollDown;
import xyz.atnrch.nicko.gui.items.admin.cache.CacheEntryItem;
import xyz.atnrch.nicko.gui.items.common.ScrollDownItem;
import org.bukkit.entity.Player;
import xyz.xenondevs.invui.window.Window;
@ -34,7 +33,7 @@ public class CacheDetailedGUI {
.collect(Collectors.toList());
final List<Item> items = loadedSkins.stream()
.map(CacheEntry::new)
.map(CacheEntryItem::new)
.collect(Collectors.toList());
final CacheManagementGUI parent = new CacheManagementGUI(player);
@ -47,9 +46,9 @@ public class CacheDetailedGUI {
"x x x x x x x x D",
"B % % % % % % % %");
guiItemBuilder.addIngredient('x', Markers.CONTENT_LIST_SLOT_HORIZONTAL);
guiItemBuilder.addIngredient('U', new ScrollUp());
guiItemBuilder.addIngredient('D', new ScrollDown());
guiItemBuilder.addIngredient('B', new GoBack(parent.getGUI(), parent.getTitle()));
guiItemBuilder.addIngredient('U', new ScrollUpItem());
guiItemBuilder.addIngredient('D', new ScrollDownItem());
guiItemBuilder.addIngredient('B', new GoBackItem(parent.getGUI(), parent.getTitle()));
guiItemBuilder.setContent(items);
});

View file

@ -1,11 +1,10 @@
package xyz.atnrch.nicko.gui.admin;
package xyz.atnrch.nicko.gui;
import xyz.atnrch.nicko.gui.AdminGUI;
import xyz.atnrch.nicko.gui.items.admin.cache.InvalidateSpecificEntry;
import xyz.atnrch.nicko.gui.items.admin.cache.InvalidateCompleteCache;
import xyz.atnrch.nicko.gui.items.admin.cache.CacheOverview;
import xyz.atnrch.nicko.gui.items.common.GoBack;
import org.bukkit.entity.Player;
import xyz.atnrch.nicko.gui.items.admin.cache.CacheOverviewItem;
import xyz.atnrch.nicko.gui.items.admin.cache.InvalidateCacheItem;
import xyz.atnrch.nicko.gui.items.admin.cache.InvalidateEntryItem;
import xyz.atnrch.nicko.gui.items.common.GoBackItem;
import xyz.xenondevs.invui.gui.Gui;
import xyz.xenondevs.invui.window.Window;
@ -22,10 +21,10 @@ public class CacheManagementGUI {
"# # # S A D # # #",
"B # # # # # # # #"
)
.addIngredient('B', new GoBack(parent.getGUI(), parent.getTitle()))
.addIngredient('S', new CacheOverview())
.addIngredient('A', new InvalidateCompleteCache())
.addIngredient('D', new InvalidateSpecificEntry())
.addIngredient('B', new GoBackItem(parent.getGUI(), parent.getTitle()))
.addIngredient('S', new CacheOverviewItem())
.addIngredient('A', new InvalidateCacheItem())
.addIngredient('D', new InvalidateEntryItem())
.build();
this.player = player;
}

View file

@ -2,9 +2,9 @@ package xyz.atnrch.nicko.gui;
import org.bukkit.Material;
import org.bukkit.entity.Player;
import xyz.atnrch.nicko.gui.items.confirm.ActionCallback;
import xyz.atnrch.nicko.gui.items.confirm.Cancel;
import xyz.atnrch.nicko.gui.items.confirm.Confirm;
import xyz.atnrch.nicko.gui.items.common.confirm.ChoiceCallback;
import xyz.atnrch.nicko.gui.items.common.confirm.CancelItem;
import xyz.atnrch.nicko.gui.items.common.confirm.ConfirmItem;
import xyz.xenondevs.invui.gui.Gui;
import xyz.xenondevs.invui.item.builder.ItemBuilder;
import xyz.xenondevs.invui.item.impl.SimpleItem;
@ -14,15 +14,15 @@ public class ConfirmGUI {
private final Player player;
private final Gui gui;
public ConfirmGUI(Player player, ActionCallback callback) {
public ConfirmGUI(Player player, ChoiceCallback callback) {
this.gui = Gui.normal()
.setStructure(
"@ @ @ @ % & & & &",
"@ @ @ @ I & & & &",
"@ @ @ @ % & & & &"
)
.addIngredient('@', new Confirm(callback))
.addIngredient('&', new Cancel(callback))
.addIngredient('@', new ConfirmItem(callback))
.addIngredient('&', new CancelItem(callback))
.addIngredient('I', new SimpleItem(new ItemBuilder(Material.PAPER).setDisplayName("§6Select an option").get()))
.build();
this.player = player;

View file

@ -1,21 +1,22 @@
package xyz.atnrch.nicko.gui;
import xyz.atnrch.nicko.gui.items.main.AdminSubGUI;
import xyz.atnrch.nicko.gui.items.main.ResetAppearance;
import xyz.atnrch.nicko.gui.items.main.SettingsSubGUI;
import xyz.atnrch.nicko.gui.items.skin.ChangeName;
import xyz.atnrch.nicko.gui.items.skin.ChangeNameAndSkin;
import xyz.atnrch.nicko.gui.items.skin.ChangeSkin;
import org.bukkit.entity.Player;
import xyz.atnrch.nicko.gui.items.appearance.ChangeBothItem;
import xyz.atnrch.nicko.gui.items.appearance.ChangeNameItem;
import xyz.atnrch.nicko.gui.items.appearance.ChangeSkinItem;
import xyz.atnrch.nicko.gui.items.home.AdminAccessItem;
import xyz.atnrch.nicko.gui.items.home.ExitItem;
import xyz.atnrch.nicko.gui.items.home.ResetItem;
import xyz.atnrch.nicko.gui.items.home.SettingsAccessItem;
import xyz.xenondevs.invui.gui.Gui;
import xyz.xenondevs.invui.window.Window;
public class MainGUI {
public class HomeGUI {
private final String title = "Nicko - Home";
private final Player player;
private final Gui gui;
public MainGUI(Player player) {
public HomeGUI(Player player) {
final String[] dynamicStructure = new String[]{
"# # # # # # # # #",
"A # # N B S # # #",
@ -27,12 +28,13 @@ public class MainGUI {
this.gui = Gui.normal()
.setStructure(dynamicStructure)
.addIngredient('R', new ResetAppearance())
.addIngredient('N', new ChangeName())
.addIngredient('B', new ChangeNameAndSkin())
.addIngredient('S', new ChangeSkin(player))
.addIngredient('P', new SettingsSubGUI())
.addIngredient('A', new AdminSubGUI())
.addIngredient('E', new ExitItem())
.addIngredient('R', new ResetItem())
.addIngredient('N', new ChangeNameItem())
.addIngredient('B', new ChangeBothItem())
.addIngredient('S', new ChangeSkinItem(player))
.addIngredient('P', new SettingsAccessItem())
.addIngredient('A', new AdminAccessItem())
.build();
this.player = player;
}

View file

@ -1,8 +1,8 @@
package xyz.atnrch.nicko.gui;
import xyz.atnrch.nicko.gui.items.common.GoBack;
import xyz.atnrch.nicko.gui.items.settings.BungeeCordCycling;
import xyz.atnrch.nicko.gui.items.settings.LanguageCycling;
import xyz.atnrch.nicko.gui.items.common.GoBackItem;
import xyz.atnrch.nicko.gui.items.settings.BungeeCordCyclingItem;
import xyz.atnrch.nicko.gui.items.settings.LanguageCyclingItem;
import org.bukkit.entity.Player;
import xyz.xenondevs.invui.gui.Gui;
import xyz.xenondevs.invui.window.Window;
@ -23,12 +23,12 @@ public class SettingsGUI {
// TODO: 3/6/23 Replace when Redis is not enabled
dynamicStructure[1] = dynamicStructure[1].replace("T", "U");
final MainGUI parent = new MainGUI(player);
final HomeGUI parent = new HomeGUI(player);
this.gui = Gui.normal()
.setStructure(dynamicStructure)
.addIngredient('B', new GoBack(parent.getGUI(), parent.getTitle()))
.addIngredient('L', new LanguageCycling().get(player))
.addIngredient('T', new BungeeCordCycling().get(player))
.addIngredient('B', new GoBackItem(parent.getGUI(), parent.getTitle()))
.addIngredient('L', new LanguageCyclingItem().get(player))
.addIngredient('T', new BungeeCordCyclingItem().get(player))
.build();
this.player = player;
}

View file

@ -3,15 +3,15 @@ package xyz.atnrch.nicko.gui.items.admin;
import xyz.xenondevs.invui.item.builder.ItemBuilder;
import xyz.xenondevs.invui.item.builder.SkullBuilder;
import xyz.xenondevs.invui.item.impl.AsyncItem;
import xyz.atnrch.nicko.gui.admin.CacheManagementGUI;
import xyz.atnrch.nicko.gui.CacheManagementGUI;
import org.bukkit.Material;
import org.bukkit.entity.Player;
import org.bukkit.event.inventory.ClickType;
import org.bukkit.event.inventory.InventoryClickEvent;
import org.jetbrains.annotations.NotNull;
public class ManageCache extends AsyncItem {
public ManageCache() {
public class ManageCacheItem extends AsyncItem {
public ManageCacheItem() {
super(new ItemBuilder(Material.PAINTING)
.setDisplayName("§fManage §6skin §fcache...")
.addLoreLines("§7Access the skin cache management panel."),

View file

@ -7,8 +7,8 @@ import org.bukkit.event.inventory.InventoryClickEvent;
import org.jetbrains.annotations.NotNull;
import xyz.atnrch.nicko.NickoBukkit;
import xyz.atnrch.nicko.gui.ConfirmGUI;
import xyz.atnrch.nicko.gui.admin.cache.CacheDetailedGUI;
import xyz.atnrch.nicko.gui.items.confirm.ActionCallback;
import xyz.atnrch.nicko.gui.CacheDetailedGUI;
import xyz.atnrch.nicko.gui.items.common.confirm.ChoiceCallback;
import xyz.atnrch.nicko.mojang.MojangAPI;
import xyz.xenondevs.invui.item.builder.ItemBuilder;
import xyz.xenondevs.invui.item.builder.SkullBuilder;
@ -16,12 +16,12 @@ import xyz.xenondevs.invui.item.impl.AsyncItem;
import java.util.UUID;
public class CacheEntry extends AsyncItem {
public class CacheEntryItem extends AsyncItem {
private final String name;
private final String uuid;
private final MojangAPI mojangAPI = NickoBukkit.getInstance().getMojangAPI();
public CacheEntry(String uuid) {
public CacheEntryItem(String uuid) {
super(new ItemBuilder(Material.PAINTING).setDisplayName("§7§oLoading..."), () -> {
final String dashedUuid = uuid.replaceAll("(.{8})(.{4})(.{4})(.{4})(.+)", "$1-$2-$3-$4-$5");
final UUID uuidObject = UUID.fromString(dashedUuid);
@ -38,7 +38,7 @@ public class CacheEntry extends AsyncItem {
public void handleClick(@NotNull ClickType click, @NotNull Player player, @NotNull InventoryClickEvent event) {
if (click.isLeftClick() || click.isRightClick()) {
event.getView().close();
new ConfirmGUI(player, new ActionCallback() {
new ConfirmGUI(player, new ChoiceCallback() {
@Override
public void onConfirm() {
mojangAPI.eraseFromCache(uuid);

View file

@ -10,8 +10,8 @@ import xyz.xenondevs.invui.item.impl.SuppliedItem;
import java.util.Optional;
public class CacheOverview extends SuppliedItem {
public CacheOverview() {
public class CacheOverviewItem extends SuppliedItem {
public CacheOverviewItem() {
super(() -> {
final ItemBuilder builder = new ItemBuilder(Material.OAK_SIGN);
final LoadingCache<String, Optional<MojangSkin>> cache = NickoBukkit.getInstance().getMojangAPI().getCache();

View file

@ -9,8 +9,8 @@ import org.bukkit.event.inventory.ClickType;
import xyz.xenondevs.invui.item.builder.ItemBuilder;
import xyz.xenondevs.invui.item.impl.SuppliedItem;
public class InvalidateCompleteCache extends SuppliedItem {
public InvalidateCompleteCache() {
public class InvalidateCacheItem extends SuppliedItem {
public InvalidateCacheItem() {
super(() -> {
final ItemBuilder builder = new ItemBuilder(Material.TNT);
builder.setDisplayName("§fInvalidate §6skin cache");

View file

@ -1,13 +1,13 @@
package xyz.atnrch.nicko.gui.items.admin.cache;
import xyz.atnrch.nicko.gui.admin.cache.CacheDetailedGUI;
import xyz.atnrch.nicko.gui.CacheDetailedGUI;
import org.bukkit.Material;
import org.bukkit.event.inventory.ClickType;
import xyz.xenondevs.invui.item.builder.ItemBuilder;
import xyz.xenondevs.invui.item.impl.SuppliedItem;
public class InvalidateSpecificEntry extends SuppliedItem {
public InvalidateSpecificEntry() {
public class InvalidateEntryItem extends SuppliedItem {
public InvalidateEntryItem() {
super(() -> {
final ItemBuilder builder = new ItemBuilder(Material.PAPER);
builder.setDisplayName("§6Invalidate specific skin...");

View file

@ -1,4 +1,4 @@
package xyz.atnrch.nicko.gui.items.skin;
package xyz.atnrch.nicko.gui.items.appearance;
import xyz.atnrch.nicko.anvil.AnvilManager;
import org.bukkit.Material;
@ -6,8 +6,8 @@ import org.bukkit.event.inventory.ClickType;
import xyz.xenondevs.invui.item.builder.ItemBuilder;
import xyz.xenondevs.invui.item.impl.SuppliedItem;
public class ChangeNameAndSkin extends SuppliedItem {
public ChangeNameAndSkin() {
public class ChangeBothItem extends SuppliedItem {
public ChangeBothItem() {
super(() -> {
final ItemBuilder builder = new ItemBuilder(Material.END_PORTAL_FRAME);
builder.setDisplayName("§6Skin §fand §6name §fchange");

View file

@ -1,4 +1,4 @@
package xyz.atnrch.nicko.gui.items.skin;
package xyz.atnrch.nicko.gui.items.appearance;
import xyz.atnrch.nicko.anvil.AnvilManager;
import org.bukkit.Material;
@ -6,8 +6,8 @@ import org.bukkit.event.inventory.ClickType;
import xyz.xenondevs.invui.item.builder.ItemBuilder;
import xyz.xenondevs.invui.item.impl.SuppliedItem;
public class ChangeName extends SuppliedItem {
public ChangeName() {
public class ChangeNameItem extends SuppliedItem {
public ChangeNameItem() {
super(() -> {
final ItemBuilder builder = new ItemBuilder(Material.NAME_TAG);
builder.setDisplayName("§fChange §6name");

View file

@ -1,4 +1,4 @@
package xyz.atnrch.nicko.gui.items.skin;
package xyz.atnrch.nicko.gui.items.appearance;
import xyz.atnrch.nicko.anvil.AnvilManager;
import org.bukkit.entity.Player;
@ -6,8 +6,8 @@ import org.bukkit.event.inventory.ClickType;
import xyz.xenondevs.invui.item.builder.SkullBuilder;
import xyz.xenondevs.invui.item.impl.SuppliedItem;
public class ChangeSkin extends SuppliedItem {
public ChangeSkin(Player player) {
public class ChangeSkinItem extends SuppliedItem {
public ChangeSkinItem(Player player) {
super(() -> {
final SkullBuilder builder = new SkullBuilder(player.getName());
builder.setDisplayName("§fChange §6skin");

View file

@ -6,8 +6,8 @@ import xyz.xenondevs.invui.item.builder.ItemBuilder;
import xyz.xenondevs.invui.item.impl.SuppliedItem;
import xyz.xenondevs.invui.window.Window;
public class GoBack extends SuppliedItem {
public GoBack(Gui gui, String parentTitle) {
public class GoBackItem extends SuppliedItem {
public GoBackItem(Gui gui, String parentTitle) {
super(() -> {
final ItemBuilder builder = new ItemBuilder(Material.ARROW);
builder.setDisplayName("Go back");

View file

@ -6,9 +6,9 @@ import xyz.xenondevs.invui.item.ItemProvider;
import xyz.xenondevs.invui.item.builder.ItemBuilder;
import xyz.xenondevs.invui.item.impl.controlitem.ScrollItem;
public class ScrollDown extends ScrollItem {
public class ScrollDownItem extends ScrollItem {
public ScrollDown() {
public ScrollDownItem() {
super(1);
}

View file

@ -6,9 +6,9 @@ import xyz.xenondevs.invui.item.ItemProvider;
import xyz.xenondevs.invui.item.builder.ItemBuilder;
import xyz.xenondevs.invui.item.impl.controlitem.ScrollItem;
public class ScrollUp extends ScrollItem {
public class ScrollUpItem extends ScrollItem {
public ScrollUp() {
public ScrollUpItem() {
super(-1);
}

View file

@ -4,8 +4,8 @@ import org.bukkit.Material;
import xyz.xenondevs.invui.item.builder.ItemBuilder;
import xyz.xenondevs.invui.item.impl.SuppliedItem;
public class OptionUnavailable extends SuppliedItem {
public OptionUnavailable() {
public class UnavailableItem extends SuppliedItem {
public UnavailableItem() {
super(() -> {
final ItemBuilder builder = new ItemBuilder(Material.RED_TERRACOTTA);
builder.setDisplayName("§cFeature unavailable :(");

View file

@ -1,11 +1,11 @@
package xyz.atnrch.nicko.gui.items.confirm;
package xyz.atnrch.nicko.gui.items.common.confirm;
import org.bukkit.Material;
import xyz.xenondevs.invui.item.builder.ItemBuilder;
import xyz.xenondevs.invui.item.impl.SuppliedItem;
public class Cancel extends SuppliedItem {
public Cancel(ActionCallback callback) {
public class CancelItem extends SuppliedItem {
public CancelItem(ChoiceCallback callback) {
super(() -> {
final ItemBuilder builder = new ItemBuilder(Material.RED_STAINED_GLASS_PANE);
builder.setDisplayName("§cCancel");

View file

@ -0,0 +1,7 @@
package xyz.atnrch.nicko.gui.items.common.confirm;
public interface ChoiceCallback {
void onConfirm();
void onCancel();
}

View file

@ -1,11 +1,11 @@
package xyz.atnrch.nicko.gui.items.confirm;
package xyz.atnrch.nicko.gui.items.common.confirm;
import org.bukkit.Material;
import xyz.xenondevs.invui.item.builder.ItemBuilder;
import xyz.xenondevs.invui.item.impl.SuppliedItem;
public class Confirm extends SuppliedItem {
public Confirm(ActionCallback callback) {
public class ConfirmItem extends SuppliedItem {
public ConfirmItem(ChoiceCallback callback) {
super(() -> {
final ItemBuilder builder = new ItemBuilder(Material.GREEN_STAINED_GLASS_PANE);
builder.setDisplayName("§aConfirm");

View file

@ -1,7 +0,0 @@
package xyz.atnrch.nicko.gui.items.confirm;
public interface ActionCallback {
void onConfirm();
void onCancel();
}

View file

@ -1,4 +1,4 @@
package xyz.atnrch.nicko.gui.items.main;
package xyz.atnrch.nicko.gui.items.home;
import xyz.atnrch.nicko.gui.AdminGUI;
import org.bukkit.Material;
@ -8,8 +8,8 @@ import org.bukkit.inventory.ItemFlag;
import xyz.xenondevs.invui.item.builder.ItemBuilder;
import xyz.xenondevs.invui.item.impl.SuppliedItem;
public class AdminSubGUI extends SuppliedItem {
public AdminSubGUI() {
public class AdminAccessItem extends SuppliedItem {
public AdminAccessItem() {
super(() -> {
final ItemBuilder builder = new ItemBuilder(Material.COMMAND_BLOCK);
builder.addEnchantment(Enchantment.DAMAGE_ALL, 1, false);

View file

@ -1,12 +1,12 @@
package xyz.atnrch.nicko.gui.items.main;
package xyz.atnrch.nicko.gui.items.home;
import org.bukkit.Material;
import org.bukkit.event.inventory.ClickType;
import xyz.xenondevs.invui.item.builder.ItemBuilder;
import xyz.xenondevs.invui.item.impl.SimpleItem;
public class ExitGUI extends SimpleItem {
public ExitGUI() {
public class ExitItem extends SimpleItem {
public ExitItem() {
super(new ItemBuilder(Material.OAK_DOOR).setDisplayName("§fExit"), click -> {
final ClickType clickType = click.getClickType();
if (clickType.isLeftClick() || clickType.isRightClick()) {

View file

@ -1,6 +1,6 @@
package xyz.atnrch.nicko.gui.items.main;
package xyz.atnrch.nicko.gui.items.home;
import xyz.atnrch.nicko.disguise.AppearanceManager;
import xyz.atnrch.nicko.appearance.AppearanceManager;
import xyz.atnrch.nicko.i18n.I18N;
import xyz.atnrch.nicko.i18n.I18NDict;
import org.bukkit.Material;
@ -9,8 +9,8 @@ import org.bukkit.event.inventory.ClickType;
import xyz.xenondevs.invui.item.builder.ItemBuilder;
import xyz.xenondevs.invui.item.impl.SuppliedItem;
public class ResetAppearance extends SuppliedItem {
public ResetAppearance() {
public class ResetItem extends SuppliedItem {
public ResetItem() {
super(() -> {
final ItemBuilder builder = new ItemBuilder(Material.TNT);
builder.setDisplayName("§fReset");
@ -25,16 +25,16 @@ public class ResetAppearance extends SuppliedItem {
final AppearanceManager appearanceManager = AppearanceManager.get(player);
if (!appearanceManager.hasData()) {
player.sendMessage(i18n.translate(I18NDict.Event.Undisguise.NONE));
player.sendMessage(i18n.translate(I18NDict.Event.Appearance.Remove.MISSING));
event.getEvent().getView().close();
return true;
}
if (!appearanceManager.reset().isError()) {
player.sendMessage(i18n.translate(I18NDict.Event.Undisguise.SUCCESS));
player.sendMessage(i18n.translate(I18NDict.Event.Appearance.Remove.OK));
return true;
} else {
player.sendMessage(i18n.translate(I18NDict.Event.Undisguise.FAIL));
player.sendMessage(i18n.translate(I18NDict.Event.Appearance.Remove.ERROR));
return false;
}
}

View file

@ -1,4 +1,4 @@
package xyz.atnrch.nicko.gui.items.main;
package xyz.atnrch.nicko.gui.items.home;
import xyz.atnrch.nicko.gui.SettingsGUI;
import org.bukkit.Material;
@ -6,8 +6,8 @@ import org.bukkit.event.inventory.ClickType;
import xyz.xenondevs.invui.item.builder.ItemBuilder;
import xyz.xenondevs.invui.item.impl.SuppliedItem;
public class SettingsSubGUI extends SuppliedItem {
public SettingsSubGUI() {
public class SettingsAccessItem extends SuppliedItem {
public SettingsAccessItem() {
super(() -> {
final ItemBuilder builder = new ItemBuilder(Material.COMPARATOR);
builder.setDisplayName("§fSettings...");

View file

@ -1,7 +1,7 @@
package xyz.atnrch.nicko.gui.items.settings;
import xyz.atnrch.nicko.NickoBukkit;
import xyz.atnrch.nicko.disguise.NickoProfile;
import xyz.atnrch.nicko.appearance.NickoProfile;
import org.bukkit.Material;
import org.bukkit.Sound;
import org.bukkit.entity.Player;
@ -13,7 +13,7 @@ import xyz.xenondevs.invui.item.impl.SimpleItem;
import java.util.Optional;
public class BungeeCordCycling {
public class BungeeCordCyclingItem {
private final ItemProvider[] providers = new ItemProvider[]{
getItemProviderForValue(true),
getItemProviderForValue(false)

View file

@ -1,7 +1,7 @@
package xyz.atnrch.nicko.gui.items.settings;
import xyz.atnrch.nicko.NickoBukkit;
import xyz.atnrch.nicko.disguise.NickoProfile;
import xyz.atnrch.nicko.appearance.NickoProfile;
import xyz.atnrch.nicko.i18n.Locale;
import org.bukkit.Material;
import org.bukkit.Sound;
@ -17,7 +17,7 @@ import java.util.Collections;
import java.util.List;
import java.util.Optional;
public class LanguageCycling {
public class LanguageCyclingItem {
private final ItemProvider[] providers = getItems();
public AbstractItem get(Player player) {

View file

@ -2,7 +2,7 @@ package xyz.atnrch.nicko.i18n;
import com.github.jsixface.YamlConfig;
import xyz.atnrch.nicko.NickoBukkit;
import xyz.atnrch.nicko.disguise.NickoProfile;
import xyz.atnrch.nicko.appearance.NickoProfile;
import org.bukkit.entity.Player;
import java.io.InputStream;

View file

@ -2,24 +2,38 @@ package xyz.atnrch.nicko.i18n;
public class I18NDict {
public static class Event {
public static final String EVENT_KEY = "event.";
public static class Admin {
public static final String CACHE_CLEAN = "event.admin.cache_clear";
public static final String ADMIN_KEY = "admin.";
public static final String CACHE_CLEAN = ADMIN_KEY + "cache_clear";
}
public static class Disguise {
public static final String SUCCESS = "event.disguise.success";
public static final String FAIL = "event.disguise.fail";
}
public static class Appearance {
public static final String APPEARANCE_KEY = EVENT_KEY + "appearance.";
public static class Undisguise {
public static final String SUCCESS = "event.undisguise.success";
public static final String FAIL = "event.undisguise.fail";
public static final String NONE = "event.undisguise.none";
}
public static class Set {
public static final String SET_KEY = APPEARANCE_KEY + "set.";
public static class PreviousSkin {
public static final String SUCCESS = "event.previous_skin_applied.success";
public static final String FAIL = "event.previous_skin_applied.fail";
public static final String OK = SET_KEY + "ok";
public static final String ERROR = SET_KEY + "error";
}
public static class Remove {
public static final String REMOVE_KEY = APPEARANCE_KEY + "remove.";
public static final String OK = REMOVE_KEY + "ok";
public static final String MISSING = REMOVE_KEY + "missing";
public static final String ERROR = REMOVE_KEY + "error";
}
public static class Restore {
public static final String RESTORE_KEY = APPEARANCE_KEY + "restore.";
public static final String OK = RESTORE_KEY + "success";
public static final String ERROR = RESTORE_KEY + "fail";
}
}
}

View file

@ -2,7 +2,7 @@ package xyz.atnrch.nicko.placeholder;
import me.clip.placeholderapi.expansion.PlaceholderExpansion;
import xyz.atnrch.nicko.NickoBukkit;
import xyz.atnrch.nicko.disguise.NickoProfile;
import xyz.atnrch.nicko.appearance.NickoProfile;
import org.bukkit.entity.Player;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;

View file

@ -1,7 +1,7 @@
package xyz.atnrch.nicko.storage;
import xyz.atnrch.nicko.disguise.ActionResult;
import xyz.atnrch.nicko.disguise.NickoProfile;
import xyz.atnrch.nicko.appearance.ActionResult;
import xyz.atnrch.nicko.appearance.NickoProfile;
import java.util.Optional;
import java.util.UUID;

View file

@ -2,8 +2,8 @@ package xyz.atnrch.nicko.storage;
import org.bukkit.entity.Player;
import xyz.atnrch.nicko.config.Configuration;
import xyz.atnrch.nicko.disguise.ActionResult;
import xyz.atnrch.nicko.disguise.NickoProfile;
import xyz.atnrch.nicko.appearance.ActionResult;
import xyz.atnrch.nicko.appearance.NickoProfile;
import xyz.atnrch.nicko.i18n.I18NDict;
import xyz.atnrch.nicko.mojang.MojangAPI;
import xyz.atnrch.nicko.mojang.MojangUtils;

View file

@ -1,7 +1,7 @@
package xyz.atnrch.nicko.storage;
import xyz.atnrch.nicko.disguise.ActionResult;
import xyz.atnrch.nicko.disguise.NickoProfile;
import xyz.atnrch.nicko.appearance.ActionResult;
import xyz.atnrch.nicko.appearance.NickoProfile;
import java.util.Optional;
import java.util.UUID;

View file

@ -3,8 +3,8 @@ package xyz.atnrch.nicko.storage.json;
import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
import xyz.atnrch.nicko.NickoBukkit;
import xyz.atnrch.nicko.disguise.ActionResult;
import xyz.atnrch.nicko.disguise.NickoProfile;
import xyz.atnrch.nicko.appearance.ActionResult;
import xyz.atnrch.nicko.appearance.NickoProfile;
import xyz.atnrch.nicko.i18n.I18NDict;
import xyz.atnrch.nicko.storage.Storage;
import xyz.atnrch.nicko.storage.StorageProvider;

View file

@ -1,7 +1,7 @@
package xyz.atnrch.nicko.storage.map;
import xyz.atnrch.nicko.disguise.ActionResult;
import xyz.atnrch.nicko.disguise.NickoProfile;
import xyz.atnrch.nicko.appearance.ActionResult;
import xyz.atnrch.nicko.appearance.NickoProfile;
import xyz.atnrch.nicko.storage.Cache;
import xyz.atnrch.nicko.storage.CacheProvider;

View file

@ -1,6 +1,6 @@
package xyz.atnrch.nicko.storage.map;
import xyz.atnrch.nicko.disguise.NickoProfile;
import xyz.atnrch.nicko.appearance.NickoProfile;
import xyz.atnrch.nicko.storage.CacheProvider;
import java.util.HashMap;

View file

@ -4,8 +4,8 @@ import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
import redis.clients.jedis.Jedis;
import xyz.atnrch.nicko.config.Configuration;
import xyz.atnrch.nicko.disguise.ActionResult;
import xyz.atnrch.nicko.disguise.NickoProfile;
import xyz.atnrch.nicko.appearance.ActionResult;
import xyz.atnrch.nicko.appearance.NickoProfile;
import xyz.atnrch.nicko.storage.Cache;
import xyz.atnrch.nicko.storage.CacheProvider;

View file

@ -1,8 +1,8 @@
package xyz.atnrch.nicko.storage.sql;
import xyz.atnrch.nicko.config.Configuration;
import xyz.atnrch.nicko.disguise.ActionResult;
import xyz.atnrch.nicko.disguise.NickoProfile;
import xyz.atnrch.nicko.appearance.ActionResult;
import xyz.atnrch.nicko.appearance.NickoProfile;
import xyz.atnrch.nicko.i18n.I18NDict;
import xyz.atnrch.nicko.i18n.Locale;
import xyz.atnrch.nicko.storage.Storage;

View file

@ -7,16 +7,18 @@ error:
cache: "Unable to get skin from the cache."
sql: "SQL Error"
json: "JSON Error"
event:
appearance:
set:
error: "§cUnable to apply your disguise. §7§o({0})"
ok: "§aDisguise applied!"
restore:
error: "§cUnable to apply your previous disguise back. §7§o({0})"
ok: "§aYour previous active disguise has been applied."
remove:
error: "§cUnable to remove your disguise. It will be reset on your next login."
missing: "§cYou are not under a disguise."
ok: "§aDisguise removed."
admin:
cache_clear: "§aSkin cache cleaned."
disguise:
fail: "§cUnable to apply your disguise. §7§o({0})"
success: "§aDisguise applied!"
previous_skin_applied:
fail: "§cUnable to apply your previous disguise back. §7§o({0})"
success: "§aYour previous active disguise has been applied."
undisguise:
fail: "§cUnable to remove your disguise. It will be reset on your next login."
none: "§cYou are not under a disguise."
success: "§aDisguise removed."
cache_clear: "§aSkin cache cleaned."

View file

@ -7,24 +7,18 @@ error:
cache: "Impossible de récupérer le skin depuis le cache."
sql: "Erreur SQL"
json: "Erreur JSON"
event:
admin:
cache_clear: "§aCache des skins nettoyé."
disguise:
fail: "§cImpossible d''appliquer votre déguisement. §7§o({0})"
success: "§aDéguisement appliqué !"
previous_skin_applied:
fail: "§cImpossible d''appliquer votre précédent déguisement. §7§o({0})"
success: "§aVotre précédent déguisement a été appliqué."
undisguise:
fail: "§cImpossible de retirer votre déguisement. Il sera réinitialisé à votre prochaine reconnexion."
none: "§cVous n''avez pas de déguisement."
success: "§aDéguisement retiré."
gui:
common:
exit: "Quitter"
back: "Retour"
l1_back: "Retournez à la fenêtre précédente."
not_available: "Option indisponible :("
l1_not_available: "Ce bouton est désactivé."
event:
appearance:
set:
error: "§cImpossible d''appliquer votre déguisement. §7§o({0})"
ok: "§aDéguisement appliqué !"
restore:
error: "§cImpossible d''appliquer votre précédent déguisement. §7§o({0})"
ok: "§aVotre précédent déguisement a été appliqué."
remove:
error: "§cImpossible de retirer votre déguisement. Il sera réinitialisé à votre prochaine reconnexion."
missing: "§cVous n''avez pas de déguisement."
ok: "§aDéguisement retiré."
admin:
cache_clear: "§aCache des skins nettoyé."

View file

@ -6,8 +6,8 @@ import be.seeseemelk.mockbukkit.entity.PlayerMock;
import xyz.atnrch.nicko.NickoBukkit;
import xyz.atnrch.nicko.config.Configuration;
import xyz.atnrch.nicko.config.DataSourceConfiguration;
import xyz.atnrch.nicko.disguise.ActionResult;
import xyz.atnrch.nicko.disguise.NickoProfile;
import xyz.atnrch.nicko.appearance.ActionResult;
import xyz.atnrch.nicko.appearance.NickoProfile;
import org.junit.jupiter.api.*;
import java.util.Optional;

View file

@ -7,8 +7,8 @@ import org.junit.jupiter.api.*;
import xyz.atnrch.nicko.NickoBukkit;
import xyz.atnrch.nicko.config.Configuration;
import xyz.atnrch.nicko.config.DataSourceConfiguration;
import xyz.atnrch.nicko.disguise.ActionResult;
import xyz.atnrch.nicko.disguise.NickoProfile;
import xyz.atnrch.nicko.appearance.ActionResult;
import xyz.atnrch.nicko.appearance.NickoProfile;
import xyz.atnrch.nicko.i18n.Locale;
import java.util.Optional;

View file

@ -6,7 +6,7 @@ import be.seeseemelk.mockbukkit.entity.PlayerMock;
import xyz.atnrch.nicko.NickoBukkit;
import xyz.atnrch.nicko.config.Configuration;
import xyz.atnrch.nicko.config.DataSourceConfiguration;
import xyz.atnrch.nicko.disguise.NickoProfile;
import xyz.atnrch.nicko.appearance.NickoProfile;
import org.junit.jupiter.api.AfterAll;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.DisplayName;

View file

@ -10,7 +10,7 @@ import org.junit.jupiter.api.Test;
import xyz.atnrch.nicko.NickoBukkit;
import xyz.atnrch.nicko.config.Configuration;
import xyz.atnrch.nicko.config.DataSourceConfiguration;
import xyz.atnrch.nicko.disguise.NickoProfile;
import xyz.atnrch.nicko.appearance.NickoProfile;
import java.util.Optional;