Package com.ldtteam.structurize.api.util
Class Utils
java.lang.Object
com.ldtteam.structurize.api.util.Utils
General purpose utilities class.
-
Method Summary
Modifier and TypeMethodDescriptionstatic voidcheckDirectory(File directory) Checks if directory exists, else creates it.static StringgetSafePackName(String input) Get a filename that's probably safe from a player name that might contain problematic characters.static booleannbtContains(net.minecraft.nbt.CompoundTag originTag, net.minecraft.nbt.CompoundTag compareTag) Check if a comparison tag has the same or more nbt tags than an origin nbt tag.static voidplayErrorSound(@NotNull net.minecraft.world.entity.player.Player player) Play an error sound.static voidplaySuccessSound(@NotNull net.minecraft.world.entity.player.Player player) Play a success sound.
-
Method Details
-
playSuccessSound
public static void playSuccessSound(@NotNull @NotNull net.minecraft.world.entity.player.Player player) Play a success sound.- Parameters:
player- the player to play it for.
-
playErrorSound
public static void playErrorSound(@NotNull @NotNull net.minecraft.world.entity.player.Player player) Play an error sound.- Parameters:
player- the player to play it for.
-
checkDirectory
Checks if directory exists, else creates it.- Parameters:
directory- the directory to check.
-
nbtContains
public static boolean nbtContains(net.minecraft.nbt.CompoundTag originTag, net.minecraft.nbt.CompoundTag compareTag) Check if a comparison tag has the same or more nbt tags than an origin nbt tag.- Parameters:
originTag- the base tag to start the comparison from.compareTag- the tag we try to fit into the origin tag.- Returns:
- true if they match.
-
getSafePackName
Get a filename that's probably safe from a player name that might contain problematic characters.- Parameters:
input- a player name or other possibly unsafe text.- Returns:
- the safe filename. This doesn't protect against Windows reserved filenames. Most servers are Linux anyway so this only hurts SP players who will have a lot of Windows things break on them too.
-