0.4.9
remade attribute system, made everything work
This commit is contained in:
parent
df35233794
commit
ce3c1d547c
69 changed files with 1109 additions and 1052 deletions
|
@ -2,13 +2,15 @@ package gq.unurled.raxen.commands.admin;
|
|||
|
||||
import de.tr7zw.nbtapi.NBTItem;
|
||||
import gq.unurled.raxen.Raxen;
|
||||
import gq.unurled.raxen.components.player.attributes.Attributes;
|
||||
import gq.unurled.raxen.components.entity.player.attributes.Attributes;
|
||||
import gq.unurled.raxen.manager.entity.PlayerManager;
|
||||
import net.kyori.adventure.text.Component;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.command.TabExecutor;
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.inventory.meta.ItemMeta;
|
||||
|
@ -18,7 +20,7 @@ import org.jetbrains.annotations.Nullable;
|
|||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import static gq.unurled.raxen.components.player.PlayerUtils.updateSkills;
|
||||
import static gq.unurled.raxen.components.entity.player.PlayerUtils.updateSkills;
|
||||
import static gq.unurled.raxen.utils.Items.attributes;
|
||||
import static gq.unurled.raxen.utils.Utils.*;
|
||||
|
||||
|
@ -75,19 +77,22 @@ public class NbtCommand implements TabExecutor {
|
|||
}
|
||||
itm.lore(lore);
|
||||
it.setItemMeta(itm);
|
||||
PlayerManager pm = ((Raxen) Bukkit.getPluginManager().getPlugin("Raxen")).getManager().getPlayerManager();
|
||||
Entity e = player;
|
||||
Attributes attributes = new Attributes(main);
|
||||
nbti.setInteger(args[0], Integer.parseInt(args[1]) + a);
|
||||
if (nbti.hasKey("SPEED")) {
|
||||
attributes.addSpeed(player, nbti.getInteger("SPEED"));
|
||||
pm.getSpeed().add(e, nbti.getInteger("SPEED"));
|
||||
}
|
||||
if (nbti.hasKey("HEALTH")) {
|
||||
attributes.addHealth(player, nbti.getInteger("HEALTH"));
|
||||
pm.getHealth().add(e, nbti.getInteger("HEALTH"));
|
||||
}
|
||||
if (nbti.hasKey("DEFENSE")) {
|
||||
attributes.addDefense(player, nbti.getInteger("DEFENSE"));
|
||||
pm.getDefense().add(e, nbti.getInteger("DEFENSE"));
|
||||
|
||||
}
|
||||
if (nbti.hasKey("STRENGTH")) {
|
||||
attributes.addStrength(player, nbti.getInteger("STRENGTH"));
|
||||
pm.getStrength().add(e, nbti.getInteger("STRENGTH"));
|
||||
}
|
||||
it = nbti.getItem();
|
||||
msgPlayer(player, colorTextComp(Raxen.getPrefix() + "<white>You successfully added the nbt " + attributes(args[0]) + "<white>with " + args[1] + "<white>."));
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
package gq.unurled.raxen.commands.admin;
|
||||
|
||||
import gq.unurled.raxen.Raxen;
|
||||
import gq.unurled.raxen.components.entity.EntityNamespacedKey;
|
||||
import gq.unurled.raxen.components.entity.other.EntityNamespacedKey;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.command.TabExecutor;
|
||||
|
@ -14,7 +14,7 @@ import org.jetbrains.annotations.Nullable;
|
|||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import static gq.unurled.raxen.components.entity.EntityUtils.setNameSpacedKeys;
|
||||
import static gq.unurled.raxen.components.entity.other.EntityUtils.setNameSpacedKeys;
|
||||
import static gq.unurled.raxen.utils.Utils.*;
|
||||
|
||||
public class SpawnEntity implements TabExecutor {
|
||||
|
|
|
@ -1,8 +1,9 @@
|
|||
package gq.unurled.raxen.commands.player;
|
||||
|
||||
import gq.unurled.raxen.Raxen;
|
||||
import gq.unurled.raxen.components.player.PlayerUtils;
|
||||
import gq.unurled.raxen.components.player.attributes.Attributes;
|
||||
import gq.unurled.raxen.components.entity.player.PlayerUtils;
|
||||
import gq.unurled.raxen.components.entity.player.attributes.Attributes;
|
||||
import gq.unurled.raxen.manager.entity.PlayerManager;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandSender;
|
||||
|
@ -13,7 +14,8 @@ import org.jetbrains.annotations.Nullable;
|
|||
|
||||
import java.util.List;
|
||||
|
||||
import static gq.unurled.raxen.utils.Utils.*;
|
||||
import static gq.unurled.raxen.utils.Utils.colorTextComp;
|
||||
import static gq.unurled.raxen.utils.Utils.error;
|
||||
|
||||
public class SkillsCommand implements TabExecutor {
|
||||
|
||||
|
@ -42,65 +44,17 @@ public class SkillsCommand implements TabExecutor {
|
|||
.append(colorTextComp("<white>/skill <dark_aqua>{health|defense|speed|strength} {add|set|remove} {amount}")));
|
||||
break;
|
||||
case 3:
|
||||
switch (args[0]) {
|
||||
case "health":
|
||||
if(args[1].equalsIgnoreCase("add")) {
|
||||
attributes.setHealth(player, attributes.getHealth(player) + Integer.parseInt(args[2]));
|
||||
msgPlayer(player,"You were added " + args[2] + " health more!");
|
||||
}
|
||||
if(args[1].equalsIgnoreCase("set")) {
|
||||
attributes.setHealth(player, Integer.parseInt(args[2]));
|
||||
msgPlayer(player,"You are set " + args[2] + " health!");
|
||||
}
|
||||
if(args[1].equalsIgnoreCase("remove")) {
|
||||
attributes.setHealth(player ,attributes.getHealth(player) - Integer.parseInt(args[2]));
|
||||
msgPlayer(player,"You were removeded " + args[2] + " health less!");
|
||||
|
||||
}
|
||||
break;
|
||||
case "defense":
|
||||
if(args[1].equalsIgnoreCase("add")) {
|
||||
attributes.setDefense(player, attributes.getDefense(player) + Integer.parseInt(args[2]));
|
||||
msgPlayer(player,"You were added " + args[2] + " defense more!");
|
||||
|
||||
}
|
||||
if(args[1].equalsIgnoreCase("set")) {
|
||||
attributes.setDefense(player, Integer.parseInt(args[2]));
|
||||
msgPlayer(player,"You are set " + args[2] + " defense!");
|
||||
}
|
||||
if(args[1].equalsIgnoreCase("remove")) {
|
||||
attributes.setDefense(player, attributes.getDefense(player) - Integer.parseInt(args[2]));
|
||||
msgPlayer(player,"You were removed " + args[2] + " defense less!");
|
||||
}
|
||||
break;
|
||||
case "speed":
|
||||
if(args[1].equalsIgnoreCase("add")) {
|
||||
attributes.setSpeed(player, attributes.getSpeed(player) + Integer.parseInt(args[2]));
|
||||
msgPlayer(player,"You were added " + args[2] + " speed more!");
|
||||
}
|
||||
if(args[1].equalsIgnoreCase("set")) {
|
||||
attributes.setSpeed(player, Integer.parseInt(args[2]));
|
||||
msgPlayer(player,"You are set " + args[2] + " speed!");
|
||||
}
|
||||
if(args[1].equalsIgnoreCase("remove")) {
|
||||
attributes.setSpeed(player, attributes.getSpeed(player) - Integer.parseInt(args[2]));
|
||||
msgPlayer(player,"You were removed " + args[2] + " speed less!");
|
||||
}
|
||||
break;
|
||||
case "stregnth":
|
||||
if(args[1].equalsIgnoreCase("add")) {
|
||||
attributes.setStrength(player, attributes.getStrength(player) + Integer.parseInt(args[2]));
|
||||
msgPlayer(player,"You were added " + args[2] + " strength more!");
|
||||
}
|
||||
if(args[1].equalsIgnoreCase("set")) {
|
||||
attributes.setStrength(player, Integer.parseInt(args[2]));
|
||||
msgPlayer(player,"You are set " + args[2] + " strength!");
|
||||
}
|
||||
if(args[1].equalsIgnoreCase("remove")) {
|
||||
attributes.setStrength(player, attributes.getStrength(player) - Integer.parseInt(args[2]));
|
||||
msgPlayer(player,"You were removed " + args[2] + " strength less!");
|
||||
}
|
||||
break;
|
||||
PlayerManager pm = ((Raxen) Bukkit.getPluginManager().getPlugin("Raxen")).getManager().getPlayerManager();
|
||||
for (String s : pm.getAttribute().keySet()) {
|
||||
if (s.equalsIgnoreCase(args[0]))
|
||||
switch (args[1]) {
|
||||
case "add":
|
||||
pm.getAttribute().get(s).add(player, Integer.parseInt(args[2]));
|
||||
case "remove":
|
||||
pm.getAttribute().get(s).remove(player, Integer.parseInt(args[2]));
|
||||
case "set":
|
||||
pm.getAttribute().get(s).set(player, Integer.parseInt(args[2]));
|
||||
}
|
||||
}
|
||||
PlayerUtils.updateSkills(main, player);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue