Update to 1.15.1

This commit is contained in:
Ghoti 2020-01-16 16:24:42 -06:00
parent 70c606b8df
commit 279c17b0c4
7 changed files with 185 additions and 180 deletions

View File

@ -25,19 +25,19 @@
<dependency>
<groupId>org.spigotmc</groupId>
<artifactId>spigot-api</artifactId>
<version>1.13.2-R0.1-SNAPSHOT</version>
<version>1.15.1-R0.1-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.bukkit</groupId>
<artifactId>craftbukkit</artifactId>
<version>1.13.2-R0.1-SNAPSHOT</version>
<version>1.15.1-R0.1-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.bukkit</groupId>
<artifactId>bukkit</artifactId>
<version>1.13.2-R0.1-SNAPSHOT</version>
<version>1.15.1-R0.1-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>de.tr7zw</groupId>

View File

@ -1,17 +1,12 @@
package com.fpghoti.classicswords.event;
import org.bukkit.Location;
import org.bukkit.entity.Entity;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.Listener;
import org.bukkit.event.entity.EntityDamageByEntityEvent;
import org.bukkit.event.entity.EntityDamageEvent.DamageModifier;
import org.bukkit.event.inventory.InventoryOpenEvent;
import com.fpghoti.classicswords.ClassicSwordsMain;
public class BlockingListener implements Listener{

View File

@ -1,7 +1,7 @@
package com.fpghoti.classicswords.item;
import org.bukkit.Material;
import org.bukkit.craftbukkit.v1_13_R2.inventory.CraftItemStack;
import org.bukkit.craftbukkit.v1_15_R1.inventory.CraftItemStack;
import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemFlag;
import org.bukkit.inventory.ItemStack;
@ -9,11 +9,8 @@ import org.bukkit.inventory.meta.Damageable;
import org.bukkit.inventory.meta.ItemMeta;
import net.md_5.bungee.api.ChatColor;
import net.minecraft.server.v1_13_R2.NBTTagCompound;
import net.minecraft.server.v1_13_R2.NBTTagDouble;
import net.minecraft.server.v1_13_R2.NBTTagInt;
import net.minecraft.server.v1_13_R2.NBTTagList;
import net.minecraft.server.v1_13_R2.NBTTagString;
import net.minecraft.server.v1_15_R1.NBTTagCompound;
import net.minecraft.server.v1_15_R1.NBTTagList;
public class CItemManager {
@ -25,32 +22,32 @@ public class CItemManager {
meta.addItemFlags(ItemFlag.HIDE_UNBREAKABLE);
meta.setDisplayName("Classic Diamond Sword");
csword.setItemMeta(meta);
net.minecraft.server.v1_13_R2.ItemStack nmsStack = CraftItemStack.asNMSCopy(csword);
net.minecraft.server.v1_15_R1.ItemStack nmsStack = CraftItemStack.asNMSCopy(csword);
NBTTagCompound compound = (nmsStack.hasTag()) ? nmsStack.getTag() : new NBTTagCompound();
NBTTagList modifiers = new NBTTagList();
NBTTagCompound damage = new NBTTagCompound();
damage.set("AttributeName", new NBTTagString("generic.attackDamage"));
damage.set("Name", new NBTTagString("generic.attackDamage"));
damage.set("Amount", new NBTTagInt(7));
damage.set("Operation", new NBTTagInt(0));
damage.set("UUIDLeast", new NBTTagInt(894654));
damage.set("UUIDMost", new NBTTagInt(2872));
damage.set("Slot", new NBTTagString("mainhand"));
damage.set("AttributeName", SetAttributes.nbtString("generic.attackDamage"));
damage.set("Name", SetAttributes.nbtString("generic.attackDamage"));
damage.set("Amount", SetAttributes.nbtInt(7));
damage.set("Operation", SetAttributes.nbtInt(0));
damage.set("UUIDLeast", SetAttributes.nbtInt(894654));
damage.set("UUIDMost", SetAttributes.nbtInt(2872));
damage.set("Slot", SetAttributes.nbtString("mainhand"));
NBTTagCompound atspeed = new NBTTagCompound();
atspeed.set("AttributeName", new NBTTagString("generic.attackSpeed"));
atspeed.set("Name", new NBTTagString("generic.attackSpeed"));
atspeed.set("Amount", new NBTTagDouble(1021.6));
atspeed.set("Operation", new NBTTagInt(0));
atspeed.set("UUIDLeast", new NBTTagInt(894654));
atspeed.set("UUIDMost", new NBTTagInt(2872));
atspeed.set("Slot", new NBTTagString("mainhand"));
atspeed.set("AttributeName", SetAttributes.nbtString("generic.attackSpeed"));
atspeed.set("Name", SetAttributes.nbtString("generic.attackSpeed"));
atspeed.set("Amount", SetAttributes.nbtDouble(1021.6));
atspeed.set("Operation", SetAttributes.nbtInt(0));
atspeed.set("UUIDLeast", SetAttributes.nbtInt(894654));
atspeed.set("UUIDMost", SetAttributes.nbtInt(2872));
atspeed.set("Slot", SetAttributes.nbtString("mainhand"));
modifiers.add(damage);
modifiers.add(atspeed);
@ -76,32 +73,32 @@ public class CItemManager {
meta.addItemFlags(ItemFlag.HIDE_UNBREAKABLE);
meta.setDisplayName("Classic Wood Sword");
csword.setItemMeta(meta);
net.minecraft.server.v1_13_R2.ItemStack nmsStack = CraftItemStack.asNMSCopy(csword);
net.minecraft.server.v1_15_R1.ItemStack nmsStack = CraftItemStack.asNMSCopy(csword);
NBTTagCompound compound = (nmsStack.hasTag()) ? nmsStack.getTag() : new NBTTagCompound();
NBTTagList modifiers = new NBTTagList();
NBTTagCompound damage = new NBTTagCompound();
damage.set("AttributeName", new NBTTagString("generic.attackDamage"));
damage.set("Name", new NBTTagString("generic.attackDamage"));
damage.set("Amount", new NBTTagInt(4));
damage.set("Operation", new NBTTagInt(0));
damage.set("UUIDLeast", new NBTTagInt(894654));
damage.set("UUIDMost", new NBTTagInt(2872));
damage.set("Slot", new NBTTagString("mainhand"));
damage.set("AttributeName", SetAttributes.nbtString("generic.attackDamage"));
damage.set("Name", SetAttributes.nbtString("generic.attackDamage"));
damage.set("Amount", SetAttributes.nbtInt(4));
damage.set("Operation", SetAttributes.nbtInt(0));
damage.set("UUIDLeast", SetAttributes.nbtInt(894654));
damage.set("UUIDMost", SetAttributes.nbtInt(2872));
damage.set("Slot", SetAttributes.nbtString("mainhand"));
NBTTagCompound atspeed = new NBTTagCompound();
atspeed.set("AttributeName", new NBTTagString("generic.attackSpeed"));
atspeed.set("Name", new NBTTagString("generic.attackSpeed"));
atspeed.set("Amount", new NBTTagDouble(1021.6));
atspeed.set("Operation", new NBTTagInt(0));
atspeed.set("UUIDLeast", new NBTTagInt(894654));
atspeed.set("UUIDMost", new NBTTagInt(2872));
atspeed.set("Slot", new NBTTagString("mainhand"));
atspeed.set("AttributeName", SetAttributes.nbtString("generic.attackSpeed"));
atspeed.set("Name", SetAttributes.nbtString("generic.attackSpeed"));
atspeed.set("Amount", SetAttributes.nbtDouble(1021.6));
atspeed.set("Operation", SetAttributes.nbtInt(0));
atspeed.set("UUIDLeast", SetAttributes.nbtInt(894654));
atspeed.set("UUIDMost", SetAttributes.nbtInt(2872));
atspeed.set("Slot", SetAttributes.nbtString("mainhand"));
modifiers.add(damage);
modifiers.add(atspeed);
@ -127,32 +124,32 @@ public class CItemManager {
meta.addItemFlags(ItemFlag.HIDE_UNBREAKABLE);
meta.setDisplayName("Classic Stone Sword");
csword.setItemMeta(meta);
net.minecraft.server.v1_13_R2.ItemStack nmsStack = CraftItemStack.asNMSCopy(csword);
net.minecraft.server.v1_15_R1.ItemStack nmsStack = CraftItemStack.asNMSCopy(csword);
NBTTagCompound compound = (nmsStack.hasTag()) ? nmsStack.getTag() : new NBTTagCompound();
NBTTagList modifiers = new NBTTagList();
NBTTagCompound damage = new NBTTagCompound();
damage.set("AttributeName", new NBTTagString("generic.attackDamage"));
damage.set("Name", new NBTTagString("generic.attackDamage"));
damage.set("Amount", new NBTTagInt(5));
damage.set("Operation", new NBTTagInt(0));
damage.set("UUIDLeast", new NBTTagInt(894654));
damage.set("UUIDMost", new NBTTagInt(2872));
damage.set("Slot", new NBTTagString("mainhand"));
damage.set("AttributeName", SetAttributes.nbtString("generic.attackDamage"));
damage.set("Name", SetAttributes.nbtString("generic.attackDamage"));
damage.set("Amount", SetAttributes.nbtInt(5));
damage.set("Operation", SetAttributes.nbtInt(0));
damage.set("UUIDLeast", SetAttributes.nbtInt(894654));
damage.set("UUIDMost", SetAttributes.nbtInt(2872));
damage.set("Slot", SetAttributes.nbtString("mainhand"));
NBTTagCompound atspeed = new NBTTagCompound();
atspeed.set("AttributeName", new NBTTagString("generic.attackSpeed"));
atspeed.set("Name", new NBTTagString("generic.attackSpeed"));
atspeed.set("Amount", new NBTTagDouble(1021.6));
atspeed.set("Operation", new NBTTagInt(0));
atspeed.set("UUIDLeast", new NBTTagInt(894654));
atspeed.set("UUIDMost", new NBTTagInt(2872));
atspeed.set("Slot", new NBTTagString("mainhand"));
atspeed.set("AttributeName", SetAttributes.nbtString("generic.attackSpeed"));
atspeed.set("Name", SetAttributes.nbtString("generic.attackSpeed"));
atspeed.set("Amount", SetAttributes.nbtDouble(1021.6));
atspeed.set("Operation", SetAttributes.nbtInt(0));
atspeed.set("UUIDLeast", SetAttributes.nbtInt(894654));
atspeed.set("UUIDMost", SetAttributes.nbtInt(2872));
atspeed.set("Slot", SetAttributes.nbtString("mainhand"));
modifiers.add(damage);
modifiers.add(atspeed);
@ -178,32 +175,32 @@ public class CItemManager {
meta.addItemFlags(ItemFlag.HIDE_UNBREAKABLE);
meta.setDisplayName("Classic Iron Sword");
csword.setItemMeta(meta);
net.minecraft.server.v1_13_R2.ItemStack nmsStack = CraftItemStack.asNMSCopy(csword);
net.minecraft.server.v1_15_R1.ItemStack nmsStack = CraftItemStack.asNMSCopy(csword);
NBTTagCompound compound = (nmsStack.hasTag()) ? nmsStack.getTag() : new NBTTagCompound();
NBTTagList modifiers = new NBTTagList();
NBTTagCompound damage = new NBTTagCompound();
damage.set("AttributeName", new NBTTagString("generic.attackDamage"));
damage.set("Name", new NBTTagString("generic.attackDamage"));
damage.set("Amount", new NBTTagInt(6));
damage.set("Operation", new NBTTagInt(0));
damage.set("UUIDLeast", new NBTTagInt(894654));
damage.set("UUIDMost", new NBTTagInt(2872));
damage.set("Slot", new NBTTagString("mainhand"));
damage.set("AttributeName", SetAttributes.nbtString("generic.attackDamage"));
damage.set("Name", SetAttributes.nbtString("generic.attackDamage"));
damage.set("Amount", SetAttributes.nbtInt(6));
damage.set("Operation", SetAttributes.nbtInt(0));
damage.set("UUIDLeast", SetAttributes.nbtInt(894654));
damage.set("UUIDMost", SetAttributes.nbtInt(2872));
damage.set("Slot", SetAttributes.nbtString("mainhand"));
NBTTagCompound atspeed = new NBTTagCompound();
atspeed.set("AttributeName", new NBTTagString("generic.attackSpeed"));
atspeed.set("Name", new NBTTagString("generic.attackSpeed"));
atspeed.set("Amount", new NBTTagDouble(1021.6));
atspeed.set("Operation", new NBTTagInt(0));
atspeed.set("UUIDLeast", new NBTTagInt(894654));
atspeed.set("UUIDMost", new NBTTagInt(2872));
atspeed.set("Slot", new NBTTagString("mainhand"));
atspeed.set("AttributeName", SetAttributes.nbtString("generic.attackSpeed"));
atspeed.set("Name", SetAttributes.nbtString("generic.attackSpeed"));
atspeed.set("Amount", SetAttributes.nbtDouble(1021.6));
atspeed.set("Operation", SetAttributes.nbtInt(0));
atspeed.set("UUIDLeast", SetAttributes.nbtInt(894654));
atspeed.set("UUIDMost", SetAttributes.nbtInt(2872));
atspeed.set("Slot", SetAttributes.nbtString("mainhand"));
modifiers.add(damage);
modifiers.add(atspeed);
@ -229,32 +226,32 @@ public class CItemManager {
meta.addItemFlags(ItemFlag.HIDE_UNBREAKABLE);
meta.setDisplayName("Classic Gold Sword");
csword.setItemMeta(meta);
net.minecraft.server.v1_13_R2.ItemStack nmsStack = CraftItemStack.asNMSCopy(csword);
net.minecraft.server.v1_15_R1.ItemStack nmsStack = CraftItemStack.asNMSCopy(csword);
NBTTagCompound compound = (nmsStack.hasTag()) ? nmsStack.getTag() : new NBTTagCompound();
NBTTagList modifiers = new NBTTagList();
NBTTagCompound damage = new NBTTagCompound();
damage.set("AttributeName", new NBTTagString("generic.attackDamage"));
damage.set("Name", new NBTTagString("generic.attackDamage"));
damage.set("Amount", new NBTTagInt(4));
damage.set("Operation", new NBTTagInt(0));
damage.set("UUIDLeast", new NBTTagInt(894654));
damage.set("UUIDMost", new NBTTagInt(2872));
damage.set("Slot", new NBTTagString("mainhand"));
damage.set("AttributeName", SetAttributes.nbtString("generic.attackDamage"));
damage.set("Name", SetAttributes.nbtString("generic.attackDamage"));
damage.set("Amount", SetAttributes.nbtInt(4));
damage.set("Operation", SetAttributes.nbtInt(0));
damage.set("UUIDLeast", SetAttributes.nbtInt(894654));
damage.set("UUIDMost", SetAttributes.nbtInt(2872));
damage.set("Slot", SetAttributes.nbtString("mainhand"));
NBTTagCompound atspeed = new NBTTagCompound();
atspeed.set("AttributeName", new NBTTagString("generic.attackSpeed"));
atspeed.set("Name", new NBTTagString("generic.attackSpeed"));
atspeed.set("Amount", new NBTTagDouble(1021.6));
atspeed.set("Operation", new NBTTagInt(0));
atspeed.set("UUIDLeast", new NBTTagInt(894654));
atspeed.set("UUIDMost", new NBTTagInt(2872));
atspeed.set("Slot", new NBTTagString("mainhand"));
atspeed.set("AttributeName", SetAttributes.nbtString("generic.attackSpeed"));
atspeed.set("Name", SetAttributes.nbtString("generic.attackSpeed"));
atspeed.set("Amount", SetAttributes.nbtDouble(1021.6));
atspeed.set("Operation", SetAttributes.nbtInt(0));
atspeed.set("UUIDLeast", SetAttributes.nbtInt(894654));
atspeed.set("UUIDMost", SetAttributes.nbtInt(2872));
atspeed.set("Slot", SetAttributes.nbtString("mainhand"));
modifiers.add(damage);
modifiers.add(atspeed);

View File

@ -4,7 +4,7 @@ import org.bukkit.Material;
import com.fpghoti.classicswords.util.Storage;
import net.minecraft.server.v1_13_R2.NBTTagCompound;
import net.minecraft.server.v1_15_R1.NBTTagCompound;
public class CItemType {

View File

@ -5,7 +5,7 @@ import java.lang.reflect.Constructor;
import org.bukkit.Bukkit;
import org.bukkit.Material;
import org.bukkit.Sound;
import org.bukkit.craftbukkit.v1_13_R2.inventory.CraftItemStack;
import org.bukkit.craftbukkit.v1_15_R1.inventory.CraftItemStack;
import org.bukkit.enchantments.Enchantment;
import org.bukkit.entity.Player;
import org.bukkit.inventory.Inventory;
@ -17,11 +17,8 @@ import org.bukkit.inventory.meta.ItemMeta;
import com.fpghoti.classicswords.item.CItemType.SwordType;
import com.fpghoti.classicswords.util.Storage;
import net.minecraft.server.v1_13_R2.NBTTagCompound;
import net.minecraft.server.v1_13_R2.NBTTagDouble;
import net.minecraft.server.v1_13_R2.NBTTagInt;
import net.minecraft.server.v1_13_R2.NBTTagList;
import net.minecraft.server.v1_13_R2.NBTTagString;
import net.minecraft.server.v1_15_R1.NBTTagCompound;
import net.minecraft.server.v1_15_R1.NBTTagList;
public class ClassicSword {
@ -52,28 +49,28 @@ public class ClassicSword {
meta.addItemFlags(ItemFlag.HIDE_UNBREAKABLE);
meta.setDisplayName(name);
csword.setItemMeta(meta);
net.minecraft.server.v1_13_R2.ItemStack nmsStack = CraftItemStack.asNMSCopy(csword);
net.minecraft.server.v1_15_R1.ItemStack nmsStack = CraftItemStack.asNMSCopy(csword);
NBTTagCompound compound = (nmsStack.hasTag()) ? nmsStack.getTag() : new NBTTagCompound();
NBTTagList modifiers = new NBTTagList();
NBTTagCompound damage = CItemType.getSwordType(type);
NBTTagCompound atspeed = new NBTTagCompound();
atspeed.set("AttributeName", new NBTTagString("generic.attackSpeed"));
atspeed.set("Name", new NBTTagString("generic.attackSpeed"));
atspeed.set("Amount", new NBTTagDouble(1021.6));
atspeed.set("Operation", new NBTTagInt(0));
atspeed.set("UUIDLeast", new NBTTagInt(894654));
atspeed.set("UUIDMost", new NBTTagInt(2872));
atspeed.set("Slot", new NBTTagString("mainhand"));
atspeed.set("AttributeName", SetAttributes.nbtString("generic.attackSpeed"));
atspeed.set("Name", SetAttributes.nbtString("generic.attackSpeed"));
atspeed.set("Amount", SetAttributes.nbtDouble(1021.6));
atspeed.set("Operation", SetAttributes.nbtInt(0));
atspeed.set("UUIDLeast", SetAttributes.nbtInt(894654));
atspeed.set("UUIDMost", SetAttributes.nbtInt(2872));
atspeed.set("Slot", SetAttributes.nbtString("mainhand"));
NBTTagCompound cstag = new NBTTagCompound();
//int dur = old.getType().getMaxDurability() - old.getDurability();
int dur = old.getType().getMaxDurability() - ((Damageable)old.getItemMeta()).getDamage();
cstag.set("Durability", new NBTTagInt(dur));
cstag.set("Type", new NBTTagString(CItemType.getShortName(type)));
cstag.set("Durability", SetAttributes.nbtInt(dur));
cstag.set("Type", SetAttributes.nbtString(CItemType.getShortName(type)));
modifiers.add(damage);
modifiers.add(atspeed);
@ -116,29 +113,29 @@ public class ClassicSword {
meta.addItemFlags(ItemFlag.HIDE_UNBREAKABLE);
meta.setDisplayName(name);
csword.setItemMeta(meta);
net.minecraft.server.v1_13_R2.ItemStack nmsStack = CraftItemStack.asNMSCopy(csword);
net.minecraft.server.v1_15_R1.ItemStack nmsStack = CraftItemStack.asNMSCopy(csword);
NBTTagCompound compound = (nmsStack.hasTag()) ? nmsStack.getTag() : new NBTTagCompound();
NBTTagList modifiers = new NBTTagList();
NBTTagCompound damage = CItemType.getSwordType(type);
NBTTagCompound atspeed = new NBTTagCompound();
atspeed.set("AttributeName", new NBTTagString("generic.attackSpeed"));
atspeed.set("Name", new NBTTagString("generic.attackSpeed"));
atspeed.set("Amount", new NBTTagDouble(1021.6));
atspeed.set("Operation", new NBTTagInt(0));
atspeed.set("UUIDLeast", new NBTTagInt(894654));
atspeed.set("UUIDMost", new NBTTagInt(2872));
atspeed.set("Slot", new NBTTagString("mainhand"));
atspeed.set("AttributeName", SetAttributes.nbtString("generic.attackSpeed"));
atspeed.set("Name", SetAttributes.nbtString("generic.attackSpeed"));
atspeed.set("Amount", SetAttributes.nbtDouble(1021.6));
atspeed.set("Operation", SetAttributes.nbtInt(0));
atspeed.set("UUIDLeast", SetAttributes.nbtInt(894654));
atspeed.set("UUIDMost", SetAttributes.nbtInt(2872));
atspeed.set("Slot", SetAttributes.nbtString("mainhand"));
NBTTagCompound cstag = new NBTTagCompound();
int dur = getCShieldDurability(old);
cstag.set("Durability", new NBTTagInt(dur));
cstag.set("Type", new NBTTagString(CItemType.getShortName(type)));
cstag.set("Durability", SetAttributes.nbtInt(dur));
cstag.set("Type", SetAttributes.nbtString(CItemType.getShortName(type)));
NBTTagCompound blocktag = new NBTTagCompound();
blocktag.set("BlockHit", new NBTTagString("BlockHit"));
blocktag.set("BlockHit", SetAttributes.nbtString("BlockHit"));
modifiers.add(damage);
modifiers.add(atspeed);
@ -187,26 +184,26 @@ public class ClassicSword {
meta.addItemFlags(ItemFlag.HIDE_UNBREAKABLE);
meta.setDisplayName(name);
csword.setItemMeta(meta);
net.minecraft.server.v1_13_R2.ItemStack nmsStack = CraftItemStack.asNMSCopy(csword);
net.minecraft.server.v1_15_R1.ItemStack nmsStack = CraftItemStack.asNMSCopy(csword);
NBTTagCompound compound = (nmsStack.hasTag()) ? nmsStack.getTag() : new NBTTagCompound();
NBTTagList modifiers = new NBTTagList();
NBTTagCompound damage = CItemType.getSwordType(type);
NBTTagCompound atspeed = new NBTTagCompound();
atspeed.set("AttributeName", new NBTTagString("generic.attackSpeed"));
atspeed.set("Name", new NBTTagString("generic.attackSpeed"));
atspeed.set("Amount", new NBTTagDouble(1021.6));
atspeed.set("Operation", new NBTTagInt(0));
atspeed.set("UUIDLeast", new NBTTagInt(894654));
atspeed.set("UUIDMost", new NBTTagInt(2872));
atspeed.set("Slot", new NBTTagString("mainhand"));
atspeed.set("AttributeName", SetAttributes.nbtString("generic.attackSpeed"));
atspeed.set("Name", SetAttributes.nbtString("generic.attackSpeed"));
atspeed.set("Amount", SetAttributes.nbtDouble(1021.6));
atspeed.set("Operation", SetAttributes.nbtInt(0));
atspeed.set("UUIDLeast", SetAttributes.nbtInt(894654));
atspeed.set("UUIDMost", SetAttributes.nbtInt(2872));
atspeed.set("Slot", SetAttributes.nbtString("mainhand"));
NBTTagCompound cstag = new NBTTagCompound();
int dur = getCShieldDurability(old);
cstag.set("Durability", new NBTTagInt(dur));
cstag.set("Type", new NBTTagString(CItemType.getShortName(type)));
cstag.set("Durability", SetAttributes.nbtInt(dur));
cstag.set("Type", SetAttributes.nbtString(CItemType.getShortName(type)));
modifiers.add(damage);
@ -252,20 +249,20 @@ public class ClassicSword {
meta.setUnbreakable(false);
meta.setDisplayName(name);
csword.setItemMeta(meta);
net.minecraft.server.v1_13_R2.ItemStack nmsStack = CraftItemStack.asNMSCopy(csword);
net.minecraft.server.v1_15_R1.ItemStack nmsStack = CraftItemStack.asNMSCopy(csword);
NBTTagCompound compound = (nmsStack.hasTag()) ? nmsStack.getTag() : new NBTTagCompound();
NBTTagList modifiers = new NBTTagList();
NBTTagCompound damage = CItemType.getSwordType(type);
NBTTagCompound atspeed = new NBTTagCompound();
atspeed.set("AttributeName", new NBTTagString("generic.attackSpeed"));
atspeed.set("Name", new NBTTagString("generic.attackSpeed"));
atspeed.set("Amount", new NBTTagDouble(1021.6));
atspeed.set("Operation", new NBTTagInt(0));
atspeed.set("UUIDLeast", new NBTTagInt(894654));
atspeed.set("UUIDMost", new NBTTagInt(2872));
atspeed.set("Slot", new NBTTagString("mainhand"));
atspeed.set("AttributeName", SetAttributes.nbtString("generic.attackSpeed"));
atspeed.set("Name", SetAttributes.nbtString("generic.attackSpeed"));
atspeed.set("Amount", SetAttributes.nbtDouble(1021.6));
atspeed.set("Operation", SetAttributes.nbtInt(0));
atspeed.set("UUIDLeast", SetAttributes.nbtInt(894654));
atspeed.set("UUIDMost", SetAttributes.nbtInt(2872));
atspeed.set("Slot", SetAttributes.nbtString("mainhand"));
NBTTagCompound cstag = new NBTTagCompound();
@ -290,7 +287,7 @@ public class ClassicSword {
if(item.getType() != Material.SHIELD) {
return false;
}
net.minecraft.server.v1_13_R2.ItemStack nms = CraftItemStack.asNMSCopy(item);
net.minecraft.server.v1_15_R1.ItemStack nms = CraftItemStack.asNMSCopy(item);
if(!nms.hasTag() || nms.getTag() == null) {
return false;
}
@ -302,7 +299,7 @@ public class ClassicSword {
}
public static Boolean isCBlockShield(ItemStack item) {
net.minecraft.server.v1_13_R2.ItemStack nms = CraftItemStack.asNMSCopy(item);
net.minecraft.server.v1_15_R1.ItemStack nms = CraftItemStack.asNMSCopy(item);
return nms.getTag() != null && isCShield(item) && nms.getTag().hasKey("ClassicSwords");
}
@ -314,7 +311,7 @@ public class ClassicSword {
if(!(item.getType() == Material.WOODEN_SWORD || item.getType() == Material.STONE_SWORD ||item.getType() == Material.IRON_SWORD || item.getType() == Material.GOLDEN_SWORD || item.getType() == Material.DIAMOND_SWORD)) {
return false;
}
net.minecraft.server.v1_13_R2.ItemStack nms = CraftItemStack.asNMSCopy(item);
net.minecraft.server.v1_15_R1.ItemStack nms = CraftItemStack.asNMSCopy(item);
if(!nms.hasTag() || nms.getTag() == null) {
return false;
}
@ -398,7 +395,7 @@ public class ClassicSword {
}
if(!skip) {
NBTTagCompound cstag = getCSTag(item);
cstag.set("Durability", new NBTTagInt(dur));
cstag.set("Durability", SetAttributes.nbtInt(dur));
p.getInventory().setItemInMainHand(updateCSTag(item, cstag));
}
}
@ -408,7 +405,7 @@ public class ClassicSword {
if(!isCItem(item)) {
return null;
}else {
net.minecraft.server.v1_13_R2.ItemStack nms = CraftItemStack.asNMSCopy(item);
net.minecraft.server.v1_15_R1.ItemStack nms = CraftItemStack.asNMSCopy(item);
NBTTagCompound cstag = (NBTTagCompound) nms.getTag().get("ClassicSwords");
return cstag;
}
@ -416,7 +413,7 @@ public class ClassicSword {
public static ItemStack updateCSTag(ItemStack item, NBTTagCompound tag) {
if(isCItem(item)) {
net.minecraft.server.v1_13_R2.ItemStack nms = CraftItemStack.asNMSCopy(item);
net.minecraft.server.v1_15_R1.ItemStack nms = CraftItemStack.asNMSCopy(item);
nms.getTag().set("ClassicSwords", tag);
return CraftItemStack.asBukkitCopy(nms);
}else {

View File

@ -2,71 +2,87 @@ package com.fpghoti.classicswords.item;
import com.fpghoti.classicswords.util.Storage;
import net.minecraft.server.v1_13_R2.NBTTagCompound;
import net.minecraft.server.v1_13_R2.NBTTagInt;
import net.minecraft.server.v1_13_R2.NBTTagString;
import net.minecraft.server.v1_15_R1.NBTTagCompound;
import net.minecraft.server.v1_15_R1.NBTTagDouble;
import net.minecraft.server.v1_15_R1.NBTTagInt;
import net.minecraft.server.v1_15_R1.NBTTagString;
public class SetAttributes {
// For readability and future changes
public static NBTTagString nbtString(String x) {
return NBTTagString.a(x);
}
public static NBTTagInt nbtInt(int x) {
return NBTTagInt.a(x);
}
public static NBTTagDouble nbtDouble(double x) {
return NBTTagDouble.a(x);
}
//
public static void defineSwords() {
NBTTagCompound damage = new NBTTagCompound();
damage.set("AttributeName", new NBTTagString("generic.attackDamage"));
damage.set("Name", new NBTTagString("generic.attackDamage"));
damage.set("Amount", new NBTTagInt(7));
damage.set("Operation", new NBTTagInt(0));
damage.set("UUIDLeast", new NBTTagInt(894654));
damage.set("UUIDMost", new NBTTagInt(2872));
damage.set("Slot", new NBTTagString("mainhand"));
damage.set("AttributeName", nbtString("generic.attackDamage"));
damage.set("Name", nbtString("generic.attackDamage"));
damage.set("Amount", nbtInt(7));
damage.set("Operation", nbtInt(0));
damage.set("UUIDLeast", nbtInt(894654));
damage.set("UUIDMost", nbtInt(2872));
damage.set("Slot", nbtString("mainhand"));
Storage.damagetag.put("diamond", damage);
damage = new NBTTagCompound();
damage.set("AttributeName", new NBTTagString("generic.attackDamage"));
damage.set("Name", new NBTTagString("generic.attackDamage"));
damage.set("Amount", new NBTTagInt(4));
damage.set("Operation", new NBTTagInt(0));
damage.set("UUIDLeast", new NBTTagInt(894654));
damage.set("UUIDMost", new NBTTagInt(2872));
damage.set("Slot", new NBTTagString("mainhand"));
damage.set("AttributeName", nbtString("generic.attackDamage"));
damage.set("Name", nbtString("generic.attackDamage"));
damage.set("Amount", nbtInt(4));
damage.set("Operation", nbtInt(0));
damage.set("UUIDLeast", nbtInt(894654));
damage.set("UUIDMost", nbtInt(2872));
damage.set("Slot", nbtString("mainhand"));
Storage.damagetag.put("wood", damage);
damage = new NBTTagCompound();
damage.set("AttributeName", new NBTTagString("generic.attackDamage"));
damage.set("Name", new NBTTagString("generic.attackDamage"));
damage.set("Amount", new NBTTagInt(5));
damage.set("Operation", new NBTTagInt(0));
damage.set("UUIDLeast", new NBTTagInt(894654));
damage.set("UUIDMost", new NBTTagInt(2872));
damage.set("Slot", new NBTTagString("mainhand"));
damage.set("AttributeName", nbtString("generic.attackDamage"));
damage.set("Name", nbtString("generic.attackDamage"));
damage.set("Amount", nbtInt(5));
damage.set("Operation", nbtInt(0));
damage.set("UUIDLeast", nbtInt(894654));
damage.set("UUIDMost", nbtInt(2872));
damage.set("Slot", nbtString("mainhand"));
Storage.damagetag.put("stone", damage);
damage = new NBTTagCompound();
damage.set("AttributeName", new NBTTagString("generic.attackDamage"));
damage.set("Name", new NBTTagString("generic.attackDamage"));
damage.set("Amount", new NBTTagInt(6));
damage.set("Operation", new NBTTagInt(0));
damage.set("UUIDLeast", new NBTTagInt(894654));
damage.set("UUIDMost", new NBTTagInt(2872));
damage.set("Slot", new NBTTagString("mainhand"));
damage.set("AttributeName", nbtString("generic.attackDamage"));
damage.set("Name", nbtString("generic.attackDamage"));
damage.set("Amount", nbtInt(6));
damage.set("Operation", nbtInt(0));
damage.set("UUIDLeast", nbtInt(894654));
damage.set("UUIDMost", nbtInt(2872));
damage.set("Slot", nbtString("mainhand"));
Storage.damagetag.put("iron", damage);
damage = new NBTTagCompound();
damage.set("AttributeName", new NBTTagString("generic.attackDamage"));
damage.set("Name", new NBTTagString("generic.attackDamage"));
damage.set("Amount", new NBTTagInt(4));
damage.set("Operation", new NBTTagInt(0));
damage.set("UUIDLeast", new NBTTagInt(894654));
damage.set("UUIDMost", new NBTTagInt(2872));
damage.set("Slot", new NBTTagString("mainhand"));
damage.set("AttributeName", nbtString("generic.attackDamage"));
damage.set("Name", nbtString("generic.attackDamage"));
damage.set("Amount", nbtInt(4));
damage.set("Operation", nbtInt(0));
damage.set("UUIDLeast", nbtInt(894654));
damage.set("UUIDMost", nbtInt(2872));
damage.set("Slot", nbtString("mainhand"));
Storage.damagetag.put("gold", damage);
}

View File

@ -12,7 +12,7 @@ import org.bukkit.Material;
import org.bukkit.entity.Player;
import io.netty.util.internal.ConcurrentSet;
import net.minecraft.server.v1_13_R2.NBTTagCompound;
import net.minecraft.server.v1_15_R1.NBTTagCompound;
public class Storage {
public static ConcurrentHashMap<String, Boolean> bools = new ConcurrentHashMap<>();