Skip to content

Instantly share code, notes, and snippets.

@aadnk
Created February 10, 2013 03:56
Show Gist options
  • Save aadnk/4748292 to your computer and use it in GitHub Desktop.
Save aadnk/4748292 to your computer and use it in GitHub Desktop.
Force the end credits on an unsuspecting player.
package com.comphenix.example;
import net.minecraft.server.v1_4_R1.EntityPlayer;
import net.minecraft.server.v1_4_R1.Packet70Bed;
import org.bukkit.ChatColor;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.craftbukkit.v1_4_R1.entity.CraftPlayer;
import org.bukkit.entity.Player;
import org.bukkit.event.Listener;
import org.bukkit.plugin.java.JavaPlugin;
public class ForceEnd extends JavaPlugin implements Listener {
@Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
if (sender instanceof Player) {
displayCredits((Player) sender);
} else {
sender.sendMessage(ChatColor.RED + "Must be a player.");
}
return true;
}
private void displayCredits(Player player) {
CraftPlayer craft = (CraftPlayer) player;
EntityPlayer nms = craft.getHandle();
nms.viewingCredits = true;
nms.playerConnection.sendPacket(new Packet70Bed(4, 0));
}
}
@Zeryther
Copy link

Zeryther commented Oct 8, 2015

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment