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
|
# Common working directory
|
||||||
run/
|
run/
|
||||||
|
.env
|
5
pom.xml
5
pom.xml
|
@ -101,5 +101,10 @@
|
||||||
<version>4.7.0</version>
|
<version>4.7.0</version>
|
||||||
<scope>provided</scope>
|
<scope>provided</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>io.github.cdimascio</groupId>
|
||||||
|
<artifactId>dotenv-java</artifactId>
|
||||||
|
<version>2.3.1</version>
|
||||||
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
</project>
|
</project>
|
||||||
|
|
|
@ -1,73 +1,39 @@
|
||||||
package me.night.nullvalkyrie;
|
package me.night.nullvalkyrie;
|
||||||
|
|
||||||
|
import io.github.cdimascio.dotenv.Dotenv;
|
||||||
import me.night.nullvalkyrie.chests.MenuListener;
|
import me.night.nullvalkyrie.chests.MenuListener;
|
||||||
import me.night.nullvalkyrie.discord.DiscordClientManager;
|
import me.night.nullvalkyrie.discord.DiscordClientManager;
|
||||||
import me.night.nullvalkyrie.enchantments.EnchantmentManager;
|
import me.night.nullvalkyrie.enchantments.EnchantmentManager;
|
||||||
import me.night.nullvalkyrie.events.CustomItemEvents;
|
import me.night.nullvalkyrie.events.*;
|
||||||
import me.night.nullvalkyrie.events.DamageEffect;
|
|
||||||
import me.night.nullvalkyrie.items.CustomItemManager;
|
import me.night.nullvalkyrie.items.CustomItemManager;
|
||||||
import me.night.nullvalkyrie.npc.ClickNPC;
|
import me.night.nullvalkyrie.npc.*;
|
||||||
import me.night.nullvalkyrie.npc.NPC;
|
import me.night.nullvalkyrie.ui.ScoreboardListener;
|
||||||
import me.night.nullvalkyrie.npc.PacketInjector;
|
import me.night.nullvalkyrie.util.*;
|
||||||
import me.night.nullvalkyrie.rank.ScoreboardListener;
|
|
||||||
import me.night.nullvalkyrie.util.FileManager;
|
|
||||||
import me.night.nullvalkyrie.util.Util;
|
|
||||||
import me.night.nullvalkyrie.commands.*;
|
import me.night.nullvalkyrie.commands.*;
|
||||||
import me.night.nullvalkyrie.database.DatabaseManager;
|
import me.night.nullvalkyrie.database.DatabaseManager;
|
||||||
import org.bukkit.*;
|
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;
|
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
|
@Override
|
||||||
public void onEnable() {
|
public void onEnable() {
|
||||||
getConfig().options().copyDefaults();
|
getConfig().options().copyDefaults();
|
||||||
saveDefaultConfig();
|
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();
|
EnchantmentManager.register();
|
||||||
new CustomItemManager(this);
|
new CustomItemManager(this);
|
||||||
new FileManager();
|
new FileManager();
|
||||||
new CommandManager(this).register();
|
new CommandManager(this).register();
|
||||||
bossbar = Bukkit.createBossBar(ChatColor.GOLD + "Kuudra", BarColor.RED, BarStyle.SEGMENTED_12);
|
Bukkit.getPluginManager().registerEvents(new ServerEvents(), this);
|
||||||
Bukkit.getPluginManager().registerEvents(this, this);
|
|
||||||
Bukkit.getPluginManager().registerEvents(new MenuListener(), this);
|
Bukkit.getPluginManager().registerEvents(new MenuListener(), this);
|
||||||
Bukkit.getPluginManager().registerEvents(new ScoreboardListener(this), this);
|
Bukkit.getPluginManager().registerEvents(new ScoreboardListener(this), this);
|
||||||
Bukkit.getPluginManager().registerEvents(new CustomItemEvents(this), this);
|
Bukkit.getPluginManager().registerEvents(new CustomItemEvents(this), this);
|
||||||
Bukkit.getPluginManager().registerEvents(new DamageEffect(this), this);
|
Bukkit.getPluginManager().registerEvents(new DamageEffectEvents(this), this);
|
||||||
Bukkit.getPluginManager().registerEvents(new ClickNPC(), this);
|
Bukkit.getPluginManager().registerEvents(new NPCEvents(), this);
|
||||||
//Bukkit.getPluginManager().registerEvents(new GameEvent(this), this);
|
|
||||||
new DiscordClientManager();
|
new DiscordClientManager();
|
||||||
new DatabaseManager();
|
new DatabaseManager(this);
|
||||||
NPC.loadNPC(CustomItemManager.loadConfig("npcs.yml"));
|
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.Cache;
|
||||||
import com.google.common.cache.CacheBuilder;
|
import com.google.common.cache.CacheBuilder;
|
||||||
import me.night.nullvalkyrie.Main;
|
import me.night.nullvalkyrie.ui.Rank;
|
||||||
import me.night.nullvalkyrie.rank.Rank;
|
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.ChatColor;
|
import org.bukkit.ChatColor;
|
||||||
import org.bukkit.OfflinePlayer;
|
import org.bukkit.OfflinePlayer;
|
||||||
|
@ -16,7 +15,7 @@ import java.util.List;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
import java.util.concurrent.TimeUnit;
|
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 {
|
public class RankCommand extends Command {
|
||||||
|
|
||||||
|
@ -37,30 +36,30 @@ public class RankCommand extends Command {
|
||||||
if (sender instanceof Player) {
|
if (sender instanceof Player) {
|
||||||
Player player = (Player) sender;
|
Player player = (Player) sender;
|
||||||
if (!cooldown.asMap().containsKey(player.getUniqueId())) {
|
if (!cooldown.asMap().containsKey(player.getUniqueId())) {
|
||||||
if (player.isOp()) {
|
if (!player.isOp()) {
|
||||||
if (args.length == 2) {
|
player.sendMessage(ChatColor.RED + "You must be server operator to use this command");
|
||||||
if (Bukkit.getOfflinePlayer(args[0]).hasPlayedBefore()) {
|
return;
|
||||||
OfflinePlayer target = Bukkit.getOfflinePlayer(args[0]);
|
}
|
||||||
for (Rank rank : Rank.values()) {
|
if (args.length == 2) {
|
||||||
if (rank.name().equalsIgnoreCase(args[1])) {
|
if (Bukkit.getOfflinePlayer(args[0]).hasPlayedBefore()) {
|
||||||
rankManager.setRank(target.getUniqueId(), rank);
|
OfflinePlayer target = Bukkit.getOfflinePlayer(args[0]);
|
||||||
player.sendMessage(ChatColor.GREEN + "You changed " + target.getName() + "'s rank to " + rank.getDisplay());
|
for (Rank rank : Rank.values()) {
|
||||||
if (target.isOnline()) {
|
if (rank.name().equalsIgnoreCase(args[1])) {
|
||||||
target.getPlayer().sendMessage(ChatColor.GREEN + player.getName() + " set your rank to " + rank.getDisplay());
|
rankManager.setRank(target.getUniqueId(), rank);
|
||||||
}
|
player.sendMessage(ChatColor.GREEN + "You changed " + target.getName() + "'s rank to " + rank.getDisplay());
|
||||||
return;
|
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 {
|
} else {
|
||||||
player.sendMessage(ChatColor.RED + "Invalid parameter, use /rank <Player> <Rank>");
|
player.sendMessage("This player has never played in this server before!");
|
||||||
}
|
}
|
||||||
} else {
|
} 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);
|
cooldown.put(player.getUniqueId(), System.currentTimeMillis() + 5000);
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -3,6 +3,7 @@ package me.night.nullvalkyrie.database;
|
||||||
import com.mongodb.MongoException;
|
import com.mongodb.MongoException;
|
||||||
import com.mongodb.client.*;
|
import com.mongodb.client.*;
|
||||||
import com.mongodb.client.model.Filters;
|
import com.mongodb.client.model.Filters;
|
||||||
|
import me.night.nullvalkyrie.Main;
|
||||||
import org.bson.Document;
|
import org.bson.Document;
|
||||||
import org.bson.conversions.Bson;
|
import org.bson.conversions.Bson;
|
||||||
|
|
||||||
|
@ -10,15 +11,18 @@ import java.util.HashMap;
|
||||||
|
|
||||||
public class DatabaseManager {
|
public class DatabaseManager {
|
||||||
private static MongoCollection<Document> users;
|
private static MongoCollection<Document> users;
|
||||||
public DatabaseManager() {
|
private Main main;
|
||||||
|
public DatabaseManager(Main main) {
|
||||||
|
this.main = main;
|
||||||
connect();
|
connect();
|
||||||
}
|
}
|
||||||
public void connect() {
|
public void connect() {
|
||||||
try (MongoClient client = MongoClients.create("mongodb+srv://cath_exe:gaeismypassion@cath-exe.iolb7.mongodb.net/NullValkyrie")) {
|
// 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);
|
// } 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");
|
MongoClient client = MongoClients.create("mongodb+srv://cath_exe:gaeismypassion@cath-exe.iolb7.mongodb.net/NullValkyrie");
|
||||||
MongoDatabase database = client.getDatabase("NullValkyrie");
|
MongoDatabase database = client.getDatabase("NullValkyrie");
|
||||||
users = database.getCollection("users");
|
users = database.getCollection("users");
|
||||||
|
|
|
@ -17,10 +17,10 @@ import org.bukkit.scheduler.BukkitRunnable;
|
||||||
import java.text.DecimalFormat;
|
import java.text.DecimalFormat;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
|
||||||
public class DamageEffect implements Listener {
|
public class DamageEffectEvents implements Listener {
|
||||||
private final Main main;
|
private final Main main;
|
||||||
|
|
||||||
public DamageEffect(Main main) {
|
public DamageEffectEvents(Main main) {
|
||||||
this.main = main;
|
this.main = main;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -63,7 +63,7 @@ public class DamageEffect implements Listener {
|
||||||
ticksLeft--;
|
ticksLeft--;
|
||||||
indicators.put(stand, ticksLeft);
|
indicators.put(stand, ticksLeft);
|
||||||
}
|
}
|
||||||
stands.removeAll(removal);
|
removal.forEach(stands::remove);
|
||||||
}
|
}
|
||||||
}.runTaskTimer(main, 0L, 1L);
|
}.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;
|
import org.bukkit.Bukkit;
|
||||||
|
|
||||||
|
@ -7,7 +7,7 @@ import java.util.Map;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
|
||||||
public class AnimatedSideBar {
|
public class AnimatedSideBar {
|
||||||
private static Map<UUID, Integer> Tasks = new HashMap<>();
|
private static final Map<UUID, Integer> Tasks = new HashMap<>();
|
||||||
private final UUID uuid;
|
private final UUID uuid;
|
||||||
|
|
||||||
public AnimatedSideBar(UUID uuid) {
|
public AnimatedSideBar(UUID uuid) {
|
||||||
|
@ -17,9 +17,7 @@ public class AnimatedSideBar {
|
||||||
Tasks.put(uuid, id);
|
Tasks.put(uuid, id);
|
||||||
}
|
}
|
||||||
public boolean hasID() {
|
public boolean hasID() {
|
||||||
if (Tasks.containsKey(uuid))
|
return Tasks.containsKey(uuid);
|
||||||
return true;
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
public void stop() {
|
public void stop() {
|
||||||
Bukkit.getScheduler().cancelTask(Tasks.get(uuid));
|
Bukkit.getScheduler().cancelTask(Tasks.get(uuid));
|
|
@ -1,18 +1,18 @@
|
||||||
package me.night.nullvalkyrie.rank;
|
package me.night.nullvalkyrie.ui;
|
||||||
|
|
||||||
import org.bukkit.ChatColor;
|
import org.bukkit.ChatColor;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.scoreboard.DisplaySlot;
|
import org.bukkit.scoreboard.Criteria;
|
||||||
import org.bukkit.scoreboard.Objective;
|
import org.bukkit.scoreboard.DisplaySlot;
|
||||||
import org.bukkit.scoreboard.Scoreboard;
|
import org.bukkit.scoreboard.Objective;
|
||||||
|
import org.bukkit.scoreboard.Scoreboard;
|
||||||
public class BelowNameManager {
|
|
||||||
public void setBelowName(Player player) {
|
public class BelowNameManager {
|
||||||
Scoreboard board = player.getScoreboard();
|
public void setBelowName(Player player) {
|
||||||
Objective obj = board.registerNewObjective("HealthBar", "health");
|
Scoreboard board = player.getScoreboard();
|
||||||
obj.setDisplaySlot(DisplaySlot.BELOW_NAME);
|
Objective obj = board.registerNewObjective("HealthBar", Criteria.HEALTH, ChatColor.RED + "❤");
|
||||||
obj.setDisplayName(ChatColor.RED + "❤");
|
obj.setDisplaySlot(DisplaySlot.BELOW_NAME);
|
||||||
player.setScoreboard(board);
|
player.setScoreboard(board);
|
||||||
player.setHealth(player.getHealth());
|
player.setHealth(player.getHealth());
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -1,45 +1,35 @@
|
||||||
package me.night.nullvalkyrie.rank;
|
package me.night.nullvalkyrie.ui;
|
||||||
|
|
||||||
import me.night.nullvalkyrie.Main;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.scoreboard.*;
|
||||||
import org.bukkit.scoreboard.DisplaySlot;
|
|
||||||
import org.bukkit.scoreboard.Objective;
|
public class NameTagManager {
|
||||||
import org.bukkit.scoreboard.Scoreboard;
|
public void setNametags(Player player) {
|
||||||
import org.bukkit.scoreboard.Team;
|
Scoreboard newScoreboard = Bukkit.getScoreboardManager().getNewScoreboard();
|
||||||
|
Objective obj = newScoreboard.registerNewObjective("TabList", Criteria.DUMMY, "");
|
||||||
public class NameTagManager {
|
obj.setDisplaySlot(DisplaySlot.PLAYER_LIST);
|
||||||
private Main main;
|
player.setScoreboard(newScoreboard);
|
||||||
|
for (Rank rank : Rank.values()) {
|
||||||
public NameTagManager(Main main) {
|
Team team = player.getScoreboard().registerNewTeam(rank.name());
|
||||||
this.main = main;
|
team.setPrefix(rank.getDisplay() + " ");
|
||||||
}
|
}
|
||||||
@SuppressWarnings("deprecation")
|
for (Player target : Bukkit.getOnlinePlayers()) {
|
||||||
public void setNametags(Player player) {
|
if (player.getUniqueId() != target.getUniqueId()) {
|
||||||
Scoreboard newScoreboard = Bukkit.getScoreboardManager().getNewScoreboard();
|
Rank rank = ScoreboardListener.rankManager.getRank(target.getUniqueId());
|
||||||
Objective obj = newScoreboard.registerNewObjective("TabList", "dummy");
|
player.getScoreboard().getTeam(rank.name()).addEntry(target.getName());
|
||||||
obj.setDisplaySlot(DisplaySlot.PLAYER_LIST);
|
}
|
||||||
player.setScoreboard(newScoreboard);
|
}
|
||||||
for (Rank rank : Rank.values()) {
|
}
|
||||||
Team team = player.getScoreboard().registerNewTeam(rank.name());
|
public void newTag(Player player) {
|
||||||
team.setPrefix(rank.getDisplay() + " ");
|
Rank rank = ScoreboardListener.rankManager.getRank(player.getUniqueId());
|
||||||
}
|
for(Player target : Bukkit.getOnlinePlayers()) {
|
||||||
for (Player target : Bukkit.getOnlinePlayers()) {
|
target.getScoreboard().getTeam(rank.name()).addEntry(player.getName());
|
||||||
if (player.getUniqueId() != target.getUniqueId()) {
|
}
|
||||||
Rank rank = ScoreboardListener.rankManager.getRank(target.getUniqueId());
|
}
|
||||||
player.getScoreboard().getTeam(rank.name()).addEntry(target.getName());
|
public void removeTag(Player player) {
|
||||||
}
|
for(Player target : Bukkit.getOnlinePlayers()) {
|
||||||
}
|
target.getScoreboard().getEntryTeam(player.getName()).removeEntry(player.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;
|
package me.night.nullvalkyrie.ui;
|
||||||
|
|
||||||
import me.night.nullvalkyrie.Main;
|
import me.night.nullvalkyrie.Main;
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.configuration.file.YamlConfiguration;
|
import org.bukkit.configuration.file.YamlConfiguration;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
|
||||||
import static me.night.nullvalkyrie.rank.ScoreboardListener.nameTagManager;
|
import static me.night.nullvalkyrie.ui.ScoreboardListener.nameTagManager;
|
||||||
|
|
||||||
public class RankManager {
|
public class RankManager {
|
||||||
private File file;
|
private final File file;
|
||||||
private YamlConfiguration config;
|
private final YamlConfiguration config;
|
||||||
|
public RankManager(Main main) {
|
||||||
private Main main;
|
if(!main.getDataFolder().exists()) {
|
||||||
|
main.getDataFolder().mkdir();
|
||||||
public RankManager(Main main) {
|
}
|
||||||
this.main = main;
|
file = new File(main.getDataFolder(), "ranks.yml");
|
||||||
if(!main.getDataFolder().exists()) {
|
if(!file.exists()) {
|
||||||
main.getDataFolder().mkdir();
|
try {
|
||||||
}
|
file.createNewFile();
|
||||||
file = new File(main.getDataFolder(), "ranks.yml");
|
} catch (IOException e) {
|
||||||
if(!file.exists()) {
|
e.printStackTrace();
|
||||||
try {
|
}
|
||||||
file.createNewFile();
|
}
|
||||||
} catch (IOException e) {
|
config = YamlConfiguration.loadConfiguration(file);
|
||||||
e.printStackTrace();
|
}
|
||||||
}
|
public void setRank(UUID uuid, Rank rank) {
|
||||||
}
|
config.set(uuid.toString(), rank.name());
|
||||||
config = YamlConfiguration.loadConfiguration(file);
|
try {
|
||||||
}
|
config.save(file);
|
||||||
public void setRank(UUID uuid, Rank rank) {
|
} catch (IOException e) {
|
||||||
config.set(uuid.toString(), rank.name());
|
e.printStackTrace();
|
||||||
try {
|
}
|
||||||
config.save(file);
|
for(Player player : Bukkit.getOnlinePlayers()) {
|
||||||
} catch (IOException e) {
|
if(player.hasPlayedBefore()) {
|
||||||
e.printStackTrace();
|
nameTagManager.removeTag(player);
|
||||||
}
|
nameTagManager.newTag(player);
|
||||||
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()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
public Rank getRank(UUID uuid) {
|
|
||||||
return Rank.valueOf(config.getString(uuid.toString()));
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,73 +1,73 @@
|
||||||
package me.night.nullvalkyrie.rank;
|
package me.night.nullvalkyrie.ui;
|
||||||
|
|
||||||
import me.night.nullvalkyrie.Main;
|
import me.night.nullvalkyrie.Main;
|
||||||
import me.night.nullvalkyrie.npc.NPC;
|
import me.night.nullvalkyrie.npc.NPC;
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.ChatColor;
|
import org.bukkit.ChatColor;
|
||||||
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;
|
||||||
import org.bukkit.event.entity.PlayerDeathEvent;
|
import org.bukkit.event.entity.PlayerDeathEvent;
|
||||||
import org.bukkit.event.player.AsyncPlayerChatEvent;
|
import org.bukkit.event.player.AsyncPlayerChatEvent;
|
||||||
import org.bukkit.event.player.PlayerJoinEvent;
|
import org.bukkit.event.player.PlayerJoinEvent;
|
||||||
import org.bukkit.event.player.PlayerQuitEvent;
|
import org.bukkit.event.player.PlayerQuitEvent;
|
||||||
|
|
||||||
import static me.night.nullvalkyrie.database.DatabaseManager.createUserSchema;
|
import static me.night.nullvalkyrie.database.DatabaseManager.createUserSchema;
|
||||||
|
|
||||||
public class ScoreboardListener implements Listener {
|
public class ScoreboardListener implements Listener {
|
||||||
|
|
||||||
public static RankManager rankManager;
|
public static RankManager rankManager;
|
||||||
public static NameTagManager nameTagManager;
|
public static NameTagManager nameTagManager;
|
||||||
private final SideBarManager sideBarManager;
|
private final SideBarManager sideBarManager;
|
||||||
private final BelowNameManager belowNameManager;
|
private final BelowNameManager belowNameManager;
|
||||||
public ScoreboardListener(Main main) {
|
public ScoreboardListener(Main main) {
|
||||||
nameTagManager = new NameTagManager(main);
|
nameTagManager = new NameTagManager();
|
||||||
rankManager = new RankManager(main);
|
rankManager = new RankManager(main);
|
||||||
sideBarManager = new SideBarManager(main);
|
sideBarManager = new SideBarManager(main);
|
||||||
belowNameManager = new BelowNameManager();
|
belowNameManager = new BelowNameManager();
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void onJoin(PlayerJoinEvent e) {
|
public void onJoin(PlayerJoinEvent e) {
|
||||||
Player player = e.getPlayer();
|
Player player = e.getPlayer();
|
||||||
if(!player.hasPlayedBefore()) {
|
if(!player.hasPlayedBefore()) {
|
||||||
e.getPlayer().sendTitle(ChatColor.RED + "Welcome to Matrix!", ChatColor.GREEN + "LOL", 20, 100, 20);
|
e.getPlayer().sendTitle(ChatColor.RED + "Welcome to Matrix!", ChatColor.GREEN + "LOL", 20, 100, 20);
|
||||||
rankManager.setRank(player.getUniqueId(), Rank.ROOKIE);
|
rankManager.setRank(player.getUniqueId(), Rank.ROOKIE);
|
||||||
createUserSchema(e.getPlayer().getDisplayName());
|
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");
|
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.setNametags(player);
|
||||||
nameTagManager.newTag(player);
|
nameTagManager.newTag(player);
|
||||||
sideBarManager.setSideBar(player);
|
sideBarManager.setSideBar(player);
|
||||||
sideBarManager.start(player);
|
sideBarManager.start(player);
|
||||||
belowNameManager.setBelowName(player);
|
belowNameManager.setBelowName(player);
|
||||||
e.setJoinMessage(rankManager.getRank(e.getPlayer().getUniqueId()).getDisplay() + " " + e.getPlayer().getName() + ChatColor.WHITE + " joined the server!");
|
e.setJoinMessage(rankManager.getRank(e.getPlayer().getUniqueId()).getDisplay() + " " + e.getPlayer().getName() + ChatColor.WHITE + " joined the server!");
|
||||||
if(NPC.getNPCs() == null) return;
|
if(NPC.getNPCs() == null) return;
|
||||||
if(NPC.getNPCs().isEmpty()) return;
|
if(NPC.getNPCs().isEmpty()) return;
|
||||||
NPC.addJoinPacket(e.getPlayer());
|
NPC.addJoinPacket(e.getPlayer());
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void onQuit(PlayerQuitEvent e) {
|
public void onQuit(PlayerQuitEvent e) {
|
||||||
e.setQuitMessage(ChatColor.RED + "bozo " + e.getPlayer().getName() + " has left.");
|
e.setQuitMessage(ChatColor.RED + "bozo " + e.getPlayer().getName() + " has left.");
|
||||||
nameTagManager.removeTag(e.getPlayer());
|
nameTagManager.removeTag(e.getPlayer());
|
||||||
e.getPlayer().setScoreboard(Bukkit.getScoreboardManager().getNewScoreboard());
|
e.getPlayer().setScoreboard(Bukkit.getScoreboardManager().getNewScoreboard());
|
||||||
AnimatedSideBar board = new AnimatedSideBar(e.getPlayer().getUniqueId());
|
AnimatedSideBar board = new AnimatedSideBar(e.getPlayer().getUniqueId());
|
||||||
if(board.hasID()) {
|
if(board.hasID()) {
|
||||||
board.stop();
|
board.stop();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void onChat(AsyncPlayerChatEvent e) {
|
public void onChat(AsyncPlayerChatEvent e) {
|
||||||
e.setCancelled(true);
|
e.setCancelled(true);
|
||||||
Player player = e.getPlayer();
|
Player player = e.getPlayer();
|
||||||
Bukkit.broadcastMessage(rankManager.getRank(player.getUniqueId()).getDisplay() + " " + player.getName() + ChatColor.WHITE + ": " + e.getMessage());
|
Bukkit.broadcastMessage(rankManager.getRank(player.getUniqueId()).getDisplay() + " " + player.getName() + ChatColor.WHITE + ": " + e.getMessage());
|
||||||
}
|
}
|
||||||
|
|
||||||
//Death changing in sidebar
|
//Death changing in sidebar
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void onDeath(PlayerDeathEvent e) {
|
public void onDeath(PlayerDeathEvent e) {
|
||||||
sideBarManager.changeOnDeath(e.getEntity().getPlayer());
|
if(e.getEntity().getPlayer() == null) sideBarManager.changeOnDeath(e.getEntity().getPlayer());
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -1,107 +1,105 @@
|
||||||
package me.night.nullvalkyrie.rank;
|
package me.night.nullvalkyrie.ui;
|
||||||
|
|
||||||
import me.night.nullvalkyrie.Main;
|
import me.night.nullvalkyrie.Main;
|
||||||
import me.night.nullvalkyrie.util.Util;
|
import me.night.nullvalkyrie.util.Util;
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.ChatColor;
|
import org.bukkit.ChatColor;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.scoreboard.*;
|
import org.bukkit.scoreboard.*;
|
||||||
import org.bukkit.scoreboard.Scoreboard;
|
import org.bukkit.scoreboard.Scoreboard;
|
||||||
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
|
||||||
public class SideBarManager {
|
public class SideBarManager {
|
||||||
private final HashMap<UUID, Integer> deaths = new HashMap<>();
|
private final HashMap<UUID, Integer> deaths = new HashMap<>();
|
||||||
private int taskID;
|
private int taskID;
|
||||||
private final Main main;
|
private final Main main;
|
||||||
|
|
||||||
public SideBarManager(Main main) {
|
public SideBarManager(Main main) {
|
||||||
this.main = main;
|
this.main = main;
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressWarnings("deprecation")
|
public void setSideBar(Player player) {
|
||||||
public void setSideBar(Player player) {
|
Scoreboard board = player.getScoreboard();
|
||||||
Scoreboard board = player.getScoreboard();
|
Objective obj;
|
||||||
Objective obj;
|
if (board.getObjective("Vanadium") != null) {
|
||||||
if (board.getObjective("Vanadium") != null) {
|
obj = board.getObjective("Vanadium");
|
||||||
obj = board.getObjective("Vanadium");
|
} else {
|
||||||
} else {
|
obj = board.registerNewObjective("Vanadium", Criteria.DUMMY, ChatColor.AQUA.toString() + ChatColor.BOLD + ">> Vanadium <<");
|
||||||
obj = board.registerNewObjective("Vanadium", "dummy");
|
}
|
||||||
}
|
obj.setDisplaySlot(DisplaySlot.SIDEBAR);
|
||||||
obj.setDisplaySlot(DisplaySlot.SIDEBAR);
|
Score hypens = obj.getScore(ChatColor.GOLD + "=-=-=-=-=-=-=-=");
|
||||||
obj.setDisplayName(ChatColor.AQUA.toString() + ChatColor.BOLD + ">> Vanadium <<");
|
hypens.setScore(9);
|
||||||
Score hypens = obj.getScore(ChatColor.GOLD + "=-=-=-=-=-=-=-=");
|
Score name = obj.getScore(ChatColor.BLUE + "Player Name: ");
|
||||||
hypens.setScore(9);
|
name.setScore(8);
|
||||||
Score name = obj.getScore(ChatColor.BLUE + "Player Name: ");
|
Score name2 = obj.getScore(ChatColor.WHITE + player.getName());
|
||||||
name.setScore(8);
|
name2.setScore(7);
|
||||||
Score name2 = obj.getScore(ChatColor.WHITE + player.getName());
|
Score space1 = obj.getScore(" ");
|
||||||
name2.setScore(7);
|
space1.setScore(6);
|
||||||
Score space1 = obj.getScore(" ");
|
Score players = obj.getScore(ChatColor.LIGHT_PURPLE + "Players Online:");
|
||||||
space1.setScore(6);
|
players.setScore(5);
|
||||||
Score players = obj.getScore(ChatColor.LIGHT_PURPLE + "Players Online:");
|
Score playercount = obj.getScore(ChatColor.YELLOW.toString() + Bukkit.getServer().getOnlinePlayers().size());
|
||||||
players.setScore(5);
|
playercount.setScore(4);
|
||||||
Score playercount = obj.getScore(ChatColor.YELLOW.toString() + Bukkit.getServer().getOnlinePlayers().size());
|
Score space2 = obj.getScore(" ");
|
||||||
playercount.setScore(4);
|
space2.setScore(2);
|
||||||
Score space2 = obj.getScore(" ");
|
Score website = obj.getScore(ChatColor.YELLOW + "cath.js.org");
|
||||||
space2.setScore(2);
|
website.setScore(1);
|
||||||
Score website = obj.getScore(ChatColor.YELLOW + "cath.js.org");
|
Team playersOnline;
|
||||||
website.setScore(1);
|
if (board.getTeam("deathsTotal") != null) {
|
||||||
Team playersOnline;
|
playersOnline = board.getTeam("deathsTotal");
|
||||||
if (board.getTeam("deathsTotal") != null) {
|
} else playersOnline = board.registerNewTeam("deathsTotal");
|
||||||
playersOnline = board.getTeam("deathsTotal");
|
playersOnline.addEntry(ChatColor.BOLD.toString());
|
||||||
} else playersOnline = board.registerNewTeam("deathsTotal");
|
playersOnline.setPrefix(ChatColor.BLUE + "Deaths: ");
|
||||||
playersOnline.addEntry(ChatColor.BOLD.toString());
|
playersOnline.setSuffix(ChatColor.YELLOW + "0");
|
||||||
playersOnline.setPrefix(ChatColor.BLUE + "Deaths: ");
|
obj.getScore(ChatColor.BOLD.toString()).setScore(3);
|
||||||
playersOnline.setSuffix(ChatColor.YELLOW + "0");
|
player.setScoreboard(board);
|
||||||
obj.getScore(ChatColor.BOLD.toString()).setScore(3);
|
deaths.put(player.getUniqueId(), 0);
|
||||||
player.setScoreboard(board);
|
}
|
||||||
deaths.put(player.getUniqueId(), 0);
|
|
||||||
}
|
public void start(Player player) {
|
||||||
|
taskID = Bukkit.getScheduler().scheduleSyncRepeatingTask(main, new Runnable() {
|
||||||
public void start(Player player) {
|
int count = 0;
|
||||||
taskID = Bukkit.getScheduler().scheduleSyncRepeatingTask(main, new Runnable() {
|
final AnimatedSideBar board = new AnimatedSideBar(player.getUniqueId());
|
||||||
int count = 0;
|
|
||||||
final AnimatedSideBar board = new AnimatedSideBar(player.getUniqueId());
|
public void animate(String str) {
|
||||||
|
Objective objective = player.getScoreboard().getObjective("Vanadium");
|
||||||
public void animate(String str) {
|
objective.setDisplaySlot(DisplaySlot.SIDEBAR);
|
||||||
Objective objective = player.getScoreboard().getObjective("Vanadium");
|
objective.setDisplayName(Util.color(str));
|
||||||
objective.setDisplaySlot(DisplaySlot.SIDEBAR);
|
}
|
||||||
objective.setDisplayName(Util.color(str));
|
|
||||||
}
|
@Override
|
||||||
|
public void run() {
|
||||||
@Override
|
if (!board.hasID())
|
||||||
public void run() {
|
board.setID(taskID);
|
||||||
if (!board.hasID())
|
if (count == 13)
|
||||||
board.setID(taskID);
|
count = 0;
|
||||||
if (count == 13)
|
switch (count) {
|
||||||
count = 0;
|
case 0 -> animate("&1&l>> &e&lVanadium&1&l <<");
|
||||||
switch (count) {
|
case 1 -> animate("&b&l>&1&l> &e&lVanadium &1&l<<");
|
||||||
case 0 -> animate("&1&l>> &e&lVanadium&1&l <<");
|
case 2 -> animate("&1&l>&b&l> &e&lVanadium &1&l<<");
|
||||||
case 1 -> animate("&b&l>&1&l> &e&lVanadium &1&l<<");
|
case 3 -> animate("&1&l>> &b&lV&e&lanadium&1&l <<");
|
||||||
case 2 -> animate("&1&l>&b&l> &e&lVanadium &1&l<<");
|
case 4 -> animate("&1&l>> &e&lV&b&la&e&lnadium&1&l <<");
|
||||||
case 3 -> animate("&1&l>> &b&lV&e&lanadium&1&l <<");
|
case 5 -> animate("&1&l>> &e&lVa&b&ln&e&ladium&1&l <<");
|
||||||
case 4 -> animate("&1&l>> &e&lV&b&la&e&lnadium&1&l <<");
|
case 6 -> animate("&1&l>> &e&lVan&b&la&e&ldium&1&l <<");
|
||||||
case 5 -> animate("&1&l>> &e&lVa&b&ln&e&ladium&1&l <<");
|
case 7 -> animate("&1&l>> &e&lVana&b&ld&e&lium&1&l <<");
|
||||||
case 6 -> animate("&1&l>> &e&lVan&b&la&e&ldium&1&l <<");
|
case 8 -> animate("&1&l>> &e&lVanad&b&li&e&lum&1&l <<");
|
||||||
case 7 -> animate("&1&l>> &e&lVana&b&ld&e&lium&1&l <<");
|
case 9 -> animate("&1&l>> &e&lVanadi&b&lu&e&lm&1&l <<");
|
||||||
case 8 -> animate("&1&l>> &e&lVanad&b&li&e&lum&1&l <<");
|
case 10 -> animate("&1&l>> &e&lVanadiu&b&lm&1&l <<");
|
||||||
case 9 -> animate("&1&l>> &e&lVanadi&b&lu&e&lm&1&l <<");
|
case 11 -> animate("&1&l>> &e&lVanadium &b&l<&1&l<");
|
||||||
case 10 -> animate("&1&l>> &e&lVanadiu&b&lm&1&l <<");
|
case 12 -> {
|
||||||
case 11 -> animate("&1&l>> &e&lVanadium &b&l<&1&l<");
|
animate("&1&l>> &e&lVanadium &1&l<&b&l<");
|
||||||
case 12 -> {
|
setSideBar(player);
|
||||||
animate("&1&l>> &e&lVanadium &1&l<&b&l<");
|
}
|
||||||
setSideBar(player);
|
}
|
||||||
}
|
count++;
|
||||||
}
|
}
|
||||||
count++;
|
}, 0, 10);
|
||||||
}
|
}
|
||||||
}, 0, 10);
|
|
||||||
}
|
public void changeOnDeath(Player player) {
|
||||||
|
int amount = deaths.get(player.getUniqueId());
|
||||||
public void changeOnDeath(Player player) {
|
deaths.put(player.getUniqueId(), amount++);
|
||||||
int amount = deaths.get(player.getUniqueId());
|
player.getScoreboard().getTeam("deathsTotal").setSuffix(ChatColor.YELLOW.toString() + amount);
|
||||||
deaths.put(player.getUniqueId(), amount++);
|
}
|
||||||
player.getScoreboard().getTeam("deathsTotal").setSuffix(ChatColor.YELLOW.toString() + amount);
|
}
|
||||||
}
|
|
||||||
}
|
|
Loading…
Reference in a new issue