Пример #1
0
 @Override
 public final boolean onCommand(
     final CommandSender commandSender,
     final Command command,
     final String label,
     final String[] args) {
   final String senderName = commandSender.getName();
   final Player sender = Bukkit.getServer().getPlayer(senderName);
   if (sender.hasPermission("udsplugin.c")) {
     final UDSPlayer senderPlayer = UDSPlugin.getPlayers().get(senderName);
     if (senderPlayer.isInClan()) {
       final UDSPlayer serverPlayer = UDSPlugin.getPlayers().get(senderName);
       final String channel = serverPlayer.getChatChannel();
       if (!"clan".equals(channel)) {
         serverPlayer.setChatChannel("clan");
         sender.sendMessage(UDSMessage.CHAT_CLAN);
       } else {
         UDSPlugin.getPlayers().get(senderName).setChatChannel("norm");
         sender.sendMessage(UDSMessage.CHAT_NORM);
       }
     } else {
       sender.sendMessage(UDSMessage.NOT_IN_CLAN);
     }
   } else {
     sender.sendMessage(UDSMessage.NO_PERM);
   }
   return true;
 }
Пример #2
0
  @Override
  public final boolean onCommand(
      final CommandSender commandSender,
      final Command command,
      final String label,
      final String[] args) {
    final String senderName = commandSender.getName();
    final Server server = Bukkit.getServer();
    final Player sender = server.getPlayer(senderName);

    if (sender.hasPermission("udsplugin.lockdown")) {
      if (args.length == 0) {
        if (!UDSPlugin.getServerInLockdown()) {
          UDSPlugin.setServerInLockdown(true);
          UDSPlugin.getPlayers().get(senderName).setLockdownPass(true);
          server.broadcastMessage(Color.BROADCAST + "Server is now in lockdown.");
        } else {
          UDSPlugin.setServerInLockdown(false);
          server.broadcastMessage(Color.BROADCAST + "Server is no longer in lockdown.");
          for (Map.Entry<String, UDSPlayer> i : UDSPlugin.getPlayers().entrySet()) {
            i.getValue().setLockdownPass(false);
          }
        }
      } else if (args.length == 1) {
        final UDSPlayer serverPlayer = PlayerUtils.matchUDS(args[0]);
        if (serverPlayer != null) {

          final String targetName = serverPlayer.getNick();
          if (serverPlayer.hasLockdownPass()) {
            serverPlayer.setLockdownPass(false);
            sender.sendMessage(Color.MESSAGE + targetName + "'s lockdown pass has been removed.");
          } else {
            serverPlayer.setLockdownPass(true);
            sender.sendMessage(
                Color.MESSAGE + targetName + " has been issued with a lockdown pass.");
          }
        } else {
          sender.sendMessage(UDSMessage.NO_PLAYER);
        }
      } else {
        sender.sendMessage(UDSMessage.BAD_ARGS);
      }
    } else {
      sender.sendMessage(UDSMessage.NO_PERM);
    }
    return true;
  }
Пример #3
0
  @Override
  public final boolean onCommand(
      final CommandSender commandSender,
      final Command command,
      final String label,
      final String[] args) {
    String senderName = commandSender.getName();
    Server server = Bukkit.getServer();
    Player sender = server.getPlayer(senderName);
    String commandName = command.getName();

    if (commandName.equalsIgnoreCase("udsreload")) {
      if (sender.hasPermission("udsplugin.udsreload")) {
        plugin.reloadConfig();
        UDSPlugin.getUDSConfig().load(plugin.getConfig());
        sender.sendMessage(UDSMessage.MSG_RELOAD);
      } else {
        sender.sendMessage(UDSMessage.NO_PERM);
      }
    } else {
      sender.sendMessage(UDSMessage.BAD_COMMAND);
    }
    return true;
  }
 public boolean pvp(Player attacker, Player defender) {
   final UDSHashMap<UDSPlayer> udsPlayers = UDSPlugin.getPlayers();
   final UDSPlayer udsDefender = udsPlayers.get(defender.getName());
   final UDSPlayer udsAttacker = udsPlayers.get(attacker.getName());
   if (udsDefender.hasChallenge() && udsAttacker.hasChallenge()) {
     return false;
   } else if (!RegionUtils.canPvp(defender.getLocation())
       || !RegionUtils.canPvp(attacker.getLocation())) {
     attacker.sendMessage(UDSMessage.NO_PVP);
     return true;
   } else if (!udsDefender.isInClan()) {
     attacker.sendMessage(UDSMessage.PVP_PLAYER_NO_CLAN);
     return true;
   } else if (!udsAttacker.isInClan()) {
     attacker.sendMessage(UDSMessage.PVP_NO_CLAN);
   } else if (udsDefender.getClan().equals(udsAttacker.getClan())) {
     return true;
   }
   udsAttacker.newAttack(System.currentTimeMillis());
   return false;
 }
Пример #5
0
 @Override
 public final void playerExecute() {
   if (minArgsHelp(1)) {
     UDSPlugin.sendBroadcast(argsToMessage());
   }
 }