#velocity-dev

164 messages ¡ Page 7 of 1

viral blade
#

I explained to you that that was static abuse, that's all

#

I still do that sometimes on small projects lmao

#

it's not terrible

uneven lynx
#

you said nothing about why it's so terrible

viral blade
#

read the post I sent.
I can't tell why you're not willing to

uneven lynx
#

because you started this discussion

viral blade
#

If you'd prefer I sent it,

Static variables represent global state. That's hard to reason about and hard to test: if I create a new instance of an object, I can reason about its new state within tests. If I use code which is using static variables, it could be in any state - and anything could be modifying it.

I could go on for quite a while, but the bigger concept to think about is that the tighter the scope of something, the easier it is to reason about. We're good at thinking about small things, but it's hard to reason about the state of a million line system if there's no modularity. This applies to all sorts of things, by the way - not just static variables.
answered Aug 11, 2011 at 13:18
Jon Skeet

viral blade
#

happy? that's the exact text from stack overflow

#

answer 1

uneven lynx
#

what does and anything could be modifying it. mean?

viral blade
#

the static variable

#

could be changed

#

and you have a new state

#

this is not super important for MC

#

but it's against best practices

uneven lynx
#

ok, so find me another way to do pass it and i will stop using instances

viral blade
#

wdym stop using instances?

#

and find me another way?
We were just talking about it. Dependency Injection

#

pass an instance of your plugin to methods

uneven lynx
#

stop using that ""static abuse"" as you call it

viral blade
#

yeah

#

use DI

uneven lynx
#

show me how to

viral blade
#

as zMario did

uneven lynx
#

i think it would break stuff

viral blade
#

new TestClass(this)

and inside TestClass accept an instance of your plugin

#

what stuff would it break?

uneven lynx
#

oh, like that

viral blade
#

you're using OOP Java how it was made :p

uneven lynx
#

i'll try

#

(not now because i need to first finish my plugin)

#

since is not causing performance or securety issues, i don't care that much

#

tbh

viral blade
#

again, it's probably fine

#

but it's against best practices

#

I was just trying to explain what they were doing

uneven lynx
#

you mean "it's not the best way to do it"?

viral blade
#

yes, static abuse is not the best way to do it.

uneven lynx
#

ok, i got it

uneven lynx
maiden hawk
#

Just learn the base language before jumping to API's please

uneven lynx
#

shut up

maiden hawk
#

No I don't think I will

#

use Dependency Injection

viral blade
#

^^^

#

kyngs is right

#

I know how wierd dependency injection is as a newbie

#

but you get used to it

uneven lynx
#

i asked another thing

viral blade
#

we just answered you

uneven lynx
#

nope

viral blade
#

dependency injection

#

yes we did lmao

maiden hawk
#

yes we did lol

#

Use dependency injection to do that

uneven lynx
#

that solves nothing

viral blade
#

Pass instances

#

of the variable

maiden hawk
uneven lynx
viral blade
#

what?

uneven lynx
#

as you said

maiden hawk
#

???

viral blade
#

huh

#

passing an instance

#

as a parameter

#

is fine

#

I told you not to make a public static variable

#

that was an instance of your main class

uneven lynx
#

so, it's not fine to pass an instance of a class and it's fine to pass istances of variables?

maiden hawk
#

no

#

it is fine to pass instance

viral blade
#

^^

maiden hawk
#

Why wouldn't it?

viral blade
#

it's just when you use static

uneven lynx
viral blade
#

no?

#

again, it's only static abuse if you're setting a static variable

#

like this

uneven lynx
#

i'm very confused rn

bronze yoke
#

i think everyone here is

viral blade
#

I'm a bit tired so am probably explaining things poorly

maiden hawk
maiden hawk
viral blade
#

ah

#

well, I misunderstood then

#

but I was just trying to explain that when that guy a while back passed this, he was doing a fine thing

maiden hawk
#

why wouldn't he?

uneven lynx
viral blade
#

you don't have to

#

you can though

#

if you don't need the data

#

then you don't need to

uneven lynx
#

ok, now i'm sick of this

#

so for once, can you exaplain when tf is this so called "static abuse" and when it's not

#

and what should be the correct behaviour?

maiden hawk
#

correct behavior -> dependency injection

uneven lynx
#

and how tf should do that?

maiden hawk
#

basically passing the plugin instance through constructor

uneven lynx
#

as an argument

maiden hawk
#

yes

uneven lynx
#

THEN SAY SO

viral blade
#

that's what I was trying to explain, I'm sorry of I was unclear

maiden hawk
#

it was pretty clear to me...

uneven lynx
#

"unclear" i reductive

#

very reductive

uneven lynx
maiden hawk
#

lol why are you so mad?

viral blade
#

On an entirely unrelated note, are there any examples of plugin messaging on velocity

#

I can't get it working

uneven lynx
viral blade
#

hm?

uneven lynx
#

that's the wiki website

maiden hawk
#

that isn't related to plugin messaging at all

viral blade
#

I'm trying to send a plugin message

#

to another server

uneven lynx
#

i sent you the wiki website

viral blade
#

okay...?

maiden hawk
#

as if he couldn't search that for himself

#

the wiki is very incomplete

viral blade
#

^

maiden hawk
#

you will find only basics there

#

so you need to send an message?

viral blade
#

I tried

arena.sendPluginMessage(MinecraftChannelIdentifier.create("trials", "start"), new byte[0]);
uneven lynx
viral blade
#

and could not recieve anything on the channel minecraft:trials

maiden hawk
maiden hawk
viral blade
#

ooooh

maiden hawk
#

so

uneven lynx
viral blade
#

you

viral blade
#

let's all please drop these dumb argumemts

#

noone is getting anywhere

viral blade
#

or does that always fail

uneven lynx
maiden hawk
#

if you want to send something, do it like this:
player.getCurrentServer().get().sendPluginMessage(the thing you already have)

viral blade
#

cool

maiden hawk
#

make sure to check whether player is connected to some server

uneven lynx
maiden hawk
maiden hawk
uneven lynx
maiden hawk
#

it literally is lol

uneven lynx
#

nope lmao

maiden hawk
#

or at least that's how I meant it, the fact it was send after your message should indicate that

uneven lynx
viral blade
#

guys please stop, there's no use in this

maiden hawk
#

well there's one great thing called "common sense", if I send something right after your message I am probably replying to it

maiden hawk
viral blade
#

trying it right now

maiden hawk
#

ok

#

tell me how it ends up

uneven lynx
maiden hawk
#

except it was

viral blade
#
Optional<Player> arenaPlayer = arena.getPlayersConnected().stream().findFirst();
                arenaPlayer.ifPresent(player -> player.getCurrentServer().get()
                        .sendPluginMessage(MinecraftChannelIdentifier.create("trials", "start"), new byte[0]));

doesn't work unfortunately

#

still getting nothing

#

on the other end

uneven lynx
viral blade
#

maybe the issue is the MinecraftChannelIdentifier? I just don't know how to make my own lmao

maiden hawk
#

how do you listen for it on the other side?

#

is there any player connected?

viral blade
#

yup

#
        this.getServer().getMessenger().registerIncomingPluginChannel(this, "minecraft:trials", new PluginChannelListener());
maiden hawk
#

oh that's the issue!

viral blade
#
public class PluginChannelListener implements PluginMessageListener {
        @Override
        public void onPluginMessageReceived(String channel, Player player, byte[] message) {
            System.out.println("Received message from channel " + channel);
            if (!channel.equals("minecraft:trials")) {
                return;
            }
            ByteArrayDataInput in = ByteStreams.newDataInput(message);
            String subchannel = in.readUTF();
            System.out.println("Received message from subchannel " + subchannel);
            if (subchannel.equals("start")) {
                Utils.createPlatform(Bukkit.getWorlds().get(0));
                new BukkitRunnable() {
                    @Override
                    public void run() {
                        Utils.removePlatform(Bukkit.getWorlds().get(0));
                    }
                }.runTaskLater(PVPTrialsArena.this, 20 * 8);
            }
        }
    }```
uneven lynx
maiden hawk
#

MinecraftChannelIdentifier.create("trials", "start") will create channel named "trials:start"

#

iirc

viral blade
#

ah okay

maiden hawk
viral blade
#

[PVPTrialsArena] [STDOUT] Received message from channel trials:start 😄

#

Thank You!

maiden hawk
uneven lynx
#

lol

uneven lynx
#

lmao

amber ridge
#

How do i get current server of CommandSource object?

maiden hawk
#

CommandSource can also be a console, which well, can't be connected to any server

amber ridge
#

any way to get player from commandsource?

burnt dragon
#

instanceof + cast?

amber ridge
#

let me try

copper crown
#

Is it possible to check if a kick message contains a certain String? The problem is that I don't know how to check for Components correctly :/
(Please ping on answer)

amber ridge
#
                    + event.getPreviousServer().get().getServerInfo().getName() + " ➜ "
                    + event.getServer().getServerInfo().getName() + ")";```
Why this String converted into component using Component.text(sendMessage) outputs this weird characters?
amber ridge
copper crown
amber ridge
#

how can i replace §

opaque escarp
craggy pecan
#

Make sure you have permission to run the command

burnt dragon
#

That's just bad file encoding - but yes, don't put legacy characters into components, use them properly as per the doc link. You may also want to look at the legacy component serializer or a modern tool like minimessage

bold wharf
#

think Component had a search method

#

or use the serialisers to convert it to plain text depending on needs, etc

burnt dragon
#

sounds like bad design tho - why don't you just send a plugin message or something and make velocity do a kick or whatever it is you're trying to do

amber ridge
#

is it possible to change server brand from "Paper (Velocity)" to custom text in F3 Debug?

burnt dragon
#

yes but it's not supported in velocity

amber ridge
#

so its some kind of license?

burnt dragon
#

no

#

it's just that velocity doesn't natively support removing attribution - neither does paper/etc

fossil sundial
# amber ridge so its some kind of license?

you’re free to change it with a plugin or by editing the sourcecode as long as you follow the license for whatever which you’re doing
Just know that changing it will not make the proxy unidentifiable

reef tiger
#

what version of adventure is velocity-3.0 is using?

fossil sundial
reef tiger
#

thanks

valid wasp
fossil sundial
valid wasp
#

Yup, that's fine

fossil sundial
#

Kk

bold wharf
#

need to decide on when to do a release tbqh

queen ether
#

i cant create classes and when i click on browse the project is not showed so i cant select it and so i cant create class files

rich hawk
#

this isnt really eclipse support

queen ether
#

i got said i should move to #paper-dev but ok where should i ask instead?

bold wharf
#

make sure that you're actually in a source folder

#

I mean, this is velocity dev

queen ether
#

oof sorry im dumb

queen ether
bold wharf
#

well

#

the java folder should be a source folder

#

make sure that you imported the gradle project properly

#

I can't provide support for eclipse, however

queen ether
#

okay thanks

rocky frost
#

Hello! Sorry, I have more questions on plugin messaging. Is it normal that on first initialisation of Paper and Velocity that no plugin message exchanges go through? If I reconnect a second time, it all works fine though.

fervent mantle
#

Anyone that can help me?

paper thistle
#

Is it possible to know somebody's client version on login? Aka to send them a specific server that's on a different version?

#

ah protocolversion i wager

fossil sundial
fossil sundial
fossil sundial
paper thistle
#

👍

gleaming ore
#

What version of the velocity api should I be using? 3.1 or 4.0?

#

are plugins built with api 3.1 compatible with velocity 3.2.x?

simple epoch
rocky frost
gleaming ore
fossil sundial
rocky frost
#

--- This is for registration: ---
Velocity: server.getChannelRegistrar().register(MinecraftChannelIdentifier.create("imdabigboss", "main"));

