Macuyiko / minecraft-python

A Jython driven plugin and interpreter system for Minecraft (on top of Spigot)
BSD 3-Clause "New" or "Revised" License
227 stars 29 forks source link

Import Error (from mcapi import *) #38

Closed Roxiun closed 4 years ago

Roxiun commented 4 years ago

When running from mcapi import * I get the error:

from org.bukkit import Location, Color, Effect, Material, Sound, TreeType, Particle, FireworkEffect
ImportError: cannot import name Particle

(Running Latest python.jar release on spigot 1.8.8)

Macuyiko commented 4 years ago

That's probably because Spigot 1.8.8 did not have Particle types yet. You can try to modify mcapi to remove Particle, FireworkEffect and the methods using that. (Or see an earlier version in the commit history https://github.com/Macuyiko/minecraft-python/commits/master/ServerPythonInterpreterPlugin/python/mcapi.py

spookybear0 commented 3 years ago

Maybe there could be a version check?

Macuyiko commented 3 years ago

Yep, that's not too bad of an idea. I'd be welcome to PR for that. Preferably, mcapi.py should import the actual file it needs depending on the detected version.

Alternatively, users on older versions of Spigot should be able to make a mcapi-local.py copy and modify it accordingly.