Fixed Fireworks crash bug & portal destroy bug;
-Only livingentities bounce off portals -Fireworks cannot be used near portals
This commit is contained in:
parent
d5c96f95c0
commit
1bfa24cc45
@ -2,13 +2,16 @@ package mineplex.hub.gadget.gadgets;
|
|||||||
|
|
||||||
import org.bukkit.Color;
|
import org.bukkit.Color;
|
||||||
import org.bukkit.FireworkEffect;
|
import org.bukkit.FireworkEffect;
|
||||||
|
import org.bukkit.Location;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
import org.bukkit.FireworkEffect.Type;
|
import org.bukkit.FireworkEffect.Type;
|
||||||
|
import org.bukkit.block.Block;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.util.Vector;
|
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.UtilFirework;
|
import mineplex.core.common.util.UtilFirework;
|
||||||
import mineplex.core.common.util.UtilPlayer;
|
import mineplex.core.common.util.UtilPlayer;
|
||||||
import mineplex.hub.gadget.GadgetManager;
|
import mineplex.hub.gadget.GadgetManager;
|
||||||
@ -44,6 +47,18 @@ public class ItemFirework extends ItemGadget
|
|||||||
@Override
|
@Override
|
||||||
public void ActivateCustom(Player player)
|
public void ActivateCustom(Player player)
|
||||||
{
|
{
|
||||||
|
Location loc = player.getEyeLocation().add(player.getLocation().getDirection());
|
||||||
|
|
||||||
|
//Portal Disallow
|
||||||
|
for (Block block : UtilBlock.getSurrounding(loc.getBlock(), true))
|
||||||
|
{
|
||||||
|
if (block.getTypeId() == 90)
|
||||||
|
{
|
||||||
|
UtilPlayer.message(player, F.main("Skill", "You cannot use " + F.skill(GetName()) + " near Portals."));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//Inform
|
//Inform
|
||||||
UtilPlayer.message(player, F.main("Skill", "You used " + F.skill(GetName()) + "."));
|
UtilPlayer.message(player, F.main("Skill", "You used " + F.skill(GetName()) + "."));
|
||||||
|
|
||||||
@ -66,7 +81,7 @@ public class ItemFirework extends ItemGadget
|
|||||||
if (r > 0.66) type = Type.BALL;
|
if (r > 0.66) type = Type.BALL;
|
||||||
else if (r > 0.33) type = Type.BALL_LARGE;
|
else if (r > 0.33) type = Type.BALL_LARGE;
|
||||||
|
|
||||||
UtilFirework.launchFirework(player.getEyeLocation().add(player.getLocation().getDirection()),
|
UtilFirework.launchFirework(loc,
|
||||||
FireworkEffect.builder().flicker(Math.random() > 0.5).withColor(color).with(type).trail(Math.random() > 0.5).build(),
|
FireworkEffect.builder().flicker(Math.random() > 0.5).withColor(color).with(type).trail(Math.random() > 0.5).build(),
|
||||||
new Vector(0,0,0), 0 + (int)(Math.random()*3));
|
new Vector(0,0,0), 0 + (int)(Math.random()*3));
|
||||||
}
|
}
|
||||||
|
@ -36,7 +36,7 @@ public class ItemPaintballGun extends ItemGadget
|
|||||||
},
|
},
|
||||||
-1,
|
-1,
|
||||||
Material.GOLD_BARDING, (byte)0,
|
Material.GOLD_BARDING, (byte)0,
|
||||||
500, 2, false);
|
200, 2, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -16,6 +16,7 @@ import org.bukkit.Bukkit;
|
|||||||
import org.bukkit.ChatColor;
|
import org.bukkit.ChatColor;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
import org.bukkit.Sound;
|
import org.bukkit.Sound;
|
||||||
|
import org.bukkit.entity.LivingEntity;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.event.EventHandler;
|
import org.bukkit.event.EventHandler;
|
||||||
import org.bukkit.event.EventPriority;
|
import org.bukkit.event.EventPriority;
|
||||||
@ -125,7 +126,9 @@ public class ServerManager extends MiniPlugin
|
|||||||
{
|
{
|
||||||
if (!(event.getEntity() instanceof Player))
|
if (!(event.getEntity() instanceof Player))
|
||||||
{
|
{
|
||||||
|
if (event.getEntity() instanceof LivingEntity)
|
||||||
UtilAction.velocity(event.getEntity(), UtilAlg.getTrajectory(event.getEntity().getLocation(), _hubManager.GetSpawn()), 1, true, 0.8, 0, 1, true);
|
UtilAction.velocity(event.getEntity(), UtilAlg.getTrajectory(event.getEntity().getLocation(), _hubManager.GetSpawn()), 1, true, 0.8, 0, 1, true);
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user