public void onPluginMessage(PluginMessageEvent event) {

Paper:
this.getServer().getMessenger().registerOutgoingPluginChannel(this, "imdabigboss:main");
this.getServer().getMessenger().registerIncomingPluginChannel(this, "imdabigboss:main", this);

public void onPluginMessageReceived(String channel, Player player, byte[] bytes) {

---This is for messaging: ---
Velocity: server.sendPluginMessage(CHANNEL_ID, b.toByteArray()); (public static final ChannelIdentifier CHANNEL_ID = MinecraftChannelIdentifier.create("imdabigboss", "main");)

Paper: player.sendPluginMessage(PLUGIN INSTANCE, "imdabigboss:main", b.toByteArray());

fossil sundial
spiral thunder
#

Is there a PlayerPreprocessCommandEvent in velocity that does provide the whole message?

#

Or would I use the PlayerChatEvent and check if it starts with /?

warm gulch
#

just CommandExecuteEvent? chat events aren't fired for commands

spiral thunder
#

That doesn't have the arguments of the command

#

Just the command label it self

warm gulch
#

that's not what i'm seeing

spiral thunder
#

Ohw, then what's the method called to get the whole message/arguments

bronze yoke
#

getCommand

spiral thunder
#

Oh, I thought that was just the command label itself

#

Well

#

ty lol

bronze yoke
#

it’s the whole command without the first slash

rocky frost
tawdry bough
#

which version of adventure does velocity 3.1.1 ship with?

burnt dragon
#

4.9.3 iirc

rich hawk
#

4.10.0

#

new ones do^

burnt dragon
#

sure, that's 3.1.2-SNAPSHOT tho :p

maiden hawk
#

^

waxen mirage
#

Hey there I have a problem with the CommandExecuteEvent
I am trying to get all commands executed on the proxy but when I go to the server and try for example to execute /foo it does not print anything.

    @Subscribe
    public void bar(CommandExecuteEvent event){
        System.out.println(event.getCommand());
        System.out.println(event.getResult());
        System.out.println(event.getCommandSource());
    }

I have registered the event subscriber and also have this in the same class

    @Subscribe
    public void foobar(PostLoginEvent event){
        Main.instance.server.getEventManager().fire(new CommandExecuteEvent(event.getPlayer(), "/test"));
    }

and this fires and also causes the bar event to fore

muted kernel
#

How I can get all the online players?

#

in the proxy

#

to put them in the tab complete

waxen mirage
fossil sundial
waxen mirage
#

But I would like to catch all the commands that are only registered on the servers not on the proxy

fossil sundial
muted kernel
fossil sundial
#

Velocity doesn’t have a network control thread
Some of the en/decoding is differently designed
As per events; everything is async; but there’s a difference between blocking and non-blocking events
Blocking events are annotated @AwaitingEvent to clearly indicate the blocked event flow
Any other events are notify only
Threads are from a thread pool and each event is fired on a future-basis from said pool
Same goes with all internal code
There is a “main” context type thread per player but that’s the only clearly linked thread

#

To put that into perspective, Velocity will use an ample amount of threads so it’s best run in a threading-friendly environment (multi-core cpu)

#

^ that especially scale out well with compression

#

Yes, usually swapped in and out with a lot more executors
But you need to remember that a Java thread doesn’t occupy a system thread fully
A single core can manage a lot of low to medium-load Java threads just fine

#

The alternative is what bungeecord does (or did? not sure) in which case if the thread hangs the proxy essentially chokes or freezes

scenic night
#

And I think only registered command work

#

But idk exactly

craggy pecan
#

No, the event is fired regardless of whether the command is actually registered

gleaming ore
#

Is there any docs for velocity plugins? Does the docs just end at the couple of website examples/event apis?

#

the event api seems pretty limited, is there a way to get the input params to the events? For example im trying to get the player once they log in, but have no real clue to get the player as the docs are super limited.

bronze yoke
#

the javadocs should help

gleaming ore
#

thanks!

fresh anchor
#

How do you do color codes with Components? the usual "&c" doesn't auto translate

fresh anchor
#

then how to use colors

oblique haven
#

Using kyori or minimessage

fresh anchor
#

That seems horrible for a configuration to allow people to change colors

oblique haven
#

How so

#

<red>Red Text <yellow>Yellow Text makes a lot more sense than &cRed Text &eYellow Text but maybe that’s me

fresh anchor
#

I'm coming from 1.8 & bungee purely so I only know &

oblique haven
#

The only difference is you have to know the names of colors

#

So like instead of 4, think dark red

fresh anchor
#

will take some getting used to

oblique haven
#

It makes a lot more sense than magic numbers

#

Random numbers arbitrarily assigned to a color seems more confusing to me

fresh anchor
#

It's just what my entire community is used to

oblique haven
#

Yeah, that’s understandable

#

Help bring them out of 2014 heh

fresh anchor
#

lol yeah, I've been living in the caves of 1.8 spigot and bungeecord for too long now, want to actually progress things along with minecraft

oblique haven
#

Kyori is the way to go

fresh anchor
#

It seems really nice

#

And modernized

#

Just need to learn it

oblique haven
#

Never a better time than now 🙂 minimessage is super cool, I recommend pursuing that

fresh anchor
#

Is there a method somewhere in getServer() to get the plugins information, the @Plugin annotation descriptor

rich hawk
#

IIrc get the class, then get the annotation?

fresh anchor
#

forgot about that

fresh anchor
#

Is spigot not used anymore? is there something else that has replaced it?

valid gazelle
#

paper

fresh anchor
#

paper is spigot

#

I mean something like velocity where it has its own base, and isn't built from bukkit/spigot

oblique haven
#

They have plans to drop spigot as an upstream

valid gazelle
#

Since it's meant for modding

oblique haven
#

PaperMC encompasses Paper and Velocity, Velocity is built up itself so it doesn’t use bungee chat, instead they use a shared lib which is kyori

Kyori has quite a few different optimizations but in general it’s a lot faster and performant than legacy.

fresh anchor
#

I really enjoy velocity

#

is ServerResult.denied() the equivalent of event.setCanceled(true)

oblique haven
#

it's more complex than "cancelled" but it gives us more options

fresh anchor
#

man this is so much nicer than legacy

oblique haven
#

100% yeah

fresh anchor
#

Does velocity have an offline player?

oblique haven
#

so no

fresh anchor
#

alr I'll just make requests through mojangs api

nimble void
#

how do i send a player to a server?

nimble void
#

why does this not work

nimble void
#

might have done this incorrectly

burnt solar
#

how to change variables in config toml and save it?

nimble void
#

I would think u need to use the snakeyml library, but i could be mistaken

burnt solar
#

snakeyml is for yml not for toml files

opaque escarp
# nimble void might have done this incorrectly

The context.getSource() method returns a CommandSource instance, which can be a player or the console. To perform an action if a player executes the command, you must perform an instanceof check and then cast the CommandSource to a Player

craggy pecan
wanton spade
#

Hey, I'm trying to pass through a favicon/server list icon during the ProxyPingEvent.

Need to do it through URL. The docs say to convert the URL to base64 first, so I do. Then I create the favicon with Favicon favIcon = new Favicon(serverIconB64);, but it's showing up as black in the server list. I'm positive that the provided URL is correct, and I can take the serverIconB64 and convert it back to the URL myself and the download works through the browser.

I'm also providing the image myself through a pipe in node.js (res.writeHead to set the Content-Type, Content-Disposition, and Content-Length and then fs.createReadStream.pipe(res)), does it need to be sent in a specific way for Velocity to accept it?

#

Did I misread ctr the docs for Favicon? It says we can pass through a "Base64 URL", which I assumed meant it can be a remote URL. But all the other helper functions that it suggests say to either pass in a path or a BufferedImage, which leads me to believe that it might not take remote URLs.

wanton spade
#

Oohh, yeah that makes total sense.

wanton spade
#

Same issue. Still black. I'm going to try passing the URL and let Java's ImageIO convert it to a BufferedImage, and use that to generate the favicon.

wanton spade
#

Same issue with creating a FavIcon via BufferedImage. The BufferedImage has the correct image data, but on the server list it's just black.

oblique haven
#

the size is important

wanton spade
oblique haven
wanton spade
oblique haven
#

because if you can get it into a similar format at a single stage of the process you could just replicate the remaining steps

#

I'd bet something you're doing from loading the url contents to distributing them is wrong

wanton spade
#

Ohp, I think something got messed up with my image. It seems fine, but the size is different and I just tried loading the exact image via path and the same thing is happening, black image. Gonna do some more testing with other images to try to track down the issue.

#

Also, the source of FavIcon is super simple. Just converts the Path to a BufferedImage, then a BufferedImage to a URI. So I think it's very likely something just got messed up with my image during development.

fossil sundial
#

Favicon.create(ImageIO.read(inputstream));
That’s what I did in my plugins

wanton spade
#

Scratch everything I just said. BufferedImages aren't working for me at all.

If I load it using ImageIO.read(inputStream) it works, but loading the file into a BufferedImage using ImageIO.read(new File("/path/to/server-icon.png")); and then create the FavIcon with Favicon.create(bufferedImage) always provides a black image.

fossil sundial
#

That’s not surprising,

#

The image reader chosen is probably not good for the image

wanton spade
#

Is there anything I can do to go about fixing it, other than downloading the file locally then using an inputStream? That's not really an option.

fossil sundial
#

ImageIO also has a .read(URL)

wanton spade
#

Yeah, same issue.

fossil sundial
#

I don’t have the workings of either in my head atm; There are other ways to encode it as b64, well other than what velocity does
If you use one of those and turn it back, provide that and send it then should work

wanton spade
#

I already tried encoding it to URI myself and had the same issue.

fossil sundial
#

Is the URI a local resource or a remote resource

wanton spade
#

It's a data URI, so the image is stored in the URI itself afaik.

fossil sundial
#

And the URI can be written to file successfully?

wanton spade
#

Yeah. The URI link itself worked fine. Triple checked. Just loading as black.

fossil sundial
wanton spade
#

I just tried uploading a brand new 64x64 png file to imgur and using the direct link as a URL in the ImageIO.read(new URL(url)), still same issue.

fossil sundial
#

I am questioning the flags or channel of the image as URI encoded
If the data didn’t amount to a picture it wouldn’t display anything except the standard sever icon
Thinking the transparency channel is broken?

#

Remember the opengl Minecraft clients use doesn’t make sense and especially these icons are finicky as hell
I bet 5$ that the icon displays correctly if you check status with a site like https://mcsrvstat.us

wanton spade
#

It sure does.

#

What does that mean?

#

The image is being processed by velocity properly, but not the Minecraft client?

#

Would that mean that I created the image incorrectly somehow? Or?

fossil sundial
#

No the image is fine
The way it’s rendered is the issue

#

And that’s not an issue with how you saved it
It’s an issue with how velocity re-encoded it

#

It’s correct but the client doesn’t think so

wanton spade
#

Oh my gosh.

#

I just restarted my client.

#

It works.

#

Are you kidding me.

fossil sundial
#

Finicky as hell

#

That’s the beauty of this with opengl

#

Probably changing one letter in the address would also have fixed or changed it

wanton spade
#

I tried deleting the server and re-adding, but I'm wondering if it keeps deleted servers cached until you restart or something.

wanton spade
fossil sundial
#

I have no fix for this
Could probably be fixed with a fabric mod to force linear encoding on this

#

That’s also the reason maps sometimes flicker ingame btw

#

Same issue

wanton spade
#

Probably, but we can't expect users to install fabric + a mod.

Ahh, interesting. Good to know. Thank you again for the help!

fossil sundial
nimble void
#

What is the proper way to get a player from an on command event?

opaque escarp
#
CommandSource source = event.getCommandSource();

if(!(source instanceof Player)){
    // the source is not a player, maybe consolecommandsource
  source.sendMessage(Component.text("You are not a Player", NamedTextColor.GRAY));
  return;
}

// the source is a player and can be casted to a player 
Player player = (Player) source;
player.sendMessage(Component.text("You are a Player", NamedTextColor.GREEN));
opaque escarp
# nimble void might have done this incorrectly

If you are trying to make a "/hub" plugin you don't need to put a listener in the CommandExecuteEvent, directly in the brigadier command you can send the player to the hub. You can be guided by a plugin I recently made for the same purpose https://github.com/4drian3d/VLobby/blob/main/src/main/java/me/dreamerzero/vlobby/commands/LobbyCommand.java

GitHub

Lobby plugin for Velocity. Contribute to 4drian3d/VLobby development by creating an account on GitHub.

nimble void
#

now that I have a bit more understanding of the velocity api, I went through and cleaned up the code. Please let me know if i did something incorrectly!

opaque escarp
opaque escarp
# nimble void now that I have a bit more understanding of the velocity api, I went through and...

There are several methods that return an optional, these methods indicate that the value they contain, will not always exist and can be null, for example, when calling a method server.getServer("lobby"); There is a possibility that either the server is not registered or the server is offline, so you should not call an Optional#get on every method that returns an optional, but you should check if it contains a value with Optional#isPresent or Optional#isEmpty before calling the Optional#get method

opaque escarp
# nimble void now that I have a bit more understanding of the velocity api, I went through and...

To compare the similarity between objects, unless it is a primitive type you should not use a comparator ==, but the #equals method. The == comparator checks if the 2 objects are exactly the same in memory, which, most of the time, does not return true. While the #equals method checks for similarity with implementation specific checks, so it may be more accurate depending on what is required

honest sierra
#

I'm sure this is a very common question but I can't find an answer, how do I teleport players to a different server from a spigot plugin?

maiden hawk
#

the same way you would do if you were running behind bungee

honest sierra
#

Inexperienced, how would that be?

maiden hawk
#

bungeecord connect player to another server -> justGoogleIt

honest sierra
#

Right, thank you

waxen mirage
#

What is the equivalent of TabCompleteEvent for 1.13+ as this works only for 1.12 or bellow according to the docs?

burnt dragon
#

there isn't one, as per the docs

waxen mirage
#

Is there then any way to block auto-completer?

burnt dragon
#

no, it's done client-side

#

what's the xy here?

robust mural
#

You can remove the commands in the PlayerAvailableCommandsEvent event

waxen mirage
robust mural
#
    public void handle(final PlayerAvailableCommandsEvent event) {
        if (!event.getPlayer().hasPermission("system.admin")) {
            event.getRootNode().getChildren().clear();
        }
    }```
burnt dragon
#

which is cringe solution that doesn't do anything security wise other than annoy people and reduce accessibility

#

just create your commands properly in the first place

#

ez

waxen mirage
burnt dragon
#

yes

#

again, just make your commands properly and then you wouldn't have to do anything of this

waxen mirage
#

Yeah I already have lots of plugins that do not do it properly and I want to implement this to clear the mess

#

Would there be a way to filter server side commands also. So it will only allow certain commands to be auto completed?

opaque escarp
# burnt dragon yes

Can the proxy really remove the commands registered by the server that are sent to the player? or even know of their existence?

burnt dragon
#

yes

#

commands go from the server through the proxy to the player

oblique haven
#

What are you trying to do

#

Like what’s the goal

cloud iron
#

Heyo,
Just trying to get started on Plugin Messaging within Velocity, does anyone have a good link or way to get started with that?

fossil sundial
cloud iron
#

Awesome thank you!

fossil sundial
#

There’s a semi-supported way of intercepting packets- See how ViaVersion or Geyser injects by replacing the channel initializer

#

But it’d be better to know why you’re trying to do this beforehand

cloud iron
fossil sundial
cloud iron
#

If that makes any sense

fossil sundial
#

You can iterate through the registered servers and send the message to all
But beware that the messaging api only works as long as at least one player is connected to the server that’s supposed to get the message

cloud iron
rocky frost
#

Hello! Is there a way that I can subscribe to events like interactions, block placements, and stuff like that with Velocity? I'd rather do it network wide, rather than on every server.

bold wharf
#

well, no

#

technically, yes, but, well

#
  1. velocity doesn't care about that stuff so doesn't decode those packets and just passes them through
#
  1. velocity wouldn't know what you interacted with, given that info only exists on the server/client
rocky frost
#

Ok. So I'll have to do it in a plugin. Just means a bit more organisation for me then. Can't do it the lazy way XD

fossil sundial
#

You're a lot better off using login-plugin-messaging. That wont require a hack and since youre using a client mod you might as well use that

#

Velocity is one of the only non-modded platforms that has native api support for it (already)

ashen pawn
#

For anyone who wants to play with the bleeding edge.. see the dev/netty-5 branch, where I've made initial progress in moving Velocity to use the very first Netty 5 alpha.

CAUTION: Don't use this branch where you care about the integrity of your server. It's not going to work with plugins that grovel down into the Netty layer to do their work like Geyser or ViaVersion. HAProxy is not currently supported. I have only lightly tested this, and it works insofar as you can authenticate to the proxy - the rest is up to you.

And I am not going to make development builds available, you get to build it yourself.

ripe pier
#

any way to make aliases with the /server command?

example: /s for /server smp

#

preferably a plugin (not mycommand), idk how to code

bold wharf
#

then don't crosspost, especially into the dev channels...

ripe pier
#

mb

woeful rose
oblique haven
#

Not entirely sure, looks like the runnable you’re assigning isn’t properly interfaced as a command - but that’s just my initial guess

#

Can’t tell from initial glance though

#

It looks like it needs to serialize it - I assume something with that command or simple command class has something to do with setting that up

woeful rose
#

Hum okay I work with someone who use a thread for his plugin. It's required to do a thread for a command ?

#

Did you need to see my main class ?

craggy pecan
#
GitHub

Brigadier is a command parser & dispatcher, designed and developed for Minecraft: Java Edition. - brigadier/StringArgumentType.java at cf754c4ef654160dca946889c11941634c5db3d5 ¡ Mojang/brigadier

agile ore
#

Hi
How i can create a .yml config file in velocity plugin
:saD:

coral hedge
agile ore
#

I can't find anything about yamls that's why I ask for help

#

if anyone could help me i would appreciate it

rich hawk
#

configurate

#

is provided in the jar

agile ore
#

But there are any example code?

burnt dragon
#

configurate has a wiki yes

fleet sailBOT
naive patrol
#

is configurate actually available on velocity?

#

I can't find org.spongepowered

agile ore
#

look

#

i have this from configurate repo

#

but i dont know how register and use in other class

oblique haven
#

Read this, and go through it, and you should be able to figure it out

#

If anything we would just be quoting the wiki so

burnt dragon
#

sponge also has a discord

agile ore
# oblique haven If anything we would just be quoting the wiki so

i can register but, how i can do for example
final ConfigurationNode countNode = root.node("messages", "count");
final ConfigurationNode moodNode = root.node("messages", "mood");

final @Nullable String name = root.node("name").getString();
final int count = countNode.getInt(Integer.MIN_VALUE);
final @Nullable Mood mood = moodNode.get(Mood.class);

#

this

#

In another class other than the main

burnt dragon
#

well, that's just java

#

id rec doing something like jetbrains academy before you start developing plugins

naive patrol
rich hawk
#

velocity contains 3.x

naive patrol
#

3.7.2 for gson and hocon
4.1.2 for yaml

#

apparently

opaque escarp
naive patrol
#

Oh nvm the 4.1.2 is because of my core dependencies overriding

#

thanks guys

obtuse umbra
#

Paper is literal ass

#

Terrible server hoster

#

Trash af

worldly meadow
#

Why?

oak frigate
#

He's a troll, he got removed, dw

valid gazelle
#

did not know that paper is apparently a server host!

oak frigate
#

I wish

#

I heard they make bank

opaque escarp
narrow pagoda
#

He's banned lol

oak frigate
#

Nah I just kicked them

#

If they would be banned, the messages would be nuked

gleaming ore
#

is there an api event for when a player disconnects? I can only see when the player is kicked.

oak frigate
#

playerquitevent

oak frigate
#

fuck

#

I need to remute this channel 😄

gleaming ore
#

perfect thank you guys ;)

glossy perch
#

My server selector plugin uses the BungeeCord plugin messaging channel to send players to servers. Reportedly, this does not work with Velocity when configured in modern forwarding mode (I know it works in classic mode).

I couldn’t find any mention in the documentation about the BungeeCord messaging channel with regards to modern forwarding. Does modern forwarding use the BungeeCord messaging channel, or something else?

fossil sundial
#

Inconsistent UUIDs will cause this is what I’m saying

glossy perch
#

Will check that after eating thx for the answer SmirkGuns

glossy perch
#

Tried Fabric-Proxy and Fabric-ProxyLite

fossil sundial
glossy perch
#

Thx 1304_pepe_thumbsup

deep rain
#

Hello everyone, if I want to modify the tab response sent by the server to players, what events should I monitor? (in BungeeCord, it is "TabCompleteResponseEvent". I'm migrating from bc to velocity, but I can't find the corresponding event. I only found "TabCompleteEvent", but it only supports 1.12.2 and below)

bold wharf
#

I don't think that velocity exposes that

deep rain
#

Oh, I'm making a feature to replace the player list because my plugin has the ability to operate across servers.
If velocity does not have this API, it seems that more complex operations are required. 😭

fossil sundial
deep rain
#

ok, thank you!

glad solstice
#

Hi, when is velocity adding 1.18.2 support? My server hosting is Exaroton.

sour current
#

Velocity already supports 1.18.2

burnt dragon
#

grab a build from the downloads page, velocity has supported 1.18.2 for like a month now

atomic leafBOT
visual fjord
#

If an exception happens in initalizing my plugin, what can I call to mark it as such in Velocity?

#

e.g. if something critical happens to where my plugin cannot function properly, can I force the Velocity server to shutdown or unload my plugin in response?

#

Specifically during the initialization stage

oblique haven
#

what kind of errors are you seeing which would be critical which you can't catch yourself?

visual fjord
#

I can catch them just fine, but if the error occurs, the plugin can't function at all afterward

#

I was looking in the api for a built in shutdown method

oblique haven
#

ProxyServer#shutdown

humble willow
#

I have a question, so i want to create a config file for my velocity plugin but idk how to create a Configuration file can someone help me?

visual fjord
#

thanks

amber ridge
#

Is it possible to track which subdomain is player using to join server?

bold wharf
#

Yes, you can get the hostname used off the players connection or something iirc

oblique haven
#
Player#getVirtualHost()``` this is the method
amber ridge
#

Is it possible anyway to get proxy bind port in ProxyInitializeEvent?

amber ridge
oblique haven
tired quarry
tired quarry
# tired quarry perhaps it is not this?

Hostname or IP, e.g. localhost or 127.0.0.1, that was used to connect. The Notchian server does not use this information. Note that SRV records are a simple redirect, e.g. if _minecraft._tcp.example.com points to mc.example.org, users connecting to example.com will provide example.org as server address in addition to connecting to it.

fossil sundial
#

Stricken text unrelated got confused in the process of reading the messages

queen pasture
#

How do I change the player count which is shown in the server list?

#

I could find a getPlayerCount() method.

#

But not a setPlayerCount()

bold wharf
#

that method iirc was on another object

#

you'd create a new instance of that other object and set it on the event

maiden hawk
queen pasture
#

Got it thanks

winged pike
#

is there a getDataFolder() in velocity, similar to JavaPlugin#getDataFolder() in paper?

#

nvm @DataDirectory is something

winged pike
#

what about using minimessage in velocity?

oblique haven
#

At least it does in the latest dev

winged pike
#

ohhh thats why my plugins didn't work yesterday, it wasn't in the stable build yet

tawdry sky
#

How do I detect when a plugin message got recieved?

#

Need it for LabyMod API

sick ether
#

Hi, why this dont work?

public class ChatListener {
    @Subscribe(order = PostOrder.FIRST)
    public void onChat(PlayerChatEvent event) {
        final Player player = event.getPlayer();
        if (player.hasPermission("pl.rafi67000.velocitycore.chat.premium")) {
            String message = event.getMessage();
            String replacedMessage = message.replace("test", "testooowawiadomosc");
            event.setResult(PlayerChatEvent.ChatResult.message(replacedMessage));
        }
        }
    }
jolly sandal
#

Hi guys do you know how could I remove this useless exception thrown by Velocity when a player tries to connect to an offline server with the /server command:

io.netty.channel.AbstractChannel$AnnotatedConnectException: finishConnect(..) failed: Connection refused: /
Caused by: java.net.ConnectException: finishConnect(..) failed: Connection refused
        at io.netty.channel.unix.Errors.newConnectException0(Errors.java:155) ~[velocity.jar:3.0.2-SNAPSHOT (git-effca0da-b70)]
        at io.netty.channel.unix.Errors.handleConnectErrno(Errors.java:128) ~[velocity.jar:3.0.2-SNAPSHOT (git-effca0da-b70)]
        at io.netty.channel.unix.Socket.finishConnect(Socket.java:312) ~[velocity.jar:3.0.2-SNAPSHOT (git-effca0da-b70)]
        at io.netty.channel.epoll.AbstractEpollChannel$AbstractEpollUnsafe.doFinishConnect(AbstractEpollChannel.java:710) ~[velocity.jar:3.0.2-SNAPSHOT (git-effca0da-b70)]
        at io.netty.channel.epoll.AbstractEpollChannel$AbstractEpollUnsafe.finishConnect(AbstractEpollChannel.java:687) ~[velocity.jar:3.0.2-SNAPSHOT (git-effca0da-b70)]
#

Its much bigger I had to cut it

bronze yoke
#

do you have your firewall set up correctly

sick ether
#

Hi, why this dont work?

public class ChatListener {
    @Subscribe(order = PostOrder.FIRST)
    public void onChat(PlayerChatEvent event) {
        final Player player = event.getPlayer();
        if (player.hasPermission("pl.rafi67000.velocitycore.chat.premium")) {
            String message = event.getMessage();
            String replacedMessage = message.replace("test", "testooowawiadomosc");
            event.setResult(PlayerChatEvent.ChatResult.message(replacedMessage));
        }
        }
    }
night forum
#

Hi i was wondering about safe way to execute commands for example give user i specify specified rank from my other service on the same server is there any hooks or is the rcon the safest way to go?

agile ore
#

how i can teleport another player to a server

#

I has try 2 plugins.... 😦

sick ether
ripe sluice
sick ether
ripe sluice
#

I believe he meant change server

agile ore
#

is there a velocity plugin github I can look at for brigadier commands? I have a command /party test <player> but the player argument is triggered instead of test literal argument. I want to know what literal is used from inside the player arg executes

sick ether
#

limboauth

#

PremiumCommand.java

agile ore
#

that uses simple command

#

could be a lot easier to write with simple though

#

I see a lot of plugins using it instead of brigadier

broken lance
#

Any way to send a plugin message from a spigot server to another without the server you are sending from and to have player

undone pumice
#

hi, when my server restarts, an error is thrown in console
[18:40:34] [Netty epoll Worker #1/INFO]: [connected player] mastermc05 (/*ip*:33631) has disconnected: An internal server connection error occurred.
because this is a disconnect, not a kick, my plugin can't detect this, and also i'm not redirected to limbo
I'm using the same configs as on my pc, and when i connect trough my pc it works well, but if from pterodactyl, it has some troubles
Can somebody give me at least a hint what may be wrong?

craggy pecan
bold wharf
#

like, restarting a server /shouldn't/ cause that

undone pumice
#

but it happens every time on restart, and most strange, on the same server, but from 2 different proxies (with the same secret), one has error, the remote one doesn't have

#

and when the error happens, i'm kicked with a delay

#

i wabt to try rebooting the vds now,when there will be 0 players

#

is there a way to enable like debug level for more logs on that error?

oblique haven
#

What have you tried

#

Have you done any debugging at all?

#

What plugins do you run?

sick ether
#

chatregulator litebans luckperms party and friends clans report helpop velocitycore vtools

sick ether
oblique haven
#

What part of it

#

Does it run

#

Does it check the permission

sick ether
#

replace TEST in message to another text

oblique haven
#

What’s the result of the permission check

#

Have you done ANY debugging?

sick ether
#

no

oblique haven
#

You should

#

Please go debug your code and let us know what isn’t working

vocal locust
#

does velocity provide a plugin config?

sick ether
fading pond
#

Hey, I'm trying to work with plugin messaging with Velocity 3.1.2 but it doesn't seem to be working.
Plugin channels have been registered in both plugin/proxy plugin

    @EventHandler
    fun on(ev: PlayerJoinEvent) {
        val p = ev.player

        val baos = ByteArrayOutputStream()
        val dos = DataOutputStream(baos)

        dos.writeUTF("Test")
        p.sendPluginMessage(this, "messagechannel:proxy", baos.toByteArray())

        logger.info("sent plugin message to messagechannel:proxy")
    }

This is the test code I'm using to quickly send a message
And this is my receiver

    @Subscribe
    fun onPluginMessageEvent(ev: PluginMessageEvent) {
        logger.info("Hit event // ${ev.data}")
    }

It seems to be sending the message but the proxy isn't receiving it, any ideas as to why this is happening? Ping me if you know, thank you!

Solution: Wait a few ticks before sending the plugin message.

#

Also this is how I'm registering the channels on Server/Proxy
Server: server.messenger.registerOutgoingPluginChannel(this, "messagechannel:proxy")
Proxy: proxy.channelRegistrar.register(MinecraftChannelIdentifier.create("messagechannel", "proxy"))

maiden hawk
maiden hawk
#

The format is supposed to be
pluginname:channel

maiden hawk
fading pond
maiden hawk
#

Are you sure?

fading pond
#

Might not have read the error properly, hold on.

#

java.lang.IllegalArgumentException: Channel must contain : separator (attempted to use proxy)

#

nah was right

maiden hawk
#

Try to change the name to only "proxy" on the server, and in the mcchanneliden. use "your plugin name", "proxy"

maiden hawk
fading pond
#

yeah

maiden hawk
#

Or the proxy?

fading pond
#
        val pre = ""
        server.messenger.registerOutgoingPluginChannel(this, "${pre}proxy")
#

server

fading pond
maiden hawk
fading pond
#

Thanks in advance.

maiden hawk
#

Oh my bad

#

So

fading pond
#

whats up

maiden hawk
#

The thing you had originally should

#

Work

#

Weird

fading pond
#

oof

#

Do I have to wait a few seconds after PlayerJoinEvent to send a plugin message?

maiden hawk
#

Oh wait

#

Yeah

#

Iirc you should

fading pond
#

Thanks

maiden hawk
#

Lol not like I helped you much anyway glhf

fading pond
#

thanks 👍

maiden hawk
#

👍

oblique haven
#

@fading pond is this on a minehut proxy? if so it might have some weird behavior with plugin messaging

#

so I urge you to test on both if that's the plan

#

I haven't heard anything conclusive yet - but I think it was listed as a potential issue when we were working on the connection stuff

fading pond
#

No idea if anything funky happens with MH

fading pond
queen pasture
#

As far as I know you can't really prevent ddos attacks with software u will need hardware level mitigation like OVH does. Bot attacks can be mitigated by using plugins such as bot sentry.

agile ore
#

I will change the server from a player

#

./send doesnt work

#

But nobody can me help 😦

#

I WILL THAT I can send a Player to a another SERVER

#

I have try 2 plugins...... but they doesnt works

agile ore
#

sorry

#

but i have the problem 3 days

ebon siren
#

Player.createConnectionRequest(RegisteredServer server)

#

Then .connect(), .connectWithIndication() or even .fireAndForget()

ebon siren
#

@agile ore

agile ore
#

i dont understand how i make this in my plugin

ebon siren
#
  1. Don't make proxyserver final as you intend to change it
bold wharf
#

that's their constructor, they just named the class name lowercase

ebon siren
#

The moment command is called it will raise an error

bold wharf
#

It's a constructor.

#

it's called on creation of the instance of the class

ebon siren
#

Ohh, I just realized it

#

who tf names their classes lowercase lol

maiden hawk
queen pasture
#

hey how do i schedule an async task in velocity

#

like i do in spigot

#

is this async by default?

burnt dragon
#

velocity doesn't really have the concept of "sync"

queen pasture
#

ow

#

nice

#

no worries then

half lodge
#

Synchronize thread in Netty boss event loop group and see what will happen

queen pasture
#

btw how do i evaluate a math operation given in a string form. for.eg. "1+1*5-8". is there some kind of parser?

bold wharf
#

there are several libraries out there for that type of stuff

queen pasture
#

hmm

#

i will check

half lodge
queen pasture
#

is this performance heavy?

agile ore
#

That is a horrible way of doing what you're trying to do

ebon siren
#

Can default java run js?

queen pasture
#

i just found it on stackoverflow

#

lol

ebon siren
#

Well, for me the only way of running js was through rhino js

agile ore
#

there are like only five operators lmao, just "hardcode" it

slate hamlet
half lodge
agile ore
queen pasture
#

ow EvalEx looks good

maiden hawk
#

*15

queen pasture
#

Btw I noticed that velocity lacks basic bungeecord commands. If i do a pull request adding all bungee commands will it be accepted?

maiden hawk
#

Most likely not

bold wharf
#

probably not

#

there are already plugins which reimplement some of them

queen pasture
#

Yea it's one thing to have them in plugins and another thing to have them natively

#

Makes life easier for end user

bold wharf
#

"ideal" situation is that somebody creates something like an essential suite of plugins which implements all the more opinionated stuff

maiden hawk
#

Velocity wants to be lightweight, this seems like bloat to me

bold wharf
#

it means that we then have to maintain that stuff, and then you end up in the case of like bungee where all the builtin commands haven't progressed anywhere in 5 years

maiden hawk
bold wharf
#

things like /send produce extra verbose stuff which is considered needless to many but there is no configuration options for, etc

queen pasture
#

Well if you see it that way a simple /server command doesn't need maintenance other than potential bug fixes.

maiden hawk
#

Look, I even needed to disable the integrated /server command

bold wharf
#

simple

#

I mean

#

velocity doesn't even have server restrictions

maiden hawk
#

Custom messages

#

Etc.

bold wharf
#

so that's already 1 feature people want which doesnt exist in velocities server command

queen pasture
maiden hawk
#

If it were on me, I would remove the /server command

#

because I have issues overriding it

queen pasture
#

U can just remove /server permission from default group

#

And use some other plugin to handle server transfers

maiden hawk
#

yes, but I want to override the command

maiden hawk
queen pasture
#

But y do you need to override that particular command u can make a new command like /s <serverName> and use that every where

maiden hawk
#

No @analog dew , I won't use Cloud

#

It is unnecessarily complicated.

#

☀️

bold wharf
#

I mean, last I saw you can practically use it akin to ACF or close enough

#

ACF should have a force param for registering commands last I saw

maiden hawk
#

idk, ACF seems more user friendly to me eShrug

queen pasture
#

What is ACF?

#

kinda dumb question

maiden hawk
#

Aikar's Command Framework

queen pasture
#

Ow i never heard of that

#

Wait so it's something new for paper command handling?

maiden hawk
#

Well it's everything but new

queen pasture
#

I am hearing the term for the first time

#

I just found it on spigot damn it looks good

maiden hawk
#

well the velocity support is a bit whacky

#

but it is in the todo list

queen pasture
#

I see

burnt dragon
#

cloud supports velocity really nicely

rich hawk
#

you can unregister the server command?

maiden hawk
#

And migrating command framework is the last thing I have time for ATM

vocal locust
#

does velocity-api ship with gson or some other impl?

thick bramble
#

Yes, gson

amber ridge
#

Is it possible to open inventory / sign editor for player from proxy or i need to have plugin on each backend and send message to it?
Is there any working ex how do i register proxy cmd?

haughty dune
#

Does meloncube support papermc?

rich hawk
#

x post

craggy pecan
ashen fiber
queen pasture
#
Invalid ID for plugin FalconClientSpigot.FalconMainVelocity. IDs must start alphabetically, have alphanumeric characters, and can contain dashes or underscores.
``` im getting this error while compiling
#

a velocity plugin

#

any fix?

bronze yoke
#

what is your plugin id?

queen pasture
bronze yoke
#

there's your problem

#

IDs must start alphabetically, have alphanumeric characters, and can contain dashes or underscores.

queen pasture
#

im having trouble understanding

#

do i start like abcd

bronze yoke
#

no

#

your id must be lowercase iirc

queen pasture
#

ow got it

bronze yoke
#

and I don't think you can use numbers but i might be wrong

ebon siren
#

I think you can

queen pasture
#

yeah i renamed the module

#

lol

bronze yoke
#

that's not their plugin id

pine holly
#

Hey, I have a little problem with ping-delay of 5-6s on the server list of my Minecraft client when pinging a Velocity proxy. Is this a known problem?

ruby spear
#

is this intended, there's no response and it was opened in January

pine holly
#

I'm not talking about kicked people, I'm talking about pinging clients

ruby spear
queen pasture
#

why does it show incompaitible version

#

im just changing the online value

ruby spear
queen pasture
#

1.16.5

#

im also changing the motd

#

on ping event

#

do i need to do something here?

ruby spear
queen pasture
#

ah i see

#

got it lemme try

#

also how to do this?

#

what do i need to modify?

ruby spear
queen pasture
#

bascically when u hover over the playercount

queen pasture
queen pasture
ruby spear
# queen pasture this one
 @Subscribe
    public void onPing(ProxyPingEvent event) {
        ServerPing.Builder builder = event.getPing().asBuilder()
                .description(description);
        event.setPing(builder.build());
    }

set the description to a Component

queen pasture
#

i already did

#

but it only changes the motd

#

like so

ruby spear
#

oh sorry

queen pasture
#

this shows when i hover over the playercount

#

what is it called?

ruby spear
queen pasture
#

so those are player names?

ruby spear
#

maybe?

queen pasture
#

thats a cool trick

ruby spear
#

maybe it's mods, idk

queen pasture
#

hmm i'll try both

ruby spear
#

google probably has the answer

pine holly
ruby spear
#

they are using sample players

queen pasture
#

Yea

#

I made it already

#

Looks cool

opal hornet
digital rock
#

can I set the motd somehow?

bronze yoke
digital rock
bronze yoke
#

sorry my bad, I meant ProxyPingEvent

digital rock
opaque escarp
# opal hornet {line1}\n{line2}

We are in Velocity, no bungee or spigot, do not use those characters, to jump to the next line you can use Component.newLine() or in MiniMessage: <br> or <newline>

gray hedge
#

Any idea why this: audience.pointers().getOrDefault(Identity.UUID, null) returns null on a player?

#

Or are the pointers different for velocity?

burnt dragon
#

heh

gray hedge
#

Wait lol

#

It is not

burnt dragon
#

when did that get removed

#

im following the commit history but i can't see it

gray hedge
#

I guess it never was added lmfao

burnt dragon
#

no it definitely was

gray hedge
#

I'm pushing an PR

burnt dragon
#

oh no it wasn't lol

#

what an oversight :')

gray hedge
#

I spent like an hour

#

Looking at my code

burnt dragon
#

im so sorry lmao

gray hedge
#

Also console should have a TYPE?

#

I mean same for Player

burnt dragon
#

i think we spoke about the idea of a type pointer

gray hedge
#

Cause I'm working on an universal system, so everything breaks for me

#

I have no way of identifying who is who

burnt dragon
#

i can't quite remember why a type pointer never ended up existing

gray hedge
#

It annoys me that Velocity doesn't use Platform api

rich hawk
#

cus it’s native

burnt dragon
#

it can't really

gray hedge
#

I mean it could have just an AudienceProvider out of the platform

burnt dragon
#

but stuff is audiences

gray hedge
#

That way it could be much easier to implement stuff with multi proxies

#

Cause rn I literally gotta just create own AudienceProvider 😄

burnt dragon
#

i mean, yeah

#

i dont know why - your abstractions should just be returning audience/etc

#

and in those cases you just return server player or whatever

gray hedge
#

Well because Bungee returns AudienceProvider

#

I need the same one to ease my workflow

burnt dragon
#

the audience provider is ideally an implementation detail

#

the audience itself is the abstraction you should be passing about

gray hedge
#

I guess I'll just have to use a fork of velocity for now

burnt dragon
#

what

#

why on earth

gray hedge
#

With FacetPointers added to identify

burnt dragon
#

no - this seems completely wrong

gray hedge
#

So how else can I identify?

burnt dragon
#

depends on what the xy is here

#

but i would highly rec making a pr to add a type pointer into adventure if you want

gray hedge
#

Well either way I'd have to wait

#

So either way I have to use a fork of mine 😄

burnt dragon
#

well, yeah

gray hedge
#

Imma open an PR tho

#

Imma test first

#

Ayo works

#

I forgot that PR updates when I update src lol

burnt dragon
#

im gonna tell you now, velocity and other native implementations should never ever have adventure-platform stuff

gray hedge
#

Wait what

burnt dragon
#

sorry, typo lol

gray hedge
#

Well for FacetPointers you do need it

burnt dragon
#

no

#

facet pointers are for facets

gray hedge
#

That's where Type comes from

burnt dragon
#

facet pointers is an internal implementation detail

gray hedge
#

But you cannot get the type in any shape or form

opaque escarp
# gray hedge

Just 1 month ago I started to make 2 plugins for Paper and Velocity that depend on the player's pointers to check permissions and I just found out that it is not implemented XD (the plugins are not published yet and I have only tested them from console, maybe that's why I didn't realize it)

burnt dragon
#

yes you can, with a PR of a type pointer to adventure api

gray hedge
#

Well it's time to PR adventure then

gray hedge
#

But wouldn't that break the platforms then

#

Cause it would be boilerplate

burnt dragon
#

why would it break the platforms?

gray hedge
#

And people wouldn't be happy to update

#

Cause the Type would be inside adventure itself

rich hawk
#

it’s internal api that class?

gray hedge
#

It is

rich hawk
#

so people shouldn’t use that anyway?

gray hedge
#

Well there's no other way?

burnt dragon
#

adventure-platform implements adventure-api

gray hedge
#

I know it does

#

But the class path of Type would be changed then 😄

burnt dragon
#

so adventure-platform's audiences would implement this new type pointer

#

what

#

no it's a new thing

#

again, the entirety of adventure-platform-facet is an implementation detail

gray hedge
#

I understand that

fossil sundial
#

I’m not familiar with adventure here but I’ll take a look later. But Kezz does make a good point; you may want to take this to the adventure discord

#

*kyori

gray hedge
#

Well the main problem tho was with velocity

fossil sundial
#

How’s it handled in paper?

gray hedge
#

And that was the pointers never used lol

#

I'm sure Paper doesn't return Empty pointers

#

Who did the ConnectedPlayer I'd like to spank the f out of them 🙂

rich hawk
#

?

gray hedge
#

Well I'm very surprised how I found out about it lmfao, it's pretty crucial thing

burnt dragon
#

easy mistake to make, also missed in review and merge

#

mistakes happen

gray hedge
#

I'm not judging no one's perfect, but this is funny tho

#

@burnt dragon Why didn't you code the stuff for it? on the issue

burnt dragon
#

because i have a full-time job and can't always get around to working on open-source projects in my free time

gray hedge
#

I see. I'm gonna try to implement such system into adventure itself

burnt dragon
#

yeah go for it! definitely needs doing

gray hedge
#

Tbh I think having the Type as strings would be the easiest implementation for all the facets & natively

zealous epoch
#

Hey guys I need help.
How can I change the .suggest so that it only shows all possible entries that start with h.
Not everything like screenshot

rich hawk
#

.startsWith?

zealous epoch
#

for better context:

rich hawk
#

need more code

valid gazelle
#

i think the way youre supposed to do it is to create separate nodes as subcommands

#

so then you dont have to manually write any logic to parse the arguments basically

fossil sundial
#

Predicates are usually used as permission checks but can also be used for that

zealous epoch
#

Can you Show an example Code?

fossil sundial
#

Not currently sorry

valid gazelle
#

i have some code for a plugin i made that i could show

zealous epoch
#

That would be useful

valid gazelle
#

might not be the best

#

but hopefully you can see the gist of it

zealous epoch
#

Saw it thank you

opaque escarp
#

I wish mojang would soon and once and for all remove the legacy color codes and support components in the motd "player list" 🥲

rigid vine
#

How can I check, if the CommandSource is the console?

rich hawk
#

instanceof

rigid vine
#

thanks

zealous epoch
#

Dear Team of velocity,
Is there anywhere a good explanation with examples for Brigadier commands for Velocity?
Because I can´t get the hang of it and I would like to code plugins for velocity with Brigadier command back end.
Or should I just stick to Simple Command?

#

The github page from Mojang doesn´t help much bcs you guys didn´t code it exactly the same (I think)

rigid vine
#

I'm using Simple Commands and I learned how to do it with a youtube tutorial from a german youtuber ^^

opaque escarp
#

It would be best to use brigadier commands, since Velocity internally uses brigadier

opaque escarp
bold wharf
#

Brigadier is brigadier, for the most part it's gonna work the exact same, maybe some slight differnces towards what you're seeing, etc

zealous epoch
#

any docs planed for to velocity approach?

#

@opaque escarp you have some sources where I can comprehend the brigadier approach?

#

like tutorials, docs, explanations, or better examples?

opaque escarp
#

Now I was writing a mini tutorial to explain, but I think I'll do it in a better way

zealous epoch
zealous epoch
opaque escarp
rigid vine
#

I can send you a link via dm, if you want

zealous epoch
#

You don´t need to already found it 😉

zealous epoch
exotic frigate
#

Hello guys, I'm starting using veloctiy API, and I want to create new User object when Player is joining or logging, how can I do it or when is the best option to create user?

oblique haven
queen pasture
#

is there a kyori-adventure-platform velocity?

oblique haven
queen pasture
#

idk about that but theres a popular plugin called placeholderApi

#

im trying to port it to velocity