This commit is contained in:
parent
d58e3da6ac
commit
ced4c0d186
122 changed files with 13914 additions and 524 deletions
|
@ -3,9 +3,12 @@ package me.unurled.sacredrealms.sr.utils;
|
|||
import static me.unurled.sacredrealms.sr.utils.Component.comp;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
import me.unurled.sacredrealms.sr.SR;
|
||||
import me.unurled.sacredrealms.sr.components.attributes.Attribute;
|
||||
import me.unurled.sacredrealms.sr.components.player.PlayerManager;
|
||||
import me.unurled.sacredrealms.sr.components.player.SRPlayer;
|
||||
import me.unurled.srcore.api.Manager;
|
||||
import org.bukkit.attribute.AttributeInstance;
|
||||
import org.bukkit.entity.Display;
|
||||
import org.bukkit.entity.Entity;
|
||||
|
@ -18,6 +21,8 @@ import org.jetbrains.annotations.NotNull;
|
|||
|
||||
public class SRPlayerUtils {
|
||||
|
||||
private static final Random RANDOM = new Random();
|
||||
|
||||
private SRPlayerUtils() {}
|
||||
|
||||
public static void syncPlayerToSR(@NotNull Player p, @NotNull SRPlayer sr) {
|
||||
|
@ -58,7 +63,11 @@ public class SRPlayerUtils {
|
|||
p.updateInventory();
|
||||
}
|
||||
|
||||
public static void updateActionBar(@NotNull Player p, @NotNull SRPlayer sr) {
|
||||
public static void updateActionBar(@NotNull Player p) {
|
||||
PlayerManager pm = Manager.getInstance(PlayerManager.class);
|
||||
if (pm == null) return;
|
||||
SRPlayer sr = pm.getPlayer(p.getUniqueId());
|
||||
if (sr == null) return;
|
||||
int maxHealth = (int) sr.getAttribute(Attribute.HEALTH);
|
||||
int health = (int) sr.getHealth();
|
||||
int mana = (int) sr.getAttribute(Attribute.MANA);
|
||||
|
@ -80,11 +89,17 @@ public class SRPlayerUtils {
|
|||
Vector spawnVector = location.add(facingVector.multiply(0.75));
|
||||
|
||||
// summon entity
|
||||
|
||||
double randomX = RANDOM.nextDouble() * 0.5 - 0.25;
|
||||
double randomZ = RANDOM.nextDouble() * 0.5 - 0.25;
|
||||
spawnVector.add(new Vector(randomX, 0, randomZ));
|
||||
|
||||
TextDisplay indicators =
|
||||
eventEntity
|
||||
.getWorld()
|
||||
.spawn(
|
||||
spawnVector.toLocation(eventEntity.getWorld()).add(0, 0.7, 0), TextDisplay.class);
|
||||
spawnVector.toLocation(eventEntity.getWorld()).add(0.0, 0.5, 0.0),
|
||||
TextDisplay.class);
|
||||
String prefix = "<red>-";
|
||||
if (isHeal) prefix = "<green>+";
|
||||
|
||||
|
@ -114,6 +129,6 @@ public class SRPlayerUtils {
|
|||
}
|
||||
height++;
|
||||
}
|
||||
}.runTaskTimer(SR.getInstance(), 0, 1);
|
||||
}.runTaskTimer(SR.getPlugin(), 0, 1);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue