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;
@ -209,10 +208,17 @@ public class ClanInfo
public int getAlliesMax()
{
if (ssAdmin())
return 1000;
return getAlliesMaxWithMemberCountOf(_memberMap.size());
}
return Math.max(2, 9 - _memberMap.size());
public int getAlliesMaxWithMemberCountOf(int memberCount)
{
if (ssAdmin())
{
return 1000;
}
return Math.max(2, 6 - memberCount);
}
public BedStatus getBedStatus()

View File

@ -1222,6 +1222,12 @@ public class ClansUtility
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());
UtilPlayer.message(caller, F.main("Clans", "You invited " + F.name(target.getName()) + " to join your Clan."));

View File

@ -550,6 +550,12 @@ public class ClansCommand extends CommandBase<ClansManager>
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);
if (event.isCancelled()) return;