How to send message to player after join


#1

Hello, Im creating little Auth plugin with my friend and we are stuck on one thing. In some case we cant get to work sending message to player after joining server. We cant even get the player after joining cuz it will apppear with few errors. Can somebody help us to resolving this problem?


#2

You are describing what you are doing, but without code we cannot know what you are actually doing. Please post code.


#3

As pie_flavor states. We do need code to help you. You also stated “a few errors”. Thouse errors would be handy too.


#4

Yea sorry about not posting the code but i did not have it in PC in that time. Anyway here is it:

Geting player and sending message is on the end. It also appears with error that it cannot be used in that way or what. I dont know it exacly.


#5

What you are currently doing is registering a command every time a player sends a message.

Also the send message bit. You dont use a @Getter for that event. It has the getting of the player in the event


#6

There are actually a number of problems here.
First, you’re registering a command every time a player joins. This is a Bad Thing. You should be registering commands in initialization.
Second, looking at your command executor code, you’re calling toString on arguments. The intended way would just be to include a type parameter in getOne, such as <String>. What you’re doing could turn into a Bad Thing if you use it in places that aren’t strings.
Third, you’re sending “Please register with /register” regardless of whether the command was successful or not.

Also, saying that it says something but you don’t know what it says is completely useless. Please post exactly what it says.

The real problem here is your import statement:

import jdk.nashorn.internal.objects.annotations.Getter;

Nope.
You need to be using Sponge’s Getter, not the JDK internals.