diff --git a/pom.xml b/pom.xml index 32deb28..3fe2e8a 100644 --- a/pom.xml +++ b/pom.xml @@ -4,27 +4,12 @@ Extras master - - 11 - 11 - - com.destroystokyo.paper paper-api 1.12.2-R0.1-SNAPSHOT - - com.boydti - fawe-api - latest - - - com.sk89q.worldedit - worldedit-bukkit - 6.1.4-SNAPSHOT - @@ -32,14 +17,6 @@ papermc https://papermc.io/repo/repository/maven-public/ - - fawe - https://ci.athion.net/job/FastAsyncWorldEdit/ws/mvn/ - - - worldedit - https://maven.sk89q.com/repo/ - diff --git a/src/main/java/pw/kaboom/extras/Commands.java b/src/main/java/pw/kaboom/extras/Commands.java index 5c45dc9..5aa75d7 100644 --- a/src/main/java/pw/kaboom/extras/Commands.java +++ b/src/main/java/pw/kaboom/extras/Commands.java @@ -179,50 +179,58 @@ class CommandSkin implements CommandExecutor { this.main = main; } - public boolean onCommand(CommandSender sender, Command command, String label, String[] args) { - Player player = (Player) sender; + public boolean onCommand(CommandSender sender, Command command, String label, final String[] args) { + final Player player = (Player) sender; if (args.length == 0) { player.sendMessage(ChatColor.RED + "Usage: /" + label + " "); } else { - Bukkit.getScheduler().runTaskAsynchronously(main, () -> { - try { - String name = args[0]; - URL nameurl = new URL("https://api.mojang.com/users/profiles/minecraft/" + name); - HttpURLConnection nameconnection = (HttpURLConnection) nameurl.openConnection(); + Bukkit.getScheduler().runTaskAsynchronously(main, new Runnable() { + public void run() { + try { + final String name = args[0]; + URL nameurl = new URL("https://api.mojang.com/users/profiles/minecraft/" + name); + HttpURLConnection nameconnection = (HttpURLConnection) nameurl.openConnection(); - if (nameconnection.getResponseCode() == 200) { - InputStreamReader namestream = new InputStreamReader(nameconnection.getInputStream()); - String uuid = new JsonParser().parse(namestream).getAsJsonObject().get("id").getAsString(); - URL uuidurl = new URL("https://sessionserver.mojang.com/session/minecraft/profile/" + uuid + "?unsigned=false"); - HttpURLConnection uuidconnection = (HttpURLConnection) uuidurl.openConnection(); + if (nameconnection.getResponseCode() == 200) { + InputStreamReader namestream = new InputStreamReader(nameconnection.getInputStream()); + String uuid = new JsonParser().parse(namestream).getAsJsonObject().get("id").getAsString(); + URL uuidurl = new URL("https://sessionserver.mojang.com/session/minecraft/profile/" + uuid + "?unsigned=false"); + HttpURLConnection uuidconnection = (HttpURLConnection) uuidurl.openConnection(); - if (uuidconnection.getResponseCode() == 200) { - InputStreamReader uuidstream = new InputStreamReader(uuidconnection.getInputStream()); - JsonObject response = new JsonParser().parse(uuidstream).getAsJsonObject().get("properties").getAsJsonArray().get(0).getAsJsonObject(); - String texture = response.get("value").getAsString(); - String signature = response.get("signature").getAsString(); + if (uuidconnection.getResponseCode() == 200) { + InputStreamReader uuidstream = new InputStreamReader(uuidconnection.getInputStream()); + JsonObject response = new JsonParser().parse(uuidstream).getAsJsonObject().get("properties").getAsJsonArray().get(0).getAsJsonObject(); + final String texture = response.get("value").getAsString(); + final String signature = response.get("signature").getAsString(); - Bukkit.getScheduler().scheduleSyncDelayedTask(main, () -> { - PlayerProfile textureprofile = player.getPlayerProfile(); - textureprofile.setProperty(new ProfileProperty("textures", texture, signature)); - player.setPlayerProfile(textureprofile); - player.sendMessage("Successfully set your skin to " + name + "'s"); - }); + Bukkit.getScheduler().scheduleSyncDelayedTask(main, new Runnable() { + public void run() { + PlayerProfile textureprofile = player.getPlayerProfile(); + textureprofile.setProperty(new ProfileProperty("textures", texture, signature)); + player.setPlayerProfile(textureprofile); + player.sendMessage("Successfully set your skin to " + name + "'s"); + } + }); + } else { + Bukkit.getScheduler().scheduleSyncDelayedTask(main, new Runnable() { + public void run() { + player.sendMessage("Failed to change skin. Try again later"); + } + }); + } + uuidconnection.disconnect(); } else { - Bukkit.getScheduler().scheduleSyncDelayedTask(main, () -> { - player.sendMessage("Failed to change skin. Try again later"); + Bukkit.getScheduler().scheduleSyncDelayedTask(main, new Runnable() { + public void run() { + player.sendMessage("A player with that username doesn't exist"); + } }); } - uuidconnection.disconnect(); - } else { - Bukkit.getScheduler().scheduleSyncDelayedTask(main, () -> { - player.sendMessage("A player with that username doesn't exist"); - }); + nameconnection.disconnect(); + } catch (Exception exception) { + exception.printStackTrace(); } - nameconnection.disconnect(); - } catch (Exception exception) { - exception.printStackTrace(); } }); } @@ -235,7 +243,7 @@ class CommandSpawn implements CommandExecutor { Player player = (Player) sender; World world = Bukkit.getWorld("world"); - player.teleport(new Location(world, 0.5, 100, 0.5)); + player.teleport(world.getSpawnLocation()); player.sendMessage("Successfully moved to the spawn"); return true; } diff --git a/src/main/java/pw/kaboom/extras/Events.java b/src/main/java/pw/kaboom/extras/Events.java index dc360e7..f1ae8d9 100644 --- a/src/main/java/pw/kaboom/extras/Events.java +++ b/src/main/java/pw/kaboom/extras/Events.java @@ -3,8 +3,9 @@ package pw.kaboom.extras; import java.util.ArrayList; import java.util.Collection; import java.util.Iterator; +import java.util.UUID; -import com.boydti.fawe.FaweAPI; +import java.util.concurrent.TimeUnit; import com.destroystokyo.paper.event.entity.EntityAddToWorldEvent; import com.destroystokyo.paper.event.entity.EntityKnockbackByEntityEvent; @@ -26,6 +27,7 @@ import org.bukkit.block.Block; import org.bukkit.block.BlockState; import org.bukkit.block.Container; import org.bukkit.block.CreatureSpawner; +import org.bukkit.block.Sign; import org.bukkit.entity.Player; import org.bukkit.entity.Entity; @@ -38,31 +40,29 @@ import org.bukkit.entity.Slime; import org.bukkit.event.EventHandler; import org.bukkit.event.Listener; -import org.bukkit.event.block.BlockExplodeEvent; -import org.bukkit.event.block.BlockFromToEvent; import org.bukkit.event.block.BlockPhysicsEvent; import org.bukkit.event.block.BlockPlaceEvent; import org.bukkit.event.block.BlockRedstoneEvent; import org.bukkit.event.block.BlockSpreadEvent; +import org.bukkit.event.block.SignChangeEvent; -import org.bukkit.event.entity.EntityDamageEvent; import org.bukkit.event.entity.EntityDamageEvent.DamageCause; +import org.bukkit.event.entity.EntityDeathEvent; import org.bukkit.event.entity.EntitySpawnEvent; import org.bukkit.event.entity.ExplosionPrimeEvent; import org.bukkit.event.entity.ItemSpawnEvent; -import org.bukkit.event.entity.LingeringPotionSplashEvent; -import org.bukkit.event.entity.PotionSplashEvent; import org.bukkit.event.entity.SpawnerSpawnEvent; import org.bukkit.event.player.AsyncPlayerChatEvent; import org.bukkit.event.player.AsyncPlayerPreLoginEvent; import org.bukkit.event.player.PlayerCommandPreprocessEvent; import org.bukkit.event.player.PlayerDropItemEvent; +import org.bukkit.event.player.PlayerInteractEvent; import org.bukkit.event.player.PlayerJoinEvent; import org.bukkit.event.player.PlayerKickEvent; import org.bukkit.event.player.PlayerLoginEvent; import org.bukkit.event.player.PlayerLoginEvent.Result; -import org.bukkit.event.player.PlayerRespawnEvent; +import org.bukkit.event.player.PlayerQuitEvent; import org.bukkit.event.server.ServerCommandEvent; @@ -74,28 +74,13 @@ import org.bukkit.inventory.meta.PotionMeta; import org.bukkit.scheduler.BukkitRunnable; -import org.spigotmc.event.player.PlayerSpawnLocationEvent; - -import com.sk89q.worldedit.EditSession; -import com.sk89q.worldedit.Vector; -import com.sk89q.worldedit.extent.clipboard.io.ClipboardFormat; -import com.sk89q.worldedit.math.transform.Transform; - -class PasteSpawn extends BukkitRunnable { +class Tick extends BukkitRunnable { Main main; - PasteSpawn(Main main) { + Tick(Main main) { this.main = main; } public void run() { - try { - boolean allowUndo = false; - boolean noAir = false; - Vector position = new Vector(0, 100, 0); - EditSession editSession = ClipboardFormat.findByFile(main.spawnSchematic).load(main.spawnSchematic).paste(FaweAPI.getWorld("world"), position, allowUndo, !noAir, (Transform) null); - } catch (Exception exception) { - exception.printStackTrace(); - } } } @@ -106,11 +91,14 @@ class TickAsync extends BukkitRunnable { } public void run() { - for (World world : Bukkit.getServer().getWorlds()) { + for (final World world : Bukkit.getServer().getWorlds()) { WorldBorder worldborder = world.getWorldBorder(); + if (worldborder.getSize() != 60000000) { worldborder.setSize(60000000); - } else if (worldborder.getCenter().getX() != 0 || worldborder.getCenter().getZ() != 0) { + } + + if (worldborder.getCenter().getX() != 0 || worldborder.getCenter().getZ() != 0) { worldborder.setCenter(0, 0); } @@ -118,47 +106,34 @@ class TickAsync extends BukkitRunnable { world.setAutoSave(true); } - for (Entity entity : world.getEntities()) { - if (entity instanceof LivingEntity) { - LivingEntity mob = (LivingEntity) entity; - AttributeInstance followAttribute = mob.getAttribute(Attribute.GENERIC_FOLLOW_RANGE); - - if (followAttribute != null && followAttribute.getBaseValue() > 40) { - followAttribute.setBaseValue(32); + try { + for (final Chunk chunk : world.getLoadedChunks()) { + try { + chunk.getTileEntities(); + } catch (Exception e) { + Bukkit.getScheduler().runTask(main, new Runnable() { + public void run() { + world.regenerateChunk(chunk.getX(), chunk.getZ()); + } + }); } } + } catch (Exception e) { } - for (Chunk chunk : world.getLoadedChunks()) { - try { - int sizeCount = 0; - for (BlockState block : chunk.getTileEntities()) { - if (block instanceof Container) { - Container container = (Container) block; + try { + for (LivingEntity mob : world.getLivingEntities()) { + final AttributeInstance followAttribute = mob.getAttribute(Attribute.GENERIC_FOLLOW_RANGE); - for (ItemStack item : container.getInventory().getContents()) { - if (item != null) { - try { - sizeCount = sizeCount + item.toString().length(); - - if (sizeCount > 200000) { - for (BlockState chunkBlock : chunk.getTileEntities()) { - if (chunkBlock instanceof Container) { - Bukkit.getScheduler().scheduleSyncDelayedTask(main, () -> { - chunkBlock.getBlock().getDrops().clear(); - chunkBlock.getBlock().setType(Material.AIR); - }); - } - } - } - } catch (Exception e) { - } - } + if (followAttribute != null && followAttribute.getBaseValue() > 40) { + Bukkit.getScheduler().runTask(main, new Runnable() { + public void run() { + followAttribute.setBaseValue(40); } - } + }); } - } catch (Exception e) { } + } catch (Exception e) { } } } @@ -184,38 +159,40 @@ class Events implements Listener { String prefix = ChatColor.translateAlternateColorCodes('&', "&8&l[&7&lDeOP&8&l]"); event.setFormat(prefix + ChatColor.GRAY + " " + player.getDisplayName().toString() + ChatColor.RESET + ": " + ChatColor.RESET + "%2$s"); } + event.setMessage(ChatColor.translateAlternateColorCodes('&', event.getMessage())); } - @EventHandler - void onBlockExplode(BlockExplodeEvent event) { - double tps = Bukkit.getServer().getTPS()[0]; - - if (tps < 14) { - event.setCancelled(true); - } - } - - @EventHandler - void onBlockFromTo(BlockFromToEvent event) { - Block block = event.getBlock(); - - if (block.getType() != Material.DRAGON_EGG || - block.getType() != Material.LAVA || - block.getType() != Material.STATIONARY_LAVA || - block.getType() != Material.STATIONARY_WATER || - block.getType() != Material.WATER) { - event.setCancelled(true); - } - } - @EventHandler void onBlockPhysics(BlockPhysicsEvent event) { Block block = event.getBlock(); + World world = event.getBlock().getWorld(); + int radius = 10; + int blockCount = 0; - if (block.getType() == Material.SOIL) { - event.setCancelled(true); + for (int x = -radius; x < radius; x++) { + for (int y = -radius; y < radius; y++) { + for (int z = -radius; z < radius; z++) { + if (blockCount < 15) { + Location blockLocation = new Location(world, block.getX() + x, block.getY() + y, block.getZ() + z); + Block coordBlock = world.getBlockAt(blockLocation); + + if (coordBlock.getType() == block.getType()) { + blockCount++; + } + continue; + } + break; + } + } } + + if (block.getType() == Material.SOIL || + blockCount == 15) { + event.setCancelled(true); + System.out.println("test"); + } + } @EventHandler @@ -223,6 +200,12 @@ class Events implements Listener { if (event.getItemInHand().toString().length() > 3019) { event.setCancelled(true); } + + try { + event.getBlockPlaced().getState(); + } catch (Exception e) { + event.setCancelled(true); + } } @EventHandler @@ -251,13 +234,17 @@ class Events implements Listener { int onChunk = 0; for (Entity chunkEntity : chunkEntities) { - if (onChunk < 50 && chunkEntity.getType() != EntityType.PLAYER) { - onChunk++; + if (onChunk < 50) { + if (chunkEntity.getType() != EntityType.PLAYER) { + onChunk++; + } + continue; } + break; } - if (onChunk == 50 && !(entity instanceof LivingEntity) || - tps < 14 && entity.getType() == EntityType.PRIMED_TNT) { + if ((onChunk == 50 && !(entity instanceof LivingEntity)) || + (tps < 14 && entity.getType() == EntityType.PRIMED_TNT)) { entity.remove(); } @@ -272,12 +259,14 @@ class Events implements Listener { } @EventHandler - void onEntityDamage(EntityDamageEvent event) { + void onEntityDeath(EntityDeathEvent event) { Entity entity = event.getEntity(); + if (entity.getType() == EntityType.PLAYER) { - if (event.getCause() == DamageCause.VOID && entity.getLocation().getY() > -64 || - event.getCause() == DamageCause.CUSTOM || - event.getCause() == DamageCause.SUICIDE) { + if ((entity.getLastDamageCause().getCause() == DamageCause.VOID && entity.getLocation().getY() > -64) || + entity.getLastDamageCause().getCause() == DamageCause.CUSTOM || + entity.getLastDamageCause().getCause() == DamageCause.SUICIDE) { + ((Player)entity).setHealth(20); event.setCancelled(true); } } @@ -299,9 +288,13 @@ class Events implements Listener { int onChunk = 0; for (Entity chunkEntity : chunkEntities) { - if (onChunk < 50 && chunkEntity.getType() != EntityType.PLAYER) { - onChunk++; + if (onChunk < 50) { + if (chunkEntity.getType() != EntityType.PLAYER) { + onChunk++; + } + continue; } + break; } if (onChunk == 50 && entity.getType() != EntityType.PLAYER) { @@ -381,36 +374,36 @@ class Events implements Listener { } } - @EventHandler - void onLingeringPotionSplash(LingeringPotionSplashEvent event) { - Entity entity = event.getEntity(); - double x = entity.getLocation().getX(); - double z = entity.getLocation().getZ(); - - if (entity.getWorld().getName().equals("world")) { - if ((x > -20 && x < 20) && (z > -20 && z < 20)) { - event.setCancelled(true); - } - } - } - - @EventHandler - void onPotionSplash(PotionSplashEvent event) { - Entity entity = event.getEntity(); - double x = entity.getLocation().getX(); - double z = entity.getLocation().getZ(); - - if (entity.getWorld().getName().equals("world")) { - if ((x > -20 && x < 20) && (z > -20 && z < 20)) { - event.setCancelled(true); - } - } - } - @EventHandler void onPlayerCommandPreprocess(PlayerCommandPreprocessEvent event) { String arr[] = event.getMessage().split(" "); + UUID playerUUID = event.getPlayer().getUniqueId(); + long millisDifference = System.currentTimeMillis() - main.commandMillisList.get(playerUUID); + if (millisDifference < 400) { + event.setCancelled(true); + } else { + main.commandMillisList.put(playerUUID, System.currentTimeMillis()); + } + +/* if (arr[0].toLowerCase().equals("/minecraft:blockdata") || + arr[0].toLowerCase().equals("/blockdata")) { + if (arr[4] != null && + !arr[4].equals("{}")) { + final Player player = event.getPlayer(); + + Bukkit.getScheduler().scheduleAsyncDelayedTask(main, new Runnable() { + public void run() { + for (Chunk chunk : player.getWorld().getLoadedChunks()) { + try { + chunk.getTileEntities(); + } catch (Exception e) { + player.getWorld().regenerateChunk(chunk.getX(), chunk.getZ()); + } + } + } + }, 1L); + }*/ if (arr[0].toLowerCase().equals("/minecraft:gamerule") || arr[0].toLowerCase().equals("/gamerule")) { if (arr[1] != null && arr[1].toLowerCase().equals("randomtickspeed")) { @@ -429,25 +422,45 @@ class Events implements Listener { } @EventHandler - void onPlayerJoin(PlayerJoinEvent event) { + void onPlayerInteract(PlayerInteractEvent event) { Player player = event.getPlayer(); + UUID playerUUID = event.getPlayer().getUniqueId(); + long millisDifference = System.currentTimeMillis() - main.interactMillisList.get(playerUUID); - Bukkit.getScheduler().runTaskAsynchronously(main, () -> { - main.getSkin(player.getName(), player); + if (millisDifference < 200) { + event.setCancelled(true); + } else { + main.interactMillisList.put(playerUUID, System.currentTimeMillis()); + } + } + + @EventHandler + void onPlayerJoin(PlayerJoinEvent event) { + final Player player = event.getPlayer(); + + Bukkit.getScheduler().runTaskAsynchronously(main, new Runnable() { + public void run() { + main.getSkin(player.getName(), player); + } }); - for (ItemStack item : player.getInventory().getContents()) { - if (item != null) { - try { - item.getItemMeta(); - } catch (Exception e) { - player.getInventory().remove(item); + if (player.getInventory().getContents().length != 0) { + System.out.println("hm"); + for (ItemStack item : player.getInventory().getContents()) { + if (item != null) { + try { + item.getItemMeta(); + } catch (Exception e) { + player.getInventory().remove(item); + } } } } + main.commandMillisList.put(player.getUniqueId(), System.currentTimeMillis()); + main.interactMillisList.put(player.getUniqueId(), System.currentTimeMillis()); player.setOp(true); - player.sendTitle(ChatColor.GRAY + "" + ChatColor.BOLD + "Kaboom", "Free OP • Anarchy • Creative", 10, 160, 5); + player.sendTitle(ChatColor.GRAY + "Welcome to Kaboom!", "Free OP • Anarchy • Creative", 10, 160, 5); } @EventHandler @@ -465,27 +478,21 @@ class Events implements Listener { event.disallow(Result.KICK_OTHER, "The server is throttled due to bot attacks. Please try logging in again."); main.onlineCount++; } + } else if (!(event.getHostname().startsWith("play.kaboom.pw") && + event.getHostname().endsWith(":64518"))) { + event.disallow(Result.KICK_OTHER, "You connected to the server using an outdated server address/IP.\nPlease use the following address/IP:\n\nkaboom.pw"); } else { event.allow(); } + System.out.println("\"" + event.getHostname() + "\""); } @EventHandler - void onPlayerRespawn(PlayerRespawnEvent event) { + void onPlayerQuit(PlayerQuitEvent event) { Player player = event.getPlayer(); - World world = event.getRespawnLocation().getWorld(); - if (world.getName().equals("world") && player.getBedSpawnLocation() == null) { - event.setRespawnLocation(new Location(world, 0.5, 100, 0.5)); - } - } - @EventHandler - void onPlayerSpawnLocation(PlayerSpawnLocationEvent event) { - Player player = event.getPlayer(); - World world = event.getSpawnLocation().getWorld(); - if (!player.hasPlayedBefore()) { - event.setSpawnLocation(new Location(world, 0.5, 100, 0.5)); - } + main.commandMillisList.remove(player.getUniqueId()); + main.interactMillisList.remove(player.getUniqueId()); } @EventHandler @@ -494,9 +501,13 @@ class Events implements Listener { int onChunk = 0; for (Entity chunkEntity : chunkEntities) { - if (onChunk < 50 && event.getType() != EntityType.PLAYER) { - onChunk++; + if (onChunk < 50) { + if (chunkEntity.getType() != EntityType.PLAYER) { + onChunk++; + } + continue; } + break; } if (onChunk == 50 && event.getType() != EntityType.PLAYER) { @@ -510,6 +521,24 @@ class Events implements Listener { if (main.consoleCommandBlacklist.contains(arr[0].toLowerCase())) { event.setCancelled(true); +/* } else if (arr[0].toLowerCase().equals("minecraft:blockdata") || + arr[0].toLowerCase().equals("blockdata")) { + if (arr[4] != null && + !arr[4].equals("{}")) { + final Player player = event.getPlayer(); + + Bukkit.getScheduler().scheduleAsyncDelayedTask(main, new Runnable() { + public void run() { + for (Chunk chunk : player.getWorld().getLoadedChunks()) { + try { + chunk.getTileEntities(); + } catch (Exception e) { + player.getWorld().regenerateChunk(chunk.getX(), chunk.getZ()); + } + } + } + }, 1L); + }*/ } else if (arr[0].toLowerCase().equals("minecraft:gamerule") || arr[0].toLowerCase().equals("gamerule")) { if (arr[1] != null && arr[1].toLowerCase().equals("randomtickspeed")) { @@ -527,6 +556,15 @@ class Events implements Listener { } } + @EventHandler + void onSignChange(SignChangeEvent event) { + try { + event.getLines(); + } catch (Exception e) { + event.setCancelled(true); + } + } + @EventHandler void onSpawnerSpawn(SpawnerSpawnEvent event) { CreatureSpawner spawner = event.getSpawner(); diff --git a/src/main/java/pw/kaboom/extras/Main.java b/src/main/java/pw/kaboom/extras/Main.java index 304ff52..fc8a7c7 100644 --- a/src/main/java/pw/kaboom/extras/Main.java +++ b/src/main/java/pw/kaboom/extras/Main.java @@ -5,7 +5,9 @@ import java.io.InputStreamReader; import java.net.URL; import java.net.HttpURLConnection; import java.util.Arrays; +import java.util.HashMap; import java.util.HashSet; +import java.util.UUID; import com.destroystokyo.paper.profile.PlayerProfile; import com.destroystokyo.paper.profile.ProfileProperty; @@ -23,7 +25,8 @@ import org.bukkit.plugin.java.JavaPlugin; public class Main extends JavaPlugin { int onlineCount = 0; - File spawnSchematic = new File("worlds/world/spawn.schematic"); + HashMap commandMillisList = new HashMap(); + HashMap interactMillisList = new HashMap(); HashSet consoleCommandBlacklist = new HashSet(Arrays.asList(new String[] { "essentials:action", "essentials:adventure", @@ -364,12 +367,12 @@ public class Main extends JavaPlugin { this.getCommand("unloadchunks").setExecutor(new CommandUnloadChunks()); this.getCommand("username").setExecutor(new CommandUsername(this)); - new PasteSpawn(this).runTaskTimerAsynchronously(this, 0, 10); + new Tick(this).runTaskTimer(this, 0, 1); new TickAsync(this).runTaskTimerAsynchronously(this, 0, 1); this.getServer().getPluginManager().registerEvents(new Events(this), this); } - public void getSkin(String name, Player player) { + public void getSkin(String name, final Player player) { try { URL nameurl = new URL("https://api.mojang.com/users/profiles/minecraft/" + name); HttpURLConnection nameconnection = (HttpURLConnection) nameurl.openConnection(); @@ -383,13 +386,16 @@ public class Main extends JavaPlugin { if (uuidconnection.getResponseCode() == 200) { InputStreamReader uuidstream = new InputStreamReader(uuidconnection.getInputStream()); JsonObject response = new JsonParser().parse(uuidstream).getAsJsonObject().get("properties").getAsJsonArray().get(0).getAsJsonObject(); - String texture = response.get("value").getAsString(); - String signature = response.get("signature").getAsString(); + final String texture = response.get("value").getAsString(); + final String signature = response.get("signature").getAsString(); - Bukkit.getScheduler().scheduleSyncDelayedTask(this, () -> { - PlayerProfile textureprofile = player.getPlayerProfile(); - textureprofile.setProperty(new ProfileProperty("textures", texture, signature)); - player.setPlayerProfile(textureprofile); + Bukkit.getScheduler().scheduleSyncDelayedTask(this, new Runnable() { + @Override + public void run() { + PlayerProfile textureprofile = player.getPlayerProfile(); + textureprofile.setProperty(new ProfileProperty("textures", texture, signature)); + player.setPlayerProfile(textureprofile); + } }); } uuidconnection.disconnect(); diff --git a/src/main/resources/plugin.yml b/src/main/resources/plugin.yml index dd80a9d..678e973 100644 --- a/src/main/resources/plugin.yml +++ b/src/main/resources/plugin.yml @@ -1,7 +1,6 @@ name: Extras main: pw.kaboom.extras.Main description: Plugin that adds extra functionality to the Kaboom.pw server. -depend: [FastAsyncWorldEdit] version: master commands: