Backward compatibility changes for Java 8.

This commit is contained in:
MobiusDevelopment
2021-01-08 23:40:59 +00:00
parent a54e1fbcf8
commit 6083099412
413 changed files with 1309 additions and 468 deletions

View File

@@ -27,6 +27,9 @@ public class Rnd
* Thread-specific random number generator.<br>
* Each is seeded with the thread ID, so the sequence of random numbers are unique between threads.
*/
// Java 1.8
// private static ThreadLocal<Random> RANDOM = new ThreadLocal<Random>()
// Java 10
private static ThreadLocal<Random> RANDOM = new ThreadLocal<>()
{
@Override

View File

@@ -68,7 +68,7 @@ public class TradeController
}
}
private TradeController()
protected TradeController()
{
boolean limitedItem = false;
_lists = new HashMap<>();

View File

@@ -47,7 +47,7 @@ public class CrestCache
private int _loadedFiles;
private long _bytesBuffLen;
private CrestCache()
protected CrestCache()
{
convertOldPedgeFiles();
reload();

View File

@@ -39,7 +39,7 @@ public class HtmCache
private int _loadedFiles;
private long _bytesBuffLen;
private HtmCache()
protected HtmCache()
{
_cache = new HashMap<>();
reload();

View File

@@ -32,7 +32,7 @@ public class WarehouseCacheManager
protected final Map<PlayerInstance, Long> _cachedWh;
protected final long _cacheTime;
private WarehouseCacheManager()
protected WarehouseCacheManager()
{
_cacheTime = Config.WAREHOUSE_CACHE_TIME * 60000; // 60*1000 = 60000
_cachedWh = new ConcurrentHashMap<>();

View File

@@ -33,7 +33,7 @@ public class HeroSkillTable
};
private static Skill[] HERO_SKILLS;
private HeroSkillTable()
protected HeroSkillTable()
{
HERO_SKILLS = new Skill[5];
HERO_SKILLS[0] = SkillTable.getInstance().getSkill(395, 1);

View File

@@ -73,7 +73,7 @@ public class ItemTable
_crystalTypes.put("none", Item.CRYSTAL_NONE);
}
private ItemTable()
protected ItemTable()
{
hashFiles("data/stats/items", _itemFiles);
_etcItems = new HashMap<>();

View File

@@ -32,7 +32,7 @@ public class MobGroupTable
public static final int FOLLOW_RANGE = 300;
public static final int RANDOM_RANGE = 300;
private MobGroupTable()
protected MobGroupTable()
{
_groupMap = new HashMap<>();
}

View File

@@ -25,7 +25,7 @@ public class NobleSkillTable
{
private static Skill[] _nobleSkills;
private NobleSkillTable()
protected NobleSkillTable()
{
_nobleSkills = new Skill[8];
_nobleSkills[0] = SkillTable.getInstance().getSkill(1323, 1);

View File

@@ -36,7 +36,7 @@ public class SkillTable
private final Map<Integer, Skill> _skills = new HashMap<>();
private final boolean _initialized = true;
private SkillTable()
protected SkillTable()
{
hashFiles("data/stats/skills", _skillFiles);

View File

@@ -56,7 +56,7 @@ public class ClanTable
private final Map<Integer, Clan> _clans = new HashMap<>();
private ClanTable()
protected ClanTable()
{
load();
}

View File

@@ -50,7 +50,7 @@ public class HelperBuffTable
/**
* Create and Load the Newbie Helper Buff list from SQL Table helper_buff_list
*/
private HelperBuffTable()
protected HelperBuffTable()
{
load();
}

View File

@@ -49,7 +49,7 @@ public class NpcTable
private final Map<Integer, NpcTemplate> _npcs = new HashMap<>();
private boolean _initialized = false;
private NpcTable()
protected NpcTable()
{
load();
}

View File

@@ -32,7 +32,7 @@ public class PetDataTable
private static Map<Integer, Map<Integer, PetData>> _petTable = new HashMap<>();
private PetDataTable()
protected PetDataTable()
{
load();
}

View File

@@ -35,7 +35,7 @@ public class SkillSpellbookTable
private static Map<Integer, Integer> skillSpellbooks;
private SkillSpellbookTable()
protected SkillSpellbookTable()
{
skillSpellbooks = new HashMap<>();
try (Connection con = DatabaseFactory.getConnection())

View File

@@ -54,7 +54,7 @@ public class SkillTreeTable
private final List<PledgeSkillLearn> _pledgeSkillTrees = new ArrayList<>();
private final List<EnchantSkillLearn> _enchantSkillTrees = new ArrayList<>();
private SkillTreeTable()
protected SkillTreeTable()
{
load();
}

View File

@@ -44,7 +44,7 @@ public class SpawnTable
private int _customSpawnCount;
private int _highestId;
private SpawnTable()
protected SpawnTable()
{
if (!Config.ALT_DEV_NO_SPAWNS)
{

View File

@@ -36,7 +36,7 @@ public class TeleportLocationTable
private final Map<Integer, TeleportLocation> _teleports = new HashMap<>();
private TeleportLocationTable()
protected TeleportLocationTable()
{
load();
}

View File

@@ -59,7 +59,7 @@ public class TradeListTable
}
}
private TradeListTable()
protected TradeListTable()
{
load();
}

View File

@@ -40,7 +40,7 @@ public class ArmorSetData implements IXmlReader
private ArmorSet[] _armorSets;
private ArmorSetData()
protected ArmorSetData()
{
load();
}

View File

@@ -67,7 +67,7 @@ public class AugmentationData
private static Map<Integer, List<augmentationSkill>> _purpleSkills = null;
private static Map<Integer, List<augmentationSkill>> _redSkills = null;
private AugmentationData()
protected AugmentationData()
{
load();
}

View File

@@ -42,7 +42,7 @@ public class ExperienceData
private final Map<Integer, Long> _expTable = new HashMap<>();
private ExperienceData()
protected ExperienceData()
{
load();
}

View File

@@ -64,7 +64,7 @@ public class MultisellData
return null;
}
private MultisellData()
protected MultisellData()
{
parseData();
}

View File

@@ -97,7 +97,7 @@ public class AdminCommandHandler
private final Map<String, IAdminCommandHandler> _datatable;
private AdminCommandHandler()
protected AdminCommandHandler()
{
_datatable = new HashMap<>();
registerAdminCommandHandler(new AdminAdmin());

View File

@@ -79,7 +79,7 @@ public class ItemHandler
return _datatable.size();
}
private ItemHandler()
protected ItemHandler()
{
_datatable = new HashMap<>();
registerItemHandler(new BeastSoulShot());

View File

@@ -63,7 +63,7 @@ public class SkillHandler
private final Map<SkillType, ISkillHandler> _datatable;
private SkillHandler()
protected SkillHandler()
{
_datatable = new HashMap<>();
registerSkillHandler(new BalanceLife());

View File

@@ -42,7 +42,7 @@ public class UserCommandHandler
private final Map<Integer, IUserCommandHandler> _datatable;
private UserCommandHandler()
protected UserCommandHandler()
{
_datatable = new HashMap<>();
registerUserCommandHandler(new ChannelDelete());

View File

@@ -39,7 +39,7 @@ public class VoicedCommandHandler
private final Map<String, IVoicedCommandHandler> _datatable;
private VoicedCommandHandler()
protected VoicedCommandHandler()
{
_datatable = new HashMap<>();
if (Config.BANKING_SYSTEM_ENABLED)

View File

@@ -26,7 +26,7 @@ public class ArenaManager
{
private List<ArenaZone> _arenas;
private ArenaManager()
protected ArenaManager()
{
}

View File

@@ -168,7 +168,7 @@ public class CastleManorManager
}
}
private CastleManorManager()
protected CastleManorManager()
{
load(); // load data from database
init(); // schedule all manor related events

View File

@@ -47,7 +47,7 @@ public class ClanHallManager
return _loaded;
}
private ClanHallManager()
protected ClanHallManager()
{
load();
}

View File

@@ -60,7 +60,7 @@ public class DimensionalRiftManager
private static final short DIMENSIONAL_FRAGMENT_ITEM_ID = 7079;
private static final int MAX_PARTY_PER_AREA = 3;
private DimensionalRiftManager()
protected DimensionalRiftManager()
{
loadRooms();
loadSpawns();

View File

@@ -32,7 +32,7 @@ public class DuelManager
private final List<Duel> _duels;
private int _currentDuelId = 0x90;
private DuelManager()
protected DuelManager()
{
LOGGER.info("Initializing DuelManager");
_duels = new ArrayList<>();

View File

@@ -44,7 +44,7 @@ public class ItemsOnGroundManager
static final Logger LOGGER = Logger.getLogger(ItemsOnGroundManager.class.getName());
protected List<ItemInstance> _items = new ArrayList<>();
private ItemsOnGroundManager()
protected ItemsOnGroundManager()
{
// If SaveDroppedItem is false, may want to delete all items previously stored to avoid add old items on reactivate
if (!Config.SAVE_DROPPED_ITEM)

View File

@@ -215,7 +215,7 @@ public class PetitionManager
}
}
private PetitionManager()
protected PetitionManager()
{
_pendingPetitions = new HashMap<>();
_completedPetitions = new HashMap<>();

View File

@@ -29,7 +29,7 @@ public class QuestManager
private static Map<String, Quest> _quests = new HashMap<>();
private static int _questCount = 0;
private QuestManager()
protected QuestManager()
{
}

View File

@@ -49,7 +49,7 @@ public class RebirthManager
private final HashMap<Integer, Integer> _playersRebirthInfo = new HashMap<>();
private RebirthManager()
protected RebirthManager()
{
// Do Nothing ^_-
}

View File

@@ -68,7 +68,7 @@ public class SiegeManager
private boolean _teleportToSiege = false;
private boolean _teleportToSiegeTown = false;
private SiegeManager()
protected SiegeManager()
{
load();
}

View File

@@ -32,7 +32,7 @@ public class PcPoint implements Runnable
{
Logger LOGGER = Logger.getLogger(PcPoint.class.getName());
private PcPoint()
protected PcPoint()
{
LOGGER.info("PcBang point event started.");
}

View File

@@ -52,7 +52,7 @@ public class Lottery
protected boolean _isStarted;
protected long _enddate;
private Lottery()
protected Lottery()
{
_number = 1;
_prize = Config.ALT_LOTTERY_PRIZE;

View File

@@ -77,7 +77,7 @@ public class World
/** The _world regions. */
private WorldRegion[][] _worldRegions;
private World()
protected World()
{
initRegions();
}

View File

@@ -47,11 +47,11 @@ public class BoatInstance extends Creature
public VehicleDeparture vd = null;
private int lastx = -1;
private int lasty = -1;
private int cycle = 0;
private int runstate = 0;
private BoatPathHolder pathA;
private BoatPathHolder pathB;
private boolean needOnVehicleCheckLocation = false;
protected int cycle = 0;
protected int runstate = 0;
protected BoatPathHolder pathA;
protected BoatPathHolder pathB;
protected boolean needOnVehicleCheckLocation = false;
private final Set<PlayerInstance> passengers = ConcurrentHashMap.newKeySet();
public BoatInstance(int objectId, CreatureTemplate template)
@@ -181,7 +181,7 @@ public class BoatInstance extends Creature
ThreadPool.schedule(bc, 300000);
}
private void begin()
protected void begin()
{
if (cycle == 1)
{
@@ -251,7 +251,7 @@ public class BoatInstance extends Creature
}
}
private void say(int id)
protected void say(int id)
{
final Collection<PlayerInstance> knownPlayers = getKnownList().getKnownPlayers().values();
CreatureSay sm;

View File

@@ -15939,6 +15939,10 @@ public class PlayerInstance extends Playable
{
private DoorInstance _target = null;
public GatesRequest()
{
}
public void setTarget(DoorInstance door)
{
_target = door;

View File

@@ -58,7 +58,7 @@ public class Olympiad
private static Map<Integer, StatSet> NOBLES;
private static Map<Integer, StatSet> NOBLES_RANK;
private static List<StatSet> HEROS_TO_BE;
protected static List<StatSet> HEROS_TO_BE;
private static List<PlayerInstance> _nonClassBasedRegisters;
private static Map<Integer, List<PlayerInstance>> _classBasedRegisters;
public static List<Spawn> OLY_MANAGERS = new ArrayList<>();

View File

@@ -60,7 +60,7 @@ class OlympiadManager implements Runnable
new OlympiadStadium(-114413, -213241, -3331)
};
private OlympiadManager()
protected OlympiadManager()
{
_olympiadInstances = new HashMap<>();
}

View File

@@ -31,7 +31,7 @@ public class PartyMatchRoomList
private int _maxid = 1;
private final Map<Integer, PartyMatchRoom> _rooms;
private PartyMatchRoomList()
protected PartyMatchRoomList()
{
_rooms = new HashMap<>();
}

View File

@@ -28,7 +28,7 @@ public class PartyMatchWaitingList
{
private final List<PlayerInstance> _members;
private PartyMatchWaitingList()
protected PartyMatchWaitingList()
{
_members = new ArrayList<>();
}

View File

@@ -24,12 +24,12 @@ import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
public class QuestTimer
{
private final String _name;
private final Quest _quest;
private final NpcInstance _npc;
private final PlayerInstance _player;
private final boolean _isRepeating;
private ScheduledFuture<?> _scheduler;
protected final String _name;
protected final Quest _quest;
protected final NpcInstance _npc;
protected final PlayerInstance _player;
protected final boolean _isRepeating;
protected ScheduledFuture<?> _scheduler;
public QuestTimer(Quest quest, String name, long time, NpcInstance npc, PlayerInstance player, boolean repeating)
{

View File

@@ -194,6 +194,10 @@ public class ClanHall
private class FunctionTask implements Runnable
{
public FunctionTask()
{
}
@Override
public void run()
{

View File

@@ -60,7 +60,7 @@ public class BanditStrongholdSiege extends ClanHallSiege
protected boolean _finalStage = false;
protected ScheduledFuture<?> _midTimer;
private BanditStrongholdSiege()
protected BanditStrongholdSiege()
{
LOGGER.info("SiegeManager of Bandits Stronghold");
final long siegeDate = restoreSiegeDate(35);

View File

@@ -77,7 +77,7 @@ public class DevastatedCastle
public long _damage;
}
private DevastatedCastle()
protected DevastatedCastle()
{
if (Config.DEVASTATED_DAY == 1)
{

View File

@@ -62,7 +62,7 @@ public class FortressOfResistance
public long _damage;
}
private FortressOfResistance()
protected FortressOfResistance()
{
if (Config.PARTISAN_DAY == 1)
{

View File

@@ -57,7 +57,7 @@ public class WildBeastFarmSiege extends ClanHallSiege
protected boolean _finalStage = false;
protected ScheduledFuture<?> _midTimer;
private WildBeastFarmSiege()
protected WildBeastFarmSiege()
{
LOGGER.info("SiegeManager of Wild Beasts Farm");
final long siegeDate = restoreSiegeDate(63);

View File

@@ -60,7 +60,7 @@ public class AutoSpawn
protected boolean _activeState = true;
private AutoSpawn()
protected AutoSpawn()
{
_registeredSpawns = new HashMap<>();
_runningSpawns = new HashMap<>();

View File

@@ -71,11 +71,11 @@ public class GameClient extends MMOClient<MMOConnection<GameClient>> implements
private ConnectionState _state;
private String _accountName;
private SessionKey _sessionId;
private PlayerInstance _player;
private ScheduledFuture<?> _cleanupTask = null;
private volatile boolean _isDetached = false;
private boolean _isAuthedGG;
private int _protocolVersion;
protected PlayerInstance _player;
public GameClient(MMOConnection<GameClient> con)
{

View File

@@ -43,7 +43,7 @@ import org.l2jmobius.gameserver.util.Util;
*/
public class RequestRestartPoint extends GameClientPacket
{
private static final Logger LOGGER = Logger.getLogger(RequestRestartPoint.class.getName());
protected static final Logger LOGGER = Logger.getLogger(RequestRestartPoint.class.getName());
protected int _requestedPointType;
protected boolean _continuation;

View File

@@ -49,7 +49,7 @@ public class EventDroplist
/**
* Constructor of EventDroplist.
*/
private EventDroplist()
protected EventDroplist()
{
_allNpcDateDrops = new ArrayList<>();
}

View File

@@ -35,7 +35,7 @@ public class DecayTaskManager
protected Map<Creature, Long> _decayTasks = new ConcurrentHashMap<>();
private DecayTaskManager()
protected DecayTaskManager()
{
ThreadPool.scheduleAtFixedRate(new DecayScheduler(), 10000, 5000);
}

View File

@@ -168,7 +168,7 @@ public class TaskManager
}
}
private TaskManager()
protected TaskManager()
{
initializate();
startAllTasks();

View File

@@ -40,9 +40,9 @@ import org.l2jmobius.gameserver.util.Locator;
*/
public class SystemPanel extends JPanel
{
private static final Logger LOGGER = Logger.getLogger(SystemPanel.class.getName());
protected static final Logger LOGGER = Logger.getLogger(SystemPanel.class.getName());
private static final long START_TIME = System.currentTimeMillis();
protected static final long START_TIME = System.currentTimeMillis();
public SystemPanel()
{

View File

@@ -45,6 +45,10 @@ public class DocumentItem extends DocumentBase
private class DocumentItemDataHolder
{
public DocumentItemDataHolder()
{
}
public int id;
public Enum<?> type;
public StatSet set;

View File

@@ -39,6 +39,10 @@ public class DocumentSkill extends DocumentBase
private class DocumentSkillDataHolder
{
public DocumentSkillDataHolder()
{
}
public int id;
public String name;
public StatSet[] sets;