Archiviert
1
0

Dont send everybody the packet.

Dieser Commit ist enthalten in:
Finn 2023-04-21 11:39:57 +02:00
Ursprung 2a91330453
Commit e72c3c4f2d
2 geänderte Dateien mit 33 neuen und 6 gelöschten Zeilen

Datei anzeigen

@ -22,6 +22,7 @@ package de.steamwar.bungeecore.commands;
import de.steamwar.bungeecore.Message;
import de.steamwar.bungeecore.Storage;
import de.steamwar.bungeecore.listeners.mods.Utils;
import de.steamwar.bungeecore.listeners.mods.lunar.Lunar;
import de.steamwar.command.SWCommand;
import de.steamwar.command.SWCommandUtils;
import de.steamwar.command.TypeMapper;
@ -111,7 +112,9 @@ public class WhoisCommand extends SWCommand {
if (Utils.playerModMap.containsKey(user.getUUID())) {
Mod.Platform modPlatform = Utils.playerModMap.get(user.getUUID()).get(0).getPlatform();
Message.send("WHOIS_PLATFORM", player, modPlatform.toString());
//Message.send("WHOIS_PLATFORM", player, modPlatform.toString());
Message.send("WHOIS_PLATFORM", player, Lunar.lunarPlayers.contains(player) ? "LABYMOD" : modPlatform.toString());
}
if (parameterTypes.contains(WhoisParameterTypes.MOD)) {

Datei anzeigen

@ -1,26 +1,33 @@
package de.steamwar.bungeecore.listeners.mods.lunar;
import com.google.common.io.ByteArrayDataOutput;
import com.google.common.io.ByteStreams;
import de.steamwar.bungeecore.BungeeCore;
import de.steamwar.bungeecore.listeners.BasicListener;
import de.steamwar.bungeecore.listeners.mods.lunar.packets.LCPacketModSettings;
import de.steamwar.sql.SteamwarUser;
import net.md_5.bungee.api.connection.ProxiedPlayer;
import net.md_5.bungee.api.event.PlayerDisconnectEvent;
import net.md_5.bungee.api.event.PluginMessageEvent;
import net.md_5.bungee.api.event.PostLoginEvent;
import net.md_5.bungee.event.EventHandler;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Set;
public class Lunar extends BasicListener {
public static final Set<ProxiedPlayer> lunarPlayers = new HashSet<>();
public static final String MESSAGE_CHANNEL = "lunarclient:pm";
static {
BungeeCore.get().getProxy().registerChannel(MESSAGE_CHANNEL);
}
@EventHandler
public void onPostLogin(PostLoginEvent e) {
BungeeCore.get().getProxy().registerChannel(MESSAGE_CHANNEL);
ProxiedPlayer player = e.getPlayer();
SteamwarUser user = SteamwarUser.get(player.getUniqueId());
LCPacketModSettings modSettingsPacket = new LCPacketModSettings();
@ -28,6 +35,23 @@ public class Lunar extends BasicListener {
modSettings.addModSetting("freelook", new ModSettings.ModSetting(false, new HashMap<>()));
player.getServer().sendData(MESSAGE_CHANNEL, LCPacket.getPacketData(modSettingsPacket));
player.sendData(MESSAGE_CHANNEL, LCPacket.getPacketData(modSettingsPacket));
}
@EventHandler
public void onPluginMessageEvent(PluginMessageEvent e) {
if (!e.getTag().equals(MESSAGE_CHANNEL))
return;
if (!(e.getSender() instanceof ProxiedPlayer)) {
return;
}
lunarPlayers.add((ProxiedPlayer) e.getSender());
}
@EventHandler
public void onDisconnect(PlayerDisconnectEvent e) {
lunarPlayers.remove(e.getPlayer());
}
}