implement reload

This commit is contained in:
Hiajen Hiajen 2021-06-20 19:04:05 +02:00
parent 1a9a9aea42
commit 00bfe748cc
3 changed files with 34 additions and 0 deletions

View File

@ -26,6 +26,7 @@ public final class EaaMod implements ClientModInitializer {
new TagCommand();
new CheckPlayerCommand();
new CheckLobbyCommand();
new ReloadCommand();
}
}

View File

@ -33,6 +33,7 @@ public class CheckPlayerCommand extends EaaModCommand{
try {
String playerUUID = MinecraftClient.getInstance().getNetworkHandler().getPlayerListEntry(player).getProfile().getId().toString();
TagCommand.loadPlayer(playerUUID, true);
List<String> names = PlayerInfo.playerUUIDToNames(playerUUID);
for (int i = 1; i <= names.size(); i++)

View File

@ -0,0 +1,32 @@
package net.saltymc.eaa.commands;
import com.mojang.brigadier.builder.LiteralArgumentBuilder;
import com.mojang.brigadier.context.CommandContext;
import net.fabricmc.fabric.api.client.command.v1.FabricClientCommandSource;
import net.minecraft.text.Text;
import static net.fabricmc.fabric.api.client.command.v1.ClientCommandManager.literal;
public class ReloadCommand extends EaaModCommand{
@Override
public int run(CommandContext<FabricClientCommandSource> context) {
FabricClientCommandSource source = context.getSource();
try {
TagCommand.getHashMap().clear();
source.sendFeedback(Text.of("Reloaded!"));
} catch (Exception e) {
source.sendFeedback(Text.of(e.toString()));
}
return 1;
}
@Override
public LiteralArgumentBuilder<FabricClientCommandSource> getCommandSpecification() {
return literal("/reload").executes(this);
}
}