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

Player#openSign cannot edit

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • 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 #1 - can't edit:

      • run command "/test open" (this will open the sign)
      • type stuff in editor
      • close sign editor
      • At this point you shall see no changes to the sign, and 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:
            1 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: