Update VV dependency to 3.3.0

This commit is contained in:
KennyTV 2021-04-27 10:01:16 +02:00
parent 8cec16e6eb
commit 5611c9986a
No known key found for this signature in database
GPG Key ID: 6BE3B555EBC5982B
3 changed files with 18 additions and 16 deletions

View File

@ -6,7 +6,7 @@
<groupId>de.gerrygames</groupId>
<artifactId>viarewind-legacy-support</artifactId>
<version>1.3.3</version>
<version>1.3.4</version>
<packaging>jar</packaging>
<properties>
@ -42,7 +42,7 @@
<dependency>
<groupId>us.myles</groupId>
<artifactId>viaversion</artifactId>
<version>2.2.2</version>
<version>3.3.0-21w15a</version>
<scope>provided</scope>
</dependency>
@ -50,7 +50,7 @@
<dependency>
<groupId>org.spigotmc</groupId>
<artifactId>spigot-api</artifactId>
<version>1.15.1-R0.1-SNAPSHOT</version>
<version>1.16.5-R0.1-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
</dependencies>

View File

@ -12,7 +12,7 @@ import org.bukkit.Bukkit;
import org.bukkit.configuration.file.FileConfiguration;
import org.bukkit.plugin.java.JavaPlugin;
import org.bukkit.scheduler.BukkitRunnable;
import us.myles.ViaVersion.api.protocol.ProtocolRegistry;
import us.myles.ViaVersion.api.Via;
public class BukkitPlugin extends JavaPlugin {
private static BukkitPlugin instance;
@ -27,23 +27,24 @@ public class BukkitPlugin extends JavaPlugin {
new BukkitRunnable() {
@Override
public void run() {
if (ProtocolRegistry.SERVER_PROTOCOL == -1) return;
int serverProtocol = Via.getAPI().getServerVersion().lowestSupportedVersion();
if (serverProtocol == -1) return;
cancel();
if (ProtocolRegistry.SERVER_PROTOCOL > 5 && config.getBoolean("enchanting-gui-fix"))
if (serverProtocol > 5 && config.getBoolean("enchanting-gui-fix"))
Bukkit.getPluginManager().registerEvents(new EnchantingListener(), BukkitPlugin.this);
if (ProtocolRegistry.SERVER_PROTOCOL > 78 && config.getBoolean("brewing-stand-gui-fix"))
if (serverProtocol > 78 && config.getBoolean("brewing-stand-gui-fix"))
Bukkit.getPluginManager().registerEvents(new BrewingListener(), BukkitPlugin.this);
if (ProtocolRegistry.SERVER_PROTOCOL > 84 && config.getBoolean("lily-pad-fix"))
if (serverProtocol > 84 && config.getBoolean("lily-pad-fix"))
BoundingBoxFixer.fixLilyPad();
if (ProtocolRegistry.SERVER_PROTOCOL > 48 && config.getBoolean("ladder-fix"))
if (serverProtocol > 48 && config.getBoolean("ladder-fix"))
BoundingBoxFixer.fixLadder();
if (ProtocolRegistry.SERVER_PROTOCOL > 47 && config.getBoolean("sound-fix"))
if (serverProtocol > 47 && config.getBoolean("sound-fix"))
Bukkit.getPluginManager().registerEvents(new SoundListener(), BukkitPlugin.this);
if (ProtocolRegistry.SERVER_PROTOCOL > 5 && config.getBoolean("slime-fix"))
if (serverProtocol > 5 && config.getBoolean("slime-fix"))
Bukkit.getPluginManager().registerEvents(new BounceListener(), BukkitPlugin.this);
if (ProtocolRegistry.SERVER_PROTOCOL > 76 && config.getBoolean("elytra-fix"))
if (serverProtocol > 76 && config.getBoolean("elytra-fix"))
Bukkit.getPluginManager().registerEvents(new ElytraListener(), BukkitPlugin.this);
if (ProtocolRegistry.SERVER_PROTOCOL > 54 && config.getBoolean("area-effect-cloud-particles"))
if (serverProtocol > 54 && config.getBoolean("area-effect-cloud-particles"))
Bukkit.getPluginManager().registerEvents(new AreaEffectCloudListener(), BukkitPlugin.this);
if (config.getBoolean("versioninfo.active"))
new VersionInformer();

View File

@ -1,7 +1,7 @@
package de.gerrygames.viarewind.legacysupport.injector;
import de.gerrygames.viarewind.legacysupport.reflection.ReflectionAPI;
import us.myles.ViaVersion.api.protocol.ProtocolRegistry;
import us.myles.ViaVersion.api.Via;
import java.lang.reflect.Constructor;
import java.lang.reflect.Field;
@ -27,12 +27,13 @@ public class BoundingBoxFixer {
Field boundingBoxNorthField, boundingBoxSouthField, boundingBoxWestField, boundingBoxEastField;
if (ProtocolRegistry.SERVER_PROTOCOL <= 340) {
int serverProtocol = Via.getAPI().getServerVersion().lowestSupportedVersion();
if (serverProtocol <= 340) {
boundingBoxEastField = ReflectionAPI.getFieldAccessible(blockLadderClass, "b");
boundingBoxWestField = ReflectionAPI.getFieldAccessible(blockLadderClass, "c");
boundingBoxSouthField = ReflectionAPI.getFieldAccessible(blockLadderClass, "d");
boundingBoxNorthField = ReflectionAPI.getFieldAccessible(blockLadderClass, "e");
} else if (ProtocolRegistry.SERVER_PROTOCOL <= 404) {
} else if (serverProtocol <= 404) {
boundingBoxEastField = ReflectionAPI.getFieldAccessible(blockLadderClass, "c");
boundingBoxWestField = ReflectionAPI.getFieldAccessible(blockLadderClass, "o");
boundingBoxSouthField = ReflectionAPI.getFieldAccessible(blockLadderClass, "p");