Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
27 changes: 14 additions & 13 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,35 +7,36 @@ jobs:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- name: Set up JDK 17.0.2
uses: actions/setup-java@v1
- uses: actions/checkout@v4
- name: Set up JDK 21
uses: actions/setup-java@v4
with:
java-version: 17.0

java-version: 21.0
cache: maven
distribution: 'temurin'

- name: Cache Maven packages
uses: actions/cache@v2
uses: actions/cache@v4
with:
path: ~/.m2
key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }}
restore-keys: ${{ runner.os }}-m2-
- name: Compile
run: mvn -B clean package -DskipTests
working-directory: AtlasParent/
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Upload Atlas
uses: actions/upload-artifact@v2
uses: actions/upload-artifact@v4
with:
name: AtlasBukkit
path: AtlasParent/AtlasBukkit/target/AtlasBukkit-*.jar
path: AtlasBukkit/target/AtlasBukkit-*.jar
- name: Upload AtlasBungee
uses: actions/upload-artifact@v2
uses: actions/upload-artifact@v4
with:
name: AtlasBungee
path: AtlasParent/AtlasBungee/target/AtlasBungee-*.jar
path: AtlasBungee/target/AtlasBungee-*.jar
- name: Upload AtlasVelocity
uses: actions/upload-artifact@v2
uses: actions/upload-artifact@v4
with:
name: AtlasVelocity
path: AtlasParent/AtlasVelocity/target/AtlasVelocity-*.jar
path: AtlasVelocity/target/AtlasVelocity-*.jar
85 changes: 64 additions & 21 deletions AtlasParent/Atlas/pom.xml → Atlas/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,11 @@
</parent>

<artifactId>Atlas</artifactId>
<version>1.12.1.1</version>

<scm>
<developerConnection>scm:git:https://github.com/funkemunky/Atlas</developerConnection>
<tag>1.12.1</tag>
<tag>1.12.1.1</tag>
</scm>

<properties>
Expand All @@ -27,8 +28,9 @@
<artifactId>maven-compiler-plugin</artifactId>
<version>3.13.0</version>
<configuration>
<source>8</source>
<target>8</target>
<source>17</source>
<target>17</target>
<useIncrementalCompilation>true</useIncrementalCompilation>
<compilerArgument>-XDignore.symbol.file</compilerArgument>
<annotationProcessorPaths>
<path>
Expand All @@ -50,6 +52,7 @@
<goal>shade</goal>
</goals>
<configuration>
<createDependencyReducedPom>false</createDependencyReducedPom>
<minimizeJar>true</minimizeJar>
<relocations>
<relocation>
Expand All @@ -58,15 +61,31 @@
</relocation>
<relocation>
<pattern>co.aikar.commands</pattern>
<shadedPattern>cc.funkemunky.api.co.aikar.commands</shadedPattern>
<shadedPattern>cc.funkemunky.api.utils.co.aikar.commands</shadedPattern>
</relocation>
<relocation>
<pattern>co.aikar.locales</pattern>
<shadedPattern>cc.funkemunky.api.utils.co.aikar.locales</shadedPattern>
</relocation>
<relocation>
<pattern>com.google.gson</pattern>
<shadedPattern>cc.funkemunky.api.utils.com.google.gson</shadedPattern>
</relocation>
<relocation>
<pattern>org.snakeyaml</pattern>
<shadedPattern>cc.funkemunky.api.utils.org.snakeyaml</shadedPattern>
<pattern>com.google.errorprone</pattern>
<shadedPattern>cc.funkemunky.api.utils.com.google.gson</shadedPattern>
</relocation>
<relocation>
<pattern>com.google.j2objc</pattern>
<shadedPattern>cc.funkemunky.api.utils.com.google.j2objc</shadedPattern>
</relocation>
<relocation>
<pattern>com.google.thirdparty</pattern>
<shadedPattern>cc.funkemunky.api.utils.com.google.thirdparty</shadedPattern>
</relocation>
<relocation>
<pattern>org.yaml</pattern>
<shadedPattern>cc.funkemunky.api.utils.org.yaml</shadedPattern>
</relocation>
<relocation>
<pattern>org.objectweb.asm</pattern>
Expand All @@ -80,6 +99,30 @@
<pattern>it.unimi.dsi</pattern>
<shadedPattern>cc.funkemunky.api.utils.it.unimi.dsi</shadedPattern>
</relocation>
<relocation>
<pattern>com.mongodb</pattern>
<shadedPattern>cc.funkemunky.api.utils.com.mongodb</shadedPattern>
</relocation>
<relocation>
<pattern>okhttp3</pattern>
<shadedPattern>cc.funkemunky.api.utils.okhttp3</shadedPattern>
</relocation>
<relocation>
<pattern>okio</pattern>
<shadedPattern>cc.funkemunky.api.utils.okio</shadedPattern>
</relocation>
<relocation>
<pattern>org.bson</pattern>
<shadedPattern>cc.funkemunky.api.utils.org.bson</shadedPattern>
</relocation>
<relocation>
<pattern>org.json</pattern>
<shadedPattern>cc.funkemunky.api.utils.org.json</shadedPattern>
</relocation>
<relocation>
<pattern>org.slf4j</pattern>
<shadedPattern>cc.funkemunky.api.utils.org.slf4j</shadedPattern>
</relocation>
</relocations>
<filters>
<filter>
Expand All @@ -95,7 +138,7 @@
</includes>
</filter>
<filter>
<artifact>cc.funkemunky.utils:Atlas</artifact>
<artifact>cc.funkemunky.api:Atlas</artifact>
<includes>
<incude>**</incude>
</includes>
Expand Down Expand Up @@ -198,6 +241,12 @@
</distributionManagement>

