mirror of
https://github.com/VolmitSoftware/Iris.git
synced 2025-07-18 18:23:06 +00:00
Nasty suppliers
This commit is contained in:
parent
2929800a9f
commit
2683c2433b
@ -23,6 +23,7 @@ import com.volmit.iris.util.collection.KList;
|
||||
import com.volmit.iris.util.function.NastyFunction;
|
||||
import com.volmit.iris.util.function.NastyFuture;
|
||||
import com.volmit.iris.util.function.NastyRunnable;
|
||||
import com.volmit.iris.util.function.NastySupplier;
|
||||
import com.volmit.iris.util.math.FinalInteger;
|
||||
import com.volmit.iris.util.parallel.MultiBurst;
|
||||
import org.bukkit.Bukkit;
|
||||
@ -125,6 +126,18 @@ public class J {
|
||||
return attemptCatch(r) == null;
|
||||
}
|
||||
|
||||
public static <T> T attemptResult(NastySupplier<T> r) {
|
||||
try
|
||||
{
|
||||
return r.get();
|
||||
}
|
||||
|
||||
catch(Throwable e)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public static Throwable attemptCatch(NastyRunnable r) {
|
||||
try {
|
||||
r.run();
|
||||
|
Loading…
x
Reference in New Issue
Block a user