refactor!: Rename back to MVWorldManager

This commit is contained in:
Ben Woo 2023-02-09 14:02:00 +08:00
parent 10ef838d3f
commit 6694c02650
18 changed files with 41 additions and 41 deletions

View File

@ -26,7 +26,7 @@ import com.onarandombox.MultiverseCore.api.MVConfig;
import com.onarandombox.MultiverseCore.api.MVCore;
import com.onarandombox.MultiverseCore.api.MVWorld;
import com.onarandombox.MultiverseCore.api.SafeTTeleporter;
import com.onarandombox.MultiverseCore.api.WorldManager;
import com.onarandombox.MultiverseCore.api.MVWorldManager;
import com.onarandombox.MultiverseCore.commands.CheckCommand;
import com.onarandombox.MultiverseCore.commands.CloneCommand;
import com.onarandombox.MultiverseCore.commands.ConfirmCommand;
@ -62,7 +62,7 @@ import com.onarandombox.MultiverseCore.utils.MVPlayerSession;
import com.onarandombox.MultiverseCore.utils.TestingMode;
import com.onarandombox.MultiverseCore.utils.UnsafeCallWrapper;
import com.onarandombox.MultiverseCore.utils.metrics.MetricsConfigurator;
import com.onarandombox.MultiverseCore.world.SimpleWorldManager;
import com.onarandombox.MultiverseCore.world.SimpleMVWorldManager;
import com.onarandombox.MultiverseCore.world.WorldProperties;
import me.main__.util.SerializationConfig.SerializationConfig;
import org.bukkit.configuration.Configuration;
@ -91,7 +91,7 @@ public class MultiverseCore extends JavaPlugin implements MVCore {
private final MVPermissions mvPermissions = new MVPermissions(this);
private SafeTTeleporter safeTTeleporter = new SimpleSafeTTeleporter(this);
private final UnsafeCallWrapper unsafeCallWrapper = new UnsafeCallWrapper(this);
private final WorldManager worldManager = new SimpleWorldManager(this);
private final MVWorldManager worldManager = new SimpleMVWorldManager(this);
// Configurations
private FileConfiguration multiverseConfig;
@ -333,7 +333,7 @@ public class MultiverseCore extends JavaPlugin implements MVCore {
* {@inheritDoc}
*/
@Override
public MVCommandManager getCommandManager() {
public MVCommandManager getMVCommandManager() {
return this.commandManager;
}
@ -373,7 +373,7 @@ public class MultiverseCore extends JavaPlugin implements MVCore {
* {@inheritDoc}
*/
@Override
public WorldManager getMVWorldManager() {
public MVWorldManager getMVWorldManager() {
return this.worldManager;
}

View File

@ -72,7 +72,7 @@ public interface MVCore extends MVPlugin {
*
* @return A non-null {@link MVCommandManager}.
*/
MVCommandManager getCommandManager();
MVCommandManager getMVCommandManager();
/**
* Gets the class responsible for loading many different destinations
@ -85,9 +85,9 @@ public interface MVCore extends MVPlugin {
/**
* Gets the primary class responsible for managing Multiverse Worlds.
*
* @return {@link WorldManager}.
* @return {@link MVWorldManager}.
*/
WorldManager getMVWorldManager();
MVWorldManager getMVWorldManager();
/**
* Saves the Multiverse-Config.

View File

@ -24,7 +24,7 @@ import org.bukkit.generator.ChunkGenerator;
* This API contains all of the world managing
* functions that your heart desires!
*/
public interface WorldManager {
public interface MVWorldManager {
/**
* Add a new World to the Multiverse Setup.
*
@ -224,7 +224,7 @@ public interface WorldManager {
/**
* Gets the {@link WorldPurger}.
* <p>
* @return The {@link WorldPurger} this {@link WorldManager} is using.
* @return The {@link WorldPurger} this {@link MVWorldManager} is using.
* @see WorldPurger
* @see SimpleWorldPurger
*/

View File

@ -18,6 +18,6 @@ public class ConfirmCommand extends MultiverseCommand {
@CommandPermission("multiverse.core.confirm")
@Description("Confirms dangerous commands before executing them.")
public void onConfirmCommand(@NotNull BukkitCommandIssuer issuer) {
this.plugin.getCommandManager().getCommandQueueManager().runQueuedCommand(issuer.getIssuer());
this.plugin.getMVCommandManager().getCommandQueueManager().runQueuedCommand(issuer.getIssuer());
}
}

View File

@ -33,7 +33,7 @@ public class DeleteCommand extends MultiverseCommand {
@Description("The world you want to delete.")
String worldName
) {
this.plugin.getCommandManager().getCommandQueueManager().addToQueue(new QueuedCommand(
this.plugin.getMVCommandManager().getCommandQueueManager().addToQueue(new QueuedCommand(
issuer.getIssuer(),
() -> {
issuer.sendMessage(String.format("Deleting world '%s'...", worldName));

View File

@ -2,7 +2,7 @@ package com.onarandombox.MultiverseCore.commands;
import co.aikar.commands.BaseCommand;
import com.onarandombox.MultiverseCore.MultiverseCore;
import com.onarandombox.MultiverseCore.api.WorldManager;
import com.onarandombox.MultiverseCore.api.MVWorldManager;
import com.onarandombox.MultiverseCore.commandtools.flags.CommandFlagGroup;
import com.onarandombox.MultiverseCore.commandtools.flags.CommandFlagsManager;
import com.onarandombox.MultiverseCore.commandtools.flags.ParsedCommandFlags;
@ -13,7 +13,7 @@ import org.jetbrains.annotations.NotNull;
*/
public class MultiverseCommand extends BaseCommand {
protected final MultiverseCore plugin;
protected final WorldManager worldManager;
protected final MVWorldManager worldManager;
protected final CommandFlagsManager flagsManager;
private String flagGroupName;
@ -21,7 +21,7 @@ public class MultiverseCommand extends BaseCommand {
protected MultiverseCommand(@NotNull MultiverseCore plugin) {
this.plugin = plugin;
this.worldManager = plugin.getMVWorldManager();
this.flagsManager = plugin.getCommandManager().getFlagsManager();
this.flagsManager = plugin.getMVCommandManager().getFlagsManager();
}
protected void registerFlagGroup(@NotNull CommandFlagGroup flagGroup) {

View File

@ -57,7 +57,7 @@ public class RegenCommand extends MultiverseCommand {
) {
ParsedCommandFlags parsedFlags = parseFlags(flags);
this.plugin.getCommandManager().getCommandQueueManager().addToQueue(new QueuedCommand(
this.plugin.getMVCommandManager().getCommandQueueManager().addToQueue(new QueuedCommand(
issuer.getIssuer(),
() -> {
issuer.sendMessage(String.format("Regenerating world '%s'...", worldName));

View File

@ -10,13 +10,13 @@ import co.aikar.commands.BukkitCommandIssuer;
import co.aikar.commands.PaperCommandCompletions;
import com.onarandombox.MultiverseCore.MultiverseCore;
import com.onarandombox.MultiverseCore.api.MVWorld;
import com.onarandombox.MultiverseCore.api.WorldManager;
import com.onarandombox.MultiverseCore.api.MVWorldManager;
import org.jetbrains.annotations.NotNull;
public class MVCommandCompletions extends PaperCommandCompletions {
protected final MVCommandManager commandManager;
private final MultiverseCore plugin;
private final WorldManager worldManager;
private final MVWorldManager worldManager;
public MVCommandCompletions(MVCommandManager mvCommandManager, MultiverseCore plugin) {
super(mvCommandManager);

View File

@ -1,7 +1,7 @@
package com.onarandombox.MultiverseCore.listeners;
import com.onarandombox.MultiverseCore.MultiverseCore;
import com.onarandombox.MultiverseCore.api.WorldManager;
import com.onarandombox.MultiverseCore.api.MVWorldManager;
import com.onarandombox.MultiverseCore.api.MVWorld;
import org.bukkit.ChatColor;
@ -14,7 +14,7 @@ import org.bukkit.event.player.AsyncPlayerChatEvent;
*/
public class MVChatListener implements Listener {
private final MultiverseCore plugin;
private final WorldManager worldManager;
private final MVWorldManager worldManager;
private final MVPlayerListener playerListener;
public MVChatListener(MultiverseCore plugin, MVPlayerListener playerListener) {

View File

@ -9,7 +9,7 @@ package com.onarandombox.MultiverseCore.listeners;
import com.dumptruckman.minecraft.util.Logging;
import com.onarandombox.MultiverseCore.MultiverseCore;
import com.onarandombox.MultiverseCore.api.WorldManager;
import com.onarandombox.MultiverseCore.api.MVWorldManager;
import com.onarandombox.MultiverseCore.api.MVWorld;
import org.bukkit.World;
import org.bukkit.entity.EntityType;
@ -28,7 +28,7 @@ import org.bukkit.event.entity.FoodLevelChangeEvent;
*/
public class MVEntityListener implements Listener {
private MultiverseCore plugin;
private WorldManager worldManager;
private MVWorldManager worldManager;
public MVEntityListener(MultiverseCore plugin) {
this.plugin = plugin;

View File

@ -12,7 +12,7 @@ import java.util.concurrent.ConcurrentHashMap;
import com.dumptruckman.minecraft.util.Logging;
import com.onarandombox.MultiverseCore.MultiverseCore;
import com.onarandombox.MultiverseCore.api.WorldManager;
import com.onarandombox.MultiverseCore.api.MVWorldManager;
import com.onarandombox.MultiverseCore.api.MVWorld;
import com.onarandombox.MultiverseCore.event.MVRespawnEvent;
import com.onarandombox.MultiverseCore.utils.PermissionTools;
@ -37,7 +37,7 @@ import org.bukkit.event.player.PlayerTeleportEvent;
*/
public class MVPlayerListener implements Listener {
private final MultiverseCore plugin;
private final WorldManager worldManager;
private final MVWorldManager worldManager;
private final PermissionTools pt;
private final Map<String, String> playerWorld = new ConcurrentHashMap<String, String>();

View File

@ -8,7 +8,7 @@
package com.onarandombox.MultiverseCore.listeners;
import com.onarandombox.MultiverseCore.MultiverseCore;
import com.onarandombox.MultiverseCore.api.WorldManager;
import com.onarandombox.MultiverseCore.api.MVWorldManager;
import com.onarandombox.MultiverseCore.api.MVWorld;
import org.bukkit.World;
import org.bukkit.event.EventHandler;
@ -21,7 +21,7 @@ import org.bukkit.event.world.WorldUnloadEvent;
*/
public class MVWorldListener implements Listener {
private MultiverseCore plugin;
private WorldManager worldManager;
private MVWorldManager worldManager;
public MVWorldListener(MultiverseCore plugin) {
this.plugin = plugin;

View File

@ -12,7 +12,7 @@ import java.util.List;
import com.dumptruckman.minecraft.util.Logging;
import com.onarandombox.MultiverseCore.MultiverseCore;
import com.onarandombox.MultiverseCore.api.MVDestination;
import com.onarandombox.MultiverseCore.api.WorldManager;
import com.onarandombox.MultiverseCore.api.MVWorldManager;
import com.onarandombox.MultiverseCore.api.MVWorld;
import org.bukkit.ChatColor;
import org.bukkit.Location;
@ -27,7 +27,7 @@ import org.bukkit.permissions.PermissionDefault;
public class MVPermissions {
private MultiverseCore plugin;
private WorldManager worldMgr;
private MVWorldManager worldMgr;
public MVPermissions(MultiverseCore plugin) {
this.plugin = plugin;

View File

@ -6,7 +6,7 @@ import java.util.function.Consumer;
import com.dumptruckman.minecraft.util.Logging;
import com.onarandombox.MultiverseCore.MultiverseCore;
import com.onarandombox.MultiverseCore.api.WorldManager;
import com.onarandombox.MultiverseCore.api.MVWorldManager;
import com.onarandombox.MultiverseCore.api.MVWorld;
import org.apache.commons.lang.WordUtils;
import org.bstats.bukkit.Metrics;
@ -30,7 +30,7 @@ public class MetricsConfigurator {
this.metrics = new Metrics(plugin, PLUGIN_ID);
}
private WorldManager getWorldManager() {
private MVWorldManager getWorldManager() {
return plugin.getMVWorldManager();
}

View File

@ -27,7 +27,7 @@ import java.util.stream.Collectors;
import com.dumptruckman.minecraft.util.Logging;
import com.onarandombox.MultiverseCore.MultiverseCore;
import com.onarandombox.MultiverseCore.MultiverseCoreConfiguration;
import com.onarandombox.MultiverseCore.api.WorldManager;
import com.onarandombox.MultiverseCore.api.MVWorldManager;
import com.onarandombox.MultiverseCore.api.MVWorld;
import com.onarandombox.MultiverseCore.api.SafeTTeleporter;
import com.onarandombox.MultiverseCore.api.WorldPurger;
@ -52,7 +52,7 @@ import org.bukkit.plugin.Plugin;
/**
* Public facing API to add/remove Multiverse worlds.
*/
public class SimpleWorldManager implements WorldManager {
public class SimpleMVWorldManager implements MVWorldManager {
private final MultiverseCore plugin;
private final WorldPurger worldPurger;
private final Map<String, MVWorld> worlds;
@ -61,7 +61,7 @@ public class SimpleWorldManager implements WorldManager {
private Map<String, String> defaultGens;
private String firstSpawn;
public SimpleWorldManager(MultiverseCore core) {
public SimpleMVWorldManager(MultiverseCore core) {
this.plugin = core;
this.worldsFromTheConfig = new HashMap<String, WorldProperties>();
this.worlds = new ConcurrentHashMap<String, MVWorld>();
@ -968,8 +968,8 @@ public class SimpleWorldManager implements WorldManager {
}
/**
* Gets the {@link FileConfiguration} that this {@link SimpleWorldManager} is using.
* @return The {@link FileConfiguration} that this {@link SimpleWorldManager} is using.
* Gets the {@link FileConfiguration} that this {@link SimpleMVWorldManager} is using.
* @return The {@link FileConfiguration} that this {@link SimpleMVWorldManager} is using.
*/
public FileConfiguration getConfigWorlds() {
return this.configWorlds;

View File

@ -1,6 +1,6 @@
package com.onarandombox.MultiverseCore;
import com.onarandombox.MultiverseCore.api.WorldManager;
import com.onarandombox.MultiverseCore.api.MVWorldManager;
import com.onarandombox.MultiverseCore.api.MVWorld;
import com.onarandombox.MultiverseCore.listeners.MVEntityListener;
import com.onarandombox.MultiverseCore.utils.MockWorldFactory;
@ -55,7 +55,7 @@ public class TestEntitySpawnRules {
cbworld = MockWorldFactory.makeNewMockWorld("world", World.Environment.NORMAL, WorldType.NORMAL);
when(mvWorld.getCBWorld()).thenReturn(cbworld);
WorldManager worldman = mock(WorldManager.class);
MVWorldManager worldman = mock(MVWorldManager.class);
when(worldman.isMVWorld(anyString())).thenReturn(true);
when(worldman.getMVWorld(anyString())).thenReturn(mvWorld);
Field worldmanfield = MVEntityListener.class.getDeclaredField("worldManager");

View File

@ -9,7 +9,7 @@ package com.onarandombox.MultiverseCore;
import java.io.File;
import com.onarandombox.MultiverseCore.api.WorldManager;
import com.onarandombox.MultiverseCore.api.MVWorldManager;
import com.onarandombox.MultiverseCore.api.MVWorld;
import com.onarandombox.MultiverseCore.world.configuration.SpawnLocation;
import com.onarandombox.MultiverseCore.utils.MockWorldFactory;
@ -125,7 +125,7 @@ public class TestWorldProperties {
// ////////////////////////////////////////////////
// let's set some world-properties
// we can test the API with this, too :D
WorldManager worldManager = core.getMVWorldManager();
MVWorldManager worldManager = core.getMVWorldManager();
assertNotNull(worldManager);
MVWorld mvWorld = worldManager.getMVWorld("world");

View File

@ -13,7 +13,7 @@ import com.onarandombox.MultiverseCore.api.MVWorld;
import com.onarandombox.MultiverseCore.listeners.MVEntityListener;
import com.onarandombox.MultiverseCore.listeners.MVPlayerListener;
import com.onarandombox.MultiverseCore.listeners.MVWeatherListener;
import com.onarandombox.MultiverseCore.world.SimpleWorldManager;
import com.onarandombox.MultiverseCore.world.SimpleMVWorldManager;
import junit.framework.Assert;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
@ -218,7 +218,7 @@ public class TestInstanceCreator {
buscriptfield.set(core, buscript);
// Set worldManager
SimpleWorldManager wm = spy(new SimpleWorldManager(core));
SimpleMVWorldManager wm = spy(new SimpleMVWorldManager(core));
Field worldmanagerfield = MultiverseCore.class.getDeclaredField("worldManager");
worldmanagerfield.setAccessible(true);
worldmanagerfield.set(core, wm);