Signed-off-by: Lixfel <agga-games@gmx.de>
Dieser Commit ist enthalten in:
Ursprung
a0a2d70c46
Commit
9572347419
@ -116,7 +116,7 @@ public class PluginMessage extends BasicListener {
|
||||
"axiom:hello", "axiom:set_gamemode", "axiom:set_fly_speed", "axiom:set_world_time",
|
||||
"axiom:set_world_property", "axiom:set_block", "axiom:set_hotbar_slot", "axiom:switch_active_hotbar",
|
||||
"axiom:teleport", "axiom:set_editor_views", "axiom:request_chunk_data", "axiom:spawn_entity",
|
||||
"axiom:manipulate_entity", "axiom:delete_entity", "axiom:marker_nbt_request"
|
||||
"axiom:manipulate_entity", "axiom:delete_entity", "axiom:marker_nbt_request", "axiom:set_buffer"
|
||||
);
|
||||
|
||||
register("REGISTER", false, directional(this::serverRegistersChannel, this::clientRegistersChannel));
|
||||
@ -129,7 +129,8 @@ public class PluginMessage extends BasicListener {
|
||||
register("MC|Brand", false, directional(this::steamWarBrand, this::userBrand));
|
||||
register("minecraft:brand", false, directional(this::steamWarBrand, this::userBrand));
|
||||
|
||||
register("sw:bridge", false, directional(onlySWSource(async(event -> NetworkPacket.handle(new ServerMetaInfo(((Server) event.getSender()).getInfo()), event.getData()))), UNKNOWN));
|
||||
//Needs to be registered cause paper refuses to send PluginMessages on unregistered channels...
|
||||
register("sw:bridge", true, directional(onlySWSource(async(event -> NetworkPacket.handle(new ServerMetaInfo(((Server) event.getSender()).getInfo()), event.getData()))), UNKNOWN));
|
||||
register("sw:hotkeys", false, directional(UNKNOWN, PASS_THROUGH));
|
||||
register("fabricmodsender:mods", true, directional(UNKNOWN, async(fabricModSender::handlePluginMessage)));
|
||||
|
||||
@ -172,10 +173,8 @@ public class PluginMessage extends BasicListener {
|
||||
}
|
||||
|
||||
private void registerPassthroughToServer(String... channels) {
|
||||
for(String channel : channels) {
|
||||
knownChannels.add(channel);
|
||||
for(String channel : channels)
|
||||
register(channel, false, directional(UNKNOWN, PASS_THROUGH));
|
||||
}
|
||||
}
|
||||
|
||||
private void registerBiDirPassthrough(String... channels) {
|
||||
|
@ -43,13 +43,17 @@ import java.util.concurrent.TimeUnit;
|
||||
|
||||
public class FabricModSender extends BasicListener {
|
||||
|
||||
private final Set<String> neededMods = new HashSet<>();
|
||||
private final Set<String> neededFabricMods = new HashSet<>();
|
||||
private final Set<String> neededQuiltMods = new HashSet<>();
|
||||
|
||||
public FabricModSender() {
|
||||
neededMods.add("java");
|
||||
neededMods.add("minecraft");
|
||||
neededMods.add("fabricloader");
|
||||
neededMods.add("steamwarmodsender");
|
||||
neededFabricMods.add("java");
|
||||
neededFabricMods.add("minecraft");
|
||||
neededFabricMods.add("steamwarmodsender");
|
||||
neededQuiltMods.addAll(neededFabricMods);
|
||||
|
||||
neededFabricMods.add("fabricloader");
|
||||
neededQuiltMods.add("quilt_loader");
|
||||
|
||||
BungeeCord.getInstance().getScheduler().schedule(BungeeCore.get(), () -> {
|
||||
synchronized (Storage.fabricExpectPluginMessage) {
|
||||
@ -95,7 +99,7 @@ public class FabricModSender extends BasicListener {
|
||||
mods.add(Mod.getOrCreate(mod.getAsString(), Mod.Platform.FABRIC));
|
||||
}
|
||||
|
||||
if(!neededModsContained(mods)) {
|
||||
if(!neededModsContained(neededFabricMods, mods) && !neededModsContained(neededQuiltMods, mods)) {
|
||||
logMessage(user, "Needed mods are not contained", data);
|
||||
return;
|
||||
}
|
||||
@ -128,11 +132,11 @@ public class FabricModSender extends BasicListener {
|
||||
}
|
||||
}
|
||||
|
||||
private boolean neededModsContained(List<Mod> mods) {
|
||||
private boolean neededModsContained(Set<String> neededMods, List<Mod> mods) {
|
||||
return mods.stream()
|
||||
.map(Mod::getModName)
|
||||
.filter(neededMods::contains)
|
||||
.count() == neededMods.size();
|
||||
.count() == neededFabricMods.size();
|
||||
}
|
||||
|
||||
private void logMessage(SteamwarUser user, String reason, String data) {
|
||||
|
@ -54,12 +54,12 @@ public class Hostname extends BasicListener {
|
||||
|
||||
@EventHandler
|
||||
public void onHandshake(PlayerHandshakeEvent event) {
|
||||
String hostname = event.getHandshake().getHost().toLowerCase();
|
||||
String extraDataInHandshake = ((InitialHandler) event.getConnection()).getExtraDataInHandshake();
|
||||
if (!knownHostnames.contains(event.getHandshake().getHost().toLowerCase())) {
|
||||
if (!knownHostnames.contains(hostname) && !hostname.endsWith(".steamwar.de")) {
|
||||
BungeeCore.get().getLogger().log(Level.WARNING, () -> event.getConnection().getSocketAddress() + " connected with unknown hostname " + event.getHandshake() + " " + extraDataInHandshake);
|
||||
} else if (!knownExtraData.contains(extraDataInHandshake)) {
|
||||
BungeeCore.get().getLogger().log(Level.WARNING, () -> event.getConnection().getSocketAddress() + " connected with unknown extra data " + event.getHandshake() + " " + extraDataInHandshake);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
In neuem Issue referenzieren
Einen Benutzer sperren