Fix for method deprecations in R5

This commit is contained in:
Eric Stokes 2012-02-21 05:25:59 -07:00
parent 868ac57a4a
commit fbbe031b2c
10 changed files with 4 additions and 418 deletions

View File

@ -180,7 +180,7 @@
<dependency>
<groupId>org.bukkit</groupId>
<artifactId>bukkit</artifactId>
<version>1.1-R3</version>
<version>1.1-R5-SNAPSHOT</version>
<type>jar</type>
<scope>compile</scope>
</dependency>

View File

@ -1,76 +0,0 @@
/******************************************************************************
* Multiverse 2 Copyright (c) the Multiverse Team 2011. *
* Multiverse 2 is licensed under the BSD License. *
* For more information please check the README.md file included *
* with this project. *
******************************************************************************/
package com.onarandombox.MultiverseCore.configuration;
import com.onarandombox.MultiverseCore.api.LoggablePlugin;
import org.bukkit.plugin.Plugin;
import org.bukkit.util.config.Configuration;
import java.io.File;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.logging.Level;
/*
* This is a mess, so I'm just going to suppress all warnings here.
* BEGIN CHECKSTYLE-SUPPRESSION: ALL
*/
/**
* This will be gone in 2.4.
* @deprecated This isn't used any more, is it? No. No it is not.
*/
@Deprecated
public abstract class MVConfigMigrator {
public List<String> createdDefaults = new ArrayList<String>();
public abstract boolean migrate(String name, File folder);
protected final void migrateListItem(Configuration newConfig, Configuration oldConfig, String key, String oldProperty, String newProperty) {
List<String> list = Arrays.asList(oldConfig.getString("worlds." + key + oldProperty).split(","));
if (list.size() > 0) {
if (list.get(0).length() == 0) {
list = new ArrayList<String>();
}
}
newConfig.setProperty("worlds." + key + newProperty, list);
}
protected final File detectMultiverseFolders(File folder, LoggablePlugin mvPlugin) {
File oldFolder = null;
mvPlugin.log(Level.INFO, "Starting Multiverse Configuration Migrator(MVCM)!");
// They still have MV 1 installed! Good!
if (mvPlugin.getServer().getPluginManager().getPlugin("MultiVerse") != null) {
mvPlugin.log(Level.INFO, "Found MultiVerse 1. Starting Config Migration...");
Plugin plugin = mvPlugin.getServer().getPluginManager().getPlugin("MultiVerse");
oldFolder = plugin.getDataFolder();
} else {
// They didn't have MV 1 enabled... let's try and find the folder...
File[] folders = folder.getParentFile().listFiles();
List<File> folderList = Arrays.asList(folders);
for (File f : folderList) {
if (f.getName().equalsIgnoreCase("MultiVerse")) {
mvPlugin.log(Level.INFO, "Found the MultiVerse 1 config folder. Starting Config Migration...");
oldFolder = f;
}
}
if (oldFolder == null) {
mvPlugin.log(Level.INFO, "Did not find the MV1 Folder. If you did not have MultiVerse 1 installed and this is the FIRST time you're running MV2, this message is GOOD. ");
mvPlugin.log(Level.INFO, "If you did, your configs were **NOT** migrated! Go Here: INSERTURLFORHELP");
return null;
}
}
return oldFolder;
}
}
/*
* END CHECKSTYLE-SUPPRESSION: ALL
*/

View File

@ -20,7 +20,6 @@ public class MVConfigReloadEvent extends Event {
private List<String> configsLoaded;
public MVConfigReloadEvent(List<String> configsLoaded) {
super("MVConfigReload");
this.configsLoaded = configsLoaded;
}

View File

@ -22,7 +22,6 @@ public class MVPlayerTouchedPortalEvent extends Event implements Cancellable {
private boolean isCancelled;
public MVPlayerTouchedPortalEvent(Player p, Location l) {
super("MVPlayerTouchedPortalEvent");
this.p = p;
this.l = l;
}

View File

@ -22,7 +22,6 @@ public class MVRespawnEvent extends Event {
public MVRespawnEvent(Location spawningAt, Player p, String respawnMethod) {
super("MVRespawn");
this.player = p;
this.location = spawningAt;
this.respawnMethod = respawnMethod;

View File

@ -28,7 +28,6 @@ public class MVTeleportEvent extends Event implements Cancellable {
private boolean isCancelled;
public MVTeleportEvent(MVDestination dest, Player teleportee, CommandSender teleporter, boolean safeTeleport) {
super("SafeTTeleporter");
this.teleportee = teleportee;
this.teleporter = teleporter;
this.dest = dest;

View File

@ -11,8 +11,7 @@ public class MVVersionEvent extends Event {
private final StringBuilder versionInfoBuilder;
public MVVersionEvent(String versionInfo) {
super("MVVersionEvent");
versionInfoBuilder = new StringBuilder(versionInfo);
this.versionInfoBuilder = new StringBuilder(versionInfo);
}
private static final HandlerList HANDLERS = new HandlerList();
@ -38,7 +37,7 @@ public class MVVersionEvent extends Event {
* @return The version-info.
*/
public String getVersionInfo() {
return versionInfoBuilder.toString();
return this.versionInfoBuilder.toString();
}
/**
@ -46,6 +45,6 @@ public class MVVersionEvent extends Event {
* @param moreVersionInfo The version-info to add. Should end with '\n'.
*/
public void appendVersionInfo(String moreVersionInfo) {
versionInfoBuilder.append(moreVersionInfo);
this.versionInfoBuilder.append(moreVersionInfo);
}
}

View File

@ -16,8 +16,6 @@ public class MVWorldDeleteEvent extends Event implements Cancellable {
private final boolean removeFromConfig;
public MVWorldDeleteEvent(MultiverseWorld world, boolean removeFromConfig) {
super("MVWorldDeleteEvent");
if (world == null)
throw new IllegalArgumentException("world can't be null!");

View File

@ -29,7 +29,6 @@ public class MVWorldPropertyChangeEvent extends Event implements Cancellable {
private String name;
public MVWorldPropertyChangeEvent(MultiverseWorld world, CommandSender changer, String name, String value) {
super("MVWorldPropertyChange");
this.world = world;
this.changer = changer;
this.name = name;

View File

@ -1,330 +0,0 @@
/******************************************************************************
* Multiverse 2 Copyright (c) the Multiverse Team 2011. *
* Multiverse 2 is licensed under the BSD License. *
* For more information please check the README.md file included *
* with this project. *
******************************************************************************/
package com.onarandombox.MultiverseCore.test.utils;
import org.bukkit.Chunk;
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
*/
public class MockBlock implements Block{
private Material type;
private Location location;
public MockBlock(Location l, Material type) {
this.type = type;
this.location = l;
}
/**
* {@inheritDoc}
*/
@Override
public byte getData() {
return 0;
}
/**
* {@inheritDoc}
*/
@Override
public Block getFace(BlockFace face) {
return null;
}
/**
* {@inheritDoc}
*/
@Override
public Block getFace(BlockFace face, int distance) {
return null;
}
/**
* {@inheritDoc}
*/
@Override
public Block getRelative(int modX, int modY, int modZ) {
return null;
}
/**
* {@inheritDoc}
*/
@Override
public Block getRelative(BlockFace face) {
return null;
}
/**
* {@inheritDoc}
*/
@Override
public Block getRelative(BlockFace face, int distance) {
return null;
}
/**
* {@inheritDoc}
*/
@Override
public Material getType() {
return this.type;
}
/**
* {@inheritDoc}
*/
@Override
public int getTypeId() {
return 0;
}
/**
* {@inheritDoc}
*/
@Override
public byte getLightLevel() {
return 0;
}
@Override
public byte getLightFromSky() {
return 0;
}
@Override
public byte getLightFromBlocks() {
return 0;
}
/**
* {@inheritDoc}
*/
@Override
public World getWorld() {
return this.location.getWorld();
}
/**
* {@inheritDoc}
*/
@Override
public int getX() {
return this.location.getBlockX();
}
/**
* {@inheritDoc}
*/
@Override
public int getY() {
return this.location.getBlockY();
}
/**
* {@inheritDoc}
*/
@Override
public int getZ() {
return this.location.getBlockZ();
}
/**
* {@inheritDoc}
*/
@Override
public Location getLocation() {
return this.location;
}
/**
* {@inheritDoc}
*/
@Override
public Chunk getChunk() {
return null;
}
/**
* {@inheritDoc}
*/
@Override
public void setData(byte data) {
}
@Override
public void setData(byte data, boolean applyPhyiscs) {
}
/**
* {@inheritDoc}
*/
@Override
public void setType(Material type) {
this.type = type;
}
/**
* {@inheritDoc}
*/
@Override
public boolean setTypeId(int type) {
return false;
}
@Override
public boolean setTypeId(int type, boolean applyPhysics) {
return false;
}
@Override
public boolean setTypeIdAndData(int type, byte data, boolean applyPhyiscs) {
return false;
}
/**
* {@inheritDoc}
*/
@Override
public BlockFace getFace(Block block) {
return null;
}
/**
* {@inheritDoc}
*/
@Override
public BlockState getState() {
return null;
}
/**
* {@inheritDoc}
*/
@Override
public Biome getBiome() {
return null;
}
/**
* {@inheritDoc}
*/
@Override
public boolean isBlockPowered() {
return false;
}
/**
* {@inheritDoc}
*/
@Override
public boolean isBlockIndirectlyPowered() {
return false;
}
/**
* {@inheritDoc}
*/
@Override
public boolean isBlockFacePowered(BlockFace face) {
return false;
}
/**
* {@inheritDoc}
*/
@Override
public boolean isBlockFaceIndirectlyPowered(BlockFace face) {
return false;
}
/**
* {@inheritDoc}
*/
@Override
public int getBlockPower(BlockFace face) {
return 0;
}
/**
* {@inheritDoc}
*/
@Override
public int getBlockPower() {
return 0;
}
/**
* {@inheritDoc}
*/
@Override
public boolean isEmpty() {
return this.type == Material.AIR;
}
/**
* {@inheritDoc}
*/
@Override
public boolean isLiquid() {
return false;
}
/**
* {@inheritDoc}
*/
@Override
public double getTemperature() {
return 0;
}
/**
* {@inheritDoc}
*/
@Override
public double getHumidity() {
return 0;
}
/**
* {@inheritDoc}
*/
@Override
public PistonMoveReaction getPistonMoveReaction() {
return null;
}
@Override
public boolean breakNaturally() {
return false;
}
@Override
public boolean breakNaturally(ItemStack itemStack) {
return false;
}
@Override
public Collection<ItemStack> getDrops() {
return null;
}
@Override
public Collection<ItemStack> getDrops(ItemStack itemStack) {
return null;
}
}