Merge remote-tracking branch 'origin/master'

This commit is contained in:
Shaun Bennett 2014-10-24 19:43:06 -05:00
commit 6138da5f93
19 changed files with 84 additions and 306 deletions

View File

@ -1,6 +1,8 @@
package mineplex.core.common.util; package mineplex.core.common.util;
import org.bukkit.Color;
import org.bukkit.FireworkEffect; import org.bukkit.FireworkEffect;
import org.bukkit.FireworkEffect.Type;
import org.bukkit.Location; import org.bukkit.Location;
import org.bukkit.craftbukkit.v1_7_R4.CraftWorld; 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.CraftEntity;
@ -57,4 +59,9 @@ public class UtilFirework
firework.remove(); firework.remove();
} }
public static void playFirework(Location loc, Type type, Color color, boolean flicker, boolean trail)
{
playFirework(loc, FireworkEffect.builder().flicker(false).withColor(color).with(type).trail(false).build());
}
} }

View File

@ -40,6 +40,7 @@ import org.bukkit.inventory.ItemStack;
import org.bukkit.plugin.Plugin; import org.bukkit.plugin.Plugin;
import org.bukkit.plugin.java.JavaPlugin; import org.bukkit.plugin.java.JavaPlugin;
import mineplex.core.common.Rank;
import mineplex.core.common.util.C; import mineplex.core.common.util.C;
import mineplex.core.common.util.Callback; import mineplex.core.common.util.Callback;
import mineplex.core.common.util.F; import mineplex.core.common.util.F;
@ -525,41 +526,30 @@ public class MapParser extends JavaPlugin implements Listener
{ {
event.setQuitMessage(F.sys("Player Quit", event.getPlayer().getName())); event.setQuitMessage(F.sys("Player Quit", event.getPlayer().getName()));
} }
@EventHandler
public void damage(EntityDamageByEntityEvent event)
{
Entity ent = UtilEvent.GetDamagerEntity(event, false);
if (ent != null && ent instanceof Player)
System.out.println("DAMAGE");
}
@EventHandler
public void interactent(PlayerInteractEntityEvent event)
{
System.out.println("ENT INTERACT");
System.out.println(event.getPlayer().getTargetBlock(null, 0)); @EventHandler(priority = EventPriority.LOWEST)
} public void TeleportCommand(PlayerCommandPreprocessEvent event)
@EventHandler
public void interact(PlayerInteractEvent event)
{
System.out.println("INTERACT");
}
@EventHandler
public void debug(PlayerCommandPreprocessEvent event)
{ {
if (!event.getMessage().toLowerCase().startsWith("/tp"))
return;
event.setCancelled(true);
Player player = event.getPlayer(); Player player = event.getPlayer();
String[] tokens = event.getMessage().split(" ");
if (event.getMessage().contains("sheep")) if (tokens.length != 2)
{ {
player.setPassenger(player.getWorld().spawn(player.getLocation(), Sheep.class)); UtilPlayer.message(player, F.main("Game", "Invalid Input. " + F.elem("/tp <Name>") + "."));
return;
} }
if (event.getMessage().contains("drop"))
Player target = UtilPlayer.searchOnline(player, tokens[1], true);
if (target != null)
{ {
player.eject(); UtilPlayer.message(player, F.main("Game", "You teleported to " + F.name(target.getName()) + "."));
player.teleport(target);
} }
} }
} }

View File

