Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/customrealms/core
Core library for the CustomRealms runtime
https://github.com/customrealms/core
bukkit gaming javascript minecraft server typescript
Last synced: 23 days ago
JSON representation
Core library for the CustomRealms runtime
- Host: GitHub
- URL: https://github.com/customrealms/core
- Owner: customrealms
- License: mit
- Created: 2021-11-10T07:29:08.000Z (almost 3 years ago)
- Default Branch: master
- Last Pushed: 2023-02-07T01:37:37.000Z (over 1 year ago)
- Last Synced: 2024-04-30T00:21:34.924Z (6 months ago)
- Topics: bukkit, gaming, javascript, minecraft, server, typescript
- Language: TypeScript
- Homepage: https://customrealms.io/core
- Size: 2.58 MB
- Stars: 31
- Watchers: 4
- Forks: 13
- Open Issues: 12
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# @customrealms/core
This repo contains the core library for CustomRealms, the JavaScript runtime for Minecraft server plugins.
### Installation
```sh
npm install --save @customrealms/core
```### Example #1 - Events
```ts
import { ServerEvents } from '@customrealms/core';// Send a welcome message when a player joins the server
ServerEvents.register(org.bukkit.event.player.PlayerJoinEvent, (event) => {
const player = event.getPlayer();
event.setJoinMessage(`${player.getName()} joined the server!`);
});
```### Example #2 - Commands
```ts
import { ServerCommands } from '@customrealms/core';// Strike lightning where the player is looking
ServerCommands.register('/strike', (player) => {
const block = player.getTargetBlockExact(100);
if (!block) return;
const location = block.getLocation();
location.getWorld()?.strikeLightning(location);
});
```## How it works
By default, without this library, the CustomRealms JavaScript runtime has access to all of the Java and Bukkit classes and functions.
This library serves several important purposes:
- Provides TypeScript type declarations for the native Java / Bukkit types.
- Implements a clean abstraction layer to make certain common tasks easier (such as commands, events, etc.)
- Adds polyfills to support modern ES6+ features.## Contributing
We need your help to implement new features, fix bugs, and optimize the entire system. If you want to help, please join our [Discord](https://discord.gg/bsTearKQsm) and/or check out the [Issues tab](https://github.com/customrealms/core/issues).