diff --git a/bukkit/pom.xml b/bukkit/pom.xml
index ddecc1bc9..2d096d4d0 100644
--- a/bukkit/pom.xml
+++ b/bukkit/pom.xml
@@ -13,7 +13,7 @@
- 1.8.8-R0.1-SNAPSHOT
+ 1.12.2-R0.1-SNAPSHOT
diff --git a/bukkit/src/main/java/us/myles/ViaVersion/bukkit/listeners/protocol1_15to1_14_4/EntityToggleGlideListener.java b/bukkit/src/main/java/us/myles/ViaVersion/bukkit/listeners/protocol1_15to1_14_4/EntityToggleGlideListener.java
new file mode 100644
index 000000000..59122387d
--- /dev/null
+++ b/bukkit/src/main/java/us/myles/ViaVersion/bukkit/listeners/protocol1_15to1_14_4/EntityToggleGlideListener.java
@@ -0,0 +1,68 @@
+package us.myles.ViaVersion.bukkit.listeners.protocol1_15to1_14_4;
+
+import org.bukkit.entity.Player;
+import org.bukkit.event.EventHandler;
+import org.bukkit.event.EventPriority;
+import org.bukkit.event.entity.EntityToggleGlideEvent;
+import org.bukkit.potion.PotionEffectType;
+import us.myles.ViaVersion.ViaVersionPlugin;
+import us.myles.ViaVersion.api.PacketWrapper;
+import us.myles.ViaVersion.api.minecraft.metadata.Metadata;
+import us.myles.ViaVersion.api.minecraft.metadata.types.MetaType1_14;
+import us.myles.ViaVersion.api.type.Type;
+import us.myles.ViaVersion.api.type.types.version.Types1_14;
+import us.myles.ViaVersion.bukkit.listeners.ViaBukkitListener;
+import us.myles.ViaVersion.protocols.protocol1_15to1_14_4.Protocol1_15To1_14_4;
+
+import java.util.Arrays;
+
+public class EntityToggleGlideListener extends ViaBukkitListener {
+
+ public EntityToggleGlideListener(ViaVersionPlugin plugin) {
+ super(plugin, Protocol1_15To1_14_4.class);
+ }
+
+ @EventHandler(priority = EventPriority.MONITOR)
+ public void entityToggleGlide(EntityToggleGlideEvent event) {
+ if (!(event.getEntity() instanceof Player)) return;
+
+ Player player = (Player) event.getEntity();
+ if (!isOnPipe(player)) return;
+
+ // Cancelling can only be done by updating the player's metadata
+ if (event.isGliding() && event.isCancelled()) {
+ PacketWrapper packet = new PacketWrapper(0x44, null, getUserConnection(player));
+ try {
+ packet.write(Type.VAR_INT, player.getEntityId());
+
+ byte bitmask = 0;
+ if (player.getFireTicks() > 0) {
+ bitmask |= 0x01;
+ }
+ if (player.isSneaking()) {
+ bitmask |= 0x02;
+ }
+ // 0x04 is unused
+ if (player.isSprinting()) {
+ bitmask |= 0x08;
+ }
+ //TODO isswimming
+ /*if (player.isSprinting()) {
+ bitmask |= 0x10;
+ }*/
+ if (player.hasPotionEffect(PotionEffectType.INVISIBILITY)) {
+ bitmask |= 0x20;
+ }
+ if (player.isGlowing()) {
+ bitmask |= 0x40;
+ }
+
+ // leave 0x80 as 0 to stop gliding
+ packet.write(Types1_14.METADATA_LIST, Arrays.asList(new Metadata(0, MetaType1_14.Byte, bitmask)));
+ packet.send(Protocol1_15To1_14_4.class);
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ }
+ }
+}
diff --git a/bukkit/src/main/java/us/myles/ViaVersion/bukkit/listeners/protocol1_9to1_8/ArmorListener.java b/bukkit/src/main/java/us/myles/ViaVersion/bukkit/listeners/protocol1_9to1_8/ArmorListener.java
index c40fc9b83..ce6192f2b 100644
--- a/bukkit/src/main/java/us/myles/ViaVersion/bukkit/listeners/protocol1_9to1_8/ArmorListener.java
+++ b/bukkit/src/main/java/us/myles/ViaVersion/bukkit/listeners/protocol1_9to1_8/ArmorListener.java
@@ -36,7 +36,6 @@ public class ArmorListener extends ViaBukkitListener {
// Ensure that the player is on our pipe
if (!isOnPipe(player)) return;
-
int armor = 0;
for (ItemStack stack : player.getInventory().getArmorContents()) {
armor += ArmorType.findById(stack.getTypeId()).getArmorPoints();
@@ -114,11 +113,6 @@ public class ArmorListener extends ViaBukkitListener {
public void sendDelayedArmorUpdate(final Player player) {
if (!isOnPipe(player)) return; // Don't start a task if the player is not on the pipe
- Via.getPlatform().runSync(new Runnable() {
- @Override
- public void run() {
- sendArmorUpdate(player);
- }
- });
+ Via.getPlatform().runSync(() -> sendArmorUpdate(player));
}
}
\ No newline at end of file
diff --git a/bukkit/src/main/java/us/myles/ViaVersion/bukkit/platform/BukkitViaLoader.java b/bukkit/src/main/java/us/myles/ViaVersion/bukkit/platform/BukkitViaLoader.java
index 50d5eba46..d394e3bb8 100644
--- a/bukkit/src/main/java/us/myles/ViaVersion/bukkit/platform/BukkitViaLoader.java
+++ b/bukkit/src/main/java/us/myles/ViaVersion/bukkit/platform/BukkitViaLoader.java
@@ -17,7 +17,12 @@ import us.myles.ViaVersion.api.protocol.ProtocolVersion;
import us.myles.ViaVersion.bukkit.classgenerator.ClassGenerator;
import us.myles.ViaVersion.bukkit.listeners.UpdateListener;
import us.myles.ViaVersion.bukkit.listeners.multiversion.PlayerSneakListener;
-import us.myles.ViaVersion.bukkit.listeners.protocol1_9to1_8.*;
+import us.myles.ViaVersion.bukkit.listeners.protocol1_15to1_14_4.EntityToggleGlideListener;
+import us.myles.ViaVersion.bukkit.listeners.protocol1_9to1_8.ArmorListener;
+import us.myles.ViaVersion.bukkit.listeners.protocol1_9to1_8.BlockListener;
+import us.myles.ViaVersion.bukkit.listeners.protocol1_9to1_8.DeathListener;
+import us.myles.ViaVersion.bukkit.listeners.protocol1_9to1_8.HandItemCache;
+import us.myles.ViaVersion.bukkit.listeners.protocol1_9to1_8.PaperPatch;
import us.myles.ViaVersion.bukkit.providers.BukkitBlockConnectionProvider;
import us.myles.ViaVersion.bukkit.providers.BukkitInventoryQuickMoveProvider;
import us.myles.ViaVersion.bukkit.providers.BukkitViaBulkChunkTranslator;
@@ -99,6 +104,14 @@ public class BukkitViaLoader implements ViaPlatformLoader {
}
}
+ if (ProtocolRegistry.SERVER_PROTOCOL < ProtocolVersion.v1_15.getId()) {
+ try {
+ Class.forName("org.bukkit.event.entity.EntityToggleGlideEvent");
+ storeListener(new EntityToggleGlideListener(plugin)).register();
+ } catch (ClassNotFoundException ignored) {
+ }
+ }
+
if ((Bukkit.getVersion().toLowerCase(Locale.ROOT).contains("paper")
|| Bukkit.getVersion().toLowerCase(Locale.ROOT).contains("taco")
|| Bukkit.getVersion().toLowerCase(Locale.ROOT).contains("torch"))