Uploaded image for project: 'Spigot'
  1. Spigot
  2. SPIGOT-7454

Player#openSign cannot open from far away

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: Minor Minor
    • None
    • None
    • None
    • CraftBukkit version 3853-Spigot-3bce793-d91e5aa (MC: 1.20.1)
    • just the included test plugin
    • Yes

      I noticed recently when using Player#openSign, the player can no longer edit.
      There is kind of 2 issues here.

      With the included jar file, I will explain the two issues
      setup:

      • place a sign down in the world
      • while looking at the sign, run command "/test set" (this just caches the block for later)
      •  

      Issue #2 - can't open from far away:

      • move about 20(ish) blocks away from the sign in any direction
      • run command "/test open" (the sign will not open, you may see it open for a tick and close immediately)
      • In console you shall see:
        "Player <YourName> just tried to change non-editable sign"

      test code (which is in the provided plugin):

      @Override
      public boolean onCommand(@NotNull CommandSender sender, @NotNull Command command, @NotNull String label, @NotNull String[] args) {
          if (sender instanceof Player player && args.length == 1) {
              if (args[0].equalsIgnoreCase("set")) {
                  block = player.getTargetBlockExact(50);
              } else if (args[0].equalsIgnoreCase("open")) {
                  if (block != null && block.getState() instanceof Sign sign) {
                      player.openSign(sign);
                  }
              }
          }
          return true;
      }
      

            Unassigned Unassigned
            ShaneBee Shane Bee
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: