add mysql
@ -366,12 +366,44 @@ public abstract class Render<T extends Entity>
|
|||||||
WorldRenderer worldrenderer = tessellator.getWorldRenderer();
|
WorldRenderer worldrenderer = tessellator.getWorldRenderer();
|
||||||
byte b0 = 0;
|
byte b0 = 0;
|
||||||
|
|
||||||
if(entityIn instanceof AbstractClientPlayer) {
|
if (entityIn instanceof AbstractClientPlayer) {
|
||||||
if (SocketClient.isUser(((AbstractClientPlayer) entityIn).getGameProfile().getName()) && entityIn.ticksExisted > 10) {
|
String username = ((AbstractClientPlayer) entityIn).getGameProfile().getId().toString();
|
||||||
|
if (SocketClient.isUser(username) && entityIn.ticksExisted > 20) {
|
||||||
Minecraft.getMinecraft().getTextureManager().bindTexture(new ResourceLocation("Athena/logo/Athena.png"));
|
Minecraft.getMinecraft().getTextureManager().bindTexture(new ResourceLocation("Athena/logo/Athena.png"));
|
||||||
|
|
||||||
|
String rank = SocketClient.getRank(username).toString();
|
||||||
|
ResourceLocation rankTexture = null;
|
||||||
|
switch (rank) {
|
||||||
|
case "OWNER":
|
||||||
|
rankTexture = new ResourceLocation("Athena/ranks/owner.png");
|
||||||
|
break;
|
||||||
|
case "DEVELOPER":
|
||||||
|
rankTexture = new ResourceLocation("Athena/ranks/developer.png");
|
||||||
|
break;
|
||||||
|
case "ADMIN":
|
||||||
|
rankTexture = new ResourceLocation("Athena/ranks/admin.png");
|
||||||
|
break;
|
||||||
|
case "MOD":
|
||||||
|
rankTexture = new ResourceLocation("Athena/ranks/mod.png");
|
||||||
|
break;
|
||||||
|
case "PREMIUM":
|
||||||
|
rankTexture = new ResourceLocation("Athena/ranks/premium.png");
|
||||||
|
break;
|
||||||
|
case "USER":
|
||||||
|
rankTexture = new ResourceLocation("Athena/ranks/user.png");
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (rankTexture != null) {
|
||||||
|
Minecraft.getMinecraft().getTextureManager().bindTexture(rankTexture);
|
||||||
Gui.drawModalRectWithCustomSizedTexture(-fontrenderer.getStringWidth(entityIn.getDisplayName().getFormattedText()) / 2 - 12, (int) -1.5, 10, 10, 10, 10, 10, 10);
|
Gui.drawModalRectWithCustomSizedTexture(-fontrenderer.getStringWidth(entityIn.getDisplayName().getFormattedText()) / 2 - 12, (int) -1.5, 10, 10, 10, 10, 10, 10);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
if (str.equals("deadmau5"))
|
if (str.equals("deadmau5"))
|
||||||
{
|
{
|
||||||
b0 = -10;
|
b0 = -10;
|
||||||
|
@ -91,25 +91,28 @@ public class Athena {
|
|||||||
* @param event The ClientTickEvent instance.
|
* @param event The ClientTickEvent instance.
|
||||||
*/
|
*/
|
||||||
@SubscribeEvent
|
@SubscribeEvent
|
||||||
public void onTick(ClientTickEvent event) {
|
public void onClientTick(ClientTickEvent event) {
|
||||||
if (Minecraft.getMinecraft().thePlayer != null && Minecraft.getMinecraft().theWorld != null) {
|
if (Minecraft.getMinecraft().thePlayer != null && Minecraft.getMinecraft().theWorld != null) {
|
||||||
String currentUsername = Minecraft.getMinecraft().thePlayer.getGameProfile().getName();
|
String currentUsername = Minecraft.getMinecraft().thePlayer.getGameProfile().getName();
|
||||||
|
|
||||||
if (!hasSent || !currentUsername.equals(SocketClient.getCurrentUsername())) {
|
if (!hasSent || !currentUsername.equals(SocketClient.getCurrentUsername())) {
|
||||||
if (hasSent && !currentUsername.equals(SocketClient.getCurrentUsername())) {
|
if (hasSent && !currentUsername.equals(SocketClient.getCurrentUsername())) {
|
||||||
// Player has changed their Minecraft account, disconnect the previous user
|
// Player has changed their Minecraft account, disconnect the previous user
|
||||||
System.out.println(SocketClient.client.request("stop", SocketClient.getCurrentUsername() + ":true"));
|
|
||||||
hasSent = false; // Reset the hasSent flag
|
hasSent = false; // Reset the hasSent flag
|
||||||
}
|
}
|
||||||
|
|
||||||
System.out.println(SocketClient.client.request("start", currentUsername + ":true"));
|
// Get the Minecraft player's UUID
|
||||||
|
String uuid = Minecraft.getMinecraft().thePlayer.getUniqueID().toString();
|
||||||
|
|
||||||
|
// Send the modified "start" request with the username and UUID
|
||||||
|
System.out.println(SocketClient.sendRequest("start", currentUsername + ":" + uuid + ":true"));
|
||||||
|
|
||||||
SocketClient.setCurrentUsername(currentUsername);
|
SocketClient.setCurrentUsername(currentUsername);
|
||||||
hasSent = true;
|
hasSent = true;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (hasSent && isGameRunningForeground) {
|
if (hasSent && isGameRunningForeground) {
|
||||||
// Minecraft game is not running in the foreground, disconnect the user
|
// Minecraft game is not running in the foreground, disconnect the user
|
||||||
System.out.println(SocketClient.client.request("stop", SocketClient.getCurrentUsername() + ":false"));
|
|
||||||
hasSent = false; // Reset the hasSent flag
|
hasSent = false; // Reset the hasSent flag
|
||||||
}
|
}
|
||||||
isGameRunningForeground = false;
|
isGameRunningForeground = false;
|
||||||
@ -120,6 +123,8 @@ public class Athena {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Cleans up and shuts down the client.
|
* Cleans up and shuts down the client.
|
||||||
* This method is responsible for any necessary cleanup tasks,
|
* This method is responsible for any necessary cleanup tasks,
|
||||||
@ -127,8 +132,5 @@ public class Athena {
|
|||||||
*/
|
*/
|
||||||
public void shutdownClient() {
|
public void shutdownClient() {
|
||||||
log.info("Shutting down client");
|
log.info("Shutting down client");
|
||||||
if(hasSent) {
|
|
||||||
System.out.println(SocketClient.client.request("stop", Minecraft.getMinecraft().thePlayer.getGameProfile().getName() + ":true"));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -105,7 +105,7 @@ public class MotionBlur extends Module {
|
|||||||
|
|
||||||
public class MotionBlurResource implements IResource {
|
public class MotionBlurResource implements IResource {
|
||||||
|
|
||||||
private static final String JSON = "{\"targets\":[\"swap\",\"previous\"],\"passes\":[{\"name\":\"phosphor\",\"intarget\":\"minecraft:main\",\"outtarget\":\"swap\",\"auxtargets\":[{\"name\":\"PrevSampler\",\"id\":\"previous\"}],\"uniforms\":[{\"name\":\"Phosphor\",\"values\":[0.5, 0.5, 0.5]}]},{\"name\":\"blit\",\"intarget\":\"swap\",\"outtarget\":\"previous\"},{\"name\":\"blit\",\"intarget\":\"swap\",\"outtarget\":\"minecraft:main\"}]}";
|
private static final String JSON = "{\"targets\":[\"swap\",\"previous\"],\"passes\":[{\"name\":\"phosphor\",\"intarget\":\"minecraft:main\",\"outtarget\":\"swap\",\"auxtargets\":[{\"name\":\"PrevSampler\",\"id\":\"previous\"}],\"uniforms\":[{\"name\":\"Phosphor\",\"values\":[%.2f, %.2f, %.2f]}]},{\"name\":\"blit\",\"intarget\":\"swap\",\"outtarget\":\"previous\"},{\"name\":\"blit\",\"intarget\":\"swap\",\"outtarget\":\"minecraft:main\"}]}";
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ResourceLocation getResourceLocation() {
|
public ResourceLocation getResourceLocation() {
|
||||||
|
@ -16,6 +16,11 @@ public class SocketClient {
|
|||||||
|
|
||||||
public static final Client client = new Client("141.145.209.142", 1337);
|
public static final Client client = new Client("141.145.209.142", 1337);
|
||||||
private static final Map<String, Boolean> userCache = new HashMap<>();
|
private static final Map<String, Boolean> userCache = new HashMap<>();
|
||||||
|
|
||||||
|
private static Map<String, String> rankCache = new HashMap<>();
|
||||||
|
private static Map<String, Long> cacheTime = new HashMap<>();
|
||||||
|
private static long cacheExpirationTime = 5 * 60 * 1000; // 5 minutes
|
||||||
|
|
||||||
private static String currentUsername = "";
|
private static String currentUsername = "";
|
||||||
|
|
||||||
public static boolean isClientRunning() {
|
public static boolean isClientRunning() {
|
||||||
@ -31,21 +36,42 @@ public class SocketClient {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Object sendRequest(String... args) {
|
public static Object sendRequest(String command, String payload) {
|
||||||
return client.request("echo", String.join(" ", args));
|
return client.request(command, payload);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean isUser(String username) {
|
public static String getRank(String username) {
|
||||||
if (userCache.containsKey(username)) {
|
if (rankCache.containsKey(username) && isCacheValid(username)) {
|
||||||
return userCache.get(username);
|
return rankCache.get(username);
|
||||||
}
|
}
|
||||||
|
|
||||||
String[] args = client.request("isUser", username).toString().split(":");
|
String rank = client.request("getRank", username).toString();
|
||||||
boolean isUser = args[0].equals("true");
|
rankCache.put(username, rank);
|
||||||
userCache.put(username, isUser);
|
cacheTime.put(username, System.currentTimeMillis());
|
||||||
return isUser;
|
return rank;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static boolean isCacheValid(String username) {
|
||||||
|
long currentTime = System.currentTimeMillis();
|
||||||
|
long lastCacheTime = cacheTime.get(username);
|
||||||
|
return currentTime - lastCacheTime <= cacheExpirationTime;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static boolean isUser(String uuid) {
|
||||||
|
if (userCache.containsKey(uuid)) {
|
||||||
|
return userCache.get(uuid);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Replace this code block with MySQL query
|
||||||
|
String payload = uuid;
|
||||||
|
String isUser = (String) client.request("isUser", payload);
|
||||||
|
|
||||||
|
boolean result = Boolean.parseBoolean(isUser);
|
||||||
|
userCache.put(uuid, result);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
public static String getCurrentUsername() {
|
public static String getCurrentUsername() {
|
||||||
return currentUsername;
|
return currentUsername;
|
||||||
}
|
}
|
||||||
|
BIN
src/main/resources/assets/minecraft/Athena/ranks/admin.png
Normal file
After Width: | Height: | Size: 114 KiB |
BIN
src/main/resources/assets/minecraft/Athena/ranks/developer.png
Normal file
After Width: | Height: | Size: 116 KiB |
BIN
src/main/resources/assets/minecraft/Athena/ranks/mod.png
Normal file
After Width: | Height: | Size: 116 KiB |
Before Width: | Height: | Size: 24 KiB After Width: | Height: | Size: 112 KiB |
BIN
src/main/resources/assets/minecraft/Athena/ranks/premium.png
Normal file
After Width: | Height: | Size: 116 KiB |
Before Width: | Height: | Size: 22 KiB After Width: | Height: | Size: 109 KiB |
After Width: | Height: | Size: 2.7 KiB |
After Width: | Height: | Size: 1.5 KiB |
After Width: | Height: | Size: 1.1 KiB |
After Width: | Height: | Size: 1.3 KiB |
After Width: | Height: | Size: 1.3 KiB |
After Width: | Height: | Size: 1.3 KiB |
After Width: | Height: | Size: 2.2 KiB |
After Width: | Height: | Size: 1.4 KiB |
After Width: | Height: | Size: 2.2 KiB |
After Width: | Height: | Size: 4.2 KiB |
After Width: | Height: | Size: 1.0 KiB |
After Width: | Height: | Size: 1.2 KiB |
After Width: | Height: | Size: 1016 B |
After Width: | Height: | Size: 435 B |
After Width: | Height: | Size: 1.4 KiB |
After Width: | Height: | Size: 1.3 KiB |
After Width: | Height: | Size: 374 B |
After Width: | Height: | Size: 1.4 KiB |
After Width: | Height: | Size: 1.9 KiB |
After Width: | Height: | Size: 1.2 KiB |
After Width: | Height: | Size: 564 B |
After Width: | Height: | Size: 1.4 KiB |
After Width: | Height: | Size: 1.8 KiB |
After Width: | Height: | Size: 862 B |
After Width: | Height: | Size: 1.1 KiB |
After Width: | Height: | Size: 1.2 KiB |
After Width: | Height: | Size: 1.2 KiB |
After Width: | Height: | Size: 1.4 KiB |
After Width: | Height: | Size: 1.5 KiB |
After Width: | Height: | Size: 1.4 KiB |
After Width: | Height: | Size: 1.9 KiB |
After Width: | Height: | Size: 1.1 KiB |
After Width: | Height: | Size: 1.6 KiB |
After Width: | Height: | Size: 1009 B |
After Width: | Height: | Size: 1.1 KiB |
After Width: | Height: | Size: 1.3 KiB |
After Width: | Height: | Size: 664 B |
After Width: | Height: | Size: 3.4 KiB |
After Width: | Height: | Size: 1.5 KiB |
After Width: | Height: | Size: 1.5 KiB |
After Width: | Height: | Size: 969 B |
After Width: | Height: | Size: 1.7 KiB |
After Width: | Height: | Size: 1.2 KiB |
After Width: | Height: | Size: 1.4 KiB |
After Width: | Height: | Size: 1.1 KiB |
After Width: | Height: | Size: 1.2 KiB |
After Width: | Height: | Size: 1.8 KiB |
After Width: | Height: | Size: 1.3 KiB |
After Width: | Height: | Size: 1.6 KiB |
After Width: | Height: | Size: 2.3 KiB |
After Width: | Height: | Size: 3.2 KiB |
After Width: | Height: | Size: 939 B |
After Width: | Height: | Size: 1.8 KiB |
After Width: | Height: | Size: 3.5 KiB |
After Width: | Height: | Size: 2.6 KiB |
After Width: | Height: | Size: 613 B |
After Width: | Height: | Size: 1.1 KiB |
After Width: | Height: | Size: 1.5 KiB |
After Width: | Height: | Size: 2.3 KiB |
After Width: | Height: | Size: 1.7 KiB |
After Width: | Height: | Size: 2.0 KiB |
After Width: | Height: | Size: 4.0 KiB |
After Width: | Height: | Size: 1.3 KiB |
After Width: | Height: | Size: 1.6 KiB |
After Width: | Height: | Size: 1.3 KiB |
After Width: | Height: | Size: 2.0 KiB |
After Width: | Height: | Size: 1.0 KiB |
After Width: | Height: | Size: 1.6 KiB |
After Width: | Height: | Size: 2.2 KiB |
After Width: | Height: | Size: 1.1 KiB |
After Width: | Height: | Size: 935 B |
After Width: | Height: | Size: 1.2 KiB |
After Width: | Height: | Size: 1.6 KiB |
After Width: | Height: | Size: 1.8 KiB |
After Width: | Height: | Size: 1.2 KiB |
After Width: | Height: | Size: 1.4 KiB |
After Width: | Height: | Size: 976 B |
After Width: | Height: | Size: 2.2 KiB |
After Width: | Height: | Size: 1.5 KiB |
After Width: | Height: | Size: 1.2 KiB |
After Width: | Height: | Size: 615 B |
After Width: | Height: | Size: 1.4 KiB |
After Width: | Height: | Size: 868 B |
After Width: | Height: | Size: 825 B |
After Width: | Height: | Size: 1.3 KiB |
After Width: | Height: | Size: 1.3 KiB |
After Width: | Height: | Size: 1.4 KiB |
After Width: | Height: | Size: 1.5 KiB |
After Width: | Height: | Size: 1.7 KiB |
After Width: | Height: | Size: 628 B |