Fix bugs arising during clans release

This commit is contained in:
AlexTheCoder 2016-07-28 19:08:47 -04:00
parent f3944527f8
commit 47d79bbad5
6 changed files with 96 additions and 29 deletions

View File

@ -95,6 +95,8 @@ public class PlayerScoreboard
ArrayList<String> lines = data.getLines(manager, player);
for (int i=0 ; i<lines.size() ; i++)
{
if ((15-i) >= 0)
{
//Get New Line
String newLine = lines.get(i);
@ -127,6 +129,7 @@ public class PlayerScoreboard
//Line
_sideObjective.getScore(_teamNames[i]).setScore(15-i);
}
}
//Hide Old Unused
if (_currentLines.size() > lines.size())

View File

@ -1,9 +1,13 @@
package mineplex.game.clans.clans.nether;
import java.util.LinkedList;
import java.util.List;
import mineplex.core.common.util.F;
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.event.UpdateEvent;
import mineplex.game.clans.clans.ClanTips.TipType;
@ -40,6 +44,7 @@ public class BossNetherPortal implements Listener
private Location[] _corners;
private boolean _returnPortal;
private byte _portalFacing;
private LinkedList<Long> _closeWarnings = new LinkedList<>();
public boolean Open = false;
public long Expire = -1;
@ -97,6 +102,16 @@ public class BossNetherPortal implements Listener
{
_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)
@ -261,6 +276,23 @@ public class BossNetherPortal implements Listener
{
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)
{
close();

View File

@ -260,7 +260,7 @@ public class NetherManager extends MiniPlugin
{
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);
for (NetherPortal returnPortal : _returnPortals)
{

View File

@ -1,9 +1,13 @@
package mineplex.game.clans.clans.nether;
import java.util.LinkedList;
import java.util.List;
import mineplex.core.common.util.F;
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.event.UpdateEvent;
import mineplex.game.clans.clans.ClanTips.TipType;
@ -41,6 +45,7 @@ public class NetherPortal implements Listener
private Location[] _corners;
private boolean _returnPortal;
private byte _portalFacing;
private LinkedList<Long> _closeWarnings = new LinkedList<>();
public boolean Open = false;
public long Expire = -1;
@ -99,6 +104,16 @@ public class NetherPortal implements Listener
{
_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)
@ -272,6 +287,23 @@ public class NetherPortal implements Listener
{
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)
{
close();

View File

@ -282,7 +282,7 @@ public abstract class EventCreature<T extends LivingEntity> implements Listener
spawnEntity();
}
if (UtilMath.offset2d(_entity.getLocation(), _spawnLocation) > 34)
if (UtilMath.offset2d(_entity.getLocation(), _spawnLocation) > 30)
{
if (_teleportHome != -1 && System.currentTimeMillis() >= _teleportHome)
{

View File

@ -135,7 +135,7 @@ public class WraithCreature extends EventCreature<Zombie>
return;
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;
}