change to linux
This commit is contained in:
parent
b6cb03bba4
commit
3425352908
39 changed files with 2262 additions and 2045 deletions
6
pom.xml
6
pom.xml
|
@ -4,7 +4,7 @@
|
|||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<groupId>com.night</groupId>
|
||||
<groupId>me.night</groupId>
|
||||
<artifactId>NullValkyrie</artifactId>
|
||||
<version>1.0.1</version>
|
||||
<packaging>jar</packaging>
|
||||
|
@ -51,7 +51,7 @@
|
|||
<artifactId>maven-jar-plugin</artifactId>
|
||||
<version>2.4</version>
|
||||
<configuration>
|
||||
<outputDirectory>D:\Server\plugins</outputDirectory>
|
||||
<outputDirectory>media/night0721/Data/Network/Lobby/plugins</outputDirectory>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<!-- <plugin>-->
|
||||
|
@ -109,7 +109,7 @@
|
|||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.spigotmc</groupId>
|
||||
<artifactId>spigot</artifactId>
|
||||
<artifactId>spigot-api</artifactId>
|
||||
<version>1.18.1-R0.1-SNAPSHOT</version>
|
||||
<!-- <classifier>remapped-mojang</classifier>-->
|
||||
<scope>provided</scope>
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
package com.night.nullvalkyrie.Chests;
|
||||
package me.night.nullvalkyrie.Chests;
|
||||
|
||||
import com.night.nullvalkyrie.commands.MenuCommand;
|
||||
import me.night.nullvalkyrie.commands.MenuCommand;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
|
@ -1,4 +1,4 @@
|
|||
package com.night.nullvalkyrie.Chests;
|
||||
package me.night.nullvalkyrie.Chests;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.ChatColor;
|
|
@ -1,4 +1,4 @@
|
|||
package com.night.nullvalkyrie.Discord;
|
||||
package me.night.nullvalkyrie.Discord;
|
||||
import net.dv8tion.jda.api.JDA;
|
||||
import net.dv8tion.jda.api.JDABuilder;
|
||||
import net.dv8tion.jda.api.entities.Activity;
|
|
@ -1,4 +1,4 @@
|
|||
package com.night.nullvalkyrie.Enchantments;
|
||||
package me.night.nullvalkyrie.Enchantments;
|
||||
|
||||
import org.bukkit.NamespacedKey;
|
||||
import org.bukkit.enchantments.Enchantment;
|
|
@ -1,4 +1,4 @@
|
|||
package com.night.nullvalkyrie.Enchantments;
|
||||
package me.night.nullvalkyrie.Enchantments;
|
||||
|
||||
import org.bukkit.enchantments.Enchantment;
|
||||
|
|
@ -1,7 +1,9 @@
|
|||
package com.night.nullvalkyrie.Events;
|
||||
package me.night.nullvalkyrie.Events;
|
||||
|
||||
import com.night.nullvalkyrie.Items.Rarity;
|
||||
import com.night.nullvalkyrie.Main;
|
||||
import me.night.nullvalkyrie.Items.CustomItemManager;
|
||||
import me.night.nullvalkyrie.Items.Rarity;
|
||||
import me.night.nullvalkyrie.Main;
|
||||
import me.night.nullvalkyrie.commands.SpawnCommand;
|
||||
import org.bukkit.*;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.entity.*;
|
||||
|
@ -11,14 +13,14 @@ import org.bukkit.event.block.Action;
|
|||
import org.bukkit.event.entity.*;
|
||||
import org.bukkit.event.player.PlayerBucketEmptyEvent;
|
||||
import org.bukkit.event.player.PlayerFishEvent;
|
||||
import org.bukkit.event.player.PlayerInteractEntityEvent;
|
||||
import org.bukkit.event.player.PlayerInteractEvent;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.inventory.Merchant;
|
||||
import org.bukkit.inventory.MerchantRecipe;
|
||||
import org.bukkit.scheduler.BukkitRunnable;
|
||||
|
||||
import java.util.Set;
|
||||
import java.util.concurrent.atomic.AtomicInteger;
|
||||
|
||||
import static com.night.nullvalkyrie.Items.CustomItemManager.loadConfig;
|
||||
import static com.night.nullvalkyrie.commands.SpawnCommand.getRandomWithNeg;
|
||||
import java.util.*;
|
||||
|
||||
public class CustomItemEvents implements Listener {
|
||||
private Main main;
|
||||
|
@ -47,13 +49,13 @@ public class CustomItemEvents implements Listener {
|
|||
String name = player.getInventory().getItemInMainHand().getItemMeta().getDisplayName();
|
||||
if(name.equalsIgnoreCase(Rarity.MYTHIC.getColor() + "Fabled Widow Sword")) {
|
||||
if (e.getEntity() instanceof Zombie) {
|
||||
int zombie = loadConfig("ItemData\\WidowSword.yml").getInt("zombie");
|
||||
int zombie = CustomItemManager.loadConfig("ItemData\\WidowSword.yml").getInt("zombie");
|
||||
e.setDamage(e.getDamage() * (1 + zombie / 100));
|
||||
} else if (e.getEntity() instanceof Skeleton) {
|
||||
int skeleton = loadConfig("ItemData\\WidowSword.yml").getInt("skeleton");
|
||||
int skeleton = CustomItemManager.loadConfig("ItemData\\WidowSword.yml").getInt("skeleton");
|
||||
e.setDamage(e.getDamage() * (1 + skeleton / 100));
|
||||
} else if (e.getEntity() instanceof Spider) {
|
||||
int spider = loadConfig("ItemData\\WidowSword.yml").getInt("spider");
|
||||
int spider = CustomItemManager.loadConfig("ItemData\\WidowSword.yml").getInt("spider");
|
||||
e.setDamage(e.getDamage() * (1 + spider / 100));
|
||||
}
|
||||
}
|
||||
|
@ -259,7 +261,7 @@ public class CustomItemEvents implements Listener {
|
|||
|
||||
}
|
||||
public Location generateRandomCoord(int size, World world) {
|
||||
int ranX = getRandomWithNeg(size), ranZ = getRandomWithNeg(size);
|
||||
int ranX = SpawnCommand.getRandomWithNeg(size), ranZ = SpawnCommand.getRandomWithNeg(size);
|
||||
Block block = world.getHighestBlockAt(ranX, ranZ);
|
||||
return block.getLocation();
|
||||
}
|
||||
|
@ -278,4 +280,39 @@ public class CustomItemEvents implements Listener {
|
|||
}, 0L, 20L);
|
||||
}
|
||||
|
||||
private final Map<UUID, Merchant> villagerlist = new HashMap<>();
|
||||
@EventHandler
|
||||
public void onClick(PlayerInteractEntityEvent e) {
|
||||
Player p = e.getPlayer();
|
||||
Entity clickedEntity = e.getRightClicked();
|
||||
if (clickedEntity instanceof Creeper) {
|
||||
if (p.getInventory().getItemInMainHand().getType() != Material.STICK) return;
|
||||
clickedEntity.remove();
|
||||
Location loc = clickedEntity.getLocation();
|
||||
Villager villager = (Villager) p.getWorld().spawnEntity(loc, EntityType.VILLAGER);
|
||||
villager.setProfession(Villager.Profession.TOOLSMITH);
|
||||
List<MerchantRecipe> recipes = new ArrayList<>();
|
||||
MerchantRecipe bread = new MerchantRecipe(new ItemStack(Material.BREAD, 3), 10);
|
||||
bread.addIngredient(new ItemStack(Material.EMERALD, 10));
|
||||
recipes.add(bread);
|
||||
|
||||
MerchantRecipe tntStick = new MerchantRecipe(CustomItemManager.getItem("Terminator"), 10);
|
||||
tntStick.addIngredient(CustomItemManager.getItem("Widow Sword"));
|
||||
recipes.add(tntStick);
|
||||
Merchant merchant = Bukkit.createMerchant("Yum Yum In The Tum Tum");
|
||||
merchant.setRecipes(recipes);
|
||||
|
||||
villagerlist.put(villager.getUniqueId(), merchant);
|
||||
|
||||
p.spawnParticle(Particle.END_ROD, loc, 30, 0, 1, 0, 0.2);
|
||||
p.openMerchant(merchant, true);
|
||||
}
|
||||
if (e.getRightClicked() instanceof Villager) {
|
||||
Merchant merchant = villagerlist.get(clickedEntity.getUniqueId());
|
||||
if (merchant == null) return;
|
||||
e.setCancelled(true);
|
||||
p.openMerchant(merchant, true);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
|
@ -1,6 +1,6 @@
|
|||
package com.night.nullvalkyrie.Items;
|
||||
package me.night.nullvalkyrie.Items;
|
||||
|
||||
import com.night.nullvalkyrie.Main;
|
||||
import me.night.nullvalkyrie.Main;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.NamespacedKey;
|
||||
|
@ -28,14 +28,14 @@ public class CustomItemManager {
|
|||
if(!main.getDataFolder().exists()) {
|
||||
main.getDataFolder().mkdir();
|
||||
}
|
||||
createItemDataDirectory("ItemData");
|
||||
createDirectoryInPluginFolder("ItemData");
|
||||
createFilesFromConfig(main.getConfig());
|
||||
register();
|
||||
}
|
||||
public void register() {
|
||||
List<String> hh = getAllFilesFromDirectory("ItemData");
|
||||
for(int kk = 0; kk < hh.size(); kk++) {
|
||||
FileConfiguration c = loadConfig("ItemData\\" + hh.get(kk));
|
||||
FileConfiguration c = loadConfig("ItemData/" + hh.get(kk));
|
||||
ItemStack i = new ItemStack(Material.matchMaterial(c.getString("material")));
|
||||
HashMap<String, List<String>> d = new HashMap<>();
|
||||
List<String> pr = new ArrayList<>();
|
||||
|
@ -145,7 +145,7 @@ public class CustomItemManager {
|
|||
}
|
||||
return f;
|
||||
}
|
||||
private static void createItemDataDirectory(String path) {
|
||||
public static void createDirectoryInPluginFolder(String path) {
|
||||
File f = new File(main.getDataFolder(), path);
|
||||
if(!f.exists()) {
|
||||
try {
|
||||
|
@ -168,6 +168,7 @@ public class CustomItemManager {
|
|||
File f = new File(main.getDataFolder(), path);
|
||||
File[] files = f.listFiles();
|
||||
for (int i = 0; i < files.length; i++) {
|
||||
System.out.println(files[i].getName());
|
||||
ns.add(files[i].getName());
|
||||
}
|
||||
} catch (Exception e) {
|
||||
|
@ -177,7 +178,7 @@ public class CustomItemManager {
|
|||
}
|
||||
public void createFilesFromConfig(FileConfiguration config) {
|
||||
for(String a : config.getKeys(false)) {
|
||||
FileConfiguration c = loadConfig("ItemData\\" + a + ".yml");
|
||||
FileConfiguration c = loadConfig("ItemData/" + a + ".yml");
|
||||
for(String b : config.getKeys(true)) {
|
||||
if(b.startsWith(a)) {
|
||||
List<String> d = new ArrayList<>(Arrays.asList(b.split("\\.")));
|
||||
|
@ -189,7 +190,7 @@ public class CustomItemManager {
|
|||
c.set(String.join(".", d), config.get(b));
|
||||
}
|
||||
try {
|
||||
c.save(loadFile("ItemData\\" + a + ".yml"));
|
||||
c.save(loadFile("ItemData/" + a + ".yml"));
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
|
@ -1,4 +1,4 @@
|
|||
package com.night.nullvalkyrie.Items;
|
||||
package me.night.nullvalkyrie.Items;
|
||||
|
||||
import org.bukkit.ChatColor;
|
||||
public enum Rarity {
|
|
@ -1,13 +1,13 @@
|
|||
package com.night.nullvalkyrie;
|
||||
package me.night.nullvalkyrie;
|
||||
|
||||
import com.night.nullvalkyrie.Chests.MenuListener;
|
||||
import com.night.nullvalkyrie.Discord.DiscordClientManager;
|
||||
import com.night.nullvalkyrie.Enchantments.EnchantmentManager;
|
||||
import com.night.nullvalkyrie.Events.CustomItemEvents;
|
||||
import com.night.nullvalkyrie.Items.CustomItemManager;
|
||||
import com.night.nullvalkyrie.Rank.*;
|
||||
import com.night.nullvalkyrie.Util.Util;
|
||||
import com.night.nullvalkyrie.commands.*;
|
||||
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.Items.CustomItemManager;
|
||||
import me.night.nullvalkyrie.Rank.ScoreboardListener;
|
||||
import me.night.nullvalkyrie.Util.Util;
|
||||
import me.night.nullvalkyrie.commands.*;
|
||||
import net.md_5.bungee.api.ChatMessageType;
|
||||
import net.md_5.bungee.api.chat.TextComponent;
|
||||
import org.bukkit.*;
|
||||
|
@ -45,6 +45,7 @@ public final class Main extends JavaPlugin implements Listener {
|
|||
new RankCommand(this);
|
||||
new UtilCommand(this);
|
||||
new WeaponCommand(this);
|
||||
new MinerCommand(this);
|
||||
bossbar = Bukkit.createBossBar(ChatColor.GOLD + "Kuudra", BarColor.RED, BarStyle.SEGMENTED_12);
|
||||
Bukkit.getPluginManager().registerEvents(this, this);
|
||||
Bukkit.getPluginManager().registerEvents(new MenuListener(), this);
|
||||
|
@ -53,7 +54,6 @@ public final class Main extends JavaPlugin implements Listener {
|
|||
Bukkit.getPluginManager().registerEvents(new SpawnCommand(this), this);
|
||||
new EnchantmentManager();
|
||||
new DiscordClientManager();
|
||||
|
||||
customItemManager = new CustomItemManager(this);
|
||||
}
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
package com.night.nullvalkyrie.Rank;
|
||||
package me.night.nullvalkyrie.Rank;
|
||||
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.entity.Player;
|
|
@ -1,6 +1,6 @@
|
|||
package com.night.nullvalkyrie.Rank;
|
||||
package me.night.nullvalkyrie.Rank;
|
||||
|
||||
import com.night.nullvalkyrie.Main;
|
||||
import me.night.nullvalkyrie.Main;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.scoreboard.DisplaySlot;
|
||||
|
@ -8,8 +8,6 @@ import org.bukkit.scoreboard.Objective;
|
|||
import org.bukkit.scoreboard.Scoreboard;
|
||||
import org.bukkit.scoreboard.Team;
|
||||
|
||||
import static com.night.nullvalkyrie.Rank.ScoreboardListener.rankManager;
|
||||
|
||||
public class NameTagManager {
|
||||
private Main main;
|
||||
|
||||
|
@ -28,13 +26,13 @@ public class NameTagManager {
|
|||
}
|
||||
for (Player target : Bukkit.getOnlinePlayers()) {
|
||||
if (player.getUniqueId() != target.getUniqueId()) {
|
||||
Rank rank = rankManager.getRank(target.getUniqueId());
|
||||
Rank rank = ScoreboardListener.rankManager.getRank(target.getUniqueId());
|
||||
player.getScoreboard().getTeam(rank.name()).addEntry(target.getName());
|
||||
}
|
||||
}
|
||||
}
|
||||
public void newTag(Player player) {
|
||||
Rank rank = rankManager.getRank(player.getUniqueId());
|
||||
Rank rank = ScoreboardListener.rankManager.getRank(player.getUniqueId());
|
||||
for(Player target : Bukkit.getOnlinePlayers()) {
|
||||
target.getScoreboard().getTeam(rank.name()).addEntry(player.getName());
|
||||
}
|
|
@ -1,4 +1,4 @@
|
|||
package com.night.nullvalkyrie.Rank;
|
||||
package me.night.nullvalkyrie.Rank;
|
||||
|
||||
import org.bukkit.ChatColor;
|
||||
|
|
@ -1,6 +1,6 @@
|
|||
package com.night.nullvalkyrie.Rank;
|
||||
package me.night.nullvalkyrie.Rank;
|
||||
|
||||
import com.night.nullvalkyrie.Main;
|
||||
import me.night.nullvalkyrie.Main;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.configuration.file.YamlConfiguration;
|
||||
import org.bukkit.entity.Player;
|
||||
|
@ -9,7 +9,7 @@ import java.io.File;
|
|||
import java.io.IOException;
|
||||
import java.util.UUID;
|
||||
|
||||
import static com.night.nullvalkyrie.Rank.ScoreboardListener.nameTagManager;
|
||||
import static me.night.nullvalkyrie.Rank.ScoreboardListener.nameTagManager;
|
||||
|
||||
public class RankManager {
|
||||
private File file;
|
|
@ -1,6 +1,6 @@
|
|||
package com.night.nullvalkyrie.Rank;
|
||||
package me.night.nullvalkyrie.Rank;
|
||||
|
||||
import com.night.nullvalkyrie.Main;
|
||||
import me.night.nullvalkyrie.Main;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.entity.Player;
|
|
@ -1,6 +1,5 @@
|
|||
package com.night.nullvalkyrie.Rank;
|
||||
package me.night.nullvalkyrie.Rank;
|
||||
|
||||
import com.night.nullvalkyrie.Main;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.entity.Player;
|
|
@ -1,4 +1,4 @@
|
|||
package com.night.nullvalkyrie.Util;
|
||||
package me.night.nullvalkyrie.Util;
|
||||
|
||||
public class Util {
|
||||
public static String centerText(String text, int lineLength) {
|
|
@ -1,4 +1,4 @@
|
|||
package com.night.nullvalkyrie.Util;
|
||||
package me.night.nullvalkyrie.Util;
|
||||
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.Material;
|
|
@ -1,4 +1,4 @@
|
|||
package com.night.nullvalkyrie.Util.components;
|
||||
package me.night.nullvalkyrie.Util.components;
|
||||
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
|
@ -12,8 +12,8 @@ import org.bukkit.inventory.ItemStack;
|
|||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
import static com.night.nullvalkyrie.Util.Utils.color;
|
||||
import static com.night.nullvalkyrie.Util.Utils.*;
|
||||
import static me.night.nullvalkyrie.Util.Utils.color;
|
||||
import static me.night.nullvalkyrie.Util.Utils.*;
|
||||
|
||||
public enum CustomMob {
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
package com.night.nullvalkyrie.Util.components;
|
||||
package me.night.nullvalkyrie.Util.components;
|
||||
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.inventory.ItemStack;
|
|
@ -1,4 +1,4 @@
|
|||
package com.night.nullvalkyrie.commands;
|
||||
package me.night.nullvalkyrie.commands;
|
||||
|
||||
|
||||
//import net.minecraft.network.protocol.game.PacketPlayOutOpenWindow;
|
|
@ -1,4 +1,4 @@
|
|||
package com.night.nullvalkyrie.commands;
|
||||
package me.night.nullvalkyrie.commands;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Material;
|
|
@ -1,4 +1,4 @@
|
|||
package com.night.nullvalkyrie.commands;
|
||||
package me.night.nullvalkyrie.commands;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.ChatColor;
|
|
@ -1,4 +1,4 @@
|
|||
package com.night.nullvalkyrie.commands;
|
||||
package me.night.nullvalkyrie.commands;
|
||||
|
||||
|
||||
import org.bukkit.command.CommandSender;
|
|
@ -1,4 +1,4 @@
|
|||
package com.night.nullvalkyrie.commands;
|
||||
package me.night.nullvalkyrie.commands;
|
||||
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
|
@ -1,4 +1,4 @@
|
|||
package com.night.nullvalkyrie.commands;
|
||||
package me.night.nullvalkyrie.commands;
|
||||
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.Location;
|
|
@ -1,4 +1,4 @@
|
|||
package com.night.nullvalkyrie.commands;
|
||||
package me.night.nullvalkyrie.commands;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.ChatColor;
|
|
@ -1,4 +1,4 @@
|
|||
package com.night.nullvalkyrie.commands;
|
||||
package me.night.nullvalkyrie.commands;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.ChatColor;
|
|
@ -0,0 +1,35 @@
|
|||
package me.night.nullvalkyrie.commands;
|
||||
|
||||
import me.night.nullvalkyrie.Main;
|
||||
import me.night.nullvalkyrie.miners.MinerGUI;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
import com.night.nullvalkyrie.miners.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class MinerCommand extends Command {
|
||||
private Main main;
|
||||
public MinerCommand(Main main) {
|
||||
super(
|
||||
"miner",
|
||||
new String[]{"m", "miners"},
|
||||
"Miner list",
|
||||
""
|
||||
);
|
||||
this.main = main;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCommand(CommandSender sender, String[] args) {
|
||||
if(sender instanceof Player) {
|
||||
Player player = (Player) sender;
|
||||
new MinerGUI(main, player);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> onTabComplete(CommandSender sender, String[] args) {
|
||||
return null;
|
||||
}
|
||||
}
|
|
@ -1,9 +1,9 @@
|
|||
package com.night.nullvalkyrie.commands;
|
||||
package me.night.nullvalkyrie.commands;
|
||||
|
||||
import com.google.common.cache.Cache;
|
||||
import com.google.common.cache.CacheBuilder;
|
||||
import com.night.nullvalkyrie.Main;
|
||||
import com.night.nullvalkyrie.Rank.Rank;
|
||||
import me.night.nullvalkyrie.Main;
|
||||
import me.night.nullvalkyrie.Rank.Rank;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.OfflinePlayer;
|
||||
|
@ -16,7 +16,7 @@ import java.util.List;
|
|||
import java.util.UUID;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
import static com.night.nullvalkyrie.Rank.ScoreboardListener.rankManager;
|
||||
import static me.night.nullvalkyrie.Rank.ScoreboardListener.rankManager;
|
||||
|
||||
//92.0.69.141:25565
|
||||
public class RankCommand extends Command {
|
|
@ -1,7 +1,8 @@
|
|||
package com.night.nullvalkyrie.commands;
|
||||
package me.night.nullvalkyrie.commands;
|
||||
|
||||
import com.night.nullvalkyrie.Main;
|
||||
import com.night.nullvalkyrie.Util.components.CustomMob;
|
||||
import me.night.nullvalkyrie.Main;
|
||||
import me.night.nullvalkyrie.Util.components.CustomMob;
|
||||
import me.night.nullvalkyrie.Util.Utils;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.World;
|
||||
|
@ -17,8 +18,6 @@ import org.bukkit.scheduler.BukkitRunnable;
|
|||
import java.text.DecimalFormat;
|
||||
import java.util.*;
|
||||
|
||||
import static com.night.nullvalkyrie.Util.Utils.color;
|
||||
|
||||
public class SpawnCommand extends Command implements Listener {
|
||||
private final Main main;
|
||||
public World world;
|
||||
|
@ -125,7 +124,7 @@ public class SpawnCommand extends Command implements Listener {
|
|||
if (health > damage) {
|
||||
// If the entity survived the hit
|
||||
health -= damage;
|
||||
entity.setCustomName(color(mob.getName() + " &r&c" + (int) health + "/" + (int) mob.getMaxHealth() + "❤"));
|
||||
entity.setCustomName(Utils.color(mob.getName() + " &r&c" + (int) health + "/" + (int) mob.getMaxHealth() + "❤"));
|
||||
}
|
||||
Location loc = entity.getLocation().clone().add(getRandomOffset(), 1, getRandomOffset());
|
||||
world.spawn(loc, ArmorStand.class, armorStand -> {
|
||||
|
@ -134,7 +133,7 @@ public class SpawnCommand extends Command implements Listener {
|
|||
armorStand.setGravity(false);
|
||||
armorStand.setSmall(true);
|
||||
armorStand.setCustomNameVisible(true);
|
||||
armorStand.setCustomName(color("&c" + formatter.format(damage)));
|
||||
armorStand.setCustomName(Utils.color("&c" + formatter.format(damage)));
|
||||
indicators.put(armorStand, 30);
|
||||
});
|
||||
}
|
|
@ -1,4 +1,4 @@
|
|||
package com.night.nullvalkyrie.commands;
|
||||
package me.night.nullvalkyrie.commands;
|
||||
|
||||
|
||||
import org.bukkit.command.CommandSender;
|
|
@ -1,6 +1,7 @@
|
|||
package com.night.nullvalkyrie.commands;
|
||||
package me.night.nullvalkyrie.commands;
|
||||
|
||||
import com.night.nullvalkyrie.Main;
|
||||
import me.night.nullvalkyrie.Main;
|
||||
import me.night.nullvalkyrie.Items.CustomItemManager;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.configuration.file.FileConfiguration;
|
||||
|
@ -13,9 +14,6 @@ import java.util.Arrays;
|
|||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
||||
import static com.night.nullvalkyrie.Items.CustomItemManager.getAllFilesFromDirectory;
|
||||
import static com.night.nullvalkyrie.Items.CustomItemManager.loadConfig;
|
||||
|
||||
public class UtilCommand extends Command {
|
||||
private Main main;
|
||||
public UtilCommand(Main main) {
|
||||
|
@ -53,10 +51,10 @@ public class UtilCommand extends Command {
|
|||
@Override
|
||||
public List<String> onTabComplete(CommandSender sender, String[] args) {
|
||||
if(args.length == 1) {
|
||||
List<String> hh = getAllFilesFromDirectory("ItemData");
|
||||
List<String> hh = CustomItemManager.getAllFilesFromDirectory("ItemData");
|
||||
ArrayList<String> cc = new ArrayList<>();
|
||||
for(int kk = 0; kk < hh.size(); kk++) {
|
||||
FileConfiguration c = loadConfig("ItemData\\" + hh.get(kk));
|
||||
FileConfiguration c = CustomItemManager.loadConfig("ItemData\\" + hh.get(kk));
|
||||
if(Objects.equals(c.getString("type"), "Util")) {
|
||||
cc.add(c.getString("name"));
|
||||
}
|
|
@ -1,4 +1,4 @@
|
|||
package com.night.nullvalkyrie.commands;
|
||||
package me.night.nullvalkyrie.commands;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.ChatColor;
|
|
@ -1,6 +1,7 @@
|
|||
package com.night.nullvalkyrie.commands;
|
||||
package me.night.nullvalkyrie.commands;
|
||||
|
||||
import com.night.nullvalkyrie.Main;
|
||||
import me.night.nullvalkyrie.Main;
|
||||
import me.night.nullvalkyrie.Items.CustomItemManager;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.configuration.file.FileConfiguration;
|
||||
|
@ -13,9 +14,6 @@ import java.util.Arrays;
|
|||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
||||
import static com.night.nullvalkyrie.Items.CustomItemManager.getAllFilesFromDirectory;
|
||||
import static com.night.nullvalkyrie.Items.CustomItemManager.loadConfig;
|
||||
|
||||
public class WeaponCommand extends Command {
|
||||
private Main main;
|
||||
public WeaponCommand(Main main) {
|
||||
|
@ -55,10 +53,10 @@ public class WeaponCommand extends Command {
|
|||
@Override
|
||||
public List<String> onTabComplete(CommandSender sender, String[] args) {
|
||||
if(args.length == 1) {
|
||||
List<String> hh = getAllFilesFromDirectory("ItemData");
|
||||
List<String> hh = CustomItemManager.getAllFilesFromDirectory("ItemData");
|
||||
ArrayList<String> cc = new ArrayList<>();
|
||||
for(int kk = 0; kk < hh.size(); kk++) {
|
||||
FileConfiguration c = loadConfig("ItemData\\" + hh.get(kk));
|
||||
FileConfiguration c = CustomItemManager.loadConfig("ItemData/" + hh.get(kk));
|
||||
if(Objects.equals(c.getString("type"), "Weapon")) {
|
||||
cc.add(c.getString("name"));
|
||||
}
|
94
src/main/java/me/night/nullvalkyrie/miners/CryptoMiner.java
Normal file
94
src/main/java/me/night/nullvalkyrie/miners/CryptoMiner.java
Normal file
|
@ -0,0 +1,94 @@
|
|||
package me.night.nullvalkyrie.miners;
|
||||
|
||||
import me.night.nullvalkyrie.Main;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.configuration.Configuration;
|
||||
import org.bukkit.configuration.file.FileConfiguration;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.scheduler.BukkitRunnable;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.ThreadLocalRandom;
|
||||
|
||||
import static me.night.nullvalkyrie.Items.CustomItemManager.loadConfig;
|
||||
import static me.night.nullvalkyrie.Items.CustomItemManager.loadFile;
|
||||
|
||||
public class CryptoMiner {
|
||||
protected Main main;
|
||||
protected String name;
|
||||
protected Material type;
|
||||
protected int level;
|
||||
protected double rate;
|
||||
protected int generated;
|
||||
public CryptoMiner(Main main, String name, Material type, int level, double rate) {
|
||||
this.main = main;
|
||||
this.name = name; // Name of the miner
|
||||
this.type = type; // Material to mine
|
||||
this.level = level;
|
||||
this.rate = rate; // Percentage generate chance in each tick 20tick per sec
|
||||
//generate(70);
|
||||
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
public double getRate() {
|
||||
return rate;
|
||||
}
|
||||
public void setRate(double rate) {
|
||||
this.rate = rate;
|
||||
}
|
||||
public Material getType() {
|
||||
return type;
|
||||
}
|
||||
public void setType(Material type) {
|
||||
this.type = type;
|
||||
}
|
||||
public int getLevel() {
|
||||
return level;
|
||||
}
|
||||
public void setLevel(int level) { this.level = level; }
|
||||
public void generate(int pp) {
|
||||
new BukkitRunnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
int count = ThreadLocalRandom.current().nextInt(100);
|
||||
if(count > pp) generated++;
|
||||
}
|
||||
}.runTaskTimer(main, 0L, 1L);
|
||||
}
|
||||
public List<CryptoMiner> getMiners() {
|
||||
List<CryptoMiner> arr = new ArrayList<>();
|
||||
FileConfiguration file = loadConfig("miners.yml");
|
||||
for(String c : file.getKeys(false)) {
|
||||
arr.add(new CryptoMiner(main, file.getString(c + ".name"), Material.matchMaterial(file.getString(c + ".material")), file.getInt(c + ".level"), file.getDouble(c + ".rate")));
|
||||
}
|
||||
return arr;
|
||||
}
|
||||
public CryptoMiner getMiner(String index) {
|
||||
FileConfiguration file = loadConfig("miners.yml");
|
||||
return new CryptoMiner(main, file.getString(index + ".name"), Material.matchMaterial(file.getString(index + ".name")), file.getInt(index + ".level"), file.getDouble(index + ".rate"));
|
||||
}
|
||||
public void setMiner(String index, String name, String material, int level, double rate) {
|
||||
CryptoMiner miner = new CryptoMiner(main, name, Material.matchMaterial(material), level, rate);
|
||||
FileConfiguration file = loadConfig("miners.yml");
|
||||
file.createSection(index);
|
||||
file.set(index + ".name", name);
|
||||
file.set(index + ".material", material);
|
||||
file.set(index + ".level", level);
|
||||
file.set(index + ".rate", rate);
|
||||
file.set(index + ".enabled", true);
|
||||
try {
|
||||
file.save(loadFile("miners.yml"));
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
58
src/main/java/me/night/nullvalkyrie/miners/MinerGUI.java
Normal file
58
src/main/java/me/night/nullvalkyrie/miners/MinerGUI.java
Normal file
|
@ -0,0 +1,58 @@
|
|||
package me.night.nullvalkyrie.miners;
|
||||
|
||||
import me.night.nullvalkyrie.Main;
|
||||
import me.night.nullvalkyrie.Items.CustomItemManager;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.configuration.file.FileConfiguration;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.inventory.Inventory;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.inventory.meta.ItemMeta;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
public class MinerGUI {
|
||||
private Main main;
|
||||
private FileConfiguration file;
|
||||
private Inventory inv;
|
||||
public MinerGUI(Main main, Player player) {
|
||||
this.main = main;
|
||||
if(!main.getDataFolder().exists()) main.getDataFolder().mkdir();
|
||||
file = CustomItemManager.loadConfig("miners.yml");
|
||||
createUI();
|
||||
player.openInventory(inv);
|
||||
}
|
||||
public void createUI() {
|
||||
inv = Bukkit.createInventory(null,45, ChatColor.DARK_AQUA + "Crypto Miners");
|
||||
ItemStack frame = new ItemStack(Material.BLUE_STAINED_GLASS_PANE);
|
||||
for(int i : new int[]{1,2,3,4,5,6,7,8,9,17,18,26,27,35,36,37,38,39,40,41,42,43,44}) {
|
||||
inv.setItem(i, frame);
|
||||
}
|
||||
ItemStack close = new ItemStack(Material.BARRIER);
|
||||
ItemMeta closemeta = close.getItemMeta();
|
||||
closemeta.setDisplayName(ChatColor.WHITE + "Close the menu");
|
||||
closemeta.setLore(Arrays.asList(ChatColor.GRAY + "Close the menu"));
|
||||
close.setItemMeta(closemeta);
|
||||
inv.setItem(0, close);
|
||||
int[] a = new int[]{10,11,12,13,14,15,16,19,20,21,22,23,24,25,28,29,30,31,32,33,34};
|
||||
int ind = 0;
|
||||
for(String c : file.getKeys(false)) {
|
||||
ItemStack item = new ItemStack(Material.matchMaterial(file.getString(c + ".material")));
|
||||
ItemMeta itemMeta = item.getItemMeta();
|
||||
itemMeta.setDisplayName(file.getString(c + ".name"));
|
||||
List<String> lore = new ArrayList<>();
|
||||
lore.add("Level: " + file.getString(c + ".level"));
|
||||
lore.add("Rate: " + file.getString(c + ".rate"));
|
||||
boolean b = file.getBoolean(c + ".rate") ? lore.add(ChatColor.GRAY + "Click to enable miner!") : lore.add(ChatColor.RED + "Click to disable miner!");
|
||||
itemMeta.setLore(lore);
|
||||
item.setItemMeta(itemMeta);
|
||||
inv.setItem(a[ind], item);
|
||||
ind++;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
|
@ -1,6 +1,6 @@
|
|||
name: NullValkyrie
|
||||
version: '${project.version}'
|
||||
main: com.night.nullvalkyrie.Main
|
||||
main: me.night.nullvalkyrie.Main
|
||||
api-version: 1.18
|
||||
authors: [ NightKaly, Leocthl ]
|
||||
description: Null Valkyrie
|
||||
|
|
Loading…
Reference in a new issue