ClassySK by novystxr

Object orientation for skript in the form of classes

Events

0

Expressions

7

Effects

2

Conditions

1

Types

3

Sections

1

Structures

1

Total

15

1.2.0 Release 8 days, 19 hours and 50 minutes ago

Constant fields

This update adds constant fields, along with some bug fixes from the last update.


public const myField: integer
public static const myField: integer = 5


Constant fields can only be set as default values, or in the new instance section. Meaning they can't be changed after creation.

Changes included in this release
- added const keyword for fields
- the variable toString for class instances no longer uses it's field contents for the hash code, meaning {var::%{_myClass}%} should produce consistent results
- registered a comparator for typed and untyped instances so now %typedinstance% is %classinstance% should consistently be true
- the typed wrapper of a specific instance is now only created once so that comparing typed instances works as intended
- reworded access errors to be more helpful and specific
- changed pattern to support new ClassName as a shortened version of new instance of ClassName
- fixed nested sections in the new instance expression to properly get the source expression before checking if it can be a section

View Update

Concrete types 14 days, 1 hour and 28 minutes ago

This update primarily adds class-specific types to classysk. This was a *big* maybe for the project so I'm excited to have this working.

Old:

function example(instance: class instance):


New:
# only instances of the class Example are accepted
function example(instance: Example instance):


Changes included in this update:
- Concrete, class-specific types
- New typed/untyped instance expression
- Types that are set to serialize as a different type are now properly converted when stored in a field.
- Fields are now properly converted on deserialization, before it would only check *if* they could convert before creating the field.
- Safe calls (like ``{_var}<>::field`` which erase parse-time type information) should now function as intended, no longer throwing a null pointer exception.
- Class names can no longer be case sensitive depending on config options, fields and methods are unaffected.

Note:
- While testing for 1.21.11 on java 25+ i ran into a warning from paper's remapper. This is a minor compatibility issue from paper trying to remap internal helper classes generated by bytebuddy. It shouldn't cause issues with the plugin's functionality. To get rid of the warning, switch to java 21 or update your server.

View Update

1.0.2 Hotfix 21 days, 7 hours and 12 minutes ago

- fixed an issue where classes would be registered before methods/field were validated meaning if it failed you would get 'A class named '%s' already exists' error. whoops

View Update

1.0.1 Hotfix 22 days, 4 hours and 55 minutes ago

Changes:

- Fixed index out of bounds exception when performing an add/remove from a single field containing no value
- Changed the method call pattern to support call chaining
- Method arguments are no longer internally formatted as lowercase, which could potentially cause issues

View Update

1.0.0 Full Release 22 days, 23 hours and 16 minutes ago

1.0.0 Full Release

Changes since the last pre-release

- New instance now supports nested sections. For example:

set {_instance} to new instance of Example:
myField: new instance of Example:
otherField: 1

otherField: 2


- Methods now support keyed expressions for list arguments
- Runtime integrity check for field/method calls: prints runtime errors if the signature at runtime isn't assignable to the type reported at parse time
- Class de-registration now happens cleanly every time the structure is unloaded, no longer needing a separate clean-up listener and reducing the chance of stale classes being left in server memory. Static fields and tracked instances are now stored independently.
- Class Wrapper has been changed to Class Reference since it no longer actually wraps an instance, this has been reflected in patterns. The class reference object is planned to be used in future updates as an entry point to reflection.
- Minor method optimizations

Features included in this version


- Fields and Methods (can be static or non-static)
- Public/Private access modifiers
- Serialization for instances (can be saved after restarts)
- Parse time instance type guessing (with optional [class hints](https://github.com/novystar/ClassySK/wiki/Class-Hints))
- Ability to get the class of an instance and check what type it is
- A new instance section where you can specify initial values for fields

View Update

Pre-release #2 34 days, 4 hours and 25 minutes ago

Potentially Breaking Changes
Class Options have been outright removed. I decided to remove them while the addon is still in pre-release since they were sort of a bandaid solution for things that should really be fleshed out features. I have plans to incorporate the same functionality in better ways (like additional keywords.. etc)

Other Changes:

  • Added -> to the method return pattern so now you can do public myMethod() -> boolean
  • Instead of if {_instance} is an instance of MyClass you can now also do if {_instance} belongs to MyClass
  • Fixed a bug with the cleanup manager where it would throw an exception if the script of a class was deleted or renamed without reloading the script.
  • Now checks the case sensitive config option rather than case-insensitive variables for if classes/methods/fields should be case sensitive.
  • Internal rework of the class structure, better entry validation and actually fails to parse if there was an error. Additionally, SecMethod and EffField are no longer registered globally. In theory this should ensure conflicts dont happen and slightly reduce parse times.

View Update

ClassySK 41 days, 1 hour and 31 minutes ago

ClassySK is an addon that adds proper object orientation capabilities to skript in the form of classes. Allowing you to write powerful, defensive code and explore OOP concepts within skript!

Roadmap
Nothing here is set in stone but these are my future ambitions regarding the project (in no particular order)
- Inheritance: extending other classes
- Abstract Methods: unimplemented methods that should be implemented by inheritors
- Constant fields: fields that cant be changed after creation
- Transient fields: Fields that don't get saved
- Method and Field Reflection

Code Examples

class SmartActionBar:
public player: player
public refreshRate: integer = 1

private isActive: boolean = false
private values: strings

public play(value: string, duration: timespan):
add {_value} to self::values

if self::isActive is false:
self::start()

wait {_duration}
remove {_value} from self::values

public start():
set self::isActive to true

while self::isActive is true:
if size of self::values is 0:
exit loop

set {_text} to join self::values with "&7 | &r"
send action bar {_text} ? "" to self::player

wait self::refreshRate*1 tick

send action bar "" to self::player
set self::isActive to false


set {-actionBar::%player%} to new instance of SmartActionBar:
player: player
refreshRate: 1

{-actionBar::%player%}::play("<red>cool text", 3 seconds)

View Update

© Copyright 2014-2026 skUnity

All rights reserved.