<dependencies>
<dependency>
<groupId>org.yaml</groupId>
<artifactId>snakeyaml</artifactId>
<version>2.2</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>dev.brighten.db</groupId>
<artifactId>Assembly</artifactId>
Expand All @@ -217,15 +266,15 @@
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.github.paperspigot</groupId>
<artifactId>1.19.4</artifactId>
<version>1.19.4</version>
<groupId>org.spigotmc</groupId>
<artifactId>spigot</artifactId>
<version>1.21.11-R0.2-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.spigotmc</groupId>
<artifactId>spigot</artifactId>
<version>1.19-R0.1</version>
<groupId>org.github.paperspigot</groupId>
<artifactId>1.19.4</artifactId>
<version>1.19.4</version>
<scope>provided</scope>
</dependency>
<dependency>
Expand Down Expand Up @@ -283,16 +332,10 @@
<version>1.16.2</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.yaml</groupId>
<artifactId>snakeyaml</artifactId>
<version>2.2</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>club.minnced</groupId>
<artifactId>discord-webhooks</artifactId>
<version>0.7.5</version>
<version>0.8.4</version>
<scope>compile</scope>
</dependency>
<dependency>
Expand Down Expand Up @@ -334,7 +377,7 @@
<dependency>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
<version>31.1-jre</version>
<version>33.4.0-jre</version>
<scope>compile</scope>
</dependency>
<dependency>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@

package cc.funkemunky.api;

import cc.funkemunky.api.bungee.BungeeManager;
Expand Down Expand Up @@ -85,19 +86,16 @@ public class Atlas extends JavaPlugin {
private final Map<UUID, WorldInfo> worldInfoMap = new HashMap<>();

@ConfigSetting(path = "updater", name = "autoDownload")
private static boolean autoDownload = false;
private static volatile boolean autoDownload = false;

@ConfigSetting(path = "logging", name = "verbose")
private static boolean verboseLogging = true;
private static volatile boolean verboseLogging = true;

@ConfigSetting(name = "metrics")
private static boolean metricsEnabled = true;

@ConfigSetting(path = "init", name = "reloadDependingPlugins")
private static boolean enableDependingPlugins = true;
private static volatile boolean metricsEnabled = true;

@ConfigSetting(path = "ticking", name = "runAsync")
private static boolean runAsync = false;
private static volatile boolean runAsync = false;

@ConfigSetting(name = "debug")
public static boolean debugMode = false;
Expand Down Expand Up @@ -226,15 +224,19 @@ private void shutdownExecutor() {
schedular.shutdown();
}

public Configuration loadConfig(Plugin plugin) {
return loadConfig(plugin, "config");
public void loadConfig(Plugin plugin) {
loadConfig(plugin, "config");
}

@SneakyThrows
public Configuration loadConfig(Plugin plugin, String name) {
public void loadConfig(Plugin plugin, String name) {
File configFile = new File(plugin.getDataFolder(), name +".yml");
if(!configFile.exists()){
configFile.getParentFile().mkdirs();
if(configFile.getParentFile().mkdirs()) {
alog(true, "&7Created plugin folder for &e%s&7!", plugin.getName());
} else {
alog(true, "&cFailed to create plugin folder for &e%s&c! Please check your permissions.", plugin.getName());
}
MiscUtils.copy(plugin.getResource(name + ".yml"), configFile);
}
Configuration yaml = ConfigurationProvider.getProvider(YamlConfiguration.class)
Expand All @@ -248,7 +250,6 @@ public Configuration loadConfig(Plugin plugin, String name) {
return value;
});

return yaml;
}

public Configuration getConfig(Plugin plugin, String name) {
Expand All @@ -270,7 +271,7 @@ public void saveConfig(Plugin plugin, String name) {
ConfigurationProvider.getProvider(YamlConfiguration.class)
.save(config, new File(plugin.getDataFolder(), name + ".yml"));
} catch (IOException e) {
e.printStackTrace();
getLogger().log(Level.WARNING, "Failed to save config for plugin " + plugin.getName(), e);
}
}

Expand All @@ -282,11 +283,11 @@ public void reloadConfig(Plugin plugin, String name) {
loadConfig(plugin, name);
}


public void reloadConfig(Plugin plugin) {
reloadConfig(plugin, "config");
}

@Deprecated
public CommandManager getCommandManager(Plugin plugin) {
return pluginCommandManagers.computeIfAbsent(plugin.getName(), key -> new CommandManager(plugin));
}
Expand Down Expand Up @@ -364,10 +365,14 @@ public void initializeScanner(Class<? extends Plugin> mainClass, Plugin plugin,
try {
if(loader instanceof RemoteClassLoader) {
return new WrappedClass(((RemoteClassLoader)loader).findClass(name));
} else
return new WrappedClass(Class.forName(name, true, loader));
} else return new WrappedClass(Class.forName(name, true, loader));
} catch (ClassNotFoundException e) {
e.printStackTrace();
if(debugMode) getLogger().log(Level.WARNING, "Failed to load class: " + name, e);
//If the class is not found, we return null so it can be filtered out later.
if(e.getMessage() != null && e.getMessage().contains("Unsupported major.minor version")) {
alog(true, "&cThe class &e%s &cis not supported by this version of Atlas! "
+ "Please update your server to a newer version.", name);
}
}
return null;
} else {
Expand All @@ -378,7 +383,8 @@ public void initializeScanner(Class<? extends Plugin> mainClass, Plugin plugin,
if(c == null) return false;
Init init = c.getAnnotation(Init.class);
//If the current version is 1.8, but the required version is 1.9, this will return false.
if(ProtocolVersion.getGameVersion().isBelow(init.requireProtocolVersion())) return false;
if(ProtocolVersion.getGameVersion() != ProtocolVersion.UNKNOWN
&& ProtocolVersion.getGameVersion().isBelow(init.requireProtocolVersion())) return false;

String[] required = init.requirePlugins();

Expand Down Expand Up @@ -458,7 +464,7 @@ public void initializeScanner(Class<? extends Plugin> mainClass, Plugin plugin,
} else if(field.isAnnotationPresent(ConfigSetting.class)) {
ConfigSetting setting = field.getAnnotation(ConfigSetting.class);

String name = setting.name().length() > 0
String name = !setting.name().isEmpty()
? setting.name()
: field.getField().getName();

Expand All @@ -469,12 +475,12 @@ public void initializeScanner(Class<? extends Plugin> mainClass, Plugin plugin,

FileConfiguration config = plugin.getConfig();

if(config.get((setting.path().length() > 0 ? setting.path() + "." : "") + name) == null) {
if(config.get((!setting.path().isEmpty() ? setting.path() + "." : "") + name) == null) {
alog(true,"&7Value not set in config! Setting value...");
config.set((setting.path().length() > 0 ? setting.path() + "." : "") + name, field.get(obj));
config.set((!setting.path().isEmpty() ? setting.path() + "." : "") + name, field.get(obj));
plugin.saveConfig();
} else {
Object configObj = config.get((setting.path().length() > 0 ? setting.path() + "." : "") + name);
Object configObj = config.get((!setting.path().isEmpty() ? setting.path() + "." : "") + name);
alog(true, "&7Set field to value &e%s&7.",
(setting.hide() ? "HIDDEN" : configObj));
field.set(obj, configObj);
Expand Down
Loading
Loading