Various code changes.

This commit is contained in:
MobiusDev
2018-04-11 11:25:53 +00:00
parent db9a123081
commit 847ff1fa4f
713 changed files with 2432 additions and 4262 deletions

View File

@@ -21,12 +21,11 @@ import java.lang.management.ManagementFactory;
import java.lang.management.MonitorInfo;
import java.lang.management.ThreadInfo;
import java.lang.management.ThreadMXBean;
import java.time.Duration;
import java.util.logging.Level;
import java.util.logging.Logger;
import com.l2jmobius.Config;
import com.l2jmobius.gameserver.Shutdown;
import com.l2jmobius.gameserver.util.Broadcast;
/**
* Thread to check for deadlocked threads.
@@ -34,16 +33,17 @@ import com.l2jmobius.gameserver.util.Broadcast;
*/
public class DeadLockDetector extends Thread
{
private static Logger _log = Logger.getLogger(DeadLockDetector.class.getName());
/** Interval to check for deadlocked threads */
private static final int _sleepTime = Config.DEADLOCK_CHECK_INTERVAL * 1000;
private static Logger LOGGER = Logger.getLogger(DeadLockDetector.class.getName());
private final Duration _checkInterval;
private final Runnable _deadLockCallback;
private final ThreadMXBean tmx;
public DeadLockDetector()
public DeadLockDetector(Duration checkInterval, Runnable deadLockCallback)
{
super("DeadLockDetector");
_checkInterval = checkInterval;
_deadLockCallback = deadLockCallback;
tmx = ManagementFactory.getThreadMXBean();
}
@@ -102,19 +102,19 @@ public class DeadLockDetector extends Thread
info.append(Config.EOL);
}
}
_log.warning(info.toString());
if (Config.RESTART_ON_DEADLOCK)
LOGGER.warning(info.toString());
if (_deadLockCallback != null)
{
Broadcast.toAllOnlinePlayers("Server has stability issues - restarting now.");
Shutdown.getInstance().startTelnetShutdown("DeadLockDetector - Auto Restart", 60, true);
_deadLockCallback.run();
}
}
Thread.sleep(_sleepTime);
Thread.sleep(_checkInterval.toMillis());
}
catch (Exception e)
{
_log.log(Level.WARNING, "DeadLockDetector: ", e);
LOGGER.log(Level.WARNING, "DeadLockDetector: ", e);
}
}
}

View File

@@ -29,7 +29,7 @@ import java.util.logging.Logger;
*/
public final class PropertiesParser
{
private static final Logger _log = Logger.getLogger(PropertiesParser.class.getName());
private static final Logger LOGGER = Logger.getLogger(PropertiesParser.class.getName());
private final Properties _properties = new Properties();
private final File _file;
@@ -51,7 +51,7 @@ public final class PropertiesParser
}
catch (Exception e)
{
_log.warning("[" + _file.getName() + "] There was an error loading config reason: " + e.getMessage());
LOGGER.warning("[" + _file.getName() + "] There was an error loading config reason: " + e.getMessage());
}
}
@@ -71,7 +71,7 @@ public final class PropertiesParser
final String value = getValue(key);
if (value == null)
{
_log.warning("[" + _file.getName() + "] missing property for key: " + key + " using default value: " + defaultValue);
LOGGER.warning("[" + _file.getName() + "] missing property for key: " + key + " using default value: " + defaultValue);
return defaultValue;
}
@@ -85,7 +85,7 @@ public final class PropertiesParser
}
else
{
_log.warning("[" + _file.getName() + "] Invalid value specified for key: " + key + " specified value: " + value + " should be \"boolean\" using default value: " + defaultValue);
LOGGER.warning("[" + _file.getName() + "] Invalid value specified for key: " + key + " specified value: " + value + " should be \"boolean\" using default value: " + defaultValue);
return defaultValue;
}
}
@@ -95,7 +95,7 @@ public final class PropertiesParser
final String value = getValue(key);
if (value == null)
{
_log.warning("[" + _file.getName() + "] missing property for key: " + key + " using default value: " + defaultValue);
LOGGER.warning("[" + _file.getName() + "] missing property for key: " + key + " using default value: " + defaultValue);
return defaultValue;
}
@@ -105,7 +105,7 @@ public final class PropertiesParser
}
catch (NumberFormatException e)
{
_log.warning("[" + _file.getName() + "] Invalid value specified for key: " + key + " specified value: " + value + " should be \"byte\" using default value: " + defaultValue);
LOGGER.warning("[" + _file.getName() + "] Invalid value specified for key: " + key + " specified value: " + value + " should be \"byte\" using default value: " + defaultValue);
return defaultValue;
}
}
@@ -115,7 +115,7 @@ public final class PropertiesParser
final String value = getValue(key);
if (value == null)
{
_log.warning("[" + _file.getName() + "] missing property for key: " + key + " using default value: " + defaultValue);
LOGGER.warning("[" + _file.getName() + "] missing property for key: " + key + " using default value: " + defaultValue);
return defaultValue;
}
@@ -125,7 +125,7 @@ public final class PropertiesParser
}
catch (NumberFormatException e)
{
_log.warning("[" + _file.getName() + "] Invalid value specified for key: " + key + " specified value: " + value + " should be \"short\" using default value: " + defaultValue);
LOGGER.warning("[" + _file.getName() + "] Invalid value specified for key: " + key + " specified value: " + value + " should be \"short\" using default value: " + defaultValue);
return defaultValue;
}
}
@@ -135,7 +135,7 @@ public final class PropertiesParser
final String value = getValue(key);
if (value == null)
{
_log.warning("[" + _file.getName() + "] missing property for key: " + key + " using default value: " + defaultValue);
LOGGER.warning("[" + _file.getName() + "] missing property for key: " + key + " using default value: " + defaultValue);
return defaultValue;
}
@@ -145,7 +145,7 @@ public final class PropertiesParser
}
catch (NumberFormatException e)
{
_log.warning("[" + _file.getName() + "] Invalid value specified for key: " + key + " specified value: " + value + " should be \"int\" using default value: " + defaultValue);
LOGGER.warning("[" + _file.getName() + "] Invalid value specified for key: " + key + " specified value: " + value + " should be \"int\" using default value: " + defaultValue);
return defaultValue;
}
}
@@ -155,7 +155,7 @@ public final class PropertiesParser
final String value = getValue(key);
if (value == null)
{
_log.warning("[" + _file.getName() + "] missing property for key: " + key + " using default value: " + defaultValue);
LOGGER.warning("[" + _file.getName() + "] missing property for key: " + key + " using default value: " + defaultValue);
return defaultValue;
}
@@ -165,7 +165,7 @@ public final class PropertiesParser
}
catch (NumberFormatException e)
{
_log.warning("[" + _file.getName() + "] Invalid value specified for key: " + key + " specified value: " + value + " should be \"long\" using default value: " + defaultValue);
LOGGER.warning("[" + _file.getName() + "] Invalid value specified for key: " + key + " specified value: " + value + " should be \"long\" using default value: " + defaultValue);
return defaultValue;
}
}
@@ -175,7 +175,7 @@ public final class PropertiesParser
final String value = getValue(key);
if (value == null)
{
_log.warning("[" + _file.getName() + "] missing property for key: " + key + " using default value: " + defaultValue);
LOGGER.warning("[" + _file.getName() + "] missing property for key: " + key + " using default value: " + defaultValue);
return defaultValue;
}
@@ -185,7 +185,7 @@ public final class PropertiesParser
}
catch (NumberFormatException e)
{
_log.warning("[" + _file.getName() + "] Invalid value specified for key: " + key + " specified value: " + value + " should be \"float\" using default value: " + defaultValue);
LOGGER.warning("[" + _file.getName() + "] Invalid value specified for key: " + key + " specified value: " + value + " should be \"float\" using default value: " + defaultValue);
return defaultValue;
}
}
@@ -195,7 +195,7 @@ public final class PropertiesParser
final String value = getValue(key);
if (value == null)
{
_log.warning("[" + _file.getName() + "] missing property for key: " + key + " using default value: " + defaultValue);
LOGGER.warning("[" + _file.getName() + "] missing property for key: " + key + " using default value: " + defaultValue);
return defaultValue;
}
@@ -205,7 +205,7 @@ public final class PropertiesParser
}
catch (NumberFormatException e)
{
_log.warning("[" + _file.getName() + "] Invalid value specified for key: " + key + " specified value: " + value + " should be \"double\" using default value: " + defaultValue);
LOGGER.warning("[" + _file.getName() + "] Invalid value specified for key: " + key + " specified value: " + value + " should be \"double\" using default value: " + defaultValue);
return defaultValue;
}
}
@@ -213,12 +213,12 @@ public final class PropertiesParser
public String getString(String key, String defaultValue)
{
final String value = getValue(key);
if (value != null)
if (value == null)
{
return value;
LOGGER.warning("[" + _file.getName() + "] missing property for key: " + key + " using default value: " + defaultValue);
return defaultValue;
}
_log.warning("[" + _file.getName() + "] missing property for key: " + key + " using default value: " + defaultValue);
return defaultValue;
return value;
}
public <T extends Enum<T>> T getEnum(String key, Class<T> clazz, T defaultValue)
@@ -226,7 +226,7 @@ public final class PropertiesParser
final String value = getValue(key);
if (value == null)
{
_log.warning("[" + _file.getName() + "] missing property for key: " + key + " using default value: " + defaultValue);
LOGGER.warning("[" + _file.getName() + "] missing property for key: " + key + " using default value: " + defaultValue);
return defaultValue;
}
@@ -236,7 +236,7 @@ public final class PropertiesParser
}
catch (IllegalArgumentException e)
{
_log.warning("[" + _file.getName() + "] Invalid value specified for key: " + key + " specified value: " + value + " should be enum value of \"" + clazz.getSimpleName() + "\" using default value: " + defaultValue);
LOGGER.warning("[" + _file.getName() + "] Invalid value specified for key: " + key + " specified value: " + value + " should be enum value of \"" + clazz.getSimpleName() + "\" using default value: " + defaultValue);
return defaultValue;
}
}

View File

@@ -30,7 +30,7 @@ import com.l2jmobius.gameserver.model.itemcontainer.Inventory;
*/
public class FortUpdater implements Runnable
{
protected static Logger _log = Logger.getLogger(FortUpdater.class.getName());
protected static Logger LOGGER = Logger.getLogger(FortUpdater.class.getName());
private final L2Clan _clan;
private final Fort _fort;
private int _runCount;
@@ -100,7 +100,7 @@ public class FortUpdater implements Runnable
}
catch (Exception e)
{
_log.log(Level.WARNING, "", e);
LOGGER.log(Level.WARNING, "", e);
}
}

View File

@@ -21,6 +21,7 @@ import java.io.File;
import java.io.FileInputStream;
import java.io.InputStream;
import java.lang.management.ManagementFactory;
import java.time.Duration;
import java.util.Calendar;
import java.util.logging.Level;
import java.util.logging.LogManager;
@@ -71,6 +72,7 @@ import com.l2jmobius.gameserver.data.xml.impl.PrimeShopData;
import com.l2jmobius.gameserver.data.xml.impl.RecipeData;
import com.l2jmobius.gameserver.data.xml.impl.SecondaryAuthData;
import com.l2jmobius.gameserver.data.xml.impl.SiegeScheduleData;
import com.l2jmobius.gameserver.data.xml.impl.SkillData;
import com.l2jmobius.gameserver.data.xml.impl.SkillLearnData;
import com.l2jmobius.gameserver.data.xml.impl.SkillTreesData;
import com.l2jmobius.gameserver.data.xml.impl.StaticObjectData;
@@ -81,7 +83,6 @@ import com.l2jmobius.gameserver.datatables.BotReportTable;
import com.l2jmobius.gameserver.datatables.EventDroplist;
import com.l2jmobius.gameserver.datatables.ItemTable;
import com.l2jmobius.gameserver.datatables.MerchantPriceConfigTable;
import com.l2jmobius.gameserver.datatables.SkillData;
import com.l2jmobius.gameserver.datatables.SpawnTable;
import com.l2jmobius.gameserver.geoengine.GeoEngine;
import com.l2jmobius.gameserver.handler.EffectHandler;
@@ -138,8 +139,9 @@ import com.l2jmobius.gameserver.network.loginserver.LoginServerNetworkManager;
import com.l2jmobius.gameserver.network.telnet.TelnetServer;
import com.l2jmobius.gameserver.scripting.ScriptEngineManager;
import com.l2jmobius.gameserver.taskmanager.TaskManager;
import com.l2jmobius.gameserver.util.Broadcast;
public final class GameServer
public class GameServer
{
private static final Logger LOGGER = Logger.getLogger(GameServer.class.getName());
@@ -175,8 +177,6 @@ public final class GameServer
throw new Exception("Could not initialize the ID factory!");
}
new File("log/game").mkdirs();
// load script engines
printSection("Scripting Engines");
EventDispatcher.getInstance();
@@ -398,7 +398,14 @@ public final class GameServer
if (Config.DEADLOCK_DETECTOR)
{
_deadDetectThread = new DeadLockDetector();
_deadDetectThread = new DeadLockDetector(Duration.ofSeconds(Config.DEADLOCK_CHECK_INTERVAL), () ->
{
if (Config.RESTART_ON_DEADLOCK)
{
Broadcast.toAllOnlinePlayers("Server has stability issues - restarting now.");
Shutdown.getInstance().startTelnetShutdown("DeadLockDetector - Auto Restart", 60, true);
}
});
_deadDetectThread.setDaemon(true);
_deadDetectThread.start();
}
@@ -460,6 +467,8 @@ public final class GameServer
LogManager.getLogManager().readConfiguration(is);
}
new File("log/game").mkdirs();
// Initialize config
Config.load();
printSection("Database");

View File

@@ -32,7 +32,7 @@ import com.l2jmobius.gameserver.model.actor.L2Character;
*/
public final class GameTimeController extends Thread
{
private static final Logger _log = Logger.getLogger(GameTimeController.class.getName());
private static final Logger LOGGER = Logger.getLogger(GameTimeController.class.getName());
public static final int TICKS_PER_SECOND = 10; // not able to change this without checking through code
public static final int MILLIS_IN_TICK = 1000 / TICKS_PER_SECOND;
@@ -131,13 +131,13 @@ public final class GameTimeController extends Thread
public final void stopTimer()
{
super.interrupt();
_log.log(Level.INFO, "Stopping " + getClass().getSimpleName());
LOGGER.info(getClass().getSimpleName() + ": Stopped.");
}
@Override
public final void run()
{
_log.log(Level.CONFIG, getClass().getSimpleName() + ": Started.");
LOGGER.info(getClass().getSimpleName() + ": Started.");
long nextTickTime, sleepTime;
boolean isNight = isNight();
@@ -157,7 +157,7 @@ public final class GameTimeController extends Thread
}
catch (Throwable e)
{
_log.log(Level.WARNING, "", e);
LOGGER.log(Level.WARNING, getClass().getSimpleName(), e);
}
sleepTime = nextTickTime - System.currentTimeMillis();

View File

@@ -26,7 +26,7 @@ import com.l2jmobius.gameserver.model.actor.templates.L2NpcTemplate;
public class MonsterRace
{
protected static final Logger _log = Logger.getLogger(MonsterRace.class.getName());
protected static final Logger LOGGER = Logger.getLogger(MonsterRace.class.getName());
private final L2Npc[] _monsters;
private int[][] _speeds;
@@ -40,11 +40,6 @@ public class MonsterRace
_second = new int[2];
}
public static MonsterRace getInstance()
{
return SingletonHolder._instance;
}
public void newRace()
{
int random = 0;
@@ -72,7 +67,7 @@ public class MonsterRace
}
catch (Exception e)
{
_log.log(Level.WARNING, "Unable to create monster!", e);
LOGGER.log(Level.WARNING, "Unable to create monster!", e);
}
}
newSpeeds();
@@ -133,6 +128,11 @@ public class MonsterRace
return _second[0];
}
public static MonsterRace getInstance()
{
return SingletonHolder._instance;
}
private static class SingletonHolder
{
protected static final MonsterRace _instance = new MonsterRace();

View File

@@ -170,7 +170,7 @@ public class RecipeController
private static class RecipeItemMaker implements Runnable
{
private static final Logger _log = Logger.getLogger(RecipeItemMaker.class.getName());
private static final Logger LOGGER = Logger.getLogger(RecipeItemMaker.class.getName());
protected boolean _isValid;
protected List<TempItem> _items = null;
protected final L2RecipeList _recipeList;
@@ -306,14 +306,14 @@ public class RecipeController
if ((_player == null) || (_target == null))
{
_log.warning("player or target == null (disconnected?), aborting" + _target + _player);
LOGGER.warning("player or target == null (disconnected?), aborting" + _target + _player);
abort();
return;
}
if (!_player.isOnline() || !_target.isOnline())
{
_log.warning("player or target is not online, aborting " + _target + _player);
LOGGER.warning("player or target is not online, aborting " + _target + _player);
abort();
return;
}

View File

@@ -561,7 +561,7 @@ public class Shutdown extends Thread
LOGGER.info("Olympiad System: Data saved(" + tc.getEstimatedTimeAndRestartCounter() + "ms).");
Hero.getInstance().shutdown();
LOGGER.info("Hero System: Data saved(" + tc.getEstimatedTimeAndRestartCounter() + "ms).");
ClanTable.getInstance().storeClanScore();
ClanTable.getInstance().shutdown();
LOGGER.info("Clan System: Data saved(" + tc.getEstimatedTimeAndRestartCounter() + "ms).");
// Save Cursed Weapons data before closing.

View File

@@ -48,7 +48,7 @@ import com.l2jmobius.gameserver.taskmanager.AttackStanceTaskManager;
*/
public abstract class AbstractAI implements Ctrl
{
protected final Logger _log = Logger.getLogger(getClass().getName());
protected final Logger LOGGER = Logger.getLogger(getClass().getName());
private NextAction _nextAction;
@@ -121,7 +121,7 @@ public abstract class AbstractAI implements Ctrl
}
catch (Exception e)
{
_log.warning(getClass().getSimpleName() + ": Error: " + e.getMessage());
LOGGER.warning(getClass().getSimpleName() + ": Error: " + e.getMessage());
}
}
}
@@ -159,10 +159,6 @@ public abstract class AbstractAI implements Ctrl
private static final int FOLLOW_INTERVAL = 1000;
private static final int ATTACK_FOLLOW_INTERVAL = 500;
/**
* Constructor of AbstractAI.
* @param creature the creature
*/
protected AbstractAI(L2Character creature)
{
_actor = creature;

View File

@@ -30,7 +30,7 @@ import com.l2jmobius.commons.concurrent.ThreadPool;
import com.l2jmobius.commons.util.Rnd;
import com.l2jmobius.gameserver.GameTimeController;
import com.l2jmobius.gameserver.data.sql.impl.TerritoryTable;
import com.l2jmobius.gameserver.datatables.SkillData;
import com.l2jmobius.gameserver.data.xml.impl.SkillData;
import com.l2jmobius.gameserver.enums.AISkillScope;
import com.l2jmobius.gameserver.enums.AIType;
import com.l2jmobius.gameserver.geoengine.GeoEngine;

View File

@@ -28,27 +28,25 @@ import com.l2jmobius.gameserver.network.serverpackets.VehicleStarted;
*/
public class L2BoatAI extends L2VehicleAI
{
public L2BoatAI(L2BoatInstance creature)
public L2BoatAI(L2BoatInstance boat)
{
super(creature);
super(boat);
}
@Override
protected void moveTo(int x, int y, int z)
{
if (_actor.isMovementDisabled())
if (!_actor.isMovementDisabled())
{
return;
if (!_clientMoving)
{
_actor.broadcastPacket(new VehicleStarted(getActor(), 1));
}
_clientMoving = true;
_actor.moveToLocation(x, y, z, 0);
_actor.broadcastPacket(new VehicleDeparture(getActor()));
}
if (!_clientMoving)
{
_actor.broadcastPacket(new VehicleStarted(getActor(), 1));
}
_clientMoving = true;
_actor.moveToLocation(x, y, z, 0);
_actor.broadcastPacket(new VehicleDeparture(getActor()));
}
@Override

View File

@@ -427,7 +427,7 @@ public class L2CharacterAI extends AbstractAI
setTarget(object);
if ((object.getX() == 0) && (object.getY() == 0))
{
_log.warning("Object in coords 0,0 - using a temporary fix");
LOGGER.warning("Object in coords 0,0 - using a temporary fix");
object.setXYZ(getActor().getX(), getActor().getY(), getActor().getZ() + 5);
}
@@ -919,7 +919,7 @@ public class L2CharacterAI extends AbstractAI
{
if (worldPosition == null)
{
_log.warning("maybeMoveToPosition: worldPosition == NULL!");
LOGGER.warning("maybeMoveToPosition: worldPosition == NULL!");
return false;
}
@@ -991,7 +991,7 @@ public class L2CharacterAI extends AbstractAI
// Get the distance between the current position of the L2Character and the target (x,y)
if (target == null)
{
_log.warning("maybeMoveToPawn: target == NULL!");
LOGGER.warning("maybeMoveToPawn: target == NULL!");
return false;
}
if (offset < 0)

View File

@@ -30,9 +30,9 @@ import com.l2jmobius.gameserver.model.skills.Skill;
*/
public class L2DoorAI extends L2CharacterAI
{
public L2DoorAI(L2DoorInstance creature)
public L2DoorAI(L2DoorInstance door)
{
super(creature);
super(door);
}
@Override

View File

@@ -32,12 +32,9 @@ import com.l2jmobius.gameserver.network.SystemMessageId;
*/
public abstract class L2PlayableAI extends L2CharacterAI
{
/**
* @param creature the creature
*/
public L2PlayableAI(L2Playable creature)
public L2PlayableAI(L2Playable playable)
{
super(creature);
super(playable);
}
@Override
@@ -84,7 +81,7 @@ public abstract class L2PlayableAI extends L2CharacterAI
@Override
protected void onIntentionCast(Skill skill, L2Object target)
{
if ((target instanceof L2Playable) && skill.isBad())
if ((target.isPlayable()) && skill.isBad())
{
if (target.getActingPlayer().isProtectionBlessingAffected() && ((_actor.getActingPlayer().getLevel() - target.getActingPlayer().getLevel()) >= 10) && (_actor.getActingPlayer().getKarma() > 0) && !target.isInsideZone(ZoneId.PVP))
{

View File

@@ -39,11 +39,11 @@ public class L2PlayerAI extends L2PlayableAI
{
private boolean _thinking; // to prevent recursive thinking
private IntentionCommand _nextIntention = null;
IntentionCommand _nextIntention = null;
public L2PlayerAI(L2PcInstance creature)
public L2PlayerAI(L2PcInstance player)
{
super(creature);
super(player);
}
void saveNextIntention(CtrlIntention intention, Object arg0, Object arg1)

View File

@@ -28,11 +28,11 @@ public abstract class L2VehicleAI extends L2CharacterAI
{
/**
* Simple AI for vehicles
* @param creature
* @param vehicle
*/
public L2VehicleAI(L2Vehicle creature)
public L2VehicleAI(L2Vehicle vehicle)
{
super(creature);
super(vehicle);
}
@Override

View File

@@ -34,7 +34,7 @@ import com.l2jmobius.gameserver.util.Util;
*/
public class HtmCache
{
private static final Logger _log = Logger.getLogger(HtmCache.class.getName());
private static final Logger LOGGER = Logger.getLogger(HtmCache.class.getName());
private static final HTMLFilter HTML_FILTER = new HTMLFilter();
@@ -57,23 +57,23 @@ public class HtmCache
{
if (!Config.LAZY_CACHE)
{
_log.info("Html cache start...");
LOGGER.info("Html cache start...");
parseDir(f);
_log.info("Cache[HTML]: " + String.format("%.3f", getMemoryUsage()) + " megabytes on " + getLoadedFiles() + " files loaded");
LOGGER.info("Cache[HTML]: " + String.format("%.3f", getMemoryUsage()) + " megabytes on " + getLoadedFiles() + " files loaded");
}
else
{
_cache.clear();
_loadedFiles = 0;
_bytesBuffLen = 0;
_log.info("Cache[HTML]: Running lazy cache");
LOGGER.info("Cache[HTML]: Running lazy cache");
}
}
public void reloadPath(File f)
{
parseDir(f);
_log.info("Cache[HTML]: Reloaded specified path.");
LOGGER.info("Cache[HTML]: Reloaded specified path.");
}
public double getMemoryUsage()
@@ -137,7 +137,7 @@ public class HtmCache
}
catch (Exception e)
{
_log.log(Level.WARNING, "Problem with htm file " + e.getMessage(), e);
LOGGER.log(Level.WARNING, "Problem with htm file " + e.getMessage(), e);
}
return content;
}
@@ -148,7 +148,7 @@ public class HtmCache
if (content == null)
{
content = "<html><body>My text is missing:<br>" + path + "</body></html>";
_log.warning("Cache[HTML]: Missing HTML page: " + path);
LOGGER.warning("Cache[HTML]: Missing HTML page: " + path);
}
return content;
}

View File

@@ -19,10 +19,10 @@ package com.l2jmobius.gameserver.communitybbs.BB;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.CopyOnWriteArrayList;
import java.util.logging.Level;
import java.util.logging.Logger;
@@ -30,9 +30,9 @@ import com.l2jmobius.commons.database.DatabaseFactory;
import com.l2jmobius.gameserver.communitybbs.Manager.ForumsBBSManager;
import com.l2jmobius.gameserver.communitybbs.Manager.TopicBBSManager;
public final class Forum
public class Forum
{
private static final Logger _log = Logger.getLogger(Forum.class.getName());
private static final Logger LOGGER = Logger.getLogger(Forum.class.getName());
// type
public static final int ROOT = 0;
@@ -46,7 +46,7 @@ public final class Forum
public static final int CLANMEMBERONLY = 2;
public static final int OWNERONLY = 3;
private final List<Forum> _children = new ArrayList<>();
private final List<Forum> _children;
private final Map<Integer, Topic> _topic = new ConcurrentHashMap<>();
private final int _forumId;
private String _forumName;
@@ -66,6 +66,7 @@ public final class Forum
{
_forumId = Forumid;
_fParent = FParent;
_children = new CopyOnWriteArrayList<>();
}
/**
@@ -84,6 +85,7 @@ public final class Forum
_forumPerm = perm;
_fParent = parent;
_ownerID = OwnerID;
_children = new CopyOnWriteArrayList<>();
parent._children.add(this);
ForumsBBSManager.getInstance().addForum(this);
_loaded = true;
@@ -109,7 +111,7 @@ public final class Forum
}
catch (Exception e)
{
_log.log(Level.WARNING, "Data error on Forum " + _forumId + " : " + e.getMessage(), e);
LOGGER.log(Level.WARNING, "Data error on Forum " + _forumId + " : " + e.getMessage(), e);
}
try (Connection con = DatabaseFactory.getInstance().getConnection();
@@ -131,7 +133,7 @@ public final class Forum
}
catch (Exception e)
{
_log.log(Level.WARNING, "Data error on Forum " + _forumId + " : " + e.getMessage(), e);
LOGGER.log(Level.WARNING, "Data error on Forum " + _forumId + " : " + e.getMessage(), e);
}
}
@@ -153,7 +155,7 @@ public final class Forum
}
catch (Exception e)
{
_log.log(Level.WARNING, "Data error on Forum (children): " + e.getMessage(), e);
LOGGER.log(Level.WARNING, "Data error on Forum (children): " + e.getMessage(), e);
}
}
@@ -229,18 +231,17 @@ public final class Forum
}
catch (Exception e)
{
_log.log(Level.WARNING, "Error while saving new Forum to db " + e.getMessage(), e);
LOGGER.log(Level.WARNING, "Error while saving new Forum to db " + e.getMessage(), e);
}
}
public void vload()
{
if (_loaded)
if (!_loaded)
{
return;
load();
getChildren();
_loaded = true;
}
load();
getChildren();
_loaded = true;
}
}

View File

@@ -19,8 +19,8 @@ package com.l2jmobius.gameserver.communitybbs.BB;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.CopyOnWriteArrayList;
import java.util.logging.Level;
import java.util.logging.Logger;
@@ -32,7 +32,7 @@ import com.l2jmobius.gameserver.communitybbs.Manager.PostBBSManager;
*/
public class Post
{
private static final Logger _log = Logger.getLogger(Post.class.getName());
private static Logger LOGGER = Logger.getLogger(Post.class.getName());
public static class CPost
{
@@ -45,7 +45,7 @@ public class Post
public String postTxt;
}
private final List<CPost> _post = new ArrayList<>();
private final List<CPost> _post;
/**
* @param _PostOwner
@@ -57,6 +57,7 @@ public class Post
*/
public Post(String _PostOwner, int _PostOwnerID, long date, int tid, int _PostForumID, String txt)
{
_post = new CopyOnWriteArrayList<>();
final CPost cp = new CPost();
cp.postId = 0;
cp.postOwner = _PostOwner;
@@ -69,11 +70,6 @@ public class Post
insertindb(cp);
}
public Post(Topic t)
{
load(t);
}
public void insertindb(CPost cp)
{
try (Connection con = DatabaseFactory.getInstance().getConnection();
@@ -90,13 +86,27 @@ public class Post
}
catch (Exception e)
{
_log.log(Level.WARNING, "Error while saving new Post to db " + e.getMessage(), e);
LOGGER.log(Level.WARNING, "Error while saving new Post to db " + e.getMessage(), e);
}
}
public Post(Topic t)
{
_post = new CopyOnWriteArrayList<>();
load(t);
}
public CPost getCPost(int id)
{
return _post.get(id);
int i = 0;
for (CPost cp : _post)
{
if (i++ == id)
{
return cp;
}
}
return null;
}
public void deleteme(Topic t)
@@ -111,7 +121,7 @@ public class Post
}
catch (Exception e)
{
_log.log(Level.WARNING, "Error while deleting post: " + e.getMessage(), e);
LOGGER.log(Level.WARNING, "Error while deleting post: " + e.getMessage(), e);
}
}
@@ -143,7 +153,7 @@ public class Post
}
catch (Exception e)
{
_log.log(Level.WARNING, "Data error on Post " + t.getForumID() + "/" + t.getID() + " : " + e.getMessage(), e);
LOGGER.log(Level.WARNING, "Data error on Post " + t.getForumID() + "/" + t.getID() + " : " + e.getMessage(), e);
}
}
@@ -152,10 +162,10 @@ public class Post
*/
public void updatetxt(int i)
{
final CPost cp = getCPost(i);
try (Connection con = DatabaseFactory.getInstance().getConnection();
PreparedStatement ps = con.prepareStatement("UPDATE posts SET post_txt=? WHERE post_id=? AND post_topic_id=? AND post_forum_id=?"))
{
final CPost cp = getCPost(i);
ps.setString(1, cp.postTxt);
ps.setInt(2, cp.postId);
ps.setInt(3, cp.postTopicId);
@@ -164,7 +174,7 @@ public class Post
}
catch (Exception e)
{
_log.log(Level.WARNING, "Error while saving new Post to db " + e.getMessage(), e);
LOGGER.log(Level.WARNING, "Error while saving new Post to db " + e.getMessage(), e);
}
}
}

View File

@@ -26,7 +26,7 @@ import com.l2jmobius.gameserver.communitybbs.Manager.TopicBBSManager;
public class Topic
{
private static final Logger _log = Logger.getLogger(Topic.class.getName());
private static final Logger LOGGER = Logger.getLogger(Topic.class.getName());
public static final int MORMAL = 0;
public static final int MEMO = 1;
@@ -86,7 +86,7 @@ public class Topic
}
catch (Exception e)
{
_log.log(Level.WARNING, "Error while saving new Topic to db " + e.getMessage(), e);
LOGGER.log(Level.WARNING, "Error while saving new Topic to db " + e.getMessage(), e);
}
}
@@ -138,7 +138,7 @@ public class Topic
}
catch (Exception e)
{
_log.log(Level.WARNING, "Error while deleting topic: " + e.getMessage(), e);
LOGGER.log(Level.WARNING, "Error while deleting topic: " + e.getMessage(), e);
}
}

View File

@@ -56,7 +56,7 @@ public abstract class BaseBBSManager
*/
protected void send1002(L2PcInstance activeChar, String string, String string2, String string3)
{
final List<String> _arg = new ArrayList<>();
final List<String> _arg = new ArrayList<>(20);
_arg.add("0");
_arg.add("0");
_arg.add("0");

View File

@@ -31,7 +31,7 @@ import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
public class ForumsBBSManager extends BaseBBSManager
{
private static Logger _log = Logger.getLogger(ForumsBBSManager.class.getName());
private final List<Forum> _table = new CopyOnWriteArrayList<>();
private final List<Forum> _table;
private int _lastid = 1;
/**
@@ -39,6 +39,7 @@ public class ForumsBBSManager extends BaseBBSManager
*/
protected ForumsBBSManager()
{
_table = new CopyOnWriteArrayList<>();
try (Connection con = DatabaseFactory.getInstance().getConnection();
Statement s = con.createStatement();
ResultSet rs = s.executeQuery("SELECT forum_id FROM forums WHERE forum_type = 0"))
@@ -50,7 +51,7 @@ public class ForumsBBSManager extends BaseBBSManager
}
catch (Exception e)
{
_log.log(Level.WARNING, "Data error on Forum (root): " + e.getMessage(), e);
_log.log(Level.WARNING, getClass().getSimpleName() + ": Data error on Forum (root): " + e.getMessage(), e);
}
}
@@ -60,7 +61,7 @@ public class ForumsBBSManager extends BaseBBSManager
public void initRoot()
{
_table.forEach(f -> f.vload());
_log.info("Loaded " + _table.size() + " forums. Last forum id used: " + _lastid);
_log.info(getClass().getSimpleName() + ": Loaded " + _table.size() + " forums. Last forum id used: " + _lastid);
}
/**
@@ -94,7 +95,14 @@ public class ForumsBBSManager extends BaseBBSManager
*/
public Forum getForumByName(String name)
{
return _table.stream().filter(f -> f.getName().equals(name)).findFirst().orElse(null);
for (Forum f : _table)
{
if (f.getName().equals(name))
{
return f;
}
}
return null;
}
/**
@@ -129,7 +137,14 @@ public class ForumsBBSManager extends BaseBBSManager
*/
public Forum getForumByID(int idf)
{
return _table.stream().filter(f -> f.getID() == idf).findFirst().orElse(null);
for (Forum f : _table)
{
if (f.getID() == idf)
{
return f;
}
}
return null;
}
@Override

View File

@@ -89,21 +89,14 @@ public class PostBBSManager extends BaseBBSManager
private void showEditPost(Topic topic, Forum forum, L2PcInstance activeChar, int idp)
{
if (topic == null)
final Post p = getGPosttByTopic(topic);
if ((forum == null) || (topic == null) || (p == null))
{
CommunityBoardHandler.separateAndSend("<html><body><br><br><center>Error: This topic does not exist!</center></body></html>", activeChar);
CommunityBoardHandler.separateAndSend("<html><body><br><br><center>Error, this forum, topic or post does not exist!</center><br><br></body></html>", activeChar);
}
else
{
final Post p = getGPosttByTopic(topic);
if ((forum == null) || (p == null))
{
CommunityBoardHandler.separateAndSend("<html><body><br><br><center>Error: This forum or post does not exist!</center></body></html>", activeChar);
}
else
{
showHtmlEditPost(topic, activeChar, forum, p);
}
showHtmlEditPost(topic, activeChar, forum, p);
}
}
@@ -132,10 +125,9 @@ public class PostBBSManager extends BaseBBSManager
private void showMemoPost(Topic topic, L2PcInstance activeChar, Forum forum)
{
//
Post p = getGPosttByTopic(topic);
Locale locale = Locale.getDefault();
DateFormat dateFormat = DateFormat.getDateInstance(DateFormat.FULL, locale);
final Post p = getGPosttByTopic(topic);
final Locale locale = Locale.getDefault();
final DateFormat dateFormat = DateFormat.getDateInstance(DateFormat.FULL, locale);
String mes = p.getCPost(0).postTxt.replace(">", "&gt;");
mes = mes.replace("<", "&lt;");

View File

@@ -19,10 +19,10 @@ package com.l2jmobius.gameserver.communitybbs.Manager;
import java.text.DateFormat;
import java.util.Calendar;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.StringTokenizer;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.CopyOnWriteArrayList;
import com.l2jmobius.gameserver.communitybbs.BB.Forum;
@@ -35,7 +35,7 @@ import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
public class TopicBBSManager extends BaseBBSManager
{
private final List<Topic> _table = new CopyOnWriteArrayList<>();
private final Map<Forum, Integer> _maxId = new HashMap<>();
private final Map<Forum, Integer> _maxId = new ConcurrentHashMap<>();
protected TopicBBSManager()
{
@@ -244,7 +244,7 @@ public class TopicBBSManager extends BaseBBSManager
{
break;
}
Topic t = forum.getTopic(j);
final Topic t = forum.getTopic(j);
if (t != null)
{
if (i++ >= (12 * (index - 1)))

View File

@@ -52,19 +52,21 @@ public class CharNameTable
public final void addName(L2PcInstance player)
{
if (player == null)
if (player != null)
{
return;
addName(player.getObjectId(), player.getName());
_accessLevels.put(player.getObjectId(), player.getAccessLevel().getLevel());
}
addName(player.getObjectId(), player.getName());
_accessLevels.put(player.getObjectId(), player.getAccessLevel().getLevel());
}
private final void addName(int objectId, String name)
{
if ((name != null) && !name.equals(_chars.get(objectId)))
if (name != null)
{
_chars.put(objectId, name);
if (!name.equals(_chars.get(objectId)))
{
_chars.put(objectId, name);
}
}
}
@@ -105,8 +107,8 @@ public class CharNameTable
{
while (rs.next())
{
id = rs.getInt(1);
accessLevel = rs.getInt(2);
id = rs.getInt("charId");
accessLevel = rs.getInt("accesslevel");
}
}
}
@@ -115,14 +117,14 @@ public class CharNameTable
_log.log(Level.WARNING, getClass().getSimpleName() + ": Could not check existing char name: " + e.getMessage(), e);
}
if (id <= 0)
if (id > 0)
{
return -1; // not found
_chars.put(id, name);
_accessLevels.put(id, accessLevel);
return id;
}
_chars.put(id, name);
_accessLevels.put(id, accessLevel);
return id;
return -1; // not found
}
public final String getNameById(int id)
@@ -151,9 +153,9 @@ public class CharNameTable
{
if (rset.next())
{
name = rset.getString(1);
name = rset.getString("char_name");
_chars.put(id, name);
_accessLevels.put(id, rset.getInt(2));
_accessLevels.put(id, rset.getInt("accesslevel"));
return name;
}
}
@@ -173,14 +175,17 @@ public class CharNameTable
public synchronized boolean doesCharNameExist(String name)
{
boolean result = true;
boolean result = false;
try (Connection con = DatabaseFactory.getInstance().getConnection();
PreparedStatement ps = con.prepareStatement("SELECT account_name FROM characters WHERE char_name=?"))
PreparedStatement ps = con.prepareStatement("SELECT COUNT(*) as count FROM characters WHERE char_name=?"))
{
ps.setString(1, name);
try (ResultSet rs = ps.executeQuery())
{
result = rs.next();
if (rs.next())
{
result = rs.getInt("count") > 0;
}
}
}
catch (SQLException e)
@@ -193,20 +198,20 @@ public class CharNameTable
public int getAccountCharacterCount(String account)
{
try (Connection con = DatabaseFactory.getInstance().getConnection();
PreparedStatement ps = con.prepareStatement("SELECT COUNT(char_name) FROM characters WHERE account_name=?"))
PreparedStatement ps = con.prepareStatement("SELECT COUNT(char_name) as count FROM characters WHERE account_name=?"))
{
ps.setString(1, account);
try (ResultSet rset = ps.executeQuery())
{
while (rset.next())
if (rset.next())
{
return rset.getInt(1);
return rset.getInt("count");
}
}
}
catch (SQLException e)
{
_log.log(Level.WARNING, getClass().getSimpleName() + ": Could not check existing char count: " + e.getMessage(), e);
_log.log(Level.WARNING, "Couldn't retrieve account for id: " + e.getMessage(), e);
}
return 0;
}
@@ -219,14 +224,14 @@ public class CharNameTable
{
while (rs.next())
{
final int id = rs.getInt(1);
_chars.put(id, rs.getString(2));
_accessLevels.put(id, rs.getInt(3));
final int id = rs.getInt("charId");
_chars.put(id, rs.getString("char_name"));
_accessLevels.put(id, rs.getInt("accesslevel"));
}
}
catch (SQLException e)
{
_log.log(Level.WARNING, getClass().getSimpleName() + ": Could not load char name: " + e.getMessage(), e);
_log.log(Level.WARNING, getClass().getSimpleName() + ": Couldn't retrieve all char id/name/access: " + e.getMessage(), e);
}
_log.info(getClass().getSimpleName() + ": Loaded " + _chars.size() + " char names.");
}

View File

@@ -29,7 +29,7 @@ import com.l2jmobius.Config;
import com.l2jmobius.commons.database.DatabaseFactory;
import com.l2jmobius.gameserver.data.xml.impl.NpcData;
import com.l2jmobius.gameserver.data.xml.impl.PetDataTable;
import com.l2jmobius.gameserver.datatables.SkillData;
import com.l2jmobius.gameserver.data.xml.impl.SkillData;
import com.l2jmobius.gameserver.model.L2PetData;
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
import com.l2jmobius.gameserver.model.actor.instance.L2PetInstance;

View File

@@ -67,7 +67,7 @@ import com.l2jmobius.gameserver.util.Util;
*/
public class ClanTable
{
private static final Logger _log = Logger.getLogger(ClanTable.class.getName());
private static final Logger LOGGER = Logger.getLogger(ClanTable.class.getName());
private final Map<Integer, L2Clan> _clans = new ConcurrentHashMap<>();
protected ClanTable()
@@ -99,9 +99,9 @@ public class ClanTable
}
catch (Exception e)
{
_log.log(Level.SEVERE, "Error restoring ClanTable.", e);
LOGGER.log(Level.SEVERE, "Error restoring ClanTable.", e);
}
_log.info(getClass().getSimpleName() + ": Restored " + clanCount + " clans from the database.");
LOGGER.info(getClass().getSimpleName() + ": Restored " + clanCount + " clans from the database.");
allianceCheck();
restorewars();
}
@@ -331,7 +331,7 @@ public class ClanTable
}
catch (Exception e)
{
_log.log(Level.SEVERE, getClass().getSimpleName() + ": Error removing clan from DB.", e);
LOGGER.log(Level.SEVERE, getClass().getSimpleName() + ": Error removing clan from DB.", e);
}
// Notify to scripts
@@ -387,7 +387,7 @@ public class ClanTable
}
catch (Exception e)
{
_log.log(Level.SEVERE, getClass().getSimpleName() + ": Error storing clan wars data.", e);
LOGGER.log(Level.SEVERE, getClass().getSimpleName() + ": Error storing clan wars data.", e);
}
// SystemMessage msg = SystemMessage.getSystemMessage(SystemMessageId.WAR_WITH_THE_S1_CLAN_HAS_BEGUN);
@@ -425,7 +425,7 @@ public class ClanTable
}
catch (Exception e)
{
_log.log(Level.SEVERE, getClass().getSimpleName() + ": Error removing clan wars data.", e);
LOGGER.log(Level.SEVERE, getClass().getSimpleName() + ": Error removing clan wars data.", e);
}
// SystemMessage msg = SystemMessage.getSystemMessage(SystemMessageId.WAR_WITH_THE_S1_CLAN_HAS_ENDED);
@@ -473,13 +473,13 @@ public class ClanTable
}
else
{
_log.log(Level.WARNING, getClass().getSimpleName() + ": restorewars one of clans is null clan1:" + clan1 + " clan2:" + clan2);
LOGGER.log(Level.WARNING, getClass().getSimpleName() + ": restorewars one of clans is null clan1:" + clan1 + " clan2:" + clan2);
}
}
}
catch (Exception e)
{
_log.log(Level.SEVERE, getClass().getSimpleName() + ": Error restoring clan wars data.", e);
LOGGER.log(Level.SEVERE, getClass().getSimpleName() + ": Error restoring clan wars data.", e);
}
}
@@ -497,7 +497,7 @@ public class ClanTable
clan.setAllyName(null);
clan.changeAllyCrest(0, true);
clan.updateClanInDB();
_log.info(getClass().getSimpleName() + ": Removed alliance from clan: " + clan);
LOGGER.info(getClass().getSimpleName() + ": Removed alliance from clan: " + clan);
}
}
}
@@ -518,11 +518,11 @@ public class ClanTable
return clanAllies;
}
public void storeClanScore()
public void shutdown()
{
for (L2Clan clan : _clans.values())
{
clan.updateClanScoreInDB();
clan.updateInDB();
}
}

View File

@@ -36,7 +36,6 @@ import org.w3c.dom.Node;
import com.l2jmobius.Config;
import com.l2jmobius.commons.util.IGameXmlReader;
import com.l2jmobius.gameserver.datatables.ItemTable;
import com.l2jmobius.gameserver.datatables.SkillData;
import com.l2jmobius.gameserver.enums.AISkillScope;
import com.l2jmobius.gameserver.enums.DropType;
import com.l2jmobius.gameserver.model.StatsSet;

View File

@@ -28,7 +28,6 @@ import org.w3c.dom.NamedNodeMap;
import org.w3c.dom.Node;
import com.l2jmobius.commons.util.IGameXmlReader;
import com.l2jmobius.gameserver.datatables.SkillData;
import com.l2jmobius.gameserver.model.actor.L2Summon;
import com.l2jmobius.gameserver.model.holders.SkillHolder;
@@ -106,7 +105,7 @@ public class PetSkillData implements IGameXmlReader
{
continue;
}
if (skillHolder.getSkillLvl() == 0)
if (skillHolder.getSkillLevel() == 0)
{
if (pet.getLevel() < 70)
{
@@ -131,9 +130,9 @@ public class PetSkillData implements IGameXmlReader
}
else if (1 <= pet.getLevel())
{
if (skillHolder.getSkillLvl() > lvl)
if (skillHolder.getSkillLevel() > lvl)
{
lvl = skillHolder.getSkillLvl();
lvl = skillHolder.getSkillLevel();
}
}
}

View File

@@ -14,7 +14,7 @@
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.l2jmobius.gameserver.datatables;
package com.l2jmobius.gameserver.data.xml.impl;
import java.util.HashMap;
import java.util.HashSet;
@@ -22,7 +22,6 @@ import java.util.Map;
import java.util.Set;
import java.util.logging.Logger;
import com.l2jmobius.gameserver.data.xml.impl.SkillTreesData;
import com.l2jmobius.gameserver.engines.DocumentEngine;
import com.l2jmobius.gameserver.model.skills.Skill;

View File

@@ -34,7 +34,6 @@ import org.w3c.dom.Node;
import com.l2jmobius.Config;
import com.l2jmobius.commons.util.IGameXmlReader;
import com.l2jmobius.gameserver.datatables.SkillData;
import com.l2jmobius.gameserver.enums.Race;
import com.l2jmobius.gameserver.model.L2Clan;
import com.l2jmobius.gameserver.model.L2SkillLearn;

View File

@@ -38,6 +38,7 @@ import org.xml.sax.helpers.DefaultHandler;
import com.l2jmobius.Config;
import com.l2jmobius.commons.concurrent.ThreadPool;
import com.l2jmobius.commons.database.DatabaseFactory;
import com.l2jmobius.gameserver.data.xml.impl.SkillData;
import com.l2jmobius.gameserver.model.L2Clan;
import com.l2jmobius.gameserver.model.L2Object;
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
@@ -95,7 +96,7 @@ public final class BotReportTable
}
catch (Exception e)
{
LOGGER.log(Level.WARNING, "BotReportTable: Could not load punishments from /config/BotReportPunishments.xml", e);
LOGGER.log(Level.WARNING, getClass().getSimpleName() + ": Could not load punishments from /config/BotReportPunishments.xml", e);
}
loadReportedCharData();
@@ -130,7 +131,6 @@ public final class BotReportTable
}
catch (Exception e)
{
}
while (rset.next())
@@ -165,11 +165,11 @@ public final class BotReportTable
}
}
LOGGER.info("BotReportTable: Loaded " + _reports.size() + " bot reports");
LOGGER.info(getClass().getSimpleName() + ": Loaded " + _reports.size() + " bot reports");
}
catch (Exception e)
{
LOGGER.log(Level.WARNING, "BotReportTable: Could not load reported char data!", e);
LOGGER.log(Level.WARNING, getClass().getSimpleName() + ": Could not load reported char data!", e);
}
}
@@ -187,19 +187,18 @@ public final class BotReportTable
for (Map.Entry<Integer, ReportedCharData> entrySet : _reports.entrySet())
{
final Map<Integer, Long> reportTable = entrySet.getValue()._reporters;
for (int reporterId : reportTable.keySet())
for (int reporterId : entrySet.getValue()._reporters.keySet())
{
ps.setInt(1, entrySet.getKey());
ps.setInt(2, reporterId);
ps.setLong(3, reportTable.get(reporterId));
ps.setLong(3, entrySet.getValue()._reporters.get(reporterId));
ps.execute();
}
}
}
catch (Exception e)
{
LOGGER.log(Level.SEVERE, "BotReportTable: Could not update reported char data in database!", e);
LOGGER.log(Level.SEVERE, getClass().getSimpleName() + ": Could not update reported char data in database!", e);
}
}
@@ -211,7 +210,6 @@ public final class BotReportTable
public boolean reportBot(L2PcInstance reporter)
{
final L2Object target = reporter.getTarget();
if (target == null)
{
return false;
@@ -321,11 +319,11 @@ public final class BotReportTable
}
SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.C1_WAS_REPORTED_AS_A_BOT);
sm.addCharName(bot);
sm.addString(bot.getName());
reporter.sendPacket(sm);
sm = SystemMessage.getSystemMessage(SystemMessageId.YOU_HAVE_USED_A_REPORT_POINT_ON_C1_YOU_HAVE_S2_POINTS_REMAINING_ON_THIS_ACCOUNT);
sm.addCharName(bot);
sm.addString(bot.getName());
sm.addInt(rcdRep.getPointsLeft());
reporter.sendPacket(sm);
@@ -391,7 +389,7 @@ public final class BotReportTable
}
else
{
LOGGER.warning("BotReportTable: Could not add punishment for " + neededReports + " report(s): Skill " + skillId + "-" + skillLevel + " does not exist!");
LOGGER.warning(getClass().getSimpleName() + ": Could not add punishment for " + neededReports + " report(s): Skill " + skillId + "-" + skillLevel + " does not exist!");
}
}
@@ -427,7 +425,7 @@ public final class BotReportTable
catch (Exception e)
{
ThreadPool.schedule(new ResetPointTask(), 24 * 3600 * 1000);
LOGGER.log(Level.WARNING, "BotReportTable: Could not properly schedule bot report points reset task. Scheduled in 24 hours.", e);
LOGGER.log(Level.WARNING, getClass().getSimpleName() + ": Could not properly schedule bot report points reset task. Scheduled in 24 hours.", e);
}
}

View File

@@ -16,9 +16,10 @@
*/
package com.l2jmobius.gameserver.datatables;
import java.util.ArrayList;
import java.util.Date;
import java.util.LinkedList;
import java.util.List;
import java.util.concurrent.CopyOnWriteArrayList;
import com.l2jmobius.gameserver.script.DateRange;
import com.l2jmobius.gameserver.script.EventDrop;
@@ -34,7 +35,7 @@ public class EventDroplist
/**
* The table containing all DataDrop object
*/
private static final List<DateDrop> ALL_NPC_DATE_DROPS = new ArrayList<>();
private static final List<DateDrop> ALL_NPC_DATE_DROPS = new CopyOnWriteArrayList<>();
public static class DateDrop
{
@@ -103,7 +104,7 @@ public class EventDroplist
*/
public List<DateDrop> getAllDrops()
{
final List<DateDrop> list = new ArrayList<>();
final List<DateDrop> list = new LinkedList<>();
final Date currentDate = new Date();
for (DateDrop drop : ALL_NPC_DATE_DROPS)
{

View File

@@ -63,7 +63,6 @@ public class ItemTable
private final Map<Integer, L2EtcItem> _etcItems = new HashMap<>();
private final Map<Integer, L2Armor> _armors = new HashMap<>();
private final Map<Integer, L2Weapon> _weapons = new HashMap<>();
static
{
SLOTS.put("shirt", L2Item.SLOT_UNDERWEAR);
@@ -143,10 +142,10 @@ public class ItemTable
}
}
buildFastLookupTable(highest);
LOGGER.log(Level.INFO, getClass().getSimpleName() + ": Loaded: " + _etcItems.size() + " Etc Items");
LOGGER.log(Level.INFO, getClass().getSimpleName() + ": Loaded: " + _armors.size() + " Armor Items");
LOGGER.log(Level.INFO, getClass().getSimpleName() + ": Loaded: " + _weapons.size() + " Weapon Items");
LOGGER.log(Level.INFO, getClass().getSimpleName() + ": Loaded: " + (_etcItems.size() + _armors.size() + _weapons.size()) + " Items in total.");
LOGGER.info(getClass().getSimpleName() + ": Loaded: " + _etcItems.size() + " Etc Items");
LOGGER.info(getClass().getSimpleName() + ": Loaded: " + _armors.size() + " Armor Items");
LOGGER.info(getClass().getSimpleName() + ": Loaded: " + _weapons.size() + " Weapon Items");
LOGGER.info(getClass().getSimpleName() + ": Loaded: " + (_etcItems.size() + _armors.size() + _weapons.size()) + " Items in total.");
}
/**
@@ -156,7 +155,7 @@ public class ItemTable
private void buildFastLookupTable(int size)
{
// Create a FastLookUp Table called _allTemplates of size : value of the highest item ID
LOGGER.info(getClass().getSimpleName() + ": Highest item id used:" + size);
LOGGER.info(getClass().getSimpleName() + ": Highest item id used: " + size);
_allTemplates = new L2Item[size + 1];
// Insert armor item in Fast Look Up Table
@@ -364,7 +363,7 @@ public class ItemTable
}
catch (Exception e)
{
LOGGER.log(Level.WARNING, "could not delete pet objectid:", e);
LOGGER.log(Level.WARNING, getClass().getSimpleName() + ": Could not delete pet objectid:", e);
}
}
}

View File

@@ -17,14 +17,14 @@
package com.l2jmobius.gameserver.engines;
import java.io.File;
import java.util.ArrayList;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import java.util.logging.Logger;
import com.l2jmobius.Config;
import com.l2jmobius.commons.util.file.filter.XMLFilter;
import com.l2jmobius.gameserver.datatables.SkillData;
import com.l2jmobius.gameserver.data.xml.impl.SkillData;
import com.l2jmobius.gameserver.engines.items.DocumentItem;
import com.l2jmobius.gameserver.engines.skills.DocumentSkill;
import com.l2jmobius.gameserver.model.items.L2Item;
@@ -35,10 +35,10 @@ import com.l2jmobius.gameserver.model.skills.Skill;
*/
public class DocumentEngine
{
private static final Logger _log = Logger.getLogger(DocumentEngine.class.getName());
private static final Logger LOGGER = Logger.getLogger(DocumentEngine.class.getName());
private final List<File> _itemFiles = new ArrayList<>();
private final List<File> _skillFiles = new ArrayList<>();
private final List<File> _itemFiles = new LinkedList<>();
private final List<File> _skillFiles = new LinkedList<>();
public static DocumentEngine getInstance()
{
@@ -64,17 +64,13 @@ public class DocumentEngine
final File dir = new File(Config.DATAPACK_ROOT, dirname);
if (!dir.exists())
{
_log.warning("Dir " + dir.getAbsolutePath() + " not exists");
LOGGER.warning("Dir " + dir.getAbsolutePath() + " not exists");
return;
}
final File[] files = dir.listFiles(new XMLFilter());
if (files != null)
for (File f : files)
{
for (File f : files)
{
hash.add(f);
}
hash.add(f);
}
}
@@ -82,7 +78,7 @@ public class DocumentEngine
{
if (file == null)
{
_log.warning("Skill file not found.");
LOGGER.warning("Skill file not found.");
return null;
}
final DocumentSkill doc = new DocumentSkill(file);
@@ -106,7 +102,7 @@ public class DocumentEngine
count++;
}
}
_log.info(getClass().getSimpleName() + ": Loaded " + count + " Skill templates from XML files.");
LOGGER.info(getClass().getSimpleName() + ": Loaded " + count + " Skill templates from XML files.");
}
/**
@@ -115,7 +111,7 @@ public class DocumentEngine
*/
public List<L2Item> loadItems()
{
final List<L2Item> list = new ArrayList<>();
final List<L2Item> list = new LinkedList<>();
for (File f : _itemFiles)
{
final DocumentItem document = new DocumentItem(f);

View File

@@ -22,6 +22,6 @@ package com.l2jmobius.gameserver.enums;
public enum InstanceReenterType
{
NONE,
ON_INSTANCE_ENTER,
ON_INSTANCE_FINISH,
ON_ENTER,
ON_FINISH,
}

View File

@@ -297,7 +297,7 @@ public class GeoEngine
final ABlock block = getBlock(geoX, geoY);
if (block == null) // null block check
{
// TODO: Find when this can be null.
// TODO: Find when this can be null. (Bad geodata? Check L2World getRegion method.)
// _log.warning("Could not find geodata block at " + getWorldX(geoX) + ", " + getWorldY(geoY) + ".");
return false;
}

View File

@@ -158,7 +158,7 @@ public final class HandysBlockCheckerManager
if (_arenaPlayers[i].getAllPlayers().contains(player))
{
final SystemMessage msg = SystemMessage.getSystemMessage(SystemMessageId.C1_IS_ALREADY_REGISTERED_ON_THE_MATCH_WAITING_LIST);
msg.addCharName(player);
msg.addString(player.getName());
player.sendPacket(msg);
return false;
}

View File

@@ -28,8 +28,8 @@ import org.w3c.dom.NodeList;
import com.l2jmobius.Config;
import com.l2jmobius.commons.util.IGameXmlReader;
import com.l2jmobius.gameserver.cache.HtmCache;
import com.l2jmobius.gameserver.data.xml.impl.SkillData;
import com.l2jmobius.gameserver.datatables.ItemTable;
import com.l2jmobius.gameserver.datatables.SkillData;
import com.l2jmobius.gameserver.enums.PrivateStoreType;
import com.l2jmobius.gameserver.handler.CommunityBoardHandler;
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
@@ -422,7 +422,7 @@ public final class SellBuffsManager implements IGameXmlReader
}
else if (player.isMounted() || player.isFlyingMounted() || player.isFlying())
{
player.sendMessage("You can't sell buffs in Mounth state!");
player.sendMessage("You can't sell buffs in Mount state!");
return false;
}
else if (player.isTransformed())

View File

@@ -30,7 +30,7 @@ import java.util.logging.Logger;
import com.l2jmobius.Config;
import com.l2jmobius.commons.database.DatabaseFactory;
import com.l2jmobius.commons.util.PropertiesParser;
import com.l2jmobius.gameserver.datatables.SkillData;
import com.l2jmobius.gameserver.data.xml.impl.SkillData;
import com.l2jmobius.gameserver.model.L2Clan;
import com.l2jmobius.gameserver.model.L2Object;
import com.l2jmobius.gameserver.model.Location;

View File

@@ -36,8 +36,8 @@ import com.l2jmobius.commons.concurrent.ThreadPool;
import com.l2jmobius.commons.database.DatabaseFactory;
import com.l2jmobius.commons.util.PropertiesParser;
import com.l2jmobius.gameserver.data.sql.impl.ClanTable;
import com.l2jmobius.gameserver.data.xml.impl.SkillData;
import com.l2jmobius.gameserver.data.xml.impl.SkillTreesData;
import com.l2jmobius.gameserver.datatables.SkillData;
import com.l2jmobius.gameserver.model.L2Clan;
import com.l2jmobius.gameserver.model.L2SiegeClan;
import com.l2jmobius.gameserver.model.L2SkillLearn;

View File

@@ -27,7 +27,7 @@ import com.l2jmobius.gameserver.network.serverpackets.SystemMessage;
public class CombatFlag
{
// private static final Logger _log = Logger.getLogger(CombatFlag.class.getName());
// private static final Logger LOGGER = Logger.getLogger(CombatFlag.class.getName());
private L2PcInstance _player = null;
private int _playerId = 0;

View File

@@ -27,8 +27,8 @@ import com.l2jmobius.Config;
import com.l2jmobius.commons.concurrent.ThreadPool;
import com.l2jmobius.commons.database.DatabaseFactory;
import com.l2jmobius.commons.util.Rnd;
import com.l2jmobius.gameserver.data.xml.impl.SkillData;
import com.l2jmobius.gameserver.data.xml.impl.TransformData;
import com.l2jmobius.gameserver.datatables.SkillData;
import com.l2jmobius.gameserver.instancemanager.CursedWeaponsManager;
import com.l2jmobius.gameserver.model.L2Party.MessageType;
import com.l2jmobius.gameserver.model.actor.L2Attackable;

View File

@@ -28,7 +28,7 @@ public class L2AccessLevel
/** The access level name. */
private String _name = null;
/** Child access levels. */
private L2AccessLevel _childsAccessLevel = null;
L2AccessLevel _childsAccessLevel = null;
/** Child access levels. */
private int _child = 0;
/** The name color for the access level. */
@@ -87,8 +87,9 @@ public class L2AccessLevel
}
/**
* Gets the access level.
* @return the access level
* Returns the access level<br>
* <br>
* @return int: access level<br>
*/
public int getLevel()
{
@@ -96,8 +97,9 @@ public class L2AccessLevel
}
/**
* Gets the access level name.
* @return the access level name
* Returns the access level name<br>
* <br>
* @return String: access level name<br>
*/
public String getName()
{
@@ -105,8 +107,9 @@ public class L2AccessLevel
}
/**
* Gets the name color of the access level.
* @return the name color for the access level
* Returns the name color of the access level<br>
* <br>
* @return int: the name color for the access level<br>
*/
public int getNameColor()
{
@@ -114,8 +117,9 @@ public class L2AccessLevel
}
/**
* Gets the title color color of the access level.
* @return the title color for the access level
* Returns the title color color of the access level<br>
* <br>
* @return int: the title color for the access level<br>
*/
public int getTitleColor()
{
@@ -123,8 +127,9 @@ public class L2AccessLevel
}
/**
* Verifies if the access level has GM access or not.
* @return {@code true} if access level have GM access, otherwise {@code false}
* Retuns if the access level has gm access or not<br>
* <br>
* @return boolean: true if access level have gm access, otherwise false<br>
*/
public boolean isGm()
{
@@ -132,8 +137,9 @@ public class L2AccessLevel
}
/**
* Verifies if the access level is allowed to attack in peace zone or not.
* @return {@code true} if the access level is allowed to attack in peace zone, otherwise {@code false}
* Returns if the access level is allowed to attack in peace zone or not<br>
* <br>
* @return boolean: true if the access level is allowed to attack in peace zone, otherwise false<br>
*/
public boolean allowPeaceAttack()
{
@@ -141,8 +147,9 @@ public class L2AccessLevel
}
/**
* Verifies if the access level is allowed to use fixed resurrection or not.
* @return {@ode true} if the access level is allowed to use fixed resurrection, otherwise {@code false}
* Retruns if the access level is allowed to use fixed res or not<br>
* <br>
* @return true if the access level is allowed to use fixed res, otherwise false<br>
*/
public boolean allowFixedRes()
{
@@ -150,8 +157,9 @@ public class L2AccessLevel
}
/**
* Verifies if the access level is allowed to perform transactions or not.
* @return {@ode true} if access level is allowed to perform transactions, otherwise {@code false}
* Returns if the access level is allowed to perform transactions or not<br>
* <br>
* @return boolean: true if access level is allowed to perform transactions, otherwise false<br>
*/
public boolean allowTransaction()
{
@@ -159,8 +167,9 @@ public class L2AccessLevel
}
/**
* Verifies if the access level is allowed to use AltG commands or not.
* @return {@ode true} if access level is allowed to use AltG commands, otherwise {@code false}
* Returns if the access level is allowed to use AltG commands or not<br>
* <br>
* @return boolean: true if access level is allowed to use AltG commands, otherwise false<br>
*/
public boolean allowAltG()
{
@@ -168,8 +177,9 @@ public class L2AccessLevel
}
/**
* Verifies if the access level can give damage or not.
* @return {@ode true} if the access level can give damage, otherwise {@code false}
* Returns if the access level can give damage or not<br>
* <br>
* @return boolean: true if the access level can give damage, otherwise false<br>
*/
public boolean canGiveDamage()
{
@@ -177,8 +187,9 @@ public class L2AccessLevel
}
/**
* Verifies if the access level can take aggro or not.
* @return {@ode true} if the access level can take aggro, otherwise {@code false}
* Returns if the access level can take aggro or not<br>
* <br>
* @return boolean: true if the access level can take aggro, otherwise false<br>
*/
public boolean canTakeAggro()
{
@@ -186,8 +197,9 @@ public class L2AccessLevel
}
/**
* Verifies if the access level can gain exp or not.
* @return {@ode true} if the access level can gain exp, otherwise {@code false}
* Returns if the access level can gain exp or not<br>
* <br>
* @return boolean: true if the access level can gain exp, otherwise false<br>
*/
public boolean canGainExp()
{
@@ -195,9 +207,9 @@ public class L2AccessLevel
}
/**
* Returns if the access level contains allowedAccess as child.
* @param accessLevel the parent access level
* @return {@ode true} if a child access level is equals to allowedAccess, otherwise {@code false}
* Returns if the access level contains allowedAccess as child<br>
* @param accessLevel as AccessLevel<br>
* @return boolean: true if a child access level is equals to allowedAccess, otherwise false<br>
*/
public boolean hasChildAccess(L2AccessLevel accessLevel)
{
@@ -210,6 +222,6 @@ public class L2AccessLevel
_childsAccessLevel = AdminData.getInstance().getAccessLevel(_child);
}
return (_childsAccessLevel.getLevel() == accessLevel.getLevel()) || _childsAccessLevel.hasChildAccess(accessLevel);
return (_childsAccessLevel != null) && ((_childsAccessLevel.getLevel() == accessLevel.getLevel()) || _childsAccessLevel.hasChildAccess(accessLevel));
}
}

View File

@@ -56,7 +56,7 @@ public class L2AdminCommandAccessRight
public boolean hasAccess(L2AccessLevel characterAccessLevel)
{
final L2AccessLevel accessLevel = AdminData.getInstance().getAccessLevel(_accessLevel);
return ((accessLevel.getLevel() == characterAccessLevel.getLevel()) || characterAccessLevel.hasChildAccess(accessLevel));
return (accessLevel != null) && ((accessLevel.getLevel() == characterAccessLevel.getLevel()) || characterAccessLevel.hasChildAccess(accessLevel));
}
/**

View File

@@ -40,7 +40,7 @@ import com.l2jmobius.gameserver.communitybbs.Manager.ForumsBBSManager;
import com.l2jmobius.gameserver.data.sql.impl.CharNameTable;
import com.l2jmobius.gameserver.data.sql.impl.ClanTable;
import com.l2jmobius.gameserver.data.sql.impl.CrestTable;
import com.l2jmobius.gameserver.datatables.SkillData;
import com.l2jmobius.gameserver.data.xml.impl.SkillData;
import com.l2jmobius.gameserver.instancemanager.CastleManager;
import com.l2jmobius.gameserver.instancemanager.FortManager;
import com.l2jmobius.gameserver.instancemanager.SiegeManager;
@@ -930,7 +930,7 @@ public class L2Clan implements IIdentifiable, INamable
/**
* Store in database current clan's reputation.
*/
public void updateClanScoreInDB()
public void updateInDB()
{
try (Connection con = DatabaseFactory.getInstance().getConnection();
PreparedStatement ps = con.prepareStatement("UPDATE clan_data SET reputation_score=? WHERE clan_id=?"))
@@ -1723,7 +1723,7 @@ public class L2Clan implements IIdentifiable, INamable
public static class RankPrivs
{
private final int _rankId;
private final int _party;// TODO find out what this stuff means and implement it
private final int _party; // TODO find out what this stuff means and implement it
private final EnumIntBitmask<ClanPrivilege> _rankPrivs;
public RankPrivs(int rank, int party, int privs)
@@ -1825,6 +1825,11 @@ public class L2Clan implements IIdentifiable, INamable
*/
public final SubPledge[] getAllSubPledges()
{
if (_subPledges == null)
{
return new SubPledge[0];
}
return _subPledges.values().toArray(new SubPledge[_subPledges.values().size()]);
}
@@ -1899,7 +1904,7 @@ public class L2Clan implements IIdentifiable, INamable
{
if (_subPledges.get(pledgeType) != null)
{
// _log.warning("found sub-unit with id: "+pledgeType);
// LOGGER.warning("found sub-unit with id: "+pledgeType);
switch (pledgeType)
{
case SUBUNIT_ACADEMY:
@@ -1963,15 +1968,15 @@ public class L2Clan implements IIdentifiable, INamable
{
// Retrieve all skills of this L2PcInstance from the database
ps.setInt(1, getId());
// _log.warning("clanPrivs restore for ClanId : "+getClanId());
try (ResultSet rs = ps.executeQuery())
// LOGGER.warning("clanPrivs restore for ClanId : "+getClanId());
try (ResultSet rset = ps.executeQuery())
{
// Go though the recordset of this SQL query
while (rs.next())
while (rset.next())
{
final int rank = rs.getInt("rank");
final int rank = rset.getInt("rank");
// int party = rset.getInt("party");
final int privileges = rs.getInt("privs");
final int privileges = rset.getInt("privs");
// Create a SubPledge object for each record
if (rank == -1)
{
@@ -2133,7 +2138,7 @@ public class L2Clan implements IIdentifiable, INamable
broadcastToOnlineMembers(new PledgeShowInfoUpdate(this));
if (save)
{
updateClanScoreInDB();
updateInDB();
}
}

View File

@@ -32,7 +32,7 @@ import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
*/
public class L2ClanMember
{
private static final Logger _log = Logger.getLogger(L2ClanMember.class.getName());
private static final Logger LOGGER = Logger.getLogger(L2ClanMember.class.getName());
private final L2Clan _clan;
private int _objectId;
@@ -241,7 +241,7 @@ public class L2ClanMember
}
catch (Exception e)
{
_log.log(Level.WARNING, "Could not update pledge type: " + e.getMessage(), e);
LOGGER.log(Level.WARNING, "Could not update pledge type: " + e.getMessage(), e);
}
}
@@ -286,7 +286,7 @@ public class L2ClanMember
}
catch (Exception e)
{
_log.log(Level.WARNING, "Could not update power _grade: " + e.getMessage(), e);
LOGGER.log(Level.WARNING, "Could not update power _grade: " + e.getMessage(), e);
}
}
@@ -798,7 +798,7 @@ public class L2ClanMember
}
catch (SQLException e)
{
_log.log(Level.WARNING, "Could not save apprentice/sponsor: " + e.getMessage(), e);
LOGGER.log(Level.WARNING, "Could not save apprentice/sponsor: " + e.getMessage(), e);
}
}
}

View File

@@ -117,18 +117,17 @@ public class L2CommandChannel extends AbstractPlayerGroup
*/
public void disbandChannel()
{
if (_parties == null)
if (_parties != null)
{
return;
}
for (L2Party party : _parties)
{
if (party != null)
for (L2Party party : _parties)
{
removeParty(party);
if (party != null)
{
removeParty(party);
}
}
_parties.clear();
}
_parties.clear();
}
/**
@@ -195,7 +194,11 @@ public class L2CommandChannel extends AbstractPlayerGroup
*/
public boolean meetRaidWarCondition(L2Object obj)
{
return (obj instanceof L2Character) && ((L2Character) obj).isRaid() && (getMemberCount() >= Config.LOOT_RAIDS_PRIVILEGE_CC_SIZE);
if (!((obj instanceof L2Character) && ((L2Character) obj).isRaid()))
{
return false;
}
return (getMemberCount() >= Config.LOOT_RAIDS_PRIVILEGE_CC_SIZE);
}
/**

View File

@@ -19,8 +19,8 @@ package com.l2jmobius.gameserver.model;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.util.List;
import java.util.concurrent.CopyOnWriteArrayList;
import java.util.Set;
import java.util.concurrent.ConcurrentHashMap;
import java.util.logging.Level;
import java.util.logging.Logger;
@@ -39,9 +39,10 @@ import com.l2jmobius.gameserver.network.serverpackets.SystemMessage;
*/
public class L2ContactList
{
private final Logger _log = Logger.getLogger(getClass().getName());
private static final Logger LOGGER = Logger.getLogger(L2ContactList.class.getName());
private final L2PcInstance activeChar;
private final List<String> _contacts = new CopyOnWriteArrayList<>();
private final Set<String> _contacts = ConcurrentHashMap.newKeySet();
private static final String QUERY_ADD = "INSERT INTO character_contacts (charId, contactId) VALUES (?, ?)";
private static final String QUERY_REMOVE = "DELETE FROM character_contacts WHERE charId = ? and contactId = ?";
@@ -58,16 +59,16 @@ public class L2ContactList
_contacts.clear();
try (Connection con = DatabaseFactory.getInstance().getConnection();
PreparedStatement ps = con.prepareStatement(QUERY_LOAD))
PreparedStatement statement = con.prepareStatement(QUERY_LOAD))
{
ps.setInt(1, activeChar.getObjectId());
try (ResultSet rs = ps.executeQuery())
statement.setInt(1, activeChar.getObjectId());
try (ResultSet rset = statement.executeQuery())
{
int contactId;
String contactName;
while (rs.next())
while (rset.next())
{
contactId = rs.getInt(1);
contactId = rset.getInt(1);
contactName = CharNameTable.getInstance().getNameById(contactId);
if ((contactName == null) || contactName.equals(activeChar.getName()) || (contactId == activeChar.getObjectId()))
{
@@ -80,7 +81,7 @@ public class L2ContactList
}
catch (Exception e)
{
_log.log(Level.WARNING, "Error found in " + activeChar.getName() + "'s ContactsList: " + e.getMessage(), e);
LOGGER.log(Level.WARNING, "Error found in " + activeChar.getName() + "'s ContactsList: " + e.getMessage(), e);
}
}
@@ -124,11 +125,11 @@ public class L2ContactList
}
try (Connection con = DatabaseFactory.getInstance().getConnection();
PreparedStatement ps = con.prepareStatement(QUERY_ADD))
PreparedStatement statement = con.prepareStatement(QUERY_ADD))
{
ps.setInt(1, activeChar.getObjectId());
ps.setInt(2, contactId);
ps.execute();
statement.setInt(1, activeChar.getObjectId());
statement.setInt(2, contactId);
statement.execute();
_contacts.add(name);
@@ -138,7 +139,7 @@ public class L2ContactList
}
catch (Exception e)
{
_log.log(Level.WARNING, "Error found in " + activeChar.getName() + "'s ContactsList: " + e.getMessage(), e);
LOGGER.log(Level.WARNING, "Error found in " + activeChar.getName() + "'s ContactsList: " + e.getMessage(), e);
}
return true;
}
@@ -161,11 +162,11 @@ public class L2ContactList
_contacts.remove(name);
try (Connection con = DatabaseFactory.getInstance().getConnection();
PreparedStatement ps = con.prepareStatement(QUERY_REMOVE))
PreparedStatement statement = con.prepareStatement(QUERY_REMOVE))
{
ps.setInt(1, activeChar.getObjectId());
ps.setInt(2, contactId);
ps.execute();
statement.setInt(1, activeChar.getObjectId());
statement.setInt(2, contactId);
statement.execute();
final SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.S1_WAS_SUCCESSFULLY_DELETED_FROM_YOUR_CONTACT_LIST);
sm.addString(name);
@@ -173,11 +174,11 @@ public class L2ContactList
}
catch (Exception e)
{
_log.log(Level.WARNING, "Error found in " + activeChar.getName() + "'s ContactsList: " + e.getMessage(), e);
LOGGER.log(Level.WARNING, "Error found in " + activeChar.getName() + "'s ContactsList: " + e.getMessage(), e);
}
}
public List<String> getAllContacts()
public Set<String> getAllContacts()
{
return _contacts;
}

View File

@@ -36,7 +36,7 @@ public final class L2Crest implements IIdentifiable
private final int _id;
private CrestType(int id)
CrestType(int id)
{
_id = id;
}

View File

@@ -28,7 +28,7 @@ public class L2ExtractableProduct
/**
* Create Extractable product
* @param id crete item id
* @param id create item id
* @param min item count max
* @param max item count min
* @param chance chance for creating

View File

@@ -87,7 +87,7 @@ public class L2GroupSpawn extends L2Spawn
}
catch (Exception e)
{
_log.log(Level.WARNING, "NPC class not found: " + e.getMessage(), e);
LOGGER.log(Level.WARNING, "NPC class not found: " + e.getMessage(), e);
return null;
}
}

View File

@@ -162,22 +162,50 @@ public class L2MapRegion
public final Location getSpawnLoc()
{
return Config.RANDOM_RESPAWN_IN_TOWN_ENABLED ? _spawnLocs.get(Rnd.get(_spawnLocs.size())) : _spawnLocs.get(0);
if (Config.RANDOM_RESPAWN_IN_TOWN_ENABLED)
{
return _spawnLocs.get(Rnd.get(_spawnLocs.size()));
}
return _spawnLocs.get(0);
}
public final Location getOtherSpawnLoc()
{
return _otherSpawnLocs != null ? Config.RANDOM_RESPAWN_IN_TOWN_ENABLED ? _otherSpawnLocs.get(Rnd.get(_otherSpawnLocs.size())) : _otherSpawnLocs.get(0) : getSpawnLoc();
if (_otherSpawnLocs != null)
{
if (Config.RANDOM_RESPAWN_IN_TOWN_ENABLED)
{
return _otherSpawnLocs.get(Rnd.get(_otherSpawnLocs.size()));
}
return _otherSpawnLocs.get(0);
}
return getSpawnLoc();
}
public final Location getChaoticSpawnLoc()
{
return _chaoticSpawnLocs != null ? Config.RANDOM_RESPAWN_IN_TOWN_ENABLED ? _chaoticSpawnLocs.get(Rnd.get(_chaoticSpawnLocs.size())) : _chaoticSpawnLocs.get(0) : getSpawnLoc();
if (_chaoticSpawnLocs != null)
{
if (Config.RANDOM_RESPAWN_IN_TOWN_ENABLED)
{
return _chaoticSpawnLocs.get(Rnd.get(_chaoticSpawnLocs.size()));
}
return _chaoticSpawnLocs.get(0);
}
return getSpawnLoc();
}
public final Location getBanishSpawnLoc()
{
return _banishSpawnLocs != null ? Config.RANDOM_RESPAWN_IN_TOWN_ENABLED ? _banishSpawnLocs.get(Rnd.get(_banishSpawnLocs.size())) : _banishSpawnLocs.get(0) : getSpawnLoc();
if (_banishSpawnLocs != null)
{
if (Config.RANDOM_RESPAWN_IN_TOWN_ENABLED)
{
return _banishSpawnLocs.get(Rnd.get(_banishSpawnLocs.size()));
}
return _banishSpawnLocs.get(0);
}
return getSpawnLoc();
}
public final void addBannedRace(String race, String point)

View File

@@ -21,7 +21,7 @@ import java.util.HashMap;
import java.util.List;
import java.util.Map;
import com.l2jmobius.gameserver.datatables.SkillData;
import com.l2jmobius.gameserver.data.xml.impl.SkillData;
import com.l2jmobius.gameserver.model.holders.SkillHolder;
/**
@@ -184,7 +184,7 @@ public class L2PetData
{
continue;
}
if (temp.getSkillLvl() == 0)
if (temp.getSkillLevel() == 0)
{
if (petLvl < 70)
{
@@ -207,9 +207,9 @@ public class L2PetData
}
break;
}
if ((temp.getMinLevel() <= petLvl) && (temp.getSkillLvl() > lvl))
if ((temp.getMinLevel() <= petLvl) && (temp.getSkillLevel() > lvl))
{
lvl = temp.getSkillLvl();
lvl = temp.getSkillLevel();
}
}
return lvl;

View File

@@ -16,8 +16,8 @@
*/
package com.l2jmobius.gameserver.model;
import java.util.List;
import java.util.concurrent.CopyOnWriteArrayList;
import java.util.Set;
import java.util.concurrent.ConcurrentHashMap;
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
import com.l2jmobius.gameserver.network.serverpackets.RadarControl;
@@ -28,7 +28,7 @@ import com.l2jmobius.gameserver.network.serverpackets.RadarControl;
public final class L2Radar
{
private final L2PcInstance _player;
private final List<RadarMarker> _markers = new CopyOnWriteArrayList<>();
private final Set<RadarMarker> _markers = ConcurrentHashMap.newKeySet();
public L2Radar(L2PcInstance player)
{
@@ -48,9 +48,13 @@ public final class L2Radar
// Remove a marker from player's radar
public void removeMarker(int x, int y, int z)
{
final RadarMarker newMarker = new RadarMarker(x, y, z);
_markers.remove(newMarker);
for (RadarMarker rm : _markers)
{
if ((rm._x == x) && (rm._y == y) && (rm._z == z))
{
_markers.remove(rm);
}
}
_player.sendPacket(new RadarControl(1, 1, x, y, z));
}
@@ -102,7 +106,8 @@ public final class L2Radar
result = (prime * result) + _type;
result = (prime * result) + _x;
result = (prime * result) + _y;
return result = (prime * result) + _z;
result = (prime * result) + _z;
return result;
}
@Override

View File

@@ -52,7 +52,7 @@ import com.l2jmobius.gameserver.model.zone.type.NpcSpawnTerritory;
*/
public class L2Spawn implements IPositionable, IIdentifiable, INamable
{
protected static final Logger _log = Logger.getLogger(L2Spawn.class.getName());
protected static final Logger LOGGER = Logger.getLogger(L2Spawn.class.getName());
/** String identifier of this spawn */
private String _name;
@@ -100,7 +100,7 @@ public class L2Spawn implements IPositionable, IIdentifiable, INamable
}
catch (Exception e)
{
_log.log(Level.WARNING, "", e);
LOGGER.log(Level.WARNING, "", e);
}
_scheduledCount--;
@@ -532,7 +532,7 @@ public class L2Spawn implements IPositionable, IIdentifiable, INamable
}
catch (Exception e)
{
_log.log(Level.WARNING, "NPC " + _template.getId() + " class not found", e);
LOGGER.log(Level.WARNING, "NPC " + _template.getId() + " class not found", e);
}
return null;
}
@@ -551,10 +551,10 @@ public class L2Spawn implements IPositionable, IIdentifiable, INamable
// New method
if (isTerritoryBased())
{
final int[] p = _spawnTerritory.getRandomPoint();
newlocx = p[0];
newlocy = p[1];
newlocz = p[2];
final Location p = _spawnTerritory.getRandomPoint();
newlocx = p.getX();
newlocy = p.getY();
newlocz = p.getZ();
}
// Old method (for backward compatibility)
else if ((getX() == 0) && (getY() == 0))
@@ -698,7 +698,7 @@ public class L2Spawn implements IPositionable, IIdentifiable, INamable
{
if (delay < 0)
{
_log.warning("respawn delay is negative for spawn:" + this);
LOGGER.warning("respawn delay is negative for spawn:" + this);
}
final int minDelay = delay - randomInterval;

View File

@@ -107,7 +107,21 @@ public class L2Territory
}
final double dx1 = p1._x - x;
return ((dx1 >= 0) && ((p2._x - x) >= 0)) || (((dx1 >= 0) || ((p2._x - x) >= 0)) && (((dy1 * (p1._x - p2._x)) / (p1._y - p2._y)) <= dx1));
final double dx2 = p2._x - x;
if ((dx1 >= 0) && (dx2 >= 0))
{
return true;
}
if ((dx1 < 0) && (dx2 < 0))
{
return false;
}
final double dx0 = (dy1 * (p1._x - p2._x)) / (p1._y - p2._y);
return dx0 <= dx1;
}
public boolean isInside(int x, int y)
@@ -115,7 +129,10 @@ public class L2Territory
int intersect_count = 0;
for (int i = 0; i < _points.size(); i++)
{
if (isIntersect(x, y, _points.get(i > 0 ? i - 1 : _points.size() - 1), _points.get(i)))
final Point p1 = _points.get(i > 0 ? i - 1 : _points.size() - 1);
final Point p2 = _points.get(i);
if (isIntersect(x, y, p1, p2))
{
intersect_count++;
}

View File

@@ -223,7 +223,6 @@ public final class L2WorldRegion
}
assert object.getWorldRegion() == this;
if (_visibleObjects == null)
{
synchronized (object)

View File

@@ -26,14 +26,13 @@ import com.l2jmobius.gameserver.model.actor.instance.L2ControllableMobInstance;
*/
public class MobGroupTable
{
private final Map<Integer, MobGroup> _groupMap;
private final Map<Integer, MobGroup> _groupMap = new ConcurrentHashMap<>();
public static final int FOLLOW_RANGE = 300;
public static final int RANDOM_RANGE = 300;
protected MobGroupTable()
{
_groupMap = new ConcurrentHashMap<>();
}
public static MobGroupTable getInstance()

View File

@@ -83,7 +83,7 @@ public class PartyMatchRoom implements IIdentifiable
for (L2PcInstance _member : _members)
{
final SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.C1_HAS_LEFT_THE_PARTY_ROOM);
sm.addCharName(player);
sm.addString(player.getName());
_member.sendPacket(sm);
_member.sendPacket(new ExManagePartyRoomMember(player, this, 2));
}

View File

@@ -41,7 +41,7 @@ public enum PcCondOverride
private final int _mask;
private final String _descr;
private PcCondOverride(int id, String descr)
PcCondOverride(int id, String descr)
{
_mask = 1 << id;
_descr = descr;

View File

@@ -86,16 +86,16 @@ public class ShortCuts implements IRestorable
}
try (Connection con = DatabaseFactory.getInstance().getConnection();
PreparedStatement ps = con.prepareStatement("REPLACE INTO character_shortcuts (charId,slot,page,type,shortcut_id,level,class_index) values(?,?,?,?,?,?,?)"))
PreparedStatement statement = con.prepareStatement("REPLACE INTO character_shortcuts (charId,slot,page,type,shortcut_id,level,class_index) values(?,?,?,?,?,?,?)"))
{
ps.setInt(1, _owner.getObjectId());
ps.setInt(2, shortcut.getSlot());
ps.setInt(3, shortcut.getPage());
ps.setInt(4, shortcut.getType().ordinal());
ps.setInt(5, shortcut.getId());
ps.setInt(6, shortcut.getLevel());
ps.setInt(7, _owner.getClassIndex());
ps.execute();
statement.setInt(1, _owner.getObjectId());
statement.setInt(2, shortcut.getSlot());
statement.setInt(3, shortcut.getPage());
statement.setInt(4, shortcut.getType().ordinal());
statement.setInt(5, shortcut.getId());
statement.setInt(6, shortcut.getLevel());
statement.setInt(7, _owner.getClassIndex());
statement.execute();
}
catch (Exception e)
{
@@ -154,13 +154,13 @@ public class ShortCuts implements IRestorable
private void deleteShortCutFromDb(Shortcut shortcut)
{
try (Connection con = DatabaseFactory.getInstance().getConnection();
PreparedStatement ps = con.prepareStatement("DELETE FROM character_shortcuts WHERE charId=? AND slot=? AND page=? AND class_index=?"))
PreparedStatement statement = con.prepareStatement("DELETE FROM character_shortcuts WHERE charId=? AND slot=? AND page=? AND class_index=?"))
{
ps.setInt(1, _owner.getObjectId());
ps.setInt(2, shortcut.getSlot());
ps.setInt(3, shortcut.getPage());
ps.setInt(4, _owner.getClassIndex());
ps.execute();
statement.setInt(1, _owner.getObjectId());
statement.setInt(2, shortcut.getSlot());
statement.setInt(3, shortcut.getPage());
statement.setInt(4, _owner.getClassIndex());
statement.execute();
}
catch (Exception e)
{

View File

@@ -22,7 +22,6 @@ import com.l2jmobius.gameserver.model.actor.L2Npc;
* This class ...
* @version $Revision: 1.2 $ $Date: 2004/06/27 08:12:59 $
*/
public interface SpawnListener
{
void npcSpawned(L2Npc npc);

View File

@@ -35,7 +35,7 @@ import com.l2jmobius.gameserver.model.interfaces.IParserAdvUtils;
*/
public class StatsSet implements IParserAdvUtils
{
private static final Logger _log = Logger.getLogger(StatsSet.class.getName());
private static final Logger LOGGER = Logger.getLogger(StatsSet.class.getName());
/** Static empty immutable map, used to avoid multiple null checks over the source. */
public static final StatsSet EMPTY_STATSET = new StatsSet(Collections.<String, Object> emptyMap());
@@ -623,7 +623,7 @@ public class StatsSet implements IParserAdvUtils
assert ((min > max) || ((value >= min) && (value < max)));
if ((min <= max) && ((value < min) || (value >= max)))
{
_log.log(Level.SEVERE, "Incorrect value: " + value + "for: " + key + "Ref: " + reference);
LOGGER.log(Level.SEVERE, "Incorrect value: " + value + "for: " + key + "Ref: " + reference);
}
set(key, value);

View File

@@ -18,10 +18,11 @@ package com.l2jmobius.gameserver.model;
import static com.l2jmobius.gameserver.model.itemcontainer.Inventory.MAX_ADENA;
import java.util.Collection;
import java.util.LinkedList;
import java.util.List;
import java.util.Set;
import java.util.concurrent.CopyOnWriteArrayList;
import java.util.concurrent.ConcurrentHashMap;
import java.util.logging.Logger;
import com.l2jmobius.Config;
@@ -47,7 +48,7 @@ public class TradeList
private final L2PcInstance _owner;
private L2PcInstance _partner;
private final List<TradeItem> _items = new CopyOnWriteArrayList<>();
private final Set<TradeItem> _items = ConcurrentHashMap.newKeySet();
private String _title;
private boolean _packaged;
@@ -117,7 +118,7 @@ public class TradeList
* @param inventory
* @return L2ItemInstance : items in inventory
*/
public List<TradeItem> getAvailableItems(PcInventory inventory)
public Collection<TradeItem> getAvailableItems(PcInventory inventory)
{
final List<TradeItem> list = new LinkedList<>();
for (TradeItem item : _items)

View File

@@ -966,7 +966,7 @@ public class L2Attackable extends L2Npc
if (isRaid() && !isRaidMinion() && (drop.getCount() > 0))
{
final SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.C1_DIED_AND_DROPPED_S3_S2);
sm.addCharName(this);
sm.addString(getName());
sm.addItemName(item);
sm.addLong(drop.getCount());
broadcastPacket(sm);

View File

@@ -6251,7 +6251,7 @@ public abstract class L2Character extends L2Object implements ISkillsHolder, IDe
{
final SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.C1_HAS_EVADED_C2_S_ATTACK);
sm.addPcName(target.getActingPlayer());
sm.addCharName(this);
sm.addString(getName());
target.sendPacket(sm);
}
}
@@ -6656,7 +6656,7 @@ public abstract class L2Character extends L2Object implements ISkillsHolder, IDe
if (_invulAgainst != null)
{
final SkillHolder holder = getInvulAgainstSkills().get(skillId);
return ((holder != null) && ((holder.getSkillLvl() < 1) || (holder.getSkillLvl() == skillLvl)));
return ((holder != null) && ((holder.getSkillLevel() < 1) || (holder.getSkillLevel() == skillLvl)));
}
return false;
}

View File

@@ -782,7 +782,7 @@ public abstract class L2Summon extends L2Playable
{
sm = SystemMessage.getSystemMessage(SystemMessageId.C1_HAS_DONE_S3_POINTS_OF_DAMAGE_TO_C2);
sm.addNpcName(this);
sm.addCharName(target);
sm.addString(target.getName());
sm.addInt(damage);
}
@@ -798,7 +798,7 @@ public abstract class L2Summon extends L2Playable
{
final SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.C1_HAS_RECEIVED_S3_DAMAGE_FROM_C2);
sm.addNpcName(this);
sm.addCharName(attacker);
sm.addString(attacker.getName());
sm.addInt((int) damage);
sendPacket(sm);
}

View File

@@ -24,7 +24,7 @@ import com.l2jmobius.commons.concurrent.ThreadPool;
import com.l2jmobius.commons.util.Rnd;
import com.l2jmobius.gameserver.ai.CtrlIntention;
import com.l2jmobius.gameserver.data.xml.impl.PetDataTable;
import com.l2jmobius.gameserver.datatables.SkillData;
import com.l2jmobius.gameserver.data.xml.impl.SkillData;
import com.l2jmobius.gameserver.enums.CategoryType;
import com.l2jmobius.gameserver.enums.InstanceType;
import com.l2jmobius.gameserver.model.L2PetData.L2PetSkillLearn;

View File

@@ -22,7 +22,7 @@ import java.util.StringTokenizer;
import com.l2jmobius.Config;
import com.l2jmobius.gameserver.cache.HtmCache;
import com.l2jmobius.gameserver.data.sql.impl.TeleportLocationTable;
import com.l2jmobius.gameserver.datatables.SkillData;
import com.l2jmobius.gameserver.data.xml.impl.SkillData;
import com.l2jmobius.gameserver.enums.InstanceType;
import com.l2jmobius.gameserver.instancemanager.CHSiegeManager;
import com.l2jmobius.gameserver.instancemanager.ClanHallManager;

View File

@@ -25,7 +25,7 @@ import java.util.logging.Logger;
import com.l2jmobius.commons.concurrent.ThreadPool;
import com.l2jmobius.commons.util.Rnd;
import com.l2jmobius.gameserver.ai.CtrlEvent;
import com.l2jmobius.gameserver.datatables.SkillData;
import com.l2jmobius.gameserver.data.xml.impl.SkillData;
import com.l2jmobius.gameserver.instancemanager.DuelManager;
import com.l2jmobius.gameserver.model.L2Object;
import com.l2jmobius.gameserver.model.L2Party;

View File

@@ -20,7 +20,7 @@ import java.util.concurrent.Future;
import java.util.logging.Level;
import com.l2jmobius.commons.concurrent.ThreadPool;
import com.l2jmobius.gameserver.datatables.SkillData;
import com.l2jmobius.gameserver.data.xml.impl.SkillData;
import com.l2jmobius.gameserver.enums.InstanceType;
import com.l2jmobius.gameserver.model.actor.L2Character;
import com.l2jmobius.gameserver.model.actor.L2Decoy;

View File

@@ -19,8 +19,8 @@ package com.l2jmobius.gameserver.model.actor.instance;
import java.util.List;
import com.l2jmobius.Config;
import com.l2jmobius.gameserver.data.xml.impl.SkillData;
import com.l2jmobius.gameserver.data.xml.impl.SkillTreesData;
import com.l2jmobius.gameserver.datatables.SkillData;
import com.l2jmobius.gameserver.enums.InstanceType;
import com.l2jmobius.gameserver.instancemanager.FishingChampionshipManager;
import com.l2jmobius.gameserver.model.L2SkillLearn;

View File

@@ -22,7 +22,7 @@ import java.util.StringTokenizer;
import com.l2jmobius.Config;
import com.l2jmobius.gameserver.cache.HtmCache;
import com.l2jmobius.gameserver.data.sql.impl.TeleportLocationTable;
import com.l2jmobius.gameserver.datatables.SkillData;
import com.l2jmobius.gameserver.data.xml.impl.SkillData;
import com.l2jmobius.gameserver.enums.InstanceType;
import com.l2jmobius.gameserver.model.ClanPrivilege;
import com.l2jmobius.gameserver.model.L2TeleportLocation;

View File

@@ -23,7 +23,7 @@ import java.util.logging.Logger;
import com.l2jmobius.gameserver.cache.HtmCache;
import com.l2jmobius.gameserver.data.sql.impl.NpcBufferTable;
import com.l2jmobius.gameserver.data.sql.impl.NpcBufferTable.NpcBufferData;
import com.l2jmobius.gameserver.datatables.SkillData;
import com.l2jmobius.gameserver.data.xml.impl.SkillData;
import com.l2jmobius.gameserver.enums.InstanceType;
import com.l2jmobius.gameserver.model.actor.L2Character;
import com.l2jmobius.gameserver.model.actor.L2Npc;
@@ -159,7 +159,7 @@ public class L2NpcBufferInstance extends L2Npc
}
}
final Skill skill = SkillData.getInstance().getSkill(npcBuffGroupInfo.getSkill().getSkillId(), npcBuffGroupInfo.getSkill().getSkillLvl());
final Skill skill = SkillData.getInstance().getSkill(npcBuffGroupInfo.getSkill().getSkillId(), npcBuffGroupInfo.getSkill().getSkillLevel());
if (skill != null)
{
skill.applyEffects(player, target);

View File

@@ -19,8 +19,8 @@ package com.l2jmobius.gameserver.model.actor.instance;
import java.util.List;
import java.util.Map;
import com.l2jmobius.gameserver.data.xml.impl.SkillData;
import com.l2jmobius.gameserver.data.xml.impl.SkillTreesData;
import com.l2jmobius.gameserver.datatables.SkillData;
import com.l2jmobius.gameserver.enums.InstanceType;
import com.l2jmobius.gameserver.model.L2SkillLearn;
import com.l2jmobius.gameserver.model.actor.L2Npc;

View File

@@ -75,9 +75,9 @@ import com.l2jmobius.gameserver.data.xml.impl.PetDataTable;
import com.l2jmobius.gameserver.data.xml.impl.PlayerTemplateData;
import com.l2jmobius.gameserver.data.xml.impl.PlayerXpPercentLostData;
import com.l2jmobius.gameserver.data.xml.impl.RecipeData;
import com.l2jmobius.gameserver.data.xml.impl.SkillData;
import com.l2jmobius.gameserver.data.xml.impl.SkillTreesData;
import com.l2jmobius.gameserver.datatables.ItemTable;
import com.l2jmobius.gameserver.datatables.SkillData;
import com.l2jmobius.gameserver.enums.ChatType;
import com.l2jmobius.gameserver.enums.HtmlActionScope;
import com.l2jmobius.gameserver.enums.IllegalActionPunishmentType;
@@ -9948,11 +9948,11 @@ public final class L2PcInstance extends L2Playable
for (SkillHolder holder : _transformation.getTemplate(this).getSkills())
{
ts.putIfAbsent(holder.getSkillId(), holder.getSkillLvl());
ts.putIfAbsent(holder.getSkillId(), holder.getSkillLevel());
if (ts.get(holder.getSkillId()) < holder.getSkillLvl())
if (ts.get(holder.getSkillId()) < holder.getSkillLevel())
{
ts.put(holder.getSkillId(), holder.getSkillLvl());
ts.put(holder.getSkillId(), holder.getSkillLevel());
}
}
@@ -9960,10 +9960,10 @@ public final class L2PcInstance extends L2Playable
{
if (getLevel() >= holder.getMinLevel())
{
ts.putIfAbsent(holder.getSkillId(), holder.getSkillLvl());
if (ts.get(holder.getSkillId()) < holder.getSkillLvl())
ts.putIfAbsent(holder.getSkillId(), holder.getSkillLevel());
if (ts.get(holder.getSkillId()) < holder.getSkillLevel())
{
ts.put(holder.getSkillId(), holder.getSkillLvl());
ts.put(holder.getSkillId(), holder.getSkillLevel());
}
}
}
@@ -12415,7 +12415,7 @@ public final class L2PcInstance extends L2Playable
{
final SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.C1_HAS_EVADED_C2_S_ATTACK);
sm.addPcName(target.getActingPlayer());
sm.addCharName(this);
sm.addString(getName());
target.sendPacket(sm);
}
final SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.C1_S_ATTACK_WENT_ASTRAY);
@@ -12456,7 +12456,7 @@ public final class L2PcInstance extends L2Playable
{
sm = SystemMessage.getSystemMessage(SystemMessageId.C1_HAS_DONE_S3_POINTS_OF_DAMAGE_TO_C2);
sm.addPcName(this);
sm.addCharName(target);
sm.addString(target.getName());
sm.addInt(damage);
}
sendPacket(sm);

View File

@@ -33,8 +33,8 @@ import com.l2jmobius.gameserver.ai.CtrlIntention;
import com.l2jmobius.gameserver.data.sql.impl.CharSummonTable;
import com.l2jmobius.gameserver.data.sql.impl.SummonEffectsTable;
import com.l2jmobius.gameserver.data.xml.impl.PetDataTable;
import com.l2jmobius.gameserver.data.xml.impl.SkillData;
import com.l2jmobius.gameserver.datatables.ItemTable;
import com.l2jmobius.gameserver.datatables.SkillData;
import com.l2jmobius.gameserver.enums.InstanceType;
import com.l2jmobius.gameserver.enums.ItemLocation;
import com.l2jmobius.gameserver.enums.PartyDistributionType;

View File

@@ -30,7 +30,7 @@ import com.l2jmobius.commons.concurrent.ThreadPool;
import com.l2jmobius.commons.database.DatabaseFactory;
import com.l2jmobius.gameserver.data.sql.impl.CharSummonTable;
import com.l2jmobius.gameserver.data.sql.impl.SummonEffectsTable;
import com.l2jmobius.gameserver.datatables.SkillData;
import com.l2jmobius.gameserver.data.xml.impl.SkillData;
import com.l2jmobius.gameserver.enums.InstanceType;
import com.l2jmobius.gameserver.model.L2Object;
import com.l2jmobius.gameserver.model.actor.L2Character;

View File

@@ -26,7 +26,7 @@ import com.l2jmobius.commons.concurrent.ThreadPool;
import com.l2jmobius.commons.util.Rnd;
import com.l2jmobius.gameserver.ai.CtrlIntention;
import com.l2jmobius.gameserver.data.xml.impl.NpcData;
import com.l2jmobius.gameserver.datatables.SkillData;
import com.l2jmobius.gameserver.data.xml.impl.SkillData;
import com.l2jmobius.gameserver.enums.InstanceType;
import com.l2jmobius.gameserver.model.L2Object;
import com.l2jmobius.gameserver.model.Location;

View File

@@ -332,8 +332,8 @@ public final class L2TrapInstance extends L2Npc
else
{
final SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.C1_HAS_DONE_S3_POINTS_OF_DAMAGE_TO_C2);
sm.addCharName(this);
sm.addCharName(target);
sm.addString(this.getName());
sm.addString(target.getName());
sm.addInt(damage);
_owner.sendPacket(sm);
}

View File

@@ -231,7 +231,7 @@ public class PcStatus extends PlayableStatus
// Send a System Message to the L2PcInstance
smsg = SystemMessage.getSystemMessage(SystemMessageId.C1_HAS_RECEIVED_S3_DAMAGE_FROM_C2);
smsg.addString(getActiveChar().getName());
smsg.addCharName(attacker);
smsg.addString(attacker.getName());
smsg.addInt(fullValue);
getActiveChar().sendPacket(smsg);

View File

@@ -55,7 +55,7 @@ public class PetStatus extends SummonStatus
if (!isDOT && (getActiveChar().getOwner() != null))
{
final SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.YOUR_PET_RECEIVED_S2_DAMAGE_BY_C1);
sm.addCharName(attacker);
sm.addString(attacker.getName());
sm.addInt((int) value);
getActiveChar().sendPacket(sm);
}

View File

@@ -338,7 +338,7 @@ public final class Transform implements IIdentifiable
{
for (AdditionalSkillHolder holder : template.getAdditionalSkills())
{
if ((player.getLevel() >= holder.getMinLevel()) && (player.getSkillLevel(holder.getSkillId()) < holder.getSkillLvl()))
if ((player.getLevel() >= holder.getMinLevel()) && (player.getSkillLevel(holder.getSkillId()) < holder.getSkillLevel()))
{
player.addSkill(holder.getSkill(), false);
player.addTransformSkill(holder.getSkill());

View File

@@ -27,7 +27,7 @@ import java.util.logging.Logger;
import com.l2jmobius.commons.concurrent.ThreadPool;
import com.l2jmobius.commons.util.Rnd;
import com.l2jmobius.gameserver.datatables.SkillData;
import com.l2jmobius.gameserver.data.xml.impl.SkillData;
import com.l2jmobius.gameserver.datatables.SpawnTable;
import com.l2jmobius.gameserver.enums.Team;
import com.l2jmobius.gameserver.instancemanager.HandysBlockCheckerManager;
@@ -583,6 +583,12 @@ public final class BlockCheckerEngine
for (L2ItemInstance item : _drops)
{
// npe
if (item == null)
{
continue;
}
// a player has it, it will be deleted later
if (!item.isSpawned() || (item.getOwnerId() != 0))
{

View File

@@ -32,8 +32,8 @@ import com.l2jmobius.commons.concurrent.ThreadPool;
import com.l2jmobius.commons.database.DatabaseFactory;
import com.l2jmobius.gameserver.data.sql.impl.ClanTable;
import com.l2jmobius.gameserver.data.xml.impl.DoorData;
import com.l2jmobius.gameserver.data.xml.impl.SkillData;
import com.l2jmobius.gameserver.data.xml.impl.SkillTreesData;
import com.l2jmobius.gameserver.datatables.SkillData;
import com.l2jmobius.gameserver.enums.MountType;
import com.l2jmobius.gameserver.instancemanager.CastleManager;
import com.l2jmobius.gameserver.instancemanager.CastleManorManager;
@@ -726,26 +726,23 @@ public final class Castle extends AbstractResidence
{
_function.put(type, new CastleFunction(type, lvl, lease, 0, rate, 0, false));
}
else if ((lvl == 0) && (lease == 0))
{
removeFunction(type);
}
else
{
if ((lvl == 0) && (lease == 0))
final int diffLease = lease - _function.get(type).getLease();
if (diffLease > 0)
{
removeFunction(type);
_function.remove(type);
_function.put(type, new CastleFunction(type, lvl, lease, 0, rate, -1, false));
}
else
{
final int diffLease = lease - _function.get(type).getLease();
if (diffLease > 0)
{
_function.remove(type);
_function.put(type, new CastleFunction(type, lvl, lease, 0, rate, -1, false));
}
else
{
_function.get(type).setLease(lease);
_function.get(type).setLvl(lvl);
_function.get(type).dbSave();
}
_function.get(type).setLease(lease);
_function.get(type).setLvl(lvl);
_function.get(type).dbSave();
}
}
return true;

View File

@@ -440,24 +440,23 @@ public final class Fort extends AbstractResidence
public void removeOwner(boolean updateDB)
{
final L2Clan clan = getOwnerClan();
if (clan == null)
if (clan != null)
{
return;
}
for (L2PcInstance member : clan.getOnlineMembers(0))
{
removeResidentialSkills(member);
member.sendSkillList();
}
clan.setFortId(0);
clan.broadcastToOnlineMembers(new PledgeShowInfoUpdate(clan));
setOwnerClan(null);
setSupplyLvL(0);
saveFortVariables();
removeAllFunctions();
if (updateDB)
{
updateOwnerInDB();
for (L2PcInstance member : clan.getOnlineMembers(0))
{
removeResidentialSkills(member);
member.sendSkillList();
}
clan.setFortId(0);
clan.broadcastToOnlineMembers(new PledgeShowInfoUpdate(clan));
setOwnerClan(null);
setSupplyLvL(0);
saveFortVariables();
removeAllFunctions();
if (updateDB)
{
updateOwnerInDB();
}
}
}
@@ -539,12 +538,11 @@ public final class Fort extends AbstractResidence
public void upgradeDoor(int doorId, int hp, int pDef, int mDef)
{
final L2DoorInstance door = getDoor(doorId);
if (door == null)
if (door != null)
{
return;
door.setCurrentHp(door.getMaxHp() + hp);
saveDoorUpgrade(doorId, hp, pDef, mDef);
}
door.setCurrentHp(door.getMaxHp() + hp);
saveDoorUpgrade(doorId, hp, pDef, mDef);
}
// This method loads fort

View File

@@ -27,8 +27,8 @@ import com.l2jmobius.Config;
import com.l2jmobius.commons.util.Rnd;
import com.l2jmobius.gameserver.cache.HtmCache;
import com.l2jmobius.gameserver.data.xml.impl.DoorData;
import com.l2jmobius.gameserver.data.xml.impl.SkillData;
import com.l2jmobius.gameserver.datatables.ItemTable;
import com.l2jmobius.gameserver.datatables.SkillData;
import com.l2jmobius.gameserver.datatables.SpawnTable;
import com.l2jmobius.gameserver.enums.ChatType;
import com.l2jmobius.gameserver.instancemanager.AntiFeedManager;

View File

@@ -45,7 +45,7 @@ public final class InstanceReenterTimeHolder
_minute = minute;
}
public final Long getTime()
public final long getTime()
{
return _time;
}

View File

@@ -16,7 +16,7 @@
*/
package com.l2jmobius.gameserver.model.holders;
import com.l2jmobius.gameserver.datatables.SkillData;
import com.l2jmobius.gameserver.data.xml.impl.SkillData;
import com.l2jmobius.gameserver.model.skills.Skill;
/**
@@ -45,7 +45,7 @@ public class SkillHolder
return _skillId;
}
public final int getSkillLvl()
public final int getSkillLevel()
{
return _skillLvl;
}

View File

@@ -72,7 +72,7 @@ public final class AuctionDateGenerator
return calcDestTime(_calendar.getTimeInMillis(), date, TimeUnit.MILLISECONDS.convert(_interval, TimeUnit.DAYS));
}
private final long calcDestTime(long time, long date, long add)
private long calcDestTime(long time, long date, long add)
{
if (time < date)
{
@@ -85,7 +85,7 @@ public final class AuctionDateGenerator
return time;
}
private final void checkDayOfWeek(int defaultValue)
private void checkDayOfWeek(int defaultValue)
{
if ((_day_of_week < 1) || (_day_of_week > 7))
{
@@ -101,7 +101,7 @@ public final class AuctionDateGenerator
}
}
private final void checkHourOfDay(int defaultValue)
private void checkHourOfDay(int defaultValue)
{
if ((_hour_of_day < 0) || (_hour_of_day > 23))
{
@@ -113,7 +113,7 @@ public final class AuctionDateGenerator
}
}
private final void checkMinuteOfHour(int defaultValue)
private void checkMinuteOfHour(int defaultValue)
{
if ((_minute_of_hour < 0) || (_minute_of_hour > 59))
{

View File

@@ -35,7 +35,7 @@ public enum ArmorType implements ItemType
/**
* Constructor of the ArmorType.
*/
private ArmorType()
ArmorType()
{
_mask = 1 << (ordinal() + WeaponType.values().length);
}

View File

@@ -36,7 +36,7 @@ public enum CrystalType
private final int _crystalEnchantBonusArmor;
private final int _crystalEnchantBonusWeapon;
private CrystalType(int id, int crystalId, int crystalEnchantBonusArmor, int crystalEnchantBonusWeapon)
CrystalType(int id, int crystalId, int crystalEnchantBonusArmor, int crystalEnchantBonusWeapon)
{
_id = id;
_crystalId = crystalId;

View File

@@ -49,7 +49,7 @@ public enum WeaponType implements ItemType
* Constructor of the L2WeaponType.
* @param traitType
*/
private WeaponType(TraitType traitType)
WeaponType(TraitType traitType)
{
_mask = 1 << ordinal();
_traitType = traitType;

View File

@@ -65,7 +65,7 @@ import com.l2jmobius.gameserver.model.olympiad.Participant;
import com.l2jmobius.gameserver.model.skills.Skill;
import com.l2jmobius.gameserver.model.zone.L2ZoneType;
import com.l2jmobius.gameserver.network.serverpackets.ActionFailed;
import com.l2jmobius.gameserver.network.serverpackets.ExNpcQuestHtmlMessage;
import com.l2jmobius.gameserver.network.serverpackets.NpcQuestHtmlMessage;
import com.l2jmobius.gameserver.network.serverpackets.NpcHtmlMessage;
import com.l2jmobius.gameserver.scripting.ScriptEngineManager;
@@ -2295,7 +2295,7 @@ public class Quest extends AbstractScript implements IIdentifiable
* The lucky member is chosen by standard loot roll rules -<br>
* each member rolls a random number, the one with the highest roll wins.
* @param player the player whose party to check
* @param npc the NPC used for distance and other checks (if {@link #checkPartyMember(L2PcInstance, L2Npc)} is overridden)
* @param npc the NPC used for distance and other checks (if {@link #checkPartyMember(L2PcInstance, L2Npc)} is overriden)
* @return the random party member or {@code null}
*/
public L2PcInstance getRandomPartyMember(L2PcInstance player, L2Npc npc)
@@ -2333,7 +2333,7 @@ public class Quest extends AbstractScript implements IIdentifiable
/**
* This method is called for every party member in {@link #getRandomPartyMember(L2PcInstance, L2Npc)}.<br>
* It is intended to be overridden by the specific quest implementations.
* It is intended to be overriden by the specific quest implementations.
* @param player the player to check
* @param npc the NPC that was passed to {@link #getRandomPartyMember(L2PcInstance, L2Npc)}
* @return {@code true} if this party member passes the check, {@code false} otherwise
@@ -2410,7 +2410,7 @@ public class Quest extends AbstractScript implements IIdentifiable
/**
* This method is called for every party member in {@link #getRandomPartyMemberState(L2PcInstance, int, int, L2Npc)} if/after all the standard checks are passed.<br>
* It is intended to be overridden by the specific quest implementations.<br>
* It is intended to be overriden by the specific quest implementations.<br>
* It can be used in cases when there are more checks performed than simply a quest condition check,<br>
* for example, if an item is required in the player's inventory.
* @param qs the {@link QuestState} object of the party member
@@ -2460,7 +2460,7 @@ public class Quest extends AbstractScript implements IIdentifiable
if (questwindow && (questId > 0) && (questId < 20000) && (questId != 999))
{
final ExNpcQuestHtmlMessage npcReply = new ExNpcQuestHtmlMessage(npc != null ? npc.getObjectId() : 0, questId);
final NpcQuestHtmlMessage npcReply = new NpcQuestHtmlMessage(npc != null ? npc.getObjectId() : 0, questId);
npcReply.setHtml(content);
npcReply.replace("%playername%", player.getName());
player.sendPacket(npcReply);

View File

@@ -48,7 +48,7 @@ public class BuffTimeTask implements Runnable
@Override
public void run()
{
if (_time.incrementAndGet() > _info.getAbnormalTime())
if ((_info.getEffected() != null) && (_time.incrementAndGet() > _info.getAbnormalTime()))
{
_info.getEffected().getEffectList().stopSkillEffects(false, _info.getSkill().getId());
}

View File

@@ -52,7 +52,7 @@ public enum CommonSkill
private final SkillHolder _holder;
private CommonSkill(int id, int level)
CommonSkill(int id, int level)
{
_holder = new SkillHolder(id, level);
}
@@ -64,7 +64,7 @@ public enum CommonSkill
public int getLevel()
{
return _holder.getSkillLvl();
return _holder.getSkillLevel();
}
public Skill getSkill()

View File

@@ -29,8 +29,8 @@ import java.util.logging.Logger;
import com.l2jmobius.Config;
import com.l2jmobius.commons.util.Rnd;
import com.l2jmobius.gameserver.data.xml.impl.SkillData;
import com.l2jmobius.gameserver.data.xml.impl.SkillTreesData;
import com.l2jmobius.gameserver.datatables.SkillData;
import com.l2jmobius.gameserver.enums.MountType;
import com.l2jmobius.gameserver.enums.ShotType;
import com.l2jmobius.gameserver.geoengine.GeoEngine;

View File

@@ -22,7 +22,7 @@ import java.util.concurrent.ScheduledFuture;
import java.util.logging.Logger;
import com.l2jmobius.commons.concurrent.ThreadPool;
import com.l2jmobius.gameserver.datatables.SkillData;
import com.l2jmobius.gameserver.data.xml.impl.SkillData;
import com.l2jmobius.gameserver.enums.ShotType;
import com.l2jmobius.gameserver.geoengine.GeoEngine;
import com.l2jmobius.gameserver.model.L2Object;

View File

@@ -896,7 +896,7 @@ public final class Formulas
else
{
final SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.C1_HAS_RESISTED_YOUR_S2);
sm.addCharName(target);
sm.addString(target.getName());
sm.addSkillName(skill);
attacker.sendPacket(sm);
damage = 1;
@@ -906,7 +906,7 @@ public final class Formulas
if (target.isPlayer())
{
final SystemMessage sm = (skill.hasEffectType(L2EffectType.HP_DRAIN)) ? SystemMessage.getSystemMessage(SystemMessageId.YOU_RESISTED_C1_S_DRAIN) : SystemMessage.getSystemMessage(SystemMessageId.YOU_RESISTED_C1_S_MAGIC);
sm.addCharName(attacker);
sm.addString(attacker.getName());
target.sendPacket(sm);
}
}
@@ -989,7 +989,7 @@ public final class Formulas
else
{
final SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.C1_HAS_RESISTED_YOUR_S2);
sm.addCharName(target);
sm.addString(target.getName());
sm.addSkillName(skill);
owner.sendPacket(sm);
damage = 1;
@@ -1000,13 +1000,13 @@ public final class Formulas
if (skill.hasEffectType(L2EffectType.HP_DRAIN))
{
final SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.YOU_RESISTED_C1_S_DRAIN);
sm.addCharName(owner);
sm.addString(owner.getName());
target.sendPacket(sm);
}
else
{
final SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.YOU_RESISTED_C1_S_MAGIC);
sm.addCharName(owner);
sm.addString(owner.getName());
target.sendPacket(sm);
}
}
@@ -1304,7 +1304,7 @@ public final class Formulas
if (skill.isDebuff() && (target.calcStat(Stats.DEBUFF_IMMUNITY, 0, attacker, skill) > 0))
{
final SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.C1_HAS_RESISTED_YOUR_S2);
sm.addCharName(target);
sm.addString(target.getName());
sm.addSkillName(skill);
attacker.sendPacket(sm);
return false;
@@ -1382,7 +1382,7 @@ public final class Formulas
if (finalRate <= Rnd.get(100))
{
final SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.C1_HAS_RESISTED_YOUR_S2);
sm.addCharName(target);
sm.addString(target.getName());
sm.addSkillName(skill);
attacker.sendPacket(sm);
return false;
@@ -1522,8 +1522,8 @@ public final class Formulas
if (attacker.isPlayer())
{
final SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.DAMAGE_IS_DECREASED_BECAUSE_C1_RESISTED_C2_S_MAGIC);
sm.addCharName(target);
sm.addCharName(attacker);
sm.addString(target.getName());
sm.addString(attacker.getName());
attacker.sendPacket(sm);
damage /= 2;
}
@@ -1531,8 +1531,8 @@ public final class Formulas
if (target.isPlayer())
{
final SystemMessage sm2 = SystemMessage.getSystemMessage(SystemMessageId.C1_WEAKLY_RESISTED_C2_S_MAGIC);
sm2.addCharName(target);
sm2.addCharName(attacker);
sm2.addString(target.getName());
sm2.addString(attacker.getName());
target.sendPacket(sm2);
}
}
@@ -1818,13 +1818,13 @@ public final class Formulas
if (target.isPlayer())
{
final SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.YOU_COUNTERED_C1_S_ATTACK);
sm.addCharName(attacker);
sm.addString(attacker.getName());
target.sendPacket(sm);
}
if (attacker.isPlayer())
{
final SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.C1_IS_PERFORMING_A_COUNTERATTACK);
sm.addCharName(target);
sm.addString(target.getName());
attacker.sendPacket(sm);
}

Some files were not shown because too many files have changed in this diff Show More