Skip to content

Commit

Permalink
Add method to query by ItemStack. Bump version
Browse files Browse the repository at this point in the history
  • Loading branch information
PikaMug committed Apr 5, 2022
1 parent 13785b1 commit 5fb19ed
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 2 deletions.
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

<groupId>me.pikamug.localelib</groupId>
<artifactId>LocaleLib</artifactId>
<version>2.5</version>
<version>2.6</version>

<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
Expand Down
13 changes: 13 additions & 0 deletions src/main/java/me/pikamug/localelib/LocaleManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -250,6 +250,18 @@ public boolean sendMessage(final Player player, final String message, final Enti
Bukkit.dispatchCommand(Bukkit.getConsoleSender(), "tellraw " + player.getName() + " [\"" + msg + "\"]");
return true;
}

/**
* Gets the key name of the specified item as it would appear in a Minecraft lang file.
*
* @param itemStack the item to check
* @return the raw key
* @throws IllegalArgumentException if that item could not be found
*/
@SuppressWarnings("deprecation")
public String queryItemStack(final ItemStack itemStack) {
return queryMaterial(itemStack.getType(), itemStack.getDurability(), itemStack.getItemMeta());
}

/**
* Gets the key name of the specified material as it would appear in a Minecraft lang file.
Expand All @@ -267,6 +279,7 @@ public String queryMaterial(final Material material) throws IllegalArgumentExcep
*
* @param material the material to check
* @param durability the material type to check
* @param meta the item meta data to check
* @return the raw key
* @throws IllegalArgumentException if an item with that material and durability could not be found
* @throws NullArgumentException if the specified material parameter is null
Expand Down
2 changes: 1 addition & 1 deletion src/main/resources/plugin.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: LocaleLib
main: me.pikamug.localelib.LocaleLib
version: 2.5
version: 2.6
api-version: 1.13
description: Show translated names of items, entities & more in client's language
website: https://github.com/PikaMug/LocaleLib
Expand Down

0 comments on commit 5fb19ed

Please sign in to comment.