Fix possible cross server invite spamming.

This commit is contained in:
TadahTech 2016-07-21 02:20:02 -05:00
parent f1b3c4756d
commit 9f0f4e0018
2 changed files with 25 additions and 0 deletions

View File

@ -120,6 +120,12 @@ public class PartyRedisManager
return;
}
if(!_plugin.getPreferencesManager().Get(player).PartyRequests)
{
publish(first, RedisMessageType.INVITE_PLAYER_NOT_ACCEPTING_INVITES, _serverName, player.getName(), player.getUniqueId().toString(), third);
return;
}
publish(first, RedisMessageType.PLAYER_FIND_RESPONSE, _serverName, player.getName(), player.getUniqueId().toString(), third);
break;
@ -127,6 +133,10 @@ public class PartyRedisManager
handleAlreadyIn(second, contents);
break;
case INVITE_PLAYER_NOT_ACCEPTING_INVITES:
handleNotAccepting(second, contents);
break;
case PLAYER_FIND_RESPONSE:
UUID uuid = UUID.fromString(third);
BukkitTask task = TASKS.remove(second);
@ -165,6 +175,19 @@ public class PartyRedisManager
}
private void handleNotAccepting(String second, String[] contents)
{
BukkitTask task = TASKS.remove(second);
if (task != null)
{
task.cancel();
}
Player inviter = Bukkit.getPlayerExact(contents[3]);
inviter.sendMessage(F.main("Party", F.name(second) + " is not accepting invites at this time."));
}
private void handleAlreadyIn(String second, String[] contents)
{
BukkitTask task = TASKS.remove(second);

View File

@ -18,6 +18,8 @@ public enum RedisMessageType
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: PLAYER_SENDER,PLAYER_TARGET_NAME,PLAYER_TARGET_UUID,RESPONSE
INVITE_PLAYER_NOT_ACCEPTING_INVITES(5, "{0},{1},{2},{3}"),
//Message: SERVER_FROM,PLAYER_INITIATING,PARTY_SIZE,_CAN_JOIN_FULL
PREJOIN_SERVER_REQUEST(6, "{0},{1},{2},{3}"),