8000 Release/10.0.1 by JorelAli · Pull Request #646 · CommandAPI/CommandAPI · GitHub
[go: up one dir, main page]

Skip to content

Release/10.0.1 #646

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 23 commits into from
May 6, 2025
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
87d2cca
Also remove commands from the Brigadier dispatcher on Paper
DerEchtePilz Apr 11, 2025
532c58a
Set version to 10.0.1-SNAPSHOT
DerEchtePilz Apr 11, 2025
a20b8c3
Merge branch 'master' into dev/dev
DerEchtePilz Apr 11, 2025
ff2ad03
Properly fix what I already fixed in 87d2cca1fc9149bc76f5b93b8a0081ef…
DerEchtePilz Apr 11, 2025
637a1f2
Revert unnecessary changes from yesterday and add changelog entry
DerEchtePilz Apr 12, 2025
dbc6e70
Fix error logging for when the mappings are wrong
willkroboth Apr 13, 2025
ef4e0f9
Update to latest MockBukkit in `commandapi-bukkit-test-toolkit`
willkroboth Apr 20, 2025
99cf995
Clean up NMS_Common to make it compile for all supported versions
DerEchtePilz Apr 17, 2025
485ba88
Use 1.21.3 dependency
DerEchtePilz Apr 17, 2025
49503a7
Use more GH Actions steps to fail the build when it isn't compatible …
DerEchtePilz Apr 17, 2025
4edc5b6
Use --quiet flag in the script
DerEchtePilz Apr 17, 2025
a29c068
Remove unused method
DerEchtePilz Apr 17, 2025
cd038b4
Remove NMS_CommonWithFunctions_XXX classes
8000 DerEchtePilz Apr 17, 2025
75ad0e1
Make sure specialsource uses the correct version
DerEchtePilz Apr 17, 2025
dc1b999
Move methods out and into NMS_Common when possible
DerEchtePilz Apr 18, 2025
a41e73a
Make compileNMSCommon.sh more compact
DerEchtePilz Apr 18, 2025
6e003bc
There's no need to have this static
DerEchtePilz Apr 18, 2025
9fc9081
Merge pull request #641 from CommandAPI/fix/make-nms-common-actually-…
DerEchtePilz Apr 22, 2025
ba35fd4
Integrate BytecodeAnalyser into the GitHub Actions build (#643)
DerEchtePilz Apr 23, 2025
4cb1d79
Fix command registration being broken on the (current) latest Paper b…
DerEchtePilz May 6, 2025
47e8ba8
Update 10.0.1 release date
DerEchtePilz May 6, 2025
df77c23
Ignore requirements for `null` sender
willkroboth May 5, 2025
5a3434a
Set version to 10.0.1
JorelAli May 6, 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
Prev Previous commit
Next Next commit
Move methods out and into NMS_Common when possible
  • Loading branch information
DerEchtePilz committed Apr 22, 2025
commit dc1b999b8ca271396db90f53bde452331994ece6
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@
import dev.jorel.commandapi.wrappers.Location2D;
import dev.jorel.commandapi.wrappers.NativeProxyCommandSender;
import dev.jorel.commandapi.wrappers.ParticleData;
import dev.jorel.commandapi.wrappers.Rotation;
import dev.jorel.commandapi.wrappers.ScoreboardSlot;
import dev.jorel.commandapi.wrappers.SimpleFunctionWrapper;
import net.kyori.adventure.text.Component;
Expand All @@ -69,16 +70,19 @@
import net.minecraft.commands.arguments.DimensionArgument;
import net.minecraft.commands.arguments.EntityArgument;
import net.minecraft.commands.arguments.MessageArgument;
import net.minecraft.commands.arguments.ObjectiveArgument;
import net.minecraft.commands.arguments.ParticleArgument;
import net.minecraft.commands.arguments.RangeArgument;
import net.minecraft.commands.arguments.ResourceArgument;
import net.minecraft.commands.arguments.ResourceLocationArgument;
import net.minecraft.commands.arguments.ScoreHolderArgument;
import net.minecraft.commands.arguments.ScoreboardSlotArgument;
import net.minecraft.commands.arguments.TeamArgument;
import net.minecraft.commands.arguments.blocks.BlockPredicateArgument;
import net.minecraft.commands.arguments.blocks.BlockStateArgument;
import net.minecraft.commands.arguments.coordinates.BlockPosArgument;
import net.minecraft.commands.arguments.coordinates.ColumnPosArgument;
import net.minecraft.commands.arguments.coordinates.RotationArgument;
import net.minecraft.commands.arguments.coordinates.Vec2Argument;
import net.minecraft.commands.arguments.coordinates.Vec3Argument;
import net.minecraft.commands.arguments.item.FunctionArgument;
Expand Down Expand Up @@ -163,6 +167,8 @@
import org.bukkit.entity.Player;
import org.bukkit.help.HelpTopic;
import org.bukkit.inventory.Recipe;
import org.bukkit.scoreboard.Objective;
import org.bukkit.scoreboard.Team;

import java.io.File;
import java.io.IOException;
Expand Down Expand Up @@ -218,25 +224,16 @@ public class NMS_1_20_R2 extends NMS_Common {
serverFunctionLibraryDispatcher = CommandAPIHandler.getField(ServerFunctionLibrary.class, "g", "dispatcher");
}

private static NamespacedKey fromResourceLocation(ResourceLocation key) {
return NamespacedKey.fromString(key.getNamespace() + ":" + key.getPath());
@Override
protected CommandBuildContext getCommandBuildContext() {
return COMMAND_BUILD_CONTEXT;
}

@Override
public ArgumentType<?> _ArgumentAdvancement() {
return ResourceLocationArgument.id();
}

@Override
public final ArgumentType<?> _ArgumentBlockPredicate() {
return BlockPredicateArgument.blockPredicate(COMMAND_BUILD_CONTEXT);
}

@Override
public final ArgumentType<?> _ArgumentBlockState() {
return BlockStateArgument.block(COMMAND_BUILD_CONTEXT);
}

@Override
public ArgumentType<?> _ArgumentChatComponent() {
return ComponentArgument.textComponent();
Expand All @@ -247,32 +244,6 @@ public final ArgumentType<?> _ArgumentEnchantment() {
return ResourceArgument.resource(COMMAND_BUILD_CONTEXT, Registries.ENCHANTMENT);
}

@Override
public final ArgumentType<?> _ArgumentEntity(ArgumentSubType subType) {
return switch (subType) {
case ENTITYSELECTOR_MANY_ENTITIES -> EntityArgument.entities();
case ENTITYSELECTOR_MANY_PLAYERS -> EntityArgument.players();
case ENTITYSELECTOR_ONE_ENTITY -> EntityArgument.entity();
case ENTITYSELECTOR_ONE_PLAYER -> EntityArgument.player();
default -> throw new IllegalArgumentException("Unexpected value: " + subType);
};
}

@Override
public final ArgumentType<?> _ArgumentItemPredicate() {
return ItemPredicateArgument.itemPredicate(COMMAND_BUILD_CONTEXT);
}

@Override
public final ArgumentType<?> _ArgumentItemStack() {
return ItemArgument.item(COMMAND_BUILD_CONTEXT);
}

@Override
public final ArgumentType<?> _ArgumentParticle() {
return ParticleArgument.particle(COMMAND_BUILD_CONTEXT);
}

@Override
public ArgumentType<?> _ArgumentRecipe() {
return ResourceLocationArgument.id();
Expand Down Expand Up @@ -315,12 +286,6 @@ private SimpleFunctionWrapper convertFunction(CommandFunction commandFunction) {
return new SimpleFunctionWrapper(fromResourceLocation(commandFunction.getId()), appliedObj, result);
}

@Override
public final void createDispatcherFile(File file, CommandDispatcher<CommandSourceStack> dispatcher) throws IOException {
Files.asCharSink(file, StandardCharsets.UTF_8).write(new GsonBuilder().setPrettyPrinting().create()
.toJson(ArgumentUtils.serializeNodeToJson(dispatcher, dispatcher.getRoot())));
}

@Override
public final HelpTopic generateHelpTopic(String commandName, String shortDescription, String fullDescription, String permission) {
return new CustomHelpTopic(commandName, shortDescription, fullDescription, permission);
Expand Down Expand Up @@ -365,13 +330,6 @@ public final Object getBiome(CommandContext<CommandSourceStack> cmdCtx, String k
};
}

@Override
public final Predicate<Block> getBlockPredicate(CommandContext<CommandSourceStack> cmdCtx, String key) throws CommandSyntaxException {
Predicate<BlockInWorld> predicate = BlockPredicateArgument.getBlockPredicate(cmdCtx, key);
return (Block block) -> predicate.test(new BlockInWorld(cmdCtx.getSource().getLevel(),
new BlockPos(block.getX(), block.getY(), block.getZ()), true));
}

@Override
public final BlockData getBlockState(CommandContext<CommandSourceStack> cmdCtx, String key) {
return CraftBlockData.fromData(BlockStateArgument.getBlock(cmdCtx, key).getState());
Expand Down Expand Up @@ -458,12 +416,6 @@ public final Object getEntitySelector(CommandContext<CommandSourceStack> cmdCtx,
};
}

@SuppressWarnings("deprecation")
@Override
public final EntityType getEntityType(CommandContext<CommandSourceStack> cmdCtx, String key) throws CommandSyntaxException {
return EntityType.fromName(net.minecraft.world.entity.EntityType.getKey(ResourceArgument.getSummonableEntityType(cmdCtx, key).value()).getPath());
}

@Override
public FloatRange getFloatRange(CommandContext<CommandSourceStack> cmdCtx, String key) {
MinMaxBounds.Doubles range = RangeArgument.Floats.getRange(cmdCtx, key);
Expand Down Expand Up @@ -546,30 +498,12 @@ public final Predicate<org.bukkit.inventory.ItemStack> getItemStackPredicate(Com
return item -> predicate.test(CraftItemStack.asNMSCopy(item));
}

@Override
public final Location2D getLocation2DBlock(CommandContext<CommandSourceStack> cmdCtx, String key) throws CommandSyntaxException {
ColumnPos blockPos = ColumnPosArgument.getColumnPos(cmdCtx, key);
return new Location2D(getWorldForCSS(cmdCtx.getSource()), blockPos.x(), blockPos.z());
}

@Override
public final Location2D getLocation2DPrecise(CommandContext<CommandSourceStack> cmdCtx, String key) throws CommandSyntaxException {
Vec2 vecPos = Vec2Argument.getVec2(cmdCtx, key);
return new Location2D(getWorldForCSS(cmdCtx.getSource()), vecPos.x, vecPos.y);
}

@Override
public final Location getLocationBlock(CommandContext<CommandSourceStack> cmdCtx, String key) throws CommandSyntaxException {
BlockPos blockPos = BlockPosArgument.getSpawnablePos(cmdCtx, key);
return new Location(getWorldForCSS(cmdCtx.getSource()), blockPos.getX(), blockPos.getY(), blockPos.getZ());
}

@Override
public final Location getLocationPrecise(CommandContext<CommandSourceStack> cmdCtx, String key) throws CommandSyntaxException {
Vec3 vecPos = Vec3Argument.getCoordinates(cmdCtx, key).getPosition(cmdCtx.getSource());
return new Location(getWorldForCSS(cmdCtx.getSource()), vecPos.x(), vecPos.y(), vecPos.z());
}

@Override
public final org.bukkit.loot.LootTable getLootTable(CommandContext<CommandSourceStack> cmdCtx, String key) {
ResourceLocation resourceLocation = ResourceLocationArgument.getId(cmdCtx, key);
Expand All @@ -581,6 +515,12 @@ public NamespacedKey getMinecraftKey(CommandContext<CommandSourceStack> cmdCtx,
return fromResourceLocation(ResourceLocationArgument.getId(cmdCtx, key));
}

@Override
public final Objective getObjective(CommandContext<CommandSourceStack> cmdCtx, String key) throws CommandSyntaxException {
String objectiveName = ObjectiveArgument.getObjective(cmdCtx, key).getName();
return Bukkit.getScoreboardManager().getMainScoreboard().getObjective(objectiveName);
}

@Differs(from = "1.20.1", by = "Uses CraftParticle#minecraftToBukkit instead of CraftParticle#toBukkit")
@Override
public final ParticleData<?> getParticle(CommandContext<CommandSourceStack> cmdCtx, String key) {
Expand Down Expand Up @@ -665,6 +605,12 @@ public final Recipe getRecipe(CommandContext<CommandSourceStack> cmdCtx, String
return new ComplexRecipeImpl(fromResourceLocation(recipe.id()), recipe.toBukkitRecipe());
}

@Override
public final Rotation getRotation(CommandContext<CommandSourceStack> cmdCtx, String key) {
Vec2 rotation = RotationArgument.getRotation(cmdCtx, key).getRotation(cmdCtx.getSource());
return new Rotation(rotation.y, rotation.x);
}

@Override
public ScoreboardSlot getScoreboardSlot(CommandContext<CommandSourceStack> cmdCtx, String key) {
return ScoreboardSlot.ofMinecraft(ScoreboardSlotArgument.getDisplaySlot(cmdCtx, key).id());
Expand Down Expand Up @@ -805,6 +751,12 @@ public Set<NamespacedKey> getTags() {
return result;
}

@Override
public final Team getTeam(CommandContext<CommandSourceStack> cmdCtx, String key) throws CommandSyntaxException {
String teamName = TeamArgument.getTeam(cmdCtx, key).getName();
return Bukkit.getScoreboardManager().getMainScoreboard().getTeam(teamName);
}

@Override
public World getWorldForCSS(CommandSourceStack css) {
return (css.getLevel() == null) ? null : css.getLevel().getWorld();
Expand Down
Loading
0