Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/rtp #9

Open
wants to merge 7 commits into
base: master
Choose a base branch
from
Open

Conversation

spaceclouds42
Copy link

@spaceclouds42 spaceclouds42 commented Dec 22, 2020

This is not entirely completed as I'd like to add a few things:

  • /rtprange (currently 5k radius is hardcoded)
  • /rtpcenter (currently only uses the center of the world 0 0)
  • /rtptimeout (currently there is none, but I'd also like to add a time out to using this command because the chunk loading can cause lag)

RtpCommand.kt calls the method PlayerDataManager.setBackPos on line 61, which uses the back feature of @YTG1234's PR. this has been removed

CommandManager.literal("rtp")
.executes { rtpCommand(it) }
)
dispatcher.register(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We don't do this - see @gdude2002's comment on my tpa PR

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm confused as to what not to do and can't seem to find his comment pertaining to registering commands, which is what I'm assuming this is about

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, are you referring to him saying that each command should have its own class? /rtp and /wild are the same command, wild is just an alias for rtp, so I thought this was how to do that.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It doesn't look like an alias - since it executes the same code. The way Minecraft does aliases is creating a CommandNode or whatever it's called (I don't remember Brigadier names) and using .redirect on the alias and passing in that node.

Copy link
Author

@spaceclouds42 spaceclouds42 Dec 22, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, well I didn't really know how to create a proper alias, but what I did is how the Fabric wiki showed how to do it. I can look into it and change it though
edit: Turns out, I managed to completely misread the wiki. I don't even know how I came up with what's here right now

Copy link
Author

@spaceclouds42 spaceclouds42 Dec 22, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fun register() {
        val node = registerMain()
        dispatcher.register(
            CommandManager.literal("wild")
                .redirect(node)
        )
    }

    fun registerMain(): LiteralCommandNode<ServerCommandSource> {
        return dispatcher.register(
            CommandManager.literal("rtp")
                .executes { rtpCommand(it) }
        )
    }

I did this based on what I could understand from the wiki. In game, it creates a /wild command, but when it is run, it gives the 'unknown command' error. Got any suggestions? (also, /rtp still works as expected)

src/main/kotlin/me/gserv/fabrikommander/Common.kt Outdated Show resolved Hide resolved
@YTG1234
Copy link
Contributor

YTG1234 commented Dec 22, 2020

A question that I have is, why did you go through the pain of making this entire thing on GitHub instead of using an IDE?

@spaceclouds42
Copy link
Author

No no no, I made it all in IntelliJ, but since it's part of a project that has all your /tpa and /back features, plus /spawn and /setspawn from my other PR, I only copied over the new files that affected this feature when making this pr. Writing this all in GitHub would just be pain

it's not from this pr, it shouldnt be here
this was only used because setBackPos was being used
}

private fun getHighestBlock(world: ServerWorld?, x: Int, z: Int): Int {
val heightLimit = world!!.heightLimit
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The auto build check keeps failing, saying that heightLimit cannot be found, but it works when I build it on my computer. From what I can tell, the file I have is the same as this one except for the few /back related lines.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants