mirror of
https://github.com/TotalFreedomMC/TF-EssentialsX.git
synced 2025-05-07 00:00:45 +00:00
[Fix] Stacked mobs count towards spawnmob-limit count.
This commit is contained in:
parent
7913cfdb3c
commit
9d2358ed4d
1 changed files with 21 additions and 10 deletions
|
@ -112,10 +112,21 @@ public class SpawnMob
|
|||
checkSpawnable(ess, sender, mob);
|
||||
}
|
||||
|
||||
int serverLimit = ess.getSettings().getSpawnMobLimit();
|
||||
if (mobCount > serverLimit)
|
||||
final int serverLimit = ess.getSettings().getSpawnMobLimit();
|
||||
int effectiveLimit = serverLimit / parts.size();
|
||||
|
||||
if (effectiveLimit < 1)
|
||||
{
|
||||
mobCount = serverLimit;
|
||||
effectiveLimit = 1;
|
||||
while (parts.size() > serverLimit)
|
||||
{
|
||||
parts.remove(serverLimit);
|
||||
}
|
||||
}
|
||||
|
||||
if (mobCount > effectiveLimit)
|
||||
{
|
||||
mobCount = effectiveLimit;
|
||||
sender.sendMessage(_("mobSpawnLimit"));
|
||||
}
|
||||
|
||||
|
@ -126,7 +137,7 @@ public class SpawnMob
|
|||
{
|
||||
spawnMob(ess, server, sender, target, sloc, parts, data);
|
||||
}
|
||||
sender.sendMessage(mobCount + " " + mob.name.toLowerCase(Locale.ENGLISH) + mob.suffix + " " + _("spawned"));
|
||||
sender.sendMessage(mobCount * parts.size() + " " + mob.name.toLowerCase(Locale.ENGLISH) + mob.suffix + " " + _("spawned"));
|
||||
}
|
||||
catch (MobException e1)
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue