Exemple #1
0
 public void staff(FancyMessage message) {
   for (Player p : Bukkit.getOnlinePlayers()) {
     if (p.hasPermission("sccore.staff")) {
       message.send(p);
     }
   }
 }
Exemple #2
0
  @EventHandler(priority = EventPriority.LOW)
  public void onPlayerChat(final AsyncPlayerChatEvent e) {
    List<Punishment> punishments = punishmentManager.getPunishments(e.getPlayer().getUniqueId());

    for (Punishment punishment : punishments) {
      if (punishment.getType().equals(PunishmentType.MUTE)) {
        if (!punishment.hasExpired()) {
          e.getPlayer().sendMessage("§cYou are permanently muted.");
          e.setCancelled(true);
          return;
        }
      }

      if (punishment.getType().equals(PunishmentType.TEMPMUTE)) {
        if (!punishment.hasExpired()) {
          e.getPlayer()
              .sendMessage(
                  "§cYou are temporarily muted until §3" + punishment.getEndTimestamp() + " §c.");
          e.setCancelled(true);
          return;
        }
      }
    }

    e.setCancelled(true);

    Player player = e.getPlayer();
    SCPlayer scPlayer = getSCPlayer(player.getUniqueId());

    if (player.isOp()) e.setMessage(e.getMessage().replace('&', ChatColor.COLOR_CHAR));

    FancyMessage message =
        new FancyMessage(" §7- ")
            .then(scPlayer.getTag())
            .tooltip(scPlayer.getHoverText())
            .then("§8: §7" + e.getMessage());

    for (final Player other : e.getRecipients()) {
      if (other.getWorld() != player.getWorld()) continue;
      if (other.getLocation().distanceSquared(player.getLocation()) <= 900) message.send(other);
    }
  }
Exemple #3
0
 public void broadcast(FancyMessage message) {
   for (Player p : Bukkit.getOnlinePlayers()) {
     message.send(p);
   }
 }