Skip to content

Commit

Permalink
Add error message when trying to copy invalid skull data
Browse files Browse the repository at this point in the history
  • Loading branch information
RappyTV committed Nov 21, 2023
1 parent 60f556a commit 4be8395
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,12 @@ public KeyListener(HeadOwnerAddon addon) {
@Subscribe
public void onKey(KeyEvent event) {
if(event.state() == State.PRESS && event.key() == addon.configuration().copyKey() && !Laby.labyAPI().minecraft().minecraftWindow().isScreenOpened()) {
Laby.labyAPI().minecraft().setClipboard(addon.getSkullApi().getCopy(addon.configuration()));
String skulldata = addon.getSkullApi().getCopy(addon.configuration());
if(skulldata == null) {
Laby.references().chatExecutor().displayClientMessage(Component.translatable("headowner.messages.nothingToCopy", NamedTextColor.RED));
return;
}
Laby.labyAPI().minecraft().setClipboard(skulldata);
Laby.references().chatExecutor().displayClientMessage(Component.translatable("headowner.messages.copied", NamedTextColor.GREEN));
}
}
Expand Down
1 change: 1 addition & 0 deletions core/src/main/resources/assets/headowner/i18n/de_de.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
"messages": {
"copyFormat": "Kopf Typ: %s, Spielername: %s, UUID: %s, Texturenwert: %s",
"copied": "Die Skull-Daten wurden in deine Zwischenablage gespeichert!",
"nothingToCopy": "Du schaust keinen gültigen Skull an!",
"unknown": "Unbekannt",
"unknownHead": "Unbekannter Kopf (wurde per Texturenwert erstellt)",
"unknownHeadKey": "Unbekannter Kopf (wurde per Texturenwert erstellt, drücke %s um Daten zu kopieren)"
Expand Down
1 change: 1 addition & 0 deletions core/src/main/resources/assets/headowner/i18n/en_us.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
"messages": {
"copyFormat": "Skull type: %s, Username: %s, UUID: %s, Texture value: %s",
"copied": "The skull data was copied to your clipboard!",
"nothingToCopy": "You're not looking at a valid skull!",
"unknown": "Unknown",
"unknownHead": "Unknown Head (created by texture value)",
"unknownHeadKey": "Unknown Head (created by texture value, press %s to copy skull data)"
Expand Down

0 comments on commit 4be8395

Please sign in to comment.