Coder Social home page Coder Social logo

pyplugins / pyplugins Goto Github PK

View Code? Open in Web Editor NEW
27.0 27.0 1.0 113 KB

Python Plugins loader plugin for Minecraft Spigot (Jython)

Home Page: https://www.spigotmc.org/resources/pyplugins.79244/

License: MIT License

Java 78.60% Python 21.40%
minecraft minecraft-plugin pyplugins spigot spigot-plugin spigot-plugins spigot-resource spigot-server

pyplugins's Introduction

PyPlugins - Python Plugin Loader

GitHub GitHub release (latest by date) GitHub Release Date GitHub All Releases Spigot Spiget Downloads Spiget Stars Spiget tested server versions bStats Players bStats Servers

PyPlugins - is a plugins loader for Bukkit/Spigot (PaperMC) to load plugins are written on Python 2.7 (via Jython 2.7.2).

The creation of the plugin was inspired by Macuyiko/minecraft-python, masteroftime/Python-Plugin-Loader and cyberlis/pploader.

Installation


PyPlugins (loader)


Available two versions of the loader plugin:

  • with included Jython (recommended to use);
  • without Jython (requires inclusion of jython.jar in the folder server/lib/)

Steps:

  1. Put PyPlugins-with[out]-Jython-*.*.*.jar (download link) in your server/plugins/ directory
  2. Run server

Python plugins install


  1. Put the <PluginName>.pyplugin sources (directory or zip file) in your server/plugins/ directory
  2. Run server

Create plugin on Python

The PyPlugins contains a few way to create plugin for Spigot on Python.

It's can be:

  1. Clear Java-like approach (just write the code as a Java plugin, but using Python);
  2. Using internal pyplugins-framework (recomended);

First approach examples you can see here.

The next paragrphes about internal pyplugins-framework.

Plugin sources

Your plugin can use the following paths to the plugin source code:

  • A zip whos name ends in either .pyplugin.zip, _pyplugin.zip or just .pyplugin
  • A directory whose name ends in .pyplugin or _pyplugin (actual for windows users)

Zips with the .pyplugin extension are recommended if you release any plugins. When you use a zip, your must specify your own metadata; it will not allow guessed metadata.

When using a dir or a zip, your zip or dir must contain a main python file (with names: main.py, plugin.py, __main__.py or __init__.py) and a plugin.yml configuration file containing metadata (see the following section).

Plugin metadata

Plugins require metadata. The absolute minimum metadata is a name version and main class. The 'main' field of plugin metadata has special behavior:

  • the main is used to search for a main class before searching the default class name.

plugin.yml is able to set all metadata fields that exist in bukkit, and should be used for all plugins that you release. plugin.yml is used in all java plugins (as it is the only option for java plugins). as such, opening up java plugin jars is a good way to learn what can go in it. Or you can read about it here http://wiki.bukkit.org/Plugin_YAML Here isan example of plugin.yml:

name: SamplePlugin
main: SampleClass
version: 0.1-dev
commands:
    samplecommand:
        description: send a sample message
        usage: /<command>

Summary of fields:

  • "main" - name of main python file or name of main class
  • "name" - name of plugin to show in /plugins list and such. used to name the config directory. for this reason it must not equal the full name of the plugin file.
  • "version" - version of plugin. shown in errors, and other plugins can access it
  • "website" - mainly for people reading the code

Clear Java-like approach


Minimum requirements:

  • Main class have to be extended from PythonPlugin class. (You don't have to import it, because it is auto imported on startup of loader plugin).
  • Your main class must have onEnable() and onDisable() methods.

Code example and learn more..

The pyplugins-framework approach


The same as Java-like minimum requirements:

  • Main class have to be extended from PythonPlugin class. (You don't have to import it, because it is auto imported on startup of loader plugin).
  • Your main class must have onEnable() and onDisable() methods.

Handlers are available to easily create your Python plugin:

  • PythonCommandExecutor class (CommandsAPI)

    You can inherit your own PluginNameCommandExecutor class from PythonCommandExecutor to make handlers for "executeCommand" and "onTabComplete" actions (the command must be declared in plugin.yml). Just create methods for these actions and make the commands attribute of your PluginNameCommandExecutor class with instances of PyCommand class (with command and methods names). Also can be used as commands list acceptor (functional approach) and able to get PyCommands as first argument on initialization.

  • PythonListener class (EventsAPI)

    Similar to CommandsAPI, but with PythonListener class as parent, the listeners attribute (for save your handlers) of class with instances of PyEventHandler (requires name of method to execute, Bukkit event object and (optional) Bukkit ptiority object). Also can be used as listener list acceptor (functional approach) and able to get PyEventHandlers as first argument on initialization.

And more! Read..

Links

Donate

Follow Sponsor button on GitHub page.

Statistics

Development

NOTE:

bStats version 2.x.x does not allow the use of the org.bukkit.plugin.Plugin class for plugins and requires org.bukkit.plugin.java.JavaPlugin.

PyPlugins currently uses bStats 1.8, and needs to be added from the local jar:

mvn install:install-file -Dfile=bstats-bukkit-1.8.jar -DgroupId=org.bstats -DartifactId=bstats-bukkit -Dversion=1.8 -Dpackaging=jar

Author: @dmytrohoi

pyplugins's People

Contributors

dmytrohoi avatar makiwara avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

Forkers

makiwara

pyplugins's Issues

Command not working propertly

commands not worrking its from your github

thats my code:

class SampleCommands(PythonCommandExecutor):
    commands = [
        PyCommand('sample', 'sampleCommand', 'sampleOnTabComplete')
    ]

    def sampleCommand(self, sender, command, label, args):
        # Print to console
        self.plugin.logger.info('aaaa')
        # Print message to command sender
        sender.sendMessage(command.getName())

        # For `/sample test` send "TEST"
        if args and args[0] == "test":
            sender.sendMessage("TEST")
        return True

    def sampleOnTabComplete(self, sender, command, alias, args):
        return ['test']
class SamplePluginMainClass(PythonPlugin):

    def onEnable(self):
        # Add commands
        self.apply_command_executor(SampleCommands)
        self.logger.info("plugin enabled!")

    def onDisable(self):
        self.logger.info("plugin disabled!")

thats my plugin.yml

name: SamplePlugin
main: SamplePluginMainClass
version: 0.1-dev
commands:
  sample:
    description: send a sample message
    usage: /<command>

thats my error:

[19:56:05 INFO]: marcel1842 issued server command: /sample
[19:56:05 ERROR]: null
org.bukkit.command.CommandException: Unhandled exception executing command 'sample' in plugin SamplePlugin v0.1-dev
    at org.bukkit.command.PluginCommand.execute(PluginCommand.java:47) ~[spigot-1.17.1.jar:3284-Spigot-3892929-0ebef35]
    at org.bukkit.command.SimpleCommandMap.dispatch(SimpleCommandMap.java:149) ~[spigot-1.17.1.jar:3284-Spigot-3892929-0ebef35]
    at org.bukkit.craftbukkit.v1_17_R1.CraftServer.dispatchCommand(CraftServer.java:790) ~[spigot-1.17.1.jar:3284-Spigot-3892929-0ebef35]
    at net.minecraft.server.network.PlayerConnection.handleCommand(PlayerConnection.java:1931) ~[spigot-1.17.1.jar:3284-Spigot-3892929-0ebef35]
    at net.minecraft.server.network.PlayerConnection.a(PlayerConnection.java:1770) ~[spigot-1.17.1.jar:3284-Spigot-3892929-0ebef35]
    at net.minecraft.server.network.PlayerConnection.a(PlayerConnection.java:1751) ~[spigot-1.17.1.jar:3284-Spigot-3892929-0ebef35]
    at net.minecraft.network.protocol.game.PacketPlayInChat.a(PacketPlayInChat.java:46) ~[spigot-1.17.1.jar:3284-Spigot-3892929-0ebef35]
    at net.minecraft.network.protocol.game.PacketPlayInChat.a(PacketPlayInChat.java:1) ~[spigot-1.17.1.jar:3284-Spigot-3892929-0ebef35]
    at net.minecraft.network.protocol.PlayerConnectionUtils.lambda$0(PlayerConnectionUtils.java:30) ~[spigot-1.17.1.jar:3284-Spigot-3892929-0ebef35]
    at net.minecraft.server.TickTask.run(SourceFile:18) ~[spigot-1.17.1.jar:3284-Spigot-3892929-0ebef35]
    at net.minecraft.util.thread.IAsyncTaskHandler.executeTask(SourceFile:151) ~[spigot-1.17.1.jar:3284-Spigot-3892929-0ebef35]
    at net.minecraft.util.thread.IAsyncTaskHandlerReentrant.executeTask(SourceFile:23) ~[spigot-1.17.1.jar:3284-Spigot-3892929-0ebef35]
    at net.minecraft.util.thread.IAsyncTaskHandler.executeNext(SourceFile:125) ~[spigot-1.17.1.jar:3284-Spigot-3892929-0ebef35]
    at net.minecraft.server.MinecraftServer.bf(MinecraftServer.java:1148) ~[spigot-1.17.1.jar:3284-Spigot-3892929-0ebef35]
    at net.minecraft.server.MinecraftServer.executeNext(MinecraftServer.java:1141) ~[spigot-1.17.1.jar:3284-Spigot-3892929-0ebef35]
    at net.minecraft.util.thread.IAsyncTaskHandler.executeAll(SourceFile:110) ~[spigot-1.17.1.jar:3284-Spigot-3892929-0ebef35]
    at net.minecraft.server.MinecraftServer.sleepForTick(MinecraftServer.java:1124) ~[spigot-1.17.1.jar:3284-Spigot-3892929-0ebef35]
    at net.minecraft.server.MinecraftServer.x(MinecraftServer.java:1054) ~[spigot-1.17.1.jar:3284-Spigot-3892929-0ebef35]
    at net.minecraft.server.MinecraftServer.lambda$0(MinecraftServer.java:305) ~[spigot-1.17.1.jar:3284-Spigot-3892929-0ebef35]
    at java.lang.Thread.run(Thread.java:833) [?:?]
Caused by: org.python.core.PyException: AttributeError: 'PyCommand' object has no attribute 'executer'
    at org.python.core.Py.AttributeError(Py.java:178) ~[?:?]
    at org.python.core.PyObject.noAttributeError(PyObject.java:965) ~[?:?]
    at org.python.core.PyObject.__getattr__(PyObject.java:959) ~[?:?]
    at org.python.pycode._pyx9.onCommand$7(<iostream>:82) ~[?:?]
    at org.python.pycode._pyx9.call_function(<iostream>) ~[?:?]
    at org.python.core.PyTableCode.call(PyTableCode.java:173) ~[?:?]
    at org.python.core.PyBaseCode.call(PyBaseCode.java:306) ~[?:?]
    at org.python.core.PyBaseCode.call(PyBaseCode.java:197) ~[?:?]
    at org.python.core.PyFunction.__call__(PyFunction.java:485) ~[?:?]
    at org.python.core.PyMethod.instancemethod___call__(PyMethod.java:237) ~[?:?]
    at org.python.core.PyMethod.__call__(PyMethod.java:228) ~[?:?]
    at org.python.core.PyMethod.__call__(PyMethod.java:218) ~[?:?]
    at org.python.core.PyMethod.__call__(PyMethod.java:213) ~[?:?]
    at org.python.core.PyObject._jcallexc(PyObject.java:3565) ~[?:?]
    at org.python.core.PyObject._jcall(PyObject.java:3598) ~[?:?]
    at org.python.proxies.__main__$PythonCommandExecutor$1.onCommand(Unknown Source) ~[?:?]
    at org.bukkit.command.PluginCommand.execute(PluginCommand.java:45) ~[spigot-1.17.1.jar:3284-Spigot-3892929-0ebef35]
    ... 19 more

Load external Python libs

If I wanted to import for example requests or numpy (regardless of the reason), what would be the best way to add it?
So far I was trying to check the site-packages approach but I'm not sure exactly where the jython plugin would check.

Is there a way to get actual intellisense for the PyPlugin side?

So far i've been coding blindly just checking documentations whenever I needed to know something.
Using the Python plugin for IntelliJ, adding the spigot/paper api jars in the libraries will give you some level of intellisense but doing the same for the PyPlugins jar shows slightly different results (besides the fact that you need to remove the imports as they get injected by default) as for example PyEventHandler when importing would be PythonEventHandler and so on.

Reason for this question is, I'm trying to create a streamlined process where anyone can write fast Minecraft python plugins with as much intellisense help as possible. This would give newer newer devs more of a reason to pick this over Skript/Denizen for example

TypeError: teleport(): 1st arg can't be coerced to org.bukkit.Location, org.bukkit.entity.Entity

Hello i been trying to create a sethome plugin
so i'm using a api to save the home of the user with the users location on a json file

but when i try to teleport a player i got a TypeError
TypeError: teleport(): 1st arg can't be coerced to org.bukkit.Location, org.bukkit.entity.Entity
my json file contains the following

{"result": true, "player_name": "Parallax", "location": ["Location{world=CraftWorld{name=world},x=225.0,y=68.0,z=-146.0,pitch=37.649994,yaw=-22.8}"]}

this is my home command to teleport to "home"

def homeCommand(self, sender, command, label, args):
        sender_name = sender.getName()
        location = self.plugin.gethomeApi(sender_name)
        self.plugin.logger.info("location: "+str(location))
        w = location["location"][0][0]
        #x = location["location"][0][1]
        #y = location["location"][0][2]
        #z = location["location"][0][3]
        self.plugin.logger.info(w)
        sender.teleport(w)
        return True

in my getHomeApi i have the user location that i can access with location["location"][0][0] but at the moment of teleport the error comes in

i'm importing the next on my plugin
import os
import platform
import urllib
import json
from org.bukkit import Location
from org.bukkit.entity import Player

any idea?

Is this still actively being developed?

I really like where this was going and am planning on supporting it on my PaperMC server and even building a few plugins but I would like to know if it still has any active development?
Also are we planning on supporting the Jython 3 when it's out?

Error on py plugin load - the plugin does not load

[19:48:26] [Server thread/INFO]: [PyPlugins] Loading Plugin pluginname_pyplugin
[19:48:27] [Server thread/ERROR]: Unable to make protected void java.lang.Object.finalize() throws java.lang.Throwable accessible: module java.base does not "opens java.lang" to unnamed module @441ba490 initializing PyPlugins v0.1.0 (Is it up to date?)
java.lang.reflect.InaccessibleObjectException: Unable to make protected void java.lang.Object.finalize() throws java.lang.Throwable accessible: module java.base does not "opens java.lang" to unnamed module @441ba490
        at java.lang.reflect.AccessibleObject.checkCanSetAccessible(AccessibleObject.java:354) ~[?:?]
        at java.lang.reflect.AccessibleObject.checkCanSetAccessible(AccessibleObject.java:297) ~[?:?]
        at java.lang.reflect.Method.checkCanSetAccessible(Method.java:199) ~[?:?]
        at java.lang.reflect.Method.setAccessible(Method.java:193) ~[?:?]
        at org.python.core.PyJavaType.init(PyJavaType.java:475) ~[?:?]
        at org.python.core.PyType$Registry.createType(PyType.java:477) ~[?:?]
        at org.python.core.PyType$Registry.addFromClass(PyType.java:426) ~[?:?]
        at org.python.core.PyType$Registry.resolveType(PyType.java:352) ~[?:?]
        at org.python.core.PyType$Registry$1.computeValue(PyType.java:208) ~[?:?]
        at org.python.core.PyType$Registry$1.computeValue(PyType.java:202) ~[?:?]
        at java.lang.ClassValue.getFromHashMap(ClassValue.java:228) ~[?:?]
        at java.lang.ClassValue.getFromBackup(ClassValue.java:210) ~[?:?]
        at java.lang.ClassValue.get(ClassValue.java:116) ~[?:?]
        at org.python.core.PyType.fromClass(PyType.java:2137) ~[?:?]
        at org.python.core.PyObject.<init>(PyObject.java:85) ~[?:?]
        at org.python.core.PyJavaPackage.<init>(PyJavaPackage.java:36) ~[?:?]
        at org.python.core.PyJavaPackage.<init>(PyJavaPackage.java:33) ~[?:?]
        at org.python.core.packagecache.PackageManager.<init>(PackageManager.java:30) ~[?:?]
        at org.python.core.packagecache.CachedJarsPackageManager.<init>(CachedJarsPackageManager.java:45) ~[?:?]
        at org.python.core.packagecache.PathPackageManager.<init>(PathPackageManager.java:30) ~[?:?]
        at org.python.core.packagecache.SysPackageManager.<init>(SysPackageManager.java:57) ~[?:?]
        at org.python.core.PySystemState.initPackages(PySystemState.java:1288) ~[?:?]
        at org.python.core.PySystemState.doInitialize(PySystemState.java:1213) ~[?:?]
        at org.python.core.PySystemState.initialize(PySystemState.java:1130) ~[?:?]
        at org.python.core.PySystemState.initialize(PySystemState.java:1085) ~[?:?]
        at org.python.core.PySystemState.initialize(PySystemState.java:1080) ~[?:?]
        at org.python.core.PySystemState.initialize(PySystemState.java:1075) ~[?:?]
        at org.python.core.PySystemState.initialize(PySystemState.java:1070) ~[?:?]
        at org.python.core.PySystemState.<init>(PySystemState.java:207) ~[?:?]
        at com.dmytrohoi.pyplugins.PythonPluginLoader.loadPlugin(PythonPluginLoader.java:179) ~[?:?]
        at com.dmytrohoi.pyplugins.PythonPluginLoader.loadPlugin(PythonPluginLoader.java:99) ~[?:?]
        at com.dmytrohoi.pyplugins.PythonPluginLoader.loadPlugin(PythonPluginLoader.java:78) ~[?:?]
        at org.bukkit.plugin.SimplePluginManager.loadPlugin(SimplePluginManager.java:394) ~[spigot-1.17.1.jar:3244-Spigot-6c1c1b2-9aeb46a]
        at com.dmytrohoi.pyplugins.PythonLoader.onLoad(PythonLoader.java:83) ~[?:?]
        at org.bukkit.craftbukkit.v1_17_R1.CraftServer.loadPlugins(CraftServer.java:408) ~[spigot-1.17.1.jar:3244-Spigot-6c1c1b2-9aeb46a]
        at net.minecraft.server.dedicated.DedicatedServer.init(DedicatedServer.java:233) ~[spigot-1.17.1.jar:3244-Spigot-6c1c1b2-9aeb46a]
        at net.minecraft.server.MinecraftServer.x(MinecraftServer.java:1010) ~[spigot-1.17.1.jar:3244-Spigot-6c1c1b2-9aeb46a]
        at net.minecraft.server.MinecraftServer.lambda$0(MinecraftServer.java:305) ~[spigot-1.17.1.jar:3244-Spigot-6c1c1b2-9aeb46a]
        at java.lang.Thread.run(Thread.java:833) [?:?]

Error while using PythonCommandExecutor

Error log:

[20:40:48 ERROR]: Error occurred while enabling TestCommands v0.0.1 (Is it up to date?): AttributeError: 'TestCommandsPlugin' object has no attribute 'apply_command_executer'
org.python.core.PyException: AttributeError: 'TestCommandsPlugin' object has no attribute 'apply_command_executer'
        at org.python.core.Py.AttributeError(Py.java:178) ~[?:?]
        at org.python.core.PyObject.noAttributeError(PyObject.java:965) ~[?:?]
        at org.python.core.PyObject.__getattr__(PyObject.java:959) ~[?:?]
        at org.python.pycode._pyx3.onEnable$5(<iostream>:30) ~[?:?]
        at org.python.pycode._pyx3.call_function(<iostream>) ~[?:?]
        at org.python.core.PyTableCode.call(PyTableCode.java:173) ~[?:?]
        at org.python.core.PyBaseCode.call(PyBaseCode.java:306) ~[?:?]
        at org.python.core.PyBaseCode.call(PyBaseCode.java:197) ~[?:?]
        at org.python.core.PyFunction.__call__(PyFunction.java:485) ~[?:?]
        at org.python.core.PyMethod.instancemethod___call__(PyMethod.java:237) ~[?:?]
        at org.python.core.PyMethod.__call__(PyMethod.java:228) ~[?:?]
        at org.python.core.PyMethod.__call__(PyMethod.java:218) ~[?:?]
        at org.python.core.PyMethod.__call__(PyMethod.java:213) ~[?:?]
        at org.python.core.PyObject._jcallexc(PyObject.java:3565) ~[?:?]
        at org.python.core.PyObject._jcall(PyObject.java:3598) ~[?:?]
        at org.python.proxies.__main__$TestCommandsPlugin$5.onEnable(Unknown Source) ~[?:?]
        at com.dmytrohoi.pyplugins.PythonPlugin.setEnabled(PythonPlugin.java:72) ~[?:?]
        at org.python.proxies.__main__$PythonPlugin$3.setEnabled(Unknown Source) ~[?:?]
        at com.dmytrohoi.pyplugins.PythonPluginLoader.enablePlugin(PythonPluginLoader.java:308) ~[?:?]
        at org.bukkit.plugin.SimplePluginManager.enablePlugin(SimplePluginManager.java:500) ~[patched_1.16.5.jar:git-Paper-778]
        at org.bukkit.craftbukkit.v1_16_R3.CraftServer.enablePlugin(CraftServer.java:518) ~[patched_1.16.5.jar:git-Paper-778]
        at org.bukkit.craftbukkit.v1_16_R3.CraftServer.enablePlugins(CraftServer.java:432) ~[patched_1.16.5.jar:git-Paper-778]
        at org.bukkit.craftbukkit.v1_16_R3.CraftServer.reload(CraftServer.java:965) ~[patched_1.16.5.jar:git-Paper-778]
        at org.bukkit.Bukkit.reload(Bukkit.java:726) ~[patched_1.16.5.jar:git-Paper-778]
        at org.bukkit.command.defaults.ReloadCommand.execute(ReloadCommand.java:54) ~[patched_1.16.5.jar:git-Paper-778]
        at org.bukkit.command.SimpleCommandMap.dispatch(SimpleCommandMap.java:159) ~[patched_1.16.5.jar:git-Paper-778]
        at org.bukkit.craftbukkit.v1_16_R3.CraftServer.dispatchCommand(CraftServer.java:826) ~[patched_1.16.5.jar:git-Paper-778]
        at net.minecraft.server.v1_16_R3.PlayerConnection.handleCommand(PlayerConnection.java:2185) ~[patched_1.16.5.jar:git-Paper-778]
        at net.minecraft.server.v1_16_R3.PlayerConnection.c(PlayerConnection.java:2000) ~[patched_1.16.5.jar:git-Paper-778]
        at net.minecraft.server.v1_16_R3.PlayerConnection.a(PlayerConnection.java:1953) ~[patched_1.16.5.jar:git-Paper-778]
        at net.minecraft.server.v1_16_R3.PacketPlayInChat.a(PacketPlayInChat.java:49) ~[patched_1.16.5.jar:git-Paper-778]
        at net.minecraft.server.v1_16_R3.PacketPlayInChat.a(PacketPlayInChat.java:7) ~[patched_1.16.5.jar:git-Paper-778]
        at net.minecraft.server.v1_16_R3.PlayerConnectionUtils.lambda$ensureMainThread$1(PlayerConnectionUtils.java:35) ~[patched_1.16.5.jar:git-Paper-778]
        at net.minecraft.server.v1_16_R3.TickTask.run(SourceFile:18) ~[patched_1.16.5.jar:git-Paper-778]
        at net.minecraft.server.v1_16_R3.IAsyncTaskHandler.executeTask(IAsyncTaskHandler.java:136) ~[patched_1.16.5.jar:git-Paper-778]
        at net.minecraft.server.v1_16_R3.IAsyncTaskHandlerReentrant.executeTask(SourceFile:23) ~[patched_1.16.5.jar:git-Paper-778]
        at net.minecraft.server.v1_16_R3.IAsyncTaskHandler.executeNext(IAsyncTaskHandler.java:109) ~[patched_1.16.5.jar:git-Paper-778]
        at net.minecraft.server.v1_16_R3.MinecraftServer.bb(MinecraftServer.java:1266) ~[patched_1.16.5.jar:git-Paper-778]
        at net.minecraft.server.v1_16_R3.MinecraftServer.executeNext(MinecraftServer.java:1259) ~[patched_1.16.5.jar:git-Paper-778]
        at net.minecraft.server.v1_16_R3.IAsyncTaskHandler.awaitTasks(IAsyncTaskHandler.java:119) ~[patched_1.16.5.jar:git-Paper-778]
        at net.minecraft.server.v1_16_R3.MinecraftServer.sleepForTick(MinecraftServer.java:1220) ~[patched_1.16.5.jar:git-Paper-778]
        at net.minecraft.server.v1_16_R3.MinecraftServer.w(MinecraftServer.java:1134) ~[patched_1.16.5.jar:git-Paper-778]
        at net.minecraft.server.v1_16_R3.MinecraftServer.lambda$a$0(MinecraftServer.java:291) ~[patched_1.16.5.jar:git-Paper-778]
        at java.lang.Thread.run(Thread.java:832) [?:?]

My plugin.py file:


# /local/bin/python
# -*- coding: utf-8 -*-

from org.bukkit.event.player import PlayerBedLeaveEvent
from random import randint


class TestCommandExecuter(PythonCommandExecutor):
    commands = [
        PyCommand('test', 'testCommand', 'testOnTabComplete')
    ]

    def testCommand(self, sender, command, label, args):
        self.plugin.logger.info('executed command /testcommand!')
        sender.sendMessage('You executed command /test!')
        sender.sendMessage(sender)
        if args and args[0] == "deeznuts":
            sender.sendMessage("hahahhaha you're so funny A H A H A H A")
        return True
    def testOnTabComplete(self, sender, command, label, args):
        return ['test']


class TestCommandsPlugin(PythonPlugin):

    def onEnable(self):
        pm = self.getServer().getPluginManager()
        self.apply_command_executer(TestCommandExecuter)
        self.logger.info("Plugin enabled!")

    def onDisable(self):
        self.logger.info("Plugin disabled!")

If you want more details or information regarding this, please do ask, since I don't know what else to send

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.