mirror of
https://github.com/Multiverse/Multiverse-Core.git
synced 2024-11-07 11:20:32 +01:00
Removed old checks, cleanup poop
Add in the deprecated config method to not break other plugins Fix handling of unloaded worlds in info and list
This commit is contained in:
parent
a1b07065b2
commit
950991ff1b
@ -64,7 +64,8 @@ import java.util.logging.Logger;
|
||||
*/
|
||||
public class MultiverseCore extends JavaPlugin implements MVPlugin, Core {
|
||||
private static final int PROTOCOL = 13;
|
||||
|
||||
// TODO: Investigate if this one is really needed to be static.
|
||||
// Doubt it. -- FernFerret
|
||||
private static Map<String, String> teleportQueue = new HashMap<String, String>();
|
||||
|
||||
private AnchorManager anchorManager = new AnchorManager(this);
|
||||
@ -152,8 +153,6 @@ public class MultiverseCore extends JavaPlugin implements MVPlugin, Core {
|
||||
private MVWeatherListener weatherListener = new MVWeatherListener(this);
|
||||
private MVPortalListener portalListener = new MVPortalListener(this);
|
||||
|
||||
//public UpdateChecker updateCheck;
|
||||
|
||||
// HashMap to contain information relating to the Players.
|
||||
private HashMap<String, MVPlayerSession> playerSessions;
|
||||
private GenericBank bank = null;
|
||||
@ -161,8 +160,6 @@ public class MultiverseCore extends JavaPlugin implements MVPlugin, Core {
|
||||
private int pluginCount;
|
||||
private DestinationFactory destFactory;
|
||||
private SpoutInterface spoutInterface = null;
|
||||
private static final double ALLPAY_VERSION = 5;
|
||||
private static final double CH_VERSION = 4;
|
||||
private MultiverseMessaging messaging;
|
||||
private BlockSafety blockSafety;
|
||||
private LocationManipulation locationManipulation;
|
||||
@ -209,12 +206,6 @@ public class MultiverseCore extends JavaPlugin implements MVPlugin, Core {
|
||||
*/
|
||||
@Override
|
||||
public void onEnable() {
|
||||
//this.worldManager = new WorldManager(this);
|
||||
// Perform initial checks for AllPay
|
||||
if (!this.validateAllpay() || !this.validateCH()) {
|
||||
this.getServer().getPluginManager().disablePlugin(this);
|
||||
return;
|
||||
}
|
||||
this.messaging = new MVMessaging();
|
||||
this.banker = new AllPay(this, LOG_TAG + " ");
|
||||
// Output a little snippet to show it's enabled.
|
||||
@ -269,40 +260,6 @@ public class MultiverseCore extends JavaPlugin implements MVPlugin, Core {
|
||||
}
|
||||
}
|
||||
|
||||
private boolean validateAllpay() {
|
||||
try {
|
||||
this.banker = new AllPay(this, "Verify");
|
||||
if (this.banker.getVersion() >= ALLPAY_VERSION) {
|
||||
return true;
|
||||
}
|
||||
} catch (Throwable t) {
|
||||
}
|
||||
LOGGER.info(String.format("%s - Version %s was NOT ENABLED!!!", LOG_TAG, this.getDescription().getVersion()));
|
||||
LOGGER.info(String.format("%s A plugin that has loaded before %s has an incompatible version of AllPay (an internal library)!",
|
||||
LOG_TAG, this.getDescription().getName()));
|
||||
LOGGER.info(String.format("%s The Following Plugins MAY out of date: %s", LOG_TAG, this.banker.getPluginsThatUseUs()));
|
||||
LOGGER.info(String.format("%s This plugin needs AllPay v%f or higher and another plugin has loaded v%f!",
|
||||
LOG_TAG, ALLPAY_VERSION, this.banker.getVersion()));
|
||||
return false;
|
||||
}
|
||||
|
||||
private boolean validateCH() {
|
||||
try {
|
||||
this.commandHandler = new CommandHandler(this, null);
|
||||
if (this.commandHandler.getVersion() >= CH_VERSION) {
|
||||
return true;
|
||||
}
|
||||
} catch (Throwable t) {
|
||||
}
|
||||
LOGGER.info(String.format("%s - Version %s was NOT ENABLED!!!", LOG_TAG, this.getDescription().getVersion()));
|
||||
LOGGER.info(String.format("%s A plugin that has loaded before %s has an incompatible version of CommandHandler (an internal library)!",
|
||||
LOG_TAG, this.getDescription().getName()));
|
||||
LOGGER.info(String.format("%s Please contact this plugin author!!!", LOG_TAG));
|
||||
LOGGER.info(String.format("%s This plugin needs CommandHandler v%f or higher and another plugin has loaded v%f!",
|
||||
LOG_TAG, CH_VERSION, this.commandHandler.getVersion()));
|
||||
return false;
|
||||
}
|
||||
|
||||
private void initializeDestinationFactory() {
|
||||
this.destFactory = new DestinationFactory(this);
|
||||
this.destFactory.registerDestinationType(WorldDestination.class, "");
|
||||
@ -898,4 +855,14 @@ public class MultiverseCore extends JavaPlugin implements MVPlugin, Core {
|
||||
public MultiverseCoreConfig getMVConfig() {
|
||||
return config;
|
||||
}
|
||||
|
||||
/**
|
||||
* This method is currently used by other plugins.
|
||||
* It will be removed in 2.4
|
||||
* @return
|
||||
*/
|
||||
@Deprecated
|
||||
public static MultiverseCoreConfiguration getStaticConfig() {
|
||||
return config;
|
||||
}
|
||||
}
|
||||
|
@ -61,9 +61,13 @@ public class InfoCommand extends MultiverseCommand {
|
||||
return;
|
||||
}
|
||||
} else if (args.size() == 1) {
|
||||
if (this.worldManager.getMVWorld(args.get(0)) != null) {
|
||||
if (this.worldManager.isMVWorld(args.get(0))) {
|
||||
// then we have a world!
|
||||
worldName = args.get(0);
|
||||
} else if(this.worldManager.getUnloadedWorlds().contains(args.get(0))){
|
||||
sender.sendMessage("That world exists, but it is unloaded!");
|
||||
sender.sendMessage(String.format("You can load it with: %s/mv load %s", ChatColor.AQUA, args.get(0)));
|
||||
return;
|
||||
} else {
|
||||
if (sender instanceof Player) {
|
||||
Player p = (Player) sender;
|
||||
@ -93,8 +97,11 @@ public class InfoCommand extends MultiverseCommand {
|
||||
p = (Player) sender;
|
||||
}
|
||||
showPage(pageNum, sender, this.buildEntireCommand(this.worldManager.getMVWorld(worldName), p));
|
||||
} else if (this.worldManager.getUnloadedWorlds().contains(worldName)) {
|
||||
sender.sendMessage("That world exists, but it is unloaded!");
|
||||
sender.sendMessage(String.format("You can load it with: %s/mv load %s", ChatColor.AQUA, worldName));
|
||||
} else if (this.plugin.getServer().getWorld(worldName) != null) {
|
||||
sender.sendMessage("That world exists, but multiverse does not know about it!");
|
||||
sender.sendMessage("That world exists, but Multiverse does not know about it!");
|
||||
sender.sendMessage("You can import it with" + ChatColor.AQUA + "/mv import " + ChatColor.GREEN + worldName + ChatColor.LIGHT_PURPLE + "{ENV}");
|
||||
sender.sendMessage("For available environments type " + ChatColor.GREEN + "/mv env");
|
||||
}
|
||||
|
@ -52,14 +52,16 @@ public class ListCommand extends PaginatedCoreCommand<String> {
|
||||
} else if (env == Environment.THE_END) {
|
||||
color = ChatColor.AQUA;
|
||||
}
|
||||
String outputCache = world.getColoredWorldString() + ChatColor.WHITE + " - " + color + world.getEnvironment();
|
||||
StringBuilder builder = new StringBuilder();
|
||||
builder.append(world.getColoredWorldString()).append(ChatColor.WHITE);
|
||||
builder.append(" - ").append(color).append(world.getEnvironment());
|
||||
if (world.isHidden()) {
|
||||
if (p == null || p.hasPermission("multiverse.core.modify")) {
|
||||
if (p == null || this.plugin.getMVPerms().hasPermission(p, "multiverse.core.modify", true)) {
|
||||
// Prefix hidden worlds with an "[H]"
|
||||
worldList.add(ChatColor.GRAY + "[H]" + outputCache);
|
||||
worldList.add(ChatColor.GRAY + "[H]" + builder.toString());
|
||||
}
|
||||
} else {
|
||||
worldList.add(outputCache);
|
||||
worldList.add(builder.toString());
|
||||
}
|
||||
}
|
||||
for (String name : this.plugin.getMVWorldManager().getUnloadedWorlds()) {
|
||||
|
Loading…
Reference in New Issue
Block a user