Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

1.19-1.20 successful load #121

Closed
wants to merge 10 commits into from
17 changes: 9 additions & 8 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
<maven.compiler.target>1.8</maven.compiler.target>

<!-- Spigot properties -->
<spigot.version>1.18.1</spigot.version>
<spigot.version>1.20</spigot.version>
<spigot.javadocs>https://hub.spigotmc.org/javadocs/spigot/</spigot.javadocs>

<!-- Default settings for sonarcloud.io -->
Expand Down Expand Up @@ -80,7 +80,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.1</version>
<version>3.11.0</version>
<configuration>
<excludes>
<!-- package info files are only important for Javadocs -->
Expand Down Expand Up @@ -108,7 +108,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>3.2.4</version>
<version>3.3.0</version>

<configuration>
<relocations>
Expand Down Expand Up @@ -221,16 +221,16 @@
</dependency>

<dependency>
<groupId>com.github.TheBusyBiscuit</groupId>
<groupId>com.github.Slimefun</groupId>
<artifactId>Slimefun4</artifactId>
<version>RC-30</version>
<version>RC-33</version>
<scope>provided</scope>
</dependency>

<dependency>
<groupId>io.github.baked-libs</groupId>
<groupId>com.github.baked-libs.dough</groupId>
<artifactId>dough-api</artifactId>
<version>1.1.1</version>
<version>39856a32c4</version>
<scope>compile</scope>
</dependency>

Expand All @@ -244,10 +244,11 @@
<dependency>
<groupId>org.bstats</groupId>
<artifactId>bstats-bukkit</artifactId>
<version>2.2.1</version>
<version>3.0.1</version>
<scope>compile</scope>
</dependency>


<dependency>
<groupId>com.sk89q.worldedit</groupId>
<artifactId>worldedit-bukkit</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
import javax.annotation.Nonnull;
import javax.annotation.ParametersAreNonnullByDefault;

import org.apache.commons.lang.Validate;
import com.google.common.base.Preconditions;
import org.bstats.bukkit.Metrics;
import org.bukkit.Server;
import org.bukkit.command.Command;
Expand Down Expand Up @@ -250,7 +250,7 @@ public void onEnable() {
RecipeUtil.setupRecipes();
RecipeBook.buildRecipes();

protectionManager = new ProtectionManager(getServer());
protectionManager = new ProtectionManager(this);
});

