Exemplo n.º 1
0
 /** Plugin onCommand() event, associates all plugins that have commands */
 public boolean onCommand(CommandSender sender, Command cmd, String commandLabel, String[] args) {
   if (commandLabel.equalsIgnoreCase("god") && fairGod != null)
     return fairGod.godCommand(sender, args);
   if (commandLabel.equalsIgnoreCase("creative") && demiGod != null)
     return demiGod.creativeCommand(sender, args);
   if (commandLabel.equalsIgnoreCase("survival") && demiGod != null)
     return demiGod.survivalCommand(sender, args);
   if (commandLabel.equalsIgnoreCase("aconf") && autoConfiscate != null)
     return autoConfiscate.onCommand(sender, args);
   if (commandLabel.equalsIgnoreCase("delprefix") && chatPrefix != null)
     return chatPrefix.delPrefix(sender, cmd, commandLabel, args);
   if (commandLabel.equalsIgnoreCase("fullprefix") && chatPrefix != null)
     return chatPrefix.fullPrefix(sender, cmd, commandLabel, args);
   if (commandLabel.equalsIgnoreCase("prefix") && chatPrefix != null)
     return chatPrefix.onCommand(sender, cmd, commandLabel, args);
   if ((commandLabel.equalsIgnoreCase("msg")
           || commandLabel.equalsIgnoreCase("m")
           || commandLabel.equalsIgnoreCase("message")
           || commandLabel.equalsIgnoreCase("tell")
           || commandLabel.equalsIgnoreCase("whisper")
           || commandLabel.equalsIgnoreCase("t"))
       && chat != null) return chat.msgCommand(sender, cmd, commandLabel, args);
   if ((commandLabel.equalsIgnoreCase("r") || commandLabel.equalsIgnoreCase("reply"))
       && chat != null) return chat.rCommand(sender, cmd, commandLabel, args);
   if (commandLabel.equalsIgnoreCase("channel")
       || commandLabel.equalsIgnoreCase("ch")
       || commandLabel.equalsIgnoreCase("ac")
       || commandLabel.equalsIgnoreCase("sc") && chat != null)
     return chat.chCommand(sender, cmd, commandLabel, args);
   if (commandLabel.equalsIgnoreCase("date") && chat != null)
     return chat.dateCommand(sender, cmd, commandLabel, args);
   if (commandLabel.equalsIgnoreCase("dump") && chat != null)
     return chat.dumpCommand(sender, cmd, commandLabel, args);
   if ((commandLabel.equalsIgnoreCase("mute") || commandLabel.equalsIgnoreCase("me"))
       && chat != null) return fullMute.onCommand(sender, cmd, commandLabel, args);
   if (commandLabel.equalsIgnoreCase("ignore") || commandLabel.equalsIgnoreCase("unignore"))
     return chat.ignoreCommand(sender, cmd, commandLabel, args);
   if (commandLabel.equalsIgnoreCase("vote"))
     return voteRewards.onCommand(sender, cmd, commandLabel, args);
   if (commandLabel.equalsIgnoreCase("toggleprofile") && chat != null)
     return chat.badProfileCommand(sender, cmd, commandLabel, args);
   // if (commandLabel.equalsIgnoreCase("peaceful"))
   // return peacefulGriefFree.onCommand(sender, cmd, commandLabel, args);
   // if (commandLabel.equalsIgnoreCase("virtualchest") ||
   // commandLabel.equalsIgnoreCase("vchest") ||
   // commandLabel.equalsIgnoreCase("vc"))
   // return virtualChest.onVCCommand(sender, args);
   //		if (commandLabel.equalsIgnoreCase("world")
   //				|| commandLabel.equalsIgnoreCase("w"))
   //			return worldBlocks.onWorldCommand(sender);
   if (commandLabel.equalsIgnoreCase("spy") && chat != null) return chat.spyCommand(sender);
   if (commandLabel.equals("plotmeoverride") && plotMeOverride != null)
     if (!(sender instanceof Player)) {
       PlotMeOverride.command(args[0]);
       return true;
     }
   if (commandLabel.equalsIgnoreCase("crash")) return crashPlayer.onCommand(sender, args);
   if (commandLabel.equalsIgnoreCase("sprint")) return beastSprint.onCommand(sender);
   if (commandLabel.equalsIgnoreCase("nameless")) return nameless.onCommand(sender, args);
   if (commandLabel.equalsIgnoreCase("tntpunch") && tntpunch != null)
     return tntpunch.onCommand(sender);
   if (commandLabel.equalsIgnoreCase("undercover")) return underCover.onCommand(sender);
   if (commandLabel.equalsIgnoreCase("edit")) return signEdit.onCommand(sender, args);
   if (commandLabel.equalsIgnoreCase("gcmd")) return bungeeGBCMD.onCommand(sender, args);
   if (commandLabel.equalsIgnoreCase("staffvote")
       || commandLabel.equalsIgnoreCase("svote") && staffVotes != null)
     return staffVotes.onCommand(sender, args);
   if (commandLabel.equalsIgnoreCase("home")
       || commandLabel.equalsIgnoreCase("homes")
       || commandLabel.equalsIgnoreCase("sethome")
       || commandLabel.equalsIgnoreCase("delhome"))
     return homes.onCommand(sender, commandLabel, args);
   if (commandLabel.equalsIgnoreCase("servertime") || commandLabel.equalsIgnoreCase("stime"))
     return respectedAutoPromote.onCommand(sender);
   if (commandLabel.equalsIgnoreCase("fly"))
     if (fly != null) return fly.onCommand(sender, cmd, commandLabel, args);
   if (commandLabel.equals("ddstop")) return serverRestart.onRestartCommand(sender);
   if (commandLabel.equals("ddwarn")) return serverRestart.onWarnCommand(sender);
   return false;
 }
