mirror of
https://github.com/ChestShop-authors/ChestShop-3.git
synced 2024-11-27 04:25:14 +01:00
No need to log console message async (Fixes #101)
Iirc this was only async for database logging or name resolving. Neither of these is done anymore and async access of the Bukkit API can lead to strange problems like the CME described in the mentioned issue.
This commit is contained in:
parent
e4fb9f9872
commit
650d02e401
@ -21,26 +21,21 @@ public class TransactionLogger implements Listener {
|
||||
|
||||
@EventHandler(priority = EventPriority.MONITOR)
|
||||
public static void onTransaction(final TransactionEvent event) {
|
||||
ChestShop.getBukkitServer().getScheduler().runTaskAsynchronously(ChestShop.getPlugin(), new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
String template = (event.getTransactionType() == BUY ? BUY_MESSAGE : SELL_MESSAGE);
|
||||
String template = (event.getTransactionType() == BUY ? BUY_MESSAGE : SELL_MESSAGE);
|
||||
|
||||
StringBuilder items = new StringBuilder(50);
|
||||
StringBuilder items = new StringBuilder(50);
|
||||
|
||||
for (ItemStack item : mergeSimilarStacks(event.getStock())) {
|
||||
items.append(item.getAmount()).append(' ').append(getSignName(item));
|
||||
}
|
||||
for (ItemStack item : mergeSimilarStacks(event.getStock())) {
|
||||
items.append(item.getAmount()).append(' ').append(getSignName(item));
|
||||
}
|
||||
|
||||
String message = String.format(template,
|
||||
event.getClient().getName(),
|
||||
items.toString(),
|
||||
event.getPrice(),
|
||||
event.getOwnerAccount().getName(),
|
||||
LocationUtil.locationToString(event.getSign().getLocation()));
|
||||
String message = String.format(template,
|
||||
event.getClient().getName(),
|
||||
items.toString(),
|
||||
event.getPrice(),
|
||||
event.getOwnerAccount().getName(),
|
||||
LocationUtil.locationToString(event.getSign().getLocation()));
|
||||
|
||||
ChestShop.getBukkitLogger().info(message);
|
||||
}
|
||||
});
|
||||
ChestShop.getBukkitLogger().info(message);
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user