Solved How can I make launch pads?

Discussion in 'Plugin Development' started by Developerjohn, Dec 31, 2013.

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

    Developerjohn

    These launch pads allow players to step onto a block and get launched about 15 blocks high and 25 blocks as a distance. These pads allow people to jump across the map to make it easier than walking. How can I make these?:confused::confused::confused:
     
  2. Offline

    Jordymt

  3. Offline

    xTrollxDudex

    Developerjohn
    Listen for PlayerInteractEvent, check if it is Action.PHYSICAL, see if the clicked block is a pressure plate, and use Vectors setting the Y and X/Z to get the distance, then multiply it.
     
  4. Offline

    Developerjohn

    xTrollxDudex not a pressure plate though. Can I change the block type?:confused:
     
  5. Offline

    xTrollxDudex

    Developerjohn
    Sure, but you will need to use PlayerMoveEvent
     
  6. Offline

    Developerjohn

  7. Offline

    SmellyPenguin

    Which is highly frowned upon :)
     
  8. Offline

    xTrollxDudex

    SmellyPenguin
    ?
    Check every 1-2 blocks the player travels, not every time he moves his head.
     
  9. Offline

    ShearsSheep

    I made a plugin about the launch pad before , I think you may need to follow this code :/

    Code:java
    1. @EventHandler
    2. public void onPlayerMove(PlayerMoveEvent e) {
    3. if (e.getTo().getBlock().getRelative(BlockFace.DOWN).getType() == Material.REDSTONE_BLOCK) {
    4. e.getPlayer().setVelocity(e.getPlayer().getLocation().getDirection().multiply(4));
    5. e.getPlayer().setVelocity(new Vector(e.getPlayer().getVelocity().getX(), 1.0D, e.getPlayer().getVelocity().getZ()));
    6. jumpers.add(e.getPlayer());

    That code does not invole pressure plates like the hive , you can change the
    Code:java
    1. Material.REDSTONE_BLOCK
    To something else :/
    Edit: I have made one, heres the link : http://dev.bukkit.org/bukkit-plugins/playerboostpads/
     
  10. Offline

    Developerjohn

    ShearsSheep which part do I have to change the velocity on?
     
  11. Offline

    ShearsSheep

    Code:java
    1. e.getPlayer().setVelocity(e.getPlayer().getLocation().getDirection().multiply(4));

    see the ().multiplay(4)); ?? You could change the 4 to any other number , but i recommend it not to be over 10. Correct me if i'm wrong. The "4" is the effect of the launch , the higher the number , the higher/faster it launches the player.
     
  12. Offline

    Developerjohn

    ShearsSheep ok thanks. Idk if your right about the 10 thing because I didn't know how to make launch pads, until you helped me. I'll have to look into that.:D
     
  13. Offline

    ShearsSheep

    Anytime , if you need any help , buzz me in via skype: ShearsSheep
     
  14. Offline

    SmellyPenguin

    PlayerMoveEvent if called whenever a player's pitch, yaw, or coordinates change.
     
  15. Offline

    xTrollxDudex

    SmellyPenguin
    I realized that already... PlayerMoveEvent is often used in large plugins like WorldGuard, it is not frowned upon. What is frowned upon is cancelling it, perfect for someone you hate as their screen completely bugs out and they have to leave to prevent nausea. Again, you would check every 1-2 blocks the player moved.
     
  16. Offline

    BillyGalbreath

    just compare event.getTo() and event.getFrom(). if the X/Y/Z values all match, the player didnt really move.
     
  17. Offline

    SmellyPenguin

    If you're making multiple checks on PME with over a hundred players on a server, that's quite a lot of resources being used
     
  18. Offline

    xTrollxDudex

    SmellyPenguin
    If statements have a very minute memory/proccessor footprint, you can't expect to lag a server using hundreds of if statements. If statements probably have such a small memory usage the probably can't even fall under "resource intensive".
     
    BillyGalbreath likes this.
  19. Offline

    BillyGalbreath

    You could have 1000 players on a home-hosted slow server all running around and this would still not produce any lag.
    Code:java
    1.  
    2. @EventHandler
    3. public void onPlayerMove(PlayerMoveEvent event) {
    4. if (event.getTo().getBlockX() == event.getFrom().getBlockX() &&
    5. event.getTo().getBlockY() == event.getFrom().getBlockY() &&
    6. event.getTo().getBlockZ() == event.getFrom().getBlockZ()) {
    7. return; // Player never actually moved.
    8. }
    9. // Player DID move, do stuffs here
    10. }
    11.  
     
    MayoDwarf likes this.
  20. Offline

    SmellyPenguin

    Thanks for infos
     
Thread Status:
Not open for further replies.

Share This Page