Merge remote-tracking branch 'remotes/origin/master' into clans-beta
This commit is contained in:
commit
639d2d110f
@ -78,10 +78,13 @@ public class UtilEnt
|
|||||||
|
|
||||||
public static void Leash(LivingEntity leashed, Entity holder, boolean pull, boolean breakable)
|
public static void Leash(LivingEntity leashed, Entity holder, boolean pull, boolean breakable)
|
||||||
{
|
{
|
||||||
leashed.setPullWhileLeashed(pull);
|
|
||||||
leashed.setShouldBreakLeash(breakable);
|
|
||||||
|
|
||||||
leashed.setLeashHolder(holder);
|
leashed.setLeashHolder(holder);
|
||||||
|
|
||||||
|
if (!(((CraftLivingEntity)leashed).getHandle() instanceof EntityInsentient))
|
||||||
|
return;
|
||||||
|
|
||||||
|
((EntityInsentient)((CraftLivingEntity)leashed).getHandle()).setPullWhileLeashed(pull);
|
||||||
|
((EntityInsentient)((CraftLivingEntity)leashed).getHandle()).setShouldBreakLeash(breakable);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void addLookAtPlayerAI(Entity entity, float dist)
|
public static void addLookAtPlayerAI(Entity entity, float dist)
|
||||||
|
@ -22,6 +22,7 @@ import net.minecraft.server.v1_8_R3.DataWatcher.WatchableObject;
|
|||||||
import net.minecraft.server.v1_8_R3.MathHelper;
|
import net.minecraft.server.v1_8_R3.MathHelper;
|
||||||
import net.minecraft.server.v1_8_R3.Packet;
|
import net.minecraft.server.v1_8_R3.Packet;
|
||||||
import net.minecraft.server.v1_8_R3.PacketPlayInUseEntity;
|
import net.minecraft.server.v1_8_R3.PacketPlayInUseEntity;
|
||||||
|
import net.minecraft.server.v1_8_R3.PacketPlayInUseEntity.EnumEntityUseAction;
|
||||||
import net.minecraft.server.v1_8_R3.PacketPlayOutAttachEntity;
|
import net.minecraft.server.v1_8_R3.PacketPlayOutAttachEntity;
|
||||||
import net.minecraft.server.v1_8_R3.PacketPlayOutEntityDestroy;
|
import net.minecraft.server.v1_8_R3.PacketPlayOutEntityDestroy;
|
||||||
import net.minecraft.server.v1_8_R3.PacketPlayOutEntityMetadata;
|
import net.minecraft.server.v1_8_R3.PacketPlayOutEntityMetadata;
|
||||||
@ -55,15 +56,12 @@ public class CustomTagFix extends MiniPlugin implements IPacketHandler, NCPHook
|
|||||||
|
|
||||||
private NautHashMap<UUID, Long> _exemptTimeMap = new NautHashMap<UUID, Long>();
|
private NautHashMap<UUID, Long> _exemptTimeMap = new NautHashMap<UUID, Long>();
|
||||||
private NautHashMap<UUID, NautHashMap<CheckType, Long>> _doubleStrike = new NautHashMap<UUID, NautHashMap<CheckType, Long>>();
|
private NautHashMap<UUID, NautHashMap<CheckType, Long>> _doubleStrike = new NautHashMap<UUID, NautHashMap<CheckType, Long>>();
|
||||||
private PacketHandler _packetHandler;
|
|
||||||
|
|
||||||
public CustomTagFix(JavaPlugin plugin, PacketHandler packetHandler)
|
public CustomTagFix(JavaPlugin plugin, PacketHandler packetHandler)
|
||||||
{
|
{
|
||||||
super("Custom Tag Fix", plugin);
|
super("Custom Tag Fix", plugin);
|
||||||
|
|
||||||
_packetHandler = packetHandler;
|
packetHandler.addPacketHandler(this, true, PacketPlayOutAttachEntity.class, PacketPlayOutEntityDestroy.class,
|
||||||
|
|
||||||
packetHandler.addPacketHandler(this, PacketPlayOutAttachEntity.class, PacketPlayOutEntityDestroy.class,
|
|
||||||
PacketPlayOutEntityMetadata.class, PacketPlayOutSpawnEntity.class, PacketPlayOutSpawnEntityLiving.class,
|
PacketPlayOutEntityMetadata.class, PacketPlayOutSpawnEntity.class, PacketPlayOutSpawnEntityLiving.class,
|
||||||
PacketPlayInUseEntity.class);
|
PacketPlayInUseEntity.class);
|
||||||
|
|
||||||
@ -353,10 +351,9 @@ public class CustomTagFix extends MiniPlugin implements IPacketHandler, NCPHook
|
|||||||
{
|
{
|
||||||
PacketPlayInUseEntity newPacket = new PacketPlayInUseEntity();
|
PacketPlayInUseEntity newPacket = new PacketPlayInUseEntity();
|
||||||
newPacket.a = entry.getKey();
|
newPacket.a = entry.getKey();
|
||||||
newPacket.action = usePacket.action;
|
newPacket.action = usePacket.action == EnumEntityUseAction.ATTACK ? EnumEntityUseAction.ATTACK
|
||||||
newPacket.c = usePacket.c;
|
: EnumEntityUseAction.INTERACT;
|
||||||
|
|
||||||
if (_packetHandler.handlePacket(owner, newPacket))
|
|
||||||
{
|
{
|
||||||
((CraftPlayer) owner).getHandle().playerConnection.a(newPacket);
|
((CraftPlayer) owner).getHandle().playerConnection.a(newPacket);
|
||||||
}
|
}
|
||||||
|
@ -5,11 +5,15 @@ import java.util.HashMap;
|
|||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
|
|
||||||
|
import net.minecraft.server.v1_8_R3.EntityPlayer;
|
||||||
|
import net.minecraft.server.v1_8_R3.MathHelper;
|
||||||
|
import net.minecraft.server.v1_8_R3.MovingObjectPosition;
|
||||||
import net.minecraft.server.v1_8_R3.PacketPlayInUseEntity;
|
import net.minecraft.server.v1_8_R3.PacketPlayInUseEntity;
|
||||||
import net.minecraft.server.v1_8_R3.PacketPlayInUseEntity.EnumEntityUseAction;
|
import net.minecraft.server.v1_8_R3.PacketPlayInUseEntity.EnumEntityUseAction;
|
||||||
import net.minecraft.server.v1_8_R3.MinecraftServer;
|
|
||||||
import net.minecraft.server.v1_8_R3.PacketPlayOutEntityDestroy;
|
import net.minecraft.server.v1_8_R3.PacketPlayOutEntityDestroy;
|
||||||
import net.minecraft.server.v1_8_R3.PacketPlayOutSpawnEntityLiving;
|
import net.minecraft.server.v1_8_R3.PacketPlayOutSpawnEntityLiving;
|
||||||
|
import net.minecraft.server.v1_8_R3.Vec3D;
|
||||||
|
import net.minecraft.server.v1_8_R3.WorldSettings.EnumGamemode;
|
||||||
|
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.craftbukkit.v1_8_R3.entity.CraftPlayer;
|
import org.bukkit.craftbukkit.v1_8_R3.entity.CraftPlayer;
|
||||||
@ -18,9 +22,6 @@ import org.bukkit.entity.EntityType;
|
|||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.event.EventHandler;
|
import org.bukkit.event.EventHandler;
|
||||||
import org.bukkit.event.block.Action;
|
import org.bukkit.event.block.Action;
|
||||||
import org.bukkit.event.player.PlayerAnimationEvent;
|
|
||||||
import org.bukkit.event.player.PlayerAnimationType;
|
|
||||||
import org.bukkit.event.player.PlayerInteractEvent;
|
|
||||||
import org.bukkit.event.player.PlayerQuitEvent;
|
import org.bukkit.event.player.PlayerQuitEvent;
|
||||||
import org.bukkit.plugin.java.JavaPlugin;
|
import org.bukkit.plugin.java.JavaPlugin;
|
||||||
|
|
||||||
@ -33,8 +34,6 @@ import mineplex.core.updater.event.UpdateEvent;
|
|||||||
public class PacketsInteractionFix extends MiniPlugin implements IPacketHandler
|
public class PacketsInteractionFix extends MiniPlugin implements IPacketHandler
|
||||||
{
|
{
|
||||||
private HashMap<String, HashSet<Integer>> _armorStands = new HashMap<String, HashSet<Integer>>();
|
private HashMap<String, HashSet<Integer>> _armorStands = new HashMap<String, HashSet<Integer>>();
|
||||||
private HashSet<Player> _leftClicked = new HashSet<Player>();
|
|
||||||
private int _lastTick;
|
|
||||||
|
|
||||||
public PacketsInteractionFix(JavaPlugin plugin, PacketHandler packetHandler)
|
public PacketsInteractionFix(JavaPlugin plugin, PacketHandler packetHandler)
|
||||||
{
|
{
|
||||||
@ -44,42 +43,9 @@ public class PacketsInteractionFix extends MiniPlugin implements IPacketHandler
|
|||||||
PacketPlayInUseEntity.class);
|
PacketPlayInUseEntity.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void checkLeftClicks()
|
|
||||||
{
|
|
||||||
if (MinecraftServer.currentTick == _lastTick)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
_lastTick = MinecraftServer.currentTick;
|
|
||||||
_leftClicked.clear();
|
|
||||||
}
|
|
||||||
|
|
||||||
//@EventHandler
|
|
||||||
public void onArmAnimation(PlayerAnimationEvent event)
|
|
||||||
{
|
|
||||||
if (event.getAnimationType() != PlayerAnimationType.ARM_SWING)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
checkLeftClicks();
|
|
||||||
|
|
||||||
Player player = event.getPlayer();
|
|
||||||
|
|
||||||
if (_leftClicked.remove(player))
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
CraftEventFactory.callPlayerInteractEvent(((CraftPlayer) player).getHandle(), Action.LEFT_CLICK_AIR,
|
|
||||||
((CraftPlayer) player).getHandle().inventory.getItemInHand());
|
|
||||||
}
|
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void onQuit(PlayerQuitEvent event)
|
public void onQuit(PlayerQuitEvent event)
|
||||||
{
|
{
|
||||||
_leftClicked.remove(event.getPlayer().getName());
|
|
||||||
_armorStands.remove(event.getPlayer().getName());
|
_armorStands.remove(event.getPlayer().getName());
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -91,8 +57,6 @@ public class PacketsInteractionFix extends MiniPlugin implements IPacketHandler
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
checkLeftClicks();
|
|
||||||
|
|
||||||
Iterator<String> itel = _armorStands.keySet().iterator();
|
Iterator<String> itel = _armorStands.keySet().iterator();
|
||||||
|
|
||||||
while (itel.hasNext())
|
while (itel.hasNext())
|
||||||
@ -110,19 +74,6 @@ public class PacketsInteractionFix extends MiniPlugin implements IPacketHandler
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//@EventHandler
|
|
||||||
public void onPlayerInteract(PlayerInteractEvent event)
|
|
||||||
{
|
|
||||||
if (!event.getAction().name().contains("LEFT"))
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
checkLeftClicks();
|
|
||||||
|
|
||||||
_leftClicked.add(event.getPlayer());
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void handle(PacketInfo packetInfo)
|
public void handle(PacketInfo packetInfo)
|
||||||
{
|
{
|
||||||
@ -166,12 +117,38 @@ public class PacketsInteractionFix extends MiniPlugin implements IPacketHandler
|
|||||||
{
|
{
|
||||||
PacketPlayInUseEntity packet = (PacketPlayInUseEntity) packetInfo.getPacket();
|
PacketPlayInUseEntity packet = (PacketPlayInUseEntity) packetInfo.getPacket();
|
||||||
|
|
||||||
if (!list.contains(packet.a))
|
if (packet.action == EnumEntityUseAction.ATTACK)
|
||||||
{
|
{
|
||||||
|
EntityPlayer nmsPlayer = ((CraftPlayer) packetInfo.getPlayer()).getHandle();
|
||||||
|
|
||||||
|
float f1 = nmsPlayer.pitch;
|
||||||
|
float f2 = nmsPlayer.yaw;
|
||||||
|
double d0 = nmsPlayer.locX;
|
||||||
|
double d1 = nmsPlayer.locY + nmsPlayer.getHeadHeight();
|
||||||
|
double d2 = nmsPlayer.locZ;
|
||||||
|
Vec3D vec3d = new Vec3D(d0, d1, d2);
|
||||||
|
|
||||||
|
float f3 = MathHelper.cos(-f2 * 0.01745329F - 3.141593F);
|
||||||
|
float f4 = MathHelper.sin(-f2 * 0.01745329F - 3.141593F);
|
||||||
|
float f5 = -MathHelper.cos(-f1 * 0.01745329F);
|
||||||
|
float f6 = MathHelper.sin(-f1 * 0.01745329F);
|
||||||
|
float f7 = f4 * f5;
|
||||||
|
float f8 = f3 * f5;
|
||||||
|
nmsPlayer.playerInteractManager.getGameMode();
|
||||||
|
double d3 = nmsPlayer.playerInteractManager.getGameMode() == EnumGamemode.CREATIVE ? 5 : 4.5;
|
||||||
|
Vec3D vec3d1 = vec3d.add(f7 * d3, f6 * d3, f8 * d3);
|
||||||
|
MovingObjectPosition movingobjectposition = nmsPlayer.world.rayTrace(vec3d, vec3d1, false);
|
||||||
|
|
||||||
|
if (movingobjectposition != null && movingobjectposition.type == MovingObjectPosition.EnumMovingObjectType.BLOCK)
|
||||||
|
{
|
||||||
|
CraftEventFactory.callPlayerInteractEvent(nmsPlayer, Action.LEFT_CLICK_AIR,
|
||||||
|
nmsPlayer.inventory.getItemInHand());
|
||||||
|
}
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (packet.action == EnumEntityUseAction.ATTACK)
|
if (!list.contains(packet.a))
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -226,7 +226,7 @@ public class StackerManager extends MiniPlugin implements IThrown
|
|||||||
|
|
||||||
UtilAction.velocity(throwee, thrower.getLocation().getDirection(), 1.8, false, 0, 0.3, 2, false);
|
UtilAction.velocity(throwee, thrower.getLocation().getDirection(), 1.8, false, 0, 0.3, 2, false);
|
||||||
|
|
||||||
_projectileManager.AddThrow(throwee, thrower, this, -1, true, false, true, false, 0.5f);
|
_projectileManager.AddThrow(throwee, thrower, this, 4000, true, false, true, false, 0.5f);
|
||||||
|
|
||||||
//Portal Delay
|
//Portal Delay
|
||||||
Manager.SetPortalDelay(thrower);
|
Manager.SetPortalDelay(thrower);
|
||||||
|
Loading…
Reference in New Issue
Block a user