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);
}
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);
}
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;
}
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);
}
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;
}
Aggregations