forked from Minecraft/QoL
Added Karat Trophy command
parent
5c8265d468
commit
bc59a8cdfb
|
@ -97,6 +97,8 @@ public class QoL extends MavenPlugin {
|
|||
this.getCommand("worldinfo").setExecutor(worldInfoCommand);
|
||||
DeathMuteCommand deathMuteCommand = new DeathMuteCommand(this);
|
||||
this.getCommand("deathmute").setExecutor(deathMuteCommand);
|
||||
KaratTrophyCommand karatTrophyCommand = new KaratTrophyCommand(this);
|
||||
this.getCommand("karattrophy").setExecutor(karatTrophyCommand);
|
||||
|
||||
if (getConfig().getStringList("list").size() > 0) {
|
||||
ListCommand listCommand = new ListCommand(this);
|
||||
|
|
|
@ -0,0 +1,45 @@
|
|||
package xyz.etztech.qol.commands;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandExecutor;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.NamespacedKey;
|
||||
import xyz.etztech.qol.EtzTechUtil;
|
||||
import xyz.etztech.qol.Lang;
|
||||
import xyz.etztech.qol.QoL;
|
||||
|
||||
public class KaratTrophyCommand implements CommandExecutor {
|
||||
|
||||
QoL plugin;
|
||||
|
||||
public KaratTrophyCommand(QoL plugin) {
|
||||
this.plugin = plugin;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onCommand(CommandSender commandSender, Command command, String s, String args[]) {
|
||||
if (!commandSender.hasPermission("qol.karat_trophy")) {
|
||||
EtzTechUtil.sms(commandSender, Lang.NO_PERMISSION.getDef());
|
||||
return true;
|
||||
}
|
||||
|
||||
Player argPlayer = Bukkit.getPlayer(args[0]);
|
||||
|
||||
if (argPlayer == null) {
|
||||
EtzTechUtil.sms(commandSender, ChatColor.RED + "No player found.");
|
||||
return true;
|
||||
}
|
||||
|
||||
final Player player = argPlayer;
|
||||
EtzTechUtil.sms(commandSender, ChatColor.GREEN + "Awarding 24 Karat Trophy to " + player.getName());
|
||||
|
||||
NamespacedKey adv = new NamespacedKey("carrotcraft", "24_karat_trophy");
|
||||
|
||||
player.getAdvancementProgress(Bukkit.getAdvancement(adv)).awardCriteria("win");
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
|
@ -40,6 +40,8 @@ commands:
|
|||
description: Whitelist command
|
||||
timeout:
|
||||
description: Timeout command
|
||||
karatTrophy:
|
||||
description: karatTrophy
|
||||
permissions:
|
||||
qol.admin:
|
||||
description: Ability to reload the plugin
|
||||
|
@ -71,6 +73,9 @@ permissions:
|
|||
qol.deathmute:
|
||||
description: Ability to use the Death Mute command
|
||||
default: op
|
||||
qol.karatTrophy:
|
||||
description: to use the Karat Trophy Command
|
||||
default: op
|
||||
qol.auditable:
|
||||
description: Audits command usage
|
||||
default: op
|
||||
|
@ -97,3 +102,4 @@ permissions:
|
|||
children:
|
||||
qol.timeout.bypass: true
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue