This commit is contained in:
Mysticate 2015-07-22 16:50:57 -04:00
parent b4df9f47c5
commit b9762bddc4
6 changed files with 116 additions and 49 deletions

View File

@ -27,7 +27,7 @@ public enum GameDisplay
HideSeek("Block Hunt", Material.GRASS, (byte)0, GameCategory.CLASSICS, 20),
HoleInTheWall("Hole in the Wall", Material.STAINED_GLASS, (byte) 2, GameCategory.ARCADE, 52),
Horse("Horseback", Material.IRON_BARDING, (byte)0, GameCategory.ARCADE, 21),
Lobbers("Bomb Lobbers", Material.FIREWORK_CHARGE, (byte) 0, GameCategory.ARCADE, 53),
Lobbers("Bomb Lobbers", Material.FIREBALL, (byte) 0, GameCategory.ARCADE, 53),
Micro("Micro Battle", Material.LAVA_BUCKET, (byte)0, GameCategory.ARCADE, 24),
MilkCow("Milk the Cow", Material.MILK_BUCKET, (byte)0, GameCategory.ARCADE, 27),
MineStrike("MineStrike", Material.TNT, (byte)0, GameCategory.CHAMPIONS, 25),// Temp set to CHAMPIONS to fix UI bug

View File

@ -1,15 +1,13 @@
package mineplex.core.projectile;
import java.util.HashSet;
import java.util.Iterator;
import java.util.Map.Entry;
import java.util.WeakHashMap;
import mineplex.core.MiniPlugin;
import mineplex.core.common.util.UtilParticle.ParticleType;
import mineplex.core.disguise.DisguiseManager;
import mineplex.core.updater.event.UpdateEvent;
import mineplex.core.updater.UpdateType;
import mineplex.core.updater.event.UpdateEvent;
import org.bukkit.Effect;
import org.bukkit.Sound;
@ -35,7 +33,7 @@ public class ProjectileManager extends MiniPlugin
{
_thrown.put(thrown, new ProjectileUser(this, thrown, thrower, callback,
expireTime, hitPlayer, hitBlock, idle, false,
null, 1f, 1f, null, 0, null, null, hitboxGrow));
null, 1f, 1f, null, 0, null, null, 0F, 0F, 0F, 0F, 1, hitboxGrow));
}
public void AddThrow(Entity thrown, LivingEntity thrower, IThrown callback,
@ -43,7 +41,7 @@ public class ProjectileManager extends MiniPlugin
{
_thrown.put(thrown, new ProjectileUser(this, thrown, thrower, callback,
expireTime, hitPlayer, hitBlock, idle, pickup,
null, 1f, 1f, null, 0, null, null, hitboxGrow));
null, 1f, 1f, null, 0, null, null, 0F, 0F, 0F, 0F, 1, hitboxGrow));
}
public void AddThrow(Entity thrown, LivingEntity thrower, IThrown callback,
@ -52,7 +50,7 @@ public class ProjectileManager extends MiniPlugin
{
_thrown.put(thrown, new ProjectileUser(this, thrown, thrower, callback,
expireTime, hitPlayer, hitBlock, idle, false,
sound, soundVolume, soundPitch, effect, effectData, effectRate, null, hitboxGrow));
sound, soundVolume, soundPitch, effect, effectData, effectRate, null, 0F, 0F, 0F, 0F, 1, hitboxGrow));
}
public void AddThrow(Entity thrown, LivingEntity thrower, IThrown callback,
@ -61,7 +59,7 @@ public class ProjectileManager extends MiniPlugin
{
_thrown.put(thrown, new ProjectileUser(this, thrown, thrower, callback,
expireTime, hitPlayer, hitBlock, idle, false,
sound, soundVolume, soundPitch, effect, effectData, effectRate, particle, hitboxGrow));
sound, soundVolume, soundPitch, effect, effectData, effectRate, particle, 0F, 0F, 0F, 0F, 1, hitboxGrow));
}
public void AddThrow(Entity thrown, LivingEntity thrower, IThrown callback,
@ -70,7 +68,16 @@ public class ProjectileManager extends MiniPlugin
{
_thrown.put(thrown, new ProjectileUser(this, thrown, thrower, callback,
expireTime, hitPlayer, hitBlock, idle, false,
sound, soundVolume, soundPitch, null, 0, effectRate, particle, hitboxMult));
sound, soundVolume, soundPitch, null, 0, effectRate, particle, 0F, 0F, 0F, 0F, 1, hitboxMult));
}
public void AddThrow(Entity thrown, LivingEntity thrower, IThrown callback,
long expireTime, boolean hitPlayer, boolean hitBlock, boolean idle,
Sound sound, float soundVolume, float soundPitch, ParticleType particle, float pX, float pY, float pZ, float pS, int pC, UpdateType effectRate, float hitboxMult)
{
_thrown.put(thrown, new ProjectileUser(this, thrown, thrower, callback,
expireTime, hitPlayer, hitBlock, idle, false,
sound, soundVolume, soundPitch, null, 0, effectRate, particle, pX, pY, pZ, pS, pC, hitboxMult));
}
@EventHandler

View File

@ -1,16 +1,13 @@
package mineplex.core.projectile;
import mineplex.core.updater.event.UpdateEvent;
import mineplex.core.updater.UpdateType;
import mineplex.core.common.util.UtilBlock;
import mineplex.core.common.util.UtilEnt;
import mineplex.core.common.util.UtilParticle;
import mineplex.core.common.util.UtilPlayer;
import mineplex.core.common.util.UtilServer;
import mineplex.core.common.util.UtilParticle.ParticleType;
import mineplex.core.common.util.UtilParticle.ViewDist;
import mineplex.core.disguise.DisguiseManager;
import mineplex.core.disguise.disguises.DisguiseSquid;
import mineplex.core.common.util.UtilPlayer;
import mineplex.core.common.util.UtilServer;
import mineplex.core.updater.UpdateType;
import mineplex.core.updater.event.UpdateEvent;
import net.minecraft.server.v1_7_R4.AxisAlignedBB;
import net.minecraft.server.v1_7_R4.MathHelper;
import net.minecraft.server.v1_7_R4.MovingObjectPosition;
@ -25,7 +22,6 @@ import org.bukkit.craftbukkit.v1_7_R4.CraftWorld;
import org.bukkit.craftbukkit.v1_7_R4.entity.CraftEntity;
import org.bukkit.craftbukkit.v1_7_R4.entity.CraftLivingEntity;
import org.bukkit.entity.Entity;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Player;
@ -46,7 +42,14 @@ public class ProjectileUser
private Sound _sound = null;
private float _soundVolume = 1f;
private float _soundPitch = 1f;
private ParticleType _particle = null;
private float _particleX = 0F;
private float _particleY = 0F;
private float _particleZ = 0F;
private float _particleS = 0F;
private int _particleC = 1;
private Effect _effect = null;
private int _effectData = 0;
private UpdateType _effectRate = UpdateType.TICK;
@ -57,8 +60,8 @@ public class ProjectileUser
long expireTime, boolean hitPlayer, boolean hitBlock, boolean idle, boolean pickup,
Sound sound, float soundVolume, float soundPitch,
Effect effect, int effectData, UpdateType effectRate,
ParticleType particle,
double hitboxMult)
ParticleType particle, float particleX, float particleY,
float particleZ, float particleS, int particleC, double hitboxMult)
{
Throw = throwInput;
@ -76,6 +79,11 @@ public class ProjectileUser
_soundVolume = soundVolume;
_soundPitch = soundPitch;
_particle = particle;
_particleX = particleX;
_particleY = particleY;
_particleZ = particleZ;
_particleS = particleS;
_particleC = particleC;
_effect = effect;
_effectData = effectData;
_effectRate = effectRate;
@ -95,7 +103,7 @@ public class ProjectileUser
_thrown.getWorld().playEffect(_thrown.getLocation(), _effect, _effectData);
if (_particle != null)
UtilParticle.PlayParticle(_particle, _thrown.getLocation(), 0f, 0f, 0f, 0, 1,
UtilParticle.PlayParticle(_particle, _thrown.getLocation(), _particleX, _particleY, _particleZ, _particleS, _particleC,
ViewDist.LONG, UtilServer.getPlayers());
}

View File

@ -32,7 +32,6 @@ import nautilus.game.arcade.game.games.lobbers.events.TNTThrowEvent;
import nautilus.game.arcade.game.games.lobbers.kits.KitArmorer;
import nautilus.game.arcade.game.games.lobbers.kits.KitDetonator;
import nautilus.game.arcade.game.games.lobbers.kits.KitJumper;
import nautilus.game.arcade.game.games.lobbers.kits.KitMortar;
import nautilus.game.arcade.game.games.lobbers.kits.KitWaller;
import nautilus.game.arcade.game.games.lobbers.trackers.Tracker6Kill;
import nautilus.game.arcade.game.games.lobbers.trackers.TrackerBestTeam;
@ -44,7 +43,6 @@ import nautilus.game.arcade.kit.Kit;
import org.bukkit.EntityEffect;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.Sound;
import org.bukkit.block.Block;
import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Player;
@ -72,7 +70,7 @@ public class BombLobbers extends TeamGame implements IThrown
new KitJumper(manager),
new KitArmorer(manager),
new KitDetonator(manager),
new KitMortar(manager),
// new KitMortar(manager),
new KitWaller(manager)
}, new String[]
{
@ -188,7 +186,7 @@ public class BombLobbers extends TeamGame implements IThrown
if (!UtilInv.IsItem(player.getItemInHand(), Material.TNT, (byte) 0))
return;
event.setCancelled(true);
UtilInv.remove(player, Material.TNT, (byte) 0, 1);
@ -199,9 +197,7 @@ public class BombLobbers extends TeamGame implements IThrown
tnt.setFuseTicks(60);
UtilAction.velocity(tnt, player.getLocation().getDirection(), 2.0D, false, 0.0D, 0.1D, 10.0D, false);
Manager.GetProjectile().AddThrow(tnt, player, this, -1L, true, false, false, .2F);
player.playSound(player.getLocation(), Sound.CREEPER_HISS, 3.0F, 1.0F);
Manager.GetProjectile().AddThrow(tnt, player, this, -1L, true, false, true, .2F);
Manager.getPlugin().getServer().getPluginManager().callEvent(new TNTThrowEvent(player, tnt));
@ -218,9 +214,17 @@ public class BombLobbers extends TeamGame implements IThrown
_tnt.put(tnt, player.getName());
}
public String getThrower(TNTPrimed tnt)
public void removeThrower(TNTPrimed tnt)
{
return _tnt.get(tnt);
_tnt.remove(tnt);
}
public Player getThrower(TNTPrimed tnt)
{
if (_tnt.get(tnt) == null)
return null;
return UtilPlayer.searchExact(_tnt.get(tnt));
}
@EventHandler
@ -312,7 +316,7 @@ public class BombLobbers extends TeamGame implements IThrown
if (team == null)
continue;
UtilParticle.PlayParticle(ParticleType.RED_DUST, tnt.getKey().getLocation().clone().add(0.0, 0.5, 0.0), team.GetColorBase().getRed(), team.GetColorBase().getGreen(), team.GetColorBase().getBlue(), 1, 0, ViewDist.LONG, UtilServer.getPlayers());
UtilParticle.PlayParticle(ParticleType.RED_DUST, tnt.getKey().getLocation().clone().add(0.0, 0.6, 0.0), team.GetColorBase().getRed(), team.GetColorBase().getGreen(), team.GetColorBase().getBlue(), 1, 0, ViewDist.LONG, UtilServer.getPlayers());
}
}

