Skip to content

Commit

Permalink
Fixed detection of disabled worlds using /is admin teleport
Browse files Browse the repository at this point in the history
  • Loading branch information
OmerBenGera committed Mar 19, 2022
1 parent 3a06851 commit 352c9d9
Show file tree
Hide file tree
Showing 14 changed files with 18 additions and 0 deletions.
Expand Up @@ -145,6 +145,7 @@ public static Island getSpawnIsland() {
/**
* Get the world of an island by the world's environment.
*/
@Nullable
public static World getIslandsWorld(Island island, World.Environment environment) {
return plugin.getGrid().getIslandsWorld(island, environment);
}
Expand Down
Expand Up @@ -223,6 +223,7 @@ void createIsland(SuperiorPlayer superiorPlayer, String schemName, BigDecimal bo
* @param environment The world environment.
* @param island The island to check.
*/
@Nullable
World getIslandsWorld(Island island, World.Environment environment);

/**
Expand Down
Expand Up @@ -4,6 +4,7 @@
import org.bukkit.Location;
import org.bukkit.World;

import javax.annotation.Nullable;
import java.util.UUID;

public interface WorldsProvider {
Expand All @@ -20,6 +21,7 @@ public interface WorldsProvider {
* @param environment The world environment.
* @param island The island to check.
*/
@Nullable
World getIslandsWorld(Island island, World.Environment environment);

/**
Expand Down
Expand Up @@ -75,6 +75,10 @@ public void execute(SuperiorSkyblockPlugin plugin, CommandSender sender, Superio
return;
}

if (plugin.getGrid().getIslandsWorld(island, environment) == null) {
Message.WORLD_NOT_ENABLED.send(sender);
return;
}

if (environment != plugin.getSettings().getWorlds().getDefaultWorld()) {
if (!island.wasSchematicGenerated(environment)) {
Expand Down
Expand Up @@ -694,6 +694,7 @@ public enum Message {
WITHDRAW_ALL_MONEY,
WITHDRAW_ANNOUNCEMENT,
WITHDRAW_ERROR,
WORLD_NOT_ENABLED,
WORLD_NOT_UNLOCKED,

CUSTOM {
Expand Down
1 change: 1 addition & 0 deletions src/main/resources/lang/de-DE.yml
Expand Up @@ -956,4 +956,5 @@ WITHDRAW_ANNOUNCEMENT: '&e&lBank | &7{0} withdrawn ${1} from the island bank!'
WITHDRAW_ERROR: '&c&lError | &7{0}.'
WITHDRAWN_MONEY: '&e&lBank | &7You withdrawn ${0} from {1}''s island bank!'
WITHDRAWN_MONEY_NAME: '&e&lBank | &7Du hast ${0} von der Inselbank von {1} abgehoben!'
WORLD_NOT_ENABLED: '&e&lWorlds | &7This world is not enabled on the server.'
WORLD_NOT_UNLOCKED: '&e&lWorlds | &7Die Welt {0} ist noch nicht freigeschaltet!'
1 change: 1 addition & 0 deletions src/main/resources/lang/en-US.yml
Expand Up @@ -736,4 +736,5 @@ WITHDRAW_ANNOUNCEMENT: '&e&lBank | &7{0} withdrawn ${1} from the island bank!'
WITHDRAW_ERROR: '&c&lError | &7{0}.'
WITHDRAWN_MONEY: '&e&lBank | &7You withdrawn ${0} from {1}''s island bank!'
WITHDRAWN_MONEY_NAME: '&e&lBank | &7You withdrawn ${0} from the island bank of {1}!'
WORLD_NOT_ENABLED: '&e&lWorlds | &7This world is not enabled on the server.'
WORLD_NOT_UNLOCKED: '&e&lWorlds | &7The {0} world is not unlocked yet!'
1 change: 1 addition & 0 deletions src/main/resources/lang/es-ES.yml
Expand Up @@ -736,4 +736,5 @@ WITHDRAW_ANNOUNCEMENT: '&e&lBanco | &7{0} esta retirado ${1} del banco de la isl
WITHDRAW_ERROR: '&c&lError | &7{0}.'
WITHDRAWN_MONEY: '&e&lBanco | &7¡Retiraste ${0} del banco de la isla de {1}!'
WITHDRAWN_MONEY_NAME: '&e&lBanco | &7¡Retiraste ${0} del banco de la isla de {1}!'
WORLD_NOT_ENABLED: '&e&lWorlds | &7This world is not enabled on the server.'
WORLD_NOT_UNLOCKED: '&e&lMundos | &7¡El mundo {0} aún no está desbloqueado!'
1 change: 1 addition & 0 deletions src/main/resources/lang/fr-FR.yml
Expand Up @@ -738,4 +738,5 @@ WITHDRAW_ANNOUNCEMENT: '&e&lBanque | &7{0} a retiré {1}$ du compte de l''île !
WITHDRAW_ERROR: '&c&lErreur | &7{0}.'
WITHDRAWN_MONEY: '&e&lBanque | &7Vous avez retiré {0}$ du compte de l''île de {1} !'
WITHDRAWN_MONEY_NAME: '&e&lBanque | &7Vous avez retiré {0}$ du compte de l''île {1} !'
WORLD_NOT_ENABLED: '&e&lWorlds | &7This world is not enabled on the server.'
WORLD_NOT_UNLOCKED: '&e&lMondes | &7Le monde {0} n''a pas encore été dévérouillé !'
1 change: 1 addition & 0 deletions src/main/resources/lang/it-IT.yml
Expand Up @@ -741,4 +741,5 @@ WITHDRAW_ANNOUNCEMENT: '&e&lBanca | &7{0} ha prelevato ${1} dalla banca dell''is
WITHDRAW_ERROR: '&c&lErrore | &7{0}.'
WITHDRAWN_MONEY: '&e&lBanca | &7Hai ritirato ${0} dalla banca dell''isola di {1}!'
WITHDRAWN_MONEY_NAME: '&e&lBanca | &7Hai ritirato ${0} dalla riva dell''isola {1}!'
WORLD_NOT_ENABLED: '&e&lWorlds | &7This world is not enabled on the server.'
WORLD_NOT_UNLOCKED: '&e&lMondi | &7Il mondo {0} non è ancora stato sbloccato!'
1 change: 1 addition & 0 deletions src/main/resources/lang/iw-IL.yml
Expand Up @@ -758,4 +758,5 @@ WITHDRAW_ANNOUNCEMENT: '&e&lקנב | &7יאה לש קנבהמ ${1} ךשמ {0}!'
WITHDRAW_ERROR: '&c&lError | &7{0}.'
WITHDRAWN_MONEY: '&e&lקנב | &7{1} לש יאה לש קנבהמ ${0} תכשמ!'
WITHDRAWN_MONEY_NAME: '&e&lקנב | &7{1} יאה לש קנבהמ ${0} תכשמ!'
WORLD_NOT_ENABLED: '&e&lWorlds | &7This world is not enabled on the server.'
WORLD_NOT_UNLOCKED: '&e&lתומלוע | &7הזה יאב חותפ אל ןיידע {0} םלועה.'
1 change: 1 addition & 0 deletions src/main/resources/lang/pl-PL.yml
Expand Up @@ -738,4 +738,5 @@ WITHDRAW_ANNOUNCEMENT: '&e&lBank | &7{0} wyplaciles {1}$ z banku wyspy!'
WITHDRAW_ERROR: '&c&lBlad | &7{0}.'
WITHDRAWN_MONEY: '&e&lBank | &7Wyplaciles {0}$ z banku wysp {1}!'
WITHDRAWN_MONEY_NAME: '&e&lBank | &7Wyplaciles {0}$ z banku wyspy {1}!'
WORLD_NOT_ENABLED: '&e&lWorlds | &7This world is not enabled on the server.'
WORLD_NOT_UNLOCKED: '&e&lSwiaty | &7swiat {0} nie jest jeszcze odblokowany!'
1 change: 1 addition & 0 deletions src/main/resources/lang/vi-VN.yml
Expand Up @@ -834,4 +834,5 @@ WITHDRAW_ANNOUNCEMENT: '&e&lNgân Hàng | &7{0} rút {1}$ từ ngân hàng của
WITHDRAW_ERROR: '&c&lLỗi | &7{0}.'
WITHDRAWN_MONEY: '&e&lNgân Hàng | &7Bạn đã rút ${0} từ đảo của {1}!'
WITHDRAWN_MONEY_NAME: '&e&lNgân Hàng | &7Bạn đã rút ${0} từ đảo {1}!'
WORLD_NOT_ENABLED: '&e&lWorlds | &7This world is not enabled on the server.'
WORLD_NOT_UNLOCKED: '&e&lThế Giới | &7Thế giới {0} hiện chưa được mở khóa!'
1 change: 1 addition & 0 deletions src/main/resources/lang/zh-CN.yml
Expand Up @@ -738,4 +738,5 @@ WITHDRAW_ANNOUNCEMENT: '&e&l岛屿银行 | &b{0} &7从岛屿银行取出了 &e&l
WITHDRAW_ERROR: '&c&lError | &7{0}.'
WITHDRAWN_MONEY: '&e&l岛屿银行 | &7你从 &b{1} &7的岛屿银行取出了 &e&l${0} &7游戏币!'
WITHDRAWN_MONEY_NAME: '&e&l岛屿银行 | &7你从 &b{1} &7岛屿银行取出了 &e&l${0} &7游戏币!'
WORLD_NOT_ENABLED: '&e&lWorlds | &7This world is not enabled on the server.'
WORLD_NOT_UNLOCKED: '&e&l岛屿维度 | &7你的岛屿还未解锁这个世界维度!'

0 comments on commit 352c9d9

Please sign in to comment.