onCommand doesn't work for me. No exception. No sign that it is even called. Nothing. Code: public void onEnable() { log.info(pdfFile.getName() + " enabled."); PluginManager pm = getServer().getPluginManager(); pm.registerEvent(Event.Type.BLOCK_INTERACT, blockListener, Priority.Normal, this); pm.registerEvent(Event.Type.BLOCK_PLACED, blockListener, Priority.Normal, this); pm.registerEvent(Event.Type.PLAYER_COMMAND, playerListener, Priority.Normal, this); pm.registerEvent(Event.Type.PLAYER_QUIT, playerListener, Priority.Normal, this); try { ... } catch (Exception ex) { } } Code: public void onCommand(PlayerChatEvent event) { Player p = event.getPlayer(); String[] m = event.getMessage().split(" "); if (m[0].equalsIgnoreCase("/chest")) { try { if (Locked.oo && !p.isOp() && !Locked.ano.contains(p.getName())) return; if (m[1].equalsIgnoreCase("lock")) { ... } else if (m[1].equalsIgnoreCase("unlock")) { ... } else { ... } } catch (Exception ex) { } } } Help please? Full source at: https://github.com/Fifteen/Locked
Thanks, that worked --- merged: Feb 3, 2011 10:35 PM --- Oh, and is there a list of correct methods? I believe I'm having the same problem with BlockDamageEvent...
Personally you ought to get in the habit of looking at the source or javadocs. JavaDocs: http://javadoc.lukegb.com/Bukkit/ http://javadoc.lukegb.com/Bukkit/de/df8/classorg_1_1bukkit_1_1event_1_1block_1_1BlockListener.html Source: https://github.com/Bukkit/Bukkit/tree/master/src/main/java/org/bukkit/event https://github.com/Bukkit/Bukkit/blob/master/src/main/java/org/bukkit/event/block/BlockListener.java
check out my picasso code, onCommand goes in the main class and it is not a playerChatEvent, it has different arguments.
Is this going to be phased out? Because it warks at the time and I'm lazy I do read changes in the release system, but no hint there.
Not properly, because it does has its uses. But: - Other plugins will be able to register your command, and yours will stop working - Your commands are limited to chat, and not from other sources (console, IRC, other plugins) - Won't show up in any /help - Won't be visible at all to other plugins, or our online command database etc