Block exploit allowing clans to make a lot of allies and then add members to disrupt the equation. Additionally, lower the maximum amount of allies per member

This commit is contained in:
AlexTheCoder 2017-03-10 14:59:03 -05:00
parent 35f2d42d08
commit 48967b4a74
3 changed files with 21 additions and 3 deletions

View File

@ -11,7 +11,6 @@ import java.util.UUID;
import org.bukkit.Location;
import org.bukkit.Sound;
import org.bukkit.block.Block;
import org.bukkit.entity.Player;
import mineplex.core.common.util.C;
@ -208,11 +207,18 @@ public class ClanInfo
}
public int getAlliesMax()
{
return getAlliesMaxWithMemberCountOf(_memberMap.size());
}
public int getAlliesMaxWithMemberCountOf(int memberCount)
{
if (ssAdmin())
{
return 1000;
return Math.max(2, 9 - _memberMap.size());
}
return Math.max(2, 6 - memberCount);
}
public BedStatus getBedStatus()

View File

@ -1221,6 +1221,12 @@ public class ClansUtility
UtilPlayer.message(caller, F.main("Clans", "You cannot invite yourself."));
return;
}
if (clan.getAllies() > clan.getAlliesMaxWithMemberCountOf(clan.getSize() + 1))
{
UtilPlayer.message(caller, F.main("Clans", "You cannot invite more members until you remove some allies."));
return;
}
// Inform
clan.inform(F.name(caller.getName()) + " invited " + F.name(target.getName()) + " to join your Clan.", caller.getName());

View File

@ -549,6 +549,12 @@ public class ClansCommand extends CommandBase<ClansManager>
UtilPlayer.message(caller, F.main("Clans", "The clan " + F.elem("Clan " + clan.getName()) + " is full and cannot be joined!"));
return;
}
if (clan.getAllies() > clan.getAlliesMaxWithMemberCountOf(clan.getSize() + 1))
{
UtilPlayer.message(caller, F.main("Clans", "You cannot join " + F.elem("Clan " + clan.getName()) + " until they remove some allies!"));
return;
}
ClanJoinEvent event = new ClanJoinEvent(clan, caller);
Bukkit.getPluginManager().callEvent(event);