mirror of
https://github.com/EssentialsX/Essentials.git
synced 2024-12-23 01:27:40 +01:00
Allow commands in kits. Adds #15.
Syntax is /<command> with the ability to add {player} as an argument.
This commit is contained in:
parent
c22978c3f9
commit
555f151692
@ -9,6 +9,7 @@ import com.earth2me.essentials.textreader.SimpleTextInput;
|
||||
import com.earth2me.essentials.utils.DateUtil;
|
||||
import com.earth2me.essentials.utils.NumberUtil;
|
||||
import net.ess3.api.IEssentials;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.configuration.ConfigurationSection;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
@ -131,7 +132,7 @@ public class Kit {
|
||||
delayTime.add(Calendar.MILLISECOND, (int) ((delay * 1000.0) % 1000.0));
|
||||
|
||||
if (lastTime == 0L || lastTime > time.getTimeInMillis()) {
|
||||
// If we have no record of kit use, or its corrupted, give them benifit of the doubt.
|
||||
// If we have no record of kit use, or its corrupted, give them benefit of the doubt.
|
||||
return 0L;
|
||||
} else if (delay < 0d) {
|
||||
// If the kit has a negative kit time, it can only be used once.
|
||||
@ -188,6 +189,14 @@ public class Kit {
|
||||
continue;
|
||||
}
|
||||
|
||||
if(kitItem.startsWith("/")) {
|
||||
String command = kitItem.substring(1);
|
||||
String name = user.getName();
|
||||
command = command.replace("{player}", name);
|
||||
Bukkit.dispatchCommand(Bukkit.getConsoleSender(), command);
|
||||
continue;
|
||||
}
|
||||
|
||||
final String[] parts = kitItem.split(" +");
|
||||
final ItemStack parseStack = ess.getItemDb().get(parts[0], parts.length > 1 ? Integer.parseInt(parts[1]) : 1);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user