Update JoinResponseReason
This commit is contained in:
parent
96261c1a6d
commit
0fc64c45a8
@ -8,16 +8,14 @@ import mineplex.core.common.util.F;
|
||||
public enum JoinResponseReason
|
||||
{
|
||||
|
||||
CANNOT_JOIN_FULL(F.main("Party", "Your party cannot join full servers!"), "no"),
|
||||
SUCCESS("", "yes");
|
||||
CANNOT_JOIN_FULL(F.main("Party", "Your party cannot join full servers!")),
|
||||
SUCCESS("");
|
||||
|
||||
private String _message;
|
||||
private String _code;
|
||||
|
||||
JoinResponseReason(String message, String code)
|
||||
JoinResponseReason(String message)
|
||||
{
|
||||
_message = message;
|
||||
_code = code;
|
||||
}
|
||||
|
||||
public String getMessage()
|
||||
@ -25,8 +23,4 @@ public enum JoinResponseReason
|
||||
return _message;
|
||||
}
|
||||
|
||||
public String getCode()
|
||||
{
|
||||
return _code;
|
||||
}
|
||||
}
|
||||
|
@ -71,12 +71,12 @@ public class PartyJoinManager
|
||||
//Max number of people on.
|
||||
if (!canJoinFull)
|
||||
{
|
||||
_plugin.getRedisManager().publish(serverFrom, RedisMessageType.PREJOIN_SERVER_RESPONSE, initiator, JoinResponseReason.CANNOT_JOIN_FULL.name(), JoinResponseReason.CANNOT_JOIN_FULL.getCode(), _plugin.getServerName());
|
||||
_plugin.getRedisManager().publish(serverFrom, RedisMessageType.PREJOIN_SERVER_RESPONSE, initiator, JoinResponseReason.CANNOT_JOIN_FULL.name(), _plugin.getServerName());
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
_plugin.getRedisManager().publish(serverFrom, RedisMessageType.PREJOIN_SERVER_RESPONSE, initiator, JoinResponseReason.SUCCESS.name(), JoinResponseReason.SUCCESS.getCode(), _plugin.getServerName());
|
||||
_plugin.getRedisManager().publish(serverFrom, RedisMessageType.PREJOIN_SERVER_RESPONSE, initiator, JoinResponseReason.SUCCESS.name(), _plugin.getServerName());
|
||||
|
||||
}
|
||||
|
||||
@ -84,11 +84,10 @@ public class PartyJoinManager
|
||||
* Manages a received response
|
||||
*
|
||||
* @param playerSender The player who sent the request
|
||||
* @param response The String response
|
||||
* @param server The server responding
|
||||
* @param reason The reason for the response
|
||||
*/
|
||||
public void handleJoinResponse(String playerSender, String response, String server, JoinResponseReason reason)
|
||||
public void handleJoinResponse(String playerSender, String server, JoinResponseReason reason)
|
||||
{
|
||||
Player player = Bukkit.getPlayer(playerSender);
|
||||
if (player == null)
|
||||
@ -100,7 +99,7 @@ public class PartyJoinManager
|
||||
{
|
||||
return;
|
||||
}
|
||||
if (response.equalsIgnoreCase(JoinResponseReason.CANNOT_JOIN_FULL.getCode()))
|
||||
if (reason != JoinResponseReason.SUCCESS)
|
||||
{
|
||||
party.sendMessage(reason.getMessage());
|
||||
return;
|
||||
|
@ -148,7 +148,7 @@ public class PartyRedisManager
|
||||
break;
|
||||
|
||||
case PREJOIN_SERVER_RESPONSE:
|
||||
_plugin.getJoinManager().handleJoinResponse(first, third, contents[3], JoinResponseReason.valueOf(second.toUpperCase()));
|
||||
_plugin.getJoinManager().handleJoinResponse(first, third, JoinResponseReason.valueOf(second.toUpperCase()));
|
||||
break;
|
||||
}
|
||||
});
|
||||
|
@ -19,8 +19,8 @@ public enum RedisMessageType
|
||||
|
||||
//Message: SERVER_FROM,PLAYER_INITIATING,PARTY_SIZE,_CAN_JOIN_FULL
|
||||
PREJOIN_SERVER_REQUEST(5, "{0},{1},{2},{3}"),
|
||||
//Message: PLAYER_INITIATING,RESPONSE,REASON,SERVER
|
||||
PREJOIN_SERVER_RESPONSE(6, "{0},{1},{2},{3}"),
|
||||
//Message: PLAYER_INITIATING,REASON,SERVER
|
||||
PREJOIN_SERVER_RESPONSE(6, "{0},{1},{2}"),
|
||||
|
||||
//Message: JSON Party
|
||||
PARTY_INFO(7, "{0}"),
|
||||
|
Loading…
Reference in New Issue
Block a user