diff --git a/src/main/java/com/onarandombox/multiverseinventories/ShareHandler.java b/src/main/java/com/onarandombox/multiverseinventories/ShareHandler.java index 25008ab6..8088c47c 100644 --- a/src/main/java/com/onarandombox/multiverseinventories/ShareHandler.java +++ b/src/main/java/com/onarandombox/multiverseinventories/ShareHandler.java @@ -3,6 +3,7 @@ import com.dumptruckman.minecraft.util.Logging; import com.onarandombox.multiverseinventories.event.ShareHandlingEvent; import com.onarandombox.multiverseinventories.profile.PlayerProfile; +import com.onarandombox.multiverseinventories.profile.ProfileTypes; import com.onarandombox.multiverseinventories.share.PersistingProfile; import com.onarandombox.multiverseinventories.share.Shares; import org.bukkit.Bukkit; @@ -42,7 +43,9 @@ final void handleSharing() { } protected final void setAlwaysWriteProfile(PlayerProfile profile) { - affectedProfiles.setAlwaysWriteProfile(profile); + if (!profile.getProfileType().equals(ProfileTypes.NONE)) { + affectedProfiles.setAlwaysWriteProfile(profile); + } } /** @@ -50,7 +53,9 @@ protected final void setAlwaysWriteProfile(PlayerProfile profile) { * @param shares What from this group needs to be saved. */ protected final void addWriteProfile(PlayerProfile profile, Shares shares) { - affectedProfiles.addWriteProfile(profile, shares); + if (!profile.getProfileType().equals(ProfileTypes.NONE)) { + affectedProfiles.addWriteProfile(profile, shares); + } } /** @@ -61,7 +66,9 @@ protected final void addWriteProfile(PlayerProfile profile, Shares shares) { * @param shares What from this group needs to be loaded. */ protected final void addReadProfile(PlayerProfile profile, Shares shares) { - affectedProfiles.addReadProfile(profile, shares); + if (!profile.getProfileType().equals(ProfileTypes.NONE)) { + affectedProfiles.addReadProfile(profile, shares); + } } protected abstract ShareHandlingEvent createEvent(); diff --git a/src/main/java/com/onarandombox/multiverseinventories/profile/ProfileTypes.java b/src/main/java/com/onarandombox/multiverseinventories/profile/ProfileTypes.java index 4de6121b..4aaf8164 100644 --- a/src/main/java/com/onarandombox/multiverseinventories/profile/ProfileTypes.java +++ b/src/main/java/com/onarandombox/multiverseinventories/profile/ProfileTypes.java @@ -22,6 +22,11 @@ public final class ProfileTypes { */ public static final ProfileType ADVENTURE = ProfileType.createProfileType("ADVENTURE"); + /** + * The profile type for the any other Game Modes, i.e. spectator. + */ + public static final ProfileType NONE = ProfileType.createProfileType("NONE"); + /** * Returns the appropriate ProfileType for the given game mode. * @@ -37,7 +42,7 @@ public static ProfileType forGameMode(GameMode mode) { case ADVENTURE: return ADVENTURE; default: - return SURVIVAL; + return NONE; } }