mirror of
https://github.com/Multiverse/Multiverse-Core.git
synced 2025-02-16 20:41:59 +01:00
parent
5d932060ee
commit
9a7c6202cc
@ -105,6 +105,7 @@ public class MVWorld implements MultiverseWorld {
|
||||
this.propertyList.put("memory", fac.getNewProperty("keepspawninmemory", true, "keepspawninmemory", "Sorry, 'memory' must either be:" + ChatColor.GREEN + " true " + ChatColor.WHITE + "or" + ChatColor.RED + " false" + ChatColor.WHITE + "."));
|
||||
this.propertyList.put("spawn", fac.getNewProperty("spawn", this.world.getSpawnLocation(), "There is no help available for this variable. Go bug Rigby90 about it."));
|
||||
this.propertyList.put("autoload", fac.getNewProperty("autoload", true, "Set this to false ONLY if you don't want this world to load itself on server restart."));
|
||||
this.propertyList.put("bedrespawn", fac.getNewProperty("bedrespawn", true, "If a player dies in this world, shoudld they go to their bed?"));
|
||||
((LocationConfigProperty) this.getKnownProperty("spawn")).setValue(this.readSpawnFromConfig(this.getCBWorld()));
|
||||
|
||||
// Set aliases
|
||||
@ -695,8 +696,8 @@ public class MVWorld implements MultiverseWorld {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setAutoLoad(boolean adjust) {
|
||||
((BooleanConfigProperty) this.getKnownProperty("autoload")).setValue(adjust);
|
||||
public void setAutoLoad(boolean autoLoad) {
|
||||
((BooleanConfigProperty) this.getKnownProperty("autoload")).setValue(autoLoad);
|
||||
saveConfig();
|
||||
}
|
||||
|
||||
@ -704,4 +705,15 @@ public class MVWorld implements MultiverseWorld {
|
||||
public boolean getAutoLoad() {
|
||||
return ((BooleanConfigProperty) this.getKnownProperty("autoload")).getValue();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setBedRespawn(boolean respawn) {
|
||||
((BooleanConfigProperty) this.getKnownProperty("bedrespawn")).setValue(respawn);
|
||||
saveConfig();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean getBedRespawn() {
|
||||
return ((BooleanConfigProperty) this.getKnownProperty("bedrespawn")).getValue();
|
||||
}
|
||||
}
|
||||
|
@ -52,7 +52,6 @@ public class MultiverseCore extends JavaPlugin implements MVPlugin, Core {
|
||||
public static boolean EnforceAccess;
|
||||
public static boolean EnforceGameModes;
|
||||
public static boolean PrefixChat;
|
||||
public static boolean BedRespawn;
|
||||
private File testConfigDirectory;
|
||||
private PluginDescriptionFile testDescriptionFile;
|
||||
|
||||
@ -299,7 +298,6 @@ public class MultiverseCore extends JavaPlugin implements MVPlugin, Core {
|
||||
EnforceAccess = this.multiverseConfig.getBoolean("enforceaccess", false);
|
||||
EnforceGameModes = this.multiverseConfig.getBoolean("enforcegamemodes", true);
|
||||
PrefixChat = this.multiverseConfig.getBoolean("worldnameprefix", true);
|
||||
BedRespawn = this.multiverseConfig.getBoolean("bedrespawn", true);
|
||||
this.messaging = new MVMessaging(this);
|
||||
this.messaging.setCooldown(this.multiverseConfig.getInt("messagecooldown", 5000));
|
||||
this.saveMVConfigs();
|
||||
|
@ -485,7 +485,7 @@ public interface MultiverseWorld {
|
||||
|
||||
/**
|
||||
* Sets whether or not Multiverse should auto-load this world.
|
||||
*
|
||||
* <p/>
|
||||
* True is default.
|
||||
*
|
||||
* @param autoLoad True if multiverse should autoload this world the spawn, false if not.
|
||||
@ -499,5 +499,23 @@ public interface MultiverseWorld {
|
||||
*/
|
||||
public boolean getAutoLoad();
|
||||
|
||||
/**
|
||||
* Sets whether or not a player who dies in this world will respawn in their
|
||||
* bed or follow the normal respawn pattern.
|
||||
* <p/>
|
||||
* True is default.
|
||||
*
|
||||
* @param autoLoad True if players dying in this world respawn at their bed.
|
||||
*/
|
||||
public void setBedRespawn(boolean autoLoad);
|
||||
|
||||
/**
|
||||
* Gets whether or not a player who dies in this world will respawn in their
|
||||
* bed or follow the normal respawn pattern.
|
||||
*
|
||||
* @return True if players dying in this world should respawn at their bed.
|
||||
*/
|
||||
public boolean getBedRespawn();
|
||||
|
||||
|
||||
}
|
||||
|
@ -32,7 +32,6 @@ public class ConfigCommand extends MultiverseCommand {
|
||||
this.addCommandExample("/mv config show");
|
||||
this.addCommandExample("/mv config " + ChatColor.GREEN + "debug" + ChatColor.AQUA + " 3");
|
||||
this.addCommandExample("/mv config " + ChatColor.GREEN + "enforceaccess" + ChatColor.AQUA + " false");
|
||||
this.addCommandExample("/mv config " + ChatColor.GREEN + "bedrespawn" + ChatColor.AQUA + " true");
|
||||
this.setPermission("multiverse.core.config", "Allows you to set Global MV Variables.", PermissionDefault.OP);
|
||||
this.worldManager = this.plugin.getMVWorldManager();
|
||||
}
|
||||
|
@ -60,7 +60,6 @@ public class VersionCommand extends MultiverseCommand {
|
||||
logAndAddToPasteBinBuffer("worldnameprefix: " + MultiverseCore.PrefixChat);
|
||||
logAndAddToPasteBinBuffer("enforceaccess: " + MultiverseCore.EnforceAccess);
|
||||
logAndAddToPasteBinBuffer("enforcegamemodes: " + MultiverseCore.EnforceGameModes);
|
||||
logAndAddToPasteBinBuffer("bedrespawn: " + MultiverseCore.BedRespawn);
|
||||
logAndAddToPasteBinBuffer("debug: " + MultiverseCore.GlobalDebug);
|
||||
logAndAddToPasteBinBuffer("Special Code: FRN002");
|
||||
|
||||
|
@ -74,7 +74,6 @@ public class MVCoreConfigMigrator extends MVConfigMigrator {
|
||||
newConfig.setProperty("opfallback", true);
|
||||
newConfig.setProperty("disableautoheal", false);
|
||||
newConfig.setProperty("fakepvp", false);
|
||||
newConfig.setProperty("bedrespawn", true);
|
||||
newConfig.setProperty("version", 2.2);
|
||||
newConfig.save();
|
||||
return true;
|
||||
|
@ -9,7 +9,7 @@ package com.onarandombox.MultiverseCore.enums;
|
||||
|
||||
/** Multiverse 2 */
|
||||
public enum ConfigProperty {
|
||||
messagecooldown, teleportcooldown, worldnameprefix, bedrespawn, enforcegamemodes, enforceaccess, debug;
|
||||
messagecooldown, teleportcooldown, worldnameprefix, enforcegamemodes, enforceaccess, debug;
|
||||
|
||||
|
||||
public static String getAllValues() {
|
||||
|
@ -11,7 +11,6 @@ import com.fernferret.allpay.GenericBank;
|
||||
import com.onarandombox.MultiverseCore.MultiverseCore;
|
||||
import com.onarandombox.MultiverseCore.api.MultiverseWorld;
|
||||
import com.onarandombox.MultiverseCore.event.MVRespawnEvent;
|
||||
import com.onarandombox.MultiverseCore.utils.LocationManipulation;
|
||||
import com.onarandombox.MultiverseCore.utils.SafeTTeleporter;
|
||||
import com.onarandombox.MultiverseCore.utils.WorldManager;
|
||||
import org.bukkit.*;
|
||||
@ -57,19 +56,17 @@ public class MVPlayerListener extends PlayerListener {
|
||||
@Override
|
||||
public void onPlayerRespawn(PlayerRespawnEvent event) {
|
||||
World world = event.getPlayer().getWorld();
|
||||
|
||||
MultiverseWorld mvWorld = this.worldManager.getMVWorld(world.getName());
|
||||
// If it's not a World MV manages we stop.
|
||||
if (!this.worldManager.isMVWorld(world.getName())) {
|
||||
if (mvWorld == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (MultiverseCore.BedRespawn) {
|
||||
if (mvWorld.getBedRespawn()) {
|
||||
this.plugin.log(Level.FINE, "Spawning " + event.getPlayer().getName() + " at their bed");
|
||||
return;
|
||||
}
|
||||
|
||||
// Get the MultiverseWorld
|
||||
MultiverseWorld mvWorld = this.worldManager.getMVWorld(world.getName());
|
||||
// Get the instance of the World the player should respawn at.
|
||||
MultiverseWorld respawnWorld = null;
|
||||
if (this.worldManager.isMVWorld(mvWorld.getRespawnToWorld())) {
|
||||
|
Loading…
Reference in New Issue
Block a user