Kits once per life

Discussion in 'Bukkit Help' started by Denny7m, Sep 27, 2016.

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

    Denny7m

    So i'm creating KitPvP for my server, but i want players to use a kit only once per life,
    Ive been looking on some other threats but none of them solved my problem,
    In case you wanna help me, this is the kit:
    Code:
     Warrior:
        delay: 6000
        items:
        - 276:0 1
        - 306:0 1
        - 307:0 1
        - 308:0 1
        - 309:0 1
        - 373:16453 1
        - 373:16453 1
        - 364:0 8
        - 322:0 2
        - 373:16453 1
        - 373:16453 1
     
  2. Offline

    Lordloss

    The easiest way is using the configuration API. Store the players which allready got the kit into a list and save it. On join check if they are in it.
     
  3. Offline

    Denny7m

    But no-one got that kit yet, and i just want to know how to get it only usable once PER LIFE! Isnt there any scripts or codes, or maybe there is a good kitpvp plugin..
    ;)
     
  4. Offline

    timtower Administrator Administrator Moderator

    @Denny7m Store who got it already in that life, if they die: remove them from storage, if they get it again: add to storage.
     
  5. Offline

    Ste4lthPr0xy

    you could just add some booleans, so for example if u have the kit named: "kitpvp" just add some booleans in every kit... what i mean with that is, that the boolean is called "kitpvpused" (or whatever u want, for each class)... so at the moment the player is recieving the kit, the "kitpvpused" boolean turns from false to true... after that the only thing u will have to do is, simply add:

    Code:
    
    public boolean onInfo(CommandSender sender, Command cmd, String label, String[] args) {
        if(cmd.getName().equalsIgnoreCase("What ever ur command is")) {
            /*
            * your code
            */
            if(kitpvpused == true) {
                player.sendMessage("You have allready used that kit");
                return false;
            /*
            * your code, to give the player the kit...
            */
            }
        }
    }
    
    
    
    so that was out of my mind, i dont really know if everything is okay with that code, because i cant test it right now... but that is how i would fix the same problem you have right now :)

    .... sorry for my bad english or grammar skills :D ... im from Germany :p

    EDIT:

    if u want it to be for once per life, just simply set the booleans on true (if the aren't allready) on a PlayerRespwanEvent for example or whatever event u want to use to define when excactly a "new life" begins :D
     
  6. Offline

    timtower Administrator Administrator Moderator

    @Ste4lthPr0xy That would be a kit per life for the entire server at the same time.
    1 player claims, everybody needs to wait
     
  7. Offline

    JanTuck

    @Denny7m
    Code:java
    1.  
    2. List<UUID> kitPerLifeDeathList = new ArrayList<UUID>();
    3.  


    Then add them when they use the kit (Check if list contains before giving them) and remove them when the EntityDeathEvent. And see if the List contains the specified players UUID and remove them.

    To see if a List contains the variable you could use something like.

    Code:java
    1.  
    2. kitPerLifeDeathList.contains(player.getUniqueID());
    3.  


    Remember these variables can be a bit off considering this is all done in a web browser always test for yourself.
     
  8. Offline

    Denny7m

    Can someone edit it in for me? its not that im lazy, but i have no idea how to start.
    The File:
    Code:
    # 
    # +------------------------------------------------------+ #
    # |                       Notes                          | #
    # +------------------------------------------------------+ #
    ops-name-color: '4'
    nickname-prefix: ''
    max-nick-length: 15
    change-displayname: true
    teleport-safety: true
    teleport-cooldown: 0
    teleport-delay: 0
    teleport-invulnerability: 4
    heal-cooldown: 60
    permission-based-item-spawn: false
    spawnmob-limit: 10
    warn-on-smite: true
    socialspy-commands:
    - msg
    - w
    - r
    - mail
    - m
    - t
    - whisper
    - emsg
    - tell
    - er
    - reply
    - ereply
    - email
    - action
    - describe
    - eme
    - eaction
    - edescribe
    - etell
    - ewhisper
    - pm
    player-commands:
    - afk
    - afk.auto
    - back
    - back.ondeath
    - balance
    - balance.others
    - balancetop
    - build
    - chat.color
    - chat.format
    - chat.shout
    - chat.question
    - clearinventory
    - compass
    - depth
    - delhome
    - getpos
    - geoip.show
    - help
    - helpop
    - home
    - home.others
    - ignore
    - info
    - itemdb
    - kit
    - kits.tools
    - list
    - mail
    - mail.send
    - me
    - motd
    - msg
    - msg.color
    - nick
    - near
    - pay
    - ping
    - protect
    - r
    - rules
    - realname
    - seen
    - sell
    - sethome
    - setxmpp
    - signs.create.protection
    - signs.create.trade
    - signs.break.protection
    - signs.break.trade
    - signs.use.balance
    - signs.use.buy
    - signs.use.disposal
    - signs.use.enchant
    - signs.use.free
    - signs.use.gamemode
    - signs.use.heal
    - signs.use.info
    - signs.use.kit
    - signs.use.mail
    - signs.use.protection
    - signs.use.repair
    - signs.use.sell
    - signs.use.time
    - signs.use.trade
    - signs.use.warp
    - signs.use.weather
    - spawn
    - suicide
    - time
    - tpa
    - tpaccept
    - tpahere
    - tpdeny
    - warp
    - warp.list
    - world
    - worth
    - xmpp
    kits:
      tools:
        delay: 10
        items:
        - 272 1
        - 273 1
        - 274 1
        - 275 1
      dtools:
        delay: 600
        items:
        - 278 1 efficiency:1 durability:1 fortune:1 name:&4Gigadrill lore:The_drill_that_&npierces|the_heavens
        - 277 1 digspeed:3 name:Dwarf lore:Diggy|Diggy|Hole
        - 298 1 color:255,255,255 name:Top_Hat lore:Good_day,_Good_day
        - 279:780 1
      skull:
        delay: 6000
        items:
        - 397:3 1 player:Denny7m
      color:
        delay: 6000
        items:
        - 387 1 title:&4Book_&9o_&6Colors author:KHobbits lore:Ingame_color_codes book:Colors
      firework:
        delay: 6000
        items:
        - 401 1 name:Angry_Creeper color:red fade:green type:creeper power:1
        - 401 1 name:StarryNight color:yellow,orange fade:blue type:star effect:trail,twinkle power:1
        - 401 2 name:SolarWind color:yellow,orange fade:red shape:large effect:twinkle color:yellow,orange fade:red shape:ball effect:trail color:red,purple fade:pink shape:star effect:trail power:1
      Warrior:
        delay: 600
        items:
        - 306:0 1
        - 307:0 1
        - 308:0 1
        - 309:0 1
        - 276:0 1
        - 322:0 2
        - 364:0 8
        - 373:16421 1
        - 373:16421 1
        - 373:16421 1
        - 373:16421 1
      Pyro:
        delay: 600
        items:
        - 302:0 1 protection_fire:2
        - 303:0 1 protection_fire:2
        - 304:0 1 protection_fire:2
        - 305:0 1 protection_fire:2
        - 283:0 1 fire_aspect:2
        - 373:16451 1
        - 373:16451 1
        - 322:0 2
        - 364:0 4
        - 373:16421 1
        - 373:16421 1
        - 373:16421 1
        - 373:16421 1
      Archer:
        delay: 600
        items:
        - 298:0 1 color:153,51,51
        - 299:0 1 color:153,51,51
        - 300:0 1 color:153,51,51
        - 301:0 1 color:153,51,51
        - 261:0 1 arrow_damage:2 arrow_infinite:1
        - 268:0 1 knockback:1
        - 322:0 2
        - 364:0 6
        - 373:16421 1
        - 262:0 1
        - 373:16450 1
        - 373:16450 1
        - 373:16421 1
        - 373:16421 1
        - 373:16421 1
        - 373:16421 1
      Wizard:
        delay: 600
        items:
        - 298:0 1 protection_environmental:1 color:127,63,178
        - 299:0 1 protection_environmental:1 color:127,63,178
        - 300:0 1 protection_environmental:1 color:127,63,178
        - 301:0 1 protection_environmental:1 color:127,63,178
        - 283:0 1 fire_aspect:2
        - 268:0 1 knockback:2
        - 322:0 2
        - 364:0 6
        - 373:16421 1
        - 373:16428 1
        - 373:16450 1
        - 373:16451 1
        - 373:16427 1
        - 373:16427 1
        - 373:16428 1
        - 373:16452 1
        - 373:16421 1
        - 373:16421 1
        - 373:16421 1
        - 373:16421 1
    enabledSigns:
    - color
    - buy
    - sell
    - trade
    - disposal
    - kit
    - enchant
    - heal
    - repair
    sign-use-per-second: 4
    backup:
      interval: 30
    per-warp-permission: false
    list:
      Admins: owner admin
    debug: false
    locale: en
    remove-god-on-disconnect: false
    auto-afk: 300
    auto-afk-kick: -1
    freeze-afk-players: false
    disable-item-pickup-while-afk: false
    cancel-afk-on-interact: true
    cancel-afk-on-move: true
    death-messages: true
    allow-silent-join-quit: false
    custom-join-message: '&7[&a+&7] &7{DISPLAYNAME}'
    custom-quit-message: '&7[&c-&7] &7{DISPLAYNAME}'
    world-teleport-permissions: false
    default-stack-size: -1
    oversized-stacksize: 64
    repair-enchanted: true
    unsafe-enchantments: false
    register-back-in-listener: false
    login-attack-delay: 5
    max-fly-speed: 0.8
    max-walk-speed: 0.8
    mails-per-minute: 1000
    max-tempban-time: -1
    update-bed-at-daytime: true
    world-home-permissions: false
    sethome-multiple:
      default: 3
      vip: 5
      staff: 10
    tpa-accept-cancellation: 120
    starting-balance: 0
    currency-symbol: $
    max-money: 10000000000000
    min-money: -10000
    economy-log-enabled: false
    non-ess-in-help: true
    hide-permissionless-help: true
    chat:
      radius: 0
      format: <{DISPLAYNAME}> {MESSAGE}
    protect:
      prevent:
        lava-flow: false
        water-flow: false
        water-bucket-flow: false
        fire-spread: true
        lava-fire-spread: true
        flint-fire: false
        lightning-fire-spread: true
        portal-creation: false
        tnt-explosion: false
        tnt-playerdamage: false
        tnt-minecart-explosion: false
        tnt-minecart-playerdamage: false
        fireball-explosion: false
        fireball-fire: false
        fireball-playerdamage: false
        witherskull-explosion: false
        witherskull-playerdamage: false
        wither-spawnexplosion: false
        wither-blockreplace: false
        creeper-explosion: false
        creeper-playerdamage: false
        creeper-blockdamage: false
        enderdragon-blockdamage: true
        enderman-pickup: false
        villager-death: false
        entitytarget: false
        spawn:
          creeper: false
          skeleton: false
          spider: false
          giant: false
          zombie: false
          slime: false
          ghast: false
          pig_zombie: false
          enderman: false
          cave_spider: false
          silverfish: false
          blaze: false
          magma_cube: false
          ender_dragon: false
          pig: false
          sheep: false
          cow: false
          chicken: false
          squid: false
          wolf: false
          mushroom_cow: false
          snowman: false
          ocelot: false
          iron_golem: false
          villager: false
          wither: false
          bat: false
          witch: false
          horse: false
      creeper:
        max-height: -1
      disable:
        fall: false
        pvp: false
        drown: false
        suffocate: false
        lavadmg: false
        projectiles: false
        contactdmg: false
        firedmg: false
        lightning: false
        wither: false
        weather:
          storm: false
          thunder: false
          lightning: false
        build: true
        use: true
        warn-on-build-disallow: true
      alert:
        on-placement: 10,11,46,327
        on-use: 327
      blacklist:
        placement: 10,11,46,327
        usage: 327
    newbies:
      announce-format: '&0{DISPLAYNAME} &cHas joined for the first time!'
      spawnpoint: newbies
      kit: tools
    respawn-listener-priority: high
    respawn-at-home: false
     
    Last edited by a moderator: Sep 27, 2016
  9. Offline

    timtower Administrator Administrator Moderator

    Moved to Bukkit help as it doesn't seem to be for developing an own plugin.
     
    oceantheskatr and Denny7m like this.
  10. Offline

    Ste4lthPr0xy

    @timtower well, sorry for that ^^ ... maybe i didnt really think twice...
     
Thread Status:
Not open for further replies.

Share This Page