formatted code on commands

This commit is contained in:
NK 2022-11-17 11:03:45 +00:00
parent 8b6cd099fd
commit abbaff1d0a
13 changed files with 82 additions and 84 deletions

View file

@ -1,15 +1,11 @@
package me.night.nullvalkyrie.commands; package me.night.nullvalkyrie.commands;
import net.minecraft.network.protocol.game.PacketPlayOutOpenWindow; import net.minecraft.network.protocol.game.PacketPlayOutOpenWindow;
import net.minecraft.server.level.EntityPlayer; import net.minecraft.server.level.EntityPlayer;
import net.minecraft.server.network.PlayerConnection; import net.minecraft.server.network.PlayerConnection;
import net.minecraft.world.inventory.Containers; import net.minecraft.world.inventory.Containers;
import org.bukkit.command.CommandSender; import org.bukkit.command.CommandSender;
//import org.bukkit.craftbukkit.v1_18_R1.entity.CraftHumanEntity;
//import org.bukkit.craftbukkit.v1_18_R1.entity.CraftPlayer;
//import org.bukkit.craftbukkit.v1_18_R1.util.CraftChatMessage;
import org.bukkit.craftbukkit.v1_19_R1.entity.CraftPlayer; import org.bukkit.craftbukkit.v1_19_R1.entity.CraftPlayer;
import org.bukkit.craftbukkit.v1_19_R1.util.CraftChatMessage; import org.bukkit.craftbukkit.v1_19_R1.util.CraftChatMessage;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;

View file

@ -1,6 +1,5 @@
package me.night.nullvalkyrie.commands; package me.night.nullvalkyrie.commands;
import org.bukkit.command.CommandSender; import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;

View file

@ -62,7 +62,6 @@ public class MenuCommand extends Command {
for (int i : new int[]{1, 2, 3, 4, 5, 6, 7, 8, 9, 17, 18, 26, 27, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44}) { for (int i : new int[]{1, 2, 3, 4, 5, 6, 7, 8, 9, 17, 18, 26, 27, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44}) {
inv.setItem(i, frame); inv.setItem(i, frame);
} }
player.openInventory(inv); player.openInventory(inv);
} }

View file

@ -13,6 +13,7 @@ import static me.night.nullvalkyrie.miners.CryptoMiner.getMiner;
public class MinerCommand extends Command { public class MinerCommand extends Command {
private final Main main; private final Main main;
public MinerCommand(Main main) { public MinerCommand(Main main) {
super( super(
"miner", "miner",
@ -28,7 +29,7 @@ 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() - (long) getMiner("1").get("lastclaim")) / 1000); int seconds = (int) (new Date().getTime() - (long) getMiner("1").get("lastclaim")) / 1000;
System.out.println("Seconds" + seconds); System.out.println("Seconds" + seconds);
generate(50, seconds); generate(50, seconds);
} }

View file

@ -18,19 +18,18 @@ 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 { public class RankCommand extends Command {
private Main main;
public RankCommand(Main main) { public RankCommand() {
super( super(
"rank", "rank",
new String[]{}, new String[]{},
"Set rank of players", "Set rank of players",
"" ""
); );
this.main = main;
} }
private Cache<UUID, Long> cooldown = CacheBuilder.newBuilder().expireAfterWrite(5, TimeUnit.SECONDS).build();
private final Cache<UUID, Long> cooldown = CacheBuilder.newBuilder().expireAfterWrite(5, TimeUnit.SECONDS).build();
@Override @Override

View file

@ -16,6 +16,7 @@ import java.util.List;
public class ShopCommand extends Command { public class ShopCommand extends Command {
private FileConfiguration file; private FileConfiguration file;
private Inventory inv; private Inventory inv;
public ShopCommand() { public ShopCommand() {
super("7elven", super("7elven",
new String[]{"711", "seven", "7ven"}, new String[]{"711", "seven", "7ven"},
@ -24,6 +25,7 @@ public class ShopCommand extends Command{
); );
file = CustomItemManager.loadConfig("miners.yml"); file = CustomItemManager.loadConfig("miners.yml");
} }
@Override @Override
public void onCommand(CommandSender sender, String[] args) { public void onCommand(CommandSender sender, String[] args) {
inv = Bukkit.createInventory(null, 45, ChatColor.GREEN + "7-Eleven 24/7"); inv = Bukkit.createInventory(null, 45, ChatColor.GREEN + "7-Eleven 24/7");

View file

@ -1,6 +1,5 @@
package me.night.nullvalkyrie.commands; package me.night.nullvalkyrie.commands;
import org.bukkit.command.CommandSender; import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
@ -15,6 +14,7 @@ public class TestCommand extends Command {
"" ""
); );
} }
@Override @Override
public void onCommand(CommandSender sender, String[] args) { public void onCommand(CommandSender sender, String[] args) {
if (sender instanceof Player) { if (sender instanceof Player) {

View file

@ -15,8 +15,8 @@ import java.util.List;
import java.util.Objects; import java.util.Objects;
public class UtilCommand extends Command { public class UtilCommand extends Command {
private Main main;
public UtilCommand(Main main) { public UtilCommand() {
super( super(
"util", "util",
new String[]{}, new String[]{},
@ -24,8 +24,8 @@ public class UtilCommand extends Command {
"" ""
); );
this.main = main;
} }
@Override @Override
public void onCommand(CommandSender sender, String[] args) { public void onCommand(CommandSender sender, String[] args) {
Player player = (Player) sender; Player player = (Player) sender;
@ -40,7 +40,7 @@ public class UtilCommand extends Command {
} }
} }
ItemStack item = main.getCustomItemManager().getItem(s.toString()); ItemStack item = CustomItemManager.getItem(s.toString());
if (item.hasItemMeta()) { if (item.hasItemMeta()) {
player.getInventory().addItem(item); player.getInventory().addItem(item);
} else { } else {
@ -53,8 +53,8 @@ public class UtilCommand extends Command {
if (args.length == 1) { if (args.length == 1) {
List<String> hh = CustomItemManager.getAllFilesFromDirectory("ItemData"); List<String> hh = CustomItemManager.getAllFilesFromDirectory("ItemData");
ArrayList<String> cc = new ArrayList<>(); ArrayList<String> cc = new ArrayList<>();
for(int kk = 0; kk < hh.size(); kk++) { for (String s : hh) {
FileConfiguration c = CustomItemManager.loadConfig("ItemData\\" + hh.get(kk)); FileConfiguration c = CustomItemManager.loadConfig("ItemData\\" + s);
if (Objects.equals(c.getString("type"), "Util")) { if (Objects.equals(c.getString("type"), "Util")) {
cc.add(c.getString("name")); cc.add(c.getString("name"));
} }

View file

@ -11,6 +11,7 @@ import java.util.UUID;
public class VanishCommand extends Command { public class VanishCommand extends Command {
private final List<UUID> vanished = new ArrayList<>(); private final List<UUID> vanished = new ArrayList<>();
public VanishCommand() { public VanishCommand() {
super( super(
"vanish", "vanish",
@ -19,6 +20,7 @@ public class VanishCommand extends Command {
"" ""
); );
} }
@Override @Override
public void onCommand(CommandSender sender, String[] args) { public void onCommand(CommandSender sender, String[] args) {
if (sender instanceof Player) { if (sender instanceof Player) {