forked from Minecraft/QoL
Merge branch 'master' of ZeroHD/QoL into master
commit
04450fc3c8
|
@ -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,50 @@
|
|||
package xyz.etztech.qol.commands;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.advancement.Advancement;
|
||||
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.karattrophy")) {
|
||||
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;
|
||||
|
||||
Advancement adv = Bukkit.getAdvancement(new NamespacedKey("carrotcraft", "24_karat_trophy"));
|
||||
|
||||
if (!player.getAdvancementProgress(adv).isDone()) {
|
||||
EtzTechUtil.sms(commandSender, ChatColor.GREEN + "Awarding 24 Karat Trophy to " + player.getName());
|
||||
player.getAdvancementProgress(adv).awardCriteria("win");
|
||||
} else {
|
||||
EtzTechUtil.sms(commandSender, ChatColor.RED + player.getName() + " already has the 24 Karat Trophy");
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
|
@ -40,6 +40,9 @@ commands:
|
|||
description: Whitelist command
|
||||
timeout:
|
||||
description: Timeout command
|
||||
karattrophy:
|
||||
description: 24 karat trophy command
|
||||
aliases: [trophy]
|
||||
permissions:
|
||||
qol.admin:
|
||||
description: Ability to reload the plugin
|
||||
|
@ -71,6 +74,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 +103,4 @@ permissions:
|
|||
children:
|
||||
qol.timeout.bypass: true
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue