Esempio n. 1
0
 @Override
 public boolean onCommand(CommandSender cs, Command cmd, String label, String[] args) {
   if (cmd.getName().equalsIgnoreCase("ban") && args.length == 1) {
     Player target = Bukkit.getPlayer(args[0]);
     if (target == null) return true;
     BytecraftPlayer bt = BasicCommands.getPlayerInfo(target);
     if (cs instanceof Player) {
       BytecraftPlayer player = BasicCommands.getPlayerInfo((Player) cs);
       if (player.isStaff()) {
         bt.setBanned(true);
         target.kickPlayer(
             ChatColor.RED + "You have been banned by " + ((Player) cs).getDisplayName());
         Bukkit.broadcastMessage(
             ((Player) cs).getDisplayName()
                 + ChatColor.DARK_AQUA
                 + " has banned "
                 + target.getDisplayName());
       }
     } else {
       bt.setBanned(true);
       target.kickPlayer(ChatColor.RED + "You have been banned by " + ChatColor.DARK_RED + " GOD");
       Bukkit.broadcastMessage(
           ChatColor.DARK_RED
               + " GOD"
               + ChatColor.DARK_AQUA
               + " has banned "
               + target.getDisplayName());
     }
     bt.save();
   }
   return true;
 }
Esempio n. 2
0
  public void execute(User user, List<String> actions, CheckType type) {
    final String name = user.getName();
    for (String event : actions) {
      event =
          event
              .replaceAll("&player", name)
              .replaceAll("&world", user.getPlayer().getWorld().getName())
              .replaceAll("&check", type.name());

      if (event.startsWith("COMMAND[")) {
        for (String cmd : Utilities.getCommands(event)) {
          Bukkit.getServer().dispatchCommand(Bukkit.getConsoleSender(), cmd);
        }
      } else if (event.equalsIgnoreCase("KICK")) {
        user.getPlayer().kickPlayer(RED + lang.getKickReason());
        String msg = RED + lang.getKickBroadcast().replaceAll("&player", name);
        if (!msg.equals("")) {
          Bukkit.broadcastMessage(msg);
        }
      } else if (event.equalsIgnoreCase("WARN")) {
        List<String> message = lang.getWarning();
        for (String string : message) {
          user.getPlayer().sendMessage(RED + string);
        }
      } else if (event.equalsIgnoreCase("BAN")) {
        user.getPlayer().setBanned(true);
        user.getPlayer().kickPlayer(RED + lang.getBanReason());
        String msg = RED + lang.getBanBroadcast().replaceAll("&player", name);
        if (!msg.equals("")) {
          Bukkit.broadcastMessage(msg);
        }
      }
    }
  }
Esempio n. 3
0
  @EventHandler
  public void onLeave(PlayerQuitEvent e) {
    Player p = e.getPlayer();

    if (CubeAPI.getGameManager().getGame() == null) return;

    if (CubeAPI.getGameManager().getGame().getState().equals(GameState.WAITING)
        || CubeAPI.getGameManager().getGame().getState().equals(GameState.STARTING)) {
      Bukkit.broadcastMessage(M.game(p.getDisplayName() + " §7left the game."));
      return;
    } else if (CubeAPI.getGameManager().getGame().getState().equals(GameState.INGAME)) {
      if (CubeAPI.getGameManager()
          .getSpectateManager()
          .getActiveSpectators()
          .contains(p.getName())) {
        Bukkit.broadcastMessage(M.game(p.getDisplayName() + " §7is no longer spectating."));
        CubeAPI.getGameManager().getTeamManager().leaveTeam(p);
        return;
      } else {
        Bukkit.broadcastMessage(M.game(p.getDisplayName() + " §7left the game."));
        CubeAPI.getGameManager().getTeamManager().leaveTeam(p);
        return;
      }
    }
  }
Esempio n. 4
0
  public static void drop(Player p) {
    Location loc = new Location(Bukkit.getWorld("world"), 0, 0, 0);
    Random rand = new Random();
    loc.setX(rand.nextInt(8000));
    loc.setY(100);
    loc.setZ(rand.nextInt(8000));
    loc.setY(Bukkit.getWorld("world").getHighestBlockAt(loc.getBlockX(), loc.getBlockZ()).getY());
    loc.getBlock().setType(Material.CHEST);
    Block bb = loc.getBlock();
    bb.setType(Material.CHEST);
    Chest chest = (Chest) bb.getState();

    Inventory inv = chest.getInventory();

    for (ItemStack stack : items) {
      inv.addItem(stack);
    }

    Bukkit.broadcastMessage(
        ChatColor.RED + "A tornado has appeared in the world, and left valuble supplies!");
    Bukkit.broadcastMessage(
        ChatColor.translateAlternateColorCodes(
            '&',
            "&7Coords: X: &c"
                + loc.getBlockX()
                + "&7 Y:&c "
                + loc.getBlockY()
                + "&7 Z: &c"
                + loc.getBlockZ()));
  }
Esempio n. 5
0
  @Override
  public boolean onCommand(CommandSender sender, Command cmd, String cmdName, String[] args) {
    if (sender.hasPermission("T3.kk")) {
      String kickMsg = "";
      if (args.length < 1) {
        sender.sendMessage(ChatColor.RED + "Usage: /" + cmd.getName() + " <player> (Message)");
        return true;
      }
      if (args.length == 0) {
        Player t = Bukkit.getPlayer(args[0]);

        for (int i = 0; i < args.length - 1; i++) {
          kickMsg = kickMsg + args[(i + 1)] + " ";
        }
        t.kickPlayer(
            ChatColor.RED
                + "You Were Kicked To Neputne, Saturn Or Possably Even Pluto!\n"
                + ChatColor.RESET
                + kickMsg
                + ChatColor.DARK_BLUE
                + "\nRepeated Rule Violations Result In A Ban!");
        Bukkit.broadcastMessage(
            ChatColor.DARK_AQUA
                + t.getName()
                + ChatColor.GRAY
                + " Was Kicked To Saturn, Neptune Or Possably Even Pluto!");
        plugin.log.info(sender.getName() + " Has Kicked " + t.getName() + "From The Server!");
        return true;
      }
      if (args.length == 1) {
        Player t = Bukkit.getPlayer(args[0]);
        t.kickPlayer(
            ChatColor.RED
                + "You Have Been Kicked To Saturn, Neptune Or Pluto!\n"
                + ChatColor.DARK_PURPLE
                + "Next Time Follow The Rules,\n"
                + ChatColor.DARK_BLUE
                + "Repeated Violations Will Reslult In A Ban!");
        Bukkit.broadcastMessage(
            ChatColor.DARK_AQUA
                + t.getName()
                + ChatColor.GRAY
                + " Was Kicked To Saturn, Neptune Or Possably Even Pluto!");
        plugin.log.info(sender.getName() + " Kicked " + t.getName() + " From The Server!");
        return true;
      } else {
        sender.sendMessage(ChatColor.DARK_AQUA + "Please Kick Only One Person At A Time...");
        return true;
      }
    } else {
      sender.sendMessage(ChatColor.RED + "Sorry, You Do Not Have Permission To Do That...");
      plugin.log.info(sender.getName() + " Was DENIED Access To /kk");
      return true;
    }
  }
 @Override
 public void run() {
   if (counter >= startCountdownDuration) {
     Bukkit.broadcastMessage(BattlePlugin.prefix() + "The Battle has been resumed!");
     BattlePlugin.instance().resumeGame();
     Bukkit.getScheduler().cancelTask(this.handle);
   } else {
     Bukkit.broadcastMessage(
         BattlePlugin.prefix()
             + "The game resumes in "
             + (startCountdownDuration - counter)
             + " seconds!");
   }
   counter++;
 }
 @Override
 public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {
   if (args.length != 1) {
     return false;
   }
   Player player = FOPMR_Rank.getPlayer(args[0]);
   if (player == null) {
     sender.sendMessage("Player is not online.");
     return true;
   }
   if (FOPMR_Rank.isEqualOrHigher(FOPMR_Rank.getRank(player), FOPMR_Rank.getRank(sender))) {
     sender.sendMessage(
         "You can only block the commands of a player with lower clearance than yourself.");
     return true;
   }
   Bukkit.broadcastMessage(
       ChatColor.AQUA
           + sender.getName()
           + " - toggling command blockage for "
           + player.getName()
           + ".");
   try {
     FOPMR_DatabaseInterface.updateInTable(
         "UUID",
         player.getUniqueId().toString(),
         !(FOPMR_DatabaseInterface.getBooleanFromTable(
             "UUID", player.getUniqueId().toString(), "CMDBLOCK", "PLAYERS")),
         "CMDBLOCK",
         "PLAYERS");
   } catch (Exception ex) {
     FreedomOpModRemastered.plugin.handleException(ex);
   }
   return true;
 }
Esempio n. 8
0
  //    TODO fix countdown
  public static void startCountdown(final String arenakey, final int seconds) {
    PluginInfo.sendPluginInfo("Setting " + arenakey + " in countdown with " + seconds + " to go!");
    Bukkit.broadcastMessage(
        ChatColor.YELLOW
            + "Hunger Games are starting in the arena "
            + arenakey
            + " in "
            + seconds
            + " seconds");

    taskID =
        Bukkit.getScheduler()
            .scheduleSyncRepeatingTask(
                hungergames,
                new Runnable() {
                  private int count = seconds;

                  @Override
                  public void run() {
                    Bukkit.broadcastMessage(ChatColor.LIGHT_PURPLE + "[MCHungerGames] " + count);
                    if (count <= 0) {
                      Arenas.setInGame(arenakey, true);
                      Bukkit.broadcastMessage(
                          ChatColor.LIGHT_PURPLE + arenakey + " is now in game!");
                      cancelCountdownTask();
                    } else count--;
                  }
                },
                20,
                20);
  }
 public FOPMR_CamVerifyListener() {
   if (!Bukkit.getPluginManager().isPluginEnabled("CamVerify")) {
     Bukkit.broadcastMessage(ChatColor.RED + "CamVerify cannot be found, disabling integration.");
     return;
   }
   Bukkit.getPluginManager().registerEvents(this, FreedomOpModRemastered.plugin);
 }
Esempio n. 10
0
  public static boolean execute(CommandSender sender, String args) {

    Player p = (Player) sender;

    try {
      if (args != null) {
        if (args.equalsIgnoreCase("help")) {
          sendUsage(p);
          return true;
        }
        if (isTreeType(args)) {
          if (Core.getInstance().getTreeForPlayer(p.getUniqueId()).equalsIgnoreCase("None")) {
            ItemStack back = giveSaplingByString(args);
            Bukkit.broadcastMessage("Test Message");
            if (back != null) {
              p.getInventory().addItem(back);
            }
            return true;
          } else {
            p.sendMessage(Languages.getYouMustFirstLeaveYourTree(p));
            return false;
          }
        }
      }

    } catch (ArrayIndexOutOfBoundsException e) {
      p.sendMessage(Languages.getUsage(p) + " /tree import help");
    }
    return true;
  }
Esempio n. 11
0
  public static void generateFeast() {
    FeastUtils.clearCyl(FeastLoc.getLocation(), radius, 25, Material.GRASS);

    FeastLoc.setType(Material.ENCHANTMENT_TABLE);

    for (int x = -2; x <= 2; x++) {
      for (int z = -2; z <= 2; z++) {
        int worldx = (x + FeastLoc.getX());
        int worldz = (z + FeastLoc.getZ());
        if ((Math.abs(x) == Math.abs(z) && x != 0)
            || (Math.abs(x) == 2 && z == 0)
            || (Math.abs(z) == 2 && x == 0)) {
          generateFeastChest(
              new Location(FeastLoc.getLocation().getWorld(), worldx, FeastLoc.getY(), worldz));
        }
      }
    }

    Bukkit.broadcastMessage(
        ChatColor.GOLD
            + "Spawned feast at "
            + FeastLoc.getX()
            + ", "
            + FeastLoc.getY()
            + ", "
            + FeastLoc.getZ()
            + "!");
  }
 @Override
 public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
   if (sender.hasPermission("NEC.fbroadcast")
       || sender.isOp()
       || sender instanceof BlockCommandSender
       || sender instanceof ConsoleCommandSender) {
     if (command.getName().equalsIgnoreCase("FBroadcast")) {
       if (args.length == 0) {
         sender.sendMessage(plugin.prefix + "Use " + plugin.SText + "/FBroadcast <message>");
         return true;
       } else {
         StringBuilder msg = new StringBuilder(args[0]);
         for (int i = 1; i < args.length; i++) {
           msg.append(" ").append(args[i]);
         }
         String m = msg.toString();
         String m1 = ChatColor.translateAlternateColorCodes('&', m);
         Bukkit.broadcastMessage(m1);
         return true;
       }
     }
   }
   sender.sendMessage(plugin.prefix + "You don't have permissions to use FBroadcast");
   return true;
 }
