Skip to content

Commit

Permalink
Bump version to 2.2.4 and fix packet issues on 1.19.3
Browse files Browse the repository at this point in the history
  • Loading branch information
Exceptionflug committed Dec 20, 2022
1 parent 2e553cf commit 272013a
Show file tree
Hide file tree
Showing 8 changed files with 28 additions and 24 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ We provide some documentation on how to migrate your existing plugin to use the
<dependency>
<groupId>dev.simplix</groupId>
<artifactId>protocolize-api</artifactId>
<version>2.2.3</version>
<version>2.2.4</version>
<scope>provided</scope>
</dependency>
```
Expand Down
4 changes: 2 additions & 2 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

<groupId>dev.simplix</groupId>
<artifactId>protocolize</artifactId>
<version>2.2.3</version>
<version>2.2.4</version>
<packaging>pom</packaging>

<modules>
Expand All @@ -23,7 +23,7 @@
<bungeecord.version>1.17-R0.1-SNAPSHOT</bungeecord.version>
<velocity.version>3.0.0</velocity.version>
<bytebuddy.version>1.11.13</bytebuddy.version>
<data.version>2.2.3</data.version>
<data.version>2.2.4</data.version>
</properties>

<repositories>
Expand Down
4 changes: 2 additions & 2 deletions protocolize-api/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@
<parent>
<groupId>dev.simplix</groupId>
<artifactId>protocolize</artifactId>
<version>2.2.3</version>
<version>2.2.4</version>
</parent>

<artifactId>protocolize-api</artifactId>
<version>2.2.3</version>
<version>2.2.4</version>

<dependencies>
<dependency>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,9 @@
import dev.simplix.protocolize.api.inventory.Inventory;
import dev.simplix.protocolize.api.inventory.PlayerInventory;
import dev.simplix.protocolize.api.item.BaseItemStack;
import dev.simplix.protocolize.api.util.ProtocolVersions;
import dev.simplix.protocolize.data.Sound;
import dev.simplix.protocolize.data.packets.CloseWindow;
import dev.simplix.protocolize.data.packets.NamedSoundEffect;
import dev.simplix.protocolize.data.packets.OpenWindow;
import dev.simplix.protocolize.data.packets.WindowItems;
import dev.simplix.protocolize.data.packets.*;

import java.util.ArrayList;
import java.util.List;
Expand Down Expand Up @@ -53,7 +51,11 @@ default void playSound(Sound sound, SoundCategory category, float volume, float
}

default void playSound(Location location, Sound sound, SoundCategory category, float volume, float pitch) {
sendPacket(new NamedSoundEffect(sound, category, location.x(), location.y(), location.z(), volume, pitch));
if (protocolVersion() >= ProtocolVersions.MINECRAFT_1_19_3) {
sendPacket(new SoundEffect(sound, category, location.x(), location.y(), location.z(), volume, pitch));
} else {
sendPacket(new NamedSoundEffect(sound, category, location.x(), location.y(), location.z(), volume, pitch));
}
}

default void registerInventory(int windowId, Inventory inventory) {
Expand Down
6 changes: 3 additions & 3 deletions protocolize-bungeecord/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@
<parent>
<groupId>dev.simplix</groupId>
<artifactId>protocolize</artifactId>
<version>2.2.3</version>
<version>2.2.4</version>
</parent>

<artifactId>protocolize-bungeecord</artifactId>
<version>2.2.3</version>
<version>2.2.4</version>

<dependencies>
<dependency>
Expand All @@ -32,7 +32,7 @@
<dependency>
<groupId>dev.simplix</groupId>
<artifactId>protocolize-api</artifactId>
<version>2.2.3</version>
<version>2.2.4</version>
<scope>compile</scope>
</dependency>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
import dev.simplix.protocolize.bungee.strategy.PacketRegistrationStrategy;
import gnu.trove.map.TIntObjectMap;
import lombok.SneakyThrows;
import lombok.extern.slf4j.Slf4j;
import net.bytebuddy.ByteBuddy;
import net.bytebuddy.implementation.MethodDelegation;
import net.bytebuddy.implementation.bind.annotation.RuntimeType;
Expand All @@ -34,6 +35,7 @@
*
* @author Exceptionflug
*/
@Slf4j
public final class BungeeCordProtocolRegistrationProvider implements ProtocolRegistrationProvider {

private final MappingProvider mappingProvider = Protocolize.mappingProvider();
Expand Down Expand Up @@ -61,17 +63,15 @@ public final class BungeeCordProtocolRegistrationProvider implements ProtocolReg
toClientField = net.md_5.bungee.protocol.Protocol.class.getDeclaredField("TO_CLIENT");
toClientField.setAccessible(true);
} catch (final Exception e) {
ProxyServer.getInstance().getLogger().log(Level.SEVERE,
"Exception occurred while initializing BungeeCordProtocolRegistrationProvider: ", e);
log.error("Exception occurred while initializing BungeeCordProtocolRegistrationProvider: ", e);
}
}

public BungeeCordProtocolRegistrationProvider(List<PacketRegistrationStrategy> strategies) {
for (PacketRegistrationStrategy strategy : strategies) {
if (strategy.compatible()) {
this.strategy = strategy;
ProxyServer.getInstance().getLogger()
.info("[Protocolize] Using " + strategy.getClass().getSimpleName());
log.info("[Protocolize] Using " + strategy.getClass().getSimpleName());
return;
}
}
Expand All @@ -96,11 +96,11 @@ public void registerPacket(List<ProtocolIdMapping> mappings, Protocol protocol,
mappingProvider.registerMapping(new RegisteredPacket(direction, packetClass), mapping);
for (int i = mapping.protocolRangeStart(); i <= mapping.protocolRangeEnd(); i++) {
strategy.registerPacket(protocols, i, mapping.id(), definedPacketClass);
log.debug("[Protocolize] Register packet " + definedPacketClass.getName() + " (0x" + Integer.toHexString(mapping.id()) + ") in direction " + direction.name() + " at protocol " + protocol.name() + " for version " + i);
}
}
} catch (Exception e) {
ProxyServer.getInstance().getLogger().log(Level.WARNING,
"Exception while registering packet " + packetClass.getName(), e);
log.warn("Exception while registering packet " + packetClass.getName(), e);
}
}

Expand Down Expand Up @@ -186,7 +186,7 @@ private Object getDirectionData(net.md_5.bungee.protocol.Protocol protocol, Pack
else
return toClientField.get(protocol);
} catch (final IllegalAccessException e) {
ProxyServer.getInstance().getLogger().log(Level.SEVERE, "Unable to get DirectionData", e);
log.error("Unable to get DirectionData", e);
}
return null;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import dev.simplix.protocolize.bungee.strategy.PacketRegistrationStrategy;
import gnu.trove.map.TIntObjectMap;
import gnu.trove.map.TObjectIntMap;
import lombok.extern.slf4j.Slf4j;
import net.md_5.bungee.api.ProxyServer;

import java.lang.reflect.Field;
Expand All @@ -14,6 +15,7 @@
*
* @author Exceptionflug
*/
@Slf4j
public final class BungeeCordPacketRegistrationStrategy implements PacketRegistrationStrategy {

private final Class<?> protocolDataClass = ReflectionUtil.getClassOrNull("net.md_5.bungee.protocol.Protocol$ProtocolData");
Expand All @@ -24,7 +26,7 @@ public final class BungeeCordPacketRegistrationStrategy implements PacketRegistr
public void registerPacket(TIntObjectMap<Object> protocols, int protocolVersion, int packetId, Class<?> clazz) throws IllegalAccessException {
final Object protocolData = protocols.get(protocolVersion);
if (protocolData == null) {
ProxyServer.getInstance().getLogger().finest("[Protocolize | DEBUG] Protocol version " + protocolVersion + " is not supported on this version. Skipping registration for that specific version.");
log.debug("[Protocolize | DEBUG] Protocol version " + protocolVersion + " is not supported on this version. Skipping registration for that specific version.");
return;
}
((TObjectIntMap<Class<?>>) protocolDataPacketMapField.get(protocolData)).put(clazz, packetId);
Expand Down
6 changes: 3 additions & 3 deletions protocolize-velocity/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<parent>
<groupId>dev.simplix</groupId>
<artifactId>protocolize</artifactId>
<version>2.2.3</version>
<version>2.2.4</version>
</parent>

<properties>
Expand All @@ -17,7 +17,7 @@

<groupId>dev.simplix</groupId>
<artifactId>protocolize-velocity</artifactId>
<version>2.2.3</version>
<version>2.2.4</version>

<dependencies>
<dependency>
Expand Down Expand Up @@ -48,7 +48,7 @@
<dependency>
<groupId>dev.simplix</groupId>
<artifactId>protocolize-api</artifactId>
<version>2.2.3</version>
<version>2.2.4</version>
<scope>compile</scope>
</dependency>

Expand Down

0 comments on commit 272013a

Please sign in to comment.