Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
8eb6c69
feat: add support for allay platform
smartcmd Oct 20, 2024
417138c
docs: add licence information
smartcmd Oct 20, 2024
a988ac6
feat: fetch allay's changes
smartcmd Nov 9, 2024
7901bf9
Merge branch 'lucko:main' into feat/allay-platform
smartcmd Dec 14, 2024
a3a92df
feat: ServerConfigProvider
IWareQ Dec 14, 2024
1b7388c
feat: use release allay-api
IWareQ Dec 23, 2024
fc691bf
chores: disable unused modules
IWareQ Feb 16, 2025
ca107dd
fix: adapt allay updates
IWareQ Apr 4, 2025
18a3e61
Merge remote-tracking branch 'origin/main' into feat/allay-platform
IWareQ Aug 12, 2025
7231864
fix: adapt allay updates
IWareQ Aug 12, 2025
f23a7d7
fix: `UnsupportedOperationException`
IWareQ Aug 12, 2025
2a641f8
fix: permission
IWareQ Aug 12, 2025
683fa41
feat: hidden v6 port & ip
IWareQ Aug 17, 2025
c9f31fa
feat: adapt allay 0.7.1
IWareQ Aug 20, 2025
744be61
Merge branch 'main' into feat/allay-platform
smartcmd Nov 14, 2025
f83c4f1
Merge remote-tracking branch 'allay/feat/allay-platform' into feat/al…
smartcmd Nov 14, 2025
6e6d44d
feat: adapt allay-api 0.17.0-dev
smartcmd Nov 14, 2025
f92ccbb
fix: fix command permission
smartcmd Nov 14, 2025
eaa926d
fix: fix command permission again xd
smartcmd Nov 14, 2025
1181f35
feat(allay): adapt allay-api 0.17.0 release
Miroshka000 Nov 28, 2025
f19244d
Fix Allay API compatibility issues
Miroshka000 Nov 28, 2025
9ab13a1
Merge pull request #1 from Miroshka000/feat/allay-platform
smartcmd Nov 28, 2025
0deb066
chore: remove unused import
smartcmd Nov 28, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 9 additions & 8 deletions settings.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,13 @@ plugins {
}

rootProject.name = 'spark-extra-platforms'
include (
'spark-folia',
'spark-geyser',
'spark-minestom',
'spark-nukkit',
'spark-sponge7',
'spark-velocity4',
'spark-waterdog',
include(
// 'spark-folia',
// 'spark-geyser',
// 'spark-minestom',
// 'spark-nukkit',
// 'spark-sponge7',
// 'spark-velocity4',
// 'spark-waterdog',
'spark-allay'
)
57 changes: 57 additions & 0 deletions spark-allay/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
plugins {
id 'com.gradleup.shadow' version '8.3.0'
id 'org.allaymc.gradle.plugin' version '0.1.2'
}

tasks.withType(JavaCompile).configureEach {
// override, compile targeting J21
options.release = 21
}

allay {
api = "0.17.0"

plugin {
it.entrance = "me.lucko.spark.allay.AllaySparkPlugin"
it.name = "spark"
it.description = project.pluginDescription
it.authors = ["Luck", "IWareQ", "daoge_cmd"]
it.version = project.pluginVersion
it.website = "https://spark.lucko.me/"
}
}

dependencies {
implementation "me.lucko:spark-common:${project.baseVersion}-SNAPSHOT"
}

processResources {
from(sourceSets.main.resources.srcDirs) {
expand(
'pluginVersion': project.pluginVersion,
'pluginDescription': project.pluginDescription
)
include 'plugin.json'
}
}

shadowJar {
archiveFileName = "spark-${project.pluginVersion}-allay.jar"

relocate 'net.kyori.adventure', 'me.lucko.spark.lib.adventure'
relocate 'net.kyori.examination', 'me.lucko.spark.lib.adventure.examination'
relocate 'net.kyori.option', 'me.lucko.spark.lib.adventure.option'
relocate 'net.bytebuddy', 'me.lucko.spark.lib.bytebuddy'
relocate 'com.google.protobuf', 'me.lucko.spark.lib.protobuf'
relocate 'org.objectweb.asm', 'me.lucko.spark.lib.asm'
relocate 'one.profiler', 'me.lucko.spark.lib.asyncprofiler'
relocate 'me.lucko.bytesocks.client', 'me.lucko.spark.lib.bytesocks'
relocate 'org.java_websocket', 'me.lucko.spark.lib.bytesocks.ws'

project.applyExcludes(delegate)
}

artifacts {
archives shadowJar
shadow shadowJar
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
/*
* This file is part of spark.
*
* Copyright (c) lucko (Luck) <luck@lucko.me>
* Copyright (c) contributors
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/

package me.lucko.spark.allay;

import me.lucko.spark.common.sampler.source.ClassSourceLookup;
import org.allaymc.api.plugin.PluginManager;

import java.util.HashMap;
import java.util.Map;

/**
* @author IWareQ
*/
public class AllayClassSourceLookup extends ClassSourceLookup.ByFirstUrlSource {
private final Map<ClassLoader, String> classLoaders2PluginName = new HashMap<>();

public AllayClassSourceLookup(PluginManager manager) {
manager.getEnabledPlugins().values().forEach(container -> classLoaders2PluginName.put(
container.plugin().getClass().getClassLoader(),
container.descriptor().getName())
);
}

@Override
public String identify(ClassLoader loader) {
return this.classLoaders2PluginName.get(loader);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
/*
* This file is part of spark.
*
* Copyright (c) lucko (Luck) <luck@lucko.me>
* Copyright (c) contributors
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/

package me.lucko.spark.allay;

import me.lucko.spark.common.command.sender.AbstractCommandSender;
import net.kyori.adventure.text.Component;
import net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer;
import org.allaymc.api.command.CommandSender;

import java.util.UUID;

/**
* @author IWareQ
*/
public class AllayCommandSender extends AbstractCommandSender<CommandSender> {
public AllayCommandSender(CommandSender delegate) {
super(delegate);
}

@Override
public String getName() {
return this.delegate.getCommandSenderName();
}

@Override
public UUID getUniqueId() {
if (this.delegate.isPlayer()) {
return this.delegate.asPlayer().getUniqueId();
}

return null;
}

@Override
public void sendMessage(Component message) {
this.delegate.sendMessage(LegacyComponentSerializer.legacySection().serialize(message));
}

@Override
public boolean hasPermission(String permission) {
return this.delegate.hasPermission(permission).asBoolean();
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
/*
* This file is part of spark.
*
* Copyright (c) lucko (Luck) <luck@lucko.me>
* Copyright (c) contributors
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/

package me.lucko.spark.allay;

import me.lucko.spark.common.platform.PlatformInfo;

import java.lang.reflect.InvocationTargetException;

/**
* @author IWareQ
*/
public class AllayPlatformInfo implements PlatformInfo {

@Override
public Type getType() {
return Type.SERVER;
}

@Override
public String getName() {
return "Allay";
}

@Override
public String getBrand() {
return "Allay";
}

@Override
public String getVersion() {
try {
var gitProperties = Class.forName("org.allaymc.server.utils.GitProperties");
var getBuildApiVersion = gitProperties.getMethod("getBuildApiVersion");
return String.valueOf(getBuildApiVersion.invoke(null));
} catch (ClassNotFoundException | NoSuchMethodException | IllegalAccessException |
InvocationTargetException e) {
throw new RuntimeException(e);
}
}

@Override
public String getMinecraftVersion() {
// TODO: Use the actual minecraft version when we can get version through the api
return "*";
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
/*
* This file is part of spark.
*
* Copyright (c) lucko (Luck) <luck@lucko.me>
* Copyright (c) contributors
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/

package me.lucko.spark.allay;

import me.lucko.spark.common.monitor.ping.PlayerPingProvider;
import org.allaymc.api.server.Server;

import java.util.Collections;
import java.util.HashMap;
import java.util.Map;

/**
* @author IWareQ
*/
public class AllayPlayerPingProvider implements PlayerPingProvider {
private final Server server;

public AllayPlayerPingProvider(Server server) {
this.server = server;
}

@Override
public Map<String, Integer> poll() {
Map<String, Integer> result = new HashMap<>();
for (var player : this.server.getPlayerManager().getPlayers().values()) {
result.put(player.getOriginName(), player.getPing());
}
return Collections.unmodifiableMap(result);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
/*
* This file is part of spark.
*
* Copyright (c) lucko (Luck) <luck@lucko.me>
* Copyright (c) contributors
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/

package me.lucko.spark.allay;

import com.google.gson.Gson;
import com.google.gson.JsonElement;
import me.lucko.spark.common.platform.serverconfig.ConfigParser;
import me.lucko.spark.common.platform.serverconfig.ExcludedConfigFilter;
import me.lucko.spark.common.platform.serverconfig.ServerConfigProvider;
import org.yaml.snakeyaml.Yaml;

import java.io.BufferedReader;
import java.io.IOException;
import java.nio.file.Paths;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
import java.util.Set;

/**
* @author IWareQ
*/
public class AllayServerConfigProvider extends ServerConfigProvider {
private static final Map<String, ConfigParser> FILES = new HashMap<>();
private static final Set<String> HIDDEN_PATHS = new HashSet<>();

static {
FILES.put("server-settings.yml", YamlConfigParser.INSTANCE);
FILES.put("worlds/world-settings.yml", YamlConfigParser.INSTANCE);

HIDDEN_PATHS.add("network-settings.ip");
HIDDEN_PATHS.add("network-settings.ipv6");
HIDDEN_PATHS.add("network-settings.port");
HIDDEN_PATHS.add("network-settings.portv6");
}

public AllayServerConfigProvider() {
super(FILES, HIDDEN_PATHS);
}

private static class YamlConfigParser implements ConfigParser {
public static final YamlConfigParser INSTANCE = new YamlConfigParser();

private static final Gson GSON = new Gson();
private static final Yaml YAML = new Yaml();

@Override
public JsonElement load(String file, ExcludedConfigFilter filter) throws IOException {
var values = this.parse(Paths.get(file));
if (values == null) {
return null;
}

return filter.apply(GSON.toJsonTree(values));
}

@Override
public Map<String, Object> parse(BufferedReader reader) {
return YAML.load(reader);
}
}
}
Loading