minor game fixes
portal method in StackerManager.java
This commit is contained in:
parent
2a3d7426d5
commit
34521eef8f
@ -1,5 +1,6 @@
|
||||
package mineplex.hub.modules;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
|
||||
import org.bukkit.GameMode;
|
||||
@ -27,6 +28,7 @@ import mineplex.core.common.util.UtilEvent;
|
||||
import mineplex.core.common.util.UtilGear;
|
||||
import mineplex.core.common.util.UtilInv;
|
||||
import mineplex.core.common.util.UtilPlayer;
|
||||
import mineplex.core.common.util.UtilTime;
|
||||
import mineplex.core.common.util.UtilEvent.ActionType;
|
||||
import mineplex.core.itemstack.ItemStackFactory;
|
||||
import mineplex.core.projectile.IThrown;
|
||||
@ -44,6 +46,8 @@ public class StackerManager extends MiniPlugin implements IThrown
|
||||
private HashSet<String> _disabled = new HashSet<String>();
|
||||
private HashSet<Entity> _tempStackShift = new HashSet<Entity>();
|
||||
|
||||
private HashMap<String, Long> _portalTime = new HashMap<String, Long>();
|
||||
|
||||
public StackerManager(HubManager manager)
|
||||
{
|
||||
super("Stacker", manager.GetPlugin());
|
||||
@ -91,6 +95,7 @@ public class StackerManager extends MiniPlugin implements IThrown
|
||||
{
|
||||
_disabled.remove(event.getPlayer().getName());
|
||||
_tempStackShift.remove(event.getPlayer());
|
||||
_portalTime.remove(event.getPlayer().getName());
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
@ -163,13 +168,17 @@ public class StackerManager extends MiniPlugin implements IThrown
|
||||
|
||||
if (!Recharge.Instance.use(stacker, "Stacker", 500, true))
|
||||
return;
|
||||
|
||||
|
||||
top.setPassenger(stackee);
|
||||
|
||||
UtilPlayer.message(stacker, F.main("Stacker", "You stacked " + F.name(UtilEnt.getName(stackee) + ".")));
|
||||
UtilPlayer.message(stackee, F.main("Stacker", "You were stacked by " + F.name(stacker.getName() + ".")));
|
||||
UtilPlayer.message(stackee, F.main("Stacker", "Push " + F.skill("Crouch") + " to escape!"));
|
||||
|
||||
//Portal Delay
|
||||
SetPortalDelay(stacker);
|
||||
SetPortalDelay(stackee);
|
||||
|
||||
event.setCancelled(true);
|
||||
}
|
||||
|
||||
@ -225,6 +234,10 @@ public class StackerManager extends MiniPlugin implements IThrown
|
||||
UtilAction.velocity(throwee, thrower.getLocation().getDirection(), 1.8, false, 0, 0.3, 2, false);
|
||||
|
||||
_projectileManager.AddThrow(throwee, thrower, this, -1, true, false, true, false, 2.4d);
|
||||
|
||||
//Portal Delay
|
||||
SetPortalDelay(thrower);
|
||||
SetPortalDelay(throwee);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -239,6 +252,9 @@ public class StackerManager extends MiniPlugin implements IThrown
|
||||
Entity rider = target.getPassenger();
|
||||
while (rider != null)
|
||||
{
|
||||
//Portal Delay
|
||||
SetPortalDelay(rider);
|
||||
|
||||
rider.leaveVehicle();
|
||||
rider.setVelocity(new Vector(0.25 - Math.random()/2, Math.random()/2, 0.25 - Math.random()/2));
|
||||
rider = rider.getPassenger();
|
||||
@ -248,6 +264,9 @@ public class StackerManager extends MiniPlugin implements IThrown
|
||||
|
||||
//Effect
|
||||
data.GetThrown().getWorld().playSound(data.GetThrown().getLocation(), Sound.HURT, 1f, 1f);
|
||||
|
||||
//Portal Delay
|
||||
SetPortalDelay(target);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -261,4 +280,23 @@ public class StackerManager extends MiniPlugin implements IThrown
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public void SetPortalDelay(Entity ent)
|
||||
{
|
||||
if (ent instanceof Player)
|
||||
_portalTime.put(((Player)ent).getName(), System.currentTimeMillis());
|
||||
}
|
||||
|
||||
public boolean CanPortal(Player player)
|
||||
{
|
||||
//Riding
|
||||
if (player.getVehicle() != null || player.getPassenger() != null)
|
||||
return false;
|
||||
|
||||
//Portal Delay
|
||||
if (!_portalTime.containsKey(player.getName()))
|
||||
return true;
|
||||
|
||||
return UtilTime.elapsed(_portalTime.get(player.getName()), 5000);
|
||||
}
|
||||
}
|
||||
|
@ -58,7 +58,7 @@ import nautilus.game.arcade.ore.OreObsfucation;
|
||||
public class Bridge extends TeamGame implements OreObsfucation
|
||||
{
|
||||
//Bridge Timer
|
||||
private int _bridgeTime = 600000;
|
||||
private int _bridgeTime = 15000;
|
||||
private boolean _bridgesDown = false;
|
||||
|
||||
//Wood Bridge
|
||||
|
@ -111,6 +111,9 @@ public class DragonEscape extends SoloGame
|
||||
|
||||
last = best;
|
||||
}
|
||||
|
||||
if (WorldData.MapName.contains("Hell"))
|
||||
this.WorldTimeSet = 16000;
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
@ -165,13 +168,15 @@ public class DragonEscape extends SoloGame
|
||||
if (SetScore(player, playerScore))
|
||||
return;
|
||||
|
||||
if (player.getLocation().getY() < 50)
|
||||
player.damage(50);
|
||||
|
||||
if (dragonScore > playerScore)
|
||||
player.damage(50);
|
||||
}
|
||||
}
|
||||
|
||||
public ArrayList<DragonScore> GetScores()
|
||||
{
|
||||
return _ranks;
|
||||
}
|
||||
|
||||
public boolean SetScore(Player player, double playerScore)
|
||||
{
|
||||
|
@ -1,11 +1,9 @@
|
||||
package nautilus.game.arcade.game.games.dragonescape;
|
||||
|
||||
import mineplex.core.common.util.UtilAlg;
|
||||
import mineplex.core.common.util.UtilMath;
|
||||
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.entity.EnderDragon;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.util.Vector;
|
||||
|
||||
public class DragonEscapeData
|
||||
@ -13,19 +11,19 @@ public class DragonEscapeData
|
||||
public DragonEscape Host;
|
||||
|
||||
public EnderDragon Dragon;
|
||||
|
||||
|
||||
public Location Target = null;
|
||||
public Location Location = null;
|
||||
|
||||
public float Pitch = 0;
|
||||
public Vector Velocity = new Vector(0,0,0);
|
||||
|
||||
|
||||
public DragonEscapeData(DragonEscape host, EnderDragon dragon, Location target)
|
||||
{
|
||||
Host = host;
|
||||
|
||||
Dragon = dragon;
|
||||
|
||||
|
||||
Location temp = dragon.getLocation();
|
||||
temp.setPitch(UtilAlg.GetPitch(UtilAlg.getTrajectory(dragon.getLocation(), target)));
|
||||
dragon.teleport(temp);
|
||||
@ -35,32 +33,27 @@ public class DragonEscapeData
|
||||
|
||||
Location = dragon.getLocation();
|
||||
}
|
||||
|
||||
|
||||
public void Move()
|
||||
{
|
||||
Turn();
|
||||
|
||||
|
||||
//Distance Boost
|
||||
double dist = 0;
|
||||
for (Player player : Host.GetPlayers(true))
|
||||
{
|
||||
double offset = UtilMath.offset(Location, player.getLocation());
|
||||
|
||||
if (offset < dist || dist == -1)
|
||||
{
|
||||
dist = offset;
|
||||
}
|
||||
}
|
||||
|
||||
//Speed
|
||||
double speed = 0.16; //+ (System.currentTimeMillis() - Host.GetStateTime())/2000000d;
|
||||
|
||||
double speed = 0.16;
|
||||
|
||||
speed += (System.currentTimeMillis() - Host.GetStateTime())/1000d * 0.001;
|
||||
|
||||
if (dist > 10)
|
||||
speed += (dist-10) * 0.001;
|
||||
|
||||
|
||||
//Speed Distance Boost
|
||||
if (!Host.GetScores().isEmpty())
|
||||
{
|
||||
double score = Host.GetScore(Dragon);
|
||||
double best = Host.GetScores().get(0).Score;
|
||||
|
||||
double lead = (best-score)/10000d;
|
||||
|
||||
speed += lead * 0.0025;
|
||||
}
|
||||
|
||||
Location.add(Velocity.clone().multiply(speed));
|
||||
Location.add(0, -Pitch, 0);
|
||||
|
||||
|
@ -608,11 +608,11 @@ public class TurfForts extends TeamGame
|
||||
if (!IsLive())
|
||||
return;
|
||||
|
||||
if (GetRedLines() == 0)
|
||||
if (GetRedLines() == 0 || GetTeam(ChatColor.RED).GetPlayers(true).size() == 0)
|
||||
{
|
||||
AnnounceEnd(GetTeam(ChatColor.AQUA));
|
||||
}
|
||||
else if (GetBlueLines() == 0)
|
||||
else if (GetBlueLines() == 0 || GetTeam(ChatColor.AQUA).GetPlayers(true).size() == 0)
|
||||
{
|
||||
AnnounceEnd(GetTeam(ChatColor.RED));
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user