fix bugs and make some improvements

This commit is contained in:
xXVevzZXx 2016-11-15 17:04:38 +01:00
parent 3f6af6372d
commit a74bc71018
6 changed files with 165 additions and 16 deletions

View File

@ -11,6 +11,7 @@ import mineplex.core.common.util.UtilMath;
import mineplex.core.common.util.UtilPlayer;
import mineplex.core.common.util.UtilServer;
import mineplex.core.common.util.UtilTextBottom;
import mineplex.core.common.util.UtilTime;
import mineplex.core.recharge.Recharge;
import mineplex.core.updater.UpdateType;
import mineplex.core.updater.event.UpdateEvent;
@ -34,9 +35,14 @@ import org.bukkit.plugin.java.JavaPlugin;
public class CompassAddon extends MiniPlugin
{
private static final long MODE_SWITCH_TIME = 3000;
public ArcadeManager Manager;
private SpectatorShop _spectatorShop;
private boolean _showTeam;
private long _lastChanged;
public CompassAddon(JavaPlugin plugin, ArcadeManager manager)
{
@ -77,10 +83,33 @@ public class CompassAddon extends MiniPlugin
GameTeam otherTeam = Manager.GetGame().GetTeam(other);
//Same Team (Not Solo Game) && Alive
if (Manager.GetGame().GetTeamList().size() > 1 && (team != null && team.equals(otherTeam)) && Manager.GetGame().IsAlive(player))
continue;
if (!Manager.GetGame().TeamMode)
{
//Same Team (Not Solo Game) && Alive
if (Manager.GetGame().GetTeamList().size() > 1 && (team != null && team.equals(otherTeam)) && Manager.GetGame().IsAlive(player))
continue;
}
else
{
if (UtilTime.elapsed(_lastChanged, MODE_SWITCH_TIME))
{
_lastChanged = System.currentTimeMillis();
_showTeam = !_showTeam;
}
if (_showTeam)
{
if (!team.equals(otherTeam))
continue;
}
else
{
if (team.equals(otherTeam))
continue;
}
}
double dist = UtilMath.offset(player, other);
if (target == null || dist < bestDist)

View File

@ -16,6 +16,7 @@ import org.bukkit.event.HandlerList;
import org.bukkit.event.Listener;
import org.bukkit.inventory.ItemStack;
import org.bukkit.util.Vector;
import org.omg.DynamicAny._DynUnionStub;
import mineplex.core.common.util.UtilAction;
import mineplex.core.common.util.UtilBlock;
@ -63,6 +64,11 @@ public class BoosterRing extends Crumbleable implements Listener
private long _disabledSince;
private long _disabledFor;
private long _disableDelay;
private long _disableDelayStarted;
private CooldownData _delayedData;
private Hologram _hologram;
private boolean _timer;
@ -89,6 +95,8 @@ public class BoosterRing extends Crumbleable implements Listener
_boostStrength = boostStrength;
_disabledSince = System.currentTimeMillis();
_disableDelayStarted = 0;
System.out.println("Registering Ring");
setupRing();
@ -305,7 +313,7 @@ public class BoosterRing extends Crumbleable implements Listener
if (event.getType() != UpdateType.TICK)
return;
for (Player player : _host.GetPlayers(true))
for (Player player : UtilServer.getPlayers())
{
if (!UtilPlayer.isGliding(player))
continue;
@ -331,7 +339,8 @@ public class BoosterRing extends Crumbleable implements Listener
Vector vec = player.getEyeLocation().getDirection();
UtilAction.velocity(player, vec.multiply(event.getStrength()));
UtilFirework.playFirework(player.getEyeLocation(), Type.BALL_LARGE, Color.BLUE, true, false);
if (_host.IsAlive(player))
UtilFirework.playFirework(player.getEyeLocation(), Type.BALL_LARGE, Color.BLUE, true, false);
}
@EventHandler
@ -391,6 +400,42 @@ public class BoosterRing extends Crumbleable implements Listener
enable();
}
@EventHandler
public void disableUpdate(UpdateEvent event)
{
if (event.getType() != UpdateType.FASTER)
return;
if (_delayedData == null)
return;
if (UtilTime.elapsed(_disableDelayStarted, _disableDelay))
{
disable(_delayedData.getTime(), _delayedData.getMaterial(), _delayedData.getData(), _delayedData.showTimer());
_delayedData = null;
}
}
public void disableLater(long delay, long time, Material mat, byte data, boolean showTimer)
{
if (_delayedData != null)
return;
_delayedData = new CooldownData(time, mat, data, showTimer);
_disableDelayStarted = System.currentTimeMillis();
_disableDelay = delay;
}
public void disableLater(long delay, long time, boolean showTimer)
{
disableLater(delay, time, Material.STAINED_CLAY, (byte) 14, showTimer);
}
public void disableLater(long delay)
{
disableLater(delay, Long.MAX_VALUE, Material.STAINED_CLAY, (byte) 14, false);
}
public void disable()
{
disable(Long.MAX_VALUE, false);
@ -493,4 +538,40 @@ public class BoosterRing extends Crumbleable implements Listener
return _ring;
}
private class CooldownData
{
private long _time;
private Material _mat;
private byte _data;
private boolean _showTimer;
public CooldownData(long time, Material mat, byte data, boolean showTimer)
{
_time = time;
_mat = mat;
_data = data;
_showTimer = showTimer;
}
public long getTime()
{
return _time;
}
public Material getMaterial()
{
return _mat;
}
public byte getData()
{
return _data;
}
public boolean showTimer()
{
return _showTimer;
}
}
}

View File

@ -91,7 +91,7 @@ public class Island extends Crumbleable
Inventory inventory = chest.getBlockInventory();
inventory.clear();
int items = 3;
int items = 6;
if (Math.random() > 0.50)
items++;
if (Math.random() > 0.65)

View File

@ -57,12 +57,12 @@ public class LootTable
Material.TNT, (byte) 0, 1, F.item("Throwing TNT")), 15),
new RandomItem(Material.MUSHROOM_SOUP, 15),
new RandomItem(Material.BAKED_POTATO, 20, 1, 5),
new RandomItem(Material.MUSHROOM_SOUP, 20, 1, 1),
new RandomItem(Material.COOKED_BEEF, 30, 1, 3),
new RandomItem(Material.COOKED_CHICKEN, 30, 1, 3),
new RandomItem(Material.COOKED_FISH, 30, 1, 6),
new RandomItem(Material.GRILLED_PORK, 20, 1, 3),
new RandomItem(Material.BAKED_POTATO, 25, 1, 5),
new RandomItem(Material.MUSHROOM_SOUP, 25, 1, 1),
new RandomItem(Material.COOKED_BEEF, 35, 1, 3),
new RandomItem(Material.COOKED_CHICKEN, 35, 1, 3),
new RandomItem(Material.COOKED_FISH, 35, 1, 6),
new RandomItem(Material.GRILLED_PORK, 25, 1, 3),
new RandomItem(Material.COOKIE, 30),
new RandomItem(Material.PUMPKIN_PIE, 20, 1, 3),
new RandomItem(Material.APPLE, 20, 2, 6),

View File

@ -11,10 +11,12 @@ import java.util.UUID;
import net.md_5.bungee.api.ChatColor;
import org.bukkit.Color;
import org.bukkit.Effect;
import org.bukkit.FireworkEffect;
import org.bukkit.FireworkEffect.Type;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.Sound;
import org.bukkit.block.Block;
import org.bukkit.block.BlockFace;
import org.bukkit.block.Chest;
@ -59,6 +61,7 @@ import mineplex.core.common.util.UtilPlayer;
import mineplex.core.common.util.UtilServer;
import mineplex.core.common.util.UtilTime;
import mineplex.core.recharge.Recharge;
import mineplex.core.shop.item.ISalesPackage;
import mineplex.core.updater.UpdateType;
import mineplex.core.updater.event.UpdateEvent;
import mineplex.minecraft.game.core.damage.CustomDamageEvent;
@ -68,6 +71,7 @@ import nautilus.game.arcade.GameType;
import nautilus.game.arcade.events.GameStateChangeEvent;
import nautilus.game.arcade.game.Game;
import nautilus.game.arcade.game.games.skyfall.kits.KitAeronaught;
import nautilus.game.arcade.game.games.skyfall.kits.KitBooster;
import nautilus.game.arcade.game.games.skyfall.kits.KitDeadeye;
import nautilus.game.arcade.game.games.skyfall.kits.KitJouster;
import nautilus.game.arcade.game.games.skyfall.kits.KitSpeeder;
@ -151,7 +155,7 @@ public abstract class Skyfall extends Game
new Kit[]
{
new KitSpeeder(manager),
//new KitBooster(manager), // Broken? :(
new KitBooster(manager), // Broken? :(
new KitJouster(manager),
new KitStunner(manager),
//new KitSurefoot(manager),
@ -568,6 +572,9 @@ public abstract class Skyfall extends Game
if (!IsLive())
return;
if (!IsAlive(event.getPlayer()))
return;
if (event.getAction() != Action.RIGHT_CLICK_BLOCK)
return;
@ -696,8 +703,9 @@ public abstract class Skyfall extends Game
@EventHandler
public void ringBoost(PlayerBoostRingEvent event)
{
event.getRing().disable(BOOSTER_COOLDOWN_TIME, Material.STAINED_CLAY, (byte) 14, true);
{
if (IsAlive(event.getPlayer()))
event.getRing().disable(BOOSTER_COOLDOWN_TIME, Material.STAINED_CLAY, (byte) 14, true);
}
public void registerBoosters()
@ -901,7 +909,13 @@ public abstract class Skyfall extends Game
Player player = _tntMap.remove(event.getEntity());
for (Player other : UtilPlayer.getNearby(event.getEntity().getLocation(), TNT_EXPLOSION_RADIUS))
{
Manager.GetCondition().Factory().Explosion("Throwing TNT", other, player, 50, 0.1, false, false);
Manager.GetDamage().NewDamageEvent(other, player, null, DamageCause.ENTITY_EXPLOSION, 6, true, true, true, player.getName(), "Throwing TNT");
}
event.getEntity().getLocation().getWorld().playEffect(event.getEntity().getLocation(), Effect.EXPLOSION_LARGE, 100);
event.getEntity().getLocation().getWorld().playSound(event.getEntity().getLocation(), Sound.EXPLODE, 100, 1);
event.setCancelled(true);
}
@ -1022,6 +1036,22 @@ public abstract class Skyfall extends Game
}
}
@EventHandler
public void updateSpecs(UpdateEvent event)
{
if (event.getType() != UpdateType.FAST)
return;
if (!IsLive())
return;
for (Player player : UtilServer.getPlayers())
{
if (!IsAlive(player))
player.getInventory().setChestplate(new ItemStack(Material.ELYTRA));
}
}
public boolean isDeathMatch()
{
return _deathmatch;

View File

@ -3,6 +3,7 @@ package nautilus.game.arcade.game.games.skyfall;
import java.util.ArrayList;
import java.util.List;
import org.bukkit.Material;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
@ -25,6 +26,7 @@ import nautilus.game.arcade.game.modules.TeamModule;
*/
public class TeamSkyfall extends Skyfall
{
private static final long BOOSTER_COOLDOWN_TIME = 1000*20; // 20 Seconds
public TeamSkyfall(ArcadeManager manager)
{
@ -34,7 +36,6 @@ public class TeamSkyfall extends Skyfall
FillTeamsInOrderToCount = 2;
SpawnNearAllies = true;
SpawnNearEnemies = true;
DamageTeamSelf = false;
@ -154,6 +155,14 @@ public class TeamSkyfall extends Skyfall
SetState(GameState.End);
}
}
@EventHandler
@Override
public void ringBoost(PlayerBoostRingEvent event)
{
if (IsAlive(event.getPlayer()))
event.getRing().disableLater(3000, BOOSTER_COOLDOWN_TIME, Material.STAINED_CLAY, (byte) 14, true);
}
@Override
public List<Player> getWinners()