Package org.cyclops.cyclopscore.helper
Class Helpers
java.lang.Object
org.cyclops.cyclopscore.helper.Helpers
Deprecated.
A collection of helper methods and fields.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic intaddAlphaToColor(int color, float alpha) Deprecated.Add the given alpha value to the given RGB color.static intaddAlphaToColor(int color, int alpha) Deprecated.Add the given alpha value to the given RGB color.static intaddSafe(int a, int b) Deprecated.Take the sum of these two values capped atInteger.MAX_VALUE.static intcastSafe(long value) Deprecated.Cast a long value safely to an int.intToRGB(int color) Deprecated.Convert a color in integer representation to seperated r, g and b colors.static intmultiplySafe(int a, int b) Deprecated.Take the multiplication of these two values capped atInteger.MAX_VALUE.static voidDeprecated.Open the given URL in the player's browser.static intRGBAToInt(int r, int g, int b, int a) Deprecated.Convert r, g, b and a colors to an integer representation.static intrgbToBgr(int color) Deprecated.Convert the given color from RGB encoding to BGR encoding.static intrgbToBgra(int color, int alpha) Deprecated.Convert the given color from RGB encoding to BGR encoding.static intRGBToInt(int r, int g, int b) Deprecated.Convert r, g and b colors to an integer representation.static ObjectDeprecated.Safe parsing of a string to it's real object type.
-
Constructor Details
-
Helpers
public Helpers()Deprecated.
-
-
Method Details
-
tryParse
Deprecated.Safe parsing of a string to it's real object type. The real object type is determined by checking the class of the oldValue.- Parameters:
newValue- The value to parseoldValue- The old value that has a certain type.- Returns:
- The parsed newValue.
-
RGBToInt
public static int RGBToInt(int r, int g, int b) Deprecated.Convert r, g and b colors to an integer representation.- Parameters:
r- redg- greenb- blue- Returns:
- integer representation of the color.
-
RGBAToInt
public static int RGBAToInt(int r, int g, int b, int a) Deprecated.Convert r, g, b and a colors to an integer representation.- Parameters:
r- redg- greenb- bluea- alpha- Returns:
- integer representation of the color.
-
addAlphaToColor
public static int addAlphaToColor(int color, int alpha) Deprecated.Add the given alpha value to the given RGB color.- Parameters:
color- The color.alpha- The alpha from 0-255- Returns:
- The color with alpha.
-
addAlphaToColor
public static int addAlphaToColor(int color, float alpha) Deprecated.Add the given alpha value to the given RGB color.- Parameters:
color- The color.alpha- The alpha from 0-1- Returns:
- The color with alpha.
-
intToRGB
Deprecated.Convert a color in integer representation to seperated r, g and b colors.- Parameters:
color- The color in integer representation.- Returns:
- The separated r, g and b colors.
-
rgbToBgra
public static int rgbToBgra(int color, int alpha) Deprecated.Convert the given color from RGB encoding to BGR encoding.- Parameters:
color- The color in RGBalpha- The alpha to apply- Returns:
- The color in BGR
-
rgbToBgr
public static int rgbToBgr(int color) Deprecated.Convert the given color from RGB encoding to BGR encoding.- Parameters:
color- The color in RGB- Returns:
- The color in BGR
-
addSafe
public static int addSafe(int a, int b) Deprecated.Take the sum of these two values capped atInteger.MAX_VALUE.- Parameters:
a- Integerb- Integer- Returns:
- The safe sum.
-
multiplySafe
public static int multiplySafe(int a, int b) Deprecated.Take the multiplication of these two values capped atInteger.MAX_VALUE.- Parameters:
a- Positive Integerb- Positive Integer- Returns:
- The safe multiplication.
-
castSafe
public static int castSafe(long value) Deprecated.Cast a long value safely to an int. If the casting would result in an overflow, return theInteger.MAX_VALUE.- Parameters:
value- A value to cast.- Returns:
- The casted value.
-
openUrl
Deprecated.Open the given URL in the player's browser.- Parameters:
url- An URL.
-