1
0
mirror of https://github.com/Zrips/Jobs.git synced 2024-11-29 14:05:25 +01:00

Fix startup issue on 1.16 servers

Fixes #829
This commit is contained in:
montlikadani 2020-06-25 11:03:23 +02:00
parent 523eecefc6
commit 41b07c2f36
2 changed files with 60 additions and 1 deletions

View File

@ -18,7 +18,7 @@
<dependency>
<groupId>org.spigotmc</groupId>
<artifactId>spigot-api</artifactId>
<version>1.15.2-R0.1-SNAPSHOT</version>
<version>1.16.1-R0.1-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
<!-- Boss -->

View File

@ -0,0 +1,59 @@
package com.gamingmesh.jobs.nmsUtil;
import java.util.ArrayList;
import java.util.List;
import org.bukkit.OfflinePlayer;
import org.bukkit.attribute.Attribute;
import org.bukkit.block.Block;
import org.bukkit.entity.Entity;
import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Player;
import org.bukkit.event.block.BlockPistonRetractEvent;
import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.meta.Damageable;
import org.bukkit.inventory.meta.SkullMeta;
import com.gamingmesh.jobs.NMS;
public class v1_16 implements NMS {
@Override
public List<Block> getPistonRetractBlocks(BlockPistonRetractEvent event) {
List<Block> blocks = new ArrayList<>();
blocks.addAll(event.getBlocks());
return blocks;
}
@Override
public String getRealType(Entity entity) {
return entity.getType().name();
}
@Override
public ItemStack getItemInMainHand(Player player) {
return player.getInventory().getItemInMainHand();
}
@Override
public void setItemInMainHand(Player player, ItemStack item) {
player.getInventory().setItemInMainHand(item);
}
@Override
public double getMaxHealth(LivingEntity entity) {
return entity.getAttribute(Attribute.GENERIC_MAX_HEALTH).getBaseValue();
}
@Override
public short getDurability(ItemStack item) {
return (short) ((Damageable) item.getItemMeta()).getDamage();
}
@Override
public void setSkullOwner(SkullMeta meta, OfflinePlayer player) {
if (meta != null && player != null) {
meta.setOwningPlayer(player);
}
}
}