Uses optional legacy method when getting sign lines
This commit is contained in:
@@ -13,7 +13,6 @@ import org.bukkit.Material;
|
|||||||
import org.bukkit.block.Block;
|
import org.bukkit.block.Block;
|
||||||
import org.bukkit.block.BlockState;
|
import org.bukkit.block.BlockState;
|
||||||
import org.bukkit.block.Sign;
|
import org.bukkit.block.Sign;
|
||||||
import org.bukkit.block.sign.Side;
|
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
import org.jetbrains.annotations.Nullable;
|
import org.jetbrains.annotations.Nullable;
|
||||||
|
|
||||||
@@ -184,7 +183,8 @@ public class PortalSignDrawer {
|
|||||||
*/
|
*/
|
||||||
private void updateSign(@NotNull Sign sign, @NotNull String[] lines) {
|
private void updateSign(@NotNull Sign sign, @NotNull String[] lines) {
|
||||||
boolean updateNecessary = false;
|
boolean updateNecessary = false;
|
||||||
String[] oldLines = sign.getSide(Side.FRONT).getLines();
|
|
||||||
|
String[] oldLines = SignHelper.getLines(sign);
|
||||||
for (int i = 0; i < 4; i++) {
|
for (int i = 0; i < 4; i++) {
|
||||||
if (!oldLines[i].equals(lines[i])) {
|
if (!oldLines[i].equals(lines[i])) {
|
||||||
updateNecessary = true;
|
updateNecessary = true;
|
||||||
|
@@ -17,6 +17,23 @@ public final class SignHelper {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the lines of the given sign
|
||||||
|
*
|
||||||
|
* @param sign <p>The sign to get lines from</p>
|
||||||
|
* @return <p>The lines of the sign</p>
|
||||||
|
*/
|
||||||
|
@NotNull
|
||||||
|
public static String[] getLines(@NotNull Sign sign) {
|
||||||
|
if (HAS_SIGN_SIDES) {
|
||||||
|
return sign.getSide(Side.FRONT).getLines();
|
||||||
|
} else {
|
||||||
|
// Note: This is depreciated, but is currently necessary for pre-1.19.4 support
|
||||||
|
//noinspection deprecation
|
||||||
|
return sign.getLines();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the dye color of the given sign
|
* Gets the dye color of the given sign
|
||||||
*
|
*
|
||||||
|
Reference in New Issue
Block a user