mirror of
https://github.com/Multiverse/Multiverse-Core.git
synced 2024-11-22 10:36:06 +01:00
Merge branch 'master' of github.com:Multiverse/Multiverse-Core into config-changes
Conflicts: src/main/java/com/onarandombox/MultiverseCore/MultiverseCore.java src/main/java/com/onarandombox/MultiverseCore/MultiverseCoreConfiguration.java src/main/java/com/onarandombox/MultiverseCore/commands/ConfigCommand.java src/main/java/com/onarandombox/MultiverseCore/utils/MVPermissions.java src/main/resources/defaults/config.yml
This commit is contained in:
commit
a1b07065b2
2
pom.xml
2
pom.xml
@ -180,7 +180,7 @@
|
||||
<dependency>
|
||||
<groupId>org.bukkit</groupId>
|
||||
<artifactId>bukkit</artifactId>
|
||||
<version>1.1-R2</version>
|
||||
<version>1.1-R3</version>
|
||||
<type>jar</type>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
|
@ -255,10 +255,7 @@ public class MultiverseCore extends JavaPlugin implements MVPlugin, Core {
|
||||
this.anchorManager.loadAnchors();
|
||||
|
||||
// Now set the firstspawnworld (after the worlds are loaded):
|
||||
// Default as the server.props world.
|
||||
this.worldManager.setFirstSpawnWorld(config.getFirstSpawnWorld());
|
||||
// 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.
|
||||
try {
|
||||
config.setFirstSpawnWorld(this.worldManager.getFirstSpawnWorld().getName());
|
||||
} catch (NullPointerException e) {
|
||||
@ -359,9 +356,62 @@ public class MultiverseCore extends JavaPlugin implements MVPlugin, Core {
|
||||
this.multiverseConfig.set("bedrespawn", null);
|
||||
this.multiverseConfig.set("opfallback", null);
|
||||
|
||||
// Old Config Format
|
||||
this.migrate22Values();
|
||||
this.saveMVConfigs();
|
||||
}
|
||||
|
||||
/**
|
||||
* Thes are the MV config 2.0-2.2 values,
|
||||
* they should be migrated to the new format.
|
||||
*/
|
||||
private void migrate22Values() {
|
||||
if (this.multiverseConfig.isSet("worldnameprefix")) {
|
||||
this.log(Level.INFO, "Migrating 'worldnameprefix'...");
|
||||
this.config.setPrefixChat(this.multiverseConfig.getBoolean("worldnameprefix"));
|
||||
this.multiverseConfig.set("worldnameprefix", null);
|
||||
}
|
||||
if (this.multiverseConfig.isSet("firstspawnworld")) {
|
||||
this.log(Level.INFO, "Migrating 'firstspawnworld'...");
|
||||
this.config.setFirstSpawnWorld(this.multiverseConfig.getString("firstspawnworld"));
|
||||
this.multiverseConfig.set("firstspawnworld", null);
|
||||
}
|
||||
if (this.multiverseConfig.isSet("enforceaccess")) {
|
||||
this.log(Level.INFO, "Migrating 'enforceaccess'...");
|
||||
this.config.setEnforceAccess(this.multiverseConfig.getBoolean("enforceaccess"));
|
||||
this.multiverseConfig.set("enforceaccess", null);
|
||||
}
|
||||
if (this.multiverseConfig.isSet("displaypermerrors")) {
|
||||
this.log(Level.INFO, "Migrating 'displaypermerrors'...");
|
||||
this.config.setDisplayPermErrors(this.multiverseConfig.getBoolean("displaypermerrors"));
|
||||
this.multiverseConfig.set("displaypermerrors", null);
|
||||
}
|
||||
if (this.multiverseConfig.isSet("teleportintercept")) {
|
||||
this.log(Level.INFO, "Migrating 'teleportintercept'...");
|
||||
this.config.setTeleportIntercept(this.multiverseConfig.getBoolean("teleportintercept"));
|
||||
this.multiverseConfig.set("teleportintercept", null);
|
||||
}
|
||||
if (this.multiverseConfig.isSet("firstspawnoverride")) {
|
||||
this.log(Level.INFO, "Migrating 'firstspawnoverride'...");
|
||||
this.config.setFirstSpawnOverride(this.multiverseConfig.getBoolean("firstspawnoverride"));
|
||||
this.multiverseConfig.set("firstspawnoverride", null);
|
||||
}
|
||||
if (this.multiverseConfig.isSet("messagecooldown")) {
|
||||
this.log(Level.INFO, "Migrating 'messagecooldown'...");
|
||||
this.config.setMessageCooldown(this.multiverseConfig.getInt("messagecooldown"));
|
||||
this.multiverseConfig.set("messagecooldown", null);
|
||||
}
|
||||
if (this.multiverseConfig.isSet("debug")) {
|
||||
this.log(Level.INFO, "Migrating 'debug'...");
|
||||
this.config.setGlobalDebug(this.multiverseConfig.getInt("debug"));
|
||||
this.multiverseConfig.set("debug", null);
|
||||
}
|
||||
if (this.multiverseConfig.isSet("version")) {
|
||||
this.log(Level.INFO, "Migrating 'version'...");
|
||||
this.multiverseConfig.set("version", null);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
|
@ -20,13 +20,13 @@ public class MultiverseCoreConfiguration extends SerializationConfig implements
|
||||
@Property
|
||||
private boolean firstspawnoverride;
|
||||
@Property
|
||||
private boolean displayPermErrors;
|
||||
private boolean displaypermerrors;
|
||||
@Property
|
||||
private int globaldebug;
|
||||
@Property
|
||||
private int messagecooldown;
|
||||
@Property
|
||||
private int version;
|
||||
private double version;
|
||||
@Property
|
||||
private String firstspawnworld;
|
||||
@Property
|
||||
@ -50,10 +50,11 @@ public class MultiverseCoreConfiguration extends SerializationConfig implements
|
||||
prefixChat = true;
|
||||
teleportintercept = true;
|
||||
firstspawnoverride = true;
|
||||
displayPermErrors = true;
|
||||
displaypermerrors = true;
|
||||
globaldebug = 0;
|
||||
messagecooldown = 5000;
|
||||
portalcooldown = 5000;
|
||||
this.version = 2.8;
|
||||
// END CHECKSTYLE-SUPPRESSION: MagicNumberCheck
|
||||
}
|
||||
|
||||
@ -64,7 +65,7 @@ public class MultiverseCoreConfiguration extends SerializationConfig implements
|
||||
*/
|
||||
@Override
|
||||
public boolean getEnforceAccess() {
|
||||
return enforceaccess;
|
||||
return this.enforceaccess;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -80,7 +81,7 @@ public class MultiverseCoreConfiguration extends SerializationConfig implements
|
||||
*/
|
||||
@Override
|
||||
public boolean getPrefixChat() {
|
||||
return prefixChat;
|
||||
return this.prefixChat;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -96,7 +97,7 @@ public class MultiverseCoreConfiguration extends SerializationConfig implements
|
||||
*/
|
||||
@Override
|
||||
public boolean getTeleportIntercept() {
|
||||
return teleportintercept;
|
||||
return this.teleportintercept;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -112,7 +113,7 @@ public class MultiverseCoreConfiguration extends SerializationConfig implements
|
||||
*/
|
||||
@Override
|
||||
public boolean getFirstSpawnOverride() {
|
||||
return firstspawnoverride;
|
||||
return this.firstspawnoverride;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -128,7 +129,7 @@ public class MultiverseCoreConfiguration extends SerializationConfig implements
|
||||
*/
|
||||
@Override
|
||||
public boolean getDisplayPermErrors() {
|
||||
return displayPermErrors;
|
||||
return this.displaypermerrors;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -136,7 +137,7 @@ public class MultiverseCoreConfiguration extends SerializationConfig implements
|
||||
*/
|
||||
@Override
|
||||
public void setDisplayPermErrors(boolean displayPermErrors) {
|
||||
this.displayPermErrors = displayPermErrors;
|
||||
this.displaypermerrors = displayPermErrors;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -144,7 +145,7 @@ public class MultiverseCoreConfiguration extends SerializationConfig implements
|
||||
*/
|
||||
@Override
|
||||
public int getGlobalDebug() {
|
||||
return globaldebug;
|
||||
return this.globaldebug;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -160,7 +161,7 @@ public class MultiverseCoreConfiguration extends SerializationConfig implements
|
||||
*/
|
||||
@Override
|
||||
public int getMessageCooldown() {
|
||||
return messagecooldown;
|
||||
return this.messagecooldown;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -175,8 +176,8 @@ public class MultiverseCoreConfiguration extends SerializationConfig implements
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public int getVersion() {
|
||||
return version;
|
||||
public double getVersion() {
|
||||
return this.version;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -192,7 +193,7 @@ public class MultiverseCoreConfiguration extends SerializationConfig implements
|
||||
*/
|
||||
@Override
|
||||
public String getFirstSpawnWorld() {
|
||||
return firstspawnworld;
|
||||
return this.firstspawnworld;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -208,7 +209,7 @@ public class MultiverseCoreConfiguration extends SerializationConfig implements
|
||||
*/
|
||||
@Override
|
||||
public int getPortalCooldown() {
|
||||
return portalcooldown;
|
||||
return this.portalcooldown;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -48,7 +48,7 @@ public interface MultiverseCoreConfig extends ConfigurationSerializable {
|
||||
* Gets version.
|
||||
* @return version.
|
||||
*/
|
||||
int getVersion();
|
||||
double getVersion();
|
||||
|
||||
/**
|
||||
* Sets messageCooldown.
|
||||
|
@ -99,6 +99,7 @@ public class MVPermissions implements PermissionsInterface {
|
||||
public boolean canEnterWorld(Player p, MultiverseWorld w) {
|
||||
// If we're not enforcing access, anyone can enter.
|
||||
if (!plugin.getMVConfig().getEnforceAccess()) {
|
||||
this.plugin.log(Level.FINEST, "EnforceAccess is OFF. Player was allowed in " + w.getAlias());
|
||||
return true;
|
||||
}
|
||||
return this.hasPermission(p, "multiverse.access." + w.getName(), false);
|
||||
@ -169,9 +170,9 @@ public class MVPermissions implements PermissionsInterface {
|
||||
// plugin reloads, when MV asks the API if a player has a perm, it reports that they do NOT.
|
||||
// For the moment, we're going to check all of this node's parents to see if the user has those. It stops
|
||||
// when if finds a true or there are no more parents. --FF
|
||||
if (!hasPermission) {
|
||||
hasPermission = this.hasAnyParentPermission(sender, node);
|
||||
}
|
||||
// if (!hasPermission) {
|
||||
// hasPermission = this.hasAnyParentPermission(sender, node);
|
||||
// }
|
||||
|
||||
return hasPermission;
|
||||
}
|
||||
@ -179,10 +180,12 @@ public class MVPermissions implements PermissionsInterface {
|
||||
// TODO: Better player checks, most likely not needed, but safer.
|
||||
private boolean checkActualPermission(CommandSender sender, String node) {
|
||||
Player player = (Player) sender;
|
||||
this.plugin.log(Level.FINEST, "Checking to see if player [" + player.getName() + "] has permission [" + node + "]");
|
||||
|
||||
boolean hasPermission = sender.hasPermission(node);
|
||||
if (hasPermission) {
|
||||
this.plugin.log(Level.FINER, "Player [" + player.getName() + "] HAS PERMISSION [" + node + "]!");
|
||||
this.plugin.log(Level.FINEST, "Checking to see if player [" + player.getName() + "] has permission [" + node + "]... YES");
|
||||
} else {
|
||||
this.plugin.log(Level.FINEST, "Checking to see if player [" + player.getName() + "] has permission [" + node + "]... NO");
|
||||
}
|
||||
return hasPermission;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user