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);
|
this.getCommand("worldinfo").setExecutor(worldInfoCommand);
|
||||||
DeathMuteCommand deathMuteCommand = new DeathMuteCommand(this);
|
DeathMuteCommand deathMuteCommand = new DeathMuteCommand(this);
|
||||||
this.getCommand("deathmute").setExecutor(deathMuteCommand);
|
this.getCommand("deathmute").setExecutor(deathMuteCommand);
|
||||||
|
KaratTrophyCommand karatTrophyCommand = new KaratTrophyCommand(this);
|
||||||
|
this.getCommand("karattrophy").setExecutor(karatTrophyCommand);
|
||||||
|
|
||||||
if (getConfig().getStringList("list").size() > 0) {
|
if (getConfig().getStringList("list").size() > 0) {
|
||||||
ListCommand listCommand = new ListCommand(this);
|
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
|
description: Whitelist command
|
||||||
timeout:
|
timeout:
|
||||||
description: Timeout command
|
description: Timeout command
|
||||||
|
karattrophy:
|
||||||
|
description: 24 karat trophy command
|
||||||
|
aliases: [trophy]
|
||||||
permissions:
|
permissions:
|
||||||
qol.admin:
|
qol.admin:
|
||||||
description: Ability to reload the plugin
|
description: Ability to reload the plugin
|
||||||
|
@ -71,6 +74,9 @@ permissions:
|
||||||
qol.deathmute:
|
qol.deathmute:
|
||||||
description: Ability to use the Death Mute command
|
description: Ability to use the Death Mute command
|
||||||
default: op
|
default: op
|
||||||
|
qol.karattrophy:
|
||||||
|
description: to use the Karat Trophy Command
|
||||||
|
default: op
|
||||||
qol.auditable:
|
qol.auditable:
|
||||||
description: Audits command usage
|
description: Audits command usage
|
||||||
default: op
|
default: op
|
||||||
|
@ -97,3 +103,4 @@ permissions:
|
||||||
children:
|
children:
|
||||||
qol.timeout.bypass: true
|
qol.timeout.bypass: true
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue