Proper naming for InstanceManager player reenter times map.
This commit is contained in:
parent
1bdd4b6bc1
commit
5ff9b568d6
@ -74,7 +74,7 @@ public class InstanceManager implements IXmlReader
|
|||||||
private int _currentInstanceId = 0;
|
private int _currentInstanceId = 0;
|
||||||
private final Map<Integer, Instance> _instanceWorlds = new ConcurrentHashMap<>();
|
private final Map<Integer, Instance> _instanceWorlds = new ConcurrentHashMap<>();
|
||||||
// Player reenter times
|
// Player reenter times
|
||||||
private final Map<Integer, Map<Integer, Long>> _PlayerTimes = new ConcurrentHashMap<>();
|
private final Map<Integer, Map<Integer, Long>> _playerTimes = new ConcurrentHashMap<>();
|
||||||
|
|
||||||
protected InstanceManager()
|
protected InstanceManager()
|
||||||
{
|
{
|
||||||
@ -96,9 +96,9 @@ public class InstanceManager implements IXmlReader
|
|||||||
parseDatapackDirectory("data/instances", true);
|
parseDatapackDirectory("data/instances", true);
|
||||||
LOGGER.info(getClass().getSimpleName() + ": Loaded " + _instanceTemplates.size() + " instance templates.");
|
LOGGER.info(getClass().getSimpleName() + ": Loaded " + _instanceTemplates.size() + " instance templates.");
|
||||||
// Load player's reenter data
|
// Load player's reenter data
|
||||||
_PlayerTimes.clear();
|
_playerTimes.clear();
|
||||||
restoreInstanceTimes();
|
restoreInstanceTimes();
|
||||||
LOGGER.info(getClass().getSimpleName() + ": Loaded instance reenter times for " + _PlayerTimes.size() + " players.");
|
LOGGER.info(getClass().getSimpleName() + ": Loaded instance reenter times for " + _playerTimes.size() + " players.");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -545,7 +545,7 @@ public class InstanceManager implements IXmlReader
|
|||||||
public Map<Integer, Long> getAllInstanceTimes(Player player)
|
public Map<Integer, Long> getAllInstanceTimes(Player player)
|
||||||
{
|
{
|
||||||
// When player don't have any instance penalty
|
// When player don't have any instance penalty
|
||||||
final Map<Integer, Long> instanceTimes = _PlayerTimes.get(player.getObjectId());
|
final Map<Integer, Long> instanceTimes = _playerTimes.get(player.getObjectId());
|
||||||
if ((instanceTimes == null) || instanceTimes.isEmpty())
|
if ((instanceTimes == null) || instanceTimes.isEmpty())
|
||||||
{
|
{
|
||||||
return Collections.emptyMap();
|
return Collections.emptyMap();
|
||||||
@ -593,7 +593,7 @@ public class InstanceManager implements IXmlReader
|
|||||||
*/
|
*/
|
||||||
public void setReenterPenalty(int objectId, int id, long time)
|
public void setReenterPenalty(int objectId, int id, long time)
|
||||||
{
|
{
|
||||||
_PlayerTimes.computeIfAbsent(objectId, k -> new ConcurrentHashMap<>()).put(id, time);
|
_playerTimes.computeIfAbsent(objectId, k -> new ConcurrentHashMap<>()).put(id, time);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -606,7 +606,7 @@ public class InstanceManager implements IXmlReader
|
|||||||
public long getInstanceTime(Player player, int id)
|
public long getInstanceTime(Player player, int id)
|
||||||
{
|
{
|
||||||
// Check if exists reenter data for player
|
// Check if exists reenter data for player
|
||||||
final Map<Integer, Long> playerData = _PlayerTimes.get(player.getObjectId());
|
final Map<Integer, Long> playerData = _playerTimes.get(player.getObjectId());
|
||||||
if ((playerData == null) || !playerData.containsKey(id))
|
if ((playerData == null) || !playerData.containsKey(id))
|
||||||
{
|
{
|
||||||
return -1;
|
return -1;
|
||||||
@ -635,9 +635,9 @@ public class InstanceManager implements IXmlReader
|
|||||||
ps.setInt(1, player.getObjectId());
|
ps.setInt(1, player.getObjectId());
|
||||||
ps.setInt(2, id);
|
ps.setInt(2, id);
|
||||||
ps.execute();
|
ps.execute();
|
||||||
if (_PlayerTimes.get(player.getObjectId()) != null)
|
if (_playerTimes.get(player.getObjectId()) != null)
|
||||||
{
|
{
|
||||||
_PlayerTimes.get(player.getObjectId()).remove(id);
|
_playerTimes.get(player.getObjectId()).remove(id);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
|
@ -74,7 +74,7 @@ public class InstanceManager implements IXmlReader
|
|||||||
private int _currentInstanceId = 0;
|
private int _currentInstanceId = 0;
|
||||||
private final Map<Integer, Instance> _instanceWorlds = new ConcurrentHashMap<>();
|
private final Map<Integer, Instance> _instanceWorlds = new ConcurrentHashMap<>();
|
||||||
// Player reenter times
|
// Player reenter times
|
||||||
private final Map<Integer, Map<Integer, Long>> _PlayerTimes = new ConcurrentHashMap<>();
|
private final Map<Integer, Map<Integer, Long>> _playerTimes = new ConcurrentHashMap<>();
|
||||||
|
|
||||||
protected InstanceManager()
|
protected InstanceManager()
|
||||||
{
|
{
|
||||||
@ -96,9 +96,9 @@ public class InstanceManager implements IXmlReader
|
|||||||
parseDatapackDirectory("data/instances", true);
|
parseDatapackDirectory("data/instances", true);
|
||||||
LOGGER.info(getClass().getSimpleName() + ": Loaded " + _instanceTemplates.size() + " instance templates.");
|
LOGGER.info(getClass().getSimpleName() + ": Loaded " + _instanceTemplates.size() + " instance templates.");
|
||||||
// Load player's reenter data
|
// Load player's reenter data
|
||||||
_PlayerTimes.clear();
|
_playerTimes.clear();
|
||||||
restoreInstanceTimes();
|
restoreInstanceTimes();
|
||||||
LOGGER.info(getClass().getSimpleName() + ": Loaded instance reenter times for " + _PlayerTimes.size() + " players.");
|
LOGGER.info(getClass().getSimpleName() + ": Loaded instance reenter times for " + _playerTimes.size() + " players.");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -545,7 +545,7 @@ public class InstanceManager implements IXmlReader
|
|||||||
public Map<Integer, Long> getAllInstanceTimes(Player player)
|
public Map<Integer, Long> getAllInstanceTimes(Player player)
|
||||||
{
|
{
|
||||||
// When player don't have any instance penalty
|
// When player don't have any instance penalty
|
||||||
final Map<Integer, Long> instanceTimes = _PlayerTimes.get(player.getObjectId());
|
final Map<Integer, Long> instanceTimes = _playerTimes.get(player.getObjectId());
|
||||||
if ((instanceTimes == null) || instanceTimes.isEmpty())
|
if ((instanceTimes == null) || instanceTimes.isEmpty())
|
||||||
{
|
{
|
||||||
return Collections.emptyMap();
|
return Collections.emptyMap();
|
||||||
@ -593,7 +593,7 @@ public class InstanceManager implements IXmlReader
|
|||||||
*/
|
*/
|
||||||
public void setReenterPenalty(int objectId, int id, long time)
|
public void setReenterPenalty(int objectId, int id, long time)
|
||||||
{
|
{
|
||||||
_PlayerTimes.computeIfAbsent(objectId, k -> new ConcurrentHashMap<>()).put(id, time);
|
_playerTimes.computeIfAbsent(objectId, k -> new ConcurrentHashMap<>()).put(id, time);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -606,7 +606,7 @@ public class InstanceManager implements IXmlReader
|
|||||||
public long getInstanceTime(Player player, int id)
|
public long getInstanceTime(Player player, int id)
|
||||||
{
|
{
|
||||||
// Check if exists reenter data for player
|
// Check if exists reenter data for player
|
||||||
final Map<Integer, Long> playerData = _PlayerTimes.get(player.getObjectId());
|
final Map<Integer, Long> playerData = _playerTimes.get(player.getObjectId());
|
||||||
if ((playerData == null) || !playerData.containsKey(id))
|
if ((playerData == null) || !playerData.containsKey(id))
|
||||||
{
|
{
|
||||||
return -1;
|
return -1;
|
||||||
@ -635,9 +635,9 @@ public class InstanceManager implements IXmlReader
|
|||||||
ps.setInt(1, player.getObjectId());
|
ps.setInt(1, player.getObjectId());
|
||||||
ps.setInt(2, id);
|
ps.setInt(2, id);
|
||||||
ps.execute();
|
ps.execute();
|
||||||
if (_PlayerTimes.get(player.getObjectId()) != null)
|
if (_playerTimes.get(player.getObjectId()) != null)
|
||||||
{
|
{
|
||||||
_PlayerTimes.get(player.getObjectId()).remove(id);
|
_playerTimes.get(player.getObjectId()).remove(id);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
|
@ -74,7 +74,7 @@ public class InstanceManager implements IXmlReader
|
|||||||
private int _currentInstanceId = 0;
|
private int _currentInstanceId = 0;
|
||||||
private final Map<Integer, Instance> _instanceWorlds = new ConcurrentHashMap<>();
|
private final Map<Integer, Instance> _instanceWorlds = new ConcurrentHashMap<>();
|
||||||
// Player reenter times
|
// Player reenter times
|
||||||
private final Map<Integer, Map<Integer, Long>> _PlayerTimes = new ConcurrentHashMap<>();
|
private final Map<Integer, Map<Integer, Long>> _playerTimes = new ConcurrentHashMap<>();
|
||||||
|
|
||||||
protected InstanceManager()
|
protected InstanceManager()
|
||||||
{
|
{
|
||||||
@ -96,9 +96,9 @@ public class InstanceManager implements IXmlReader
|
|||||||
parseDatapackDirectory("data/instances", true);
|
parseDatapackDirectory("data/instances", true);
|
||||||
LOGGER.info(getClass().getSimpleName() + ": Loaded " + _instanceTemplates.size() + " instance templates.");
|
LOGGER.info(getClass().getSimpleName() + ": Loaded " + _instanceTemplates.size() + " instance templates.");
|
||||||
// Load player's reenter data
|
// Load player's reenter data
|
||||||
_PlayerTimes.clear();
|
_playerTimes.clear();
|
||||||
restoreInstanceTimes();
|
restoreInstanceTimes();
|
||||||
LOGGER.info(getClass().getSimpleName() + ": Loaded instance reenter times for " + _PlayerTimes.size() + " players.");
|
LOGGER.info(getClass().getSimpleName() + ": Loaded instance reenter times for " + _playerTimes.size() + " players.");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -545,7 +545,7 @@ public class InstanceManager implements IXmlReader
|
|||||||
public Map<Integer, Long> getAllInstanceTimes(Player player)
|
public Map<Integer, Long> getAllInstanceTimes(Player player)
|
||||||
{
|
{
|
||||||
// When player don't have any instance penalty
|
// When player don't have any instance penalty
|
||||||
final Map<Integer, Long> instanceTimes = _PlayerTimes.get(player.getObjectId());
|
final Map<Integer, Long> instanceTimes = _playerTimes.get(player.getObjectId());
|
||||||
if ((instanceTimes == null) || instanceTimes.isEmpty())
|
if ((instanceTimes == null) || instanceTimes.isEmpty())
|
||||||
{
|
{
|
||||||
return Collections.emptyMap();
|
return Collections.emptyMap();
|
||||||
@ -593,7 +593,7 @@ public class InstanceManager implements IXmlReader
|
|||||||
*/
|
*/
|
||||||
public void setReenterPenalty(int objectId, int id, long time)
|
public void setReenterPenalty(int objectId, int id, long time)
|
||||||
{
|
{
|
||||||
_PlayerTimes.computeIfAbsent(objectId, k -> new ConcurrentHashMap<>()).put(id, time);
|
_playerTimes.computeIfAbsent(objectId, k -> new ConcurrentHashMap<>()).put(id, time);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -606,7 +606,7 @@ public class InstanceManager implements IXmlReader
|
|||||||
public long getInstanceTime(Player player, int id)
|
public long getInstanceTime(Player player, int id)
|
||||||
{
|
{
|
||||||
// Check if exists reenter data for player
|
// Check if exists reenter data for player
|
||||||
final Map<Integer, Long> playerData = _PlayerTimes.get(player.getObjectId());
|
final Map<Integer, Long> playerData = _playerTimes.get(player.getObjectId());
|
||||||
if ((playerData == null) || !playerData.containsKey(id))
|
if ((playerData == null) || !playerData.containsKey(id))
|
||||||
{
|
{
|
||||||
return -1;
|
return -1;
|
||||||
@ -635,9 +635,9 @@ public class InstanceManager implements IXmlReader
|
|||||||
ps.setInt(1, player.getObjectId());
|
ps.setInt(1, player.getObjectId());
|
||||||
ps.setInt(2, id);
|
ps.setInt(2, id);
|
||||||
ps.execute();
|
ps.execute();
|
||||||
if (_PlayerTimes.get(player.getObjectId()) != null)
|
if (_playerTimes.get(player.getObjectId()) != null)
|
||||||
{
|
{
|
||||||
_PlayerTimes.get(player.getObjectId()).remove(id);
|
_playerTimes.get(player.getObjectId()).remove(id);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
|
@ -74,7 +74,7 @@ public class InstanceManager implements IXmlReader
|
|||||||
private int _currentInstanceId = 0;
|
private int _currentInstanceId = 0;
|
||||||
private final Map<Integer, Instance> _instanceWorlds = new ConcurrentHashMap<>();
|
private final Map<Integer, Instance> _instanceWorlds = new ConcurrentHashMap<>();
|
||||||
// Player reenter times
|
// Player reenter times
|
||||||
private final Map<Integer, Map<Integer, Long>> _PlayerTimes = new ConcurrentHashMap<>();
|
private final Map<Integer, Map<Integer, Long>> _playerTimes = new ConcurrentHashMap<>();
|
||||||
|
|
||||||
protected InstanceManager()
|
protected InstanceManager()
|
||||||
{
|
{
|
||||||
@ -96,9 +96,9 @@ public class InstanceManager implements IXmlReader
|
|||||||
parseDatapackDirectory("data/instances", true);
|
parseDatapackDirectory("data/instances", true);
|
||||||
LOGGER.info(getClass().getSimpleName() + ": Loaded " + _instanceTemplates.size() + " instance templates.");
|
LOGGER.info(getClass().getSimpleName() + ": Loaded " + _instanceTemplates.size() + " instance templates.");
|
||||||
// Load player's reenter data
|
// Load player's reenter data
|
||||||
_PlayerTimes.clear();
|
_playerTimes.clear();
|
||||||
restoreInstanceTimes();
|
restoreInstanceTimes();
|
||||||
LOGGER.info(getClass().getSimpleName() + ": Loaded instance reenter times for " + _PlayerTimes.size() + " players.");
|
LOGGER.info(getClass().getSimpleName() + ": Loaded instance reenter times for " + _playerTimes.size() + " players.");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -545,7 +545,7 @@ public class InstanceManager implements IXmlReader
|
|||||||
public Map<Integer, Long> getAllInstanceTimes(Player player)
|
public Map<Integer, Long> getAllInstanceTimes(Player player)
|
||||||
{
|
{
|
||||||
// When player don't have any instance penalty
|
// When player don't have any instance penalty
|
||||||
final Map<Integer, Long> instanceTimes = _PlayerTimes.get(player.getObjectId());
|
final Map<Integer, Long> instanceTimes = _playerTimes.get(player.getObjectId());
|
||||||
if ((instanceTimes == null) || instanceTimes.isEmpty())
|
if ((instanceTimes == null) || instanceTimes.isEmpty())
|
||||||
{
|
{
|
||||||
return Collections.emptyMap();
|
return Collections.emptyMap();
|
||||||
@ -593,7 +593,7 @@ public class InstanceManager implements IXmlReader
|
|||||||
*/
|
*/
|
||||||
public void setReenterPenalty(int objectId, int id, long time)
|
public void setReenterPenalty(int objectId, int id, long time)
|
||||||
{
|
{
|
||||||
_PlayerTimes.computeIfAbsent(objectId, k -> new ConcurrentHashMap<>()).put(id, time);
|
_playerTimes.computeIfAbsent(objectId, k -> new ConcurrentHashMap<>()).put(id, time);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -606,7 +606,7 @@ public class InstanceManager implements IXmlReader
|
|||||||
public long getInstanceTime(Player player, int id)
|
public long getInstanceTime(Player player, int id)
|
||||||
{
|
{
|
||||||
// Check if exists reenter data for player
|
// Check if exists reenter data for player
|
||||||
final Map<Integer, Long> playerData = _PlayerTimes.get(player.getObjectId());
|
final Map<Integer, Long> playerData = _playerTimes.get(player.getObjectId());
|
||||||
if ((playerData == null) || !playerData.containsKey(id))
|
if ((playerData == null) || !playerData.containsKey(id))
|
||||||
{
|
{
|
||||||
return -1;
|
return -1;
|
||||||
@ -635,9 +635,9 @@ public class InstanceManager implements IXmlReader
|
|||||||
ps.setInt(1, player.getObjectId());
|
ps.setInt(1, player.getObjectId());
|
||||||
ps.setInt(2, id);
|
ps.setInt(2, id);
|
||||||
ps.execute();
|
ps.execute();
|
||||||
if (_PlayerTimes.get(player.getObjectId()) != null)
|
if (_playerTimes.get(player.getObjectId()) != null)
|
||||||
{
|
{
|
||||||
_PlayerTimes.get(player.getObjectId()).remove(id);
|
_playerTimes.get(player.getObjectId()).remove(id);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
|
@ -74,7 +74,7 @@ public class InstanceManager implements IXmlReader
|
|||||||
private int _currentInstanceId = 0;
|
private int _currentInstanceId = 0;
|
||||||
private final Map<Integer, Instance> _instanceWorlds = new ConcurrentHashMap<>();
|
private final Map<Integer, Instance> _instanceWorlds = new ConcurrentHashMap<>();
|
||||||
// Player reenter times
|
// Player reenter times
|
||||||
private final Map<Integer, Map<Integer, Long>> _PlayerTimes = new ConcurrentHashMap<>();
|
private final Map<Integer, Map<Integer, Long>> _playerTimes = new ConcurrentHashMap<>();
|
||||||
|
|
||||||
protected InstanceManager()
|
protected InstanceManager()
|
||||||
{
|
{
|
||||||
@ -96,9 +96,9 @@ public class InstanceManager implements IXmlReader
|
|||||||
parseDatapackDirectory("data/instances", true);
|
parseDatapackDirectory("data/instances", true);
|
||||||
LOGGER.info(getClass().getSimpleName() + ": Loaded " + _instanceTemplates.size() + " instance templates.");
|
LOGGER.info(getClass().getSimpleName() + ": Loaded " + _instanceTemplates.size() + " instance templates.");
|
||||||
// Load player's reenter data
|
// Load player's reenter data
|
||||||
_PlayerTimes.clear();
|
_playerTimes.clear();
|
||||||
restoreInstanceTimes();
|
restoreInstanceTimes();
|
||||||
LOGGER.info(getClass().getSimpleName() + ": Loaded instance reenter times for " + _PlayerTimes.size() + " players.");
|
LOGGER.info(getClass().getSimpleName() + ": Loaded instance reenter times for " + _playerTimes.size() + " players.");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -545,7 +545,7 @@ public class InstanceManager implements IXmlReader
|
|||||||
public Map<Integer, Long> getAllInstanceTimes(Player player)
|
public Map<Integer, Long> getAllInstanceTimes(Player player)
|
||||||
{
|
{
|
||||||
// When player don't have any instance penalty
|
// When player don't have any instance penalty
|
||||||
final Map<Integer, Long> instanceTimes = _PlayerTimes.get(player.getObjectId());
|
final Map<Integer, Long> instanceTimes = _playerTimes.get(player.getObjectId());
|
||||||
if ((instanceTimes == null) || instanceTimes.isEmpty())
|
if ((instanceTimes == null) || instanceTimes.isEmpty())
|
||||||
{
|
{
|
||||||
return Collections.emptyMap();
|
return Collections.emptyMap();
|
||||||
@ -593,7 +593,7 @@ public class InstanceManager implements IXmlReader
|
|||||||
*/
|
*/
|
||||||
public void setReenterPenalty(int objectId, int id, long time)
|
public void setReenterPenalty(int objectId, int id, long time)
|
||||||
{
|
{
|
||||||
_PlayerTimes.computeIfAbsent(objectId, k -> new ConcurrentHashMap<>()).put(id, time);
|
_playerTimes.computeIfAbsent(objectId, k -> new ConcurrentHashMap<>()).put(id, time);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -606,7 +606,7 @@ public class InstanceManager implements IXmlReader
|
|||||||
public long getInstanceTime(Player player, int id)
|
public long getInstanceTime(Player player, int id)
|
||||||
{
|
{
|
||||||
// Check if exists reenter data for player
|
// Check if exists reenter data for player
|
||||||
final Map<Integer, Long> playerData = _PlayerTimes.get(player.getObjectId());
|
final Map<Integer, Long> playerData = _playerTimes.get(player.getObjectId());
|
||||||
if ((playerData == null) || !playerData.containsKey(id))
|
if ((playerData == null) || !playerData.containsKey(id))
|
||||||
{
|
{
|
||||||
return -1;
|
return -1;
|
||||||
@ -635,9 +635,9 @@ public class InstanceManager implements IXmlReader
|
|||||||
ps.setInt(1, player.getObjectId());
|
ps.setInt(1, player.getObjectId());
|
||||||
ps.setInt(2, id);
|
ps.setInt(2, id);
|
||||||
ps.execute();
|
ps.execute();
|
||||||
if (_PlayerTimes.get(player.getObjectId()) != null)
|
if (_playerTimes.get(player.getObjectId()) != null)
|
||||||
{
|
{
|
||||||
_PlayerTimes.get(player.getObjectId()).remove(id);
|
_playerTimes.get(player.getObjectId()).remove(id);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
|
@ -74,7 +74,7 @@ public class InstanceManager implements IXmlReader
|
|||||||
private int _currentInstanceId = 0;
|
private int _currentInstanceId = 0;
|
||||||
private final Map<Integer, Instance> _instanceWorlds = new ConcurrentHashMap<>();
|
private final Map<Integer, Instance> _instanceWorlds = new ConcurrentHashMap<>();
|
||||||
// Player reenter times
|
// Player reenter times
|
||||||
private final Map<Integer, Map<Integer, Long>> _PlayerTimes = new ConcurrentHashMap<>();
|
private final Map<Integer, Map<Integer, Long>> _playerTimes = new ConcurrentHashMap<>();
|
||||||
|
|
||||||
protected InstanceManager()
|
protected InstanceManager()
|
||||||
{
|
{
|
||||||
@ -96,9 +96,9 @@ public class InstanceManager implements IXmlReader
|
|||||||
parseDatapackDirectory("data/instances", true);
|
parseDatapackDirectory("data/instances", true);
|
||||||
LOGGER.info(getClass().getSimpleName() + ": Loaded " + _instanceTemplates.size() + " instance templates.");
|
LOGGER.info(getClass().getSimpleName() + ": Loaded " + _instanceTemplates.size() + " instance templates.");
|
||||||
// Load player's reenter data
|
// Load player's reenter data
|
||||||
_PlayerTimes.clear();
|
_playerTimes.clear();
|
||||||
restoreInstanceTimes();
|
restoreInstanceTimes();
|
||||||
LOGGER.info(getClass().getSimpleName() + ": Loaded instance reenter times for " + _PlayerTimes.size() + " players.");
|
LOGGER.info(getClass().getSimpleName() + ": Loaded instance reenter times for " + _playerTimes.size() + " players.");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -545,7 +545,7 @@ public class InstanceManager implements IXmlReader
|
|||||||
public Map<Integer, Long> getAllInstanceTimes(Player player)
|
public Map<Integer, Long> getAllInstanceTimes(Player player)
|
||||||
{
|
{
|
||||||
// When player don't have any instance penalty
|
// When player don't have any instance penalty
|
||||||
final Map<Integer, Long> instanceTimes = _PlayerTimes.get(player.getObjectId());
|
final Map<Integer, Long> instanceTimes = _playerTimes.get(player.getObjectId());
|
||||||
if ((instanceTimes == null) || instanceTimes.isEmpty())
|
if ((instanceTimes == null) || instanceTimes.isEmpty())
|
||||||
{
|
{
|
||||||
return Collections.emptyMap();
|
return Collections.emptyMap();
|
||||||
@ -593,7 +593,7 @@ public class InstanceManager implements IXmlReader
|
|||||||
*/
|
*/
|
||||||
public void setReenterPenalty(int objectId, int id, long time)
|
public void setReenterPenalty(int objectId, int id, long time)
|
||||||
{
|
{
|
||||||
_PlayerTimes.computeIfAbsent(objectId, k -> new ConcurrentHashMap<>()).put(id, time);
|
_playerTimes.computeIfAbsent(objectId, k -> new ConcurrentHashMap<>()).put(id, time);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -606,7 +606,7 @@ public class InstanceManager implements IXmlReader
|
|||||||
public long getInstanceTime(Player player, int id)
|
public long getInstanceTime(Player player, int id)
|
||||||
{
|
{
|
||||||
// Check if exists reenter data for player
|
// Check if exists reenter data for player
|
||||||
final Map<Integer, Long> playerData = _PlayerTimes.get(player.getObjectId());
|
final Map<Integer, Long> playerData = _playerTimes.get(player.getObjectId());
|
||||||
if ((playerData == null) || !playerData.containsKey(id))
|
if ((playerData == null) || !playerData.containsKey(id))
|
||||||
{
|
{
|
||||||
return -1;
|
return -1;
|
||||||
@ -635,9 +635,9 @@ public class InstanceManager implements IXmlReader
|
|||||||
ps.setInt(1, player.getObjectId());
|
ps.setInt(1, player.getObjectId());
|
||||||
ps.setInt(2, id);
|
ps.setInt(2, id);
|
||||||
ps.execute();
|
ps.execute();
|
||||||
if (_PlayerTimes.get(player.getObjectId()) != null)
|
if (_playerTimes.get(player.getObjectId()) != null)
|
||||||
{
|
{
|
||||||
_PlayerTimes.get(player.getObjectId()).remove(id);
|
_playerTimes.get(player.getObjectId()).remove(id);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
|
@ -74,7 +74,7 @@ public class InstanceManager implements IXmlReader
|
|||||||
private int _currentInstanceId = 0;
|
private int _currentInstanceId = 0;
|
||||||
private final Map<Integer, Instance> _instanceWorlds = new ConcurrentHashMap<>();
|
private final Map<Integer, Instance> _instanceWorlds = new ConcurrentHashMap<>();
|
||||||
// Player reenter times
|
// Player reenter times
|
||||||
private final Map<Integer, Map<Integer, Long>> _PlayerTimes = new ConcurrentHashMap<>();
|
private final Map<Integer, Map<Integer, Long>> _playerTimes = new ConcurrentHashMap<>();
|
||||||
|
|
||||||
protected InstanceManager()
|
protected InstanceManager()
|
||||||
{
|
{
|
||||||
@ -96,9 +96,9 @@ public class InstanceManager implements IXmlReader
|
|||||||
parseDatapackDirectory("data/instances", true);
|
parseDatapackDirectory("data/instances", true);
|
||||||
LOGGER.info(getClass().getSimpleName() + ": Loaded " + _instanceTemplates.size() + " instance templates.");
|
LOGGER.info(getClass().getSimpleName() + ": Loaded " + _instanceTemplates.size() + " instance templates.");
|
||||||
// Load player's reenter data
|
// Load player's reenter data
|
||||||
_PlayerTimes.clear();
|
_playerTimes.clear();
|
||||||
restoreInstanceTimes();
|
restoreInstanceTimes();
|
||||||
LOGGER.info(getClass().getSimpleName() + ": Loaded instance reenter times for " + _PlayerTimes.size() + " players.");
|
LOGGER.info(getClass().getSimpleName() + ": Loaded instance reenter times for " + _playerTimes.size() + " players.");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -545,7 +545,7 @@ public class InstanceManager implements IXmlReader
|
|||||||
public Map<Integer, Long> getAllInstanceTimes(Player player)
|
public Map<Integer, Long> getAllInstanceTimes(Player player)
|
||||||
{
|
{
|
||||||
// When player don't have any instance penalty
|
// When player don't have any instance penalty
|
||||||
final Map<Integer, Long> instanceTimes = _PlayerTimes.get(player.getObjectId());
|
final Map<Integer, Long> instanceTimes = _playerTimes.get(player.getObjectId());
|
||||||
if ((instanceTimes == null) || instanceTimes.isEmpty())
|
if ((instanceTimes == null) || instanceTimes.isEmpty())
|
||||||
{
|
{
|
||||||
return Collections.emptyMap();
|
return Collections.emptyMap();
|
||||||
@ -593,7 +593,7 @@ public class InstanceManager implements IXmlReader
|
|||||||
*/
|
*/
|
||||||
public void setReenterPenalty(int objectId, int id, long time)
|
public void setReenterPenalty(int objectId, int id, long time)
|
||||||
{
|
{
|
||||||
_PlayerTimes.computeIfAbsent(objectId, k -> new ConcurrentHashMap<>()).put(id, time);
|
_playerTimes.computeIfAbsent(objectId, k -> new ConcurrentHashMap<>()).put(id, time);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -606,7 +606,7 @@ public class InstanceManager implements IXmlReader
|
|||||||
public long getInstanceTime(Player player, int id)
|
public long getInstanceTime(Player player, int id)
|
||||||
{
|
{
|
||||||
// Check if exists reenter data for player
|
// Check if exists reenter data for player
|
||||||
final Map<Integer, Long> playerData = _PlayerTimes.get(player.getObjectId());
|
final Map<Integer, Long> playerData = _playerTimes.get(player.getObjectId());
|
||||||
if ((playerData == null) || !playerData.containsKey(id))
|
if ((playerData == null) || !playerData.containsKey(id))
|
||||||
{
|
{
|
||||||
return -1;
|
return -1;
|
||||||
@ -635,9 +635,9 @@ public class InstanceManager implements IXmlReader
|
|||||||
ps.setInt(1, player.getObjectId());
|
ps.setInt(1, player.getObjectId());
|
||||||
ps.setInt(2, id);
|
ps.setInt(2, id);
|
||||||
ps.execute();
|
ps.execute();
|
||||||
if (_PlayerTimes.get(player.getObjectId()) != null)
|
if (_playerTimes.get(player.getObjectId()) != null)
|
||||||
{
|
{
|
||||||
_PlayerTimes.get(player.getObjectId()).remove(id);
|
_playerTimes.get(player.getObjectId()).remove(id);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
|
@ -74,7 +74,7 @@ public class InstanceManager implements IXmlReader
|
|||||||
private int _currentInstanceId = 0;
|
private int _currentInstanceId = 0;
|
||||||
private final Map<Integer, Instance> _instanceWorlds = new ConcurrentHashMap<>();
|
private final Map<Integer, Instance> _instanceWorlds = new ConcurrentHashMap<>();
|
||||||
// Player reenter times
|
// Player reenter times
|
||||||
private final Map<Integer, Map<Integer, Long>> _PlayerTimes = new ConcurrentHashMap<>();
|
private final Map<Integer, Map<Integer, Long>> _playerTimes = new ConcurrentHashMap<>();
|
||||||
|
|
||||||
protected InstanceManager()
|
protected InstanceManager()
|
||||||
{
|
{
|
||||||
@ -96,9 +96,9 @@ public class InstanceManager implements IXmlReader
|
|||||||
parseDatapackDirectory("data/instances", true);
|
parseDatapackDirectory("data/instances", true);
|
||||||
LOGGER.info(getClass().getSimpleName() + ": Loaded " + _instanceTemplates.size() + " instance templates.");
|
LOGGER.info(getClass().getSimpleName() + ": Loaded " + _instanceTemplates.size() + " instance templates.");
|
||||||
// Load player's reenter data
|
// Load player's reenter data
|
||||||
_PlayerTimes.clear();
|
_playerTimes.clear();
|
||||||
restoreInstanceTimes();
|
restoreInstanceTimes();
|
||||||
LOGGER.info(getClass().getSimpleName() + ": Loaded instance reenter times for " + _PlayerTimes.size() + " players.");
|
LOGGER.info(getClass().getSimpleName() + ": Loaded instance reenter times for " + _playerTimes.size() + " players.");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -545,7 +545,7 @@ public class InstanceManager implements IXmlReader
|
|||||||
public Map<Integer, Long> getAllInstanceTimes(Player player)
|
public Map<Integer, Long> getAllInstanceTimes(Player player)
|
||||||
{
|
{
|
||||||
// When player don't have any instance penalty
|
// When player don't have any instance penalty
|
||||||
final Map<Integer, Long> instanceTimes = _PlayerTimes.get(player.getObjectId());
|
final Map<Integer, Long> instanceTimes = _playerTimes.get(player.getObjectId());
|
||||||
if ((instanceTimes == null) || instanceTimes.isEmpty())
|
if ((instanceTimes == null) || instanceTimes.isEmpty())
|
||||||
{
|
{
|
||||||
return Collections.emptyMap();
|
return Collections.emptyMap();
|
||||||
@ -593,7 +593,7 @@ public class InstanceManager implements IXmlReader
|
|||||||
*/
|
*/
|
||||||
public void setReenterPenalty(int objectId, int id, long time)
|
public void setReenterPenalty(int objectId, int id, long time)
|
||||||
{
|
{
|
||||||
_PlayerTimes.computeIfAbsent(objectId, k -> new ConcurrentHashMap<>()).put(id, time);
|
_playerTimes.computeIfAbsent(objectId, k -> new ConcurrentHashMap<>()).put(id, time);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -606,7 +606,7 @@ public class InstanceManager implements IXmlReader
|
|||||||
public long getInstanceTime(Player player, int id)
|
public long getInstanceTime(Player player, int id)
|
||||||
{
|
{
|
||||||
// Check if exists reenter data for player
|
// Check if exists reenter data for player
|
||||||
final Map<Integer, Long> playerData = _PlayerTimes.get(player.getObjectId());
|
final Map<Integer, Long> playerData = _playerTimes.get(player.getObjectId());
|
||||||
if ((playerData == null) || !playerData.containsKey(id))
|
if ((playerData == null) || !playerData.containsKey(id))
|
||||||
{
|
{
|
||||||
return -1;
|
return -1;
|
||||||
@ -635,9 +635,9 @@ public class InstanceManager implements IXmlReader
|
|||||||
ps.setInt(1, player.getObjectId());
|
ps.setInt(1, player.getObjectId());
|
||||||
ps.setInt(2, id);
|
ps.setInt(2, id);
|
||||||
ps.execute();
|
ps.execute();
|
||||||
if (_PlayerTimes.get(player.getObjectId()) != null)
|
if (_playerTimes.get(player.getObjectId()) != null)
|
||||||
{
|
{
|
||||||
_PlayerTimes.get(player.getObjectId()).remove(id);
|
_playerTimes.get(player.getObjectId()).remove(id);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
|
@ -74,7 +74,7 @@ public class InstanceManager implements IXmlReader
|
|||||||
private int _currentInstanceId = 0;
|
private int _currentInstanceId = 0;
|
||||||
private final Map<Integer, Instance> _instanceWorlds = new ConcurrentHashMap<>();
|
private final Map<Integer, Instance> _instanceWorlds = new ConcurrentHashMap<>();
|
||||||
// Player reenter times
|
// Player reenter times
|
||||||
private final Map<Integer, Map<Integer, Long>> _PlayerTimes = new ConcurrentHashMap<>();
|
private final Map<Integer, Map<Integer, Long>> _playerTimes = new ConcurrentHashMap<>();
|
||||||
|
|
||||||
protected InstanceManager()
|
protected InstanceManager()
|
||||||
{
|
{
|
||||||
@ -96,9 +96,9 @@ public class InstanceManager implements IXmlReader
|
|||||||
parseDatapackDirectory("data/instances", true);
|
parseDatapackDirectory("data/instances", true);
|
||||||
LOGGER.info(getClass().getSimpleName() + ": Loaded " + _instanceTemplates.size() + " instance templates.");
|
LOGGER.info(getClass().getSimpleName() + ": Loaded " + _instanceTemplates.size() + " instance templates.");
|
||||||
// Load player's reenter data
|
// Load player's reenter data
|
||||||
_PlayerTimes.clear();
|
_playerTimes.clear();
|
||||||
restoreInstanceTimes();
|
restoreInstanceTimes();
|
||||||
LOGGER.info(getClass().getSimpleName() + ": Loaded instance reenter times for " + _PlayerTimes.size() + " players.");
|
LOGGER.info(getClass().getSimpleName() + ": Loaded instance reenter times for " + _playerTimes.size() + " players.");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -549,7 +549,7 @@ public class InstanceManager implements IXmlReader
|
|||||||
public Map<Integer, Long> getAllInstanceTimes(Player player)
|
public Map<Integer, Long> getAllInstanceTimes(Player player)
|
||||||
{
|
{
|
||||||
// When player don't have any instance penalty
|
// When player don't have any instance penalty
|
||||||
final Map<Integer, Long> instanceTimes = _PlayerTimes.get(player.getObjectId());
|
final Map<Integer, Long> instanceTimes = _playerTimes.get(player.getObjectId());
|
||||||
if ((instanceTimes == null) || instanceTimes.isEmpty())
|
if ((instanceTimes == null) || instanceTimes.isEmpty())
|
||||||
{
|
{
|
||||||
return Collections.emptyMap();
|
return Collections.emptyMap();
|
||||||
@ -597,7 +597,7 @@ public class InstanceManager implements IXmlReader
|
|||||||
*/
|
*/
|
||||||
public void setReenterPenalty(int objectId, int id, long time)
|
public void setReenterPenalty(int objectId, int id, long time)
|
||||||
{
|
{
|
||||||
_PlayerTimes.computeIfAbsent(objectId, k -> new ConcurrentHashMap<>()).put(id, time);
|
_playerTimes.computeIfAbsent(objectId, k -> new ConcurrentHashMap<>()).put(id, time);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -610,7 +610,7 @@ public class InstanceManager implements IXmlReader
|
|||||||
public long getInstanceTime(Player player, int id)
|
public long getInstanceTime(Player player, int id)
|
||||||
{
|
{
|
||||||
// Check if exists reenter data for player
|
// Check if exists reenter data for player
|
||||||
final Map<Integer, Long> playerData = _PlayerTimes.get(player.getObjectId());
|
final Map<Integer, Long> playerData = _playerTimes.get(player.getObjectId());
|
||||||
if ((playerData == null) || !playerData.containsKey(id))
|
if ((playerData == null) || !playerData.containsKey(id))
|
||||||
{
|
{
|
||||||
return -1;
|
return -1;
|
||||||
@ -639,9 +639,9 @@ public class InstanceManager implements IXmlReader
|
|||||||
ps.setInt(1, player.getObjectId());
|
ps.setInt(1, player.getObjectId());
|
||||||
ps.setInt(2, id);
|
ps.setInt(2, id);
|
||||||
ps.execute();
|
ps.execute();
|
||||||
if (_PlayerTimes.get(player.getObjectId()) != null)
|
if (_playerTimes.get(player.getObjectId()) != null)
|
||||||
{
|
{
|
||||||
_PlayerTimes.get(player.getObjectId()).remove(id);
|
_playerTimes.get(player.getObjectId()).remove(id);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
|
@ -74,7 +74,7 @@ public class InstanceManager implements IXmlReader
|
|||||||
private int _currentInstanceId = 0;
|
private int _currentInstanceId = 0;
|
||||||
private final Map<Integer, Instance> _instanceWorlds = new ConcurrentHashMap<>();
|
private final Map<Integer, Instance> _instanceWorlds = new ConcurrentHashMap<>();
|
||||||
// Player reenter times
|
// Player reenter times
|
||||||
private final Map<Integer, Map<Integer, Long>> _PlayerTimes = new ConcurrentHashMap<>();
|
private final Map<Integer, Map<Integer, Long>> _playerTimes = new ConcurrentHashMap<>();
|
||||||
|
|
||||||
protected InstanceManager()
|
protected InstanceManager()
|
||||||
{
|
{
|
||||||
@ -96,9 +96,9 @@ public class InstanceManager implements IXmlReader
|
|||||||
parseDatapackDirectory("data/instances", true);
|
parseDatapackDirectory("data/instances", true);
|
||||||
LOGGER.info(getClass().getSimpleName() + ": Loaded " + _instanceTemplates.size() + " instance templates.");
|
LOGGER.info(getClass().getSimpleName() + ": Loaded " + _instanceTemplates.size() + " instance templates.");
|
||||||
// Load player's reenter data
|
// Load player's reenter data
|
||||||
_PlayerTimes.clear();
|
_playerTimes.clear();
|
||||||
restoreInstanceTimes();
|
restoreInstanceTimes();
|
||||||
LOGGER.info(getClass().getSimpleName() + ": Loaded instance reenter times for " + _PlayerTimes.size() + " players.");
|
LOGGER.info(getClass().getSimpleName() + ": Loaded instance reenter times for " + _playerTimes.size() + " players.");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -549,7 +549,7 @@ public class InstanceManager implements IXmlReader
|
|||||||
public Map<Integer, Long> getAllInstanceTimes(Player player)
|
public Map<Integer, Long> getAllInstanceTimes(Player player)
|
||||||
{
|
{
|
||||||
// When player don't have any instance penalty
|
// When player don't have any instance penalty
|
||||||
final Map<Integer, Long> instanceTimes = _PlayerTimes.get(player.getObjectId());
|
final Map<Integer, Long> instanceTimes = _playerTimes.get(player.getObjectId());
|
||||||
if ((instanceTimes == null) || instanceTimes.isEmpty())
|
if ((instanceTimes == null) || instanceTimes.isEmpty())
|
||||||
{
|
{
|
||||||
return Collections.emptyMap();
|
return Collections.emptyMap();
|
||||||
@ -597,7 +597,7 @@ public class InstanceManager implements IXmlReader
|
|||||||
*/
|
*/
|
||||||
public void setReenterPenalty(int objectId, int id, long time)
|
public void setReenterPenalty(int objectId, int id, long time)
|
||||||
{
|
{
|
||||||
_PlayerTimes.computeIfAbsent(objectId, k -> new ConcurrentHashMap<>()).put(id, time);
|
_playerTimes.computeIfAbsent(objectId, k -> new ConcurrentHashMap<>()).put(id, time);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -610,7 +610,7 @@ public class InstanceManager implements IXmlReader
|
|||||||
public long getInstanceTime(Player player, int id)
|
public long getInstanceTime(Player player, int id)
|
||||||
{
|
{
|
||||||
// Check if exists reenter data for player
|
// Check if exists reenter data for player
|
||||||
final Map<Integer, Long> playerData = _PlayerTimes.get(player.getObjectId());
|
final Map<Integer, Long> playerData = _playerTimes.get(player.getObjectId());
|
||||||
if ((playerData == null) || !playerData.containsKey(id))
|
if ((playerData == null) || !playerData.containsKey(id))
|
||||||
{
|
{
|
||||||
return -1;
|
return -1;
|
||||||
@ -639,9 +639,9 @@ public class InstanceManager implements IXmlReader
|
|||||||
ps.setInt(1, player.getObjectId());
|
ps.setInt(1, player.getObjectId());
|
||||||
ps.setInt(2, id);
|
ps.setInt(2, id);
|
||||||
ps.execute();
|
ps.execute();
|
||||||
if (_PlayerTimes.get(player.getObjectId()) != null)
|
if (_playerTimes.get(player.getObjectId()) != null)
|
||||||
{
|
{
|
||||||
_PlayerTimes.get(player.getObjectId()).remove(id);
|
_playerTimes.get(player.getObjectId()).remove(id);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
|
@ -74,7 +74,7 @@ public class InstanceManager implements IXmlReader
|
|||||||
private int _currentInstanceId = 0;
|
private int _currentInstanceId = 0;
|
||||||
private final Map<Integer, Instance> _instanceWorlds = new ConcurrentHashMap<>();
|
private final Map<Integer, Instance> _instanceWorlds = new ConcurrentHashMap<>();
|
||||||
// Player reenter times
|
// Player reenter times
|
||||||
private final Map<Integer, Map<Integer, Long>> _PlayerTimes = new ConcurrentHashMap<>();
|
private final Map<Integer, Map<Integer, Long>> _playerTimes = new ConcurrentHashMap<>();
|
||||||
|
|
||||||
protected InstanceManager()
|
protected InstanceManager()
|
||||||
{
|
{
|
||||||
@ -96,9 +96,9 @@ public class InstanceManager implements IXmlReader
|
|||||||
parseDatapackDirectory("data/instances", true);
|
parseDatapackDirectory("data/instances", true);
|
||||||
LOGGER.info(getClass().getSimpleName() + ": Loaded " + _instanceTemplates.size() + " instance templates.");
|
LOGGER.info(getClass().getSimpleName() + ": Loaded " + _instanceTemplates.size() + " instance templates.");
|
||||||
// Load player's reenter data
|
// Load player's reenter data
|
||||||
_PlayerTimes.clear();
|
_playerTimes.clear();
|
||||||
restoreInstanceTimes();
|
restoreInstanceTimes();
|
||||||
LOGGER.info(getClass().getSimpleName() + ": Loaded instance reenter times for " + _PlayerTimes.size() + " players.");
|
LOGGER.info(getClass().getSimpleName() + ": Loaded instance reenter times for " + _playerTimes.size() + " players.");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -549,7 +549,7 @@ public class InstanceManager implements IXmlReader
|
|||||||
public Map<Integer, Long> getAllInstanceTimes(Player player)
|
public Map<Integer, Long> getAllInstanceTimes(Player player)
|
||||||
{
|
{
|
||||||
// When player don't have any instance penalty
|
// When player don't have any instance penalty
|
||||||
final Map<Integer, Long> instanceTimes = _PlayerTimes.get(player.getObjectId());
|
final Map<Integer, Long> instanceTimes = _playerTimes.get(player.getObjectId());
|
||||||
if ((instanceTimes == null) || instanceTimes.isEmpty())
|
if ((instanceTimes == null) || instanceTimes.isEmpty())
|
||||||
{
|
{
|
||||||
return Collections.emptyMap();
|
return Collections.emptyMap();
|
||||||
@ -597,7 +597,7 @@ public class InstanceManager implements IXmlReader
|
|||||||
*/
|
*/
|
||||||
public void setReenterPenalty(int objectId, int id, long time)
|
public void setReenterPenalty(int objectId, int id, long time)
|
||||||
{
|
{
|
||||||
_PlayerTimes.computeIfAbsent(objectId, k -> new ConcurrentHashMap<>()).put(id, time);
|
_playerTimes.computeIfAbsent(objectId, k -> new ConcurrentHashMap<>()).put(id, time);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -610,7 +610,7 @@ public class InstanceManager implements IXmlReader
|
|||||||
public long getInstanceTime(Player player, int id)
|
public long getInstanceTime(Player player, int id)
|
||||||
{
|
{
|
||||||
// Check if exists reenter data for player
|
// Check if exists reenter data for player
|
||||||
final Map<Integer, Long> playerData = _PlayerTimes.get(player.getObjectId());
|
final Map<Integer, Long> playerData = _playerTimes.get(player.getObjectId());
|
||||||
if ((playerData == null) || !playerData.containsKey(id))
|
if ((playerData == null) || !playerData.containsKey(id))
|
||||||
{
|
{
|
||||||
return -1;
|
return -1;
|
||||||
@ -639,9 +639,9 @@ public class InstanceManager implements IXmlReader
|
|||||||
ps.setInt(1, player.getObjectId());
|
ps.setInt(1, player.getObjectId());
|
||||||
ps.setInt(2, id);
|
ps.setInt(2, id);
|
||||||
ps.execute();
|
ps.execute();
|
||||||
if (_PlayerTimes.get(player.getObjectId()) != null)
|
if (_playerTimes.get(player.getObjectId()) != null)
|
||||||
{
|
{
|
||||||
_PlayerTimes.get(player.getObjectId()).remove(id);
|
_playerTimes.get(player.getObjectId()).remove(id);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
|
@ -74,7 +74,7 @@ public class InstanceManager implements IXmlReader
|
|||||||
private int _currentInstanceId = 0;
|
private int _currentInstanceId = 0;
|
||||||
private final Map<Integer, Instance> _instanceWorlds = new ConcurrentHashMap<>();
|
private final Map<Integer, Instance> _instanceWorlds = new ConcurrentHashMap<>();
|
||||||
// Player reenter times
|
// Player reenter times
|
||||||
private final Map<Integer, Map<Integer, Long>> _PlayerTimes = new ConcurrentHashMap<>();
|
private final Map<Integer, Map<Integer, Long>> _playerTimes = new ConcurrentHashMap<>();
|
||||||
|
|
||||||
protected InstanceManager()
|
protected InstanceManager()
|
||||||
{
|
{
|
||||||
@ -96,9 +96,9 @@ public class InstanceManager implements IXmlReader
|
|||||||
parseDatapackDirectory("data/instances", true);
|
parseDatapackDirectory("data/instances", true);
|
||||||
LOGGER.info(getClass().getSimpleName() + ": Loaded " + _instanceTemplates.size() + " instance templates.");
|
LOGGER.info(getClass().getSimpleName() + ": Loaded " + _instanceTemplates.size() + " instance templates.");
|
||||||
// Load player's reenter data
|
// Load player's reenter data
|
||||||
_PlayerTimes.clear();
|
_playerTimes.clear();
|
||||||
restoreInstanceTimes();
|
restoreInstanceTimes();
|
||||||
LOGGER.info(getClass().getSimpleName() + ": Loaded instance reenter times for " + _PlayerTimes.size() + " players.");
|
LOGGER.info(getClass().getSimpleName() + ": Loaded instance reenter times for " + _playerTimes.size() + " players.");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -549,7 +549,7 @@ public class InstanceManager implements IXmlReader
|
|||||||
public Map<Integer, Long> getAllInstanceTimes(Player player)
|
public Map<Integer, Long> getAllInstanceTimes(Player player)
|
||||||
{
|
{
|
||||||
// When player don't have any instance penalty
|
// When player don't have any instance penalty
|
||||||
final Map<Integer, Long> instanceTimes = _PlayerTimes.get(player.getObjectId());
|
final Map<Integer, Long> instanceTimes = _playerTimes.get(player.getObjectId());
|
||||||
if ((instanceTimes == null) || instanceTimes.isEmpty())
|
if ((instanceTimes == null) || instanceTimes.isEmpty())
|
||||||
{
|
{
|
||||||
return Collections.emptyMap();
|
return Collections.emptyMap();
|
||||||
@ -597,7 +597,7 @@ public class InstanceManager implements IXmlReader
|
|||||||
*/
|
*/
|
||||||
public void setReenterPenalty(int objectId, int id, long time)
|
public void setReenterPenalty(int objectId, int id, long time)
|
||||||
{
|
{
|
||||||
_PlayerTimes.computeIfAbsent(objectId, k -> new ConcurrentHashMap<>()).put(id, time);
|
_playerTimes.computeIfAbsent(objectId, k -> new ConcurrentHashMap<>()).put(id, time);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -610,7 +610,7 @@ public class InstanceManager implements IXmlReader
|
|||||||
public long getInstanceTime(Player player, int id)
|
public long getInstanceTime(Player player, int id)
|
||||||
{
|
{
|
||||||
// Check if exists reenter data for player
|
// Check if exists reenter data for player
|
||||||
final Map<Integer, Long> playerData = _PlayerTimes.get(player.getObjectId());
|
final Map<Integer, Long> playerData = _playerTimes.get(player.getObjectId());
|
||||||
if ((playerData == null) || !playerData.containsKey(id))
|
if ((playerData == null) || !playerData.containsKey(id))
|
||||||
{
|
{
|
||||||
return -1;
|
return -1;
|
||||||
@ -639,9 +639,9 @@ public class InstanceManager implements IXmlReader
|
|||||||
ps.setInt(1, player.getObjectId());
|
ps.setInt(1, player.getObjectId());
|
||||||
ps.setInt(2, id);
|
ps.setInt(2, id);
|
||||||
ps.execute();
|
ps.execute();
|
||||||
if (_PlayerTimes.get(player.getObjectId()) != null)
|
if (_playerTimes.get(player.getObjectId()) != null)
|
||||||
{
|
{
|
||||||
_PlayerTimes.get(player.getObjectId()).remove(id);
|
_playerTimes.get(player.getObjectId()).remove(id);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
|
@ -47,7 +47,7 @@ public class InstanceManager implements IXmlReader
|
|||||||
private static final Map<Integer, String> _instanceIdNames = new HashMap<>();
|
private static final Map<Integer, String> _instanceIdNames = new HashMap<>();
|
||||||
// Instance templates
|
// Instance templates
|
||||||
private final Map<Integer, String> _instanceTemplates = new ConcurrentHashMap<>();
|
private final Map<Integer, String> _instanceTemplates = new ConcurrentHashMap<>();
|
||||||
private final Map<Integer, Map<Integer, Long>> _PlayerTimes = new ConcurrentHashMap<>();
|
private final Map<Integer, Map<Integer, Long>> _playerTimes = new ConcurrentHashMap<>();
|
||||||
// SQL Queries
|
// SQL Queries
|
||||||
private static final String ADD_INSTANCE_TIME = "INSERT INTO character_instance_time (charId,instanceId,time) values (?,?,?) ON DUPLICATE KEY UPDATE time=?";
|
private static final String ADD_INSTANCE_TIME = "INSERT INTO character_instance_time (charId,instanceId,time) values (?,?,?) ON DUPLICATE KEY UPDATE time=?";
|
||||||
private static final String RESTORE_INSTANCE_TIMES = "SELECT instanceId,time FROM character_instance_time WHERE charId=?";
|
private static final String RESTORE_INSTANCE_TIMES = "SELECT instanceId,time FROM character_instance_time WHERE charId=?";
|
||||||
@ -92,13 +92,13 @@ public class InstanceManager implements IXmlReader
|
|||||||
*/
|
*/
|
||||||
public long getInstanceTime(int playerObjId, int id)
|
public long getInstanceTime(int playerObjId, int id)
|
||||||
{
|
{
|
||||||
if (!_PlayerTimes.containsKey(playerObjId))
|
if (!_playerTimes.containsKey(playerObjId))
|
||||||
{
|
{
|
||||||
restoreInstanceTimes(playerObjId);
|
restoreInstanceTimes(playerObjId);
|
||||||
}
|
}
|
||||||
if (_PlayerTimes.get(playerObjId).containsKey(id))
|
if (_playerTimes.get(playerObjId).containsKey(id))
|
||||||
{
|
{
|
||||||
return _PlayerTimes.get(playerObjId).get(id);
|
return _playerTimes.get(playerObjId).get(id);
|
||||||
}
|
}
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
@ -109,11 +109,11 @@ public class InstanceManager implements IXmlReader
|
|||||||
*/
|
*/
|
||||||
public Map<Integer, Long> getAllInstanceTimes(int playerObjId)
|
public Map<Integer, Long> getAllInstanceTimes(int playerObjId)
|
||||||
{
|
{
|
||||||
if (!_PlayerTimes.containsKey(playerObjId))
|
if (!_playerTimes.containsKey(playerObjId))
|
||||||
{
|
{
|
||||||
restoreInstanceTimes(playerObjId);
|
restoreInstanceTimes(playerObjId);
|
||||||
}
|
}
|
||||||
return _PlayerTimes.get(playerObjId);
|
return _playerTimes.get(playerObjId);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -123,7 +123,7 @@ public class InstanceManager implements IXmlReader
|
|||||||
*/
|
*/
|
||||||
public void setInstanceTime(int playerObjId, int id, long time)
|
public void setInstanceTime(int playerObjId, int id, long time)
|
||||||
{
|
{
|
||||||
if (!_PlayerTimes.containsKey(playerObjId))
|
if (!_playerTimes.containsKey(playerObjId))
|
||||||
{
|
{
|
||||||
restoreInstanceTimes(playerObjId);
|
restoreInstanceTimes(playerObjId);
|
||||||
}
|
}
|
||||||
@ -136,7 +136,7 @@ public class InstanceManager implements IXmlReader
|
|||||||
ps.setLong(3, time);
|
ps.setLong(3, time);
|
||||||
ps.setLong(4, time);
|
ps.setLong(4, time);
|
||||||
ps.execute();
|
ps.execute();
|
||||||
_PlayerTimes.get(playerObjId).put(id, time);
|
_playerTimes.get(playerObjId).put(id, time);
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
@ -156,7 +156,7 @@ public class InstanceManager implements IXmlReader
|
|||||||
ps.setInt(1, playerObjId);
|
ps.setInt(1, playerObjId);
|
||||||
ps.setInt(2, id);
|
ps.setInt(2, id);
|
||||||
ps.execute();
|
ps.execute();
|
||||||
_PlayerTimes.get(playerObjId).remove(id);
|
_playerTimes.get(playerObjId).remove(id);
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
@ -169,11 +169,11 @@ public class InstanceManager implements IXmlReader
|
|||||||
*/
|
*/
|
||||||
public void restoreInstanceTimes(int playerObjId)
|
public void restoreInstanceTimes(int playerObjId)
|
||||||
{
|
{
|
||||||
if (_PlayerTimes.containsKey(playerObjId))
|
if (_playerTimes.containsKey(playerObjId))
|
||||||
{
|
{
|
||||||
return; // already restored
|
return; // already restored
|
||||||
}
|
}
|
||||||
_PlayerTimes.put(playerObjId, new ConcurrentHashMap<>());
|
_playerTimes.put(playerObjId, new ConcurrentHashMap<>());
|
||||||
try (Connection con = DatabaseFactory.getConnection();
|
try (Connection con = DatabaseFactory.getConnection();
|
||||||
PreparedStatement ps = con.prepareStatement(RESTORE_INSTANCE_TIMES))
|
PreparedStatement ps = con.prepareStatement(RESTORE_INSTANCE_TIMES))
|
||||||
{
|
{
|
||||||
@ -190,7 +190,7 @@ public class InstanceManager implements IXmlReader
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
_PlayerTimes.get(playerObjId).put(id, time);
|
_playerTimes.get(playerObjId).put(id, time);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -47,7 +47,7 @@ public class InstanceManager implements IXmlReader
|
|||||||
private static final Map<Integer, String> _instanceIdNames = new HashMap<>();
|
private static final Map<Integer, String> _instanceIdNames = new HashMap<>();
|
||||||
// Instance templates
|
// Instance templates
|
||||||
private final Map<Integer, String> _instanceTemplates = new ConcurrentHashMap<>();
|
private final Map<Integer, String> _instanceTemplates = new ConcurrentHashMap<>();
|
||||||
private final Map<Integer, Map<Integer, Long>> _PlayerTimes = new ConcurrentHashMap<>();
|
private final Map<Integer, Map<Integer, Long>> _playerTimes = new ConcurrentHashMap<>();
|
||||||
// SQL Queries
|
// SQL Queries
|
||||||
private static final String ADD_INSTANCE_TIME = "INSERT INTO character_instance_time (charId,instanceId,time) values (?,?,?) ON DUPLICATE KEY UPDATE time=?";
|
private static final String ADD_INSTANCE_TIME = "INSERT INTO character_instance_time (charId,instanceId,time) values (?,?,?) ON DUPLICATE KEY UPDATE time=?";
|
||||||
private static final String RESTORE_INSTANCE_TIMES = "SELECT instanceId,time FROM character_instance_time WHERE charId=?";
|
private static final String RESTORE_INSTANCE_TIMES = "SELECT instanceId,time FROM character_instance_time WHERE charId=?";
|
||||||
@ -83,13 +83,13 @@ public class InstanceManager implements IXmlReader
|
|||||||
*/
|
*/
|
||||||
public long getInstanceTime(int playerObjId, int id)
|
public long getInstanceTime(int playerObjId, int id)
|
||||||
{
|
{
|
||||||
if (!_PlayerTimes.containsKey(playerObjId))
|
if (!_playerTimes.containsKey(playerObjId))
|
||||||
{
|
{
|
||||||
restoreInstanceTimes(playerObjId);
|
restoreInstanceTimes(playerObjId);
|
||||||
}
|
}
|
||||||
if (_PlayerTimes.get(playerObjId).containsKey(id))
|
if (_playerTimes.get(playerObjId).containsKey(id))
|
||||||
{
|
{
|
||||||
return _PlayerTimes.get(playerObjId).get(id);
|
return _playerTimes.get(playerObjId).get(id);
|
||||||
}
|
}
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
@ -100,11 +100,11 @@ public class InstanceManager implements IXmlReader
|
|||||||
*/
|
*/
|
||||||
public Map<Integer, Long> getAllInstanceTimes(int playerObjId)
|
public Map<Integer, Long> getAllInstanceTimes(int playerObjId)
|
||||||
{
|
{
|
||||||
if (!_PlayerTimes.containsKey(playerObjId))
|
if (!_playerTimes.containsKey(playerObjId))
|
||||||
{
|
{
|
||||||
restoreInstanceTimes(playerObjId);
|
restoreInstanceTimes(playerObjId);
|
||||||
}
|
}
|
||||||
return _PlayerTimes.get(playerObjId);
|
return _playerTimes.get(playerObjId);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -114,7 +114,7 @@ public class InstanceManager implements IXmlReader
|
|||||||
*/
|
*/
|
||||||
public void setInstanceTime(int playerObjId, int id, long time)
|
public void setInstanceTime(int playerObjId, int id, long time)
|
||||||
{
|
{
|
||||||
if (!_PlayerTimes.containsKey(playerObjId))
|
if (!_playerTimes.containsKey(playerObjId))
|
||||||
{
|
{
|
||||||
restoreInstanceTimes(playerObjId);
|
restoreInstanceTimes(playerObjId);
|
||||||
}
|
}
|
||||||
@ -127,7 +127,7 @@ public class InstanceManager implements IXmlReader
|
|||||||
ps.setLong(3, time);
|
ps.setLong(3, time);
|
||||||
ps.setLong(4, time);
|
ps.setLong(4, time);
|
||||||
ps.execute();
|
ps.execute();
|
||||||
_PlayerTimes.get(playerObjId).put(id, time);
|
_playerTimes.get(playerObjId).put(id, time);
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
@ -147,7 +147,7 @@ public class InstanceManager implements IXmlReader
|
|||||||
ps.setInt(1, playerObjId);
|
ps.setInt(1, playerObjId);
|
||||||
ps.setInt(2, id);
|
ps.setInt(2, id);
|
||||||
ps.execute();
|
ps.execute();
|
||||||
_PlayerTimes.get(playerObjId).remove(id);
|
_playerTimes.get(playerObjId).remove(id);
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
@ -160,11 +160,11 @@ public class InstanceManager implements IXmlReader
|
|||||||
*/
|
*/
|
||||||
public void restoreInstanceTimes(int playerObjId)
|
public void restoreInstanceTimes(int playerObjId)
|
||||||
{
|
{
|
||||||
if (_PlayerTimes.containsKey(playerObjId))
|
if (_playerTimes.containsKey(playerObjId))
|
||||||
{
|
{
|
||||||
return; // already restored
|
return; // already restored
|
||||||
}
|
}
|
||||||
_PlayerTimes.put(playerObjId, new ConcurrentHashMap<>());
|
_playerTimes.put(playerObjId, new ConcurrentHashMap<>());
|
||||||
try (Connection con = DatabaseFactory.getConnection();
|
try (Connection con = DatabaseFactory.getConnection();
|
||||||
PreparedStatement ps = con.prepareStatement(RESTORE_INSTANCE_TIMES))
|
PreparedStatement ps = con.prepareStatement(RESTORE_INSTANCE_TIMES))
|
||||||
{
|
{
|
||||||
@ -181,7 +181,7 @@ public class InstanceManager implements IXmlReader
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
_PlayerTimes.get(playerObjId).put(id, time);
|
_playerTimes.get(playerObjId).put(id, time);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -47,7 +47,7 @@ public class InstanceManager implements IXmlReader
|
|||||||
private static final Map<Integer, String> _instanceIdNames = new HashMap<>();
|
private static final Map<Integer, String> _instanceIdNames = new HashMap<>();
|
||||||
// Instance templates
|
// Instance templates
|
||||||
private final Map<Integer, String> _instanceTemplates = new ConcurrentHashMap<>();
|
private final Map<Integer, String> _instanceTemplates = new ConcurrentHashMap<>();
|
||||||
private final Map<Integer, Map<Integer, Long>> _PlayerTimes = new ConcurrentHashMap<>();
|
private final Map<Integer, Map<Integer, Long>> _playerTimes = new ConcurrentHashMap<>();
|
||||||
// SQL Queries
|
// SQL Queries
|
||||||
private static final String ADD_INSTANCE_TIME = "INSERT INTO character_instance_time (charId,instanceId,time) values (?,?,?) ON DUPLICATE KEY UPDATE time=?";
|
private static final String ADD_INSTANCE_TIME = "INSERT INTO character_instance_time (charId,instanceId,time) values (?,?,?) ON DUPLICATE KEY UPDATE time=?";
|
||||||
private static final String RESTORE_INSTANCE_TIMES = "SELECT instanceId,time FROM character_instance_time WHERE charId=?";
|
private static final String RESTORE_INSTANCE_TIMES = "SELECT instanceId,time FROM character_instance_time WHERE charId=?";
|
||||||
@ -83,13 +83,13 @@ public class InstanceManager implements IXmlReader
|
|||||||
*/
|
*/
|
||||||
public long getInstanceTime(int playerObjId, int id)
|
public long getInstanceTime(int playerObjId, int id)
|
||||||
{
|
{
|
||||||
if (!_PlayerTimes.containsKey(playerObjId))
|
if (!_playerTimes.containsKey(playerObjId))
|
||||||
{
|
{
|
||||||
restoreInstanceTimes(playerObjId);
|
restoreInstanceTimes(playerObjId);
|
||||||
}
|
}
|
||||||
if (_PlayerTimes.get(playerObjId).containsKey(id))
|
if (_playerTimes.get(playerObjId).containsKey(id))
|
||||||
{
|
{
|
||||||
return _PlayerTimes.get(playerObjId).get(id);
|
return _playerTimes.get(playerObjId).get(id);
|
||||||
}
|
}
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
@ -100,11 +100,11 @@ public class InstanceManager implements IXmlReader
|
|||||||
*/
|
*/
|
||||||
public Map<Integer, Long> getAllInstanceTimes(int playerObjId)
|
public Map<Integer, Long> getAllInstanceTimes(int playerObjId)
|
||||||
{
|
{
|
||||||
if (!_PlayerTimes.containsKey(playerObjId))
|
if (!_playerTimes.containsKey(playerObjId))
|
||||||
{
|
{
|
||||||
restoreInstanceTimes(playerObjId);
|
restoreInstanceTimes(playerObjId);
|
||||||
}
|
}
|
||||||
return _PlayerTimes.get(playerObjId);
|
return _playerTimes.get(playerObjId);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -114,7 +114,7 @@ public class InstanceManager implements IXmlReader
|
|||||||
*/
|
*/
|
||||||
public void setInstanceTime(int playerObjId, int id, long time)
|
public void setInstanceTime(int playerObjId, int id, long time)
|
||||||
{
|
{
|
||||||
if (!_PlayerTimes.containsKey(playerObjId))
|
if (!_playerTimes.containsKey(playerObjId))
|
||||||
{
|
{
|
||||||
restoreInstanceTimes(playerObjId);
|
restoreInstanceTimes(playerObjId);
|
||||||
}
|
}
|
||||||
@ -127,7 +127,7 @@ public class InstanceManager implements IXmlReader
|
|||||||
ps.setLong(3, time);
|
ps.setLong(3, time);
|
||||||
ps.setLong(4, time);
|
ps.setLong(4, time);
|
||||||
ps.execute();
|
ps.execute();
|
||||||
_PlayerTimes.get(playerObjId).put(id, time);
|
_playerTimes.get(playerObjId).put(id, time);
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
@ -147,7 +147,7 @@ public class InstanceManager implements IXmlReader
|
|||||||
ps.setInt(1, playerObjId);
|
ps.setInt(1, playerObjId);
|
||||||
ps.setInt(2, id);
|
ps.setInt(2, id);
|
||||||
ps.execute();
|
ps.execute();
|
||||||
_PlayerTimes.get(playerObjId).remove(id);
|
_playerTimes.get(playerObjId).remove(id);
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
@ -160,11 +160,11 @@ public class InstanceManager implements IXmlReader
|
|||||||
*/
|
*/
|
||||||
public void restoreInstanceTimes(int playerObjId)
|
public void restoreInstanceTimes(int playerObjId)
|
||||||
{
|
{
|
||||||
if (_PlayerTimes.containsKey(playerObjId))
|
if (_playerTimes.containsKey(playerObjId))
|
||||||
{
|
{
|
||||||
return; // already restored
|
return; // already restored
|
||||||
}
|
}
|
||||||
_PlayerTimes.put(playerObjId, new ConcurrentHashMap<>());
|
_playerTimes.put(playerObjId, new ConcurrentHashMap<>());
|
||||||
try (Connection con = DatabaseFactory.getConnection();
|
try (Connection con = DatabaseFactory.getConnection();
|
||||||
PreparedStatement ps = con.prepareStatement(RESTORE_INSTANCE_TIMES))
|
PreparedStatement ps = con.prepareStatement(RESTORE_INSTANCE_TIMES))
|
||||||
{
|
{
|
||||||
@ -181,7 +181,7 @@ public class InstanceManager implements IXmlReader
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
_PlayerTimes.get(playerObjId).put(id, time);
|
_playerTimes.get(playerObjId).put(id, time);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -74,7 +74,7 @@ public class InstanceManager implements IXmlReader
|
|||||||
private int _currentInstanceId = 0;
|
private int _currentInstanceId = 0;
|
||||||
private final Map<Integer, Instance> _instanceWorlds = new ConcurrentHashMap<>();
|
private final Map<Integer, Instance> _instanceWorlds = new ConcurrentHashMap<>();
|
||||||
// Player reenter times
|
// Player reenter times
|
||||||
private final Map<Integer, Map<Integer, Long>> _PlayerTimes = new ConcurrentHashMap<>();
|
private final Map<Integer, Map<Integer, Long>> _playerTimes = new ConcurrentHashMap<>();
|
||||||
|
|
||||||
protected InstanceManager()
|
protected InstanceManager()
|
||||||
{
|
{
|
||||||
@ -96,9 +96,9 @@ public class InstanceManager implements IXmlReader
|
|||||||
parseDatapackDirectory("data/instances", true);
|
parseDatapackDirectory("data/instances", true);
|
||||||
LOGGER.info(getClass().getSimpleName() + ": Loaded " + _instanceTemplates.size() + " instance templates.");
|
LOGGER.info(getClass().getSimpleName() + ": Loaded " + _instanceTemplates.size() + " instance templates.");
|
||||||
// Load player's reenter data
|
// Load player's reenter data
|
||||||
_PlayerTimes.clear();
|
_playerTimes.clear();
|
||||||
restoreInstanceTimes();
|
restoreInstanceTimes();
|
||||||
LOGGER.info(getClass().getSimpleName() + ": Loaded instance reenter times for " + _PlayerTimes.size() + " players.");
|
LOGGER.info(getClass().getSimpleName() + ": Loaded instance reenter times for " + _playerTimes.size() + " players.");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -545,7 +545,7 @@ public class InstanceManager implements IXmlReader
|
|||||||
public Map<Integer, Long> getAllInstanceTimes(Player player)
|
public Map<Integer, Long> getAllInstanceTimes(Player player)
|
||||||
{
|
{
|
||||||
// When player don't have any instance penalty
|
// When player don't have any instance penalty
|
||||||
final Map<Integer, Long> instanceTimes = _PlayerTimes.get(player.getObjectId());
|
final Map<Integer, Long> instanceTimes = _playerTimes.get(player.getObjectId());
|
||||||
if ((instanceTimes == null) || instanceTimes.isEmpty())
|
if ((instanceTimes == null) || instanceTimes.isEmpty())
|
||||||
{
|
{
|
||||||
return Collections.emptyMap();
|
return Collections.emptyMap();
|
||||||
@ -593,7 +593,7 @@ public class InstanceManager implements IXmlReader
|
|||||||
*/
|
*/
|
||||||
public void setReenterPenalty(int objectId, int id, long time)
|
public void setReenterPenalty(int objectId, int id, long time)
|
||||||
{
|
{
|
||||||
_PlayerTimes.computeIfAbsent(objectId, k -> new ConcurrentHashMap<>()).put(id, time);
|
_playerTimes.computeIfAbsent(objectId, k -> new ConcurrentHashMap<>()).put(id, time);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -606,7 +606,7 @@ public class InstanceManager implements IXmlReader
|
|||||||
public long getInstanceTime(Player player, int id)
|
public long getInstanceTime(Player player, int id)
|
||||||
{
|
{
|
||||||
// Check if exists reenter data for player
|
// Check if exists reenter data for player
|
||||||
final Map<Integer, Long> playerData = _PlayerTimes.get(player.getObjectId());
|
final Map<Integer, Long> playerData = _playerTimes.get(player.getObjectId());
|
||||||
if ((playerData == null) || !playerData.containsKey(id))
|
if ((playerData == null) || !playerData.containsKey(id))
|
||||||
{
|
{
|
||||||
return -1;
|
return -1;
|
||||||
@ -635,9 +635,9 @@ public class InstanceManager implements IXmlReader
|
|||||||
ps.setInt(1, player.getObjectId());
|
ps.setInt(1, player.getObjectId());
|
||||||
ps.setInt(2, id);
|
ps.setInt(2, id);
|
||||||
ps.execute();
|
ps.execute();
|
||||||
if (_PlayerTimes.get(player.getObjectId()) != null)
|
if (_playerTimes.get(player.getObjectId()) != null)
|
||||||
{
|
{
|
||||||
_PlayerTimes.get(player.getObjectId()).remove(id);
|
_playerTimes.get(player.getObjectId()).remove(id);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
|
@ -74,7 +74,7 @@ public class InstanceManager implements IXmlReader
|
|||||||
private int _currentInstanceId = 0;
|
private int _currentInstanceId = 0;
|
||||||
private final Map<Integer, Instance> _instanceWorlds = new ConcurrentHashMap<>();
|
private final Map<Integer, Instance> _instanceWorlds = new ConcurrentHashMap<>();
|
||||||
// Player reenter times
|
// Player reenter times
|
||||||
private final Map<Integer, Map<Integer, Long>> _PlayerTimes = new ConcurrentHashMap<>();
|
private final Map<Integer, Map<Integer, Long>> _playerTimes = new ConcurrentHashMap<>();
|
||||||
|
|
||||||
protected InstanceManager()
|
protected InstanceManager()
|
||||||
{
|
{
|
||||||
@ -96,9 +96,9 @@ public class InstanceManager implements IXmlReader
|
|||||||
parseDatapackDirectory("data/instances", true);
|
parseDatapackDirectory("data/instances", true);
|
||||||
LOGGER.info(getClass().getSimpleName() + ": Loaded " + _instanceTemplates.size() + " instance templates.");
|
LOGGER.info(getClass().getSimpleName() + ": Loaded " + _instanceTemplates.size() + " instance templates.");
|
||||||
// Load player's reenter data
|
// Load player's reenter data
|
||||||
_PlayerTimes.clear();
|
_playerTimes.clear();
|
||||||
restoreInstanceTimes();
|
restoreInstanceTimes();
|
||||||
LOGGER.info(getClass().getSimpleName() + ": Loaded instance reenter times for " + _PlayerTimes.size() + " players.");
|
LOGGER.info(getClass().getSimpleName() + ": Loaded instance reenter times for " + _playerTimes.size() + " players.");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -545,7 +545,7 @@ public class InstanceManager implements IXmlReader
|
|||||||
public Map<Integer, Long> getAllInstanceTimes(Player player)
|
public Map<Integer, Long> getAllInstanceTimes(Player player)
|
||||||
{
|
{
|
||||||
// When player don't have any instance penalty
|
// When player don't have any instance penalty
|
||||||
final Map<Integer, Long> instanceTimes = _PlayerTimes.get(player.getObjectId());
|
final Map<Integer, Long> instanceTimes = _playerTimes.get(player.getObjectId());
|
||||||
if ((instanceTimes == null) || instanceTimes.isEmpty())
|
if ((instanceTimes == null) || instanceTimes.isEmpty())
|
||||||
{
|
{
|
||||||
return Collections.emptyMap();
|
return Collections.emptyMap();
|
||||||
@ -593,7 +593,7 @@ public class InstanceManager implements IXmlReader
|
|||||||
*/
|
*/
|
||||||
public void setReenterPenalty(int objectId, int id, long time)
|
public void setReenterPenalty(int objectId, int id, long time)
|
||||||
{
|
{
|
||||||
_PlayerTimes.computeIfAbsent(objectId, k -> new ConcurrentHashMap<>()).put(id, time);
|
_playerTimes.computeIfAbsent(objectId, k -> new ConcurrentHashMap<>()).put(id, time);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -606,7 +606,7 @@ public class InstanceManager implements IXmlReader
|
|||||||
public long getInstanceTime(Player player, int id)
|
public long getInstanceTime(Player player, int id)
|
||||||
{
|
{
|
||||||
// Check if exists reenter data for player
|
// Check if exists reenter data for player
|
||||||
final Map<Integer, Long> playerData = _PlayerTimes.get(player.getObjectId());
|
final Map<Integer, Long> playerData = _playerTimes.get(player.getObjectId());
|
||||||
if ((playerData == null) || !playerData.containsKey(id))
|
if ((playerData == null) || !playerData.containsKey(id))
|
||||||
{
|
{
|
||||||
return -1;
|
return -1;
|
||||||
@ -635,9 +635,9 @@ public class InstanceManager implements IXmlReader
|
|||||||
ps.setInt(1, player.getObjectId());
|
ps.setInt(1, player.getObjectId());
|
||||||
ps.setInt(2, id);
|
ps.setInt(2, id);
|
||||||
ps.execute();
|
ps.execute();
|
||||||
if (_PlayerTimes.get(player.getObjectId()) != null)
|
if (_playerTimes.get(player.getObjectId()) != null)
|
||||||
{
|
{
|
||||||
_PlayerTimes.get(player.getObjectId()).remove(id);
|
_playerTimes.get(player.getObjectId()).remove(id);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
|
@ -74,7 +74,7 @@ public class InstanceManager implements IXmlReader
|
|||||||
private int _currentInstanceId = 0;
|
private int _currentInstanceId = 0;
|
||||||
private final Map<Integer, Instance> _instanceWorlds = new ConcurrentHashMap<>();
|
private final Map<Integer, Instance> _instanceWorlds = new ConcurrentHashMap<>();
|
||||||
// Player reenter times
|
// Player reenter times
|
||||||
private final Map<Integer, Map<Integer, Long>> _PlayerTimes = new ConcurrentHashMap<>();
|
private final Map<Integer, Map<Integer, Long>> _playerTimes = new ConcurrentHashMap<>();
|
||||||
|
|
||||||
protected InstanceManager()
|
protected InstanceManager()
|
||||||
{
|
{
|
||||||
@ -96,9 +96,9 @@ public class InstanceManager implements IXmlReader
|
|||||||
parseDatapackDirectory("data/instances", true);
|
parseDatapackDirectory("data/instances", true);
|
||||||
LOGGER.info(getClass().getSimpleName() + ": Loaded " + _instanceTemplates.size() + " instance templates.");
|
LOGGER.info(getClass().getSimpleName() + ": Loaded " + _instanceTemplates.size() + " instance templates.");
|
||||||
// Load player's reenter data
|
// Load player's reenter data
|
||||||
_PlayerTimes.clear();
|
_playerTimes.clear();
|
||||||
restoreInstanceTimes();
|
restoreInstanceTimes();
|
||||||
LOGGER.info(getClass().getSimpleName() + ": Loaded instance reenter times for " + _PlayerTimes.size() + " players.");
|
LOGGER.info(getClass().getSimpleName() + ": Loaded instance reenter times for " + _playerTimes.size() + " players.");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -545,7 +545,7 @@ public class InstanceManager implements IXmlReader
|
|||||||
public Map<Integer, Long> getAllInstanceTimes(Player player)
|
public Map<Integer, Long> getAllInstanceTimes(Player player)
|
||||||
{
|
{
|
||||||
// When player don't have any instance penalty
|
// When player don't have any instance penalty
|
||||||
final Map<Integer, Long> instanceTimes = _PlayerTimes.get(player.getObjectId());
|
final Map<Integer, Long> instanceTimes = _playerTimes.get(player.getObjectId());
|
||||||
if ((instanceTimes == null) || instanceTimes.isEmpty())
|
if ((instanceTimes == null) || instanceTimes.isEmpty())
|
||||||
{
|
{
|
||||||
return Collections.emptyMap();
|
return Collections.emptyMap();
|
||||||
@ -593,7 +593,7 @@ public class InstanceManager implements IXmlReader
|
|||||||
*/
|
*/
|
||||||
public void setReenterPenalty(int objectId, int id, long time)
|
public void setReenterPenalty(int objectId, int id, long time)
|
||||||
{
|
{
|
||||||
_PlayerTimes.computeIfAbsent(objectId, k -> new ConcurrentHashMap<>()).put(id, time);
|
_playerTimes.computeIfAbsent(objectId, k -> new ConcurrentHashMap<>()).put(id, time);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -606,7 +606,7 @@ public class InstanceManager implements IXmlReader
|
|||||||
public long getInstanceTime(Player player, int id)
|
public long getInstanceTime(Player player, int id)
|
||||||
{
|
{
|
||||||
// Check if exists reenter data for player
|
// Check if exists reenter data for player
|
||||||
final Map<Integer, Long> playerData = _PlayerTimes.get(player.getObjectId());
|
final Map<Integer, Long> playerData = _playerTimes.get(player.getObjectId());
|
||||||
if ((playerData == null) || !playerData.containsKey(id))
|
if ((playerData == null) || !playerData.containsKey(id))
|
||||||
{
|
{
|
||||||
return -1;
|
return -1;
|
||||||
@ -635,9 +635,9 @@ public class InstanceManager implements IXmlReader
|
|||||||
ps.setInt(1, player.getObjectId());
|
ps.setInt(1, player.getObjectId());
|
||||||
ps.setInt(2, id);
|
ps.setInt(2, id);
|
||||||
ps.execute();
|
ps.execute();
|
||||||
if (_PlayerTimes.get(player.getObjectId()) != null)
|
if (_playerTimes.get(player.getObjectId()) != null)
|
||||||
{
|
{
|
||||||
_PlayerTimes.get(player.getObjectId()).remove(id);
|
_playerTimes.get(player.getObjectId()).remove(id);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
|
@ -74,7 +74,7 @@ public class InstanceManager implements IXmlReader
|
|||||||
private int _currentInstanceId = 0;
|
private int _currentInstanceId = 0;
|
||||||
private final Map<Integer, Instance> _instanceWorlds = new ConcurrentHashMap<>();
|
private final Map<Integer, Instance> _instanceWorlds = new ConcurrentHashMap<>();
|
||||||
// Player reenter times
|
// Player reenter times
|
||||||
private final Map<Integer, Map<Integer, Long>> _PlayerTimes = new ConcurrentHashMap<>();
|
private final Map<Integer, Map<Integer, Long>> _playerTimes = new ConcurrentHashMap<>();
|
||||||
|
|
||||||
protected InstanceManager()
|
protected InstanceManager()
|
||||||
{
|
{
|
||||||
@ -96,9 +96,9 @@ public class InstanceManager implements IXmlReader
|
|||||||
parseDatapackDirectory("data/instances", true);
|
parseDatapackDirectory("data/instances", true);
|
||||||
LOGGER.info(getClass().getSimpleName() + ": Loaded " + _instanceTemplates.size() + " instance templates.");
|
LOGGER.info(getClass().getSimpleName() + ": Loaded " + _instanceTemplates.size() + " instance templates.");
|
||||||
// Load player's reenter data
|
// Load player's reenter data
|
||||||
_PlayerTimes.clear();
|
_playerTimes.clear();
|
||||||
restoreInstanceTimes();
|
restoreInstanceTimes();
|
||||||
LOGGER.info(getClass().getSimpleName() + ": Loaded instance reenter times for " + _PlayerTimes.size() + " players.");
|
LOGGER.info(getClass().getSimpleName() + ": Loaded instance reenter times for " + _playerTimes.size() + " players.");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -545,7 +545,7 @@ public class InstanceManager implements IXmlReader
|
|||||||
public Map<Integer, Long> getAllInstanceTimes(Player player)
|
public Map<Integer, Long> getAllInstanceTimes(Player player)
|
||||||
{
|
{
|
||||||
// When player don't have any instance penalty
|
// When player don't have any instance penalty
|
||||||
final Map<Integer, Long> instanceTimes = _PlayerTimes.get(player.getObjectId());
|
final Map<Integer, Long> instanceTimes = _playerTimes.get(player.getObjectId());
|
||||||
if ((instanceTimes == null) || instanceTimes.isEmpty())
|
if ((instanceTimes == null) || instanceTimes.isEmpty())
|
||||||
{
|
{
|
||||||
return Collections.emptyMap();
|
return Collections.emptyMap();
|
||||||
@ -593,7 +593,7 @@ public class InstanceManager implements IXmlReader
|
|||||||
*/
|
*/
|
||||||
public void setReenterPenalty(int objectId, int id, long time)
|
public void setReenterPenalty(int objectId, int id, long time)
|
||||||
{
|
{
|
||||||
_PlayerTimes.computeIfAbsent(objectId, k -> new ConcurrentHashMap<>()).put(id, time);
|
_playerTimes.computeIfAbsent(objectId, k -> new ConcurrentHashMap<>()).put(id, time);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -606,7 +606,7 @@ public class InstanceManager implements IXmlReader
|
|||||||
public long getInstanceTime(Player player, int id)
|
public long getInstanceTime(Player player, int id)
|
||||||
{
|
{
|
||||||
// Check if exists reenter data for player
|
// Check if exists reenter data for player
|
||||||
final Map<Integer, Long> playerData = _PlayerTimes.get(player.getObjectId());
|
final Map<Integer, Long> playerData = _playerTimes.get(player.getObjectId());
|
||||||
if ((playerData == null) || !playerData.containsKey(id))
|
if ((playerData == null) || !playerData.containsKey(id))
|
||||||
{
|
{
|
||||||
return -1;
|
return -1;
|
||||||
@ -635,9 +635,9 @@ public class InstanceManager implements IXmlReader
|
|||||||
ps.setInt(1, player.getObjectId());
|
ps.setInt(1, player.getObjectId());
|
||||||
ps.setInt(2, id);
|
ps.setInt(2, id);
|
||||||
ps.execute();
|
ps.execute();
|
||||||
if (_PlayerTimes.get(player.getObjectId()) != null)
|
if (_playerTimes.get(player.getObjectId()) != null)
|
||||||
{
|
{
|
||||||
_PlayerTimes.get(player.getObjectId()).remove(id);
|
_playerTimes.get(player.getObjectId()).remove(id);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
|
@ -74,7 +74,7 @@ public class InstanceManager implements IXmlReader
|
|||||||
private int _currentInstanceId = 0;
|
private int _currentInstanceId = 0;
|
||||||
private final Map<Integer, Instance> _instanceWorlds = new ConcurrentHashMap<>();
|
private final Map<Integer, Instance> _instanceWorlds = new ConcurrentHashMap<>();
|
||||||
// Player reenter times
|
// Player reenter times
|
||||||
private final Map<Integer, Map<Integer, Long>> _PlayerTimes = new ConcurrentHashMap<>();
|
private final Map<Integer, Map<Integer, Long>> _playerTimes = new ConcurrentHashMap<>();
|
||||||
|
|
||||||
protected InstanceManager()
|
protected InstanceManager()
|
||||||
{
|
{
|
||||||
@ -96,9 +96,9 @@ public class InstanceManager implements IXmlReader
|
|||||||
parseDatapackDirectory("data/instances", true);
|
parseDatapackDirectory("data/instances", true);
|
||||||
LOGGER.info(getClass().getSimpleName() + ": Loaded " + _instanceTemplates.size() + " instance templates.");
|
LOGGER.info(getClass().getSimpleName() + ": Loaded " + _instanceTemplates.size() + " instance templates.");
|
||||||
// Load player's reenter data
|
// Load player's reenter data
|
||||||
_PlayerTimes.clear();
|
_playerTimes.clear();
|
||||||
restoreInstanceTimes();
|
restoreInstanceTimes();
|
||||||
LOGGER.info(getClass().getSimpleName() + ": Loaded instance reenter times for " + _PlayerTimes.size() + " players.");
|
LOGGER.info(getClass().getSimpleName() + ": Loaded instance reenter times for " + _playerTimes.size() + " players.");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -545,7 +545,7 @@ public class InstanceManager implements IXmlReader
|
|||||||
public Map<Integer, Long> getAllInstanceTimes(Player player)
|
public Map<Integer, Long> getAllInstanceTimes(Player player)
|
||||||
{
|
{
|
||||||
// When player don't have any instance penalty
|
// When player don't have any instance penalty
|
||||||
final Map<Integer, Long> instanceTimes = _PlayerTimes.get(player.getObjectId());
|
final Map<Integer, Long> instanceTimes = _playerTimes.get(player.getObjectId());
|
||||||
if ((instanceTimes == null) || instanceTimes.isEmpty())
|
if ((instanceTimes == null) || instanceTimes.isEmpty())
|
||||||
{
|
{
|
||||||
return Collections.emptyMap();
|
return Collections.emptyMap();
|
||||||
@ -593,7 +593,7 @@ public class InstanceManager implements IXmlReader
|
|||||||
*/
|
*/
|
||||||
public void setReenterPenalty(int objectId, int id, long time)
|
public void setReenterPenalty(int objectId, int id, long time)
|
||||||
{
|
{
|
||||||
_PlayerTimes.computeIfAbsent(objectId, k -> new ConcurrentHashMap<>()).put(id, time);
|
_playerTimes.computeIfAbsent(objectId, k -> new ConcurrentHashMap<>()).put(id, time);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -606,7 +606,7 @@ public class InstanceManager implements IXmlReader
|
|||||||
public long getInstanceTime(Player player, int id)
|
public long getInstanceTime(Player player, int id)
|
||||||
{
|
{
|
||||||
// Check if exists reenter data for player
|
// Check if exists reenter data for player
|
||||||
final Map<Integer, Long> playerData = _PlayerTimes.get(player.getObjectId());
|
final Map<Integer, Long> playerData = _playerTimes.get(player.getObjectId());
|
||||||
if ((playerData == null) || !playerData.containsKey(id))
|
if ((playerData == null) || !playerData.containsKey(id))
|
||||||
{
|
{
|
||||||
return -1;
|
return -1;
|
||||||
@ -635,9 +635,9 @@ public class InstanceManager implements IXmlReader
|
|||||||
ps.setInt(1, player.getObjectId());
|
ps.setInt(1, player.getObjectId());
|
||||||
ps.setInt(2, id);
|
ps.setInt(2, id);
|
||||||
ps.execute();
|
ps.execute();
|
||||||
if (_PlayerTimes.get(player.getObjectId()) != null)
|
if (_playerTimes.get(player.getObjectId()) != null)
|
||||||
{
|
{
|
||||||
_PlayerTimes.get(player.getObjectId()).remove(id);
|
_playerTimes.get(player.getObjectId()).remove(id);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
|
@ -74,7 +74,7 @@ public class InstanceManager implements IXmlReader
|
|||||||
private int _currentInstanceId = 0;
|
private int _currentInstanceId = 0;
|
||||||
private final Map<Integer, Instance> _instanceWorlds = new ConcurrentHashMap<>();
|
private final Map<Integer, Instance> _instanceWorlds = new ConcurrentHashMap<>();
|
||||||
// Player reenter times
|
// Player reenter times
|
||||||
private final Map<Integer, Map<Integer, Long>> _PlayerTimes = new ConcurrentHashMap<>();
|
private final Map<Integer, Map<Integer, Long>> _playerTimes = new ConcurrentHashMap<>();
|
||||||
|
|
||||||
protected InstanceManager()
|
protected InstanceManager()
|
||||||
{
|
{
|
||||||
@ -96,9 +96,9 @@ public class InstanceManager implements IXmlReader
|
|||||||
parseDatapackDirectory("data/instances", true);
|
parseDatapackDirectory("data/instances", true);
|
||||||
LOGGER.info(getClass().getSimpleName() + ": Loaded " + _instanceTemplates.size() + " instance templates.");
|
LOGGER.info(getClass().getSimpleName() + ": Loaded " + _instanceTemplates.size() + " instance templates.");
|
||||||
// Load player's reenter data
|
// Load player's reenter data
|
||||||
_PlayerTimes.clear();
|
_playerTimes.clear();
|
||||||
restoreInstanceTimes();
|
restoreInstanceTimes();
|
||||||
LOGGER.info(getClass().getSimpleName() + ": Loaded instance reenter times for " + _PlayerTimes.size() + " players.");
|
LOGGER.info(getClass().getSimpleName() + ": Loaded instance reenter times for " + _playerTimes.size() + " players.");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -545,7 +545,7 @@ public class InstanceManager implements IXmlReader
|
|||||||
public Map<Integer, Long> getAllInstanceTimes(Player player)
|
public Map<Integer, Long> getAllInstanceTimes(Player player)
|
||||||
{
|
{
|
||||||
// When player don't have any instance penalty
|
// When player don't have any instance penalty
|
||||||
final Map<Integer, Long> instanceTimes = _PlayerTimes.get(player.getObjectId());
|
final Map<Integer, Long> instanceTimes = _playerTimes.get(player.getObjectId());
|
||||||
if ((instanceTimes == null) || instanceTimes.isEmpty())
|
if ((instanceTimes == null) || instanceTimes.isEmpty())
|
||||||
{
|
{
|
||||||
return Collections.emptyMap();
|
return Collections.emptyMap();
|
||||||
@ -593,7 +593,7 @@ public class InstanceManager implements IXmlReader
|
|||||||
*/
|
*/
|
||||||
public void setReenterPenalty(int objectId, int id, long time)
|
public void setReenterPenalty(int objectId, int id, long time)
|
||||||
{
|
{
|
||||||
_PlayerTimes.computeIfAbsent(objectId, k -> new ConcurrentHashMap<>()).put(id, time);
|
_playerTimes.computeIfAbsent(objectId, k -> new ConcurrentHashMap<>()).put(id, time);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -606,7 +606,7 @@ public class InstanceManager implements IXmlReader
|
|||||||
public long getInstanceTime(Player player, int id)
|
public long getInstanceTime(Player player, int id)
|
||||||
{
|
{
|
||||||
// Check if exists reenter data for player
|
// Check if exists reenter data for player
|
||||||
final Map<Integer, Long> playerData = _PlayerTimes.get(player.getObjectId());
|
final Map<Integer, Long> playerData = _playerTimes.get(player.getObjectId());
|
||||||
if ((playerData == null) || !playerData.containsKey(id))
|
if ((playerData == null) || !playerData.containsKey(id))
|
||||||
{
|
{
|
||||||
return -1;
|
return -1;
|
||||||
@ -635,9 +635,9 @@ public class InstanceManager implements IXmlReader
|
|||||||
ps.setInt(1, player.getObjectId());
|
ps.setInt(1, player.getObjectId());
|
||||||
ps.setInt(2, id);
|
ps.setInt(2, id);
|
||||||
ps.execute();
|
ps.execute();
|
||||||
if (_PlayerTimes.get(player.getObjectId()) != null)
|
if (_playerTimes.get(player.getObjectId()) != null)
|
||||||
{
|
{
|
||||||
_PlayerTimes.get(player.getObjectId()).remove(id);
|
_playerTimes.get(player.getObjectId()).remove(id);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
|
@ -74,7 +74,7 @@ public class InstanceManager implements IXmlReader
|
|||||||
private int _currentInstanceId = 0;
|
private int _currentInstanceId = 0;
|
||||||
private final Map<Integer, Instance> _instanceWorlds = new ConcurrentHashMap<>();
|
private final Map<Integer, Instance> _instanceWorlds = new ConcurrentHashMap<>();
|
||||||
// Player reenter times
|
// Player reenter times
|
||||||
private final Map<Integer, Map<Integer, Long>> _PlayerTimes = new ConcurrentHashMap<>();
|
private final Map<Integer, Map<Integer, Long>> _playerTimes = new ConcurrentHashMap<>();
|
||||||
|
|
||||||
protected InstanceManager()
|
protected InstanceManager()
|
||||||
{
|
{
|
||||||
@ -96,9 +96,9 @@ public class InstanceManager implements IXmlReader
|
|||||||
parseDatapackDirectory("data/instances", true);
|
parseDatapackDirectory("data/instances", true);
|
||||||
LOGGER.info(getClass().getSimpleName() + ": Loaded " + _instanceTemplates.size() + " instance templates.");
|
LOGGER.info(getClass().getSimpleName() + ": Loaded " + _instanceTemplates.size() + " instance templates.");
|
||||||
// Load player's reenter data
|
// Load player's reenter data
|
||||||
_PlayerTimes.clear();
|
_playerTimes.clear();
|
||||||
restoreInstanceTimes();
|
restoreInstanceTimes();
|
||||||
LOGGER.info(getClass().getSimpleName() + ": Loaded instance reenter times for " + _PlayerTimes.size() + " players.");
|
LOGGER.info(getClass().getSimpleName() + ": Loaded instance reenter times for " + _playerTimes.size() + " players.");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -545,7 +545,7 @@ public class InstanceManager implements IXmlReader
|
|||||||
public Map<Integer, Long> getAllInstanceTimes(Player player)
|
public Map<Integer, Long> getAllInstanceTimes(Player player)
|
||||||
{
|
{
|
||||||
// When player don't have any instance penalty
|
// When player don't have any instance penalty
|
||||||
final Map<Integer, Long> instanceTimes = _PlayerTimes.get(player.getObjectId());
|
final Map<Integer, Long> instanceTimes = _playerTimes.get(player.getObjectId());
|
||||||
if ((instanceTimes == null) || instanceTimes.isEmpty())
|
if ((instanceTimes == null) || instanceTimes.isEmpty())
|
||||||
{
|
{
|
||||||
return Collections.emptyMap();
|
return Collections.emptyMap();
|
||||||
@ -593,7 +593,7 @@ public class InstanceManager implements IXmlReader
|
|||||||
*/
|
*/
|
||||||
public void setReenterPenalty(int objectId, int id, long time)
|
public void setReenterPenalty(int objectId, int id, long time)
|
||||||
{
|
{
|
||||||
_PlayerTimes.computeIfAbsent(objectId, k -> new ConcurrentHashMap<>()).put(id, time);
|
_playerTimes.computeIfAbsent(objectId, k -> new ConcurrentHashMap<>()).put(id, time);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -606,7 +606,7 @@ public class InstanceManager implements IXmlReader
|
|||||||
public long getInstanceTime(Player player, int id)
|
public long getInstanceTime(Player player, int id)
|
||||||
{
|
{
|
||||||
// Check if exists reenter data for player
|
// Check if exists reenter data for player
|
||||||
final Map<Integer, Long> playerData = _PlayerTimes.get(player.getObjectId());
|
final Map<Integer, Long> playerData = _playerTimes.get(player.getObjectId());
|
||||||
if ((playerData == null) || !playerData.containsKey(id))
|
if ((playerData == null) || !playerData.containsKey(id))
|
||||||
{
|
{
|
||||||
return -1;
|
return -1;
|
||||||
@ -635,9 +635,9 @@ public class InstanceManager implements IXmlReader
|
|||||||
ps.setInt(1, player.getObjectId());
|
ps.setInt(1, player.getObjectId());
|
||||||
ps.setInt(2, id);
|
ps.setInt(2, id);
|
||||||
ps.execute();
|
ps.execute();
|
||||||
if (_PlayerTimes.get(player.getObjectId()) != null)
|
if (_playerTimes.get(player.getObjectId()) != null)
|
||||||
{
|
{
|
||||||
_PlayerTimes.get(player.getObjectId()).remove(id);
|
_playerTimes.get(player.getObjectId()).remove(id);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
|
@ -74,7 +74,7 @@ public class InstanceManager implements IXmlReader
|
|||||||
private int _currentInstanceId = 0;
|
private int _currentInstanceId = 0;
|
||||||
private final Map<Integer, Instance> _instanceWorlds = new ConcurrentHashMap<>();
|
private final Map<Integer, Instance> _instanceWorlds = new ConcurrentHashMap<>();
|
||||||
// Player reenter times
|
// Player reenter times
|
||||||
private final Map<Integer, Map<Integer, Long>> _PlayerTimes = new ConcurrentHashMap<>();
|
private final Map<Integer, Map<Integer, Long>> _playerTimes = new ConcurrentHashMap<>();
|
||||||
|
|
||||||
protected InstanceManager()
|
protected InstanceManager()
|
||||||
{
|
{
|
||||||
@ -96,9 +96,9 @@ public class InstanceManager implements IXmlReader
|
|||||||
parseDatapackDirectory("data/instances", true);
|
parseDatapackDirectory("data/instances", true);
|
||||||
LOGGER.info(getClass().getSimpleName() + ": Loaded " + _instanceTemplates.size() + " instance templates.");
|
LOGGER.info(getClass().getSimpleName() + ": Loaded " + _instanceTemplates.size() + " instance templates.");
|
||||||
// Load player's reenter data
|
// Load player's reenter data
|
||||||
_PlayerTimes.clear();
|
_playerTimes.clear();
|
||||||
restoreInstanceTimes();
|
restoreInstanceTimes();
|
||||||
LOGGER.info(getClass().getSimpleName() + ": Loaded instance reenter times for " + _PlayerTimes.size() + " players.");
|
LOGGER.info(getClass().getSimpleName() + ": Loaded instance reenter times for " + _playerTimes.size() + " players.");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -545,7 +545,7 @@ public class InstanceManager implements IXmlReader
|
|||||||
public Map<Integer, Long> getAllInstanceTimes(Player player)
|
public Map<Integer, Long> getAllInstanceTimes(Player player)
|
||||||
{
|
{
|
||||||
// When player don't have any instance penalty
|
// When player don't have any instance penalty
|
||||||
final Map<Integer, Long> instanceTimes = _PlayerTimes.get(player.getObjectId());
|
final Map<Integer, Long> instanceTimes = _playerTimes.get(player.getObjectId());
|
||||||
if ((instanceTimes == null) || instanceTimes.isEmpty())
|
if ((instanceTimes == null) || instanceTimes.isEmpty())
|
||||||
{
|
{
|
||||||
return Collections.emptyMap();
|
return Collections.emptyMap();
|
||||||
@ -593,7 +593,7 @@ public class InstanceManager implements IXmlReader
|
|||||||
*/
|
*/
|
||||||
public void setReenterPenalty(int objectId, int id, long time)
|
public void setReenterPenalty(int objectId, int id, long time)
|
||||||
{
|
{
|
||||||
_PlayerTimes.computeIfAbsent(objectId, k -> new ConcurrentHashMap<>()).put(id, time);
|
_playerTimes.computeIfAbsent(objectId, k -> new ConcurrentHashMap<>()).put(id, time);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -606,7 +606,7 @@ public class InstanceManager implements IXmlReader
|
|||||||
public long getInstanceTime(Player player, int id)
|
public long getInstanceTime(Player player, int id)
|
||||||
{
|
{
|
||||||
// Check if exists reenter data for player
|
// Check if exists reenter data for player
|
||||||
final Map<Integer, Long> playerData = _PlayerTimes.get(player.getObjectId());
|
final Map<Integer, Long> playerData = _playerTimes.get(player.getObjectId());
|
||||||
if ((playerData == null) || !playerData.containsKey(id))
|
if ((playerData == null) || !playerData.containsKey(id))
|
||||||
{
|
{
|
||||||
return -1;
|
return -1;
|
||||||
@ -635,9 +635,9 @@ public class InstanceManager implements IXmlReader
|
|||||||
ps.setInt(1, player.getObjectId());
|
ps.setInt(1, player.getObjectId());
|
||||||
ps.setInt(2, id);
|
ps.setInt(2, id);
|
||||||
ps.execute();
|
ps.execute();
|
||||||
if (_PlayerTimes.get(player.getObjectId()) != null)
|
if (_playerTimes.get(player.getObjectId()) != null)
|
||||||
{
|
{
|
||||||
_PlayerTimes.get(player.getObjectId()).remove(id);
|
_playerTimes.get(player.getObjectId()).remove(id);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
|
@ -74,7 +74,7 @@ public class InstanceManager implements IXmlReader
|
|||||||
private int _currentInstanceId = 0;
|
private int _currentInstanceId = 0;
|
||||||
private final Map<Integer, Instance> _instanceWorlds = new ConcurrentHashMap<>();
|
private final Map<Integer, Instance> _instanceWorlds = new ConcurrentHashMap<>();
|
||||||
// Player reenter times
|
// Player reenter times
|
||||||
private final Map<Integer, Map<Integer, Long>> _PlayerTimes = new ConcurrentHashMap<>();
|
private final Map<Integer, Map<Integer, Long>> _playerTimes = new ConcurrentHashMap<>();
|
||||||
|
|
||||||
protected InstanceManager()
|
protected InstanceManager()
|
||||||
{
|
{
|
||||||
@ -96,9 +96,9 @@ public class InstanceManager implements IXmlReader
|
|||||||
parseDatapackDirectory("data/instances", true);
|
parseDatapackDirectory("data/instances", true);
|
||||||
LOGGER.info(getClass().getSimpleName() + ": Loaded " + _instanceTemplates.size() + " instance templates.");
|
LOGGER.info(getClass().getSimpleName() + ": Loaded " + _instanceTemplates.size() + " instance templates.");
|
||||||
// Load player's reenter data
|
// Load player's reenter data
|
||||||
_PlayerTimes.clear();
|
_playerTimes.clear();
|
||||||
restoreInstanceTimes();
|
restoreInstanceTimes();
|
||||||
LOGGER.info(getClass().getSimpleName() + ": Loaded instance reenter times for " + _PlayerTimes.size() + " players.");
|
LOGGER.info(getClass().getSimpleName() + ": Loaded instance reenter times for " + _playerTimes.size() + " players.");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -545,7 +545,7 @@ public class InstanceManager implements IXmlReader
|
|||||||
public Map<Integer, Long> getAllInstanceTimes(Player player)
|
public Map<Integer, Long> getAllInstanceTimes(Player player)
|
||||||
{
|
{
|
||||||
// When player don't have any instance penalty
|
// When player don't have any instance penalty
|
||||||
final Map<Integer, Long> instanceTimes = _PlayerTimes.get(player.getObjectId());
|
final Map<Integer, Long> instanceTimes = _playerTimes.get(player.getObjectId());
|
||||||
if ((instanceTimes == null) || instanceTimes.isEmpty())
|
if ((instanceTimes == null) || instanceTimes.isEmpty())
|
||||||
{
|
{
|
||||||
return Collections.emptyMap();
|
return Collections.emptyMap();
|
||||||
@ -593,7 +593,7 @@ public class InstanceManager implements IXmlReader
|
|||||||
*/
|
*/
|
||||||
public void setReenterPenalty(int objectId, int id, long time)
|
public void setReenterPenalty(int objectId, int id, long time)
|
||||||
{
|
{
|
||||||
_PlayerTimes.computeIfAbsent(objectId, k -> new ConcurrentHashMap<>()).put(id, time);
|
_playerTimes.computeIfAbsent(objectId, k -> new ConcurrentHashMap<>()).put(id, time);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -606,7 +606,7 @@ public class InstanceManager implements IXmlReader
|
|||||||
public long getInstanceTime(Player player, int id)
|
public long getInstanceTime(Player player, int id)
|
||||||
{
|
{
|
||||||
// Check if exists reenter data for player
|
// Check if exists reenter data for player
|
||||||
final Map<Integer, Long> playerData = _PlayerTimes.get(player.getObjectId());
|
final Map<Integer, Long> playerData = _playerTimes.get(player.getObjectId());
|
||||||
if ((playerData == null) || !playerData.containsKey(id))
|
if ((playerData == null) || !playerData.containsKey(id))
|
||||||
{
|
{
|
||||||
return -1;
|
return -1;
|
||||||
@ -635,9 +635,9 @@ public class InstanceManager implements IXmlReader
|
|||||||
ps.setInt(1, player.getObjectId());
|
ps.setInt(1, player.getObjectId());
|
||||||
ps.setInt(2, id);
|
ps.setInt(2, id);
|
||||||
ps.execute();
|
ps.execute();
|
||||||
if (_PlayerTimes.get(player.getObjectId()) != null)
|
if (_playerTimes.get(player.getObjectId()) != null)
|
||||||
{
|
{
|
||||||
_PlayerTimes.get(player.getObjectId()).remove(id);
|
_playerTimes.get(player.getObjectId()).remove(id);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
|
@ -74,7 +74,7 @@ public class InstanceManager implements IXmlReader
|
|||||||
private int _currentInstanceId = 0;
|
private int _currentInstanceId = 0;
|
||||||
private final Map<Integer, Instance> _instanceWorlds = new ConcurrentHashMap<>();
|
private final Map<Integer, Instance> _instanceWorlds = new ConcurrentHashMap<>();
|
||||||
// Player reenter times
|
// Player reenter times
|
||||||
private final Map<Integer, Map<Integer, Long>> _PlayerTimes = new ConcurrentHashMap<>();
|
private final Map<Integer, Map<Integer, Long>> _playerTimes = new ConcurrentHashMap<>();
|
||||||
|
|
||||||
protected InstanceManager()
|
protected InstanceManager()
|
||||||
{
|
{
|
||||||
@ -96,9 +96,9 @@ public class InstanceManager implements IXmlReader
|
|||||||
parseDatapackDirectory("data/instances", true);
|
parseDatapackDirectory("data/instances", true);
|
||||||
LOGGER.info(getClass().getSimpleName() + ": Loaded " + _instanceTemplates.size() + " instance templates.");
|
LOGGER.info(getClass().getSimpleName() + ": Loaded " + _instanceTemplates.size() + " instance templates.");
|
||||||
// Load player's reenter data
|
// Load player's reenter data
|
||||||
_PlayerTimes.clear();
|
_playerTimes.clear();
|
||||||
restoreInstanceTimes();
|
restoreInstanceTimes();
|
||||||
LOGGER.info(getClass().getSimpleName() + ": Loaded instance reenter times for " + _PlayerTimes.size() + " players.");
|
LOGGER.info(getClass().getSimpleName() + ": Loaded instance reenter times for " + _playerTimes.size() + " players.");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -545,7 +545,7 @@ public class InstanceManager implements IXmlReader
|
|||||||
public Map<Integer, Long> getAllInstanceTimes(Player player)
|
public Map<Integer, Long> getAllInstanceTimes(Player player)
|
||||||
{
|
{
|
||||||
// When player don't have any instance penalty
|
// When player don't have any instance penalty
|
||||||
final Map<Integer, Long> instanceTimes = _PlayerTimes.get(player.getObjectId());
|
final Map<Integer, Long> instanceTimes = _playerTimes.get(player.getObjectId());
|
||||||
if ((instanceTimes == null) || instanceTimes.isEmpty())
|
if ((instanceTimes == null) || instanceTimes.isEmpty())
|
||||||
{
|
{
|
||||||
return Collections.emptyMap();
|
return Collections.emptyMap();
|
||||||
@ -593,7 +593,7 @@ public class InstanceManager implements IXmlReader
|
|||||||
*/
|
*/
|
||||||
public void setReenterPenalty(int objectId, int id, long time)
|
public void setReenterPenalty(int objectId, int id, long time)
|
||||||
{
|
{
|
||||||
_PlayerTimes.computeIfAbsent(objectId, k -> new ConcurrentHashMap<>()).put(id, time);
|
_playerTimes.computeIfAbsent(objectId, k -> new ConcurrentHashMap<>()).put(id, time);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -606,7 +606,7 @@ public class InstanceManager implements IXmlReader
|
|||||||
public long getInstanceTime(Player player, int id)
|
public long getInstanceTime(Player player, int id)
|
||||||
{
|
{
|
||||||
// Check if exists reenter data for player
|
// Check if exists reenter data for player
|
||||||
final Map<Integer, Long> playerData = _PlayerTimes.get(player.getObjectId());
|
final Map<Integer, Long> playerData = _playerTimes.get(player.getObjectId());
|
||||||
if ((playerData == null) || !playerData.containsKey(id))
|
if ((playerData == null) || !playerData.containsKey(id))
|
||||||
{
|
{
|
||||||
return -1;
|
return -1;
|
||||||
@ -635,9 +635,9 @@ public class InstanceManager implements IXmlReader
|
|||||||
ps.setInt(1, player.getObjectId());
|
ps.setInt(1, player.getObjectId());
|
||||||
ps.setInt(2, id);
|
ps.setInt(2, id);
|
||||||
ps.execute();
|
ps.execute();
|
||||||
if (_PlayerTimes.get(player.getObjectId()) != null)
|
if (_playerTimes.get(player.getObjectId()) != null)
|
||||||
{
|
{
|
||||||
_PlayerTimes.get(player.getObjectId()).remove(id);
|
_playerTimes.get(player.getObjectId()).remove(id);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
|
@ -74,7 +74,7 @@ public class InstanceManager implements IXmlReader
|
|||||||
private int _currentInstanceId = 0;
|
private int _currentInstanceId = 0;
|
||||||
private final Map<Integer, Instance> _instanceWorlds = new ConcurrentHashMap<>();
|
private final Map<Integer, Instance> _instanceWorlds = new ConcurrentHashMap<>();
|
||||||
// Player reenter times
|
// Player reenter times
|
||||||
private final Map<Integer, Map<Integer, Long>> _PlayerTimes = new ConcurrentHashMap<>();
|
private final Map<Integer, Map<Integer, Long>> _playerTimes = new ConcurrentHashMap<>();
|
||||||
|
|
||||||
protected InstanceManager()
|
protected InstanceManager()
|
||||||
{
|
{
|
||||||
@ -96,9 +96,9 @@ public class InstanceManager implements IXmlReader
|
|||||||
parseDatapackDirectory("data/instances", true);
|
parseDatapackDirectory("data/instances", true);
|
||||||
LOGGER.info(getClass().getSimpleName() + ": Loaded " + _instanceTemplates.size() + " instance templates.");
|
LOGGER.info(getClass().getSimpleName() + ": Loaded " + _instanceTemplates.size() + " instance templates.");
|
||||||
// Load player's reenter data
|
// Load player's reenter data
|
||||||
_PlayerTimes.clear();
|
_playerTimes.clear();
|
||||||
restoreInstanceTimes();
|
restoreInstanceTimes();
|
||||||
LOGGER.info(getClass().getSimpleName() + ": Loaded instance reenter times for " + _PlayerTimes.size() + " players.");
|
LOGGER.info(getClass().getSimpleName() + ": Loaded instance reenter times for " + _playerTimes.size() + " players.");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -549,7 +549,7 @@ public class InstanceManager implements IXmlReader
|
|||||||
public Map<Integer, Long> getAllInstanceTimes(Player player)
|
public Map<Integer, Long> getAllInstanceTimes(Player player)
|
||||||
{
|
{
|
||||||
// When player don't have any instance penalty
|
// When player don't have any instance penalty
|
||||||
final Map<Integer, Long> instanceTimes = _PlayerTimes.get(player.getObjectId());
|
final Map<Integer, Long> instanceTimes = _playerTimes.get(player.getObjectId());
|
||||||
if ((instanceTimes == null) || instanceTimes.isEmpty())
|
if ((instanceTimes == null) || instanceTimes.isEmpty())
|
||||||
{
|
{
|
||||||
return Collections.emptyMap();
|
return Collections.emptyMap();
|
||||||
@ -597,7 +597,7 @@ public class InstanceManager implements IXmlReader
|
|||||||
*/
|
*/
|
||||||
public void setReenterPenalty(int objectId, int id, long time)
|
public void setReenterPenalty(int objectId, int id, long time)
|
||||||
{
|
{
|
||||||
_PlayerTimes.computeIfAbsent(objectId, k -> new ConcurrentHashMap<>()).put(id, time);
|
_playerTimes.computeIfAbsent(objectId, k -> new ConcurrentHashMap<>()).put(id, time);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -610,7 +610,7 @@ public class InstanceManager implements IXmlReader
|
|||||||
public long getInstanceTime(Player player, int id)
|
public long getInstanceTime(Player player, int id)
|
||||||
{
|
{
|
||||||
// Check if exists reenter data for player
|
// Check if exists reenter data for player
|
||||||
final Map<Integer, Long> playerData = _PlayerTimes.get(player.getObjectId());
|
final Map<Integer, Long> playerData = _playerTimes.get(player.getObjectId());
|
||||||
if ((playerData == null) || !playerData.containsKey(id))
|
if ((playerData == null) || !playerData.containsKey(id))
|
||||||
{
|
{
|
||||||
return -1;
|
return -1;
|
||||||
@ -639,9 +639,9 @@ public class InstanceManager implements IXmlReader
|
|||||||
ps.setInt(1, player.getObjectId());
|
ps.setInt(1, player.getObjectId());
|
||||||
ps.setInt(2, id);
|
ps.setInt(2, id);
|
||||||
ps.execute();
|
ps.execute();
|
||||||
if (_PlayerTimes.get(player.getObjectId()) != null)
|
if (_playerTimes.get(player.getObjectId()) != null)
|
||||||
{
|
{
|
||||||
_PlayerTimes.get(player.getObjectId()).remove(id);
|
_playerTimes.get(player.getObjectId()).remove(id);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
|
@ -74,7 +74,7 @@ public class InstanceManager implements IXmlReader
|
|||||||
private int _currentInstanceId = 0;
|
private int _currentInstanceId = 0;
|
||||||
private final Map<Integer, Instance> _instanceWorlds = new ConcurrentHashMap<>();
|
private final Map<Integer, Instance> _instanceWorlds = new ConcurrentHashMap<>();
|
||||||
// Player reenter times
|
// Player reenter times
|
||||||
private final Map<Integer, Map<Integer, Long>> _PlayerTimes = new ConcurrentHashMap<>();
|
private final Map<Integer, Map<Integer, Long>> _playerTimes = new ConcurrentHashMap<>();
|
||||||
|
|
||||||
protected InstanceManager()
|
protected InstanceManager()
|
||||||
{
|
{
|
||||||
@ -96,9 +96,9 @@ public class InstanceManager implements IXmlReader
|
|||||||
parseDatapackDirectory("data/instances", true);
|
parseDatapackDirectory("data/instances", true);
|
||||||
LOGGER.info(getClass().getSimpleName() + ": Loaded " + _instanceTemplates.size() + " instance templates.");
|
LOGGER.info(getClass().getSimpleName() + ": Loaded " + _instanceTemplates.size() + " instance templates.");
|
||||||
// Load player's reenter data
|
// Load player's reenter data
|
||||||
_PlayerTimes.clear();
|
_playerTimes.clear();
|
||||||
restoreInstanceTimes();
|
restoreInstanceTimes();
|
||||||
LOGGER.info(getClass().getSimpleName() + ": Loaded instance reenter times for " + _PlayerTimes.size() + " players.");
|
LOGGER.info(getClass().getSimpleName() + ": Loaded instance reenter times for " + _playerTimes.size() + " players.");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -549,7 +549,7 @@ public class InstanceManager implements IXmlReader
|
|||||||
public Map<Integer, Long> getAllInstanceTimes(Player player)
|
public Map<Integer, Long> getAllInstanceTimes(Player player)
|
||||||
{
|
{
|
||||||
// When player don't have any instance penalty
|
// When player don't have any instance penalty
|
||||||
final Map<Integer, Long> instanceTimes = _PlayerTimes.get(player.getObjectId());
|
final Map<Integer, Long> instanceTimes = _playerTimes.get(player.getObjectId());
|
||||||
if ((instanceTimes == null) || instanceTimes.isEmpty())
|
if ((instanceTimes == null) || instanceTimes.isEmpty())
|
||||||
{
|
{
|
||||||
return Collections.emptyMap();
|
return Collections.emptyMap();
|
||||||
@ -597,7 +597,7 @@ public class InstanceManager implements IXmlReader
|
|||||||
*/
|
*/
|
||||||
public void setReenterPenalty(int objectId, int id, long time)
|
public void setReenterPenalty(int objectId, int id, long time)
|
||||||
{
|
{
|
||||||
_PlayerTimes.computeIfAbsent(objectId, k -> new ConcurrentHashMap<>()).put(id, time);
|
_playerTimes.computeIfAbsent(objectId, k -> new ConcurrentHashMap<>()).put(id, time);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -610,7 +610,7 @@ public class InstanceManager implements IXmlReader
|
|||||||
public long getInstanceTime(Player player, int id)
|
public long getInstanceTime(Player player, int id)
|
||||||
{
|
{
|
||||||
// Check if exists reenter data for player
|
// Check if exists reenter data for player
|
||||||
final Map<Integer, Long> playerData = _PlayerTimes.get(player.getObjectId());
|
final Map<Integer, Long> playerData = _playerTimes.get(player.getObjectId());
|
||||||
if ((playerData == null) || !playerData.containsKey(id))
|
if ((playerData == null) || !playerData.containsKey(id))
|
||||||
{
|
{
|
||||||
return -1;
|
return -1;
|
||||||
@ -639,9 +639,9 @@ public class InstanceManager implements IXmlReader
|
|||||||
ps.setInt(1, player.getObjectId());
|
ps.setInt(1, player.getObjectId());
|
||||||
ps.setInt(2, id);
|
ps.setInt(2, id);
|
||||||
ps.execute();
|
ps.execute();
|
||||||
if (_PlayerTimes.get(player.getObjectId()) != null)
|
if (_playerTimes.get(player.getObjectId()) != null)
|
||||||
{
|
{
|
||||||
_PlayerTimes.get(player.getObjectId()).remove(id);
|
_playerTimes.get(player.getObjectId()).remove(id);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
|
@ -74,7 +74,7 @@ public class InstanceManager implements IXmlReader
|
|||||||
private int _currentInstanceId = 0;
|
private int _currentInstanceId = 0;
|
||||||
private final Map<Integer, Instance> _instanceWorlds = new ConcurrentHashMap<>();
|
private final Map<Integer, Instance> _instanceWorlds = new ConcurrentHashMap<>();
|
||||||
// Player reenter times
|
// Player reenter times
|
||||||
private final Map<Integer, Map<Integer, Long>> _PlayerTimes = new ConcurrentHashMap<>();
|
private final Map<Integer, Map<Integer, Long>> _playerTimes = new ConcurrentHashMap<>();
|
||||||
|
|
||||||
protected InstanceManager()
|
protected InstanceManager()
|
||||||
{
|
{
|
||||||
@ -96,9 +96,9 @@ public class InstanceManager implements IXmlReader
|
|||||||
parseDatapackDirectory("data/instances", true);
|
parseDatapackDirectory("data/instances", true);
|
||||||
LOGGER.info(getClass().getSimpleName() + ": Loaded " + _instanceTemplates.size() + " instance templates.");
|
LOGGER.info(getClass().getSimpleName() + ": Loaded " + _instanceTemplates.size() + " instance templates.");
|
||||||
// Load player's reenter data
|
// Load player's reenter data
|
||||||
_PlayerTimes.clear();
|
_playerTimes.clear();
|
||||||
restoreInstanceTimes();
|
restoreInstanceTimes();
|
||||||
LOGGER.info(getClass().getSimpleName() + ": Loaded instance reenter times for " + _PlayerTimes.size() + " players.");
|
LOGGER.info(getClass().getSimpleName() + ": Loaded instance reenter times for " + _playerTimes.size() + " players.");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -549,7 +549,7 @@ public class InstanceManager implements IXmlReader
|
|||||||
public Map<Integer, Long> getAllInstanceTimes(Player player)
|
public Map<Integer, Long> getAllInstanceTimes(Player player)
|
||||||
{
|
{
|
||||||
// When player don't have any instance penalty
|
// When player don't have any instance penalty
|
||||||
final Map<Integer, Long> instanceTimes = _PlayerTimes.get(player.getObjectId());
|
final Map<Integer, Long> instanceTimes = _playerTimes.get(player.getObjectId());
|
||||||
if ((instanceTimes == null) || instanceTimes.isEmpty())
|
if ((instanceTimes == null) || instanceTimes.isEmpty())
|
||||||
{
|
{
|
||||||
return Collections.emptyMap();
|
return Collections.emptyMap();
|
||||||
@ -597,7 +597,7 @@ public class InstanceManager implements IXmlReader
|
|||||||
*/
|
*/
|
||||||
public void setReenterPenalty(int objectId, int id, long time)
|
public void setReenterPenalty(int objectId, int id, long time)
|
||||||
{
|
{
|
||||||
_PlayerTimes.computeIfAbsent(objectId, k -> new ConcurrentHashMap<>()).put(id, time);
|
_playerTimes.computeIfAbsent(objectId, k -> new ConcurrentHashMap<>()).put(id, time);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -610,7 +610,7 @@ public class InstanceManager implements IXmlReader
|
|||||||
public long getInstanceTime(Player player, int id)
|
public long getInstanceTime(Player player, int id)
|
||||||
{
|
{
|
||||||
// Check if exists reenter data for player
|
// Check if exists reenter data for player
|
||||||
final Map<Integer, Long> playerData = _PlayerTimes.get(player.getObjectId());
|
final Map<Integer, Long> playerData = _playerTimes.get(player.getObjectId());
|
||||||
if ((playerData == null) || !playerData.containsKey(id))
|
if ((playerData == null) || !playerData.containsKey(id))
|
||||||
{
|
{
|
||||||
return -1;
|
return -1;
|
||||||
@ -639,9 +639,9 @@ public class InstanceManager implements IXmlReader
|
|||||||
ps.setInt(1, player.getObjectId());
|
ps.setInt(1, player.getObjectId());
|
||||||
ps.setInt(2, id);
|
ps.setInt(2, id);
|
||||||
ps.execute();
|
ps.execute();
|
||||||
if (_PlayerTimes.get(player.getObjectId()) != null)
|
if (_playerTimes.get(player.getObjectId()) != null)
|
||||||
{
|
{
|
||||||
_PlayerTimes.get(player.getObjectId()).remove(id);
|
_playerTimes.get(player.getObjectId()).remove(id);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
|
@ -74,7 +74,7 @@ public class InstanceManager implements IXmlReader
|
|||||||
private int _currentInstanceId = 0;
|
private int _currentInstanceId = 0;
|
||||||
private final Map<Integer, Instance> _instanceWorlds = new ConcurrentHashMap<>();
|
private final Map<Integer, Instance> _instanceWorlds = new ConcurrentHashMap<>();
|
||||||
// Player reenter times
|
// Player reenter times
|
||||||
private final Map<Integer, Map<Integer, Long>> _PlayerTimes = new ConcurrentHashMap<>();
|
private final Map<Integer, Map<Integer, Long>> _playerTimes = new ConcurrentHashMap<>();
|
||||||
|
|
||||||
protected InstanceManager()
|
protected InstanceManager()
|
||||||
{
|
{
|
||||||
@ -96,9 +96,9 @@ public class InstanceManager implements IXmlReader
|
|||||||
parseDatapackDirectory("data/instances", true);
|
parseDatapackDirectory("data/instances", true);
|
||||||
LOGGER.info(getClass().getSimpleName() + ": Loaded " + _instanceTemplates.size() + " instance templates.");
|
LOGGER.info(getClass().getSimpleName() + ": Loaded " + _instanceTemplates.size() + " instance templates.");
|
||||||
// Load player's reenter data
|
// Load player's reenter data
|
||||||
_PlayerTimes.clear();
|
_playerTimes.clear();
|
||||||
restoreInstanceTimes();
|
restoreInstanceTimes();
|
||||||
LOGGER.info(getClass().getSimpleName() + ": Loaded instance reenter times for " + _PlayerTimes.size() + " players.");
|
LOGGER.info(getClass().getSimpleName() + ": Loaded instance reenter times for " + _playerTimes.size() + " players.");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -549,7 +549,7 @@ public class InstanceManager implements IXmlReader
|
|||||||
public Map<Integer, Long> getAllInstanceTimes(Player player)
|
public Map<Integer, Long> getAllInstanceTimes(Player player)
|
||||||
{
|
{
|
||||||
// When player don't have any instance penalty
|
// When player don't have any instance penalty
|
||||||
final Map<Integer, Long> instanceTimes = _PlayerTimes.get(player.getObjectId());
|
final Map<Integer, Long> instanceTimes = _playerTimes.get(player.getObjectId());
|
||||||
if ((instanceTimes == null) || instanceTimes.isEmpty())
|
if ((instanceTimes == null) || instanceTimes.isEmpty())
|
||||||
{
|
{
|
||||||
return Collections.emptyMap();
|
return Collections.emptyMap();
|
||||||
@ -597,7 +597,7 @@ public class InstanceManager implements IXmlReader
|
|||||||
*/
|
*/
|
||||||
public void setReenterPenalty(int objectId, int id, long time)
|
public void setReenterPenalty(int objectId, int id, long time)
|
||||||
{
|
{
|
||||||
_PlayerTimes.computeIfAbsent(objectId, k -> new ConcurrentHashMap<>()).put(id, time);
|
_playerTimes.computeIfAbsent(objectId, k -> new ConcurrentHashMap<>()).put(id, time);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -610,7 +610,7 @@ public class InstanceManager implements IXmlReader
|
|||||||
public long getInstanceTime(Player player, int id)
|
public long getInstanceTime(Player player, int id)
|
||||||
{
|
{
|
||||||
// Check if exists reenter data for player
|
// Check if exists reenter data for player
|
||||||
final Map<Integer, Long> playerData = _PlayerTimes.get(player.getObjectId());
|
final Map<Integer, Long> playerData = _playerTimes.get(player.getObjectId());
|
||||||
if ((playerData == null) || !playerData.containsKey(id))
|
if ((playerData == null) || !playerData.containsKey(id))
|
||||||
{
|
{
|
||||||
return -1;
|
return -1;
|
||||||
@ -639,9 +639,9 @@ public class InstanceManager implements IXmlReader
|
|||||||
ps.setInt(1, player.getObjectId());
|
ps.setInt(1, player.getObjectId());
|
||||||
ps.setInt(2, id);
|
ps.setInt(2, id);
|
||||||
ps.execute();
|
ps.execute();
|
||||||
if (_PlayerTimes.get(player.getObjectId()) != null)
|
if (_playerTimes.get(player.getObjectId()) != null)
|
||||||
{
|
{
|
||||||
_PlayerTimes.get(player.getObjectId()).remove(id);
|
_playerTimes.get(player.getObjectId()).remove(id);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
|
Loading…
Reference in New Issue
Block a user