Removed TradeController CSV file compatibility.

This commit is contained in:
MobiusDevelopment
2020-06-10 21:28:54 +00:00
parent 4c3faebdf0
commit 47347785cc

View File

@ -16,10 +16,6 @@
*/
package org.l2jmobius.gameserver;
import java.io.BufferedReader;
import java.io.File;
import java.io.FileReader;
import java.io.LineNumberReader;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
@ -74,86 +70,9 @@ public class TradeController
private TradeController()
{
boolean limitedItem = false;
_lists = new HashMap<>();
_listsTaskItem = new HashMap<>();
final File buylistData = new File(Config.DATAPACK_ROOT, "data/buylists.csv");
if (buylistData.exists())
{
LOGGER.warning("Do, please, remove buylists from data folder and use SQL buylist instead");
String line = null;
FileReader reader = null;
BufferedReader buff = null;
LineNumberReader lnr = null;
try
{
reader = new FileReader(buylistData);
buff = new BufferedReader(reader);
lnr = new LineNumberReader(buff);
while ((line = lnr.readLine()) != null)
{
if ((line.trim().length() == 0) || line.startsWith("#"))
{
continue;
}
// FIXME: Nothing?
}
LOGGER.info("TradeController: Loaded " + _lists.size() + " Buylists.");
}
catch (Exception e)
{
LOGGER.warning("Error while creating trade controller in line: " + (lnr == null ? 0 : lnr.getLineNumber()) + " " + e);
}
finally
{
if (lnr != null)
{
try
{
lnr.close();
}
catch (Exception e1)
{
LOGGER.warning("Problem with TradeController: " + e1.getMessage());
}
}
if (buff != null)
{
try
{
buff.close();
}
catch (Exception e1)
{
LOGGER.warning("Problem with TradeController: " + e1.getMessage());
}
}
if (reader != null)
{
try
{
reader.close();
}
catch (Exception e1)
{
LOGGER.warning("Problem with TradeController: " + e1.getMessage());
}
}
}
}
else
{
LOGGER.info("No buylists found in data folder, using SQL buylist instead.");
/**
* Initialize Shop buylist
*/
boolean limitedItem = false;
try (Connection con = DatabaseFactory.getConnection())
{
@ -279,7 +198,7 @@ public class TradeController
LOGGER.info("TradeController: Loaded " + _listsTaskItem.size() + " Limited Buylists.");
/*
* Restore Task for reinitialyze count of buy item
* Restore Task for reinitialize count of buy item
*/
try
{
@ -312,14 +231,13 @@ public class TradeController
}
catch (Exception e)
{
// problem with initializing spawn, go to next one
LOGGER.warning("TradeController: Buylists could not be initialized." + e.getMessage());
}
/*
* If enabled, initialize the custom buylist
* If enabled, initialize the custom buylist.
*/
if (Config.CUSTOM_MERCHANT_TABLES)// Custom merchat Tabels
if (Config.CUSTOM_MERCHANT_TABLES) // Custom merchant tables.
{
try (Connection con = DatabaseFactory.getConnection())
{
@ -441,7 +359,7 @@ public class TradeController
LOGGER.info("TradeController: Loaded " + (_lists.size() - initialSize) + " Custom Buylists.");
/**
* Restore Task for reinitialyze count of buy item
* Restore Task for reinitialize count of buy item
*/
try
{
@ -474,12 +392,10 @@ public class TradeController
}
catch (Exception e)
{
// problem with initializing spawn, go to next one
LOGGER.warning("TradeController: Buylists could not be initialized. " + e.getMessage());
}
}
}
}
public StoreTradeList getBuyList(int listId)
{
@ -589,9 +505,6 @@ public class TradeController
}
}
/**
* @return
*/
public synchronized int getNextId()
{
return _nextListId++;