Send messages to BlockCommandSender on owning thread

Fixes #124
This commit is contained in:
LOOHP committed 2025-07-16 13:17:48 +01:00
1 parent 837a9a5b73
commit e25eff4fac
27 files changed
+232 -242

No files matched your search

+1 -1
View File
@@ -27,7 +27,7 @@
<parent>
<groupId>com.loohp</groupId>
<artifactId>ImageFrame-Parent</artifactId>
<version>1.8.4.0</version>
<version>1.8.4.1</version>
</parent>
<artifactId>ImageFrame-V1_16</artifactId>
+1 -1
View File
@@ -27,7 +27,7 @@
<parent>
<groupId>com.loohp</groupId>
<artifactId>ImageFrame-Parent</artifactId>
<version>1.8.4.0</version>
<version>1.8.4.1</version>
</parent>
<artifactId>ImageFrame-V1_16_2</artifactId>
+1 -1
View File
@@ -27,7 +27,7 @@
<parent>
<groupId>com.loohp</groupId>
<artifactId>ImageFrame-Parent</artifactId>
<version>1.8.4.0</version>
<version>1.8.4.1</version>
</parent>
<artifactId>ImageFrame-V1_16_4</artifactId>
+1 -1
View File
@@ -27,7 +27,7 @@
<parent>
<groupId>com.loohp</groupId>
<artifactId>ImageFrame-Parent</artifactId>
<version>1.8.4.0</version>
<version>1.8.4.1</version>
</parent>
<artifactId>ImageFrame-V1_17</artifactId>
+1 -1
View File
@@ -27,7 +27,7 @@
<parent>
<groupId>com.loohp</groupId>
<artifactId>ImageFrame-Parent</artifactId>
<version>1.8.4.0</version>
<version>1.8.4.1</version>
</parent>
<artifactId>ImageFrame-V1_18</artifactId>
+1 -1
View File
@@ -27,7 +27,7 @@
<parent>
<groupId>com.loohp</groupId>
<artifactId>ImageFrame-Parent</artifactId>
<version>1.8.4.0</version>
<version>1.8.4.1</version>
</parent>
<artifactId>ImageFrame-V1_18_2</artifactId>
+1 -1
View File
@@ -27,7 +27,7 @@
<parent>
<groupId>com.loohp</groupId>
<artifactId>ImageFrame-Parent</artifactId>
<version>1.8.4.0</version>
<version>1.8.4.1</version>
</parent>
<artifactId>ImageFrame-V1_19</artifactId>
+1 -1
View File
@@ -27,7 +27,7 @@
<parent>
<groupId>com.loohp</groupId>
<artifactId>ImageFrame-Parent</artifactId>
<version>1.8.4.0</version>
<version>1.8.4.1</version>
</parent>
<artifactId>ImageFrame-V1_19_3</artifactId>
+1 -1
View File
@@ -27,7 +27,7 @@
<parent>
<groupId>com.loohp</groupId>
<artifactId>ImageFrame-Parent</artifactId>
<version>1.8.4.0</version>
<version>1.8.4.1</version>
</parent>
<artifactId>ImageFrame-V1_19_4</artifactId>
+1 -1
View File
@@ -27,7 +27,7 @@
<parent>
<groupId>com.loohp</groupId>
<artifactId>ImageFrame-Parent</artifactId>
<version>1.8.4.0</version>
<version>1.8.4.1</version>
</parent>
<artifactId>ImageFrame-V1_20</artifactId>
+1 -1
View File
@@ -27,7 +27,7 @@
<parent>
<groupId>com.loohp</groupId>
<artifactId>ImageFrame-Parent</artifactId>
<version>1.8.4.0</version>
<version>1.8.4.1</version>
</parent>
<artifactId>ImageFrame-V1_20_2</artifactId>
+1 -1
View File
@@ -27,7 +27,7 @@
<parent>
<groupId>com.loohp</groupId>
<artifactId>ImageFrame-Parent</artifactId>
<version>1.8.4.0</version>
<version>1.8.4.1</version>
</parent>
<artifactId>ImageFrame-V1_20_3</artifactId>
+1 -1
View File
@@ -27,7 +27,7 @@
<parent>
<groupId>com.loohp</groupId>
<artifactId>ImageFrame-Parent</artifactId>
<version>1.8.4.0</version>
<version>1.8.4.1</version>
</parent>
<artifactId>ImageFrame-V1_20_5</artifactId>
+1 -1
View File
@@ -27,7 +27,7 @@
<parent>
<groupId>com.loohp</groupId>
<artifactId>ImageFrame-Parent</artifactId>
<version>1.8.4.0</version>
<version>1.8.4.1</version>
</parent>
<artifactId>ImageFrame-V1_20_6</artifactId>
+1 -1
View File
@@ -27,7 +27,7 @@
<parent>
<groupId>com.loohp</groupId>
<artifactId>ImageFrame-Parent</artifactId>
<version>1.8.4.0</version>
<version>1.8.4.1</version>
</parent>
<artifactId>ImageFrame-V1_21</artifactId>
+1 -1
View File
@@ -27,7 +27,7 @@
<parent>
<groupId>com.loohp</groupId>
<artifactId>ImageFrame-Parent</artifactId>
<version>1.8.4.0</version>
<version>1.8.4.1</version>
</parent>
<artifactId>ImageFrame-V1_21_1</artifactId>
+1 -1
View File
@@ -27,7 +27,7 @@
<parent>
<groupId>com.loohp</groupId>
<artifactId>ImageFrame-Parent</artifactId>
<version>1.8.4.0</version>
<version>1.8.4.1</version>
</parent>
<artifactId>ImageFrame-V1_21_2</artifactId>
+1 -1
View File
@@ -27,7 +27,7 @@
<parent>
<groupId>com.loohp</groupId>
<artifactId>ImageFrame-Parent</artifactId>
<version>1.8.4.0</version>
<version>1.8.4.1</version>
</parent>
<artifactId>ImageFrame-V1_21_3</artifactId>
+1 -1
View File
@@ -27,7 +27,7 @@
<parent>
<groupId>com.loohp</groupId>
<artifactId>ImageFrame-Parent</artifactId>
<version>1.8.4.0</version>
<version>1.8.4.1</version>
</parent>
<artifactId>ImageFrame-V1_21_4</artifactId>
+1 -1
View File
@@ -27,7 +27,7 @@
<parent>
<groupId>com.loohp</groupId>
<artifactId>ImageFrame-Parent</artifactId>
<version>1.8.4.0</version>
<version>1.8.4.1</version>
</parent>
<artifactId>ImageFrame-V1_21_5</artifactId>
+1 -1
View File
@@ -27,7 +27,7 @@
<parent>
<groupId>com.loohp</groupId>
<artifactId>ImageFrame-Parent</artifactId>
<version>1.8.4.0</version>
<version>1.8.4.1</version>
</parent>
<artifactId>ImageFrame-V1_21_6</artifactId>
+1 -1
View File
@@ -27,7 +27,7 @@
<parent>
<groupId>com.loohp</groupId>
<artifactId>ImageFrame-Parent</artifactId>
<version>1.8.4.0</version>
<version>1.8.4.1</version>
</parent>
<artifactId>ImageFrame-V1_21_7</artifactId>
+1 -1
View File
@@ -27,7 +27,7 @@
<parent>
<groupId>com.loohp</groupId>
<artifactId>ImageFrame-Parent</artifactId>
<version>1.8.4.0</version>
<version>1.8.4.1</version>
</parent>
<artifactId>ImageFrame-Abstraction</artifactId>
+1 -1
View File
@@ -26,7 +26,7 @@
<groupId>com.loohp</groupId>
<artifactId>ImageFrame</artifactId>
<version>1.8.4.0</version>
<version>1.8.4.1</version>
<packaging>jar</packaging>
<name>ImageFrame</name>
File diff suppressed because it is too large. Load diff
@@ -20,32 +20,21 @@
package com.loohp.imageframe.utils;
import java.io.DataInputStream;
import java.io.DataOutputStream;
import java.io.IOException;
import com.loohp.imageframe.ImageFrame;
import com.loohp.platformscheduler.Scheduler;
import org.bukkit.Chunk;
import org.bukkit.command.BlockCommandSender;
import org.bukkit.command.CommandSender;
public class DataTypeIO {
public static int readVarInt(DataInputStream in) throws IOException {
int i = 0;
int j = 0;
byte b;
do {
b = in.readByte();
i |= (b & 127) << j++ * 7;
if (j > 5) {
throw new RuntimeException("VarInt too big");
}
} while ((b & 128) == 128);
return i;
}
public static void writeVarInt(DataOutputStream out, int value) throws IOException {
while ((value & -128) != 0) {
out.writeByte(value & 127 | 128);
value >>>= 7;
}
out.writeByte(value);
}
public class CommandSenderUtils {
public static void sendMessage(CommandSender sender, String message) {
if (sender instanceof BlockCommandSender) {
Chunk chunk = ((BlockCommandSender) sender).getBlock().getChunk();
Scheduler.executeOrScheduleSync(ImageFrame.plugin, () -> sender.sendMessage(message), chunk);
} else {
sender.sendMessage(message);
}
}
}
+1 -1
View File
@@ -26,7 +26,7 @@
<groupId>com.loohp</groupId>
<artifactId>ImageFrame-Parent</artifactId>
<version>1.8.4.0</version>
<version>1.8.4.1</version>
<packaging>pom</packaging>
<properties>