Skip to content

Commit

Permalink
Update SkinsRestorer integration (fixes #33)
Browse files Browse the repository at this point in the history
  • Loading branch information
MrMicky-FR committed Dec 5, 2023
1 parent 9f24ddb commit b1fcbdb
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 17 deletions.
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
allprojects {
group 'com.azuriom'
version '1.3.3'
version '1.3.4'
}

subprojects {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
import com.azuriom.azlink.bukkit.integrations.AuthMeIntegration;
import com.azuriom.azlink.bukkit.integrations.FoliaSchedulerAdapter;
import com.azuriom.azlink.bukkit.integrations.MoneyPlaceholderExpansion;
import com.azuriom.azlink.bukkit.integrations.SkinRestorerIntegration;
import com.azuriom.azlink.bukkit.integrations.SkinsRestorerIntegration;
import com.azuriom.azlink.common.AzLinkPlatform;
import com.azuriom.azlink.common.AzLinkPlugin;
import com.azuriom.azlink.common.command.CommandSender;
Expand Down Expand Up @@ -90,7 +90,7 @@ && getServer().getPluginManager().getPlugin("SkinsRestorer") != null) {
try {
Class.forName("net.skinsrestorer.api.SkinsRestorer");

getServer().getPluginManager().registerEvents(new SkinRestorerIntegration(this), this);
getServer().getPluginManager().registerEvents(new SkinsRestorerIntegration(this), this);
} catch (ClassNotFoundException e) {
getLogger().severe("SkinsRestorer integration requires SkinsRestorer v15.0.0 or higher");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,16 +11,14 @@
import org.bukkit.event.Listener;
import org.bukkit.event.player.PlayerJoinEvent;

public class SkinRestorerIntegration implements Listener {
public class SkinsRestorerIntegration implements Listener {

private final SkinsRestorer skinsRestorer;
private final AzLinkBukkitPlugin plugin;

public SkinRestorerIntegration(AzLinkBukkitPlugin plugin) {
public SkinsRestorerIntegration(AzLinkBukkitPlugin plugin) {
this.plugin = plugin;
this.skinsRestorer = SkinsRestorerProvider.get();

this.plugin.getLoggerAdapter().info("SkinRestorer integration enabled.");
this.plugin.getLoggerAdapter().info("SkinsRestorer integration enabled.");
}

@EventHandler
Expand All @@ -35,9 +33,10 @@ public void onPlayerJoin(PlayerJoinEvent e) {

try {
String url = baseUrl + "/api/skin-api/skins/" + player.getName();
MineSkinResponse skin = this.skinsRestorer.getMineSkinAPI().genSkin(url, null);
SkinsRestorer skins = SkinsRestorerProvider.get();
MineSkinResponse res = skins.getMineSkinAPI().genSkin(url, null);

this.skinsRestorer.getSkinApplier(Player.class).applySkin(player, skin.getProperty());
skins.getSkinApplier(Player.class).applySkin(player, res.getProperty());
} catch (DataRequestException | MineSkinException ex) {
this.plugin.getLoggerAdapter().warn("Unable to apply skin for " + player.getName() + ": " + ex.getMessage());
}
Expand Down
2 changes: 1 addition & 1 deletion bukkit/src/main/resources/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,6 @@ ignore-vanished-players: false
# from registering multiple times
authme-integration: false

# When enabled, if SkinRestorer is installed, and the SkinAPI plugin is present on the website,
# When enabled, if SkinsRestorer is installed, and the SkinAPI plugin is present on the website,
# the player's skin will be updated to the website's skin
skinrestorer-integration: false
12 changes: 6 additions & 6 deletions fabric/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,17 @@ sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17

ext {
minecraft_version = '1.20'
yarn_mappings = '1.20+build.1'
loader_version = '0.14.21'
fabric_version = '0.83.0+1.20'
minecraft_version = '1.20.2'
yarn_mappings = '1.20.2+build.4'
loader_version = '0.15.0'
fabric_version = '0.91.1+1.20.2'
}

dependencies {
implementation project(':azlink-common')
implementation 'net.kyori:adventure-api:4.12.0'
implementation 'net.kyori:adventure-text-serializer-gson:4.12.0'
implementation 'net.kyori:adventure-text-serializer-legacy:4.12.0'
implementation 'net.kyori:adventure-text-serializer-gson:4.14.0'
implementation 'net.kyori:adventure-text-serializer-legacy:4.14.0'
minecraft "com.mojang:minecraft:${project.ext.minecraft_version}"
mappings "net.fabricmc:yarn:${project.ext.yarn_mappings}:v2"
modImplementation "net.fabricmc:fabric-loader:${project.ext.loader_version}"
Expand Down

0 comments on commit b1fcbdb

Please sign in to comment.