public static void spawnTemporaryPlayer(Player p, Location loc, UUID skin, String customName, Consumer<FakePlayer> callback) { GameProfileBuilder.fetch(skin, gameProfile -> { System.out.println(gameProfile); callback.accept(spawnTemporaryPlayer(p, loc, gameProfile, customName)); }); }
@Override public <T extends Entity> T spawn(Location location, Class<T> clazz, Consumer<T> function) throws IllegalArgumentException { // TODO Auto-generated method stub throw new UnimplementedOperationException(); }
@Override public <T extends Entity> T spawn(Location location, Class<T> clazz, Consumer<T> function) throws IllegalArgumentException { return TaskManager.IMP.sync(new RunnableVal<T>() { @Override public void run(T value) { this.value = parent.spawn(location, clazz, function); } }); }
public static void updateMeta(ItemStack item, Consumer<ItemMeta> mutator) { final ItemMeta meta = item.getItemMeta(); mutator.accept(meta); item.setItemMeta(meta); }
public static void updateMetaIfPresent(@Nullable ItemStack item, Consumer<ItemMeta> mutator) { if(item != null && item.hasItemMeta()) { updateMeta(item, mutator); } }
public static void spawnPlayer(Player p, Location loc, UUID skin, String name, Consumer<FakePlayer> callback) { spawnTemporaryPlayer(p, loc, skin, name, entity -> { FakeRegister.getPlayerLocationsFile().addPlayerToFile(entity); callback.accept(entity); }); }
@Override public <T extends Entity> T spawn( Location location, Class<T> aClass, Consumer<T> consumer ) throws IllegalArgumentException { return null; }
@Override public <T extends Entity> T spawn(Location location, Class<T> clazz, Consumer<T> consumer) throws IllegalArgumentException { throw Pokkit.unsupported(); }
/** * Spawns in a {@link FakePlayer} for the {@link Player} * * @param p the {@link Player} to spawn the {@link FakePlayer} for * @param loc {@link Location} where the {@link FakePlayer} should be spawned at * @param skin the {@link OfflinePlayer} which has the skin for the {@link FakePlayer} * @param customName of the {@link FakePlayer} inside the file and above his head */ public static void spawnPlayer(Player p, Location loc, OfflinePlayer skin, String customName, Consumer<FakePlayer> callback) { spawnTemporaryPlayer(p, loc, skin, customName, entity -> { FakeRegister.getPlayerLocationsFile().addPlayerToFile(entity); callback.accept(entity); }); }
/** * Spawns in a temporary {@link FakePlayer} (disappears after rejoin) for the {@link Player} * * @param p the {@link Player} to spawn the {@link FakePlayer} for * @param loc {@link Location} where the {@link FakePlayer} should be spawned at * @param skin the {@link OfflinePlayer} which has the skin for the {@link FakePlayer} * @param customName of the {@link FakePlayer} inside the file and above his head */ public static void spawnTemporaryPlayer(Player p, Location loc, OfflinePlayer skin, String customName, Consumer<FakePlayer> callback) { UUIDFetcher.getUUID(skin, id -> GameProfileBuilder.fetch(id, gameProfile -> callback.accept(spawnTemporaryPlayer(p, loc, gameProfile, customName))) ); }