Plugin Request Duel / 1vs1 plugin

Discussion in 'Plugin Help/Development/Requests' started by Rowinvd, Mar 3, 2015.

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

    Rowinvd

    Yes, I know there are 10 of them or something, but i want a simpler plugin without 100 features:
    Suggested name: Duels

    What i want:
    There is 1 arena. In that arena can everyone play duels, because all the players are hided ( Not your duel player )
    You play 1 game, when you win/die you get teleported to the lobby .

    Commands:
    /duel {NAME} - Message: Color GOLD: "You invited {PLAYER} to a duel!"
    /duel accept {NAME} - Message: Color GOLD: "{INVITER} has invited you for a duel! /duel accept [NAME] to accept!"
    /duel setpos1 - Message: Color GOLD: "Pos 1 has been set!"
    /duel setpos2 - Message: Color GOLD: "Pos 2 has been set!"
    /duel setlobby - Message: Color GOLD: "The lobby has been set!"

    Permissions:
    duel.admin for: setpos1, setpos2, and setlobby.
     
  2. Offline

    spy_1134

    An interesting idea. I've never thought of having all duels take place in one arena like that.

    I've been thinking of writing a PVP plugin for fun but I've never gotten around to it. I could do this for you no problem.

    Any additional features you could think of?
    Keeping items or XP on death? Blocking PVP if you aren't dueling? That kind of thing.
     
  3. Offline

    Rowinvd

    If you gonna make your plugin public, add a message like: You killed .... with HEALTH!
     
  4. Offline

    spy_1134

    Loading and saving configuration is done as well as all necessary structures to store the information needed to make the plugin work.

    I just have to finish the command and event handling code now.

    Command and event handling code is done. There are some bugs I'm going to iron out tomorrow, but the plugin is mostly usable.

    I'll finish it up tomorrow.

    EDIT by Timtower: merged posts

    @Rowinvd
    I squashed all of the bugs I could find, which was a bit of a pain with only one copy of Minecraft.

    Source code is here: https://github.com/spy1134/Duel-Plugin

    The plugin will notify any admins connecting to the server if it has not been properly set up.
    Run /duel setlobby followed by /duel setpos1 and /duel setpos2 to mark your locations then reload
    your server and it will save all of the new configuration values to the plugin folder.

    There are two configuration values for whether or not the server should save items and experience on death. By default they are set to true.

    I was unable to test hiding other duelers since I was only able to test the plugin with two players, so let me know if that doesn't work right. Also, if a player who is dueling is killed by a player not involved in that duel, they will be kicked for interfering.

    All duel requests and duels in progress are only stored in RAM, so when the plugin is reloaded or the server restarts all duels that are taking place are destroyed and all requests are cancelled. Currently, the duelers are given no notification when their duel is cancelled, so be sure to give people a heads up so they don't lose experience or items.

    Let me know if there are any bugs or anything that you would like changed.
    The plugin is inside the attached ZIP.
     

    Attached Files:

    Last edited by a moderator: Mar 5, 2015
  5. Offline

    Rowinvd

    @spy_1134 PlayerDeathEvent error: Btw I'm using Spigot
    Code:
    [15:46:16] [Server thread/ERROR]: Could not pass event PlayerDeathEvent to Duel-Plugin v1.0
    org.bukkit.event.EventException
       at org.bukkit.plugin.java.JavaPluginLoader$1.execute(JavaPluginLoader.java:299) ~[Spigot.jar:git-Spigot-1558]
       at org.bukkit.plugin.RegisteredListener.callEvent(RegisteredListener.java:62) ~[Spigot.jar:git-Spigot-1558]
       at org.bukkit.plugin.SimplePluginManager.fireEvent(SimplePluginManager.java:502) [Spigot.jar:git-Spigot-1558]
       at org.bukkit.plugin.SimplePluginManager.callEvent(SimplePluginManager.java:487) [Spigot.jar:git-Spigot-1558]
       at org.bukkit.craftbukkit.v1_7_R4.event.CraftEventFactory.callPlayerDeathEvent(CraftEventFactory.java:397) [Spigot.jar:git-Spigot-1558]
       at net.minecraft.server.v1_7_R4.EntityPlayer.die(EntityPlayer.java:385) [Spigot.jar:git-Spigot-1558]
       at net.minecraft.server.v1_7_R4.EntityLiving.damageEntity(EntityLiving.java:745) [Spigot.jar:git-Spigot-1558]
       at net.minecraft.server.v1_7_R4.EntityHuman.damageEntity(EntityHuman.java:751) [Spigot.jar:git-Spigot-1558]
       at net.minecraft.server.v1_7_R4.EntityPlayer.damageEntity(EntityPlayer.java:464) [Spigot.jar:git-Spigot-1558]
       at net.minecraft.server.v1_7_R4.EntityHuman.attack(EntityHuman.java:936) [Spigot.jar:git-Spigot-1558]
       at net.minecraft.server.v1_7_R4.PlayerConnection.a(PlayerConnection.java:1176) [Spigot.jar:git-Spigot-1558]
       at net.minecraft.server.v1_7_R4.PacketPlayInUseEntity.a(SourceFile:55) [Spigot.jar:git-Spigot-1558]
       at net.minecraft.server.v1_7_R4.PacketPlayInUseEntity.handle(SourceFile:10) [Spigot.jar:git-Spigot-1558]
       at net.minecraft.server.v1_7_R4.NetworkManager.a(NetworkManager.java:184) [Spigot.jar:git-Spigot-1558]
       at net.minecraft.server.v1_7_R4.ServerConnection.c(ServerConnection.java:81) [Spigot.jar:git-Spigot-1558]
       at net.minecraft.server.v1_7_R4.MinecraftServer.v(MinecraftServer.java:731) [Spigot.jar:git-Spigot-1558]
       at net.minecraft.server.v1_7_R4.DedicatedServer.v(DedicatedServer.java:289) [Spigot.jar:git-Spigot-1558]
       at net.minecraft.server.v1_7_R4.MinecraftServer.u(MinecraftServer.java:584) [Spigot.jar:git-Spigot-1558]
       at net.minecraft.server.v1_7_R4.MinecraftServer.run(MinecraftServer.java:490) [Spigot.jar:git-Spigot-1558]
       at net.minecraft.server.v1_7_R4.ThreadServerApplication.run(SourceFile:628) [Spigot.jar:git-Spigot-1558]
    Caused by: java.lang.NoSuchMethodError: org.bukkit.event.entity.PlayerDeathEvent.setKeepInventory(Z)V
       at com.github.spy1134.DuelPlugin.EventListener.onPlayerDeath(EventListener.java:54) ~[?:?]
       at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_31]
       at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_31]
       at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_31]
       at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.8.0_31]
       at org.bukkit.plugin.java.JavaPluginLoader$1.execute(JavaPluginLoader.java:296) ~[Spigot.jar:git-Spigot-1558]
       ... 19 more
    [15:46:24] [Server thread/ERROR]: Could not pass event PlayerDeathEvent to Duel-Plugin v1.0
    org.bukkit.event.EventException
       at org.bukkit.plugin.java.JavaPluginLoader$1.execute(JavaPluginLoader.java:299) ~[Spigot.jar:git-Spigot-1558]
       at org.bukkit.plugin.RegisteredListener.callEvent(RegisteredListener.java:62) ~[Spigot.jar:git-Spigot-1558]
       at org.bukkit.plugin.SimplePluginManager.fireEvent(SimplePluginManager.java:502) [Spigot.jar:git-Spigot-1558]
       at org.bukkit.plugin.SimplePluginManager.callEvent(SimplePluginManager.java:487) [Spigot.jar:git-Spigot-1558]
       at org.bukkit.craftbukkit.v1_7_R4.event.CraftEventFactory.callPlayerDeathEvent(CraftEventFactory.java:397) [Spigot.jar:git-Spigot-1558]
       at net.minecraft.server.v1_7_R4.EntityPlayer.die(EntityPlayer.java:385) [Spigot.jar:git-Spigot-1558]
       at net.minecraft.server.v1_7_R4.EntityLiving.damageEntity(EntityLiving.java:745) [Spigot.jar:git-Spigot-1558]
       at net.minecraft.server.v1_7_R4.EntityHuman.damageEntity(EntityHuman.java:751) [Spigot.jar:git-Spigot-1558]
       at net.minecraft.server.v1_7_R4.EntityPlayer.damageEntity(EntityPlayer.java:464) [Spigot.jar:git-Spigot-1558]
       at net.minecraft.server.v1_7_R4.EntityMonster.n(EntityMonster.java:100) [Spigot.jar:git-Spigot-1558]
       at net.minecraft.server.v1_7_R4.EntityZombie.n(EntityZombie.java:235) [Spigot.jar:git-Spigot-1558]
       at net.minecraft.server.v1_7_R4.PathfinderGoalMeleeAttack.e(PathfinderGoalMeleeAttack.java:100) [Spigot.jar:git-Spigot-1558]
       at net.minecraft.server.v1_7_R4.PathfinderGoalSelector.a(PathfinderGoalSelector.java:108) [Spigot.jar:git-Spigot-1558]
       at net.minecraft.server.v1_7_R4.EntityInsentient.bn(EntityInsentient.java:416) [Spigot.jar:git-Spigot-1558]
       at net.minecraft.server.v1_7_R4.EntityLiving.e(EntityLiving.java:1549) [Spigot.jar:git-Spigot-1558]
       at net.minecraft.server.v1_7_R4.EntityInsentient.e(EntityInsentient.java:289) [Spigot.jar:git-Spigot-1558]
       at net.minecraft.server.v1_7_R4.EntityMonster.e(EntityMonster.java:21) [Spigot.jar:git-Spigot-1558]
       at net.minecraft.server.v1_7_R4.EntityZombie.e(EntityZombie.java:160) [Spigot.jar:git-Spigot-1558]
       at net.minecraft.server.v1_7_R4.EntityLiving.h(EntityLiving.java:1409) [Spigot.jar:git-Spigot-1558]
       at net.minecraft.server.v1_7_R4.EntityInsentient.h(EntityInsentient.java:150) [Spigot.jar:git-Spigot-1558]
       at net.minecraft.server.v1_7_R4.EntityMonster.h(EntityMonster.java:25) [Spigot.jar:git-Spigot-1558]
       at net.minecraft.server.v1_7_R4.EntityZombie.h(EntityZombie.java:231) [Spigot.jar:git-Spigot-1558]
       at net.minecraft.server.v1_7_R4.World.entityJoinedWorld(World.java:1603) [Spigot.jar:git-Spigot-1558]
       at net.minecraft.server.v1_7_R4.World.playerJoinedWorld(World.java:1578) [Spigot.jar:git-Spigot-1558]
       at net.minecraft.server.v1_7_R4.World.tickEntities(World.java:1443) [Spigot.jar:git-Spigot-1558]
       at net.minecraft.server.v1_7_R4.WorldServer.tickEntities(WorldServer.java:516) [Spigot.jar:git-Spigot-1558]
       at net.minecraft.server.v1_7_R4.MinecraftServer.v(MinecraftServer.java:703) [Spigot.jar:git-Spigot-1558]
       at net.minecraft.server.v1_7_R4.DedicatedServer.v(DedicatedServer.java:289) [Spigot.jar:git-Spigot-1558]
       at net.minecraft.server.v1_7_R4.MinecraftServer.u(MinecraftServer.java:584) [Spigot.jar:git-Spigot-1558]
       at net.minecraft.server.v1_7_R4.MinecraftServer.run(MinecraftServer.java:490) [Spigot.jar:git-Spigot-1558]
       at net.minecraft.server.v1_7_R4.ThreadServerApplication.run(SourceFile:628) [Spigot.jar:git-Spigot-1558]
    Caused by: java.lang.NoSuchMethodError: org.bukkit.event.entity.PlayerDeathEvent.setKeepInventory(Z)V
       at com.github.spy1134.DuelPlugin.EventListener.onPlayerDeath(EventListener.java:54) ~[?:?]
       at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_31]
       at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_31]
       at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_31]
       at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.8.0_31]
       at org.bukkit.plugin.java.JavaPluginLoader$1.execute(JavaPluginLoader.java:296) ~[Spigot.jar:git-Spigot-1558]
       ... 30 more
    [15:46:33]
    
    EDIT by Timtower: made error readable.
     
  6. Online

    timtower Administrator Administrator Moderator

    Moved to Bukkit alternatives
     
  7. Offline

    spy_1134

    I built this plugin against the Spigot API for MC 1.8, so that shouldn't be an issue.

    It looks like you're running an outdated version of Spigot and the server is saying it can't find a function to tell the server to save a player's items when they die. That function exists in the latest version.

    You can either update to the latest version of Spigot and it will work, or I could try to track down a version of the API for your outdated build and rewrite or disable any features that are missing.
     
  8. Offline

    Rowinvd

    @spy_1134 Can you make it if you accept a player, player 1 and 2 gets Iron armor, a iron sword, a rod, a bow, and 8 arrows? after the game they get the old stuff back. Omg I think my english is so bad in this message 0.O
     
  9. Offline

    spy_1134

    I could. If the server were to crash or some error occurred when the plugin was holding their inventory then the players may lose items though. If that's an acceptable risk for you then I could do it.
     
  10. Offline

    Rowinvd

    @spy_1134 Then give the player at the end of the game ( setlobby teleport ) the same items ( iron armor sword, etc ) Its for my pvp server thats why.
     
  11. Offline

    Rowinvd

    @spy_1134 This is a better version of the request:

    What i don't really need:
    A message like: You killed ... with ... because its already in my plugin.
    Clear xp drops ( same reson )
    Clear item drops ( same reson )
    So, a config is'nt needed :)

    How it works:
    There is 1 arena. Everyone can pvp here, because all the players get turned off ( Not PLAYER2 )
    The stuff you get:
    Iron armor, Iron sword, Fishing rod, a Bow, and 8 Arrows.
    When you kill PLAYER2, you and PLAYER2 get teleported to the lobby, also of you died.
    When you get teleported to the lobby, you get the same stuff as in the duel, because this plugin is for my FFA server ( something like kitPvP )

    Commands:
    /duel help - no permission.
    /duel PLAYER - no permission.
    /duel accept PLAYER - no permission.
    /duel setlobby - permission: duel.admin
    /duel setpos1 - permission: duel.admin
    /duel setpos2 - permission: duel.admin

    Messages: ( All the mesesages are YELLOW! )
    /duel help - Commands: \n/duel <Player> \n/duel accept <Player>
    /duel - You requested PLAYER for a duel!
    PLAYER2 Gets: PLAYER has invited you for a duel! do /duel accept <Player> to accept the duel!
    There are no prefixes, only this!
    /duel accept - You accepted the request for a duel!
    PLAYER2 Gets: PLAYER has accepted your duel request!
    /duel setlobby - The lobby has been set!
    /duel setpos1 - Pos1 has been set!
    /duel setpos2 - Pos2 has been set!
     
    Last edited by a moderator: Mar 8, 2015
  12. Offline

    spy_1134

    Ah. Got it.
    Disabling the XP and inventory stuff would just take commenting out some lines of code.
    So no death messages or win/loss messages to players when a duel is finished? Anything else?
     
  13. Offline

    Rowinvd

  14. Offline

    spy_1134

    Gold messages, no more death messages, and no more keeping items on death.

    Upon start and completion of the duel, both players' inventories are cleared and they are given a full set of iron armor with an iron sword in the first slot of their hotbar. At the moment all items are hard coded, but I could add configuration sections for that as well in the future if you are interested.

    Let me know if I missed anything or if there is anything else I can do to improve this for you further.
     

    Attached Files:

Thread Status:
Not open for further replies.

Share This Page