mirror of
https://gitlab.com/phoenix-dvpmt/mmoitems.git
synced 2024-12-22 04:37:42 +01:00
Added a silent argument to the /mi give
command.
This is an example of how to use it `/mi give ACCESSORY BOOK_OF_STAMPS MonzterSlayer 1 0 100 0 silent` You need to specify the unidentify-chance, drop-chance, and soulbound-chance, to then add silent. If you use "s" or "silent" where I did, the message of "You received ITEM NAME" will not be sent to the Player. This does not affect any previous usages of the command, but if you want to use it, just add the "silent" argument!
This commit is contained in:
parent
16c1aada3e
commit
20d7b809b8
@ -38,6 +38,7 @@ public class GiveCommandTreeNode extends CommandTreeNode {
|
||||
addParameter(new Parameter("(unidentify-chance)", (explore, list) -> list.add("(unidentify-chance)")));
|
||||
addParameter(new Parameter("(drop-chance)", (explore, list) -> list.add("(drop-chance)")));
|
||||
addParameter(new Parameter("(soulbound-chance)", (explore, list) -> list.add("(soulbound-chance)")));
|
||||
addParameter(new Parameter("(silent)", (explore, list) -> list.addAll(Arrays.asList("silent", "s"))));
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -59,6 +60,7 @@ public class GiveCommandTreeNode extends CommandTreeNode {
|
||||
double unidentify = args.length > 5 ? Double.parseDouble(args[5]) / 100 : 0;
|
||||
double drop = args.length > 6 ? Double.parseDouble(args[6]) / 100 : 1;
|
||||
double soulbound = args.length > 7 ? Double.parseDouble(args[7]) / 100 : 0;
|
||||
boolean silent = args.length > 8 ? args[8].equalsIgnoreCase("silent") || args[8].equalsIgnoreCase("s") : false;
|
||||
|
||||
// roll drop chance
|
||||
if (random.nextDouble() > drop)
|
||||
@ -81,12 +83,13 @@ public class GiveCommandTreeNode extends CommandTreeNode {
|
||||
item.setAmount(amount.getRandomAmount());
|
||||
|
||||
// message
|
||||
if (!sender.equals(target))
|
||||
sender.sendMessage(MMOItems.plugin.getPrefix() + ChatColor.YELLOW + "Successfully gave " + ChatColor.GOLD
|
||||
+ MMOUtils.getDisplayName(item) + (item.getAmount() > 1 ? " x" + item.getAmount() : "") + ChatColor.YELLOW + " to "
|
||||
+ ChatColor.GOLD + target.getName() + ChatColor.YELLOW + ".");
|
||||
Message.RECEIVED_ITEM.format(ChatColor.YELLOW, "#item#", MMOUtils.getDisplayName(item), "#amount#",
|
||||
(item.getAmount() > 1 ? " x" + item.getAmount() : "")).send(target);
|
||||
if (!sender.equals(target))
|
||||
sender.sendMessage(MMOItems.plugin.getPrefix() + ChatColor.YELLOW + "Successfully gave " + ChatColor.GOLD
|
||||
+ MMOUtils.getDisplayName(item) + (item.getAmount() > 1 ? " x" + item.getAmount() : "") + ChatColor.YELLOW + " to "
|
||||
+ ChatColor.GOLD + target.getName() + ChatColor.YELLOW + ".");
|
||||
if (!silent)
|
||||
Message.RECEIVED_ITEM.format(ChatColor.YELLOW, "#item#", MMOUtils.getDisplayName(item), "#amount#",
|
||||
(item.getAmount() > 1 ? " x" + item.getAmount() : "")).send(target);
|
||||
|
||||
// item
|
||||
new SmartGive(target).give(item);
|
||||
|
Loading…
Reference in New Issue
Block a user