A lot of fixes
This commit is contained in:
parent
03eca44be5
commit
73626afe80
8 changed files with 57 additions and 18 deletions
3
src/META-INF/MANIFEST.MF
Normal file
3
src/META-INF/MANIFEST.MF
Normal file
|
@ -0,0 +1,3 @@
|
|||
Manifest-Version: 1.0
|
||||
Main-Class: me.mctp.Main
|
||||
|
|
@ -1,9 +1,11 @@
|
|||
package me.mctp;
|
||||
|
||||
import me.mctp.managers.PinManager;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandExecutor;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
public class MCTPAudioCmd implements CommandExecutor {
|
||||
|
||||
|
@ -13,7 +15,19 @@ public class MCTPAudioCmd implements CommandExecutor {
|
|||
if (cmd.getName().equalsIgnoreCase("mctpaudio")) {
|
||||
sender.sendMessage(prefix + "MCTP Audio command!");
|
||||
} else if (cmd.getName().equalsIgnoreCase("audio")) {
|
||||
sender.sendMessage(prefix + "MCTP Audio connect command!");
|
||||
if (!(sender instanceof Player)) {
|
||||
sender.sendMessage(prefix + "Alleen spelers kunnen verbinden met onze audioclient.");
|
||||
return true;
|
||||
}
|
||||
|
||||
Player p = (Player) sender;
|
||||
String pin = PinManager.getPIN(p.getUniqueId());
|
||||
|
||||
String url = "http://localhost/audio/index";
|
||||
url = url + "?uuid=" + p.getUniqueId().toString().replace("-", "") + "&pin=" + pin;
|
||||
|
||||
sender.sendMessage(prefix + "Gebruik: " + url);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -21,20 +21,23 @@ public class Main extends JavaPlugin implements Listener {
|
|||
|
||||
pl = this;
|
||||
|
||||
client = new Client("SOCKET URL");
|
||||
client = new Client("ws://144.91.100.169:30217");
|
||||
client.connect();
|
||||
|
||||
getCommand("audio").setExecutor(new MCTPAudioCmd());
|
||||
getCommand("mctpaudio").setExecutor(new MCTPAudioCmd());
|
||||
|
||||
Bukkit.getLogger().info(prefix + " __ __ ____ _____ ____ _ _ _ ");
|
||||
Bukkit.getLogger().info(prefix + "| \\/ |/ ___|_ _| _ \\ / \\ _ _ __| (_) ___ ");
|
||||
Bukkit.getLogger().info(prefix + "| |\\/| | | | | | |_) | / _ \\| | | |/ _` | |/ _ \\ ");
|
||||
Bukkit.getLogger().info(prefix + "| | | | |___ | | | __/ / ___ \\ |_| | (_| | | (_) |");
|
||||
Bukkit.getLogger().info(prefix + "|_| |_|\\____| |_| |_| /_/ \\_\\__,_|\\__,_|_|\\___/ ");
|
||||
Bukkit.getLogger().info(prefix + " __ __ ____ _____ ____ _ _ _ ");
|
||||
Bukkit.getLogger().info(prefix + " | \\/ |/ ___|_ _| _ \\ / \\ _ _ __| (_) ___ ");
|
||||
Bukkit.getLogger().info(prefix + " | |\\/| | | | | | |_) / _ \\| | | |/ _` | |/ _ \\ ");
|
||||
Bukkit.getLogger().info(prefix + " | | | | |___ | | | __/ ___ \\ |_| | (_| | | (_) |");
|
||||
Bukkit.getLogger().info(prefix + " |_| |_|\\____| |_| |_| /_/ \\_\\__,_|\\__,_|_|\\___/ ");
|
||||
Bukkit.getLogger().info(prefix + " ");
|
||||
Bukkit.getLogger().info(prefix + "successfully enabled!");
|
||||
}
|
||||
|
||||
public void onDisable(){
|
||||
public void onDisable() {
|
||||
client.disconnect();
|
||||
Bukkit.getLogger().info(prefix + "successfully disabled!");
|
||||
}
|
||||
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
package me.mctp.managers;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
|
||||
import java.security.SecureRandom;
|
||||
import java.util.UUID;
|
||||
import java.util.WeakHashMap;
|
||||
|
@ -56,6 +58,8 @@ 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));
|
||||
}
|
||||
|
||||
|
|
|
@ -65,18 +65,15 @@ public class Client {
|
|||
if (pin == null || pin.isEmpty()) return;
|
||||
|
||||
UUID pUUID = UUID.fromString(JSONUtil.fixUUID(uuid));
|
||||
boolean verified = true;
|
||||
Player player = Bukkit.getPlayer(uuid);
|
||||
if (player == null || !player.isOnline()) {
|
||||
verified = false;
|
||||
boolean verified = false;
|
||||
if (Bukkit.getPlayer(pUUID) != null) {
|
||||
verified = PinManager.checkPin(pUUID, pin);
|
||||
}
|
||||
|
||||
if (!PinManager.checkPin(pUUID, pin)) {
|
||||
verified = false;
|
||||
}
|
||||
Bukkit.getLogger().info("VERIFIED IS: " + verified);
|
||||
|
||||
JSONObject reply = new JSONObject();
|
||||
reply.put("action", "AUTHENTICATION");
|
||||
reply.put("task", "AUTHENTICATION");
|
||||
reply.put("verified", verified);
|
||||
reply.put("uuid", uuid);
|
||||
this.send(reply.toJSONString());
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue