#velocity-dev
164 messages · Page 11 of 1
not necessarily 1.19 specific, had it on older versions too
don’t know what causes it tho
I'm trying to send a plugin message to a velocity proxy from papermc. This is how I do it:
target.sendPluginMessage(BukkitServerCore.instance, "megavex:autoban", byteArrayOf())
And this is how I am listening for it:
@Subscribe
fun onPluginMessage(event: PluginMessageEvent) {
println("Plugin message received: $event")
}
However I don't seem to receive the message. What am I doing wrong?
I also registered the channel on papermc like this:
server.messenger.registerOutgoingPluginChannel(this, "megavex:autoban")
The listener is definitelly registered, I tested that.
have you registered the channels?
on velocity you should also have something like this.server.getChannelRegistrar().register(ChannelIdentifier);
yep, that worked
nice
@Subscribe
public void onChat(PlayerChatEvent event) {
event.setResult(PlayerChatEvent.ChatResult.denied());
}
declaration: package: com.velocitypowered.api.event.player, class: PlayerChatEvent, class: ChatResult
is there a services manager like Spigot where you can register your services?
See https://github.com/PaperMC/Velocity/issues/231 for tracking issue
is velocity polymer still roughly on track to release at 2023 Q1 or is it likely it’ll release later?
Potentially later than that. Tux recently moved and switched jobs so he has been quite busy
Velocity polymer, I am sure, will require much more time to develop than between now and March 2023
yeah I’m aware now given that tux has had more to work with since I last heard a rough eta
how do I use com.velocitypowered.api.proxy.messages?
(I can't find any guides on youtube)
I'm reading the docs and this is all I figure out
this.server.getChannelRegistrar().register(MinecraftChannelIdentifier.from("connect_requests"));
how do I tell it what to do when it recives a pluginMessage?
Use this as an example https://gist.github.com/Xernium/95c9262c5f70b8791557861bbc09be1b
your format is also wrong
TYSM
OH MY GOD I'M SO STUPID IT WAS AN EVENT LISTENER
I AM SO DUMB
I JUST NEEDED AN EVENT LISTENER
HOW AM I THIS DUMB
📉
Lol
👀
aah devs, can you check again this issue?
https://github.com/PaperMC/Velocity/issues/654
Do me a favor: Make a simple plugin that logs the resource pack status and the origin of the resource pack in question.
Because when I last did that I didn’t have any discrepancies
[16:30:43 INFO] Applying ResourcePack to Over_Brave.
[16:30:43 INFO] Over_Brave sent status: ACCEPTED
[16:30:52 INFO] Over_Brave sent status: SUCCESSFUL
By the way, I'm not a plugin dev. Your request was available in the debug section of the plugin I used. I just thought it was right to write about the issue here.
I don't fully understand your second request.
Thats from Velocity
No request is sent or detected on Spigot.
The second part is the important one:
https://jd.papermc.io/velocity/3.0.0/com/velocitypowered/api/event/player/PlayerResourcePackStatusEvent.html#getPackInfo()
If not null log the origin and original origin of the pack
declaration: package: com.velocitypowered.api.event.player, class: PlayerResourcePackStatusEvent
Applying ResourcePack to Over_Brave.
Over_Brave sent status: ACCEPTED
Origin: PLUGIN_ON_PROXY Original origin: PLUGIN_ON_PROXY
Over_Brave sent status: SUCCESSFUL
Origin: PLUGIN_ON_PROXY Original origin: PLUGIN_ON_PROXY
And the original origin was the server?

I mean where was the pack sent from originally
If it was the proxy then this is absolutely working as intended
Its proxy
Yea then it’s working as intended
The proxy sending the request on previously was a bug
My problem is that it is not sending the status to the backendserver.
if the proxy is sending the request the backend shouldn't expect a status response - you'll need to monitor status on the proxy
the proxy purposefully doesn't pass status back if the origin was the proxy since the backend isn't the one "handling" that pack - you're free to use plugin messaging to achieve this though with custom channels, shouldn't be too hard
I can do that before.
I check if the player has properly loaded the resource pack with the spigot ResourcePackStatus event from the lobby server.
It was working in January-February.
After this
https://github.com/PaperMC/Velocity/pull/659
I think it was broked.
this is resolving intended behavior
what you're seeing is intended - what was happening before was not intended if it was passing it back
I believe there was an issue with original origin or something which Five fixed in one of the prior patches which led to that PR
But after these dates, this is the only action taken on the issue.
Could Spigot detect that the player's resource pack was loaded due to the bug?
I want to explain my problem from the beginning.
When I sent the resource pack over the proxy in January-February, I could detect the player's resource pack from the spigot servers on the backendserver with the "ResourcePackStatus event". But now I can't do that.
right
I've been looking for what caused this all along. I can't understand why.
I was not using the message channel before.
Just a resource pack plugin via Velocity and an event listener via spigot server. This much.
Right - that was unintended behavior and has since been fixed
Could you add a setting about this? Because I need it. 😦
you don't need it
just send a plugin message
having a random resource pack ack to the spigot server about status makes no sense outside of your particular scenario
if spigot didn't send a resource pack - it's not expecting a response, so it makes absolutely no sense to send it one
if you want to imitate one you're free to do so with plugin messaging - but that's imo probably the best way to handle it
Understood.
Hello everyone, can anyone write me a line with the code for teleporting to the server at certain coordinates?
no, this is for help with development not comissioning people to do work for you
Adding to that, I don't think this is possible on the proxy side either
Not without a plugin on the server itself, no
Is there a way I can get a list of running backend servers? Basically I want to check if the player is allowed to join a specific backend server on a ServerPreConnectEven, if not send player to the first fallback server that they have access to.
https://jd.papermc.io/velocity/3.0.0/com/velocitypowered/api/proxy/ProxyServer.html#getAllServers(), you have to ping the server to determine whether or not the server is online.
declaration: package: com.velocitypowered.api.proxy, interface: ProxyServer
for pinging the server, see https://jd.papermc.io/velocity/3.0.0/com/velocitypowered/api/proxy/server/RegisteredServer.html#ping()
declaration: package: com.velocitypowered.api.proxy.server, interface: RegisteredServer
It is plenty possible, though paper itself lacks the api for it at the moment.
You’d just need a plugin on proxy and one on each server
Nice! Thanks
Is there a better documentation on velocity & its velocity-plugin.json ?
Because I am finding lots of conflicting information
I cannot get a velocity-plugin.json to generate
dependencies {
annotationProcessor("com.velocitypowered:velocity-api:3.0.1")
compileOnly("com.velocitypowered:velocity-api:3.0.1")
}
``` Should be this simple; why not?
Do you have the @Plugin annotation in your main class
I needed to use kapt as the annotation processor due to kotlin source file
Ah yes, that'll do it
Fun fact, for some reason plugin id cannot have uppercase
That is correct
However, I feel that shouldn't completely stop the plugin from starting imo
It prevents it from compiling
It would be much cleaner if we just threw an error and allowed the plugin to load
well, yes
But, I do not feel that it should
Ideally, we should just ignore the casing of the letters and automatically format the string
Well, I guess my only recommendations are to add such things to the documentation (usage of kapt for kotlin sources, lowercase plugin id)
Thanks for the help though
Would it be possible to make a compiler error/warning for that because that would make more sense
Well, we can do two things simultaneously in theory
Auto lowercase plugin id's, and print a better message
Perhaps something like this
Printing a message with the invalid id entered is a good idea, but converting the invalid id to lowercase may cause some unwanted problems. For example, if you want to depend on another plugin and it is opensource, you can look at the main class and copy the id to use it in the dependencies of the @Plugin annotation, but in case the id is invalid the plugin will not be able to depend correctly on the other plugin
Perhaps we should apply the same logic to the dependency then
It was done to avoid casing conflicts
kapt being needed to run annotation processors on Kotlin code isn't specific to Velocity, that's just general Kotlin knowledge
I don't think it's particularly important for the Velocity docs to document how to use Kotlin
Are you we able to hide disconnect messages when we disconnect a player with event.setResult(ResultedEvent.ComponentResult.denied(message));?
As if they are formatted pretty they take up a bit of console space
By this logic, the call-out for using the annotationProcessor configuration should be removed, because it's non specific to velocity
But it is required, it generates the plugin json, and that’s non-standard for libraries
There isn’t a specific event for it but you could register a log4j log filter
And kapt is necessary to generate the plugin JSON for kotlin source; I'm fortunate the rest of the internet has enough information that I could make an inference about how to apply the processor similarly. Making the defense for not adding to the documentation just feels like gatekeeping. Hell, if there's a way for me to contribute, I'll PR these documentation changes on my own.
docs are all on github! https://github.com/PaperMC/docs
I am not sure the velocity dev docs made it over to paper yet- If they did, feel free to contribute it to the official documentation; just afaik kapt breaks in spectacular ways if you shade dependencies.
How would I go about sending kicked players to a predefined server? For example, if I join a server and get a forge mod rejection (or I get kicked for any other reason) I want the players to be sent to the lobby again
I know on bungee I somehow managed to not even connect to a server if the join event was cancelled so I would just remain on the lobby if I got kicked instantly
you can listen to the kicked event and set a redirection iirc
getServer should be the server you're kicked from then, right?
The docs did make it over, however, a rewrite is in progress so it’s best to wait for that to happen
Would you be able to recommend any docs or guides for help achieving this. I am stuck trying to add filter to slf4j. None of the old methods seem to exist
When I send a {message} from a proxy in minecraft chat, a message comes up: "<> {message}"
How to get rid of those <> ?
paper 1.19
on version 1.18.2 everything was fine
It's bugged, devs will probably fix it soon™️.
Hello, I have an issue with PlayerAvailableCommandsEvent event. I am trying to prevent tab-autocomplete ONLY for proxy commands, but this event includes both proxy and server commands. How can I distinguish these two type of commands?
you can check if the command exists in the velocity command manager
it has a method to get a list of aliases
but also, consider not removing tab completion as it just hurts accessibility for no gain
I am just trying to prevent players to see those commands
use a permissions plugin
I am developing a plugin, I already have spigot and waterfall compatibility, but I want velocity too
but it seems this worked so thx
that doesn't have anything to do with not using a permissions plugin but whatevs
even with a permission plugin, commands will appear in the tab completion
that's why there are hundreds of anti tab completion plugins on SpigotMC
I am new to velocity, I don't know much about it, maybe velocity already blocks all commands on tab completion
but that doesn't happen on bungeecord or waterfall.
Plugins which properly define their stuff will not show up in tab completion
Like, that 100% happens on waterfall
Hurr durr brigadier is broken on waterfall
Any commands that use the correct simplecommand impl or are brigadier commands with a correct permission predicate do work with permission filtering
^ Plugins just suck at using it, but the feature is literally there and has existed for a looooong time
Also, i got chat registry passthrough working, all of my checks for equality came back true, and chat actually works again! now just for eveeeerything else, lol
nice! what else is missing? do you think it's production ready?
Well, that's part 1, gotta work on all the business which will use that
i.e. registering custom types, etc
Think I'm going to wait on seeing what adventure does before I actually bother with the API side of stuff, idk what all they intend to cover, but, want to at least get the business logic needed in place for it
do chat events work any differently with the signed messages
I'm not sure what to change on my end to update to velocity 1.19
Well, the signed message will need to be passed around, part of what I'm waiting on adventure for
Honestly, I ain't done much with velocites API, or the codebase, so this is all pretty much a new territory for me, already had a few fights with checkstyle
what are other servers doing using velocity with 1.19? embracing the jank?
I mean, thus far it works fine, I don't think anything supports the signed message stuff though
is there a way to just disable signed messages
pretend that every message is sent by the server
welp
Technically you can create custom message type
That only displays players name
Then just use display name for message
Through it's harder on proxies
No. Won’t display if you enable signature enforcement.
It will
Since displayname is fully controlled by server
And client never signs it
Just content part of message
Which doesn't even need to be visible
Turn off the chat decorator preview packets and see if it still works
I’m genuinely interested
Had no time to see
Tested when I modded it
I'm currently on my phone so ¯\_(ツ)_/¯
Someone would report that already if it was the case
Hello, sorry for my english, how do I fix this? happens when I use \n
I'm also using LegacyComponentSerializer.legacySection().deserialize()
Okay, I'll see if I can make a parser, thanks.
It works in chat in 1.8, but not in 1.7.
ok well it doesn't work on 1.7
why I can not get resource from plugin folder on velocity? resourceAsStream is ok but result is empty
Because you're calling it on the classloader
the classloader is, well, looking at the jar file
if you want a file off the disk, create a reference for that
no, i want get a packages and classes form package
how?
this code works correctly in simple java application
Yea, stuff like that is none reliable
guessing that your "working" test was ran from the IDE where the classloader is often pointing towards a folder
maybe..
velcity has google libs
List<ClassPath.ClassInfo> classes = new ArrayList<>();
for (ClassPath.ClassInfo info : ClassPath.from(LiteProxyManager.class.getClassLoader()).getTopLevelClasses()) {
if (info.getPackageName().startsWith("dev.rollczi")) {
classes.add(info);
}
}
works
or
Set<ClassPath.ClassInfo> classes = ClassPath.from(LiteProxyManager.class.getClassLoader()).getTopLevelClassesRecursive("dev.rollczi");
could you theoretically use signed messages with a custom chat formatter?
or is that not possible
(im not exactly familiar with the new updates)
yes, that's what chat types are for
How can I usee bungee channels with velocity
Paper -> Velocity https://www.spigotmc.org/wiki/bukkit-bungee-plugin-messaging-channel/
Velocity -> Paper https://gist.github.com/Xernium/95c9262c5f70b8791557861bbc09be1b
Why does when kicking with disconnect() remove the spaces also it says internal issue occured?
Oh nvm
I'm stupid
Tired
Sowwy
The second link is velocity 1
btw
what was velocity 2?
Velocity 2 is now Velocity Polymer (4)
Is the same in 3.x.x
To clarify... Velocity 3.0.0 (in its first release) and Velocity 1.1.x are the same, except that Velocity 3.0.0 removes text, updates guice and starts using Java 11
The 1.x series couldn't continue without breaking changes, but 2.x was already assigned at the time
IIRC, semantic versioning allows for breaking changes at the minor version, right?
No
figured i'd ask this again as im considering making a PR:
Has anyone considered adding more command-line arguments to velocity? specifically --host, --online-mode, etc
why not
lithium polymer
Hi all!
I need help getting a PluginMessage on the Paper Server.
So I send a PluginMessage to a chat event from my proxy using: sendExampleMessage(e.getPlayer(), "123");
The sendExampleMessage() method was taken from https://gist.github.com/Xernium/95c9262c5f70b8791557861bbc09be1b.
On the Paper server, the handler was taken from https://www.spigotmc.org/wiki/bukkit-bungee-plugin-messaging-channel/
On my Paper server, I register a channel: this.getServer().getMessenger().registerIncomingPluginChannel(this, "mychannel:main", this);
And in the onPluginMessageReceived() method I check if it belongs to my channel.
But tests have shown that even the onPluginMessageReceived() method itself is not called, that is, I'm just trying to display in the logger that a message has arrived without any checks.
But nothing happens, I can't figure out why it doesn't work. From the server side, I can send a message and it will come to the proxy.
I can't figure out if I'm sending it somehow wrong or it's not accepted on the server.
I am using Velocity 3.1.2-153
and Paper 1.19-17
You’re thinking wrong. The destination you want to send it too from the proxy is not the player. You want to send it to the server; the channel message sink is the ServerConnection if you want to send it to the server
https://jd.papermc.io/velocity/3.0.0/com/velocitypowered/api/proxy/Player.html#getCurrentServer()
declaration: package: com.velocitypowered.api.proxy, interface: Player
Oh yes, it works! Thanks a lot!
How does one disable a velocity plugin or is it not possible?
Open an issue on GitHub or I’ll forget; that was originally intentional for 1.19+ but it must have gotten lost in the update madness
huh..?
inb4 via
oh they edited their message
Does velocity have some ticking internally or everything that happens is handled async upon events?
Anyone have a simple example on how to use plugin messaging channels?
.
How can I make an API for a Velocity plugin that plugins on sub servers can use?
You'd need to use something like plugin messaging or redis so that the plugins can talk to eachother
Is there any resources I can read on plugin messaging?
I'm making a friends plugin in Velocity and I basically want to make an API that gets the friends of a specific person
See the message that 4drian3d replied to above yours, its the spigot page on the bungee channel which shows how to use it
Would this be possible with plugin messaging channels?
Yes
That's possible I think, though it'd be better to use something like mysql
How would that make things easier?
If it's for an api for other plugins to use then probably not, nvm that
I still don't understand how I'm supposed to be sending a list of data from the Velocity plugin to the server
What I'm getting is that I have to register a channel using the Velocity plugin
proxy.getChannelRegistrar().register(someChannel);
Then send some data
sendExampleMessage(player.server, "something");
In my Paper plugin I would register a plugin channel and an event for it. But I don't see how I can make an API with this
I would have to listen and deserialize the data for every plugin
You can’t share a classspace so this is more or less one of the only ways to move data
Yes exactly
If it were easier then Minecraft wouldn’t have the networking code it does currently
at the end of the day, they're two isolated program spaces
anything you do between the two is gonna involve some form of communication
That's all fine and good, but I am trying to make an API. It seems I can't
Well, you kinda can't
at least, any API you make is gonna rely on communicating over the network
Like, if you want reliable connections and stuff and to have an "API", you'd generally be better off writing some REST API and wrapping API around that
but, then ofc, everything is still network IO
I'm making an API for Ambassdor
So people can create plugins that interact with the forge handshaking process
If they want
This will be the most used method I think
It does all the hard work for you
It uses my custom downloading mechanism to download the handshake packets from the forge server
And stores them in simple byte arrays that you can send to the client directly using Velocity API
I'm gonna create a way for plugins take over the handshaking process and just use Ambassador as library. If they doesn't, Ambassador is gonna default to it's own handshake handler
Basically, I'm doing a full rewrite right now
Guys, I know that in order to successfully receive the PluginMessage you need at least 1 person on the server, but can I bypass this system to always receive the PluginMessage even if there are no players on the server?
No
the entire thing relies on hijacking a players connection to send it over
No player to hijack, no connection to send data over
best you can do is rely on some other solution, pubsub, sockets, etc
I'm understood, thank you
Is there an event that fires when a server connects to the proxy?
Servers don’t connect to the proxy
Players connect to the proxy and the proxy connects to the server on behalf of the player
Would this work or does it need to be sent from a player
It needs to use a connection from a player
Why can you even send it from the server then
Because it uses a cached list of known players to hijack the connection from
So that will work?
I just need to send an alert the the plugin running on the proxy then send info back
What if there isn't? will it wait until a player is?
Unsure
Could test it
Plugin messaging requires a player to be online for it to work?
I've read that somewhere yeah
I think I understand why but thats kind of gross
You can always try communication by redis
I suppose so
Better than relying on a player to be online
Can think of other solutions tbh
What are you trying to achieve?
Can someone explain redis to me
I always thought it was just another version of mysql
Is it not?
I have a list of players, I need to have the list on proxy side and be able to access it from each server. Right now I was planning on everytime something gets added to the list, send a message to the server and replicate the list there, is there a better way?
yeah redis sounds like the right tool for that
i dont really know the specifics that well so i cant give much more advice though
Do you know if sending plugin messages is secure or can clients access it
idk, might have to ask someone else
Because i'm sending database information
yeah i would say that probably makes more sense to go over redis because it's not player specific right
Yeah but thats the other thing
Its a bungee network so there will be a lot of servers, and I dont want to have to manually enter the server connection string for each one, so i was going to have it on the main, when the server boots up send a connection ping to the proxy then the proxy responds with the database information and the plugin saves it
is there a way you could pass the credentials as an environment variable, adn then read that variable in your plugin?
Do rented dedicated servers usually allow you too do that?
This look right? isnt sending message to bungee
For redis do you need to host a server? i'm looking at https://www.tutorialspoint.com/redis/redis_java.htm will Jedis jedis = new Jedis("localhost"); just run it on the server the bungee is on?
Redis - Java, Before you start using Redis in your Java programs, you need to make sure that you have Redis Java driver and Java set up on the machine. You can check our Java
i think you have to run redis separately
Yea redis wont work for me because it needs to know when its being called
wdym
cant you check it every interval
That sounds stressful for the server
do it on another thread every so often
its not a good idea but
are you just trying to communicate stuff between a front end and backend
Every so often wouldnt work either that ruins the point of needing to know when its called
yea
I was thinking earlier could you use a http server?
Like if I have a ban command on the server, do the command there, send the info to the proxy, then send the ban info to all servers
on another thread possibly
If i was to do that I would just make my own server
Which is what im trying to avoiid
And does http have an event system with packets?
I mean you can post to a server
Yea at that point I would just create a server from scratch
^ im being serious with that I think it would handle data better
I mean thats a fairly big task
I want to see if there is a way to do it directly with bungee and spigot first
You could just fork velocity and add what you need into it
Or make a plugin for front and back end
Still would need a server to communicate with each other
What would be the point for that
Thats just exactly what im trying to do already but just with extra plugins for no reason
Then build it into one plugin 🤷♂️
Its an option
Might not be what you want but if redis doesnt work and you can think of anything else
That wouldnt work...
You cant communicate directly between bungee and spigot
so it cant be one plugin
well
you could have two packages that compile into one jar
and have it connect via databases to communicate information
not even actual data just booleans etc
sql messaging?
yeah
yeah thats good
that’s what i was getting at
used that before
I dont want to use a database that stores information I just need to send it and then dump it
but i think he'd run into the same problem
what do you mean by that
Like a spigot and bungee version in 1 jar?
you can make multiple types of plugin into the same jar
yeah
I know that, but what would that do
Well it would mean you're only making one plugin technically
The plugins would still need to communicate and they are in different directories on different servers
redis communication
¯_(ツ)_/¯
^
If I do /ban Keylon I need to know when that command is called on the proxy for example
Not using Command events or anything because its not being called on the command
Then,,, handle the command proxy-side...?
I still don't really understand
I need a way to send any data, and know when that data is sent
You need to register a command to process it-?
no
Im trying to make almost an event system ig that runs across the proxy and server
then again, proxy communication or communication by redis is fine..?
^
Alright, another thing is my proxy isn't receiving messages from my server
Depends on what kind of event you want to gauge how feasible any of this is
You can’t get an awaiting event to work right over redis
But the same is true with plugin messaging
server send class
public static void SendConnection(Player player) {
ByteArrayDataOutput out = ByteStreams.newDataOutput();
out.writeUTF("_connection");
out.writeUTF(ServerCore.getInstance().getServer().getName());
player.sendPluginMessage(ServerCore.getInstance(), "oak:connection", out.toByteArray());
}
Server main
getServer().getMessenger().registerOutgoingPluginChannel( this, "oak:connection" );
Bungee lsitener
@EventHandler
public void onPluginMessage(PluginMessageEvent event) {
Messenger.log("PLUGIN MESSAGE = " + event.getTag());
if (event.getTag().equalsIgnoreCase("oak:connection") ) {
DataInputStream in = new DataInputStream( new ByteArrayInputStream( event.getData() ) );
try {
String channel = in.readUTF();
if ( channel.equals( "_connection" ) ) {
String serverName = in.readUTF();
ServerInfo server = Oakland.getInstance().getProxy().getServerInfo(serverName);
sendConnection(server);
Messenger.log("PLUGIN MESSAGE 2");
}
} catch (IOException ignored) { }
}
}
Do I need to register incoming channels in my bungee plugin? or only outgoing
……. You’re in the wrong channel for bungeecord
There’s no @tame spireentHandler on velocity
Sorry to whoever I just pinged, discord mobile is problematic sometimes
lmao
Hello, I was wondering if it was possible to set to blank the default fallback server because I'm making a plugin that's manage all servers and add/remove them automatically
Or I just need to unregister the default fallback server ?
Hey, how to change the log level of the integrated slf4j logger? I have not found a config option.
Ideally you’d use the log4j launch flag and provide a config xml
But Logger.getRootLogger().setLevel(…) should also work
Thanks! 😇
If I send a resource pack through a backend plugin, will velocity receive the status packet back from the client
or what about vise versa
if I use velocity to send a player a resource pack, will the backend server receive the packet
Velocity fires events for all resource packs and resource pack status to the api.
The api also exposes where the pack originated from; and if the proxy interferes with the pack it also saves where it was from originally
But in essence:
If the backend sends a pack then the backend will always get a response
If the proxy sends a pack then the backend will never get a response because that would constitute an illegal protocol state
mk ty
The events fired on the velocity api are
And
To get the origin see:
declaration: package: com.velocitypowered.api.event.player, class: PlayerResourcePackStatusEvent
declaration: package: com.velocitypowered.api.event.player, class: ServerResourcePackSendEvent
declaration: package: com.velocitypowered.api.proxy.player, interface: ResourcePackInfo
any chance someone could take a look at my pull request i made a while ago and review if possible? it's pretty small and i'm getting tired of rebasing it every so often, and also maintaining my own jar on my server
https://github.com/PaperMC/Velocity/pull/643
This can be replicated with a plugin, so I doubt it will get accepted
^
Hello I wish to modify total player count but it does not work. This is my implementation
@Subscribe
public void onPing(ProxyPingEvent event){
AtomicInteger count = new AtomicInteger();
for (GameServer server1 : VelocityCore.getInstance().getServerManager().getServers().values()) {
if (server1.getGameMode().equals(GameMode.SUPREME_PG)) {
continue;
}
count.addAndGet(server1.getPlayerAmount());
}
VelocityCore.getInstance().getServer().getAllServers().forEach(server1 -> count.addAndGet(server1.getPlayersConnected().size()));
event.getPing().asBuilder().onlinePlayers(count.get());
}
please let me know if I am doing something wrong
you're not setting the ping
you're getting the current ping and then modifying it, but you need to call event.setPing
oh shoot, thanks!
yeah but its much uglier as a plugin since I'm basically having to copy the logic into my plugin
when its in velocity itself its just 3-4 lines of actual code/logic
You have to understand that the feature is niche at most, given 1. most servers don't use forced hosts, and 2. even less use it in conjunction with exotic ping passthrough configurations
That 3 lines of code estimate doesn't take into account docs and further confusion when using forced hosts
I thought it was like the default option, or at least a very popular one on bungeecord
and it shouldn't be confusing I don't think, just basically is like a toggle for a network wide motd I think, by default the behavior isnt changed in this pr
how much time does it take so a PR is available on the website ?
it won't show up until it's merged
and how much time does it take to be merged ?
Really depends on the content; What did you have in mind?
It's the #765, it's really nothing just adding equals and hashcode methods to 3 classes
✊😔
Would it be possible to tell if an attempted connection is from an browser context, and if so redirect them. Haven’t looked at it much but was just thinking about it? could be useful
🤷♂️
you just set up a SRV record.
for me on the domain it looks like this: (gloryx.net is the domain)
A gloryx.net (my web server ip)
A mc.gloryx.net (my velocity ip)
SRV _minecraft._tcp.gloryx.net 1 1 25565 mc.gloryx.net
this works, i use it
SRV records do have some caveats
I mean, web servers generally run on a different port, so often just host the web server on the same box, or, setup a web server which just redirects to the correct place
SRV sometimes can randomly fail for no reason, which is fun
tho, I've only seen that happen a couple times over the past few months, so
huh i never had it happen myself
seems generally down to janky ISP hardware
it probably doesn't help that I use CenturyLink with no better option available
like, for some people they can just reboot their router and magically all works again
weird, why would that happen with srv and not other dns lookups either
tbqh, SRV records are somewhat niche
probably bad caching cannot store SRV
and that may incur a longer round trip than A or AAAA
Like, idk anybody who really uses them all too much, and so chances are they're just not as well tested
Or janky software
This override here is dum
(at least imho)
- this is the cause of the <> in messages
- adventure defaults that to use the SYSTEM message type, which WOULD be the correct behavior for literally every single usage within the proxy itself, however, I am somewhat iffy on changing this from default
@fossil sundial if you happen to be around, thoughts?
we need to force it to system type since the actual new player chat expects two components
system chat packet can only provide one
Thing is that it defaults to chat
So, that override replaces the default message type that adventure would set
I wanna just yeet that override
(the one I linked, so that we go back to the default there)
overwrite it in the chat builder
adventure cant account for this yet
is there a command to send players to other servers?
Hey all. I'm a bit confused while making my plugin. I have a Player object & a RegisteredServer object. How do I force the player to join the RegisteredServer?
I need to 'move' the player to another server from a lobby server.
player.createConnectionRequest(sever).fireAndForget()
replace fireAndForget() with one of the other methods if you want actual error handling
Ah, perfect! Thanks 🙂
no but the player can do /server if they have permission to.
I think
I seem to have an issue where Player#sendMessage seems to be printing out Action Bars rather than text chat
Using: Velocity 3.1.2-SNAPSHOT (git-0caff79b-b156)
this.server.getAllPlayers().stream().filter(player -> player.hasPermission("staffchat.use")).forEach(player -> player.sendMessage(
MINI_MESSAGE.deserialize(chatMessage,
Placeholder.unparsed("server", serverName),
Placeholder.unparsed("player", displayName),
Placeholder.unparsed("message", message)
)
));```
```java
player.sendMessage(MINI_MESSAGE.deserialize(toggleMessage, Placeholder.component("status", Component.text("disabled").color(NamedTextColor.RED))));
```
anyone know why this is caused, or if I did something wrong?
iirc that's a viaversion bug, update to their latest commit
Yep, just needed to update viaversion! Thanks.
Hi guys!, is there any way to dynamically load a plugin on Velocity? I suppose there isn't any way but we don't lose anything by asking :)
No
i mean a proxy starts up quick enough to just restart really
Like, I mean, theres always a way, but, ofc, 100% unsupported
Suggest looking into your IDEs hotswapping features, etc; but, as said, proxies load pretty darn quick so it's generally not a huge concern
Is there any way to intercept messages received through the BungeeCord channel?
I tried using PluginMessageEvent but I can't get anything from the channel.
Why would you need to do that? If you make your own custom plugin you’re expected to use your own namespace:key identifier.
I digress, yes it is possible to do; If you disable the bungee messaging channel in the velocity config then the proxy itself won’t respond to it anymore and plugins can use it. If you need to use a subchannel of bungee you also need to implement the other functionality of the bungee channel to keep it working
Maybe clear your caches, this should work fine
Either that or the mojang repo isn’t working once again
I need the bungee channel because I have 2 minigame rooms, and some plugins (like Citzens) use the bungee channel to connect to the room, but I wanted to create a failover if the first room is full.
it doesn't work fine because that url really doesn't exist
or maybe my build.gradle is broken or somethingh
repositories {
maven {
name = 'velocitypowered-repo'
url = 'https://nexus.velocitypowered.com/repository/maven-public/'
}
}
dependencies {
implementation project(':jedis:jedis-datasource-api')
compileOnly 'com.velocitypowered:velocity-api:3.1.0'
annotationProcessor 'com.velocitypowered:velocity-api:3.1.0'
}
Do you have the papermc maven repo?
i only have velocitypowered
maybe ServerPreConnectEvent?
you could also make your own channel for load balancing
You’re better off making a small plugin that adds a command to the server which sends a plugin message to a plugin on the proxy to run that sequence imo
maven {
name = 'papermc-repo'
url = 'https://papermc.io/repo/repository/maven-public/'
}
Iirc Velocity's Brigadier fork was published to the old nexus repo, did that ever get migrated to the Paper repo? It's not here https://papermc.io/repo/#browse/browse:maven-releases:com%2Fvelocitypowered
Nexus Repository Manager
maven >
raven
nvm guys, setting up dependencyResolutionManagement is very hard
Hello,
I'm sending plugin messages with spigot, but when i register a listener on velocity with PluginMessageEvent the event gets never called
this.server.getChannelRegistrar().register(new LegacyChannelIdentifier("your plugin channel or something"));
on velocity
this.server is proxyserver
there's also MinecraftChannelIdentifier for 1.13+
Hello, I didn't find code for teleport source and player to server
Yeah i know that i have them assigned as variable just never used the variable😆
I am making a plugin for screenshare
do you want to teleport a player to specific location
no
or just send them into another server
this
source and player called in command
Is there a way to set a players displayName like it was possible in BungeeCord?
player.get().createConnectionRequest(proxy.getServer("some_server").orElseThrow()).fireAndForget()
if you want a response to check if player has really connected to a server then you can use connect instead of fireAndForget
perfect
I want send executor of command in this server
and arg[0] (player_name)
But I don't find this method for send executor
how find player name executor of command?
I have find them
I am stupid sorry lol
Would like some feedback on whether this maven configuration would work or not:
https://github.com/Andre601/AdvancedServerList/commit/67aab526253f82da8afaa0479589de185da07512
My goal is to have stuff such as configurate and Adventure shaded into the core, so that I can then relocate them if needed for the other modules.
Like:
- On BungeeCord, shade and relocate both into the resource
- On Velocity, only shade and relocate Configurate (Can't even remember if that is needed...)
If there are any other recommendations to make the jar files both less bloated and functional with BungeeCord and Velocity lmk (Also, to be clear: The jars will be separate from each other. There won't be a universal jar for both proxy types)
if they're separate jars then you can do what you want, keep as much stuff in a commons module as you can and yay
My question was if what I'm doing her works or if there is better options
Welp... Of to a good start on Velocity I guess: https://paste.helpch.at/evakuzugiv.sql
I weirdly enough had the same error duing the mvn clean install command, but that was fixed when I excluded SF and RSA files
So, not entirely sure what I should do here... Include the same excludes in the velocity module?
Welp. That seems to have worked.
Is there a way to get the name of the player in the ProxyPingEvent?
Or alternatively the UUID.
No
except if you store like a ip -> uuid or ip -> name thing when the player connects and then when the player ping you can retrieve the last uuid / name of the player
in the proxy ping you have only the ip of the player
rip
Is there an equivalent setup in Velocity for BungeeCords onDisable method?
I assume the ProxyShutdownEvent would be the right choice?
yes
Hello, How check if command has been executed by player or Console?
You can check if commandSource is instance of Player
if not then it's the console
If it isn't a player then it could also be a command block. The ConsoleCommandSender represents the console
How can I create a configuration (toml) in Velocity? Do I need to hook other things or is there a direct method to do that?
Commandblock on Velocity ? waht...
How can I use commands for velocity plugins network-wide?
how do i change a players message with the chat event
yea thats not a thing. But beware, plugins like a few of the discord chat plugins implement their own commandsource so you cant be sure 100% of the time. Always check, never assume.
set the result- but I have to warn you, that will not work correctly with players on 1.19 or newer
Oh my god I was in a rush and didn't read the channel name 🤦 my bad
Didnt think about that but yes you're right
How can I debug incoming plugin messages like BungeeCord Connect?
Are there any flags for enabling that
No.
You can attach a debugger and breakpoint to the velocity proxy downstream play handler handle(PluginMessage…) function
But no other than that

Option 2 is to disable the bungee messaging channel in the config
That’ll allow a plugin to register and listen to it
If you want to print them, you can add logger inside ClientPlaySessionHandler#handle(PluginMessage packet) and compile it 😄
But it also breaks the functionality of the channel
cho that’s the discount alternative to attaching a debugger

Also Server session handler. This here would invoke on plugin messages sent by the players client
yep, but debugger only works when you want to run proxy in idea 😄
No; javas very capable of remote debugging using the builtin remote debug system
hmm, ok fair point
remote debugging is ❤️
But, yea, theres not much real thing for debugging that as the format is set in stone, you can't really screw it up on the proxy side
btw, is there any way to "wait for the next packet"? f.e
server.sendPluginMessage(channel, data);
server.getConnection().ReadNextPacket()?
I want to force the server to respond with PluginMessage in the next packet, I know I can subscribe PluginMessageEvent and add some timeout like 1sec for a response, but maybe there is any more elegant way?
That’s not ever guaranteed with the Minecraft protocol. But besides that, you could launch a completable future with a runnable scheduled completed that will abort on tick and also use it as event listener to catch a possible response & abort the schedule
what is the common/best way to broadcast events accoss minecraft server network?
the network is running with multiple proxies, so broadcasting with plugin channels (they exist only if there is a player) is not the solution I need
Maybe some message services, like RabitMQ, or Redis Pubsubs?
are there any special cases where one is better than the other or vice versa?
In my case, I am using Redis because I store some other data, like player statistics, etc. But if you don't want to store data in Redis, you can easily choose RabitMQ
ok, then I will stick with timeout and PluginMessageEvent, one more question, why I can't send pluginMessage to the client in PostLoginEvent? I am getting the error "Not connected to server" and I can't understand why I need to be connected to the server if I want to send a packet to the player? Is there any event when I can send PluginMessage(to player) before connecting to a server?
You want to send to the client?
And not the server
Am I understanding correctly?
yes, like that:
@Subscribe
public void onLoginEvent(PostLoginEvent e) {
byte[] data = getData(e.getPlayer());
e.getPlayer().sendPluginMessage(channel, data);
}
i looked at source code, and PostLoginEvent is fired in "game state" after login is finished, so it should be fine to send pluginMessage in this event
Open an issue on GitHub. Yea that’s a bug. I think you’re the first person I’ve seen that needs this functionality
I don't see where such a check exists?
@Override
public boolean handle(PluginMessage packet) {
VelocityServerConnection serverConn = player.getConnectionInFlight();
if (serverConn != null) {
if (player.getPhase().handle(player, packet, serverConn)) {
return true;
}
if (PluginMessageUtil.isRegister(packet)) {
player.getKnownChannels().addAll(PluginMessageUtil.getChannels(packet));
} else if (PluginMessageUtil.isUnregister(packet)) {
player.getKnownChannels().removeAll(PluginMessageUtil.getChannels(packet));
} else if (BungeeCordMessageResponder.isBungeeCordMessage(packet)) {
return true;
}
System.out.println(String.format("Packet: %s",packet.getChannel()));
serverConn.ensureConnected().write(packet.retain());
}
return true;
}
inside InitialConnectSessionHandler
Wait what
hmm?
I mean, I see that there exists logic for the connection to the server
but not for the player itself
So I looked inside AuthSessionHandler, in line 141 you change state to Play, fire LoginEvent
then switch Handler to InitialConnectSessionHandler and fire PostLoginEvent, so all logic is handled by InitialConnectSessionHandler, am I correct? I started using velocity yesterday so i could make some mistakes.
And of course, if sending pluginMessage will be allowed in InitialConnectSessionHandler, some logic needs to be copied from ClientPlaySessionHandler (like firing PluginMessageEvent) 😄
Again I see how this issue could arise. Open an issue on GitHub and we will look into it soon.
Besides that- which versions are you coding this for? On 1.13 and newer there’s a better solution
1.8 as a base, but with ViaVersion
So you want to interact with a client mod?
yep, i need to send as soon as possible some data with PluginMessage and wait for response
just before you get your hopes up
even if we fix it
some versions will not be able to respond correctly before the client is first initialized
(aka has joined the first server successfully)
yea, i know but this mod only works on 1.8, so i know it will work, beside that i already "hardcoded" fix and tested it
should I use a single app for both messaging and data storage or can I use rabbitmq or redis for messaging and mysql to store stats?
but I wanted to confirm if it is a bug or just my mistake, I will make an issue on GitHub right now
I don't really think there is any big difference, but just asking what is considered a better practice
mysql also has “notify” functions but I am not sure how well they work with the java adapters
I prefer using a single app it is easier to maintain a single app than two 😄 Right now I store important data inside MySQL, like player data, etc and in Redis, i store caches and generated to TopList(which can be generated again from MySQL), Redis is just faster than MySQL
I heard that mysql can be used for messaging (like luckperms does) but should not be the choice if I can choose between redis/rabbitmq and mysql
I mean, it's a hack
thanks, I'll probably do the same I think
You basically just create a table which stores rows and poll the db for entries since the last record you read
I would argue that MySQL can be really fast, but you have to use it correctly for that actually to apply
what would be the correct way to use it?
transactions and pre-compiled sequences
correct use of indexes and relations
correct constraints and data sizes
list goes on
Ofc MySQL can be fast with correct indexes, caching etc but Redis is still faster 😄
yea, but redis persistence is a joke
That's why I am using it for cache and for generated data, at any time I can FLUSH ALL all data from Redis, and it will be back in like 5min without any problems 😄
redis is not for persistence anyway
it's for temporary data / cache / messaging if you want
@fossil sundial is the modern forwarding secret able to be provided by the system (sys prop/env var)? We have an issue where our secrets are defined at a system level so pushing it into a file during runtime makes no sense - it would be nice if we could securely push it into the environment under a hidden environment property, mainly for security
Putting it in the file space opens up a potential security issue for our users and I want to make sure we’re not falling into that. For now our unstable latest uses a legacy configuration to surpass this.
Haven’t had time to sift through that piece but thought you might know
VELOCITY_FORWARDING_SECRET
pinned message, first launch flag
2G heap, using almost 4G, which is really just the norm, but it does seem to go up slowly over a while, so, maybe
how does velocity know what permissions a player has?
that makes more sense. whats the industry standard? just ignore velocity permissions?
luckperms
I think i messed up the kick event
[22:24:25 ERROR]: at lucid.hasx.BreezyFiok.lambda$onProxyInitialization$1(BreezyFiok.java:91)
[22:24:25 ERROR]: at com.velocitypowered.api.event.EventHandler.executeAsync(EventHandler.java:23)
[22:24:25 ERROR]: at com.velocitypowered.proxy.event.VelocityEventManager.fire(VelocityEventManager.java:598)
[22:24:25 ERROR]: at com.velocitypowered.proxy.event.VelocityEventManager.lambda$fire$5(VelocityEventManager.java:479)
[22:24:25 ERROR]: at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136)
[22:24:25 ERROR]: at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635)
[22:24:25 ERROR]: at java.base/java.lang.Thread.run(Thread.java:833)```
that is not the full stack trace
💀
Jeez, thanks, can’t believe I didn’t go look at that 
Hello friends I wonder if there is a configuration read object(Like SnakeYaml) in Velocity API
Are there any documentation about it? I researched but couldnt find anything
Velocity bundles configurate, which you can use, but you’re free to shade in and use any config provider you’d like to
If you like snake you can shade it into your project just fine
snake 🙏
Ok thanks ☺️
So I am working on a velocity plugin.
Which of the events (LoginEvent, PreLoginEvent, PostLoginEvent) should I use?
Currently I am using LoginEvent when the server is in online mode and PreLoginEvent if it is in offline mode.
Problem wih PreLoginEvent is that it just provides the username and not the Player object.
You should be using the LoginEvent in both cases as that’s the first event where the player object actually exists
ok thanks!
btw is there a way to get the player object from within execute(invocation) in a SimpleCommand?
Ah I see player extends it
ok ez
Heyo! I'm working on a velocity plugin that has commands that can be used across the server network (i.e. /send)
The command registers fine on the proxy, but not on any of the other servers, how can I have it register on the servs?
make a server plugin
stuff on the proxy runs on the proxy
the proxy will intercept that command when you have the correct perms, etc, iirc
otherwise it just passes through silently, but, if you want the commands to exist on the server for plugins to abuse, etc, you'd need a server plugin
I see, thanks! So what would the server plugin contain? I'm guessing it's not simply including the command in the plugin.yml
well, you'd need to have some way to communicate with the proxy
bruh
plugin messages for stuff like that is generally perfect, either using the built in bungeecord channel, or, a custom channel if you want your own logic
I thought so! Thank you for the help!
so the invocation.source() will never be player??
it should be the player if the player execues it
but you said its only proxy commands
or at least something associated with the player, iirc, see the JDs to see what that method returns and what extends that return type
the command exists on the proxy.
the proxy intercepts those commands
if the player runs a proxy command, it will run on the proxy
ok I see so i gotta do some additonal mc server side stuff to register the proxy commands there too?
no
once again, the proxy interecepts all the commands
if the command is registered on the proxy, and the player runs a command that they have perms for, the proxy will intercept it and handle it, running the command
For their specific case, stuff like /send, sometimes you want such a command to exist on the proxy so that signs or command blocks, etc, can run such commands
if you want something on the server itself to run a command, the command needs to actually exist on the server
but, that doesn't show relevent to your case
ok great!
player runs a command that they have perms for
Are player perms defined by the perms they have on the proxy or on the server they're running it on?
on the proxy
Thought so, thank you!
I'm reading the velocity api docs and it says to reply to a message I have to do:
source.sendMessage(TextComponent.of("Hello World!").color(TextColor.AQUA));
However when I try to do TextComponent.of, IntelliJ tells me that such a method doesn't exist, anyone know why?
I'm using API version 3.1.2
You're probably reading the old docs, the newer ones are hosted at https://docs.papermc.io/velocity/dev
Is there a way to get the players ip address from the player object?
where is that function?
i seee
im dumb
thanks!
I can't see velocity plugins messages on client 1.19
Is there a method to automatically center the motd lines?
no
Check those two classes
Ah centerText. Thanks
@Subscribe
public void onProxyInitialization(ProxyInitializeEvent event) {
logger.info("Initialized");
try {
jda = JDABuilder.createDefault("placeholder")
.addEventListeners(new MessageReceived())
.build();
logger.info("Successfully logged into client");
} catch (LoginException e) {
e.printStackTrace();
}
server.getEventManager().register(this, new PlayerChat());
logger.info("AxoVelocity ready");
}
None of my code within my ProxyInitializeEvent seems to be running and there's no errors, anyone know why?
I can provide the full main file if needed
You did annotate the class @Plugin and you did add the velocity annotation processor to run for your build goal with gradle/maven ?
How can I properly send players between servers?
player.createConnectionRequest(server); doesn't seem to work
gotta add .fireAndForget() to the end
or connect() if you want to handle errors yourself
Ohh that would make sense, thank you!
heres my main class: https://srcb.in/NWbZb3FYjd
Don’t use google’s subscribe annotation I believe
im so dumb
, thanks
Off topic, but I wouldn't recommend using this system as is: each character in the string to center incurs a linear search. Imo this is not premature optimization, a much better option is to keep a lookup table from ascii -> length/enum variant
Does "CommandSource" has an alternative method for its name who executed this command?
source#getName does not exist and I want to safe the name of the player / console. I could make an instance check if it's a player and then get his name and if it's not a player, then write as console, but isn't there a better/clean way?
source.get(Identity.NAME) would work
If you really desperately need a name
public static String getSourceName(CommandSource source) {
if (source instanceof Player p) {
return p.getUsername();
} else if (source instanceof ConsoleCommandSource){
return “Console”;
} else {
return “Unknown”;
}
}

not guaranteed to return something though
The reason we don’t have this in the api is that plugins check for name.equals(“Console”) more often than you’d think
There is a player named console
For that reason alone this is a hard no from us
Thank you for your answer
Hello there, so currently im getting this error, it seems like something is broken with minimessages?
This is where the error appears to come from? (Line: 39)
Update Velocity 
on the server lol
is it possible to block commands for players on a specific server only?
oh found the PermissionsSetupEvent. that should do it
Use the dev builds from https://papermc.io
The old velocity website is a bit problematic nowadays; we can’t exactly change it atm
Ah okay, where can I find these dev builds?
Downloads > Velocity
Yes, but i need those for gradle too
just change the version to 3.1.2-SNAPSHOT and swap the velocity repo for the paper maven repo
ah okay!
Why is the event.getSubject() of PermissionsSetupEvent of type VelocityConsole and not always Player?
ok guess I'll have to add an exception for that
see the known sub/implementing classes for types https://jd.papermc.io/velocity/3.0.0/com/velocitypowered/api/permission/PermissionSubject.html
You may also have plugins that implement their own types, Ive seen discord plugins do that for example
declaration: package: com.velocitypowered.api.permission, interface: PermissionSubject
Hello, how to switch player's server from a spigot server please?
use the bungee messaging channel
it's the same with velocity?
so it's working like this?
No
- wrong channel name, there is an example pinned somewhere or something
- you still have to actually follow the bungeecord channel spec, just sending a server name is gonna do nothing
okay thanks, but where can I find the channel name
it was like bungeecord:main or something for 1.13+
okay thanks
Is it possible to do something like in the spigot api where you can do ChatColor.translateAlternateColorCodes()
Could you give me a link to where I can learn more about it?
Thanks
Idk where to write this exactly but a Velocity Version of a Waterfall / BC plugin needs to be completely rewrote?
depends on how the plugin was designed, but, generally, yes
@fossil sundial I got server switching to work
It is possible to to avoid using a reset packet

Now we only need a platform to put it on
Yeah, but there is a but
the forge servers must be identical if you are gonna switch from one forge server to another
So it will still work for load balancing
I hope I didn't disappoint you
?
hi, is possible to run a server from velocity? i use Runtime.getRuntime.exec pointing to the right directory but seems that it won't run anything
thanks for helping
Can someone please explain how do I properly set the hash for the server resource pack?
Here's the link to the code and the error I get: https://paste.gg/p/anonymous/105f6b8a2cab4bac80b9a7153ba0a7b3
why on earth are you implementing proxy server
uh i assume that's bad
yes
sorry, i'm new to velocity's api and just java in general 🥲
what does this means: Playername has disconnected: multiplayer.disconnect.missing_public_key and how to fix?
That isn't related to Velocity plugin development.
mhmm Im getting this because of my plugin though
Did you disable force-key-authentication?
no. also dont know what that means
Go to line 19 in Velocity's config and disable force-key-authentication
Then restart
my velocity.toml doesnt have that
It should be there
Your config is old
Here's the current config
latest stable build
looks like the issue is related to 1.19.
I'll try your fix thanks
I think you accidentally picked an IDE auto complete option that you shouldn't have picked
What's the proxyServer variable there intended to contain
I definitely did
I honestly don’t know 💀
is it possible to use kotlin for plugins? Cuz i cant get .json file generated in jar
What were you trying to do
use kapt
^
Send a resource pack when a player join the server
im sorry but what i supposed to pass there?
the annotation processor
com.velocitypowered:velocity-api:3.1.2-SNAPSHOT
well IDs must start alphabetically, have alphanumeric characters, and can contain dashes or underscores.
Do I have to close previous connection after forwarding/redirecting the player to another server in ServerPreConnectEvent with event.setResult(ServerPreConnectEvent.ServerResult.allowed(newServer));
Im not even sure if forwarding like that works?
But since this is on the server pre connect event, there shouldnt be a connection yet...
Players get disconnected when doing it this way though... it says read timeout.
possible bug?
🐛
Heyo! Is it possible to get a connected server's logger through Velocity?
No- but you can implement a plugin channel message with a plugin on either side to send a log call downstream
I think you’re confused as to what you’re doing here. Velocity will itself handle all of that. The connection to a possible old/previous Server gets automatically aborted on the https://jd.papermc.io/velocity/3.0.0/com/velocitypowered/api/event/player/ServerConnectedEvent.html
declaration: package: com.velocitypowered.api.event.player, class: ServerConnectedEvent
Setting denied here only causes the proxy to abort the attempt to connect to this server. In the case the player currently doesn’t have a valid server and you don’t have any fallback servers or a plugin is not providing one the player will be kicked.
Otherwise the player will stay on his current server.
This may clear that up a bit:
To set the first server velocity attempts to connect you to use the PlayerChooseInitialServerEvent
If a player gets kicked or disconnected from a server you can listen to the player kicked event
And only if the player uses the command /server or the bungee channel is used by the server of another plugin is trying to connect the player somewhere else
Then is the only time ServerPreConnect is fired without your plugin having made the decision
All in all it should work. But if it takes too long then the proxy can’t fix it.
I opened an issue on github. The thing is that the new mc server says the player connected, but velocity seems to miss that and gives the timeout message.
Again, what’s the error message on the proxy?
Player read timed out
if there is none then you made the client wait for too long
you can reproduce with this example code: https://github.com/PaperMC/Velocity/issues/778
I assume this only happens on first connection?
Cause this code doesn’t cause it for me
its the first join on the proxy yes
there’s a hard 10s limit to join first. This is a known problem which is why I suggested you use the PlayerChooseInitialServerEvent
we cant fix that
i attached some logs to the issue
bruhh
Its a client limitation. From the first packet the client sends to the client joining must not exceed 10s or the client will abort the connection
but what is the issue here? it doesnt take 10 seconds to redirect the player..
I don’t know what to tell you. But I myself can’t reproduce your problem
and the client hitting the limit is the only reason you’d get a timeout here
How long are you holding the event for?
which version of velocity were u using?
milliseconds
maybe add like Thread.sleep(100) after event.setResult
currently velocity only validates that chat messages are sent in order but ignores command packet timestamps, is that intended? the vanilla server checks both
There are two issues on the tracker that affect that. Currently commands are not tracked to work around another issue
1.19 servers, 1.19 client, velocity 3.1.2-SNAPSHOT, latest build
package me.fivepb.testplugin;
import com.google.inject.Inject;
import com.velocitypowered.api.event.player.PlayerChooseInitialServerEvent;
import com.velocitypowered.api.event.player.ServerPreConnectEvent;
import com.velocitypowered.api.event.proxy.ProxyInitializeEvent;
import com.velocitypowered.api.event.Subscribe;
import com.velocitypowered.api.plugin.Plugin;
import com.velocitypowered.api.proxy.ProxyServer;
import org.slf4j.Logger;
@Plugin(
id = "testplugin",
name = "Testplugin",
version = "1.0-SNAPSHOT"
)
public class Testplugin {
@Inject
private Logger logger;
@Inject
private ProxyServer server;
@Subscribe
public void onProxyInitialization(ProxyInitializeEvent event) {
}
@Subscribe
public void onPreConnect(ServerPreConnectEvent e){
e.setResult(ServerPreConnectEvent.ServerResult.allowed(server.getServer("survival").orElseThrow()));
}
@Subscribe
public void chooseInitial(PlayerChooseInitialServerEvent e) {
e.setInitialServer(server.getServer("lobby").orElseThrow());
}
}
cannot reproduce.
the choose initial is just there so you see that the original server is not the same server
you can remove that, no change
dammn thats great. what settings have you used?
try running it with these:
player-info-forwarding-mode = "modern"
force-key-authentication = false
forwarding-secret-file = "secret.txt"
When trying it with player-info-forwarding-mode = "none" (default) I get directly kicked with Unknown login plugin response packet! message.
Funny enough that’s what I used
ooof
It is something with the server you’re being sent to if nothing else
Try another server
It even fails when connecting to the actual server instead of forwarding to another one
The only thing I can think of is another event of my plugin interfering somehow...
You could try running my plugin?https://github.com/Osiris-Team/VelocityAuth
I can’t reproduce your issue.
Also your use is unsupported (piracy).
If you find a way to reproduce it with a supported setup and it is indeed caused by velocity then please open a new issue on GitHub
ok. just to be sure. PreLoginEvent, ServerPreConnectEvent, PermissionsSetupEvent, ServerConnectedEvent and DisconnectEvent, can do nothing to interfer with each other? Since I have no exceptions or any signs of issues thrown in each of those events.
Those run in sequence
PreLogin > PermissionSetup > ServerPreConnect > ServerConnected
I left out the events that are fired between them
Ok great. Just removed all other registered events, except the forwarding, and indeed it works
Another event is interfering
Now going to add one event after another and find out which one
brb
found the culprit... @fossil sundial I thought u could do long running stuff on the ServerConnectedEvent
guess i gotta use the postserverconnectedevent
nevermind. the stuff I was doing in that event has to be done in async
thx for the help
how can i get the server name from an argument?
optional reports that is empty while it isn't
how to get backend server online? only ServerPing?
anyone know how I can disconnect a player with a displayed component without printing it out on the console? Or print out the console with a shorter version instead of the component shown to the player
just log something to the console before you disconnect them?
i mean it still shows "ABC disconnected: (long reason)"
well yeah but that solves your issue of "unreadable thing being printed to console"
https://github.com/adde0109/Ambassador I'm almost finnished. I'm implementing checksum calculation on the forge side so the velocity plugin can check more efficient if handshakes matches
When that's done, V0.2 is released
This is very inefficient way, It donwloads the handshake AGAIN just to check if it's still the same as before (because the server admin could have restarted the server to updated a mod in the meantime and the handshake would then be different)
This can happen, so I want to use checksum to make sure the server hasn't changed, and not have to download the entire handshake every time someone wants to switch servers
Also right now it just prints "Resync" needed in the console. This is a placeholder for what I'm gonna do I V0.3, which is this "kick to reset"-packet
Because ping forwarding is not high priority right now
So
that's the plan
Does anyone know what might be causing this?
Disconnect packet works normally
But there's a tineout on clientside
Does stuff executed by the proxy.getScheduler() get executed in async?
there’s no asynch on velocity. there is only context. it just gets executed without link to anything else
really unfortunate that they just didn’t add the reset packet to forge again so you don’t need dumb workarounds
literally such a dumb regression that they literally know about
I'm trying to make the workaround as invisible as possible
Reset packet induces a unstandard state transition that forge agreed they didn't wanna deal with years ago, especially as it woulda caused issues across the board with nothing expecting that and proxies being shaky as all shit back then
I have looked at how forge works and have adapted my plugin after that to make forge as stable as possible
My plugin keeps track on forge snapshots config files and modlists and maneges them so the client always is synced
Does velocity support plugin message like bungeecord to move players between servers?
yes, it supports the bungeecord channel
Ok thank you
@brisk steeple heads up
The 1.19.1 update will add modern forwarding v3 to Velocity
v2 has the Revision 1 player key type
v3 has the Revision 2 player key type
- the uuid it is signed against (if present)
If you ask for v3 you may get a v2 response.
The revision 1 key from 1.19(.0) is unusable on 1.19.1 so you must ignore it on that server version
This scenario may happen if you have ViaVersion somewhere in the pipeline but is technically still valid
Thanks for fabricproxy-lite!
The changes are as seen here
Ping me if you have questions about it
ok
nevermind, its not velocity issue
but i still dont know how to fix that 😭
anyone
;-;
the client has an idle handler on the network connection
you have 30 seconds to start sending packets to the client from when the thing connects before it DC's
well the backend server sends packets but it doesn't seem like velocity forwarded them
net.minecraft.network.handshake.client.C00Handshake@7bde6b57
net.minecraft.network.login.client.C00PacketLoginStart@2cfe1362
net.minecraft.network.login.server.S03PacketEnableCompression@2634d717
net.minecraft.network.login.server.S02PacketLoginSuccess@1b637b4f
im only receinvg these packets on my client
and backend logs say that the client has connected
yea, those packets are only handled between the proxy and the server
you can't send login start to a client which is already joined, etc, and so velocity manages that mess
you basically need to get the client into the play state within a reasonable amount of time
Does Velocity has it's own config management? Or should I just use Gson?
Velocity provides (sponge) configurate-3

