#help-development

1 messages · Page 747 of 1

sick edge
#

@young knoll one question: What do you do if you need multiple Inventories of one CustomInventory (if i see it correctly an Instance of CI is a specific CustomInventory so you cant instantiate multiple of that)?

smoky oak
#

why shouldnt you be able to? if its separate for people make multiple instances, if they look at the same inventory open the same inventory for em all

sick edge
smoky oak
#

wlel

#

good luck i guess

remote swallow
#

a class would extend custom inv

#

wait

#

when did it cahnge

#

@young knoll smh

sick edge
young knoll
#

When did what change

remote swallow
#

you added more generic

wet breach
#

but generics are awesome

remote swallow
#

yeah but changes

young knoll
#

Lol

#

If you want multiple instances you just make multiple instances

short pilot
#

what's a good way to implement an invites system for a factions plugin? Store the invites per faction mapping to a player or something?

ivory sleet
#

Depends on how you gonna structure the usage of ur invites

sick edge
ivory sleet
#

But presumably you prob want the invites encapsulated inside some faction object

short pilot
#

i have a factions manager object

#

would that make more sense?

#

then perhaps i could map player UUID to a faction ID

ivory sleet
#

You wouldn’t store the invites there tho lol

#

And manager is usually a bad name as I assume that class is just a glorified map, no?

short pilot
#

something like that

#

so what would you suggest doing in this case?

ivory sleet
#

Ugh i mean keep the “manager” although its more of a repository class

#

I just said that it makes sense to encapsulate the invites inside a faction object, you don’t agree?

wet breach
#

there is a few different ways to do this, but it all depends how you are saving the info to begin with

short pilot
#

hmm ok

short pilot
#

i was planning to notify them like a sort of mail thing

ivory sleet
#

Faction#isInvitePending(player)
or sth like
Faction#getInvitationState(player)

#

You can make so the invitations are expiring after x time period subsequent to creation

weak meteor
#

yea i dont like gradle for some reason

ivory sleet
#

Not gradles fault

weak meteor
#

mine? D:

ivory sleet
#

You just haven’t specified what dependencies to shade etc

weak meteor
#

should i?

ivory sleet
#

I mean yes?

weak meteor
#

idk

#

new to gradle

ivory sleet
#

ah you probably need to add a shade plugin (shadowJar)

weak meteor
#

lemme show you the whole build.gradle

#

?paste

undone axleBOT
ivory sleet
#

Since I assume you’re developing against gradle’s normal java plugin

weak meteor
weak meteor
ivory sleet
#

That thing is like a tutorial island without any finish line, it has some niece QoL features but def lacks some stuff

weak meteor
#

so...

#

should i change to maven

remote swallow
#

no

#

just add the shadow plugin

weak meteor
#

thanks

ivory sleet
#

(Then you run shadowJar instead of build (or jar))

#

And the output file should be named with the suffix -all

weak meteor
#

uy

#

i added the id plugin

#

now what should i change

#

(im new to gradle ig)

ivory sleet
#

Nothing

remote swallow
#

you just change the task you run

ivory sleet
#

You just run the task shadowJar instead

weak meteor
#

oh

#

okay

ivory sleet
#

yeah, its pretty nice for being an external plugin you have to add

weak meteor
#

and now i guess its something from the api

#

i do not like dynamodb

young knoll
#

Wait do people actually run shadowJar

#

Rather than making build depend on it

remote swallow
#

ye

weak meteor
#

it worked

#

now i can be happy

ivory sleet
weak meteor
#

can i use color codes when im using Logger#info?

#

in the JavaPlugin class

hazy parrot
#

Try ansi codes

#

But there is really no reason to do that

wet breach
#

typically for logging purposes you shouldn't use color codes as these codes will show up in the log file and make it harder to read or find the info you are looking for. So it looks good when you have the console up, but that is it.

#

most people who run servers are not even looking at the console, and even if they were the console has a limited history you could scroll back to

short pilot
#

how do i store entire objects on mongodb or is that not advisable

#

actually scratch that i dont think i installed it correctly

#

trying to install it using this page but idk what to do with the jar with gradle

wet breach
#

you would shade it in

#

reason you don't shade in the connector for mysql is because spigot already has it shaded in

#

but spigot doesn't shade in connectors for all DB's mongoDB being one of them

sterile token
#

Why all spigot tutos explain mongodb against MongoCursor instead of bson document?

remote swallow
#

the command stuff in my current plugin is so jank but its the best way i can think at the moment

sterile token
remote swallow
#

basically uses the arg command handler in my lib to create the start command, then it janks into another handler with another impl of that to work with it only have args that it will need

sterile token
#

oh okay

#

its public lib?

remote swallow
#

yeah

sterile token
#

would i take a small look?

#

Im designing mine and wants to have idea

remote swallow
sterile token
#

So far thought them as Single and Parent structure, where Single represent a command with none implicit arguments. While Parent, has implicit arguments or other parents associated to it. What do you think about it?

remote swallow
#

the names could probably do with some work but the idea works

sterile token
#

right i having some nightmare around recursition

#

Specially with parent, because one parent have more parents associated to it and that into an infinite chain. Which ends in recursive execution

remote swallow
#

the way mine works is there an abstract simple command handler, takes a permission and overides tab complete to return an empty list, then my arg command handler allows you to create sub commands, but its desinged so you can stack it as it extends simple command handler

sterile token
#

yeah mines is similars to you

#

yours Arg command is mine Parent, same with simple command is my Single

#

i will have to code it carefully hehe

grand flint
#

How can I make it always the latest version, whenever I create a new project it starts with 7.3.3

remote swallow
#

file>settings>Editor>File and Code Templates>Other>Minecraft>Common>MinecraftDev gradle-wrapper.properties

weak meteor
#

question

#

this ShadowJar stuff

#

puts all dependencies on the Jar right?

remote swallow
#

the ones that should be shaded yes

river oracle
#

All the ones you tell it to

remote swallow
#

shouldnt you be asleep

river oracle
#

It's 8pm

remote swallow
#

and

#

you have to wake up at 5 am for college

weak meteor
#

how should i tell the plugin which to shadow

remote swallow
#

use implementation over compileOnly

weak meteor
#

like this its ok ig

river oracle
#

Don't shade spigot 💀

weak meteor
#

k

remote swallow
#

kek

weak meteor
#

like this?

remote swallow
#

ye

weak meteor
#

cuz im trying to obfuscate

#

but the obfuscator cant think for itself so i gotta put all dependencies in jar either dependencies for the obfuscator

#

and stuff

#

BUT IM NOT EVEN USING LOG4J BRO

wet breach
#

shouldn't bother with obfuscating

sterile token
#

When obfuscating, you must tell the obfuscator what libraries you used. So it doesnt obfuscate them

river oracle
weak meteor
river oracle
#

No reason to learn obfuscation

#

It's a waste of time

weak meteor
#

where is the cache of gradle

#

or any other way to get the jar of the implementation?

sterile token
weak meteor
#

yes

river oracle
#

Your code isn't special enough to be obfuscate

weak meteor
#

never backdown never giveup 💪

sterile token
#

But he will realize he will just lost time

weak meteor
#

i know im losing my time

remote swallow
#

most ive done in the past 3 weeks

sterile token
#

@river oracle it is a canonical event, we can not intervene

remote swallow
weak meteor
#

NEVER GIVEUP

#

chatgpt is slower than my ass

#

bros been thinking since 1984

sterile token
#

free version what more you can expect

weak meteor
sterile token
#

Premium doesnt even take more than 1m to answer longer question

#

What do you want to obf i can do it for you if yo uwant

weak meteor
#

ur paying in a free game

weak meteor
#

dont wanna bother u

sterile token
weak meteor
#

i know

#

just lemme have an argument in not paying gpt plus

#

or however its called

sterile token
#

i dont know what you wondering to say, but all same shit about premium things until they give a try

weak meteor
#

well

sterile token
#

Is that same that saying that Copilot is like paying air when thats is totally fake. Its even more powerfull than any other AI rounding

weak meteor
#

thats kinda true

remote swallow
#

@river oracle opinion on reload confirm

weak meteor
#

its given free for students

#

👲

wet breach
remote swallow
wet breach
#

obfuscation doesn't stop anyone. MC is a prime example

river oracle
weak meteor
#

how can people be so unoccupied to reverse engineer a 2usd plugin

wet breach
#

MC used obfuscation, and yet we still managed to do what we wanted with it

remote swallow
weak meteor
remote swallow
#

still is

sterile token
river oracle
wet breach
weak meteor
#

well i was talking that with @sterile token

#

if people want the code, they'll get it

#

but they'll need to know how to do it

remote swallow
#

feck sake

sterile token
weak meteor
#

like, i dont want to gift it

remote swallow
# sterile token ?

i making something that relies on worldedit percents, and its annoying bc it uses weighted random

sterile token
#

obfuscating it or not is the same as gifthing it

weak meteor
#

well

#

yeah in part

river oracle
wet breach
#

The reason obfuscation can be defeated is learning java and the JVM. If you learn those two things you would understand why obfuscation is pointless with the exception of minimizing sizes I guess, but size isn't an issue when your project isn't even going to take up a tenth of space of HDD's

sterile token
#

Everything that is understood by a machine is understood by a human.

wet breach
#

Its not that, Java was never designed with protecting code

river oracle
river oracle
wet breach
#

because Java was more geared towards the Enterprise side and in the Enterprise side its actually far easier to control businesses in what they can and can't use without using obfuscation

#

so it wasn't seen as a necessity to incorporate such things

#

Sure change the name of methods and classes, doesn't stop me from naming them myself

sterile token
#

You are going to laugh too much but I have read bytecode of obfuscated plugins and it was just a waste of time, because it is garbage programmed code. Here is an example, where why obfuscate if the code is no big deal.

wet breach
#

as long as you have a decent IDE you can see where all methods are used and variables

wet breach
sterile token
wet breach
#

then you would know there is no hiding anything

weak meteor
#

fuck it

#

i'll not obfuscate

#

so difficult

wet breach
#

Well it is, and with very little to gain from it

weak meteor
#

BUT THE PROBLEM NOW IS

#

how tf do i protect my AWS credentials?

wet breach
#

this is why like 99% of java projects do not bother with it

sterile token
#

not difficult, wasting of time, thats the correct term

weak meteor
#

well, its true that i can change them

#

but

wet breach
weak meteor
#

its not what i would like

weak meteor
sterile token
#

what you trying to do??

#

you want to add a DRM? If not doesnt make sense that question

weak meteor
#

look

wet breach
# weak meteor what u mean

I forget the kind of credential system, but anyways you validate through a restAPI with a different set of credentials. And the restAPI is the one that keeps hold and secures the aws credentials without exposing them

weak meteor
#

but to access iam

#

u need 2 keys

#

access

#

and secret

#

the ones like lined

remote swallow
#

is aws for storing data from the plugin, or is it saving stat data for the plugin

weak meteor
#

its just a simple License manager

remote swallow
#

rest api

sterile token
weak meteor
#

no cuz people will crack the plugin

#

and thats not the idea

#

of selling something

wet breach
#

people can crack anyways

weak meteor
#

people do anything to get free stuff

sterile token
#

yeah they can crack it even more easier than if you obfusate it

wet breach
#

its not overly difficult to decompile, remove your license thingy and recompile

remote swallow
#

it sends/asks for the data the rest api responds with what it needs, to check just ask for xyz rest api verifies then queires aws

weak meteor
#

whats drm

wet breach
#

but now, if you use something like a RestAPI you wouldn't necessarily stop them from using the plugin

#

but you can stop them from accessing the data

sterile token
# weak meteor whats drm

it is a technology and set of access control techniques used by content creators, publishers, and distributors to protect digital media

remote swallow
#

idk why people care so much about people cracking their plugin, oh no they want to use ur plugin

sterile token
wet breach
#

just know not even native applications are safe from cracking either 😉

remote swallow
#

if i ever do decide to sell premium im just gonna publish it free on github with source code bc if they want to use my plugin i would rather it have no malware from cracked sites

sterile token
#

you can even reverse engeenier native apps so dont lost time

wet breach
#

Now here is the thing though

#

if you have to combat people from taking your plugin, you are going about it the wrong way to deal with it

#

that is, you are not actually addressing the problem

sterile token
#

Yeah first thing you must do for selling, is licenses nothing more efficient than that

wet breach
#

the problem may be your price is too high if you are seeing too many so call stealing it

#

maybe release a limited free version

weak meteor
#

like lightspigot?

#

didnt think about jt

#

it*

wet breach
#

but those who steal it though had no intention of paying, and those are not your customers, and if them stealing it isn't affecting your loyal customers you can largely ignore it. Adobe Photoshop became popular because it didn't really care people stole it

#

it was free advertisement to them

#

they knew you could crack it easily and they didn't put much effort into it beyond just needing a key but the thing is, someone had to buy the key first 😛

#

this is how Photoshop became popular and reason anyone knows it

#

but they knew it would get spread around and it would be all people talked about because friends would recommend it

#

Adobe was brilliant in this regard

weak meteor
#

Well

#

Ye i know plugin will be cracked

thin iris
#

Can falling blocks glow?

weak meteor
#

BUT STILL THE PROBLEM IS HOW DO I PROTECT MY AWS CREDENTIALS

wet breach
#

I already told you. You are going to need a service like restAPI

#

or one way hash the credentials

weak meteor
#

hmm

wet breach
#

but if its merely to pull a license, restAPI can do this easily

weak meteor
#

that should be in a server i bought right?

wet breach
#

RestAPI basically revolves around endpoints to provide information. the RestAPI Server is the one that does the actual work to get the info you requested

#

however you will need to have some small server to host the end points

weak meteor
#

cuz i was also thinking of doing that instead of using DynamoDB

weak meteor
#

but aws does give free servers for 1 year

wet breach
#

however there might be a better way

weak meteor
#

And well 1gb ram and 1 vcore should do for just some http get requests

wet breach
#

why not sign user certificates instead?

weak meteor
#

what u mean

wet breach
#

you can validate users to something via certs

quaint mantle
wet breach
#

the thing that wants to validate provides the cert and then you can check against your cert if its valid

#

still need a small server but this is less intensive and you only need a HTTP server for this

#

like a really small one

#

talking about only need a couple hundred of megabytes XD

#

and virtually no HDD space

#

except to hold the http server really

#

its basically impossible to fake a 502 cert

#

you would need to get a hold of the signing cert in order to fake one

remote swallow
quaint mantle
remote swallow
#

does it showa s 1 line in logs?

quaint mantle
#

1 sec let me fix it

weak meteor
remote swallow
wet breach
#

it won't stop the stealing, but this just helps you validate your users in a more efficient way

quaint mantle
#

yes

weak meteor
#

I still crack FL Studio 😻

wet breach
#

lol

remote swallow
quaint mantle
#

plugin.yml

remote swallow
#

?paste plugin.yml, ur main class and EventToggling if its not ur main class

undone axleBOT
quaint mantle
#

1 sec

short pilot
#

how do I add MongoDB to my project with gradle?

quaint mantle
remote swallow
quaint mantle
#

ok

slender elbow
remote swallow
#

why does everyone hate it

river oracle
slender elbow
#

it's literally hideous

worldly ingot
#

because it's weird!

river oracle
#

Jesus

remote swallow
#

it looks fine

#

smooth font cool

worldly ingot
slender elbow
#

monospace is also smooth

#

???

remote swallow
#

wait

#

i can read

#

i just love arial

slender elbow
#

💀

remote swallow
#

i love how i awoke everyone by screenshotting pastebin

quaint mantle
remote swallow
#

they appeared, said stuff, and left again

worldly ingot
#

Yeah because it was awful

remote swallow
#

what husky cani have

sterile token
#

What the hell

#

Invalidating cache momment just for checking IJ is not bugged haha

thin iris
#

is .forEach just for (Player p : Bukkit.getOnlinePlayers())

sterile token
#

getOnlinePlayers() returns a Collection<Player>, it doesnt return a list of locations

thin iris
#

oh

#

wtf

sterile token
#

If that what u meaning

thin iris
#

i typed in location

#

i’m too tired for this shit

sterile token
#

haha

#

me too

#

imagine im having a compilation error which isnt maked by IDE

#

hahah

#

Some time IJ doesnt make sense when giving errors

restive mango
#

Why does adding an item to an inventory that belongs to a chest blockstate and then updating the blockstate not add the item to the chest in the world?

#

How can I do something like that?

wet breach
#

?nocode

undone axleBOT
#

It’s hard to answer a programming question without code
Oh no! You ran into a problem. But no worries, people are willing to help, but first they need to see your code. This is because otherwise, they would be providing help based on guesses instead of concrete knowledge. Whether it be a compile error, runtime error, or an unexpected output, I'm sure that if you were to provide code, you'd receive a quick solution.

restive mango
#

i assume you're saying that, no, normally that does not happen?

wet breach
#

It depends how you are trying to do it

#

but we be guessing in what you are or not doing without something to look at

#

there is api methods to update the state of a block and methods to feed data to create said state

restive mango
#

BlockState preState = event.getBlockPlaced().getState();
Chest thisChest = (Chest) preState;
thisChest.getBlockInventory().addItem(item);
thisChest.update(true, false);

#

does not add the item, for example

sterile token
#

Does it?**

wet breach
#

well it says string can't be converted to a string array

sterile token
#

yeah that why doesnt make sense 🤔

fading gull
#

Ur saying it can?

sterile token
fading gull
#

String can be converted to string array?

sterile token
#

Im just said that the issue doesnt make sense, because im never converting string into String[]

#

Must be an IJ compilation failure i will update the maen-compile-artifact in case its bug or broken

#

Some times java has many weird issues that you can realize

thin iris
#

try use a String[] as the params

sterile token
thin iris
#

hmm

sterile token
#

Even Config#getStringList() returns a List instead of String[]

#

Vectors are not used now a days they used to be used

thin iris
#

for (Player p : Bukkit.getOnlinePlayers()) {
if (!p.hasPermission(permission)) return;
for (String str : text) {
p.sendMessage(text);
}
}

sterile token
#

yeah i know, but must work with what i sent

thin iris
#

?

sterile token
#

If it would work the IDE must be putting a red flag over the code even before compiling, just during coding process

fading gull
#

Uh which one is lime 46 and 51

wet breach
sterile token
wet breach
#

but your issues is how you are doing foreach, its best when having issues with lambda's to break them down to see what is really going on

sterile token
wet breach
#

this is the very problem I hate with lamdba's in where it hides details

sterile token
#

what do you mean by that?

slender elbow
#

goofy ahh maven compiler

sterile token
#

If the compile exception is what it must be - IDE should mark an issue even not compiling - isnt it?

slender elbow
#

that is valid java code, and javac builds it fine

#

this is peak maven

sterile token
#

yeah must be a maven compiler issue - there is no other logical explanation

fading gull
#

Pls send screenshot with line numbers

thin iris
#

Bukkit.getOnlinePlayers().stream().filter(p -> p.hasPermission(permission)).forEach(p -> Arrays.stream(text).forEach(p::sendMessage));

wet breach
#

its not a maven compiler issue

thin iris
#

try this

wet breach
#

and it seems slokx is on the right path here

sterile token
slender elbow
#

so there is something else maven is messing with here

thin iris
#

maybe it’s language level or sdk

sterile token
#

okay def was that. I updated to latest maven compiler and compile now

thin iris
#

which code

sterile token
#

💀

thin iris
#

mine or urs

slender elbow
#

😄

sterile token
#

Maven has extrange bugs haha

#

You should nevertruth of its issue

fading gull
#

Interesting, I'll keep that in mind

sterile token
#

But thanks to all for trying to help

wet breach
#

well it depends which java versions too, since sometimes implementation does change

sterile token
#

tried with 8 and 18, was the same issue

wet breach
#

that isn't what I meant

#

I meant maven compiler versions are sometimes specific to a java version or a range

sterile token
#

oh you mean the language level right?

sterile token
wet breach
#

also just fyi, you can with maven specify a specific compiler

#

you don't have to use the maven compiler

wet breach
#

either way now its fixed and you can proceed onwards 🙂

sterile token
#

yeah, thanks to all

warped shell
#

I created some Shapeless Recipes and registered them to the server, I also discovered them for all players, but while the recipes work when manually crafting them, they do not show up in the Crafting Menu unless I select all recipes. The recipe output is enchanted and the ingrediants have lore

wet breach
#

I would help but recipes is one of the few things I don't really mess with 😦

#

hopefully someone can help with your problem lol

quaint mantle
#

🤣

wet breach
#

got a lot of open space there

quaint mantle
#

ignore that file

remote swallow
#

Thats not pastebin

quaint mantle
#

oh

#

shi u right

#

Emberassing!

spare hazel
#

please

quaint mantle
weak meteor
undone axleBOT
weak meteor
#

Please use pastes

weak meteor
#

what u doin here

icy beacon
#

Should be fixed after a fresh recompile

quaint mantle
quaint mantle
weak meteor
#

Talked to u few times

shut shoal
#

I uploaded a premium resource the last 6 of october and it wasn't aproved yet

#

😦

upper hazel
#

Is it better to save block data in text format or in key format. Which object is best suited for the player to save the placed block?

#

in file

hybrid turret
#

Can I somehow set the permission-message in my onEnable for each command instead of having to run getCommand() every single time?

upper hazel
#

what?

lost matrix
# hybrid turret Can I somehow set the permission-message in my onEnable for each command instead...
    PluginDescriptionFile descriptionFile = getDescription();
    for(String commandName : descriptionFile.getCommands().keySet()) {
      getCommand(commandName).setPermissionMessage("Some message");
    }

But in your onEnable you need to use getCommand(...) for every command anyways because you need
to reguister an executor for them... So whats the point?

    String permMessage = "You are a bob and cant use this";
    
    PluginCommand someCommand = getCommand("some");
    someCommand.setExecutor(new SomeExecutor());
    someCommand.setPermissionMessage(permMessage);

    PluginCommand someOtherCommand = getCommand("someother");
    someOtherCommand.setExecutor(new SomeOtherExecutor());
    someOtherCommand.setPermissionMessage(permMessage);
upper hazel
lost matrix
upper hazel
#

what better use blockData?

#

or blockState

lost matrix
#

You cant serialize a BlockState

upper hazel
#

oh

lost matrix
#

I mean you can, but its a hustle. And you need the BlockData anyways.

upper hazel
#

what will be if i will use 1 data file for save for all blocks placed by all players

#

or better use several files?

smoky oak
#

u can def use 1 file, depends what you need that data for

lost matrix
smoky oak
#

