Merge remote-tracking branch 'remotes/origin/mrsomeone12_SmallFixes'
This commit is contained in:
commit
963caae719
@ -532,9 +532,14 @@ public class UtilEnt
|
||||
|
||||
public static boolean isGrounded(Entity ent)
|
||||
{
|
||||
AxisAlignedBB box = ((CraftEntity)ent).getHandle().getBoundingBox();
|
||||
Location bottom_corner_1 = new Location(ent.getWorld(), box.a, ent.getLocation().getY()-0.1, box.c);
|
||||
Location bottom_corner_2 = new Location(ent.getWorld(), box.d, ent.getLocation().getY()-0.1, box.f);
|
||||
|
||||
if(!(ent instanceof Player)) {
|
||||
return ent.isOnGround();
|
||||
}
|
||||
|
||||
AxisAlignedBB box = ((CraftEntity)ent).getHandle().getBoundingBox().shrink(0.05, 0, 0.05);
|
||||
Location bottom_corner_1 = new Location(ent.getWorld(), box.a, ent.getLocation().getY()-0.05, box.c);
|
||||
Location bottom_corner_2 = new Location(ent.getWorld(), box.d, ent.getLocation().getY()-0.05, box.f);
|
||||
|
||||
for(Block b : UtilBlock.getInBoundingBox(bottom_corner_1, bottom_corner_2)){
|
||||
if(UtilBlock.solid(b)) return true;
|
||||
|
@ -1,14 +1,12 @@
|
||||
package mineplex.core.common.util;
|
||||
|
||||
import java.lang.reflect.Field;
|
||||
|
||||
import mineplex.core.common.util.UtilParticle.ViewDist;
|
||||
import net.minecraft.server.v1_8_R3.EnumParticle;
|
||||
import net.minecraft.server.v1_8_R3.PacketPlayOutWorldParticles;
|
||||
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.util.Vector;
|
||||
|
||||
import net.minecraft.server.v1_8_R3.EnumParticle;
|
||||
import net.minecraft.server.v1_8_R3.PacketPlayOutWorldParticles;
|
||||
|
||||
public class UtilParticle
|
||||
{
|
||||
@ -249,6 +247,22 @@ public class UtilParticle
|
||||
PlayParticle(type, location, offsetX, offsetY, offsetZ, speed, count, dist, UtilServer.getPlayers());
|
||||
}
|
||||
|
||||
public static void PlayParticleToAll(ParticleType type, Location location, Vector offset, float speed, int count, ViewDist dist)
|
||||
{
|
||||
PlayParticle(type, location, (float) offset.getX(), (float) offset.getY(), (float) offset.getZ(), speed, count, dist, UtilServer.getPlayers());
|
||||
}
|
||||
|
||||
public static void PlayParticle(ParticleType type, Location location, Vector offset, float speed, int count, ViewDist dist, Player... players)
|
||||
{
|
||||
PlayParticle(type, location, (float) offset.getX(), (float) offset.getY(), (float) offset.getZ(), speed, count, dist, players);
|
||||
}
|
||||
|
||||
public static void PlayParticleToAll(ParticleType type, Location location, float offsetX, float offsetY, float offsetZ,
|
||||
float speed, int count, ViewDist dist)
|
||||
{
|
||||
PlayParticle(type.particleName, location, offsetX, offsetY, offsetZ, speed, count, dist, UtilServer.getPlayers());
|
||||
}
|
||||
|
||||
public static void PlayParticle(ParticleType type, Location location, float offsetX, float offsetY, float offsetZ,
|
||||
float speed, int count, ViewDist dist, Player... players)
|
||||
{
|
||||
|
@ -1,13 +1,25 @@
|
||||
package mineplex.core.gadget.gadgets;
|
||||
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.util.Vector;
|
||||
|
||||
import mineplex.core.common.util.C;
|
||||
import mineplex.core.gadget.types.ParticleGadget;
|
||||
import mineplex.core.common.util.UtilParticle;
|
||||
import mineplex.core.common.util.UtilParticle.ParticleType;
|
||||
import mineplex.core.common.util.UtilParticle.ViewDist;
|
||||
import mineplex.core.gadget.GadgetManager;
|
||||
import mineplex.core.gadget.types.ParticleGadget;
|
||||
import mineplex.core.updater.UpdateType;
|
||||
import mineplex.core.updater.event.UpdateEvent;
|
||||
|
||||
public class ParticleTitan extends ParticleGadget
|
||||
{
|
||||
|
||||
private int _tick;
|
||||
|
||||
public ParticleTitan(GadgetManager manager)
|
||||
{
|
||||
super(manager, "Titanic Particle", new String[]
|
||||
@ -16,7 +28,71 @@ public class ParticleTitan extends ParticleGadget
|
||||
" ",
|
||||
C.cRed + "Unlocked with Titan Rank",
|
||||
},
|
||||
-1,
|
||||
// Price for debuging purposes
|
||||
10,
|
||||
Material.INK_SACK, (byte)8);
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onUpdate(UpdateEvent event)
|
||||
{
|
||||
if (event.getType() != UpdateType.TICK)
|
||||
{
|
||||
return;
|
||||
}
|
||||
_tick++;
|
||||
_tick = _tick%620;
|
||||
|
||||
for(Player player : GetActive())
|
||||
{
|
||||
if (!shouldDisplay(player)) continue;
|
||||
|
||||
double total = 3;
|
||||
double step = (1/total)*Math.PI*2;
|
||||
double offset1 = (step/20)*_tick%20;
|
||||
double offset2 = (step/31)*_tick%31;
|
||||
|
||||
double r = 3;
|
||||
boolean redstone = false;
|
||||
|
||||
if(Manager.isMoving(player)) r = 0.5;
|
||||
|
||||
for(int i = 0; i < total; i++)
|
||||
{
|
||||
double rad = step*i + offset1;
|
||||
|
||||
double x = Math.sin(rad);
|
||||
double y = 0;
|
||||
double z = Math.cos(rad);
|
||||
|
||||
|
||||
Vector v = new Vector(x,y,z).normalize();
|
||||
v.multiply(r);
|
||||
Location loc = player.getLocation();
|
||||
loc.add(0, 0.1, 0);
|
||||
|
||||
loc.add(v);
|
||||
|
||||
|
||||
if(redstone) UtilParticle.PlayParticleToAll(ParticleType.RED_DUST, loc, 1, 0, 0, 1, 0, ViewDist.NORMAL);
|
||||
v.multiply(-1);
|
||||
UtilParticle.PlayParticleToAll(ParticleType.FLAME, loc, v, 0.05f, 0, ViewDist.NORMAL);
|
||||
|
||||
rad = -(step*i + offset2);
|
||||
x = Math.sin(rad);
|
||||
z = Math.cos(rad);
|
||||
|
||||
v = new Vector(x,y,z).normalize();
|
||||
v.multiply(r);
|
||||
loc = player.getLocation();
|
||||
loc.add(0, 0.1, 0);
|
||||
|
||||
loc.add(v);
|
||||
|
||||
if(redstone) UtilParticle.PlayParticleToAll(ParticleType.RED_DUST, loc, 1, 0, 0, 1, 0, ViewDist.NORMAL);
|
||||
v.multiply(-1);
|
||||
UtilParticle.PlayParticleToAll(ParticleType.FLAME, loc, v, 0.05f, 0, ViewDist.NORMAL);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,8 +1,19 @@
|
||||
package mineplex.core.mount.types;
|
||||
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.Sound;
|
||||
import org.bukkit.entity.Minecart;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.entity.EntityTargetEvent;
|
||||
import org.bukkit.event.player.PlayerInteractEntityEvent;
|
||||
import org.bukkit.event.vehicle.VehicleDamageEvent;
|
||||
|
||||
import mineplex.core.common.util.F;
|
||||
import mineplex.core.common.util.UtilAction;
|
||||
import mineplex.core.common.util.UtilAlg;
|
||||
import mineplex.core.common.util.UtilEnt;
|
||||
import mineplex.core.common.util.UtilMath;
|
||||
import mineplex.core.common.util.UtilPlayer;
|
||||
import mineplex.core.mount.Mount;
|
||||
@ -11,6 +22,7 @@ import mineplex.core.recharge.Recharge;
|
||||
import mineplex.core.updater.UpdateType;
|
||||
import mineplex.core.updater.event.UpdateEvent;
|
||||
|
||||
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.Sound;
|
||||
@ -110,12 +122,9 @@ public class MountCart extends Mount<Minecart>
|
||||
if (cart.getPassenger() == null)
|
||||
continue;
|
||||
|
||||
if (!((CraftMinecart) cart).getHandle().onGround)
|
||||
if (!UtilEnt.isGrounded(cart))
|
||||
continue;
|
||||
|
||||
// if (!UtilEnt.isGrounded(cart))
|
||||
// continue;
|
||||
|
||||
if (!(cart.getPassenger() instanceof Player))
|
||||
continue;
|
||||
|
||||
|
@ -1,5 +1,6 @@
|
||||
package mineplex.hub.modules;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Effect;
|
||||
import org.bukkit.GameMode;
|
||||
import org.bukkit.block.BlockFace;
|
||||
@ -18,6 +19,7 @@ import mineplex.core.disguise.disguises.DisguiseBat;
|
||||
import mineplex.core.disguise.disguises.DisguiseChicken;
|
||||
import mineplex.core.disguise.disguises.DisguiseEnderman;
|
||||
import mineplex.core.disguise.disguises.DisguiseWither;
|
||||
import mineplex.core.recharge.Recharge;
|
||||
import mineplex.core.updater.UpdateType;
|
||||
import mineplex.core.updater.event.UpdateEvent;
|
||||
import mineplex.hub.HubManager;
|
||||
@ -66,6 +68,8 @@ public class JumpManager extends MiniPlugin
|
||||
|
||||
//Sound
|
||||
player.playEffect(player.getLocation(), Effect.BLAZE_SHOOT, 0);
|
||||
|
||||
Recharge.Instance.useForce(player, "Double Jump", 500);
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
@ -94,8 +98,11 @@ public class JumpManager extends MiniPlugin
|
||||
|
||||
if (UtilEnt.isGrounded(player) || UtilBlock.solid(player.getLocation().getBlock().getRelative(BlockFace.DOWN)))
|
||||
{
|
||||
player.setAllowFlight(true);
|
||||
player.setFlying(false);
|
||||
if(!player.getAllowFlight() && Recharge.Instance.usable(player, "Double Jump"))
|
||||
{
|
||||
player.setAllowFlight(true);
|
||||
player.setFlying(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -101,6 +101,8 @@ public class PerkDoubleJump extends Perk
|
||||
Recharge.Instance.setDisplayForce(player, GetName(), true);
|
||||
}
|
||||
}
|
||||
|
||||
Recharge.Instance.useForce(player, "Double Jump", 500);
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
@ -119,6 +121,9 @@ public class PerkDoubleJump extends Perk
|
||||
|
||||
if (_recharge > 0 && !Recharge.Instance.usable(player, GetName()))
|
||||
continue;
|
||||
|
||||
if (!Recharge.Instance.usable(player, "Double Jump"))
|
||||
continue;
|
||||
|
||||
if (UtilEnt.isGrounded(player) || UtilBlock.solid(player.getLocation().getBlock().getRelative(BlockFace.DOWN)))
|
||||
player.setAllowFlight(true);
|
||||
|
Loading…
Reference in New Issue
Block a user