diff --git a/pom.xml b/pom.xml index dba5ce5d..6d8bb505 100644 --- a/pom.xml +++ b/pom.xml @@ -46,6 +46,14 @@ org.apache.commons:commons-collections4 org.slf4j:slf4j-api org.jetbrains:annotations + com.neovisionaries:nv-websocket-client + com.squareup.okhttp3:okhttp + com.squareup.okio:okio + com.squareup.okio:okio-jvm + net.sf.trove4j:core + com.fasterxml.jackson.core:jackson-core + com.fasterxml.jackson.core:jackson-annotations + com.jeff-media:custom-block-data diff --git a/src/main/java/net/skullian/torrent/skyfactions/SkyFactionsReborn.java b/src/main/java/net/skullian/torrent/skyfactions/SkyFactionsReborn.java index c2fef69f..cf8b1024 100644 --- a/src/main/java/net/skullian/torrent/skyfactions/SkyFactionsReborn.java +++ b/src/main/java/net/skullian/torrent/skyfactions/SkyFactionsReborn.java @@ -40,7 +40,8 @@ public final class SkyFactionsReborn extends JavaPlugin { ____ _ _ _ _ ____ ____ ____ ___ _ ____ _ _ ____\s [__ |_/ \\_/ |___ |__| | | | | | |\\ | [__ \s - ___] | \\_ | | | | |___ | | |__| | \\| ___] + ___] | \\_ | | | | |___ | | |__| | \\| ___]\s + """; @Override diff --git a/src/main/java/net/skullian/torrent/skyfactions/api/FactionAPI.java b/src/main/java/net/skullian/torrent/skyfactions/api/FactionAPI.java index c3185d9b..b8af15f7 100644 --- a/src/main/java/net/skullian/torrent/skyfactions/api/FactionAPI.java +++ b/src/main/java/net/skullian/torrent/skyfactions/api/FactionAPI.java @@ -58,6 +58,7 @@ public static void createFaction(Player player, String name) { Faction faction = FactionAPI.getFaction(name); faction.createAuditLog(player.getUniqueId(), AuditLogType.FACTION_CREATE, "%player_name%", player.getName(), "%faction_name%", name); createIsland(player, name); + NotificationAPI.factionInviteStore.put(faction.getName(), 0); } /** diff --git a/src/main/java/net/skullian/torrent/skyfactions/api/GUIAPI.java b/src/main/java/net/skullian/torrent/skyfactions/api/GUIAPI.java index 37d08f80..5890a948 100644 --- a/src/main/java/net/skullian/torrent/skyfactions/api/GUIAPI.java +++ b/src/main/java/net/skullian/torrent/skyfactions/api/GUIAPI.java @@ -114,12 +114,12 @@ public static List getPaginationData(Player player) throws R } } - public static ItemStack createItem(ItemData data, Player player) { + public static ItemStack createItem(ItemData data, UUID playerUUID) { ItemStack stack; if (data.getMATERIAL().equalsIgnoreCase("PLAYER_HEAD")) { String texture = data.getBASE64_TEXTURE(); if (texture.equalsIgnoreCase("%player_skull%")) { - stack = SkullAPI.getPlayerSkull(new ItemStack(Material.PLAYER_HEAD), player); + stack = SkullAPI.getPlayerSkull(new ItemStack(Material.PLAYER_HEAD), playerUUID); } else { stack = SkullAPI.convertToSkull(new ItemStack(Material.PLAYER_HEAD), data.getBASE64_TEXTURE()); } @@ -130,28 +130,12 @@ public static ItemStack createItem(ItemData data, Player player) { return stack; } - public static ItemStack createItem(ItemData data, OfflinePlayer player) { + public static ItemStack createItem(PaginationItemData data, UUID playerUUID) { ItemStack stack; if (data.getMATERIAL().equalsIgnoreCase("PLAYER_HEAD")) { String texture = data.getBASE64_TEXTURE(); if (texture.equalsIgnoreCase("%player_skull%")) { - stack = SkullAPI.getPlayerSkull(new ItemStack(Material.PLAYER_HEAD), player.getPlayer()); - } else { - stack = SkullAPI.convertToSkull(new ItemStack(Material.PLAYER_HEAD), data.getBASE64_TEXTURE()); - } - } else { - stack = new ItemStack(Material.getMaterial(data.getMATERIAL())); - } - - return stack; - } - - public static ItemStack createItem(PaginationItemData data, Player player) { - ItemStack stack; - if (data.getMATERIAL().equalsIgnoreCase("PLAYER_HEAD")) { - String texture = data.getBASE64_TEXTURE(); - if (texture.equalsIgnoreCase("%player_skull%")) { - stack = SkullAPI.getPlayerSkull(new ItemStack(Material.PLAYER_HEAD), player); + stack = SkullAPI.getPlayerSkull(new ItemStack(Material.PLAYER_HEAD), playerUUID); } else { stack = SkullAPI.convertToSkull(new ItemStack(Material.PLAYER_HEAD), data.getBASE64_TEXTURE()); } diff --git a/src/main/java/net/skullian/torrent/skyfactions/api/SkullAPI.java b/src/main/java/net/skullian/torrent/skyfactions/api/SkullAPI.java index 9669f388..3935f5f1 100644 --- a/src/main/java/net/skullian/torrent/skyfactions/api/SkullAPI.java +++ b/src/main/java/net/skullian/torrent/skyfactions/api/SkullAPI.java @@ -28,10 +28,10 @@ public static ItemStack convertToSkull(ItemStack item, String skullValue) { return item; } - public static ItemStack getPlayerSkull(ItemStack item, Player player) { + public static ItemStack getPlayerSkull(ItemStack item, UUID playerUUID) { if (item.getType() == Material.PLAYER_HEAD) { SkullMeta meta = (SkullMeta) item.getItemMeta(); - meta.setOwningPlayer(Bukkit.getOfflinePlayer(player.getUniqueId())); + meta.setOwningPlayer(Bukkit.getOfflinePlayer(playerUUID)); item.setItemMeta(meta); } diff --git a/src/main/java/net/skullian/torrent/skyfactions/command/faction/cmds/FactionRequestJoinCommand.java b/src/main/java/net/skullian/torrent/skyfactions/command/faction/cmds/FactionRequestJoinCommand.java index c4978803..81c429f9 100644 --- a/src/main/java/net/skullian/torrent/skyfactions/command/faction/cmds/FactionRequestJoinCommand.java +++ b/src/main/java/net/skullian/torrent/skyfactions/command/faction/cmds/FactionRequestJoinCommand.java @@ -2,6 +2,7 @@ import net.skullian.torrent.skyfactions.SkyFactionsReborn; import net.skullian.torrent.skyfactions.api.FactionAPI; +import net.skullian.torrent.skyfactions.api.NotificationAPI; import net.skullian.torrent.skyfactions.command.CommandTemplate; import net.skullian.torrent.skyfactions.command.CooldownHandler; import net.skullian.torrent.skyfactions.command.PermissionsHandler; @@ -54,6 +55,8 @@ public void perform(Player player, String[] args) { faction.createJoinRequest(Bukkit.getOfflinePlayer(player.getUniqueId())); Messages.JOIN_REQUEST_CREATE_SUCCESS.send(player, "%faction_name%", factionName); + NotificationAPI.factionInviteStore.replace(factionName, (NotificationAPI.factionInviteStore.get(factionName) + 1)); + } } diff --git a/src/main/java/net/skullian/torrent/skyfactions/config/GUIEnums.java b/src/main/java/net/skullian/torrent/skyfactions/config/GUIEnums.java index 110ad9c8..d926d435 100644 --- a/src/main/java/net/skullian/torrent/skyfactions/config/GUIEnums.java +++ b/src/main/java/net/skullian/torrent/skyfactions/config/GUIEnums.java @@ -20,6 +20,7 @@ public enum GUIEnums { OBELISK_INVITE_SELECTION_GUI("guis/obelisk/invites/invite_selection"), OBELISK_INVITE_INCOMING_GUI("guis/obelisk/invites/incoming_requests"), OBELISK_INVITE_OUTGOING_GUI("guis/obelisk/invites/outgoing_invites"), + OBELISK_PLAYER_INVITE_MANAGE_GUI("guis/obelisk/invites/player_invite_manage"), OBELISK_PLAYER_INCOMING_INVITES_GUI("guis/obelisk/invites/player_faction_invites"), OBELISK_PLAYER_INVITE_TYPE_SELECTION_GUI("guis/obelisk/invites/player_invite_selection"), OBELISK_PLAYER_JOIN_REQUEST_MANAGE_GUI("guis/obelisk/invites/player_join_request"), diff --git a/src/main/java/net/skullian/torrent/skyfactions/config/Messages.java b/src/main/java/net/skullian/torrent/skyfactions/config/Messages.java index add1d2f8..2c1fa554 100644 --- a/src/main/java/net/skullian/torrent/skyfactions/config/Messages.java +++ b/src/main/java/net/skullian/torrent/skyfactions/config/Messages.java @@ -106,7 +106,8 @@ public enum Messages { FACTION_JOIN_REQUEST_NOT_EXIST("Factions.FACTION_INVITE.JOIN_REQUEST_NOT_EXIST"), FACTION_JOIN_REQUEST_REVOKE_SUCCESS("Factions.FACTION_INVITE.JOIN_REQUEST_REVOKE_SUCCESS"), FACTION_JOIN_REQUEST_DENY_SUCCESS("Factions.FACTION_INVITE.JOIN_REQUEST_DENY_SUCCESS"), - FACTION_PLAYER_JOIN_REQUEST_ACCEPT("Factions.FACTION_INVITE.PLAYER_JOIN_REQUEST_ACCEPT_SUCCESS"), + PLAYER_FACTION_JOIN_SUCCESS("Factions.FACTION_INVITE.PLAYER_FACTION_JOIN_SUCCESS"), + FACTION_INVITE_DENY_SUCCESS("Factions.FACTION_INVITE.FACTION_INVITE_DENY_SUCCESS"), ALREADY_IN_FACTION("Factions.ALREADY_IN_FACTION"), NOT_IN_FACTION("Factions.NOT_IN_FACTION"), @@ -160,6 +161,10 @@ public enum Messages { AUDIT_FACTION_PLAYER_JOIN_REQUEST_REVOKE_DESCRIPTION("Audit_Logs.PLAYER_JOIN_REQUEST_REVOKE_DESCRIPTION"), AUDIT_FACTION_PLAYER_JOIN_REQUEST_DENY_TITLE("Audit_Logs.PLAYER_JOIN_REQUEST_DENY_TITLE"), AUDIT_FACTION_PLAYER_JOIN_REQUEST_DENY_DESCRIPTION("Audit_Logs.PLAYER_JOIN_REQUEST_DENY_DESCRIPTION"), + AUDIT_FACTION_PLAYER_INVITE_ACCEPT_TITLE("Audit_Logs.INVITE_ACCEPT_TITLE"), + AUDIT_FACTION_PLAYER_INVITE_ACCEPT_DESCRIPTION("Audit_Logs.INVITE_ACCEPT_TITLE"), + AUDIT_FACTION_PLAYER_INVITE_DENY_TITLE("Audit_Logs.INVITE_DENY_TITLE"), + AUDIT_FACTION_PLAYER_INVITE_DENY_DESCRIPTION("Audit_Logs.INVITE_DENY_DESCRIPTION"), NOTIFICATION_TIMESTAMP_FORMAT("Notifications.NOTIFICATION_TYPES.NOTIFICATION_TIMESTAMP"), NOTIFICATION_FACTION_INVITE_TITLE("Notifications.NOTIFICATION_TYPES.FACTION_INVITE_TITLE"), diff --git a/src/main/java/net/skullian/torrent/skyfactions/db/HikariHandler.java b/src/main/java/net/skullian/torrent/skyfactions/db/HikariHandler.java index aff7d2a2..acbbcf08 100644 --- a/src/main/java/net/skullian/torrent/skyfactions/db/HikariHandler.java +++ b/src/main/java/net/skullian/torrent/skyfactions/db/HikariHandler.java @@ -115,7 +115,7 @@ private void setupTables() throws SQLException { PreparedStatement islandsTable = connection.prepareStatement(""" CREATE TABLE IF NOT EXISTS islands ( [id] INTEGER PRIMARY KEY, - [uuid] BLOB NOT NULL, + [uuid] TEXT NOT NULL, [level] INTEGER NOT NULL, [gems] INTEGER NOT NULL, [runes] INTEGER NOT NULL, @@ -125,7 +125,7 @@ CREATE TABLE IF NOT EXISTS islands ( PreparedStatement playerDataTable = connection.prepareStatement(""" CREATE TABLE IF NOT EXISTS playerData ( - [uuid] BLOB PRIMARY KEY UNIQUE NOT NULL, + [uuid] TEXT PRIMARY KEY UNIQUE NOT NULL, [faction] TEXT NOT NULL, [discord_id] TEXT NOT NULL, [last_raid] INTEGER NOT NULL @@ -135,7 +135,7 @@ CREATE TABLE IF NOT EXISTS playerData ( PreparedStatement factionIslandTable = connection.prepareStatement(""" CREATE TABLE IF NOT EXISTS factionIslands ( [id] INTEGER PRIMARY KEY, - [faction_name] BLOB NOT NULL, + [faction_name] TEXT NOT NULL, [runes] INTEGER NOT NULL, [gems] INTEGER NOT NULL, [last_raided] INTEGER NOT NULL @@ -153,8 +153,8 @@ CREATE TABLE IF NOT EXISTS factions( PreparedStatement factionMemberTable = connection.prepareStatement(""" CREATE TABLE IF NOT EXISTS factionMembers ( - [faction_name] TEXT PRIMARY KEY NOT NULL, - [uuid] BLOB NOT NULL, + [faction_name] TEXT NOT NULL, + [uuid] TEXT PRIMARY KEY NOT NULL, [rank] TEXT NOT NULL ) STRICT; """); @@ -162,7 +162,7 @@ CREATE TABLE IF NOT EXISTS factionMembers ( PreparedStatement trustedPlayerTable = connection.prepareStatement(""" CREATE TABLE IF NOT EXISTS trustedPlayers ( [island_id] INTEGER PRIMARY KEY NOT NULL, - [uuid] BLOB NOT NULL + [uuid] TEXT NOT NULL ) STRICT; """); @@ -170,8 +170,8 @@ CREATE TABLE IF NOT EXISTS trustedPlayers ( CREATE TABLE IF NOT EXISTS auditLogs ( [faction_name] TEXT NOT NULL, [type] TEXT NOT NULL, - [uuid] BLOB NOT NULL, - [description] BLOB NOT NULL, + [uuid] TEXT NOT NULL, + [description] TEXT NOT NULL, [timestamp] INTEGER NOT NULL ) STRICT; """); @@ -179,26 +179,26 @@ CREATE TABLE IF NOT EXISTS auditLogs ( PreparedStatement factionBannedMembers = connection.prepareStatement(""" CREATE TABLE IF NOT EXISTS factionBans ( [faction_name] TEXT NOT NULL, - [uuid] BLOB NOT NULL + [uuid] TEXT NOT NULL ) STRICT; """); PreparedStatement factionInvitesTable = connection.prepareStatement(""" CREATE TABLE IF NOT EXISTS factionInvites ( [faction_name] TEXT NOT NULL, - [uuid] BLOB NOT NULL, - [inviter] BLOB NOT NULL, + [uuid] TEXT NOT NULL, + [inviter] TEXT NOT NULL, [type] TEXT NOT NULL, - [accepted] BOOLEAN NOT NULL, + [accepted] INTEGER NOT NULL, [timestamp] INTEGER NOT NULL ) STRICT; """); PreparedStatement notificationTable = connection.prepareStatement(""" CREATE TABLE IF NOT EXISTS notifications ( - [uuid] BLOB NOT NULL, - [type] BLOB NOT NULL, - [description] BLOB NOT NULL, + [uuid] TEXT NOT NULL, + [type] TEXT NOT NULL, + [description] TEXT NOT NULL, [timestamp] INTEGER NOT NULL ) STRICT; """)) { @@ -1490,7 +1490,7 @@ public CompletableFuture getPlayerOutgoingJoinRequest(Player pl ResultSet set = statement.executeQuery(); if (set.next()) { - String factionName = set.getString("faction+name"); + String factionName = set.getString("faction_name"); long timestamp = set.getLong("timestamp"); boolean accepted = set.getBoolean("accepted"); diff --git a/src/main/java/net/skullian/torrent/skyfactions/faction/AuditLogType.java b/src/main/java/net/skullian/torrent/skyfactions/faction/AuditLogType.java index d27b3afb..9e3b73a0 100644 --- a/src/main/java/net/skullian/torrent/skyfactions/faction/AuditLogType.java +++ b/src/main/java/net/skullian/torrent/skyfactions/faction/AuditLogType.java @@ -17,7 +17,9 @@ public enum AuditLogType { JOIN_REQUEST_ACCEPT(Messages.AUDIT_FACTION_JOIN_REQUEST_ACCEPT_TITLE, Messages.AUDIT_FACTION_JOIN_REQUEST_ACCEPT_DESCRIPTION), JOIN_REQUEST_REJECT(Messages.AUDIT_FACTION_JOIN_REQUEST_REJECT_TITLE, Messages.AUDIT_FACTION_JOIN_REQUEST_REJECT_DESCRIPTION), PLAYER_JOIN_REQUEST_REVOKE(Messages.AUDIT_FACTION_PLAYER_JOIN_REQUEST_REVOKE_TITLE, Messages.AUDIT_FACTION_PLAYER_JOIN_REQUEST_REVOKE_DESCRIPTION), - PLAYER_JOIN_REQUEST_DENY(Messages.AUDIT_FACTION_PLAYER_JOIN_REQUEST_DENY_TITLE, Messages.AUDIT_FACTION_PLAYER_JOIN_REQUEST_DENY_DESCRIPTION); + PLAYER_JOIN_REQUEST_DENY(Messages.AUDIT_FACTION_PLAYER_JOIN_REQUEST_DENY_TITLE, Messages.AUDIT_FACTION_PLAYER_JOIN_REQUEST_DENY_DESCRIPTION), + INVITE_ACCEPT(Messages.AUDIT_FACTION_PLAYER_INVITE_ACCEPT_TITLE, Messages.AUDIT_FACTION_PLAYER_INVITE_ACCEPT_DESCRIPTION), + INVITE_DENY(Messages.AUDIT_FACTION_PLAYER_INVITE_DENY_TITLE, Messages.AUDIT_FACTION_PLAYER_INVITE_DENY_DESCRIPTION); private final Messages title; private final Messages description; diff --git a/src/main/java/net/skullian/torrent/skyfactions/gui/FactionLeaveConfirmationUI.java b/src/main/java/net/skullian/torrent/skyfactions/gui/FactionLeaveConfirmationUI.java index a8974135..e01d7779 100644 --- a/src/main/java/net/skullian/torrent/skyfactions/gui/FactionLeaveConfirmationUI.java +++ b/src/main/java/net/skullian/torrent/skyfactions/gui/FactionLeaveConfirmationUI.java @@ -7,23 +7,20 @@ import net.skullian.torrent.skyfactions.gui.items.GeneralBorderItem; import net.skullian.torrent.skyfactions.gui.items.GeneralPromptItem; import net.skullian.torrent.skyfactions.gui.items.faction_leave.LeaveConfirmationItem; -import net.skullian.torrent.skyfactions.gui.items.island_creation.CreationCancelItem; -import net.skullian.torrent.skyfactions.gui.items.island_creation.CreationConfirmationItem; +import net.skullian.torrent.skyfactions.gui.items.GeneralCancelItem; import net.skullian.torrent.skyfactions.util.SoundUtil; import net.skullian.torrent.skyfactions.util.text.TextUtility; -import org.bukkit.configuration.InvalidConfigurationException; import org.bukkit.entity.Player; import xyz.xenondevs.invui.gui.Gui; import xyz.xenondevs.invui.window.Window; -import java.io.IOException; import java.util.List; public class FactionLeaveConfirmationUI { public static void promptPlayer(Player player) { try { - GUIData data = GUIAPI.getGUIData("confirmatioms/faction_leave"); + GUIData data = GUIAPI.getGUIData("confirmations/faction_leave"); Gui.Builder.Normal gui = registerItems(Gui.normal() .setStructure(data.getLAYOUT()), player); @@ -48,13 +45,16 @@ private static Gui.Builder.Normal registerItems(Gui.Builder.Normal builder, Play switch (itemData.getITEM_ID()) { case "PROMPT": - builder.addIngredient(itemData.getCHARACTER(), new GeneralPromptItem(itemData, GUIAPI.createItem(itemData, player))); + builder.addIngredient(itemData.getCHARACTER(), new GeneralPromptItem(itemData, GUIAPI.createItem(itemData, player.getUniqueId()))); break; case "CONFIRM": - builder.addIngredient(itemData.getCHARACTER(), new LeaveConfirmationItem(itemData, GUIAPI.createItem(itemData, player))); + builder.addIngredient(itemData.getCHARACTER(), new LeaveConfirmationItem(itemData, GUIAPI.createItem(itemData, player.getUniqueId()))); + break; + case "CANCEL": + builder.addIngredient(itemData.getCHARACTER(), new GeneralCancelItem(itemData, GUIAPI.createItem(itemData, player.getUniqueId()))); break; case "BORDER": - builder.addIngredient(itemData.getCHARACTER(), new GeneralBorderItem(itemData, GUIAPI.createItem(itemData, player))); + builder.addIngredient(itemData.getCHARACTER(), new GeneralBorderItem(itemData, GUIAPI.createItem(itemData, player.getUniqueId()))); break; } } diff --git a/src/main/java/net/skullian/torrent/skyfactions/gui/IslandCreationConfirmationUI.java b/src/main/java/net/skullian/torrent/skyfactions/gui/IslandCreationConfirmationUI.java index 2cf4bd80..f6056478 100644 --- a/src/main/java/net/skullian/torrent/skyfactions/gui/IslandCreationConfirmationUI.java +++ b/src/main/java/net/skullian/torrent/skyfactions/gui/IslandCreationConfirmationUI.java @@ -5,18 +5,16 @@ import net.skullian.torrent.skyfactions.gui.data.GUIData; import net.skullian.torrent.skyfactions.gui.data.ItemData; import net.skullian.torrent.skyfactions.gui.items.GeneralPromptItem; -import net.skullian.torrent.skyfactions.gui.items.island_creation.CreationCancelItem; +import net.skullian.torrent.skyfactions.gui.items.GeneralCancelItem; import net.skullian.torrent.skyfactions.gui.items.island_creation.CreationConfirmationItem; import net.skullian.torrent.skyfactions.gui.items.GeneralBorderItem; import net.skullian.torrent.skyfactions.util.SoundUtil; import net.skullian.torrent.skyfactions.util.text.TextUtility; -import org.bukkit.configuration.InvalidConfigurationException; import org.bukkit.entity.Player; import org.bukkit.event.Listener; import xyz.xenondevs.invui.gui.Gui; import xyz.xenondevs.invui.window.Window; -import java.io.IOException; import java.util.List; public class IslandCreationConfirmationUI implements Listener { @@ -48,16 +46,16 @@ private static Gui.Builder.Normal registerItems(Gui.Builder.Normal builder, Play switch (itemData.getITEM_ID()) { case "CANCEL": - builder.addIngredient(itemData.getCHARACTER(), new CreationCancelItem(itemData, GUIAPI.createItem(itemData, player))); + builder.addIngredient(itemData.getCHARACTER(), new GeneralCancelItem(itemData, GUIAPI.createItem(itemData, player.getUniqueId()))); break; case "CONFIRM": - builder.addIngredient(itemData.getCHARACTER(), new CreationConfirmationItem(itemData, GUIAPI.createItem(itemData, player))); + builder.addIngredient(itemData.getCHARACTER(), new CreationConfirmationItem(itemData, GUIAPI.createItem(itemData, player.getUniqueId()))); break; case "PROMPT": - builder.addIngredient(itemData.getCHARACTER(), new GeneralPromptItem(itemData, GUIAPI.createItem(itemData, player))); + builder.addIngredient(itemData.getCHARACTER(), new GeneralPromptItem(itemData, GUIAPI.createItem(itemData, player.getUniqueId()))); break; case "BORDER": - builder.addIngredient(itemData.getCHARACTER(), new GeneralBorderItem(itemData, GUIAPI.createItem(itemData, player))); + builder.addIngredient(itemData.getCHARACTER(), new GeneralBorderItem(itemData, GUIAPI.createItem(itemData, player.getUniqueId()))); break; } } diff --git a/src/main/java/net/skullian/torrent/skyfactions/gui/PlayerRaidConfirmationUI.java b/src/main/java/net/skullian/torrent/skyfactions/gui/PlayerRaidConfirmationUI.java index 1c76e07f..96174aa9 100644 --- a/src/main/java/net/skullian/torrent/skyfactions/gui/PlayerRaidConfirmationUI.java +++ b/src/main/java/net/skullian/torrent/skyfactions/gui/PlayerRaidConfirmationUI.java @@ -47,16 +47,16 @@ private static Gui.Builder.Normal registerItems(Gui.Builder.Normal builder, Play switch (itemData.getITEM_ID()) { case "CANCEL": - builder.addIngredient(itemData.getCHARACTER(), new RaidCancelItem(itemData, GUIAPI.createItem(itemData, player))); + builder.addIngredient(itemData.getCHARACTER(), new RaidCancelItem(itemData, GUIAPI.createItem(itemData, player.getUniqueId()))); break; case "CONFIRM": - builder.addIngredient(itemData.getCHARACTER(), new RaidConfirmationItem(itemData, GUIAPI.createItem(itemData, player))); + builder.addIngredient(itemData.getCHARACTER(), new RaidConfirmationItem(itemData, GUIAPI.createItem(itemData, player.getUniqueId()))); break; case "PROMPT": - builder.addIngredient(itemData.getCHARACTER(), new GeneralPromptItem(itemData, GUIAPI.createItem(itemData, player))); + builder.addIngredient(itemData.getCHARACTER(), new GeneralPromptItem(itemData, GUIAPI.createItem(itemData, player.getUniqueId()))); break; case "BORDER": - builder.addIngredient(itemData.getCHARACTER(), new GeneralBorderItem(itemData, GUIAPI.createItem(itemData, player))); + builder.addIngredient(itemData.getCHARACTER(), new GeneralBorderItem(itemData, GUIAPI.createItem(itemData, player.getUniqueId()))); break; } } diff --git a/src/main/java/net/skullian/torrent/skyfactions/gui/items/island_creation/CreationCancelItem.java b/src/main/java/net/skullian/torrent/skyfactions/gui/items/GeneralCancelItem.java similarity index 89% rename from src/main/java/net/skullian/torrent/skyfactions/gui/items/island_creation/CreationCancelItem.java rename to src/main/java/net/skullian/torrent/skyfactions/gui/items/GeneralCancelItem.java index 6d92685b..b44af6ce 100644 --- a/src/main/java/net/skullian/torrent/skyfactions/gui/items/island_creation/CreationCancelItem.java +++ b/src/main/java/net/skullian/torrent/skyfactions/gui/items/GeneralCancelItem.java @@ -1,4 +1,4 @@ -package net.skullian.torrent.skyfactions.gui.items.island_creation; +package net.skullian.torrent.skyfactions.gui.items; import net.skullian.torrent.skyfactions.util.SoundUtil; @@ -15,7 +15,7 @@ import java.util.List; -public class CreationCancelItem extends AbstractItem { +public class GeneralCancelItem extends AbstractItem { private String NAME; private String SOUND; @@ -23,7 +23,7 @@ public class CreationCancelItem extends AbstractItem { private List LORE; private ItemStack STACK; - public CreationCancelItem(ItemData data, ItemStack stack) { + public GeneralCancelItem(ItemData data, ItemStack stack) { this.NAME = data.getNAME(); this.SOUND = data.getSOUND(); this.PITCH = data.getPITCH(); diff --git a/src/main/java/net/skullian/torrent/skyfactions/gui/items/faction_leave/LeaveConfirmationItem.java b/src/main/java/net/skullian/torrent/skyfactions/gui/items/faction_leave/LeaveConfirmationItem.java index 76eed20c..d575a424 100644 --- a/src/main/java/net/skullian/torrent/skyfactions/gui/items/faction_leave/LeaveConfirmationItem.java +++ b/src/main/java/net/skullian/torrent/skyfactions/gui/items/faction_leave/LeaveConfirmationItem.java @@ -87,7 +87,7 @@ public void handleClick(@NotNull ClickType clickType, @NotNull Player player, @N } faction.leaveFaction(Bukkit.getOfflinePlayer(player.getUniqueId())); - Messages.FACTION_LEAVE_SUCCESS.send(player); + Messages.FACTION_LEAVE_SUCCESS.send(player, "%faction_name%", faction.getName()); } else { Messages.ERROR.send(player, "%operation%", "leave the faction", "%debug%", "WORLD_NOT_EXIST"); diff --git a/src/main/java/net/skullian/torrent/skyfactions/gui/items/obelisk/invites/FactionJoinRequestPaginationItem.java b/src/main/java/net/skullian/torrent/skyfactions/gui/items/obelisk/invites/FactionJoinRequestPaginationItem.java index 1558224e..0ace1df6 100644 --- a/src/main/java/net/skullian/torrent/skyfactions/gui/items/obelisk/invites/FactionJoinRequestPaginationItem.java +++ b/src/main/java/net/skullian/torrent/skyfactions/gui/items/obelisk/invites/FactionJoinRequestPaginationItem.java @@ -43,7 +43,10 @@ public ItemProvider getItemProvider() { .setDisplayName(TextUtility.color(NAME)); for (String loreLine : LORE) { - builder.addLoreLines(TextUtility.color(loreLine)); + builder.addLoreLines(TextUtility.color(loreLine + .replace("%player_name%", DATA.getPlayer().getName())) + .replace("%timestamp%", TextUtility.formatExtendedElapsedTime(DATA.getTimestamp())) + ); } return builder; diff --git a/src/main/java/net/skullian/torrent/skyfactions/gui/items/obelisk/invites/FactionPlayerJoinRequestConfirmItem.java b/src/main/java/net/skullian/torrent/skyfactions/gui/items/obelisk/invites/FactionPlayerJoinRequestConfirmItem.java index 91209395..bbf6b5e5 100644 --- a/src/main/java/net/skullian/torrent/skyfactions/gui/items/obelisk/invites/FactionPlayerJoinRequestConfirmItem.java +++ b/src/main/java/net/skullian/torrent/skyfactions/gui/items/obelisk/invites/FactionPlayerJoinRequestConfirmItem.java @@ -2,7 +2,9 @@ import net.skullian.torrent.skyfactions.SkyFactionsReborn; import net.skullian.torrent.skyfactions.api.FactionAPI; +import net.skullian.torrent.skyfactions.api.NotificationAPI; import net.skullian.torrent.skyfactions.config.Messages; +import net.skullian.torrent.skyfactions.faction.Faction; import net.skullian.torrent.skyfactions.faction.JoinRequestData; import net.skullian.torrent.skyfactions.gui.data.ItemData; import net.skullian.torrent.skyfactions.util.SoundUtil; @@ -58,9 +60,11 @@ public void handleClick(@NotNull ClickType clickType, @NotNull Player player, @N } event.getInventory().close(); - FactionAPI.getFaction(DATA.getFactionName()).addFactionMember(player.getUniqueId()); + Faction faction = FactionAPI.getFaction(DATA.getFactionName()); + faction.addFactionMember(player.getUniqueId()); SkyFactionsReborn.db.revokeInvite(DATA.getFactionName(), player.getUniqueId(), "incoming").join(); - Messages.FACTION_PLAYER_JOIN_REQUEST_ACCEPT.send(player, "%faction_name%", DATA.getFactionName()); + Messages.PLAYER_FACTION_JOIN_SUCCESS.send(player, "%faction_name%", DATA.getFactionName()); + NotificationAPI.factionInviteStore.replace(faction.getName(), (NotificationAPI.factionInviteStore.get(faction.getName()) - 1)); } } diff --git a/src/main/java/net/skullian/torrent/skyfactions/gui/items/obelisk/invites/FactionPlayerJoinRequestDenyItem.java b/src/main/java/net/skullian/torrent/skyfactions/gui/items/obelisk/invites/FactionPlayerJoinRequestDenyItem.java index 6b7f4d2d..da911ec0 100644 --- a/src/main/java/net/skullian/torrent/skyfactions/gui/items/obelisk/invites/FactionPlayerJoinRequestDenyItem.java +++ b/src/main/java/net/skullian/torrent/skyfactions/gui/items/obelisk/invites/FactionPlayerJoinRequestDenyItem.java @@ -2,6 +2,7 @@ import net.skullian.torrent.skyfactions.SkyFactionsReborn; import net.skullian.torrent.skyfactions.api.FactionAPI; +import net.skullian.torrent.skyfactions.api.NotificationAPI; import net.skullian.torrent.skyfactions.config.Messages; import net.skullian.torrent.skyfactions.faction.AuditLogType; import net.skullian.torrent.skyfactions.faction.Faction; @@ -62,6 +63,7 @@ public void handleClick(@NotNull ClickType clickType, @NotNull Player player, @N Faction faction = FactionAPI.getFaction(DATA.getFactionName()); faction.createAuditLog(player.getUniqueId(), AuditLogType.PLAYER_JOIN_REQUEST_REVOKE, "%player_name%", player.getName()); SkyFactionsReborn.db.revokeInvite(DATA.getFactionName(), player.getUniqueId(), "incoming").join(); + NotificationAPI.factionInviteStore.replace(faction.getName(), (NotificationAPI.factionInviteStore.get(faction.getName()) - 1)); Messages.FACTION_JOIN_REQUEST_DENY_SUCCESS.send(player, "%faction_name%", DATA.getFactionName()); } diff --git a/src/main/java/net/skullian/torrent/skyfactions/gui/items/obelisk/invites/FactionPlayerJoinRequestRevoke.java b/src/main/java/net/skullian/torrent/skyfactions/gui/items/obelisk/invites/FactionPlayerJoinRequestRevoke.java index 8ab32916..b417a0a3 100644 --- a/src/main/java/net/skullian/torrent/skyfactions/gui/items/obelisk/invites/FactionPlayerJoinRequestRevoke.java +++ b/src/main/java/net/skullian/torrent/skyfactions/gui/items/obelisk/invites/FactionPlayerJoinRequestRevoke.java @@ -2,6 +2,7 @@ import net.skullian.torrent.skyfactions.SkyFactionsReborn; import net.skullian.torrent.skyfactions.api.FactionAPI; +import net.skullian.torrent.skyfactions.api.NotificationAPI; import net.skullian.torrent.skyfactions.config.Messages; import net.skullian.torrent.skyfactions.faction.Faction; import net.skullian.torrent.skyfactions.faction.JoinRequestData; @@ -61,5 +62,6 @@ public void handleClick(@NotNull ClickType clickType, @NotNull Player player, @N SkyFactionsReborn.db.revokeInvite(DATA.getFactionName(), player.getUniqueId(), "incoming").join(); Messages.FACTION_JOIN_REQUEST_REVOKE_SUCCESS.send(player, "%faction_name%", DATA.getFactionName()); + NotificationAPI.factionInviteStore.replace(DATA.getFactionName(), (NotificationAPI.factionInviteStore.get(DATA.getFactionName()) - 1)); } } diff --git a/src/main/java/net/skullian/torrent/skyfactions/gui/items/obelisk/invites/PlayerFactionInvitePaginationItem.java b/src/main/java/net/skullian/torrent/skyfactions/gui/items/obelisk/invites/PlayerFactionInvitePaginationItem.java index 9d6da2aa..edb88c5a 100644 --- a/src/main/java/net/skullian/torrent/skyfactions/gui/items/obelisk/invites/PlayerFactionInvitePaginationItem.java +++ b/src/main/java/net/skullian/torrent/skyfactions/gui/items/obelisk/invites/PlayerFactionInvitePaginationItem.java @@ -2,6 +2,7 @@ import net.skullian.torrent.skyfactions.db.InviteData; import net.skullian.torrent.skyfactions.gui.data.ItemData; +import net.skullian.torrent.skyfactions.gui.obelisk.invites.PlayerManageIncomingInviteUI; import net.skullian.torrent.skyfactions.util.SoundUtil; import net.skullian.torrent.skyfactions.util.text.TextUtility; import org.bukkit.OfflinePlayer; @@ -56,7 +57,7 @@ public void handleClick(@NotNull ClickType clickType, @NotNull Player player, @N SoundUtil.playSound(player, SOUND, PITCH, 1); } - // todo + PlayerManageIncomingInviteUI.promptPlayer(player, DATA); } } diff --git a/src/main/java/net/skullian/torrent/skyfactions/gui/items/obelisk/invites/PlayerIncomingInviteAccept.java b/src/main/java/net/skullian/torrent/skyfactions/gui/items/obelisk/invites/PlayerIncomingInviteAccept.java new file mode 100644 index 00000000..1521710a --- /dev/null +++ b/src/main/java/net/skullian/torrent/skyfactions/gui/items/obelisk/invites/PlayerIncomingInviteAccept.java @@ -0,0 +1,73 @@ +package net.skullian.torrent.skyfactions.gui.items.obelisk.invites; + +import net.skullian.torrent.skyfactions.SkyFactionsReborn; +import net.skullian.torrent.skyfactions.api.FactionAPI; +import net.skullian.torrent.skyfactions.config.Messages; +import net.skullian.torrent.skyfactions.db.InviteData; +import net.skullian.torrent.skyfactions.faction.AuditLogType; +import net.skullian.torrent.skyfactions.faction.Faction; +import net.skullian.torrent.skyfactions.faction.JoinRequestData; +import net.skullian.torrent.skyfactions.gui.data.ItemData; +import net.skullian.torrent.skyfactions.util.SoundUtil; +import net.skullian.torrent.skyfactions.util.text.TextUtility; +import org.bukkit.entity.Player; +import org.bukkit.event.inventory.ClickType; +import org.bukkit.event.inventory.InventoryClickEvent; +import org.bukkit.inventory.ItemStack; +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; + +import java.util.List; + +public class PlayerIncomingInviteAccept extends AbstractItem { + + private String NAME; + private String SOUND; + private int PITCH; + private List LORE; + private ItemStack STACK; + private InviteData DATA; + + public PlayerIncomingInviteAccept(ItemData data, ItemStack stack, InviteData inviteData) { + this.NAME = data.getNAME(); + this.SOUND = data.getSOUND(); + this.PITCH = data.getPITCH(); + this.LORE = data.getLORE(); + this.STACK = stack; + this.DATA = inviteData; + } + + @Override + public ItemProvider getItemProvider() { + ItemBuilder builder = new ItemBuilder(STACK) + .setDisplayName(TextUtility.color(NAME)); + + for (String loreLine : LORE) { + builder.addLoreLines(TextUtility.color(loreLine)); + } + + return builder; + } + + @Override + public void handleClick(@NotNull ClickType clickType, @NotNull Player player, @NotNull InventoryClickEvent event) { + event.setCancelled(true); + + if (!SOUND.equalsIgnoreCase("none")) { + SoundUtil.playSound(player, SOUND, PITCH, 1); + } + event.getInventory().close(); + + if (FactionAPI.isInFaction(player)) { + Messages.ALREADY_IN_FACTION.send(player); + } else { + Faction faction = FactionAPI.getFaction(DATA.getFactionName()); + SkyFactionsReborn.db.revokeInvite(DATA.getFactionName(), player.getUniqueId(), "outgoing").join(); + faction.addFactionMember(player.getUniqueId()); + faction.createAuditLog(player.getUniqueId(), AuditLogType.INVITE_ACCEPT, "%player_name%", player.getName()); + Messages.PLAYER_FACTION_JOIN_SUCCESS.send(player, "%faction_name%", player.getName()); + } + } +} diff --git a/src/main/java/net/skullian/torrent/skyfactions/gui/items/obelisk/invites/PlayerIncomingInviteDeny.java b/src/main/java/net/skullian/torrent/skyfactions/gui/items/obelisk/invites/PlayerIncomingInviteDeny.java new file mode 100644 index 00000000..8507f3c8 --- /dev/null +++ b/src/main/java/net/skullian/torrent/skyfactions/gui/items/obelisk/invites/PlayerIncomingInviteDeny.java @@ -0,0 +1,69 @@ +package net.skullian.torrent.skyfactions.gui.items.obelisk.invites; + +import net.skullian.torrent.skyfactions.SkyFactionsReborn; +import net.skullian.torrent.skyfactions.api.FactionAPI; +import net.skullian.torrent.skyfactions.config.Messages; +import net.skullian.torrent.skyfactions.db.InviteData; +import net.skullian.torrent.skyfactions.faction.AuditLogType; +import net.skullian.torrent.skyfactions.faction.Faction; +import net.skullian.torrent.skyfactions.faction.JoinRequestData; +import net.skullian.torrent.skyfactions.gui.data.ItemData; +import net.skullian.torrent.skyfactions.util.SoundUtil; +import net.skullian.torrent.skyfactions.util.text.TextUtility; +import org.bukkit.entity.Player; +import org.bukkit.event.inventory.ClickType; +import org.bukkit.event.inventory.InventoryClickEvent; +import org.bukkit.inventory.ItemStack; +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; + +import java.util.List; + +public class PlayerIncomingInviteDeny extends AbstractItem { + + private String NAME; + private String SOUND; + private int PITCH; + private List LORE; + private ItemStack STACK; + private InviteData DATA; + + public PlayerIncomingInviteDeny(ItemData data, ItemStack stack, InviteData inviteData) { + this.NAME = data.getNAME(); + this.SOUND = data.getSOUND(); + this.PITCH = data.getPITCH(); + this.LORE = data.getLORE(); + this.STACK = stack; + this.DATA = inviteData; + } + + @Override + public ItemProvider getItemProvider() { + ItemBuilder builder = new ItemBuilder(STACK) + .setDisplayName(TextUtility.color(NAME)); + + for (String loreLine : LORE) { + builder.addLoreLines(TextUtility.color(loreLine)); + } + + return builder; + } + + @Override + public void handleClick(@NotNull ClickType clickType, @NotNull Player player, @NotNull InventoryClickEvent event) { + event.setCancelled(true); + + if (!SOUND.equalsIgnoreCase("none")) { + SoundUtil.playSound(player, SOUND, PITCH, 1); + } + + event.getInventory().close(); + Faction faction = FactionAPI.getFaction(DATA.getFactionName()); + faction.createAuditLog(player.getUniqueId(), AuditLogType.INVITE_DENY, "%player_name%", player.getName()); + SkyFactionsReborn.db.revokeInvite(DATA.getFactionName(), player.getUniqueId(), "outgoing").join(); + Messages.FACTION_INVITE_DENY_SUCCESS.send(player, "%faction_name%", faction.getName()); + } + +} diff --git a/src/main/java/net/skullian/torrent/skyfactions/gui/items/obelisk/invites/PlayerIncomingInvitePromptItem.java b/src/main/java/net/skullian/torrent/skyfactions/gui/items/obelisk/invites/PlayerIncomingInvitePromptItem.java new file mode 100644 index 00000000..ad063e03 --- /dev/null +++ b/src/main/java/net/skullian/torrent/skyfactions/gui/items/obelisk/invites/PlayerIncomingInvitePromptItem.java @@ -0,0 +1,56 @@ +package net.skullian.torrent.skyfactions.gui.items.obelisk.invites; + +import net.skullian.torrent.skyfactions.db.InviteData; +import net.skullian.torrent.skyfactions.gui.data.ItemData; +import net.skullian.torrent.skyfactions.util.SoundUtil; +import net.skullian.torrent.skyfactions.util.text.TextUtility; +import org.bukkit.entity.Player; +import org.bukkit.event.inventory.ClickType; +import org.bukkit.event.inventory.InventoryClickEvent; +import org.bukkit.inventory.ItemStack; +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; + +import java.util.List; + +public class PlayerIncomingInvitePromptItem extends AbstractItem { + + private String NAME; + private String SOUND; + private int PITCH; + private List LORE; + private ItemStack STACK; + private InviteData DATA; + + public PlayerIncomingInvitePromptItem(ItemData data, ItemStack stack, InviteData inviteData) { + this.NAME = data.getNAME(); + this.SOUND = data.getSOUND(); + this.PITCH = data.getPITCH(); + this.LORE = data.getLORE(); + this.STACK = stack; + this.DATA = inviteData; + } + + @Override + public ItemProvider getItemProvider() { + ItemBuilder builder = new ItemBuilder(STACK) + .setDisplayName(TextUtility.color(NAME.replace("%faction_name%", DATA.getFactionName()))); + + for (String loreLine : LORE) { + builder.addLoreLines(TextUtility.color(loreLine)); + } + + return builder; + } + + @Override + public void handleClick(@NotNull ClickType clickType, @NotNull Player player, @NotNull InventoryClickEvent event) { + event.setCancelled(true); + + if (!SOUND.equalsIgnoreCase("none")) { + SoundUtil.playSound(player, SOUND, PITCH, 1); + } + } +} diff --git a/src/main/java/net/skullian/torrent/skyfactions/gui/items/obelisk/invites/PlayerJoinRequestPromptItem.java b/src/main/java/net/skullian/torrent/skyfactions/gui/items/obelisk/invites/PlayerJoinRequestPromptItem.java new file mode 100644 index 00000000..9d766834 --- /dev/null +++ b/src/main/java/net/skullian/torrent/skyfactions/gui/items/obelisk/invites/PlayerJoinRequestPromptItem.java @@ -0,0 +1,57 @@ +package net.skullian.torrent.skyfactions.gui.items.obelisk.invites; + +import net.skullian.torrent.skyfactions.faction.JoinRequestData; +import net.skullian.torrent.skyfactions.gui.data.ItemData; +import net.skullian.torrent.skyfactions.util.SoundUtil; +import net.skullian.torrent.skyfactions.util.text.TextUtility; +import org.bukkit.entity.Player; +import org.bukkit.event.inventory.ClickType; +import org.bukkit.event.inventory.InventoryClickEvent; +import org.bukkit.inventory.ItemStack; +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; + +import java.util.List; + +public class PlayerJoinRequestPromptItem extends AbstractItem { + + private String NAME; + private String SOUND; + private int PITCH; + private List LORE; + private ItemStack STACK; + private JoinRequestData DATA; + + public PlayerJoinRequestPromptItem(ItemData data, ItemStack stack, JoinRequestData joinRequest) { + this.NAME = data.getNAME(); + this.SOUND = data.getSOUND(); + this.PITCH = data.getPITCH(); + this.LORE = data.getLORE(); + this.STACK = stack; + this.DATA = joinRequest; + } + + @Override + public ItemProvider getItemProvider() { + ItemBuilder builder = new ItemBuilder(STACK) + .setDisplayName(TextUtility.color(NAME.replace("%faction_name%", DATA.getFactionName()))); + + for (String loreLine : LORE) { + builder.addLoreLines(TextUtility.color(loreLine)); + } + + return builder; + } + + @Override + public void handleClick(@NotNull ClickType clickType, @NotNull Player player, @NotNull InventoryClickEvent event) { + event.setCancelled(true); + + if (!SOUND.equalsIgnoreCase("none")) { + SoundUtil.playSound(player, SOUND, PITCH, 1); + } + } + +} diff --git a/src/main/java/net/skullian/torrent/skyfactions/gui/items/obelisk/member_manage/MemberPromptItem.java b/src/main/java/net/skullian/torrent/skyfactions/gui/items/obelisk/member_manage/MemberPromptItem.java new file mode 100644 index 00000000..0a76d197 --- /dev/null +++ b/src/main/java/net/skullian/torrent/skyfactions/gui/items/obelisk/member_manage/MemberPromptItem.java @@ -0,0 +1,58 @@ +package net.skullian.torrent.skyfactions.gui.items.obelisk.member_manage; + +import net.skullian.torrent.skyfactions.gui.data.ItemData; +import net.skullian.torrent.skyfactions.util.SoundUtil; +import net.skullian.torrent.skyfactions.util.text.TextUtility; +import org.bukkit.OfflinePlayer; +import org.bukkit.entity.Player; +import org.bukkit.event.inventory.ClickType; +import org.bukkit.event.inventory.InventoryClickEvent; +import org.bukkit.inventory.ItemStack; +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; + +import java.util.List; + +public class MemberPromptItem extends AbstractItem { + + private String NAME; + private String SOUND; + private int PITCH; + private List LORE; + private ItemStack STACK; + private OfflinePlayer SUBJECT; + + public MemberPromptItem(ItemData data, ItemStack stack, OfflinePlayer player) { + this.NAME = data.getNAME(); + this.SOUND = data.getSOUND(); + this.PITCH = data.getPITCH(); + this.LORE = data.getLORE(); + this.STACK = stack; + this.SUBJECT = player; + } + + @Override + public ItemProvider getItemProvider() { + ItemBuilder builder = new ItemBuilder(STACK) + .setDisplayName(TextUtility.color(NAME.replace("%player_name%", SUBJECT.getName()))); + + for (String loreLine : LORE) { + builder.addLoreLines(TextUtility.color(loreLine)); + } + + return builder; + } + + @Override + public void handleClick(@NotNull ClickType clickType, @NotNull Player player, @NotNull InventoryClickEvent event) { + event.setCancelled(true); + + if (!SOUND.equalsIgnoreCase("none")) { + SoundUtil.playSound(player, SOUND, PITCH, 1); + } + } + + +} diff --git a/src/main/java/net/skullian/torrent/skyfactions/gui/obelisk/FactionAuditLogUI.java b/src/main/java/net/skullian/torrent/skyfactions/gui/obelisk/FactionAuditLogUI.java index 8e481abc..216450d8 100644 --- a/src/main/java/net/skullian/torrent/skyfactions/gui/obelisk/FactionAuditLogUI.java +++ b/src/main/java/net/skullian/torrent/skyfactions/gui/obelisk/FactionAuditLogUI.java @@ -58,11 +58,11 @@ private static PagedGui.Builder registerItems(PagedGui.Builder builder, Player p for (ItemData itemData : data) { switch (itemData.getITEM_ID()) { case "PROMPT": - builder.addIngredient(itemData.getCHARACTER(), new GeneralPromptItem(itemData, GUIAPI.createItem(itemData, player))); + builder.addIngredient(itemData.getCHARACTER(), new GeneralPromptItem(itemData, GUIAPI.createItem(itemData, player.getUniqueId()))); break; case "BACK": - builder.addIngredient(itemData.getCHARACTER(), new ObeliskBackItem(itemData, GUIAPI.createItem(itemData, player), "faction")); + builder.addIngredient(itemData.getCHARACTER(), new ObeliskBackItem(itemData, GUIAPI.createItem(itemData, player.getUniqueId()), "faction")); break; case "MODEL": @@ -70,7 +70,7 @@ private static PagedGui.Builder registerItems(PagedGui.Builder builder, Player p break; case "BORDER": - builder.addIngredient(itemData.getCHARACTER(), new GeneralBorderItem(itemData, GUIAPI.createItem(itemData, player))); + builder.addIngredient(itemData.getCHARACTER(), new GeneralBorderItem(itemData, GUIAPI.createItem(itemData, player.getUniqueId()))); break; } } @@ -78,11 +78,11 @@ private static PagedGui.Builder registerItems(PagedGui.Builder builder, Player p switch (paginationItem.getITEM_ID()) { case "FORWARD_BUTTON": - builder.addIngredient(paginationItem.getCHARACTER(), new PaginationForwardItem(paginationItem, GUIAPI.createItem(paginationItem, player))); + builder.addIngredient(paginationItem.getCHARACTER(), new PaginationForwardItem(paginationItem, GUIAPI.createItem(paginationItem, player.getUniqueId()))); break; case "BACK_BUTTON": - builder.addIngredient(paginationItem.getCHARACTER(), new PaginationBackItem(paginationItem, GUIAPI.createItem(paginationItem, player))); + builder.addIngredient(paginationItem.getCHARACTER(), new PaginationBackItem(paginationItem, GUIAPI.createItem(paginationItem, player.getUniqueId()))); break; } } @@ -99,7 +99,7 @@ private static List getItems(Player player, ItemData data) { List auditLogData = faction.getAuditLogs(); for (AuditLogData auditLog : auditLogData) { - items.add(new AuditPaginationItem(data, GUIAPI.createItem(data, auditLog.getPlayer().getPlayer()), auditLog)); + items.add(new AuditPaginationItem(data, GUIAPI.createItem(data, auditLog.getPlayer().getUniqueId()), auditLog)); } return items; diff --git a/src/main/java/net/skullian/torrent/skyfactions/gui/obelisk/FactionObeliskUI.java b/src/main/java/net/skullian/torrent/skyfactions/gui/obelisk/FactionObeliskUI.java index 5a95a647..fca53f3d 100644 --- a/src/main/java/net/skullian/torrent/skyfactions/gui/obelisk/FactionObeliskUI.java +++ b/src/main/java/net/skullian/torrent/skyfactions/gui/obelisk/FactionObeliskUI.java @@ -53,36 +53,36 @@ private static Gui.Builder.Normal registerItems(Gui.Builder.Normal builder, Play switch (itemData.getITEM_ID()) { case "FACTION": - builder.addIngredient(itemData.getCHARACTER(), new ObeliskFactionOverviewItem(itemData, GUIAPI.createItem(itemData, player), player)); + builder.addIngredient(itemData.getCHARACTER(), new ObeliskFactionOverviewItem(itemData, GUIAPI.createItem(itemData, player.getUniqueId()), player)); break; case "DEFENCES": // todo probably will need to add type for when actually functioning - builder.addIngredient(itemData.getCHARACTER(), new ObeliskDefencesItem(itemData, GUIAPI.createItem(itemData, player))); + builder.addIngredient(itemData.getCHARACTER(), new ObeliskDefencesItem(itemData, GUIAPI.createItem(itemData, player.getUniqueId()))); break; case "RUNES_CONVERSION": - builder.addIngredient(itemData.getCHARACTER(), new ObeliskRuneItem(itemData, GUIAPI.createItem(itemData, player), "faction", player)); + builder.addIngredient(itemData.getCHARACTER(), new ObeliskRuneItem(itemData, GUIAPI.createItem(itemData, player.getUniqueId()), "faction", player)); break; case "MEMBER_MANAGEMENT": - builder.addIngredient(itemData.getCHARACTER(), new ObeliskMemberManagementItem(itemData, GUIAPI.createItem(itemData, player))); + builder.addIngredient(itemData.getCHARACTER(), new ObeliskMemberManagementItem(itemData, GUIAPI.createItem(itemData, player.getUniqueId()))); break; case "AUDIT_LOGS": - builder.addIngredient(itemData.getCHARACTER(), new ObeliskAuditLogItem(itemData, GUIAPI.createItem(itemData, player))); + builder.addIngredient(itemData.getCHARACTER(), new ObeliskAuditLogItem(itemData, GUIAPI.createItem(itemData, player.getUniqueId()))); break; case "INVITES": if (faction.isOwner(player) || faction.isAdmin(player) || faction.isModerator(player)) { - builder.addIngredient(itemData.getCHARACTER(), new ObeliskInvitesItem(itemData, GUIAPI.createItem(itemData, player), "faction")); + builder.addIngredient(itemData.getCHARACTER(), new ObeliskInvitesItem(itemData, GUIAPI.createItem(itemData, player.getUniqueId()), "faction")); } else { Messages.OBELISK_GUI_DENY.send(player, "%rank%", Messages.FACTION_MODERATOR_TITLE.get()); } break; case "BORDER": - builder.addIngredient(itemData.getCHARACTER(), new GeneralBorderItem(itemData, GUIAPI.createItem(itemData, player))); + builder.addIngredient(itemData.getCHARACTER(), new GeneralBorderItem(itemData, GUIAPI.createItem(itemData, player.getUniqueId()))); break; } } diff --git a/src/main/java/net/skullian/torrent/skyfactions/gui/obelisk/PlayerObeliskNotificationUI.java b/src/main/java/net/skullian/torrent/skyfactions/gui/obelisk/PlayerObeliskNotificationUI.java index 1e53306d..3a060512 100644 --- a/src/main/java/net/skullian/torrent/skyfactions/gui/obelisk/PlayerObeliskNotificationUI.java +++ b/src/main/java/net/skullian/torrent/skyfactions/gui/obelisk/PlayerObeliskNotificationUI.java @@ -60,11 +60,11 @@ private static PagedGui.Builder registerItems(PagedGui.Builder builder, Player p for (ItemData itemData : data) { switch (itemData.getITEM_ID()) { case "PROMPT": - builder.addIngredient(itemData.getCHARACTER(), new GeneralPromptItem(itemData, GUIAPI.createItem(itemData, player))); + builder.addIngredient(itemData.getCHARACTER(), new GeneralPromptItem(itemData, GUIAPI.createItem(itemData, player.getUniqueId()))); break; case "BACK": - builder.addIngredient(itemData.getCHARACTER(), new ObeliskBackItem(itemData, GUIAPI.createItem(itemData, player), "player")); + builder.addIngredient(itemData.getCHARACTER(), new ObeliskBackItem(itemData, GUIAPI.createItem(itemData, player.getUniqueId()), "player")); break; case "MODEL": @@ -72,7 +72,7 @@ private static PagedGui.Builder registerItems(PagedGui.Builder builder, Player p break; case "BORDER": - builder.addIngredient(itemData.getCHARACTER(), new GeneralBorderItem(itemData, GUIAPI.createItem(itemData, player))); + builder.addIngredient(itemData.getCHARACTER(), new GeneralBorderItem(itemData, GUIAPI.createItem(itemData, player.getUniqueId()))); break; } } @@ -80,11 +80,11 @@ private static PagedGui.Builder registerItems(PagedGui.Builder builder, Player p switch (paginationItem.getITEM_ID()) { case "FORWARD_BUTTON": - builder.addIngredient(paginationItem.getCHARACTER(), new PaginationForwardItem(paginationItem, GUIAPI.createItem(paginationItem, player))); + builder.addIngredient(paginationItem.getCHARACTER(), new PaginationForwardItem(paginationItem, GUIAPI.createItem(paginationItem, player.getUniqueId()))); break; case "BACK_BUTTON": - builder.addIngredient(paginationItem.getCHARACTER(), new PaginationBackItem(paginationItem, GUIAPI.createItem(paginationItem, player))); + builder.addIngredient(paginationItem.getCHARACTER(), new PaginationBackItem(paginationItem, GUIAPI.createItem(paginationItem, player.getUniqueId()))); break; } } @@ -100,7 +100,7 @@ private static List getItems(Player player, ItemData data) { List notifications = NotificationAPI.getNotifications(Bukkit.getOfflinePlayer(player.getUniqueId())); for (NotificationData notification : notifications) { - items.add(new ObeliskNotificationPaginationItem(data, GUIAPI.createItem(data, player), notification)); + items.add(new ObeliskNotificationPaginationItem(data, GUIAPI.createItem(data, player.getUniqueId()), notification)); } return items; diff --git a/src/main/java/net/skullian/torrent/skyfactions/gui/obelisk/PlayerObeliskUI.java b/src/main/java/net/skullian/torrent/skyfactions/gui/obelisk/PlayerObeliskUI.java index 23464c10..5552183e 100644 --- a/src/main/java/net/skullian/torrent/skyfactions/gui/obelisk/PlayerObeliskUI.java +++ b/src/main/java/net/skullian/torrent/skyfactions/gui/obelisk/PlayerObeliskUI.java @@ -45,27 +45,27 @@ private static Gui.Builder.Normal registerItems(Gui.Builder.Normal builder, Play switch (itemData.getITEM_ID()) { case "HEAD": - builder.addIngredient(itemData.getCHARACTER(), new ObeliskHeadItem(itemData, GUIAPI.createItem(itemData, player), player)); + builder.addIngredient(itemData.getCHARACTER(), new ObeliskHeadItem(itemData, GUIAPI.createItem(itemData, player.getUniqueId()), player)); break; case "DEFENCES": - builder.addIngredient(itemData.getCHARACTER(), new ObeliskDefencesItem(itemData, GUIAPI.createItem(itemData, player))); + builder.addIngredient(itemData.getCHARACTER(), new ObeliskDefencesItem(itemData, GUIAPI.createItem(itemData, player.getUniqueId()))); break; case "RUNES_CONVERSION": - builder.addIngredient(itemData.getCHARACTER(), new ObeliskRuneItem(itemData, GUIAPI.createItem(itemData, player), "player", player)); + builder.addIngredient(itemData.getCHARACTER(), new ObeliskRuneItem(itemData, GUIAPI.createItem(itemData, player.getUniqueId()), "player", player)); break; case "INVITES": - builder.addIngredient(itemData.getCHARACTER(), new ObeliskInvitesItem(itemData, GUIAPI.createItem(itemData, player), "player")); + builder.addIngredient(itemData.getCHARACTER(), new ObeliskInvitesItem(itemData, GUIAPI.createItem(itemData, player.getUniqueId()), "player")); break; case "NOTIFICATIONS": - builder.addIngredient(itemData.getCHARACTER(), new ObeliskPlayerNotificationsItem(itemData, GUIAPI.createItem(itemData, player), player)); + builder.addIngredient(itemData.getCHARACTER(), new ObeliskPlayerNotificationsItem(itemData, GUIAPI.createItem(itemData, player.getUniqueId()), player)); break; case "BORDER": - builder.addIngredient(itemData.getCHARACTER(), new GeneralBorderItem(itemData, GUIAPI.createItem(itemData, player))); + builder.addIngredient(itemData.getCHARACTER(), new GeneralBorderItem(itemData, GUIAPI.createItem(itemData, player.getUniqueId()))); break; } } diff --git a/src/main/java/net/skullian/torrent/skyfactions/gui/obelisk/RuneSubmitUI.java b/src/main/java/net/skullian/torrent/skyfactions/gui/obelisk/RuneSubmitUI.java index 00330004..041a961a 100644 --- a/src/main/java/net/skullian/torrent/skyfactions/gui/obelisk/RuneSubmitUI.java +++ b/src/main/java/net/skullian/torrent/skyfactions/gui/obelisk/RuneSubmitUI.java @@ -123,19 +123,19 @@ private Structure registerItems(Structure builder, Player player, String type) { switch (itemData.getITEM_ID()) { case "PROMPT": - builder.addIngredient(itemData.getCHARACTER(), new GeneralPromptItem(itemData, GUIAPI.createItem(itemData, player))); + builder.addIngredient(itemData.getCHARACTER(), new GeneralPromptItem(itemData, GUIAPI.createItem(itemData, player.getUniqueId()))); break; case "BACK": - builder.addIngredient(itemData.getCHARACTER(), new ObeliskBackItem(itemData, GUIAPI.createItem(itemData, player), type)); + builder.addIngredient(itemData.getCHARACTER(), new ObeliskBackItem(itemData, GUIAPI.createItem(itemData, player.getUniqueId()), type)); break; case "BORDER": - builder.addIngredient(itemData.getCHARACTER(), new GeneralBorderItem(itemData, GUIAPI.createItem(itemData, player))); + builder.addIngredient(itemData.getCHARACTER(), new GeneralBorderItem(itemData, GUIAPI.createItem(itemData, player.getUniqueId()))); break; case "SUBMIT": - builder.addIngredient(itemData.getCHARACTER(), new RuneSubmitItem(itemData, GUIAPI.createItem(itemData, player), type, GUI)); + builder.addIngredient(itemData.getCHARACTER(), new RuneSubmitItem(itemData, GUIAPI.createItem(itemData, player.getUniqueId()), type, GUI)); break; } } diff --git a/src/main/java/net/skullian/torrent/skyfactions/gui/obelisk/invites/FactionInviteTypeSelectionUI.java b/src/main/java/net/skullian/torrent/skyfactions/gui/obelisk/invites/FactionInviteTypeSelectionUI.java index 27e19d11..edfdf4d6 100644 --- a/src/main/java/net/skullian/torrent/skyfactions/gui/obelisk/invites/FactionInviteTypeSelectionUI.java +++ b/src/main/java/net/skullian/torrent/skyfactions/gui/obelisk/invites/FactionInviteTypeSelectionUI.java @@ -46,23 +46,23 @@ private static Gui.Builder.Normal registerItems(Gui.Builder.Normal builder, Play switch (itemData.getITEM_ID()) { case "PROMPT": - builder.addIngredient(itemData.getCHARACTER(), new GeneralPromptItem(itemData, GUIAPI.createItem(itemData, player))); + builder.addIngredient(itemData.getCHARACTER(), new GeneralPromptItem(itemData, GUIAPI.createItem(itemData, player.getUniqueId()))); break; case "OUTGOING_INVITES": - builder.addIngredient(itemData.getCHARACTER(), new OutgoingInvitesTypeItem(itemData, GUIAPI.createItem(itemData, player))); + builder.addIngredient(itemData.getCHARACTER(), new OutgoingInvitesTypeItem(itemData, GUIAPI.createItem(itemData, player.getUniqueId()))); break; case "INCOMING_INVITES": - builder.addIngredient(itemData.getCHARACTER(), new JoinRequestsTypeItem(itemData, GUIAPI.createItem(itemData, player), "faction")); + builder.addIngredient(itemData.getCHARACTER(), new JoinRequestsTypeItem(itemData, GUIAPI.createItem(itemData, player.getUniqueId()), "faction")); break; case "BACK": - builder.addIngredient(itemData.getCHARACTER(), new ObeliskBackItem(itemData, GUIAPI.createItem(itemData, player), "faction")); + builder.addIngredient(itemData.getCHARACTER(), new ObeliskBackItem(itemData, GUIAPI.createItem(itemData, player.getUniqueId()), "faction")); break; case "BORDER": - builder.addIngredient(itemData.getCHARACTER(), new GeneralBorderItem(itemData, GUIAPI.createItem(itemData, player))); + builder.addIngredient(itemData.getCHARACTER(), new GeneralBorderItem(itemData, GUIAPI.createItem(itemData, player.getUniqueId()))); break; } } diff --git a/src/main/java/net/skullian/torrent/skyfactions/gui/obelisk/invites/JoinRequestManageUI.java b/src/main/java/net/skullian/torrent/skyfactions/gui/obelisk/invites/JoinRequestManageUI.java index cea0c6a1..c9dddf91 100644 --- a/src/main/java/net/skullian/torrent/skyfactions/gui/obelisk/invites/JoinRequestManageUI.java +++ b/src/main/java/net/skullian/torrent/skyfactions/gui/obelisk/invites/JoinRequestManageUI.java @@ -47,23 +47,23 @@ private static Gui.Builder.Normal registerItems(Gui.Builder.Normal builder, Play switch (itemData.getITEM_ID()) { case "PROMPT": - builder.addIngredient(itemData.getCHARACTER(), new GeneralPromptItem(itemData, GUIAPI.createItem(itemData, player))); + builder.addIngredient(itemData.getCHARACTER(), new GeneralPromptItem(itemData, GUIAPI.createItem(itemData, player.getUniqueId()))); break; case "BACK": - builder.addIngredient(itemData.getCHARACTER(), new ObeliskBackItem(itemData, GUIAPI.createItem(itemData, player), "faction")); + builder.addIngredient(itemData.getCHARACTER(), new ObeliskBackItem(itemData, GUIAPI.createItem(itemData, player.getUniqueId()), "faction")); break; case "BORDER": - builder.addIngredient(itemData.getCHARACTER(), new GeneralBorderItem(itemData, GUIAPI.createItem(itemData, player))); + builder.addIngredient(itemData.getCHARACTER(), new GeneralBorderItem(itemData, GUIAPI.createItem(itemData, player.getUniqueId()))); break; case "REJECT": - builder.addIngredient(itemData.getCHARACTER(), new FactionJoinRequestRejectItem(itemData, GUIAPI.createItem(itemData, player), inviteData)); + builder.addIngredient(itemData.getCHARACTER(), new FactionJoinRequestRejectItem(itemData, GUIAPI.createItem(itemData, player.getUniqueId()), inviteData)); break; case "ACCEPT": - builder.addIngredient(itemData.getCHARACTER(), new FactionJoinRequestAcceptItem(itemData, GUIAPI.createItem(itemData, player), inviteData)); + builder.addIngredient(itemData.getCHARACTER(), new FactionJoinRequestAcceptItem(itemData, GUIAPI.createItem(itemData, player.getUniqueId()), inviteData)); break; } } diff --git a/src/main/java/net/skullian/torrent/skyfactions/gui/obelisk/invites/JoinRequestsUI.java b/src/main/java/net/skullian/torrent/skyfactions/gui/obelisk/invites/JoinRequestsUI.java index 003c6db4..1546e2a9 100644 --- a/src/main/java/net/skullian/torrent/skyfactions/gui/obelisk/invites/JoinRequestsUI.java +++ b/src/main/java/net/skullian/torrent/skyfactions/gui/obelisk/invites/JoinRequestsUI.java @@ -56,7 +56,7 @@ private static PagedGui.Builder registerItems(PagedGui.Builder builder, Player p for (ItemData itemData : data) { switch (itemData.getITEM_ID()) { case "PROMPT": - builder.addIngredient(itemData.getCHARACTER(), new GeneralPromptItem(itemData, GUIAPI.createItem(itemData, player))); + builder.addIngredient(itemData.getCHARACTER(), new GeneralPromptItem(itemData, GUIAPI.createItem(itemData, player.getUniqueId()))); break; case "MODEL": @@ -64,11 +64,11 @@ private static PagedGui.Builder registerItems(PagedGui.Builder builder, Player p break; case "BACK": - builder.addIngredient(itemData.getCHARACTER(), new ObeliskBackItem(itemData, GUIAPI.createItem(itemData, player), "faction")); + builder.addIngredient(itemData.getCHARACTER(), new ObeliskBackItem(itemData, GUIAPI.createItem(itemData, player.getUniqueId()), "faction")); break; case "BORDER": - builder.addIngredient(itemData.getCHARACTER(), new GeneralBorderItem(itemData, GUIAPI.createItem(itemData, player))); + builder.addIngredient(itemData.getCHARACTER(), new GeneralBorderItem(itemData, GUIAPI.createItem(itemData, player.getUniqueId()))); break; } } @@ -76,11 +76,11 @@ private static PagedGui.Builder registerItems(PagedGui.Builder builder, Player p switch (paginationItem.getITEM_ID()) { case "FORWARD_BUTTON": - builder.addIngredient(paginationItem.getCHARACTER(), new PaginationForwardItem(paginationItem, GUIAPI.createItem(paginationItem, player))); + builder.addIngredient(paginationItem.getCHARACTER(), new PaginationForwardItem(paginationItem, GUIAPI.createItem(paginationItem, player.getUniqueId()))); break; case "BACK_BUTTON": - builder.addIngredient(paginationItem.getCHARACTER(), new PaginationBackItem(paginationItem, GUIAPI.createItem(paginationItem, player))); + builder.addIngredient(paginationItem.getCHARACTER(), new PaginationBackItem(paginationItem, GUIAPI.createItem(paginationItem, player.getUniqueId()))); break; } } @@ -103,7 +103,7 @@ private static List getItems(Player player, ItemData itemData) { List data = faction.getJoinRequests(); for (InviteData inviteData : data) { itemData.setNAME(itemData.getNAME().replace("%player_name%", inviteData.getPlayer().getName())); - items.add(new FactionJoinRequestPaginationItem(itemData, GUIAPI.createItem(itemData, inviteData.getPlayer().getPlayer()), inviteData.getPlayer(), inviteData)); + items.add(new FactionJoinRequestPaginationItem(itemData, GUIAPI.createItem(itemData, inviteData.getPlayer().getUniqueId()), inviteData.getPlayer(), inviteData)); } return items; diff --git a/src/main/java/net/skullian/torrent/skyfactions/gui/obelisk/invites/OutgoingInvitesUI.java b/src/main/java/net/skullian/torrent/skyfactions/gui/obelisk/invites/OutgoingInvitesUI.java index f76743d9..05392b9e 100644 --- a/src/main/java/net/skullian/torrent/skyfactions/gui/obelisk/invites/OutgoingInvitesUI.java +++ b/src/main/java/net/skullian/torrent/skyfactions/gui/obelisk/invites/OutgoingInvitesUI.java @@ -56,7 +56,7 @@ private static PagedGui.Builder registerItems(PagedGui.Builder builder, Player p for (ItemData itemData : data) { switch (itemData.getITEM_ID()) { case "PROMPT": - builder.addIngredient(itemData.getCHARACTER(), new GeneralPromptItem(itemData, GUIAPI.createItem(itemData, player))); + builder.addIngredient(itemData.getCHARACTER(), new GeneralPromptItem(itemData, GUIAPI.createItem(itemData, player.getUniqueId()))); break; case "MODEL": @@ -64,11 +64,11 @@ private static PagedGui.Builder registerItems(PagedGui.Builder builder, Player p break; case "BACK": - builder.addIngredient(itemData.getCHARACTER(), new ObeliskBackItem(itemData, GUIAPI.createItem(itemData, player), "faction")); + builder.addIngredient(itemData.getCHARACTER(), new ObeliskBackItem(itemData, GUIAPI.createItem(itemData, player.getUniqueId()), "faction")); break; case "BORDER": - builder.addIngredient(itemData.getCHARACTER(), new GeneralBorderItem(itemData, GUIAPI.createItem(itemData, player))); + builder.addIngredient(itemData.getCHARACTER(), new GeneralBorderItem(itemData, GUIAPI.createItem(itemData, player.getUniqueId()))); break; } } @@ -76,11 +76,11 @@ private static PagedGui.Builder registerItems(PagedGui.Builder builder, Player p switch (paginationItem.getITEM_ID()) { case "FORWARD_BUTTON": - builder.addIngredient(paginationItem.getCHARACTER(), new PaginationForwardItem(paginationItem, GUIAPI.createItem(paginationItem, player))); + builder.addIngredient(paginationItem.getCHARACTER(), new PaginationForwardItem(paginationItem, GUIAPI.createItem(paginationItem, player.getUniqueId()))); break; case "BACK_BUTTON": - builder.addIngredient(paginationItem.getCHARACTER(), new PaginationBackItem(paginationItem, GUIAPI.createItem(paginationItem, player))); + builder.addIngredient(paginationItem.getCHARACTER(), new PaginationBackItem(paginationItem, GUIAPI.createItem(paginationItem, player.getUniqueId()))); break; } } @@ -104,7 +104,7 @@ private static List getItems(Player player, ItemData itemData) { List data = faction.getOutgoingInvites(); for (InviteData inviteData : data) { itemData.setNAME(itemData.getNAME().replace("%player_name%", inviteData.getPlayer().getName())); - items.add(new OutgoingInvitePaginationItem(itemData, GUIAPI.createItem(itemData, inviteData.getPlayer().getPlayer()), inviteData)); + items.add(new OutgoingInvitePaginationItem(itemData, GUIAPI.createItem(itemData, inviteData.getPlayer().getUniqueId()), inviteData)); } return items; diff --git a/src/main/java/net/skullian/torrent/skyfactions/gui/obelisk/invites/PlayerIncomingInvites.java b/src/main/java/net/skullian/torrent/skyfactions/gui/obelisk/invites/PlayerIncomingInvites.java index 24d6985d..513ddcba 100644 --- a/src/main/java/net/skullian/torrent/skyfactions/gui/obelisk/invites/PlayerIncomingInvites.java +++ b/src/main/java/net/skullian/torrent/skyfactions/gui/obelisk/invites/PlayerIncomingInvites.java @@ -56,7 +56,7 @@ private static PagedGui.Builder registerItems(PagedGui.Builder builder, Player p for (ItemData itemData : data) { switch (itemData.getITEM_ID()) { case "PROMPT": - builder.addIngredient(itemData.getCHARACTER(), new GeneralPromptItem(itemData, GUIAPI.createItem(itemData, player))); + builder.addIngredient(itemData.getCHARACTER(), new GeneralPromptItem(itemData, GUIAPI.createItem(itemData, player.getUniqueId()))); break; case "MODEL": @@ -64,11 +64,11 @@ private static PagedGui.Builder registerItems(PagedGui.Builder builder, Player p break; case "BACK": - builder.addIngredient(itemData.getCHARACTER(), new ObeliskBackItem(itemData, GUIAPI.createItem(itemData, player), "player")); + builder.addIngredient(itemData.getCHARACTER(), new ObeliskBackItem(itemData, GUIAPI.createItem(itemData, player.getUniqueId()), "player")); break; case "BORDER": - builder.addIngredient(itemData.getCHARACTER(), new GeneralBorderItem(itemData, GUIAPI.createItem(itemData, player))); + builder.addIngredient(itemData.getCHARACTER(), new GeneralBorderItem(itemData, GUIAPI.createItem(itemData, player.getUniqueId()))); break; } } @@ -76,11 +76,11 @@ private static PagedGui.Builder registerItems(PagedGui.Builder builder, Player p switch (paginationItem.getITEM_ID()) { case "FORWARD_BUTTON": - builder.addIngredient(paginationItem.getCHARACTER(), new PaginationForwardItem(paginationItem, GUIAPI.createItem(paginationItem, player))); + builder.addIngredient(paginationItem.getCHARACTER(), new PaginationForwardItem(paginationItem, GUIAPI.createItem(paginationItem, player.getUniqueId()))); break; case "BACK_BUTTON": - builder.addIngredient(paginationItem.getCHARACTER(), new PaginationBackItem(paginationItem, GUIAPI.createItem(paginationItem, player))); + builder.addIngredient(paginationItem.getCHARACTER(), new PaginationBackItem(paginationItem, GUIAPI.createItem(paginationItem, player.getUniqueId()))); break; } } @@ -99,7 +99,7 @@ private static List getItems(Player player, ItemData itemData) { List data = SkyFactionsReborn.db.getInvitesOfPlayer(Bukkit.getOfflinePlayer(player.getUniqueId())).join(); for (InviteData inviteData : data) { itemData.setNAME(itemData.getNAME().replace("%faction_name%", inviteData.getFactionName())); - items.add(new PlayerFactionInvitePaginationItem(itemData, GUIAPI.createItem(itemData, inviteData.getInviter().getPlayer()), inviteData.getPlayer(), inviteData)); + items.add(new PlayerFactionInvitePaginationItem(itemData, GUIAPI.createItem(itemData, inviteData.getInviter().getUniqueId()), inviteData.getPlayer(), inviteData)); } return items; diff --git a/src/main/java/net/skullian/torrent/skyfactions/gui/obelisk/invites/PlayerInviteTypeSelectionUI.java b/src/main/java/net/skullian/torrent/skyfactions/gui/obelisk/invites/PlayerInviteTypeSelectionUI.java index 8e66958f..05b74901 100644 --- a/src/main/java/net/skullian/torrent/skyfactions/gui/obelisk/invites/PlayerInviteTypeSelectionUI.java +++ b/src/main/java/net/skullian/torrent/skyfactions/gui/obelisk/invites/PlayerInviteTypeSelectionUI.java @@ -49,23 +49,23 @@ private static Gui.Builder.Normal registerItems(Gui.Builder.Normal builder, Play switch (itemData.getITEM_ID()) { case "PROMPT": - builder.addIngredient(itemData.getCHARACTER(), new GeneralPromptItem(itemData, GUIAPI.createItem(itemData, player))); + builder.addIngredient(itemData.getCHARACTER(), new GeneralPromptItem(itemData, GUIAPI.createItem(itemData, player.getUniqueId()))); break; case "OUTGOING_JOIN_REQUEST": - builder.addIngredient(itemData.getCHARACTER(), new JoinRequestsTypeItem(itemData, GUIAPI.createItem(itemData, player), "player")); + builder.addIngredient(itemData.getCHARACTER(), new JoinRequestsTypeItem(itemData, GUIAPI.createItem(itemData, player.getUniqueId()), "player")); break; case "INCOMING_INVITES": - builder.addIngredient(itemData.getCHARACTER(), new PlayerFactionInvitesTypeItem(itemData, GUIAPI.createItem(itemData, player))); + builder.addIngredient(itemData.getCHARACTER(), new PlayerFactionInvitesTypeItem(itemData, GUIAPI.createItem(itemData, player.getUniqueId()))); break; case "BACK": - builder.addIngredient(itemData.getCHARACTER(), new ObeliskBackItem(itemData, GUIAPI.createItem(itemData, player), "player")); + builder.addIngredient(itemData.getCHARACTER(), new ObeliskBackItem(itemData, GUIAPI.createItem(itemData, player.getUniqueId()), "player")); break; case "BORDER": - builder.addIngredient(itemData.getCHARACTER(), new GeneralBorderItem(itemData, GUIAPI.createItem(itemData, player))); + builder.addIngredient(itemData.getCHARACTER(), new GeneralBorderItem(itemData, GUIAPI.createItem(itemData, player.getUniqueId()))); break; } } diff --git a/src/main/java/net/skullian/torrent/skyfactions/gui/obelisk/invites/PlayerManageIncomingInviteUI.java b/src/main/java/net/skullian/torrent/skyfactions/gui/obelisk/invites/PlayerManageIncomingInviteUI.java new file mode 100644 index 00000000..161884a6 --- /dev/null +++ b/src/main/java/net/skullian/torrent/skyfactions/gui/obelisk/invites/PlayerManageIncomingInviteUI.java @@ -0,0 +1,72 @@ +package net.skullian.torrent.skyfactions.gui.obelisk.invites; + +import net.skullian.torrent.skyfactions.api.GUIAPI; +import net.skullian.torrent.skyfactions.config.Messages; +import net.skullian.torrent.skyfactions.db.InviteData; +import net.skullian.torrent.skyfactions.gui.data.GUIData; +import net.skullian.torrent.skyfactions.gui.data.ItemData; +import net.skullian.torrent.skyfactions.gui.items.GeneralBorderItem; +import net.skullian.torrent.skyfactions.gui.items.obelisk.ObeliskBackItem; +import net.skullian.torrent.skyfactions.gui.items.obelisk.invites.PlayerIncomingInviteAccept; +import net.skullian.torrent.skyfactions.gui.items.obelisk.invites.PlayerIncomingInviteDeny; +import net.skullian.torrent.skyfactions.gui.items.obelisk.invites.PlayerIncomingInvitePromptItem; +import net.skullian.torrent.skyfactions.util.SoundUtil; +import net.skullian.torrent.skyfactions.util.text.TextUtility; +import org.bukkit.entity.Player; +import xyz.xenondevs.invui.gui.Gui; +import xyz.xenondevs.invui.window.Window; + +import java.util.List; + +public class PlayerManageIncomingInviteUI { + + public static void promptPlayer(Player player, InviteData inviteData) { + try { + GUIData data = GUIAPI.getGUIData("obelisk/invites/player_invite_manage"); + Gui.Builder.Normal gui = registerItems(Gui.normal() + .setStructure(data.getLAYOUT()), player, inviteData); + + Window window = Window.single() + .setViewer(player) + .setTitle(TextUtility.color(data.getTITLE())) + .setGui(gui) + .build(); + + SoundUtil.playSound(player, data.getOPEN_SOUND(), data.getOPEN_PITCH(), 1f); + window.open(); + } catch (IllegalArgumentException error) { + error.printStackTrace(); + Messages.ERROR.send(player, "%operation%", "manage an incoming Faction invite", "%debug%", "GUI_LOAD_EXCEPTION"); + } + } + + private static Gui.Builder.Normal registerItems(Gui.Builder.Normal builder, Player player, InviteData inviteData) { + List data = GUIAPI.getItemData("obelisk/invites/player_invite_manage", player); + for (ItemData itemData : data) { + + switch (itemData.getITEM_ID()) { + case "PROMPT": + builder.addIngredient(itemData.getCHARACTER(), new PlayerIncomingInvitePromptItem(itemData, GUIAPI.createItem(itemData, player.getUniqueId()), inviteData)); + break; + + case "ACCEPT": + builder.addIngredient(itemData.getCHARACTER(), new PlayerIncomingInviteAccept(itemData, GUIAPI.createItem(itemData, player.getUniqueId()), inviteData)); + break; + + case "DENY": + builder.addIngredient(itemData.getCHARACTER(), new PlayerIncomingInviteDeny(itemData, GUIAPI.createItem(itemData, player.getUniqueId()), inviteData)); + break; + + case "BACK": + builder.addIngredient(itemData.getCHARACTER(), new ObeliskBackItem(itemData, GUIAPI.createItem(itemData, player.getUniqueId()), "player")); + break; + + case "BORDER": + builder.addIngredient(itemData.getCHARACTER(), new GeneralBorderItem(itemData, GUIAPI.createItem(itemData, player.getUniqueId()))); + break; + } + } + + return builder; + } +} diff --git a/src/main/java/net/skullian/torrent/skyfactions/gui/obelisk/invites/PlayerOutgoingRequestManageUI.java b/src/main/java/net/skullian/torrent/skyfactions/gui/obelisk/invites/PlayerOutgoingRequestManageUI.java index da497d36..843819da 100644 --- a/src/main/java/net/skullian/torrent/skyfactions/gui/obelisk/invites/PlayerOutgoingRequestManageUI.java +++ b/src/main/java/net/skullian/torrent/skyfactions/gui/obelisk/invites/PlayerOutgoingRequestManageUI.java @@ -5,10 +5,12 @@ import net.skullian.torrent.skyfactions.faction.JoinRequestData; import net.skullian.torrent.skyfactions.gui.data.GUIData; import net.skullian.torrent.skyfactions.gui.data.ItemData; +import net.skullian.torrent.skyfactions.gui.items.GeneralBorderItem; import net.skullian.torrent.skyfactions.gui.items.GeneralPromptItem; import net.skullian.torrent.skyfactions.gui.items.obelisk.invites.FactionPlayerJoinRequestConfirmItem; import net.skullian.torrent.skyfactions.gui.items.obelisk.invites.FactionPlayerJoinRequestDenyItem; import net.skullian.torrent.skyfactions.gui.items.obelisk.invites.FactionPlayerJoinRequestRevoke; +import net.skullian.torrent.skyfactions.gui.items.obelisk.invites.PlayerJoinRequestPromptItem; import net.skullian.torrent.skyfactions.util.SoundUtil; import net.skullian.torrent.skyfactions.util.text.TextUtility; import org.bukkit.entity.Player; @@ -46,28 +48,28 @@ private static Gui.Builder.Normal registerItems(Gui.Builder.Normal builder, Play switch (itemData.getITEM_ID()) { case "PROMPT": - builder.addIngredient(itemData.getCHARACTER(), new GeneralPromptItem(itemData, GUIAPI.createItem(itemData, player))); + builder.addIngredient(itemData.getCHARACTER(), new PlayerJoinRequestPromptItem(itemData, GUIAPI.createItem(itemData, player.getUniqueId()), joinRequest)); break; case "ACCEPT": if (joinRequest.isAccepted()) { - builder.addIngredient(itemData.getCHARACTER(), new FactionPlayerJoinRequestConfirmItem(itemData, GUIAPI.createItem(itemData, player), joinRequest)); + builder.addIngredient(itemData.getCHARACTER(), new FactionPlayerJoinRequestConfirmItem(itemData, GUIAPI.createItem(itemData, player.getUniqueId()), joinRequest)); } break; case "DENY": if (joinRequest.isAccepted()) { - builder.addIngredient(itemData.getCHARACTER(), new FactionPlayerJoinRequestDenyItem(itemData, GUIAPI.createItem(itemData, player), joinRequest)); + builder.addIngredient(itemData.getCHARACTER(), new FactionPlayerJoinRequestDenyItem(itemData, GUIAPI.createItem(itemData, player.getUniqueId()), joinRequest)); } break; case "REVOKE": - if (!joinRequest.isAccepted()) { - builder.addIngredient(itemData.getCHARACTER(), new FactionPlayerJoinRequestRevoke(itemData, GUIAPI.createItem(itemData, player), joinRequest)); - } + builder.addIngredient(itemData.getCHARACTER(), new FactionPlayerJoinRequestRevoke(itemData, GUIAPI.createItem(itemData, player.getUniqueId()), joinRequest)); break; - + case "BORDER": + builder.addIngredient(itemData.getCHARACTER(), new GeneralBorderItem(itemData, GUIAPI.createItem(itemData, player.getUniqueId()))); + break; } } diff --git a/src/main/java/net/skullian/torrent/skyfactions/gui/obelisk/member/ManageMemberUI.java b/src/main/java/net/skullian/torrent/skyfactions/gui/obelisk/member/ManageMemberUI.java index fefdf49d..970e6cb5 100644 --- a/src/main/java/net/skullian/torrent/skyfactions/gui/obelisk/member/ManageMemberUI.java +++ b/src/main/java/net/skullian/torrent/skyfactions/gui/obelisk/member/ManageMemberUI.java @@ -54,25 +54,25 @@ private static Gui.Builder.Normal registerItems(Gui.Builder.Normal builder, Offl switch (itemData.getITEM_ID()) { case "BORDER": - builder.addIngredient(itemData.getCHARACTER(), new GeneralBorderItem(itemData, GUIAPI.createItem(itemData, player))); + builder.addIngredient(itemData.getCHARACTER(), new GeneralBorderItem(itemData, GUIAPI.createItem(itemData, player.getUniqueId()))); break; case "PLAYER_HEAD": - builder.addIngredient(itemData.getCHARACTER(), new GeneralPromptItem(itemData, GUIAPI.createItem(itemData, player))); + builder.addIngredient(itemData.getCHARACTER(), new GeneralPromptItem(itemData, GUIAPI.createItem(itemData, player.getUniqueId()))); break; case "KICK": - builder.addIngredient(itemData.getCHARACTER(), new MemberKickItem(itemData, GUIAPI.createItem(itemData, player), player)); + builder.addIngredient(itemData.getCHARACTER(), new MemberKickItem(itemData, GUIAPI.createItem(itemData, player.getUniqueId()), player)); break; case "BAN": if (faction.isOwner(actor) || faction.isAdmin(actor)) { - builder.addIngredient(itemData.getCHARACTER(), new MemberBanItem(itemData, GUIAPI.createItem(itemData, player), player)); + builder.addIngredient(itemData.getCHARACTER(), new MemberBanItem(itemData, GUIAPI.createItem(itemData, player.getUniqueId()), player)); } break; case "BACK": - builder.addIngredient(itemData.getCHARACTER(), new ObeliskBackItem(itemData, GUIAPI.createItem(itemData, player), "faction")); + builder.addIngredient(itemData.getCHARACTER(), new ObeliskBackItem(itemData, GUIAPI.createItem(itemData, player.getUniqueId()), "faction")); break; } } diff --git a/src/main/java/net/skullian/torrent/skyfactions/gui/obelisk/member/MemberManagementUI.java b/src/main/java/net/skullian/torrent/skyfactions/gui/obelisk/member/MemberManagementUI.java index 7f79e192..df9a2511 100644 --- a/src/main/java/net/skullian/torrent/skyfactions/gui/obelisk/member/MemberManagementUI.java +++ b/src/main/java/net/skullian/torrent/skyfactions/gui/obelisk/member/MemberManagementUI.java @@ -56,7 +56,7 @@ private static PagedGui.Builder registerItems(PagedGui.Builder builder, Player p for (ItemData itemData : data) { switch (itemData.getITEM_ID()) { case "PROMPT": - builder.addIngredient(itemData.getCHARACTER(), new GeneralPromptItem(itemData, GUIAPI.createItem(itemData, player))); + builder.addIngredient(itemData.getCHARACTER(), new GeneralPromptItem(itemData, GUIAPI.createItem(itemData, player.getUniqueId()))); break; case "MODEL": @@ -64,11 +64,11 @@ private static PagedGui.Builder registerItems(PagedGui.Builder builder, Player p break; case "BACK": - builder.addIngredient(itemData.getCHARACTER(), new ObeliskBackItem(itemData, GUIAPI.createItem(itemData, player), "faction")); + builder.addIngredient(itemData.getCHARACTER(), new ObeliskBackItem(itemData, GUIAPI.createItem(itemData, player.getUniqueId()), "faction")); break; case "BORDER": - builder.addIngredient(itemData.getCHARACTER(), new GeneralBorderItem(itemData, GUIAPI.createItem(itemData, player))); + builder.addIngredient(itemData.getCHARACTER(), new GeneralBorderItem(itemData, GUIAPI.createItem(itemData, player.getUniqueId()))); break; } } @@ -76,11 +76,11 @@ private static PagedGui.Builder registerItems(PagedGui.Builder builder, Player p switch (paginationItem.getITEM_ID()) { case "FORWARD_BUTTON": - builder.addIngredient(paginationItem.getCHARACTER(), new PaginationForwardItem(paginationItem, GUIAPI.createItem(paginationItem, player))); + builder.addIngredient(paginationItem.getCHARACTER(), new PaginationForwardItem(paginationItem, GUIAPI.createItem(paginationItem, player.getUniqueId()))); break; case "BACK_BUTTON": - builder.addIngredient(paginationItem.getCHARACTER(), new PaginationBackItem(paginationItem, GUIAPI.createItem(paginationItem, player))); + builder.addIngredient(paginationItem.getCHARACTER(), new PaginationBackItem(paginationItem, GUIAPI.createItem(paginationItem, player.getUniqueId()))); break; } } @@ -104,23 +104,23 @@ private static List getItems(Player player, ItemData data) { List members = faction.getMembers(); data.setNAME(data.getNAME().replace("%player_name%", owner.getName())); - items.add(new MemberPaginationItem(data, GUIAPI.createItem(data, owner.getPlayer()), Messages.FACTION_OWNER_TITLE.get(), owner, player)); + items.add(new MemberPaginationItem(data, GUIAPI.createItem(data, owner.getUniqueId()), Messages.FACTION_OWNER_TITLE.get(), owner, player)); for (OfflinePlayer admin : admins) { data.setNAME(data.getNAME().replace("%player_name%", admin.getName())); - items.add(new MemberPaginationItem(data, GUIAPI.createItem(data, admin.getPlayer()), Messages.FACTION_ADMIN_TITLE.get(), admin, player)); + items.add(new MemberPaginationItem(data, GUIAPI.createItem(data, admin.getUniqueId()), Messages.FACTION_ADMIN_TITLE.get(), admin, player)); } for (OfflinePlayer moderator : moderators) { data.setNAME(data.getNAME().replace("%player_name%", moderator.getName())); - items.add(new MemberPaginationItem(data, GUIAPI.createItem(data, moderator.getPlayer()), Messages.FACTION_MODERATOR_TITLE.get(), moderator, player)); + items.add(new MemberPaginationItem(data, GUIAPI.createItem(data, moderator.getUniqueId()), Messages.FACTION_MODERATOR_TITLE.get(), moderator, player)); } for (OfflinePlayer fighter : fighters) { data.setNAME(data.getNAME().replace("%player_name%", fighter.getName())); - items.add(new MemberPaginationItem(data, GUIAPI.createItem(data, fighter.getPlayer()), Messages.FACTION_FIGHTER_TITLE.get(), fighter, player)); + items.add(new MemberPaginationItem(data, GUIAPI.createItem(data, fighter.getUniqueId()), Messages.FACTION_FIGHTER_TITLE.get(), fighter, player)); } for (OfflinePlayer member : members) { data.setNAME(data.getNAME().replace("%player_name%", member.getName())); - items.add(new MemberPaginationItem(data, GUIAPI.createItem(data, member.getPlayer()), Messages.FACTION_MEMBER_TITLE.get(), member, player)); + items.add(new MemberPaginationItem(data, GUIAPI.createItem(data, member.getUniqueId()), Messages.FACTION_MEMBER_TITLE.get(), member, player)); } return items; diff --git a/src/main/java/net/skullian/torrent/skyfactions/notification/NotificationTask.java b/src/main/java/net/skullian/torrent/skyfactions/notification/NotificationTask.java index 9dde7794..b4addf63 100644 --- a/src/main/java/net/skullian/torrent/skyfactions/notification/NotificationTask.java +++ b/src/main/java/net/skullian/torrent/skyfactions/notification/NotificationTask.java @@ -23,6 +23,7 @@ public void run() { if (isInFaction) { Faction faction = FactionAPI.getFaction(player); + if (faction == null) return; if (NotificationAPI.factionInviteStore.containsKey(faction.getName())) { int factionJoinRequestCount = NotificationAPI.factionInviteStore.get(faction.getName()); if (factionJoinRequestCount > 0 && (faction.isOwner(player) || faction.isAdmin(player) || faction.isModerator(player))) { diff --git a/src/main/java/net/skullian/torrent/skyfactions/util/text/TextUtility.java b/src/main/java/net/skullian/torrent/skyfactions/util/text/TextUtility.java index d91f7ddd..bb36805a 100644 --- a/src/main/java/net/skullian/torrent/skyfactions/util/text/TextUtility.java +++ b/src/main/java/net/skullian/torrent/skyfactions/util/text/TextUtility.java @@ -1,11 +1,10 @@ package net.skullian.torrent.skyfactions.util.text; -import com.fasterxml.jackson.databind.ObjectMapper; import net.skullian.torrent.skyfactions.config.Messages; import net.skullian.torrent.skyfactions.config.Settings; import org.bukkit.entity.Player; +import org.jetbrains.annotations.NotNull; -import javax.annotation.Nullable; import java.time.Duration; import java.util.Arrays; import java.util.List; @@ -17,8 +16,6 @@ public static String color (final String string) { return ColorAPI.process(string); } - public static final ObjectMapper objectMapper = new ObjectMapper(); - public static String fromList(List list) { if (list == null || list.isEmpty()) return null; StringBuilder builder = new StringBuilder(); @@ -32,7 +29,7 @@ public static String fromList(List list) { return builder.toString(); } - public static boolean isEnglish(@Nullable CharSequence seq) { + public static boolean isEnglish(@NotNull CharSequence seq) { if (seq == null) { return false; } else { @@ -80,7 +77,7 @@ public static boolean hasBlacklistedWords(Player player, String name) { } } - public static boolean hasSymbols(@Nullable CharSequence seq) { + public static boolean hasSymbols(@NotNull CharSequence seq) { if (seq == null) { return false; } else { @@ -99,7 +96,7 @@ public static boolean hasSymbols(@Nullable CharSequence seq) { } } - public static boolean containsNumbers(@Nullable CharSequence seq) { + public static boolean containsNumbers(@NotNull CharSequence seq) { if (seq == null) { return false; } else { diff --git a/src/main/resources/guis/obelisk/invites/player_invite_manage.yml b/src/main/resources/guis/obelisk/invites/player_invite_manage.yml new file mode 100644 index 00000000..5ea929b8 --- /dev/null +++ b/src/main/resources/guis/obelisk/invites/player_invite_manage.yml @@ -0,0 +1,79 @@ +# Title of the GUI (Inventory) +TITLE: "&9View Faction Invite" +OPEN_SOUND: "ui.button.click" +OPEN_PITCH: 1 + +# This allows you to customise the shape of the GUI. +# You can only have a maximum of 54 slots (9 x 6). +# Each character represents an item / slot. +# '.' represents an empty slot. +# Any other characters are shown below under ITEMS +# Each character corresponds to an item. + +# This GUI allows players to view their outgoing join request. +# The Accept (a) and Deny (d) buttons will only appear if the join request had been accepted, +# therefore the player can choose to proceed and join the faction, or deny. + +LAYOUT: + - "b # # # # # # # #" + - "# . . . p . . . #" + - "# . a . . . d . #" + - "# # # # # # # # #" + +ITEMS: + PROMPT: + char: "p" # This is the character to use in the LAYOUT! + material: "PLAYER_HEAD" + skull: "eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvNTczZGI5NmY3YjlmNzhlZGU5MjY5NDEwYzY1OTI4NWZjYTIwZWZiYzhkZmE5ZGVmZjRiYmU1NDM0OTNhNDQ0NSJ9fX0=" # You can set custom skull textures (e.g. from minecraft-heads.com). 'material' MUST BE SET TO 'PLAYER_HEAD'. Placeholders: %player_skull% - Skull texture of the player. + text: "&c&l%faction_name%" # Placeholders: %faction_name% - Name of the Faction you are requesting to join. + sound: "" # Sound played when the item is clicked. Set to 'none' to disable. + pitch: 1 # Pitch of the sound. Does not apply if 'sound' is 'none.'. + lore: + - "nothing here atm" + + # Back button, return to the main Obelisk UI + BACK: + char: "b" + material: "BARRIER" + skull: "" + text: "&c&oBack" + sound: "" # The obelisk UI by default is set to make a sound. Don't want to trigger it twice. + pitch: 1 + lore: "" + + # Accept the invite. + ACCEPT: + char: "a" + material: "PLAYER_HEAD" + skull: "eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvZWVmZDRjZmE5MTQzMzk4ZTExZWJjZTNmYjJlY2JiZjU2YTA3M2UzNTYzZjZlZjZhY2FlNGNiNzM5N2U1ODhiMiJ9fX0=" + text: "&aAccept" + sound: "" + pitch: 1 + lore: + - "&eClick me to accept the invite." + - "" + - "&7You will immediately join" + - "&7the Faction." + + # If the join request was accepted by the Faction in question, you can choose to deny it instead. + DENY: + char: "d" + material: "PLAYER_HEAD" + skull: "eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvZDZhZTIxMWI0NDAzYjg5NjNjNjc0NWYzYzk4ZWJlNzNhMmI0ZTk3YzQwYTc4YjJmZDQwM2EwOWMwZmNhZDZkIn19fQ==" + text: "&cDeny" + sound: "" + pitch: 1 + lore: + - "&cClick me to deny the invite." + - "" + - "&7This is a permanent and" + - "&7irreversible action." + + BORDER: + char: "#" + material: "GRAY_STAINED_GLASS_PANE" + skull: "" + text: " " # No text + sound: "none" + pitch: 1 + lore: "" # Empty lore \ No newline at end of file diff --git a/src/main/resources/guis/obelisk/invites/player_join_request.yml b/src/main/resources/guis/obelisk/invites/player_join_request.yml index a6830329..adcf4274 100644 --- a/src/main/resources/guis/obelisk/invites/player_join_request.yml +++ b/src/main/resources/guis/obelisk/invites/player_join_request.yml @@ -1,5 +1,5 @@ # Title of the GUI (Inventory) -TITLE: "&eView Join Request" +TITLE: "&9View Join Request" OPEN_SOUND: "ui.button.click" OPEN_PITCH: 1 @@ -30,9 +30,7 @@ ITEMS: sound: "" # Sound played when the item is clicked. Set to 'none' to disable. pitch: 1 # Pitch of the sound. Does not apply if 'sound' is 'none.'. lore: - - "&eView either your incoming" - - "&ejoin requests, or outgoing" - - "&einvites." + - "nothing here atm" # Back button, return to the main Obelisk UI BACK: diff --git a/src/main/resources/messages.yml b/src/main/resources/messages.yml index 21088456..991706cf 100644 --- a/src/main/resources/messages.yml +++ b/src/main/resources/messages.yml @@ -238,7 +238,7 @@ Messages: FACTION_LEAVE: # Sent when a player successfully leaves a faction. # Placeholders: %faction_name% - Name of the faction. - FACTION_LEAVE_SUCCESS: "%server_name% &c&oYou have successfully left %faction_name%." + FACTION_LEAVE_SUCCESS: "%server_name% &aYou have successfully left &e%faction_name%." # Sent when the faction owner tries to leave the faction. FACTION_OWNER_LEAVE_DENY: "%server_name% &cYou cannot leave this faction because you are the owner!" @@ -327,9 +327,9 @@ Messages: # Placeholders: %faction_name% - Name of the Faction your join request WAS going to. JOIN_REQUEST_REVOKE_SUCCESS: "%server_name% &aYour join request to &e%faction_name% &ahas been revoked." - # Sent when a player confirms the acceptance of their join request. + # Sent when a player confirms the acceptance of their join request, or accepted a Faction invite. # Placeholders: %faction_name% - Name of the Faction you are now part of. - PLAYER_JOIN_REQUEST_ACCEPT_SUCCESS: "%server_name% &eYou are now part of the Faction &a%faction_name%!" + PLAYER_FACTION_JOIN_SUCCESS: "%server_name% &eYou are now part of the Faction &a%faction_name%!" # Sent when a player, after their join request is accepted by the Faction, rejects it. # Placeholders: %faction_name% - Name of the Faction your join request was going to. @@ -343,6 +343,10 @@ Messages: # Placeholders: %faction_name% - Name of the Faction. JOIN_REQUEST_REJECT_NOTIFICATION: "%server_name% &eYour join request to &c&l%faction_name%&r&e has been rejected." + # Sent to the player when they denied a Faction's invite. + # Placeholders: %faction_name% - Name of the Faction. + FACTION_INVITE_DENY_SUCCESS: "%server_name% &eYou successfully denied &a%faction_name%'s &einvite." + Notifications: # Sent when a player has a pending Faction invitation in their Obelisk. # Placeholders: %count% - Amount of pending Faction invitations. @@ -504,3 +508,13 @@ Messages: PLAYER_JOIN_REQUEST_DENY_TITLE: "&c&lJoin Request Denied" PLAYER_JOIN_REQUEST_DENY_DESCRIPTION: "&a%player_name% &edenied your acceptance/of their join request." + # Sent when a player accepts a Faction's invite. + # Placeholders: %player_name% - Player who accepted the invite. + INVITE_ACCEPT_TITLE: "&a&lInvite Accepted" + INVITE_ACCEPT_DESCRIPTION: "&a%player_name% &eaccepted your Faction invite." + + # Sent when a player denies a Faction's invite. + # Placeholders: %player_name% - Player who denied the invite. + INVITE_DENY_TITLE: "&c&lInvite Denied" + INVITE_DENY_DESCRIPTION: "&a%player_name% &edenied your Faction invite." + diff --git a/src/main/resources/plugin.yml b/src/main/resources/plugin.yml index 8328fade..63dd5628 100644 --- a/src/main/resources/plugin.yml +++ b/src/main/resources/plugin.yml @@ -101,6 +101,7 @@ permissions: libraries: - "com.zaxxer:HikariCP:5.1.0" + - "org.xerial:sqlite-jdbc:3.46.0.0" - "net.dv8tion:JDA:5.0.1" - "com.fasterxml.jackson.core:jackson-databind:2.17.2" - "com.jeff-media:custom-block-data:2.2.2" @@ -113,4 +114,4 @@ libraries: - "com.fasterxml.jackson.core:jackson-core:2.17.0" - "com.fasterxml.jackson.core:jackson-annotations:2.17.2" - "org.slf4j:slf4j-api:2.0.9" - - "org.jetbrains:annotations:23.0.0" + - "org.jetbrains:annotations:23.0.0" \ No newline at end of file