forked from zhdev/griefus
Added logging and rollback support for double sided signs
This commit is contained in:
parent
7e97e12969
commit
4e43a42662
25 changed files with 658 additions and 107 deletions
|
|
@ -9,6 +9,7 @@ import org.bukkit.inventory.InventoryHolder;
|
|||
|
||||
import net.coreprotect.bukkit.BukkitAdapter;
|
||||
import net.coreprotect.config.ConfigHandler;
|
||||
import net.coreprotect.spigot.SpigotAdapter;
|
||||
|
||||
public class PaperAdapter implements PaperInterface {
|
||||
|
||||
|
|
@ -21,6 +22,7 @@ public class PaperAdapter implements PaperInterface {
|
|||
public static final int PAPER_V1_17 = BukkitAdapter.BUKKIT_V1_17;
|
||||
public static final int PAPER_V1_18 = BukkitAdapter.BUKKIT_V1_18;
|
||||
public static final int PAPER_V1_19 = BukkitAdapter.BUKKIT_V1_19;
|
||||
public static final int PAPER_V1_20 = BukkitAdapter.BUKKIT_V1_20;
|
||||
|
||||
public static void loadAdapter() {
|
||||
int paperVersion = ConfigHandler.SERVER_VERSION;
|
||||
|
|
@ -43,9 +45,12 @@ public class PaperAdapter implements PaperInterface {
|
|||
case PAPER_V1_17:
|
||||
case PAPER_V1_18:
|
||||
case PAPER_V1_19:
|
||||
default:
|
||||
PaperAdapter.ADAPTER = new Paper_v1_17();
|
||||
break;
|
||||
case PAPER_V1_20:
|
||||
default:
|
||||
PaperAdapter.ADAPTER = new Paper_v1_20();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -61,7 +66,7 @@ public class PaperAdapter implements PaperInterface {
|
|||
|
||||
@Override
|
||||
public String getLine(Sign sign, int line) {
|
||||
return sign.getLine(line);
|
||||
return SpigotAdapter.ADAPTER.getLine(sign, line);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
|||
21
src/main/java/net/coreprotect/paper/Paper_v1_20.java
Normal file
21
src/main/java/net/coreprotect/paper/Paper_v1_20.java
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
package net.coreprotect.paper;
|
||||
|
||||
import org.bukkit.block.Sign;
|
||||
import org.bukkit.block.sign.Side;
|
||||
|
||||
import net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer;
|
||||
|
||||
public class Paper_v1_20 extends Paper_v1_17 implements PaperInterface {
|
||||
|
||||
@Override
|
||||
public String getLine(Sign sign, int line) {
|
||||
// https://docs.adventure.kyori.net/serializer/
|
||||
if (line < 4) {
|
||||
return LegacyComponentSerializer.legacySection().serialize(sign.getSide(Side.FRONT).line(line));
|
||||
}
|
||||
else {
|
||||
return LegacyComponentSerializer.legacySection().serialize(sign.getSide(Side.BACK).line(line - 4));
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue