Search in sources :

Example 41 with CraftServer

use of org.bukkit.craftbukkit.v1_18_R2.CraftServer in project Denizen-For-Bukkit by DenizenScript.

the class ItemHelperImpl method registerStonecuttingRecipe.

@Override
public void registerStonecuttingRecipe(String keyName, String group, ItemStack result, ItemStack[] ingredient, boolean exact) {
    ResourceLocation key = new ResourceLocation("denizen", keyName);
    Ingredient itemRecipe = itemArrayToRecipe(ingredient, exact);
    StonecutterRecipe recipe = new StonecutterRecipe(key, group, itemRecipe, CraftItemStack.asNMSCopy(result));
    ((CraftServer) Bukkit.getServer()).getServer().getRecipeManager().addRecipe(recipe);
}
Also used : ResourceLocation(net.minecraft.resources.ResourceLocation) CraftServer(org.bukkit.craftbukkit.v1_18_R2.CraftServer)

Example 42 with CraftServer

use of org.bukkit.craftbukkit.v1_18_R2.CraftServer in project Denizen-For-Bukkit by DenizenScript.

the class ItemHelperImpl method registerSmithingRecipe.

@Override
public void registerSmithingRecipe(String keyName, ItemStack result, ItemStack[] baseItem, boolean baseExact, ItemStack[] upgradeItem, boolean upgradeExact) {
    ResourceLocation key = new ResourceLocation("denizen", keyName);
    Ingredient baseItemRecipe = itemArrayToRecipe(baseItem, baseExact);
    Ingredient upgradeItemRecipe = itemArrayToRecipe(upgradeItem, upgradeExact);
    UpgradeRecipe recipe = new UpgradeRecipe(key, baseItemRecipe, upgradeItemRecipe, CraftItemStack.asNMSCopy(result));
    ((CraftServer) Bukkit.getServer()).getServer().getRecipeManager().addRecipe(recipe);
}
Also used : ResourceLocation(net.minecraft.resources.ResourceLocation) CraftServer(org.bukkit.craftbukkit.v1_18_R2.CraftServer)

Example 43 with CraftServer

use of org.bukkit.craftbukkit.v1_18_R2.CraftServer in project Denizen-For-Bukkit by DenizenScript.

the class ItemHelperImpl method renderEntireMap.

@Override
public boolean renderEntireMap(int mapId, int xMin, int zMin, int xMax, int zMax) {
    MapItemSavedData worldmap = ((CraftServer) Bukkit.getServer()).getServer().getLevel(net.minecraft.world.level.Level.OVERWORLD).getMapData("map_" + mapId);
    if (worldmap == null) {
        return false;
    }
    renderFullMap(worldmap, xMin, zMin, xMax, zMax);
    return true;
}
Also used : MapItemSavedData(net.minecraft.world.level.saveddata.maps.MapItemSavedData) CraftServer(org.bukkit.craftbukkit.v1_18_R2.CraftServer)

Example 44 with CraftServer

use of org.bukkit.craftbukkit.v1_18_R2.CraftServer in project Denizen-For-Bukkit by DenizenScript.

the class ProfileEditorImpl method updatePlayer.

@Override
protected void updatePlayer(Player player, final boolean isSkinChanging) {
    final ServerPlayer entityPlayer = ((CraftPlayer) player).getHandle();
    final UUID uuid = player.getUniqueId();
    ClientboundRemoveEntitiesPacket destroyPacket = new ClientboundRemoveEntitiesPacket(entityPlayer.getId());
    for (Player p : Bukkit.getServer().getOnlinePlayers()) {
        if (!p.getUniqueId().equals(uuid)) {
            PacketHelperImpl.send(p, destroyPacket);
        }
    }
    new BukkitRunnable() {

        @Override
        public void run() {
            ClientboundPlayerInfoPacket playerInfo = new ClientboundPlayerInfoPacket(ClientboundPlayerInfoPacket.Action.ADD_PLAYER, entityPlayer);
            ClientboundAddPlayerPacket spawnPacket = new ClientboundAddPlayerPacket(entityPlayer);
            for (Player player : Bukkit.getServer().getOnlinePlayers()) {
                PacketHelperImpl.send(player, playerInfo);
                if (!player.getUniqueId().equals(uuid)) {
                    PacketHelperImpl.send(player, spawnPacket);
                } else {
                    if (isSkinChanging) {
                        ((CraftServer) Bukkit.getServer()).getHandle().respawn(entityPlayer, (ServerLevel) entityPlayer.level, true, player.getLocation(), false);
                    }
                    player.updateInventory();
                }
            }
        }
    }.runTaskLater(NMSHandler.getJavaPlugin(), 5);
}
Also used : ServerLevel(net.minecraft.server.level.ServerLevel) ClientboundRemoveEntitiesPacket(net.minecraft.network.protocol.game.ClientboundRemoveEntitiesPacket) Player(org.bukkit.entity.Player) ServerPlayer(net.minecraft.server.level.ServerPlayer) CraftPlayer(org.bukkit.craftbukkit.v1_18_R2.entity.CraftPlayer) ServerPlayer(net.minecraft.server.level.ServerPlayer) BukkitRunnable(org.bukkit.scheduler.BukkitRunnable) CraftPlayer(org.bukkit.craftbukkit.v1_18_R2.entity.CraftPlayer) ClientboundAddPlayerPacket(net.minecraft.network.protocol.game.ClientboundAddPlayerPacket) UUID(java.util.UUID) CraftServer(org.bukkit.craftbukkit.v1_18_R2.CraftServer) ClientboundPlayerInfoPacket(net.minecraft.network.protocol.game.ClientboundPlayerInfoPacket)

Example 45 with CraftServer

use of org.bukkit.craftbukkit.v1_18_R2.CraftServer in project Denizen-For-Bukkit by DenizenScript.

the class ItemHelperImpl method renderEntireMap.

@Override
public boolean renderEntireMap(int mapId, int xMin, int zMin, int xMax, int zMax) {
    MapItemSavedData worldmap = ((CraftServer) Bukkit.getServer()).getServer().getLevel(net.minecraft.world.level.Level.OVERWORLD).getMapData("map_" + mapId);
    if (worldmap == null) {
        return false;
    }
    renderFullMap(worldmap, xMin, zMin, xMax, zMax);
    return true;
}
Also used : MapItemSavedData(net.minecraft.world.level.saveddata.maps.MapItemSavedData) CraftServer(org.bukkit.craftbukkit.v1_17_R1.CraftServer)

Aggregations

GameProfile (com.mojang.authlib.GameProfile)49 CraftServer (org.bukkit.craftbukkit.v1_16_R3.CraftServer)38 Player (org.bukkit.entity.Player)33 CraftServer (org.bukkit.craftbukkit.v1_18_R2.CraftServer)23 ResourceLocation (net.minecraft.resources.ResourceLocation)22 MinecraftServer (net.minecraft.server.MinecraftServer)22 CraftPlayer (org.bukkit.craftbukkit.v1_16_R3.entity.CraftPlayer)21 CraftServer (org.bukkit.craftbukkit.v1_17_R1.CraftServer)21 ServerPlayer (net.minecraft.server.level.ServerPlayer)20 Block (org.bukkit.block.Block)19 NotNull (org.jetbrains.annotations.NotNull)18 OfflinePlayer (org.bukkit.OfflinePlayer)16 CraftServer (org.bukkit.craftbukkit.v1_12_R1.CraftServer)16 ServerLevel (net.minecraft.server.level.ServerLevel)14 Property (com.mojang.authlib.properties.Property)13 CraftWorld (org.bukkit.craftbukkit.v1_16_R3.CraftWorld)11 CraftPlayer (org.bukkit.craftbukkit.v1_18_R2.entity.CraftPlayer)10 BlockFace (org.bukkit.block.BlockFace)8 CraftServer (org.bukkit.craftbukkit.v1_18_R1.CraftServer)8 PlayerProfile (com.denizenscript.denizen.nms.util.PlayerProfile)7