Skip to content

Commit

Permalink
Merge pull request #1 from bivashy/fix/scaik123/premium-players-suppo…
Browse files Browse the repository at this point in the history
…rt/caffeine-library

[Fix] Relocate and download Caffeine using LibraryManagement
  • Loading branch information
scaik authored Jul 26, 2024
2 parents b450773 + e564f5d commit d0a4eef
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 9 deletions.
4 changes: 1 addition & 3 deletions bungee/src/main/resources/bungee.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,4 @@ softDepends:
- VK-API
- JavaTelegramBotApi
- NanoLimboBungee
author: bivashy, MasterCapeXD
libraries:
- com.github.ben-manes.caffeine:caffeine:3.1.7
author: bivashy, MasterCapeXD
1 change: 0 additions & 1 deletion core/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,6 @@
<dependency>
<groupId>com.github.ben-manes.caffeine</groupId>
<artifactId>caffeine</artifactId>
<version>3.1.7</version>
<scope>provided</scope>
</dependency>
</dependencies>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package me.mastercapexd.auth.management;

import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.List;

import com.alessiodp.libby.Library;
Expand All @@ -11,6 +11,7 @@
public class BaseLibraryManagement implements LibraryManagement {

private static final String JDA_VERSION = "5.0.0-beta.20";
private static final String CAFFEINE_VERSION = "3.1.8";
public static final Library JDA_LIBRARY = Library.builder()
.groupId("net{}dv8tion")
.artifactId("JDA")
Expand All @@ -27,8 +28,17 @@ public class BaseLibraryManagement implements LibraryManagement {
.resolveTransitiveDependencies(true)
.excludeTransitiveDependency("club{}minnced", "opus-java")
.build();
public static final Library CAFFEINE_LIBRARY = Library.builder()
.groupId("com{}github{}ben-manes{}caffeine")
.artifactId("caffeine")
.relocate("com{}github{}benmanes{}caffeine", "com{}bivashy{}auth{}lib{}com{}github{}benmanes{}caffeine")
.version(CAFFEINE_VERSION)
.resolveTransitiveDependencies(true)
.build();
private final List<String> customRepositories = new ArrayList<>();
private final List<Library> customLibraries = new ArrayList<>();
private final List<Library> customLibraries = new ArrayList<>(Collections.singletonList(
CAFFEINE_LIBRARY
));
private final LibraryManager libraryManager;

public BaseLibraryManagement(LibraryManager libraryManager) {
Expand All @@ -42,9 +52,7 @@ public void loadLibraries() {
libraryManager.addMavenCentral();
libraryManager.addJitPack();

Collection<Library> libraries = new ArrayList<>(customLibraries);

libraries.forEach(libraryManager::loadLibrary);
customLibraries.forEach(libraryManager::loadLibrary);
}

@Override
Expand Down
10 changes: 10 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@
<event-bus.version>1.3</event-bus.version>
<libby.version>2.0.0-SNAPSHOT</libby.version>
<nanolimbo.version>1.0.8</nanolimbo.version>
<caffeine.version>3.1.8</caffeine.version>

<!-- Maven plugins -->
<maven.compiler.plugin.version>3.12.1</maven.compiler.plugin.version>
Expand Down Expand Up @@ -327,6 +328,11 @@
<artifactId>api</artifactId>
<version>${nanolimbo.version}</version>
</dependency>
<dependency>
<groupId>com.github.ben-manes.caffeine</groupId>
<artifactId>caffeine</artifactId>
<version>${caffeine.version}</version>
</dependency>
</dependencies>
</dependencyManagement>

Expand Down Expand Up @@ -467,6 +473,10 @@
<pattern>com.grack.nanojson</pattern>
<shadedPattern>${dependencies.relocation.package}.com.grack.nanojson</shadedPattern>
</relocation>
<relocation>
<pattern>com.github.benmanes.caffeine</pattern>
<shadedPattern>${dependencies.relocation.package}.com.github.benmanes.caffeine</shadedPattern>
</relocation>
</relocations>
</configuration>
</plugin>
Expand Down

0 comments on commit d0a4eef

Please sign in to comment.