mirror of
https://github.com/PaperMC/Paper.git
synced 2025-08-17 13:24:17 -07:00
@@ -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);
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user