blob: c0b4546c5b127ce74ab33c501b6bdd489aeaaab7 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
|
package de.torui.coflsky;
import de.torui.coflsky.core.Command;
import de.torui.coflsky.core.CommandType;
import de.torui.coflsky.core.JsonStringCommand;
import java.util.UUID;
import net.minecraft.client.Minecraft;
import net.minecraft.server.MinecraftServer;
import net.minecraft.server.gui.MinecraftServerGui;
import net.minecraftforge.event.world.WorldEvent;
import net.minecraftforge.fml.client.FMLClientHandler;
import net.minecraftforge.fml.common.eventhandler.EventPriority;
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
import net.minecraftforge.fml.common.gameevent.InputEvent.KeyInputEvent;
import net.minecraftforge.fml.common.gameevent.PlayerEvent.PlayerLoggedInEvent;
import net.minecraftforge.fml.common.gameevent.PlayerEvent.PlayerLoggedOutEvent;
import net.minecraftforge.fml.common.network.FMLNetworkEvent;
import net.minecraftforge.fml.common.network.FMLNetworkEvent.ClientConnectedToServerEvent;
import net.minecraftforge.fml.common.network.FMLNetworkEvent.ClientDisconnectionFromServerEvent;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
import net.minecraftforge.fml.server.FMLServerHandler;
public class EventRegistry{
@SubscribeEvent
public void onConnectedToServerEvent(ClientConnectedToServerEvent event) {
/* if(!event.isLocal ) {
//String serverIP = Minecraft.getMinecraft().getCurrentServerData().serverIP;
/* if(false && serverIP.equals("hypixel.net")) {
}*
//UUID.randomUUID().toString();
//String id = FMLClientHandler.instance().getClient().thePlayer.getUniqueID().toString();
String id = UUID.randomUUID().toString();//Minecraft.getMinecraft().thePlayer.getUniqueID().toString();
System.out.println("PlayerUUID:" + id);
CoflSky.PlayerUUID = id;
System.out.println("Connected to server");
CoflSky.Wrapper.start();
System.out.println("CoflSky started");
}*/
}
@SubscribeEvent
public void onDisconnectedFromServerEvent(ClientDisconnectionFromServerEvent event) {
System.out.println("Disconnected from server");
CoflSky.Wrapper.stop();
System.out.println("CoflSky stopped");
}
@SideOnly(Side.CLIENT)
//@SubscribeEvent(priority = EventPriority.NORMAL, receiveCanceled = true)
public void onEvent(KeyInputEvent event) {
if(CoflSky.keyBindings[0].isPressed()) {
if(WSCommandHandler.lastOnClickEvent != null) {
String command = WSCommandHandler.lastOnClickEvent;
WSCommandHandler.lastOnClickEvent = null;
WSCommandHandler.HandleCommand(new JsonStringCommand(CommandType.Execute, WSClient.gson.toJson(command)),
Minecraft.getMinecraft().thePlayer);
}
}
}
/*@SubscribeEvent
public void OnSomething(FMLNetworkEvent.ClientConnectedToServerEvent event) {
System.out.println("Client connect to server from network");
}
@SubscribeEvent
public void PlayerLoggedOut(PlayerLoggedOutEvent ploe) {
//CoflSky.Wrapper.stop();
System.out.println("COFLSKY disabled");
}*/
}
|