some change, not much for now
This commit is contained in:
parent
f6a41fafb9
commit
499aeaf2b5
17 changed files with 232 additions and 50 deletions
15
build.gradle
15
build.gradle
|
@ -14,6 +14,7 @@ repositories {
|
||||||
url = uri('https://jitpack.io')
|
url = uri('https://jitpack.io')
|
||||||
}
|
}
|
||||||
maven {
|
maven {
|
||||||
|
name = "PaperMc"
|
||||||
url = uri('https://papermc.io/repo/repository/maven-public/')
|
url = uri('https://papermc.io/repo/repository/maven-public/')
|
||||||
}
|
}
|
||||||
maven {
|
maven {
|
||||||
|
@ -27,6 +28,7 @@ repositories {
|
||||||
url = uri('https://repo.dmulloy2.net/repository/public/')
|
url = uri('https://repo.dmulloy2.net/repository/public/')
|
||||||
}
|
}
|
||||||
maven {
|
maven {
|
||||||
|
name = "EssentialsX"
|
||||||
url = uri('https://repo.essentialsx.net/releases/')
|
url = uri('https://repo.essentialsx.net/releases/')
|
||||||
}
|
}
|
||||||
maven {
|
maven {
|
||||||
|
@ -36,9 +38,11 @@ repositories {
|
||||||
url = uri('https://repo.maven.apache.org/maven2/')
|
url = uri('https://repo.maven.apache.org/maven2/')
|
||||||
}
|
}
|
||||||
maven {
|
maven {
|
||||||
|
name = "PlaceHolderApi"
|
||||||
url = 'https://repo.extendedclip.com/content/repositories/placeholderapi/'
|
url = 'https://repo.extendedclip.com/content/repositories/placeholderapi/'
|
||||||
}
|
}
|
||||||
maven {
|
maven {
|
||||||
|
name = "Citizens"
|
||||||
url = 'https://repo.citizensnpcs.co/'
|
url = 'https://repo.citizensnpcs.co/'
|
||||||
}
|
}
|
||||||
maven {
|
maven {
|
||||||
|
@ -58,7 +62,7 @@ dependencies {
|
||||||
implementation 'org.mongodb:bson:4.7.2'
|
implementation 'org.mongodb:bson:4.7.2'
|
||||||
implementation 'org.mongodb:mongodb-driver-core:4.7.2'
|
implementation 'org.mongodb:mongodb-driver-core:4.7.2'
|
||||||
|
|
||||||
implementation 'de.tr7zw:item-nbt-api-plugin:2.10.0'
|
implementation 'de.tr7zw:item-nbt-api-plugin:2.11.1'
|
||||||
compileOnly 'io.papermc.paper:paper-api:1.19.3-R0.1-SNAPSHOT'
|
compileOnly 'io.papermc.paper:paper-api:1.19.3-R0.1-SNAPSHOT'
|
||||||
compileOnly 'com.comphenix.protocol:ProtocolLib:4.8.0'
|
compileOnly 'com.comphenix.protocol:ProtocolLib:4.8.0'
|
||||||
compileOnly 'net.luckperms:api:5.4'
|
compileOnly 'net.luckperms:api:5.4'
|
||||||
|
@ -67,10 +71,13 @@ dependencies {
|
||||||
//compileOnly 'com.fastasyncworldedit:FastAsyncWorldEdit-Core:2.3.0'
|
//compileOnly 'com.fastasyncworldedit:FastAsyncWorldEdit-Core:2.3.0'
|
||||||
//compileOnly 'com.fastasyncworldedit:FastAsyncWorldEdit-Bukkit:2.3.0'
|
//compileOnly 'com.fastasyncworldedit:FastAsyncWorldEdit-Bukkit:2.3.0'
|
||||||
compileOnly 'me.clip:placeholderapi:2.11.2'
|
compileOnly 'me.clip:placeholderapi:2.11.2'
|
||||||
//compileOnly 'net.citizensnpcs:citizens-main:2.0.30-SNAPSHOT'
|
compileOnly('net.citizensnpcs:citizens-main:2.0.30-SNAPSHOT') {
|
||||||
|
exclude group: '*', module: '*'
|
||||||
|
}
|
||||||
compileOnly 'com.onarandombox.multiversecore:Multiverse-Core:4.3.1'
|
compileOnly 'com.onarandombox.multiversecore:Multiverse-Core:4.3.1'
|
||||||
|
compileOnly 'me.filoghost.holographicdisplays:holographicdisplays-api:3.0.0'
|
||||||
compileOnly fileTree(dir: 'libs', include: '*.jar')
|
compileOnly fileTree(dir: 'libs', include: '*.jar')
|
||||||
paperweightDevelopmentBundle("io.papermc.paper:dev-bundle:1.19.2-R0.1-SNAPSHOT")
|
paperweightDevelopmentBundle("io.papermc.paper:dev-bundle:1.19.3-R0.1-SNAPSHOT")
|
||||||
}
|
}
|
||||||
|
|
||||||
group = 'me.unurled'
|
group = 'me.unurled'
|
||||||
|
@ -103,7 +110,7 @@ tasks {
|
||||||
|
|
||||||
shadowJar {
|
shadowJar {
|
||||||
dependencies {
|
dependencies {
|
||||||
include dependency('de.tr7zw:item-nbt-api-plugin:2.10.0')
|
include dependency('de.tr7zw:item-nbt-api-plugin:2.11.1')
|
||||||
include dependency('org.mongodb:mongodb-driver-sync:4.7.2')
|
include dependency('org.mongodb:mongodb-driver-sync:4.7.2')
|
||||||
include dependency('org.mongodb:bson:4.7.2')
|
include dependency('org.mongodb:bson:4.7.2')
|
||||||
include dependency('org.mongodb:mongodb-driver-core:4.7.2')
|
include dependency('org.mongodb:mongodb-driver-core:4.7.2')
|
||||||
|
|
|
@ -95,7 +95,7 @@ public final class Raxen extends JavaPlugin {
|
||||||
* getter for the logger
|
* getter for the logger
|
||||||
* @return the plugin logger
|
* @return the plugin logger
|
||||||
*/
|
*/
|
||||||
public static Logger getPluginLogger() {
|
public Logger getPluginLogger() {
|
||||||
return logger;
|
return logger;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -111,7 +111,7 @@ public final class Raxen extends JavaPlugin {
|
||||||
* return the instance which is launched.
|
* return the instance which is launched.
|
||||||
* @return main instance
|
* @return main instance
|
||||||
*/
|
*/
|
||||||
public static Raxen getPlugin() {
|
public Raxen getPlugin() {
|
||||||
return plugin;
|
return plugin;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -127,7 +127,7 @@ public final class Raxen extends JavaPlugin {
|
||||||
* getter for the yml's player configs.
|
* getter for the yml's player configs.
|
||||||
* @return player config instance
|
* @return player config instance
|
||||||
*/
|
*/
|
||||||
public static PlayerConfig getPlayerConfig() {
|
public PlayerConfig getPlayerConfig() {
|
||||||
return playerConfig;
|
return playerConfig;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -135,7 +135,11 @@ public final class Raxen extends JavaPlugin {
|
||||||
* getter for an instance of the config utility class
|
* getter for an instance of the config utility class
|
||||||
* @return raxen's config
|
* @return raxen's config
|
||||||
*/
|
*/
|
||||||
public static Config getConf() {
|
public Config getConf() {
|
||||||
return config;
|
return config;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void disable() {
|
||||||
|
this.setEnabled(false);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -45,12 +45,12 @@ public class NbtCommand implements TabExecutor {
|
||||||
switch (args.length) {
|
switch (args.length) {
|
||||||
case 0, 1 -> msgPlayer(player, colorTextComp("<red>You must specify an nbt and an int."));
|
case 0, 1 -> msgPlayer(player, colorTextComp("<red>You must specify an nbt and an int."));
|
||||||
case 2 -> {
|
case 2 -> {
|
||||||
debug(main, "'" + args[0] + "'", "'" + args[1] + "'");
|
debug("'" + args[0] + "'", "'" + args[1] + "'");
|
||||||
ItemStack it = player.getInventory().getItemInMainHand();
|
ItemStack it = player.getInventory().getItemInMainHand();
|
||||||
NBTItem nbti = new NBTItem(it);
|
NBTItem nbti = new NBTItem(it);
|
||||||
int a = 0;
|
int a = 0;
|
||||||
if (nbti.hasKey(args[1])) {
|
if (nbti.hasTag(args[0])) {
|
||||||
a = nbti.getInteger(args[1]);
|
a = nbti.getInteger(args[0]);
|
||||||
}
|
}
|
||||||
List<Component> lore = new ArrayList<>();
|
List<Component> lore = new ArrayList<>();
|
||||||
// ItemMeta itm = it.getItemMeta();
|
// ItemMeta itm = it.getItemMeta();
|
||||||
|
@ -78,17 +78,17 @@ public class NbtCommand implements TabExecutor {
|
||||||
// it.setItemMeta(itm);
|
// it.setItemMeta(itm);
|
||||||
PlayerManager pm = ((Raxen) Objects.requireNonNull(Bukkit.getPluginManager().getPlugin("Raxen"))).getManager().getPlayerManager();
|
PlayerManager pm = ((Raxen) Objects.requireNonNull(Bukkit.getPluginManager().getPlugin("Raxen"))).getManager().getPlayerManager();
|
||||||
nbti.setInteger(args[0], Integer.parseInt(args[1]) + a);
|
nbti.setInteger(args[0], Integer.parseInt(args[1]) + a);
|
||||||
if (nbti.hasKey("SPEED")) {
|
if (nbti.hasTag("SPEED")) {
|
||||||
pm.getSpeed().add(player, nbti.getInteger("SPEED"));
|
pm.getSpeed().add(player, nbti.getInteger("SPEED"));
|
||||||
}
|
}
|
||||||
if (nbti.hasKey("HEALTH")) {
|
if (nbti.hasTag("HEALTH")) {
|
||||||
pm.getHealth().add(player, nbti.getInteger("HEALTH"));
|
pm.getHealth().add(player, nbti.getInteger("HEALTH"));
|
||||||
}
|
}
|
||||||
if (nbti.hasKey("DEFENSE")) {
|
if (nbti.hasTag("DEFENSE")) {
|
||||||
pm.getDefense().add(player, nbti.getInteger("DEFENSE"));
|
pm.getDefense().add(player, nbti.getInteger("DEFENSE"));
|
||||||
|
|
||||||
}
|
}
|
||||||
if (nbti.hasKey("STRENGTH")) {
|
if (nbti.hasTag("STRENGTH")) {
|
||||||
pm.getStrength().add(player, nbti.getInteger("STRENGTH"));
|
pm.getStrength().add(player, nbti.getInteger("STRENGTH"));
|
||||||
}
|
}
|
||||||
it = nbti.getItem();
|
it = nbti.getItem();
|
||||||
|
|
|
@ -0,0 +1,67 @@
|
||||||
|
package me.unurled.raxen.commands.admin;
|
||||||
|
|
||||||
|
import me.unurled.raxen.Raxen;
|
||||||
|
import me.unurled.raxen.utils.Utils;
|
||||||
|
import net.kyori.adventure.text.TextComponent;
|
||||||
|
import org.bukkit.command.Command;
|
||||||
|
import org.bukkit.command.CommandSender;
|
||||||
|
import org.bukkit.command.TabExecutor;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
import org.jetbrains.annotations.Nullable;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public class TestHoloCommand implements TabExecutor {
|
||||||
|
|
||||||
|
private Raxen main;
|
||||||
|
|
||||||
|
public TestHoloCommand(Raxen main) {
|
||||||
|
this.main = main;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param sender Source of the command
|
||||||
|
* @param command Command which was executed
|
||||||
|
* @param label Alias of the command which was used
|
||||||
|
* @param args Passed command arguments
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public boolean onCommand(@NotNull CommandSender sender, @NotNull Command command, @NotNull String label, @NotNull String[] args) {
|
||||||
|
if (sender instanceof Player player) {
|
||||||
|
if (player.hasPermission("raxen.testholo.cmd")) {
|
||||||
|
// spawn a hologram
|
||||||
|
if (args.length > 0) {
|
||||||
|
if (args[0].equalsIgnoreCase("text")) {
|
||||||
|
main.getManager().getLibsManager().getHolographicDisplay().createHologram("test holo", player.getLocation().add(0.0, 2.0, 0.0));
|
||||||
|
} else if (args[0].equalsIgnoreCase("item")) {
|
||||||
|
main.getManager().getLibsManager().getHolographicDisplay().createHologram(player.getInventory().getItemInMainHand(), player.getLocation().add(0.0, 2.0, 0.0));
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
Utils.msgPlayer(player, "You need to use the correct syntax :", "/" + label + " [text | item]");
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
Utils.msgPlayer(player, (TextComponent) Utils.noPerms());
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
Utils.errorConsoleSender(sender);
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param sender Source of the command. For players tab-completing a
|
||||||
|
* command inside of a command block, this will be the player, not
|
||||||
|
* the command block.
|
||||||
|
* @param command Command which was executed
|
||||||
|
* @param label Alias of the command which was used
|
||||||
|
* @param args The arguments passed to the command, including final
|
||||||
|
* partial argument to be completed
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public @Nullable List<String> onTabComplete(@NotNull CommandSender sender, @NotNull Command command, @NotNull String label, @NotNull String[] args) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
|
@ -61,7 +61,7 @@ public class Attribute {
|
||||||
*/
|
*/
|
||||||
public Integer get(@NotNull ItemStack it) {
|
public Integer get(@NotNull ItemStack it) {
|
||||||
NBTItem nbti = new NBTItem(it);
|
NBTItem nbti = new NBTItem(it);
|
||||||
if (nbti.hasKey(name)){
|
if (nbti.hasTag(name)){
|
||||||
return nbti.getInteger(name);
|
return nbti.getInteger(name);
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
|
|
|
@ -29,7 +29,7 @@ public class CustomLoot {
|
||||||
|
|
||||||
public Double getDrop_rate() {
|
public Double getDrop_rate() {
|
||||||
NBTItem nbti = new NBTItem(item);
|
NBTItem nbti = new NBTItem(item);
|
||||||
if (nbti.hasKey(NBT.DROP_RATE)) {
|
if (nbti.hasTag(NBT.DROP_RATE)) {
|
||||||
return nbti.getDouble(NBT.DROP_RATE);
|
return nbti.getDouble(NBT.DROP_RATE);
|
||||||
}
|
}
|
||||||
return 0.0;
|
return 0.0;
|
||||||
|
|
|
@ -35,35 +35,35 @@ public class ArmorEvent implements Listener {
|
||||||
if(e.getOldItem() != null && e.getOldItem().getType() != Material.AIR) {
|
if(e.getOldItem() != null && e.getOldItem().getType() != Material.AIR) {
|
||||||
ItemStack oldItem = e.getOldItem();
|
ItemStack oldItem = e.getOldItem();
|
||||||
NBTItem nbti = new NBTItem(oldItem);
|
NBTItem nbti = new NBTItem(oldItem);
|
||||||
if(nbti.hasKey("SPEED")) {
|
if(nbti.hasTag("SPEED")) {
|
||||||
pm.getSpeed().remove(entity, nbti.getInteger("SPEED"));
|
pm.getSpeed().remove(entity, nbti.getInteger("SPEED"));
|
||||||
}
|
}
|
||||||
if(nbti.hasKey("HEALTH")) {
|
if(nbti.hasTag("HEALTH")) {
|
||||||
pm.getHealth().remove(entity, nbti.getInteger("HEALTH"));
|
pm.getHealth().remove(entity, nbti.getInteger("HEALTH"));
|
||||||
}
|
}
|
||||||
if(nbti.hasKey("DEFENSE")) {
|
if(nbti.hasTag("DEFENSE")) {
|
||||||
pm.getDefense().remove(entity, nbti.getInteger("DEFENSE"));
|
pm.getDefense().remove(entity, nbti.getInteger("DEFENSE"));
|
||||||
|
|
||||||
}
|
}
|
||||||
if(nbti.hasKey("STRENGTH")) {
|
if(nbti.hasTag("STRENGTH")) {
|
||||||
pm.getStrength().remove(entity, nbti.getInteger("STRENGTH"));
|
pm.getStrength().remove(entity, nbti.getInteger("STRENGTH"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(e.getNewItem() != null && e.getNewItem().getType() != Material.AIR) {
|
if(e.getNewItem() != null && e.getNewItem().getType() != Material.AIR) {
|
||||||
ItemStack newItem = e.getNewItem();
|
ItemStack newItem = e.getNewItem();
|
||||||
NBTItem nbti = new NBTItem(newItem);
|
NBTItem nbti = new NBTItem(newItem);
|
||||||
if(nbti.hasKey("SPEED")) {
|
if(nbti.hasTag("SPEED")) {
|
||||||
pm.getSpeed().add(entity, nbti.getInteger("SPEED"));
|
pm.getSpeed().add(entity, nbti.getInteger("SPEED"));
|
||||||
}
|
}
|
||||||
if(nbti.hasKey("HEALTH")) {
|
if(nbti.hasTag("HEALTH")) {
|
||||||
pm.getHealth().add(entity, nbti.getInteger("HEALTH"));
|
pm.getHealth().add(entity, nbti.getInteger("HEALTH"));
|
||||||
|
|
||||||
}
|
}
|
||||||
if(nbti.hasKey("DEFENSE")) {
|
if(nbti.hasTag("DEFENSE")) {
|
||||||
pm.getDefense().add(entity, nbti.getInteger("DEFENSE"));
|
pm.getDefense().add(entity, nbti.getInteger("DEFENSE"));
|
||||||
|
|
||||||
}
|
}
|
||||||
if(nbti.hasKey("STRENGTH")) {
|
if(nbti.hasTag("STRENGTH")) {
|
||||||
pm.getStrength().add(entity, nbti.getInteger("STRENGTH"));
|
pm.getStrength().add(entity, nbti.getInteger("STRENGTH"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -42,7 +42,7 @@ public class ItemHandEvent implements Listener {
|
||||||
if(oldItem != null && oldItem.getType() != Material.AIR) {
|
if(oldItem != null && oldItem.getType() != Material.AIR) {
|
||||||
NBTItem nbti = new NBTItem(oldItem);
|
NBTItem nbti = new NBTItem(oldItem);
|
||||||
for (String s : Attributes.getNameList()) {
|
for (String s : Attributes.getNameList()) {
|
||||||
if (nbti.hasKey(s.toUpperCase())) {
|
if (nbti.hasTag(s.toUpperCase())) {
|
||||||
java.lang.reflect.Method method = null;
|
java.lang.reflect.Method method = null;
|
||||||
try {
|
try {
|
||||||
method = pm.getClass().getMethod("getItem" + s);
|
method = pm.getClass().getMethod("getItem" + s);
|
||||||
|
@ -63,23 +63,23 @@ public class ItemHandEvent implements Listener {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/*if(nbti.hasKey("SPEED")) {
|
/*if(nbti.hasTag("SPEED")) {
|
||||||
pm.getItemSpeed().remove(player, nbti.getInteger("SPEED"));
|
pm.getItemSpeed().remove(player, nbti.getInteger("SPEED"));
|
||||||
}
|
}
|
||||||
if(nbti.hasKey("HEALTH")) {
|
if(nbti.hasTag("HEALTH")) {
|
||||||
pm.getItemHealth().remove(player, nbti.getInteger("HEALTH"));
|
pm.getItemHealth().remove(player, nbti.getInteger("HEALTH"));
|
||||||
}
|
}
|
||||||
if(nbti.hasKey("DEFENSE")) {
|
if(nbti.hasTag("DEFENSE")) {
|
||||||
pm.getItemDefense().remove(player, nbti.getInteger("DEFENSE"));
|
pm.getItemDefense().remove(player, nbti.getInteger("DEFENSE"));
|
||||||
}
|
}
|
||||||
if(nbti.hasKey("STRENGTH")) {
|
if(nbti.hasTag("STRENGTH")) {
|
||||||
pm.getItemStrength().remove(player, nbti.getInteger("STRENGTH"));
|
pm.getItemStrength().remove(player, nbti.getInteger("STRENGTH"));
|
||||||
}*/
|
}*/
|
||||||
}
|
}
|
||||||
if(newItem != null && newItem.getType() != Material.AIR) {
|
if(newItem != null && newItem.getType() != Material.AIR) {
|
||||||
NBTItem nbti = new NBTItem(newItem);
|
NBTItem nbti = new NBTItem(newItem);
|
||||||
for (String s : Attributes.getNameList()) {
|
for (String s : Attributes.getNameList()) {
|
||||||
if (nbti.hasKey(s.toUpperCase())) {
|
if (nbti.hasTag(s.toUpperCase())) {
|
||||||
java.lang.reflect.Method method = null;
|
java.lang.reflect.Method method = null;
|
||||||
try {
|
try {
|
||||||
method = pm.getClass().getMethod("getItem" + s);
|
method = pm.getClass().getMethod("getItem" + s);
|
||||||
|
@ -100,18 +100,18 @@ public class ItemHandEvent implements Listener {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/* if(nbti.hasKey("SPEED")) {
|
/* if(nbti.hasTag("SPEED")) {
|
||||||
pm.getItemSpeed().add(player, nbti.getInteger("SPEED"));
|
pm.getItemSpeed().add(player, nbti.getInteger("SPEED"));
|
||||||
}
|
}
|
||||||
if(nbti.hasKey("HEALTH")) {
|
if(nbti.hasTag("HEALTH")) {
|
||||||
pm.getItemHealth().add(player, nbti.getInteger("HEALTH"));
|
pm.getItemHealth().add(player, nbti.getInteger("HEALTH"));
|
||||||
|
|
||||||
}
|
}
|
||||||
if(nbti.hasKey("DEFENSE")) {
|
if(nbti.hasTag("DEFENSE")) {
|
||||||
pm.getItemDefense().add(player, nbti.getInteger("DEFENSE"));
|
pm.getItemDefense().add(player, nbti.getInteger("DEFENSE"));
|
||||||
|
|
||||||
}
|
}
|
||||||
if(nbti.hasKey("STRENGTH")) {
|
if(nbti.hasTag("STRENGTH")) {
|
||||||
pm.getItemStrength().add(player, nbti.getInteger("STRENGTH"));
|
pm.getItemStrength().add(player, nbti.getInteger("STRENGTH"));
|
||||||
}*/
|
}*/
|
||||||
}
|
}
|
||||||
|
|
|
@ -28,6 +28,8 @@ public class CommandManager {
|
||||||
private MainGuiCommand mainGuiCommand;
|
private MainGuiCommand mainGuiCommand;
|
||||||
private ItemTo64Command itemTo64Command;
|
private ItemTo64Command itemTo64Command;
|
||||||
|
|
||||||
|
private TestHoloCommand testHoloCommand;
|
||||||
|
|
||||||
public CommandManager(Raxen main) {
|
public CommandManager(Raxen main) {
|
||||||
this.main = main;
|
this.main = main;
|
||||||
this.itemListCommand = new ItemListCommand(this.main);
|
this.itemListCommand = new ItemListCommand(this.main);
|
||||||
|
@ -40,6 +42,7 @@ public class CommandManager {
|
||||||
this.customModelDataCommand = new CustomModelDataCommand();
|
this.customModelDataCommand = new CustomModelDataCommand();
|
||||||
this.mainGuiCommand = new MainGuiCommand(this.main);
|
this.mainGuiCommand = new MainGuiCommand(this.main);
|
||||||
this.itemTo64Command = new ItemTo64Command();
|
this.itemTo64Command = new ItemTo64Command();
|
||||||
|
this.testHoloCommand = new TestHoloCommand(this.main);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -82,5 +85,8 @@ public class CommandManager {
|
||||||
|
|
||||||
main.getCommand("itemto64").setTabCompleter(itemTo64Command);
|
main.getCommand("itemto64").setTabCompleter(itemTo64Command);
|
||||||
main.getCommand("itemto64").setExecutor(itemTo64Command);
|
main.getCommand("itemto64").setExecutor(itemTo64Command);
|
||||||
|
|
||||||
|
main.getCommand("testholo").setTabCompleter(testHoloCommand);
|
||||||
|
main.getCommand("testholo").setExecutor(testHoloCommand);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,7 +2,9 @@ package me.unurled.raxen.manager.server;
|
||||||
|
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
import me.unurled.raxen.Raxen;
|
import me.unurled.raxen.Raxen;
|
||||||
|
import me.unurled.raxen.utils.Utils;
|
||||||
import me.unurled.raxen.utils.libs.*;
|
import me.unurled.raxen.utils.libs.*;
|
||||||
|
import org.bukkit.Bukkit;
|
||||||
|
|
||||||
public class LibsManager {
|
public class LibsManager {
|
||||||
@Getter
|
@Getter
|
||||||
|
@ -18,7 +20,9 @@ public class LibsManager {
|
||||||
@Getter
|
@Getter
|
||||||
private PlaceHolderAPI placeHolderAPI;
|
private PlaceHolderAPI placeHolderAPI;
|
||||||
@Getter
|
@Getter
|
||||||
private Citizens citizens;
|
private CitizensApi citizens;
|
||||||
|
@Getter
|
||||||
|
private HolographicDisplay holographicDisplay;
|
||||||
|
|
||||||
public LibsManager(Raxen main) {
|
public LibsManager(Raxen main) {
|
||||||
this.luckPerm = new LuckPerm(main);
|
this.luckPerm = new LuckPerm(main);
|
||||||
|
@ -27,6 +31,12 @@ public class LibsManager {
|
||||||
this.protocolManager = new ProtocolManager(main);
|
this.protocolManager = new ProtocolManager(main);
|
||||||
this.mongoDB = new MongoDB();
|
this.mongoDB = new MongoDB();
|
||||||
this.placeHolderAPI = new PlaceHolderAPI(main);
|
this.placeHolderAPI = new PlaceHolderAPI(main);
|
||||||
this.citizens = new Citizens(main);
|
this.citizens = new CitizensApi(main);
|
||||||
|
if (!Bukkit.getPluginManager().isPluginEnabled("HolographicDisplays")) {
|
||||||
|
Utils.error("*** HolographicDisplays is not installed or not enabled. ***", "*** This plugin will be disabled. ***");
|
||||||
|
main.disable();
|
||||||
|
} else {
|
||||||
|
holographicDisplay = new HolographicDisplay(main);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,7 +2,6 @@ package me.unurled.raxen.utils;
|
||||||
|
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
import org.bukkit.craftbukkit.v1_19_R1.entity.CraftPlayer;
|
|
||||||
import org.bukkit.entity.Entity;
|
import org.bukkit.entity.Entity;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
|
|
|
@ -504,42 +504,42 @@ public class Items {
|
||||||
lore.add(cp);
|
lore.add(cp);
|
||||||
}
|
}
|
||||||
NBTItem nbti = new NBTItem(it);
|
NBTItem nbti = new NBTItem(it);
|
||||||
if(nbti.hasKey(NBT.SPEED)) {
|
if(nbti.hasTag(NBT.SPEED)) {
|
||||||
if(lore.size() > 2) {
|
if(lore.size() > 2) {
|
||||||
lore.add(2, colorComp(attributes("SPEED")).append(Component.text(nbti.getInteger(NBT.SPEED))));
|
lore.add(2, colorComp(attributes("SPEED")).append(Component.text(nbti.getInteger(NBT.SPEED))));
|
||||||
} else {
|
} else {
|
||||||
lore.add(colorComp(attributes("SPEED")).append(Component.text(nbti.getInteger(NBT.SPEED))));
|
lore.add(colorComp(attributes("SPEED")).append(Component.text(nbti.getInteger(NBT.SPEED))));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(nbti.hasKey(NBT.HEALTH)) {
|
if(nbti.hasTag(NBT.HEALTH)) {
|
||||||
if(lore.size() > 1) {
|
if(lore.size() > 1) {
|
||||||
lore.add(1, colorComp(attributes("HEALTH")).append(Component.text(nbti.getInteger(NBT.HEALTH))));
|
lore.add(1, colorComp(attributes("HEALTH")).append(Component.text(nbti.getInteger(NBT.HEALTH))));
|
||||||
} else {
|
} else {
|
||||||
lore.add(colorComp(attributes("HEALTH")).append(Component.text(nbti.getInteger(NBT.HEALTH))));
|
lore.add(colorComp(attributes("HEALTH")).append(Component.text(nbti.getInteger(NBT.HEALTH))));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(nbti.hasKey(NBT.DEFENSE)) {
|
if(nbti.hasTag(NBT.DEFENSE)) {
|
||||||
if(lore.size() > 3) {
|
if(lore.size() > 3) {
|
||||||
lore.add(3, colorComp(attributes("DEFENSE")).append(Component.text(nbti.getInteger(NBT.DEFENSE))));
|
lore.add(3, colorComp(attributes("DEFENSE")).append(Component.text(nbti.getInteger(NBT.DEFENSE))));
|
||||||
} else {
|
} else {
|
||||||
lore.add(colorComp(attributes("DEFENSE")).append(Component.text(nbti.getInteger(NBT.DEFENSE))));
|
lore.add(colorComp(attributes("DEFENSE")).append(Component.text(nbti.getInteger(NBT.DEFENSE))));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(nbti.hasKey(NBT.STRENGTH)) {
|
if(nbti.hasTag(NBT.STRENGTH)) {
|
||||||
if(lore.size() > 3) {
|
if(lore.size() > 3) {
|
||||||
lore.add(3, colorComp(attributes("STRENGTH")).append(Component.text(nbti.getInteger(NBT.STRENGTH))));
|
lore.add(3, colorComp(attributes("STRENGTH")).append(Component.text(nbti.getInteger(NBT.STRENGTH))));
|
||||||
} else {
|
} else {
|
||||||
lore.add(colorComp(attributes("STRENGTH")).append(Component.text(nbti.getInteger(NBT.STRENGTH))));
|
lore.add(colorComp(attributes("STRENGTH")).append(Component.text(nbti.getInteger(NBT.STRENGTH))));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(nbti.hasKey(NBT.MANA)) {
|
if(nbti.hasTag(NBT.MANA)) {
|
||||||
if(lore.size() > 3) {
|
if(lore.size() > 3) {
|
||||||
lore.add(3, colorComp(attributes("MANA")).append(Component.text(nbti.getInteger(NBT.MANA))));
|
lore.add(3, colorComp(attributes("MANA")).append(Component.text(nbti.getInteger(NBT.MANA))));
|
||||||
} else {
|
} else {
|
||||||
lore.add(colorComp(attributes("MANA")).append(Component.text(nbti.getInteger(NBT.MANA))));
|
lore.add(colorComp(attributes("MANA")).append(Component.text(nbti.getInteger(NBT.MANA))));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(nbti.hasKey(NBT.LUCK)) {
|
if(nbti.hasTag(NBT.LUCK)) {
|
||||||
if(lore.size() > 3) {
|
if(lore.size() > 3) {
|
||||||
lore.add(3, colorComp(attributes("LUCK")).append(Component.text(nbti.getInteger(NBT.LUCK))));
|
lore.add(3, colorComp(attributes("LUCK")).append(Component.text(nbti.getInteger(NBT.LUCK))));
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -15,12 +15,13 @@ import java.nio.file.Files;
|
||||||
import java.nio.file.Paths;
|
import java.nio.file.Paths;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Objects;
|
||||||
|
|
||||||
import static me.unurled.raxen.utils.Utils.colorTextComp;
|
import static me.unurled.raxen.utils.Utils.colorTextComp;
|
||||||
|
|
||||||
public class Reload implements Listener {
|
public class Reload implements Listener {
|
||||||
|
|
||||||
private static FileConfiguration config = Raxen.getPlugin().getConfig();
|
private static FileConfiguration config = Objects.requireNonNull(Bukkit.getPluginManager().getPlugin("Raxen")).getConfig();
|
||||||
private static boolean serverReloading = true;
|
private static boolean serverReloading = true;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -3,11 +3,11 @@ package me.unurled.raxen.utils.libs;
|
||||||
import me.unurled.raxen.Raxen;
|
import me.unurled.raxen.Raxen;
|
||||||
import org.bukkit.entity.Entity;
|
import org.bukkit.entity.Entity;
|
||||||
|
|
||||||
public class Citizens {
|
public class CitizensApi {
|
||||||
|
|
||||||
private Raxen main;
|
private Raxen main;
|
||||||
|
|
||||||
public Citizens(Raxen main) {
|
public CitizensApi(Raxen main) {
|
||||||
this.main = main;
|
this.main = main;
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,82 @@
|
||||||
|
package me.unurled.raxen.utils.libs;
|
||||||
|
|
||||||
|
import lombok.Getter;
|
||||||
|
import me.filoghost.holographicdisplays.api.HolographicDisplaysAPI;
|
||||||
|
import me.filoghost.holographicdisplays.api.hologram.Hologram;
|
||||||
|
import me.filoghost.holographicdisplays.api.hologram.line.ItemHologramLine;
|
||||||
|
import me.filoghost.holographicdisplays.api.hologram.line.TextHologramLine;
|
||||||
|
import me.unurled.raxen.Raxen;
|
||||||
|
import org.bukkit.Location;
|
||||||
|
import org.bukkit.Material;
|
||||||
|
import org.bukkit.inventory.ItemStack;
|
||||||
|
import org.bukkit.plugin.Plugin;
|
||||||
|
|
||||||
|
public class HolographicDisplay {
|
||||||
|
private Raxen main;
|
||||||
|
|
||||||
|
@Getter
|
||||||
|
private HolographicDisplaysAPI holographicDisplaysAPI;
|
||||||
|
|
||||||
|
public HolographicDisplay(Raxen main) {
|
||||||
|
this.main = main;
|
||||||
|
holographicDisplaysAPI = HolographicDisplaysAPI.get(main);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* create a Hologram at Loc
|
||||||
|
* @param text the text to be displayed (one line only)
|
||||||
|
* @param loc the location of the hologram
|
||||||
|
* @return the created hologram
|
||||||
|
*/
|
||||||
|
public Hologram createHologram(String text, Location loc) {
|
||||||
|
Hologram hologram = null;
|
||||||
|
if (text != null && !text.equals("")) {
|
||||||
|
hologram = holographicDisplaysAPI.createHologram(loc);
|
||||||
|
TextHologramLine textLine = hologram.getLines().appendText(text);
|
||||||
|
}
|
||||||
|
return hologram;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* create a Hologram at Loc
|
||||||
|
* @param item the item to be displayed (only one)
|
||||||
|
* @param loc the location of the hologram
|
||||||
|
* @return the created hologram
|
||||||
|
*/
|
||||||
|
public Hologram createHologram(ItemStack item, Location loc) {
|
||||||
|
Hologram hologram = null;
|
||||||
|
if (item != null && !item.getType().equals(Material.AIR)) {
|
||||||
|
hologram = holographicDisplaysAPI.createHologram(loc);
|
||||||
|
ItemHologramLine textLine = hologram.getLines().appendItem(item);
|
||||||
|
}
|
||||||
|
return hologram;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* insert in the holo
|
||||||
|
* @param holo the hologram to insert
|
||||||
|
* @param text the text that is inserted
|
||||||
|
* @param line the line to change (start at 0)
|
||||||
|
* @return the hologram
|
||||||
|
*/
|
||||||
|
public Hologram insertHologram(Hologram holo, String text, Integer line) {
|
||||||
|
if (text != null && !text.equals("")) {
|
||||||
|
TextHologramLine textLine = holo.getLines().insertText(line, text);
|
||||||
|
}
|
||||||
|
return holo;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* insert in the holo
|
||||||
|
* @param holo the hologram to insert
|
||||||
|
* @param item the item that is inserted
|
||||||
|
* @param line the line to change (start at 0)
|
||||||
|
* @return the hologram
|
||||||
|
*/
|
||||||
|
public Hologram insertHologram(Hologram holo, ItemStack item, Integer line) {
|
||||||
|
if (item != null && !item.getType().equals(Material.AIR)) {
|
||||||
|
ItemHologramLine textLine = holo.getLines().insertItem(line, item);
|
||||||
|
}
|
||||||
|
return holo;
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,7 +1,6 @@
|
||||||
package me.unurled.raxen.utils.libs;
|
package me.unurled.raxen.utils.libs;
|
||||||
|
|
||||||
import com.mongodb.ConnectionString;
|
import com.mongodb.ConnectionString;
|
||||||
import com.mongodb.MongoClientSettings;
|
|
||||||
import com.mongodb.client.MongoClient;
|
import com.mongodb.client.MongoClient;
|
||||||
import com.mongodb.client.MongoClients;
|
import com.mongodb.client.MongoClients;
|
||||||
import com.mongodb.client.MongoCollection;
|
import com.mongodb.client.MongoCollection;
|
||||||
|
@ -12,6 +11,8 @@ import org.bukkit.Bukkit;
|
||||||
import org.bukkit.configuration.file.FileConfiguration;
|
import org.bukkit.configuration.file.FileConfiguration;
|
||||||
|
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
|
import java.util.logging.Level;
|
||||||
|
import java.util.logging.Logger;
|
||||||
|
|
||||||
import static me.unurled.raxen.utils.Utils.*;
|
import static me.unurled.raxen.utils.Utils.*;
|
||||||
|
|
||||||
|
@ -36,6 +37,7 @@ public class MongoDB {
|
||||||
mongoCollection = mongoDatabase.getCollection("player");
|
mongoCollection = mongoDatabase.getCollection("player");
|
||||||
mongoConfigs = mongoDatabase.getCollection("config");
|
mongoConfigs = mongoDatabase.getCollection("config");
|
||||||
|
|
||||||
|
|
||||||
Bukkit.getConsoleSender().sendMessage(colorComp("<green>MongoDB connected!"));
|
Bukkit.getConsoleSender().sendMessage(colorComp("<green>MongoDB connected!"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -3,8 +3,8 @@ version: '${version}'
|
||||||
main: me.unurled.raxen.Raxen
|
main: me.unurled.raxen.Raxen
|
||||||
author: unurled
|
author: unurled
|
||||||
api-version: 1.19
|
api-version: 1.19
|
||||||
depend: [ProtocolLib, PlaceholderAPI, 'Multiverse-Core']
|
depend: [ProtocolLib, PlaceholderAPI, 'Multiverse-Core', Citizens]
|
||||||
softdepend: [LuckPerms, Essentials]
|
softdepend: [LuckPerms, Essentials, HolographicDisplays]
|
||||||
|
|
||||||
commands:
|
commands:
|
||||||
reloadplugin:
|
reloadplugin:
|
||||||
|
@ -42,6 +42,8 @@ commands:
|
||||||
description: not very much used, more with right click on device
|
description: not very much used, more with right click on device
|
||||||
itemto64:
|
itemto64:
|
||||||
description: transform an item to it's 64encoded byte
|
description: transform an item to it's 64encoded byte
|
||||||
|
testholo:
|
||||||
|
description: test command for the holograms
|
||||||
|
|
||||||
permissions:
|
permissions:
|
||||||
raxen.reload.cmd:
|
raxen.reload.cmd:
|
||||||
|
@ -66,3 +68,5 @@ permissions:
|
||||||
description: main gui command permission
|
description: main gui command permission
|
||||||
raxen.itemto64.cmd:
|
raxen.itemto64.cmd:
|
||||||
description: item to 64 command permission
|
description: item to 64 command permission
|
||||||
|
raxen.testholo.cmd:
|
||||||
|
description: testholo command permission
|
Loading…
Reference in a new issue