PC Party updates.

This commit is contained in:
TadahTech 2016-06-22 00:35:57 -05:00
parent e39326b592
commit 4d31867e98
43 changed files with 1326 additions and 334 deletions

View File

@ -0,0 +1,97 @@
package mineplex.core.party;
import mineplex.core.common.util.C;
import org.bukkit.entity.Player;
import mineplex.core.common.util.F;
import static sun.audio.AudioPlayer.player;
/**
* All chat messages for the party system to align with PE
*/
public enum Lang
{
//Party
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!"),
INVITE_ACCEPT("{0} has joined the party."),
INVITE_DENY("{0} declined your invite."),
INVITE_EXPIRED("{0} did not respond in time."),
INVITE_EXPIRED_PLAYER("Your invite to {0}'s party has expired."),
SHOW_MEMBERS("Party members: {0}."),
REMOVE_PLAYER("{0} has left the party."),
REMOVE_PLAYER_KICK("{0} has been removed from the party."),
ADD_MEMBER("{0} has joined the party."),
LEFT("You have left your party."),
PARTY_OWNER_LEAVE("{0} has left the party. {1} is the new party owner."),
TRANSFER_OWNER("{0} has given party leadership to {1}."),
DISBANDED("Your party has been disbanded, due to a lack of players."),
REMOVED("You have been removed from the party."),
NOT_EXIST("Error: {0} is not in a party right now."),
ALREADY_MEMBER("Error: {0} is already in the party!"),
NO_PARTY("Error: You are not in a party!"),
ALREADY_IN("Error: You are already in a party! Type {0} to leave."),
NOT_MEMBER("Error: {0} is not a member of your party."),
NOT_INVITED("Error: You do not have a pending invite to {0}'s party."),
NOT_OWNER("Error: You must be the party owner to do this!"),
NOT_OWNER_SERVER("Error: You must be the owner to move servers!"),
ALREADY_INVITED("Error: {0} has already been invited."),
PARTY_FULL("Error: Your party is full!"),
SERVER_CLOSED("Error: Your server is closed and you cannot invite players to join it right now!"),
SERVER_FULL("Error: Your server is full and you cannot invite more players to join it right now!"),
;
private String _message;
Lang(String message)
{
_message = message;
}
public void send(Player player, String... args)
{
String message = _message;
String colored = "";
if(args.length == 0)
{
player.sendMessage(F.main("Party", _message));
return;
}
for(int i = 0; i < args.length; i++)
{
String s = args[i];
message = message.replace("{" + i + "}", F.elem(s));
colored = C.mBody + message;
}
player.sendMessage(C.mHead + "Party> " + colored);
}
public void send(Party party, String... args)
{
String message = _message;
String colored = "";
if(args.length == 0)
{
party.sendMessage(F.main("Party", _message));
return;
}
for(int i = 0; i < args.length; i++)
{
String s = args[i];
message = message.replace("{" + i + "}", F.elem(s));
colored = C.mBody + message;
}
party.sendMessage(C.mHead + "Party> " + colored);
}
}

View File

@ -2,7 +2,13 @@ package mineplex.core.party;
import com.google.common.collect.Lists; import com.google.common.collect.Lists;
import com.google.common.collect.Maps; import com.google.common.collect.Maps;
import mineplex.core.chat.Chat;
import mineplex.core.common.util.F;
import mineplex.core.common.util.UtilServer;
import mineplex.core.party.event.PartyTransferOwnerEvent;
import mineplex.core.party.event.PartyTransferOwnerEvent.TransferReason;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
import org.bukkit.entity.Player;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
@ -13,9 +19,17 @@ import java.util.Map;
public class Party public class Party
{ {
private transient boolean _ownerKickMode = false;
private String _owner; private String _owner;
private List<String> _members; private List<String> _members;
private Map<String, Long> _invites; private Map<String, Long> _invites;
private int size;
public Party()
{
}
public Party(String owner) public Party(String owner)
{ {
@ -49,4 +63,71 @@ public class Party
{ {
getMembers().stream().map(Bukkit::getPlayer).forEach(player -> player.sendMessage(message)); getMembers().stream().map(Bukkit::getPlayer).forEach(player -> player.sendMessage(message));
} }
public int getSize()
{
return size;
}
public void setSize(int size)
{
this.size = size;
}
public void onPlayerAdd(String player)
{
_invites.remove(player);
if(_members.contains(player))
{
return;
}
_members.add(player);
Lang.ADD_MEMBER.send(this, player);
}
public void onPlayerRemove(String player, PartyRemoveReason reason)
{
if(reason == PartyRemoveReason.DISBANDED)
{
Player bukkitPlayer = Bukkit.getPlayerExact(player);
Lang.DISBANDED.send(bukkitPlayer);
return;
}
if(_members.size() <= 0)
{
return;
}
if(reason == PartyRemoveReason.LEFT)
{
Lang.REMOVE_PLAYER.send(this, player);
if(player.equalsIgnoreCase(_owner))
{
_owner = _members.get(0);
Lang.TRANSFER_OWNER.send(this, player, _owner);
PartyTransferOwnerEvent event = new PartyTransferOwnerEvent(this, _owner, player, TransferReason.LEFT);
UtilServer.getServer().getPluginManager().callEvent(event);
}
return;
}
if(reason == PartyRemoveReason.OTHER)
{
return;
}
Lang.REMOVE_PLAYER_KICK.send(this, player);
}
public boolean isOwnerKickMode()
{
return _ownerKickMode;
}
public void setOwnerKickMode(boolean ownerKickMode)
{
_ownerKickMode = ownerKickMode;
}
public void setOwner(String owner)
{
_owner = owner;
}
} }

View File

@ -0,0 +1,99 @@
package mineplex.core.party;
import mineplex.core.common.Rank;
import mineplex.core.party.event.PartyMemberKickGUIEvent;
import mineplex.core.party.event.PartyTransferOwnerEvent;
import mineplex.core.party.manager.PartyRedisManager;
import org.bukkit.Bukkit;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.player.PlayerJoinEvent;
import org.bukkit.event.player.PlayerQuitEvent;
/**
*
*/
public class PartyEventListener implements Listener
{
private final PartyManager _plugin;
private final PartyRedisManager _redisManager;
public PartyEventListener(PartyManager plugin, PartyRedisManager redisManager)
{
_plugin = plugin;
_redisManager = redisManager;
_plugin.getPluginManager().registerEvents(this, plugin.getPlugin());
}
@EventHandler
public void onJoin(PlayerJoinEvent event)
{
Player player = event.getPlayer();
String partyName = _plugin.getInviteManager().getPartyWaiting(player.getUniqueId());
if(partyName == null)
{
return;
}
Party party = _plugin.getParty(partyName);
Player bukkitPlayer = Bukkit.getPlayerExact(partyName);
if(party == null)
{
party = new Party(partyName);
int size = 5;
if(bukkitPlayer != null && _plugin.getClientManager().Get(bukkitPlayer).GetRank().isDonor())
{
size = 10;
}
party.setSize(size);
_plugin.addParty(party);
}
_plugin.addToParty(Bukkit.getPlayerExact(partyName), party);
_plugin.addToParty(player, party);
_plugin.getInviteManager().removeFromWaiting(player.getUniqueId());
}
@EventHandler
public void onQuit(PlayerQuitEvent event)
{
Player player = event.getPlayer();
Party party = _plugin.getParty(player);
_plugin.getInviteManager().removeAll(player.getUniqueId());
if (party == null)
{
return;
}
_plugin.removeFromParty(player, PartyRemoveReason.LEFT);
}
@EventHandler
public void onTransferOwner(PartyTransferOwnerEvent event)
{
_plugin.transferOwner(event.getNewOwner(), event.getOldOwner());
}
@EventHandler
public void onKick(PartyMemberKickGUIEvent event)
{
_plugin.removeFromParty(Bukkit.getPlayerExact(event.getPlayerClicked()), PartyRemoveReason.KICKED);
}
}

View File

@ -1,6 +1,8 @@
package mineplex.core.party; package mineplex.core.party;
import com.google.common.collect.Maps; import com.google.common.collect.Maps;
import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
import mineplex.core.MiniPlugin; import mineplex.core.MiniPlugin;
import mineplex.core.account.CoreClientManager; import mineplex.core.account.CoreClientManager;
import mineplex.core.party.command.PartyCommand; import mineplex.core.party.command.PartyCommand;
@ -12,6 +14,7 @@ import mineplex.core.portal.Portal;
import mineplex.core.preferences.PreferencesManager; import mineplex.core.preferences.PreferencesManager;
import mineplex.serverdata.Utility; import mineplex.serverdata.Utility;
import mineplex.serverdata.servers.ServerManager; import mineplex.serverdata.servers.ServerManager;
import org.bukkit.Bukkit;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.plugin.java.JavaPlugin; import org.bukkit.plugin.java.JavaPlugin;
@ -47,9 +50,9 @@ public class PartyManager extends MiniPlugin
_joinManager = new PartyJoinManager(this); _joinManager = new PartyJoinManager(this);
addCommand(new PartyCommand(this)); addCommand(new PartyCommand(this));
getPluginManager().registerEvents(new MenuListener(), getPlugin()); getPluginManager().registerEvents(new MenuListener(), getPlugin());
new PartyEventListener(this, _redisManager);
} }
public Party getParty(String party) public Party getParty(String party)
{ {
return _parties.get(party); return _parties.get(party);
@ -68,6 +71,13 @@ public class PartyManager extends MiniPlugin
public void addToParty(UUID uuid, Party party) public void addToParty(UUID uuid, Party party)
{ {
_players.put(uuid, party); _players.put(uuid, party);
Player player = Bukkit.getPlayer(uuid);
party.onPlayerAdd(player.getName());
}
public void addToParty(Player player, Party party)
{
addToParty(player.getUniqueId(), party);
} }
public void removeParty(Party party) public void removeParty(Party party)
@ -75,11 +85,56 @@ public class PartyManager extends MiniPlugin
_parties.remove(party.getName()); _parties.remove(party.getName());
} }
public void removeFromParty(UUID uuid) public void removeFromParty(UUID uuid, PartyRemoveReason reason)
{ {
_players.remove(uuid); Party party = _players.remove(uuid);
if(party == null)
{
return;
}
Player player = Bukkit.getPlayer(uuid);
party.getMembers().remove(player.getName());
party.onPlayerRemove(player.getName(), reason);
int size = party.getMembers().size();
if(size <= 1)
{
if(size == 0)
{
removeParty(party);
return;
}
_players.remove(Bukkit.getPlayerExact(party.getMembers().get(0)).getUniqueId());
party.onPlayerRemove(party.getMembers().get(0), PartyRemoveReason.DISBANDED);
removeParty(party);
}
} }
public void removeFromParty(Player player, PartyRemoveReason reason)
{
removeFromParty(player.getUniqueId(), reason);
}
public void disbandParty(Party party)
{
party.getMembers().stream().map(Bukkit::getPlayer).forEach(player -> removeFromParty(player.getUniqueId(), PartyRemoveReason.KICKED));
removeParty(party);
}
public void transferOwner(String newOwner, String oldOwner)
{
Party party = _parties.remove(oldOwner.toLowerCase());
_parties.put(newOwner.toLowerCase(), party);
party.getMembers().stream().map(Bukkit::getPlayer).forEach(s ->
{
_players.remove(s.getUniqueId());
_players.put(s.getUniqueId(), party);
});
party.setOwner(newOwner);
party.getMembers().remove(oldOwner);
party.getMembers().add(oldOwner);
}
public Portal getPortal() public Portal getPortal()
{ {
return _portal; return _portal;
@ -114,4 +169,6 @@ public class PartyManager extends MiniPlugin
{ {
return _joinManager; return _joinManager;
} }
} }

View File

@ -0,0 +1,33 @@
package mineplex.core.party;
/**
*
*/
public enum PartyRemoveReason
{
KICKED(1, "kicked"),
LEFT(2, "left"),
OTHER(3, "other"),
DISBANDED(4, "disbanded"),
;
private int _id;
private String _name;
PartyRemoveReason(int id, String name)
{
_id = id;
_name = name;
}
public int getId()
{
return _id;
}
public String getName()
{
return _name;
}
}

View File

@ -7,8 +7,10 @@ import mineplex.core.common.jsonchat.ClickEvent;
import mineplex.core.common.jsonchat.JsonMessage; import mineplex.core.common.jsonchat.JsonMessage;
import mineplex.core.common.util.C; import mineplex.core.common.util.C;
import mineplex.core.common.util.F; import mineplex.core.common.util.F;
import mineplex.core.party.Lang;
import mineplex.core.party.Party; import mineplex.core.party.Party;
import mineplex.core.party.PartyManager; import mineplex.core.party.PartyManager;
import mineplex.core.party.PartyRemoveReason;
import mineplex.core.party.manager.PartyInviteManager; import mineplex.core.party.manager.PartyInviteManager;
import mineplex.core.party.ui.menus.PartyMainMenu; import mineplex.core.party.ui.menus.PartyMainMenu;
import mineplex.core.party.ui.menus.PartyOwnerMenu; import mineplex.core.party.ui.menus.PartyOwnerMenu;
@ -35,7 +37,7 @@ public class PartyCommand extends CommandBase<PartyManager>
help("leave", "Leave your current party"), help("leave", "Leave your current party"),
help("kick <player>", "Kick a player from your party."), help("kick <player>", "Kick a player from your party."),
help("disband", "Disband your party."), help("disband", "Disband your party."),
C.cBlue + "Party> " + C.cWhite + "#<message> " + C.cGray + "- Send a message tp your party." C.cBlue + "Party> " + C.cWhite + "#<message> " + C.cGray + "- Send a message to your party."
}; };
public PartyCommand(PartyManager plugin) public PartyCommand(PartyManager plugin)
@ -126,12 +128,46 @@ public class PartyCommand extends CommandBase<PartyManager>
private void handleInvite(Player caller, String target) private void handleInvite(Player caller, String target)
{ {
Player possible = Bukkit.getPlayer(target); Player possible = Bukkit.getPlayerExact(target);
Party party = Plugin.getParty(caller);
//Same Server
if (possible != null) if (possible != null)
{ {
if (party == null)
{
Lang.INVITE_SUCCESS_PLAYER.send(caller, target);
} else
{
if(!party.getOwner().equalsIgnoreCase(caller.getName()))
{
Lang.NOT_OWNER.send(caller);
return;
}
if(Plugin.getInviteManager().isInvitedTo(possible.getUniqueId(), party.getName()))
{
Lang.ALREADY_INVITED.send(caller, target);
return;
}
if(party.getMembers().contains(target))
{
Lang.ALREADY_MEMBER.send(caller, target);
return;
}
if(party.getMembers().size() >= party.getSize())
{
Lang.PARTY_FULL.send(caller);
return;
}
Lang.SUCCESS_INVITE.send(party, caller.getName(), target);
}
UUID uuid = possible.getUniqueId(); UUID uuid = possible.getUniqueId();
caller.sendMessage(F.main("Party", "Sent an invite to " + possible.getName() + "..."));
Lang.INVITE_RECEIVED.send(possible, caller.getName(), caller.getName());
Plugin.getInviteManager().inviteTo(uuid, caller.getName(), caller.getName()); Plugin.getInviteManager().inviteTo(uuid, caller.getName(), caller.getName());
Plugin.getInviteManager().sendAcceptOrDeny(possible, caller.getName()); Plugin.getInviteManager().sendAcceptOrDeny(possible, caller.getName());
return; return;
} }
@ -145,7 +181,7 @@ public class PartyCommand extends CommandBase<PartyManager>
if (!inviteManager.isInvitedTo(caller.getUniqueId(), target)) if (!inviteManager.isInvitedTo(caller.getUniqueId(), target))
{ {
//He isn't invited to this party. //He isn't invited to this party.
caller.sendMessage(F.main("Party", "You do not have an invitation to " + F.elem(target))); Lang.NOT_INVITED.send(caller, target);
return; return;
} }
@ -158,37 +194,35 @@ public class PartyCommand extends CommandBase<PartyManager>
if (party == null) if (party == null)
{ {
caller.sendMessage(F.main("Party", "You are not in a party! Do /party help to get started.")); Lang.NO_PARTY.send(caller);
return; return;
} }
if (!party.getOwner().equalsIgnoreCase(caller.getName())) if (!party.getOwner().equalsIgnoreCase(caller.getName()))
{ {
caller.sendMessage(F.main("Party", "You must be the leader of the party to do that!")); Lang.NOT_OWNER.send(caller);
return; return;
} }
Player playerTarget = Bukkit.getPlayer(target); Player playerTarget = Bukkit.getPlayerExact(target);
if (playerTarget == null) if (playerTarget == null)
{ {
caller.sendMessage(F.main("Party", target + " is not online, and is not in your party!")); Lang.NOT_MEMBER.send(caller, target);
return; return;
} }
Party targetParty = Plugin.getParty(playerTarget); Party targetParty = Plugin.getParty(playerTarget);
if (targetParty == null || party.getMembers().contains(target)) if (targetParty == null ||!party.getMembers().contains(target))
{ {
caller.sendMessage(F.main("Party", target + " is not a member of your party.")); Lang.NOT_MEMBER.send(caller, target);
return; return;
} }
Plugin.removeFromParty(playerTarget.getUniqueId()); Plugin.removeFromParty(playerTarget.getUniqueId(), PartyRemoveReason.KICKED);
party.getMembers().remove(target);
targetParty.sendMessage(F.main("Party", "You have been removed from " + party.getName() + ".")); Lang.REMOVE_PLAYER_KICK.send(targetParty);
party.sendMessage(F.main("Party", caller.getName() + " has removed " + target + " from the party."));
} }
private void handleLeave(Player caller) private void handleLeave(Player caller)
@ -197,14 +231,12 @@ public class PartyCommand extends CommandBase<PartyManager>
if (party == null) if (party == null)
{ {
caller.sendMessage(F.main("Party", "You are not in a party! Do /party help to get started.")); Lang.NO_PARTY.send(caller);
return; return;
} }
party.getMembers().remove(caller.getName()); Plugin.removeFromParty(caller.getUniqueId(), PartyRemoveReason.LEFT);
Plugin.removeFromParty(caller.getUniqueId()); Lang.LEFT.send(caller);
caller.sendMessage(F.main("Party", "You have left " + party.getOwner() + "'s party"));
party.sendMessage(F.main("Party", caller.getName() + " has left the party."));
} }
private void handleDisband(Player caller) private void handleDisband(Player caller)
@ -213,23 +245,17 @@ public class PartyCommand extends CommandBase<PartyManager>
if (party == null) if (party == null)
{ {
caller.sendMessage(F.main("Party", "You are not in a party! Do /party help to get started.")); Lang.NO_PARTY.send(caller);
return; return;
} }
if (!party.getOwner().equalsIgnoreCase(caller.getName())) if (!party.getOwner().equalsIgnoreCase(caller.getName()))
{ {
caller.sendMessage(F.main("Party", "You must be the leader of the party to do that!")); Lang.NOT_OWNER.send(caller);
return; return;
} }
party.sendMessage(F.main("Party", caller.getName() + " has disbanded the party!")); Plugin.disbandParty(party);
party.getMembers().stream().map(Bukkit::getPlayer).forEach(player -> Plugin.removeFromParty(player.getUniqueId()));
party.getMembers().clear();
party.getInvites().clear();
Plugin.removeParty(party);
} }
private String help(String command, String description) private String help(String command, String description)

View File

@ -0,0 +1,37 @@
package mineplex.core.party.event;
import mineplex.core.party.Party;
import org.bukkit.event.Event;
import org.bukkit.event.HandlerList;
/**
* An event called when a server receives a PartyPacket containing the information about a party
*/
public class PartyDataReceivedEvent extends Event
{
private static final HandlerList HANDLER_LIST = new HandlerList();
private final Party _party;
public PartyDataReceivedEvent(Party party)
{
_party = party;
}
public Party getParty()
{
return _party;
}
@Override
public HandlerList getHandlers()
{
return HANDLER_LIST;
}
public static HandlerList getHandlerList()
{
return HANDLER_LIST;
}
}

View File

@ -0,0 +1,51 @@
package mineplex.core.party.event;
import mineplex.core.party.Party;
import org.bukkit.entity.Player;
import org.bukkit.event.Event;
import org.bukkit.event.HandlerList;
/**
* This event is called when an owner clicks a PartyMemberIcon while having Kick mode activated.
*/
public class PartyMemberKickGUIEvent extends Event
{
private static final HandlerList HANDLER_LIST = new HandlerList();
private final Party _party;
private final String _playerClicked;
private final Player _owner;
public PartyMemberKickGUIEvent(Party party, String playerClicked, Player owner)
{
_party = party;
_playerClicked = playerClicked;
_owner = owner;
}
public String getPlayerClicked()
{
return _playerClicked;
}
public Player getOwner()
{
return _owner;
}
public Party getParty()
{
return _party;
}
@Override
public HandlerList getHandlers()
{
return HANDLER_LIST;
}
public static HandlerList getHandlerList()
{
return HANDLER_LIST;
}
}

View File

@ -0,0 +1,36 @@
package mineplex.core.party.event;
import mineplex.core.party.Party;
import org.bukkit.event.Event;
import org.bukkit.event.HandlerList;
/**
* This event is called when a party owner selects the compass icon.
*/
public class PartySelectServerEvent extends Event
{
private static final HandlerList HANDLER_LIST = new HandlerList();
private final Party _party;
public PartySelectServerEvent(Party party)
{
_party = party;
}
public Party getParty()
{
return _party;
}
@Override
public HandlerList getHandlers()
{
return HANDLER_LIST;
}
public static HandlerList getHandlerList()
{
return HANDLER_LIST;
}
}

View File

@ -0,0 +1,65 @@
package mineplex.core.party.event;
import mineplex.core.party.Party;
import org.bukkit.event.Event;
import org.bukkit.event.HandlerList;
/**
* An event called when an owner leaves a party
*/
public class PartyTransferOwnerEvent extends Event
{
public enum TransferReason
{
LEFT,
TRANSFER;
}
private static final HandlerList HANDLER_LIST = new HandlerList();
private final Party _party;
private final String _newOwner;
private final String _oldOwner;
private final TransferReason _reason;
public PartyTransferOwnerEvent(Party party, String newOwner, String oldOwner, TransferReason reason)
{
_party = party;
_newOwner = newOwner;
_oldOwner = oldOwner;
_reason = reason;
}
public String getNewOwner()
{
return _newOwner;
}
public String getOldOwner()
{
return _oldOwner;
}
public TransferReason getReason()
{
return _reason;
}
public Party getParty()
{
return _party;
}
@Override
public HandlerList getHandlers()
{
return HANDLER_LIST;
}
public static HandlerList getHandlerList()
{
return HANDLER_LIST;
}
}

View File

@ -2,8 +2,10 @@ package mineplex.core.party.manager;
import com.google.common.collect.Lists; import com.google.common.collect.Lists;
import com.google.common.collect.Maps; import com.google.common.collect.Maps;
import mineplex.core.common.util.C;
import mineplex.core.common.util.F; import mineplex.core.common.util.F;
import mineplex.core.party.InviteData; import mineplex.core.party.InviteData;
import mineplex.core.party.Lang;
import mineplex.core.party.Party; import mineplex.core.party.Party;
import mineplex.core.party.PartyManager; import mineplex.core.party.PartyManager;
import mineplex.core.party.redis.RedisMessageType; import mineplex.core.party.redis.RedisMessageType;
@ -42,7 +44,7 @@ public class PartyInviteManager
public String format(String target) public String format(String target)
{ {
return String.format(_message, target); return C.mHead + "Party> " + F.name(target) + " " + _message.substring(_message.indexOf("}" + 1));
} }
} }
@ -78,7 +80,7 @@ public class PartyInviteManager
String message = InviteResponse.DENIED.format(player.getName()); String message = InviteResponse.DENIED.format(player.getName());
if (newParty == null) if (newParty == null)
{ {
player.sendMessage(message); possible.sendMessage(message);
return; return;
} }
newParty.sendMessage(message); newParty.sendMessage(message);
@ -89,10 +91,7 @@ public class PartyInviteManager
newParty = new Party(possible.getName()); newParty = new Party(possible.getName());
_plugin.addParty(newParty); _plugin.addParty(newParty);
_plugin.addToParty(possible.getUniqueId(), newParty); _plugin.addToParty(possible.getUniqueId(), newParty);
possible.sendMessage(F.main("Party", "Created a new party!"));
} }
newParty.getMembers().add(player.getName());
newParty.sendMessage(F.main("Party", player.getName() + " has joined the party"));
_plugin.addToParty(player.getUniqueId(), newParty); _plugin.addToParty(player.getUniqueId(), newParty);
return; return;
} }
@ -114,6 +113,7 @@ public class PartyInviteManager
_players.put(player.getUniqueId(), player.getName()); _players.put(player.getUniqueId(), player.getName());
INVITE_FROM_SERVERS.put(target, serverFrom); INVITE_FROM_SERVERS.put(target, serverFrom);
inviteTo(player.getUniqueId(), sender, sender); inviteTo(player.getUniqueId(), sender, sender);
Lang.INVITE_RECEIVED.send(player, sender);
sendAcceptOrDeny(player, sender); sendAcceptOrDeny(player, sender);
} }
@ -137,7 +137,6 @@ public class PartyInviteManager
party = new Party(sender); party = new Party(sender);
_plugin.addParty(party); _plugin.addParty(party);
_plugin.addToParty(player.getUniqueId(), party); _plugin.addToParty(player.getUniqueId(), party);
player.sendMessage(F.main("Party", "Created a new party!"));
} }
party.sendMessage(message); party.sendMessage(message);
addToPendingJoin(targetUUID, party.getName()); addToPendingJoin(targetUUID, party.getName());
@ -147,7 +146,6 @@ public class PartyInviteManager
if (party == null) if (party == null)
{ {
player.sendMessage(message); player.sendMessage(message);
player.sendMessage(F.main("Party", "Party not created."));
return; return;
} }
party.sendMessage(message); party.sendMessage(message);
@ -155,6 +153,18 @@ public class PartyInviteManager
} }
} }
/**
* Remove all references tied with this player
*
* @param player The player's UUID
*/
public void removeAll(UUID player)
{
_players.remove(player);
_invitedBy.remove(player);
_activeInvites.remove(player);
}
/** /**
* Get the name of the server that this request was initiated from. * Get the name of the server that this request was initiated from.
* *
@ -177,6 +187,16 @@ public class PartyInviteManager
return _awaitingJoin.get(player); return _awaitingJoin.get(player);
} }
/**
* Remove the party reference that invited this player
*
* @param player The player's UUID
*/
public void removeFromWaiting(UUID player)
{
_awaitingJoin.remove(player);
}
/** /**
* Get the name of the person who has invited the target player * Get the name of the person who has invited the target player
* Used mainly for player locating * Used mainly for player locating
@ -296,7 +316,6 @@ public class PartyInviteManager
public void sendAcceptOrDeny(Player player, String arg) public void sendAcceptOrDeny(Player player, String arg)
{ {
player.sendMessage(F.main("Party", "You have received an invite from " + arg));
TextComponent textComponent = new TextComponent(F.main("Party", "Click one: ")); TextComponent textComponent = new TextComponent(F.main("Party", "Click one: "));
TextComponent accept = new TextComponent("ACCEPT"); TextComponent accept = new TextComponent("ACCEPT");

View File

@ -64,7 +64,7 @@ public class PartyJoinManager
public void handleJoinRequest(String serverFrom, int partySize, String initiator, boolean canJoinFull) public void handleJoinRequest(String serverFrom, int partySize, String initiator, boolean canJoinFull)
{ {
int currentPlayers = UtilServer.getPlayers().length; int currentPlayers = UtilServer.getPlayers().length;
if (currentPlayers >= _maxPLayers) if (currentPlayers >= _maxPLayers || (currentPlayers + partySize) >= _maxPLayers)
{ {
//Max number of people on. //Max number of people on.
if (!canJoinFull) if (!canJoinFull)
@ -74,6 +74,7 @@ public class PartyJoinManager
return; return;
} }
} }
_plugin.getRedisManager().publish(serverFrom, RedisMessageType.PREJOIN_SERVER_RESPONSE, initiator, "yes", "none"); _plugin.getRedisManager().publish(serverFrom, RedisMessageType.PREJOIN_SERVER_RESPONSE, initiator, "yes", "none");
} }
@ -95,6 +96,7 @@ public class PartyJoinManager
return; return;
} }
party.sendMessage(F.main("Party", "Transferring servers...")); party.sendMessage(F.main("Party", "Transferring servers..."));
_plugin.getRedisManager().sendPartyInfo(server, party);
party.getMembers().stream().map(Bukkit::getPlayer).forEach(player1 -> _plugin.getPortal().sendPlayerToServer(player1, server)); party.getMembers().stream().map(Bukkit::getPlayer).forEach(player1 -> _plugin.getPortal().sendPlayerToServer(player1, server));
} }

View File

@ -1,8 +1,14 @@
package mineplex.core.party.manager; package mineplex.core.party.manager;
import com.google.common.collect.Maps; import com.google.common.collect.Maps;
import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
import mineplex.core.common.util.F; import mineplex.core.common.util.F;
import mineplex.core.party.Lang;
import mineplex.core.party.Party;
import mineplex.core.party.PartyManager; import mineplex.core.party.PartyManager;
import mineplex.core.party.PartyRemoveReason;
import mineplex.core.party.event.PartyDataReceivedEvent;
import mineplex.core.party.manager.PartyInviteManager.InviteResponse; import mineplex.core.party.manager.PartyInviteManager.InviteResponse;
import mineplex.core.party.manager.PartyJoinManager.JoinResponseReason; import mineplex.core.party.manager.PartyJoinManager.JoinResponseReason;
import mineplex.core.party.redis.PartyRedisListener; import mineplex.core.party.redis.PartyRedisListener;
@ -22,6 +28,8 @@ import java.util.UUID;
*/ */
public class PartyRedisManager public class PartyRedisManager
{ {
protected final Gson GSON = new GsonBuilder().create();
protected static final String CHANNEL_BASE = "party-pubsub"; protected static final String CHANNEL_BASE = "party-pubsub";
protected static final String FIND_PLAYERS_CHANNEL = "party-player-finder"; protected static final String FIND_PLAYERS_CHANNEL = "party-player-finder";
private final Map<String, BukkitTask> TASKS = Maps.newHashMap(); private final Map<String, BukkitTask> TASKS = Maps.newHashMap();
@ -62,7 +70,7 @@ public class PartyRedisManager
public void handle(RedisMessageType messageType, String message) public void handle(RedisMessageType messageType, String message)
{ {
String[] contents = message.split("-"); String[] contents = message.split("-");
if(contents.length < 3) if (contents.length < 3)
{ {
return; return;
} }
@ -71,6 +79,10 @@ public class PartyRedisManager
String third = contents[2]; String third = contents[2];
switch (messageType) switch (messageType)
{ {
case PARTY_INFO:
handlePartyInfo(first);
break;
case INVITE_PLAYER_REQUEST: case INVITE_PLAYER_REQUEST:
_inviteManager.handleInviteRequest(second, third, first); _inviteManager.handleInviteRequest(second, third, first);
break; break;
@ -82,26 +94,37 @@ public class PartyRedisManager
case PLAYER_FIND_REQUEST: case PLAYER_FIND_REQUEST:
Player player = Bukkit.getPlayer(second); Player player = Bukkit.getPlayer(second);
if(player == null) if (player == null)
{ {
return; return;
} }
publish(first, RedisMessageType.PLAYER_FIND_RESPONSE, publish(first, RedisMessageType.PLAYER_FIND_RESPONSE, _serverName, player.getName(), player.getUniqueId().toString(), second);
_serverName, player.getName(), player.getUniqueId().toString(), second);
break; break;
case PLAYER_FIND_RESPONSE: case PLAYER_FIND_RESPONSE:
UUID uuid = UUID.fromString(third); UUID uuid = UUID.fromString(third);
BukkitTask task = TASKS.remove(second); BukkitTask task = TASKS.remove(second);
if(task != null) if (task != null)
{ {
task.cancel(); task.cancel();
} }
Player inviter = Bukkit.getPlayerExact(contents[3]);
_inviteManager.inviteTo(uuid, contents[3], contents[3]); if (_inviteManager.isInvitedTo(uuid, inviter.getName()))
publish(first, RedisMessageType.INVITE_PLAYER_REQUEST, _serverName, contents[3], second); {
Lang.ALREADY_INVITED.send(inviter, second);
return;
}
if (_plugin.getParty(inviter) == null)
{
Lang.INVITE_SUCCESS_PLAYER.send(inviter, second);
} else
{
Lang.SUCCESS_INVITE.send(_plugin.getParty(inviter), inviter.getName(), second);
}
_inviteManager.inviteTo(uuid, inviter.getName(), inviter.getName());
publish(first, RedisMessageType.INVITE_PLAYER_REQUEST, _serverName, inviter.getName(), second);
break; break;
case PREJOIN_SERVER_REQUEST: case PREJOIN_SERVER_REQUEST:
@ -123,7 +146,7 @@ public class PartyRedisManager
{ {
TASKS.remove(player); TASKS.remove(player);
Player senderPlayer = Bukkit.getPlayerExact(sender); Player senderPlayer = Bukkit.getPlayerExact(sender);
if(senderPlayer == null) if (senderPlayer == null)
{ {
return; return;
} }
@ -139,5 +162,32 @@ public class PartyRedisManager
}); });
} }
public void sendPartyInfo(String server, Party party)
{
publish(server, RedisMessageType.PARTY_INFO, GSON.toJson(party));
_plugin.removeParty(party);
party.getMembers().stream().map(Bukkit::getPlayer).forEach(player -> _plugin.removeFromParty(player.getUniqueId(), PartyRemoveReason.OTHER));
}
public void handlePartyInfo(String json)
{
new BukkitRunnable()
{
@Override
public void run()
{
Party party = GSON.fromJson(json, Party.class);
_plugin.addParty(party);
party.getMembers().forEach(s ->
{
Player player = Bukkit.getPlayerExact(s);
if (player != null)
{
_plugin.addToParty(player, party);
}
});
Bukkit.getServer().getPluginManager().callEvent(new PartyDataReceivedEvent(party));
}
}.runTaskLater(_plugin.getPlugin(), 10L);
}
} }

View File

@ -19,7 +19,6 @@ public class PartyRedisListener extends JedisPubSub
@Override @Override
public void onMessage(String channel, String message) public void onMessage(String channel, String message)
{ {
System.out.println(channel + " - " + message);
RedisMessageType type = RedisMessageType.valueOf(message.split(":")[0].toUpperCase()); RedisMessageType type = RedisMessageType.valueOf(message.split(":")[0].toUpperCase());
_redisManager.handle(type, message.split(":")[1]); _redisManager.handle(type, message.split(":")[1]);
} }

View File

@ -20,7 +20,10 @@ public enum RedisMessageType
//Message: SERVER_FROM-PLAYER_INITIATING-PARTY_SIZE-_CAN_JOIN_FULL //Message: SERVER_FROM-PLAYER_INITIATING-PARTY_SIZE-_CAN_JOIN_FULL
PREJOIN_SERVER_REQUEST(5, "{0}-{1}-{2}-{3}"), PREJOIN_SERVER_REQUEST(5, "{0}-{1}-{2}-{3}"),
//Message: PLAYER_INITIATING-RESPONSE-REASON-SERVER //Message: PLAYER_INITIATING-RESPONSE-REASON-SERVER
PREJOIN_SERVER_RESPONSE(6, "{0}-{1}-{2}-[3}") PREJOIN_SERVER_RESPONSE(6, "{0}-{1}-{2}-[3}"),
//Message: JSON Party
PARTY_INFO(7, "{0}")
; ;
private int _id; private int _id;

View File

@ -1,9 +1,12 @@
package mineplex.core.party.ui; package mineplex.core.party.ui;
import mineplex.core.itemstack.ItemBuilder;
import mineplex.core.party.PartyManager; import mineplex.core.party.PartyManager;
import mineplex.core.party.ui.button.IconButton; import mineplex.core.party.ui.button.IconButton;
import net.md_5.bungee.api.ChatColor; import net.md_5.bungee.api.ChatColor;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
import org.bukkit.DyeColor;
import org.bukkit.Material;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.inventory.Inventory; import org.bukkit.inventory.Inventory;
import org.bukkit.inventory.InventoryView; import org.bukkit.inventory.InventoryView;
@ -19,176 +22,210 @@ import java.util.UUID;
public abstract class Menu public abstract class Menu
{ {
protected static final Button[] EMPTY = new Button[45]; protected static final Button PANE = new IconButton(new ItemBuilder(Material.STAINED_GLASS_PANE)
protected static Map<UUID, Menu> MENUS = new HashMap<>(); .setTitle(" ")
private String _name; .setData(DyeColor.LIGHT_BLUE.getWoolData())
protected Button[] _buttons; .build(), null);
protected static final Button[] EMPTY = new Button[45];
protected static Map<UUID, Menu> MENUS = new HashMap<>();
private String _name;
protected Button[] _buttons;
protected PartyManager _plugin; protected PartyManager _plugin;
public Menu(String name, PartyManager plugin) public Menu(String name, PartyManager plugin)
{ {
_name = name; _name = name;
_buttons = EMPTY; _buttons = EMPTY;
_plugin = plugin; _plugin = plugin;
} }
public static Menu get(UUID name) public static Menu get(UUID name)
{ {
return MENUS.get(name); return MENUS.get(name);
} }
/**
* Create an icon (no click action)
*
* @param item The itemstack ti display
* @return The created button
*/
protected Button create(ItemStack item)
{
return new IconButton(item, _plugin);
}
/** public String getName()
* Create an icon (no click action) {
* return ChatColor.translateAlternateColorCodes('&', _name);
* @param item The itemstack ti display }
* @return The created button
*/
protected Button create(ItemStack item)
{
return new IconButton(item, _plugin);
}
public String getName() public Button[] addPanes(Button[] buttons)
{ {
return ChatColor.translateAlternateColorCodes('&', _name); for (int i = 0; i < 9; i++)
} {
if (buttons[i] == null)
{
buttons[i] = PANE;
}
/** if(buttons.length == 9)
* Open and setup the inventory for the player to view {
* Store a reference to it inside a map for retrieving later continue;
* }
* @param player The player who we wish to show the GUI to
*/
public void open(Player player)
{
setButtons(setUp(player));
if (MENUS.get(player.getUniqueId()) != null) if (buttons[i + buttons.length - 9] == null)
{ {
MENUS.remove(player.getUniqueId()); buttons[i + buttons.length - 9] = PANE;
} }
MENUS.put(player.getUniqueId(), this); if (i == 0 || i == 8)
{
for (int a = 9; a < buttons.length; a += 9)
{
buttons[i + a] = PANE;
}
}
}
return buttons;
}
int size = (_buttons.length + 8) / 9 * 9; /**
Inventory inventory = Bukkit.createInventory(player, size, getName()); * Open and setup the inventory for the player to view
* Store a reference to it inside a map for retrieving later
*
* @param player The player who we wish to show the GUI to
*/
public void open(Player player)
{
setButtons(setUp(player));
for (int i = 0; i < _buttons.length; i++) if (MENUS.get(player.getUniqueId()) != null)
{ {
if (_buttons[i] == null) MENUS.remove(player.getUniqueId());
{ }
continue;
}
ItemStack item = _buttons[i].getItemStack(); MENUS.put(player.getUniqueId(), this);
inventory.setItem(i, item); int size = (_buttons.length + 8) / 9 * 9;
} Inventory inventory = Bukkit.createInventory(player, size, getName());
player.openInventory(inventory);
}
/** for (int i = 0; i < _buttons.length; i++)
* Set up the GUI with buttons {
* if (_buttons[i] == null)
* @return The setup button array {
*/ continue;
protected abstract Button[] setUp(Player player); }
public Button[] getButtons() ItemStack item = _buttons[i].getItemStack();
{
return _buttons;
}
public void setButtons(Button[] buttons) inventory.setItem(i, item);
{ }
_buttons = buttons; player.openInventory(inventory);
} }
/** /**
* Retrieve the button based off the slot * Set up the GUI with buttons
* *
* @param slot The slot in the inventory * @return The setup button array
* @return The button corresponding to that slot */
*/ protected abstract Button[] setUp(Player player);
public Button getButton(int slot)
{
try
{
return _buttons[slot];
} catch (ArrayIndexOutOfBoundsException e)
{
//There isn't a button there, so no need to throw an error
//e.printStackTrace();
return null;
}
}
/** public Button[] getButtons()
* Replace a button, or create a new button dynamically {
* Update the players GUI return _buttons;
* }
* @param slot The slot to set the new button
* @param button The reference to the button
* @param player The player whose GUI we'll be updating
*/
public void setButton(int slot, Button button, Player player)
{
try
{
_buttons[slot] = button;
} catch (ArrayIndexOutOfBoundsException ignored)
{
ignored.printStackTrace();
}
update(player);
}
/** public void setButtons(Button[] buttons)
* Refresh the players view, allows to change what the player sees, without opening and closing the GUI {
* _buttons = buttons;
* @param player The player whose view you wish to update }
*/
public void update(Player player)
{
InventoryView view = player.getOpenInventory();
if (view == null) /**
{ * Retrieve the button based off the slot
return; *
} * @param slot The slot in the inventory
* @return The button corresponding to that slot
*/
public Button getButton(int slot)
{
try
{
return _buttons[slot];
} catch (ArrayIndexOutOfBoundsException e)
{
//There isn't a button there, so no need to throw an error
//e.printStackTrace();
return null;
}
}
if (!view.getTitle().equalsIgnoreCase(getName())) /**
{ * Replace a button, or create a new button dynamically
return; * Update the players GUI
} *
* @param slot The slot to set the new button
* @param button The reference to the button
* @param player The player whose GUI we'll be updating
*/
public void setButton(int slot, Button button, Player player)
{
try
{
_buttons[slot] = button;
} catch (ArrayIndexOutOfBoundsException ignored)
{
ignored.printStackTrace();
}
update(player);
}
Inventory inventory = view.getTopInventory(); /**
for (int i = 0; i < _buttons.length; i++) * Refresh the players view, allows to change what the player sees, without opening and closing the GUI
{ *
if (_buttons[i] == null) * @param player The player whose view you wish to update
{ */
continue; public void update(Player player)
} {
InventoryView view = player.getOpenInventory();
ItemStack item = _buttons[i].getItemStack(); if (view == null)
{
return;
}
inventory.setItem(i, item); if (!view.getTitle().equalsIgnoreCase(getName()))
} {
} return;
}
public void setTitle(String title) Inventory inventory = view.getTopInventory();
{ for (int i = 0; i < _buttons.length; i++)
_name = title; {
} if (_buttons[i] == null)
{
continue;
}
public void onClose(Player player) ItemStack item = _buttons[i].getItemStack();
{
MENUS.remove(player.getUniqueId());
}
public static Menu remove(UUID uniqueId) inventory.setItem(i, item);
{ }
return MENUS.remove(uniqueId); }
}
public void setTitle(String title)
{
_name = title;
}
public void onClose(Player player)
{
MENUS.remove(player.getUniqueId());
}
public static Menu remove(UUID uniqueId)
{
return MENUS.remove(uniqueId);
}
} }

View File

@ -1,5 +1,7 @@
package mineplex.core.party.ui; package mineplex.core.party.ui;
import mineplex.core.party.ui.button.PartyMemberIcon;
import mineplex.core.party.ui.menus.PartyOwnerMenu;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.event.Event; import org.bukkit.event.Event;
import org.bukkit.event.EventHandler; import org.bukkit.event.EventHandler;
@ -39,6 +41,16 @@ public class MenuListener implements Listener
return; return;
} }
if(button instanceof PartyMemberIcon)
{
if(!(gui instanceof PartyOwnerMenu))
{
return;
}
((PartyMemberIcon) button).onClick(player, event.getCurrentItem());
return;
}
button.onClick(player, event.getClick()); button.onClick(player, event.getClick());
} }

View File

@ -1,10 +1,15 @@
package mineplex.core.party.ui.button; package mineplex.core.party.ui.button;
import mineplex.core.common.util.C; import mineplex.core.common.util.C;
import mineplex.core.common.util.UtilServer;
import mineplex.core.itemstack.ItemBuilder; import mineplex.core.itemstack.ItemBuilder;
import mineplex.core.itemstack.ItemStackFactory; import mineplex.core.itemstack.ItemStackFactory;
import mineplex.core.party.Party;
import mineplex.core.party.PartyManager; import mineplex.core.party.PartyManager;
import mineplex.core.party.event.PartyMemberKickGUIEvent;
import mineplex.core.party.ui.Button; import mineplex.core.party.ui.Button;
import mineplex.core.party.ui.button.tools.PartyButton;
import org.bukkit.ChatColor;
import org.bukkit.DyeColor; import org.bukkit.DyeColor;
import org.bukkit.Material; import org.bukkit.Material;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
@ -14,21 +19,31 @@ import org.bukkit.inventory.ItemStack;
/** /**
* The button representing a Party member. * The button representing a Party member.
*/ */
public class PartyMemberIcon extends IconButton public class PartyMemberIcon extends PartyButton
{ {
public PartyMemberIcon(String player, boolean owner) public PartyMemberIcon(String player, Party party, boolean owner)
{ {
super(new ItemBuilder(Material.SKULL_ITEM, 1, (byte) 3) super(new ItemBuilder(Material.SKULL_ITEM, 1, (byte) 3)
.setTitle(C.cYellow + player) .setTitle(C.cYellow + player)
.setGlow(owner) .setGlow(owner)
.setPlayerHead(player).build(), null); .setPlayerHead(player).build(), party, null);
} }
public PartyMemberIcon(String player) public PartyMemberIcon(String player, Party party)
{ {
this(player, false); this(player, party, false);
} }
public void onClick(Player clicker, ItemStack clicked)
{
String name = ChatColor.stripColor(clicked.getItemMeta().getDisplayName());
UtilServer.getPluginManager().callEvent(new PartyMemberKickGUIEvent(getParty(), name, clicker));
}
@Override
public void onClick(Player player, ClickType clickType)
{
}
} }

View File

@ -27,7 +27,8 @@ public class LeavePartyButton extends Button
@Override @Override
public void onClick(Player player, ClickType clickType) public void onClick(Player player, ClickType clickType)
{ {
player.performCommand("party leave"); player.chat("/party leave");
player.closeInventory();
} }
} }

View File

@ -1,8 +1,34 @@
package mineplex.core.party.ui.button.tools.main; package mineplex.core.party.ui.button.tools.main;
import mineplex.core.common.util.C;
import mineplex.core.itemstack.ItemBuilder;
import mineplex.core.party.PartyManager;
import mineplex.core.party.ui.Button;
import mineplex.core.party.ui.menus.input.PartyInvitePlayerMenu;
import org.bukkit.Material;
import org.bukkit.entity.Player;
import org.bukkit.event.inventory.ClickType;
import org.bukkit.inventory.ItemStack;
/** /**
* *
*/ */
public class InvitePlayerButton public class InvitePlayerButton extends Button
{ {
private static final ItemStack ITEM = new ItemBuilder(Material.NAME_TAG)
.setTitle(C.cYellow + "Invite a Player")
.setLore(" ", C.cGray + "Invites a player to join", C.cGray + "you in a new party.")
.build();
public InvitePlayerButton(PartyManager plugin)
{
super(ITEM, plugin);
}
@Override
public void onClick(Player player, ClickType clickType)
{
new PartyInvitePlayerMenu(getPlugin(), player).openInventory();
}
} }

View File

@ -1,8 +1,35 @@
package mineplex.core.party.ui.button.tools.main; package mineplex.core.party.ui.button.tools.main;
import mineplex.core.common.util.C;
import mineplex.core.inventory.data.Item;
import mineplex.core.itemstack.ItemBuilder;
import mineplex.core.party.PartyManager;
import mineplex.core.party.ui.Button;
import mineplex.core.party.ui.menus.PartyInvitesMenu;
import org.bukkit.Material;
import org.bukkit.entity.Player;
import org.bukkit.event.inventory.ClickType;
import org.bukkit.inventory.ItemStack;
/** /**
* *
*/ */
public class ViewInvitesButton public class ViewInvitesButton extends Button
{ {
private static final ItemStack ITEM = new ItemBuilder(Material.BOOK)
.setTitle(C.cYellow + "View Invites")
.setLore(" ", C.cGray + "Manage invites to parties.")
.build();
public ViewInvitesButton(PartyManager plugin)
{
super(ITEM, plugin);
}
@Override
public void onClick(Player player, ClickType clickType)
{
new PartyInvitesMenu(getPlugin()).open(player);
}
} }

View File

@ -30,7 +30,7 @@ public class AddPlayerButton extends PartyButton
@Override @Override
public void onClick(Player player, ClickType clickType) public void onClick(Player player, ClickType clickType)
{ {
new PartyInvitePlayerMenu(getPlugin(), player, getParty()).openInventory(); new PartyInvitePlayerMenu(getPlugin(), player).openInventory();
} }
} }

View File

@ -1,8 +1,38 @@
package mineplex.core.party.ui.button.tools.owner; package mineplex.core.party.ui.button.tools.owner;
import mineplex.core.common.util.C;
import mineplex.core.inventory.data.Item;
import mineplex.core.itemstack.ItemBuilder;
import mineplex.core.party.PartyManager;
import mineplex.core.party.ui.Button;
import org.bukkit.Material;
import org.bukkit.entity.Player;
import org.bukkit.event.inventory.ClickType;
import org.bukkit.inventory.ItemStack;
/** /**
* *
*/ */
public class DisbandPartyButton public class DisbandPartyButton extends Button
{ {
private static final ItemStack ITEM = new ItemBuilder(Material.BARRIER)
.setTitle(C.cRedB + "Disband your party")
.setLore(" ", C.cGray + "This will erase your party!", C.cRed + "Shift-Right-Click " + C.cGray + " to disband.")
.build();
public DisbandPartyButton(PartyManager plugin)
{
super(ITEM, plugin);
}
@Override
public void onClick(Player player, ClickType clickType)
{
if(clickType != ClickType.SHIFT_RIGHT)
{
return;
}
player.chat("/party disband");
}
} }

View File

@ -1,8 +1,51 @@
package mineplex.core.party.ui.button.tools.owner; package mineplex.core.party.ui.button.tools.owner;
import mineplex.core.common.util.C;
import mineplex.core.itemstack.ItemBuilder;
import mineplex.core.party.Party;
import mineplex.core.party.ui.Menu;
import mineplex.core.party.ui.button.tools.PartyButton;
import org.bukkit.Material;
import org.bukkit.entity.Player;
import org.bukkit.event.inventory.ClickType;
import org.bukkit.inventory.ItemStack;
/** /**
* *
*/ */
public class KickPlayerButton public class KickPlayerButton extends PartyButton
{ {
private static final ItemStack ITEM_OFF = new ItemBuilder(Material.IRON_AXE)
.setTitle(C.cYellow + "Kick Player's")
.setLore(" ", C.cRed + "Right Click to enter " + C.cGreen + "Kick Mode",
C.cGray + "While activated, click on a player's head", C.cGray + "to remove them fro the party")
.build();
private static final ItemStack ITEM_ON = new ItemBuilder(Material.IRON_AXE)
.setTitle(C.cYellow + "Kick Player's")
.setLore(" ", C.cGreen + "Right Click to leave " + C.cRed + "Kick Mode",
C.cGray + "While activated, click on a player's head", C.cGray + "to remove them fro the party")
.setGlow(true)
.build();
public KickPlayerButton(Party party)
{
super(ITEM_OFF, party, null);
}
@Override
public void onClick(Player player, ClickType clickType)
{
getParty().setOwnerKickMode(!getParty().isOwnerKickMode());
if (getParty().isOwnerKickMode())
{
setItemStack(ITEM_ON);
} else
{
setItemStack(ITEM_OFF);
}
Menu.get(player.getUniqueId()).update(player);
}
} }

View File

@ -1,8 +1,37 @@
package mineplex.core.party.ui.button.tools.owner; package mineplex.core.party.ui.button.tools.owner;
import mineplex.core.common.util.C;
import mineplex.core.common.util.UtilServer;
import mineplex.core.itemstack.ItemBuilder;
import mineplex.core.party.Party;
import mineplex.core.party.PartyManager;
import mineplex.core.party.event.PartySelectServerEvent;
import mineplex.core.party.ui.Button;
import mineplex.core.party.ui.button.tools.PartyButton;
import org.bukkit.Material;
import org.bukkit.entity.Player;
import org.bukkit.event.inventory.ClickType;
import org.bukkit.inventory.ItemStack;
/** /**
* *
*/ */
public class SelectServerButton public class SelectServerButton extends PartyButton
{ {
private static final ItemStack ITEM = new ItemBuilder(Material.COMPASS)
.setTitle(C.cYellow + "Select Server")
.setLore(" ", C.cGray + "Brings up the Server Selection GUI")
.build();
public SelectServerButton(Party party)
{
super(ITEM, party, null);
}
@Override
public void onClick(Player player, ClickType clickType)
{
UtilServer.getPluginManager().callEvent(new PartySelectServerEvent(getParty()));
}
} }

View File

@ -1,8 +1,36 @@
package mineplex.core.party.ui.button.tools.owner; package mineplex.core.party.ui.button.tools.owner;
import mineplex.core.common.util.C;
import mineplex.core.itemstack.ItemBuilder;
import mineplex.core.party.Party;
import mineplex.core.party.PartyManager;
import mineplex.core.party.ui.button.tools.PartyButton;
import mineplex.core.party.ui.menus.input.PartyTransferOwnerMenu;
import org.bukkit.Material;
import org.bukkit.entity.Player;
import org.bukkit.event.inventory.ClickType;
import org.bukkit.inventory.ItemStack;
/** /**
* *
*/ */
public class TransferOwnerButton public class TransferOwnerButton extends PartyButton
{ {
private static final ItemStack ITEM = new ItemBuilder(Material.BOOK_AND_QUILL)
.setTitle(C.cYellow + "Transfer Ownership")
.setLore(" ", C.cGray + "Transfers ownership of the party", C.cGray + "to another player",
" ", C.cDRed + "This cannot be undone!")
.build();
public TransferOwnerButton(Party party, PartyManager plugin)
{
super(ITEM, party, plugin);
}
@Override
public void onClick(Player player, ClickType clickType)
{
new PartyTransferOwnerMenu(getPlugin(), player, getParty());
}
} }

View File

@ -19,6 +19,7 @@ public class PartyInvitesMenu extends Menu
@Override @Override
protected Button[] setUp(Player player) protected Button[] setUp(Player player)
{ {
return new Button[0]; Button[] buttons = new Button[54];
return addPanes(buttons);
} }
} }

View File

@ -3,6 +3,8 @@ package mineplex.core.party.ui.menus;
import mineplex.core.party.PartyManager; import mineplex.core.party.PartyManager;
import mineplex.core.party.ui.Button; import mineplex.core.party.ui.Button;
import mineplex.core.party.ui.Menu; import mineplex.core.party.ui.Menu;
import mineplex.core.party.ui.button.tools.main.InvitePlayerButton;
import mineplex.core.party.ui.button.tools.main.ViewInvitesButton;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
/** /**
@ -21,6 +23,9 @@ public class PartyMainMenu extends Menu
{ {
Button[] buttons = new Button[9]; Button[] buttons = new Button[9];
buttons[3] = new InvitePlayerButton(_plugin);
buttons[5] = new ViewInvitesButton(_plugin);
return buttons; return buttons;
} }
} }

View File

@ -5,7 +5,7 @@ import mineplex.core.party.PartyManager;
import mineplex.core.party.ui.Button; import mineplex.core.party.ui.Button;
import mineplex.core.party.ui.Menu; import mineplex.core.party.ui.Menu;
import mineplex.core.party.ui.button.PartyMemberIcon; import mineplex.core.party.ui.button.PartyMemberIcon;
import mineplex.core.party.ui.button.tools.owner.AddPlayerButton; import mineplex.core.party.ui.button.tools.owner.*;
import mineplex.core.party.ui.button.tools.LeavePartyButton; import mineplex.core.party.ui.button.tools.LeavePartyButton;
import org.bukkit.Material; import org.bukkit.Material;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
@ -33,15 +33,15 @@ public class PartyOwnerMenu extends Menu
//Tools //Tools
buttons[1] = new AddPlayerButton(_plugin, _party); buttons[1] = new AddPlayerButton(_plugin, _party);
//Kick player //Kick player
buttons[4] = create(new ItemStack(Material.IRON_AXE)); buttons[4] = new KickPlayerButton(_party);
//Transfer ownership //Transfer ownership
buttons[7] = create(new ItemStack(Material.BOOK_AND_QUILL)); buttons[7] = new TransferOwnerButton(_party, _plugin);
//Go to server //Go to server
buttons[46] = create(new ItemStack(Material.COMPASS)); buttons[46] = new SelectServerButton(_party);
//Leave party //Leave party
buttons[49] = new LeavePartyButton(); buttons[49] = new LeavePartyButton();
//Disband //Disband
buttons[52] = create(new ItemStack(Material.BARRIER)); buttons[52] = new DisbandPartyButton(_plugin);
int slot = 20; int slot = 20;
//Players //Players
@ -51,9 +51,9 @@ public class PartyOwnerMenu extends Menu
{ {
slot = 29; slot = 29;
} }
buttons[slot++] = new PartyMemberIcon(_party.getMembers().get(i)); buttons[slot++] = new PartyMemberIcon(_party.getMembers().get(i), _party);
} }
return buttons; return addPanes(buttons);
} }
} }

View File

@ -26,23 +26,23 @@ public class PartyViewMenu extends Menu
@Override @Override
protected Button[] setUp(Player player) protected Button[] setUp(Player player)
{ {
Button[] buttons = new Button[36]; Button[] buttons = new Button[54];
//Tools //Tools
buttons[1] = new LeavePartyButton(); buttons[3] = new LeavePartyButton();
//Suggest Player //Suggest Player
buttons[4] = new SuggestPlayerButton(_party, _plugin); buttons[5] = new SuggestPlayerButton(_party, _plugin);
int slot = 20; int slot = 20;
//Players //Players
for(int i = 0; i < _party.getMembers().size(); i++) for (int i = 0; i < _party.getMembers().size(); i++)
{ {
if(slot == 25) if (slot == 25)
{ {
slot = 29; slot = 29;
} }
buttons[slot++] = new PartyMemberIcon(_party.getMembers().get(i)); buttons[slot++] = new PartyMemberIcon(_party.getMembers().get(i), _party);
} }
return buttons; return addPanes(buttons);
} }
} }

View File

@ -37,8 +37,7 @@ public abstract class PlayerNameActionMenu implements Listener
_player = player; _player = player;
_partyManager = partyManager; _partyManager = partyManager;
_party = party; _party = party;
player.closeInventory();
openInventory();
_partyManager.registerEvents(this); _partyManager.registerEvents(this);
} }
@ -81,6 +80,7 @@ public abstract class PlayerNameActionMenu implements Listener
{ {
if (_itemName.length() > 1 && !_searching) if (_itemName.length() > 1 && !_searching)
{ {
_searching = true;
final String name = _itemName; final String name = _itemName;
_partyManager.getClientManager().checkPlayerName(_player, _itemName, result -> { _partyManager.getClientManager().checkPlayerName(_player, _itemName, result -> {
@ -88,8 +88,7 @@ public abstract class PlayerNameActionMenu implements Listener
if (result != null) if (result != null)
{ {
onSuccess(name); onSuccess(result);
unregisterListener();
} else } else
{ {
onFail(name); onFail(name);
@ -112,7 +111,6 @@ public abstract class PlayerNameActionMenu implements Listener
public void openInventory() public void openInventory()
{ {
_player.closeInventory();
EntityPlayer p = ((CraftPlayer) _player).getHandle(); EntityPlayer p = ((CraftPlayer) _player).getHandle();

View File

@ -1,6 +1,5 @@
package mineplex.core.party.ui.menus.input; package mineplex.core.party.ui.menus.input;
import mineplex.core.party.Party;
import mineplex.core.party.PartyManager; import mineplex.core.party.PartyManager;
import mineplex.core.party.ui.menus.PartyOwnerMenu; import mineplex.core.party.ui.menus.PartyOwnerMenu;
import mineplex.core.party.ui.menus.PlayerNameActionMenu; import mineplex.core.party.ui.menus.PlayerNameActionMenu;
@ -13,17 +12,21 @@ import org.bukkit.entity.Player;
public class PartyInvitePlayerMenu extends PlayerNameActionMenu public class PartyInvitePlayerMenu extends PlayerNameActionMenu
{ {
public PartyInvitePlayerMenu(PartyManager partyManager, Player player, Party party) public PartyInvitePlayerMenu(PartyManager partyManager, Player player)
{ {
super(partyManager, player, party); super(partyManager, player, null);
} }
@Override @Override
public void onSuccess(String name) public void onSuccess(String name)
{ {
_partyManager.getRedisManager().findAndInvite(name, _player.getName()); _player.chat("/party invite " + name);
_player.playSound(_player.getLocation(), Sound.NOTE_PLING, 1, 1.6f); _player.playSound(_player.getLocation(), Sound.NOTE_PLING, 1, 1.6f);
_player.closeInventory(); _player.closeInventory();
if (_partyManager.getParty(_player) == null)
{
return;
}
new PartyOwnerMenu(_party, _partyManager).open(_player); new PartyOwnerMenu(_party, _partyManager).open(_player);
} }

View File

@ -0,0 +1,34 @@
package mineplex.core.party.ui.menus.input;
import mineplex.core.party.Lang;
import mineplex.core.party.Party;
import mineplex.core.party.PartyManager;
import mineplex.core.party.ui.menus.PlayerNameActionMenu;
import org.bukkit.entity.Player;
/**
*
*/
public class PartyTransferOwnerMenu extends PlayerNameActionMenu
{
public PartyTransferOwnerMenu(PartyManager partyManager, Player player, Party party)
{
super(partyManager, player, party);
}
@Override
public void onSuccess(String name)
{
_partyManager.transferOwner(name, _player.getName());
Lang.TRANSFER_OWNER.send(_party, _player.getName(), name);
_player.closeInventory();
_player.chat("/party");
}
@Override
public void onFail(String name)
{
}
}

View File

@ -26,13 +26,18 @@ public class PlayerSuggestPlayerMenu extends PlayerNameActionMenu
public void onSuccess(String name) public void onSuccess(String name)
{ {
Player player = Bukkit.getPlayerExact(_party.getOwner()); Player player = Bukkit.getPlayerExact(_party.getOwner());
_party.sendMessage(C.mHead + "Party> " + F.name(player.getName()) + " has suggested " + F.name(name) + " be invited.");
_party.sendMessage(C.mHead + "Party> " + F.name(_player.getName()) + " has suggested " + F.name(name) + " be invited.");
ChildJsonMessage message = new ChildJsonMessage("").extra(F.main("Party", "Type or click ")); ChildJsonMessage message = new ChildJsonMessage("").extra(F.main("Party", "Type or click "));
message.add(F.link("/party invite " + name)) message.add(F.link("/party invite " + name))
.hover(HoverEvent.SHOW_TEXT, C.cGreen + "Clicking this will invite " + C.cYellow + name + C.cGreen + " to the party") .hover(HoverEvent.SHOW_TEXT, C.cGreen + "Clicking this will invite " + C.cYellow + name + C.cGreen + " to the party")
.click(ClickEvent.RUN_COMMAND, "/party invite " + name); .click(ClickEvent.RUN_COMMAND, "/party invite " + name);
message.add(C.mBody + " to invite them"); message.add(C.mBody + " to invite them");
message.sendToPlayer(player); message.sendToPlayer(player);
_player.closeInventory();
_player.chat("/party");
} }
@Override @Override

View File

@ -54,7 +54,15 @@ import mineplex.core.blockrestore.BlockRestore;
import mineplex.core.bonuses.BonusManager; import mineplex.core.bonuses.BonusManager;
import mineplex.core.botspam.BotSpamManager; import mineplex.core.botspam.BotSpamManager;
import mineplex.core.common.Rank; import mineplex.core.common.Rank;
import mineplex.core.common.util.*; import mineplex.core.common.util.C;
import mineplex.core.common.util.F;
import mineplex.core.common.util.UtilInv;
import mineplex.core.common.util.UtilMath;
import mineplex.core.common.util.UtilPlayer;
import mineplex.core.common.util.UtilServer;
import mineplex.core.common.util.UtilTextBottom;
import mineplex.core.common.util.UtilTime;
import mineplex.core.common.util.UtilWorld;
import mineplex.core.cosmetic.CosmeticManager; import mineplex.core.cosmetic.CosmeticManager;
import mineplex.core.customdata.CustomDataManager; import mineplex.core.customdata.CustomDataManager;
import mineplex.core.disguise.DisguiseManager; import mineplex.core.disguise.DisguiseManager;
@ -97,8 +105,21 @@ import mineplex.core.treasure.TreasureManager;
import mineplex.core.updater.UpdateType; import mineplex.core.updater.UpdateType;
import mineplex.core.updater.event.UpdateEvent; import mineplex.core.updater.event.UpdateEvent;
import mineplex.core.valentines.ValentinesGiftManager; import mineplex.core.valentines.ValentinesGiftManager;
import mineplex.hub.commands.*; import mineplex.hub.commands.DisguiseCommand;
import mineplex.hub.modules.*; import mineplex.hub.commands.ForcefieldRadius;
import mineplex.hub.commands.GadgetToggle;
import mineplex.hub.commands.GameModeCommand;
import mineplex.hub.commands.NewsCommand;
import mineplex.hub.modules.ForcefieldManager;
import mineplex.hub.modules.HubVisibilityManager;
import mineplex.hub.modules.JumpManager;
import mineplex.hub.modules.KothManager;
import mineplex.hub.modules.NewsManager;
import mineplex.hub.modules.ParkourManager;
import mineplex.hub.modules.SoccerManager;
import mineplex.hub.modules.TextManager;
import mineplex.hub.modules.ValentinesManager;
import mineplex.hub.modules.WorldManager;
import mineplex.hub.profile.gui.GUIProfile; import mineplex.hub.profile.gui.GUIProfile;
import mineplex.hub.tutorial.TutorialManager; import mineplex.hub.tutorial.TutorialManager;
import mineplex.minecraft.game.classcombat.Skill.event.SkillTriggerEvent; import mineplex.minecraft.game.classcombat.Skill.event.SkillTriggerEvent;
@ -112,36 +133,6 @@ import net.md_5.bungee.api.chat.HoverEvent.Action;
import net.md_5.bungee.api.chat.TextComponent; import net.md_5.bungee.api.chat.TextComponent;
import net.minecraft.server.v1_8_R3.EntityInsentient; import net.minecraft.server.v1_8_R3.EntityInsentient;
import net.minecraft.server.v1_8_R3.EntityPlayer; import net.minecraft.server.v1_8_R3.EntityPlayer;
import org.bukkit.*;
import org.bukkit.craftbukkit.v1_8_R3.CraftWorld;
import org.bukkit.entity.Egg;
import org.bukkit.entity.Entity;
import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.entity.EntityDamageEvent;
import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
import org.bukkit.event.entity.EntityTargetEvent.TargetReason;
import org.bukkit.event.entity.ItemSpawnEvent;
import org.bukkit.event.entity.PlayerDeathEvent;
import org.bukkit.event.inventory.InventoryClickEvent;
import org.bukkit.event.player.*;
import org.bukkit.event.server.ServerListPingEvent;
import org.bukkit.event.world.ChunkLoadEvent;
import org.bukkit.plugin.java.JavaPlugin;
import org.bukkit.scoreboard.DisplaySlot;
import org.bukkit.scoreboard.Objective;
import org.bukkit.scoreboard.Scoreboard;
import java.io.DataInputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Random;
public class HubManager extends MiniClientPlugin<HubClient> public class HubManager extends MiniClientPlugin<HubClient>
{ {
@ -197,15 +188,15 @@ public class HubManager extends MiniClientPlugin<HubClient>
// Christmas Songs // Christmas Songs
private Random _random = new Random(); private Random _random = new Random();
private int _lastSong = 0; private int _lastSong = 0;
// private final String[] _songNames = {"JingleBells.nbs", "TheFirstNoel.nbs", "Hark.nbs", "DeckTheHalls.nbs", "Joy.nbs", "MerryChristmas.nbs"}; // private final String[] _songNames = {"JingleBells.nbs", "TheFirstNoel.nbs", "Hark.nbs", "DeckTheHalls.nbs", "Joy.nbs", "MerryChristmas.nbs"};
private final ArrayList<NoteSong> _songs; private final ArrayList<NoteSong> _songs;
public HubManager(JavaPlugin plugin, BlockRestore blockRestore, CoreClientManager clientManager, IncognitoManager incognito, DonationManager donationManager, InventoryManager inventoryManager, ConditionManager conditionManager, DisguiseManager disguiseManager, TaskManager taskManager, Portal portal, PartyManager partyManager, PreferencesManager preferences, PetManager petManager, PollManager pollManager, StatsManager statsManager, AchievementManager achievementManager, HologramManager hologramManager, NpcManager npcManager, PersonalServerManager personalServerManager, PacketHandler packetHandler, Punish punish, ServerStatusManager serverStatusManager, CustomDataManager customDataManager) public HubManager(JavaPlugin plugin, BlockRestore blockRestore, CoreClientManager clientManager, IncognitoManager incognito, DonationManager donationManager, InventoryManager inventoryManager, ConditionManager conditionManager, DisguiseManager disguiseManager, TaskManager taskManager, Portal portal, PartyManager partyManager, PreferencesManager preferences, PetManager petManager, PollManager pollManager, StatsManager statsManager, AchievementManager achievementManager, HologramManager hologramManager, NpcManager npcManager, PersonalServerManager personalServerManager, PacketHandler packetHandler, Punish punish, ServerStatusManager serverStatusManager, CustomDataManager customDataManager, BoosterManager boosterManager)
{ {
super("Hub Manager", plugin); super("Hub Manager", plugin);
_incognito = incognito; _incognito = incognito;
_blockRestore = blockRestore; _blockRestore = blockRestore;
_clientManager = clientManager; _clientManager = clientManager;
_conditionManager = conditionManager; _conditionManager = conditionManager;
@ -237,7 +228,7 @@ public class HubManager extends MiniClientPlugin<HubClient>
FacebookManager facebookManager = new FacebookManager(plugin, clientManager, donationManager, inventoryManager); FacebookManager facebookManager = new FacebookManager(plugin, clientManager, donationManager, inventoryManager);
_bonusManager = new BonusManager(plugin, clientManager, serverStatusManager, donationManager, pollManager , npcManager, hologramManager, statsManager, _inventoryManager, petManager, facebookManager, _gadgetManager); _bonusManager = new BonusManager(plugin, clientManager, serverStatusManager, donationManager, pollManager , npcManager, hologramManager, statsManager, _inventoryManager, petManager, facebookManager, _gadgetManager);
_treasureManager = new TreasureManager(_plugin, clientManager, serverStatusManager, donationManager, _inventoryManager, petManager, _blockRestore, hologramManager, statsManager, _bonusManager.getRewardManager()); _treasureManager = new TreasureManager(_plugin, clientManager, serverStatusManager, donationManager, _inventoryManager, petManager, _blockRestore, hologramManager, statsManager, _bonusManager.getRewardManager());
new CosmeticManager(_plugin, clientManager, donationManager, _inventoryManager, _gadgetManager, _mountManager, petManager, _treasureManager, boosterManager); new CosmeticManager(_plugin, clientManager, donationManager, _inventoryManager, _gadgetManager, _mountManager, petManager, _treasureManager, boosterManager);
@ -276,11 +267,11 @@ public class HubManager extends MiniClientPlugin<HubClient>
_playerCountManager = new PlayerCountManager(plugin); _playerCountManager = new PlayerCountManager(plugin);
_customDataManager = new CustomDataManager(plugin, clientManager); _customDataManager = new CustomDataManager(plugin, clientManager);
_songs = new ArrayList<NoteSong>(); _songs = new ArrayList<NoteSong>();
_punishManager = punish; _punishManager = punish;
_valentinesManager = new ValentinesManager(plugin, clientManager, donationManager); _valentinesManager = new ValentinesManager(plugin, clientManager, donationManager);
try try
@ -440,9 +431,9 @@ public class HubManager extends MiniClientPlugin<HubClient>
@EventHandler(priority = EventPriority.LOW) @EventHandler(priority = EventPriority.LOW)
public void login(final PlayerLoginEvent event) public void login(final PlayerLoginEvent event)
{ {
CoreClient client = _clientManager.Get(event.getPlayer().getName()); CoreClient client = _clientManager.Get(event.getPlayer().getName());
// Reserved Slot Check // Reserved Slot Check
if (Bukkit.getOnlinePlayers().size() - Bukkit.getServer().getMaxPlayers() >= 20) if (Bukkit.getOnlinePlayers().size() - Bukkit.getServer().getMaxPlayers() >= 20)
{ {
if (!client.GetRank().has(Rank.ULTRA)) if (!client.GetRank().has(Rank.ULTRA))
@ -467,13 +458,13 @@ public class HubManager extends MiniClientPlugin<HubClient>
{ {
// Give developers operator on their servers // Give developers operator on their servers
boolean testServer = _plugin.getConfig().getString("serverstatus.group").equalsIgnoreCase("Testing"); boolean testServer = _plugin.getConfig().getString("serverstatus.group").equalsIgnoreCase("Testing");
Rank minimum = Rank.OWNER; Rank minimum = Rank.OWNER;
if (testServer) if (testServer)
{ {
minimum = Rank.JNR_DEV; minimum = Rank.JNR_DEV;
} }
if (_clientManager.Get(event.getPlayer()).GetRank().has(minimum)) if (_clientManager.Get(event.getPlayer()).GetRank().has(minimum))
event.getPlayer().setOp(true); event.getPlayer().setOp(true);
else else
@ -580,7 +571,7 @@ public class HubManager extends MiniClientPlugin<HubClient>
event.setCancelled(true); event.setCancelled(true);
} }
} }
@EventHandler @EventHandler
public void Incog(IncognitoHidePlayerEvent event) public void Incog(IncognitoHidePlayerEvent event)
{ {
@ -613,7 +604,7 @@ public class HubManager extends MiniClientPlugin<HubClient>
Rank rank = GetClients().Get(player).GetRank(); Rank rank = GetClients().Get(player).GetRank();
if(GetClients().Get(player).isDisguised()) if (GetClients().Get(player).isDisguised())
rank = GetClients().Get(player).getDisguisedRank(); rank = GetClients().Get(player).getDisguisedRank();
//Level Prefix //Level Prefix
@ -621,11 +612,36 @@ public class HubManager extends MiniClientPlugin<HubClient>
//Rank Prefix //Rank Prefix
String rankStr = ""; String rankStr = "";
if (rank != Rank.ALL) if (rank != Rank.ALL)
{
rankStr = rank.getTag(true, true) + " "; rankStr = rank.getTag(true, true) + " ";
} //Party Chat
if (event.getMessage().charAt(0) == '#')
{
Party party = _partyManager.getParty(player);
if (party != null)
{
event.getRecipients().clear();
event.setMessage(event.getMessage().substring(1, event.getMessage().length()));
event.setFormat(levelStr + C.cDPurple + C.Bold + "Party " + C.cWhite + C.Bold + playerName + " " + C.cPurple + "%2$s");
for (String name : party.getMembers())
{
Player other = UtilPlayer.searchExact(name);
if (other != null)
{
event.getRecipients().add(other);
}
}
} else
{
UtilPlayer.message(player, F.main("Party", "You are not in a Party."));
event.setCancelled(true);
}
} else
{
TextComponent rankComponent = new TextComponent(rankStr); TextComponent rankComponent = new TextComponent(rankStr);
TextComponent playerNameText = new TextComponent(ChatColor.YELLOW + playerName); TextComponent playerNameText = new TextComponent(ChatColor.YELLOW + playerName);
TextComponent component = new TextComponent(); TextComponent component = new TextComponent();
@ -636,6 +652,7 @@ public class HubManager extends MiniClientPlugin<HubClient>
component.addExtra(rankComponent); component.addExtra(rankComponent);
component.addExtra(playerNameText); component.addExtra(playerNameText);
component.addExtra(" " + ChatColor.WHITE + event.getMessage()); component.addExtra(" " + ChatColor.WHITE + event.getMessage());
for (Player other : UtilServer.getPlayers()) for (Player other : UtilServer.getPlayers())
{ {
if (_tutorialManager.InTutorial(other)) if (_tutorialManager.InTutorial(other))
@ -644,10 +661,12 @@ public class HubManager extends MiniClientPlugin<HubClient>
continue; continue;
} }
if(!event.isCancelled()) if (!event.isCancelled())
other.spigot().sendMessage(component); other.spigot().sendMessage(component);
} }
event.setCancelled(true); event.setCancelled(true);
// }
}
} }
@EventHandler @EventHandler
@ -715,7 +734,7 @@ public class HubManager extends MiniClientPlugin<HubClient>
return; return;
int playerCount = _playerCountManager.getPlayerCount(); int playerCount = _playerCountManager.getPlayerCount();
for (Player player : UtilServer.getPlayers()) for (Player player : UtilServer.getPlayers())
{ {
@ -752,7 +771,7 @@ public class HubManager extends MiniClientPlugin<HubClient>
obj.getScore(C.cYellow + C.Bold + "Players").setScore(line--); obj.getScore(C.cYellow + C.Bold + "Players").setScore(line--);
player.getScoreboard().resetScores(_lastPlayerCount + ""); player.getScoreboard().resetScores(_lastPlayerCount + "");
obj.getScore(playerCount + "").setScore(line--); obj.getScore(playerCount + "").setScore(line--);
//Space //Space
obj.getScore(" ").setScore(line--); obj.getScore(" ").setScore(line--);
@ -768,10 +787,10 @@ public class HubManager extends MiniClientPlugin<HubClient>
if (GetClients().Get(player).GetRank().has(Rank.ULTRA)) if (GetClients().Get(player).GetRank().has(Rank.ULTRA))
obj.getScore(GetClients().Get(player).GetRank().Name).setScore(line--); obj.getScore(GetClients().Get(player).GetRank().Name).setScore(line--);
else if (GetDonation().Get(player.getName()).OwnsUnknownPackage("SuperSmashMobs ULTRA") || else if (GetDonation().Get(player.getName()).OwnsUnknownPackage("SuperSmashMobs ULTRA") ||
GetDonation().Get(player.getName()).OwnsUnknownPackage("Survival Games ULTRA") || GetDonation().Get(player.getName()).OwnsUnknownPackage("Survival Games ULTRA") ||
GetDonation().Get(player.getName()).OwnsUnknownPackage("Minigames ULTRA") || GetDonation().Get(player.getName()).OwnsUnknownPackage("Minigames ULTRA") ||
GetDonation().Get(player.getName()).OwnsUnknownPackage("CastleSiege ULTRA") || GetDonation().Get(player.getName()).OwnsUnknownPackage("CastleSiege ULTRA") ||
GetDonation().Get(player.getName()).OwnsUnknownPackage("Champions ULTRA")) GetDonation().Get(player.getName()).OwnsUnknownPackage("Champions ULTRA"))
obj.getScore("Single Ultra").setScore(line--); obj.getScore("Single Ultra").setScore(line--);
else else
obj.getScore("No Rank").setScore(line--); obj.getScore("No Rank").setScore(line--);
@ -785,7 +804,7 @@ public class HubManager extends MiniClientPlugin<HubClient>
obj.getScore("www.mineplex.com").setScore(line--); obj.getScore("www.mineplex.com").setScore(line--);
obj.getScore("----------------").setScore(line--); obj.getScore("----------------").setScore(line--);
} }
_lastPlayerCount = playerCount; _lastPlayerCount = playerCount;
} }
@ -852,9 +871,9 @@ public class HubManager extends MiniClientPlugin<HubClient>
public PetManager getPetManager() public PetManager getPetManager()
{ {
return _petManager; return _petManager;
} }
public BonusManager getBonusManager() public BonusManager getBonusManager()
{ {
return _bonusManager; return _bonusManager;
@ -879,7 +898,7 @@ public class HubManager extends MiniClientPlugin<HubClient>
{ {
return _customDataManager; return _customDataManager;
} }
public Punish getPunishments() public Punish getPunishments()
{ {
return _punishManager; return _punishManager;
@ -889,7 +908,7 @@ public class HubManager extends MiniClientPlugin<HubClient>
// { // {
// return _halloweenManager; // return _halloweenManager;
// } // }
@EventHandler(priority = EventPriority.MONITOR) @EventHandler(priority = EventPriority.MONITOR)
public void gadgetCollide(GadgetCollideEntityEvent event) public void gadgetCollide(GadgetCollideEntityEvent event)
{ {
@ -995,7 +1014,7 @@ public class HubManager extends MiniClientPlugin<HubClient>
if (entity instanceof EntityInsentient) if (entity instanceof EntityInsentient)
{ {
EntityInsentient entityMonster = (EntityInsentient)entity; EntityInsentient entityMonster = (EntityInsentient)entity;
if (entityMonster.getGoalTarget() != null && entityMonster.getGoalTarget() instanceof EntityPlayer) if (entityMonster.getGoalTarget() != null && entityMonster.getGoalTarget() instanceof EntityPlayer)
{ {
if (((EntityPlayer)entityMonster.getGoalTarget()).playerConnection.isDisconnected()) if (((EntityPlayer)entityMonster.getGoalTarget()).playerConnection.isDisconnected())
@ -1004,7 +1023,7 @@ public class HubManager extends MiniClientPlugin<HubClient>
} }
} }
} }
@EventHandler @EventHandler
public void clearGameMode(PlayerQuitEvent event) public void clearGameMode(PlayerQuitEvent event)
{ {
@ -1027,7 +1046,7 @@ public class HubManager extends MiniClientPlugin<HubClient>
public PacketHandler getPacketHandler() public PacketHandler getPacketHandler()
{ {
return _packetHandler; return _packetHandler;
} }
@EventHandler @EventHandler
@ -1054,17 +1073,17 @@ public class HubManager extends MiniClientPlugin<HubClient>
{ {
playNextSong(); playNextSong();
} }
@EventHandler @EventHandler
public void trackPortalDelayPlayers(UpdateEvent event) public void trackPortalDelayPlayers(UpdateEvent event)
{ {
if (event.getType() != UpdateType.TICK) if (event.getType() != UpdateType.TICK)
return; return;
for (Iterator<String> playerNameIterator = _portalTime.keySet().iterator(); playerNameIterator.hasNext();) for (Iterator<String> playerNameIterator = _portalTime.keySet().iterator(); playerNameIterator.hasNext();)
{ {
String playerName = playerNameIterator.next(); String playerName = playerNameIterator.next();
if (UtilTime.elapsed(_portalTime.get(playerName), 5000)) if (UtilTime.elapsed(_portalTime.get(playerName), 5000))
{ {
playerNameIterator.remove(); playerNameIterator.remove();
@ -1076,4 +1095,4 @@ public class HubManager extends MiniClientPlugin<HubClient>
{ {
return _incognito; return _incognito;
} }
} }

View File

@ -249,7 +249,7 @@ public class NewsManager extends MiniPlugin
} }
} }
@EventHandler /* @EventHandler
public void DragonBarUpdate(UpdateEvent event) public void DragonBarUpdate(UpdateEvent event)
{ {
if (event.getType() != UpdateType.FASTEST) if (event.getType() != UpdateType.FASTEST)
@ -296,10 +296,10 @@ public class NewsManager extends MiniPlugin
} }
else if (Manager.Type == HubType.Halloween) else if (Manager.Type == HubType.Halloween)
{ {
/** *//**
* @author Mysticate * @author Mysticate
* Myst's sexy ass animation :> * Myst's sexy ass animation :>
*/ *//*
_animationIndex = (_animationIndex + 1) % 147; _animationIndex = (_animationIndex + 1) % 147;
@ -457,5 +457,5 @@ public class NewsManager extends MiniPlugin
((MorphWither)gadget).setWitherData(text, healthPercent); ((MorphWither)gadget).setWitherData(text, healthPercent);
} }
} }
} }*/
} }

View File

@ -2,16 +2,21 @@ package mineplex.hub.queue.ui;
import mineplex.core.account.CoreClientManager; import mineplex.core.account.CoreClientManager;
import mineplex.core.donation.DonationManager; import mineplex.core.donation.DonationManager;
import mineplex.core.party.Party;
import mineplex.core.shop.item.IButton; import mineplex.core.shop.item.IButton;
import mineplex.core.shop.item.ShopItem; import mineplex.core.shop.item.ShopItem;
import mineplex.core.shop.page.ShopPageBase; import mineplex.core.shop.page.ShopPageBase;
import mineplex.hub.queue.PlayerMatchStatus; import mineplex.hub.queue.PlayerMatchStatus;
import mineplex.hub.queue.QueueManager; import mineplex.hub.queue.QueueManager;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor; import org.bukkit.ChatColor;
import org.bukkit.Material; import org.bukkit.Material;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.event.inventory.ClickType; import org.bukkit.event.inventory.ClickType;
import java.util.List;
import java.util.stream.Collectors;
public class QueuePage extends ShopPageBase<QueueManager, QueueShop> public class QueuePage extends ShopPageBase<QueueManager, QueueShop>
{ {
private boolean _closeOnNextUpdate; private boolean _closeOnNextUpdate;
@ -125,8 +130,17 @@ public class QueuePage extends ShopPageBase<QueueManager, QueueShop>
private void queuePlayer(int gameType, Player player) private void queuePlayer(int gameType, Player player)
{ {
getPlugin().queuePlayer(gameType, player); Party party = getPlugin().getPartyManager().getParty(player);
if(party == null)
{
getPlugin().queuePlayer(gameType, player);
return;
}
if(party.getOwner().equalsIgnoreCase(player.getName()))
{
List<Player> players = party.getMembers().stream().map(Bukkit::getPlayerExact).collect(Collectors.toList());
getPlugin().queuePlayer(gameType, players.toArray(new Player[players.size()]));
}
buildPage(); buildPage();
} }

View File

@ -1,12 +1,16 @@
package mineplex.hub.queue.ui; package mineplex.hub.queue.ui;
import mineplex.core.account.CoreClientManager; import mineplex.core.account.CoreClientManager;
import mineplex.core.common.util.C;
import mineplex.core.common.util.F;
import mineplex.core.party.Party;
import mineplex.core.shop.ShopBase; import mineplex.core.shop.ShopBase;
import mineplex.core.shop.page.ShopPageBase; import mineplex.core.shop.page.ShopPageBase;
import mineplex.core.updater.UpdateType; import mineplex.core.updater.UpdateType;
import mineplex.core.updater.event.UpdateEvent; import mineplex.core.updater.event.UpdateEvent;
import mineplex.hub.queue.QueueManager; import mineplex.hub.queue.QueueManager;
import org.bukkit.ChatColor; import org.bukkit.ChatColor;
import org.bukkit.Sound;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler; import org.bukkit.event.EventHandler;
@ -28,15 +32,15 @@ public class QueueShop extends ShopBase<QueueManager>
@Override @Override
protected boolean canOpenShop(Player player) protected boolean canOpenShop(Player player)
{ {
/* Party party = getPlugin().getPartyManager().GetParty(player); Party party = getPlugin().getPartyManager().getParty(player);
if (party != null && !player.getName().equalsIgnoreCase(party.GetLeader())) if (party != null && !player.getName().equalsIgnoreCase(party.getOwner()))
{ {
player.playSound(player.getLocation(), Sound.ITEM_BREAK, 1, .6f); player.playSound(player.getLocation(), Sound.ITEM_BREAK, 1, .6f);
player.sendMessage(F.main("Party", "Only Party Leaders can join games.")); player.sendMessage(F.main("Party", "Only Party Leaders can join games."));
player.sendMessage(F.main("Party", "Type " + C.cGreen + "/party leave" + C.cGray + " if you wish to leave your party.")); player.sendMessage(F.main("Party", "Type " + C.cGreen + "/party leave" + C.cGray + " if you wish to leave your party."));
return false; return false;
}*/ }
return true; return true;
} }

View File

@ -1,11 +1,15 @@
package mineplex.hub.server.ui; package mineplex.hub.server.ui;
import mineplex.core.account.CoreClientManager; import mineplex.core.account.CoreClientManager;
import mineplex.core.common.util.C;
import mineplex.core.common.util.F;
import mineplex.core.donation.DonationManager; import mineplex.core.donation.DonationManager;
import mineplex.core.party.Party;
import mineplex.core.shop.ShopBase; import mineplex.core.shop.ShopBase;
import mineplex.core.shop.page.ShopPageBase; import mineplex.core.shop.page.ShopPageBase;
import mineplex.hub.server.ServerManager; import mineplex.hub.server.ServerManager;
import mineplex.serverdata.data.ServerGroup; import mineplex.serverdata.data.ServerGroup;
import org.bukkit.Sound;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
public class ServerNpcShop extends ShopBase<ServerManager> public class ServerNpcShop extends ShopBase<ServerManager>
@ -36,15 +40,15 @@ public class ServerNpcShop extends ShopBase<ServerManager>
@Override @Override
protected boolean canOpenShop(Player player) protected boolean canOpenShop(Player player)
{ {
/* Party party = getPlugin().getPartyManager().GetParty(player); Party party = getPlugin().getPartyManager().getParty(player);
if (party != null && !player.getName().equalsIgnoreCase(party.GetLeader())) if (party != null && !player.getName().equalsIgnoreCase(party.getOwner()))
{ {
player.playSound(player.getLocation(), Sound.ITEM_BREAK, 1, .6f); player.playSound(player.getLocation(), Sound.ITEM_BREAK, 1, .6f);
player.sendMessage(F.main("Party", "Only Party Leaders can join games.")); player.sendMessage(F.main("Party", "Only Party Leaders can join games."));
player.sendMessage(F.main("Party", "Type " + C.cGreen + "/party leave" + C.cGray + " if you wish to leave your party.")); player.sendMessage(F.main("Party", "Type " + C.cGreen + "/party leave" + C.cGray + " if you wish to leave your party."));
return false; return false;
}*/ }
return true; return true;
} }

View File

@ -1,12 +1,15 @@
package mineplex.hub.server.ui.clans; package mineplex.hub.server.ui.clans;
import mineplex.core.account.CoreClientManager; import mineplex.core.account.CoreClientManager;
import mineplex.core.common.util.F;
import mineplex.core.donation.DonationManager; import mineplex.core.donation.DonationManager;
import mineplex.core.party.Party;
import mineplex.core.shop.ShopBase; import mineplex.core.shop.ShopBase;
import mineplex.core.shop.page.ShopPageBase; import mineplex.core.shop.page.ShopPageBase;
import mineplex.game.clans.core.repository.ClanRepository; import mineplex.game.clans.core.repository.ClanRepository;
import mineplex.game.clans.core.repository.tokens.SimpleClanToken; import mineplex.game.clans.core.repository.tokens.SimpleClanToken;
import mineplex.hub.server.ServerManager; import mineplex.hub.server.ServerManager;
import org.bukkit.Sound;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
public class ClanMoveServerShop extends ShopBase<ServerManager> public class ClanMoveServerShop extends ShopBase<ServerManager>
@ -33,14 +36,14 @@ public class ClanMoveServerShop extends ShopBase<ServerManager>
@Override @Override
protected boolean canOpenShop(Player player) protected boolean canOpenShop(Player player)
{ {
/* Party party = getPlugin().getPartyManager().GetParty(player); Party party = getPlugin().getPartyManager().getParty(player);
if (party != null) if (party != null)
{ {
player.playSound(player.getLocation(), Sound.ITEM_BREAK, 1, .6f); player.playSound(player.getLocation(), Sound.ITEM_BREAK, 1, .6f);
player.sendMessage(F.main("Party", "You cannot join Clans while in a party.")); player.sendMessage(F.main("Party", "You cannot join Clans while in a party."));
return false; return false;
}*/ }
return true; return true;
} }

View File

@ -1,11 +1,14 @@
package mineplex.hub.server.ui.clans; package mineplex.hub.server.ui.clans;
import mineplex.core.account.CoreClientManager; import mineplex.core.account.CoreClientManager;
import mineplex.core.common.util.F;
import mineplex.core.donation.DonationManager; import mineplex.core.donation.DonationManager;
import mineplex.core.party.Party;
import mineplex.core.shop.ShopBase; import mineplex.core.shop.ShopBase;
import mineplex.core.shop.page.ShopPageBase; import mineplex.core.shop.page.ShopPageBase;
import mineplex.game.clans.core.repository.ClanRepository; import mineplex.game.clans.core.repository.ClanRepository;
import mineplex.hub.server.ServerManager; import mineplex.hub.server.ServerManager;
import org.bukkit.Sound;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
public class ClansServerShop extends ShopBase<ServerManager> public class ClansServerShop extends ShopBase<ServerManager>
@ -28,14 +31,14 @@ public class ClansServerShop extends ShopBase<ServerManager>
@Override @Override
protected boolean canOpenShop(Player player) protected boolean canOpenShop(Player player)
{ {
/* Party party = getPlugin().getPartyManager().GetParty(player); Party party = getPlugin().getPartyManager().getParty(player);
if (party != null) if (party != null)
{ {
player.playSound(player.getLocation(), Sound.ITEM_BREAK, 1, .6f); player.playSound(player.getLocation(), Sound.ITEM_BREAK, 1, .6f);
player.sendMessage(F.main("Party", "You cannot join Clans while in a party.")); player.sendMessage(F.main("Party", "You cannot join Clans while in a party."));
return false; return false;
}*/ }
return true; return true;
} }

View File

@ -1,7 +1,7 @@
package nautilus.game.arcade.game.games.speedbuilders.data; package nautilus.game.arcade.game.games.speedbuilders.data;
import java.util.ArrayList; import mineplex.core.common.util.*;
import mineplex.core.hologram.Hologram;
import org.bukkit.Effect; import org.bukkit.Effect;
import org.bukkit.Location; import org.bukkit.Location;
import org.bukkit.Material; import org.bukkit.Material;
@ -13,14 +13,7 @@ import org.bukkit.inventory.ItemStack;
import org.bukkit.material.Bed; import org.bukkit.material.Bed;
import org.bukkit.material.Door; import org.bukkit.material.Door;
import mineplex.core.common.util.MapUtil; import java.util.ArrayList;
import mineplex.core.common.util.NautHashMap;
import mineplex.core.common.util.UtilAlg;
import mineplex.core.common.util.UtilBlock;
import mineplex.core.common.util.UtilEnt;
import mineplex.core.common.util.UtilInv;
import mineplex.core.common.util.UtilTime;
import mineplex.core.hologram.Hologram;
public class DemolitionData public class DemolitionData
{ {
@ -65,9 +58,9 @@ public class DemolitionData
loc = Blocks.keySet().iterator().next().getLocation().add(0.5, 0.5, 0.5); loc = Blocks.keySet().iterator().next().getLocation().add(0.5, 0.5, 0.5);
else if (!Mobs.isEmpty()) else if (!Mobs.isEmpty())
loc = UtilAlg.Random(Mobs).getLocation().add(0, 1, 0); loc = UtilAlg.Random(Mobs).getLocation().add(0, 1, 0);
_hologram = new Hologram(Parent.Game.Manager.getHologramManager(), loc, "3"); _hologram = new Hologram(Parent.Game.Manager.getHologramManager(), loc, "3");
_hologram.start(); _hologram.start();
} }

View File

@ -6,10 +6,12 @@ import mineplex.core.common.jsonchat.JsonMessage;
import mineplex.core.common.util.C; import mineplex.core.common.util.C;
import mineplex.core.common.util.F; import mineplex.core.common.util.F;
import mineplex.core.common.util.UtilPlayer; import mineplex.core.common.util.UtilPlayer;
import mineplex.core.party.Party;
import nautilus.game.arcade.ArcadeManager; import nautilus.game.arcade.ArcadeManager;
import nautilus.game.arcade.game.Game; import nautilus.game.arcade.game.Game;
import nautilus.game.arcade.game.Game.GameState; import nautilus.game.arcade.game.Game.GameState;
import nautilus.game.arcade.game.GameTeam; import nautilus.game.arcade.game.GameTeam;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor; import org.bukkit.ChatColor;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler; import org.bukkit.event.EventHandler;
@ -20,6 +22,7 @@ import org.jooq.tools.json.JSONObject;
import java.text.DecimalFormat; import java.text.DecimalFormat;
import java.util.*; import java.util.*;
import java.util.stream.Collectors;
public class GameChatManager implements Listener public class GameChatManager implements Listener
{ {
@ -116,10 +119,10 @@ public class GameChatManager implements Listener
rankStr = rank.getTag(true, true) + " " + C.Reset; rankStr = rank.getTag(true, true) + " " + C.Reset;
} }
/* if (event.getMessage().charAt(0) == '@') if (event.getMessage().charAt(0) == '#')
{ {
//Party Chat //Party Chat
Party party = _manager.getPartyManager().GetParty(sender); Party party = _manager.getPartyManager().getParty(sender);
if (party != null) if (party != null)
{ {
@ -134,14 +137,14 @@ public class GameChatManager implements Listener
name = C.cWhiteB + sender.getName() + C.Reset; name = C.cWhiteB + sender.getName() + C.Reset;
message = event.getFormat().split(sender.getName())[1].replace("%2$s", "") + _manager.GetChat().getFilteredMessage(sender, event.getMessage()); message = event.getFormat().split(sender.getName())[1].replace("%2$s", "") + _manager.GetChat().getFilteredMessage(sender, event.getMessage());
if(safeSend(sender, format, rankStr, rank, name, message, party.GetPlayersOnline())) if(safeSend(sender, format, rankStr, rank, name, message, party.getMembers().stream().map(Bukkit::getPlayerExact).collect(Collectors.toList())))
{ {
event.setCancelled(true); event.setCancelled(true);
} }
return; return;
} }
}*/ }
event.setFormat(levelStr + rankStr + senderName + " " + C.cWhite + "%2$s"); event.setFormat(levelStr + rankStr + senderName + " " + C.cWhite + "%2$s");