mirror of
https://github.com/MassiveCraft/Factions.git
synced 2024-11-24 03:05:52 +01:00
Fix clients getting kicked from too many allies/enemies.
This commit is contained in:
parent
b970755cb1
commit
356842ab41
@ -11,6 +11,7 @@ import com.massivecraft.factions.struct.Role;
|
||||
import mkremins.fanciful.FancyMessage;
|
||||
import org.bukkit.ChatColor;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
|
||||
public class CmdShow extends FCommand {
|
||||
@ -87,8 +88,11 @@ public class CmdShow extends FCommand {
|
||||
}
|
||||
}
|
||||
|
||||
FancyMessage allies = new FancyMessage("Allies: ").color(ChatColor.GOLD);
|
||||
FancyMessage enemies = new FancyMessage("Enemies: ").color(ChatColor.GOLD);
|
||||
ArrayList<FancyMessage> allies = new ArrayList<FancyMessage>();
|
||||
ArrayList<FancyMessage> enemies = new ArrayList<FancyMessage>();
|
||||
FancyMessage currentAllies = new FancyMessage("Allies: ").color(ChatColor.GOLD);
|
||||
FancyMessage currentEnemies = new FancyMessage("Enemies: ").color(ChatColor.GOLD);
|
||||
|
||||
boolean firstAlly = true;
|
||||
boolean firstEnemy = true;
|
||||
for (Faction otherFaction : Factions.getInstance().getAllFactions()) {
|
||||
@ -100,19 +104,30 @@ public class CmdShow extends FCommand {
|
||||
String s = otherFaction.getTag(fme);
|
||||
if (rel.isAlly()) {
|
||||
if (firstAlly)
|
||||
allies.then(s).tooltip(getToolTips(otherFaction));
|
||||
currentAllies.then(s).tooltip(getToolTips(otherFaction));
|
||||
else
|
||||
alies.then(", " + s).tooltip(getToolTips(otherFaction));
|
||||
currentAllies.then(", " + s).tooltip(getToolTips(otherFaction));
|
||||
firstAlly = false;
|
||||
|
||||
if (currentAllies.toJSONString().length() >= 32700) { // Client gets kicked at 32767, some leniency
|
||||
allies.add(currentAllies);
|
||||
currentAllies = new FancyMessage();
|
||||
}
|
||||
} else if (rel.isEnemy()) {
|
||||
if (firstEnemy)
|
||||
enemies.then(s).tooltip(getToolTips(otherFaction));
|
||||
currentEnemies.then(s).tooltip(getToolTips(otherFaction));
|
||||
else
|
||||
enemies.then(", " + s).tooltip(getToolTips(otherFaction));
|
||||
currentEnemies.then(", " + s).tooltip(getToolTips(otherFaction));
|
||||
firstEnemy = false;
|
||||
}
|
||||
}
|
||||
|
||||
if (currentEnemies.toJSONString().length() >= 32700) { // Client gets kicked at 32767, some leniency
|
||||
enemies.add(currentEnemies);
|
||||
currentEnemies = new FancyMessage();
|
||||
}
|
||||
}
|
||||
}
|
||||
allies.add(currentAllies);
|
||||
enemies.add(currentEnemies);
|
||||
|
||||
FancyMessage online = new FancyMessage("Members online: ").color(ChatColor.GOLD);
|
||||
FancyMessage offline = new FancyMessage("Members offline: ").color(ChatColor.GOLD);
|
||||
|
Loading…
Reference in New Issue
Block a user