diff --git a/pom.xml b/pom.xml index 5c4a7a85..ce3bd564 100644 --- a/pom.xml +++ b/pom.xml @@ -20,7 +20,7 @@ 1.8 - 1.18.1 + 1.19.2 https://hub.spigotmc.org/javadocs/spigot/ @@ -230,7 +230,7 @@ io.github.baked-libs dough-api - 1.1.1 + 1.2.0 compile @@ -244,7 +244,7 @@ org.bstats bstats-bukkit - 2.2.1 + 3.0.0 compile diff --git a/src/main/java/io/github/thebusybiscuit/sensibletoolbox/SensibleToolboxPlugin.java b/src/main/java/io/github/thebusybiscuit/sensibletoolbox/SensibleToolboxPlugin.java index d20afdd7..85094851 100644 --- a/src/main/java/io/github/thebusybiscuit/sensibletoolbox/SensibleToolboxPlugin.java +++ b/src/main/java/io/github/thebusybiscuit/sensibletoolbox/SensibleToolboxPlugin.java @@ -9,7 +9,7 @@ import javax.annotation.Nonnull; import javax.annotation.ParametersAreNonnullByDefault; -import org.apache.commons.lang.Validate; +import io.github.thebusybiscuit.sensibletoolbox.helpers.Validate; import org.bstats.bukkit.Metrics; import org.bukkit.Server; import org.bukkit.command.Command; @@ -250,7 +250,7 @@ public void onEnable() { RecipeUtil.setupRecipes(); RecipeBook.buildRecipes(); - protectionManager = new ProtectionManager(getServer()); + protectionManager = new ProtectionManager(instance); }); getServer().getScheduler().runTaskTimer(this, LocationManager.getManager()::tick, 1L, 1L); diff --git a/src/main/java/io/github/thebusybiscuit/sensibletoolbox/api/MinecraftVersion.java b/src/main/java/io/github/thebusybiscuit/sensibletoolbox/api/MinecraftVersion.java index bfefebf3..9bc5b6dc 100644 --- a/src/main/java/io/github/thebusybiscuit/sensibletoolbox/api/MinecraftVersion.java +++ b/src/main/java/io/github/thebusybiscuit/sensibletoolbox/api/MinecraftVersion.java @@ -2,7 +2,7 @@ import javax.annotation.Nonnull; -import org.apache.commons.lang.Validate; +import io.github.thebusybiscuit.sensibletoolbox.helpers.Validate; import org.bukkit.Server; import io.github.thebusybiscuit.sensibletoolbox.SensibleToolboxPlugin; @@ -51,6 +51,8 @@ public enum MinecraftVersion { */ MINECRAFT_1_18(18, "1.18.x"), + MINECRAFT_1_19(19, "1.19.x"), + /** * This constant represents an exceptional state in which we were unable * to identify the Minecraft Version we are using diff --git a/src/main/java/io/github/thebusybiscuit/sensibletoolbox/api/filters/Filter.java b/src/main/java/io/github/thebusybiscuit/sensibletoolbox/api/filters/Filter.java index 4140c2e2..0f703523 100644 --- a/src/main/java/io/github/thebusybiscuit/sensibletoolbox/api/filters/Filter.java +++ b/src/main/java/io/github/thebusybiscuit/sensibletoolbox/api/filters/Filter.java @@ -1,6 +1,6 @@ package io.github.thebusybiscuit.sensibletoolbox.api.filters; -import org.apache.commons.lang.Validate; +import io.github.thebusybiscuit.sensibletoolbox.helpers.Validate; import org.bukkit.inventory.ItemStack; import java.util.ArrayList; diff --git a/src/main/java/io/github/thebusybiscuit/sensibletoolbox/api/gui/gadgets/ChargeMeter.java b/src/main/java/io/github/thebusybiscuit/sensibletoolbox/api/gui/gadgets/ChargeMeter.java index ab570cda..87b023b0 100644 --- a/src/main/java/io/github/thebusybiscuit/sensibletoolbox/api/gui/gadgets/ChargeMeter.java +++ b/src/main/java/io/github/thebusybiscuit/sensibletoolbox/api/gui/gadgets/ChargeMeter.java @@ -1,6 +1,6 @@ package io.github.thebusybiscuit.sensibletoolbox.api.gui.gadgets; -import org.apache.commons.lang.Validate; +import io.github.thebusybiscuit.sensibletoolbox.helpers.Validate; import org.bukkit.Color; import org.bukkit.Material; import org.bukkit.inventory.ItemStack; diff --git a/src/main/java/io/github/thebusybiscuit/sensibletoolbox/api/gui/gadgets/DirectionGadget.java b/src/main/java/io/github/thebusybiscuit/sensibletoolbox/api/gui/gadgets/DirectionGadget.java index 31f74002..bd2feec2 100644 --- a/src/main/java/io/github/thebusybiscuit/sensibletoolbox/api/gui/gadgets/DirectionGadget.java +++ b/src/main/java/io/github/thebusybiscuit/sensibletoolbox/api/gui/gadgets/DirectionGadget.java @@ -3,7 +3,7 @@ import java.util.HashMap; import java.util.Map; -import org.apache.commons.lang.Validate; +import io.github.thebusybiscuit.sensibletoolbox.helpers.Validate; import org.bukkit.ChatColor; import org.bukkit.Material; import org.bukkit.block.BlockFace; diff --git a/src/main/java/io/github/thebusybiscuit/sensibletoolbox/api/gui/gadgets/EnergyFlowGadget.java b/src/main/java/io/github/thebusybiscuit/sensibletoolbox/api/gui/gadgets/EnergyFlowGadget.java index 013fc284..1d5042b6 100644 --- a/src/main/java/io/github/thebusybiscuit/sensibletoolbox/api/gui/gadgets/EnergyFlowGadget.java +++ b/src/main/java/io/github/thebusybiscuit/sensibletoolbox/api/gui/gadgets/EnergyFlowGadget.java @@ -1,6 +1,6 @@ package io.github.thebusybiscuit.sensibletoolbox.api.gui.gadgets; -import org.apache.commons.lang.Validate; +import io.github.thebusybiscuit.sensibletoolbox.helpers.Validate; import org.bukkit.ChatColor; import org.bukkit.Material; import org.bukkit.block.BlockFace; diff --git a/src/main/java/io/github/thebusybiscuit/sensibletoolbox/api/gui/gadgets/FilterTypeGadget.java b/src/main/java/io/github/thebusybiscuit/sensibletoolbox/api/gui/gadgets/FilterTypeGadget.java index f5864197..87aa9ddf 100644 --- a/src/main/java/io/github/thebusybiscuit/sensibletoolbox/api/gui/gadgets/FilterTypeGadget.java +++ b/src/main/java/io/github/thebusybiscuit/sensibletoolbox/api/gui/gadgets/FilterTypeGadget.java @@ -1,6 +1,6 @@ package io.github.thebusybiscuit.sensibletoolbox.api.gui.gadgets; -import org.apache.commons.lang.Validate; +import io.github.thebusybiscuit.sensibletoolbox.helpers.Validate; import org.bukkit.ChatColor; import org.bukkit.Material; diff --git a/src/main/java/io/github/thebusybiscuit/sensibletoolbox/api/gui/gadgets/LightMeter.java b/src/main/java/io/github/thebusybiscuit/sensibletoolbox/api/gui/gadgets/LightMeter.java index 3d7e8218..b003fa15 100644 --- a/src/main/java/io/github/thebusybiscuit/sensibletoolbox/api/gui/gadgets/LightMeter.java +++ b/src/main/java/io/github/thebusybiscuit/sensibletoolbox/api/gui/gadgets/LightMeter.java @@ -1,6 +1,6 @@ package io.github.thebusybiscuit.sensibletoolbox.api.gui.gadgets; -import org.apache.commons.lang.Validate; +import io.github.thebusybiscuit.sensibletoolbox.helpers.Validate; import io.github.thebusybiscuit.sensibletoolbox.api.LightMeterHolder; import io.github.thebusybiscuit.sensibletoolbox.api.gui.InventoryGUI; diff --git a/src/main/java/io/github/thebusybiscuit/sensibletoolbox/api/gui/gadgets/NumericGadget.java b/src/main/java/io/github/thebusybiscuit/sensibletoolbox/api/gui/gadgets/NumericGadget.java index d26099b5..6a6610d9 100644 --- a/src/main/java/io/github/thebusybiscuit/sensibletoolbox/api/gui/gadgets/NumericGadget.java +++ b/src/main/java/io/github/thebusybiscuit/sensibletoolbox/api/gui/gadgets/NumericGadget.java @@ -1,7 +1,7 @@ package io.github.thebusybiscuit.sensibletoolbox.api.gui.gadgets; -import org.apache.commons.lang.Validate; -import org.apache.commons.lang.math.IntRange; +import io.github.thebusybiscuit.sensibletoolbox.helpers.Validate; +import io.github.thebusybiscuit.sensibletoolbox.helpers.IntRange; import org.bukkit.ChatColor; import org.bukkit.Material; import org.bukkit.entity.Player; diff --git a/src/main/java/io/github/thebusybiscuit/sensibletoolbox/api/gui/gadgets/ProgressMeter.java b/src/main/java/io/github/thebusybiscuit/sensibletoolbox/api/gui/gadgets/ProgressMeter.java index 9fb5a6a0..60dd1d73 100644 --- a/src/main/java/io/github/thebusybiscuit/sensibletoolbox/api/gui/gadgets/ProgressMeter.java +++ b/src/main/java/io/github/thebusybiscuit/sensibletoolbox/api/gui/gadgets/ProgressMeter.java @@ -1,6 +1,6 @@ package io.github.thebusybiscuit.sensibletoolbox.api.gui.gadgets; -import org.apache.commons.lang.Validate; +import io.github.thebusybiscuit.sensibletoolbox.helpers.Validate; import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.meta.ItemMeta; diff --git a/src/main/java/io/github/thebusybiscuit/sensibletoolbox/api/items/BaseSTBBlock.java b/src/main/java/io/github/thebusybiscuit/sensibletoolbox/api/items/BaseSTBBlock.java index 5be60054..ed8cf4a3 100644 --- a/src/main/java/io/github/thebusybiscuit/sensibletoolbox/api/items/BaseSTBBlock.java +++ b/src/main/java/io/github/thebusybiscuit/sensibletoolbox/api/items/BaseSTBBlock.java @@ -9,7 +9,7 @@ import javax.annotation.Nonnull; import javax.annotation.Nullable; -import org.apache.commons.lang.Validate; +import io.github.thebusybiscuit.sensibletoolbox.helpers.Validate; import org.bukkit.Bukkit; import org.bukkit.ChatColor; import org.bukkit.GameMode; @@ -269,7 +269,7 @@ public final boolean hasAccessRights(@Nonnull Player player) { * Check if this block may be interacted with by the player of the given * UUID, based on its current security settings. Note that no player * permission check is done here; see - * {@link BaseSTBItem#checkPlayerPermission(org.bukkit.entity.Player, me.desht.sensibletoolbox.api.items.BaseSTBItem.ItemAction)}. + * . * * @param uuid * the UUID to check diff --git a/src/main/java/io/github/thebusybiscuit/sensibletoolbox/api/items/BaseSTBItem.java b/src/main/java/io/github/thebusybiscuit/sensibletoolbox/api/items/BaseSTBItem.java index 6923c3ab..dce673a9 100644 --- a/src/main/java/io/github/thebusybiscuit/sensibletoolbox/api/items/BaseSTBItem.java +++ b/src/main/java/io/github/thebusybiscuit/sensibletoolbox/api/items/BaseSTBItem.java @@ -10,7 +10,7 @@ import javax.annotation.Nullable; import javax.annotation.ParametersAreNonnullByDefault; -import org.apache.commons.lang.Validate; +import io.github.thebusybiscuit.sensibletoolbox.helpers.Validate; import org.bukkit.ChatColor; import org.bukkit.Keyed; import org.bukkit.Material; diff --git a/src/main/java/io/github/thebusybiscuit/sensibletoolbox/api/items/BaseSTBMachine.java b/src/main/java/io/github/thebusybiscuit/sensibletoolbox/api/items/BaseSTBMachine.java index 8dc758d8..e66f3fe6 100644 --- a/src/main/java/io/github/thebusybiscuit/sensibletoolbox/api/items/BaseSTBMachine.java +++ b/src/main/java/io/github/thebusybiscuit/sensibletoolbox/api/items/BaseSTBMachine.java @@ -11,8 +11,8 @@ import javax.annotation.Nullable; -import org.apache.commons.lang.StringUtils; -import org.apache.commons.lang.Validate; +import io.github.thebusybiscuit.sensibletoolbox.helpers.StringUtils; +import io.github.thebusybiscuit.sensibletoolbox.helpers.Validate; import org.bukkit.Bukkit; import org.bukkit.ChatColor; import org.bukkit.Location; diff --git a/src/main/java/io/github/thebusybiscuit/sensibletoolbox/api/recipes/CustomRecipeCollection.java b/src/main/java/io/github/thebusybiscuit/sensibletoolbox/api/recipes/CustomRecipeCollection.java index bbc3a520..9c2dd5b5 100644 --- a/src/main/java/io/github/thebusybiscuit/sensibletoolbox/api/recipes/CustomRecipeCollection.java +++ b/src/main/java/io/github/thebusybiscuit/sensibletoolbox/api/recipes/CustomRecipeCollection.java @@ -7,7 +7,7 @@ import javax.annotation.Nonnull; -import org.apache.commons.lang.Validate; +import io.github.thebusybiscuit.sensibletoolbox.helpers.Validate; import org.bukkit.inventory.ItemStack; import com.google.common.base.Joiner; diff --git a/src/main/java/io/github/thebusybiscuit/sensibletoolbox/api/recipes/CustomRecipeManager.java b/src/main/java/io/github/thebusybiscuit/sensibletoolbox/api/recipes/CustomRecipeManager.java index cb9c501f..e7f38e6f 100644 --- a/src/main/java/io/github/thebusybiscuit/sensibletoolbox/api/recipes/CustomRecipeManager.java +++ b/src/main/java/io/github/thebusybiscuit/sensibletoolbox/api/recipes/CustomRecipeManager.java @@ -8,7 +8,7 @@ import javax.annotation.Nonnull; -import org.apache.commons.lang.Validate; +import io.github.thebusybiscuit.sensibletoolbox.helpers.Validate; import org.bukkit.inventory.ItemStack; import io.github.thebusybiscuit.sensibletoolbox.api.items.BaseSTBMachine; diff --git a/src/main/java/io/github/thebusybiscuit/sensibletoolbox/api/recipes/SupplementaryResult.java b/src/main/java/io/github/thebusybiscuit/sensibletoolbox/api/recipes/SupplementaryResult.java index 564e2c60..b43b20e1 100644 --- a/src/main/java/io/github/thebusybiscuit/sensibletoolbox/api/recipes/SupplementaryResult.java +++ b/src/main/java/io/github/thebusybiscuit/sensibletoolbox/api/recipes/SupplementaryResult.java @@ -2,7 +2,7 @@ import javax.annotation.Nonnull; -import org.apache.commons.lang.Validate; +import io.github.thebusybiscuit.sensibletoolbox.helpers.Validate; import org.bukkit.inventory.ItemStack; /** diff --git a/src/main/java/io/github/thebusybiscuit/sensibletoolbox/blocks/BlockUpdateDetector.java b/src/main/java/io/github/thebusybiscuit/sensibletoolbox/blocks/BlockUpdateDetector.java index 2f5a6711..f8193b90 100644 --- a/src/main/java/io/github/thebusybiscuit/sensibletoolbox/blocks/BlockUpdateDetector.java +++ b/src/main/java/io/github/thebusybiscuit/sensibletoolbox/blocks/BlockUpdateDetector.java @@ -1,6 +1,6 @@ package io.github.thebusybiscuit.sensibletoolbox.blocks; -import org.apache.commons.lang.math.IntRange; +import io.github.thebusybiscuit.sensibletoolbox.helpers.IntRange; import org.bukkit.Bukkit; import org.bukkit.ChatColor; import org.bukkit.Location; diff --git a/src/main/java/io/github/thebusybiscuit/sensibletoolbox/blocks/Elevator.java b/src/main/java/io/github/thebusybiscuit/sensibletoolbox/blocks/Elevator.java index be171167..c2978518 100644 --- a/src/main/java/io/github/thebusybiscuit/sensibletoolbox/blocks/Elevator.java +++ b/src/main/java/io/github/thebusybiscuit/sensibletoolbox/blocks/Elevator.java @@ -3,7 +3,7 @@ import javax.annotation.Nonnull; import javax.annotation.Nullable; -import org.apache.commons.lang.Validate; +import io.github.thebusybiscuit.sensibletoolbox.helpers.Validate; import org.bukkit.DyeColor; import org.bukkit.Material; import org.bukkit.block.Block; diff --git a/src/main/java/io/github/thebusybiscuit/sensibletoolbox/blocks/PaintCan.java b/src/main/java/io/github/thebusybiscuit/sensibletoolbox/blocks/PaintCan.java index 99706b9f..46dc8161 100644 --- a/src/main/java/io/github/thebusybiscuit/sensibletoolbox/blocks/PaintCan.java +++ b/src/main/java/io/github/thebusybiscuit/sensibletoolbox/blocks/PaintCan.java @@ -5,7 +5,7 @@ import javax.annotation.Nonnull; import javax.annotation.Nullable; -import org.apache.commons.lang.StringUtils; +import io.github.thebusybiscuit.sensibletoolbox.helpers.StringUtils; import org.bukkit.ChatColor; import org.bukkit.DyeColor; import org.bukkit.Location; diff --git a/src/main/java/io/github/thebusybiscuit/sensibletoolbox/blocks/RedstoneClock.java b/src/main/java/io/github/thebusybiscuit/sensibletoolbox/blocks/RedstoneClock.java index 63566bc8..4db5eb12 100644 --- a/src/main/java/io/github/thebusybiscuit/sensibletoolbox/blocks/RedstoneClock.java +++ b/src/main/java/io/github/thebusybiscuit/sensibletoolbox/blocks/RedstoneClock.java @@ -2,7 +2,7 @@ import java.awt.Color; -import org.apache.commons.lang.math.IntRange; +import io.github.thebusybiscuit.sensibletoolbox.helpers.IntRange; import org.bukkit.ChatColor; import org.bukkit.Location; import org.bukkit.Material; diff --git a/src/main/java/io/github/thebusybiscuit/sensibletoolbox/blocks/SoundMuffler.java b/src/main/java/io/github/thebusybiscuit/sensibletoolbox/blocks/SoundMuffler.java index 9e03deec..23ebbd39 100644 --- a/src/main/java/io/github/thebusybiscuit/sensibletoolbox/blocks/SoundMuffler.java +++ b/src/main/java/io/github/thebusybiscuit/sensibletoolbox/blocks/SoundMuffler.java @@ -1,6 +1,6 @@ package io.github.thebusybiscuit.sensibletoolbox.blocks; -import org.apache.commons.lang.math.IntRange; +import io.github.thebusybiscuit.sensibletoolbox.helpers.IntRange; import org.bukkit.ChatColor; import org.bukkit.Location; import org.bukkit.Material; diff --git a/src/main/java/io/github/thebusybiscuit/sensibletoolbox/blocks/machines/AutoBuilder.java b/src/main/java/io/github/thebusybiscuit/sensibletoolbox/blocks/machines/AutoBuilder.java index dc82fda8..13a06f5e 100644 --- a/src/main/java/io/github/thebusybiscuit/sensibletoolbox/blocks/machines/AutoBuilder.java +++ b/src/main/java/io/github/thebusybiscuit/sensibletoolbox/blocks/machines/AutoBuilder.java @@ -2,7 +2,7 @@ import javax.annotation.Nonnull; -import org.apache.commons.lang.Validate; +import io.github.thebusybiscuit.sensibletoolbox.helpers.Validate; import org.bukkit.Bukkit; import org.bukkit.ChatColor; import org.bukkit.DyeColor; diff --git a/src/main/java/io/github/thebusybiscuit/sensibletoolbox/blocks/machines/BigStorageUnit.java b/src/main/java/io/github/thebusybiscuit/sensibletoolbox/blocks/machines/BigStorageUnit.java index 6e1e953d..0e1df44d 100644 --- a/src/main/java/io/github/thebusybiscuit/sensibletoolbox/blocks/machines/BigStorageUnit.java +++ b/src/main/java/io/github/thebusybiscuit/sensibletoolbox/blocks/machines/BigStorageUnit.java @@ -6,7 +6,7 @@ import javax.annotation.Nonnull; import javax.annotation.Nullable; -import org.apache.commons.lang.WordUtils; +import io.github.thebusybiscuit.sensibletoolbox.helpers.WordUtils; import org.bukkit.Bukkit; import org.bukkit.ChatColor; import org.bukkit.Location; diff --git a/src/main/java/io/github/thebusybiscuit/sensibletoolbox/commands/FriendCommand.java b/src/main/java/io/github/thebusybiscuit/sensibletoolbox/commands/FriendCommand.java index f891d6f4..7e009195 100644 --- a/src/main/java/io/github/thebusybiscuit/sensibletoolbox/commands/FriendCommand.java +++ b/src/main/java/io/github/thebusybiscuit/sensibletoolbox/commands/FriendCommand.java @@ -4,7 +4,7 @@ import java.util.Set; import java.util.UUID; -import org.apache.commons.lang.Validate; +import io.github.thebusybiscuit.sensibletoolbox.helpers.Validate; import org.bukkit.Bukkit; import org.bukkit.ChatColor; import org.bukkit.command.CommandSender; diff --git a/src/main/java/io/github/thebusybiscuit/sensibletoolbox/commands/GiveCommand.java b/src/main/java/io/github/thebusybiscuit/sensibletoolbox/commands/GiveCommand.java index 24266513..ac5cf893 100644 --- a/src/main/java/io/github/thebusybiscuit/sensibletoolbox/commands/GiveCommand.java +++ b/src/main/java/io/github/thebusybiscuit/sensibletoolbox/commands/GiveCommand.java @@ -4,7 +4,7 @@ import java.util.List; import java.util.Locale; -import org.apache.commons.lang.Validate; +import io.github.thebusybiscuit.sensibletoolbox.helpers.Validate; import org.bukkit.Bukkit; import org.bukkit.command.CommandSender; import org.bukkit.entity.Player; diff --git a/src/main/java/io/github/thebusybiscuit/sensibletoolbox/commands/RedrawCommand.java b/src/main/java/io/github/thebusybiscuit/sensibletoolbox/commands/RedrawCommand.java index d2ee876a..c949672d 100644 --- a/src/main/java/io/github/thebusybiscuit/sensibletoolbox/commands/RedrawCommand.java +++ b/src/main/java/io/github/thebusybiscuit/sensibletoolbox/commands/RedrawCommand.java @@ -3,7 +3,7 @@ import java.util.ArrayList; import java.util.List; -import org.apache.commons.lang.Validate; +import io.github.thebusybiscuit.sensibletoolbox.helpers.Validate; import org.bukkit.Bukkit; import org.bukkit.World; import org.bukkit.block.Block; diff --git a/src/main/java/io/github/thebusybiscuit/sensibletoolbox/commands/ShowCommand.java b/src/main/java/io/github/thebusybiscuit/sensibletoolbox/commands/ShowCommand.java index 25c7e916..88285e89 100644 --- a/src/main/java/io/github/thebusybiscuit/sensibletoolbox/commands/ShowCommand.java +++ b/src/main/java/io/github/thebusybiscuit/sensibletoolbox/commands/ShowCommand.java @@ -10,7 +10,7 @@ import javax.annotation.ParametersAreNonnullByDefault; -import org.apache.commons.lang.Validate; +import io.github.thebusybiscuit.sensibletoolbox.helpers.Validate; import org.bukkit.Bukkit; import org.bukkit.ChatColor; import org.bukkit.Location; diff --git a/src/main/java/io/github/thebusybiscuit/sensibletoolbox/commands/UnfriendCommand.java b/src/main/java/io/github/thebusybiscuit/sensibletoolbox/commands/UnfriendCommand.java index b60131f6..37077e63 100644 --- a/src/main/java/io/github/thebusybiscuit/sensibletoolbox/commands/UnfriendCommand.java +++ b/src/main/java/io/github/thebusybiscuit/sensibletoolbox/commands/UnfriendCommand.java @@ -2,7 +2,7 @@ import java.util.UUID; -import org.apache.commons.lang.Validate; +import io.github.thebusybiscuit.sensibletoolbox.helpers.Validate; import org.bukkit.command.CommandSender; import org.bukkit.entity.Player; import org.bukkit.plugin.Plugin; diff --git a/src/main/java/io/github/thebusybiscuit/sensibletoolbox/core/STBFriendManager.java b/src/main/java/io/github/thebusybiscuit/sensibletoolbox/core/STBFriendManager.java index a4709722..18eda367 100644 --- a/src/main/java/io/github/thebusybiscuit/sensibletoolbox/core/STBFriendManager.java +++ b/src/main/java/io/github/thebusybiscuit/sensibletoolbox/core/STBFriendManager.java @@ -13,7 +13,7 @@ import javax.annotation.Nonnull; -import org.apache.commons.lang.Validate; +import io.github.thebusybiscuit.sensibletoolbox.helpers.Validate; import org.bukkit.configuration.file.YamlConfiguration; import io.github.thebusybiscuit.sensibletoolbox.SensibleToolboxPlugin; diff --git a/src/main/java/io/github/thebusybiscuit/sensibletoolbox/core/STBItemRegistry.java b/src/main/java/io/github/thebusybiscuit/sensibletoolbox/core/STBItemRegistry.java index 7e490dd4..7855f7d7 100644 --- a/src/main/java/io/github/thebusybiscuit/sensibletoolbox/core/STBItemRegistry.java +++ b/src/main/java/io/github/thebusybiscuit/sensibletoolbox/core/STBItemRegistry.java @@ -13,7 +13,7 @@ import javax.annotation.Nullable; import javax.annotation.ParametersAreNonnullByDefault; -import org.apache.commons.lang.Validate; +import io.github.thebusybiscuit.sensibletoolbox.helpers.Validate; import org.bukkit.Bukkit; import org.bukkit.ChatColor; import org.bukkit.Keyed; diff --git a/src/main/java/io/github/thebusybiscuit/sensibletoolbox/core/enderstorage/EnderStorageManager.java b/src/main/java/io/github/thebusybiscuit/sensibletoolbox/core/enderstorage/EnderStorageManager.java index cc02636c..92dbf91e 100644 --- a/src/main/java/io/github/thebusybiscuit/sensibletoolbox/core/enderstorage/EnderStorageManager.java +++ b/src/main/java/io/github/thebusybiscuit/sensibletoolbox/core/enderstorage/EnderStorageManager.java @@ -10,7 +10,7 @@ import java.util.Set; import java.util.UUID; -import org.apache.commons.lang.Validate; +import io.github.thebusybiscuit.sensibletoolbox.helpers.Validate; import org.bukkit.OfflinePlayer; import org.bukkit.event.EventHandler; import org.bukkit.event.Listener; diff --git a/src/main/java/io/github/thebusybiscuit/sensibletoolbox/core/gui/STBInventoryGUI.java b/src/main/java/io/github/thebusybiscuit/sensibletoolbox/core/gui/STBInventoryGUI.java index 9170e8da..bee45afe 100644 --- a/src/main/java/io/github/thebusybiscuit/sensibletoolbox/core/gui/STBInventoryGUI.java +++ b/src/main/java/io/github/thebusybiscuit/sensibletoolbox/core/gui/STBInventoryGUI.java @@ -4,8 +4,8 @@ import java.util.ArrayList; import java.util.List; -import org.apache.commons.lang.Validate; -import org.apache.commons.lang.math.IntRange; +import io.github.thebusybiscuit.sensibletoolbox.helpers.Validate; +import io.github.thebusybiscuit.sensibletoolbox.helpers.IntRange; import org.bukkit.Bukkit; import org.bukkit.ChatColor; import org.bukkit.Location; diff --git a/src/main/java/io/github/thebusybiscuit/sensibletoolbox/core/storage/LocationManager.java b/src/main/java/io/github/thebusybiscuit/sensibletoolbox/core/storage/LocationManager.java index fc27ecec..e3791311 100644 --- a/src/main/java/io/github/thebusybiscuit/sensibletoolbox/core/storage/LocationManager.java +++ b/src/main/java/io/github/thebusybiscuit/sensibletoolbox/core/storage/LocationManager.java @@ -19,7 +19,7 @@ import javax.annotation.Nonnull; import javax.annotation.Nullable; -import org.apache.commons.lang.Validate; +import io.github.thebusybiscuit.sensibletoolbox.helpers.Validate; import org.bukkit.Bukkit; import org.bukkit.Chunk; import org.bukkit.Location; diff --git a/src/main/java/io/github/thebusybiscuit/sensibletoolbox/helpers/IntRange.java b/src/main/java/io/github/thebusybiscuit/sensibletoolbox/helpers/IntRange.java new file mode 100644 index 00000000..e8005653 --- /dev/null +++ b/src/main/java/io/github/thebusybiscuit/sensibletoolbox/helpers/IntRange.java @@ -0,0 +1,34 @@ +package io.github.thebusybiscuit.sensibletoolbox.helpers; + +public class IntRange { + int minimumInteger; + int maximumInteger; + + public IntRange(int x) { + this.minimumInteger = x; + this.maximumInteger = x; + } + public IntRange(int min, int max) { + this.minimumInteger = min; + this.maximumInteger = max; + } + public boolean containsInteger(int i) { + return i <= maximumInteger && i >= minimumInteger; + } + + public int getMinimumInteger() { + return minimumInteger; + } + + public void setMinimumInteger(int minimumInteger) { + this.minimumInteger = minimumInteger; + } + + public int getMaximumInteger() { + return maximumInteger; + } + + public void setMaximumInteger(int maximumInteger) { + this.maximumInteger = maximumInteger; + } +} diff --git a/src/main/java/io/github/thebusybiscuit/sensibletoolbox/helpers/StringUtils.java b/src/main/java/io/github/thebusybiscuit/sensibletoolbox/helpers/StringUtils.java new file mode 100644 index 00000000..28f0bdbd --- /dev/null +++ b/src/main/java/io/github/thebusybiscuit/sensibletoolbox/helpers/StringUtils.java @@ -0,0 +1,17 @@ +package io.github.thebusybiscuit.sensibletoolbox.helpers; + +import javax.annotation.Nonnull; + +public class StringUtils { + public static String repeat(@Nonnull String z, int i) { + StringBuilder sb = new StringBuilder(); + for(int a = 0; a < i; a++) { + sb.append(z); + } + return sb.toString(); + } + + public static boolean isNumeric(@Nonnull String s) { + return s.matches("-?\\d+(\\.\\d+)?"); + } +} diff --git a/src/main/java/io/github/thebusybiscuit/sensibletoolbox/helpers/Validate.java b/src/main/java/io/github/thebusybiscuit/sensibletoolbox/helpers/Validate.java new file mode 100644 index 00000000..801cc50d --- /dev/null +++ b/src/main/java/io/github/thebusybiscuit/sensibletoolbox/helpers/Validate.java @@ -0,0 +1,37 @@ +package io.github.thebusybiscuit.sensibletoolbox.helpers; + +import java.io.IOException; + +public class Validate { + public static void isTrue(boolean b, String s) { + if(!b) { + throwException(new IOException(s)); + } + } + + public static void notNull(Object o, String s) { + if(o == null) { + throwException(new IOException(s)); + } + } + + public static void noNullElements(Object[] objs, String s) { + if(objs == null) { + throwException(new IOException("Argument is null!")); + } + for(int i = 0; i < objs.length; i++) { + if(objs[i] == null) { + throwException(new IOException(s)); + } + } + } + + @SuppressWarnings("unchecked") + private static void throwException(Throwable exception, Object dummy) throws T{ + throw (T) exception; + } + + public static void throwException(Throwable exception) { + Validate.throwException(exception, null); + } +} diff --git a/src/main/java/io/github/thebusybiscuit/sensibletoolbox/helpers/WordUtils.java b/src/main/java/io/github/thebusybiscuit/sensibletoolbox/helpers/WordUtils.java new file mode 100644 index 00000000..b3c9b8ae --- /dev/null +++ b/src/main/java/io/github/thebusybiscuit/sensibletoolbox/helpers/WordUtils.java @@ -0,0 +1,19 @@ +package io.github.thebusybiscuit.sensibletoolbox.helpers; + +import javax.annotation.Nonnull; + +public class WordUtils { + public static String wrap(@Nonnull String s, int w) { + StringBuilder sb = new StringBuilder(); + + char[] ch = s.toCharArray(); + for(int i = 0; i < ch.length; i++) { + int a = i % w; + sb.append(ch[i]); + if(a == w-1) { + sb.append("\n"); + } + } + return sb.toString(); + } +} diff --git a/src/main/java/io/github/thebusybiscuit/sensibletoolbox/items/EnderTuner.java b/src/main/java/io/github/thebusybiscuit/sensibletoolbox/items/EnderTuner.java index 6f5009f2..1992caf5 100644 --- a/src/main/java/io/github/thebusybiscuit/sensibletoolbox/items/EnderTuner.java +++ b/src/main/java/io/github/thebusybiscuit/sensibletoolbox/items/EnderTuner.java @@ -2,7 +2,7 @@ import javax.annotation.Nonnull; -import org.apache.commons.lang.math.IntRange; +import io.github.thebusybiscuit.sensibletoolbox.helpers.IntRange; import org.bukkit.ChatColor; import org.bukkit.Material; import org.bukkit.block.Block; diff --git a/src/main/java/io/github/thebusybiscuit/sensibletoolbox/listeners/GeneralListener.java b/src/main/java/io/github/thebusybiscuit/sensibletoolbox/listeners/GeneralListener.java index 1a7785af..6eb385c3 100644 --- a/src/main/java/io/github/thebusybiscuit/sensibletoolbox/listeners/GeneralListener.java +++ b/src/main/java/io/github/thebusybiscuit/sensibletoolbox/listeners/GeneralListener.java @@ -3,7 +3,7 @@ import java.util.Iterator; import java.util.concurrent.ThreadLocalRandom; -import org.apache.commons.lang.Validate; +import io.github.thebusybiscuit.sensibletoolbox.helpers.Validate; import org.bukkit.Bukkit; import org.bukkit.Location; import org.bukkit.Material; diff --git a/src/main/java/io/github/thebusybiscuit/sensibletoolbox/utils/BukkitSerialization.java b/src/main/java/io/github/thebusybiscuit/sensibletoolbox/utils/BukkitSerialization.java index 6ffe4857..d9ae576e 100644 --- a/src/main/java/io/github/thebusybiscuit/sensibletoolbox/utils/BukkitSerialization.java +++ b/src/main/java/io/github/thebusybiscuit/sensibletoolbox/utils/BukkitSerialization.java @@ -6,7 +6,7 @@ import javax.annotation.Nonnull; -import org.apache.commons.lang.Validate; +import io.github.thebusybiscuit.sensibletoolbox.helpers.Validate; import org.bukkit.Bukkit; import org.bukkit.inventory.Inventory; import org.bukkit.inventory.ItemStack; diff --git a/src/main/java/io/github/thebusybiscuit/sensibletoolbox/utils/ColoredMaterial.java b/src/main/java/io/github/thebusybiscuit/sensibletoolbox/utils/ColoredMaterial.java index 2891c721..0502fb5e 100644 --- a/src/main/java/io/github/thebusybiscuit/sensibletoolbox/utils/ColoredMaterial.java +++ b/src/main/java/io/github/thebusybiscuit/sensibletoolbox/utils/ColoredMaterial.java @@ -6,7 +6,7 @@ import javax.annotation.Nonnull; -import org.apache.commons.lang.Validate; +import io.github.thebusybiscuit.sensibletoolbox.helpers.Validate; import org.bukkit.DyeColor; import org.bukkit.Material; diff --git a/src/main/java/io/github/thebusybiscuit/sensibletoolbox/utils/STBUtil.java b/src/main/java/io/github/thebusybiscuit/sensibletoolbox/utils/STBUtil.java index 9ef689cd..1f987bac 100644 --- a/src/main/java/io/github/thebusybiscuit/sensibletoolbox/utils/STBUtil.java +++ b/src/main/java/io/github/thebusybiscuit/sensibletoolbox/utils/STBUtil.java @@ -13,8 +13,8 @@ import javax.annotation.Nonnull; import javax.annotation.Nullable; -import org.apache.commons.lang.StringUtils; -import org.apache.commons.lang.Validate; +import io.github.thebusybiscuit.sensibletoolbox.helpers.StringUtils; +import io.github.thebusybiscuit.sensibletoolbox.helpers.Validate; import org.bukkit.Bukkit; import org.bukkit.ChatColor; import org.bukkit.DyeColor; diff --git a/src/main/java/io/github/thebusybiscuit/sensibletoolbox/utils/VanillaInventoryUtils.java b/src/main/java/io/github/thebusybiscuit/sensibletoolbox/utils/VanillaInventoryUtils.java index f0d37407..45863b64 100644 --- a/src/main/java/io/github/thebusybiscuit/sensibletoolbox/utils/VanillaInventoryUtils.java +++ b/src/main/java/io/github/thebusybiscuit/sensibletoolbox/utils/VanillaInventoryUtils.java @@ -8,7 +8,7 @@ import javax.annotation.Nonnull; import javax.annotation.Nullable; -import org.apache.commons.lang.math.IntRange; +import io.github.thebusybiscuit.sensibletoolbox.helpers.IntRange; import org.bukkit.Bukkit; import org.bukkit.Material; import org.bukkit.block.Block; diff --git a/src/main/java/me/desht/dhutils/blocks/RelativePosition.java b/src/main/java/me/desht/dhutils/blocks/RelativePosition.java index ce2224f0..c63d6a53 100644 --- a/src/main/java/me/desht/dhutils/blocks/RelativePosition.java +++ b/src/main/java/me/desht/dhutils/blocks/RelativePosition.java @@ -1,6 +1,6 @@ package me.desht.dhutils.blocks; -import org.apache.commons.lang.Validate; +import io.github.thebusybiscuit.sensibletoolbox.helpers.Validate; import io.github.thebusybiscuit.sensibletoolbox.api.items.BaseSTBBlock; diff --git a/src/main/java/me/desht/dhutils/commands/AbstractCommand.java b/src/main/java/me/desht/dhutils/commands/AbstractCommand.java index beadd651..7e5a25dc 100644 --- a/src/main/java/me/desht/dhutils/commands/AbstractCommand.java +++ b/src/main/java/me/desht/dhutils/commands/AbstractCommand.java @@ -12,8 +12,8 @@ import javax.annotation.Nonnull; import javax.annotation.ParametersAreNonnullByDefault; -import org.apache.commons.lang.StringUtils; -import org.apache.commons.lang.Validate; +import io.github.thebusybiscuit.sensibletoolbox.helpers.StringUtils; +import io.github.thebusybiscuit.sensibletoolbox.helpers.Validate; import org.bukkit.command.CommandSender; import org.bukkit.configuration.ConfigurationSection; import org.bukkit.entity.Player; diff --git a/src/main/java/me/desht/dhutils/commands/CommandManager.java b/src/main/java/me/desht/dhutils/commands/CommandManager.java index 0f3ca679..ad7e61fa 100644 --- a/src/main/java/me/desht/dhutils/commands/CommandManager.java +++ b/src/main/java/me/desht/dhutils/commands/CommandManager.java @@ -8,7 +8,7 @@ import javax.annotation.Nonnull; -import org.apache.commons.lang.Validate; +import io.github.thebusybiscuit.sensibletoolbox.helpers.Validate; import org.bukkit.Sound; import org.bukkit.command.Command; import org.bukkit.command.CommandSender;