Fixes possible bug with party leaders not seeing chat.

Adds pling when you received an invite.
This commit is contained in:
TadahTech 2016-07-28 03:40:24 -05:00
parent b718a72366
commit ab9bf2f405
5 changed files with 34 additions and 37 deletions

View File

@ -17,6 +17,7 @@ import net.md_5.bungee.api.chat.ClickEvent.Action;
import net.md_5.bungee.api.chat.HoverEvent;
import net.md_5.bungee.api.chat.TextComponent;
import org.bukkit.Bukkit;
import org.bukkit.Sound;
import org.bukkit.entity.Player;
import org.bukkit.scheduler.BukkitRunnable;
import org.bukkit.scheduler.BukkitTask;
@ -124,6 +125,7 @@ public class PartyInviteManager
inviteTo(player.getUniqueId(), sender, sender, serverFrom);
Lang.INVITE_RECEIVED.send(player, sender);
sendAcceptOrDeny(player, sender);
player.playSound(player.getLocation(), Sound.NOTE_PLING, 1.0F, 1.0F);
}
/**

View File

@ -139,12 +139,7 @@ public class PartyRedisManager
case PLAYER_FIND_RESPONSE:
UUID uuid = UUID.fromString(third);
BukkitTask task = TASKS.remove(second);
if (task != null)
{
task.cancel();
}
cancelTask(second);
Player inviter = Bukkit.getPlayerExact(contents[3]);
if (_plugin.getInviteManager().isInvitedTo(uuid, inviter.getName()))
@ -177,12 +172,7 @@ public class PartyRedisManager
private void handleNotAccepting(String second, String[] contents)
{
BukkitTask task = TASKS.remove(second);
if (task != null)
{
task.cancel();
}
cancelTask(second);
Player inviter = Bukkit.getPlayerExact(contents[3]);
inviter.sendMessage(F.main("Party", F.name(second) + " is not accepting invites at this time."));
@ -190,13 +180,7 @@ public class PartyRedisManager
private void handleAlreadyIn(String second, String[] contents)
{
BukkitTask task = TASKS.remove(second);
if (task != null)
{
task.cancel();
}
cancelTask(second);
Player inviter = Bukkit.getPlayerExact(contents[3]);
Lang.ALREADY_IN.send(inviter, second);
}
@ -215,6 +199,11 @@ public class PartyRedisManager
@Override
public void run()
{
if(!TASKS.containsKey(player))
{
cancel();
return;
}
TASKS.remove(player);
Player senderPlayer = Bukkit.getPlayerExact(sender);
if (senderPlayer == null)
@ -293,4 +282,14 @@ public class PartyRedisManager
{
return FIND_PLAYERS_CHANNEL;
}
public void cancelTask(String player)
{
BukkitTask task = TASKS.remove(player);
if (task != null)
{
task.cancel();
}
}
}

View File

@ -9,6 +9,7 @@ import mineplex.core.common.util.Callback;
import mineplex.core.common.util.F;
import mineplex.core.common.util.UtilPlayer;
import mineplex.core.common.util.UtilTabTitle;
import mineplex.core.party.Lang;
import mineplex.core.party.Party;
import mineplex.core.party.event.PartySendToServerEvent;
import mineplex.core.portal.Commands.SendCommand;
@ -101,6 +102,11 @@ public class Portal extends MiniPlugin
if (event.getParty() != null && override)
{
Party party = event.getParty();
if(!party.getOwner().equalsIgnoreCase(player.getName()))
{
Lang.NOT_OWNER_SERVER.send(player);
return;
}
sendParty(party);
return;
}

View File

@ -102,6 +102,7 @@ import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Random;
import java.util.stream.Collectors;
public class HubManager extends MiniClientPlugin<HubClient>
{
@ -601,14 +602,7 @@ public class HubManager extends MiniClientPlugin<HubClient>
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);
}
event.getRecipients().addAll(party.getMembersByUUID().stream().map(Bukkit::getPlayer).collect(Collectors.toList()));
}
else
{

View File

@ -11,6 +11,7 @@ import nautilus.game.arcade.ArcadeManager;
import nautilus.game.arcade.game.Game;
import nautilus.game.arcade.game.Game.GameState;
import nautilus.game.arcade.game.GameTeam;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
@ -25,6 +26,7 @@ import java.util.Collection;
import java.util.Iterator;
import java.util.LinkedList;
import java.util.Map;
import java.util.stream.Collectors;
public class GameChatManager implements Listener
{
@ -131,20 +133,14 @@ public class GameChatManager implements Listener
event.setMessage(event.getMessage().substring(1, event.getMessage().length()));
event.setFormat(levelStr + C.cDPurple + C.Bold + "Party " + C.cWhite + C.Bold + event.getPlayer().getName() + " " + C.cPurple + "%2$s");
for (String member : party.getMembers())
{
Player other = UtilPlayer.searchExact(member);
if (other != null)
event.getRecipients().add(other);
}
event.getRecipients().addAll(party.getMembersByUUID().stream().map(Bukkit::getPlayer).collect(Collectors.toList()));
}
else
{
UtilPlayer.message(sender, F.main("Party", "You are not in a Party."));
UtilPlayer.message(event.getPlayer(), F.main("Party", "You are not in a Party."));
event.setCancelled(true);
}
return;
}
@ -156,7 +152,7 @@ public class GameChatManager implements Listener
format = event.getFormat().split(rankStr)[0];
name = _manager.GetColor(sender) + sender.getName() + C.Reset;
if (event.getMessage().charAt(0) == '@')
if (event.getMessage().charAt(0) == '#')
message = event.getFormat().split(sender.getName())[1].replace("%2$s", "") + _manager.GetChat().getFilteredMessage(sender, event.getMessage().substring(1, event.getMessage().length()));
else
message = event.getFormat().split(sender.getName())[1].replace("%2$s", "") + _manager.GetChat().getFilteredMessage(sender, event.getMessage());