forget add to index

This commit is contained in:
Boosik 2015-01-06 11:34:19 +01:00
parent ff5075b0e4
commit acd7c706ff
3 changed files with 177 additions and 0 deletions

View File

@ -0,0 +1,51 @@
package cz.boosik.boosCooldown;
import java.util.Set;
import org.bukkit.entity.Player;
public class BoosAliasManager {
public static String checkCommandAlias(String originalCommand,
Set<String> aliases, Player player) {
String[] splitCommand = originalCommand.split(" ", 4);
String one = "";
String two = "";
String three = "";
if (splitCommand.length > 1) {
one = splitCommand[1];
if (splitCommand.length > 2) {
two = splitCommand[2];
if (splitCommand.length > 3) {
three = splitCommand[3];
}
}
}
for (String alias : aliases) {
String alias2 = alias.replace("*", ".+");
if (originalCommand.matches("(?i)" + alias2)) {
originalCommand = BoosConfigManager.getAlias(alias);
if (originalCommand.contains("$1")) {
originalCommand = originalCommand.replace("$1", one);
}
if (originalCommand.contains("$2")) {
originalCommand = originalCommand.replace("$2", two);
}
if (originalCommand.contains("$*")) {
originalCommand = originalCommand.replace("$*", three);
}
if (originalCommand.contains("$player")) {
originalCommand = originalCommand.replace("$player",
player.getName());
}
if (originalCommand.contains("$world")) {
originalCommand = originalCommand.replace("$world", player
.getWorld().getName());
}
}
}
originalCommand = originalCommand.trim().replaceAll(" +", " ");
return originalCommand;
}
}

View File

@ -0,0 +1,26 @@
package cz.boosik.boosCooldown;
import org.bukkit.Bukkit;
public class BoosGlobalLimitResetRunnable implements Runnable {
private String command;
public BoosGlobalLimitResetRunnable(String key) {
this.command = key;
}
@Override
public void run() {
BoosCoolDown.getLog().info(
"[boosCooldowns] Reseting limits for command " + command);
BoosLimitManager.clearAllLimits(command.hashCode());
BoosLimitManager.setGlobalLimitResetDate(command);
String msg = BoosConfigManager.getLimitResetNowMessage();
msg = msg.replaceAll("&command&", command);
msg = msg.replaceAll("&", "§");
Bukkit.broadcastMessage(msg);
BoosCoolDown.startLimitResetTimerGlobal(command);
}
}

View File

@ -0,0 +1,100 @@
options:
options:
warmups_enabled: true
cooldowns_enabled: true
prices_enabled: true
item_cost_enabled: true
xp_cost_enabled: true
limits_enabled: true
auto_save_enabled_CAN_CAUSE_BIG_LAGS: false
save_interval_in_minutes: 15
cancel_warmup_on_damage: false
cancel_warmup_on_move: false
cancel_warmup_on_sneak: false
cancel_warmup_on_sprint: false
cancel_warmup_on_gamemode_change: false
block_interact_during_warmup: false
clear_on_restart: false
clear_uses_on_death: false
clear_cooldowns_on_death: false
start_cooldowns_on_death: false
command_logging: false
command_signs: false
units:
seconds: seconds
minutes: minutes
hours: hours
messages:
warmup_cancelled_by_damage: '&6Warm-ups have been cancelled due to receiving damage.&f'
warmup_cancelled_by_move: '&6Warm-ups have been cancelled due to moving.&f'
warmup_cancelled_by_sprint: '&6Warm-ups have been cancelled due to sprinting.&f'
warmup_cancelled_by_sneak: '&6Warm-ups have been cancelled due to sneaking.&f'
warmup_cancelled_by_gamemode_change: '&6Warm-ups have been cancelled due to changing
gamemode.&f'
cooling_down: '&6Wait&e &seconds& &unit&&6 before you can use command&e &command&
&6again.&f'
warming_up: '&6Wait&e &seconds& &unit&&6 before command&e &command& &6has warmed
up.&f'
warmup_already_started: '&6Warm-Up process for&e &command& &6has already started.&f'
paid_error: '&6An error has occured:&e %s'
insufficient_funds: '&6You have insufficient funds!&e &command& &6costs &e%s &6but
you only have &e%s'
paid_for_command: '&6Price of&e &command& &6was&e %s &6and you now have&e %s'
paid_items_for_command: '&6Price of&e &command& &6was &e%s'
paid_xp_for_command: '&6Price of&e &command& &6was &e%s levels'
insufficient_items: '&6You have not enough items!&e &command& &6needs &e%s'
insufficient_xp: '&6You have not enough XP!&e &command& &6needs &e%s'
limit_achieved: '&6You cannot use this command anymore!&f'
limit_reset: '&6Wait&e &seconds& &unit&&6 before your limit for command&e &command&
&6is reset.&f'
limit_reset_now: '&6Reseting limits for command&e &command& &6now!&f'
limit_list: '&6Limit for command &e&command&&6 is &e&limit&&6. You can still use
it &e&times&&6 times.&f'
interact_blocked_during_warmup: '&6You can''t do this when command is warming-up!&f'
cannot_create_sign: '&6You are not allowed to create this kind of signs!&f'
cannot_use_sign: '&6You are not allowed to use this sign!&f'
invalid_command_syntax: '&6You are not allowed to use command syntax /<pluginname>:<command>!'
commands:
groups:
default:
/command parameter:
cooldown: 2 hours
/commandwithparameters *:
cooldown: 5 seconds
/anothercommand:
cooldown: 2 minute
/yetanothercommand:
warmup: 5
price: 10.0
limit: 5
potion: WEAKNESS,3
/test:
message: You just used /test!
limit: 1
/shared_example:
cooldown: 6 hours
shared_cooldown:
- /this_commands_cooldown_will_also_be_started
- /another_one
/this_commands_cooldown_will_also_be_started:
cooldown: 1 week
/another_one:
cooldown: 1 month
/per_time_interval_limit:
limit: 1
limit_reset_delay: 120
/original *:
cooldown: 5
warmup: 1
limit: 10
vip:
/command *:
warmup: 5
aliases:
/newcommand: /originalcommand
/ja *: /me $1 $2 $* $world $player
global:
/test:
limit_reset_delay: 1 hour
/original *:
limit_reset_delay: 360 minutes