[INACTIVE][ADMN] PetitionPlugin v1.34 - Help ticket system [600-818]

Discussion in 'Inactive/Unsupported Plugins' started by FloydATC, Jan 20, 2011.

  1. Offline

    FloydATC

    This plugin is used for players to log problems, requests and complaints. This plugin relies on Permissions.jar for access control. This will ofcourse be changed once permissions are properly implemented in Bukkit.

    The source code is included in the .jar file, feel free to do whatever you want with it. If you use it to save the universe, credits would be nice.

    Features:
    • Players may open one or more petitions and get assigned a unique ticket # for each. This number can be used to track the petition until it has been closed.
    • Each petition may be assigned to a specific op/admin or left as unassigned
    • Players as well as ops/admins may add comments to an open petition
    • Ops/admins (and currently players) may warp to the location where the petition was opened
    • Ops/admins (and currently players) may review the history of each open petition
    • Closed petitions are archived and can be reviewed or reopened by moderators
    • Use the command "/petition" or the shorthand command "/pe". These can be reconfigured if you want. Option to change these was removed in v1.20, sorry.
    • All commands are case-insensitive
    • New and updated petitions are announced to everyone with 'petition.moderate' permission
    • Want to call them something else than petitions? This can be configured.
    • Supports multiple worlds
    • Offline players receive notifications on petition updates when logging in
    • Server admins can handle petitions on the server console
    • Players and moderators are reminded of their open petitions at configurable intervals
    Command syntax
    Code:
    /pe open|create|new <Message>
    /pe comment|log <#> <Message>
    /pe close <#> [<Message>]
    /pe list [<count>]
    /pe view <#>
    /pe assign <#> [<Operator>]
    /pe unassign <#>
    /pe warp|goto <#>
    
    Note that the command/alias "/pe" can no longer be changed by the server administrator.

    How to install
    1. Download http://minecraft.atc.no/plugins/PetitionPlugin.jar
    2. Copy it to your "plugins" directory
    3. Optionally create a new directory called "plugins/PetitionPlugin"
    4. Optionally create a new directory called "plugins/PetitionPlugin/archive"
    5. Optionally create a new file "plugins/PetitionPlugin/settings.txt"
    6. Load the plugin (Restart the server, or use any plugin you have for this purpose)
    Settings
    The configuration file is optional, the following settings are available:
    Code:
    single=Petition
    plural=Petitions
    notify-all-on-close=false
    notify-owner-on-assign=true
    notify-owner-on-unassign=true
    notify-interval-seconds=300
    warp-requires-permission=false
    Command examples
    A player in distress:
    Code:
    /pe open Someone has burned down my home!
    # the player receives a ticket number, say 45 for this example
    /pe comment 45 And killed my chicken!
    
    The brave (but slightly insensitive) administrator arrives:
    Code:
    /pe list
    # the plugin shows me a list of currently open petitions
    /pe assign 45 FloydATC
    # the petition status is changed to show that I am now handling this incident
    /pe warp 45
    # I am teleported to the scene
    /pe comment 45 Nice crater
    /pe close 45 Feather refunded, have a nice day
    # +1 served
    
    Again, note that the command/alias "/pe" can be changed by the server administrator.

    Changelog:
    v1.00 - Original release
    v1.01 - Rebuild (fixed onPlayerCommand issue)
    v1.02 - Implemented locking and permissions
    v1.03 - Added notifications and colors, and fixed a stupid permission bug
    v1.04 - Fixed a few problems with notifications, added more colors.
    v1.05 - Command/alias can now be configured. More colors.
    v1.06 - Fixed crash bug when closing without a comment. Added optional notifications on assign/unassign.
    v1.07 - Improved error-checking. Players may now list/close/comment/view/warp to their own petitions.
    v1.08 - Automatically create necessary directories and files if they don't exist
    v1.10 - A few cosmetic fixes + petition length in header
    v1.11 - Added experimental support for multiple worlds
    v1.12 - Changed to use world name instead of ID
    v1.20 - Rewrote to use onCommand(), fixed /pe warp security issue + much more.
    v1.21 - Removed the "stupidly long constructor" as per Bukkit team recommendation
    v1.22 - Implemented a notification system for offline players, admins and operators
    v1.23 - Fixed duplicate messages. Commands now work from the server console.
    v1.24 - Added optional setting to limit use of warp. Petitions are now almost listed in correct order.
    v1.25 - Fixed null pointer error on player join.
    v1.26 - Petitions are now listed in correct order. Finally.
    v1.27 - Optional online/offline filter to /pe list implemented.
    v1.28 - Non-moderators could assign/unassign their petitions. Fixed.
    v1.30 - Closed petitions may be viewed and reopened. Added list filters "closed", "unassigned", "newest" plus Regular Expression matching.
    v1.31 - The list would always get reversed. Fixed.
    v1.32 - Notification thread implemented, remind users and mods at regular intervals.
    v1.33 - Changed onPlayerJoin() as required by build #600. Fixed deprecated call to void teleportTo().
    v1.34 - Added option to notify all players when a petition is closed, not just the moderators.

    Dependencies:
    • Requires the Permissions plugin (2.6 or equivalent required) Use other versions or compatible plugins at own risk.
    Permissions
    • 'petition' required to open, comment and view a petition
    • 'petition.warp-to-own' required IF 'warp-requires-permission' is enabled
    • 'petition.warp-to-own-if-assigned' required IF 'warp-requires-permission' is enabled
    • 'petition.moderate' required for everything else
    Known problems
    Certain situations can lead to double notifications, such as an operator commenting on his own petition. Colorization is work-in-progress.

    I'm a Java newbie, please be gentle.
    Thank you :)
     
    DJdur, Phaedrus, kahlilnc and 3 others like this.
  2. Offline

    BadgerLove

    Hey Floyd, this is a very interesting plugin, I would personally call the issues raised to me tickets and would be very useful for when our mods are not online.

    Without being anal is there anyway to change the command to /ticket?
     
  3. Offline

    FloydATC

    Shouldn't be much of a problem really, after all it's just a string. I considered having the command itself be configurable but I thought I'd wait and see exactly how the permission system turns out first. Stay tuned.

    At this time I'm very interested in having the basic mechanics tested and if anyone with more Java experience would review the code I'd appreciate it. I also need to solve one major flaw in the design: If two players alter the same ticket at exactly the same time, bad things may happen because there is no semaphore or locking. (Update: This has been solved in v1.02)
     
  4. Offline

    FloydATC

    I think I've finally isolated the problem, it seems if I register the commands in plugin.yml they don't work consistently. Leave them out, and everything seems ok. Please re-download and let me know if it works :)
     
  5. Offline

    An0nx

    This is a great plugin! It'll be a great addition to my server.
    Could you add Permissions support? It would be a great improvement.
     
  6. Offline

    Chojin

    Great plugin !
    Could you add an instant notification to all admins online (and admins who become online) each time a new petition is created ?
    It would be wonderful.
    (Admins or any authorized person as soon as you can support Permissions plugin.)
    Thank you ;)
     
  7. Offline

    FloydATC

    Permissions finally implemented, and I added a simple locking scheme to prevent simultaneous updates to the same petition from breaking things. Please report any issues. Notifications are on my TODO list, it's obviously critical on a busy server but I need to figure out how to examine logged-in users etc first :-D
     
  8. Offline

    l5p4ngl312

    Doesn't seem to work on build #129
     
  9. Offline

    FloydATC

    What version of Permissions are you running, and can I see your permissions setup please?
     
  10. Offline

    Kainzo

    Could we have teh command configurable? would be awesome.
     
  11. Hi!

    I greatly like this plugin. One thing it is missing though is a notification to Ops/Admins when a new ticket is opened.
    could we maybe get that? ;)

    Thanks!
     
  12. Offline

    Kainzo

    I was testing this last night - it's a very good plugin.

    Some suggestions:
    *Colors on the tickets
    *Perhaps a 'higher priority' cmd for advanced users
    *Sexytime for all.
     
  13. Offline

    Chojin

    Hello

    another suggestion:
    * Color green/red on nicknames petitions list to know if user who submitted ticket is online or not.
     
  14. Offline

    FloydATC

    Everyone with 'petition.moderate' permissions now get notified of new and updated petitions.

    Configurable command alias is in the pipe.
    Chojin: Good idea, will do.
    --- merged: Jan 25, 2011 9:02 PM ---
    Getting there, the info is too hard to read atm. Any thoughts on a color scheme? I dunno if other plugins are establishing some sort of standard or if it's free for all and total BBS style chaos?

    I'm toying with the idea of implementing priorities but I thought I'd have mods set them rather than depend on the players' subjective priorities.

    This one you'll have to explain.
     
  15. Offline

    Kainzo

    Here's some very needed change functionality features.
    When you do a /pe close # <MSG> it should send the msg to the user

    Currently, im seeing that the ticket is closed but no response back to the other stating so.
     
  16. Offline

    FloydATC

    I've just reworked the notifications a bit, there were a few bugs and I'm sure some still remain.

    My basic idea is that the owner should always get a full report when his case is updated or closed, all moderators should get a brief notification without getting spammed with details. The current logic means that in some cases the player performing the update will receive duplicate messages, which is a little daft but better than getting no response at all.

    Now, if I could only get around to the custom alias... not enough hours in a day! :-|
     
  17. Offline

    Kainzo

    Very well done - I will use the crap out of the plugin - change up some colors and its golden P:
     
  18. Offline

    FloydATC

    Another update just uploaded. This one will look for an optional file named 'plugin/PetitionPlugin/settings.txt' which defaults to the following:

    Code:
    command=petition
    commandalias=pe
    single=Petition
    plural=Petitions
    This has only been briefly tested but as long as both the command and commandalias works, the rest is purely cosmetic. If I forgot a hard-coded string somewhere, let me know. Oh and I added more colors.
     
  19. Offline

    Xemnas33

    Hi, could you make it send a message to the petition creator when someone starts handling the ticket? Not sure if it already does this but I asked someone who was testing it and they said it didn't.
    An example would be: Your ticket is being handled by 'name here' this message could be coloured too.

    Also when you give someone the petition permission does that mean they can comment on any petition? Or is that just being able to comment on their own?
     
  20. Offline

    t0phux

    I found a bug. When closing a ticket without a message, it throws this error:

    Code:
    Jan 26, 2011 9:38:07 PM org.bukkit.plugin.SimplePluginManager callEvent
    SEVERE: Could not pass event PLAYER_COMMAND to PetitionPlugin
    java.lang.StringIndexOutOfBoundsException: String index out of range: -1
            at java.lang.String.substring(String.java:1937)
            at java.lang.String.substring(String.java:1904)
            at com.bukkit.floyd.petition.PetitionPlayerListener.onPlayerCommand(PetitionPlayerListener.java:191)
            at org.bukkit.plugin.java.JavaPluginLoader.callEvent(JavaPluginLoader.java:135)
            at org.bukkit.plugin.SimplePluginManager.callEvent(SimplePluginManager.java:201)
            at net.minecraft.server.NetServerHandler.c(NetServerHandler.java:554)
            at net.minecraft.server.NetServerHandler.a(NetServerHandler.java:528)
            at net.minecraft.server.Packet3Chat.a(SourceFile:24)
            at net.minecraft.server.NetworkManager.a(SourceFile:232)
            at net.minecraft.server.NetServerHandler.a(NetServerHandler.java:65)
            at net.minecraft.server.NetworkListenThread.a(SourceFile:104)
            at net.minecraft.server.MinecraftServer.h(MinecraftServer.java:261)
            at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:197)
            at net.minecraft.server.ThreadServerApplication.run(SourceFile:512)
    2011-01-26 21:38:07 [INFO] [PLAYER_COMMAND] t0phux: /pe close 3
    2011-01-26 21:38:07 [INFO] t0phux tried command: pe close 3
    java.net.SocketException: Connection reset
            at java.net.SocketInputStream.read(SocketInputStream.java:168)
            at java.net.SocketInputStream.read(SocketInputStream.java:182)
            at java.io.FilterInputStream.read(FilterInputStream.java:66)
            at net.minecraft.server.Packet.b(SourceFile:102)
            at net.minecraft.server.NetworkManager.f(SourceFile:157)
            at net.minecraft.server.NetworkManager.c(SourceFile:15)
            at net.minecraft.server.NetworkReaderThread.run(SourceFile:68)
    
    And once you actually commit another command it goes into and infinite loop and throws this error repeatedly and crashes the server.

    Code:
    [Pe] Denied t0phux lock on #2; currently locked by t0phux
    [Pe] Denied t0phux lock on #2; currently locked by t0phux
    [Pe] Denied t0phux lock on #2; currently locked by t0phux
    [Pe] Denied t0phux lock on #2; currently locked by t0phux
    [Pe] Denied t0phux lock on #2; currently locked by t0phux
    Thanks for this awesome plugin!
     
  21. Offline

    FloydATC

    You're right, assign/unassign is currently invisible to the petition owner. Some ops may want to study the details and perhaps look up docs before contacting the player, that's why I didn't add this from the start. I will add an optional setting for this.

    This has been bothering be for a while, they can indeed comment on any open petition, not just their own. I will add a check for this.


    Ouch. I assume that these two quotes stem from two different tests, since the failed close on #3 would leave the lock in place on #3. Just goes to show how important exception handling is when dealing with locks. The stupid parsing error should be easy enough to fix but I won't be able to post an update until 10-12 hours from now, sorry for the inconvenience :-/
     
  22. Offline

    Xemnas33

    Awesome thanks! :D Keep up the great work :)
     
  23. Offline

    FloydATC

    Bug squashed. I also added the following optional settings:
    Code:
    notify-owner-on-assign=true
    notify-owner-on-unassign=true
    I may add similar options for other notifies once I get the notification logic properly sorted (i.e. no duplicates), but I'll try to keep the default behaviour as it is to avoid surprises.
     
  24. Offline

    Xemnas33

    Another quick question. Can the player who set up the ticket warp back to the area? If there's a lot of tickets it could take a while for an admin to get to them.

    Also would it be possible for a preset command to file a preset ticket? Say they type /peticketa and that sets it up with a message such as Help someone has just griefed my structure!

    Not sure how many ideas I can come up with for this.
    I've got 2 more I can think of so I'll suggest them for the future:
    Viewing a petition shows the creator's online status.
    /view could be an admin command and instead something similar to /mypetitions could just show the petitions created by that one person.
     
  25. Offline

    FloydATC

    No, the player does not have the "/pe warp" command, only the moderators do. The idea is for the mod/admin to use "/pe warp" and then possibly "/tphere" or something similar if he needs the player present.

    Presets would be possible, although you haven't quite sold me the idea... would it be easier to train users to type "/pe petitiona" instead of just hammering in the generic "/pe open Type whatever you want here"?

    Viewing a petition already shows the petition "header" with the owner's status and that of the assigned moderator (if any). There is (currently) no way to open a petition on behalf of someone else. Come to think of it, that might be useful for mods who get tired of training users :-D

    "/pe view" is supposed to be for owners and moderators only, as is "/pe comment". I'll add checks for this later today.

    I don't want to add any more /commands but I consider tweaking "/pe list" so non-moderators can use it to list just their own open petitions. Furthermore, currently there's no quick way for moderators to list only the petitions assigned to them. So many ideas, so little time... :-(
     
  26. Offline

    Xemnas33

    Well the preset petitions would only be for very generic problems such as wanting their lot protected or they have been griefed, stolen from etc. That's the only reason i'd want them :)
    So i'd want to use things like /petitiong, /petitionprot

    And with the fact you have many ideas at least you'll be kept on your feet and plus this is only the beginning of your plugin once you've got it up to a near perfect level there'll probably not be many ideas floating around so then just updates for it to work with the latest mc.
     
  27. Offline

    Azraeil

    Not sure what caused it, but infinite loop and then the server locked up:
    Name of my admin is obviously SuperUser. All I tried to do was to to close out the first ticket ever created.
     
  28. Offline

    FloydATC

    You seem to either be running v1.05 (or earlier), or there may be another bug causing "/pe close" to crash. Crashing during a petition update (close/comment/assign/unassign) will cause the lock to remain in place. In either case, I'll have another stab at this just to try and make the code more robust.
     
  29. Offline

    Azraeil

    Very possible. I downloaded the plugin yesterday sometime and didn't include a comment when I closed the ticket. I'll continue using the 1.06. If I have any problems, I'll report them!
     
  30. Offline

    FloydATC

    I have just posted an update to v1.07 with improved exception handling and a workaround in the locking mechanism that should prevent this problem from appearing even if a command handler chokes on unexpected input, a corrupted file or whatever.

    Also, I have made it possible for players to list, comment, close and warp to their own petitions and nobody else's.
     

Share This Page