Git Product home page Git Product logo

mcdreforged-plugins's People

Contributors

ivan-1f avatar xiaohuihui233 avatar

Stargazers

 avatar  avatar

Watchers

 avatar

mcdreforged-plugins's Issues

3 SEVERE bugs

1、Command function need class Literal from MCDReforged, not from python standard library typing.
This may be caused by your auto import from IDE. MCDReforged has class Literal, but typing also has it. So your IDE make it imported from typing. That's not correct. And it will be running well in Python 3.8. Because import all from MCDReforged will overlap the import from typing. But under python 3.8, it will occur errors, because class Literal is new feature of library typing. It will cause ImportError.

2、Runtime error was caused by incorrectly method call.
Your code line 37 has a severe bug.

server.register_command(Literal(PREFIX).runs(lambda src: src.reply(help_msg)).then(Text('player').runs(lambda src, ctx: src.reply(reply_info(server, src, ctx)))))

Look at the end of this line. You make method run() to call src.reply(), and put arguments reply_info() in it. But see below:

def reply_info(server: ServerInterface, src: CommandSource, ctx):
	api = server.get_plugin_instance('minecraft_data_api')
	dim = api.get_player_dimension(ctx['player'])
	cord = api.get_player_coordinate(ctx['player'])
	src.reply('§6{} §7@ {} [x:{}, y:{}, z:{}]'.format(src.player, dim_convert[dim], int(cord.x), int(cord.y), int(cord.z)))

There is already a call to src.reply() made by reply_info() and you didn't return anything from function reply_info(). That will make None put to src.reply() and raise an error.

3、After fix 2 bugs above, there was a little functional bug. When I want to see the location of player Alex, I run command !!where Alex. But the result of my calling shows my name not Alex. See picture:
QQ图片20210628161238
That's not correct.

I have commited a pull request to fix these bugs. Please review and merge it. And wish you can make some tests next time you write a plugin. : )

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.