Skip to content
Open
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
9 changes: 5 additions & 4 deletions gradle.properties
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
group=com.legitimoose.legitslimepaper
version=1.21.10-R0.1-SNAPSHOT
mcVersion=1.21.10
version=1.21.11-R0.1-SNAPSHOT
mcVersion=1.21.11

#Update with ASP!! (also update gradle/libs.versions.toml)
aspRef=cd28d91fa92818b296ad914b584f9aae911e4045
apiVersion=4.2.0-SNAPSHOT
aspRef=89f6dc94bd9db7c7195b5421f69d554a73e11b65
apiVersion=1.21.11
aspApiVersion=4.2.0-SNAPSHOT

org.gradle.caching=true
org.gradle.parallel=true
Expand Down
4 changes: 2 additions & 2 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ autoservice = "1.1.1"
blossom = "2.1.0"
bstats = "3.1.0"
cloud-core = "2.0.0"
cloud-minecraft = "2.0.0-beta.10"
cloud-minecraft = "2.0.0-beta.14"
configurate = "4.1.2"
indra-git = "3.1.3"
gradle-profiles = "0.54.0"
Expand All @@ -15,7 +15,7 @@ lettuce = "6.5.1.RELEASE"
lombok = "1.18.36"
lombok-plugin = "8.11"
mongo = "5.2.1"
paperweight = "2.0.0-beta.18"
paperweight = "2.0.0-beta.19"
plugin-yml-paper = "0.6.0"
shadow = "9.2.2"
slf4j = "2.0.16"
Expand Down
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.14.1-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-9.2.0-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
Expand Down
2 changes: 1 addition & 1 deletion legitslimepaper-api/build.gradle.kts.patch
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
--- a/aspaper-api/build.gradle.kts
+++ b/aspaper-api/build.gradle.kts
@@ -101,17 +_,21 @@
@@ -103,17 +_,21 @@
java {
srcDir(generatedDir)
srcDir(file("../paper-api/src/main/java"))
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
--- a/src/main/java/com/infernalsuite/asp/SlimeNMSBridgeImpl.java
+++ b/src/main/java/com/infernalsuite/asp/SlimeNMSBridgeImpl.java
@@ -79,8 +_,10 @@
@@ -80,8 +_,10 @@
// Some stuff is needed when loading overworld world
SlimeLevelInstance instance = ((SlimeInMemoryWorld) this.loadInstance(defaultWorld, Level.OVERWORLD)).getInstance();
DimensionDataStorage worldpersistentdata = instance.getDataStorage();
+ instance.getServer().readScoreboard(worldpersistentdata); // Moose
+ instance.getServer().getScoreboard().load(worldpersistentdata.computeIfAbsent(net.minecraft.world.scores.ScoreboardSaveData.TYPE).getData()); // Moose
instance.getCraftServer().scoreboardManager = new org.bukkit.craftbukkit.scoreboard.CraftScoreboardManager(instance.getServer(), instance.getScoreboard());
instance.getServer().commandStorage = new CommandStorage(worldpersistentdata);
+ instance.getServer().worldData = instance.serverLevelData; // Moose - Set default spawn location correctly (and prob more)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
--- a/src/main/java/com/infernalsuite/asp/level/SlimeLevelInstance.java
+++ b/src/main/java/com/infernalsuite/asp/level/SlimeLevelInstance.java
@@ -68,16 +_,10 @@
public static LevelStorageSource CUSTOM_LEVEL_STORAGE;
@@ -73,16 +_,10 @@
private static final Logger LOGGER = LogUtils.getClassLogger();

static {
- try {
Expand All @@ -21,7 +21,7 @@
}

private static final ExecutorService WORLD_SAVER_SERVICE = Executors.newFixedThreadPool(4, new ThreadFactoryBuilder()
@@ -91,7 +_,7 @@
@@ -96,7 +_,7 @@
org.bukkit.World.Environment environment) throws IOException {

super(slimeBootstrap, MinecraftServer.getServer(), MinecraftServer.getServer().executor,
Expand All @@ -30,7 +30,7 @@
primaryLevelData, worldKey, worldDimension, false, 0,
Collections.emptyList(), true, null, environment, null, null);
this.slimeInstance = new SlimeInMemoryWorld(slimeBootstrap, this);
@@ -169,6 +_,7 @@
@@ -175,6 +_,7 @@
Bukkit.getPluginManager().callEvent(new WorldSaveEvent(getWorld()));

//this.getChunkSource().save(forceSave);
Expand Down
10 changes: 5 additions & 5 deletions legitslimepaper-server/build.gradle.kts.patch
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
--- a/aspaper-server/build.gradle.kts
+++ b/aspaper-server/build.gradle.kts
@@ -32,7 +_,22 @@
@@ -31,8 +_,22 @@
}
}

Expand All @@ -19,11 +19,11 @@
+ outputDir = rootDirectory.dir("aspaper-server")
+ }
+ }
+
+ activeFork = legitslimepaper

+ activeFork = legitslimepaper
spigot {
enabled = true
buildDataRef = "17f77cee7117ab9d6175f088ae8962bfd04e61a9"
@@ -119,10 +_,14 @@
main {
java { srcDir("../paper-server/src/main/java") }
Expand All @@ -46,9 +46,9 @@
- implementation(project(":aspaper-api")) //ASP
+ implementation(project(":legitslimepaper-api")) //ASP + Moose
implementation(project(":core")) //ASP
implementation("ca.spottedleaf:concurrentutil:0.0.7")
implementation("ca.spottedleaf:concurrentutil:0.0.8")
implementation("org.jline:jline-terminal-ffm:3.27.1") // use ffm on java 22+
@@ -221,14 +_,14 @@
@@ -222,14 +_,14 @@
val gitBranch = git.exec(providers, "rev-parse", "--abbrev-ref", "HEAD").get().trim()
attributes(
"Main-Class" to "org.bukkit.craftbukkit.Main",
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
--- a/ca/spottedleaf/moonrise/patches/chunk_system/level/entity/ChunkEntitySlices.java
+++ b/ca/spottedleaf/moonrise/patches/chunk_system/level/entity/ChunkEntitySlices.java
@@ -545,6 +_,8 @@
if (entity == null || entity == except || !entity.getBoundingBox().intersects(box)) {
continue;
}
+ if (except instanceof net.minecraft.server.level.ServerPlayer player && !player.getBukkitEntity().canSee(entity.getBukkitEntity())) // Moose - Disable collisions for hidden entities
+ continue;

if (predicate != null && !predicate.test(entity)) {
continue;
Original file line number Diff line number Diff line change
Expand Up @@ -20,31 +20,23 @@
import java.util.function.Consumer;
import java.util.function.Predicate;
import java.util.function.UnaryOperator;
@@ -40,7 +_,6 @@
@@ -38,7 +_,6 @@
import net.minecraft.network.chat.ClickEvent;
import net.minecraft.network.chat.CommonComponents;
import net.minecraft.network.chat.Component;
-import net.minecraft.network.chat.ComponentUtils;
import net.minecraft.network.chat.HoverEvent;
import net.minecraft.network.chat.MutableComponent;
import net.minecraft.network.protocol.game.ClientboundCommandsPacket;
@@ -145,6 +_,7 @@
import net.minecraft.util.profiling.jfr.JvmProfiler;
import net.minecraft.world.flag.FeatureFlagSet;
import net.minecraft.world.flag.FeatureFlags;
+import net.minecraft.world.level.BaseCommandBlock;
import net.minecraft.world.level.GameRules;
import org.slf4j.Logger;

@@ -177,6 +_,7 @@
@@ -186,6 +_,7 @@
}
};
private final CommandDispatcher<CommandSourceStack> dispatcher = new CommandDispatcher<>();
+ public static CommandDispatcher<CommandSourceStack> vanillaCommands = new CommandDispatcher<>(); // Moose

public Commands(Commands.CommandSelection selection, CommandBuildContext context) {
// Paper start - Brigadier API - modern minecraft overloads that do not use redirects but are copies instead
@@ -293,6 +_,25 @@
@@ -303,6 +_,25 @@
PublishCommand.register(this.dispatcher);
}

Expand All @@ -70,12 +62,12 @@
// Paper start - Vanilla command permission fixes
for (final CommandNode<CommandSourceStack> node : this.dispatcher.getRoot().getChildren()) {
if (node.getRequirement() == com.mojang.brigadier.builder.ArgumentBuilder.<CommandSourceStack>defaultRequirement()) {
@@ -360,6 +_,15 @@
@@ -370,6 +_,15 @@
ContextChain<CommandSourceStack> contextChain = finishParsing(parseResults, command, commandSourceStack);

try {
+ // Moose start - Command block whitelist
+ if (parseResults.getContext().getSource().source instanceof BaseCommandBlock.CloseableCommandBlockSource) {
+ if (parseResults.getContext().getSource().source instanceof net.minecraft.world.level.BaseCommandBlock.CloseableCommandBlockSource) {
+ List<ParsedCommandNode<CommandSourceStack>> context = parseResults.getContext().getNodes();
+ if (!context.isEmpty() && !context.getFirst().getNode().commandBlockAllowed) {
+ throw new Exception("Non-vanilla commands cannot be executed in command blocks.");
Expand All @@ -86,7 +78,7 @@
if (contextChain != null) {
executeCommandInContext(
commandSourceStack,
@@ -370,7 +_,7 @@
@@ -380,7 +_,7 @@
}
// Paper start
} catch (Throwable var12) { // always gracefully handle it, no matter how bad:tm:
Expand All @@ -95,12 +87,12 @@
// Paper end
MutableComponent mutableComponent = Component.literal(var12.getMessage() == null ? var12.getClass().getName() : var12.getMessage());
LOGGER.error("Command exception: /{}", command, var12); // Paper - always show execution exception in console log
@@ -507,6 +_,20 @@
@@ -518,6 +_,20 @@
runSync(player, bukkit, rootCommandNode);
});
}
+ // Moose start - Make sure non-vanilla commands are restricted
+ static class SpecialPermissionCheck implements Predicate<CommandSourceStack>, PermissionSource.RestrictedMarker {
+ static class SpecialPermissionCheck implements Predicate<CommandSourceStack>, RestrictedMarker {
+ private final Predicate<CommandSourceStack> originalRequirement;
+
+ public SpecialPermissionCheck(Predicate<CommandSourceStack> originalRequirement) {
Expand All @@ -116,7 +108,7 @@

private void runSync(ServerPlayer player, java.util.Collection<String> bukkit, RootCommandNode<CommandSourceStack> rootCommandNode) {
// Paper end - Perf: Async command map building
@@ -521,6 +_,15 @@
@@ -532,6 +_,15 @@
}
}
// CraftBukkit end
Expand Down
Original file line number Diff line number Diff line change
@@ -1,18 +1,10 @@
--- a/net/minecraft/commands/functions/MacroFunction.java
+++ b/net/minecraft/commands/functions/MacroFunction.java
@@ -13,6 +_,7 @@
import java.util.Locale;
import javax.annotation.Nullable;
import net.minecraft.Util;
+import net.minecraft.commands.Commands;
import net.minecraft.commands.ExecutionCommandSource;
import net.minecraft.commands.FunctionInstantiationException;
import net.minecraft.commands.execution.UnboundEntryAction;
@@ -51,6 +_,7 @@
@@ -50,6 +_,7 @@

@Override
public InstantiatedFunction<T> instantiate(@Nullable CompoundTag arguments, CommandDispatcher<T> dispatcher) throws FunctionInstantiationException {
+ dispatcher = (CommandDispatcher<T>) Commands.vanillaCommands; // Moose
+ dispatcher = (CommandDispatcher<T>) net.minecraft.commands.Commands.vanillaCommands; // Moose
if (arguments == null) {
throw new FunctionInstantiationException(Component.translatable("commands.function.error.missing_arguments", Component.translationArg(this.id())));
} else {
Original file line number Diff line number Diff line change
@@ -1,14 +1,6 @@
--- a/net/minecraft/network/chat/Style.java
+++ b/net/minecraft/network/chat/Style.java
@@ -7,6 +_,7 @@
import java.util.Optional;
import javax.annotation.Nullable;
import net.minecraft.ChatFormatting;
+import net.minecraft.commands.Commands;
import net.minecraft.network.RegistryFriendlyByteBuf;
import net.minecraft.network.codec.ByteBufCodecs;
import net.minecraft.network.codec.StreamCodec;
@@ -86,7 +_,20 @@
@@ -76,7 +_,20 @@
this.underlined = underlined;
this.strikethrough = strikethrough;
this.obfuscated = obfuscated;
Expand All @@ -21,7 +13,7 @@
+ cmd = cmd.split(" ", 2)[0];
+ String finalCmd = cmd;
+
+ if (Commands.vanillaCommands.getRoot().getChildren().stream().noneMatch((node) -> node.commandBlockAllowed && finalCmd.startsWith(node.getName()))) {
+ if (net.minecraft.commands.Commands.vanillaCommands.getRoot().getChildren().stream().noneMatch((node) -> node.commandBlockAllowed && finalCmd.startsWith(node.getName()))) {
+ blackListedCommand = true;
+ }
+ }
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
--- a/net/minecraft/resources/RegistryDataLoader.java
+++ b/net/minecraft/resources/RegistryDataLoader.java
@@ -193,11 +_,12 @@
map.put(registry.key(), new IllegalStateException("Registry must be non-empty: " + registry.key().location()));
@@ -199,11 +_,12 @@
map.put(registry.key(), new IllegalStateException("Registry must be non-empty: " + registry.key().identifier()));
}
});
+ // Moose start - Don't throw an exception on invalid registry
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,34 +8,7 @@
import com.mojang.datafixers.DataFixer;
import com.mojang.logging.LogUtils;
import com.mojang.serialization.Dynamic;
@@ -16,12 +_,9 @@
import java.util.Optional;
import java.util.function.BooleanSupplier;
import javax.annotation.Nullable;
-import joptsimple.OptionParser;
+
import joptsimple.OptionSet;
-import joptsimple.OptionSpec;
-import joptsimple.util.PathConverter;
import net.minecraft.CrashReport;
-import net.minecraft.DefaultUncaughtExceptionHandler;
import net.minecraft.SharedConstants;
import net.minecraft.SuppressForbidden;
import net.minecraft.Util;
@@ -52,11 +_,7 @@
import net.minecraft.world.level.levelgen.WorldDimensions;
import net.minecraft.world.level.levelgen.WorldOptions;
import net.minecraft.world.level.levelgen.presets.WorldPresets;
-import net.minecraft.world.level.storage.LevelDataAndDimensions;
-import net.minecraft.world.level.storage.LevelStorageSource;
-import net.minecraft.world.level.storage.LevelSummary;
-import net.minecraft.world.level.storage.PrimaryLevelData;
-import net.minecraft.world.level.storage.WorldData;
+import net.minecraft.world.level.storage.*;
import org.slf4j.Logger;

public class Main {
@@ -139,6 +_,8 @@
@@ -137,6 +_,8 @@
return;
}

Expand All @@ -44,7 +17,7 @@
// Spigot start
boolean eulaAgreed = Boolean.getBoolean("com.mojang.eula.agree");
if (eulaAgreed) {
@@ -228,7 +_,7 @@
@@ -226,7 +_,7 @@
LOGGER.warn("Safe mode active, only vanilla datapack will be loaded");
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,19 +1,11 @@
--- a/net/minecraft/server/ServerFunctionLibrary.java
+++ b/net/minecraft/server/ServerFunctionLibrary.java
@@ -17,6 +_,7 @@
import java.util.concurrent.Executor;
import net.minecraft.commands.CommandSource;
import net.minecraft.commands.CommandSourceStack;
+import net.minecraft.commands.Commands;
import net.minecraft.commands.functions.CommandFunction;
import net.minecraft.core.Registry;
import net.minecraft.core.registries.Registries;
@@ -90,7 +_,7 @@
ResourceLocation resourceLocation1 = LISTER.fileToId(resourceLocation);
map1.put(resourceLocation1, CompletableFuture.supplyAsync(() -> {
List<String> lines = readLines(entry.getValue());
- return CommandFunction.fromLines(resourceLocation1, this.dispatcher, commandSourceStack, lines);
+ return CommandFunction.fromLines(resourceLocation1, Commands.vanillaCommands, commandSourceStack, lines);
}, backgroundExecutor));
}
@@ -85,7 +_,7 @@
Identifier identifier1 = LISTER.fileToId(identifier);
map1.put(identifier1, CompletableFuture.supplyAsync(() -> {
List<String> lines = readLines(entry.getValue());
- return CommandFunction.fromLines(identifier1, this.dispatcher, commandSourceStack, lines);
+ return CommandFunction.fromLines(identifier1, Commands.vanillaCommands, commandSourceStack, lines);
}, backgroundExecutor));
}

Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
--- a/net/minecraft/server/commands/ExecuteCommand.java
+++ b/net/minecraft/server/commands/ExecuteCommand.java
@@ -142,7 +_,7 @@
@@ -148,7 +_,7 @@
dispatcher.register(
Commands.literal("execute")
.requires(Commands.hasPermission(2))
.requires(Commands.hasPermission(Commands.LEVEL_GAMEMASTERS))
- .then(Commands.literal("run").redirect(dispatcher.getRoot()))
+ .then(Commands.literal("run").redirect(Commands.vanillaCommands.getRoot())) // Moose - Only run vanilla commands
.then(addConditionals(literalCommandNode, Commands.literal("if"), true, buildContext))
.then(addConditionals(literalCommandNode, Commands.literal("unless"), false, buildContext))
.then(Commands.literal("as").then(Commands.argument("targets", EntityArgument.entities()).fork(literalCommandNode, commandContext -> {
.then(Commands.literal("as").then(Commands.argument("targets", EntityArgument.entities()).fork(literalCommandNode, context -> {
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
public static void register(CommandDispatcher<CommandSourceStack> dispatcher) {
dispatcher.register(
Commands.literal("tick")
- .requires(Commands.hasPermission(3))
+ .requires(Commands.hasPermission(2))
- .requires(Commands.hasPermission(Commands.LEVEL_ADMINS))
+ .requires(Commands.hasPermission(Commands.LEVEL_GAMEMASTERS))
.then(Commands.literal("query").executes(commandContext -> tickQuery(commandContext.getSource())))
.then(
Commands.literal("rate")
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
--- a/net/minecraft/server/level/ServerChunkCache.java
+++ b/net/minecraft/server/level/ServerChunkCache.java
@@ -211,7 +_,7 @@
@@ -209,7 +_,7 @@
}

//ASP start - No dimension data storage
- if(level instanceof com.infernalsuite.asp.level.SlimeLevelInstance) {
+ if(level instanceof com.infernalsuite.asp.level.SlimeLevelInstance && false) { // Moose - Re-enable dat file storage
this.dataStorage = new com.infernalsuite.asp.level.ReadOnlyDimensionDataStorage(new SavedData.Context(level), path, fixerUpper, level.registryAccess());
this.dataStorage = new com.infernalsuite.asp.level.ReadOnlyDimensionDataStorage(path, fixerUpper, level.registryAccess());
} else {
this.dataStorage = new DimensionDataStorage(new SavedData.Context(level), path, fixerUpper, level.registryAccess());
this.dataStorage = new DimensionDataStorage(path, fixerUpper, level.registryAccess());
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
--- a/net/minecraft/server/level/ServerPlayer.java
+++ b/net/minecraft/server/level/ServerPlayer.java
@@ -536,8 +_,8 @@
@@ -526,8 +_,8 @@
}

@Override
Expand Down
Loading