mirror of
https://github.com/SquidDev-CC/CC-Tweaked
synced 2025-02-03 04:39:12 +00:00
Bump checkstyle, fix warnings from TeaVM upgrade
This commit is contained in:
parent
6fb291112d
commit
ffb62dfa02
@ -13,6 +13,10 @@ SPDX-License-Identifier: MPL-2.0
|
|||||||
<property name="tabWidth" value="4"/>
|
<property name="tabWidth" value="4"/>
|
||||||
<property name="charset" value="UTF-8" />
|
<property name="charset" value="UTF-8" />
|
||||||
|
|
||||||
|
<module name="BeforeExecutionExclusionFileFilter">
|
||||||
|
<property name="fileNamePattern" value="module\-info\.java$"/>
|
||||||
|
</module>
|
||||||
|
|
||||||
<module name="SuppressionFilter">
|
<module name="SuppressionFilter">
|
||||||
<property name="file" value="${config_loc}/suppressions.xml" />
|
<property name="file" value="${config_loc}/suppressions.xml" />
|
||||||
</module>
|
</module>
|
||||||
|
@ -55,7 +55,7 @@ jmh = "1.37"
|
|||||||
|
|
||||||
# Build tools
|
# Build tools
|
||||||
cctJavadoc = "1.8.2"
|
cctJavadoc = "1.8.2"
|
||||||
checkstyle = "10.12.6"
|
checkstyle = "10.14.1"
|
||||||
curseForgeGradle = "1.0.14"
|
curseForgeGradle = "1.0.14"
|
||||||
errorProne-core = "2.23.0"
|
errorProne-core = "2.23.0"
|
||||||
errorProne-plugin = "3.1.0"
|
errorProne-plugin = "3.1.0"
|
||||||
|
@ -78,11 +78,11 @@ public class JavascriptConv {
|
|||||||
* @return The wrapped array.
|
* @return The wrapped array.
|
||||||
*/
|
*/
|
||||||
public static byte[] asByteArray(ArrayBuffer view) {
|
public static byte[] asByteArray(ArrayBuffer view) {
|
||||||
return asByteArray(Int8Array.create(view));
|
return asByteArray(new Int8Array(view));
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Int8Array toArray(ByteBuffer buffer) {
|
public static Int8Array toArray(ByteBuffer buffer) {
|
||||||
var array = Int8Array.create(buffer.remaining());
|
var array = new Int8Array(buffer.remaining());
|
||||||
for (var i = 0; i < array.getLength(); i++) array.set(i, buffer.get(i));
|
for (var i = 0; i < array.getLength(); i++) array.set(i, buffer.get(i));
|
||||||
return array;
|
return array;
|
||||||
}
|
}
|
||||||
|
@ -53,11 +53,13 @@ public class SpeakerPeripheral implements TickablePeripheral {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@LuaFunction
|
@LuaFunction
|
||||||
|
@SuppressWarnings("DoNotCallSuggester")
|
||||||
public final boolean playNote(String instrumentA, Optional<Double> volumeA, Optional<Double> pitchA) throws LuaException {
|
public final boolean playNote(String instrumentA, Optional<Double> volumeA, Optional<Double> pitchA) throws LuaException {
|
||||||
throw new LuaException("Cannot play notes outside of Minecraft");
|
throw new LuaException("Cannot play notes outside of Minecraft");
|
||||||
}
|
}
|
||||||
|
|
||||||
@LuaFunction
|
@LuaFunction
|
||||||
|
@SuppressWarnings("DoNotCallSuggester")
|
||||||
public final boolean playSound(String name, Optional<Double> volumeA, Optional<Double> pitchA) throws LuaException {
|
public final boolean playSound(String name, Optional<Double> volumeA, Optional<Double> pitchA) throws LuaException {
|
||||||
throw new LuaException("Cannot play sounds outside of Minecraft");
|
throw new LuaException("Cannot play sounds outside of Minecraft");
|
||||||
}
|
}
|
||||||
@ -70,7 +72,7 @@ public class SpeakerPeripheral implements TickablePeripheral {
|
|||||||
if (length <= 0) throw new LuaException("Cannot play empty audio");
|
if (length <= 0) throw new LuaException("Cannot play empty audio");
|
||||||
if (length > 128 * 1024) throw new LuaException("Audio data is too large");
|
if (length > 128 * 1024) throw new LuaException("Audio data is too large");
|
||||||
|
|
||||||
if (audioContext == null) audioContext = AudioContext.create();
|
if (audioContext == null) audioContext = new AudioContext();
|
||||||
if (state == null || !state.isPlaying()) state = new AudioState(audioContext);
|
if (state == null || !state.isPlaying()) state = new AudioState(audioContext);
|
||||||
|
|
||||||
return state.pushBuffer(audio, length, volume);
|
return state.pushBuffer(audio, length, volume);
|
||||||
|
@ -92,7 +92,7 @@ public class THttpRequest extends Resource<THttpRequest> {
|
|||||||
if (isClosed()) return;
|
if (isClosed()) return;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
var request = XMLHttpRequest.create();
|
var request = new XMLHttpRequest();
|
||||||
request.setOnReadyStateChange(() -> onResponseStateChange(request));
|
request.setOnReadyStateChange(() -> onResponseStateChange(request));
|
||||||
request.setResponseType("arraybuffer");
|
request.setResponseType("arraybuffer");
|
||||||
var address = uri.toASCIIString();
|
var address = uri.toASCIIString();
|
||||||
|
@ -40,7 +40,7 @@ public class TWebsocket extends Resource<TWebsocket> implements WebsocketClient
|
|||||||
public void connect() {
|
public void connect() {
|
||||||
if (isClosed()) return;
|
if (isClosed()) return;
|
||||||
|
|
||||||
var client = this.websocket = WebSocket.create(uri.toASCIIString());
|
var client = this.websocket = new WebSocket(uri.toASCIIString());
|
||||||
client.setBinaryType("arraybuffer");
|
client.setBinaryType("arraybuffer");
|
||||||
client.onOpen(e -> success(Action.ALLOW.toPartial().toOptions()));
|
client.onOpen(e -> success(Action.ALLOW.toPartial().toOptions()));
|
||||||
client.onError(e -> {
|
client.onError(e -> {
|
||||||
@ -50,7 +50,7 @@ public class TWebsocket extends Resource<TWebsocket> implements WebsocketClient
|
|||||||
client.onMessage(e -> {
|
client.onMessage(e -> {
|
||||||
if (isClosed()) return;
|
if (isClosed()) return;
|
||||||
if (JavascriptConv.isArrayBuffer(e.getData())) {
|
if (JavascriptConv.isArrayBuffer(e.getData())) {
|
||||||
var array = Int8Array.create(e.getDataAsArray());
|
var array = new Int8Array(e.getDataAsArray());
|
||||||
var contents = new byte[array.getLength()];
|
var contents = new byte[array.getLength()];
|
||||||
for (var i = 0; i < contents.length; i++) contents[i] = array.get(i);
|
for (var i = 0; i < contents.length; i++) contents[i] = array.get(i);
|
||||||
environment.queueEvent("websocket_message", address, contents, true);
|
environment.queueEvent("websocket_message", address, contents, true);
|
||||||
|
Loading…
Reference in New Issue
Block a user