use of me.basiqueevangelist.pingspam.mixin.SoundEventAccessor 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 me.basiqueevangelist.pingspam.mixin.SoundEventAccessor 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