9
0
mirror of https://github.com/VolmitSoftware/Iris.git synced 2025-12-23 17:19:16 +00:00

Nasty suppliers

This commit is contained in:
cyberpwn
2021-08-25 03:55:25 -04:00
parent 2929800a9f
commit 2683c2433b

View File

@@ -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();