0.4.3: change in Damage system => it's working !, Attributes, ...
need some testin and also make damage by block event
This commit is contained in:
parent
5f5e4fa87c
commit
bc12dcc70a
25 changed files with 182 additions and 120 deletions
|
@ -2,7 +2,6 @@ package gq.unurled.raxen.commands;
|
|||
|
||||
import gq.unurled.raxen.Raxen;
|
||||
import gq.unurled.raxen.manager.StorageManager;
|
||||
import gq.unurled.raxen.utils.Utils;
|
||||
import net.kyori.adventure.text.Component;
|
||||
import net.kyori.adventure.text.TextComponent;
|
||||
import net.kyori.adventure.text.event.ClickEvent;
|
||||
|
@ -71,7 +70,6 @@ public class RaxenCommand implements TabExecutor {
|
|||
return true;
|
||||
}
|
||||
case 1 -> {
|
||||
log("hello");
|
||||
switch (args[0]) {
|
||||
case "mongodb", "mongo", "MONGODB", "MONGO" -> {
|
||||
//print info about connection
|
||||
|
@ -96,7 +94,7 @@ public class RaxenCommand implements TabExecutor {
|
|||
}
|
||||
case "hemlp", "?", "h" ->
|
||||
//print help
|
||||
log("why tf?");
|
||||
debug(main, "print help");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -12,7 +12,6 @@ import org.bukkit.command.TabExecutor;
|
|||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.inventory.meta.ItemMeta;
|
||||
import org.checkerframework.checker.units.qual.A;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
|
@ -25,8 +24,8 @@ import static gq.unurled.raxen.utils.Utils.*;
|
|||
|
||||
public class NbtCommand implements TabExecutor {
|
||||
|
||||
private Raxen main;
|
||||
private ProfileManager profileManager;
|
||||
private final Raxen main;
|
||||
private final ProfileManager profileManager;
|
||||
|
||||
public NbtCommand(Raxen main) {
|
||||
this.main = main;
|
||||
|
@ -45,16 +44,13 @@ public class NbtCommand implements TabExecutor {
|
|||
return true;
|
||||
}
|
||||
switch (args.length) {
|
||||
case 0:
|
||||
case 1:
|
||||
msgPlayer(player, color("&cYou must specify an nbt and an int."));
|
||||
break;
|
||||
case 2:
|
||||
log("'"+args[0]+"'", "'"+args[1]+"'");
|
||||
case 0, 1 -> msgPlayer(player, color("&cYou must specify an nbt and an int."));
|
||||
case 2 -> {
|
||||
debug(main, "'" + args[0] + "'", "'" + args[1] + "'");
|
||||
ItemStack it = player.getInventory().getItemInMainHand();
|
||||
NBTItem nbti = new NBTItem(it);
|
||||
int a = 0;
|
||||
if(nbti.hasKey(args[1])) {
|
||||
if (nbti.hasKey(args[1])) {
|
||||
a = nbti.getInteger(args[1]);
|
||||
}
|
||||
List<Component> lore = new ArrayList<>();
|
||||
|
@ -62,7 +58,7 @@ public class NbtCommand implements TabExecutor {
|
|||
lore.add((Component) itm.lore());
|
||||
Boolean yes = false;
|
||||
Boolean ever = false;
|
||||
for(Component ct : lore) {
|
||||
for (Component ct : lore) {
|
||||
if (ct != null) {
|
||||
if (ct.contains(Component.text("Attributes:"))) {
|
||||
yes = true;
|
||||
|
@ -75,30 +71,31 @@ public class NbtCommand implements TabExecutor {
|
|||
}
|
||||
}
|
||||
}
|
||||
if(!ever) {
|
||||
if (!ever) {
|
||||
lore.add(Component.text(color("&cAttributes:")));
|
||||
lore.add(Component.text(color(attributes(args[0]) + ": " + (Integer.parseInt(args[1]) + a) )));
|
||||
lore.add(Component.text(color(attributes(args[0]) + ": " + (Integer.parseInt(args[1]) + a))));
|
||||
}
|
||||
itm.lore(lore);
|
||||
it.setItemMeta(itm);
|
||||
Attributes attributes = new Attributes(main);
|
||||
nbti.setInteger(args[0], Integer.parseInt(args[1]) + a);
|
||||
if(nbti.hasKey("SPEED")) {
|
||||
if (nbti.hasKey("SPEED")) {
|
||||
attributes.addSpeed(player, nbti.getInteger("SPEED"));
|
||||
}
|
||||
if(nbti.hasKey("HEALTH")) {
|
||||
if (nbti.hasKey("HEALTH")) {
|
||||
attributes.addHealth(player, nbti.getInteger("HEALTH"));
|
||||
}
|
||||
if(nbti.hasKey("DEFENSE")) {
|
||||
if (nbti.hasKey("DEFENSE")) {
|
||||
attributes.addDefense(player, nbti.getInteger("DEFENSE"));
|
||||
}
|
||||
if(nbti.hasKey("STRENGTH")) {
|
||||
if (nbti.hasKey("STRENGTH")) {
|
||||
attributes.addStrength(player, nbti.getInteger("STRENGTH"));
|
||||
}
|
||||
it = nbti.getItem();
|
||||
msgPlayer(player, Raxen.getPrefix() + color("&fYou successfully added the nbt " +attributes(args[0]) + "&fwith " + args[1] + "&f."));
|
||||
msgPlayer(player, Raxen.getPrefix() + color("&fYou successfully added the nbt " + attributes(args[0]) + "&fwith " + args[1] + "&f."));
|
||||
updateSkills(main, player);
|
||||
player.getInventory().setItem(player.getInventory().getHeldItemSlot(), it);
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -8,13 +8,11 @@ import org.bukkit.command.TabExecutor;
|
|||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.entity.EntityType;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.persistence.PersistentDataContainer;
|
||||
import org.bukkit.persistence.PersistentDataType;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
|
||||
import static gq.unurled.raxen.components.entity.Entity.setNameSpacedKeys;
|
||||
import static gq.unurled.raxen.utils.Utils.*;
|
||||
|
@ -32,11 +30,11 @@ public class SpawnEntity implements TabExecutor {
|
|||
@Override
|
||||
public boolean onCommand(@NotNull CommandSender sender, @NotNull Command command, @NotNull String label, @NotNull String[] args) {
|
||||
if (!(sender instanceof Player)) {
|
||||
log("&cConsole can't execute this command!");
|
||||
log(color("&cConsole can't execute this command!"));
|
||||
return false;
|
||||
}
|
||||
Player player = (Player) sender;
|
||||
if (player.hasPermission("raxen.entityspawn.cmd")) {
|
||||
if (!player.hasPermission("raxen.entityspawn.cmd")) {
|
||||
player.sendMessage(noPerms());
|
||||
return false;
|
||||
}
|
||||
|
@ -49,6 +47,10 @@ public class SpawnEntity implements TabExecutor {
|
|||
|
||||
@Override
|
||||
public @Nullable List<String> onTabComplete(@NotNull CommandSender sender, @NotNull Command command, @NotNull String alias, @NotNull String[] args) {
|
||||
return null;
|
||||
List<String> list = new ArrayList<>();
|
||||
for (EntityType type : EntityType.values()) {
|
||||
list.add(type.name());
|
||||
}
|
||||
return list;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue