diff --git a/Plugins/Mineplex.Core/src/mineplex/core/party/Lang.java b/Plugins/Mineplex.Core/src/mineplex/core/party/Lang.java index 1826241a7..57da4496a 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/party/Lang.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/party/Lang.java @@ -16,7 +16,6 @@ public enum Lang SUCCESS_SERVER_CONNECT("Sending you and your party to {0}..."), INVITE_SUCCESS_PLAYER("Successfully invited {0} to the party."), SUCCESS_INVITE("{0} has invited {1} to the party."), - INVITE_RECEIVED("You have been invited to {0}''s party! You have 60 seconds to reply."), INVITE_ACCEPT("{0} has joined the party."), INVITE_DENY("{0} declined your invite."), INVITE_EXPIRED("{0} did not respond in time."), diff --git a/Plugins/Mineplex.Core/src/mineplex/core/party/PartyManager.java b/Plugins/Mineplex.Core/src/mineplex/core/party/PartyManager.java index d30ba0678..a63ea6ff9 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/party/PartyManager.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/party/PartyManager.java @@ -38,9 +38,7 @@ import mineplex.core.portal.Portal; import mineplex.core.preferences.Preference; import mineplex.core.preferences.PreferencesManager; import mineplex.serverdata.Region; -import mineplex.serverdata.Utility; import mineplex.serverdata.commands.ServerCommandManager; -import mineplex.serverdata.servers.ServerManager; public class PartyManager extends MiniPlugin { @@ -89,9 +87,7 @@ public class PartyManager extends MiniPlugin _serverName = UtilServer.getServerName(); - _redisManager = new PartyRedisManager(this, _serverName, - Utility.generatePool(ServerManager.getMasterConnection()), - Utility.generatePool(ServerManager.getSlaveConnection())); + _redisManager = new PartyRedisManager(this, _serverName); _inviteManager = new PartyInviteManager(this); _joinManager = new PartyJoinManager(this); @@ -326,7 +322,7 @@ public class PartyManager extends MiniPlugin { ChildJsonMessage message = new ChildJsonMessage("").extra(F.main("Party", "Click ")); message.add(F.link("Invite " + target)) - .hover(HoverEvent.SHOW_TEXT, C.cGreen + "Clicking this will invite " + C.cYellow + target + C.cGreen + " to the party") + .hover(HoverEvent.SHOW_TEXT, C.cGreen + "Clicking this will invite " + C.cYellow + target + C.cGreen + " to the party") .click(ClickEvent.RUN_COMMAND, "/party gui invite " + target); message.add(C.mBody + " to invite them"); message.sendToPlayer(owner); @@ -348,25 +344,17 @@ public class PartyManager extends MiniPlugin Lang.ALREADY_INVITED.send(caller, target); return; } - if (possible != null && getPartyByPlayer(possible) != null) + if (possible != null && !getPreferencesManager().get(possible).isActive(Preference.PARTY_REQUESTS)) { - Lang.PLAYER_IN_DIFFERENT_PARTY.send(caller, target); + UtilPlayer.message(caller, F.main("Party", F.name(target) + " is not accepting invites at this time.")); return; } //Same Server if (possible != null) { - if (!getPreferencesManager().get(possible).isActive(Preference.PARTY_REQUESTS)) - { - caller.sendMessage(F.main("Party", F.name(target) + " is not accepting invites at this time.")); - return; - } - Lang.SUCCESS_INVITE.send(party, caller.getName(), target); - Lang.INVITE_RECEIVED.send(possible, caller.getName(), caller.getName()); getInviteManager().inviteTo(possible.getName(), possible.getUniqueId(), caller.getName(), caller.getUniqueId(), party.getUniqueId(), getServerName()); - getInviteManager().sendAcceptOrDeny(possible, caller.getName()); } else { diff --git a/Plugins/Mineplex.Core/src/mineplex/core/party/command/PartyCLICommand.java b/Plugins/Mineplex.Core/src/mineplex/core/party/command/PartyCLICommand.java index c9459fd81..a5cdc12e6 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/party/command/PartyCLICommand.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/party/command/PartyCLICommand.java @@ -59,6 +59,7 @@ public class PartyCLICommand extends MultiCommandBase ComponentBuilder builder = new ComponentBuilder("") .append("[", ComponentBuilder.FormatRetention.NONE) + .bold(true) .color(ChatColor.AQUA) .append("?", ComponentBuilder.FormatRetention.NONE) .event(new HoverEvent(HoverEvent.Action.SHOW_TEXT, new ComponentBuilder("Click to view Party Help").create())) diff --git a/Plugins/Mineplex.Core/src/mineplex/core/party/manager/PartyInviteManager.java b/Plugins/Mineplex.Core/src/mineplex/core/party/manager/PartyInviteManager.java index 5a301022b..8ecc3ee0d 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/party/manager/PartyInviteManager.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/party/manager/PartyInviteManager.java @@ -25,6 +25,7 @@ import org.spigotmc.CaseInsensitiveMap; import mineplex.core.common.util.F; import mineplex.core.common.util.UtilPlayer; +import mineplex.core.common.util.UtilServer; import mineplex.core.party.InviteData; import mineplex.core.party.Party; import mineplex.core.party.PartyManager; @@ -212,6 +213,35 @@ public class PartyInviteManager } }, 20 * 60)); } + + Player player = Bukkit.getPlayer(targetUUID); + if (player != null) + { + Party party = _plugin.getPartyByPlayer(player); + if (party == null) + { + if (server.equals(UtilServer.getServerName())) + { + UtilPlayer.message(player, F.main("Party", "You have been invited to " + F.elem(inviterName) + "'s party! You have 60 seconds to reply")); + } + else + { + UtilPlayer.message(player, F.main("Party", "You have been invited to " + F.elem(inviterName) + "'s party! You have 60 seconds to reply. If you accept, you will be be sent to " + F.elem(server))); + } + } + else + { + if (server.equals(UtilServer.getServerName())) + { + UtilPlayer.message(player, F.main("Party", "You have been invited to " + F.elem(inviterName) + "'s party! You have 60 seconds to reply. If you accept, you will leave your current party")); + } + else + { + UtilPlayer.message(player, F.main("Party", "You have been invited to " + F.elem(inviterName) + "'s party! You have 60 seconds to reply. If you accept, you will leave your current party and you will be be sent to " + F.elem(server))); + } + } + sendAcceptOrDeny(player, inviterName); + } } /** @@ -220,7 +250,7 @@ public class PartyInviteManager * @param player The player who received the invite * @param arg The name of the inviting party */ - public void sendAcceptOrDeny(Player player, String arg) + private void sendAcceptOrDeny(Player player, String arg) { TextComponent textComponent = new TextComponent(F.main("Party", "Reply: ")); @@ -229,7 +259,7 @@ public class PartyInviteManager accept.setBold(true); accept.setClickEvent(new ClickEvent(Action.RUN_COMMAND, "/party cli a " + arg)); accept.setHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, new TextComponent[]{ - new TextComponent("Click to join " + F.name(arg) + "'s party") + new TextComponent("Click to join " + F.name(arg) + ChatColor.WHITE + "'s party") })); textComponent.addExtra(accept); @@ -240,7 +270,7 @@ public class PartyInviteManager deny.setBold(true); deny.setClickEvent(new ClickEvent(Action.RUN_COMMAND, "/party cli d " + arg)); deny.setHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, new TextComponent[]{ - new TextComponent("Click to decline joining " + F.name(arg) + "'s party") + new TextComponent("Click to decline joining " + F.name(arg) + ChatColor.WHITE + "'s party") })); textComponent.addExtra(deny); @@ -249,9 +279,9 @@ public class PartyInviteManager TextComponent view = new TextComponent("VIEW"); view.setColor(ChatColor.YELLOW); view.setBold(true); - view.setClickEvent(new ClickEvent(Action.RUN_COMMAND, "/party is")); + view.setClickEvent(new ClickEvent(Action.RUN_COMMAND, "/party cli is")); view.setHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, new TextComponent[]{ - new TextComponent("Click to view all pending invites.") + new TextComponent("Click to view all pending invites") })); textComponent.addExtra(view); diff --git a/Plugins/Mineplex.Core/src/mineplex/core/party/manager/PartyRedisManager.java b/Plugins/Mineplex.Core/src/mineplex/core/party/manager/PartyRedisManager.java index 128b04e1a..4b782736d 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/party/manager/PartyRedisManager.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/party/manager/PartyRedisManager.java @@ -5,15 +5,11 @@ import java.util.Map; import java.util.UUID; import org.bukkit.Bukkit; -import org.bukkit.Sound; import org.bukkit.entity.Player; import org.bukkit.scheduler.BukkitTask; -import com.google.common.collect.Maps; - import mineplex.core.common.util.F; import mineplex.core.common.util.UtilPlayer; -import mineplex.core.party.Lang; import mineplex.core.party.Party; import mineplex.core.party.PartyManager; import mineplex.core.party.rediscommands.PartyCrossServerInviteAccept; @@ -24,8 +20,6 @@ import mineplex.core.portal.Portal; import mineplex.core.preferences.Preference; import mineplex.serverdata.commands.ServerCommandManager; -import redis.clients.jedis.JedisPool; - public class PartyRedisManager { private final Map> _pendingFindResponse = new HashMap<>(); @@ -33,7 +27,7 @@ public class PartyRedisManager private final PartyManager _plugin; private final String _serverName; - public PartyRedisManager(PartyManager plugin, String serverName, JedisPool writePool, JedisPool readPool) + public PartyRedisManager(PartyManager plugin, String serverName) { _plugin = plugin; _serverName = serverName; @@ -43,17 +37,12 @@ public class PartyRedisManager _plugin.runSync(() -> { Player player = Bukkit.getPlayerExact(command.getTarget()); + if (player == null || !player.isOnline()) { return; } - if (_plugin.getPartyByPlayer(player) != null) - { - ServerCommandManager.getInstance().publishCommand(new PartyCrossServerInviteResponse(PartyCrossServerInviteResponse.Result.TARGET_ALREADY_IN_PARTY, command, player)); - return; - } - if (!_plugin.getPreferencesManager().get(player).isActive(Preference.PARTY_REQUESTS)) { ServerCommandManager.getInstance().publishCommand(new PartyCrossServerInviteResponse(PartyCrossServerInviteResponse.Result.TARGET_NOT_ACCEPTING_INVITES, command, player)); @@ -61,16 +50,23 @@ public class PartyRedisManager } _plugin.getInviteManager().inviteTo(player.getName(), player.getUniqueId(), command.getRequesterName(), command.getRequesterUUID(), command.getPartyUUID(), command.getFromServer()); - Lang.INVITE_RECEIVED.send(player, command.getRequesterName()); - _plugin.getInviteManager().sendAcceptOrDeny(player, command.getRequesterName()); - player.playSound(player.getLocation(), Sound.NOTE_PLING, 1.0F, 1.0F); - ServerCommandManager.getInstance().publishCommand(new PartyCrossServerInviteResponse(PartyCrossServerInviteResponse.Result.SUCCESS, command, player)); + if (_plugin.getPartyByPlayer(player) != null) + { + ServerCommandManager.getInstance().publishCommand(new PartyCrossServerInviteResponse(PartyCrossServerInviteResponse.Result.SUCCESS_IN_PARTY, command, player)); + } + else + { + ServerCommandManager.getInstance().publishCommand(new PartyCrossServerInviteResponse(PartyCrossServerInviteResponse.Result.SUCCESS, command, player)); + } }); }); ServerCommandManager.getInstance().registerCommandType(PartyCrossServerInviteResponse.class, command -> { + if (!command.getOrigin().wasSentFromThisServer()) + return; + _plugin.runSync(() -> { Map pendingTasks = _pendingFindResponse.get(command.getOrigin().getRequesterUUID()); @@ -92,13 +88,11 @@ public class PartyRedisManager switch (command.getResult()) { - case TARGET_ALREADY_IN_PARTY: - UtilPlayer.message(caller, F.main("Party", "The player " + F.elem(command.getOrigin().getTarget()) + " is already in a party!")); - break; case TARGET_NOT_ACCEPTING_INVITES: UtilPlayer.message(caller, F.main("Party", "The player " + F.elem(command.getOrigin().getTarget()) + " is not accepting invites!")); break; - case SUCCESS: + case SUCCESS_IN_PARTY: + { Party party = _plugin.getPartyByPlayer(command.getOrigin().getRequesterUUID()); if (party == null) { @@ -109,11 +103,30 @@ public class PartyRedisManager { //todo wat do } + _plugin.getInviteManager().inviteTo(command.getTargetName(), command.getTargetUUID(), command.getOrigin().getRequesterName(), command.getOrigin().getRequesterUUID(), command.getOrigin().getPartyUUID(), _plugin.getServerName()); - UtilPlayer.message(caller, F.main("Party", "You have invited " + F.elem(command.getTargetName()) + " to your party")); + party.sendMessage(F.main("Party", F.elem(command.getOrigin().getRequesterName()) + " has invited " + F.elem(command.getTargetName()) + " to the party")); break; + } + case SUCCESS: + { + Party party = _plugin.getPartyByPlayer(command.getOrigin().getRequesterUUID()); + if (party == null) + { + // todo wat do + return; + } + if (!party.getOwnerName().equals(command.getOrigin().getRequesterName())) + { + //todo wat do + } + + _plugin.getInviteManager().inviteTo(command.getTargetName(), command.getTargetUUID(), command.getOrigin().getRequesterName(), command.getOrigin().getRequesterUUID(), command.getOrigin().getPartyUUID(), _plugin.getServerName()); + party.sendMessage(F.main("Party", F.elem(command.getOrigin().getRequesterName()) + " has invited " + F.elem(command.getTargetName()) + " to the party")); + break; + } case UNKNOWN: - UtilPlayer.message(caller, F.main("Party", "Uh oh, something went wrong while inviting " + F.elem(command.getOrigin().getTarget()))); + UtilPlayer.message(caller, F.main("Party", "Uh oh, something went wrong while inviting " + F.elem(command.getTargetName()))); break; } }); @@ -126,6 +139,8 @@ public class PartyRedisManager Player apparentSender = Bukkit.getPlayer(command.getInviterUUID()); if (apparentSender != null && apparentSender.isOnline()) { + _plugin.getInviteManager().removeInviteTo(command.getPlayerName(), command.getPartyUUID()); + Party partyOfSender = _plugin.getPartyByPlayer(apparentSender); if (partyOfSender == null) { @@ -157,6 +172,8 @@ public class PartyRedisManager Player apparentSender = Bukkit.getPlayer(command.getInviterUUID()); if (apparentSender != null && apparentSender.isOnline()) { + _plugin.getInviteManager().removeInviteTo(command.getPlayerName(), command.getPartyUUID()); + Party partyOfSender = _plugin.getPartyByPlayer(apparentSender); if (partyOfSender == null) { diff --git a/Plugins/Mineplex.Core/src/mineplex/core/party/rediscommands/PartyCrossServerInviteResponse.java b/Plugins/Mineplex.Core/src/mineplex/core/party/rediscommands/PartyCrossServerInviteResponse.java index 8b9b4de14..bfc49a223 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/party/rediscommands/PartyCrossServerInviteResponse.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/party/rediscommands/PartyCrossServerInviteResponse.java @@ -47,8 +47,8 @@ public class PartyCrossServerInviteResponse extends ServerCommand public enum Result { - @SerializedName("already-in-party") - TARGET_ALREADY_IN_PARTY, + @SerializedName("success-in-party") + SUCCESS_IN_PARTY, @SerializedName("not-accepting-invites") TARGET_NOT_ACCEPTING_INVITES, @SerializedName("success") diff --git a/Plugins/Mineplex.Core/src/mineplex/core/party/ui/button/tools/owner/AddPlayerButton.java b/Plugins/Mineplex.Core/src/mineplex/core/party/ui/button/tools/owner/AddPlayerButton.java index 72bad2bed..ec2a4e0c6 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/party/ui/button/tools/owner/AddPlayerButton.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/party/ui/button/tools/owner/AddPlayerButton.java @@ -19,7 +19,7 @@ public class AddPlayerButton extends PartyButton private static final ItemStack ITEM = new ItemBuilder(Material.SIGN) .setTitle(C.cYellow + "Invite a Player") - .setLore(" ", C.cGray + "Brings up the Inviting Anvil!", C.cGray + "Simply type a player's name", C.cGray + "and click the paper to invite him") + .setLore(" ", C.cGray + "Brings up the Inviting Anvil!", C.cGray + "Simply type a player's name", C.cGray + "and click the paper to invite them") .build(); public AddPlayerButton(PartyManager plugin, Party party) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/Arcade.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/Arcade.java index 779166f2e..541733818 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/Arcade.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/Arcade.java @@ -179,6 +179,7 @@ public class Arcade extends JavaPlugin BoosterManager boosterManager = new BoosterManager(this, _serverConfiguration.getServerGroup().getBoosterGroup(), _clientManager, _donationManager, inventoryManager, thankManager); CosmeticManager cosmeticManager = new CosmeticManager(this, _clientManager, _donationManager, inventoryManager, gadgetManager, mountManager, petManager, null, boosterManager); cosmeticManager.setInterfaceSlot(6); + gadgetManager.setActiveItemSlot(3); cosmeticManager.disableTeamArmor(); CustomDataManager customDataManager = new CustomDataManager(this, _clientManager); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/ArcadeManager.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/ArcadeManager.java index 4fe7b705c..61befa719 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/ArcadeManager.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/ArcadeManager.java @@ -84,6 +84,7 @@ import mineplex.core.movement.Movement; import mineplex.core.npc.NpcManager; import mineplex.core.packethandler.PacketHandler; import mineplex.core.party.PartyManager; +import mineplex.core.party.event.PartySelectServerEvent; import mineplex.core.personalServer.PersonalServerManager; import mineplex.core.pet.PetManager; import mineplex.core.playwire.PlayWireManager; @@ -964,6 +965,12 @@ public class ArcadeManager extends MiniPlugin implements IRelation event.setMotd(ChatColor.GOLD + "Private Mineplex Test Server"); } + @EventHandler + public void onClickCompassPartyIcon(PartySelectServerEvent event) + { + UtilPlayer.message(event.getPlayer(), F.main("Party", "This option cannot be used here")); + } + @EventHandler public void MessageJoin(PlayerJoinEvent event) {