示例#1
0
 public void setupLogBlock() {
   if (plugin.getConfig().getBoolean("LogBlockEnabled")) {
     Plugin lbplugin = Bukkit.getServer().getPluginManager().getPlugin("LogBlock");
     if (lbplugin != null) {
       LogBlockConsumer = ((de.diddiz.LogBlock.LogBlock) lbplugin).getConsumer();
       LogBlockPlugin = (de.diddiz.LogBlock.LogBlock) lbplugin;
     } else {
       plugin.PM.log(
           "Could not hook into LogBlock. LogBlock features have been disabled.", Level.WARNING);
       plugin.getConfig().set("LogBlockEnabled", false);
     }
   }
 }
  @EventHandler
  public void onPlayerChat(AsyncPlayerChatEvent e) {
    if (plugin.getConfig().getBoolean("spell-castable-with-chat")) {
      if (plugin.SpellManager.isSpell(e.getMessage().substring(0, e.getMessage().length() - 1))) {
        plugin.SpellManager.getSpell(e.getMessage().substring(0, e.getMessage().length() - 1))
            .cast(e.getPlayer());
        return;
      }
    }

    if (sonorus.contains(e.getPlayer().getName())) {
      e.setCancelled(true);
      plugin
          .getServer()
          .broadcastMessage(
              e.getPlayer().getDisplayName() + ChatColor.WHITE + ": " + e.getMessage());
      sonorus.remove(e.getPlayer().getName());
    }
  }