Fix merge issues

This commit is contained in:
Rsl1122 2017-08-12 16:41:02 +03:00
commit 2a32de97d2
17 changed files with 89 additions and 137 deletions

View File

@ -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).toString(), "plan m"); super(plugin, "manage,m", CommandType.CONSOLE, Permissions.MANAGE.getPermission(), Locale.get(Msg.CMD_USG_MANAGE) + "", "plan m");
} }

View File

@ -50,12 +50,8 @@ public class ManageDumpCommand extends SubCommand {
plugin.getRunnableFactory().createNew(new AbsRunnable("DumpTask") { plugin.getRunnableFactory().createNew(new AbsRunnable("DumpTask") {
@Override @Override
public void run() { public void run() {
try { sender.sendLink("Link to the Dump", DumpUtils.dump(plugin));
sender.sendLink("Link to the Dump", DumpUtils.dump(plugin)); sender.sendLink("Report Issues here", "https://github.com/Rsl1122/Plan-PlayerAnalytics/issues/new");
sender.sendLink("Report Issues here", "https://github.com/Rsl1122/Plan-PlayerAnalytics/issues/new");
} finally {
this.cancel();
}
} }
}).runTaskAsynchronously(); }).runTaskAsynchronously();
} }

View File

@ -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<UUID> q, DataCacheHandler handler) { ClearConsumer(BlockingQueue q, DataCacheHandler handler) {
super(q, "ClearQueueConsumer"); super(q, "ClearQueueConsumer");
this.handler = handler; this.handler = handler;
} }
@ -95,7 +95,7 @@ class ClearConsumer extends Consumer<UUID> implements Runnable {
class ClearSetup extends Setup<UUID> { class ClearSetup extends Setup<UUID> {
ClearSetup(BlockingQueue<UUID> q, DataCacheHandler handler) { public ClearSetup(BlockingQueue<UUID> q, DataCacheHandler handler) {
super(new ClearConsumer(q, handler)); super(new ClearConsumer(q, handler));
} }
} }

View File

@ -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,12 +49,8 @@ public class DataCacheGetQueue extends Queue<Map<UUID, List<DBCallableProcessor>
} }
} }
boolean containsUUIDtoBeCached(UUID uuid) { public boolean containsUUIDtoBeCached(UUID uuid) {
return uuid != null return uuid != null && new ArrayList<>(queue).stream().anyMatch(map -> (map.get(uuid) != null && map.get(uuid).size() >= 2));
&& queue.stream()
.map(map -> map.get(uuid))
.filter(Objects::nonNull)
.anyMatch(list -> list.size() >= 2);
} }
} }
@ -62,7 +58,7 @@ class GetConsumer extends Consumer<Map<UUID, List<DBCallableProcessor>>> {
private Database db; private Database db;
GetConsumer(BlockingQueue<Map<UUID, List<DBCallableProcessor>>> q, Database db) { GetConsumer(BlockingQueue q, Database db) {
super(q, "GetQueueConsumer"); super(q, "GetQueueConsumer");
this.db = db; this.db = db;
} }

View File

@ -39,7 +39,7 @@ public class Locale implements Closeable {
private final Map<Msg, Message> messages; private final Map<Msg, Message> messages;
public Locale(Plan plugin) { public Locale(Plan plugin) {
LocaleHolder.setLocale(this); LocaleHolder.setLOCALE(this);
this.plugin = plugin; this.plugin = plugin;
messages = new HashMap<>(); messages = new HashMap<>();
} }
@ -62,9 +62,9 @@ public class Locale implements Closeable {
} }
} catch (IOException e) { } catch (IOException e) {
Log.toLog(this.getClass().getName(), e); Log.toLog(this.getClass().getName(), e);
} finally {
Benchmark.stop("Enable", "Initializing locale");
} }
Benchmark.stop("Enable", "Initializing locale");
} }
private void writeNewDefaultLocale() throws IOException { private void writeNewDefaultLocale() throws IOException {
@ -316,24 +316,25 @@ public class Locale implements Closeable {
} }
public Message getMessage(Msg msg) { public Message getMessage(Msg msg) {
return messages.getOrDefault(msg, new Message("")); Message message = messages.get(msg);
return message != null ? message : new Message("");
} }
@Override @Override
public void close() { public void close() {
messages.clear(); messages.clear();
LocaleHolder.locale = null; LocaleHolder.LOCALE = null;
} }
public static void unload() { public static void unload() {
Locale locale = LocaleHolder.getLocale(); Locale locale = LocaleHolder.getLOCALE();
if (locale != null) { if (locale != null) {
locale.close(); locale.close();
} }
} }
public static Message get(Msg msg) { public static Message get(Msg msg) {
Locale locale = LocaleHolder.getLocale(); Locale locale = LocaleHolder.getLOCALE();
if (locale == null) { if (locale == null) {
throw new IllegalStateException("Locale has not been initialized."); throw new IllegalStateException("Locale has not been initialized.");
} }
@ -342,14 +343,14 @@ public class Locale implements Closeable {
private static class LocaleHolder { private static class LocaleHolder {
private static Locale locale; private static Locale LOCALE;
public static void setLocale(Locale locale) { public static void setLOCALE(Locale LOCALE) {
LocaleHolder.locale = locale; LocaleHolder.LOCALE = LOCALE;
} }
public static Locale getLocale() { public static Locale getLOCALE() {
return locale; return LOCALE;
} }
} }
} }

View File

@ -84,12 +84,12 @@ public class TextUI {
final TPSPart tps = d.getTpsPart(); final TPSPart tps = d.getTpsPart();
return new String[]{ return new String[]{
ball + " Total Players: " + sec + count.getPlayerCount(), ball + " Total Players: " + sec + count.getPlayerCount(),
//
ball + " Active: " + sec + activity.getActive().size() ball + " Active: " + sec + activity.getActive().size()
+ main + " Inactive: " + sec + activity.getInactive().size() + main + " Inactive: " + sec + activity.getInactive().size()
+ main + " Single Join: " + sec + activity.getJoinedOnce().size() + main + " Single Join: " + sec + activity.getJoinedOnce().size()
+ main + " Banned: " + sec + activity.getBans().size(), + main + " Banned: " + sec + activity.getBans().size(),
//
ball + " New Players 24h: " + sec + join.get("npday") + main + " 7d: " + sec + d.get("npweek") + main + " 30d: " + sec + d.get("npmonth"), ball + " New Players 24h: " + sec + join.get("npday") + main + " 7d: " + sec + d.get("npweek") + main + " 30d: " + sec + d.get("npmonth"),
"", "",
ball + " Total Playtime: " + sec + playtime.get("totalplaytime") + main + " Player Avg: " + sec + playtime.get("avgplaytime"), ball + " Total Playtime: " + sec + playtime.get("totalplaytime") + main + " Player Avg: " + sec + playtime.get("avgplaytime"),

View File

@ -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(analysisData, rawData); ExportUtility.export(plugin, 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);

View File

@ -1,7 +1,5 @@
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;
@ -23,7 +21,7 @@ import java.util.List;
*/ */
public class DumpLog { public class DumpLog {
private final List<CharSequence> lines = new ArrayList<>(); private List<CharSequence> lines = new ArrayList<>();
/** /**
* Writes a header * Writes a header
@ -90,11 +88,6 @@ 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) {
if (line == null) {
lines.add("\n");
return;
}
lines.add(line.toString()); lines.add(line.toString());
} }
@ -104,27 +97,7 @@ public class DumpLog {
* @return The link to the Dump Log * @return The link to the Dump Log
*/ */
String upload() { String upload() {
List<String> parts = ImmutableList.copyOf(split()).reverse(); String content = this.toString();
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");
@ -138,16 +111,13 @@ public class DumpLog {
connection.setDoOutput(true); connection.setDoOutput(true);
DataOutputStream wr = new DataOutputStream(connection.getOutputStream()); DataOutputStream wr = new DataOutputStream(connection.getOutputStream());
wr.writeBytes(content); wr.writeBytes(this.toString());
wr.flush(); wr.flush();
wr.close(); wr.close();
BufferedReader reader = new BufferedReader(new InputStreamReader(connection.getInputStream())); BufferedReader rd = new BufferedReader(new InputStreamReader(connection.getInputStream()));
String response = reader.readLine();
JSONParser parser = new JSONParser(); JSONParser parser = new JSONParser();
JSONObject json = (JSONObject) parser.parse(response); JSONObject json = (JSONObject) parser.parse(rd.readLine());
return "https://hastebin.com/" + json.get("key"); return "https://hastebin.com/" + json.get("key");
} catch (IOException | ParseException e) { } catch (IOException | ParseException e) {
@ -160,15 +130,6 @@ 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);

View File

@ -741,12 +741,12 @@
function openFunc(i) { function openFunc(i) {
return function() { return function() {
if (window.getComputedStyle(document.getElementById("navbutton")).getPropertyValue('display') === "inline") { if (window.getComputedStyle(document.getElementById("navbutton")).getPropertyValue('display') == "inline") {
closeNav(); closeNav();
} }
var max = navButtons.length; var max = navButtons.length;
for (var j = 0; j < max; j++) { for (var j = 0; j < max; j++) {
if (j === i) { if (j == i) {
navButtons[j].classList.add('active'); navButtons[j].classList.add('active');
continue; continue;
} }
@ -770,7 +770,9 @@
var begin = new Date(%refreshlong%); var begin = new Date(%refreshlong%);
var seconds = now.getTime() - begin.getTime(); var seconds = now.getTime() - begin.getTime();
document.getElementById('divTime').innerHTML = formatTime(seconds); var out = formatTime(seconds);
document.getElementById('divTime').innerHTML = out;
setTimeout('countUpTimer()', 1000); setTimeout('countUpTimer()', 1000);
} }
</script> </script>

View File

@ -16,6 +16,7 @@ import org.bukkit.entity.Player;
import org.mockito.Mockito; import org.mockito.Mockito;
import org.powermock.api.mockito.PowerMockito; import org.powermock.api.mockito.PowerMockito;
import java.io.IOException;
import java.net.InetAddress; import java.net.InetAddress;
import java.net.InetSocketAddress; import java.net.InetSocketAddress;
import java.util.HashSet; import java.util.HashSet;
@ -153,7 +154,7 @@ public class MockUtils {
return PowerMockito.mock(CommandSender.class); return PowerMockito.mock(CommandSender.class);
} }
public static HttpServer mockHTTPServer() { public static HttpServer mockHTTPServer() throws IOException {
HttpServer httpServer = PowerMockito.mock(HttpServer.class); HttpServer httpServer = PowerMockito.mock(HttpServer.class);
when(httpServer.getAddress()).thenReturn(new InetSocketAddress(80)); when(httpServer.getAddress()).thenReturn(new InetSocketAddress(80));
when(httpServer.getExecutor()).thenReturn(command -> System.out.println("HTTP Server command received")); when(httpServer.getExecutor()).thenReturn(command -> System.out.println("HTTP Server command received"));

View File

@ -3,7 +3,7 @@
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
<groupId>com.djrapitops</groupId> <groupId>com.djrapitops</groupId>
<artifactId>PlanPluginBridge</artifactId> <artifactId>PlanPluginBridge</artifactId>
<version>3.6.3</version> <version>3.6.0</version>
<packaging>jar</packaging> <packaging>jar</packaging>
<repositories> <repositories>
<repository> <repository>
@ -23,7 +23,7 @@
<dependency> <dependency>
<groupId>com.djrapitops</groupId> <groupId>com.djrapitops</groupId>
<artifactId>Plan</artifactId> <artifactId>Plan</artifactId>
<version>3.6.2</version> <version>3.6.0</version>
<scope>provided</scope> <scope>provided</scope>
</dependency> </dependency>
<dependency> <dependency>

View File

@ -1,26 +1,23 @@
package com.djrapitops.pluginbridge.plan.advancedachievements; package com.djrapitops.pluginbridge.plan.advancedachievements;
import com.hm.achievement.api.AdvancedAchievementsAPI; import com.hm.achievement.api.AdvancedAchievementsAPI;
import java.io.Serializable;
import java.util.Map;
import java.util.UUID;
import main.java.com.djrapitops.plan.data.additional.AnalysisType; import main.java.com.djrapitops.plan.data.additional.AnalysisType;
import main.java.com.djrapitops.plan.data.additional.PluginData; import main.java.com.djrapitops.plan.data.additional.PluginData;
import main.java.com.djrapitops.plan.utilities.MiscUtils; import main.java.com.djrapitops.plan.utilities.MiscUtils;
import java.io.Serializable;
import java.util.Collection;
import java.util.HashMap;
import java.util.Map;
import java.util.UUID;
/** /**
* PluginData class for AdvancedAchievements-plugin. * PluginData class for AdvancedAchievements-plugin.
* <p> *
* Registered to the plugin by AdvancedAchievementsHook. * Registered to the plugin by AdvancedAchievementsHook.
* <p> *
* Gives the amount of achievements as value. * Gives the amount of achievements as value.
* *
* @author Rsl1122 * @author Rsl1122
* @see AdvancedAchievementsHook
* @since 3.1.0 * @since 3.1.0
* @see AdvancedAchievementsHook
*/ */
public class AdvancedAchievementsAchievements extends PluginData { public class AdvancedAchievementsAchievements extends PluginData {
@ -60,14 +57,6 @@ public class AdvancedAchievementsAchievements extends PluginData {
lastRefresh = MiscUtils.getTime(); lastRefresh = MiscUtils.getTime();
} }
@Override
public Map<UUID, Serializable> getValues(Collection<UUID> uuid) {
if (MiscUtils.getTime() - lastRefresh > 60000) {
refreshTotalAchievements();
}
return new HashMap<>(totalAchievements);
}
@Override @Override
public Serializable getValue(UUID uuid) { public Serializable getValue(UUID uuid) {
if (MiscUtils.getTime() - lastRefresh > 60000) { if (MiscUtils.getTime() - lastRefresh > 60000) {

View File

@ -1,11 +1,10 @@
package com.djrapitops.pluginbridge.plan.askyblock; package com.djrapitops.pluginbridge.plan.askyblock;
import com.wasteofplastic.askyblock.ASkyBlockAPI; import com.wasteofplastic.askyblock.ASkyBlockAPI;
import main.java.com.djrapitops.plan.data.additional.AnalysisType;
import main.java.com.djrapitops.plan.data.additional.PluginData;
import java.io.Serializable; import java.io.Serializable;
import java.util.UUID; import java.util.UUID;
import main.java.com.djrapitops.plan.data.additional.AnalysisType;
import main.java.com.djrapitops.plan.data.additional.PluginData;
/** /**
* PluginData class for ASkyBlock-plugin. * PluginData class for ASkyBlock-plugin.

View File

@ -2,13 +2,16 @@ package com.djrapitops.pluginbridge.plan.essentials;
import com.earth2me.essentials.Essentials; import com.earth2me.essentials.Essentials;
import com.earth2me.essentials.Warps; import com.earth2me.essentials.Warps;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.List;
import java.util.UUID;
import main.java.com.djrapitops.plan.data.additional.AnalysisType; import main.java.com.djrapitops.plan.data.additional.AnalysisType;
import main.java.com.djrapitops.plan.data.additional.PluginData; import main.java.com.djrapitops.plan.data.additional.PluginData;
import main.java.com.djrapitops.plan.ui.html.Html; import main.java.com.djrapitops.plan.ui.html.Html;
import java.io.Serializable;
import java.util.*;
/** /**
* PluginData class for Essentials-plugin. * PluginData class for Essentials-plugin.
* *
@ -53,7 +56,7 @@ public class EssentialsWarps extends PluginData {
Collections.sort(warps); Collections.sort(warps);
StringBuilder html = new StringBuilder(); StringBuilder html = new StringBuilder();
if (warps.isEmpty()) { if (warps.isEmpty()) {
html.append(Html.TABLELINE_4.parse("No Factions", "", "", "")); html.append(Html.TABLELINE_4.parse(Html.FACTION_NO_FACTIONS.parse(), "", "", ""));
} else { } else {
for (String warp : warps) { for (String warp : warps) {
html.append(Html.TABLELINE_2.parse(warp, "/warp " + warp)); html.append(Html.TABLELINE_2.parse(warp, "/warp " + warp));
@ -64,7 +67,11 @@ public class EssentialsWarps extends PluginData {
@Override @Override
public Serializable getValue(UUID uuid) { public Serializable getValue(UUID uuid) {
return -1; Warps warps = essentials.getWarps();
if (!warps.isEmpty()) {
return warps.getList().toString();
}
return "No Warps.";
} }
} }

View File

@ -3,6 +3,12 @@ package com.djrapitops.pluginbridge.plan.factions;
import com.massivecraft.factions.entity.Faction; import com.massivecraft.factions.entity.Faction;
import com.massivecraft.factions.entity.FactionColl; import com.massivecraft.factions.entity.FactionColl;
import com.massivecraft.factions.entity.MPlayer; import com.massivecraft.factions.entity.MPlayer;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.UUID;
import java.util.stream.Collectors;
import main.java.com.djrapitops.plan.Settings; import main.java.com.djrapitops.plan.Settings;
import main.java.com.djrapitops.plan.data.additional.AnalysisType; import main.java.com.djrapitops.plan.data.additional.AnalysisType;
import main.java.com.djrapitops.plan.data.additional.PluginData; import main.java.com.djrapitops.plan.data.additional.PluginData;
@ -10,20 +16,14 @@ import main.java.com.djrapitops.plan.ui.html.Html;
import main.java.com.djrapitops.plan.utilities.FormatUtils; import main.java.com.djrapitops.plan.utilities.FormatUtils;
import main.java.com.djrapitops.plan.utilities.HtmlUtils; import main.java.com.djrapitops.plan.utilities.HtmlUtils;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;
import java.util.UUID;
import java.util.stream.Collectors;
/** /**
* PluginData class for Factions-plugin. * PluginData class for Factions-plugin.
* <p> *
* Registered to the plugin by FactionsHook * Registered to the plugin by FactionsHook
* *
* @author Rsl1122 * @author Rsl1122
* @see FactionsHook
* @since 3.1.0 * @since 3.1.0
* @see FactionsHook
*/ */
public class FactionsTable extends PluginData { public class FactionsTable extends PluginData {
@ -31,7 +31,7 @@ public class FactionsTable extends PluginData {
/** /**
* Class Constructor, sets the parameters of the PluginData object. * Class Constructor, sets the parameters of the PluginData object.
* <p> *
* Uses Html to easily parse Html for the table. * Uses Html to easily parse Html for the table.
* *
* @see FactionsHook * @see FactionsHook
@ -67,7 +67,7 @@ public class FactionsTable extends PluginData {
StringBuilder html = new StringBuilder(); StringBuilder html = new StringBuilder();
this.factions = getTopFactions(); this.factions = getTopFactions();
if (factions.isEmpty()) { if (factions.isEmpty()) {
html.append(Html.TABLELINE_4.parse("No Factions", "", "", "")); html.append(Html.TABLELINE_4.parse(Html.FACTION_NO_FACTIONS.parse(), "", "", ""));
} else { } else {
for (Faction f : factions) { for (Faction f : factions) {
String name; String name;
@ -77,14 +77,14 @@ public class FactionsTable extends PluginData {
if (f != null) { if (f != null) {
name = f.getName(); name = f.getName();
MPlayer fLeader = f.getLeader(); MPlayer fLeader = f.getLeader();
leader = fLeader != null ? fLeader.getNameAndSomething("", "") : "No Leader"; leader = fLeader != null ? fLeader.getNameAndSomething("", "") : Html.FACTION_NO_LEADER.parse();
power = FormatUtils.cutDecimals(f.getPower()); power = FormatUtils.cutDecimals(f.getPower());
land = f.getLandCount() + ""; land = f.getLandCount() + "";
} else { } else {
name = "Not Found"; name = Html.FACTION_NOT_FOUND.parse();
leader = "Not Found"; leader = Html.FACTION_NOT_FOUND.parse();
power = "Not Found"; power = Html.FACTION_NOT_FOUND.parse();
land = "Not Found"; land = Html.FACTION_NOT_FOUND.parse();
} }
String leaderPage = Html.LINK.parse(HtmlUtils.getInspectUrl(leader), leader); String leaderPage = Html.LINK.parse(HtmlUtils.getInspectUrl(leader), leader);
html.append(Html.TABLELINE_4.parse(name, power, land, leaderPage)); html.append(Html.TABLELINE_4.parse(name, power, land, leaderPage));

View File

@ -4,17 +4,17 @@ import com.massivecraft.factions.entity.MPlayer;
import com.palmergames.bukkit.towny.object.Resident; import com.palmergames.bukkit.towny.object.Resident;
import com.palmergames.bukkit.towny.object.Town; import com.palmergames.bukkit.towny.object.Town;
import com.palmergames.bukkit.towny.object.TownyUniverse; import com.palmergames.bukkit.towny.object.TownyUniverse;
import java.io.Serializable;
import java.util.Collections;
import java.util.List;
import java.util.UUID;
import java.util.stream.Collectors;
import main.java.com.djrapitops.plan.Settings; import main.java.com.djrapitops.plan.Settings;
import main.java.com.djrapitops.plan.data.additional.AnalysisType; import main.java.com.djrapitops.plan.data.additional.AnalysisType;
import main.java.com.djrapitops.plan.data.additional.PluginData; import main.java.com.djrapitops.plan.data.additional.PluginData;
import main.java.com.djrapitops.plan.ui.html.Html; import main.java.com.djrapitops.plan.ui.html.Html;
import main.java.com.djrapitops.plan.utilities.HtmlUtils; import main.java.com.djrapitops.plan.utilities.HtmlUtils;
import java.io.Serializable;
import java.util.List;
import java.util.UUID;
import java.util.stream.Collectors;
/** /**
* PluginData class for Towny-plugin. * PluginData class for Towny-plugin.
* *
@ -45,7 +45,7 @@ public class TownyTable extends PluginData {
StringBuilder html = new StringBuilder(); StringBuilder html = new StringBuilder();
List<Town> towns = getTopTowns(); List<Town> towns = getTopTowns();
if (towns.isEmpty()) { if (towns.isEmpty()) {
html.append(Html.TABLELINE_4.parse("No Towns", "", "", "")); html.append(Html.TABLELINE_4.parse(Html.TOWN_NO_TOWNS.parse(), "", "", ""));
} else { } else {
for (Town t : towns) { for (Town t : towns) {
if (t == null) { if (t == null) {

View File

@ -3,13 +3,13 @@ package com.djrapitops.pluginbridge.plan.towny;
import com.palmergames.bukkit.towny.exceptions.NotRegisteredException; import com.palmergames.bukkit.towny.exceptions.NotRegisteredException;
import com.palmergames.bukkit.towny.object.Resident; import com.palmergames.bukkit.towny.object.Resident;
import com.palmergames.bukkit.towny.object.TownyUniverse; import com.palmergames.bukkit.towny.object.TownyUniverse;
import java.io.Serializable;
import java.util.UUID;
import main.java.com.djrapitops.plan.Phrase;
import main.java.com.djrapitops.plan.Plan; import main.java.com.djrapitops.plan.Plan;
import main.java.com.djrapitops.plan.data.UserData; import main.java.com.djrapitops.plan.data.UserData;
import main.java.com.djrapitops.plan.data.additional.PluginData; import main.java.com.djrapitops.plan.data.additional.PluginData;
import java.io.Serializable;
import java.util.UUID;
/** /**
* PluginData class for Towny-plugin. * PluginData class for Towny-plugin.
* *
@ -37,7 +37,7 @@ public class TownyTown extends PluginData {
public String getHtmlReplaceValue(String modifierPrefix, UUID uuid) { public String getHtmlReplaceValue(String modifierPrefix, UUID uuid) {
UserData data = Plan.getPlanAPI().getInspectCachedUserDataMap().get(uuid); UserData data = Plan.getPlanAPI().getInspectCachedUserDataMap().get(uuid);
if (data == null) { if (data == null) {
return parseContainer(modifierPrefix, "Not in a Town"); return parseContainer(modifierPrefix, Phrase.NOT_IN_TOWN + "");
} }
String name = data.getName(); String name = data.getName();
try { try {
@ -46,11 +46,11 @@ public class TownyTown extends PluginData {
if (res.hasTown()) { if (res.hasTown()) {
town = res.getTown().getName(); town = res.getTown().getName();
} else { } else {
town = "Not in a Town"; town = Phrase.NOT_IN_TOWN + "";
} }
return parseContainer("", town); return parseContainer("", town);
} catch (NotRegisteredException ex) { } catch (NotRegisteredException ex) {
return parseContainer(modifierPrefix, "Not in a Town"); return parseContainer(modifierPrefix, Phrase.NOT_IN_TOWN + "");
} }
} }
@ -58,7 +58,7 @@ public class TownyTown extends PluginData {
public Serializable getValue(UUID uuid) { public Serializable getValue(UUID uuid) {
UserData data = Plan.getPlanAPI().getInspectCachedUserDataMap().get(uuid); UserData data = Plan.getPlanAPI().getInspectCachedUserDataMap().get(uuid);
if (data == null) { if (data == null) {
return "Not in a Town"; return Phrase.NOT_IN_TOWN + "";
} }
String name = data.getName(); String name = data.getName();
try { try {
@ -67,7 +67,7 @@ public class TownyTown extends PluginData {
if (res.hasTown()) { if (res.hasTown()) {
town = res.getTown().getName(); town = res.getTown().getName();
} else { } else {
town = "Not in a Town"; town = Phrase.NOT_IN_TOWN + "";
} }
return town; return town;
} catch (NotRegisteredException ex) { } catch (NotRegisteredException ex) {