again, depends what you need it for. There's a plugin that tracks what players do, so that's stored in one large database. but if you just want to know which blocks have been generated naturally and which havent, you can just use the chunk PDC to store a bunch of booleans (though I'd recommend bit packing here)

drowsy cosmos
#

I used setTarget on a skeleton to target a ravager when i hit the ravager. But the skeleton still aims for player. Is there something else to add?

hybrid turret
#

ykw, before i refactor my shit, can I use colors in these?

lost matrix
rigid otter
#

In the BlockGrowEvent, what is the difference between event.getBlock() and event.getNewState()? Does the event.getBlock() sticks in the old state?

rotund ravine
#

What does the javadoc say?

rigid otter
#

Javadoc is unclear

rotund ravine
#

What does it say?

rigid otter
#
Gets the state of the block where it will form or spread to.
getNewState()
rotund ravine
#

And the other?

rigid otter
#
Gets the block involved in this event.
getBlock()
lost matrix
#

getBlock() is the origin of the event and getNewState() is the target state (which involves the position).
I assume getBlock() will return the origin Block which is still in the original state.

upper hazel
#

BlockData not serizible what i shold to do

#

use components?

lost matrix
upper hazel
#

BlockData not serizible

#

not impl serizible intarface

#

oh

#

so stream classes not need??

#

bukkitStream

#

ByteStream

#

etc

#

oh

#

lol

mortal hare
#

Is there any way to have a view of list on top of collection (not a copy), i dont care about ordering at all, i just want to forcefully put collection where list is expected (it wouldnt break the implementation, its just an artificial constraint to put list there, because it copies to its internal list afterwards you put it anyways)

lost matrix
lost matrix
mortal hare
#

bukkit command api .setAliases() expects a list, but it doesnt make any sense, since the aliases aren't ordered in any way

#

my wrapper returns Collection<String> for aliases instead of List<String>

#

so i cant plug it into command.setAliases()

lost matrix
#

Either make your api return a list or use a quick wrap using List.copyOf(yourCollection)

fallen grove
#

are the people that approve plugin resources in this discord? i need to tell them they did a bad job in one of my last attempts to be approved after one week!

mortal hare
#

i can just do new ArrayList<>(collection) but in that case i would create a copy, that would be fine, but internally .setAliases() copy the elements in the same fashion

#

so im cloning the collection twice

#

which isnt really great tbh

lost matrix
#

Its not like you create aliases every tick. Its just called once and then its done. 50 micros more or less doesnt matter.

#

But i see how it is a bit annoying

mortal hare
#

i give up, i will change my return type according to the bukkit api constraints :/

#

neither java collections, neither fastutil have an adapter of list interface for collection

lost matrix
mortal hare
#

its possible it would just break the rule of the list that every element's order is deterministic

lost matrix
#

Then write a quick wrapper

#

10min max

upper hazel
#

what going on

mortal hare
#

?paste

undone axleBOT
lost matrix
mortal hare
#

ik but this is only going to be used as a collection

#

just as another type

lost matrix
#

myeah ok

hybrid turret
#

(oops, sorry for pinging)

rapid vigil
#

What is better using == for checking enum value or .equals?

hybrid turret
#

Google says == is best practice

shadow night
#

iirc == compares instances, .equals(...) compares object values, not sure how that helps but ¯_(ツ)_/¯

rapid vigil
#

and what is the difference between them

lost matrix
rapid vigil
#

ok thanks

shadow night
lost matrix
# rapid vigil and what is the difference between them

== checks if the objects have exactly the same memory address (meaning they are exactly the same object)
.equals() checks if two objects "look" equal in terms of their internal structure, even when they are not
exactly the same object.

bronze crystal
#

just dont use == for non primitive data values

hybrid turret
#

What about checking if objects are null?

bronze crystal
#

== null?

hybrid turret
#

Yeah

bronze crystal
#

oh ok yeah in this case yes

#

but i mean comparing

hybrid turret
#

But i also heard about Objects.equals(obj, null)

bronze crystal
#

yeah I also heard about that but actually never use this

eternal oxide
bronze crystal
#

yea

#

h

hybrid turret
#

Perfect. This just made my code a whole lot cleaner lmao

orchid gazelle
#

permissionMessage does not work for me smh

hybrid turret
#

wym?

#

Mhh you can‘t get the commandLabel somehow in the plugin.yml, right?

mortal hare
hybrid turret
#

Oh so just use obj == null i‘m guessing?

mortal hare
#

if you dont have another reference, just use the way you wrote it rn

clear elm
#

how can i make that crystals make normal damadge like in cpvp?

lost matrix
clear elm
#

do you now cpvp?

#

if i crystall on my server crystal make much less damage

hybrid turret
lost matrix
clear elm
#

okay

ivory sleet
#

obj == null implies Objects.equals(obj, null)

shadow night
#

When you compare something to null it's basically checking if that object is defined, exists or whatever

sick edge
#

Hi, how would I get an advancement out of the PacketType.Play.Server.ADVANCEMENTS in Protocol Lib? Can I get it as a json or smth like that?

shadow night
modern ridge
#

Hi, can i ask ?

lost matrix
#

?ask

undone axleBOT
#

If you have a question, please just ask it. Don't look for staff or topic experts. Don't ask to ask or ask if people are awake or available. Just ask the question to the channel straight out, and wait patiently for a reply. Make sure you use the right channel regarding the topic of your question. Create a thread in case the channel is already in use!

modern ridge
#

how do i fix mysql problem like ‘The last packet successfully received from the server was 55,058,023 milliseconds ago’

#

im using HikariCP

#

on my spigot plugin

valid burrow
#

the connection died

modern ridge
#

yep i know

#

when i idle the plugin

#

so it cause this error

valid burrow
#

every time you send new package check if connection is up if not make a new one

#

thats the simplest way

lost matrix
#

Make sure to use your connections for only one execution and then close them again.
Always get a new one.

modern ridge
young knoll
#

With Hikaricp you should close the connection after you use it

lost matrix
#

Thats what HikariCP is for

valid burrow
#

yh sorry i overread the hikari part

granite owl
#

is the minecraft server inheritly single or multithreaded?

#

if we dont consider BukkitRunnables etc

subtle folio
#

there is a main thread

#

that all block related activities happen on

gleaming grove
#

BukkitRunnables are tasks executed in the main thread

granite owl
#

so theres only 1 main thread and one for networking and one for chat?

young knoll
#

No

young knoll
#

There’s a main thread, a chat thread, several networking threads, several worker threads, several craftbukkit worker threads, and a watchdog thread

ivory sleet
#

bukkitrunnables are executed on server thread if you don't use the asynchronous variants where they would be executed in a cached thread pool instead

#

all bukkitrunnables are however ticked on the server thread

young knoll
#

^

granite owl
#

isee

#

🙏

ivory sleet
#

what coll said also, (might b noteworthy to mention that the actual logic processing usually happens on the main/server thread, that is all the ticking, most physics etc)

young knoll
#

Yes

#

The worker threads are pretty much only used in worldgen

#

Chat thread is for chat
The networking threads are for packet sending and receiving
And the watchdog thread makes sure the server is still responding

ivory sleet
#

yeah, I mean it makes sense, its hard to split up the actual logic to different threads (altho folia does it, it def comes at a cost)

modern ridge
#

or update mysql data

#

like that

young knoll
#

Yes

#

Use a try with resources to handle the connection

modern ridge
#

okay

#

im new to HikariCP

#

its different but managed well

#

so i choose it

lost matrix
#

For loading player data, use the AsyncPlayerPreLoginEvent and for saving use the PlayerQuitEvent but start
a new thread or use an async bukkit task.

modern ridge
#

okay thanks

scenic onyx
#

how i can resolve it?

sick edge
ivory sleet
mortal hare
#

Do you guys prefer ORM's like JPA/jakarta (hibernate for example) for database management, or do you handle JDBC operations manually with DAO's?

ivory sleet
#

esp if u solo a project

#

it can be nice for group projects

mortal hare
#

i 100% agree

#

i've used hibernate with spring before, hell it is bad when you want to optimize something

#

for me personally no matter how i setup my annotations to do lazy loading, it will always send inefficient queries

#

like instead of returning a all columns in one query

#

it will spam query requests for each column

#

its pain in the ass

ivory sleet
#

yeah

mortal hare
#

sometimes

ivory sleet
#

and if you wanna optimize it accordingly to your needs you'd need to invest time in understanding the implementation of said orm

#

which I mean, thats just a lot of work

#

now still, that might be better than to have 10 different devs with 10 different opinions on how the data modelling should be structured

young knoll
#

And then spigot 1.20.2 breaks your hibernate

#

Sadge

ivory sleet
#

lol

bronze crystal
#

so this is my package structure for the project, would this be the right shadedPattern value? trying to set up bstats ```
<relocation>
<pattern>org.bstats</pattern>
<shadedPattern>at.evipez.craftingtableplus</shadedPattern>
</relocation>

scenic onyx
ivory sleet
#

to avoid conflicts

bronze crystal
#

but I don't have a package named shaded.bstats

#

and if so, what would I put into it

ivory sleet
ivory sleet
#

dw

bronze crystal
#

so I just create the package shaded.bstats and use <shadedPattern>at.evipez.craftingtableplus.shaded.bstats</shadedPattern>?

ivory sleet
#

dont create no package

young knoll
#

You don’t even need to create it

ivory sleet
#

maven will do that for u

bronze crystal
#

ah ok

#

ty

scenic onyx
ivory sleet
#

idk what exactly u're doing

#

but based on the previous error UserConnectEvent is happening on AsyncPlayerPreLoginEvent

subtle folio
#

you cant call getPlayer nope, i cant??

ivory sleet
#

which means, there is no player object present

quaint mantle
#

People before docs were invented

ivory sleet
#

there is no player to begin with

young knoll
#

java.lang.IllegalArgumentException: name cannot be null
at com.google.common.base.Preconditions.checkArgument(Preconditions.java:145) ~[guava-31.1-jre.jar:?]
at org.bukkit.craftbukkit.v1_20_R1.CraftServer.getPlayer(CraftServer.java:575) ~[spigot-1.20.1-R0.1-SNAPSHOT.jar:3864-Spigot-d2eba2c-00f5a80]
at org.bukkit.Bukkit.getPlayer(Bukkit.java:611) ~[spigot-api-1.20.1-R0.1-SNAPSHOT.jar:?]
at dev.scienziato1pazzo.it.infiniteanticheat.player.IACPlayer.<init>(IACPlayer.java:32) ~[?:?]
at dev.scienziato1pazzo.it.infiniteanticheat.player.events.PlayerJoinEvent.onUserConnect(PlayerJoinEvent.java:23) ~[?:?]

ivory sleet
#

not in that event

young knoll
#

You are trying to call Bukkit.getPlayer with a null name

ivory sleet
#

oh nvm

bronze crystal
scenic onyx
ivory sleet
ivory sleet
#

you'd need to have some sort of injective Map<Player/UUID,User>

scenic onyx
ivory sleet
#

its your code right?

scenic onyx
ivory sleet
#

how is it not ur code when

        at dev.scienziato1pazzo.it.infiniteanticheat.player.IACPlayer.<init>(IACPlayer.java:32) ~[?:?]
        at dev.scienziato1pazzo.it.infiniteanticheat.player.events.PlayerJoinEvent.onUserConnect(PlayerJoinEvent.java:23) ~[?:?]
scenic onyx
ivory sleet
#

You want to get an IACPlayer by a User?

scenic onyx
#

i have find it

#

it go?

ivory sleet
#

idk, I think this is a question you should ask in the packetevents discord to begin with

brazen hollow
#

Logging

bronze crystal
hybrid turret
#

Is there a way of displaying a different string when doing return false in a command and when executing /help <command>?

#

If not, I fucked up

#

Lmao

bronze crystal
#

i think you are fucked up

hybrid turret
#

For the usage

#

Oh no

bronze crystal
#

let me do some research

hybrid turret
#

Would be lovely

remote swallow
#

change the usage message in plugin.yml or send your own usage message and return true

hybrid turret
#

Yeah i‘ve had that with my own usage message and returning true + providing a usage in the plugin.yml to display it in the /help menu

#

Now i changed it by setting the usage onEnable for each command as usage and returning false

#

Wanted to clean up code

#

Then I just executed /help <command> and saw the message instead of the usage :(

ivory sleet
#

I think the most common approach is to just yield true and dump messages to the sender inside onCommand

hybrid turret
#

F*ck

#

All that refactoring here and there took me like 4 hours maybe more. All down the drain now :|

ivory sleet
#

once upon a long time far far away in another galaxy, bukkit created a command api amongst the many living dinosaurs that once roamed the earth, it was at this moment that the initial command api contructed didnt take many aspects into consideration and so we got a simple quadpredicate, but I mean, the dinosaurs didnt really have any needs for complex command building etc like today's brigadier etc

hybrid turret
#

Tbh what bukkit COULD implement is:

command.getUsage(String prefix) (as extra method overloading the original)

Which just returns prefix + usageMessage

#

The one without prefix is called on /help

ivory sleet
#

bukkit could do many things

hybrid turret
#

The one with is called upon onCommand returning false

#

That would be like 5 minutes max

#

Is there a way to submit tickets? Lmao

ivory sleet
#

I mean thats 5 min max for u as well

river oracle
#

PR it then

ivory sleet
#

prefix + command.getUsage()

#

for u

#

lol

#

they typically dont want these kinds of utility functions anyway

hybrid turret
opal carbon
#

CLA is rather annoying though

hybrid turret
#

CLA?

opal carbon
#

for PRing

river oracle
#

Not really only md5 sees it

opal carbon
#

but still would rather not

river oracle
#

Unless you're worried md5 is some stalker (he is)

opal carbon
#

like i understand why

#

just unfortunate

hybrid turret
#

What‘s CLA?

river oracle
#

?cla

undone axleBOT
hybrid turret
#

Ohh

hybrid turret
ivory sleet
#

i havent touched the command api for too long, but i used to just do sth like

@FunctionalInterface interface VoidCommandExecutor extends CommandExecutor {
  void executeCommand(CommandSender sender, Command command, String label, String[] arguments);

  @Override default boolean onCommand(CommandSender sender, Command command, String label, String[] arguments){
    this.executeCommand(sender,command,label,arguments);
    return true;
  }

  public static VoidCommandExecutor of(CommandExecutor executor) {
    return executor instanceof VoidCommandExecutor voidExecutor ? voidExecutor : executor::onCommand;
  }
}```
worldly ingot
#

I'm sorry you put your annotations on the same line as your modifiers?

#

We can't be friends

remote swallow
#

i had to make intellij stop doing that

ivory sleet
#

lmao, that's... the way it should be! :)

orchid trout
#

is this a weird eclipse thing or is my crappy external drive failing

remote swallow
hybrid turret
smoky anchor
#

\j

hybrid turret
#

Omg how could he have known??

#

Yeah same, i think it‘s just to be ignored. If there‘s a fix to those warnings tho, please ping me lol

mortal hare
#

why tf does intellij cream about using normal comparison operator

#

when im implementing equals

#

btw is there any java way to create a case insensitive string

young knoll
#

Case insensitive how

mortal hare
#

sorry

#

case insensitive string set*

young knoll
#

You could just lowercase everything passed to it

mortal hare
#

currently im using fast util's custom set

young knoll
#

Or make use of equalsIgnoreCase

mortal hare
#

before adding to set

young knoll
#

?

mortal hare
#

i need to add the collection

#

not one instance

#

basically addAll(Collection<String>)

young knoll
#

Ah

#

Yes you’d have to loop each and lowercase it

mortal hare
#

that allows me to supply custom hashing strategies

#

like i've shown in the screenshot

terse pumice
#

How would I go about getting the max damage of an item?

#

Or alternatively is there a better way to go about dealing damage to an item than damageable.setDamage(damageable.getDamage() + 1);

young knoll
#

Material has a max damage method

terse pumice
#

Gotcha, thanks

#

Any ideas what event is ran when a player attempts to place bonemeal?

young knoll
#

Interact

terse pumice
#

Hmm thought so

weak meteor
#

for a restAPI

#

should i use

#

NodeJS?

eternal night
#

I mean, what rest api

#

depends a lot on the usecase

#

but also, what language you are comfortable in

desert tinsel
#

How to copy a world and create another one? I tried something like this but idk if it worked, pls tell me if im wrong:

        WorldCreator worldCreator = new WorldCreator(nameOfTheNewWorld);

        worldCreator.copy(arena.getWorld());
        this.world = plugin.getServer().createWorld(worldCreator);```
#

the thing is that the original one is a flat world, but the generated one is a normal world

#

this saved me

void createNewWorld(World world){
     File worldDir = world.getWorldFolder();
     String newName = world.getName() + "_temp";
     FileUtils.copyDirectory(worldDir, new File(worldDir.getParent(), newName));

     WorldCreator creator = newWorldCrator(newName);
     World newWorld = Bukkit.createWorld(creator);
}
quaint mantle
#

For world generation

desert tinsel
#

I need the same world

#

copied

eternal valve
#

I added custommodeldata to the custom block in my source package, how can I turn off particle effects by specifying this??

#

with data packs or in model.json

sick edge
#

Hi, Should i use protocolLib with spigot api or nms?

weak meteor
#

smth like that

#

and well

#

i was reading from IBM

#

and it doesnt need a specific language, just a standard to do it

#

and i was thinking NodeJS to learn smth new

#

shouldnt be that difficult

eternal night
#

I mean yea

#

if you are gonna setup a separate service that your plugin runs https calls again

#

nodejs surely works

quaint mantle
#

Nodejs is legacy 😀😀

eternal night
#

average bun enjoyer

weak meteor
#

DAMN

#

I COULD TRY BUN

#

its relatively new, right?

eternal night
#

its just a plain http server ¯_(ツ)_/¯

weak meteor
#

google bard told me to do it with C lang

eternal night
#

I would not recommend C for a webserver KEKW

weak meteor
#

lemme see bun

eternal night
#

I mean, you can also do kotlin if you want

#

java also has some great HTTP frameworks (quarkus, spring, etc)

quaint mantle
#

Just not worth it

eternal night
#

ktor for kotlin does its job

weak meteor
#

i could do it with anything im some way

eternal night
#

Yea

weak meteor
#

but i wanna learn something new

eternal night
#

Welp, pick whatever language you are most interested in learning then

weak meteor
#

sure im doing 48k requests per second

weak meteor
quaint mantle
#

Lua

eternal night
weak meteor
#

lua is shit

ivory sleet
#

rust or go maybe

quaint mantle
#

I use lua as embedding

weak meteor
ivory sleet
#

yeah, or maybe haskell :D

weak meteor
#

that shi fast asf

ivory sleet
#

mye

weak meteor
#

nah im doing it with CoffeeScript

ivory sleet
#

goofy

eternal night
#

rust KEKW

slender elbow
#

shut up

eternal night
#

imma throw some rewritten core utils at you emily

weak meteor
#

bun is only for Linux

#

im not installing WSL only for bun

slender elbow
#

i'm rewriting coreutils in clojure

eternal night
#

Rewrite them in java

#

be progressive

slender elbow
#

jython

quaint mantle
#

Thats worse

weak meteor
#

wtf is jython

quaint mantle
#

Java and python

#

Mixed

young knoll
#

Python 2.old*

quaint mantle
#

💀💀

weak meteor
#

gotta make my plugins in Jython then

young knoll
weak meteor
#

HELL NAH

#

WHY PEOPLE WANNA USE PYTHON

pseudo hazel
#

cuz its easier

weak meteor
#

blud wanna make a server in the server

pseudo hazel
#

and people dont wanna learn new things

weak meteor
#

☠️

weak meteor
#

or its doesnt?

young knoll
#

Python scripting sounds way better than skript

weak meteor
#

people doesnt like change or people dont like change

mortal hare
#

ok, bukkit command api is weird, i've managed to register command which is not in lowercase, tabcompletion detect it as normal, but handler just gives up 😄 im not sure if that's brigadier or bukkit command api which doesnt like this

pseudo hazel
#

its dont

mortal hare
#

it shows as unknown command, but tabcompletion works

weak meteor
pseudo hazel
#

people is plural

weak meteor
#

how tf ur command is in Uppercase

mortal hare
#

reflection hacking

eternal night
#

worth it

mortal hare
#

i wanted to make case sensitive completions, but i guess bukkit doesnt like it

#

it works with arguments, but not with commands themselves

pseudo hazel
#

sounds very cursed

mortal hare
#

it is

#

i've spent like 3-4 hours

#

trying to setup this mess

#

only to be slashed by the buggy bukkit impl :/

pseudo hazel
#

but why do it in teh first place?

#

bored?

#

or is it a client request

mortal hare
#

Because

#

because

#

idk

pseudo hazel
#

so bored then

mortal hare
#

hmm

#

nvm

mint nova
#

Hello, what implements i need to put in my class to get the command with tab-complete method ?

ivory sleet
# mortal hare hmm

I mean it would be a lot of combinations/permutations that’d show up in chat no?

mortal hare
mint nova
pseudo hazel
#

use TabExecutor

#

its just both interfaces in one

mint nova
#

thanks a lot guys

mortal hare
#

i think i found a bug that you can even guys replicate even if you dont have reflections to have the UPPERCASE completion for commands

#

according to what i see, aliases are not checked for case sensitivity

#

so they might invoke the same behaviour that i've sent earlier

#

for some reason only command.getName() gets turned to lowercase, but not its aliases, they're straight pumped into command map

#

and that's probably why it bugs out, since handler probably expects all commands to be lowercase, and doesnt check the command itself using equalsIgnoreCase(), but with equals(), thus "Unknown Command" pops up

#

wait, i've managed it to make it work

#

wtf

river oracle
#

can't wait for Banip2, bANIP2, baNIP2, banIP2, baniP2, banip2...

#

case insensitive commands

mortal hare
#

nah i just want to have completions the same way i've provided

#

without lowercasing it

#

but execution be lowercase

#

ikr

#

i've constructed my command framework around the lambdas

#

they're pretty useful

mortal hare
# mortal hare

it works, but with one exception, if the PluginCommand's name is lowercase, if not it just rejects the command once again

hybrid turret
#

Can I change what items a block drops?

mortal hare
#

int a = 1_000

remote swallow
#

isnt it unnamed vars

mortal hare
#

its used as a delimiter between numbers

sterile token
#

I need some sort of help with my command api help part. Because im complicated about recursivity which i need to use caused because a command executor can contain more commands or execturos associated to it, like an infinity chain. By my goal is the enxt:

  1. If you run the root command with none arguments (for example /faction), will give you the all the arguments and sub commands associated to it.

  2. If you run any sub command associated to faction, with none arguments will give you the sub command help.

Im just struggling too much and having an innecesary nightmare

mortal hare
#

int a = 1_000_000
you can have number separator like this and it will compile

#

kinda useless java syntax feature

quaint mantle
#

Yes

mortal hare
#

and i dont know why it exists

smoky oak
#

for(String key : section.getKeys(false)){
returns a size-0 keyset for this section from the config after calling config.getSection("limit"). Why?

#

the section clearly exists or it would be null

remote swallow
#

does it exist on the server

sterile token
#

I dont think thats a section

remote swallow
#

it is a section

sterile token
#

sections looks like:

Section:
key: value
key: value

remote swallow
#

there isnt a minimum required

smoky oak
# remote swallow does it exist on the server

no, because I'm not saving it so i dont have to go in there and delete the config every time i make changes to the section. I'm reading it like this

private FileConfiguration config;

    public ConfigHandler(JavaPlugin plugin){
        config = plugin.getConfig();
    }
remote swallow
#

check the file on the server anyway

#

it should be that

smoky oak
#

nope no folder

#

debugger:

#

?

#

that 'false' is for deep keys innit

young knoll
#

yes

remote swallow
#

sout plugin.getConfig().getValues()

smoky oak
#

is that kotlin?

#

i cant write that in either the debug console nor code

remote swallow
#

no i said sout as short hand

smoky oak
#

but why does the section exist then?

sterile token
#

What you provide in ur template code is not a Map

pseudo hazel
#

what template code

remote swallow
#

if gonna say you call section#set then dont save so the value exists in memory but not on the server

smoky oak
#

wait i had the wrong print i think

#

what's the format i have to put there?

remote swallow
#

use System.out.println()

#

not printf

smoky oak
#

ah

#

thats what i did, resulted in {}

remote swallow
#

tf

#

sout just writes the sysout code for me

smoky oak
#

bleh where's my config gone to bruh

remote swallow
#

john spigot

smoky oak
#

the deep key list is ALSO empty

#

wth

remote swallow
#

delete the config file and restart

smoky oak
#

theres no saved config file

pseudo hazel
#

or, hardcode the config

remote swallow
pseudo hazel
#

and then see if it there

smoky oak
#

?

#

wait

remote swallow
#

plugin.getConfig returns the file

#

in the server plugin folder

young knoll
#

Well, the contents of the file

remote swallow
#

not code resource folder

smoky oak
#

pretty sure i can read that out directly

#

i did that before

remote swallow
#

if you wanna have the config come from resources you need to call getResource and give the input stream to file config or yaml config

smoky oak
#

but thats what the issue here was

pseudo hazel
#

or just save the config

smoky oak
#

no i want to remember how to read from config

#

ill save it but i want to know this

pseudo hazel
#

then hardcode a config

#

and try to read from it

remote swallow
#

you call JavaPlugin#getResource and use the input stream

smoky oak
#

FileConfig is abstract and YAML config doesnt take an arg lol

remote swallow
#

YamlConfiguration config = YamlConfiguration.loadConfiguration(new InputStreamReader(plugin.getResource("config.yml"))

smoky oak
#

ah

#

always forget static is a thing

remote swallow
#

kek

smoky oak
#

different topic

#

what's the debug mod called

#

the thing that makes your client not disconnect if u debug

remote swallow
#

theres some things you dont disconnect for, the reason you may disconnect is watchdog

#

idk if any mods exist to make you not disconnect

#

@eternal night does kenny have one, would be something kenny made

eternal night
#

I mean, just disable watchdog and send keepalive yourself

#

I have a snippet on gist somewhere

remote swallow
#

how do you expect to send a keep alive while the server is paused