Fixed typos
This commit is contained in:
parent
d74df6404a
commit
9f3bb214f7
2 changed files with 39 additions and 5 deletions
|
@ -20,6 +20,7 @@ public class MCTPAudioCmd implements CommandExecutor {
|
|||
public boolean onCommand(CommandSender sender, Command cmd, String commandlabel, String[] args) {
|
||||
if (cmd.getName().equalsIgnoreCase("mctpaudio")) {
|
||||
// /mctpaudio play SELECTOR TYPE URL
|
||||
// /mctpaudio stop SELECTOR TYPE
|
||||
if (args.length == 4 && args[0].equalsIgnoreCase("play")) {
|
||||
AudioType type;
|
||||
try {
|
||||
|
@ -49,7 +50,7 @@ public class MCTPAudioCmd implements CommandExecutor {
|
|||
|
||||
if (!PinManager.hasPin(p.getUniqueId())) continue;
|
||||
|
||||
data.put("action", type.name());
|
||||
data.put("task", type.name());
|
||||
data.put("path", args[3]);
|
||||
data.put("uuid", p.getUniqueId().toString().replace("-", ""));
|
||||
Main.getClient().sendData(data);
|
||||
|
@ -57,6 +58,43 @@ public class MCTPAudioCmd implements CommandExecutor {
|
|||
|
||||
sender.sendMessage(prefix + "Gestart met afspelen!");
|
||||
return true;
|
||||
} else if (args.length == 3 && args[0].equalsIgnoreCase("stop")) {
|
||||
AudioType type;
|
||||
try {
|
||||
type = AudioType.valueOf(args[2].toUpperCase());
|
||||
} catch (IllegalArgumentException ex) {
|
||||
sender.sendMessage(prefix + args[1] + " is geen correcte type.");
|
||||
return true;
|
||||
}
|
||||
|
||||
ArrayList<Player> players = new ArrayList<>();
|
||||
Player target = Bukkit.getPlayer(args[1]);
|
||||
if (target != null) {
|
||||
if (!PinManager.hasPin(target.getUniqueId())) {
|
||||
sender.sendMessage(prefix + "Die speler is niet verbonden met de client.");
|
||||
return true;
|
||||
}
|
||||
|
||||
players.add(target);
|
||||
} else {
|
||||
SpigotPlayerSelector selector = new SpigotPlayerSelector(args[1]);
|
||||
players.addAll(selector.getPlayers(sender));
|
||||
}
|
||||
|
||||
JSONObject data;
|
||||
for (Player p : players) {
|
||||
data = new JSONObject();
|
||||
|
||||
if (!PinManager.hasPin(p.getUniqueId())) continue;
|
||||
|
||||
data.put("task", "STOP");
|
||||
data.put("type", type.name());
|
||||
data.put("uuid", p.getUniqueId().toString().replace("-", ""));
|
||||
Main.getClient().sendData(data);
|
||||
}
|
||||
|
||||
sender.sendMessage(prefix + "Gestopt met afspelen!");
|
||||
return true;
|
||||
}
|
||||
} else if (cmd.getName().equalsIgnoreCase("audio")) {
|
||||
if (!(sender instanceof Player)) {
|
||||
|
|
|
@ -1,7 +1,5 @@
|
|||
package me.mctp.managers;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
|
||||
import java.security.SecureRandom;
|
||||
import java.util.UUID;
|
||||
import java.util.WeakHashMap;
|
||||
|
@ -58,8 +56,6 @@ public class PinManager {
|
|||
return false;
|
||||
}
|
||||
|
||||
Bukkit.getLogger().info("PIN IN DATA: " + pins.get(pUUID) + " || But got: " + pin);
|
||||
|
||||
return pins.containsKey(pUUID) && pin.equals(pins.get(pUUID));
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue