fix miner
This commit is contained in:
parent
bcdf49e996
commit
4df924e3ce
2 changed files with 18 additions and 18 deletions
|
@ -12,7 +12,7 @@ import static me.night.nullvalkyrie.miners.CryptoMiner.generate;
|
|||
import static me.night.nullvalkyrie.miners.CryptoMiner.getMiner;
|
||||
|
||||
public class MinerCommand extends Command {
|
||||
private Main main;
|
||||
private final Main main;
|
||||
public MinerCommand(Main main) {
|
||||
super(
|
||||
"miner",
|
||||
|
@ -28,7 +28,7 @@ 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);
|
||||
int seconds = Math.round((new Date().getTime() - (long) getMiner("1").get("lastclaim")) / 1000);
|
||||
System.out.println("Seconds" + seconds);
|
||||
generate(50, seconds);
|
||||
}
|
||||
|
|
|
@ -12,15 +12,12 @@ import org.bukkit.inventory.ItemStack;
|
|||
import org.bukkit.inventory.meta.ItemMeta;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
public class MinerGUI {
|
||||
private Main main;
|
||||
private FileConfiguration file;
|
||||
private final FileConfiguration file;
|
||||
private Inventory inv;
|
||||
public MinerGUI(Main main, Player player) {
|
||||
this.main = main;
|
||||
if(!main.getDataFolder().exists()) main.getDataFolder().mkdir();
|
||||
file = CustomItemManager.loadConfig("miners.yml");
|
||||
createUI();
|
||||
|
@ -35,12 +32,13 @@ public class MinerGUI {
|
|||
ItemStack close = new ItemStack(Material.BARRIER);
|
||||
ItemMeta closemeta = close.getItemMeta();
|
||||
closemeta.setDisplayName(ChatColor.WHITE + "Close the menu");
|
||||
closemeta.setLore(Arrays.asList(ChatColor.GRAY + "Close the menu"));
|
||||
closemeta.setLore(List.of(ChatColor.GRAY + "Close the menu"));
|
||||
close.setItemMeta(closemeta);
|
||||
inv.setItem(0, close);
|
||||
int[] a = new int[]{10,11,12,13,14,15,16,19,20,21,22,23,24,25,28,29,30,31,32,33,34};
|
||||
int ind = 0;
|
||||
for(String c : file.getKeys(false)) {
|
||||
if (ind <= 20) {
|
||||
ItemStack item = new ItemStack(Material.matchMaterial(file.getString(c + ".material")));
|
||||
ItemMeta itemMeta = item.getItemMeta();
|
||||
itemMeta.setDisplayName(file.getString(c + ".name"));
|
||||
|
@ -53,6 +51,8 @@ public class MinerGUI {
|
|||
inv.setItem(a[ind], item);
|
||||
ind++;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue