Add world capability check for setfirework
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
parent
34730ec881
commit
ea02b866e1
@ -1,6 +1,7 @@
|
||||
package wtf.beatrice.uhccore.commands.uhccommands;
|
||||
|
||||
import wtf.beatrice.uhccore.utils.Cache;
|
||||
import wtf.beatrice.uhccore.utils.MessageUtils;
|
||||
import wtf.beatrice.uhccore.utils.configuration.ConfigEntry;
|
||||
import wtf.beatrice.uhccore.utils.Debugger;
|
||||
import wtf.beatrice.uhccore.utils.configuration.FileUtils;
|
||||
@ -8,6 +9,7 @@ import org.bukkit.Location;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.configuration.file.YamlConfiguration;
|
||||
import org.bukkit.entity.Player;
|
||||
import wtf.beatrice.uhccore.utils.configuration.LocalizedMessage;
|
||||
|
||||
import java.util.logging.Level;
|
||||
|
||||
@ -21,6 +23,14 @@ public class SetFireworkCommand
|
||||
Player player = (Player) sender;
|
||||
Location fireworkLoc = player.getLocation();
|
||||
|
||||
String worldName = fireworkLoc.getWorld().getName();
|
||||
|
||||
if(!Cache.lobbyWorlds.contains(worldName))
|
||||
{
|
||||
MessageUtils.sendLocalizedMessage(sender, LocalizedMessage.ERROR_NOT_IN_LOBBY_WORLD);
|
||||
return;
|
||||
}
|
||||
|
||||
YamlConfiguration config = FileUtils.FileType.CONFIG_YAML.yaml;
|
||||
|
||||
int listPos = Cache.fireworksLocations.size() + 1;
|
||||
@ -41,7 +51,7 @@ public class SetFireworkCommand
|
||||
config.set(currentPath + ".x", fireworkLoc.getX());
|
||||
config.set(currentPath + ".y", fireworkLoc.getY());
|
||||
config.set(currentPath + ".z", fireworkLoc.getZ());
|
||||
config.set(currentPath + ".world", fireworkLoc.getWorld().getName());
|
||||
config.set(currentPath + ".world", worldName);
|
||||
|
||||
FileUtils.FileType.CONFIG_YAML.yaml = config;
|
||||
FileUtils.saveExistingYaml(FileUtils.FileType.CONFIG_YAML);
|
||||
|
Loading…
Reference in New Issue
Block a user