<commit_before>from helpers import *
from java.util.UUID import fromString as id_to_player
import time
import thread


time_format   = "%Y.%m.%d %H:%M"
reports       = open_json_file("reports", [])
check_reports = True
check_delay   = 60 * 10 # Every 10 minutes, staff will be notified about pending reports.
rp_permission = "utils.rp"


def print_help(sender):
  msg(sender, " &2/report <text> &eReport something")
  msg(sender, " &2/rp list          &eList unresolved reports (id, player, text)")
  msg(sender, " &2/rp tp <id>      &eTeleport to report's location & show details")
  msg(sender, " &2/rp del <id>     &eResolve a report")


def print_list(sender):
  msg(sender, "&a" + str(len(reports)) + " reports:")
  for i, report in enumerate(reports):
    msg(sender, "&8[&e" + str(i) + " &c" + report["time"] + "&8] &3" + server.getOfflinePlayer(id_to_player(report["uuid"])).getName() + "&f: &a" + report["msg"])


def tp_report(sender, rep_id):
  if rep_id >= len(reports) or rep_id < 0:
    msg(sender, "&cReport &3#" + str(rep_id) + "&c does not exist!")
    return True
  else:
    report = reports[rep_id]
    safetp(sender, server.getWorld(report["world"]), report["x"], report["y"], report["z"], report["yaw"], report["pitch"])
    msg(sender, "&aTeleported to report #%s" % rep_id )


def delete_report(sender, rep_id):
  if len(reports) > rep_id >= 0:
    report = reports[rep_id]
    reports.pop(rep_id)
    save_reports()
    msg(sender, "&aReport #%s deleted." % rep_id)
    reporter = server.getOfflinePlayer(id_to_player(report["uuid"]))
    plugin_header(reporter, "Report")
    msg(reporter, "&aReport '&e%s&a' was resolved by %s." % (report["msg"], sender.getName()))
  else:
    msg(sender, "&cThat report does not exist!")


def save_reports():
  save_json_file("reports", reports)


@hook.command("rp")
def on_rp_command(sender, args):
  if sender.hasPermission(rp_permission):
    plugin_header(sender, "Reports")
    if len(args) > 0:
      if args[0] == "list":
        print_list(sender)
      else:
        if not checkargs(sender, args, 2, 2):
          return True
        try:<commit_msg>get rid of dico's stupid nonsense :3<commit_after>from helpers import *
from java.util.UUID import fromString as juuid
import time
import thread


time_format   = "%Y.%m.%d %H:%M"
reports       = open_json_file("reports", [])
check_reports = True
check_delay   = 60 * 10 # Every 10 minutes, staff will be notified about pending reports.
rp_permission = "utils.rp"


def print_help(sender):
  msg(sender, " &2/report <text> &eReport something")
  msg(sender, " &2/rp list          &eList unresolved reports (id, player, text)")
  msg(sender, " &2/rp tp <id>      &eTeleport to report's location & show details")
  msg(sender, " &2/rp del <id>     &eResolve a report")


def print_list(sender):
  msg(sender, "&a" + str(len(reports)) + " reports:")
  for i, report in enumerate(reports):
    name = server.getOfflinePlayer(juuid(report["uuid"])).getName()
    msg(sender, "&8[&e%s&c%s&8] &3%s&f: &a%s" % (i, report["time"], name, report["msg"]))


def tp_report(sender, rep_id):
  if rep_id >= len(reports) or rep_id < 0:
    msg(sender, "&cReport &3#" + str(rep_id) + "&c does not exist!")
    return True
  else:
    report = reports[rep_id]
    safetp(sender, server.getWorld(report["world"]), report["x"], report["y"], report["z"], report["yaw"], report["pitch"])
    msg(sender, "&aTeleported to report #%s" % rep_id )


def delete_report(sender, rep_id):
  if len(reports) > rep_id >= 0:
    report = reports[rep_id]
    reports.pop(rep_id)
    save_reports()
    msg(sender, "&aReport #%s deleted." % rep_id)
    reporter = server.getOfflinePlayer(juuid(report["uuid"]))
    plugin_header(reporter, "Report")
    msg(reporter, "&aReport '&e%s&a' was resolved by %s." % (report["msg"], sender.getName()))
  else:
    msg(sender, "&cThat report does not exist!")


def save_reports():
  save_json_file("reports", reports)


@hook.command("rp")
def on_rp_command(sender, args):
  if sender.hasPermission(rp_permission):
    plugin_header(sender, "Reports")
    if len(args) > 0:
      if args[0] == "list":
        print_list(sender)
      else:
        if not checkargs(sender, args, 2, 2):
          return True
        try:
{'fraction_non_alphanumeric': 0.16462841015992474, 'fraction_numerical': 0.009642521166509878, 'mean_word_length': 3.980093676814988, 'pattern_counts': {'":': 2, '<': 11, '<?xml version=': 0, '>': 17, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4345917', 'n_tokens_mistral': 1562, 'n_tokens_neox': 1498, 'n_words': 384}