Skip to content

Commit

Permalink
Fixed an error thrown when using admin teleport command and specifyin…
Browse files Browse the repository at this point in the history
…g an invalid world
  • Loading branch information
OmerBenGera committed Jan 25, 2022
1 parent e67cad2 commit 91d5f1f
Showing 1 changed file with 12 additions and 3 deletions.
@@ -1,11 +1,12 @@
package com.bgsoftware.superiorskyblock.commands.admin;

import com.bgsoftware.superiorskyblock.lang.Message;
import com.bgsoftware.superiorskyblock.SuperiorSkyblockPlugin;
import com.bgsoftware.superiorskyblock.api.island.Island;
import com.bgsoftware.superiorskyblock.api.wrappers.SuperiorPlayer;
import com.bgsoftware.superiorskyblock.commands.CommandArguments;
import com.bgsoftware.superiorskyblock.commands.CommandTabCompletes;
import com.bgsoftware.superiorskyblock.commands.IAdminIslandCommand;
import com.bgsoftware.superiorskyblock.lang.Message;
import com.bgsoftware.superiorskyblock.utils.logic.PortalsLogic;
import org.bukkit.Location;
import org.bukkit.World;
Expand Down Expand Up @@ -65,8 +66,16 @@ public boolean supportMultipleIslands() {
public void execute(SuperiorSkyblockPlugin plugin, CommandSender sender, SuperiorPlayer targetPlayer, Island island, String[] args) {
SuperiorPlayer superiorPlayer = plugin.getPlayers().getSuperiorPlayer(sender);

World.Environment environment = args.length == 4 ? World.Environment.valueOf(args[3].toUpperCase()) :
plugin.getSettings().getWorlds().getDefaultWorld();
World.Environment environment;

if (args.length != 4) {
environment = plugin.getSettings().getWorlds().getDefaultWorld();
} else {
environment = CommandArguments.getEnvironment(sender, args[3]);
if (environment == null)
return;
}


if (environment != plugin.getSettings().getWorlds().getDefaultWorld()) {
if (!island.wasSchematicGenerated(environment)) {
Expand Down

0 comments on commit 91d5f1f

Please sign in to comment.