Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/nightly' into merged
Browse files Browse the repository at this point in the history
  • Loading branch information
DasBabyPixel committed Jan 10, 2025
2 parents 6f06c91 + 790ec42 commit 1c2a16c
Show file tree
Hide file tree
Showing 11 changed files with 58 additions and 70 deletions.
2 changes: 2 additions & 0 deletions checkstyle.xml
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@
<property name="ignorePattern" value="^package.*|^import.*|a href|http://|https://|ftp://|//.*"/>
</module>
<module name="TreeWalker">
<property name="skipFileOnJavaParseException" value="true"/>
<property name="javaParseExceptionSeverity" value="info"/>
<module name="SuppressionCommentFilter">
<property name="offCommentFormat" value="CHECKSTYLE.OFF\: ([\w\|]+)"/>
<property name="onCommentFormat" value="CHECKSTYLE.ON"/>
Expand Down
30 changes: 15 additions & 15 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
@@ -1,51 +1,51 @@
[versions]

# plugins
shadow = "8.3.3"
shadow = "8.3.5"
juppiter = "0.4.0"
spotless = "6.25.0"
fabricLoom = "1.8.10"
fabricLoom = "1.9.2"
nexusPublish = "2.0.0"
checkstyleTools = "10.18.2"
checkstyleTools = "10.21.0"

# google libs
gson = "2.11.0"
guava = "33.3.1-jre"
guava = "33.4.0-jre"

# testing
junit = "5.11.2"
junit = "5.11.4"
mockito = "5.14.2"
junitLauncher = "1.11.2"
testcontainers = "1.20.2"
junitLauncher = "1.11.4"
testcontainers = "1.20.4"

# compile time processing
lombok = "1.18.34"
lombok = "1.18.36"
javapoet = "1.13.0"

# console
jline = "3.27.1"
jline = "3.28.0"
cloud = "2.0.0-cn1"
cloudConfirmation = "1.0.0-rc.1"
stringSimilarity = "2.0.0"

# databases
h2 = "1.4.197" # do not update, leads to database incompatibility
xodus = "2.0.1"
mongodb = "5.2.0"
hikariCp = "6.0.0"
mongodb = "5.2.1"
hikariCp = "6.2.1"
mysqlConnector = "9.1.0"

# general
oshi = "6.6.5"
vavr = "0.10.5"
sshj = "0.39.0"
aerogel = "2.1.0"
awsSdk = "2.28.26"
unirest = "4.4.4"
awsSdk = "2.29.35"
unirest = "4.4.5"
caffeine = "3.1.8"
reflexion = "1.8.0"
geantyref = "2.0.0"
dockerJava = "3.4.0"
dockerJava = "3.4.1"
nightConfig = "3.8.1"
annotations = "26.0.1"
influxClient = "7.2.0"
Expand All @@ -54,7 +54,7 @@ gulf = "1.0.0-SNAPSHOT"

# logging
slf4j = "2.0.16"
logback = "1.5.11"
logback = "1.5.12"

# platform api versions
sponge = "9.0.0"
Expand Down
4 changes: 2 additions & 2 deletions gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionSha256Sum=31c55713e40233a8303827ceb42ca48a47267a0ad4bab9177123121e71524c26
distributionUrl=https\://services.gradle.org/distributions/gradle-8.10.2-bin.zip
distributionSha256Sum=f397b287023acdba1e9f6fc5ea72d22dd63669d59ed4a289a29b1a76eee151c6
distributionUrl=https\://services.gradle.org/distributions/gradle-8.11.1-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
Expand Down
9 changes: 5 additions & 4 deletions modules/bridge/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -52,13 +52,10 @@ tasks.withType<Jar> {
manifest {
attributes["paperweight-mappings-namespace"] = "mojang"
}
}

tasks.withType<RemapJarTask> {
// depend on adventure helper jar task
dependsOn(":ext:adventure-helper:jar")
// base setup
archiveFileName.set(Files.bridge)

duplicatesStrategy = DuplicatesStrategy.EXCLUDE
// includes all dependencies of runtimeImpl but excludes gson because we don't need it
from(configurations.getByName("runtimeImpl").map { if (it.isDirectory) it else zipTree(it) })
Expand All @@ -67,6 +64,10 @@ tasks.withType<RemapJarTask> {
}
}

tasks.withType<RemapJarTask> {
archiveFileName.set(Files.bridge)
}

loom {
accessWidenerPath.set(project.file("src/main/resources/cloudnet_bridge.accesswidener"))
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
import eu.cloudnetservice.modules.npc.NPC;
import java.util.Set;
import lombok.NonNull;
import org.jetbrains.annotations.Nullable;

public interface PlatformSelectorEntity<L, P, M, I, S> {

Expand All @@ -39,7 +40,7 @@ public interface PlatformSelectorEntity<L, P, M, I, S> {

void executeAction(@NonNull P player, @NonNull NPC.ClickAction action);

@NonNull I selectorInventory();
@Nullable I selectorInventory();

void handleInventoryInteract(@NonNull I inv, @NonNull P player, @NonNull M clickedItem);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ public void handle(@NonNull InventoryClickEvent event) {
// check if we can handle the event
if (item != null && item.hasItemMeta() && inv != null && inv.getHolder() == null && clicker instanceof Player) {
this.management.trackedEntities().values().stream()
.filter(npc -> npc.selectorInventory().equals(inv))
.filter(npc -> inv.equals(npc.selectorInventory()))
.findFirst()
.ifPresent(npc -> {
event.setCancelled(true);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,12 @@ final class DefaultCommandManager extends CommandManager<CommandSource> {
* a thread pool with 4 threads.
*/
private DefaultCommandManager() {
var executor = Executors.newFixedThreadPool(4);
super(
ExecutionCoordinator.<CommandSource>builder().executor(Executors.newFixedThreadPool(4)).build(),
ExecutionCoordinator.<CommandSource>builder()
.parsingExecutor(executor)
.executionSchedulingExecutor(executor)
.build(),
CommandRegistrationHandler.nullCommandRegistrationHandler());
this.registerCapability(CloudCapability.StandardCapabilities.ROOT_COMMAND_DELETION);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,6 @@
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import java.util.Queue;
import java.util.stream.Collectors;
import java.util.stream.Stream;
import lombok.NonNull;
Expand All @@ -62,7 +61,6 @@
import org.incendo.cloud.annotations.Permission;
import org.incendo.cloud.annotations.parser.Parser;
import org.incendo.cloud.annotations.suggestion.Suggestions;
import org.incendo.cloud.context.CommandContext;
import org.incendo.cloud.context.CommandInput;
import org.jetbrains.annotations.Nullable;
import org.slf4j.Logger;
Expand Down Expand Up @@ -136,11 +134,8 @@ public ClusterCommand(
}

@Parser(suggestions = "networkClusterNode")
public @NonNull NetworkClusterNode defaultNetworkClusterNodeParser(
@NonNull CommandContext<?> $,
@NonNull Queue<String> input
) {
var nodeId = input.remove();
public @NonNull NetworkClusterNode defaultNetworkClusterNodeParser(@NonNull CommandInput input) {
var nodeId = input.readString();
var clusterNode = this.clusterNodeProvider.node(nodeId);
if (clusterNode == null) {
throw new ArgumentNotAvailableException(I18n.trans("command-cluster-node-not-found"));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,12 @@
import eu.cloudnetservice.common.column.RowedFormatter;
import eu.cloudnetservice.common.language.I18n;
import eu.cloudnetservice.common.resource.ResourceFormatter;
import eu.cloudnetservice.common.tuple.Tuple2;
import eu.cloudnetservice.common.util.WildcardUtil;
import eu.cloudnetservice.driver.channel.ChannelMessageSender;
import eu.cloudnetservice.driver.event.EventListener;
import eu.cloudnetservice.driver.event.EventManager;
import eu.cloudnetservice.driver.event.events.service.CloudServiceLogEntryEvent;
import eu.cloudnetservice.driver.provider.CloudServiceProvider;
import eu.cloudnetservice.driver.provider.SpecificCloudServiceProvider;
import eu.cloudnetservice.driver.service.ServiceDeployment;
import eu.cloudnetservice.driver.service.ServiceInfoSnapshot;
import eu.cloudnetservice.driver.service.ServiceRemoteInclusion;
Expand All @@ -51,7 +49,6 @@
import java.util.Objects;
import java.util.Set;
import java.util.regex.Pattern;
import java.util.stream.Collectors;
import java.util.stream.Stream;
import lombok.NonNull;
import org.incendo.cloud.annotation.specifier.Greedy;
Expand Down Expand Up @@ -203,44 +200,32 @@ public void copyService(
@Nullable @Flag("includes") @Quoted String includes,
@Flag("case-sensitive") boolean caseSensitive
) {
// associate all services with a template
Collection<Tuple2<SpecificCloudServiceProvider, ServiceTemplate>> targets = services.stream()
.map(service -> {
if (template != null) {
return new Tuple2<>(service.provider(), template);
} else {
// find a matching template
return service.configuration().templates().stream()
.filter(st -> st.prefix().equalsIgnoreCase(service.serviceId().taskName()))
.filter(st -> st.name().equalsIgnoreCase("default"))
.map(st -> new Tuple2<>(service.provider(), st))
.findFirst()
.orElse(null);
}
})
.collect(Collectors.toSet());
// check if we found a result
if (targets.isEmpty()) {
source.sendMessage(I18n.trans("command-service-copy-no-default-template"));
return;
var service = services.iterator().next();
var serviceProvider = service.provider();
if (template == null) {
template = serviceProvider.installedTemplates().stream()
.filter(st -> st.prefix().equalsIgnoreCase(service.serviceId().taskName()))
.filter(st -> st.name().equalsIgnoreCase("default"))
.findFirst()
.orElse(null);

if (template == null) {
source.sendMessage(I18n.trans("command-service-copy-no-default-template", service.serviceId().name()));
return;
}
}

// split on a semicolon and try to fix the patterns the user entered
var parsedExcludes = parseDeploymentPatterns(excludes, caseSensitive);
var parsedIncludes = parseDeploymentPatterns(includes, caseSensitive);
for (var target : targets) {
target.first().addServiceDeployment(ServiceDeployment.builder()
.template(target.second())
.excludes(parsedExcludes)
.includes(parsedIncludes)
.withDefaultExclusions()
.build());
target.first().removeAndExecuteDeployments();
// send a message for each service we did copy the template of
//noinspection ConstantConditions
source.sendMessage(I18n.trans("command-service-copy-success",
target.first().serviceInfo().name(),
target.second().toString()));
}
serviceProvider.addServiceDeployment(ServiceDeployment.builder()
.template(template)
.excludes(parsedExcludes)
.includes(parsedIncludes)
.withDefaultExclusions()
.build());
serviceProvider.removeAndExecuteDeployments();
source.sendMessage(I18n.trans("command-service-copy-success", service.serviceId().name(), template));
}

@Command("service|ser <name> delete|del")
Expand Down
2 changes: 1 addition & 1 deletion node/src/main/resources/lang/de_DE.properties
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ command-cluster-start-sync=Die Cluster Synchronisation wird gestartet
# Command Service
#
command-service-description=Verwaltet alle Services in dem Cluster
command-service-copy-no-default-template=Der von Dir angegebene Service hat keine default Template. Benutze "copy {0$name$} template\=storage\:prefix/name" um ein Template anzugeben, in das du kopieren möchtest
command-service-copy-no-default-template=Der angegebene Service hat kein default Template. Um ein Template anzugeben kann "service {0$name$} copy --template storage\:prefix/name" verwendet werden
command-service-copy-success=Der Service {0$name$} wurde erfolgreich in das Template {1$template$} kopiert
command-service-add-deployment-success=Das Deployment {0$deployment$} wurde erfolgreich zu der Warteschlange hinzugefügt
command-service-deploy-deployment-success=Die Ressourcen des Services wurden erfolgreich deployed
Expand Down
2 changes: 1 addition & 1 deletion node/src/main/resources/lang/en_US.properties
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ command-cluster-start-sync=The cluster sync starts now
# Command Service
#
command-service-description=Manages all services in the cluster
command-service-copy-no-default-template=The service you provided does not have a default template, use "copy {0$name$} template=storage:prefix/name" to provide a template you would like to copy to
command-service-copy-no-default-template=The provided service does not have a default template. To specify a template "service {0$name$} copy --template storage:prefix/name" can be used
command-service-copy-success=The service {0$name$} was successfully copied to the template {1$template$}
command-service-add-deployment-success=The deployment {0$deployment$} was successfully added to the waiting deployments
command-service-deploy-deployment-success=The resources of the service were successfully deployed
Expand Down

0 comments on commit 1c2a16c

Please sign in to comment.