How would I go about getting the lines of a sign on the player interact event it seems that (Sign)event.getClickedBlock().getState().getLines(0) doesnt work it gives a red error line under the .getLines(0)
Code:java package com.arnie.sh2.Listeners; import com.arnie.sh2.Main;import org.bukkit.Material;import org.bukkit.block.Block;import org.bukkit.entity.Player;import org.bukkit.event.EventHandler;import org.bukkit.event.EventPriority;import org.bukkit.event.Listener;import org.bukkit.event.block.Action;import org.bukkit.event.player.PlayerInteractEvent;import org.bukkit.material.Sign; public class SignGeneratorListener implements Listener{@EventHandler(priority=EventPriority.NORMAL)public void OutpostClick(PlayerInteractEvent event){ Action action = event.getAction();Player player = event.getPlayer();Block block = event.getClickedBlock(); if ((action == Action.RIGHT_CLICK_BLOCK) && (event.getClickedBlock() != null) && (block.getType() == Material.SIGN_POST) && (((Sign)event.getClickedBlock().getState()).getLine(0).toString().equalsIgnoreCase(Main.config.getString("Stronghold2.Sign.Name"))))){ }}}
Yep, you need to be using org.bukkit.block.Sign there, not org.bukkit.material.Sign. And if your lines of code are getting that long, it's a good sign you need to consider a little reformatting, e.g.: PHP: if (action == Action.RIGHT_CLICK_BLOCK && block != null) { if (block.getType == Material.SIGN_POST) { // do you want to also check for WALL_SIGN? Sign sign = (Sign)block.getState(); if (sign.getLine(0).equalsIgnoreCase(Main.config.getString("Stronghold2.Sign.Name"))) { // ... } }} Just a suggestion