This commit is contained in:
Jesse Boyd 2016-10-21 03:51:27 +11:00
parent 93c4854454
commit 68011f43cd
No known key found for this signature in database
GPG Key ID: 59F1DE6293AF6E1F
2 changed files with 11 additions and 10 deletions

View File

@ -1,13 +1,10 @@
package com.intellectualcrafters.plot.util;
import java.io.BufferedReader;
import java.io.DataOutputStream;
import java.io.File;
import java.io.FileReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.*;
import java.net.HttpURLConnection;
import java.net.URL;
import java.util.ArrayList;
import java.util.List;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
@ -49,13 +46,17 @@ public class HastebinUtility {
public static String upload(final File file) throws IOException {
final StringBuilder content = new StringBuilder();
List<String> lines = new ArrayList<>();
try (BufferedReader reader = new BufferedReader(new FileReader(file))) {
String line;
int i = 0;
while ((line = reader.readLine()) != null && i++ < 1000) {
content.append(line).append("\n");
while ((line = reader.readLine()) != null) {
lines.add(line);
}
}
for (int i = Math.max(0, lines.size() - 1000); i < lines.size(); i++) {
content.append(lines.get(i)).append("\n");
}
return upload(content.toString());
}

View File

@ -52,7 +52,7 @@ public class ExpireManager {
public void handleJoin(PlotPlayer pp) {
storeDate(pp.getUUID(), System.currentTimeMillis());
if (!plotsToDelete.isEmpty()) {
if (plotsToDelete != null && !plotsToDelete.isEmpty()) {
for (Plot plot : pp.getPlots()) {
plotsToDelete.remove(plot);
}
@ -77,7 +77,7 @@ public class ExpireManager {
}
public void updateExpired(Plot plot) {
if (!plotsToDelete.isEmpty() && plotsToDelete.contains(plot)) {
if (plotsToDelete != null && !plotsToDelete.isEmpty() && plotsToDelete.contains(plot)) {
if (isExpired(new ArrayDeque<>(tasks), plot).isEmpty()) {
plotsToDelete.remove(plot);
}