Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
1 change: 1 addition & 0 deletions build-extensions/src/main/kotlin/Files.kt
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ object Files {
const val chatPlugin = "cloudnet-chat.jar"
const val papiExpansion = "cloudnet-papi-expansion.jar"
const val simpleNameTagsPlugin = "cloudnet-simplenametags.jar"
const val luckPermsPlugin = "cloudnet-luckperms.jar"

const val bridge = "cloudnet-bridge.jar"
const val cloudflare = "cloudnet-cloudflare.jar"
Expand Down
2 changes: 2 additions & 0 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ modlauncher = "8.1.3"
npcLib = "3.0.0-beta6"
placeholderApi = "2.11.5"
adventure-serializer-bungee = "4.3.2"
luckPermsApi = "5.4"

# fabric platform special dependencies
minecraft = "1.20.4"
Expand Down Expand Up @@ -181,6 +182,7 @@ placeholderApi = { group = "me.clip", name = "placeholderapi", version.ref = "pl

npcLib = { group = "io.github.juliarn", name = "npc-lib-bukkit", version.ref = "npcLib" }
npcLibLabymod = { group = "io.github.juliarn", name = "npc-lib-labymod", version.ref = "npcLib" }
luckPermsApi = { group = "net.luckperms", name = "api", version.ref = "luckPermsApi" }

# fabric platform special dependencies
minecraft = { group = "com.mojang", name = "minecraft", version.ref = "minecraft" }
Expand Down
1 change: 1 addition & 0 deletions modules/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ subprojects {

repositories {
maven("https://repo.waterdog.dev/releases/")
maven("https://repo.waterdog.dev/snapshots/")
maven("https://repo.md-5.net/repository/releases/")
maven("https://repo.md-5.net/repository/snapshots/")
maven("https://repo.opencollab.dev/maven-releases/")
Expand Down
3 changes: 3 additions & 0 deletions plugins/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,12 @@ import org.apache.tools.ant.filters.ReplaceTokens

subprojects {
repositories {
maven("https://repo.waterdog.dev/releases/")
maven("https://repo.waterdog.dev/snapshots/")
maven("https://repo.spongepowered.org/maven/")
Comment thread
RobotHanzo marked this conversation as resolved.
Resolved
maven("https://repo.opencollab.dev/maven-releases/")
maven("https://repo.opencollab.dev/maven-snapshots/")
maven("https://repo.papermc.io/repository/maven-public/")
maven("https://hub.spigotmc.org/nexus/content/repositories/snapshots/")
}

Expand Down
40 changes: 40 additions & 0 deletions plugins/luckperms/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
import net.fabricmc.loom.task.RemapJarTask

/*
* Copyright 2019-2023 CloudNetService team & contributors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

plugins {
alias(libs.plugins.fabricLoom)
}


dependencies {
"compileOnly"(libs.bundles.proxyPlatform)
"compileOnly"(libs.bundles.serverPlatform)

"compileOnly"(libs.luckPermsApi)
"compileOnly"(projects.wrapperJvm)
"compileOnly"(projects.modules.bridge)

"minecraft"(libs.minecraft)
"modCompileOnly"(libs.fabricLoader)
"mappings"(loom.officialMojangMappings())
}

tasks.withType<RemapJarTask> {
// base setup
archiveFileName.set(Files.luckPermsPlugin)
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
/*
* Copyright 2019-2024 CloudNetService team & contributors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package eu.cloudnetservice.plugins.luckperms;

import eu.cloudnetservice.ext.platforminject.api.PlatformEntrypoint;
import eu.cloudnetservice.ext.platforminject.api.stereotype.Dependency;
import eu.cloudnetservice.ext.platforminject.api.stereotype.PlatformPlugin;
import jakarta.inject.Inject;
import jakarta.inject.Singleton;
import lombok.NonNull;
import net.luckperms.api.LuckPermsProvider;

@Singleton
@PlatformPlugin(
platform = "bukkit",
name = "CloudNet-LuckPerms",
authors = "CloudNetService",
version = "@version@",
description = "Brings LuckPerms support to all server platforms",
pluginFileNames = "plugin.yml",
dependencies = @Dependency(name = "LuckPerms")
)
public class BukkitLuckPermsPlugin implements PlatformEntrypoint {

private final CloudNetContextCalculator cloudNetContextCalculator;

@Inject
public BukkitLuckPermsPlugin(@NonNull CloudNetContextCalculator cloudNetContextCalculator) {
this.cloudNetContextCalculator = cloudNetContextCalculator;
}

@Override
public void onLoad() {
LuckPermsProvider.get().getContextManager().registerCalculator(this.cloudNetContextCalculator);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
/*
* Copyright 2019-2024 CloudNetService team & contributors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package eu.cloudnetservice.plugins.luckperms;

import eu.cloudnetservice.ext.platforminject.api.PlatformEntrypoint;
import eu.cloudnetservice.ext.platforminject.api.stereotype.Dependency;
import eu.cloudnetservice.ext.platforminject.api.stereotype.PlatformPlugin;
import jakarta.inject.Inject;
import jakarta.inject.Singleton;
import lombok.NonNull;
import net.luckperms.api.LuckPermsProvider;

@Singleton
@PlatformPlugin(
platform = "bungeecord",
name = "CloudNet-LuckPerms",
authors = "CloudNetService",
version = "@version@",
description = "Brings LuckPerms support to all server platforms",
dependencies = @Dependency(name = "LuckPerms")
)
public class BungeecordLuckPermsPlugin implements PlatformEntrypoint {

private final CloudNetContextCalculator cloudNetContextCalculator;

@Inject
public BungeecordLuckPermsPlugin(@NonNull CloudNetContextCalculator cloudNetContextCalculator) {
this.cloudNetContextCalculator = cloudNetContextCalculator;
}

@Override
public void onLoad() {
LuckPermsProvider.get().getContextManager().registerCalculator(this.cloudNetContextCalculator);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
/*
* Copyright 2019-2024 CloudNetService team & contributors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package eu.cloudnetservice.plugins.luckperms;

import eu.cloudnetservice.wrapper.configuration.WrapperConfiguration;
import jakarta.inject.Inject;
import jakarta.inject.Singleton;
import lombok.NonNull;
import net.luckperms.api.context.ContextConsumer;
import net.luckperms.api.context.ContextSet;
import net.luckperms.api.context.MutableContextSet;
import net.luckperms.api.context.StaticContextCalculator;

@Singleton
public class CloudNetContextCalculator implements StaticContextCalculator {

private final WrapperConfiguration wrapperConfiguration;

@Inject
public CloudNetContextCalculator(@NonNull WrapperConfiguration wrapperConfiguration) {
this.wrapperConfiguration = wrapperConfiguration;
}

private @NonNull ContextSet contextSet() {
var contextSet = MutableContextSet.create();
var serviceId = this.wrapperConfiguration.serviceConfiguration().serviceId();

contextSet.add("service", serviceId.name());
contextSet.add("task", serviceId.taskName());
contextSet.add("node", serviceId.nodeUniqueId());
contextSet.add("environment", serviceId.environmentName());
for (var group : this.wrapperConfiguration.serviceConfiguration().groups()) {
contextSet.add("group", group);
}
return contextSet;
}

@Override
public void calculate(@NonNull ContextConsumer consumer) {
consumer.accept(this.contextSet());
}

@Override
public @NonNull ContextSet estimatePotentialContexts() {
return this.contextSet();
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
/*
* Copyright 2019-2024 CloudNetService team & contributors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package eu.cloudnetservice.plugins.luckperms;

import eu.cloudnetservice.ext.platforminject.api.PlatformEntrypoint;
import eu.cloudnetservice.ext.platforminject.api.stereotype.Dependency;
import eu.cloudnetservice.ext.platforminject.api.stereotype.PlatformPlugin;
import jakarta.inject.Inject;
import jakarta.inject.Singleton;
import lombok.NonNull;
import net.luckperms.api.LuckPermsProvider;

@Singleton
@PlatformPlugin(
platform = "fabric",
name = "CloudNet-LuckPerms",
version = "@version@",
dependencies = {
@Dependency(name = "fabricloader", version = ">=0.14.17"),
@Dependency(name = "minecraft", version = ">=1.20.4"),
@Dependency(name = "java", version = ">=17"),
@Dependency(name = "LuckPerms")
},
authors = "CloudNetService",
description = "Brings LuckPerms support to all server platforms"
)
public class FabricLuckPermsPlugin implements PlatformEntrypoint {

private final CloudNetContextCalculator cloudNetContextCalculator;

@Inject
public FabricLuckPermsPlugin(@NonNull CloudNetContextCalculator cloudNetContextCalculator) {
this.cloudNetContextCalculator = cloudNetContextCalculator;
}

@Override
public void onLoad() {
LuckPermsProvider.get().getContextManager().registerCalculator(this.cloudNetContextCalculator);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
/*
* Copyright 2019-2024 CloudNetService team & contributors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package eu.cloudnetservice.plugins.luckperms;

import eu.cloudnetservice.ext.platforminject.api.PlatformEntrypoint;
import eu.cloudnetservice.ext.platforminject.api.stereotype.Dependency;
import eu.cloudnetservice.ext.platforminject.api.stereotype.PlatformPlugin;
import jakarta.inject.Inject;
import jakarta.inject.Singleton;
import lombok.NonNull;
import net.luckperms.api.LuckPermsProvider;

@Singleton
@PlatformPlugin(
platform = "nukkit",
api = "1.0.5",
name = "CloudNet-LuckPerms",
version = "@version@",
authors = "CloudNetService",
description = "Brings LuckPerms support to all server platforms",
dependencies = @Dependency(name = "LuckPerms")
)
public class NukkitLuckPermsPlugin implements PlatformEntrypoint {

private final CloudNetContextCalculator cloudNetContextCalculator;

@Inject
public NukkitLuckPermsPlugin(@NonNull CloudNetContextCalculator cloudNetContextCalculator) {
this.cloudNetContextCalculator = cloudNetContextCalculator;
}

@Override
public void onLoad() {
LuckPermsProvider.get().getContextManager().registerCalculator(this.cloudNetContextCalculator);
}
}
Loading