mirror of
https://github.com/plan-player-analytics/Plan.git
synced 2025-01-24 09:01:41 +01:00
[Debt] Removed MiscUtils.getPlanVersion() method.
This method was dependent on PlanPlugin.getInstance() which is being removed. Also removed use of Settings in MiscUtils.close methods. Affected issues: none
This commit is contained in:
parent
54e3528a59
commit
bff365de20
@ -5,7 +5,6 @@
|
||||
package com.djrapitops.plan.system.webserver.response.errors;
|
||||
|
||||
import com.djrapitops.plan.system.webserver.response.Response;
|
||||
import com.djrapitops.plan.utilities.MiscUtils;
|
||||
import com.djrapitops.plan.utilities.file.FileUtil;
|
||||
import com.djrapitops.plugin.logging.L;
|
||||
import com.djrapitops.plugin.logging.error.ErrorHandler;
|
||||
@ -26,6 +25,7 @@ public class ErrorResponse extends Response {
|
||||
private String paragraph;
|
||||
|
||||
// TODO
|
||||
private String version;
|
||||
private ErrorHandler errorHandler;
|
||||
|
||||
public ErrorResponse() {
|
||||
@ -42,7 +42,7 @@ public class ErrorResponse extends Response {
|
||||
String[] split = title.split(">", 3);
|
||||
placeHolders.put("titleText", split.length == 3 ? split[2] : title);
|
||||
placeHolders.put("paragraph", paragraph);
|
||||
placeHolders.put("version", MiscUtils.getPlanVersion());
|
||||
placeHolders.put("version", version);
|
||||
|
||||
setContent(StringSubstitutor.replace(getContent(), placeHolders));
|
||||
}
|
||||
|
@ -1,10 +1,8 @@
|
||||
package com.djrapitops.plan.utilities;
|
||||
|
||||
import com.djrapitops.plan.PlanPlugin;
|
||||
import com.djrapitops.plan.system.settings.Permissions;
|
||||
import com.djrapitops.plan.system.settings.Settings;
|
||||
import com.djrapitops.plugin.api.TimeAmount;
|
||||
import com.djrapitops.plugin.api.utility.log.Log;
|
||||
import com.djrapitops.plugin.command.CommandUtils;
|
||||
import com.djrapitops.plugin.command.ISender;
|
||||
|
||||
@ -78,11 +76,8 @@ public class MiscUtils {
|
||||
if (c != null) {
|
||||
try {
|
||||
c.close();
|
||||
} catch (IOException e) {
|
||||
if (Settings.DEV_MODE.isTrue()) {
|
||||
Log.warn("THIS ERROR IS ONLY LOGGED IN DEV MODE:");
|
||||
Log.toLog(MiscUtils.class, e);
|
||||
}
|
||||
} catch (IOException ignored) {
|
||||
// Closing exceptions are ignored.
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -93,18 +88,10 @@ public class MiscUtils {
|
||||
if (c != null) {
|
||||
try {
|
||||
c.close();
|
||||
} catch (Exception e) {
|
||||
if (Settings.DEV_MODE.isTrue()) {
|
||||
Log.warn("THIS ERROR IS ONLY LOGGED IN DEV MODE:");
|
||||
Log.toLog(MiscUtils.class, e);
|
||||
}
|
||||
} catch (Exception ignore) {
|
||||
// Closing exceptions are ignored.
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
public static String getPlanVersion() {
|
||||
return PlanPlugin.getInstance().getVersion();
|
||||
}
|
||||
}
|
||||
|
@ -46,6 +46,8 @@ public class InspectPage implements Page {
|
||||
private final PlayerContainer player;
|
||||
private final Map<UUID, String> serverNames;
|
||||
|
||||
private final String version;
|
||||
|
||||
private final PlanConfig config;
|
||||
private final Theme theme;
|
||||
private final Graphs graphs;
|
||||
@ -60,6 +62,7 @@ public class InspectPage implements Page {
|
||||
|
||||
InspectPage(
|
||||
PlayerContainer player, Map<UUID, String> serverNames,
|
||||
String version,
|
||||
PlanConfig config,
|
||||
Theme theme,
|
||||
Graphs graphs,
|
||||
@ -70,6 +73,7 @@ public class InspectPage implements Page {
|
||||
) {
|
||||
this.player = player;
|
||||
this.serverNames = serverNames;
|
||||
this.version = version;
|
||||
this.config = config;
|
||||
this.theme = theme;
|
||||
this.graphs = graphs;
|
||||
@ -107,7 +111,7 @@ public class InspectPage implements Page {
|
||||
PlaceholderReplacer replacer = new PlaceholderReplacer();
|
||||
|
||||
replacer.put("refresh", clockLongFormatter.apply(now));
|
||||
replacer.put("version", MiscUtils.getPlanVersion());
|
||||
replacer.put("version", version);
|
||||
replacer.put("timeZone", MiscUtils.getTimeZoneOffsetHours());
|
||||
|
||||
boolean online = false;
|
||||
|
@ -94,7 +94,9 @@ public class PageFactory {
|
||||
Map<UUID, String> serverNames = database.get().fetch().getServerNames();
|
||||
return new InspectPage(
|
||||
player, serverNames,
|
||||
config.get(), theme.get(), graphs.get(), tables.get(), formatters.get(), serverInfo.get(), timings.get()
|
||||
version,
|
||||
config.get(), theme.get(), graphs.get(), tables.get(), formatters.get(),
|
||||
serverInfo.get(), timings.get()
|
||||
);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user