mirror of
https://github.com/PaperMC/Paper.git
synced 2025-08-17 13:24:17 -07:00
1.21.6 dev
Co-authored-by: Bjarne Koll <git@lynxplay.dev> Co-authored-by: Jake Potrebic <jake.m.potrebic@gmail.com> Co-authored-by: Jason Penilla <11360596+jpenilla@users.noreply.github.com> Co-authored-by: Lulu13022002 <41980282+Lulu13022002@users.noreply.github.com> Co-authored-by: Noah van der Aa <ndvdaa@gmail.com> Co-authored-by: Owen1212055 <23108066+Owen1212055@users.noreply.github.com> Co-authored-by: Spottedleaf <Spottedleaf@users.noreply.github.com>
This commit is contained in:
committed by
Nassim Jahnke
parent
39203a65e0
commit
a24f9b204c
@@ -5,7 +5,10 @@ dependencies {
|
||||
}
|
||||
|
||||
tasks.processResources {
|
||||
val apiVersion = rootProject.providers.gradleProperty("mcVersion").get()
|
||||
var apiVersion = rootProject.providers.gradleProperty("mcVersion").get()
|
||||
// Bukkit api versioning does not support suffixed versions
|
||||
apiVersion = apiVersion.substringBefore('-')
|
||||
|
||||
val props = mapOf(
|
||||
"version" to project.version,
|
||||
"apiversion" to "\"$apiVersion\"",
|
||||
|
@@ -8,7 +8,6 @@ import io.papermc.paper.command.brigadier.argument.ArgumentTypes;
|
||||
import io.papermc.paper.command.brigadier.argument.RegistryArgumentExtractor;
|
||||
import io.papermc.paper.command.brigadier.argument.range.DoubleRangeProvider;
|
||||
import io.papermc.paper.command.brigadier.argument.resolvers.FinePositionResolver;
|
||||
import io.papermc.paper.math.FinePosition;
|
||||
import io.papermc.paper.plugin.bootstrap.BootstrapContext;
|
||||
import io.papermc.paper.plugin.lifecycle.event.LifecycleEventManager;
|
||||
import io.papermc.paper.plugin.lifecycle.event.types.LifecycleEvents;
|
||||
|
@@ -8,11 +8,9 @@ import io.papermc.paper.command.brigadier.argument.ArgumentTypes;
|
||||
import io.papermc.paper.command.brigadier.argument.resolvers.BlockPositionResolver;
|
||||
import io.papermc.paper.command.brigadier.argument.resolvers.selector.PlayerSelectorArgumentResolver;
|
||||
import io.papermc.paper.math.BlockPosition;
|
||||
import io.papermc.testplugin.TestPlugin;
|
||||
import net.kyori.adventure.chat.ChatType;
|
||||
import net.kyori.adventure.text.Component;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.block.BlockState;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandSender;
|
||||
@@ -109,9 +107,8 @@ public class ExampleAdminCommand {
|
||||
BlockState state = context.getArgument("block", BlockState.class);
|
||||
|
||||
// TODO: better block state api here? :thinking:
|
||||
Block block = context.getSource().getLocation().getWorld().getBlockAt(position.blockX(), position.blockY(), position.blockZ());
|
||||
block.setType(state.getType());
|
||||
block.setBlockData(state.getBlockData());
|
||||
state.copy(position.toLocation(context.getSource().getLocation().getWorld()))
|
||||
.update(true);
|
||||
|
||||
return 1;
|
||||
})
|
||||
|
@@ -1,11 +1,9 @@
|
||||
package io.papermc.testplugin.brigtests.example;
|
||||
|
||||
import com.mojang.brigadier.Message;
|
||||
import com.mojang.brigadier.arguments.ArgumentType;
|
||||
import com.mojang.brigadier.arguments.StringArgumentType;
|
||||
import com.mojang.brigadier.context.CommandContext;
|
||||
import com.mojang.brigadier.exceptions.CommandSyntaxException;
|
||||
import com.mojang.brigadier.exceptions.SimpleCommandExceptionType;
|
||||
import com.mojang.brigadier.suggestion.Suggestions;
|
||||
import com.mojang.brigadier.suggestion.SuggestionsBuilder;
|
||||
import io.papermc.paper.command.brigadier.MessageComponentSerializer;
|
||||
@@ -22,10 +20,8 @@ public class IceCreamTypeArgument implements CustomArgumentType.Converted<IceCre
|
||||
public @NotNull IceCreamType convert(String nativeType) throws CommandSyntaxException {
|
||||
try {
|
||||
return IceCreamType.valueOf(nativeType.toUpperCase());
|
||||
} catch (Exception e) {
|
||||
Message message = MessageComponentSerializer.message().serialize(Component.text("Invalid species %s!".formatted(nativeType), NamedTextColor.RED));
|
||||
|
||||
throw new CommandSyntaxException(new SimpleCommandExceptionType(message), message);
|
||||
} catch (IllegalArgumentException ignored) {
|
||||
throw new ComponentCommandExceptionType(Component.text("Invalid species %s!".formatted(nativeType), NamedTextColor.RED)).create();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -40,8 +36,6 @@ public class IceCreamTypeArgument implements CustomArgumentType.Converted<IceCre
|
||||
builder.suggest(species.name(), MessageComponentSerializer.message().serialize(Component.text("COOL! TOOLTIP!", NamedTextColor.GREEN)));
|
||||
}
|
||||
|
||||
return CompletableFuture.completedFuture(
|
||||
builder.build()
|
||||
);
|
||||
return builder.buildFuture();
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user