-sigh- a hotfix.

Won't invite players across servers who are already in parties.
Fix transferring ownership to non-party members
This commit is contained in:
TadahTech 2016-07-21 02:05:10 -05:00
parent e7da161f35
commit 76ac89266e
5 changed files with 41 additions and 10 deletions

View File

@ -71,7 +71,7 @@ public enum Lang
if(args.length == 0)
{
return _message;
return color + _message;
}
if(_message.startsWith("Error:"))

View File

@ -38,6 +38,11 @@ public class PartyCommand extends CommandBase<PartyManager>
{
if (args.length == 0)
{
if(_aliasUsed.equalsIgnoreCase("openinvitesmenu"))
{
new PartyInvitesMenu(Plugin).open(caller);
return;
}
Party party = Plugin.getParty(caller);
if (party == null)
{
@ -52,11 +57,7 @@ public class PartyCommand extends CommandBase<PartyManager>
new PartyViewMenu(party, Plugin).open(caller);
return;
}
if(_aliasUsed.equalsIgnoreCase("openinvitesmenu"))
{
new PartyInvitesMenu(Plugin).open(caller);
return;
}
if(args.length == 1)
{
String arg = args[0];

View File

@ -114,9 +114,19 @@ public class PartyRedisManager
return;
}
if(_plugin.getParty(player) != null)
{
publish(first, RedisMessageType.INVITE_PLAYER_ALREADY_IN_PARTY, _serverName, player.getName(), player.getUniqueId().toString(), third);
return;
}
publish(first, RedisMessageType.PLAYER_FIND_RESPONSE, _serverName, player.getName(), player.getUniqueId().toString(), third);
break;
case INVITE_PLAYER_ALREADY_IN_PARTY:
handleAlreadyIn(second, contents);
break;
case PLAYER_FIND_RESPONSE:
UUID uuid = UUID.fromString(third);
BukkitTask task = TASKS.remove(second);
@ -155,6 +165,19 @@ public class PartyRedisManager
}
private void handleAlreadyIn(String second, String[] contents)
{
BukkitTask task = TASKS.remove(second);
if (task != null)
{
task.cancel();
}
Player inviter = Bukkit.getPlayerExact(contents[3]);
Lang.ALREADY_IN.send(inviter, second);
}
/**
* Initiates inviting a player who is no on the same server
*

View File

@ -16,15 +16,17 @@ public enum RedisMessageType
INVITE_PLAYER_REQUEST(3, "{0},{1},{2}"),
//Message: PLAYER_SENDER,PLAYER_TARGET_NAME,PLAYER_TARGET_UUID,RESPONSE
INVITE_PLAYER_RESPONSE(4, "{0},{1},{2},{3}"),
//Message: PLAYER_SENDER,PLAYER_TARGET_NAME,PLAYER_TARGET_UUID,RESPONSE
INVITE_PLAYER_ALREADY_IN_PARTY(5, "{0},{1},{2},{3}"),
//Message: SERVER_FROM,PLAYER_INITIATING,PARTY_SIZE,_CAN_JOIN_FULL
PREJOIN_SERVER_REQUEST(5, "{0},{1},{2},{3}"),
PREJOIN_SERVER_REQUEST(6, "{0},{1},{2},{3}"),
//Message: PLAYER_INITIATING,REASON,SERVER
PREJOIN_SERVER_RESPONSE(6, "{0},{1},{2}"),
PREJOIN_SERVER_RESPONSE(7, "{0},{1},{2}"),
//Message: JSON Party
PARTY_INFO(7, "{0}"),
TEST_CONN(8, "{0}")
PARTY_INFO(8, "{0}"),
TEST_CONN(9, "{0}")
;
private int _id;

View File

@ -24,6 +24,11 @@ public class PartyTransferOwnerMenu extends PlayerNameMenu
@Override
public void onSuccess(String name)
{
if(!_party.contains(name))
{
Lang.NOT_MEMBER.send(_player, name);
return;
}
_partyManager.getMethodManager().transferOwner(name, _player.getName());
Lang.TRANSFER_OWNER.send(_party, _player.getName(), name);
_player.closeInventory();