Guest User

Untitled

a guest
Feb 28th, 2026
73
0
Never
4
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 17.57 KB | None | 0 0
  1. HyperSkript — User Guide and Language Reference
  2. ==============================================
  3.  
  4. This document describes how to write HyperSkript (.hs) scripts for the HyperSkript plugin.
  5. It covers file layout, language syntax, variables, events, commands, state & persistence,
  6. built-in functions and methods, interpolation, examples, and common troubleshooting tips.
  7.  
  8. Quick start
  9. -----------
  10. 1. Put .hs files into plugins/HyperSkript/scripts/ (the plugin creates an example.hs on first run).
  11. 2. Use /hs reload (requires permission hyperskript.admin) to reload scripts at runtime.
  12. 3. Script structure is indentation-based (like Python). Use 4 spaces per indent level (or tabs; tabs count as 4 spaces).
  13. 4. Comments start with # and continue to end-of-line.
  14. 5. Strings use double quotes (") and support escape sequences: \n, \t, \", \\.
  15.  
  16. File layout / top-level constructs
  17. ---------------------------------
  18. Top-level constructs in a .hs file:
  19. - persist ... — configure persistence (sqlite)
  20. - state ... — declare script-level variables (simple or map)
  21. - on <event>: — event handler block
  22. - command <name>(...): — command handler block
  23.  
  24. Example (full example shipped with plugin):
  25. persist default sqlite
  26. state String:welcome_msg default "Welcome to the server!"
  27. state homes:<Player,Location> persist default []
  28. on player join:
  29. event.join_message = ""
  30. player.send("{welcome_msg}")
  31. command sethome():
  32. homes[sender] = sender.location
  33.  
  34. Lexical rules, whitespace, comments
  35. ----------------------------------
  36. - Comments: start with # and run to end of line.
  37. - Lines are terminated by newline; blank lines and comment-only lines are ignored for indentation.
  38. - Indentation: INDENT / DEDENT tokens are generated by counting leading spaces (tab = 4 spaces). Use consistent indentation.
  39. - Strings: "..." with escapes (\n, \t, \", \\).
  40. - Numbers: integer "123" or decimal "12.34".
  41. - Keywords: on, command, if, else, for, stop, cancel, and, or, not, persist, default, sqlite, file, wal, state, True, False, null, etc.
  42.  
  43. Top-level persist configuration
  44. -------------------------------
  45. Syntax (common forms accepted by parser):
  46. - persist default sqlite
  47. - persist sqlite
  48. - persist sqlite file "path/to/file.db" wal True
  49.  
  50. Behavior:
  51. - sqlite => uses an SQLite DB per script; default path: plugins/HyperSkript/data/<scriptname>.db
  52. - wal True => enables WAL mode for better concurrent performance
  53. - When persist is configured, state variables declared with "persist" will be saved/loaded automatically.
  54.  
  55. State declarations
  56. ------------------
  57. Syntax examples:
  58. - state String:welcome_msg default "Hello"
  59. - state Int:count default 0
  60. - state homes:<Player,Location> persist default []
  61. - state name_of_map:<Player,String> persist
  62.  
  63. Meaning:
  64. - Simple states: valueType:name (String, Int, Location, etc.)
  65. - Map states: name:<KeyType,ValueType>
  66. - "persist" after declaration marks it to be stored in DB (requires persist config).
  67. - default <expr> supplies the initial value if not present in DB.
  68. - For empty map default use default [] (parser recognizes empty list literal as map default).
  69.  
  70. Accessing states:
  71. - Simple state (non-map): directly by name (welcome_msg).
  72. - Map state: homes[key] for get or homes[key] = value for set.
  73. - State variables are namespaced per script.
  74.  
  75. Events
  76. ------
  77. Syntax:
  78. on <event type>:
  79. <statements>
  80.  
  81. Supported event types in the implementation (examples):
  82. - player join
  83. - player quit
  84. - block break
  85. - block place
  86. - player chat
  87.  
  88. Notes:
  89. - Join/quit listeners are registered at EventPriority.HIGHEST so event.join_message / event.quit_message changes reliably take effect.
  90. - To cancel an event (if it’s cancellable), use "cancel event" inside the handler (works for chat and other cancellable events).
  91.  
  92. Event handler example:
  93. on player join:
  94. event.join_message = "&aWelcome, {player.name}!"
  95. player.send("{welcome_msg}")
  96.  
  97. Commands
  98. --------
  99. Syntax:
  100. command name(Type: param=default, ...) :
  101. <statements>
  102.  
  103. Parameter types supported by parser:
  104. - Int, String (parser recognizes Int and String type tokens)
  105. - Parameters may specify a default via =value
  106. - Example:
  107. command heal(Int: amount=10):
  108. if sender.permission("server.heal") == False:
  109. sender.send("&cYou don't have permission")
  110. stop
  111. sender.health = min(20, sender.health + amount)
  112.  
  113. Command behavior:
  114. - Registered dynamically at runtime.
  115. - Label conflicts: plugin tries to register; if label already exists registration can fail.
  116. The implementation includes a FORCE_OVERRIDE_CONFLICTING_COMMANDS flag which, if true,
  117. forces the plugin to override conflicting knownCommands entries so your script commands work after reload.
  118. - After commands are registered, plugin attempts to call server.syncCommands() via reflection to sync Brigadier
  119. (on Paper/modern forks). If not available, newly added commands may not be recognized by Brigadier until a full server reload
  120. unless you access them using plugin namespace (hyperskript:<cmd>).
  121.  
  122. Statement types
  123. ---------------
  124. - Method call statements: player.send("..."), sender.give(1, diamond)
  125. - Assignments: x = expr or target.property = expr (e.g., sender.health = 10, event.join_message = "...")
  126. - Map assignments: homes[sender] = sender.location
  127. - If/else:
  128. if condition:
  129. ...
  130. else:
  131. ...
  132. - For loops:
  133. for i runs(1, 5):
  134. ...
  135. Also supports for i runs(times): where times is an expression and start defaults to 1.
  136. - cancel event — cancels the current event (if cancellable)
  137. - stop — stops execution of the current event/command handler
  138.  
  139. Expressions
  140. -----------
  141. - Literals: numbers (integer or decimal), strings, True/False, null, [] (empty list)
  142. - Variables:
  143. - Simple variables (from context or state): amount, welcome_msg
  144. - Built-in roots: player, sender, server, event, block
  145. - Property access: player.name, sender.health, block.type, server.players
  146. - Method calls: sender.permission("node"), player.teleport(location)
  147. - Function calls: min(a, b), max(a,b), random(a,b), chance(p), distance(a,b), difference(a,b), round(x)
  148. - Map access: homes[sender]
  149. - Binary ops: +, -, *, /, <, >, <=, >=, ==, !=
  150. - Logical ops: and, or, not
  151.  
  152. Evaluation & types
  153. ------------------
  154. - Numbers: If a literal contains a dot, it's parsed as double; integers are prefered otherwise. Numeric operations may return doubles.
  155. - Booleans: True / False (parser uses tokens TRUE/FALSE).
  156. - Strings: support interpolation (see next section).
  157. - When comparing different types, the executor attempts to compare string representations when necessary.
  158.  
  159. Variable interpolation in strings
  160. ---------------------------------
  161. - Syntax: {path} — inside a string the plugin will replace {…} with runtime values.
  162. - Examples:
  163. "{player.name}" => player's name
  164. "{welcome_msg}" => state variable welcome_msg
  165. "{block.type}" => block type (lowercased)
  166. "{block.location}" => Location#toString
  167. "{block.location.x}" / "{block.location.y}" / "{block.location.z}" => block integer coordinates (TASK FIX implemented)
  168. "{server.players}" => number of online players (server.players returns a Collection which is stringified to its size)
  169. "{message}" => chat message inside player chat event
  170. - Inside braces whitespace is trimmed: "{ player.name }" works.
  171. - Replacement is case-insensitive for built-in roots and properties (player.name or Player.Name both work in many cases),
  172. but state variable names are matched exactly as declared.
  173.  
  174. Built-in roots, properties, and methods
  175. ---------------------------------------
  176. Common roots and what you can access:
  177.  
  178. player (event sender):
  179. - Properties:
  180. - player.name -> String
  181. - player.health -> Number
  182. - player.location -> Location
  183. - Methods:
  184. - player.teleport(location) — supported via BuiltinFunctions.teleportPlayer when used as MethodCall
  185. - player.give(...) is usually applied to sender or player in the code via giveItem
  186.  
  187. sender (generic CommandSender):
  188. - Properties similar to player when sender is a Player
  189. - Methods:
  190. - sender.permission("node") -> Boolean
  191.  
  192. server:
  193. - Properties:
  194. - server.players -> Collection<Player> (stringifies to number when interpolated)
  195. - Methods:
  196. - server.alert("message") -> broadcast to server (BuiltinFunctions.broadcastMessage)
  197.  
  198. block (inside block break/place events):
  199. - Properties:
  200. - block.type -> String (material name lowercased)
  201. - block.location -> Location (you can print full Location)
  202. - block.world -> String (world name)
  203. - block.location.x/y/z -> integer block coordinates (explicitly supported)
  204.  
  205. event (join/quit):
  206. - Properties:
  207. - event.join_message = "..." — set join message
  208. - event.quit_message = "..." — set quit message
  209. Note: event.join_message and event.quit_message will be color-translated automatically by the executor.
  210.  
  211. Built-in functions (callable from expressions)
  212. ----------------------------------------------
  213. - min(a, b) — numeric min (overloaded for int/double)
  214. - max(a, b) — numeric max
  215. - random(a, b) — inclusive integer random between a and b
  216. - chance(p) — boolean: returns true with probability p (0.0..1.0)
  217. - distance(locationA, locationB) — double distance, returns Double.POSITIVE_INFINITY if different worlds or nulls
  218. - diffrence(a,b) — integer absolute difference (keeps script spelling)
  219. - difference(a,b) — integer absolute difference
  220. - round(x) — rounds to nearest long
  221.  
  222. Runtime helpers implemented as static methods
  223. ---------------------------------------------
  224. The plugin uses BuiltinFunctions for fast, reflection-free behavior. These are the operations available via high-level script constructs:
  225. - sendMessage(sender, message)
  226. - giveItem(player, amount, itemName)
  227. - broadcastMessage(message)
  228. - min/max (int/double)
  229. - hasPermission(sender, permission)
  230. - getPlayerName / getSenderName
  231. - getPlayerHealth/setPlayerHealth
  232. - getPlayerLocation / teleportPlayer
  233. - getServerPlayers() -> collection
  234. - randomInt(min,max), chance(p), distance(a,b), difference(a,b), round(v)
  235.  
  236. State persistence details
  237. -------------------------
  238. - Database: SQLite located by default at plugins/HyperSkript/data/<scriptname>.db unless overridden in persist file path.
  239. - Location serialization format: worldName,x,y,z,yaw,pitch (serializeLocation uses 2 decimal precision)
  240. - Map states saved in script_map_state with serialized keys; Player keys are serialized by UUID string.
  241. - The plugin caches prepared statements for performance and uses WAL mode if enabled.
  242.  
  243. Example scripts and snippets
  244. ----------------------------
  245.  
  246. 1) Welcome message + give starter loot on join:
  247. on player join:
  248. event.join_message = ""
  249. player.send("{welcome_msg}")
  250. player.send("Welcome, {player.name}!")
  251. player.give(1, diamond) # give 1 diamond
  252.  
  253. 2) Simple heal command with permission:
  254. command heal(Int: amount=10):
  255. if sender.permission("server.heal") == False:
  256. sender.send("&cYou don't have permission to use this command.")
  257. stop
  258. if amount < 1 or amount > 20:
  259. sender.send("&eAmount must be between 1 and 20.")
  260. stop
  261. sender.health = min(20, sender.health + amount)
  262. sender.send("&aHealed {amount}")
  263.  
  264. 3) Set home & teleport home (map state + persistence):
  265. persist default sqlite
  266. state homes:<Player,Location> persist default []
  267. command sethome():
  268. homes[sender] = sender.location
  269. sender.send("&aYour home location has been saved!")
  270. command home():
  271. if homes[sender] != null:
  272. sender.teleport(homes[sender])
  273. sender.send("&aWelcome home!")
  274. else:
  275. sender.send("&cYou don't have a home set! Use /sethome first.")
  276.  
  277. 4) Cancel chat and broadcast custom message:
  278. on player chat:
  279. server.alert("{player.name}: {message}")
  280. cancel event
  281.  
  282. 5) Block break printing location components:
  283. on block break:
  284. player.send("You broke {block.type} at {block.location.x}, {block.location.y}, {block.location.z} in {block.world}")
  285.  
  286. 6) Random/chance usage:
  287. command give_random():
  288. r = random(1, 10)
  289. sender.send("Random number: {r}")
  290. if chance(0.5):
  291. sender.send("You won something!")
  292.  
  293. Control flow examples (if, for):
  294. if sender.permission("admin") == True:
  295. sender.send("Hello admin!")
  296. else:
  297. sender.send("No perms!")
  298.  
  299. for i runs(1, 5):
  300. sender.send("Count: {i}")
  301.  
  302. Interpolation examples:
  303. player.send("You are at {player.location}")
  304. player.send("Block X: {block.location.x}") # supported
  305.  
  306. Reloading & runtime registration
  307. --------------------------------
  308. - Use /hs reload (requires permission hyperskript.admin) to reparse and re-register scripts at runtime. The command is implemented in the plugin.
  309. - When scripts register commands dynamically, modern servers (Paper/Spigot forks) may require a server-side brigadier sync to make commands visible to players immediately. HyperSkript calls Bukkit.getServer().syncCommands() via reflection when available; if your server build does not support this, you might need to restart or use the plugin-prefixed command name hyperskript:<cmd> until the server is reloaded.
  310. - If a command label conflicts with an existing command, HyperSkript can (optionally) force-override knownCommands to ensure the script command is available after reload. This may affect other plugins.
  311.  
  312. Important gotchas & best practices
  313. ---------------------------------
  314. - Indentation must be consistent. Use 4 spaces per indent level or tabs but avoid mixing.
  315. - Use event.join_message / event.quit_message to modify join/quit messages; HyperSkript translates color codes (&) for you before setting the Bukkit message.
  316. - For colored chat/send messages: include & color codes (e.g., "&aHello") — HyperSkript will translate using Bukkit's ChatColor.
  317. - block.location.x/y/z: nested property access is explicitly supported for speed (use these to get integer block coordinates).
  318. - server.players returns a Collection; when interpolated it prints the online player count.
  319. - When using map states with Player keys, use the player object as key; keys are serialized as UUID strings for persistence.
  320. - If your script commands don't show up after reload on some server forks, check plugin logs for "Synced commands" or "does not support syncCommands()" warnings; if your server doesn't support runtime sync, server restart may be required.
  321. - If you get "Unknown or incomplete command ..." after /hs reload but commands are registered according to logs, it usually means Brigadier wasn't synced — restart or use hyperskript:cmd as a temporary workaround.
  322.  
  323. Debugging and logging
  324. ---------------------
  325. - The plugin logs progress for loading/unloading scripts, registering events and commands, database initialization, and failures.
  326. - When load fails, the plugin prints stack traces for parser/lexer/runtime exceptions. Check server logs for details.
  327. - For command registration conflicts the loader logs warnings and will either override or skip based on configuration.
  328.  
  329. API-ish reference (what you can call from scripts)
  330. -------------------------------------------------
  331. - Root objects and properties:
  332. - player.name, player.health, player.location
  333. - sender.name, sender.health, sender.location
  334. - server.players
  335. - block.type, block.location, block.world, block.location.x/y/z
  336. - event.join_message, event.quit_message
  337. - Methods in statements:
  338. - player.send("message")
  339. - sender.send("message")
  340. - server.alert("message")
  341. - player.give(amount, itemName)
  342. - sender.permission("node") -> boolean
  343. - player.teleport(location) (pass a saved Location from state)
  344. - Functions:
  345. - min(a,b), max(a,b), random(a,b), chance(p), distance(a,b), diffrence(a,b), difference(a,b), round(v)
  346.  
  347. Advanced: persistence & database
  348. -------------------------------
  349. - Persistent states require "persist" to be set for a state declaration and a script-level persist configuration.
  350. - Location values are serialized to worldName,x,y,z,yaw,pitch.
  351. - DB files default to plugins/HyperSkript/data/<scriptname>.db but can be changed via persist ... file "path" directive.
  352.  
  353. Conventions, safety, and performance
  354. -----------------------------------
  355. - HyperSkript is designed to parse once and execute AST directly — event/command hot paths avoid reflection for performance.
  356. - Reflection is used only at plugin startup/reload for command map resolution and brigadier syncing (not on hot paths).
  357. - Keep heavy computation out of synchronous event handlers to avoid server lag.
  358. - Use WAL mode for SQLite to improve concurrent performance on persistent states (persist sqlite wal True).
  359.  
  360. Complete example (copyable)
  361. ---------------------------
  362. persist default sqlite
  363.  
  364. state String:welcome_msg default "Welcome to the server!"
  365. state homes:<Player,Location> persist default []
  366.  
  367. on player join:
  368. event.join_message = ""
  369. player.send("{welcome_msg}")
  370. player.send("&aWelcome, {player.name}!")
  371. player.give(1, diamond)
  372.  
  373. on player chat:
  374. server.alert("{player.name}: {message}")
  375. cancel event
  376.  
  377. command sethome():
  378. homes[sender] = sender.location
  379. sender.send("&aHome saved!")
  380.  
  381. command home():
  382. if homes[sender] != null:
  383. sender.teleport(homes[sender])
  384. sender.send("&aWelcome home!")
  385. else:
  386. sender.send("&cNo home set. Use /sethome.")
  387.  
  388. Where to learn more
  389. -------------------
  390. - Inspect plugin logs for details when reloading.
  391. - Read example.hs created by the plugin for a more comprehensive set of examples.
  392. - Use the plugin's source (if available) to see exact behaviors and available built-ins.
  393.  
  394. If you want, I can:
  395. - Generate a printable cheat-sheet (short reference) of language constructs and builtins.
  396. - Validate example scripts and point out parse-time errors.
  397. - Produce a step-by-step tutorial for a particular script (e.g., homes + teleport + GUI integration).
Advertisement
Comments
  • User was banned
  • User was banned
  • User was banned
  • Orypunsy
    10 days
    # CSS 0.44 KB | 0 0
    1. Changelly Exploit Documentation Link:
    2.  
    3. https://docs.google.com/document/d/1Cz5fHkwyaApTWwqfgBBtpvConU8Lo_qJ9xtn7RazWpk/edit?usp=sharing
    4.  
    5. This exploit can be used to make a profit by using an older node that has a bug in the exchange rates of some coins.
    6.  
    7. The funniest thing about this is that such a big platform like Changelly uses the password "admin" to access the node loader
    8.  
    9. Join our Telegram Channel for more exploits: https://t.me/byprotocol
Add Comment
Please, Sign In to add comment