0.4.4: tested little bit, remade raxenPLayer etc...
This commit is contained in:
parent
bc12dcc70a
commit
952ed13086
27 changed files with 457 additions and 225 deletions
|
@ -2,9 +2,9 @@
|
|||
#### to wich direction i want Raxen to go ?
|
||||
Some RPG thing :
|
||||
- Hypixel has Skyblock
|
||||
- Wyncraft has Quests
|
||||
- Wyncraft has Quests and Magic
|
||||
- Raxen must do :
|
||||
- some survival and RPG thing
|
||||
- some survival and RPG(Class) thing
|
||||
- need some sort of action => pve, pvp maybe ?
|
||||
- need custom mobs => some are made => not definitive need more => juste made the damage system and persistentdatacontainer on entities outside of Player, might consider to switch to persistentdatacontainer on player instead of having an hashmap (ProfileManager.java)
|
||||
- need custom items => partialy made => need custom resource pack support
|
||||
|
|
4
pom.xml
4
pom.xml
|
@ -6,7 +6,7 @@
|
|||
|
||||
<groupId>gq.unurled</groupId>
|
||||
<artifactId>raxen</artifactId>
|
||||
<version>0.4.3</version>
|
||||
<version>0.4.4</version>
|
||||
<packaging>jar</packaging>
|
||||
|
||||
<name>Raxen</name>
|
||||
|
@ -107,7 +107,7 @@
|
|||
<artifactId>nms</artifactId>
|
||||
<version>4.7.0</version>
|
||||
<scope>system</scope>
|
||||
<systemPath>${project.basedir}/api/paper-1.18.1.jar</systemPath>
|
||||
<systemPath>/media/QDISK/DOCUMENT/prog/MC/Elixium/dev/Raxen/api/paper-1.18.1.jar</systemPath>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.projectlombok</groupId>
|
||||
|
|
|
@ -20,7 +20,7 @@ public final class Raxen extends JavaPlugin {
|
|||
|
||||
private static final String prefix = ChatColor.AQUA + "Rx" + ChatColor.LIGHT_PURPLE + "> ";
|
||||
@Getter
|
||||
private static final String version = "0.4.3";
|
||||
private static final String version = "0.4.4";
|
||||
private final PluginManager pm = getServer().getPluginManager();
|
||||
|
||||
@Getter
|
||||
|
@ -33,7 +33,6 @@ public final class Raxen extends JavaPlugin {
|
|||
private static StorageManager storageManager;
|
||||
|
||||
private static PlayerManager playerManager;
|
||||
private static ProfileManager profileManager;
|
||||
private static PlayerConfig playerConfig;
|
||||
|
||||
private static ListenerManager listenerManager;
|
||||
|
@ -64,7 +63,7 @@ public final class Raxen extends JavaPlugin {
|
|||
|
||||
//Managers
|
||||
itemManager = new ItemManager(this);
|
||||
profileManager = new ProfileManager(this);
|
||||
playerManager = new PlayerManager(this);
|
||||
listenerManager = new ListenerManager(this);
|
||||
commandManager = new CommandManager(this);
|
||||
protocolManager = ProtocolLibrary.getProtocolManager();
|
||||
|
@ -120,10 +119,6 @@ public final class Raxen extends JavaPlugin {
|
|||
return prefix;
|
||||
}
|
||||
|
||||
public static ProfileManager getProfileManager() {
|
||||
return profileManager;
|
||||
}
|
||||
|
||||
public static PlayerManager getPlayerManager() {
|
||||
return playerManager;
|
||||
}
|
||||
|
|
|
@ -3,7 +3,6 @@ package gq.unurled.raxen.commands.admin;
|
|||
import de.tr7zw.changeme.nbtapi.NBTItem;
|
||||
import gq.unurled.raxen.Raxen;
|
||||
import gq.unurled.raxen.components.player.Attributes.Attributes;
|
||||
import gq.unurled.raxen.manager.ProfileManager;
|
||||
import net.kyori.adventure.text.Component;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.command.Command;
|
||||
|
@ -25,11 +24,9 @@ import static gq.unurled.raxen.utils.Utils.*;
|
|||
public class NbtCommand implements TabExecutor {
|
||||
|
||||
private final Raxen main;
|
||||
private final ProfileManager profileManager;
|
||||
|
||||
public NbtCommand(Raxen main) {
|
||||
this.main = main;
|
||||
this.profileManager = main.getProfileManager();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -14,7 +14,7 @@ import org.jetbrains.annotations.Nullable;
|
|||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import static gq.unurled.raxen.components.entity.Entity.setNameSpacedKeys;
|
||||
import static gq.unurled.raxen.components.entity.EntityUtils.setNameSpacedKeys;
|
||||
import static gq.unurled.raxen.utils.Utils.*;
|
||||
|
||||
public class SpawnEntity implements TabExecutor {
|
||||
|
|
|
@ -2,7 +2,6 @@ package gq.unurled.raxen.commands.player;
|
|||
|
||||
import gq.unurled.raxen.Raxen;
|
||||
import gq.unurled.raxen.components.player.Attributes.Attributes;
|
||||
import gq.unurled.raxen.manager.ProfileManager;
|
||||
import net.kyori.adventure.text.Component;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandSender;
|
||||
|
@ -17,12 +16,10 @@ import static gq.unurled.raxen.utils.Utils.*;
|
|||
|
||||
public class SkillsCommand implements TabExecutor {
|
||||
|
||||
private ProfileManager profileManager;
|
||||
private Raxen main;
|
||||
|
||||
public SkillsCommand(Raxen main) {
|
||||
this.main = main;
|
||||
this.profileManager = main.getProfileManager();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
package gq.unurled.raxen.commands.player;
|
||||
|
||||
import gq.unurled.raxen.Raxen;
|
||||
import gq.unurled.raxen.manager.ProfileManager;
|
||||
import gq.unurled.raxen.manager.PlayerManager;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandSender;
|
||||
|
@ -17,7 +17,7 @@ import static gq.unurled.raxen.utils.Utils.*;
|
|||
|
||||
public class StorageCommand implements TabExecutor {
|
||||
|
||||
private ProfileManager profileManager = Raxen.getProfileManager();
|
||||
private PlayerManager playerManager = Raxen.getPlayerManager();
|
||||
|
||||
@Override
|
||||
public boolean onCommand(@NotNull CommandSender sender, @NotNull Command command, @NotNull String label, @NotNull String[] args) {
|
||||
|
@ -29,12 +29,12 @@ public class StorageCommand implements TabExecutor {
|
|||
Inventory inv;
|
||||
switch (args.length) {
|
||||
case 0:
|
||||
if(profileManager.getPlayerStorage(player.getUniqueId()) != null) {
|
||||
inv = profileManager.getPlayerStorage(player.getUniqueId()).getEc().getEc();
|
||||
if(playerManager.getRaxenPlayer(player).getStorage() != null) {
|
||||
inv = playerManager.getRaxenPlayer(player).getStorage().getEc().getEc();
|
||||
}
|
||||
else {
|
||||
profileManager.createNewStorage(player);
|
||||
inv = profileManager.getPlayerStorage(player.getUniqueId()).getEc().getEc();
|
||||
playerManager.getRaxenPlayer(player).createStorage();
|
||||
inv = playerManager.getRaxenPlayer(player).getStorage().getEc().getEc();
|
||||
}
|
||||
player.openInventory(inv);
|
||||
|
||||
|
@ -45,7 +45,7 @@ public class StorageCommand implements TabExecutor {
|
|||
msgPlayer(player, color("&cYou can't open the Storage of an unknown Player."));
|
||||
return true;
|
||||
}
|
||||
inv = profileManager.getPlayerStorage(p.getUniqueId()).getEc().getEc();
|
||||
inv = playerManager.getRaxenPlayer(player).getStorage().getEc().getEc();
|
||||
player.openInventory(inv);
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -3,6 +3,7 @@ package gq.unurled.raxen.components.entity;
|
|||
import gq.unurled.raxen.Raxen;
|
||||
import gq.unurled.raxen.components.player.Attributes.Attribute;
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.persistence.PersistentDataContainer;
|
||||
import org.bukkit.persistence.PersistentDataType;
|
||||
|
||||
|
@ -16,7 +17,8 @@ public class Attributes {
|
|||
|
||||
public static Attribute getAttribute(Entity e) {
|
||||
PersistentDataContainer data = e.getPersistentDataContainer();
|
||||
int health, itemHealth, defense, itemDefense, speed, itemSpeed, strength, itemDmg;
|
||||
int maxHealth, health, itemHealth, defense, itemDefense, speed, itemSpeed, strength, itemDmg, maxMana, mana, itemMana;
|
||||
maxHealth = data.get(namespacedKey.maxHealth, PersistentDataType.INTEGER);
|
||||
health = data.get(namespacedKey.healthKey, PersistentDataType.INTEGER);
|
||||
itemHealth = data.get(namespacedKey.itemHealthKey, PersistentDataType.INTEGER);
|
||||
defense = data.get(namespacedKey.defenseKey, PersistentDataType.INTEGER);
|
||||
|
@ -25,10 +27,14 @@ public class Attributes {
|
|||
itemSpeed = data.get(namespacedKey.itemSpeedKey, PersistentDataType.INTEGER);
|
||||
strength = data.get(namespacedKey.strengthKey , PersistentDataType.INTEGER);
|
||||
itemDmg = data.get(namespacedKey.itemStrengthKey, PersistentDataType.INTEGER);
|
||||
return new Attribute(health, itemHealth, defense, itemDefense, speed, itemSpeed, strength, itemDmg);
|
||||
maxMana = data.get(namespacedKey.maxMana, PersistentDataType.INTEGER);
|
||||
mana = data.get(namespacedKey.mana, PersistentDataType.INTEGER);
|
||||
itemMana = data.get(namespacedKey.itemMana, PersistentDataType.INTEGER);
|
||||
|
||||
return new Attribute(maxHealth, health, itemHealth, defense, itemDefense, speed, itemSpeed, strength, itemDmg, maxMana, mana, itemMana);
|
||||
}
|
||||
|
||||
public static void setAttributes(Entity e, int health, int itemHealth, int defense, int itemDefense, int speed, int itemSpeed, int strength, int itemDmg) {
|
||||
public static void setAttributes(Entity e, int health, int itemHealth, int defense, int itemDefense, int speed, int itemSpeed, int strength, int itemDmg, int maxMana, int mana, int itemMana) {
|
||||
PersistentDataContainer data = e.getPersistentDataContainer();
|
||||
data.set(namespacedKey.healthKey, PersistentDataType.INTEGER, health);
|
||||
data.set(namespacedKey.itemHealthKey, PersistentDataType.INTEGER, itemHealth);
|
||||
|
@ -38,6 +44,9 @@ public class Attributes {
|
|||
data.set(namespacedKey.itemSpeedKey, PersistentDataType.INTEGER, itemSpeed);
|
||||
data.set(namespacedKey.strengthKey , PersistentDataType.INTEGER, strength);
|
||||
data.set(namespacedKey.itemStrengthKey, PersistentDataType.INTEGER, itemDmg);
|
||||
data.set(namespacedKey.maxMana, PersistentDataType.INTEGER, maxMana);
|
||||
data.set(namespacedKey.mana, PersistentDataType.INTEGER, mana);
|
||||
data.set(namespacedKey.itemMana, PersistentDataType.INTEGER, itemMana);
|
||||
}
|
||||
|
||||
public void removeSpeed(Entity e, int i) {
|
||||
|
@ -56,6 +65,18 @@ public class Attributes {
|
|||
PersistentDataContainer data = e.getPersistentDataContainer();
|
||||
data.set(namespacedKey.strengthKey, PersistentDataType.INTEGER, data.get(namespacedKey.strengthKey, PersistentDataType.INTEGER) -i);
|
||||
}
|
||||
public void removeMana(Player player, int i) {
|
||||
PersistentDataContainer data = player.getPersistentDataContainer();
|
||||
data.set(namespacedKey.mana, PersistentDataType.INTEGER, data.get(namespacedKey.mana, PersistentDataType.INTEGER) -i);
|
||||
}
|
||||
public void removeMaxMana(Player player, int i) {
|
||||
PersistentDataContainer data = player.getPersistentDataContainer();
|
||||
data.set(namespacedKey.maxMana, PersistentDataType.INTEGER, data.get(namespacedKey.maxMana, PersistentDataType.INTEGER) -i);
|
||||
}
|
||||
public void removeMaxHealth(Player player, int i) {
|
||||
PersistentDataContainer data = player.getPersistentDataContainer();
|
||||
data.set(namespacedKey.maxHealth, PersistentDataType.INTEGER, data.get(namespacedKey.maxHealth, PersistentDataType.INTEGER) -i);
|
||||
}
|
||||
|
||||
public void removeItemSpeed(Entity e, int i) {
|
||||
PersistentDataContainer data = e.getPersistentDataContainer();
|
||||
|
@ -90,6 +111,18 @@ public class Attributes {
|
|||
PersistentDataContainer data = e.getPersistentDataContainer();
|
||||
data.set(namespacedKey.strengthKey, PersistentDataType.INTEGER, data.get(namespacedKey.strengthKey, PersistentDataType.INTEGER) +i);
|
||||
}
|
||||
public void addMana(Player player, int i) {
|
||||
PersistentDataContainer data = player.getPersistentDataContainer();
|
||||
data.set(namespacedKey.mana, PersistentDataType.INTEGER, data.get(namespacedKey.mana, PersistentDataType.INTEGER) +i);
|
||||
}
|
||||
public void addMaxMana(Player player, int i) {
|
||||
PersistentDataContainer data = player.getPersistentDataContainer();
|
||||
data.set(namespacedKey.maxMana, PersistentDataType.INTEGER, data.get(namespacedKey.maxMana, PersistentDataType.INTEGER) +i);
|
||||
}
|
||||
public void addMaxHealth(Player player, int i) {
|
||||
PersistentDataContainer data = player.getPersistentDataContainer();
|
||||
data.set(namespacedKey.maxHealth, PersistentDataType.INTEGER, data.get(namespacedKey.maxHealth, PersistentDataType.INTEGER) +i);
|
||||
}
|
||||
|
||||
public void addItemSpeed(Entity e, int i) {
|
||||
PersistentDataContainer data = e.getPersistentDataContainer();
|
||||
|
@ -124,6 +157,18 @@ public class Attributes {
|
|||
PersistentDataContainer data = e.getPersistentDataContainer();
|
||||
return data.get(namespacedKey.defenseKey, PersistentDataType.INTEGER);
|
||||
}
|
||||
public Integer getMana(Player player) {
|
||||
PersistentDataContainer data = player.getPersistentDataContainer();
|
||||
return data.get(namespacedKey.mana, PersistentDataType.INTEGER);
|
||||
}
|
||||
public Integer getMaxMana(Player player) {
|
||||
PersistentDataContainer data = player.getPersistentDataContainer();
|
||||
return data.get(namespacedKey.maxMana, PersistentDataType.INTEGER);
|
||||
}
|
||||
public Integer getMaxHealth(Player player) {
|
||||
PersistentDataContainer data = player.getPersistentDataContainer();
|
||||
return data.get(namespacedKey.maxHealth, PersistentDataType.INTEGER);
|
||||
}
|
||||
|
||||
public Integer getItemSpeed(Entity e) {
|
||||
PersistentDataContainer data = e.getPersistentDataContainer();
|
||||
|
@ -158,6 +203,18 @@ public class Attributes {
|
|||
PersistentDataContainer data = e.getPersistentDataContainer();
|
||||
data.set(namespacedKey.strengthKey, PersistentDataType.INTEGER, i);
|
||||
}
|
||||
public void setMana(Player player, int i) {
|
||||
PersistentDataContainer data = player.getPersistentDataContainer();
|
||||
data.set(namespacedKey.mana, PersistentDataType.INTEGER, i);
|
||||
}
|
||||
public void setMaxMana(Player player, int i) {
|
||||
PersistentDataContainer data = player.getPersistentDataContainer();
|
||||
data.set(namespacedKey.maxMana, PersistentDataType.INTEGER, i);
|
||||
}
|
||||
public void setMaxHealth(Player player, int i) {
|
||||
PersistentDataContainer data = player.getPersistentDataContainer();
|
||||
data.set(namespacedKey.maxHealth, PersistentDataType.INTEGER, i);
|
||||
}
|
||||
|
||||
public void setItemHealth(Entity e, int i) {
|
||||
PersistentDataContainer data = e.getPersistentDataContainer();
|
||||
|
|
|
@ -2,12 +2,14 @@ package gq.unurled.raxen.components.entity;
|
|||
|
||||
import gq.unurled.raxen.Raxen;
|
||||
import org.bukkit.NamespacedKey;
|
||||
import org.checkerframework.checker.units.qual.N;
|
||||
|
||||
public class EntityNamespacedKey {
|
||||
|
||||
public EntityNamespacedKey(Raxen main) {
|
||||
nameKey = new NamespacedKey(main, "name");
|
||||
levelKey = new NamespacedKey(main, "level");
|
||||
maxHealth = new NamespacedKey(main, "maxHealth");
|
||||
healthKey = new NamespacedKey(main, "health");
|
||||
itemHealthKey = new NamespacedKey(main, "itemHealth");
|
||||
speedKey = new NamespacedKey(main, "speed");
|
||||
|
@ -15,11 +17,18 @@ public class EntityNamespacedKey {
|
|||
defenseKey = new NamespacedKey(main, "defense");
|
||||
itemDefenseKey = new NamespacedKey(main, "itemDefense");
|
||||
strengthKey = new NamespacedKey(main, "strength");
|
||||
itemStrengthKey = new NamespacedKey(main, "itemDmg");
|
||||
itemStrengthKey = new NamespacedKey(main, "itemStrength");
|
||||
maxMana = new NamespacedKey(main, "maxMana");
|
||||
mana = new NamespacedKey(main, "mana");
|
||||
itemMana = new NamespacedKey(main, "itemMana");
|
||||
inventory = new NamespacedKey(main, "inventory");
|
||||
storage = new NamespacedKey(main, "storage");
|
||||
|
||||
}
|
||||
|
||||
public final NamespacedKey nameKey;
|
||||
public final NamespacedKey levelKey;
|
||||
public final NamespacedKey maxHealth;
|
||||
public final NamespacedKey healthKey;
|
||||
public final NamespacedKey itemHealthKey;
|
||||
public final NamespacedKey speedKey;
|
||||
|
@ -28,5 +37,10 @@ public class EntityNamespacedKey {
|
|||
public final NamespacedKey itemDefenseKey;
|
||||
public final NamespacedKey strengthKey;
|
||||
public final NamespacedKey itemStrengthKey;
|
||||
public final NamespacedKey maxMana;
|
||||
public final NamespacedKey mana;
|
||||
public final NamespacedKey itemMana;
|
||||
public final NamespacedKey inventory;
|
||||
public final NamespacedKey storage;
|
||||
|
||||
}
|
||||
|
|
|
@ -8,12 +8,12 @@ import org.bukkit.persistence.PersistentDataType;
|
|||
|
||||
import static gq.unurled.raxen.utils.Utils.debug;
|
||||
|
||||
public class Entity {
|
||||
public class EntityUtils {
|
||||
|
||||
private static Raxen main;
|
||||
private static EntityNamespacedKey namespacedKey;
|
||||
|
||||
public Entity(Raxen main) {
|
||||
public EntityUtils(Raxen main) {
|
||||
this.main = main;
|
||||
namespacedKey = new EntityNamespacedKey(main);
|
||||
}
|
||||
|
@ -32,20 +32,6 @@ public class Entity {
|
|||
data.set(namespacedKey.levelKey, PersistentDataType.INTEGER, level);
|
||||
}
|
||||
|
||||
public static Attribute getattributesEntity(org.bukkit.entity.Entity e) {
|
||||
PersistentDataContainer data = e.getPersistentDataContainer();
|
||||
int health, itemHealth, defense, itemDefense, speed, itemSpeed, strength, itemDmg;
|
||||
health = data.get(namespacedKey.healthKey, PersistentDataType.INTEGER);
|
||||
itemHealth = data.get(namespacedKey.itemHealthKey, PersistentDataType.INTEGER);
|
||||
defense = data.get(namespacedKey.defenseKey, PersistentDataType.INTEGER);
|
||||
itemDefense = data.get(namespacedKey.itemDefenseKey, PersistentDataType.INTEGER);
|
||||
speed = data.get(namespacedKey.speedKey, PersistentDataType.INTEGER);
|
||||
itemSpeed = data.get(namespacedKey.itemSpeedKey, PersistentDataType.INTEGER);
|
||||
strength = data.get(namespacedKey.strengthKey , PersistentDataType.INTEGER);
|
||||
itemDmg = data.get(namespacedKey.itemStrengthKey, PersistentDataType.INTEGER);
|
||||
return new Attribute(health, itemHealth, defense, itemDefense, speed, itemSpeed, strength, itemDmg);
|
||||
}
|
||||
|
||||
public static void updateSkills(LivingEntity livingEntity) {
|
||||
Attributes attributes = new Attributes(main);
|
||||
int health, itemHealth, defense, itemDefense, speed, itemSpeed, strength, itemDmg;
|
|
@ -6,5 +6,7 @@ public class NBT {
|
|||
public static String SPEED = "SPEED";
|
||||
public static String STRENGTH = "STRENGTH";
|
||||
public static String DEFENSE = "DEFENSE";
|
||||
public static String ID = "ID";
|
||||
public static String CUSTOM_ABILITY = "CUSTOM_ABILITY";
|
||||
|
||||
}
|
||||
|
|
|
@ -7,9 +7,10 @@ public class Attribute {
|
|||
|
||||
@Getter
|
||||
@Setter
|
||||
private int health, itemHealth, defense, itemDefense, speed, itemSpeed, strength, itemDmg;
|
||||
private int maxHealth, health, itemHealth, defense, itemDefense, speed, itemSpeed, strength, itemStrength, maxMana, mana, itemMana;
|
||||
|
||||
public Attribute(int health, int itemHealth, int defense, int itemDefense, int speed, int itemSpeed, int strength, int itemDmg) {
|
||||
public Attribute(int maxHealth, int health, int itemHealth, int defense, int itemDefense, int speed, int itemSpeed, int strength, int itemStrength, int maxMana, int mana, int itemMana) {
|
||||
this.maxHealth = maxHealth;
|
||||
this.health = health;
|
||||
this.itemHealth = itemHealth;
|
||||
this.defense = defense;
|
||||
|
@ -17,6 +18,9 @@ public class Attribute {
|
|||
this.speed = speed;
|
||||
this.itemSpeed = itemSpeed;
|
||||
this.strength = strength;
|
||||
this.itemDmg = itemDmg;
|
||||
this.itemStrength = itemStrength;
|
||||
this.maxHealth = maxMana;
|
||||
this.mana = mana;
|
||||
this.itemMana = itemMana;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -16,7 +16,8 @@ public class Attributes {
|
|||
|
||||
public static Attribute getAttribute(Player player) {
|
||||
PersistentDataContainer data = player.getPersistentDataContainer();
|
||||
int health, itemHealth, defense, itemDefense, speed, itemSpeed, strength, itemDmg;
|
||||
int maxHealth, health, itemHealth, defense, itemDefense, speed, itemSpeed, strength, itemDmg, maxMana, mana, itemMana;
|
||||
maxHealth = data.get(namespacedKey.maxHealth, PersistentDataType.INTEGER);
|
||||
health = data.get(namespacedKey.healthKey, PersistentDataType.INTEGER);
|
||||
itemHealth = data.get(namespacedKey.itemHealthKey, PersistentDataType.INTEGER);
|
||||
defense = data.get(namespacedKey.defenseKey, PersistentDataType.INTEGER);
|
||||
|
@ -25,11 +26,15 @@ public class Attributes {
|
|||
itemSpeed = data.get(namespacedKey.itemSpeedKey, PersistentDataType.INTEGER);
|
||||
strength = data.get(namespacedKey.strengthKey , PersistentDataType.INTEGER);
|
||||
itemDmg = data.get(namespacedKey.itemStrengthKey, PersistentDataType.INTEGER);
|
||||
return new Attribute(health, itemHealth, defense, itemDefense, speed, itemSpeed, strength, itemDmg);
|
||||
mana = data.get(namespacedKey.mana, PersistentDataType.INTEGER);
|
||||
itemMana = data.get(namespacedKey.itemMana, PersistentDataType.INTEGER);
|
||||
maxMana = data.get(namespacedKey.maxMana, PersistentDataType.INTEGER);
|
||||
return new Attribute(maxHealth, health, itemHealth, defense, itemDefense, speed, itemSpeed, strength, itemDmg, maxMana, mana, itemMana);
|
||||
}
|
||||
|
||||
public static void setAttributes(Player player, int health, int itemHealth, int defense, int itemDefense, int speed, int itemSpeed, int strength, int itemDmg) {
|
||||
public static void setAttributes(Player player, int maxHealth, int health, int itemHealth, int defense, int itemDefense, int speed, int itemSpeed, int strength, int itemDmg, int maxMana, int mana, int itemMana) {
|
||||
PersistentDataContainer data = player.getPersistentDataContainer();
|
||||
data.set(namespacedKey.maxHealth, PersistentDataType.INTEGER, maxHealth);
|
||||
data.set(namespacedKey.healthKey, PersistentDataType.INTEGER, health);
|
||||
data.set(namespacedKey.itemHealthKey, PersistentDataType.INTEGER, itemHealth);
|
||||
data.set(namespacedKey.defenseKey, PersistentDataType.INTEGER, defense);
|
||||
|
@ -38,6 +43,9 @@ public class Attributes {
|
|||
data.set(namespacedKey.itemSpeedKey, PersistentDataType.INTEGER, itemSpeed);
|
||||
data.set(namespacedKey.strengthKey , PersistentDataType.INTEGER, strength);
|
||||
data.set(namespacedKey.itemStrengthKey, PersistentDataType.INTEGER, itemDmg);
|
||||
data.set(namespacedKey.maxMana, PersistentDataType.INTEGER, maxMana);
|
||||
data.set(namespacedKey.mana, PersistentDataType.INTEGER, mana);
|
||||
data.set(namespacedKey.itemMana, PersistentDataType.INTEGER, itemMana);
|
||||
}
|
||||
|
||||
public void removeSpeed(Player player, int i) {
|
||||
|
@ -56,6 +64,20 @@ public class Attributes {
|
|||
PersistentDataContainer data = player.getPersistentDataContainer();
|
||||
data.set(namespacedKey.strengthKey, PersistentDataType.INTEGER, data.get(namespacedKey.strengthKey, PersistentDataType.INTEGER) -i);
|
||||
}
|
||||
public void removeMana(Player player, int i) {
|
||||
PersistentDataContainer data = player.getPersistentDataContainer();
|
||||
data.set(namespacedKey.mana, PersistentDataType.INTEGER, data.get(namespacedKey.mana, PersistentDataType.INTEGER) -i);
|
||||
}
|
||||
public void removeMaxMana(Player player, int i) {
|
||||
PersistentDataContainer data = player.getPersistentDataContainer();
|
||||
data.set(namespacedKey.maxMana, PersistentDataType.INTEGER, data.get(namespacedKey.maxMana, PersistentDataType.INTEGER) -i);
|
||||
}
|
||||
public void removeMaxHealth(Player player, int i) {
|
||||
PersistentDataContainer data = player.getPersistentDataContainer();
|
||||
data.set(namespacedKey.maxHealth, PersistentDataType.INTEGER, data.get(namespacedKey.maxHealth, PersistentDataType.INTEGER) -i);
|
||||
}
|
||||
|
||||
|
||||
|
||||
public void removeItemSpeed(Player player, int i) {
|
||||
PersistentDataContainer data = player.getPersistentDataContainer();
|
||||
|
@ -73,6 +95,11 @@ public class Attributes {
|
|||
PersistentDataContainer data = player.getPersistentDataContainer();
|
||||
data.set(namespacedKey.itemStrengthKey, PersistentDataType.INTEGER, data.get(namespacedKey.itemStrengthKey, PersistentDataType.INTEGER) -i);
|
||||
}
|
||||
public void removeItemMana(Player player, int i) {
|
||||
PersistentDataContainer data = player.getPersistentDataContainer();
|
||||
data.set(namespacedKey.itemMana, PersistentDataType.INTEGER, data.get(namespacedKey.itemMana, PersistentDataType.INTEGER) -i);
|
||||
}
|
||||
|
||||
|
||||
public void addSpeed(Player player, int i) {
|
||||
PersistentDataContainer data = player.getPersistentDataContainer();
|
||||
|
@ -90,6 +117,18 @@ public class Attributes {
|
|||
PersistentDataContainer data = player.getPersistentDataContainer();
|
||||
data.set(namespacedKey.strengthKey, PersistentDataType.INTEGER, data.get(namespacedKey.strengthKey, PersistentDataType.INTEGER) +i);
|
||||
}
|
||||
public void addMana(Player player, int i) {
|
||||
PersistentDataContainer data = player.getPersistentDataContainer();
|
||||
data.set(namespacedKey.mana, PersistentDataType.INTEGER, data.get(namespacedKey.mana, PersistentDataType.INTEGER) +i);
|
||||
}
|
||||
public void addMaxMana(Player player, int i) {
|
||||
PersistentDataContainer data = player.getPersistentDataContainer();
|
||||
data.set(namespacedKey.maxMana, PersistentDataType.INTEGER, data.get(namespacedKey.maxMana, PersistentDataType.INTEGER) +i);
|
||||
}
|
||||
public void addMaxHealth(Player player, int i) {
|
||||
PersistentDataContainer data = player.getPersistentDataContainer();
|
||||
data.set(namespacedKey.maxHealth, PersistentDataType.INTEGER, data.get(namespacedKey.maxHealth, PersistentDataType.INTEGER) +i);
|
||||
}
|
||||
|
||||
public void addItemSpeed(Player player, int i) {
|
||||
PersistentDataContainer data = player.getPersistentDataContainer();
|
||||
|
@ -107,6 +146,10 @@ public class Attributes {
|
|||
PersistentDataContainer data = player.getPersistentDataContainer();
|
||||
data.set(namespacedKey.itemStrengthKey, PersistentDataType.INTEGER, data.get(namespacedKey.itemStrengthKey, PersistentDataType.INTEGER) +i);
|
||||
}
|
||||
public void addItemMana(Player player, int i) {
|
||||
PersistentDataContainer data = player.getPersistentDataContainer();
|
||||
data.set(namespacedKey.itemMana, PersistentDataType.INTEGER, data.get(namespacedKey.itemMana, PersistentDataType.INTEGER) +i);
|
||||
}
|
||||
|
||||
public Integer getSpeed(Player player) {
|
||||
PersistentDataContainer data = player.getPersistentDataContainer();
|
||||
|
@ -124,6 +167,18 @@ public class Attributes {
|
|||
PersistentDataContainer data = player.getPersistentDataContainer();
|
||||
return data.get(namespacedKey.defenseKey, PersistentDataType.INTEGER);
|
||||
}
|
||||
public Integer getMana(Player player) {
|
||||
PersistentDataContainer data = player.getPersistentDataContainer();
|
||||
return data.get(namespacedKey.mana, PersistentDataType.INTEGER);
|
||||
}
|
||||
public Integer getMaxMana(Player player) {
|
||||
PersistentDataContainer data = player.getPersistentDataContainer();
|
||||
return data.get(namespacedKey.maxMana, PersistentDataType.INTEGER);
|
||||
}
|
||||
public Integer getMaxHealth(Player player) {
|
||||
PersistentDataContainer data = player.getPersistentDataContainer();
|
||||
return data.get(namespacedKey.maxHealth, PersistentDataType.INTEGER);
|
||||
}
|
||||
|
||||
public Integer getItemSpeed(Player player) {
|
||||
PersistentDataContainer data = player.getPersistentDataContainer();
|
||||
|
@ -141,6 +196,10 @@ public class Attributes {
|
|||
PersistentDataContainer data = player.getPersistentDataContainer();
|
||||
return data.get(namespacedKey.itemDefenseKey, PersistentDataType.INTEGER);
|
||||
}
|
||||
public Integer getItemMana(Player player) {
|
||||
PersistentDataContainer data = player.getPersistentDataContainer();
|
||||
return data.get(namespacedKey.itemMana, PersistentDataType.INTEGER);
|
||||
}
|
||||
|
||||
public void setHealth(Player player, int i) {
|
||||
PersistentDataContainer data = player.getPersistentDataContainer();
|
||||
|
@ -158,6 +217,18 @@ public class Attributes {
|
|||
PersistentDataContainer data = player.getPersistentDataContainer();
|
||||
data.set(namespacedKey.strengthKey, PersistentDataType.INTEGER, i);
|
||||
}
|
||||
public void setMana(Player player, int i) {
|
||||
PersistentDataContainer data = player.getPersistentDataContainer();
|
||||
data.set(namespacedKey.mana, PersistentDataType.INTEGER, i);
|
||||
}
|
||||
public void setMaxMana(Player player, int i) {
|
||||
PersistentDataContainer data = player.getPersistentDataContainer();
|
||||
data.set(namespacedKey.maxMana, PersistentDataType.INTEGER, i);
|
||||
}
|
||||
public void setMaxHealth(Player player, int i) {
|
||||
PersistentDataContainer data = player.getPersistentDataContainer();
|
||||
data.set(namespacedKey.maxHealth, PersistentDataType.INTEGER, i);
|
||||
}
|
||||
|
||||
public void setItemHealth(Player player, int i) {
|
||||
PersistentDataContainer data = player.getPersistentDataContainer();
|
||||
|
@ -175,4 +246,8 @@ public class Attributes {
|
|||
PersistentDataContainer data = player.getPersistentDataContainer();
|
||||
data.set(namespacedKey.itemStrengthKey, PersistentDataType.INTEGER, i);
|
||||
}
|
||||
public void setItemMana(Player player, int i) {
|
||||
PersistentDataContainer data = player.getPersistentDataContainer();
|
||||
data.set(namespacedKey.mana, PersistentDataType.INTEGER, i);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,20 +0,0 @@
|
|||
package gq.unurled.raxen.components.player;
|
||||
|
||||
import gq.unurled.raxen.components.player.Attributes.Attributes;
|
||||
|
||||
public class Profile {
|
||||
|
||||
private Attributes skils;
|
||||
|
||||
public Profile(Attributes skils) {
|
||||
this.skils = skils;
|
||||
}
|
||||
|
||||
public Attributes getSkils() {
|
||||
return skils;
|
||||
}
|
||||
|
||||
public void setSkils(Attributes skils) {
|
||||
this.skils = skils;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,134 @@
|
|||
package gq.unurled.raxen.components.player;
|
||||
|
||||
import gq.unurled.raxen.Raxen;
|
||||
import gq.unurled.raxen.components.entity.EntityNamespacedKey;
|
||||
import gq.unurled.raxen.components.player.Attributes.Attribute;
|
||||
import gq.unurled.raxen.components.player.Attributes.Attributes;
|
||||
import gq.unurled.raxen.components.player.Storages.EnderChest;
|
||||
import gq.unurled.raxen.components.player.Storages.Inventory;
|
||||
import gq.unurled.raxen.utils.Items;
|
||||
import net.kyori.adventure.text.Component;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.inventory.InventoryType;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.persistence.PersistentDataContainer;
|
||||
import org.bukkit.persistence.PersistentDataType;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
import static gq.unurled.raxen.utils.Items.setItemsToInventory;
|
||||
import static gq.unurled.raxen.utils.Utils.debug;
|
||||
|
||||
public class RaxenPlayer {
|
||||
|
||||
private final Raxen main;
|
||||
private final Player player;
|
||||
private final EntityNamespacedKey namespacedKey;
|
||||
private final Attributes attributes;
|
||||
|
||||
private Boolean isRaxenPlayer;
|
||||
|
||||
private Attribute attribute;
|
||||
|
||||
private Storage storages;
|
||||
private Inventories inventory;
|
||||
|
||||
public RaxenPlayer(Raxen main, Player player) {
|
||||
this.main = main;
|
||||
this.player = player;
|
||||
this.namespacedKey = new EntityNamespacedKey(main);
|
||||
this.isRaxenPlayer = true;
|
||||
this.attributes = new Attributes(main);
|
||||
}
|
||||
|
||||
public Attribute createNewAttribute() {
|
||||
debug(main, "Created new Attribute");
|
||||
attributes.setAttributes(player, 100, 100,0,50,0,100,0,100,0, 100, 100, 0);
|
||||
return new Attribute(100,100,0,50,0,100,0,100,0, 100, 100, 0);
|
||||
}
|
||||
|
||||
public void setStorages(org.bukkit.inventory.Inventory inv, org.bukkit.inventory.Inventory ec) {
|
||||
setStorage(ec);
|
||||
setInventory(inv);
|
||||
}
|
||||
|
||||
public Storage getStorage() {
|
||||
PersistentDataContainer data = player.getPersistentDataContainer();
|
||||
String store = data.get(namespacedKey.storage, PersistentDataType.STRING);
|
||||
org.bukkit.inventory.Inventory ec = Bukkit.createInventory(null, 54, Component.text("Ender Chest"));
|
||||
ec = setItemsToInventory(Items.listItemStackDeserilize(store), ec);
|
||||
EnderChest ecc = new EnderChest(ec);
|
||||
Storage storage = new Storage(ecc);
|
||||
return storage;
|
||||
}
|
||||
|
||||
public Inventories getInventory() {
|
||||
PersistentDataContainer data = player.getPersistentDataContainer();
|
||||
String inv = data.get(namespacedKey.inventory, PersistentDataType.STRING);
|
||||
org.bukkit.inventory.Inventory invv = Bukkit.createInventory(player, InventoryType.PLAYER);
|
||||
invv = setItemsToInventory(Items.listItemStackDeserilize(inv), invv);
|
||||
gq.unurled.raxen.components.player.Storages.Inventory invvv = new gq.unurled.raxen.components.player.Storages.Inventory(invv);
|
||||
Inventories invvvv = new Inventories(invvv);
|
||||
return invvvv;
|
||||
}
|
||||
|
||||
public void setInventory(org.bukkit.inventory.Inventory inv) {
|
||||
PersistentDataContainer data = player.getPersistentDataContainer();
|
||||
List<String> listInv = new ArrayList<String>();
|
||||
Integer reverse = 0;
|
||||
for(ItemStack it : inv) {
|
||||
reverse = reverse + 1;
|
||||
if(it != null && it.getType() != Material.AIR) {
|
||||
String s = Items.itemStackSerilize(it, reverse);
|
||||
listInv.add(s);
|
||||
}
|
||||
}
|
||||
String invv = Items.listItemStackSerelize(listInv);
|
||||
this.inventory = new Inventories(new Inventory(inv));
|
||||
data.set(namespacedKey.inventory, PersistentDataType.STRING, invv);
|
||||
}
|
||||
|
||||
public void setStorage(org.bukkit.inventory.Inventory ec) {
|
||||
PersistentDataContainer data = player.getPersistentDataContainer();
|
||||
List<String> list = new ArrayList<String>();
|
||||
int reverse = 0;
|
||||
for(ItemStack it : ec) {
|
||||
reverse += 1;
|
||||
if(it != null) {
|
||||
String s = Items.itemStackSerilize(it, reverse);
|
||||
list.add(s);
|
||||
}
|
||||
}
|
||||
String store = Items.listItemStackSerelize(list);
|
||||
this.storages = new Storage(new EnderChest(ec));
|
||||
data.set(namespacedKey.storage, PersistentDataType.STRING, store);
|
||||
}
|
||||
|
||||
public Storage createStorage() {
|
||||
setStorage(Bukkit.createInventory(null, 54, Component.text("Ender Chest")));
|
||||
return getStorage();
|
||||
}
|
||||
|
||||
public Inventories createInventory() {
|
||||
setInventory(Bukkit.createInventory(null, InventoryType.PLAYER));
|
||||
return getInventory();
|
||||
}
|
||||
|
||||
public Boolean isRaxenPlayer() {
|
||||
return isRaxenPlayer;
|
||||
}
|
||||
|
||||
public void isRaxenPlayer(boolean player) {
|
||||
isRaxenPlayer = player;
|
||||
}
|
||||
|
||||
public Attribute getAttribute() {
|
||||
return attribute;
|
||||
}
|
||||
|
||||
public Attributes getAttributes() {
|
||||
return attributes;
|
||||
}
|
||||
}
|
|
@ -7,7 +7,7 @@ import gq.unurled.raxen.components.player.Attributes.Attributes;
|
|||
import gq.unurled.raxen.components.player.Inventories;
|
||||
import gq.unurled.raxen.components.player.Storage;
|
||||
import gq.unurled.raxen.components.player.Storages.EnderChest;
|
||||
import gq.unurled.raxen.manager.ProfileManager;
|
||||
import gq.unurled.raxen.manager.PlayerManager;
|
||||
import gq.unurled.raxen.manager.StorageManager;
|
||||
import gq.unurled.raxen.utils.Items;
|
||||
import gq.unurled.raxen.utils.MongoDB;
|
||||
|
@ -20,11 +20,14 @@ import org.bukkit.entity.Player;
|
|||
import org.bukkit.event.inventory.InventoryType;
|
||||
import org.bukkit.inventory.Inventory;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.inventory.PlayerInventory;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import static gq.unurled.raxen.utils.Items.listItemStackDeserilize;
|
||||
import static gq.unurled.raxen.utils.Items.setItemsToInventory;
|
||||
import static gq.unurled.raxen.utils.Utils.debug;
|
||||
import static gq.unurled.raxen.utils.Utils.warn;
|
||||
|
||||
|
@ -33,7 +36,7 @@ public class PlayerConfig {
|
|||
private static Raxen main;
|
||||
private MongoDB mongoDB;
|
||||
private MongoCollection<Document> mongoCollection;
|
||||
private static ProfileManager profileManager;
|
||||
private static PlayerManager playerManager;
|
||||
private static StorageManager sto;
|
||||
private Attributes attributes;
|
||||
|
||||
|
@ -42,7 +45,7 @@ public class PlayerConfig {
|
|||
sto = Raxen.getStorageManager();
|
||||
this.mongoDB = StorageManager.getMongo();
|
||||
this.mongoCollection = mongoDB.getMongoCollection();
|
||||
profileManager = Raxen.getProfileManager();
|
||||
playerManager = Raxen.getPlayerManager();
|
||||
this.attributes = new Attributes(main);
|
||||
}
|
||||
|
||||
|
@ -53,6 +56,7 @@ public class PlayerConfig {
|
|||
public void saveUsingMongoDB(Player player, Attributes attributes, String invstr, Integer reverse) {
|
||||
Document doc = new Document("uuid", player.getUniqueId().toString())
|
||||
.append("name", player.getName())
|
||||
.append("maxHealth", attributes.getMaxHealth(player))
|
||||
.append("health", attributes.getHealth(player))
|
||||
.append("itemHealth", attributes.getItemHealth(player))
|
||||
.append("defense", attributes.getDefense(player))
|
||||
|
@ -60,11 +64,14 @@ public class PlayerConfig {
|
|||
.append("speed", attributes.getSpeed(player))
|
||||
.append("itemSpeed", attributes.getItemSpeed(player))
|
||||
.append("strength", attributes.getStrength(player))
|
||||
.append("itemDmg", attributes.getItemStrength(player))
|
||||
.append("itemStrength", attributes.getItemStrength(player))
|
||||
.append("maxMana", attributes.getMaxMana(player))
|
||||
.append("mana", attributes.getMana(player))
|
||||
.append("itemMana", attributes.getItemMana(player))
|
||||
.append("inv", invstr);
|
||||
if (profileManager.getPlayerStorage(player.getUniqueId()) != null) {
|
||||
if(profileManager.getPlayerStorage(player.getUniqueId()).getEc() != null) {
|
||||
EnderChest ec = profileManager.getPlayerStorage(player.getUniqueId()).getEc();
|
||||
if (playerManager.getRaxenPlayer(player).getStorage() != null) {
|
||||
if(playerManager.getRaxenPlayer(player).getStorage().getEc() != null) {
|
||||
EnderChest ec = playerManager.getRaxenPlayer(player).getStorage().getEc();
|
||||
List<String> list = new ArrayList<String>();
|
||||
reverse = 0;
|
||||
for(ItemStack it : ec.getEc()) {
|
||||
|
@ -92,18 +99,22 @@ public class PlayerConfig {
|
|||
public void saveUsingYml(Player player, Attributes attributes, String invstr, Integer reverse) {
|
||||
FileConfiguration config = sto.createYml(player);
|
||||
config.set("name", player.getName());
|
||||
config.set("maxHealth", attributes.getMaxHealth(player));
|
||||
config.set("health", attributes.getHealth(player));
|
||||
config.set("itemHealth", attributes.getItemHealth(player));
|
||||
config.set("strength", attributes.getStrength(player));
|
||||
config.set("itemDmg", attributes.getItemStrength(player));
|
||||
config.set("itemStrength", attributes.getItemStrength(player));
|
||||
config.set("speed", attributes.getSpeed(player));
|
||||
config.set("itemSpeed", attributes.getItemSpeed(player));
|
||||
config.set("defense", attributes.getDefense(player));
|
||||
config.set("itemDefense", attributes.getItemDefense(player));
|
||||
config.set("maxMana", attributes.getMaxMana(player));
|
||||
config.set("mana", attributes.getMana(player));
|
||||
config.set("itemMana", attributes.getItemMana(player));
|
||||
config.set("inv", invstr);
|
||||
if (profileManager.getPlayerStorage(player.getUniqueId()) != null) {
|
||||
if(profileManager.getPlayerStorage(player.getUniqueId()).getEc() != null) {
|
||||
EnderChest ec = profileManager.getPlayerStorage(player.getUniqueId()).getEc();
|
||||
if (playerManager.getRaxenPlayer(player).getStorage() != null) {
|
||||
if(playerManager.getRaxenPlayer(player).getStorage().getEc() != null) {
|
||||
EnderChest ec = playerManager.getRaxenPlayer(player).getStorage().getEc();
|
||||
List<String> list = new ArrayList<String>();
|
||||
reverse = 0;
|
||||
for(ItemStack it : ec.getEc()) {
|
||||
|
@ -128,54 +139,53 @@ public class PlayerConfig {
|
|||
Document playerDoc = mongoCollection.find(Filters.eq("uuid", player.getUniqueId().toString())).first();
|
||||
if(playerDoc == null) {
|
||||
debug(main, "Intiatilising Data for Player: " + player.getName());
|
||||
profileManager.createNewProfile(player);
|
||||
profileManager.createNewStorage(player);
|
||||
profileManager.createNewInventory(player);
|
||||
playerManager.getRaxenPlayer(player).createNewAttribute();
|
||||
playerManager.getRaxenPlayer(player).createStorage();
|
||||
playerManager.getRaxenPlayer(player).createInventory();
|
||||
return;
|
||||
}
|
||||
debug(main, "Loading " + player.getName() + "'s data!");
|
||||
attributes.setAttributes(player, playerDoc.getInteger("health"), playerDoc.getInteger("itemHealth"), playerDoc.getInteger("defense"),
|
||||
attributes.setAttributes(player, playerDoc.getInteger("maxHealth"), playerDoc.getInteger("health"), playerDoc.getInteger("itemHealth"), playerDoc.getInteger("defense"),
|
||||
playerDoc.getInteger("itemDefense"), playerDoc.getInteger("speed"), playerDoc.getInteger("itemSpeed"),
|
||||
playerDoc.getInteger("strength"), playerDoc.getInteger("itemDmg"));
|
||||
|
||||
playerDoc.getInteger("strength"), playerDoc.getInteger("itemStrength"),
|
||||
playerDoc.getInteger("maxMana"), playerDoc.getInteger("mana"), playerDoc.getInteger("itemMana"));
|
||||
Inventory ec = Bukkit.createInventory(null, 54, Component.text("Ender Chest"));
|
||||
if(playerDoc.getString("ec") != null) {
|
||||
ItemStack[] itList = Items.listItemStackDeserilize(playerDoc.getString("ec"));
|
||||
ec.addItem(itList);
|
||||
ec = setItemsToInventory(listItemStackDeserilize(playerDoc.getString("ec")), ec);
|
||||
}
|
||||
EnderChest ecc = new EnderChest(ec);
|
||||
Storage storage = new Storage(ecc);
|
||||
profileManager.setPlayerStorage(player.getUniqueId(), storage);
|
||||
Inventory inv = Bukkit.createInventory(player, InventoryType.PLAYER);
|
||||
ItemStack[] itListInv = Items.listItemStackDeserilize(playerDoc.getString("inv"));
|
||||
inv.addItem(itListInv);
|
||||
playerManager.getRaxenPlayer(player).setStorage(ec);
|
||||
PlayerInventory inv = player.getInventory();
|
||||
inv = setItemsToInventory(listItemStackDeserilize(playerDoc.getString("inv")), inv);
|
||||
player.getInventory().setContents(inv.getContents());
|
||||
player.updateInventory();
|
||||
gq.unurled.raxen.components.player.Storages.Inventory invv = new gq.unurled.raxen.components.player.Storages.Inventory(inv);
|
||||
Inventories invvv = new Inventories(invv);
|
||||
profileManager.setPlayerInventory(player.getUniqueId(), invvv);
|
||||
playerManager.getRaxenPlayer(player).setInventory(inv);
|
||||
}
|
||||
|
||||
public void loadUsingYml(Player player) throws IOException {
|
||||
FileConfiguration config = sto.createYml(player);
|
||||
attributes.setAttributes(player, config.getInt("health"), config.getInt("itemHealth"),
|
||||
attributes.setAttributes(player, config.getInt("maxHealth"), config.getInt("health"), config.getInt("itemHealth"),
|
||||
config.getInt("defense"), config.getInt("itemDefense"),
|
||||
config.getInt("speed"), config.getInt("itemSpeed"),
|
||||
config.getInt("strength"), config.getInt("itemDmg"));
|
||||
config.getInt("strength"), config.getInt("itemStrength"),
|
||||
config.getInt("maxMana"), config.getInt("mana"), config.getInt("itemMana"));
|
||||
Inventory ec = Bukkit.createInventory(null, 54, Component.text("Ender Chest"));
|
||||
if((String) config.get("ec") != null) {
|
||||
ItemStack[] itList = Items.listItemStackDeserilize((String) config.get("ec"));
|
||||
ec.addItem(itList);
|
||||
ec = setItemsToInventory(listItemStackDeserilize((String) config.get("ec")), ec);
|
||||
}
|
||||
EnderChest ecc = new EnderChest(ec);
|
||||
Storage storage = new Storage(ecc);
|
||||
profileManager.setPlayerStorage(player.getUniqueId(), storage);
|
||||
playerManager.getRaxenPlayer(player).setStorage(ec);
|
||||
Inventory inv = Bukkit.createInventory(player, InventoryType.PLAYER);
|
||||
ItemStack[] itListInv = Items.listItemStackDeserilize((String) config.getString("inv"));
|
||||
inv.addItem(itListInv);
|
||||
inv = setItemsToInventory(listItemStackDeserilize((String) config.getString("inv")), inv);
|
||||
player.getInventory().setContents(inv.getContents());
|
||||
player.updateInventory();
|
||||
gq.unurled.raxen.components.player.Storages.Inventory invv = new gq.unurled.raxen.components.player.Storages.Inventory(inv);
|
||||
Inventories invvv = new Inventories(invv);
|
||||
profileManager.setPlayerInventory(player.getUniqueId(), invvv);
|
||||
playerManager.getRaxenPlayer(player).setInventory(inv);
|
||||
}
|
||||
|
||||
public void savePlayerConfig(Player player) {
|
||||
|
|
|
@ -3,7 +3,6 @@ package gq.unurled.raxen.listener.entity;
|
|||
import gq.unurled.raxen.Raxen;
|
||||
import gq.unurled.raxen.components.entity.EntityNamespacedKey;
|
||||
import gq.unurled.raxen.components.items.Attributes;
|
||||
import gq.unurled.raxen.manager.ProfileManager;
|
||||
import gq.unurled.raxen.utils.Items;
|
||||
import org.bukkit.attribute.Attribute;
|
||||
import org.bukkit.entity.Entity;
|
||||
|
@ -19,13 +18,12 @@ import org.bukkit.persistence.PersistentDataType;
|
|||
import static gq.unurled.raxen.utils.Utils.debug;
|
||||
|
||||
public class DamageEntity implements Listener {
|
||||
|
||||
private Raxen main;
|
||||
private ProfileManager profileManager;
|
||||
private EntityNamespacedKey entityNamespacedKey;
|
||||
|
||||
public DamageEntity(Raxen main) {
|
||||
this.main = main;
|
||||
this.profileManager = main.getProfileManager();
|
||||
this.entityNamespacedKey = new EntityNamespacedKey(main);
|
||||
}
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
package gq.unurled.raxen.listener.entity;
|
||||
|
||||
import gq.unurled.raxen.Raxen;
|
||||
import gq.unurled.raxen.components.entity.Entity;
|
||||
import gq.unurled.raxen.components.entity.EntityUtils;
|
||||
import gq.unurled.raxen.components.entity.EntityNamespacedKey;
|
||||
import org.bukkit.entity.EntityType;
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
|
@ -16,12 +16,12 @@ import static gq.unurled.raxen.utils.Utils.debug;
|
|||
public class SpawnEvent implements Listener {
|
||||
|
||||
private Raxen main;
|
||||
private gq.unurled.raxen.components.entity.Entity entity;
|
||||
private EntityUtils entityUtils;
|
||||
private EntityNamespacedKey namespacedKey;
|
||||
|
||||
public SpawnEvent(Raxen main) {
|
||||
this.main = main;
|
||||
this.entity = new Entity(main);
|
||||
this.entityUtils = new EntityUtils(main);
|
||||
this.namespacedKey = new EntityNamespacedKey(main);
|
||||
}
|
||||
|
||||
|
@ -33,9 +33,9 @@ public class SpawnEvent implements Listener {
|
|||
} else if (e.getEntity().getType() != EntityType.DROPPED_ITEM) {
|
||||
debug(main, e.getEntity().getName());
|
||||
if (!e.getEntity().getPersistentDataContainer().has(namespacedKey.nameKey, PersistentDataType.STRING)) {
|
||||
entity.setNameSpacedKeys(e.getEntity(), e.getEntityType().name(), 1, 10, 0, 50, 0, 100, 0, 100, 0);
|
||||
entityUtils.setNameSpacedKeys(e.getEntity(), e.getEntityType().name(), 1, 10, 0, 50, 0, 100, 0, 100, 0);
|
||||
}
|
||||
entity.updateSkills((LivingEntity) e.getEntity());
|
||||
entityUtils.updateSkills((LivingEntity) e.getEntity());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -4,7 +4,6 @@ import com.destroystokyo.paper.event.player.PlayerArmorChangeEvent;
|
|||
import de.tr7zw.changeme.nbtapi.NBTItem;
|
||||
import gq.unurled.raxen.Raxen;
|
||||
import gq.unurled.raxen.components.player.Attributes.Attributes;
|
||||
import gq.unurled.raxen.manager.ProfileManager;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
|
@ -13,12 +12,10 @@ import org.bukkit.inventory.ItemStack;
|
|||
|
||||
public class ArmorEvent implements Listener {
|
||||
|
||||
private ProfileManager profileManager;
|
||||
private Raxen main;
|
||||
|
||||
public ArmorEvent(Raxen main) {
|
||||
this.main = main;
|
||||
this.profileManager = main.getProfileManager();
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
|
|
|
@ -3,7 +3,6 @@ package gq.unurled.raxen.listener.player;
|
|||
import de.tr7zw.changeme.nbtapi.NBTItem;
|
||||
import gq.unurled.raxen.Raxen;
|
||||
import gq.unurled.raxen.components.player.Attributes.Attributes;
|
||||
import gq.unurled.raxen.manager.ProfileManager;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
|
@ -13,12 +12,10 @@ import org.bukkit.inventory.ItemStack;
|
|||
|
||||
public class ItemHandEvent implements Listener {
|
||||
|
||||
private ProfileManager profileManager;
|
||||
private Raxen main;
|
||||
|
||||
public ItemHandEvent(Raxen main) {
|
||||
this.main = main;
|
||||
this.profileManager = main.getProfileManager();
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
|
|
|
@ -4,7 +4,7 @@ import gq.unurled.raxen.Raxen;
|
|||
import gq.unurled.raxen.components.player.Scoreboard;
|
||||
import gq.unurled.raxen.components.resourcepack.ResourcePack;
|
||||
import gq.unurled.raxen.config.PlayerConfig;
|
||||
import gq.unurled.raxen.manager.ProfileManager;
|
||||
import gq.unurled.raxen.manager.PlayerManager;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.Listener;
|
||||
|
@ -13,17 +13,17 @@ import org.bukkit.event.player.PlayerJoinEvent;
|
|||
public class JoinEvent implements Listener {
|
||||
|
||||
private Raxen main;
|
||||
private ProfileManager profileManager;
|
||||
private PlayerConfig playerConfig;
|
||||
private Scoreboard scoreboard;
|
||||
private ResourcePack resourcePack;
|
||||
private PlayerManager playerManager;
|
||||
|
||||
public JoinEvent(Raxen main) {
|
||||
this.main = main;
|
||||
this.profileManager = main.getProfileManager();
|
||||
this.playerConfig = main.getPlayerConfig();
|
||||
this.scoreboard = new Scoreboard(main);
|
||||
this.resourcePack = main.getResourcePackManager().getResourcePack();
|
||||
this.playerManager = main.getPlayerManager();
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
|
@ -32,6 +32,8 @@ public class JoinEvent implements Listener {
|
|||
playerConfig.loadPlayerConfig(player);
|
||||
scoreboard.createScorebord(player);
|
||||
resourcePack.join(player);
|
||||
playerManager.getRaxenPlayer(player).isRaxenPlayer(true);
|
||||
playerManager.registerActionBar(player);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -2,7 +2,7 @@ package gq.unurled.raxen.listener.player;
|
|||
|
||||
import gq.unurled.raxen.Raxen;
|
||||
import gq.unurled.raxen.config.PlayerConfig;
|
||||
import gq.unurled.raxen.manager.ProfileManager;
|
||||
import gq.unurled.raxen.manager.PlayerManager;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.Listener;
|
||||
|
@ -13,15 +13,19 @@ import java.io.IOException;
|
|||
public class LeaveEvent implements Listener {
|
||||
|
||||
private final PlayerConfig playerConfig;
|
||||
private PlayerManager playerManager;
|
||||
|
||||
public LeaveEvent(Raxen main) {
|
||||
ProfileManager profileManager = main.getProfileManager();
|
||||
this.playerConfig = main.getPlayerConfig();
|
||||
this.playerManager = main.getPlayerManager();
|
||||
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void PlayerLeaveEvent(PlayerQuitEvent e) throws IOException {
|
||||
Player player = e.getPlayer();
|
||||
playerConfig.savePlayerConfig(player);
|
||||
playerManager.getRaxenPlayer(player).isRaxenPlayer(false);
|
||||
playerManager.unregisterActionBar(player);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -6,11 +6,14 @@ import lombok.Setter;
|
|||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.configuration.file.FileConfiguration;
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.entity.EntityType;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import static gq.unurled.raxen.utils.Utils.debug;
|
||||
|
||||
public class EntityManager {
|
||||
|
||||
private Raxen main;
|
||||
|
@ -26,10 +29,10 @@ public class EntityManager {
|
|||
|
||||
}
|
||||
|
||||
public void registerEntityFromConfig(FileConfiguration config) {
|
||||
World world = Bukkit.getWorld(config.getString("world"));
|
||||
String name = config.getString("name");
|
||||
|
||||
public void registerEntityFromConfig(FileConfiguration file) {
|
||||
debug(main, (String) file.get("id"));
|
||||
World world = Bukkit.getWorld(file.getString("world"));
|
||||
String name = file.getString("name");
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -2,6 +2,7 @@ package gq.unurled.raxen.manager;
|
|||
|
||||
import de.tr7zw.changeme.nbtapi.NBTItem;
|
||||
import gq.unurled.raxen.Raxen;
|
||||
import gq.unurled.raxen.components.items.NBT;
|
||||
import lombok.Getter;
|
||||
import net.kyori.adventure.text.Component;
|
||||
import org.bukkit.Material;
|
||||
|
@ -25,6 +26,7 @@ public class ItemManager {
|
|||
private final Raxen main;
|
||||
@Getter
|
||||
private List<ItemStack> list = new ArrayList<>();
|
||||
private NBT nbt = new NBT();
|
||||
|
||||
public ItemManager(Raxen main) {
|
||||
this.main = main;
|
||||
|
@ -118,12 +120,12 @@ public class ItemManager {
|
|||
itm.lore(lore);
|
||||
it.setItemMeta(itm);
|
||||
NBTItem nbti = new NBTItem(it);
|
||||
nbti.setInteger("SPEED", file.getInt("speed"));
|
||||
nbti.setInteger("HEALTH", file.getInt("health"));
|
||||
nbti.setInteger("DEFENSE", file.getInt("defense"));
|
||||
nbti.setInteger("STRENGTH", file.getInt("strength"));
|
||||
nbti.setString("ID", file.getString("customId"));
|
||||
nbti.setString("CUSTOM_ABILITY", file.getString("custom_ability"));
|
||||
nbti.setInteger(NBT.SPEED, file.getInt("speed"));
|
||||
nbti.setInteger(NBT.HEALTH, file.getInt("health"));
|
||||
nbti.setInteger(NBT.DEFENSE, file.getInt("defense"));
|
||||
nbti.setInteger(NBT.STRENGTH, file.getInt("strength"));
|
||||
nbti.setString(NBT.ID, file.getString("customId"));
|
||||
nbti.setString(NBT.CUSTOM_ABILITY, file.getString("custom_ability"));
|
||||
it = nbti.getItem();
|
||||
it = setLoreFromNBT(it);
|
||||
list.add(it);
|
||||
|
|
|
@ -1,12 +1,50 @@
|
|||
package gq.unurled.raxen.manager;
|
||||
|
||||
import gq.unurled.raxen.Raxen;
|
||||
import gq.unurled.raxen.components.player.Attributes.Attribute;
|
||||
import gq.unurled.raxen.components.player.Attributes.Attributes;
|
||||
import gq.unurled.raxen.components.player.RaxenPlayer;
|
||||
import net.kyori.adventure.text.Component;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.scheduler.BukkitRunnable;
|
||||
import org.bukkit.scheduler.BukkitTask;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.UUID;
|
||||
|
||||
public class PlayerManager {
|
||||
|
||||
private Raxen main;
|
||||
private HashMap<UUID, BukkitTask> actionBar = new HashMap<>();
|
||||
|
||||
public PlayerManager(Raxen main) {
|
||||
this.main = main;
|
||||
}
|
||||
|
||||
public RaxenPlayer getRaxenPlayer(Player player) {
|
||||
return new RaxenPlayer(main, player);
|
||||
}
|
||||
|
||||
public void registerActionBar(Player player) {
|
||||
Attribute attributes = getRaxenPlayer(player).getAttributes().getAttribute(player);
|
||||
BukkitTask task = new BukkitRunnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
player.sendActionBar(Component.text(attributes.getHealth() + "/" + attributes.getMaxHealth() + "❤ " + attributes.getMana() + "/" + attributes.getMaxMana()));
|
||||
}
|
||||
}.runTaskTimer(main, 0L, 20L);
|
||||
if(actionBar.containsKey(player.getUniqueId())) {
|
||||
actionBar.replace(player.getUniqueId(), task);
|
||||
} else {
|
||||
actionBar.put(player.getUniqueId(), task);
|
||||
}
|
||||
}
|
||||
|
||||
public void unregisterActionBar(Player player) {
|
||||
if(actionBar.containsKey(player.getUniqueId())) {
|
||||
BukkitTask task = actionBar.get(player.getUniqueId());
|
||||
task.cancel();
|
||||
actionBar.remove(player.getUniqueId());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,83 +0,0 @@
|
|||
package gq.unurled.raxen.manager;
|
||||
|
||||
import gq.unurled.raxen.Raxen;
|
||||
import gq.unurled.raxen.components.entity.EntityNamespacedKey;
|
||||
import gq.unurled.raxen.components.player.Attributes.Attribute;
|
||||
import gq.unurled.raxen.components.player.Attributes.Attributes;
|
||||
import gq.unurled.raxen.components.player.Inventories;
|
||||
import gq.unurled.raxen.components.player.Storage;
|
||||
import gq.unurled.raxen.components.player.Storages.EnderChest;
|
||||
import gq.unurled.raxen.components.player.Storages.Inventory;
|
||||
import net.kyori.adventure.text.Component;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.inventory.InventoryType;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.UUID;
|
||||
|
||||
import static gq.unurled.raxen.utils.Utils.debug;
|
||||
|
||||
public class ProfileManager {
|
||||
|
||||
private Raxen main;
|
||||
private EntityNamespacedKey namespacedKey;
|
||||
private Map<UUID, Storage> storages = new HashMap<>();
|
||||
private Map<UUID, Inventories> inventory = new HashMap<>();
|
||||
private Attributes attributes;
|
||||
|
||||
public ProfileManager(Raxen main) {
|
||||
this.main = main;
|
||||
this.namespacedKey = new EntityNamespacedKey(main);
|
||||
this.attributes = new Attributes(main);
|
||||
}
|
||||
|
||||
public Attribute createNewProfile(Player player) {
|
||||
attributes.setAttributes(player, 100,0,50,0,100,0,100,0);
|
||||
return new Attribute(100,0,50,0,100,0,100,0);
|
||||
}
|
||||
|
||||
public Storage createNewStorage(Player player) {
|
||||
EnderChest ec = new EnderChest(Bukkit.createInventory(null, 54, Component.text("Ender Chest")));
|
||||
Storage storage = new Storage(ec);
|
||||
storages.put(player.getUniqueId(), storage);
|
||||
return storage;
|
||||
}
|
||||
|
||||
public Storage getPlayerStorage(UUID uuid) {
|
||||
return storages.get(uuid);
|
||||
}
|
||||
|
||||
public void setPlayerStorage(UUID uuid, Storage storage) {
|
||||
if(storages.get(uuid) == null) {
|
||||
storages.put(uuid, storage);
|
||||
}
|
||||
else {
|
||||
storages.replace(uuid, storage);
|
||||
}
|
||||
debug(main, "Storage Updated!");
|
||||
}
|
||||
|
||||
public Inventories createNewInventory(Player player) {
|
||||
Inventory inv = new Inventory(Bukkit.createInventory(null, InventoryType.PLAYER));
|
||||
Inventories inves = new Inventories(inv);
|
||||
inventory.put(player.getUniqueId(), inves);
|
||||
return inves;
|
||||
}
|
||||
|
||||
public Inventories getPlayerInventory(UUID uuid) {
|
||||
return inventory.get(uuid);
|
||||
}
|
||||
|
||||
public void setPlayerInventory(UUID uuid, Inventories inventories) {
|
||||
if(inventory.get(uuid) == null) {
|
||||
inventory.put(uuid, inventories);
|
||||
}
|
||||
else {
|
||||
inventory.replace(uuid, inventories);
|
||||
}
|
||||
debug(main, "Inventory Updated!");
|
||||
}
|
||||
|
||||
}
|
|
@ -9,15 +9,10 @@ import net.kyori.adventure.text.Component;
|
|||
import org.bukkit.Material;
|
||||
import org.bukkit.enchantments.Enchantment;
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
import org.bukkit.inventory.EntityEquipment;
|
||||
import org.bukkit.inventory.ItemFlag;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.inventory.*;
|
||||
import org.bukkit.inventory.meta.ItemMeta;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.*;
|
||||
|
||||
import static gq.unurled.raxen.utils.Utils.color;
|
||||
import static gq.unurled.raxen.utils.Utils.error;
|
||||
|
@ -90,6 +85,14 @@ public class Items {
|
|||
}
|
||||
}
|
||||
|
||||
public static class itemStackListDeserilize {
|
||||
HashMap<Integer, ItemStack> inv;
|
||||
|
||||
public itemStackListDeserilize(HashMap<Integer, ItemStack> inv) {
|
||||
this.inv = inv;
|
||||
}
|
||||
}
|
||||
|
||||
public static itemStackDeserilizeResult itemStackDeserilize(String str) {
|
||||
List<String> mapp = Arrays.asList(str.split("@#NBT#"));
|
||||
Gson gson = new Gson();
|
||||
|
@ -142,23 +145,43 @@ public class Items {
|
|||
return str;
|
||||
}
|
||||
|
||||
public static ItemStack[] listItemStackDeserilize(String str) {
|
||||
public static HashMap<Integer, ItemStack> listItemStackDeserilize(String str) {
|
||||
Gson gson = new Gson();
|
||||
List<String> map = Arrays.asList(str.split("@#NEW_ITEM#"));
|
||||
HashMap<Integer, ItemStack> inv = new HashMap<>();
|
||||
ArrayList<ItemStack> items = new ArrayList<ItemStack>();
|
||||
for(String s : map) {
|
||||
ItemStack itt;
|
||||
Integer slot;
|
||||
if(s != null) {
|
||||
itt = itemStackDeserilize(s).it;
|
||||
itemStackDeserilizeResult itm = itemStackDeserilize(s);
|
||||
itt = itm.it;
|
||||
if (itt != null && itt.getType() != Material.AIR) {
|
||||
items.add(itt);
|
||||
}
|
||||
slot = itm.slot;
|
||||
inv.put(slot, itt);
|
||||
}
|
||||
}
|
||||
ItemStack[] it = items.toArray(new ItemStack[0]);
|
||||
return it;
|
||||
return inv;
|
||||
}
|
||||
|
||||
public static Inventory setItemsToInventory(HashMap<Integer, ItemStack> list, Inventory inv) {
|
||||
for (Map.Entry<Integer, ItemStack> entry : list.entrySet()) {
|
||||
inv.setItem(entry.getKey(), entry.getValue());
|
||||
}
|
||||
return inv;
|
||||
}
|
||||
|
||||
public static PlayerInventory setItemsToInventory(HashMap<Integer, ItemStack> list, PlayerInventory inv) {
|
||||
for (Map.Entry<Integer, ItemStack> entry : list.entrySet()) {
|
||||
inv.setItem(entry.getKey(), entry.getValue());
|
||||
}
|
||||
return inv;
|
||||
}
|
||||
|
||||
|
||||
public static String attributes(String str) {
|
||||
String stt = "";
|
||||
if(str.contains("SPEED")) {
|
||||
|
|
Loading…
Reference in a new issue