mirror of
https://github.com/AtlasMediaGroup/TotalFreedomMod.git
synced 2024-11-27 01:05:38 +00:00
replace private constructors & new attribute names
This commit is contained in:
parent
1a7c14ad3e
commit
bb4f8d1fc6
@ -5,11 +5,14 @@ import java.util.List;
|
|||||||
import me.totalfreedom.totalfreedommod.rank.Rank;
|
import me.totalfreedom.totalfreedommod.rank.Rank;
|
||||||
import me.totalfreedom.totalfreedommod.util.FUtil;
|
import me.totalfreedom.totalfreedommod.util.FUtil;
|
||||||
import net.minecraft.server.v1_16_R1.NBTTagCompound;
|
import net.minecraft.server.v1_16_R1.NBTTagCompound;
|
||||||
|
import net.minecraft.server.v1_16_R1.NBTTagInt;
|
||||||
import net.minecraft.server.v1_16_R1.NBTTagList;
|
import net.minecraft.server.v1_16_R1.NBTTagList;
|
||||||
|
import net.minecraft.server.v1_16_R1.NBTTagString;
|
||||||
import org.apache.commons.lang.StringUtils;
|
import org.apache.commons.lang.StringUtils;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
import org.bukkit.command.Command;
|
import org.bukkit.command.Command;
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
|
import org.bukkit.craftbukkit.v1_16_R1.inventory.CraftItemStack;
|
||||||
import org.bukkit.enchantments.Enchantment;
|
import org.bukkit.enchantments.Enchantment;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.ItemStack;
|
||||||
@ -141,13 +144,13 @@ public class Command_modifyitem extends FreedomCommand
|
|||||||
item.setItemMeta(potionMeta);
|
item.setItemMeta(potionMeta);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
// TODO: Fix code here bc 1.15 made some things private for some reason
|
|
||||||
/*case "attribute":
|
case "attribute":
|
||||||
if (args.length < 3)
|
if (args.length < 3)
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
net.minecraft.server.v1_15_R1.ItemStack nmsStack = CraftItemStack.asNMSCopy(item);
|
net.minecraft.server.v1_16_R1.ItemStack nmsStack = CraftItemStack.asNMSCopy(item);
|
||||||
NBTTagCompound compound = (nmsStack.hasTag()) ? nmsStack.getTag() : new NBTTagCompound();
|
NBTTagCompound compound = (nmsStack.hasTag()) ? nmsStack.getTag() : new NBTTagCompound();
|
||||||
NBTTagList modifiers = getAttributeList(nmsStack);
|
NBTTagList modifiers = getAttributeList(nmsStack);
|
||||||
NBTTagCompound cmpnd = new NBTTagCompound();
|
NBTTagCompound cmpnd = new NBTTagCompound();
|
||||||
@ -157,8 +160,8 @@ public class Command_modifyitem extends FreedomCommand
|
|||||||
msg("Invalid attribute. Please run /attributelist for a list of valid attributes.");
|
msg("Invalid attribute. Please run /attributelist for a list of valid attributes.");
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
cmpnd.set("AttributeName", new NBTTagString(attribute.getAttribute()));
|
cmpnd.set("AttributeName", NBTTagString.a(attribute.getAttribute()));
|
||||||
cmpnd.set("Name", new NBTTagString(attribute.getAttribute()));
|
cmpnd.set("Name", NBTTagString.a(attribute.getAttribute()));
|
||||||
int amount;
|
int amount;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
@ -169,16 +172,16 @@ public class Command_modifyitem extends FreedomCommand
|
|||||||
msg("The amount specified is not a valid integer.");
|
msg("The amount specified is not a valid integer.");
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
cmpnd.set("Amount", new NBTTagInt(amount));
|
cmpnd.set("Amount", NBTTagInt.a(amount));
|
||||||
cmpnd.set("Operation", new NBTTagInt(0));
|
cmpnd.set("Operation", NBTTagInt.a(0));
|
||||||
cmpnd.set("UUIDLeast", new NBTTagInt(894654));
|
cmpnd.set("UUIDLeast", NBTTagInt.a(894654));
|
||||||
cmpnd.set("UUIDMost", new NBTTagInt(2872));
|
cmpnd.set("UUIDMost", NBTTagInt.a(2872));
|
||||||
cmpnd.set("Slot", new NBTTagString("mainhand"));
|
cmpnd.set("Slot", NBTTagString.a("mainhand"));
|
||||||
modifiers.add(cmpnd);
|
modifiers.add(cmpnd);
|
||||||
compound.set("AttributeModifiers", modifiers);
|
compound.set("AttributeModifiers", modifiers);
|
||||||
nmsStack.setTag(compound);
|
nmsStack.setTag(compound);
|
||||||
item = CraftItemStack.asBukkitCopy(nmsStack);
|
item = CraftItemStack.asBukkitCopy(nmsStack);
|
||||||
break;*/
|
break;
|
||||||
default:
|
default:
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -200,21 +203,20 @@ public class Command_modifyitem extends FreedomCommand
|
|||||||
return stack.getTag().getList("AttributeModifiers", 10);
|
return stack.getTag().getList("AttributeModifiers", 10);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private enum Attribute
|
private enum Attribute
|
||||||
{
|
{
|
||||||
GENERIC_MAX_HEALTH("GENERIC_MAX_HEALTH", "generic.maxHealth"),
|
GENERIC_MAX_HEALTH("GENERIC_MAX_HEALTH", "generic.max_health"),
|
||||||
GENERIC_FOLLOW_RANGE("GENERIC_FOLLOW_RANGE", "generic.followRange"),
|
GENERIC_FOLLOW_RANGE("GENERIC_FOLLOW_RANGE", "generic.follow_range"),
|
||||||
GENERIC_KNOCKBACK_RESISTANCE("GENERIC_KNOCKBACK_RESISTANCE", "generic.knockbackResistance"),
|
GENERIC_KNOCKBACK_RESISTANCE("GENERIC_KNOCKBACK_RESISTANCE", "generic.knockback_resistance"),
|
||||||
GENERIC_MOVEMENT_SPEED("GENERIC_MOVEMENT_SPEED", "generic.movementSpeed"),
|
GENERIC_MOVEMENT_SPEED("GENERIC_MOVEMENT_SPEED", "generic.movement_speed"),
|
||||||
GENERIC_FLYING_SPEED("GENERIC_FLYING_SPEED", "generic.flyingSpeed"),
|
GENERIC_FLYING_SPEED("GENERIC_FLYING_SPEED", "generic.flying_speed"),
|
||||||
GENERIC_ATTACK_DAMAGE("GENERIC_ATTACK_DAMAGE", "generic.attackDamage"),
|
GENERIC_ATTACK_DAMAGE("GENERIC_ATTACK_DAMAGE", "generic.attack_damage"),
|
||||||
GENERIC_ATTACK_SPEED("GENERIC_ATTACK_SPEED", "generic.attackSpeed"),
|
GENERIC_ATTACK_SPEED("GENERIC_ATTACK_SPEED", "generic.attack_speed"),
|
||||||
GENERIC_ARMOR("GENERIC_ARMOR", "generic.armor"),
|
GENERIC_ARMOR("GENERIC_ARMOR", "generic.armor"),
|
||||||
GENERIC_ARMOR_TOUGHNESS("GENERIC_ARMOR_TOUGHNESS", "generic.armorToughmess"),
|
GENERIC_ARMOR_TOUGHNESS("GENERIC_ARMOR_TOUGHNESS", "generic.armor_toughmess"),
|
||||||
GENERIC_LUCK("GENERIC_LUCK", "generic.luck"),
|
GENERIC_LUCK("GENERIC_LUCK", "generic.luck"),
|
||||||
HORSE_JUMP_STRENGTH("GENERIC_MAX_HEALTH", "horse.JumpStrength"),
|
HORSE_JUMP_STRENGTH("GENERIC_MAX_HEALTH", "horse.jump_strength"),
|
||||||
ZOMBIE_SPAWN_REINFORCEMENTS("ZOMBIE_SPAWN_REINFORCEMENTS", "zombie.SpawnReinforcements");
|
ZOMBIE_SPAWN_REINFORCEMENTS("ZOMBIE_SPAWN_REINFORCEMENTS", "zombie.spawn_reinforcements");
|
||||||
|
|
||||||
private final String name;
|
private final String name;
|
||||||
private final String attribute;
|
private final String attribute;
|
||||||
|
Loading…
Reference in New Issue
Block a user