Add config option to toggle if all shop removals should be logged

Removals that happened due to no player being present will always be logged
This commit is contained in:
Phoenix616 2019-04-01 13:49:48 +01:00
parent 03589b3fef
commit be5f47cb1f
2 changed files with 7 additions and 2 deletions

View File

@ -164,6 +164,9 @@ public class Properties {
@ConfigurationComment("Do you want ChestShop's messages to show up in console?")
public static boolean LOG_TO_CONSOLE = true;
@ConfigurationComment("Should all shop removals be logged to the console?")
public static boolean LOG_ALL_SHOP_REMOVALS = true;
@PrecededBySpace
@ConfigurationComment("Do you want to stack all items up to 64 item stacks?")
public static boolean STACK_TO_64 = false;

View File

@ -2,6 +2,7 @@ package com.Acrobot.ChestShop.Listeners.ShopRemoval;
import com.Acrobot.Breeze.Utils.LocationUtil;
import com.Acrobot.ChestShop.ChestShop;
import com.Acrobot.ChestShop.Configuration.Properties;
import com.Acrobot.ChestShop.Events.ShopDestroyedEvent;
import com.Acrobot.ChestShop.Signs.ChestShopSign;
import org.bukkit.event.EventHandler;
@ -14,11 +15,11 @@ import static com.Acrobot.ChestShop.Signs.ChestShopSign.*;
* @author Acrobot
*/
public class ShopRemovalLogger implements Listener {
private static final String REMOVAL_MESSAGE = "%1$s was removed - %2$s - %3$s - at %4$s";
private static final String REMOVAL_MESSAGE = "%1$s was removed by %2$s - %3$s - %4$s - at %5$s";
@EventHandler(priority = EventPriority.MONITOR)
public static void onShopRemoval(final ShopDestroyedEvent event) {
if (event.getDestroyer() != null) {
if (Properties.LOG_ALL_SHOP_REMOVALS || event.getDestroyer() != null) {
return;
}
@ -33,6 +34,7 @@ public class ShopRemovalLogger implements Listener {
String message = String.format(REMOVAL_MESSAGE,
typeOfShop,
event.getDestroyer() != null ? event.getDestroyer().getName() : "???",
item,
prices,
location);