Bump version

This commit is contained in:
Jesse Boyd 2016-06-19 15:51:46 +10:00
parent c2f10a7065
commit 3ce225c044
3 changed files with 15 additions and 10 deletions

View File

@ -1,5 +1,6 @@
package com.plotsquared.general.commands; package com.plotsquared.general.commands;
import com.intellectualcrafters.configuration.file.YamlConfiguration;
import com.intellectualcrafters.plot.PS; import com.intellectualcrafters.plot.PS;
import com.intellectualcrafters.plot.commands.CommandCategory; import com.intellectualcrafters.plot.commands.CommandCategory;
import com.intellectualcrafters.plot.commands.MainCommand; import com.intellectualcrafters.plot.commands.MainCommand;
@ -176,25 +177,26 @@ public abstract class Command {
options.put("usage", declaration.usage()); options.put("usage", declaration.usage());
options.put("confirmation", declaration.confirmation()); options.put("confirmation", declaration.confirmation());
boolean set = false; boolean set = false;
YamlConfiguration commands = PS.get() == null ? new YamlConfiguration() : PS.get().commands;
for (Map.Entry<String, Object> entry : options.entrySet()) { for (Map.Entry<String, Object> entry : options.entrySet()) {
String key = this.getFullId() + "." + entry.getKey(); String key = this.getFullId() + "." + entry.getKey();
if (!PS.get().commands.contains(key)) { if (!commands.contains(key)) {
PS.get().commands.set(key, entry.getValue()); commands.set(key, entry.getValue());
set = true; set = true;
} }
} }
if (set) { if (set && PS.get() != null) {
try { try {
PS.get().commands.save(PS.get().commandsFile); commands.save(PS.get().commandsFile);
} catch (IOException e) { } catch (IOException e) {
e.printStackTrace(); e.printStackTrace();
} }
} }
this.aliases = PS.get().commands.getStringList(this.getFullId() + ".aliases"); this.aliases = commands.getStringList(this.getFullId() + ".aliases");
this.description = PS.get().commands.getString(this.getFullId() + ".description"); this.description = commands.getString(this.getFullId() + ".description");
this.usage = PS.get().commands.getString(this.getFullId() + ".usage"); this.usage = commands.getString(this.getFullId() + ".usage");
this.confirmation = PS.get().commands.getBoolean(this.getFullId() + ".confirmation"); this.confirmation = commands.getBoolean(this.getFullId() + ".confirmation");
if (this.parent != null) { if (this.parent != null) {
this.parent.register(this); this.parent.register(this);
} }
@ -432,6 +434,9 @@ public abstract class Command {
} }
public boolean canExecute(PlotPlayer player, boolean message) { public boolean canExecute(PlotPlayer player, boolean message) {
if (player == null) {
return true;
}
if (!this.required.allows(player)) { if (!this.required.allows(player)) {
if (message) { if (message) {
MainUtil.sendMessage(player, this.required == RequiredType.PLAYER ? C.IS_CONSOLE : C.NOT_CONSOLE); MainUtil.sendMessage(player, this.required == RequiredType.PLAYER ? C.IS_CONSOLE : C.NOT_CONSOLE);

View File

@ -19,7 +19,7 @@ ext {
git = Grgit.open(file(".git")) git = Grgit.open(file(".git"))
revision = "-${git.head().abbreviatedId}" revision = "-${git.head().abbreviatedId}"
} }
version = "3.4.1${revision}" version = "3.4.2${revision}"
description = """PlotSquared""" description = """PlotSquared"""
subprojects { subprojects {

View File

@ -7,7 +7,7 @@
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties> </properties>
<artifactId>PlotSquared</artifactId> <artifactId>PlotSquared</artifactId>
<version>3.4.1-SNAPSHOT</version> <version>3.4.2-SNAPSHOT</version>
<name>PlotSquared</name> <name>PlotSquared</name>
<packaging>jar</packaging> <packaging>jar</packaging>
<build> <build>