Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
No ender dragon sound in different worlds.
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);
}
}
}
});
}
}
@MCTyler

This comment has been minimized.

Copy link

@MCTyler MCTyler commented Oct 22, 2014

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!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.