mirror of
https://github.com/Oth3r/Sit.git
synced 2025-09-19 16:03:22 +02:00
reload message to all player with perms when /reload
is ran
This commit is contained in:
parent
363747bd02
commit
58fd5e7cf8
1 changed files with 16 additions and 0 deletions
|
@ -1,9 +1,14 @@
|
||||||
package one.oth3r.sit.mixin;
|
package one.oth3r.sit.mixin;
|
||||||
|
|
||||||
import com.mojang.brigadier.CommandDispatcher;
|
import com.mojang.brigadier.CommandDispatcher;
|
||||||
|
import net.minecraft.server.MinecraftServer;
|
||||||
import net.minecraft.server.command.ReloadCommand;
|
import net.minecraft.server.command.ReloadCommand;
|
||||||
import net.minecraft.server.command.ServerCommandSource;
|
import net.minecraft.server.command.ServerCommandSource;
|
||||||
|
import net.minecraft.server.network.ServerPlayerEntity;
|
||||||
|
import net.minecraft.util.Formatting;
|
||||||
import one.oth3r.sit.file.FileData;
|
import one.oth3r.sit.file.FileData;
|
||||||
|
import one.oth3r.sit.utl.Data;
|
||||||
|
import one.oth3r.sit.utl.Utl;
|
||||||
import org.spongepowered.asm.mixin.Mixin;
|
import org.spongepowered.asm.mixin.Mixin;
|
||||||
import org.spongepowered.asm.mixin.injection.At;
|
import org.spongepowered.asm.mixin.injection.At;
|
||||||
import org.spongepowered.asm.mixin.injection.Inject;
|
import org.spongepowered.asm.mixin.injection.Inject;
|
||||||
|
@ -14,5 +19,16 @@ public class ReloadCommandMixin {
|
||||||
@Inject(at = @At("TAIL"), method = "register")
|
@Inject(at = @At("TAIL"), method = "register")
|
||||||
private static void register(CommandDispatcher<ServerCommandSource> dispatcher, CallbackInfo ci) {
|
private static void register(CommandDispatcher<ServerCommandSource> dispatcher, CallbackInfo ci) {
|
||||||
FileData.loadFiles();
|
FileData.loadFiles();
|
||||||
|
|
||||||
|
// make sure the server isn't null
|
||||||
|
MinecraftServer server = Data.getServer();
|
||||||
|
if (server == null || server.getPlayerManager() == null) return;
|
||||||
|
|
||||||
|
// send a reloaded message to all players with permissions
|
||||||
|
for (ServerPlayerEntity player : server.getPlayerManager().getPlayerList()) {
|
||||||
|
if (player.isCreativeLevelTwoOp()) {
|
||||||
|
player.sendMessage(Utl.messageTag().append(Utl.lang("msg.reloaded").formatted(Formatting.GREEN)));
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue