mirror of
https://github.com/plan-player-analytics/Plan.git
synced 2024-12-21 05:50:18 +08:00
plan manage remove bugfix
This commit is contained in:
parent
7f29d3dcc1
commit
4e6d84cde2
@ -73,6 +73,7 @@ public enum Phrase {
|
||||
ANALYSIS_FAIL_NO_DATA(ANALYSIS + "Analysis failed, no data in the database."),
|
||||
ANALYSIS_BEGIN_ANALYSIS(ANALYSIS + "Data Fetched, beginning Analysis of data.."),
|
||||
ANALYSIS_COMPLETE(ANALYSIS + "Analysis Complete."),
|
||||
DATA_CORRUPTION_WARN("Some data might be corrupted: "+REPLACE0),
|
||||
//
|
||||
ERROR_PLANLITE("PlanLite not found, if you're have plugins using PlanAPI v1.6.0 download PlanLite."),
|
||||
ERROR_CONSOLE_PLAYER("This point of code should not be accessable on console. Inform author: "+REPLACE0+" Console: REPLACE1"),
|
||||
|
@ -9,7 +9,7 @@
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
* License for more details.
|
||||
*
|
||||
* You should have received a copy of the License
|
||||
* along with this program.
|
||||
@ -51,22 +51,15 @@ import org.bukkit.plugin.PluginManager;
|
||||
import org.bukkit.scheduler.BukkitRunnable;
|
||||
import org.bukkit.scheduler.BukkitTask;
|
||||
|
||||
/* TODO 2.5.0
|
||||
/* TODO 2.6.0
|
||||
Placeholder API
|
||||
Database cleaning
|
||||
Play session lenght
|
||||
- Existing data
|
||||
- importing
|
||||
Kills & Deaths 50%
|
||||
- DB saving & Alter tables
|
||||
Location Analysis to view meaningful locations on Dynmap (Investigate dynmap api)
|
||||
Integrate PlanLite features to Plan and discontinue PlanLite
|
||||
Seperate serverdata and userdata saving
|
||||
Database Cleaning of useless data
|
||||
Fix any bugs that come up
|
||||
Localization
|
||||
- Combine the two locale files
|
||||
Security
|
||||
*/
|
||||
/**
|
||||
*
|
||||
|
@ -80,7 +80,7 @@ public class AnalyzeCommand extends SubCommand {
|
||||
sendAnalysisMessage(sender);
|
||||
this.cancel();
|
||||
}
|
||||
if (timesrun > 45) {
|
||||
if (timesrun > 10) {
|
||||
sender.sendMessage(Phrase.COMMAND_TIMEOUT.parse("Analysis"));
|
||||
this.cancel();
|
||||
}
|
||||
|
@ -125,7 +125,7 @@ public class InspectCommand extends SubCommand {
|
||||
sender.sendMessage(Phrase.CMD_FOOTER+"");
|
||||
this.cancel();
|
||||
}
|
||||
if (timesrun > 45) {
|
||||
if (timesrun > 10) {
|
||||
sender.sendMessage(Phrase.COMMAND_TIMEOUT.parse("Inspect"));
|
||||
this.cancel();
|
||||
}
|
||||
|
@ -515,7 +515,6 @@ public abstract class SQLDB extends Database {
|
||||
statement.setString(1, "" + userId);
|
||||
statement.execute();
|
||||
statement.close();
|
||||
|
||||
statement = connection.prepareStatement("DELETE FROM " + nicknamesName + " WHERE UPPER(" + nicknamesColumnUserID + ") LIKE UPPER(?)");
|
||||
statement.setString(1, "" + userId);
|
||||
statement.execute();
|
||||
@ -524,7 +523,7 @@ public abstract class SQLDB extends Database {
|
||||
statement.setString(1, "" + userId);
|
||||
statement.execute();
|
||||
statement.close();
|
||||
statement = connection.prepareStatement("DELETE FROM " + ipsName + " WHERE UPPER(" + ipsColumnIP + ") LIKE UPPER(?)");
|
||||
statement = connection.prepareStatement("DELETE FROM " + ipsName + " WHERE UPPER(" + ipsColumnUserID + ") LIKE UPPER(?)");
|
||||
statement.setString(1, "" + userId);
|
||||
statement.execute();
|
||||
statement.close();
|
||||
|
@ -50,7 +50,7 @@ public class Response {
|
||||
} else {
|
||||
securityCode = requestArgs[1];
|
||||
}
|
||||
if (!securityCode.equals(Settings.SECURITY_CODE+"")) {
|
||||
if (!securityCode.equals(Settings.SECURITY_CODE + "")) {
|
||||
forbidden = true;
|
||||
}
|
||||
if (forbidden) {
|
||||
@ -77,12 +77,22 @@ public class Response {
|
||||
return;
|
||||
}
|
||||
if (requestHandler.checkIfCached(uuid)) {
|
||||
String dataHtml = requestHandler.getDataHtml(uuid);
|
||||
String htmlDef = "HTTP/1.1 OK\r\n"
|
||||
+ "Content-Type: text/html; charset=utf-8\r\n"
|
||||
+ "Content-Length: " + dataHtml.length() + "\r\n"
|
||||
+ "\r\n";
|
||||
output.write((htmlDef + dataHtml).getBytes());
|
||||
try {
|
||||
String dataHtml = requestHandler.getDataHtml(uuid);
|
||||
String htmlDef = "HTTP/1.1 OK\r\n"
|
||||
+ "Content-Type: text/html; charset=utf-8\r\n"
|
||||
+ "Content-Length: " + dataHtml.length() + "\r\n"
|
||||
+ "\r\n";
|
||||
output.write((htmlDef + dataHtml).getBytes());
|
||||
} catch (NullPointerException e) {
|
||||
e.printStackTrace();
|
||||
String errorMessage = "HTTP/1.1 404 Error\r\n"
|
||||
+ "Content-Type: text/html;\r\n"
|
||||
+ "Content-Length: 30\r\n"
|
||||
+ "\r\n"
|
||||
+ "<h1>404 - Error has occurred..</h1>";
|
||||
output.write(errorMessage.getBytes());
|
||||
}
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
@ -116,7 +116,7 @@ public class Analysis {
|
||||
long totalKills = 0;
|
||||
long totalMobKills = 0;
|
||||
long totalDeaths = 0;
|
||||
|
||||
|
||||
int ops = 0;
|
||||
List<Integer> ages = new ArrayList<>();
|
||||
|
||||
@ -131,60 +131,64 @@ public class Analysis {
|
||||
HashMap<String, Long> playtimes = new HashMap<>();
|
||||
// Fill Dataset with userdata.
|
||||
for (UserData uData : rawData) {
|
||||
if (planLiteEnabled) {
|
||||
PlanLitePlayerData litePlayerData = uData.getPlanLiteData();
|
||||
String town = litePlayerData.getTown();
|
||||
if (!townMap.containsKey(town)) {
|
||||
townMap.put(town, 0);
|
||||
}
|
||||
townMap.replace(town, townMap.get(town) + 1);
|
||||
String faction = litePlayerData.getFaction();
|
||||
if (!factionMap.containsKey(faction)) {
|
||||
factionMap.put(faction, 0);
|
||||
}
|
||||
factionMap.replace(faction, factionMap.get(faction) + 1);
|
||||
totalVotes += litePlayerData.getVotes();
|
||||
totalMoney += litePlayerData.getMoney();
|
||||
}
|
||||
HashMap<GameMode, Long> gmTimes = uData.getGmTimes();
|
||||
gmZero += gmTimes.get(GameMode.SURVIVAL);
|
||||
gmOne += gmTimes.get(GameMode.CREATIVE);
|
||||
gmTwo += gmTimes.get(GameMode.ADVENTURE);
|
||||
try {
|
||||
Long gm = gmTimes.get(GameMode.SPECTATOR);
|
||||
if (gm != null) {
|
||||
gmThree += gm;
|
||||
if (planLiteEnabled) {
|
||||
PlanLitePlayerData litePlayerData = uData.getPlanLiteData();
|
||||
String town = litePlayerData.getTown();
|
||||
if (!townMap.containsKey(town)) {
|
||||
townMap.put(town, 0);
|
||||
}
|
||||
townMap.replace(town, townMap.get(town) + 1);
|
||||
String faction = litePlayerData.getFaction();
|
||||
if (!factionMap.containsKey(faction)) {
|
||||
factionMap.put(faction, 0);
|
||||
}
|
||||
factionMap.replace(faction, factionMap.get(faction) + 1);
|
||||
totalVotes += litePlayerData.getVotes();
|
||||
totalMoney += litePlayerData.getMoney();
|
||||
}
|
||||
} catch (NoSuchFieldError e) {
|
||||
}
|
||||
long playTime = uData.getPlayTime();
|
||||
totalPlaytime += playTime;
|
||||
String playerName = uData.getName();
|
||||
String url = HtmlUtils.getInspectUrl(playerName);
|
||||
String html = Html.BUTTON.parse(url, playerName);
|
||||
HashMap<GameMode, Long> gmTimes = uData.getGmTimes();
|
||||
gmZero += gmTimes.get(GameMode.SURVIVAL);
|
||||
gmOne += gmTimes.get(GameMode.CREATIVE);
|
||||
gmTwo += gmTimes.get(GameMode.ADVENTURE);
|
||||
try {
|
||||
Long gm = gmTimes.get(GameMode.SPECTATOR);
|
||||
if (gm != null) {
|
||||
gmThree += gm;
|
||||
}
|
||||
} catch (NoSuchFieldError e) {
|
||||
}
|
||||
long playTime = uData.getPlayTime();
|
||||
totalPlaytime += playTime;
|
||||
String playerName = uData.getName();
|
||||
String url = HtmlUtils.getInspectUrl(playerName);
|
||||
String html = Html.BUTTON.parse(url, playerName);
|
||||
|
||||
latestLogins.put(html, uData.getLastPlayed());
|
||||
totalLoginTimes += uData.getLoginTimes();
|
||||
int age = uData.getDemData().getAge();
|
||||
if (age != -1) {
|
||||
ages.add(age);
|
||||
latestLogins.put(html, uData.getLastPlayed());
|
||||
totalLoginTimes += uData.getLoginTimes();
|
||||
int age = uData.getDemData().getAge();
|
||||
if (age != -1) {
|
||||
ages.add(age);
|
||||
}
|
||||
if (uData.isOp()) {
|
||||
ops++;
|
||||
}
|
||||
if (uData.isBanned()) {
|
||||
totalBanned++;
|
||||
} else if (uData.getLoginTimes() == 1) {
|
||||
joinleaver++;
|
||||
} else if (AnalysisUtils.isActive(uData.getLastPlayed(), playTime, uData.getLoginTimes())) {
|
||||
active++;
|
||||
playtimes.put(html, playTime);
|
||||
} else {
|
||||
inactive++;
|
||||
}
|
||||
totalKills += uData.getPlayerKills();
|
||||
totalMobKills += uData.getMobKills();
|
||||
totalDeaths += uData.getDeaths();
|
||||
} catch (NullPointerException e) {
|
||||
plugin.logError(Phrase.DATA_CORRUPTION_WARN.parse(uData.getUuid()+""));
|
||||
}
|
||||
if (uData.isOp()) {
|
||||
ops++;
|
||||
}
|
||||
if (uData.isBanned()) {
|
||||
totalBanned++;
|
||||
} else if (uData.getLoginTimes() == 1) {
|
||||
joinleaver++;
|
||||
} else if (AnalysisUtils.isActive(uData.getLastPlayed(), playTime, uData.getLoginTimes())) {
|
||||
active++;
|
||||
playtimes.put(html, playTime);
|
||||
} else {
|
||||
inactive++;
|
||||
}
|
||||
totalKills += uData.getPlayerKills();
|
||||
totalMobKills += uData.getMobKills();
|
||||
totalDeaths += uData.getDeaths();
|
||||
}
|
||||
|
||||
// Save Dataset to AnalysisData
|
||||
@ -204,7 +208,7 @@ public class Analysis {
|
||||
analyzeAverageAge(ages, data);
|
||||
createGamemodeUsageVisualization(gmZero, gmOne, gmTwo, gmThree, data);
|
||||
createCommandUseTable(data);
|
||||
|
||||
|
||||
data.setTotaldeaths(totalDeaths);
|
||||
data.setTotalkills(totalKills);
|
||||
data.setTotalmobkills(totalMobKills);
|
||||
|
@ -1,7 +1,7 @@
|
||||
name: Plan
|
||||
author: Rsl1122
|
||||
main: com.djrapitops.plan.Plan
|
||||
version: 2.5.0
|
||||
version: 2.5.1
|
||||
|
||||
commands:
|
||||
plan:
|
||||
|
Loading…
Reference in New Issue
Block a user