shop command fix
This commit is contained in:
parent
63a1d5e4ae
commit
dfa6cb489e
5 changed files with 254 additions and 15 deletions
|
@ -27,16 +27,19 @@ import org.bukkit.plugin.java.JavaPlugin;
|
|||
import java.io.File;
|
||||
import java.util.Date;
|
||||
|
||||
import static me.night.nullvalkyrie.items.CustomItemManager.updateYamlFilesToPlugin;
|
||||
|
||||
public final class Main extends JavaPlugin implements Listener {
|
||||
private BossBar bossbar;
|
||||
private CustomItemManager customItemManager;
|
||||
public CustomItemManager getCustomItemManager() {
|
||||
return customItemManager;
|
||||
}
|
||||
@Override
|
||||
public void onEnable() {
|
||||
getConfig().options().copyDefaults();
|
||||
saveDefaultConfig();
|
||||
EnchantmentManager.register();
|
||||
new CustomItemManager(this);
|
||||
updateYamlFilesToPlugin("shop.yml");
|
||||
updateYamlFilesToPlugin("hardpoint.yml");
|
||||
updateYamlFilesToPlugin("miners.yml");
|
||||
new CommandManager(this).register();
|
||||
bossbar = Bukkit.createBossBar(ChatColor.GOLD + "Kuudra", BarColor.RED, BarStyle.SEGMENTED_12);
|
||||
Bukkit.getPluginManager().registerEvents(this, this);
|
||||
|
@ -45,10 +48,8 @@ public final class Main extends JavaPlugin implements Listener {
|
|||
Bukkit.getPluginManager().registerEvents(new CustomItemEvents(this), this);
|
||||
Bukkit.getPluginManager().registerEvents(new DamageEffect(this), this);
|
||||
//Bukkit.getPluginManager().registerEvents(new GameEvent(this), this);
|
||||
EnchantmentManager.register();
|
||||
new DiscordClientManager();
|
||||
customItemManager = new CustomItemManager(this);
|
||||
new CryptoMiner(this, "Gay", Material.ENDER_CHEST, 10, 0.7, new Date().getTime());
|
||||
new CryptoMiner(this, "Baka", Material.ENDER_CHEST, 10, 0.7, new Date().getTime());
|
||||
new Client();
|
||||
}
|
||||
|
||||
|
|
|
@ -20,6 +20,7 @@ public class CommandManager {
|
|||
new WeaponCommand();
|
||||
new RankCommand();
|
||||
new UtilCommand();
|
||||
new ShopCommand();
|
||||
new BetaCommand(main);
|
||||
new MinerCommand(main);
|
||||
}
|
||||
|
|
|
@ -3,18 +3,17 @@ 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.entity.Player;
|
||||
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 final FileConfiguration file = CustomItemManager.loadConfig("shop.yml");
|
||||
private Inventory inv;
|
||||
|
||||
public ShopCommand() {
|
||||
|
@ -23,22 +22,24 @@ public class ShopCommand extends Command {
|
|||
"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");
|
||||
int counter = 0;
|
||||
for (String c : file.getKeys(false)) {
|
||||
ItemStack item = new ItemStack(Material.matchMaterial(file.getString(c + ".material")));
|
||||
ItemStack item = CustomItemManager.getItem(file.getString(c + ".name")).clone();
|
||||
ItemMeta itemMeta = item.getItemMeta();
|
||||
itemMeta.setDisplayName(file.getString(c + ".name"));
|
||||
List<String> lore = new ArrayList<>();
|
||||
List<String> lore = itemMeta.getLore();
|
||||
lore.add("Price (BIN): " + file.getString(c + ".price"));
|
||||
itemMeta.setLore(lore);
|
||||
item.setItemMeta(itemMeta);
|
||||
|
||||
inv.setItem(counter, item);
|
||||
counter++;
|
||||
}
|
||||
Player player = (Player) sender;
|
||||
player.openInventory(inv);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -0,0 +1,224 @@
|
|||
'0':
|
||||
name: Sussy
|
||||
material: ENDER_CHEST
|
||||
level: 10
|
||||
rate: 0.7
|
||||
enabled: true
|
||||
last-claim: 1668206939600
|
||||
'1':
|
||||
name: Sussy
|
||||
material: ENDER_CHEST
|
||||
level: 10
|
||||
rate: 0.7
|
||||
enabled: true
|
||||
last-claim: 1668208245832
|
||||
'2':
|
||||
name: Sussy
|
||||
material: ENDER_CHEST
|
||||
level: 10
|
||||
rate: 0.7
|
||||
enabled: true
|
||||
last-claim: 1668208370651
|
||||
'3':
|
||||
name: Sussy
|
||||
material: ENDER_CHEST
|
||||
level: 10
|
||||
rate: 0.7
|
||||
enabled: true
|
||||
last-claim: 1668208676271
|
||||
'4':
|
||||
name: Sussy
|
||||
material: ENDER_CHEST
|
||||
level: 10
|
||||
rate: 0.7
|
||||
enabled: true
|
||||
last-claim: 1668210448531
|
||||
'5':
|
||||
name: Sussy
|
||||
material: ENDER_CHEST
|
||||
level: 10
|
||||
rate: 0.7
|
||||
enabled: true
|
||||
last-claim: 1668210799036
|
||||
'6':
|
||||
name: Sussy
|
||||
material: ENDER_CHEST
|
||||
level: 10
|
||||
rate: 0.7
|
||||
enabled: true
|
||||
last-claim: 1668254119769
|
||||
'7':
|
||||
name: Sussy
|
||||
material: ENDER_CHEST
|
||||
level: 10
|
||||
rate: 0.7
|
||||
enabled: true
|
||||
last-claim: 1668254787702
|
||||
'8':
|
||||
name: Sussy
|
||||
material: ENDER_CHEST
|
||||
level: 10
|
||||
rate: 0.7
|
||||
enabled: true
|
||||
last-claim: 1668256451864
|
||||
'9':
|
||||
name: Sussy
|
||||
material: ENDER_CHEST
|
||||
level: 10
|
||||
rate: 0.7
|
||||
enabled: true
|
||||
last-claim: 1668257458167
|
||||
'10':
|
||||
name: Sussy
|
||||
material: ENDER_CHEST
|
||||
level: 10
|
||||
rate: 0.7
|
||||
enabled: true
|
||||
last-claim: 1668257773080
|
||||
'11':
|
||||
name: Sussy
|
||||
material: ENDER_CHEST
|
||||
level: 10
|
||||
rate: 0.7
|
||||
enabled: true
|
||||
last-claim: 1668259524393
|
||||
'12':
|
||||
name: Sussy
|
||||
material: ENDER_CHEST
|
||||
level: 10
|
||||
rate: 0.7
|
||||
enabled: true
|
||||
last-claim: 1668260226503
|
||||
'13':
|
||||
name: Sussy
|
||||
material: ENDER_CHEST
|
||||
level: 10
|
||||
rate: 0.7
|
||||
enabled: true
|
||||
last-claim: 1668261403911
|
||||
'14':
|
||||
name: Sussy
|
||||
material: ENDER_CHEST
|
||||
level: 10
|
||||
rate: 0.7
|
||||
enabled: true
|
||||
last-claim: 1668261796376
|
||||
'15':
|
||||
name: Sussy
|
||||
material: ENDER_CHEST
|
||||
level: 10
|
||||
rate: 0.7
|
||||
enabled: true
|
||||
last-claim: 1668262686577
|
||||
'16':
|
||||
name: Sussy
|
||||
material: ENDER_CHEST
|
||||
level: 10
|
||||
rate: 0.7
|
||||
enabled: true
|
||||
last-claim: 1668262788190
|
||||
'17':
|
||||
name: Sussy
|
||||
material: ENDER_CHEST
|
||||
level: 10
|
||||
rate: 0.7
|
||||
enabled: true
|
||||
last-claim: 1668263553259
|
||||
'18':
|
||||
name: Sussy
|
||||
material: ENDER_CHEST
|
||||
level: 10
|
||||
rate: 0.7
|
||||
enabled: true
|
||||
last-claim: 1668263687264
|
||||
'19':
|
||||
name: Sussy
|
||||
material: ENDER_CHEST
|
||||
level: 10
|
||||
rate: 0.7
|
||||
enabled: true
|
||||
last-claim: 1668267428787
|
||||
'20':
|
||||
name: Sussy
|
||||
material: ENDER_CHEST
|
||||
level: 10
|
||||
rate: 0.7
|
||||
enabled: true
|
||||
last-claim: 1668267550253
|
||||
'21':
|
||||
name: Sussy
|
||||
material: ENDER_CHEST
|
||||
level: 10
|
||||
rate: 0.7
|
||||
enabled: true
|
||||
last-claim: 1668267769594
|
||||
'22':
|
||||
name: Sussy
|
||||
material: ENDER_CHEST
|
||||
level: 10
|
||||
rate: 0.7
|
||||
enabled: true
|
||||
last-claim: 1668268013534
|
||||
'23':
|
||||
name: Sussy
|
||||
material: ENDER_CHEST
|
||||
level: 10
|
||||
rate: 0.7
|
||||
enabled: true
|
||||
last-claim: 1668268096781
|
||||
'24':
|
||||
name: Sussy
|
||||
material: ENDER_CHEST
|
||||
level: 10
|
||||
rate: 0.7
|
||||
enabled: true
|
||||
last-claim: 1668268392432
|
||||
'25':
|
||||
name: Sussy
|
||||
material: ENDER_CHEST
|
||||
level: 10
|
||||
rate: 0.7
|
||||
enabled: true
|
||||
last-claim: 1668268601044
|
||||
'26':
|
||||
name: Sussy
|
||||
material: ENDER_CHEST
|
||||
level: 10
|
||||
rate: 0.7
|
||||
enabled: true
|
||||
last-claim: 1668300216256
|
||||
'27':
|
||||
name: Sussy
|
||||
material: ENDER_CHEST
|
||||
level: 10
|
||||
rate: 0.7
|
||||
enabled: true
|
||||
last-claim: 1668300740524
|
||||
'28':
|
||||
name: Sussy
|
||||
material: ENDER_CHEST
|
||||
level: 10
|
||||
rate: 0.7
|
||||
enabled: true
|
||||
last-claim: 1668301188489
|
||||
'29':
|
||||
name: Sussy
|
||||
material: ENDER_CHEST
|
||||
level: 10
|
||||
rate: 0.7
|
||||
enabled: true
|
||||
last-claim: 1668303289593
|
||||
'30':
|
||||
name: Sussy
|
||||
material: ENDER_CHEST
|
||||
level: 10
|
||||
rate: 0.7
|
||||
enabled: true
|
||||
last-claim: 1668303659410
|
||||
'31':
|
||||
name: Sussy
|
||||
material: ENDER_CHEST
|
||||
level: 10
|
||||
rate: 0.7
|
||||
enabled: true
|
||||
last-claim: 1668304689097
|
12
src/main/resources/shop.yml
Normal file
12
src/main/resources/shop.yml
Normal file
|
@ -0,0 +1,12 @@
|
|||
SnowGun:
|
||||
name: Snow Gun
|
||||
price: 200
|
||||
Terminator:
|
||||
name: Terminator
|
||||
price: 300
|
||||
ExplosiveBow:
|
||||
name: Explosive Bow
|
||||
price: 250
|
||||
GrapplingHook:
|
||||
name: Grappling Hook
|
||||
price: 400
|
Loading…
Reference in a new issue