-
Notifications
You must be signed in to change notification settings - Fork 129
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix bed interactions kicking players, fixes #787
- Loading branch information
1 parent
b692fa5
commit 3c99810
Showing
3 changed files
with
44 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
38 changes: 38 additions & 0 deletions
38
...libraryaddict/disguise/utilities/packets/packethandlers/PacketHandlerEntityAnimation.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
package me.libraryaddict.disguise.utilities.packets.packethandlers; | ||
|
||
import com.github.retrooper.packetevents.protocol.packettype.PacketType; | ||
import com.github.retrooper.packetevents.protocol.packettype.PacketTypeCommon; | ||
import com.github.retrooper.packetevents.wrapper.play.server.WrapperPlayServerEntityAnimation; | ||
import me.libraryaddict.disguise.disguisetypes.Disguise; | ||
import me.libraryaddict.disguise.utilities.packets.IPacketHandler; | ||
import me.libraryaddict.disguise.utilities.packets.LibsPackets; | ||
import org.bukkit.entity.Entity; | ||
import org.bukkit.entity.Player; | ||
|
||
public class PacketHandlerEntityAnimation implements IPacketHandler<WrapperPlayServerEntityAnimation> { | ||
@Override | ||
public PacketTypeCommon[] getHandledPackets() { | ||
return new PacketTypeCommon[]{PacketType.Play.Server.ENTITY_ANIMATION}; | ||
} | ||
|
||
@Override | ||
public void handle(Disguise disguise, LibsPackets<WrapperPlayServerEntityAnimation> packets, Player observer, Entity entity) { | ||
// All misc disguises cannot have animation events | ||
if (disguise.isMiscDisguise()) { | ||
packets.clear(); | ||
return; | ||
} | ||
|
||
// If this animation isn't a wake up, then don't need to handle | ||
if (packets.getOriginalPacket().getType() != WrapperPlayServerEntityAnimation.EntityAnimationType.WAKE_UP) { | ||
return; | ||
} | ||
|
||
// Player disguises can play the animation | ||
if (disguise.isPlayerDisguise()) { | ||
return; | ||
} | ||
|
||
packets.clear(); | ||
} | ||
} |