Skip to content

Commit

Permalink
hide player waypoints when mod is disabled
Browse files Browse the repository at this point in the history
  • Loading branch information
Gjum committed Aug 4, 2020
1 parent f226858 commit 8c6d6bb
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 3 deletions.
2 changes: 1 addition & 1 deletion litemod/gradle.properties
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name=Synapse
description=Civ player utilities
projectGroup=gjum.minecraft.civ.synapse
version=2.0.0-beta10
version=2.0.0-beta11
mcVersion=1.12.2
mcMappings=snapshot_20180101
forgeGradleVersion=2.3-SNAPSHOT
Original file line number Diff line number Diff line change
Expand Up @@ -225,6 +225,7 @@ private void onModDeactivated() {
player.setGlowing(false);
}
}
if (waypointManager != null) waypointManager.updateAllWaypoints();
comms.disconnect();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -139,10 +139,12 @@ public void updateMapWaypoints() {
final EntityPlayer player = getMc().world.getPlayerEntityByName(account);
hiddenForNearby = player != null;

final boolean modActive = LiteModSynapse.instance.isModActive();

final GlobalConfig globalConfig = LiteModSynapse.instance.config;
try {
if (isJourneyMapLoaded()) {
if (globalConfig.isUseJourneyMap()) {
if (modActive && globalConfig.isUseJourneyMap()) {
JourneyMapHelper.updateWaypoint(this);
} else {
JourneyMapHelper.deleteWaypoint(this);
Expand All @@ -154,7 +156,7 @@ public void updateMapWaypoints() {

try {
if (isVoxelMapActive()) {
if (globalConfig.isUseVoxelMap()) {
if (modActive && globalConfig.isUseVoxelMap()) {
VoxelMapHelper.updateWaypoint(this);
} else {
VoxelMapHelper.deleteWaypoint(this);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,18 @@ public void updateAllWaypoints() {
}
}

/**
* e.g. when mod is disabled
*/
public void deleteAllWaypoints() {
for (MultiWaypoint point : managedAccountWaypoints.values()) {
point.deleteMapWaypoints();
}
for (MultiWaypoint point : managedPearlWaypoints.values()) {
point.deleteMapWaypoints();
}
}

@Override
public void handlePersonChange(@Nullable Person personOld, @Nullable Person personNew) {
if (personOld != null) {
Expand Down

0 comments on commit 8c6d6bb

Please sign in to comment.