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) {
|
public boolean onCommand(CommandSender sender, Command cmd, String commandlabel, String[] args) {
|
||||||
if (cmd.getName().equalsIgnoreCase("mctpaudio")) {
|
if (cmd.getName().equalsIgnoreCase("mctpaudio")) {
|
||||||
// /mctpaudio play SELECTOR TYPE URL
|
// /mctpaudio play SELECTOR TYPE URL
|
||||||
|
// /mctpaudio stop SELECTOR TYPE
|
||||||
if (args.length == 4 && args[0].equalsIgnoreCase("play")) {
|
if (args.length == 4 && args[0].equalsIgnoreCase("play")) {
|
||||||
AudioType type;
|
AudioType type;
|
||||||
try {
|
try {
|
||||||
|
@ -49,7 +50,7 @@ public class MCTPAudioCmd implements CommandExecutor {
|
||||||
|
|
||||||
if (!PinManager.hasPin(p.getUniqueId())) continue;
|
if (!PinManager.hasPin(p.getUniqueId())) continue;
|
||||||
|
|
||||||
data.put("action", type.name());
|
data.put("task", type.name());
|
||||||
data.put("path", args[3]);
|
data.put("path", args[3]);
|
||||||
data.put("uuid", p.getUniqueId().toString().replace("-", ""));
|
data.put("uuid", p.getUniqueId().toString().replace("-", ""));
|
||||||
Main.getClient().sendData(data);
|
Main.getClient().sendData(data);
|
||||||
|
@ -57,6 +58,43 @@ public class MCTPAudioCmd implements CommandExecutor {
|
||||||
|
|
||||||
sender.sendMessage(prefix + "Gestart met afspelen!");
|
sender.sendMessage(prefix + "Gestart met afspelen!");
|
||||||
return true;
|
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")) {
|
} else if (cmd.getName().equalsIgnoreCase("audio")) {
|
||||||
if (!(sender instanceof Player)) {
|
if (!(sender instanceof Player)) {
|
||||||
|
|
|
@ -1,7 +1,5 @@
|
||||||
package me.mctp.managers;
|
package me.mctp.managers;
|
||||||
|
|
||||||
import org.bukkit.Bukkit;
|
|
||||||
|
|
||||||
import java.security.SecureRandom;
|
import java.security.SecureRandom;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
import java.util.WeakHashMap;
|
import java.util.WeakHashMap;
|
||||||
|
@ -58,8 +56,6 @@ public class PinManager {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
Bukkit.getLogger().info("PIN IN DATA: " + pins.get(pUUID) + " || But got: " + pin);
|
|
||||||
|
|
||||||
return pins.containsKey(pUUID) && pin.equals(pins.get(pUUID));
|
return pins.containsKey(pUUID) && pin.equals(pins.get(pUUID));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue