Cooldown bar
This commit is contained in:
parent
2f0167ea09
commit
80c153095b
@ -157,7 +157,7 @@ public class Recharge extends MiniPlugin
|
|||||||
UtilServer.getServer().getPluginManager().callEvent(rechargeEvent);
|
UtilServer.getServer().getPluginManager().callEvent(rechargeEvent);
|
||||||
|
|
||||||
if (attachItem)
|
if (attachItem)
|
||||||
Get(player).put(ability, new RechargeData(player, ability, player.getItemInHand(), System.currentTimeMillis()+rechargeEvent.GetRecharge()));
|
Get(player).put(ability, new RechargeData(player, ability, player.getItemInHand(), System.currentTimeMillis()+rechargeEvent.GetRecharge(), _plugin, rechargeEvent.GetRecharge()));
|
||||||
else
|
else
|
||||||
Get(player).put(ability, new RechargeData(System.currentTimeMillis()+rechargeEvent.GetRecharge()));
|
Get(player).put(ability, new RechargeData(System.currentTimeMillis()+rechargeEvent.GetRecharge()));
|
||||||
}
|
}
|
||||||
|
@ -1,20 +1,25 @@
|
|||||||
package mineplex.core.recharge;
|
package mineplex.core.recharge;
|
||||||
|
|
||||||
import mineplex.core.common.util.C;
|
import mineplex.core.common.util.C;
|
||||||
|
import mineplex.core.common.util.UtilDisplay;
|
||||||
import mineplex.core.common.util.UtilInv;
|
import mineplex.core.common.util.UtilInv;
|
||||||
|
import mineplex.core.common.util.UtilServer;
|
||||||
import mineplex.core.common.util.UtilTime;
|
import mineplex.core.common.util.UtilTime;
|
||||||
|
|
||||||
import org.bukkit.ChatColor;
|
import org.bukkit.ChatColor;
|
||||||
import org.bukkit.enchantments.Enchantment;
|
import org.bukkit.enchantments.Enchantment;
|
||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.ItemStack;
|
||||||
import org.bukkit.inventory.meta.ItemMeta;
|
import org.bukkit.inventory.meta.ItemMeta;
|
||||||
|
import org.bukkit.plugin.java.JavaPlugin;
|
||||||
|
|
||||||
public class RechargeData
|
public class RechargeData
|
||||||
{
|
{
|
||||||
|
public JavaPlugin Plugin;
|
||||||
public long Time;
|
public long Time;
|
||||||
|
|
||||||
public org.bukkit.entity.Player Player;
|
public org.bukkit.entity.Player Player;
|
||||||
public String Name;
|
public String Name;
|
||||||
|
public long Recharge;
|
||||||
public ItemStack Item;
|
public ItemStack Item;
|
||||||
|
|
||||||
public RechargeData(long time)
|
public RechargeData(long time)
|
||||||
@ -22,19 +27,37 @@ public class RechargeData
|
|||||||
Time = time;
|
Time = time;
|
||||||
}
|
}
|
||||||
|
|
||||||
public RechargeData(org.bukkit.entity.Player player, String name, ItemStack stack, long time)
|
public RechargeData(org.bukkit.entity.Player player, String name, ItemStack stack, long time, JavaPlugin plugin, long recharge)
|
||||||
{
|
{
|
||||||
Player = player;
|
Player = player;
|
||||||
Name = name;
|
Name = name;
|
||||||
Item = stack;
|
Item = stack;
|
||||||
Time = time;
|
Time = time;
|
||||||
|
Plugin = plugin;
|
||||||
|
Recharge = recharge;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean Update()
|
public boolean Update()
|
||||||
{
|
{
|
||||||
/*
|
|
||||||
if (Item != null && Name != null && Player != null)
|
if (Item != null && Name != null && Player != null)
|
||||||
{
|
{
|
||||||
|
if (System.currentTimeMillis() < Time)
|
||||||
|
{
|
||||||
|
if (Player.getItemInHand().getType() == Item.getType())
|
||||||
|
{
|
||||||
|
long time = Time - System.currentTimeMillis();
|
||||||
|
double percent = (double)(Recharge-time)/(double)Recharge;
|
||||||
|
|
||||||
|
UtilDisplay.displayTextBar(Plugin, Player, percent, C.cYellow + C.Bold + Name + ChatColor.RESET + " - " + C.cGreen + C.Bold + (int)(percent*100) + "%");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
UtilDisplay.displayTextBar(Plugin, Player, 1, C.cGreen + C.Bold + Name);
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
ItemMeta itemMeta = Item.getItemMeta();
|
ItemMeta itemMeta = Item.getItemMeta();
|
||||||
|
|
||||||
if (System.currentTimeMillis() < Time)
|
if (System.currentTimeMillis() < Time)
|
||||||
@ -49,8 +72,9 @@ public class RechargeData
|
|||||||
Item.removeEnchantment(Enchantment.DURABILITY);
|
Item.removeEnchantment(Enchantment.DURABILITY);
|
||||||
else
|
else
|
||||||
Item.addEnchantment(Enchantment.DURABILITY, 1);
|
Item.addEnchantment(Enchantment.DURABILITY, 1);
|
||||||
|
*/
|
||||||
}
|
}
|
||||||
*/
|
|
||||||
|
|
||||||
return System.currentTimeMillis() > Time;
|
return System.currentTimeMillis() > Time;
|
||||||
}
|
}
|
||||||
|
@ -314,7 +314,7 @@ public abstract class Skill implements ISkill, Listener
|
|||||||
public void DisplayProgress(Player player, String ability, float amount)
|
public void DisplayProgress(Player player, String ability, float amount)
|
||||||
{
|
{
|
||||||
player.setExp(amount);
|
player.setExp(amount);
|
||||||
UtilDisplay.displayTextBar(Factory.GetPlugin(), player, amount, C.cYellow + C.Bold + ability + ChatColor.RESET + " - " + C.cGreen + C.Bold + (int)(amount*100) + "%");
|
//UtilDisplay.displayTextBar(Factory.GetPlugin(), player, amount, C.cYellow + C.Bold + ability + ChatColor.RESET + " - " + C.cGreen + C.Bold + (int)(amount*100) + "%");
|
||||||
|
|
||||||
player.playSound(player.getLocation(), Sound.NOTE_PIANO, 0.5f, 0.5f + (amount * 1.5f));
|
player.playSound(player.getLocation(), Sound.NOTE_PIANO, 0.5f, 0.5f + (amount * 1.5f));
|
||||||
}
|
}
|
||||||
|
@ -64,7 +64,7 @@ public class Arcade extends JavaPlugin implements INautilusPlugin
|
|||||||
getConfig().addDefault(WEB_CONFIG, "http://accounts.mineplex.com/");
|
getConfig().addDefault(WEB_CONFIG, "http://accounts.mineplex.com/");
|
||||||
getConfig().set(WEB_CONFIG, getConfig().getString(WEB_CONFIG));
|
getConfig().set(WEB_CONFIG, getConfig().getString(WEB_CONFIG));
|
||||||
saveConfig();
|
saveConfig();
|
||||||
|
|
||||||
_clientManager = CoreClientManager.Initialize(this, GetWebServerAddress());
|
_clientManager = CoreClientManager.Initialize(this, GetWebServerAddress());
|
||||||
|
|
||||||
CommandCenter.Initialize(this, _clientManager);
|
CommandCenter.Initialize(this, _clientManager);
|
||||||
@ -74,7 +74,7 @@ public class Arcade extends JavaPlugin implements INautilusPlugin
|
|||||||
|
|
||||||
_donationManager = new DonationManager(this, GetWebServerAddress());
|
_donationManager = new DonationManager(this, GetWebServerAddress());
|
||||||
ConditionManager conditionManager = new ConditionManager(this);
|
ConditionManager conditionManager = new ConditionManager(this);
|
||||||
|
|
||||||
new MessageManager(this, _clientManager);
|
new MessageManager(this, _clientManager);
|
||||||
|
|
||||||
AntiStack antistack = new AntiStack(this);
|
AntiStack antistack = new AntiStack(this);
|
||||||
|
Loading…
Reference in New Issue
Block a user