some change, not much for now

This commit is contained in:
unurled 2022-12-28 20:48:14 +01:00
parent f6a41fafb9
commit 499aeaf2b5
17 changed files with 232 additions and 50 deletions

View file

@ -2,7 +2,6 @@ package me.unurled.raxen.utils;
import org.bukkit.Bukkit;
import org.bukkit.Location;
import org.bukkit.craftbukkit.v1_19_R1.entity.CraftPlayer;
import org.bukkit.entity.Entity;
import org.bukkit.entity.Player;

View file

@ -504,42 +504,42 @@ public class Items {
lore.add(cp);
}
NBTItem nbti = new NBTItem(it);
if(nbti.hasKey(NBT.SPEED)) {
if(nbti.hasTag(NBT.SPEED)) {
if(lore.size() > 2) {
lore.add(2, colorComp(attributes("SPEED")).append(Component.text(nbti.getInteger(NBT.SPEED))));
} else {
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) {
lore.add(1, colorComp(attributes("HEALTH")).append(Component.text(nbti.getInteger(NBT.HEALTH))));
} else {
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) {
lore.add(3, colorComp(attributes("DEFENSE")).append(Component.text(nbti.getInteger(NBT.DEFENSE))));
} else {
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) {
lore.add(3, colorComp(attributes("STRENGTH")).append(Component.text(nbti.getInteger(NBT.STRENGTH))));
} else {
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) {
lore.add(3, colorComp(attributes("MANA")).append(Component.text(nbti.getInteger(NBT.MANA))));
} else {
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) {
lore.add(3, colorComp(attributes("LUCK")).append(Component.text(nbti.getInteger(NBT.LUCK))));
} else {

View file

@ -15,12 +15,13 @@ import java.nio.file.Files;
import java.nio.file.Paths;
import java.util.ArrayList;
import java.util.List;
import java.util.Objects;
import static me.unurled.raxen.utils.Utils.colorTextComp;
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;
/**

View file

@ -3,11 +3,11 @@ package me.unurled.raxen.utils.libs;
import me.unurled.raxen.Raxen;
import org.bukkit.entity.Entity;
public class Citizens {
public class CitizensApi {
private Raxen main;
public Citizens(Raxen main) {
public CitizensApi(Raxen main) {
this.main = main;
}

View file

@ -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;
}
}

View file

@ -1,7 +1,6 @@
package me.unurled.raxen.utils.libs;
import com.mongodb.ConnectionString;
import com.mongodb.MongoClientSettings;
import com.mongodb.client.MongoClient;
import com.mongodb.client.MongoClients;
import com.mongodb.client.MongoCollection;
@ -12,6 +11,8 @@ import org.bukkit.Bukkit;
import org.bukkit.configuration.file.FileConfiguration;
import java.util.Objects;
import java.util.logging.Level;
import java.util.logging.Logger;
import static me.unurled.raxen.utils.Utils.*;
@ -36,6 +37,7 @@ public class MongoDB {
mongoCollection = mongoDatabase.getCollection("player");
mongoConfigs = mongoDatabase.getCollection("config");
Bukkit.getConsoleSender().sendMessage(colorComp("<green>MongoDB connected!"));
}