Add time, remove global gamemode, see below:

- Add Time as a settable (but not stored) function proptery.
 - Add Function properties (They're called tempStringConfigProperties until I make them more generic. deal with it :P)
 - Remove the globalgamemode setting, since it's already covered with the new perms.

When I move TempStringConfigProperty to a seperate superclass (ActiveConfigProperty) we won't have the issue of things getting set anymore, as ActiveConfigProperties will change an active setting (gamemode for example) **when** they're set, not after some cleanup function gets run. Hell. Yes.

Off to bed... I promised this commit to someone which is why it's a lil' sloppy. Sorry :( Will fix tomorrow!
This commit is contained in:
Eric Stokes 2012-01-03 20:57:36 -07:00
parent b69403e00c
commit 10d849dc51
11 changed files with 246 additions and 45 deletions

View File

@ -8,14 +8,15 @@
package com.onarandombox.MultiverseCore; package com.onarandombox.MultiverseCore;
import com.onarandombox.MultiverseCore.api.MultiverseWorld; import com.onarandombox.MultiverseCore.api.MultiverseWorld;
import com.onarandombox.MultiverseCore.configuration.*; import com.onarandombox.MultiverseCore.configuration.ConfigPropertyFactory;
import com.onarandombox.MultiverseCore.configuration.MVConfigProperty;
import com.onarandombox.MultiverseCore.configuration.TempStringConfigProperty;
import com.onarandombox.MultiverseCore.enums.EnglishChatColor; import com.onarandombox.MultiverseCore.enums.EnglishChatColor;
import com.onarandombox.MultiverseCore.event.MVWorldPropertyChangeEvent; import com.onarandombox.MultiverseCore.event.MVWorldPropertyChangeEvent;
import com.onarandombox.MultiverseCore.exceptions.PropertyDoesNotExistException; import com.onarandombox.MultiverseCore.exceptions.PropertyDoesNotExistException;
import com.onarandombox.MultiverseCore.utils.BlockSafety; import com.onarandombox.MultiverseCore.utils.BlockSafety;
import com.onarandombox.MultiverseCore.utils.LocationManipulation; import com.onarandombox.MultiverseCore.utils.LocationManipulation;
import com.onarandombox.MultiverseCore.utils.SafeTTeleporter; import com.onarandombox.MultiverseCore.utils.SafeTTeleporter;
import org.bukkit.ChatColor; import org.bukkit.ChatColor;
import org.bukkit.Difficulty; import org.bukkit.Difficulty;
import org.bukkit.GameMode; import org.bukkit.GameMode;
@ -31,11 +32,15 @@ import org.bukkit.permissions.PermissionDefault;
import java.io.File; import java.io.File;
import java.io.IOException; import java.io.IOException;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.logging.Level; import java.util.logging.Level;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
/** /**
* The implementation of a Multiverse handled world. * The implementation of a Multiverse handled world.
@ -61,6 +66,16 @@ public class MVWorld implements MultiverseWorld {
private Map<String, String> propertyAliases; private Map<String, String> propertyAliases;
private Permission ignoreperm; private Permission ignoreperm;
private static final Map<String, String> staticTimes = new HashMap<String, String>();
static {
staticTimes.put("morning", "8:00");
staticTimes.put("day", "12:00");
staticTimes.put("noon", "12:00");
staticTimes.put("midnight", "0:00");
staticTimes.put("night", "20:00");
}
public MVWorld(World world, FileConfiguration config, MultiverseCore instance, Long seed, String generatorString, boolean fixSpawn) { public MVWorld(World world, FileConfiguration config, MultiverseCore instance, Long seed, String generatorString, boolean fixSpawn) {
this.config = config; this.config = config;
this.plugin = instance; this.plugin = instance;
@ -112,7 +127,7 @@ public class MVWorld implements MultiverseWorld {
"Sorry, 'weather' must either be:" + ChatColor.GREEN + " true " + ChatColor.WHITE + "or" + ChatColor.RED + " false" + ChatColor.WHITE + ".")); "Sorry, 'weather' must either be:" + ChatColor.GREEN + " true " + ChatColor.WHITE + "or" + ChatColor.RED + " false" + ChatColor.WHITE + "."));
this.propertyList.put("difficulty", fac.getNewProperty("difficulty", Difficulty.EASY, this.propertyList.put("difficulty", fac.getNewProperty("difficulty", Difficulty.EASY,
"Difficulty must be set as one of the following: " + ChatColor.GREEN + "peaceful " "Difficulty must be set as one of the following: " + ChatColor.GREEN + "peaceful "
+ ChatColor.AQUA + "easy " + ChatColor.GOLD + "normal " + ChatColor.RED + "hard")); + ChatColor.AQUA + "easy " + ChatColor.GOLD + "normal " + ChatColor.RED + "hard"));
this.propertyList.put("animals", fac.getNewProperty("animals", true, "animals.spawn", this.propertyList.put("animals", fac.getNewProperty("animals", true, "animals.spawn",
"Sorry, 'animals' must either be:" + ChatColor.GREEN + " true " + ChatColor.WHITE + "or" + ChatColor.RED + " false" + ChatColor.WHITE + ".")); "Sorry, 'animals' must either be:" + ChatColor.GREEN + " true " + ChatColor.WHITE + "or" + ChatColor.RED + " false" + ChatColor.WHITE + "."));
this.propertyList.put("monsters", fac.getNewProperty("monsters", true, "monsters.spawn", this.propertyList.put("monsters", fac.getNewProperty("monsters", true, "monsters.spawn",
@ -121,14 +136,14 @@ public class MVWorld implements MultiverseWorld {
"Currency must be an integer between -1 and the highest Minecraft item ID.")); "Currency must be an integer between -1 and the highest Minecraft item ID."));
this.propertyList.put("price", fac.getNewProperty("price", 0.0, "entryfee.price", this.propertyList.put("price", fac.getNewProperty("price", 0.0, "entryfee.price",
"Price must be a double value. ex: " + ChatColor.GOLD + "1.2" + ChatColor.WHITE "Price must be a double value. ex: " + ChatColor.GOLD + "1.2" + ChatColor.WHITE
+ ". Set to a negative value to give players money for entering this world.")); + ". Set to a negative value to give players money for entering this world."));
this.propertyList.put("hunger", fac.getNewProperty("hunger", true, this.propertyList.put("hunger", fac.getNewProperty("hunger", true,
"Sorry, 'hunger' must either be:" + ChatColor.GREEN + " true " + ChatColor.WHITE + "or" + ChatColor.RED + " false" + ChatColor.WHITE + ".")); "Sorry, 'hunger' must either be:" + ChatColor.GREEN + " true " + ChatColor.WHITE + "or" + ChatColor.RED + " false" + ChatColor.WHITE + "."));
this.propertyList.put("autoheal", fac.getNewProperty("autoheal", true, this.propertyList.put("autoheal", fac.getNewProperty("autoheal", true,
"Sorry, 'autoheal' must either be:" + ChatColor.GREEN + " true " + ChatColor.WHITE + "or" + ChatColor.RED + " false" + ChatColor.WHITE + ".")); "Sorry, 'autoheal' must either be:" + ChatColor.GREEN + " true " + ChatColor.WHITE + "or" + ChatColor.RED + " false" + ChatColor.WHITE + "."));
this.propertyList.put("adjustspawn", fac.getNewProperty("adjustspawn", true, this.propertyList.put("adjustspawn", fac.getNewProperty("adjustspawn", true,
"Sorry, 'adjustspawn' must either be:" + ChatColor.GREEN + " true " + ChatColor.WHITE "Sorry, 'adjustspawn' must either be:" + ChatColor.GREEN + " true " + ChatColor.WHITE
+ "or" + ChatColor.RED + " false" + ChatColor.WHITE + ".")); + "or" + ChatColor.RED + " false" + ChatColor.WHITE + "."));
if (!fixSpawn) { if (!fixSpawn) {
this.setAdjustSpawn(false); this.setAdjustSpawn(false);
} }
@ -141,6 +156,7 @@ public class MVWorld implements MultiverseWorld {
this.propertyList.put("autoload", fac.getNewProperty("autoload", true, 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.")); "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?")); this.propertyList.put("bedrespawn", fac.getNewProperty("bedrespawn", true, "If a player dies in this world, shoudld they go to their bed?"));
this.propertyList.put("time", fac.getNewProperty("time", "", "Set the time to whatever you want! (Will NOT freeze time)", "setTime", true));
this.getKnownProperty("spawn", Location.class).setValue(this.readSpawnFromConfig(this.getCBWorld())); this.getKnownProperty("spawn", Location.class).setValue(this.readSpawnFromConfig(this.getCBWorld()));
@ -210,16 +226,13 @@ public class MVWorld implements MultiverseWorld {
this.plugin.log(Level.WARNING, "Someone tried to set a scale <= 0, defaulting to 1."); this.plugin.log(Level.WARNING, "Someone tried to set a scale <= 0, defaulting to 1.");
} }
// Set the gamemode for (Player p : this.plugin.getServer().getWorld(this.getName()).getPlayers()) {
// TODO: Move this to a per world gamemode this.plugin.log(Level.FINER, "Setting " + p.getName() + "'s GameMode to "
if (MultiverseCore.EnforceGameModes) { + this.getKnownProperty("mode", GameMode.class).getValue().toString());
for (Player p : this.plugin.getServer().getWorld(this.getName()).getPlayers()) { this.plugin.getPlayerListener().handleGameMode(p, this);
this.plugin.log(Level.FINER, "Setting " + p.getName() + "'s GameMode to "
+ this.getKnownProperty("mode", GameMode.class).getValue().toString());
this.plugin.getPlayerListener().handleGameMode(p, this);
}
} }
// Set the difficulty // Set the difficulty
this.getCBWorld().setDifficulty(this.getKnownProperty("diff", Difficulty.class).getValue()); this.getCBWorld().setDifficulty(this.getKnownProperty("diff", Difficulty.class).getValue());
} }
@ -420,6 +433,7 @@ public class MVWorld implements MultiverseWorld {
/** /**
* {@inheritDoc} * {@inheritDoc}
*
* @deprecated Use {@link #getProperty(String, Class)} instead * @deprecated Use {@link #getProperty(String, Class)} instead
*/ */
@Override @Override
@ -443,7 +457,7 @@ public class MVWorld implements MultiverseWorld {
/** /**
* This method should only be used from inside this class when it is KNOWN that the property exists. * This method should only be used from inside this class when it is KNOWN that the property exists.
* *
* @param name The known name of a property * @param name The known name of a property
* @param expected The Type of the expected value * @param expected The Type of the expected value
* @return The property object. * @return The property object.
*/ */
@ -489,12 +503,33 @@ public class MVWorld implements MultiverseWorld {
value = propertyChangeEvent.getNewValue(); value = propertyChangeEvent.getNewValue();
} }
if (property.parseValue(value)) { if (property.parseValue(value)) {
if (property instanceof TempStringConfigProperty) {
return this.setActiveProperty((TempStringConfigProperty) property);
}
this.saveConfig(); this.saveConfig();
return true; return true;
} }
return false; return false;
} }
private boolean setActiveProperty(TempStringConfigProperty property) {
try {
Method method = this.getClass().getMethod(property.getMethod(), String.class);
Object returnVal = method.invoke(this, (String) property.getValue());
if (returnVal instanceof Boolean) {
return (Boolean) returnVal;
} else {
return true;
}
} catch (NoSuchMethodException e) {
return false;
} catch (IllegalAccessException e) {
return false;
} catch (InvocationTargetException e) {
return false;
}
}
/** /**
* {@inheritDoc} * {@inheritDoc}
*/ */
@ -706,6 +741,7 @@ public class MVWorld implements MultiverseWorld {
/** /**
* {@inheritDoc} * {@inheritDoc}
*
* @deprecated This is deprecated. * @deprecated This is deprecated.
*/ */
@Override @Override
@ -1008,6 +1044,73 @@ public class MVWorld implements MultiverseWorld {
return result; return result;
} }
/**
* {@inheritDoc}
*/
@Override
public String getTime() {
long time = this.getCBWorld().getTime();
// I'm tired, so they get time in 24 hour for now.
// Someone else can add 12 hr format if they want :P
int hours = (int) ((time / 1000 + 8) % 24);
int minutes = (int) (60 * (time % 1000) / 1000);
return String.format("%d:%02d", hours, minutes);
}
/**
* {@inheritDoc}
*/
@Override
public boolean setTime(String timeAsString) {
if (staticTimes.containsKey(timeAsString.toLowerCase())) {
return this.setTime(staticTimes.get(timeAsString.toLowerCase()));
}
// Regex that extracts a time in the following formats:
// 11:11pm, 11:11, 23:11, 1111, 1111p, and the aliases at the top of this file.
String timeRegex = "(\\d\\d?):?(\\d\\d)(a|p)?m?";
Pattern pattern = Pattern.compile(timeRegex, Pattern.CASE_INSENSITIVE);
Matcher matcher = pattern.matcher(timeAsString);
matcher.find();
int hour = 0;
double minute = 0;
int count = matcher.groupCount();
if (count >= 2) {
hour = Integer.parseInt(matcher.group(1));
minute = Integer.parseInt(matcher.group(2));
}
// If there were 4 matches (all, hour, min, ampm)
if (count == 4) {
// We want 24 hour time for calcs, but if they
// added a p[m], turn it into a 24 hr one.
if (matcher.group(3).equals("p")) {
hour += 12;
}
}
// Translate 24th hour to 0th hour.
if (hour == 24) {
hour = 0;
}
// Clamp the hour
if (hour > 23 || hour < 0) {
return false;
}
// Clamp the minute
if (minute > 59 || minute < 0) {
return false;
}
// 60 seconds in a minute, time needs to be in hrs * 1000, per
// the bukkit docs.
double totaltime = (hour + (minute / 60.0)) * 1000;
// Somehow there's an 8 hour offset...
totaltime -= 8000;
if (totaltime < 0) {
totaltime = 24000 + totaltime;
}
this.getCBWorld().setTime((long) totaltime);
return true;
}
@Override @Override
public String toString() { public String toString() {
StringBuilder toStringBuilder = new StringBuilder(); StringBuilder toStringBuilder = new StringBuilder();

View File

@ -71,7 +71,6 @@ public class MultiverseCore extends JavaPlugin implements MVPlugin, Core {
// to worlds. // to worlds.
// TODO This is REALLY bad style! We have to change this! // TODO This is REALLY bad style! We have to change this!
public static boolean EnforceAccess; public static boolean EnforceAccess;
public static boolean EnforceGameModes;
public static boolean PrefixChat; public static boolean PrefixChat;
public static boolean DisplayPermErrors; public static boolean DisplayPermErrors;
public static boolean TeleportIntercept; public static boolean TeleportIntercept;
@ -360,7 +359,6 @@ public class MultiverseCore extends JavaPlugin implements MVPlugin, Core {
GlobalDebug = this.multiverseConfig.getInt("debug", 0); GlobalDebug = this.multiverseConfig.getInt("debug", 0);
// Lets cache these values due to the fact that they will be accessed many times. // Lets cache these values due to the fact that they will be accessed many times.
EnforceAccess = this.multiverseConfig.getBoolean("enforceaccess", false); EnforceAccess = this.multiverseConfig.getBoolean("enforceaccess", false);
EnforceGameModes = this.multiverseConfig.getBoolean("enforcegamemodes", true);
PrefixChat = this.multiverseConfig.getBoolean("worldnameprefix", true); PrefixChat = this.multiverseConfig.getBoolean("worldnameprefix", true);
// Should MV Intercept teleports by other plugins? // Should MV Intercept teleports by other plugins?
TeleportIntercept = this.multiverseConfig.getBoolean("teleportintercept", true); TeleportIntercept = this.multiverseConfig.getBoolean("teleportintercept", true);
@ -370,6 +368,14 @@ public class MultiverseCore extends JavaPlugin implements MVPlugin, Core {
DisplayPermErrors = this.multiverseConfig.getBoolean("displaypermerrors", true); DisplayPermErrors = this.multiverseConfig.getBoolean("displaypermerrors", true);
this.messaging.setCooldown(this.multiverseConfig.getInt("messagecooldown", 5000)); this.messaging.setCooldown(this.multiverseConfig.getInt("messagecooldown", 5000));
// Update the version of the config!
this.multiverseConfig.set("version", coreDefaults.get("version"));
// Remove old values.
this.multiverseConfig.set("enforcegamemodes", null);
this.multiverseConfig.set("bedrespawn", null);
this.multiverseConfig.set("opfallback", null);
this.saveMVConfigs(); this.saveMVConfigs();
} }

View File

@ -533,4 +533,23 @@ public interface MultiverseWorld {
* @return All property names, with alternating colors. * @return All property names, with alternating colors.
*/ */
String getAllPropertyNames(); String getAllPropertyNames();
/**
* Sets the current time in a world.
*
* This method will take the following formats:
* 11:37am
* 4:30p
* day(morning), night, noon, midnight
*
* @param timeAsString The formatted time to set the world to.
* @return True if the time was set, false if not.
*/
boolean setTime(String timeAsString);
/**
* Same as {@link #getTime()}, but returns a string.
* @return The time as a short string: 12:34pm
*/
String getTime();
} }

View File

@ -109,11 +109,7 @@ public class InfoCommand extends MultiverseCommand {
message.add(new FancyHeader("General Info", colors)); message.add(new FancyHeader("General Info", colors));
message.add(new FancyMessage("World Name: ", world.getName(), colors)); message.add(new FancyMessage("World Name: ", world.getName(), colors));
message.add(new FancyMessage("World Alias: ", world.getColoredWorldString(), colors)); message.add(new FancyMessage("World Alias: ", world.getColoredWorldString(), colors));
String enforced = ""; message.add(new FancyMessage("Game Mode: ", world.getGameMode().toString(), colors));
if (!MultiverseCore.EnforceGameModes) {
enforced = ChatColor.RED + " Not Enforced!";
}
message.add(new FancyMessage("Game Mode: ", world.getGameMode() + enforced, colors));
//message.add(new FancyMessage("Game Mode: ", StringUtils.capitalize(world.getGameMode().toString()), colors)); //message.add(new FancyMessage("Game Mode: ", StringUtils.capitalize(world.getGameMode().toString()), colors));
Location spawn = world.getSpawnLocation(); Location spawn = world.getSpawnLocation();
message.add(new FancyMessage("Spawn Location: ", LocationManipulation.strCoords(spawn), colors)); message.add(new FancyMessage("Spawn Location: ", LocationManipulation.strCoords(spawn), colors));

View File

@ -58,7 +58,6 @@ public class VersionCommand extends MultiverseCommand {
buffer.append("[Multiverse-Core] teleportcooldown: ").append("Not yet IMPLEMENTED").append('\n'); buffer.append("[Multiverse-Core] teleportcooldown: ").append("Not yet IMPLEMENTED").append('\n');
buffer.append("[Multiverse-Core] worldnameprefix: ").append(MultiverseCore.PrefixChat).append('\n'); buffer.append("[Multiverse-Core] worldnameprefix: ").append(MultiverseCore.PrefixChat).append('\n');
buffer.append("[Multiverse-Core] enforceaccess: ").append(MultiverseCore.EnforceAccess).append('\n'); buffer.append("[Multiverse-Core] enforceaccess: ").append(MultiverseCore.EnforceAccess).append('\n');
buffer.append("[Multiverse-Core] enforcegamemodes: ").append(MultiverseCore.EnforceGameModes).append('\n');
buffer.append("[Multiverse-Core] displaypermerrors: ").append(MultiverseCore.DisplayPermErrors).append('\n'); buffer.append("[Multiverse-Core] displaypermerrors: ").append(MultiverseCore.DisplayPermErrors).append('\n');
buffer.append("[Multiverse-Core] teleportintercept: ").append(MultiverseCore.TeleportIntercept).append('\n'); buffer.append("[Multiverse-Core] teleportintercept: ").append(MultiverseCore.TeleportIntercept).append('\n');
buffer.append("[Multiverse-Core] firstspawnoverride: ").append(MultiverseCore.FirstSpawnOverride).append('\n'); buffer.append("[Multiverse-Core] firstspawnoverride: ").append(MultiverseCore.FirstSpawnOverride).append('\n');

View File

@ -228,4 +228,20 @@ public class ConfigPropertyFactory {
public LocationConfigProperty getNewProperty(String name, Location defaultValue, String node, String help) { public LocationConfigProperty getNewProperty(String name, Location defaultValue, String node, String help) {
return new LocationConfigProperty(this.section, name, defaultValue, node, help); return new LocationConfigProperty(this.section, name, defaultValue, node, help);
} }
/**
* Constructs a new TempStringConfigProperty
*
* The boolean is a dummy. This is so I can differentiate from the non-temp one.
*
* @param name The name of this ConifgProperty
* @param defaultValue The default value.
* @param help What string is shown for help.
* @param method The method that should be executed.
* @param b Dummy.
* @return The TempStringConfigProperty
*/
public TempStringConfigProperty getNewProperty(String name, String defaultValue, String help, String method, boolean b) {
return new TempStringConfigProperty(name, defaultValue, help, method);
}
} }

View File

@ -0,0 +1,77 @@
/******************************************************************************
* Multiverse 2 Copyright (c) the Multiverse Team 2012. *
* Multiverse 2 is licensed under the BSD License. *
* For more information please check the README.md file included *
* with this project. *
******************************************************************************/
package com.onarandombox.MultiverseCore.configuration;
/**
* A {@link String} config-property that will NOT be saved to the config.
*/
public class TempStringConfigProperty implements MVConfigProperty<String> {
private String name;
private String value;
private String method;
private String help;
public TempStringConfigProperty(String name, String defaultValue, String help) {
this.name = name;
this.help = help;
this.value = defaultValue;
this.parseValue(defaultValue);
}
public TempStringConfigProperty(String name, String defaultValue, String help, String method) {
this(name, defaultValue, help);
this.method = method;
}
@Override
public String getName() {
return this.name;
}
@Override
public String getValue() {
return this.value;
}
public String getMethod() {
return this.method;
}
@Override
public boolean parseValue(String value) {
if (value == null) {
return false;
}
this.setValue(value);
return true;
}
@Override
public String getConfigNode() {
return "";
}
@Override
public String toString() {
return value;
}
@Override
public String getHelp() {
return this.help;
}
@Override
public boolean setValue(String value) {
if (value == null) {
return false;
}
this.value = value;
return true;
}
}

View File

@ -23,10 +23,6 @@ public enum ConfigProperty {
* Prefix chat-messages with world-names. * Prefix chat-messages with world-names.
*/ */
worldnameprefix, worldnameprefix,
/**
* If value is set to false, Multiverse will NOT enforce world-gamemodes.
*/
enforcegamemodes,
/** /**
* If value is set to false, Multiverse will NOT enforce world access permissions. * If value is set to false, Multiverse will NOT enforce world access permissions.
*/ */

View File

@ -122,19 +122,13 @@ public class MVPlayerListener extends PlayerListener {
this.plugin.log(Level.FINE, "Player joined AGAIN!"); this.plugin.log(Level.FINE, "Player joined AGAIN!");
} }
// Handle the Players GameMode setting for the new world. // Handle the Players GameMode setting for the new world.
if (MultiverseCore.EnforceGameModes) { this.handleGameMode(event.getPlayer(), event.getPlayer().getWorld());
this.handleGameMode(event.getPlayer(), event.getPlayer().getWorld());
}
} }
@Override @Override
public void onPlayerChangedWorld(PlayerChangedWorldEvent event) { public void onPlayerChangedWorld(PlayerChangedWorldEvent event) {
// Handle the Players GameMode setting for the new world. // Permissions now determine whether or not to handle a gamemode.
if (MultiverseCore.EnforceGameModes) { this.handleGameMode(event.getPlayer(), event.getPlayer().getWorld());
// Not yet implemented, but eventually we'll switch to this!
//if (this.plugin.getMVWorldManager().getMVWorld(event.getPlayer().getWorld()).getEnforceGameMode())
this.handleGameMode(event.getPlayer(), event.getPlayer().getWorld());
}
} }
@Override @Override
@ -232,6 +226,7 @@ public class MVPlayerListener extends PlayerListener {
} }
}, 1L); }, 1L);
} }
// FOLLOWING 2 Methods and Private class handle Per Player GameModes. // FOLLOWING 2 Methods and Private class handle Per Player GameModes.
private void handleGameMode(Player player, World world) { private void handleGameMode(Player player, World world) {

View File

@ -43,11 +43,6 @@ public class MVPermissions implements PermissionsInterface {
* @return True if they should bypass restrictions. * @return True if they should bypass restrictions.
*/ */
public boolean canIgnoreGameModeRestriction(Player p, MultiverseWorld w) { public boolean canIgnoreGameModeRestriction(Player p, MultiverseWorld w) {
// If we're not enforcing gamemodes, won't change for anyone.
if (!MultiverseCore.EnforceGameModes) {
this.plugin.log(Level.FINER, "Enforce gamemodes is OFF, all players roam freely!");
return true;
}
if (p.hasPermission("mv.bypass.gamemode.*")) { if (p.hasPermission("mv.bypass.gamemode.*")) {
this.plugin.log(Level.FINER, "Player has mv.bypass.gamemode.* their gamemode is ignored!"); this.plugin.log(Level.FINER, "Player has mv.bypass.gamemode.* their gamemode is ignored!");
return true; return true;

View File

@ -1,15 +1,14 @@
# This is the MV2 Config. If you mess it up, copy the values out # This is the MV2 Config. If you mess it up, copy the values out
# Delete it, and it will be regenerated. Then use the ingame interface # delete it, and it will be regenerated. Then use the ingame interface
# to add your values back. # to add your values back via the "/mv conf" command.
# When in-game, simply type: "/mv conf ?" for help.
# A config with explanations can be found here: # A config with explanations can be found here:
# https://github.com/Multiverse/Multiverse-Core/wiki/config.yml # https://github.com/Multiverse/Multiverse-Core/wiki/config.yml
worldnameprefix: true worldnameprefix: true
enforceaccess: true enforceaccess: true
enforcegamemodes: true
bedrespawn: true
version: 2.6
displaypermerrors: true displaypermerrors: true
teleportintercept: true teleportintercept: true
firstspawnoverride: true firstspawnoverride: true
messagecooldown: 5000 messagecooldown: 5000
version: 2.7