Jump to content

[Java] Sledgehammer Server 2.05_04


Jab

Recommended Posts

ZkazPMo.png

 

 

 

 

Sledgehammer is a “Module-Event” engine designed for the multiplayer game-mode for Project Zomboid. Modules are loaded through the use of Java’s Classloader library, through JAR files (Java Archive File). Modules are given access to core components of the game, as well as utilities to handle a wide variety of needs for each individual module.

 

Targeting specific needs of Project Zomboid Multiplayer management, Administrators can deploy solutions based on their specific needs quickly, and properly, avoiding hard-coding and non-standard code practices that occur when modding multiplayer games.

 

 

 

Instructions

This is a java mod, so in order to install this, copy the folders inside "PZ Files" folder in the download, and paste them into the folder containing the server files, and replace when asked by your OS.

 

 

(Download)

 

- Sledgehammer -

(2.05_04)(Build 34.28)

 

(Plug-ins)

(will redo section soon)

 

- Factions - 

(1.04_03) (SH - 2.05_04)

 

- IRC-Bot -

(1.05) (SH - 2.05_04)

 

- Permissions -

(1.02_02 BETA) (SH - 2.05_04)

 

- Discord-Bot -

(1.00_03_BETA) (SH - 2.04_04)

 

 

Commands

Spoiler
  • colors
  • broadcast "color" "message"
  • ban: 
    
    Bans a player. Flags:
        -s: SteamID flag (No ID required, but must be online!) ex: /ban -U "username\" -s
        -S: SteamID flag (ID required!) ex: /ban -S "11330"
        -U: Username flag (Required unless "-S" or "-I") ex: /ban -U "username"
        -i: IP flag (No IP required, but must be online!)
        -I: IP flag (IP required!) ex: /ban -I "127.0.0.1" (Note: without -U given, To undo this ban, the IP will be manditory as an argument!) 

     

  • unban: 

    
    Unbans a player. Flags:
        -U: Username flag (Required!) ex: /unban -U "username"
        -S: SteamID flag (ID required!) ex: /unban -S "11330"
        -I: IP flag (IP required!) ex: /unban -I "127.0.0.1"

     

 

 

 

Developer Information

Spoiler

The Sledgehammer Core, along with the modules: Factions, IRC Bot, and Global-Mute are now available as open source. All of the modules and the core do not expose or publicly share Java source files decompiled from the original game, only Java .class compiled files that are distributed along with the release of Sledgehammer. 

 

The source is avaliable here:

https://atlassian.ecs-server.net/stash/projects/SLAM

 

You can study the modules on how to work on your own plug-ins for now. I will be spending time cleaning up the code as I move forward to write more utilities for Sledgehammer and modules.

 

Sledgehammer projects are organized in Eclipse projects; there is one workspace, with each project as a git repository. In order to compile Sledgehammer and modules, you must add a variable (Or external class folder), and link to the "Project Zomboid Dedicated Server/java" folder, followed by linking to the Sledgehammer's Core 'bin' folder. 

 

To create a plug-in, create a project like one of the 3 shown, create a class that extends Module, SQLModule, or SettingsModule (Will either convert to interface, or integrate directly into Module). When you are done, make sure to have a plugin.txt file that points to your module. E.G: "module:sledgehammer.modules.MyModule". Export the project as a JAR file, and place in your"Zomboid/Server/ZIRC/plugins/" folder. Add this plugin (the name of the JAR file), in the Sledgehammer.ini file in "Zomboid/Server/Sledgehammer/Sledgehammer.ini", delimited by commas.

 

 

Release notes

Spoiler

V2.05_04:

- Fixed the teleport command.

- Fixed the addxp command.

 

V2.05_03:

- Started implementing PlayerManager.

- Added Sledgehammer shutdown call when Co-Op disconnects.

- Migrated Player search API to the PlayerManager class.

- Changed Player search methods to use the context "IsoPlayer' in method names, for future Player methods.

- Removed the NPC class from the source. (This does not affect the Behavior / Action API. This allows sensitive code to be used in the NPC class.

- Added nick-name support to more of the Player API.

- Added a ScriptEvent object, allowing plug-ins to hook into Lua events.

- Added a LuaListener class that outlines how to interpret ScriptEvents.

- Fixed a vanilla crash from an ArrayIndexOutOfBoundsException, when looking up cell information on an invalid or nonexistent chunk.

Cleaned up console on startup. (This does not include Steam mod prints)

- Vanilla optimizations to consume less cpu time when the server is empty.

- Added PeriodicMessage class, that will allow plug-ins to push periodic messages to players. This is planned in a future version.

 

V2.05_02:

- Various bug fixes.

- Added wild-card functionality to player names.

- Fixed scoreboard (Players menu) not updating properly on login.

- Updated SledgeHammerExtension Lua mod to fix the admin buttons on the players menu.

- Added another PRNG, replacing the uncommons math PRNG, removing some time between update ticks.

 

V2.05_01:

- Various bug fixes.

- Added player nickname support for plug-ins (Factions uses this).

 

V2.05:

- Fixed various small bugs.

- Fixed 'getSettings()' nullpointerexception

- NPC's Behavior & Action API is more mature, but still needs some more framework development to become solid.

- Discord-bot's '!z <command>' component did not respond when used. This is now fixed.

- Players now show modified names.

- Factions now uses Local chat & Player list.

- Workshop extension updated.

 

V2.04_01:

- Fixed NPC spawner infinite loop.

- Organized Manager classes. 

- Moved Manager classes into sledgehammer.managers package.

- Documented SledgeHammer.java & manager classes.

- Updated Factions & Discord plug-ins due to API changes in the core.

 

V2.04:

- Various bug fixes

- Added 'unregister(...)' methods. This fixed a certain bug with duplicate event handles. 

- Added Discord-Bot module.

 

V2.03:

- Major organizing & optimizing of core code.

- Various bug fixes.

- More work done on Behavior API for fake players.

 

V2.02:

- Updated to Build 34.27.

- Changed project name to "Sledgehammer".

Added Permissions system.

- Will write change-log soon.

 

V2.01:

- Modified Events to be identified with Strings, rather than a Enumeration, in order for custom Events by third-parties to be handled in the future. I.E: FactionDisbandEvent

- Created a JAR classloader to load in Jar files at runtime for modules, as plugins.  Requires a plugin.txt file specifying the module class to be loaded.

- IRC-BOT module ignores PVPAttackEvent.

- Cleaned up various areas of code.

 

V2.00:

Rewritten engine to support a wide variety of modular benefits.

- Added ZIRC Events. These are events that represent in-game server events, such as DeathEvent, PVPKillEvent, ChatEvent, etc.

- Added ZIRC Log Listeners. These are useful when needing to Log, or transmit logged events (Example: IRC).

- Added ZIRC Modules. These will become more useful when Jar classloading is implemented. This organizes components loaded and used by ZIRC.

- Added ZIRC Command Listeners. These are for Command Events, and are implemented to organize tooltip messages, command registration, and command execution.

- Added ZIRC Player Wrapper class, to handle UdpConnection and IsoPlayer instances simultaneously, without having to juggle them both, to retrieve common information, such as admin rights, and usernames.

- Added ZIRC module super-class 'SQLModule', to aid in modules requiring SQLite access to the servertest.db. (Other files can also be used with SQLModule!).

- Added ZIRC module 'ModuleIRC', which is a re-write of handling and loading a IRC Bot instance for server moderation purposes.

- Added ZIRC module 'ModuleFactions', which is a re-write of handling and managing factions on the server.

- Added ZIRC module 'VanillaModule' which is a re-organization and partial re-writing of the way commands, and logging are handled.

- Added ZIRC module 'ModuleMonitorGlobals', which is used to dump memory size and item count of commonly & heavily used Map collections across Project Zomboid, to detect memory leaks. This module will be developed more over time, depending on memory leaks, or other globally-relative issues in the future.

- Added ZIRC EventListener 'ChatListener' which is a ZIRC listener for chat handling, and chat message dispatching. This helps organize and keep things clean.

- Added ZIRC EventListener 'DeathListener' which is a ZIRC listener for death handling, and PVP kill events.

- Added ZIRC EventListener 'ZIRCCommandListener', which is used for handling ZIRC-crafted commands, and re-written commands from the vanilla server.

- Added ZIRC LogListener for the IRC Bot, for transmission of logged events.

- Modified Log events to be more proper english.

- Removed commands '/banuser', '/banip', and '/banid'.

- Added commands '/ban', and '/unban'. This is to unify ban management commands.

- Added command '/reload', which performs '/reloadoptions' and re-initializes ZIRC.

- Added command '/muteglobal', which mutes global chat for a player. This is permenant, until the player types '/muteglobal' again. The player is notified every time they log on.

- Added Event 'ChatEvent' for chat events.

- Added Event 'CommandEvent' for command events.

- Added Event 'ConnectEvent' for connection events.

- Added Event 'DeathEvent' for player death events (non-pvp). (May be duplicate instances when fired. Looking into it. Using a event timestamp to remedy this for now)

- Added Event 'PVPKillEvent' for player PVP death events. (May be duplicate instances when fired. Looking into it. Using a event timestamp to remedy this for now)

- Added Event 'PVPAttackEvent' for player PVP attack events. (Will be implemented in the next version)

- Added Event 'LogEvent', used for passing log events through ZIRC's Log Listeners.

- Added Event 'LuaEvent', which will be implemented possibly in the next version, and will be used as a proxy for Lua events.

- Changed command '/startzirc' and '/stopzirc' to '/irc [start|stop]' for organization and consistency.

- Re-written /help to be server-sided. This helps with the addition of new commands.

 

V1.03:

- Added Factions. Type /Factions help for information on how the commands work.

- Added ZIRC EXTENSION mod to the Steam Workshop. This is required to properly display chat and chat effects.

- Added SQLite support for Factions data. Using a SQLite viewer (Example: http://sqlitebrowser.org/), you can modify factions as an administrator. Commands are planned.

- Added Internal Time-stamp for the IRC relay to reflect accurate time of dispatched messages.

- Removed command /servermsg and replaced with /broadcast "color" "message", which removes "Server : " for more dynamic text, and colors. The message fades when disappearing.

- Added Color encoding to global chat messages (Internal use only, inbound chat is stripped.).

- Added /colors command, showing all avaliable colors for certain options.

- Fixed various issues surrounding the IRC component of ZIRC.

- Tweaked the server response message color to be easier to the eye.

 

V1.02:

- Changed 1000ms latency for messaging when the dispatch queue to 1250ms, when it is beyond a certain threshold of messages to dispatch.

- Removed some debugging prints hogging up the console.

 

V1.01:

- Implemented a asynchronous dispatcher to prevent excess flooding disconnection in IRC.

- Checked against names to prevent bot alts from feedback

- Fixed In-game death message (null has died)

- Exception passing for when the IRC component is erroneous.

- Voice / Op requirement for messages to be relayed to in-game.

 

V1.00:

- Initial release.

 

 

Official Test Server

Special thanks to Terminus for supporting the first versions of SledgeHammer. Thanks to your support, this mod has matured and Project Zomboid multiplayer will benefit from this.

 

 

Edited by Jab
Link to comment
Share on other sites

  • 3 weeks later...

Updated to V1.01.

 

V1.01:

- Implemented a asynchronous dispatcher to prevent excess flooding disconnection in IRC.

- Checked against names to prevent bot alts from feedback

- Fixed In-game death message (null has died)

- Exception passing for when the IRC component is erroneous.

- Voice / Op requirement for messages to be relayed to in-game.

Edited by Jab
Link to comment
Share on other sites

Updated to V1.02.

 

V1.02:

- Changed 1000ms latency for messaging when the dispatch queue to 1250ms, when it is beyond a certain threshold of messages to dispatch.

- Removed some debugging prints hogging up the console.

 

Considering doing internal timestamps for the dispatcher so the time of events in mass can be observed properly.

Considering doing blacklist options for ZIRC for when mods like to spam local messages.

Considering doing more options for choosing whether or not to send local chat to IRC.

 

Edited by Jab
Link to comment
Share on other sites

ZIRC Todo:

* Modify ISChat.addLineInChat to support multi-color chat (Make sure to strip client-outbound msgs via server-side)

* Create PM system

* Auto-connect / attempt system.

* Dispatcher latency settings. (Min, Max, Increment) (E.G: Min: 250, max: 1250, inc: 250)

* Add option for internal timestamps.

* First-time greet messages for the server.
* Create 2 SQL Tables, one to handle the Faction definitions / owners,
    and another for users.

* Create commands to join and create factions. (With passwords)

Edited by Jab
Link to comment
Share on other sites

While doing testing in a live multiplayer environment, I realized more work needs to be done on commands, as some of them are bugging out. 

 

Delaying release of next version to make sure the first factions release will be stable. Will make a long post sometime in the next day.

Link to comment
Share on other sites

QiNptOq.png

 

ZIRC Factions Update V1.03:

  • Added Factions. Type /Factions help for information on how the commands work.
  • Added ZIRC EXTENSION mod to the Steam Workshop. This is required to properly display chat and chat effects.
  • Added SQLite support for Factions data. Using a SQLite viewer (Example: http://sqlitebrowser.org/), you can modify factions as an administrator. Commands are planned.
  • Added Internal Time-stamp for the IRC relay to reflect accurate time of dispatched messages.
  • Removed command /servermsg and replaced with /broadcast "color" "message", which removes "Server : " for more dynamic text, and colors. The message fades when disappearing.
  • Added Color encoding to global chat messages (Internal use only, inbound chat is stripped.).
  • Added /colors command, showing all avaliable colors for certain options.
  • Fixed various issues surrounding the IRC component of ZIRC.
  • Tweaked the server response message color to be easier to the eye.

Download is in the original post.

Link to comment
Share on other sites

ZIRC Todo:

 

(General)
* Create ZIRC modules.
* Permissions system for staff.

 

(Chat)
* Globally display faction creation and disbands.
* Faction chat channel.

* command option to mute global
* First-time greet messages for the server.
* Create Macros table.

 

(IRC)
* Auto-connect / attempt system.(Still in the works)
* Hook up new events & ZIRC events.
* Add option to toggle internal timestamps.

 

(Faction stuff)
* Command to see who owns a Faction.
* Faction relationship table.

Edited by Jab
Link to comment
Share on other sites

  • 2 weeks later...

So far, I've successfully converted all the zirc code into a new engine that supports modules. I've also worked on ZIRC events, which are fantastic. There are LogListener, CommandListener, and EventListener interfaces for modules to register and use. The transfer of the vanilla commands are still being debugged, and is holding back the next release, with a couple more planned features to add in for staff management.

Link to comment
Share on other sites

7 hours ago, Sky_Orc_Mm said:

Great plugin, completely changed chat function..

 

You can add "ZIRC" translation function support?

 

Been thinking about it. I'll have to look and see how TIS does it, however, I see it as an important feature to add. :)

Link to comment
Share on other sites

11 hours ago, Jab said:

 

Been thinking about it. I'll have to look and see how TIS does it, however, I see it as an important feature to add. :)

Awesome  But I've had some problems.

 

Seem to be having a encoding problem, Chinese Message can not read, I have a full Chinese fonts

 

Did I miss something?

 

1.jpg

 

Edit:Problem solved, because I set the wrong character encoding

 

 

Needs to add a "encoding setting" function

 

Used to process other character sets

 

 

Edited by Sky_Orc_Mm
Link to comment
Share on other sites

On 3/27/2016 at 10:54 PM, Sky_Orc_Mm said:

Awesome  But I've had some problems.

 

Seem to be having a encoding problem, Chinese Message can not read, I have a full Chinese fonts

 

Did I miss something?

 

1.jpg

 

Edit:Problem solved, because I set the wrong character encoding

 

 

Needs to add a "encoding setting" function

 

Used to process other character sets

 

 

 

Neat. I'm new to advanced encoding techniques. I might stumble a bit when I start looking into it. :)

Link to comment
Share on other sites

Okay so, I just did a big push of code last night, and now I am testing what is currently done.

 

The Module system seems stable, with a few things possibly missing, beyond adding more Event types for EventListeners. 

 

Although the classloading jar stuff isn't here yet, the engine is essentially prepped for it when I get to it, which means opening up ZIRC for third-party modules.

 

I will also be looking at heavily improving the way module config files work, before any third-party modules become a thing.

 

Be sure to look for a update / change log in the coming 48 hours or so. :-)

Link to comment
Share on other sites

ZIRC Update V2.00:

  • Rewritten engine to support a wide variety of modular benefits.
  • Added ZIRC Events. These are events that represent in-game server events, such as DeathEvent, PVPKillEvent, ChatEvent, etc.
  • Added ZIRC Log Listeners. These are useful when needing to Log, or transmit logged events (Example: IRC).
  • Added ZIRC Modules. These will become more useful when Jar classloading is implemented. This organizes components loaded and used by ZIRC.
  • Added ZIRC Command Listeners. These are for Command Events, and are implemented to organize tooltip messages, command registration, and command execution.
  • Added ZIRC Player Wrapper class, to handle UdpConnection and IsoPlayer instances simultaneously, without having to juggle them both, to retrieve common information, such as admin rights, and usernames.
  • Added ZIRC module super-class 'SQLModule', to aid in modules requiring SQLite access to the servertest.db. (Other files can also be used with SQLModule!).
  • Added ZIRC module 'ModuleIRC', which is a re-write of handling and loading a IRC Bot instance for server moderation purposes.
  • Added ZIRC module 'ModuleFactions', which is a re-write of handling and managing factions on the server.
  • Added ZIRC module 'VanillaModule' which is a re-organization and partial re-writing of the way commands, and logging are handled.
  • Added ZIRC module 'ModuleMonitorGlobals', which is used to dump memory size and item count of commonly & heavily used Map collections across Project Zomboid, to detect memory leaks. This module will be developed more over time, depending on memory leaks, or other globally-relative issues in the future.
  • Added ZIRC EventListener 'ChatListener' which is a ZIRC listener for chat handling, and chat message dispatching. This helps organize and keep things clean.
  • Added ZIRC EventListener 'DeathListener' which is a ZIRC listener for death handling, and PVP kill events.
  • Added ZIRC EventListener 'ZIRCCommandListener', which is used for handling ZIRC-crafted commands, and re-written commands from the vanilla server.
  • Added ZIRC LogListener for the IRC Bot, for transmission of logged events.
  • Modified Log events to be more proper english.
  • Removed commands '/banuser', '/banip', and '/banid'.
  • Added commands '/ban', and '/unban'. This is to unify ban management commands.
  • Added command '/reload', which performs '/reloadoptions' and re-initializes ZIRC.
  • Added command '/muteglobal', which mutes global chat for a player. This is permenant, until the player types '/muteglobal' again. The player is notified every time they log on.
  • Added Event 'ChatEvent' for chat events.
  • Added Event 'CommandEvent' for command events.
  • Added Event 'ConnectEvent' for connection events.
  • Added Event 'DeathEvent' for player death events (non-pvp). (May be duplicate instances when fired. Looking into it. Using a event timestamp to remedy this for now)
  • Added Event 'PVPKillEvent' for player PVP death events. (May be duplicate instances when fired. Looking into it. Using a event timestamp to remedy this for now)
  • Added Event 'PVPAttackEvent' for player PVP attack events. (Will be implemented in the next version)
  • Added Event 'LogEvent', used for passing log events through ZIRC's Log Listeners.
  • Added Event 'LuaEvent', which will be implemented possibly in the next version, and will be used as a proxy for Lua events.
  • Changed command '/startzirc' and '/stopzirc' to '/irc [start|stop]' for organization and consistency.
  • Re-written /help to be server-sided. This helps with the addition of new commands.
  • /ban:
    Bans a player. Flags:
    	-s: SteamID flag (No ID required, but must be online!) ex: /ban -U "username\" -s
    	-S: SteamID flag (ID required!) ex: /ban -S "11330"
    	-U: Username flag (Required unless "-S" or "-I") ex: /ban -U "username"
    	-i: IP flag (No IP required, but must be online!)
    	-I: IP flag (IP required!) ex: /ban -I "127.0.0.1" (Note: without -U given, To undo this ban, the IP will be manditory as an argument!) 
    
    /unban:
    Unbans a player. Flags:
    	-U: Username flag (Required!) ex: /unban -U "username"
    	-S: SteamID flag (ID required!) ex: /unban -S "11330"
    	-I: IP flag (IP required!) ex: /unban -I "127.0.0.1"

     

 

Edited by Jab
Link to comment
Share on other sites

After some extensive memory analysis, I have created a couple patches to the game's java files that may fix a potential memory leak where lua event triggers error and cause objects to not be garbage collected, stacking up over time and causing memory to build up.

 

I'll throw it on the next update to ZIRC soon.

Link to comment
Share on other sites

7 hours ago, Jab said:

After some extensive memory analysis, I have created a couple patches to the game's java files that may fix a potential memory leak where lua event triggers error and cause objects to not be garbage collected, stacking up over time and causing memory to build up.

 

I'll throw it on the next update to ZIRC soon.

Do you have any plans of letting TIS know about these issues, assuming you're not working from an unpatched 33.20 build of the server?

Link to comment
Share on other sites

1 hour ago, EnigmaGrey said:

Do you have any plans of letting TIS know about these issues, assuming you're not working from an unpatched 33.20 build of the server?

 

I wanted to do some more testing to make sure that this is absolutely a memory leak. 

 

I am also not too sure how to tell TIS properly. Would be cool to know if there's a proper way to report it. :)

Link to comment
Share on other sites

2 minutes ago, EnigmaGrey said:

Post it in the bug tracker, please. Thanks.

 

Sure thing! It seems like I actually fixed a memory leak. Terminus (The test server for ZIRC), has been up all day with way less memory footprints.

Link to comment
Share on other sites

1 minute ago, Jab said:

 

Sure thing! It seems like I actually fixed a memory leak. Terminus (The test server for ZIRC), has been up all day with way less memory footprints.

How much RAM does it typically use? After applying the patches released earlier last week, it should be around 8 - 12 GB -- maybe up to 20 if it has a much higher population, though the excess memory should be freed as the population drops.

Link to comment
Share on other sites

Just now, EnigmaGrey said:

How much RAM does it typically use? After applying the patches released earlier last week, it should be around 8 - 12 GB -- maybe up to 20 if it has a much higher population, though the excess memory should be freed as the population drops.

 

Right now, the memory trend you mention is right (besides freeing up memory with native memory handling with the JVM (non-ZNET & RakNet stuff), however, before then, the memory footprint was linearly getting worse. the server had to be restarted a few times a day, and i've seen it try to cap 32gb with little to no reason, even with a stable population.

 

I ran some analytics I coded into ZIRC to see what was going on, after messing around with JMap a bit. When I post a bug report, I'll be sure to include it.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...