Fix even more bugs
This commit is contained in:
parent
8bddad44da
commit
5564dc7daf
@ -30,10 +30,7 @@ import nautilus.game.arcade.kit.perks.PerkDestructor;
|
||||
import nautilus.game.arcade.ore.OreHider;
|
||||
import nautilus.game.arcade.ore.OreObsfucation;
|
||||
import nautilus.game.arcade.stats.*;
|
||||
import org.bukkit.Effect;
|
||||
import org.bukkit.GameMode;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.*;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.block.BlockFace;
|
||||
import org.bukkit.block.Chest;
|
||||
@ -74,11 +71,6 @@ public class Bridge extends TeamGame implements OreObsfucation
|
||||
*/
|
||||
private static final long BRIDGE_TIME = TimeUnit.MINUTES.toMillis(10);
|
||||
|
||||
/**
|
||||
* The number of ticks after the prepare state that we wait before setting the world border for the players. Just to make sure they are in the correct world.
|
||||
*/
|
||||
private static final int WORLD_BORDER_PREPARE_TICKS = 20;
|
||||
|
||||
private static final String CUSTOM_BRIDGE_KEY = "TYPE";
|
||||
|
||||
//Bridge
|
||||
@ -113,6 +105,8 @@ public class Bridge extends TeamGame implements OreObsfucation
|
||||
private boolean _tournament;
|
||||
private HashMap<GameTeam, Integer> _tournamentKills = new HashMap<GameTeam, Integer>();
|
||||
private long _tournamentKillMessageTimer = 0;
|
||||
|
||||
private final Map<GameTeam, Location> _averageSpawns = new HashMap<>();
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public Bridge(ArcadeManager manager)
|
||||
@ -145,7 +139,6 @@ public class Bridge extends TeamGame implements OreObsfucation
|
||||
new KitApple(manager),
|
||||
new KitBerserker(manager),
|
||||
new KitBrawler(manager),
|
||||
new KitMammoth(manager),
|
||||
new KitArcher(manager),
|
||||
new KitMiner(manager),
|
||||
new KitBomber(manager),
|
||||
@ -225,25 +218,18 @@ public class Bridge extends TeamGame implements OreObsfucation
|
||||
new CompassModule()
|
||||
.setGiveCompassToAlive(true)
|
||||
.register(this);
|
||||
|
||||
new WorldBorderModule().register(this);
|
||||
|
||||
|
||||
// So that we can be 110% sure
|
||||
for (Kit kit : GetKits())
|
||||
{
|
||||
if (kit instanceof KitDestructor)
|
||||
{
|
||||
for (Perk perk : kit.GetPerks())
|
||||
{
|
||||
((PerkDestructor) perk).setEnabled(false);
|
||||
break;
|
||||
}
|
||||
|
||||
((KitDestructor) kit).SetEnabled(false);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
registerDebugCommand(new DebugCommand("bridge", Rank.ADMIN)
|
||||
registerDebugCommand(new DebugCommand("bridge", getArcadeManager().getGameCommandRank())
|
||||
{
|
||||
|
||||
@Override
|
||||
@ -272,40 +258,15 @@ public class Bridge extends TeamGame implements OreObsfucation
|
||||
});
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.LOWEST)
|
||||
@EventHandler
|
||||
public void prepare(GameStateChangeEvent event)
|
||||
{
|
||||
if (event.GetState() != GameState.Prepare || !WorldData.GetCustomLocs("DISABLE_BORDER").isEmpty())
|
||||
if (event.GetState() != GameState.Prepare)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
//Delay this so that we are 100% sure people are in the world.
|
||||
Manager.runSyncLater(() -> {
|
||||
|
||||
WorldBorderModule borderModule = getModule(WorldBorderModule.class);
|
||||
|
||||
// Here we do some calculations for per player world borders
|
||||
for (GameTeam team : GetTeamList())
|
||||
{
|
||||
// Step 1 - Get the average location of the spawns, we assume this is generally in an OK position.
|
||||
Location center = UtilAlg.getAverageLocation(team.GetSpawns());
|
||||
// Step 1.5 - Move the location back a bit from the centre, this is usually because spawns are on the inside edge of the islands.
|
||||
center.add(UtilAlg.getTrajectory(SpectatorSpawn, center).multiply(15));
|
||||
|
||||
// Step 2 - Calculate an estimate for the size of the border. We'll go with half but the setSize uses the radius so it works out the same to leave it like this
|
||||
double distToCenter = UtilMath.offset2d(SpectatorSpawn, center) * 0.9;
|
||||
|
||||
// Step 3 - Send the setCenter and setSize packets to the team members
|
||||
for (Player player : team.GetPlayers(true))
|
||||
{
|
||||
borderModule.setCenter(player, center);
|
||||
borderModule.setSize(player, distToCenter);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}, WORLD_BORDER_PREPARE_TICKS);
|
||||
Manager.runSyncLater(() -> _animation.onParse(), 10);
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.MONITOR)
|
||||
@ -319,17 +280,13 @@ public class Bridge extends TeamGame implements OreObsfucation
|
||||
if (!WorldData.GetCustomLocs("WATER_DAMAGE").isEmpty())
|
||||
{
|
||||
WorldWaterDamage = 4;
|
||||
}
|
||||
|
||||
if (WorldWaterDamage > 0)
|
||||
{
|
||||
String name = WorldData.MapName;
|
||||
|
||||
if (name.equals("Volcanic Islands"))
|
||||
{
|
||||
UtilTextMiddle.display(C.cRed + "Warning", "Water is Boiling Hot", 10, 60, 20);
|
||||
}
|
||||
else if (WorldData.MapName.equals("Icelands"))
|
||||
else if (name.equals("Icelands"))
|
||||
{
|
||||
UtilTextMiddle.display(C.cRed + "Warning", "Water is Freezing Cold", 10, 60, 20);
|
||||
}
|
||||
@ -388,8 +345,6 @@ public class Bridge extends TeamGame implements OreObsfucation
|
||||
}
|
||||
}
|
||||
|
||||
_animation.onParse();
|
||||
|
||||
ParseChests();
|
||||
|
||||
ParseOre(WorldData.GetCustomLocs("73")); // Red
|
||||
@ -750,12 +705,12 @@ public class Bridge extends TeamGame implements OreObsfucation
|
||||
{
|
||||
_bridgesDown = true;
|
||||
|
||||
WorldBorderModule borderModule = getModule(WorldBorderModule.class);
|
||||
|
||||
for (Player player : GetPlayers(true))
|
||||
{
|
||||
borderModule.setSize(player, 10000);
|
||||
}
|
||||
// WorldBorderModule borderModule = getModule(WorldBorderModule.class);
|
||||
//
|
||||
// for (Player player : GetPlayers(true))
|
||||
// {
|
||||
// borderModule.setSize(player, 10000);
|
||||
// }
|
||||
|
||||
Manager.GetExplosion().SetLiquidDamage(true);
|
||||
Announce(C.cRedB + "ALERT: " + C.Reset + C.Bold + "THE BRIDGES ARE SPAWNING!");
|
||||
@ -1754,6 +1709,44 @@ public class Bridge extends TeamGame implements OreObsfucation
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void updateBorder(UpdateEvent event)
|
||||
{
|
||||
if (event.getType() != UpdateType.FAST || _bridgesDown)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
for (GameTeam team : GetTeamList())
|
||||
{
|
||||
List<Location> border = WorldData.GetCustomLocs("BORDER " + team.getDisplayName());
|
||||
|
||||
if (border.size() < 2)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
Location one = border.get(0);
|
||||
Location two = border.get(1);
|
||||
Location average = _averageSpawns.computeIfAbsent(team, k -> UtilAlg.getAverageLocation(team.GetSpawns()));
|
||||
|
||||
one.setY(0);
|
||||
two.setY(256);
|
||||
|
||||
for (Player player : team.GetPlayers(true))
|
||||
{
|
||||
Location location = player.getLocation();
|
||||
|
||||
if (!UtilAlg.inBoundingBox(location, one, two))
|
||||
{
|
||||
player.setVelocity(UtilAlg.getTrajectory(location, average).add(new Vector(0, 1, 0)));
|
||||
player.sendMessage(C.cRedB + "STAY ON YOUR ISLAND!");
|
||||
player.playSound(player.getLocation(), Sound.NOTE_PLING, 1, 0.5F);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void setBridgeTime(int time)
|
||||
{
|
||||
_bridgeTime = time;
|
||||
|
@ -179,6 +179,11 @@ public abstract class CustomBridgeAnimation extends BridgeAnimation
|
||||
continue;
|
||||
}
|
||||
|
||||
for (Location location : locations)
|
||||
{
|
||||
location.getChunk().load();
|
||||
}
|
||||
|
||||
for (Block block : UtilBlock.getInBoundingBox(locations.get(0), locations.get(1)))
|
||||
{
|
||||
if (!_blockIds.contains(block.getTypeId()) || _bridgeBlocks.containsKey(block))
|
||||
|
@ -16,12 +16,12 @@ public class KitApple extends ProgressingKit
|
||||
private static final String[] DESCRIPTION = {
|
||||
"Possess the rare skill of finding apples frequently!",
|
||||
"",
|
||||
receiveItem("apple", 1, 10, 0),
|
||||
receiveItem("apple", 1, 17, 0),
|
||||
click(true, "the apple to throw it")
|
||||
};
|
||||
|
||||
private static final Perk[] PERKS = {
|
||||
new PerkApple(10000)
|
||||
new PerkApple(17000)
|
||||
};
|
||||
|
||||
private static final ItemStack IN_HAND = new ItemStack(Material.APPLE);
|
||||
|
@ -22,12 +22,12 @@ public class KitArcher extends ProgressingKit
|
||||
"Highly trained with a bow, probably an elf or something...",
|
||||
" ",
|
||||
"Begin the game with a Bow",
|
||||
receiveArrowString(1, 20, 3),
|
||||
receiveArrowString(1, 20, 4),
|
||||
"Charge Bow to use " + C.cGreen + "Barrage"
|
||||
};
|
||||
|
||||
private static final Perk[] PERKS = {
|
||||
new PerkFletcher(20, 3, true),
|
||||
new PerkFletcher(20, 4, true),
|
||||
new PerkBarrage(5, 250, true, false),
|
||||
};
|
||||
|
||||
|
@ -25,7 +25,7 @@ public class KitBerserker extends ProgressingKit
|
||||
};
|
||||
|
||||
private static final Perk[] PERKS = {
|
||||
new PerkLeap("Beserker Leap", 1.2, 1.2, 8000),
|
||||
new PerkLeap("Beserker Leap", 1.2, 1.2, 14000),
|
||||
new PerkAxeman(),
|
||||
};
|
||||
|
||||
|
@ -17,12 +17,12 @@ public class KitBomber extends ProgressingKit
|
||||
private static final String[] DESCRIPTION = {
|
||||
"Crazy bomb throwing guy.",
|
||||
" ",
|
||||
receiveItem("TNT", 1, 30, 2),
|
||||
receiveItem("TNT", 1, 25, 2),
|
||||
C.cYellow + "Click" + C.cWhite + " to throw TNT"
|
||||
};
|
||||
|
||||
private static final Perk[] PERKS = {
|
||||
new PerkBomber(30, 2, -1)
|
||||
new PerkBomber(25, 2, -1)
|
||||
};
|
||||
|
||||
private static final ItemStack IN_HAND = new ItemStack(Material.TNT);
|
||||
|
@ -22,12 +22,12 @@ public class KitBrawler extends ProgressingKit
|
||||
"Begin with an Iron Sword",
|
||||
"Take " + C.cGreen + "75%" + C.cWhite + " knockback",
|
||||
"Deal " + C.cGreen + "125%" + C.cWhite + " knockback",
|
||||
"Take " + C.cGreen + "-1" + C.cWhite + " damage from all attacks"
|
||||
"Take " + C.cGreen + "-0.5" + C.cWhite + " damage from all attacks"
|
||||
};
|
||||
|
||||
private static final Perk[] PERKS = {
|
||||
new PerkMammoth(),
|
||||
new PerkIronSkin(1)
|
||||
new PerkIronSkin(0.5)
|
||||
};
|
||||
|
||||
private static final ItemStack[] PLAYER_ITEMS = {
|
||||
|
@ -14,7 +14,7 @@ public class PerkMammoth extends Perk
|
||||
{
|
||||
super("Mammoth", new String[]
|
||||
{
|
||||
C.cGray + "Take 75% knockback and deal 125% knockback",
|
||||
C.cGray + "Take 85% knockback and deal 115% knockback",
|
||||
});
|
||||
}
|
||||
|
||||
@ -30,7 +30,7 @@ public class PerkMammoth extends Perk
|
||||
if (!Kit.HasKit(damager))
|
||||
return;
|
||||
|
||||
event.AddKnockback(GetName(), 1.25d);
|
||||
event.AddKnockback(GetName(), 1.15d);
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.HIGH)
|
||||
@ -45,6 +45,6 @@ public class PerkMammoth extends Perk
|
||||
if (!Kit.HasKit(damagee))
|
||||
return;
|
||||
|
||||
event.AddKnockback(GetName(), 0.75d);
|
||||
event.AddKnockback(GetName(), 0.85d);
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user