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

View File

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

View File

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