[MECH/EDIT] SimpleSignEdit v1.7.1 - Edit signs with right-click, now on BukkitDev [1060]

Discussion in 'Inactive/Unsupported Plugins' started by Celtic Minstrel, Mar 22, 2011.

  1. Offline

    Celtic Minstrel

    Not satisfied with the mechanics of other sign edit tools, such as requiring the use of commands, I went and threw together a plugin that lets you edit signs simply by right-clicking them with another sign in hand.
    Download from the BukkitDev page. (Older versions available here.)

    When you right-click to edit a sign, you can then view and edit the text of the sign just as you would when creating it. You can only edit signs if you are the owner or if they are owned by everyone. To include colours on the sign, use the & character followed by a digit or a letter from A to F. This works both when placing and when editing. If you want to include an & character on the sign, and the plugin interprets it as a colour code, simply double it and the plugin will realize that you don't want it to be converted.

    To see who owns a sign, hold a stick in your hand (you can change this to any item in the config file), and right-click the sign. To change who owns a sign if you have permission, hold a feather in your hand (you can change this to any item in the config file), and right-click the sign. Then either type the new owner name into chat, or walk over and punch them. You can also enter the symbols @, #, and * into chat to set the owner to yourself, no-one, or everyone, respectively. You could also edit ownership by editing the config file, but since signs are stored by their location that would not be an easy task.

    To configure the items used for setting/viewing the owner of the sign, simply set the "view-owner" or "set-owner" values in the config file to the ID of the item you want to use. You can also change the "allow-stacking" and "break-protect" values if you wish. It's probably a good idea to leave the "signs" section alone since that keeps track of who owns which sign. You can also configure it so that you need to be sneaking (or not sneaking) to edit signs.

    Permissions nodes:
    • simplesignedit.edit - Allows players to edit the signs they have placed as well as public signs (owned by everyone). If Permissions is not installed, everyone gets this.
    • simplesignedit.edit.all - Allows players to edit any sign, including those with no owner and those placed by others. If Permissions is not installed, only ops get this
    • simplesignedit.colour.<code> - Allows players to use the specified colour on signs. Available colours are listed here, but leave out the underscores and use all lowercase. Or you can just give simplesignedit.colour.*; also, the U in colour is optional. Currently this is restricted to ops if Permissions is not installed
    • simplesignedit.setowner - Allows players to change the owner of a sign. If Permissions is not installed, only ops get this.

    Config options:
    • allow-stacking - Allows sign posts to be built on top of sign posts; if false, an attempt to stack sign posts will result in the edit window appearing.
    • break-protect - Protect signs from being broken by people other than their owner. Obviously signs owned by everyone can then be broken by everyone.
    • orphaned-breakable - If the above is set to true, this controls whether signs owned by no-one can be broken by anyone.
    • sneaking - One of "true", "false", or "both"; if true, you must be sneaking to edit signs, and if false, you must not be sneaking to edit signs. The default, "both", means that your sneaking status is not checked when determining if you should edit the sign.
    • view-owner - The ID of the item used to see the owner of a sign by right-clicking. Defaults to stick.
    • set-owner - The ID of the item used to set the owner of a sign by right-clicking. Defaults to feather

    Video by Warby579:


    List of things to maybe do:
    • None right now

    Changelog:

    Version 1.7
    • Now uses a database to keep track of sign ownership.
    • Added auto-save option.

    Version 1.6.2
    • Added configuration option to allow anyone to break signs that have no owner even if break protection is enabled; it has no effect if break protection is not enabled
    • Fixed a potential NullPointerException that would sometimes occur when disabling; this bug could in theory haved cause loss of owner data
    • Fixed PermissionsBukkit antibuild interfering with the operation of the plugin; now you should be able to edit signs if you have simplesignedit.edit even if you do not have permissions.build
    • Fixed duplication issue that resulted from a conflict with plugins that display an inventory window when right-clicking a sign; any other, similar duplication issues that I'm unaware of should be similarly fixed

    Version 1.6.1
    • Editing signs despite anti-build should now work with more anti-build plugins. It still might not work with some though.

    Version 1.6
    • Added an option to require that you are sneaking (or not sneaking) in order to edit signs. By default, you can edit signs regardless of whether you are sneaking.
    • Added the simplesignedit.* permission node, which somehow I managed to forget when implementing superperms support.
    • Added more API stuff. I suppose it's unlikely people will use it, but still. Also, the API is now used internally as well.
    • It should now be possible to make signs editable for users who do not have build permission. Whether it actually works may also depend on what plugin you use for anti-build. It still won't affect built-in spawn protection though.
     
    Taranis01, Pompeij and ksevelyar like this.
  2. Offline

    Celtic Minstrel

    You mean, only allow editing if you click the sign on the side rather than the top face? It could be done, but I'm confused how it would help what you're describing.

    You know you can set the sign's owner to none to prevent it being edited, right? Or set it to all?
     
  3. Offline

    MineralMC

    Exactly this, to allow the natural sign-stacking behaviour.

    To be honest, I've never really experimented much with the ownership system - I always assumed the owner of the sign was the person who placed it!
     
  4. Offline

    Celtic Minstrel

    Ahh, so that you can put a sign post on a sign post. Yeah, I can see how that would be a good idea.

    And yeah, the owner of a sign is generally who placed it; signs placed when the plugin is not activated will have no owner though, so only admins can edit them, and you can also explicitly set signs to have no owner or to be publicly editable.
     
  5. Offline

    Taranis01

    thanks for this nice plugin :)
    im just missing the config file! i cant find one in my whole minecraftfolder. also simplesignedit didnt created a folder in plugins, so i did. but the configfile is still missing. But it works ingame!

    edit: aver hours i looked in the simplesignedit folder again...and there was a config file :confused:
     
  6. Verry nice mod, THX 4 that.

    but i've the same problem like MineralMC, i want to build a mobavator, but can't place a sign on a sign, even if i change the owner to no-one, the sign disapears :( maybe add an command to deactivate ist (for the next sign or till it's be activatet again).

    (sry 4 my bad english -.-')
     
  7. Offline

    Celtic Minstrel

    I'll "fix" that in a later release, probably by using a config file option.

    By the way, can anyone confirm that this works on build 740? Or even better, 760?

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

    MineralMC

    Works on 760, but I was still getting that console spam. Actually got an 'overflow'-type crash as a result of it yesterday, so I've taken SSE out for the time being. Was after reloading the server after about 2 days of use - it spammed SSE output for about 2 minutes, then died.

    Planning to give it a go again in a couple of days, in the hope that a fresh install will solve it.
     
  9. Offline

    Celtic Minstrel

    Agh, this is really annoying me... why does it do that console spam...
     
  10. Offline

    Spathizilla

    Are you talking about the Invalid Key in config spam which seems to be different every time the server is restarted/reloaded?
     
  11. Offline

    sintri

    Can't delete one letter lines.
     
  12. Offline

    MineralMC

    Yep! Got any thoughts on it, Spathi?
     
  13. Offline

    Spathizilla

    I'd have to dig through the code to see whats going on. I just notice it every time I reload/restart the server. Never the same set of invalid keys regardless of whether there were sign changes or not (iirc).. I guess the locpat matcher with the regexp gets pissy sometimes since that is where the warning comes from.

    Personally I'd split the sign data off into a sqlite/mysql/flatfile setup and keep the config values as is. Probably put one sign per line in a flatfile or one per row in a sql db.

    Maybe if I'm really bored I'll make that change on a fork and give it to Celtic heh.
     
  14. Offline

    xGhOsTkiLLeRx

    Hey,

    I'm on build #766 and it's working.
    Colours, Edit, Owner, Change-owner :)

    But the only little thing is, that there is a new temporarily sign in the world...
     
  15. Offline

    Celtic Minstrel

    That is intentional. It's the only way I was able to make it work.
     
  16. Offline

    xGhOsTkiLLeRx

    Okay sir!

    But:

    If I edit a sign, I can't delete a line :/
    That sucks!

    greetings ;)
     
  17. Offline

    Celtic Minstrel

    Really? I thought I fixed that. In any case, the workaround is to replace the line with a single space.

    @Spathizilla - Did you find any clue about the invalid keys?
     
  18. Offline

    LucidLethargy

    There is a duplication exploit tied to this plugin.
    If you use craftbook or falsebook and you place the sign on an elevator, it generates a free sign. Please fix if possible :/
     
  19. Offline

    Celtic Minstrel

    Oh, actually I recall noticing this. I'm not sure if I can do much about it though; I would basically need some method of detecting that the right-click has been intercepted by another plugin. I'll give it some thought though; it is a bug, and fixing it would be nice.
     
  20. Offline

    Spathizilla

    It looks like the regexp gets angry over something (tbh last time I looked at it was like 7am) - that is what triggers the warning in the code. I guess it might be if the line is too long and it wordwraps in a bad spot then it could break.

    You might want to rework the sign storage format to something like I mentioned in my previous post. Either way it makes finding a specific sign easier than digging out the sign in the current mass of text.
     
  21. Offline

    Celtic Minstrel

    Eh, I suppose. A database would be a logical choice for this, really, with a compound primary key. I'll look at doing that in the next version, along with a couple of other things people have suggested.

    I thought the invalid keys actually did exist in the file though, because they did in early stages of testing; was that assumption false?
     
  22. Offline

    mattmoss

    Yes, there is something buggy that erased all the ownership values I had set for pre-existing signs. Here's a demonstration. (I'm using SimpleSignEdit 1.3.3 on Bukkit 766).

    1. Stop server.
    2. Backup and remove existing SimpleSignEdit/config.yml file.
    3. Start server.
    4. console> reload
    5. Examine config.yml and see that no signs have ownership.
      Code:
      signs: {}
    6. In game, right-click a pre-existing sign with feather to set ownership. Type a name in chat or punch appropriately to set ownership.
    7. Right-click sign with stick to see ownership. (Note that this is not written to file yet; only in memory.)
    8. console> reload
    9. Examine config.yml (ignoring the view-owner and set-owner tool identifiers for now).

      Code:
      signs:
             world(-15,111,124): mattmoss
    10. Set ownership again (as in step 6), but on a different pre-existing sign.
    11. Using stick and right-click, see that both signs are owned.
    12. console> reload
    13. Examine config.yml

      Code:
      signs:
             world(-15,112,124): mattmoss
             world(-15,112,124)world(-15,111,124): mattmoss
         
    14. console> reload
      (I don't always seem to get an error message at this time, but I have several times... maybe I just missed it the other times).
    15. Examine config.yml

      Code:
      signs:
             world(-15,111,124): mattmoss
    As you can see, the second sign ownership has been lost. Now, I'm not expecting this to happen generally in this fashion, since only I can reload like this. However, the principle is the same; ownerships are only being written when the plugin is shutdown, and the keys are incorrect and being thrown out at the next reload.

    (The point of reloading is to stimulate the plugin to write out the data. You might consider doing that at the time of setting ownership... or at least do it periodically, say once/minute or something. If the server crashes before it is gracefully stopped, your data sitting in memory will get lost. Better yet, maybe? Look into using Bukkit's persistence.)

    I looked at the config.yml file once before during testing to see that some keys were several coords long. And based upon the error message during one server startup, the 100 or so signs I did at once were all smushed together, and subsequently all that ownership information was lost.

    Also... was able to demonstrate the bug to myself by placing four new signs (which were automatically assigned ownership to me), doing a reload:

    Code:
    signs:
        world(-14,111,133)world(-15,112,124)world(-14,113,133)world(-14,114,133)world(-14,112,133): mattmoss
        world(-14,111,133): mattmoss
        world(-14,111,133)world(-15,112,124)world(-14,113,133)world(-14,114,133): mattmoss
        world(-14,111,133)world(-15,112,124)world(-14,113,133): mattmoss
        world(-14,111,133)world(-15,112,124): mattmoss
    and immediately doing another reload:
    Code:
    signs:
        world(-14,111,133): mattmoss
    at which point in game only the one sign (when right-clicked with stick) reported being owned by me.

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

    Celtic Minstrel

    Ooooh, I bet this was a misunderstanding of what Formatter actually does. I've made a small change which should fix the issue by creating a brand-new Formatter for each key. It will be uploaded sometime in the next few minutes, after which I'll edit the title to reflect the new release.

    I'll look into using Bukkit persistence in a later version, though.
     
  24. Offline

    mattmoss

    Yeah, that would appear to be the cause.

    EDIT: Just tested your new build. Fixed the problem. Thanks!
     
  25. Offline

    Celtic Minstrel

    And thank you for helping me figure out what the cause was!
     
  26. Offline

    Xmillsa

    Got a bit of a problem.

    Writing "&&1 = &1Blue" on a sign works fine, displays "&1 = Blue".
    However when I go to edit that sign, it brings up "&1 = &1Blue", so when I'm finished editing, it then displays " = Blue" meaning I have to edit the entire line every time I go to edit signs containing &&#.

    Edit: using version 1.3.4
    craftbukkit 766 (might be the issue)
     
  27. Offline

    Celtic Minstrel

    Ah, I see. Now that you bring it up, it's obvious why that would happen. I'll fix it soon.
     
  28. Offline

    Xmillsa

    Thanks :D
    Great plugin btw, havent been using it long but already it's a great tool for quickly editing signs!
     
  29. Offline

    ValBGaming

    I found a bug -- Not a console error or anything, but when I click to edit a sign, it gives me an extra sign stacked on top of the sign I used to edit with... This happens every time, so I end up with a big stack of duplicate signs...

    Another thing I wanted to mention, I have iConomyChestShop and when I try to edit the shop signs, it does not let me, it does however work on all other signs. Not sure if that is this plugin, or iConomyChestShop.

    Great plugin though. :)

    Bukkit Version: 766
    Plugin Version: 1.3.4
     
  30. Offline

    Celtic Minstrel

    It's a known bug; there's a conflict with any plugin that shows an inventory window in response to right-clicking a sign, and I'm not sure if I can work around it.
     
  31. Offline

    oxguy3

    I like this mod a lot, but I have one problem. A lot of other mods also require you to right-click signs, but don't care what you have in your hand. So, when I go to edit the sign, I also cause something else to happen. This is particularly problematic with mods like CommandSigns, where right-clicking a sign might spawn a monster in front of me or teleport me across the map. This can also cause problems with CraftBook, ElevatorSigns, and many other mods.

    Perhaps you could allow users to hold a different item, then click the block underneath a sign to edit it. Or maybe you have some other idea as to how to fix this.

    Otherwise, this is a very awesome mod. Keep up the great work Celtic Minstrel!
     

Share This Page