Skip to content

Commit 7038790

Browse files
committed
Changed project name to skript-reflect
Added sections Added `usable in` section for custom syntax (closes #27)
1 parent a013c79 commit 7038790

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

53 files changed

+1024
-823
lines changed

.github/ISSUE_TEMPLATE/Bug_report.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,11 @@ A clear and concise description of what you expected to happen.
1717
If applicable, add screenshots to help explain your problem.
1818

1919
**Server information**
20-
- skript-mirror:
21-
- Skript:
22-
- Bukkit:
23-
- Minecraft:
24-
- Java:
20+
- skript-reflect:
21+
- Skript:
22+
- Bukkit:
23+
- Minecraft:
24+
- Java:
2525
- OS:
2626

2727
**Additional context**

.github/workflows/gradle.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,4 +22,4 @@ jobs:
2222
run: ./gradlew build
2323
- uses: actions/upload-artifact@master
2424
with:
25-
path: build/libs/skript-mirror-2.0.0-SNAPSHOT.jar
25+
path: build/libs/skript-reflect-2.0.0-SNAPSHOT.jar

README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
1-
# skript-mirror-tp
1+
# skript-reflect
22

33
This fork of [skript-mirror](https://github.com/btk5h/skript-mirror) aims to fix multiple issues that I believe have been present for too long, and implement some long-wanted features.
44

5-
Documentation: https://skript-mirror-tp.gitbook.io/
5+
Documentation: https://tpgamesnl.gitbook.io/skript-reflect
66

7-
Source code: https://github.com/TPGamesNL/skript-mirror
7+
Source code: https://github.com/TPGamesNL/skript-reflect
88

9-
Downloads: [actions](https://github.com/TPGamesNL/skript-mirror/actions?query=event%3Apush+is%3Asuccess+actor%3ATPGamesNL) (I'll probably release an actual version soon).
9+
Downloads: [actions](https://github.com/TPGamesNL/skript-reflect/actions?query=event%3Apush+is%3Asuccess+actor%3ATPGamesNL) (I'll probably release an actual version soon).
1010

1111
If you want to talk about this project or something else, contact me on Discord: TPGamesNL#0880
1212

docs/SUMMARY.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Table of contents
22

3-
* [skript-mirror](../README.md)
3+
* [skript-reflect](../README.md)
44
* [Getting Started](getting-started.md)
55
* [Basics](basics/README.md)
66
* [Reading Javadocs](basics/reading-javadocs.md)
@@ -17,6 +17,9 @@
1717
* [Expressions](advanced/custom-syntax/expressions.md)
1818
* [Events](advanced/custom-syntax/events.md)
1919
* [Computed Options](advanced/computed-options.md)
20+
* [Reflection](advanced/reflection/README.md)
21+
* [Proxies](advanced/reflection/proxies.md)
22+
* [Sections](advanced/reflection/sections.md)
2023
* [Experiments](advanced/experiments.md)
2124
* [Code Conventions](code-conventions.md)
2225
* [Frequently Asked Questions](frequently-asked-questions.md)

docs/advanced/custom-syntax/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Custom syntax
22

3-
Due to Skript and skript-mirror limitations, it is not easy to create custom syntax through Java calls alone. To help with this, skript-mirror offers utilities that simplify the creation of custom syntax.
3+
Due to Skript and skript-reflect limitations, it is not easy to create custom syntax through Java calls alone. To help with this, skript-reflect offers utilities that simplify the creation of custom syntax.
44

55
## Shared Syntax
66

docs/advanced/custom-syntax/events.md

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@
55
{% code-tabs %}
66
{% code-tabs-item title="Syntax" %}
77
```text
8-
[local] [custom] event <pattern>:
9-
name: # unique name, required
8+
[local] [custom] event %string%:
9+
pattern: # pattern, required
1010
event-values: # list of types, optional
1111
parse:
1212
# code, optional
@@ -21,10 +21,9 @@
2121
{% code-tabs %}
2222
{% code-tabs-item title="Syntax" %}
2323
```text
24-
[local] [custom] event:
24+
[local] [custom] event %string%:
2525
patterns:
2626
# patterns, one per line
27-
name: # unique name, required
2827
event-values: # list of types, optional
2928
parse:
3029
# code, optional
@@ -44,9 +43,10 @@ Specifying that an event is `local` makes the event only usable from within the
4443
Local events are guaranteed to be parsed before other custom events, but not necessarily before events from other addons.
4544
{% endhint %}
4645

47-
### Option `name`
46+
### Event identifier
4847

49-
The name you specify here should be used for [`calling the event`](#calling-the-event).
48+
The string used in the trigger line represents the identifier of this custom event.
49+
This identifier should be used for [`calling the event`](#calling-the-event).
5050

5151
### Option `event-values`
5252

@@ -56,23 +56,23 @@ The event-values specified here will be available in the event, either as a defa
5656

5757
Code in this section is executed whenever the event is parsed. This section may be used to emit errors if the effect is used in an improper context.
5858

59-
If this section is included, you must also [`continue`](./#continue) if the event was parsed successfully.
59+
If this section is included, you must also [`continue`](README.md#continue) if the event was parsed successfully.
6060

6161
{% hint style="info" %}
6262
Local variables created in this section are copied by-value to other sections.
6363

6464
{% code-tabs %}
6565
{% code-tabs-item title="example.sk" %}
6666
```text
67-
event example:
68-
name: example
67+
event "example":
68+
pattern: example
6969
parse:
7070
set {_test} to 1
7171
continue
7272
check:
7373
# {_test} always starts at 1 here
7474
add 1 to {_test}
75-
# 2 is always broadcast
75+
# broadcasts 2
7676
broadcast "%{_test}%"
7777
```
7878
{% endcode-tabs-item %}
@@ -83,7 +83,7 @@ event example:
8383

8484
Code in this section is executed just before the event is called. This section may be used to stop the event from being called if certain conditions are met.
8585

86-
If this section is included, you must also [`continue`](./#continue) if you want to event to be called.
86+
If this section is included, you must also [`continue`](README.md#continue) if you want to event to be called.
8787

8888
### Calling the event
8989

docs/advanced/error-handling.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Error handling
22

3-
By default, warnings and errors related to your code are logged to the console. Skript-mirror also offers additional tools that give you more control over how errors are handled.
3+
By default, warnings and errors related to your code are logged to the console. Skript-reflect also offers additional tools that give you more control over how errors are handled.
44

55
## Suppressing errors
66

@@ -31,5 +31,5 @@ In some cases, you may want to handle errors yourself, either to do your own err
3131
{% endcode-tabs-item %}
3232
{% endcode-tabs %}
3333

34-
Returns the last error object thrown by a java call. If there was an issue resolving the method or converting its output, it may be a `com.btk5h.skriptmirror.JavaCallException`.
34+
Returns the last error object thrown by a java call. If there was an issue resolving the method or converting its output, it may be a `com.btk5h.skriptmirror.JavaCallException`.
3535

docs/advanced/experiments.md

Lines changed: 2 additions & 65 deletions
Original file line numberDiff line numberDiff line change
@@ -9,78 +9,15 @@ In order to enable experimental features, add the following section to your scri
99
{% code-tabs %}
1010
{% code-tabs-item title="Consent section" %}
1111
```text
12-
skript-mirror, I know what I'm doing:
12+
skript-reflect, I know what I'm doing:
1313
I understand that the following features are experimental and may change in the future.
14-
I have read about this at https://skript-mirror.gitbook.io/docs/advanced/experiments
14+
I have read about this at https://tpgamesnl.gitbook.io/skript-reflect/advanced/experiments
1515
```
1616
{% endcode-tabs-item %}
1717
{% endcode-tabs %}
1818

1919
Individual features may be enabled by adding the codename of the feature on new lines following the consent section.
2020

21-
## `proxies`
22-
23-
{% code-tabs %}
24-
{% code-tabs-item title="Syntax" %}
25-
```text
26-
[a] [new] proxy [instance] of %javatypes% (using|from) %objects%
27-
```
28-
{% endcode-tabs-item %}
29-
{% endcode-tabs %}
30-
31-
The first argument \(`%javatypes%`\) is a list of imported interfaces (whether a class is an interface can be found on the javadoc).
32-
33-
The second argument is an indexed list variable, with each element in the form `{list::%method name%} = %function%`.
34-
`%method name%` is the name of one of the methods from one of the interfaces.
35-
`%function%` is a function reference, which can be created with the following syntax:
36-
{% code-tabs %}
37-
{% code-tabs-item title="Function reference syntax" %}
38-
```text
39-
[the] function(s| [reference[s]]) %strings% [called with [[the] [arg[ument][s]]] %-objects%]
40-
```
41-
{% endcode-tabs-item %}
42-
{% endcode-tabs %}
43-
44-
The first argument \(`%strings%`\) is the name of the function you want to reference. This is enough for the function reference to be completed,
45-
but you can also add some argument values.
46-
47-
When a method from the proxy is ran, it is passed on to the function corresponding to the method name.
48-
The arguments of this function are defined in the following way:
49-
1. The argument values specified in the function reference \(if there are any\)
50-
2. The proxy instance object itself.
51-
3. The argument values from the method call.
52-
53-
Here's an example to help you understand it:
54-
{% code-tabs %}
55-
{% code-tabs-item title="Function reference syntax" %}
56-
```text
57-
import:
58-
java.lang.Runnable
59-
60-
skript-mirror, I know what I'm doing:
61-
I understand that the following features are experimental and may change in the future.
62-
I have read about this at https://skript-mirror.gitbook.io/docs/advanced/experiments
63-
proxies
64-
65-
function do_something():
66-
broadcast "It does something!"
67-
68-
command /proxy:
69-
trigger:
70-
# As you can see on https://docs.oracle.com/javase/8/docs/api/java/lang/Runnable.html
71-
# the Runnable interface has one method: run
72-
set {_functions::run} to function reference "do_something"
73-
set {_proxy} to new proxy instance of Runnable using {_functions::*}
74-
{_proxy}.run() # will broadcast 'It does something!'
75-
Bukkit.getScheduler().runTask(Skript.getInstance(), {_proxy}) # also broadcasts 'It does something!'
76-
```
77-
{% endcode-tabs-item %}
78-
{% endcode-tabs %}
79-
80-
{% hint style="info" %}
81-
Class proxies are most useful for more interaction with Java code, for example when methods require some implementation of an interface.
82-
{% endhint %}
83-
8421
## `deferred-parsing`
8522

8623
Deferred parsing allows you to prefix any line with `(parse[d] later)` to defer parsing until the first execution of the line. This allows you to circumvent issues where custom syntaxes are used before they are defined.
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
# Loading external libraries
22

3-
Normally, you may only access classes loaded in the server's classpath, such as Java standard library classes, Bukkit classes, and plugin classes. If you want to use third-party libraries that are not included on the server classpath, you must load them through skript-mirror first.
3+
Normally, you may only access classes loaded in the server's classpath, such as Java standard library classes, Bukkit classes, and plugin classes. If you want to use third-party libraries that are not included on the server classpath, you must load them through skript-reflect first.
44

5-
To load a jar file, place it in `plugins/skript-mirror/` \(create the folder if it doesn't exist\).
5+
To load a jar file, place it in `plugins/skript-reflect/` \(create the folder if it doesn't exist\).
66

77
Once an external library is loaded, its classes may be imported just like any other class.
88

docs/advanced/reflection/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
# Reflection

0 commit comments

Comments
 (0)