Merge branch 'master' of ssh://184.154.0.242:7999/min/Mineplex

This commit is contained in:
Jonathan Williams 2014-10-24 18:00:18 -07:00
commit 6f541a8d30
23 changed files with 217 additions and 337 deletions

View File

@ -1,6 +1,8 @@
package mineplex.core.common.util;
import org.bukkit.Color;
import org.bukkit.FireworkEffect;
import org.bukkit.FireworkEffect.Type;
import org.bukkit.Location;
import org.bukkit.craftbukkit.v1_7_R4.CraftWorld;
import org.bukkit.craftbukkit.v1_7_R4.entity.CraftEntity;
@ -57,4 +59,9 @@ public class UtilFirework
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

@ -6,6 +6,7 @@ import java.util.List;
import mineplex.core.common.DummyEntity;
import mineplex.core.common.util.NautHashMap;
import mineplex.core.event.CustomTagEvent;
import mineplex.core.packethandler.IPacketHandler;
import mineplex.core.common.util.UtilEnt;
import mineplex.core.packethandler.PacketHandler;
@ -334,8 +335,12 @@ public class CustomTagFix extends MiniPlugin implements IPacketHandler
}
}
private void sendProtocolPackets(final Player owner, final int entityId, final int newEntityId, final String entityName, final PacketVerifier packetList)
private void sendProtocolPackets(final Player owner, final int entityId, final int newEntityId, String entityName, final PacketVerifier packetList)
{
CustomTagEvent event = new CustomTagEvent(owner, entityId, entityName);
_plugin.getServer().getPluginManager().callEvent(event);
final String finalEntityName = event.getCustomName();
Bukkit.getServer().getScheduler().scheduleSyncDelayedTask(GetPlugin(), new Runnable()
{
public void run()
@ -412,7 +417,7 @@ public class CustomTagFix extends MiniPlugin implements IPacketHandler
watcher.watch(10, Byte.valueOf(b1));
watcher.watch(2, entityName);
watcher.watch(2, finalEntityName);
watcher.watch(3, Byte.valueOf((byte)1));
packet.l = watcher;

View File

@ -0,0 +1,55 @@
package mineplex.core.event;
import org.bukkit.entity.Entity;
import org.bukkit.entity.Player;
import org.bukkit.event.Event;
import org.bukkit.event.HandlerList;
/**
* Created by Shaun on 10/24/2014.
*/
public class CustomTagEvent extends Event
{
private static final HandlerList handlers = new HandlerList();
private Player _player;
private int _entityId;
private String _customName;
public CustomTagEvent(Player player, int entityId, String customName)
{
_player = player;
_entityId = entityId;
_customName = customName;
}
public Player getPlayer()
{
return _player;
}
public String getCustomName()
{
return _customName;
}
public void setCustomName(String customName)
{
_customName = customName;
}
public HandlerList getHandlers()
{
return handlers;
}
public static HandlerList getHandlerList()
{
return handlers;
}
public int getEntityId()
{
return _entityId;
}
}

View File

@ -21,6 +21,7 @@ import org.bukkit.event.player.PlayerInteractEvent;
import org.bukkit.event.player.PlayerQuitEvent;
import org.bukkit.event.player.PlayerVelocityEvent;
import org.bukkit.potion.PotionEffectType;
import org.bukkit.util.Vector;
import mineplex.core.MiniPlugin;
import mineplex.core.common.util.C;
@ -120,6 +121,8 @@ public class ParkourManager extends MiniPlugin
UtilPlayer.message(player, F.main("Parkour", "You have entered " + F.elem("Parkour Mode") + "."));
Manager.GetGadget().DisableAll(player);
player.setVelocity(new Vector(0,-1,0));
}
else
{

View File

@ -40,6 +40,7 @@ import org.bukkit.inventory.ItemStack;
import org.bukkit.plugin.Plugin;
import org.bukkit.plugin.java.JavaPlugin;
import mineplex.core.common.Rank;
import mineplex.core.common.util.C;
import mineplex.core.common.util.Callback;
import mineplex.core.common.util.F;
@ -526,40 +527,29 @@ public class MapParser extends JavaPlugin implements Listener
event.setQuitMessage(F.sys("Player Quit", event.getPlayer().getName()));
}
@EventHandler
public void damage(EntityDamageByEntityEvent event)
@EventHandler(priority = EventPriority.LOWEST)
public void TeleportCommand(PlayerCommandPreprocessEvent event)
{
Entity ent = UtilEvent.GetDamagerEntity(event, false);
if (ent != null && ent instanceof Player)
System.out.println("DAMAGE");
}
if (!event.getMessage().toLowerCase().startsWith("/tp"))
return;
@EventHandler
public void interactent(PlayerInteractEntityEvent event)
{
System.out.println("ENT INTERACT");
event.setCancelled(true);
System.out.println(event.getPlayer().getTargetBlock(null, 0));
}
@EventHandler
public void interact(PlayerInteractEvent event)
{
System.out.println("INTERACT");
}
@EventHandler
public void debug(PlayerCommandPreprocessEvent event)
{
Player player = event.getPlayer();
if (event.getMessage().contains("sheep"))
String[] tokens = event.getMessage().split(" ");
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.ChatColor;
import org.bukkit.Color;
import org.bukkit.FireworkEffect;
import org.bukkit.GameMode;
import org.bukkit.Material;
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.CraftPlayer;
import org.bukkit.entity.Player;
@ -39,6 +42,7 @@ import mineplex.core.chat.Chat;
import mineplex.core.common.Rank;
import mineplex.core.common.util.C;
import mineplex.core.common.util.F;
import mineplex.core.common.util.UtilFirework;
import mineplex.core.common.util.UtilGear;
import mineplex.core.common.util.UtilInv;
import mineplex.core.common.util.UtilPlayer;
@ -63,6 +67,8 @@ import mineplex.core.status.ServerStatusManager;
import mineplex.core.task.TaskManager;
import mineplex.core.teleport.Teleport;
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.Condition.SkillConditionManager;
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.MiscManager;
import nautilus.game.arcade.shop.ArcadeShop;
import nautilus.game.arcade.world.FireworkHandler;
public class ArcadeManager extends MiniPlugin implements IRelation
{
@ -120,7 +125,6 @@ public class ArcadeManager extends MiniPlugin implements IRelation
private DamageManager _damageManager;
private Explosion _explosionManager;
private Fire _fire;
private FireworkHandler _firework;
private ProjectileManager _projectileManager;
private Portal _portal;
@ -206,7 +210,6 @@ public class ArcadeManager extends MiniPlugin implements IRelation
_donationManager = donationManager;
_firework = new FireworkHandler();
_fire = new Fire(plugin, _conditionManager, damageManager);
_projectileManager = projectileManager;
@ -360,11 +363,6 @@ public class ArcadeManager extends MiniPlugin implements IRelation
return _fire;
}
public FireworkHandler GetFirework()
{
return _firework;
}
public ProjectileManager GetProjectile()
{
return _projectileManager;
@ -709,18 +707,6 @@ public class ArcadeManager extends MiniPlugin implements IRelation
GetDisguise().undisguise(player);
}
public void RefreshPlayers()
{
for (Player player : UtilServer.getPlayers())
{
for (Player other : UtilServer.getPlayers())
{
player.hidePlayer(other);
player.showPlayer(other);
}
}
}
public ArrayList<String> LoadFiles(String gameName)
{
TimingManager.start("ArcadeManager LoadFiles");

View File

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

View File

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

View File

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

View File

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

View File

@ -5,6 +5,7 @@ import org.bukkit.entity.EntityType;
import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;
import mineplex.core.achievement.Achievement;
import nautilus.game.arcade.ArcadeManager;
import nautilus.game.arcade.kit.Kit;
import nautilus.game.arcade.kit.KitAvailability;
@ -29,6 +30,14 @@ public class KitHorseman extends Kit
EntityType.HORSE,
new ItemStack(Material.DIAMOND_BARDING));
this.setAchievementRequirements(new Achievement[]
{
Achievement.SURVIVAL_GAMES_BLOODLUST,
Achievement.SURVIVAL_GAMES_LIGHT_WEIGHT,
Achievement.SURVIVAL_GAMES_LOOT,
Achievement.SURVIVAL_GAMES_SKELETONS,
Achievement.SURVIVAL_GAMES_WINS,
});
}
@Override

View File

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

View File

@ -23,6 +23,7 @@ import mineplex.core.common.util.UtilAction;
import mineplex.core.common.util.UtilAlg;
import mineplex.core.common.util.UtilBlock;
import mineplex.core.common.util.UtilEnt;
import mineplex.core.common.util.UtilFirework;
import mineplex.core.common.util.UtilMath;
import mineplex.core.common.util.UtilPlayer;
import mineplex.core.common.util.UtilTime;
@ -180,16 +181,8 @@ public class PerkChickenRocket extends Perk
data.Chicken.getWorld().createExplosion(data.Chicken.getLocation(), 1.8f);
//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();
dataIterator.remove();

View File

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

View File

@ -20,6 +20,7 @@ import mineplex.core.common.util.C;
import mineplex.core.common.util.F;
import mineplex.core.common.util.UtilBlock;
import mineplex.core.common.util.UtilEnt;
import mineplex.core.common.util.UtilFirework;
import mineplex.core.common.util.UtilMath;
import mineplex.core.common.util.UtilParticle;
import mineplex.core.common.util.UtilPlayer;
@ -99,7 +100,7 @@ public class PerkLazer extends Perk
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());
@ -182,16 +183,7 @@ public class PerkLazer extends Perk
UtilParticle.PlayParticle(ParticleType.EXPLODE, target, 0, 0, 0, 0, 1);
//Firework
FireworkEffect effect = FireworkEffect.builder().flicker(false).withColor(Color.RED).with(Type.BALL).trail(false).build();
try
{
Manager.GetFirework().playFirework(player.getEyeLocation(), effect);
}
catch (Exception e)
{
e.printStackTrace();
}
UtilFirework.playFirework(player.getLocation().add(player.getLocation().getDirection().multiply(Math.max(0, curRange - 0.6))), Type.BURST, Color.YELLOW, false, false);
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.F;
import mineplex.core.common.util.UtilAction;
import mineplex.core.common.util.UtilFirework;
import mineplex.core.common.util.UtilInv;
import mineplex.core.common.util.UtilPlayer;
import mineplex.core.common.util.UtilServer;
@ -196,16 +197,7 @@ public class PerkSparkler extends Perk
continue;
}
FireworkEffect effect = FireworkEffect.builder().withColor(Color.GREEN).with(Type.BURST).build();
try
{
Manager.GetFirework().playFirework(item.getLocation(), effect);
}
catch (Exception e)
{
e.printStackTrace();
}
UtilFirework.playFirework(item.getLocation(), Type.BURST, Color.GREEN, false, false);
}
}

