Share scripts you wrote for Denizen-Bukkit here!
-
Mwthorn
- User

- Posts: 46
- Joined: August 6th, 2016, 8:35 am
- Location: Roskilde, Sjælland, Denmark
-
Contact:
Post
by Mwthorn » November 3rd, 2019, 1:50 pm
This handler takes care of the SQL connection and should be used whenever you make SQL tasks.
This only handles a single connection for simplicity reasons.
Instructions:
- Download the script here: https://one.denizenscript.com/paste/59562.txt
- Place the script in your script folder.
- Restart server or reload scripts
- Configure the file: plugins/denizen/data/sql/config.yml (path is the address with the SQL database)
- Place `- inject SQL_Handler_Connect` right before you have SQL commands; use the SQL ID definition: <[id]>
Example:
Code: Select all
- inject SQL_Handler_Connect
- ~sql id:<[id]> "update:UPDATE `servers_status` SET `TPS=<server.recent_tps.get[1]>,`Players`=<server.list_online_players.size>,`Max`=<server.max_players>,`Update`=<server.current_time_millis> WHERE `Server Name` = <&sq>lobby<&sq>"
-
mcmonkey
- Site Admin

- Posts: 299
- Joined: August 5th, 2016, 7:27 pm
- Location: Los Angeles, California, USA
-
Contact:
Post
by mcmonkey » November 4th, 2019, 5:19 am
- define pass:"none"
^ that's bad syntax
- yaml id:<[id]> set Password:MyPassword
^ for these lines, you should probably include a comment saying to not change the password within the script there, only within the generated config, to avoid risk of people confusing that.
You also still have old-style braces in the script.
Also your example on the forum post has a typo - missing backtick quote for "TPS"
Denizen lead developer. On Discord as mcmonkey#6666
.
Users browsing this forum: No registered users and 1 guest