[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. I would like to have different permission nodes because it has almost the same permission nodes as simplesign
    so maybe
    • simplesignedit.edit
    instead of
    • simplesign.edit
     
  3. Offline

    captainawesome7

    Oh, I didn't realize somebody was using nodes that were the same as mine. I think I'm going to leave them how they are though, because SimpleSignEdit isn't really called SimpleSign.
     
  4. Offline

    Darq

    Pretty nice plugin, but there are two issues for me.

    When right clicking on a PhysicalShop sign, the sign in your hand duplicates and and stacks.
    When right clicking on a Lift Sign created by FalseBook, the sign in your hand duplicates and stacks.

    Not sure if there is much that can be done about this.
     
  5. Offline

    Celtic Minstrel

    Indeed, this is a known bug that I can't really do much about since I don't believe I can tell that some other plugin has hijacked the right-click. If I think of a solution, though, I'll certainly fix it asap.
     
  6. Getting errors sometimes:

    Code:
    16:09:05 [SEVERE] Could not pass event BLOCK_PLACE to SimpleSignEdit
    java.lang.ClassCastException: org.bukkit.craftbukkit.block.CraftBlockState cannot be cast to org.bukkit.block.Sign
            at ca.celticminstrel.signedit.SignEdit$1.onBlockPlace(SignEdit.java:119)
            at org.bukkit.plugin.java.JavaPluginLoader$26.execute(JavaPluginLoader.java:419)
            at org.bukkit.plugin.RegisteredListener.callEvent(RegisteredListener.java:58)
            at org.bukkit.plugin.SimplePluginManager.callEvent(SimplePluginManager.java:310)
            at org.bukkit.craftbukkit.event.CraftEventFactory.callBlockPlaceEvent(CraftEventFactory.java:84)
            at org.bukkit.craftbukkit.event.CraftEventFactory.callBlockPlaceEvent(CraftEventFactory.java:68)
            at net.minecraft.server.ItemSign.a(ItemSign.java:57)
            at net.minecraft.server.ItemStack.placeItem(ItemStack.java:56)
            at net.minecraft.server.ItemInWorldManager.interact(ItemInWorldManager.java:217)
            at net.minecraft.server.NetServerHandler.a(NetServerHandler.java:535)
            at net.minecraft.server.Packet15Place.a(SourceFile:57)
            at net.minecraft.server.NetworkManager.a(NetworkManager.java:196)
            at net.minecraft.server.NetServerHandler.a(NetServerHandler.java:75)
            at net.minecraft.server.NetworkListenThread.a(SourceFile:100)
            at net.minecraft.server.MinecraftServer.h(MinecraftServer.java:377)
            at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:292)
            at net.minecraft.server.ThreadServerApplication.run(SourceFile:394)
     
  7. Offline

    xGhOsTkiLLeRx

    READ THE EDIT!

    Hi,

    I know, CB #812 isn't recommend, but it breaks your plugin :(
    (MC 1.6.4)

    If I edit a sign, I have to re-login and only then I see the changes!

    Greetings :)

    EDIT:

    Updated to CB #814 and all is working fine!
    :)
     
  8. Offline

    ArmEagle

    I see you're trying to place the temporary sign in front of the sign to be edited. But there are some situations where the sign is tucked away. I'm not sure plugins can place signs really anywhere. But what about placing it in the block the player's head is occupying? That is usually air (unlike the bottom block, which could be anything). That or you could perhaps look around in a short distance for air I guess.

    It doesn't happen that often that a sign doesn't have space in front of it though (but it tends to happen when I use them for MinecartMania command signs).

    Great plugin though!

    We are using SignOwner for a little while now (http://forums.bukkit.org/threads/in...0-2-tells-you-who-placed-that-sign-720.10530/). It's nice how you protect signs from being edited by others. But have you thought about protecting them from being broken down by others too?

    I'd be fine in having to copy over (and modify) the config from that plugin into your config file.

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

    Celtic Minstrel

    Sadly, I don't believe this is possible; as I recall, if the sign is not placed where the client expects it to be, it will not show the sign edit window. That said, a workaround may be possible. I'll look into it sometime.

    I had not thought about that, since this plugin was solely about editing the signs. I suppose it's a feature I could add though. I'm already preventing breakage of the temporary signs anyway.
     
  10. Offline

    ArmEagle

    Works for MC 1.6.6, CB 818.
     
  11. Offline

    Phaedrus

    Seems to be working with bukkit 818, but getting this error at server stop.

    Code:
    2011-06-02 19:26:46 [SEVERE] Error occurred while disabling SimpleSignEdit v1.3.4 (Is it up to date?): null
    java.lang.NullPointerException
    	at ca.celticminstrel.signedit.SignEdit.onDisable(SignEdit.java:247)
    	at org.bukkit.plugin.java.JavaPlugin.setEnabled(JavaPlugin.java:127)
    	at org.bukkit.plugin.java.JavaPluginLoader.disablePlugin(JavaPluginLoader.java:771)
    	at org.bukkit.plugin.SimplePluginManager.disablePlugin(SimplePluginManager.java:269)
    	at org.bukkit.plugin.SimplePluginManager.disablePlugins(SimplePluginManager.java:262)
    	at org.bukkit.craftbukkit.CraftServer.disablePlugins(CraftServer.java:123)
    	at net.minecraft.server.MinecraftServer.stop(MinecraftServer.java:260)
    	at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:341)
    	at net.minecraft.server.ThreadServerApplication.run(SourceFile:422)
    
     
  12. Offline

    Celtic Minstrel

    Hm, not sure what that error is; it's likely preventing the plugin from saving owner info, though. I think the latest source has a few things that aren't in the latest release, so if you feel like building it from source and still get the error, let me know.
     
  13. Offline

    Tealk

  14. Offline

    sventi83

    I suggest the other mods implement a way to config signs as a 'dont-activate'.
    (IE, CommandSign could let the user Not Activate a command sign, IF holding a sign.)
    Maybe you could notify other plugin devs to implement something like this to their configs? :)
     
  15. Offline

    ArmEagle

    Except that I do not want people to edit signs used in shops for TradeCraft (see signature). Maybe something similar goes for iConomyChestShop, I didn't really look into that plugin though.

    I only block editing of signs that are specifically used for that plugin though. I'm not sure whether Tealk meant that iConomyChestShop causes editing to be blocked on all signs.
     
  16. Offline

    sventi83

    Guess I can see that.. although it could be handy to be able to just edit the cost or item Id if one mistyped it. :p
    Off topic; I haven't tried your shop-plugin, but it seems interesting. I'll give it a go later today (=
     
  17. Offline

    Kerazene

    Feature request: iConomy support?
    We'd like VIPs to be able to use coloured signs on our server however would like to charge some amount of money for it, would you be able to make it so it charges whenever colour is added to a sign please?
    E.g. "&cHello, Welcome!" would charge X amount of money, but "Hello, Welcome!" would not?

    Thanks a bunch! :)
     
  18. Offline

    iffa

    Looks outdated but 'did' work on a 800+ build some weeks ago. Just to let you people know
     
  19. Offline

    Celtic Minstrel

    iConomy support is fairly unlikely to be honest. I just checked, and it appears to work fine on build 838, so I'll update the title as well.

    There will be an update coming for this. Possibly soon.
     
  20. Offline

    Siriuo

    Your link to download doesnt work
     
  21. Offline

    Celtic Minstrel

    Sorry, I'm aware of this. I expect it to be fixed by tomorrow.

    Link is back up now.

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

    Celtic Minstrel

    Version 1.4
    • When editing signs with & on it, it should be changed to && so that you don't need to edit the whole line.
    • Sign posts can now be stacked by default; clicking on the top face of a sign post with a sign in hand won't trigger an edit. The old behaviour may be retained by changing allow-stacking to false.
    • Permissions nodes are now simplesignedit.node, though the old nodes still work.
    • If you set break-protect to true, players will not be able to break signs unless they are the owner.
    • I added a public function to set the ownership of a sign at a given location; in theory, other plugins could use this to declare signs which would trigger the infinite sign bug as belonging to no-one (which means editable only by those with special privilege to edit all signs). I dunno if anyone will use it, but it's there.
     
  23. Offline

    ArmEagle

    Thanks for the owner changes/protection. We can now probably merge the list from SignOwner into your configuration file and get actual protection.

    I looked at your github page. You added a setOwner function too? I was about to ask that to 'keep the balance'. But it looks like you already thought of that.

    I have no idea what that first point wrt "&" is about. Could you explain?

    And good that sign stacking is an option. Because often I don't have space in front of a sign to edit. Often there is space above it though. Just an idea though, to expand on it just being a configurable option. Maybe you could make it an option to base whether you edit on the player's crouching state? I've seen other plugins use that as a bit of a dirt toggle. But it seems to work.

    In short. I still love this plugin. Makes maintaining MinecartMania signs a LOT easier! :)
     
  24. Offline

    Celtic Minstrel

    What do you mean by "keep the balance"?

    That would be this issue:
    Even with stacking on, wall signs can be edited from above. The stacking option only affects sign posts.

    Hm, that's an interesting idea...
     
  25. Offline

    ArmEagle

    Oh I had too much going on.. I was actually looking for a GetOwner function. But while looking through your code I swapped around thoughts, found the 'SetOwner' and thought I now found both.

    Anyway Ignore all this.

    I think it would be nice, no idea yet why it would be useful, if one could get the owner of a sign just as well as setting one. That's what I meant with the 'balance'.

    And thanks for you responses. I guess I'll update soon. And maybe I should look into these color options for signs for my 'own' plugin.

    Oh another remark. Maybe you should split off the signs from the settings config and put them in their own yml.

    Also, you do mention setting break-protect to true. But maybe that setting could be put in the config file (set to false) if the setting isn't in there. That way someone is sure they use the right setting.

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

    Celtic Minstrel

    Ah, API for getting the owner? Yeah, that's logical; I've no idea why I didn't do that. I'll throw it in on the next version; I won't make a release specifically for that though, unless someone actually informs me that they'd like to make use of it in their plugin.

    It will be, but only after you try breaking a sign controlled by the plugin.
     
  27. Offline

    ArmEagle

    Ok, cool, thanks.

    I just merged all the entries of SignOwner with the list of this plugin and tossed out that other plugin, since your plugin does the same anyway, though just a little bit different. And now also does sign protection. Just perfect!

    One thing, which is a pet-peeve of mine. Since your plugin saves the config when it is disabled (and loads it when enabled, that's good) I need to disable the plugin to make changes to it and then I can enable it. I've been using PlugMan since we switched to Bukkit which allows this. A /reload will not work in this case, because you overwrite any changes someone made to the file on disable.

    But many plugin developers do not think about the possibility their plugin gets disabled and re-enabled without a complete reload by CraftBukkit. This means that when this happens, a lot of plugins will register their event listeners again. And they also ignore the plugin.isEnabled() state when their event listeners receive events, making them not actually disable.

    For my plugins I simply keep a plugin class variable hasRegisteredListeners which I set at the end of onEnable and check for before registering my listeners. It is a small thing and not many people might encounter it.

    In my opinion it is an oversight by the Bukkit team. They should not let plugins register the exact same listener (same priority) twice. If that happens the old one should be cleared. And they shouldn't send events to disabled plugins. But that's just me I guess.
     
  28. Offline

    Toxik

    Would it be possible to also configure or remove the requirement for the actual sign editing itself?
    On my server, we don't use ownerships, and since signs aren't stackable in the inventory (we looked at the 'Stackable' plugin, but it's really not done yet) it can be quite annoying that we always need space for an extra sign.
     
  29. Offline

    ArmEagle

    Something I sometimes forgot about myself is that this plugin makes use of the fact that you are placing a sign somewhere. The plugin itself cannot give you the sign write 'popup'. So it hooks into the fact that a sign is placed by a player. It then quickly sets the text on this sign and lets you change it. Then when you are done it copies back the text from the new sign to the original and removes the new sign, giving back the sign item to you.

    In short, this plugin requires you to actually place a sign, or else it wouldn't work at all. There are other plugins that use commands to edit signs. But I think this is much more user friendly.

    Maybe an idea to help you, is to somehow give the owner of a sign a sign item when he interacts with a sign in some way. Of course this should be an option server owners can choose to use or not. If it is used, the sign would then not be returned when the player is done editing (or add some fancy checking/keeping track).
     
  30. Offline

    Toxik

    I see how you would need that hook. Guess I'll keep track of the Stackable plugin then.
    You are right, though, in stating that this is a lot better than using commands.
    Maybe I'll go and do some reading into the API, although it's been a while since I coded any Java.
    I had this idea in the meantime to hook into editing the sign simply by hitting it, for example with anything but a sword, so you're still able to break it if you want to.
     
  31. Offline

    Xaymar

    Code:
    2011-06-26 01:19:59 [SEVERE] Error occurred while disabling SimpleSignEdit v1.4 (Is it up to date?): null
    java.lang.NullPointerException
        at ca.celticminstrel.signedit.SignEdit.onDisable(SignEdit.java:285)
        at org.bukkit.plugin.java.JavaPlugin.setEnabled(JavaPlugin.java:128)
        at org.bukkit.plugin.java.JavaPluginLoader.disablePlugin(JavaPluginLoader.java:878)
        at org.bukkit.plugin.SimplePluginManager.disablePlugin(SimplePluginManager.java:269)
        at org.bukkit.plugin.SimplePluginManager.disablePlugins(SimplePluginManager.java:262)
        at org.bukkit.plugin.SimplePluginManager.clearPlugins(SimplePluginManager.java:290)
        at org.bukkit.craftbukkit.CraftServer.reload(CraftServer.java:335)
        at org.bukkit.command.SimpleCommandMap$ReloadCommand.execute(SimpleCommandMap.java:281)
        at org.bukkit.command.SimpleCommandMap.dispatch(SimpleCommandMap.java:129)
        at org.bukkit.craftbukkit.CraftServer.dispatchCommand(CraftServer.java:304)
        at net.minecraft.server.NetServerHandler.handleCommand(NetServerHandler.java:725)
        at net.minecraft.server.NetServerHandler.chat(NetServerHandler.java:691)
        at net.minecraft.server.NetServerHandler.a(NetServerHandler.java:684)
        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:451)
        at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:361)
        at net.minecraft.server.ThreadServerApplication.run(SourceFile:422)
    I'm requesting a fix for this, just for the sake of less error messages in the log(I get emailed about them :/ )
     

Share This Page