Bukkit devolopment problem

Discussion in 'Plugin Development' started by Icanthough, Nov 20, 2013.

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

    Icanthough

    I have been working on a lot of plugins,
    I just have a few questions... ( By the way i have been coding for 1 year so i am very new and not experiened much)

    So this is what i need,
    The ability so players can enable/disable lifting people up or make that as a permission E.G RightClick.Lift
    or some command like that ALSO,

    How do i make it when you interact with a block LIKE hit it you either die or get tped back to the start of the minigame? I know i have asked this before but i'm very new can someone show me how/where to put the teleportation location and how do i do this and where do i put the block id for when they hit it?,

    And last but not least how do i make it so you ride on a something when the minigame starts?
    Or could i make it like using bungeecord they start on a boat/horse/whatever when they first join then when i reload the server it restarts everything?
    Thanks please help!
     
  2. Offline

    Jamesthatguy

    This was basically a giant explosion of I don't even know what. It doesn't seem like you know the first thing of what you are talking about and diving into a large project. I suggest starting with something smaller and learning the basics first.
     
  3. Offline

    boysnnoco

    To teleport a player do:
    Code:java
    1. p.teleport(new Location(p.getWorld(),x,y,z))//x y and z represent the cords you want to tp the player :)
    2.  

    I think that is what you wanted but if you need something else just hollar!
    (there is also a .setPassenger in bukkit for that last part and first part)
     
  4. Offline

    Dr_Bunsen

    I think the meaning was, that you get teleported to a location when you interact with a block at a given location.


    @op So a catch block interaction and compare the block location against the given location wheter you want to teleport or not.
     
  5. Offline

    boysnnoco

    Dr_Bunsen likes this.
  6. Offline

    1Rogue

    Well if you want to make it so that people are teleported on interacting with blocks, I suppose you could listen for breaks:

    Code:java
    1. Location loc; //predetermined
    2.  
    3. @EventHandler public void onBlockBreak(BlockBreakEvent event) {
    4. Player p = event.getPlayer();
    5. if (!p.hasPermission("example.override") {
    6. // teleport player to pre-determined location
    7. p.teleport(loc);
    8. p.sendMessage("Don't break blocks!");
    9. }
    10. }
     
  7. Offline

    boysnnoco

    You can also do this
    Code:java
    1. @EventHandler
    2. public void onMove(PlayerMoveEvent event){
    3. if(event.getPlayer().getLocation().getBlock().getRelative(BlockFace.DOWN).getType().equals(Material.[YourBlock])){
    4. Player player = (Player)event.getPlayer();
    5. player.teleport(new Location(player.getWorld(),x,y,z))//X y and z being the cords you want to tp the player
    6. }else{
    7. return;
    8.  
    9. }
    10. }

    Basically whenever the player moves it check the block on bottom and checks if it is whatever the block you want it to be, and if it is it will tp them back to the start.
    1Rogue your way works fine to mine is like a "follow up" so someone doesn't have to break a block
     
  8. Offline

    Dr_Bunsen

    boysnnoco That is actually quite brilliant
     
  9. Offline

    PolarCraft

    Dr_Bunsen boysnnoco Icanthough
    This is what i did.
    Code:java
    1. @EventHandler
    2. public void onPlayerMove(PlayerMoveEvent e)
    3. {
    4. if(e.getFrom().getBlockX() != e.getTo().getBlockX() || e.getFrom().getBlockY() != e.getTo().getBlockY() || e.getFrom().getBlockZ() != e.getTo().getBlockZ())
    5. {
    6. Location location = e.getTo();
    7. Block b = location.getBlock().getRelative(BlockFace.DOWN);
    8.  
    9. if(b.getType() == Material.WOOL && b.getData() == (byte)10)//CHANGE THIS TO YOUR TYPE OF BLOCK
    10. {
    11. e.getPlayer().teleport(new Location(Bukkit.getWorld("YOURWORLD"), YOURCOORDS));
    12. }
    13. }
    14. }
    15. }
     
  10. Offline

    Dr_Bunsen

    Aren' t we forgetting that the op wanted a click on block teleport?
     
  11. Offline

    McMhz

    So, Click on a block and tp to it?
     
  12. Offline

    Dr_Bunsen

    Just take one of the example event codes, and replace with interacting ;P
     
Thread Status:
Not open for further replies.

Share This Page