-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Use gradle * Add permission for interacting with slimes with a bucket * Update config to use `MiniMessage` format. Extract config vars into `PluginConfig` * Update `foojay-resolver-convention` * Code cleanup * Update NBTAPI and fix its shading * Update deps. Simplify iterations in `SlimeListener` * Code cleanup. Naming * Code cleanup. Update for Minecraft 1.21
- Loading branch information
1 parent
96a5499
commit 866cf14
Showing
5 changed files
with
105 additions
and
58 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
31 changes: 31 additions & 0 deletions
31
src/main/java/com/danikvitek/slimeinabukkit/util/ISUtil.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,31 @@ | ||
package com.danikvitek.slimeinabukkit.util; | ||
|
||
import net.kyori.adventure.text.Component; | ||
import org.bukkit.inventory.ItemStack; | ||
import org.bukkit.inventory.meta.ItemMeta; | ||
import org.jetbrains.annotations.NotNull; | ||
|
||
import java.util.function.Consumer; | ||
|
||
/** | ||
* Utility class for {@link org.bukkit.inventory.ItemStack}. | ||
*/ | ||
public final class ISUtil { | ||
private ISUtil() { | ||
} | ||
|
||
public static void useDisplayName(final @NotNull ItemStack itemStack, final @NotNull Consumer<@NotNull Component> consumer) { | ||
if (!itemStack.hasItemMeta()) { | ||
final ItemMeta itemMeta = itemStack.getItemMeta(); | ||
useDisplayName(itemMeta, consumer); | ||
} | ||
} | ||
|
||
public static void useDisplayName(final @NotNull ItemMeta itemMeta, final @NotNull Consumer<@NotNull Component> consumer) { | ||
if (itemMeta.hasDisplayName()) { | ||
final Component displayName = itemMeta.displayName(); | ||
assert displayName != null; | ||
consumer.accept(displayName); | ||
} | ||
} | ||
} |
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