0.5.5
This commit is contained in:
parent
8122ecbe70
commit
21f32349ee
29 changed files with 284 additions and 228 deletions
2
.gitignore
vendored
2
.gitignore
vendored
|
@ -128,3 +128,5 @@ buildNumber.properties
|
|||
run/
|
||||
/.gradle/
|
||||
/gradle/
|
||||
|
||||
resource_pack/raxen/assets/minecraft/
|
||||
|
|
33
build.gradle
33
build.gradle
|
@ -2,7 +2,7 @@ plugins {
|
|||
id 'java'
|
||||
id 'maven-publish'
|
||||
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.9"
|
||||
}
|
||||
|
||||
apply plugin: "java"
|
||||
|
@ -60,27 +60,27 @@ dependencies {
|
|||
testCompileOnly 'org.projectlombok:lombok:1.18.24'
|
||||
|
||||
// mongo stuff
|
||||
implementation 'org.mongodb:mongodb-driver-sync:4.7.1'
|
||||
implementation 'org.mongodb:bson:4.7.1'
|
||||
implementation 'org.mongodb:mongodb-driver-core:4.7.1'
|
||||
implementation 'org.mongodb:mongodb-driver-sync:4.7.2'
|
||||
implementation 'org.mongodb:bson:4.7.2'
|
||||
implementation 'org.mongodb:mongodb-driver-core:4.7.2'
|
||||
|
||||
implementation 'de.tr7zw:item-nbt-api-plugin:2.10.0'
|
||||
compileOnly 'io.papermc.paper:paper-api:1.19-R0.1-SNAPSHOT'
|
||||
compileOnly 'io.papermc.paper:paper-api:1.19.2-R0.1-SNAPSHOT'
|
||||
compileOnly 'com.comphenix.protocol:ProtocolLib:4.8.0'
|
||||
compileOnly 'net.luckperms:api:5.4'
|
||||
compileOnly 'com.github.MilkBowl:VaultAPI:1.7.1'
|
||||
compileOnly 'net.essentialsx:EssentialsX:2.19.4'
|
||||
compileOnly 'net.essentialsx:EssentialsX:2.19.7'
|
||||
//compileOnly 'com.fastasyncworldedit:FastAsyncWorldEdit-Core:2.3.0'
|
||||
//compileOnly 'com.fastasyncworldedit:FastAsyncWorldEdit-Bukkit:2.3.0'
|
||||
compileOnly 'me.clip:placeholderapi:2.11.1'
|
||||
compileOnly 'me.clip:placeholderapi:2.11.2'
|
||||
//compileOnly 'net.citizensnpcs:citizens-main:2.0.30-SNAPSHOT'
|
||||
compileOnly 'com.onarandombox.multiversecore:Multiverse-Core:4.3.1'
|
||||
compileOnly fileTree(dir: 'libs', include: '*.jar')
|
||||
paperweightDevelopmentBundle("io.papermc.paper:dev-bundle:1.19-R0.1-SNAPSHOT")
|
||||
paperweightDevelopmentBundle("io.papermc.paper:dev-bundle:1.19.2-R0.1-SNAPSHOT")
|
||||
}
|
||||
|
||||
group = 'me.unurled'
|
||||
version = '0.5.4'
|
||||
version = '0.5.5'
|
||||
description = 'Raxen'
|
||||
|
||||
java {
|
||||
|
@ -110,9 +110,9 @@ tasks {
|
|||
shadowJar {
|
||||
dependencies {
|
||||
include dependency('de.tr7zw:item-nbt-api-plugin:2.10.0')
|
||||
include dependency('org.mongodb:mongodb-driver-sync:4.5.1')
|
||||
include dependency('org.mongodb:bson:4.5.1')
|
||||
include dependency('org.mongodb:mongodb-driver-core:4.5.1')
|
||||
include dependency('org.mongodb:mongodb-driver-sync:4.7.2')
|
||||
include dependency('org.mongodb:bson:4.7.2')
|
||||
include dependency('org.mongodb:mongodb-driver-core:4.7.2')
|
||||
}
|
||||
relocate("de.tr7zw.changeme", "me.unurled.libs.de.tr7zw")
|
||||
relocate("de.tr7zw", "me.unurled.libs.de.tr7zw")
|
||||
|
@ -123,8 +123,7 @@ shadowJar {
|
|||
}
|
||||
}
|
||||
|
||||
gradle.projectsEvaluated {
|
||||
tasks.withType(JavaCompile) {
|
||||
options.compilerArgs << "-Xlint:unchecked" << "-Xlint:deprecation"
|
||||
}
|
||||
}
|
||||
|
||||
tasks.withType(JavaCompile) {
|
||||
options.compilerArgs += ["-Xlint:unchecked", "-Xlint:deprecation"]
|
||||
}
|
||||
|
|
2
gradle/wrapper/gradle-wrapper.properties
vendored
2
gradle/wrapper/gradle-wrapper.properties
vendored
|
@ -1,5 +1,5 @@
|
|||
distributionBase=GRADLE_USER_HOME
|
||||
distributionPath=wrapper/dists
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-7.4.2-bin.zip
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-7.5.1-bin.zip
|
||||
zipStoreBase=GRADLE_USER_HOME
|
||||
zipStorePath=wrapper/dists
|
||||
|
|
|
@ -1,14 +0,0 @@
|
|||
{
|
||||
"providers": [
|
||||
{
|
||||
"chars":
|
||||
[
|
||||
"ꀀ"
|
||||
],
|
||||
"file": "minecraft:/recipe_showcase.png",
|
||||
"ascent":40,
|
||||
"height":164,
|
||||
"type":"bitmap"
|
||||
}
|
||||
]
|
||||
}
|
|
@ -1,15 +0,0 @@
|
|||
{
|
||||
"parent": "item/generated",
|
||||
"textures": {
|
||||
"layer0": "item/compass_16"
|
||||
},
|
||||
"overrides": [
|
||||
{
|
||||
"predicate": {
|
||||
"custom_model_data": 1
|
||||
},
|
||||
"model": "raxen/item/device"
|
||||
}
|
||||
|
||||
]
|
||||
}
|
|
@ -1,20 +0,0 @@
|
|||
{
|
||||
"parent":"item/handheld",
|
||||
"textures": {
|
||||
"layer0":"item/diamond_axe"
|
||||
},
|
||||
"overrides": [
|
||||
{
|
||||
"predicate": {
|
||||
"custom_model_data":1
|
||||
},
|
||||
"model":"default/magical_axe"
|
||||
},
|
||||
{
|
||||
"predicate": {
|
||||
"custom_model_data":2
|
||||
},
|
||||
"model":"default/battle_axe"
|
||||
}
|
||||
]
|
||||
}
|
|
@ -1,25 +0,0 @@
|
|||
{
|
||||
"parent": "minecraft:item/handheld",
|
||||
"textures": {
|
||||
"layer0": "minecraft:item/diamond_shovel"
|
||||
},
|
||||
"overrides": [
|
||||
{
|
||||
"predicate": {
|
||||
"custom_model_data": 1
|
||||
},
|
||||
"model":"raxen/item/device"
|
||||
},
|
||||
{
|
||||
"predicate": {
|
||||
"custom_model_data": 2
|
||||
},
|
||||
"model":"raxen/gui/lower_section"
|
||||
},{
|
||||
"predicate": {
|
||||
"custom_model_data": 3
|
||||
},
|
||||
"model":"raxen/gui/upper_section"
|
||||
}
|
||||
]
|
||||
}
|
|
@ -1,27 +0,0 @@
|
|||
{
|
||||
"textures": {
|
||||
"texture": "raxen/gui/lower_section"
|
||||
},
|
||||
"elements": [
|
||||
{
|
||||
"from": [ -16, -16, 15.9375 ],
|
||||
"to": [ 32, 32, 16 ],
|
||||
"faces": {
|
||||
"north": { "uv": [ 11, 16, 0, 5 ], "rotation": 180, "texture": "#texture" },
|
||||
"south": { "uv": [ 0, 5, 11, 16 ], "texture": "#texture" }
|
||||
}
|
||||
}
|
||||
],
|
||||
"display": {
|
||||
"firstperson_lefthand": {
|
||||
"rotation": [ 0, 0, 0 ],
|
||||
"translation": [ 0, 0, 0 ],
|
||||
"scale": [ 0, 0, 0 ]
|
||||
},
|
||||
"gui": {
|
||||
"rotation": [ 0, 0, 0 ],
|
||||
"translation": [ 72, -74, -80 ],
|
||||
"scale": [ 3.66, 3.66, 3.66 ]
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,27 +0,0 @@
|
|||
{
|
||||
"textures": {
|
||||
"texture": "raxen/gui/upper_section"
|
||||
},
|
||||
"elements": [
|
||||
{
|
||||
"from": [ -16, -16, 15.9375 ],
|
||||
"to": [ 32, 32, 16 ],
|
||||
"faces": {
|
||||
"north": { "uv": [ 11, 16, 0, 5 ], "rotation": 180, "texture": "#texture" },
|
||||
"south": { "uv": [ 0, 5, 11, 16 ], "texture": "#texture" }
|
||||
}
|
||||
}
|
||||
],
|
||||
"display": {
|
||||
"firstperson_lefthand": {
|
||||
"rotation": [ 0, 0, 0 ],
|
||||
"translation": [ 0, 0, 0 ],
|
||||
"scale": [ 0, 0, 0 ]
|
||||
},
|
||||
"gui": {
|
||||
"rotation": [ 0, 0, 0 ],
|
||||
"translation": [ 72, 29, -80 ],
|
||||
"scale": [ 3.66, 3.66, 3.66 ]
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,37 +0,0 @@
|
|||
{
|
||||
"credit": "Made with Blockbench",
|
||||
"texture_size": [32, 32],
|
||||
"textures": {
|
||||
"0": "raxen/item/device"
|
||||
},
|
||||
"elements": [
|
||||
{
|
||||
"from": [5, 4, 7],
|
||||
"to": [12, 12, 9],
|
||||
"faces": {
|
||||
"north": {"uv": [7, 0, 14, 8], "texture": "#0"},
|
||||
"east": {"uv": [2, 8, 4, 16], "texture": "#0"},
|
||||
"south": {"uv": [0, 0, 7, 8], "texture": "#0"},
|
||||
"west": {"uv": [0, 8, 2, 16], "texture": "#0"},
|
||||
"up": {"uv": [11, 10, 4, 8], "rotation": 180, "texture": "#0"},
|
||||
"down": {"uv": [11, 10, 4, 12], "rotation": 180, "texture": "#0"}
|
||||
}
|
||||
}
|
||||
],
|
||||
"display": {
|
||||
"thirdperson_righthand": {
|
||||
"translation": [0, 4, 1]
|
||||
},
|
||||
"firstperson_righthand": {
|
||||
"rotation": [-12, -25, 0]
|
||||
},
|
||||
"gui": {
|
||||
"translation": [-0.75, 0, 0],
|
||||
"scale": [1.5, 1.5, 1.5]
|
||||
},
|
||||
"fixed": {
|
||||
"rotation": [0, -180, 0],
|
||||
"scale": [1.5, 1.5, 1.5]
|
||||
}
|
||||
}
|
||||
}
|
Binary file not shown.
Before Width: | Height: | Size: 1.6 KiB |
Binary file not shown.
Before Width: | Height: | Size: 3.4 KiB |
Binary file not shown.
Before Width: | Height: | Size: 3.4 KiB |
Binary file not shown.
Before Width: | Height: | Size: 201 B |
|
@ -18,7 +18,7 @@ import static me.unurled.raxen.utils.Utils.colorComp;
|
|||
public final class Raxen extends JavaPlugin {
|
||||
|
||||
private static final String prefix = "<aqua>Rx</aqua><light_purple>></light_purple> ";
|
||||
@Getter private static String version = "0.5.4";
|
||||
@Getter private static String version = "0.5.5";
|
||||
private final PluginManager pm = getServer().getPluginManager();
|
||||
|
||||
private static Raxen plugin;
|
||||
|
|
|
@ -0,0 +1,2 @@
|
|||
package me.unurled.raxen.commands.admin;public class EntitiyCommand {
|
||||
}
|
|
@ -0,0 +1,2 @@
|
|||
package me.unurled.raxen.commands.admin;public class ItemTo64 {
|
||||
}
|
|
@ -2,19 +2,27 @@ package me.unurled.raxen.commands.admin;
|
|||
|
||||
import me.unurled.raxen.Raxen;
|
||||
import me.unurled.raxen.components.entity.other.EntityNamespacedKey;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.command.TabExecutor;
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.entity.EntityType;
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.inventory.EntityEquipment;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
||||
import static me.unurled.raxen.components.entity.other.EntityUtils.setNameSpacedKeys;
|
||||
import static me.unurled.raxen.utils.Items.itemFrom64;
|
||||
import static me.unurled.raxen.utils.Utils.*;
|
||||
|
||||
public class SpawnEntity implements TabExecutor {
|
||||
|
@ -30,23 +38,99 @@ 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(colorString("<red>Console can't execute this command!"));
|
||||
return false;
|
||||
log(colorTextComp("<red>Console can't execute this command!"));
|
||||
try { // /entityspawn ZOMBIE "&cHello folks" x:0 y:0 z:0 level health defense speed strength itemStackBinary64: helmet, chestplate, leggings, boots, main-hand, off-hand
|
||||
if (validateArgs(args, 16)) {
|
||||
args = setNullInArgs(args);
|
||||
} else {
|
||||
log(colorTextComp("<red>Please use null if you don't want some parameters in the command.</red>"));
|
||||
log(colorTextComp("<red>Follow this command: /entityspawn TYPE \"name\" x y z level health defense speed strength " +
|
||||
"helmet(itemStackBinary64) chestplate(itemStackBinary64) leggings(itemStackBinary64) boots(itemStackBinary64) main-hand(itemStackBinary64) off-hand(itemStackBinary64)</red>"));
|
||||
return false;
|
||||
}
|
||||
|
||||
EntityType types = EntityType.valueOf(args[0]);
|
||||
Location loc = new Location(Bukkit.getWorld("world"), Double.parseDouble(args[2]), Double.parseDouble(args[3]), Double.parseDouble(args[4]));
|
||||
Entity e = loc.getWorld().spawnEntity(loc, types, false);
|
||||
setNameSpacedKeys(e, getStringFromArg(args), Integer.parseInt(args[6]), Integer.parseInt(args[7]),0,
|
||||
Integer.parseInt(args[8]),0, Integer.parseInt(args[9]),0, Integer.parseInt(args[10]),0);
|
||||
e.customName(colorTextComp(getStringFromArg(args)));
|
||||
e.setCustomNameVisible(true);
|
||||
if (e instanceof LivingEntity livingEntity) {
|
||||
// livingEntity.getEquipment().set
|
||||
ItemStack helmet = itemFrom64(args[11]);
|
||||
ItemStack chestplate = itemFrom64(args[12]);
|
||||
ItemStack leggins = itemFrom64(args[13]);
|
||||
ItemStack boots = itemFrom64(args[14]);
|
||||
ItemStack mainhand = itemFrom64(args[15]);
|
||||
ItemStack offhand = itemFrom64(args[14]);
|
||||
EntityEquipment equip = livingEntity.getEquipment();
|
||||
equip.setHelmet(helmet);
|
||||
equip.setChestplate(chestplate);
|
||||
equip.setLeggings(leggins);
|
||||
equip.setBoots(boots);
|
||||
equip.setItemInMainHand(mainhand);
|
||||
equip.setItemInOffHand(offhand);
|
||||
}
|
||||
|
||||
System.out.println(e.getName());
|
||||
} catch (IllegalArgumentException e) {
|
||||
error("Something happened near the SpawnEntity command.");
|
||||
throw new RuntimeException(e);
|
||||
} catch (IOException e) {
|
||||
error("Could not deserialize item from the command EntitySpawn (command launched by " + sender.getName() + ")");
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
for (String arg : args) {
|
||||
log(arg);
|
||||
}
|
||||
Player player = (Player) sender;
|
||||
if (!player.hasPermission("raxen.entityspawn.cmd")) {
|
||||
player.sendMessage(noPerms());
|
||||
return false;
|
||||
}
|
||||
//example command : /entityspawn ZOMBIE "&cHello folks" 50 200
|
||||
try {
|
||||
EntityType types = EntityType.valueOf(args[0]);
|
||||
Entity e = player.getWorld().spawnEntity(player.getLocation(), types, false);
|
||||
setNameSpacedKeys(e, "<red>Name", 100, 100,0,50,0,100,0,100,0);
|
||||
e.customName(colorTextComp(args[1]));
|
||||
e.setCustomNameVisible(true);
|
||||
} catch (IllegalArgumentException e) {
|
||||
try { // /entityspawn ZOMBIE "&cHello folks" x:0 y:0 z:0 level health defense speed strength itemStackBinary64: helmet, chestplate, leggings, boots, main-hand, off-hand
|
||||
if (validateArgs(args, 16)) {
|
||||
args = setNullInArgs(args);
|
||||
} else {
|
||||
log(colorTextComp("<red>Please use null if you don't want some parameters in the command.</red>"));
|
||||
log(colorTextComp("<red>Follow this command: /entityspawn TYPE \"name\" x y z level health defense speed strength " +
|
||||
"helmet(itemStackBinary64) chestplate(itemStackBinary64) leggings(itemStackBinary64) boots(itemStackBinary64) main-hand(itemStackBinary64) off-hand(itemStackBinary64)</red>"));
|
||||
return false;
|
||||
}
|
||||
|
||||
EntityType types = EntityType.valueOf(args[0]);
|
||||
Location loc = new Location(Bukkit.getWorld("world"), Double.parseDouble(args[2]), Double.parseDouble(args[3]), Double.parseDouble(args[4]));
|
||||
Entity e = loc.getWorld().spawnEntity(loc, types, false);
|
||||
setNameSpacedKeys(e, getStringFromArg(args), Integer.parseInt(args[6]), Integer.parseInt(args[7]),0,
|
||||
Integer.parseInt(args[8]),0, Integer.parseInt(args[9]),0, Integer.parseInt(args[10]),0);
|
||||
e.customName(colorTextComp(getStringFromArg(args)));
|
||||
e.setCustomNameVisible(true);
|
||||
if (e instanceof LivingEntity livingEntity) {
|
||||
// livingEntity.getEquipment().set
|
||||
ItemStack helmet = itemFrom64(args[11]);
|
||||
ItemStack chestplate = itemFrom64(args[12]);
|
||||
ItemStack leggins = itemFrom64(args[13]);
|
||||
ItemStack boots = itemFrom64(args[14]);
|
||||
ItemStack mainhand = itemFrom64(args[15]);
|
||||
ItemStack offhand = itemFrom64(args[14]);
|
||||
EntityEquipment equip = livingEntity.getEquipment();
|
||||
equip.setHelmet(helmet);
|
||||
equip.setChestplate(chestplate);
|
||||
equip.setLeggings(leggins);
|
||||
equip.setBoots(boots);
|
||||
equip.setItemInMainHand(mainhand);
|
||||
equip.setItemInOffHand(offhand);
|
||||
}
|
||||
|
||||
System.out.println(e.getName());
|
||||
} catch (IllegalArgumentException e) {
|
||||
error("Something happened near the SpawnEntity command.");
|
||||
throw new RuntimeException(e);
|
||||
} catch (IOException e) {
|
||||
error("Could not deserialize item from the command EntitySpawn (command launched by " + sender.getName() + ")");
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
|
||||
return false;
|
||||
|
|
|
@ -4,10 +4,7 @@ import me.unurled.raxen.Raxen;
|
|||
import me.unurled.raxen.utils.libs.Vault;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.scoreboard.DisplaySlot;
|
||||
import org.bukkit.scoreboard.Objective;
|
||||
import org.bukkit.scoreboard.Score;
|
||||
import org.bukkit.scoreboard.ScoreboardManager;
|
||||
import org.bukkit.scoreboard.*;
|
||||
|
||||
import static me.unurled.raxen.utils.Utils.*;
|
||||
|
||||
|
@ -24,17 +21,17 @@ public class Scoreboard {
|
|||
public void createScorebord(Player player) {
|
||||
ScoreboardManager manager = Bukkit.getScoreboardManager();
|
||||
org.bukkit.scoreboard.Scoreboard board = manager.getNewScoreboard();
|
||||
Objective obj = board.registerNewObjective("Raxen","dummy", colorTextComp("<red>Elixium"));
|
||||
Objective obj = board.registerNewObjective("Raxen", "dummy", colorTextComp("<red>Elixium"));
|
||||
obj.setDisplaySlot(DisplaySlot.SIDEBAR);
|
||||
Score score = obj.getScore(colorString("<gold>-------------"));
|
||||
Score score = obj.getScore(textCompToString(colorTextComp("<gold>-------------")));
|
||||
score.setScore(4);
|
||||
Score score1 = obj.getScore(colorString("<aqua>Name:" + player.getName()));
|
||||
Score score1 = obj.getScore(textCompToString(colorTextComp("<aqua>Name:" + player.getName())));
|
||||
score1.setScore(3);
|
||||
Score score2 = obj.getScore(colorString("<white>Location"));
|
||||
Score score2 = obj.getScore(textCompToString(colorTextComp("<white>Location")));
|
||||
score2.setScore(2);
|
||||
Score score3 = obj.getScore(colorString("<gold>Coins: <gold>" + vault.getBalanceString(player)));
|
||||
Score score3 = obj.getScore(textCompToString(colorTextComp("<gold>Coins: <gold>" + vault.getBalanceString(player))));
|
||||
score3.setScore(1);
|
||||
Score score4 = obj.getScore(colorString("<yellow>unurled.me"));
|
||||
Score score4 = obj.getScore(textCompToString(colorTextComp("<yellow>unurled.me")));
|
||||
score4.setScore(0);
|
||||
player.setScoreboard(board);
|
||||
}
|
||||
|
@ -50,7 +47,8 @@ public class Scoreboard {
|
|||
}
|
||||
}
|
||||
player.getScoreboard().resetScores("Coins");
|
||||
Score score = objective.getScore(colorString("<gold>Coins: <gold>" + vault.getBalanceString(player)));
|
||||
assert objective != null;
|
||||
Score score = objective.getScore(textCompToString(colorTextComp("<gold>Coins: <gold>" + vault.getBalanceString(player))));
|
||||
score.setScore(1);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -15,6 +15,8 @@ import org.bukkit.event.entity.EntityDamageByEntityEvent;
|
|||
import org.bukkit.persistence.PersistentDataContainer;
|
||||
import org.bukkit.persistence.PersistentDataType;
|
||||
|
||||
import java.util.Objects;
|
||||
|
||||
import static me.unurled.raxen.utils.Utils.debug;
|
||||
|
||||
public class DamageEntity implements Listener {
|
||||
|
@ -46,10 +48,9 @@ public class DamageEntity implements Listener {
|
|||
Integer health = 0;
|
||||
Integer itemHealth = 0;
|
||||
Integer initDamage = 0;
|
||||
PlayerManager pm = ((Raxen) Bukkit.getPluginManager().getPlugin("Raxen")).getManager().getPlayerManager();
|
||||
PlayerManager pm = ((Raxen) Objects.requireNonNull(Bukkit.getPluginManager().getPlugin("Raxen"))).getManager().getPlayerManager();
|
||||
debug(main, e.getEntity().getName(), e.getEntity().getType().toString(), e.getDamager().getType().toString(), e.getDamager().getName());
|
||||
if (e.getDamager() instanceof Player) {
|
||||
Player playerDamager = (Player) e.getDamager();
|
||||
if (e.getDamager() instanceof Player playerDamager) {
|
||||
strength = pm.getStrength().get(playerDamager);
|
||||
itemStrength = pm.getItemStrength().get(playerDamager);
|
||||
} else {
|
||||
|
@ -60,8 +61,7 @@ public class DamageEntity implements Listener {
|
|||
}
|
||||
itemStrength = pm.getItemStrength().getItem((LivingEntity) entityDamager);
|
||||
}
|
||||
if (e.getEntity() instanceof Player) {
|
||||
Player playerVictim = (Player) e.getEntity();
|
||||
if (e.getEntity() instanceof Player playerVictim) {
|
||||
me.unurled.raxen.components.entity.player.attributes.Attributes attributes = new me.unurled.raxen.components.entity.player.attributes.Attributes(main);
|
||||
defense = pm.getDefense().get(playerVictim);
|
||||
health = pm.getHealth().get(playerVictim);
|
||||
|
@ -93,7 +93,7 @@ public class DamageEntity implements Listener {
|
|||
debug(main, String.valueOf(health_with_defense));
|
||||
if (damage >= health_with_defense) {
|
||||
debug(main, "Killed entity normally.");
|
||||
e.setDamage(e.getEntity().getType().getDefaultAttributes().getAttribute(Attribute.GENERIC_MAX_HEALTH).getDefaultValue());
|
||||
e.setDamage(Objects.requireNonNull(e.getEntity().getType().getDefaultAttributes().getAttribute(Attribute.GENERIC_MAX_HEALTH)).getDefaultValue());
|
||||
} else {
|
||||
debug(main, "Applying damage to entity.");
|
||||
if (defense == 0) {
|
||||
|
@ -101,8 +101,7 @@ public class DamageEntity implements Listener {
|
|||
} else {
|
||||
health = health_with_defense - health - damage;
|
||||
}
|
||||
if (e.getEntity() instanceof Player) {
|
||||
Player playerVictim = (Player) e.getEntity();
|
||||
if (e.getEntity() instanceof Player playerVictim) {
|
||||
me.unurled.raxen.components.entity.player.attributes.Attributes attributes = new me.unurled.raxen.components.entity.player.attributes.Attributes(main);
|
||||
pm.getHealth().set(playerVictim, health);
|
||||
playerVictim.setHealth(health.doubleValue()/5);
|
||||
|
|
|
@ -0,0 +1,18 @@
|
|||
package me.unurled.raxen.listener.player;
|
||||
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.Listener;
|
||||
import org.bukkit.event.player.PlayerInteractEvent;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
public class InteractEvent implements Listener {
|
||||
@EventHandler
|
||||
public void PlayerInteractEvent(PlayerInteractEvent e) {
|
||||
// Player p = e.getPlayer();
|
||||
// if (e.hasItem()) {
|
||||
// ItemStack i = e.getItem();
|
||||
// }
|
||||
}
|
||||
}
|
|
@ -0,0 +1,21 @@
|
|||
package me.unurled.raxen.listener.player;
|
||||
|
||||
import me.unurled.raxen.Raxen;
|
||||
import me.unurled.raxen.manager.entity.PlayerManager;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.Listener;
|
||||
import org.bukkit.event.player.PlayerRespawnEvent;
|
||||
|
||||
import static me.unurled.raxen.utils.Utils.msgPlayer;
|
||||
|
||||
public class RespawnEvent implements Listener {
|
||||
@EventHandler
|
||||
public void PlayerRespawnEvent(PlayerRespawnEvent e) {
|
||||
Player p = e.getPlayer();
|
||||
PlayerManager pm = ((Raxen) Bukkit.getPluginManager().getPlugin("Raxen")).getManager().getPlayerManager();
|
||||
pm.getHealth().set(p, pm.getMaxHealth().get(p));
|
||||
msgPlayer(p, "<red>You have been killed. You lost something deep in you...</red>");
|
||||
}
|
||||
}
|
|
@ -15,6 +15,8 @@ import org.bukkit.scheduler.BukkitTask;
|
|||
import java.util.HashMap;
|
||||
import java.util.UUID;
|
||||
|
||||
import static me.unurled.raxen.utils.Utils.*;
|
||||
|
||||
public class PlayerManager {
|
||||
|
||||
private Raxen main;
|
||||
|
@ -61,9 +63,11 @@ public class PlayerManager {
|
|||
BukkitTask task = new BukkitRunnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
player.sendActionBar(Component.text(pm.getHealth().get(player) + "/" + pm.getMaxHealth().get(player) + "❤ " + pm.getMana().get(player) + "/" + pm.getMaxMana().get(player)));
|
||||
player.sendActionBar(colorComp("<red>" + pm.getHealth().get(player) + "/" +
|
||||
pm.getMaxHealth().get(player) + "❤</red> <aqua>" + pm.getMana().get(player) + "/" +
|
||||
pm.getMaxMana().get(player) + "</aqua>"));
|
||||
}
|
||||
}.runTaskTimer(main, 0L, 20L);
|
||||
}.runTaskTimerAsynchronously(main, 10, 20);
|
||||
if(actionBar.containsKey(player.getUniqueId())) {
|
||||
actionBar.replace(player.getUniqueId(), task);
|
||||
} else {
|
||||
|
@ -80,6 +84,8 @@ public class PlayerManager {
|
|||
BukkitTask task = actionBar.get(player.getUniqueId());
|
||||
task.cancel();
|
||||
actionBar.remove(player.getUniqueId());
|
||||
} else {
|
||||
debug(colorTextComp("<red>Player " + player.getName() + " didn't have any Action Bar" + player.getUniqueId().toString() + "</red>"));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -22,20 +22,24 @@ public class CommandManager {
|
|||
private SkillsCommand skillsCommand;
|
||||
private RaxenCommand raxenCommand;
|
||||
private SpawnEntity entityspawn;
|
||||
private EntitiyCommand entitiyCommand;
|
||||
private ClassCommand classCommand;
|
||||
private CustomModelDataCommand customModelDataCommand;
|
||||
private MainGuiCommand mainGuiCommand;
|
||||
private ItemTo64Command itemTo64Command;
|
||||
|
||||
public CommandManager(Raxen main) {
|
||||
this.main = main;
|
||||
this.itemListCommand = new ItemListCommand(this.main);
|
||||
this.nbtCommand = new NbtCommand(this.main);
|
||||
this.entityspawn = new SpawnEntity(this.main);
|
||||
this.entitiyCommand = new EntitiyCommand();
|
||||
this.classCommand = new ClassCommand(this.main);
|
||||
this.skillsCommand = new SkillsCommand(main);
|
||||
this.raxenCommand = new RaxenCommand(main);
|
||||
this.skillsCommand = new SkillsCommand(this.main);
|
||||
this.raxenCommand = new RaxenCommand(this.main);
|
||||
this.customModelDataCommand = new CustomModelDataCommand();
|
||||
this.mainGuiCommand = new MainGuiCommand(main);
|
||||
this.mainGuiCommand = new MainGuiCommand(this.main);
|
||||
this.itemTo64Command = new ItemTo64Command();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -75,6 +79,8 @@ public class CommandManager {
|
|||
|
||||
main.getCommand("main_gui").setTabCompleter(mainGuiCommand);
|
||||
main.getCommand("main_gui").setExecutor(mainGuiCommand);
|
||||
}
|
||||
|
||||
main.getCommand("itemto64").setTabCompleter(itemTo64Command);
|
||||
main.getCommand("itemto64").setExecutor(itemTo64Command);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -28,7 +28,7 @@ public class ResourcePackManager {
|
|||
}
|
||||
|
||||
/**
|
||||
* Method to enable the ressourcpack
|
||||
* Method to enable the ressourcepack
|
||||
*/
|
||||
private void enable() {
|
||||
if(useRP) {
|
||||
|
|
|
@ -393,7 +393,7 @@ public class Items {
|
|||
* @return a string
|
||||
* @throws IllegalStateException stream errors
|
||||
*/
|
||||
private static @NotNull String itemTo64(ItemStack stack) throws IllegalStateException {
|
||||
public static @NotNull String itemTo64(ItemStack stack) throws IllegalStateException {
|
||||
try {
|
||||
ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
|
||||
BukkitObjectOutputStream dataOutput = new BukkitObjectOutputStream(outputStream);
|
||||
|
@ -414,7 +414,10 @@ public class Items {
|
|||
* @return itemstack
|
||||
* @throws IOException stream error
|
||||
*/
|
||||
private static ItemStack itemFrom64(String data) throws IOException {
|
||||
public static ItemStack itemFrom64(String data) throws IOException {
|
||||
if (data != null) {
|
||||
return new ItemStack(Material.AIR);
|
||||
}
|
||||
try {
|
||||
ByteArrayInputStream inputStream = new ByteArrayInputStream(Base64Coder.decodeLines(data));
|
||||
BukkitObjectInputStream dataInput = new BukkitObjectInputStream(inputStream);
|
||||
|
|
|
@ -112,7 +112,7 @@ public class Utils {
|
|||
|
||||
/**
|
||||
* Strips all color from a string.
|
||||
* @param string the string that want's to be decolored.
|
||||
* @param string the string that wants to be decolored.
|
||||
* @return a decolored string
|
||||
*/
|
||||
public static String decolor(String string) {
|
||||
|
@ -163,6 +163,21 @@ public class Utils {
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* debug output to console if debug is set to true in config
|
||||
* @param comps output to console
|
||||
*/
|
||||
public static void debug(TextComponent... comps) {
|
||||
Raxen main = (Raxen) Bukkit.getPluginManager().getPlugin("Raxen");
|
||||
assert main != null;
|
||||
FileConfiguration config = main.getConfig();
|
||||
if(config.getBoolean("debug")) {
|
||||
for(TextComponent comp : comps) {
|
||||
main.getLogger().info(textCompToString(comp));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Log the strings to the console
|
||||
* @param main a main instance running
|
||||
|
@ -366,4 +381,62 @@ public class Utils {
|
|||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* get a string from args which contains ""
|
||||
* @param args a string list
|
||||
* @return a string
|
||||
*/
|
||||
public static String getStringFromArg(String[] args) {
|
||||
String result = "";
|
||||
boolean getFColon = false;
|
||||
boolean getLColon = false;
|
||||
for (String arg : args) {
|
||||
if (arg.contains("\"")) {
|
||||
if (!getFColon) {
|
||||
getFColon = true;
|
||||
} else if (getFColon && !getLColon) {
|
||||
result += arg.replace("\"", "");
|
||||
return result;
|
||||
} else if (getFColon) {
|
||||
result += arg.replace("\"", "");
|
||||
}
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* search if there is an args that is null or do not exist
|
||||
* @param args a list of string
|
||||
* @param n a number of entries a list should have
|
||||
* @return a boolean if true or not
|
||||
*/
|
||||
public static Boolean validateArgs(String[] args, Integer n) {
|
||||
for (int i = 0; i < n ; i++) {
|
||||
if (args.length < n-1) {
|
||||
return false;
|
||||
} else if (args[i] == null) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* changes every "null" in list to the object null
|
||||
* @param args a list of strings
|
||||
* @return return a new list
|
||||
*/
|
||||
public static String[] setNullInArgs(String[] args) {
|
||||
String[] newList = new String[args.length];
|
||||
for (int i = 0 ; i < args.length ; i++) {
|
||||
if (args[i].equalsIgnoreCase("null")) {
|
||||
newList[i] = null;
|
||||
} else {
|
||||
newList[i] = args[i];
|
||||
}
|
||||
}
|
||||
return newList;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
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,8 +13,7 @@ import org.bukkit.configuration.file.FileConfiguration;
|
|||
|
||||
import java.util.Objects;
|
||||
|
||||
import static me.unurled.raxen.utils.Utils.colorComp;
|
||||
import static me.unurled.raxen.utils.Utils.log;
|
||||
import static me.unurled.raxen.utils.Utils.*;
|
||||
|
||||
public class MongoDB {
|
||||
@Getter
|
||||
|
@ -29,7 +29,7 @@ public class MongoDB {
|
|||
FileConfiguration config = Objects.requireNonNull(Bukkit.getPluginManager().getPlugin("Raxen")).getConfig();
|
||||
String uri = (String) config.get("url");
|
||||
assert uri != null;
|
||||
log("URI" + uri);
|
||||
debug("URI " + uri);
|
||||
ConnectionString connectionString = new ConnectionString(uri);
|
||||
mongoClient = MongoClients.create(connectionString);
|
||||
mongoDatabase = mongoClient.getDatabase("Raxen");
|
||||
|
|
|
@ -4,7 +4,7 @@ main: me.unurled.raxen.Raxen
|
|||
author: unurled
|
||||
api-version: 1.19
|
||||
depend: [ProtocolLib, PlaceholderAPI, 'Multiverse-Core']
|
||||
softdepend: [AureliumSkills, LuckPerms]
|
||||
softdepend: [LuckPerms, Essentials]
|
||||
|
||||
commands:
|
||||
reloadplugin:
|
||||
|
@ -29,6 +29,8 @@ commands:
|
|||
description: Open ItemList menu
|
||||
entityspawn:
|
||||
description: Spawn an custom entity
|
||||
entity:
|
||||
description: Spawn an custom entity
|
||||
class:
|
||||
description: player command that make them choose their class and then their stats
|
||||
custommodeldata:
|
||||
|
@ -38,6 +40,8 @@ commands:
|
|||
description: set custom model data to item
|
||||
main_gui:
|
||||
description: not very much used, more with right click on device
|
||||
itemto64:
|
||||
description: transform an item to it's 64encoded byte
|
||||
|
||||
permissions:
|
||||
raxen.reload.cmd:
|
||||
|
@ -52,9 +56,13 @@ permissions:
|
|||
description: itemlist command permission
|
||||
raxen.entityspawn.cmd:
|
||||
description: entityspawn command permission
|
||||
raxen.entity.cmd:
|
||||
description: entity command permission
|
||||
raxen.class.cmd:
|
||||
description: class command permission
|
||||
raxen.custommodeldata.cmd:
|
||||
description: custom model data command permission
|
||||
raxen.maingui.cmd:
|
||||
description: main gui command permission
|
||||
description: main gui command permission
|
||||
raxen.itemto64.cmd:
|
||||
description: item to 64 command permission
|
||||
|
|
Loading…
Add table
Reference in a new issue