#help-development

1 messages · Page 2144 of 1

sterile token
#

recaf isnt a decompiling or bytecode related tool ?

#

I suppoused

crisp steeple
#

real ones code plugins directly in bytecode

lethal coral
#

dangit same error

crisp steeple
#

what is on line 23 of discordserverpanel

#

you need to show that

lethal coral
crisp steeple
#

yeah

quiet ice
#

Remove ANY new DiscordServerPanel metions

crisp steeple
#

thats your issue

sterile token
crisp steeple
#

you're making a new instance of your plugin

sterile token
#

?paste

undone axleBOT
lethal coral
#

oh

crisp steeple
lethal coral
#

🤦‍♂️

quiet ice
lethal coral
#

I realized I was doing that to register the event listener

sterile token
#

Send full code, and also why using EvenListener?

#

Isnt only called Listener?

#

🤔

lethal coral
#

it's for jda

crisp steeple
#

pass an instance of your plugin instead of extending the class

lethal coral
#

yeah

crisp steeple
#

Lethal injection

#

MongoInjection 🤔

hybrid spoke
#

self vaccination

quaint mantle
#

only way to check if a player steps on a pressure plate is interactevent?

tardy delta
#

or the player move event

#

not the best way i guess

quaint mantle
sterile token
quaint mantle
#

it can

sterile token
#

You will have to harcode a lot

lethal coral
#

anybody here use jda in their plugins?

quaint mantle
#

check for the block they're under

sterile token
lethal coral
sterile token
#

If not its impossible to help...

lethal coral
#

even though it's being called in the ready event

sterile token
#

?PASTE

#

?paste

undone axleBOT
sterile token
#

Dont send fu¨¨¨screenshoit

lethal coral
#

would you rather me not send the error

sterile token
#

Send the full error pasted

#

Its really impossble to read from caps

lethal coral
sterile token
#

Allright

#

Now yes

#

1 sec

#

I think you are passing a null instance

lethal coral
#

but it's being called in the ready event

#

which should be triggered when the bot is ready

sterile token
#

1 sec im opening the error

#

Now send your main class code and the bot code

#

So i can check the full code

eternal oxide
#

DiscordServerPanel.java:82

sterile token
#

DiscordServerPanel.java that class

sterile token
#

Its saying that: this.jda is null

lethal coral
sterile token
#

Allright

#

I thin kits better to do this

eternal oxide
#

you never assign jda to a value

lethal coral
#

I do

sterile token
lethal coral
#

I do

sterile token
lethal coral
#

how so?

sterile token
#

You dont assign like that on java

lethal coral
#

yes

#

and that is called in the ReadyEvent

#

which should be triggered after the bot is ready from the awaitReady() method being called in my bot class

hybrid spoke
sterile token
#

Do this changes so its better your Bot class:

Bot bot = new Bot(DiscordServerPanel plugin)
hybrid spoke
#

its just not a good practice

sterile token
sterile token
#

I think you have a nightmare in code

lethal coral
#

looks fine to me

#

I understand that I'm getting the instance a ton and I'll probably pass it through when I create a new Bot object, but how will that solve the error

sterile token
#

You should have this order:

DiscordServerPanel class => Plugin things
Bot class => JDA related thin
BotListener class => for JDA listeners

#

Because eyes hurts a bit with that structure

#

Its just a recomedantion

lethal coral
#

the whole plugin is about a discord bot

#

the stuff in the main class is for organizing the startup code

sterile token
lethal coral
#

the listener is only there because it only applies to one method that goes along to startup the bot

sterile token
#

Do what ever you want but them dont get mad if people dont understand some part of your code

#

😂

lethal coral
#

I don't understand how it's confusing 😩

knotty meteor
undone axleBOT
knotty meteor
sterile token
#

Ah yeah on 1.12 up you have the armor slot

#

So its another hand let say

tardy delta
#

you still have to learn the api

sterile token
#

Yeah lmao its bug

#

Zacken do you use gth copilot?

lethal coral
#

my error was never resolved 😩

sterile token
#

Oh lol really?

sterile token
knotty meteor
#

How can i fix that?

sterile token
#

If you dont get answer just be patient and if dont want to your message get losted open a thread on the channel

sterile token
hybrid spoke
#

its called once per hand

tardy delta
#
casting a player to a player?
instead of (Integer) config.get() -> config.getInt()
do early return in case something doesnt met your conditions
use dependency injection for the plugin instance```
#

voila

sterile token
#

I dont know im anoyyed

hybrid spoke
#

does he?

knotty meteor
#

Oooww thank you!

tardy delta
#

lmao

sterile token
#

In fact yeah

#

Conclure use maven right?

tardy delta
#

i think i saw conclure using gradle

hybrid spoke
#

maven>

eternal night
#

gradle ?!😱

sterile token
#

Maven > gradle

#

cargo > maven && gradle

tardy delta
#

dunno lol

hybrid spoke
#

csgo > maven && gradle

tardy delta
#

i only use cargo for rust

hybrid spoke
#

imagine using a buildtool

sterile token
#

Most spigot use spigot build tool lmao

eternal night
#

lol cargo 😂

sterile token
#

That why most people directly use spigot jars from internet

#

😂

#

Yeah didnt you know that 40% of people download directly the spígot server for their servers

#

The correct way should be use build tools to get the spigot server jar, but that take to much time for people. So they directly download the jar from a website

exotic grove
#

Cast block to chest error

desert tinsel
#

why i can't implement "PluginMessageListener" to a class with bungeecord API?

sterile token
desert tinsel
#

yep

sterile token
#

Because PluginMessageListener is from Bungeecord api

desert tinsel
#

yes

#

i use it

sterile token
#

It doesnt allow to import it?

#

Not even writting the import manually?

crisp steeple
#

i dont think pluginmessagelistener is a thing in bungee

#

theres a pluginmessageevent

sterile token
#

Why the heck bungee component api apply color to the first line of message, and doesnt apply color to the rest of them. is it a bug?

sterile token
#

On spígot = its a listener called PluginMessageListener
On bungee = its an event called PluginMessageEvent

#

@desert tinsel my bad there you have the explanation

crisp steeple
# desert tinsel

well ofc you cant import something from bukkit into a bungee plugin lol

radiant cedar
sterile token
radiant cedar
crisp steeple
#

.getInventory().getView()

#

also dont use inventory name for checking the type of an inventory 🙂

sterile token
#

Things that are on the docs

radiant cedar
#

i have checked docs

#

thats why im here

radiant cedar
#

what do i use then

crisp steeple
#

check the instance

sterile token
#

Why the heck bungee component api apply color to the first line of message, and doesnt apply color to the rest of them. is it a bug?

crisp steeple
#

^ @quaint mantle

eternal night
#

maybe because legacy text is legacy 🤔

#

text components work fine last time I checked

radiant cedar
#

should i do the same for all Villager shop keepers

#

do u think

sterile token
#

🤡

radiant cedar
#

ok i gtg learn maps

#

oh what why

eternal night
#

I mean, legacy parsing for this is just

#

pain

radiant cedar
#

this isnt just for a player

#

for anyone

#

to open through shop keeper

#

what do u use the map for if u remove them after

#

from thje map

#

ah alright

crisp steeple
#

i usually make a small api that just has a craftinventorycustom wrapper that listens for clicks etc

sterile token
eternal night
#

idk I just don't use legacy chat 😅

#

adventure has been a blessing

sterile token
#

So how you send the components on bungee?

radiant cedar
#

inventory.getView() isnt a thing btw

eternal night
#

that too, tho I barely use it for in-code components

#

I only really use MM for user inputs

crisp steeple
#

my bad

radiant cedar
#

what does that give

crisp steeple
#

the InventoryView

sterile token
radiant cedar
#

didnt memorise it

#

cant remember it if i dont use it

sterile token
#

You do the same lmao hahaha

radiant cedar
#

i did this

#

should work

sterile token
crisp steeple
#

yes, but like i said you shouldnt really be using inventory names in the first place

radiant cedar
#

alright

#

but why does it matter if i just keep recreatinmg them

#

what does spoofable mean

crisp steeple
radiant cedar
#

oh

#

alright

#

ty guys

sterile token
#

You should do:

event.getViewers().getTopInventory().equals(custom inventory)

crisp steeple
#

that isnt valid

sterile token
#

I use something similar on my menu api

crisp steeple
#

getViewers() returns a list of humanentities

sterile token
#

Or getViews() its called?

crisp steeple
#

yea

#

just event.getClickedInventory()

radiant cedar
#

thats what im doing

crisp steeple
#

ok, then you check if that inv is equal to the reference you have

sterile token
#

if (!event.getView().getTopInventory().equals(menu.getInventory())) return;

That what i use

crisp steeple
#

so people could double click items out of the menu etc

sterile token
#

But that will work if clicking on own inventory, my goal of menu api its working with custom menus not player inventory!

crisp steeple
#

...

#

but you dont ever want that

#

i have literally been duping on a server for the past few hours just because they implemented something like that

#

and it broke their entire server

trail oriole
#

Hello, I have a gui that a player can modify but I need it to be player specific so that if a player changes it, it only changes from their own gui and not everyone's

sterile token
#

Hmn mines works okay atm

trail oriole
#

Does that even make sense

sterile token
#

Lmao everyone has menu/gui issue today

crisp steeple
#

you're only making one inventory instance

sterile token
#

😂

crisp steeple
#

and storing it in a static field

trail oriole
#

Yes I am

crisp steeple
#

well then thats your problem

trail oriole
#

But I have an event that checks OpenInventoryEvent and checks the name of the inv

#

how would I change that

crisp steeple
#

dont check the name of the inv

#

check the instance

sterile token
#

What do InventoryHolder i dont understand the reason because it literally contain a:

Inventory getInventory();

trail oriole
crisp steeple
#

event.getInventory().equals(<inventory reference>)

sterile token
#

Deotime have you orked with InventoryHolder? What does it

crisp steeple
#

no

#

you shouldnt work with inventoryholder

#

its deprecated api

ivory sleet
#

verano because it holds an inventory

#

hence its functionality also its name

trail oriole
sterile token
#

I dont still understand

crisp steeple
#

a lot of people use inventoryholder to find the type of the inventory even though thats not what its intended for

rough drift
#

that's a thing

crisp steeple
lethal coral
#

is there any statistical reason to use a json library for file storage over yaml from spigot

#

like is it inherently faster

quaint mantle
#

no

rough drift
#

depends on your needs

#

if you also need to send it over the internet, then yeah

#

otherwise no

radiant cedar
#

didnt exaclty do that

ivory sleet
#

hexic dragon Id say its preference at most

radiant cedar
crisp steeple
radiant cedar
#

but does it look better now

exotic grove
#

chestLocation.getBlock().setType(Material.CHEST);
Chest chest = (Chest) chestLocation.getBlock().getState();

Why does my cast to chest fail here?

rough drift
#

so like

sterile token
ivory sleet
#

and then you gotta remember "Given a JSON structure, it is also a YAML structure since JSON is a subset of YAML"

rough drift
#

inv.getClass() == AnvilInventory.class

trail oriole
#

what

rough drift
sterile token
rough drift
rough drift
ivory sleet
#

no ikevoodoo

sterile token
#

So how you send component to ProxyPlayer? Because it doesn contain a way for sending them

daring lark
#

how could i get front face of chest?

ivory sleet
#

but it means that valid json must be valid yaml

rough drift
#

json has a different syntax than yaml

crisp steeple
ivory sleet
#

not necessarily

#

you have different styles in yaml

rough drift
#
{
  "num": 1
}
num: 1
ivory sleet
#

^

#

both are valid yaml

rough drift
trail oriole
ivory sleet
#

former is valid json

sterile token
quaint mantle
crisp steeple
rough drift
sterile token
daring lark
sterile token
crisp steeple
#

i usually prefer json just because its not spacing-based and easier to serialize

rough drift
crisp steeple
trail oriole
#

but what would the name of the inv be?

ivory sleet
#

and yeah hexicdragon

#

most people choose yaml because thats the convention in spigot

quaint mantle
#

you can put anything json as yaml?

trail oriole
#

like "inventory" + player.getExactUUID.ToString()"" ?

ivory sleet
#

yup

rough drift
crisp steeple
#

thats just a syntax error anyways

rough drift
#

if it's just some storage for metadata that you need sticking with non-human readable format is good enough

quaint mantle
#

byte format

ivory sleet
sterile token
#

How do you send componenent to Bungee player them?? Because TextComponent.fromLegacyText(component) doesnt work. And ProxyPlayer also doesnt a have a method like ProxyPlayer#sendMessage(component)

trail oriole
# crisp steeple im really not sure what you mean
public Inventory inv = Bukkit.createInventory(null, 54, "§6Kit Menu");
    @Override
    public boolean onCommand(CommandSender sender, Command cmd, String arg2, String[] arg3) {
        if (sender instanceof Player) {
            Player player = (Player) sender;
            Inventory inventory = player.getInventory();
            if(cmd.getName().equalsIgnoreCase("kit")) {
                player.openInventory(inv);``` how would I implement it there the instance creation thing
crisp steeple
#

side note

rough drift
#

DataOutputStream os = new DataOutputStream(new GZipOutputStream(new FileOutputStream(file))); * Example, not what you'd actually do

sage merlin
#

does anyone know why this error is caused and how to fix it

crisp steeple
#

im so confused why so many people check cmd.getName().equalsIgnoreCase(<command name>)

#

is there just like

undone axleBOT
crisp steeple
#

one tutorial out there that does that and everyone just blindly follows it

#

its so pointless

trail oriole
#

yes

hybrid spoke
#

explicit programming

rough drift
#

first off, label

#

it allows you to check what alt you're using

#

such as /mycommand or /mycmd

rough drift
#

second off, why? it does not get triggered globally

crisp steeple
#

?

trail oriole
#

then how ?

rough drift
#

I believe tuts do that because they think it gets triggered globally

crisp steeple
#

if you register the command properly itll only get triggered when the command name is the same as the executor

rough drift
#

yep

crisp steeple
#

so checking the command name is pointless

sterile token
sage merlin
sterile token
#

I dont know why people do that

rough drift
#

well, if you want to run different stuff on alias, then you can do that ig

quaint mantle
#

lol

ivory sleet
#

ye

rough drift
#

but then just make it a separate cmd

quaint mantle
#

thats dumb

#

yeah

sterile token
#

So in fact using a annotated command framework its 100% better than simple command

rough drift
#

or rather than sending
/mycmd a
send
"/" + label + " a"

rough drift
#

I don't know why spigot still hangs onto this really shitty cmd implementation

ivory sleet
#

I mean if you wanna reuse your gamemode cmd executor for all gamemode commands like gamemode <c|s|sp|a> and for stuff like gmc, gms, gmsp and gma

quaint mantle
#

How can I add a maven project as a dependency to another maven project?
I want the jar of the first one when its built to be a dependency of the other.

rough drift
#

but again

#

separate commands

ivory sleet
#

yep

eternal night
#

could argue that spigot does not include fully fletched frameworks as that may be left the community

sterile token
quaint mantle
rough drift
#

label is only useful for stuff like usage, so you can send the exact message

rough drift
#

Its not that hard

eternal night
#

Yea but why

rough drift
#

~30mins of time

quaint mantle
eternal night
#

there is great frameworks out there, just use them

ivory sleet
#

^

sage merlin
ivory sleet
#

they have been unit tested, integration tested and havew a variety of features as opposed to your duct taped 30 min one

sterile token
sage merlin
#

its pretty urgent

rough drift
rough drift
eternal night
#

why do you depend on the serde crate in rust

sterile token
rough drift
#

to make a good one you need weeks

eternal night
#

why do you include your own http client

rough drift
eternal night
#

why do you include your own mysql drivers

#

it is an abstraction or framework above the "low level" stuff

sage merlin
sterile token
#

Anyone know which is the repo of the MaowHttp library?

eternal night
#

forcing a framework into spigot a) kills alternatives

sterile token
eternal night
#

b) stifles innovation

#

c) needs more effort to maintain stuff

rough drift
#

but the entire spigot api is a framework over the low level stuff if you look at it that way, commandexecutor just adds the Command in the args of the method

#

you could use packets

#

but then that's difficult

eternal night
#

spigot is the lowest level abstraction you are getting

#

packets is not abstraction that is impl detail

ivory sleet
#

I mean if none of the already opinionated cmd frameworks fir your expectations then perhaps make your own but it comes w a cost ofc lol

rough drift
sage merlin
eternal night
#

you are coding against c libraries, not setting the registries values yourself

sterile token
#

I think spigot should contains 2 clases for commands:

CommandExecutor
CommandArgument

eternal night
#

it should expose the command map

#

a bit better imo

ivory sleet
#

I think spigot should add full support for brigadier

#

yeah the cmd map is already a good enough of a facade to serve as api

eternal night
#

@sage merlin can you provide the inventory listener class

rough drift
#

Why not just make the API slightly better? Like it is right now, but at least not have people write messy parsing code for each argument and also allow people that don't want to use external libs to not have to use them to write an understandable command class

eternal night
#

the ban class thing is not where the exception happens

sterile token
eternal night
#

there is a library loader these days

rough drift
ivory sleet
#

nah

eternal night
#

choose your fav framework, add it as a lib and use it without having to shade it

rough drift
ivory sleet
#

brigadier is well engineered

eternal night
#

bruh

#

download once

rough drift
#

No

#

For me it redownloads each startup

eternal night
#

then your server is fucked

ivory sleet
#

?jd-bcc

rough drift
#

(Freshly downloaded spigot server)

eternal night
#

it validates the lib

ivory sleet
#

?jd-bc

sterile token
# ivory sleet it does

If i do: ProxyPlayer#sendMessage(<component here>) doesnt compile its so shity intellij

rough drift
ivory sleet
#

yes thats good tho

#

it exposed the true structure of the command

#

and then you just pass the command object itself

rough drift
#

take the execute command

#

it has dozens of nodes

#

its just difficult to read with brigadier

eternal night
#

Hmm it is almost like people have different taste in framework design

#

almost like forcing a single framework onto people is not a smart idea 🤔

ivory sleet
#

I mean you should extract lines of commands into variables

rough drift
eternal night
#

adventure ?

rough drift
#

yes

#

i forgot the name

eternal night
#

I mean that is half industry standard at this point 😅

#

it is pretty good

rough drift
sterile token
# waxen plinth How would that even work

One for managing normal commands and the other for sub commands, like does faction plugin:

/faction => the command executor
/fact list => an argument
/faction create <name> => a sub command

waxen plinth
#

That's a subcommand

#

/fact list

eternal night
#

mini message exists

waxen plinth
#

And no, it shouldn't work like that

#

Because that creates ambiguity

radiant cedar
#

would it be hard to make it so only the person who breaks the block can pick it up

ivory sleet
#

literal("gamemode").then(
argument("type",string()).then(ctx -> {
var firstArgument = ctx.getArgument("type",String.class);
});
);

waxen plinth
#

It's good that the provided way of doing commands is barebones, it makes it easy to create frameworks

ivory sleet
#

ikevoodoo that imo looks way better than dynamically handling arguments yourself

waxen plinth
eternal night
#

^^ smack the uuid into the PDC

#

or smth

waxen plinth
#

And cancel the pickup event if the wrong player tries to pick it up

radiant cedar
waxen plinth
#

Listen for BlockDropItemEvent

#

Tag the items somehow

#

Either with a scoreboard tag

#

Or storing them in a map

lean sandal
#

Hey I have a minor problem. When you search my plugin name online and go to the spigot website option it redirects you to the wrong url, any way to fix it?

ivory sleet
#

and if you want to you could extract a variable for literal, and the argument

rough drift
#

I'd prefer using spigot's default over brigadier

ivory sleet
#

which would increase readability significantly

waxen plinth
#

It will be re-indexed at some point

lean sandal
#

Ok thanks

radiant cedar
daring lark
#

how could i display item as a hologram?

waxen plinth
#

Making commands with no library is horrible

ivory sleet
#

and the benefit w brigadier is that you also retain an api for arguments at runtime

rough drift
waxen plinth
waxen plinth
ivory sleet
#

thus you also get tabcompleting capability

rough drift
#

So i don't have to bleach my eyes after reading

waxen plinth
#

I'd rather have a bunch of nested function calls defining the behavior than a ton of manual handling of arguments and stuff

ivory sleet
#

^

waxen plinth
#

Nothing is uglier than manually-handled commands

#

For real

daring lark
waxen plinth
#

What do you mean like a text

ivory sleet
#

you can extract function calls into explanatory variable and the send in the variable

rough drift
ivory sleet
#

in case you wanna avoid direct nesting

rough drift
#

(not in functionality)

waxen plinth
#

Like sure it's verbose

ivory sleet
#

idk how its worse

waxen plinth
#

And I'm not really a fan of verbosity

tardy delta
rough drift
#

not functionality

ivory sleet
#

thats not an issue lol

rough drift
#

for functionality I am 100% with it

waxen plinth
#

I mean

#

Anything is better for readability than manual handling

rough drift
rough drift
#

wait

#

no

#

60 lines

ivory sleet
#

yeah thats easy

rough drift
#

nope

#

its hell

ivory sleet
#

nah

waxen plinth
rough drift
#

you place one ) wrong and your command is fucked

waxen plinth
#

???

ivory sleet
#

id only have to unit test my own functions that I provide by the ::handles function

rough drift
#

the entire tree goes to shit

waxen plinth
#

How the hell are you writing your functions lol

#

I write the ( and the ) at the same time, then just move back in between them to keep writing

rough drift
waxen plinth
#

Do you try to manually keep count of how many you have to close or something?

sage merlin
waxen plinth
#

Because I don't see any other way to really get that wrong

rough drift
#

if you place a .literal after its a pain

radiant cedar
#

i have event for breaking blocks and an event from picking up

radiant cedar
#

but idk how to set it so the person who broke it can pick ut

waxen plinth
#

Ok nobody's forcing you to use brig

rough drift
#

But if at some point you mistype it becomes pain

rough drift
waxen plinth
#

But if you have a problem with it you can always make your own shallow wrapper to make it less verbose the way you want

#

Or you can use my library :)

rough drift
#

there was a kotlin brigadier lib

#

it was so elegant

#

So clean

sage merlin
#

yeah i never used the InventoryClickEvent

ivory sleet
#

ike Ill show you then

#

:3

#

let me just write it

rough drift
#

its similar

waxen plinth
#

That's not that elegant

rough drift
#

but its easier to read

rough drift
#

and it has its charm

tardy delta
rough drift
#

its cleaner brigadier

waxen plinth
#

ctx.getArgument("type", String.class) is so much lol

#

Dear god

rough drift
tardy delta
#

im tryin to figure out how i use acf lol

waxen plinth
#

You have to do argument("type", string()) too

#

That is so verbose

sterile token
#

Oh lol

#

Please end brigadier docs

#

I want to take ideas

waxen plinth
#

That's why I'm not a fan of builder style

#

Like yeah I'd do that over the standard spigot commands

#

But that would slow me down

rough drift
waxen plinth
#

There's no real good way to do that

#

Commands are complicated

sterile token
#

Its possible to do something like this?

CommandExecutor = new Command().builder().name("bla").execute((sender, args) -> bla).build();

golden kelp
rough drift
waxen plinth
#

It would suck though

golden kelp
waxen plinth
#

Like it's such a thin wrapper that it would barely help you at all

sterile token
#

I know but i want to do it

waxen plinth
#

Why

sterile token
#

Just to test something

waxen plinth
#

All that does is make one small part of the process slightly easier

#

Just slightly rearranges it, really

sterile token
#

How its called that i sent?

tardy delta
#

ye im looking at that

sterile token
#

