2013-08-07 02:03:09 +02:00
|
|
|
package com.Acrobot.ChestShop.Listeners.PostShopCreation;
|
|
|
|
|
|
|
|
import com.Acrobot.Breeze.Utils.LocationUtil;
|
|
|
|
import com.Acrobot.ChestShop.ChestShop;
|
|
|
|
import com.Acrobot.ChestShop.Events.ShopCreatedEvent;
|
|
|
|
import com.Acrobot.ChestShop.Signs.ChestShopSign;
|
|
|
|
import org.bukkit.event.EventHandler;
|
|
|
|
import org.bukkit.event.EventPriority;
|
|
|
|
import org.bukkit.event.Listener;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @author Acrobot
|
|
|
|
*/
|
|
|
|
public class ShopCreationLogger implements Listener {
|
|
|
|
private static final String CREATION_MESSAGE = "%1$s created %2$s - %3$s - %4$s - at %5$s";
|
|
|
|
|
|
|
|
@EventHandler(priority = EventPriority.MONITOR)
|
|
|
|
public static void onShopCreation(final ShopCreatedEvent event) {
|
2023-03-23 23:50:08 +01:00
|
|
|
ChestShop.runInAsyncThread(() -> {
|
2022-01-26 20:35:42 +01:00
|
|
|
String creator = event.getPlayer().getName();
|
|
|
|
String shopOwner = ChestShopSign.getOwner(event.getSignLines());
|
|
|
|
String typeOfShop = ChestShopSign.isAdminShop(shopOwner) ? "an Admin Shop" : "a shop" + (event.createdByOwner() ? "" : " for " + event.getOwnerAccount().getName());
|
2013-08-07 02:03:09 +02:00
|
|
|
|
2022-02-17 16:34:25 +01:00
|
|
|
String item = ChestShopSign.getQuantity(event.getSignLines()) + ' ' + ChestShopSign.getItem(event.getSignLines());
|
|
|
|
String prices = ChestShopSign.getPrice(event.getSignLines());
|
2022-01-26 20:35:42 +01:00
|
|
|
String location = LocationUtil.locationToString(event.getSign().getLocation());
|
2013-08-07 02:03:09 +02:00
|
|
|
|
2022-01-26 20:35:42 +01:00
|
|
|
String message = String.format(CREATION_MESSAGE,
|
|
|
|
creator,
|
|
|
|
typeOfShop,
|
|
|
|
item,
|
|
|
|
prices,
|
|
|
|
location);
|
2013-08-07 02:03:09 +02:00
|
|
|
|
2023-06-18 23:12:08 +02:00
|
|
|
ChestShop.getShopLogger().info(message);
|
2013-08-07 02:03:09 +02:00
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|