Updates depreciated sign API calls

This commit is contained in:
2023-06-07 18:35:22 +02:00
parent 22f4cb78f6
commit 1c06cf2188
5 changed files with 11 additions and 7 deletions

View File

@@ -521,10 +521,12 @@ portalInfoServer=Server: %server%
# Changes # Changes
#### \[Version 0.11.5.4] Unified Legacy Fork #### \[Version 0.11.5.4] Unified Legacy Fork
- Fix for a problem which could cause activators to generate at invalid locations. - Fix for a problem which could cause activators to generate at invalid locations.
- Minor documentation clarification. - Minor documentation clarification.
#### \[Version 0.11.5.3] Unified Legacy Fork #### \[Version 0.11.5.3] Unified Legacy Fork
- Hotfix for an issue wherein the gate folder failed to populate on fresh installs. - Hotfix for an issue wherein the gate folder failed to populate on fresh installs.
#### \[Version 0.11.5.2] Unified Legacy Fork #### \[Version 0.11.5.2] Unified Legacy Fork

View File

@@ -45,7 +45,7 @@
<dependency> <dependency>
<groupId>org.spigotmc</groupId> <groupId>org.spigotmc</groupId>
<artifactId>spigot-api</artifactId> <artifactId>spigot-api</artifactId>
<version>1.19.4-R0.1-SNAPSHOT</version> <version>1.20-R0.1-SNAPSHOT</version>
<scope>provided</scope> <scope>provided</scope>
</dependency> </dependency>
<dependency> <dependency>

View File

@@ -4,6 +4,7 @@ import net.knarcraft.knarlib.util.ColorHelper;
import net.md_5.bungee.api.ChatColor; import net.md_5.bungee.api.ChatColor;
import org.bukkit.DyeColor; import org.bukkit.DyeColor;
import org.bukkit.block.Sign; import org.bukkit.block.Sign;
import org.bukkit.block.sign.Side;
/** /**
* A class that keeps track of the sign colors for a given sign * A class that keeps track of the sign colors for a given sign
@@ -26,7 +27,7 @@ public class SignData {
this.sign = sign; this.sign = sign;
this.mainSignColor = mainSignColor; this.mainSignColor = mainSignColor;
this.highlightSignColor = highlightSignColor; this.highlightSignColor = highlightSignColor;
this.dyedColor = sign.getColor(); this.dyedColor = sign.getSide(Side.FRONT).getColor();
} }
/** /**

View File

@@ -11,6 +11,7 @@ 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 java.util.Map; import java.util.Map;
@@ -175,7 +176,7 @@ public class PortalSignDrawer {
*/ */
private void clearSign(Sign sign) { private void clearSign(Sign sign) {
for (int index = 0; index <= 3; index++) { for (int index = 0; index <= 3; index++) {
sign.setLine(index, ""); sign.getSide(Side.FRONT).setLine(index, "");
} }
} }
@@ -188,7 +189,7 @@ public class PortalSignDrawer {
return; return;
} }
clearSign(sign); clearSign(sign);
sign.setLine(0, translateAllColorCodes(portal.getName())); sign.getSide(Side.FRONT).setLine(0, translateAllColorCodes(portal.getName()));
sign.update(); sign.update();
} }
@@ -256,7 +257,7 @@ public class PortalSignDrawer {
*/ */
public void setLine(SignData signData, int index, String text) { public void setLine(SignData signData, int index, String text) {
ChatColor mainColor = signData.getMainSignColor(); ChatColor mainColor = signData.getMainSignColor();
signData.getSign().setLine(index, mainColor + text); signData.getSign().getSide(Side.FRONT).setLine(index, mainColor + text);
} }
/** /**
@@ -357,7 +358,7 @@ public class PortalSignDrawer {
if (!(blockState instanceof Sign sign)) { if (!(blockState instanceof Sign sign)) {
return; return;
} }
sign.setLine(3, errorColor + Stargate.getString("signInvalidGate")); sign.getSide(Side.FRONT).setLine(3, errorColor + Stargate.getString("signInvalidGate"));
sign.update(); sign.update();
Stargate.logInfo(String.format("Gate layout on line %d does not exist [%s]", lineIndex, gateName)); Stargate.logInfo(String.format("Gate layout on line %d does not exist [%s]", lineIndex, gateName));