Skip to content

Commit 16bf231

Browse files
committed
Bumped version to 1.3.0.
Minecraft 1.16 support!
1 parent 9a618a3 commit 16bf231

File tree

389 files changed

+4369
-745
lines changed

Some content is hidden

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

389 files changed

+4369
-745
lines changed

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# ScriptableMC-TypeScript Example & Libraries
2-
[![docs](https://img.shields.io/badge/ScriptableMC--Engine-v1.2.1-blue?style=for-the-badge)](https://github.com/astorks/ScriptableMC-Engine)
2+
[![docs](https://img.shields.io/badge/ScriptableMC--Engine-v1.3.0-blue?style=for-the-badge)](https://github.com/astorks/ScriptableMC-Engine)
33
[![docs](https://img.shields.io/badge/Read_the_Docs-gray?style=for-the-badge)](https://astorks.github.io/ScriptableMC-TypeScript)
44
## Getting Started
55
- Install [NodeJS/NPM](https://nodejs.org/en/download/) or if you're on linux/macos you can install [GraalVM-CE](https://github.com/graalvm/graalvm-ce-builds/releases/latest) which includes a NodeJS runtime
@@ -10,7 +10,7 @@
1010
## How To Compile The Source
1111
- Run the TypeScript compiler script `npm run compile` or `npm run watch`
1212
- The compiled scripts will be placed in the `dist` folder
13-
- Upload the compiled scripts to your minecraft server `scripts` folder and execute the `/jsrl` command ingame or restart the server to load the new scripts
13+
- Upload the compiled scripts to your minecraft server `scripts` folder and execute the `/smc js reload` command or restart the server to load the new scripts
1414

1515

1616
## How To Generate Documentation

src/TestPlugin/main.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,11 @@ import MinecraftVersions from '../lib/com/smc/version/MinecraftVersions.js';
2020
import SmartInventory from '../lib/com/smc/smartinvs/SmartInventory.js';
2121
import ItemBuilder from '../lib/com/smc/utils/ItemBuilder.js';
2222
import SmartInventoryProvider from '../lib/com/smc/smartinvs/SmartInventoryProvider.js';
23+
import Player$Spigot from '../lib/org/bukkit/entity/Player$Spigot.js';
24+
import ChatMessageType from '../lib/net/md_5/bungee/api/ChatMessageType.js';
25+
import BaseComponent from '../lib/net/md_5/bungee/api/chat/BaseComponent.js';
26+
import ComponentBuilder from '../lib/net/md_5/bungee/api/chat/ComponentBuilder.js';
27+
import SpigotChatColor from '../lib/net/md_5/bungee/api/ChatColor.js';
2328

2429
export default class TestPlugin extends JsPlugin {
2530

@@ -93,6 +98,8 @@ export default class TestPlugin extends JsPlugin {
9398
onPlayerJoin(listener: any, event: PlayerJoinEvent) {
9499
let player = event.getPlayer();
95100

101+
player.spigot().sendMessage(ChatMessageType.ACTION_BAR, new ComponentBuilder("Hello World!!").color(SpigotChatColor.AQUA).getParts());
102+
96103
if(CONFIG.fireworkOnJoin.enabled && player.hasPermission(CONFIG.fireworkOnJoin.requiredPermission)) {
97104
let fw = player.getWorld().spawnEntity(player.getLocation().add(0, 10, 0), EntityType.FIREWORK) as Firework;
98105
let fwm = fw.getFireworkMeta();

src/dynamic-plugins/HubSpawn/main.ts

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,9 @@ import File from '../../lib/java/io/File.js';
2828
import FileUtils from '../../lib/org/apache/commons/io/FileUtils.js';
2929
import Charset from '../../lib/java/nio/charset/Charset.js';
3030
import Command from '../../lib/org/bukkit/command/Command.js';
31+
import InventoryContents from '../../lib/fr/minuskube/inv/content/InventoryContents.js';
32+
import SmartInventory from '../../lib/com/smc/smartinvs/SmartInventory.js';
33+
import ItemStack from '../../lib/org/bukkit/inventory/ItemStack.js';
3134

3235
declare const __dirname: string;
3336
const mainWorld = Bukkit.getServer().getWorld("world");
@@ -365,4 +368,18 @@ export default class HubSpawn extends JsPlugin {
365368
let configFile = new File(playerDataFolder, uuid.toString().replace(/-/g, "") + ".json");
366369
FileUtils.writeStringToFile(configFile, JSON.stringify(data), Charset.defaultCharset());
367370
}
371+
}
372+
373+
class HubSettingsInventoryProvider {
374+
constructor(private plugin: HubSpawn) {
375+
376+
}
377+
378+
public init(player: Player, contents: InventoryContents) {
379+
contents.set(1, 1, SmartInventory.clickableItem(
380+
new ItemBuilder(new ItemStack(Material.GOLD_NUGGET)).setDisplayName(ChatColor.DARK_AQUA + "Hello World").build(), () => {
381+
382+
}
383+
));
384+
}
368385
}

src/lib/JsPlugin.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,12 @@ import MysqlWrapper from "./com/smc/utils/MysqlWrapper.js";
99
import File from "./java/io/File.js";
1010
import ScriptablePluginEngine from "./com/pixlfox/scriptablemc/core/ScriptablePluginEngine.js";
1111
import ScriptEngineConfig from "./com/pixlfox/scriptablemc/ScriptEngineConfig.js";
12-
import Material from "./org/bukkit/Material.js";
1312

1413
declare type Type<T> = { new (...args: any[]): T; };
1514
declare const engine: ScriptablePluginEngine;
1615

1716
export default class JsPlugin {
1817
public context: ScriptablePluginContext;
19-
public pluginIcon: Material = Material.STONE;
2018

2119
get pluginName(): string {
2220
return this.constructor.name;

src/lib/com/google/common/io/ByteArrayDataInput.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
declare var Java: any;
22
import DataInput from '../../../../java/io/DataInput.js'
33

4-
export default interface ByteArrayDataInput {
4+
export default interface ByteArrayDataInput extends DataInput {
55
readBoolean(): boolean;
66
readByte(): number;
77
readChar(): string;

src/lib/com/google/common/io/ByteArrayDataOutput.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
declare var Java: any;
22
import DataOutput from '../../../../java/io/DataOutput.js'
33

4-
export default interface ByteArrayDataOutput {
4+
export default interface ByteArrayDataOutput extends DataOutput {
55
toByteArray(): Array<number>;
66
write(arg0: Array<number>): void;
77
write(arg0: number): void;

src/lib/com/google/common/io/ByteStreams.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,16 +30,16 @@ export default class ByteStreams {
3030
return ByteStreams.$javaClass.limit(...args);
3131
}
3232

33-
public static newDataInput(byteArrayInputStream: ByteArrayInputStream): ByteArrayDataInput;
3433
public static newDataInput(bytes: Array<number>): ByteArrayDataInput;
34+
public static newDataInput(byteArrayInputStream: ByteArrayInputStream): ByteArrayDataInput;
3535
public static newDataInput(bytes: Array<number>, start: number): ByteArrayDataInput;
3636
public static newDataInput(...args: any[]): any {
3737
return ByteStreams.$javaClass.newDataInput(...args);
3838
}
3939

4040
public static newDataOutput(): ByteArrayDataOutput;
41-
public static newDataOutput(size: number): ByteArrayDataOutput;
4241
public static newDataOutput(byteArrayOutputSteam: ByteArrayOutputStream): ByteArrayDataOutput;
42+
public static newDataOutput(size: number): ByteArrayDataOutput;
4343
public static newDataOutput(...args: any[]): any {
4444
return ByteStreams.$javaClass.newDataOutput(...args);
4545
}

src/lib/com/pixlfox/scriptablemc/core/ScriptablePluginContext.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import EventExecutor from '../../../../org/bukkit/plugin/EventExecutor.js'
33
import InventoryManager from '../../../../fr/minuskube/inv/InventoryManager.js'
44
import JavaPlugin from '../../../../org/bukkit/plugin/java/JavaPlugin.js'
55
import Listener from '../../../../org/bukkit/event/Listener.js'
6+
import Material from '../../../../org/bukkit/Material.js'
67
import OfflinePlayer from '../../../../org/bukkit/OfflinePlayer.js'
78
import Player from '../../../../org/bukkit/entity/Player.js'
89
import PluginCommand from '../../../../org/bukkit/command/PluginCommand.js'
@@ -22,6 +23,7 @@ export default interface ScriptablePluginContext extends Listener {
2223
getEngine(): ScriptablePluginEngine;
2324
getInventoryManager(): InventoryManager;
2425
getJavaPlugin(): JavaPlugin;
26+
getPluginIcon(): Material;
2527
getPluginInstance(): any;
2628
getPluginName(): string;
2729
getPluginVersion(): Version;
@@ -34,8 +36,8 @@ export default interface ScriptablePluginContext extends Listener {
3436
registerEvent(eventClass: any, executor: EventExecutor): void;
3537
registerIncomingPluginChannel(channelName: string, listener: PluginMessageListener): PluginMessageListenerRegistration;
3638
registerOutgoingPluginChannel(channel: string): void;
37-
setPlaceholders(player: Player, placeholderText: string): string;
3839
setPlaceholders(player: OfflinePlayer, placeholderText: string): string;
40+
setPlaceholders(player: Player, placeholderText: string): string;
3941
unregisterCommand(command: PluginCommand): void;
4042
unregisterIncomingPluginChannel(channel: string): void;
4143
unregisterOutgoingPluginChannel(channel: string): void;

src/lib/com/pixlfox/scriptablemc/core/ScriptablePluginEngine.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,8 @@ export default interface ScriptablePluginEngine {
2727
getInventoryManager(): InventoryManager;
2828
getLanguageFileExtension(): string;
2929
getLanguageName(): string;
30-
getPluginInstance(_name: string): any;
3130
getPluginInstance(pluginContext: ScriptablePluginContext): any;
31+
getPluginInstance(_name: string): any;
3232
getPluginVersion(): Version;
3333
getScriptablePlugins(): Array<ScriptablePluginContext>;
3434
getStartupErrors(): Array<any>;

src/lib/com/smc/smartinvs/SmartInventoryProvider.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import InventoryContents from '../../../fr/minuskube/inv/content/InventoryConten
33
import InventoryProvider from '../../../fr/minuskube/inv/content/InventoryProvider.js'
44
import Player from '../../../org/bukkit/entity/Player.js'
55

6-
export default interface SmartInventoryProvider {
6+
export default interface SmartInventoryProvider extends InventoryProvider {
77
init(player: Player, contents: InventoryContents): void;
88
update(player: Player, contents: InventoryContents): void;
99
}

0 commit comments

Comments
 (0)