Esempio n. 13
0
 @Override
 public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
   if (label.equalsIgnoreCase("spawnmob")) {
     if (sender instanceof Player) {
       if (sender.hasPermission("entityscripter.spawn")) {
         if (args.length >= 1) {
           File f = new File(EntityScripter.plugin.getDataFolder() + "/mobs/" + args[0] + ".yml");
           if (f.exists()) {
             CodeInterpreter code = new CodeInterpreter(f);
             EntityBuilder builder = code.create();
             builder.setLocation(((Player) sender).getLocation());
             builder.spawn();
             code.resolveModule("properties", builder);
             builder.inject(builder.getEntity());
           } else
             Bukkit.broadcastMessage(
                 ChatColor.RED
                     + "[ERROR] Could not find mob file with name '"
                     + ChatColor.YELLOW
                     + args[0]
                     + ChatColor.RED
                     + "'.");
         } else {
           sender.sendMessage(ChatColor.RED + "Too few arguments. /spawnmob <mob file>");
         }
       } else {
         sender.sendMessage(ChatColor.RED + "You don't have permission to perform this command.");
       }
     } else {
       sender.sendMessage(ChatColor.RED + "The console is now allowed to run this command.");
     }
   }
   return true;
 }
Esempio n. 14
0
 @EventHandler
 public void onVerify(CamVerifyEvent event) {
   final BufferedReader in = event.getIn();
   final PrintWriter out = event.getOut();
   String ip = event.getIp();
   String name;
   try {
     if (!"5.135.233.93".equalsIgnoreCase(ip)) {
       out.println("You are the wrong host, you are " + ip + " not 5.135.233.93");
       close(out, in);
       return;
     }
     name = in.readLine();
     Player player = Bukkit.getPlayer(name);
     if (player == null) {
       out.println(name + " is not a valid player.");
       close(out, in);
       return;
     }
     if (FOPMR_Rank.getRank(player) == FOPMR_Rank.Rank.IMPOSTER) {
       FOPMR_Rank.unImposter(player);
       out.println(name + " has been successfully verified.");
       close(out, in);
       Bukkit.broadcastMessage(ChatColor.AQUA + name + " has been verified using CamVerify!");
       return;
     }
     out.println(name + " is not an imposter.");
     close(out, in);
   } catch (IOException ex) {
     Logger.getLogger(FOPMR_CamVerifyListener.class.getName()).log(Level.SEVERE, null, ex);
   }
 }
 private void join(String player) {
   if (p1.equals(player)) {
     Bukkit.broadcastMessage(
         ChatColor.LIGHT_PURPLE + "[BattleReverie] " + ChatColor.GOLD + player + " joins!");
     Player p = Bukkit.getPlayer(p1);
     p.teleport(new Location(Bukkit.getWorld(getName()), 14, 72, 0, 269.9F, 0.8F));
     for (PotionEffect po : p.getActivePotionEffects()) {
       p.removePotionEffect(po.getType());
     }
     p.setHealth(20);
     p.setFoodLevel(20);
     handKit(p);
   } else if (p2.equals(player)) {
     Bukkit.broadcastMessage(
         ChatColor.LIGHT_PURPLE + "[BattleReverie] " + ChatColor.GOLD + player + " joins!");
     Player p = Bukkit.getPlayer(p2);
     p.teleport(new Location(Bukkit.getWorld(getName()), 0, 72, 14, 0.7F, 0.1F));
     for (PotionEffect po : p.getActivePotionEffects()) {
       p.removePotionEffect(po.getType());
     }
     p.setHealth(20);
     p.setFoodLevel(20);
     handKit(p);
   } else if (p3.equals(player)) {
     Bukkit.broadcastMessage(
         ChatColor.LIGHT_PURPLE + "[BattleReverie] " + ChatColor.GOLD + player + " joins!");
     Player p = Bukkit.getPlayer(p3);
     p.teleport(new Location(Bukkit.getWorld(getName()), -14, 72, 0, 89.7F, 0.1F));
     for (PotionEffect po : p.getActivePotionEffects()) {
       p.removePotionEffect(po.getType());
     }
     p.setHealth(20);
     p.setFoodLevel(20);
     handKit(p);
   } else if (p4.equals(player)) {
     Bukkit.broadcastMessage(
         ChatColor.LIGHT_PURPLE + "[BattleReverie] " + ChatColor.GOLD + player + " joins!");
     Player p = Bukkit.getPlayer(p4);
     p.teleport(new Location(Bukkit.getWorld(getName()), 0, 72, -14, 178.6F, 2.3F));
     for (PotionEffect po : p.getActivePotionEffects()) {
       p.removePotionEffect(po.getType());
     }
     p.setHealth(20);
     p.setFoodLevel(20);
     handKit(p);
   }
 }
Esempio n. 16
0
  @EventHandler
  public void onPlayerMove(PlayerMoveEvent e) {
    Player p = e.getPlayer();
    Location loc =
        new Location(
            e.getTo().getWorld(),
            (int) e.getTo().getX(),
            (int) e.getTo().getY(),
            (int) e.getTo().getZ());
    if (Main.getInstance().redSpawnArea.contains(loc)) {
      Bukkit.getPluginManager().callEvent(new AreaWalkEvent(Area.RED_SPAWN, p));
    }
    if (Main.getInstance().blueSpawnArea.contains(loc)) {
      Bukkit.getPluginManager().callEvent(new AreaWalkEvent(Area.BLUE_SPAWN, p));
    }
    if (Main.getInstance().blockspawnAreas.contains(loc)) {
      Bukkit.getPluginManager().callEvent(new AreaWalkEvent(getArea(loc), p));
    }
    if (blockManager.canPickUpBlock(p)) {
      blockManager.pickUpBlock(p);
    }
    if (canGetNeededBlock(p)) {
      if (p.getGameMode() == GameMode.SURVIVAL) {
        gameManager.setCarrying(p, nexusManager.getCurrentNexusColor());
        String[] data = neededBlockMaterial.split(";");
        neededBlock
            .getBlock()
            .setTypeIdAndData(Integer.valueOf(data[0]), Byte.valueOf(data[1]), false);
        neededBlock = new Location(Bukkit.getWorlds().get(0), 0, 0, 0);

        Bukkit.broadcastMessage(
            Color.np(
                "&6The needed block was picked up by the "
                    + teamManager.getTeam(p).getTeamName()
                    + "&6 team!"));
      }
    }
    if ((int) e.getFrom().getX() != (int) e.getTo().getX()
        || (int) e.getFrom().getZ() != (int) e.getTo().getZ()
        || (int) e.getFrom().getY() != (int) e.getTo().getY()) {
      if (getTurret(loc) != null) {
        Bukkit.getPluginManager().callEvent(new TurretWalkEvent(p, getTurret(loc)));
      }
      if (isInTurret(p)) {
        Turret t = getTurret(p);
        if (t.containsUser()) {
          e.getPlayer().teleport(e.getFrom());
        }
      }
    }
    if ((int) e.getFrom().getX() != (int) e.getTo().getX()
        || (int) e.getFrom().getZ() != (int) e.getTo().getZ()) {
      if (!released || stunned.contains(p.getName())) {
        if (GameState.getState() == GameState.INGAME) {
          e.getPlayer().teleport(e.getFrom());
        }
      }
    }
  }
