diff --git a/pom.xml b/pom.xml
index 8237f6f..c3ec580 100644
--- a/pom.xml
+++ b/pom.xml
@@ -51,42 +51,42 @@
maven-jar-plugin
2.4
- media/night0721/Data/Network/Lobby/plugins
+ E:\Files\SB\plugins
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+ net.md-5
+ specialsource-maven-plugin
+ 1.2.2
+
+
+ package
+
+ remap
+
+ remap-obf
+
+ org.spigotmc:minecraft-server:1.19.2-R0.1-SNAPSHOT:txt:maps-mojang
+ true
+ org.spigotmc:spigot:1.19.2-R0.1-SNAPSHOT:jar:remapped-mojang
+ true
+ remapped-obf
+
+
+
+ package
+
+ remap
+
+ remap-spigot
+
+ ${project.build.directory}/${project.artifactId}-${project.version}-remapped-obf.jar
+ org.spigotmc:minecraft-server:1.19.2-R0.1-SNAPSHOT:csrg:maps-spigot
+ org.spigotmc:spigot:1.19.2-R0.1-SNAPSHOT:jar:remapped-obf
+
+
+
+
@@ -109,9 +109,9 @@
org.spigotmc
- spigot-api
- 1.18.1-R0.1-SNAPSHOT
-
+ spigot
+ 1.19.2-R0.1-SNAPSHOT
+ remapped-mojang
provided
@@ -119,5 +119,11 @@
JDA
5.0.0-alpha.13
+
+ org.mongodb
+ mongo-java-driver
+ 3.12.11
+ compile
+
diff --git a/src/main/java/me/night/nullvalkyrie/Main.java b/src/main/java/me/night/nullvalkyrie/Main.java
index aa99341..acf69e4 100644
--- a/src/main/java/me/night/nullvalkyrie/Main.java
+++ b/src/main/java/me/night/nullvalkyrie/Main.java
@@ -1,13 +1,15 @@
package me.night.nullvalkyrie;
-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.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 me.night.nullvalkyrie.database.Client;
+import me.night.nullvalkyrie.miners.CryptoMiner;
import net.md_5.bungee.api.ChatMessageType;
import net.md_5.bungee.api.chat.TextComponent;
import org.bukkit.*;
@@ -21,6 +23,7 @@ import org.bukkit.event.server.ServerListPingEvent;
import org.bukkit.plugin.java.JavaPlugin;
import java.io.File;
+import java.util.Date;
public final class Main extends JavaPlugin implements Listener {
private BossBar bossbar;
@@ -28,7 +31,6 @@ public final class Main extends JavaPlugin implements Listener {
public CustomItemManager getCustomItemManager() {
return customItemManager;
}
-
@Override
public void onEnable() {
getConfig().options().copyDefaults();
@@ -42,6 +44,7 @@ public final class Main extends JavaPlugin implements Listener {
new HologramCommand();
new CraftCommand();
new EnchantingCommand();
+ new BetaCommand();
new RankCommand(this);
new UtilCommand(this);
new WeaponCommand(this);
@@ -52,9 +55,11 @@ public final class Main extends JavaPlugin implements Listener {
Bukkit.getPluginManager().registerEvents(new ScoreboardListener(this), this);
Bukkit.getPluginManager().registerEvents(new CustomItemEvents(this), this);
Bukkit.getPluginManager().registerEvents(new SpawnCommand(this), this);
- new EnchantmentManager();
+ EnchantmentManager.register();
new DiscordClientManager();
customItemManager = new CustomItemManager(this);
+ new CryptoMiner(this, "Gay", Material.ENDER_CHEST, 10, 0.7, new Date().getTime());
+ new Client();
}
@@ -62,7 +67,8 @@ public final class Main extends JavaPlugin implements Listener {
public void onJoin(PlayerJoinEvent e) {
e.getPlayer().spigot().sendMessage(ChatMessageType.ACTION_BAR, TextComponent.fromLegacyText("§1NOT ENOUGH MANNER"));
bossbar.addPlayer(e.getPlayer());
- }
+
+ }
@EventHandler
public void onPing(ServerListPingEvent e) {
diff --git a/src/main/java/me/night/nullvalkyrie/Chests/MenuListener.java b/src/main/java/me/night/nullvalkyrie/chests/MenuListener.java
similarity index 93%
rename from src/main/java/me/night/nullvalkyrie/Chests/MenuListener.java
rename to src/main/java/me/night/nullvalkyrie/chests/MenuListener.java
index 6a0ec94..22bdea2 100644
--- a/src/main/java/me/night/nullvalkyrie/Chests/MenuListener.java
+++ b/src/main/java/me/night/nullvalkyrie/chests/MenuListener.java
@@ -1,37 +1,37 @@
-package me.night.nullvalkyrie.Chests;
-
-import me.night.nullvalkyrie.commands.MenuCommand;
-import org.bukkit.ChatColor;
-import org.bukkit.entity.Player;
-import org.bukkit.event.EventHandler;
-import org.bukkit.event.Listener;
-import org.bukkit.event.inventory.InventoryClickEvent;
-public class MenuListener implements Listener {
-
- @EventHandler
- public void onClick(InventoryClickEvent e) {
- if(e.getInventory().equals(MenuCommand.inv) && e.getCurrentItem() != null) {
- e.setCancelled(true);
- Player player = (Player) e.getWhoClicked();
- switch (e.getRawSlot()) {
- case 0:
- break;
- case 20:
- player.setHealth(0);
- player.sendMessage(ChatColor.RED + "又做兵 抵死");
- break;
- case 22:
- break;
- case 24:
- player.closeInventory();
- player.openInventory(WitherChest.witherchest);
- return;
- default:
- return;
- }
-
-
- player.closeInventory();
- }else { return; }
- }
-}
+package me.night.nullvalkyrie.chests;
+
+import me.night.nullvalkyrie.commands.MenuCommand;
+import org.bukkit.ChatColor;
+import org.bukkit.entity.Player;
+import org.bukkit.event.EventHandler;
+import org.bukkit.event.Listener;
+import org.bukkit.event.inventory.InventoryClickEvent;
+public class MenuListener implements Listener {
+
+ @EventHandler
+ public void onClick(InventoryClickEvent e) {
+ if(e.getInventory().equals(MenuCommand.inv) && e.getCurrentItem() != null) {
+ e.setCancelled(true);
+ Player player = (Player) e.getWhoClicked();
+ switch (e.getRawSlot()) {
+ case 0:
+ break;
+ case 20:
+ player.setHealth(0);
+ player.sendMessage(ChatColor.RED + "又做兵 抵死");
+ break;
+ case 22:
+ break;
+ case 24:
+ player.closeInventory();
+ player.openInventory(WitherChest.witherchest);
+ return;
+ default:
+ return;
+ }
+
+
+ player.closeInventory();
+ }else { return; }
+ }
+}
diff --git a/src/main/java/me/night/nullvalkyrie/Chests/WitherChest.java b/src/main/java/me/night/nullvalkyrie/chests/WitherChest.java
similarity index 83%
rename from src/main/java/me/night/nullvalkyrie/Chests/WitherChest.java
rename to src/main/java/me/night/nullvalkyrie/chests/WitherChest.java
index 1602a93..6ad79f3 100644
--- a/src/main/java/me/night/nullvalkyrie/Chests/WitherChest.java
+++ b/src/main/java/me/night/nullvalkyrie/chests/WitherChest.java
@@ -1,9 +1,9 @@
-package me.night.nullvalkyrie.Chests;
-
-import org.bukkit.Bukkit;
-import org.bukkit.ChatColor;
-import org.bukkit.inventory.Inventory;
-
-public class WitherChest {
- public static Inventory witherchest = Bukkit.createInventory(null,54, ChatColor.DARK_AQUA + "Whiter Chest");
-}
+package me.night.nullvalkyrie.chests;
+
+import org.bukkit.Bukkit;
+import org.bukkit.ChatColor;
+import org.bukkit.inventory.Inventory;
+
+public class WitherChest {
+ public static Inventory witherchest = Bukkit.createInventory(null,54, ChatColor.DARK_AQUA + "Whiter Chest");
+}
diff --git a/src/main/java/me/night/nullvalkyrie/commands/BetaCommand.java b/src/main/java/me/night/nullvalkyrie/commands/BetaCommand.java
new file mode 100644
index 0000000..524c46f
--- /dev/null
+++ b/src/main/java/me/night/nullvalkyrie/commands/BetaCommand.java
@@ -0,0 +1,36 @@
+package me.night.nullvalkyrie.commands;
+
+import net.minecraft.network.protocol.game.ClientboundSetHealthPacket;
+import org.bukkit.command.CommandSender;
+import org.bukkit.craftbukkit.v1_19_R1.entity.CraftPlayer;
+import org.bukkit.entity.Player;
+
+import java.util.List;
+
+import static me.night.nullvalkyrie.database.Client.getUser;
+
+public class BetaCommand extends Command {
+ public BetaCommand() {
+ super(
+ "beta",
+ new String[]{"b"},
+ "Beta",
+ ""
+ );
+ }
+
+ @Override
+ public void onCommand(CommandSender sender, String[] args) {
+ getUser("Kaly15");
+ if(sender instanceof Player) {
+ CraftPlayer p = (CraftPlayer) sender;
+ ClientboundSetHealthPacket packet = new ClientboundSetHealthPacket(19.5f, 20, 0.0f);
+ p.getHandle().connection.send(packet);
+ }
+ }
+
+ @Override
+ public List onTabComplete(CommandSender sender, String[] args) {
+ return null;
+ }
+}
diff --git a/src/main/java/me/night/nullvalkyrie/commands/MinerCommand.java b/src/main/java/me/night/nullvalkyrie/commands/MinerCommand.java
index 01abbcc..1e92a16 100644
--- a/src/main/java/me/night/nullvalkyrie/commands/MinerCommand.java
+++ b/src/main/java/me/night/nullvalkyrie/commands/MinerCommand.java
@@ -4,10 +4,13 @@ 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.Date;
import java.util.List;
+import static me.night.nullvalkyrie.miners.CryptoMiner.generate;
+import static me.night.nullvalkyrie.miners.CryptoMiner.getMiner;
+
public class MinerCommand extends Command {
private Main main;
public MinerCommand(Main main) {
@@ -25,6 +28,9 @@ public class MinerCommand extends Command {
if(sender instanceof Player) {
Player player = (Player) sender;
new MinerGUI(main, player);
+ int seconds = Math.round((new Date().getTime() - getMiner("1").getLastclaim()) / 1000);
+ System.out.println("Seconds" + seconds);
+ generate(50, seconds);
}
}
diff --git a/src/main/java/me/night/nullvalkyrie/commands/RankCommand.java b/src/main/java/me/night/nullvalkyrie/commands/RankCommand.java
index 9a48e99..840b60a 100644
--- a/src/main/java/me/night/nullvalkyrie/commands/RankCommand.java
+++ b/src/main/java/me/night/nullvalkyrie/commands/RankCommand.java
@@ -3,7 +3,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.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 me.night.nullvalkyrie.Rank.ScoreboardListener.rankManager;
+import static me.night.nullvalkyrie.rank.ScoreboardListener.rankManager;
//92.0.69.141:25565
public class RankCommand extends Command {
diff --git a/src/main/java/me/night/nullvalkyrie/commands/ShopCommand.java b/src/main/java/me/night/nullvalkyrie/commands/ShopCommand.java
new file mode 100644
index 0000000..ddb7a82
--- /dev/null
+++ b/src/main/java/me/night/nullvalkyrie/commands/ShopCommand.java
@@ -0,0 +1,46 @@
+package me.night.nullvalkyrie.commands;
+
+import me.night.nullvalkyrie.items.CustomItemManager;
+import org.bukkit.Bukkit;
+import org.bukkit.ChatColor;
+import org.bukkit.Material;
+import org.bukkit.command.CommandSender;
+import org.bukkit.configuration.file.FileConfiguration;
+import org.bukkit.inventory.Inventory;
+import org.bukkit.inventory.ItemStack;
+import org.bukkit.inventory.meta.ItemMeta;
+
+import java.util.ArrayList;
+import java.util.List;
+
+public class ShopCommand extends Command{
+ private FileConfiguration file;
+ private Inventory inv;
+ public ShopCommand() {
+ super("7elven",
+ new String[]{"711", "seven", "7ven"},
+ "Shop",
+ ""
+ );
+ file = CustomItemManager.loadConfig("miners.yml");
+ }
+ @Override
+ public void onCommand(CommandSender sender, String[] args) {
+ inv = Bukkit.createInventory(null, 45, ChatColor.GREEN + "7-Eleven 24/7");
+ 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 lore = new ArrayList<>();
+ lore.add("Price (BIN): " + file.getString(c + ".price"));
+ itemMeta.setLore(lore);
+ item.setItemMeta(itemMeta);
+
+ }
+ }
+
+ @Override
+ public List onTabComplete(CommandSender sender, String[] args) {
+ return null;
+ }
+}
diff --git a/src/main/java/me/night/nullvalkyrie/commands/SpawnCommand.java b/src/main/java/me/night/nullvalkyrie/commands/SpawnCommand.java
index b92cb02..b26fb1f 100644
--- a/src/main/java/me/night/nullvalkyrie/commands/SpawnCommand.java
+++ b/src/main/java/me/night/nullvalkyrie/commands/SpawnCommand.java
@@ -1,8 +1,8 @@
package me.night.nullvalkyrie.commands;
import me.night.nullvalkyrie.Main;
-import me.night.nullvalkyrie.Util.components.CustomMob;
-import me.night.nullvalkyrie.Util.Utils;
+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;
diff --git a/src/main/java/me/night/nullvalkyrie/commands/UtilCommand.java b/src/main/java/me/night/nullvalkyrie/commands/UtilCommand.java
index 874320c..c59a756 100644
--- a/src/main/java/me/night/nullvalkyrie/commands/UtilCommand.java
+++ b/src/main/java/me/night/nullvalkyrie/commands/UtilCommand.java
@@ -1,7 +1,7 @@
package me.night.nullvalkyrie.commands;
import me.night.nullvalkyrie.Main;
-import me.night.nullvalkyrie.Items.CustomItemManager;
+import me.night.nullvalkyrie.items.CustomItemManager;
import org.bukkit.ChatColor;
import org.bukkit.command.CommandSender;
import org.bukkit.configuration.file.FileConfiguration;
diff --git a/src/main/java/me/night/nullvalkyrie/commands/WeaponCommand.java b/src/main/java/me/night/nullvalkyrie/commands/WeaponCommand.java
index 2e210d4..6fccfcf 100644
--- a/src/main/java/me/night/nullvalkyrie/commands/WeaponCommand.java
+++ b/src/main/java/me/night/nullvalkyrie/commands/WeaponCommand.java
@@ -1,7 +1,7 @@
package me.night.nullvalkyrie.commands;
import me.night.nullvalkyrie.Main;
-import me.night.nullvalkyrie.Items.CustomItemManager;
+import me.night.nullvalkyrie.items.CustomItemManager;
import org.bukkit.ChatColor;
import org.bukkit.command.CommandSender;
import org.bukkit.configuration.file.FileConfiguration;
diff --git a/src/main/java/me/night/nullvalkyrie/database/Client.java b/src/main/java/me/night/nullvalkyrie/database/Client.java
new file mode 100644
index 0000000..5e24f35
--- /dev/null
+++ b/src/main/java/me/night/nullvalkyrie/database/Client.java
@@ -0,0 +1,52 @@
+package me.night.nullvalkyrie.database;
+
+import com.mongodb.MongoException;
+import com.mongodb.client.*;
+import com.mongodb.client.model.Filters;
+import org.bson.Document;
+import org.bson.conversions.Bson;
+
+public class Client {
+ private MongoClient client;
+ private static MongoCollection users;
+ public Client() {
+ 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);
+ }
+ MongoClient client = MongoClients.create("mongodb+srv://cath_exe:gaeismypassion@cath-exe.iolb7.mongodb.net/NullValkyrie");
+ MongoDatabase database = client.getDatabase("NullValkyrie");
+ users = database.getCollection("users");
+ }
+ public static void createUserSchema(String username) {
+ Document document = new Document();
+ document.put("Username", username);
+ document.put("Bank", 0);
+ users.insertOne(document);
+ }
+ public void updateUserBank(String username, Number coins) {
+ Document document = (Document) users.find(new Document("Username", username)).first();
+ if(document != null) {
+ Bson updated = new Document("Bank", coins);
+ Bson update = new Document("$set", updated);
+ users.updateOne(document, update);
+ }
+
+ }
+ public static void getUser(String username) {
+ try (MongoCursor cursor = users.find(Filters.eq("Username", username)).cursor()) {
+ while (cursor.hasNext()) {
+ Document doc = (Document) cursor.next();
+ for(String a : doc.keySet()) {
+ if(!a.equals("_id")) {
+ System.out.println(a + ": " + doc.get(a));
+ }
+ }
+ }
+ }
+ }
+}
diff --git a/src/main/java/me/night/nullvalkyrie/Discord/DiscordClientManager.java b/src/main/java/me/night/nullvalkyrie/discord/DiscordClientManager.java
similarity index 82%
rename from src/main/java/me/night/nullvalkyrie/Discord/DiscordClientManager.java
rename to src/main/java/me/night/nullvalkyrie/discord/DiscordClientManager.java
index bbf9885..d817bbd 100644
--- a/src/main/java/me/night/nullvalkyrie/Discord/DiscordClientManager.java
+++ b/src/main/java/me/night/nullvalkyrie/discord/DiscordClientManager.java
@@ -1,4 +1,4 @@
-package me.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;
@@ -12,7 +12,7 @@ public class DiscordClientManager {
register();
}
public void register() {
- JDABuilder builder = JDABuilder.createDefault("OTk3ODczMzgyNjM0ODM2MDQ5.GTalga.2uMZE-S0t2yL-3jsglrpG9lMbIHHBMAedVZA4U");
+ JDABuilder builder = JDABuilder.createDefault("OTk3ODczMzgyNjM0ODM2MDQ5.Gd9Fdh.GEOleI-1znVeHwaAef54nXl2ovlSmC3hQX-qQI");
builder.setActivity(Activity.streaming("cath.exe", "https://www.youtube.com/watch?v=YSKDu1gKntY"));
try {
jda = builder.build();
@@ -21,5 +21,4 @@ public class DiscordClientManager {
}
}
-
}
diff --git a/src/main/java/me/night/nullvalkyrie/Enchantments/CustomEnchantment.java b/src/main/java/me/night/nullvalkyrie/enchantments/CustomEnchantment.java
similarity index 91%
rename from src/main/java/me/night/nullvalkyrie/Enchantments/CustomEnchantment.java
rename to src/main/java/me/night/nullvalkyrie/enchantments/CustomEnchantment.java
index 5854ac5..9c40c5f 100644
--- a/src/main/java/me/night/nullvalkyrie/Enchantments/CustomEnchantment.java
+++ b/src/main/java/me/night/nullvalkyrie/enchantments/CustomEnchantment.java
@@ -1,4 +1,4 @@
-package me.night.nullvalkyrie.Enchantments;
+package me.night.nullvalkyrie.enchantments;
import org.bukkit.NamespacedKey;
import org.bukkit.enchantments.Enchantment;
diff --git a/src/main/java/me/night/nullvalkyrie/Enchantments/EnchantmentManager.java b/src/main/java/me/night/nullvalkyrie/enchantments/EnchantmentManager.java
similarity index 89%
rename from src/main/java/me/night/nullvalkyrie/Enchantments/EnchantmentManager.java
rename to src/main/java/me/night/nullvalkyrie/enchantments/EnchantmentManager.java
index 4711693..f5c750e 100644
--- a/src/main/java/me/night/nullvalkyrie/Enchantments/EnchantmentManager.java
+++ b/src/main/java/me/night/nullvalkyrie/enchantments/EnchantmentManager.java
@@ -1,4 +1,4 @@
-package me.night.nullvalkyrie.Enchantments;
+package me.night.nullvalkyrie.enchantments;
import org.bukkit.enchantments.Enchantment;
@@ -7,9 +7,6 @@ import java.util.Arrays;
import java.util.stream.Collectors;
public class EnchantmentManager {
- public EnchantmentManager() {
- register();
- }
public static final Enchantment ThunderBolt = new CustomEnchantment("thunderbolt", "ThunderBolt", 5);
public static final Enchantment SmeltingTouch = new CustomEnchantment("smelting-touch", "Smelting Touch", 1);
public static void register() {
diff --git a/src/main/java/me/night/nullvalkyrie/Events/CustomItemEvents.java b/src/main/java/me/night/nullvalkyrie/events/CustomItemEvents.java
similarity index 97%
rename from src/main/java/me/night/nullvalkyrie/Events/CustomItemEvents.java
rename to src/main/java/me/night/nullvalkyrie/events/CustomItemEvents.java
index 41051e9..0f4118f 100644
--- a/src/main/java/me/night/nullvalkyrie/Events/CustomItemEvents.java
+++ b/src/main/java/me/night/nullvalkyrie/events/CustomItemEvents.java
@@ -1,7 +1,7 @@
-package me.night.nullvalkyrie.Events;
+package me.night.nullvalkyrie.events;
-import me.night.nullvalkyrie.Items.CustomItemManager;
-import me.night.nullvalkyrie.Items.Rarity;
+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.*;
diff --git a/src/main/java/me/night/nullvalkyrie/Items/CustomItemManager.java b/src/main/java/me/night/nullvalkyrie/items/CustomItemManager.java
similarity index 96%
rename from src/main/java/me/night/nullvalkyrie/Items/CustomItemManager.java
rename to src/main/java/me/night/nullvalkyrie/items/CustomItemManager.java
index 5acbad9..c5d52cb 100644
--- a/src/main/java/me/night/nullvalkyrie/Items/CustomItemManager.java
+++ b/src/main/java/me/night/nullvalkyrie/items/CustomItemManager.java
@@ -1,4 +1,4 @@
-package me.night.nullvalkyrie.Items;
+package me.night.nullvalkyrie.items;
import me.night.nullvalkyrie.Main;
import org.bukkit.ChatColor;
@@ -6,7 +6,6 @@ import org.bukkit.Material;
import org.bukkit.NamespacedKey;
import org.bukkit.attribute.Attribute;
import org.bukkit.attribute.AttributeModifier;
-import org.bukkit.configuration.MemorySection;
import org.bukkit.configuration.file.FileConfiguration;
import org.bukkit.configuration.file.YamlConfiguration;
import org.bukkit.enchantments.Enchantment;
@@ -168,7 +167,6 @@ 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) {
diff --git a/src/main/java/me/night/nullvalkyrie/Items/Rarity.java b/src/main/java/me/night/nullvalkyrie/items/Rarity.java
similarity index 96%
rename from src/main/java/me/night/nullvalkyrie/Items/Rarity.java
rename to src/main/java/me/night/nullvalkyrie/items/Rarity.java
index cd97e1a..a0f985b 100644
--- a/src/main/java/me/night/nullvalkyrie/Items/Rarity.java
+++ b/src/main/java/me/night/nullvalkyrie/items/Rarity.java
@@ -1,4 +1,4 @@
-package me.night.nullvalkyrie.Items;
+package me.night.nullvalkyrie.items;
import org.bukkit.ChatColor;
public enum Rarity {
diff --git a/src/main/java/me/night/nullvalkyrie/miners/CryptoMiner.java b/src/main/java/me/night/nullvalkyrie/miners/CryptoMiner.java
index a851e50..8c550b4 100644
--- a/src/main/java/me/night/nullvalkyrie/miners/CryptoMiner.java
+++ b/src/main/java/me/night/nullvalkyrie/miners/CryptoMiner.java
@@ -2,34 +2,33 @@ 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;
+import static me.night.nullvalkyrie.items.CustomItemManager.loadConfig;
+import static me.night.nullvalkyrie.items.CustomItemManager.loadFile;
public class CryptoMiner {
- protected Main main;
+ protected static 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) {
+ protected static int generated;
+ protected long lastclaim;
+ public CryptoMiner(Main main, String name, Material type, int level, double rate, long lastclaim) {
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);
-
+ this.lastclaim = lastclaim;
+ FileConfiguration file = loadConfig("miners.yml");
+ setMiner(Integer.toString(file.getKeys(false).size()), name, type.name(), level, rate, lastclaim);
}
public String getName() {
@@ -53,30 +52,34 @@ public class CryptoMiner {
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 void setLevel(int level) { this.level = level; };
+ public long getLastclaim() {
+ return lastclaim;
+ }
+ public void setLastClaim(long lastclaim) {
+ this.lastclaim = lastclaim;
+ }
+ private int aa;
+ public static void generate(int pp, int times) {
+ for (int ia = 0; ia < times; ia++) {
+ int count = ThreadLocalRandom.current().nextInt(100);
+ if(count > pp) generated++;
+ }
+ System.out.println(generated);
}
public List getMiners() {
List 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")));
+ arr.add(new CryptoMiner(main, file.getString(c + ".name"), Material.matchMaterial(file.getString(c + ".material")), file.getInt(c + ".level"), file.getDouble(c + ".rate"), file.getLong(c + ".last-claim")));
}
return arr;
}
- public CryptoMiner getMiner(String index) {
+ public static 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"));
+ return new CryptoMiner(main, file.getString(index + ".name"), Material.matchMaterial(file.getString(index + ".name")), file.getInt(index + ".level"), file.getDouble(index + ".rate"), file.getLong(index + ".last-claim"));
}
- public void setMiner(String index, String name, String material, int level, double rate) {
- CryptoMiner miner = new CryptoMiner(main, name, Material.matchMaterial(material), level, rate);
+ public void setMiner(String index, String name, String material, int level, double rate, long time) {
FileConfiguration file = loadConfig("miners.yml");
file.createSection(index);
file.set(index + ".name", name);
@@ -84,6 +87,7 @@ public class CryptoMiner {
file.set(index + ".level", level);
file.set(index + ".rate", rate);
file.set(index + ".enabled", true);
+ file.set(index + ".last-claim", time);
try {
file.save(loadFile("miners.yml"));
} catch (IOException e) {
diff --git a/src/main/java/me/night/nullvalkyrie/miners/MinerGUI.java b/src/main/java/me/night/nullvalkyrie/miners/MinerGUI.java
index 57c9a42..d6213cd 100644
--- a/src/main/java/me/night/nullvalkyrie/miners/MinerGUI.java
+++ b/src/main/java/me/night/nullvalkyrie/miners/MinerGUI.java
@@ -1,7 +1,7 @@
package me.night.nullvalkyrie.miners;
import me.night.nullvalkyrie.Main;
-import me.night.nullvalkyrie.Items.CustomItemManager;
+import me.night.nullvalkyrie.items.CustomItemManager;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.Material;
diff --git a/src/main/java/me/night/nullvalkyrie/Mobs/ModdedZombie.yml b/src/main/java/me/night/nullvalkyrie/mobs/ModdedZombie.yml
similarity index 100%
rename from src/main/java/me/night/nullvalkyrie/Mobs/ModdedZombie.yml
rename to src/main/java/me/night/nullvalkyrie/mobs/ModdedZombie.yml
diff --git a/src/main/java/me/night/nullvalkyrie/Rank/BelowNameManager.java b/src/main/java/me/night/nullvalkyrie/rank/BelowNameManager.java
similarity index 91%
rename from src/main/java/me/night/nullvalkyrie/Rank/BelowNameManager.java
rename to src/main/java/me/night/nullvalkyrie/rank/BelowNameManager.java
index 8681693..454575e 100644
--- a/src/main/java/me/night/nullvalkyrie/Rank/BelowNameManager.java
+++ b/src/main/java/me/night/nullvalkyrie/rank/BelowNameManager.java
@@ -1,4 +1,4 @@
-package me.night.nullvalkyrie.Rank;
+package me.night.nullvalkyrie.rank;
import org.bukkit.ChatColor;
import org.bukkit.entity.Player;
diff --git a/src/main/java/me/night/nullvalkyrie/Rank/NameTagManager.java b/src/main/java/me/night/nullvalkyrie/rank/NameTagManager.java
similarity index 95%
rename from src/main/java/me/night/nullvalkyrie/Rank/NameTagManager.java
rename to src/main/java/me/night/nullvalkyrie/rank/NameTagManager.java
index e58ed0d..e38ac09 100644
--- a/src/main/java/me/night/nullvalkyrie/Rank/NameTagManager.java
+++ b/src/main/java/me/night/nullvalkyrie/rank/NameTagManager.java
@@ -1,4 +1,4 @@
-package me.night.nullvalkyrie.Rank;
+package me.night.nullvalkyrie.rank;
import me.night.nullvalkyrie.Main;
import org.bukkit.Bukkit;
diff --git a/src/main/java/me/night/nullvalkyrie/Rank/Rank.java b/src/main/java/me/night/nullvalkyrie/rank/Rank.java
similarity index 87%
rename from src/main/java/me/night/nullvalkyrie/Rank/Rank.java
rename to src/main/java/me/night/nullvalkyrie/rank/Rank.java
index 5c45a47..72c9c43 100644
--- a/src/main/java/me/night/nullvalkyrie/Rank/Rank.java
+++ b/src/main/java/me/night/nullvalkyrie/rank/Rank.java
@@ -1,4 +1,4 @@
-package me.night.nullvalkyrie.Rank;
+package me.night.nullvalkyrie.rank;
import org.bukkit.ChatColor;
diff --git a/src/main/java/me/night/nullvalkyrie/Rank/RankManager.java b/src/main/java/me/night/nullvalkyrie/rank/RankManager.java
similarity index 90%
rename from src/main/java/me/night/nullvalkyrie/Rank/RankManager.java
rename to src/main/java/me/night/nullvalkyrie/rank/RankManager.java
index 41e22f0..16be626 100644
--- a/src/main/java/me/night/nullvalkyrie/Rank/RankManager.java
+++ b/src/main/java/me/night/nullvalkyrie/rank/RankManager.java
@@ -1,4 +1,4 @@
-package me.night.nullvalkyrie.Rank;
+package me.night.nullvalkyrie.rank;
import me.night.nullvalkyrie.Main;
import org.bukkit.Bukkit;
@@ -9,7 +9,7 @@ import java.io.File;
import java.io.IOException;
import java.util.UUID;
-import static me.night.nullvalkyrie.Rank.ScoreboardListener.nameTagManager;
+import static me.night.nullvalkyrie.rank.ScoreboardListener.nameTagManager;
public class RankManager {
private File file;
diff --git a/src/main/java/me/night/nullvalkyrie/Rank/ScoreboardListener.java b/src/main/java/me/night/nullvalkyrie/rank/ScoreboardListener.java
similarity index 91%
rename from src/main/java/me/night/nullvalkyrie/Rank/ScoreboardListener.java
rename to src/main/java/me/night/nullvalkyrie/rank/ScoreboardListener.java
index 205e3e5..168da5f 100644
--- a/src/main/java/me/night/nullvalkyrie/Rank/ScoreboardListener.java
+++ b/src/main/java/me/night/nullvalkyrie/rank/ScoreboardListener.java
@@ -1,4 +1,4 @@
-package me.night.nullvalkyrie.Rank;
+package me.night.nullvalkyrie.rank;
import me.night.nullvalkyrie.Main;
import org.bukkit.Bukkit;
@@ -11,6 +11,8 @@ import org.bukkit.event.player.AsyncPlayerChatEvent;
import org.bukkit.event.player.PlayerJoinEvent;
import org.bukkit.event.player.PlayerQuitEvent;
+import static me.night.nullvalkyrie.database.Client.createUserSchema;
+
public class ScoreboardListener implements Listener {
public static RankManager rankManager;
@@ -30,6 +32,7 @@ public class ScoreboardListener implements Listener {
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);
diff --git a/src/main/java/me/night/nullvalkyrie/Rank/SideBarManager.java b/src/main/java/me/night/nullvalkyrie/rank/SideBarManager.java
similarity index 95%
rename from src/main/java/me/night/nullvalkyrie/Rank/SideBarManager.java
rename to src/main/java/me/night/nullvalkyrie/rank/SideBarManager.java
index db906cf..1928d9c 100644
--- a/src/main/java/me/night/nullvalkyrie/Rank/SideBarManager.java
+++ b/src/main/java/me/night/nullvalkyrie/rank/SideBarManager.java
@@ -1,4 +1,4 @@
-package me.night.nullvalkyrie.Rank;
+package me.night.nullvalkyrie.rank;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
diff --git a/src/main/java/me/night/nullvalkyrie/Util/Util.java b/src/main/java/me/night/nullvalkyrie/util/Util.java
similarity index 90%
rename from src/main/java/me/night/nullvalkyrie/Util/Util.java
rename to src/main/java/me/night/nullvalkyrie/util/Util.java
index 97cff62..5787bec 100644
--- a/src/main/java/me/night/nullvalkyrie/Util/Util.java
+++ b/src/main/java/me/night/nullvalkyrie/util/Util.java
@@ -1,4 +1,4 @@
-package me.night.nullvalkyrie.Util;
+package me.night.nullvalkyrie.util;
public class Util {
public static String centerText(String text, int lineLength) {
diff --git a/src/main/java/me/night/nullvalkyrie/Util/Utils.java b/src/main/java/me/night/nullvalkyrie/util/Utils.java
similarity index 94%
rename from src/main/java/me/night/nullvalkyrie/Util/Utils.java
rename to src/main/java/me/night/nullvalkyrie/util/Utils.java
index 1dd3192..a9afc3d 100644
--- a/src/main/java/me/night/nullvalkyrie/Util/Utils.java
+++ b/src/main/java/me/night/nullvalkyrie/util/Utils.java
@@ -1,4 +1,4 @@
-package me.night.nullvalkyrie.Util;
+package me.night.nullvalkyrie.util;
import org.bukkit.ChatColor;
import org.bukkit.Material;
diff --git a/src/main/java/me/night/nullvalkyrie/Util/components/CustomMob.java b/src/main/java/me/night/nullvalkyrie/util/components/CustomMob.java
similarity index 93%
rename from src/main/java/me/night/nullvalkyrie/Util/components/CustomMob.java
rename to src/main/java/me/night/nullvalkyrie/util/components/CustomMob.java
index af43309..ff09dd5 100644
--- a/src/main/java/me/night/nullvalkyrie/Util/components/CustomMob.java
+++ b/src/main/java/me/night/nullvalkyrie/util/components/CustomMob.java
@@ -1,4 +1,4 @@
-package me.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 me.night.nullvalkyrie.Util.Utils.color;
-import static me.night.nullvalkyrie.Util.Utils.*;
+import static me.night.nullvalkyrie.util.Utils.color;
+import static me.night.nullvalkyrie.util.Utils.*;
public enum CustomMob {
diff --git a/src/main/java/me/night/nullvalkyrie/Util/components/LootItem.java b/src/main/java/me/night/nullvalkyrie/util/components/LootItem.java
similarity index 91%
rename from src/main/java/me/night/nullvalkyrie/Util/components/LootItem.java
rename to src/main/java/me/night/nullvalkyrie/util/components/LootItem.java
index 374ae6d..98e50ae 100644
--- a/src/main/java/me/night/nullvalkyrie/Util/components/LootItem.java
+++ b/src/main/java/me/night/nullvalkyrie/util/components/LootItem.java
@@ -1,4 +1,4 @@
-package me.night.nullvalkyrie.Util.components;
+package me.night.nullvalkyrie.util.components;
import org.bukkit.Location;
import org.bukkit.inventory.ItemStack;
diff --git a/src/main/resources/miners.yml b/src/main/resources/miners.yml
new file mode 100644
index 0000000..e69de29