0.4.8
get MiniMessage to work, modified some classes and update in build.gradle, update of gradle wrapper
This commit is contained in:
parent
0b861e39bd
commit
9b14f1ec83
48 changed files with 657 additions and 596 deletions
2
.gitignore
vendored
2
.gitignore
vendored
|
@ -9,8 +9,6 @@ api/
|
||||||
libs/
|
libs/
|
||||||
*.iml
|
*.iml
|
||||||
|
|
||||||
gradle-wrapper.properties
|
|
||||||
gradle/
|
|
||||||
.gradle/
|
.gradle/
|
||||||
|
|
||||||
*.lock
|
*.lock
|
||||||
|
|
12
build.gradle
12
build.gradle
|
@ -2,7 +2,7 @@ plugins {
|
||||||
id 'java'
|
id 'java'
|
||||||
id 'maven-publish'
|
id 'maven-publish'
|
||||||
id "com.github.johnrengelman.shadow" version "7.1.2"
|
id "com.github.johnrengelman.shadow" version "7.1.2"
|
||||||
id("io.papermc.paperweight.userdev") version "1.3.5"
|
id "io.papermc.paperweight.userdev" version "1.3.5"
|
||||||
}
|
}
|
||||||
|
|
||||||
apply plugin: "java"
|
apply plugin: "java"
|
||||||
|
@ -42,6 +42,12 @@ repositories {
|
||||||
maven {
|
maven {
|
||||||
url = uri('https://repo.maven.apache.org/maven2/')
|
url = uri('https://repo.maven.apache.org/maven2/')
|
||||||
}
|
}
|
||||||
|
maven {
|
||||||
|
url = 'https://repo.extendedclip.com/content/repositories/placeholderapi/'
|
||||||
|
}
|
||||||
|
maven {
|
||||||
|
url = 'https://repo.citizensnpcs.co/'
|
||||||
|
}
|
||||||
mavenCentral()
|
mavenCentral()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -65,12 +71,14 @@ dependencies {
|
||||||
compileOnly 'net.essentialsx:EssentialsX:2.19.4'
|
compileOnly 'net.essentialsx:EssentialsX:2.19.4'
|
||||||
compileOnly 'com.fastasyncworldedit:FastAsyncWorldEdit-Core:2.0.1'
|
compileOnly 'com.fastasyncworldedit:FastAsyncWorldEdit-Core:2.0.1'
|
||||||
compileOnly 'com.fastasyncworldedit:FastAsyncWorldEdit-Bukkit:2.0.1'
|
compileOnly 'com.fastasyncworldedit:FastAsyncWorldEdit-Bukkit:2.0.1'
|
||||||
|
compileOnly 'me.clip:placeholderapi:2.11.1'
|
||||||
|
compileOnly 'net.citizensnpcs:citizens-main:2.0.29-SNAPSHOT'
|
||||||
compileOnly fileTree(dir: 'libs', include: '*.jar')
|
compileOnly fileTree(dir: 'libs', include: '*.jar')
|
||||||
paperweightDevelopmentBundle("io.papermc.paper:dev-bundle:1.18.2-R0.1-SNAPSHOT")
|
paperweightDevelopmentBundle("io.papermc.paper:dev-bundle:1.18.2-R0.1-SNAPSHOT")
|
||||||
}
|
}
|
||||||
|
|
||||||
group = 'gq.unurled'
|
group = 'gq.unurled'
|
||||||
version = '0.4.6'
|
version = '0.4.8'
|
||||||
description = 'Raxen'
|
description = 'Raxen'
|
||||||
java.sourceCompatibility = JavaVersion.VERSION_17
|
java.sourceCompatibility = JavaVersion.VERSION_17
|
||||||
|
|
||||||
|
|
BIN
gradle/wrapper/gradle-wrapper.jar
vendored
Normal file
BIN
gradle/wrapper/gradle-wrapper.jar
vendored
Normal file
Binary file not shown.
|
@ -4,24 +4,22 @@ import com.comphenix.protocol.ProtocolLibrary;
|
||||||
import com.comphenix.protocol.ProtocolManager;
|
import com.comphenix.protocol.ProtocolManager;
|
||||||
import gq.unurled.raxen.config.Config;
|
import gq.unurled.raxen.config.Config;
|
||||||
import gq.unurled.raxen.config.PlayerConfig;
|
import gq.unurled.raxen.config.PlayerConfig;
|
||||||
import gq.unurled.raxen.manager.*;
|
import gq.unurled.raxen.manager.Manager;
|
||||||
import gq.unurled.raxen.utils.LuckPerm;
|
|
||||||
import gq.unurled.raxen.utils.Reload;
|
import gq.unurled.raxen.utils.Reload;
|
||||||
import gq.unurled.raxen.utils.Vault;
|
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
import net.kyori.adventure.text.TextComponent;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.plugin.PluginManager;
|
import org.bukkit.plugin.PluginManager;
|
||||||
import org.bukkit.plugin.java.JavaPlugin;
|
import org.bukkit.plugin.java.JavaPlugin;
|
||||||
|
|
||||||
import java.util.logging.Logger;
|
import java.util.logging.Logger;
|
||||||
|
|
||||||
import static gq.unurled.raxen.utils.Utils.colorTextComp;
|
import static gq.unurled.raxen.utils.Utils.colorComp;
|
||||||
|
|
||||||
public final class Raxen extends JavaPlugin {
|
public final class Raxen extends JavaPlugin {
|
||||||
|
|
||||||
private static final TextComponent prefix = colorTextComp("<aqua>Rx</aqua><light_purple>></light_purple> ");
|
private static final String prefix = "<aqua>Rx</aqua><light_purple>></light_purple> ";
|
||||||
@Getter
|
@Getter
|
||||||
private static String version = "0.4.7";
|
private static String version = "0.4.8";
|
||||||
private final PluginManager pm = getServer().getPluginManager();
|
private final PluginManager pm = getServer().getPluginManager();
|
||||||
|
|
||||||
private static Raxen plugin;
|
private static Raxen plugin;
|
||||||
|
@ -29,87 +27,59 @@ public final class Raxen extends JavaPlugin {
|
||||||
private static Logger logger;
|
private static Logger logger;
|
||||||
|
|
||||||
private static Config config;
|
private static Config config;
|
||||||
private static WorldManager worldManager;
|
|
||||||
@Getter
|
|
||||||
private static StorageManager storageManager;
|
|
||||||
|
|
||||||
private static PlayerManager playerManager;
|
|
||||||
private static PlayerConfig playerConfig;
|
private static PlayerConfig playerConfig;
|
||||||
|
|
||||||
private static ListenerManager listenerManager;
|
|
||||||
@Getter
|
|
||||||
private static CommandManager commandManager;
|
|
||||||
@Getter
|
|
||||||
private gq.unurled.raxen.manager.ProtocolManager protoManager;
|
|
||||||
@Getter
|
|
||||||
private ItemManager itemManager;
|
|
||||||
@Getter
|
|
||||||
private ResourcePackManager resourcePackManager;
|
|
||||||
@Getter
|
|
||||||
private LootManager lootManager;
|
|
||||||
|
|
||||||
@Getter
|
@Getter
|
||||||
private ProtocolManager protocolManager;
|
private ProtocolManager protocolManager;
|
||||||
|
|
||||||
@Getter
|
@Getter
|
||||||
public LuckPerm luckPerm;
|
private Manager manager;
|
||||||
@Getter
|
|
||||||
public Vault vault;
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onEnable() {
|
public void onEnable() {
|
||||||
plugin = this;
|
plugin = this;
|
||||||
logger = getLogger();
|
logger = getLogger();
|
||||||
version = plugin.getDescription().getVersion();
|
version = plugin.getDescription().getVersion();
|
||||||
|
manager = new Manager();
|
||||||
|
manager.set(plugin);
|
||||||
|
|
||||||
//Config and storage sruff
|
// Config
|
||||||
config = new Config(this);
|
config = new Config(plugin);
|
||||||
worldManager = new WorldManager(this);
|
|
||||||
storageManager = new StorageManager(this);
|
|
||||||
|
|
||||||
//Managers
|
|
||||||
itemManager = new ItemManager(this);
|
|
||||||
playerManager = new PlayerManager(this);
|
|
||||||
listenerManager = new ListenerManager(this);
|
|
||||||
commandManager = new CommandManager(this);
|
|
||||||
protocolManager = ProtocolLibrary.getProtocolManager();
|
protocolManager = ProtocolLibrary.getProtocolManager();
|
||||||
protoManager = new gq.unurled.raxen.manager.ProtocolManager(this);
|
|
||||||
resourcePackManager = new ResourcePackManager(this);
|
|
||||||
lootManager = new LootManager(this);
|
|
||||||
|
|
||||||
playerConfig = new PlayerConfig(this);
|
playerConfig = new PlayerConfig(plugin);
|
||||||
luckPerm = new LuckPerm(this);
|
|
||||||
luckPerm.register();
|
|
||||||
vault = new Vault(this);
|
|
||||||
|
|
||||||
//register Commands and Events
|
//register Commands and Events
|
||||||
registerCommands();
|
registerCommands();
|
||||||
registerEvents();
|
registerEvents();
|
||||||
|
|
||||||
getServer().getConsoleSender().sendMessage(colorTextComp(prefix +"<green>Server Started Successfully!</green>"));
|
Bukkit.getConsoleSender().sendMessage(colorComp(prefix +"<green>Server Started Successfully!</green>"));
|
||||||
|
|
||||||
listenerManager.getServerPingEvent().setLoading(false);
|
manager.getListenerManager().getServerPingEvent().setLoading(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void registerCommands() {
|
private void registerCommands() {
|
||||||
commandManager.register();
|
manager.getCommandManager().register();
|
||||||
|
|
||||||
getServer().getConsoleSender().sendMessage(colorTextComp(prefix +"<green>Commands Registered!</green>"));
|
Bukkit.getConsoleSender().sendMessage(colorComp(prefix +"<green>Commands Registered!</green>"));
|
||||||
}
|
}
|
||||||
|
|
||||||
private void registerEvents() {
|
private void registerEvents() {
|
||||||
listenerManager.register();
|
manager.getListenerManager().register();
|
||||||
|
|
||||||
getServer().getConsoleSender().sendMessage(colorTextComp(prefix +"<green>Events Registered!</green>"));
|
Bukkit.getConsoleSender().sendMessage(colorComp(prefix +"<green>Events Registered!</green>"));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onDisable() {
|
public void onDisable() {
|
||||||
listenerManager.getServerPingEvent().setLoading(true);
|
manager.getListenerManager().getServerPingEvent().setLoading(true);
|
||||||
Reload.kickAll();
|
Reload.kickAll();
|
||||||
|
|
||||||
playerConfig.close();
|
playerConfig.close();
|
||||||
|
|
||||||
getServer().getConsoleSender().sendMessage(colorTextComp(prefix +"<red>Server Stopped Successfully!</red>"));
|
Bukkit.getConsoleSender().sendMessage(colorComp(prefix +"<red>Server Stopped Successfully!</red>"));
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Logger getPluginLogger() {
|
public static Logger getPluginLogger() {
|
||||||
|
@ -124,14 +94,10 @@ public final class Raxen extends JavaPlugin {
|
||||||
return plugin;
|
return plugin;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static TextComponent getPrefix() {
|
public static String getPrefix() {
|
||||||
return prefix;
|
return prefix;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static PlayerManager getPlayerManager() {
|
|
||||||
return playerManager;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static PlayerConfig getPlayerConfig() {
|
public static PlayerConfig getPlayerConfig() {
|
||||||
return playerConfig;
|
return playerConfig;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,8 +1,7 @@
|
||||||
package gq.unurled.raxen.commands;
|
package gq.unurled.raxen.commands;
|
||||||
|
|
||||||
import gq.unurled.raxen.Raxen;
|
import gq.unurled.raxen.Raxen;
|
||||||
import gq.unurled.raxen.manager.StorageManager;
|
import gq.unurled.raxen.manager.entity.StorageManager;
|
||||||
import net.kyori.adventure.text.Component;
|
|
||||||
import net.kyori.adventure.text.TextComponent;
|
import net.kyori.adventure.text.TextComponent;
|
||||||
import net.kyori.adventure.text.event.ClickEvent;
|
import net.kyori.adventure.text.event.ClickEvent;
|
||||||
import org.bukkit.command.Command;
|
import org.bukkit.command.Command;
|
||||||
|
@ -29,7 +28,7 @@ public class RaxenCommand implements TabExecutor {
|
||||||
if(sender instanceof Player) {
|
if(sender instanceof Player) {
|
||||||
Player player = (Player) sender;
|
Player player = (Player) sender;
|
||||||
if(!(player.hasPermission("raxen."))) {
|
if(!(player.hasPermission("raxen."))) {
|
||||||
msgPlayer(player, Raxen.getPrefix().append(colorTextComp("<red>You can't execute this command. Insufficient permission.")));
|
msgPlayer(player, coloredString(Raxen.getPrefix()) + colorTextComp("<red>You can't execute this command. Insufficient permission."));
|
||||||
}
|
}
|
||||||
switch (args.length) {
|
switch (args.length) {
|
||||||
case 0 -> msgPl(player, 0);
|
case 0 -> msgPl(player, 0);
|
||||||
|
@ -37,13 +36,13 @@ public class RaxenCommand implements TabExecutor {
|
||||||
switch (args[0]) {
|
switch (args[0]) {
|
||||||
case "mongodb", "mongo", "MONGODB", "MONGO" -> {
|
case "mongodb", "mongo", "MONGODB", "MONGO" -> {
|
||||||
//print info about connection
|
//print info about connection
|
||||||
sender.sendMessage(Raxen.getPrefix().append(colorTextComp("<gold>Printing About Raxen's MongoDB connection...")));
|
sender.sendMessage(coloredString(Raxen.getPrefix()) + colorTextComp("<gold>Printing About Raxen's MongoDB connection..."));
|
||||||
msgPlayer(player, Raxen.getPrefix()
|
msgPlayer(player, coloredString(Raxen.getPrefix()) +
|
||||||
.append(colorTextComp("<gold>---------------------------------------------")));
|
colorTextComp("<gold>---------------------------------------------"));
|
||||||
msgPlayer(player, colorTextComp("<red>MONGO DB<white>"));
|
msgPlayer(player, colorTextComp("<red>MONGO DB<white>"));
|
||||||
msgPlayer(player, StorageManager.getMongo().getMongoClient().getClusterDescription().toString());
|
msgPlayer(player, StorageManager.getMongodb().getMongoClient().getClusterDescription().toString());
|
||||||
msgPlayer(player, StorageManager.getMongo().getMongoDatabase().getName());
|
msgPlayer(player, StorageManager.getMongodb().getMongoDatabase().getName());
|
||||||
msgPlayer(player, StorageManager.getMongo().getMongoCollection().getNamespace().toString());
|
msgPlayer(player, StorageManager.getMongodb().getMongoCollection().getNamespace().toString());
|
||||||
msgPlayer(player, "<gold>---------------------------------------------");
|
msgPlayer(player, "<gold>---------------------------------------------");
|
||||||
}
|
}
|
||||||
case "v", "version", "ver" -> {
|
case "v", "version", "ver" -> {
|
||||||
|
@ -60,37 +59,37 @@ public class RaxenCommand implements TabExecutor {
|
||||||
log(String.valueOf(args.length));
|
log(String.valueOf(args.length));
|
||||||
switch (args.length) {
|
switch (args.length) {
|
||||||
case 0 -> {
|
case 0 -> {
|
||||||
msgSender(sender, Raxen.getPrefix() + colorString("<gold>Printing About Raxen..."),
|
msgSender(sender, Raxen.getPrefix() + "<gold>Printing About Raxen...",
|
||||||
colorString("<gold>---------------------------------------------"),
|
"<gold>---------------------------------------------",
|
||||||
colorString("<dark_aqua> Raxen "),
|
"<dark_aqua> Raxen ",
|
||||||
colorString("<dark_aqua> - Version: " + Raxen.getVersion()),
|
"<dark_aqua> - Version: " + Raxen.getVersion(),
|
||||||
colorString("<dark_aqua> - Author: <b><red>U<gold>n&eu<dark_green>r<green>l<aqua>e<dark_aqua>d<reset>"));
|
"<dark_aqua> - Author: <b><red>U<gold>n<yellow>u<dark_green>r<green>l<aqua>e<dark_aqua>d<reset>");
|
||||||
TextComponent txt = Component.text(colorString("<dark_aqua> - Website: https://unurled.gq"));
|
TextComponent txt = colorTextComp("<dark_aqua> - Website: https://unurled.gq");
|
||||||
sender.sendMessage(txt);
|
sender.sendMessage(txt);
|
||||||
sender.sendMessage(colorString("<gold>---------------------------------------------"));
|
sender.sendMessage(coloredString("<gold>---------------------------------------------"));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
case 1 -> {
|
case 1 -> {
|
||||||
switch (args[0]) {
|
switch (args[0]) {
|
||||||
case "mongodb", "mongo", "MONGODB", "MONGO" -> {
|
case "mongodb", "mongo", "MONGODB", "MONGO" -> {
|
||||||
//print info about connection
|
//print info about connection
|
||||||
sender.sendMessage(Raxen.getPrefix() + colorString("<gold>Printing About Raxen's MongoDB connection..."));
|
msgSender(sender, Raxen.getPrefix() + "<gold>Printing About Raxen's MongoDB connection...",
|
||||||
sender.sendMessage(colorString("<gold>---------------------------------------------"), colorString("<red>MONGO DB"));
|
"<gold>---------------------------------------------" + "<red>MONGO DB");
|
||||||
sender.sendMessage(StorageManager.getMongo().getMongoClient().getClusterDescription().toString());
|
sender.sendMessage(StorageManager.getMongodb().getMongoClient().getClusterDescription().toString());
|
||||||
sender.sendMessage(StorageManager.getMongo().getMongoDatabase().getName());
|
sender.sendMessage(StorageManager.getMongodb().getMongoDatabase().getName());
|
||||||
sender.sendMessage(StorageManager.getMongo().getMongoCollection().getNamespace().toString());
|
sender.sendMessage(StorageManager.getMongodb().getMongoCollection().getNamespace().toString());
|
||||||
sender.sendMessage(colorString("<gold>---------------------------------------------"));
|
sender.sendMessage(coloredString("<gold>---------------------------------------------"));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
case "v", "version", "ver" -> {
|
case "v", "version", "ver" -> {
|
||||||
sender.sendMessage(Raxen.getPrefix() + colorString("<gold>Printing About Raxen..."),
|
msgSender(sender, Raxen.getPrefix() + "<gold>Printing About Raxen...",
|
||||||
colorString("<gold>---------------------------------------------"),
|
"<gold>---------------------------------------------",
|
||||||
colorString("<dark_aqua> Raxen "),
|
"<dark_aqua> Raxen ",
|
||||||
colorString("<dark_aqua> - Version: " + Raxen.getVersion()),
|
"<dark_aqua> - Version: " + Raxen.getVersion(),
|
||||||
colorString("<dark_aqua> - Author: <b><red>U<gold>n&eu<dark_green>r<green>l<aqua>e<dark_aqua>d<reset>"));
|
"<dark_aqua> - Author: <b><red>U<gold>n&eu<dark_green>r<green>l<aqua>e<dark_aqua>d<reset>");
|
||||||
TextComponent txt= Component.text(colorString("<dark_aqua> - Website: https://unurled.gq"));
|
TextComponent txt=colorTextComp("<dark_aqua> - Website: https://unurled.gq");
|
||||||
sender.sendMessage(txt);
|
sender.sendMessage(txt);
|
||||||
sender.sendMessage(colorString("<gold>---------------------------------------------"));
|
sender.sendMessage(coloredString("<gold>---------------------------------------------"));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
case "hemlp", "?", "h" ->
|
case "hemlp", "?", "h" ->
|
||||||
|
|
|
@ -18,8 +18,8 @@ import org.jetbrains.annotations.Nullable;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
import static gq.unurled.raxen.components.player.PlayerUtils.updateSkills;
|
||||||
import static gq.unurled.raxen.utils.Items.attributes;
|
import static gq.unurled.raxen.utils.Items.attributes;
|
||||||
import static gq.unurled.raxen.utils.Skills.updateSkills;
|
|
||||||
import static gq.unurled.raxen.utils.Utils.*;
|
import static gq.unurled.raxen.utils.Utils.*;
|
||||||
|
|
||||||
public class NbtCommand implements TabExecutor {
|
public class NbtCommand implements TabExecutor {
|
||||||
|
@ -38,11 +38,11 @@ public class NbtCommand implements TabExecutor {
|
||||||
}
|
}
|
||||||
Player player = (Player) sender;
|
Player player = (Player) sender;
|
||||||
if(player.getInventory().getItemInMainHand().getType() == Material.AIR || player.getInventory().getItemInMainHand() == null) {
|
if(player.getInventory().getItemInMainHand().getType() == Material.AIR || player.getInventory().getItemInMainHand() == null) {
|
||||||
msgPlayer(player,colorString("<red>You must hold an Item in hand."));
|
msgPlayer(player,colorTextComp("<red>You must hold an Item in hand."));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
switch (args.length) {
|
switch (args.length) {
|
||||||
case 0, 1 -> msgPlayer(player, colorString("<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(main, "'" + args[0] + "'", "'" + args[1] + "'");
|
||||||
ItemStack it = player.getInventory().getItemInMainHand();
|
ItemStack it = player.getInventory().getItemInMainHand();
|
||||||
|
@ -70,8 +70,8 @@ public class NbtCommand implements TabExecutor {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!ever) {
|
if (!ever) {
|
||||||
lore.add(Component.text(colorString("<red>Attributes:")));
|
lore.add(colorTextComp("<red>Attributes:"));
|
||||||
lore.add(Component.text(colorString(attributes(args[0]) + ": " + (Integer.parseInt(args[1]) + a))));
|
lore.add(colorTextComp(attributes(args[0]) + ": " + (Integer.parseInt(args[1]) + a)));
|
||||||
}
|
}
|
||||||
itm.lore(lore);
|
itm.lore(lore);
|
||||||
it.setItemMeta(itm);
|
it.setItemMeta(itm);
|
||||||
|
@ -90,7 +90,7 @@ public class NbtCommand implements TabExecutor {
|
||||||
attributes.addStrength(player, nbti.getInteger("STRENGTH"));
|
attributes.addStrength(player, nbti.getInteger("STRENGTH"));
|
||||||
}
|
}
|
||||||
it = nbti.getItem();
|
it = nbti.getItem();
|
||||||
msgPlayer(player, Raxen.getPrefix() + colorString("<white>You successfully added the nbt " + attributes(args[0]) + "<white>with " + args[1] + "<white>."));
|
msgPlayer(player, colorTextComp(Raxen.getPrefix() + "<white>You successfully added the nbt " + attributes(args[0]) + "<white>with " + args[1] + "<white>."));
|
||||||
updateSkills(main, player);
|
updateSkills(main, player);
|
||||||
player.getInventory().setItem(player.getInventory().getHeldItemSlot(), it);
|
player.getInventory().setItem(player.getInventory().getHeldItemSlot(), it);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
package gq.unurled.raxen.commands.player;
|
package gq.unurled.raxen.commands.player;
|
||||||
|
|
||||||
import gq.unurled.raxen.Raxen;
|
import gq.unurled.raxen.Raxen;
|
||||||
|
import gq.unurled.raxen.components.player.PlayerUtils;
|
||||||
import gq.unurled.raxen.components.player.attributes.Attributes;
|
import gq.unurled.raxen.components.player.attributes.Attributes;
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.command.Command;
|
import org.bukkit.command.Command;
|
||||||
|
@ -101,7 +102,7 @@ public class SkillsCommand implements TabExecutor {
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
gq.unurled.raxen.utils.Skills.updateSkills(main, player);
|
PlayerUtils.updateSkills(main, player);
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
package gq.unurled.raxen.commands.player;
|
package gq.unurled.raxen.commands.player;
|
||||||
|
|
||||||
import gq.unurled.raxen.Raxen;
|
import gq.unurled.raxen.Raxen;
|
||||||
import gq.unurled.raxen.manager.PlayerManager;
|
import gq.unurled.raxen.manager.entity.PlayerManager;
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.command.Command;
|
import org.bukkit.command.Command;
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
|
@ -17,7 +17,7 @@ import static gq.unurled.raxen.utils.Utils.*;
|
||||||
|
|
||||||
public class StorageCommand implements TabExecutor {
|
public class StorageCommand implements TabExecutor {
|
||||||
|
|
||||||
private PlayerManager playerManager = Raxen.getPlayerManager();
|
private PlayerManager playerManager;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onCommand(@NotNull CommandSender sender, @NotNull Command command, @NotNull String label, @NotNull String[] args) {
|
public boolean onCommand(@NotNull CommandSender sender, @NotNull Command command, @NotNull String label, @NotNull String[] args) {
|
||||||
|
@ -27,6 +27,7 @@ public class StorageCommand implements TabExecutor {
|
||||||
}
|
}
|
||||||
Player player = (Player) sender;
|
Player player = (Player) sender;
|
||||||
Inventory inv;
|
Inventory inv;
|
||||||
|
playerManager = ((Raxen) Bukkit.getPluginManager().getPlugin("Raxen")).getManager().getPlayerManager();
|
||||||
switch (args.length) {
|
switch (args.length) {
|
||||||
case 0:
|
case 0:
|
||||||
if(playerManager.getRaxenPlayer(player).getStorage() == null) {
|
if(playerManager.getRaxenPlayer(player).getStorage() == null) {
|
||||||
|
|
|
@ -4,6 +4,7 @@ import gq.unurled.raxen.Raxen;
|
||||||
import org.bukkit.entity.LivingEntity;
|
import org.bukkit.entity.LivingEntity;
|
||||||
import org.bukkit.persistence.PersistentDataContainer;
|
import org.bukkit.persistence.PersistentDataContainer;
|
||||||
import org.bukkit.persistence.PersistentDataType;
|
import org.bukkit.persistence.PersistentDataType;
|
||||||
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
import static gq.unurled.raxen.utils.Utils.debug;
|
import static gq.unurled.raxen.utils.Utils.debug;
|
||||||
|
|
||||||
|
@ -17,7 +18,7 @@ public class EntityUtils {
|
||||||
namespacedKey = new EntityNamespacedKey(main);
|
namespacedKey = new EntityNamespacedKey(main);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void setNameSpacedKeys(org.bukkit.entity.Entity e, String name, Integer level, int health, int itemHealth, int defense, int itemDefense, int speed, int itemSpeed, int strength, int itemDmg) {
|
public static void setNameSpacedKeys(org.bukkit.entity.@NotNull Entity e, String name, Integer level, int health, int itemHealth, int defense, int itemDefense, int speed, int itemSpeed, int strength, int itemDmg) {
|
||||||
PersistentDataContainer data = e.getPersistentDataContainer();
|
PersistentDataContainer data = e.getPersistentDataContainer();
|
||||||
data.set(namespacedKey.healthKey, PersistentDataType.INTEGER, health);
|
data.set(namespacedKey.healthKey, PersistentDataType.INTEGER, health);
|
||||||
data.set(namespacedKey.itemHealthKey, PersistentDataType.INTEGER, itemHealth);
|
data.set(namespacedKey.itemHealthKey, PersistentDataType.INTEGER, itemHealth);
|
||||||
|
@ -31,7 +32,7 @@ public class EntityUtils {
|
||||||
data.set(namespacedKey.levelKey, PersistentDataType.INTEGER, level);
|
data.set(namespacedKey.levelKey, PersistentDataType.INTEGER, level);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void updateSkills(LivingEntity livingEntity) {
|
public static void updateSkills(@NotNull LivingEntity livingEntity) {
|
||||||
Attributes attributes = new Attributes(main);
|
Attributes attributes = new Attributes(main);
|
||||||
int health, itemHealth, defense, itemDefense, speed, itemSpeed, strength, itemDmg;
|
int health, itemHealth, defense, itemDefense, speed, itemSpeed, strength, itemDmg;
|
||||||
org.bukkit.entity.Entity e = livingEntity;
|
org.bukkit.entity.Entity e = livingEntity;
|
||||||
|
|
|
@ -1,6 +1,8 @@
|
||||||
package gq.unurled.raxen.components.entity;
|
package gq.unurled.raxen.components.entity;
|
||||||
|
|
||||||
import gq.unurled.raxen.Raxen;
|
import gq.unurled.raxen.Raxen;
|
||||||
|
import lombok.Getter;
|
||||||
|
import lombok.Setter;
|
||||||
import net.kyori.adventure.text.Component;
|
import net.kyori.adventure.text.Component;
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
import org.bukkit.NamespacedKey;
|
import org.bukkit.NamespacedKey;
|
||||||
|
@ -13,9 +15,15 @@ public class RaxenEntity {
|
||||||
|
|
||||||
private final Raxen main;
|
private final Raxen main;
|
||||||
|
|
||||||
|
@Getter
|
||||||
private final String name;
|
private final String name;
|
||||||
|
@Getter
|
||||||
private Integer level;
|
private Integer level;
|
||||||
|
@Getter
|
||||||
|
@Setter
|
||||||
private Double health;
|
private Double health;
|
||||||
|
@Getter
|
||||||
|
@Setter
|
||||||
private Double strength;
|
private Double strength;
|
||||||
|
|
||||||
public RaxenEntity(Raxen main, String name, Integer level, Double health, Double strength) {
|
public RaxenEntity(Raxen main, String name, Integer level, Double health, Double strength) {
|
||||||
|
@ -39,4 +47,10 @@ public class RaxenEntity {
|
||||||
data.set(new NamespacedKey(main ,"NAME"), PersistentDataType.STRING, name);
|
data.set(new NamespacedKey(main ,"NAME"), PersistentDataType.STRING, name);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Double getMaxHealth(Entity e) {
|
||||||
|
PersistentDataContainer data = e.getPersistentDataContainer();
|
||||||
|
EntityNamespacedKey key = new EntityNamespacedKey(main);
|
||||||
|
return data.get(key.maxHealth, PersistentDataType.DOUBLE);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,68 @@
|
||||||
|
package gq.unurled.raxen.components.entity.custom;
|
||||||
|
|
||||||
|
import gq.unurled.raxen.Raxen;
|
||||||
|
import lombok.Getter;
|
||||||
|
import lombok.Setter;
|
||||||
|
|
||||||
|
import static gq.unurled.raxen.utils.Utils.colorString;
|
||||||
|
|
||||||
|
public class Entity {
|
||||||
|
|
||||||
|
private final String name;
|
||||||
|
@Getter
|
||||||
|
private Integer level;
|
||||||
|
@Setter
|
||||||
|
private Double health;
|
||||||
|
@Getter
|
||||||
|
@Setter
|
||||||
|
private Double strength;
|
||||||
|
@Getter
|
||||||
|
@Setter
|
||||||
|
private Double defense;
|
||||||
|
@Getter
|
||||||
|
@Setter
|
||||||
|
private Double speed;
|
||||||
|
@Getter
|
||||||
|
@Setter
|
||||||
|
private Double maxHealth;
|
||||||
|
@Getter
|
||||||
|
@Setter
|
||||||
|
private boolean isHostile;
|
||||||
|
|
||||||
|
public Entity(String name, Integer level, Double maxHealth, Double strength, Double defense, Double speed, boolean isHostile) {
|
||||||
|
this.name = name;
|
||||||
|
this.level = level;
|
||||||
|
this.health = maxHealth;
|
||||||
|
this.strength = strength;
|
||||||
|
this.defense = defense;
|
||||||
|
this.speed = speed;
|
||||||
|
this.maxHealth = maxHealth;
|
||||||
|
this.isHostile = isHostile;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void register (Raxen main) {
|
||||||
|
main.getManager().getEntityManager().entities.put(name, this);
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getName() {
|
||||||
|
return "<white>" + name;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getFullName(Entity e) {
|
||||||
|
if (isHostile) {
|
||||||
|
return colorString(getColorLevel() + "<white>⚔️" + getName() + "<red>" + health + "<white>/<white/>" + maxHealth);
|
||||||
|
} else {
|
||||||
|
return colorString(getColorLevel() + "<white>❤️" + getName() + "<red>" + health + "<white>/<white/>" + maxHealth);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getColorLevel() {
|
||||||
|
return level.toString();
|
||||||
|
}
|
||||||
|
|
||||||
|
public Double getHealth() {
|
||||||
|
Double health = 0.0;
|
||||||
|
|
||||||
|
return health;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,24 @@
|
||||||
|
package gq.unurled.raxen.components.entity.custom.hostile.low;
|
||||||
|
|
||||||
|
import gq.unurled.raxen.Raxen;
|
||||||
|
import gq.unurled.raxen.components.entity.RaxenEntity;
|
||||||
|
import gq.unurled.raxen.components.entity.custom.Entity;
|
||||||
|
|
||||||
|
public class Goblin extends Entity {
|
||||||
|
|
||||||
|
RaxenEntity goblin;
|
||||||
|
|
||||||
|
public Goblin(Raxen main) {
|
||||||
|
super("Goblin", 1, 100.0, 10.0, 0.0, 50.0, true);
|
||||||
|
this.goblin = new RaxenEntity(main, "Goblin", 1, 100.0, 10.0);
|
||||||
|
register(main);
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getName() {
|
||||||
|
return "<white>" + goblin.getName();
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getFullName(Entity e) {
|
||||||
|
return "<white>⚔️" + getName() + "<red>" + getHealth() + "<white>/<white/>" + getMaxHealth();
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,6 +1,7 @@
|
||||||
package gq.unurled.raxen.components.gui;
|
package gq.unurled.raxen.components.gui;
|
||||||
|
|
||||||
import gq.unurled.raxen.Raxen;
|
import gq.unurled.raxen.Raxen;
|
||||||
|
import gq.unurled.raxen.components.player.PlayerUtils;
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
import net.kyori.adventure.text.Component;
|
import net.kyori.adventure.text.Component;
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
|
@ -38,7 +39,7 @@ public class ItemListGui implements Listener {
|
||||||
|
|
||||||
public ItemListGui(Raxen main) {
|
public ItemListGui(Raxen main) {
|
||||||
this.main = main;
|
this.main = main;
|
||||||
this.itlist = this.main.getItemManager().getList();
|
this.itlist = this.main.getManager().getItemManager().getList();
|
||||||
this.inv = getInventories();
|
this.inv = getInventories();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -215,7 +216,7 @@ public class ItemListGui implements Listener {
|
||||||
//add to stash
|
//add to stash
|
||||||
//}
|
//}
|
||||||
player.getInventory().addItem(e.getCurrentItem());
|
player.getInventory().addItem(e.getCurrentItem());
|
||||||
gq.unurled.raxen.utils.Skills.updateSkills(main, player);
|
PlayerUtils.updateSkills(main, player);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -47,7 +47,7 @@ public class Dager {
|
||||||
* need Raxen main to be set before calling this method.
|
* need Raxen main to be set before calling this method.
|
||||||
*/
|
*/
|
||||||
public void register() {
|
public void register() {
|
||||||
main.getItemManager().registerItem(dager);
|
main.getManager().getItemManager().registerItem(dager);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
package gq.unurled.raxen.components.lootchest;
|
package gq.unurled.raxen.components.lootchest;
|
||||||
|
|
||||||
import gq.unurled.raxen.Raxen;
|
import gq.unurled.raxen.Raxen;
|
||||||
import gq.unurled.raxen.manager.PlayerManager;
|
import gq.unurled.raxen.manager.entity.PlayerManager;
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
@ -13,7 +13,7 @@ public class GUI {
|
||||||
private static PlayerManager playerManager;
|
private static PlayerManager playerManager;
|
||||||
|
|
||||||
public GUI(Raxen main) {
|
public GUI(Raxen main) {
|
||||||
this.playerManager = main.getPlayerManager();
|
this.playerManager = main.getManager().getPlayerManager();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Inventory addItems(Player player) {
|
public static Inventory addItems(Player player) {
|
||||||
|
|
|
@ -36,7 +36,7 @@ public class CustomLoot {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void tryDropLoot(Location location) {
|
public void tryDropLoot(Location location) {
|
||||||
for (LootItem item : main.getLootManager().getLootTable()) {
|
for (LootItem item : main.getManager().getLootManager().getLootTable()) {
|
||||||
item.tryDropItem(location);
|
item.tryDropItem(location);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,7 +6,7 @@ import gq.unurled.raxen.components.lootchest.loots.CustomLoot;
|
||||||
public class TestSword extends CustomLoot {
|
public class TestSword extends CustomLoot {
|
||||||
|
|
||||||
public TestSword(Raxen main) {
|
public TestSword(Raxen main) {
|
||||||
this.itlist = main.getItemManager().getList();
|
this.itlist = main.getManager().getItemManager().getList();
|
||||||
this.ID = "BEST_NEW_ITEM";
|
this.ID = "BEST_NEW_ITEM";
|
||||||
this.drop_rate = getDrop_rate();
|
this.drop_rate = getDrop_rate();
|
||||||
this.item = registerItem();
|
this.item = registerItem();
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
package gq.unurled.raxen.utils;
|
package gq.unurled.raxen.components.player;
|
||||||
|
|
||||||
import gq.unurled.raxen.Raxen;
|
import gq.unurled.raxen.Raxen;
|
||||||
import gq.unurled.raxen.components.player.attributes.Attributes;
|
import gq.unurled.raxen.components.player.attributes.Attributes;
|
||||||
|
@ -7,7 +7,7 @@ import org.bukkit.entity.Player;
|
||||||
|
|
||||||
import static gq.unurled.raxen.utils.Utils.msgPlayer;
|
import static gq.unurled.raxen.utils.Utils.msgPlayer;
|
||||||
|
|
||||||
public class Skills {
|
public class PlayerUtils {
|
||||||
|
|
||||||
public static void updateSkills(Raxen main, Player player) {
|
public static void updateSkills(Raxen main, Player player) {
|
||||||
Attributes attributes = new Attributes(main);
|
Attributes attributes = new Attributes(main);
|
|
@ -1,7 +1,7 @@
|
||||||
package gq.unurled.raxen.components.player;
|
package gq.unurled.raxen.components.player;
|
||||||
|
|
||||||
import gq.unurled.raxen.Raxen;
|
import gq.unurled.raxen.Raxen;
|
||||||
import gq.unurled.raxen.utils.Vault;
|
import gq.unurled.raxen.utils.libs.Vault;
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.scoreboard.DisplaySlot;
|
import org.bukkit.scoreboard.DisplaySlot;
|
||||||
|
@ -18,7 +18,7 @@ public class Scoreboard {
|
||||||
|
|
||||||
public Scoreboard(Raxen main) {
|
public Scoreboard(Raxen main) {
|
||||||
this.main = main;
|
this.main = main;
|
||||||
this.vault = main.getVault();
|
this.vault = main.getManager().getLibsManager().getVault();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void createScorebord(Player player) {
|
public void createScorebord(Player player) {
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
package gq.unurled.raxen.components.player.classes;
|
package gq.unurled.raxen.components.player.classes;
|
||||||
|
|
||||||
import gq.unurled.raxen.Raxen;
|
import gq.unurled.raxen.Raxen;
|
||||||
import gq.unurled.raxen.manager.PlayerManager;
|
import gq.unurled.raxen.manager.entity.PlayerManager;
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
import lombok.Setter;
|
import lombok.Setter;
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
|
@ -29,7 +29,7 @@ public class Classes {
|
||||||
public void register() {
|
public void register() {
|
||||||
File folder = new File(main.getDataFolder() + "/Class/");
|
File folder = new File(main.getDataFolder() + "/Class/");
|
||||||
File[] listFile = folder.listFiles();
|
File[] listFile = folder.listFiles();
|
||||||
PlayerManager pm = main.getPlayerManager();
|
PlayerManager pm = main.getManager().getPlayerManager();
|
||||||
for (int i = 0; i < listFile.length; i++) {
|
for (int i = 0; i < listFile.length; i++) {
|
||||||
if (listFile[i].isFile()) {
|
if (listFile[i].isFile()) {
|
||||||
FileConfiguration customClass = new YamlConfiguration();
|
FileConfiguration customClass = new YamlConfiguration();
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
package gq.unurled.raxen.components.resourcepack;
|
package gq.unurled.raxen.components.resourcepack;
|
||||||
|
|
||||||
import gq.unurled.raxen.Raxen;
|
import gq.unurled.raxen.Raxen;
|
||||||
import gq.unurled.raxen.manager.ResourcePackManager;
|
import gq.unurled.raxen.manager.server.ResourcePackManager;
|
||||||
import org.bukkit.configuration.file.FileConfiguration;
|
import org.bukkit.configuration.file.FileConfiguration;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.scheduler.BukkitRunnable;
|
import org.bukkit.scheduler.BukkitRunnable;
|
||||||
|
|
|
@ -7,10 +7,10 @@ import gq.unurled.raxen.components.player.Inventories;
|
||||||
import gq.unurled.raxen.components.player.Storage;
|
import gq.unurled.raxen.components.player.Storage;
|
||||||
import gq.unurled.raxen.components.player.attributes.Attributes;
|
import gq.unurled.raxen.components.player.attributes.Attributes;
|
||||||
import gq.unurled.raxen.components.player.storages.EnderChest;
|
import gq.unurled.raxen.components.player.storages.EnderChest;
|
||||||
import gq.unurled.raxen.manager.PlayerManager;
|
import gq.unurled.raxen.manager.entity.PlayerManager;
|
||||||
import gq.unurled.raxen.manager.StorageManager;
|
import gq.unurled.raxen.manager.entity.StorageManager;
|
||||||
import gq.unurled.raxen.utils.Items;
|
import gq.unurled.raxen.utils.Items;
|
||||||
import gq.unurled.raxen.utils.MongoDB;
|
import gq.unurled.raxen.utils.libs.MongoDB;
|
||||||
import net.kyori.adventure.text.Component;
|
import net.kyori.adventure.text.Component;
|
||||||
import org.bson.Document;
|
import org.bson.Document;
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
|
@ -42,10 +42,10 @@ public class PlayerConfig {
|
||||||
|
|
||||||
public PlayerConfig(Raxen main) {
|
public PlayerConfig(Raxen main) {
|
||||||
PlayerConfig.main = main;
|
PlayerConfig.main = main;
|
||||||
sto = Raxen.getStorageManager();
|
sto = main.getManager().getStorageManager();
|
||||||
this.mongoDB = StorageManager.getMongo();
|
this.mongoDB = main.getManager().getLibsManager().getMongoDB();
|
||||||
this.mongoCollection = mongoDB.getMongoCollection();
|
this.mongoCollection = mongoDB.getMongoCollection();
|
||||||
playerManager = Raxen.getPlayerManager();
|
playerManager = main.getManager().getPlayerManager();
|
||||||
this.attributes = new Attributes(main);
|
this.attributes = new Attributes(main);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -29,6 +29,9 @@ public class DamageEntity implements Listener {
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void entityDamageByEntity(EntityDamageByEntityEvent e) {
|
public void entityDamageByEntity(EntityDamageByEntityEvent e) {
|
||||||
|
if (!(e.getEntity() instanceof LivingEntity)) {
|
||||||
|
debug("Not Living Entity, Some block falling shit or block entities");
|
||||||
|
} else {
|
||||||
e.setDamage(0);
|
e.setDamage(0);
|
||||||
Integer damage = 1;
|
Integer damage = 1;
|
||||||
Integer strength = 0;
|
Integer strength = 0;
|
||||||
|
@ -99,6 +102,7 @@ public class DamageEntity implements Listener {
|
||||||
Player playerVictim = (Player) e.getEntity();
|
Player playerVictim = (Player) e.getEntity();
|
||||||
gq.unurled.raxen.components.player.attributes.Attributes attributes = new gq.unurled.raxen.components.player.attributes.Attributes(main);
|
gq.unurled.raxen.components.player.attributes.Attributes attributes = new gq.unurled.raxen.components.player.attributes.Attributes(main);
|
||||||
attributes.setHealth(playerVictim, health);
|
attributes.setHealth(playerVictim, health);
|
||||||
|
playerVictim.setHealth(health.doubleValue()/5);
|
||||||
} else {
|
} else {
|
||||||
Entity entityVictim = e.getEntity();
|
Entity entityVictim = e.getEntity();
|
||||||
PersistentDataContainer data = entityVictim.getPersistentDataContainer();
|
PersistentDataContainer data = entityVictim.getPersistentDataContainer();
|
||||||
|
@ -107,6 +111,7 @@ public class DamageEntity implements Listener {
|
||||||
debug(main, health.toString());
|
debug(main, health.toString());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void entityDamageByBlock(EntityDamageByBlockEvent e) {
|
public void entityDamageByBlock(EntityDamageByBlockEvent e) {
|
||||||
|
|
|
@ -3,6 +3,7 @@ package gq.unurled.raxen.listener.player;
|
||||||
import com.destroystokyo.paper.event.player.PlayerArmorChangeEvent;
|
import com.destroystokyo.paper.event.player.PlayerArmorChangeEvent;
|
||||||
import de.tr7zw.nbtapi.NBTItem;
|
import de.tr7zw.nbtapi.NBTItem;
|
||||||
import gq.unurled.raxen.Raxen;
|
import gq.unurled.raxen.Raxen;
|
||||||
|
import gq.unurled.raxen.components.player.PlayerUtils;
|
||||||
import gq.unurled.raxen.components.player.attributes.Attributes;
|
import gq.unurled.raxen.components.player.attributes.Attributes;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
@ -54,6 +55,6 @@ public class ArmorEvent implements Listener {
|
||||||
attributes.addStrength(player, nbti.getInteger("STRENGTH"));
|
attributes.addStrength(player, nbti.getInteger("STRENGTH"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
gq.unurled.raxen.utils.Skills.updateSkills(main, player);
|
PlayerUtils.updateSkills(main, player);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,8 +1,9 @@
|
||||||
package gq.unurled.raxen.listener.player;
|
package gq.unurled.raxen.listener.player;
|
||||||
|
|
||||||
import gq.unurled.raxen.Raxen;
|
import gq.unurled.raxen.Raxen;
|
||||||
import gq.unurled.raxen.manager.PlayerManager;
|
import gq.unurled.raxen.manager.entity.PlayerManager;
|
||||||
import net.kyori.adventure.text.Component;
|
import net.kyori.adventure.text.Component;
|
||||||
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.event.EventHandler;
|
import org.bukkit.event.EventHandler;
|
||||||
import org.bukkit.event.Listener;
|
import org.bukkit.event.Listener;
|
||||||
|
@ -12,13 +13,14 @@ import static gq.unurled.raxen.utils.Utils.log;
|
||||||
|
|
||||||
public class CloseInventoryEvent implements Listener {
|
public class CloseInventoryEvent implements Listener {
|
||||||
|
|
||||||
private PlayerManager playerManager = Raxen.getPlayerManager();
|
private PlayerManager playerManager;
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void InventoryCloseEvent(InventoryCloseEvent e) {
|
public void InventoryCloseEvent(InventoryCloseEvent e) {
|
||||||
Player player = (Player) e.getPlayer();
|
Player player = (Player) e.getPlayer();
|
||||||
Component title = e.getView().title();
|
Component title = e.getView().title();
|
||||||
if (title.toString().contains("Ender Chest")) {
|
if (title.toString().contains("Ender Chest")) {
|
||||||
|
playerManager = ((Raxen) Bukkit.getPluginManager().getPlugin("Raxen")).getManager().getPlayerManager();
|
||||||
playerManager.getRaxenPlayer(player).setStorage(e.getInventory());
|
playerManager.getRaxenPlayer(player).setStorage(e.getInventory());
|
||||||
}
|
}
|
||||||
log(player.getName() + " " + title.toString());
|
log(player.getName() + " " + title.toString());
|
||||||
|
|
|
@ -2,6 +2,7 @@ package gq.unurled.raxen.listener.player;
|
||||||
|
|
||||||
import de.tr7zw.nbtapi.NBTItem;
|
import de.tr7zw.nbtapi.NBTItem;
|
||||||
import gq.unurled.raxen.Raxen;
|
import gq.unurled.raxen.Raxen;
|
||||||
|
import gq.unurled.raxen.components.player.PlayerUtils;
|
||||||
import gq.unurled.raxen.components.player.attributes.Attributes;
|
import gq.unurled.raxen.components.player.attributes.Attributes;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
@ -54,6 +55,6 @@ public class ItemHandEvent implements Listener {
|
||||||
attributes.addItemStrength(player, nbti.getInteger("STRENGTH"));
|
attributes.addItemStrength(player, nbti.getInteger("STRENGTH"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
gq.unurled.raxen.utils.Skills.updateSkills(main, player);
|
PlayerUtils.updateSkills(main, player);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,7 +4,7 @@ import gq.unurled.raxen.Raxen;
|
||||||
import gq.unurled.raxen.components.player.Scoreboard;
|
import gq.unurled.raxen.components.player.Scoreboard;
|
||||||
import gq.unurled.raxen.components.resourcepack.ResourcePack;
|
import gq.unurled.raxen.components.resourcepack.ResourcePack;
|
||||||
import gq.unurled.raxen.config.PlayerConfig;
|
import gq.unurled.raxen.config.PlayerConfig;
|
||||||
import gq.unurled.raxen.manager.PlayerManager;
|
import gq.unurled.raxen.manager.entity.PlayerManager;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.event.EventHandler;
|
import org.bukkit.event.EventHandler;
|
||||||
import org.bukkit.event.Listener;
|
import org.bukkit.event.Listener;
|
||||||
|
@ -22,8 +22,8 @@ public class JoinEvent implements Listener {
|
||||||
this.main = main;
|
this.main = main;
|
||||||
this.playerConfig = main.getPlayerConfig();
|
this.playerConfig = main.getPlayerConfig();
|
||||||
this.scoreboard = new Scoreboard(main);
|
this.scoreboard = new Scoreboard(main);
|
||||||
this.resourcePack = main.getResourcePackManager().getResourcePack();
|
this.resourcePack = main.getManager().getResourcePackManager().getResourcePack();
|
||||||
this.playerManager = main.getPlayerManager();
|
this.playerManager = main.getManager().getPlayerManager();
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
|
|
|
@ -2,7 +2,7 @@ package gq.unurled.raxen.listener.player;
|
||||||
|
|
||||||
import gq.unurled.raxen.Raxen;
|
import gq.unurled.raxen.Raxen;
|
||||||
import gq.unurled.raxen.config.PlayerConfig;
|
import gq.unurled.raxen.config.PlayerConfig;
|
||||||
import gq.unurled.raxen.manager.PlayerManager;
|
import gq.unurled.raxen.manager.entity.PlayerManager;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.event.EventHandler;
|
import org.bukkit.event.EventHandler;
|
||||||
import org.bukkit.event.Listener;
|
import org.bukkit.event.Listener;
|
||||||
|
@ -17,7 +17,7 @@ public class LeaveEvent implements Listener {
|
||||||
|
|
||||||
public LeaveEvent(Raxen main) {
|
public LeaveEvent(Raxen main) {
|
||||||
this.playerConfig = main.getPlayerConfig();
|
this.playerConfig = main.getPlayerConfig();
|
||||||
this.playerManager = main.getPlayerManager();
|
this.playerManager = main.getManager().getPlayerManager();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -2,7 +2,7 @@ package gq.unurled.raxen.listener.player;
|
||||||
|
|
||||||
import gq.unurled.raxen.Raxen;
|
import gq.unurled.raxen.Raxen;
|
||||||
import gq.unurled.raxen.components.player.Scoreboard;
|
import gq.unurled.raxen.components.player.Scoreboard;
|
||||||
import gq.unurled.raxen.utils.Vault;
|
import gq.unurled.raxen.utils.libs.Vault;
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.event.EventHandler;
|
import org.bukkit.event.EventHandler;
|
||||||
|
@ -17,7 +17,7 @@ public class TransactionEvent implements Listener {
|
||||||
public TransactionEvent(Raxen main) {
|
public TransactionEvent(Raxen main) {
|
||||||
this.main = main;
|
this.main = main;
|
||||||
this.scoreboard = new Scoreboard(main);
|
this.scoreboard = new Scoreboard(main);
|
||||||
this.vault = main.getVault();
|
this.vault = main.getManager().getLibsManager().getVault();
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
|
|
46
src/main/java/gq/unurled/raxen/manager/Manager.java
Normal file
46
src/main/java/gq/unurled/raxen/manager/Manager.java
Normal file
|
@ -0,0 +1,46 @@
|
||||||
|
package gq.unurled.raxen.manager;
|
||||||
|
|
||||||
|
import gq.unurled.raxen.Raxen;
|
||||||
|
import gq.unurled.raxen.manager.entity.*;
|
||||||
|
import gq.unurled.raxen.manager.server.*;
|
||||||
|
import lombok.Getter;
|
||||||
|
|
||||||
|
public class Manager {
|
||||||
|
|
||||||
|
@Getter
|
||||||
|
private static WorldManager worldManager;
|
||||||
|
@Getter
|
||||||
|
private static StorageManager storageManager;
|
||||||
|
@Getter
|
||||||
|
private static PlayerManager playerManager;
|
||||||
|
@Getter
|
||||||
|
private static ListenerManager listenerManager;
|
||||||
|
@Getter
|
||||||
|
private static CommandManager commandManager;
|
||||||
|
@Getter
|
||||||
|
private ItemManager itemManager;
|
||||||
|
@Getter
|
||||||
|
private ResourcePackManager resourcePackManager;
|
||||||
|
@Getter
|
||||||
|
private EntityManager entityManager;
|
||||||
|
@Getter
|
||||||
|
private LootManager lootManager;
|
||||||
|
@Getter
|
||||||
|
private LibsManager libsManager;
|
||||||
|
|
||||||
|
public void set(Raxen main) {
|
||||||
|
libsManager = new LibsManager(main);
|
||||||
|
|
||||||
|
worldManager = new WorldManager(main);
|
||||||
|
storageManager = new StorageManager(main);
|
||||||
|
|
||||||
|
//Managers
|
||||||
|
itemManager = new ItemManager(main);
|
||||||
|
playerManager = new PlayerManager(main);
|
||||||
|
listenerManager = new ListenerManager(main);
|
||||||
|
commandManager = new CommandManager(main);
|
||||||
|
resourcePackManager = new ResourcePackManager(main);
|
||||||
|
entityManager = new EntityManager(main);
|
||||||
|
lootManager = new LootManager(main);
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,4 +1,4 @@
|
||||||
package gq.unurled.raxen.manager;
|
package gq.unurled.raxen.manager.entity;
|
||||||
|
|
||||||
import gq.unurled.raxen.Raxen;
|
import gq.unurled.raxen.Raxen;
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
|
@ -6,20 +6,28 @@ import lombok.Setter;
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.World;
|
import org.bukkit.World;
|
||||||
import org.bukkit.configuration.file.FileConfiguration;
|
import org.bukkit.configuration.file.FileConfiguration;
|
||||||
|
import org.bukkit.entity.Entity;
|
||||||
import org.bukkit.entity.EntityType;
|
import org.bukkit.entity.EntityType;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.UUID;
|
||||||
|
|
||||||
import static gq.unurled.raxen.utils.Utils.debug;
|
import static gq.unurled.raxen.utils.Utils.debug;
|
||||||
|
|
||||||
public class EntityManager {
|
public class EntityManager {
|
||||||
|
|
||||||
private Raxen main;
|
private Raxen main;
|
||||||
|
|
||||||
@Getter
|
@Getter
|
||||||
@Setter
|
@Setter
|
||||||
public List<EntityType> list = new ArrayList<>();
|
public List<EntityType> list = new ArrayList<>();
|
||||||
|
|
||||||
|
public HashMap<String, gq.unurled.raxen.components.entity.custom.Entity> entities = new HashMap<>();
|
||||||
|
|
||||||
|
public HashMap<UUID, Entity> livingEntities = new HashMap<>();
|
||||||
|
|
||||||
public EntityManager(Raxen main) {
|
public EntityManager(Raxen main) {
|
||||||
this.main = main;
|
this.main = main;
|
||||||
}
|
}
|
|
@ -1,4 +1,4 @@
|
||||||
package gq.unurled.raxen.manager;
|
package gq.unurled.raxen.manager.entity;
|
||||||
|
|
||||||
import de.tr7zw.nbtapi.NBTItem;
|
import de.tr7zw.nbtapi.NBTItem;
|
||||||
import gq.unurled.raxen.Raxen;
|
import gq.unurled.raxen.Raxen;
|
|
@ -1,4 +1,4 @@
|
||||||
package gq.unurled.raxen.manager;
|
package gq.unurled.raxen.manager.entity;
|
||||||
|
|
||||||
import gq.unurled.raxen.Raxen;
|
import gq.unurled.raxen.Raxen;
|
||||||
import gq.unurled.raxen.components.lootchest.loots.LootItem;
|
import gq.unurled.raxen.components.lootchest.loots.LootItem;
|
|
@ -1,4 +1,4 @@
|
||||||
package gq.unurled.raxen.manager;
|
package gq.unurled.raxen.manager.entity;
|
||||||
|
|
||||||
import gq.unurled.raxen.Raxen;
|
import gq.unurled.raxen.Raxen;
|
||||||
import gq.unurled.raxen.components.player.RaxenPlayer;
|
import gq.unurled.raxen.components.player.RaxenPlayer;
|
|
@ -1,19 +1,21 @@
|
||||||
package gq.unurled.raxen.manager;
|
package gq.unurled.raxen.manager.entity;
|
||||||
|
|
||||||
import gq.unurled.raxen.Raxen;
|
import gq.unurled.raxen.Raxen;
|
||||||
import gq.unurled.raxen.utils.MongoDB;
|
import gq.unurled.raxen.utils.libs.MongoDB;
|
||||||
import gq.unurled.raxen.utils.Mysql;
|
import gq.unurled.raxen.utils.libs.Mysql;
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.configuration.InvalidConfigurationException;
|
import org.bukkit.configuration.InvalidConfigurationException;
|
||||||
import org.bukkit.configuration.file.FileConfiguration;
|
import org.bukkit.configuration.file.FileConfiguration;
|
||||||
import org.bukkit.configuration.file.YamlConfiguration;
|
import org.bukkit.configuration.file.YamlConfiguration;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
|
||||||
import static gq.unurled.raxen.utils.Utils.*;
|
import static gq.unurled.raxen.utils.Utils.debug;
|
||||||
|
import static gq.unurled.raxen.utils.Utils.error;
|
||||||
|
|
||||||
public class StorageManager {
|
public class StorageManager {
|
||||||
|
|
||||||
|
@ -22,31 +24,28 @@ public class StorageManager {
|
||||||
private static FileConfiguration config;
|
private static FileConfiguration config;
|
||||||
|
|
||||||
@Getter
|
@Getter
|
||||||
private static MongoDB mongo;
|
private static MongoDB mongodb;
|
||||||
@Getter
|
@Getter
|
||||||
private static Mysql mysql;
|
private static Mysql mysql;
|
||||||
|
|
||||||
public StorageManager(Raxen main) {
|
public StorageManager(Raxen main) {
|
||||||
this.main = main.getPlugin();
|
this.main = main;
|
||||||
this.config = main.getConfig();
|
this.config = main.getConfig();
|
||||||
this.mongo = new MongoDB();
|
|
||||||
this.connect();
|
this.connect();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void connect() {
|
public static void connect() {
|
||||||
String s = (String) config.get("storage");
|
String s = (String) config.get("storage");
|
||||||
debug(main, s);
|
debug(main, s);
|
||||||
|
mongodb = main.getManager().getLibsManager().getMongoDB();
|
||||||
if(s.equalsIgnoreCase("MONGODB")) {
|
if(s.equalsIgnoreCase("MONGODB")) {
|
||||||
mongo.connect();
|
mongodb.connect();
|
||||||
warn(main, "'" + s + "'");
|
debug(main, "'" + s + "'");
|
||||||
}
|
} else if(s.equalsIgnoreCase("MYSQL")) {
|
||||||
|
|
||||||
if(s.equalsIgnoreCase("MYSQL")) {
|
|
||||||
error((Raxen) Bukkit.getPluginManager().getPlugin("Raxen"),"Currently not implemented, switching to YML");
|
error((Raxen) Bukkit.getPluginManager().getPlugin("Raxen"),"Currently not implemented, switching to YML");
|
||||||
warn(main, "'" + s + "'");
|
debug(main, "'" + s + "'");
|
||||||
}
|
} else {
|
||||||
else {
|
debug(main, "'" + s + "'");
|
||||||
warn(main, "'" + s + "'");
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -54,7 +53,7 @@ public class StorageManager {
|
||||||
mysql.disconnect();
|
mysql.disconnect();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static FileConfiguration createYml(Player player) {
|
public static @NotNull FileConfiguration createYml(@NotNull Player player) {
|
||||||
File customFile;
|
File customFile;
|
||||||
FileConfiguration customConfig;
|
FileConfiguration customConfig;
|
||||||
customFile = new File(main.getDataFolder() + "/playerInfo/" + player.getUniqueId(), "/playerInfo.yml");
|
customFile = new File(main.getDataFolder() + "/playerInfo/" + player.getUniqueId(), "/playerInfo.yml");
|
||||||
|
@ -98,7 +97,7 @@ public class StorageManager {
|
||||||
return customConfig;
|
return customConfig;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static FileConfiguration createYml(File file) {
|
public static @NotNull FileConfiguration createYml(@NotNull File file) {
|
||||||
|
|
||||||
FileConfiguration customConfig;
|
FileConfiguration customConfig;
|
||||||
|
|
||||||
|
@ -121,7 +120,7 @@ public class StorageManager {
|
||||||
return customConfig;
|
return customConfig;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static FileConfiguration createYml(String path) {
|
public static @NotNull FileConfiguration createYml(String path) {
|
||||||
File customFile;
|
File customFile;
|
||||||
FileConfiguration customConfig;
|
FileConfiguration customConfig;
|
||||||
customFile = new File(path);
|
customFile = new File(path);
|
|
@ -1,4 +1,4 @@
|
||||||
package gq.unurled.raxen.manager;
|
package gq.unurled.raxen.manager.server;
|
||||||
|
|
||||||
import gq.unurled.raxen.Raxen;
|
import gq.unurled.raxen.Raxen;
|
||||||
import gq.unurled.raxen.commands.RaxenCommand;
|
import gq.unurled.raxen.commands.RaxenCommand;
|
||||||
|
@ -18,8 +18,8 @@ public class CommandManager {
|
||||||
private NbtCommand nbtCommand;
|
private NbtCommand nbtCommand;
|
||||||
private TestGuiCommand testGuiCommand = new TestGuiCommand();
|
private TestGuiCommand testGuiCommand = new TestGuiCommand();
|
||||||
private StorageCommand storageCommand = new StorageCommand();
|
private StorageCommand storageCommand = new StorageCommand();
|
||||||
private SkillsCommand skillsCommand = new SkillsCommand(main);
|
private SkillsCommand skillsCommand;
|
||||||
private RaxenCommand raxenCommand = new RaxenCommand(main);
|
private RaxenCommand raxenCommand;
|
||||||
private SpawnEntity entityspawn;
|
private SpawnEntity entityspawn;
|
||||||
private ClassCommand classCommand;
|
private ClassCommand classCommand;
|
||||||
|
|
||||||
|
@ -29,6 +29,8 @@ public class CommandManager {
|
||||||
this.nbtCommand = new NbtCommand(this.main);
|
this.nbtCommand = new NbtCommand(this.main);
|
||||||
this.entityspawn = new SpawnEntity(this.main);
|
this.entityspawn = new SpawnEntity(this.main);
|
||||||
this.classCommand = new ClassCommand(this.main);
|
this.classCommand = new ClassCommand(this.main);
|
||||||
|
this.skillsCommand = new SkillsCommand(main);
|
||||||
|
this.raxenCommand = new RaxenCommand(main);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void register() {
|
public void register() {
|
|
@ -0,0 +1,32 @@
|
||||||
|
package gq.unurled.raxen.manager.server;
|
||||||
|
|
||||||
|
import gq.unurled.raxen.Raxen;
|
||||||
|
import gq.unurled.raxen.utils.libs.*;
|
||||||
|
import lombok.Getter;
|
||||||
|
|
||||||
|
public class LibsManager {
|
||||||
|
@Getter
|
||||||
|
private final ProtocolManager protocolManager;
|
||||||
|
@Getter
|
||||||
|
private final LuckPerm luckPerm;
|
||||||
|
@Getter
|
||||||
|
private final Vault vault;
|
||||||
|
@Getter
|
||||||
|
private final MongoDB mongoDB;
|
||||||
|
@Getter
|
||||||
|
private static Mysql mysql;
|
||||||
|
@Getter
|
||||||
|
private PlaceHolderAPI placeHolderAPI;
|
||||||
|
@Getter
|
||||||
|
private Citizens citizens;
|
||||||
|
|
||||||
|
public LibsManager(Raxen main) {
|
||||||
|
this.luckPerm = new LuckPerm(main);
|
||||||
|
this.luckPerm.register();
|
||||||
|
this.vault = new Vault(main);
|
||||||
|
this.protocolManager = new ProtocolManager(main);
|
||||||
|
this.mongoDB = new MongoDB();
|
||||||
|
this.placeHolderAPI = new PlaceHolderAPI(main);
|
||||||
|
this.citizens = new Citizens(main);
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,4 +1,4 @@
|
||||||
package gq.unurled.raxen.manager;
|
package gq.unurled.raxen.manager.server;
|
||||||
|
|
||||||
import gq.unurled.raxen.Raxen;
|
import gq.unurled.raxen.Raxen;
|
||||||
import gq.unurled.raxen.listener.entity.DamageEntity;
|
import gq.unurled.raxen.listener.entity.DamageEntity;
|
||||||
|
@ -28,7 +28,7 @@ public class ListenerManager {
|
||||||
this.pm.registerEvents(new ItemHandEvent(main), main);
|
this.pm.registerEvents(new ItemHandEvent(main), main);
|
||||||
this.pm.registerEvents(new Reload(), main);
|
this.pm.registerEvents(new Reload(), main);
|
||||||
this.pm.registerEvents(new TransactionEvent(main), main);
|
this.pm.registerEvents(new TransactionEvent(main), main);
|
||||||
this.pm.registerEvents(main.getCommandManager().getItemListCommand().getItemListGui(), main);
|
this.pm.registerEvents(main.getManager().getCommandManager().getItemListCommand().getItemListGui(), main);
|
||||||
this.pm.registerEvents(new DamageEntity(main), main);
|
this.pm.registerEvents(new DamageEntity(main), main);
|
||||||
this.pm.registerEvents(new SpawnEvent(main), main);
|
this.pm.registerEvents(new SpawnEvent(main), main);
|
||||||
this.pm.registerEvents(new ClickBlockEvent(main), main);
|
this.pm.registerEvents(new ClickBlockEvent(main), main);
|
|
@ -1,4 +1,4 @@
|
||||||
package gq.unurled.raxen.manager;
|
package gq.unurled.raxen.manager.server;
|
||||||
|
|
||||||
import com.comphenix.protocol.PacketType;
|
import com.comphenix.protocol.PacketType;
|
||||||
import com.comphenix.protocol.events.ListenerPriority;
|
import com.comphenix.protocol.events.ListenerPriority;
|
||||||
|
@ -9,6 +9,7 @@ import gq.unurled.raxen.Raxen;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
public class ProtocolManager {
|
public class ProtocolManager {
|
||||||
|
|
||||||
private final Raxen main;
|
private final Raxen main;
|
||||||
private com.comphenix.protocol.ProtocolManager manager;
|
private com.comphenix.protocol.ProtocolManager manager;
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
package gq.unurled.raxen.manager;
|
package gq.unurled.raxen.manager.server;
|
||||||
|
|
||||||
import gq.unurled.raxen.Raxen;
|
import gq.unurled.raxen.Raxen;
|
||||||
import gq.unurled.raxen.components.resourcepack.ResourcePack;
|
import gq.unurled.raxen.components.resourcepack.ResourcePack;
|
|
@ -1,6 +1,7 @@
|
||||||
package gq.unurled.raxen.manager;
|
package gq.unurled.raxen.manager.server;
|
||||||
|
|
||||||
import gq.unurled.raxen.Raxen;
|
import gq.unurled.raxen.Raxen;
|
||||||
|
import gq.unurled.raxen.manager.entity.StorageManager;
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.World;
|
import org.bukkit.World;
|
||||||
|
@ -23,7 +24,7 @@ public class WorldManager {
|
||||||
|
|
||||||
public WorldManager(Raxen main) {
|
public WorldManager(Raxen main) {
|
||||||
this.main = main;
|
this.main = main;
|
||||||
this.sto = main.getStorageManager();
|
this.sto = main.getManager().getStorageManager();
|
||||||
if(!(new File(main.getDataFolder() + "/Worlds/").exists())) {
|
if(!(new File(main.getDataFolder() + "/Worlds/").exists())) {
|
||||||
new File(main.getDataFolder() + "/Worlds/").mkdirs();
|
new File(main.getDataFolder() + "/Worlds/").mkdirs();
|
||||||
}
|
}
|
|
@ -1,24 +0,0 @@
|
||||||
package gq.unurled.raxen.utils;
|
|
||||||
|
|
||||||
import gq.unurled.raxen.Raxen;
|
|
||||||
import lombok.Getter;
|
|
||||||
import net.luckperms.api.LuckPerms;
|
|
||||||
import org.bukkit.Bukkit;
|
|
||||||
import org.bukkit.plugin.RegisteredServiceProvider;
|
|
||||||
|
|
||||||
public class LuckPerm {
|
|
||||||
|
|
||||||
private static RegisteredServiceProvider<LuckPerms> provider;
|
|
||||||
@Getter
|
|
||||||
private static LuckPerms api;
|
|
||||||
|
|
||||||
public LuckPerm(Raxen main) {
|
|
||||||
provider = Bukkit.getServicesManager().getRegistration(LuckPerms.class);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void register() {
|
|
||||||
if (provider != null) {
|
|
||||||
api = provider.getProvider();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,39 +0,0 @@
|
||||||
package gq.unurled.raxen.utils;
|
|
||||||
|
|
||||||
import com.mongodb.ConnectionString;
|
|
||||||
import com.mongodb.client.MongoClient;
|
|
||||||
import com.mongodb.client.MongoClients;
|
|
||||||
import com.mongodb.client.MongoCollection;
|
|
||||||
import com.mongodb.client.MongoDatabase;
|
|
||||||
import lombok.Getter;
|
|
||||||
import org.bson.Document;
|
|
||||||
import org.bukkit.Bukkit;
|
|
||||||
|
|
||||||
import static gq.unurled.raxen.utils.Utils.colorTextComp;
|
|
||||||
|
|
||||||
public class MongoDB {
|
|
||||||
@Getter
|
|
||||||
private MongoClient mongoClient;
|
|
||||||
@Getter
|
|
||||||
private MongoDatabase mongoDatabase;
|
|
||||||
@Getter
|
|
||||||
private MongoCollection<Document> mongoCollection;
|
|
||||||
@Getter
|
|
||||||
private MongoCollection<Document> mongoConfigs;
|
|
||||||
|
|
||||||
public void connect() {
|
|
||||||
ConnectionString connectionString = new ConnectionString("mongodb://localhost:27017");
|
|
||||||
mongoClient = MongoClients.create(connectionString);
|
|
||||||
mongoDatabase = mongoClient.getDatabase("Raxen");
|
|
||||||
mongoCollection = mongoDatabase.getCollection("player");
|
|
||||||
mongoConfigs = mongoDatabase.getCollection("config");
|
|
||||||
|
|
||||||
Bukkit.getConsoleSender().sendMessage(colorTextComp("<green>MongoDB connected!"));
|
|
||||||
}
|
|
||||||
|
|
||||||
public void close() {
|
|
||||||
mongoClient.close();
|
|
||||||
|
|
||||||
Bukkit.getConsoleSender().sendMessage(colorTextComp("<red>MongoDB disconnected!"));
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,46 +0,0 @@
|
||||||
package gq.unurled.raxen.utils;
|
|
||||||
|
|
||||||
import gq.unurled.raxen.Raxen;
|
|
||||||
import gq.unurled.raxen.config.Config;
|
|
||||||
import gq.unurled.raxen.manager.StorageManager;
|
|
||||||
import org.bukkit.entity.Player;
|
|
||||||
|
|
||||||
import java.sql.SQLException;
|
|
||||||
|
|
||||||
public class Mysql {
|
|
||||||
|
|
||||||
private static String username;
|
|
||||||
private static String password;
|
|
||||||
private static String url;
|
|
||||||
|
|
||||||
private Raxen main;
|
|
||||||
private StorageManager sto;
|
|
||||||
private Config config;
|
|
||||||
|
|
||||||
public Mysql(Raxen main) {
|
|
||||||
this.main = main;
|
|
||||||
this.sto = main.getStorageManager();
|
|
||||||
this.config = main.getConf();
|
|
||||||
this.username = (String) config.getConfig().get("username");
|
|
||||||
this.url = (String) config.getConfig().get("url");
|
|
||||||
this.password = (String) config.getConfig().get("password");
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void init() {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
public static String get(Player player, String str) throws SQLException {
|
|
||||||
return "False";
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void connect() {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void disconnect() {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
|
@ -4,14 +4,19 @@ import gq.unurled.raxen.Raxen;
|
||||||
import net.kyori.adventure.text.Component;
|
import net.kyori.adventure.text.Component;
|
||||||
import net.kyori.adventure.text.TextComponent;
|
import net.kyori.adventure.text.TextComponent;
|
||||||
import net.kyori.adventure.text.minimessage.MiniMessage;
|
import net.kyori.adventure.text.minimessage.MiniMessage;
|
||||||
|
import net.kyori.adventure.text.minimessage.tag.resolver.TagResolver;
|
||||||
|
import net.kyori.adventure.text.minimessage.tag.standard.StandardTags;
|
||||||
|
import net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer;
|
||||||
import net.kyori.adventure.text.serializer.plain.PlainTextComponentSerializer;
|
import net.kyori.adventure.text.serializer.plain.PlainTextComponentSerializer;
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
|
import org.bukkit.ChatColor;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
import org.bukkit.configuration.file.FileConfiguration;
|
import org.bukkit.configuration.file.FileConfiguration;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.inventory.Inventory;
|
import org.bukkit.inventory.Inventory;
|
||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.ItemStack;
|
||||||
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
public class Utils {
|
public class Utils {
|
||||||
|
|
||||||
|
@ -20,12 +25,28 @@ public class Utils {
|
||||||
* @param stringToComponent a string
|
* @param stringToComponent a string
|
||||||
* @return a component
|
* @return a component
|
||||||
*/
|
*/
|
||||||
public static Component colorComp(String stringToComponent) {
|
public static @NotNull Component colorComp(String stringToComponent) {
|
||||||
return MiniMessage.miniMessage().deserialize(stringToComponent);
|
MiniMessage minimessage = MiniMessage.builder()
|
||||||
|
.tags(TagResolver.builder()
|
||||||
|
.resolver(StandardTags.color())
|
||||||
|
.resolver(StandardTags.decorations())
|
||||||
|
.resolver(StandardTags.reset())
|
||||||
|
.build()
|
||||||
|
)
|
||||||
|
.build();
|
||||||
|
return minimessage.deserialize(stringToComponent);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static TextComponent colorTextComp(String stringToComponent) {
|
public static @NotNull TextComponent colorTextComp(String stringToComponent) {
|
||||||
return (TextComponent) MiniMessage.miniMessage().deserialize(stringToComponent);
|
MiniMessage minimessage = MiniMessage.builder()
|
||||||
|
.tags(TagResolver.builder()
|
||||||
|
.resolver(StandardTags.color())
|
||||||
|
.resolver(StandardTags.decorations())
|
||||||
|
.resolver(StandardTags.reset())
|
||||||
|
.build()
|
||||||
|
)
|
||||||
|
.build();
|
||||||
|
return (TextComponent) minimessage.deserialize(stringToComponent);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -33,8 +54,29 @@ public class Utils {
|
||||||
* @param string a string
|
* @param string a string
|
||||||
* @return a colored string
|
* @return a colored string
|
||||||
*/
|
*/
|
||||||
public static String colorString(String string) {
|
public static @NotNull String colorString(String string) {
|
||||||
return PlainTextComponentSerializer.plainText().serialize(MiniMessage.miniMessage().deserialize(string));
|
MiniMessage minimessage = MiniMessage.builder()
|
||||||
|
.tags(TagResolver.builder()
|
||||||
|
.resolver(StandardTags.color())
|
||||||
|
.resolver(StandardTags.decorations())
|
||||||
|
.resolver(StandardTags.reset())
|
||||||
|
.build()
|
||||||
|
)
|
||||||
|
.build();
|
||||||
|
return LegacyComponentSerializer.legacyAmpersand().serialize(minimessage.deserialize(string));
|
||||||
|
}
|
||||||
|
|
||||||
|
public static String coloredString(String string) {
|
||||||
|
MiniMessage minimessage = MiniMessage.builder()
|
||||||
|
.tags(TagResolver.builder()
|
||||||
|
.resolver(StandardTags.color())
|
||||||
|
.resolver(StandardTags.decorations())
|
||||||
|
.resolver(StandardTags.reset())
|
||||||
|
.build()
|
||||||
|
)
|
||||||
|
.build();
|
||||||
|
return ChatColor.translateAlternateColorCodes('&', LegacyComponentSerializer.legacyAmpersand()
|
||||||
|
.serialize(minimessage.deserialize(string)));
|
||||||
}
|
}
|
||||||
|
|
||||||
public static String decolor(String string) {
|
public static String decolor(String string) {
|
||||||
|
@ -61,6 +103,7 @@ public class Utils {
|
||||||
*/
|
*/
|
||||||
public static void debug(String... strings) {
|
public static void debug(String... strings) {
|
||||||
Raxen main = (Raxen) Bukkit.getPluginManager().getPlugin("Raxen");
|
Raxen main = (Raxen) Bukkit.getPluginManager().getPlugin("Raxen");
|
||||||
|
assert main != null;
|
||||||
FileConfiguration config = main.getConfig();
|
FileConfiguration config = main.getConfig();
|
||||||
if(config.getBoolean("debug")) {
|
if(config.getBoolean("debug")) {
|
||||||
for(String string : strings) {
|
for(String string : strings) {
|
||||||
|
@ -76,6 +119,7 @@ public class Utils {
|
||||||
*/
|
*/
|
||||||
public static void debug(FileConfiguration config, String... strings) {
|
public static void debug(FileConfiguration config, String... strings) {
|
||||||
Raxen main = (Raxen) Bukkit.getPluginManager().getPlugin("Raxen");
|
Raxen main = (Raxen) Bukkit.getPluginManager().getPlugin("Raxen");
|
||||||
|
assert main != null;
|
||||||
if(config.getBoolean("debug")) {
|
if(config.getBoolean("debug")) {
|
||||||
for(String string : strings) {
|
for(String string : strings) {
|
||||||
main.getLogger().info(string);
|
main.getLogger().info(string);
|
||||||
|
|
|
@ -1,48 +0,0 @@
|
||||||
package gq.unurled.raxen.utils;
|
|
||||||
|
|
||||||
import gq.unurled.raxen.Raxen;
|
|
||||||
import lombok.Getter;
|
|
||||||
import net.milkbowl.vault.economy.Economy;
|
|
||||||
import org.bukkit.Bukkit;
|
|
||||||
import org.bukkit.entity.Player;
|
|
||||||
import org.bukkit.plugin.RegisteredServiceProvider;
|
|
||||||
|
|
||||||
import java.text.DecimalFormat;
|
|
||||||
|
|
||||||
import static gq.unurled.raxen.utils.Utils.error;
|
|
||||||
|
|
||||||
public class Vault {
|
|
||||||
@Getter
|
|
||||||
private Economy econ = null;
|
|
||||||
//econ.depositPlayer(player,amount)
|
|
||||||
//econ.withdrawPlayer(player,amount)
|
|
||||||
//econ.getBalance(player);
|
|
||||||
|
|
||||||
|
|
||||||
private static Raxen main;
|
|
||||||
|
|
||||||
public Vault(Raxen main) {
|
|
||||||
this.main = main;
|
|
||||||
setupEconomy();
|
|
||||||
}
|
|
||||||
|
|
||||||
private void setupEconomy() {
|
|
||||||
if (main.getServer().getPluginManager().getPlugin("Vault") == null) {
|
|
||||||
error((Raxen) Bukkit.getPluginManager().getPlugin("Raxen"),"Need to install plugin Vault. (https://github.com/milkbowl/Vault)");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
RegisteredServiceProvider<Economy> rsp = main.getServer().getServicesManager().getRegistration(Economy.class);
|
|
||||||
if (rsp == null) {
|
|
||||||
error((Raxen) Bukkit.getPluginManager().getPlugin("Raxen"),"Some bug happend in the initialisation of Vault and Raxen.");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
econ = rsp.getProvider();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getBalanceString(Player player) {
|
|
||||||
double bal = econ.getBalance(player);
|
|
||||||
DecimalFormat format = new DecimalFormat("#,###.00");
|
|
||||||
return format.format(bal);
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,5 +0,0 @@
|
||||||
package gq.unurled.raxen.utils;
|
|
||||||
|
|
||||||
public class WorldEdit {
|
|
||||||
|
|
||||||
}
|
|
|
@ -3,7 +3,7 @@ version: '${version}'
|
||||||
main: gq.unurled.raxen.Raxen
|
main: gq.unurled.raxen.Raxen
|
||||||
author: unurled
|
author: unurled
|
||||||
api-version: 1.18
|
api-version: 1.18
|
||||||
depend: [ProtocolLib]
|
depend: [ProtocolLib, PlaceholderAPI]
|
||||||
softdepend: [AureliumSkills, LuckPerms]
|
softdepend: [AureliumSkills, LuckPerms]
|
||||||
|
|
||||||
commands:
|
commands:
|
||||||
|
|
Loading…
Reference in a new issue