Fix /xprate not properly sending "Event started" messages. Fixes #624

This commit is contained in:
GJ 2013-02-04 08:47:54 -05:00
parent 284bab397a
commit 458f7f5f5b
2 changed files with 7 additions and 5 deletions

View File

@ -24,8 +24,6 @@ public class XprateCommand implements CommandExecutor {
return true;
}
boolean xpEventEnabled = mcMMO.p.isXPEventEnabled();
switch (args.length) {
case 1:
if (args[0].equalsIgnoreCase("reset")) {
@ -33,12 +31,12 @@ public class XprateCommand implements CommandExecutor {
return true;
}
if (xpEventEnabled) {
if (mcMMO.p.isXPEventEnabled()) {
for (Player x : mcMMO.p.getServer().getOnlinePlayers()) {
x.sendMessage(LocaleLoader.getString("Commands.xprate.over"));
}
mcMMO.p.setXPEventEnabled(!xpEventEnabled);
mcMMO.p.toggleXpEventEnabled();
Config.getInstance().setExperienceGainsGlobalMultiplier(originalRate);
}
else {
@ -69,7 +67,7 @@ public class XprateCommand implements CommandExecutor {
int newRate = Misc.getInt(args[0]);
Config.getInstance().setExperienceGainsGlobalMultiplier(newRate);
if (xpEventEnabled) {
if (mcMMO.p.isXPEventEnabled()) {
for (Player x : mcMMO.p.getServer().getOnlinePlayers()) {
x.sendMessage(LocaleLoader.getString("Commands.xprate.started.0"));
x.sendMessage(LocaleLoader.getString("Commands.xprate.started.1", newRate));

View File

@ -540,5 +540,9 @@ public class mcMMO extends JavaPlugin {
public void setXPEventEnabled(boolean enabled) {
this.xpEventEnabled = enabled;
}
public void toggleXpEventEnabled() {
xpEventEnabled = !xpEventEnabled;
}
}