mirror of
https://github.com/kaboomserver/extras.git
synced 2025-02-11 20:00:43 +00:00
Fix /skin & build error
This commit is contained in:
parent
a14f8b07de
commit
c57beec377
4 changed files with 8 additions and 28 deletions
|
@ -45,7 +45,8 @@ public final class PlatformScheduler {
|
||||||
currentScheduler.executeOnGlobalRegion(plugin, runnable);
|
currentScheduler.executeOnGlobalRegion(plugin, runnable);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void executeOnEntity(final Plugin plugin, final Entity entity, final Runnable runnable) {
|
public static void executeOnEntity(final Plugin plugin, final Entity entity,
|
||||||
|
final Runnable runnable) {
|
||||||
currentScheduler.executeOnEntity(plugin, entity, runnable);
|
currentScheduler.executeOnEntity(plugin, entity, runnable);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,8 +7,6 @@ import org.bukkit.command.CommandExecutor;
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
import org.bukkit.command.ConsoleCommandSender;
|
import org.bukkit.command.ConsoleCommandSender;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.plugin.java.JavaPlugin;
|
|
||||||
import pw.kaboom.extras.Main;
|
|
||||||
import pw.kaboom.extras.skin.SkinManager;
|
import pw.kaboom.extras.skin.SkinManager;
|
||||||
|
|
||||||
import javax.annotation.Nonnull;
|
import javax.annotation.Nonnull;
|
||||||
|
@ -23,14 +21,6 @@ public final class CommandSkin implements CommandExecutor {
|
||||||
final @Nonnull Command command,
|
final @Nonnull Command command,
|
||||||
final @Nonnull String label,
|
final @Nonnull String label,
|
||||||
final String[] args) {
|
final String[] args) {
|
||||||
final Main plugin = JavaPlugin.getPlugin(Main.class);
|
|
||||||
|
|
||||||
if (plugin.isFolia()) {
|
|
||||||
sender.sendMessage(Component
|
|
||||||
.text("Command cannot be ran on Folia servers!"));
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (sender instanceof ConsoleCommandSender) {
|
if (sender instanceof ConsoleCommandSender) {
|
||||||
sender.sendMessage(Component
|
sender.sendMessage(Component
|
||||||
.text("Command has to be run by a player"));
|
.text("Command has to be run by a player"));
|
||||||
|
|
|
@ -110,10 +110,8 @@ public final class PlayerConnection implements Listener {
|
||||||
}
|
}
|
||||||
|
|
||||||
final Server server = Bukkit.getServer();
|
final Server server = Bukkit.getServer();
|
||||||
final Main plugin = JavaPlugin.getPlugin(Main.class);
|
|
||||||
|
|
||||||
|
if (!server.getOnlineMode()) {
|
||||||
if (!server.getOnlineMode() && !plugin.isFolia()) {
|
|
||||||
SkinManager.applySkin(player, player.getName(), false);
|
SkinManager.applySkin(player, player.getName(), false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -29,17 +29,13 @@ public final class SkinManager {
|
||||||
.newCachedThreadPool();
|
.newCachedThreadPool();
|
||||||
|
|
||||||
public static void resetSkin(final Player player, final boolean shouldSendMessage) {
|
public static void resetSkin(final Player player, final boolean shouldSendMessage) {
|
||||||
final Main plugin = JavaPlugin.getPlugin(Main.class);
|
|
||||||
|
|
||||||
if (plugin.isFolia()) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
executorService.submit(() -> {
|
executorService.submit(() -> {
|
||||||
final PlayerProfile playerProfile = player.getPlayerProfile();
|
final PlayerProfile playerProfile = player.getPlayerProfile();
|
||||||
playerProfile.removeProperty("textures");
|
playerProfile.removeProperty("textures");
|
||||||
|
|
||||||
PlatformScheduler.runSync(plugin, () -> player.setPlayerProfile(playerProfile));
|
final Main plugin = JavaPlugin.getPlugin(Main.class);
|
||||||
|
PlatformScheduler.executeOnEntity(plugin, player,
|
||||||
|
() -> player.setPlayerProfile(playerProfile));
|
||||||
|
|
||||||
if(!shouldSendMessage) {
|
if(!shouldSendMessage) {
|
||||||
return;
|
return;
|
||||||
|
@ -51,12 +47,6 @@ public final class SkinManager {
|
||||||
|
|
||||||
public static void applySkin(final Player player, final String name,
|
public static void applySkin(final Player player, final String name,
|
||||||
final boolean shouldSendMessage) {
|
final boolean shouldSendMessage) {
|
||||||
final Main plugin = JavaPlugin.getPlugin(Main.class);
|
|
||||||
|
|
||||||
if (plugin.isFolia()) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
executorService.submit(() -> {
|
executorService.submit(() -> {
|
||||||
final PlayerProfile profile = player.getPlayerProfile();
|
final PlayerProfile profile = player.getPlayerProfile();
|
||||||
final SkinData skinData;
|
final SkinData skinData;
|
||||||
|
@ -76,7 +66,8 @@ public final class SkinManager {
|
||||||
final String signature = skinData.signature();
|
final String signature = skinData.signature();
|
||||||
profile.setProperty(new ProfileProperty("textures", texture, signature));
|
profile.setProperty(new ProfileProperty("textures", texture, signature));
|
||||||
|
|
||||||
PlatformScheduler.runSync(plugin,
|
final Main plugin = JavaPlugin.getPlugin(Main.class);
|
||||||
|
PlatformScheduler.executeOnEntity(plugin, player,
|
||||||
() -> player.setPlayerProfile(profile));
|
() -> player.setPlayerProfile(profile));
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue