Added some defensive code in some Island's methods

This commit is contained in:
Florian CUNY 2019-01-06 11:03:32 +01:00
parent 8da1dc1590
commit 55afa166cd

View File

@ -512,6 +512,10 @@ public class Island implements DataObject {
* @param owner the island owner - the owner to set * @param owner the island owner - the owner to set
*/ */
public void setOwner(UUID owner){ public void setOwner(UUID owner){
if (this.owner == owner) {
return; //No need to update anything
}
this.owner = owner; this.owner = owner;
if (owner == null) { if (owner == null) {
return; return;
@ -579,6 +583,10 @@ public class Island implements DataObject {
* @param isSpawn {@code true} if the island is a spawn, {@code false} otherwise. * @param isSpawn {@code true} if the island is a spawn, {@code false} otherwise.
*/ */
public void setSpawn(boolean isSpawn){ public void setSpawn(boolean isSpawn){
if (spawn == isSpawn) {
return; // No need to update anything
}
spawn = isSpawn; spawn = isSpawn;
if (isSpawn) { if (isSpawn) {
owner = null; owner = null;