Complete
This commit is contained in:
parent
7a21ac1295
commit
c6fb20d686
6
bin/.gitignore
vendored
6
bin/.gitignore
vendored
@ -1 +1,7 @@
|
||||
/com/
|
||||
/bungee.yml
|
||||
/config.yml
|
||||
/lang.yml
|
||||
/lang_cn.yml
|
||||
/lang_en.yml
|
||||
/plugin.yml
|
||||
|
||||
2
pom.xml
2
pom.xml
@ -23,7 +23,7 @@
|
||||
<resources>
|
||||
<resource>
|
||||
<targetPath>.</targetPath>
|
||||
<directory>${basedir}</directory>
|
||||
<directory>${basedir}/src/</directory>
|
||||
</resource>
|
||||
</resources>
|
||||
<plugins>
|
||||
|
||||
BIN
target/BugRepGUI-b.jar
Normal file
BIN
target/BugRepGUI-b.jar
Normal file
Binary file not shown.
4
target/classes/bungee.yml
Normal file
4
target/classes/bungee.yml
Normal file
@ -0,0 +1,4 @@
|
||||
name: BugRepGUI
|
||||
main: com.ilummc.bugrepgui.bungee.Main
|
||||
version: 1.5b
|
||||
author: IzzelAliz
|
||||
124
target/classes/com/ilummc/bugrepgui/Bug.java
Normal file
124
target/classes/com/ilummc/bugrepgui/Bug.java
Normal file
@ -0,0 +1,124 @@
|
||||
package com.ilummc.bugrepgui;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.OfflinePlayer;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.inventory.meta.SkullMeta;
|
||||
|
||||
public class Bug {
|
||||
/*
|
||||
* SERIAL REPNAME REPTIME REPMSG EXENAME EXETIME EXEMSG EXECUTED BACK METHOD
|
||||
*/
|
||||
@SuppressWarnings("deprecation")
|
||||
OfflinePlayer player = Bukkit.getOfflinePlayer("Steve"), exeplayer = Bukkit.getOfflinePlayer("Steve");
|
||||
String repmsg = "", reptime = "", exetime = "", exemsg = "";
|
||||
Date date = new Date();
|
||||
Locale l;
|
||||
Integer serial = 0, method = 0;
|
||||
|
||||
public Bug(Player player) {
|
||||
this.player = player;
|
||||
repmsg = "";
|
||||
date = new Date();
|
||||
l = new Locale(Storage.getConfig().getString("lang"), Storage.getConfig().getString("locale"));
|
||||
reptime = String.format(l, "%tc", date);
|
||||
}
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
public Bug(int serial, String reptime, String repname, String repmsg) {
|
||||
this.repmsg = repmsg;
|
||||
this.reptime = reptime;
|
||||
this.serial = serial;
|
||||
this.player = Bukkit.getOfflinePlayer(repname);
|
||||
|
||||
}
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
public Bug(int serial, String reptime, String repname, String repmsg, String exetime, String exename, String exemsg,
|
||||
Integer method) {
|
||||
this.repmsg = repmsg;
|
||||
this.reptime = reptime;
|
||||
this.serial = serial;
|
||||
this.player = Bukkit.getOfflinePlayer(repname);
|
||||
this.exeplayer = Bukkit.getOfflinePlayer(exename);
|
||||
this.exetime = exetime;
|
||||
this.exemsg = exemsg;
|
||||
this.method = method;
|
||||
}
|
||||
|
||||
public ItemStack toItem() {
|
||||
ItemStack head = new ItemStack(Material.SKULL_ITEM, 1, (short) 3);
|
||||
SkullMeta m = (SkullMeta) head.getItemMeta();
|
||||
m.setOwner(player.getName());
|
||||
m.setDisplayName(serial.toString());
|
||||
List<String> l = new ArrayList<>();
|
||||
l.add("¡ìb" + player.getName());
|
||||
l.add("¡ìe" + reptime + "¡ìf");
|
||||
String[] lorem = this.repmsg.split("#");
|
||||
for (int i = 0; i < lorem.length; i++) {
|
||||
l.add("¡ìe" + lorem[i]);
|
||||
}
|
||||
m.setLore(l);
|
||||
head.setItemMeta(m);
|
||||
return head;
|
||||
}
|
||||
|
||||
public ItemStack toItemExecuted(){
|
||||
ItemStack head = new ItemStack(Material.SKULL_ITEM, 1 ,(short)3);
|
||||
SkullMeta m =(SkullMeta) head.getItemMeta();
|
||||
m.setOwner(player.getName());
|
||||
m.setDisplayName("¡ìa#"+serial.toString());
|
||||
List<String> l = new ArrayList<>();
|
||||
l.add("¡ìb"+player.getName());
|
||||
l.add("¡ìe"+reptime+"¡ìf");
|
||||
String[] lorem= this.repmsg.split("#");
|
||||
for(int i=0;i<lorem.length;i++){
|
||||
l.add("¡ìe"+lorem[i]);
|
||||
}
|
||||
String methodmsg = "";
|
||||
if(method == 1) methodmsg = Storage.getMsg("method-manualreply");
|
||||
if(method == 2) methodmsg = Storage.getMsg("method-autoreply");
|
||||
if(method == 3) methodmsg = Storage.getMsg("method-ignore");
|
||||
l.add("¡ì9================");
|
||||
l.add(exetime);
|
||||
l.add(Storage.getMsg("item-msg").replaceAll("%exename%", exeplayer.getName()).replaceAll("%method%", methodmsg));
|
||||
l.add(exemsg);
|
||||
m.setLore(l);
|
||||
head.setItemMeta(m);
|
||||
return head;
|
||||
}
|
||||
|
||||
public void append(String msg) {
|
||||
if (repmsg.equals("")) {
|
||||
this.repmsg = msg;
|
||||
return;
|
||||
}
|
||||
this.repmsg = this.repmsg + "#" + msg;
|
||||
return;
|
||||
}
|
||||
|
||||
public String getMsg() {
|
||||
return this.repmsg;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return this.player.getName();
|
||||
}
|
||||
|
||||
public String getRepTime() {
|
||||
return this.reptime;
|
||||
}
|
||||
|
||||
public String getExeTime() {
|
||||
return this.exetime;
|
||||
}
|
||||
public String getRepUUID(){
|
||||
return this.player.getUniqueId().toString();
|
||||
}
|
||||
}
|
||||
338
target/classes/com/ilummc/bugrepgui/Database.java
Normal file
338
target/classes/com/ilummc/bugrepgui/Database.java
Normal file
@ -0,0 +1,338 @@
|
||||
package com.ilummc.bugrepgui;
|
||||
|
||||
import java.sql.*;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.TreeMap;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
public class Database {
|
||||
/*
|
||||
* SERIAL REPNAME REPTIME REPMSG EXENAME EXETIME EXEMSG EXECUTED BACK
|
||||
* EXECUTED 1:MANUALREPLY 2:AUTOREPLY 3:IGNORE
|
||||
*/
|
||||
private static String dbtype = Storage.getConfig().getString("database", "sqlite");
|
||||
private static Connection c = null;
|
||||
private static Statement state = null;
|
||||
private static String autoback = Storage.getConfig().getString("auto-sendback-msg");
|
||||
public static String format = Storage.getMsg("join-notify");
|
||||
public static String format2 = Storage.getMsg("join-notify2");
|
||||
|
||||
public static void test(){
|
||||
connect();
|
||||
String sql = "INSERT INTO br_bug (REPNAME, REPTIME, REPMSG, EXENAME, EXETIME, EXEMSG, EXECUTED, BACK)"
|
||||
+ " VALUES ('a','b','c','d','g','h',1,1);";
|
||||
try {
|
||||
state.executeUpdate(sql);
|
||||
} catch (SQLException e) {
|
||||
Storage.logExcept(e);
|
||||
}
|
||||
}
|
||||
public static Map<String, Integer> loadStatsRep() {
|
||||
connect();
|
||||
String sql = "SELECT REPNAME FROM br_bug;";
|
||||
Map<String, Integer> reprank = new TreeMap<>();
|
||||
Integer repmax = 1;
|
||||
try {
|
||||
ResultSet res = state.executeQuery(sql);
|
||||
while (res.next()) {
|
||||
String repname = res.getString("REPNAME");
|
||||
if (reprank.containsKey(repname)) {
|
||||
reprank.replace(repname, reprank.get(repname) + 1);
|
||||
if (repmax < reprank.get(repname))
|
||||
repmax++;
|
||||
} else {
|
||||
reprank.put(repname, 1);
|
||||
}
|
||||
}
|
||||
} catch (SQLException e) {
|
||||
Storage.logExcept(e);
|
||||
}
|
||||
return reprank;
|
||||
}
|
||||
|
||||
public static Map<String, Integer> loadStatsExe() {
|
||||
connect();
|
||||
String sql = "SELECT EXENAME,EXECUTED FROM br_bug;";
|
||||
Map<String, Integer> exerank = new TreeMap<>();
|
||||
Integer exemax = 1;
|
||||
try {
|
||||
ResultSet res = state.executeQuery(sql);
|
||||
while (res.next()) {
|
||||
String exename = res.getString("EXENAME");
|
||||
if (exerank.containsKey(exename)) {
|
||||
exerank.replace(exename, exerank.get(exename) + 1);
|
||||
if (exemax < exerank.get(exename))
|
||||
exemax++;
|
||||
} else {
|
||||
exerank.put(exename, 1);
|
||||
}
|
||||
}
|
||||
} catch (SQLException e) {
|
||||
Storage.logExcept(e);
|
||||
}
|
||||
return exerank;
|
||||
}
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
public static Player getRepPlayer(String serial) {
|
||||
connect();
|
||||
String sql = "SELECT REPNAME FROM br_bug WHERE SERIAL =" + serial + ";";
|
||||
String name = "Steve";
|
||||
try {
|
||||
ResultSet res = state.executeQuery(sql);
|
||||
if (res.next()) {
|
||||
name = res.getString("REPNAME");
|
||||
res.close();
|
||||
res = null;
|
||||
}
|
||||
} catch (SQLException e) {
|
||||
Storage.logExcept(e);
|
||||
} finally {
|
||||
close();
|
||||
}
|
||||
return Bukkit.getPlayer(name);
|
||||
}
|
||||
|
||||
public static void check(Player player) {
|
||||
connect();
|
||||
String sql = "SELECT SERIAL,EXEMSG,EXENAME FROM br_bug WHERE REPNAME = '" + player.getName()
|
||||
+ "' AND (EXECUTED = 1 OR EXECUTED = 2) AND BACK = 0 ORDER BY SERIAL ASC;";
|
||||
String send[] = new String[12];
|
||||
Integer[] ser = new Integer[6];
|
||||
try {
|
||||
ResultSet res = state.executeQuery(sql);
|
||||
int limit = 0;
|
||||
while (((limit += 2) < 12) && res.next()) {
|
||||
Integer serial = res.getInt("SERIAL");
|
||||
String msg = res.getString("EXEMSG");
|
||||
String exename = res.getString("EXENAME");
|
||||
String str = format.replaceAll("%serial%", serial.toString()).replaceAll("%exename%", exename)
|
||||
.replaceAll("%reply%", msg);
|
||||
String str2 = format2.replaceAll("%serial%", serial.toString()).replaceAll("%exename%", exename)
|
||||
.replaceAll("%reply%", msg);
|
||||
send[limit - 2] = Storage.compile(str);
|
||||
send[limit - 1] = Storage.compile(str2);
|
||||
ser[limit / 2] = serial;
|
||||
}
|
||||
res.close();
|
||||
} catch (SQLException e) {
|
||||
Storage.logExcept(e);
|
||||
}
|
||||
Storage.sends(player, send);
|
||||
close();
|
||||
setback(ser);
|
||||
}
|
||||
|
||||
public static void setback(Integer[] ser) {
|
||||
connect();
|
||||
for (int i = 1; i < (ser.length) && (ser[i] != null); i++) {
|
||||
String sql2 = "UPDATE br_bug SET BACK = 1 WHERE SERIAL = " + ser[i].toString() + ";";
|
||||
try {
|
||||
state.executeUpdate(sql2);
|
||||
} catch (SQLException e) {
|
||||
Storage.logExcept(e);
|
||||
}
|
||||
}
|
||||
close();
|
||||
}
|
||||
|
||||
public static void setback(String ser) {
|
||||
connect();
|
||||
String sql = "UPDATE br_bug SET BACK = 1 WHERE SERIAL = " + ser + ";";
|
||||
try {
|
||||
state.executeUpdate(sql);
|
||||
} catch (SQLException e) {
|
||||
Storage.logExcept(e);
|
||||
}
|
||||
close();
|
||||
}
|
||||
|
||||
public static void qback(String serial, Player player) {
|
||||
// auto reply method
|
||||
connect();
|
||||
Date date = new Date();
|
||||
String exetime = String.format("%tc", date);
|
||||
String sql = "UPDATE br_bug SET EXETIME = '" + exetime + "', EXENAME = '" + player.getName()
|
||||
+ "' ,EXECUTED = 2, EXEMSG = '" + autoback + "' WHERE SERIAL = " + serial + ";";
|
||||
try {
|
||||
state.executeUpdate(sql);
|
||||
} catch (SQLException e) {
|
||||
Storage.logExcept(e);
|
||||
}
|
||||
close();
|
||||
}
|
||||
|
||||
public static void back(String serial, String msg, Player player) {
|
||||
// manual reply method
|
||||
connect();
|
||||
Date date = new Date();
|
||||
String exetime = String.format("%tc", date);
|
||||
String sql = "UPDATE br_bug SET EXETIME = '" + exetime + "', EXENAME = '" + player.getName()
|
||||
+ "', EXECUTED = 1, EXEMSG = '" + msg + "' WHERE SERIAL = " + serial + ";";
|
||||
try {
|
||||
state.executeUpdate(sql);
|
||||
} catch (SQLException e) {
|
||||
Storage.logExcept(e);
|
||||
}
|
||||
close();
|
||||
}
|
||||
|
||||
public static List<Bug> list() {
|
||||
connect();
|
||||
List<Bug> set = new ArrayList<>();
|
||||
String sql = "SELECT SERIAL,REPTIME,REPNAME,REPMSG FROM br_bug WHERE EXECUTED = 0;";
|
||||
try {
|
||||
ResultSet res = state.executeQuery(sql);
|
||||
while (res.next()) {
|
||||
Bug bug = new Bug(res.getInt("SERIAL"), res.getString("REPTIME"), res.getString("REPNAME"),
|
||||
res.getString("REPMSG"));
|
||||
set.add(bug);
|
||||
}
|
||||
} catch (SQLException e) {
|
||||
Storage.logExcept(e);
|
||||
}
|
||||
close();
|
||||
return set;
|
||||
}
|
||||
|
||||
public static List<Bug> listHis() {
|
||||
connect();
|
||||
List<Bug> set = new ArrayList<>();
|
||||
String sql = "SELECT SERIAL,REPTIME,REPNAME,REPMSG,EXENAME,EXETIME,EXEMSG,EXECUTED FROM br_bug WHERE BACK = 1";
|
||||
try {
|
||||
ResultSet res = state.executeQuery(sql);
|
||||
while (res.next()) {
|
||||
Bug bug = new Bug(res.getInt("SERIAL"), res.getString("REPTIME"), res.getString("REPNAME"),
|
||||
res.getString("REPMSG"), res.getString("EXETIME"), res.getString("EXENAME"),
|
||||
res.getString("EXEMSG"), res.getInt("EXECUTED"));
|
||||
set.add(bug);
|
||||
}
|
||||
} catch (SQLException e) {
|
||||
Storage.logExcept(e);
|
||||
}
|
||||
close();
|
||||
return set;
|
||||
}
|
||||
|
||||
public static void insert(Bug bug) {
|
||||
connect();
|
||||
String sql = "INSERT INTO br_bug (REPTIME,REPNAME,REPMSG,EXECUTED,BACK)" + " VALUES ('" + bug.getRepTime()
|
||||
+ "','" + bug.getName() + "','" + bug.getMsg() + "',0,0);";
|
||||
try {
|
||||
state.executeUpdate(sql);
|
||||
} catch (SQLException e) {
|
||||
Storage.logExcept(e);
|
||||
}
|
||||
close();
|
||||
}
|
||||
|
||||
public static void ignore(String serial, Player player) {
|
||||
connect();
|
||||
Date date = new Date();
|
||||
String exetime = String.format("tc", date);
|
||||
String sql = "UPDATE br_bug SET EXETIME = '" + exetime + "', EXENAME = '" + player.getName()
|
||||
+ "', EXECUTED = 3 WHERE SERIAL = " + serial + ";";
|
||||
try {
|
||||
state.executeUpdate(sql);
|
||||
} catch (SQLException e) {
|
||||
Storage.logExcept(e);
|
||||
}
|
||||
close();
|
||||
}
|
||||
|
||||
public static String getSerial(Player player) {
|
||||
connect();
|
||||
String sql = "SELECT SERIAL FROM br_bug WHERE REPNAME = '" + player.getName() + "' ORDER BY SERIAL DESC;";
|
||||
Integer i = 0;
|
||||
try {
|
||||
ResultSet res = state.executeQuery(sql);
|
||||
if (res.next()) {
|
||||
i = res.getInt("SERIAL");
|
||||
}
|
||||
res.close();
|
||||
res = null;
|
||||
} catch (SQLException e1) {
|
||||
Storage.logExcept(e1);
|
||||
} finally {
|
||||
close();
|
||||
}
|
||||
return i.toString();
|
||||
}
|
||||
|
||||
public static void connect() {
|
||||
if (dbtype.equalsIgnoreCase("sqlite")) {
|
||||
conSQLite();
|
||||
}
|
||||
if (dbtype.equalsIgnoreCase("mysql")) {
|
||||
if (!conMySQL()) {
|
||||
Bukkit.getLogger().warning("[BugRepGUI] MySQL connect failed!");
|
||||
Bukkit.getLogger().warning("[BugRepGUI] Now using SQLite!");
|
||||
conSQLite();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static void close() {
|
||||
try {
|
||||
state.close();
|
||||
state = null;
|
||||
c.close();
|
||||
} catch (Exception e) {
|
||||
Storage.logExcept(e);
|
||||
}
|
||||
}
|
||||
|
||||
public static void conSQLite() {
|
||||
try {
|
||||
Class.forName("org.sqlite.JDBC");
|
||||
c = DriverManager.getConnection("jdbc:sqlite:" + Storage.getFolder().getAbsolutePath() + "/bug.db");
|
||||
state = c.createStatement();
|
||||
} catch (SQLException e) {
|
||||
Storage.logExcept(e);
|
||||
} catch (ClassNotFoundException e) {
|
||||
Storage.logExcept(e);
|
||||
}
|
||||
String sql = "CREATE TABLE IF NOT EXISTS br_bug " + "(SERIAL INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL,"
|
||||
+ " REPNAME TEXT NOT NULL, " + " REPTIME TEXT NOT NULL, "
|
||||
+ " REPMSG TEXT NOT NULL, " + " EXENAME TEXT, " + " EXETIME TEXT, "
|
||||
+ " EXEMSG TEXT, " + " EXECUTED INTEGER, " + " BACK INTEGER);";
|
||||
try {
|
||||
state.executeUpdate(sql);
|
||||
} catch (SQLException e) {
|
||||
Storage.logExcept(e);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public static boolean conMySQL() {
|
||||
String url = "jdbc:mysql://" + Storage.getConfig().getString("mysql-url") + ":"
|
||||
+ Storage.getConfig().getString("mysql-port") + "/" + Storage.getConfig().getString("mysql-db");
|
||||
try {
|
||||
Class.forName("com.mysql.jdbc.Driver");
|
||||
c = DriverManager.getConnection(url, Storage.getConfig().getString("mysql-username"),
|
||||
Storage.getConfig().getString("mysql-password"));
|
||||
state = c.createStatement();
|
||||
} catch (SQLException e) {
|
||||
Storage.logExcept(e);
|
||||
return false;
|
||||
} catch (ClassNotFoundException e) {
|
||||
Storage.logExcept(e);
|
||||
return false;
|
||||
}
|
||||
String sql = "CREATE TABLE IF NOT EXISTS br_bug " + "(SERIAL INT PRIMARY KEY AUTO_INCREMENT NOT NULL,"
|
||||
+ " REPNAME TEXT NOT NULL, " + " REPTIME TEXT NOT NULL, "
|
||||
+ " REPMSG TEXT NOT NULL, " + " EXENAME TEXT, " + " EXETIME TEXT, "
|
||||
+ " EXEMSG TEXT, " + " EXECUTED INT, " + " BACK INT);";
|
||||
try {
|
||||
state.executeUpdate(sql);
|
||||
} catch (SQLException e) {
|
||||
Storage.logExcept(e);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
142
target/classes/com/ilummc/bugrepgui/EventListener.java
Normal file
142
target/classes/com/ilummc/bugrepgui/EventListener.java
Normal file
@ -0,0 +1,142 @@
|
||||
package com.ilummc.bugrepgui;
|
||||
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.EventPriority;
|
||||
import org.bukkit.event.inventory.InventoryClickEvent;
|
||||
import org.bukkit.event.player.AsyncPlayerChatEvent;
|
||||
import org.bukkit.event.player.PlayerCommandPreprocessEvent;
|
||||
import org.bukkit.event.player.PlayerJoinEvent;
|
||||
import org.bukkit.event.player.PlayerMoveEvent;
|
||||
import org.bukkit.event.player.PlayerQuitEvent;
|
||||
import org.bukkit.inventory.Inventory;
|
||||
|
||||
public class EventListener implements org.bukkit.event.Listener {
|
||||
String alias;
|
||||
public EventListener setAlias(String msg) {
|
||||
this.alias = msg;
|
||||
return this;
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onCommand(PlayerCommandPreprocessEvent evt) {
|
||||
if (evt.getMessage().equalsIgnoreCase("/"+alias)) {
|
||||
evt.setCancelled(true);
|
||||
Player sender = evt.getPlayer();
|
||||
if (sender.hasPermission("bugrepgui.report")) {
|
||||
Bug bug = new Bug(sender);
|
||||
Storage.putMap(bug);
|
||||
Storage.send(sender, "input-bug-info");
|
||||
return;
|
||||
} else {
|
||||
Storage.send(sender, "no-perm");
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = false)
|
||||
public void onChat(AsyncPlayerChatEvent evt) {
|
||||
String regex2 = "[^']+";
|
||||
Pattern pattern2 = Pattern.compile(regex2);
|
||||
Matcher m2 = pattern2.matcher(evt.getMessage());
|
||||
if (Storage.map.containsKey(evt.getPlayer().getUniqueId().toString())) {
|
||||
evt.setCancelled(true);
|
||||
if (m2.matches()) {
|
||||
Bug bug = Storage.map.get(evt.getPlayer().getUniqueId().toString());
|
||||
bug.append(evt.getMessage());
|
||||
evt.getPlayer().sendMessage(Storage.getMsg("continue-input"));
|
||||
return;
|
||||
} else {
|
||||
Storage.send(evt.getPlayer(), "illegal-char");
|
||||
return;
|
||||
}
|
||||
}
|
||||
if (Storage.back.containsKey(evt.getPlayer().getUniqueId().toString())) {
|
||||
evt.setCancelled(true);
|
||||
Database.back(Storage.back.get(evt.getPlayer().getUniqueId().toString()), evt.getMessage(),
|
||||
evt.getPlayer());
|
||||
if (!Storage.getConfig().getBoolean("use-bungee")) {
|
||||
Notify.notifyb(Storage.back.get(evt.getPlayer().getUniqueId().toString()), evt.getMessage(),
|
||||
evt.getPlayer());
|
||||
}
|
||||
Storage.back.remove(evt.getPlayer().getUniqueId().toString());
|
||||
Storage.send(evt.getPlayer(), "send-back-success");
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = false)
|
||||
public void onMove(PlayerMoveEvent evt) {
|
||||
if (Storage.map.containsKey(evt.getPlayer().getUniqueId().toString())) {
|
||||
evt.setCancelled(true);
|
||||
Bug bug = Storage.map.get(evt.getPlayer().getUniqueId().toString());
|
||||
Database.insert(bug);
|
||||
evt.getPlayer().sendMessage(Storage.getPrefix()
|
||||
+ Storage.getMsg("rep-suc").replaceAll("%serial%", Database.getSerial(evt.getPlayer())));
|
||||
if (!Storage.getConfig().getBoolean("use-bungee")) {
|
||||
Notify.notifyt(evt.getPlayer());
|
||||
}
|
||||
Storage.map.remove(evt.getPlayer().getUniqueId().toString());
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = false)
|
||||
public void onOffline(PlayerQuitEvent evt) {
|
||||
if (Storage.map.containsKey(evt.getPlayer().getUniqueId().toString())) {
|
||||
Storage.map.remove(evt.getPlayer().getUniqueId().toString());
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = false)
|
||||
public void onClick(InventoryClickEvent evt) {
|
||||
String regex = "[¡ì[0-9a-fA-f]]*\\u005b\\s[0-9]*\\s/\\s[0-9]*\\s\\u005d\\s*[\\d\\D]*";
|
||||
Pattern pattern = Pattern.compile(regex);
|
||||
Matcher m = pattern.matcher(evt.getInventory().getTitle());
|
||||
String regex2 = "[¡ì[0-9a-fA-f]]*\\u0028\\s[0-9]*\\s/\\s[0-9]*\\s\\u0029\\s*[\\d\\D]*";
|
||||
Pattern pattern2 = Pattern.compile(regex2);
|
||||
Matcher m2 = pattern2.matcher(evt.getInventory().getTitle());
|
||||
if (m2.matches()) {
|
||||
evt.setCancelled(true);
|
||||
Inventory inv = evt.getInventory();
|
||||
Integer id = evt.getRawSlot();
|
||||
String arr = evt.getInventory().getTitle();
|
||||
String pagestr = "";
|
||||
for (int i = 4;; i++) {
|
||||
if (arr.charAt(i) >= '0' && arr.charAt(i) <= '9') {
|
||||
pagestr = pagestr + arr.charAt(i);
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
}
|
||||
Integer page = Integer.parseInt(pagestr);
|
||||
GUI.clickHis(inv, page, id, evt.getClick(), (Player) evt.getWhoClicked());
|
||||
}
|
||||
if (m.matches()) {
|
||||
evt.setCancelled(true);
|
||||
Inventory inv = evt.getInventory();
|
||||
Integer id = evt.getRawSlot();
|
||||
String arr = evt.getInventory().getTitle();
|
||||
String pagestr = "";
|
||||
for (int i = 4;; i++) {
|
||||
if (arr.charAt(i) >= '0' && arr.charAt(i) <= '9') {
|
||||
pagestr = pagestr + arr.charAt(i);
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
}
|
||||
Integer page = Integer.parseInt(pagestr);
|
||||
GUI.click(inv, page, id, evt.getClick(), (Player) evt.getWhoClicked());
|
||||
return;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = false)
|
||||
public void onJoin(PlayerJoinEvent evt) {
|
||||
Database.check(evt.getPlayer());
|
||||
}
|
||||
}
|
||||
235
target/classes/com/ilummc/bugrepgui/GUI.java
Normal file
235
target/classes/com/ilummc/bugrepgui/GUI.java
Normal file
@ -0,0 +1,235 @@
|
||||
package com.ilummc.bugrepgui;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.inventory.ClickType;
|
||||
import org.bukkit.inventory.Inventory;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.inventory.meta.ItemMeta;
|
||||
|
||||
public class GUI {
|
||||
static List<Inventory> invs = new ArrayList<>();
|
||||
static List<Inventory> his = new ArrayList<>();
|
||||
static Integer pages;
|
||||
|
||||
public static void open(Player player, int page) {
|
||||
loadInv();
|
||||
player.closeInventory();
|
||||
player.openInventory(invs.get(page - 1));
|
||||
}
|
||||
|
||||
public static void openHistory(Player player, int page) {
|
||||
loadHis(player);
|
||||
player.closeInventory();
|
||||
player.openInventory(his.get(page - 1));
|
||||
}
|
||||
|
||||
public static void loadHis(Player player) {
|
||||
his = new ArrayList<>();
|
||||
List<Bug> set = Database.listHis();
|
||||
Iterator<Bug> it = set.iterator();
|
||||
List<ItemStack> nlist = new ArrayList<>();
|
||||
while (it.hasNext()) {
|
||||
nlist.add(it.next().toItemExecuted());
|
||||
}
|
||||
setItemHis(nlist, player);
|
||||
}
|
||||
|
||||
public static boolean loadInv() {
|
||||
invs = new ArrayList<>();
|
||||
List<Bug> set = Database.list();
|
||||
Iterator<Bug> it = set.iterator();
|
||||
List<ItemStack> nlist = new ArrayList<>();
|
||||
while (it.hasNext()) {
|
||||
nlist.add(it.next().toItem());
|
||||
}
|
||||
setItem(nlist);
|
||||
return true;
|
||||
}
|
||||
|
||||
private static void setItemHis(List<ItemStack> nlist, Player player) {
|
||||
ItemStack lp = new ItemStack(Material.REDSTONE);
|
||||
ItemMeta lm = lp.getItemMeta();
|
||||
lm.setDisplayName(Storage.getMsg("last-page"));
|
||||
lp.setItemMeta(lm);
|
||||
ItemStack np = new ItemStack(Material.EMERALD);
|
||||
ItemMeta nm = np.getItemMeta();
|
||||
nm.setDisplayName(Storage.getMsg("next-page"));
|
||||
np.setItemMeta(nm);
|
||||
ItemStack usage = new ItemStack(Material.PAPER);
|
||||
ItemMeta um = usage.getItemMeta();
|
||||
um.setDisplayName(Storage.getMsg("to-not-executed"));
|
||||
usage.setItemMeta(um);
|
||||
ItemStack re = new ItemStack(Material.BOOK);
|
||||
ItemMeta rm = re.getItemMeta();
|
||||
rm.setDisplayName(Storage.getMsg("refresh"));
|
||||
re.setItemMeta(rm);
|
||||
ItemStack ex = new ItemStack(Material.NETHER_STAR);
|
||||
ItemMeta em = ex.getItemMeta();
|
||||
em.setDisplayName(Storage.getMsg("exit"));
|
||||
ex.setItemMeta(em);
|
||||
Iterator<ItemStack> iter = nlist.iterator();
|
||||
int all = nlist.size();
|
||||
pages = (((all % 45) == 0) && (all != 0)) ? (all / 45) : (all / 45 + 1);
|
||||
for (Integer t = 1; t <= pages; t++) {
|
||||
Inventory inv = Bukkit.createInventory(player, 54,
|
||||
"¡ìd( " + t.toString() + " / " + pages.toString() + " ) " + Storage.getMsg("history-name"));
|
||||
for (int i = 0; i <= 44 && iter.hasNext(); i++) {
|
||||
ItemStack it = iter.next();
|
||||
inv.setItem(i, it);
|
||||
}
|
||||
inv.setItem(45, lp);
|
||||
inv.setItem(47, np);
|
||||
inv.setItem(51, usage);
|
||||
inv.setItem(49, re);
|
||||
inv.setItem(53, ex);
|
||||
his.add(t - 1, inv);
|
||||
}
|
||||
}
|
||||
|
||||
public static void setItem(List<ItemStack> item) {
|
||||
ItemStack lp = new ItemStack(Material.REDSTONE);
|
||||
ItemMeta lm = lp.getItemMeta();
|
||||
lm.setDisplayName(Storage.getMsg("last-page"));
|
||||
lp.setItemMeta(lm);
|
||||
ItemStack np = new ItemStack(Material.EMERALD);
|
||||
ItemMeta nm = np.getItemMeta();
|
||||
nm.setDisplayName(Storage.getMsg("next-page"));
|
||||
np.setItemMeta(nm);
|
||||
ItemStack usage = new ItemStack(Material.PAPER);
|
||||
ItemMeta um = usage.getItemMeta();
|
||||
um.setDisplayName(Storage.getMsg("usage-name"));
|
||||
List<String> lore = Storage.getMsgs("usage-lore");
|
||||
um.setLore(lore);
|
||||
usage.setItemMeta(um);
|
||||
ItemStack re = new ItemStack(Material.BOOK);
|
||||
ItemMeta rm = re.getItemMeta();
|
||||
rm.setDisplayName(Storage.getMsg("refresh"));
|
||||
re.setItemMeta(rm);
|
||||
ItemStack ex = new ItemStack(Material.NETHER_STAR);
|
||||
ItemMeta em = ex.getItemMeta();
|
||||
em.setDisplayName(Storage.getMsg("exit"));
|
||||
ex.setItemMeta(em);
|
||||
// add items to bug view
|
||||
Iterator<ItemStack> iter = item.iterator();
|
||||
int all = item.size();
|
||||
pages = (((all % 45) == 0) && (all != 0)) ? (all / 45) : (all / 45 + 1);
|
||||
for (Integer t = 1; t <= pages; t++) {
|
||||
Inventory inv = Bukkit.createInventory(null, 54,
|
||||
"¡ìd[ " + t.toString() + " / " + pages.toString() + " ] " + Storage.getMsg("gui-name"));
|
||||
for (int i = 0; i <= 44 && iter.hasNext(); i++) {
|
||||
ItemStack it = iter.next();
|
||||
inv.setItem(i, it);
|
||||
}
|
||||
inv.setItem(45, lp);
|
||||
inv.setItem(47, np);
|
||||
inv.setItem(51, usage);
|
||||
inv.setItem(49, re);
|
||||
inv.setItem(53, ex);
|
||||
invs.add(t - 1, inv);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param inv
|
||||
* this inventory
|
||||
* @param page
|
||||
* this page
|
||||
* @param id
|
||||
* slot id
|
||||
* @param click
|
||||
* click type
|
||||
*/
|
||||
public static void click(Inventory inv, Integer page, Integer id, ClickType click, Player player) {
|
||||
if (inv.getItem(id) != null) {
|
||||
ItemStack item = inv.getItem(id);
|
||||
String serial = item.getItemMeta().getDisplayName();
|
||||
if (id != 45 && id != 47 && id != 49 && id != 51 && id != 53) {
|
||||
if (click.isLeftClick() && (!click.isShiftClick())) {
|
||||
ItemMeta im = item.getItemMeta();
|
||||
List<String> lore = im.getLore();
|
||||
lore.add(Storage.getMsg("executed"));
|
||||
item.setItemMeta(im);
|
||||
inv.clear(id);
|
||||
inv.setItem(id, item);
|
||||
Database.qback(serial, player);
|
||||
Notify.notifyb(serial, Storage.getConfig().getString("auto-sendback-msg"), player);
|
||||
}
|
||||
if (click.isRightClick() && (!click.isShiftClick())) {
|
||||
// need to add a serial to this map
|
||||
Storage.back.put(player.getUniqueId().toString(), serial);
|
||||
Storage.send(player, "send-back");
|
||||
player.closeInventory();
|
||||
}
|
||||
if (click.isLeftClick() && (click.isShiftClick())) {
|
||||
ItemMeta im = item.getItemMeta();
|
||||
List<String> lore = im.getLore();
|
||||
lore.add(Storage.getMsg("executed"));
|
||||
item.setItemMeta(im);
|
||||
inv.clear(id);
|
||||
inv.setItem(id, item);
|
||||
Database.ignore(serial, player);
|
||||
}
|
||||
} else {
|
||||
if (id == 45) {
|
||||
if (page != 1) {
|
||||
open(player, page - 1);
|
||||
} else {
|
||||
Storage.send(player, "no-this-page");
|
||||
}
|
||||
}
|
||||
if (id == 47) {
|
||||
if (page != pages) {
|
||||
open(player, page + 1);
|
||||
} else {
|
||||
Storage.send(player, "no-this-page");
|
||||
}
|
||||
}
|
||||
if (id == 49) {
|
||||
loadInv();
|
||||
player.closeInventory();
|
||||
open(player, page);
|
||||
}
|
||||
if (id == 53) {
|
||||
player.closeInventory();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static void clickHis(Inventory inv, Integer page, Integer id, ClickType click, Player player) {
|
||||
if (id >= 0 && id <= 53 && inv.getItem(id) != null) {
|
||||
if (id == 45) {
|
||||
if (page != 1) {
|
||||
openHistory(player, page - 1);
|
||||
} else {
|
||||
Storage.send(player, "no-this-page");
|
||||
}
|
||||
}
|
||||
if (id == 47) {
|
||||
if (page != pages) {
|
||||
openHistory(player, page + 1);
|
||||
} else {
|
||||
Storage.send(player, "no-this-page");
|
||||
}
|
||||
}
|
||||
if (id == 49) {
|
||||
loadHis(player);
|
||||
player.closeInventory();
|
||||
openHistory(player, page);
|
||||
}
|
||||
if (id == 51) {
|
||||
player.closeInventory();
|
||||
open(player, 1);
|
||||
}
|
||||
if (id == 53) {
|
||||
player.closeInventory();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
28
target/classes/com/ilummc/bugrepgui/Main.java
Normal file
28
target/classes/com/ilummc/bugrepgui/Main.java
Normal file
@ -0,0 +1,28 @@
|
||||
package com.ilummc.bugrepgui;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.plugin.java.*;
|
||||
|
||||
import com.ilummc.bugrepgui.util.UpdateChecker;
|
||||
|
||||
public class Main extends JavaPlugin {
|
||||
@Override
|
||||
public void onEnable() {
|
||||
this.saveDefaultConfig();
|
||||
String lang = this.getConfig().getString("lang");
|
||||
String alias = this.getConfig().getString("alias");
|
||||
this.saveResource("lang_" + lang + ".yml", false);
|
||||
Storage.init(this.getConfig(), this.getDataFolder(), "lang_" + lang + ".yml");
|
||||
getServer().getPluginManager().registerEvents(new EventListener().setAlias(getConfig().getString("alias")),
|
||||
this);
|
||||
getCommand("bug").setExecutor(new cmdExe());
|
||||
getCommand("bugrepgui").setExecutor(new cmdExe());
|
||||
if (this.getConfig().getBoolean("check-update"))
|
||||
UpdateChecker.check(this.getDescription().getVersion(), this.getDescription().getWebsite());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDisable() {
|
||||
Bukkit.getLogger().info("[BugRepGUI] Thanks for chosing this plugin!");
|
||||
}
|
||||
}
|
||||
35
target/classes/com/ilummc/bugrepgui/Notify.java
Normal file
35
target/classes/com/ilummc/bugrepgui/Notify.java
Normal file
@ -0,0 +1,35 @@
|
||||
package com.ilummc.bugrepgui;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.OfflinePlayer;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
public class Notify {
|
||||
|
||||
public static void notifyt(Player player) {
|
||||
OfflinePlayer[] list = Bukkit.getOfflinePlayers();
|
||||
for (int i = 0; i < list.length; i++) {
|
||||
if (list[i].isOnline()) {
|
||||
if ((list[i]).getPlayer().hasPermission("bugrepgui.notify")) {
|
||||
(list[i]).getPlayer()
|
||||
.sendMessage(Storage.getPrefix()
|
||||
+ Storage.getMsg("notify-op").replaceAll("%player%", player.getName())
|
||||
.replaceAll("%serial%", Database.getSerial(player)));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static void notifyb(String serial, String msg, Player exename) {
|
||||
Player player = Database.getRepPlayer(serial);
|
||||
if (player.isOnline()) {
|
||||
String str = Database.format.replaceAll("%serial%", serial.toString())
|
||||
.replaceAll("%exename%", exename.getDisplayName()).replaceAll("%reply%", msg);
|
||||
String str2 = Database.format2.replaceAll("%serial%", serial.toString())
|
||||
.replaceAll("%exename%", exename.getDisplayName()).replaceAll("%reply%", msg);
|
||||
String msgs[] = { str, Storage.compile(str2) };
|
||||
player.sendMessage(msgs);
|
||||
Database.setback(serial);
|
||||
}
|
||||
}
|
||||
}
|
||||
53
target/classes/com/ilummc/bugrepgui/Stats.java
Normal file
53
target/classes/com/ilummc/bugrepgui/Stats.java
Normal file
@ -0,0 +1,53 @@
|
||||
package com.ilummc.bugrepgui;
|
||||
|
||||
import java.util.Iterator;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.TreeSet;
|
||||
|
||||
import com.ilummc.bugrepgui.stats.Reporter;
|
||||
|
||||
public class Stats {
|
||||
public static String[] loadTextRep() {
|
||||
Map<String, Integer> res = Database.loadStatsRep();
|
||||
Set<String> set = res.keySet();
|
||||
Iterator<String> it = set.iterator();
|
||||
Set<Reporter> rank = new TreeSet<>();
|
||||
while (it.hasNext()) {
|
||||
String name = it.next();
|
||||
Reporter rep = new Reporter(name, res.get(name));
|
||||
rank.add(rep);
|
||||
}
|
||||
String[] msg = new String[rank.size() + 2];
|
||||
msg[0] = Storage.getMsg("rep-rank");
|
||||
Iterator<Reporter> its = rank.iterator();
|
||||
for (int i = 1; i <= rank.size(); i++) {
|
||||
Reporter next = its.next();
|
||||
msg[i] = next.getName() + " : " + next.getAmount().toString();
|
||||
}
|
||||
Integer all = rank.size();
|
||||
msg[all + 1] = Storage.getMsg("rep-stats").replaceAll("%amount%", all.toString());
|
||||
return msg;
|
||||
}
|
||||
public static String[] loadTextExe() {
|
||||
Map<String, Integer> res = Database.loadStatsExe();
|
||||
Set<String> set = res.keySet();
|
||||
Iterator<String> it = set.iterator();
|
||||
Set<Reporter> rank = new TreeSet<>();
|
||||
while (it.hasNext()) {
|
||||
String name = it.next();
|
||||
Reporter rep = new Reporter(name, res.get(name));
|
||||
rank.add(rep);
|
||||
}
|
||||
String[] msg = new String[rank.size() + 2];
|
||||
msg[0] = Storage.getMsg("exe-rank");
|
||||
Iterator<Reporter> its = rank.iterator();
|
||||
for (int i = 1; i <= rank.size(); i++) {
|
||||
Reporter next = its.next();
|
||||
msg[i] = next.getName() + " : " + next.getAmount().toString();
|
||||
}
|
||||
Integer all = rank.size();
|
||||
msg[all + 1] = Storage.getMsg("rep-stats").replaceAll("%amount%", all.toString());
|
||||
return msg;
|
||||
}
|
||||
}
|
||||
143
target/classes/com/ilummc/bugrepgui/Storage.java
Normal file
143
target/classes/com/ilummc/bugrepgui/Storage.java
Normal file
@ -0,0 +1,143 @@
|
||||
package com.ilummc.bugrepgui;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.configuration.file.FileConfiguration;
|
||||
import org.bukkit.configuration.file.YamlConfiguration;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
public class Storage {
|
||||
private static FileConfiguration configyml;
|
||||
private static File folder;
|
||||
static String serial;
|
||||
static File lang;
|
||||
static boolean debug;
|
||||
static String format = "%serial%:\n serial: '#%serial%'\n name: '%player%'\n time: '%time%'\n file: '%path%'\n executed: false\n";
|
||||
private static FileConfiguration langyml;
|
||||
// this is a temporary list for reporters
|
||||
public static Map<String, Bug> map = new HashMap<>();
|
||||
// this is a temporary list for ops who send back
|
||||
public static Map<String, String> back = new HashMap<>();
|
||||
|
||||
public static void init(FileConfiguration config, File thisfolder, String language) {
|
||||
configyml = config;
|
||||
folder = thisfolder;
|
||||
lang = new File(thisfolder, language);
|
||||
langyml = YamlConfiguration.loadConfiguration(lang);
|
||||
debug = configyml.getBoolean("debug");
|
||||
Database.connect();
|
||||
}
|
||||
|
||||
public static void reload() {
|
||||
init(configyml, folder, "lang_" + configyml.getString("lang", "en") + ".yml");
|
||||
}
|
||||
|
||||
public static void putMap(Bug bug) {
|
||||
Storage.map.put(bug.getRepUUID(), bug);
|
||||
}
|
||||
|
||||
public static File getFolder() {
|
||||
return folder;
|
||||
}
|
||||
|
||||
public static FileConfiguration getConfig() {
|
||||
return configyml;
|
||||
}
|
||||
|
||||
public static FileConfiguration getLang() {
|
||||
return langyml;
|
||||
}
|
||||
|
||||
public static String compile(String str) {
|
||||
char[] cha = str.toCharArray();
|
||||
for (int i = 0; i < str.length(); i++) {
|
||||
if (cha[i] == '&') {
|
||||
if ((cha[i + 1] >= '0' && cha[i + 1] <= '9') || (cha[i + 1] >= 'a' && cha[i + 1] <= 'f')) {
|
||||
cha[i] = '¡ì';
|
||||
}
|
||||
}
|
||||
}
|
||||
return String.valueOf(cha);
|
||||
}
|
||||
|
||||
public static String getMsg(String msg) {
|
||||
String str = langyml.getString(msg, "¡ìePlease check the lang_" + configyml.getString("lang", "xx") + ".yml!!!");
|
||||
return compile(str);
|
||||
}
|
||||
|
||||
public static List<String> getMsgs(String msg) {
|
||||
List<String> list = langyml.getStringList(msg);
|
||||
for (int i = 0; i < list.size(); i++) {
|
||||
list.set(i, compile(list.get(i)));
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
public static String getPrefix() {
|
||||
return getMsg("prefix");
|
||||
}
|
||||
|
||||
public static void send(Player player, String msg) {
|
||||
player.sendMessage(getPrefix() + getMsg(msg));
|
||||
}
|
||||
|
||||
public static void send(CommandSender player, String msg) {
|
||||
player.sendMessage(getPrefix() + getMsg(msg));
|
||||
}
|
||||
|
||||
public static void sends(Player player, String[] msg) {
|
||||
for (int i = 0; i < msg.length; i++) {
|
||||
if (msg[i] != null && msg[i] != "")
|
||||
player.sendMessage(getPrefix() + msg[i]);
|
||||
}
|
||||
}
|
||||
|
||||
public static void log(String msg) {
|
||||
Bukkit.getLogger().info(
|
||||
getLang().getString(getPrefix().replaceAll("¡ì", ""), "[BugRepGUI]") + getMsg(msg).replaceAll("¡ì", ""));
|
||||
}
|
||||
|
||||
public static void logExcept(Exception e) {
|
||||
Bukkit.getConsoleSender().sendMessage(ChatColor.RED + "[BugRepGUI] Err occured: " + e.getMessage());
|
||||
if (debug) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
public static void getHelp(Player player) {
|
||||
List<String> helpl = langyml.getStringList("help");
|
||||
String[] help = new String[helpl.size()];
|
||||
for (int i = 0; i < helpl.size(); i++) {
|
||||
help[i] = compile(helpl.get(i));
|
||||
}
|
||||
player.sendMessage(help);
|
||||
}
|
||||
|
||||
public static void getHelp(CommandSender player) {
|
||||
List<String> helpl = langyml.getStringList("help");
|
||||
String[] help = new String[helpl.size()];
|
||||
for (int i = 0; i < helpl.size(); i++) {
|
||||
help[i] = compile(helpl.get(i));
|
||||
}
|
||||
player.sendMessage(help);
|
||||
}
|
||||
|
||||
public static String transfer(String string) {
|
||||
char[] ch = string.toCharArray();
|
||||
StringBuffer out = new StringBuffer();
|
||||
for (int i = 0; i < ch.length; i++) {
|
||||
if (ch[i] == ' ')
|
||||
out.append("\\s");
|
||||
else
|
||||
out.append(String.valueOf(ch[i]));
|
||||
}
|
||||
return out.toString();
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,19 @@
|
||||
package com.ilummc.bugrepgui.bungee;
|
||||
|
||||
import net.md_5.bungee.api.connection.ProxiedPlayer;
|
||||
import net.md_5.bungee.api.event.ChatEvent;
|
||||
import net.md_5.bungee.api.plugin.Listener;
|
||||
import net.md_5.bungee.event.EventHandler;
|
||||
|
||||
public class BungeeListener implements Listener {
|
||||
@EventHandler
|
||||
public void onChat(ChatEvent evt) {
|
||||
if (!(evt.getSender() instanceof ProxiedPlayer)) {
|
||||
return;
|
||||
}
|
||||
ProxiedPlayer p = (ProxiedPlayer) evt.getSender();
|
||||
if (Main.config.getString("stop-sign").equals(evt.getMessage())) {
|
||||
GlobalNotify.notifyt(p);
|
||||
}
|
||||
}
|
||||
}
|
||||
167
target/classes/com/ilummc/bugrepgui/bungee/GlobalNotify.java
Normal file
167
target/classes/com/ilummc/bugrepgui/bungee/GlobalNotify.java
Normal file
@ -0,0 +1,167 @@
|
||||
package com.ilummc.bugrepgui.bungee;
|
||||
|
||||
import java.sql.Connection;
|
||||
import java.sql.DriverManager;
|
||||
import java.sql.ResultSet;
|
||||
import java.sql.SQLException;
|
||||
import java.sql.Statement;
|
||||
import java.util.Collection;
|
||||
import java.util.Iterator;
|
||||
|
||||
import com.ilummc.bugrepgui.Storage;
|
||||
|
||||
import net.md_5.bungee.api.connection.ProxiedPlayer;
|
||||
|
||||
public class GlobalNotify {
|
||||
private static Connection c = null;
|
||||
private static Statement state = null;
|
||||
public static String format = Main.lang.getString("join-notify");
|
||||
public static String format2 = Main.lang.getString("join-notify2");
|
||||
|
||||
public static void init() {
|
||||
Thread post = new Thread(new Runnable() {
|
||||
long spd = Main.config.getInt("check-speed");
|
||||
@Override
|
||||
public void run() {
|
||||
while (true) {
|
||||
Collection<ProxiedPlayer> l = Main.server.getPlayers();
|
||||
Iterator<ProxiedPlayer> it = l.iterator();
|
||||
while(it.hasNext()){
|
||||
ProxiedPlayer p = it.next();
|
||||
check(p.getName());
|
||||
try {
|
||||
Thread.sleep(spd);
|
||||
} catch (InterruptedException e) {
|
||||
Main.printException(e.getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
post.start();
|
||||
}
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
public static void notifyt(ProxiedPlayer player) {
|
||||
Collection<ProxiedPlayer> l = Main.server.getPlayers();
|
||||
Iterator<ProxiedPlayer> it = l.iterator();
|
||||
while(it.hasNext()){
|
||||
ProxiedPlayer p = it.next();
|
||||
if(p.hasPermission("bugrepgui.notify")){
|
||||
p.sendMessage(Main.lang.getString("notify-op").replaceAll("%player%", player.getName()));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
public static void sends(String player, String[] msg){
|
||||
ProxiedPlayer p = Main.server.getPlayer(player);
|
||||
for (int i = 0; i < msg.length; i++) {
|
||||
if (msg[i] != null && msg[i] != "")
|
||||
p.sendMessage(getPrefix() + msg[i]);
|
||||
}
|
||||
}
|
||||
public static String getPrefix(){
|
||||
return Storage.compile(Main.lang.getString("prefix"));
|
||||
}
|
||||
public static void check(String player) {
|
||||
connect();
|
||||
String sql = "SELECT SERIAL,EXEMSG,EXENAME FROM br_bug WHERE REPNAME = '" + player
|
||||
+ "' AND (EXECUTED = 1 OR EXECUTED = 2) AND BACK = 0 ORDER BY SERIAL ASC;";
|
||||
String send[] = new String[12];
|
||||
Integer[] ser = new Integer[6];
|
||||
try {
|
||||
ResultSet res = state.executeQuery(sql);
|
||||
int limit = 0;
|
||||
while (((limit += 2) < 12) && res.next()) {
|
||||
Integer serial = res.getInt("SERIAL");
|
||||
String msg = res.getString("EXEMSG");
|
||||
String exename = res.getString("EXENAME");
|
||||
String str = format.replaceAll("%serial%", serial.toString()).replaceAll("%exename%", exename)
|
||||
.replaceAll("%reply%", msg);
|
||||
String str2 = format2.replaceAll("%serial%", serial.toString()).replaceAll("%exename%", exename)
|
||||
.replaceAll("%reply%", msg);
|
||||
send[limit - 2] = Storage.compile(str);
|
||||
send[limit - 1] = Storage.compile(str2);
|
||||
ser[limit / 2] = serial;
|
||||
}
|
||||
res.close();
|
||||
} catch (SQLException e) {
|
||||
Main.printException(e.getMessage());
|
||||
}
|
||||
sends(player, send);
|
||||
close();
|
||||
setback(ser);
|
||||
}
|
||||
|
||||
public static void setback(Integer[] ser) {
|
||||
connect();
|
||||
for (int i = 1; i < (ser.length) && (ser[i] != null); i++) {
|
||||
String sql2 = "UPDATE br_bug SET BACK = 1 WHERE SERIAL = " + ser[i].toString() + ";";
|
||||
try {
|
||||
state.executeUpdate(sql2);
|
||||
} catch (SQLException e) {
|
||||
Main.printException(e.getMessage());
|
||||
}
|
||||
}
|
||||
close();
|
||||
}
|
||||
|
||||
public static void setback(String ser) {
|
||||
connect();
|
||||
String sql = "UPDATE br_bug SET BACK = 1 WHERE SERIAL = " + ser + ";";
|
||||
try {
|
||||
state.executeUpdate(sql);
|
||||
} catch (SQLException e) {
|
||||
Main.printException(e.getMessage());
|
||||
}
|
||||
close();
|
||||
}
|
||||
|
||||
public static void connect() {
|
||||
if (!conMySQL()) {
|
||||
Main.log.warning("[BugRepGUI] MySQL connect failed!");
|
||||
Main.log.warning("**************************************************");
|
||||
Main.log.warning("[BugRepGUI] Must check the MySQL server settings!!");
|
||||
Main.log.warning("[BugRepGUI] Must check the MySQL server settings!!");
|
||||
Main.log.warning("**************************************************");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public static void close() {
|
||||
try {
|
||||
state.close();
|
||||
state = null;
|
||||
c.close();
|
||||
} catch (Exception e) {
|
||||
Main.printException(e.getMessage());
|
||||
}
|
||||
}
|
||||
public static boolean conMySQL() {
|
||||
String url = "jdbc:mysql://" + Main.config.getString("mysql-url") + ":"
|
||||
+ Main.config.getString("mysql-port") + "/" +Main.config.getString("mysql-db");
|
||||
try {
|
||||
Class.forName("com.mysql.jdbc.Driver");
|
||||
c = DriverManager.getConnection(url, Main.config.getString("mysql-username"),
|
||||
Main.config.getString("mysql-password"));
|
||||
state = c.createStatement();
|
||||
} catch (SQLException e) {
|
||||
Main.printException(e.getMessage());
|
||||
return false;
|
||||
} catch (ClassNotFoundException e) {
|
||||
Main.printException(e.getMessage());
|
||||
return false;
|
||||
}
|
||||
String sql = "CREATE TABLE IF NOT EXISTS br_bug " + "(SERIAL INT PRIMARY KEY AUTO_INCREMENT NOT NULL,"
|
||||
+ " REPNAME TEXT NOT NULL, " + " REPTIME TEXT NOT NULL, "
|
||||
+ " REPMSG TEXT NOT NULL, " + " EXENAME TEXT, " + " EXETIME TEXT, "
|
||||
+ " EXEMSG TEXT, " + " EXECUTED INT, " + " BACK INT);";
|
||||
try {
|
||||
state.executeUpdate(sql);
|
||||
} catch (SQLException e) {
|
||||
Main.printException(e.getMessage());
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
84
target/classes/com/ilummc/bugrepgui/bungee/Main.java
Normal file
84
target/classes/com/ilummc/bugrepgui/bungee/Main.java
Normal file
@ -0,0 +1,84 @@
|
||||
package com.ilummc.bugrepgui.bungee;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.nio.file.CopyOption;
|
||||
import java.nio.file.Files;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
import net.md_5.bungee.api.ProxyServer;
|
||||
import net.md_5.bungee.api.plugin.Plugin;
|
||||
import net.md_5.bungee.config.Configuration;
|
||||
import net.md_5.bungee.config.ConfigurationProvider;
|
||||
import net.md_5.bungee.config.YamlConfiguration;
|
||||
|
||||
public class Main extends Plugin {
|
||||
static Logger log;
|
||||
static File folder;
|
||||
static Configuration config;
|
||||
static Configuration lang;
|
||||
static File cf;
|
||||
static File lf;
|
||||
static ProxyServer server;
|
||||
|
||||
public void onEnable() {
|
||||
this.init(this.getDataFolder(), this.getLogger());
|
||||
this.getLogger().info("BungeeCord mode is on!");
|
||||
this.getProxy().getPluginManager().registerListener(this, new BungeeListener());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDisable() {
|
||||
try {
|
||||
ConfigurationProvider.getProvider(YamlConfiguration.class).save(config, cf);
|
||||
ConfigurationProvider.getProvider(YamlConfiguration.class).save(lang, lf);
|
||||
} catch (Exception e) {
|
||||
printException(e.getMessage());
|
||||
}
|
||||
this.getLogger().info("BugRepGUI disabled! Thanks for chosing us!");
|
||||
}
|
||||
|
||||
public void init(File f, Logger log) {
|
||||
if (!this.getDataFolder().exists()) {
|
||||
this.getDataFolder().mkdir();
|
||||
}
|
||||
Main.log = log;
|
||||
Main.folder = f;
|
||||
Main.server = this.getProxy();
|
||||
cf = new File(f + "/config.yml");
|
||||
try {
|
||||
if (!cf.exists()) {
|
||||
Files.copy(getResourceAsStream("config.yml"), cf.toPath(), new CopyOption[0]);
|
||||
}
|
||||
reloadConfig();
|
||||
lf = new File(f + "/lang_"+config.getString("lang")+".yml");
|
||||
if (!lf.exists()) {
|
||||
Files.copy(getResourceAsStream("lang_" + config.getString("lang") + ".yml"), lf.toPath(),
|
||||
new CopyOption[0]);
|
||||
}
|
||||
reloadLang();
|
||||
} catch (Exception e) {
|
||||
printException(e.getMessage());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void reloadConfig() {
|
||||
try {
|
||||
config = ConfigurationProvider.getProvider(YamlConfiguration.class).load(cf);
|
||||
} catch (IOException e) {
|
||||
printException(e.getMessage());
|
||||
}
|
||||
}
|
||||
private void reloadLang() {
|
||||
try {
|
||||
lang = ConfigurationProvider.getProvider(YamlConfiguration.class).load(lf);
|
||||
} catch (IOException e) {
|
||||
printException(e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
public static void printException(String msg) {
|
||||
log.warning("Error: " + msg);
|
||||
}
|
||||
}
|
||||
116
target/classes/com/ilummc/bugrepgui/cmdExe.java
Normal file
116
target/classes/com/ilummc/bugrepgui/cmdExe.java
Normal file
@ -0,0 +1,116 @@
|
||||
package com.ilummc.bugrepgui;
|
||||
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandExecutor;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
public class cmdExe implements CommandExecutor {
|
||||
|
||||
@Override
|
||||
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
||||
if (command.getName().equals("report")) {
|
||||
if (sender instanceof Player) {
|
||||
if (sender.hasPermission("bugrepgui.report")) {
|
||||
Bug bug = new Bug((Player) sender);
|
||||
Storage.putMap(bug);
|
||||
Storage.send(sender, "input-bug-info");
|
||||
return true;
|
||||
} else {
|
||||
Storage.send(sender, "no-perm");
|
||||
return true;
|
||||
}
|
||||
} else {
|
||||
Storage.send(sender, "must-player-run");
|
||||
return true;
|
||||
}
|
||||
} else {
|
||||
if (args.length == 1 && args[0].equalsIgnoreCase("help")) {
|
||||
Storage.getHelp(sender);
|
||||
return true;
|
||||
}
|
||||
if (args.length == 1 && args[0].equalsIgnoreCase("view")) {
|
||||
if (sender instanceof Player) {
|
||||
if (sender.hasPermission("bugrepgui.view")) {
|
||||
GUI.open((Player) sender, 1);
|
||||
} else {
|
||||
Storage.send(sender, "no-perm");
|
||||
}
|
||||
return true;
|
||||
} else {
|
||||
Storage.send(sender, "must-player-run");
|
||||
}
|
||||
return true;
|
||||
}
|
||||
if (args.length == 2 && args[0].equalsIgnoreCase("view") && args[1].equalsIgnoreCase("history")) {
|
||||
if (sender instanceof Player) {
|
||||
if (sender.hasPermission("bugrepgui.view")) {
|
||||
GUI.openHistory((Player) sender, 1);
|
||||
} else {
|
||||
Storage.send(sender, "no-perm");
|
||||
}
|
||||
return true;
|
||||
} else {
|
||||
Storage.send(sender, "must-player-run");
|
||||
}
|
||||
}
|
||||
if (args.length == 1 && args[0].equalsIgnoreCase("report")) {
|
||||
if (sender instanceof Player) {
|
||||
if (sender.hasPermission("bugrepgui.report")) {
|
||||
Bug bug = new Bug((Player) sender);
|
||||
Storage.putMap(bug);
|
||||
Storage.send(sender, "input-bug-info");
|
||||
return true;
|
||||
} else {
|
||||
Storage.send(sender, "no-perm");
|
||||
return true;
|
||||
}
|
||||
} else {
|
||||
Storage.send(sender, "must-player-run");
|
||||
return true;
|
||||
}
|
||||
}
|
||||
if (args.length == 2 && args[0].equalsIgnoreCase("stats")) {
|
||||
if (args[1].equalsIgnoreCase("text")) {
|
||||
if (sender.hasPermission("bugrepgui.stats.text")) {
|
||||
final CommandSender send = sender;
|
||||
Thread t = new Thread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
send.sendMessage(Stats.loadTextRep());
|
||||
try {
|
||||
Thread.sleep(3000);
|
||||
Storage.send(send, "wait");
|
||||
Thread.sleep(5000);
|
||||
} catch (InterruptedException e) {
|
||||
Storage.logExcept(e);
|
||||
}
|
||||
send.sendMessage(Stats.loadTextExe());
|
||||
}
|
||||
});
|
||||
t.start();
|
||||
return true;
|
||||
} else {
|
||||
Storage.send(sender, "no-perm");
|
||||
return true;
|
||||
}
|
||||
}
|
||||
if (args[1].equalsIgnoreCase("gui")) {
|
||||
return true;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
if (args.length == 1 && args[0].equalsIgnoreCase("reload")) {
|
||||
if (sender.hasPermission("bugrepgui.reload")) {
|
||||
Storage.reload();
|
||||
Storage.send(sender, "reload-suc");
|
||||
return true;
|
||||
} else {
|
||||
Storage.send(sender, "no-perm");
|
||||
}
|
||||
}
|
||||
Storage.getHelp(sender);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
28
target/classes/com/ilummc/bugrepgui/stats/Reporter.java
Normal file
28
target/classes/com/ilummc/bugrepgui/stats/Reporter.java
Normal file
@ -0,0 +1,28 @@
|
||||
package com.ilummc.bugrepgui.stats;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.OfflinePlayer;
|
||||
|
||||
public class Reporter implements Comparable<Reporter> {
|
||||
OfflinePlayer player;
|
||||
Integer amount = 0;
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
public Reporter(String player, Integer amount) {
|
||||
this.player = Bukkit.getOfflinePlayer(player);
|
||||
this.amount = amount;
|
||||
}
|
||||
|
||||
public Integer getAmount() {
|
||||
return this.amount;
|
||||
}
|
||||
public String getName(){
|
||||
return this.player.getName();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int compareTo(Reporter other) {
|
||||
return this.amount - other.getAmount();
|
||||
}
|
||||
|
||||
}
|
||||
48
target/classes/com/ilummc/bugrepgui/util/UpdateChecker.java
Normal file
48
target/classes/com/ilummc/bugrepgui/util/UpdateChecker.java
Normal file
@ -0,0 +1,48 @@
|
||||
package com.ilummc.bugrepgui.util;
|
||||
|
||||
import java.io.BufferedReader;
|
||||
import java.io.InputStreamReader;
|
||||
import java.net.HttpURLConnection;
|
||||
import java.net.URL;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
|
||||
import com.ilummc.bugrepgui.Storage;
|
||||
|
||||
public class UpdateChecker {
|
||||
public static void check(String version, String web) {
|
||||
final String ver = version;
|
||||
final String webn = web;
|
||||
Thread t = new Thread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
Storage.log("checking-update");
|
||||
try {
|
||||
HttpURLConnection c = (HttpURLConnection) new URL("http://www.spigotmc.org/api/general.php")
|
||||
.openConnection();
|
||||
c.setDoOutput(true);
|
||||
c.setRequestMethod("POST");
|
||||
c.getOutputStream()
|
||||
.write(("key=98BE0FE67F88AB82B4C197FAF1DC3B69206EFDCC4D3B80FC83A00037510B99B4&resource=35119")
|
||||
.getBytes("UTF-8"));
|
||||
String oldVersion = ver;
|
||||
String newVersion = new BufferedReader(new InputStreamReader(c.getInputStream())).readLine()
|
||||
.replaceAll("[a-zA-Z ]", "");
|
||||
if (newVersion.equals(oldVersion)) {
|
||||
Storage.log("no-new-version");
|
||||
} else {
|
||||
String[] msg = Storage.getMsg("new-version").replaceAll("%version%", newVersion)
|
||||
.replaceAll("%website%", webn).split("\\\\n");
|
||||
for (int i = 0; i < msg.length; i++) {
|
||||
msg[i] = Storage.getPrefix() + Storage.compile(msg[i]);
|
||||
}
|
||||
Bukkit.getConsoleSender().sendMessage(msg);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
Storage.logExcept(e);
|
||||
}
|
||||
}
|
||||
});
|
||||
t.start();
|
||||
}
|
||||
}
|
||||
27
target/classes/config.yml
Normal file
27
target/classes/config.yml
Normal file
@ -0,0 +1,27 @@
|
||||
#BugReportGUI Configuration file
|
||||
#Google is your friend :)
|
||||
debug: false
|
||||
check-update: true
|
||||
#This could be sqlite, mysql
|
||||
database: sqlite
|
||||
#These are required if database is set to MySQL
|
||||
mysql-url: 'localhost'
|
||||
mysql-port: 3306
|
||||
mysql-username: ''
|
||||
mysql-password: ''
|
||||
mysql-db: ''
|
||||
###########################################################################
|
||||
#This controls the date format(such as CST or PST or EST) in the bug view #
|
||||
# Here is a country list for you :) #
|
||||
# https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2 #
|
||||
###########################################################################
|
||||
locale: 'US'
|
||||
lang: 'en'
|
||||
#This controls the message when left click a bug
|
||||
auto-sendback-msg: '&eThanks for your reporting'
|
||||
#Report Alias
|
||||
alias: 'r'
|
||||
#If you use bungeecord, please set this to true and set database to mysql
|
||||
use-bungee: false
|
||||
#This controls the speed of checking sendback (in ms)
|
||||
check-speed: 2000
|
||||
23
target/classes/lang.yml
Normal file
23
target/classes/lang.yml
Normal file
@ -0,0 +1,23 @@
|
||||
prefix: '§d[BugRepGUI] '
|
||||
rep-suc: '§eSuccessfully report bug serial #%serial%'
|
||||
get-help: '§eUse §a/bug help §fto get help'
|
||||
must-player-run: '§cThis command must be run as player!'
|
||||
input-bug-info: '§ePlease input bug information. You can divide it in several parts if its too long, and send as§a ##bug§f for several times'
|
||||
continue-input: '§eContinue input and use §a#end# §fto stop this input'
|
||||
illegal-char: '§cYour input contains illegal character, please check and retry!'
|
||||
not-complete: '§cPlease finish reporting first! Chat with§a #end#§c may help'
|
||||
gui-name: '§cBug View'
|
||||
last-page: '§eLast Page'
|
||||
next-page: '§eNext Page'
|
||||
executed: '§aThis one has been executed!'
|
||||
usage-name: '§eUsage'
|
||||
usage-lore:
|
||||
- '§aUse left click to quick executed'
|
||||
- '§aUse right click to send back some message to reporter'
|
||||
- '§aUse shift+left click to ignore this'
|
||||
send-back: '§ePlease type your message here'
|
||||
send-back-continue: '§eYou can continue to send and use §a##stop §eto finish'
|
||||
send-back-success: '§eYour message has been sent to this player'
|
||||
no-perm: '§cYou dont have permission to do this!'
|
||||
no-this-page: '§eNo mre pages!'
|
||||
join-notify: '§bYuor bug §a#%serial% §bhas been accept! Reply - §f%msg%'
|
||||
48
target/classes/lang_cn.yml
Normal file
48
target/classes/lang_cn.yml
Normal file
@ -0,0 +1,48 @@
|
||||
prefix: '&d[BugRepGUI] '
|
||||
rep-suc: '&e成功提交,编号#%serial%'
|
||||
get-help: '&e使用&a/bug help &f获得更多帮助'
|
||||
must-player-run: '&c这个命令必须由玩家使用!'
|
||||
input-bug-info: '&e请输入你要提交的内容'
|
||||
continue-input: '&e请继续提交,移动以完成提交'
|
||||
illegal-char: '&c你的输入含有非法字符,请检查并重新提交!'
|
||||
not-complete: '&c请先完成提交!'
|
||||
gui-name: '&c浏览全部'
|
||||
history-name: '&b历史记录'
|
||||
last-page: '&e上一页'
|
||||
next-page: '&e下一页'
|
||||
executed: '&a处理完成!'
|
||||
usage-name: '&e使用说明'
|
||||
usage-lore:
|
||||
- '&a左键单击即可快捷回复'
|
||||
- '&a右键单击,发送你的消息给提交者'
|
||||
- '&aSHIFT+左键忽略这条提交'
|
||||
send-back: '&e请在这里输入你的消息,这将发送给提交者'
|
||||
send-back-success: '&e你的消息已经发送给了提交者'
|
||||
no-perm: '&c你没有权限这样做!'
|
||||
no-this-page: '&e没有更多了!'
|
||||
join-notify: '&b你提交的编号 &a#%serial% &b的bug已由 %exename% 处理!'
|
||||
join-notify2: '&b回复自 %exename% - %reply%'
|
||||
reload-suc: '&e成功重载BugRepGUI'
|
||||
notify-op: '&e%player% 提交了新的信息,编号 %serial%'
|
||||
item-msg: '&b%method%&b自%exename%'
|
||||
method-autoreply: '&e自动回复'
|
||||
method-manualreply: '&e手动回复'
|
||||
method-ignore: '&e忽略'
|
||||
refresh: '&e刷新'
|
||||
exit: '&e退出'
|
||||
to-not-executed: '&e切换至未处理视图'
|
||||
rep-rank: '&b===提交排行 & 统计==='
|
||||
rep-stats: '&b===共 %amount% 条记录==='
|
||||
exe-rank: '&b===处理排行 & 统计==='
|
||||
wait: '&a请等待5秒'
|
||||
help:
|
||||
- '&b======BugRepGUI======'
|
||||
- '&ahttp://www.mcbbs.net/forum.php?mod=viewthread&tid=665729'
|
||||
- '&a/bug view &f- 打开GUI面板浏览所有bug'
|
||||
- '&a/bug view history &f- 查看历史记录'
|
||||
- '&a/bug stats text &f- 查看文字统计信息'
|
||||
- '&c (如果人数较多,这会消耗不少CPU)'
|
||||
- '&a/bug report &f- 提交一条bug'
|
||||
- '&a/bug reload &f- 重载BugRepGUI'
|
||||
- '&a/report &f- 提交一条bug'
|
||||
- '&b======BugRepGUI======'
|
||||
48
target/classes/lang_en.yml
Normal file
48
target/classes/lang_en.yml
Normal file
@ -0,0 +1,48 @@
|
||||
prefix: '&d[BugRepGUI] '
|
||||
rep-suc: '&eSuccessfully report bug serial #%serial%'
|
||||
get-help: '&eUse &a/bug help &fto get help'
|
||||
must-player-run: '&cThis command must be run as player!'
|
||||
input-bug-info: '&ePlease input bug information. You can divide it in several parts if its too long.'
|
||||
continue-input: '&eContinue input and try to move to stop this input'
|
||||
illegal-char: '&cYour input contains illegal character, please check and retry!'
|
||||
not-complete: '&cPlease finish reporting first!'
|
||||
gui-name: '&cBug View'
|
||||
history-name: '&bHistory View'
|
||||
last-page: '&eLast Page'
|
||||
next-page: '&eNext Page'
|
||||
executed: '&aThis one has been executed!'
|
||||
usage-name: '&eUsage'
|
||||
usage-lore:
|
||||
- '&aUse left click to quick executed'
|
||||
- '&aUse right click to send back some message to reporter'
|
||||
- '&aUse shift+left click to ignore this'
|
||||
send-back: '&ePlease type your message here, and this will send to reporter'
|
||||
send-back-success: '&eYour message has been sent to this player'
|
||||
no-perm: '&cYou dont have permission to do this!'
|
||||
no-this-page: '&eNo mre pages!'
|
||||
join-notify: '&bYour report No &a#%serial% &bhas been executed by %exename%!'
|
||||
join-notify2: '&bReply from %exename% - %reply%'
|
||||
reload-suc: '&eSuccessfully reload BugRepGUI'
|
||||
notify-op: '&e%player% report a new message #%serial%'
|
||||
item-msg: '&b%method%&b by %exename%'
|
||||
method-autoreply: '&eAuto replied'
|
||||
method-manualreply: '&eManually replied'
|
||||
method-ignore: '&eIgnored'
|
||||
refresh: '&eRefresh'
|
||||
exit: '&eExit'
|
||||
to-not-executed: '&eTurn to not executed bugs'
|
||||
rep-rank: '&b===Reporter Rank & Stats==='
|
||||
rep-stats: '&b===All %amount% records in total==='
|
||||
exe-rank: '&b===Executer Rank & Stats==='
|
||||
wait: '&aPlease wait for 5 seconds'
|
||||
help:
|
||||
- '&b======BugRepGUI======'
|
||||
- '&ahttps://www.spigotmc.org/resources/bugreportgui.35119/'
|
||||
- '&a/bug view &f- View all bugs'
|
||||
- '&a/bug view history &f- View historic records'
|
||||
- '&a/bug stats text &f- View text statistics'
|
||||
- '&c (If player is too much, this will cost a lot.)'
|
||||
- '&a/bug report &f- Report'
|
||||
- '&a/bug reload &f- Reload plugin'
|
||||
- '&a/report &f- Report a bug'
|
||||
- '&b======BugRepGUI======'
|
||||
44
target/classes/plugin.yml
Normal file
44
target/classes/plugin.yml
Normal file
@ -0,0 +1,44 @@
|
||||
name: BugRepGUI
|
||||
main: com.ilummc.bugrepgui.Main
|
||||
version: 1.7
|
||||
author: IzzelAliz
|
||||
website: https://www.spigotmc.org/resources/bugreportgui-better-than-rating.35119/
|
||||
commands:
|
||||
bug:
|
||||
description: /bug help for more help
|
||||
usage: /bug help
|
||||
bugrepgui:
|
||||
description: /bugrepgui for more help
|
||||
usage: /bugrepgui
|
||||
|
||||
permissions:
|
||||
bugrepgui.admin:
|
||||
description: Gives access to all BugRepGUI commands
|
||||
children:
|
||||
bugrepgui.view: true
|
||||
bugrepgui.execute: true
|
||||
bugrepgui.sendback: true
|
||||
bugrepgui.notify: true
|
||||
bugrepgui.stats.text: true
|
||||
bugrepgui.user:
|
||||
description: Gives access to user commands
|
||||
children:
|
||||
bugrepgui.report: true
|
||||
bugrepgui.view:
|
||||
description: Allows you to have a view to all bugs
|
||||
default: op
|
||||
bugrepgui.sendback:
|
||||
description: Allows you to send back to the reporter
|
||||
default: op
|
||||
bugrepgui.execute:
|
||||
description: Allows you to execute a reported bug
|
||||
default: op
|
||||
bugrepgui.report:
|
||||
description: Allows you to report an known bug
|
||||
default: true
|
||||
bugrepgui.notify:
|
||||
description: Allows op to be notified when someone report a bug
|
||||
default: op
|
||||
bugrepgui.stats.text:
|
||||
description: Allows you to view text statistics
|
||||
default: op
|
||||
@ -1,75 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<groupId>com.ilummc.bugrepgui</groupId>
|
||||
<artifactId>BugRepGUI</artifactId>
|
||||
<version>b</version>
|
||||
<repositories>
|
||||
<repository>
|
||||
<id>bungeecord-repo</id>
|
||||
<url>https://oss.sonatype.org/content/repositories/snapshots</url>
|
||||
</repository>
|
||||
<repository>
|
||||
<id>spigot-repo</id>
|
||||
<url>https://hub.spigotmc.org/nexus/content/repositories/snapshots/</url>
|
||||
</repository>
|
||||
</repositories>
|
||||
|
||||
<build>
|
||||
|
||||
<resources>
|
||||
<resource>
|
||||
<targetPath>.</targetPath>
|
||||
<directory>${basedir}</directory>
|
||||
</resource>
|
||||
</resources>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-compiler-plugin</artifactId>
|
||||
<version>3.5.1</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>default-compile</id>
|
||||
<phase>compile</phase>
|
||||
<goals>
|
||||
<goal>compile</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
<configuration>
|
||||
<source>1.8</source>
|
||||
<target>1.8</target>
|
||||
<encoding>GBK</encoding>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>net.md-5</groupId>
|
||||
<artifactId>bungeecord-api</artifactId>
|
||||
<version>1.7-SNAPSHOT</version>
|
||||
<type>jar</type>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<!--Spigot API-->
|
||||
<dependency>
|
||||
<groupId>org.spigotmc</groupId>
|
||||
<artifactId>spigot-api</artifactId>
|
||||
<version>1.8.3-R0.1-SNAPSHOT</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<!--Bukkit API-->
|
||||
<dependency>
|
||||
<groupId>org.bukkit</groupId>
|
||||
<artifactId>bukkit</artifactId>
|
||||
<version>1.8.3-R0.1-SNAPSHOT</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</project>
|
||||
5
target/maven-archiver/pom.properties
Normal file
5
target/maven-archiver/pom.properties
Normal file
@ -0,0 +1,5 @@
|
||||
#Generated by Maven
|
||||
#Fri Jun 30 13:26:31 CST 2017
|
||||
version=b
|
||||
groupId=com.ilummc.bugrepgui
|
||||
artifactId=BugRepGUI
|
||||
Loading…
x
Reference in New Issue
Block a user