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>
|
||||
<version>2.4</version>
|
||||
<configuration>
|
||||
<outputDirectory>media/night0721/Data/Network/Lobby/plugins</outputDirectory>
|
||||
<outputDirectory>E:\Files\SB\plugins</outputDirectory>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<!-- <plugin>-->
|
||||
<!-- <groupId>net.md-5</groupId>-->
|
||||
<!-- <artifactId>specialsource-maven-plugin</artifactId>-->
|
||||
<!-- <version>1.2.2</version>-->
|
||||
<!-- <executions>-->
|
||||
<!-- <execution>-->
|
||||
<!-- <phase>package</phase>-->
|
||||
<!-- <goals>-->
|
||||
<!-- <goal>remap</goal>-->
|
||||
<!-- </goals>-->
|
||||
<!-- <id>remap-obf</id>-->
|
||||
<!-- <configuration>-->
|
||||
<!-- <srgIn>org.spigotmc:minecraft-server:1.18-R0.1-SNAPSHOT:txt:maps-mojang</srgIn>-->
|
||||
<!-- <reverse>true</reverse>-->
|
||||
<!-- <remappedDependencies>org.spigotmc:spigot:1.18-R0.1-SNAPSHOT:jar:remapped-mojang</remappedDependencies>-->
|
||||
<!-- <remappedArtifactAttached>true</remappedArtifactAttached>-->
|
||||
<!-- <remappedClassifierName>remapped-obf</remappedClassifierName>-->
|
||||
<!-- </configuration>-->
|
||||
<!-- </execution>-->
|
||||
<!-- <execution>-->
|
||||
<!-- <phase>package</phase>-->
|
||||
<!-- <goals>-->
|
||||
<!-- <goal>remap</goal>-->
|
||||
<!-- </goals>-->
|
||||
<!-- <id>remap-spigot</id>-->
|
||||
<!-- <configuration>-->
|
||||
<!-- <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>-->
|
||||
<!-- <remappedDependencies>org.spigotmc:spigot:1.18-R0.1-SNAPSHOT:jar:remapped-obf</remappedDependencies>-->
|
||||
<!-- </configuration>-->
|
||||
<!-- </execution>-->
|
||||
<!-- </executions>-->
|
||||
<!-- </plugin>-->
|
||||
<plugin>
|
||||
<groupId>net.md-5</groupId>
|
||||
<artifactId>specialsource-maven-plugin</artifactId>
|
||||
<version>1.2.2</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<phase>package</phase>
|
||||
<goals>
|
||||
<goal>remap</goal>
|
||||
</goals>
|
||||
<id>remap-obf</id>
|
||||
<configuration>
|
||||
<srgIn>org.spigotmc:minecraft-server:1.19.2-R0.1-SNAPSHOT:txt:maps-mojang</srgIn>
|
||||
<reverse>true</reverse>
|
||||
<remappedDependencies>org.spigotmc:spigot:1.19.2-R0.1-SNAPSHOT:jar:remapped-mojang</remappedDependencies>
|
||||
<remappedArtifactAttached>true</remappedArtifactAttached>
|
||||
<remappedClassifierName>remapped-obf</remappedClassifierName>
|
||||
</configuration>
|
||||
</execution>
|
||||
<execution>
|
||||
<phase>package</phase>
|
||||
<goals>
|
||||
<goal>remap</goal>
|
||||
</goals>
|
||||
<id>remap-spigot</id>
|
||||
<configuration>
|
||||
<inputFile>${project.build.directory}/${project.artifactId}-${project.version}-remapped-obf.jar</inputFile>
|
||||
<srgIn>org.spigotmc:minecraft-server:1.19.2-R0.1-SNAPSHOT:csrg:maps-spigot</srgIn>
|
||||
<remappedDependencies>org.spigotmc:spigot:1.19.2-R0.1-SNAPSHOT:jar:remapped-obf</remappedDependencies>
|
||||
</configuration>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
</plugins>
|
||||
<resources>
|
||||
<resource>
|
||||
|
@ -109,9 +109,9 @@
|
|||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.spigotmc</groupId>
|
||||
<artifactId>spigot-api</artifactId>
|
||||
<version>1.18.1-R0.1-SNAPSHOT</version>
|
||||
<!-- <classifier>remapped-mojang</classifier>-->
|
||||
<artifactId>spigot</artifactId>
|
||||
<version>1.19.2-R0.1-SNAPSHOT</version>
|
||||
<classifier>remapped-mojang</classifier>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
|
@ -119,5 +119,11 @@
|
|||
<artifactId>JDA</artifactId>
|
||||
<version>5.0.0-alpha.13</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.mongodb</groupId>
|
||||
<artifactId>mongo-java-driver</artifactId>
|
||||
<version>3.12.11</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</project>
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -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; }
|
||||
}
|
||||
}
|
|
@ -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");
|
||||
}
|
|
@ -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 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);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -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 {
|
||||
|
|
|
@ -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;
|
||||
|
||||
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;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
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.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 {
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -1,4 +1,4 @@
|
|||
package me.night.nullvalkyrie.Enchantments;
|
||||
package me.night.nullvalkyrie.enchantments;
|
||||
|
||||
import org.bukkit.NamespacedKey;
|
||||
import org.bukkit.enchantments.Enchantment;
|
|
@ -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() {
|
|
@ -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.*;
|
|
@ -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) {
|
|
@ -1,4 +1,4 @@
|
|||
package me.night.nullvalkyrie.Items;
|
||||
package me.night.nullvalkyrie.items;
|
||||
|
||||
import org.bukkit.ChatColor;
|
||||
public enum Rarity {
|
|
@ -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<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")));
|
||||
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) {
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
package me.night.nullvalkyrie.Rank;
|
||||
package me.night.nullvalkyrie.rank;
|
||||
|
||||
import org.bukkit.ChatColor;
|
||||
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 org.bukkit.Bukkit;
|
|
@ -1,4 +1,4 @@
|
|||
package me.night.nullvalkyrie.Rank;
|
||||
package me.night.nullvalkyrie.rank;
|
||||
|
||||
import org.bukkit.ChatColor;
|
||||
|
|
@ -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;
|
|
@ -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);
|
|
@ -1,4 +1,4 @@
|
|||
package me.night.nullvalkyrie.Rank;
|
||||
package me.night.nullvalkyrie.rank;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.ChatColor;
|
|
@ -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) {
|
|
@ -1,4 +1,4 @@
|
|||
package me.night.nullvalkyrie.Util;
|
||||
package me.night.nullvalkyrie.util;
|
||||
|
||||
import org.bukkit.ChatColor;
|
||||
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.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 {
|
||||
|
|
@ -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;
|
0
src/main/resources/miners.yml
Normal file
0
src/main/resources/miners.yml
Normal file
Loading…
Reference in a new issue