diff --git a/pom.xml b/pom.xml
index 6b8b0bd..b393fb3 100644
--- a/pom.xml
+++ b/pom.xml
@@ -6,7 +6,7 @@
com.github.hank9999
UseBlessingSkin
- 1.1.1
+ 1.2.0
jar
UseBlessingSkin
@@ -78,7 +78,7 @@
net.skinsrestorer
skinsrestorer-api
- 14.2.2-SNAPSHOT
+ 15.0.4-SNAPSHOT
provided
diff --git a/src/main/java/com/github/hank9999/useblessingskin/bukkit/Commands/BukkitCommand.java b/src/main/java/com/github/hank9999/useblessingskin/bukkit/Commands/BukkitCommand.java
index 665b706..73b3ee8 100644
--- a/src/main/java/com/github/hank9999/useblessingskin/bukkit/Commands/BukkitCommand.java
+++ b/src/main/java/com/github/hank9999/useblessingskin/bukkit/Commands/BukkitCommand.java
@@ -6,15 +6,14 @@
import static com.github.hank9999.useblessingskin.bukkit.UseBlessingSkin.skinsRestorerAPI;
import static com.github.hank9999.useblessingskin.shared.utils.*;
-import net.skinsrestorer.api.property.IProperty;
+import net.skinsrestorer.api.property.InputDataResult;
+import net.skinsrestorer.api.property.SkinProperty;
import org.bukkit.ChatColor;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.command.TabExecutor;
-import org.bukkit.plugin.java.JavaPlugin;
+import org.bukkit.entity.Player;
import org.bukkit.scheduler.BukkitRunnable;
-
-import net.skinsrestorer.api.PlayerWrapper;
import org.jetbrains.annotations.NotNull;
import java.net.URLEncoder;
@@ -156,12 +155,26 @@ public void run() {
commandSender.sendMessage(ChatColor.AQUA + "[UBS] " + ChatColor.BLUE + getConfig.str("message.UploadTextureSuccess"));
- IProperty iProperty = skinsRestorerAPI.createPlatformProperty("textures", value, signature);
- skinsRestorerAPI.setSkinData(" " + commandSender.getName(), iProperty, 9223243187835955807L);
- skinsRestorerAPI.setSkin(commandSender.getName(), " " + commandSender.getName());
+ UseBlessingSkin.skinStorage.setCustomSkinData(" " + commandSender.getName(), SkinProperty.of(value, signature));
+
+ Optional result = UseBlessingSkin.skinStorage.findOrCreateSkinData(" " + commandSender.getName());
+
+ if (!result.isPresent()) {
+ commandSender.sendMessage(ChatColor.AQUA + "[UBS] " + ChatColor.RED + getConfig.str("message.UnknownError"));
+ return;
+ }
+
+ Player player = UseBlessingSkin.plugin.getServer().getPlayer(commandSender.getName());
+
+ if (player == null) {
+ commandSender.sendMessage(ChatColor.AQUA + "[UBS] " + ChatColor.RED + getConfig.str("message.UnknownError"));
+ return;
+ }
+
+ UseBlessingSkin.playerStorage.setSkinIdOfPlayer(player.getUniqueId(), result.get().getIdentifier());
- skinsRestorerAPI.applySkin(new PlayerWrapper(commandSender));
+ skinsRestorerAPI.getSkinApplier(Player.class).applySkin(player);
commandSender.sendMessage(ChatColor.AQUA + "[UBS] " + ChatColor.BLUE + getConfig.str("message.SetSkinSuccess"));
diff --git a/src/main/java/com/github/hank9999/useblessingskin/bukkit/UseBlessingSkin.java b/src/main/java/com/github/hank9999/useblessingskin/bukkit/UseBlessingSkin.java
index c15989d..4d495e9 100644
--- a/src/main/java/com/github/hank9999/useblessingskin/bukkit/UseBlessingSkin.java
+++ b/src/main/java/com/github/hank9999/useblessingskin/bukkit/UseBlessingSkin.java
@@ -4,7 +4,10 @@
import com.github.hank9999.useblessingskin.bukkit.bStats.MetricsLite;
import com.github.hank9999.useblessingskin.bukkit.Update.Updater;
-import net.skinsrestorer.api.SkinsRestorerAPI;
+import net.skinsrestorer.api.SkinsRestorer;
+import net.skinsrestorer.api.SkinsRestorerProvider;
+import net.skinsrestorer.api.storage.PlayerStorage;
+import net.skinsrestorer.api.storage.SkinStorage;
import org.bukkit.ChatColor;
import org.bukkit.plugin.java.JavaPlugin;
@@ -13,7 +16,9 @@
public final class UseBlessingSkin extends JavaPlugin {
public static UseBlessingSkin plugin;
- public static SkinsRestorerAPI skinsRestorerAPI;
+ public static SkinsRestorer skinsRestorerAPI;
+ public static SkinStorage skinStorage;
+ public static PlayerStorage playerStorage;
@Override
public void onLoad() {
@@ -23,7 +28,9 @@ public void onLoad() {
@Override
public void onEnable() {
plugin = this;
- skinsRestorerAPI = SkinsRestorerAPI.getApi();
+ skinsRestorerAPI = SkinsRestorerProvider.get();
+ skinStorage = skinsRestorerAPI.getSkinStorage();
+ playerStorage = skinsRestorerAPI.getPlayerStorage();
if (!getDataFolder().exists()) {
getDataFolder().mkdir();
}
@@ -53,6 +60,8 @@ public void onEnable() {
public void onDisable() {
plugin = null;
skinsRestorerAPI = null;
+ skinStorage = null;
+ playerStorage = null;
getLogger().info(ChatColor.BLUE + "UseBlessingSkin插件已禁用");
}
}
diff --git a/src/main/java/com/github/hank9999/useblessingskin/bungee/Commands/BungeeCommand.java b/src/main/java/com/github/hank9999/useblessingskin/bungee/Commands/BungeeCommand.java
index 34327fb..6a3f9b1 100644
--- a/src/main/java/com/github/hank9999/useblessingskin/bungee/Commands/BungeeCommand.java
+++ b/src/main/java/com/github/hank9999/useblessingskin/bungee/Commands/BungeeCommand.java
@@ -6,17 +6,18 @@
import net.md_5.bungee.api.CommandSender;
import net.md_5.bungee.api.chat.ClickEvent;
import net.md_5.bungee.api.chat.TextComponent;
+import net.md_5.bungee.api.connection.ProxiedPlayer;
import net.md_5.bungee.api.plugin.Command;
import net.md_5.bungee.api.plugin.TabExecutor;
-import net.skinsrestorer.api.PlayerWrapper;
-import net.skinsrestorer.api.property.IProperty;
+import net.skinsrestorer.api.property.InputDataResult;
+import net.skinsrestorer.api.property.SkinProperty;
import java.net.URLEncoder;
import java.util.*;
import java.util.stream.Collectors;
-import static com.github.hank9999.useblessingskin.bungee.UseBlessingSkin.skinsRestorerAPI;
+import static com.github.hank9999.useblessingskin.bungee.UseBlessingSkin.*;
import static com.github.hank9999.useblessingskin.shared.utils.*;
@@ -169,12 +170,20 @@ public void execute(CommandSender commandSender, String[] strings) {
commandSender.sendMessage(new TextComponent(ChatColor.AQUA + "[UBS] " + ChatColor.BLUE + getConfig.str("message.UploadTextureSuccess")));
- IProperty iProperty = skinsRestorerAPI.createPlatformProperty("textures", value, signature);
- skinsRestorerAPI.setSkinData(" " + commandSender.getName(), iProperty, 9223243187835955807L);
- skinsRestorerAPI.setSkin(commandSender.getName(), " " + commandSender.getName());
+ skinStorage.setCustomSkinData(" " + commandSender.getName(), SkinProperty.of(value, signature));
- skinsRestorerAPI.applySkin(new PlayerWrapper(commandSender));
+ Optional result = skinStorage.findOrCreateSkinData(" " + commandSender.getName());
+
+ if (!result.isPresent()) {
+ commandSender.sendMessage(new TextComponent(ChatColor.AQUA + "[UBS] " + getConfig.str("message.UnknownError")));
+ return;
+ }
+
+ ProxiedPlayer player = instance.getProxy().getPlayer(commandSender.getName());
+ playerStorage.setSkinIdOfPlayer(player.getUniqueId(), result.get().getIdentifier());
+
+ skinsRestorerAPI.getSkinApplier(ProxiedPlayer.class).applySkin(player);
commandSender.sendMessage(new TextComponent(ChatColor.AQUA + "[UBS] " + ChatColor.BLUE + getConfig.str("message.SetSkinSuccess")));
diff --git a/src/main/java/com/github/hank9999/useblessingskin/bungee/UseBlessingSkin.java b/src/main/java/com/github/hank9999/useblessingskin/bungee/UseBlessingSkin.java
index ebb4250..68dc025 100644
--- a/src/main/java/com/github/hank9999/useblessingskin/bungee/UseBlessingSkin.java
+++ b/src/main/java/com/github/hank9999/useblessingskin/bungee/UseBlessingSkin.java
@@ -9,7 +9,10 @@
import net.md_5.bungee.config.Configuration;
import net.md_5.bungee.config.ConfigurationProvider;
import net.md_5.bungee.config.YamlConfiguration;
-import net.skinsrestorer.api.SkinsRestorerAPI;
+import net.skinsrestorer.api.SkinsRestorer;
+import net.skinsrestorer.api.SkinsRestorerProvider;
+import net.skinsrestorer.api.storage.PlayerStorage;
+import net.skinsrestorer.api.storage.SkinStorage;
import java.io.*;
import java.nio.file.Files;
@@ -19,7 +22,9 @@ public final class UseBlessingSkin extends Plugin {
public static UseBlessingSkin instance;
public static Configuration configuration;
- public static SkinsRestorerAPI skinsRestorerAPI;
+ public static SkinsRestorer skinsRestorerAPI;
+ public static SkinStorage skinStorage;
+ public static PlayerStorage playerStorage;
@Override
public void onLoad() {
@@ -29,7 +34,11 @@ public void onLoad() {
@Override
public void onEnable() {
instance = this;
- skinsRestorerAPI = SkinsRestorerAPI.getApi();
+
+ skinsRestorerAPI = SkinsRestorerProvider.get();
+ skinStorage = skinsRestorerAPI.getSkinStorage();
+ playerStorage = skinsRestorerAPI.getPlayerStorage();
+
if (!getDataFolder().exists()) {
getDataFolder().mkdir();
}
@@ -71,6 +80,8 @@ public void onEnable() {
public void onDisable() {
instance = null;
skinsRestorerAPI = null;
+ skinStorage = null;
+ playerStorage = null;
getLogger().info(ChatColor.BLUE + "UseBlessingSkin Disable");
}
diff --git a/src/main/resources/bungee.yml b/src/main/resources/bungee.yml
index e8a7526..af8ba73 100644
--- a/src/main/resources/bungee.yml
+++ b/src/main/resources/bungee.yml
@@ -1,8 +1,8 @@
name: UseBlessingSkin
version: ${project.version}
main: com.github.hank9999.useblessingskin.bungee.UseBlessingSkin
-depend: [SkinsRestorer]
-author: [hank9999]
+softDepends: [ "SkinsRestorer" ]
+author: "hank9999"
description: 让SkinsRestorer使用Blessing Skin Server搭建的皮肤站上的皮肤!
permissions:
diff --git a/src/main/resources/plugin.yml b/src/main/resources/plugin.yml
index 2cfefe2..c2f1c0b 100644
--- a/src/main/resources/plugin.yml
+++ b/src/main/resources/plugin.yml
@@ -1,8 +1,8 @@
name: UseBlessingSkin
version: ${project.version}
main: com.github.hank9999.useblessingskin.bukkit.UseBlessingSkin
-depend: [SkinsRestorer]
-authors: [hank9999]
+softdepend: [ "SkinsRestorer" ]
+authors: ["hank9999"]
description: 让SkinsRestorer使用Blessing Skin Server搭建的皮肤站上的皮肤!
api-version: 1.13