getServer().getScheduler().runTaskTimer(this, LocationManager.getManager()::tick, 1L, 1L);
Expand Down Expand Up @@ -544,9 +544,9 @@ public List<String> onTabComplete(CommandSender sender, Command command, String
@Override
public <T> T onConfigurationValidate(ConfigurationManager configurationManager, String key, T oldVal, T newVal) {
if (key.equals("save_interval")) {
Validate.isTrue((Integer) newVal > 0, "save_interval must be > 0");
Preconditions.checkArgument((Integer) newVal > 0, "save_interval must be > 0");
} else if (key.equals("energy.tick_rate")) {
Validate.isTrue((Integer) newVal > 0, "energy.tick_rate must be > 0");
Preconditions.checkArgument((Integer) newVal > 0, "energy.tick_rate must be > 0");
} else if (key.startsWith("gui.texture.")) {
STBUtil.parseMaterialSpec(newVal.toString());
} else if (key.equals("default_access")) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import javax.annotation.Nonnull;

import org.apache.commons.lang.Validate;
import com.google.common.base.Preconditions;
import org.bukkit.Server;

import io.github.thebusybiscuit.sensibletoolbox.SensibleToolboxPlugin;
Expand Down Expand Up @@ -50,6 +50,18 @@ public enum MinecraftVersion {
*
*/
MINECRAFT_1_18(18, "1.18.x"),
/**
* This constant represents Minecraft (Java Edition) Version 1.19
* (The "The Wild Update" Update)
*
*/
MINECRAFT_1_19(19, "1.19.x"),
/**
* This constant represents Minecraft (Java Edition) Version 1.20
* (The "Trails and Tales" Update)
*
*/
MINECRAFT_1_20(20, "1.20.x"),

/**
* This constant represents an exceptional state in which we were unable
Expand Down Expand Up @@ -151,7 +163,7 @@ public boolean isMinecraftVersion(int minecraftVersion) {
* @return Whether this {@link MinecraftVersion} is newer or equal to the given {@link MinecraftVersion}
*/
public boolean isAtLeast(@Nonnull MinecraftVersion version) {
Validate.notNull(version, "A Minecraft version cannot be null!");
Preconditions.checkArgument(version != null, "A Minecraft version cannot be null!");

if (this == UNKNOWN) {
return false;
Expand All @@ -171,7 +183,7 @@ public boolean isAtLeast(@Nonnull MinecraftVersion version) {
* @return Whether this {@link MinecraftVersion} is older than the given one
*/
public boolean isBefore(@Nonnull MinecraftVersion version) {
Validate.notNull(version, "A Minecraft version cannot be null!");
Preconditions.checkArgument(version != null, "A Minecraft version cannot be null!");

if (this == UNKNOWN) {
return true;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package io.github.thebusybiscuit.sensibletoolbox.api.filters;

import org.apache.commons.lang.Validate;
import com.google.common.base.Preconditions;
import org.bukkit.inventory.ItemStack;

import java.util.ArrayList;
Expand Down Expand Up @@ -95,7 +95,7 @@ public void addItem(@Nonnull ItemStack stack) {
* @return true if the filter should pass the item; false otherwise
*/
public boolean shouldPass(@Nonnull ItemStack stack) {
Validate.notNull(stack, "Cannot filter null ItemStacks");
Preconditions.checkArgument(stack != null, "Cannot filter null ItemStacks");

if (filteredItems.isEmpty()) {
return !whiteList;
Expand Down Expand Up @@ -197,7 +197,7 @@ public FilterType getFilterType() {
* the filtering type
*/
public void setFilterType(@Nonnull FilterType filterType) {
Validate.notNull(filterType, "FilterType cannot be null!");
Preconditions.checkArgument(filterType != null, "FilterType cannot be null!");
this.filterType = filterType;
}
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package io.github.thebusybiscuit.sensibletoolbox.api.gui.gadgets;

import org.apache.commons.lang.Validate;
import com.google.common.base.Preconditions;
import org.bukkit.Color;
import org.bukkit.Material;
import org.bukkit.inventory.ItemStack;
Expand Down Expand Up @@ -31,7 +31,7 @@ public class ChargeMeter extends MonitorGadget {
public ChargeMeter(InventoryGUI gui) {
super(gui);

Validate.isTrue(getOwner() instanceof ChargeableBlock, "Attempt to add charge meter to non-chargeable block!");
Preconditions.checkArgument(getOwner() instanceof ChargeableBlock, "Attempt to add charge meter to non-chargeable block!");

chargeable = (ChargeableBlock) getOwner();
this.indicator = new ItemStack(Material.LEATHER_HELMET);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import java.util.HashMap;
import java.util.Map;

import org.apache.commons.lang.Validate;
import com.google.common.base.Preconditions;
import org.bukkit.ChatColor;
import org.bukkit.Material;
import org.bukkit.block.BlockFace;
Expand All @@ -30,8 +30,8 @@ public class DirectionGadget extends ClickableGadget {
public DirectionGadget(InventoryGUI gui, int slot, ItemStack mainTexture) {
super(gui, slot);

Validate.isTrue(gui.getOwningItem() instanceof Directional, "DirectionalGadget can only be used on a directional item!");
Validate.isTrue(slot >= 9 && slot < gui.getInventory().getSize() - 9 && slot % 9 > 0 && slot % 9 < 8, "DirectionalGadget can't be placed at edge of inventory window!");
Preconditions.checkArgument(gui.getOwningItem() instanceof Directional, "DirectionalGadget can only be used on a directional item!");
Preconditions.checkArgument(slot >= 9 && slot < gui.getInventory().getSize() - 9 && slot % 9 > 0 && slot % 9 < 8, "DirectionalGadget can't be placed at edge of inventory window!");

this.mainTexture = mainTexture;
this.allowSelf = true;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package io.github.thebusybiscuit.sensibletoolbox.api.gui.gadgets;

import org.apache.commons.lang.Validate;
import com.google.common.base.Preconditions;
import org.bukkit.ChatColor;
import org.bukkit.Material;
import org.bukkit.block.BlockFace;
Expand Down Expand Up @@ -33,7 +33,7 @@ public class EnergyFlowGadget extends CyclerGadget<EnergyFlow> {
public EnergyFlowGadget(InventoryGUI gui, int slot, BlockFace face) {
super(gui, slot, face.toString());

Validate.isTrue(gui.getOwningItem() instanceof BatteryBox, "Energy flow gadget can only be used on a battery box!");
Preconditions.checkArgument(gui.getOwningItem() instanceof BatteryBox, "Energy flow gadget can only be used on a battery box!");

this.face = face;
add(EnergyFlow.IN, ChatColor.DARK_AQUA, Material.BLUE_WOOL, "Device accepts energy", "on this face");
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package io.github.thebusybiscuit.sensibletoolbox.api.gui.gadgets;

import org.apache.commons.lang.Validate;
import com.google.common.base.Preconditions;
import org.bukkit.ChatColor;
import org.bukkit.Material;

Expand All @@ -27,7 +27,7 @@ public class FilterTypeGadget extends CyclerGadget<FilterType> {
public FilterTypeGadget(InventoryGUI gui, int slot) {
super(gui, slot, "Filter Type");

Validate.isTrue(gui.getOwningItem() instanceof Filtering, "Filter Type gadget can only be added to filtering items!");
Preconditions.checkArgument(gui.getOwningItem() instanceof Filtering, "Filter Type gadget can only be added to filtering items!");

add(FilterType.MATERIAL, ChatColor.GRAY, Material.STONE, "Match material only");
add(FilterType.ITEM_META, ChatColor.LIGHT_PURPLE, Material.ENCHANTED_BOOK, "Match material, block metadata", "and item metadata (NBT)");
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package io.github.thebusybiscuit.sensibletoolbox.api.gui.gadgets;

import org.apache.commons.lang.Validate;
import com.google.common.base.Preconditions;

import io.github.thebusybiscuit.sensibletoolbox.api.LightMeterHolder;
import io.github.thebusybiscuit.sensibletoolbox.api.gui.InventoryGUI;
Expand All @@ -22,7 +22,7 @@ public class LightMeter extends MonitorGadget {
*/
public LightMeter(InventoryGUI gui) {
super(gui);
Validate.isTrue(gui.getOwningBlock() instanceof LightMeterHolder, "Attempt to install light meter in non-lightmeter-holder block!");
Preconditions.checkArgument(gui.getOwningBlock() instanceof LightMeterHolder, "Attempt to install light meter in non-lightmeter-holder block!");
}

@Override
Expand Down
Original file line number Diff line number Diff line change
@@ -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 com.google.common.base.Preconditions;

import org.bukkit.ChatColor;
import org.bukkit.Material;
import org.bukkit.entity.Player;
Expand All @@ -12,6 +12,7 @@
import io.github.thebusybiscuit.sensibletoolbox.api.gui.GUIUtil;
import io.github.thebusybiscuit.sensibletoolbox.api.gui.InventoryGUI;
import io.github.thebusybiscuit.sensibletoolbox.utils.STBUtil;
import io.github.thebusybiscuit.sensibletoolbox.utils.IntRange;

/**
* A GUI gadget which allows an integer value to be displayed
Expand Down Expand Up @@ -67,7 +68,7 @@ public void onClicked(InventoryClickEvent event) {
} else if (event.isRightClick()) {
newValue += event.isShiftClick() ? altIncr : incr;
}
newValue = Math.max(Math.min(newValue, range.getMaximumInteger()), range.getMinimumInteger());
newValue = Math.max(Math.min(newValue, range.getMaximumInt()), range.getMinimumInt());
if (newValue != value && callback.run(newValue)) {
value = newValue;
event.setCurrentItem(getTexture());
Expand All @@ -86,7 +87,7 @@ public void onClicked(InventoryClickEvent event) {
* the new value
*/
public void setValue(int value) {
Validate.isTrue(range.containsInteger(value), "Value " + value + " is out of range");
Preconditions.checkArgument(range.containsInteger(value), "Value " + value + " is out of range");
this.value = value;
updateGUI();
}
Expand All @@ -95,8 +96,8 @@ public void setValue(int value) {
public ItemStack getTexture() {
ItemMeta meta = icon.getItemMeta();
meta.setDisplayName(ChatColor.YELLOW + title + ": " + ChatColor.AQUA + value);
String max = range.getMaximumInteger() == Integer.MAX_VALUE ? "\u221e" : Integer.toString(range.getMaximumInteger());
String min = range.getMaximumInteger() == Integer.MIN_VALUE ? "-\u221e" : Integer.toString(range.getMinimumInteger());
String max = range.getMaximumInt() == Integer.MAX_VALUE ? "\u221e" : Integer.toString(range.getMaximumInt());
String min = range.getMaximumInt() == Integer.MIN_VALUE ? "-\u221e" : Integer.toString(range.getMinimumInt());
String[] lore = { "Valid value range: " + min + "-" + max, "L-Click: -" + incr, "R-Click: +" + incr, "With Shift held, +/-" + altIncr };
meta.setLore(GUIUtil.makeLore(lore));
icon.setItemMeta(meta);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package io.github.thebusybiscuit.sensibletoolbox.api.gui.gadgets;

import org.apache.commons.lang.Validate;
import com.google.common.base.Preconditions;
import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.meta.ItemMeta;

Expand Down Expand Up @@ -31,13 +31,13 @@ public class ProgressMeter extends MonitorGadget {
public ProgressMeter(InventoryGUI gui) {
super(gui);

Validate.isTrue(getGUI().getOwningBlock() instanceof AbstractProcessingMachine, "Attempt to install progress meter in non-processing machine " + getGUI().getOwningBlock());
Preconditions.checkArgument(getGUI().getOwningBlock() instanceof AbstractProcessingMachine, "Attempt to install progress meter in non-processing machine " + getGUI().getOwningBlock());

machine = (AbstractProcessingMachine) getGUI().getOwningBlock();
Validate.isTrue(machine.getProgressCounterSlot() > 0 || machine.getProgressItemSlot() > 0, "At least one of counter slot and item slot must be >= 0!");
Preconditions.checkArgument(machine.getProgressCounterSlot() > 0 || machine.getProgressItemSlot() > 0, "At least one of counter slot and item slot must be >= 0!");

this.progressIcon = machine.getProgressIcon().clone();
Validate.isTrue(progressIcon.getType().getMaxDurability() > 0, "Material " + progressIcon + " doesn't have a durability!");
Preconditions.checkArgument(progressIcon.getType().getMaxDurability() > 0, "Material " + progressIcon + " doesn't have a durability!");
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
import javax.annotation.Nonnull;
import javax.annotation.Nullable;

import org.apache.commons.lang.Validate;
import com.google.common.base.Preconditions;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.GameMode;
Expand Down Expand Up @@ -519,9 +519,9 @@ public final PersistableLocation getPersistableLocation() {
* if the new location is null or the block's current location is non-null
*/
public final void setLocation(BlockAccess blockAccess, Location loc) {
Validate.notNull(blockAccess, "Do not call this method directly");
Validate.notNull(loc, "Location must not be null");
Validate.isTrue(persistableLocation == null, "Attempt to change the location of existing STB block @ " + persistableLocation);
Preconditions.checkArgument(blockAccess != null, "Do not call this method directly");
Preconditions.checkArgument(loc != null, "Location must not be null");
Preconditions.checkArgument(persistableLocation == null, "Attempt to change the location of existing STB block @ " + persistableLocation);
persistableLocation = new PersistableLocation(loc);
}

Expand Down Expand Up @@ -565,7 +565,7 @@ public Block getAuxiliaryBlock(Location loc, RelativePosition pos) {
* the block's new location
*/
public final void moveTo(BlockAccess blockAccess, final Location oldLoc, final Location newLoc) {
Validate.notNull(blockAccess, "Don't call this method directly");
Preconditions.checkArgument(blockAccess != null, "Don't call this method directly");

oldLoc.getBlock().removeMetadata(BaseSTBBlock.STB_BLOCK, SensibleToolbox.getPluginInstance());
for (RelativePosition pos : getBlockStructure()) {
Expand Down Expand Up @@ -637,7 +637,7 @@ public final void moveTo(BlockAccess blockAccess, final Location oldLoc, final L
* is being restored from persisted data
*/
public final void preRegister(BlockAccess blockAccess, Location location, boolean isPlacing) {
Validate.notNull(blockAccess, "Don't call this method directly");
Preconditions.checkArgument(blockAccess != null, "Don't call this method directly");
location.getBlock().setMetadata(BaseSTBBlock.STB_BLOCK, new FixedMetadataValue(SensibleToolboxPlugin.getInstance(), this));

for (RelativePosition pos : getBlockStructure()) {
Expand Down Expand Up @@ -1045,9 +1045,9 @@ private boolean attachLabelSign(PlayerInteractEvent event) {
}

private boolean placeLabelSign(@Nonnull Block signBlock, @Nonnull BlockFace face, @Nonnull Material signType) {
Validate.notNull(signBlock, "The Sign Block cannot be null");
Validate.notNull(face, "The Face cannot be null");
Validate.notNull(signType, "The Sign Type cannot be null");
Preconditions.checkArgument(signBlock != null, "The Sign Block cannot be null");
Preconditions.checkArgument(face != null, "The Face cannot be null");
Preconditions.checkArgument(signType != null, "The Sign Type cannot be null");

if (!signBlock.isEmpty() && !Tag.WALL_SIGNS.isTagged(signBlock.getType())) {
// something in the way!
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
import javax.annotation.Nullable;
import javax.annotation.ParametersAreNonnullByDefault;

import org.apache.commons.lang.Validate;
import com.google.common.base.Preconditions;
import org.bukkit.ChatColor;
import org.bukkit.Keyed;
import org.bukkit.Material;
Expand Down Expand Up @@ -110,7 +110,7 @@ protected void updateHeldItemStack(Player player, EquipmentSlot hand) {
*/
public final boolean checkPlayerPermission(@Nonnull Permissible player, @Nonnull ItemAction action) {
String prefix = SensibleToolboxPlugin.getInstance().getItemRegistry().getPermissionPrefix(this);
Validate.notNull(prefix, "Can't determine permission node prefix for " + getItemTypeID());
Preconditions.checkArgument(prefix != null, "Can't determine permission node prefix for " + getItemTypeID());
return player.hasPermission(prefix + "." + action.getNode() + "." + getItemTypeID());
}

Expand Down
Loading