implement reload
This commit is contained in:
parent
1a9a9aea42
commit
00bfe748cc
3 changed files with 34 additions and 0 deletions
|
@ -26,6 +26,7 @@ public final class EaaMod implements ClientModInitializer {
|
||||||
new TagCommand();
|
new TagCommand();
|
||||||
new CheckPlayerCommand();
|
new CheckPlayerCommand();
|
||||||
new CheckLobbyCommand();
|
new CheckLobbyCommand();
|
||||||
|
new ReloadCommand();
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -33,6 +33,7 @@ public class CheckPlayerCommand extends EaaModCommand{
|
||||||
|
|
||||||
try {
|
try {
|
||||||
String playerUUID = MinecraftClient.getInstance().getNetworkHandler().getPlayerListEntry(player).getProfile().getId().toString();
|
String playerUUID = MinecraftClient.getInstance().getNetworkHandler().getPlayerListEntry(player).getProfile().getId().toString();
|
||||||
|
TagCommand.loadPlayer(playerUUID, true);
|
||||||
|
|
||||||
List<String> names = PlayerInfo.playerUUIDToNames(playerUUID);
|
List<String> names = PlayerInfo.playerUUIDToNames(playerUUID);
|
||||||
for (int i = 1; i <= names.size(); i++)
|
for (int i = 1; i <= names.size(); i++)
|
||||||
|
|
32
src/main/java/net/saltymc/eaa/commands/ReloadCommand.java
Normal file
32
src/main/java/net/saltymc/eaa/commands/ReloadCommand.java
Normal 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);
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in a new issue