#help-development

1 messages · Page 1561 of 1

sullen dome
#

lol? there's a BlockDropItemEvent?!?!? i probably never stop learning lmao

quaint mantle
#

idk

opal juniper
#

Unfortunately, this feature is only on bedrock. you do have to use bungeecord to do this on java

sullen dome
#

thanks bud

near crypt
#

okay

tired dagger
#

You're welcome

wide dune
#

BungeeMessaging, 100% possible

near crypt
#

what is BungeeMessaging?

#

xD

sullen dome
#

one sec

opal juniper
#

the channels

sullen dome
#

there you go

quaint mantle
#

just use serverselector x

#

works liek a charm

opal juniper
#

so up the threshhold? idk i dont get kicked

near crypt
#

and is it in spigot or in bungeecord?

wide dune
#

Spigot you can do it in

sullen dome
#

spigot

near crypt
#

ok

wide dune
#

Register an outgoing channel to bungee, then send the connect message

sullen dome
#

works with the bungeecord api, that is included in spigot-api

quaint mantle
#

wait rlly

near crypt
#

and the plugin has to be on both servers?

sullen dome
#

so, no learning of bungeecord needed

#

no

#

just on the one, you wanna join FROM

#

one sec, i can even give you smt instantly

opal juniper
quaint mantle
#

yep

#

told u

#

that wat i trying to do

#

set fly to on when u take off

#

and when land set it to false

sullen dome
# near crypt and the plugin has to be on both servers?

you need to use this one to connect to a server. player is the player you wanna connect, server is the name defined in your bungeecord config.yml.

    public void connect(Player player, String server) {
        ByteArrayDataOutput output = ByteStreams.newDataOutput();
        output.writeUTF("Connect");
        output.writeUTF(server);
        player.sendPluginMessage(Main.getPlugin(), "BungeeCord", output.toByteArray());
    }```

and in your onEnable, put this
```java
this.getServer().getMessenger().registerOutgoingPluginChannel(this, "BungeeCord");```
that's it
quaint mantle
#

bruh

#

why dont u just

#

do this

sullen dome
#

?

quaint mantle
#

ezpz

sullen dome
#

he asked how to code it

#

i answered that question

#

easy peazy

quaint mantle
#

well its open source

#

if he wantsd

near crypt
sullen dome
#

spigot

quaint mantle
#

spigot

near crypt
#

okay and nothing else needed?

sullen dome
#

yea

#

except the bungeecord proxy running

quaint mantle
#

if u wanted u can make an api to put in all ur other servers to check if its online or not]

sullen dome
#

with your 2/more servers

near crypt
#

and how do i teleport the player to this server?

sullen dome
#

with the method i sent

#

just call it

#

and you teleport the given player to the given server, easy peazy

near crypt
#

so the method automaticly does that?

sullen dome
#

yea

#

if you call it somewhere

#

like one sec, i show you

quaint mantle
#

ezpz lemon sqeezy

#

👍

opal juniper
sullen dome
#

thats what i use in my /hub command:

    @Override
    public boolean onCommand(@NotNull CommandSender sender, @NotNull Command command, @NotNull String label, @NotNull String[] args) {
        if (sender instanceof Player) {
            if (args.length == 0) {
                Main.getPlugin().getMessenger().connect((Player) sender, "lobby");
                sender.sendMessage("§aYou are now connected to Lobby.");
            }
        }
        return false;
    }
quaint mantle
sullen dome
#

just call it, and you'll sent to the server. except you're not allowed to. but that's shown in chat in most cases

quaint mantle
#

not everyonw will do tht

opal juniper
sullen dome
#

not possible then

quaint mantle
#

omg

sullen dome
#

riding an enderpearl is on minecraft-side illegal flying

#

i guess

quaint mantle
#

yes it s

#

nddfbhdbj

#

i wanted to set fly to true

opal juniper
#

there is probs a way thru

#

nms

sullen dome
#

nms 🦆
i'm out, joke

quaint mantle
#

im good

opal juniper
#

well its not gonna be exposed by spigot is it

#

literally in the server.properties

quaint mantle
#

fshdfdsvfvsdfbs bk

#

i wanted to set fly to true

sullen dome
#

his issue is, if he's making it public, other people will have issues when they don'T set flying in their properties

quaint mantle
#

but idc no more

opal juniper
#

i understand

#

well, just cancel the kick event if it is for flying ig

sullen dome
#

well, that's actually an anticheat-breaker i guess?

opal juniper
#

on bukkit

quaint mantle
sullen dome
#

nms <3

#

i love nms... not

opal juniper
#

that is craftbukkit i think...

sullen dome
#

idk

quaint mantle
#

[12:08:08 WARN]: BunkDev2 was kicked for floating too long!

#

float

opal juniper
#

well do it how i did it the first time

near crypt
sullen dome
#

yea

#

or use the existing

#

like

opal juniper
sullen dome
#

Main.getPlugin(Main.class) iirc

quaint mantle
#

butts

opal juniper
#

but what

near crypt
#

yeah okay

sullen dome
#

just replace main with your mainclass's name

#

ofc

opal juniper
#

u will have to do it like this then @quaint mantle

sullen dome
#

but i'd suggest creating those

   private static Main plugin;
    public static Main getPlugin() {
        return plugin;
    }```
opal juniper
#

i literally dont understand you

sullen dome
#

at least thats what i do everytime

opal juniper
#

you dont want to do it the best way, because you have to include some nms code

quaint mantle
#

lmao

#

nms = my ass

#

i hate

#

nms

opal juniper
#

dont we all???

sullen dome
#

yea

#

nms more like nmtrash

#

heh

#

heh

opal juniper
#

but it is sometimes necessary

sullen dome
#

funny right?

opal juniper
#

no

sullen dome
#

:(

opal juniper
#

not really

sullen dome
#

sad

quaint mantle
#

:[

sullen dome
#

the getter for the class where the method is in

quaint mantle
sullen dome
#

if you like static abuse, just make the method static :/

quaint mantle
#

yes its the "getter"

sullen dome
#

i'm just trying to get away from that static abuse

#

so i'm making a getter/constructor for like everything

#

maybe even worse than before lol

#

stay in english

#

people dont like that

near crypt
#

yeah

#

ik

sullen dome
#

not my fault :/

#

if you need german help, dm me

opal juniper
#

german is a cringe lang

sullen dome
#

stfu

#

german is og

opal juniper
#

but english is cringer

quaint mantle
#

AYO

sullen dome
#

^^

quaint mantle
#

some pple would get offended by that

#

lol

sullen dome
#

german is best thing

#

you ever heard Krankenwagen? sounds funny

opal juniper
#

yeah

sullen dome
#

Umfahren is the opposite of umfahren

#

my favourite

opal juniper
#

am a native english speaker who learnt german. a lot of the words just seem... odd

sullen dome
#

yea true tho

#

like... Lastkraftwagen... i mean, people just say Auto, but still... why does that words even exists

#

nvm

opaque bane
#

I'd suggest using composition over a static reference when possible

sullen dome
#

lastkraftwagen is a truck lol

earnest sonnet
#

go to #general for that kind of stuff, don't flood this channel

sullen dome
#

sorry :/ got ya

opaque bane
#

accessing a static reference via getter doesn't change the fact that it's static

quaint mantle
#

korbsti

#

is there any way

#

to edit the sounds

#

of villagers

#

when they have seggs

sullen dome
#

lol

quaint mantle
#

i think u know wat i mean

sullen dome
#

yea

quaint mantle
#

is it possible?

tardy delta
#

Hi!

sullen dome
#

do they even make sounds in that event? lol

tardy delta
#

Whats the problem?

quaint mantle
#

idk

tardy delta
#

What does .getmessenger() do?

sullen dome
#

wdym? from my code?

#

if so, returns the instance of the class

tardy delta
#

Uh never worked withit

quaint mantle
chrome beacon
#

#help-server and make sure you are connecting to the bungeecord and not the server

#

@last temple ^

waxen plaza
#

is there any tutorial on how to implement vault perms? all I find is for economy

chrome beacon
#

They have examples on their github page for it, right?

waxen plaza
#

I think they do, I'll check

subtle kite
#

so
player.performCommand();

makes the player do a command??
and if so do I need to do the /
player.performCommand("/heal");
or
player.performCommand("heal");

#

ok

umbral pagoda
#

hi

wild marten
#

A bungeecord server is the proxy server, like how you join Hypixel and from there you can connect to other smaller servers. A proxy server is a bungeecord server where all of the connections are held allowing you to hop around non-proxy servers while not having to change IPs

waxen plaza
#

Why when I add 2 or more aliases to a command they don't work at all, but when I have only 1 alias it works

#

I set the list of aliases like this [alias1,alias2]

crisp citrus
#

if i run .toString() on a uuid, does it give me the uuid with or without the dash thingies

dusk flicker
#

With

tardy delta
#

is there a simple way to add more files to the plugins folder?

weary geyser
chrome beacon
#

new File(getDataFolder(), "cool file");

^ from memory may or may not work

tardy delta
#

i meant do i neeed to write all this twice

dusk flicker
#

no

#

you dont even need to write that once

#

Not sure why you recreated the method

subtle kite
#

how do I fake a User has left the game!

#

I know how to do command and all that.
but for example if I do /leave in game
I want it to look like I left the game for everyone else

hybrid spoke
#

and make the player invisible/hide him from other players

subtle kite
#

yeah I was thinking that would be the way

ornate heart
#

How would I compare 2 custom items? I know that comparing them via display name isn’t the best option because players can rename items.

lusty cipher
#

ItemStack.equals()?

ornate heart
#

.equals() only returns true if they’re the same ItemStack object which is not what I want

eternal oxide
#

isSimilar compares everything bar stack size

lusty cipher
#

well what comparison do you want to do exactly

ornate heart
#

Cool. I’ll try that out.

unreal quartz
#

so it is valid for your use case if the amounts are the same as well

dusty sphinx
#
                    CompletableFuture<Boolean> serverConnectionFuture = new CompletableFuture<>();
                    player.connect(serverInfo, (status, throwable) -> {
                        if (throwable != null) {
                            serverConnectionFuture.completeExceptionally(throwable);
                        } else {
                            serverConnectionFuture.complete(status);
                        }
                    });
                    boolean connectionStatus = serverConnectionFuture.get();```
whats wrong with the code here? the callback never returns
ornate heart
unreal quartz
#

you can look at the source code and see the implementation yourself

#

but it’s just everything about the item i’m pretty sure

vestal dome
#

uhh

#

Should I use ClientboundSetTitleTextPacket or PacketPlayOutChatPacket for 1.17 title packet sendings? (Yes NMS..)

#

I ask this because both of them have a something in common that is to send a title packet, but I don't know which one of them actually does the trick...

#

or if both do.,

vestal dome
ornate heart
#

1.17

hybrid spoke
#

use the PDC

#

oh wait, does ItemStack has a PDC?

ornate heart
#

I’m not adding keys to PDC. I’m making a sacks plugin. The plugin owner defines what items are eligible to be put in a sack via GUI.

These items can be custom items. I just needed a way to compare them

#

Yea it does

eternal oxide
#

yes ItemStack has PDC

#

ItemStacks, Entities, TileEntities and Chunks have PDC

hybrid spoke
#

good, wasn't sure since the javadocs doesn't show me the PDC

hybrid spoke
#

ah, thanks. i am just dumb. i looked for itemstack, not for itemmeta

summer scroll
hybrid spoke
ornate heart
ornate heart
summer scroll
#

yes pdc then

ornate heart
#

I need to check to see if the item them are trying to place into the sack, matches the eligible items that can be placed in the sack

#

How would I use pdc

eternal oxide
#

then yes, just add a PDC flag to mark the item as valid for the container

#

?pdc

ornate heart
#

I know how to use pdc I just don’t think I explained it correctly.

If I’m trying to compare if an item from a random plugin like ItemsAdder is eligible to be put in the sack, then I wouldn’t check it’s PDC because it’s ItemsAdder’s item. I haven’t added any keys to it.

eternal oxide
#

then either add a key to it or you have to maintain your own list of allowable items

forest edge
foggy bough
#

I have this piece of code here```java
@SuppressWarnings("unlikely-arg-type")
@EventHandler
public void onDeath(PlayerDeathEvent e) {
if(e.getDrops().equals(Material.COMPASS)) {

    } else {
        return;
    }
}``` how can I clear a specific drop from the player?
vestal dome
#

e.getDrops()

#

if not mistaken

hybrid spoke
forest edge
hybrid spoke
#

^

summer scroll
foggy bough
forest edge
#

That is a lambda

#

I dont have time to explain but maybe someone else does

foggy bough
#

here let me try something

#

and I will show

eternal oxide
#

that loops over every item i and the tests Predicates if it is to be removed

#

a Predicate is basically a boolean test

#

so if i.getType() == x (you provide X) it will be removed

#

ie (i -> i.getType() == Material.STONE);

#

removes all stone from drops

foggy bough
forest edge
#

Precisely

waxen plaza
#

How do I make my permission nodes show up when I use for example luckperms plugin?

forest edge
#

However if you used a normal foreach loop I think it would cause a ConcurrentModificationException?

foggy bough
#

ok so like this? ```java
for(i -> i.getType() == Material.COMPASS) {

}```

lusty cipher
#

no

#

you literally got an example

worldly ingot
#

o.O That's one heck of an attempt at a for loop

stone sinew
lusty cipher
#

removeIf is a function that takes a Predicate for each item in the original list. So i -> i.getType() == x checks if the type of each drop is equal to x. Essentially the same as:

for (var drop : e.getDrops()) {
  if (drop.getType() == x) {  
    // remove the drop (doesn't actually work), which is why we use removeIf()
  }
}
foggy bough
#
Material x = Material.COMPASS;
        
        if(e.getDrops().equals(Material.COMPASS)) {
            e.getDrops().removeIf(i -> i.getType() == x);
        }``` ????
eternal oxide
#

literally e.getDrops().removeIf(i -> i.getType() == Material.COMPASS);

lusty cipher
#

no that makes no sense

#

wtf

#

lmao

foggy bough
#

I am going to get rid of that if

eternal oxide
#

get rid of it all

lusty cipher
#

getDrops is a List of everything it will drop. Why would you want to compare it to a Material?

eternal oxide
#

you use teh exact code I just showed you and nothing else

foggy bough
#

this? e.getDrops().removeIf(i -> i.getType() == Material.COMPASS);

lusty cipher
#

🎉

eternal oxide
#

removeIf iterates over every item in the Collection

stone sinew
tardy delta
#

is there a way to find how many fileconfigurations your plugin has?

eternal oxide
#

you keep track

#

build an index, or count the files

waxen plaza
#

Is it possible to create permissions at run time?

eternal oxide
#

yes

waxen plaza
#

How?

eternal oxide
#

depends on your use case

waxen plaza
#

ok

eternal oxide
#

What are you trying to do?

waxen plaza
#

Working on a private chest command I use /open (chest_name) to open it and I can add or remove them

#

and people with ranks will have access to more chests depending on how the owner sets it up

eternal oxide
#

I don;t see that you have to create any permissions

#

you just test if (player.hasPermission("chest." + chestname.toLowerCase()))

vestal dome
#

does anyone here know 1.7 NMS?

eternal oxide
#

You will have to make sure the name is only a-z and convert spaces to _

quiet hearth
#

I have been trying to figure out how you would add custom skulls to the game for like say a head that looks likes fries that replenishes hunger. I just am not sure how u create that skull in the plugin itself

waxen plaza
#

ok that shouldn't be hard to implement then

vestal dome
#

@dusk flicker I could care less if you don't care at all

waxen plaza
marble rivet
#

Whenever I use worldcreator to create a world, it keeps making the spawn point 0 0 for some reason
nvm its a glitch with spigot on certain minecraft versions

eternal oxide
waxen plaza
unreal quartz
eternal oxide
eternal oxide
#

You can register them to yoru plugin though

waxen plaza
#

Ok

eternal oxide
# waxen plaza Ok

Bukkit.getPluginManager().addPermission(new Permission("your.permission"));

eternal oxide
#

Then they would show up in the LP UI thing

vestal dome
#

Since I am mapping NMS..

tardy delta
#

what does plugin.getConfig() returns when there are multiple config files?

vestal dome
#

config.yml

#

other configs you have to build them yourself..

tardy delta
#

ah

waxen plaza
#

@eternal oxide I made a test command and it works great! now all I need is to add the permissions again whenever I start the plugin.

eternal oxide
waxen plaza
green prism
#

Hi to everyone.
I got a problem with p.spigot().sendMessage. When I do txtComponent + txtComponent in the sendMessage it leaves to me a "log/description" of the textComponent
(Others txtComponents works! Only yes and no do that)
---------------------------------------------------------------------------
Code regarding the creation of yesTextComponent e noTextComponent: https://paste.md-5.net/didogiputi.coffeescript

SendMessage Line: https://paste.md-5.net/ebehegawel.css

Image of the result: https://i.imgur.com/QGRu4DS.png

eternal night
#

Text components are not concatenated using the '+' operator

#

You usually either want to add them to a component builder one after another or simply compile them all into a single array

green prism
#

Thanks

hardy swan
ivory sleet
#

Kinda agree, that would be syntactically nice

eternal night
#

Seems pretty impossible concerning in the end a single component with a bunch of children has to be sent

#

Spigot would have to invent some useless format and parsee for stringified components

#

Which seen resource intense af

ivory sleet
#

Lmao yeah

elfin creek
#

https://ibb.co/fk1TWRv
why do i get an error in the override i just created a new porject,
i created another project too but i still get the error

elfin creek
eternal oxide
#

File menu, invalidate caches

#

then restart your IDE

elfin creek
#

ok

elfin creek
#

:)

#

i there a way to compile projects dictly without using maven like in eclipse in intellij

eternal oxide
#

right hand side maven menu, lifecycles

#

I believe you can other ways but no clue as I use Eclipse

dusty sphinx
#

This is probably a potato brain question, but how do I interface with a BungeeCord plugin from a Spigot server

#

As a plugin

eternal oxide
#

Plugin Messaging Channels

dusty sphinx
#

As I thought

eternal night
#

Obviously has the issue that your server needs a player on it

elfin creek
# eternal oxide right hand side maven menu, lifecycles

i tried eclipse today but gave up cuz i know less code lol i didnt knew how much intellij was helping me i had to google search for everything in intellij one thing i liked is the genaration of har files is very fast whereas in intellij takes more than a minute

dusty sphinx
#

That's not an issue

#

Just wondering how to use it

eternal night
#

Google can help I think

#

There should be spigot wiki on it

hardy swan
eternal oxide
#

he means single button click

hardy swan
#

oh

#

thats why learn mvn commands😉

eternal oxide
#

In Eclipse you just click the run configuration for the project and it builds.

vernal basalt
#
if (player.isOnline() && player.hasPlayedBefore()) {
                    player.getPlayer().kickPlayer("You have been banned");
                }``` why is this an error
eternal oxide
vernal basalt
#

player is an ofline player

#

normally i can understad errors

#

but i can't

dusk flicker
#

thats an async catcher

eternal oxide
#

then you can;t kick them

vernal basalt
#

on this one

dusk flicker
#

means you cant run that async

vernal basalt
#

im checking if the offline player is online

#

and then kicking them

eternal oxide
#

if they are offline you can NOT getPlayer() and you can;t kick them

#

ok, makes more sense

#

anyway, don;t kick Async

vernal basalt
#

how do i kick them

eternal oxide
#

the error tells you as such

#

runTask(

#

bukkit scheduler

hardy swan
#

why is player.getPlayer() a thing?

eternal oxide
#

His player is actually an OfflinePlayer

hardy swan
#

ohhh

#

Optional best

elfin creek
hardy swan
#

you... idk

#

why you hate maven?

eternal oxide
#

maven is great

elfin creek
eternal oxide
#

You shouldn't

elfin creek
eternal oxide
#

What lifecycle are you using to build? or are you making the mistake of using Artifacts in Intelij?

hardy swan
#

why does intelliJ have such a cool discord game status but not vscode

eternal oxide
#

correct

#

if you are having those errors come up run a clean and see if tis fixed

eternal oxide
#

You actually have a bridge build which is clean/package under your configuration

#

in your maven window

#

yes

sharp bough
#

is there a function to check if all arguments in a boolean[] are true then return true?

eternal oxide
#

Afraid no clue then, you cache is messing up, but I don't use InteliJ so can;t advise

elfin creek
#

what do i do now

#

fresh install intellij

eternal oxide
#

try File -> synchronize

dusty sphinx
#

Should the plugin channel I listen to be BungeeCord or something else?

#

I'm creating a pluginchannel listener on the proxy

weary geyser
#

Is there any way to set the message in AsyncPlayerChatEvent to a text component?

opal juniper
#

no i dont think so

weary geyser
#

So I am trying to figure out a solution

shadow gazelle
#

Is there something that will tell you what version of the game someone is using?

summer scroll
#

Cancel the event and send the message using player.spigot().sendMessage()

opal juniper
shadow gazelle
#

So hooking into ViaVersion

#

:yay:

elfin creek
#

took lot of troubleshooting lol

shadow gazelle
#

What about editing what the version in the top right of the server shows?

blissful saffron
weary geyser
opal juniper
#

its just like player.spigot().sendMessage("string")

right?

opal juniper
#

?learnjava

undone axleBOT
weary geyser
#

?learnjava

undone axleBOT
blissful saffron
dusk flicker
#

thats not really a learn java error

#

its just confusing as shit to use itemstacks

weary geyser
dusk flicker
blissful saffron
#

Okay tyvm

shadow gazelle
#

How would I go about changing the version that appears in the top right of the server when you're in your server list?

dusk flicker
#

prob in the server list ping event

shadow gazelle
#

Ah

#

Thanks

maiden cape
#

e.getChunk().getEntities() seems to always be empty on ChunkLoadEvent. Any ideas on how to get around this?

shadow gazelle
#

Well, as far as I can tell, there's nothing about versions in there

dusty sphinx
#

Are plugin messages between the proxy and the backend server secure?

vague oracle
shadow gazelle
#

Oh

vague oracle
#

0 being the version I think

vague oracle
#

What are you trying to do?

weary geyser
vague oracle
mystic sky
#

Why getting that issue compiling BungeeCord?

vague oracle
#

You just split the string up where ever you need. Then for each section of the split string you can turn it into a textcomponent. Then use getServer().spigot().sendMessage(TextComponent...); and send all of the textcomponents in order. A textcomponent extends BaseComponent.

vague oracle
#

No problem 🙂

#

ItemStack.isSimilar(ItemStack), you can't compare itemstack object instances as im pretty sure they get copied and pasted meaning they don't have the same objectID as the one you created.

shadow gazelle
#

Is there any way to fix an anvil removing "illegal" enchantments?

waxen plaza
#

if I add permission in the plugin.yml do I still need to check when the command executes if the player has the permission?

mystic sky
#

yessir

shadow gazelle
#

My custom enchant gets removed from an item if you use it in an anvil to add another enchant

sharp bough
#

but i want to delete "2" for example

#

i have a way to do this wich is take each value from the next id and move it to the current id, when the next one is null i delete the last one

cold tartan
#

can you edit the player class?

sharp bough
#

that is not a good idea

cold tartan
cold tartan
eternal oxide
#

methods like?

sharp bough
#

you gotta really know what you are doing

cold tartan
#

which will return an origin from the Origin class

eternal oxide
#

what is an origin class?

dusk flicker
#

you cant really edit the player class without editing the server

cold tartan
eternal oxide
#

then make your own player class and wrap it

cold tartan
#

like "implements Player"?

eternal oxide
#

no, you create your own class, say User. It has a UUID and all the methods you want. add a getPlayer method so you can get a Player from it

vale cradle
#

You can't just implement player, if you want to make your own player you'd need to extend from the original NMS class wich is EntityPlayer

#

What you can do with this is very limited btw

#

But I don't see any other solution if you want to actually edit the player class

#

Unless you build your own server

devout spoke
#

some1 know how to check which gui opened and if the item clicked is in the gui?

cold tartan
#

event.getClickedInventory();

devout spoke
#

I have that
if(e.getClickedInventory().getTitle().equalsIgnoreCase(ChatColor.BOLD + "" + ChatColor.RED +"Teleport GUI")){
but there is an error at .getTitle()

mystic sky
#

Why im getting that issue with checkstyle.xml (When i compile BungeeCord)

eternal oxide
devout spoke
eternal oxide
#

e.getClickedInventory()

#

not getInventory

devout spoke
#

oh, Thanks!

eternal oxide
#

also getClickedInventory() can be null so reverse it, if (gui.equals(e.getClickedInventory())

quiet hearth
chrome beacon
#

What's the error

#

Also is that the full class

#

Or did you just cut it

quiet hearth
#

cut

#

just where the issue is

chrome beacon
#

Well idk what the issue is

#

So tell us

quiet hearth
#

it says "One related problem"

#

ok so when i click on it.. it takes me to my main class and says there is an error with "
getServer().getPluginManager().registerEvents(new BoomBallEvents(), this);"

hasty prawn
#

You have to do new BoomBallEvents(this), this);

chrome beacon
#

Yeah

quiet hearth
#

ah

untold gazelle
#

how do you send titles to players in the 1.8.8 spigot api? the sendTitle() and resetTitle() methods are deprecated

eternal oxide
#

use the methods that require more than just String

#

sendTitle("title", "subTitle", -1, -1, -1);

untold gazelle
eternal oxide
#

oh sorry, two strings

#

title and subtitle

untold gazelle
#

oh okay it's still deprecated but i'm gonna use it anyway

wraith ingot
agile anvil
#

Hello,
Does anyone know how to get a constructor in reflection that has a "int..." argument in it?

<class>.getConstructor(int.class)
```works well for a Constructor(int arg) but I'm searching for the Constructor(int... args).

Will the int[] works?
vale cradle
#

yes

agile anvil
#

Thanks

#

Confirmation it works

quiet ice
#

varargs are represented as arrays in bytecode

vale cradle
#

^^

agile anvil
quiet ice
#

np

shadow gazelle
#

What is the event for a player leaving?

#

nvm, found it

dense pulsar
#

If I were to be using WorldEdit on a plugin I am developing, would I put a worldedit jar into my external libraries?

#

Same with Vault

chrome beacon
#

Yes unless you're using maven or gradle

dense pulsar
#

I see, thanks

quaint mantle
#

hey whats the best way for me to keep a database for per player stuff like points or money?

ivory sleet
#

Best way?

dense pulsar
#

generally I see JSON

paper viper
#

Depends

#

For fetching small data in periodic times like once in a while you would probably choose a database or such

ivory sleet
#

Usually just have a dao which loads the dto on join and then unloads it on leave and also some sync timer

paper viper
#

For constant operations, then use like JSON or YAML because you load all the elements into the memory

#

And fast access speed for a lot of constant operations

dense pulsar
#

I have this clickable chat message ```java
TextComponent msg = new TextComponent(Utils.formatMsg("&n&oClick to join " + player.getDisplayName() + "'s party."));
msg.setClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/join " + player.getDisplayName()));

vale cradle
#

Use a database

paper viper
paper viper
#

Scale also matters

dense pulsar
#

damn

paper viper
#

You’d have to force a command to be ran

#

It sucks yea

ivory sleet
#

Hypixel even does that

#

Only way 😔

dense pulsar
#

very dumb

ivory sleet
#

Not really

quaint mantle
#

is that the same way essentials does it?

ivory sleet
#

Presumably

quaint mantle
#

I'm kinda looking for something like that

dense pulsar
#

they should've made ClickEvent inheritable so you could do something like ```java
msg.setClickEvent(newClickEvent() {
foo
});

#

or a lambda

ivory sleet
#

That wouldn’t work

paper viper
#

Sadly this isn’t swing

ivory sleet
#

The click is sorta client sided

chrome beacon
#

Well blame Mojang for that

paper viper
#

Yeah mojang does a lot dodo stuff

#

Their client is dog

dense pulsar
#

Its not a huge problem, I just need to set up a permissions system

vale cradle
#

I mean

dense pulsar
#

Have not figured out how to do that yet lol I think I need Vault or something

quaint mantle
#

Daddy

vale cradle
#

You're trying to execute code in the machine of the client?

vernal basalt
#

why is this whitelisting null

ivory sleet
#

/whitelist add null

vernal basalt
#
            UUID uuid;

            try {
                uuid = UUID.fromString(ctx.pathParam("uuid"));
            }
            catch (IllegalArgumentException e1) {
                ctx.json("No player found");
                return;
            }

            //uuid to player
            OfflinePlayer player = (OfflinePlayer) Bukkit.getOfflinePlayer(uuid);

            player.setWhitelisted(true);
            ctx.json("whitelisted " + player.getName());```
dense pulsar
paper viper
#

Yo that code tho

#

🥲

chrome beacon
ivory sleet
#

RMI 😌

dense pulsar
#

Just using permissions

chrome beacon
#

You don't really need Vault then

vale cradle
paper viper
#

Just read a bit up

chrome beacon
#

A good permissions plugin will handle bukkit permission requests

paper viper
#

It’s just about the click messages

#

That you can click on

dense pulsar
#

yeah but a permission plugin would be overkill for my scenario

paper viper
#

And how you can’t run a method directly

vernal basalt
vale cradle
#

You can just wrap your method in a command and execute set the click event on run command

dense pulsar
#

I mean this isn't for a massive server, just a minigame a couple of my friends will play, I could always just make a hash map in memory to do the permissions

chrome beacon
ivory sleet
#

Need_Not why not share some more code

vernal basalt
ivory sleet
#

I said more...

paper viper
#

You are using ==

vernal basalt
#
        app.get("/whitelist/add/:uuid", ctx -> {
            UUID uuid;

            try {
                uuid = UUID.fromString(ctx.pathParam("uuid"));
            }
            catch (IllegalArgumentException e1) {
                ctx.json("No player found");
                return;
            }

            //uuid to player
            OfflinePlayer player = (OfflinePlayer) Bukkit.getOfflinePlayer(uuid);

            player.setWhitelisted(true);
            ctx.json("whitelisted " + player.getName());
        });``` this is it sir
paper viper
#

That is comparing references

#

Is that supposed to be .isSimilar or .equals

#

Depending on your needs

ivory sleet
#

But anyways the player name might be null

chrome beacon
#

Well Inventory isn't a list of items either

vernal basalt
ivory sleet
#

Yeah

vernal basalt
#

but normally you can't be online without whitelisted

ivory sleet
#

Server#getOfflinePlayer(UUID) will have the name null if no name is cached

chrome beacon
#

Why are you remaking the whitelist command?

paper viper
#

Yeah lol

dense pulsar
#

you know the saying

#

"always reinvent the wheel"

paper viper
#

*dont

chrome beacon
#

Oh no 👀

chrome beacon
vernal basalt
paper viper
#

Just get the white list so far

#

And apply it to the bot

ivory sleet
#

Tbf I wouldn’t bother with the default whitelist

#

Just have your own

chrome beacon
vernal basalt
#

how do i run commands as console with the plugin

ivory sleet
#

Server#dispatchCommand iirc

#

Then just pass Server#getConsoleSender

chrome beacon
#

Use Bukkit instead of server if you need easier access

ivory sleet
#

😫

paper viper
#

Lol I use Bukkit if I have to

#

Like for static utility methods

ivory sleet
#

Myeah

paper viper
#

Static with static

ivory sleet
#

I’m used to pass the server. I did work for a fac server which had like 2 server instances

paper viper
#

Oop with Oop

#

😫

#

That’s so painful

ivory sleet
#

Yeah and it was 1.7.10

vale cradle
paper viper
#

🤡

ivory sleet
#

Myeah,

vale cradle
#

I mean, I can see many reasons why you'd like to do that

ivory sleet
#

Yeah they had their reasons to

vale cradle
#

But

#

The GC will go brrrrrrrrrrrrrrrrr

paper viper
#

Like what lol

#

I’m wondering

ivory sleet
tiny wolf
#

Hey, can I get the name of an offline player ?

ivory sleet
#

Uh depends

#

I mean if you used the getOfflinePlayer(name) method then yes

#

Else not guaranteed

paper viper
#

Make sure to do that asynchronous

#

Pls

tiny wolf
#

uuid is the way now

dusk flicker
#

yes but theres no other way atm

ivory sleet
#

It’s cause it’s blocking and makes a request to mojang shit

#

Paper got getOfflinePlayerIfCached(name) but it doesn’t replace the deprecated one

tiny wolf
#

also with uuid it gets from java

ivory sleet
#

?

tiny wolf
#

Ok, but why can I get a skull from offline uuid but not name ?

ivory sleet
#

Skull textures are mapped by uuids

tiny wolf
#

ok nvm,

shadow gazelle
#

tf

#

Anyone have experience with the ViaVersion API?

ivory sleet
#

Nope sry

shadow gazelle
#

The stupid docs are complaining that JS is disabled when it's enabled lol

#

rip

#

Is there any way to automatically "translate" protocols to Minecraft versions?

quiet ice
#

wdym?

desert marten
#

geol

#

You...

shadow gazelle
desert marten
#

You mean, make a 1.8 packet for example work for 1.16?

#

For example?

#

Or what

shadow gazelle
#

No, just automatically get the Minecraft version the protocol is for

#

Without something stupid like an if for every protocol number

quiet ice
#

That is what I thought

#

NMS has no API for that afaik

shadow gazelle
#

I was thinking maybe the ViaVersion API does

quiet ice
#

It should be noted that following 1.16.5, two versions might share a protocol id

shadow gazelle
#

But JavaDocs are being stupid

vale cradle
#

Maybe you'd like to use ProtocolLib?

shadow gazelle
quiet ice
#

that is what I said

vale cradle
#

Send the packet and afaik ViaVersion should translate it 4 u

quiet ice
#

he does not want to translate packets though

dense pulsar
#

lol who needs a permissions plugin ```java
public class PermissionManager {

private static final HashMap<Player, List<Permission>> activePerms = new HashMap<>();

public static boolean hasPermission(Player player, Permission permission) {
    return activePerms.containsKey(player) && activePerms.get(player).contains(permission);
}

public enum Permission {
    JOIN_PARTY, ALL_PARTY_COMMANDS;
}

}

quiet ice
#

Only a protocol id -> minecraft version lookup

dense pulsar
#

😢

tiny wolf
#

ItemBuilder.skull().owner(teamPlayer).asGuiItem().getItemStack().getItemMeta().getDisplayName() lol this should work

#

not totally a dumb way of getting a playername from uuid at all

quiet ice
#

You might want to ask #mcdevs, they should be aware of something that does that

dense pulsar
#

@tiny wolfI was getting a Player object from an item displayname earlier

#

not scuffed even remotely

tiny wolf
quiet hearth
#

in order to remove an enchant from an item in a players inventory would it be..
player.getInventory().getItemInMainHand().removeEnchant(Enchantmend.LUCK)
or do u have to get the itemMeta as well

dense pulsar
#

seriously? you can't do like Bukkit.getServer().getPlayer(uuid)??

desert marten
tiny wolf
#

they are offline

dense pulsar
#

ah

desert marten
#

getOfflinePlayer()

tiny wolf
#

doesnt work

desert marten
#

Would return offline though

shadow gazelle
dense pulsar
#

that's pretty funny then

tiny wolf
#

it returns CraftOffline...

dense pulsar
#

like an object?

tiny wolf
#

even inside getName

dense pulsar
#

oh

tiny wolf
#

ye..

dense pulsar
#

dumb

quiet ice
tiny wolf
#

see lol

vale cradle
#

Name needs to be fetched out someway, bcs bukkit doesn't store the name of each uuid and viceversa

#

If it's not fetched, or fetched async, then might return null

#

Or no, since you're just creating the skull and setting the owner, the display name must not change

tiny wolf
vague mason
tiny wolf
#

wdym

vague mason
#

use .getName()

vale cradle
#

I'm still not confident

#

You might block your thread without realizing

tiny wolf
#

ye so I figured out just now when I try to just do OfflinePlayer.getName() wont work but, Bukkit.getOfflinePlayer(UUID).getName will

#

so yay ig

vale cradle
#

That method can either block or return null if the player has never joined the server

#

I don't recall

tiny wolf
#

nope, according to the javadocs it returns a player no matter if they have ever joined

vale cradle
#

Then can block the thread

quiet ice
ivory sleet
#

Only getOfflinePlayer(String name) makes a request to mojang thus must be invoked carefully.

tiny wolf
#

what can go wrong ?

ivory sleet
#

Server freezes

tiny wolf
#

wouldnt that be the same issue for getting skulls ?

vale cradle
#

Still thinking that the method might not work as expected because the server doesn't cache all the player uuids and the respective name

tiny wolf
vale cradle
#

That's the thing

#

If you try to get it from mojang, you need to do a request

ivory sleet
#

^

#

try call getOfflinePlayer(String name) 50 times with random valid names vs getOfflinePlayer(UUID) on the server thread

#

should demonstrate some difference

kind coral
dense pulsar
#

login page

tiny wolf
#

logins ?

dense pulsar
#

pretty dumbfounding I agree

quasi flint
#

Cracked Server

#

Workin

#

U use this in cracked Servers to give Users some Kind of protection

dense pulsar
#

Will a player be able to in any way see a command that is ran for them?

weary geyser
#

Does NBTCompound#toString() return JSON? (NMS)

vale cradle
#

Better use AuthMe, lol

quasi flint
#

U have to set a password first join

dense pulsar
#

i wasn't talking about that

quasi flint
#

And then every other time enter that password

ivory sleet
quasi flint
#

U were not?

ivory sleet
#

not too sure

weary geyser
ivory sleet
#

MojangsonParser should do it iirc

#

the name might have changed

tiny wolf
vale cradle
#

well, ye

quasi flint
#

Better yet: Kill the guy who made it into existence

weary geyser
ivory sleet
#

I think you can figure out by just looking at their signatures

dusty herald
quasi flint
#

Haven't looked at src

#

Look at the src

ivory sleet
#

actually sysdm, for NBTTagCompound to String just #toString it

#

it will give u a valid json object

#

yeah

waxen plaza
#

Is there a way to force close an inventory for players that are using it?

clear galleon
waxen plaza
ivory sleet
#

Indeed

#

Yeah

hexed hatch
#

I just updated my IDE and it seems Java is just fucking gone despite it being in the project structure

ivory sleet
#

Material#getKey iirc

hexed hatch
#

does anyone know how to fix this?

weary geyser
hexed hatch
#

IntelliJ Idea

ivory sleet
#

Invalidate and restart caches

waxen plaza
#

go to project structure and select you jdk if you didn't

hexed hatch
#

I did

#

Trying invalidate first

#

that didn't work

waxen plaza
#

Weird

ivory sleet
#

Also u got the latest version of IntelliJ?

hexed hatch
#

Yeah

hollow river
#

hey i have villagers (npcs) which i spawn in during the onEnable event of my plugin, and remove by their uuid on the onDisable event. now there's a problem where after a while there are duplicates of the villagers (only one is real and the others become normal villagers) so i think there's something happening where the plugin's onDisable doen't run, but onEnable does. has anyone experienced something like it or know a good fix for that?

hexed hatch
#

Just updated it today

tiny wolf
#

anyone know why my gradle cant replace Version tag properly:

processResources {
    from(sourceSets.main.resources.srcDirs) {
        filter ReplaceTokens, tokens: [version: version]
    }
}``` its quite annoying
hexed hatch
ivory sleet
#

why Replace tokens

ivory sleet
waxen plaza
#

Did you select from project?

tiny wolf
hexed hatch
ivory sleet
#

expand shmezi

#
processResources.expand 'something': 'lol'

then in plugin.yml you’d declare ${something}

tiny wolf
#

Thanks ❤️

ivory sleet
vale cradle
tiny wolf
#

I should really learn all the stuff for gradle lol

hexed hatch
ivory sleet
#

Yeah it’s quite handy

tiny wolf
#

I just have a plugin in intelij that sets up my mc projects

ivory sleet
#

Oh that one

tiny wolf
#

thats the only reason I had that

ivory sleet
#

My gradle setups usually differ a lot so I just rewrite every time

dense pulsar
hexed hatch
#

How'd you fix it?

tiny wolf
#

haha ye me too, but Its simple import shadow jar stuff

dense pulsar
#

invalidate caches and restart always did the trick for me lol

hexed hatch
#

Oh

#

That hasn't worked twice

vale cradle
#

Then ur project structure is setup bad

ivory sleet
#

Might wanna try reinstall IntelliJ like worst case scenario

waxen plaza
#

What is the permissions.yml from spigot server?

hexed hatch
#

I don't know how it is, it's literally unchanged

#

I just updated the IDE version

#

Ooh, fixed it

#

Just changed my jdk version to 16

dense pulsar
#

intellij loves to have seizures randomly

hexed hatch
#

That should not have stopped Java 11 from working but oh well, I'm writing plugins for latest anyways

dense pulsar
#

never too consistent to be angry at though lol

weary geyser
#

Does anyone know how to use SHOW_ITEM in the hover event?

ivory sleet
#

Yeah

#

Well I do with bungee chat api and adventure

tiny wolf
#

ye use adventure, its pretty poggers

weary geyser
#

Alright

tiny wolf
#

Is there an event in spigot for when a server on the network shutsdown ?

ivory sleet
#

No need to use adventure if you’re not using something like paper

#

Nope

#

Or like there is sort of

tiny wolf
#

... whats the sort of

quasi flint
#

onDisable

#

Will do it

tiny wolf
#

in the proxy smh

ivory sleet
#

No you can technically intercept the stop command

#

But a really bad workaround

quasi flint
#

Haven't read the question prob. Sowy

tiny wolf
#

wouldnt work for crashes

ivory sleet
#

Myeah exactly

quasi flint
#

If it crashed the event wouldn't get fired either

ivory sleet
#

BungeeCord is the way to go here

tiny wolf
tiny wolf
ivory sleet
weary geyser
#

hoverEvent(What do I put here?)

tiny wolf
#

reload command is always a bad idea

ivory sleet
#

Which one sysdm

#

Still used

weary geyser
#

Adventure

ivory sleet
#

HoverEvent.showItem

weary geyser
#

Ahaa

tiny wolf
#

I guess Ill try using bungee messaging onDisable

quiet hearth
weary geyser
quasi flint
#

Probably HovereventSource.smth

weary geyser
#

Nope

waxen plaza
#

?paste

undone axleBOT
quasi flint
#

HoverEvent.Action.smth

#

That's it

waxen plaza
weary geyser
#

Nvm just wrong imports

quasi flint
#

U looping over a list and removing / adding smth

ivory sleet
waxen plaza
#

I have a for loop inside a for loop, the main for loop removes

quasi flint
weary geyser
ivory sleet
#

Try and see

quasi flint
#

Compile and see

ivory sleet
#

Suppress warnings all 😬

dusty herald
#

if you need to suppress all warnings I don't think it will 😂

quaint mantle
#

Hello how i can get name of offline player with args?
code:

Player player = (Player) sender;

if(args.length == 1) {
     Player target = Bukkit.getPlayer(args[0]);
     player.sendMessage(target.getName());
}

its return me error

dusty herald
#

why do that when you can just give them args[0]

quasi flint
quaint mantle
quaint mantle
#

its long 300+

ivory sleet
#

Send it

quasi flint
#

?paste

undone axleBOT
quasi flint
#

Please

ornate heart
#

Do I have to register shaped recipes every time the server starts up or if I register them once they'll always be there?

quaint mantle
ornate heart
#

So if I wanted a recipe to be persistent i'd have to find a way to serialize it and save it to file?

#

and then load it back up later.

ivory sleet
#

Uh yeah

quasi flint
#

Probbaly the player

quaint mantle
#

i am the player

quasi flint
#

What's at line 44,32

#

And 18

eternal oxide
#

Stats.java:18

quaint mantle
#

44: nothing
32: getStats(player, target);
18: player.sendMessage(ChatColor.YELLOW + target.getName() + "'s K/D Stats");

eternal oxide
#

target i snull then

quaint mantle
#
    public void getStats(Player player, Player target) {
        player.sendMessage("");
        player.sendMessage(ChatColor.YELLOW + target.getName() + "'s K/D Stats");
        player.sendMessage(ChatColor.GRAY + "Kills: " + ChatColor.GREEN + "0");
        player.sendMessage(ChatColor.GRAY + "Deaths: " + ChatColor.RED + "0");
        player.sendMessage(ChatColor.GRAY + "KDR: " + ChatColor.GREEN + "0/" + ChatColor.RED + "0 " + ChatColor.GRAY + "= " + ChatColor.GOLD + "0");
        player.sendMessage(ChatColor.GRAY + "Leaderboard: " + ChatColor.DARK_AQUA + "Not on leaderboard.");
        player.sendMessage("");
    }
#

how null?

eternal oxide
#

you are passing null

quasi flint
#

Null != Good

waxen plaza
#

still getting same error with a list iterator

quaint mantle
#

i dont understand

#

where here is null

#

have target

#

and target is player

eternal oxide
#

just because you define it as a player doesn;t not mean its not null

vague mason
#

Show me how do you call this method.

eternal oxide
#

show your onCommand method

quaint mantle
#
package pvp.pvp.commands;

import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;

import java.util.logging.Logger;

public class Stats implements CommandExecutor {

    Logger console = Bukkit.getServer().getLogger();

    public void getStats(Player player, Player target) {
        player.sendMessage("");
        player.sendMessage(ChatColor.YELLOW + target.getName() + "'s K/D Stats");
        player.sendMessage(ChatColor.GRAY + "Kills: " + ChatColor.GREEN + "0");
        player.sendMessage(ChatColor.GRAY + "Deaths: " + ChatColor.RED + "0");
        player.sendMessage(ChatColor.GRAY + "KDR: " + ChatColor.GREEN + "0/" + ChatColor.RED + "0 " + ChatColor.GRAY + "= " + ChatColor.GOLD + "0");
        player.sendMessage(ChatColor.GRAY + "Leaderboard: " + ChatColor.DARK_AQUA + "Not on leaderboard.");
        player.sendMessage("");
    }

    @Override
    public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
        if (sender instanceof Player) {
            Player player = (Player) sender;
            if(args.length == 1) {
                Player target = Bukkit.getPlayer(args[0]);
                getStats(player, target);
            } else getStats(player, player);
        } else console.info("Command works only for players!");
        return true;
    }

}
eternal oxide
#

Player target = Bukkit.getPlayer(args[0]); is returning null

quaint mantle
#

so how i need to do that? so it will not return null?

#

how i getting offline player stats

vague mason
#

why do you even need a player to show stats?

#

you just save players name

eternal oxide
#

you need to test if its null. If its null the player you tried to get was not online/is invalid

vague mason
#

and all their stats in file

quasi flint
#

Or by uuid

#

In a database

eternal oxide
#

getPlayer will only return a player IF they are actually online and not dead

quaint mantle
#

but how i get his uuid from arg -_-

vague mason
#
Black1_TV:
  kills: 16
  deaths: 2
quasi flint
vague mason
#

you don't need that

quasi flint
#

.getUUID xd

vague mason
#

save players name

eternal oxide
#

no he doesn't

quasi flint
#

I know

quaint mantle
#

players name is so unsafe

quasi flint
#

Just said it can be stored alternative way

vague mason
#

as every offline server can use different uuid version

#

so names are more safe then uuids

#

for offline servers

quaint mantle
#

i cant do fetch to mojang api of username to uuid like in javascript or something?

vague mason
#

it's not worth doing that

#

they also have limitations

quaint mantle
#

so wait,
if i am using bungeecord server and on my pvp server have my plugin
so i need save it by names?

vague mason
#

I had problems when I was saving UUIDs

#

because I had multiple servers on one bungeecord

#

and one server uses different uuid version

#

I did use the same server version

quaint mantle
#

so username are safty?

vague mason
#

for offline servers

#

for online servers uuids are safer.

quasi flint
#

I meant online servers and mzsql databases but yeah sure :D

vague mason
#

50% servers are offline and 50% online so it's hard to choose

#

I do store both in database

#

uuid and name

#

when player joins the severs for the first time

quiet ice
#

what the heck did I stumble upon

#

never save any data based on name, ever
Spigot has a bungee setting that allows to sync UUIDs iirc

vague mason
#

Also why it's turn off by default?

quaint mantle
#

i told you

#

its must be uuid

quiet ice
#

because most server owners that do not know about the setting are running without a proxy

eternal oxide
vague mason
#

Can you show me where I can find this setting?

quaint mantle
#

its like
if you save perms by username and give to someone all access
with bungee ppls can hack your server by this

dusty herald
#

yeah but like

#

same with the UUID

#

👀

quaint mantle