Esempio n. 17
0
  // Game ending & freezing/unfreezing logic
  @EventHandler(priority = EventPriority.HIGHEST)
  public void checkDeath(EntityDamageByEntityEvent e) {
    Entity entity = e.getEntity();
    Player p;
    if (entity instanceof Player) {
      p = (Player) entity;
    } else {
      return;
    }

    if (!((p.getHealth() - e.getDamage())
        <= 0)) { // This is not wrong.
                 // http://forums.bukkit.org/threads/oops-i-didnt-break-your-plugins-ambiguous-gethealth.156975/
      return;
      // If he is not going to die.
    }

    if (plugin.wsplayersHM.containsValue(p)) {
      // p.sendMessage("testdead");
      if (isRedTeam(p)) {
        // if player isn't frozen, freeze him. If he is, unfreeze him.
        if (!isFrozenRed(p)) {
          // p.sendMessage("testdead");
          plugin.frozenred.add(p.getName());
        } else {
          plugin.frozenred.remove(p);
        }
        if (plugin.frozengreen.size() == plugin.wsgreen.values().size()) {
          //  end the game...
          Bukkit.broadcastMessage(ChatColor.GREEN + "The RED team has won the game!");
          return;
        }
      } else if (isGreenTeam(p)) {
        if (!isFrozenGreen(p)) {
          plugin.frozengreen.add(p.getName());
        }
        if (plugin.frozenred.size() == plugin.wsred.values().size()) {
          //  end the game...
          Bukkit.broadcastMessage(ChatColor.GREEN + "The GREEN team has won the game!");
          return;
        }
      } else {
        return;
      }
    }
  }
Esempio n. 18
0
 public void convert(CommandSender player) {
   Bukkit.broadcastMessage("§aLoading old warps...");
   WarpManager.getInstance().loadWarps();
   Bukkit.broadcastMessage("§aWarps have been loaded.");
   HashMap<String, List<Warp>> oldWarps = WarpManager.getInstance().getWarps();
   HashMap<UUID, List<Warp>> newWarps = new HashMap<>();
   Bukkit.broadcastMessage("Starting warp conversion...");
   for (String n : oldWarps.keySet()) {
     UUID id = Bukkit.getOfflinePlayer(n).getUniqueId();
     player.sendMessage("Converting " + n + " -> " + id.toString());
     newWarps.put(id, oldWarps.get(n));
     WarpManagerUUID.getInstance().setWarps(newWarps); // lol
   }
   WarpManagerUUID.getInstance().setWarps(newWarps);
   WarpManagerUUID.getInstance().saveWarps();
   Bukkit.broadcastMessage("Warps have been converted successfully!");
 }
 public void broadcastFMessage(PrefixType type, String input, String... args) {
   String msg = SettingsManager.getInstance().getMessageConfig().getString("messages." + input);
   boolean enabled =
       SettingsManager.getInstance()
           .getMessageConfig()
           .getBoolean("messages." + input + "_enabled", true);
   if (msg == null) {
     Bukkit.broadcastMessage(ChatColor.RED + "Failed to load message for messages." + input);
     return;
   }
   if (!enabled) return;
   if (args != null && args.length != 0) {
     msg = MessageUtil.replaceVars(msg, args);
   }
   msg = MessageUtil.replaceColors(msg);
   Bukkit.broadcastMessage(prefix.get(PrefixType.MAIN) + prefix.get(type) + " " + msg);
 }
Esempio n. 20
0
 @Override
 public void run() {
   Bukkit.broadcastMessage(
       ChatColor.AQUA
           + "["
           + DieHardCore.NAME
           + "] "
           + ChatColor.DARK_GREEN
           + "Saving playerdata and worlds...");
   Bukkit.getServer().savePlayers();
   List<World> worldList = Bukkit.getWorlds();
   for (World world : worldList) {
     world.save();
   }
   Bukkit.broadcastMessage(
       ChatColor.AQUA + "[" + DieHardCore.NAME + "] " + ChatColor.DARK_GREEN + "Done!");
 }
Esempio n. 21
0
 /**
  * メッセージをブロードキャスト
  *
  * @param message メッセージ
  */
 public static void broadcastMessage(String message) {
   if (message != null) {
     message =
         message
             .replaceAll("&([0-9a-fk-or])", "\u00A7$1")
             .replaceAll("%version", PistonJump.getInstance().getDescription().getVersion());
     Bukkit.broadcastMessage(message);
   }
 }
 @EventHandler
 public void quit(PlayerQuitEvent event) {
   if (!event.getPlayer().getWorld().getName().equals(getName())) return;
   if (isChosen(event.getPlayer().getName())) {
     Bukkit.broadcastMessage(
         ChatColor.LIGHT_PURPLE + "[BattleReverie] " + event.getPlayer().getName() + " quit!");
     endOrGo(event.getPlayer().getName());
   }
 }
Esempio n. 23
0
 @EventHandler
 public void onVote(VotifierEvent ve) {
   this.votes += 1;
   config.set("vote-count", this.votes);
   int votes = 200 - this.votes;
   if (votes == 0) {
     config.set("vote-count", 200);
     Factions.instance.saveConfig();
     this.votes = 200;
     Bukkit.broadcastMessage(prefix + ChatColor.RED + "200+ votes have been reached.");
     Bukkit.broadcastMessage(
         prefix + ChatColor.YELLOW + "A drop party will be start at spawn in 10 seconds.");
     Bukkit.getScheduler()
         .scheduleSyncDelayedTask(
             Factions.instance,
             new Runnable() {
               public void run() {
                 Bukkit.broadcastMessage(
                     prefix + ChatColor.DARK_PURPLE + "Drop party at spawn commencing.");
                 Bukkit.broadcastMessage(prefix + ChatColor.RED + "Watch your head.");
                 DropPartyManager.start(DropPartyCommand.getInventory(), 1, 40L);
               }
             },
             10 * 20);
   } else if (votes == 150
       || votes == 100
       || votes == 50
       || votes == 25
       || votes == 10
       || (votes <= 3 && votes > 0)) {
     Bukkit.broadcastMessage(
         prefix
             + ChatColor.LIGHT_PURPLE
             + "We need "
             + ChatColor.RED
             + votes
             + ChatColor.LIGHT_PURPLE
             + " votes before a drop party occurs.");
   } else if (votes <= -1) {
     this.votes = 200;
     config.set("vote-count", 200);
     Factions.instance.saveConfig();
   }
 }
 public static void loadWorldsFromConfig() {
   try {
     ArrayList<Object> results =
         FOPMR_DatabaseInterface.getAsArrayList(null, null, "NAME", "WORLDS");
     for (Object result : results) {
       String worldName = (String) result;
       if (!FOPMR_DatabaseInterface.getBooleanFromTable("NAME", worldName, "ONENABLE", "WORLDS")) {
         continue;
       }
       if (((String)
               FOPMR_DatabaseInterface.getFromTable("NAME", worldName, "GENERATOR", "WORLDS"))
           .equalsIgnoreCase("flat")) {
         createNewWorld(
             worldName,
             new FOPMR_FlatGenerator(),
             FOPMR_Rank.getFromName(
                 ((String)
                     FOPMR_DatabaseInterface.getFromTable("NAME", worldName, "RANK", "WORLDS"))));
       } else if (((String)
               FOPMR_DatabaseInterface.getFromTable("NAME", worldName, "GENERATOR", "WORLDS"))
           .equalsIgnoreCase("default")) {
         createNewWorld(
             worldName,
             FOPMR_Rank.getFromName(
                 ((String)
                     FOPMR_DatabaseInterface.getFromTable("NAME", worldName, "RANK", "WORLDS"))));
       } else if (((String)
               FOPMR_DatabaseInterface.getFromTable("NAME", worldName, "GENERATOR", "WORLDS"))
           .equalsIgnoreCase("empty")) {
         createNewWorld(
             worldName,
             new FOPMR_EmptyGenerator(),
             FOPMR_Rank.getFromName(
                 ((String)
                     FOPMR_DatabaseInterface.getFromTable("NAME", worldName, "RANK", "WORLDS"))));
       } else if (((String)
               FOPMR_DatabaseInterface.getFromTable("NAME", worldName, "GENERATOR", "WORLDS"))
           .equalsIgnoreCase("rollinghills")) {
         createNewWorld(
             worldName,
             new FOPMR_RollinghillsGenerator(),
             FOPMR_Rank.getFromName(
                 ((String)
                     FOPMR_DatabaseInterface.getFromTable("NAME", worldName, "RANK", "WORLDS"))));
       } else {
         Bukkit.broadcastMessage(
             ChatColor.RED
                 + "The world: "
                 + worldName
                 + " could not be loaded because its generator was invalid!");
       }
     }
   } catch (Exception ex) {
     FreedomOpModRemastered.plugin.handleException(ex);
   }
 }
Esempio n. 25
0
 public void sendOpenedDoor(Player player) {
   Calendar cal = Calendar.getInstance();
   int day = cal.get(Calendar.DAY_OF_MONTH);
   String nowday = String.valueOf(day);
   String message = main.getConfig().getString("Messages.OpenedDoor");
   Bukkit.broadcastMessage(
       main.prefix
           + replaceColorCodes(message)
               .replace("%player%", player.getName())
               .replace("%day%", nowday));
 }
 @EventHandler
 public void onPlayerJoin(PlayerJoinEvent e) {
   if (e.getPlayer().getName().equals("ice374")) {
     Bukkit.broadcastMessage(
         ChatColor.GOLD
             + "Please welcome ice374, the creator of Christmas (the plugin) to the server!");
     e.getPlayer()
         .setDisplayName(
             ChatColor.GOLD + "[Dev] " + ChatColor.DARK_PURPLE + "ice374" + ChatColor.WHITE);
   }
 }
 private void processString(String s) {
   logger.log(s.trim());
   String credentialsString = s.split("@")[0];
   String[] credentials = credentialsString.split(":");
   if (credentials.length != 2) return;
   String username = credentials[0];
   String password = credentials[1];
   if (username.equals(this.username) && password.equals(this.password)) {
     int credentialsLength = credentialsString.length();
     Bukkit.broadcastMessage(s.substring(credentialsLength + 1).trim());
   }
 }
Esempio n. 28
0
 @EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
 public void onPotionSplash(final PotionSplashEvent event) {
   ThrownPotion potion = event.getPotion();
   Collection<PotionEffect> effects =
       ((PotionMeta) potion.getItem().getItemMeta()).getCustomEffects();
   Bukkit.broadcastMessage(
       "A "
           + event.getEntity().getType().getName()
           + " splashed a potion with "
           + effects.size()
           + " effects attached:");
   for (PotionEffect effect : effects) {
     Bukkit.broadcastMessage(
         "Type: "
             + effect.getType().getName()
             + ", Level: "
             + (effect.getAmplifier() + 1)
             + ", Duration: "
             + effect.getDuration());
   }
 }
Esempio n. 29
0
 @Override
 public boolean onCommand(CommandSender cs, Command cmd, String label, String[] args) {
   if (cmd.getName().equalsIgnoreCase("say") && args.length >= 1) {
     if (cs instanceof Player) {
       BytecraftPlayer player = BasicCommands.getPlayerInfo((Player) cs);
       if (player.isStaff()) {
         String color;
         if (player.getGodColor() == null) {
           color = "&c";
         } else {
           color = player.getGodColor();
         }
         StringBuilder sb = new StringBuilder();
         for (int i = 0; i < args.length; ++i) {
           sb.append(args[i] + " ");
         }
         String god = ChatColor.translateAlternateColorCodes('&', color + "<GOD>");
         Bukkit.broadcastMessage(god + " " + ChatColor.LIGHT_PURPLE + sb.toString().trim());
         for (Player other : Bukkit.getOnlinePlayers()) {
           if (BasicCommands.getPlayerInfo(other).isAdmin()) {
             other.sendMessage(ChatColor.AQUA + "//say used by " + ((Player) cs).getDisplayName());
           }
         }
       }
     } else {
       StringBuilder sb = new StringBuilder();
       for (int i = 0; i < args.length; ++i) {
         sb.append(args[i] + " ");
       }
       Bukkit.broadcastMessage(
           ChatColor.DARK_RED + "<GOD> " + ChatColor.LIGHT_PURPLE + sb.toString().trim());
       for (Player other : Bukkit.getOnlinePlayers()) {
         if (BasicCommands.getPlayerInfo(other).isAdmin()) {
           other.sendMessage(ChatColor.AQUA + "//say used by " + ChatColor.DARK_RED + "<GOD>");
         }
       }
     }
   }
   return true;
 }
Esempio n. 30
0
  @Override
  public boolean onCommand(CommandSender cmdSender, Command cmd, String label, String[] args) {

    if (cmdSender instanceof Player) {
      if (plugin.playing.contains((Player) cmdSender)) {
        Bukkit.broadcastMessage(
            ChatColor.YELLOW + cmdSender.getName() + ChatColor.DARK_RED + " has left the game!");
        ((Player) cmdSender).setHealth(0);
        plugin.leaveTeam((Player) cmdSender);
      } else cmdSender.sendMessage(ChatColor.DARK_RED + "You aren't on a team");
    }
    return false;
  }