Commit Graph

75 Commits

Author SHA1 Message Date
69a08b3f6a Network:
- Removed methods for writing/reading/checking mod versions.
- Changed accepted versions to the current mod version.
- Removed MismatchedVersionException.java.

These changes should enforce that the exact same mod versions are only allowed to play together.
forge-1.18.2-3.0.1
2022-10-31 19:23:17 +00:00
89be776c7a gradle.properties:
- Updated build version to 3.0.1.
- Updated forge version to 40.1.84.
2022-10-31 19:20:26 +00:00
a6fc5d918e NetworkManager:
- Fixed the mod version pattern being incorrect.
- Fixed mod version checking not working.
- Fixed MismatchedVersionException not being thrown if the mod versions are wrong.
2022-10-25 23:06:16 +01:00
c1e62ce951 Reflected logo file extension in mods.toml. forge-1.18.2-3.0.0 2022-10-25 22:11:20 +01:00
ddb93f8a02 Replaced logo with a jpg to lower file size. 2022-10-25 22:10:35 +01:00
0ef3f8509f Added logo. 2022-10-25 20:43:05 +01:00
499cb870ee GuiRenderTickMixin:
- Added additional check to player state.
- Cleaned up the player state string when displaying.
2022-10-25 19:17:19 +01:00
f698a6ecf7 OnClientInputEventHandler:
- Added check for dedicated server before cancelling the event.
- Removed old todo comment.
2022-10-25 17:17:00 +01:00
97e452c6ee Split event classes into client/common packages within the events package. 2022-10-24 19:01:28 +01:00
28a1778b0f GuiRenderTickMixin:
- Added more comments
- Removed unnecessary alpha calculations.
- Replaced draw method with drawShadow.
- Cleaned up variables
- Made y offset to scale with window height.
2022-10-24 18:57:07 +01:00
898d938774 Changed archive base name. 2022-10-24 18:54:55 +01:00
b26726bb68 Fixed a typo. 2022-10-24 17:50:01 +01:00
8a03da1baa Added cache file to .gitignore. 2022-10-24 17:49:39 +01:00
3cde87ab86 OnClientInputEventHandler:
- Fixed passing the wrong value into checking if the screen is allowed for each monitored key.
2022-10-24 03:36:06 +01:00
ff22422492 OnClientInputEventHandler:
- Added more comments.
- Renamed variable isHotbarPressed to isHotBarPressed.
- Extracted checking if the screen is allowed into its own method.
- Extracted updating last input tick and sending an InputPacket into its own method.
- When a monitored key is pressed, it now checks if the screen along with the key are not allowed before calling updateAndNotify().

All of the above changes fixed the issue of being able to close inventory while afk when inventory is not allowed along with clicking the button to unpause the game ending the "Joining" and "AFK" states.
2022-10-20 23:41:51 +01:00
6b93b32ce6 InputPacket: Instead of checking for any state other than ACTIVE, it will check for the JOINING or AFK state before updating the state. 2022-06-08 12:51:43 +01:00
4c4addc7ef OnLivingSetAttackTargetEventHandler: Checks for new grace states before cancelling event. 2022-06-08 12:50:43 +01:00
592fb79519 OnPlayerDamageEventHandler: Removed old grace period time remaining check. 2022-06-08 12:49:24 +01:00
f0e0b6a458 Event Handlers: added some whitespace. 2022-06-07 15:59:25 +01:00
8a4b4ec5bc ProtectedPlayerManager: State changes.
- Updated updateState method to fit in all current config options as well as the new grace states.
- Added Javadoc to startAfkTimer method.
- Removed old todo comments.
- Removed unnecessary state check in the afk timer task.
- Renamed startGracePeriod method to startGraceTimer. Added delay parameter. Updated Javadoc. Removed old grace period time initialization in the protected player. Rewrote the timer task to now just update the player state after the delay.
- Removed unnecessary check at the end of applyPostEffects to remove player if afk is disabled. This is now done in the updateState method.
2022-06-07 14:35:12 +01:00
187eebee4a ProtectedPlayer: Grace period changes.
- Removed old way of tracking how much time is left in the grace period.
- Added delay parameter to the setGracePeriodTimerTask method.
- Added two new States: LOGIN_GRACE and AFK_GRACE.
2022-06-07 14:29:30 +01:00
0af7bba7e8 Updated Config.
- Removed old config options for the grace period and replaced them with separate options for a grace period after login and after afk.
- Changed naming convention for config file sections.
- Renamed config options IGNORE_PLAYER_ENABLED to MOBS_IGNORE_PLAYER.
- Added new config option for applying post effects after login.
2022-06-07 14:27:03 +01:00
e33ab62b63 Changed setLastInputTick method in Client Proxy to a simpler updateLastInputTick method which doesn't need a parameter since it was only ever passed one value. 2022-06-06 13:12:29 +01:00
0744bd064a Updated RequestLastInputTickPacket.
- Removed unnecessary default constructor.
- When handling the packet the client will first check if input is allowed which should update the last input tick if needs be before sending it to the server.
2022-06-06 13:06:27 +01:00
e030d67be7 Rewrote OnClientInputEventHandler.
It now keeps track of whether any of configurable keys is pressed in or not. It also will now check whether any of the pressed keys are allowed or not before updating last input tick and sending an input packet. This was done to fix the issue of GLFW_REPEAT stopping after another key is typed. This will prevent a player from going afk while still moving after jumping etc.
2022-06-06 13:04:52 +01:00
27acfd0806 Removed unnecessary constructor. 2022-06-05 16:18:01 +01:00
7a6c8f4cef Created a new packet for sending the last input tick to the server and deciding whether the player is afk or not. 2022-06-05 13:50:43 +01:00
cd98b0c811 Created new packet for requesting the last input tick from a client. 2022-06-05 13:50:05 +01:00
a440fcc1ab Removed OnPlayerTickEventHandler and added client-sided last input tick field with getter and setter to proxy. 2022-06-05 13:49:17 +01:00
1931f491a0 ProtectedPlayerManager adjustments and AFK timer.
- No longer adding a player that might not exist to then instantly remove them if they don't.
- Updated method calls to match new ones in ProtectedPlayer.
- Updated packet names to new ones.
- Grace period timer no longer cancels the timer but itself instead.
- Created new method for starting the afk timer for a player, starting a new afk timer whenever a player becomes active.
2022-06-05 13:47:36 +01:00
f46109e1cb Changed ProtectedPlayer's timers.
-Removed lastInputTick field along with the getter and setter.
-Changed timer name and added two TimerTask fields for the grace period and afk.
-Changed the getter for the timer.
-Added new setters for both of the timer tasks.
2022-06-05 13:41:10 +01:00
9f30820391 Changed packet names of existing packets. Registering two new packets to be made. 2022-06-05 13:38:12 +01:00
42a0e6f240 Moved to new package for server to client packets. Renamed ServerPlayerStatePacket to PlayerStatePacket. 2022-06-05 13:35:17 +01:00
452b772127 Moved to new package for client to server packets. Renamed ClientInputPacket to InputPacket. 2022-06-05 13:34:51 +01:00
ceff99c81c Additionally, checking if player is active and afk protection is enabled before setting player as afk. 2022-05-24 02:19:35 +01:00
1a10094c9f Fixed client not sending input packets when the key is not allowed. 2022-05-24 02:17:51 +01:00
3ad8b7b212 Created mixin config. 2022-05-24 02:16:56 +01:00
a204f7ac56 Created initial mixin for drawing the state text on screen. 2022-05-24 02:16:35 +01:00
962749cfae Added mixin support. 2022-05-24 02:16:07 +01:00
4c74718880 Registering new player tick event handler. 2022-05-24 00:30:59 +01:00
52287f3f49 Created player tick event for setting player to afk. 2022-05-24 00:30:45 +01:00
1dc206fe91 Setting last input tick of a player when a player becomes active. 2022-05-24 00:29:39 +01:00
49ca0fe465 Added a field, getter and setter for the last tick a player inputted anything. 2022-05-24 00:28:53 +01:00
fa9cba99bb Lowered limit for the afk time threshold option as it needs to be converted into ticks later. 2022-05-24 00:26:27 +01:00
0f1950b5cd Fixed damage event not cancelling when it should. 2022-05-24 00:00:46 +01:00
acc48922b1 Fixed net and mod version patterns being incorrect. 2022-05-24 00:00:14 +01:00
7de5416692 Sending player state to the client when added to protected players. 2022-05-23 23:59:40 +01:00
1976e54424 Updated to use new ProtectedPlayerManager and new config options. 2022-05-22 03:18:34 +01:00
084d2caa25 Removed event handler for player tick since grace period is done with timers now. 2022-05-22 03:17:35 +01:00
d6d8034311 Renamed and reworked the OnClientInputEventHandler to prevent pointless packets from being sent and for it to work with the afk allowed keys too. 2022-05-22 03:16:58 +01:00