Added a check to see if the target already had the 24 Karrat Trophy
parent
d59f8186da
commit
a08100a101
|
@ -2,6 +2,7 @@ package xyz.etztech.qol.commands;
|
||||||
|
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.ChatColor;
|
import org.bukkit.ChatColor;
|
||||||
|
import org.bukkit.advancement.Advancement;
|
||||||
import org.bukkit.command.Command;
|
import org.bukkit.command.Command;
|
||||||
import org.bukkit.command.CommandExecutor;
|
import org.bukkit.command.CommandExecutor;
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
|
@ -34,11 +35,15 @@ public class KaratTrophyCommand implements CommandExecutor {
|
||||||
}
|
}
|
||||||
|
|
||||||
final Player player = argPlayer;
|
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());
|
EtzTechUtil.sms(commandSender, ChatColor.GREEN + "Awarding 24 Karat Trophy to " + player.getName());
|
||||||
|
player.getAdvancementProgress(adv).awardCriteria("win");
|
||||||
NamespacedKey adv = new NamespacedKey("carrotcraft", "24_karat_trophy");
|
} else {
|
||||||
|
EtzTechUtil.sms(commandSender, ChatColor.RED + player.getName() + " already has the 24 Karat Trophy");
|
||||||
player.getAdvancementProgress(Bukkit.getAdvancement(adv)).awardCriteria("win");
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue