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 mkremins.fanciful.FancyMessage;
|
||||||
import org.bukkit.ChatColor;
|
import org.bukkit.ChatColor;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
|
|
||||||
public class CmdShow extends FCommand {
|
public class CmdShow extends FCommand {
|
||||||
@ -87,8 +88,11 @@ public class CmdShow extends FCommand {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
FancyMessage allies = new FancyMessage("Allies: ").color(ChatColor.GOLD);
|
ArrayList<FancyMessage> allies = new ArrayList<FancyMessage>();
|
||||||
FancyMessage enemies = new FancyMessage("Enemies: ").color(ChatColor.GOLD);
|
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 firstAlly = true;
|
||||||
boolean firstEnemy = true;
|
boolean firstEnemy = true;
|
||||||
for (Faction otherFaction : Factions.getInstance().getAllFactions()) {
|
for (Faction otherFaction : Factions.getInstance().getAllFactions()) {
|
||||||
@ -100,19 +104,30 @@ public class CmdShow extends FCommand {
|
|||||||
String s = otherFaction.getTag(fme);
|
String s = otherFaction.getTag(fme);
|
||||||
if (rel.isAlly()) {
|
if (rel.isAlly()) {
|
||||||
if (firstAlly)
|
if (firstAlly)
|
||||||
allies.then(s).tooltip(getToolTips(otherFaction));
|
currentAllies.then(s).tooltip(getToolTips(otherFaction));
|
||||||
else
|
else
|
||||||
alies.then(", " + s).tooltip(getToolTips(otherFaction));
|
currentAllies.then(", " + s).tooltip(getToolTips(otherFaction));
|
||||||
firstAlly = false;
|
firstAlly = false;
|
||||||
|
|
||||||
|
if (currentAllies.toJSONString().length() >= 32700) { // Client gets kicked at 32767, some leniency
|
||||||
|
allies.add(currentAllies);
|
||||||
|
currentAllies = new FancyMessage();
|
||||||
|
}
|
||||||
} else if (rel.isEnemy()) {
|
} else if (rel.isEnemy()) {
|
||||||
if (firstEnemy)
|
if (firstEnemy)
|
||||||
enemies.then(s).tooltip(getToolTips(otherFaction));
|
currentEnemies.then(s).tooltip(getToolTips(otherFaction));
|
||||||
else
|
else
|
||||||
enemies.then(", " + s).tooltip(getToolTips(otherFaction));
|
currentEnemies.then(", " + s).tooltip(getToolTips(otherFaction));
|
||||||
firstEnemy = false;
|
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 online = new FancyMessage("Members online: ").color(ChatColor.GOLD);
|
||||||
FancyMessage offline = new FancyMessage("Members offline: ").color(ChatColor.GOLD);
|
FancyMessage offline = new FancyMessage("Members offline: ").color(ChatColor.GOLD);
|
||||||
|
Loading…
Reference in New Issue
Block a user