-
-
Save anonymous/570c1f9458e750b1b2d2 to your computer and use it in GitHub Desktop.
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
public class Main extends JavaPlugin { | |
private static final boolean ASYNC = true; | |
public void onEnable() { | |
AsyncListenerHandler handler = ProtocolLibrary.getProtocolManager().getAsynchronousManager().registerAsyncHandler(new PacketAdapter(this, PacketType.Play.Server.RESPAWN) { | |
public void onPacketSending(PacketEvent event) { | |
getLogger().info("Sending respawn packet to " + event.getPlayer().getName()); | |
} | |
}); | |
if (ASYNC) { | |
handler.start(); | |
} else { | |
handler.syncStart(); | |
} | |
} | |
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) { | |
Player player = (Player) sender; | |
player.setHealth(0); | |
player.spigot().respawn(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment