Replaced disabled skills CopyOnWriteArrayList, also minor loc and PlayerInstance cleanups.

This commit is contained in:
MobiusDevelopment 2020-09-29 14:33:47 +00:00
parent 12bc3abb9f
commit 5a26950843
6 changed files with 8 additions and 14 deletions

View File

@ -32,10 +32,8 @@ public class Loc implements IUserCommandHandler
@Override @Override
public boolean useUserCommand(int id, PlayerInstance player) public boolean useUserCommand(int id, PlayerInstance player)
{ {
final int _nearestTown = MapRegionData.getInstance().getClosestTownNumber(player); final SystemMessageId msg;
SystemMessageId msg; switch (MapRegionData.getInstance().getClosestTownNumber(player))
switch (_nearestTown)
{ {
case 0: case 0:
{ {

View File

@ -23,8 +23,8 @@ import java.util.Collection;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.Set;
import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.CopyOnWriteArrayList;
import java.util.concurrent.Future; import java.util.concurrent.Future;
import java.util.logging.Logger; import java.util.logging.Logger;
@ -4337,7 +4337,7 @@ public abstract class Creature extends WorldObject implements ISkillsHolder
public int geoPathGty; public int geoPathGty;
} }
protected List<Skill> _disabledSkills = new CopyOnWriteArrayList<>(); protected Set<Skill> _disabledSkills = ConcurrentHashMap.newKeySet();
private boolean _allSkillsDisabled; private boolean _allSkillsDisabled;
protected MoveData _move; protected MoveData _move;
private boolean _cursorKeyMovement = false; private boolean _cursorKeyMovement = false;

View File

@ -700,7 +700,6 @@ public class PlayerInstance extends Playable
{ {
sendPacket(ActionFailed.STATIC_PACKET); sendPacket(ActionFailed.STATIC_PACKET);
return; return;
} }
// during teleport phase, players cant do any attack // during teleport phase, players cant do any attack

View File

@ -32,10 +32,8 @@ public class Loc implements IUserCommandHandler
@Override @Override
public boolean useUserCommand(int id, PlayerInstance player) public boolean useUserCommand(int id, PlayerInstance player)
{ {
final int _nearestTown = MapRegionData.getInstance().getClosestTownNumber(player); final SystemMessageId msg;
SystemMessageId msg; switch (MapRegionData.getInstance().getClosestTownNumber(player))
switch (_nearestTown)
{ {
case 0: case 0:
{ {

View File

@ -23,8 +23,8 @@ import java.util.Collection;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.Set;
import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.CopyOnWriteArrayList;
import java.util.concurrent.Future; import java.util.concurrent.Future;
import java.util.logging.Logger; import java.util.logging.Logger;
@ -4385,7 +4385,7 @@ public abstract class Creature extends WorldObject implements ISkillsHolder
public int geoPathGty; public int geoPathGty;
} }
protected List<Skill> _disabledSkills = new CopyOnWriteArrayList<>(); protected Set<Skill> _disabledSkills = ConcurrentHashMap.newKeySet();
private boolean _allSkillsDisabled; private boolean _allSkillsDisabled;
protected MoveData _move; protected MoveData _move;
private boolean _cursorKeyMovement = false; private boolean _cursorKeyMovement = false;

View File

@ -714,7 +714,6 @@ public class PlayerInstance extends Playable
{ {
sendPacket(ActionFailed.STATIC_PACKET); sendPacket(ActionFailed.STATIC_PACKET);
return; return;
} }
// during teleport phase, players cant do any attack // during teleport phase, players cant do any attack