mirror of
https://github.com/kaboomserver/extras.git
synced 2025-02-11 11:40:19 +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);
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -7,8 +7,6 @@ import org.bukkit.command.CommandExecutor;
|
|||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.command.ConsoleCommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.plugin.java.JavaPlugin;
|
||||
import pw.kaboom.extras.Main;
|
||||
import pw.kaboom.extras.skin.SkinManager;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
@ -23,14 +21,6 @@ public final class CommandSkin implements CommandExecutor {
|
|||
final @Nonnull Command command,
|
||||
final @Nonnull String label,
|
||||
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) {
|
||||
sender.sendMessage(Component
|
||||
.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 Main plugin = JavaPlugin.getPlugin(Main.class);
|
||||
|
||||
|
||||
if (!server.getOnlineMode() && !plugin.isFolia()) {
|
||||
if (!server.getOnlineMode()) {
|
||||
SkinManager.applySkin(player, player.getName(), false);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -29,17 +29,13 @@ public final class SkinManager {
|
|||
.newCachedThreadPool();
|
||||
|
||||
public static void resetSkin(final Player player, final boolean shouldSendMessage) {
|
||||
final Main plugin = JavaPlugin.getPlugin(Main.class);
|
||||
|
||||
if (plugin.isFolia()) {
|
||||
return;
|
||||
}
|
||||
|
||||
executorService.submit(() -> {
|
||||
final PlayerProfile playerProfile = player.getPlayerProfile();
|
||||
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) {
|
||||
return;
|
||||
|
@ -51,12 +47,6 @@ public final class SkinManager {
|
|||
|
||||
public static void applySkin(final Player player, final String name,
|
||||
final boolean shouldSendMessage) {
|
||||
final Main plugin = JavaPlugin.getPlugin(Main.class);
|
||||
|
||||
if (plugin.isFolia()) {
|
||||
return;
|
||||
}
|
||||
|
||||
executorService.submit(() -> {
|
||||
final PlayerProfile profile = player.getPlayerProfile();
|
||||
final SkinData skinData;
|
||||
|
@ -76,7 +66,8 @@ public final class SkinManager {
|
|||
final String signature = skinData.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));
|
||||
|
||||
|
||||
|
|
Loading…
Reference in a new issue