Dotenv doesnt work and renaming
This commit is contained in:
parent
f3ccf080ea
commit
a40fba2753
17 changed files with 429 additions and 412 deletions
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -111,3 +111,4 @@ buildNumber.properties
|
|||
|
||||
# Common working directory
|
||||
run/
|
||||
.env
|
5
pom.xml
5
pom.xml
|
@ -101,5 +101,10 @@
|
|||
<version>4.7.0</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>io.github.cdimascio</groupId>
|
||||
<artifactId>dotenv-java</artifactId>
|
||||
<version>2.3.1</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</project>
|
||||
|
|
|
@ -1,73 +1,39 @@
|
|||
package me.night.nullvalkyrie;
|
||||
|
||||
import io.github.cdimascio.dotenv.Dotenv;
|
||||
import me.night.nullvalkyrie.chests.MenuListener;
|
||||
import me.night.nullvalkyrie.discord.DiscordClientManager;
|
||||
import me.night.nullvalkyrie.enchantments.EnchantmentManager;
|
||||
import me.night.nullvalkyrie.events.CustomItemEvents;
|
||||
import me.night.nullvalkyrie.events.DamageEffect;
|
||||
import me.night.nullvalkyrie.events.*;
|
||||
import me.night.nullvalkyrie.items.CustomItemManager;
|
||||
import me.night.nullvalkyrie.npc.ClickNPC;
|
||||
import me.night.nullvalkyrie.npc.NPC;
|
||||
import me.night.nullvalkyrie.npc.PacketInjector;
|
||||
import me.night.nullvalkyrie.rank.ScoreboardListener;
|
||||
import me.night.nullvalkyrie.util.FileManager;
|
||||
import me.night.nullvalkyrie.util.Util;
|
||||
import me.night.nullvalkyrie.npc.*;
|
||||
import me.night.nullvalkyrie.ui.ScoreboardListener;
|
||||
import me.night.nullvalkyrie.util.*;
|
||||
import me.night.nullvalkyrie.commands.*;
|
||||
import me.night.nullvalkyrie.database.DatabaseManager;
|
||||
import org.bukkit.*;
|
||||
import org.bukkit.boss.BarColor;
|
||||
import org.bukkit.boss.BarStyle;
|
||||
import org.bukkit.boss.BossBar;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.Listener;
|
||||
import org.bukkit.event.player.PlayerJoinEvent;
|
||||
import org.bukkit.event.server.ServerListPingEvent;
|
||||
import org.bukkit.plugin.java.JavaPlugin;
|
||||
public final class Main extends JavaPlugin {
|
||||
|
||||
import java.io.File;
|
||||
|
||||
public final class Main extends JavaPlugin implements Listener {
|
||||
private BossBar bossbar;
|
||||
private PacketInjector injector;
|
||||
|
||||
@Override
|
||||
public void onEnable() {
|
||||
getConfig().options().copyDefaults();
|
||||
saveDefaultConfig();
|
||||
// Dotenv env = Dotenv.configure().directory("C:\\Users\\NK\\OneDrive\\Desktop\\.nky\\Coding\\Java\\NullValkyrie\\src\\main\\resources").filename(".env").load();
|
||||
// System.out.println(env.get("MONGO"));
|
||||
EnchantmentManager.register();
|
||||
new CustomItemManager(this);
|
||||
new FileManager();
|
||||
new CommandManager(this).register();
|
||||
bossbar = Bukkit.createBossBar(ChatColor.GOLD + "Kuudra", BarColor.RED, BarStyle.SEGMENTED_12);
|
||||
Bukkit.getPluginManager().registerEvents(this, this);
|
||||
Bukkit.getPluginManager().registerEvents(new ServerEvents(), this);
|
||||
Bukkit.getPluginManager().registerEvents(new MenuListener(), this);
|
||||
Bukkit.getPluginManager().registerEvents(new ScoreboardListener(this), this);
|
||||
Bukkit.getPluginManager().registerEvents(new CustomItemEvents(this), this);
|
||||
Bukkit.getPluginManager().registerEvents(new DamageEffect(this), this);
|
||||
Bukkit.getPluginManager().registerEvents(new ClickNPC(), this);
|
||||
//Bukkit.getPluginManager().registerEvents(new GameEvent(this), this);
|
||||
Bukkit.getPluginManager().registerEvents(new DamageEffectEvents(this), this);
|
||||
Bukkit.getPluginManager().registerEvents(new NPCEvents(), this);
|
||||
new DiscordClientManager();
|
||||
new DatabaseManager();
|
||||
new DatabaseManager(this);
|
||||
NPC.loadNPC(CustomItemManager.loadConfig("npcs.yml"));
|
||||
this.injector = new PacketInjector();
|
||||
}
|
||||
@EventHandler
|
||||
public void onJoin(PlayerJoinEvent e) {
|
||||
bossbar.addPlayer(e.getPlayer());
|
||||
injector.addPlayer(e.getPlayer());
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onPing(ServerListPingEvent e) {
|
||||
e.setMaxPlayers(8964);
|
||||
String s = Util.centerText("Matrix", 45);
|
||||
String s2 = Util.centerText("Support 1.18 & 1.8.9", 45);
|
||||
e.setMotd(ChatColor.AQUA.toString() + ChatColor.BOLD + s + "\n" + ChatColor.GOLD + ChatColor.BOLD + s2);
|
||||
try {
|
||||
e.setServerIcon(Bukkit.loadServerIcon(new File("nuke.png")));
|
||||
} catch (Exception ee) {
|
||||
ee.printStackTrace();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2,8 +2,7 @@ package me.night.nullvalkyrie.commands;
|
|||
|
||||
import com.google.common.cache.Cache;
|
||||
import com.google.common.cache.CacheBuilder;
|
||||
import me.night.nullvalkyrie.Main;
|
||||
import me.night.nullvalkyrie.rank.Rank;
|
||||
import me.night.nullvalkyrie.ui.Rank;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.OfflinePlayer;
|
||||
|
@ -16,7 +15,7 @@ import java.util.List;
|
|||
import java.util.UUID;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
import static me.night.nullvalkyrie.rank.ScoreboardListener.rankManager;
|
||||
import static me.night.nullvalkyrie.ui.ScoreboardListener.rankManager;
|
||||
|
||||
public class RankCommand extends Command {
|
||||
|
||||
|
@ -37,30 +36,30 @@ public class RankCommand extends Command {
|
|||
if (sender instanceof Player) {
|
||||
Player player = (Player) sender;
|
||||
if (!cooldown.asMap().containsKey(player.getUniqueId())) {
|
||||
if (player.isOp()) {
|
||||
if (args.length == 2) {
|
||||
if (Bukkit.getOfflinePlayer(args[0]).hasPlayedBefore()) {
|
||||
OfflinePlayer target = Bukkit.getOfflinePlayer(args[0]);
|
||||
for (Rank rank : Rank.values()) {
|
||||
if (rank.name().equalsIgnoreCase(args[1])) {
|
||||
rankManager.setRank(target.getUniqueId(), rank);
|
||||
player.sendMessage(ChatColor.GREEN + "You changed " + target.getName() + "'s rank to " + rank.getDisplay());
|
||||
if (target.isOnline()) {
|
||||
target.getPlayer().sendMessage(ChatColor.GREEN + player.getName() + " set your rank to " + rank.getDisplay());
|
||||
}
|
||||
return;
|
||||
if (!player.isOp()) {
|
||||
player.sendMessage(ChatColor.RED + "You must be server operator to use this command");
|
||||
return;
|
||||
}
|
||||
if (args.length == 2) {
|
||||
if (Bukkit.getOfflinePlayer(args[0]).hasPlayedBefore()) {
|
||||
OfflinePlayer target = Bukkit.getOfflinePlayer(args[0]);
|
||||
for (Rank rank : Rank.values()) {
|
||||
if (rank.name().equalsIgnoreCase(args[1])) {
|
||||
rankManager.setRank(target.getUniqueId(), rank);
|
||||
player.sendMessage(ChatColor.GREEN + "You changed " + target.getName() + "'s rank to " + rank.getDisplay());
|
||||
if (target.isOnline()) {
|
||||
target.getPlayer().sendMessage(ChatColor.GREEN + player.getName() + " set your rank to " + rank.getDisplay());
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
player.sendMessage(ChatColor.RED + "Invalid Rank, please specify a valid rank, ROOKIE, SPECIAL, ADMIN, OWNER");
|
||||
} else {
|
||||
player.sendMessage("This player has never played in this server before!");
|
||||
|
||||
}
|
||||
player.sendMessage(ChatColor.RED + "Invalid Rank, please specify a valid rank, ROOKIE, SPECIAL, ADMIN, OWNER");
|
||||
} else {
|
||||
player.sendMessage(ChatColor.RED + "Invalid parameter, use /rank <Player> <Rank>");
|
||||
player.sendMessage("This player has never played in this server before!");
|
||||
}
|
||||
} else {
|
||||
player.sendMessage(ChatColor.RED + "You must be server operator to use this command");
|
||||
player.sendMessage(ChatColor.RED + "Invalid parameter, use /rank <Player> <Rank>");
|
||||
}
|
||||
cooldown.put(player.getUniqueId(), System.currentTimeMillis() + 5000);
|
||||
} else {
|
||||
|
|
|
@ -3,6 +3,7 @@ package me.night.nullvalkyrie.database;
|
|||
import com.mongodb.MongoException;
|
||||
import com.mongodb.client.*;
|
||||
import com.mongodb.client.model.Filters;
|
||||
import me.night.nullvalkyrie.Main;
|
||||
import org.bson.Document;
|
||||
import org.bson.conversions.Bson;
|
||||
|
||||
|
@ -10,15 +11,18 @@ import java.util.HashMap;
|
|||
|
||||
public class DatabaseManager {
|
||||
private static MongoCollection<Document> users;
|
||||
public DatabaseManager() {
|
||||
private Main main;
|
||||
public DatabaseManager(Main main) {
|
||||
this.main = main;
|
||||
connect();
|
||||
}
|
||||
public void connect() {
|
||||
try (MongoClient client = MongoClients.create("mongodb+srv://cath_exe:gaeismypassion@cath-exe.iolb7.mongodb.net/NullValkyrie")) {
|
||||
|
||||
} catch (MongoException e) {
|
||||
System.out.println("An error occurred when logging in to MongoDB" + e);
|
||||
}
|
||||
// System.out.println(System.getenv("MONGO"));
|
||||
// try (MongoClient client = MongoClients.create(System.getenv("MONGO"))) {
|
||||
//
|
||||
// } catch (MongoException e) {
|
||||
// System.out.println("An error occurred when logging in to MongoDB" + e);
|
||||
// }
|
||||
MongoClient client = MongoClients.create("mongodb+srv://cath_exe:gaeismypassion@cath-exe.iolb7.mongodb.net/NullValkyrie");
|
||||
MongoDatabase database = client.getDatabase("NullValkyrie");
|
||||
users = database.getCollection("users");
|
||||
|
|
|
@ -17,10 +17,10 @@ import org.bukkit.scheduler.BukkitRunnable;
|
|||
import java.text.DecimalFormat;
|
||||
import java.util.*;
|
||||
|
||||
public class DamageEffect implements Listener {
|
||||
public class DamageEffectEvents implements Listener {
|
||||
private final Main main;
|
||||
|
||||
public DamageEffect(Main main) {
|
||||
public DamageEffectEvents(Main main) {
|
||||
this.main = main;
|
||||
}
|
||||
|
||||
|
@ -63,7 +63,7 @@ public class DamageEffect implements Listener {
|
|||
ticksLeft--;
|
||||
indicators.put(stand, ticksLeft);
|
||||
}
|
||||
stands.removeAll(removal);
|
||||
removal.forEach(stands::remove);
|
||||
}
|
||||
}.runTaskTimer(main, 0L, 1L);
|
||||
}
|
42
src/main/java/me/night/nullvalkyrie/events/ServerEvents.java
Normal file
42
src/main/java/me/night/nullvalkyrie/events/ServerEvents.java
Normal file
|
@ -0,0 +1,42 @@
|
|||
package me.night.nullvalkyrie.events;
|
||||
|
||||
import me.night.nullvalkyrie.npc.PacketInjector;
|
||||
import me.night.nullvalkyrie.util.Util;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.boss.BarColor;
|
||||
import org.bukkit.boss.BarStyle;
|
||||
import org.bukkit.boss.BossBar;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.Listener;
|
||||
import org.bukkit.event.player.PlayerJoinEvent;
|
||||
import org.bukkit.event.server.ServerListPingEvent;
|
||||
|
||||
import java.io.File;
|
||||
|
||||
public class ServerEvents implements Listener {
|
||||
public BossBar bossbar;
|
||||
public PacketInjector injector;
|
||||
public ServerEvents() {
|
||||
bossbar = Bukkit.createBossBar(ChatColor.GOLD + "Kuudra", BarColor.RED, BarStyle.SEGMENTED_12);
|
||||
this.injector = new PacketInjector();
|
||||
}
|
||||
@EventHandler
|
||||
public void onJoin(PlayerJoinEvent e) {
|
||||
bossbar.addPlayer(e.getPlayer());
|
||||
injector.addPlayer(e.getPlayer());
|
||||
}
|
||||
@EventHandler
|
||||
public void onPing(ServerListPingEvent e) {
|
||||
e.setMaxPlayers(8964);
|
||||
String s = Util.centerText("Vanadium", 45);
|
||||
String s2 = Util.centerText("Support 1.19.2", 45);
|
||||
e.setMotd(ChatColor.AQUA.toString() + ChatColor.BOLD + s + "\n" + ChatColor.GOLD + ChatColor.BOLD + s2);
|
||||
try {
|
||||
e.setServerIcon(Bukkit.loadServerIcon(new File("nuke.png")));
|
||||
} catch (Exception ee) {
|
||||
ee.printStackTrace();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
|
@ -1,16 +0,0 @@
|
|||
package me.night.nullvalkyrie.npc;
|
||||
|
||||
import me.night.nullvalkyrie.util.Util;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.Listener;
|
||||
|
||||
public class ClickNPC implements Listener {
|
||||
@EventHandler
|
||||
public void onClick(RightClickNPC e) {
|
||||
Player player = e.getPlayer();
|
||||
if (e.getNPC().getBukkitEntity().getName().equalsIgnoreCase(Util.color("&a&lNK"))) {
|
||||
player.sendMessage(Util.color("Hi"));
|
||||
}
|
||||
}
|
||||
}
|
34
src/main/java/me/night/nullvalkyrie/npc/NPCEvents.java
Normal file
34
src/main/java/me/night/nullvalkyrie/npc/NPCEvents.java
Normal file
|
@ -0,0 +1,34 @@
|
|||
package me.night.nullvalkyrie.npc;
|
||||
|
||||
import me.night.nullvalkyrie.util.Util;
|
||||
import net.minecraft.network.protocol.game.PacketPlayOutEntity;
|
||||
import net.minecraft.network.protocol.game.PacketPlayOutEntityHeadRotation;
|
||||
import net.minecraft.server.network.PlayerConnection;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.craftbukkit.v1_19_R1.entity.CraftPlayer;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.Listener;
|
||||
import org.bukkit.event.player.PlayerMoveEvent;
|
||||
|
||||
public class NPCEvents implements Listener {
|
||||
@EventHandler
|
||||
public void onClick(RightClickNPC e) {
|
||||
Player player = e.getPlayer();
|
||||
if (e.getNPC().getBukkitEntity().getName().equalsIgnoreCase(Util.color("&a&lNK"))) {
|
||||
player.sendMessage(Util.color("Hi"));
|
||||
}
|
||||
}
|
||||
@EventHandler
|
||||
public void onMove(PlayerMoveEvent e) {
|
||||
NPC.getNPCs().stream().forEach(npc -> {
|
||||
Location location = npc.getBukkitEntity().getLocation();
|
||||
location.setDirection(e.getPlayer().getLocation().subtract(location).toVector());
|
||||
float yaw = location.getYaw();
|
||||
float pitch = location.getPitch();
|
||||
PlayerConnection con = ((CraftPlayer) e.getPlayer()).getHandle().b;
|
||||
con.a(new PacketPlayOutEntityHeadRotation(npc, (byte) ((yaw%360)*256/360)));
|
||||
con.a(new PacketPlayOutEntity.PacketPlayOutEntityLook(npc.ae(), (byte) ((yaw%360)*256/360), (byte) ((pitch%360)*256/360), false));
|
||||
});
|
||||
}
|
||||
}
|
|
@ -1,20 +0,0 @@
|
|||
package me.night.nullvalkyrie.rank;
|
||||
|
||||
import org.bukkit.ChatColor;
|
||||
|
||||
public enum Rank {
|
||||
OWNER(ChatColor.DARK_RED + "{OWNER}"),
|
||||
ADMIN(ChatColor.RED + "{ADMIN}"),
|
||||
SPECIAL(ChatColor.GOLD + "{SPECIAL}"),
|
||||
ROOKIE(ChatColor.DARK_GREEN + "{ROOKIE}");
|
||||
|
||||
private String display;
|
||||
|
||||
Rank(String display) {
|
||||
this.display = display;
|
||||
}
|
||||
|
||||
public String getDisplay() {
|
||||
return display;
|
||||
}
|
||||
}
|
|
@ -1,4 +1,4 @@
|
|||
package me.night.nullvalkyrie.rank;
|
||||
package me.night.nullvalkyrie.ui;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
|
||||
|
@ -7,7 +7,7 @@ import java.util.Map;
|
|||
import java.util.UUID;
|
||||
|
||||
public class AnimatedSideBar {
|
||||
private static Map<UUID, Integer> Tasks = new HashMap<>();
|
||||
private static final Map<UUID, Integer> Tasks = new HashMap<>();
|
||||
private final UUID uuid;
|
||||
|
||||
public AnimatedSideBar(UUID uuid) {
|
||||
|
@ -17,9 +17,7 @@ public class AnimatedSideBar {
|
|||
Tasks.put(uuid, id);
|
||||
}
|
||||
public boolean hasID() {
|
||||
if (Tasks.containsKey(uuid))
|
||||
return true;
|
||||
return false;
|
||||
return Tasks.containsKey(uuid);
|
||||
}
|
||||
public void stop() {
|
||||
Bukkit.getScheduler().cancelTask(Tasks.get(uuid));
|
|
@ -1,18 +1,18 @@
|
|||
package me.night.nullvalkyrie.rank;
|
||||
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.scoreboard.DisplaySlot;
|
||||
import org.bukkit.scoreboard.Objective;
|
||||
import org.bukkit.scoreboard.Scoreboard;
|
||||
|
||||
public class BelowNameManager {
|
||||
public void setBelowName(Player player) {
|
||||
Scoreboard board = player.getScoreboard();
|
||||
Objective obj = board.registerNewObjective("HealthBar", "health");
|
||||
obj.setDisplaySlot(DisplaySlot.BELOW_NAME);
|
||||
obj.setDisplayName(ChatColor.RED + "❤");
|
||||
player.setScoreboard(board);
|
||||
player.setHealth(player.getHealth());
|
||||
}
|
||||
}
|
||||
package me.night.nullvalkyrie.ui;
|
||||
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.scoreboard.Criteria;
|
||||
import org.bukkit.scoreboard.DisplaySlot;
|
||||
import org.bukkit.scoreboard.Objective;
|
||||
import org.bukkit.scoreboard.Scoreboard;
|
||||
|
||||
public class BelowNameManager {
|
||||
public void setBelowName(Player player) {
|
||||
Scoreboard board = player.getScoreboard();
|
||||
Objective obj = board.registerNewObjective("HealthBar", Criteria.HEALTH, ChatColor.RED + "❤");
|
||||
obj.setDisplaySlot(DisplaySlot.BELOW_NAME);
|
||||
player.setScoreboard(board);
|
||||
player.setHealth(player.getHealth());
|
||||
}
|
||||
}
|
|
@ -1,45 +1,35 @@
|
|||
package me.night.nullvalkyrie.rank;
|
||||
|
||||
import me.night.nullvalkyrie.Main;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.scoreboard.DisplaySlot;
|
||||
import org.bukkit.scoreboard.Objective;
|
||||
import org.bukkit.scoreboard.Scoreboard;
|
||||
import org.bukkit.scoreboard.Team;
|
||||
|
||||
public class NameTagManager {
|
||||
private Main main;
|
||||
|
||||
public NameTagManager(Main main) {
|
||||
this.main = main;
|
||||
}
|
||||
@SuppressWarnings("deprecation")
|
||||
public void setNametags(Player player) {
|
||||
Scoreboard newScoreboard = Bukkit.getScoreboardManager().getNewScoreboard();
|
||||
Objective obj = newScoreboard.registerNewObjective("TabList", "dummy");
|
||||
obj.setDisplaySlot(DisplaySlot.PLAYER_LIST);
|
||||
player.setScoreboard(newScoreboard);
|
||||
for (Rank rank : Rank.values()) {
|
||||
Team team = player.getScoreboard().registerNewTeam(rank.name());
|
||||
team.setPrefix(rank.getDisplay() + " ");
|
||||
}
|
||||
for (Player target : Bukkit.getOnlinePlayers()) {
|
||||
if (player.getUniqueId() != target.getUniqueId()) {
|
||||
Rank rank = ScoreboardListener.rankManager.getRank(target.getUniqueId());
|
||||
player.getScoreboard().getTeam(rank.name()).addEntry(target.getName());
|
||||
}
|
||||
}
|
||||
}
|
||||
public void newTag(Player player) {
|
||||
Rank rank = ScoreboardListener.rankManager.getRank(player.getUniqueId());
|
||||
for(Player target : Bukkit.getOnlinePlayers()) {
|
||||
target.getScoreboard().getTeam(rank.name()).addEntry(player.getName());
|
||||
}
|
||||
}
|
||||
public void removeTag(Player player) {
|
||||
for(Player target : Bukkit.getOnlinePlayers()) {
|
||||
target.getScoreboard().getEntryTeam(player.getName()).removeEntry(player.getName());
|
||||
}
|
||||
}
|
||||
}
|
||||
package me.night.nullvalkyrie.ui;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.scoreboard.*;
|
||||
|
||||
public class NameTagManager {
|
||||
public void setNametags(Player player) {
|
||||
Scoreboard newScoreboard = Bukkit.getScoreboardManager().getNewScoreboard();
|
||||
Objective obj = newScoreboard.registerNewObjective("TabList", Criteria.DUMMY, "");
|
||||
obj.setDisplaySlot(DisplaySlot.PLAYER_LIST);
|
||||
player.setScoreboard(newScoreboard);
|
||||
for (Rank rank : Rank.values()) {
|
||||
Team team = player.getScoreboard().registerNewTeam(rank.name());
|
||||
team.setPrefix(rank.getDisplay() + " ");
|
||||
}
|
||||
for (Player target : Bukkit.getOnlinePlayers()) {
|
||||
if (player.getUniqueId() != target.getUniqueId()) {
|
||||
Rank rank = ScoreboardListener.rankManager.getRank(target.getUniqueId());
|
||||
player.getScoreboard().getTeam(rank.name()).addEntry(target.getName());
|
||||
}
|
||||
}
|
||||
}
|
||||
public void newTag(Player player) {
|
||||
Rank rank = ScoreboardListener.rankManager.getRank(player.getUniqueId());
|
||||
for(Player target : Bukkit.getOnlinePlayers()) {
|
||||
target.getScoreboard().getTeam(rank.name()).addEntry(player.getName());
|
||||
}
|
||||
}
|
||||
public void removeTag(Player player) {
|
||||
for(Player target : Bukkit.getOnlinePlayers()) {
|
||||
target.getScoreboard().getEntryTeam(player.getName()).removeEntry(player.getName());
|
||||
}
|
||||
}
|
||||
}
|
20
src/main/java/me/night/nullvalkyrie/ui/Rank.java
Normal file
20
src/main/java/me/night/nullvalkyrie/ui/Rank.java
Normal file
|
@ -0,0 +1,20 @@
|
|||
package me.night.nullvalkyrie.ui;
|
||||
|
||||
import org.bukkit.ChatColor;
|
||||
|
||||
public enum Rank {
|
||||
OWNER(ChatColor.DARK_RED + "<OWNER>"),
|
||||
ADMIN(ChatColor.RED + "<ADMIN>"),
|
||||
SPECIAL(ChatColor.GOLD + "<SPECIAL>"),
|
||||
ROOKIE(ChatColor.DARK_GREEN + "<ROOKIE>");
|
||||
|
||||
private final String display;
|
||||
|
||||
Rank(String display) {
|
||||
this.display = display;
|
||||
}
|
||||
|
||||
public String getDisplay() {
|
||||
return display;
|
||||
}
|
||||
}
|
|
@ -1,52 +1,48 @@
|
|||
package me.night.nullvalkyrie.rank;
|
||||
|
||||
import me.night.nullvalkyrie.Main;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.configuration.file.YamlConfiguration;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.util.UUID;
|
||||
|
||||
import static me.night.nullvalkyrie.rank.ScoreboardListener.nameTagManager;
|
||||
|
||||
public class RankManager {
|
||||
private File file;
|
||||
private YamlConfiguration config;
|
||||
|
||||
private Main main;
|
||||
|
||||
public RankManager(Main main) {
|
||||
this.main = main;
|
||||
if(!main.getDataFolder().exists()) {
|
||||
main.getDataFolder().mkdir();
|
||||
}
|
||||
file = new File(main.getDataFolder(), "ranks.yml");
|
||||
if(!file.exists()) {
|
||||
try {
|
||||
file.createNewFile();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
config = YamlConfiguration.loadConfiguration(file);
|
||||
}
|
||||
public void setRank(UUID uuid, Rank rank) {
|
||||
config.set(uuid.toString(), rank.name());
|
||||
try {
|
||||
config.save(file);
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
for(Player player : Bukkit.getOnlinePlayers()) {
|
||||
if(player.hasPlayedBefore()) {
|
||||
nameTagManager.removeTag(player);
|
||||
nameTagManager.newTag(player);
|
||||
}
|
||||
}
|
||||
}
|
||||
public Rank getRank(UUID uuid) {
|
||||
return Rank.valueOf(config.getString(uuid.toString()));
|
||||
}
|
||||
}
|
||||
package me.night.nullvalkyrie.ui;
|
||||
|
||||
import me.night.nullvalkyrie.Main;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.configuration.file.YamlConfiguration;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.util.UUID;
|
||||
|
||||
import static me.night.nullvalkyrie.ui.ScoreboardListener.nameTagManager;
|
||||
|
||||
public class RankManager {
|
||||
private final File file;
|
||||
private final YamlConfiguration config;
|
||||
public RankManager(Main main) {
|
||||
if(!main.getDataFolder().exists()) {
|
||||
main.getDataFolder().mkdir();
|
||||
}
|
||||
file = new File(main.getDataFolder(), "ranks.yml");
|
||||
if(!file.exists()) {
|
||||
try {
|
||||
file.createNewFile();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
config = YamlConfiguration.loadConfiguration(file);
|
||||
}
|
||||
public void setRank(UUID uuid, Rank rank) {
|
||||
config.set(uuid.toString(), rank.name());
|
||||
try {
|
||||
config.save(file);
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
for(Player player : Bukkit.getOnlinePlayers()) {
|
||||
if(player.hasPlayedBefore()) {
|
||||
nameTagManager.removeTag(player);
|
||||
nameTagManager.newTag(player);
|
||||
}
|
||||
}
|
||||
}
|
||||
public Rank getRank(UUID uuid) {
|
||||
return Rank.valueOf(config.getString(uuid.toString()));
|
||||
}
|
||||
}
|
|
@ -1,73 +1,73 @@
|
|||
package me.night.nullvalkyrie.rank;
|
||||
|
||||
import me.night.nullvalkyrie.Main;
|
||||
import me.night.nullvalkyrie.npc.NPC;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.Listener;
|
||||
import org.bukkit.event.entity.PlayerDeathEvent;
|
||||
import org.bukkit.event.player.AsyncPlayerChatEvent;
|
||||
import org.bukkit.event.player.PlayerJoinEvent;
|
||||
import org.bukkit.event.player.PlayerQuitEvent;
|
||||
|
||||
import static me.night.nullvalkyrie.database.DatabaseManager.createUserSchema;
|
||||
|
||||
public class ScoreboardListener implements Listener {
|
||||
|
||||
public static RankManager rankManager;
|
||||
public static NameTagManager nameTagManager;
|
||||
private final SideBarManager sideBarManager;
|
||||
private final BelowNameManager belowNameManager;
|
||||
public ScoreboardListener(Main main) {
|
||||
nameTagManager = new NameTagManager(main);
|
||||
rankManager = new RankManager(main);
|
||||
sideBarManager = new SideBarManager(main);
|
||||
belowNameManager = new BelowNameManager();
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onJoin(PlayerJoinEvent e) {
|
||||
Player player = e.getPlayer();
|
||||
if(!player.hasPlayedBefore()) {
|
||||
e.getPlayer().sendTitle(ChatColor.RED + "Welcome to Matrix!", ChatColor.GREEN + "LOL", 20, 100, 20);
|
||||
rankManager.setRank(player.getUniqueId(), Rank.ROOKIE);
|
||||
createUserSchema(e.getPlayer().getDisplayName());
|
||||
}
|
||||
e.getPlayer().setPlayerListHeaderFooter(ChatColor.AQUA + "You are playing on " + ChatColor.GREEN + "127.0.0.1", ChatColor.GOLD + "Ranks, boosters, & more!" + ChatColor.AQUA + "127.0.0.1");
|
||||
nameTagManager.setNametags(player);
|
||||
nameTagManager.newTag(player);
|
||||
sideBarManager.setSideBar(player);
|
||||
sideBarManager.start(player);
|
||||
belowNameManager.setBelowName(player);
|
||||
e.setJoinMessage(rankManager.getRank(e.getPlayer().getUniqueId()).getDisplay() + " " + e.getPlayer().getName() + ChatColor.WHITE + " joined the server!");
|
||||
if(NPC.getNPCs() == null) return;
|
||||
if(NPC.getNPCs().isEmpty()) return;
|
||||
NPC.addJoinPacket(e.getPlayer());
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onQuit(PlayerQuitEvent e) {
|
||||
e.setQuitMessage(ChatColor.RED + "bozo " + e.getPlayer().getName() + " has left.");
|
||||
nameTagManager.removeTag(e.getPlayer());
|
||||
e.getPlayer().setScoreboard(Bukkit.getScoreboardManager().getNewScoreboard());
|
||||
AnimatedSideBar board = new AnimatedSideBar(e.getPlayer().getUniqueId());
|
||||
if(board.hasID()) {
|
||||
board.stop();
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onChat(AsyncPlayerChatEvent e) {
|
||||
e.setCancelled(true);
|
||||
Player player = e.getPlayer();
|
||||
Bukkit.broadcastMessage(rankManager.getRank(player.getUniqueId()).getDisplay() + " " + player.getName() + ChatColor.WHITE + ": " + e.getMessage());
|
||||
}
|
||||
|
||||
//Death changing in sidebar
|
||||
@EventHandler
|
||||
public void onDeath(PlayerDeathEvent e) {
|
||||
sideBarManager.changeOnDeath(e.getEntity().getPlayer());
|
||||
}
|
||||
}
|
||||
package me.night.nullvalkyrie.ui;
|
||||
|
||||
import me.night.nullvalkyrie.Main;
|
||||
import me.night.nullvalkyrie.npc.NPC;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.Listener;
|
||||
import org.bukkit.event.entity.PlayerDeathEvent;
|
||||
import org.bukkit.event.player.AsyncPlayerChatEvent;
|
||||
import org.bukkit.event.player.PlayerJoinEvent;
|
||||
import org.bukkit.event.player.PlayerQuitEvent;
|
||||
|
||||
import static me.night.nullvalkyrie.database.DatabaseManager.createUserSchema;
|
||||
|
||||
public class ScoreboardListener implements Listener {
|
||||
|
||||
public static RankManager rankManager;
|
||||
public static NameTagManager nameTagManager;
|
||||
private final SideBarManager sideBarManager;
|
||||
private final BelowNameManager belowNameManager;
|
||||
public ScoreboardListener(Main main) {
|
||||
nameTagManager = new NameTagManager();
|
||||
rankManager = new RankManager(main);
|
||||
sideBarManager = new SideBarManager(main);
|
||||
belowNameManager = new BelowNameManager();
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onJoin(PlayerJoinEvent e) {
|
||||
Player player = e.getPlayer();
|
||||
if(!player.hasPlayedBefore()) {
|
||||
e.getPlayer().sendTitle(ChatColor.RED + "Welcome to Matrix!", ChatColor.GREEN + "LOL", 20, 100, 20);
|
||||
rankManager.setRank(player.getUniqueId(), Rank.ROOKIE);
|
||||
createUserSchema(e.getPlayer().getDisplayName());
|
||||
}
|
||||
e.getPlayer().setPlayerListHeaderFooter(ChatColor.AQUA + "You are playing on " + ChatColor.GREEN + "127.0.0.1", ChatColor.GOLD + "Ranks, boosters, & more!" + ChatColor.AQUA + "127.0.0.1");
|
||||
nameTagManager.setNametags(player);
|
||||
nameTagManager.newTag(player);
|
||||
sideBarManager.setSideBar(player);
|
||||
sideBarManager.start(player);
|
||||
belowNameManager.setBelowName(player);
|
||||
e.setJoinMessage(rankManager.getRank(e.getPlayer().getUniqueId()).getDisplay() + " " + e.getPlayer().getName() + ChatColor.WHITE + " joined the server!");
|
||||
if(NPC.getNPCs() == null) return;
|
||||
if(NPC.getNPCs().isEmpty()) return;
|
||||
NPC.addJoinPacket(e.getPlayer());
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onQuit(PlayerQuitEvent e) {
|
||||
e.setQuitMessage(ChatColor.RED + "bozo " + e.getPlayer().getName() + " has left.");
|
||||
nameTagManager.removeTag(e.getPlayer());
|
||||
e.getPlayer().setScoreboard(Bukkit.getScoreboardManager().getNewScoreboard());
|
||||
AnimatedSideBar board = new AnimatedSideBar(e.getPlayer().getUniqueId());
|
||||
if(board.hasID()) {
|
||||
board.stop();
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onChat(AsyncPlayerChatEvent e) {
|
||||
e.setCancelled(true);
|
||||
Player player = e.getPlayer();
|
||||
Bukkit.broadcastMessage(rankManager.getRank(player.getUniqueId()).getDisplay() + " " + player.getName() + ChatColor.WHITE + ": " + e.getMessage());
|
||||
}
|
||||
|
||||
//Death changing in sidebar
|
||||
@EventHandler
|
||||
public void onDeath(PlayerDeathEvent e) {
|
||||
if(e.getEntity().getPlayer() == null) sideBarManager.changeOnDeath(e.getEntity().getPlayer());
|
||||
}
|
||||
}
|
|
@ -1,107 +1,105 @@
|
|||
package me.night.nullvalkyrie.rank;
|
||||
|
||||
import me.night.nullvalkyrie.Main;
|
||||
import me.night.nullvalkyrie.util.Util;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.scoreboard.*;
|
||||
import org.bukkit.scoreboard.Scoreboard;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.UUID;
|
||||
|
||||
public class SideBarManager {
|
||||
private final HashMap<UUID, Integer> deaths = new HashMap<>();
|
||||
private int taskID;
|
||||
private final Main main;
|
||||
|
||||
public SideBarManager(Main main) {
|
||||
this.main = main;
|
||||
}
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
public void setSideBar(Player player) {
|
||||
Scoreboard board = player.getScoreboard();
|
||||
Objective obj;
|
||||
if (board.getObjective("Vanadium") != null) {
|
||||
obj = board.getObjective("Vanadium");
|
||||
} else {
|
||||
obj = board.registerNewObjective("Vanadium", "dummy");
|
||||
}
|
||||
obj.setDisplaySlot(DisplaySlot.SIDEBAR);
|
||||
obj.setDisplayName(ChatColor.AQUA.toString() + ChatColor.BOLD + ">> Vanadium <<");
|
||||
Score hypens = obj.getScore(ChatColor.GOLD + "=-=-=-=-=-=-=-=");
|
||||
hypens.setScore(9);
|
||||
Score name = obj.getScore(ChatColor.BLUE + "Player Name: ");
|
||||
name.setScore(8);
|
||||
Score name2 = obj.getScore(ChatColor.WHITE + player.getName());
|
||||
name2.setScore(7);
|
||||
Score space1 = obj.getScore(" ");
|
||||
space1.setScore(6);
|
||||
Score players = obj.getScore(ChatColor.LIGHT_PURPLE + "Players Online:");
|
||||
players.setScore(5);
|
||||
Score playercount = obj.getScore(ChatColor.YELLOW.toString() + Bukkit.getServer().getOnlinePlayers().size());
|
||||
playercount.setScore(4);
|
||||
Score space2 = obj.getScore(" ");
|
||||
space2.setScore(2);
|
||||
Score website = obj.getScore(ChatColor.YELLOW + "cath.js.org");
|
||||
website.setScore(1);
|
||||
Team playersOnline;
|
||||
if (board.getTeam("deathsTotal") != null) {
|
||||
playersOnline = board.getTeam("deathsTotal");
|
||||
} else playersOnline = board.registerNewTeam("deathsTotal");
|
||||
playersOnline.addEntry(ChatColor.BOLD.toString());
|
||||
playersOnline.setPrefix(ChatColor.BLUE + "Deaths: ");
|
||||
playersOnline.setSuffix(ChatColor.YELLOW + "0");
|
||||
obj.getScore(ChatColor.BOLD.toString()).setScore(3);
|
||||
player.setScoreboard(board);
|
||||
deaths.put(player.getUniqueId(), 0);
|
||||
}
|
||||
|
||||
public void start(Player player) {
|
||||
taskID = Bukkit.getScheduler().scheduleSyncRepeatingTask(main, new Runnable() {
|
||||
int count = 0;
|
||||
final AnimatedSideBar board = new AnimatedSideBar(player.getUniqueId());
|
||||
|
||||
public void animate(String str) {
|
||||
Objective objective = player.getScoreboard().getObjective("Vanadium");
|
||||
objective.setDisplaySlot(DisplaySlot.SIDEBAR);
|
||||
objective.setDisplayName(Util.color(str));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
if (!board.hasID())
|
||||
board.setID(taskID);
|
||||
if (count == 13)
|
||||
count = 0;
|
||||
switch (count) {
|
||||
case 0 -> animate("&1&l>> &e&lVanadium&1&l <<");
|
||||
case 1 -> animate("&b&l>&1&l> &e&lVanadium &1&l<<");
|
||||
case 2 -> animate("&1&l>&b&l> &e&lVanadium &1&l<<");
|
||||
case 3 -> animate("&1&l>> &b&lV&e&lanadium&1&l <<");
|
||||
case 4 -> animate("&1&l>> &e&lV&b&la&e&lnadium&1&l <<");
|
||||
case 5 -> animate("&1&l>> &e&lVa&b&ln&e&ladium&1&l <<");
|
||||
case 6 -> animate("&1&l>> &e&lVan&b&la&e&ldium&1&l <<");
|
||||
case 7 -> animate("&1&l>> &e&lVana&b&ld&e&lium&1&l <<");
|
||||
case 8 -> animate("&1&l>> &e&lVanad&b&li&e&lum&1&l <<");
|
||||
case 9 -> animate("&1&l>> &e&lVanadi&b&lu&e&lm&1&l <<");
|
||||
case 10 -> animate("&1&l>> &e&lVanadiu&b&lm&1&l <<");
|
||||
case 11 -> animate("&1&l>> &e&lVanadium &b&l<&1&l<");
|
||||
case 12 -> {
|
||||
animate("&1&l>> &e&lVanadium &1&l<&b&l<");
|
||||
setSideBar(player);
|
||||
}
|
||||
}
|
||||
count++;
|
||||
}
|
||||
}, 0, 10);
|
||||
}
|
||||
|
||||
public void changeOnDeath(Player player) {
|
||||
int amount = deaths.get(player.getUniqueId());
|
||||
deaths.put(player.getUniqueId(), amount++);
|
||||
player.getScoreboard().getTeam("deathsTotal").setSuffix(ChatColor.YELLOW.toString() + amount);
|
||||
}
|
||||
}
|
||||
package me.night.nullvalkyrie.ui;
|
||||
|
||||
import me.night.nullvalkyrie.Main;
|
||||
import me.night.nullvalkyrie.util.Util;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.scoreboard.*;
|
||||
import org.bukkit.scoreboard.Scoreboard;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.UUID;
|
||||
|
||||
public class SideBarManager {
|
||||
private final HashMap<UUID, Integer> deaths = new HashMap<>();
|
||||
private int taskID;
|
||||
private final Main main;
|
||||
|
||||
public SideBarManager(Main main) {
|
||||
this.main = main;
|
||||
}
|
||||
|
||||
public void setSideBar(Player player) {
|
||||
Scoreboard board = player.getScoreboard();
|
||||
Objective obj;
|
||||
if (board.getObjective("Vanadium") != null) {
|
||||
obj = board.getObjective("Vanadium");
|
||||
} else {
|
||||
obj = board.registerNewObjective("Vanadium", Criteria.DUMMY, ChatColor.AQUA.toString() + ChatColor.BOLD + ">> Vanadium <<");
|
||||
}
|
||||
obj.setDisplaySlot(DisplaySlot.SIDEBAR);
|
||||
Score hypens = obj.getScore(ChatColor.GOLD + "=-=-=-=-=-=-=-=");
|
||||
hypens.setScore(9);
|
||||
Score name = obj.getScore(ChatColor.BLUE + "Player Name: ");
|
||||
name.setScore(8);
|
||||
Score name2 = obj.getScore(ChatColor.WHITE + player.getName());
|
||||
name2.setScore(7);
|
||||
Score space1 = obj.getScore(" ");
|
||||
space1.setScore(6);
|
||||
Score players = obj.getScore(ChatColor.LIGHT_PURPLE + "Players Online:");
|
||||
players.setScore(5);
|
||||
Score playercount = obj.getScore(ChatColor.YELLOW.toString() + Bukkit.getServer().getOnlinePlayers().size());
|
||||
playercount.setScore(4);
|
||||
Score space2 = obj.getScore(" ");
|
||||
space2.setScore(2);
|
||||
Score website = obj.getScore(ChatColor.YELLOW + "cath.js.org");
|
||||
website.setScore(1);
|
||||
Team playersOnline;
|
||||
if (board.getTeam("deathsTotal") != null) {
|
||||
playersOnline = board.getTeam("deathsTotal");
|
||||
} else playersOnline = board.registerNewTeam("deathsTotal");
|
||||
playersOnline.addEntry(ChatColor.BOLD.toString());
|
||||
playersOnline.setPrefix(ChatColor.BLUE + "Deaths: ");
|
||||
playersOnline.setSuffix(ChatColor.YELLOW + "0");
|
||||
obj.getScore(ChatColor.BOLD.toString()).setScore(3);
|
||||
player.setScoreboard(board);
|
||||
deaths.put(player.getUniqueId(), 0);
|
||||
}
|
||||
|
||||
public void start(Player player) {
|
||||
taskID = Bukkit.getScheduler().scheduleSyncRepeatingTask(main, new Runnable() {
|
||||
int count = 0;
|
||||
final AnimatedSideBar board = new AnimatedSideBar(player.getUniqueId());
|
||||
|
||||
public void animate(String str) {
|
||||
Objective objective = player.getScoreboard().getObjective("Vanadium");
|
||||
objective.setDisplaySlot(DisplaySlot.SIDEBAR);
|
||||
objective.setDisplayName(Util.color(str));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
if (!board.hasID())
|
||||
board.setID(taskID);
|
||||
if (count == 13)
|
||||
count = 0;
|
||||
switch (count) {
|
||||
case 0 -> animate("&1&l>> &e&lVanadium&1&l <<");
|
||||
case 1 -> animate("&b&l>&1&l> &e&lVanadium &1&l<<");
|
||||
case 2 -> animate("&1&l>&b&l> &e&lVanadium &1&l<<");
|
||||
case 3 -> animate("&1&l>> &b&lV&e&lanadium&1&l <<");
|
||||
case 4 -> animate("&1&l>> &e&lV&b&la&e&lnadium&1&l <<");
|
||||
case 5 -> animate("&1&l>> &e&lVa&b&ln&e&ladium&1&l <<");
|
||||
case 6 -> animate("&1&l>> &e&lVan&b&la&e&ldium&1&l <<");
|
||||
case 7 -> animate("&1&l>> &e&lVana&b&ld&e&lium&1&l <<");
|
||||
case 8 -> animate("&1&l>> &e&lVanad&b&li&e&lum&1&l <<");
|
||||
case 9 -> animate("&1&l>> &e&lVanadi&b&lu&e&lm&1&l <<");
|
||||
case 10 -> animate("&1&l>> &e&lVanadiu&b&lm&1&l <<");
|
||||
case 11 -> animate("&1&l>> &e&lVanadium &b&l<&1&l<");
|
||||
case 12 -> {
|
||||
animate("&1&l>> &e&lVanadium &1&l<&b&l<");
|
||||
setSideBar(player);
|
||||
}
|
||||
}
|
||||
count++;
|
||||
}
|
||||
}, 0, 10);
|
||||
}
|
||||
|
||||
public void changeOnDeath(Player player) {
|
||||
int amount = deaths.get(player.getUniqueId());
|
||||
deaths.put(player.getUniqueId(), amount++);
|
||||
player.getScoreboard().getTeam("deathsTotal").setSuffix(ChatColor.YELLOW.toString() + amount);
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue