mirror of
https://github.com/Multiverse/Multiverse-Core.git
synced 2024-11-22 18:47:20 +01:00
Merge pull request #2977 from zax71/codestyle-changes
This commit is contained in:
commit
954e304f3a
@ -7,14 +7,6 @@
|
||||
|
||||
package com.onarandombox.MultiverseCore;
|
||||
|
||||
import java.io.File;
|
||||
import java.lang.annotation.Annotation;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.logging.Logger;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import com.dumptruckman.minecraft.util.Logging;
|
||||
import com.onarandombox.MultiverseCore.anchor.AnchorManager;
|
||||
import com.onarandombox.MultiverseCore.api.Destination;
|
||||
@ -47,6 +39,12 @@ import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import org.jvnet.hk2.annotations.Service;
|
||||
|
||||
import java.io.File;
|
||||
import java.lang.annotation.Annotation;
|
||||
import java.util.List;
|
||||
import java.util.logging.Logger;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* The implementation of the Multiverse-{@link MVCore}.
|
||||
*/
|
||||
@ -377,7 +375,7 @@ public class MultiverseCore extends JavaPlugin implements MVCore {
|
||||
* Gets the best service from this plugin that implements the given contract or has the given implementation.
|
||||
*
|
||||
* @param contractOrImpl The contract or concrete implementation to get the best instance of
|
||||
* @param qualifiers The set of qualifiers that must match this service definition
|
||||
* @param qualifiers The set of qualifiers that must match this service definition
|
||||
* @return An instance of the contract or impl if it is a service and is already instantiated, null otherwise
|
||||
* @throws MultiException if there was an error during service lookup
|
||||
*/
|
||||
@ -395,7 +393,7 @@ public class MultiverseCore extends JavaPlugin implements MVCore {
|
||||
* the provided qualifiers.
|
||||
*
|
||||
* @param contractOrImpl The contract or concrete implementation to get the best instance of
|
||||
* @param qualifiers The set of qualifiers that must match this service definition
|
||||
* @param qualifiers The set of qualifiers that must match this service definition
|
||||
* @return A list of services implementing this contract or concrete implementation. May not return null, but may
|
||||
* return an empty list
|
||||
* @throws MultiException if there was an error during service lookup
|
||||
@ -415,10 +413,10 @@ public class MultiverseCore extends JavaPlugin implements MVCore {
|
||||
/**
|
||||
* This is for unit testing ONLY. Do not use this constructor.
|
||||
*
|
||||
* @param loader The PluginLoader to use.
|
||||
* @param loader The PluginLoader to use.
|
||||
* @param description The Description file to use.
|
||||
* @param dataFolder The folder that other datafiles can be found in.
|
||||
* @param file The location of the plugin.
|
||||
* @param dataFolder The folder that other datafiles can be found in.
|
||||
* @param file The location of the plugin.
|
||||
*/
|
||||
public MultiverseCore(JavaPluginLoader loader, PluginDescriptionFile description, File dataFolder, File file) {
|
||||
super(loader, description, dataFolder, file);
|
||||
|
@ -1,15 +1,15 @@
|
||||
package com.onarandombox.MultiverseCore.configuration.node;
|
||||
|
||||
import io.github.townyadvanced.commentedconfiguration.setting.CommentedNode;
|
||||
import io.vavr.control.Option;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
import java.util.Map;
|
||||
|
||||
import io.github.townyadvanced.commentedconfiguration.setting.CommentedNode;
|
||||
import io.vavr.control.Option;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
/**
|
||||
* A collection of {@link CommentedNode}s, with mappings to nodes by name.
|
||||
*/
|
||||
@ -52,7 +52,7 @@ public class NodeGroup implements Collection<Node> {
|
||||
/**
|
||||
* Gets the node with the given name.
|
||||
*
|
||||
* @param name The name of the node to get.
|
||||
* @param name The name of the node to get.
|
||||
* @return The node with the given name, or {@link Option.None} if no node with the given name exists.
|
||||
*/
|
||||
public Option<Node> findNode(String name) {
|
||||
|
@ -7,29 +7,12 @@
|
||||
|
||||
package com.onarandombox.MultiverseCore.world;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FilenameFilter;
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Random;
|
||||
import java.util.Set;
|
||||
import java.util.Stack;
|
||||
import java.util.concurrent.Callable;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import com.dumptruckman.minecraft.util.Logging;
|
||||
import com.onarandombox.MultiverseCore.MultiverseCore;
|
||||
import com.onarandombox.MultiverseCore.api.BlockSafety;
|
||||
import com.onarandombox.MultiverseCore.api.LocationManipulation;
|
||||
import com.onarandombox.MultiverseCore.api.MVWorldManager;
|
||||
import com.onarandombox.MultiverseCore.api.MVWorld;
|
||||
import com.onarandombox.MultiverseCore.api.MVWorldManager;
|
||||
import com.onarandombox.MultiverseCore.api.SafeTTeleporter;
|
||||
import com.onarandombox.MultiverseCore.api.WorldPurger;
|
||||
import com.onarandombox.MultiverseCore.config.MVCoreConfig;
|
||||
@ -56,6 +39,22 @@ import org.bukkit.permissions.PermissionDefault;
|
||||
import org.bukkit.plugin.Plugin;
|
||||
import org.jvnet.hk2.annotations.Service;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Random;
|
||||
import java.util.Set;
|
||||
import java.util.Stack;
|
||||
import java.util.concurrent.Callable;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* Public facing API to add/remove Multiverse worlds.
|
||||
*/
|
||||
@ -179,7 +178,7 @@ public class SimpleMVWorldManager implements MVWorldManager {
|
||||
}
|
||||
this.server.getWorld(oldName).setAutoSave(false);
|
||||
}
|
||||
|
||||
|
||||
// Grab a bit of metadata from the old world.
|
||||
MVWorld oldWorld = getMVWorld(oldName);
|
||||
|
||||
@ -207,7 +206,7 @@ public class SimpleMVWorldManager implements MVWorldManager {
|
||||
if (oldWorld != null && wasAutoSave) {
|
||||
oldWorld.getCBWorld().setAutoSave(true);
|
||||
}
|
||||
|
||||
|
||||
if (newWorldFile.exists()) {
|
||||
Logging.fine("Succeeded at copying files");
|
||||
|
||||
@ -227,8 +226,8 @@ public class SimpleMVWorldManager implements MVWorldManager {
|
||||
|
||||
// actually load the world
|
||||
if (doLoad(newName)) {
|
||||
Logging.fine("Succeeded at loading cloned world '" + newName + "'");
|
||||
return true;
|
||||
Logging.fine("Succeeded at loading cloned world '" + newName + "'");
|
||||
return true;
|
||||
}
|
||||
Logging.severe("Failed to load the cloned world '" + newName + "'");
|
||||
return false;
|
||||
@ -408,7 +407,7 @@ public class SimpleMVWorldManager implements MVWorldManager {
|
||||
this.worlds.remove(name);
|
||||
Logging.info("World '%s' was unloaded from Bukkit.", name);
|
||||
return true;
|
||||
} else if (!unloadBukkit){
|
||||
} else if (!unloadBukkit) {
|
||||
this.worlds.remove(name);
|
||||
Logging.info("World '%s' was unloaded from Multiverse.", name);
|
||||
return true;
|
||||
@ -992,6 +991,7 @@ public class SimpleMVWorldManager implements MVWorldManager {
|
||||
|
||||
/**
|
||||
* Gets the {@link FileConfiguration} that this {@link SimpleMVWorldManager} is using.
|
||||
*
|
||||
* @return The {@link FileConfiguration} that this {@link SimpleMVWorldManager} is using.
|
||||
*/
|
||||
public FileConfiguration getConfigWorlds() {
|
||||
@ -1001,24 +1001,24 @@ public class SimpleMVWorldManager implements MVWorldManager {
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public boolean hasUnloadedWorld(String name, boolean includeLoaded) {
|
||||
if (getMVWorld(name) != null) {
|
||||
return includeLoaded;
|
||||
}
|
||||
for (Map.Entry<String, WorldProperties> entry : this.worldsFromTheConfig.entrySet()) {
|
||||
if (name.equals(entry.getKey()) || name.equals(entry.getValue().getAlias())) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
@Override
|
||||
public boolean hasUnloadedWorld(String name, boolean includeLoaded) {
|
||||
if (getMVWorld(name) != null) {
|
||||
return includeLoaded;
|
||||
}
|
||||
for (Map.Entry<String, WorldProperties> entry : this.worldsFromTheConfig.entrySet()) {
|
||||
if (name.equals(entry.getKey()) || name.equals(entry.getValue().getAlias())) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public Collection<String> getPotentialWorlds() {
|
||||
public Collection<String> getPotentialWorlds() {
|
||||
File worldContainer = this.server.getWorldContainer();
|
||||
if (worldContainer == null) {
|
||||
return Collections.emptyList();
|
||||
|
Loading…
Reference in New Issue
Block a user