View File

@ -85,11 +85,11 @@ public class PerkSquidRifle extends Perk implements IThrown
try
{
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);
_fireworks.put(fw, vel);
//Firework fw = Manager.GetFirework().launchFirework(player.getEyeLocation().subtract(0, 0.5, 0).add(player.getLocation().getDirection()), effect, vel);
//_fireworks.put(fw, vel);
//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)
{
@ -165,7 +165,7 @@ public class PerkSquidRifle extends Perk implements IThrown
try
{
Manager.GetFirework().detonateFirework(fw);
//Manager.GetFirework().detonateFirework(fw);
}
catch (Exception e)
{

View File

@ -92,11 +92,11 @@ public class PerkSquidShotgun extends Perk implements IThrown
try
{
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);
_fireworks.put(fw, vel);
//Firework fw = Manager.GetFirework().launchFirework(player.getEyeLocation().subtract(0, 0.5, 0).add(player.getLocation().getDirection()), effect, vel);
//_fireworks.put(fw, vel);
//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)
{
@ -182,7 +182,7 @@ public class PerkSquidShotgun extends Perk implements IThrown
try
{
Manager.GetFirework().detonateFirework(fw);
//Manager.GetFirework().detonateFirework(fw);
}
catch (Exception e)
{

View File

@ -85,11 +85,11 @@ public class PerkSquidSniper extends Perk implements IThrown
try
{
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);
_fireworks.put(fw, vel);
//Firework fw = Manager.GetFirework().launchFirework(player.getEyeLocation().subtract(0, 0.5, 0).add(player.getLocation().getDirection()), effect, vel);
//_fireworks.put(fw, vel);
//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)
{
@ -173,7 +173,7 @@ public class PerkSquidSniper extends Perk implements IThrown
try
{
Manager.GetFirework().detonateFirework(fw);
//Manager.GetFirework().detonateFirework(fw);
}
catch (Exception e)
{

View File

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

View File

@ -44,7 +44,9 @@ import mineplex.core.common.util.F;
import mineplex.core.common.util.MapUtil;
import mineplex.core.common.util.NautHashMap;
import mineplex.core.common.util.UtilEnt;
import mineplex.core.common.util.UtilFirework;
import mineplex.core.common.util.UtilInv;
import mineplex.core.common.util.UtilPlayer;
import mineplex.core.common.util.UtilServer;
import mineplex.core.common.util.UtilText;
import mineplex.core.common.util.UtilText.TextAlign;
@ -52,6 +54,7 @@ import mineplex.core.common.util.UtilTime;
import mineplex.core.common.util.UtilWorld;
import mineplex.core.cosmetic.event.ActivateGemBoosterEvent;
import mineplex.core.donation.Donor;
import mineplex.core.event.CustomTagEvent;
import mineplex.core.packethandler.IPacketHandler;
import mineplex.core.packethandler.PacketHandler;
import mineplex.core.packethandler.PacketVerifier;
@ -69,7 +72,9 @@ import nautilus.game.arcade.kit.Kit;
import nautilus.game.arcade.kit.KitAvailability;
import nautilus.game.arcade.kit.KitSorter;
import net.minecraft.server.v1_7_R4.Packet;
import net.minecraft.server.v1_7_R4.PacketPlayOutEntityMetadata;
import net.minecraft.server.v1_7_R4.PacketPlayOutSpawnEntityLiving;
import net.minecraft.server.v1_7_R4.WatchableObject;
public class GameLobbyManager implements Listener, IPacketHandler
{
@ -857,17 +862,8 @@ public class GameLobbyManager implements Listener, IPacketHandler
if (UtilTime.elapsed(_fireworkStart, 10000))
return;
FireworkEffect effect = FireworkEffect.builder().flicker(false).withColor(_fireworkColor).with(Type.BALL_LARGE).trail(false).build();
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();
}
UtilFirework.playFirework(spawn.clone().add(Math.random()*160-80, 30 + Math.random()*10, Math.random()*160-80),
Type.BALL_LARGE, _fireworkColor, false, false);
}
@EventHandler
@ -1087,10 +1083,36 @@ public class GameLobbyManager implements Listener, IPacketHandler
return entityName;
}
@EventHandler
public void customEntityName(CustomTagEvent event)
{
// TODO: This needs to be changed when removing CustomTagFix
if (Manager.GetGame() != null)
{
String customName = null;
for (LobbyEnt ent : _kits.values())
{
if (ent.GetEnt().getEntityId() == event.getEntityId())
{
customName = GetKitCustomName(event.getPlayer(), Manager.GetGame(), ent);
break;
}
}
if (customName != null)
{
event.setCustomName(customName);
}
}
}
@SuppressWarnings("unchecked")
public void handle(PacketInfo packetInfo)
{
if (_handlingPacket)
// This only applies to 1.7 clients currently, 1.8 custom names are handled by customEntityName(CustomTagEvent event)
if (_handlingPacket || UtilPlayer.is1_8(packetInfo.getPlayer()))
return;
Packet packet = packetInfo.getPacket();
@ -1099,9 +1121,9 @@ public class GameLobbyManager implements Listener, IPacketHandler
int entityId = -1;
if (packet instanceof PacketPlayOutSpawnEntityLiving)
if (packet instanceof PacketPlayOutEntityMetadata)
{
entityId = ((PacketPlayOutSpawnEntityLiving)packet).a;
entityId = ((PacketPlayOutEntityMetadata)packet).a;
}
if (entityId != -1)
@ -1122,10 +1144,31 @@ public class GameLobbyManager implements Listener, IPacketHandler
{
try
{
if (packet instanceof PacketPlayOutSpawnEntityLiving)
if (packet instanceof PacketPlayOutEntityMetadata)
{
((PacketPlayOutSpawnEntityLiving)packet).l.watch(2, customName);
((PacketPlayOutSpawnEntityLiving)packet).l.watch(10, customName);
List<WatchableObject> watchables = new ArrayList<WatchableObject>();
for (WatchableObject watchableObject : (List<WatchableObject>)((PacketPlayOutEntityMetadata) packet).b)
{
WatchableObject newWatch = new WatchableObject(watchableObject.c(), watchableObject.a(), watchableObject.b());
if (newWatch.a() == 10)
{
newWatch.a(customName);
}
watchables.add(newWatch);
}
PacketPlayOutEntityMetadata newPacket = new PacketPlayOutEntityMetadata();
newPacket.a = entityId;
newPacket.b = watchables;
_handlingPacket = true;
packetVerifier.process(newPacket);
_handlingPacket = false;
packetInfo.setCancelled(true);
}
}
catch (IllegalArgumentException e)

View File

@ -7,6 +7,7 @@ import mineplex.core.common.util.C;
import mineplex.core.common.util.F;
import mineplex.core.common.util.UtilAlg;
import mineplex.core.common.util.UtilDisplay;
import mineplex.core.common.util.UtilFirework;
import mineplex.core.common.util.UtilInv;
import mineplex.core.common.util.UtilPlayer;
import mineplex.core.common.util.UtilServer;
@ -33,6 +34,7 @@ import org.bukkit.ChatColor;
import org.bukkit.Color;
import org.bukkit.FireworkEffect;
import org.bukkit.GameMode;
import org.bukkit.Location;
import org.bukkit.Sound;
import org.bukkit.FireworkEffect.Type;
import org.bukkit.entity.Player;
@ -260,15 +262,6 @@ public class GameManager implements Listener
event.setCancelled(true);
}
@EventHandler
public void VisibilityRefresh(GameStateChangeEvent event)
{
if (event.GetState() != GameState.Live)
return;
Manager.RefreshPlayers();
}
@EventHandler
public void KitRegister(GameStateChangeEvent event)
{
@ -639,17 +632,9 @@ public class GameManager implements Listener
else color = Color.LIME;
}
FireworkEffect effect = FireworkEffect.builder().flicker(false).withColor(color).with(Type.BALL_LARGE).trail(false).build();
Location loc = game.GetSpectatorLocation().clone().add(Math.random()*160-80, 10 + Math.random()*20, Math.random()*160-80);
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();
}
UtilFirework.playFirework(loc, Type.BALL_LARGE, color, false, false);
}
@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();
}
}