Wrapper style?

waxen plinth
#

Builder

tardy delta
#

figuring out how to make a /sethome command which only takes a name

quaint mantle
waxen plinth
rough drift
#

This is how i like to make commands:

public class MyCmd extends CustomCmd {
  public MyCmd(Plugin plugin) {
    addSubCommands(new MySubCommand(plugin));
  }

  // execute method, parsed args, similar to brigadier
}
waxen plinth
#

Eh

#

How would arguments work

tardy delta
rough drift
sterile token
waxen plinth
tardy delta
#

i want it to take a string as parameter (the name)

waxen plinth
#
sethome string:name {
  user player 
  permission sethome.use
  hook sethome
}```

```java
@CommandHook("sethome")
public void setHome(Player sender, String name) {
  // do stuff
}```
#

Mine looks something like this

tardy delta
#

oh ye you told me about that

waxen plinth
#

With the top bit being what you would put in the command file, a separate markup file that describes the command layout

rough drift
#

setArgs(new Argument("myarg", required, Player.class, OptionalFor.PLAYER))

sterile token
#

CommandExecutor = new Command().builder().name("bla").execute((sender, args) -> bla).build();

The black part should be a consumer right?

rough drift
#

something like that

#

You can add multiple

#

and the entire structure changes based on args

tardy delta
#

even a biconsumer

#

ye i saw that 👍

sterile token
tardy delta
#

do i need to register stuff or smth?

rough drift
#

For example, usage on console there is:

/mycommand <myarg>

player:

/mycommand [myarg]

waxen plinth
tardy delta
#

ah ye hold on i know that part

waxen plinth
#

What is myarg in that case?

ivory sleet
#
        ArgumentBuilder<Object,?> argument = literal("first");
        argument = argument.then(argument("firstArgument", word()));
        argument = argument.then(literal("second"));
        argument = argument.then(argument("secondArgument", integer()));
        argument = argument.then(literal("third"));
        argument = argument.then(argument("thirdArgument", bool()));
        argument.executes(this::execute);

this for the command line

/first <firstArgument: String> second <secondArgument: Number> third <thirgArgument: Boolean>

rough drift
tardy delta
#

also arent these the same?

rough drift
#

of type Player

ivory sleet
#

and it takes 1 min to add an abstraction above all the mutations

rough drift
ivory sleet
#

nah its not that big

#

anyway I dont see how that degrades readability whatsoever

waxen plinth
#

It's really dense

#

I'd split it up a bit more

#

But then that just makes it even bigger

sterile token
#

TextComponent component = new TextComponent("text").setHoverEvent();
ProxyPlayer#sendMessage(component);

Conclure is it possible to send this component on bungee?

ivory sleet
#

I mean sure you could split it up, but that still reads rather fine

rough drift
#

@waxen plinth I'll send you an example command in mine soon

waxen plinth
#

Alright

rough drift
#

its not the best, still a WIP

ivory sleet
#

ProxiedPlayer::sendMessage
arguments:

ChatMessageType.CHAT
component

trail oriole
#

Do i need to do a hashmap to make a specific player's int var ?

ivory sleet
#

mye

#

sounds appropriate

trail oriole
#

sorry for asking dumb questions lmao, pretty new to java still

sterile token
# ivory sleet mye

conclure another thing and really sorry im really annoyed trying to do this:

Command cmd = new CommandBuilder().name("test").execute((sender, args) -> bla bla).build();

I dont know how to do that part, for that i have a class called CommndExecutor but i dont know how to use it in that thay i send te code

ivory sleet
#

oh

#

BiConsumer<CommandSender,List<String>>

#

maybe?

sterile token
#

Because i explain my logic

#

But thanks i will try that

knotty meteor
#
package nl.stefanokeizers.grabbelton.listeners;

import org.bukkit.Material;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.block.Action;
import org.bukkit.event.player.PlayerInteractEvent;

import nl.stefanokeizers.grabbelton.Main;
import nl.stefanokeizers.grabbelton.utils.Utils;

public class GrabbeltonOpenListener implements Listener {

    @EventHandler
    public void onInteract(PlayerInteractEvent e) {
        Player p = (Player) e.getPlayer();
        final Integer grabbel = (Integer) Main.grabbelConfig.getConfig().get(p.getUniqueId() + ".Pogingen");
            if (e.getAction().equals(Action.LEFT_CLICK_BLOCK) || (e.getAction().equals(Action.RIGHT_CLICK_BLOCK))) {
                if (e.getClickedBlock().getType() == Material.LIME_GLAZED_TERRACOTTA) {
                    if (grabbel == 0) {
                        p.sendMessage(Utils.colorize("&cJij hebt geen grabbelton poging(en)."));
                        e.setCancelled(true);
                    }
                    if (grabbel > 1) {
                        Main.grabbelConfig.getConfig().set(p.getUniqueId() + ".Pogingen", (Integer) grabbel - 1);
                        Main.grabbelConfig.save();
                        p.sendMessage(Utils.colorize("&7Je hebt de grabbelton geopend, succes!"));
                        // Open grabbelton menu
                        e.setCancelled(true);
                }
            }
        }
    }
}

Hello why does it execute 2 times
Can someone help

undone axleBOT
knotty meteor
sterile token
#

And you already asked that before and someone explain you what happen

knotty meteor
#

I dont know how works

sterile token
#

User have 2 hands, that why it get double executed

knotty meteor
#

How do i set 1 hand

sterile token
#

Using the event you should ignore one hand

#

That one olf the solution

knotty meteor
#

Wich event

#

I have playerinteractevent

sterile token
#

Oh sorry

#

I thought you already asked that, but was a diff person

#

I get confused my bad

knotty meteor
#

Ooh xD

sterile token
#

So you dont need to cast it manually

knotty meteor
#

Oh i see

tardy delta
#

i started with it today lol

#

whats the difference lol

eternal night
#

the folder name ?

#

xD

tardy delta
#

im confused lol

#

ah wait jdk and jre

#

lets remove them all and replace it by the not headless version

torn vale
#

Why does my PlayerRespawnEvent not get called when I use Player#spigot().respawn()?

torn vale
#

uhm, is there a Method to call it instantly? Because atm it just gets ignored :/

quaint mantle
#

like i said

#

u have to wait 3 ticks

torn vale
# quaint mantle u have to wait 3 ticks
    @EventHandler
    public void onRespawn(PlayerRespawnEvent e) {
        Player p = e.getPlayer();
        p.teleport(API.getSpawn());
    }```
But why doesnt it teleport the player after I execute ``Player#spigot().respawn()``?
quaint mantle
#

they have to respawn before being tped

#

or u can set their respawn location

torn vale
#

how can i set their respawn location?

quaint mantle
#

@late sonnet bachelor's degree in comp eng 👀

late sonnet
quaint mantle
#

in english?

late sonnet
quaint mantle
#

that sounds better

zealous edge
#

setItemMeta does not authenticate

lost matrix
zealous edge
lost matrix
#

?notworking

undone axleBOT
#

"Does not working" is a useless statement. Please describe what exactly is not working, what you expect it to do, and what actually happens. If you get any console errors, also ?paste the entire stacktrace.

quaint mantle
#

?notworking

undone axleBOT
#

"Does not working" is a useless statement. Please describe what exactly is not working, what you expect it to do, and what actually happens. If you get any console errors, also ?paste the entire stacktrace.

zealous edge
#

how to show a script ?

lethal coral
lost matrix
#

```
Code here
```

zealous edge
#
import org.bukkit.enchantments.Enchantment;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.player.PlayerJoinEvent;
import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.meta.ItemMeta;

public class mainListeners implements Listener 
{
    @EventHandler
    public void onJoin(PlayerJoinEvent event)
    {        
        Player player = event.getPlayer();
        ItemStack honey = new ItemStack(Material.HONEYCOMB);
        ItemMeta honey2 = honey.getItemMeta();
        
        player.getInventory().clear();
        player.getInventory().setItem(4, honey);
        honey.setItemMeta(honey2);
        
        honey2.setDisplayName("§lMenu");
        honey2.addEnchant(Enchantment.BINDING_CURSE, 1, true);
        
        player.updateInventory();
    }
}
#

the SetItemMeta does not want to run on minecraft

worldly ingot
#

I mean, it is working, you're just setting the item before you modify it

zealous edge
#

I don't know how to say

lost matrix
dusk flicker
#

use the chat color enum

zealous edge
dusk flicker
#

§ can break on certain systems

worldly ingot
#

You're doing this:

ItemStack honey = new ItemStack(Material.HONEYCOMB);
ItemMeta meta = honey.getItemMeta(); // Gets the meta
honey.setItemMeta(meta); // Re-sets the meta
player.getInventory().setItem(4, honey); // Sets the item
meta.setDisplayName(""); // Sets the name AFTER you already set the item in the inventory
meta.addEnchant(Enchantment.BINDING_CURSE, 1, true); // Adds an enchantment AFTER you already set the item in the inventory```
You want to do this
```java
ItemStack honey = new ItemStack(Material.HONEYCOMB);
ItemMeta meta = honey.getItemMeta(); // Gets the meta
// NOW EDIT THE META
meta.setDisplayName("");
meta.addEnchant(Enchantment.BINDING_CURSE, 1, true);
honey.setItemMeta(meta); // Set the updated meta
player.getInventory().setItem(4, honey); // Now set the item in the inventory```
lost matrix
worldly ingot
#

Still shouldn't do it

dusk flicker
#

^

dusk flicker
sterile token
#

Its possible to have a maven settings.xml file with custom properties, which i can use in every module of the project?

sterile token
#

How it looks inside?

worldly ingot
#

Yeah, you can set properties in the parent pom, but I definitely wouldn't do it in your settings.xml because that's local ;p

dusk flicker
#

its the pom.xml for the parent module

#

normal maven pom, mostly

worldly ingot
#
<project>
    ...
    <properties>
        <whatever.property.you.want>hello world</whatever.property.you.want>
    </properties>
    ...
</project>```
sterile token
#

So the one alone its the parent right?

worldly ingot
#

Yes

sterile token
#

Allright know i understand i was a bit annoyed

worldly ingot
#

The one that declares <packaging>pom</packaging>

sterile token
#

Allright, because a friend told me something harcoded to do what i want a settings file, which declare a profile, with properties

#

A mess to understand how it work

worldly ingot
#

Yeah the settings.xml is a local file to change settings about Maven including private repository credentials among other thing. Not ideal if you intend on having other people work on your project

#

Only acceptable thing to do there would be like... maybe access keys

#

Even then, way better ways to handle that

sterile token
#

Something like tha its allowed?

#

Or should be declare like: <menu.name></menu.name> etc

dusk flicker
#

that looks fine, Im no xml expert tho

sterile token
#

I ask because i dont know what support maven as properties

fading lake
#

what r u tryna do

sterile token
#

Im trying to setup global properties for a multi module project

radiant cedar
#

anyone know sound effects that sound like u bought something

sterile token
#

I think its something similar to that

radiant cedar
#

is there any website u know can hear these

lost matrix
#

Did you shade bungeecord in?

#

Do you use the maven-shade-plugin?

#

I see

#

Make sure to use the latest version for both your compilation and the server

hoary mason
#

Hey, I have a little question, is it possible to register to spigot's bitbucket so I can fork and create a pull request?

lost matrix
#

?contribute @hoary mason

sterile token
#

'version' contains an expression but should be a constant. @ dev.alex.net.library.menu:spigot-menu:${module.menu.version}, C:\Users\Usuario\IdeaProjects\Spigot-Library\Menu\pom.xml, line 13, column 14

What means that?

knotty meteor
hoary mason
lost matrix
#

Wait... why are you trying to get a ProxiedPlayer in the InventoryClickEvent? Spigot doesnt have any idea of proxies and Bungeecord does not
have any idea about inventories.

visual tide
#

uh

#

spigot still wont know about proxies

lost matrix
#

Ok but Spigot doesnt know if the player is connected via a proxy. Spigot doesnt have any idea about Bungeecord and you will never be able
to interact with Bungeecord on spigot unless you use the plugin messaging channel.

visual tide
#

and bungee will still not know about inventories

#

no

lethal coral
#

is it possible for me to detect and get when something is sent to the console

visual tide
#

it

#

wont work

lost matrix
lethal coral
#

no

#

like everything sent in the console log

visual tide
#

not sure

lost matrix
hasty prawn
#

?pmc

lethal coral
lost matrix
lethal coral
#

slight problem

#

actually hold on

lost matrix
# lethal coral actually hold on
PrintStream myStream = new PrintStream(System.out) {
    @Override
    public void println(String x) {
        super.println(System.currentTimeMillis() + ": " + x);
    }
};
System.setOut(myStream);
System.out.println("Hello World!");

Results in

1420553422337: Hello World!
lethal coral
#

well

#

that was helpful

#

thanks 😂

lethal coral
#

since I'm setting the output stream

lost matrix
#

The super call logs to the console.
super.println(System.currentTimeMillis() + ": " + x);

lethal coral
#

(if I'm outputting it elsewhere)

#

yes but

#

I want to log this stuff in discord

#

so theoretically I could just add both methods in that sub method?

eternal night
#

I mean

#

did you regsiter the channel 😅

sterile token
#

getServer()#getMessenger()#registerOutgoingChannel("BungeeCord")

eternal night
#
  @Override
  public void onEnable() {
    this.getServer().getMessenger().registerOutgoingPluginChannel(this, "BungeeCord");
    this.getServer().getMessenger().registerIncomingPluginChannel(this, "BungeeCord", this);
  }

  @Override
  public void onDisable() {
    //make sure to unregister the registered channels in case of a reload
    this.getServer().getMessenger().unregisterOutgoingPluginChannel(this);
    this.getServer().getMessenger().unregisterIncomingPluginChannel(this);
  }
#

this part from the tutorial

lost matrix
# lethal coral I want to log this stuff in discord
  @Override
  public void onLoad() {
    PrintStream myStream = new PrintStream(System.out) {
      @Override
      public void println(String msg) {
        CompletableFuture.runAsync(() -> this.logToDiscord(msg))
        super.println(msg);
      }
    };
    System.setOut(myStream);
  }

  private void logToDiscord(String message) {
    // Implement sending message to DC
  }

*If you want to be really clean then you would need to provide an executor
to the CF so that the common pool is not littered.

sterile token
#

toto i dont understand what you are doing, you have a plugin with bungee and spigot code. so i dont understand your code

lost matrix
#

Also you dont need to check if the player is already there. Bungeecord checks that already and doesnt do anything in that case

radiant cedar
#

why does this class not do anything?

#

second image is in onEnable

hybrid spoke
#

because you never actually start the timer

lost matrix
radiant cedar
#

what

radiant cedar
lost matrix
#

?scheduling

undone axleBOT
lethal coral
#

I don't understand this error

#

?paste

undone axleBOT
trail oriole
#

[DiscordServerPanel] Plugin DiscordServerPanel v1.0-ALPHA generated an exception while executing task 3java.lang.NullPointerException: Cannot invoke "me.hapily.plugins.market.discordserverpanel.Bot.initializePanels(net.dv8tion.jda.api.JDA)" because the return value of "me.hapily.plugins.market.discordserverpanel.DiscordServerPanel.access$000(me.hapily.plugins.market.discordserverpanel.DiscordServerPanel)" is null

#

null

lethal coral
#

yeah what is it saying is null

#

"access$000"

#

is it referring to my my main class itself?

trail oriole
#

well this is null

#

you put it in an event listener

#

it can return null

lethal coral
#

what is null?

hybrid spoke
#

just show us the full code

#

?paste

undone axleBOT
lethal coral
#

event.getJDA() was not null when I used it before

trail oriole
#

Did you inject your object from the bot class to the panel class ?

lethal coral
trail oriole
#

then why sending the panel class too ?

lethal coral
#

because in the initializePanels method it's creating a new panel object for each guild

hybrid spoke
#

ah } is never causing a NPE

#

try again and show the new exception

#

without changing anything

lethal coral
#

what

trail oriole
#

just generate a random integer, why doing a uuid ?

hybrid spoke
#

oh well, my bad.

radiant cedar
#

anyone know website of library to listen to these sounds

hybrid spoke
#

i went with your screenshot sent earlier

lethal coral
hybrid spoke
#

is it just line 49 in DiscordServerPanel or does it go further? @lethal coral

sacred mountain
#

i'm trying to connect to my mongodb server and it keeps saying

java.lang.NoClassDefFoundError: com/mongodb/ServerAddress

    ```xml

<dependency>
<groupId>org.mongodb</groupId>
<artifactId>mongo-java-driver</artifactId>
<version>3.12.11</version>
</dependency>


i have it in the pom.xml
hybrid spoke
#

or bot

#

probably bot

lethal coral
#

how

hybrid spoke
#

seems like the event gets fired before the creation of the bot

sacred mountain
#

how so

#

im not very good with maven

dusk flicker
#

checkout the maven shade plugin

lethal coral
sacred mountain
#

alr

lethal coral
sacred mountain
#
<plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-shade-plugin</artifactId>
                <version>3.2.4</version>
                <executions>
                    <execution>
                        <phase>package</phase>
                        <goals>
                            <goal>shade</goal>
                        </goals>
                        <configuration>
                            <createDependencyReducedPom>false</createDependencyReducedPom>
                        </configuration>
                    </execution>
                </executions>
            </plugin>```
#

should this work

trail oriole
#

well try and tell us

dusk flicker
#

as long as its in <build> and <plugins>

sacred mountain
#

nope same error

dusk flicker
#

How are you building the jar

lethal coral
# hybrid spoke try to debug it

well I already have it broadcasting when the bot is "successfully created" (just right after I create the new bot object) and it broadcasts after the error

sacred mountain
#

ah it worked

#

thanks for the help

dusk flicker
#

No problem

sacred mountain
#

i shaded the libs in

hybrid spoke
lethal coral
#

significantly improves performance

halcyon mica
#

Question, after initially generating a world, is spigot/bukkit/whoever caching the dimension minY and height somewhere besides the datapack dimension type?

#

I have noticed that a world does not update its height restrictions after a restart when the datapack is modified

hybrid spoke
lethal coral
#

if I was just doing it when the server starts that would be fine, but I have a reload command

hybrid spoke
#

the event

#

what if you dont call that async

lethal coral
#

the initializePanels?

hybrid spoke
#

yes

arctic moth
#

is there a way to send someone to another server that's not part of the bungeecord network?

dusk flicker
#

no

#

I mean, you could theoretically do it

#

but itd be a pain in the ass

lethal coral
hybrid spoke
lethal coral
#

well there's our answer

#

😂

hybrid spoke
#

ah, yes, there we have it. the bot is null as said

lethal coral
#

interesting

dusk flicker
# dusk flicker no

if you wanted too, if the server is offlinemode and allowing direct connections you could add it to your network, no matter if you own it or not and you can connect to it

lethal coral
hybrid spoke
#

probably because the event is called before the bot got assign. idk when the event fires

lethal coral
#

ok but

echo basalt
#

unless we make a proxy within spigot itself

lethal coral
#

I'm setting the value in a method that I call before the JDABuilder is even activated to do the ready event

hybrid spoke
echo basalt
#

when you're running stuff async, order doesn't really matter

hybrid spoke
#

readyevent probably means "hey, i, the jda, loaded"

lethal coral
#

ok?

#

one moment

#

this is the example they give

hybrid spoke
#

yes, "API is ready"

lethal coral
#

😐

radiant cedar
#

how do u use multiple small worlds for different places and teleport from one to another

lethal coral
#

I don't think that makes sense

trail oriole
#

multiverse ?

radiant cedar
lethal coral
radiant cedar
#

or are they always in one world

#

different locations

crisp steeple
#

location has the world in it

echo basalt
#

^

radiant cedar
#

how do u implement multiple worlds tho

echo basalt
#

just create a new world and such

radiant cedar
#

and then how would I teleport there

#

how do i add location

#

with the world

#

specified

crisp steeple
#

new Location(world, x, y, z)

#

you could always read the docs you know

radiant cedar
#

and how do u get world

#

i dont rly understand docs

#

sryy

crisp steeple
#

Bukkit.getWorld(name)

radiant cedar
#

name is just the name of the file right

crisp steeple
#

name of the world

radiant cedar
#

so like default one is just "world"

echo basalt
#

yes

radiant cedar
#

folder sorry

#

yes ok ty

sacred mountain
#

back again lol,

java.lang.NoSuchMethodError: 'void com.google.gson.JsonArray.add(java.lang.String)'

i have gson in my pom.xml

#

its all shaded

halcyon mica
#

Right, different question

#

Is it possible to change the max and min height of a world during runtime

#

Through NMS and reflection if necessary

sacred mountain
#
for (String s : this.aliases()) {
      array.add(s);
}
lethal coral
# hybrid spoke yes, "**API** is ready"

sir I changed it to awaitStatus(Status.CONNECTED) which is "JDA has finished loading everything, is receiving information from Discord and is firing events."
and changed the event as well and I still get the same error

sacred mountain
#

and 'add' is a method so idk whats happening

lethal coral
hasty prawn
undone axleBOT
radiant cedar
hasty prawn
hasty prawn
#

Seems like that event is being fired before you're setting it

#

Especially since you're setting it async

#

See how the error is thrown and THEN it says Bot has successfully been created!

lethal coral
#

yeah

#

but how is the event being fired before that makes no sense

#

😩

hasty prawn
#

Because you're starting JDA

#

So JDA can start firing events before you've fully created your Bot class

#

Call initialize() after you do attemptBotCreation

#

Or better yet, inside attemptBotCreation

radiant cedar
# echo basalt yes

are you sure i can just use the name of the folder for the world, it seems to not work for me

radiant cedar
#

i can go to world_nether

#

but cant go to xylia or zorro

#

which are the ones i made

echo basalt
#

if the world is unloaded, you gotta load it

lethal coral
radiant cedar
echo basalt
#

Nop

radiant cedar
#

huh

hasty prawn
echo basalt
#

new WorldCreator(name).createWorld();

daring lark
#

Chest chest = (Chest) player.getTargetBlock(null, 5); why am i cannot cast to chest?

echo basalt
#

Chest itself is not a block, rather a block state

#

but also the target block of that player is null, in this case

radiant cedar
hasty prawn
#

Why wouldnt it be possible

midnight shore
hasty prawn
#

It has to do all of that because it's inside the constructor

#

So the constructor isn't complete until it's finished with that.

sacred mountain
#

hey does anyone know how to solve this error: java.lang.NoSuchMethodError: 'void com.google.gson.JsonArray.add(java.lang.String)' ? i have the gson 2.9.0 lib in my pom xml.

echo basalt
#

You gotta shade it

sacred mountain
#

im fairly sure it is

#
<plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>3.8.1</version>
                <configuration>
                    <source>1.8</source>
                    <target>1.8</target>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-shade-plugin</artifactId>
                <version>3.2.4</version>
                <executions>
                    <execution>
                        <phase>package</phase>
                        <goals>
                            <goal>shade</goal>
                        </goals>
                        <configuration>
                            <createDependencyReducedPom>false</createDependencyReducedPom>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-jar-plugin</artifactId>
                <version>3.1.2</version>
                <configuration>
                    <archive>
                        <addMavenDescriptor>false</addMavenDescriptor>
                        <manifestEntries>
                            <Built-By>V_Link</Built-By>
                            <Main-Class>com.clonkc.vlands.kitpvp.vlandsutils.Snake</Main-Class>
                        </manifestEntries>
                    </archive>
                </configuration>
            </plugin>

        </plugins>```
chrome beacon
#

?paste

undone axleBOT
sacred mountain
#

sorry

chrome beacon
#

Send full pom

sacred mountain