Fixed some warnings.

This commit is contained in:
TomyLobo 2013-06-22 05:54:28 +02:00 committed by wizjany
parent 5db504aed2
commit 3e875b7936
3 changed files with 6 additions and 12 deletions

View File

@ -130,6 +130,7 @@ public class BukkitWorld extends LocalWorld {
* Construct the object.
* @param world
*/
@SuppressWarnings("unchecked")
public BukkitWorld(World world) {
this.world = world;
@ -170,7 +171,7 @@ public class BukkitWorld extends LocalWorld {
Class<? extends NmsBlock> nmsClass = (Class<? extends NmsBlock>) testBlock;
boolean canUse = false;
try {
canUse = (Boolean) nmsClass.getMethod("verify", null).invoke(null, null);
canUse = (Boolean) nmsClass.getMethod("verify").invoke(null);
} catch (Throwable e) {
continue;
}
@ -191,7 +192,7 @@ public class BukkitWorld extends LocalWorld {
// try our default
try {
nmsBlockType = (Class<? extends NmsBlock>) Class.forName("com.sk89q.worldedit.bukkit.DefaultNmsBlock");
boolean canUse = (Boolean) nmsBlockType.getMethod("verify", null).invoke(null, null);
boolean canUse = (Boolean) nmsBlockType.getMethod("verify").invoke(null);
if (canUse) {
nmsSetMethod = nmsBlockType.getMethod("set", World.class, Vector.class, BaseBlock.class);
nmsValidBlockMethod = nmsBlockType.getMethod("isValidBlockType", int.class);

View File

@ -116,20 +116,21 @@ public class WorldEditPlugin extends JavaPlugin {
// Setup interfaces
server = new BukkitServerInterface(this, getServer());
controller = new WorldEdit(server, config);
WorldEdit.getInstance().logger.setParent(Bukkit.getLogger());
WorldEdit.logger.setParent(Bukkit.getLogger());
api = new WorldEditAPI(this);
getServer().getMessenger().registerIncomingPluginChannel(this, CUI_PLUGIN_CHANNEL, new CUIChannelListener(this));
getServer().getMessenger().registerOutgoingPluginChannel(this, CUI_PLUGIN_CHANNEL);
// Now we can register events!
getServer().getPluginManager().registerEvents(new WorldEditListener(this), this);
getServer().getScheduler().scheduleAsyncRepeatingTask(this,
getServer().getScheduler().runTaskTimerAsynchronously(this,
new SessionTimer(controller, getServer()), 120, 120);
}
private void copyNmsBlockClasses(File target) {
try {
JarFile jar = new JarFile(getFile());
@SuppressWarnings("rawtypes")
Enumeration entries = jar.entries();
while (entries.hasMoreElements()) {
JarEntry jarEntry = (JarEntry) entries.nextElement();
@ -158,12 +159,6 @@ public class WorldEditPlugin extends JavaPlugin {
*/
@Override
public void onDisable() {
for (Player player : getServer().getOnlinePlayers()) {
LocalPlayer lPlayer = wrapPlayer(player);
if (controller.getSession(lPlayer).hasCUISupport()) {
lPlayer.dispatchCUIHandshake();
}
}
controller.clearSessions();
for (Handler h : controller.commandLogger.getHandlers()) {
h.close();

View File

@ -225,7 +225,6 @@ public class SchematicCommands {
throw new FilenameResolutionException(dir.getPath(), "Schematics directory invalid or not found.");
}
StringBuilder build = new StringBuilder("Available schematics (Filename (Format)): ");
boolean first = true;
final int sortType = args.hasFlag('d') ? -1 : args.hasFlag('n') ? 1 : 0;
// cleanup file list
@ -248,7 +247,6 @@ public class SchematicCommands {
build.append("\n\u00a79");
SchematicFormat format = SchematicFormat.getFormat(file);
build.append(file.getName()).append(": ").append(format == null ? "Unknown" : format.getName());
first = false;
}
player.print(build.toString());
}