How to disable end credits?

Discussion in 'Spigot Plugin Help' started by DogisPlz, Feb 7, 2015.

  1. So i have a server where people are constantly fighting in the end ... these people run away to the portal created by the death of the dragon ... here comes the problem ... if these people do not press escape will not appear in the overworld and will be hidden until the credits run out ... how can i disable the credits?

    this is what I have:

    Code (Text):
    public class PlayerPortalEvent implements Listener {
       
         @EventHandler(priority=EventPriority.HIGHEST)
         public void onPlayerPortal(PlayerPortalEvent e){
             Player p = e.getPlayer();
             World wTo = Bukkit.getWorld("world");
             World wFrom = p.getWorld();
             if( wFrom.equals(Bukkit.getWorld("world_the_end"))){
                 //to spawn
                 Location l = new Location (wTo, 0 , 90, 0);
                 e.setTo(l);
             }
         }
    }
    this works perfectly, but the credits appear before this event... Help plz :'c <3
     
  2. Possibly cancel the event and teleport them there?
     
  3. i tested out canceling the event, but the credits still appearing :ccc The credits should be cancelable for other side, but i don't know :'c and i've searched a lot of information and all i found was how to show the credits to players (https://gist.github.com/aadnk/4748292)
     
  4. Surely there is a packet to send which cancels it, I'm a noob with that sort of stuff but I'm still trying to learn.

    Maybe check if the block or two blocks below them is an end portal, then tp them?

    Edit: Just saw the gist, maybe make nms.viewingCredits = false and send a teleport packet?
     
  5. Just asking, could you not check the type of portal? I've never used this event before so I wouldn't know ;P
     
  6. I'll test it out when I get on my laptop which will be in half an hour. I'll let you know what I find out.
     
  7. Maybe you could just set the boolean there to false...I have no idea just throwing suggestions out there
     
  8. damn it you beat me to it ;P Good luck and let us know how it went
     
  9. Yeah, you might need to send a packet to update the client. Like I said earlier, still learning packets.

    Looks like you posted again... lol
     
  10. Okay, after killing the ender dragon and going through the portal, it didn't work. I am attempting to find other solutions.

    EDIT: I managed to do this, I think this is the only solution I found.
    PHP:
    @EventHandler
        public void portal(PlayerMoveEvent e) {
            Player p = e.getPlayer();
            World wTo = Bukkit.getWorld("world");
            World wFrom = p.getWorld();
            if (wFrom.equals(Bukkit.getWorld("world_the_end"))) {
                Location l = new Location(wTo, 0, 90, 0);
                if (p.getLocation().add(0, -1, 0).getBlock().getType() == Material.ENDER_PORTAL
                        || p.getLocation().getBlock().getType() == Material.ENDER_PORTAL) {
                    p.teleport(l);
                }
            }
        }
     
    #10 dentmaged, Feb 7, 2015
    Last edited: Feb 7, 2015
    • Like Like x 1
  11. It works perfect :')) thanks both for ur help <3 I'm focused trying to cancel the credits, but your code make this.
    I have a question: This event does not diminish the tps when many people are playing? i say this becouse the PlayerMoveEvent is always checking, anyway i'm gona test in my server thanks again :'D
     
  12. It may slow the server down a bit but I don't know any other solutions. :(