Skip to content

Commit

Permalink
Remove redundant nationSpawn variable (#5485)
Browse files Browse the repository at this point in the history
  • Loading branch information
Warriorrrr authored Dec 2, 2021
1 parent 60ab18c commit 33e53fa
Showing 1 changed file with 8 additions and 9 deletions.
17 changes: 8 additions & 9 deletions src/com/palmergames/bukkit/towny/object/Nation.java
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ public class Nation extends Government {
private List<Nation> allies = new ArrayList<>();
private List<Nation> enemies = new ArrayList<>();
private Town capital;
private Location nationSpawn;
private final transient List<Invite> sentAllyInvites = new ArrayList<>();

public Nation(String name) {
Expand Down Expand Up @@ -197,8 +196,8 @@ public void setCapital(Town capital) {
TownyMessaging.sendDebugMsg("Nation " + this.getName() + " has set a capital city of " + capital.getName());
this.capital = capital;

if (this.nationSpawn != null && TownySettings.isNationSpawnOnlyAllowedInCapital() && !capital.isInsideTown(this.nationSpawn))
this.nationSpawn = null;
if (this.spawn != null && TownySettings.isNationSpawnOnlyAllowedInCapital() && !capital.isInsideTown(this.spawn))
this.spawn = null;

try {
TownyPerms.assignPermissions(capital.getMayor(), null);
Expand Down Expand Up @@ -238,25 +237,25 @@ public boolean findNewCapital() {

@Override
public Location getSpawn() throws TownyException {
if (nationSpawn == null)
if (spawn == null)
throw new TownyException(Translation.of("msg_err_nation_has_not_set_a_spawn_location"));

return nationSpawn;
return spawn;
}

@Nullable
public Location getSpawnOrNull() {
return nationSpawn;
return spawn;
}


@Override
public void setSpawn(Location spawn) {
if (spawn != null)
TownyUniverse.getInstance().addSpawnPoint(new SpawnPoint(spawn, SpawnPointType.NATION_SPAWN));
else if (this.nationSpawn != null)
TownyUniverse.getInstance().removeSpawnPoint(this.nationSpawn);
this.nationSpawn = spawn;
else if (this.spawn != null)
TownyUniverse.getInstance().removeSpawnPoint(this.spawn);
this.spawn = spawn;
}

public List<Resident> getAssistants() {
Expand Down

0 comments on commit 33e53fa

Please sign in to comment.