Skip to content

Commit 1a301e1

Browse files
authored
Minor grammar fixes to the developer guide (#90)
1 parent 9b37f1d commit 1a301e1

File tree

7 files changed

+35
-21
lines changed

7 files changed

+35
-21
lines changed

docs/paper/dev/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import { useCurrentSidebarCategory } from "@docusaurus/theme-common";
44
# Development Guide
55

66
Welcome to the Paper Development Guide! This guide includes information and tutorials for developers
7-
to create and expand on Paper plugins.
7+
on how to create and expand on Paper plugins.
88

99
---
1010

docs/paper/dev/event-api/custom-events.md

Lines changed: 23 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,12 @@ slug: /dev/custom-events
55
# Custom Events
66

77
Creating custom events is a great way to add functionality to your plugin.
8-
This will allow for other people to listen for your custom events and add functionality to your plugin.
8+
This will allow other plugins to listen to your custom events and add functionality to your plugin.
99

1010
## Creating a custom event
1111

12-
To create a custom event, you need to create a class that extends `Event`. Each event has a `HandlerList` that contains all the listeners that are listening for that event.
12+
To create a custom event, you need to create a class that extends `Event`. Each event requires a `HandlerList` that will contain all the listeners that are listening to that event. The only exception to this requirement is when you have an event class that cannot be fired, but serves as a parent for other events instead.
13+
An example of this is the BlockPistonEvent, which cannot be listened to directly.
1314

1415
This list is used to call the listeners when the event is called.
1516

@@ -78,7 +79,7 @@ public class ExamplePlugin extends JavaPlugin {
7879
// ...
7980

8081
public void callCoolPaperEvent() {
81-
PaperIsCoolEvent coolEvent = new PaperIsCoolEvent(Component.text("Paper is cool!"))
82+
PaperIsCoolEvent coolEvent = new PaperIsCoolEvent(Component.text("Paper is cool!"));
8283
coolEvent.callEvent();
8384
// Plugins could have changed the message from inside their listeners here. So we need to get the message again.
8485
// This event structure allows for other plugins to change the message to their taste.
@@ -121,11 +122,28 @@ public class ExamplePlugin extends JavaPlugin {
121122
// ...
122123

123124
public void callCoolPaperEvent() {
124-
PaperIsCoolEvent coolEvent = new PaperIsCoolEvent(Component.text("Paper is cool!"))
125+
PaperIsCoolEvent coolEvent = new PaperIsCoolEvent(Component.text("Paper is cool!"));
125126
coolEvent.callEvent();
126127
if (!coolEvent.isCancelled()) {
127128
Bukkit.broadcast(coolEvent.getMessage());
128129
}
129130
}
130131
}
131-
```
132+
```
133+
134+
When an event is cancellable, `Event#callEvent` will return false if the event was cancelled. This allows you to directly use `callEvent`
135+
in your if statement, instead of having to check `Cancellable#isCancelled` manually.
136+
137+
```java title="ExamplePlugin.java"
138+
public class ExamplePlugin extends JavaPlugin {
139+
140+
// ...
141+
142+
public void callCoolPaperEvent() {
143+
PaperIsCoolEvent coolEvent = new PaperIsCoolEvent(Component.text("Paper is cool!"));
144+
if (coolEvent.callEvent()) { // Directly get the output from callEvent
145+
Bukkit.broadcast(coolEvent.getMessage());
146+
}
147+
}
148+
}
149+
```

docs/paper/dev/event-api/event-listeners.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,8 @@ This method can be named anything you want, but it is recommended to name it som
2626

2727
## The listener method
2828

29-
The method body does not need to return any data, for this reason use `void` as the return type.
30-
Listeners take in a single parameter, which is the event that is being listened for.
29+
The method body does not need to return any data, for this reason, use void as the return type.
30+
Listeners take in a single parameter, which is the event that is being listened to.
3131

3232
```java title="ExampleListener.java"
3333
public class ExampleListener implements Listener {
@@ -41,9 +41,11 @@ public class ExampleListener implements Listener {
4141

4242
:::note Events
4343

44-
There is no list of events that can be listened for, however take a look
44+
There is no list of events that can be listened to, however take a look
4545
[here](https://jd.papermc.io/paper/1.19/org/bukkit/event/Event.html) to see all events that extend `Event`.
4646

47+
An event can only be listened to if it has a static `getHandlerList` method.
48+
4749
:::
4850

4951
## Registering the listener
@@ -130,5 +132,3 @@ public class ExampleListener implements Listener {
130132
}
131133
}
132134
```
133-
134-

docs/paper/dev/event-api/handler-lists.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ slug: /dev/handler-lists
44

55
# Handler Lists
66

7-
Every `Event` has a `HandlerList` that contains all the listeners that are listening for that event.
7+
Every `Event` that can be listened to has a `HandlerList` containing all the listeners that are listening to that event.
88
This list is used to call the listeners when the event is called.
99

1010
## Getting the handler list for an event

docs/paper/dev/getting-started/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import { useCurrentSidebarCategory } from "@docusaurus/theme-common";
33

44
# Development Guide
55

6-
Welcome to the Paper Development Guide! This guide includes information and tutorials for
6+
Welcome to the Paper Development Guide! This guide includes information and tutorials on
77
how to start developing plugins for Paper.
88

99
---

docs/paper/dev/getting-started/plugin-yml.md

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -194,7 +194,3 @@ A list of plugins that your plugin should be loaded __before__. They are specifi
194194
This is useful if you want to load your plugin before another plugin for the other plugin to use your plugin's API.
195195

196196
- `loadbefore: [Vault, FactionsUUID]`
197-
198-
199-
200-

docs/paper/dev/getting-started/project-setup.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@ slug: /dev/project-setup
55
# Paper Project Setup
66

77
As the Paper team primarily uses [IntelliJ IDEA](https://www.jetbrains.com/idea/), this guide will be focused on that IDE.
8-
However, the steps below should be applicable to other IDEs as well, with some minor changes.
8+
However, the steps below should apply to other IDEs as well, with some minor changes.
99

10-
The paper team uses [Gradle](https://gradle.org/) as its build system, and it's tools are implemented for Gradle.
10+
The Paper team uses [Gradle](https://gradle.org/) as its build system, and its tools are implemented for Gradle.
1111
Most of the code below can be altered to work with other build systems, such as Maven, but this guide will only cover Gradle.
1212

1313
Follow the guide [here](https://docs.gradle.org/current/userguide/migrating_from_maven.html) to learn how to migrate from Maven to Gradle.
@@ -43,7 +43,7 @@ java {
4343

4444
:::note
4545

46-
If your project creates a `src` directory automatically, you can skip this step.
46+
If your IDE creates a `src` directory automatically, you can skip this step.
4747

4848
:::
4949

@@ -95,7 +95,7 @@ When [naming](https://docs.oracle.com/javase/tutorial/java/package/namingpkgs.ht
9595
your package name should be `io.papermc`. If you do not have a domain name, you could use something like your GitHub username.
9696
If you were Linus Torvalds, your package would be `io.github.torvalds`.
9797

98-
This is all then followed by the name of your project.
98+
This is then followed by the name of your project.
9999
For example, if your project was called `ExamplePlugin`, your package would be `io.github.torvalds.exampleplugin`.
100100
This allows for a unique package name for every plugin.
101101

0 commit comments

Comments
 (0)