forked from MagicBane/Server
update loaded players on screen
This commit is contained in:
@@ -5234,6 +5234,12 @@ public class PlayerCharacter extends AbstractCharacter {
|
|||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
if(!this.timestamps.containsKey("nextReload")){
|
||||||
|
this.timestamps.put("nextReload",System.currentTimeMillis() + 5000L);
|
||||||
|
}else{
|
||||||
|
if(this.timestamps.get("nextReload") > System.currentTimeMillis())
|
||||||
|
updateLoadedPlayers(this);
|
||||||
|
}
|
||||||
|
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
Logger.error(e);
|
Logger.error(e);
|
||||||
@@ -5245,23 +5251,6 @@ public class PlayerCharacter extends AbstractCharacter {
|
|||||||
Logger.error("UPDATE ISSUE: " + e);
|
Logger.error("UPDATE ISSUE: " + e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void updateBoxStatus(boolean newValue) {
|
|
||||||
|
|
||||||
this.isBoxed = newValue; // Update the isBoxed status
|
|
||||||
|
|
||||||
if(this.isBoxed) {
|
|
||||||
if(!this.title.equals(CharacterTitle.PVE)){
|
|
||||||
this.title = CharacterTitle.PVE;
|
|
||||||
this.getClientConnection().forceDisconnect();
|
|
||||||
}
|
|
||||||
}else{
|
|
||||||
if(!this.title.equals(CharacterTitle.NONE)){
|
|
||||||
this.title = CharacterTitle.NONE;
|
|
||||||
this.getClientConnection().forceDisconnect();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
public static void unboxPlayer(PlayerCharacter player) {
|
public static void unboxPlayer(PlayerCharacter player) {
|
||||||
String machineID = player.getClientConnection().machineID;
|
String machineID = player.getClientConnection().machineID;
|
||||||
ArrayList<PlayerCharacter> sameMachine = new ArrayList<>();
|
ArrayList<PlayerCharacter> sameMachine = new ArrayList<>();
|
||||||
@@ -5273,13 +5262,24 @@ public class PlayerCharacter extends AbstractCharacter {
|
|||||||
for (PlayerCharacter pc : sameMachine) {
|
for (PlayerCharacter pc : sameMachine) {
|
||||||
if(pc.equals(player))
|
if(pc.equals(player))
|
||||||
continue;
|
continue;
|
||||||
//pc.isBoxed = true;
|
|
||||||
//pc.updateBoxStatus(true);
|
|
||||||
pc.isBoxed = true;
|
pc.isBoxed = true;
|
||||||
}
|
}
|
||||||
//player.updateBoxStatus(false);
|
|
||||||
player.isBoxed = false;
|
player.isBoxed = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static void updateLoadedPlayers(PlayerCharacter pc){
|
||||||
|
HashSet<AbstractWorldObject> inRange = WorldGrid.getObjectsInRangePartial(pc.loc,MBServerStatics.CHARACTER_LOAD_RANGE,MBServerStatics.MASK_PLAYER);
|
||||||
|
for(AbstractWorldObject awo : inRange){
|
||||||
|
if(pc.loadedObjects.contains(awo))
|
||||||
|
continue;
|
||||||
|
PlayerCharacter toLoad = (PlayerCharacter)awo;
|
||||||
|
if(toLoad.hidden > pc.seeInvis)
|
||||||
|
continue;
|
||||||
|
LoadCharacterMsg lcm = new LoadCharacterMsg(toLoad, PlayerCharacter.hideNonAscii());
|
||||||
|
pc.getClientConnection().sendMsg(lcm);
|
||||||
|
pc.loadedObjects.add(toLoad);
|
||||||
|
}
|
||||||
|
}
|
||||||
public static boolean checkIfBoxed(PlayerCharacter player){
|
public static boolean checkIfBoxed(PlayerCharacter player){
|
||||||
if(ConfigManager.MB_WORLD_BOXLIMIT.getValue().equals("false")) {
|
if(ConfigManager.MB_WORLD_BOXLIMIT.getValue().equals("false")) {
|
||||||
return false;
|
return false;
|
||||||
|
|||||||
Reference in New Issue
Block a user