1.14 new signs

Discussion in 'Spigot Plugin Development' started by umbreon.m, Sep 7, 2019.

Thread Status:
Not open for further replies.
  1. Code (Text):
    int max = 255 - block.getY();
    for (int i = 1; i < max; i++) {
       Block face = block.getRelative(BlockFace.UP, i);
       if (face.getType().name().contains("SIGN_")) {
          Sign sign = (Sign) face.getState();
          if (sign.getLine(1).equals("[Lift Down]")) {
             return face;

    if I put an oak sign at my position and four blocks above me also one and click it with the right mouse button, I get "Sign_Post" back. If I do the same with one of the new signs from the 1.14, then I just get "AIR" back.

    Does someone know how i solve this?
  2. you need to add the API version to your plugin.yml
    you can find info on that here -> Optional Attributes

    Code (YAML):
    api-version: '1.14'
    • Agree Agree x 2
  3. As you have said youself ...
    You are using
    Code (Text):
    if (face.getType().name().contains("SIGN_")) {
    And yet
    There is a mis-match here! Both in CASE, and in content, the underScore position.

    Take a look at the assigned enums for 1.14 Materials of Signs and you will find that they are different from previous versions.
  4. well a good way would be just:
    Code (Java):
    if (face.getType().name().toUpperCase().contains("SIGN"))
    I use similar methods for any material type I need.
  5. I recommend using TAGS
    Code (Java):
    if (Tag.SIGNS.isTagged(face.getType()))
    • Like Like x 2
    • Informative Informative x 1
  6. Oh? I never knew these existed. Yeah this is more optimized than getting the enum name and making it upper case. Thanks!
  7. You're welcome. If im not mistaken, the tags match the tags in Minecraft ... like you can go into creative mode, and in the search bar use the tags like #bed or #sign
  8. MiniDigger


    yes, bukkits tags are just wrappers
    (unless papers MaterialTag class which provides additional ones ontop of minecrafts inbuild ones https://papermc.io/javadocs/paper/1.14/com/destroystokyo/paper/MaterialTags.html)
    • Informative Informative x 1
  9. As stated in the first reply, putting the correct api version in your plugin.yml should fix your issue.
  10. This is, just more logical as in my English train of thought.
    Code (Text):
    if (event.getBlock().getType().name().toLowerCase().contains("sign")) {
    IMO the code is more transferable to other versions.
    Why make it more compicated when other tests are made by the programer afterwards?
  11. MiniDigger


    see, there are proper solutions and there are hacks.
    tags for the proper solution to this problem, build by mojang for us. your solution is a hack (that performs worse, tags are sets, O(1)) to allow you to support outdated versions. your code is also worse to read/maintain.
    not everybody thinks that these tradeoffs are worth supporting ancient versions. I don't. thats why many ppl only target modern version of minecraft, in particular the "post-flattening" versions (1.13+).
    • Agree Agree x 2
  12. I have investigated 'TAG's as used here for Minecraft, and I see no real benefit other than it is a replacement of 'instanceof'
    (instanceof appears to have been removed from Materials comparison)
    In this case.
    'isTagged' appears to be a replacement of '!null' and 'instanceof', combined. (Supposidly more ideal)

    TAG.WALL_SIGNS contains Material.(Treespecies+Material)
    TAG.STANDING_SIGNS contains Material.(Treespecies+Material)
    (TAG identifiers and Material identifiers are not even consistent with the minecraft names viewed using F3 (These have been known as friendly names))

    There is no other data available from TAGS appart from their subClass'

    Meaning that previous methods are required for further manipulation.
    #12 Goldentoenail, Sep 13, 2019
    Last edited: Sep 13, 2019
  13. Problem solved. Thank you all for helping and sorry for the late response.
Thread Status:
Not open for further replies.