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;
|
package com.intellectualcrafters.plot.util;
|
||||||
|
|
||||||
import java.io.BufferedReader;
|
import java.io.*;
|
||||||
import java.io.DataOutputStream;
|
|
||||||
import java.io.File;
|
|
||||||
import java.io.FileReader;
|
|
||||||
import java.io.IOException;
|
|
||||||
import java.io.InputStreamReader;
|
|
||||||
import java.net.HttpURLConnection;
|
import java.net.HttpURLConnection;
|
||||||
import java.net.URL;
|
import java.net.URL;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
import java.util.regex.Matcher;
|
import java.util.regex.Matcher;
|
||||||
import java.util.regex.Pattern;
|
import java.util.regex.Pattern;
|
||||||
|
|
||||||
@ -49,13 +46,17 @@ public class HastebinUtility {
|
|||||||
|
|
||||||
public static String upload(final File file) throws IOException {
|
public static String upload(final File file) throws IOException {
|
||||||
final StringBuilder content = new StringBuilder();
|
final StringBuilder content = new StringBuilder();
|
||||||
|
List<String> lines = new ArrayList<>();
|
||||||
try (BufferedReader reader = new BufferedReader(new FileReader(file))) {
|
try (BufferedReader reader = new BufferedReader(new FileReader(file))) {
|
||||||
String line;
|
String line;
|
||||||
int i = 0;
|
int i = 0;
|
||||||
while ((line = reader.readLine()) != null && i++ < 1000) {
|
while ((line = reader.readLine()) != null) {
|
||||||
content.append(line).append("\n");
|
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());
|
return upload(content.toString());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -52,7 +52,7 @@ public class ExpireManager {
|
|||||||
|
|
||||||
public void handleJoin(PlotPlayer pp) {
|
public void handleJoin(PlotPlayer pp) {
|
||||||
storeDate(pp.getUUID(), System.currentTimeMillis());
|
storeDate(pp.getUUID(), System.currentTimeMillis());
|
||||||
if (!plotsToDelete.isEmpty()) {
|
if (plotsToDelete != null && !plotsToDelete.isEmpty()) {
|
||||||
for (Plot plot : pp.getPlots()) {
|
for (Plot plot : pp.getPlots()) {
|
||||||
plotsToDelete.remove(plot);
|
plotsToDelete.remove(plot);
|
||||||
}
|
}
|
||||||
@ -77,7 +77,7 @@ public class ExpireManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void updateExpired(Plot plot) {
|
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()) {
|
if (isExpired(new ArrayDeque<>(tasks), plot).isEmpty()) {
|
||||||
plotsToDelete.remove(plot);
|
plotsToDelete.remove(plot);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user