forked from SteamWar/SteamWar
Remove Lunar client support
They currently have a problem with their maven repository
This commit is contained in:
@@ -57,7 +57,6 @@ dependencies {
|
|||||||
implementation(libs.mysql)
|
implementation(libs.mysql)
|
||||||
|
|
||||||
implementation(libs.msgpack)
|
implementation(libs.msgpack)
|
||||||
implementation(libs.apolloprotos)
|
|
||||||
|
|
||||||
implementation(libs.nbt)
|
implementation(libs.nbt)
|
||||||
|
|
||||||
|
|||||||
@@ -19,25 +19,9 @@
|
|||||||
|
|
||||||
package de.steamwar.velocitycore.mods;
|
package de.steamwar.velocitycore.mods;
|
||||||
|
|
||||||
import com.google.protobuf.Any;
|
|
||||||
import com.google.protobuf.InvalidProtocolBufferException;
|
|
||||||
import com.google.protobuf.Value;
|
|
||||||
import com.lunarclient.apollo.configurable.v1.ConfigurableSettings;
|
|
||||||
import com.lunarclient.apollo.configurable.v1.OverrideConfigurableSettingsMessage;
|
|
||||||
import com.lunarclient.apollo.player.v1.ModMessage;
|
|
||||||
import com.lunarclient.apollo.player.v1.PlayerHandshakeMessage;
|
|
||||||
import com.velocitypowered.api.event.connection.PluginMessageEvent;
|
import com.velocitypowered.api.event.connection.PluginMessageEvent;
|
||||||
import com.velocitypowered.api.proxy.Player;
|
import com.velocitypowered.api.proxy.Player;
|
||||||
import com.velocitypowered.api.proxy.messages.MinecraftChannelIdentifier;
|
|
||||||
import de.steamwar.messages.Chatter;
|
import de.steamwar.messages.Chatter;
|
||||||
import de.steamwar.sql.Mod;
|
|
||||||
import de.steamwar.sql.SteamwarUser;
|
|
||||||
import de.steamwar.sql.UserPerm;
|
|
||||||
import de.steamwar.velocitycore.VelocityCore;
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.logging.Level;
|
|
||||||
|
|
||||||
public class Lunar {
|
public class Lunar {
|
||||||
// https://lunarclient.dev/apollo/introduction
|
// https://lunarclient.dev/apollo/introduction
|
||||||
@@ -45,61 +29,7 @@ public class Lunar {
|
|||||||
|
|
||||||
public static final String CHANNEL = "lunar:apollo";
|
public static final String CHANNEL = "lunar:apollo";
|
||||||
|
|
||||||
private final byte[] packet;
|
|
||||||
|
|
||||||
public Lunar() {
|
|
||||||
ConfigurableSettings.Builder builder = ConfigurableSettings.newBuilder()
|
|
||||||
.setApolloModule("mod_setting")
|
|
||||||
.setEnable(true);
|
|
||||||
|
|
||||||
for(String property : List.of(
|
|
||||||
"freelook.enabled", "hypixel-mod.enabled", "minimap.enabled", "nametag.enabled", "replaymod.enabled",
|
|
||||||
"team-view.enabled", "tnt-countdown.enabled", "toggle-sneak.toggle-sneak-container"
|
|
||||||
))
|
|
||||||
builder.putProperties(property, Value.newBuilder().setBoolValue(false).build());
|
|
||||||
|
|
||||||
packet = Any.pack(OverrideConfigurableSettingsMessage.newBuilder().addConfigurableSettings(builder).build()).toByteArray();
|
|
||||||
}
|
|
||||||
|
|
||||||
public void sendRestrictions(Player player) {
|
|
||||||
player.sendPluginMessage(MinecraftChannelIdentifier.from(CHANNEL), packet);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void handlePluginMessage(PluginMessageEvent event) {
|
public void handlePluginMessage(PluginMessageEvent event) {
|
||||||
try {
|
Chatter.disconnect((Player) event.getSource()).prefixless("MOD_YELLOW_SING", "lunar");
|
||||||
Any packet = Any.parseFrom(event.getData());
|
|
||||||
if(packet.is(PlayerHandshakeMessage.class))
|
|
||||||
handle((Player) event.getSource(), packet.unpack(PlayerHandshakeMessage.class));
|
|
||||||
} catch (InvalidProtocolBufferException e) {
|
|
||||||
throw new SecurityException(e);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void handle(Player player, PlayerHandshakeMessage packet) {
|
|
||||||
if (!SteamwarUser.get(player.getUniqueId()).hasPerm(UserPerm.RESTRICTED_MODS)) {
|
|
||||||
Chatter.disconnect(player).prefixless("MOD_YELLOW_SING", "Lunar");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
List<Mod> mods = new ArrayList<>();
|
|
||||||
|
|
||||||
for(ModMessage mod : packet.getInstalledModsList()) {
|
|
||||||
switch(mod.getType()) {
|
|
||||||
case TYPE_FABRIC_INTERNAL, TYPE_FORGE_INTERNAL:
|
|
||||||
// Controlled with ModSettings
|
|
||||||
break;
|
|
||||||
case TYPE_FABRIC_EXTERNAL:
|
|
||||||
mods.add(Mod.getOrCreate(mod.getName(), Mod.Platform.FABRIC));
|
|
||||||
break;
|
|
||||||
case TYPE_FORGE_EXTERNAL:
|
|
||||||
mods.add(Mod.getOrCreate(mod.getName(), Mod.Platform.FORGE));
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
VelocityCore.getLogger().log(Level.INFO, () -> player.getUsername() + " uses Lunar mod with unknown type " + mod);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
ModUtils.handleMods(player, mods);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -34,13 +34,6 @@ dependencyResolutionManagement {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
maven {
|
|
||||||
url = URI("https://repo.lunarclient.dev")
|
|
||||||
content {
|
|
||||||
includeGroup("com.lunarclient")
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
maven {
|
maven {
|
||||||
if (isInCi) {
|
if (isInCi) {
|
||||||
url = URI("file:///var/www/maven/")
|
url = URI("file:///var/www/maven/")
|
||||||
@@ -141,7 +134,6 @@ dependencyResolutionManagement {
|
|||||||
library("viavelocity", "com.viaversion:viaversion-velocity:4.3.1")
|
library("viavelocity", "com.viaversion:viaversion-velocity:4.3.1")
|
||||||
library("jda", "net.dv8tion:JDA:5.5.1")
|
library("jda", "net.dv8tion:JDA:5.5.1")
|
||||||
library("msgpack", "org.msgpack:msgpack-core:0.9.8")
|
library("msgpack", "org.msgpack:msgpack-core:0.9.8")
|
||||||
library("apolloprotos", "com.lunarclient:apollo-protos:1.0-SNAPSHOT")
|
|
||||||
|
|
||||||
library("logback", "ch.qos.logback:logback-classic:1.5.6")
|
library("logback", "ch.qos.logback:logback-classic:1.5.6")
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user