mirror of
https://github.com/plan-player-analytics/Plan.git
synced 2025-01-12 15:56:00 +08:00
Reverts some changes
This commit is contained in:
parent
755a0b3949
commit
198c902b8f
@ -24,7 +24,7 @@ public class ManageCommand extends TreeCommand<Plan> {
|
|||||||
* @param plugin Current instance of Plan
|
* @param plugin Current instance of Plan
|
||||||
*/
|
*/
|
||||||
public ManageCommand(Plan plugin) {
|
public ManageCommand(Plan plugin) {
|
||||||
super(plugin, "manage,m", CommandType.CONSOLE, Permissions.MANAGE.getPermission(), Locale.get(Msg.CMD_USG_MANAGE) + "", "plan m");
|
super(plugin, "manage,m", CommandType.CONSOLE, Permissions.MANAGE.getPermission(), Locale.get(Msg.CMD_USG_MANAGE).toString(), "plan m");
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -27,7 +27,7 @@ public class DataCacheClearQueue extends Queue<UUID> {
|
|||||||
* @param handler current instance of DataCacheHandler.
|
* @param handler current instance of DataCacheHandler.
|
||||||
*/
|
*/
|
||||||
public DataCacheClearQueue(DataCacheHandler handler) {
|
public DataCacheClearQueue(DataCacheHandler handler) {
|
||||||
super(new ArrayBlockingQueue(Settings.PROCESS_CLEAR_LIMIT.getNumber()));
|
super(new ArrayBlockingQueue<>(Settings.PROCESS_CLEAR_LIMIT.getNumber()));
|
||||||
setup = new ClearSetup(queue, handler);
|
setup = new ClearSetup(queue, handler);
|
||||||
setup.go();
|
setup.go();
|
||||||
}
|
}
|
||||||
@ -63,7 +63,7 @@ class ClearConsumer extends Consumer<UUID> implements Runnable {
|
|||||||
|
|
||||||
private DataCacheHandler handler;
|
private DataCacheHandler handler;
|
||||||
|
|
||||||
ClearConsumer(BlockingQueue q, DataCacheHandler handler) {
|
ClearConsumer(BlockingQueue<UUID> q, DataCacheHandler handler) {
|
||||||
super(q, "ClearQueueConsumer");
|
super(q, "ClearQueueConsumer");
|
||||||
this.handler = handler;
|
this.handler = handler;
|
||||||
}
|
}
|
||||||
|
@ -27,7 +27,7 @@ public class DataCacheGetQueue extends Queue<Map<UUID, List<DBCallableProcessor>
|
|||||||
* @param plugin current instance of Plan
|
* @param plugin current instance of Plan
|
||||||
*/
|
*/
|
||||||
public DataCacheGetQueue(Plan plugin) {
|
public DataCacheGetQueue(Plan plugin) {
|
||||||
super(new ArrayBlockingQueue(Settings.PROCESS_GET_LIMIT.getNumber()));
|
super(new ArrayBlockingQueue<>(Settings.PROCESS_GET_LIMIT.getNumber()));
|
||||||
setup = new GetSetup(queue, plugin.getDB());
|
setup = new GetSetup(queue, plugin.getDB());
|
||||||
setup.go();
|
setup.go();
|
||||||
}
|
}
|
||||||
@ -49,8 +49,11 @@ public class DataCacheGetQueue extends Queue<Map<UUID, List<DBCallableProcessor>
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean containsUUIDtoBeCached(UUID uuid) {
|
boolean containsUUIDtoBeCached(UUID uuid) {
|
||||||
return uuid != null && new ArrayList<>(queue).stream().anyMatch(map -> (map.get(uuid) != null && map.get(uuid).size() >= 2));
|
return uuid != null && queue.stream()
|
||||||
|
.map(map -> map.get(uuid))
|
||||||
|
.filter(Objects::nonNull)
|
||||||
|
.anyMatch(list -> list.size() >= 2);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -58,7 +61,7 @@ class GetConsumer extends Consumer<Map<UUID, List<DBCallableProcessor>>> {
|
|||||||
|
|
||||||
private Database db;
|
private Database db;
|
||||||
|
|
||||||
GetConsumer(BlockingQueue q, Database db) {
|
GetConsumer(BlockingQueue<Map<UUID, List<DBCallableProcessor>>> q, Database db) {
|
||||||
super(q, "GetQueueConsumer");
|
super(q, "GetQueueConsumer");
|
||||||
this.db = db;
|
this.db = db;
|
||||||
}
|
}
|
||||||
|
@ -167,7 +167,7 @@ public class Analysis {
|
|||||||
|
|
||||||
PageCacheHandler.cachePage("analysisPage", () -> new AnalysisPageResponse(plugin.getUiServer().getDataReqHandler()));
|
PageCacheHandler.cachePage("analysisPage", () -> new AnalysisPageResponse(plugin.getUiServer().getDataReqHandler()));
|
||||||
PageCacheHandler.cachePage("players", () -> new PlayersPageResponse(plugin));
|
PageCacheHandler.cachePage("players", () -> new PlayersPageResponse(plugin));
|
||||||
ExportUtility.export(plugin, analysisData, rawData);
|
ExportUtility.export(analysisData, rawData);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
Log.toLog(this.getClass().getName(), e);
|
Log.toLog(this.getClass().getName(), e);
|
||||||
plugin.processStatus().setStatus("Analysis", "Error: " + e);
|
plugin.processStatus().setStatus("Analysis", "Error: " + e);
|
||||||
|
@ -1,5 +1,7 @@
|
|||||||
package main.java.com.djrapitops.plan.utilities.file.dump;
|
package main.java.com.djrapitops.plan.utilities.file.dump;
|
||||||
|
|
||||||
|
import com.google.common.base.Splitter;
|
||||||
|
import com.google.common.collect.ImmutableList;
|
||||||
import main.java.com.djrapitops.plan.Log;
|
import main.java.com.djrapitops.plan.Log;
|
||||||
import org.json.simple.JSONObject;
|
import org.json.simple.JSONObject;
|
||||||
import org.json.simple.parser.JSONParser;
|
import org.json.simple.parser.JSONParser;
|
||||||
@ -21,7 +23,7 @@ import java.util.List;
|
|||||||
*/
|
*/
|
||||||
public class DumpLog {
|
public class DumpLog {
|
||||||
|
|
||||||
private List<CharSequence> lines = new ArrayList<>();
|
private final List<CharSequence> lines = new ArrayList<>();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Writes a header
|
* Writes a header
|
||||||
@ -88,7 +90,7 @@ public class DumpLog {
|
|||||||
* @param line The content of the line
|
* @param line The content of the line
|
||||||
*/
|
*/
|
||||||
private void addLine(CharSequence line) {
|
private void addLine(CharSequence line) {
|
||||||
lines.add(line.toString());
|
lines.add(line == null ? "\n" : line.toString());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -97,7 +99,27 @@ public class DumpLog {
|
|||||||
* @return The link to the Dump Log
|
* @return The link to the Dump Log
|
||||||
*/
|
*/
|
||||||
String upload() {
|
String upload() {
|
||||||
String content = this.toString();
|
List<String> parts = ImmutableList.copyOf(split()).reverse();
|
||||||
|
|
||||||
|
String lastLink = null;
|
||||||
|
for (String part : parts) {
|
||||||
|
if (lastLink != null) {
|
||||||
|
part += "\n" + lastLink;
|
||||||
|
}
|
||||||
|
|
||||||
|
lastLink = upload(part);
|
||||||
|
}
|
||||||
|
|
||||||
|
return lastLink;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Uploads the content to Hastebin using HTTPS and POST
|
||||||
|
*
|
||||||
|
* @param content The content
|
||||||
|
* @return The link to the content
|
||||||
|
*/
|
||||||
|
private String upload(String content) {
|
||||||
HttpsURLConnection connection = null;
|
HttpsURLConnection connection = null;
|
||||||
try {
|
try {
|
||||||
URL url = new URL("https://hastebin.com/documents");
|
URL url = new URL("https://hastebin.com/documents");
|
||||||
@ -115,9 +137,9 @@ public class DumpLog {
|
|||||||
wr.flush();
|
wr.flush();
|
||||||
wr.close();
|
wr.close();
|
||||||
|
|
||||||
BufferedReader rd = new BufferedReader(new InputStreamReader(connection.getInputStream()));
|
BufferedReader reader = new BufferedReader(new InputStreamReader(connection.getInputStream()));
|
||||||
JSONParser parser = new JSONParser();
|
JSONParser parser = new JSONParser();
|
||||||
JSONObject json = (JSONObject) parser.parse(rd.readLine());
|
JSONObject json = (JSONObject) parser.parse(reader.readLine());
|
||||||
|
|
||||||
return "https://hastebin.com/" + json.get("key");
|
return "https://hastebin.com/" + json.get("key");
|
||||||
} catch (IOException | ParseException e) {
|
} catch (IOException | ParseException e) {
|
||||||
@ -130,6 +152,15 @@ public class DumpLog {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Splits the content of the DumpLog into parts
|
||||||
|
*
|
||||||
|
* @return The splitted content
|
||||||
|
*/
|
||||||
|
private Iterable<String> split() {
|
||||||
|
return Splitter.fixedLength(390000).split(this.toString());
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return String.join("\n", lines);
|
return String.join("\n", lines);
|
||||||
|
Loading…
Reference in New Issue
Block a user