mirror of
https://github.com/PaperMC/Paper.git
synced 2024-12-28 20:07:41 +01:00
Update to Minecraft 1.19
By: md_5 <git@md-5.net>
This commit is contained in:
parent
9bfa9ca85b
commit
ec575f5252
@ -5,7 +5,7 @@
|
||||
|
||||
<groupId>org.bukkit</groupId>
|
||||
<artifactId>bukkit</artifactId>
|
||||
<version>1.18.2-R0.1-SNAPSHOT</version>
|
||||
<version>1.19-R0.1-SNAPSHOT</version>
|
||||
<packaging>jar</packaging>
|
||||
|
||||
<name>Bukkit</name>
|
||||
@ -31,12 +31,6 @@
|
||||
</distributionManagement>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>commons-lang</groupId>
|
||||
<artifactId>commons-lang</artifactId>
|
||||
<version>2.6</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
<!-- bundled with Minecraft, should be kept in sync -->
|
||||
<dependency>
|
||||
<groupId>com.google.guava</groupId>
|
||||
@ -61,19 +55,19 @@
|
||||
<dependency>
|
||||
<groupId>org.apache.maven</groupId>
|
||||
<artifactId>maven-resolver-provider</artifactId>
|
||||
<version>3.8.4</version>
|
||||
<version>3.8.5</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.maven.resolver</groupId>
|
||||
<artifactId>maven-resolver-connector-basic</artifactId>
|
||||
<version>1.7.2</version>
|
||||
<version>1.8.0</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.maven.resolver</groupId>
|
||||
<artifactId>maven-resolver-transport-http</artifactId>
|
||||
<version>1.7.2</version>
|
||||
<version>1.8.0</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<!-- annotations -->
|
||||
@ -99,7 +93,7 @@
|
||||
<dependency>
|
||||
<groupId>org.ow2.asm</groupId>
|
||||
<artifactId>asm-tree</artifactId>
|
||||
<version>9.2</version>
|
||||
<version>9.3</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
@ -122,7 +116,7 @@
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-compiler-plugin</artifactId>
|
||||
<version>3.8.1</version>
|
||||
<version>3.10.1</version>
|
||||
<configuration>
|
||||
<!-- we use the Eclipse compiler as it doesn't need a JDK -->
|
||||
<compilerId>eclipse</compilerId>
|
||||
@ -131,19 +125,14 @@
|
||||
<dependency>
|
||||
<groupId>org.codehaus.plexus</groupId>
|
||||
<artifactId>plexus-compiler-eclipse</artifactId>
|
||||
<version>2.8.8</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.eclipse.jdt</groupId>
|
||||
<artifactId>ecj</artifactId>
|
||||
<version>3.28.0</version>
|
||||
<version>2.12.0</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-jar-plugin</artifactId>
|
||||
<version>3.2.0</version>
|
||||
<version>3.2.2</version>
|
||||
<configuration>
|
||||
<archive>
|
||||
<manifest>
|
||||
@ -183,7 +172,7 @@
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-javadoc-plugin</artifactId>
|
||||
<version>3.3.1</version>
|
||||
<version>3.4.0</version>
|
||||
<configuration>
|
||||
<links>
|
||||
<link>https://guava.dev/releases/31.0.1-jre/api/docs/</link>
|
||||
@ -231,7 +220,7 @@
|
||||
<plugin>
|
||||
<groupId>org.codehaus.mojo</groupId>
|
||||
<artifactId>animal-sniffer-maven-plugin</artifactId>
|
||||
<version>1.20</version>
|
||||
<version>1.21</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<phase>process-classes</phase>
|
||||
|
@ -1,8 +1,8 @@
|
||||
package org.bukkit;
|
||||
|
||||
import com.google.common.base.Preconditions;
|
||||
import com.google.common.collect.Maps;
|
||||
import java.util.HashMap;
|
||||
import org.apache.commons.lang.Validate;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
@ -35,7 +35,11 @@ public enum Art implements Keyed {
|
||||
PIGSCENE(22, 4, 4),
|
||||
BURNING_SKULL(23, 4, 4),
|
||||
SKELETON(24, 4, 3),
|
||||
DONKEY_KONG(25, 4, 3);
|
||||
DONKEY_KONG(25, 4, 3),
|
||||
EARTH(26, 2, 2),
|
||||
WIND(27, 2, 2),
|
||||
WATER(28, 2, 2),
|
||||
FIRE(29, 2, 2);
|
||||
|
||||
private final int id, width, height;
|
||||
private final NamespacedKey key;
|
||||
@ -107,7 +111,7 @@ public enum Art implements Keyed {
|
||||
*/
|
||||
@Nullable
|
||||
public static Art getByName(@NotNull String name) {
|
||||
Validate.notNull(name, "Name cannot be null");
|
||||
Preconditions.checkArgument(name != null, "Name cannot be null");
|
||||
|
||||
return BY_NAME.get(name.toLowerCase(java.util.Locale.ENGLISH));
|
||||
}
|
||||
|
@ -1,9 +1,9 @@
|
||||
package org.bukkit;
|
||||
|
||||
import com.google.common.base.Preconditions;
|
||||
import com.google.common.collect.Maps;
|
||||
import java.util.Map;
|
||||
import java.util.regex.Pattern;
|
||||
import org.apache.commons.lang.Validate;
|
||||
import org.jetbrains.annotations.Contract;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
@ -180,8 +180,8 @@ public enum ChatColor {
|
||||
*/
|
||||
@Nullable
|
||||
public static ChatColor getByChar(@NotNull String code) {
|
||||
Validate.notNull(code, "Code cannot be null");
|
||||
Validate.isTrue(code.length() > 0, "Code must have at least one char");
|
||||
Preconditions.checkArgument(code != null, "Code cannot be null");
|
||||
Preconditions.checkArgument(code.length() > 0, "Code must have at least one char");
|
||||
|
||||
return BY_CHAR.get(code.charAt(0));
|
||||
}
|
||||
@ -214,7 +214,7 @@ public enum ChatColor {
|
||||
*/
|
||||
@NotNull
|
||||
public static String translateAlternateColorCodes(char altColorChar, @NotNull String textToTranslate) {
|
||||
Validate.notNull(textToTranslate, "Cannot translate null text");
|
||||
Preconditions.checkArgument(textToTranslate != null, "Cannot translate null text");
|
||||
|
||||
char[] b = textToTranslate.toCharArray();
|
||||
for (int i = 0; i < b.length - 1; i++) {
|
||||
@ -234,7 +234,7 @@ public enum ChatColor {
|
||||
*/
|
||||
@NotNull
|
||||
public static String getLastColors(@NotNull String input) {
|
||||
Validate.notNull(input, "Cannot get last colors from null text");
|
||||
Preconditions.checkArgument(input != null, "Cannot get last colors from null text");
|
||||
|
||||
String result = "";
|
||||
int length = input.length();
|
||||
|
@ -1,8 +1,10 @@
|
||||
package org.bukkit;
|
||||
|
||||
import com.google.common.base.Preconditions;
|
||||
import com.google.common.collect.ImmutableMap;
|
||||
import java.util.Arrays;
|
||||
import java.util.Map;
|
||||
import org.apache.commons.lang.Validate;
|
||||
import java.util.Objects;
|
||||
import org.bukkit.configuration.serialization.ConfigurationSerializable;
|
||||
import org.bukkit.configuration.serialization.SerializableAs;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
@ -144,7 +146,7 @@ public final class Color implements ConfigurationSerializable {
|
||||
*/
|
||||
@NotNull
|
||||
public static Color fromRGB(int rgb) throws IllegalArgumentException {
|
||||
Validate.isTrue((rgb >> 24) == 0, "Extrenuous data in: ", rgb);
|
||||
Preconditions.checkArgument((rgb >> 24) == 0, "Extrenuous data in: ", rgb);
|
||||
return fromRGB(rgb >> 16 & BIT_MASK, rgb >> 8 & BIT_MASK, rgb >> 0 & BIT_MASK);
|
||||
}
|
||||
|
||||
@ -159,14 +161,14 @@ public final class Color implements ConfigurationSerializable {
|
||||
*/
|
||||
@NotNull
|
||||
public static Color fromBGR(int bgr) throws IllegalArgumentException {
|
||||
Validate.isTrue((bgr >> 24) == 0, "Extrenuous data in: ", bgr);
|
||||
Preconditions.checkArgument((bgr >> 24) == 0, "Extrenuous data in: ", bgr);
|
||||
return fromBGR(bgr >> 16 & BIT_MASK, bgr >> 8 & BIT_MASK, bgr >> 0 & BIT_MASK);
|
||||
}
|
||||
|
||||
private Color(int red, int green, int blue) {
|
||||
Validate.isTrue(red >= 0 && red <= BIT_MASK, "Red is not between 0-255: ", red);
|
||||
Validate.isTrue(green >= 0 && green <= BIT_MASK, "Green is not between 0-255: ", green);
|
||||
Validate.isTrue(blue >= 0 && blue <= BIT_MASK, "Blue is not between 0-255: ", blue);
|
||||
Preconditions.checkArgument(red >= 0 && red <= BIT_MASK, "Red is not between 0-255: ", red);
|
||||
Preconditions.checkArgument(green >= 0 && green <= BIT_MASK, "Green is not between 0-255: ", green);
|
||||
Preconditions.checkArgument(blue >= 0 && blue <= BIT_MASK, "Blue is not between 0-255: ", blue);
|
||||
|
||||
this.red = (byte) red;
|
||||
this.green = (byte) green;
|
||||
@ -261,7 +263,7 @@ public final class Color implements ConfigurationSerializable {
|
||||
// TODO: Javadoc what this method does, not what it mimics. API != Implementation
|
||||
@NotNull
|
||||
public Color mixDyes(@NotNull DyeColor... colors) {
|
||||
Validate.noNullElements(colors, "Colors cannot be null");
|
||||
Preconditions.checkArgument(colors != null && Arrays.stream(colors).allMatch(Objects::nonNull), "Colors cannot be null");
|
||||
|
||||
Color[] toPass = new Color[colors.length];
|
||||
for (int i = 0; i < colors.length; i++) {
|
||||
@ -281,7 +283,7 @@ public final class Color implements ConfigurationSerializable {
|
||||
// TODO: Javadoc what this method does, not what it mimics. API != Implementation
|
||||
@NotNull
|
||||
public Color mixColors(@NotNull Color... colors) {
|
||||
Validate.noNullElements(colors, "Colors cannot be null");
|
||||
Preconditions.checkArgument(colors != null && Arrays.stream(colors).allMatch(Objects::nonNull), "Colors cannot be null");
|
||||
|
||||
int totalRed = this.getRed();
|
||||
int totalGreen = this.getGreen();
|
||||
|
@ -1,10 +1,10 @@
|
||||
package org.bukkit;
|
||||
|
||||
import com.google.common.base.Preconditions;
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import com.google.common.collect.ImmutableMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import org.apache.commons.lang.Validate;
|
||||
import org.bukkit.configuration.serialization.ConfigurationSerializable;
|
||||
import org.bukkit.configuration.serialization.SerializableAs;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
@ -75,7 +75,7 @@ public final class FireworkEffect implements ConfigurationSerializable {
|
||||
*/
|
||||
@NotNull
|
||||
public Builder with(@NotNull Type type) throws IllegalArgumentException {
|
||||
Validate.notNull(type, "Cannot have null type");
|
||||
Preconditions.checkArgument(type != null, "Cannot have null type");
|
||||
this.type = type;
|
||||
return this;
|
||||
}
|
||||
@ -135,7 +135,7 @@ public final class FireworkEffect implements ConfigurationSerializable {
|
||||
*/
|
||||
@NotNull
|
||||
public Builder withColor(@NotNull Color color) throws IllegalArgumentException {
|
||||
Validate.notNull(color, "Cannot have null color");
|
||||
Preconditions.checkArgument(color != null, "Cannot have null color");
|
||||
|
||||
colors.add(color);
|
||||
|
||||
@ -153,14 +153,14 @@ public final class FireworkEffect implements ConfigurationSerializable {
|
||||
*/
|
||||
@NotNull
|
||||
public Builder withColor(@NotNull Color... colors) throws IllegalArgumentException {
|
||||
Validate.notNull(colors, "Cannot have null colors");
|
||||
Preconditions.checkArgument(colors != null, "Cannot have null colors");
|
||||
if (colors.length == 0) {
|
||||
return this;
|
||||
}
|
||||
|
||||
ImmutableList.Builder<Color> list = this.colors;
|
||||
for (Color color : colors) {
|
||||
Validate.notNull(color, "Color cannot be null");
|
||||
Preconditions.checkArgument(color != null, "Color cannot be null");
|
||||
list.add(color);
|
||||
}
|
||||
|
||||
@ -179,7 +179,7 @@ public final class FireworkEffect implements ConfigurationSerializable {
|
||||
*/
|
||||
@NotNull
|
||||
public Builder withColor(@NotNull Iterable<?> colors) throws IllegalArgumentException {
|
||||
Validate.notNull(colors, "Cannot have null colors");
|
||||
Preconditions.checkArgument(colors != null, "Cannot have null colors");
|
||||
|
||||
ImmutableList.Builder<Color> list = this.colors;
|
||||
for (Object color : colors) {
|
||||
@ -203,7 +203,7 @@ public final class FireworkEffect implements ConfigurationSerializable {
|
||||
*/
|
||||
@NotNull
|
||||
public Builder withFade(@NotNull Color color) throws IllegalArgumentException {
|
||||
Validate.notNull(color, "Cannot have null color");
|
||||
Preconditions.checkArgument(color != null, "Cannot have null color");
|
||||
|
||||
if (fadeColors == null) {
|
||||
fadeColors = ImmutableList.builder();
|
||||
@ -225,7 +225,7 @@ public final class FireworkEffect implements ConfigurationSerializable {
|
||||
*/
|
||||
@NotNull
|
||||
public Builder withFade(@NotNull Color... colors) throws IllegalArgumentException {
|
||||
Validate.notNull(colors, "Cannot have null colors");
|
||||
Preconditions.checkArgument(colors != null, "Cannot have null colors");
|
||||
if (colors.length == 0) {
|
||||
return this;
|
||||
}
|
||||
@ -236,7 +236,7 @@ public final class FireworkEffect implements ConfigurationSerializable {
|
||||
}
|
||||
|
||||
for (Color color : colors) {
|
||||
Validate.notNull(color, "Color cannot be null");
|
||||
Preconditions.checkArgument(color != null, "Color cannot be null");
|
||||
list.add(color);
|
||||
}
|
||||
|
||||
@ -255,7 +255,7 @@ public final class FireworkEffect implements ConfigurationSerializable {
|
||||
*/
|
||||
@NotNull
|
||||
public Builder withFade(@NotNull Iterable<?> colors) throws IllegalArgumentException {
|
||||
Validate.notNull(colors, "Cannot have null colors");
|
||||
Preconditions.checkArgument(colors != null, "Cannot have null colors");
|
||||
|
||||
ImmutableList.Builder<Color> list = this.fadeColors;
|
||||
if (list == null) {
|
||||
|
@ -14,51 +14,80 @@ public final class GameEvent implements Keyed {
|
||||
|
||||
private static final Map<NamespacedKey, GameEvent> GAME_EVENTS = new HashMap<>();
|
||||
//
|
||||
public static final GameEvent BLOCK_ACTIVATE = getEvent("block_activate");
|
||||
public static final GameEvent BLOCK_ATTACH = getEvent("block_attach");
|
||||
public static final GameEvent BLOCK_CHANGE = getEvent("block_change");
|
||||
public static final GameEvent BLOCK_CLOSE = getEvent("block_close");
|
||||
public static final GameEvent BLOCK_DEACTIVATE = getEvent("block_deactivate");
|
||||
public static final GameEvent BLOCK_DESTROY = getEvent("block_destroy");
|
||||
public static final GameEvent BLOCK_DETACH = getEvent("block_detach");
|
||||
public static final GameEvent BLOCK_OPEN = getEvent("block_open");
|
||||
public static final GameEvent BLOCK_PLACE = getEvent("block_place");
|
||||
public static final GameEvent BLOCK_PRESS = getEvent("block_press");
|
||||
public static final GameEvent BLOCK_SWITCH = getEvent("block_switch");
|
||||
public static final GameEvent BLOCK_UNPRESS = getEvent("block_unpress");
|
||||
public static final GameEvent BLOCK_UNSWITCH = getEvent("block_unswitch");
|
||||
@Deprecated
|
||||
public static final GameEvent BLOCK_PRESS = getEvent("block_activate");
|
||||
@Deprecated
|
||||
public static final GameEvent BLOCK_SWITCH = getEvent("block_activate");
|
||||
@Deprecated
|
||||
public static final GameEvent BLOCK_UNPRESS = getEvent("block_deactivate");
|
||||
@Deprecated
|
||||
public static final GameEvent BLOCK_UNSWITCH = getEvent("block_deactivate");
|
||||
public static final GameEvent CONTAINER_CLOSE = getEvent("container_close");
|
||||
public static final GameEvent CONTAINER_OPEN = getEvent("container_open");
|
||||
public static final GameEvent DISPENSE_FAIL = getEvent("dispense_fail");
|
||||
public static final GameEvent DRINKING_FINISH = getEvent("drinking_finish");
|
||||
public static final GameEvent DRINK = getEvent("drink");
|
||||
@Deprecated
|
||||
public static final GameEvent DRINKING_FINISH = getEvent("drink");
|
||||
public static final GameEvent EAT = getEvent("eat");
|
||||
public static final GameEvent ELYTRA_FREE_FALL = getEvent("elytra_free_fall");
|
||||
public static final GameEvent ENTITY_DAMAGED = getEvent("entity_damaged");
|
||||
public static final GameEvent ENTITY_KILLED = getEvent("entity_killed");
|
||||
@Deprecated
|
||||
public static final GameEvent ELYTRA_FREE_FALL = getEvent("elytra_glide");
|
||||
public static final GameEvent ELYTRA_GLIDE = getEvent("elytra_glide");
|
||||
public static final GameEvent ENTITY_DAMAGE = getEvent("entity_damage");
|
||||
@Deprecated
|
||||
public static final GameEvent ENTITY_DAMAGED = getEvent("entity_damage");
|
||||
public static final GameEvent ENTITY_DIE = getEvent("entity_die");
|
||||
@Deprecated
|
||||
public static final GameEvent ENTITY_DYING = getEvent("entity_die");
|
||||
public static final GameEvent ENTITY_INTERACT = getEvent("entity_interact");
|
||||
@Deprecated
|
||||
public static final GameEvent ENTITY_KILLED = getEvent("entity_die");
|
||||
public static final GameEvent ENTITY_PLACE = getEvent("entity_place");
|
||||
public static final GameEvent ENTITY_ROAR = getEvent("entity_roar");
|
||||
public static final GameEvent ENTITY_SHAKE = getEvent("entity_shake");
|
||||
public static final GameEvent EQUIP = getEvent("equip");
|
||||
public static final GameEvent EXPLODE = getEvent("explode");
|
||||
public static final GameEvent FISHING_ROD_CAST = getEvent("fishing_rod_cast");
|
||||
public static final GameEvent FISHING_ROD_REEL_IN = getEvent("fishing_rod_reel_in");
|
||||
public static final GameEvent FLAP = getEvent("flap");
|
||||
public static final GameEvent FLUID_PICKUP = getEvent("fluid_pickup");
|
||||
public static final GameEvent FLUID_PLACE = getEvent("fluid_place");
|
||||
public static final GameEvent HIT_GROUND = getEvent("hit_ground");
|
||||
public static final GameEvent INSTRUMENT_PLAY = getEvent("instrument_play");
|
||||
public static final GameEvent ITEM_INTERACT_FINISH = getEvent("item_interact_finish");
|
||||
public static final GameEvent ITEM_INTERACT_START = getEvent("item_interact_start");
|
||||
public static final GameEvent LIGHTNING_STRIKE = getEvent("lightning_strike");
|
||||
public static final GameEvent MINECART_MOVING = getEvent("minecart_moving");
|
||||
public static final GameEvent MOB_INTERACT = getEvent("mob_interact");
|
||||
@Deprecated
|
||||
public static final GameEvent MOB_INTERACT = getEvent("entity_interact");
|
||||
public static final GameEvent NOTE_BLOCK_PLAY = getEvent("note_block_play");
|
||||
public static final GameEvent PISTON_CONTRACT = getEvent("piston_contract");
|
||||
public static final GameEvent PISTON_EXTEND = getEvent("piston_extend");
|
||||
public static final GameEvent PRIME_FUSE = getEvent("prime_fuse");
|
||||
public static final GameEvent PROJECTILE_LAND = getEvent("projectile_land");
|
||||
public static final GameEvent PROJECTILE_SHOOT = getEvent("projectile_shoot");
|
||||
public static final GameEvent RAVAGER_ROAR = getEvent("ravager_roar");
|
||||
public static final GameEvent RING_BELL = getEvent("ring_bell");
|
||||
@Deprecated
|
||||
public static final GameEvent RAVAGER_ROAR = getEvent("entity_roar");
|
||||
@Deprecated
|
||||
public static final GameEvent RING_BELL = getEvent("block_change");
|
||||
public static final GameEvent SCULK_SENSOR_TENDRILS_CLICKING = getEvent("sculk_sensor_tendrils_clicking");
|
||||
public static final GameEvent SHEAR = getEvent("shear");
|
||||
public static final GameEvent SHULKER_CLOSE = getEvent("shulker_close");
|
||||
public static final GameEvent SHULKER_OPEN = getEvent("shulker_open");
|
||||
public static final GameEvent SHRIEK = getEvent("shriek");
|
||||
@Deprecated
|
||||
public static final GameEvent SHULKER_CLOSE = getEvent("container_close");
|
||||
@Deprecated
|
||||
public static final GameEvent SHULKER_OPEN = getEvent("container_open");
|
||||
public static final GameEvent SPLASH = getEvent("splash");
|
||||
public static final GameEvent STEP = getEvent("step");
|
||||
public static final GameEvent SWIM = getEvent("swim");
|
||||
public static final GameEvent WOLF_SHAKING = getEvent("wolf_shaking");
|
||||
public static final GameEvent TELEPORT = getEvent("teleport");
|
||||
@Deprecated
|
||||
public static final GameEvent WOLF_SHAKING = getEvent("entity_shake");
|
||||
//
|
||||
private final NamespacedKey key;
|
||||
|
||||
|
@ -163,6 +163,11 @@ public final class GameRule<T> {
|
||||
*/
|
||||
public static final GameRule<Boolean> DO_TRADER_SPAWNING = new GameRule<>("doTraderSpawning", Boolean.class);
|
||||
|
||||
/**
|
||||
* Whether wardens should naturally spawn.
|
||||
*/
|
||||
public static final GameRule<Boolean> DO_WARDEN_SPAWNING = new GameRule<>("doWardenSpawning", Boolean.class);
|
||||
|
||||
/**
|
||||
* Whether mobs should cease being angry at a player once they die.
|
||||
*/
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -1,8 +1,8 @@
|
||||
package org.bukkit;
|
||||
|
||||
import com.google.common.base.Preconditions;
|
||||
import com.google.common.collect.Maps;
|
||||
import java.util.Map;
|
||||
import org.apache.commons.lang.Validate;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
@ -127,7 +127,7 @@ public class Note {
|
||||
* value. The value has to be in the interval [0; 24].
|
||||
*/
|
||||
public Note(int note) {
|
||||
Validate.isTrue(note >= 0 && note <= 24, "The note value has to be between 0 and 24.");
|
||||
Preconditions.checkArgument(note >= 0 && note <= 24, "The note value has to be between 0 and 24.");
|
||||
|
||||
this.note = (byte) note;
|
||||
}
|
||||
@ -161,7 +161,7 @@ public class Note {
|
||||
*/
|
||||
@NotNull
|
||||
public static Note flat(int octave, @NotNull Tone tone) {
|
||||
Validate.isTrue(octave != 2, "Octave cannot be 2 for flats");
|
||||
Preconditions.checkArgument(octave != 2, "Octave cannot be 2 for flats");
|
||||
tone = tone == Tone.G ? Tone.F : Tone.values()[tone.ordinal() - 1];
|
||||
return new Note(octave, tone, tone.isSharpable());
|
||||
}
|
||||
@ -188,7 +188,7 @@ public class Note {
|
||||
*/
|
||||
@NotNull
|
||||
public static Note natural(int octave, @NotNull Tone tone) {
|
||||
Validate.isTrue(octave != 2, "Octave cannot be 2 for naturals");
|
||||
Preconditions.checkArgument(octave != 2, "Octave cannot be 2 for naturals");
|
||||
return new Note(octave, tone, false);
|
||||
}
|
||||
|
||||
@ -197,7 +197,7 @@ public class Note {
|
||||
*/
|
||||
@NotNull
|
||||
public Note sharped() {
|
||||
Validate.isTrue(note < 24, "This note cannot be sharped because it is the highest known note!");
|
||||
Preconditions.checkArgument(note < 24, "This note cannot be sharped because it is the highest known note!");
|
||||
return new Note(note + 1);
|
||||
}
|
||||
|
||||
@ -206,7 +206,7 @@ public class Note {
|
||||
*/
|
||||
@NotNull
|
||||
public Note flattened() {
|
||||
Validate.isTrue(note > 0, "This note cannot be flattened because it is the lowest known note!");
|
||||
Preconditions.checkArgument(note > 0, "This note cannot be flattened because it is the lowest known note!");
|
||||
return new Note(note - 1);
|
||||
}
|
||||
|
||||
|
@ -118,6 +118,11 @@ public enum Particle {
|
||||
WAX_OFF,
|
||||
ELECTRIC_SPARK,
|
||||
SCRAPE,
|
||||
SONIC_BOOM,
|
||||
SCULK_SOUL,
|
||||
SCULK_CHARGE(Float.class),
|
||||
SCULK_CHARGE_POP,
|
||||
SHRIEK(Integer.class),
|
||||
/**
|
||||
* Uses {@link BlockData} as DataType
|
||||
*/
|
||||
|
@ -12,6 +12,7 @@ import org.bukkit.block.Biome;
|
||||
import org.bukkit.boss.KeyedBossBar;
|
||||
import org.bukkit.enchantments.Enchantment;
|
||||
import org.bukkit.entity.EntityType;
|
||||
import org.bukkit.entity.Frog;
|
||||
import org.bukkit.entity.Villager;
|
||||
import org.bukkit.entity.memory.MemoryKey;
|
||||
import org.bukkit.loot.LootTables;
|
||||
@ -170,6 +171,12 @@ public interface Registry<T extends Keyed> extends Iterable<T> {
|
||||
* @see Fluid
|
||||
*/
|
||||
Registry<Fluid> FLUID = new SimpleRegistry<>(Fluid.class);
|
||||
/**
|
||||
* Frog variants.
|
||||
*
|
||||
* @see Frog.Variant
|
||||
*/
|
||||
Registry<Frog.Variant> FROG_VARIANT = new SimpleRegistry<>(Frog.Variant.class);
|
||||
/**
|
||||
* Game events.
|
||||
*
|
||||
|
@ -202,6 +202,17 @@ public enum Sound implements Keyed {
|
||||
BLOCK_FLOWERING_AZALEA_HIT("block.flowering_azalea.hit"),
|
||||
BLOCK_FLOWERING_AZALEA_PLACE("block.flowering_azalea.place"),
|
||||
BLOCK_FLOWERING_AZALEA_STEP("block.flowering_azalea.step"),
|
||||
BLOCK_FROGLIGHT_BREAK("block.froglight.break"),
|
||||
BLOCK_FROGLIGHT_FALL("block.froglight.fall"),
|
||||
BLOCK_FROGLIGHT_HIT("block.froglight.hit"),
|
||||
BLOCK_FROGLIGHT_PLACE("block.froglight.place"),
|
||||
BLOCK_FROGLIGHT_STEP("block.froglight.step"),
|
||||
BLOCK_FROGSPAWN_BREAK("block.frogspawn.break"),
|
||||
BLOCK_FROGSPAWN_FALL("block.frogspawn.fall"),
|
||||
BLOCK_FROGSPAWN_HATCH("block.frogspawn.hatch"),
|
||||
BLOCK_FROGSPAWN_HIT("block.frogspawn.hit"),
|
||||
BLOCK_FROGSPAWN_PLACE("block.frogspawn.place"),
|
||||
BLOCK_FROGSPAWN_STEP("block.frogspawn.step"),
|
||||
BLOCK_FUNGUS_BREAK("block.fungus.break"),
|
||||
BLOCK_FUNGUS_FALL("block.fungus.fall"),
|
||||
BLOCK_FUNGUS_HIT("block.fungus.hit"),
|
||||
@ -267,6 +278,11 @@ public enum Sound implements Keyed {
|
||||
BLOCK_LODESTONE_HIT("block.lodestone.hit"),
|
||||
BLOCK_LODESTONE_PLACE("block.lodestone.place"),
|
||||
BLOCK_LODESTONE_STEP("block.lodestone.step"),
|
||||
BLOCK_MANGROVE_ROOTS_BREAK("block.mangrove_roots.break"),
|
||||
BLOCK_MANGROVE_ROOTS_FALL("block.mangrove_roots.fall"),
|
||||
BLOCK_MANGROVE_ROOTS_HIT("block.mangrove_roots.hit"),
|
||||
BLOCK_MANGROVE_ROOTS_PLACE("block.mangrove_roots.place"),
|
||||
BLOCK_MANGROVE_ROOTS_STEP("block.mangrove_roots.step"),
|
||||
BLOCK_MEDIUM_AMETHYST_BUD_BREAK("block.medium_amethyst_bud.break"),
|
||||
BLOCK_MEDIUM_AMETHYST_BUD_PLACE("block.medium_amethyst_bud.place"),
|
||||
BLOCK_METAL_BREAK("block.metal.break"),
|
||||
@ -286,6 +302,21 @@ public enum Sound implements Keyed {
|
||||
BLOCK_MOSS_HIT("block.moss.hit"),
|
||||
BLOCK_MOSS_PLACE("block.moss.place"),
|
||||
BLOCK_MOSS_STEP("block.moss.step"),
|
||||
BLOCK_MUDDY_MANGROVE_ROOTS_BREAK("block.muddy_mangrove_roots.break"),
|
||||
BLOCK_MUDDY_MANGROVE_ROOTS_FALL("block.muddy_mangrove_roots.fall"),
|
||||
BLOCK_MUDDY_MANGROVE_ROOTS_HIT("block.muddy_mangrove_roots.hit"),
|
||||
BLOCK_MUDDY_MANGROVE_ROOTS_PLACE("block.muddy_mangrove_roots.place"),
|
||||
BLOCK_MUDDY_MANGROVE_ROOTS_STEP("block.muddy_mangrove_roots.step"),
|
||||
BLOCK_MUD_BREAK("block.mud.break"),
|
||||
BLOCK_MUD_BRICKS_BREAK("block.mud_bricks.break"),
|
||||
BLOCK_MUD_BRICKS_FALL("block.mud_bricks.fall"),
|
||||
BLOCK_MUD_BRICKS_HIT("block.mud_bricks.hit"),
|
||||
BLOCK_MUD_BRICKS_PLACE("block.mud_bricks.place"),
|
||||
BLOCK_MUD_BRICKS_STEP("block.mud_bricks.step"),
|
||||
BLOCK_MUD_FALL("block.mud.fall"),
|
||||
BLOCK_MUD_HIT("block.mud.hit"),
|
||||
BLOCK_MUD_PLACE("block.mud.place"),
|
||||
BLOCK_MUD_STEP("block.mud.step"),
|
||||
BLOCK_NETHERITE_BLOCK_BREAK("block.netherite_block.break"),
|
||||
BLOCK_NETHERITE_BLOCK_FALL("block.netherite_block.fall"),
|
||||
BLOCK_NETHERITE_BLOCK_HIT("block.netherite_block.hit"),
|
||||
@ -338,6 +369,11 @@ public enum Sound implements Keyed {
|
||||
BLOCK_NYLIUM_HIT("block.nylium.hit"),
|
||||
BLOCK_NYLIUM_PLACE("block.nylium.place"),
|
||||
BLOCK_NYLIUM_STEP("block.nylium.step"),
|
||||
BLOCK_PACKED_MUD_BREAK("block.packed_mud.break"),
|
||||
BLOCK_PACKED_MUD_FALL("block.packed_mud.fall"),
|
||||
BLOCK_PACKED_MUD_HIT("block.packed_mud.hit"),
|
||||
BLOCK_PACKED_MUD_PLACE("block.packed_mud.place"),
|
||||
BLOCK_PACKED_MUD_STEP("block.packed_mud.step"),
|
||||
BLOCK_PISTON_CONTRACT("block.piston.contract"),
|
||||
BLOCK_PISTON_EXTEND("block.piston.extend"),
|
||||
BLOCK_POINTED_DRIPSTONE_BREAK("block.pointed_dripstone.break"),
|
||||
@ -389,6 +425,17 @@ public enum Sound implements Keyed {
|
||||
BLOCK_SCAFFOLDING_HIT("block.scaffolding.hit"),
|
||||
BLOCK_SCAFFOLDING_PLACE("block.scaffolding.place"),
|
||||
BLOCK_SCAFFOLDING_STEP("block.scaffolding.step"),
|
||||
BLOCK_SCULK_BREAK("block.sculk.break"),
|
||||
BLOCK_SCULK_CATALYST_BLOOM("block.sculk_catalyst.bloom"),
|
||||
BLOCK_SCULK_CATALYST_BREAK("block.sculk_catalyst.break"),
|
||||
BLOCK_SCULK_CATALYST_FALL("block.sculk_catalyst.fall"),
|
||||
BLOCK_SCULK_CATALYST_HIT("block.sculk_catalyst.hit"),
|
||||
BLOCK_SCULK_CATALYST_PLACE("block.sculk_catalyst.place"),
|
||||
BLOCK_SCULK_CATALYST_STEP("block.sculk_catalyst.step"),
|
||||
BLOCK_SCULK_CHARGE("block.sculk.charge"),
|
||||
BLOCK_SCULK_FALL("block.sculk.fall"),
|
||||
BLOCK_SCULK_HIT("block.sculk.hit"),
|
||||
BLOCK_SCULK_PLACE("block.sculk.place"),
|
||||
BLOCK_SCULK_SENSOR_BREAK("block.sculk_sensor.break"),
|
||||
BLOCK_SCULK_SENSOR_CLICKING("block.sculk_sensor.clicking"),
|
||||
BLOCK_SCULK_SENSOR_CLICKING_STOP("block.sculk_sensor.clicking_stop"),
|
||||
@ -396,6 +443,19 @@ public enum Sound implements Keyed {
|
||||
BLOCK_SCULK_SENSOR_HIT("block.sculk_sensor.hit"),
|
||||
BLOCK_SCULK_SENSOR_PLACE("block.sculk_sensor.place"),
|
||||
BLOCK_SCULK_SENSOR_STEP("block.sculk_sensor.step"),
|
||||
BLOCK_SCULK_SHRIEKER_BREAK("block.sculk_shrieker.break"),
|
||||
BLOCK_SCULK_SHRIEKER_FALL("block.sculk_shrieker.fall"),
|
||||
BLOCK_SCULK_SHRIEKER_HIT("block.sculk_shrieker.hit"),
|
||||
BLOCK_SCULK_SHRIEKER_PLACE("block.sculk_shrieker.place"),
|
||||
BLOCK_SCULK_SHRIEKER_SHRIEK("block.sculk_shrieker.shriek"),
|
||||
BLOCK_SCULK_SHRIEKER_STEP("block.sculk_shrieker.step"),
|
||||
BLOCK_SCULK_SPREAD("block.sculk.spread"),
|
||||
BLOCK_SCULK_STEP("block.sculk.step"),
|
||||
BLOCK_SCULK_VEIN_BREAK("block.sculk_vein.break"),
|
||||
BLOCK_SCULK_VEIN_FALL("block.sculk_vein.fall"),
|
||||
BLOCK_SCULK_VEIN_HIT("block.sculk_vein.hit"),
|
||||
BLOCK_SCULK_VEIN_PLACE("block.sculk_vein.place"),
|
||||
BLOCK_SCULK_VEIN_STEP("block.sculk_vein.step"),
|
||||
BLOCK_SHROOMLIGHT_BREAK("block.shroomlight.break"),
|
||||
BLOCK_SHROOMLIGHT_FALL("block.shroomlight.fall"),
|
||||
BLOCK_SHROOMLIGHT_HIT("block.shroomlight.hit"),
|
||||
@ -503,6 +563,13 @@ public enum Sound implements Keyed {
|
||||
BLOCK_WOOL_PLACE("block.wool.place"),
|
||||
BLOCK_WOOL_STEP("block.wool.step"),
|
||||
ENCHANT_THORNS_HIT("enchant.thorns.hit"),
|
||||
ENTITY_ALLAY_AMBIENT_WITHOUT_ITEM("entity.allay.ambient_without_item"),
|
||||
ENTITY_ALLAY_AMBIENT_WITH_ITEM("entity.allay.ambient_with_item"),
|
||||
ENTITY_ALLAY_DEATH("entity.allay.death"),
|
||||
ENTITY_ALLAY_HURT("entity.allay.hurt"),
|
||||
ENTITY_ALLAY_ITEM_GIVEN("entity.allay.item_given"),
|
||||
ENTITY_ALLAY_ITEM_TAKEN("entity.allay.item_taken"),
|
||||
ENTITY_ALLAY_ITEM_THROWN("entity.allay.item_thrown"),
|
||||
ENTITY_ARMOR_STAND_BREAK("entity.armor_stand.break"),
|
||||
ENTITY_ARMOR_STAND_FALL("entity.armor_stand.fall"),
|
||||
ENTITY_ARMOR_STAND_HIT("entity.armor_stand.hit"),
|
||||
@ -649,6 +716,14 @@ public enum Sound implements Keyed {
|
||||
ENTITY_FOX_SNIFF("entity.fox.sniff"),
|
||||
ENTITY_FOX_SPIT("entity.fox.spit"),
|
||||
ENTITY_FOX_TELEPORT("entity.fox.teleport"),
|
||||
ENTITY_FROG_AMBIENT("entity.frog.ambient"),
|
||||
ENTITY_FROG_DEATH("entity.frog.death"),
|
||||
ENTITY_FROG_EAT("entity.frog.eat"),
|
||||
ENTITY_FROG_HURT("entity.frog.hurt"),
|
||||
ENTITY_FROG_LAY_SPAWN("entity.frog.lay_spawn"),
|
||||
ENTITY_FROG_LONG_JUMP("entity.frog.long_jump"),
|
||||
ENTITY_FROG_STEP("entity.frog.step"),
|
||||
ENTITY_FROG_TONGUE("entity.frog.tongue"),
|
||||
ENTITY_GENERIC_BIG_FALL("entity.generic.big_fall"),
|
||||
ENTITY_GENERIC_BURN("entity.generic.burn"),
|
||||
ENTITY_GENERIC_DEATH("entity.generic.death"),
|
||||
@ -678,6 +753,7 @@ public enum Sound implements Keyed {
|
||||
ENTITY_GOAT_AMBIENT("entity.goat.ambient"),
|
||||
ENTITY_GOAT_DEATH("entity.goat.death"),
|
||||
ENTITY_GOAT_EAT("entity.goat.eat"),
|
||||
ENTITY_GOAT_HORN_BREAK("entity.goat.horn_break"),
|
||||
ENTITY_GOAT_HURT("entity.goat.hurt"),
|
||||
ENTITY_GOAT_LONG_JUMP("entity.goat.long_jump"),
|
||||
ENTITY_GOAT_MILK("entity.goat.milk"),
|
||||
@ -686,6 +762,7 @@ public enum Sound implements Keyed {
|
||||
ENTITY_GOAT_SCREAMING_AMBIENT("entity.goat.screaming.ambient"),
|
||||
ENTITY_GOAT_SCREAMING_DEATH("entity.goat.screaming.death"),
|
||||
ENTITY_GOAT_SCREAMING_EAT("entity.goat.screaming.eat"),
|
||||
ENTITY_GOAT_SCREAMING_HORN_BREAK("entity.goat.screaming.horn_break"),
|
||||
ENTITY_GOAT_SCREAMING_HURT("entity.goat.screaming.hurt"),
|
||||
ENTITY_GOAT_SCREAMING_LONG_JUMP("entity.goat.screaming.long_jump"),
|
||||
ENTITY_GOAT_SCREAMING_MILK("entity.goat.screaming.milk"),
|
||||
@ -834,6 +911,7 @@ public enum Sound implements Keyed {
|
||||
ENTITY_PARROT_IMITATE_STRAY("entity.parrot.imitate.stray"),
|
||||
ENTITY_PARROT_IMITATE_VEX("entity.parrot.imitate.vex"),
|
||||
ENTITY_PARROT_IMITATE_VINDICATOR("entity.parrot.imitate.vindicator"),
|
||||
ENTITY_PARROT_IMITATE_WARDEN("entity.parrot.imitate.warden"),
|
||||
ENTITY_PARROT_IMITATE_WITCH("entity.parrot.imitate.witch"),
|
||||
ENTITY_PARROT_IMITATE_WITHER("entity.parrot.imitate.wither"),
|
||||
ENTITY_PARROT_IMITATE_WITHER_SKELETON("entity.parrot.imitate.wither_skeleton"),
|
||||
@ -993,6 +1071,10 @@ public enum Sound implements Keyed {
|
||||
ENTITY_STRIDER_SADDLE("entity.strider.saddle"),
|
||||
ENTITY_STRIDER_STEP("entity.strider.step"),
|
||||
ENTITY_STRIDER_STEP_LAVA("entity.strider.step_lava"),
|
||||
ENTITY_TADPOLE_DEATH("entity.tadpole.death"),
|
||||
ENTITY_TADPOLE_FLOP("entity.tadpole.flop"),
|
||||
ENTITY_TADPOLE_GROW_UP("entity.tadpole.grow_up"),
|
||||
ENTITY_TADPOLE_HURT("entity.tadpole.hurt"),
|
||||
ENTITY_TNT_PRIMED("entity.tnt.primed"),
|
||||
ENTITY_TROPICAL_FISH_AMBIENT("entity.tropical_fish.ambient"),
|
||||
ENTITY_TROPICAL_FISH_DEATH("entity.tropical_fish.death"),
|
||||
@ -1048,6 +1130,26 @@ public enum Sound implements Keyed {
|
||||
ENTITY_WANDERING_TRADER_REAPPEARED("entity.wandering_trader.reappeared"),
|
||||
ENTITY_WANDERING_TRADER_TRADE("entity.wandering_trader.trade"),
|
||||
ENTITY_WANDERING_TRADER_YES("entity.wandering_trader.yes"),
|
||||
ENTITY_WARDEN_AGITATED("entity.warden.agitated"),
|
||||
ENTITY_WARDEN_AMBIENT("entity.warden.ambient"),
|
||||
ENTITY_WARDEN_ANGRY("entity.warden.angry"),
|
||||
ENTITY_WARDEN_ATTACK_IMPACT("entity.warden.attack_impact"),
|
||||
ENTITY_WARDEN_DEATH("entity.warden.death"),
|
||||
ENTITY_WARDEN_DIG("entity.warden.dig"),
|
||||
ENTITY_WARDEN_EMERGE("entity.warden.emerge"),
|
||||
ENTITY_WARDEN_HEARTBEAT("entity.warden.heartbeat"),
|
||||
ENTITY_WARDEN_HURT("entity.warden.hurt"),
|
||||
ENTITY_WARDEN_LISTENING("entity.warden.listening"),
|
||||
ENTITY_WARDEN_LISTENING_ANGRY("entity.warden.listening_angry"),
|
||||
ENTITY_WARDEN_NEARBY_CLOSE("entity.warden.nearby_close"),
|
||||
ENTITY_WARDEN_NEARBY_CLOSER("entity.warden.nearby_closer"),
|
||||
ENTITY_WARDEN_NEARBY_CLOSEST("entity.warden.nearby_closest"),
|
||||
ENTITY_WARDEN_ROAR("entity.warden.roar"),
|
||||
ENTITY_WARDEN_SNIFF("entity.warden.sniff"),
|
||||
ENTITY_WARDEN_SONIC_BOOM("entity.warden.sonic_boom"),
|
||||
ENTITY_WARDEN_SONIC_CHARGE("entity.warden.sonic_charge"),
|
||||
ENTITY_WARDEN_STEP("entity.warden.step"),
|
||||
ENTITY_WARDEN_TENDRIL_CLICKS("entity.warden.tendril_clicks"),
|
||||
ENTITY_WITCH_AMBIENT("entity.witch.ambient"),
|
||||
ENTITY_WITCH_CELEBRATE("entity.witch.celebrate"),
|
||||
ENTITY_WITCH_DEATH("entity.witch.death"),
|
||||
@ -1126,11 +1228,13 @@ public enum Sound implements Keyed {
|
||||
ITEM_BUCKET_EMPTY_FISH("item.bucket.empty_fish"),
|
||||
ITEM_BUCKET_EMPTY_LAVA("item.bucket.empty_lava"),
|
||||
ITEM_BUCKET_EMPTY_POWDER_SNOW("item.bucket.empty_powder_snow"),
|
||||
ITEM_BUCKET_EMPTY_TADPOLE("item.bucket.empty_tadpole"),
|
||||
ITEM_BUCKET_FILL("item.bucket.fill"),
|
||||
ITEM_BUCKET_FILL_AXOLOTL("item.bucket.fill_axolotl"),
|
||||
ITEM_BUCKET_FILL_FISH("item.bucket.fill_fish"),
|
||||
ITEM_BUCKET_FILL_LAVA("item.bucket.fill_lava"),
|
||||
ITEM_BUCKET_FILL_POWDER_SNOW("item.bucket.fill_powder_snow"),
|
||||
ITEM_BUCKET_FILL_TADPOLE("item.bucket.fill_tadpole"),
|
||||
ITEM_BUNDLE_DROP_CONTENTS("item.bundle.drop_contents"),
|
||||
ITEM_BUNDLE_INSERT("item.bundle.insert"),
|
||||
ITEM_BUNDLE_REMOVE_ONE("item.bundle.remove_one"),
|
||||
@ -1149,6 +1253,15 @@ public enum Sound implements Keyed {
|
||||
ITEM_FIRECHARGE_USE("item.firecharge.use"),
|
||||
ITEM_FLINTANDSTEEL_USE("item.flintandsteel.use"),
|
||||
ITEM_GLOW_INK_SAC_USE("item.glow_ink_sac.use"),
|
||||
ITEM_GOAT_HORN_PLAY("item.goat_horn.play"),
|
||||
ITEM_GOAT_HORN_SOUND_0("item.goat_horn.sound.0"),
|
||||
ITEM_GOAT_HORN_SOUND_1("item.goat_horn.sound.1"),
|
||||
ITEM_GOAT_HORN_SOUND_2("item.goat_horn.sound.2"),
|
||||
ITEM_GOAT_HORN_SOUND_3("item.goat_horn.sound.3"),
|
||||
ITEM_GOAT_HORN_SOUND_4("item.goat_horn.sound.4"),
|
||||
ITEM_GOAT_HORN_SOUND_5("item.goat_horn.sound.5"),
|
||||
ITEM_GOAT_HORN_SOUND_6("item.goat_horn.sound.6"),
|
||||
ITEM_GOAT_HORN_SOUND_7("item.goat_horn.sound.7"),
|
||||
ITEM_HOE_TILL("item.hoe.till"),
|
||||
ITEM_HONEYCOMB_WAX_ON("item.honeycomb.wax_on"),
|
||||
ITEM_HONEY_BOTTLE_DRINK("item.honey_bottle.drink"),
|
||||
@ -1173,6 +1286,7 @@ public enum Sound implements Keyed {
|
||||
MUSIC_CREDITS("music.credits"),
|
||||
MUSIC_DISC_11("music_disc.11"),
|
||||
MUSIC_DISC_13("music_disc.13"),
|
||||
MUSIC_DISC_5("music_disc.5"),
|
||||
MUSIC_DISC_BLOCKS("music_disc.blocks"),
|
||||
MUSIC_DISC_CAT("music_disc.cat"),
|
||||
MUSIC_DISC_CHIRP("music_disc.chirp"),
|
||||
@ -1194,14 +1308,18 @@ public enum Sound implements Keyed {
|
||||
MUSIC_NETHER_NETHER_WASTES("music.nether.nether_wastes"),
|
||||
MUSIC_NETHER_SOUL_SAND_VALLEY("music.nether.soul_sand_valley"),
|
||||
MUSIC_NETHER_WARPED_FOREST("music.nether.warped_forest"),
|
||||
MUSIC_OVERWORLD_DEEP_DARK("music.overworld.deep_dark"),
|
||||
MUSIC_OVERWORLD_DRIPSTONE_CAVES("music.overworld.dripstone_caves"),
|
||||
MUSIC_OVERWORLD_FROZEN_PEAKS("music.overworld.frozen_peaks"),
|
||||
MUSIC_OVERWORLD_GROVE("music.overworld.grove"),
|
||||
MUSIC_OVERWORLD_JAGGED_PEAKS("music.overworld.jagged_peaks"),
|
||||
MUSIC_OVERWORLD_JUNGLE_AND_FOREST("music.overworld.jungle_and_forest"),
|
||||
MUSIC_OVERWORLD_LUSH_CAVES("music.overworld.lush_caves"),
|
||||
MUSIC_OVERWORLD_MEADOW("music.overworld.meadow"),
|
||||
MUSIC_OVERWORLD_OLD_GROWTH_TAIGA("music.overworld.old_growth_taiga"),
|
||||
MUSIC_OVERWORLD_SNOWY_SLOPES("music.overworld.snowy_slopes"),
|
||||
MUSIC_OVERWORLD_STONY_PEAKS("music.overworld.stony_peaks"),
|
||||
MUSIC_OVERWORLD_SWAMP("music.overworld.swamp"),
|
||||
MUSIC_UNDER_WATER("music.under_water"),
|
||||
PARTICLE_SOUL_ESCAPE("particle.soul_escape"),
|
||||
UI_BUTTON_CLICK("ui.button.click"),
|
||||
|
@ -1,11 +1,11 @@
|
||||
package org.bukkit;
|
||||
|
||||
import com.google.common.base.Preconditions;
|
||||
import com.google.common.base.Strings;
|
||||
import com.google.common.collect.ImmutableMap;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
import org.apache.commons.lang.Validate;
|
||||
import org.bukkit.map.MapCursor;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
@ -111,7 +111,7 @@ public final class StructureType implements Keyed {
|
||||
* They consist primarily of end stone bricks, purpur blocks, and end rods.
|
||||
* They are the only place where shulkers can be found.
|
||||
*/
|
||||
public static final StructureType END_CITY = register(new StructureType("endcity", MapCursor.Type.RED_X));
|
||||
public static final StructureType END_CITY = register(new StructureType("end_city", MapCursor.Type.RED_X));
|
||||
|
||||
/**
|
||||
* Mansions (also known as woodland mansions) are massive house structures
|
||||
@ -175,7 +175,7 @@ public final class StructureType implements Keyed {
|
||||
* not be compatible with explorer maps.
|
||||
*/
|
||||
private StructureType(@NotNull String name, @Nullable MapCursor.Type mapIcon) {
|
||||
Validate.notEmpty(name, "Structure name cannot be empty");
|
||||
Preconditions.checkArgument(!Strings.isNullOrEmpty(name), "Structure name cannot be empty");
|
||||
this.key = NamespacedKey.minecraft(name);
|
||||
this.mapCursor = mapIcon;
|
||||
}
|
||||
|
@ -44,7 +44,12 @@ public interface Tag<T extends Keyed> extends Keyed {
|
||||
/**
|
||||
* Vanilla block tag representing all colors of carpet.
|
||||
*/
|
||||
Tag<Material> CARPETS = Bukkit.getTag(REGISTRY_BLOCKS, NamespacedKey.minecraft("carpets"), Material.class);
|
||||
Tag<Material> WOOL_CARPETS = Bukkit.getTag(REGISTRY_BLOCKS, NamespacedKey.minecraft("wool_carpets"), Material.class);
|
||||
/**
|
||||
* @deprecated {@link #WOOL_CARPETS}.
|
||||
*/
|
||||
@Deprecated
|
||||
Tag<Material> CARPETS = WOOL_CARPETS;
|
||||
/**
|
||||
* Vanilla block tag representing all wooden doors.
|
||||
*/
|
||||
@ -90,6 +95,11 @@ public interface Tag<T extends Keyed> extends Keyed {
|
||||
* Vanilla block tag representing all log and bark variants that burn.
|
||||
*/
|
||||
Tag<Material> LOGS_THAT_BURN = Bukkit.getTag(REGISTRY_BLOCKS, NamespacedKey.minecraft("logs_that_burn"), Material.class);
|
||||
/**
|
||||
* Vanilla block tag representing all log bark variants that appear
|
||||
* naturally in the overworld.
|
||||
*/
|
||||
Tag<Material> OVERWORLD_NATURAL_LOGS = Bukkit.getTag(REGISTRY_BLOCKS, NamespacedKey.minecraft("overworld_natural_logs"), Material.class);
|
||||
/**
|
||||
* Vanilla block tag representing all log and bark variants.
|
||||
*/
|
||||
@ -118,6 +128,10 @@ public interface Tag<T extends Keyed> extends Keyed {
|
||||
* Vanilla block tag representing all spruce log and bark variants.
|
||||
*/
|
||||
Tag<Material> SPRUCE_LOGS = Bukkit.getTag(REGISTRY_BLOCKS, NamespacedKey.minecraft("spruce_logs"), Material.class);
|
||||
/**
|
||||
* Vanilla block tag representing all mangrove log and bark variants.
|
||||
*/
|
||||
Tag<Material> MANGROVE_LOGS = Bukkit.getTag(REGISTRY_BLOCKS, NamespacedKey.minecraft("mangrove_logs"), Material.class);
|
||||
/**
|
||||
* Vanilla block tag representing all crimson stems.
|
||||
*/
|
||||
@ -239,6 +253,11 @@ public interface Tag<T extends Keyed> extends Keyed {
|
||||
* Vanilla block tag representing all terracotta.
|
||||
*/
|
||||
Tag<Material> TERRACOTTA = Bukkit.getTag(REGISTRY_BLOCKS, NamespacedKey.minecraft("terracotta"), Material.class);
|
||||
/**
|
||||
* Vanilla block tag representing all blocks which complete the find tree
|
||||
* tutorial.
|
||||
*/
|
||||
Tag<Material> COMPLETES_FIND_TREE_TUTORIAL = Bukkit.getTag(REGISTRY_BLOCKS, NamespacedKey.minecraft("completes_find_tree_tutorial"), Material.class);
|
||||
/**
|
||||
* Vanilla block tag denoting blocks that enderman may pick up and hold.
|
||||
*/
|
||||
@ -295,6 +314,11 @@ public interface Tag<T extends Keyed> extends Keyed {
|
||||
* Vanilla block tag representing all blocks immune to dragons.
|
||||
*/
|
||||
Tag<Material> DRAGON_IMMUNE = Bukkit.getTag(REGISTRY_BLOCKS, NamespacedKey.minecraft("dragon_immune"), Material.class);
|
||||
/**
|
||||
* Vanilla block tag representing all blocks transparent to the ender
|
||||
* dragon.
|
||||
*/
|
||||
Tag<Material> DRAGON_TRANSPARENT = Bukkit.getTag(REGISTRY_BLOCKS, NamespacedKey.minecraft("dragon_transparent"), Material.class);
|
||||
/**
|
||||
* Vanilla block tag representing all blocks immune to withers.
|
||||
*/
|
||||
@ -422,6 +446,16 @@ public interface Tag<T extends Keyed> extends Keyed {
|
||||
* Vanilla block tag representing the nether base material.
|
||||
*/
|
||||
Tag<Material> BASE_STONE_NETHER = Bukkit.getTag(REGISTRY_BLOCKS, NamespacedKey.minecraft("base_stone_nether"), Material.class);
|
||||
/**
|
||||
* Vanilla block tag representing all blocks replaceable by the overworld
|
||||
* carver.
|
||||
*/
|
||||
Tag<Material> OVERWORLD_CARVER_REPLACEABLES = Bukkit.getTag(REGISTRY_BLOCKS, NamespacedKey.minecraft("overworld_carver_replaceables"), Material.class);
|
||||
/**
|
||||
* Vanilla block tag representing all blocks replaceable by the nether
|
||||
* carver.
|
||||
*/
|
||||
Tag<Material> NETHER_CARVER_REPLACEABLES = Bukkit.getTag(REGISTRY_BLOCKS, NamespacedKey.minecraft("nether_carver_replaceables"), Material.class);
|
||||
/**
|
||||
* Vanilla block tag representing all candle cakes.
|
||||
*/
|
||||
@ -442,6 +476,11 @@ public interface Tag<T extends Keyed> extends Keyed {
|
||||
* Vanilla block tag representing all blocks that block vibration signals.
|
||||
*/
|
||||
Tag<Material> OCCLUDES_VIBRATION_SIGNALS = Bukkit.getTag(REGISTRY_BLOCKS, NamespacedKey.minecraft("occludes_vibration_signals"), Material.class);
|
||||
/**
|
||||
* Vanilla block tag representing all blocks that dampen the propagation of
|
||||
* vibration signals.
|
||||
*/
|
||||
Tag<Material> DAMPENS_VIBRATIONS = Bukkit.getTag(REGISTRY_BLOCKS, NamespacedKey.minecraft("dampens_vibrations"), Material.class);
|
||||
/**
|
||||
* Vanilla block tag representing all blocks that are replaceable by
|
||||
* dripstone.
|
||||
@ -519,6 +558,24 @@ public interface Tag<T extends Keyed> extends Keyed {
|
||||
* Vanilla block tag representing all blocks which geodes will not spawn in.
|
||||
*/
|
||||
Tag<Material> GEODE_INVALID_BLOCKS = Bukkit.getTag(REGISTRY_BLOCKS, NamespacedKey.minecraft("geode_invalid_blocks"), Material.class);
|
||||
/**
|
||||
* Vanilla block tag representing all blocks which frogs prefer to jump to.
|
||||
*/
|
||||
Tag<Material> FROG_PREFER_JUMP_TO = Bukkit.getTag(REGISTRY_BLOCKS, NamespacedKey.minecraft("frog_prefer_jump_to"), Material.class);
|
||||
/**
|
||||
* Vanilla block tag representing all blocks which can be replaced by skulk.
|
||||
*/
|
||||
Tag<Material> SCULK_REPLACEABLE = Bukkit.getTag(REGISTRY_BLOCKS, NamespacedKey.minecraft("sculk_replaceable"), Material.class);
|
||||
/**
|
||||
* Vanilla block tag representing all blocks which can be replaced by skulk
|
||||
* during world generation.
|
||||
*/
|
||||
Tag<Material> SCULK_REPLACEABLE_WORLD_GEN = Bukkit.getTag(REGISTRY_BLOCKS, NamespacedKey.minecraft("sculk_replaceable_world_gen"), Material.class);
|
||||
/**
|
||||
* Vanilla block tag representing all blocks which can be replaced by
|
||||
* ancient cities.
|
||||
*/
|
||||
Tag<Material> ANCIENT_CITY_REPLACEABLE = Bukkit.getTag(REGISTRY_BLOCKS, NamespacedKey.minecraft("ancient_city_replaceable"), Material.class);
|
||||
/**
|
||||
* Vanilla block tag representing all blocks which animals will spawn on.
|
||||
*/
|
||||
@ -543,7 +600,12 @@ public interface Tag<T extends Keyed> extends Keyed {
|
||||
* Vanilla block tag representing all blocks which polar bears will spawn
|
||||
* on.
|
||||
*/
|
||||
Tag<Material> POLAR_BEARS_SPAWNABLE_ON_IN_FROZEN_OCEAN = Bukkit.getTag(REGISTRY_BLOCKS, NamespacedKey.minecraft("polar_bears_spawnable_on_in_frozen_ocean"), Material.class);
|
||||
Tag<Material> POLAR_BEARS_SPAWNABLE_ON_ALTERNATE = Bukkit.getTag(REGISTRY_BLOCKS, NamespacedKey.minecraft("polar_bears_spawnable_on_alternate"), Material.class);
|
||||
/**
|
||||
* @deprecated {@link #POLAR_BEARS_SPAWNABLE_ON_ALTERNATE}
|
||||
*/
|
||||
@Deprecated
|
||||
Tag<Material> POLAR_BEARS_SPAWNABLE_ON_IN_FROZEN_OCEAN = POLAR_BEARS_SPAWNABLE_ON_ALTERNATE;
|
||||
/**
|
||||
* Vanilla block tag representing all blocks which rabbits will spawn on.
|
||||
*/
|
||||
@ -556,6 +618,10 @@ public interface Tag<T extends Keyed> extends Keyed {
|
||||
* Vanilla block tag representing all blocks which wolves will spawn on.
|
||||
*/
|
||||
Tag<Material> WOLVES_SPAWNABLE_ON = Bukkit.getTag(REGISTRY_BLOCKS, NamespacedKey.minecraft("wolves_spawnable_on"), Material.class);
|
||||
/**
|
||||
* Vanilla block tag representing all blocks which frogs will spawn on.
|
||||
*/
|
||||
Tag<Material> FROGS_SPAWNABLE_ON = Bukkit.getTag(REGISTRY_BLOCKS, NamespacedKey.minecraft("frogs_spawnable_on"), Material.class);
|
||||
/**
|
||||
* Vanilla block tag representing all blocks which azaleas will grow on.
|
||||
*/
|
||||
@ -564,6 +630,37 @@ public interface Tag<T extends Keyed> extends Keyed {
|
||||
* Vanilla block tag representing all plant blocks which may be replaced.
|
||||
*/
|
||||
Tag<Material> REPLACEABLE_PLANTS = Bukkit.getTag(REGISTRY_BLOCKS, NamespacedKey.minecraft("replaceable_plants"), Material.class);
|
||||
/**
|
||||
* Vanilla block tag representing all blocks which may be converted to mud.
|
||||
*/
|
||||
Tag<Material> CONVERTABLE_TO_MUD = Bukkit.getTag(REGISTRY_BLOCKS, NamespacedKey.minecraft("convertable_to_mud"), Material.class);
|
||||
/**
|
||||
* Vanilla block tag representing all blocks which mangrove logs can grow
|
||||
* through.
|
||||
*/
|
||||
Tag<Material> MANGROVE_LOGS_CAN_GROW_THROUGH = Bukkit.getTag(REGISTRY_BLOCKS, NamespacedKey.minecraft("mangrove_logs_can_grow_through"), Material.class);
|
||||
/**
|
||||
* Vanilla block tag representing all blocks which mangrove roots can grow
|
||||
* through.
|
||||
*/
|
||||
Tag<Material> MANGROVE_ROOTS_CAN_GROW_THROUGH = Bukkit.getTag(REGISTRY_BLOCKS, NamespacedKey.minecraft("mangrove_roots_can_grow_through"), Material.class);
|
||||
/**
|
||||
* Vanilla block tag representing all blocks which dead bushes may be placed
|
||||
* on.
|
||||
*/
|
||||
Tag<Material> DEAD_BUSH_MAY_PLACE_ON = Bukkit.getTag(REGISTRY_BLOCKS, NamespacedKey.minecraft("dead_bush_may_place_on"), Material.class);
|
||||
/**
|
||||
* Vanilla block tag representing all blocks which snap dropped goat horns.
|
||||
*/
|
||||
Tag<Material> SNAPS_GOAT_HORN = Bukkit.getTag(REGISTRY_BLOCKS, NamespacedKey.minecraft("snaps_goat_horn"), Material.class);
|
||||
/**
|
||||
* Vanilla block tag representing blocks which snow cannot survive on.
|
||||
*/
|
||||
Tag<Material> SNOW_LAYER_CANNOT_SURVIVE_ON = Bukkit.getTag(REGISTRY_BLOCKS, NamespacedKey.minecraft("snow_layer_cannot_survive_on"), Material.class);
|
||||
/**
|
||||
* Vanilla block tag representing blocks which snow can survive on.
|
||||
*/
|
||||
Tag<Material> SNOW_LAYER_CAN_SURVIVE_ON = Bukkit.getTag(REGISTRY_BLOCKS, NamespacedKey.minecraft("snow_layer_can_survive_on"), Material.class);
|
||||
/**
|
||||
* Key for the built in item registry.
|
||||
*/
|
||||
@ -592,6 +689,10 @@ public interface Tag<T extends Keyed> extends Keyed {
|
||||
* Vanilla item tag representing all boat items.
|
||||
*/
|
||||
Tag<Material> ITEMS_BOATS = Bukkit.getTag(REGISTRY_ITEMS, NamespacedKey.minecraft("boats"), Material.class);
|
||||
/**
|
||||
* Vanilla item tag representing all chest boat items.
|
||||
*/
|
||||
Tag<Material> ITEMS_CHEST_BOATS = Bukkit.getTag(REGISTRY_ITEMS, NamespacedKey.minecraft("chest_boats"), Material.class);
|
||||
/**
|
||||
* Vanilla item tag representing all fish items.
|
||||
*/
|
||||
@ -628,6 +729,10 @@ public interface Tag<T extends Keyed> extends Keyed {
|
||||
* Vanilla item tag representing all furnace materials.
|
||||
*/
|
||||
Tag<Material> ITEMS_FURNACE_MATERIALS = Bukkit.getTag(REGISTRY_ITEMS, NamespacedKey.minecraft("furnace_materials"), Material.class);
|
||||
/**
|
||||
* Vanilla item tag representing all compasses.
|
||||
*/
|
||||
Tag<Material> ITEMS_COMPASSES = Bukkit.getTag(REGISTRY_ITEMS, NamespacedKey.minecraft("compasses"), Material.class);
|
||||
/**
|
||||
* Vanilla item tag representing all items that confer freeze immunity on
|
||||
* the wearer.
|
||||
@ -698,6 +803,10 @@ public interface Tag<T extends Keyed> extends Keyed {
|
||||
* Vanilla tag representing entities extra susceptible to freezing.
|
||||
*/
|
||||
Tag<EntityType> ENTITY_TYPES_FREEZE_HURTS_EXTRA_TYPES = Bukkit.getTag(REGISTRY_ENTITY_TYPES, NamespacedKey.minecraft("freeze_hurts_extra_types"), EntityType.class);
|
||||
/**
|
||||
* Vanilla tag representing entities which can be eaten by frogs.
|
||||
*/
|
||||
Tag<EntityType> ENTITY_TYPES_FROG_FOOD = Bukkit.getTag(REGISTRY_ENTITY_TYPES, NamespacedKey.minecraft("frog_food"), EntityType.class);
|
||||
|
||||
/**
|
||||
* Returns whether or not this tag has an entry for the specified item.
|
||||
|
@ -84,5 +84,13 @@ public enum TreeType {
|
||||
/**
|
||||
* Tree with large roots which grows above lush caves
|
||||
*/
|
||||
AZALEA
|
||||
AZALEA,
|
||||
/**
|
||||
* Mangrove tree
|
||||
*/
|
||||
MANGROVE,
|
||||
/**
|
||||
* Tall mangrove tree
|
||||
*/
|
||||
TALL_MANGROVE,
|
||||
}
|
||||
|
@ -1,10 +1,10 @@
|
||||
package org.bukkit.attribute;
|
||||
|
||||
import com.google.common.base.Preconditions;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
import java.util.UUID;
|
||||
import org.apache.commons.lang.Validate;
|
||||
import org.bukkit.configuration.serialization.ConfigurationSerializable;
|
||||
import org.bukkit.inventory.EquipmentSlot;
|
||||
import org.bukkit.util.NumberConversions;
|
||||
@ -31,9 +31,9 @@ public class AttributeModifier implements ConfigurationSerializable {
|
||||
}
|
||||
|
||||
public AttributeModifier(@NotNull UUID uuid, @NotNull String name, double amount, @NotNull Operation operation, @Nullable EquipmentSlot slot) {
|
||||
Validate.notNull(uuid, "UUID cannot be null");
|
||||
Validate.notNull(name, "Name cannot be null");
|
||||
Validate.notNull(operation, "Operation cannot be null");
|
||||
Preconditions.checkArgument(uuid != null, "UUID cannot be null");
|
||||
Preconditions.checkArgument(name != null, "Name cannot be null");
|
||||
Preconditions.checkArgument(operation != null, "Operation cannot be null");
|
||||
this.uuid = uuid;
|
||||
this.name = name;
|
||||
this.amount = amount;
|
||||
|
@ -16,6 +16,7 @@ public enum Biome implements Keyed {
|
||||
FOREST,
|
||||
TAIGA,
|
||||
SWAMP,
|
||||
MANGROVE_SWAMP,
|
||||
RIVER,
|
||||
NETHER_WASTES,
|
||||
THE_END,
|
||||
@ -64,6 +65,7 @@ public enum Biome implements Keyed {
|
||||
BASALT_DELTAS,
|
||||
DRIPSTONE_CAVES,
|
||||
LUSH_CAVES,
|
||||
DEEP_DARK,
|
||||
MEADOW,
|
||||
GROVE,
|
||||
SNOWY_SLOPES,
|
||||
|
@ -0,0 +1,7 @@
|
||||
package org.bukkit.block;
|
||||
|
||||
/**
|
||||
* Represents a captured state of a sculk catalyst.
|
||||
*/
|
||||
public interface SculkCatalyst extends TileState {
|
||||
}
|
27
paper-api/src/main/java/org/bukkit/block/SculkShrieker.java
Normal file
27
paper-api/src/main/java/org/bukkit/block/SculkShrieker.java
Normal file
@ -0,0 +1,27 @@
|
||||
package org.bukkit.block;
|
||||
|
||||
/**
|
||||
* Represents a captured state of a sculk shrieker.
|
||||
*/
|
||||
public interface SculkShrieker extends TileState {
|
||||
|
||||
/**
|
||||
* Gets the most recent warning level of this block.
|
||||
*
|
||||
* When the warning level reaches 4, the shrieker will attempt to spawn a
|
||||
* Warden.
|
||||
*
|
||||
* @return current warning level
|
||||
*/
|
||||
int getWarningLevel();
|
||||
|
||||
/**
|
||||
* Sets the most recent warning level of this block.
|
||||
*
|
||||
* When the warning level reaches 4, the shrieker will attempt to spawn a
|
||||
* Warden.
|
||||
*
|
||||
* @param level new warning level
|
||||
*/
|
||||
void setWarningLevel(int level);
|
||||
}
|
21
paper-api/src/main/java/org/bukkit/block/data/Hangable.java
Normal file
21
paper-api/src/main/java/org/bukkit/block/data/Hangable.java
Normal file
@ -0,0 +1,21 @@
|
||||
package org.bukkit.block.data;
|
||||
|
||||
/**
|
||||
* 'hanging' denotes whether the lantern is hanging from a block.
|
||||
*/
|
||||
public interface Hangable extends BlockData {
|
||||
|
||||
/**
|
||||
* Gets the value of the 'hanging' property.
|
||||
*
|
||||
* @return the 'hanging' value
|
||||
*/
|
||||
boolean isHanging();
|
||||
|
||||
/**
|
||||
* Sets the value of the 'hanging' property.
|
||||
*
|
||||
* @param hanging the new 'hanging' value
|
||||
*/
|
||||
void setHanging(boolean hanging);
|
||||
}
|
@ -1,23 +1,7 @@
|
||||
package org.bukkit.block.data.type;
|
||||
|
||||
import org.bukkit.block.data.Hangable;
|
||||
import org.bukkit.block.data.Waterlogged;
|
||||
|
||||
/**
|
||||
* 'hanging' denotes whether the lantern is hanging from a block.
|
||||
*/
|
||||
public interface Lantern extends Waterlogged {
|
||||
|
||||
/**
|
||||
* Gets the value of the 'hanging' property.
|
||||
*
|
||||
* @return the 'hanging' value
|
||||
*/
|
||||
boolean isHanging();
|
||||
|
||||
/**
|
||||
* Sets the value of the 'hanging' property.
|
||||
*
|
||||
* @param hanging the new 'hanging' value
|
||||
*/
|
||||
void setHanging(boolean hanging);
|
||||
public interface Lantern extends Hangable, Waterlogged {
|
||||
}
|
||||
|
@ -0,0 +1,7 @@
|
||||
package org.bukkit.block.data.type;
|
||||
|
||||
import org.bukkit.block.data.Ageable;
|
||||
import org.bukkit.block.data.Waterlogged;
|
||||
|
||||
public interface MangrovePropagule extends Ageable, Sapling, Waterlogged {
|
||||
}
|
@ -0,0 +1,24 @@
|
||||
package org.bukkit.block.data.type;
|
||||
|
||||
import org.bukkit.block.data.BlockData;
|
||||
|
||||
/**
|
||||
* 'bloom' indicates whether the sculk catalyst is actively spreading the sculk
|
||||
* or not.
|
||||
*/
|
||||
public interface SculkCatalyst extends BlockData {
|
||||
|
||||
/**
|
||||
* Gets the value of the 'bloom' property.
|
||||
*
|
||||
* @return the 'bloom' value
|
||||
*/
|
||||
boolean isBloom();
|
||||
|
||||
/**
|
||||
* Sets the value of the 'bloom' property.
|
||||
*
|
||||
* @param bloom the new 'bloom' value
|
||||
*/
|
||||
void setBloom(boolean bloom);
|
||||
}
|
@ -0,0 +1,39 @@
|
||||
package org.bukkit.block.data.type;
|
||||
|
||||
import org.bukkit.block.data.Waterlogged;
|
||||
|
||||
/**
|
||||
* 'can_summon' indicates whether the sculk shrieker can summon the warden.
|
||||
* <p>
|
||||
* 'shrieking' indicated whether the sculk shrieker is shrieking or not.
|
||||
*/
|
||||
public interface SculkShrieker extends Waterlogged {
|
||||
|
||||
/**
|
||||
* Gets the value of the 'can_summon' property.
|
||||
*
|
||||
* @return the 'can_summon' value
|
||||
*/
|
||||
boolean isCanSummon();
|
||||
|
||||
/**
|
||||
* Sets the value of the 'can_summon' property.
|
||||
*
|
||||
* @param can_summon the new 'can_summon' value
|
||||
*/
|
||||
void setCanSummon(boolean can_summon);
|
||||
|
||||
/**
|
||||
* Gets the value of the 'shrieking' property.
|
||||
*
|
||||
* @return the 'shrieking' value
|
||||
*/
|
||||
boolean isShrieking();
|
||||
|
||||
/**
|
||||
* Sets the value of the 'shrieking' property.
|
||||
*
|
||||
* @param shrieking the new 'shrieking' value
|
||||
*/
|
||||
void setShrieking(boolean shrieking);
|
||||
}
|
@ -1,11 +1,11 @@
|
||||
package org.bukkit.command;
|
||||
|
||||
import com.google.common.base.Preconditions;
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
import org.apache.commons.lang.Validate;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.GameRule;
|
||||
@ -93,9 +93,9 @@ public abstract class Command {
|
||||
|
||||
@NotNull
|
||||
private List<String> tabComplete0(@NotNull CommandSender sender, @NotNull String alias, @NotNull String[] args, @Nullable Location location) throws IllegalArgumentException {
|
||||
Validate.notNull(sender, "Sender cannot be null");
|
||||
Validate.notNull(args, "Arguments cannot be null");
|
||||
Validate.notNull(alias, "Alias cannot be null");
|
||||
Preconditions.checkArgument(sender != null, "Sender cannot be null");
|
||||
Preconditions.checkArgument(args != null, "Arguments cannot be null");
|
||||
Preconditions.checkArgument(alias != null, "Alias cannot be null");
|
||||
|
||||
if (args.length == 0) {
|
||||
return ImmutableList.of();
|
||||
|
@ -1,7 +1,7 @@
|
||||
package org.bukkit.command;
|
||||
|
||||
import com.google.common.base.Preconditions;
|
||||
import java.util.List;
|
||||
import org.apache.commons.lang.Validate;
|
||||
import org.bukkit.plugin.Plugin;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
@ -128,9 +128,9 @@ public final class PluginCommand extends Command implements PluginIdentifiableCo
|
||||
@NotNull
|
||||
@Override
|
||||
public java.util.List<String> tabComplete(@NotNull CommandSender sender, @NotNull String alias, @NotNull String[] args) throws CommandException, IllegalArgumentException {
|
||||
Validate.notNull(sender, "Sender cannot be null");
|
||||
Validate.notNull(args, "Arguments cannot be null");
|
||||
Validate.notNull(alias, "Alias cannot be null");
|
||||
Preconditions.checkArgument(sender != null, "Sender cannot be null");
|
||||
Preconditions.checkArgument(args != null, "Arguments cannot be null");
|
||||
Preconditions.checkArgument(alias != null, "Alias cannot be null");
|
||||
|
||||
List<String> completions = null;
|
||||
try {
|
||||
|
@ -1,5 +1,6 @@
|
||||
package org.bukkit.command;
|
||||
|
||||
import com.google.common.base.Preconditions;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collection;
|
||||
@ -8,7 +9,6 @@ import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import org.apache.commons.lang.Validate;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Server;
|
||||
import org.bukkit.command.defaults.BukkitCommand;
|
||||
@ -181,8 +181,8 @@ public class SimpleCommandMap implements CommandMap {
|
||||
@Override
|
||||
@Nullable
|
||||
public List<String> tabComplete(@NotNull CommandSender sender, @NotNull String cmdLine, @Nullable Location location) {
|
||||
Validate.notNull(sender, "Sender cannot be null");
|
||||
Validate.notNull(cmdLine, "Command line cannot null");
|
||||
Preconditions.checkArgument(sender != null, "Sender cannot be null");
|
||||
Preconditions.checkArgument(cmdLine != null, "Command line cannot null");
|
||||
|
||||
int spaceIndex = cmdLine.indexOf(' ');
|
||||
|
||||
|
@ -1,5 +1,7 @@
|
||||
package org.bukkit.command.defaults;
|
||||
|
||||
import com.google.common.base.Joiner;
|
||||
import com.google.common.base.Preconditions;
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
@ -8,10 +10,6 @@ import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.TreeSet;
|
||||
import org.apache.commons.lang.ArrayUtils;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.apache.commons.lang.Validate;
|
||||
import org.apache.commons.lang.math.NumberUtils;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.command.CommandSender;
|
||||
@ -45,10 +43,10 @@ public class HelpCommand extends BukkitCommand {
|
||||
if (args.length == 0) {
|
||||
command = "";
|
||||
pageNumber = 1;
|
||||
} else if (NumberUtils.isDigits(args[args.length - 1])) {
|
||||
command = StringUtils.join(ArrayUtils.subarray(args, 0, args.length - 1), " ");
|
||||
} else if (args[args.length - 1].chars().allMatch(Character::isDigit)) {
|
||||
command = Joiner.on(" ").join(Arrays.copyOfRange(args, 0, args.length - 1));
|
||||
try {
|
||||
pageNumber = NumberUtils.createInteger(args[args.length - 1]);
|
||||
pageNumber = Integer.decode(args[args.length - 1]);
|
||||
} catch (NumberFormatException exception) {
|
||||
pageNumber = 1;
|
||||
}
|
||||
@ -56,7 +54,7 @@ public class HelpCommand extends BukkitCommand {
|
||||
pageNumber = 1;
|
||||
}
|
||||
} else {
|
||||
command = StringUtils.join(args, " ");
|
||||
command = Joiner.on(" ").join(args);
|
||||
pageNumber = 1;
|
||||
}
|
||||
|
||||
@ -114,9 +112,9 @@ public class HelpCommand extends BukkitCommand {
|
||||
@NotNull
|
||||
@Override
|
||||
public List<String> tabComplete(@NotNull CommandSender sender, @NotNull String alias, @NotNull String[] args) {
|
||||
Validate.notNull(sender, "Sender cannot be null");
|
||||
Validate.notNull(args, "Arguments cannot be null");
|
||||
Validate.notNull(alias, "Alias cannot be null");
|
||||
Preconditions.checkArgument(sender != null, "Sender cannot be null");
|
||||
Preconditions.checkArgument(args != null, "Arguments cannot be null");
|
||||
Preconditions.checkArgument(alias != null, "Alias cannot be null");
|
||||
|
||||
if (args.length == 1) {
|
||||
List<String> matchedTopics = new ArrayList<String>();
|
||||
|
@ -1,12 +1,12 @@
|
||||
package org.bukkit.command.defaults;
|
||||
|
||||
import com.google.common.base.Preconditions;
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.io.PrintStream;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import org.apache.commons.lang.Validate;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.command.CommandSender;
|
||||
@ -113,9 +113,9 @@ public class TimingsCommand extends BukkitCommand {
|
||||
@NotNull
|
||||
@Override
|
||||
public List<String> tabComplete(@NotNull CommandSender sender, @NotNull String alias, @NotNull String[] args) {
|
||||
Validate.notNull(sender, "Sender cannot be null");
|
||||
Validate.notNull(args, "Arguments cannot be null");
|
||||
Validate.notNull(alias, "Alias cannot be null");
|
||||
Preconditions.checkArgument(sender != null, "Sender cannot be null");
|
||||
Preconditions.checkArgument(args != null, "Arguments cannot be null");
|
||||
Preconditions.checkArgument(alias != null, "Alias cannot be null");
|
||||
|
||||
if (args.length == 1) {
|
||||
return StringUtil.copyPartialMatches(args[0], TIMINGS_SUBCOMMANDS, new ArrayList<String>(TIMINGS_SUBCOMMANDS.size()));
|
||||
|
@ -1,6 +1,7 @@
|
||||
package org.bukkit.command.defaults;
|
||||
|
||||
import com.google.common.base.Charsets;
|
||||
import com.google.common.base.Preconditions;
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import com.google.common.io.Resources;
|
||||
import com.google.gson.Gson;
|
||||
@ -16,7 +17,6 @@ import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
import java.util.concurrent.locks.ReentrantLock;
|
||||
import org.apache.commons.lang.Validate;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.command.CommandSender;
|
||||
@ -127,9 +127,9 @@ public class VersionCommand extends BukkitCommand {
|
||||
@NotNull
|
||||
@Override
|
||||
public List<String> tabComplete(@NotNull CommandSender sender, @NotNull String alias, @NotNull String[] args) {
|
||||
Validate.notNull(sender, "Sender cannot be null");
|
||||
Validate.notNull(args, "Arguments cannot be null");
|
||||
Validate.notNull(alias, "Alias cannot be null");
|
||||
Preconditions.checkArgument(sender != null, "Sender cannot be null");
|
||||
Preconditions.checkArgument(args != null, "Arguments cannot be null");
|
||||
Preconditions.checkArgument(alias != null, "Alias cannot be null");
|
||||
|
||||
if (args.length == 1) {
|
||||
List<String> completions = new ArrayList<String>();
|
||||
|
@ -1,7 +1,7 @@
|
||||
package org.bukkit.configuration;
|
||||
|
||||
import com.google.common.base.Preconditions;
|
||||
import java.util.Map;
|
||||
import org.apache.commons.lang.Validate;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
@ -32,7 +32,7 @@ public class MemoryConfiguration extends MemorySection implements Configuration
|
||||
|
||||
@Override
|
||||
public void addDefault(@NotNull String path, @Nullable Object value) {
|
||||
Validate.notNull(path, "Path may not be null");
|
||||
Preconditions.checkArgument(path != null, "Path may not be null");
|
||||
|
||||
if (defaults == null) {
|
||||
defaults = new MemoryConfiguration();
|
||||
@ -43,7 +43,7 @@ public class MemoryConfiguration extends MemorySection implements Configuration
|
||||
|
||||
@Override
|
||||
public void addDefaults(@NotNull Map<String, Object> defaults) {
|
||||
Validate.notNull(defaults, "Defaults may not be null");
|
||||
Preconditions.checkArgument(defaults != null, "Defaults may not be null");
|
||||
|
||||
for (Map.Entry<String, Object> entry : defaults.entrySet()) {
|
||||
addDefault(entry.getKey(), entry.getValue());
|
||||
@ -52,7 +52,7 @@ public class MemoryConfiguration extends MemorySection implements Configuration
|
||||
|
||||
@Override
|
||||
public void addDefaults(@NotNull Configuration defaults) {
|
||||
Validate.notNull(defaults, "Defaults may not be null");
|
||||
Preconditions.checkArgument(defaults != null, "Defaults may not be null");
|
||||
|
||||
for (String key : defaults.getKeys(true)) {
|
||||
if (!defaults.isConfigurationSection(key)) {
|
||||
@ -63,7 +63,7 @@ public class MemoryConfiguration extends MemorySection implements Configuration
|
||||
|
||||
@Override
|
||||
public void setDefaults(@NotNull Configuration defaults) {
|
||||
Validate.notNull(defaults, "Defaults may not be null");
|
||||
Preconditions.checkArgument(defaults != null, "Defaults may not be null");
|
||||
|
||||
this.defaults = defaults;
|
||||
}
|
||||
|
@ -1,6 +1,8 @@
|
||||
package org.bukkit.configuration;
|
||||
|
||||
import static org.bukkit.util.NumberConversions.*;
|
||||
import com.google.common.base.Preconditions;
|
||||
import com.google.common.base.Strings;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.LinkedHashMap;
|
||||
@ -8,7 +10,6 @@ import java.util.LinkedHashSet;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import org.apache.commons.lang.Validate;
|
||||
import org.bukkit.Color;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.OfflinePlayer;
|
||||
@ -60,14 +61,14 @@ public class MemorySection implements ConfigurationSection {
|
||||
* if parent contains no root Configuration.
|
||||
*/
|
||||
protected MemorySection(@NotNull ConfigurationSection parent, @NotNull String path) {
|
||||
Validate.notNull(parent, "Parent cannot be null");
|
||||
Validate.notNull(path, "Path cannot be null");
|
||||
Preconditions.checkArgument(parent != null, "Parent cannot be null");
|
||||
Preconditions.checkArgument(path != null, "Path cannot be null");
|
||||
|
||||
this.path = path;
|
||||
this.parent = parent;
|
||||
this.root = parent.getRoot();
|
||||
|
||||
Validate.notNull(root, "Path cannot be orphaned");
|
||||
Preconditions.checkArgument(root != null, "Path cannot be orphaned");
|
||||
|
||||
this.fullPath = createPath(parent, path);
|
||||
}
|
||||
@ -158,7 +159,7 @@ public class MemorySection implements ConfigurationSection {
|
||||
|
||||
@Override
|
||||
public void addDefault(@NotNull String path, @Nullable Object value) {
|
||||
Validate.notNull(path, "Path cannot be null");
|
||||
Preconditions.checkArgument(path != null, "Path cannot be null");
|
||||
|
||||
Configuration root = getRoot();
|
||||
if (root == null) {
|
||||
@ -187,7 +188,7 @@ public class MemorySection implements ConfigurationSection {
|
||||
|
||||
@Override
|
||||
public void set(@NotNull String path, @Nullable Object value) {
|
||||
Validate.notEmpty(path, "Cannot set to an empty path");
|
||||
Preconditions.checkArgument(!Strings.isNullOrEmpty(path), "Cannot set to an empty path");
|
||||
|
||||
Configuration root = getRoot();
|
||||
if (root == null) {
|
||||
@ -240,7 +241,7 @@ public class MemorySection implements ConfigurationSection {
|
||||
@Contract("_, !null -> !null")
|
||||
@Nullable
|
||||
public Object get(@NotNull String path, @Nullable Object def) {
|
||||
Validate.notNull(path, "Path cannot be null");
|
||||
Preconditions.checkArgument(path != null, "Path cannot be null");
|
||||
|
||||
if (path.length() == 0) {
|
||||
return this;
|
||||
@ -278,7 +279,7 @@ public class MemorySection implements ConfigurationSection {
|
||||
@Override
|
||||
@NotNull
|
||||
public ConfigurationSection createSection(@NotNull String path) {
|
||||
Validate.notEmpty(path, "Cannot create section at empty path");
|
||||
Preconditions.checkArgument(!Strings.isNullOrEmpty(path), "Cannot create section at empty path");
|
||||
Configuration root = getRoot();
|
||||
if (root == null) {
|
||||
throw new IllegalStateException("Cannot create section without a root");
|
||||
@ -711,7 +712,7 @@ public class MemorySection implements ConfigurationSection {
|
||||
@Nullable
|
||||
@Override
|
||||
public <T extends Object> T getObject(@NotNull String path, @NotNull Class<T> clazz) {
|
||||
Validate.notNull(clazz, "Class cannot be null");
|
||||
Preconditions.checkArgument(clazz != null, "Class cannot be null");
|
||||
Object def = getDefault(path);
|
||||
return getObject(path, clazz, (def != null && clazz.isInstance(def)) ? clazz.cast(def) : null);
|
||||
}
|
||||
@ -720,7 +721,7 @@ public class MemorySection implements ConfigurationSection {
|
||||
@Nullable
|
||||
@Override
|
||||
public <T extends Object> T getObject(@NotNull String path, @NotNull Class<T> clazz, @Nullable T def) {
|
||||
Validate.notNull(clazz, "Class cannot be null");
|
||||
Preconditions.checkArgument(clazz != null, "Class cannot be null");
|
||||
Object val = get(path, def);
|
||||
return (val != null && clazz.isInstance(val)) ? clazz.cast(val) : def;
|
||||
}
|
||||
@ -855,7 +856,7 @@ public class MemorySection implements ConfigurationSection {
|
||||
|
||||
@Nullable
|
||||
protected Object getDefault(@NotNull String path) {
|
||||
Validate.notNull(path, "Path cannot be null");
|
||||
Preconditions.checkArgument(path != null, "Path cannot be null");
|
||||
|
||||
Configuration root = getRoot();
|
||||
Configuration defaults = root == null ? null : root.getDefaults();
|
||||
@ -940,7 +941,7 @@ public class MemorySection implements ConfigurationSection {
|
||||
*/
|
||||
@NotNull
|
||||
public static String createPath(@NotNull ConfigurationSection section, @Nullable String key, @Nullable ConfigurationSection relativeTo) {
|
||||
Validate.notNull(section, "Cannot create path without a section");
|
||||
Preconditions.checkArgument(section != null, "Cannot create path without a section");
|
||||
Configuration root = section.getRoot();
|
||||
if (root == null) {
|
||||
throw new IllegalStateException("Cannot create path without a root");
|
||||
@ -998,7 +999,7 @@ public class MemorySection implements ConfigurationSection {
|
||||
|
||||
@Nullable
|
||||
private SectionPathData getSectionPathData(@NotNull String path) {
|
||||
Validate.notNull(path, "Path cannot be null");
|
||||
Preconditions.checkArgument(path != null, "Path cannot be null");
|
||||
|
||||
Configuration root = getRoot();
|
||||
if (root == null) {
|
||||
|
@ -1,6 +1,7 @@
|
||||
package org.bukkit.configuration.file;
|
||||
|
||||
import com.google.common.base.Charsets;
|
||||
import com.google.common.base.Preconditions;
|
||||
import com.google.common.io.Files;
|
||||
import java.io.BufferedReader;
|
||||
import java.io.File;
|
||||
@ -12,7 +13,6 @@ import java.io.InputStreamReader;
|
||||
import java.io.OutputStreamWriter;
|
||||
import java.io.Reader;
|
||||
import java.io.Writer;
|
||||
import org.apache.commons.lang.Validate;
|
||||
import org.bukkit.configuration.Configuration;
|
||||
import org.bukkit.configuration.InvalidConfigurationException;
|
||||
import org.bukkit.configuration.MemoryConfiguration;
|
||||
@ -58,7 +58,7 @@ public abstract class FileConfiguration extends MemoryConfiguration {
|
||||
* @throws IllegalArgumentException Thrown when file is null.
|
||||
*/
|
||||
public void save(@NotNull File file) throws IOException {
|
||||
Validate.notNull(file, "File cannot be null");
|
||||
Preconditions.checkArgument(file != null, "File cannot be null");
|
||||
|
||||
Files.createParentDirs(file);
|
||||
|
||||
@ -89,7 +89,7 @@ public abstract class FileConfiguration extends MemoryConfiguration {
|
||||
* @throws IllegalArgumentException Thrown when file is null.
|
||||
*/
|
||||
public void save(@NotNull String file) throws IOException {
|
||||
Validate.notNull(file, "File cannot be null");
|
||||
Preconditions.checkArgument(file != null, "File cannot be null");
|
||||
|
||||
save(new File(file));
|
||||
}
|
||||
@ -121,7 +121,7 @@ public abstract class FileConfiguration extends MemoryConfiguration {
|
||||
* @throws IllegalArgumentException Thrown when file is null.
|
||||
*/
|
||||
public void load(@NotNull File file) throws FileNotFoundException, IOException, InvalidConfigurationException {
|
||||
Validate.notNull(file, "File cannot be null");
|
||||
Preconditions.checkArgument(file != null, "File cannot be null");
|
||||
|
||||
final FileInputStream stream = new FileInputStream(file);
|
||||
|
||||
@ -179,7 +179,7 @@ public abstract class FileConfiguration extends MemoryConfiguration {
|
||||
* @throws IllegalArgumentException Thrown when file is null.
|
||||
*/
|
||||
public void load(@NotNull String file) throws FileNotFoundException, IOException, InvalidConfigurationException {
|
||||
Validate.notNull(file, "File cannot be null");
|
||||
Preconditions.checkArgument(file != null, "File cannot be null");
|
||||
|
||||
load(new File(file));
|
||||
}
|
||||
|
@ -1,5 +1,6 @@
|
||||
package org.bukkit.configuration.file;
|
||||
|
||||
import com.google.common.base.Preconditions;
|
||||
import java.io.ByteArrayInputStream;
|
||||
import java.io.File;
|
||||
import java.io.FileNotFoundException;
|
||||
@ -12,7 +13,6 @@ import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.logging.Level;
|
||||
import org.apache.commons.lang.Validate;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.configuration.Configuration;
|
||||
import org.bukkit.configuration.ConfigurationSection;
|
||||
@ -94,7 +94,7 @@ public class YamlConfiguration extends FileConfiguration {
|
||||
|
||||
@Override
|
||||
public void loadFromString(@NotNull String contents) throws InvalidConfigurationException {
|
||||
Validate.notNull(contents, "String cannot be null");
|
||||
Preconditions.checkArgument(contents != null, "Contents cannot be null");
|
||||
yamlLoaderOptions.setProcessComments(options().parseComments());
|
||||
|
||||
MappingNode node;
|
||||
@ -296,7 +296,7 @@ public class YamlConfiguration extends FileConfiguration {
|
||||
*/
|
||||
@NotNull
|
||||
public static YamlConfiguration loadConfiguration(@NotNull File file) {
|
||||
Validate.notNull(file, "File cannot be null");
|
||||
Preconditions.checkArgument(file != null, "File cannot be null");
|
||||
|
||||
YamlConfiguration config = new YamlConfiguration();
|
||||
|
||||
@ -325,7 +325,7 @@ public class YamlConfiguration extends FileConfiguration {
|
||||
*/
|
||||
@NotNull
|
||||
public static YamlConfiguration loadConfiguration(@NotNull Reader reader) {
|
||||
Validate.notNull(reader, "Stream cannot be null");
|
||||
Preconditions.checkArgument(reader != null, "Stream cannot be null");
|
||||
|
||||
YamlConfiguration config = new YamlConfiguration();
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
package org.bukkit.configuration.file;
|
||||
|
||||
import com.google.common.base.Preconditions;
|
||||
import java.util.List;
|
||||
import org.apache.commons.lang.Validate;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
@ -95,8 +95,8 @@ public class YamlConfigurationOptions extends FileConfigurationOptions {
|
||||
*/
|
||||
@NotNull
|
||||
public YamlConfigurationOptions indent(int value) {
|
||||
Validate.isTrue(value >= 2, "Indent must be at least 2 characters");
|
||||
Validate.isTrue(value <= 9, "Indent cannot be greater than 9 characters");
|
||||
Preconditions.checkArgument(value >= 2, "Indent must be at least 2 characters");
|
||||
Preconditions.checkArgument(value <= 9, "Indent cannot be greater than 9 characters");
|
||||
|
||||
this.indent = value;
|
||||
return this;
|
||||
|
@ -1,5 +1,6 @@
|
||||
package org.bukkit.configuration.serialization;
|
||||
|
||||
import com.google.common.base.Preconditions;
|
||||
import java.lang.reflect.Constructor;
|
||||
import java.lang.reflect.InvocationTargetException;
|
||||
import java.lang.reflect.Method;
|
||||
@ -8,7 +9,6 @@ import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
import org.apache.commons.lang.Validate;
|
||||
import org.bukkit.Color;
|
||||
import org.bukkit.FireworkEffect;
|
||||
import org.bukkit.Location;
|
||||
@ -115,7 +115,7 @@ public class ConfigurationSerialization {
|
||||
|
||||
@Nullable
|
||||
public ConfigurationSerializable deserialize(@NotNull Map<String, ?> args) {
|
||||
Validate.notNull(args, "Args must not be null");
|
||||
Preconditions.checkArgument(args != null, "Args must not be null");
|
||||
|
||||
ConfigurationSerializable result = null;
|
||||
Method method = null;
|
||||
|
@ -1,7 +1,8 @@
|
||||
package org.bukkit.conversations;
|
||||
|
||||
import org.apache.commons.lang.ArrayUtils;
|
||||
import org.apache.commons.lang.BooleanUtils;
|
||||
import com.google.common.collect.ImmutableSet;
|
||||
import java.util.Locale;
|
||||
import java.util.Set;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
@ -11,21 +12,23 @@ import org.jetbrains.annotations.Nullable;
|
||||
*/
|
||||
public abstract class BooleanPrompt extends ValidatingPrompt {
|
||||
|
||||
private static final Set<String> TRUE_INPUTS = ImmutableSet.of("true", "on", "yes", "y", "1", "right", "correct", "valid");
|
||||
private static final Set<String> FALSE_INPUTS = ImmutableSet.of("false", "off", "no", "n", "0", "wrong", "incorrect", "invalid");
|
||||
private static final Set<String> VALID_INPUTS = ImmutableSet.<String>builder().addAll(TRUE_INPUTS).addAll(FALSE_INPUTS).build();
|
||||
|
||||
public BooleanPrompt() {
|
||||
super();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean isInputValid(@NotNull ConversationContext context, @NotNull String input) {
|
||||
String[] accepted = {/* Apache values: */ "true", "false", "on", "off", "yes", "no", /* Additional values: */ "y", "n", "1", "0", "right", "wrong", "correct", "incorrect", "valid", "invalid"};
|
||||
return ArrayUtils.contains(accepted, input.toLowerCase());
|
||||
return VALID_INPUTS.contains(input.toLowerCase(Locale.ROOT));
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
protected Prompt acceptValidatedInput(@NotNull ConversationContext context, @NotNull String input) {
|
||||
if (input.equalsIgnoreCase("y") || input.equals("1") || input.equalsIgnoreCase("right") || input.equalsIgnoreCase("correct") || input.equalsIgnoreCase("valid")) input = "true";
|
||||
return acceptValidatedInput(context, BooleanUtils.toBoolean(input));
|
||||
return acceptValidatedInput(context, TRUE_INPUTS.contains(input.toLowerCase(Locale.ROOT)));
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1,8 +1,8 @@
|
||||
package org.bukkit.conversations;
|
||||
|
||||
import com.google.common.base.Joiner;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
/**
|
||||
@ -42,6 +42,6 @@ public abstract class FixedSetPrompt extends ValidatingPrompt {
|
||||
*/
|
||||
@NotNull
|
||||
protected String formatFixedSet() {
|
||||
return "[" + StringUtils.join(fixedSet, ", ") + "]";
|
||||
return "[" + Joiner.on(", ").join(fixedSet) + "]";
|
||||
}
|
||||
}
|
||||
|
@ -1,6 +1,6 @@
|
||||
package org.bukkit.conversations;
|
||||
|
||||
import org.apache.commons.lang.math.NumberUtils;
|
||||
import org.apache.commons.lang3.math.NumberUtils;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
|
@ -205,6 +205,11 @@ public abstract class Enchantment implements Keyed {
|
||||
*/
|
||||
public static final Enchantment SOUL_SPEED = new EnchantmentWrapper("soul_speed");
|
||||
|
||||
/**
|
||||
* Walk quicker while sneaking
|
||||
*/
|
||||
public static final Enchantment SWIFT_SNEAK = new EnchantmentWrapper("swift_sneak");
|
||||
|
||||
private static final Map<NamespacedKey, Enchantment> byKey = new HashMap<NamespacedKey, Enchantment>();
|
||||
private static final Map<String, Enchantment> byName = new HashMap<String, Enchantment>();
|
||||
private static boolean acceptingNew = true;
|
||||
|
@ -1,6 +1,6 @@
|
||||
package org.bukkit.enchantments;
|
||||
|
||||
import org.apache.commons.lang.Validate;
|
||||
import com.google.common.base.Preconditions;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
/**
|
||||
@ -34,7 +34,7 @@ public class EnchantmentOffer {
|
||||
* @param enchantment type of the enchantment
|
||||
*/
|
||||
public void setEnchantment(@NotNull Enchantment enchantment) {
|
||||
Validate.notNull(enchantment, "The enchantment may not be null!");
|
||||
Preconditions.checkArgument(enchantment != null, "The enchantment may not be null!");
|
||||
|
||||
this.enchantment = enchantment;
|
||||
}
|
||||
@ -54,7 +54,7 @@ public class EnchantmentOffer {
|
||||
* @param enchantmentLevel level of the enchantment
|
||||
*/
|
||||
public void setEnchantmentLevel(int enchantmentLevel) {
|
||||
Validate.isTrue(enchantmentLevel > 0, "The enchantment level must be greater than 0!");
|
||||
Preconditions.checkArgument(enchantmentLevel > 0, "The enchantment level must be greater than 0!");
|
||||
|
||||
this.enchantmentLevel = enchantmentLevel;
|
||||
}
|
||||
@ -76,7 +76,7 @@ public class EnchantmentOffer {
|
||||
* @param cost cost for this enchantment
|
||||
*/
|
||||
public void setCost(int cost) {
|
||||
Validate.isTrue(cost > 0, "The cost must be greater than 0!");
|
||||
Preconditions.checkArgument(cost > 0, "The cost must be greater than 0!");
|
||||
|
||||
this.cost = cost;
|
||||
}
|
||||
|
9
paper-api/src/main/java/org/bukkit/entity/Allay.java
Normal file
9
paper-api/src/main/java/org/bukkit/entity/Allay.java
Normal file
@ -0,0 +1,9 @@
|
||||
package org.bukkit.entity;
|
||||
|
||||
import org.bukkit.inventory.InventoryHolder;
|
||||
|
||||
/**
|
||||
* An Allay.
|
||||
*/
|
||||
public interface Allay extends Creature, InventoryHolder {
|
||||
}
|
10
paper-api/src/main/java/org/bukkit/entity/ChestBoat.java
Normal file
10
paper-api/src/main/java/org/bukkit/entity/ChestBoat.java
Normal file
@ -0,0 +1,10 @@
|
||||
package org.bukkit.entity;
|
||||
|
||||
import org.bukkit.inventory.InventoryHolder;
|
||||
import org.bukkit.loot.Lootable;
|
||||
|
||||
/**
|
||||
* A {@link Boat} with a chest.
|
||||
*/
|
||||
public interface ChestBoat extends Boat, InventoryHolder, Lootable {
|
||||
}
|
@ -271,6 +271,11 @@ public enum EntityType implements Keyed {
|
||||
GLOW_SQUID("glow_squid", GlowSquid.class, -1),
|
||||
GOAT("goat", Goat.class, -1),
|
||||
MARKER("marker", Marker.class, -1),
|
||||
ALLAY("allay", Allay.class, -1),
|
||||
CHEST_BOAT("chest_boat", ChestBoat.class, -1),
|
||||
FROG("frog", Frog.class, -1),
|
||||
TADPOLE("tadpole", Tadpole.class, -1),
|
||||
WARDEN("warden", Warden.class, -1),
|
||||
/**
|
||||
* A fishing line and bobber.
|
||||
*/
|
||||
|
73
paper-api/src/main/java/org/bukkit/entity/Frog.java
Normal file
73
paper-api/src/main/java/org/bukkit/entity/Frog.java
Normal file
@ -0,0 +1,73 @@
|
||||
package org.bukkit.entity;
|
||||
|
||||
import java.util.Locale;
|
||||
import org.bukkit.Keyed;
|
||||
import org.bukkit.NamespacedKey;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
/**
|
||||
* A Frog.
|
||||
*/
|
||||
public interface Frog extends Animals {
|
||||
|
||||
/**
|
||||
* Gets the tongue target of this frog.
|
||||
*
|
||||
* @return tongue target or null if not set
|
||||
*/
|
||||
@Nullable
|
||||
Entity getTongueTarget();
|
||||
|
||||
/**
|
||||
* Sets the tongue target of this frog.
|
||||
*
|
||||
* @param target tongue target or null to clear
|
||||
*/
|
||||
void setTongueTarget(@Nullable Entity target);
|
||||
|
||||
/**
|
||||
* Get the variant of this frog.
|
||||
*
|
||||
* @return frog variant
|
||||
*/
|
||||
@NotNull
|
||||
Variant getVariant();
|
||||
|
||||
/**
|
||||
* Set the variant of this frog.
|
||||
*
|
||||
* @param variant frog variant
|
||||
*/
|
||||
void setVariant(@NotNull Variant variant);
|
||||
|
||||
/**
|
||||
* Represents the variant of a frog - ie its color.
|
||||
*/
|
||||
public enum Variant implements Keyed {
|
||||
|
||||
/**
|
||||
* Temperate (brown-orange) frog.
|
||||
*/
|
||||
TEMPERATE,
|
||||
/**
|
||||
* Warm (gray) frog.
|
||||
*/
|
||||
WARM,
|
||||
/**
|
||||
* Cold (green) frog.
|
||||
*/
|
||||
COLD;
|
||||
private final NamespacedKey key;
|
||||
|
||||
private Variant() {
|
||||
this.key = NamespacedKey.minecraft(name().toLowerCase(Locale.ROOT));
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public NamespacedKey getKey() {
|
||||
return key;
|
||||
}
|
||||
}
|
||||
}
|
@ -5,6 +5,34 @@ package org.bukkit.entity;
|
||||
*/
|
||||
public interface Goat extends Animals {
|
||||
|
||||
/**
|
||||
* Gets if this goat has its left horn.
|
||||
*
|
||||
* @return left horn status
|
||||
*/
|
||||
boolean hasLeftHorn();
|
||||
|
||||
/**
|
||||
* Sets if this goat has its left horn.
|
||||
*
|
||||
* @param hasHorn left horn status
|
||||
*/
|
||||
void setLeftHorn(boolean hasHorn);
|
||||
|
||||
/**
|
||||
* Gets if this goat has its right horn.
|
||||
*
|
||||
* @return right horn status
|
||||
*/
|
||||
boolean hasRightHorn();
|
||||
|
||||
/**
|
||||
* Sets if this goat has its right horn.
|
||||
*
|
||||
* @param hasHorn right horn status
|
||||
*/
|
||||
void setRightHorn(boolean hasHorn);
|
||||
|
||||
/**
|
||||
* Gets if this is a screaming goat.
|
||||
*
|
||||
|
@ -37,5 +37,29 @@ public enum Pose {
|
||||
/**
|
||||
* Entity is dead.
|
||||
*/
|
||||
DYING;
|
||||
DYING,
|
||||
/**
|
||||
* Entity is croaking.
|
||||
*/
|
||||
CROAKING,
|
||||
/**
|
||||
* Entity is using its tongue.
|
||||
*/
|
||||
USING_TONGUE,
|
||||
/**
|
||||
* Entity is roaring.
|
||||
*/
|
||||
ROARING,
|
||||
/**
|
||||
* Entity is sniffing.
|
||||
*/
|
||||
SNIFFING,
|
||||
/**
|
||||
* Entity is emerging.
|
||||
*/
|
||||
EMERGING,
|
||||
/**
|
||||
* Entity is digging.
|
||||
*/
|
||||
DIGGING;
|
||||
}
|
||||
|
21
paper-api/src/main/java/org/bukkit/entity/Tadpole.java
Normal file
21
paper-api/src/main/java/org/bukkit/entity/Tadpole.java
Normal file
@ -0,0 +1,21 @@
|
||||
package org.bukkit.entity;
|
||||
|
||||
/**
|
||||
* A baby {@link Frog}.
|
||||
*/
|
||||
public interface Tadpole extends Fish {
|
||||
|
||||
/**
|
||||
* Gets the age of this mob.
|
||||
*
|
||||
* @return Age
|
||||
*/
|
||||
public int getAge();
|
||||
|
||||
/**
|
||||
* Sets the age of this mob.
|
||||
*
|
||||
* @param age New age
|
||||
*/
|
||||
public void setAge(int age);
|
||||
}
|
38
paper-api/src/main/java/org/bukkit/entity/Warden.java
Normal file
38
paper-api/src/main/java/org/bukkit/entity/Warden.java
Normal file
@ -0,0 +1,38 @@
|
||||
package org.bukkit.entity;
|
||||
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
/**
|
||||
* A Warden.
|
||||
*/
|
||||
public interface Warden extends Monster {
|
||||
|
||||
/**
|
||||
* Gets the anger level of this warden.
|
||||
*
|
||||
* Anger is an integer from 0 to 150. Once a Warden reaches 80 anger at a
|
||||
* target it will actively pursue it.
|
||||
*
|
||||
* @param entity target
|
||||
* @return anger level
|
||||
*/
|
||||
int getAnger(@NotNull Entity entity);
|
||||
|
||||
/**
|
||||
* Increases the anger level of this warden.
|
||||
*
|
||||
* @param entity target
|
||||
* @param increase number to increase by
|
||||
* @see #getAnger(org.bukkit.entity.Entity)
|
||||
*/
|
||||
void increaseAnger(@NotNull Entity entity, int increase);
|
||||
|
||||
/**
|
||||
* Sets the anger level of this warden.
|
||||
*
|
||||
* @param entity target
|
||||
* @param anger new anger level
|
||||
* @see #getAnger(org.bukkit.entity.Entity)
|
||||
*/
|
||||
void setAnger(@NotNull Entity entity, int anger);
|
||||
}
|
@ -65,6 +65,10 @@ public final class MemoryKey<T> implements Keyed {
|
||||
public static final MemoryKey<Integer> LONG_JUMP_COOLING_DOWN = new MemoryKey<>(NamespacedKey.minecraft("long_jump_cooling_down"), Integer.class);
|
||||
public static final MemoryKey<Boolean> HAS_HUNTING_COOLDOWN = new MemoryKey<>(NamespacedKey.minecraft("has_hunting_cooldown"), Boolean.class);
|
||||
public static final MemoryKey<Integer> RAM_COOLDOWN_TICKS = new MemoryKey<>(NamespacedKey.minecraft("ram_cooldown_ticks"), Integer.class);
|
||||
public static final MemoryKey<UUID> LIKED_PLAYER = new MemoryKey<>(NamespacedKey.minecraft("liked_player"), UUID.class);
|
||||
public static final MemoryKey<Location> LIKED_NOTEBLOCK_POSITION = new MemoryKey<>(NamespacedKey.minecraft("liked_noteblock"), Location.class);
|
||||
public static final MemoryKey<Integer> LIKED_NOTEBLOCK_COOLDOWN_TICKS = new MemoryKey<>(NamespacedKey.minecraft("liked_noteblock_cooldown_ticks"), Integer.class);
|
||||
public static final MemoryKey<Integer> ITEM_PICKUP_COOLDOWN_TICKS = new MemoryKey<>(NamespacedKey.minecraft("item_pickup_cooldown_ticks"), Integer.class);
|
||||
|
||||
/**
|
||||
* Returns a {@link MemoryKey} by a {@link NamespacedKey}.
|
||||
|
@ -1,8 +1,8 @@
|
||||
package org.bukkit.event.enchantment;
|
||||
|
||||
import com.google.common.base.Preconditions;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import org.apache.commons.lang.Validate;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.enchantments.Enchantment;
|
||||
import org.bukkit.entity.Player;
|
||||
@ -85,7 +85,7 @@ public class EnchantItemEvent extends InventoryEvent implements Cancellable {
|
||||
* @param level - cost in levels
|
||||
*/
|
||||
public void setExpLevelCost(int level) {
|
||||
Validate.isTrue(level > 0, "The cost must be greater than 0!");
|
||||
Preconditions.checkArgument(level > 0, "The cost must be greater than 0!");
|
||||
|
||||
this.level = level;
|
||||
}
|
||||
|
@ -1,6 +1,6 @@
|
||||
package org.bukkit.event.entity;
|
||||
|
||||
import org.apache.commons.lang.Validate;
|
||||
import com.google.common.base.Preconditions;
|
||||
import org.bukkit.entity.EnderDragon;
|
||||
import org.bukkit.event.Cancellable;
|
||||
import org.bukkit.event.HandlerList;
|
||||
@ -56,7 +56,7 @@ public class EnderDragonChangePhaseEvent extends EntityEvent implements Cancella
|
||||
* @param newPhase the new dragon phase
|
||||
*/
|
||||
public void setNewPhase(@NotNull EnderDragon.Phase newPhase) {
|
||||
Validate.notNull(newPhase, "New dragon phase cannot be null");
|
||||
Preconditions.checkArgument(newPhase != null, "New dragon phase cannot be null");
|
||||
this.newPhase = newPhase;
|
||||
}
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
package org.bukkit.event.entity;
|
||||
|
||||
import org.apache.commons.lang.Validate;
|
||||
import com.google.common.base.Preconditions;
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
import org.bukkit.event.Cancellable;
|
||||
import org.bukkit.event.HandlerList;
|
||||
@ -26,9 +26,9 @@ public class EntityBreedEvent extends EntityEvent implements Cancellable {
|
||||
public EntityBreedEvent(@NotNull LivingEntity child, @NotNull LivingEntity mother, @NotNull LivingEntity father, @Nullable LivingEntity breeder, @Nullable ItemStack bredWith, int experience) {
|
||||
super(child);
|
||||
|
||||
Validate.notNull(child, "Cannot have null child");
|
||||
Validate.notNull(mother, "Cannot have null mother");
|
||||
Validate.notNull(father, "Cannot have null father");
|
||||
Preconditions.checkArgument(child != null, "Cannot have null child");
|
||||
Preconditions.checkArgument(mother != null, "Cannot have null mother");
|
||||
Preconditions.checkArgument(father != null, "Cannot have null father");
|
||||
|
||||
// Breeder can be null in the case of spontaneous conception
|
||||
this.mother = mother;
|
||||
@ -101,7 +101,7 @@ public class EntityBreedEvent extends EntityEvent implements Cancellable {
|
||||
* @param experience experience amount
|
||||
*/
|
||||
public void setExperience(int experience) {
|
||||
Validate.isTrue(experience >= 0, "Experience cannot be negative");
|
||||
Preconditions.checkArgument(experience >= 0, "Experience cannot be negative");
|
||||
this.experience = experience;
|
||||
}
|
||||
|
||||
|
@ -2,10 +2,11 @@ package org.bukkit.event.entity;
|
||||
|
||||
import com.google.common.base.Function;
|
||||
import com.google.common.base.Functions;
|
||||
import com.google.common.base.Preconditions;
|
||||
import com.google.common.collect.ImmutableMap;
|
||||
import java.util.EnumMap;
|
||||
import java.util.Map;
|
||||
import org.apache.commons.lang.Validate;
|
||||
import java.util.Objects;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.entity.Player;
|
||||
@ -32,11 +33,11 @@ public class EntityDamageEvent extends EntityEvent implements Cancellable {
|
||||
|
||||
public EntityDamageEvent(@NotNull final Entity damagee, @NotNull final DamageCause cause, @NotNull final Map<DamageModifier, Double> modifiers, @NotNull final Map<DamageModifier, ? extends Function<? super Double, Double>> modifierFunctions) {
|
||||
super(damagee);
|
||||
Validate.isTrue(modifiers.containsKey(DamageModifier.BASE), "BASE DamageModifier missing");
|
||||
Validate.isTrue(!modifiers.containsKey(null), "Cannot have null DamageModifier");
|
||||
Validate.noNullElements(modifiers.values(), "Cannot have null modifier values");
|
||||
Validate.isTrue(modifiers.keySet().equals(modifierFunctions.keySet()), "Must have a modifier function for each DamageModifier");
|
||||
Validate.noNullElements(modifierFunctions.values(), "Cannot have null modifier function");
|
||||
Preconditions.checkArgument(modifiers.containsKey(DamageModifier.BASE), "BASE DamageModifier missing");
|
||||
Preconditions.checkArgument(!modifiers.containsKey(null), "Cannot have null DamageModifier");
|
||||
Preconditions.checkArgument(modifiers.values().stream().allMatch(Objects::nonNull), "Cannot have null modifier values");
|
||||
Preconditions.checkArgument(modifiers.keySet().equals(modifierFunctions.keySet()), "Must have a modifier function for each DamageModifier");
|
||||
Preconditions.checkArgument(modifierFunctions.values().stream().allMatch(Objects::nonNull), "Cannot have null modifier function");
|
||||
this.originals = new EnumMap<DamageModifier, Double>(modifiers);
|
||||
this.cause = cause;
|
||||
this.modifiers = modifiers;
|
||||
@ -99,7 +100,7 @@ public class EntityDamageEvent extends EntityEvent implements Cancellable {
|
||||
* @see DamageModifier#BASE
|
||||
*/
|
||||
public double getDamage(@NotNull DamageModifier type) throws IllegalArgumentException {
|
||||
Validate.notNull(type, "Cannot have null DamageModifier");
|
||||
Preconditions.checkArgument(type != null, "Cannot have null DamageModifier");
|
||||
final Double damage = modifiers.get(type);
|
||||
return damage == null ? 0 : damage;
|
||||
}
|
||||
@ -116,7 +117,7 @@ public class EntityDamageEvent extends EntityEvent implements Cancellable {
|
||||
* @throws IllegalArgumentException if type is null
|
||||
*/
|
||||
public boolean isApplicable(@NotNull DamageModifier type) throws IllegalArgumentException {
|
||||
Validate.notNull(type, "Cannot have null DamageModifier");
|
||||
Preconditions.checkArgument(type != null, "Cannot have null DamageModifier");
|
||||
return modifiers.containsKey(type);
|
||||
}
|
||||
|
||||
|
@ -1,9 +1,9 @@
|
||||
package org.bukkit.event.entity;
|
||||
|
||||
import com.google.common.base.Preconditions;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.Map;
|
||||
import org.apache.commons.lang.Validate;
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
import org.bukkit.entity.ThrownPotion;
|
||||
import org.bukkit.event.Cancellable;
|
||||
@ -70,7 +70,7 @@ public class PotionSplashEvent extends ProjectileHitEvent implements Cancellable
|
||||
* @param intensity relative to maximum effect
|
||||
*/
|
||||
public void setIntensity(@NotNull LivingEntity entity, double intensity) {
|
||||
Validate.notNull(entity, "You must specify a valid entity.");
|
||||
Preconditions.checkArgument(entity != null, "You must specify a valid entity.");
|
||||
if (intensity <= 0.0) {
|
||||
affectedEntities.remove(entity);
|
||||
} else {
|
||||
|
@ -1,10 +1,10 @@
|
||||
package org.bukkit.event.inventory;
|
||||
|
||||
import com.google.common.base.Preconditions;
|
||||
import com.google.common.collect.ImmutableSet;
|
||||
import java.util.Collections;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import org.apache.commons.lang.Validate;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.entity.HumanEntity;
|
||||
import org.bukkit.entity.Player;
|
||||
@ -65,8 +65,8 @@ public class InventoryDragEvent extends InventoryInteractEvent {
|
||||
public InventoryDragEvent(@NotNull InventoryView what, @Nullable ItemStack newCursor, @NotNull ItemStack oldCursor, boolean right, @NotNull Map<Integer, ItemStack> slots) {
|
||||
super(what);
|
||||
|
||||
Validate.notNull(oldCursor);
|
||||
Validate.notNull(slots);
|
||||
Preconditions.checkArgument(oldCursor != null);
|
||||
Preconditions.checkArgument(slots != null);
|
||||
|
||||
type = right ? DragType.SINGLE : DragType.EVEN;
|
||||
this.newCursor = newCursor;
|
||||
|
@ -1,6 +1,6 @@
|
||||
package org.bukkit.event.inventory;
|
||||
|
||||
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;
|
||||
@ -33,7 +33,7 @@ public class InventoryMoveItemEvent extends Event implements Cancellable {
|
||||
private final boolean didSourceInitiate;
|
||||
|
||||
public InventoryMoveItemEvent(@NotNull final Inventory sourceInventory, @NotNull final ItemStack itemStack, @NotNull final Inventory destinationInventory, final boolean didSourceInitiate) {
|
||||
Validate.notNull(itemStack, "ItemStack cannot be null");
|
||||
Preconditions.checkArgument(itemStack != null, "ItemStack cannot be null");
|
||||
this.sourceInventory = sourceInventory;
|
||||
this.itemStack = itemStack;
|
||||
this.destinationInventory = destinationInventory;
|
||||
@ -69,7 +69,7 @@ public class InventoryMoveItemEvent extends Event implements Cancellable {
|
||||
* @param itemStack The ItemStack
|
||||
*/
|
||||
public void setItem(@NotNull ItemStack itemStack) {
|
||||
Validate.notNull(itemStack, "ItemStack cannot be null. Cancel the event if you want nothing to be transferred.");
|
||||
Preconditions.checkArgument(itemStack != null, "ItemStack cannot be null. Cancel the event if you want nothing to be transferred.");
|
||||
this.itemStack = itemStack.clone();
|
||||
}
|
||||
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -1,8 +1,8 @@
|
||||
package org.bukkit.event.server;
|
||||
|
||||
import com.google.common.base.Preconditions;
|
||||
import java.net.InetAddress;
|
||||
import java.util.Iterator;
|
||||
import org.apache.commons.lang.Validate;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.UndefinedNullability;
|
||||
import org.bukkit.entity.Player;
|
||||
@ -27,7 +27,7 @@ public class ServerListPingEvent extends ServerEvent implements Iterable<Player>
|
||||
|
||||
public ServerListPingEvent(@NotNull final InetAddress address, @NotNull final String motd, final int numPlayers, final int maxPlayers) {
|
||||
super(true);
|
||||
Validate.isTrue(numPlayers >= 0, "Cannot have negative number of players online", numPlayers);
|
||||
Preconditions.checkArgument(numPlayers >= 0, "Cannot have negative number of players online", numPlayers);
|
||||
this.address = address;
|
||||
this.motd = motd;
|
||||
this.numPlayers = numPlayers;
|
||||
|
@ -1,7 +1,7 @@
|
||||
package org.bukkit.event.server;
|
||||
|
||||
import com.google.common.base.Preconditions;
|
||||
import java.util.List;
|
||||
import org.apache.commons.lang.Validate;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.event.Cancellable;
|
||||
import org.bukkit.event.Event;
|
||||
@ -29,9 +29,9 @@ public class TabCompleteEvent extends Event implements Cancellable {
|
||||
private boolean cancelled;
|
||||
|
||||
public TabCompleteEvent(@NotNull CommandSender sender, @NotNull String buffer, @NotNull List<String> completions) {
|
||||
Validate.notNull(sender, "sender");
|
||||
Validate.notNull(buffer, "buffer");
|
||||
Validate.notNull(completions, "completions");
|
||||
Preconditions.checkArgument(sender != null, "sender");
|
||||
Preconditions.checkArgument(buffer != null, "buffer");
|
||||
Preconditions.checkArgument(completions != null, "completions");
|
||||
|
||||
this.sender = sender;
|
||||
this.buffer = buffer;
|
||||
@ -75,7 +75,7 @@ public class TabCompleteEvent extends Event implements Cancellable {
|
||||
* @param completions the new completions
|
||||
*/
|
||||
public void setCompletions(@NotNull List<String> completions) {
|
||||
Validate.notNull(completions);
|
||||
Preconditions.checkArgument(completions != null);
|
||||
this.completions = completions;
|
||||
}
|
||||
|
||||
|
@ -24,8 +24,8 @@ public class GenericGameEvent extends WorldEvent implements Cancellable {
|
||||
private int radius;
|
||||
private boolean cancelled;
|
||||
|
||||
public GenericGameEvent(@NotNull GameEvent event, @NotNull Location location, @Nullable Entity entity, int radius) {
|
||||
super(location.getWorld());
|
||||
public GenericGameEvent(@NotNull GameEvent event, @NotNull Location location, @Nullable Entity entity, int radius, boolean isAsync) {
|
||||
super(location.getWorld(), isAsync);
|
||||
this.event = event;
|
||||
this.location = location;
|
||||
this.entity = entity;
|
||||
|
@ -11,6 +11,11 @@ public abstract class WorldEvent extends Event {
|
||||
private final World world;
|
||||
|
||||
public WorldEvent(@NotNull final World world) {
|
||||
this(world, false);
|
||||
}
|
||||
|
||||
public WorldEvent(@NotNull World world, boolean isAsync) {
|
||||
super(isAsync);
|
||||
this.world = world;
|
||||
}
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
package org.bukkit.help;
|
||||
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import com.google.common.base.Joiner;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandSender;
|
||||
@ -54,7 +54,7 @@ public class GenericCommandHelpTopic extends HelpTopic {
|
||||
sb.append(ChatColor.GOLD);
|
||||
sb.append("Aliases: ");
|
||||
sb.append(ChatColor.WHITE);
|
||||
sb.append(ChatColor.WHITE + StringUtils.join(command.getAliases(), ", "));
|
||||
sb.append(Joiner.on(", ").join(command.getAliases()));
|
||||
}
|
||||
fullText = sb.toString();
|
||||
}
|
||||
|
@ -1,9 +1,9 @@
|
||||
package org.bukkit.inventory;
|
||||
|
||||
import com.google.common.base.Preconditions;
|
||||
import com.google.common.collect.ImmutableMap;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.Map;
|
||||
import org.apache.commons.lang.Validate;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.Utility;
|
||||
@ -79,7 +79,7 @@ public class ItemStack implements Cloneable, ConfigurationSerializable {
|
||||
*/
|
||||
@Deprecated
|
||||
public ItemStack(@NotNull final Material type, final int amount, final short damage, @Nullable final Byte data) {
|
||||
Validate.notNull(type, "Material cannot be null");
|
||||
Preconditions.checkArgument(type != null, "Material cannot be null");
|
||||
this.type = type;
|
||||
this.amount = amount;
|
||||
if (damage != 0) {
|
||||
@ -98,7 +98,7 @@ public class ItemStack implements Cloneable, ConfigurationSerializable {
|
||||
* returns an item meta not created by the item factory
|
||||
*/
|
||||
public ItemStack(@NotNull final ItemStack stack) throws IllegalArgumentException {
|
||||
Validate.notNull(stack, "Cannot copy null stack");
|
||||
Preconditions.checkArgument(stack != null, "Cannot copy null stack");
|
||||
this.type = stack.getType();
|
||||
this.amount = stack.getAmount();
|
||||
if (this.type.isLegacy()) {
|
||||
@ -133,7 +133,7 @@ public class ItemStack implements Cloneable, ConfigurationSerializable {
|
||||
*/
|
||||
@Utility
|
||||
public void setType(@NotNull Material type) {
|
||||
Validate.notNull(type, "Material cannot be null");
|
||||
Preconditions.checkArgument(type != null, "Material cannot be null");
|
||||
this.type = type;
|
||||
if (this.meta != null) {
|
||||
this.meta = Bukkit.getItemFactory().asMetaFor(meta, type);
|
||||
@ -368,7 +368,7 @@ public class ItemStack implements Cloneable, ConfigurationSerializable {
|
||||
*/
|
||||
@Utility
|
||||
public void addEnchantments(@NotNull Map<Enchantment, Integer> enchantments) {
|
||||
Validate.notNull(enchantments, "Enchantments cannot be null");
|
||||
Preconditions.checkArgument(enchantments != null, "Enchantments cannot be null");
|
||||
for (Map.Entry<Enchantment, Integer> entry : enchantments.entrySet()) {
|
||||
addEnchantment(entry.getKey(), entry.getValue());
|
||||
}
|
||||
@ -387,7 +387,7 @@ public class ItemStack implements Cloneable, ConfigurationSerializable {
|
||||
*/
|
||||
@Utility
|
||||
public void addEnchantment(@NotNull Enchantment ench, int level) {
|
||||
Validate.notNull(ench, "Enchantment cannot be null");
|
||||
Preconditions.checkArgument(ench != null, "Enchantment cannot be null");
|
||||
if ((level < ench.getStartLevel()) || (level > ench.getMaxLevel())) {
|
||||
throw new IllegalArgumentException("Enchantment level is either too low or too high (given " + level + ", bounds are " + ench.getStartLevel() + " to " + ench.getMaxLevel() + ")");
|
||||
} else if (!ench.canEnchantItem(this)) {
|
||||
|
@ -4,7 +4,6 @@ import com.google.common.base.Preconditions;
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import org.apache.commons.lang.Validate;
|
||||
import org.bukkit.Keyed;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.NamespacedKey;
|
||||
@ -61,15 +60,15 @@ public class ShapedRecipe implements Recipe, Keyed {
|
||||
*/
|
||||
@NotNull
|
||||
public ShapedRecipe shape(@NotNull final String... shape) {
|
||||
Validate.notNull(shape, "Must provide a shape");
|
||||
Validate.isTrue(shape.length > 0 && shape.length < 4, "Crafting recipes should be 1, 2 or 3 rows, not ", shape.length);
|
||||
Preconditions.checkArgument(shape != null, "Must provide a shape");
|
||||
Preconditions.checkArgument(shape.length > 0 && shape.length < 4, "Crafting recipes should be 1, 2 or 3 rows, not ", shape.length);
|
||||
|
||||
int lastLen = -1;
|
||||
for (String row : shape) {
|
||||
Validate.notNull(row, "Shape cannot have null rows");
|
||||
Validate.isTrue(row.length() > 0 && row.length() < 4, "Crafting rows should be 1, 2, or 3 characters, not ", row.length());
|
||||
Preconditions.checkArgument(row != null, "Shape cannot have null rows");
|
||||
Preconditions.checkArgument(row.length() > 0 && row.length() < 4, "Crafting rows should be 1, 2, or 3 characters, not ", row.length());
|
||||
|
||||
Validate.isTrue(lastLen == -1 || lastLen == row.length(), "Crafting recipes must be rectangular");
|
||||
Preconditions.checkArgument(lastLen == -1 || lastLen == row.length(), "Crafting recipes must be rectangular");
|
||||
lastLen = row.length();
|
||||
}
|
||||
this.rows = new String[shape.length];
|
||||
@ -125,7 +124,7 @@ public class ShapedRecipe implements Recipe, Keyed {
|
||||
@Deprecated
|
||||
@NotNull
|
||||
public ShapedRecipe setIngredient(char key, @NotNull Material ingredient, int raw) {
|
||||
Validate.isTrue(ingredients.containsKey(key), "Symbol does not appear in the shape:", key);
|
||||
Preconditions.checkArgument(ingredients.containsKey(key), "Symbol does not appear in the shape:", key);
|
||||
|
||||
// -1 is the old wildcard, map to Short.MAX_VALUE as the new one
|
||||
if (raw == -1) {
|
||||
@ -138,7 +137,7 @@ public class ShapedRecipe implements Recipe, Keyed {
|
||||
|
||||
@NotNull
|
||||
public ShapedRecipe setIngredient(char key, @NotNull RecipeChoice ingredient) {
|
||||
Validate.isTrue(ingredients.containsKey(key), "Symbol does not appear in the shape:", key);
|
||||
Preconditions.checkArgument(ingredients.containsKey(key), "Symbol does not appear in the shape:", key);
|
||||
|
||||
ingredients.put(key, ingredient);
|
||||
return this;
|
||||
|
@ -5,7 +5,6 @@ import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import org.apache.commons.lang.Validate;
|
||||
import org.bukkit.Keyed;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.NamespacedKey;
|
||||
@ -121,7 +120,7 @@ public class ShapelessRecipe implements Recipe, Keyed {
|
||||
@Deprecated
|
||||
@NotNull
|
||||
public ShapelessRecipe addIngredient(int count, @NotNull Material ingredient, int rawdata) {
|
||||
Validate.isTrue(ingredients.size() + count <= 9, "Shapeless recipes cannot have more than 9 ingredients");
|
||||
Preconditions.checkArgument(ingredients.size() + count <= 9, "Shapeless recipes cannot have more than 9 ingredients");
|
||||
|
||||
// -1 is the old wildcard, map to Short.MAX_VALUE as the new one
|
||||
if (rawdata == -1) {
|
||||
@ -136,7 +135,7 @@ public class ShapelessRecipe implements Recipe, Keyed {
|
||||
|
||||
@NotNull
|
||||
public ShapelessRecipe addIngredient(@NotNull RecipeChoice ingredient) {
|
||||
Validate.isTrue(ingredients.size() + 1 <= 9, "Shapeless recipes cannot have more than 9 ingredients");
|
||||
Preconditions.checkArgument(ingredients.size() + 1 <= 9, "Shapeless recipes cannot have more than 9 ingredients");
|
||||
|
||||
ingredients.add(ingredient);
|
||||
return this;
|
||||
|
@ -1,6 +1,6 @@
|
||||
package org.bukkit.loot;
|
||||
|
||||
import org.apache.commons.lang.Validate;
|
||||
import com.google.common.base.Preconditions;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.entity.HumanEntity;
|
||||
@ -22,8 +22,8 @@ public final class LootContext {
|
||||
private final HumanEntity killer;
|
||||
|
||||
private LootContext(@NotNull Location location, float luck, int lootingModifier, @Nullable Entity lootedEntity, @Nullable HumanEntity killer) {
|
||||
Validate.notNull(location, "LootContext location cannot be null");
|
||||
Validate.notNull(location.getWorld(), "LootContext World cannot be null");
|
||||
Preconditions.checkArgument(location != null, "LootContext location cannot be null");
|
||||
Preconditions.checkArgument(location.getWorld() != null, "LootContext World cannot be null");
|
||||
this.location = location;
|
||||
this.luck = luck;
|
||||
this.lootingModifier = lootingModifier;
|
||||
|
@ -30,6 +30,8 @@ public enum LootTables implements Keyed {
|
||||
BASTION_OTHER("chests/bastion_other"),
|
||||
BASTION_BRIDGE("chests/bastion_bridge"),
|
||||
BASTION_HOGLIN_STABLE("chests/bastion_hoglin_stable"),
|
||||
ANCIENT_CITY("chests/ancient_city"),
|
||||
ANCIENT_CITY_ICE_BOX("chests/ancient_city_ice_box"),
|
||||
RUINED_PORTAL("chests/ruined_portal"),
|
||||
SHIPWRECK_MAP("chests/shipwreck_map"),
|
||||
SHIPWRECK_SUPPLY("chests/shipwreck_supply"),
|
||||
|
@ -1,8 +1,8 @@
|
||||
package org.bukkit.material;
|
||||
|
||||
import com.google.common.base.Preconditions;
|
||||
import java.util.EnumSet;
|
||||
import java.util.Set;
|
||||
import org.apache.commons.lang.Validate;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.block.BlockFace;
|
||||
import org.bukkit.material.types.MushroomBlockTexture;
|
||||
@ -37,7 +37,7 @@ public class Mushroom extends MaterialData {
|
||||
*/
|
||||
public Mushroom(Material shroom) {
|
||||
super(shroom);
|
||||
Validate.isTrue(shroom == Material.LEGACY_HUGE_MUSHROOM_1 || shroom == Material.LEGACY_HUGE_MUSHROOM_2, "Not a mushroom!");
|
||||
Preconditions.checkArgument(shroom == Material.LEGACY_HUGE_MUSHROOM_1 || shroom == Material.LEGACY_HUGE_MUSHROOM_2, "Not a mushroom!");
|
||||
}
|
||||
|
||||
/**
|
||||
@ -82,7 +82,7 @@ public class Mushroom extends MaterialData {
|
||||
@Deprecated
|
||||
public Mushroom(Material shroom, byte data) {
|
||||
super(shroom, data);
|
||||
Validate.isTrue(shroom == Material.LEGACY_HUGE_MUSHROOM_1 || shroom == Material.LEGACY_HUGE_MUSHROOM_2, "Not a mushroom!");
|
||||
Preconditions.checkArgument(shroom == Material.LEGACY_HUGE_MUSHROOM_1 || shroom == Material.LEGACY_HUGE_MUSHROOM_2, "Not a mushroom!");
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1,8 +1,8 @@
|
||||
package org.bukkit.metadata;
|
||||
|
||||
import com.google.common.base.Preconditions;
|
||||
import java.lang.ref.SoftReference;
|
||||
import java.util.concurrent.Callable;
|
||||
import org.apache.commons.lang.Validate;
|
||||
import org.bukkit.plugin.Plugin;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
@ -47,8 +47,8 @@ public class LazyMetadataValue extends MetadataValueAdapter {
|
||||
*/
|
||||
public LazyMetadataValue(@NotNull Plugin owningPlugin, @NotNull CacheStrategy cacheStrategy, @NotNull Callable<Object> lazyValue) {
|
||||
super(owningPlugin);
|
||||
Validate.notNull(cacheStrategy, "cacheStrategy cannot be null");
|
||||
Validate.notNull(lazyValue, "lazyValue cannot be null");
|
||||
Preconditions.checkArgument(cacheStrategy != null, "cacheStrategy cannot be null");
|
||||
Preconditions.checkArgument(lazyValue != null, "lazyValue cannot be null");
|
||||
this.internalValue = new SoftReference<Object>(null);
|
||||
this.lazyValue = lazyValue;
|
||||
this.cacheStrategy = cacheStrategy;
|
||||
|
@ -1,5 +1,6 @@
|
||||
package org.bukkit.metadata;
|
||||
|
||||
import com.google.common.base.Preconditions;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
@ -7,7 +8,6 @@ import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.WeakHashMap;
|
||||
import org.apache.commons.lang.Validate;
|
||||
import org.bukkit.plugin.Plugin;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
@ -37,9 +37,9 @@ public abstract class MetadataStoreBase<T> {
|
||||
* @see MetadataStore#setMetadata(Object, String, MetadataValue)
|
||||
*/
|
||||
public synchronized void setMetadata(@NotNull T subject, @NotNull String metadataKey, @NotNull MetadataValue newMetadataValue) {
|
||||
Validate.notNull(newMetadataValue, "Value cannot be null");
|
||||
Preconditions.checkArgument(newMetadataValue != null, "Value cannot be null");
|
||||
Plugin owningPlugin = newMetadataValue.getOwningPlugin();
|
||||
Validate.notNull(owningPlugin, "Plugin cannot be null");
|
||||
Preconditions.checkArgument(owningPlugin != null, "Plugin cannot be null");
|
||||
String key = disambiguate(subject, metadataKey);
|
||||
Map<Plugin, MetadataValue> entry = metadataMap.get(key);
|
||||
if (entry == null) {
|
||||
@ -95,7 +95,7 @@ public abstract class MetadataStoreBase<T> {
|
||||
* org.bukkit.plugin.Plugin)
|
||||
*/
|
||||
public synchronized void removeMetadata(@NotNull T subject, @NotNull String metadataKey, @NotNull Plugin owningPlugin) {
|
||||
Validate.notNull(owningPlugin, "Plugin cannot be null");
|
||||
Preconditions.checkArgument(owningPlugin != null, "Plugin cannot be null");
|
||||
String key = disambiguate(subject, metadataKey);
|
||||
Map<Plugin, MetadataValue> entry = metadataMap.get(key);
|
||||
if (entry == null) {
|
||||
@ -118,7 +118,7 @@ public abstract class MetadataStoreBase<T> {
|
||||
* @see MetadataStore#invalidateAll(org.bukkit.plugin.Plugin)
|
||||
*/
|
||||
public synchronized void invalidateAll(@NotNull Plugin owningPlugin) {
|
||||
Validate.notNull(owningPlugin, "Plugin cannot be null");
|
||||
Preconditions.checkArgument(owningPlugin != null, "Plugin cannot be null");
|
||||
for (Map<Plugin, MetadataValue> values : metadataMap.values()) {
|
||||
if (values.containsKey(owningPlugin)) {
|
||||
values.get(owningPlugin).invalidate();
|
||||
|
@ -1,7 +1,7 @@
|
||||
package org.bukkit.metadata;
|
||||
|
||||
import com.google.common.base.Preconditions;
|
||||
import java.lang.ref.WeakReference;
|
||||
import org.apache.commons.lang.Validate;
|
||||
import org.bukkit.plugin.Plugin;
|
||||
import org.bukkit.util.NumberConversions;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
@ -18,7 +18,7 @@ public abstract class MetadataValueAdapter implements MetadataValue {
|
||||
protected final WeakReference<Plugin> owningPlugin;
|
||||
|
||||
protected MetadataValueAdapter(@NotNull Plugin owningPlugin) {
|
||||
Validate.notNull(owningPlugin, "owningPlugin cannot be null");
|
||||
Preconditions.checkArgument(owningPlugin != null, "owningPlugin cannot be null");
|
||||
this.owningPlugin = new WeakReference<Plugin>(owningPlugin);
|
||||
}
|
||||
|
||||
|
@ -1,12 +1,12 @@
|
||||
package org.bukkit.permissions;
|
||||
|
||||
import com.google.common.base.Preconditions;
|
||||
import java.util.ArrayList;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.logging.Level;
|
||||
import org.apache.commons.lang.Validate;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.plugin.PluginManager;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
@ -53,7 +53,7 @@ public class Permission {
|
||||
}
|
||||
|
||||
public Permission(@NotNull String name, @Nullable String description, @Nullable PermissionDefault defaultValue, @Nullable Map<String, Boolean> children) {
|
||||
Validate.notNull(name, "Name cannot be null");
|
||||
Preconditions.checkArgument(name != null, "Name cannot be null");
|
||||
this.name = name;
|
||||
this.description = (description == null) ? "" : description;
|
||||
|
||||
@ -288,8 +288,8 @@ public class Permission {
|
||||
*/
|
||||
@NotNull
|
||||
public static Permission loadPermission(@NotNull String name, @NotNull Map<?, ?> data, @Nullable PermissionDefault def, @Nullable List<Permission> output) {
|
||||
Validate.notNull(name, "Name cannot be null");
|
||||
Validate.notNull(data, "Data cannot be null");
|
||||
Preconditions.checkArgument(name != null, "Name cannot be null");
|
||||
Preconditions.checkArgument(data != null, "Data cannot be null");
|
||||
|
||||
String desc = null;
|
||||
Map<String, Boolean> children = null;
|
||||
|
@ -23,7 +23,6 @@ import java.util.WeakHashMap;
|
||||
import java.util.logging.Level;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
import org.apache.commons.lang.Validate;
|
||||
import org.bukkit.Server;
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.command.Command;
|
||||
@ -111,8 +110,8 @@ public final class SimplePluginManager implements PluginManager {
|
||||
@Override
|
||||
@NotNull
|
||||
public Plugin[] loadPlugins(@NotNull File directory) {
|
||||
Validate.notNull(directory, "Directory cannot be null");
|
||||
Validate.isTrue(directory.isDirectory(), "Directory must be a directory");
|
||||
Preconditions.checkArgument(directory != null, "Directory cannot be null");
|
||||
Preconditions.checkArgument(directory.isDirectory(), "Directory must be a directory");
|
||||
|
||||
List<Plugin> result = new ArrayList<Plugin>();
|
||||
Set<Pattern> filters = fileAssociations.keySet();
|
||||
@ -376,7 +375,7 @@ public final class SimplePluginManager implements PluginManager {
|
||||
@Override
|
||||
@Nullable
|
||||
public synchronized Plugin loadPlugin(@NotNull File file) throws InvalidPluginException, UnknownDependencyException {
|
||||
Validate.notNull(file, "File cannot be null");
|
||||
Preconditions.checkArgument(file != null, "File cannot be null");
|
||||
|
||||
checkUpdate(file);
|
||||
|
||||
@ -636,10 +635,10 @@ public final class SimplePluginManager implements PluginManager {
|
||||
*/
|
||||
@Override
|
||||
public void registerEvent(@NotNull Class<? extends Event> event, @NotNull Listener listener, @NotNull EventPriority priority, @NotNull EventExecutor executor, @NotNull Plugin plugin, boolean ignoreCancelled) {
|
||||
Validate.notNull(listener, "Listener cannot be null");
|
||||
Validate.notNull(priority, "Priority cannot be null");
|
||||
Validate.notNull(executor, "Executor cannot be null");
|
||||
Validate.notNull(plugin, "Plugin cannot be null");
|
||||
Preconditions.checkArgument(listener != null, "Listener cannot be null");
|
||||
Preconditions.checkArgument(priority != null, "Priority cannot be null");
|
||||
Preconditions.checkArgument(executor != null, "Executor cannot be null");
|
||||
Preconditions.checkArgument(plugin != null, "Plugin cannot be null");
|
||||
|
||||
if (!plugin.isEnabled()) {
|
||||
throw new IllegalPluginAccessException("Plugin attempted to register " + event + " while not enabled");
|
||||
|
@ -1,6 +1,7 @@
|
||||
package org.bukkit.plugin.java;
|
||||
|
||||
import com.google.common.base.Charsets;
|
||||
import com.google.common.base.Preconditions;
|
||||
import java.io.File;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.IOException;
|
||||
@ -13,7 +14,6 @@ import java.net.URLConnection;
|
||||
import java.util.List;
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
import org.apache.commons.lang.Validate;
|
||||
import org.bukkit.Server;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandSender;
|
||||
@ -389,7 +389,7 @@ public abstract class JavaPlugin extends PluginBase {
|
||||
*/
|
||||
@NotNull
|
||||
public static <T extends JavaPlugin> T getPlugin(@NotNull Class<T> clazz) {
|
||||
Validate.notNull(clazz, "Null class cannot have a plugin");
|
||||
Preconditions.checkArgument(clazz != null, "Null class cannot have a plugin");
|
||||
if (!JavaPlugin.class.isAssignableFrom(clazz)) {
|
||||
throw new IllegalArgumentException(clazz + " does not extend " + JavaPlugin.class);
|
||||
}
|
||||
@ -418,7 +418,7 @@ public abstract class JavaPlugin extends PluginBase {
|
||||
*/
|
||||
@NotNull
|
||||
public static JavaPlugin getProvidingPlugin(@NotNull Class<?> clazz) {
|
||||
Validate.notNull(clazz, "Null class cannot have a plugin");
|
||||
Preconditions.checkArgument(clazz != null, "Null class cannot have a plugin");
|
||||
final ClassLoader cl = clazz.getClassLoader();
|
||||
if (!(cl instanceof PluginClassLoader)) {
|
||||
throw new IllegalArgumentException(clazz + " is not provided by " + PluginClassLoader.class);
|
||||
|
@ -1,5 +1,6 @@
|
||||
package org.bukkit.plugin.java;
|
||||
|
||||
import com.google.common.base.Preconditions;
|
||||
import java.io.File;
|
||||
import java.io.FileNotFoundException;
|
||||
import java.io.IOException;
|
||||
@ -18,7 +19,6 @@ import java.util.jar.JarEntry;
|
||||
import java.util.jar.JarFile;
|
||||
import java.util.logging.Level;
|
||||
import java.util.regex.Pattern;
|
||||
import org.apache.commons.lang.Validate;
|
||||
import org.bukkit.Server;
|
||||
import org.bukkit.Warning;
|
||||
import org.bukkit.Warning.WarningState;
|
||||
@ -61,7 +61,7 @@ public final class JavaPluginLoader implements PluginLoader {
|
||||
*/
|
||||
@Deprecated
|
||||
public JavaPluginLoader(@NotNull Server instance) {
|
||||
Validate.notNull(instance, "Server cannot be null");
|
||||
Preconditions.checkArgument(instance != null, "Server cannot be null");
|
||||
server = instance;
|
||||
|
||||
LibraryLoader libraryLoader = null;
|
||||
@ -77,7 +77,7 @@ public final class JavaPluginLoader implements PluginLoader {
|
||||
@Override
|
||||
@NotNull
|
||||
public Plugin loadPlugin(@NotNull final File file) throws InvalidPluginException {
|
||||
Validate.notNull(file, "File cannot be null");
|
||||
Preconditions.checkArgument(file != null, "File cannot be null");
|
||||
|
||||
if (!file.exists()) {
|
||||
throw new InvalidPluginException(new FileNotFoundException(file.getPath() + " does not exist"));
|
||||
@ -155,7 +155,7 @@ public final class JavaPluginLoader implements PluginLoader {
|
||||
@Override
|
||||
@NotNull
|
||||
public PluginDescriptionFile getPluginDescription(@NotNull File file) throws InvalidDescriptionException {
|
||||
Validate.notNull(file, "File cannot be null");
|
||||
Preconditions.checkArgument(file != null, "File cannot be null");
|
||||
|
||||
JarFile jar = null;
|
||||
InputStream stream = null;
|
||||
@ -226,8 +226,8 @@ public final class JavaPluginLoader implements PluginLoader {
|
||||
@Override
|
||||
@NotNull
|
||||
public Map<Class<? extends Event>, Set<RegisteredListener>> createRegisteredListeners(@NotNull Listener listener, @NotNull final Plugin plugin) {
|
||||
Validate.notNull(plugin, "Plugin can not be null");
|
||||
Validate.notNull(listener, "Listener can not be null");
|
||||
Preconditions.checkArgument(plugin != null, "Plugin can not be null");
|
||||
Preconditions.checkArgument(listener != null, "Listener can not be null");
|
||||
|
||||
boolean useTimings = server.getPluginManager().useTimings();
|
||||
Map<Class<? extends Event>, Set<RegisteredListener>> ret = new HashMap<Class<? extends Event>, Set<RegisteredListener>>();
|
||||
@ -316,7 +316,7 @@ public final class JavaPluginLoader implements PluginLoader {
|
||||
|
||||
@Override
|
||||
public void enablePlugin(@NotNull final Plugin plugin) {
|
||||
Validate.isTrue(plugin instanceof JavaPlugin, "Plugin is not associated with this PluginLoader");
|
||||
Preconditions.checkArgument(plugin instanceof JavaPlugin, "Plugin is not associated with this PluginLoader");
|
||||
|
||||
if (!plugin.isEnabled()) {
|
||||
plugin.getLogger().info("Enabling " + plugin.getDescription().getFullName());
|
||||
@ -344,7 +344,7 @@ public final class JavaPluginLoader implements PluginLoader {
|
||||
|
||||
@Override
|
||||
public void disablePlugin(@NotNull Plugin plugin) {
|
||||
Validate.isTrue(plugin instanceof JavaPlugin, "Plugin is not associated with this PluginLoader");
|
||||
Preconditions.checkArgument(plugin instanceof JavaPlugin, "Plugin is not associated with this PluginLoader");
|
||||
|
||||
if (plugin.isEnabled()) {
|
||||
String message = String.format("Disabling %s", plugin.getDescription().getFullName());
|
||||
|
@ -1,5 +1,6 @@
|
||||
package org.bukkit.plugin.java;
|
||||
|
||||
import com.google.common.base.Preconditions;
|
||||
import com.google.common.io.ByteStreams;
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
@ -19,7 +20,6 @@ import java.util.jar.JarEntry;
|
||||
import java.util.jar.JarFile;
|
||||
import java.util.jar.Manifest;
|
||||
import java.util.logging.Level;
|
||||
import org.apache.commons.lang.Validate;
|
||||
import org.bukkit.plugin.InvalidPluginException;
|
||||
import org.bukkit.plugin.PluginDescriptionFile;
|
||||
import org.bukkit.plugin.SimplePluginManager;
|
||||
@ -50,7 +50,7 @@ final class PluginClassLoader extends URLClassLoader {
|
||||
|
||||
PluginClassLoader(@NotNull final JavaPluginLoader loader, @Nullable final ClassLoader parent, @NotNull final PluginDescriptionFile description, @NotNull final File dataFolder, @NotNull final File file, @Nullable ClassLoader libraryLoader) throws IOException, InvalidPluginException, MalformedURLException {
|
||||
super(new URL[] {file.toURI().toURL()}, parent);
|
||||
Validate.notNull(loader, "Loader cannot be null");
|
||||
Preconditions.checkArgument(loader != null, "Loader cannot be null");
|
||||
|
||||
this.loader = loader;
|
||||
this.description = description;
|
||||
@ -219,8 +219,8 @@ final class PluginClassLoader extends URLClassLoader {
|
||||
}
|
||||
|
||||
synchronized void initialize(@NotNull JavaPlugin javaPlugin) {
|
||||
Validate.notNull(javaPlugin, "Initializing plugin cannot be null");
|
||||
Validate.isTrue(javaPlugin.getClass().getClassLoader() == this, "Cannot initialize plugin outside of this class loader");
|
||||
Preconditions.checkArgument(javaPlugin != null, "Initializing plugin cannot be null");
|
||||
Preconditions.checkArgument(javaPlugin.getClass().getClassLoader() == this, "Cannot initialize plugin outside of this class loader");
|
||||
if (this.plugin != null || this.pluginInit != null) {
|
||||
throw new IllegalArgumentException("Plugin already initialized!", pluginState);
|
||||
}
|
||||
|
@ -1,7 +1,7 @@
|
||||
package org.bukkit.potion;
|
||||
|
||||
import com.google.common.base.Preconditions;
|
||||
import java.util.Collection;
|
||||
import org.apache.commons.lang.Validate;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
@ -28,7 +28,7 @@ public class Potion {
|
||||
* @param type The potion type
|
||||
*/
|
||||
public Potion(@NotNull PotionType type) {
|
||||
Validate.notNull(type, "Null PotionType");
|
||||
Preconditions.checkArgument(type != null, "Null PotionType");
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
@ -40,8 +40,8 @@ public class Potion {
|
||||
*/
|
||||
public Potion(@NotNull PotionType type, int level) {
|
||||
this(type);
|
||||
Validate.notNull(type, "Type cannot be null");
|
||||
Validate.isTrue(level > 0 && level < 3, "Level must be 1 or 2");
|
||||
Preconditions.checkArgument(type != null, "Type cannot be null");
|
||||
Preconditions.checkArgument(level > 0 && level < 3, "Level must be 1 or 2");
|
||||
this.level = level;
|
||||
}
|
||||
|
||||
@ -105,9 +105,9 @@ public class Potion {
|
||||
* @param to The itemstack to apply to
|
||||
*/
|
||||
public void apply(@NotNull ItemStack to) {
|
||||
Validate.notNull(to, "itemstack cannot be null");
|
||||
Validate.isTrue(to.hasItemMeta(), "given itemstack is not a potion");
|
||||
Validate.isTrue(to.getItemMeta() instanceof PotionMeta, "given itemstack is not a potion");
|
||||
Preconditions.checkArgument(to != null, "itemstack cannot be null");
|
||||
Preconditions.checkArgument(to.hasItemMeta(), "given itemstack is not a potion");
|
||||
Preconditions.checkArgument(to.getItemMeta() instanceof PotionMeta, "given itemstack is not a potion");
|
||||
PotionMeta meta = (PotionMeta) to.getItemMeta();
|
||||
meta.setBasePotionData(new PotionData(type, extended, level == 2));
|
||||
to.setItemMeta(meta);
|
||||
@ -121,7 +121,7 @@ public class Potion {
|
||||
* @see LivingEntity#addPotionEffects(Collection)
|
||||
*/
|
||||
public void apply(@NotNull LivingEntity to) {
|
||||
Validate.notNull(to, "entity cannot be null");
|
||||
Preconditions.checkArgument(to != null, "entity cannot be null");
|
||||
to.addPotionEffects(getEffects());
|
||||
}
|
||||
|
||||
@ -204,7 +204,7 @@ public class Potion {
|
||||
* @param isExtended Whether the potion should have extended duration
|
||||
*/
|
||||
public void setHasExtendedDuration(boolean isExtended) {
|
||||
Validate.isTrue(type == null || !type.isInstant(), "Instant potions cannot be extended");
|
||||
Preconditions.checkArgument(type == null || !type.isInstant(), "Instant potions cannot be extended");
|
||||
extended = isExtended;
|
||||
}
|
||||
|
||||
@ -233,8 +233,8 @@ public class Potion {
|
||||
* @param level The new level of this potion
|
||||
*/
|
||||
public void setLevel(int level) {
|
||||
Validate.notNull(this.type, "No-effect potions don't have a level.");
|
||||
Validate.isTrue(level > 0 && level <= 2, "Level must be between 1 and 2 for this potion");
|
||||
Preconditions.checkArgument(this.type != null, "No-effect potions don't have a level.");
|
||||
Preconditions.checkArgument(level > 0 && level <= 2, "Level must be between 1 and 2 for this potion");
|
||||
this.level = level;
|
||||
}
|
||||
|
||||
@ -354,7 +354,7 @@ public class Potion {
|
||||
|
||||
@NotNull
|
||||
public static Potion fromItemStack(@NotNull ItemStack item) {
|
||||
Validate.notNull(item, "item cannot be null");
|
||||
Preconditions.checkArgument(item != null, "item cannot be null");
|
||||
if (item.getType() != Material.POTION)
|
||||
throw new IllegalArgumentException("item is not a potion");
|
||||
return fromDamage(item.getDurability());
|
||||
|
@ -1,6 +1,6 @@
|
||||
package org.bukkit.potion;
|
||||
|
||||
import org.apache.commons.lang.Validate;
|
||||
import com.google.common.base.Preconditions;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
public final class PotionData {
|
||||
@ -20,10 +20,10 @@ public final class PotionData {
|
||||
* must be true
|
||||
*/
|
||||
public PotionData(@NotNull PotionType type, boolean extended, boolean upgraded) {
|
||||
Validate.notNull(type, "Potion Type must not be null");
|
||||
Validate.isTrue(!upgraded || type.isUpgradeable(), "Potion Type is not upgradable");
|
||||
Validate.isTrue(!extended || type.isExtendable(), "Potion Type is not extendable");
|
||||
Validate.isTrue(!upgraded || !extended, "Potion cannot be both extended and upgraded");
|
||||
Preconditions.checkArgument(type != null, "Potion Type must not be null");
|
||||
Preconditions.checkArgument(!upgraded || type.isUpgradeable(), "Potion Type is not upgradable");
|
||||
Preconditions.checkArgument(!extended || type.isExtendable(), "Potion Type is not extendable");
|
||||
Preconditions.checkArgument(!upgraded || !extended, "Potion cannot be both extended and upgraded");
|
||||
this.type = type;
|
||||
this.extended = extended;
|
||||
this.upgraded = upgraded;
|
||||
|
@ -1,9 +1,9 @@
|
||||
package org.bukkit.potion;
|
||||
|
||||
import com.google.common.base.Preconditions;
|
||||
import com.google.common.collect.ImmutableMap;
|
||||
import java.util.Map;
|
||||
import java.util.NoSuchElementException;
|
||||
import org.apache.commons.lang.Validate;
|
||||
import org.bukkit.Color;
|
||||
import org.bukkit.configuration.serialization.ConfigurationSerializable;
|
||||
import org.bukkit.configuration.serialization.SerializableAs;
|
||||
@ -44,7 +44,7 @@ public class PotionEffect implements ConfigurationSerializable {
|
||||
* @param icon the icon status, see {@link PotionEffect#hasIcon()}
|
||||
*/
|
||||
public PotionEffect(@NotNull PotionEffectType type, int duration, int amplifier, boolean ambient, boolean particles, boolean icon) {
|
||||
Validate.notNull(type, "effect type cannot be null");
|
||||
Preconditions.checkArgument(type != null, "effect type cannot be null");
|
||||
this.type = type;
|
||||
this.duration = duration;
|
||||
this.amplifier = amplifier;
|
||||
|
@ -1,9 +1,9 @@
|
||||
package org.bukkit.potion;
|
||||
|
||||
import com.google.common.base.Preconditions;
|
||||
import java.util.Arrays;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import org.apache.commons.lang.Validate;
|
||||
import org.bukkit.Color;
|
||||
import org.bukkit.Keyed;
|
||||
import org.bukkit.NamespacedKey;
|
||||
@ -180,6 +180,11 @@ public abstract class PotionEffectType implements Keyed {
|
||||
*/
|
||||
public static final PotionEffectType HERO_OF_THE_VILLAGE = new PotionEffectTypeWrapper(32, "hero_of_the_village");
|
||||
|
||||
/**
|
||||
* Causes the player's vision to dim occasionally.
|
||||
*/
|
||||
public static final PotionEffectType DARKNESS = new PotionEffectTypeWrapper(33, "darkness");
|
||||
|
||||
private final int id;
|
||||
private final NamespacedKey key;
|
||||
|
||||
@ -276,7 +281,7 @@ public abstract class PotionEffectType implements Keyed {
|
||||
return "PotionEffectType[" + id + ", " + getName() + "]";
|
||||
}
|
||||
|
||||
private static final PotionEffectType[] byId = new PotionEffectType[33];
|
||||
private static final PotionEffectType[] byId = new PotionEffectType[34];
|
||||
private static final Map<String, PotionEffectType> byName = new HashMap<String, PotionEffectType>();
|
||||
private static final Map<NamespacedKey, PotionEffectType> byKey = new HashMap<NamespacedKey, PotionEffectType>();
|
||||
// will break on updates.
|
||||
@ -317,7 +322,7 @@ public abstract class PotionEffectType implements Keyed {
|
||||
*/
|
||||
@Nullable
|
||||
public static PotionEffectType getByName(@NotNull String name) {
|
||||
Validate.notNull(name, "name cannot be null");
|
||||
Preconditions.checkArgument(name != null, "name cannot be null");
|
||||
return byName.get(name.toLowerCase(java.util.Locale.ENGLISH));
|
||||
}
|
||||
|
||||
|
@ -1,9 +1,9 @@
|
||||
package org.bukkit.util;
|
||||
|
||||
import com.google.common.base.Preconditions;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
import org.apache.commons.lang.Validate;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.block.BlockFace;
|
||||
@ -39,8 +39,8 @@ public class BoundingBox implements Cloneable, ConfigurationSerializable {
|
||||
*/
|
||||
@NotNull
|
||||
public static BoundingBox of(@NotNull Vector corner1, @NotNull Vector corner2) {
|
||||
Validate.notNull(corner1, "Corner1 is null!");
|
||||
Validate.notNull(corner2, "Corner2 is null!");
|
||||
Preconditions.checkArgument(corner1 != null, "Corner1 is null!");
|
||||
Preconditions.checkArgument(corner2 != null, "Corner2 is null!");
|
||||
return new BoundingBox(corner1.getX(), corner1.getY(), corner1.getZ(), corner2.getX(), corner2.getY(), corner2.getZ());
|
||||
}
|
||||
|
||||
@ -54,9 +54,9 @@ public class BoundingBox implements Cloneable, ConfigurationSerializable {
|
||||
*/
|
||||
@NotNull
|
||||
public static BoundingBox of(@NotNull Location corner1, @NotNull Location corner2) {
|
||||
Validate.notNull(corner1, "Corner1 is null!");
|
||||
Validate.notNull(corner2, "Corner2 is null!");
|
||||
Validate.isTrue(Objects.equals(corner1.getWorld(), corner2.getWorld()), "Locations from different worlds!");
|
||||
Preconditions.checkArgument(corner1 != null, "Corner1 is null!");
|
||||
Preconditions.checkArgument(corner2 != null, "Corner2 is null!");
|
||||
Preconditions.checkArgument(Objects.equals(corner1.getWorld(), corner2.getWorld()), "Locations from different worlds!");
|
||||
return new BoundingBox(corner1.getX(), corner1.getY(), corner1.getZ(), corner2.getX(), corner2.getY(), corner2.getZ());
|
||||
}
|
||||
|
||||
@ -72,9 +72,9 @@ public class BoundingBox implements Cloneable, ConfigurationSerializable {
|
||||
*/
|
||||
@NotNull
|
||||
public static BoundingBox of(@NotNull Block corner1, @NotNull Block corner2) {
|
||||
Validate.notNull(corner1, "Corner1 is null!");
|
||||
Validate.notNull(corner2, "Corner2 is null!");
|
||||
Validate.isTrue(Objects.equals(corner1.getWorld(), corner2.getWorld()), "Blocks from different worlds!");
|
||||
Preconditions.checkArgument(corner1 != null, "Corner1 is null!");
|
||||
Preconditions.checkArgument(corner2 != null, "Corner2 is null!");
|
||||
Preconditions.checkArgument(Objects.equals(corner1.getWorld(), corner2.getWorld()), "Blocks from different worlds!");
|
||||
|
||||
int x1 = corner1.getX();
|
||||
int y1 = corner1.getY();
|
||||
@ -101,7 +101,7 @@ public class BoundingBox implements Cloneable, ConfigurationSerializable {
|
||||
*/
|
||||
@NotNull
|
||||
public static BoundingBox of(@NotNull Block block) {
|
||||
Validate.notNull(block, "Block is null!");
|
||||
Preconditions.checkArgument(block != null, "Block is null!");
|
||||
return new BoundingBox(block.getX(), block.getY(), block.getZ(), block.getX() + 1, block.getY() + 1, block.getZ() + 1);
|
||||
}
|
||||
|
||||
@ -116,7 +116,7 @@ public class BoundingBox implements Cloneable, ConfigurationSerializable {
|
||||
*/
|
||||
@NotNull
|
||||
public static BoundingBox of(@NotNull Vector center, double x, double y, double z) {
|
||||
Validate.notNull(center, "Center is null!");
|
||||
Preconditions.checkArgument(center != null, "Center is null!");
|
||||
return new BoundingBox(center.getX() - x, center.getY() - y, center.getZ() - z, center.getX() + x, center.getY() + y, center.getZ() + z);
|
||||
}
|
||||
|
||||
@ -131,7 +131,7 @@ public class BoundingBox implements Cloneable, ConfigurationSerializable {
|
||||
*/
|
||||
@NotNull
|
||||
public static BoundingBox of(@NotNull Location center, double x, double y, double z) {
|
||||
Validate.notNull(center, "Center is null!");
|
||||
Preconditions.checkArgument(center != null, "Center is null!");
|
||||
return new BoundingBox(center.getX() - x, center.getY() - y, center.getZ() - z, center.getX() + x, center.getY() + y, center.getZ() + z);
|
||||
}
|
||||
|
||||
@ -348,7 +348,7 @@ public class BoundingBox implements Cloneable, ConfigurationSerializable {
|
||||
*/
|
||||
@NotNull
|
||||
public BoundingBox copy(@NotNull BoundingBox other) {
|
||||
Validate.notNull(other, "Other bounding box is null!");
|
||||
Preconditions.checkArgument(other != null, "Other bounding box is null!");
|
||||
return this.resize(other.getMinX(), other.getMinY(), other.getMinZ(), other.getMaxX(), other.getMaxY(), other.getMaxZ());
|
||||
}
|
||||
|
||||
@ -449,7 +449,7 @@ public class BoundingBox implements Cloneable, ConfigurationSerializable {
|
||||
*/
|
||||
@NotNull
|
||||
public BoundingBox expand(@NotNull Vector expansion) {
|
||||
Validate.notNull(expansion, "Expansion is null!");
|
||||
Preconditions.checkArgument(expansion != null, "Expansion is null!");
|
||||
double x = expansion.getX();
|
||||
double y = expansion.getY();
|
||||
double z = expansion.getZ();
|
||||
@ -510,7 +510,7 @@ public class BoundingBox implements Cloneable, ConfigurationSerializable {
|
||||
*/
|
||||
@NotNull
|
||||
public BoundingBox expand(@NotNull Vector direction, double expansion) {
|
||||
Validate.notNull(direction, "Direction is null!");
|
||||
Preconditions.checkArgument(direction != null, "Direction is null!");
|
||||
return this.expand(direction.getX(), direction.getY(), direction.getZ(), expansion);
|
||||
}
|
||||
|
||||
@ -527,7 +527,7 @@ public class BoundingBox implements Cloneable, ConfigurationSerializable {
|
||||
*/
|
||||
@NotNull
|
||||
public BoundingBox expand(@NotNull BlockFace blockFace, double expansion) {
|
||||
Validate.notNull(blockFace, "Block face is null!");
|
||||
Preconditions.checkArgument(blockFace != null, "Block face is null!");
|
||||
if (blockFace == BlockFace.SELF) return this;
|
||||
|
||||
return this.expand(blockFace.getDirection(), expansion);
|
||||
@ -563,7 +563,7 @@ public class BoundingBox implements Cloneable, ConfigurationSerializable {
|
||||
*/
|
||||
@NotNull
|
||||
public BoundingBox expandDirectional(@NotNull Vector direction) {
|
||||
Validate.notNull(direction, "Expansion is null!");
|
||||
Preconditions.checkArgument(direction != null, "Expansion is null!");
|
||||
return this.expand(direction.getX(), direction.getY(), direction.getZ(), 1.0D);
|
||||
}
|
||||
|
||||
@ -599,7 +599,7 @@ public class BoundingBox implements Cloneable, ConfigurationSerializable {
|
||||
*/
|
||||
@NotNull
|
||||
public BoundingBox union(@NotNull Vector position) {
|
||||
Validate.notNull(position, "Position is null!");
|
||||
Preconditions.checkArgument(position != null, "Position is null!");
|
||||
return this.union(position.getX(), position.getY(), position.getZ());
|
||||
}
|
||||
|
||||
@ -612,7 +612,7 @@ public class BoundingBox implements Cloneable, ConfigurationSerializable {
|
||||
*/
|
||||
@NotNull
|
||||
public BoundingBox union(@NotNull Location position) {
|
||||
Validate.notNull(position, "Position is null!");
|
||||
Preconditions.checkArgument(position != null, "Position is null!");
|
||||
return this.union(position.getX(), position.getY(), position.getZ());
|
||||
}
|
||||
|
||||
@ -625,7 +625,7 @@ public class BoundingBox implements Cloneable, ConfigurationSerializable {
|
||||
*/
|
||||
@NotNull
|
||||
public BoundingBox union(@NotNull BoundingBox other) {
|
||||
Validate.notNull(other, "Other bounding box is null!");
|
||||
Preconditions.checkArgument(other != null, "Other bounding box is null!");
|
||||
if (this.contains(other)) return this;
|
||||
double newMinX = Math.min(this.minX, other.minX);
|
||||
double newMinY = Math.min(this.minY, other.minY);
|
||||
@ -646,8 +646,8 @@ public class BoundingBox implements Cloneable, ConfigurationSerializable {
|
||||
*/
|
||||
@NotNull
|
||||
public BoundingBox intersection(@NotNull BoundingBox other) {
|
||||
Validate.notNull(other, "Other bounding box is null!");
|
||||
Validate.isTrue(this.overlaps(other), "The bounding boxes do not overlap!");
|
||||
Preconditions.checkArgument(other != null, "Other bounding box is null!");
|
||||
Preconditions.checkArgument(this.overlaps(other), "The bounding boxes do not overlap!");
|
||||
double newMinX = Math.max(this.minX, other.minX);
|
||||
double newMinY = Math.max(this.minY, other.minY);
|
||||
double newMinZ = Math.max(this.minZ, other.minZ);
|
||||
@ -680,7 +680,7 @@ public class BoundingBox implements Cloneable, ConfigurationSerializable {
|
||||
*/
|
||||
@NotNull
|
||||
public BoundingBox shift(@NotNull Vector shift) {
|
||||
Validate.notNull(shift, "Shift is null!");
|
||||
Preconditions.checkArgument(shift != null, "Shift is null!");
|
||||
return this.shift(shift.getX(), shift.getY(), shift.getZ());
|
||||
}
|
||||
|
||||
@ -692,7 +692,7 @@ public class BoundingBox implements Cloneable, ConfigurationSerializable {
|
||||
*/
|
||||
@NotNull
|
||||
public BoundingBox shift(@NotNull Location shift) {
|
||||
Validate.notNull(shift, "Shift is null!");
|
||||
Preconditions.checkArgument(shift != null, "Shift is null!");
|
||||
return this.shift(shift.getX(), shift.getY(), shift.getZ());
|
||||
}
|
||||
|
||||
@ -712,7 +712,7 @@ public class BoundingBox implements Cloneable, ConfigurationSerializable {
|
||||
* @return <code>true</code> if overlapping
|
||||
*/
|
||||
public boolean overlaps(@NotNull BoundingBox other) {
|
||||
Validate.notNull(other, "Other bounding box is null!");
|
||||
Preconditions.checkArgument(other != null, "Other bounding box is null!");
|
||||
return this.overlaps(other.minX, other.minY, other.minZ, other.maxX, other.maxY, other.maxZ);
|
||||
}
|
||||
|
||||
@ -728,8 +728,8 @@ public class BoundingBox implements Cloneable, ConfigurationSerializable {
|
||||
* @return <code>true</code> if overlapping
|
||||
*/
|
||||
public boolean overlaps(@NotNull Vector min, @NotNull Vector max) {
|
||||
Validate.notNull(min, "Min is null!");
|
||||
Validate.notNull(max, "Max is null!");
|
||||
Preconditions.checkArgument(min != null, "Min is null!");
|
||||
Preconditions.checkArgument(max != null, "Max is null!");
|
||||
double x1 = min.getX();
|
||||
double y1 = min.getY();
|
||||
double z1 = min.getZ();
|
||||
@ -773,7 +773,7 @@ public class BoundingBox implements Cloneable, ConfigurationSerializable {
|
||||
* @return <code>true</code> if the bounding box contains the position
|
||||
*/
|
||||
public boolean contains(@NotNull Vector position) {
|
||||
Validate.notNull(position, "Position is null!");
|
||||
Preconditions.checkArgument(position != null, "Position is null!");
|
||||
return this.contains(position.getX(), position.getY(), position.getZ());
|
||||
}
|
||||
|
||||
@ -791,7 +791,7 @@ public class BoundingBox implements Cloneable, ConfigurationSerializable {
|
||||
* box
|
||||
*/
|
||||
public boolean contains(@NotNull BoundingBox other) {
|
||||
Validate.notNull(other, "Other bounding box is null!");
|
||||
Preconditions.checkArgument(other != null, "Other bounding box is null!");
|
||||
return this.contains(other.minX, other.minY, other.minZ, other.maxX, other.maxY, other.maxZ);
|
||||
}
|
||||
|
||||
@ -805,8 +805,8 @@ public class BoundingBox implements Cloneable, ConfigurationSerializable {
|
||||
* bounding box
|
||||
*/
|
||||
public boolean contains(@NotNull Vector min, @NotNull Vector max) {
|
||||
Validate.notNull(min, "Min is null!");
|
||||
Validate.notNull(max, "Max is null!");
|
||||
Preconditions.checkArgument(min != null, "Min is null!");
|
||||
Preconditions.checkArgument(max != null, "Max is null!");
|
||||
double x1 = min.getX();
|
||||
double y1 = min.getY();
|
||||
double z1 = min.getZ();
|
||||
@ -831,11 +831,11 @@ public class BoundingBox implements Cloneable, ConfigurationSerializable {
|
||||
*/
|
||||
@Nullable
|
||||
public RayTraceResult rayTrace(@NotNull Vector start, @NotNull Vector direction, double maxDistance) {
|
||||
Validate.notNull(start, "Start is null!");
|
||||
Preconditions.checkArgument(start != null, "Start is null!");
|
||||
start.checkFinite();
|
||||
Validate.notNull(direction, "Direction is null!");
|
||||
Preconditions.checkArgument(direction != null, "Direction is null!");
|
||||
direction.checkFinite();
|
||||
Validate.isTrue(direction.lengthSquared() > 0, "Direction's magnitude is 0!");
|
||||
Preconditions.checkArgument(direction.lengthSquared() > 0, "Direction's magnitude is 0!");
|
||||
if (maxDistance < 0.0D) return null;
|
||||
|
||||
// ray start:
|
||||
|
@ -1,7 +1,7 @@
|
||||
package org.bukkit.util;
|
||||
|
||||
import com.google.common.base.Preconditions;
|
||||
import java.util.Objects;
|
||||
import org.apache.commons.lang.Validate;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.block.BlockFace;
|
||||
import org.bukkit.entity.Entity;
|
||||
@ -24,7 +24,7 @@ public class RayTraceResult {
|
||||
private final Entity hitEntity;
|
||||
|
||||
private RayTraceResult(@NotNull Vector hitPosition, @Nullable Block hitBlock, @Nullable BlockFace hitBlockFace, @Nullable Entity hitEntity) {
|
||||
Validate.notNull(hitPosition, "Hit position is null!");
|
||||
Preconditions.checkArgument(hitPosition != null, "Hit position is null!");
|
||||
this.hitPosition = hitPosition.clone();
|
||||
this.hitBlock = hitBlock;
|
||||
this.hitBlockFace = hitBlockFace;
|
||||
|
@ -1,7 +1,7 @@
|
||||
package org.bukkit.util;
|
||||
|
||||
import com.google.common.base.Preconditions;
|
||||
import java.util.Collection;
|
||||
import org.apache.commons.lang.Validate;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
public class StringUtil {
|
||||
@ -25,9 +25,9 @@ public class StringUtil {
|
||||
*/
|
||||
@NotNull
|
||||
public static <T extends Collection<? super String>> T copyPartialMatches(@NotNull final String token, @NotNull final Iterable<String> originals, @NotNull final T collection) throws UnsupportedOperationException, IllegalArgumentException {
|
||||
Validate.notNull(token, "Search token cannot be null");
|
||||
Validate.notNull(collection, "Collection cannot be null");
|
||||
Validate.notNull(originals, "Originals cannot be null");
|
||||
Preconditions.checkArgument(token != null, "Search token cannot be null");
|
||||
Preconditions.checkArgument(collection != null, "Collection cannot be null");
|
||||
Preconditions.checkArgument(originals != null, "Originals cannot be null");
|
||||
|
||||
for (String string : originals) {
|
||||
if (startsWithIgnoreCase(string, token)) {
|
||||
@ -51,7 +51,7 @@ public class StringUtil {
|
||||
* @throws IllegalArgumentException if string is null
|
||||
*/
|
||||
public static boolean startsWithIgnoreCase(@NotNull final String string, @NotNull final String prefix) throws IllegalArgumentException, NullPointerException {
|
||||
Validate.notNull(string, "Cannot check a null string for a match");
|
||||
Preconditions.checkArgument(string != null, "Cannot check a null string for a match");
|
||||
if (string.length() < prefix.length()) {
|
||||
return false;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user