3
0
Mirror von https://github.com/ViaVersion/ViaVersion.git synchronisiert 2024-12-27 08:30:09 +01:00

Create bukkit-legacy module for 1.8 magic method usage

No real changes to the classes other than them being moved
Dieser Commit ist enthalten in:
KennyTV 2020-04-13 20:19:55 +02:00
Ursprung f173cf73d4
Commit fdb6137339
Es konnte kein GPG-Schlüssel zu dieser Signatur gefunden werden
GPG-Schlüssel-ID: 6BE3B555EBC5982B
14 geänderte Dateien mit 104 neuen und 44 gelöschten Zeilen

63
bukkit-legacy/pom.xml Normale Datei
Datei anzeigen

@ -0,0 +1,63 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
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">
<parent>
<artifactId>viaversion-parent</artifactId>
<groupId>us.myles</groupId>
<version>3.0.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>viaversion-bukkit-legacy</artifactId>
<properties>
<bukkitVersion>1.8.8-R0.1-SNAPSHOT</bukkitVersion>
</properties>
<build>
<resources>
<resource>
<targetPath>.</targetPath>
<filtering>true</filtering>
<directory>src/main/resources/</directory>
<includes>
<include>*</include>
</includes>
</resource>
</resources>
</build>
<dependencies>
<!-- Common Module -->
<dependency>
<groupId>us.myles</groupId>
<artifactId>viaversion-common</artifactId>
<version>${project.parent.version}</version>
<scope>provided</scope>
</dependency>
<!-- Bukkit API, http://www.spigotmc.org/ or http://bukkit.org/ -->
<dependency>
<groupId>org.bukkit</groupId>
<artifactId>bukkit</artifactId>
<version>${bukkitVersion}</version>
<scope>provided</scope>
<optional>true</optional>
<exclusions>
<exclusion>
<artifactId>junit</artifactId>
<groupId>junit</groupId>
</exclusion>
<exclusion>
<artifactId>gson</artifactId>
<groupId>com.google.code.gson</groupId>
</exclusion>
<exclusion>
<artifactId>persistence-api</artifactId>
<groupId>javax.persistence</groupId>
</exclusion>
</exclusions>
</dependency>
</dependencies>
</project>

Datei anzeigen

@ -1,21 +1,17 @@
package us.myles.ViaVersion.bukkit.listeners; package us.myles.ViaVersion.bukkit.listeners;
import lombok.AccessLevel;
import lombok.Getter;
import lombok.NonNull; import lombok.NonNull;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.event.Listener; import org.bukkit.event.Listener;
import org.bukkit.plugin.Plugin; import org.bukkit.plugin.Plugin;
import us.myles.ViaVersion.ViaVersionPlugin;
import us.myles.ViaVersion.api.ViaListener; import us.myles.ViaVersion.api.ViaListener;
import us.myles.ViaVersion.api.data.UserConnection; import us.myles.ViaVersion.api.data.UserConnection;
import us.myles.ViaVersion.api.protocol.Protocol; import us.myles.ViaVersion.api.protocol.Protocol;
@Getter(AccessLevel.PROTECTED)
public class ViaBukkitListener extends ViaListener implements Listener { public class ViaBukkitListener extends ViaListener implements Listener {
private final Plugin plugin; private final Plugin plugin;
public ViaBukkitListener(ViaVersionPlugin plugin, Class<? extends Protocol> requiredPipeline) { public ViaBukkitListener(Plugin plugin, Class<? extends Protocol> requiredPipeline) {
super(requiredPipeline); super(requiredPipeline);
this.plugin = plugin; this.plugin = plugin;
} }
@ -50,4 +46,8 @@ public class ViaBukkitListener extends ViaListener implements Listener {
plugin.getServer().getPluginManager().registerEvents(this, plugin); plugin.getServer().getPluginManager().registerEvents(this, plugin);
setRegistered(true); setRegistered(true);
} }
public Plugin getPlugin() {
return plugin;
}
} }

Datei anzeigen

@ -14,7 +14,7 @@ import org.bukkit.event.player.PlayerJoinEvent;
import org.bukkit.event.player.PlayerRespawnEvent; import org.bukkit.event.player.PlayerRespawnEvent;
import org.bukkit.inventory.CraftingInventory; import org.bukkit.inventory.CraftingInventory;
import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.ItemStack;
import us.myles.ViaVersion.ViaVersionPlugin; import org.bukkit.plugin.Plugin;
import us.myles.ViaVersion.api.PacketWrapper; import us.myles.ViaVersion.api.PacketWrapper;
import us.myles.ViaVersion.api.Via; import us.myles.ViaVersion.api.Via;
import us.myles.ViaVersion.api.type.Type; import us.myles.ViaVersion.api.type.Type;
@ -28,7 +28,7 @@ public class ArmorListener extends ViaBukkitListener {
private static final UUID ARMOR_ATTRIBUTE = UUID.fromString("2AD3F246-FEE1-4E67-B886-69FD380BB150"); private static final UUID ARMOR_ATTRIBUTE = UUID.fromString("2AD3F246-FEE1-4E67-B886-69FD380BB150");
public ArmorListener(ViaVersionPlugin plugin) { public ArmorListener(Plugin plugin) {
super(plugin, Protocol1_9To1_8.class); super(plugin, Protocol1_9To1_8.class);
} }
@ -81,12 +81,7 @@ public class ArmorListener extends ViaBukkitListener {
if (e.getAction() == Action.RIGHT_CLICK_AIR || e.getAction() == Action.RIGHT_CLICK_BLOCK) { if (e.getAction() == Action.RIGHT_CLICK_AIR || e.getAction() == Action.RIGHT_CLICK_BLOCK) {
final Player player = e.getPlayer(); final Player player = e.getPlayer();
// Due to odd bugs it's 3 ticks later // Due to odd bugs it's 3 ticks later
Bukkit.getScheduler().scheduleSyncDelayedTask(getPlugin(), new Runnable() { Bukkit.getScheduler().scheduleSyncDelayedTask(getPlugin(), () -> sendArmorUpdate(player), 3L);
@Override
public void run() {
sendArmorUpdate(player);
}
}, 3L);
} }
} }
} }

Datei anzeigen

@ -4,7 +4,7 @@ import org.bukkit.block.Block;
import org.bukkit.event.EventHandler; import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority; import org.bukkit.event.EventPriority;
import org.bukkit.event.block.BlockPlaceEvent; import org.bukkit.event.block.BlockPlaceEvent;
import us.myles.ViaVersion.ViaVersionPlugin; import org.bukkit.plugin.Plugin;
import us.myles.ViaVersion.api.minecraft.Position; import us.myles.ViaVersion.api.minecraft.Position;
import us.myles.ViaVersion.bukkit.listeners.ViaBukkitListener; import us.myles.ViaVersion.bukkit.listeners.ViaBukkitListener;
import us.myles.ViaVersion.protocols.protocol1_9to1_8.Protocol1_9To1_8; import us.myles.ViaVersion.protocols.protocol1_9to1_8.Protocol1_9To1_8;
@ -12,7 +12,7 @@ import us.myles.ViaVersion.protocols.protocol1_9to1_8.storage.EntityTracker1_9;
public class BlockListener extends ViaBukkitListener { public class BlockListener extends ViaBukkitListener {
public BlockListener(ViaVersionPlugin plugin) { public BlockListener(Plugin plugin) {
super(plugin, Protocol1_9To1_8.class); super(plugin, Protocol1_9To1_8.class);
} }

Datei anzeigen

@ -5,7 +5,7 @@ import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler; import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority; import org.bukkit.event.EventPriority;
import org.bukkit.event.entity.PlayerDeathEvent; import org.bukkit.event.entity.PlayerDeathEvent;
import us.myles.ViaVersion.ViaVersionPlugin; import org.bukkit.plugin.Plugin;
import us.myles.ViaVersion.api.PacketWrapper; import us.myles.ViaVersion.api.PacketWrapper;
import us.myles.ViaVersion.api.Via; import us.myles.ViaVersion.api.Via;
import us.myles.ViaVersion.api.data.UserConnection; import us.myles.ViaVersion.api.data.UserConnection;
@ -14,7 +14,8 @@ import us.myles.ViaVersion.bukkit.listeners.ViaBukkitListener;
import us.myles.ViaVersion.protocols.protocol1_9to1_8.Protocol1_9To1_8; import us.myles.ViaVersion.protocols.protocol1_9to1_8.Protocol1_9To1_8;
public class DeathListener extends ViaBukkitListener { public class DeathListener extends ViaBukkitListener {
public DeathListener(ViaVersionPlugin plugin) {
public DeathListener(Plugin plugin) {
super(plugin, Protocol1_9To1_8.class); super(plugin, Protocol1_9To1_8.class);
} }

Datei anzeigen

@ -13,6 +13,7 @@ import java.util.UUID;
import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.ConcurrentHashMap;
public class HandItemCache extends BukkitRunnable { public class HandItemCache extends BukkitRunnable {
private final Map<UUID, Item> handCache = new ConcurrentHashMap<>(); private final Map<UUID, Item> handCache = new ConcurrentHashMap<>();
@Override @Override

Datei anzeigen

@ -6,13 +6,13 @@ import org.bukkit.block.BlockFace;
import org.bukkit.event.EventHandler; import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority; import org.bukkit.event.EventPriority;
import org.bukkit.event.block.BlockPlaceEvent; import org.bukkit.event.block.BlockPlaceEvent;
import us.myles.ViaVersion.ViaVersionPlugin; import org.bukkit.plugin.Plugin;
import us.myles.ViaVersion.bukkit.listeners.ViaBukkitListener; import us.myles.ViaVersion.bukkit.listeners.ViaBukkitListener;
import us.myles.ViaVersion.protocols.protocol1_9to1_8.Protocol1_9To1_8; import us.myles.ViaVersion.protocols.protocol1_9to1_8.Protocol1_9To1_8;
public class PaperPatch extends ViaBukkitListener { public class PaperPatch extends ViaBukkitListener {
public PaperPatch(ViaVersionPlugin plugin) { public PaperPatch(Plugin plugin) {
super(plugin, Protocol1_9To1_8.class); super(plugin, Protocol1_9To1_8.class);
} }

Datei anzeigen

@ -13,7 +13,7 @@
<properties> <properties>
<!-- Change Bukkit Version HERE! --> <!-- Change Bukkit Version HERE! -->
<bukkitVersion>1.12.2-R0.1-SNAPSHOT</bukkitVersion> <bukkitVersion>1.15.2-R0.1-SNAPSHOT</bukkitVersion>
</properties> </properties>
<build> <build>
@ -60,5 +60,13 @@
</exclusion> </exclusion>
</exclusions> </exclusions>
</dependency> </dependency>
<!-- Legacy Support -->
<dependency>
<groupId>us.myles</groupId>
<artifactId>viaversion-bukkit-legacy</artifactId>
<version>${project.parent.version}</version>
<scope>compile</scope>
</dependency>
</dependencies> </dependencies>
</project> </project>

Datei anzeigen

@ -36,6 +36,7 @@ public class EntityToggleGlideListener extends ViaBukkitListener {
packet.write(Type.VAR_INT, player.getEntityId()); packet.write(Type.VAR_INT, player.getEntityId());
byte bitmask = 0; byte bitmask = 0;
// Collect other metadata for the mitmask
if (player.getFireTicks() > 0) { if (player.getFireTicks() > 0) {
bitmask |= 0x01; bitmask |= 0x01;
} }
@ -46,10 +47,9 @@ public class EntityToggleGlideListener extends ViaBukkitListener {
if (player.isSprinting()) { if (player.isSprinting()) {
bitmask |= 0x08; bitmask |= 0x08;
} }
//TODO isswimming if (player.isSwimming()) {
/*if (player.isSprinting()) {
bitmask |= 0x10; bitmask |= 0x10;
}*/ }
if (player.hasPotionEffect(PotionEffectType.INVISIBILITY)) { if (player.hasPotionEffect(PotionEffectType.INVISIBILITY)) {
bitmask |= 0x20; bitmask |= 0x20;
} }

13
pom.xml
Datei anzeigen

@ -18,6 +18,7 @@
<modules> <modules>
<module>common</module> <module>common</module>
<module>bukkit</module> <module>bukkit</module>
<module>bukkit-legacy</module>
<module>bungee</module> <module>bungee</module>
<module>fabric</module> <module>fabric</module>
<module>sponge</module> <module>sponge</module>
@ -52,6 +53,18 @@
<url>https://oss.sonatype.org/content/repositories/snapshots</url> <url>https://oss.sonatype.org/content/repositories/snapshots</url>
</repository> </repository>
<!-- Velocity repository -->
<repository>
<id>velocity</id>
<url>https://repo.velocitypowered.com/snapshots</url>
</repository>
<!-- Sponge repository -->
<repository>
<id>sponge</id>
<url>https://repo.spongepowered.org/maven</url>
</repository>
<!-- ViaVersion Repository --> <!-- ViaVersion Repository -->
<repository> <repository>
<id>viaversion-repo</id> <id>viaversion-repo</id>

Datei anzeigen

@ -12,13 +12,6 @@
<artifactId>viaversion-sponge-legacy</artifactId> <artifactId>viaversion-sponge-legacy</artifactId>
<packaging>jar</packaging> <packaging>jar</packaging>
<repositories>
<repository>
<id>sponge</id>
<url>https://repo.spongepowered.org/maven</url>
</repository>
</repositories>
<build> <build>
<resources> <resources>
<resource> <resource>

Datei anzeigen

@ -11,13 +11,6 @@
<artifactId>viaversion-sponge</artifactId> <artifactId>viaversion-sponge</artifactId>
<repositories>
<repository>
<id>sponge</id>
<url>https://repo.spongepowered.org/maven</url>
</repository>
</repositories>
<build> <build>
<resources> <resources>
<resource> <resource>

Datei anzeigen

@ -11,13 +11,6 @@
<artifactId>viaversion-velocity</artifactId> <artifactId>viaversion-velocity</artifactId>
<repositories>
<repository>
<id>velocity</id>
<url>https://repo.velocitypowered.com/snapshots</url>
</repository>
</repositories>
<build> <build>
<plugins> <plugins>
<plugin> <plugin>