This commit is contained in:
Anuken
2024-04-14 11:17:57 -04:00
parent e80a523073
commit 569d0f8fac
4 changed files with 10 additions and 5 deletions

View File

@@ -1310,7 +1310,7 @@ abstract class BuildingComp implements Posc, Teamc, Healthc, Buildingc, Timerc,
if(value instanceof UnitType) type = UnitType.class;
if(builder != null && builder.isPlayer()){
lastAccessed = builder.getPlayer().coloredName();
updateLastAccess(builder.getPlayer());
}
if(block.configurations.containsKey(type)){
@@ -1324,6 +1324,10 @@ abstract class BuildingComp implements Posc, Teamc, Healthc, Buildingc, Timerc,
}
}
public void updateLastAccess(Player player){
lastAccessed = player.coloredName();
}
/** Called when the block is tapped by the local player. */
public void tapped(){

View File

@@ -734,7 +734,7 @@ abstract class UnitComp implements Healthc, Physicsc, Hitboxc, Statusc, Teamc, I
/** @return name of direct or indirect player controller. */
@Override
public @Nullable String getControllerName(){
if(isPlayer()) return getPlayer().name;
if(isPlayer()) return getPlayer().coloredName();
if(controller instanceof LogicAI ai && ai.controller != null) return ai.controller.lastAccessed;
return null;
}