This repository has been archived by the owner on Aug 8, 2024. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 90
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Export favorites via command (#681)
* chore: Remove broken quest book * fix: Allow access to guides and lootruns * feat: Export favorites via command --------- Co-authored-by: Magnus Ihse Bursie <mag@icus.se>
- Loading branch information
1 parent
b0e0d5b
commit 103a8b8
Showing
2 changed files
with
62 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
60 changes: 60 additions & 0 deletions
60
src/main/java/com/wynntils/modules/questbook/commands/CommandExportFavorites.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
/* | ||
* * Copyright © Wynntils - 2022. | ||
*/ | ||
|
||
package com.wynntils.modules.questbook.commands; | ||
|
||
import com.wynntils.McIf; | ||
import com.wynntils.core.utils.Utils; | ||
import com.wynntils.modules.utilities.configs.UtilitiesConfig; | ||
import net.minecraft.command.CommandBase; | ||
import net.minecraft.command.CommandException; | ||
import net.minecraft.command.ICommandSender; | ||
import net.minecraft.server.MinecraftServer; | ||
import net.minecraft.util.text.ITextComponent; | ||
import net.minecraft.util.text.TextComponentString; | ||
import net.minecraft.util.text.TextFormatting; | ||
import net.minecraft.util.text.event.ClickEvent; | ||
import net.minecraftforge.client.IClientCommand; | ||
|
||
import java.util.ArrayList; | ||
import java.util.List; | ||
|
||
public class CommandExportFavorites extends CommandBase implements IClientCommand { | ||
|
||
|
||
@Override | ||
public String getName() { | ||
return "exportfavorites"; | ||
} | ||
|
||
@Override | ||
public boolean allowUsageWithoutPrefix(ICommandSender sender, String message) { | ||
return false; | ||
} | ||
|
||
@Override | ||
public String getUsage(ICommandSender sender) { | ||
return "exportfavorites"; | ||
} | ||
|
||
@Override | ||
public void execute(MinecraftServer server, ICommandSender sender, String[] args) throws CommandException { | ||
ITextComponent command = new TextComponentString("/exportfavorites"); | ||
command.getStyle().setClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/exportfavorites")); | ||
|
||
List<String> combinedList = new ArrayList<>(); | ||
combinedList.addAll(UtilitiesConfig.INSTANCE.favoriteItems); | ||
combinedList.addAll(UtilitiesConfig.INSTANCE.favoriteIngredients); | ||
combinedList.addAll(UtilitiesConfig.INSTANCE.favoritePowders); | ||
combinedList.addAll(UtilitiesConfig.INSTANCE.favoriteEmeraldPouches); | ||
|
||
Utils.copyToClipboard("wynntilsFavorites," + String.join(",", combinedList)); | ||
McIf.player().sendMessage(new TextComponentString(TextFormatting.GREEN + "Copied favorites to clipboard! Open the guide list and click the + button on Artemis to import them.")); | ||
} | ||
|
||
@Override | ||
public int getRequiredPermissionLevel() { | ||
return 0; | ||
} | ||
} |