mirror of
https://github.com/EarthMC/QuickShop-Reremake.git
synced 2026-11-24 17:39:52 -05:00
Try use runnable switch async to sync
Former-commit-id: fd16a39e441b30c2a287b817e13345162e2bfb1d [formerly 0f798b40364080a198aa191c0384f9fe0ab2159b] Former-commit-id: 1e7ce988872e273e2139905ca0b23d45154b7361
This commit is contained in:
1 parent
19dc32480e
commit
91c3848ead
2 files changed
+27
-26
No files matched your search
@@ -50,30 +50,24 @@ public class QS implements CommandExecutor {
|
||||
}
|
||||
|
||||
public void signGUIApi(ArrayList<Object> data, String arg) {
|
||||
new BukkitRunnable() {
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
Shop shop = (Shop) data.get(0);
|
||||
String type = (String) data.get(1);
|
||||
Player player = Bukkit.getPlayer(UUID.fromString(String.valueOf(data.get(2))));
|
||||
Util.debugLog(String.valueOf(data.size()));
|
||||
switch (type) {
|
||||
case "owner":
|
||||
uiOwner(shop, arg, player);
|
||||
break;
|
||||
case "refill":
|
||||
uiRefill(shop, arg, player);
|
||||
break;
|
||||
case "price":
|
||||
uiPrice(shop, arg, player);
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
Shop shop = (Shop) data.get(0);
|
||||
String type = (String) data.get(1);
|
||||
Player player = Bukkit.getPlayer(UUID.fromString(String.valueOf(data.get(2))));
|
||||
Util.debugLog(String.valueOf(data.size()));
|
||||
switch (type) {
|
||||
case "owner":
|
||||
uiOwner(shop, arg, player);
|
||||
break;
|
||||
case "refill":
|
||||
uiRefill(shop, arg, player);
|
||||
break;
|
||||
case "price":
|
||||
uiPrice(shop, arg, player);
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void uiPrice(Shop shop, String arg, Player sender) {
|
||||
|
||||
@@ -176,12 +176,19 @@ public class QuickShop extends JavaPlugin {
|
||||
protocolLibPlugin = (ProtocolLib) Bukkit.getPluginManager().getPlugin("ProtocolLib");
|
||||
if (protocolLibPlugin != null) {
|
||||
getProtocolLib().addPacketListener(new PacketAdapter(this, PacketType.Play.Client.UPDATE_SIGN) {
|
||||
@Override
|
||||
|
||||
@Override
|
||||
public void onPacketReceiving(PacketEvent event) {
|
||||
WrapperPlayClientUpdateSign wrapper = new WrapperPlayClientUpdateSign(event.getPacket());
|
||||
//BlockPosition blockPos = wrapper.getLocation();
|
||||
ArrayList<Object> data = QS.signPlayerCache.get(event.getPlayer().getUniqueId());
|
||||
QuickShop.instance.commandExecutor.signGUIApi(data,wrapper.getLines()[0]);
|
||||
new BukkitRunnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
QuickShop.instance.commandExecutor.signGUIApi(data,wrapper.getLines()[0]);
|
||||
}
|
||||
}.runTask(QuickShop.instance);
|
||||
|
||||
}
|
||||
});
|
||||
getLogger().info("Successfully loaded ProtocolLib support!");
|
||||
|
||||
Reference in new issue
Block a user