mirror of
https://github.com/ViaVersion/ViaBackwards.git
synced 2024-11-25 12:45:35 +01:00
parent
f263f757de
commit
32c26a5539
@ -41,7 +41,7 @@
|
|||||||
<plugin>
|
<plugin>
|
||||||
<groupId>org.apache.maven.plugins</groupId>
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
<artifactId>maven-shade-plugin</artifactId>
|
<artifactId>maven-shade-plugin</artifactId>
|
||||||
<version>3.2.1</version>
|
<version>3.2.2</version>
|
||||||
<configuration>
|
<configuration>
|
||||||
<createDependencyReducedPom>false</createDependencyReducedPom>
|
<createDependencyReducedPom>false</createDependencyReducedPom>
|
||||||
<minimizeJar>false</minimizeJar>
|
<minimizeJar>false</minimizeJar>
|
||||||
@ -91,36 +91,42 @@
|
|||||||
<groupId>nl.matsv</groupId>
|
<groupId>nl.matsv</groupId>
|
||||||
<artifactId>viabackwards-core</artifactId>
|
<artifactId>viabackwards-core</artifactId>
|
||||||
<version>${project.parent.version}</version>
|
<version>${project.parent.version}</version>
|
||||||
|
<scope>compile</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>nl.matsv</groupId>
|
<groupId>nl.matsv</groupId>
|
||||||
<artifactId>viabackwards-bukkit</artifactId>
|
<artifactId>viabackwards-bukkit</artifactId>
|
||||||
<version>${project.parent.version}</version>
|
<version>${project.parent.version}</version>
|
||||||
|
<scope>compile</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>nl.matsv</groupId>
|
<groupId>nl.matsv</groupId>
|
||||||
<artifactId>viabackwards-bungee</artifactId>
|
<artifactId>viabackwards-bungee</artifactId>
|
||||||
<version>${project.parent.version}</version>
|
<version>${project.parent.version}</version>
|
||||||
|
<scope>compile</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>nl.matsv</groupId>
|
<groupId>nl.matsv</groupId>
|
||||||
<artifactId>viabackwards-fabric</artifactId>
|
<artifactId>viabackwards-fabric</artifactId>
|
||||||
<version>${project.parent.version}</version>
|
<version>${project.parent.version}</version>
|
||||||
|
<scope>compile</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>nl.matsv</groupId>
|
<groupId>nl.matsv</groupId>
|
||||||
<artifactId>viabackwards-sponge</artifactId>
|
<artifactId>viabackwards-sponge</artifactId>
|
||||||
<version>${project.parent.version}</version>
|
<version>${project.parent.version}</version>
|
||||||
|
<scope>compile</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>nl.matsv</groupId>
|
<groupId>nl.matsv</groupId>
|
||||||
<artifactId>viabackwards-velocity</artifactId>
|
<artifactId>viabackwards-velocity</artifactId>
|
||||||
<version>${project.parent.version}</version>
|
<version>${project.parent.version}</version>
|
||||||
|
<scope>compile</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
</project>
|
</project>
|
||||||
|
@ -12,12 +12,12 @@
|
|||||||
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||||
|
<modelVersion>4.0.0</modelVersion>
|
||||||
<parent>
|
<parent>
|
||||||
<artifactId>viabackwards-parent</artifactId>
|
<artifactId>viabackwards-parent</artifactId>
|
||||||
<groupId>nl.matsv</groupId>
|
<groupId>nl.matsv</groupId>
|
||||||
<version>3.0.0-SNAPSHOT</version>
|
<version>3.0.0-SNAPSHOT</version>
|
||||||
</parent>
|
</parent>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
|
||||||
|
|
||||||
<artifactId>viabackwards-bukkit</artifactId>
|
<artifactId>viabackwards-bukkit</artifactId>
|
||||||
|
|
||||||
@ -32,13 +32,14 @@
|
|||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.spigotmc</groupId>
|
<groupId>org.spigotmc</groupId>
|
||||||
<artifactId>spigot-api</artifactId>
|
<artifactId>spigot-api</artifactId>
|
||||||
<version>1.13-R0.1-SNAPSHOT</version>
|
<version>1.15.2-R0.1-SNAPSHOT</version>
|
||||||
<scope>provided</scope>
|
<scope>provided</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>nl.matsv</groupId>
|
<groupId>nl.matsv</groupId>
|
||||||
<artifactId>viabackwards-core</artifactId>
|
<artifactId>viabackwards-core</artifactId>
|
||||||
<version>${project.parent.version}</version>
|
<version>${project.parent.version}</version>
|
||||||
|
<scope>compile</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
||||||
|
@ -11,13 +11,26 @@
|
|||||||
package nl.matsv.viabackwards;
|
package nl.matsv.viabackwards;
|
||||||
|
|
||||||
import nl.matsv.viabackwards.api.ViaBackwardsPlatform;
|
import nl.matsv.viabackwards.api.ViaBackwardsPlatform;
|
||||||
|
import nl.matsv.viabackwards.listener.LecternInteractListener;
|
||||||
import org.bukkit.plugin.java.JavaPlugin;
|
import org.bukkit.plugin.java.JavaPlugin;
|
||||||
|
import us.myles.ViaVersion.api.Via;
|
||||||
|
import us.myles.ViaVersion.api.protocol.ProtocolRegistry;
|
||||||
|
import us.myles.ViaVersion.api.protocol.ProtocolVersion;
|
||||||
|
import us.myles.ViaVersion.bukkit.platform.BukkitViaLoader;
|
||||||
|
|
||||||
public class BukkitPlugin extends JavaPlugin implements ViaBackwardsPlatform {
|
public class BukkitPlugin extends JavaPlugin implements ViaBackwardsPlatform {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onEnable() {
|
public void onEnable() {
|
||||||
init(getDataFolder());
|
init(getDataFolder());
|
||||||
|
Via.getPlatform().runSync(this::onServerLoaded);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void onServerLoaded() {
|
||||||
|
if (ProtocolRegistry.SERVER_PROTOCOL >= ProtocolVersion.v1_14.getId()) {
|
||||||
|
BukkitViaLoader loader = (BukkitViaLoader) Via.getManager().getLoader();
|
||||||
|
loader.storeListener(new LecternInteractListener()).register();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -0,0 +1,47 @@
|
|||||||
|
package nl.matsv.viabackwards.listener;
|
||||||
|
|
||||||
|
import nl.matsv.viabackwards.protocol.protocol1_13_2to1_14.Protocol1_13_2To1_14;
|
||||||
|
import org.bukkit.Material;
|
||||||
|
import org.bukkit.block.Block;
|
||||||
|
import org.bukkit.block.Lectern;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
import org.bukkit.event.EventHandler;
|
||||||
|
import org.bukkit.event.EventPriority;
|
||||||
|
import org.bukkit.event.player.PlayerInteractEvent;
|
||||||
|
import org.bukkit.inventory.ItemStack;
|
||||||
|
import org.bukkit.inventory.meta.BookMeta;
|
||||||
|
import us.myles.ViaVersion.ViaVersionPlugin;
|
||||||
|
import us.myles.ViaVersion.bukkit.listeners.ViaBukkitListener;
|
||||||
|
|
||||||
|
public class LecternInteractListener extends ViaBukkitListener {
|
||||||
|
|
||||||
|
public LecternInteractListener() {
|
||||||
|
super(ViaVersionPlugin.getInstance(), Protocol1_13_2To1_14.class);
|
||||||
|
}
|
||||||
|
|
||||||
|
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
|
||||||
|
public void onLecternInteract(PlayerInteractEvent event) {
|
||||||
|
Player player = event.getPlayer();
|
||||||
|
if (!isOnPipe(player)) return;
|
||||||
|
|
||||||
|
Block block = event.getClickedBlock();
|
||||||
|
if (block == null || block.getType() != Material.LECTERN) return;
|
||||||
|
|
||||||
|
Lectern lectern = (Lectern) block.getState();
|
||||||
|
ItemStack book = lectern.getInventory().getItem(0);
|
||||||
|
if (book == null) return;
|
||||||
|
|
||||||
|
BookMeta meta = (BookMeta) book.getItemMeta();
|
||||||
|
|
||||||
|
// Open a book with the text of the lectern's writable book
|
||||||
|
ItemStack newBook = new ItemStack(Material.WRITTEN_BOOK);
|
||||||
|
BookMeta newBookMeta = (BookMeta) newBook.getItemMeta();
|
||||||
|
newBookMeta.setPages(meta.getPages());
|
||||||
|
newBookMeta.setAuthor("an upsidedown person");
|
||||||
|
newBookMeta.setTitle("buk");
|
||||||
|
newBook.setItemMeta(newBookMeta);
|
||||||
|
player.openBook(newBook);
|
||||||
|
|
||||||
|
event.setCancelled(true);
|
||||||
|
}
|
||||||
|
}
|
@ -12,12 +12,12 @@
|
|||||||
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||||
|
<modelVersion>4.0.0</modelVersion>
|
||||||
<parent>
|
<parent>
|
||||||
<artifactId>viabackwards-parent</artifactId>
|
<artifactId>viabackwards-parent</artifactId>
|
||||||
<groupId>nl.matsv</groupId>
|
<groupId>nl.matsv</groupId>
|
||||||
<version>3.0.0-SNAPSHOT</version>
|
<version>3.0.0-SNAPSHOT</version>
|
||||||
</parent>
|
</parent>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
|
||||||
|
|
||||||
<artifactId>viabackwards-bungee</artifactId>
|
<artifactId>viabackwards-bungee</artifactId>
|
||||||
|
|
||||||
@ -34,7 +34,7 @@
|
|||||||
<dependency>
|
<dependency>
|
||||||
<groupId>net.md-5</groupId>
|
<groupId>net.md-5</groupId>
|
||||||
<artifactId>bungeecord-api</artifactId>
|
<artifactId>bungeecord-api</artifactId>
|
||||||
<version>1.13-SNAPSHOT</version>
|
<version>1.15-SNAPSHOT</version>
|
||||||
<scope>provided</scope>
|
<scope>provided</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
@ -43,6 +43,7 @@
|
|||||||
<groupId>nl.matsv</groupId>
|
<groupId>nl.matsv</groupId>
|
||||||
<artifactId>viabackwards-core</artifactId>
|
<artifactId>viabackwards-core</artifactId>
|
||||||
<version>${project.parent.version}</version>
|
<version>${project.parent.version}</version>
|
||||||
|
<scope>compile</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
||||||
|
@ -12,22 +12,15 @@
|
|||||||
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||||
|
<modelVersion>4.0.0</modelVersion>
|
||||||
<parent>
|
<parent>
|
||||||
<artifactId>viabackwards-parent</artifactId>
|
<artifactId>viabackwards-parent</artifactId>
|
||||||
<groupId>nl.matsv</groupId>
|
<groupId>nl.matsv</groupId>
|
||||||
<version>3.0.0-SNAPSHOT</version>
|
<version>3.0.0-SNAPSHOT</version>
|
||||||
</parent>
|
</parent>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
|
||||||
|
|
||||||
<artifactId>viabackwards-core</artifactId>
|
<artifactId>viabackwards-core</artifactId>
|
||||||
|
|
||||||
<repositories>
|
|
||||||
<repository>
|
|
||||||
<id>viaversion-repo</id>
|
|
||||||
<url>https://repo.viaversion.com/</url>
|
|
||||||
</repository>
|
|
||||||
</repositories>
|
|
||||||
|
|
||||||
<dependencies>
|
<dependencies>
|
||||||
<!-- Netty (Network Library) -->
|
<!-- Netty (Network Library) -->
|
||||||
<dependency>
|
<dependency>
|
||||||
|
@ -79,7 +79,7 @@ public class BlockItemPackets1_14 extends nl.matsv.viabackwards.api.rewriters.It
|
|||||||
if (type == 2) containerTitle = "Barrel";
|
if (type == 2) containerTitle = "Barrel";
|
||||||
stringType = "minecraft:container";
|
stringType = "minecraft:container";
|
||||||
slotSize = (type + 1) * 9;
|
slotSize = (type + 1) * 9;
|
||||||
} else
|
} else {
|
||||||
switch (type) {
|
switch (type) {
|
||||||
case 11:
|
case 11:
|
||||||
stringType = "minecraft:crafting_table";
|
stringType = "minecraft:crafting_table";
|
||||||
@ -126,6 +126,7 @@ public class BlockItemPackets1_14 extends nl.matsv.viabackwards.api.rewriters.It
|
|||||||
slotSize = 27;
|
slotSize = 27;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (stringType == null) {
|
if (stringType == null) {
|
||||||
ViaBackwards.getPlatform().getLogger().warning("Can't open inventory for 1.13 player! Type: " + type);
|
ViaBackwards.getPlatform().getLogger().warning("Can't open inventory for 1.13 player! Type: " + type);
|
||||||
|
@ -12,12 +12,12 @@
|
|||||||
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||||
|
<modelVersion>4.0.0</modelVersion>
|
||||||
<parent>
|
<parent>
|
||||||
<artifactId>viabackwards-parent</artifactId>
|
<artifactId>viabackwards-parent</artifactId>
|
||||||
<groupId>nl.matsv</groupId>
|
<groupId>nl.matsv</groupId>
|
||||||
<version>3.0.0-SNAPSHOT</version>
|
<version>3.0.0-SNAPSHOT</version>
|
||||||
</parent>
|
</parent>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
|
||||||
|
|
||||||
<artifactId>viabackwards-fabric</artifactId>
|
<artifactId>viabackwards-fabric</artifactId>
|
||||||
|
|
||||||
@ -45,6 +45,7 @@
|
|||||||
<groupId>nl.matsv</groupId>
|
<groupId>nl.matsv</groupId>
|
||||||
<artifactId>viabackwards-core</artifactId>
|
<artifactId>viabackwards-core</artifactId>
|
||||||
<version>${project.parent.version}</version>
|
<version>${project.parent.version}</version>
|
||||||
|
<scope>compile</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
||||||
|
@ -12,12 +12,12 @@
|
|||||||
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||||
|
<modelVersion>4.0.0</modelVersion>
|
||||||
<parent>
|
<parent>
|
||||||
<artifactId>viabackwards-parent</artifactId>
|
<artifactId>viabackwards-parent</artifactId>
|
||||||
<groupId>nl.matsv</groupId>
|
<groupId>nl.matsv</groupId>
|
||||||
<version>3.0.0-SNAPSHOT</version>
|
<version>3.0.0-SNAPSHOT</version>
|
||||||
</parent>
|
</parent>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
|
||||||
|
|
||||||
<artifactId>viabackwards-sponge</artifactId>
|
<artifactId>viabackwards-sponge</artifactId>
|
||||||
|
|
||||||
@ -70,6 +70,7 @@
|
|||||||
<groupId>nl.matsv</groupId>
|
<groupId>nl.matsv</groupId>
|
||||||
<artifactId>viabackwards-core</artifactId>
|
<artifactId>viabackwards-core</artifactId>
|
||||||
<version>${project.parent.version}</version>
|
<version>${project.parent.version}</version>
|
||||||
|
<scope>compile</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<!-- Sponge API -->
|
<!-- Sponge API -->
|
||||||
|
@ -12,12 +12,12 @@
|
|||||||
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||||
|
<modelVersion>4.0.0</modelVersion>
|
||||||
<parent>
|
<parent>
|
||||||
<artifactId>viabackwards-parent</artifactId>
|
<artifactId>viabackwards-parent</artifactId>
|
||||||
<groupId>nl.matsv</groupId>
|
<groupId>nl.matsv</groupId>
|
||||||
<version>3.0.0-SNAPSHOT</version>
|
<version>3.0.0-SNAPSHOT</version>
|
||||||
</parent>
|
</parent>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
|
||||||
|
|
||||||
<artifactId>viabackwards-velocity</artifactId>
|
<artifactId>viabackwards-velocity</artifactId>
|
||||||
|
|
||||||
@ -70,6 +70,7 @@
|
|||||||
<groupId>nl.matsv</groupId>
|
<groupId>nl.matsv</groupId>
|
||||||
<artifactId>viabackwards-core</artifactId>
|
<artifactId>viabackwards-core</artifactId>
|
||||||
<version>${project.parent.version}</version>
|
<version>${project.parent.version}</version>
|
||||||
|
<scope>compile</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<!-- Velocity API -->
|
<!-- Velocity API -->
|
||||||
|
Loading…
Reference in New Issue
Block a user