mirror of
https://github.com/IntellectualSites/PlotSquared.git
synced 2024-11-26 07:06:44 +01:00
Fixes #1390
This commit is contained in:
parent
93c4854454
commit
68011f43cd
@ -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());
|
||||
}
|
||||
|
||||
|
@ -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);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user