1.1Bate
This commit is contained in:
parent
513041608b
commit
cc5758faca
|
@ -32,7 +32,8 @@ public final class BoxSimulate extends JavaPlugin {
|
||||||
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
||||||
if (args.length == 1 && args[0].equalsIgnoreCase("reload")) {
|
if (args.length == 1 && args[0].equalsIgnoreCase("reload")) {
|
||||||
reloadConfig();
|
reloadConfig();
|
||||||
sender.sendMessage("Config reloaded.");
|
reload();
|
||||||
|
sender.sendMessage("模拟开箱配置文件已重载.");
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
if (sender instanceof Player) {
|
if (sender instanceof Player) {
|
||||||
|
|
|
@ -7,6 +7,7 @@ import com.praya.myitems.MyItems;
|
||||||
import com.yaohun.itemlibrary.api.ItemKuAPI;
|
import com.yaohun.itemlibrary.api.ItemKuAPI;
|
||||||
import me.Demon.DemonPlugin.DemonAPI;
|
import me.Demon.DemonPlugin.DemonAPI;
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
|
import org.bukkit.Sound;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.event.inventory.InventoryClickEvent;
|
import org.bukkit.event.inventory.InventoryClickEvent;
|
||||||
import org.bukkit.event.inventory.InventoryCloseEvent;
|
import org.bukkit.event.inventory.InventoryCloseEvent;
|
||||||
|
@ -27,7 +28,7 @@ public class BoxSimulateGui implements InventoryHolder, GuiHolder {
|
||||||
private Map<Integer, String> cacheItems = new HashMap<>();
|
private Map<Integer, String> cacheItems = new HashMap<>();
|
||||||
|
|
||||||
public BoxSimulateGui(Player player) {
|
public BoxSimulateGui(Player player) {
|
||||||
this.inventory = Bukkit.createInventory(this, 54, "开箱模拟器");
|
this.inventory = Bukkit.createInventory(this, 27, "装备武器箱 - 模拟开箱");
|
||||||
this.player = player;
|
this.player = player;
|
||||||
init();
|
init();
|
||||||
}
|
}
|
||||||
|
@ -38,9 +39,6 @@ public class BoxSimulateGui implements InventoryHolder, GuiHolder {
|
||||||
int i = 0;
|
int i = 0;
|
||||||
for (Map.Entry<String, BoxData> entry : boxDatas.entrySet()) {
|
for (Map.Entry<String, BoxData> entry : boxDatas.entrySet()) {
|
||||||
BoxData boxData = boxDataList.get(i);
|
BoxData boxData = boxDataList.get(i);
|
||||||
if (!DemonAPI.hasPoints(player, boxData.getNeed())) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
ItemStack itemStack = getBoxItem(boxData.getItem());
|
ItemStack itemStack = getBoxItem(boxData.getItem());
|
||||||
inventory.setItem(i, itemStack);
|
inventory.setItem(i, itemStack);
|
||||||
cacheItems.put(i, entry.getKey());
|
cacheItems.put(i, entry.getKey());
|
||||||
|
@ -68,12 +66,23 @@ public class BoxSimulateGui implements InventoryHolder, GuiHolder {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
String id = cacheItems.get(slot);
|
String id = cacheItems.get(slot);
|
||||||
|
long time = CDTimeAPI.getCD(player.getUniqueId(),"box_simulate_box_"+id) / 1000;
|
||||||
|
String timeShow = String.format("%.1f",(double) time);
|
||||||
|
if(!player.isOp()) {
|
||||||
if (CDTimeAPI.isCD(player.getUniqueId(), "box_simulate_box_" + id)) {
|
if (CDTimeAPI.isCD(player.getUniqueId(), "box_simulate_box_" + id)) {
|
||||||
player.sendMessage("§8§l[§c§l!§8§l] §7该箱子冷却中...");
|
player.sendMessage("§7[§6帝国战争§7] §f你需要等待 §e" + timeShow + "秒 §f后才能再次打开.");
|
||||||
|
player.playSound(player.getLocation(), Sound.ENTITY_VILLAGER_NO, 1.6F, 1.8F);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
BoxData boxData = BoxSimulate.getBoxDatas().get(id);
|
BoxData boxData = BoxSimulate.getBoxDatas().get(id);
|
||||||
|
if (!DemonAPI.hasPoints(player, boxData.getNeed())) {
|
||||||
|
player.sendMessage("§7[§6帝国战争§7] §f你需要拥有§d"+DemonAPI.MoneyFormat(boxData.getNeed())+"点券§f才能模拟打开.");
|
||||||
|
player.playSound(player.getLocation(), Sound.ENTITY_VILLAGER_NO,1.6F,1.8F);
|
||||||
|
return;
|
||||||
|
}
|
||||||
inventory.setItem(slot, generateItem(boxData.getItem()));
|
inventory.setItem(slot, generateItem(boxData.getItem()));
|
||||||
|
player.playSound(player.getLocation(), Sound.ENTITY_EXPERIENCE_ORB_PICKUP,1.6F,1.8F);
|
||||||
CDTimeAPI.setPlayerCD(player.getUniqueId(), "box_simulate_box_"+id, 1000 * 60 * 60);
|
CDTimeAPI.setPlayerCD(player.getUniqueId(), "box_simulate_box_"+id, 1000 * 60 * 60);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user