Report

Discussion in 'Plugin Requests' started by TheHoboHomeless, Sep 26, 2015.

Thread Status:
Not open for further replies.
  1. Offline

    TheHoboHomeless

    Plugin category: Administration

    Suggested name: ExodusReport

    What I want: When a player executes the command /report <name> <reason> it will notify all online staff members with the permission exodusreport.report.notify. I would also like the messages to be configurable, I want the two messages below the same on separate lines.

    1st line of message: [​IMG]
    2nd line of message: [​IMG]


    - The two messages above will be sent to staff with the correct permission. -

    Also, skim-reading is much easier with paragraphs!

    Ideas for commands: /report <name> <reason> (With a configurable cool down)

    Ideas for permissions: exoduspvp.report
    exoduspvp.report.notify


    When I'd like it by: ASAP.
     
  2. Offline

    tkuiyeager1

    @TheHoboHomeless I will try to make it for you.

    Edit:
    The sender can also report?
     
    Last edited: Sep 26, 2015
  3. Offline

    Chromify

    There's already a plugin like this btw.


    Don't waste your time coding a plugin that already exists. :)
     
  4. Offline

    timtower Ninja on the waves Moderator

    @Chromify Would be nice that if you say that it exists that you link it.
     
  5. Offline

    tkuiyeager1

  6. Offline

    TheHoboHomeless

    No, @tkuiyeager1. I want the message color to be configurable in the config.yml. And I also forgot to add when the player executes the command it sends them a message saying "&cThanks for your report, all online staff will be notified and will be handled soon."
     
  7. Offline

    tkuiyeager1

    @TheHoboHomeless Ok.

    Guys i have a problem, the config is not replacing: <player> with the player name. i know this should be on plugin development but i need help with this plugin.
    Code:
    Code:
    if (label.equalsIgnoreCase("report")) {
                if (!(sender instanceof Player)) {
                    sender.sendMessage(prefix + "§cOnly Players Can Report!");
                    return false;
                }
                Player p = (Player) sender;
                if (p.hasPermission("exoduspvp.report")) {
                    if (args.length >= 2) {
                        Player t = Bukkit.getPlayer(args[0]);
                        if (t != null) {
                            StringBuilder str = new StringBuilder();
                            for (int i = 1; i < args.length; i++) {
                                str.append(args[i]);
                                str.append(" ");
                            }
                            String reason = str.toString();
                            String reasoncolor = ChatColor
                                    .translateAlternateColorCodes('&', reason);
                            p.sendMessage(prefix + "§cThanks for your report, all online staff will be notified and will be handled soon.");
                            for (Player player : Bukkit.getServer()
                                    .getOnlinePlayers()) {
                                if (player.hasPermission("exoduspvp.report.notify")) {
                                    String reportmessageone = getConfig()
                                            .getString("ReportMessageONE");
                                    reportmessageone.replaceAll("<player>",
                                            p.getName());
                                    reportmessageone.replaceAll("<reportedplayer>",
                                            t.getName());
                                    String reportmessageonecolor = ChatColor
                                            .translateAlternateColorCodes('&',
                                                    reportmessageone);
                                    String reportmessagetwo = getConfig()
                                            .getString("ReportMessageTWO");
                                    reportmessagetwo.replace("<reason>",
                                            reasoncolor);
                                    String reportmessagetwocolor = ChatColor
                                            .translateAlternateColorCodes('&',
                                                    reportmessagetwo);
                                    player.sendMessage(prefix
                                            + reportmessageonecolor);
                                    player.sendMessage(prefix
                                            + reportmessagetwocolor);
                                }
                            }
                        } else {
                            p.sendMessage(prefix + "§7Player Is Not Online");
                            return false;
                        }
                    } else {
                        p.sendMessage(prefix
                                + "§7Please Use This Usage: /report <name> <reason>");
                        return false;
                    }
                } else {
                    p.sendMessage(prefix
                            + "§7You Don't Have Permission To Use This Command");
                    return false;
                }
            }
            return true;
        }
    Config:
    Code:
    ReportMessageONE: "&6<player> &7was reported by &6<reportedplayer>"
    ReportMessageTWO: "&7Reason&8: &6<reason>"
    @timtower or @Chromify can you help me with this?

    EDIT by Timtower: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: Sep 26, 2015
  8. Offline

    timtower Ninja on the waves Moderator

    @tkuiyeager1 replaceAll returns a string, you aren't catching that string.
     
  9. Offline

    tkuiyeager1

    @timtower i also tried replace and its still not working.
     
  10. Offline

    timtower Ninja on the waves Moderator

    @tkuiyeager1 You just call the method like
    Code:
    somestring.replace
    But you need to use
    Code:
    somestring=somestring.replace
     
  11. Offline

    tkuiyeager1

    @timtower thank you very much.
    @TheHoboHomeless here is the link to the plugin.
    if you need anything to be changed just reply again.

    EDIT:
    also only players who have the permission you said can use this commands, op with out this permission cant use this command. Only player who have this permission can use those command. i mean someone who is op cant use this commands if he dont have permission so he cant use it
     
    Last edited: Sep 26, 2015
  12. Offline

    Chromify

    You can just google "Report plugin bukkit" and browse through them.

    I'm not a big coder, but I code extremely tiny plugins such as a plugin that when you enter a command, it runs a command from console, which can easily be done in-game anyway. :p
     
  13. Offline

    tkuiyeager1

    ok @Chromify.

    EDIT:
    i did it so they can use chat colors so if you want to chage it please reply.
     
    Last edited: Sep 26, 2015
  14. Offline

    tkuiyeager1

  15. Offline

    Skrubzy

    It's not my plugin request, but could you add a cooldown customization in the config? Like in seconds.
     
  16. Offline

    tkuiyeager1

    @Skrubzy Do you mean that if player is writing a report, then he can report again in the time that the config says?

    EDIT:
    also @TheHoboHomeless why arent you replying to the thread and tell me if you liked the plugin?
     
  17. Offline

    Skrubzy

    Yes, with a default cooldown of 2 minuets or something but editable in the config. (By seconds)
     
  18. Offline

    tkuiyeager1

    Last edited by a moderator: Oct 1, 2015
Thread Status:
Not open for further replies.

Share This Page