use of net.minecraft.server.command.ServerCommandSource in project LuckPerms by lucko.
the class PermissionCheckListener method onOtherPermissionCheck.
private TriState onOtherPermissionCheck(CommandSource source, String permission) {
if (source instanceof ServerCommandSource) {
String name = ((ServerCommandSource) source).getName();
VerboseCheckTarget target = VerboseCheckTarget.internal(name);
this.plugin.getVerboseHandler().offerPermissionCheckEvent(CheckOrigin.PLATFORM_API_HAS_PERMISSION, target, QueryOptionsImpl.DEFAULT_CONTEXTUAL, permission, TristateResult.UNDEFINED);
this.plugin.getPermissionRegistry().offer(permission);
}
return TriState.DEFAULT;
}
use of net.minecraft.server.command.ServerCommandSource in project quilt-standard-libraries by QuiltMC.
the class NetworkingChannelTest method infoCommand.
private static int infoCommand(CommandContext<ServerCommandSource> context, ServerPlayerEntity player) {
ServerCommandSource source = context.getSource();
Set<Identifier> channels = ServerPlayNetworking.getSendable(player);
source.sendFeedback(new LiteralText(String.format("Available channels for player %s", player.getEntityName())), false);
for (Identifier channel : channels) {
source.sendFeedback(new LiteralText(channel.toString()), false);
}
return 1;
}
use of net.minecraft.server.command.ServerCommandSource in project pingspam by BasiqueEvangelist.
the class PingSoundCommand method removePingSound.
private static int removePingSound(CommandContext<ServerCommandSource> ctx) throws CommandSyntaxException {
ServerCommandSource src = ctx.getSource();
ServerPlayerEntity player = src.getPlayer();
PlayerUtils.setPingSound(player, null);
src.sendFeedback(new LiteralText("Disabled ping sound.").formatted(Formatting.GREEN), false);
return 0;
}
use of net.minecraft.server.command.ServerCommandSource in project pingspam by BasiqueEvangelist.
the class PingSoundCommand method setPingSound.
private static int setPingSound(CommandContext<ServerCommandSource> ctx) throws CommandSyntaxException {
ServerCommandSource src = ctx.getSource();
ServerPlayerEntity player = src.getPlayer();
Identifier soundId = IdentifierArgumentType.getIdentifier(ctx, "sound");
SoundEvent event = Registry.SOUND_EVENT.getOrEmpty(soundId).orElseThrow(INVALID_SOUND::create);
PlayerUtils.setPingSound(player, event);
src.sendFeedback(new LiteralText("Set ping sound to ").formatted(Formatting.GREEN).append(new LiteralText(((SoundEventAccessor) PlayerUtils.getPingSound(player)).pingspam$getId().toString()).formatted(Formatting.YELLOW)).append(new LiteralText(".")), false);
return 0;
}
use of net.minecraft.server.command.ServerCommandSource in project pingspam by BasiqueEvangelist.
the class PingSoundCommand method getPingSound.
private static int getPingSound(CommandContext<ServerCommandSource> ctx) throws CommandSyntaxException {
ServerCommandSource src = ctx.getSource();
ServerPlayerEntity player = src.getPlayer();
if (PlayerUtils.getPingSound(player) != null) {
src.sendFeedback(new LiteralText("Your current ping sound is ").formatted(Formatting.GREEN).append(new LiteralText(((SoundEventAccessor) PlayerUtils.getPingSound(player)).pingspam$getId().toString()).formatted(Formatting.YELLOW)).append(new LiteralText(".")), false);
} else {
src.sendFeedback(new LiteralText("You have disabled ping sounds.").formatted(Formatting.GREEN), false);
}
return 0;
}
Aggregations