Skip to content

Commit

Permalink
requested changes!
Browse files Browse the repository at this point in the history
  • Loading branch information
sovdeeth committed Oct 2, 2024
1 parent 76cca4e commit 17664a9
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 13 deletions.
6 changes: 3 additions & 3 deletions src/main/java/ch/njol/skript/aliases/ItemType.java
Original file line number Diff line number Diff line change
Expand Up @@ -1415,8 +1415,8 @@ public Material getMaterial() {
}

/**
* @return A random block material this ItemType represents. {@link Material#AIR} will be returned if no block
* material exists.
* @return A random block material this ItemType represents.
* @throws IllegalStateException If {@link #hasBlock()} is false.
*/
public Material getBlockMaterial() {
List<ItemData> blockItemDatas = new ArrayList<>();
Expand All @@ -1426,7 +1426,7 @@ public Material getBlockMaterial() {
}
if (blockItemDatas.isEmpty())
throw new IllegalStateException("This ItemType does not represent a material. " +
"ItemData#hasBlock() should return true before invoking this method.");
"ItemType#hasBlock() should return true before invoking this method.");
return blockItemDatas.get(random.nextInt(blockItemDatas.size())).getType();
}

Expand Down
18 changes: 8 additions & 10 deletions src/main/java/ch/njol/skript/util/ColorRGB.java
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import org.bukkit.DyeColor;
import org.jetbrains.annotations.ApiStatus;
import org.jetbrains.annotations.Contract;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;

import java.io.NotSerializableException;
Expand All @@ -17,12 +18,12 @@

public class ColorRGB implements Color {

private static final boolean HAS_ARGB = Skript.methodExists(org.bukkit.Color.class, "getAlpha");
private static final Pattern RGB_PATTERN = Pattern.compile("(?>rgb|RGB) (\\d+), (\\d+), (\\d+)");

private org.bukkit.Color bukkit;

@Nullable
private DyeColor dye;
private @Nullable DyeColor dye;

/**
* Subject to being private in the future. Use {@link #fromRGB(int, int, int)}
Expand All @@ -48,7 +49,6 @@ public ColorRGB(org.bukkit.Color bukkit) {
this.bukkit = bukkit;
}

private static final boolean HAS_ARGB = Skript.methodExists(org.bukkit.Color.class, "getAlpha");
/**
* Returns a ColorRGB object from the provided arguments. Versions lower than 1.19 will not support alpha values.
*
Expand All @@ -59,7 +59,7 @@ public ColorRGB(org.bukkit.Color bukkit) {
* @return ColorRGB
*/
@Contract("_,_,_,_ -> new")
public static ColorRGB fromRGBA(int red, int green, int blue, int alpha) {
public static @NotNull ColorRGB fromRGBA(int red, int green, int blue, int alpha) {
org.bukkit.Color bukkit;
if (HAS_ARGB) {
bukkit = org.bukkit.Color.fromARGB(alpha, red, green, blue);
Expand All @@ -78,7 +78,7 @@ public static ColorRGB fromRGBA(int red, int green, int blue, int alpha) {
* @return ColorRGB
*/
@Contract("_,_,_ -> new")
public static ColorRGB fromRGB(int red, int green, int blue) {
public static @NotNull ColorRGB fromRGB(int red, int green, int blue) {
return new ColorRGB(red, green, blue);
}

Expand All @@ -89,7 +89,7 @@ public static ColorRGB fromRGB(int red, int green, int blue) {
* @return ColorRGB
*/
@Contract("_ -> new")
public static ColorRGB fromBukkitColor(org.bukkit.Color bukkit) {
public static @NotNull ColorRGB fromBukkitColor(org.bukkit.Color bukkit) {
return new ColorRGB(bukkit);
}

Expand All @@ -99,8 +99,7 @@ public org.bukkit.Color asBukkitColor() {
}

@Override
@Nullable
public DyeColor asDyeColor() {
public @Nullable DyeColor asDyeColor() {
return dye;
}

Expand All @@ -112,8 +111,7 @@ public String getName() {
return "rgb " + rgb;
}

@Nullable
public static ColorRGB fromString(String string) {
public static @Nullable ColorRGB fromString(String string) {
Matcher matcher = RGB_PATTERN.matcher(string);
if (!matcher.matches())
return null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,8 @@ public void change(Event event, Object @Nullable [] delta, ChangeMode mode) {
case ADD:
for (Display display : displays) {
float value = Math.max(0F, display.getViewRange() + change);
if (Float.isInfinite(value))
continue;
display.setViewRange(value);
}
break;
Expand Down

0 comments on commit 17664a9

Please sign in to comment.