mirror of
https://github.com/ViaVersion/ViaVersion.git
synced 2024-11-25 11:35:18 +01:00
Create bukkit-legacy module for 1.8 magic method usage
No real changes to the classes other than them being moved
This commit is contained in:
parent
f173cf73d4
commit
fdb6137339
63
bukkit-legacy/pom.xml
Normal file
63
bukkit-legacy/pom.xml
Normal file
@ -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>
|
@ -1,21 +1,17 @@
|
||||
package us.myles.ViaVersion.bukkit.listeners;
|
||||
|
||||
import lombok.AccessLevel;
|
||||
import lombok.Getter;
|
||||
import lombok.NonNull;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.Listener;
|
||||
import org.bukkit.plugin.Plugin;
|
||||
import us.myles.ViaVersion.ViaVersionPlugin;
|
||||
import us.myles.ViaVersion.api.ViaListener;
|
||||
import us.myles.ViaVersion.api.data.UserConnection;
|
||||
import us.myles.ViaVersion.api.protocol.Protocol;
|
||||
|
||||
@Getter(AccessLevel.PROTECTED)
|
||||
public class ViaBukkitListener extends ViaListener implements Listener {
|
||||
private final Plugin plugin;
|
||||
|
||||
public ViaBukkitListener(ViaVersionPlugin plugin, Class<? extends Protocol> requiredPipeline) {
|
||||
public ViaBukkitListener(Plugin plugin, Class<? extends Protocol> requiredPipeline) {
|
||||
super(requiredPipeline);
|
||||
this.plugin = plugin;
|
||||
}
|
||||
@ -50,4 +46,8 @@ public class ViaBukkitListener extends ViaListener implements Listener {
|
||||
plugin.getServer().getPluginManager().registerEvents(this, plugin);
|
||||
setRegistered(true);
|
||||
}
|
||||
|
||||
public Plugin getPlugin() {
|
||||
return plugin;
|
||||
}
|
||||
}
|
@ -14,7 +14,7 @@ import org.bukkit.event.player.PlayerJoinEvent;
|
||||
import org.bukkit.event.player.PlayerRespawnEvent;
|
||||
import org.bukkit.inventory.CraftingInventory;
|
||||
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.Via;
|
||||
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");
|
||||
|
||||
public ArmorListener(ViaVersionPlugin plugin) {
|
||||
public ArmorListener(Plugin plugin) {
|
||||
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) {
|
||||
final Player player = e.getPlayer();
|
||||
// Due to odd bugs it's 3 ticks later
|
||||
Bukkit.getScheduler().scheduleSyncDelayedTask(getPlugin(), new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
sendArmorUpdate(player);
|
||||
}
|
||||
}, 3L);
|
||||
Bukkit.getScheduler().scheduleSyncDelayedTask(getPlugin(), () -> sendArmorUpdate(player), 3L);
|
||||
}
|
||||
}
|
||||
}
|
@ -4,7 +4,7 @@ import org.bukkit.block.Block;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.EventPriority;
|
||||
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.bukkit.listeners.ViaBukkitListener;
|
||||
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 BlockListener(ViaVersionPlugin plugin) {
|
||||
public BlockListener(Plugin plugin) {
|
||||
super(plugin, Protocol1_9To1_8.class);
|
||||
}
|
||||
|
@ -5,7 +5,7 @@ import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.EventPriority;
|
||||
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.Via;
|
||||
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;
|
||||
|
||||
public class DeathListener extends ViaBukkitListener {
|
||||
public DeathListener(ViaVersionPlugin plugin) {
|
||||
|
||||
public DeathListener(Plugin plugin) {
|
||||
super(plugin, Protocol1_9To1_8.class);
|
||||
}
|
||||
|
@ -13,6 +13,7 @@ import java.util.UUID;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
|
||||
public class HandItemCache extends BukkitRunnable {
|
||||
|
||||
private final Map<UUID, Item> handCache = new ConcurrentHashMap<>();
|
||||
|
||||
@Override
|
@ -6,13 +6,13 @@ import org.bukkit.block.BlockFace;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.EventPriority;
|
||||
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.protocols.protocol1_9to1_8.Protocol1_9To1_8;
|
||||
|
||||
public class PaperPatch extends ViaBukkitListener {
|
||||
|
||||
public PaperPatch(ViaVersionPlugin plugin) {
|
||||
public PaperPatch(Plugin plugin) {
|
||||
super(plugin, Protocol1_9To1_8.class);
|
||||
}
|
||||
|
@ -13,7 +13,7 @@
|
||||
|
||||
<properties>
|
||||
<!-- Change Bukkit Version HERE! -->
|
||||
<bukkitVersion>1.12.2-R0.1-SNAPSHOT</bukkitVersion>
|
||||
<bukkitVersion>1.15.2-R0.1-SNAPSHOT</bukkitVersion>
|
||||
</properties>
|
||||
|
||||
<build>
|
||||
@ -60,5 +60,13 @@
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
|
||||
<!-- Legacy Support -->
|
||||
<dependency>
|
||||
<groupId>us.myles</groupId>
|
||||
<artifactId>viaversion-bukkit-legacy</artifactId>
|
||||
<version>${project.parent.version}</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</project>
|
||||
|
@ -36,6 +36,7 @@ public class EntityToggleGlideListener extends ViaBukkitListener {
|
||||
packet.write(Type.VAR_INT, player.getEntityId());
|
||||
|
||||
byte bitmask = 0;
|
||||
// Collect other metadata for the mitmask
|
||||
if (player.getFireTicks() > 0) {
|
||||
bitmask |= 0x01;
|
||||
}
|
||||
@ -46,10 +47,9 @@ public class EntityToggleGlideListener extends ViaBukkitListener {
|
||||
if (player.isSprinting()) {
|
||||
bitmask |= 0x08;
|
||||
}
|
||||
//TODO isswimming
|
||||
/*if (player.isSprinting()) {
|
||||
if (player.isSwimming()) {
|
||||
bitmask |= 0x10;
|
||||
}*/
|
||||
}
|
||||
if (player.hasPotionEffect(PotionEffectType.INVISIBILITY)) {
|
||||
bitmask |= 0x20;
|
||||
}
|
||||
|
13
pom.xml
13
pom.xml
@ -18,6 +18,7 @@
|
||||
<modules>
|
||||
<module>common</module>
|
||||
<module>bukkit</module>
|
||||
<module>bukkit-legacy</module>
|
||||
<module>bungee</module>
|
||||
<module>fabric</module>
|
||||
<module>sponge</module>
|
||||
@ -52,6 +53,18 @@
|
||||
<url>https://oss.sonatype.org/content/repositories/snapshots</url>
|
||||
</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 -->
|
||||
<repository>
|
||||
<id>viaversion-repo</id>
|
||||
|
@ -12,13 +12,6 @@
|
||||
<artifactId>viaversion-sponge-legacy</artifactId>
|
||||
<packaging>jar</packaging>
|
||||
|
||||
<repositories>
|
||||
<repository>
|
||||
<id>sponge</id>
|
||||
<url>https://repo.spongepowered.org/maven</url>
|
||||
</repository>
|
||||
</repositories>
|
||||
|
||||
<build>
|
||||
<resources>
|
||||
<resource>
|
||||
|
@ -11,13 +11,6 @@
|
||||
|
||||
<artifactId>viaversion-sponge</artifactId>
|
||||
|
||||
<repositories>
|
||||
<repository>
|
||||
<id>sponge</id>
|
||||
<url>https://repo.spongepowered.org/maven</url>
|
||||
</repository>
|
||||
</repositories>
|
||||
|
||||
<build>
|
||||
<resources>
|
||||
<resource>
|
||||
|
@ -11,13 +11,6 @@
|
||||
|
||||
<artifactId>viaversion-velocity</artifactId>
|
||||
|
||||
<repositories>
|
||||
<repository>
|
||||
<id>velocity</id>
|
||||
<url>https://repo.velocitypowered.com/snapshots</url>
|
||||
</repository>
|
||||
</repositories>
|
||||
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
|
Loading…
Reference in New Issue
Block a user