Updates for 1.20
Updates Spigot version Changes API version to 1.20 Updates depreciated sign code Waxes new permission signs
This commit is contained in:
parent
4c47332c98
commit
18642fc046
4
pom.xml
4
pom.xml
@ -73,13 +73,13 @@
|
|||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.spigotmc</groupId>
|
<groupId>org.spigotmc</groupId>
|
||||||
<artifactId>spigot-api</artifactId>
|
<artifactId>spigot-api</artifactId>
|
||||||
<version>1.19.2-R0.1-SNAPSHOT</version>
|
<version>1.20.1-R0.1-SNAPSHOT</version>
|
||||||
<scope>provided</scope>
|
<scope>provided</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.jetbrains</groupId>
|
<groupId>org.jetbrains</groupId>
|
||||||
<artifactId>annotations</artifactId>
|
<artifactId>annotations</artifactId>
|
||||||
<version>23.0.0</version>
|
<version>24.0.1</version>
|
||||||
<scope>compile</scope>
|
<scope>compile</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
|
@ -14,6 +14,8 @@ import org.bukkit.Material;
|
|||||||
import org.bukkit.Tag;
|
import org.bukkit.Tag;
|
||||||
import org.bukkit.block.Block;
|
import org.bukkit.block.Block;
|
||||||
import org.bukkit.block.Sign;
|
import org.bukkit.block.Sign;
|
||||||
|
import org.bukkit.block.sign.Side;
|
||||||
|
import org.bukkit.block.sign.SignSide;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.event.EventHandler;
|
import org.bukkit.event.EventHandler;
|
||||||
import org.bukkit.event.Listener;
|
import org.bukkit.event.Listener;
|
||||||
@ -194,7 +196,8 @@ public class SignListener implements Listener {
|
|||||||
* @param player <p>The player that interacted with the sign</p>
|
* @param player <p>The player that interacted with the sign</p>
|
||||||
*/
|
*/
|
||||||
private void registerPermissionSign(Sign sign, SignCreationRequest request, Player player) {
|
private void registerPermissionSign(Sign sign, SignCreationRequest request, Player player) {
|
||||||
String[] lines = sign.getLines();
|
SignSide frontSide = sign.getSide(Side.FRONT);
|
||||||
|
String[] lines = frontSide.getLines();
|
||||||
//Don't allow non-empty signs to be overwritten
|
//Don't allow non-empty signs to be overwritten
|
||||||
if (!Arrays.stream(lines).allMatch(String::isEmpty)) {
|
if (!Arrays.stream(lines).allMatch(String::isEmpty)) {
|
||||||
return;
|
return;
|
||||||
@ -209,8 +212,9 @@ public class SignListener implements Listener {
|
|||||||
//Display the permission sign information on the sign
|
//Display the permission sign information on the sign
|
||||||
String[] signLines = permissionSign.getSignLines();
|
String[] signLines = permissionSign.getSignLines();
|
||||||
for (int i = 0; i < signLines.length; i++) {
|
for (int i = 0; i < signLines.length; i++) {
|
||||||
sign.setLine(i, signLines[i]);
|
frontSide.setLine(i, signLines[i]);
|
||||||
}
|
}
|
||||||
|
sign.setWaxed(true);
|
||||||
sign.update();
|
sign.update();
|
||||||
player.sendMessage(StringFormatter.getTranslatedInfoMessage(TranslatableMessage.PERMISSION_SIGN_CREATED));
|
player.sendMessage(StringFormatter.getTranslatedInfoMessage(TranslatableMessage.PERMISSION_SIGN_CREATED));
|
||||||
}
|
}
|
||||||
|
@ -7,6 +7,8 @@ import org.bukkit.Location;
|
|||||||
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.bukkit.block.sign.SignSide;
|
||||||
import org.bukkit.configuration.ConfigurationSection;
|
import org.bukkit.configuration.ConfigurationSection;
|
||||||
import org.bukkit.configuration.InvalidConfigurationException;
|
import org.bukkit.configuration.InvalidConfigurationException;
|
||||||
import org.bukkit.configuration.file.YamlConfiguration;
|
import org.bukkit.configuration.file.YamlConfiguration;
|
||||||
@ -127,12 +129,14 @@ public final class SignManager {
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
String[] newLines = permissionSign.getSignLines();
|
String[] newLines = permissionSign.getSignLines();
|
||||||
if (Arrays.equals(sign.getLines(), newLines)) {
|
SignSide frontSide = sign.getSide(Side.FRONT);
|
||||||
|
if (Arrays.equals(frontSide.getLines(), newLines)) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
for (int i = 0; i < 4; i++) {
|
for (int i = 0; i < 4; i++) {
|
||||||
sign.setLine(i, newLines[i]);
|
frontSide.setLine(i, newLines[i]);
|
||||||
}
|
}
|
||||||
|
sign.setWaxed(true);
|
||||||
sign.update();
|
sign.update();
|
||||||
}
|
}
|
||||||
for (Location signLocation : invalidPermissionSigns) {
|
for (Location signLocation : invalidPermissionSigns) {
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
name: PermissionSigns
|
name: PermissionSigns
|
||||||
version: 1.0.4
|
version: 1.0.4
|
||||||
main: net.knarcraft.permissionsigns.PermissionSigns
|
main: net.knarcraft.permissionsigns.PermissionSigns
|
||||||
api-version: 1.18
|
api-version: '1.20'
|
||||||
prefix: PermissionSigns
|
prefix: PermissionSigns
|
||||||
depend: [ Vault ]
|
depend: [ Vault ]
|
||||||
authors: [ EpicKnarvik97 ]
|
authors: [ EpicKnarvik97 ]
|
||||||
|
Loading…
Reference in New Issue
Block a user