From c8ee79f26ed79257303e1f951442b50bc71ccd78 Mon Sep 17 00:00:00 2001 From: Cool_Mineman <62723322+CoolMineman@users.noreply.github.com> Date: Tue, 12 May 2020 16:39:32 -0500 Subject: [PATCH] Periods and Namespace (#6) I'm squashing one commit deal with it --- .../api/networking/PluginChannel.java | 13 +++++++------ .../impl/networking/PluginChannelRegistryImpl.java | 2 +- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/src/main/java/io/github/minecraftcursedlegacy/api/networking/PluginChannel.java b/src/main/java/io/github/minecraftcursedlegacy/api/networking/PluginChannel.java index 0e514883..a34109c0 100644 --- a/src/main/java/io/github/minecraftcursedlegacy/api/networking/PluginChannel.java +++ b/src/main/java/io/github/minecraftcursedlegacy/api/networking/PluginChannel.java @@ -1,5 +1,6 @@ package io.github.minecraftcursedlegacy.api.networking; +import io.github.minecraftcursedlegacy.api.registry.Id; import io.github.minecraftcursedlegacy.impl.networking.PluginMessagePacket; import net.minecraft.client.Minecraft; import net.minecraft.entity.player.ServerPlayer; @@ -11,31 +12,31 @@ public abstract class PluginChannel { * This should always have the same return value. * @return Channel Identifier */ - public abstract String getChannelIdentifier(); + public abstract Id getChannelIdentifier(); /** - * Called when this channel recieves a packet + * Called when this channel recieves a packet. * @param arg The local PacketHandler * @param data The data of the packet */ public abstract void onRecieve(PacketHandler arg, byte[] data); /** - * Server packet send method + * Server packet send method. * @param data The data to send * @param player The player to send the data to */ public void send(byte[] data, ServerPlayer player) { - player.field_255.method_835(new PluginMessagePacket(getChannelIdentifier(), data)); + player.field_255.method_835(new PluginMessagePacket(getChannelIdentifier().toString(), data)); } /** - * Client packet send method + * Client packet send method. * @param data The data to send * @param mc The local Minecraft */ public void send(byte[] data, Minecraft mc) { - mc.method_2145().sendPacket(new PluginMessagePacket(getChannelIdentifier(), data)); + mc.method_2145().sendPacket(new PluginMessagePacket(getChannelIdentifier().toString(), data)); } } \ No newline at end of file diff --git a/src/main/java/io/github/minecraftcursedlegacy/impl/networking/PluginChannelRegistryImpl.java b/src/main/java/io/github/minecraftcursedlegacy/impl/networking/PluginChannelRegistryImpl.java index f4076858..060f69fc 100644 --- a/src/main/java/io/github/minecraftcursedlegacy/impl/networking/PluginChannelRegistryImpl.java +++ b/src/main/java/io/github/minecraftcursedlegacy/impl/networking/PluginChannelRegistryImpl.java @@ -12,7 +12,7 @@ private PluginChannelRegistryImpl() { private static HashMap channelMap = new HashMap<>(); public static void registerPluginChannel(PluginChannel channel) { - channelMap.put(channel.getChannelIdentifier(), channel); + channelMap.put(channel.getChannelIdentifier().toString(), channel); } protected static void handlePacket(PacketHandler arg, PluginMessagePacket packet) {