Inactive [FUN/MECH] Duels v0.7.0 - Arranged PVP between players. [Major Economies][Permissions][1000]

Discussion in 'Inactive/Unsupported Plugins' started by zonedabone, Jun 14, 2011.

  1. Offline

    zonedabone

    NOTE: The plugin has been moved to the bukkitDev site here.


    Duels - A simple plugin to control battles between players - Safe PVP:
    Version: v0.7.0

    Duels controls PVP so that two players can fight only if they have both agreed. It also allows users to define terms for a battle, such as whether or not items are lost on death, what each player stakes, (iConomy) whether or not food can be eaten, if wolves will fight at your side, etc. It is currently under heavy development but testing is highly welcomed and appreciated.

    Features:
    • Blocks PVP between players that aren't dueling.
    • Allows for staking over a duel by participants. (iConomy)
    • Player forfeits match if they log out or run away.
    • Allows keeping of item on death, else puts drops directly in winner's inventory.
    • Controls wolves based on a setting.
    • Controls food use based on duel settings.
    • Messages can be set by a configuration value.
    Downloads:

    Download Duels (WGet)

    Source Code

    Instructions/Wiki

    How To Use:
    • Download Duels.jar and put it in your plugin directory.
    • Restart your server or /reload.
    • Edit the configuration at /plugins/Duels/config.yml to fit your needs.
    • Restart your server or /reload.
    • The plugin is now ready to use!
    • To initiate a duel with someone, type:
    Code:
    /duel challenge <player>
    • The other person will receive a notification. Accept duels with:
    Code:
    /duel challenge <player>
    • Once the duel has been accepted by both people, it is time to configure the duel using any of these parameters:
    Code:
    /duel set stake <money>      - Sets how much money you are staking.
     
    /duel set food <on/off>      - enables or disables food use.
    /duel set wolves <on/off>    - enables or disables wolves.
    /duel set keepitems <on/off> - sets whether you lose your items on death.
    • When you are satisfied with the current duel parameters, use:
    Code:
    /duel confirm
    • Once both players confirm, it's a fight to he death!
    Disabling in certain worlds:


    To disable in worlds, add this to the end of your config:
    Code:
    disabledworlds:
        - worlds
        - go
        - here
    Permission Nodes:
    The permissions nodes are divided into two main sections, user and admin.
    (Nodes with a # are for features that aren't yet implemented)
    • duels
      • user
        • challenge - can challenge others to duels
        • set
          • stake - can set a new stake
          • wolves - can change wolf settings
          • food - can change food settings
          • keepitems - can change keepitems settings
        • #admin - admin tasks
        • #peace - can stop all duels in progress
    To give users access to standard functions, simply give them the following node:

    Code:
    duels.user.*
    For admin tasks, (Not yet added) give users the following node:
    Code:
    duels.admin.*
    Some times, you might want to force a duel parameter to stay at the default setting. (Defined in the config) to do this, you can cancel out the node for that option. For example, if you always want users to lose items on death, (If defined in the config) you could add the following node to users:
    Code:
    -duels.user.set.keepitems
    To Do:
    • General bug fixing. (Pretty much bug free)
    • Add support for bukkit perms. (Can't wait?)
      • Depreciate permissions.
    If you have any ideas for additions, please post them on this thread. If you want to help out, you can fork the project on github and make any changes you'd like. I'll be sure to look at any pull requests!​

    Bugs:
    I currently know of no bugs in particular with Duels, though I'm sure there are some. If you find a problem, please be sure to post a detailed bug report on this thread.​

    Changelog:
    Version 0.7.0
    • Added support for more economies with Register. (iCo4, iCo5, BOSE, Essentials) As more economies are added to register, we will support them.
    Version 0.6.2
    • Added option to allow pvp outside of duels. (noduelpvp)
    Version 0.6.1
    • Added back commands. (No idea how they got removed)
    • Added back force fields. (Disabled by default) Try them out and tell me how they work! (I'm hoping they'll work again with bukkit 928)
    Version 0.6.0
    • Fixed bugs when parsing chat colors.
    • Added highscores support with ELO algorithm.
    • Added support for disabling in certain worlds.
    Version 0.5.0
    • Added permissions support!
    • Added ability to set default duel parameters.
    Version 0.4.0
    • Added configuration system. (Not all messages have been added yet!)
    • Fixed a few bugs. (Less serious this time ;))
    • Cleaned up the code a bit.
    Version 0.3.0
    • Cleaned up item respawn system.
    • Added food control!
    Version 0.2.0
    • Added wolf control.
    Version 0.1.0
    • Initial plugin release.
     
    KragTheDark and kahlilnc like this.
  2. Offline

    Klausar

    Any bugs?
     
  3. Offline

    zonedabone

    There are some bugs, but I've fixed the major show-stopping ones and it's pretty stable. I wouldn't recommend you put it on a huge production server, but I've been running it on mine without too many problems.

    It's sort of my summer project currently, so I'm devoting a lot of time to it. It will only get better, and if more people test it, I can find more bugs and fix more bugs.

    I'd say that it's becoming less buggy. In the recent builds I haven't been having as many errors, and the feature set is starting to get to where I'm wanting it to be. I'd really love it if people tried it out!

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

    LeGenDaryX

    The idea is great but it doesnt do anything for me.. only gives me errors.
    Code:
    	at org.bukkit.command.PluginCommand.execute(PluginCommand.java:37)
    	at org.bukkit.command.SimpleCommandMap.dispatch(SimpleCommandMap.java:128)
    	at org.bukkit.craftbukkit.CraftServer.dispatchCommand(CraftServer.java:287)
    	at net.minecraft.server.NetServerHandler.handleCommand(NetServerHandler.java:712)
    	at net.minecraft.server.NetServerHandler.chat(NetServerHandler.java:678)
    	at net.minecraft.server.NetServerHandler.a(NetServerHandler.java:671)
    	at net.minecraft.server.Packet3Chat.a(Packet3Chat.java:32)
    	at net.minecraft.server.NetworkManager.b(NetworkManager.java:226)
    	at net.minecraft.server.NetServerHandler.a(NetServerHandler.java:75)
    	at net.minecraft.server.NetworkListenThread.a(SourceFile:105)
    	at net.minecraft.server.MinecraftServer.h(MinecraftServer.java:399)
    	at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:309)
    	at net.minecraft.server.ThreadServerApplication.run(SourceFile:422)
    Caused by: java.lang.ClassCastException: [Ljava.lang.Object; cannot be cast to [Ljava.lang.String;
    	at zonedabone.Duels.MessageParser.parseMessage(MessageParser.java:23)
    	at zonedabone.Duels.MessageParser.parseMessage(MessageParser.java:10)
    	at zonedabone.Duels.Duels.onCommand(Duels.java:109)
    	at org.bukkit.command.PluginCommand.execute(PluginCommand.java:35)
    	... 12 more 
    Alright i got a duel to work! But.. setting up the duel feels a bit weird. You don't know what the other person picks?

    Also after the fight, it kept spamming You've lost the duel and i had to relogin with both players to make it stop.

    & I use the tombstone plugin, and when the person died all of his stuff just went to the chest. While i setup the duel for keeping the items.

    Hope you understand and can fix this ^^


    BTW would it be possible to set the duel parameters in the config file? so you can have a standard duel so you can begin fighting immediately?

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

    zonedabone

    I fixed the array cast errors. Thanks for the bug report!
    About the spamming in the console, I have no idea how that would happen. I'll look into it.
    I will be adding a section to the config to set default options. I may also add one to skip configuration.
    I don't know how this would interact with tombstone. This does a lot of stuff on player death, and since you can't cancel PlayerDeathEvent, I don't think it would be possible to stop tombstone during duels.

    Since it appears that the author of tombstone is being an impossible-to-deal with idiot, I don't think integration with his plugin would be an idea, unless I made a little fork that disabled it during duels. (It shouldn't be too hard.)
     
  6. Offline

    LeGenDaryX

    I tested the new version 0.4.3 and the spamming stopped!
    The only bug i have left now. Is that when i killed the other guy I didn't got a message i won the battle. But when i logged out, he got the message he won the battle.

    Also thanks for trying to implent my suggestions and fast bug fixes! This thing is gonna be great. I have a colloseum on my server so now i can use it some more.
     
  7. Offline

    zonedabone

    I looked at the source for Tombstone and it looks like disabling tombstones during duels is really easy.
    Here's the jar:
    https://github.com/zonedabone/Tombstone/raw/master/Tombstone.jar

    I'll look at your win detection bug now. It must be something wrong with my events.
     
  8. Offline

    LeGenDaryX

    Just tryin to help but i got another bug or the same as before i dont know.
    But after a duel the other guy kept staying in a duel (relogin didn't work). So when he typt
    /duel surrender
    There came a message that he lost the duel but he still didn't quit the duel. This error appeared in the server:

    Code:
        at org.bukkit.command.PluginCommand.execute(PluginCommand.java:37)
        at org.bukkit.command.SimpleCommandMap.dispatch(SimpleCommandMap.java:128)
        at org.bukkit.craftbukkit.CraftServer.dispatchCommand(CraftServer.java:287)
        at net.minecraft.server.NetServerHandler.handleCommand(NetServerHandler.java:712)
        at net.minecraft.server.NetServerHandler.chat(NetServerHandler.java:678)
        at net.minecraft.server.NetServerHandler.a(NetServerHandler.java:671)
        at net.minecraft.server.Packet3Chat.a(Packet3Chat.java:32)
        at net.minecraft.server.NetworkManager.b(NetworkManager.java:226)
        at net.minecraft.server.NetServerHandler.a(NetServerHandler.java:75)
        at net.minecraft.server.NetworkListenThread.a(SourceFile:105)
        at net.minecraft.server.MinecraftServer.h(MinecraftServer.java:399)
        at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:309)
        at net.minecraft.server.ThreadServerApplication.run(SourceFile:422)
    Caused by: java.lang.NoClassDefFoundError: com/iConomy/iConomy
        at zonedabone.Duels.Duel.lose(Duel.java:80)
        at zonedabone.Duels.Duels.onCommand(Duels.java:172)
        at org.bukkit.command.PluginCommand.execute(PluginCommand.java:35)
        ... 12 more
    2011-06-15 17:27:47 [SEVERE] null
    org.bukkit.command.CommandException: Unhandled exception executing command 'duel' in plugin Duels v0.4.3
        at org.bukkit.command.PluginCommand.execute(PluginCommand.java:37)
        at org.bukkit.command.SimpleCommandMap.dispatch(SimpleCommandMap.java:128)
        at org.bukkit.craftbukkit.CraftServer.dispatchCommand(CraftServer.java:287)
        at net.minecraft.server.NetServerHandler.handleCommand(NetServerHandler.java:712)
        at net.minecraft.server.NetServerHandler.chat(NetServerHandler.java:678)
        at net.minecraft.server.NetServerHandler.a(NetServerHandler.java:671)
        at net.minecraft.server.Packet3Chat.a(Packet3Chat.java:32)
        at net.minecraft.server.NetworkManager.b(NetworkManager.java:226)
        at net.minecraft.server.NetServerHandler.a(NetServerHandler.java:75)
        at net.minecraft.server.NetworkListenThread.a(SourceFile:105)
        at net.minecraft.server.MinecraftServer.h(MinecraftServer.java:399)
        at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:309)
        at net.minecraft.server.ThreadServerApplication.run(SourceFile:422)
    Caused by: java.lang.NoClassDefFoundError: com/iConomy/iConomy
        at zonedabone.Duels.Duel.lose(Duel.java:80)
        at zonedabone.Duels.Duels.onCommand(Duels.java:172)
        at org.bukkit.command.PluginCommand.execute(PluginCommand.java:35)
        ... 12 more
    Hope it helps!
     
  9. Offline

    zonedabone

    do you have iConomy installed? I still haven't added all of the plugin checking. I'll have it in 0.4.4. Thanks for the bug report! I actually haven't gotten to test it with iConomy uninstalled. I would assume that the reason you were having trouble with duels not terminating was because of this error.

    EDIT: 0.4.4 is up! Test it out and tell me if you have any more bugs. It turns out that for this plugin the hardest part has been finding bugs. They've been really easy to fix, and were probably caused by me staying up too late to make this. [creeper]
     
  10. Offline

    LeGenDaryX

    I have iConomy version 4.65 (kenzi) installed.

    Sure no problem! Glad to help.
     
  11. Offline

    zonedabone

    Oh. I think this requires iConomy5
    At least that's what I wrote it for, and the api changed a lot.
    I'll have to add more contingency for that. As long as you don't set money stakes it'll be okay.

    EDIT: Looks like 4.x won't even load, so setting stakes will just be disabled.
     
  12. Offline

    LeGenDaryX

    Tombstone was disabled so that works!
    That i didn't get iConomy money is logical now because i have the wrong version.

    But when i moved out of range it kicked me out of the server and said:
    I moved to quickly. Elapsed ticks: 1, Distance change 146.06131513424

    EDIT: When i fought someone again. I killed him. He died but spawned directly on the same spot again (wich is a good thing!) but i didn't got a win. He had to typ /duel surrender and then i got the win.
     
  13. Offline

    zonedabone

    Hmm. No idea what would cause that. try 0.4.5. it has a ton of bugfixes and more config values.

    On second thought, that might be caused by the new force field stuff. Try setting both force field options to false in the config.

    Maybe Tombstone is still messing with it. Try temporarily disabling tombstone and trying it again.

    EDIT: It's something up with the death detection. I'm working on getting a better version working. It will be out in 0.6.6

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

    LeGenDaryX

    With forcefield off i did win the matches. But i think that was because he was out of range and lost because of that.

    The keepitems setting didn't work with and without tombstone enabled.
     
  15. Offline

    zonedabone

    Keepitems is still a bit sketchy. I have 0.4.6 ready. I just have to upload it. I did a few changes that should fix the death detection. It may also fix keepitems.
     
  16. Offline

    LeGenDaryX

    I think everything is working now! :p

    EDIT: BTW would it be difficult to implent iConomy 4 support?
    Im not sure but i dont think iConomy 5 isn't support by many plugins.

    I could be wrong though.. ^^
     
  17. Offline

    zonedabone

    I can look into it. 0.4.8 fixes a lot of bugs that you wouldn't notice, because they're related to iConomy. My only concern is that 0.4.8 might cause item duplication if keep items is off. That'll need to be tested. After that is figured out, I'll release 0.4.9 with the rest of the config messages in and item duplication fixed if it needs to be, and then we'll be set to move up to 0.5.0 with permissions, which is good because we're running out of numbers!

    I found the api docs for 1.9, which is syntactically identical to 4.x. I'll take a look into what it'd take to implement this, which shouldn't be much, and maybe by some time tomorrow we'll have a workable interface. of course, I won't be able to test it because I run 5.0. It'll probably come in 0.5.0 along with permissions, so then we'll have 9 chances to work out the kinks. ;)

    EDIT: I've been looking around everywhere and I can't find the api docs for iConomy4. iConomy5 has a really easy api and so I could implement it in under an hour. I've spent that much time just trying to find iConomy4 api. I found the source, but it's way overcomplicated and dirty. I think that for now iConomy4 support is a no go.

    0.4.9 is stable! All of the current show-stopping bugs have been dealt with and it has been tested.

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

    LeGenDaryX

    Nice! Ill test it when im home!
     
  19. Offline

    Joy

    Nice :)

    Ok been testing shortly.

    - After both players do /duel challenge, I tried /duel set stake 10
    It then said "You are ready to duel" or so, instead of anything related to stake.

    - When you do /duel confirm, it provides no message, I would expect the "You are ready to duel" message there?

    Otherwise no issues yet.

    Getting different kind of these errors:

    Code:
    10:59:24 [SEVERE] null
    org.bukkit.command.CommandException: Unhandled exception executing command 'duel' in plugin Duels v0.5.0
            at org.bukkit.command.PluginCommand.execute(PluginCommand.java:37)
            at org.bukkit.command.SimpleCommandMap.dispatch(SimpleCommandMap.java:129)
            at org.bukkit.craftbukkit.CraftServer.dispatchCommand(CraftServer.java:294)
            at net.minecraft.server.NetServerHandler.handleCommand(NetServerHandler.java:714)
            at net.minecraft.server.NetServerHandler.chat(NetServerHandler.java:680)
            at net.minecraft.server.NetServerHandler.a(NetServerHandler.java:673)
            at net.minecraft.server.Packet3Chat.a(Packet3Chat.java:32)
            at net.minecraft.server.NetworkManager.b(NetworkManager.java:223)
            at net.minecraft.server.NetServerHandler.a(NetServerHandler.java:75)
            at net.minecraft.server.NetworkListenThread.a(SourceFile:105)
            at net.minecraft.server.MinecraftServer.h(MinecraftServer.java:431)
            at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:341)
            at net.minecraft.server.ThreadServerApplication.run(SourceFile:422)
    Caused by: java.lang.NullPointerException
            at zonedabone.Duels.Duels.onCommand(Duels.java:281)
            at org.bukkit.command.PluginCommand.execute(PluginCommand.java:35)
    
    Generally means not catching command parameters you don't expect, afaik :p

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

    algiuxas

    Seems nice :) One question - is it compatible with Tombstone? I mean, if items after duel are placed to inventory, and chest spawns, maybe a way to duplicate items?
     
  21. Offline

    zonedabone

    Actually, we were specifically talking about tombstone earlier, and it works so that during duels tombstones won't work, thanks to a handy little thing I did to trick death detection. Basically anything that processes inventory on death won't work.

    Yeah, it's tough to get command parameters screened. I'll look at this specific error and see exactly what's causing it. Any chance I could get exactly what you typed in to get that error?

    EDIT: Line 281 is just a simple if conditional. Does this happen all the time, or just when invalid parameters are specified?

    EDIT: Oops. I forgot to add null checking to /duel confirm. Thanks for the bug report. I'd assume this is when you tried doing /duel confirm when you weren't in a duel?

    EDIT: In 0.5.1 I added checking to cancel. (Somehow I forgot) and also fixed some problems with cancelling duels on player logout. It wasn't a big issue, as only duels that hadn't actually been accepted failed to log out, but still, it could cause errors down the line if the player's object got purged.

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

    vrox

    Can you add an option to only block pvp in a certain world? Id like to use this in one world, and have all out war in another world.
     
  23. Offline

    Joy

    This started spamming, and then server melted <_<

    Code:
    2011-06-17 22:28:31 [SEVERE] Could not pass event PLAYER_MOVE to Duels
    java.lang.IllegalArgumentException: Cannot measure distance between worlds or to null
            at org.bukkit.Location.distance(Location.java:327)
            at zonedabone.Duels.Duel.checkLocations(Duel.java:115)
            at zonedabone.Duels.DuelsPlayerListener.onPlayerMove(DuelsPlayerListener.java:25)
            at org.bukkit.plugin.java.JavaPluginLoader$7.execute(JavaPluginLoader.java:285)
            at org.bukkit.plugin.RegisteredListener.callEvent(RegisteredListener.java:58)
            at org.bukkit.plugin.SimplePluginManager.callEvent(SimplePluginManager.java:310)
            at net.minecraft.server.NetServerHandler.a(NetServerHandler.java:140)
            at net.minecraft.server.Packet10Flying.a(SourceFile:126)
            at net.minecraft.server.NetworkManager.b(NetworkManager.java:223)
            at net.minecraft.server.NetServerHandler.a(NetServerHandler.java:75)
            at net.minecraft.server.NetworkListenThread.a(SourceFile:105)
            at net.minecraft.server.MinecraftServer.h(MinecraftServer.java:431)
            at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:341)
            at net.minecraft.server.ThreadServerApplication.run(SourceFile:422)
    
    Disabled for now :/
     
  24. Offline

    zonedabone

    Oops. I never tried it with multiworld. It should be a really easy check. I'll try to have 0.5.2 out ASAP with a fix.

    NOTE:

    For 0.6.0 and highscores, I'm planning on basing it on more than just raw wins and losses. If I did that, a person that wins his first battle could be better than the server champion. I will be using the ELO rating system, which will give everyone a fair chance of getting points, even if they lose their first few battles. ELO is very forgiving, so if you lose against a person who is better than you, ELO understands, and will only deduct a few points. Likewise, if you win against someone who is nowhere near your skill, ELO will shrug and only give you a few points. Now, if you're a newbie to a server, but know how it's done and take on the champion, you could theoretically earn up to 9.2 points in a single duel! So you see this will be a great algorithm, and it doesn't even require saving individual battle stats, it's cumulative.
     
  25. Offline

    TerrorBite

    I'd like to do this as well.

    Also, will this plugin still work in a world with PvP disabled? I'm not sure I want to PvP-enable the entire world just so that duels can occur - what if the plugin breaks? (And what about users not smart enough to enable PvP before running this plugin?)
     
  26. Offline

    zonedabone

    Sadly, the PVP event doesn't even trigger if pvp is disabled, so sadly no. If you want a filsafe, the best thing to do would be to enable pvp in server properties, and then disable it globally using a plugin like worldguard, which is very stable and won't break. Then you can use this plugin make sure forcepvp is truue in the config. This way, Duels will override worldguard when it's working, and on the off chance that it fails, worldguard will not be overriden and block pvp.

    Basically this plugin overrides all pvp blocking during duels except in server properties.

    Of course, the code is written so that it's encapsulated, meaning that is errors occour outside of the pvp code, pvp will still act normally. Also, the pvp code is very robust for exactly the reason you're talking about. It'd be no good to have people running around with pvp!

    For your request, I'm planning on adding a list of worlds in which duels is disabled, AKA will not function in any way, so that whatever settings other plugins enforce there will be kept. How does that sound?
     
  27. Offline

    Klausar

    Is it compatible with Multiverse? In Multiverse you can disable pvp for each world but pvp has to be set on true (In the server.properties). And is 0.5.2 stable?
     
  28. Offline

    zonedabone

    This is compatible with multiverse as far as I know. If the pvp of a world is true, it will still be blocked if they're not in a duel. If pvp is false, duels won't work unless you have the forcepvp setting set to true in the config. 0.5.2 is stable as far as I know, and just like multiverse it still requires global pvp to be on, because of the way bukkit triggers events.
     
  29. Offline

    H4Mm3r

    Could be fun if compatible with Worldguard region !!! Any possibility ?
     
  30. Offline

    caron300

    Using bukkit 818 and getting internal error when doing /duel challenge name
    Using groupmanager for permissions, but i also tried it without using permissions.
     

Share This Page