mirror of
https://github.com/Multiverse/Multiverse-Core.git
synced 2025-02-16 20:41:59 +01:00
Fix color checking, fix price reporting failure on successful set
This commit is contained in:
parent
c200d43f51
commit
750adcf376
@ -8,7 +8,7 @@
|
||||
package com.onarandombox.MultiverseCore;
|
||||
|
||||
import com.onarandombox.MultiverseCore.api.MultiverseWorld;
|
||||
import com.onarandombox.MultiverseCore.utils.EnglishChatColor;
|
||||
import com.onarandombox.MultiverseCore.enums.EnglishChatColor;
|
||||
import org.bukkit.*;
|
||||
import org.bukkit.World.Environment;
|
||||
import org.bukkit.configuration.ConfigurationSection;
|
||||
@ -347,8 +347,7 @@ public class MVWorld implements MultiverseWorld {
|
||||
return true;
|
||||
}
|
||||
if (name.equalsIgnoreCase("aliascolor") || name.equalsIgnoreCase("color")) {
|
||||
this.setColor(value);
|
||||
return true;
|
||||
return this.setColor(value);
|
||||
}
|
||||
if (name.equalsIgnoreCase("currency") || name.equalsIgnoreCase("curr")) {
|
||||
try {
|
||||
@ -361,6 +360,7 @@ public class MVWorld implements MultiverseWorld {
|
||||
if (name.equalsIgnoreCase("price")) {
|
||||
try {
|
||||
this.setPrice(Double.parseDouble(value));
|
||||
return true;
|
||||
} catch (Exception e) {
|
||||
return false;
|
||||
}
|
||||
@ -533,6 +533,7 @@ public class MVWorld implements MultiverseWorld {
|
||||
if (scaling <= 0) {
|
||||
// Disallow negative or 0 scalings.
|
||||
scaling = 1.0;
|
||||
this.plugin.log(Level.WARNING, "Someone tried to set a scale <= 0, defaulting to 1.");
|
||||
success = false;
|
||||
}
|
||||
this.scaling = scaling;
|
||||
@ -554,7 +555,6 @@ public class MVWorld implements MultiverseWorld {
|
||||
}
|
||||
|
||||
public boolean isValidAliasColor(String aliasColor) {
|
||||
System.out.print("Checking color... " + aliasColor);
|
||||
return (EnglishChatColor.fromString(aliasColor) != null);
|
||||
}
|
||||
|
||||
|
@ -10,6 +10,7 @@ package com.onarandombox.MultiverseCore.commands;
|
||||
import com.onarandombox.MultiverseCore.MultiverseCore;
|
||||
import com.onarandombox.MultiverseCore.api.MultiverseWorld;
|
||||
import com.onarandombox.MultiverseCore.enums.Action;
|
||||
import com.onarandombox.MultiverseCore.enums.EnglishChatColor;
|
||||
import com.onarandombox.MultiverseCore.utils.WorldManager;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.command.CommandSender;
|
||||
@ -97,7 +98,8 @@ public class ModifySetCommand extends MultiverseCommand {
|
||||
return;
|
||||
}
|
||||
if ((property.equalsIgnoreCase("aliascolor") || property.equalsIgnoreCase("color")) && !world.isValidAliasColor(value)) {
|
||||
sender.sendMessage(value + " is not a valid color. Please see our Github Wiki for the complete color list.");
|
||||
sender.sendMessage(value + " is not a valid color. Please pick one of the following:");
|
||||
sender.sendMessage(EnglishChatColor.getAllColors());
|
||||
} else if (world.setVariable(property, value)) {
|
||||
sender.sendMessage(ChatColor.GREEN + "Success!" + ChatColor.WHITE + " Property " + ChatColor.AQUA + property + ChatColor.WHITE + " was set to " + ChatColor.GREEN + value);
|
||||
} else {
|
||||
|
@ -5,7 +5,7 @@
|
||||
* with this project. *
|
||||
******************************************************************************/
|
||||
|
||||
package com.onarandombox.MultiverseCore.utils;
|
||||
package com.onarandombox.MultiverseCore.enums;
|
||||
|
||||
import org.bukkit.ChatColor;
|
||||
|
||||
@ -47,6 +47,14 @@ public enum EnglishChatColor {
|
||||
return this.color;
|
||||
}
|
||||
|
||||
public static String getAllColors() {
|
||||
String buffer = "";
|
||||
for (EnglishChatColor c : EnglishChatColor.values()) {
|
||||
buffer += c.getColor() + c.getText() + " ";
|
||||
}
|
||||
return buffer;
|
||||
}
|
||||
|
||||
public static EnglishChatColor fromString(String text) {
|
||||
if (text != null) {
|
||||
for (EnglishChatColor c : EnglishChatColor.values()) {
|
Loading…
Reference in New Issue
Block a user