Files
CustomNPC-Plus/src/main/java/noppes/npcs/util/ValueUtil.java
T
Kam 39d2b9227d Quest Manual + Quest Objective Command
Quest Manual allows you to add manual quests that can only be completed via script or command. The command will essentially call the .setProgress or .setPlayerProgress (if the player is within a party) to set the progress for the objectives.
2024-03-19 05:09:11 -04:00

52 lines
1.1 KiB
Java

package noppes.npcs.util;
public class ValueUtil {
public static float clamp(float given, float min, float max){
if(given < min)
return min;
return Math.min(given, max);
}
public static int clamp(int given, int min, int max) {
if(given < min)
return min;
return Math.min(given, max);
}
public static byte clamp(byte given, byte min, byte max) {
if(given < min)
return min;
if(given > max)
return max;
return given;
}
public static double clamp(double given, double min, double max) {
if(given < min)
return min;
return Math.min(given, max);
}
public static long clamp(long given, long min, long max) {
if(given < min)
return min;
return Math.min(given, max);
}
public static float correctFloat(float given, float min, float max){
if(given < min)
return min;
if(given > max)
return max;
return given;
}
public static int CorrectInt(int given, int min, int max) {
if(given < min)
return min;
if(given > max)
return max;
return given;
}
}