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:
parent
35f2d42d08
commit
48967b4a74
@ -11,7 +11,6 @@ import java.util.UUID;
|
|||||||
|
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
import org.bukkit.Sound;
|
import org.bukkit.Sound;
|
||||||
import org.bukkit.block.Block;
|
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
import mineplex.core.common.util.C;
|
import mineplex.core.common.util.C;
|
||||||
@ -209,10 +208,17 @@ public class ClanInfo
|
|||||||
|
|
||||||
public int getAlliesMax()
|
public int getAlliesMax()
|
||||||
{
|
{
|
||||||
if (ssAdmin())
|
return getAlliesMaxWithMemberCountOf(_memberMap.size());
|
||||||
return 1000;
|
}
|
||||||
|
|
||||||
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()
|
public BedStatus getBedStatus()
|
||||||
|
@ -1222,6 +1222,12 @@ public class ClansUtility
|
|||||||
return;
|
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
|
// Inform
|
||||||
clan.inform(F.name(caller.getName()) + " invited " + F.name(target.getName()) + " to join your Clan.", caller.getName());
|
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."));
|
UtilPlayer.message(caller, F.main("Clans", "You invited " + F.name(target.getName()) + " to join your Clan."));
|
||||||
|
@ -550,6 +550,12 @@ public class ClansCommand extends CommandBase<ClansManager>
|
|||||||
return;
|
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);
|
ClanJoinEvent event = new ClanJoinEvent(clan, caller);
|
||||||
Bukkit.getPluginManager().callEvent(event);
|
Bukkit.getPluginManager().callEvent(event);
|
||||||
if (event.isCancelled()) return;
|
if (event.isCancelled()) return;
|
||||||
|
Loading…
Reference in New Issue
Block a user