Exemplo n.º 2
0
  /** Plugin onEnable() event, enables all custom plugins that are on the current server */
  public void onEnable() {
    log("Diamond Dominion Custom Plugin ENABLING!");
    Bukkit.getServer().getPluginManager().registerEvents(this, this);

    this.getServer().getMessenger().registerOutgoingPluginChannel(this, "BungeeCord");
    this.getServer().getMessenger().registerIncomingPluginChannel(this, "BungeeCord", this);

    String server = detectedServer();
    log("Detected Server: " + server);

    DataManager dm = new DataManager();
    dm.reloaddata();
    Bukkit.dispatchCommand(Bukkit.getConsoleSender(), "pex set default group Player");
    log("Loading Custom Items:");
    /*
     * Start Loading all Custom Plugin Classes
     */
    if (shouldEnable("EndDragonRespawn")) {
      log(" - EndDragonRespawn:");
      try {
        endDragonRespawn = new EndDragonRespawn(this);
        endDragonRespawn.enable();
      } catch (Exception e) {
        pluginFailed();
      }
    }

    if (shouldEnable("HeartBeat"))
      try {
        heartBeat = new HeartBeat(this);
        heartBeat.enable();
      } catch (Exception e) {
        pluginFailed();
      }

    if (shouldEnable("FairGod"))
      try {
        fairGod = new FairGod(this);
        fairGod.enable();
      } catch (Exception e) {
        pluginFailed();
      }

    //		if (shouldEnable("LegitWarzone"))
    //			try {
    //				legitWarzone = new LegitWarzone(this);
    //				legitWarzone.enable();
    //			} catch (Exception e) {
    //				pluginFailed();
    //			}

    if (shouldEnable("TopPvPers"))
      try {
        topPvPers = new TopPvPers(this);
        topPvPers.enable();
      } catch (Exception e) {
        pluginFailed();
      }

    if (shouldEnable("VoteRewards"))
      try {
        voteRewards = new VoteRewards(this);
        voteRewards.enable();
      } catch (Exception e) {
        pluginFailed();
      }

    if (shouldEnable("VoteReceiver"))
      try {
        voteReceiver = new VoteReceiver(this);
        voteReceiver.enable();
      } catch (Exception e) {
        pluginFailed();
      }

    if (shouldEnable("DemiGodPackage"))
      try {
        demiGod = new DemiGodPackage(this);
        demiGod.enable();
      } catch (Exception e) {
        pluginFailed();
      }

    //		if (shouldEnable("DirectionBook"))
    //			try {
    //				directionBook = new DirectionBook(this);
    //				directionBook.enable();
    //			} catch (Exception e) {
    //				pluginFailed();
    //			}

    //		if (shouldEnable("GameTime"))
    //			try {
    //				gameTime = new GameTime(this);
    //				gameTime.enable();
    //			} catch (Exception e) {
    //				pluginFailed();
    //			}

    if (shouldEnable("CustomRecipies"))
      try {
        customRecipies = new CustomRecipies(this);
        customRecipies.enable();
      } catch (Exception e) {
        pluginFailed();
      }

    if (shouldEnable("SpawnerSwitch"))
      try {
        spawnerSwitch = new SpawnerSwitch(this);
        spawnerSwitch.enable();
      } catch (Exception e) {
        pluginFailed();
      }

    //		if (shouldEnable("JailSigns"))
    //		jailSigns.enable();

    //		if (shouldEnable("AutoConfiscate"))
    //		autoConfiscate.enable();

    if (shouldEnable("ModAppWall"))
      try {
        modAppWall = new ModAppWall(this);
        modAppWall.enable();
      } catch (Exception e) {
        pluginFailed();
      }

    if (shouldEnable("ModListWall"))
      try {
        modListWall = new ModListWall(this);
        modListWall.enable();
      } catch (Exception e) {
        pluginFailed();
      }

    //		if (shouldEnable("WebRanks"))
    //			try {
    //				webRanks = new WebRanks(this);
    //				webRanks.enable();
    //			} catch (Exception e) {
    //				pluginFailed();
    //			}

    if (shouldEnable("Trampoline"))
      try {
        trampoline = new Trampoline(this);
        trampoline.enable();
      } catch (Exception e) {
        pluginFailed();
      }

    if (shouldEnable("PlotMeOverride"))
      try {
        plotMeOverride = new PlotMeOverride(this);
        plotMeOverride.enable();
      } catch (Exception e) {
        pluginFailed();
      }

    if (shouldEnable("Chat"))
      try {
        chat = new Chat(this);
        chat.enable();
      } catch (Exception e) {
        pluginFailed();
      }

    if (shouldEnable("ChatPrefix"))
      try {
        chatPrefix = new ChatPrefix(this);
        chatPrefix.enable();
      } catch (Exception e) {
        pluginFailed();
      }

    if (shouldEnable("FullMute"))
      try {
        fullMute = new FullMute(this);
        fullMute.enable();
      } catch (Exception e) {
        pluginFailed();
      }

    if (shouldEnable("LaunchPad"))
      try {
        launchPad = new LaunchPad(this);
        launchPad.enable();
      } catch (Exception e) {
        pluginFailed();
      }

    if (shouldEnable("ColorArmor"))
      try {
        colorArmor = new ColorArmor(this);
        colorArmor.enable();
      } catch (Exception e) {
        pluginFailed();
      }

    //		if (shouldEnable("DrunkenWizard"))
    //		drunkenWizard.enable();

    if (shouldEnable("CreativeEntityRemover"))
      try {
        creativeEntityRemover = new CreativeEntityRemover(this);
        creativeEntityRemover.enable();
      } catch (Exception e) {
        pluginFailed();
      }

    if (shouldEnable("WelcomeBook"))
      try {
        welcomeBook = new WelcomeBook(this);
        welcomeBook.enable();
      } catch (Exception e) {
        pluginFailed();
      }

    if (shouldEnable("IpRecorder"))
      try {
        ipRecorder = new IpRecorder(this);
        ipRecorder.enable();
      } catch (Exception e) {
        pluginFailed();
      }

    if (shouldEnable("WelcomeSign"))
      try {
        welcomeSign = new WelcomeSign(this);
        welcomeSign.enable();
      } catch (Exception e) {
        pluginFailed();
      }

    //		if (shouldEnable("PeacefulGriefFree"))
    //		peacefulGriefFree.enable();

    //		if (shouldEnable("ForumActivation"))
    //			try {
    //				forumActivation = new ForumActivation(this);
    //				forumActivation.enable();
    //			} catch (Exception e) {
    //				pluginFailed();
    //			}

    if (shouldEnable("VirtualChest"))
      try {
        virtualChest = new VirtualChest(this);
        virtualChest.enable();
      } catch (Exception e) {
        pluginFailed();
      }

    //		if (shouldEnable("WorldBlocks"))
    //			try {
    //				worldBlocks = new WorldBlocks(this);
    //				worldBlocks.enable();
    //			} catch (Exception e) {
    //				pluginFailed();
    //			}

    if (shouldEnable("DonorShop"))
      try {
        donorShop = new DonorShop(this);
        donorShop.enable();
      } catch (Exception e) {
        pluginFailed();
      }

    if (shouldEnable("SpawnMusic"))
      try {
        spawnMusic = new SpawnMusic(this);
        spawnMusic.enable();
      } catch (Exception e) {
        pluginFailed();
      }

    if (shouldEnable("CrashPlayer"))
      try {
        crashPlayer = new CrashPlayer(this);
        crashPlayer.enable();
      } catch (Exception e) {
        pluginFailed();
      }

    if (shouldEnable("BeastSprint"))
      try {
        beastSprint = new BeastSprint(this);
        beastSprint.enable();
      } catch (Exception e) {
        pluginFailed();
      }

    if (shouldEnable("Nameless"))
      try {
        nameless = new Nameless(this);
        nameless.enable();
      } catch (Exception e) {
        pluginFailed();
      }

    if (shouldEnable("TnTPunch"))
      try {
        tntpunch = new TnTPunch(this);
        tntpunch.enable();
      } catch (Exception e) {
        pluginFailed();
      }

    if (shouldEnable("RestartWarning"))
      try {
        restartWarning = new RestartWarning(this);
        restartWarning.enable();
      } catch (Exception e) {
        pluginFailed();
      }

    if (shouldEnable("UnderCover"))
      try {
        underCover = new UnderCover(this);
        underCover.enable();
      } catch (Exception e) {
        pluginFailed();
      }

    if (shouldEnable("SignEdit"))
      try {
        signEdit = new SignEdit(this);
        signEdit.enable();
      } catch (Exception e) {
        pluginFailed();
      }

    if (shouldEnable("WarpWild"))
      try {
        warpWild = new WarpWild(this);
        warpWild.enable();
      } catch (Exception e) {
        pluginFailed();
      }

    if (shouldEnable("EWButtons"))
      try {
        ewButtons = new EWButtons(this);
        ewButtons.enable();
      } catch (Exception e) {
        pluginFailed();
      }

    if (shouldEnable("SkyBlockTP"))
      try {
        skyBlockTP = new SkyBlockTP(this);
        skyBlockTP.enable();
      } catch (Exception e) {
        pluginFailed();
      }

    if (shouldEnable("EnderEggCollection"))
      try {
        enderEggCollection = new EnderEggCollection(this);
        enderEggCollection.enable();
      } catch (Exception e) {
        pluginFailed();
      }

    if (shouldEnable("Voodoo"))
      try {
        voodoo = new Voodoo(this);
        voodoo.enable();
      } catch (Exception e) {
        pluginFailed();
      }

    if (shouldEnable("ExtraMiningLoot"))
      try {
        extraMiningLoot = new ExtraMiningLoot(this);
        extraMiningLoot.enable();
      } catch (Exception e) {
        pluginFailed();
      }

    if (shouldEnable("EWBlockFenceWalk"))
      try {
        ewBlockFenceWalk = new EWBlockFenceWalk(this);
        ewBlockFenceWalk.enable();
      } catch (Exception e) {
        pluginFailed();
      }

    if (shouldEnable("CommandModifier"))
      try {
        commandModifier = new CommandModifier(this);
        commandModifier.enable();
      } catch (Exception e) {
        pluginFailed();
      }

    if (shouldEnable("SkyBlockPortalReward"))
      try {
        sbPortalReward = new SkyBlockPortalReward(this);
        sbPortalReward.enable();
      } catch (Exception e) {
        pluginFailed();
      }

    if (shouldEnable("HubPortals"))
      try {
        hubPortals = new HubPortals(this);
        hubPortals.enable();
      } catch (Exception e) {
        pluginFailed();
      }

    if (shouldEnable("BungeeGlobalCommand"))
      try {
        bungeeGBCMD = new BungeeGlobalCommand(this);
        bungeeGBCMD.enable();
      } catch (Exception e) {
        pluginFailed();
      }

    if (shouldEnable("StaffVotes"))
      try {
        staffVotes = new StaffVotes(this);
        staffVotes.enable();
      } catch (Exception e) {
        pluginFailed();
      }

    if (shouldEnable("RespectedAutoPromote"))
      try {
        respectedAutoPromote = new RespectedAutoPromote(this);
        respectedAutoPromote.enable();
      } catch (Exception e) {
        pluginFailed();
      }

    if (shouldEnable("Homes"))
      try {
        homes = new Homes(this);
        homes.enable();
      } catch (Exception e) {
        pluginFailed();
      }

    if (shouldEnable("FairFly"))
      try {
        fly = new FairFly(this);
        fly.enable();
      } catch (Exception e) {
        pluginFailed();
      }

    if (shouldEnable("ServerRestart"))
      try {
        serverRestart = new ServerRestart(this);
        serverRestart.enable();
      } catch (Exception e) {
        pluginFailed();
      }

    /*
     * Complete loading all custom plugin classes
     */
    log("Fully Enabled!");
  }