update to 1.18.2, and bug fixes
This commit is contained in:
unurled 2022-03-20 00:35:06 +01:00
parent e217fa80d7
commit 0b861e39bd
30 changed files with 224 additions and 160 deletions

View file

@ -29,7 +29,7 @@ public class RaxenCommand implements TabExecutor {
if(sender instanceof Player) {
Player player = (Player) sender;
if(!(player.hasPermission("raxen."))) {
msgPlayer(player, Raxen.getPrefix() + color("&cYou can't execute this command. Insufficient permission."));
msgPlayer(player, Raxen.getPrefix().append(colorTextComp("<red>You can't execute this command. Insufficient permission.")));
}
switch (args.length) {
case 0 -> msgPl(player, 0);
@ -37,13 +37,14 @@ public class RaxenCommand implements TabExecutor {
switch (args[0]) {
case "mongodb", "mongo", "MONGODB", "MONGO" -> {
//print info about connection
sender.sendMessage(Raxen.getPrefix() + color("&6Printing About Raxen's MongoDB connection..."));
msgPlayer(player, Raxen.getPrefix() + color("&6---------------------------------------------"),
color("&cMONGO DB"));
sender.sendMessage(Raxen.getPrefix().append(colorTextComp("<gold>Printing About Raxen's MongoDB connection...")));
msgPlayer(player, Raxen.getPrefix()
.append(colorTextComp("<gold>---------------------------------------------")));
msgPlayer(player, colorTextComp("<red>MONGO DB<white>"));
msgPlayer(player, StorageManager.getMongo().getMongoClient().getClusterDescription().toString());
msgPlayer(player, StorageManager.getMongo().getMongoDatabase().getName());
msgPlayer(player, StorageManager.getMongo().getMongoCollection().getNamespace().toString());
msgPlayer(player, color("&6---------------------------------------------"));
msgPlayer(player, "<gold>---------------------------------------------");
}
case "v", "version", "ver" -> {
msgPl(player, 0);
@ -59,37 +60,37 @@ public class RaxenCommand implements TabExecutor {
log(String.valueOf(args.length));
switch (args.length) {
case 0 -> {
sender.sendMessage(Raxen.getPrefix() + color("&6Printing About Raxen..."),
color("&6---------------------------------------------"),
color("&3 Raxen "),
color("&3 - Version: " + Raxen.getVersion()),
color("&3 - Author: &l&cU&6n&eu&2r&al&be&3d&r"));
TextComponent txt = Component.text(color("&3 - Website: https://unurled.gq"));
msgSender(sender, Raxen.getPrefix() + colorString("<gold>Printing About Raxen..."),
colorString("<gold>---------------------------------------------"),
colorString("<dark_aqua> Raxen "),
colorString("<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>"));
TextComponent txt = Component.text(colorString("<dark_aqua> - Website: https://unurled.gq"));
sender.sendMessage(txt);
sender.sendMessage(color("&6---------------------------------------------"));
sender.sendMessage(colorString("<gold>---------------------------------------------"));
return true;
}
case 1 -> {
switch (args[0]) {
case "mongodb", "mongo", "MONGODB", "MONGO" -> {
//print info about connection
sender.sendMessage(Raxen.getPrefix() + color("&6Printing About Raxen's MongoDB connection..."));
sender.sendMessage(color("&6---------------------------------------------"), color("&cMONGO DB"));
sender.sendMessage(Raxen.getPrefix() + colorString("<gold>Printing About Raxen's MongoDB connection..."));
sender.sendMessage(colorString("<gold>---------------------------------------------"), colorString("<red>MONGO DB"));
sender.sendMessage(StorageManager.getMongo().getMongoClient().getClusterDescription().toString());
sender.sendMessage(StorageManager.getMongo().getMongoDatabase().getName());
sender.sendMessage(StorageManager.getMongo().getMongoCollection().getNamespace().toString());
sender.sendMessage(color("&6---------------------------------------------"));
sender.sendMessage(colorString("<gold>---------------------------------------------"));
return true;
}
case "v", "version", "ver" -> {
sender.sendMessage(Raxen.getPrefix() + color("&6Printing About Raxen..."),
color("&6---------------------------------------------"),
color("&3 Raxen "),
color("&3 - Version: " + Raxen.getVersion()),
color("&3 - Author: &l&cU&6n&eu&2r&al&be&3d&r"));
TextComponent txt= Component.text(color("&3 - Website: https://unurled.gq"));
sender.sendMessage(Raxen.getPrefix() + colorString("<gold>Printing About Raxen..."),
colorString("<gold>---------------------------------------------"),
colorString("<dark_aqua> Raxen "),
colorString("<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>"));
TextComponent txt= Component.text(colorString("<dark_aqua> - Website: https://unurled.gq"));
sender.sendMessage(txt);
sender.sendMessage(color("&6---------------------------------------------"));
sender.sendMessage(colorString("<gold>---------------------------------------------"));
return true;
}
case "hemlp", "?", "h" ->
@ -105,15 +106,15 @@ public class RaxenCommand implements TabExecutor {
public void msgPl(Player player, Integer in) {
switch(in) {
case 0:
msgPlayer(player, Raxen.getPrefix() + color("&6Printing About Raxen..."),
color("&6---------------------------------------------"),
color("&3 Raxen "),
color("&3 - Version: " + Raxen.getVersion()),
color("&3 - Author: &l&cU&6n&eu&2r&al&be&3d&r"));
TextComponent txt = Component.text(color("&3 - Website: https://unurled.gq"))
msgPlayer(player, Raxen.getPrefix() + "<gold>Printing About Raxen...",
"<gold>---------------------------------------------",
"<dark_aqua> Raxen ",
"<dark_aqua> - Version: " + Raxen.getVersion(),
"<dark_aqua> - Author: <b><red>U<gold>n&eu<dark_green>r<green>l<aqua>e<dark_aqua>d<reset>");
TextComponent txt = (TextComponent) colorComp("<dark_aqua> - Website: https://unurled.gq")
.clickEvent(ClickEvent.openUrl("https://unurled.gq"));
player.sendMessage(txt);
msgPlayer(player, "", color("&6---------------------------------------------"));
msgPlayer(player, "", "<gold>---------------------------------------------");
}
}

View file

@ -34,7 +34,7 @@ public class ItemListCommand implements TabExecutor {
}
Player player = (Player) sender;
if(!(player.hasPermission("raxen.itemlist.cmd"))) {
msgPlayer(player, color("&cYou'dont have the permission to execute this command."));
msgPlayer(player, colorString("<red>You'dont have the permission to execute this command."));
return true;
}
//openGui logic

View file

@ -4,6 +4,7 @@ import de.tr7zw.nbtapi.NBTItem;
import gq.unurled.raxen.Raxen;
import gq.unurled.raxen.components.player.attributes.Attributes;
import net.kyori.adventure.text.Component;
import org.bukkit.Bukkit;
import org.bukkit.Material;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
@ -32,16 +33,16 @@ public class NbtCommand implements TabExecutor {
@Override
public boolean onCommand(@NotNull CommandSender sender, @NotNull Command cmd, @NotNull String msg, @NotNull String[] args) {
if(!(sender instanceof Player)) {
error(color("&cYou can't execute this command as the Console!"));
error((Raxen) Bukkit.getPluginManager().getPlugin("Raxen"),colorString("<red>You can't execute this command as the Console!"));
return true;
}
Player player = (Player) sender;
if(player.getInventory().getItemInMainHand().getType() == Material.AIR || player.getInventory().getItemInMainHand() == null) {
msgPlayer(player,color("&cYou must hold an Item in hand."));
msgPlayer(player,colorString("<red>You must hold an Item in hand."));
return true;
}
switch (args.length) {
case 0, 1 -> msgPlayer(player, color("&cYou must specify an nbt and an int."));
case 0, 1 -> msgPlayer(player, colorString("<red>You must specify an nbt and an int."));
case 2 -> {
debug(main, "'" + args[0] + "'", "'" + args[1] + "'");
ItemStack it = player.getInventory().getItemInMainHand();
@ -62,15 +63,15 @@ public class NbtCommand implements TabExecutor {
ever = true;
} else {
if (yes) {
ct.append(Component.text(color(attributes(args[0]) + ": " + (Integer.parseInt(args[1]) + a))));
ct.append(Component.text(colorString(attributes(args[0]) + ": " + (Integer.parseInt(args[1]) + a))));
yes = false;
}
}
}
}
if (!ever) {
lore.add(Component.text(color("&cAttributes:")));
lore.add(Component.text(color(attributes(args[0]) + ": " + (Integer.parseInt(args[1]) + a))));
lore.add(Component.text(colorString("<red>Attributes:")));
lore.add(Component.text(colorString(attributes(args[0]) + ": " + (Integer.parseInt(args[1]) + a))));
}
itm.lore(lore);
it.setItemMeta(itm);
@ -89,7 +90,7 @@ public class NbtCommand implements TabExecutor {
attributes.addStrength(player, nbti.getInteger("STRENGTH"));
}
it = nbti.getItem();
msgPlayer(player, Raxen.getPrefix() + color("&fYou successfully added the nbt " + attributes(args[0]) + "&fwith " + args[1] + "&f."));
msgPlayer(player, Raxen.getPrefix() + colorString("<white>You successfully added the nbt " + attributes(args[0]) + "<white>with " + args[1] + "<white>."));
updateSkills(main, player);
player.getInventory().setItem(player.getInventory().getHeldItemSlot(), it);
}

View file

@ -24,7 +24,7 @@ public class ReloadCommand implements TabExecutor {
}
}
Reload.kickAll();
log(color("&cServer stopping!\n Using: /rlpl.\n Please wait a little bit."));
log(colorString("<red>Server stopping!\n Using: /rlpl.\n Please wait a little bit."));
Bukkit.getServer().shutdown();
return false;
}

View file

@ -30,7 +30,7 @@ public class SpawnEntity implements TabExecutor {
@Override
public boolean onCommand(@NotNull CommandSender sender, @NotNull Command command, @NotNull String label, @NotNull String[] args) {
if (!(sender instanceof Player)) {
log(color("&cConsole can't execute this command!"));
log(colorString("<red>Console can't execute this command!"));
return false;
}
Player player = (Player) sender;
@ -41,8 +41,8 @@ public class SpawnEntity implements TabExecutor {
//example command : /entityspawn ZOMBIE "&cHello folks" 50 200
EntityType type = EntityType.valueOf(args[0]);
Entity e = player.getWorld().spawnEntity(player.getLocation(), type, false);
setNameSpacedKeys(e, "&cName", 100, 100,0,50,0,100,0,100,0);
e.setCustomName(color(args[1]));
setNameSpacedKeys(e, "<red>Name", 100, 100,0,50,0,100,0,100,0);
e.customName(colorTextComp(args[1]));
e.setCustomNameVisible(true);
return false;
}

View file

@ -1,6 +1,5 @@
package gq.unurled.raxen.commands.admin;
import net.kyori.adventure.text.Component;
import org.bukkit.Bukkit;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
@ -11,7 +10,7 @@ import org.jetbrains.annotations.Nullable;
import java.util.List;
import static gq.unurled.raxen.utils.Utils.color;
import static gq.unurled.raxen.utils.Utils.colorTextComp;
import static gq.unurled.raxen.utils.Utils.log;
public class TestGuiCommand implements TabExecutor {
@ -20,7 +19,7 @@ public class TestGuiCommand implements TabExecutor {
if(sender instanceof Player) {
Player player = (Player) sender;
if(player.hasPermission("raxen.test.gui.cmd")) {
player.openInventory(Bukkit.createInventory(null, 54, Component.text(color(args[0]))));
player.openInventory(Bukkit.createInventory(null, 54, colorTextComp(args[0])));
}
}
else {

View file

@ -1,6 +1,7 @@
package gq.unurled.raxen.commands.player;
import gq.unurled.raxen.Raxen;
import org.bukkit.Bukkit;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.command.TabExecutor;
@ -23,7 +24,7 @@ public class ClassCommand implements TabExecutor {
@Override
public boolean onCommand(@NotNull CommandSender sender, @NotNull Command command, @NotNull String label, @NotNull String[] args) {
if(!(sender instanceof Player)) {
error("The console can't execute this Command!");
error((Raxen) Bukkit.getPluginManager().getPlugin("Raxen"),"The console can't execute this Command!");
return true;
}
Player player = (Player) sender;

View file

@ -2,7 +2,7 @@ package gq.unurled.raxen.commands.player;
import gq.unurled.raxen.Raxen;
import gq.unurled.raxen.components.player.attributes.Attributes;
import net.kyori.adventure.text.Component;
import org.bukkit.Bukkit;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.command.TabExecutor;
@ -25,7 +25,7 @@ public class SkillsCommand implements TabExecutor {
@Override
public boolean onCommand(@NotNull CommandSender sender, @NotNull Command command, @NotNull String msg, @NotNull String[] args) {
if(!(sender instanceof Player)) {
error("The console can't execute this Command!");
error((Raxen) Bukkit.getPluginManager().getPlugin("Raxen"),"The console can't execute this Command!");
return true;
}
Player player = (Player) sender;
@ -33,12 +33,12 @@ public class SkillsCommand implements TabExecutor {
switch (args.length) {
case 0:
//open gui
player.sendMessage(Component.text(color("&cGUI not implemented yet..")).append(Component.text(color("&cTry /skill help."))));
player.sendMessage(colorTextComp("<red>GUI not implemented yet..").append(colorTextComp("<red>Try /skill help.")));
break;
case 1:
case 2:
player.sendMessage(Component.text(color("&fUse the command like: "))
.append(Component.text(color("&f/skill &3{health|defense|speed|strength} {add|set|remove} {amount}"))));
player.sendMessage(colorTextComp("<white>Use the command like: ")
.append(colorTextComp("<white>/skill <dark_aqua>{health|defense|speed|strength} {add|set|remove} {amount}")));
break;
case 3:
switch (args[0]) {

View file

@ -22,7 +22,7 @@ public class StorageCommand implements TabExecutor {
@Override
public boolean onCommand(@NotNull CommandSender sender, @NotNull Command command, @NotNull String label, @NotNull String[] args) {
if(!(sender instanceof Player)) {
error("The console can't execute this Command!");
error((Raxen) Bukkit.getPluginManager().getPlugin("Raxen"),"The console can't execute this Command!");
return true;
}
Player player = (Player) sender;
@ -39,7 +39,7 @@ public class StorageCommand implements TabExecutor {
case 1:
Player p = Bukkit.getPlayer(args[0]);
if(p == null) {
msgPlayer(player, color("&cYou can't open the Storage of an unknown Player."));
msgPlayer(player, colorString("<red>You can't open the Storage of an unknown Player."));
return true;
}
inv = playerManager.getRaxenPlayer(player).getStorage().getEc().getEc();