Open server menu properly

This commit is contained in:
TadahTech 2016-06-22 00:56:44 -05:00
parent d9c5e6323a
commit 38a13d01f1
4 changed files with 27 additions and 19 deletions

View File

@ -1,6 +1,7 @@
package mineplex.core.party.event; package mineplex.core.party.event;
import mineplex.core.party.Party; import mineplex.core.party.Party;
import org.bukkit.entity.Player;
import org.bukkit.event.Event; import org.bukkit.event.Event;
import org.bukkit.event.HandlerList; import org.bukkit.event.HandlerList;
@ -11,16 +12,16 @@ public class PartySelectServerEvent extends Event
{ {
private static final HandlerList HANDLER_LIST = new HandlerList(); private static final HandlerList HANDLER_LIST = new HandlerList();
private final Party _party; private final Player _player;
public PartySelectServerEvent(Party party) public PartySelectServerEvent(Player player)
{ {
_party = party; _player = player;
} }
public Party getParty() public Player getPLayer()
{ {
return _party; return _player;
} }
@Override @Override

View File

@ -32,6 +32,6 @@ public class SelectServerButton extends PartyButton
@Override @Override
public void onClick(Player player, ClickType clickType) public void onClick(Player player, ClickType clickType)
{ {
UtilServer.getPluginManager().callEvent(new PartySelectServerEvent(getParty())); UtilServer.getPluginManager().callEvent(new PartySelectServerEvent(player));
} }
} }

View File

@ -604,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
@ -612,12 +612,12 @@ 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 /* //Party Chat
if (event.getMessage().charAt(0) == '#') if (event.getMessage().charAt(0) == '#')
{ {
Party party = _partyManager.getParty(player); Party party = _partyManager.GetParty(player);
if (party != null) if (party != null)
{ {
event.getRecipients().clear(); event.getRecipients().clear();
@ -625,23 +625,24 @@ public class HubManager extends MiniClientPlugin<HubClient>
event.setMessage(event.getMessage().substring(1, event.getMessage().length())); 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"); event.setFormat(levelStr + C.cDPurple + C.Bold + "Party " + C.cWhite + C.Bold + playerName + " " + C.cPurple + "%2$s");
for (String name : party.getMembers()) for (String name : party.GetPlayers())
{ {
Player other = UtilPlayer.searchExact(name); Player other = UtilPlayer.searchExact(name);
if (other != null) if (other != null)
{
event.getRecipients().add(other); event.getRecipients().add(other);
}
} }
} else }
else
{ {
UtilPlayer.message(player, F.main("Party", "You are not in a Party.")); UtilPlayer.message(player, F.main("Party", "You are not in a Party."));
event.setCancelled(true); event.setCancelled(true);
} }
} else return;
{ }
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();
@ -661,12 +662,11 @@ 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

View File

@ -13,6 +13,7 @@ import java.util.Set;
import mineplex.core.boosters.BoosterManager; import mineplex.core.boosters.BoosterManager;
import mineplex.core.brawl.fountain.BrawlShopProvider; import mineplex.core.brawl.fountain.BrawlShopProvider;
import mineplex.core.party.event.PartySelectServerEvent;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
import org.bukkit.ChatColor; import org.bukkit.ChatColor;
import org.bukkit.Material; import org.bukkit.Material;
@ -352,7 +353,13 @@ public class ServerManager extends MiniDbClientPlugin<SimpleClanToken> implement
{ {
return _serverInfoMap.get(serverName); return _serverInfoMap.get(serverName);
} }
@EventHandler
public void onClickCompassPartyIcon(PartySelectServerEvent event)
{
_quickShop.attemptShopOpen(event.getPlayer());
}
@EventHandler @EventHandler
public void updatePages(UpdateEvent event) public void updatePages(UpdateEvent event)
{ {