mirror of
https://github.com/plan-player-analytics/Plan.git
synced 2024-09-12 06:48:50 +02:00
Relocated apache packages, Replaced deprecated StrSubstitutor
This commit is contained in:
parent
41cce35f9a
commit
f1024f67c0
11
Plan/pom.xml
11
Plan/pom.xml
@ -74,11 +74,10 @@
|
|||||||
<type>jar</type>
|
<type>jar</type>
|
||||||
<scope>provided</scope>
|
<scope>provided</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
<!-- StringUtils lang3 -->
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.apache.commons</groupId>
|
<groupId>org.apache.commons</groupId>
|
||||||
<artifactId>commons-lang3</artifactId>
|
<artifactId>commons-text</artifactId>
|
||||||
<version>3.6</version>
|
<version>1.3</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
<!-- Geo IP -->
|
<!-- Geo IP -->
|
||||||
<dependency>
|
<dependency>
|
||||||
@ -192,6 +191,12 @@
|
|||||||
<exclude>junit:*</exclude>
|
<exclude>junit:*</exclude>
|
||||||
</excludes>
|
</excludes>
|
||||||
</artifactSet>
|
</artifactSet>
|
||||||
|
<relocations>
|
||||||
|
<relocation>
|
||||||
|
<pattern>org.apache</pattern>
|
||||||
|
<shadedPattern>plan.org.apache</shadedPattern>
|
||||||
|
</relocation>
|
||||||
|
</relocations>
|
||||||
</configuration>
|
</configuration>
|
||||||
</plugin>
|
</plugin>
|
||||||
<plugin>
|
<plugin>
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
*/
|
*/
|
||||||
package com.djrapitops.plan.data;
|
package com.djrapitops.plan.data;
|
||||||
|
|
||||||
import org.apache.commons.lang3.text.WordUtils;
|
import org.apache.commons.text.WordUtils;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* IDs of various actions
|
* IDs of various actions
|
||||||
|
@ -17,7 +17,7 @@ import com.djrapitops.plan.system.webserver.response.pages.InspectPageResponse;
|
|||||||
import com.djrapitops.plan.utilities.Base64Util;
|
import com.djrapitops.plan.utilities.Base64Util;
|
||||||
import com.djrapitops.plan.utilities.file.export.HtmlExport;
|
import com.djrapitops.plan.utilities.file.export.HtmlExport;
|
||||||
import com.djrapitops.plugin.utilities.Verify;
|
import com.djrapitops.plugin.utilities.Verify;
|
||||||
import org.apache.commons.lang3.text.StrSubstitutor;
|
import org.apache.commons.text.StringSubstitutor;
|
||||||
|
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
@ -63,7 +63,7 @@ public class CacheInspectPageRequest extends InfoRequestWithVariables implements
|
|||||||
|
|
||||||
Map<String, String> replace = Collections.singletonMap("networkName", ServerInfo.getServerName());
|
Map<String, String> replace = Collections.singletonMap("networkName", ServerInfo.getServerName());
|
||||||
boolean export = Settings.ANALYSIS_EXPORT.isTrue();
|
boolean export = Settings.ANALYSIS_EXPORT.isTrue();
|
||||||
cache(export, uuid, StrSubstitutor.replace(Base64Util.decode(html), replace));
|
cache(export, uuid, StringSubstitutor.replace(Base64Util.decode(html), replace));
|
||||||
|
|
||||||
return DefaultResponses.SUCCESS.get();
|
return DefaultResponses.SUCCESS.get();
|
||||||
}
|
}
|
||||||
|
@ -26,7 +26,9 @@ public class SpongeConfigSystem extends ServerConfigSystem {
|
|||||||
protected void copyDefaults() throws IOException {
|
protected void copyDefaults() throws IOException {
|
||||||
super.copyDefaults();
|
super.copyDefaults();
|
||||||
if (firstInstall) {
|
if (firstInstall) {
|
||||||
Log.info("WebServer and Geolocations disabled by default. Please enable them in the config.");
|
Log.info("§eWebServer and Geolocations disabled by default on Sponge servers. You can enable them in the config:");
|
||||||
|
Log.info("§e " + Settings.WEBSERVER_DISABLED.getPath());
|
||||||
|
Log.info("§e " + Settings.DATA_GEOLOCATIONS.getPath());
|
||||||
Settings.WEBSERVER_DISABLED.set(true);
|
Settings.WEBSERVER_DISABLED.set(true);
|
||||||
Settings.DATA_GEOLOCATIONS.set(false);
|
Settings.DATA_GEOLOCATIONS.set(false);
|
||||||
Settings.save();
|
Settings.save();
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
package com.djrapitops.plan.system.settings.locale;
|
package com.djrapitops.plan.system.settings.locale;
|
||||||
|
|
||||||
import com.djrapitops.plugin.utilities.Verify;
|
import com.djrapitops.plugin.utilities.Verify;
|
||||||
import org.apache.commons.lang3.text.StrSubstitutor;
|
import org.apache.commons.text.StringSubstitutor;
|
||||||
|
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
@ -30,7 +30,7 @@ public class Message {
|
|||||||
replaceMap.put(String.valueOf(i), p[i].toString());
|
replaceMap.put(String.valueOf(i), p[i].toString());
|
||||||
}
|
}
|
||||||
|
|
||||||
StrSubstitutor sub = new StrSubstitutor(replaceMap);
|
StringSubstitutor sub = new StringSubstitutor(replaceMap);
|
||||||
|
|
||||||
return sub.replace(content);
|
return sub.replace(content);
|
||||||
}
|
}
|
||||||
|
@ -2,7 +2,7 @@ package com.djrapitops.plan.system.webserver.response;
|
|||||||
|
|
||||||
import com.djrapitops.plan.system.settings.theme.Theme;
|
import com.djrapitops.plan.system.settings.theme.Theme;
|
||||||
import com.djrapitops.plan.system.settings.theme.ThemeVal;
|
import com.djrapitops.plan.system.settings.theme.ThemeVal;
|
||||||
import org.apache.commons.lang3.text.StrSubstitutor;
|
import org.apache.commons.text.StringSubstitutor;
|
||||||
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
@ -18,6 +18,6 @@ public class JavaScriptResponse extends FileResponse {
|
|||||||
super.setType(ResponseType.JAVASCRIPT);
|
super.setType(ResponseType.JAVASCRIPT);
|
||||||
Map<String, String> replace = new HashMap<>();
|
Map<String, String> replace = new HashMap<>();
|
||||||
replace.put("defaultTheme", Theme.getValue(ThemeVal.THEME_DEFAULT));
|
replace.put("defaultTheme", Theme.getValue(ThemeVal.THEME_DEFAULT));
|
||||||
setContent(StrSubstitutor.replace(Theme.replaceColors(getContent()), replace));
|
setContent(StringSubstitutor.replace(Theme.replaceColors(getContent()), replace));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -9,7 +9,7 @@ import com.djrapitops.plan.system.webserver.response.Response;
|
|||||||
import com.djrapitops.plan.utilities.MiscUtils;
|
import com.djrapitops.plan.utilities.MiscUtils;
|
||||||
import com.djrapitops.plan.utilities.file.FileUtil;
|
import com.djrapitops.plan.utilities.file.FileUtil;
|
||||||
import com.djrapitops.plugin.api.utility.log.Log;
|
import com.djrapitops.plugin.api.utility.log.Log;
|
||||||
import org.apache.commons.lang3.text.StrSubstitutor;
|
import org.apache.commons.text.StringSubstitutor;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
@ -41,7 +41,7 @@ public class ErrorResponse extends Response {
|
|||||||
placeHolders.put("paragraph", paragraph);
|
placeHolders.put("paragraph", paragraph);
|
||||||
placeHolders.put("version", MiscUtils.getPlanVersion());
|
placeHolders.put("version", MiscUtils.getPlanVersion());
|
||||||
|
|
||||||
setContent(StrSubstitutor.replace(getContent(), placeHolders));
|
setContent(StringSubstitutor.replace(getContent(), placeHolders));
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setTitle(String title) {
|
public void setTitle(String title) {
|
||||||
|
@ -6,7 +6,7 @@ import com.djrapitops.plan.system.webserver.response.cache.PageId;
|
|||||||
import com.djrapitops.plan.system.webserver.response.cache.ResponseCache;
|
import com.djrapitops.plan.system.webserver.response.cache.ResponseCache;
|
||||||
import com.djrapitops.plan.system.webserver.response.errors.ErrorResponse;
|
import com.djrapitops.plan.system.webserver.response.errors.ErrorResponse;
|
||||||
import com.djrapitops.plan.system.webserver.response.pages.parts.InspectPagePluginsContent;
|
import com.djrapitops.plan.system.webserver.response.pages.parts.InspectPagePluginsContent;
|
||||||
import org.apache.commons.lang3.text.StrSubstitutor;
|
import org.apache.commons.text.StringSubstitutor;
|
||||||
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
@ -35,7 +35,7 @@ public class InspectPageResponse extends Response {
|
|||||||
replaceMap.put("navPluginsTabs", inspectPagePluginsTab[0]);
|
replaceMap.put("navPluginsTabs", inspectPagePluginsTab[0]);
|
||||||
replaceMap.put("pluginsTabs", inspectPagePluginsTab[1]);
|
replaceMap.put("pluginsTabs", inspectPagePluginsTab[1]);
|
||||||
|
|
||||||
return StrSubstitutor.replace(super.getContent(), replaceMap);
|
return StringSubstitutor.replace(super.getContent(), replaceMap);
|
||||||
}
|
}
|
||||||
|
|
||||||
private String[] getCalculating() {
|
private String[] getCalculating() {
|
||||||
|
@ -20,7 +20,7 @@ import com.djrapitops.plan.utilities.file.FileUtil;
|
|||||||
import com.djrapitops.plan.utilities.html.Html;
|
import com.djrapitops.plan.utilities.html.Html;
|
||||||
import com.djrapitops.plugin.api.Check;
|
import com.djrapitops.plugin.api.Check;
|
||||||
import com.djrapitops.plugin.api.utility.log.Log;
|
import com.djrapitops.plugin.api.utility.log.Log;
|
||||||
import org.apache.commons.lang3.text.StrSubstitutor;
|
import org.apache.commons.text.StringSubstitutor;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
@ -47,7 +47,7 @@ public class PlayersPageResponse extends Response {
|
|||||||
}
|
}
|
||||||
replace.put("playersTable", buildPlayersTable(db));
|
replace.put("playersTable", buildPlayersTable(db));
|
||||||
replace.put("version", plugin.getVersion());
|
replace.put("version", plugin.getVersion());
|
||||||
super.setContent(Theme.replaceColors(StrSubstitutor.replace(FileUtil.getStringFromResource("web/players.html"), replace)));
|
super.setContent(Theme.replaceColors(StringSubstitutor.replace(FileUtil.getStringFromResource("web/players.html"), replace)));
|
||||||
} catch (DBException | IOException e) {
|
} catch (DBException | IOException e) {
|
||||||
Log.toLog(this.getClass(), e);
|
Log.toLog(this.getClass(), e);
|
||||||
setContent(new InternalErrorResponse("/players", e).getContent());
|
setContent(new InternalErrorResponse("/players", e).getContent());
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
package com.djrapitops.plan.utilities.html;
|
package com.djrapitops.plan.utilities.html;
|
||||||
|
|
||||||
import org.apache.commons.lang3.text.StrSubstitutor;
|
import org.apache.commons.text.StringSubstitutor;
|
||||||
|
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
@ -131,7 +131,7 @@ public enum Html {
|
|||||||
replaceMap.put(String.valueOf(i), p[i]);
|
replaceMap.put(String.valueOf(i), p[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
StrSubstitutor sub = new StrSubstitutor(replaceMap);
|
StringSubstitutor sub = new StringSubstitutor(replaceMap);
|
||||||
sub.setEnableSubstitutionInVariables(false);
|
sub.setEnableSubstitutionInVariables(false);
|
||||||
return sub.replace(html);
|
return sub.replace(html);
|
||||||
}
|
}
|
||||||
|
@ -2,7 +2,7 @@ package com.djrapitops.plan.utilities.html;
|
|||||||
|
|
||||||
import com.djrapitops.plan.system.info.server.ServerInfo;
|
import com.djrapitops.plan.system.info.server.ServerInfo;
|
||||||
import com.djrapitops.plan.system.settings.Settings;
|
import com.djrapitops.plan.system.settings.Settings;
|
||||||
import org.apache.commons.lang3.text.StrSubstitutor;
|
import org.apache.commons.text.StringSubstitutor;
|
||||||
|
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
@ -27,7 +27,7 @@ public class HtmlUtils {
|
|||||||
* @return Html with placeholders replaced
|
* @return Html with placeholders replaced
|
||||||
*/
|
*/
|
||||||
public static String replacePlaceholders(String html, Map<String, Serializable> replaceMap) {
|
public static String replacePlaceholders(String html, Map<String, Serializable> replaceMap) {
|
||||||
StrSubstitutor sub = new StrSubstitutor(replaceMap);
|
StringSubstitutor sub = new StringSubstitutor(replaceMap);
|
||||||
sub.setEnableSubstitutionInVariables(true);
|
sub.setEnableSubstitutionInVariables(true);
|
||||||
return sub.replace(html);
|
return sub.replace(html);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user