-
-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
TODO: finish readme with instructions for itemsadder. Closes #141.
- Loading branch information
Showing
7 changed files
with
73 additions
and
2 deletions.
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
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
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
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
30 changes: 30 additions & 0 deletions
30
src/main/java/io/github/townyadvanced/townyresources/util/ItemsAdderUtil.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,30 @@ | ||
package io.github.townyadvanced.townyresources.util; | ||
|
||
import org.bukkit.inventory.ItemStack; | ||
import org.jetbrains.annotations.Nullable; | ||
|
||
import dev.lone.itemsadder.api.CustomStack; | ||
|
||
public class ItemsAdderUtil { | ||
|
||
@Nullable | ||
public static ItemStack getItemStack(String materialName, int amount) { | ||
CustomStack itemsAdderItem = CustomStack.getInstance(materialName); | ||
if (itemsAdderItem == null) | ||
return null; | ||
ItemStack itemStack = itemsAdderItem.getItemStack(); | ||
itemStack.setAmount(amount); | ||
return itemStack; | ||
} | ||
|
||
public static String getMaterialNameForDisplay(String materialName) { | ||
CustomStack itemsAdderItem = CustomStack.getInstance(materialName); | ||
if (itemsAdderItem == null) | ||
return null; | ||
return itemsAdderItem.getDisplayName(); | ||
} | ||
|
||
public static boolean isValidItem(String materialName) { | ||
return CustomStack.getInstance(materialName) != null; | ||
} | ||
} |
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
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