Created
July 24, 2013 03:25
-
-
Save aadnk/6067861 to your computer and use it in GitHub Desktop.
No ender dragon sound in different worlds.
This file contains hidden or 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
package com.comphenix.example; | |
import org.bukkit.plugin.java.JavaPlugin; | |
import com.comphenix.protocol.Packets; | |
import com.comphenix.protocol.ProtocolLibrary; | |
import com.comphenix.protocol.events.ConnectionSide; | |
import com.comphenix.protocol.events.PacketAdapter; | |
import com.comphenix.protocol.events.PacketEvent; | |
public class NoEnderDragonSound extends JavaPlugin { | |
@Override | |
public void onEnable() { | |
ProtocolLibrary.getProtocolManager().addPacketListener(new PacketAdapter(this, ConnectionSide.SERVER_SIDE, Packets.Server.WORLD_EVENT) { | |
@Override | |
public void onPacketSending(PacketEvent event) { | |
String worldName = event.getPlayer().getWorld().getName(); | |
int effectId = event.getPacket().getIntegers().read(0); | |
if (effectId == 1018) { | |
if ("world_the_end".equals(worldName)) { | |
event.setCancelled(true); | |
} | |
} | |
} | |
}); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I'm trying to make your code work embedded in a fake dragon program but it won't parse this line...
int effectId = event.getPacket().getIntegers().read(0);
Specifically the .getIntegers(), has this been deprecated and if so with what? I replaced it with .getIdIntegers with .getID() but that didn't turn the dragon wing noise off. Thanks in advance!