Skip to content

Commit

Permalink
Bump config, Add workaround for spout issue.
Browse files Browse the repository at this point in the history
Closes #355, Closes #149, Closes #349

This adds a new config var: firstspawnoverride that defaults to true.
You should disable this if you don't want mv to do your spawning (if
you have Spout, a warning will print and it will be disabled
automatically. The firstspawn feature will NOT work with spout at this
time.) When the spout bug is fixed, someone should open an issue. I
will not be monitoring this :)
  • Loading branch information
fernferret committed Dec 31, 2011
1 parent 9fa29bc commit 9f12f63
Show file tree
Hide file tree
Showing 6 changed files with 36 additions and 10 deletions.
26 changes: 23 additions & 3 deletions src/main/java/com/onarandombox/MultiverseCore/MultiverseCore.java
Expand Up @@ -59,6 +59,7 @@ public class MultiverseCore extends JavaPlugin implements MVPlugin, Core {
public static boolean PrefixChat;
public static boolean DisplayPermErrors;
public static boolean TeleportIntercept;
public static boolean FirstSpawnOverride;
public static Map<String, String> teleportQueue = new HashMap<String, String>();
private AnchorManager anchorManager = new AnchorManager(this);

Expand Down Expand Up @@ -222,6 +223,19 @@ public void onEnable() {
this.log(Level.SEVERE, "Your configs were not loaded. Very little will function in Multiverse.");
}
this.anchorManager.loadAnchors();

// Now set the firstspawnworld (after the worlds are loaded):
// Default as the server.props world.
this.worldManager.setFirstSpawnWorld(this.multiverseConfig.getString("firstspawnworld", getDefaultWorldName()));
// We have to set this one here, if it's not present, we don't know the name of the default world.
// and this one won't be in the defaults yml file.
this.multiverseConfig.set("firstspawnworld", this.worldManager.getFirstSpawnWorld().getName());
// A test that had no worlds loaded was being run. This should never happen in production
this.saveMVConfig();
// Check to see if spout was already loaded (most likely):
if (this.getServer().getPluginManager().getPlugin("Spout") != null) {
this.log(Level.INFO, "Spout integration enabled.");
}
}

private boolean validateAllpay() {
Expand Down Expand Up @@ -325,10 +339,10 @@ public void loadConfigs() {
EnforceAccess = this.multiverseConfig.getBoolean("enforceaccess", false);
EnforceGameModes = this.multiverseConfig.getBoolean("enforcegamemodes", true);
PrefixChat = this.multiverseConfig.getBoolean("worldnameprefix", true);
DisplayPermErrors = this.multiverseConfig.getBoolean("displaypermerrors", true);
TeleportIntercept = this.multiverseConfig.getBoolean("teleportintercept", true);
// Default as the server.props world.
this.worldManager.setFirstSpawnWorld(this.multiverseConfig.getString("firstspawnworld", getDefaultWorldName()));
// Should MV do the first spawn stuff?
FirstSpawnOverride = this.multiverseConfig.getBoolean("firstspawnoverride", true);
// Should permissions errors display to users?
DisplayPermErrors = this.multiverseConfig.getBoolean("displaypermerrors", true);
this.messaging = new MVMessaging(this);
this.messaging.setCooldown(this.multiverseConfig.getInt("messagecooldown", 5000));
Expand Down Expand Up @@ -657,6 +671,12 @@ public void setServerFolder(File newServerFolder) {
public void setSpout() {
this.spoutInterface = new SpoutInterface();
this.commandHandler.registerCommand(new SpoutCommand(this));
if (FirstSpawnOverride) {
this.log(Level.WARNING, "the config value 'firstspawnworld' will have NO effect!!!");
this.log(Level.WARNING, " --FernFerret");
FirstSpawnOverride = false;
this.multiverseConfig.set("firstspawnoverride", false);
}
}

public SpoutInterface getSpout() {
Expand Down
Expand Up @@ -8,7 +8,7 @@
package com.onarandombox.MultiverseCore.enums;

public enum ConfigProperty {
messagecooldown, teleportcooldown, worldnameprefix, enforcegamemodes, enforceaccess, displaypermerrors, debug, firstworldspawn, teleportintercept;
messagecooldown, teleportcooldown, worldnameprefix, enforcegamemodes, enforceaccess, displaypermerrors, debug, firstspawnworld, teleportintercept, firstspawnoverride;

public static String getAllValues() {
String buffer = "";
Expand Down
Expand Up @@ -12,7 +12,6 @@
import org.bukkit.event.Event;

public class MVRespawnEvent extends Event {
private static final long serialVersionUID = -2991894063331856687L;
private Player player;
private Location location;
private String respawnMethod;
Expand Down
Expand Up @@ -107,9 +107,10 @@ public void onPlayerJoin(PlayerJoinEvent event) {
Player p = event.getPlayer();
if (!p.hasPlayedBefore()) {
this.plugin.log(Level.FINE, "Player joined first!");
this.plugin.log(Level.FINE, "Loc: " + worldManager.getFirstSpawnWorld().getSpawnLocation());
// This will override other spawn plugins atm :(
this.spawnNewPlayer(p);
if(MultiverseCore.FirstSpawnOverride) {
this.plugin.log(Level.FINE, "Moving NEW player to(firstspawnoverride): " + worldManager.getFirstSpawnWorld().getSpawnLocation());
this.spawnNewPlayer(p);
}
return;
} else {
this.plugin.log(Level.FINE, "Player joined AGAIN!");
Expand Down
Expand Up @@ -214,7 +214,12 @@ public MultiverseWorld getFirstSpawnWorld() {
if (world == null) {
// If the spawn world was unloaded, get the default world
this.plugin.log(Level.WARNING, "The world specified as the spawn world (" + this.firstSpawn + ") did not exist!!");
return this.getMVWorld(this.plugin.getServer().getWorlds().get(0));
try {
return this.getMVWorld(this.plugin.getServer().getWorlds().get(0));
} catch (IndexOutOfBoundsException e) {
// This should only happen in tests.
return null;
}
}
return world;
}
Expand Down
3 changes: 2 additions & 1 deletion src/main/resources/defaults/config.yml
Expand Up @@ -8,6 +8,7 @@ worldnameprefix: true
enforceaccess: true
enforcegamemodes: true
bedrespawn: true
version: 2.4
version: 2.5
displaypermerrors: true
teleportintercept: true
firstspawnoverride: true

2 comments on commit 9f12f63

@Psithief
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Many thanks for the Spout workaround.

@andrewkm
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you

Please sign in to comment.