View File

@ -1,12 +1,17 @@
package nautilus.game.arcade.game.games.lobbers.kits;
import java.util.Map.Entry;
import mineplex.core.common.util.C;
import mineplex.core.common.util.F;
import mineplex.core.common.util.NautHashMap;
import mineplex.core.common.util.UtilEvent;
import mineplex.core.common.util.UtilEvent.ActionType;
import mineplex.core.common.util.UtilInv;
import mineplex.core.itemstack.ItemBuilder;
import mineplex.core.updater.event.UpdateEvent;
import nautilus.game.arcade.ArcadeManager;
import nautilus.game.arcade.game.games.lobbers.BombLobbers;
import nautilus.game.arcade.game.games.lobbers.events.TNTThrowEvent;
import nautilus.game.arcade.game.games.lobbers.kits.perks.PerkCraftman;
import nautilus.game.arcade.kit.Kit;
@ -16,23 +21,26 @@ import nautilus.game.arcade.kit.Perk;
import org.bukkit.Material;
import org.bukkit.Sound;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Player;
import org.bukkit.entity.TNTPrimed;
import org.bukkit.event.EventHandler;
import org.bukkit.event.player.PlayerInteractEvent;
import org.bukkit.inventory.ItemStack;
import org.bukkit.metadata.FixedMetadataValue;
public class KitDetonator extends Kit
{
private NautHashMap<TNTPrimed, Integer> _fuseTimes = new NautHashMap<TNTPrimed, Integer>();
public KitDetonator(ArcadeManager manager)
{
super(manager, "Detonator", KitAvailability.Gem, 4000, new String[]
{
"He doesn't like to wait. Max fuse of 3 and min fuse of 2.",
"",
"He doesn't like to wait. ",
C.cYellow + "Left Click" + C.cGray + " lever to " + C.cGreen + "Decrease Fuse Time.",
C.cYellow + "Right Click" + C.cGray + " lever to " + C.cGreen + "Increase Fuse Time."
C.cYellow + "Right Click" + C.cGray + " lever to " + C.cGreen + "Increase Fuse Time.",
"Maximum fuse time of " + C.cYellow + "6 Seconds.",
"Minimum fuse time of " + C.cYellow + "2 Seconds.",
}, new Perk[]
{
new PerkCraftman(6000)
@ -43,13 +51,7 @@ public class KitDetonator extends Kit
@Override
public void GiveItems(Player player)
{
player.getInventory().setItem(1, new ItemBuilder(Material.LEVER).setTitle(F.item("Fuse Selector (Seconds)")).setAmount(2).build());
}
@Override
public void SpawnCustom(LivingEntity ent)
{
player.getInventory().setItem(1, new ItemBuilder(Material.LEVER).setTitle(F.item("Fuse Selector (Seconds)")).setAmount(3).build());
}
@EventHandler
@ -69,14 +71,13 @@ public class KitDetonator extends Kit
}
else
{
if (lever.getAmount() <= 0 || lever.getAmount() > 3)
if (lever.getAmount() < 2 || lever.getAmount() > 6)
{
GiveItems(event.getPlayer());
}
else
{
event.getTNT().setFuseTicks(lever.getAmount() * 20);
}
event.getTNT().setFuseTicks(lever.getAmount() * 20);
_fuseTimes.put(event.getTNT(), lever.getAmount() * 20);
}
}
@ -100,7 +101,7 @@ public class KitDetonator extends Kit
//Right
if (UtilEvent.isAction(event, ActionType.R))
{
if (amount >= 3)
if (amount >= 6)
return;
UtilInv.insert(event.getPlayer(), new ItemBuilder(Material.LEVER).setTitle(F.item("Fuse Selector (Seconds)")).build());
@ -116,5 +117,52 @@ public class KitDetonator extends Kit
UtilInv.Update(event.getPlayer());
}
event.getPlayer().getWorld().playSound(event.getPlayer().getLocation(), Sound.CLICK, 3.0F, 1.0F);
}
}
@EventHandler
public void respawnBombs(UpdateEvent event)
{
if (!(Manager.GetGame() instanceof BombLobbers))
return;
BombLobbers l = (BombLobbers) Manager.GetGame();
if (!Manager.GetGame().IsLive())
return;
for (Entry<TNTPrimed, Integer> entry : _fuseTimes.entrySet())
{
if (entry.getKey() == null || !entry.getKey().isValid())
return;
//If it will need respawning
if (entry.getValue() > 60)
{
//If it's near 60 ticks
//2 tick leeway
if (entry.getKey().getFuseTicks() >= 60 && entry.getKey().getFuseTicks() <= 62)
{
Player player = l.getThrower(entry.getKey());
if (player == null)
{
continue;
}
TNTPrimed newTNT = entry.getKey().getWorld().spawn(entry.getKey().getLocation(), TNTPrimed.class);
newTNT.setMetadata("owner", new FixedMetadataValue(Manager.getPlugin(), player.getUniqueId()));
newTNT.setVelocity(entry.getKey().getVelocity());
newTNT.setFuseTicks(59);
Manager.GetProjectile().AddThrow(newTNT, player, l, -1L, true, false, true, .2F);
entry.getKey().remove();
l.removeThrower(entry.getKey());
_fuseTimes.remove(entry.getKey());
l.addThrower(player, newTNT);
}
}
}
}
}

View File

@ -88,7 +88,7 @@ public class PerkWaller extends Perk
for (TNTPrimed tnt : _tnt)
{
for (Block near : UtilBlock.getInRadius(tnt.getLocation(), 2.0F).keySet())
for (Block near : UtilBlock.getInRadius(tnt.getLocation(), 3.0F).keySet())
{
if (_wallBlocks.contains(near.getLocation()))
{