Solved How I can make custom portal?

Discussion in 'Spigot Plugin Development' started by Videosambo, Jul 16, 2018.

Thread Status:
Not open for further replies.
  1. Hello, I m trying to create a custom portal that player can build, then it teleport player to another world, I need some help to complete this code, I m stuck at detecting portal structure...
    here my code:
    Code (Text):

    package com.videosambo.motimaa.Taivas;

    import org.bukkit.Material;
    import org.bukkit.block.BlockFace;
    import org.bukkit.event.EventHandler;
    import org.bukkit.event.Listener;
    import org.bukkit.event.player.PlayerInteractEvent;

    public class Portaali implements Listener {
        public void onInteractEvent (PlayerInteractEvent e) {
            if (e.getClickedBlock().getType().equals(Material.GLOWSTONE) && e.getBlockFace().equals(BlockFace.UP)) {
                if (e.getItem().getType().equals(Material.FLINT_AND_STEEL) && e.getItem().getType() != null && e.getClickedBlock().getType() != Material.AIR) {              
                   //what now
  2. So you want to detect if the player clicked in the bottom left or right corner of a portal made of glowstone?
  3. It depends on if you want portals to have the same functionality as nether portals (No fixed size). If you want a fixed size:
    When using flint and steel:
    1. Check if the clicked block is glowstone (Done)
    2. Check if block face is up (Done)
    3. Check relative upwards of 3, and see if it's glowstone
    4. Check if the side blocks (N,S,E or W) are glowstone. If more than 3 sideways blocks are glowstone, it isn't a portal
    5. Based on where you found the glowstone in step 4, do a check on the opposite end of the portal (Relative by 2 blocks in opposite direction)
    6. Repeat steps 4-5 for about 3 blocks of height

    Basically a bunch of block.getRelative manipulation
    • Like Like x 1
  4. I got it work, thx
Thread Status:
Not open for further replies.