3
0
Mirror von https://github.com/ViaVersion/ViaVersion.git synchronisiert 2024-10-03 08:41:05 +02:00

Merge branches 'dev' and 'master' of https://github.com/MylesIsCool/ViaVersion into dev

Dieser Commit ist enthalten in:
Matsv 2017-05-27 16:39:43 +02:00
Commit 0817d28b88
13 geänderte Dateien mit 102 neuen und 89 gelöschten Zeilen

Datei anzeigen

@ -1,6 +1,7 @@
# ViaVersion 1.0.5 - Spigot, Sponge, BungeeCord # ViaVersion 1.0.5 - Spigot, Sponge, BungeeCord
[![Build Status](https://travis-ci.org/MylesIsCool/ViaVersion.svg?branch=master)](https://travis-ci.org/MylesIsCool/ViaVersion) [![Build Status](https://travis-ci.org/MylesIsCool/ViaVersion.svg?branch=master)](https://travis-ci.org/MylesIsCool/ViaVersion)
[![Gitter](https://badges.gitter.im/MylesIsCool/ViaVersion.svg)](https://gitter.im/MylesIsCool/ViaVersion) [![Gitter](https://badges.gitter.im/MylesIsCool/ViaVersion.svg)](https://gitter.im/MylesIsCool/ViaVersion)
[![Discord](https://img.shields.io/badge/chat-on%20discord-blue.svg)](https://viaversion.com/discord)
IRC: [#viaversion](http://irc.spi.gt/iris/?channels=viaversion) on irc.spi.gt for Support. IRC: [#viaversion](http://irc.spi.gt/iris/?channels=viaversion) on irc.spi.gt for Support.

Datei anzeigen

@ -5,7 +5,7 @@
<parent> <parent>
<artifactId>viaversion-parent</artifactId> <artifactId>viaversion-parent</artifactId>
<groupId>us.myles</groupId> <groupId>us.myles</groupId>
<version>1.0.5-1_12pre4</version> <version>1.0.5-1_12pre5</version>
</parent> </parent>
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>

Datei anzeigen

@ -37,8 +37,7 @@ public class BukkitViaInjector implements ViaInjector {
// Inject the list // Inject the list
List wrapper = new ListWrapper((List) value) { List wrapper = new ListWrapper((List) value) {
@Override @Override
public synchronized void handleAdd(Object o) { public void handleAdd(Object o) {
synchronized (this) {
if (o instanceof ChannelFuture) { if (o instanceof ChannelFuture) {
try { try {
injectChannelFuture((ChannelFuture) o); injectChannelFuture((ChannelFuture) o);
@ -47,7 +46,6 @@ public class BukkitViaInjector implements ViaInjector {
} }
} }
} }
}
}; };
injectedLists.add(new Pair<>(field, connection)); injectedLists.add(new Pair<>(field, connection));
field.set(connection, wrapper); field.set(connection, wrapper);

Datei anzeigen

@ -5,7 +5,7 @@
<parent> <parent>
<artifactId>viaversion-parent</artifactId> <artifactId>viaversion-parent</artifactId>
<groupId>us.myles</groupId> <groupId>us.myles</groupId>
<version>1.0.5-1_12pre4</version> <version>1.0.5-1_12pre5</version>
</parent> </parent>
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
@ -37,7 +37,7 @@
<dependency> <dependency>
<groupId>us.myles</groupId> <groupId>us.myles</groupId>
<artifactId>viaversion-common</artifactId> <artifactId>viaversion-common</artifactId>
<version>1.0.5-1_12pre4</version> <version>1.0.5-1_12pre5</version>
</dependency> </dependency>
</dependencies> </dependencies>
</project> </project>

Datei anzeigen

@ -8,6 +8,7 @@ import net.md_5.bungee.event.EventHandler;
import net.md_5.bungee.event.EventPriority; import net.md_5.bungee.event.EventPriority;
import us.myles.ViaVersion.api.Pair; import us.myles.ViaVersion.api.Pair;
import us.myles.ViaVersion.api.Via; import us.myles.ViaVersion.api.Via;
import us.myles.ViaVersion.api.boss.BossBar;
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;
import us.myles.ViaVersion.api.protocol.ProtocolPipeline; import us.myles.ViaVersion.api.protocol.ProtocolPipeline;
@ -15,6 +16,7 @@ import us.myles.ViaVersion.api.protocol.ProtocolRegistry;
import us.myles.ViaVersion.bungee.service.ProtocolDetectorService; import us.myles.ViaVersion.bungee.service.ProtocolDetectorService;
import us.myles.ViaVersion.bungee.storage.BungeeStorage; import us.myles.ViaVersion.bungee.storage.BungeeStorage;
import us.myles.ViaVersion.protocols.base.ProtocolInfo; import us.myles.ViaVersion.protocols.base.ProtocolInfo;
import us.myles.ViaVersion.protocols.protocol1_9to1_8.storage.EntityTracker;
import java.lang.reflect.Field; import java.lang.reflect.Field;
import java.lang.reflect.InvocationTargetException; import java.lang.reflect.InvocationTargetException;
@ -79,6 +81,15 @@ public class BungeeServerHandler implements Listener {
public void checkServerChange(ServerConnectedEvent e, UserConnection user) throws Exception { public void checkServerChange(ServerConnectedEvent e, UserConnection user) throws Exception {
if (user == null) return; if (user == null) return;
// Manually hide ViaVersion-created BossBars if the childserver was version 1.8.x (#666)
if (user.has(EntityTracker.class)) {
EntityTracker tracker = user.get(EntityTracker.class);
if (tracker.getBossBarMap() != null)
for (BossBar bar : tracker.getBossBarMap().values())
bar.hide();
}
// Handle server/version change
if (user.has(BungeeStorage.class)) { if (user.has(BungeeStorage.class)) {
BungeeStorage storage = user.get(BungeeStorage.class); BungeeStorage storage = user.get(BungeeStorage.class);
ProxiedPlayer player = storage.getPlayer(); ProxiedPlayer player = storage.getPlayer();

Datei anzeigen

@ -5,7 +5,7 @@
<parent> <parent>
<artifactId>viaversion-parent</artifactId> <artifactId>viaversion-parent</artifactId>
<groupId>us.myles</groupId> <groupId>us.myles</groupId>
<version>1.0.5-1_12pre4</version> <version>1.0.5-1_12pre5</version>
</parent> </parent>
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>

Datei anzeigen

@ -55,7 +55,7 @@ public class ProtocolVersion {
register(v1_10 = new ProtocolVersion(210, "1.10")); register(v1_10 = new ProtocolVersion(210, "1.10"));
register(v1_11 = new ProtocolVersion(315, "1.11")); register(v1_11 = new ProtocolVersion(315, "1.11"));
register(v1_11_1 = new ProtocolVersion(316, "1.11.1")); register(v1_11_1 = new ProtocolVersion(316, "1.11.1"));
register(snapshot = new ProtocolVersion(331, "1.12-pre4")); register(snapshot = new ProtocolVersion(332, "1.12-pre5"));
register(unknown = new ProtocolVersion(-1, "UNKNOWN")); register(unknown = new ProtocolVersion(-1, "UNKNOWN"));
} }

Datei anzeigen

@ -19,37 +19,11 @@ public class ProtocolSnapshotTo1_11_1 extends Protocol {
@Override @Override
protected void registerPackets() { protected void registerPackets() {
// As of 1.12-pre4 // As of 1.12-pre5
// Outgoing // Outgoing
// New packet at 0x08
registerOutgoing(State.PLAY, 0x08, 0x09);
registerOutgoing(State.PLAY, 0x09, 0x0a);
registerOutgoing(State.PLAY, 0x0a, 0x0b);
registerOutgoing(State.PLAY, 0x0b, 0x0c);
// error here, 0x0c
registerOutgoing(State.PLAY, 0x0c, 0x0d);
registerOutgoing(State.PLAY, 0x0d, 0x0e);
registerOutgoing(State.PLAY, 0x0e, 0x0f);
registerOutgoing(State.PLAY, 0x0f, 0x10);
registerOutgoing(State.PLAY, 0x10, 0x11);
registerOutgoing(State.PLAY, 0x11, 0x12);
registerOutgoing(State.PLAY, 0x12, 0x13);
registerOutgoing(State.PLAY, 0x13, 0x14);
registerOutgoing(State.PLAY, 0x14, 0x15);
registerOutgoing(State.PLAY, 0x15, 0x16);
registerOutgoing(State.PLAY, 0x16, 0x17);
registerOutgoing(State.PLAY, 0x17, 0x18);
registerOutgoing(State.PLAY, 0x18, 0x19);
registerOutgoing(State.PLAY, 0x19, 0x1a);
registerOutgoing(State.PLAY, 0x1a, 0x1b);
registerOutgoing(State.PLAY, 0x1b, 0x1c);
registerOutgoing(State.PLAY, 0x1c, 0x1d);
registerOutgoing(State.PLAY, 0x1d, 0x1e);
registerOutgoing(State.PLAY, 0x1e, 0x1f);
registerOutgoing(State.PLAY, 0x1f, 0x20);
// Chunk Data // Chunk Data
registerOutgoing(State.PLAY, 0x20, 0x21, new PacketRemapper() { registerOutgoing(State.PLAY, 0x20, 0x20, new PacketRemapper() {
@Override @Override
public void registerMap() { public void registerMap() {
handler(new PacketHandler() { handler(new PacketHandler() {
@ -91,27 +65,55 @@ public class ProtocolSnapshotTo1_11_1 extends Protocol {
}); });
} }
}); });
registerOutgoing(State.PLAY, 0x21, 0x22); // Join Packet
registerOutgoing(State.PLAY, 0x22, 0x23); registerOutgoing(State.PLAY, 0x23, 0x23, new PacketRemapper() {
registerOutgoing(State.PLAY, 0x23, 0x24); @Override
registerOutgoing(State.PLAY, 0x24, 0x25); public void registerMap() {
map(Type.INT); // 0 - Entity ID
map(Type.UNSIGNED_BYTE); // 1 - Gamemode
map(Type.INT); // 2 - Dimension
handler(new PacketHandler() {
@Override
public void handle(PacketWrapper wrapper) throws Exception {
ClientWorld clientChunks = wrapper.user().get(ClientWorld.class);
int dimensionId = wrapper.get(Type.INT, 1);
clientChunks.setEnvironment(dimensionId);
}
});
}
});
// 0x28 moved to 0x25
registerOutgoing(State.PLAY, 0x28, 0x25);
registerOutgoing(State.PLAY, 0x25, 0x26); registerOutgoing(State.PLAY, 0x25, 0x26);
registerOutgoing(State.PLAY, 0x26, 0x27); registerOutgoing(State.PLAY, 0x26, 0x27);
registerOutgoing(State.PLAY, 0x27, 0x28); registerOutgoing(State.PLAY, 0x27, 0x28);
registerOutgoing(State.PLAY, 0x28, 0x29); // New packet at 0x30
registerOutgoing(State.PLAY, 0x29, 0x2a); registerOutgoing(State.PLAY, 0x30, 0x31);
registerOutgoing(State.PLAY, 0x2a, 0x2b); registerOutgoing(State.PLAY, 0x31, 0x32);
registerOutgoing(State.PLAY, 0x2b, 0x2c); registerOutgoing(State.PLAY, 0x32, 0x33);
registerOutgoing(State.PLAY, 0x2c, 0x2d); // Respawn Packet
registerOutgoing(State.PLAY, 0x2d, 0x2e); registerOutgoing(State.PLAY, 0x33, 0x34, new PacketRemapper() {
registerOutgoing(State.PLAY, 0x2e, 0x2f); @Override
registerOutgoing(State.PLAY, 0x2f, 0x30); public void registerMap() {
registerOutgoing(State.PLAY, 0x30, 0x32); map(Type.INT); // 0 - Dimension ID
// New packet at 0x31
registerOutgoing(State.PLAY, 0x31, 0x33); handler(new PacketHandler() {
registerOutgoing(State.PLAY, 0x32, 0x34); @Override
registerOutgoing(State.PLAY, 0x33, 0x35); public void handle(PacketWrapper wrapper) throws Exception {
registerOutgoing(State.PLAY, 0x34, 0x36); ClientWorld clientWorld = wrapper.user().get(ClientWorld.class);
int dimensionId = wrapper.get(Type.INT, 0);
clientWorld.setEnvironment(dimensionId);
}
});
}
});
registerOutgoing(State.PLAY, 0x34, 0x35);
// New packet at 0x36
registerOutgoing(State.PLAY, 0x35, 0x37); registerOutgoing(State.PLAY, 0x35, 0x37);
registerOutgoing(State.PLAY, 0x36, 0x38); registerOutgoing(State.PLAY, 0x36, 0x38);
registerOutgoing(State.PLAY, 0x37, 0x39); registerOutgoing(State.PLAY, 0x37, 0x39);
@ -130,7 +132,7 @@ public class ProtocolSnapshotTo1_11_1 extends Protocol {
registerOutgoing(State.PLAY, 0x44, 0x46); registerOutgoing(State.PLAY, 0x44, 0x46);
registerOutgoing(State.PLAY, 0x45, 0x47); registerOutgoing(State.PLAY, 0x45, 0x47);
// Sound effect, TODO: This changed in 17w15a // Sound effect, should work fine, might need checking for parrots?
registerOutgoing(State.PLAY, 0x46, 0x48, new PacketRemapper() { registerOutgoing(State.PLAY, 0x46, 0x48, new PacketRemapper() {
@Override @Override
public void registerMap() { public void registerMap() {
@ -159,9 +161,9 @@ public class ProtocolSnapshotTo1_11_1 extends Protocol {
registerOutgoing(State.PLAY, 0x47, 0x49); registerOutgoing(State.PLAY, 0x47, 0x49);
registerOutgoing(State.PLAY, 0x48, 0x4a); registerOutgoing(State.PLAY, 0x48, 0x4a);
registerOutgoing(State.PLAY, 0x49, 0x4b); registerOutgoing(State.PLAY, 0x49, 0x4b);
registerOutgoing(State.PLAY, 0x4a, 0x4c); // New packet at 0x4c
registerOutgoing(State.PLAY, 0x4b, 0x4d); registerOutgoing(State.PLAY, 0x4a, 0x4d);
// New packet at 0x4e registerOutgoing(State.PLAY, 0x4b, 0x4e);
// Incoming // Incoming
// New packet at 0x01 // New packet at 0x01
@ -188,10 +190,12 @@ public class ProtocolSnapshotTo1_11_1 extends Protocol {
registerIncoming(State.PLAY, 0x09, 0x0a); registerIncoming(State.PLAY, 0x09, 0x0a);
registerIncoming(State.PLAY, 0x0a, 0x0b); registerIncoming(State.PLAY, 0x0a, 0x0b);
registerIncoming(State.PLAY, 0x0b, 0x0c); registerIncoming(State.PLAY, 0x0b, 0x0c);
registerIncoming(State.PLAY, 0x0c, 0x0d); // Mojang swapped 0x0F to 0x0D
registerIncoming(State.PLAY, 0x0d, 0x0e); registerIncoming(State.PLAY, 0x0f, 0x0d);
registerIncoming(State.PLAY, 0x0e, 0x0f); registerIncoming(State.PLAY, 0x0c, 0x0e);
registerIncoming(State.PLAY, 0x0f, 0x10); // Mojang swapped 0x0F to 0x0D
registerIncoming(State.PLAY, 0x0d, 0x0f);
registerIncoming(State.PLAY, 0x0e, 0x10);
registerIncoming(State.PLAY, 0x10, 0x11); registerIncoming(State.PLAY, 0x10, 0x11);
registerIncoming(State.PLAY, 0x11, 0x12); registerIncoming(State.PLAY, 0x11, 0x12);
registerIncoming(State.PLAY, 0x12, 0x13); registerIncoming(State.PLAY, 0x12, 0x13);
@ -212,15 +216,8 @@ public class ProtocolSnapshotTo1_11_1 extends Protocol {
} }
}); });
registerIncoming(State.PLAY, 0x16, 0x18); registerIncoming(State.PLAY, 0x16, 0x18);
registerIncoming(State.PLAY, 0x17, 0x19); // New packet 0x19
registerIncoming(State.PLAY, 0x18, 0x1a); registerIncoming(State.PLAY, 0x19, 0x19, new PacketRemapper() {
registerIncoming(State.PLAY, 0x19, 0x1b);
registerIncoming(State.PLAY, 0x1a, 0x1c);
registerIncoming(State.PLAY, 0x1b, 0x1d);
registerIncoming(State.PLAY, 0x1c, 0x1e);
registerIncoming(State.PLAY, 0x1d, 0x1f);
// New packet at 0x20
registerIncoming(State.PLAY, 0x20, 0x20, new PacketRemapper() {
@Override @Override
public void registerMap() { public void registerMap() {
handler(new PacketHandler() { handler(new PacketHandler() {
@ -232,6 +229,13 @@ public class ProtocolSnapshotTo1_11_1 extends Protocol {
}); });
} }
}); });
registerIncoming(State.PLAY, 0x17, 0x1a);
registerIncoming(State.PLAY, 0x18, 0x1b);
registerIncoming(State.PLAY, 0x19, 0x1c);
registerIncoming(State.PLAY, 0x1a, 0x1d);
registerIncoming(State.PLAY, 0x1b, 0x1e);
registerIncoming(State.PLAY, 0x1c, 0x1f);
registerIncoming(State.PLAY, 0x1d, 0x20);
} }
private int getNewSoundId(int id) { //TODO Make it better, suggestions are welcome. It's ugly and hardcoded now. private int getNewSoundId(int id) { //TODO Make it better, suggestions are welcome. It's ugly and hardcoded now.
@ -257,6 +261,7 @@ public class ProtocolSnapshotTo1_11_1 extends Protocol {
@Override @Override
public void init(UserConnection userConnection) { public void init(UserConnection userConnection) {
if (!userConnection.has(ClientWorld.class))
userConnection.put(new ClientWorld(userConnection));
} }
} }

Datei anzeigen

@ -5,7 +5,7 @@
<parent> <parent>
<artifactId>viaversion-parent</artifactId> <artifactId>viaversion-parent</artifactId>
<groupId>us.myles</groupId> <groupId>us.myles</groupId>
<version>1.0.5-1_12pre4</version> <version>1.0.5-1_12pre5</version>
</parent> </parent>
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
<name>viaversion-jar</name> <name>viaversion-jar</name>

Datei anzeigen

@ -6,7 +6,7 @@
<groupId>us.myles</groupId> <groupId>us.myles</groupId>
<artifactId>viaversion-parent</artifactId> <artifactId>viaversion-parent</artifactId>
<version>1.0.5-1_12pre4</version> <version>1.0.5-1_12pre5</version>
<packaging>pom</packaging> <packaging>pom</packaging>
<name>viaversion-parent</name> <name>viaversion-parent</name>

Datei anzeigen

@ -5,7 +5,7 @@
<parent> <parent>
<artifactId>viaversion-parent</artifactId> <artifactId>viaversion-parent</artifactId>
<groupId>us.myles</groupId> <groupId>us.myles</groupId>
<version>1.0.5-1_12pre4</version> <version>1.0.5-1_12pre5</version>
</parent> </parent>
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>

Datei anzeigen

@ -5,7 +5,7 @@
<parent> <parent>
<artifactId>viaversion-parent</artifactId> <artifactId>viaversion-parent</artifactId>
<groupId>us.myles</groupId> <groupId>us.myles</groupId>
<version>1.0.5-1_12pre4</version> <version>1.0.5-1_12pre5</version>
</parent> </parent>
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>

Datei anzeigen

@ -36,8 +36,7 @@ public class SpongeViaInjector implements ViaInjector {
// Inject the list // Inject the list
List wrapper = new ListWrapper((List) value) { List wrapper = new ListWrapper((List) value) {
@Override @Override
public synchronized void handleAdd(Object o) { public void handleAdd(Object o) {
synchronized (this) {
if (o instanceof ChannelFuture) { if (o instanceof ChannelFuture) {
try { try {
injectChannelFuture((ChannelFuture) o); injectChannelFuture((ChannelFuture) o);
@ -46,7 +45,6 @@ public class SpongeViaInjector implements ViaInjector {
} }
} }
} }
}
}; };
injectedLists.add(new Pair<>(field, connection)); injectedLists.add(new Pair<>(field, connection));
field.set(connection, wrapper); field.set(connection, wrapper);