#Sign not Editable

1 messages · Page 1 of 1 (latest)

edgy orchid
#

Hey there guys!

So as the thread name says, I am having an issue where in the console the following message is being sent Player TrappedHeart just tried to change non-editable sign. I am currently coding an edit sign class which was working fine, but suddenly isn't. I've tried a clean server with only the necessary mandatory plugins installed, even without the CoreProtect plugin check as you can see in the code below.

@EventHandler
    public void onPlayerClick (PlayerInteractEvent e){
        CoreProtectAPI api = getCoreProtect();
        Player player = e.getPlayer();
        if (e.getAction().equals(Action.RIGHT_CLICK_BLOCK) && player.isSneaking()){
            if (e.getClickedBlock().getState() instanceof Sign && player.hasPermission("fortunecraft.sign.edit")){
                Block block = e.getClickedBlock();
                String playername = null;
                List<String[]> lookup = api.blockLookup(block, 0);
                if (lookup != null){
                    for (String[] result : lookup){
                        CoreProtectAPI.ParseResult parseResult = api.parseResult(result);
                        playername = parseResult.getPlayer();
                        break;
                    }
                }
                if (playername != null && playername.equalsIgnoreCase(player.getName())){
                    Sign sign = (Sign) block.getState();
                    sign.setEditable(true);
                    sign.update();
                    PacketContainer packet = pm.createPacket(PacketType.Play.Server.OPEN_SIGN_EDITOR);
                    packet.getBlockPositionModifier().write(0, new BlockPosition(block.getX(), block.getY(), block.getZ()));
                    try {
                        pm.sendServerPacket(player, packet);
                    } catch (InvocationTargetException invocationTargetException) {
                        invocationTargetException.printStackTrace();
                    }
                    FortuneCraft.grantAdvancement(player, "creative_mind");
                }else{
                    player.sendMessage(ChatColor.RED + "You must be the Owner of this sign to edit.");
                }
            }
        }
    }

Any help would be much appreciated,
thanks!

orchid fog
edgy orchid
orchid fog
#

I'm serious.

#

The sign has a uuid value for defining the player that is editing it in NMS.

#

I myself ran into this error making a sign editor plug-in

#

Accessing NMS is the only way of doing your idea.