@ -9,9 +9,12 @@ import java.util.UUID;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
import org.bukkit.ChatColor; import org.bukkit.ChatColor;
import org.bukkit.Color;
import org.bukkit.FireworkEffect;
import org.bukkit.GameMode; import org.bukkit.GameMode;
import org.bukkit.Material; import org.bukkit.Material;
import org.bukkit.OfflinePlayer; import org.bukkit.OfflinePlayer;
import org.bukkit.FireworkEffect.Type;
import org.bukkit.craftbukkit.v1_7_R4.entity.CraftEntity; import org.bukkit.craftbukkit.v1_7_R4.entity.CraftEntity;
import org.bukkit.craftbukkit.v1_7_R4.entity.CraftPlayer; import org.bukkit.craftbukkit.v1_7_R4.entity.CraftPlayer;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
@ -39,6 +42,7 @@ import mineplex.core.chat.Chat;
import mineplex.core.common.Rank; import mineplex.core.common.Rank;
import mineplex.core.common.util.C; import mineplex.core.common.util.C;
import mineplex.core.common.util.F; import mineplex.core.common.util.F;
import mineplex.core.common.util.UtilFirework;
import mineplex.core.common.util.UtilGear; import mineplex.core.common.util.UtilGear;
import mineplex.core.common.util.UtilInv; import mineplex.core.common.util.UtilInv;
import mineplex.core.common.util.UtilPlayer; import mineplex.core.common.util.UtilPlayer;
@ -63,6 +67,8 @@ import mineplex.core.status.ServerStatusManager;
import mineplex.core.task.TaskManager; import mineplex.core.task.TaskManager;
import mineplex.core.teleport.Teleport; import mineplex.core.teleport.Teleport;
import mineplex.core.timing.TimingManager; import mineplex.core.timing.TimingManager;
import mineplex.core.updater.UpdateType;
import mineplex.core.updater.event.UpdateEvent;
import mineplex.minecraft.game.classcombat.Class.ClassManager; import mineplex.minecraft.game.classcombat.Class.ClassManager;
import mineplex.minecraft.game.classcombat.Condition.SkillConditionManager; import mineplex.minecraft.game.classcombat.Condition.SkillConditionManager;
import mineplex.minecraft.game.classcombat.Skill.SkillFactory; import mineplex.minecraft.game.classcombat.Skill.SkillFactory;
@ -103,7 +109,6 @@ import nautilus.game.arcade.managers.HalloweenManager;
import nautilus.game.arcade.managers.IdleManager; import nautilus.game.arcade.managers.IdleManager;
import nautilus.game.arcade.managers.MiscManager; import nautilus.game.arcade.managers.MiscManager;
import nautilus.game.arcade.shop.ArcadeShop; import nautilus.game.arcade.shop.ArcadeShop;
import nautilus.game.arcade.world.FireworkHandler;
public class ArcadeManager extends MiniPlugin implements IRelation public class ArcadeManager extends MiniPlugin implements IRelation
{ {
@ -120,7 +125,6 @@ public class ArcadeManager extends MiniPlugin implements IRelation
private DamageManager _damageManager; private DamageManager _damageManager;
private Explosion _explosionManager; private Explosion _explosionManager;
private Fire _fire; private Fire _fire;
private FireworkHandler _firework;
private ProjectileManager _projectileManager; private ProjectileManager _projectileManager;
private Portal _portal; private Portal _portal;
@ -206,7 +210,6 @@ public class ArcadeManager extends MiniPlugin implements IRelation
_donationManager = donationManager; _donationManager = donationManager;
_firework = new FireworkHandler();
_fire = new Fire(plugin, _conditionManager, damageManager); _fire = new Fire(plugin, _conditionManager, damageManager);
_projectileManager = projectileManager; _projectileManager = projectileManager;
@ -359,12 +362,7 @@ public class ArcadeManager extends MiniPlugin implements IRelation
{ {
return _fire; return _fire;
} }
public FireworkHandler GetFirework()
{
return _firework;
}
public ProjectileManager GetProjectile() public ProjectileManager GetProjectile()
{ {
return _projectileManager; return _projectileManager;

View File

@ -44,6 +44,7 @@ import mineplex.core.common.util.C;
import mineplex.core.common.util.F; import mineplex.core.common.util.F;
import mineplex.core.common.util.UtilBlock; import mineplex.core.common.util.UtilBlock;
import mineplex.core.common.util.UtilEnt; import mineplex.core.common.util.UtilEnt;
import mineplex.core.common.util.UtilFirework;
import mineplex.core.common.util.UtilMath; import mineplex.core.common.util.UtilMath;
import mineplex.core.common.util.UtilPlayer; import mineplex.core.common.util.UtilPlayer;
import mineplex.core.common.util.UtilServer; import mineplex.core.common.util.UtilServer;
@ -771,16 +772,8 @@ public class CastleSiege extends TeamGame
continue; continue;
} }
FireworkEffect effect = FireworkEffect.builder().withColor(Color.RED).with(Type.BURST).build(); //Firework
UtilFirework.playFirework(player.getEyeLocation(), Type.BURST, Color.RED, false, false);
try
{
Manager.GetFirework().playFirework(player.getEyeLocation(), effect);
}
catch (Exception e)
{
e.printStackTrace();
}
} }
} }

View File

@ -28,6 +28,7 @@ import mineplex.core.common.util.C;
import mineplex.core.common.util.F; import mineplex.core.common.util.F;
import mineplex.core.common.util.NautHashMap; import mineplex.core.common.util.NautHashMap;
import mineplex.core.common.util.UtilBlock; import mineplex.core.common.util.UtilBlock;
import mineplex.core.common.util.UtilFirework;
import mineplex.core.common.util.UtilInv; import mineplex.core.common.util.UtilInv;
import mineplex.core.common.util.UtilMath; import mineplex.core.common.util.UtilMath;
import mineplex.core.common.util.UtilPlayer; import mineplex.core.common.util.UtilPlayer;
@ -489,17 +490,9 @@ public class DragonEscape extends SoloGame
UtilInv.Update(player); UtilInv.Update(player);
//Firework //Firework
FireworkEffect effect = FireworkEffect.builder().flicker(false).withColor(Color.BLACK).with(Type.BALL).trail(false).build(); UtilFirework.playFirework(player.getEyeLocation(), Type.BALL, Color.BLACK, false, false);
try player.getWorld().playSound(player.getLocation(), Sound.ZOMBIE_UNFECT, 2f, 2f);
{
Manager.GetFirework().playFirework(player.getEyeLocation(), effect);
player.getWorld().playSound(player.getLocation(), Sound.ZOMBIE_UNFECT, 2f, 2f);
}
catch (Exception e)
{
e.printStackTrace();
}
//Teleport //Teleport
player.teleport(target.getLocation().add(0, 0.5, 0)); player.teleport(target.getLocation().add(0, 0.5, 0));
player.setVelocity(new Vector(0,0,0)); player.setVelocity(new Vector(0,0,0));
@ -516,15 +509,8 @@ public class DragonEscape extends SoloGame
//Firework //Firework
try UtilFirework.playFirework(player.getEyeLocation(), Type.BALL, Color.BLACK, false, false);
{ player.getWorld().playSound(player.getLocation(), Sound.ZOMBIE_UNFECT, 2f, 2f);
Manager.GetFirework().playFirework(player.getEyeLocation(), effect);
player.getWorld().playSound(player.getLocation(), Sound.ZOMBIE_UNFECT, 2f, 2f);
}
catch (Exception e)
{
e.printStackTrace();
}
} }
else else
{ {

View File

@ -27,6 +27,7 @@ import mineplex.core.common.util.C;
import mineplex.core.common.util.F; import mineplex.core.common.util.F;
import mineplex.core.common.util.NautHashMap; import mineplex.core.common.util.NautHashMap;
import mineplex.core.common.util.UtilBlock; import mineplex.core.common.util.UtilBlock;
import mineplex.core.common.util.UtilFirework;
import mineplex.core.common.util.UtilInv; import mineplex.core.common.util.UtilInv;
import mineplex.core.common.util.UtilMath; import mineplex.core.common.util.UtilMath;
import mineplex.core.common.util.UtilPlayer; import mineplex.core.common.util.UtilPlayer;
@ -534,17 +535,9 @@ public class DragonEscapeTeams extends TeamGame
UtilInv.Update(player); UtilInv.Update(player);
//Firework //Firework
FireworkEffect effect = FireworkEffect.builder().flicker(false).withColor(Color.BLACK).with(Type.BALL).trail(false).build(); UtilFirework.playFirework(player.getEyeLocation(), Type.BALL, Color.BLACK, false, false);
try player.getWorld().playSound(player.getLocation(), Sound.ZOMBIE_UNFECT, 2f, 2f);
{
Manager.GetFirework().playFirework(player.getEyeLocation(), effect);
player.getWorld().playSound(player.getLocation(), Sound.ZOMBIE_UNFECT, 2f, 2f);
}
catch (Exception e)
{
e.printStackTrace();
}
//Teleport //Teleport
player.teleport(target.getLocation().add(0, 0.5, 0)); player.teleport(target.getLocation().add(0, 0.5, 0));
player.setVelocity(new Vector(0,0,0)); player.setVelocity(new Vector(0,0,0));
@ -561,15 +554,8 @@ public class DragonEscapeTeams extends TeamGame
//Firework //Firework
try UtilFirework.playFirework(player.getEyeLocation(), Type.BALL, Color.BLACK, false, false);
{ player.getWorld().playSound(player.getLocation(), Sound.ZOMBIE_UNFECT, 2f, 2f);
Manager.GetFirework().playFirework(player.getEyeLocation(), effect);
player.getWorld().playSound(player.getLocation(), Sound.ZOMBIE_UNFECT, 2f, 2f);
}
catch (Exception e)
{
e.printStackTrace();
}
} }
else else
{ {

View File

@ -14,6 +14,7 @@ import org.bukkit.scoreboard.DisplaySlot;
import org.bukkit.scoreboard.Objective; import org.bukkit.scoreboard.Objective;
import mineplex.core.common.util.C; import mineplex.core.common.util.C;
import mineplex.core.common.util.UtilFirework;
import mineplex.core.common.util.UtilPlayer; import mineplex.core.common.util.UtilPlayer;
import mineplex.core.recharge.Recharge; import mineplex.core.recharge.Recharge;
import mineplex.core.updater.UpdateType; import mineplex.core.updater.UpdateType;
@ -177,17 +178,8 @@ public class Evolution extends SoloGame
GetKits()[i].ApplyKit(player); GetKits()[i].ApplyKit(player);
//Firework //Firework
FireworkEffect effect = FireworkEffect.builder().flicker(false).withColor(Color.LIME).with(Type.BALL).trail(false).build(); UtilFirework.playFirework(player.getEyeLocation(), Type.BALL, Color.LIME, false, false);
try
{
Manager.GetFirework().playFirework(player.getEyeLocation(), effect);
}
catch (Exception e)
{
e.printStackTrace();
}
//Teleport //Teleport
player.teleport(GetTeam(player).GetSpawn()); player.teleport(GetTeam(player).GetSpawn());

View File

@ -17,6 +17,7 @@ import org.bukkit.util.Vector;
import mineplex.core.common.util.C; import mineplex.core.common.util.C;
import mineplex.core.common.util.F; import mineplex.core.common.util.F;
import mineplex.core.common.util.UtilBlock; import mineplex.core.common.util.UtilBlock;
import mineplex.core.common.util.UtilFirework;
import mineplex.core.common.util.UtilPlayer; import mineplex.core.common.util.UtilPlayer;
import mineplex.core.recharge.Recharge; import mineplex.core.recharge.Recharge;
import nautilus.game.arcade.kit.Perk; import nautilus.game.arcade.kit.Perk;
@ -100,30 +101,12 @@ public class PerkBlink extends Perk
if (curRange > 0) if (curRange > 0)
{ {
//Firework //Firework
FireworkEffect effect = FireworkEffect.builder().flicker(false).withColor(Color.BLACK).with(Type.BALL).trail(false).build(); UtilFirework.playFirework(player.getEyeLocation(), Type.BALL, Color.BLACK, false, false);
try
{
Manager.GetFirework().playFirework(player.getEyeLocation(), effect);
player.getWorld().playSound(player.getLocation(), Sound.ZOMBIE_UNFECT, 2f, 2f);
}
catch (Exception e)
{
e.printStackTrace();
}
player.teleport(loc); player.teleport(loc);
//Firework //Firework
try UtilFirework.playFirework(player.getEyeLocation(), Type.BALL, Color.BLACK, false, false);
{
Manager.GetFirework().playFirework(player.getEyeLocation(), effect);
player.getWorld().playSound(player.getLocation(), Sound.ZOMBIE_UNFECT, 2f, 2f);
}
catch (Exception e)
{
e.printStackTrace();
}
} }

View File

@ -23,6 +23,7 @@ import mineplex.core.common.util.UtilAction;
import mineplex.core.common.util.UtilAlg; import mineplex.core.common.util.UtilAlg;
import mineplex.core.common.util.UtilBlock; import mineplex.core.common.util.UtilBlock;
import mineplex.core.common.util.UtilEnt; import mineplex.core.common.util.UtilEnt;
import mineplex.core.common.util.UtilFirework;
import mineplex.core.common.util.UtilMath; import mineplex.core.common.util.UtilMath;
import mineplex.core.common.util.UtilPlayer; import mineplex.core.common.util.UtilPlayer;
import mineplex.core.common.util.UtilTime; import mineplex.core.common.util.UtilTime;
@ -180,16 +181,8 @@ public class PerkChickenRocket extends Perk
data.Chicken.getWorld().createExplosion(data.Chicken.getLocation(), 1.8f); data.Chicken.getWorld().createExplosion(data.Chicken.getLocation(), 1.8f);
//Firework //Firework
FireworkEffect effect = FireworkEffect.builder().flicker(false).withColor(Color.WHITE).with(Type.BALL).trail(false).build(); UtilFirework.playFirework(data.Chicken.getLocation().add(0, 0.6, 0), Type.BALL, Color.WHITE, false, false);
try
{
Manager.GetFirework().playFirework(data.Chicken.getLocation().add(0, 0.6, 0), effect);
}
catch (Exception e)
{
e.printStackTrace();
}
data.Chicken.remove(); data.Chicken.remove();
dataIterator.remove(); dataIterator.remove();

View File

@ -18,6 +18,7 @@ import org.bukkit.util.Vector;
import mineplex.core.common.util.C; import mineplex.core.common.util.C;
import mineplex.core.common.util.F; import mineplex.core.common.util.F;
import mineplex.core.common.util.UtilBlock; import mineplex.core.common.util.UtilBlock;
import mineplex.core.common.util.UtilFirework;
import mineplex.core.common.util.UtilPlayer; import mineplex.core.common.util.UtilPlayer;
import mineplex.core.common.util.UtilTime; import mineplex.core.common.util.UtilTime;
import mineplex.core.recharge.Recharge; import mineplex.core.recharge.Recharge;
@ -95,16 +96,7 @@ public class PerkFirefly extends Perk
if (_tick == 0) if (_tick == 0)
{ {
//Firework //Firework
FireworkEffect effect = FireworkEffect.builder().flicker(false).withColor(Color.ORANGE).with(Type.BURST).trail(false).build(); UtilFirework.playFirework(data.Player.getLocation().add(0, 0.6, 0), Type.BURST, Color.ORANGE, false, false);
try
{
Manager.GetFirework().playFirework(data.Player.getLocation(), effect);
}
catch (Exception e)
{
e.printStackTrace();
}
} }
} }
@ -118,19 +110,9 @@ public class PerkFirefly extends Perk
if (_tick == 0) if (_tick == 0)
{ {
//Firework //Firework
FireworkEffect effect = FireworkEffect.builder().flicker(false).withColor(Color.RED).with(Type.BURST).trail(false).build(); UtilFirework.playFirework(data.Player.getLocation().add(0, 0.6, 0), Type.BURST, Color.RED, false, false);
try
{
Manager.GetFirework().playFirework(data.Player.getLocation(), effect);
}
catch (Exception e)
{
e.printStackTrace();
}
} }
for (Player other : UtilPlayer.getNearby(data.Player.getLocation(), 3)) for (Player other : UtilPlayer.getNearby(data.Player.getLocation(), 3))
{ {
if (other.equals(data.Player)) if (other.equals(data.Player))

View File

@ -20,6 +20,7 @@ import mineplex.core.common.util.C;
import mineplex.core.common.util.F; import mineplex.core.common.util.F;
import mineplex.core.common.util.UtilBlock; import mineplex.core.common.util.UtilBlock;
import mineplex.core.common.util.UtilEnt; import mineplex.core.common.util.UtilEnt;
import mineplex.core.common.util.UtilFirework;
import mineplex.core.common.util.UtilMath; import mineplex.core.common.util.UtilMath;
import mineplex.core.common.util.UtilParticle; import mineplex.core.common.util.UtilParticle;
import mineplex.core.common.util.UtilPlayer; import mineplex.core.common.util.UtilPlayer;
@ -99,7 +100,7 @@ public class PerkLazer extends Perk
if (player.isBlocking()) if (player.isBlocking())
{ {
player.setExp(Math.min(0.999f, player.getExp() + 0.03f)); player.setExp(Math.min(0.999f, player.getExp() + 0.035f));
player.getWorld().playSound(player.getLocation(), Sound.FIZZ, 0.25f + player.getExp(), 0.75f + player.getExp()); player.getWorld().playSound(player.getLocation(), Sound.FIZZ, 0.25f + player.getExp(), 0.75f + player.getExp());
@ -182,16 +183,7 @@ public class PerkLazer extends Perk
UtilParticle.PlayParticle(ParticleType.EXPLODE, target, 0, 0, 0, 0, 1); UtilParticle.PlayParticle(ParticleType.EXPLODE, target, 0, 0, 0, 0, 1);
//Firework //Firework
FireworkEffect effect = FireworkEffect.builder().flicker(false).withColor(Color.YELLOW).with(Type.BALL).trail(false).build(); UtilFirework.playFirework(player.getLocation().add(player.getLocation().getDirection().multiply(Math.max(0, curRange - 0.6))), Type.BURST, Color.YELLOW, false, false);
try
{
Manager.GetFirework().playFirework(player.getEyeLocation(), effect);
}
catch (Exception e)
{
e.printStackTrace();
}
for (LivingEntity other : UtilEnt.getInRadius(target, 5).keySet()) for (LivingEntity other : UtilEnt.getInRadius(target, 5).keySet())
{ {

View File

@ -23,6 +23,7 @@ import org.bukkit.event.player.PlayerInteractEvent;
import mineplex.core.common.util.C; import mineplex.core.common.util.C;
import mineplex.core.common.util.F; import mineplex.core.common.util.F;
import mineplex.core.common.util.UtilAction; import mineplex.core.common.util.UtilAction;
import mineplex.core.common.util.UtilFirework;
import mineplex.core.common.util.UtilInv; import mineplex.core.common.util.UtilInv;
import mineplex.core.common.util.UtilPlayer; import mineplex.core.common.util.UtilPlayer;
import mineplex.core.common.util.UtilServer; import mineplex.core.common.util.UtilServer;
@ -196,16 +197,7 @@ public class PerkSparkler extends Perk
continue; continue;
} }
FireworkEffect effect = FireworkEffect.builder().withColor(Color.GREEN).with(Type.BURST).build(); UtilFirework.playFirework(item.getLocation(), Type.BURST, Color.GREEN, false, false);
try
{
Manager.GetFirework().playFirework(item.getLocation(), effect);
}
catch (Exception e)
{
e.printStackTrace();
}
} }
} }

View File

@ -85,11 +85,11 @@ public class PerkSquidRifle extends Perk implements IThrown
try try
{ {
Vector vel = player.getLocation().getDirection().multiply(1.8); Vector vel = player.getLocation().getDirection().multiply(1.8);
Firework fw = Manager.GetFirework().launchFirework(player.getEyeLocation().subtract(0, 0.5, 0).add(player.getLocation().getDirection()), effect, vel); //Firework fw = Manager.GetFirework().launchFirework(player.getEyeLocation().subtract(0, 0.5, 0).add(player.getLocation().getDirection()), effect, vel);
_fireworks.put(fw, vel); //_fireworks.put(fw, vel);
//Projectile //Projectile
Manager.GetProjectile().AddThrow(fw, player, this, -1, true, true, true, 3d, Manager.GetDisguise()); //Manager.GetProjectile().AddThrow(fw, player, this, -1, true, true, true, 3d, Manager.GetDisguise());
} }
catch (Exception e) catch (Exception e)
{ {
@ -165,7 +165,7 @@ public class PerkSquidRifle extends Perk implements IThrown
try try
{ {
Manager.GetFirework().detonateFirework(fw); //Manager.GetFirework().detonateFirework(fw);
} }
catch (Exception e) catch (Exception e)
{ {

View File

@ -92,11 +92,11 @@ public class PerkSquidShotgun extends Perk implements IThrown
try try
{ {
Vector vel = player.getLocation().getDirection().multiply(1.4).add(random); Vector vel = player.getLocation().getDirection().multiply(1.4).add(random);
Firework fw = Manager.GetFirework().launchFirework(player.getEyeLocation().subtract(0, 0.5, 0).add(player.getLocation().getDirection()), effect, vel); //Firework fw = Manager.GetFirework().launchFirework(player.getEyeLocation().subtract(0, 0.5, 0).add(player.getLocation().getDirection()), effect, vel);
_fireworks.put(fw, vel); //_fireworks.put(fw, vel);
//Projectile //Projectile
Manager.GetProjectile().AddThrow(fw, player, this, -1, true, true, true, 3d, Manager.GetDisguise()); //Manager.GetProjectile().AddThrow(fw, player, this, -1, true, true, true, 3d, Manager.GetDisguise());
} }
catch (Exception e) catch (Exception e)
{ {
@ -182,7 +182,7 @@ public class PerkSquidShotgun extends Perk implements IThrown
try try
{ {
Manager.GetFirework().detonateFirework(fw); //Manager.GetFirework().detonateFirework(fw);
} }
catch (Exception e) catch (Exception e)
{ {

View File

@ -85,11 +85,11 @@ public class PerkSquidSniper extends Perk implements IThrown
try try
{ {
Vector vel = player.getLocation().getDirection().multiply(3); Vector vel = player.getLocation().getDirection().multiply(3);
Firework fw = Manager.GetFirework().launchFirework(player.getEyeLocation().subtract(0, 0.5, 0).add(player.getLocation().getDirection()), effect, vel); //Firework fw = Manager.GetFirework().launchFirework(player.getEyeLocation().subtract(0, 0.5, 0).add(player.getLocation().getDirection()), effect, vel);
_fireworks.put(fw, vel); //_fireworks.put(fw, vel);
//Projectile //Projectile
Manager.GetProjectile().AddThrow(fw, player, this, -1, true, true, true, 3d, Manager.GetDisguise()); //Manager.GetProjectile().AddThrow(fw, player, this, -1, true, true, true, 3d, Manager.GetDisguise());
} }
catch (Exception e) catch (Exception e)
{ {
@ -173,7 +173,7 @@ public class PerkSquidSniper extends Perk implements IThrown
try try
{ {
Manager.GetFirework().detonateFirework(fw); //Manager.GetFirework().detonateFirework(fw);
} }
catch (Exception e) catch (Exception e)
{ {

View File

@ -4,7 +4,6 @@ import java.util.HashMap;
import mineplex.core.achievement.Achievement; import mineplex.core.achievement.Achievement;
import mineplex.core.common.util.C; import mineplex.core.common.util.C;
import mineplex.core.common.util.Callback;
import mineplex.core.common.util.F; import mineplex.core.common.util.F;
import mineplex.core.common.util.UtilPlayer; import mineplex.core.common.util.UtilPlayer;
import mineplex.core.common.util.UtilServer; import mineplex.core.common.util.UtilServer;

View File

@ -44,6 +44,7 @@ import mineplex.core.common.util.F;
import mineplex.core.common.util.MapUtil; import mineplex.core.common.util.MapUtil;
import mineplex.core.common.util.NautHashMap; import mineplex.core.common.util.NautHashMap;
import mineplex.core.common.util.UtilEnt; import mineplex.core.common.util.UtilEnt;
import mineplex.core.common.util.UtilFirework;
import mineplex.core.common.util.UtilInv; import mineplex.core.common.util.UtilInv;
import mineplex.core.common.util.UtilPlayer; import mineplex.core.common.util.UtilPlayer;
import mineplex.core.common.util.UtilServer; import mineplex.core.common.util.UtilServer;
@ -861,17 +862,8 @@ public class GameLobbyManager implements Listener, IPacketHandler
if (UtilTime.elapsed(_fireworkStart, 10000)) if (UtilTime.elapsed(_fireworkStart, 10000))
return; return;
FireworkEffect effect = FireworkEffect.builder().flicker(false).withColor(_fireworkColor).with(Type.BALL_LARGE).trail(false).build(); UtilFirework.playFirework(spawn.clone().add(Math.random()*160-80, 30 + Math.random()*10, Math.random()*160-80),
Type.BALL_LARGE, _fireworkColor, false, false);
try
{
Manager.GetFirework().playFirework(spawn.clone().add(
Math.random()*160-80, 30 + Math.random()*10, Math.random()*160-80), effect);
}
catch (Exception e)
{
e.printStackTrace();
}
} }
@EventHandler @EventHandler

View File

@ -7,6 +7,7 @@ import mineplex.core.common.util.C;
import mineplex.core.common.util.F; import mineplex.core.common.util.F;
import mineplex.core.common.util.UtilAlg; import mineplex.core.common.util.UtilAlg;
import mineplex.core.common.util.UtilDisplay; import mineplex.core.common.util.UtilDisplay;
import mineplex.core.common.util.UtilFirework;
import mineplex.core.common.util.UtilInv; import mineplex.core.common.util.UtilInv;
import mineplex.core.common.util.UtilPlayer; import mineplex.core.common.util.UtilPlayer;
import mineplex.core.common.util.UtilServer; import mineplex.core.common.util.UtilServer;
@ -33,6 +34,7 @@ import org.bukkit.ChatColor;
import org.bukkit.Color; import org.bukkit.Color;
import org.bukkit.FireworkEffect; import org.bukkit.FireworkEffect;
import org.bukkit.GameMode; import org.bukkit.GameMode;
import org.bukkit.Location;
import org.bukkit.Sound; import org.bukkit.Sound;
import org.bukkit.FireworkEffect.Type; import org.bukkit.FireworkEffect.Type;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
@ -629,18 +631,10 @@ public class GameManager implements Listener
else if (game.WinnerTeam.GetColor() == ChatColor.YELLOW) color = Color.YELLOW; else if (game.WinnerTeam.GetColor() == ChatColor.YELLOW) color = Color.YELLOW;
else color = Color.LIME; else color = Color.LIME;
} }
Location loc = game.GetSpectatorLocation().clone().add(Math.random()*160-80, 10 + Math.random()*20, Math.random()*160-80);
FireworkEffect effect = FireworkEffect.builder().flicker(false).withColor(color).with(Type.BALL_LARGE).trail(false).build(); UtilFirework.playFirework(loc, Type.BALL_LARGE, color, false, false);
try
{
Manager.GetFirework().playFirework(game.GetSpectatorLocation().clone().add(
Math.random()*160-80, 10 + Math.random()*20, Math.random()*160-80), effect);
}
catch (Exception e)
{
e.printStackTrace();
}
} }
@EventHandler(priority = EventPriority.MONITOR) @EventHandler(priority = EventPriority.MONITOR)

View File

@ -1,101 +0,0 @@
package nautilus.game.arcade.world;
import java.lang.reflect.Method;
import org.bukkit.FireworkEffect;
import org.bukkit.Location;
import org.bukkit.entity.Firework;
import org.bukkit.inventory.meta.FireworkMeta;
import org.bukkit.util.Vector;
public class FireworkHandler
{
private Method world_getHandle = null;
private Method nms_world_broadcastEntityEffect = null;
private Method firework_getHandle = null;
public void playFirework(Location loc, FireworkEffect fe) throws Exception
{
Firework fw = (Firework) loc.getWorld().spawn(loc, Firework.class);
Object nms_world = null;
Object nms_firework = null;
if(world_getHandle == null)
{
world_getHandle = getMethod(loc.getWorld().getClass(), "getHandle");
firework_getHandle = getMethod(fw.getClass(), "getHandle");
}
nms_world = world_getHandle.invoke(loc.getWorld(), (Object[]) null);
nms_firework = firework_getHandle.invoke(fw, (Object[]) null);
if(nms_world_broadcastEntityEffect == null)
{
nms_world_broadcastEntityEffect = getMethod(nms_world.getClass(), "broadcastEntityEffect");
}
FireworkMeta data = (FireworkMeta) fw.getFireworkMeta();
data.clearEffects();
data.setPower(1);
data.addEffect(fe);
fw.setFireworkMeta(data);
nms_world_broadcastEntityEffect.invoke(nms_world, new Object[] {nms_firework, (byte) 17});
fw.remove();
}
private static Method getMethod(Class<?> cl, String method)
{
for(Method m : cl.getMethods())
{
if(m.getName().equals(method))
{
return m;
}
}
return null;
}
public Firework launchFirework(Location loc, FireworkEffect fe, Vector dir) throws Exception
{
Firework fw = (Firework) loc.getWorld().spawn(loc, Firework.class);
FireworkMeta data = (FireworkMeta) fw.getFireworkMeta();
data.clearEffects();
data.setPower(1);
data.addEffect(fe);
fw.setFireworkMeta(data);
fw.setVelocity(dir);
return fw;
}
public void detonateFirework(Firework fw) throws Exception
{
Object nms_world = null;
Object nms_firework = null;
if(world_getHandle == null)
{
world_getHandle = getMethod(fw.getWorld().getClass(), "getHandle");
firework_getHandle = getMethod(fw.getClass(), "getHandle");
}
nms_world = world_getHandle.invoke(fw.getWorld(), (Object[]) null);
nms_firework = firework_getHandle.invoke(fw, (Object[]) null);
if(nms_world_broadcastEntityEffect == null)
{
nms_world_broadcastEntityEffect = getMethod(nms_world.getClass(), "broadcastEntityEffect");
}
nms_world_broadcastEntityEffect.invoke(nms_world, new Object[] {nms_firework, (byte) 17});
fw.remove();
}
}