mirror of
https://github.com/xoo0524tw/OpenArcadeGames.git
synced 2026-12-06 02:46:01 +02:00
Initial ArcadeGames source and build setup
This commit is contained in:
commit
76ac0e3acd
1069 files changed
+97958
No files matched your search
+73
@@ -0,0 +1,73 @@
|
||||
package ro.fr33styler.arcade.internal.runtime;
|
||||
|
||||
import com.google.gson.Gson;
|
||||
import java.io.Closeable;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.net.MalformedURLException;
|
||||
import java.net.URI;
|
||||
import java.net.URISyntaxException;
|
||||
import java.net.URLConnection;
|
||||
import java.util.UUID;
|
||||
import org.bukkit.event.block.Action;
|
||||
|
||||
public final class SharedEngineOperations {
|
||||
|
||||
private SharedEngineOperations() {
|
||||
}
|
||||
|
||||
public static void sleepQuietly(long var0) {
|
||||
try {
|
||||
Thread.sleep(var0);
|
||||
} catch (InterruptedException var3) {
|
||||
}
|
||||
}
|
||||
|
||||
public static void closeQuietly(Closeable var0) {
|
||||
try {
|
||||
var0.close();
|
||||
} catch (IOException var2) {
|
||||
}
|
||||
}
|
||||
|
||||
public static <T> T orElse(T var0, T var1) {
|
||||
return (T) (var0 == null ? var1 : var0);
|
||||
}
|
||||
|
||||
public static void swap(Object[] var0, int var1, int var2) {
|
||||
Object var3 = var0[var1];
|
||||
var0[var1] = var0[var2];
|
||||
var0[var2] = var3;
|
||||
}
|
||||
|
||||
public static float snapYaw(float var0) {
|
||||
if ((!(var0 > 135.0F) || !(var0 <= 180.0F)) && !(var0 < -135.0F)) {
|
||||
if (var0 >= -135.0F && var0 <= -45.0F) {
|
||||
return -90.0F;
|
||||
} else {
|
||||
return var0 < 135.0F && var0 >= 45.0F ? 90.0F : 0.0F;
|
||||
}
|
||||
} else {
|
||||
return 180.0F;
|
||||
}
|
||||
}
|
||||
|
||||
public static boolean isLeftClick(Action var0) {
|
||||
return var0 == Action.LEFT_CLICK_AIR || var0 == Action.LEFT_CLICK_BLOCK;
|
||||
}
|
||||
|
||||
public static boolean isRightClick(Action var0) {
|
||||
return var0 == Action.RIGHT_CLICK_AIR || var0 == Action.RIGHT_CLICK_BLOCK;
|
||||
}
|
||||
|
||||
public static InputStream openStream(String var0, String var1, String var2, int var3) {
|
||||
try {
|
||||
URLConnection var4 = new URI(var0, var1, var2, null).toURL().openConnection();
|
||||
var4.setConnectTimeout(1000);
|
||||
var4.setReadTimeout(var3);
|
||||
return var4.getInputStream();
|
||||
} catch (URISyntaxException | IOException var5) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user