changing to 1.19.2 and having shop and nms
This commit is contained in:
parent
3425352908
commit
786bb682d7
32 changed files with 306 additions and 153 deletions
80
pom.xml
80
pom.xml
|
@ -51,42 +51,42 @@
|
||||||
<artifactId>maven-jar-plugin</artifactId>
|
<artifactId>maven-jar-plugin</artifactId>
|
||||||
<version>2.4</version>
|
<version>2.4</version>
|
||||||
<configuration>
|
<configuration>
|
||||||
<outputDirectory>media/night0721/Data/Network/Lobby/plugins</outputDirectory>
|
<outputDirectory>E:\Files\SB\plugins</outputDirectory>
|
||||||
</configuration>
|
</configuration>
|
||||||
</plugin>
|
</plugin>
|
||||||
<!-- <plugin>-->
|
<plugin>
|
||||||
<!-- <groupId>net.md-5</groupId>-->
|
<groupId>net.md-5</groupId>
|
||||||
<!-- <artifactId>specialsource-maven-plugin</artifactId>-->
|
<artifactId>specialsource-maven-plugin</artifactId>
|
||||||
<!-- <version>1.2.2</version>-->
|
<version>1.2.2</version>
|
||||||
<!-- <executions>-->
|
<executions>
|
||||||
<!-- <execution>-->
|
<execution>
|
||||||
<!-- <phase>package</phase>-->
|
<phase>package</phase>
|
||||||
<!-- <goals>-->
|
<goals>
|
||||||
<!-- <goal>remap</goal>-->
|
<goal>remap</goal>
|
||||||
<!-- </goals>-->
|
</goals>
|
||||||
<!-- <id>remap-obf</id>-->
|
<id>remap-obf</id>
|
||||||
<!-- <configuration>-->
|
<configuration>
|
||||||
<!-- <srgIn>org.spigotmc:minecraft-server:1.18-R0.1-SNAPSHOT:txt:maps-mojang</srgIn>-->
|
<srgIn>org.spigotmc:minecraft-server:1.19.2-R0.1-SNAPSHOT:txt:maps-mojang</srgIn>
|
||||||
<!-- <reverse>true</reverse>-->
|
<reverse>true</reverse>
|
||||||
<!-- <remappedDependencies>org.spigotmc:spigot:1.18-R0.1-SNAPSHOT:jar:remapped-mojang</remappedDependencies>-->
|
<remappedDependencies>org.spigotmc:spigot:1.19.2-R0.1-SNAPSHOT:jar:remapped-mojang</remappedDependencies>
|
||||||
<!-- <remappedArtifactAttached>true</remappedArtifactAttached>-->
|
<remappedArtifactAttached>true</remappedArtifactAttached>
|
||||||
<!-- <remappedClassifierName>remapped-obf</remappedClassifierName>-->
|
<remappedClassifierName>remapped-obf</remappedClassifierName>
|
||||||
<!-- </configuration>-->
|
</configuration>
|
||||||
<!-- </execution>-->
|
</execution>
|
||||||
<!-- <execution>-->
|
<execution>
|
||||||
<!-- <phase>package</phase>-->
|
<phase>package</phase>
|
||||||
<!-- <goals>-->
|
<goals>
|
||||||
<!-- <goal>remap</goal>-->
|
<goal>remap</goal>
|
||||||
<!-- </goals>-->
|
</goals>
|
||||||
<!-- <id>remap-spigot</id>-->
|
<id>remap-spigot</id>
|
||||||
<!-- <configuration>-->
|
<configuration>
|
||||||
<!-- <inputFile>${project.build.directory}/${project.artifactId}-${project.version}-remapped-obf.jar</inputFile>-->
|
<inputFile>${project.build.directory}/${project.artifactId}-${project.version}-remapped-obf.jar</inputFile>
|
||||||
<!-- <srgIn>org.spigotmc:minecraft-server:1.18-R0.1-SNAPSHOT:csrg:maps-spigot</srgIn>-->
|
<srgIn>org.spigotmc:minecraft-server:1.19.2-R0.1-SNAPSHOT:csrg:maps-spigot</srgIn>
|
||||||
<!-- <remappedDependencies>org.spigotmc:spigot:1.18-R0.1-SNAPSHOT:jar:remapped-obf</remappedDependencies>-->
|
<remappedDependencies>org.spigotmc:spigot:1.19.2-R0.1-SNAPSHOT:jar:remapped-obf</remappedDependencies>
|
||||||
<!-- </configuration>-->
|
</configuration>
|
||||||
<!-- </execution>-->
|
</execution>
|
||||||
<!-- </executions>-->
|
</executions>
|
||||||
<!-- </plugin>-->
|
</plugin>
|
||||||
</plugins>
|
</plugins>
|
||||||
<resources>
|
<resources>
|
||||||
<resource>
|
<resource>
|
||||||
|
@ -109,9 +109,9 @@
|
||||||
<dependencies>
|
<dependencies>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.spigotmc</groupId>
|
<groupId>org.spigotmc</groupId>
|
||||||
<artifactId>spigot-api</artifactId>
|
<artifactId>spigot</artifactId>
|
||||||
<version>1.18.1-R0.1-SNAPSHOT</version>
|
<version>1.19.2-R0.1-SNAPSHOT</version>
|
||||||
<!-- <classifier>remapped-mojang</classifier>-->
|
<classifier>remapped-mojang</classifier>
|
||||||
<scope>provided</scope>
|
<scope>provided</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
|
@ -119,5 +119,11 @@
|
||||||
<artifactId>JDA</artifactId>
|
<artifactId>JDA</artifactId>
|
||||||
<version>5.0.0-alpha.13</version>
|
<version>5.0.0-alpha.13</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.mongodb</groupId>
|
||||||
|
<artifactId>mongo-java-driver</artifactId>
|
||||||
|
<version>3.12.11</version>
|
||||||
|
<scope>compile</scope>
|
||||||
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
</project>
|
</project>
|
||||||
|
|
|
@ -1,13 +1,15 @@
|
||||||
package me.night.nullvalkyrie;
|
package me.night.nullvalkyrie;
|
||||||
|
|
||||||
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.CustomItemEvents;
|
||||||
import me.night.nullvalkyrie.Items.CustomItemManager;
|
import me.night.nullvalkyrie.items.CustomItemManager;
|
||||||
import me.night.nullvalkyrie.Rank.ScoreboardListener;
|
import me.night.nullvalkyrie.rank.ScoreboardListener;
|
||||||
import me.night.nullvalkyrie.Util.Util;
|
import me.night.nullvalkyrie.util.Util;
|
||||||
import me.night.nullvalkyrie.commands.*;
|
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.ChatMessageType;
|
||||||
import net.md_5.bungee.api.chat.TextComponent;
|
import net.md_5.bungee.api.chat.TextComponent;
|
||||||
import org.bukkit.*;
|
import org.bukkit.*;
|
||||||
|
@ -21,6 +23,7 @@ import org.bukkit.event.server.ServerListPingEvent;
|
||||||
import org.bukkit.plugin.java.JavaPlugin;
|
import org.bukkit.plugin.java.JavaPlugin;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
public final class Main extends JavaPlugin implements Listener {
|
public final class Main extends JavaPlugin implements Listener {
|
||||||
private BossBar bossbar;
|
private BossBar bossbar;
|
||||||
|
@ -28,7 +31,6 @@ public final class Main extends JavaPlugin implements Listener {
|
||||||
public CustomItemManager getCustomItemManager() {
|
public CustomItemManager getCustomItemManager() {
|
||||||
return customItemManager;
|
return customItemManager;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onEnable() {
|
public void onEnable() {
|
||||||
getConfig().options().copyDefaults();
|
getConfig().options().copyDefaults();
|
||||||
|
@ -42,6 +44,7 @@ public final class Main extends JavaPlugin implements Listener {
|
||||||
new HologramCommand();
|
new HologramCommand();
|
||||||
new CraftCommand();
|
new CraftCommand();
|
||||||
new EnchantingCommand();
|
new EnchantingCommand();
|
||||||
|
new BetaCommand();
|
||||||
new RankCommand(this);
|
new RankCommand(this);
|
||||||
new UtilCommand(this);
|
new UtilCommand(this);
|
||||||
new WeaponCommand(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 ScoreboardListener(this), this);
|
||||||
Bukkit.getPluginManager().registerEvents(new CustomItemEvents(this), this);
|
Bukkit.getPluginManager().registerEvents(new CustomItemEvents(this), this);
|
||||||
Bukkit.getPluginManager().registerEvents(new SpawnCommand(this), this);
|
Bukkit.getPluginManager().registerEvents(new SpawnCommand(this), this);
|
||||||
new EnchantmentManager();
|
EnchantmentManager.register();
|
||||||
new DiscordClientManager();
|
new DiscordClientManager();
|
||||||
customItemManager = new CustomItemManager(this);
|
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) {
|
public void onJoin(PlayerJoinEvent e) {
|
||||||
e.getPlayer().spigot().sendMessage(ChatMessageType.ACTION_BAR, TextComponent.fromLegacyText("§1NOT ENOUGH MANNER"));
|
e.getPlayer().spigot().sendMessage(ChatMessageType.ACTION_BAR, TextComponent.fromLegacyText("§1NOT ENOUGH MANNER"));
|
||||||
bossbar.addPlayer(e.getPlayer());
|
bossbar.addPlayer(e.getPlayer());
|
||||||
}
|
|
||||||
|
}
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void onPing(ServerListPingEvent e) {
|
public void onPing(ServerListPingEvent e) {
|
||||||
|
|
|
@ -1,37 +1,37 @@
|
||||||
package me.night.nullvalkyrie.Chests;
|
package me.night.nullvalkyrie.chests;
|
||||||
|
|
||||||
import me.night.nullvalkyrie.commands.MenuCommand;
|
import me.night.nullvalkyrie.commands.MenuCommand;
|
||||||
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.inventory.InventoryClickEvent;
|
import org.bukkit.event.inventory.InventoryClickEvent;
|
||||||
public class MenuListener implements Listener {
|
public class MenuListener implements Listener {
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void onClick(InventoryClickEvent e) {
|
public void onClick(InventoryClickEvent e) {
|
||||||
if(e.getInventory().equals(MenuCommand.inv) && e.getCurrentItem() != null) {
|
if(e.getInventory().equals(MenuCommand.inv) && e.getCurrentItem() != null) {
|
||||||
e.setCancelled(true);
|
e.setCancelled(true);
|
||||||
Player player = (Player) e.getWhoClicked();
|
Player player = (Player) e.getWhoClicked();
|
||||||
switch (e.getRawSlot()) {
|
switch (e.getRawSlot()) {
|
||||||
case 0:
|
case 0:
|
||||||
break;
|
break;
|
||||||
case 20:
|
case 20:
|
||||||
player.setHealth(0);
|
player.setHealth(0);
|
||||||
player.sendMessage(ChatColor.RED + "又做兵 抵死");
|
player.sendMessage(ChatColor.RED + "又做兵 抵死");
|
||||||
break;
|
break;
|
||||||
case 22:
|
case 22:
|
||||||
break;
|
break;
|
||||||
case 24:
|
case 24:
|
||||||
player.closeInventory();
|
player.closeInventory();
|
||||||
player.openInventory(WitherChest.witherchest);
|
player.openInventory(WitherChest.witherchest);
|
||||||
return;
|
return;
|
||||||
default:
|
default:
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
player.closeInventory();
|
player.closeInventory();
|
||||||
}else { return; }
|
}else { return; }
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -1,9 +1,9 @@
|
||||||
package me.night.nullvalkyrie.Chests;
|
package me.night.nullvalkyrie.chests;
|
||||||
|
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.ChatColor;
|
import org.bukkit.ChatColor;
|
||||||
import org.bukkit.inventory.Inventory;
|
import org.bukkit.inventory.Inventory;
|
||||||
|
|
||||||
public class WitherChest {
|
public class WitherChest {
|
||||||
public static Inventory witherchest = Bukkit.createInventory(null,54, ChatColor.DARK_AQUA + "Whiter Chest");
|
public static Inventory witherchest = Bukkit.createInventory(null,54, ChatColor.DARK_AQUA + "Whiter Chest");
|
||||||
}
|
}
|
|
@ -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<String> onTabComplete(CommandSender sender, String[] args) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
|
@ -4,10 +4,13 @@ import me.night.nullvalkyrie.Main;
|
||||||
import me.night.nullvalkyrie.miners.MinerGUI;
|
import me.night.nullvalkyrie.miners.MinerGUI;
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import com.night.nullvalkyrie.miners.*;
|
|
||||||
|
|
||||||
|
import java.util.Date;
|
||||||
import java.util.List;
|
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 {
|
public class MinerCommand extends Command {
|
||||||
private Main main;
|
private Main main;
|
||||||
public MinerCommand(Main main) {
|
public MinerCommand(Main main) {
|
||||||
|
@ -25,6 +28,9 @@ public class MinerCommand extends Command {
|
||||||
if(sender instanceof Player) {
|
if(sender instanceof Player) {
|
||||||
Player player = (Player) sender;
|
Player player = (Player) sender;
|
||||||
new MinerGUI(main, player);
|
new MinerGUI(main, player);
|
||||||
|
int seconds = Math.round((new Date().getTime() - getMiner("1").getLastclaim()) / 1000);
|
||||||
|
System.out.println("Seconds" + seconds);
|
||||||
|
generate(50, seconds);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -3,7 +3,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.Main;
|
||||||
import me.night.nullvalkyrie.Rank.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 +16,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.rank.ScoreboardListener.rankManager;
|
||||||
|
|
||||||
//92.0.69.141:25565
|
//92.0.69.141:25565
|
||||||
public class RankCommand extends Command {
|
public class RankCommand extends Command {
|
||||||
|
|
|
@ -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<String> lore = new ArrayList<>();
|
||||||
|
lore.add("Price (BIN): " + file.getString(c + ".price"));
|
||||||
|
itemMeta.setLore(lore);
|
||||||
|
item.setItemMeta(itemMeta);
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<String> onTabComplete(CommandSender sender, String[] args) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,8 +1,8 @@
|
||||||
package me.night.nullvalkyrie.commands;
|
package me.night.nullvalkyrie.commands;
|
||||||
|
|
||||||
import me.night.nullvalkyrie.Main;
|
import me.night.nullvalkyrie.Main;
|
||||||
import me.night.nullvalkyrie.Util.components.CustomMob;
|
import me.night.nullvalkyrie.util.components.CustomMob;
|
||||||
import me.night.nullvalkyrie.Util.Utils;
|
import me.night.nullvalkyrie.util.Utils;
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
import org.bukkit.World;
|
import org.bukkit.World;
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
package me.night.nullvalkyrie.commands;
|
package me.night.nullvalkyrie.commands;
|
||||||
|
|
||||||
import me.night.nullvalkyrie.Main;
|
import me.night.nullvalkyrie.Main;
|
||||||
import me.night.nullvalkyrie.Items.CustomItemManager;
|
import me.night.nullvalkyrie.items.CustomItemManager;
|
||||||
import org.bukkit.ChatColor;
|
import org.bukkit.ChatColor;
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
import org.bukkit.configuration.file.FileConfiguration;
|
import org.bukkit.configuration.file.FileConfiguration;
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
package me.night.nullvalkyrie.commands;
|
package me.night.nullvalkyrie.commands;
|
||||||
|
|
||||||
import me.night.nullvalkyrie.Main;
|
import me.night.nullvalkyrie.Main;
|
||||||
import me.night.nullvalkyrie.Items.CustomItemManager;
|
import me.night.nullvalkyrie.items.CustomItemManager;
|
||||||
import org.bukkit.ChatColor;
|
import org.bukkit.ChatColor;
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
import org.bukkit.configuration.file.FileConfiguration;
|
import org.bukkit.configuration.file.FileConfiguration;
|
||||||
|
|
52
src/main/java/me/night/nullvalkyrie/database/Client.java
Normal file
52
src/main/java/me/night/nullvalkyrie/database/Client.java
Normal file
|
@ -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<Document> 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<Document> 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));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -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.JDA;
|
||||||
import net.dv8tion.jda.api.JDABuilder;
|
import net.dv8tion.jda.api.JDABuilder;
|
||||||
import net.dv8tion.jda.api.entities.Activity;
|
import net.dv8tion.jda.api.entities.Activity;
|
||||||
|
@ -12,7 +12,7 @@ public class DiscordClientManager {
|
||||||
register();
|
register();
|
||||||
}
|
}
|
||||||
public void 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"));
|
builder.setActivity(Activity.streaming("cath.exe", "https://www.youtube.com/watch?v=YSKDu1gKntY"));
|
||||||
try {
|
try {
|
||||||
jda = builder.build();
|
jda = builder.build();
|
||||||
|
@ -21,5 +21,4 @@ public class DiscordClientManager {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
|
@ -1,4 +1,4 @@
|
||||||
package me.night.nullvalkyrie.Enchantments;
|
package me.night.nullvalkyrie.enchantments;
|
||||||
|
|
||||||
import org.bukkit.NamespacedKey;
|
import org.bukkit.NamespacedKey;
|
||||||
import org.bukkit.enchantments.Enchantment;
|
import org.bukkit.enchantments.Enchantment;
|
|
@ -1,4 +1,4 @@
|
||||||
package me.night.nullvalkyrie.Enchantments;
|
package me.night.nullvalkyrie.enchantments;
|
||||||
|
|
||||||
import org.bukkit.enchantments.Enchantment;
|
import org.bukkit.enchantments.Enchantment;
|
||||||
|
|
||||||
|
@ -7,9 +7,6 @@ import java.util.Arrays;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
public class EnchantmentManager {
|
public class EnchantmentManager {
|
||||||
public EnchantmentManager() {
|
|
||||||
register();
|
|
||||||
}
|
|
||||||
public static final Enchantment ThunderBolt = new CustomEnchantment("thunderbolt", "ThunderBolt", 5);
|
public static final Enchantment ThunderBolt = new CustomEnchantment("thunderbolt", "ThunderBolt", 5);
|
||||||
public static final Enchantment SmeltingTouch = new CustomEnchantment("smelting-touch", "Smelting Touch", 1);
|
public static final Enchantment SmeltingTouch = new CustomEnchantment("smelting-touch", "Smelting Touch", 1);
|
||||||
public static void register() {
|
public static void register() {
|
|
@ -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.CustomItemManager;
|
||||||
import me.night.nullvalkyrie.Items.Rarity;
|
import me.night.nullvalkyrie.items.Rarity;
|
||||||
import me.night.nullvalkyrie.Main;
|
import me.night.nullvalkyrie.Main;
|
||||||
import me.night.nullvalkyrie.commands.SpawnCommand;
|
import me.night.nullvalkyrie.commands.SpawnCommand;
|
||||||
import org.bukkit.*;
|
import org.bukkit.*;
|
|
@ -1,4 +1,4 @@
|
||||||
package me.night.nullvalkyrie.Items;
|
package me.night.nullvalkyrie.items;
|
||||||
|
|
||||||
import me.night.nullvalkyrie.Main;
|
import me.night.nullvalkyrie.Main;
|
||||||
import org.bukkit.ChatColor;
|
import org.bukkit.ChatColor;
|
||||||
|
@ -6,7 +6,6 @@ import org.bukkit.Material;
|
||||||
import org.bukkit.NamespacedKey;
|
import org.bukkit.NamespacedKey;
|
||||||
import org.bukkit.attribute.Attribute;
|
import org.bukkit.attribute.Attribute;
|
||||||
import org.bukkit.attribute.AttributeModifier;
|
import org.bukkit.attribute.AttributeModifier;
|
||||||
import org.bukkit.configuration.MemorySection;
|
|
||||||
import org.bukkit.configuration.file.FileConfiguration;
|
import org.bukkit.configuration.file.FileConfiguration;
|
||||||
import org.bukkit.configuration.file.YamlConfiguration;
|
import org.bukkit.configuration.file.YamlConfiguration;
|
||||||
import org.bukkit.enchantments.Enchantment;
|
import org.bukkit.enchantments.Enchantment;
|
||||||
|
@ -168,7 +167,6 @@ public class CustomItemManager {
|
||||||
File f = new File(main.getDataFolder(), path);
|
File f = new File(main.getDataFolder(), path);
|
||||||
File[] files = f.listFiles();
|
File[] files = f.listFiles();
|
||||||
for (int i = 0; i < files.length; i++) {
|
for (int i = 0; i < files.length; i++) {
|
||||||
System.out.println(files[i].getName());
|
|
||||||
ns.add(files[i].getName());
|
ns.add(files[i].getName());
|
||||||
}
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
|
@ -1,4 +1,4 @@
|
||||||
package me.night.nullvalkyrie.Items;
|
package me.night.nullvalkyrie.items;
|
||||||
|
|
||||||
import org.bukkit.ChatColor;
|
import org.bukkit.ChatColor;
|
||||||
public enum Rarity {
|
public enum Rarity {
|
|
@ -2,34 +2,33 @@ package me.night.nullvalkyrie.miners;
|
||||||
|
|
||||||
import me.night.nullvalkyrie.Main;
|
import me.night.nullvalkyrie.Main;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
import org.bukkit.configuration.Configuration;
|
|
||||||
import org.bukkit.configuration.file.FileConfiguration;
|
import org.bukkit.configuration.file.FileConfiguration;
|
||||||
import org.bukkit.event.EventHandler;
|
|
||||||
import org.bukkit.scheduler.BukkitRunnable;
|
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.concurrent.ThreadLocalRandom;
|
import java.util.concurrent.ThreadLocalRandom;
|
||||||
|
|
||||||
import static me.night.nullvalkyrie.Items.CustomItemManager.loadConfig;
|
import static me.night.nullvalkyrie.items.CustomItemManager.loadConfig;
|
||||||
import static me.night.nullvalkyrie.Items.CustomItemManager.loadFile;
|
import static me.night.nullvalkyrie.items.CustomItemManager.loadFile;
|
||||||
|
|
||||||
public class CryptoMiner {
|
public class CryptoMiner {
|
||||||
protected Main main;
|
protected static Main main;
|
||||||
protected String name;
|
protected String name;
|
||||||
protected Material type;
|
protected Material type;
|
||||||
protected int level;
|
protected int level;
|
||||||
protected double rate;
|
protected double rate;
|
||||||
protected int generated;
|
protected static int generated;
|
||||||
public CryptoMiner(Main main, String name, Material type, int level, double rate) {
|
protected long lastclaim;
|
||||||
|
public CryptoMiner(Main main, String name, Material type, int level, double rate, long lastclaim) {
|
||||||
this.main = main;
|
this.main = main;
|
||||||
this.name = name; // Name of the miner
|
this.name = name; // Name of the miner
|
||||||
this.type = type; // Material to mine
|
this.type = type; // Material to mine
|
||||||
this.level = level;
|
this.level = level;
|
||||||
this.rate = rate; // Percentage generate chance in each tick 20tick per sec
|
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() {
|
public String getName() {
|
||||||
|
@ -53,30 +52,34 @@ public class CryptoMiner {
|
||||||
public int getLevel() {
|
public int getLevel() {
|
||||||
return level;
|
return level;
|
||||||
}
|
}
|
||||||
public void setLevel(int level) { this.level = level; }
|
public void setLevel(int level) { this.level = level; };
|
||||||
public void generate(int pp) {
|
public long getLastclaim() {
|
||||||
new BukkitRunnable() {
|
return lastclaim;
|
||||||
@Override
|
}
|
||||||
public void run() {
|
public void setLastClaim(long lastclaim) {
|
||||||
int count = ThreadLocalRandom.current().nextInt(100);
|
this.lastclaim = lastclaim;
|
||||||
if(count > pp) generated++;
|
}
|
||||||
}
|
private int aa;
|
||||||
}.runTaskTimer(main, 0L, 1L);
|
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<CryptoMiner> getMiners() {
|
public List<CryptoMiner> getMiners() {
|
||||||
List<CryptoMiner> arr = new ArrayList<>();
|
List<CryptoMiner> arr = new ArrayList<>();
|
||||||
FileConfiguration file = loadConfig("miners.yml");
|
FileConfiguration file = loadConfig("miners.yml");
|
||||||
for(String c : file.getKeys(false)) {
|
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;
|
return arr;
|
||||||
}
|
}
|
||||||
public CryptoMiner getMiner(String index) {
|
public static CryptoMiner getMiner(String index) {
|
||||||
FileConfiguration file = loadConfig("miners.yml");
|
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) {
|
public void setMiner(String index, String name, String material, int level, double rate, long time) {
|
||||||
CryptoMiner miner = new CryptoMiner(main, name, Material.matchMaterial(material), level, rate);
|
|
||||||
FileConfiguration file = loadConfig("miners.yml");
|
FileConfiguration file = loadConfig("miners.yml");
|
||||||
file.createSection(index);
|
file.createSection(index);
|
||||||
file.set(index + ".name", name);
|
file.set(index + ".name", name);
|
||||||
|
@ -84,6 +87,7 @@ public class CryptoMiner {
|
||||||
file.set(index + ".level", level);
|
file.set(index + ".level", level);
|
||||||
file.set(index + ".rate", rate);
|
file.set(index + ".rate", rate);
|
||||||
file.set(index + ".enabled", true);
|
file.set(index + ".enabled", true);
|
||||||
|
file.set(index + ".last-claim", time);
|
||||||
try {
|
try {
|
||||||
file.save(loadFile("miners.yml"));
|
file.save(loadFile("miners.yml"));
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
package me.night.nullvalkyrie.miners;
|
package me.night.nullvalkyrie.miners;
|
||||||
|
|
||||||
import me.night.nullvalkyrie.Main;
|
import me.night.nullvalkyrie.Main;
|
||||||
import me.night.nullvalkyrie.Items.CustomItemManager;
|
import me.night.nullvalkyrie.items.CustomItemManager;
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.ChatColor;
|
import org.bukkit.ChatColor;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
package me.night.nullvalkyrie.Rank;
|
package me.night.nullvalkyrie.rank;
|
||||||
|
|
||||||
import org.bukkit.ChatColor;
|
import org.bukkit.ChatColor;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
|
@ -1,4 +1,4 @@
|
||||||
package me.night.nullvalkyrie.Rank;
|
package me.night.nullvalkyrie.rank;
|
||||||
|
|
||||||
import me.night.nullvalkyrie.Main;
|
import me.night.nullvalkyrie.Main;
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
|
@ -1,4 +1,4 @@
|
||||||
package me.night.nullvalkyrie.Rank;
|
package me.night.nullvalkyrie.rank;
|
||||||
|
|
||||||
import org.bukkit.ChatColor;
|
import org.bukkit.ChatColor;
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
package me.night.nullvalkyrie.Rank;
|
package me.night.nullvalkyrie.rank;
|
||||||
|
|
||||||
import me.night.nullvalkyrie.Main;
|
import me.night.nullvalkyrie.Main;
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
|
@ -9,7 +9,7 @@ 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.rank.ScoreboardListener.nameTagManager;
|
||||||
|
|
||||||
public class RankManager {
|
public class RankManager {
|
||||||
private File file;
|
private File file;
|
|
@ -1,4 +1,4 @@
|
||||||
package me.night.nullvalkyrie.Rank;
|
package me.night.nullvalkyrie.rank;
|
||||||
|
|
||||||
import me.night.nullvalkyrie.Main;
|
import me.night.nullvalkyrie.Main;
|
||||||
import org.bukkit.Bukkit;
|
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.PlayerJoinEvent;
|
||||||
import org.bukkit.event.player.PlayerQuitEvent;
|
import org.bukkit.event.player.PlayerQuitEvent;
|
||||||
|
|
||||||
|
import static me.night.nullvalkyrie.database.Client.createUserSchema;
|
||||||
|
|
||||||
public class ScoreboardListener implements Listener {
|
public class ScoreboardListener implements Listener {
|
||||||
|
|
||||||
public static RankManager rankManager;
|
public static RankManager rankManager;
|
||||||
|
@ -30,6 +32,7 @@ public class ScoreboardListener implements Listener {
|
||||||
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());
|
||||||
}
|
}
|
||||||
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);
|
|
@ -1,4 +1,4 @@
|
||||||
package me.night.nullvalkyrie.Rank;
|
package me.night.nullvalkyrie.rank;
|
||||||
|
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.ChatColor;
|
import org.bukkit.ChatColor;
|
|
@ -1,4 +1,4 @@
|
||||||
package me.night.nullvalkyrie.Util;
|
package me.night.nullvalkyrie.util;
|
||||||
|
|
||||||
public class Util {
|
public class Util {
|
||||||
public static String centerText(String text, int lineLength) {
|
public static String centerText(String text, int lineLength) {
|
|
@ -1,4 +1,4 @@
|
||||||
package me.night.nullvalkyrie.Util;
|
package me.night.nullvalkyrie.util;
|
||||||
|
|
||||||
import org.bukkit.ChatColor;
|
import org.bukkit.ChatColor;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
|
@ -1,4 +1,4 @@
|
||||||
package me.night.nullvalkyrie.Util.components;
|
package me.night.nullvalkyrie.util.components;
|
||||||
|
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
|
@ -12,8 +12,8 @@ import org.bukkit.inventory.ItemStack;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import static me.night.nullvalkyrie.Util.Utils.color;
|
import static me.night.nullvalkyrie.util.Utils.color;
|
||||||
import static me.night.nullvalkyrie.Util.Utils.*;
|
import static me.night.nullvalkyrie.util.Utils.*;
|
||||||
|
|
||||||
public enum CustomMob {
|
public enum CustomMob {
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
package me.night.nullvalkyrie.Util.components;
|
package me.night.nullvalkyrie.util.components;
|
||||||
|
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.ItemStack;
|
0
src/main/resources/miners.yml
Normal file
0
src/main/resources/miners.yml
Normal file
Loading…
Reference in a new issue