3
0
Mirror von https://github.com/ViaVersion/ViaVersion.git synchronisiert 2024-12-25 15:50:10 +01:00

Merge branch 'master' into dev

Dieser Commit ist enthalten in:
Myles 2019-03-17 16:10:38 +00:00
Commit 32a2734082
21 geänderte Dateien mit 151 neuen und 139 gelöschten Zeilen

Datei anzeigen

@ -254,4 +254,8 @@ public class BukkitViaConfig extends Config implements ViaVersionConfig {
public boolean truncate1_14Books() { public boolean truncate1_14Books() {
return getBoolean("truncate-1_14-books", false); return getBoolean("truncate-1_14-books", false);
} }
public boolean isLeftHandedHandling() {
return getBoolean("left-handed-handling", true);
}
} }

Datei anzeigen

@ -20,8 +20,8 @@ import java.util.ArrayList;
import java.util.List; import java.util.List;
public class BukkitViaInjector implements ViaInjector { public class BukkitViaInjector implements ViaInjector {
private List<ChannelFuture> injectedFutures = new ArrayList<>(); private List<ChannelFuture> injectedFutures = new ConcurrentList<>();
private List<Pair<Field, Object>> injectedLists = new ArrayList<>(); private List<Pair<Field, Object>> injectedLists = new ConcurrentList<>();
@Override @Override
public void inject() throws Exception { public void inject() throws Exception {

Datei anzeigen

@ -1,51 +0,0 @@
package us.myles.ViaVersion.bungee.listeners;
import net.md_5.bungee.api.event.ServerConnectEvent;
import net.md_5.bungee.api.plugin.Listener;
import net.md_5.bungee.event.EventHandler;
import us.myles.ViaVersion.api.Via;
import us.myles.ViaVersion.api.data.UserConnection;
import us.myles.ViaVersion.protocols.base.ProtocolInfo;
import us.myles.ViaVersion.protocols.protocol1_9to1_8.Protocol1_9TO1_8;
import us.myles.ViaVersion.protocols.protocol1_9to1_8.storage.EntityTracker;
import java.lang.reflect.Method;
/*
This solves the wrong mainhand issue when you join with BungeeCord on a 1.8 server, and switch to a 1.9 or higher.
*/
public class MainHandPatch implements Listener {
private static Method getSettings = null;
private static Method setMainHand = null;
static {
try {
getSettings = Class.forName("net.md_5.bungee.UserConnection").getDeclaredMethod("getSettings");
setMainHand = Class.forName("net.md_5.bungee.protocol.packet.ClientSettings").getDeclaredMethod("setMainHand", int.class);
} catch (Exception ignored) {
}
}
@EventHandler
public void onServerConnect(ServerConnectEvent event) {
// Ignore if it doesn't exist (Like BungeeCord 1.8)
if (setMainHand == null || getSettings == null)
return;
UserConnection user = Via.getManager().getConnection(event.getPlayer().getUniqueId());
if (user == null) return;
try {
if (user.get(ProtocolInfo.class).getPipeline().contains(Protocol1_9TO1_8.class)) {
Object settings = getSettings.invoke(event.getPlayer());
if (settings != null) {
if (user.has(EntityTracker.class)) {
setMainHand.invoke(settings, user.get(EntityTracker.class).getMainHand());
}
}
}
} catch (Exception e) {
e.printStackTrace();
}
}
}

Datei anzeigen

@ -307,4 +307,8 @@ public class BungeeViaConfig extends Config implements ViaVersionConfig {
public boolean truncate1_14Books() { public boolean truncate1_14Books() {
return getBoolean("truncate-1_14-books", false); return getBoolean("truncate-1_14-books", false);
} }
public boolean isLeftHandedHandling() {
return getBoolean("left-handed-handling", true);
}
} }

Datei anzeigen

@ -8,16 +8,13 @@ import us.myles.ViaVersion.api.Via;
import us.myles.ViaVersion.api.platform.ViaPlatformLoader; import us.myles.ViaVersion.api.platform.ViaPlatformLoader;
import us.myles.ViaVersion.bungee.handlers.BungeeServerHandler; import us.myles.ViaVersion.bungee.handlers.BungeeServerHandler;
import us.myles.ViaVersion.bungee.listeners.ElytraPatch; import us.myles.ViaVersion.bungee.listeners.ElytraPatch;
import us.myles.ViaVersion.bungee.listeners.MainHandPatch;
import us.myles.ViaVersion.bungee.listeners.UpdateListener; import us.myles.ViaVersion.bungee.listeners.UpdateListener;
import us.myles.ViaVersion.bungee.providers.BungeeBossBarProvider; import us.myles.ViaVersion.bungee.providers.*;
import us.myles.ViaVersion.bungee.providers.BungeeEntityIdProvider;
import us.myles.ViaVersion.bungee.providers.BungeeMovementTransmitter;
import us.myles.ViaVersion.bungee.providers.BungeeVersionProvider;
import us.myles.ViaVersion.bungee.service.ProtocolDetectorService; import us.myles.ViaVersion.bungee.service.ProtocolDetectorService;
import us.myles.ViaVersion.protocols.base.VersionProvider; import us.myles.ViaVersion.protocols.base.VersionProvider;
import us.myles.ViaVersion.protocols.protocol1_9to1_8.providers.BossBarProvider; import us.myles.ViaVersion.protocols.protocol1_9to1_8.providers.BossBarProvider;
import us.myles.ViaVersion.protocols.protocol1_9to1_8.providers.EntityIdProvider; import us.myles.ViaVersion.protocols.protocol1_9to1_8.providers.EntityIdProvider;
import us.myles.ViaVersion.protocols.protocol1_9to1_8.providers.MainHandProvider;
import us.myles.ViaVersion.protocols.protocol1_9to1_8.providers.MovementTransmitterProvider; import us.myles.ViaVersion.protocols.protocol1_9to1_8.providers.MovementTransmitterProvider;
import java.util.HashSet; import java.util.HashSet;
@ -45,7 +42,6 @@ public class BungeeViaLoader implements ViaPlatformLoader {
registerListener(plugin); registerListener(plugin);
registerListener(new UpdateListener()); registerListener(new UpdateListener());
registerListener(new BungeeServerHandler()); registerListener(new BungeeServerHandler());
registerListener(new MainHandPatch());
registerListener(new ElytraPatch()); registerListener(new ElytraPatch());
// Providers // Providers
@ -53,6 +49,7 @@ public class BungeeViaLoader implements ViaPlatformLoader {
Via.getManager().getProviders().use(VersionProvider.class, new BungeeVersionProvider()); Via.getManager().getProviders().use(VersionProvider.class, new BungeeVersionProvider());
Via.getManager().getProviders().use(EntityIdProvider.class, new BungeeEntityIdProvider()); Via.getManager().getProviders().use(EntityIdProvider.class, new BungeeEntityIdProvider());
Via.getManager().getProviders().use(BossBarProvider.class, new BungeeBossBarProvider()); Via.getManager().getProviders().use(BossBarProvider.class, new BungeeBossBarProvider());
Via.getManager().getProviders().use(MainHandProvider.class, new BungeeMainHandProvider());
if (plugin.getConf().getBungeePingInterval() > 0) { if (plugin.getConf().getBungeePingInterval() > 0) {
tasks.add(plugin.getProxy().getScheduler().schedule( tasks.add(plugin.getProxy().getScheduler().schedule(

Datei anzeigen

@ -0,0 +1,42 @@
package us.myles.ViaVersion.bungee.providers;
import net.md_5.bungee.api.ProxyServer;
import net.md_5.bungee.api.connection.ProxiedPlayer;
import us.myles.ViaVersion.api.data.UserConnection;
import us.myles.ViaVersion.protocols.base.ProtocolInfo;
import us.myles.ViaVersion.protocols.protocol1_9to1_8.providers.MainHandProvider;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
/*
This solves the wrong mainhand issue when you join with BungeeCord on a 1.8 server, and switch to a 1.9 or higher.
*/
public class BungeeMainHandProvider extends MainHandProvider {
private static Method getSettings = null;
private static Method setMainHand = null;
static {
try {
getSettings = Class.forName("net.md_5.bungee.UserConnection").getDeclaredMethod("getSettings");
setMainHand = Class.forName("net.md_5.bungee.protocol.packet.ClientSettings").getDeclaredMethod("setMainHand", int.class);
} catch (Exception ignored) {
}
}
@Override
public void setMainHand(UserConnection user, int hand) {
ProtocolInfo info = user.get(ProtocolInfo.class);
if (info == null || info.getUuid() == null) return;
ProxiedPlayer player = ProxyServer.getInstance().getPlayer(info.getUuid());
if (player == null) return;
try {
Object settings = getSettings.invoke(player);
if (settings != null) {
setMainHand.invoke(settings, hand);
}
} catch (IllegalAccessException | InvocationTargetException e) {
e.printStackTrace();
}
}
}

Datei anzeigen

@ -316,4 +316,11 @@ public interface ViaVersionConfig {
* @return True if enabled * @return True if enabled
*/ */
boolean truncate1_14Books(); boolean truncate1_14Books();
/**
* Handles left handed info by using unused bit 7 on Client Settings packet
*
* @return True if enabled
*/
boolean isLeftHandedHandling();
} }

Datei anzeigen

@ -121,6 +121,7 @@ public class NamedSoundRewriter {
oldToNew.put("entity.snowman.death", "entity.snow_golem.death"); oldToNew.put("entity.snowman.death", "entity.snow_golem.death");
oldToNew.put("entity.snowman.hurt", "entity.snow_golem.hurt"); oldToNew.put("entity.snowman.hurt", "entity.snow_golem.hurt");
oldToNew.put("entity.snowman.shoot", "entity.snow_golem.shoot"); oldToNew.put("entity.snowman.shoot", "entity.snow_golem.shoot");
oldToNew.put("entity.villager.trading", "entity.villager.trade");
oldToNew.put("entity.vindication_illager.ambient", "entity.vindicator.ambient"); oldToNew.put("entity.vindication_illager.ambient", "entity.vindicator.ambient");
oldToNew.put("entity.vindication_illager.death", "entity.vindicator.death"); oldToNew.put("entity.vindication_illager.death", "entity.vindicator.death");
oldToNew.put("entity.vindication_illager.hurt", "entity.vindicator.hurt"); oldToNew.put("entity.vindication_illager.hurt", "entity.vindicator.hurt");

Datei anzeigen

@ -22,6 +22,7 @@ public class BlockEntityProvider implements Provider {
handlers.put("minecraft:banner", new BannerHandler()); handlers.put("minecraft:banner", new BannerHandler());
handlers.put("minecraft:skull", new SkullHandler()); handlers.put("minecraft:skull", new SkullHandler());
handlers.put("minecraft:mob_spawner", new SpawnerHandler()); handlers.put("minecraft:mob_spawner", new SpawnerHandler());
handlers.put("minecraft:command_block", new CommandBlockHandler());
} }
/** /**

Datei anzeigen

@ -0,0 +1,23 @@
package us.myles.ViaVersion.protocols.protocol1_13to1_12_2.providers.blockentities;
import com.github.steveice10.opennbt.tag.builtin.CompoundTag;
import com.github.steveice10.opennbt.tag.builtin.StringTag;
import com.github.steveice10.opennbt.tag.builtin.Tag;
import us.myles.ViaVersion.api.data.UserConnection;
import us.myles.ViaVersion.protocols.protocol1_13to1_12_2.ChatRewriter;
import us.myles.ViaVersion.protocols.protocol1_13to1_12_2.providers.BlockEntityProvider;
public class CommandBlockHandler implements BlockEntityProvider.BlockEntityHandler {
@Override
public int transform(UserConnection user, CompoundTag tag) {
Tag name = tag.get("CustomName");
if (name instanceof StringTag) {
((StringTag) name).setValue(ChatRewriter.legacyTextToJson(((StringTag) name).getValue()));
}
Tag out = tag.get("LastOutput");
if (out instanceof StringTag) {
((StringTag) out).setValue(ChatRewriter.processTranslate(((StringTag) out).getValue()));
}
return -1;
}
}

Datei anzeigen

@ -95,6 +95,7 @@ public class Protocol1_9TO1_8 extends Protocol {
providers.register(CommandBlockProvider.class, new CommandBlockProvider()); providers.register(CommandBlockProvider.class, new CommandBlockProvider());
providers.register(EntityIdProvider.class, new EntityIdProvider()); providers.register(EntityIdProvider.class, new EntityIdProvider());
providers.register(BossBarProvider.class, new BossBarProvider()); providers.register(BossBarProvider.class, new BossBarProvider());
providers.register(MainHandProvider.class, new MainHandProvider());
providers.require(MovementTransmitterProvider.class); providers.require(MovementTransmitterProvider.class);
if (Via.getConfig().isStimulatePlayerTick()) { if (Via.getConfig().isStimulatePlayerTick()) {
Via.getPlatform().runRepeatingSync(new ViaIdleThread(), 1L); Via.getPlatform().runRepeatingSync(new ViaIdleThread(), 1L);

Datei anzeigen

@ -283,7 +283,7 @@ public class EntityPackets {
@Override @Override
public void handle(PacketWrapper wrapper) throws Exception { public void handle(PacketWrapper wrapper) throws Exception {
if (!Via.getConfig().isMinimizeCooldown()) return; if (!Via.getConfig().isMinimizeCooldown()) return;
if (wrapper.get(Type.VAR_INT, 0) != wrapper.user().get(EntityTracker.class).getEntityID()) { if (wrapper.get(Type.VAR_INT, 0) != wrapper.user().get(EntityTracker.class).getProvidedEntityId()) {
return; return;
} }
int propertiesToRead = wrapper.read(Type.INT); int propertiesToRead = wrapper.read(Type.INT);

Datei anzeigen

@ -19,6 +19,7 @@ import us.myles.ViaVersion.protocols.protocol1_9to1_8.Protocol1_9TO1_8;
import us.myles.ViaVersion.protocols.protocol1_9to1_8.chat.ChatRewriter; import us.myles.ViaVersion.protocols.protocol1_9to1_8.chat.ChatRewriter;
import us.myles.ViaVersion.protocols.protocol1_9to1_8.chat.GameMode; import us.myles.ViaVersion.protocols.protocol1_9to1_8.chat.GameMode;
import us.myles.ViaVersion.protocols.protocol1_9to1_8.providers.CommandBlockProvider; import us.myles.ViaVersion.protocols.protocol1_9to1_8.providers.CommandBlockProvider;
import us.myles.ViaVersion.protocols.protocol1_9to1_8.providers.MainHandProvider;
import us.myles.ViaVersion.protocols.protocol1_9to1_8.storage.ClientChunks; import us.myles.ViaVersion.protocols.protocol1_9to1_8.storage.ClientChunks;
import us.myles.ViaVersion.protocols.protocol1_9to1_8.storage.EntityTracker; import us.myles.ViaVersion.protocols.protocol1_9to1_8.storage.EntityTracker;
@ -458,8 +459,15 @@ public class PlayerPackets {
public void handle(PacketWrapper wrapper) throws Exception { public void handle(PacketWrapper wrapper) throws Exception {
int hand = wrapper.read(Type.VAR_INT); int hand = wrapper.read(Type.VAR_INT);
EntityTracker tracker = wrapper.user().get(EntityTracker.class); if (Via.getConfig().isLeftHandedHandling()) {
tracker.setMainHand(hand); // Add 0x80 if left handed
if (hand == 0) wrapper.set(Type.UNSIGNED_BYTE, 0,
(short) (wrapper.get(Type.UNSIGNED_BYTE, 0).intValue() | 0x80)
);
}
wrapper.sendToServer(Protocol1_9TO1_8.class, true, true);
wrapper.cancel();
Via.getManager().getProviders().get(MainHandProvider.class).setMainHand(wrapper.user(), hand);
} }
}); });
} }

Datei anzeigen

@ -0,0 +1,9 @@
package us.myles.ViaVersion.protocols.protocol1_9to1_8.providers;
import us.myles.ViaVersion.api.data.UserConnection;
import us.myles.ViaVersion.api.platform.providers.Provider;
public class MainHandProvider implements Provider {
public void setMainHand(UserConnection user, int hand) {
}
}

Datei anzeigen

@ -52,8 +52,6 @@ public class EntityTracker extends StoredObject {
@Setter @Setter
private GameMode gameMode; private GameMode gameMode;
@Setter @Setter
private int mainHand;
@Setter
private String currentTeam; private String currentTeam;
public EntityTracker(UserConnection user) { public EntityTracker(UserConnection user) {
@ -170,6 +168,13 @@ public class EntityTracker extends StoredObject {
} }
} }
} }
if (metadata.getId() == 12 && Via.getConfig().isLeftHandedHandling()) { // Player model
metadataList.add(new Metadata(
13, // Main hand
MetaType1_9.Byte,
(byte) (((((byte) metadata.getValue()) & 0x80) != 0) ? 0 : 1)
));
}
} }
if (type == Entity1_10Types.EntityType.ARMOR_STAND && Via.getConfig().isHologramPatch()) { if (type == Entity1_10Types.EntityType.ARMOR_STAND && Via.getConfig().isHologramPatch()) {
if (metadata.getId() == 0 && getMetaByIndex(metadataList, 10) != null) { if (metadata.getId() == 0 && getMetaByIndex(metadataList, 10) != null) {

Datei anzeigen

@ -19,43 +19,44 @@ public abstract class ListWrapper implements List {
} }
@Override @Override
public synchronized int size() { public int size() {
return this.list.size(); return this.list.size();
} }
@Override @Override
public synchronized boolean isEmpty() { public boolean isEmpty() {
return this.list.isEmpty(); return this.list.isEmpty();
} }
@Override @Override
public synchronized boolean contains(Object o) { public boolean contains(Object o) {
return this.list.contains(o); return this.list.contains(o);
} }
@Override @Override
public synchronized Iterator iterator() { public Iterator iterator() {
return listIterator(); return listIterator();
} }
@Override @Override
public synchronized Object[] toArray() { public Object[] toArray() {
return this.list.toArray(); return this.list.toArray();
} }
@Override @Override
public synchronized boolean add(Object o) { public boolean add(Object o) {
handleAdd(o); handleAdd(o);
return this.list.add(o); return this.list.add(o);
} }
@Override @Override
public synchronized boolean remove(Object o) { public boolean remove(Object o) {
return this.list.remove(o); return this.list.remove(o);
} }
@Override @Override
public synchronized boolean addAll(Collection c) { public boolean addAll(Collection c) {
for (Object o : c) { for (Object o : c) {
handleAdd(o); handleAdd(o);
} }
@ -63,7 +64,7 @@ public abstract class ListWrapper implements List {
} }
@Override @Override
public synchronized boolean addAll(int index, Collection c) { public boolean addAll(int index, Collection c) {
for (Object o : c) { for (Object o : c) {
handleAdd(o); handleAdd(o);
} }
@ -71,72 +72,72 @@ public abstract class ListWrapper implements List {
} }
@Override @Override
public synchronized void clear() { public void clear() {
this.list.clear(); this.list.clear();
} }
@Override @Override
public synchronized Object get(int index) { public Object get(int index) {
return this.list.get(index); return this.list.get(index);
} }
@Override @Override
public synchronized Object set(int index, Object element) { public Object set(int index, Object element) {
return this.list.set(index, element); return this.list.set(index, element);
} }
@Override @Override
public synchronized void add(int index, Object element) { public void add(int index, Object element) {
this.list.add(index, element); this.list.add(index, element);
} }
@Override @Override
public synchronized Object remove(int index) { public Object remove(int index) {
return this.list.remove(index); return this.list.remove(index);
} }
@Override @Override
public synchronized int indexOf(Object o) { public int indexOf(Object o) {
return this.list.indexOf(o); return this.list.indexOf(o);
} }
@Override @Override
public synchronized int lastIndexOf(Object o) { public int lastIndexOf(Object o) {
return this.list.lastIndexOf(o); return this.list.lastIndexOf(o);
} }
@Override @Override
public synchronized ListIterator listIterator() { public ListIterator listIterator() {
return this.list.listIterator(); return this.list.listIterator();
} }
@Override @Override
public synchronized ListIterator listIterator(int index) { public ListIterator listIterator(int index) {
return this.list.listIterator(index); return this.list.listIterator(index);
} }
@Override @Override
public synchronized List subList(int fromIndex, int toIndex) { public List subList(int fromIndex, int toIndex) {
return this.list.subList(fromIndex, toIndex); return this.list.subList(fromIndex, toIndex);
} }
@Override @Override
public synchronized boolean retainAll(Collection c) { public boolean retainAll(Collection c) {
return this.list.retainAll(c); return this.list.retainAll(c);
} }
@Override @Override
public synchronized boolean removeAll(Collection c) { public boolean removeAll(Collection c) {
return this.list.removeAll(c); return this.list.removeAll(c);
} }
@Override @Override
public synchronized boolean containsAll(Collection c) { public boolean containsAll(Collection c) {
return this.list.containsAll(c); return this.list.containsAll(c);
} }
@Override @Override
public synchronized Object[] toArray(Object[] a) { public Object[] toArray(Object[] a) {
return this.list.toArray(a); return this.list.toArray(a);
} }
} }

Datei anzeigen

@ -167,4 +167,6 @@ replacement-piston-id: 0
# Force the string -> json transform # Force the string -> json transform
force-json-transform: false force-json-transform: false
# Minimize the cooldown animation in 1.8 servers # Minimize the cooldown animation in 1.8 servers
minimize-cooldown: true minimize-cooldown: true
# Left handed handling on 1.8 servers
left-handed-handling: true

Datei anzeigen

@ -260,4 +260,8 @@ public class SpongeViaConfig extends Config implements ViaVersionConfig {
public boolean truncate1_14Books() { public boolean truncate1_14Books() {
return getBoolean("truncate-1_14-books", false); return getBoolean("truncate-1_14-books", false);
} }
public boolean isLeftHandedHandling() {
return getBoolean("left-handed-handling", true);
}
} }

Datei anzeigen

@ -1,49 +0,0 @@
package us.myles.ViaVersion.velocity.listeners;
import com.velocitypowered.api.event.Subscribe;
import com.velocitypowered.api.event.player.ServerConnectedEvent;
import com.velocitypowered.api.proxy.player.PlayerSettings;
import us.myles.ViaVersion.api.Via;
import us.myles.ViaVersion.api.data.UserConnection;
import us.myles.ViaVersion.protocols.base.ProtocolInfo;
import us.myles.ViaVersion.protocols.protocol1_9to1_8.Protocol1_9TO1_8;
import us.myles.ViaVersion.protocols.protocol1_9to1_8.storage.EntityTracker;
import us.myles.ViaVersion.util.ReflectionUtil;
import java.lang.reflect.Method;
/*
This solves the wrong mainhand issue when you join with BungeeCord on a 1.8 server, and switch to a 1.9 or higher.
*/
public class MainHandPatch {
private static Method setSettings;
static {
try {
Class clientSettings = Class.forName("com.velocitypowered.proxy.protocol.packet.ClientSettings");
setSettings = Class.forName("com.velocitypowered.proxy.connection.client.ConnectedPlayer").getDeclaredMethod("setPlayerSettings", clientSettings);
setSettings.setAccessible(true);
} catch (ClassNotFoundException | NoSuchMethodException e) {
e.printStackTrace();
}
}
@Subscribe
public void onServerConnect(ServerConnectedEvent event) {
UserConnection user = Via.getManager().getConnection(event.getPlayer().getUniqueId());
if (user == null || setSettings == null) return;
try {
if (user.get(ProtocolInfo.class).getPipeline().contains(Protocol1_9TO1_8.class)) {
PlayerSettings settings = event.getPlayer().getPlayerSettings();
if (user.has(EntityTracker.class)) {
Object clientSettings = ReflectionUtil.get(settings, "settings", Object.class);
ReflectionUtil.set(clientSettings, "mainHand", user.get(EntityTracker.class).getMainHand());
setSettings.invoke(event.getPlayer(), clientSettings);
}
}
} catch (Exception e) {
e.printStackTrace();
}
}
}

Datei anzeigen

@ -312,4 +312,8 @@ public class VelocityViaConfig extends Config implements ViaVersionConfig {
public boolean truncate1_14Books() { public boolean truncate1_14Books() {
return getBoolean("truncate-1_14-books", false); return getBoolean("truncate-1_14-books", false);
} }
public boolean isLeftHandedHandling() {
return getBoolean("left-handed-handling", true);
}
} }

Datei anzeigen

@ -9,7 +9,6 @@ import us.myles.ViaVersion.protocols.protocol1_9to1_8.providers.BossBarProvider;
import us.myles.ViaVersion.protocols.protocol1_9to1_8.providers.MovementTransmitterProvider; import us.myles.ViaVersion.protocols.protocol1_9to1_8.providers.MovementTransmitterProvider;
import us.myles.ViaVersion.velocity.handlers.VelocityServerHandler; import us.myles.ViaVersion.velocity.handlers.VelocityServerHandler;
import us.myles.ViaVersion.velocity.listeners.ElytraPatch; import us.myles.ViaVersion.velocity.listeners.ElytraPatch;
import us.myles.ViaVersion.velocity.listeners.MainHandPatch;
import us.myles.ViaVersion.velocity.listeners.UpdateListener; import us.myles.ViaVersion.velocity.listeners.UpdateListener;
import us.myles.ViaVersion.velocity.providers.VelocityBossBarProvider; import us.myles.ViaVersion.velocity.providers.VelocityBossBarProvider;
import us.myles.ViaVersion.velocity.providers.VelocityMovementTransmitter; import us.myles.ViaVersion.velocity.providers.VelocityMovementTransmitter;
@ -26,10 +25,10 @@ public class VelocityViaLoader implements ViaPlatformLoader {
Via.getManager().getProviders().use(BossBarProvider.class, new VelocityBossBarProvider()); Via.getManager().getProviders().use(BossBarProvider.class, new VelocityBossBarProvider());
Via.getManager().getProviders().use(VersionProvider.class, new VelocityVersionProvider()); Via.getManager().getProviders().use(VersionProvider.class, new VelocityVersionProvider());
// We probably don't need a EntityIdProvider because velocity sends a Join packet on server change // We probably don't need a EntityIdProvider because velocity sends a Join packet on server change
// We don't need main hand patch because Join Game packet makes client send hand data again
VelocityPlugin.PROXY.getEventManager().register(plugin, new UpdateListener()); VelocityPlugin.PROXY.getEventManager().register(plugin, new UpdateListener());
VelocityPlugin.PROXY.getEventManager().register(plugin, new VelocityServerHandler()); VelocityPlugin.PROXY.getEventManager().register(plugin, new VelocityServerHandler());
VelocityPlugin.PROXY.getEventManager().register(plugin, new MainHandPatch());
VelocityPlugin.PROXY.getEventManager().register(plugin, new ElytraPatch()); VelocityPlugin.PROXY.getEventManager().register(plugin, new ElytraPatch());
int pingInterval = ((VelocityViaConfig) Via.getPlatform().getConf()).getVelocityPingInterval(); int pingInterval = ((VelocityViaConfig) Via.getPlatform().getConf()).getVelocityPingInterval();