mirror of
https://github.com/ChestShop-authors/ChestShop-3.git
synced 2024-09-29 15:07:40 +02:00
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:
parent
03589b3fef
commit
be5f47cb1f
@ -164,6 +164,9 @@ public class Properties {
|
|||||||
@ConfigurationComment("Do you want ChestShop's messages to show up in console?")
|
@ConfigurationComment("Do you want ChestShop's messages to show up in console?")
|
||||||
public static boolean LOG_TO_CONSOLE = true;
|
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
|
@PrecededBySpace
|
||||||
@ConfigurationComment("Do you want to stack all items up to 64 item stacks?")
|
@ConfigurationComment("Do you want to stack all items up to 64 item stacks?")
|
||||||
public static boolean STACK_TO_64 = false;
|
public static boolean STACK_TO_64 = false;
|
||||||
|
@ -2,6 +2,7 @@ package com.Acrobot.ChestShop.Listeners.ShopRemoval;
|
|||||||
|
|
||||||
import com.Acrobot.Breeze.Utils.LocationUtil;
|
import com.Acrobot.Breeze.Utils.LocationUtil;
|
||||||
import com.Acrobot.ChestShop.ChestShop;
|
import com.Acrobot.ChestShop.ChestShop;
|
||||||
|
import com.Acrobot.ChestShop.Configuration.Properties;
|
||||||
import com.Acrobot.ChestShop.Events.ShopDestroyedEvent;
|
import com.Acrobot.ChestShop.Events.ShopDestroyedEvent;
|
||||||
import com.Acrobot.ChestShop.Signs.ChestShopSign;
|
import com.Acrobot.ChestShop.Signs.ChestShopSign;
|
||||||
import org.bukkit.event.EventHandler;
|
import org.bukkit.event.EventHandler;
|
||||||
@ -14,11 +15,11 @@ import static com.Acrobot.ChestShop.Signs.ChestShopSign.*;
|
|||||||
* @author Acrobot
|
* @author Acrobot
|
||||||
*/
|
*/
|
||||||
public class ShopRemovalLogger implements Listener {
|
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)
|
@EventHandler(priority = EventPriority.MONITOR)
|
||||||
public static void onShopRemoval(final ShopDestroyedEvent event) {
|
public static void onShopRemoval(final ShopDestroyedEvent event) {
|
||||||
if (event.getDestroyer() != null) {
|
if (Properties.LOG_ALL_SHOP_REMOVALS || event.getDestroyer() != null) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -33,6 +34,7 @@ public class ShopRemovalLogger implements Listener {
|
|||||||
|
|
||||||
String message = String.format(REMOVAL_MESSAGE,
|
String message = String.format(REMOVAL_MESSAGE,
|
||||||
typeOfShop,
|
typeOfShop,
|
||||||
|
event.getDestroyer() != null ? event.getDestroyer().getName() : "???",
|
||||||
item,
|
item,
|
||||||
prices,
|
prices,
|
||||||
location);
|
location);
|
||||||
|
Loading…
Reference in New Issue
Block a user