1.11.2
This commit is contained in:
parent
7a53bfcec8
commit
ff9dd28802
9 changed files with 49 additions and 71 deletions
12
pom.xml
12
pom.xml
|
|
@ -31,23 +31,13 @@
|
|||
<id>minecraft-repo</id>
|
||||
<url>https://libraries.minecraft.net/</url>
|
||||
</repository>
|
||||
<repository>
|
||||
<id>papermc</id>
|
||||
<url>https://repo.papermc.io/repository/maven-public/</url>
|
||||
</repository>
|
||||
</repositories>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>io.papermc.paper</groupId>
|
||||
<artifactId>paper-api</artifactId>
|
||||
<version>1.20.4-R0.1-SNAPSHOT</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.spigotmc</groupId>
|
||||
<artifactId>spigot-api</artifactId>
|
||||
<version>1.20.5-R0.1-SNAPSHOT</version>
|
||||
<version>1.20.6-R0.1-SNAPSHOT</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
|
|
|
|||
|
|
@ -118,7 +118,12 @@ public class PlayerKits2 extends JavaPlugin {
|
|||
|
||||
public void setVersion(){
|
||||
String packageName = Bukkit.getServer().getClass().getPackage().getName();
|
||||
serverVersion = ServerVersion.valueOf(packageName.replace("org.bukkit.craftbukkit.", ""));
|
||||
String bukkitVersion = Bukkit.getServer().getBukkitVersion();
|
||||
if(bukkitVersion.contains("1.20.5") || bukkitVersion.contains("1.20.6")){
|
||||
serverVersion = ServerVersion.v1_20_R4;
|
||||
}else{
|
||||
serverVersion = ServerVersion.valueOf(packageName.replace("org.bukkit.craftbukkit.", ""));
|
||||
}
|
||||
}
|
||||
|
||||
public KitItemManager getKitItemManager() {
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@ public class OtherListener implements Listener {
|
|||
@EventHandler
|
||||
public void fireworkDamage(EntityDamageByEntityEvent event) {
|
||||
Entity damager = event.getDamager();
|
||||
if(event.getEntity() instanceof Player && damager.getType().equals(EntityType.FIREWORK)) {
|
||||
if(event.getEntity() instanceof Player && damager.getType().name().contains("FIREWORK")) {
|
||||
if(damager.hasMetadata("playerkits")) {
|
||||
event.setCancelled(true);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,8 +1,6 @@
|
|||
package pk.ajneb97.managers;
|
||||
|
||||
import com.destroystokyo.paper.Namespaced;
|
||||
import org.bukkit.Color;
|
||||
import org.bukkit.NamespacedKey;
|
||||
import org.bukkit.configuration.file.FileConfiguration;
|
||||
import org.bukkit.enchantments.Enchantment;
|
||||
import org.bukkit.entity.Player;
|
||||
|
|
@ -89,23 +87,6 @@ public class KitItemManager {
|
|||
kitItem.setBookEnchants(enchantsList);
|
||||
}
|
||||
}
|
||||
|
||||
if(plugin.getDependencyManager().isPaper()){
|
||||
List<String> canDestroy = new ArrayList<>();
|
||||
for(Namespaced n : meta.getDestroyableKeys()){
|
||||
canDestroy.add(n.getNamespace()+":"+n.getKey());
|
||||
}
|
||||
if(!canDestroy.isEmpty()){
|
||||
kitItem.setCanDestroy(canDestroy);
|
||||
}
|
||||
List<String> canPlace = new ArrayList<>();
|
||||
for(Namespaced n : meta.getPlaceableKeys()){
|
||||
canPlace.add(n.getNamespace()+":"+n.getKey());
|
||||
}
|
||||
if(!canPlace.isEmpty()){
|
||||
kitItem.setCanPlace(canPlace);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
ServerVersion serverVersion = PlayerKits2.serverVersion;
|
||||
|
|
@ -181,27 +162,6 @@ public class KitItemManager {
|
|||
}
|
||||
}
|
||||
|
||||
if(plugin.getDependencyManager().isPaper()){
|
||||
List<String> canDestroy = kitItem.getCanDestroy();
|
||||
if(canDestroy != null && !canDestroy.isEmpty()){
|
||||
Collection<Namespaced> destroyableKeys = new ArrayList<>();
|
||||
for(String line : canDestroy){
|
||||
String[] sep = line.split(":");
|
||||
destroyableKeys.add(new NamespacedKey(sep[0],sep[1]));
|
||||
}
|
||||
meta.setDestroyableKeys(destroyableKeys);
|
||||
}
|
||||
List<String> canPlace = kitItem.getCanPlace();
|
||||
if(canPlace != null && !canPlace.isEmpty()){
|
||||
Collection<Namespaced> placeableKeys = new ArrayList<>();
|
||||
for(String line : canPlace){
|
||||
String[] sep = line.split(":");
|
||||
placeableKeys.add(new NamespacedKey(sep[0],sep[1]));
|
||||
}
|
||||
meta.setPlaceableKeys(placeableKeys);
|
||||
}
|
||||
}
|
||||
|
||||
item.setItemMeta(meta);
|
||||
|
||||
//OTHER META
|
||||
|
|
|
|||
|
|
@ -97,7 +97,15 @@ public class ActionUtils {
|
|||
}
|
||||
|
||||
Location location = player.getLocation();
|
||||
Firework firework = (Firework) location.getWorld().spawnEntity(location, EntityType.FIREWORK);
|
||||
|
||||
ServerVersion serverVersion = PlayerKits2.serverVersion;
|
||||
EntityType entityType = null;
|
||||
if(serverVersion.serverVersionGreaterEqualThan(serverVersion,ServerVersion.v1_20_R4)){
|
||||
entityType = EntityType.FIREWORK_ROCKET;
|
||||
}else{
|
||||
entityType = EntityType.valueOf("FIREWORK");
|
||||
}
|
||||
Firework firework = (Firework) location.getWorld().spawnEntity(location, entityType);
|
||||
FireworkMeta fireworkMeta = firework.getFireworkMeta();
|
||||
FireworkEffect effect = FireworkEffect.builder().flicker(false)
|
||||
.withColor(colors)
|
||||
|
|
|
|||
|
|
@ -52,7 +52,7 @@ public class InventoryItem {
|
|||
|
||||
public InventoryItem enchanted(boolean enchanted) {
|
||||
if(enchanted) {
|
||||
meta.addEnchant(Enchantment.ARROW_DAMAGE, 1, true);
|
||||
meta.addEnchant(Enchantment.FIRE_ASPECT, 1, true);
|
||||
meta.addItemFlags(ItemFlag.HIDE_ENCHANTS);
|
||||
}
|
||||
return this;
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@ package pk.ajneb97.utils;
|
|||
|
||||
import java.lang.reflect.Field;
|
||||
import java.lang.reflect.InvocationTargetException;
|
||||
import java.net.MalformedURLException;
|
||||
|
||||
import java.net.URL;
|
||||
import java.util.*;
|
||||
|
||||
|
|
@ -224,14 +224,22 @@ public class ItemUtils {
|
|||
potionEffectsList.add(type+";"+amplifier+";"+duration);
|
||||
}
|
||||
}
|
||||
if(!Bukkit.getVersion().contains("1.8")) {
|
||||
ServerVersion serverVersion = PlayerKits2.serverVersion;
|
||||
if(serverVersion.serverVersionGreaterEqualThan(serverVersion,ServerVersion.v1_9_R1)) {
|
||||
if(meta.hasColor()) {
|
||||
potionColor = meta.getColor().asRGB();
|
||||
}
|
||||
PotionData basePotionData = meta.getBasePotionData();
|
||||
extended = basePotionData.isExtended();
|
||||
upgraded = basePotionData.isUpgraded();
|
||||
potionType = basePotionData.getType().name();
|
||||
|
||||
if(serverVersion.serverVersionGreaterEqualThan(serverVersion,ServerVersion.v1_20_R2)) {
|
||||
if(meta.getBasePotionType() != null){
|
||||
potionType = meta.getBasePotionType().name();
|
||||
}
|
||||
}else{
|
||||
PotionData basePotionData = meta.getBasePotionData();
|
||||
extended = basePotionData.isExtended();
|
||||
upgraded = basePotionData.isUpgraded();
|
||||
potionType = basePotionData.getType().name();
|
||||
}
|
||||
}
|
||||
|
||||
potionData = new KitItemPotionData(upgraded,extended,potionType,potionColor,potionEffectsList);
|
||||
|
|
@ -265,18 +273,25 @@ public class ItemUtils {
|
|||
meta.addCustomEffect(new PotionEffect(PotionEffectType.getByName(type),duration,amplifier), false);
|
||||
}
|
||||
}
|
||||
|
||||
if(!Bukkit.getVersion().contains("1.8")) {
|
||||
PotionData basePotionData = new PotionData(
|
||||
PotionType.valueOf(potionData.getPotionType()),
|
||||
potionData.isExtended(),
|
||||
potionData.isUpgraded());
|
||||
meta.setBasePotionData(basePotionData);
|
||||
|
||||
|
||||
ServerVersion serverVersion = PlayerKits2.serverVersion;
|
||||
if(serverVersion.serverVersionGreaterEqualThan(serverVersion,ServerVersion.v1_9_R1)) {
|
||||
int color = potionData.getPotionColor();
|
||||
if(color != 0) {
|
||||
meta.setColor(Color.fromRGB(color));
|
||||
}
|
||||
if(serverVersion.serverVersionGreaterEqualThan(serverVersion,ServerVersion.v1_20_R2)) {
|
||||
if(potionData.getPotionType() != null && !potionData.getPotionType().isEmpty()){
|
||||
meta.setBasePotionType(PotionType.valueOf(potionData.getPotionType()));
|
||||
}
|
||||
}else{
|
||||
PotionData basePotionData = new PotionData(
|
||||
PotionType.valueOf(potionData.getPotionType()),
|
||||
potionData.isExtended(),
|
||||
potionData.isUpgraded());
|
||||
|
||||
meta.setBasePotionData(basePotionData);
|
||||
}
|
||||
}
|
||||
|
||||
item.setItemMeta(meta);
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@ items:
|
|||
- ""
|
||||
- "&7Owner: &6%player_name%"
|
||||
enchants:
|
||||
- "DAMAGE_ALL;5"
|
||||
- "FIRE_ASPECT;5"
|
||||
actions:
|
||||
claim:
|
||||
1:
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
main: pk.ajneb97.PlayerKits2
|
||||
version: 1.11.1
|
||||
version: 1.11.2
|
||||
name: PlayerKits2
|
||||
api-version: 1.13
|
||||
softdepend: [Vault,PlaceholderAPI]
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue