18 lines
		
	
	
	
		
			827 B
		
	
	
	
		
			Java
		
	
	
	
	
	
			
		
		
	
	
			18 lines
		
	
	
	
		
			827 B
		
	
	
	
		
			Java
		
	
	
	
	
	
| package net.minecraft.server.commands;
 | |
| 
 | |
| import com.mojang.brigadier.CommandDispatcher;
 | |
| import net.minecraft.commands.CommandSourceStack;
 | |
| import net.minecraft.commands.Commands;
 | |
| import net.minecraft.network.chat.Component;
 | |
| import net.minecraft.network.chat.ComponentUtils;
 | |
| 
 | |
| public class SeedCommand {
 | |
| 	public static void register(CommandDispatcher<CommandSourceStack> dispatcher, boolean isDedicatedServer) {
 | |
| 		dispatcher.register(Commands.literal("seed").requires(Commands.hasPermission(isDedicatedServer ? 2 : 0)).executes(commandContext -> {
 | |
| 			long l = commandContext.getSource().getLevel().getSeed();
 | |
| 			Component component = ComponentUtils.copyOnClickText(String.valueOf(l));
 | |
| 			commandContext.getSource().sendSuccess(() -> Component.translatable("commands.seed.success", component), false);
 | |
| 			return (int)l;
 | |
| 		}));
 | |
| 	}
 | |
| }
 |