Exemplo n.º 1
0
  public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
    String cmd = command.getName();

    if (cmd.equalsIgnoreCase("mchatwho")) {
      if (args.length > 0) {
        if (sender instanceof Player) {
          Player player = (Player) sender;
          if (!plugin
              .getAPI()
              .checkPermissions(player.getName(), player.getWorld().getName(), "mchat.who")) {
            Messanger.sendMessage(
                sender, plugin.getLocale().getOption("noPermissions") + " " + cmd + ".");
            return true;
          }
        }

        if (plugin.getServer().getPlayer(args[0]) == null) {
          sender.sendMessage(formatPNF(args[0]));
          return true;
        } else {
          Player receiver = plugin.getServer().getPlayer(args[0]);
          formatWho(sender, receiver);
          return true;
        }
      }
    }

    return false;
  }
Exemplo n.º 2
0
  public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
    String cmd = command.getName();

    if (!(sender instanceof Player)) {
      sender.sendMessage(formatPMessage(Messanger.addColour("Console's can't send PM's.")));
      return true;
    }

    Player player = (Player) sender;
    String pName = player.getName();
    String world = player.getWorld().getName();

    if (cmd.equalsIgnoreCase("pmchatinvite")) {
      if (args.length < 1) return false;

      if (!plugin
          .getAPI()
          .checkPermissions(player.getName(), player.getWorld().getName(), "mchat.pm.invite")) {
        player.sendMessage(
            formatPMessage(Messanger.addColour("You are not allowed to use Invite functions.")));
        return true;
      }

      Player recipient = plugin.getServer().getPlayer(args[0]);
      String rName = recipient.getName();
      String rWorld = recipient.getWorld().getName();

      if (recipient == null) {
        player.sendMessage(formatPNF(args[0]));
        return true;
      }

      if (plugin.getInvite.get(rName) == null) {
        plugin.getInvite.put(rName, pName);
        player.sendMessage(
            formatPMessage(
                Messanger.addColour(
                    "You have invited &5'&4"
                        + plugin.getAPI().ParsePlayerName(rName, rWorld)
                        + "&5'&4 to have a Convo.")));
        recipient.sendMessage(
            formatPMessage(
                Messanger.addColour(
                    "You have been invited to a Convo by &5'&4"
                        + plugin.getAPI().ParsePlayerName(pName, world)
                        + "&5'&4 use /pmchataccept to accept.")));
      } else
        player.sendMessage(
            formatPMessage(
                Messanger.addColour(
                    "&5'&4"
                        + plugin.getAPI().ParsePlayerName(rName, rWorld)
                        + "&5'&4 Already has a Convo request.")));

      return true;
    }

    return false;
  }
Exemplo n.º 3
0
 String formatPNF(String playerNotFound) {
   return (Messanger.addColour(
       Messanger.format("")
           + " "
           + plugin.getLocale().getOption("player")
           + " &e"
           + playerNotFound
           + " &4"
           + plugin.getLocale().getOption("notFound")));
 }
  public void save() {
    try {
      plugin.censor = config;
      plugin.censor.save(plugin.censorF);

      Messanger.log(
          plugin
              .getLocale()
              .getOption(LocaleType.CONFIG_UPDATED)
              .replace("%config%", "censor.yml"));
    } catch (Exception ignored) {
    }
  }
Exemplo n.º 5
0
  public void load() {
    if (!(new File(plugin.getDataFolder(), "info.yml").exists())) defaultConfig();

    YamlConfiguration config = plugin.mIConfig;
    YamlConfigurationOptions configO = config.options();

    if (config.get("users") == null) {
      config.set("users.MiracleM4n.group", "admin");
      config.set("users.MiracleM4n.worlds.DtK.prefix", "");
      config.set("users.MiracleM4n.info.suffix", "");
      config.set("users.MiracleM4n.info.prefix", "");

      hasChanged = true;
    }

    if (config.get("groups") == null) {
      config.set("groups.admin.worlds.DtK.prefix", "");
      config.set("groups.admin.info.prefix", "");
      config.set("groups.admin.info.suffix", "");
      config.set("groups.admin.info.custVar", "");

      hasChanged = true;
    }

    if (config.get("groupnames") == null) {
      config.set("groupnames.admin", "[a]");
      config.set("groupnames.sadmin", "[sa]");
      config.set("groupnames.jadmin", "[ja]");
      config.set("groupnames.member", "[m]");

      hasChanged = true;
    }

    if (config.get("worldnames") == null) {
      config.set("worldnames.D3GN", "[D]");
      config.set("worldnames.DtK", "[DtK]");
      config.set("worldnames.Nether", "[N]");
      config.set("worldnames.Hello", "[H]");

      hasChanged = true;
    }

    if (config.get("mname") == null) {
      config.set("mname.MiracleM4n", "M1r4c13M4n");
      config.set("mname.Jessica_RS", "M1r4c13M4n's Woman");

      hasChanged = true;
    }

    if (hasChanged) {
      configO.header("Info Config");

      save();
    }
  }
Exemplo n.º 6
0
  public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
    String cmd = command.getName();

    if (cmd.equalsIgnoreCase("mchatme")) {
      if (args.length > 0) {
        String message = "";

        for (String arg : args) message += " " + arg;

        message = message.trim();

        if (sender instanceof Player) {
          Player player = (Player) sender;
          World world = player.getWorld();

          if (plugin
              .getAPI()
              .checkPermissions(player.getName(), player.getWorld().getName(), "mchat.me"))
            plugin
                .getServer()
                .broadcastMessage(
                    plugin.getParser().parseMe(player.getName(), world.getName(), message));
          else
            Messanger.sendMessage(
                player,
                plugin
                    .getLocale()
                    .getOption(LocaleType.NO_PERMS)
                    .replace("%permission%", "mchat.me"));

          return true;
        } else {
          String senderName = "Console";
          plugin.getServer().broadcastMessage("* " + senderName + " " + message);
          Messanger.log("* " + senderName + " " + message);
          return true;
        }
      }
    }

    return false;
  }
Exemplo n.º 7
0
  void formatWho(CommandSender sender, Player recipient) {
    String recipientName =
        plugin.getAPI().ParsePlayerName(recipient.getName(), recipient.getWorld().getName());
    Integer locX = (int) recipient.getLocation().getX();
    Integer locY = (int) recipient.getLocation().getY();
    Integer locZ = (int) recipient.getLocation().getZ();
    String loc = ("X: " + locX + ", " + "Y: " + locY + ", " + "Z: " + locZ);
    String world = recipient.getWorld().getName();

    sender.sendMessage(
        Messanger.addColour(
            plugin.getLocale().getOption("player") + " Name: " + recipient.getName()));
    sender.sendMessage(Messanger.addColour("Display Name: " + recipient.getDisplayName()));
    sender.sendMessage(Messanger.addColour("Formatted Name: " + recipientName));
    sender.sendMessage(
        Messanger.addColour(
            plugin.getLocale().getOption("player") + "'s Location: [ " + loc + " ]"));
    sender.sendMessage(
        Messanger.addColour(plugin.getLocale().getOption("player") + "'s World: " + world));
    sender.sendMessage(
        Messanger.addColour(
            plugin.getLocale().getOption("player")
                + "'s Health: "
                + plugin.getAPI().healthBar(recipient)
                + " "
                + recipient.getHealth()
                + "/20"));
    sender.sendMessage(
        Messanger.addColour(
            plugin.getLocale().getOption("player")
                + "'s IP: "
                + recipient.getAddress().getHostString()));
    sender.sendMessage(
        Messanger.addColour("Current Item: " + recipient.getItemInHand().getType().name()));
    sender.sendMessage(Messanger.addColour("Entity ID: #" + recipient.getEntityId()));
  }
Exemplo n.º 8
0
 public void reload() {
   plugin.mIConfig = YamlConfiguration.loadConfiguration(plugin.mIConfigF);
   plugin.mIConfig.options().indent(4);
 }
Exemplo n.º 9
0
 @Override
 public boolean isEnabled() {
   return mChat != null && mChat.isEnabled();
 }
Exemplo n.º 10
0
 public void reload() {
   config = YamlConfiguration.loadConfiguration(plugin.censorF);
   plugin.censor = config;
   config.options().indent(4);
 }