Fix bugs arising during clans release
This commit is contained in:
parent
f3944527f8
commit
47d79bbad5
@ -96,36 +96,39 @@ public class PlayerScoreboard
|
|||||||
|
|
||||||
for (int i=0 ; i<lines.size() ; i++)
|
for (int i=0 ; i<lines.size() ; i++)
|
||||||
{
|
{
|
||||||
//Get New Line
|
if ((15-i) >= 0)
|
||||||
String newLine = lines.get(i);
|
|
||||||
|
|
||||||
//Check if Unchanged
|
|
||||||
if (_currentLines.size() > i)
|
|
||||||
{
|
{
|
||||||
String oldLine = _currentLines.get(i);
|
//Get New Line
|
||||||
|
String newLine = lines.get(i);
|
||||||
|
|
||||||
if (oldLine.equals(newLine))
|
//Check if Unchanged
|
||||||
|
if (_currentLines.size() > i)
|
||||||
|
{
|
||||||
|
String oldLine = _currentLines.get(i);
|
||||||
|
|
||||||
|
if (oldLine.equals(newLine))
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Ignore extra lines
|
||||||
|
if (i >= _teamNames.length)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
//Update
|
||||||
|
Team team = _scoreboard.getTeam(_teamNames[i]);
|
||||||
|
if (team == null)
|
||||||
|
{
|
||||||
|
System.out.println("Scoreboard Error: Line Team Not Found!");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
//Set Line Prefix/Suffix
|
||||||
|
team.setPrefix(newLine.substring(0, Math.min(newLine.length(), 16)));
|
||||||
|
team.setSuffix(ChatColor.getLastColors(team.getPrefix()) + newLine.substring(team.getPrefix().length(), Math.min(newLine.length(), 32)));
|
||||||
|
|
||||||
|
//Line
|
||||||
|
_sideObjective.getScore(_teamNames[i]).setScore(15-i);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Ignore extra lines
|
|
||||||
if (i >= _teamNames.length)
|
|
||||||
continue;
|
|
||||||
|
|
||||||
//Update
|
|
||||||
Team team = _scoreboard.getTeam(_teamNames[i]);
|
|
||||||
if (team == null)
|
|
||||||
{
|
|
||||||
System.out.println("Scoreboard Error: Line Team Not Found!");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
//Set Line Prefix/Suffix
|
|
||||||
team.setPrefix(newLine.substring(0, Math.min(newLine.length(), 16)));
|
|
||||||
team.setSuffix(ChatColor.getLastColors(team.getPrefix()) + newLine.substring(team.getPrefix().length(), Math.min(newLine.length(), 32)));
|
|
||||||
|
|
||||||
//Line
|
|
||||||
_sideObjective.getScore(_teamNames[i]).setScore(15-i);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//Hide Old Unused
|
//Hide Old Unused
|
||||||
|
@ -1,9 +1,13 @@
|
|||||||
package mineplex.game.clans.clans.nether;
|
package mineplex.game.clans.clans.nether;
|
||||||
|
|
||||||
|
import java.util.LinkedList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import mineplex.core.common.util.F;
|
import mineplex.core.common.util.F;
|
||||||
import mineplex.core.common.util.UtilPlayer;
|
import mineplex.core.common.util.UtilPlayer;
|
||||||
|
import mineplex.core.common.util.UtilTime;
|
||||||
|
import mineplex.core.common.util.UtilWorld;
|
||||||
|
import mineplex.core.common.util.UtilTime.TimeUnit;
|
||||||
import mineplex.core.updater.UpdateType;
|
import mineplex.core.updater.UpdateType;
|
||||||
import mineplex.core.updater.event.UpdateEvent;
|
import mineplex.core.updater.event.UpdateEvent;
|
||||||
import mineplex.game.clans.clans.ClanTips.TipType;
|
import mineplex.game.clans.clans.ClanTips.TipType;
|
||||||
@ -40,6 +44,7 @@ public class BossNetherPortal implements Listener
|
|||||||
private Location[] _corners;
|
private Location[] _corners;
|
||||||
private boolean _returnPortal;
|
private boolean _returnPortal;
|
||||||
private byte _portalFacing;
|
private byte _portalFacing;
|
||||||
|
private LinkedList<Long> _closeWarnings = new LinkedList<>();
|
||||||
|
|
||||||
public boolean Open = false;
|
public boolean Open = false;
|
||||||
public long Expire = -1;
|
public long Expire = -1;
|
||||||
@ -97,6 +102,16 @@ public class BossNetherPortal implements Listener
|
|||||||
{
|
{
|
||||||
_portalFacing = (byte)0;
|
_portalFacing = (byte)0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
_closeWarnings.add(UtilTime.convert(5, TimeUnit.MINUTES, TimeUnit.MILLISECONDS));
|
||||||
|
_closeWarnings.add(UtilTime.convert(1, TimeUnit.MINUTES, TimeUnit.MILLISECONDS));
|
||||||
|
_closeWarnings.add(30000L);
|
||||||
|
_closeWarnings.add(10000L);
|
||||||
|
_closeWarnings.add(5000L);
|
||||||
|
_closeWarnings.add(4000L);
|
||||||
|
_closeWarnings.add(3000L);
|
||||||
|
_closeWarnings.add(2000L);
|
||||||
|
_closeWarnings.add(1000L);
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean isInPortal(Block block)
|
private boolean isInPortal(Block block)
|
||||||
@ -261,6 +276,23 @@ public class BossNetherPortal implements Listener
|
|||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
if (Open && Expire != -1)
|
||||||
|
{
|
||||||
|
Long warning = -1L;
|
||||||
|
for (Long test : _closeWarnings)
|
||||||
|
{
|
||||||
|
if ((Expire - System.currentTimeMillis()) < warning)
|
||||||
|
{
|
||||||
|
warning = test;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (warning != -1)
|
||||||
|
{
|
||||||
|
_closeWarnings.remove(warning);
|
||||||
|
Bukkit.broadcastMessage(F.main(ClansManager.getInstance().getNetherManager().getName(), "The " + F.clansNether("Nether Portal") + " at " + F.elem(UtilWorld.locToStrClean(getLocation())) + " will close in " + F.elem(UtilTime.MakeStr(warning)) + "!"));
|
||||||
|
}
|
||||||
|
}
|
||||||
if (Open && Expire != -1 && System.currentTimeMillis() >= Expire)
|
if (Open && Expire != -1 && System.currentTimeMillis() >= Expire)
|
||||||
{
|
{
|
||||||
close();
|
close();
|
||||||
|
@ -260,7 +260,7 @@ public class NetherManager extends MiniPlugin
|
|||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
BossNetherPortal portal = new BossNetherPortal(bossSpawn.clone().add(-2, 5, 0), bossSpawn.clone().add(0, 0, 2), false);
|
BossNetherPortal portal = new BossNetherPortal(bossSpawn.clone().add(-2, 5, 0), bossSpawn.clone().add(2, 0, 0), false);
|
||||||
portal.open(PORTAL_OPEN_DURATION);
|
portal.open(PORTAL_OPEN_DURATION);
|
||||||
for (NetherPortal returnPortal : _returnPortals)
|
for (NetherPortal returnPortal : _returnPortals)
|
||||||
{
|
{
|
||||||
|
@ -1,9 +1,13 @@
|
|||||||
package mineplex.game.clans.clans.nether;
|
package mineplex.game.clans.clans.nether;
|
||||||
|
|
||||||
|
import java.util.LinkedList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import mineplex.core.common.util.F;
|
import mineplex.core.common.util.F;
|
||||||
import mineplex.core.common.util.UtilPlayer;
|
import mineplex.core.common.util.UtilPlayer;
|
||||||
|
import mineplex.core.common.util.UtilTime;
|
||||||
|
import mineplex.core.common.util.UtilWorld;
|
||||||
|
import mineplex.core.common.util.UtilTime.TimeUnit;
|
||||||
import mineplex.core.updater.UpdateType;
|
import mineplex.core.updater.UpdateType;
|
||||||
import mineplex.core.updater.event.UpdateEvent;
|
import mineplex.core.updater.event.UpdateEvent;
|
||||||
import mineplex.game.clans.clans.ClanTips.TipType;
|
import mineplex.game.clans.clans.ClanTips.TipType;
|
||||||
@ -41,6 +45,7 @@ public class NetherPortal implements Listener
|
|||||||
private Location[] _corners;
|
private Location[] _corners;
|
||||||
private boolean _returnPortal;
|
private boolean _returnPortal;
|
||||||
private byte _portalFacing;
|
private byte _portalFacing;
|
||||||
|
private LinkedList<Long> _closeWarnings = new LinkedList<>();
|
||||||
|
|
||||||
public boolean Open = false;
|
public boolean Open = false;
|
||||||
public long Expire = -1;
|
public long Expire = -1;
|
||||||
@ -99,6 +104,16 @@ public class NetherPortal implements Listener
|
|||||||
{
|
{
|
||||||
_portalFacing = (byte)0;
|
_portalFacing = (byte)0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
_closeWarnings.add(UtilTime.convert(5, TimeUnit.MINUTES, TimeUnit.MILLISECONDS));
|
||||||
|
_closeWarnings.add(UtilTime.convert(1, TimeUnit.MINUTES, TimeUnit.MILLISECONDS));
|
||||||
|
_closeWarnings.add(30000L);
|
||||||
|
_closeWarnings.add(10000L);
|
||||||
|
_closeWarnings.add(5000L);
|
||||||
|
_closeWarnings.add(4000L);
|
||||||
|
_closeWarnings.add(3000L);
|
||||||
|
_closeWarnings.add(2000L);
|
||||||
|
_closeWarnings.add(1000L);
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean isInPortal(Block block)
|
private boolean isInPortal(Block block)
|
||||||
@ -272,6 +287,23 @@ public class NetherPortal implements Listener
|
|||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
if (Open && Expire != -1)
|
||||||
|
{
|
||||||
|
Long warning = -1L;
|
||||||
|
for (Long test : _closeWarnings)
|
||||||
|
{
|
||||||
|
if ((Expire - System.currentTimeMillis()) < warning)
|
||||||
|
{
|
||||||
|
warning = test;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (warning != -1)
|
||||||
|
{
|
||||||
|
_closeWarnings.remove(warning);
|
||||||
|
Bukkit.broadcastMessage(F.main(ClansManager.getInstance().getNetherManager().getName(), "The " + F.clansNether("Nether Portal") + " at " + F.elem(UtilWorld.locToStrClean(getLocation())) + " will close in " + F.elem(UtilTime.MakeStr(warning)) + "!"));
|
||||||
|
}
|
||||||
|
}
|
||||||
if (Open && Expire != -1 && System.currentTimeMillis() >= Expire)
|
if (Open && Expire != -1 && System.currentTimeMillis() >= Expire)
|
||||||
{
|
{
|
||||||
close();
|
close();
|
||||||
|
@ -282,7 +282,7 @@ public abstract class EventCreature<T extends LivingEntity> implements Listener
|
|||||||
spawnEntity();
|
spawnEntity();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (UtilMath.offset2d(_entity.getLocation(), _spawnLocation) > 34)
|
if (UtilMath.offset2d(_entity.getLocation(), _spawnLocation) > 30)
|
||||||
{
|
{
|
||||||
if (_teleportHome != -1 && System.currentTimeMillis() >= _teleportHome)
|
if (_teleportHome != -1 && System.currentTimeMillis() >= _teleportHome)
|
||||||
{
|
{
|
||||||
|
@ -135,7 +135,7 @@ public class WraithCreature extends EventCreature<Zombie>
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
Location teleport = zombie.getTarget().getLocation().add(Math.random() + 1, 0, Math.random() + 1);
|
Location teleport = zombie.getTarget().getLocation().add(Math.random() + 1, 0, Math.random() + 1);
|
||||||
if (UtilMath.offset(getSpawnLocation(), teleport) > 34)
|
if (UtilMath.offset(getSpawnLocation(), teleport) > 30)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user