#development

1 messages · Page 25 of 1

worn jasper
#

that

#

fking

#

~

#

impressive how I never find the issues, but once I ask for help here, I 98% of the time find them

icy shadow
#

it's the rubber duck method

dark garnet
#

What was it returning? Just curious

dense drift
#

Dont you need to get data first and then the uuid?

worn jasper
worn jasper
#

wth is a self-loop edge?

dark garnet
worn jasper
#

doesn't return a nullpointer because it's inside a try/catch

dark garnet
#

ah ok

#

was gonna say thats kinda strange

worn jasper
#

uhm is it normal that the Vault api #getBalance() returns 0 while I have money in my account?

#

what could be the cause for such thing?

lyric gyro
#

a number of things

#

do you have an economy plugin that provides Vault's economy service?

worn jasper
#

yes

#

funny part is that I use it in another class and it works

#

only difference is that I use a Player object instead of Offlineplayer in that class

#

can that be the cause?

lyric gyro
#

it depends ™️

worn jasper
#

explain ™️

lyric gyro
#

ideally it wouldn't

#

but it depends on the economy plugin and how it is subclassing vault

worn jasper
#

oh oof

#

I am using BetterEconomy rn for testing

#

happens the same with xconomy

#

no idea how I would fix this, since I assume #getPlayer() from an offlineplayer wouldn't work if they were offline

lyric gyro
#

in that case it returns null

worn jasper
lyric gyro
#

¯_(ツ)_/¯

proud pebble
#

which you can get their offlineplayer with a uuid

#

Bukkit#getOfflinePlayer(UUID)

worn jasper
#

yes thats what I am using

#

read everything

proud pebble
#

ive used essentialsXEco and it returns the balance correctly, id assume its a problem with those economy plugins or something else

#

maybe the wrong offlineplayer object is being returned

#

see what the offlineplayers getname returns

#

its also possible that the players eco data is unloaded on player quit in the eco plugins youve tested with

#

which tbh is kinda weird

torn heart
#

i know you can change the ascent value and the height on a custom font character to move it up or down, but is there a different way to print multiple consecutive lines than that? like so i don't have to create a variation of each character at different heights on the screen?

proud pebble
#

i would assume yes you can but im not sure how exactly, maybe theres a way to make a character force all other characters infront of it to line up with it

#

ive seen it done with moving all characters back or forward

lyric gyro
#

print where?

stuck canopy
#

What velocity do I need to set for a entity to make it move forward 1 block to the direction it’s facing

hoary scarab
torn heart
torn heart
stuck canopy
#

what is the easiest way to get that marked block's location

#

using that armorstand

torn heart
#

if you wanna get the location one block in front of the armor stand just get its location and then add to it its normalized direction

stuck canopy
#

add what to it?

torn heart
#

sec

#
Location newLocation = stand.getLocation().add(stand.getLocation().getDirection().normalize());

should be something like this

#

just get the stand and that'll give you the new location

stuck canopy
#

sure let me try that

torn heart
#

if you're trying to move the armor stand to that location you can just use .teleport btw

stuck canopy
#

Don’t want to use teleport coz I want smooth movements also seems to be moving like 2-3 blocks but I want to make it move one block at a time

torn heart
#

i just tested it it works fine. change getEyeLocation to getLocation

stuck canopy
#

Its still 2 blocks

torn heart
#

could you show your code? i've tested it and it works fine

somber gale
dusky harness
#

the server owner that I make plugins for only restarts their server when updating a plugin for example

somber gale
#

I don't think that's worth it. I want to avoud some scheduled tasks or whatever.

proud pebble
#

ive almost finished my aote clone and now the last thing to do is to fix teleporting into a hole where the block directly and north and south are both solid

#

but im not exactly sure what the best method is

#

the particles is the teleport spot

#

im hoping that i could make it so that the paricle is on the floor just before the hole in the wall

hoary scarab
#

Try adding .900 in the direction you want it. (Or .400 if you already centered it)

west socket
#

I'm trying to use gson to serialize an object, but it doesn't appear to be serializing the entire thing and just cuts off after awhile

leaden sinew
#

That image is not very helpful, can you just paste the JSON?

#

Are you missing a quote or something?

west socket
#

Yeah one second

#

Wait

#

that didnt work

#

It's hard to paste json since it has no line breaks

#

This is the best I can do

#

It looks like it's missing a quote and close bracket, but I'm not very familiar with json formatting.

leaden sinew
#

I think there should be an option to save it with a different format

#

So that it looks better

west socket
#

Ah

#

Nope, doesnt help

stuck canopy
leaden sinew
#

Probably 1

stuck canopy
#

What should be the vector then?

leaden sinew
stuck canopy
#

k

stuck canopy
#

still moves 2 to 3 blocks...

stuck canopy
#

These velocities are fucked up

#

Its so confusing

leaden sinew
stuck canopy
# leaden sinew Can you post your code?
            Vector oldVector = player.getLocation().toVector();
            Vector newVector = new Location(player.getWorld(), Double.parseDouble(args[0]), Double.parseDouble(args[1]), Double.parseDouble(args[2])).toVector();
            Vector finalVector = newVector.subtract(oldVector).normalize().multiply(2);
            stand.setVelocity(finalVector);```
leaden sinew
#

Why are you normalizing and multiplying by 2?

hoary scarab
#

Make sure to apply an angle or the armorstand will slide less then you want (if there are blocks)

stuck canopy
leaden sinew
stuck canopy
#

Its faster when I multiply

stuck canopy
#

Also the armorstand is stationery before setting the velocity

#

Wdym by angle?

hoary scarab
#

Could also set its gravity to false then a time after set it back to true

stuck canopy
#

The first location have 180 yaw and 0 pitch and I didn’t specify any yaw and pitch to the second location

stuck canopy
leaden sinew
#

No

leaden sinew
stuck canopy
#

I just want the armor stand to move to a location which is specified

#

Without teleporting it

leaden sinew
#

Then move it

stuck canopy
#

K let me try if that works

#

So Im assuming that I don’t need to multiply or normalize the vector. right?

stuck canopy
#

The pitch in first location or the second?

hoary scarab
#

newVector.subtract(oldVector) of this

stuck canopy
leaden sinew
#

Just subtract

stuck canopy
#

Thats what I meant

stuck canopy
leaden sinew
stuck canopy
#

I did

leaden sinew
#

So what happens now?

hoary scarab
leaden sinew
#

That will still have friction though

#

Just teleport it up a small amount

hoary scarab
leaden sinew
#

Yes it will, it starts from the ground

stuck canopy
#

Multiply by 2?

leaden sinew
#

No

#

No multiplying

#

Just subtraction

stuck canopy
#

He says to multiply an you say not to…

leaden sinew
#

No they did not

#

They were saying to set the pitch

hoary scarab
leaden sinew
#

But just teleport it up a bit

hoary scarab
#

If you don't multiply there is no velocity xD

#

One sec

stuck canopy
#

K let me first try the teleporting method. If it doesn’t work then we can see

leaden sinew
#

You just do setVelocity

leaden sinew
hoary scarab
#
if(seat.getPassenger() != null) {
    as.setVelocity(newLoc.toVector().subtract(loc.toVector()).multiply(1.8+cart.getCartSpeed()));
}else {
    as.setVelocity(newLoc.toVector().subtract(loc.toVector()).multiply(.1));
}
```Here is some code from my rides plugin
leaden sinew
#

And even in that case it won't be accurate

stuck canopy
#

Actually I might not be able to use your teleporting method coz I don’t think teleporting a entity works if it has passenger on it

hoary scarab
stuck canopy
#

Does it work?

hoary scarab
#

Not with a passenger

#

Hence the passenger check above lol

stuck canopy
hoary scarab
#

Here I'll edit the message lol

stuck canopy
#

K so it works

hoary scarab
#

... "nope" it doesn't work

stuck canopy
#

Bruhh

leaden sinew
#

I must have missed where you said there was a passenger, sorry

hoary scarab
#

Can't teleport an entity with a passenger

stuck canopy
hoary scarab
#

I edited the message.

stuck canopy
#

Whatever

#

Is it possible to move a armor stand using nms. I found something related to it on spigot forums

leaden sinew
#

You can also just unmount then mount it

hoary scarab
# hoary scarab with packets yes
public MoveArmorstand(Location loc, Player player, ArmorStand stand) {
    double x = (loc.getX() * 32 - stand.getX() * 32) * 128;
    double y = (loc.getY() * 32 - stand.getY() * 32) * 128;
    double z = (loc.getZ() * 32 - stand.getZ() * 32) * 128;
        
    stand.absMoveTo(loc.getX(), loc.getY(), loc.getZ());
        
    ServerPlayerConnection playerConnection = ((CraftPlayer) player).getHandle().connection;
    ClientboundMoveEntityPacket.Pos moveEntity = new ClientboundMoveEntityPacket.Pos(stand.getId(), (short) x, (short) y, (short) z, false);
    playerConnection.send(moveEntity);
}
sterile hinge
#

is that... a constructor... that sends... packets??

hoary scarab
#

yeap lol

icy shadow
#

i am turning in my own grave

#

aaaaaa

#

nooo

#

aaaaaa

#

AAAAA

leaden sinew
#

At least you aren't turning in someone else's grave

#

that would be bad

icy shadow
#

very true

dense drift
hoary scarab
#

Have one for spawn, teleport, move, remove and name visibility.

icy shadow
#

😵‍💫 😵‍💫 😵‍💫 😵‍💫 😵‍💫 😵‍💫 😵‍💫 😵‍💫 😵‍💫 😵‍💫 😵‍💫 😵‍💫

dense drift
#

wait until you find about methods

icy shadow
#

😭

dense drift
#

they are a real game changer

icy shadow
#

true

dense drift
#

they can have different names as well btw

leaden sinew
#

They can even have the same name!

hoary scarab
#

It was mimicking the actual packet names (or use case) while also sending the packets 😉

leaden sinew
#

?

#

That doesn't make sense 😉

dense drift
#

constructors are meant for data initialisation, not what you are doing kek

icy shadow
#

^^ constructors should never have side effects

lyric gyro
#

this is how i write code

Max max = new Max(i, j);
int k = max.result();
sterile hinge
#

perfection

leaden sinew
#

This is how I write code:

#

(I stole your joke Emily)

hoary scarab
icy shadow
#

...?

icy shadow
lyric gyro
#

true

#

i forgot

leaden sinew
icy shadow
#

xDDD

lyric gyro
#

ROFL*

torn heart
#

imagine using spaces to indent

frigid crater
#

hey everyone, a long while back a programmer coded me a minecraft plugin. the minecraft version it was coded for was 1.8,9, I still have the source code and have the plugin open in IntelliJ. How do i update the version to 1.19.2

dusky harness
frigid crater
#

i actually didnt run them yet

#

should i and see the log errors?

#

dont you have to set something in the coding to make the server be able to take the plugin

dusky harness
#

many plugins work fine on latest

dusky harness
#

Sounds won't convert itself to latest though for example

frigid crater
#

ok ill go ahead and try

#

i have 4 plugins so should i run all at once or one at a time

dusky harness
#

all

frigid crater
#

ok so i was planning to run all this through a free aternos server

#

but they dont take custom plugins

#

to upload

#

any suggestions?

#

for server hosting websites that are free or cheap that i can upload plugins onto

dusky harness
#

@frigid crater

Click your windows key and type cmd, press enter (open command prompt)
Put ```bat
java -version

frigid crater
#

java version "1.8.0_351"
Java(TM) SE Runtime Environment (build 1.8.0_351-b10)
Java HotSpot(TM) 64-Bit Server VM (build 25.351-b10, mixed mode)

dusky harness
#

you'll have to install java but that's it

frigid crater
#

do i need to port forward

dusky harness
#

nope

frigid crater
#

am i able to get people to join

#

like a friend on discord

dusky harness
#

well no if you don't port forward

#

i mean this as just a test server to see if the plugin works

frigid crater
#

oh true

dusky harness
#

or does it require 2 players?

frigid crater
#

nah it doesnt

#

just testing atm

dusky harness
#

there's also minehut

#

iirc minehut lets you upload files

frigid crater
#

also doesnt my computer have java already

dusky harness
#

it's an extremely outdated version

#

you have java 8 while 1.19 requires java 17

frigid crater
#

oh?

#

so do i download the new version on the website or can i update it through the one i have

dusky harness
#

you can download it from https://adoptium.net/

Eclipse Adoptium provides prebuilt OpenJDK binaries from a fully open source set of build scripts and infrastructure. Supported platforms include Linux, macOS, Windows, ARM, Solaris, and AIX.

#

Latest LTS Release

#

@frigid crater in the installation process make sure to enable "Put on PATH"

#

or whatever its on

#

something something PATH environment variables

frigid crater
#

add to path?

dusky harness
#

yeah there should be an option

frigid crater
#

no option

#

just says that wil lbe installed

dusky harness
#

huh

#

lemme see

frigid crater
#

i cant put ss in here

dusky harness
#

ill look in the installer rq

#

oh yeah click Next

frigid crater
#

i installed it

dusky harness
#

this is what I meant

pulsar ferry
dusky harness
#

or ig if you installed it already we can set it manually if it didn't set itself

#

close command prompt and then reopen it with the same java -version command

frigid crater
#

openjdk version "17.0.5" 2022-10-18
OpenJDK Runtime Environment Temurin-17.0.5+8 (build 17.0.5+8)
OpenJDK 64-Bit Server VM Temurin-17.0.5+8 (build 17.0.5+8, mixed mode, sharing)

dusky harness
#

oh nice

frigid crater
#

done

dusky harness
#

now do cd C:\Users\CoolUser\Downloads\Server for example (cd means change directory) in command prompt

#

if the path has a space in it then you'll need to wrap it with ""

frigid crater
#

C:\Users "Dylan Nabeth">cd C:\Users"Dylan Nabeth"\Downloads\Server
The system cannot find the path specified.

dusky harness
#

cd "C:\Users\Dylan Nabeth\Downloads\Server"

frigid crater
#

theres a slash before dylan

#

discord isnt showing it

#

oh wrap the entire thing with "?

#

or just the part with the space

dusky harness
#

entire thing

#

🥲

frigid crater
#

'"C:\Users\Dylan Nabeth\Downloads\Server"' is not recognized as an internal or external command,
operable program or batch file.

dusky harness
#

put cd before

frigid crater
#

C:\Users\Dylan Nabeth>cd "C:\Users\Dylan Nabeth\Downloads\Server"
The system cannot find the path specified.

dusky harness
#

then cd Server

#

make sure the Server folder exists in Downloads

frigid crater
#

XC:\Users\Dylan Nabeth>cd Downloads

C:\Users\Dylan Nabeth\Downloads>cd Server
The system cannot find the path specified.

#

ohhh shit

#

i put it on my dekstop

#

my bad

#

ok were good now what

#

@dusky harness ?

dusky harness
frigid crater
#

did

dusky harness
#

then in command prompt run java -jar paper-304.jar (or whatever the jar name is)

#

it should error saying that you have to accept the eula

#

and then you have to go to eula.txt and change false to true

#

then make a plugins folder and put the plugins in there that you want to test and run the java -jar command again

#

in mc, connect with the IP set as localhost

frigid crater
#

Error: Unable to access jarfile paper-304.jar

#

we good

#

[19:34:51 INFO]: Building unoptimized datafixer
[19:34:52 ERROR]: Failed to load properties from file: server.properties
[19:34:52 WARN]: Failed to load eula.txt
[19:34:52 INFO]: You need to agree to the EULA in order to run the server. Go to eula.txt for more info.

#

all normal?

#

@dusky harness ran into issues i think

dusky harness
frigid crater
#

yeah

#

same error

dusky harness
#

which error?

frigid crater
#

maybe something changed ill make a new pastebin

dusky harness
#

what command did you run?

frigid crater
#

java -jar paper-304.jar

#

well with the right name

#

paper-1.19.2-304

#

wait no sorry

#

wait yeah sorry

#

i have no idea what i did lemme retart'

#

C:\Users\Dylan Nabeth\Desktop\Server>java -jar paper-1.19.2-304
Error: Unable to access jarfile paper-1.19.2-304

#

yeah so i cant run that command and doing java -jar gives me that long error in pastebin

#

ok wait

#

fixed it

#

ok im in!!!

#

how do i give myself perms @dusky harness

dusky harness
frigid crater
#

oh that window is the console

dusky harness
#

yeah

frigid crater
#

commands arent working

#

for the plugins i put in

#

yeah nothing works

dusky harness
neat pierBOT
#
FAQ Answer:

Paste Services
When asking for help with a config/menu/code issue please use our paste bin:
(we prefer it over pastebin.com)
HelpChat Paste - How To Use

frigid crater
dusky harness
frigid crater
#

yep

dusky harness
#

i guess im not used to seeing logs that short

#

🥲

frigid crater
#

did i send the wrong this

dusky harness
#

I guess make sure the jars are in the right folder

dusky harness
frigid crater
#

thats from the white screen titled "Mineraft Server"

#

was i supposed to send the cmd prompt

dusky harness
frigid crater
#

im looking at the cmd prompt and its the same

dusky harness
#

if you go in the Server folder and open up the plugins folder its all there?

frigid crater
#

yeah theyre all folders

#

here can i dm u

#

so i can send pics

dusky harness
#

?imgur

neat pierBOT
#
FAQ Answer:

You won't be able to upload images here directly to avoid spam, so please use https://imgur.com/upload to upload images/screenshots.
You can also use a screenshot service like gyazo or jinx and post those links here.

frigid crater
#

id rather not upload to imgur

#

im sorry

#

is my server even spigot

#

or is it vanilla

dusky harness
#

you started the server after uploading the plugins into the plugins folder

#

right

frigid crater
#

yes

#

um

#

are my plugins supposed to be jar file? @dusky harness

dusky harness
#

yes

frigid crater
#

wtf

#

theyre folders

dusky harness
#

uhh whats in the folders?

#

oh wait

#

you're probably using the source code

frigid crater
#

.idea

#

.out

#

.src

dusky harness
#

yeah

#

🥲

#

do you have the actual plugin?

frigid crater
#

fuck

dusky harness
#

not the source

frigid crater
#

maybe

dusky harness
#

use the actual plugin

frigid crater
#

can i make a jar from the source?

dusky harness
#

shouldn't you have the jar already?

frigid crater
#

i have to find it

#

i stripped these off my old pc

#

how do i turn them into jar files

dusky harness
#

depends

#

depends on the build tool and its dependencies

frigid crater
#

IntelliJ is what i use

dusky harness
#

IntelliJ only helps you edit the code - building the plugin still requires running the commands of the build tool (or a button in IntelliJ which just runs the commands)

#

can you show me a screenshot of the project structure?

#

you can DM me

frigid crater
#

so???

#

@dusky harness

dusky harness
#

hmmm
either I'd just put it in #1047749266921230407 (and say that you have the source code) as I don't have the time to fix it for you

#

so maybe someone else is able to

frigid crater
#

i want to fix it myself i just need to know how

dark garnet
#

i have a string ("hello %test==cool% gamer %wow% omg") and i want to extract the %test==cool% part without knowing what cool actually is
ive gotten this far:

final Matcher matcher = Pattern.compile("%test==.*%").matcher("hello %test==cool% gamer %wow% omg");
final String match = matcher.group();
```but the issue comes in with `%wow%`; instead of `match` returning `%test==cool%`, it returns `%test==cool% gamer %wow%`, because of the `.*` in the regex
how can i fix this? *ping if reply*
dark garnet
crisp oar
#

Had hopefully a quick question.
Is it possible to use the API to parse a placeholder from another plugin in my code

dense drift
crisp oar
#

I know that, but I am trying to find a way to parse the placeholder from another plugin and hadn't seen anything about it. I might have just missed it, but I was trying to find something like String parsed = PlaceholderAPI.parse(%some-placeholder-here%);

#

Its not a big issue, Just was curious

dense drift
#

setPlaceholders() @crisp oar

crisp oar
#

Ah alright.
The name threw me off.
I should have read it, but had thought that setting it would be to make them not to parse them.

Thanks for that

dark garnet
river solstice
#

any react experts round here?

#

my home gets rendered multiple times

#

hence the buggy looking text

icy shadow
#

why on earth are u using jquery

wheat carbon
#

what do u use

icy shadow
#

not jquery

sour phoenix
#

What is the reason for this response

sterile hinge
#

probably your message

icy shadow
#

"specifically, will there be any complications with backend functions like sending obfuscated tasks to the kernel"

what in gods name are you doing to need this in a minecraft plugin

#

What does it even mean

#

How does one send obfuscated tasks to the kernel

sour phoenix
#

why does it need to be human readable?

#

lol

sour phoenix
icy shadow
#

I dread to think

sour phoenix
#

Allow me to help you then I guess.. lol

icy shadow
#

I suppose the obvious way is that you just mean syscalls but you're describing it in a really unnecessarily complicated way

sour phoenix
#

its a rootkit.

icy shadow
#

what is?

hoary scarab
#

He's trying to make a backdoored plugin thats able to access the server system rather then just its partition.

icy shadow
#

What does that have to do with deluxemenus

hoary scarab
#

🤷 Haven't figured that out yet lol

icy shadow
#

SQL garbage collector vs the deluxemenus rootkit

#

Which is a worse idea

hoary scarab
#

Has any of the newer java versions made Arrays comparable yet?
Ex;```java
Object[] chunkCoordintes = new Object[] {"world", 1, 1};
Object[] checkCoordinates = new Object[] {"world", 1, 1};

System.out().println("Match: "+(chunkCoordinates == checkCoordinates));

icy shadow
#

that is true for any reference type

#

Nothing special about arrays there

hoary scarab
#

Damn trying to removed the need for a few lists and comparison methods.

icy shadow
#

Arrays.equals is a thing

hoary scarab
icy shadow
#

No

#

That method does what you qant

#

== compares references

hoary scarab
#

🤦

icy shadow
#

It would be nice if arrays overwrote equals and hashcode but I doubt that will ever happen because it will break a ton of existing code

hoary scarab
#

Let me test cause I think it was said before and still didn't work

icy shadow
hoary scarab
#

👍

#

What java version added that?

#

Had to make my own before lol

hushed badge
#

java 2

hoary scarab
#

Found my method (for doubles)```java
public boolean doesDoubleArrayMatch(double[] array1, double[] array2) {
if(array1 == null || array2 == null)
return false;
if(array1.length != array2.length)
return false;
for(int i = 0; i < array1.length; i++)
if(array1[i] != array2[i]) return false;
return true;
}

icy shadow
#

rofl

#

yeah it's been there for years lol

#

with overrides for all the primitives so that method really isnt necessary

hoary scarab
dense drift
#

doesnt jebrains suggest to use Arrays#equals just like it suggest Arrays#toString ?

icy shadow
#

unfortunately not

dense drift
#

😦

leaden sinew
icy shadow
#

i prefer the latter actually

leaden sinew
#

Hmm

#

I think you’re wrong

icy shadow
#

Deluxemenus rootkit is gonna change the world

leaden sinew
#

Maybe

#

But SQL GC will change the universe

#

Just imagine it

#

A GC

#

Written in SQL

#

Unbeatable idea

icy shadow
#

god i wish it was real

#

it would be truly gamechanging

leaden sinew
#

See

#

It’s better than deluxemenus rootkit

hoary scarab
#

If I run World.loadChunk(0,0), what is the best event to check when this chunk has become modifiable? ChunkLoadEvent, EntitiesLoadEvent or something else?

leaden sinew
#

Probably ChunkLoadEvent

icy shadow
#

^^ but just reminding you of this in case you weren't aware

This method will keep the specified chunk loaded until one of the unload methods is manually called. Callers are advised to instead use getChunkAt which will only temporarily load the requested chunk.

icy shadow
#

at least paper 1.16

#

idk

hoary scarab
#

And how long is temporarily? lol Would I still be able to run code in ChunkEvent if using that method?

hoary scarab
icy shadow
icy shadow
#

it's also present on spigot 1.19 so it's not a paper-exclusive thing

hoary scarab
#

Well spigot doesn't say that so

icy shadow
#

yes it does

dense drift
#

d;World#loadChunk

uneven lanternBOT
#
void loadChunk(@NotNull Chunk chunk)```
Description:

Loads the specified Chunk.

This method will keep the specified chunk loaded until one of the unload methods is manually called. Callers are advised to instead use getChunkAt which will only temporarily load the requested chunk.

Parameters:

chunk - The chunk to load

icy shadow
#

^

dense drift
#

The javadocs only display the first few worlds on the top part LOL

hoary scarab
#

Ah thats why lol

warm spear
#

Hello im new but could i use ItemStack#hashCode() to identify an itemstack (the hashCode will never change even when i stop the server etc ... ? ). For example when i right click i check the hashCode

dense drift
#

No

icy shadow
#

NO*

dense drift
#

Use nbt, pdc. Hashcode is not meant for that

warm spear
#

ok ty

warm spear
icy shadow
#

Item stacks dont have anything uniquely identifiable by default

dense drift
#

check for a nbt tag set by you

icy shadow
#

generate a uuid yourself, set it, and then save it somewhere

dense drift
#

depends on your use case

icy shadow
#

or something similar

marble nimbus
#

Quick question: If I have an empty folder where a Server will be created, can I just create an empty .properties file and just put online-mode and port in there, or will that get overridden once the server is created, same question for the spigot.yml

dusky harness
#

with reflection, are you supposed to cache the Class.forName result too?
or just the getMethod, getField, etc

#

I think that you don't have to cache it but im making sure

lyric gyro
#

it's better if you do

dusky harness
#

ah alr

#

thanks emily

#

🙃

icy shadow
#

No worries

lyric gyro
#

ignore him

#

do worry

#

a lot

high edge
#

Quick question, am I able to disable the response on this? (As in, prevent it from sending the empty line).
(Context: Conversation API)

        /**
         * Gets the text to display to the user when this prompt is first
         * presented.
         *
         * @param context Context information about the conversation.
         * @return The text to display.
         */
        @Override
        public @NotNull String getPromptText(@NotNull ConversationContext context) {
            return "";
        }
dense drift
#

Not from what I know, and it doesnt accept null

high edge
#

Actual scam

dense drift
#

After all it is an api made when, 2013? And probabily not updated since then 😬

river solstice
dense drift
#

I can see that

icy shadow
feral raptor
marble nimbus
#

Actually it didn't, it just appends the missing config fields to it

rose depot
#

I'd like to start using the Guilds plugin, but I'm not sure if it has everything I need. I imagine a plugin that works like a clan. Players have bases that they can expand, modify, etc. It would be ideal if they had something to protect. Then I don't know if the plugin has a base label (like with WE) to indicate its area. This could be used to let guild members know when someone is approaching them so they can possibly prepare to defend their base. I would like to make clan wars in one world, where I would limit its size via the worldborder.

stuck canopy
#

I'm trying to store the uuids of a few entities upon spawning and trying to remove those entities when the plugin loads up using their uuids but it seems to not work. What is a better way to do this?

warm steppe
#

Aren’t plugins loaded before the world is even loaded?

icy shadow
#

don't do it on startup

#

EntitiesLoadEvent

dusky harness
#

Also only the entities in spawn chunks would load on startup

#

I think

stuck canopy
#

Didn’t even know that event existed

icy shadow
#

it's relatively new iirc

edgy lintel
#

Any chance?

dense drift
#

@edgy lintel use dms to discuss with them

edgy lintel
#

its a copypasta 💀

dense drift
#

Ok

edgy lintel
#

💀

#

omega

#

skull

#

asd

stuck canopy
#

Is EntityDismountEvent broken or something coz for some reason it fires this event even when I add a passenger to a entity.

#

Also does VehicleEnterEvent fires for Zombies?

sudden sand
#

majority of the vehicle events works with regular entities

stuck canopy
sudden sand
stuck canopy
#
        new BukkitRunnable() {
            @Override
            public void run() {
                if (manager.getPlayersInBus().size() > 0) {
                    for (UUID uuid : manager.getPlayersInBus()) {
                        Player player = Bukkit.getPlayer(uuid);
                        if (player == null) {
                            manager.getPlayersInBus().remove(uuid);
                            manager.getBusByPlayer().remove(uuid);
                            continue;
                        }
                        if (!player.isOnline()) {
                            manager.getPlayersInBus().remove(uuid);
                            manager.getBusByPlayer().remove(uuid);
                            continue;
                        }
                        if (player.getVehicle() == null) {
                            manager.getPlayersInBus().remove(uuid);
                            manager.getBusByPlayer().remove(uuid);
                            player.sendMessage(SUCCESS_LEAVE);
                        }
                    }
                }
            }
        }.runTaskTimer(plugin, 0L, 20L);
    }```
#

what could be causing this error

sterile hinge
#

manager.getBusByPlayer().remove(uuid); modifies a list you're currently iterating

stuck canopy
#

thats a hashmap

#

Fixed it

        new BukkitRunnable() {
            @Override
            public void run() {
                if (manager.getPlayersInBus().size() > 0) {
                    for (int i = 0; i < manager.getPlayersInBus().size(); i++) {
                        UUID uuid = manager.getPlayersInBus().get(i);
                        Player player = Bukkit.getPlayer(uuid);
                        if (player == null) {
                            manager.getPlayersInBus().remove(uuid);
                            manager.getBusByPlayer().remove(uuid);
                            continue;
                        }
                        if (!player.isOnline()) {
                            manager.getPlayersInBus().remove(uuid);
                            manager.getBusByPlayer().remove(uuid);
                            continue;
                        }
                        if (player.getVehicle() == null) {
                            manager.getPlayersInBus().remove(uuid);
                            manager.getBusByPlayer().remove(uuid);
                            player.sendMessage(SUCCESS_LEAVE);
                        }
                    }
                }
            }
        }.runTaskTimer(plugin, 0L, 20L);
    }```
leaden sinew
#

Is there any built-in method to convert a EulerAngle to a Vector? Or do I have to do it myself / how would I do it?

somber gale
proud pebble
#

its possible they are unaware that exxists

dusky harness
#

intellij 😌

lyric gyro
#

what does intellij have to do with any of that lol

dark garnet
#

anyone know how i can replace ${version} in plugin.yml with the version from build.gradle.kts for a test jar?

#

this is what i have to replace ${version} in the main jar and to create the test jar:```kts
tasks {
// Replace version in plugin.yml
processResources {
inputs.property("version", project.version)
filesMatching("**/plugin.yml") {
expand("version" to project.version)
}
}

// Create test JAR
assemble {
    dependsOn("testJar")
}
register<Jar>("testJar") {
    archiveClassifier.set("test")
    from(sourceSets["test"].output)
}

}

#

ping if reply

dusky harness
dusky harness
lyric gyro
dusky harness
#

oh I misread it then 🥲

#

yeah I guess he probably doesn't know about Bukkit.getScheduler

dusky harness
#

instead of version

#

im like 10% sure that regular version didn't work when i tried

lyric gyro
#

it shouldn't make a difference

#

so long as it matches what is in the file with what you replace in the build script

dusky harness
#

ill check my code but just wanted to say that while i bring it up

dusky harness
#

oh I don't have filesMatching

lyric gyro
#

like for all that matters I could have it say ${giant-grandpa-ear-hair}

dusky harness
#

👀

jade wave
#

Any tips to start learning kotlin?

lyric gyro
#

do the things

#

read all the things

jade wave
#

Those are some solid tips

dusky harness
dark garnet
#

i just need it to also work for test

jade wave
dark garnet
#

huh

jade wave
#

I'll send you the painful code xD

dusky harness
#

ow why does kotlin docs not have dark mode

jade wave
#

Once I have some

jade wave
dark garnet
dusky harness
#

🙃

dark garnet
lyric gyro
#

kotlin bad

dark garnet
jade wave
#

Is it?

#

Or are you just bad 😎

dusky harness
#

💀 💀 💀 💀 💀

jade wave
#

Joke btw

lyric gyro
#

i'm too good for kotlin

jade wave
dusky harness
#

?di

neat pierBOT
dusky harness
#

here's an example

#

lol

#

wow it uses Main

#

I thought that was bad to use as the main class name

lyric gyro
#

i mean it's not going to break your program kind of bad

#

it's more like, this is unideal and you may have a problem with that in the future and it does not make sense for a plugin

#

kind of bad

dusky harness
#

why does Java had CoolPlugin

#

but kotlin has Main

#

😠

dusky harness
#

I thought it was like a convention kind of thing

#

like naming conventions

dark garnet
lyric gyro
dusky harness
#

oh

dark garnet
lyric gyro
#

but your class is also called main but you need to fqn it but you forgot and cce aaaaaaaaaaa

dusky harness
dark garnet
#

also wait what the hell did it do to wikipedia

dusky harness
#

lol

#

its mobile version

dark garnet
#

bruh why does it look so much better

#

that should just be the main layout

#

u can collapse categories that is so useful

dark garnet
dusky harness
#

I don't unfortunately

lyric gyro
#

you may be able to get away with doing withType<ProcessResources> { ... as opposed to just processResources { ...

dark garnet
#

altho im being screamed at:

'org.gradle.language.jvm.tasks.ProcessResources' is declared in unstable package 'org.gradle.language.jvm.tasks' marked with @Incubating

lyric gyro
#

yeah

#

just ignore it

dark garnet
#

ok ill tell it to shut up

#

now i dont have to have a completely separate set-up to test my api pepe_woo

lyric gyro
#

how to make the identifier like this? namelist_player_# # replace with number

@Override
    public String onPlaceholderRequest(Player player, String identifier) {
        if (identifier.equals("player_#")) {

do i like substring and check last char?

dusky harness
#

or you can just keep it simple and do ```java
if (identifier.equals("player_#")) {
int num = Integer.parseInt(identifier.substring(7));
}

#

your choice 😃

lyric gyro
#

alright thankyou

dusky harness
#

👍

#

np

hoary scarab
dusky harness
#

i might be wrong though

hoary scarab
#

If the string doesn't originally contain an _ I don't think it creates an array. I think it nulls doesn't it?

dusky harness
#

only 1 way to find out

#

gimme a sec

#

oh it returns an empty array

#

none of us were right 🥲

#

wait

#

lemme see actually

hoary scarab
#

👍

dusky harness
#

nvm it returns an array of size 1

#

i put in "" and it returned [] so I thought at first that meant empty array

hoary scarab
#

It would still output array index out of bounds right?

dusky harness
#

that it's at least 2

hoary scarab
#

Oh ok. Maybe I'm thinking of something else then.

dusky harness
#

possibly
🤷
You learn new things every day fingerguns

sour hamlet
broken elbow
grand zodiac
#

So, what new careers are ya'll picking?

#

We aren't even needed for debugging anymore

broken elbow
#

But who is going to debug the chat ai?

grand zodiac
#

It will debug itself

high edge
broken elbow
high edge
#

Same

broken elbow
#

easy map

#

math*

#

I'm on meth

#

bye

grand zodiac
high edge
#

It'll probably give you an answr

#

nvm it won't

frigid crater
#

java: getDurability() in org.bukkit.inventory.ItemStack has been deprecated

#

what does this mean

#

i have three warnings like that

proud pebble
#

if you wanna get durability get it from ItemMeta

#

specifically Damageable

#

so ((Damageable) ItemStack.getItemMeta()).getDamage()

#

ofcourse do your checks before casting

frigid crater
proud pebble
frigid crater
#

1.19.2

#

im converting it from 1.8 to 1.19.2

#
    xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <groupId>dev.magicmq</groupId>
    <artifactId>captcha</artifactId>
    <version>1.0-SNAPSHOT</version>
    <name>Captcha</name>

    <properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    </properties>

    <repositories>
        <repository>
            <id>repo</id>
            <url>https://hub.spigotmc.org/nexus/content/repositories/snapshots/</url>
        </repository>
    </repositories>

    <dependencies>
        <dependency>
            <groupId>org.spigotmc</groupId>
            <artifactId>spigot-api</artifactId>
            <version>1.19.2-R0.1-SNAPSHOT</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>dev.magicmq</groupId>
            <artifactId>rappu</artifactId>
            <version>1.6-SNAPSHOT</version>
        </dependency>
    </dependencies>

    <build>
        <defaultGoal>clean package</defaultGoal>
        <sourceDirectory>${basedir}/src/main/java</sourceDirectory>
        <finalName>${project.name}-${project.version}</finalName>
        <resources>
            <resource>
                <directory>${basedir}/src/main/resources</directory>
                <filtering>true</filtering>
                <includes>
                    <include>**/*</include>
                </includes>
            </resource>
        </resources>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>3.8.1</version>
                <configuration>
                    <source>17</source>
                    <target>17</target>
                </configuration>
            </plugin>
            <plugin>
                <artifactId>maven-shade-plugin</artifactId>
                <version>3.2.3</version>
                <executions>
                    <execution>
                        <id>shade</id>
                        <phase>package</phase>
                        <goals>
                            <goal>shade</goal>
                        </goals>
                    </execution>
                </executions>
                <configuration>
                    <finalName>${project.name}-${project.version}</finalName>
                    <relocations>
                        <relocation>
                            <pattern>com.zaxxer.hikari</pattern>
                            <shadedPattern>dev.magicmq.captcha.libs.hikari</shadedPattern>
                        </relocation>
                        <relocation>
                            <pattern>dev.magicmq.rappu</pattern>
                            <shadedPattern>dev.magicmq.captcha.libs.rappu</shadedPattern>
                        </relocation>
                    </relocations>
                </configuration>
            </plugin>
        </plugins>
    </build>
</project>````
#

thats my pom

#

omg

#

how do i collapse that

proud pebble
#

that sounds like youre building it using java 18 or higher instead of java 17

frigid crater
#

oh

#

so should i change 17 to 18 and see if that works

proud pebble
#

are you using intellij?

frigid crater
#

yes

proud pebble
#

in project structure what language version does it say its using?

frigid crater
#

temurin 17

proud pebble
#

not jdk, the language level

#

theyre too seperate boxes

frigid crater
#

uhhh

#

i dmd u a pic

proud pebble
#

that looks correct

#

when you compile what are your steps?

frigid crater
#

i refresh pom

#

and click on package

#

in maven

#

i sent u 1 more dm

proud pebble
#

afaik your supposed to do clean package

frigid crater
#

where

proud pebble
#

create a maven configuration and in the command box put clean package

frigid crater
#

wish i knew how xD

proud pebble
#

see on the toolbar theres like a green triangle pointing right and theres a massive box woth a tiny arround on the right?

frigid crater
#

yes

#

same error shows up

#

nvm

#

maven clean?

#

cleaned

#

packaged again and same error

proud pebble
frigid crater
#

dm

proud pebble
#

no idea

frigid crater
#

😮

proud pebble
#

hmm

#

try 3.3.1

frigid crater
#
[INFO] --- maven-shade-plugin:3.2.4:shade (shade) @ captcha ---
[INFO] Including dev.magicmq:rappu:jar:1.6-SNAPSHOT in the shaded jar.
[INFO] Including com.zaxxer:HikariCP:jar:3.4.1 in the shaded jar.
[INFO] Including org.slf4j:slf4j-api:jar:1.7.25 in the shaded jar.```
#

thats more detail on the shade

#

331 doesnt read

#

turns red

proud pebble
#

maybe its 3.3.1-SNAPSHOT

#

actually apparently 3.4.1 is latest for maven shade

#

i ersonslly still use 3.2.4 just cus i never updated and it support java 14 like my plugin needed at the time, i dont remember when i last of if i actually every did compile native java 17

frigid crater
#

<artifactId>maven-shade-plugin</artifactId>
<version>3.4.1</version>

#

maven shade not found

#

@proud pebble how do i download the latest shade

#

check dm

proud pebble
#

you clicked the maven logo in the top right yes

#

id assume its safe to ignore

frigid crater
#

yeah

#

i updated to 3.3.0

#

now its giving me errors in console

#

[01:55:41 ERROR]: Error occurred while disabling Captcha v1.0-SNAPSHOT (Is it up to date?)
[01:58:20 ERROR]: Ambiguous plugin name Captcha' for files plugins\Captcha-1.0-SNAPSHOT.jar' and plugins\captcha-1.0-SNAPSHOT-shaded.jar' in plugins'
[01:58:20 ERROR]: [STDERR] [org.bukkit.craftbukkit.v1_19_R1.legacy.CraftLegacy] Initializing Legacy Material Support. Unless you have legacy plugins and/or data this is a bug!
[01:58:27 ERROR]: [dev.magicmq.captcha.libs.hikari.pool.HikariPool] captcha-rappu-hikari - Exception during pool initialization.

#

also the build gave me 3 jar files

lyric gyro
#

Is there a good way to "mark" a custom item so that you can later check if the held item is let's say a special sword or a normal sword?

frigid crater
#

1 sec the dev is working with me rn

warm steppe
lyric gyro
warm steppe
#

I have used them personally to make custom enchantments

#

pretty nice thing

warm steppe
proud pebble
#

dont use the shaded one

frigid crater
#

the dev decided to just fix the plugin for me himself xD

tight junco
#

Anyone know the reasoning for java.lang.IllegalStateException: Cannot move entity off-main, it semes to be more of a paper thing but altHmm

#

seems to happen when teleporting an entity

lyric gyro
#

consider not doing it off the server thread?

tight junco
#

but like

#

where did that error come from huh

icy shadow
#

somewhere

#

Read the stack trace if you want to know where it came from

lyric gyro
high edge
proud pebble
#

where stacktraces no longer exist and raw bytecode is harvested by hand

lucid mica
#

I made a freeze plugin that freezes you when you get hit by a bow but when you unfreeze it spams the message, any idea why?

    public void onPlayerMove(PlayerMoveEvent e){
        if(frozenPlayers.contains(e.getPlayer())){
            e.setCancelled(true);
            new BukkitRunnable() {
                @Override
                public void run(){
                    frozenPlayers.remove(e.getPlayer());
                    e.setCancelled(false);
                    e.getPlayer().sendMessage(ChatColors.chat("&aYou are now unfrozen!"));
                }
            }.runTaskLater(plugin, 100);
        }
    }``` (It only spams it when you try move when you're frozen then when you get unfrozen it spams the message)
dense drift
#

look at the code, it is pretty obvious why that happens

lucid mica
little surge
icy shadow
lyric gyro
#

How to specify the dragon's head in the DeluxeMenus?

dense drift
dark garnet
#

hi, i have 2 strings, hello_there_super_cool and wow_epic
i want to replace the _ with . using regex, how can i do that?

#

to avoid xyz problem:
full string: new AnnoyingMessage(plugin, "error_invalid_argument")
error_invalid_argument is different for every instance, im using intellij replace regex (supports captures groups)
i need all the _ in the keys (error_invalid_argument) to be replaced with .

icy shadow
#

_ as the search and \. as the replacement?

dark garnet
#

but i cant just do _ as the regex cause then every single _ in my code will be replaced

#

i have something like this:
new AnnoyingMessage\(plugin, "(?:([^_]+)_*)*"\)

#

but the problem is that the capture group only returns the last match

dark garnet
#

ig i could do new AnnoyingMessage\(plugin, "([^_]+)_([^_]+)"\) for keys that only have one _, and then use new AnnoyingMessage\(plugin, "([^_]+)_([^_]+)_([^_]+)"\) for keys that have 2 _, and so on

dark garnet
potent flower
#

I'm quite new at programming, I'm wondering if a function like this is good enough. It's intended to work with both positive and negative values:

    public void changeLevel(int levels)
    {
        // Guard clause: Level cannot be higher than maxLevel.
        if (level + levels > maxLevel)
        {
            level = maxLevel;
            return;
        }

        // Guard clause: Level cannot be lower than 0.
        if (level + levels < 0)
        {
            level = 0;
            return;
        }

        level = level + levels;
    }
dark garnet
#

Unchecked cast: 'java.lang.Object' to 'java.util.Collection<java.lang.String>'
how can i fix this? i tried googling, but the problem is that i dont know what type of collection suggestionsObject is, so i cant loop thru (Collection<?>) suggestionsObject and add to a new collection

        final Object suggestionsObject = onTabComplete(sender);
        final Collection<String> suggestions;
        if (suggestionsObject instanceof Collection) {
            suggestions = (Collection<String>) suggestionsObject; // <--- WARNING HERE
        } else if (suggestionsObject instanceof TabCompleteType) {
            suggestions = ((TabCompleteType) suggestionsObject).getFunction().apply(sender);
        } else {
            return Collections.emptyList();
        }```
icy shadow
#

easy solution = you cant
hard solution = lots of refactoring to make things generic so you never need Object/Collection<?>

dark garnet
#

🙃

icy shadow
#

unchecked casts are gonna be inevitable at some point down the line tho

#

i would suggest that returning Object is a bad idea

#

if you can help it

dark garnet
#

idk how to get around it

#
    @Nullable
    default Object onTabComplete(@NotNull AnnoyingSender sender) {
        return null;
    }```
#

can either return a collection or TabCompleteType:

    enum TabCompleteType {
        ONLINE_PLAYERS(sender -> AnnoyingUtility.getOnlinePlayerNames()),
        OFFLINE_PLAYERS(sender -> AnnoyingUtility.getOfflinePlayerNames()),
        WORLDS(sender -> AnnoyingUtility.getWorldNames()),
        BOOLEAN(sender -> Arrays.asList("true", "false"));

        private final Function<AnnoyingSender, Collection<String>> function;

        @Contract(pure = true)
        TabCompleteType(Function<AnnoyingSender, Collection<String>> function) {
            this.function = function;
        }

        @Contract(pure = true)
        public Function<AnnoyingSender, Collection<String>> getFunction() {
            return function;
        }
    }```
#

i tried having 2 onTabComplete methods, but it doesnt work since they both have the same arguments

#

i think i got around it

#

after getting suggestions, i loop thru them to filter, so i just check if suggestion is string when filtering:

        // Get suggestions
        final Object suggestionsObject = onTabComplete(sender);
        final Collection<?> suggestions;
        if (suggestionsObject instanceof Collection) {
            suggestions = (Collection<?>) suggestionsObject;
        } else if (suggestionsObject instanceof TabCompleteType) {
            suggestions = ((TabCompleteType) suggestionsObject).getFunction().apply(sender);
        } else {
            return Collections.emptyList();
        }

        // Filter suggestions
        final List<String> results = new ArrayList<>();
        for (final Object suggestion : suggestions) {
            if (!(suggestion instanceof String)) continue;
            final String suggestionString = (String) suggestion;
            if (suggestionString.toLowerCase().startsWith(args[args.length - 1].toLowerCase())) results.add(suggestionString);
        }
        return results;```
dark garnet
icy shadow
#

An interface is the obvious one that springs to mind

#

Or in java 16, sealed class + records to replicate an ADT which will keep your type safety

dark garnet
#

using java 8 so interface it is ig

icy shadow
#

sad

#

But yeah interface which your enum and a class wrapping a collection both implement

dark garnet
#

oh and then the interface has a method to return a collection<string>?

icy shadow
#

Yes, taking the sender as an argument

#

Alternatively, just make onTabComplete always return the Function<AnnoyingSender, Blah> and just use ignored -> collection for when you don't care about the sender

#

but then if you think about the design more, why do you even have 2 separate functions? just make onTabComplete return a Collection all the time. if you want some pre-set completions, just make them static methods

dark garnet
icy shadow
#

is it really?

lyric gyro
#

either type either type

icy shadow
#

return TabCompleteType.ONLINE_PLAYERS; vs return Completions.onlinePlayers();

#

seems exactly the same to me

dark garnet
#

ok ye imma just do that actually too much pain

icy shadow
#

KISS

lyric gyro
#

my ass

dark garnet
#

:O

lyric gyro
dark garnet
#

ban ban ban

lyric gyro
icy shadow
#

hell, it seems like your TabCompleteType entries don't even need the sender

dark garnet
#

future-proof

icy shadow
#

future-complicating

dark garnet
#

at least u didnt point out that all the tab complete types are just static methods

icy shadow
#

theres nothing inherently wrong with that

#

static is fine as long as you're not mutating things or (arguably) pulling dependencies out of nowhere

dark garnet
icy shadow
#

yeah you should

#

for your preset ones

#

not for all of them ofc

dark garnet
#

yeye and the enum was already doing that so the enum was basically just an alias to the static methods 💀

icy shadow
#

yeah i did say that lol

dark garnet
#

oh

icy shadow
#

if you want some pre-set completions, just make them static methods

dark garnet
#

heh

olive lily
#

Hey, I was wondering, is it possible to join a server with same Premium account? Is there a way like changing the UUID of first player? Can you @mention me for the answer? Thanks

vagrant minnow
#

Is there now a Source Code dor Deluxemenues?

proud pebble
#

there isnt a public source code, but there is a private one that i assume is only owned by the deluxemenus devs

hoary scarab
#

🤦 why does minecraft use byte when you set a boolean

#

Annoying because now my boolean turns into a byte and my getTag methods will return a byte instead of a boolean and error. sigh

dense drift
#

Because thats what booleans are?

dusky harness
#

technically aren't booleans a bit?

#

but since java can't store them it's represented as a byte since it's the smallest datatype

hoary scarab
#

Yeah but on return of a NBTTag it returns as byte rather then true or false. So broke shit and had to debug for a few hours lol

dusky harness
#

i assume there's like a getBoolean method though

hoary scarab
dense drift
#

therefor it is your fault D:

hoary scarab
#

never said it wasn't lol

#

Annoying because now my boolean turns into a byte and my getTag methods will return a byte instead of a boolean and error. sigh

lyric gyro
#

it has always been like that lol

#

like since the beginning of time

hoary scarab
#

never had this issue come up before so never noticed

dark garnet
#

hi i need help with some dependency importing thingy magicy stuff
so i have a method in my api that accepts TextChannel as an argument, TextChannel is from discordsrv
the api imports discordsrv (not shadow bc if i shadow it includes like 30 other things, and some cant be excluded cause they weird), but the plugin using the api doesnt import discordsrv
when i try to use a method with the same name as the other one, it doesnt build:

class file for github.scarsz.discordsrv.dependencies.jda.api.entities.TextChannel not found

#
    public void send(@NotNull TextChannel channel) {
        DiscordUtil.sendMessage(channel, ChatColor.stripColor(getMessage()));
    }

    public void send(@NotNull CommandSender sender) {
        send(new AnnoyingSender(sender));
    }```these r the 2 methods, im using the 2nd one in my plugin, but the 1st one is causing the error since the plugin doesnt import/compile discordsrv (even tho im not technically using the first method)
dusky harness
dark garnet
#

i just want a plugin using my api to be able to use send(CommandSender) without needing to import discordsrv

dusky harness
#

oh shoot you made discordsrv?

dark garnet
icy shadow
#

that was me

cinder forum
icy shadow
#

YES!

#

working on it

#

I have actually done the latter before

#

but it's awful

#

and needs JNI

#

so literally triples development time

dusky harness
dark garnet
lyric gyro
icy shadow
#

soon

#

but not that soon

#

because it is a painful experience tbh

#

even getting 2 stub files to compile is irritating

dark garnet
icy shadow
#

the easy fix is just depend on discordsrv too

#

but if your api used a proper publishing system it could expose dsrv as a transitive dependency and it'd be added automatically

dark garnet
#

the jar file is just for server owners

icy shadow
#

okay are you actually depending on it with maven?

dark garnet
icy shadow
#

okay even better

#

show buildscripts for both projects pls

icy shadow
icy shadow
#

makes it a transitive dependency

dark garnet
icy shadow
#

i assume you've republished

#

bump the version in case it's getting cached

dark garnet
icy shadow
#

and also because that should be a bump version anyway

icy shadow
dark garnet
icy shadow
#

this is another reason why you should be publishing your api as a maven artifact rather than just a jar file

#

jar files do not hold dependency information

dark garnet
#

r u sure this will work? i dont wanna make a release and it no work

icy shadow
#

it's already not working

#

hardly gonna get worse

#

also

#

you dont have to make a release

dark garnet
#

oh true

icy shadow
#

you can just use the commit tag with jitpack

#

fucking jithub lmao

dark garnet
#

💀

icy shadow
dark garnet
#

Could not find com.discordsrv:discordsrv:1.26.0.

icy shadow
#

probably need to add the repo

#

i think there's some way of making repositories transitive too but idk what it is

dark garnet
#

ughhhhh

dark garnet
dark garnet
icy shadow
#

okay

#

i can do absolutely nothing with that information

#

but it is literally 1 line to add the repo so hardly a big issue

dark garnet
#

its just annoying cause not all my plugins r ever gonna touch the send(TextChannel) method

#

only 1 of my plugins currently do actually

#

ill just remove the method actually, it only runs one line which can be easily done by the plugin, just unfortunate

icy shadow
dark garnet
icy shadow
#

a "subproject" that can have different dependencies

#

then you only add the dependencies you want

#

@cinder forum lol

cinder forum
dark garnet
icy shadow
#

you have a base with the no-dependency stuff, and another module for the dsrv stuff

dark garnet
#

would that mean 2 separate AnnoyingMessages?

icy shadow
#

no?

dark garnet
#

oh

#

im confused

icy shadow
#

fuck

#

reply fail

cinder forum
icy shadow
#

soz

#

jk idc

icy shadow
icy shadow
# icy shadow look at this

core module has all the base stuff, the papi module has papi-specific stuff, papi module depends on core module

#

if you only want base stuff, only depend on core module. if you want both, depend on both

#

simple

dark garnet
#

but the different modules wouldnt have different classes

#

only a different method inside of a class that everything else is the same in

icy shadow
#

yeah thats not really gonna be possible without some hacks

#

hacks that are not really worth the hassle imo

dark garnet
#

ok

icy shadow
#

also hacks that i would not know how to do before you ask

dark garnet
#

wow bad programmer (jk)

cinder forum
#

bm do you use rust 🥺

icy shadow
#

no

leaden sinew
#

So then you would do

    public void send(@NotNull TextChannel channel, SomeObject messageType) {
        messageSenders.get(messageType).send(yourCommandSender, yourMessage)
        DiscordUtil.sendMessage(channel, ChatColor.stripColor(getMessage()));
    }
dark garnet
icy shadow
#

or just use inheritance

leaden sinew
#

That too

icy shadow
#

base class only has send(CommandSender)
override and add send(TextChannel) or whatever

dark garnet
#

but it'd ruin consistency and just be weird

leaden sinew
#

How would that work though if they wanted to send a TextChannel?

icy shadow
#

easiest way of doing it

leaden sinew
#

In their base module

icy shadow
#

you wouldnt

dark garnet
#

yea u just wouldnt be able to

leaden sinew
#

I don't think I understand what you want then lol

icy shadow
#

if you're only depending on the base module then discordsrv isnt even on the classpath

dark garnet
leaden sinew
#

What class is send in?

dark garnet
leaden sinew
#

Can you link the project?

leaden sinew
#

Where is AnnoyingMessage being sent from?

#

Are you creating a new one each time you send it?

dark garnet