mirror of
https://github.com/GeorgH93/Minepacks.git
synced 2025-01-23 21:51:31 +01:00
Update to V1.8
Add cooldown bypass permission Change cooldown time from milliseconds to seconds Cooldown now only effects the open command
This commit is contained in:
parent
9961301937
commit
93532290ea
2
pom.xml
2
pom.xml
@ -2,7 +2,7 @@
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>at.pcgamingfreaks</groupId>
|
||||
<artifactId>MinePacks</artifactId>
|
||||
<version>1.7.3</version>
|
||||
<version>1.8</version>
|
||||
<repositories>
|
||||
<repository>
|
||||
<id>in-project</id>
|
||||
|
@ -20,6 +20,7 @@ permissions:
|
||||
backpack.KeepOnDeath: true
|
||||
backpack.clean: true
|
||||
backpack.clean.other: true
|
||||
backpack.noCooldown: true
|
||||
backpack.use:
|
||||
description: Allows a player to open the backpack.
|
||||
children:
|
||||
@ -63,4 +64,7 @@ permissions:
|
||||
backpack.others: true
|
||||
backpack.KeepOnDeath:
|
||||
description: Allows the player to keep their items in their backpack on death.
|
||||
defautl: op
|
||||
default: op
|
||||
backpack.noCooldown:
|
||||
description: Allows to bypass the cooldown to open the backpack.
|
||||
default: op
|
@ -236,6 +236,6 @@ public boolean getAutoUpdate()
|
||||
|
||||
public int getCommandCooldown()
|
||||
{
|
||||
return config.getInt("command_cooldown", -1);
|
||||
return config.getInt("command_cooldown", -1) * 1000;
|
||||
}
|
||||
}
|
@ -62,23 +62,23 @@ public boolean onCommand(CommandSender sender, Command cmd, String arg, String[]
|
||||
sender.sendMessage(Message_NotFromConsole);
|
||||
return true;
|
||||
}
|
||||
if(cooldown > 0)
|
||||
{
|
||||
if(plugin.cooldowns.containsKey(player))
|
||||
{
|
||||
if(((new Date()).getTime() - plugin.cooldowns.get(player).longValue()) < cooldown)
|
||||
{
|
||||
sender.sendMessage(Message_Cooldown);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
plugin.cooldowns.put(player, new Long((new Date()).getTime()));
|
||||
}
|
||||
if(args.length == 0)
|
||||
{
|
||||
// Open player backpack
|
||||
if(player.hasPermission("backpack"))
|
||||
{
|
||||
if(cooldown > 0 && !player.hasPermission("backpack.noCooldown"))
|
||||
{
|
||||
if(plugin.cooldowns.containsKey(player))
|
||||
{
|
||||
if(((new Date()).getTime() - plugin.cooldowns.get(player).longValue()) < cooldown)
|
||||
{
|
||||
sender.sendMessage(Message_Cooldown);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
plugin.cooldowns.put(player, new Long((new Date()).getTime()));
|
||||
}
|
||||
Backpack bp = plugin.DB.getBackpack(player, false);
|
||||
if(bp == null)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user