fixing bugs
This commit is contained in:
parent
9979c9de23
commit
63a1d5e4ae
2 changed files with 36 additions and 47 deletions
|
@ -26,13 +26,12 @@ public class CustomItemManager {
|
||||||
public static HashMap<String, NamespacedKey> keys = new HashMap<>();
|
public static HashMap<String, NamespacedKey> keys = new HashMap<>();
|
||||||
private static Main main;
|
private static Main main;
|
||||||
public CustomItemManager(Main main) {
|
public CustomItemManager(Main main) {
|
||||||
this.main = main;
|
CustomItemManager.main = main;
|
||||||
main.getConfig().options().copyDefaults();
|
main.getConfig().options().copyDefaults();
|
||||||
main.saveDefaultConfig();
|
main.saveDefaultConfig();
|
||||||
if(!main.getDataFolder().exists()) {
|
if(!main.getDataFolder().exists()) {
|
||||||
main.getDataFolder().mkdir();
|
main.getDataFolder().mkdir();
|
||||||
}
|
}
|
||||||
|
|
||||||
createDirectoryInPluginFolder("ItemData");
|
createDirectoryInPluginFolder("ItemData");
|
||||||
createFilesFromConfig(main.getConfig());
|
createFilesFromConfig(main.getConfig());
|
||||||
register();
|
register();
|
||||||
|
@ -151,17 +150,18 @@ public class CustomItemManager {
|
||||||
return YamlConfiguration.loadConfiguration(f);
|
return YamlConfiguration.loadConfiguration(f);
|
||||||
}
|
}
|
||||||
public static File loadFile(String path) {
|
public static File loadFile(String path) {
|
||||||
File f = new File(main.getDataFolder(), path);
|
File file = new File(main.getDataFolder(), path);
|
||||||
if(!f.exists()) {
|
if(!file.exists()) {
|
||||||
try {
|
try {
|
||||||
f.createNewFile();
|
file.createNewFile();
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
return f;
|
return file;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void createDirectoryInPluginFolder(String path) {
|
public static void createDirectoryInPluginFolder(String path) {
|
||||||
File f = new File(main.getDataFolder(), path);
|
File f = new File(main.getDataFolder(), path);
|
||||||
if(!f.exists()) {
|
if(!f.exists()) {
|
||||||
|
@ -219,4 +219,10 @@ public class CustomItemManager {
|
||||||
public static ItemStack getItem(String name){
|
public static ItemStack getItem(String name){
|
||||||
return weapons.get(name);
|
return weapons.get(name);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static void updateYamlFilesToPlugin(String path) {
|
||||||
|
File file = new File(main.getDataFolder(), path); //xxx.yml
|
||||||
|
if (!file.exists()) main.saveResource(path, true);
|
||||||
|
else main.saveResource(path, true);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
package me.night.nullvalkyrie.rank;
|
package me.night.nullvalkyrie.rank;
|
||||||
|
|
||||||
import me.night.nullvalkyrie.Main;
|
import me.night.nullvalkyrie.Main;
|
||||||
|
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;
|
||||||
|
@ -13,7 +14,7 @@ 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 Main main;
|
private final Main main;
|
||||||
|
|
||||||
public SideBarManager(Main main) {
|
public SideBarManager(Main main) {
|
||||||
this.main = main;
|
this.main = main;
|
||||||
|
@ -63,6 +64,12 @@ public class SideBarManager {
|
||||||
int count = 0;
|
int count = 0;
|
||||||
final AnimatedSideBar board = new AnimatedSideBar(player.getUniqueId());
|
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
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
if (!board.hasID())
|
if (!board.hasID())
|
||||||
|
@ -70,46 +77,22 @@ public class SideBarManager {
|
||||||
if (count == 13)
|
if (count == 13)
|
||||||
count = 0;
|
count = 0;
|
||||||
switch (count) {
|
switch (count) {
|
||||||
case 0:
|
case 0 -> animate("&1&l>> &e&lVanadium&1&l <<");
|
||||||
player.getScoreboard().getObjective(DisplaySlot.SIDEBAR).setDisplayName(ChatColor.translateAlternateColorCodes('&', "&1&l>> &e&lVanadium&1&l <<"));
|
case 1 -> animate("&b&l>&1&l> &e&lVanadium &1&l<<");
|
||||||
break;
|
case 2 -> animate("&1&l>&b&l> &e&lVanadium &1&l<<");
|
||||||
case 1:
|
case 3 -> animate("&1&l>> &b&lV&e&lanadium&1&l <<");
|
||||||
player.getScoreboard().getObjective(DisplaySlot.SIDEBAR).setDisplayName(ChatColor.translateAlternateColorCodes('&', "&b&l>&1&l> &e&lVanadium &1&l<<")); //>
|
case 4 -> animate("&1&l>> &e&lV&b&la&e&lnadium&1&l <<");
|
||||||
break;
|
case 5 -> animate("&1&l>> &e&lVa&b&ln&e&ladium&1&l <<");
|
||||||
case 2:
|
case 6 -> animate("&1&l>> &e&lVan&b&la&e&ldium&1&l <<");
|
||||||
player.getScoreboard().getObjective(DisplaySlot.SIDEBAR).setDisplayName(ChatColor.translateAlternateColorCodes('&', "&1&l>&b&l> &e&lVanadium &1&l<<")); //>>
|
case 7 -> animate("&1&l>> &e&lVana&b&ld&e&lium&1&l <<");
|
||||||
break;
|
case 8 -> animate("&1&l>> &e&lVanad&b&li&e&lum&1&l <<");
|
||||||
case 3:
|
case 9 -> animate("&1&l>> &e&lVanadi&b&lu&e&lm&1&l <<");
|
||||||
player.getScoreboard().getObjective(DisplaySlot.SIDEBAR).setDisplayName(ChatColor.translateAlternateColorCodes('&', "&1&l>> &b&lV&e&lanadium&1&l <<"));//V
|
case 10 -> animate("&1&l>> &e&lVanadiu&b&lm&1&l <<");
|
||||||
break;
|
case 11 -> animate("&1&l>> &e&lVanadium &b&l<&1&l<");
|
||||||
case 4:
|
case 12 -> {
|
||||||
player.getScoreboard().getObjective(DisplaySlot.SIDEBAR).setDisplayName(ChatColor.translateAlternateColorCodes('&', "&1&l>> &e&lV&b&la&e&lnadium&1&l <<")); //Va
|
animate("&1&l>> &e&lVanadium &1&l<&b&l<");
|
||||||
break;
|
|
||||||
case 5:
|
|
||||||
player.getScoreboard().getObjective(DisplaySlot.SIDEBAR).setDisplayName(ChatColor.translateAlternateColorCodes('&', "&1&l>> &e&lVa&b&ln&e&ladium&1&l <<")); //Van
|
|
||||||
break;
|
|
||||||
case 6:
|
|
||||||
player.getScoreboard().getObjective(DisplaySlot.SIDEBAR).setDisplayName(ChatColor.translateAlternateColorCodes('&', "&1&l>> &e&lVan&b&la&e&ldium&1&l <<")); //Vana
|
|
||||||
break;
|
|
||||||
case 7:
|
|
||||||
player.getScoreboard().getObjective(DisplaySlot.SIDEBAR).setDisplayName(ChatColor.translateAlternateColorCodes('&', "&1&l>> &e&lVana&b&ld&e&lium&1&l <<")); //Vanad
|
|
||||||
break;
|
|
||||||
case 8:
|
|
||||||
player.getScoreboard().getObjective(DisplaySlot.SIDEBAR).setDisplayName(ChatColor.translateAlternateColorCodes('&', "&1&l>> &e&lVanad&b&li&e&lum&1&l <<")); //Vanadi
|
|
||||||
break;
|
|
||||||
case 9:
|
|
||||||
player.getScoreboard().getObjective(DisplaySlot.SIDEBAR).setDisplayName(ChatColor.translateAlternateColorCodes('&', "&1&l>> &e&lVanadi&b&lu&e&lm&1&l <<")); // Vanadiu
|
|
||||||
break;
|
|
||||||
case 10:
|
|
||||||
player.getScoreboard().getObjective(DisplaySlot.SIDEBAR).setDisplayName(ChatColor.translateAlternateColorCodes('&', "&1&l>> &e&lVanadiu&b&lm&1&l <<")); //Vanadium
|
|
||||||
break;
|
|
||||||
case 11:
|
|
||||||
player.getScoreboard().getObjective(DisplaySlot.SIDEBAR).setDisplayName(ChatColor.translateAlternateColorCodes('&', "&1&l>> &e&lVanadium &b&l<&1&l<")); // <
|
|
||||||
break;
|
|
||||||
case 12:
|
|
||||||
player.getScoreboard().getObjective(DisplaySlot.SIDEBAR).setDisplayName(ChatColor.translateAlternateColorCodes('&', "&1&l>> &e&lVanadium &1&l<&b&l<")); // <<
|
|
||||||
setSideBar(player);
|
setSideBar(player);
|
||||||
break;
|
}
|
||||||
}
|
}
|
||||||
count++;
|
count++;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue