So Im Trying To Make Rewards...

Discussion in 'Plugin Development' started by 16austin16, May 29, 2015.

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

    16austin16

    So I Am Trying To Make Rewards In A Commands And It Tracks The Kills And Deaths Already Its Just I Don't Know How I Can Make It To Where You Can Do A Command Like /reward add minecraft:diamond 10 5. The First Number Is Kills The Second It Quantity
     
    Last edited: May 30, 2015
  2. Offline

    Agentleader1

    On Death listener

    HashMaps

    Booleans.
     
  3. StOp WrItInG LiKe ThAt
     
    KingFaris11 likes this.
  4. Offline

    16austin16

    like The Only Thing I Need Is Really How To Convert Monecraft IDs To Material.Whatever
     
  5. Offline

    JoelyBob

    Why not just use Material?

    EDIT://

    Merged Posts (sorry for spam)

    Are you trying to make a command so when a player gets a certain amount of kills they can /reward and get a reward?

    Are you trying to make a command so when a player gets a certain amount of kills they can /reward and get a reward?

    EDIT by Timtower: and yet you still double post. Merged
     
    Last edited by a moderator: May 30, 2015
  6. Offline

    16austin16

    The Thing I Am Trying To Do Is Make It To Where A Player Gets x Kills They Automaticly Get The Reward Because I Am Doing It In The PlayerDeathEvent. Like I Got The /rewards [Add] [ID] [Amount] [Kills] Command And It Saves The Args In A File Called rewards.yml But I Don't Know How I Can Make It Give The Item.
     
  7. Offline

    Gater12

  8. Offline

    16austin16

    What Would I Use In The () Of The If Statement To Do This?
     
  9. Offline

    JoelyBob

    Okay, in that part;

    Code:
    public void onPlayerDeath(PlayerDeathEvent event) {
    
    //Add this \/
    
    Player k = event.getEntity().getKiller();
    That is defining the killer.

    Code:
    k.getInventory().addItem(new ItemStack(Material.DIAMOND, 1));
    
    //replace diamond with the reward and 1 with the amount.
    That is creating the reward.
     
  10. Offline

    16austin16

    thx but i have that here is my whole event thing
    Code:
        @EventHandler
        public void onPlayerKillEvent(PlayerDeathEvent event) {
            Player killed = event.getEntity();
            Player killer = event.getEntity().getKiller();
    //        if(killer == killed) {
    //            return;
    //        } else {
                Main.user.set("Players." + killer.getName() + ".Kills", Main.user.getInt("Players." + killer.getName() + ".Kills") + 1);
                Main.user.set("Players." + killed.getName() + ".Deaths", Main.user.getInt("Players." + killed.getName() + ".Deaths") + 1);
        // I Need Help Here\/\/\/\/\/\/\/\/       
    if(Main.rewards.getStringList("Rewards.Kills").get(Main.user.getInt("Players." + killer.getName() + ".OnRewards")) == Main.user.get("Players." + killer.getName() + ".Kills")) {
                    killer.sendMessage("Completed If Statment! Fuck YES!");
                    killer.sendMessage("You Now Get " + Main.rewards.getStringList("Rewards.ItemID").get(Main.user.getInt("Players." + killer.getName() + ".OnRewards")));
                    Main.user.set("Players." + killer.getName() + ".OnRewards", Main.user.getInt("Players." + killer.getName() + ".OnRewards") + 1);
                }
    //        }
            Main.saveYamls();
        }
    The Comment Outs Are For Testing It By Killing Myself xD But In The If IDK What I Would Put Because The Player Types A Command And It Saves The Args That Are The ItemId Amount And Kills And They Are Saves In A String List.
     
    Last edited: May 30, 2015
  11. Offline

    16austin16

    *Bump*
    Dont Delete Look At Times
    Last Post: Yesterday at 12:05 AM
    This One: 2:01 AM
     
Thread Status:
Not open for further replies.

Share This Page