Portal

Discussion in 'Plugin Development' started by DanielSivertsen, Mar 22, 2014.

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

    DanielSivertsen

    Hey, i got some question.

    1. Portal blocks, how can i make that 2 in the high with like, i spank a blaze rod or something on the floor and whips i get a portal 1 x 2, 2 high. And this without a frame. When i try it, only the one under opens, or it disappear.

    2. How can i make the portal personal, so if i open it. It would go to my vault, and if other people are running in the portal they will go to my vault, not they own, without opening it them self.

    I would love the help, and thanks in front!
    (Sry my bad english i'm norwegian)
     
  2. Offline

    Noxyro

    1. Portal blocks have special behaviour that makes them disappear if no border is present (when they are updated). I'm not completly sure if this also applies on plugin spawned blocks, but I guess so. Someone else might help you on this, because I never realy used portal blocks in my own plugins.

    2. You have to save the portal (blocks) position and the owner of this portal somewhere to check who owns this portal later on. I recommend the usage of a HashMap.
     
  3. Offline

    drtshock

    Have you tried anything yet? Not gonna write code for you but if you have some to show we can go from there :)
     
    DanielSivertsen likes this.
  4. Offline

    DanielSivertsen

    drtshock, yeah i do here it is:
    Code:java
    1. public void createPortal(Player p, Block b) {
    2.  
    3. if (hasPortal.contains(p)) {
    4. p.sendMessage(ChatColor.RED + "Du har allerede en aktiv portal.");
    5. return;
    6. }
    7.  
    8. Block above = b.getRelative(BlockFace.UP);
    9. p.sendMessage(ChatColor.RED + "Registrert.");
    10. if (above.getType() == Material.AIR) {
    11. p.sendMessage(ChatColor.LIGHT_PURPLE + "Portal opprettet.");
    12. p.playSound(b.getLocation(), Sound.BLAZE_HIT, 50, 50);
    13. above.setType(Material.PORTAL);
    14. hasPortal.add(p);
    15. // above.getRelative(BlockFace.UP).setType(Material.PORTAL);
    16. } else {
    17. p.sendMessage(ChatColor.LIGHT_PURPLE + "Du kan ikke lage portal her!");
    18. p.playSound(p.getLocation(), Sound.GHAST_SCREAM, 50, 50);
    19. p.damage(2);
    20. }
    21. }


    @drtshock
    It would help alot if you got some ideas ;)

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: Jun 7, 2016
  5. Offline

    drtshock

    I don't understand the issue :c
     
  6. Offline

    DanielSivertsen

    drtshock We can't get two portal blocks like this:

    I
    I

    When we make it like that the portal are disappear... We don't want a frame.
    I = portal block

    Try on your own server, or survival world to place two portal blocks up on each other. drtshock

    I really need help with these.

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: Jun 7, 2016
  7. Offline

    Noxyro


    I tested it myself now with a simple plugin and it seems like you can't manage to create 2 portal blocks next to each other without getting into advanced coding. The block that is placed second will update the first block. This block will "see" that it has no border and will disappear, which updates the other portal block which will also "see" that it has no border and will disappear too.

    I never realy dealt with portal blocks before as I already told in my first post, so someone else has to help you here.
    I just figured out the fact above for you. ^^
     
  8. Offline

    DanielSivertsen

    Thanks, the fact's was something we already know, the problem is now to stop them from disappearing ;)


    0:47 sec look there drtshock i want it like that portal.

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: Jun 7, 2016
Thread Status:
Not open for further replies.

Share This Page