diff options
Diffstat (limited to 'src/main/java/at/hannibal2/skyhanni/utils')
3 files changed, 7 insertions, 9 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/utils/ItemUtils.kt b/src/main/java/at/hannibal2/skyhanni/utils/ItemUtils.kt index bd373d075..d8e21e46f 100644 --- a/src/main/java/at/hannibal2/skyhanni/utils/ItemUtils.kt +++ b/src/main/java/at/hannibal2/skyhanni/utils/ItemUtils.kt @@ -1,6 +1,6 @@ package at.hannibal2.skyhanni.utils -import at.hannibal2.skyhanni.utils.LorenzUtils.matchRegex +import at.hannibal2.skyhanni.utils.StringUtils.matchRegex import at.hannibal2.skyhanni.utils.StringUtils.removeColor import com.google.gson.GsonBuilder import com.google.gson.JsonObject @@ -14,7 +14,8 @@ object ItemUtils { fun ItemStack.cleanName() = this.displayName.removeColor() - fun isSack(name: String): Boolean = name.endsWith(" Sack")//TODO use item id or api or something? or dont, its working fine now + fun isSack(name: String): Boolean = + name.endsWith(" Sack")//TODO use item id or api or something? or dont, its working fine now fun ItemStack.getLore(): List<String> { val tagCompound = this.tagCompound ?: return emptyList() diff --git a/src/main/java/at/hannibal2/skyhanni/utils/LorenzUtils.kt b/src/main/java/at/hannibal2/skyhanni/utils/LorenzUtils.kt index 3783833fb..faff0fb0c 100644 --- a/src/main/java/at/hannibal2/skyhanni/utils/LorenzUtils.kt +++ b/src/main/java/at/hannibal2/skyhanni/utils/LorenzUtils.kt @@ -9,7 +9,6 @@ import net.minecraft.client.Minecraft import net.minecraft.entity.EntityLivingBase import net.minecraft.entity.SharedMonsterAttributes import net.minecraft.util.ChatComponentText -import org.intellij.lang.annotations.Language import java.text.DecimalFormat import java.text.SimpleDateFormat @@ -83,9 +82,6 @@ object LorenzUtils { return true } - //TODO move into StringUtils - fun String.matchRegex(@Language("RegExp") regex: String): Boolean = regex.toRegex().matches(this) - fun SimpleDateFormat.formatCurrentTime(): String = this.format(System.currentTimeMillis()) fun stripVanillaMessage(originalMessage: String): String { diff --git a/src/main/java/at/hannibal2/skyhanni/utils/StringUtils.kt b/src/main/java/at/hannibal2/skyhanni/utils/StringUtils.kt index 7c8e68a87..877e0edf6 100644 --- a/src/main/java/at/hannibal2/skyhanni/utils/StringUtils.kt +++ b/src/main/java/at/hannibal2/skyhanni/utils/StringUtils.kt @@ -1,10 +1,10 @@ package at.hannibal2.skyhanni.utils +import org.intellij.lang.annotations.Language import java.text.DecimalFormat import java.util.* object StringUtils { - private val durationFormat = DecimalFormat("00") fun String.firstLetterUppercase(): String { @@ -92,6 +92,7 @@ object StringUtils { return toString().replace("-", "") } -} + fun String.matchRegex(@Language("RegExp") regex: String): Boolean = regex.toRegex().matches(this) -private fun String.removeAtBeginning(text: String): String = if (this.startsWith(text)) substring(text.length) else this + private fun String.removeAtBeginning(text: String): String = if (this.startsWith(text)) substring(text.length) else this +} |