mirror of
https://github.com/TotalFreedomMC/TF-EssentialsX.git
synced 2025-02-12 20:29:20 +00:00
![Ali Moghnieh](/assets/img/avatar_default.png)
This commit adds a new `/payconfirmtoggle` command with `/payconfirmon` and `/payconfirmoff` as well.
32 lines
990 B
Java
32 lines
990 B
Java
package com.earth2me.essentials.commands;
|
|
|
|
import static com.earth2me.essentials.I18n.tl;
|
|
|
|
import com.earth2me.essentials.User;
|
|
|
|
import org.bukkit.Server;
|
|
|
|
public class Commandpayconfirmtoggle extends EssentialsCommand {
|
|
|
|
public Commandpayconfirmtoggle() {
|
|
super("payconfirmtoggle");
|
|
}
|
|
|
|
@Override
|
|
public void run(Server server, User user, String commandLabel, String[] args) throws Exception {
|
|
boolean confirmingPay = !user.isPromptingPayConfirm();
|
|
if (commandLabel.contains("payconfirmon")) {
|
|
confirmingPay = true;
|
|
} else if (commandLabel.contains("payconfirmoff")) {
|
|
confirmingPay = false;
|
|
}
|
|
user.setPromptingPayConfirm(confirmingPay);
|
|
if (confirmingPay) {
|
|
user.sendMessage(tl("payConfirmToggleOn"));
|
|
} else {
|
|
user.sendMessage(tl("payConfirmToggleOff"));
|
|
}
|
|
user.getConfirmingPayments().clear(); // Clear any outstanding confirmations.
|
|
}
|
|
}
|
|
|