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:
GeorgH93 2015-05-13 19:05:46 +02:00
parent 9961301937
commit 93532290ea
4 changed files with 19 additions and 15 deletions

View File

@ -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>

View File

@ -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

View File

@ -236,6 +236,6 @@ public boolean getAutoUpdate()
public int getCommandCooldown()
{
return config.getInt("command_cooldown", -1);
return config.getInt("command_cooldown", -1) * 1000;
}
}

View File

@ -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)
{