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:
Phoenix616 2018-01-22 01:00:24 +01:00
parent e4fb9f9872
commit 650d02e401

View File

@ -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);
}
}