Filled Kill to heal and feed.

Discussion in 'Plugin Requests' started by Emperor Aiman, Feb 25, 2015.

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

    Emperor Aiman

    Plugin category: IDK

    Suggested name: KitPvP

    What I want:
    I would like a plugin which does the following things:
    1- When the player killes someone, give him/her 10$ (Through essentials eco) and tell him/her "You have received $10" also delete any potions effect or gapple effect on him.
    2 - do /heal (Essentials)
    3- For the victim player, do the command /kit Default as an op on respawn.
    And make all new players get kit Default on login.
    4 - Make it so that all the players end up on spawn every time they log in.

    Ideas for commands: No commands needed for this plugin.

    Ideas for permissions: No permissions needed.

    When I'd like it by: Anytime, but I think this is very simple so I would appreciate if you make it fast :D
     
    Last edited: Feb 26, 2015
  2. Offline

    au2001

    @Emperor Aiman Making that right now :p
    It will use vault for the money, and it won't use Essentials for the heal part (it will be the exact same thing).
    I'll also make a config to configure the message and the amount of money you get by killing someone/dying.

    EDIT: I already made a plugin named "KitPvP" so is it okay if I name it "KitPvPAssist" ?

    EDIT 2: Oh and it will be compiled in 1.7 since this isn't in bukkit alternatives, but it should still work in any 1.8 version (won't be tested though).
     
  3. Offline

    Emperor Aiman

    Oh thanks, I won't mind if it's called KitPvPAssist.
     
  4. Offline

    au2001

    Apotheose likes this.
  5. Offline

    Emperor Aiman

    @au2001 Thank you very much for making this plugin :). There are somethings I want changed.
    1. I only want kit Default when the player logs in the first time to the server
    2. When loggin in at other times,keep the same kit with no changes.
    3. BUG: When the player dies, his armour is not lost :p
    4. Please send a messege to killer when he is healed and has received $10. It would be very good if it's configurable in the confog file.
    5. Execute the "/kit Default" as OP and as the player, it's a player command (I am using KitEssentials plugin). Players have no permission to "/kit Default"
    6. Also, if a staff executes /kill, can you make the staff to become killer and get all the things the killer gets? Like receiving money, health, and the broadcast message.(I am using the DeathMessages plugin to broadcast when someone kills a player.
    Thanks :)
     
  6. Offline

    au2001

    @Emperor Aiman Okay, I'll change n°1 and 2.
    For the n°3, you can change that in the config ;)
    Woops, forgot to do n°4 ^.^ I'll do that right now.
    For n°5, I execute it as the console, not as the player, is that good?
    And n°6 I'll try to do that, yes :p

    EDIT : And I can make the death message configurable if you want, so that you don't have to install DeathMessages.

    EDIT 2: I gtg now, so I uploaded the current version to the same url, the n°6 isn't done though :(
     
    Last edited: Feb 26, 2015
  7. Offline

    Emperor Aiman

    You are awesome.
    "For n°5, I execute it as the console, not as the player, is that good?" Will the player get the kit if the console does "\kit Default"? It does not have an option of specifying which player to give the kit, so the players should do it themselves. But they don't have permission (To prevent abusing). That's why I am asking to make it run as if the player was an OP.
    EDIT1: No it's ok. :)
    EDIT2: Hope you do 6 soon :)
    Thanks again.

    P.S I think it would be great if there was an option to delete the player drops after they die.
    P.S2 Can you give me the source? I know C# I think I can tweak some little things :D

    EDIT by Timtower: merged posts
     
    Last edited by a moderator: Feb 27, 2015
  8. Offline

    timtower Administrator Administrator Moderator

  9. Offline

    au2001

    Ooooooh, sorry didn't understand that, I thought you could do "/kit {PLAYER} Default", like in Essentials.
    Well, what I did is that I give them a permission (with Vault, configurable in the config), execute the command, and then remove the permission (unless they had it before).
    Making them OP would be way to dangerous in case of error or something like that...

    And for n°6, I override the command, so if they use /ekill it won't work (same for /essentials:kill and /essentials:ekill).
    But tell them just to use /kill if they want to get the bonuses ;)
    I'll re-upload it and tell you when it's done.

    @timtower Yes, they do... But what's the problem? x)
    Do you mean we can't execute a command "as if they were OP"?
    Because we can use :
    Code:
    boolean wasOp = player.isOp();
    player.setOp(true);
    Bukkit.dispatchCommand(player, command);
    player.setOp(wasOp);
    EDIT: Woops, the PS part didn't show, I had to refresh the page ^.^
    @Emperor Aiman Well, here is the source but as @timtower said, it is java ;)
    Oh and the permission for /kill is KitPvPAssist.kill
    And I just uploaded it to the same url: http://www.shadowcasted.com/plugins/KitPvPAssist.jar
     
    Last edited: Feb 27, 2015
  10. Offline

    Emperor Aiman

  11. Offline

    au2001

    @Emperor Aiman Wooops, I'm such a noob, forgot to do that x)

    Just fixed it, you can download the new version (still the same link).
     
  12. Offline

    Emperor Aiman

    Thank you so much. But it seems that firsttime users are not getting the kit. They are getting the essentials Tools kit instead I disabled the essentials option and now they are not getting anything.
     
    Last edited: Feb 27, 2015
  13. Offline

    au2001

    @Emperor Aiman Are you sure you have Vault and a Permission plugin installed?
    If this is the case, I just changed something to use the hasPlayedBefore() method.
    It shouldn't change anything, but just in case, try updating the plugin.
     
  14. Offline

    Emperor Aiman

    @au2001
    Yes I have vault and Pex.
    Ok,now the players get the kit on first login. But when they respawn, it says they don't have permission.
    Anyway, please remove the permission thing. I will just give them default kit permission :)

    Another thing, the kill command does not kill users with armour. It goes to half health and stays like that.
    Also, can you please tell the player that they have been healed?

    P.S I just tried to compile your plugin in eclipse but it gave me errors saying that getHealth is ambiguous or something.
     
  15. Offline

    timtower Administrator Administrator Moderator

    @Emperor Aiman Why would you compile it yourself when you talk to the developer :confused:
     
  16. Offline

    Emperor Aiman

    I have been trying to compile a plugin correctly so I took his source and tried to compile it. :p With the config and plugin yml of course.
     
    Last edited: Feb 27, 2015
  17. Offline

    au2001

    @Emperor Aiman If it says it's Ambiguous for the type Player, add a cast to Damageable, it will fix it.
    And for the permission thing, I don't see anything that could cause the error...
    Here is my code where I added comments (if someone like @timtower could help me :D) :
    Code:
    @SuppressWarnings("deprecation")
    @EventHandler
    public void onPlayerRespawn (PlayerRespawnEvent event) {
        // Make the player respawn at spawn.
        event.setRespawnLocation(Bukkit.getWorld(getConfig().getString("respawnWorld")).getSpawnLocation());
        // Clear the player's inventory.
        event.getPlayer().getInventory().clear();
        // Deprecated, but needed to update the player's inventory.
        event.getPlayer().updateInventory();
        // If the player doesn't have acces to the kit permission
        if (!event.getPlayer().hasPermission(getConfig().getString("kitPermission"))) {
            // Checks if Vault is installed.
            if (Bukkit.getPluginManager().getPlugin("Vault") instanceof Vault) {
                // Checks if a permission plugin is installed.
                if (Bukkit.getServicesManager().getRegistration(Permission.class) != null) {
                    // Gets the permission plugin with Vault.
                    Permission perms = Bukkit.getServicesManager().getRegistration(Permission.class).getProvider();
                    // Adds the permission to the player.
                    perms.playerAdd(event.getPlayer(), getConfig().getString("kitPermission"));
                    // Makes him execute the command.
                    Bukkit.dispatchCommand(event.getPlayer(), getConfig().getString("defaultKitCmd"));
                    // Removes the permission.
                    perms.playerRemove(event.getPlayer(), getConfig().getString("kitPermission"));
                    // Makes sure the dispatchCommand isn't run twice.
                    return;
                }
            }
        }
        // Run the command if he has the command or if Vault isn't installed.
        Bukkit.dispatchCommand(event.getPlayer(), getConfig().getString("defaultKitCmd"));
    }
     
  18. Offline

    Emperor Aiman

    I don't know why, but it says "You don't have permission" only on respawn, not on first login. :/

    Which eclipse version are you using? Can you send me the project file? I am not able to get even a single plugin to compile correctly. :/ For example, I just made a plugin with a /test command but it did not show in the server /plugins

    EDIT by Timtower: merged posts
     
    Last edited by a moderator: Feb 27, 2015
  19. Offline

    au2001

    Last edited: Feb 27, 2015
  20. Offline

    Emperor Aiman

    @au2001 No I don't get the kit in the inventory.
    can you please fix the kill command issue?
     
  21. Offline

    au2001

    What issue with the /kill command? Is it not working??
     
  22. Offline

    Emperor Aiman

    Yes, if the player is wearing armour, it just damages the player by some hearts and no matter how much I type the command, the player's health never goes less than 1/2 heart.
    P.S How to get rid of this moderator approval things? Why am I getting this?
    I was able to compile the plugin successfully :). So give me only source now :).
    P.S2 How to prevent users from dropping items by using q or dropping out of their inventory? I installed an antibuild plugin, but it's broken.
     
    Last edited: Feb 27, 2015
  23. Offline

    au2001

    @Emperor Aiman Ooooh, yes, sorry, forgot about that :x
    What do you mean by Moderator approval? Can you send a link?
    And for the dropping thing, the Plugin Developpement forum would be more appropriate, but here is the code :
    Code:
    @EventHandler
    public void onPlayerDropItem (PlayerDropItemEvent event) {
        event.setCancelled(true);
    }
    It's very simple, so I hope you can understand what it does ^.^
     
  24. Offline

    mrCookieSlime

    @au2001 @Emperor Aiman
    What he means by way of "moderator approval" is a restriction for newly joined members. Each post of new members needs to be reviewed by a member of staff first. This will go away after a week, no need to worry about this.
     
  25. Offline

    au2001

  26. Offline

    mrCookieSlime

    @au2001
    You did have that once. There are three circumstances which require moderator attention:
    - member since < 7 days
    - < 10 posts
    - > 2 warnings

    You definitely posted your first ten messages at some point for sure.
     
  27. Offline

    au2001

    @mrCookieSlime Hmm, must have been so long ago ._. But thanks for these precisions ;)
     
  28. Offline

    Emperor Aiman

    Lol, I executed that command in the pvp protected area(world guard) and the whole server crashed :v
    Is there anyway to stop that?
    P.S Aboout no drop: Dragging out of inventory makes the item diappear :eek: Ah, world guard has a way of doing it. :D item-drop deny :)
     
    Last edited: Feb 27, 2015
  29. Offline

    au2001

  30. Offline

    Emperor Aiman

    @au2001
    Code:
    victim.damage(((Damageable) victim).getHealth()*100);
    Works :)
     
    Last edited: Feb 27, 2015
Thread Status:
Not open for further replies.

Share This Page