Skip to content

Commit

Permalink
Fixed some permissions, makespawnisland can now also remove spawn island
Browse files Browse the repository at this point in the history
  • Loading branch information
aleksilassila committed Oct 30, 2020
1 parent f14d8eb commit e668ea5
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 3 deletions.
5 changes: 5 additions & 0 deletions src/me/aleksilassila/islands/IslandLayout.java
Original file line number Diff line number Diff line change
Expand Up @@ -382,6 +382,11 @@ public void deleteIsland(String islandId) {
public boolean setSpawnIsland(String islandId) {
if (getIslandsConfig().getConfigurationSection(islandId) == null) return false;

if (getIslandsConfig().getBoolean(islandId + ".isSpawn")) {
getIslandsConfig().set(islandId + ".isSpawn", false);
return true;
}

for (String island : getIslandsConfig().getKeys(false)) {
if (getIslandsConfig().getBoolean(island + ".isSpawn")) {
getIslandsConfig().set(island + ".isSpawn", false);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ public String help() {

@Override
public String getPermission() {
return Permissions.command.delete;
return Permissions.command.clear;
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,12 @@ public void onCommand(Player player, String[] args, boolean confirmed) {
return;
}

boolean removedSpawn = plugin.getIslandsConfig().getBoolean(islandId + ".isSpawn");

if (!layout.setSpawnIsland(islandId))
player.sendMessage(Messages.get("error.NOT_ON_ISLAND"));
else
player.sendMessage(Messages.get("success.SPAWN_ISLAND_CHANGED"));
player.sendMessage(Messages.get(removedSpawn ? "success.SPAWN_ISLAND_REMOVED" : "success.SPAWN_ISLAND_CHANGED"));
}

@Override
Expand Down
2 changes: 1 addition & 1 deletion src/me/aleksilassila/islands/utils/Permissions.java
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ public static class command {
public static final String create = "islands.command.create";
public static final String createCustom = "islands.command.create.custom";
public static final String recreate = "islands.command.recreate";
public static final String delete = "islands.command.delete";
public static final String clear = "islands.command.clear";
public static final String give = "islands.command.give";
public static final String name = "islands.command.name";
public static final String unname = "islands.command.unname";
Expand Down
1 change: 1 addition & 0 deletions src/messages.properties
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ success.TRUSTED=\u00a77[\u00a72\u00a7lIslands\u00a77] \u00a7aPlayer trusted!
success.SPAWN_POINT_CHANGED=\u00a77[\u00a72\u00a7lIslands\u00a77] \u00a7aIsland spawn point changed.
success.OWNER_REMOVED=\u00a77[\u00a72\u00a7lIslands\u00a77] \u00a7aIsland owner removed.
success.SPAWN_ISLAND_CHANGED=\u00a77[\u00a72\u00a7lIslands\u00a77] \u00a7aGlobal spawn island changed.
success.SPAWN_ISLAND_REMOVED=\u00a77[\u00a72\u00a7lIslands\u00a77] \u00a7aGlobal spawn island removed.
success.OWNER_CHANGED=\u00a77[\u00a72\u00a7lIslands\u00a77] \u00a7aIsland owner switched to {0}.
success.NAME_CHANGED=\u00a77[\u00a72\u00a7lIslands\u00a77] \u00a7aIsland name changed to {0}. Anyone with your island name can now visit it.
success.ISLAND_RECEIVED=\u00a77[\u00a72\u00a7lIslands\u00a77] \u00a7aYou are now the owner of {0} island, previously owned by {1}.
Expand Down
1 change: 1 addition & 0 deletions src/messages_en.properties
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ success.TRUSTED=\u00a77[\u00a72\u00a7lIslands\u00a77] \u00a7aPlayer trusted!
success.SPAWN_POINT_CHANGED=\u00a77[\u00a72\u00a7lIslands\u00a77] \u00a7aIsland spawn point changed.
success.OWNER_REMOVED=\u00a77[\u00a72\u00a7lIslands\u00a77] \u00a7aIsland owner removed.
success.SPAWN_ISLAND_CHANGED=\u00a77[\u00a72\u00a7lIslands\u00a77] \u00a7aGlobal spawn island changed.
success.SPAWN_ISLAND_REMOVED=\u00a77[\u00a72\u00a7lIslands\u00a77] \u00a7aGlobal spawn island removed.
success.OWNER_CHANGED=\u00a77[\u00a72\u00a7lIslands\u00a77] \u00a7aIsland owner switched to {0}.
success.NAME_CHANGED=\u00a77[\u00a72\u00a7lIslands\u00a77] \u00a7aIsland name changed to {0}. Anyone with your island name can now visit it.
success.ISLAND_RECEIVED=\u00a77[\u00a72\u00a7lIslands\u00a77] \u00a7aYou are now the owner of {0} island, previously owned by {1}.
Expand Down

0 comments on commit e668ea5

Please sign in to comment.