diff --git a/pom.xml b/pom.xml
index 12779cc6..e1b9a1dd 100644
--- a/pom.xml
+++ b/pom.xml
@@ -198,7 +198,7 @@
me.main__.util
SerializationConfig
- 1.5
+ 1.6
jar
compile
diff --git a/src/main/java/com/onarandombox/MultiverseCore/MVWorld.java b/src/main/java/com/onarandombox/MultiverseCore/MVWorld.java
index 782379b4..cddc4238 100644
--- a/src/main/java/com/onarandombox/MultiverseCore/MVWorld.java
+++ b/src/main/java/com/onarandombox/MultiverseCore/MVWorld.java
@@ -341,7 +341,7 @@ public class MVWorld extends SerializationConfig implements MultiverseWorld {
private String alias;
@Property(serializor = EnumPropertySerializor.class, description = "Sorry, 'color' must be a valid color-name.")
private EnglishChatColor color;
- @Property(description = "Sorry, 'pvp' must either be: true or false.")
+ @Property(description = "Sorry, 'pvp' must either be: true or false.", virtualType = Boolean.class)
private VirtualProperty pvp = new VirtualProperty() {
@Override
public void set(Boolean newValue) {
@@ -359,7 +359,8 @@ public class MVWorld extends SerializationConfig implements MultiverseWorld {
private String respawnWorld;
@Property(validator = AllowWeatherPropertyValidator.class, description = "Sorry, this must either be: true or false.")
private boolean allowWeather;
- @Property(serializor = DifficultyPropertySerializor.class, description = "Difficulty must be set as one of the following: peaceful easy normal hard")
+ @Property(serializor = DifficultyPropertySerializor.class, virtualType = Difficulty.class,
+ description = "Difficulty must be set as one of the following: peaceful easy normal hard")
private VirtualProperty difficulty = new VirtualProperty() {
@Override
public void set(Difficulty newValue) {
@@ -388,7 +389,7 @@ public class MVWorld extends SerializationConfig implements MultiverseWorld {
private GameMode gameMode;
@Property
private boolean keepSpawnLoaded;
- @Property(description = "Sorry, this must either be: true or false.")
+ @Property(description = "Sorry, this must either be: true or false.", virtualType = Boolean.class)
private VirtualProperty keepSpawnInMemory = new VirtualProperty() {
@Override
public void set(Boolean newValue) {
@@ -403,7 +404,7 @@ public class MVWorld extends SerializationConfig implements MultiverseWorld {
};
@Property
private SpawnLocation spawnLocation;
- @Property(validator = SpawnLocationPropertyValidator.class,
+ @Property(validator = SpawnLocationPropertyValidator.class, virtualType = Location.class,
description = "There is no help available for this variable. Go bug Rigby90 about it.")
private VirtualProperty spawn = new VirtualProperty() {
@Override
@@ -429,7 +430,8 @@ public class MVWorld extends SerializationConfig implements MultiverseWorld {
@Property
private List worldBlacklist;
@SuppressWarnings("unused") // it IS used!
- @Property(serializor = TimePropertySerializor.class, description = "Set the time to whatever you want! (Will NOT freeze time)")
+ @Property(serializor = TimePropertySerializor.class, virtualType = Long.class,
+ description = "Set the time to whatever you want! (Will NOT freeze time)")
private VirtualProperty time = new VirtualProperty() {
@Override
public void set(Long newValue) {
diff --git a/src/test/java/com/onarandombox/MultiverseCore/test/TestModifyCommand.java b/src/test/java/com/onarandombox/MultiverseCore/test/TestModifyCommand.java
new file mode 100644
index 00000000..6eff3363
--- /dev/null
+++ b/src/test/java/com/onarandombox/MultiverseCore/test/TestModifyCommand.java
@@ -0,0 +1,61 @@
+package com.onarandombox.MultiverseCore.test;
+
+import static org.junit.Assert.*;
+import static org.mockito.Mockito.*;
+
+import org.bukkit.Server;
+import org.bukkit.World.Environment;
+import org.bukkit.command.Command;
+import org.bukkit.command.CommandSender;
+import org.bukkit.plugin.PluginDescriptionFile;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.powermock.core.classloader.annotations.PrepareForTest;
+import org.powermock.modules.junit4.PowerMockRunner;
+
+import com.onarandombox.MultiverseCore.MultiverseCore;
+import com.onarandombox.MultiverseCore.api.MultiverseWorld;
+import com.onarandombox.MultiverseCore.test.utils.TestInstanceCreator;
+
+
+@RunWith(PowerMockRunner.class)
+@PrepareForTest({ MultiverseCore.class, PluginDescriptionFile.class })
+public class TestModifyCommand {
+ TestInstanceCreator creator;
+ Server mockServer;
+ MultiverseCore core;
+ CommandSender mockCommandSender;
+
+ @Before
+ public void setUp() throws Exception {
+ creator = new TestInstanceCreator();
+ assertTrue(creator.setUp());
+ mockServer = creator.getServer();
+ mockCommandSender = creator.getCommandSender();
+ core = creator.getCore();
+
+ // create world
+ assertTrue(core.getMVWorldManager().addWorld("world", Environment.NORMAL, null, null, null, null));
+ }
+
+ @After
+ public void tearDown() throws Exception {
+ creator.tearDown();
+ }
+
+ @Test
+ public void testSetHidden() {
+ Command cmd = mock(Command.class);
+ when(cmd.getName()).thenReturn("mv");
+
+ MultiverseWorld world = core.getMVWorldManager().getMVWorld("world");
+ assertNotNull(world);
+
+ assertFalse(world.isHidden()); // ensure it's not hidden now
+ assertTrue(core.onCommand(mockCommandSender, cmd, "", // run the command
+ new String[] { "modify", "set", "hidden", "true", "world" }));
+ assertTrue(world.isHidden()); // test if it worked
+ }
+}