- * Currently INCOMPLETE */ public interface MultiverseWorld { @@ -146,6 +145,18 @@ public interface MultiverseWorld { */ String getName(); + /** + * Gets the lowercased name of the world. This method is required, since the permissables + * lowercase all permissions when recalculating. + *
+ * Note: This also means if a user has worlds named: world and WORLD, that they can both + * exist, and both be teleported to independently, but their permissions **cannot** be + * uniqueified at this time. See bug report #. + * + * @return The lowercased name of the world. + */ + String getPermissibleName(); + /** * Gets the alias of this world. *
@@ -536,7 +547,7 @@ public interface MultiverseWorld { /** * Sets the current time in a world. - * + *
* This method will take the following formats: * 11:37am * 4:30p @@ -552,4 +563,14 @@ public interface MultiverseWorld { * @return The time as a short string: 12:34pm */ String getTime(); + + /** + * Gets the type of this world. As of 1.1-R1 this will be: + * FLAT or NORMAL + *
+ * This is *not* the generator.
+ *
+ * @return The Type of this world.
+ */
+ WorldType getWorldType();
}
diff --git a/src/main/java/com/onarandombox/MultiverseCore/commands/CreateCommand.java b/src/main/java/com/onarandombox/MultiverseCore/commands/CreateCommand.java
index e6613c17..ffc3533d 100644
--- a/src/main/java/com/onarandombox/MultiverseCore/commands/CreateCommand.java
+++ b/src/main/java/com/onarandombox/MultiverseCore/commands/CreateCommand.java
@@ -12,6 +12,7 @@ import com.onarandombox.MultiverseCore.api.MVWorldManager;
import com.pneumaticraft.commandhandler.CommandHandler;
import org.bukkit.ChatColor;
import org.bukkit.World.Environment;
+import org.bukkit.WorldType;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.permissions.PermissionDefault;
@@ -28,8 +29,8 @@ public class CreateCommand extends MultiverseCommand {
public CreateCommand(MultiverseCore plugin) {
super(plugin);
this.setName("Create World");
- this.setCommandUsage("/mv create" + ChatColor.GREEN + " {NAME} {ENV}" + ChatColor.GOLD + " -s [SEED] -g [GENERATOR[:ID]] [-n]");
- this.setArgRange(2, 7); // SUPPRESS CHECKSTYLE: MagicNumberCheck
+ this.setCommandUsage("/mv create" + ChatColor.GREEN + " {NAME} {ENV}" + ChatColor.GOLD + " -s [SEED] -g [GENERATOR[:ID]] -t [WORLDTYPE] [-n]");
+ this.setArgRange(2, 9); // SUPPRESS CHECKSTYLE: MagicNumberCheck
this.addKey("mvcreate");
this.addKey("mvc");
this.addKey("mv create");
@@ -37,6 +38,7 @@ public class CreateCommand extends MultiverseCommand {
this.addCommandExample("/mv create " + ChatColor.GOLD + "world" + ChatColor.GREEN + " normal");
this.addCommandExample("/mv create " + ChatColor.GOLD + "lavaland" + ChatColor.RED + " nether");
this.addCommandExample("/mv create " + ChatColor.GOLD + "starwars" + ChatColor.AQUA + " end");
+ this.addCommandExample("/mv create " + ChatColor.GOLD + "flatroom" + ChatColor.GREEN + " normal" + ChatColor.AQUA + " -t flat");
this.addCommandExample("/mv create " + ChatColor.GOLD + "gargamel" + ChatColor.GREEN + " normal" + ChatColor.DARK_AQUA + " -s gargamel");
this.addCommandExample("/mv create " + ChatColor.GOLD + "moonworld" + ChatColor.GREEN + " normal" + ChatColor.DARK_AQUA + " -g BukkitFullOfMoon");
this.worldManager = this.plugin.getMVWorldManager();
@@ -49,6 +51,7 @@ public class CreateCommand extends MultiverseCommand {
String env = args.get(1);
String seed = CommandHandler.getFlag("-s", args);
String generator = CommandHandler.getFlag("-g", args);
+ String typeString = CommandHandler.getFlag("-t", args);
boolean useSpawnAdjust = true;
for (String s : args) {
if (s.equalsIgnoreCase("-n")) {
@@ -61,16 +64,27 @@ public class CreateCommand extends MultiverseCommand {
return;
}
- Environment environment = this.plugin.getEnvFromString(env);
+ Environment environment = EnvironmentCommand.getEnvFromString(env);
if (environment == null) {
sender.sendMessage(ChatColor.RED + "That is not a valid environment.");
EnvironmentCommand.showEnvironments(sender);
return;
}
+ // If they didn't specify a type, default to NORMAL
+ if (typeString == null) {
+ typeString = "NORMAL";
+ }
+ WorldType type = EnvironmentCommand.getWorldTypeFromString(typeString);
+ if (type == null) {
+ sender.sendMessage(ChatColor.RED + "That is not a valid World Type.");
+ EnvironmentCommand.showWorldTypes(sender);
+ return;
+ }
+
Command.broadcastCommandMessage(sender, "Starting creation of world '" + worldName + "'...");
- if (this.worldManager.addWorld(worldName, environment, seed, generator, useSpawnAdjust)) {
+ if (this.worldManager.addWorld(worldName, environment, seed, type, generator, useSpawnAdjust)) {
Command.broadcastCommandMessage(sender, "Complete!");
} else {
Command.broadcastCommandMessage(sender, "FAILED.");
diff --git a/src/main/java/com/onarandombox/MultiverseCore/commands/EnvironmentCommand.java b/src/main/java/com/onarandombox/MultiverseCore/commands/EnvironmentCommand.java
index 5612340c..4531b39e 100644
--- a/src/main/java/com/onarandombox/MultiverseCore/commands/EnvironmentCommand.java
+++ b/src/main/java/com/onarandombox/MultiverseCore/commands/EnvironmentCommand.java
@@ -9,6 +9,8 @@ package com.onarandombox.MultiverseCore.commands;
import com.onarandombox.MultiverseCore.MultiverseCore;
import org.bukkit.ChatColor;
+import org.bukkit.World;
+import org.bukkit.WorldType;
import org.bukkit.command.CommandSender;
import org.bukkit.permissions.PermissionDefault;
@@ -26,10 +28,11 @@ public class EnvironmentCommand extends MultiverseCommand {
this.setArgRange(0, 0);
this.addKey("mvenv");
this.addKey("mv env");
+ this.addKey("mv type");
this.addKey("mv environment");
this.addKey("mv environments");
this.addCommandExample("/mv env");
- this.setPermission("multiverse.core.list.environments", "Lists valid known environments.", PermissionDefault.OP);
+ this.setPermission("multiverse.core.list.environments", "Lists valid known environments/world types.", PermissionDefault.OP);
}
/**
@@ -43,9 +46,67 @@ public class EnvironmentCommand extends MultiverseCommand {
sender.sendMessage(ChatColor.RED + "NETHER");
sender.sendMessage(ChatColor.AQUA + "END");
}
+ /**
+ * Shows all valid known world types to a {@link CommandSender}.
+ *
+ * @param sender The {@link CommandSender}.
+ */
+ public static void showWorldTypes(CommandSender sender) {
+ sender.sendMessage(ChatColor.YELLOW + "Valid World Types are:");
+ sender.sendMessage(String.format("%sNORMAL %sor %sFLAT",
+ ChatColor.GREEN, ChatColor.WHITE, ChatColor.AQUA));
+ }
@Override
public void runCommand(CommandSender sender, List
- * Used to double-monitor {@link Type#PLAYER_PORTAL}.
- */
-public class MVPortalAdjustListener extends PlayerListener {
-
- private MultiverseCore plugin;
-
- public MVPortalAdjustListener(MultiverseCore core) {
- this.plugin = core;
- }
-
- @Override
- public void onPlayerPortal(PlayerPortalEvent event) {
- this.plugin.log(Level.FINE, "CALLING CORE-ADJUST!!!");
- if (event.isCancelled() || event.getFrom() == null) {
- return;
- }
-
- // REMEMBER! getTo MAY be NULL HERE!!!
- // If the player was actually outside of the portal, adjust the from location
- if (event.getFrom().getWorld().getBlockAt(event.getFrom()).getType() != Material.PORTAL) {
- Location newloc = SafeTTeleporter.findPortalBlockNextTo(event.getFrom());
- // TODO: Fix this. Currently, we only check for PORTAL blocks. I'll have to figure out what
- // TODO: we want to do here.
- if (newloc != null) {
- event.setFrom(newloc);
- }
- }
- // Wait for the adjust, then return!
- if (event.getTo() == null) {
- return;
- }
- }
-}
diff --git a/src/main/java/com/onarandombox/MultiverseCore/listeners/MVWeatherListener.java b/src/main/java/com/onarandombox/MultiverseCore/listeners/MVWeatherListener.java
index d6a0ad81..358803e1 100644
--- a/src/main/java/com/onarandombox/MultiverseCore/listeners/MVWeatherListener.java
+++ b/src/main/java/com/onarandombox/MultiverseCore/listeners/MVWeatherListener.java
@@ -9,22 +9,30 @@ package com.onarandombox.MultiverseCore.listeners;
import com.onarandombox.MultiverseCore.MultiverseCore;
import com.onarandombox.MultiverseCore.api.MultiverseWorld;
+import org.bukkit.event.EventHandler;
+import org.bukkit.event.Listener;
import org.bukkit.event.weather.ThunderChangeEvent;
import org.bukkit.event.weather.WeatherChangeEvent;
-import org.bukkit.event.weather.WeatherListener;
/**
- * Multiverse's {@link WeatherListener}.
+ * Multiverse's Weather {@link Listener}.
*/
-public class MVWeatherListener extends WeatherListener {
+public class MVWeatherListener implements Listener {
private MultiverseCore plugin;
public MVWeatherListener(MultiverseCore plugin) {
this.plugin = plugin;
}
- @Override
- public void onWeatherChange(WeatherChangeEvent event) {
+ /**
+ * This method is called when the weather changes.
+ * @param event The Event that was fired.
+ */
+ @EventHandler
+ public void weatherChange(WeatherChangeEvent event) {
+ if (event.isCancelled()) {
+ return;
+ }
MultiverseWorld world = this.plugin.getMVWorldManager().getMVWorld(event.getWorld().getName());
if (world != null) {
// If it's going to start raining and we have weather disabled
@@ -32,8 +40,15 @@ public class MVWeatherListener extends WeatherListener {
}
}
- @Override
- public void onThunderChange(ThunderChangeEvent event) {
+ /**
+ * This method is called when a big storm is going to start.
+ * @param event The Event that was fired.
+ */
+ @EventHandler
+ public void thunderChange(ThunderChangeEvent event) {
+ if (event.isCancelled()) {
+ return;
+ }
MultiverseWorld world = this.plugin.getMVWorldManager().getMVWorld(event.getWorld().getName());
if (world != null) {
// If it's going to start raining and we have weather disabled
diff --git a/src/main/java/com/onarandombox/MultiverseCore/listeners/MultiverseCoreListener.java b/src/main/java/com/onarandombox/MultiverseCore/listeners/MultiverseCoreListener.java
index e81e9539..fa1adf67 100644
--- a/src/main/java/com/onarandombox/MultiverseCore/listeners/MultiverseCoreListener.java
+++ b/src/main/java/com/onarandombox/MultiverseCore/listeners/MultiverseCoreListener.java
@@ -7,9 +7,6 @@
package com.onarandombox.MultiverseCore.listeners;
-import org.bukkit.event.CustomEventListener;
-import org.bukkit.event.Event;
-
import com.onarandombox.MultiverseCore.event.MVConfigReloadEvent;
import com.onarandombox.MultiverseCore.event.MVPlayerTouchedPortalEvent;
import com.onarandombox.MultiverseCore.event.MVRespawnEvent;
@@ -17,80 +14,66 @@ import com.onarandombox.MultiverseCore.event.MVTeleportEvent;
import com.onarandombox.MultiverseCore.event.MVVersionEvent;
import com.onarandombox.MultiverseCore.event.MVWorldDeleteEvent;
import com.onarandombox.MultiverseCore.event.MVWorldPropertyChangeEvent;
+import org.bukkit.event.EventHandler;
+import org.bukkit.event.Listener;
/**
* Subclasses of this listener can be used to conveniently listen to MultiverseCore-events.
*/
-public abstract class MultiverseCoreListener extends CustomEventListener {
- /**
- * {@inheritDoc}
- */
- @Override
- public final void onCustomEvent(Event event) {
- if (event.getEventName().equals("MVConfigReload") && event instanceof MVConfigReloadEvent) {
- onMVConfigReload((MVConfigReloadEvent) event);
- } else if (event.getEventName().equals("MVPlayerTouchedPortalEvent") && event instanceof MVPlayerTouchedPortalEvent) {
- onPlayerTouchedPortal((MVPlayerTouchedPortalEvent) event);
- } else if (event.getEventName().equals("MVRespawn") && event instanceof MVRespawnEvent) {
- onPlayerRespawn((MVRespawnEvent) event);
- } else if (event.getEventName().equals("SafeTTeleporter") && event instanceof MVTeleportEvent) {
- onPlayerTeleport((MVTeleportEvent) event);
- } else if (event.getEventName().equals("MVVersionEvent") && event instanceof MVVersionEvent) {
- onVersionRequest((MVVersionEvent) event);
- } else if (event.getEventName().equals("MVWorldDeleteEvent") && event instanceof MVWorldDeleteEvent) {
- onWorldDelete((MVWorldDeleteEvent) event);
- } else if (event.getEventName().equals("MVWorldPropertyChange") && event instanceof MVWorldPropertyChangeEvent) {
- onWorldPropertyChange((MVWorldPropertyChangeEvent) event);
- }
- }
-
+public abstract class MultiverseCoreListener implements Listener {
/**
* Called when a {@link MVWorldPropertyChangeEvent} is fired.
* @param event The event.
*/
- public void onWorldPropertyChange(MVWorldPropertyChangeEvent event) {
+ @EventHandler
+ public void worldPropertyChange(MVWorldPropertyChangeEvent event) {
}
/**
* Called when a {@link MVWorldDeleteEvent} is fired.
* @param event The event.
*/
- public void onWorldDelete(MVWorldDeleteEvent event) {
+ @EventHandler
+ public void worldDelete(MVWorldDeleteEvent event) {
}
/**
* Called when a {@link MVVersionEvent} is fired.
* @param event The event.
*/
- public void onVersionRequest(MVVersionEvent event) {
+ @EventHandler
+ public void versionRequest(MVVersionEvent event) {
}
/**
* Called when a {@link MVTeleportEvent} is fired.
* @param event The event.
*/
- public void onPlayerTeleport(MVTeleportEvent event) {
+ @EventHandler
+ public void playerTeleport(MVTeleportEvent event) {
}
/**
* Called when a {@link MVRespawnEvent} is fired.
* @param event The event.
*/
- public void onPlayerRespawn(MVRespawnEvent event) {
+ @EventHandler
+ public void playerRespawn(MVRespawnEvent event) {
}
/**
* Called when a {@link MVPlayerTouchedPortalEvent} is fired.
* @param event The event.
*/
- public void onPlayerTouchedPortal(MVPlayerTouchedPortalEvent event) {
+ @EventHandler
+ public void playerTouchedPortal(MVPlayerTouchedPortalEvent event) {
}
/**
* Called when a {@link MVConfigReloadEvent} is fired.
* @param event The event.
*/
- public void onMVConfigReload(MVConfigReloadEvent event) {
+ @EventHandler
+ public void configReload(MVConfigReloadEvent event) {
}
-
}
diff --git a/src/main/java/com/onarandombox/MultiverseCore/utils/LocationManipulation.java b/src/main/java/com/onarandombox/MultiverseCore/utils/LocationManipulation.java
index 132ff259..0c605309 100644
--- a/src/main/java/com/onarandombox/MultiverseCore/utils/LocationManipulation.java
+++ b/src/main/java/com/onarandombox/MultiverseCore/utils/LocationManipulation.java
@@ -17,6 +17,7 @@ import org.bukkit.util.Vector;
import java.text.DecimalFormat;
import java.util.Collections;
import java.util.HashMap;
+import java.util.Locale;
import java.util.Map;
/**
@@ -57,7 +58,10 @@ public class LocationManipulation {
if (location == null) {
return "";
}
- return String.format("%s:%.2f,%.2f,%.2f:%.2f:%.2f", location.getWorld().getName(),
+ // We set the locale to ENGLISH here so we always save with the format:
+ // world:1.2,5.4,3.6:1.8:21.3
+ // Otherwise we blow up when parsing!
+ return String.format(Locale.ENGLISH, "%s:%.2f,%.2f,%.2f:%.2f:%.2f", location.getWorld().getName(),
location.getX(), location.getY(), location.getZ(), location.getYaw(), location.getPitch());
}
diff --git a/src/main/java/com/onarandombox/MultiverseCore/utils/PermissionTools.java b/src/main/java/com/onarandombox/MultiverseCore/utils/PermissionTools.java
index 5c5712c9..2be0c287 100644
--- a/src/main/java/com/onarandombox/MultiverseCore/utils/PermissionTools.java
+++ b/src/main/java/com/onarandombox/MultiverseCore/utils/PermissionTools.java
@@ -128,7 +128,7 @@ public class PermissionTools {
// If the toWorld isn't controlled by MV,
// We don't care.
- if(toWorld == null) {
+ if (toWorld == null) {
return true;
}
@@ -148,7 +148,7 @@ public class PermissionTools {
if (!bank.hasEnough(teleporterPlayer, toWorld.getPrice(), toWorld.getCurrency(), errString)) {
return false;
} else if (pay) {
- bank.pay(teleporterPlayer, toWorld.getPrice(), toWorld.getCurrency());
+ bank.give(teleporterPlayer, toWorld.getPrice(), toWorld.getCurrency());
}
}
return true;
diff --git a/src/main/java/com/onarandombox/MultiverseCore/utils/WorldManager.java b/src/main/java/com/onarandombox/MultiverseCore/utils/WorldManager.java
index 71390cd8..b8bc41fb 100644
--- a/src/main/java/com/onarandombox/MultiverseCore/utils/WorldManager.java
+++ b/src/main/java/com/onarandombox/MultiverseCore/utils/WorldManager.java
@@ -11,10 +11,12 @@ import com.onarandombox.MultiverseCore.MVWorld;
import com.onarandombox.MultiverseCore.MultiverseCore;
import com.onarandombox.MultiverseCore.api.MVWorldManager;
import com.onarandombox.MultiverseCore.api.MultiverseWorld;
+import com.onarandombox.MultiverseCore.commands.EnvironmentCommand;
import com.onarandombox.MultiverseCore.event.MVWorldDeleteEvent;
import org.bukkit.World;
import org.bukkit.World.Environment;
import org.bukkit.WorldCreator;
+import org.bukkit.WorldType;
import org.bukkit.configuration.file.FileConfiguration;
import org.bukkit.configuration.file.YamlConfiguration;
import org.bukkit.entity.Player;
@@ -80,16 +82,16 @@ public class WorldManager implements MVWorldManager {
* {@inheritDoc}
*/
@Override
- public boolean addWorld(String name, Environment env, String seedString, String generator) {
- return this.addWorld(name, env, seedString, generator, true);
+ public boolean addWorld(String name, Environment env, String seedString, WorldType type, String generator) {
+ return this.addWorld(name, env, seedString, type, generator, true);
}
/**
* {@inheritDoc}
*/
@Override
- public boolean addWorld(String name, Environment env, String seedString, String generator, boolean useSpawnAdjust) {
- plugin.log(Level.FINE, "Adding world with: " + name + ", " + env.toString() + ", " + seedString + ", " + generator);
+ public boolean addWorld(String name, Environment env, String seedString, WorldType type, String generator, boolean useSpawnAdjust) {
+ plugin.log(Level.FINE, "Adding world with: " + name + ", " + env.toString() + ", " + seedString + ", " + type.toString() + ", " + generator);
Long seed = null;
WorldCreator c = new WorldCreator(name);
if (seedString != null && seedString.length() > 0) {
@@ -101,27 +103,26 @@ public class WorldManager implements MVWorldManager {
c.seed(seed);
}
-
// TODO: Use the fancy kind with the commandSender
if (generator != null && generator.length() != 0) {
c.generator(generator);
}
c.environment(env);
+ c.type(type);
- World world = null;
+ World world;
+ StringBuilder builder = new StringBuilder();
+ builder.append("Loading World & Settings - '").append(name).append("'");
+ builder.append(" - Env: ").append(env);
+ builder.append(" - Type: ").append(type);
if (seed != null) {
- if (generator != null) {
- this.plugin.log(Level.INFO, "Loading World & Settings - '" + name + "' - " + env + " with seed: " + seed + " & Custom Generator: " + generator);
- } else {
- this.plugin.log(Level.INFO, "Loading World & Settings - '" + name + "' - " + env + " with seed: " + seed);
- }
- } else {
- if (generator != null) {
- this.plugin.log(Level.INFO, "Loading World & Settings - '" + name + "' - " + env + " & Custom Generator: " + generator);
- } else {
- this.plugin.log(Level.INFO, "Loading World & Settings - '" + name + "' - " + env);
- }
+ builder.append(" & seed: ").append(seed);
}
+ if (generator != null) {
+ builder.append(" & generator: ").append(generator);
+ }
+ this.plugin.log(Level.INFO, builder.toString());
+
try {
world = c.createWorld();
} catch (Exception e) {
@@ -275,10 +276,12 @@ public class WorldManager implements MVWorldManager {
if ((worldKeys != null) && (worldKeys.contains(name))) {
// Grab the initial values from the config file.
String environment = this.configWorlds.getString("worlds." + name + ".environment", "NORMAL"); // Grab the Environment as a String.
+ String type = this.configWorlds.getString("worlds." + name + ".type", "NORMAL");
String seedString = this.configWorlds.getString("worlds." + name + ".seed", "");
String generatorString = this.configWorlds.getString("worlds." + name + ".generator");
- addWorld(name, this.plugin.getEnvFromString(environment), seedString, generatorString);
+ addWorld(name, EnvironmentCommand.getEnvFromString(environment), seedString,
+ EnvironmentCommand.getWorldTypeFromString(type), generatorString);
if (this.unloadedWorlds.contains(name)) {
this.unloadedWorlds.remove(name);
}
@@ -464,9 +467,9 @@ public class WorldManager implements MVWorldManager {
String name = w.getName();
if (!worldStrings.contains(name)) {
if (this.defaultGens.containsKey(name)) {
- this.addWorld(name, w.getEnvironment(), w.getSeed() + "", this.defaultGens.get(name));
+ this.addWorld(name, w.getEnvironment(), w.getSeed() + "", w.getWorldType(), this.defaultGens.get(name));
} else {
- this.addWorld(name, w.getEnvironment(), w.getSeed() + "", null);
+ this.addWorld(name, w.getEnvironment(), w.getSeed() + "", w.getWorldType(), null);
}
}
@@ -537,7 +540,8 @@ public class WorldManager implements MVWorldManager {
continue;
}
// Grab the initial values from the config file.
- String environment = this.configWorlds.getString("worlds." + worldKey + ".environment", "NORMAL"); // Grab the Environment as a String.
+ String environment = this.configWorlds.getString("worlds." + worldKey + ".environment", "NORMAL");
+ String type = this.configWorlds.getString("worlds." + worldKey + ".type", "NORMAL");
String seedString = this.configWorlds.getString("worlds." + worldKey + ".seed", null);
if (seedString == null) {
seedString = this.configWorlds.getLong("worlds." + worldKey + ".seed") + "";
@@ -548,7 +552,9 @@ public class WorldManager implements MVWorldManager {
this.plugin.log(Level.WARNING, "Found SKYLANDS world. Not importing automatically, as it won't work atm :(");
continue;
}
- addWorld(worldKey, this.plugin.getEnvFromString(environment), seedString, generatorString);
+ // TODO: UNCOMMENT BEFORE RELEASE
+ addWorld(worldKey, EnvironmentCommand.getEnvFromString(environment), seedString,
+ EnvironmentCommand.getWorldTypeFromString(type), generatorString);
// Increment the world count
count++;
diff --git a/src/test/java/com/onarandombox/MultiverseCore/test/utils/MockBlock.java b/src/test/java/com/onarandombox/MultiverseCore/test/utils/MockBlock.java
index b5d12199..57e6a331 100644
--- a/src/test/java/com/onarandombox/MultiverseCore/test/utils/MockBlock.java
+++ b/src/test/java/com/onarandombox/MultiverseCore/test/utils/MockBlock.java
@@ -12,6 +12,9 @@ import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.World;
import org.bukkit.block.*;
+import org.bukkit.inventory.ItemStack;
+
+import java.util.Collection;
/**
* Multiverse 2
@@ -27,35 +30,31 @@ public class MockBlock implements Block{
}
/**
- * Gets the metadata for this block
- *
- * @return block specific metadata
+ * {@inheritDoc}
*/
@Override
public byte getData() {
return 0;
}
- /** @deprecated use {@link #getRelative(org.bukkit.block.BlockFace face)} */
+ /**
+ * {@inheritDoc}
+ */
@Override
public Block getFace(BlockFace face) {
return null;
}
- /** @deprecated use {@link #getRelative(org.bukkit.block.BlockFace face, int distance)} */
+ /**
+ * {@inheritDoc}
+ */
@Override
public Block getFace(BlockFace face, int distance) {
return null;
}
/**
- * Gets the block at the given offsets
- *
- * @param modX X-coordinate offset
- * @param modY Y-coordinate offset
- * @param modZ Z-coordinate offset
- *
- * @return Block at the given offsets
+ * {@inheritDoc}
*/
@Override
public Block getRelative(int modX, int modY, int modZ) {
@@ -63,15 +62,7 @@ public class MockBlock implements Block{
}
/**
- * Gets the block at the given face
- * The returned object will never be updated, and you are not guaranteed that
- * (for example) a sign is still a sign after you capture its state.
- *
- * @return BlockState with the current state of this block.
+ * {@inheritDoc}
*/
@Override
public BlockState getState() {
- return null; //To change body of implemented methods use File | Settings | File Templates.
+ return null;
}
/**
- * Returns the biome that this block resides in
- *
- * @return Biome type containing this block
+ * {@inheritDoc}
*/
@Override
public Biome getBiome() {
- return null; //To change body of implemented methods use File | Settings | File Templates.
+ return null;
}
/**
- * Returns true if the block is being powered by Redstone.
- *
- * @return True if the block is powered.
+ * {@inheritDoc}
*/
@Override
public boolean isBlockPowered() {
- return false; //To change body of implemented methods use File | Settings | File Templates.
+ return false;
}
/**
- * Returns true if the block is being indirectly powered by Redstone.
- *
- * @return True if the block is indirectly powered.
+ * {@inheritDoc}
*/
@Override
public boolean isBlockIndirectlyPowered() {
- return false; //To change body of implemented methods use File | Settings | File Templates.
+ return false;
}
/**
- * Returns true if the block face is being powered by Redstone.
- *
- * @param face The block face
- *
- * @return True if the block face is powered.
+ * {@inheritDoc}
*/
@Override
public boolean isBlockFacePowered(BlockFace face) {
- return false; //To change body of implemented methods use File | Settings | File Templates.
+ return false;
}
/**
- * Returns true if the block face is being indirectly powered by Redstone.
- *
- * @param face The block face
- *
- * @return True if the block face is indirectly powered.
+ * {@inheritDoc}
*/
@Override
public boolean isBlockFaceIndirectlyPowered(BlockFace face) {
- return false; //To change body of implemented methods use File | Settings | File Templates.
+ return false;
}
/**
- * Returns the redstone power being provided to this block face
- *
- * @param face the face of the block to query or BlockFace.SELF for the block itself
- *
- * @return The power level.
+ * {@inheritDoc}
*/
@Override
public int getBlockPower(BlockFace face) {
- return 0; //To change body of implemented methods use File | Settings | File Templates.
+ return 0;
}
/**
- * Returns the redstone power being provided to this block
- *
- * @return The power level.
+ * {@inheritDoc}
*/
@Override
public int getBlockPower() {
- return 0; //To change body of implemented methods use File | Settings | File Templates.
+ return 0;
}
/**
- * Checks if this block is empty.
- *
- * A block is considered empty when {@link #getType()} returns {@link org.bukkit.Material#AIR}.
- *
- * @return true if this block is empty
+ * {@inheritDoc}
*/
@Override
public boolean isEmpty() {
@@ -361,46 +277,54 @@ public class MockBlock implements Block{
}
/**
- * Checks if this block is liquid.
- *
- * A block is considered liquid when {@link #getType()} returns {@link org.bukkit.Material#WATER}, {@link
- * org.bukkit.Material#STATIONARY_WATER}, {@link org.bukkit.Material#LAVA} or {@link
- * org.bukkit.Material#STATIONARY_LAVA}.
- *
- * @return true if this block is liquid
+ * {@inheritDoc}
*/
@Override
public boolean isLiquid() {
- return false; //To change body of implemented methods use File | Settings | File Templates.
+ return false;
}
/**
- * Gets the temperature of the biome of this block
- *
- * @return Temperature of this block
+ * {@inheritDoc}
*/
@Override
public double getTemperature() {
- return 0; //To change body of implemented methods use File | Settings | File Templates.
+ return 0;
}
/**
- * Gets the humidity of the biome of this block
- *
- * @return Humidity of this block
+ * {@inheritDoc}
*/
@Override
public double getHumidity() {
- return 0; //To change body of implemented methods use File | Settings | File Templates.
+ return 0;
}
/**
- * Returns the reaction of the block when moved by a piston
- *
- * @return reaction
+ * {@inheritDoc}
*/
@Override
public PistonMoveReaction getPistonMoveReaction() {
- return null; //To change body of implemented methods use File | Settings | File Templates.
+ return null;
+ }
+
+ @Override
+ public boolean breakNaturally() {
+ return false;
+ }
+
+ @Override
+ public boolean breakNaturally(ItemStack itemStack) {
+ return false;
+ }
+
+ @Override
+ public Collection
- *
- * This method is equal to getRelative(face, 1)
- *
- * @param face Face of this block to return
- *
- * @return Block at the given face
- *
- * @see #getRelative(org.bukkit.block.BlockFace, int)
+ * {@inheritDoc}
*/
@Override
public Block getRelative(BlockFace face) {
@@ -79,20 +70,7 @@ public class MockBlock implements Block{
}
/**
- * Gets the block at the given distance of the given face
- *
- * For example, the following method places water at 100,102,100; two blocks
- * above 100,100,100.
- *
- * Block block = world.getBlockAt(100,100,100);
- * Block shower = block.getFace(BlockFace.UP, 2);
- * shower.setType(Material.WATER);
- *
- *
- * @param face Face of this block to return
- * @param distance Distance to get the block at
- *
- * @return Block at the given face
+ * {@inheritDoc}
*/
@Override
public Block getRelative(BlockFace face, int distance) {
@@ -100,9 +78,7 @@ public class MockBlock implements Block{
}
/**
- * Gets the type of this block
- *
- * @return block type
+ * {@inheritDoc}
*/
@Override
public Material getType() {
@@ -110,29 +86,33 @@ public class MockBlock implements Block{
}
/**
- * Gets the type-id of this block
- *
- * @return block type-id
+ * {@inheritDoc}
*/
@Override
public int getTypeId() {
- return 0; //To change body of implemented methods use File | Settings | File Templates.
+ return 0;
}
/**
- * Gets the light level between 0-15
- *
- * @return light level
+ * {@inheritDoc}
*/
@Override
public byte getLightLevel() {
- return 0; //To change body of implemented methods use File | Settings | File Templates.
+ return 0;
+ }
+
+ @Override
+ public byte getLightFromSky() {
+ return 0;
+ }
+
+ @Override
+ public byte getLightFromBlocks() {
+ return 0;
}
/**
- * Gets the world which contains this Block
- *
- * @return World containing this block
+ * {@inheritDoc}
*/
@Override
public World getWorld() {
@@ -140,9 +120,7 @@ public class MockBlock implements Block{
}
/**
- * Gets the x-coordinate of this block
- *
- * @return x-coordinate
+ * {@inheritDoc}
*/
@Override
public int getX() {
@@ -150,9 +128,7 @@ public class MockBlock implements Block{
}
/**
- * Gets the y-coordinate of this block
- *
- * @return y-coordinate
+ * {@inheritDoc}
*/
@Override
public int getY() {
@@ -160,9 +136,7 @@ public class MockBlock implements Block{
}
/**
- * Gets the z-coordinate of this block
- *
- * @return z-coordinate
+ * {@inheritDoc}
*/
@Override
public int getZ() {
@@ -170,9 +144,7 @@ public class MockBlock implements Block{
}
/**
- * Gets the Location of the block
- *
- * @return Location of block
+ * {@inheritDoc}
*/
@Override
public Location getLocation() {
@@ -180,34 +152,26 @@ public class MockBlock implements Block{
}
/**
- * Gets the chunk which contains this block
- *
- * @return Containing Chunk
+ * {@inheritDoc}
*/
@Override
public Chunk getChunk() {
- return null; //To change body of implemented methods use File | Settings | File Templates.
+ return null;
}
/**
- * Sets the metadata for this block
- *
- * @param data New block specific metadata
+ * {@inheritDoc}
*/
@Override
public void setData(byte data) {
- //To change body of implemented methods use File | Settings | File Templates.
}
@Override
public void setData(byte data, boolean applyPhyiscs) {
- //To change body of implemented methods use File | Settings | File Templates.
}
/**
- * Sets the type of this block
- *
- * @param type Material to change this block to
+ * {@inheritDoc}
*/
@Override
public void setType(Material type) {
@@ -215,145 +179,97 @@ public class MockBlock implements Block{
}
/**
- * Sets the type-id of this block
- *
- * @param type Type-Id to change this block to
- *
- * @return whether the block was changed
+ * {@inheritDoc}
*/
@Override
public boolean setTypeId(int type) {
- return false; //To change body of implemented methods use File | Settings | File Templates.
+ return false;
}
@Override
public boolean setTypeId(int type, boolean applyPhysics) {
- return false; //To change body of implemented methods use File | Settings | File Templates.
+ return false;
}
@Override
public boolean setTypeIdAndData(int type, byte data, boolean applyPhyiscs) {
- return false; //To change body of implemented methods use File | Settings | File Templates.
+ return false;
}
/**
- * Gets the face relation of this block compared to the given block
- *
- * For example:
- *
- * Block current = world.getBlockAt(100, 100, 100);
- * Block target = world.getBlockAt(100, 101, 100);
- *
- * current.getFace(target) == BlockFace.Up;
- *
- *
- * If the given block is not connected to this block, null may be returned
- *
- * @param block Block to compare against this block
- *
- * @return BlockFace of this block which has the requested block, or null
+ * {@inheritDoc}
*/
@Override
public BlockFace getFace(Block block) {
- return null; //To change body of implemented methods use File | Settings | File Templates.
+ return null;
}
/**
- * Captures the current state of this block. You may then cast that state
- * into any accepted type, such as Furnace or Sign.
- *