diff --git a/src/main/java/com/dev7ex/multiworld/MultiWorldConfiguration.java b/src/main/java/com/dev7ex/multiworld/MultiWorldConfiguration.java deleted file mode 100644 index 2103137..0000000 --- a/src/main/java/com/dev7ex/multiworld/MultiWorldConfiguration.java +++ /dev/null @@ -1,64 +0,0 @@ -package com.dev7ex.multiworld; - -import com.dev7ex.common.bukkit.command.BukkitCommand; -import com.dev7ex.common.bukkit.configuration.ConfigurationProperties; -import com.dev7ex.common.bukkit.plugin.BukkitPlugin; -import com.dev7ex.common.bukkit.plugin.configuration.DefaultPluginConfiguration; -import com.dev7ex.common.map.ParsedMap; -import com.dev7ex.multiworld.api.MultiWorldApiConfiguration; -import com.dev7ex.multiworld.world.WorldOption; -import lombok.SneakyThrows; - -import java.util.List; - -/** - * @author Dev7ex - * @since 19.05.2021 - */ -@ConfigurationProperties(fileName = "config.yml") -public final class MultiWorldConfiguration extends DefaultPluginConfiguration implements MultiWorldApiConfiguration { - - private final ParsedMap worldDefaults = new ParsedMap<>(); - private final String messagePath = "messages."; - - public MultiWorldConfiguration(final BukkitPlugin bukkitPlugin) { - super(bukkitPlugin); - } - - @Override @SneakyThrows - public void load() { - super.load(); - - super.getFileConfiguration().getConfigurationSection("defaults").getKeys(false).stream() - .filter(entry -> !entry.equalsIgnoreCase("world")) // Ignore this - .forEach(entry -> this.worldDefaults.put(WorldOption.valueOf(entry.replaceAll("-", "_").toUpperCase()), super.getFileConfiguration().get(entry))); - - this.loadChanges(); - } - - public void loadChanges() { - if (!super.getFileConfiguration().contains("config-version")) { - super.getFileConfiguration().set("config-version", "1.3.1-SNAPSHOT"); - super.saveFile(); - } - } - - @Override - public List getAutoLoadableWorlds() { - return super.getStringList("auto-load"); - } - - @Override - public String getDefaultWorldName() { - return super.getFileConfiguration().getString("defaults.world"); - } - - public String getCommandUsage(final BukkitCommand bukkitCommand) { - return super.getString(this.messagePath + bukkitCommand.getName() + ".usage").replaceAll("%prefix%", super.getPrefix()); - } - - public String getMessage(final String path) { - return this.getString(this.messagePath + path).replaceAll("%prefix%", super.getPrefix()); - } - -} diff --git a/src/main/java/com/dev7ex/multiworld/MultiWorldPlugin.java b/src/main/java/com/dev7ex/multiworld/MultiWorldPlugin.java deleted file mode 100644 index eb60618..0000000 --- a/src/main/java/com/dev7ex/multiworld/MultiWorldPlugin.java +++ /dev/null @@ -1,121 +0,0 @@ -package com.dev7ex.multiworld; - -import com.dev7ex.common.bukkit.plugin.BukkitPlugin; - -import com.dev7ex.common.bukkit.plugin.PluginProperties; -import com.dev7ex.multiworld.api.MultiWorldApi; -import com.dev7ex.multiworld.api.MultiWorldProvider; -import com.dev7ex.multiworld.command.WorldCommand; -import com.dev7ex.multiworld.listener.*; -import com.dev7ex.multiworld.world.WorldConfiguration; -import com.dev7ex.multiworld.user.WorldUserService; -import com.dev7ex.multiworld.world.WorldManager; -import com.dev7ex.multiworld.world.WorldService; - -import lombok.AccessLevel; -import lombok.Getter; - -import org.bukkit.Bukkit; -import org.bukkit.plugin.Plugin; -import org.bukkit.plugin.java.JavaPlugin; - -import java.io.IOException; -import java.io.InputStream; -import java.net.URL; -import java.util.Scanner; - -/** - * @author Dev7ex - * @since 19.05.2021 - */ -@Getter(AccessLevel.PUBLIC) -@PluginProperties(resourceId = 92559, metricsId = 15446, metrics = true) -public final class MultiWorldPlugin extends BukkitPlugin implements MultiWorldApi { - - private boolean updateAvailable = false; - - private MultiWorldConfiguration configuration; - private WorldConfiguration worldConfiguration; - private WorldService worldService; - private WorldManager worldManager; - private WorldUserService worldUserService; - - @Override - public void onLoad() { - this.configuration = new MultiWorldConfiguration(this); - this.configuration.load(); - - this.worldConfiguration = new WorldConfiguration(this); - } - - @Override - public void onEnable() { - MultiWorldProvider.registerApi(this); - - final Plugin facilisCommonPlugin = super.getServer().getPluginManager().getPlugin("FacilisCommon"); - - if (!facilisCommonPlugin.getDescription().getVersion().equalsIgnoreCase("1.0.0-b002-SNAPSHOT")) { - super.getLogger().severe("MultiWorld need FacilisCommon 1.0.0-b002-SNAPSHOT"); - super.getLogger().severe("https://www.spigotmc.org/resources/faciliscommon.107198/"); - super.getServer().getPluginManager().disablePlugin(this); - return; - } - - this.checkUpdates(); - - super.registerService(this.worldUserService = new WorldUserService()); - this.worldManager = new WorldManager(this.configuration, this.worldConfiguration, this.worldUserService); - super.registerService(this.worldService = new WorldService(this.worldManager, this.worldConfiguration)); - } - - @Override - public void onDisable() { - MultiWorldProvider.unregisterApi(); - - super.onDisable(); - } - - @Override - public void registerCommands() { - super.registerCommand(new WorldCommand(this)); - } - - @Override - public void registerListeners() { - super.registerListener(new EntityDamageByEntityListener(this)); - super.registerListenerIf(new PlayerChangeWorldListener(this), - enable -> this.configuration.getBoolean("settings.auto-gamemode")); - super.registerListener(new PlayerConnectionListener(this)); - } - - public void checkUpdates() { - super.getServer().getScheduler().runTaskAsynchronously(this, () -> { - - try (final InputStream inputStream = new URL("https://api.spigotmc.org/legacy/update.php?resource=" + super.getResourceId()).openStream()) { - try (final Scanner scanner = new Scanner(inputStream)) { - - if (scanner.hasNext()) { - final String currentVersion = this.getDescription().getVersion(); - final String newVersion = scanner.next(); - if (!currentVersion.equalsIgnoreCase(newVersion)) { - this.updateAvailable = true; - super.getServer().getScheduler().runTask(this, () -> { - super.getLogger().info("There is a new update available."); - }); - - } - } - } - } catch (final IOException exception) { - super.getServer().getScheduler().runTask(this, () -> { - super.getLogger().info("Unable to check for updates: " + exception.getMessage()); - }); - } - }); - } - - public static MultiWorldPlugin getInstance() { - return JavaPlugin.getPlugin(MultiWorldPlugin.class); - } - -} diff --git a/src/main/java/com/dev7ex/multiworld/api/MultiWorldApi.java b/src/main/java/com/dev7ex/multiworld/api/MultiWorldApi.java deleted file mode 100644 index ab0eaf2..0000000 --- a/src/main/java/com/dev7ex/multiworld/api/MultiWorldApi.java +++ /dev/null @@ -1,21 +0,0 @@ -package com.dev7ex.multiworld.api; - -import com.dev7ex.multiworld.user.WorldUserService; -import com.dev7ex.multiworld.world.WorldManager; -import com.dev7ex.multiworld.world.WorldService; - -/** - * @author Dev7ex - * @since 20.12.2022 - */ -public interface MultiWorldApi { - - WorldService getWorldService(); - - WorldManager getWorldManager(); - - WorldUserService getWorldUserService(); - - MultiWorldApiConfiguration getConfiguration(); - -} diff --git a/src/main/java/com/dev7ex/multiworld/api/MultiWorldApiConfiguration.java b/src/main/java/com/dev7ex/multiworld/api/MultiWorldApiConfiguration.java deleted file mode 100644 index 2d9b9e2..0000000 --- a/src/main/java/com/dev7ex/multiworld/api/MultiWorldApiConfiguration.java +++ /dev/null @@ -1,21 +0,0 @@ -package com.dev7ex.multiworld.api; - -import org.apache.maven.artifact.versioning.DefaultArtifactVersion; - -import java.util.List; - -/** - * @author Dev7ex - * @since 25.01.2023 - */ -public interface MultiWorldApiConfiguration { - - DefaultArtifactVersion getVersion(); - - String getVersionAsString(); - - String getDefaultWorldName(); - - List getAutoLoadableWorlds(); - -} diff --git a/src/main/java/com/dev7ex/multiworld/api/MultiWorldProvider.java b/src/main/java/com/dev7ex/multiworld/api/MultiWorldProvider.java deleted file mode 100644 index c51c728..0000000 --- a/src/main/java/com/dev7ex/multiworld/api/MultiWorldProvider.java +++ /dev/null @@ -1,23 +0,0 @@ -package com.dev7ex.multiworld.api; - -/** - * @author Dev7ex - * @since 20.12.2022 - */ -public class MultiWorldProvider { - - private static MultiWorldApi multiWorldApi; - - public static void registerApi(final MultiWorldApi multiWorldApi) { - MultiWorldProvider.multiWorldApi = multiWorldApi; - } - - public static void unregisterApi() { - MultiWorldProvider.multiWorldApi = null; - } - - public static MultiWorldApi getMultiWorldApi() { - return multiWorldApi; - } - -} diff --git a/src/main/java/com/dev7ex/multiworld/api/event/MultiWorldListener.java b/src/main/java/com/dev7ex/multiworld/api/event/MultiWorldListener.java deleted file mode 100644 index b7ab083..0000000 --- a/src/main/java/com/dev7ex/multiworld/api/event/MultiWorldListener.java +++ /dev/null @@ -1,41 +0,0 @@ -package com.dev7ex.multiworld.api.event; - -import com.dev7ex.multiworld.MultiWorldConfiguration; -import com.dev7ex.multiworld.MultiWorldPlugin; -import com.dev7ex.multiworld.user.WorldUser; -import com.dev7ex.multiworld.user.WorldUserService; -import com.dev7ex.multiworld.world.WorldManager; - -import org.bukkit.event.Listener; - -import java.util.UUID; - -/** - * @author Dev7ex - * @since 20.05.2021 - */ -public abstract class MultiWorldListener implements Listener { - - protected final MultiWorldPlugin multiWorldPlugin; - - protected MultiWorldListener(final MultiWorldPlugin multiWorldPlugin) { - this.multiWorldPlugin = multiWorldPlugin; - } - - protected final WorldUser getWorldUser(final UUID uniqueId) { - return this.getWorldUserService().getUsers().get(uniqueId); - } - - protected final MultiWorldConfiguration getConfiguration() { - return this.multiWorldPlugin.getConfiguration(); - } - - protected final WorldManager getWorldManager() { - return this.multiWorldPlugin.getWorldManager(); - } - - protected final WorldUserService getWorldUserService() { - return this.multiWorldPlugin.getWorldUserService(); - } - -} diff --git a/src/main/java/com/dev7ex/multiworld/api/event/plugin/MultiWorldStartupCompleteEvent.java b/src/main/java/com/dev7ex/multiworld/api/event/plugin/MultiWorldStartupCompleteEvent.java deleted file mode 100644 index 0591cb0..0000000 --- a/src/main/java/com/dev7ex/multiworld/api/event/plugin/MultiWorldStartupCompleteEvent.java +++ /dev/null @@ -1,34 +0,0 @@ -package com.dev7ex.multiworld.api.event.plugin; - -import lombok.AccessLevel; -import lombok.Getter; -import lombok.Setter; - -import org.bukkit.event.Event; -import org.bukkit.event.HandlerList; - -/** - * @author itsTyrion - * @since 29.11.2022 - */ -@Getter(AccessLevel.PUBLIC) -@Setter(AccessLevel.PUBLIC) -public class MultiWorldStartupCompleteEvent extends Event { - - private static final HandlerList HANDLERS = new HandlerList(); - private long startupDuration; - - public MultiWorldStartupCompleteEvent(final long startupDuration) { - this.startupDuration = startupDuration; - } - - public static HandlerList getHandlerList() { - return HANDLERS; - } - - @Override - public HandlerList getHandlers() { - return HANDLERS; - } - -} diff --git a/src/main/java/com/dev7ex/multiworld/api/event/user/WorldUserEvent.java b/src/main/java/com/dev7ex/multiworld/api/event/user/WorldUserEvent.java deleted file mode 100644 index a5bdc29..0000000 --- a/src/main/java/com/dev7ex/multiworld/api/event/user/WorldUserEvent.java +++ /dev/null @@ -1,23 +0,0 @@ -package com.dev7ex.multiworld.api.event.user; - -import com.dev7ex.multiworld.user.WorldUser; - -import lombok.AccessLevel; -import lombok.Getter; - -import org.bukkit.event.Event; - -/** - * @author Dev7ex - * @since 20.12.2022 - */ -@Getter(AccessLevel.PUBLIC) -public abstract class WorldUserEvent extends Event { - - private final WorldUser user; - - public WorldUserEvent(final WorldUser user) { - this.user = user; - } - -} diff --git a/src/main/java/com/dev7ex/multiworld/api/event/user/WorldUserLoginEvent.java b/src/main/java/com/dev7ex/multiworld/api/event/user/WorldUserLoginEvent.java deleted file mode 100644 index 6cbb6af..0000000 --- a/src/main/java/com/dev7ex/multiworld/api/event/user/WorldUserLoginEvent.java +++ /dev/null @@ -1,27 +0,0 @@ -package com.dev7ex.multiworld.api.event.user; - -import com.dev7ex.multiworld.user.WorldUser; -import org.bukkit.event.HandlerList; - -/** - * @author Dev7ex - * @since 20.12.2022 - */ -public class WorldUserLoginEvent extends WorldUserEvent { - - private static final HandlerList HANDLERS = new HandlerList(); - - public WorldUserLoginEvent(final WorldUser user) { - super(user); - } - - public static HandlerList getHandlerList() { - return HANDLERS; - } - - @Override - public HandlerList getHandlers() { - return HANDLERS; - } - -} diff --git a/src/main/java/com/dev7ex/multiworld/api/event/user/WorldUserLogoutEvent.java b/src/main/java/com/dev7ex/multiworld/api/event/user/WorldUserLogoutEvent.java deleted file mode 100644 index efc466c..0000000 --- a/src/main/java/com/dev7ex/multiworld/api/event/user/WorldUserLogoutEvent.java +++ /dev/null @@ -1,27 +0,0 @@ -package com.dev7ex.multiworld.api.event.user; - -import com.dev7ex.multiworld.user.WorldUser; -import org.bukkit.event.HandlerList; - -/** - * @author Dev7ex - * @since 20.12.2022 - */ -public class WorldUserLogoutEvent extends WorldUserEvent { - - private static final HandlerList HANDLERS = new HandlerList(); - - public WorldUserLogoutEvent(final WorldUser user) { - super(user); - } - - public static HandlerList getHandlerList() { - return HANDLERS; - } - - @Override - public HandlerList getHandlers() { - return HANDLERS; - } - -} diff --git a/src/main/java/com/dev7ex/multiworld/api/event/world/WorldCloneEvent.java b/src/main/java/com/dev7ex/multiworld/api/event/world/WorldCloneEvent.java deleted file mode 100644 index 61058ec..0000000 --- a/src/main/java/com/dev7ex/multiworld/api/event/world/WorldCloneEvent.java +++ /dev/null @@ -1,47 +0,0 @@ -package com.dev7ex.multiworld.api.event.world; - -import lombok.AccessLevel; -import lombok.Getter; -import lombok.Setter; -import org.bukkit.command.CommandSender; -import org.bukkit.event.Cancellable; -import org.bukkit.event.Event; -import org.bukkit.event.HandlerList; - -import java.io.File; - -/** - * @author Dev7ex - * @since 30.12.2022 - */ -@Getter(AccessLevel.PUBLIC) -@Setter(AccessLevel.PUBLIC) -public class WorldCloneEvent extends Event implements Cancellable { - - private static final HandlerList HANDLERS = new HandlerList(); - private boolean cancelled = false; - - private final CommandSender commandSender; - private final String worldName; - private final String clonedName; - private final File sourceFolder; - private final File destinationFolder; - - public WorldCloneEvent(final CommandSender commandSender, final String worldName, final String clonedName, final File sourceFolder, final File destinationFolder) { - this.commandSender = commandSender; - this.worldName = worldName; - this.clonedName = clonedName; - this.sourceFolder = sourceFolder; - this.destinationFolder = destinationFolder; - } - - public static HandlerList getHandlerList() { - return HANDLERS; - } - - @Override - public HandlerList getHandlers() { - return HANDLERS; - } - -} diff --git a/src/main/java/com/dev7ex/multiworld/api/event/world/WorldCreateEvent.java b/src/main/java/com/dev7ex/multiworld/api/event/world/WorldCreateEvent.java deleted file mode 100644 index 8994e2f..0000000 --- a/src/main/java/com/dev7ex/multiworld/api/event/world/WorldCreateEvent.java +++ /dev/null @@ -1,34 +0,0 @@ -package com.dev7ex.multiworld.api.event.world; - -import com.dev7ex.multiworld.world.WorldProperties; -import lombok.AccessLevel; -import lombok.Getter; -import lombok.Setter; -import org.bukkit.event.Cancellable; -import org.bukkit.event.HandlerList; - -/** - * @author Dev7ex - * @since 20.12.2022 - */ -@Getter(AccessLevel.PUBLIC) -@Setter(AccessLevel.PUBLIC) -public class WorldCreateEvent extends WorldEvent implements Cancellable { - - private static final HandlerList HANDLERS = new HandlerList(); - private boolean cancelled = false; - - public WorldCreateEvent(final WorldProperties worldProperties) { - super(worldProperties); - } - - public static HandlerList getHandlerList() { - return HANDLERS; - } - - @Override - public HandlerList getHandlers() { - return HANDLERS; - } - -} diff --git a/src/main/java/com/dev7ex/multiworld/api/event/world/WorldDeleteEvent.java b/src/main/java/com/dev7ex/multiworld/api/event/world/WorldDeleteEvent.java deleted file mode 100644 index 47f351a..0000000 --- a/src/main/java/com/dev7ex/multiworld/api/event/world/WorldDeleteEvent.java +++ /dev/null @@ -1,36 +0,0 @@ -package com.dev7ex.multiworld.api.event.world; - -import com.dev7ex.multiworld.world.WorldProperties; - -import lombok.AccessLevel; -import lombok.Getter; -import lombok.Setter; - -import org.bukkit.event.Cancellable; -import org.bukkit.event.HandlerList; - -/** - * @author Dev7ex - * @since 20.12.2022 - */ -@Getter(AccessLevel.PUBLIC) -@Setter(AccessLevel.PUBLIC) -public class WorldDeleteEvent extends WorldEvent implements Cancellable { - - private static final HandlerList HANDLERS = new HandlerList(); - private boolean cancelled = false; - - public WorldDeleteEvent(final WorldProperties worldProperties) { - super(worldProperties); - } - - public static HandlerList getHandlerList() { - return HANDLERS; - } - - @Override - public HandlerList getHandlers() { - return HANDLERS; - } - -} diff --git a/src/main/java/com/dev7ex/multiworld/api/event/world/WorldEvent.java b/src/main/java/com/dev7ex/multiworld/api/event/world/WorldEvent.java deleted file mode 100644 index d3158f5..0000000 --- a/src/main/java/com/dev7ex/multiworld/api/event/world/WorldEvent.java +++ /dev/null @@ -1,21 +0,0 @@ -package com.dev7ex.multiworld.api.event.world; - -import com.dev7ex.multiworld.world.WorldProperties; -import lombok.AccessLevel; -import lombok.Getter; -import org.bukkit.event.Event; - -/** - * @author Dev7ex - * @since 20.12.2022 - */ -@Getter(AccessLevel.PUBLIC) -public abstract class WorldEvent extends Event { - - private final WorldProperties worldProperties; - - public WorldEvent(final WorldProperties worldProperties) { - this.worldProperties = worldProperties; - } - -} diff --git a/src/main/java/com/dev7ex/multiworld/command/WorldCommand.java b/src/main/java/com/dev7ex/multiworld/command/WorldCommand.java deleted file mode 100644 index 248e49e..0000000 --- a/src/main/java/com/dev7ex/multiworld/command/WorldCommand.java +++ /dev/null @@ -1,69 +0,0 @@ -package com.dev7ex.multiworld.command; - -import com.dev7ex.common.bukkit.command.BukkitCommand; -import com.dev7ex.common.bukkit.command.CommandProperties; -import com.dev7ex.multiworld.MultiWorldPlugin; -import com.dev7ex.multiworld.command.world.*; - -import com.google.common.collect.Lists; - -import org.bukkit.Bukkit; -import org.bukkit.command.Command; -import org.bukkit.command.CommandSender; -import org.bukkit.command.TabCompleter; - -import java.util.List; -import java.util.Optional; - -/** - * @author Dev7ex - * @since 19.05.2021 - */ -@CommandProperties(name = "world", permission = "multiworld.command.world") -public final class WorldCommand extends BukkitCommand implements TabCompleter { - - public WorldCommand(final MultiWorldPlugin plugin) { - super(plugin); - - super.registerSubCommand(new BackCommand(plugin)); - super.registerSubCommand(new CloneCommand(plugin)); - super.registerSubCommand(new CreateCommand(plugin)); - super.registerSubCommand(new DeleteCommand(plugin)); - super.registerSubCommand(new InfoCommand(plugin)); - super.registerSubCommand(new HelpCommand(plugin)); - super.registerSubCommand(new ImportCommand(plugin)); - super.registerSubCommand(new ListCommand(plugin)); - super.registerSubCommand(new LoadCommand(plugin)); - super.registerSubCommand(new OptionsCommand(plugin)); - super.registerSubCommand(new ReloadCommand(plugin)); - super.registerSubCommand(new TeleportCommand(plugin)); - super.registerSubCommand(new UnloadCommand(plugin)); - } - - @Override - public boolean execute(final CommandSender commandSender, final String[] arguments) { - if ((arguments.length == 0) || (arguments.length > 4)) { - return super.getSubCommand("help").orElseThrow().execute(commandSender, arguments); - } - final Optional commandOptional = super.getSubCommand(arguments[0].toLowerCase()); - - if (commandOptional.isEmpty()) { - return super.getSubCommand("help").orElseThrow().execute(commandSender, arguments); - } - return commandOptional.get().execute(commandOptional.get(), commandSender, arguments); - } - - @Override - public List onTabComplete(final CommandSender commandSender, final Command command, final String commandLabel, final String[] arguments) { - if (arguments.length == 1) { - return Lists.newArrayList(super.getSubCommands().keySet()); - } - final Optional commandOptional = super.getSubCommand(arguments[0].toLowerCase()); - - if ((commandOptional.isEmpty()) || (!(commandOptional.get() instanceof TabCompleter))) { - return null; - } - return ((TabCompleter) commandOptional.get()).onTabComplete(commandSender, command, commandLabel, arguments); - } - -} diff --git a/src/main/java/com/dev7ex/multiworld/command/WorldSubCommand.java b/src/main/java/com/dev7ex/multiworld/command/WorldSubCommand.java deleted file mode 100644 index f6f29a6..0000000 --- a/src/main/java/com/dev7ex/multiworld/command/WorldSubCommand.java +++ /dev/null @@ -1,40 +0,0 @@ -package com.dev7ex.multiworld.command; - -import com.dev7ex.common.bukkit.command.BukkitCommand; - -import com.dev7ex.multiworld.MultiWorldConfiguration; -import com.dev7ex.multiworld.MultiWorldPlugin; -import com.dev7ex.multiworld.user.WorldUser; -import com.dev7ex.multiworld.user.WorldUserService; -import com.dev7ex.multiworld.world.WorldManager; -import com.dev7ex.multiworld.world.WorldService; -import lombok.AccessLevel; -import lombok.Getter; - -import java.util.UUID; - -/** - * @author Dev7ex - * @since 20.05.2021 - */ -@Getter(AccessLevel.PUBLIC) -public abstract class WorldSubCommand extends BukkitCommand { - - private final WorldUserService worldUserService; - private final WorldManager worldManager; - private final MultiWorldConfiguration configuration; - private final WorldService worldService; - - public WorldSubCommand(final MultiWorldPlugin plugin) { - super(plugin); - this.worldUserService = plugin.getWorldUserService(); - this.worldManager = plugin.getWorldManager(); - this.configuration = plugin.getConfiguration(); - this.worldService = plugin.getWorldService(); - } - - public final WorldUser getWorldUser(final UUID uniqueId) { - return this.worldUserService.getUsers().get(uniqueId); - } - -} diff --git a/src/main/java/com/dev7ex/multiworld/command/world/BackCommand.java b/src/main/java/com/dev7ex/multiworld/command/world/BackCommand.java deleted file mode 100644 index 45c81e7..0000000 --- a/src/main/java/com/dev7ex/multiworld/command/world/BackCommand.java +++ /dev/null @@ -1,60 +0,0 @@ -package com.dev7ex.multiworld.command.world; - -import com.dev7ex.common.bukkit.command.CommandProperties; -import com.dev7ex.multiworld.MultiWorldPlugin; -import com.dev7ex.multiworld.command.WorldSubCommand; -import com.dev7ex.multiworld.user.WorldUser; - -import org.bukkit.Bukkit; -import org.bukkit.Location; -import org.bukkit.World; -import org.bukkit.command.CommandSender; -import org.bukkit.entity.Player; - -/** - * @author Dev7ex - * @since 20.05.2021 - */ -@CommandProperties(name = "back", permission = "multiworld.command.world.back") -public final class BackCommand extends WorldSubCommand { - - public BackCommand(final MultiWorldPlugin plugin) { - super(plugin); - } - - @Override - public boolean execute(final CommandSender commandSender, final String[] arguments) { - if (!(commandSender instanceof Player)) { - commandSender.sendMessage(super.getConfiguration().getMessage("only-player-command")); - return true; - } - final Player player = (Player) commandSender; - final WorldUser worldUser = super.getWorldUser(player.getUniqueId()); - - if (arguments.length != 1) { - commandSender.sendMessage(super.getConfiguration().getCommandUsage(this)); - return true; - } - - if (worldUser.getProperties().getLastWorld() == null) { - player.sendMessage(super.getConfiguration().getMessage("back.world-not-found")); - return true; - } - final World world = Bukkit.getWorld(worldUser.getProperties().getLastWorld()); - - if (world == null) { - worldUser.getProperties().setLastWorld(null); - player.sendMessage(super.getConfiguration().getMessage(super.getConfiguration().getMessage("back.world-not-found"))); - return true; - } - - if (worldUser.getProperties().getLastWorld().equalsIgnoreCase(player.getWorld().getName())) { - player.sendMessage(super.getConfiguration().getMessage("back.world-already-there")); - return true; - } - final Location teleportLocation = (worldUser.getProperties().getLastWorldLocation() == null ? world.getSpawnLocation() : worldUser.getProperties().getLastWorldLocation()); - super.getWorldManager().teleportWorld(player, teleportLocation); - return true; - } - -} diff --git a/src/main/java/com/dev7ex/multiworld/command/world/CloneCommand.java b/src/main/java/com/dev7ex/multiworld/command/world/CloneCommand.java deleted file mode 100644 index 40d6930..0000000 --- a/src/main/java/com/dev7ex/multiworld/command/world/CloneCommand.java +++ /dev/null @@ -1,45 +0,0 @@ -package com.dev7ex.multiworld.command.world; - -import com.dev7ex.common.bukkit.command.CommandProperties; -import com.dev7ex.multiworld.MultiWorldPlugin; -import com.dev7ex.multiworld.command.WorldSubCommand; -import com.google.common.collect.Lists; -import org.bukkit.command.Command; -import org.bukkit.command.CommandSender; -import org.bukkit.command.TabCompleter; - -import java.util.ArrayList; -import java.util.Collections; -import java.util.List; - -@CommandProperties(name = "clone", permission = "multiworld.command.world.clone") -public class CloneCommand extends WorldSubCommand implements TabCompleter { - - public CloneCommand(final MultiWorldPlugin plugin) { - super(plugin); - } - - @Override - public boolean execute(final CommandSender commandSender, final String[] arguments) { - if (arguments.length != 3) { - commandSender.sendMessage(super.getConfiguration().getCommandUsage(this)); - return true; - } - - if (super.getWorldManager().getWorldProperties().containsKey(arguments[2])) { - commandSender.sendMessage(super.getConfiguration().getMessage("general.already-exists").replaceAll("%world%", arguments[1])); - return true; - } - super.getWorldManager().cloneWorld(commandSender, arguments[1], arguments[2]); - return true; - } - - @Override - public List onTabComplete(final CommandSender commandSender, final Command command, final String commandLabel, final String[] arguments) { - if (arguments.length == 3) { - return Collections.emptyList(); - } - return new ArrayList<>(super.getWorldManager().getWorldProperties().keySet()); - } - -} diff --git a/src/main/java/com/dev7ex/multiworld/command/world/CreateCommand.java b/src/main/java/com/dev7ex/multiworld/command/world/CreateCommand.java deleted file mode 100644 index 7ae2728..0000000 --- a/src/main/java/com/dev7ex/multiworld/command/world/CreateCommand.java +++ /dev/null @@ -1,84 +0,0 @@ -package com.dev7ex.multiworld.command.world; - -import com.dev7ex.common.bukkit.command.BukkitCommand; -import com.dev7ex.common.bukkit.command.CommandProperties; -import com.dev7ex.common.util.NumberUtil; -import com.dev7ex.multiworld.MultiWorldPlugin; -import com.dev7ex.multiworld.command.WorldSubCommand; -import com.dev7ex.multiworld.world.WorldType; - -import org.bukkit.Bukkit; -import org.bukkit.command.Command; -import org.bukkit.command.CommandSender; -import org.bukkit.command.TabCompleter; - -import java.util.ArrayList; -import java.util.Collections; -import java.util.List; -import java.util.Optional; - -/** - * @author Dev7ex - * @since 20.05.2021 - */ -@CommandProperties(name = "create", permission = "multiworld.command.world.create") -public final class CreateCommand extends WorldSubCommand implements TabCompleter { - - public CreateCommand(final MultiWorldPlugin plugin) { - super(plugin); - } - - @Override - public boolean execute(final CommandSender commandSender, final String[] arguments) { - if (!commandSender.hasPermission(this.getPermission())) { - commandSender.sendMessage(super.getNoPermissionMessage()); - return true; - } - - if (arguments.length != 3) { - commandSender.sendMessage(super.getConfiguration().getCommandUsage(this)); - return true; - } - - if (super.getWorldManager().getWorldProperties().containsKey(arguments[1])) { - commandSender.sendMessage(super.getConfiguration().getMessage("general.already-exists").replaceAll("%world%", arguments[1])); - return true; - } - - if (NumberUtil.isNumber(arguments[2])) { - super.getWorldManager().createWorld(commandSender, arguments[1], Long.parseLong(arguments[2])); - return true; - } - - if (super.getWorldService().getWorldGenerators().containsValue(arguments[2])) { - super.getWorldManager().createWorld(commandSender, arguments[1], arguments[2]); - return true; - } - - final Optional optional = WorldType.fromString(arguments[2].toUpperCase()); - - if ((optional.isEmpty())) { - commandSender.sendMessage(super.getConfiguration().getMessage("general.invalid-input")); - return true; - } - super.getWorldManager().createWorld(commandSender, arguments[1], optional.get()); - return true; - } - - @Override - public List onTabComplete(final CommandSender commandSender, final Command command, final String commandLabel, final String[] arguments) { - if (arguments.length != 3) { - return Collections.emptyList(); - } - - if (super.getWorldService().getWorldGenerators().isEmpty()) { - return WorldType.toStringList(); - } - final List completions = new ArrayList<>(); - completions.addAll(WorldType.toStringList()); - completions.addAll(super.getWorldService().getWorldGenerators().values()); - - return completions; - } - -} diff --git a/src/main/java/com/dev7ex/multiworld/command/world/DeleteCommand.java b/src/main/java/com/dev7ex/multiworld/command/world/DeleteCommand.java deleted file mode 100644 index 7333417..0000000 --- a/src/main/java/com/dev7ex/multiworld/command/world/DeleteCommand.java +++ /dev/null @@ -1,67 +0,0 @@ -package com.dev7ex.multiworld.command.world; - -import com.dev7ex.common.bukkit.command.CommandProperties; -import com.dev7ex.common.io.Files; -import com.dev7ex.multiworld.MultiWorldPlugin; -import com.dev7ex.multiworld.command.WorldSubCommand; - -import com.google.common.collect.Lists; - -import org.bukkit.Bukkit; -import org.bukkit.command.Command; -import org.bukkit.command.CommandSender; -import org.bukkit.command.TabCompleter; - -import java.io.File; -import java.util.List; - -/** - * @author Dev7ex - * @since 20.05.2021 - */ -@CommandProperties(name = "delete", permission = "multiworld.command.world.delete") -public final class DeleteCommand extends WorldSubCommand implements TabCompleter { - - public DeleteCommand(final MultiWorldPlugin plugin) { - super(plugin); - } - - @Override - public boolean execute(final CommandSender commandSender, final String[] arguments) { - if (arguments.length != 2) { - commandSender.sendMessage(super.getConfiguration().getCommandUsage(this)); - return true; - } - final File worldFolder = new File(Bukkit.getWorldContainer(), arguments[1]); - - if(!worldFolder.exists()) { - commandSender.sendMessage(super.getConfiguration().getMessage("general.folder-not-exists").replaceAll("%folder%", arguments[1])); - return true; - } - - if(!Files.containsFile(worldFolder, "session.lock")) { - commandSender.sendMessage(super.getConfiguration().getMessage("general.folder-not-exists").replaceAll("%folder%", arguments[1])); - return true; - } - - if (arguments[1].equalsIgnoreCase(MultiWorldPlugin.getInstance().getConfiguration().getString("defaults.world"))) { - commandSender.sendMessage(super.getConfiguration().getMessage("general.cannot-deleted").replaceAll("%world%", arguments[1])); - return true; - } - - if (!super.getWorldManager().getWorldConfiguration().isWorldRegistered(arguments[1])) { - commandSender.sendMessage(super.getConfiguration().getMessage("general.not-exists").replaceAll("%world%", arguments[1])); - return true; - } - super.getWorldManager().deleteWorld(commandSender, arguments[1]); - return true; - } - - @Override - public List onTabComplete(final CommandSender commandSender, final Command command, final String commandLabel, final String[] arguments) { - final List worlds = Lists.newArrayList(super.getWorldManager().getWorldProperties().keySet()); - worlds.remove(super.getPlugin().getConfiguration().getString("defaults.world")); - return worlds; - } - -} diff --git a/src/main/java/com/dev7ex/multiworld/command/world/HelpCommand.java b/src/main/java/com/dev7ex/multiworld/command/world/HelpCommand.java deleted file mode 100644 index 36cf47b..0000000 --- a/src/main/java/com/dev7ex/multiworld/command/world/HelpCommand.java +++ /dev/null @@ -1,27 +0,0 @@ -package com.dev7ex.multiworld.command.world; - -import com.dev7ex.common.bukkit.command.CommandProperties; -import com.dev7ex.multiworld.MultiWorldPlugin; -import com.dev7ex.multiworld.command.WorldSubCommand; - -import org.bukkit.command.CommandSender; - -/** - * @author Dev7ex - * @since 18.05.2021 - */ -@CommandProperties(name = "help", permission = "multiworld.command.world") -public final class HelpCommand extends WorldSubCommand { - - public HelpCommand(final MultiWorldPlugin plugin) { - super(plugin); - } - - @Override - public boolean execute(final CommandSender commandSender, final String[] arguments) { - super.getConfiguration().getStringList("messages.help.messages").forEach(message -> - commandSender.sendMessage(message.replaceAll("%prefix%", super.getConfiguration().getPrefix()))); - return true; - } - -} diff --git a/src/main/java/com/dev7ex/multiworld/command/world/ImportCommand.java b/src/main/java/com/dev7ex/multiworld/command/world/ImportCommand.java deleted file mode 100644 index 554340f..0000000 --- a/src/main/java/com/dev7ex/multiworld/command/world/ImportCommand.java +++ /dev/null @@ -1,86 +0,0 @@ -package com.dev7ex.multiworld.command.world; - -import com.dev7ex.common.bukkit.command.CommandProperties; -import com.dev7ex.common.io.Files; -import com.dev7ex.common.util.NumberUtil; -import com.dev7ex.multiworld.MultiWorldPlugin; -import com.dev7ex.multiworld.command.WorldSubCommand; -import com.dev7ex.multiworld.world.WorldType; - -import com.google.common.collect.Lists; - -import org.bukkit.Bukkit; -import org.bukkit.command.Command; -import org.bukkit.command.CommandSender; -import org.bukkit.command.TabCompleter; - -import java.io.File; -import java.util.List; -import java.util.Objects; -import java.util.Optional; - -/** - * @author Dev7ex - * @since 25.05.2021 - */ -@CommandProperties(name = "import", permission = "multiworld.command.world.import") -public final class ImportCommand extends WorldSubCommand implements TabCompleter { - - public ImportCommand(final MultiWorldPlugin plugin) { - super(plugin); - } - - @Override - public boolean execute(final CommandSender commandSender, final String[] arguments) { - if (!commandSender.hasPermission(this.getPermission())) { - commandSender.sendMessage(super.getNoPermissionMessage()); - return true; - } - - if (arguments.length != 3) { - commandSender.sendMessage(super.getConfiguration().getCommandUsage(this)); - return true; - } - final File worldFolder = new File(Bukkit.getWorldContainer(), arguments[1]); - - if(!Files.containsFile(worldFolder, "level.dat")) { - commandSender.sendMessage(super.getConfiguration().getMessage("general.folder-not-exists").replaceAll("%folder%", arguments[1])); - return true; - } - - if(super.getWorldManager().getWorldProperties().containsKey(arguments[1])) { - commandSender.sendMessage(super.getConfiguration().getMessage("import.already-imported").replaceAll("%world%", arguments[1])); - return true; - } - final Optional optional = WorldType.fromString(arguments[2].toUpperCase()); - - if ((optional.isEmpty())) { - commandSender.sendMessage(super.getConfiguration().getMessage("general.invalid-input")); - return true; - } - super.getWorldManager().importWorld(commandSender, arguments[1], optional.get()); - return true; - } - - @Override - public List onTabComplete(final CommandSender commandSender, final Command command, final String commandLabel, final String[] arguments) { - if((arguments.length < 2) || (arguments.length > 3)) { - return null; - } - - if(arguments.length == 3) { - return WorldType.toStringList(); - } - final List files = Files.toStringList(Bukkit.getWorldContainer()); - final List completions = Lists.newArrayList(files); - - for(final File folder : Objects.requireNonNull(Bukkit.getWorldContainer().listFiles())) { - if(Files.containsFile(folder, "level.dat")) { - continue; - } - completions.remove(folder.getName()); - } - return completions; - } - -} diff --git a/src/main/java/com/dev7ex/multiworld/command/world/InfoCommand.java b/src/main/java/com/dev7ex/multiworld/command/world/InfoCommand.java deleted file mode 100644 index e915cee..0000000 --- a/src/main/java/com/dev7ex/multiworld/command/world/InfoCommand.java +++ /dev/null @@ -1,62 +0,0 @@ -package com.dev7ex.multiworld.command.world; - -import com.dev7ex.common.bukkit.command.CommandProperties; -import com.dev7ex.multiworld.MultiWorldPlugin; -import com.dev7ex.multiworld.command.WorldSubCommand; -import com.dev7ex.multiworld.world.WorldProperties; - -import com.google.common.collect.Lists; - -import org.bukkit.command.Command; -import org.bukkit.command.CommandSender; -import org.bukkit.command.TabCompleter; - -import java.util.List; - -/** - * @author Dev7ex - * @since 24.05.2021 - */ -@CommandProperties(name = "info", permission = "multiworld.command.world.info") -public final class InfoCommand extends WorldSubCommand implements TabCompleter { - - public InfoCommand(final MultiWorldPlugin plugin) { - super(plugin); - } - - @Override - public boolean execute(final CommandSender commandSender, final String[] arguments) { - if (!commandSender.hasPermission(super.getPermission())) { - commandSender.sendMessage(super.getNoPermissionMessage()); - return true; - } - - if (arguments.length != 2) { - commandSender.sendMessage(super.getConfiguration().getCommandUsage(this)); - return true; - } - - if (!super.getWorldManager().getWorldProperties().containsKey(arguments[1])) { - commandSender.sendMessage(super.getConfiguration().getMessage("world-doesnt-exist").replaceAll("%world%", arguments[1])); - return true; - } - final WorldProperties worldProperties = super.getWorldManager().getWorldProperties().get(arguments[1]); - - super.getConfiguration().getStringList("messages.info.messages").forEach(message -> - commandSender.sendMessage(message.replaceAll("%world%", arguments[1]).replaceAll("%worldCreator%", worldProperties.getWorldCreator()) - .replaceAll("%creationDate%", worldProperties.formatCreationDate(worldProperties.getCreationTime())) - .replaceAll("%loaded%", worldProperties.isLoaded() ? "true" : "false") - .replaceAll("%worldType%", worldProperties.getWorldType().toString()) - .replaceAll("%environment%", worldProperties.getWorldType().getEnvironment().toString()) - .replaceAll("%difficulty%", worldProperties.getDifficulty().toString()) - .replaceAll("%gamemode%", worldProperties.getGameMode().toString()) - .replaceAll("%pvpEnabled%", worldProperties.isPvpEnabled() ? "true" : "false"))); - return true; - } - - @Override - public final List onTabComplete(final CommandSender commandSender, final Command command, final String commandLabel, final String[] arguments) { - return Lists.newArrayList(super.getWorldManager().getWorldProperties().keySet()); - } - -} diff --git a/src/main/java/com/dev7ex/multiworld/command/world/ListCommand.java b/src/main/java/com/dev7ex/multiworld/command/world/ListCommand.java deleted file mode 100644 index 3cfdd77..0000000 --- a/src/main/java/com/dev7ex/multiworld/command/world/ListCommand.java +++ /dev/null @@ -1,52 +0,0 @@ -package com.dev7ex.multiworld.command.world; - -import com.dev7ex.common.bukkit.command.CommandProperties; -import com.dev7ex.multiworld.MultiWorldPlugin; -import com.dev7ex.multiworld.command.WorldSubCommand; -import com.dev7ex.multiworld.world.WorldProperties; - -import org.bukkit.ChatColor; -import org.bukkit.command.CommandSender; - -import java.util.Set; - -/** - * @author Dev7ex - * @since 20.05.2021 - */ -@CommandProperties(name = "list", permission = "multiworld.command.world.list") -public final class ListCommand extends WorldSubCommand { - - public ListCommand(final MultiWorldPlugin plugin) { - super(plugin); - } - - @Override - public boolean execute(final CommandSender commandSender, final String[] arguments) { - if (!commandSender.hasPermission(this.getPermission())) { - commandSender.sendMessage(super.getNoPermissionMessage()); - return true; - } - - if (arguments.length != 1) { - commandSender.sendMessage(super.getConfiguration().getCommandUsage(this)); - return true; - } - - final StringBuilder stringBuilder = new StringBuilder(); - final Set worldSet = super.getWorldManager().getWorldProperties().keySet(); - - for (final String world : worldSet) { - final WorldProperties worldProperties = super.getWorldManager().getWorldProperties().get(world); - - if (stringBuilder.length() > 0) { - stringBuilder.append(ChatColor.WHITE); - stringBuilder.append(", "); - } - stringBuilder.append(worldProperties.isLoaded() ? ChatColor.GREEN : ChatColor.RED).append(world); - } - commandSender.sendMessage(super.getConfiguration().getMessage("list.message").replaceAll("%worlds%", stringBuilder.toString())); - return true; - } - -} diff --git a/src/main/java/com/dev7ex/multiworld/command/world/LoadCommand.java b/src/main/java/com/dev7ex/multiworld/command/world/LoadCommand.java deleted file mode 100644 index 13b0988..0000000 --- a/src/main/java/com/dev7ex/multiworld/command/world/LoadCommand.java +++ /dev/null @@ -1,75 +0,0 @@ -package com.dev7ex.multiworld.command.world; - -import com.dev7ex.common.bukkit.command.CommandProperties; -import com.dev7ex.multiworld.MultiWorldPlugin; -import com.dev7ex.multiworld.command.WorldSubCommand; - -import com.google.common.collect.Lists; - -import net.md_5.bungee.api.chat.ClickEvent; -import net.md_5.bungee.api.chat.HoverEvent; -import net.md_5.bungee.api.chat.TextComponent; -import net.md_5.bungee.api.chat.hover.content.Text; - -import org.bukkit.Bukkit; -import org.bukkit.command.Command; -import org.bukkit.command.CommandSender; -import org.bukkit.command.TabCompleter; -import org.bukkit.entity.Player; - -import java.util.List; - -/** - * @author Dev7ex - * @since 20.05.2021 - */ -@CommandProperties(name = "load", permission = "multiworld.command.world.load") -public final class LoadCommand extends WorldSubCommand implements TabCompleter { - - public LoadCommand(final MultiWorldPlugin plugin) { - super(plugin); - } - - @Override - public boolean execute(final CommandSender commandSender, final String[] arguments) { - if (!commandSender.hasPermission(this.getPermission())) { - commandSender.sendMessage(super.getNoPermissionMessage()); - return true; - } - - if (arguments.length != 2) { - commandSender.sendMessage(super.getConfiguration().getCommandUsage(this)); - return true; - } - - if (Bukkit.getWorld(arguments[1]) != null) { - commandSender.sendMessage(super.getConfiguration().getMessage("load.already-loaded").replaceAll("%world%", arguments[1])); - return true; - } - - if (!super.getWorldManager().getWorldConfiguration().isWorldRegistered(arguments[1])) { - commandSender.sendMessage(super.getConfiguration().getMessage("general.not-exists").replaceAll("%world%", arguments[1])); - return true; - } - super.getWorldManager().loadWorld(commandSender, arguments[1]); - - if (commandSender instanceof Player) { - final Player player = (Player) commandSender; - player.spigot().sendMessage(this.getTeleportComponent(player, arguments[1])); - } - return true; - } - - public TextComponent getTeleportComponent(final Player player, final String world) { - final TextComponent textComponent = new TextComponent(super.getConfiguration().getMessage("teleport.component-message")); - textComponent.setHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, new Text(super.getConfiguration().getMessage("teleport.component-hover-text")))); - textComponent.setClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/world teleport " + player.getName() + " " + world)); - return textComponent; - } - - @Override - public List onTabComplete(final CommandSender commandSender, final Command command, final String commandLabel, final String[] arguments) { - return Lists.newArrayList(super.getWorldManager().getWorldProperties().keySet()); - } - -} diff --git a/src/main/java/com/dev7ex/multiworld/command/world/OptionsCommand.java b/src/main/java/com/dev7ex/multiworld/command/world/OptionsCommand.java deleted file mode 100644 index 3a72cf6..0000000 --- a/src/main/java/com/dev7ex/multiworld/command/world/OptionsCommand.java +++ /dev/null @@ -1,82 +0,0 @@ -package com.dev7ex.multiworld.command.world; - -import com.dev7ex.common.bukkit.command.CommandProperties; -import com.dev7ex.multiworld.MultiWorldPlugin; -import com.dev7ex.multiworld.command.WorldSubCommand; -import com.dev7ex.multiworld.world.WorldOption; -import com.dev7ex.multiworld.world.WorldProperties; - -import com.dev7ex.multiworld.world.WorldType; -import com.google.common.collect.Lists; - -import org.bukkit.command.Command; -import org.bukkit.command.CommandSender; -import org.bukkit.command.TabCompleter; - -import java.util.List; -import java.util.Optional; - -/** - * @author Dev7ex - * @since 24.05.2021 - */ -@CommandProperties(name = "options", permission = "multiworld.command.world.options") -public final class OptionsCommand extends WorldSubCommand implements TabCompleter { - - public OptionsCommand(final MultiWorldPlugin plugin) { - super(plugin); - } - - @Override - public boolean execute(final CommandSender commandSender, final String[] arguments) { - if (!commandSender.hasPermission(super.getPermission())) { - commandSender.sendMessage(super.getNoPermissionMessage()); - return true; - } - - if (arguments.length != 4) { - commandSender.sendMessage(super.getConfiguration().getCommandUsage(this)); - return true; - } - - if (!super.getWorldManager().getWorldProperties().containsKey(arguments[1])) { - commandSender.sendMessage(super.getConfiguration().getMessage("general.not-exists").replaceAll("%world%", arguments[1])); - return true; - } - final Optional optional = WorldOption.fromString(arguments[2].toUpperCase()); - - if (optional.isEmpty()) { - commandSender.sendMessage(super.getConfiguration().getMessage("options.not-available")); - return true; - } - final WorldProperties worldProperties = super.getWorldManager().getWorldProperties().get(arguments[1]); - final WorldOption currentOption = optional.get(); - - if (!optional.get().getValues().contains(arguments[3])) { - commandSender.sendMessage(super.getConfiguration().getMessage("options.value-wrong").replaceAll("%value%", arguments[3])); - return true; - } - commandSender.sendMessage(super.getConfiguration().getMessage("options.updating").replaceAll("%option%", currentOption.toString()) - .replaceAll("%value%", arguments[3]).replaceAll("%world%", arguments[1])); - worldProperties.updateWorldOption(currentOption, arguments[3]); - super.getWorldManager().getWorldConfiguration().updateWorldOption(worldProperties.getWorldName(), currentOption, arguments[3]); - return true; - } - - @Override - public List onTabComplete(final CommandSender commandSender, final Command command, final String commandLabel, final String[] arguments) { - if (arguments.length == 2) { - return Lists.newArrayList(super.getWorldManager().getWorldProperties().keySet()); - } - if (arguments.length == 3) { - return WorldOption.toStringList(); - } - final Optional optional = WorldOption.fromString(arguments[2].toUpperCase()); - - if ((optional.isEmpty())) { - return null; - } - return Lists.newArrayList(optional.get().getValues()); - } - -} diff --git a/src/main/java/com/dev7ex/multiworld/command/world/ReloadCommand.java b/src/main/java/com/dev7ex/multiworld/command/world/ReloadCommand.java deleted file mode 100644 index 7121ba8..0000000 --- a/src/main/java/com/dev7ex/multiworld/command/world/ReloadCommand.java +++ /dev/null @@ -1,35 +0,0 @@ -package com.dev7ex.multiworld.command.world; - -import com.dev7ex.common.bukkit.command.CommandProperties; -import com.dev7ex.multiworld.MultiWorldPlugin; -import com.dev7ex.multiworld.command.WorldSubCommand; -import org.bukkit.command.CommandSender; - -/** - * @author Dev7ex - * @since 28.12.2022 - */ -@CommandProperties(name = "reload", permission = "multiworld.command.world.reload") -public class ReloadCommand extends WorldSubCommand { - - public ReloadCommand(final MultiWorldPlugin plugin) { - super(plugin); - } - - @Override - public boolean execute(final CommandSender commandSender, final String[] arguments) { - if (!commandSender.hasPermission(this.getPermission())) { - commandSender.sendMessage(super.getNoPermissionMessage()); - return true; - } - - if (arguments.length != 1) { - commandSender.sendMessage(super.getConfiguration().getCommandUsage(this)); - return true; - } - super.getPlugin().getConfiguration().load(); - commandSender.sendMessage(super.getConfiguration().getMessage("reload.successfully-reloaded")); - return false; - } - -} diff --git a/src/main/java/com/dev7ex/multiworld/command/world/TeleportCommand.java b/src/main/java/com/dev7ex/multiworld/command/world/TeleportCommand.java deleted file mode 100644 index 69eeb28..0000000 --- a/src/main/java/com/dev7ex/multiworld/command/world/TeleportCommand.java +++ /dev/null @@ -1,84 +0,0 @@ -package com.dev7ex.multiworld.command.world; - -import com.dev7ex.common.bukkit.command.CommandProperties; -import com.dev7ex.multiworld.MultiWorldPlugin; -import com.dev7ex.multiworld.command.WorldSubCommand; - -import com.google.common.collect.Lists; - -import org.bukkit.Bukkit; -import org.bukkit.World; -import org.bukkit.command.Command; -import org.bukkit.command.CommandSender; -import org.bukkit.command.TabCompleter; -import org.bukkit.entity.Player; - -import java.util.Collections; -import java.util.List; - -/** - * @author Dev7ex - * @since 20.05.2021 - */ -@CommandProperties(name = "teleport", permission = "multiworld.command.world.teleport") -public final class TeleportCommand extends WorldSubCommand implements TabCompleter { - - public TeleportCommand(final MultiWorldPlugin plugin) { - super(plugin); - } - - @Override - public boolean execute(final CommandSender commandSender, final String[] arguments) { - if (!commandSender.hasPermission(this.getPermission())) { - commandSender.sendMessage(super.getNoPermissionMessage()); - return true; - } - - if (arguments.length != 3) { - commandSender.sendMessage(super.getConfiguration().getCommandUsage(this)); - return true; - } - - if (!super.getWorldManager().getWorldProperties().containsKey(arguments[2])) { - commandSender.sendMessage(super.getConfiguration().getMessage("general.not-exists").replaceAll("%world%", arguments[1])); - return true; - } - final World world = Bukkit.getWorld(arguments[2]); - - if (world == null) { - commandSender.sendMessage(super.getConfiguration().getMessage("load.not-loaded").replaceAll("%world%", arguments[1])); - return true; - } - final Player target = Bukkit.getPlayer(arguments[1]); - - if (target == null) { - commandSender.sendMessage(super.getConfiguration().getMessage("player-not-found")); - return true; - } - - if (target.getWorld().getName().equalsIgnoreCase(arguments[2])) { - if (commandSender.getName().equalsIgnoreCase(target.getName())) { - commandSender.sendMessage(super.getConfiguration().getMessage("teleport.sender-already-in-world").replaceAll("%world%", arguments[1])); - return true; - } - commandSender.sendMessage(super.getConfiguration().getMessage("teleport.target-already-in-world").replaceAll("%target%", target.getName()).replaceAll("%world%", arguments[1])); - return true; - } - super.getWorldManager().teleportWorld(commandSender, target, world.getSpawnLocation()); - return true; - } - - @Override - public List onTabComplete(final CommandSender commandSender, final Command command, final String commandLabel, final String[] arguments) { - if (arguments.length != 3) { - return null; - } - final List completions = Lists.newArrayList(super.getWorldManager().getWorldProperties().keySet()); - - if (commandSender instanceof Player) { - completions.remove(((Player) commandSender).getWorld().getName()); - } - return completions; - } - -} diff --git a/src/main/java/com/dev7ex/multiworld/command/world/UnloadCommand.java b/src/main/java/com/dev7ex/multiworld/command/world/UnloadCommand.java deleted file mode 100644 index cfca6ec..0000000 --- a/src/main/java/com/dev7ex/multiworld/command/world/UnloadCommand.java +++ /dev/null @@ -1,64 +0,0 @@ -package com.dev7ex.multiworld.command.world; - -import com.dev7ex.common.bukkit.command.CommandProperties; -import com.dev7ex.multiworld.MultiWorldPlugin; -import com.dev7ex.multiworld.command.WorldSubCommand; - -import com.google.common.collect.Lists; - -import org.bukkit.Bukkit; -import org.bukkit.command.Command; -import org.bukkit.command.CommandSender; -import org.bukkit.command.TabCompleter; - -import java.util.List; - -/** - * @author Dev7ex - * @since 20.05.2021 - */ -@CommandProperties(name = "unload", permission = "multiworld.command.world.unload") -public final class UnloadCommand extends WorldSubCommand implements TabCompleter { - - public UnloadCommand(final MultiWorldPlugin plugin) { - super(plugin); - } - - @Override - public boolean execute(final CommandSender commandSender, final String[] arguments) { - if (!commandSender.hasPermission(this.getPermission())) { - commandSender.sendMessage(super.getNoPermissionMessage()); - return true; - } - - if (arguments.length != 2) { - commandSender.sendMessage(super.getConfiguration().getCommandUsage(this)); - return true; - } - - if (arguments[1].equalsIgnoreCase(MultiWorldPlugin.getInstance().getConfiguration().getString("defaults.world"))) { - commandSender.sendMessage(super.getConfiguration().getMessage("general.cannot-unloaded").replaceAll("%world%", arguments[1])); - return true; - } - - if (!super.getWorldManager().getWorldConfiguration().isWorldRegistered(arguments[1])) { - commandSender.sendMessage(super.getConfiguration().getMessage("general.not-exists").replaceAll("%world%", arguments[1])); - return true; - } - - if (Bukkit.getWorld(arguments[1]) == null) { - commandSender.sendMessage(super.getConfiguration().getMessage("load.not-loaded").replaceAll("%world%", arguments[1])); - return true; - } - super.getWorldManager().unloadWorld(commandSender, arguments[1]); - return true; - } - - @Override - public List onTabComplete(final CommandSender commandSender, final Command command, final String commandLabel, final String[] arguments) { - final List loadedWorlds = Lists.newArrayList(super.getWorldManager().getWorldProperties().keySet()); - loadedWorlds.remove(super.getPlugin().getConfiguration().getString("defaults.world")); - return loadedWorlds; - } - -} diff --git a/src/main/java/com/dev7ex/multiworld/generator/FlatChunkGenerator.java b/src/main/java/com/dev7ex/multiworld/generator/FlatChunkGenerator.java deleted file mode 100644 index 3357401..0000000 --- a/src/main/java/com/dev7ex/multiworld/generator/FlatChunkGenerator.java +++ /dev/null @@ -1,30 +0,0 @@ -package com.dev7ex.multiworld.generator; - -import org.bukkit.Material; -import org.bukkit.World; -import org.bukkit.block.Biome; -import org.bukkit.generator.ChunkGenerator; - -import java.util.Random; - -/** - * @author Dev7ex - * @since 20.05.2021 - */ -public final class FlatChunkGenerator extends ChunkGenerator { - - @Override - public ChunkData generateChunkData(final World world, final Random random, final int x, final int z, final BiomeGrid biome) { - final ChunkData chunkData = super.createChunkData(world); - chunkData.setRegion(0, 0, 0, 16, 1, 16, Material.BEDROCK); - chunkData.setRegion(0, 1, 0, 16, 64, 16, Material.GRASS_BLOCK); - - for (int chunkX = 0; chunkX < 16; chunkX++) { - for (int chunkZ = 0; chunkZ < 16; chunkZ++) { - biome.setBiome(x, z, Biome.PLAINS); - } - } - return chunkData; - } - -} diff --git a/src/main/java/com/dev7ex/multiworld/generator/VoidChunkGenerator.java b/src/main/java/com/dev7ex/multiworld/generator/VoidChunkGenerator.java deleted file mode 100644 index 718bd8c..0000000 --- a/src/main/java/com/dev7ex/multiworld/generator/VoidChunkGenerator.java +++ /dev/null @@ -1,33 +0,0 @@ -package com.dev7ex.multiworld.generator; - -import org.bukkit.Location; -import org.bukkit.Material; -import org.bukkit.World; -import org.bukkit.block.Biome; -import org.bukkit.generator.ChunkGenerator; - -import java.util.Random; - -/** - * @author Dev7ex - * @since 20.05.2021 - */ -public final class VoidChunkGenerator extends ChunkGenerator { - - @Override - public ChunkData generateChunkData(final World world, final Random random, final int x, final int z, final BiomeGrid biome) { - final ChunkData chunkData = super.createChunkData(world); - - if ((x == 0) && (z == 0)) { - chunkData.setBlock(0, 63, 0, Material.STONE); - world.setSpawnLocation(new Location(world, 0, 64, 0)); - } - for (int chunkX = 0; chunkX < 16; chunkX++) { - for (int chunkZ = 0; chunkZ < 16; chunkZ++) { - biome.setBiome(x, z, Biome.PLAINS); - } - } - return chunkData; - } - -} diff --git a/src/main/java/com/dev7ex/multiworld/listener/EntityDamageByEntityListener.java b/src/main/java/com/dev7ex/multiworld/listener/EntityDamageByEntityListener.java deleted file mode 100644 index 938a3a5..0000000 --- a/src/main/java/com/dev7ex/multiworld/listener/EntityDamageByEntityListener.java +++ /dev/null @@ -1,52 +0,0 @@ -package com.dev7ex.multiworld.listener; - -import com.dev7ex.multiworld.MultiWorldPlugin; -import com.dev7ex.multiworld.api.event.MultiWorldListener; -import com.dev7ex.multiworld.world.WorldProperties; - -import org.bukkit.entity.Arrow; -import org.bukkit.entity.EntityType; -import org.bukkit.entity.Player; -import org.bukkit.event.EventHandler; -import org.bukkit.event.EventPriority; -import org.bukkit.event.entity.EntityDamageByEntityEvent; - -/** - * @author Dev7ex - * @since 24.05.2021 - */ -public final class EntityDamageByEntityListener extends MultiWorldListener { - - public EntityDamageByEntityListener(final MultiWorldPlugin multiWorldPlugin) { - super(multiWorldPlugin); - } - - @EventHandler(priority = EventPriority.NORMAL) - public void handleEntityDamageByEntity(final EntityDamageByEntityEvent event) { - if (event.getEntity().getType() != EntityType.PLAYER) { - return; - } - final Player player = (Player) event.getEntity(); - final WorldProperties worldProperties = super.getWorldManager().getWorldProperties().get(player.getWorld().getName()); - - if (worldProperties == null) { - return; - } - - if (worldProperties.isPvpEnabled()) { - return; - } - - if (event.getDamager().getType() == EntityType.PLAYER) { - event.setCancelled(true); - } - - if (event.getDamager().getType() == EntityType.ARROW) { - final Arrow arrow = (Arrow) event.getDamager(); - if (arrow.getShooter() instanceof Player) { - event.setCancelled(true); - } - } - } - -} diff --git a/src/main/java/com/dev7ex/multiworld/listener/PlayerChangeWorldListener.java b/src/main/java/com/dev7ex/multiworld/listener/PlayerChangeWorldListener.java deleted file mode 100644 index 79421b6..0000000 --- a/src/main/java/com/dev7ex/multiworld/listener/PlayerChangeWorldListener.java +++ /dev/null @@ -1,33 +0,0 @@ -package com.dev7ex.multiworld.listener; - -import com.dev7ex.multiworld.MultiWorldPlugin; -import com.dev7ex.multiworld.api.event.MultiWorldListener; -import com.dev7ex.multiworld.world.WorldProperties; - -import org.bukkit.entity.Player; -import org.bukkit.event.EventHandler; -import org.bukkit.event.EventPriority; -import org.bukkit.event.player.PlayerChangedWorldEvent; - -/** - * @author Dev7ex - * @since 24.05.2021 - */ -public final class PlayerChangeWorldListener extends MultiWorldListener { - - public PlayerChangeWorldListener(final MultiWorldPlugin multiWorldPlugin) { - super(multiWorldPlugin); - } - - @EventHandler(priority = EventPriority.NORMAL) - public void handlePlayerChangeWorld(final PlayerChangedWorldEvent event) { - final Player player = event.getPlayer(); - final WorldProperties worldProperties = super.getWorldManager().getWorldProperties().get(player.getWorld().getName()); - - if (worldProperties == null) { - return; - } - player.setGameMode(worldProperties.getGameMode()); - } - -} diff --git a/src/main/java/com/dev7ex/multiworld/listener/PlayerConnectionListener.java b/src/main/java/com/dev7ex/multiworld/listener/PlayerConnectionListener.java deleted file mode 100644 index 32cf724..0000000 --- a/src/main/java/com/dev7ex/multiworld/listener/PlayerConnectionListener.java +++ /dev/null @@ -1,62 +0,0 @@ -package com.dev7ex.multiworld.listener; - -import com.dev7ex.multiworld.MultiWorldPlugin; -import com.dev7ex.multiworld.api.event.user.WorldUserLoginEvent; -import com.dev7ex.multiworld.api.event.user.WorldUserLogoutEvent; -import com.dev7ex.multiworld.api.event.MultiWorldListener; -import com.dev7ex.multiworld.user.WorldUser; - -import com.dev7ex.multiworld.world.WorldProperties; -import org.bukkit.Bukkit; -import org.bukkit.entity.Player; -import org.bukkit.event.EventHandler; -import org.bukkit.event.EventPriority; -import org.bukkit.event.player.PlayerJoinEvent; -import org.bukkit.event.player.PlayerLoginEvent; -import org.bukkit.event.player.PlayerQuitEvent; - -/** - * @author Dev7ex - * @since 19.05.2021 - */ -public final class PlayerConnectionListener extends MultiWorldListener { - - public PlayerConnectionListener(final MultiWorldPlugin multiWorldPlugin) { - super(multiWorldPlugin); - } - - @EventHandler(priority = EventPriority.NORMAL) - public void handlePlayerLogin(final PlayerLoginEvent event) { - final Player player = event.getPlayer(); - final WorldUser user = new WorldUser(player.getUniqueId()); - - Bukkit.getPluginManager().callEvent(new WorldUserLoginEvent(user)); - - super.getWorldUserService().registerUser(user); - } - - @EventHandler(priority = EventPriority.NORMAL) - public void handlePlayerJoin(final PlayerJoinEvent event) { - final Player player = event.getPlayer(); - final WorldProperties worldProperties = super.getWorldManager().getWorldProperties().get(player.getWorld().getName()); - - if ((super.getConfiguration().getBoolean("settings.receive-update-message")) && (player.hasPermission("multiworld.update.notify")) && (super.multiWorldPlugin.isUpdateAvailable())) { - player.sendMessage(super.getConfiguration().getMessage("general.update-message-player")); - return; - } - - if ((worldProperties != null) && (super.getConfiguration().getBoolean("settings.auto-gamemode"))) { - player.setGameMode(worldProperties.getGameMode()); - } - } - - @EventHandler(priority = EventPriority.NORMAL) - public void handlePlayerQuit(final PlayerQuitEvent event) { - final WorldUser user = super.getWorldUser(event.getPlayer().getUniqueId()); - - Bukkit.getPluginManager().callEvent(new WorldUserLogoutEvent(user)); - - super.getWorldUserService().removeUser(event.getPlayer().getUniqueId()); - } - -} diff --git a/src/main/java/com/dev7ex/multiworld/user/WorldUser.java b/src/main/java/com/dev7ex/multiworld/user/WorldUser.java deleted file mode 100644 index 4403615..0000000 --- a/src/main/java/com/dev7ex/multiworld/user/WorldUser.java +++ /dev/null @@ -1,38 +0,0 @@ -package com.dev7ex.multiworld.user; - -import com.dev7ex.multiworld.MultiWorldPlugin; - -import lombok.AccessLevel; -import lombok.Getter; -import lombok.Setter; - -import org.bukkit.Bukkit; -import org.bukkit.entity.Player; - -import java.util.UUID; - -/** - * @author Dev7ex - * @since 20.05.2021 - */ -@Getter(AccessLevel.PUBLIC) -@Setter(AccessLevel.PUBLIC) -public final class WorldUser { - - private final UUID uniqueId; - private WorldUserProperties properties; - - public WorldUser(final UUID uniqueId) { - this.uniqueId = uniqueId; - this.properties = new WorldUserProperties(); - } - - public void sendMessage(final String message) { - this.getPlayer().sendMessage(MultiWorldPlugin.getInstance().getConfiguration().getPrefix() + message); - } - - public Player getPlayer() { - return Bukkit.getPlayer(this.uniqueId); - } - -} diff --git a/src/main/java/com/dev7ex/multiworld/user/WorldUserProperties.java b/src/main/java/com/dev7ex/multiworld/user/WorldUserProperties.java deleted file mode 100644 index fc3b98e..0000000 --- a/src/main/java/com/dev7ex/multiworld/user/WorldUserProperties.java +++ /dev/null @@ -1,20 +0,0 @@ -package com.dev7ex.multiworld.user; - -import lombok.AccessLevel; -import lombok.Getter; -import lombok.Setter; - -import org.bukkit.Location; - -/** - * @author Dev7ex - * @since 20.05.2021 - */ -@Getter(AccessLevel.PUBLIC) -@Setter(AccessLevel.PUBLIC) -public final class WorldUserProperties { - - private String lastWorld; - private Location lastWorldLocation; - -} diff --git a/src/main/java/com/dev7ex/multiworld/user/WorldUserService.java b/src/main/java/com/dev7ex/multiworld/user/WorldUserService.java deleted file mode 100644 index b22fcc6..0000000 --- a/src/main/java/com/dev7ex/multiworld/user/WorldUserService.java +++ /dev/null @@ -1,46 +0,0 @@ -package com.dev7ex.multiworld.user; - -import com.dev7ex.common.bukkit.plugin.service.PluginService; - -import com.google.common.collect.Maps; - -import lombok.AccessLevel; -import lombok.Getter; - -import org.bukkit.Bukkit; -import org.bukkit.entity.Player; - -import java.util.Map; -import java.util.UUID; - -/** - * @author Dev7ex - * @since 19.05.2021 - */ -@Getter(AccessLevel.PUBLIC) -public final class WorldUserService implements PluginService { - - private final Map users = Maps.newHashMap(); - - @Override - public void onEnable() { - for(final Player player : Bukkit.getOnlinePlayers()) { - final WorldUser worldUser = new WorldUser(player.getUniqueId()); - this.users.put(player.getUniqueId(), worldUser); - } - } - - @Override - public void onDisable() { - this.users.clear(); - } - - public void registerUser(final WorldUser worldUser) { - this.users.put(worldUser.getUniqueId(), worldUser); - } - - public void removeUser(final UUID uniqueId) { - this.users.remove(uniqueId); - } - -} diff --git a/src/main/java/com/dev7ex/multiworld/world/WorldConfiguration.java b/src/main/java/com/dev7ex/multiworld/world/WorldConfiguration.java deleted file mode 100644 index 711b403..0000000 --- a/src/main/java/com/dev7ex/multiworld/world/WorldConfiguration.java +++ /dev/null @@ -1,93 +0,0 @@ -package com.dev7ex.multiworld.world; - -import com.dev7ex.common.bukkit.configuration.ConfigurationBase; -import com.dev7ex.common.bukkit.configuration.ConfigurationProperties; -import com.google.common.collect.Maps; -import org.bukkit.Difficulty; -import org.bukkit.GameMode; -import org.bukkit.configuration.ConfigurationSection; -import org.bukkit.plugin.Plugin; - -import java.util.Map; -import java.util.Set; - -/** - * @author Dev7ex - * @since 20.05.2021 - */ -@ConfigurationProperties(fileName = "worlds.yml") -public final class WorldConfiguration extends ConfigurationBase { - - public WorldConfiguration(final Plugin plugin) { - super(plugin); - } - - public void registerWorld(final String worldName, final WorldProperties worldProperties) { - super.getFileConfiguration().set(worldName + ".creator", worldProperties.getWorldCreator()); - super.getFileConfiguration().set(worldName + ".creation-time", worldProperties.getCreationTime()); - super.getFileConfiguration().set(worldName + ".last-world-interaction", worldProperties.getLastWorldInteraction()); - super.getFileConfiguration().set(worldName + ".world-type", worldProperties.getWorldType().toString()); - super.getFileConfiguration().set(worldName + ".difficulty", worldProperties.getDifficulty().toString()); - super.getFileConfiguration().set(worldName + ".gamemode", worldProperties.getGameMode().toString()); - super.getFileConfiguration().set(worldName + ".pvp-enabled", worldProperties.isPvpEnabled()); - super.saveFile(); - } - - public void unregisterWorld(final String worldName) { - super.getFileConfiguration().set(worldName, null); - super.saveFile(); - } - - public boolean isWorldRegistered(final String worldName) { - return super.getFileConfiguration().contains(worldName); - } - - public WorldProperties getWorldProperties(final String worldName) { - final String creator = super.getFileConfiguration().getString(worldName + ".creator"); - final long creationTime = super.getFileConfiguration().getLong(worldName + ".creation-time"); - final long lastWorldInteraction = super.getFileConfiguration().getLong(worldName + ".last-world-interaction"); - final WorldType worldType = WorldType.valueOf(super.getFileConfiguration().getString(worldName + ".world-type")); - final Difficulty difficulty = Difficulty.valueOf(super.getFileConfiguration().getString(worldName + ".difficulty")); - final GameMode gameMode = GameMode.valueOf(super.getFileConfiguration().getString(worldName + ".gamemode")); - final boolean pvpEnabled = super.getFileConfiguration().getBoolean(worldName + ".pvp-enabled"); - final boolean spawnAnimals = super.getFileConfiguration().getBoolean(worldName + "spawn-animals", false); - final boolean spawnMonsters = super.getFileConfiguration().getBoolean(worldName + "spawn-monsters", false); - return new WorldProperties(worldName, creator, creationTime, - lastWorldInteraction, worldType, difficulty, - gameMode, pvpEnabled, spawnAnimals, spawnMonsters); - } - - public void updateWorldOption(final String worldName, final WorldOption worldOption, final String value) { - super.getFileConfiguration().set(worldName + "." + worldOption.getStoragePath(), value); - super.saveFile(); - } - - public void updateLastWorldInteraction(final WorldProperties worldProperties) { - super.getFileConfiguration().set(worldProperties.getWorldName() + ".last-world-interaction", worldProperties.getLastWorldInteraction()); - super.saveFile(); - } - - public Map getWorldProperties() { - final Map worlds = Maps.newHashMap(); - - for (final String world : super.getFileConfiguration().getKeys(false)) { - final ConfigurationSection section = super.getFileConfiguration().getConfigurationSection(world); - final String creator = section.getString("creator"); - final long creationTime = section.getLong("creation-time"); - final long lastWorldInteraction = section.getLong("last-world-interaction"); - final WorldType worldType = WorldType.valueOf(section.getString("world-type")); - final Difficulty difficulty = Difficulty.valueOf(section.getString("difficulty")); - final GameMode gameMode = GameMode.valueOf(section.getString("gamemode")); - final boolean pvpEnabled = section.getBoolean("pvp-enabled"); - final boolean spawnAnimals = section.getBoolean("spawn-animals", false); - final boolean spawnMonsters = section.getBoolean("spawn-monsters", false); - worlds.put(world, new WorldProperties(world, creator, creationTime, lastWorldInteraction, worldType, difficulty, gameMode, pvpEnabled, spawnAnimals, spawnMonsters)); - } - return worlds; - } - - public Set getWorlds() { - return super.getFileConfiguration().getKeys(false); - } - -} diff --git a/src/main/java/com/dev7ex/multiworld/world/WorldManager.java b/src/main/java/com/dev7ex/multiworld/world/WorldManager.java deleted file mode 100644 index 6de18ca..0000000 --- a/src/main/java/com/dev7ex/multiworld/world/WorldManager.java +++ /dev/null @@ -1,314 +0,0 @@ -package com.dev7ex.multiworld.world; - -import com.dev7ex.common.io.Files; -import com.dev7ex.multiworld.MultiWorldConfiguration; -import com.dev7ex.multiworld.MultiWorldPlugin; -import com.dev7ex.multiworld.api.event.world.WorldCloneEvent; -import com.dev7ex.multiworld.api.event.world.WorldCreateEvent; -import com.dev7ex.multiworld.api.event.world.WorldDeleteEvent; -import com.dev7ex.multiworld.command.WorldCommand; -import com.dev7ex.multiworld.generator.FlatChunkGenerator; -import com.dev7ex.multiworld.generator.VoidChunkGenerator; -import com.dev7ex.multiworld.user.WorldUser; -import com.dev7ex.multiworld.user.WorldUserProperties; -import com.dev7ex.multiworld.user.WorldUserService; - -import com.google.common.collect.Maps; - -import lombok.AccessLevel; -import lombok.Getter; - -import org.apache.commons.io.FileUtils; -import org.bukkit.*; -import org.bukkit.command.CommandSender; -import org.bukkit.entity.Player; - -import java.io.File; -import java.io.IOException; -import java.util.Arrays; -import java.util.Map; - -/** - * @author Dev7ex - * @since 20.05.2021 - */ -@Getter(AccessLevel.PUBLIC) -public final class WorldManager { - - private final Map worldProperties = Maps.newHashMap(); - private final WorldConfiguration worldConfiguration; - private final WorldUserService worldUserService; - private final MultiWorldConfiguration configuration; - - public WorldManager(final MultiWorldConfiguration configuration, final WorldConfiguration worldConfiguration, final WorldUserService worldUserService) { - this.configuration = configuration; - this.worldConfiguration = worldConfiguration; - this.worldUserService = worldUserService; - } - - public void createWorld(final CommandSender commandSender, final String worldName, final WorldType worldType) { - final WorldCreator worldCreator = new WorldCreator(worldName); - - switch (worldType) { - case FLAT: - worldCreator.generator(new FlatChunkGenerator()); - break; - - case NETHER: - worldCreator.environment(World.Environment.NETHER); - break; - - case END: - worldCreator.environment(World.Environment.THE_END); - break; - - case VOID: - worldCreator.generator(new VoidChunkGenerator()); - break; - - default: - worldCreator.type(org.bukkit.WorldType.NORMAL); - break; - } - commandSender.sendMessage(this.configuration.getMessage("create.starting").replaceAll("%world%", worldName)); - final WorldProperties worldProperties = new WorldProperties(worldName, commandSender.getName(), - System.currentTimeMillis(), System.currentTimeMillis(), worldType, - Difficulty.valueOf(this.configuration.getString("defaults.difficulty")), - GameMode.valueOf(this.configuration.getString("defaults.gamemode")), - this.configuration.getBoolean("defaults.pvp-enabled"), - this.configuration.getBoolean("defaults.spawn-animals"), - this.configuration.getBoolean("defaults.spawn-monsters")); - - final WorldCreateEvent event = new WorldCreateEvent(worldProperties); - Bukkit.getPluginManager().callEvent(event); - - if (event.isCancelled()) { - return; - } - final World world = worldCreator.createWorld(); - - commandSender.sendMessage(this.configuration.getMessage("create.finished").replaceAll("%world%", worldName)); - worldProperties.setLoaded(true); - world.setDifficulty(worldProperties.getDifficulty()); - this.worldConfiguration.registerWorld(worldName, worldProperties); - this.worldProperties.put(worldName, worldProperties); - } - - public void createWorld(final CommandSender commandSender, final String worldName, final long seed) { - final WorldCreator worldCreator = new WorldCreator(worldName); - worldCreator.seed(seed); - - commandSender.sendMessage(this.configuration.getMessage("create.starting").replaceAll("%world%", worldName)); - final WorldProperties worldProperties = new WorldProperties(worldName, commandSender.getName(), - System.currentTimeMillis(), System.currentTimeMillis(), WorldType.NORMAL, - Difficulty.valueOf(this.configuration.getString("defaults.difficulty")), - GameMode.valueOf(this.configuration.getString("defaults.gamemode")), - this.configuration.getBoolean("defaults.pvp-enabled"), - this.configuration.getBoolean("defaults.spawn-animals"), - this.configuration.getBoolean("defaults.spawn-monsters")); - - final WorldCreateEvent event = new WorldCreateEvent(worldProperties); - Bukkit.getPluginManager().callEvent(event); - - if (event.isCancelled()) { - return; - } - final World world = worldCreator.createWorld(); - - commandSender.sendMessage(this.configuration.getMessage("create.finished").replaceAll("%world%", worldName)); - worldProperties.setLoaded(true); - world.setDifficulty(worldProperties.getDifficulty()); - this.worldConfiguration.registerWorld(worldName, worldProperties); - this.worldProperties.put(worldName, worldProperties); - } - - public void createWorld(final CommandSender commandSender, final String worldName, final String generator) { - final WorldCreator worldCreator = new WorldCreator(worldName); - worldCreator.generator(generator); - - commandSender.sendMessage(this.configuration.getMessage("create.starting").replaceAll("%world%", worldName)); - final WorldProperties worldProperties = new WorldProperties(worldName, commandSender.getName(), - System.currentTimeMillis(), System.currentTimeMillis(), WorldType.NORMAL, - Difficulty.valueOf(this.configuration.getString("defaults.difficulty")), - GameMode.valueOf(this.configuration.getString("defaults.gamemode")), - this.configuration.getBoolean("defaults.pvp-enabled"), - this.configuration.getBoolean("defaults.spawn-animals"), - this.configuration.getBoolean("defaults.spawn-monsters")); - - final WorldCreateEvent event = new WorldCreateEvent(worldProperties); - Bukkit.getPluginManager().callEvent(event); - - if (event.isCancelled()) { - return; - } - final World world = worldCreator.createWorld(); - - commandSender.sendMessage(this.configuration.getMessage("create.finished").replaceAll("%world%", worldName)); - worldProperties.setLoaded(true); - world.setDifficulty(worldProperties.getDifficulty()); - this.worldConfiguration.registerWorld(worldName, worldProperties); - this.worldProperties.put(worldName, worldProperties); - } - - public void cloneWorld(final CommandSender commandSender, final String worldName, final String clonedName) { - final File sourceFolder = new File(Bukkit.getWorldContainer(), worldName); - final File destinationFolder = new File(Bukkit.getWorldContainer(), clonedName); - - final WorldCloneEvent event = new WorldCloneEvent(commandSender, worldName, clonedName, sourceFolder, destinationFolder); - Bukkit.getPluginManager().callEvent(event); - - if (event.isCancelled()) { - return; - } - - commandSender.sendMessage(this.configuration.getMessage("clone.starting").replaceAll("%world%", worldName)); - - try { - final File sessionFile = new File(sourceFolder, "session.lock"); - - if (sessionFile.exists()) { - sessionFile.delete(); - } - - FileUtils.copyDirectory(sourceFolder, destinationFolder); - - for (final File file : Files.getFiles(destinationFolder)) { - if (!file.isFile()) { - continue; - } - if (!file.getName().equalsIgnoreCase("uid.dat")) { - continue; - } - file.delete(); - } - commandSender.sendMessage(this.configuration.getMessage("clone.finished").replaceAll("%world%", worldName)); - - } catch (final IOException exception) { - commandSender.sendMessage("§cAn error has occurred. View the logs"); - exception.printStackTrace(); - } - } - - public void unloadWorld(final CommandSender commandSender, final String worldName) { - final World world = Bukkit.getWorld(worldName); - - for (final Player player : Bukkit.getOnlinePlayers()) { - if (!player.getWorld().getName().equalsIgnoreCase(worldName)) { - continue; - } - player.sendMessage(this.configuration.getMessage("unload.chunk-teleport").replaceAll("%world%", worldName)); - player.teleport(Bukkit.getWorld(MultiWorldPlugin.getInstance().getConfiguration().getString("defaults.world")).getSpawnLocation()); - } - commandSender.sendMessage(this.configuration.getMessage("unload.chunk-starting").replaceAll("%world%", worldName)); - Arrays.stream(world.getLoadedChunks()).forEach(Chunk::unload); - commandSender.sendMessage(this.configuration.getMessage("unload.chunk-finished").replaceAll("%world%", worldName)); - - commandSender.sendMessage(this.configuration.getMessage("unload.starting").replaceAll("%world%", worldName)); - Bukkit.unloadWorld(world.getName(), true); - commandSender.sendMessage(this.configuration.getMessage("unload.finished").replaceAll("%world%", worldName)); - this.worldProperties.get(worldName).setLoaded(false); - } - - public void deleteWorld(final CommandSender commandSender, final String worldName) { - commandSender.sendMessage(this.configuration.getMessage("delete.starting").replaceAll("%world%", worldName)); - - final WorldDeleteEvent event = new WorldDeleteEvent(this.worldConfiguration.getWorldProperties(worldName)); - Bukkit.getPluginManager().callEvent(event); - - if (event.isCancelled()) { - return; - } - - if (Bukkit.getWorld(worldName) != null) { - this.unloadWorld(commandSender, worldName); - } - - try { - FileUtils.deleteDirectory(new File(Bukkit.getWorldContainer() + File.separator + worldName)); - - } catch (final IOException exception) { - commandSender.sendMessage("§cAn error has occurred. View the logs"); - exception.printStackTrace(); - return; - } - this.worldConfiguration.unregisterWorld(worldName); - this.worldProperties.remove(worldName); - commandSender.sendMessage(this.configuration.getMessage("delete.finished").replaceAll("%world%", worldName)); - } - - public void loadWorld(final CommandSender commandSender, final String worldName) { - final WorldProperties worldProperties = this.worldConfiguration.getWorldProperties(worldName); - final WorldCreator worldCreator = new WorldCreator(worldName); - - commandSender.sendMessage(this.configuration.getMessage("load.starting").replaceAll("%world%", worldName)); - - if (!worldProperties.getWorldType().isOverWorld()) { - worldCreator.environment(worldProperties.getWorldType().getEnvironment()); - } - - switch (worldProperties.getWorldType()) { - case VOID: - worldCreator.generator(new VoidChunkGenerator()); - worldCreator.generateStructures(false); - break; - - case FLAT: - worldCreator.generator(new FlatChunkGenerator()); - worldCreator.generateStructures(false); - break; - } - - final World world = Bukkit.createWorld(worldCreator); - world.setDifficulty(worldProperties.getDifficulty()); - commandSender.sendMessage(this.configuration.getMessage("load.finished").replaceAll("%world%", worldName)); - - worldProperties.setLoaded(true); - this.worldProperties.put(worldName, worldProperties); - } - - public void importWorld(final CommandSender commandSender, final String worldName, final WorldType worldType) { - commandSender.sendMessage(this.configuration.getMessage("import.starting").replaceAll("%world%", worldName)); - - final WorldProperties worldProperties = new WorldProperties(worldName, commandSender.getName(), - System.currentTimeMillis(), System.currentTimeMillis(), worldType, - Difficulty.valueOf(this.configuration.getString("defaults.difficulty")), - GameMode.valueOf(this.configuration.getString("defaults.gamemode")), - this.configuration.getBoolean("defaults.pvp-enabled"), - this.configuration.getBoolean("defaults.spawn-animals"), - this.configuration.getBoolean("defaults.spawn-monsters")); - - this.worldConfiguration.registerWorld(worldName, worldProperties); - this.worldProperties.put(worldName, worldProperties); - commandSender.sendMessage(this.configuration.getMessage("import.finished").replaceAll("%world%", worldName)); - } - - public void teleportWorld(final CommandSender commandSender, final Player target, final Location teleportLocation) { - final WorldUser worldUser = this.worldUserService.getUsers().get(target.getUniqueId()); - final WorldUserProperties userProperties = worldUser.getProperties(); - final WorldProperties worldProperties = this.worldProperties.get(teleportLocation.getWorld().getName()); - - userProperties.setLastWorld(target.getWorld().getName()); - userProperties.setLastWorldLocation(target.getLocation()); - - target.teleport(teleportLocation); - commandSender.sendMessage(this.configuration.getMessage("teleport.message").replaceAll("%player%", target.getName()).replaceAll("%world%", teleportLocation.getWorld().getName())); - - worldProperties.setLastWorldInteraction(System.currentTimeMillis()); - this.worldConfiguration.updateLastWorldInteraction(worldProperties); - } - - public void teleportWorld(final Player target, final Location teleportLocation) { - final WorldUser worldUser = this.worldUserService.getUsers().get(target.getUniqueId()); - final WorldUserProperties userProperties = worldUser.getProperties(); - final WorldProperties worldProperties = this.worldProperties.get(teleportLocation.getWorld().getName()); - - userProperties.setLastWorld(target.getWorld().getName()); - userProperties.setLastWorldLocation(target.getLocation()); - - target.teleport(teleportLocation); - - worldProperties.setLastWorldInteraction(System.currentTimeMillis()); - this.worldConfiguration.updateLastWorldInteraction(this.worldProperties.get(teleportLocation.getWorld().getName())); - } - -} diff --git a/src/main/java/com/dev7ex/multiworld/world/WorldOption.java b/src/main/java/com/dev7ex/multiworld/world/WorldOption.java deleted file mode 100644 index da83892..0000000 --- a/src/main/java/com/dev7ex/multiworld/world/WorldOption.java +++ /dev/null @@ -1,47 +0,0 @@ -package com.dev7ex.multiworld.world; - -import com.google.common.collect.Lists; - -import lombok.AccessLevel; -import lombok.Getter; - -import java.util.Arrays; -import java.util.List; -import java.util.Optional; - -/** - * @author Dev7ex - * @since 23.05.2021 - */ -@Getter(AccessLevel.PUBLIC) -public enum WorldOption { - - SPAWN_MONSTERS("spawn-monsters", Lists.newArrayList("false", "true")), - SPAWN_ANIMALS("spawn-animals", Lists.newArrayList("false", "true")), - GAMEMODE("gamemode", Lists.newArrayList("ADVENTURE", "CREATIVE", "SURVIVAL", "SPECTATOR")), - PVP_ENABLED("pvp", Lists.newArrayList("false", "true")), - DIFFICULTY("difficulty", Lists.newArrayList("EASY", "HARD", "NORMAL", "PEACEFUL")), - WORLD_TYPE("world-type", WorldType.toStringList()); - - private final String storagePath; - private final List values; - - WorldOption(final String storagePath, final List values) { - this.storagePath = storagePath; - this.values = values; - } - - public static List toStringList() { - final List constants = Lists.newArrayList(); - - for (final WorldOption option : WorldOption.values()) { - constants.add(option.name()); - } - return constants; - } - - public static Optional fromString(final String name) { - return Arrays.stream(WorldOption.values()).filter(worldOption -> worldOption.name().equalsIgnoreCase(name)).findFirst(); - } - -} diff --git a/src/main/java/com/dev7ex/multiworld/world/WorldProperties.java b/src/main/java/com/dev7ex/multiworld/world/WorldProperties.java deleted file mode 100644 index b7caefa..0000000 --- a/src/main/java/com/dev7ex/multiworld/world/WorldProperties.java +++ /dev/null @@ -1,89 +0,0 @@ -package com.dev7ex.multiworld.world; - -import lombok.AccessLevel; -import lombok.Getter; -import lombok.Setter; - -import org.bukkit.Bukkit; -import org.bukkit.Difficulty; -import org.bukkit.GameMode; - -import java.text.SimpleDateFormat; -import java.util.Date; -import java.util.Objects; - -/** - * @author Dev7ex - * @since 20.05.2021 - */ -@Getter(AccessLevel.PUBLIC) -@Setter(AccessLevel.PUBLIC) -public final class WorldProperties { - - private final String worldName; - private String worldCreator; - private long creationTime; - private long lastWorldInteraction; - private boolean loaded; - private WorldType worldType; - private GameMode gameMode; - private Difficulty difficulty; - private boolean pvpEnabled; - private boolean spawnAnimals; - private boolean spawnMonsters; - - public WorldProperties(final String worldName, final String worldCreator, final long creationTime, - final long lastWorldInteraction, final WorldType worldType, final Difficulty difficulty, - final GameMode gameMode, final boolean pvpEnabled, final boolean spawnAnimals, final boolean spawnMonsters) { - this.worldName = worldName; - this.worldCreator = worldCreator; - this.creationTime = creationTime; - this.lastWorldInteraction = lastWorldInteraction; - this.worldType = worldType; - this.difficulty = difficulty; - this.gameMode = gameMode; - this.pvpEnabled = pvpEnabled; - } - - public void updateWorldOption(final WorldOption worldOption, final String value) { - switch (worldOption) { - case PVP_ENABLED: - this.pvpEnabled = Boolean.parseBoolean(value); - break; - - case GAMEMODE: - this.gameMode = GameMode.valueOf(String.valueOf(value)); - break; - - case DIFFICULTY: - this.difficulty = Difficulty.valueOf(String.valueOf(value)); - if (this.loaded) { - Objects.requireNonNull(Bukkit.getWorld(this.worldName)).setDifficulty(this.difficulty); - } - break; - - case SPAWN_ANIMALS: - this.spawnAnimals = Boolean.parseBoolean(value); - if (this.loaded) { - Objects.requireNonNull(Bukkit.getWorld(this.worldName)).setSpawnFlags(this.spawnMonsters, this.spawnAnimals); - } - break; - - case SPAWN_MONSTERS: - this.spawnMonsters = Boolean.parseBoolean(value); - if (this.loaded) { - Objects.requireNonNull(Bukkit.getWorld(this.worldName)).setSpawnFlags(this.spawnMonsters, this.spawnAnimals); - } - break; - - case WORLD_TYPE: - this.worldType = WorldType.valueOf(String.valueOf(value)); - break; - } - } - - public String formatCreationDate(final long value) { - return new SimpleDateFormat("dd.MM.yyyy").format(new Date(value)); - } - -} diff --git a/src/main/java/com/dev7ex/multiworld/world/WorldService.java b/src/main/java/com/dev7ex/multiworld/world/WorldService.java deleted file mode 100644 index 47267e4..0000000 --- a/src/main/java/com/dev7ex/multiworld/world/WorldService.java +++ /dev/null @@ -1,91 +0,0 @@ -package com.dev7ex.multiworld.world; - -import com.dev7ex.common.bukkit.plugin.service.PluginService; - -import com.dev7ex.multiworld.MultiWorldConfiguration; - -import com.dev7ex.multiworld.MultiWorldPlugin; -import com.dev7ex.multiworld.api.event.plugin.MultiWorldStartupCompleteEvent; -import lombok.AccessLevel; -import lombok.Getter; -import org.bukkit.Bukkit; -import org.bukkit.ChatColor; -import org.bukkit.World; -import org.bukkit.plugin.Plugin; - -import java.util.ArrayList; -import java.util.HashMap; -import java.util.Map; - -/** - * @author Dev7ex - * @since 20.05.2021 - */ -@Getter(AccessLevel.PUBLIC) -public final class WorldService implements PluginService { - - private final WorldConfiguration worldConfiguration; - private final WorldManager worldManager; - private final MultiWorldConfiguration configuration; - private final Map worldGenerators = new HashMap<>(); - - public WorldService(final WorldManager worldManager, final WorldConfiguration worldConfiguration) { - this.worldManager = worldManager; - this.worldConfiguration = worldConfiguration; - this.configuration = worldManager.getConfiguration(); - } - - @Override - public void onEnable() { - final long startTime = System.currentTimeMillis(); - - for (final World worlds : Bukkit.getWorlds()) { - if (this.worldConfiguration.isWorldRegistered(worlds.getName())) { - continue; - } - this.worldManager.importWorld(Bukkit.getConsoleSender(), worlds.getName(), WorldType.getByEnvironment(worlds.getEnvironment())); - } - - for (final String worlds : this.configuration.getAutoLoadableWorlds()) { - if (!this.worldConfiguration.isWorldRegistered(worlds)) { - Bukkit.getConsoleSender().sendMessage(this.configuration.getMessage("loading.not-registered").replaceAll("%world%", worlds)); - continue; - } - this.worldManager.loadWorld(Bukkit.getConsoleSender(), worlds); - } - - for (final String worlds : this.worldConfiguration.getWorlds()) { - final WorldProperties worldProperties = this.worldConfiguration.getWorldProperties(worlds); - if (Bukkit.getWorld(worlds) != null) { - final World currentWorld = Bukkit.getWorld(worlds); - currentWorld.setDifficulty(this.worldConfiguration.getWorldProperties(worlds).getDifficulty()); - worldProperties.setLoaded(true); - } - this.worldManager.getWorldProperties().put(worlds, worldProperties); - } - - for (final Plugin plugin : Bukkit.getServer().getPluginManager().getPlugins()) { - if (!plugin.isEnabled()) { - continue; - } - - try { - if (plugin.getDefaultWorldGenerator("world", "") == null) { - continue; - } - } catch (final Exception exception) { - MultiWorldPlugin.getInstance().getLogger().severe(plugin.getName() + " could not be loaded"); - continue; - } - this.worldGenerators.put(plugin, plugin.getDescription().getName()); - } - MultiWorldPlugin.getInstance().getLogger().info("Found: [" + this.worldGenerators.values().size() + "] World Generator"); - Bukkit.getPluginManager().callEvent(new MultiWorldStartupCompleteEvent(System.currentTimeMillis() - startTime)); - } - - @Override - public void onDisable() { - this.worldManager.getWorldProperties().clear(); - } - -} diff --git a/src/main/java/com/dev7ex/multiworld/world/WorldType.java b/src/main/java/com/dev7ex/multiworld/world/WorldType.java deleted file mode 100644 index 1e09fd5..0000000 --- a/src/main/java/com/dev7ex/multiworld/world/WorldType.java +++ /dev/null @@ -1,50 +0,0 @@ -package com.dev7ex.multiworld.world; - -import lombok.AccessLevel; -import lombok.Getter; - -import org.bukkit.World; - -import java.util.Arrays; -import java.util.List; -import java.util.Optional; -import java.util.stream.Collectors; - -/** - * @author Dev7ex - * @since 20.05.2021 - */ -@Getter(AccessLevel.PUBLIC) -public enum WorldType { - - NORMAL(World.Environment.NORMAL, true), - FLAT(World.Environment.CUSTOM, true), - END(World.Environment.THE_END, false), - NETHER(World.Environment.NETHER, false), - VOID(World.Environment.CUSTOM, true); - - private final World.Environment environment; - private final boolean overWorld; - - WorldType(final World.Environment environment, final boolean overWorld) { - this.environment = environment; - this.overWorld = overWorld; - } - - public static WorldType getByEnvironment(final World.Environment environment) { - return switch (environment) { - case NETHER -> WorldType.NETHER; - case THE_END -> WorldType.END; - default -> WorldType.NORMAL; - }; - } - - public static List toStringList() { - return Arrays.stream(WorldType.values()).map(Enum::name).collect(Collectors.toList()); - } - - public static Optional fromString(final String name) { - return Arrays.stream(WorldType.values()).filter(worldType -> worldType.name().equalsIgnoreCase(name)).findFirst(); - } - -} diff --git a/src/main/resources/config.yml b/src/main/resources/config.yml deleted file mode 100644 index 9de31d0..0000000 --- a/src/main/resources/config.yml +++ /dev/null @@ -1,142 +0,0 @@ -# -# __ ___ ____ _ _ __ __ __ -# / |/ /_ __/ / /_(_) | / /___ _____/ /___/ / -# / /|_/ / / / / / __/ /| | /| / / __ \/ ___/ / __ / -# / / / / /_/ / / /_/ / | |/ |/ / /_/ / / / / /_/ / -# /_/ /_/\__,_/_/\__/_/ |__/|__/\____/_/ /_/\__,_/ -# -# Copyright (c) 2023 by Dev7ex -# Version: ${project.version} -config-version: ${project.version} -# General -prefix: '§8[§bMultiWorld§8]§r' -no-permission: '§cIm sorry, but you do not have permission to perform this command. Please contact the server administrators if you believe that is in error.' -player-not-found: '%prefix% §cThis player cannot be found' -only-player-command: '%prefix% §cThis command can only performed by a player' - -# Worlds that should be loaded when the server starts -# WARNING: When the world is not registered by MultiWorld the world will not bee loaded -# The world has to be imported manually! (Attention choose the correct WorldType) -auto-load: [] - -# Standard values for new worlds -defaults: - world: world - difficulty: PEACEFUL - gamemode: SURVIVAL - pvp-enabled: true - spawn-animals: true - spawn-monsters: true - -# Settings -settings: - # Should all players with the permission (multiworld.notify.update) - # get a message when entering server - receive-update-message: true - # Should the auto-gamemode per world work? - auto-gamemode: true - -messages: - back: - usage: '%prefix% §cUsage: /world back' - world-already-there: '%prefix%§ §7You are already in this world' - world-not-loaded: '%prefix% §7This world is not longer active' - world-not-found: '%prefix% §7There is no world you can be teleported' - clone: - usage: '%prefix% §cUsage: /world clone ' - starting: '%prefix% §7The world §a%world% §7will be cloned..' - finished: '%prefix% §7The world §a%world% §7was successfully cloned!' - create: - usage: '%prefix% §cUsage: /world create ' - starting: '%prefix% §7The world §a%world% §7is being created...' - finished: '%prefix% §7The world §a%world% §7was successfully created!' - delete: - usage: '%prefix% §cUsage: /world delete ' - starting: '%prefix% §7The world §a%world% §7will be deleted...' - finished: '%prefix% §7The world §a%world% §7has been deleted!' - help: - messages: - - '' - - '§f§m §r§r %prefix% §f§m ' - - '' - - '§7» §7/world §bback' - - '§7» §7/world §bclone §7 ' - - '§7» §7/world §bcreate §7 ' - - '§7» §7/world §bdelete §7' - - '§7» §7/world §bhelp' - - '§7» §7/world §bimport §7 ' - - '§7» §7/world §binfo §7' - - '§7» §7/world §blist' - - '§7» §7/world §bload §7' - - '§7» §7/world §boptions §7