Migrate another batch of FilePrinter users to slf4j.Logger

Another FilePrinter method removed.
This commit is contained in:
P0nk
2022-02-08 21:00:51 +01:00
parent 53465bba25
commit 0c60606b4e
15 changed files with 97 additions and 120 deletions

View File

@@ -32,10 +32,11 @@ import client.inventory.ItemFactory;
import client.inventory.manipulator.InventoryManipulator;
import net.server.Server;
import net.server.world.World;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import server.ItemInformationProvider;
import server.maps.HiredMerchant;
import tools.DatabaseConnection;
import tools.FilePrinter;
import tools.PacketCreator;
import tools.Pair;
@@ -50,7 +51,7 @@ import static java.util.concurrent.TimeUnit.DAYS;
* @author RonanLana - synchronization of Fredrick modules and operation results
*/
public class FredrickProcessor {
private static final Logger log = LoggerFactory.getLogger(FredrickProcessor.class);
private static final int[] dailyReminders = new int[]{2, 5, 10, 15, 30, 60, 90, Integer.MAX_VALUE};
private static byte canRetrieveFromFredrick(Character chr, List<Pair<Item, InventoryType>> items) {
@@ -293,7 +294,7 @@ public class FredrickProcessor {
Item item = it.getLeft();
InventoryManipulator.addFromDrop(chr.getClient(), item, false);
String itemName = ItemInformationProvider.getInstance().getName(item.getItemId());
FilePrinter.print(FilePrinter.FREDRICK + chr.getName() + ".txt", chr.getName() + " gained " + item.getQuantity() + " " + itemName + " (" + item.getItemId() + ")");
log.debug("Chr {} gained {}x {} ({})", chr.getName(), item.getQuantity(), itemName, item.getItemId());
}
chr.sendPacket(PacketCreator.fredrickMessage((byte) 0x1E));

View File

@@ -33,9 +33,10 @@ import config.YamlConfig;
import constants.id.ItemId;
import constants.inventory.ItemConstants;
import net.packet.InPacket;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import server.ItemInformationProvider;
import server.Storage;
import tools.FilePrinter;
import tools.PacketCreator;
/**
@@ -43,6 +44,7 @@ import tools.PacketCreator;
* @author Ronan - inventory concurrency protection on storing items
*/
public class StorageProcessor {
private static final Logger log = LoggerFactory.getLogger(StorageProcessor.class);
public static void storageAction(InPacket p, Client c) {
ItemInformationProvider ii = ItemInformationProvider.getInstance();
@@ -63,7 +65,7 @@ public class StorageProcessor {
byte slot = p.readByte();
if (slot < 0 || slot > storage.getSlots()) { // removal starts at zero
AutobanFactory.PACKET_EDIT.alert(c.getPlayer(), c.getPlayer().getName() + " tried to packet edit with storage.");
FilePrinter.print(FilePrinter.EXPLOITS + c.getPlayer().getName() + ".txt", c.getPlayer().getName() + " tried to work with storage slot " + slot);
log.warn("Chr {} tried to work with storage slot {}", c.getPlayer().getName(), slot);
c.disconnect(true, false);
return;
}
@@ -91,7 +93,7 @@ public class StorageProcessor {
InventoryManipulator.addFromDrop(c, item, false);
String itemName = ii.getName(item.getItemId());
FilePrinter.print(FilePrinter.STORAGE + c.getAccountName() + ".txt", c.getPlayer().getName() + " took out " + item.getQuantity() + " " + itemName + " (" + item.getItemId() + ")");
log.debug("Chr {} took out {}x {} ({})", c.getPlayer().getName(), item.getQuantity(), itemName, item.getItemId());
storage.sendTakenOut(c, item.getInventoryType());
} else {
@@ -110,7 +112,7 @@ public class StorageProcessor {
Inventory inv = chr.getInventory(invType);
if (slot < 1 || slot > inv.getSlotLimit()) { //player inv starts at one
AutobanFactory.PACKET_EDIT.alert(c.getPlayer(), c.getPlayer().getName() + " tried to packet edit with storage.");
FilePrinter.print(FilePrinter.EXPLOITS + c.getPlayer().getName() + ".txt", c.getPlayer().getName() + " tried to store item at slot " + slot);
log.warn("Chr {} tried to store item at slot {}", c.getPlayer().getName(), slot);
c.disconnect(true, false);
return;
}
@@ -162,8 +164,7 @@ public class StorageProcessor {
chr.setUsedStorage();
String itemName = ii.getName(item.getItemId());
FilePrinter.print(FilePrinter.STORAGE + c.getAccountName() + ".txt", c.getPlayer().getName() + " stored " + item.getQuantity() + " " + itemName + " (" + item.getItemId() + ")");
log.debug("Chr {} stored {}x {} ({})", c.getPlayer().getName(), item.getQuantity(), itemName, item.getItemId());
storage.sendStored(c, ItemConstants.getInventoryType(itemId));
}
} else if (mode == 6) { // arrange items
@@ -192,7 +193,7 @@ public class StorageProcessor {
storage.setMeso(storageMesos - meso);
chr.gainMeso(meso, false, true, false);
chr.setUsedStorage();
FilePrinter.print(FilePrinter.STORAGE + c.getPlayer().getName() + ".txt", c.getPlayer().getName() + (meso > 0 ? " took out " : " stored ") + Math.abs(meso) + " mesos");
log.debug("Chr {} {} {} mesos", c.getPlayer().getName(), meso > 0 ? "took out" : "stored", Math.abs(meso));
storage.sendMeso(c);
} else {
c.sendPacket(PacketCreator.enableActions());