mirror of
https://github.com/VolmitSoftware/Iris.git
synced 2026-10-20 23:36:52 +00:00
Nasty suppliers
This commit is contained in:
1 parent
2929800a9f
commit
2683c2433b
1 file changed
+13
@@ -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();
|
||||
|
||||
Reference in new issue
Block a user