make some changes on classes, not groundbreaking
This commit is contained in:
parent
7277e41c56
commit
e0bccb9e72
7 changed files with 58 additions and 63 deletions
|
@ -39,11 +39,16 @@ public class SpawnEntity implements TabExecutor {
|
|||
return false;
|
||||
}
|
||||
//example command : /entityspawn ZOMBIE "&cHello folks" 50 200
|
||||
EntityType types = EntityType.valueOf(args[0]);
|
||||
Entity e = player.getWorld().spawnEntity(player.getLocation(), types, false);
|
||||
setNameSpacedKeys(e, "<red>Name", 100, 100,0,50,0,100,0,100,0);
|
||||
e.customName(colorTextComp(args[1]));
|
||||
e.setCustomNameVisible(true);
|
||||
try {
|
||||
EntityType types = EntityType.valueOf(args[0]);
|
||||
Entity e = player.getWorld().spawnEntity(player.getLocation(), types, false);
|
||||
setNameSpacedKeys(e, "<red>Name", 100, 100,0,50,0,100,0,100,0);
|
||||
e.customName(colorTextComp(args[1]));
|
||||
e.setCustomNameVisible(true);
|
||||
} catch (IllegalArgumentException e) {
|
||||
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
@ -1,22 +1,31 @@
|
|||
package me.unurled.raxen.commands.player;
|
||||
|
||||
import me.unurled.raxen.Raxen;
|
||||
import me.unurled.raxen.components.entity.player.classes.Class;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.command.TabExecutor;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.inventory.Inventory;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
|
||||
import static me.unurled.raxen.utils.Utils.colorTextComp;
|
||||
import static me.unurled.raxen.utils.Utils.error;
|
||||
|
||||
public class ClassCommand implements TabExecutor {
|
||||
|
||||
private Raxen main;
|
||||
|
||||
/**
|
||||
* the Command to choose the class
|
||||
* @param main
|
||||
*/
|
||||
public ClassCommand(Raxen main) {
|
||||
this.main = main;
|
||||
}
|
||||
|
@ -28,6 +37,17 @@ public class ClassCommand implements TabExecutor {
|
|||
return true;
|
||||
}
|
||||
Player player = (Player) sender;
|
||||
Inventory inv = Bukkit.createInventory(null, 9, colorTextComp("<grey>Choose your class</grey>"));
|
||||
HashMap<String, Class> classes = main.getManager().getPlayerManager().getClasses();
|
||||
if (classes.size() > 10) {
|
||||
if (classes.size() > 55) {
|
||||
inv = Bukkit.createInventory(null, classes.size(), colorTextComp("<grey>Choose your class</grey>"));
|
||||
}
|
||||
}
|
||||
for (Class clas : classes.values()) {
|
||||
ItemStack item = clas.getPlaceHolder();
|
||||
inv.addItem(item);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
@ -45,7 +45,7 @@ public class Dungeon {
|
|||
|
||||
/**
|
||||
* Generate the Gate and make it available to players in the world.
|
||||
* TODO: Place the gate at a random place.
|
||||
* //TODO: Place the gate at a random place.
|
||||
*/
|
||||
public void generateGate() {
|
||||
// -281.50 36.00 187.50
|
||||
|
@ -55,7 +55,7 @@ public class Dungeon {
|
|||
}
|
||||
|
||||
/**
|
||||
* TODO: Terrain Generation of the inside of the Dungeons
|
||||
* //TODO: Terrain Generation of the inside of the Dungeons
|
||||
*/
|
||||
public void generate() {
|
||||
Raxen main = (Raxen) Bukkit.getPluginManager().getPlugin("Raxen");
|
||||
|
|
|
@ -26,4 +26,12 @@ public class Class {
|
|||
this.placeHolder.getItemMeta().displayName(colorTextComp(colorName));
|
||||
this.max_level = max_level;
|
||||
}
|
||||
|
||||
public Class(String name, String colorName, String ID, ItemStack itemPlaceHolder, Integer max_level) {
|
||||
this.name = name;
|
||||
this.ID = ID;
|
||||
this.placeHolder = itemPlaceHolder;
|
||||
this.placeHolder.getItemMeta().displayName(colorTextComp(colorName));
|
||||
this.max_level = max_level;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -3,61 +3,21 @@ package me.unurled.raxen.components.entity.player.classes;
|
|||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import me.unurled.raxen.Raxen;
|
||||
import me.unurled.raxen.manager.entity.PlayerManager;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.configuration.InvalidConfigurationException;
|
||||
import org.bukkit.configuration.file.FileConfiguration;
|
||||
import org.bukkit.configuration.file.YamlConfiguration;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.util.HashMap;
|
||||
import me.unurled.raxen.components.entity.player.classes.list.Assassin;
|
||||
|
||||
import static me.unurled.raxen.utils.Utils.debug;
|
||||
import static me.unurled.raxen.utils.Utils.error;
|
||||
|
||||
public class Classes {
|
||||
|
||||
private final Raxen main;
|
||||
@Getter
|
||||
private HashMap<String, Class> classes = new HashMap<>();
|
||||
|
||||
public Classes(Raxen main) {
|
||||
this.main = main;
|
||||
register();
|
||||
}
|
||||
|
||||
public void register() {
|
||||
File folder = new File(main.getDataFolder() + "/Class/");
|
||||
File[] listFile = folder.listFiles();
|
||||
PlayerManager pm = main.getManager().getPlayerManager();
|
||||
for (int i = 0; i < listFile.length; i++) {
|
||||
if (listFile[i].isFile()) {
|
||||
FileConfiguration customClass = new YamlConfiguration();
|
||||
try {
|
||||
customClass.load(listFile[i]);
|
||||
} catch (IOException | InvalidConfigurationException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
resultClass cla = registerClass(customClass);
|
||||
pm.addClasses(cla.getClas(), cla.getId());
|
||||
} else if (listFile[i].isDirectory()) {
|
||||
for (int a = 0; a < listFile[i].listFiles().length; a++) {
|
||||
if(listFile[i].listFiles()[a].isFile()) {
|
||||
FileConfiguration customClass = new YamlConfiguration();
|
||||
try {
|
||||
customClass.load(listFile[i].listFiles()[a]);
|
||||
} catch (IOException | InvalidConfigurationException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
resultClass cla = registerClass(customClass);
|
||||
pm.addClasses(cla.getClas(), cla.getId());
|
||||
} else if (listFile[i].listFiles()[a].isDirectory()) {
|
||||
error((Raxen) Bukkit.getPluginManager().getPlugin("Raxen"),"Can't use more than 2 folder to get Class.yml");
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
registerClass(new Assassin());
|
||||
}
|
||||
|
||||
public class resultClass {
|
||||
|
@ -73,15 +33,8 @@ public class Classes {
|
|||
}
|
||||
}
|
||||
|
||||
public resultClass registerClass(FileConfiguration file) {
|
||||
String id = file.getString("id");
|
||||
debug(id);
|
||||
return new resultClass(new Class(file.getString("name"), file.getString("color-name"), id, file.getString("item_placeholder"), file.getInt("max_level")), id);
|
||||
}
|
||||
|
||||
public void registerClass(Class clas) {
|
||||
debug(clas.getID());
|
||||
resultClass result = new resultClass(clas, clas.getID());
|
||||
classes.put(result.getId(), result.getClas());
|
||||
main.getManager().getPlayerManager().addClasses(clas, clas.getID());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,9 +1,12 @@
|
|||
package me.unurled.raxen.components.entity.player.classes.list;
|
||||
|
||||
import me.unurled.raxen.components.entity.player.classes.Class;
|
||||
import me.unurled.raxen.components.items.custom.weapon.Dager;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
public class Assassin {
|
||||
public class Assassin extends Class {
|
||||
|
||||
String ID = "ASSASSIN";
|
||||
String name = "Assassin";
|
||||
String colorName = "<red>Assassin";
|
||||
|
@ -12,8 +15,13 @@ public class Assassin {
|
|||
ItemStack placeHolder;
|
||||
|
||||
public Assassin() {
|
||||
super("Assassin", "<red>Assassin", "ASSASSIN", new ItemStack(Material.AIR), 100);
|
||||
Dager dager = new Dager();
|
||||
dager.buildItem();
|
||||
placeHolder = dager.getDager();
|
||||
}
|
||||
|
||||
public Assassin(String name, String colorName, String ID, String itemPlaceHolder, Integer max_level) {
|
||||
super(name, colorName, ID, itemPlaceHolder, max_level);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -6,6 +6,7 @@ import me.unurled.raxen.components.entity.Attributes.*;
|
|||
import me.unurled.raxen.components.entity.other.EntityNamespacedKey;
|
||||
import me.unurled.raxen.components.entity.player.RaxenPlayer;
|
||||
import me.unurled.raxen.components.entity.player.classes.Class;
|
||||
import me.unurled.raxen.components.entity.player.classes.Classes;
|
||||
import net.kyori.adventure.text.Component;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.scheduler.BukkitRunnable;
|
||||
|
@ -18,10 +19,14 @@ public class PlayerManager {
|
|||
|
||||
private Raxen main;
|
||||
private HashMap<UUID, BukkitTask> actionBar = new HashMap<>();
|
||||
//TODO: player classes
|
||||
private HashMap<String, Class> classes = new HashMap<>();
|
||||
@Getter
|
||||
private HashMap<String, me.unurled.raxen.components.entity.Attributes.Attribute> attribute = new HashMap<>();
|
||||
|
||||
|
||||
private Classes classesRegister;
|
||||
|
||||
// Attributes
|
||||
private Defense defense;
|
||||
private Health health;
|
||||
|
@ -81,10 +86,6 @@ public class PlayerManager {
|
|||
public void unRegisterRaxenPlayer(Player player) {
|
||||
}
|
||||
|
||||
public void registerClasses() {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* getClasses
|
||||
* @return the classes HashMap
|
||||
|
|
Loading…
Reference in a new issue