Anyway to force end credits on a player?

Discussion in 'Plugin Development' started by BR3TON, Feb 9, 2013.

Thread Status:
Not open for further replies.
  1. Offline

    BR3TON

    Is it possible to force the Minecraft end credits on somebody?
     
  2. Offline

    RealDope

    Doubt it, that's probably client-side.
     
  3. Offline

    ZeusAllMighty11

    Hmm... that's a really good question, actually.

    Not that i've ever heard of
     
  4. Offline

    stuntguy3000

    Posting here because i can't wait to see if its possible =)
     
  5. Offline

    CookCreeperz

    Are you Dr. Cactus? [cake]
     
  6. Offline

    Comphenix

    Yes, but the sever should be able to initiate it.

    In fact, it IS possible (download):
    Code:java
    1. public class ExampleMod extends JavaPlugin implements Listener {
    2. @Override
    3. public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
    4. if (sender instanceof Player) {
    5. displayCredits((Player) sender);
    6. } else {
    7. sender.sendMessage(ChatColor.RED + "Must be a player.");
    8. }
    9.  
    10. return true;
    11. }
    12.  
    13. private void displayCredits(Player player) {
    14. CraftPlayer craft = (CraftPlayer) player;
    15. EntityPlayer nms = craft.getHandle();
    16.  
    17. nms.viewingCredits = true;
    18. nms.playerConnection.sendPacket(new Packet70Bed(4, 0));
    19. }
    20. }


    And here's a version that uses ProtocolLib, if you don't want to reference CraftBukkit directly;
    Code:java
    1. private void displayCredits(Player player) throws InvocationTargetException, IllegalArgumentException, IllegalAccessException {
    2. BukkitUnwrapper unwrapper = new BukkitUnwrapper();
    3. Object nms = unwrapper.unwrapItem(player);
    4.  
    5. PacketContainer useBed = new PacketContainer(Packets.Server.BED);
    6. useBed.getIntegers().
    7. write(0, 4).
    8. write(1, 0);
    9.  
    10. FuzzyReflection.fromObject(nms).getFieldByName("viewingCredits").set(nms, true);
    11. ProtocolLibrary.getProtocolManager().sendServerPacket(player, useBed);
    12. }
     
  7. Offline

    stuntguy3000

    Awesome! =O
     
  8. Offline

    LaxWasHere

    Ha! My players better watch out, I'll force the credits on them if they say YOLO.
     
    KollegahDerBoss, Garris0n and TfT_02 like this.
  9. Offline

    caseif

    I have got to get this plugin...
     
  10. Offline

    ceoepts

    Now when you can change the credits using Resource pack this is a epic way of showing server credits
     
  11. Offline

    Ultimate_n00b

    Something not to do.
    Force this onto yourself every tick, then not be able to restart the server with the fix.


    (necropost, sorry =p)
     
  12. Offline

    Blingdaddy1

    Brilliant!
     
  13. Offline

    xTrollxDudex

    Blingdaddy1
    -______-

    Even the person above you noticed it was an old thread
     
Thread Status:
Not open for further replies.

Share This Page