Updated the server plugin
This commit is contained in:
0
DiscordVerifier/.DS_Store
vendored
Normal file → Executable file
0
DiscordVerifier/.DS_Store
vendored
Normal file → Executable file
0
DiscordVerifier/DiscordVerifier.iml
Normal file → Executable file
0
DiscordVerifier/DiscordVerifier.iml
Normal file → Executable file
56
DiscordVerifier/src/Main.java
Normal file → Executable file
56
DiscordVerifier/src/Main.java
Normal file → Executable file
@@ -1,3 +1,4 @@
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.plugin.PluginManager;
|
||||
import org.bukkit.plugin.java.JavaPlugin;
|
||||
|
||||
@@ -11,27 +12,42 @@ public class Main extends JavaPlugin {
|
||||
getLogger().info("DiscordVerifier Plugin enabled");
|
||||
PluginManager pm = getServer().getPluginManager();
|
||||
|
||||
try{
|
||||
ServerSocket ss = new ServerSocket(3333);
|
||||
while (true) {
|
||||
Socket s = ss.accept();
|
||||
PrintWriter out =
|
||||
new PrintWriter(s.getOutputStream(), true);
|
||||
BufferedReader in = new BufferedReader(
|
||||
new InputStreamReader(s.getInputStream()));
|
||||
String inputLine, outputLine;
|
||||
inputLine = in.readLine();
|
||||
if (inputLine != null) {
|
||||
outputLine = "test succeeded";
|
||||
out.println(outputLine);
|
||||
System.out.println("message: " + inputLine);
|
||||
}
|
||||
}
|
||||
start_socketserver();
|
||||
|
||||
} catch (Exception e) {
|
||||
System.out.println("error man");
|
||||
System.out.println(e);
|
||||
}
|
||||
}
|
||||
|
||||
public void start_socketserver() {
|
||||
new Thread(() -> {
|
||||
try{
|
||||
ServerSocket ss = new ServerSocket(3333);
|
||||
while (true) {
|
||||
Socket s = ss.accept();
|
||||
PrintWriter out =
|
||||
new PrintWriter(s.getOutputStream(), true);
|
||||
BufferedReader in = new BufferedReader(
|
||||
new InputStreamReader(s.getInputStream()));
|
||||
String inputLine, outputLine;
|
||||
inputLine = in.readLine();
|
||||
if (inputLine != null) {
|
||||
outputLine = "test succeeded";
|
||||
out.println(outputLine);
|
||||
System.out.println("message: " + inputLine);
|
||||
String[] info = inputLine.split("\t");
|
||||
Player player = getServer().getPlayer(info[0]);
|
||||
String code = info[1];
|
||||
|
||||
send_chat(player, code);
|
||||
}
|
||||
}
|
||||
|
||||
} catch (Exception e) {
|
||||
System.out.println(e);
|
||||
}
|
||||
}).start();
|
||||
}
|
||||
|
||||
public void send_chat(Player player, String code){
|
||||
player.sendMessage(code);
|
||||
}
|
||||
|
||||
public void onDisable() {
|
||||
|
||||
0
DiscordVerifier/src/plugin.yml
Normal file → Executable file
0
DiscordVerifier/src/plugin.yml
Normal file → Executable file
0
cogs/modcommands.py
Normal file → Executable file
0
cogs/modcommands.py
Normal file → Executable file
0
cogs/servertatus.py
Normal file → Executable file
0
cogs/servertatus.py
Normal file → Executable file
0
data/constants.py
Normal file → Executable file
0
data/constants.py
Normal file → Executable file
0
files/images/server_icon.png
Normal file → Executable file
0
files/images/server_icon.png
Normal file → Executable file
|
Before Width: | Height: | Size: 171 KiB After Width: | Height: | Size: 171 KiB |
0
functions/checks.py
Normal file → Executable file
0
functions/checks.py
Normal file → Executable file
0
sockettest.py
Normal file → Executable file
0
sockettest.py
Normal file → Executable file
Reference in New Issue
Block a user