Gladiator

Discussion in 'Plugin Development' started by Swagger_Saurus, Sep 4, 2014.

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

    Swagger_Saurus

    I am trying to code gladiator at the moment and i im struggling to do so. I'm trying to make it so when the player right clicked someone with an iron fence it will teleport them up into a glass dome, which if they try to break it will turn to bedrock, anf after 5min they get withered 1 until someone dies.
    Please help appreciate it.
     
  2. Offline

    mine-care

    How can we help? Any specific part you're stuck on?
     
  3. Offline

    Swagger_Saurus

    Well yes pretty much everything i need help with all the EventHandlers and the plugin.Gladiator .contains...
     
  4. Offline

    Anrza

    http://jd.bukkit.org/rb/apidocs/
    PlayerInteractEvent, Player.teleport(), BlockBreakEvent.
    New to bukkit? I'd start with something a bit easier. You might have great dreams and ideas, but it's better to make the big mistakes in the beginning and save the stuff you care about for later.
     
  5. Offline

    Swagger_Saurus

    Well i am new but im not that new, ive coded a hole kitpvp server, i just struggle with this kit only.
     
  6. Offline

    Anrza

    Swagger_Saurus
    I'm sorry, I doubted you because it seems really simple to me.

    Well, for getting if someone right clicked someone with an iron bar, I'd get the player's lineOfSight with the distance of three, and check if it contains the blocks of any nearby players.

    As for the breaking of glass, I'd recommend sending block updates to the player who tried breaking it. That way you don't have to actually change anything (no resetting of the map).
    To delay things, a syncDelayedTask is probably easiest.

    I think those are the most difficult things to do. Anything else you want help with, specifically?
     
  7. Offline

    Swagger_Saurus

    Well im not mad at you, however i am mad at this kit i know what events to do i know how to implement some coding just not all so if its okay with u, i basically need help with everything
     
  8. Offline

    Anrza

    Swagger_Saurus
    Show me what you have now and what your biggest issues are.
     
  9. Offline

    Swagger_Saurus

    Yeah sorry cant do that, after done trying to code it i went to test it when it didnt work i looked wat was the problem after countless hours of research and asking people how to do it i decided to give up so i may have deleted the code

    oh btw how do u code the deathmessages? i only know to do Player was killed by Player. So how do you do when someone dies from lava or when they die of fall damage if you know what i mean.

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

    Swagger_Saurus

    Can anyone help me?
     
  11. Offline

    Yekllurt

    @Swagger_Saurus
    If you follow this an change this in to code you have eveything exept the Wither where spawn's after 5 minutes
    If i woud give you the code it woud be feeding and you wouden't learn
    Remember to register the Event's
    If you want me to reply write Yekllurt in your message

    Create a new ArrayList called list

    Call the Event PlayerInteractEntityEvent
    Get the player who clicks in a variable
    Get the entity where get's clicked in a variable (IMPORTANT the variablre is an Entity)
    Check if the entity wich get's clicked is a Player
    Then make a new Player variable and cast the Entity variable to it
    Then Check if the player who clicks has an IRON_FENCE in his hand
    Then Check if the two Players aren't in the list (IMPORTANT check if the UUID is in the list)
    If then you create a new location (where they get teleportet)
    Teleport the two players to the location
    Add the two players to the list (IMPORTANT add the uuid of the two players to the list)

    Call the Event BlockBreakEvent
    Make a new Player variable for the player who destroyed the block
    Make a new Block variable for the destroyed Block
    Check if the player's UUID is in the list
    Check if the material of the Block ist Glass
    Then set the Block Material to BEDROCK

    Call the Event PlayerDeathEvent
    Make a new Player variable of the player who get's killed
    Check if the the player's UUID is in the list
    If then remove them from the list
     
  12. Offline

    Swagger_Saurus

    @Yekllurt
    Awsome thanks its works! However now i need help with another kit :p ive searched this up and i have no idea how to do it or should i say fix it. Its kit ninja, when you shift you teleport to the person you last hit. Here's my code so far. Cheers.

    @EventHandler
    public void ninja(EntityDamageByEntityEvent e) {
    if(e.getEntity() instanceof Player && e.getDamager() instanceof Player) {
    final Player p = (Player) e.getEntity();
    final Player dmger = (Player) e.getDamager();
    final String pName = dmger.getName();
    if(plugin.Ninja.contains(p.getName())) {
    if(plugin.Cooldown.contains(p.getName())) {
    } else {
    if(dmger.isSneaking()) {
    dmger.teleport(p);
    plugin.Cooldown.contains(p.getName());
    Bukkit.getScheduler().scheduleSyncDelayedTask(plugin, new Runnable() {
    public void run(){
    plugin.Cooldown.remove(pName);
    p.sendMessage(ChatColor.RED + "You may not tp yet!");
    }

    }, 140L);
    }
    }
    }
    }
    }
     
  13. Offline

    jpjunho

    Swagger_Saurus
    when they hit someone put them in a hashmap and then on PlayerToggleSneakEvent get the player from the hashmap and tp
     
Thread Status:
Not open for further replies.

Share This Page