From 000219a5ff183e469129e5804d0a6090d6b47b26 Mon Sep 17 00:00:00 2001 From: Tyler Murphy Date: Sun, 30 Jul 2023 18:12:47 -0400 Subject: 1.7.5 rc4 --- .../tylermurphy/hideAndSeek/command/Confirm.java | 62 ---------------------- 1 file changed, 62 deletions(-) delete mode 100644 src/main/java/net/tylermurphy/hideAndSeek/command/Confirm.java (limited to 'src/main/java/net/tylermurphy/hideAndSeek/command/Confirm.java') diff --git a/src/main/java/net/tylermurphy/hideAndSeek/command/Confirm.java b/src/main/java/net/tylermurphy/hideAndSeek/command/Confirm.java deleted file mode 100644 index a25185d..0000000 --- a/src/main/java/net/tylermurphy/hideAndSeek/command/Confirm.java +++ /dev/null @@ -1,62 +0,0 @@ -package net.tylermurphy.hideAndSeek.command; - -import net.tylermurphy.hideAndSeek.command.util.ICommand; -import org.bukkit.entity.Player; -import org.jetbrains.annotations.NotNull; - -import java.util.*; -import java.util.function.Consumer; - -import static net.tylermurphy.hideAndSeek.configuration.Config.errorPrefix; -import static net.tylermurphy.hideAndSeek.configuration.Localization.message; - -public class Confirm implements ICommand { - - public static final Map confirmations = new HashMap<>(); - - public void execute(Player sender, String[] args) { - Confirmation confirmation = confirmations.get(sender.getUniqueId()); - confirmations.remove(sender.getUniqueId()); - if(confirmation == null) { - sender.sendMessage(errorPrefix + message("NO_CONFIRMATION")); - } else { - long now = System.currentTimeMillis(); - float secs = (now - confirmation.start) / 1000F; - if(secs > 10) { - sender.sendMessage(errorPrefix + message("CONFIRMATION_TIMED_OUT")); - return; - } - confirmation.callback.accept(confirmation.data); - } - } - - public String getLabel() { - return "confirm"; - } - - public String getUsage() { - return ""; - } - - public String getDescription() { - return "Confirm another command if required"; - } - - public List autoComplete(@NotNull String parameter, @NotNull String typed) { - return null; - } - - public static class Confirmation { - public final Consumer callback; - public final String data; - public final long start; - - public Confirmation(String data, Consumer callback) { - this.callback = callback; - this.data = data; - this.start = System.currentTimeMillis(); - } - - } - -} -- cgit v1.2.3-freya