Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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.slimefun4.implementation.Slimefun;
Expand Down Expand Up @@ -233,7 +233,7 @@ public boolean isMinecraftVersion(int minecraftVersion, int patchVersion) {
* @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.checkNotNull(version, "A Minecraft version cannot be null!");

if (this == UNKNOWN) {
return false;
Expand Down Expand Up @@ -268,7 +268,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.checkNotNull(version, "A Minecraft version cannot be null!");

if (this == UNKNOWN) {
return true;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import javax.annotation.Nonnull;
import javax.annotation.Nullable;

import org.apache.commons.lang.Validate;
import com.google.common.base.Preconditions;
import org.bukkit.plugin.Plugin;
import org.bukkit.plugin.PluginDescriptionFile;
import org.bukkit.plugin.java.JavaPlugin;
Expand Down Expand Up @@ -86,7 +86,7 @@ public interface SlimefunAddon {
* @return Whether this {@link SlimefunAddon} depends on the given {@link Plugin}
*/
default boolean hasDependency(@Nonnull String dependency) {
Validate.notNull(dependency, "The dependency cannot be null");
Preconditions.checkNotNull(dependency, "The dependency cannot be null");

// Well... it cannot depend on itself but you get the idea.
if (getJavaPlugin().getName().equalsIgnoreCase(dependency)) {
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 io.github.bakedlibs.dough.common.CommonPatterns;

Expand Down Expand Up @@ -45,7 +45,7 @@ public enum SlimefunBranch {
private final boolean official;

SlimefunBranch(@Nonnull String name, boolean official) {
Validate.notNull(name, "The branch name cannot be null");
Preconditions.checkNotNull(name, "The branch name cannot be null");

this.name = name;
this.official = official;
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.event.Cancellable;
import org.bukkit.event.Event;
import org.bukkit.event.HandlerList;
Expand Down Expand Up @@ -31,9 +31,9 @@ public class AsyncAutoEnchanterProcessEvent extends Event implements Cancellable
public AsyncAutoEnchanterProcessEvent(@Nonnull ItemStack item, @Nonnull ItemStack enchantedBook, @Nonnull BlockMenu menu) {
super(true);

Validate.notNull(item, "The item to enchant cannot be null!");
Validate.notNull(enchantedBook, "The enchanted book to enchant cannot be null!");
Validate.notNull(menu, "The menu of auto-enchanter cannot be null!");
Preconditions.checkNotNull(item, "The item to enchant cannot be null!");
Preconditions.checkNotNull(enchantedBook, "The enchanted book to enchant cannot be null!");
Preconditions.checkNotNull(menu, "The menu of auto-enchanter cannot be null!");

this.item = item;
this.enchantedBook = enchantedBook;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

import javax.annotation.Nonnull;

import org.apache.commons.lang.Validate;
import com.google.common.base.Preconditions;
import org.bukkit.entity.Player;
import org.bukkit.event.Event;
import org.bukkit.event.HandlerList;
Expand Down Expand Up @@ -32,7 +32,7 @@ public class AsyncProfileLoadEvent extends Event {
public AsyncProfileLoadEvent(@Nonnull PlayerProfile profile) {
super(true);

Validate.notNull(profile, "The Profile cannot be null");
Preconditions.checkNotNull(profile, "The Profile cannot be null");

this.uniqueId = profile.getUUID();
this.profile = profile;
Expand All @@ -56,8 +56,8 @@ public PlayerProfile getProfile() {
* The {@link PlayerProfile}
*/
public void setProfile(@Nonnull PlayerProfile profile) {
Validate.notNull(profile, "The PlayerProfile cannot be null!");
Validate.isTrue(profile.getUUID().equals(uniqueId), "Cannot inject a PlayerProfile with a different UUID");
Preconditions.checkNotNull(profile, "The PlayerProfile cannot be null!");
Preconditions.checkArgument(profile.getUUID().equals(uniqueId), "Cannot inject a PlayerProfile with a different UUID");

this.profile = profile;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import javax.annotation.Nonnull;
import javax.annotation.ParametersAreNonnullByDefault;

import org.apache.commons.lang.Validate;
import com.google.common.base.Preconditions;
import org.bukkit.block.Block;
import org.bukkit.event.Cancellable;
import org.bukkit.event.Event;
Expand Down Expand Up @@ -75,7 +75,7 @@ public ItemStack getItemStack() {
* The {@link ItemStack} to be placed
*/
public void setItemStack(@Nonnull ItemStack item) {
Validate.notNull(item, "The ItemStack must not be null!");
Preconditions.checkNotNull(item, "The ItemStack must not be null!");

if (!locked) {
this.placedItem = item;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import javax.annotation.Nonnull;
import javax.annotation.ParametersAreNonnullByDefault;

import org.apache.commons.lang.Validate;
import com.google.common.base.Preconditions;
import org.bukkit.block.Block;
import org.bukkit.entity.Player;
import org.bukkit.event.Cancellable;
Expand Down Expand Up @@ -63,7 +63,7 @@ public Vector getVelocity() {
* The {@link Vector} velocity to apply
*/
public void setVelocity(@Nonnull Vector velocity) {
Validate.notNull(velocity);
Preconditions.checkNotNull(velocity);
this.velocity = velocity;
}

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

import org.apache.commons.lang.Validate;
import com.google.common.base.Preconditions;
import org.bukkit.entity.Player;
import org.bukkit.event.Cancellable;
import org.bukkit.event.Event;
Expand Down Expand Up @@ -84,8 +84,8 @@ public ItemStack getConsumedItem() {
* The new {@link ItemStack}
*/
public void setConsumedItem(@Nonnull ItemStack item) {
Validate.notNull(item, "The consumed Item cannot be null!");
Validate.isTrue(item.getItemMeta() instanceof PotionMeta, "The item must be a potion!");
Preconditions.checkNotNull(item, "The consumed Item cannot be null!");
Preconditions.checkArgument(item.getItemMeta() instanceof PotionMeta, "The item must be a potion!");

this.consumedItem = item;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import javax.annotation.Nonnull;
import javax.annotation.ParametersAreNonnullByDefault;

import org.apache.commons.lang.Validate;
import com.google.common.base.Preconditions;
import org.bukkit.block.Block;
import org.bukkit.entity.Player;
import org.bukkit.event.Cancellable;
Expand Down Expand Up @@ -38,10 +38,10 @@ public class ExplosiveToolBreakBlocksEvent extends PlayerEvent implements Cancel
public ExplosiveToolBreakBlocksEvent(Player player, Block block, List<Block> blocks, ItemStack item, ExplosiveTool explosiveTool) {
super(player);

Validate.notNull(block, "The center block cannot be null!");
Validate.notNull(blocks, "Blocks cannot be null");
Validate.notNull(item, "Item cannot be null");
Validate.notNull(explosiveTool, "ExplosiveTool cannot be null");
Preconditions.checkNotNull(block, "The center block cannot be null!");
Preconditions.checkNotNull(blocks, "Blocks cannot be null");
Preconditions.checkNotNull(item, "Item cannot be null");
Preconditions.checkNotNull(explosiveTool, "ExplosiveTool cannot be null");

this.mainBlock = block;
this.additionalBlocks = blocks;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import javax.annotation.Nonnull;
import javax.annotation.ParametersAreNonnullByDefault;

import org.apache.commons.lang.Validate;
import com.google.common.base.Preconditions;
import org.bukkit.entity.Player;
import org.bukkit.event.Cancellable;
import org.bukkit.event.Event;
Expand Down Expand Up @@ -35,9 +35,9 @@ public class PlayerPreResearchEvent extends Event implements Cancellable {

@ParametersAreNonnullByDefault
public PlayerPreResearchEvent(Player p, Research research, SlimefunItem slimefunItem) {
Validate.notNull(p, "The Player cannot be null");
Validate.notNull(research, "Research cannot be null");
Validate.notNull(slimefunItem, "SlimefunItem cannot be null");
Preconditions.checkNotNull(p, "The Player cannot be null");
Preconditions.checkNotNull(research, "Research cannot be null");
Preconditions.checkNotNull(slimefunItem, "SlimefunItem cannot be null");

this.player = p;
this.research = research;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

import javax.annotation.Nonnull;

import org.apache.commons.lang.Validate;
import com.google.common.base.Preconditions;
import org.bukkit.Material;
import org.bukkit.block.Block;
import org.bukkit.block.BlockFace;
Expand Down Expand Up @@ -168,12 +168,12 @@ public Result useBlock() {
}

public void setUseItem(@Nonnull Result result) {
Validate.notNull(result, "Result cannot be null");
Preconditions.checkNotNull(result, "Result cannot be null");
itemResult = result;
}

public void setUseBlock(@Nonnull Result result) {
Validate.notNull(result, "Result cannot be null");
Preconditions.checkNotNull(result, "Result cannot be null");
blockResult = result;
}

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.Location;
import org.bukkit.event.Event;
import org.bukkit.event.HandlerList;
Expand All @@ -24,8 +24,8 @@ public class ReactorExplodeEvent extends Event {
private final Reactor reactor;

public ReactorExplodeEvent(@Nonnull Location l, @Nonnull Reactor reactor) {
Validate.notNull(l, "A Location must be provided");
Validate.notNull(reactor, "A Reactor cannot be null");
Preconditions.checkNotNull(l, "A Location must be provided");
Preconditions.checkNotNull(reactor, "A Reactor cannot be null");

this.location = l;
this.reactor = reactor;
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.Bukkit;
import org.bukkit.entity.Player;
import org.bukkit.event.Cancellable;
Expand Down Expand Up @@ -30,8 +30,8 @@ public class ResearchUnlockEvent extends Event implements Cancellable {
public ResearchUnlockEvent(@Nonnull Player p, @Nonnull Research research) {
super(!Bukkit.isPrimaryThread());

Validate.notNull(p, "The Player cannot be null");
Validate.notNull(research, "Research cannot be null");
Preconditions.checkNotNull(p, "The Player cannot be null");
Preconditions.checkNotNull(research, "Research cannot be null");

this.player = p;
this.research = research;
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.entity.Player;
import org.bukkit.event.Cancellable;
import org.bukkit.event.Event;
Expand All @@ -28,9 +28,9 @@ public class SlimefunGuideOpenEvent extends Event implements Cancellable {
private boolean cancelled;

public SlimefunGuideOpenEvent(@Nonnull Player p, @Nonnull ItemStack guide, @Nonnull SlimefunGuideMode layout) {
Validate.notNull(p, "The Player cannot be null");
Validate.notNull(guide, "Guide cannot be null");
Validate.notNull(layout, "Layout cannot be null");
Preconditions.checkNotNull(p, "The Player cannot be null");
Preconditions.checkNotNull(guide, "Guide cannot be null");
Preconditions.checkNotNull(layout, "Layout cannot be null");
this.player = p;
this.guide = guide;
this.layout = layout;
Expand Down Expand Up @@ -76,7 +76,7 @@ public SlimefunGuideMode getGuideLayout() {
* The new {@link SlimefunGuideMode}
*/
public void setGuideLayout(@Nonnull SlimefunGuideMode layout) {
Validate.notNull(layout, "You must specify a layout that is not-null!");
Preconditions.checkNotNull(layout, "You must specify a layout that is not-null!");
this.layout = layout;
}

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

import org.apache.commons.lang.Validate;
import com.google.common.base.Preconditions;
import org.bukkit.Location;
import org.bukkit.entity.Player;
import org.bukkit.event.Cancellable;
Expand Down Expand Up @@ -83,7 +83,7 @@ public SlimefunItemSpawnEvent(Location location, ItemStack itemStack, ItemSpawnR
* The {@link Location} where to drop the {@link ItemStack}
*/
public void setLocation(@Nonnull Location location) {
Validate.notNull(location, "The Location cannot be null!");
Preconditions.checkNotNull(location, "The Location cannot be null!");

this.location = location;
}
Expand All @@ -104,8 +104,8 @@ public void setLocation(@Nonnull Location location) {
* The {@link ItemStack} to drop
*/
public void setItemStack(@Nonnull ItemStack itemStack) {
Validate.notNull(itemStack, "Cannot drop null.");
Validate.isTrue(!itemStack.getType().isAir(), "Cannot drop air.");
Preconditions.checkNotNull(itemStack, "Cannot drop null.");
Preconditions.checkArgument(!itemStack.getType().isAir(), "Cannot drop air.");

this.itemStack = itemStack;
}
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.Location;
import org.bukkit.entity.Player;
import org.bukkit.event.Cancellable;
Expand Down Expand Up @@ -37,8 +37,8 @@ public class WaypointCreateEvent extends PlayerEvent implements Cancellable {
public WaypointCreateEvent(@Nonnull Player player, @Nonnull String name, @Nonnull Location location) {
super(player);

Validate.notNull(location, "Location must not be null!");
Validate.notNull(name, "Name must not be null!");
Preconditions.checkNotNull(location, "Location must not be null!");
Preconditions.checkNotNull(name, "Name must not be null!");

this.location = location;
this.name = name;
Expand All @@ -63,7 +63,7 @@ public Location getLocation() {
* The {@link Location} to set
*/
public void setLocation(@Nonnull Location loc) {
Validate.notNull(loc, "Cannot set the Location to null!");
Preconditions.checkNotNull(loc, "Cannot set the Location to null!");
this.location = loc;
}

Expand All @@ -84,7 +84,7 @@ public String getName() {
* The name for this waypoint
*/
public void setName(@Nonnull String name) {
Validate.notEmpty(name, "The name of a waypoint must not be empty!");
Preconditions.checkArgument(name != null && !name.isEmpty(), "The name of a waypoint must not be empty!");
this.name = name;
}

Expand Down
Loading