@@ -1,8 +1,8 @@
|
||||
package org.bukkit.event.player;
|
||||
|
||||
import com.google.common.base.Preconditions;
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
import org.apache.commons.lang.Validate;
|
||||
import org.bukkit.Warning;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.Cancellable;
|
||||
@@ -78,7 +78,7 @@ public class PlayerChatEvent extends PlayerEvent implements Cancellable {
|
||||
* @param player New player which this event will execute as
|
||||
*/
|
||||
public void setPlayer(@NotNull final Player player) {
|
||||
Validate.notNull(player, "Player cannot be null");
|
||||
Preconditions.checkArgument(player != null, "Player cannot be null");
|
||||
this.player = player;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package org.bukkit.event.player;
|
||||
|
||||
import com.google.common.base.Preconditions;
|
||||
import java.util.Collection;
|
||||
import org.apache.commons.lang.Validate;
|
||||
import org.bukkit.Warning;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.HandlerList;
|
||||
@@ -22,8 +22,8 @@ public class PlayerChatTabCompleteEvent extends PlayerEvent {
|
||||
|
||||
public PlayerChatTabCompleteEvent(@NotNull final Player who, @NotNull final String message, @NotNull final Collection<String> completions) {
|
||||
super(who);
|
||||
Validate.notNull(message, "Message cannot be null");
|
||||
Validate.notNull(completions, "Completions cannot be null");
|
||||
Preconditions.checkArgument(message != null, "Message cannot be null");
|
||||
Preconditions.checkArgument(completions != null, "Completions cannot be null");
|
||||
this.message = message;
|
||||
int i = message.lastIndexOf(' ');
|
||||
if (i < 0) {
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
package org.bukkit.event.player;
|
||||
|
||||
import com.google.common.base.Preconditions;
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
import org.apache.commons.lang.Validate;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.Cancellable;
|
||||
import org.bukkit.event.HandlerList;
|
||||
@@ -96,8 +96,8 @@ public class PlayerCommandPreprocessEvent extends PlayerEvent implements Cancell
|
||||
* @throws IllegalArgumentException if command is null or empty
|
||||
*/
|
||||
public void setMessage(@NotNull String command) throws IllegalArgumentException {
|
||||
Validate.notNull(command, "Command cannot be null");
|
||||
Validate.notEmpty(command, "Command cannot be empty");
|
||||
Preconditions.checkArgument(command != null, "Command cannot be null");
|
||||
Preconditions.checkArgument(!command.isEmpty(), "Command cannot be empty");
|
||||
this.message = command;
|
||||
}
|
||||
|
||||
@@ -108,7 +108,7 @@ public class PlayerCommandPreprocessEvent extends PlayerEvent implements Cancell
|
||||
* @throws IllegalArgumentException if the player provided is null
|
||||
*/
|
||||
public void setPlayer(@NotNull final Player player) throws IllegalArgumentException {
|
||||
Validate.notNull(player, "Player cannot be null");
|
||||
Preconditions.checkArgument(player != null, "Player cannot be null");
|
||||
this.player = player;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
package org.bukkit.event.player;
|
||||
|
||||
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;
|
||||
@@ -24,9 +24,9 @@ public class PlayerEditBookEvent extends PlayerEvent implements Cancellable {
|
||||
public PlayerEditBookEvent(@NotNull Player who, int slot, @NotNull BookMeta previousBookMeta, @NotNull BookMeta newBookMeta, boolean isSigning) {
|
||||
super(who);
|
||||
|
||||
Validate.isTrue(slot >= -1 && slot <= 8, "Slot must be in range (-1)-8 inclusive");
|
||||
Validate.notNull(previousBookMeta, "Previous book meta must not be null");
|
||||
Validate.notNull(newBookMeta, "New book meta must not be null");
|
||||
Preconditions.checkArgument(slot >= -1 && slot <= 8, "Slot must be in range (-1)-8 inclusive");
|
||||
Preconditions.checkArgument(previousBookMeta != null, "Previous book meta must not be null");
|
||||
Preconditions.checkArgument(newBookMeta != null, "New book meta must not be null");
|
||||
|
||||
Bukkit.getItemFactory().equals(previousBookMeta, newBookMeta);
|
||||
|
||||
@@ -86,7 +86,7 @@ public class PlayerEditBookEvent extends PlayerEvent implements Cancellable {
|
||||
* @throws IllegalArgumentException if the new book meta is null
|
||||
*/
|
||||
public void setNewBookMeta(@NotNull BookMeta newBookMeta) throws IllegalArgumentException {
|
||||
Validate.notNull(newBookMeta, "New book meta must not be null");
|
||||
Preconditions.checkArgument(newBookMeta != null, "New book meta must not be null");
|
||||
Bukkit.getItemFactory().equals(newBookMeta, null);
|
||||
this.newBookMeta = newBookMeta.clone();
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
package org.bukkit.event.player;
|
||||
|
||||
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.HandlerList;
|
||||
@@ -43,8 +43,8 @@ public class PlayerRespawnEvent extends PlayerEvent {
|
||||
* @param respawnLocation new location for the respawn
|
||||
*/
|
||||
public void setRespawnLocation(@NotNull Location respawnLocation) {
|
||||
Validate.notNull(respawnLocation, "Respawn location can not be null");
|
||||
Validate.notNull(respawnLocation.getWorld(), "Respawn world can not be null");
|
||||
Preconditions.checkArgument(respawnLocation != null, "Respawn location can not be null");
|
||||
Preconditions.checkArgument(respawnLocation.getWorld() != null, "Respawn world can not be null");
|
||||
|
||||
this.respawnLocation = respawnLocation;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user