Heavy UI and Command work. Begin testing
Time: 2hrs
This commit is contained in:
parent
c577e5827c
commit
474a9dc975
@ -111,7 +111,7 @@ public class PartyCommand extends CommandBase<PartyManager>
|
||||
if(possible != null)
|
||||
{
|
||||
UUID uuid = possible.getUniqueId();
|
||||
caller.sendMessage(F.main("Party", "Sent an invite to " + target + "..."));
|
||||
caller.sendMessage(F.main("Party", "Sent an invite to " + possible.getName() + "..."));
|
||||
Plugin.getInviteManager().inviteTo(uuid, caller.getName(), caller.getName());
|
||||
Plugin.getInviteManager().sendAcceptOrDeny(possible, caller.getName());
|
||||
return;
|
||||
|
@ -64,10 +64,40 @@ public class PartyInviteManager
|
||||
|
||||
public void respondToInvite(Player player, String party, boolean accept)
|
||||
{
|
||||
Player possible = Bukkit.getPlayer(party);
|
||||
|
||||
remove(party, player.getUniqueId());
|
||||
|
||||
_players.remove(player.getUniqueId());
|
||||
|
||||
if(possible != null)
|
||||
{
|
||||
Party newParty = _plugin.getParty(party);
|
||||
if(!accept)
|
||||
{
|
||||
String message = InviteResponse.DENIED.format(player.getName());
|
||||
if (newParty == null)
|
||||
{
|
||||
player.sendMessage(message);
|
||||
player.sendMessage(F.main("Party", "Party not created."));
|
||||
return;
|
||||
}
|
||||
newParty.sendMessage(message);
|
||||
return;
|
||||
}
|
||||
if (newParty == null)
|
||||
{
|
||||
newParty = new Party(possible.getName());
|
||||
_plugin.addParty(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);
|
||||
return;
|
||||
}
|
||||
|
||||
String serverFrom = INVITE_FROM_SERVERS.remove(player.getName());
|
||||
|
||||
_partyRedisManager.publish(serverFrom, RedisMessageType.INVITE_PLAYER_RESPONSE, party,
|
||||
@ -97,6 +127,7 @@ public class PartyInviteManager
|
||||
return;
|
||||
}
|
||||
String message = F.main("Party", response.format(target));
|
||||
|
||||
Party party = _plugin.getParty(sender);
|
||||
|
||||
switch (response)
|
||||
@ -266,6 +297,7 @@ public class PartyInviteManager
|
||||
|
||||
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 accept = new TextComponent("ACCEPT");
|
||||
|
@ -54,7 +54,7 @@ public class PartyRedisManager
|
||||
_plugin.runAsync(() -> {
|
||||
try (Jedis jedis = _writePool.getResource())
|
||||
{
|
||||
jedis.publish(CHANNEL_BASE + "-" + server, messageType.format(args));
|
||||
jedis.publish(CHANNEL_BASE + "-" + server, messageType.name() + ":" + messageType.format(args));
|
||||
}
|
||||
});
|
||||
}
|
||||
|
@ -19,6 +19,7 @@ public class PartyRedisListener extends JedisPubSub
|
||||
@Override
|
||||
public void onMessage(String channel, String message)
|
||||
{
|
||||
System.out.println(channel + " - " + message);
|
||||
RedisMessageType type = RedisMessageType.valueOf(message.split(":")[0].toUpperCase());
|
||||
_redisManager.handle(type, message.split(":")[1]);
|
||||
}
|
||||
|
@ -39,7 +39,7 @@ public class MenuListener implements Listener
|
||||
return;
|
||||
}
|
||||
|
||||
button.onClick(player);
|
||||
button.onClick(player, event.getClick());
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -15,9 +15,8 @@ import org.bukkit.inventory.ItemStack;
|
||||
public class LeavePartyButton extends Button
|
||||
{
|
||||
|
||||
private static final ItemStack ITEM = new ItemBuilder(Material.STAINED_GLASS_PANE)
|
||||
.setData((byte) 14)
|
||||
.setTitle(C.cYellow + "Invite a Player")
|
||||
private static final ItemStack ITEM = new ItemBuilder(Material.BARRIER)
|
||||
.setTitle(C.cYellow + "Leave Party")
|
||||
.build();
|
||||
|
||||
public LeavePartyButton(PartyManager plugin)
|
||||
|
@ -30,9 +30,9 @@ public class PartyViewMenu extends Menu
|
||||
buttons[4] = new LeavePartyButton(_plugin);
|
||||
|
||||
//Players
|
||||
for(int i = 18; i < _party.getMembers().size(); i++)
|
||||
for(int i = 0; i < _party.getMembers().size(); i++)
|
||||
{
|
||||
buttons[i] = new PartyMemberIcon(_party.getMembers().get(i), _plugin);
|
||||
buttons[i + 18] = new PartyMemberIcon(_party.getMembers().get(i), _plugin);
|
||||
}
|
||||
|
||||
return buttons;
|
||||
|
@ -577,11 +577,10 @@ public class HubManager extends MiniClientPlugin<HubClient>
|
||||
//Rank Prefix
|
||||
String rankStr = "";
|
||||
if (rank != Rank.ALL)
|
||||
rankStr = rank.getTag(true, true) + " ";
|
||||
//Party Chat
|
||||
|
||||
else
|
||||
{
|
||||
rankStr = rank.getTag(true, true) + " ";
|
||||
}
|
||||
|
||||
TextComponent rankComponent = new TextComponent(rankStr);
|
||||
TextComponent playerNameText = new TextComponent(ChatColor.YELLOW + playerName);
|
||||
TextComponent component = new TextComponent();
|
||||
@ -592,11 +591,6 @@ public class HubManager extends MiniClientPlugin<HubClient>
|
||||
component.addExtra(rankComponent);
|
||||
component.addExtra(playerNameText);
|
||||
component.addExtra(" " + ChatColor.WHITE + event.getMessage());
|
||||
|
||||
// JsonMessage jsonMessage = new JsonMessage(levelStr)
|
||||
// .extra(JSONObject.escape(rankStr)).hover("show_text", rank.getColor() + rank.getTag(true, true) + ChatColor.WHITE + "\n" + rank.getDescription())
|
||||
// .add(JSONObject.escape(C.cYellow + playerName + " " + ChatColor.WHITE + event.getMessage()));
|
||||
|
||||
for (Player other : UtilServer.getPlayers())
|
||||
{
|
||||
if (_tutorialManager.InTutorial(other))
|
||||
@ -605,13 +599,10 @@ public class HubManager extends MiniClientPlugin<HubClient>
|
||||
continue;
|
||||
}
|
||||
|
||||
// event.setMessage(event.getMessage());
|
||||
// event.setFormat(levelStr + rankStr + C.cYellow + playerName + " " + C.cWhite + "%2$s");
|
||||
if(!event.isCancelled())
|
||||
other.spigot().sendMessage(component);
|
||||
}
|
||||
event.setCancelled(true);
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
|
Loading…
Reference in New Issue
Block a user