Added text to show teh fray amoutn when fray is added through command, yay!
This commit is contained in:
parent
ccb85e5060
commit
198b214d56
1 changed files with 9 additions and 3 deletions
|
@ -4,14 +4,19 @@ import com.mojang.brigadier.Command;
|
|||
import com.mojang.brigadier.CommandDispatcher;
|
||||
import com.mojang.brigadier.arguments.FloatArgumentType;
|
||||
import com.mojang.brigadier.arguments.IntegerArgumentType;
|
||||
import net.minecraft.command.argument.ColorArgumentType;
|
||||
import net.minecraft.command.argument.DimensionArgumentType;
|
||||
import net.minecraft.command.argument.Vec3ArgumentType;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.network.MessageType;
|
||||
import net.minecraft.server.command.CommandManager;
|
||||
import net.minecraft.server.command.ServerCommandSource;
|
||||
import net.minecraft.server.network.ServerPlayerEntity;
|
||||
import net.minecraft.server.world.ServerWorld;
|
||||
import net.minecraft.text.LiteralText;
|
||||
import net.minecraft.text.Text;
|
||||
import net.minecraft.util.Formatting;
|
||||
import net.minecraft.util.math.EulerAngle;
|
||||
import net.minecraft.util.math.Vec3d;
|
||||
import org.dimdev.dimdoors.api.util.TeleportUtil;
|
||||
|
@ -25,14 +30,15 @@ public class FrayCommand {
|
|||
.argument("amount", IntegerArgumentType.integer())
|
||||
.executes(ctx -> {
|
||||
ServerPlayerEntity player = ctx.getSource().getPlayer();
|
||||
|
||||
return addFray(player, IntegerArgumentType.getInteger(ctx, "amount"));
|
||||
return addFray(ctx.getSource(), Formatting.ITALIC, player, IntegerArgumentType.getInteger(ctx, "amount"));
|
||||
})
|
||||
)
|
||||
);
|
||||
}
|
||||
private static int addFray(PlayerEntity player, int amount) {
|
||||
private static int addFray(ServerCommandSource source, Formatting formatting, PlayerEntity player, int amount) {
|
||||
PlayerModifiersComponent.incrementFray(player, amount);
|
||||
final Text text = new LiteralText("added : " + amount + " player now has : " + PlayerModifiersComponent.getFray(player)).formatted(formatting);
|
||||
source.getMinecraftServer().getPlayerManager().broadcastChatMessage(text, MessageType.CHAT, player.getUuid());
|
||||
return Command.SINGLE_SUCCESS;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue