#help-development

1 messages · Page 106 of 1

reef lagoon
#

Okay nevermind just needed to add .getTopInventory

timid jetty
#

Does anyone know if you can somehow bypass certain modifiers in EntityDamageByEntityEvent (ie. Ignore armor when damaging?)

sharp flare
#

Maven or gradle?

ornate mantle
#

maven

#

all my homies hate gradle

warm light
#

how can I make it like custom echest will not be counted here?
like crates

#

if someone uses echest as their crate. and any player clicked on that, this code will not work on that. like this

drowsy helm
#

you have to have a more complex system to determine whether it is custom or not

lilac dagger
#

what name would fit a class that holds wins/loses/playtime etc?

chrome beacon
#

PlayerStatistics

serene egret
#

i have a question , i want to have a CustomHead in Minecraft so i edited the meta of the skull but when i join my Server the Head is still a Skull:

           SkullMeta meta = (SkullMeta) stack.getItemMeta();
           ArrayList<String> lore = new ArrayList<String>();
           lore.add("c7e2aa79fc62fa4f5a8919f3dd0f12ab35e2d30f8e234bfea896c4ef31eee3db");
           meta.setLore(lore);
           stack.setItemMeta(meta);```
#

whats the mistake?

charred blaze
#

i wonder why skinsrestorer needs setOp method...

#

weird

#

??

#

can someone explain?

chrome beacon
#

A comment in their source code says "workaround..."

#

Honestly just don't use SkinRestorer

#

Online mode is all you need

charred blaze
chrome beacon
#

That's their comment

chrome beacon
charred blaze
chrome beacon
serene egret
drowsy helm
#

And what is that string from it doesnt look like a texture string

serene egret
#

and what Material

#

playerhead?

chrome beacon
#

Yes

serene egret
#

ok

drowsy helm
#

Yep

serene egret
# chrome beacon Yes
            SkullMeta meta = (SkullMeta) stack.getItemMeta();
            meta.setOwner("3297b7ac-0f7b-45bc-ae4b-2dfa8bce7570");
            stack.setItemMeta(meta);```
it doesnt go anyways
#

i made the material to PlayerHead and set the meta Owner to the texture

#

but in game its still a steve head

chrome beacon
#

The method you're using right now is deprecated and takes the username rather than UUID

serene egret
#

ok

drowsy helm
#

Uuid should never be passed as string

sacred mountain
#

rate my debugging skills

#

B)

kindred valley
#

Omg

#

What did i just post3d

sacred mountain
#

bro what is that

kindred valley
#

Man i accidentally posted p**nhub link

sacred mountain
#

💀

drowsy helm
#

None of thise would work

kindred valley
sacred mountain
#

who else

kindred valley
eternal night
#

I love myself a 2 slot inventory

kindred valley
drowsy helm
#

Wtf bro

drowsy helm
#

Thats a joke right

kindred valley
tender shard
#

send the full class

#

because I still don't see you declaring "inventory" anywhere there

#

only "inv1" and "inv2" etc

#

and obviously the whole code is cursed

#

you can only create inventories with a multiple of 9

sacred mountain
#

mfalmo

#

godmgna myseppleing

#

wtf

kindred valley
sacred mountain
#

mfankelx

kindred valley
tender shard
#

the stacktrace you sent said that the variable "inventory" is null

#

weird that I remember it because I was heavily drunk

#

it didn't say "inv1 or inv2 is null"

#

it said "inventory is null"

sacred mountain
#

if you hit a player when enderpearling at them do they take damage

tender shard
#

wdym with "when enderpearling at them"?

sacred mountain
#

literally what i mean

kindred valley
#

Enderpearling

sacred mountain
#

if u throw a pearl at someone

tender shard
#

the enderpearl ONLY does stuff the moment it hits the ground

sacred mountain
#

do they take damage or nah

tender shard
#

oh you mean whether the actual ender pearl hit does damage?

kindred valley
#

Let me open the ide

tight tundra
#

One message removed from a suspended account.

tender shard
#

i don't think that the ender pearl hit does damage, mr. light furry but you'll have to try and see

sacred mountain
#

bitch

sacred mountain
#

i dislike static instances to access

tender shard
#

many people dislike it

kindred valley
sacred mountain
#

no

tender shard
#

that's why I explained both approaches in the blog post

kindred valley
#

Why do you hate man very pwerful keyword

sacred mountain
#

static abuse

#

u should see my old plugins

#

😭

kindred valley
#

?paste

undone axleBOT
sacred mountain
#

what

tender shard
#

having a static instance getter is no static abuse

sacred mountain
drowsy helm
#

It’s not a joke

drowsy helm
#

Reduce your boilerplate man

kindred valley
grim ice
#

Pazar

sacred mountain
#

NINENTH???

kindred valley
#

i am trying to obtain something

grim ice
#

thats a funny name ngl

kindred valley
#

shut up

drowsy helm
#

You’re abusing static

kindred valley
drowsy helm
#

A lot

kindred valley
drowsy helm
#

I cant tell if this is a joke

grim ice
#

its not

sacred mountain
#

neither

grim ice
#

there are so many wrong things wit hthat code

kindred valley
drowsy helm
#

Boiler plate, static abuse

grim ice
#
  1. static abuse
  2. getters for every numbered field
  3. misuse of if and else statements
kindred valley
grim ice
#

lmao

#

this is the meme of the day

drowsy helm
#

It is big abuse

kindred valley
#

So why it throws error

timid jetty
#

Anyone know if you can somehow bypass certain modifiers in EntityDamageByEntityEvent (ie. Ignore armor when damaging?)

plz tell me if i just gotta write my own event to manage that

drowsy helm
#

Judging by how you code, you’re new to java. Try and avoid using static

#

Especially if you dont know why it’s bad to abuse it

grim ice
#

you're new to java

kindred valley
#

😡

grim ice
#

you didnt study for 1.5 years, thats impossible

kindred valley
grim ice
#

unless u studied at some type of indian school that teaches u how to open ur computer

kindred valley
#

Look at my old messages. Joining time of this spigot, i prolly started java 2 months before i joined this dc.

grim ice
#

eitherway

#

learn java, you're new to it

kindred valley
#

Man

#

I'm not

#

I am not doing essentials or world edit

#

just a fucking simple plugin

grim ice
#

cool, then you should know why your code is full of beginner mistakes

kindred valley
#

Are you going to obtain error or judge?

#

I am just here to help not judging

drowsy helm
#

What is the error anyway

grim ice
#

im just helping u actually

kindred valley
#

No ur judging

grim ice
#

u gotta lower ur ego a bit if u wanna learn

#

and plus ur gonna run into many other errors later on if u dont learn java

#

better to learn it now

kindred valley
#

I am just unexperienced

grim ice
drowsy helm
#

One of your inventories is null

grim ice
#

that error is completely self explanatory and u would know what it does with 0 knowledge of spigot

#

meaning you're lacking java

kindred valley
# drowsy helm One of your inventories is null

I am instancing all of them

 public Pazar(int number) {
        if(number == 1) {
            inv1 = Bukkit.createInventory(null, 2, "FİRST");
        }else if(number == 2) {
            inv2 = Bukkit.createInventory(null, 2, "SECOND");
        }else if(number == 3) {
             inv3 = Bukkit.createInventory(null, 11, "THIRD");
        }else if(number == 4) {
             inv4 = Bukkit.createInventory(null, 2, "FOURTH");
        }else if(number == 5) {
             inv5 = Bukkit.createInventory(null, 16, "FIFTH");
        }else if(number == 6) {
             inv6 = Bukkit.createInventory(null, 3, "SIXTH");
        }else if(number == 7) {
             inv7 = Bukkit.createInventory(null, 8, "SEVENTH");
        }else if(number == 8) {
             inv8 = Bukkit.createInventory(null, 8, "EIGHTH");
        }else if(number == 9) {
             inv9 = Bukkit.createInventory(null, 8, "NINENTH");
        }
    }```
kindred valley
grim ice
#

show ur Click.java

drowsy helm
#

Whats like 26

#

Of click

#

Line*

grim ice
#

which is a very weird naming for a class

kindred valley
kindred valley
grim ice
#

Pazar.inv1 is null

kindred valley
#

ah

#

is it about static?

#

what if i take it with getters

drowsy helm
#

Probs

grim ice
#

no

drowsy helm
#

That woukdnt make a diff

grim ice
#

you just didnt initialize inv1

drowsy helm
#

You could rewrite this in like 10 lines of code dude

old cloud
#

Using a constructor to initialize static fields. nice

timid jetty
grim ice
kindred valley
#

Pazar pazar1 = new Pazar(1); So this is initialization

timid jetty
#

ok

grim ice
#

he wants to do things his own way, without knowing java

kindred valley
#

if(number == 1) { inv1 = Bukkit.createInventory(null, 2, "FİRST"); }

drowsy helm
#

You cant create an inventory with 2 slots

kindred valley
#

yes ik

#

my bad

old cloud
#

is this bait

grim ice
#

no

#

he's serious

#

lmao

drowsy helm
#

We all thought so

old cloud
#

bruh

grim ice
#

he always comes and asks very beginner questions

timid jetty
#

questions don't get answered because bait 😭

kindred valley
#

2Hex stop judging me

grim ice
#

but refuses to learn java

#

im not judging you

#

this is valid criticism

kindred valley
#

Do not manipulate 😡

ivory sleet
#

Guys just stop

kindred valley
tender shard
#

I guess so

iron glade
timid jetty
#

Okay, DamageModifier API is deprecated, I need to be able to alter modifiers. Am I forced to write my own damageEvent API or is there some way to bypass this that anyone knows

tardy delta
#

i just join this channel and wtf

shadow zinc
#

hey is there any better way to use plugin messages to get the playercount without having to do wacky stuff and violate numerous OOP principles?

iron glade
#

wdym plugin messages to get the player count?

reef lagoon
#

,logger?

ivory sleet
shadow zinc
old cloud
#

just use the tag PlayerCount

icy beacon
#

why am I getting this?

java.lang.NullPointerException: Cannot invoke "org.bukkit.configuration.file.FileConfiguration.options()" because "this.config" is null
        at com.roughlyunderscore.politfrontreports.PolitFrontReports.onEnable(PolitFrontReports.java:66) ~[?:?]

code:

                saveDefaultConfig();
                config = this.getConfig();
                config.options().copyDefaults(true); // 66
                saveDefaultConfig();
                reloadConfig();

i've used this code in numerous other projects and it never bugged. spigot (paperspigot) 1.16.5, the data folder is never created

ivory sleet
#

this.getConfig(); can be null

#

Supposedly

icy beacon
#

why so though

tardy delta
#

why having a config field too

icy beacon
#

i have it in my resouces

#

a 42 line config.yml

#

should be created with saveDefaultConfig, no?

ivory sleet
#

You probably wanna call reload after save

icy beacon
ivory sleet
#

Since saveDefault copies the file from jar to plugin folder

#

And reload would load the contents of the file (from the plugins folder)

icy beacon
#

nope that didn't help

#
                saveDefaultConfig();
                reloadConfig();
                config = this.getConfig();
                config.options().copyDefaults(true); // this
ivory sleet
#

Do you override getConfig()?

icy beacon
#

no i don't think so

#

wait

#

that's the problem

#

i have lombok's @Getter

#

with config

#

lmao

tardy delta
#

doesnt copyDefaults just mentions that the default should be copied but what if you dont specify defaults?

ivory sleet
icy beacon
#

nice deduction

ivory sleet
icy beacon
#

xd

shadow zinc
ivory sleet
#

Oh yeah

shadow zinc
#

the guy said at the bottom that he is using mysql, is that necessary?

ivory sleet
#

No

old cloud
#

no

shadow zinc
#

whats the best way, the most convenient and cleanest.

old cloud
old cloud
#

Obviously

ivory sleet
#

But generally when you rely on stuff like this, you have one component that stores the player count, one that updates it (might be a sync buffer etc) and then you facade it with an api

icy beacon
#

everything works now, thanks Conclure!

tranquil dome
#

I am trying to support multiple versions using NMS, so I came across this resource explaining how to do so using Multi Module Maven projects aka pom projects:
https://www.spigotmc.org/threads/maven-nms-tutorial.347254/

Now, I tried following through all the steps but it does not seem to work. Upon startup, the plugin jar cannot be loaded because it does not have a plugin.yml in its resources folder. In the tutorial however, it stated the project did not need a plugin.yml, and if I did want one, that I should put it in the core module (which I did). Can anyone help me?

charred blaze
#

how can i check if player is x blocks away from any location?

#

is there any method?

timid jetty
#

Is there any information on how DamageModifiers in damageEvents work or how DamageCause may effect these damageModifiers, I'm desperate and not finding enough looking through the spigot classes or online :I

timid jetty
ivory sleet
#

or (distanceSquared, preferably)

charred blaze
tranquil dome
shadow zinc
ivory sleet
ivory sleet
hybrid pond
#

Hi, how can I safe scheduled task in block, so I can cancel scheduled task with block reference? (I want trapdoors to open/close after n sec, but if trapdoor is clicked again, then cancel scheduled task)

tardy delta
#

looks like smth copilot would do tbh

timid jetty
# ivory sleet Isnt those just appended at the end of the damage pipeline

I mean so its applied when getting final damage, but I can't manually set final damage in an EntityDamageByEntity event, since different causes are effected by different modifiers, if I use a DamageCause CUSTOM does that mean no modifiers are applied (or if you know which class/interface modifiers + cause interact)

ivory sleet
#

But speaking of which, cancelling is almost always a hell and gross to deal with

hybrid pond
sacred mountain
#

will this work? before i try it

tardy delta
#

have a Map<Location, Task>?

tardy delta
#

shooter is always an entity iirc

sacred mountain
#

as in inline variable used on the same line

#

for another check

ivory sleet
sacred mountain
#

thx

tardy delta
#

is it better to clear the internal state of an object rather than creating a new object?

#

basically trying to get a new empty object with 2 number fields and a boolean

ivory sleet
#

I can go a bit deeper into pros and cons if you wish

tardy delta
#

just clearing state by this now cuz the object is mutable anyways and i dont want to create three new object every loop iteration

tardy delta
#

hmm thats gonna be a long bible

eternal night
ivory sleet
#

Actually this is a really complicated design choice, but let us just state the differences. Either mutability exist in low level layers, or higher level layers. Generally speaking, if mutability exists in the lowest level layers you reduce reusability but you increase abstraction because higher level layers do not have to care about managing direct change of state. If pick the other design choice you increase reusability as the component becomes more pure through the application’s lifetime with the extra cost of having to deal with mutability in higher level layers thus might indicate leaky abstractions etc.

tardy delta
#

what have i done

drowsy helm
#

also no gc if you reuse

tardy delta
#

it holds stack variables so doesnt matter

ivory sleet
#

Oh yeah I should say you can still have a fair amount of reusability when you have mutable components, just that it in practice becomes exponentially difficult to deal with

shadow zinc
#

Using callbacks for my plugin message receiver how can I ensure its not another incoming message but the one I wanted?

grim ice
#

anyone has ideas of stuff to learn?

ivory sleet
#

Elegant objects principle

grim ice
#

aight ty

ivory sleet
#

Lol nw

ivory sleet
tardy delta
#

first time in my life that i write that much of documentation and still people dont understand how my code works

ivory sleet
#

🥲

tardy delta
#

💀

shadow zinc
tardy delta
#

well ye if you see my maths it makes sense

ivory sleet
#

Thats why you just filter plugin message that go to the right channel and then just push the update to whatever variable

tardy delta
#

im wondering whats even the fastest?
``

#

fuck

grim ice
#

Principles:

No null (why?)
No code in constructors (why?)
No getters and setters (why?)
No mutable objects (why?)
No readers, parsers, controllers, sorters, and so on (why?)
No static methods, not even private ones (why?)
No instanceof, type casting, or reflection (why?)
No public methods without a contract (interface) (why?)
No statements in test methods except assertThat (why?)
No ORM or ActiveRecord (why? and why?)
No implementation inheritance (why? and why?)

#

wow

#

removed 90% of java features

#

kekw

ivory sleet
#

Hehe

grim ice
#

this looks interesting

tardy delta
#
x *=10;
x += y;```
or

x = x * 10 + y;```

shadow zinc
ivory sleet
#

Theres also data oriented design, as well as data oriented programming which you might wanna look at (theyre not the same7

shadow zinc
#

thx for the help

eternal night
#

No static methods, not even private ones
das dumb

ivory sleet
#

When you realize instance methods are (almost) static methods 💀

icy beacon
#

hey, anyone familiar with acf? i have this command:

@Conditions("player")
public void report(Player player, String reportedName, String reason) {
  // whatever
}

i expect it to work when i do /report <player> <reason>, but for some reason it falls back to my @catchunknown command, any idea why?

#

also i can't put Player as the second parameter for other reasons that are in my method

tardy delta
#

why dont (Player sender, Player target, String reason).?

tranquil dome
tardy delta
#

i believe it thinks that it needs a method of signature (Player, Player, String)

icy beacon
#

but why won't it work with a string though

ivory sleet
#

Youd have to implement Listener

icy beacon
#

it should work just fine

ivory sleet
#

And register an instance of the class that implements Listener

icy beacon
#

/report a b or /report obtm some reason - neither work, just fall back

tardy delta
#

ah wheres your @Default on the method?

icy beacon
#

my help command

#

it falls back to it

timid jetty
icy beacon
#
@Default @CatchUnknown @HelpCommand @Conditions("player")
public void defaultCommand(Player player) {}
tardy delta
#

uhh @HelpCommand is basically the same as @Default

icy beacon
#

i believe we are going off the topic

drowsy helm
#

also you can use OfflinePlayer or OnlinePlayer instead of name

drowsy helm
#

lmao

#

didnt bother reading

icy beacon
#

xD

#

any idea why this won't work?

drowsy helm
#

is the @loud prismditions the only param?

icy beacon
#

yeah

#

oh

drowsy helm
#

oops sorry for ping

icy beacon
#

wait

floral pewter
#

💀

icy beacon
#

bruh it is

#

forgot to put the subcommand

#

brain fart lmao

drowsy helm
#

lmao

tardy delta
#

lmao

icy beacon
#

thanks

grim ice
#

holy fuck

#

i just read the first principle and it makes a lot of sense

tardy delta
#

hows that a subcommand lol

icy beacon
#

wait yeah

drowsy helm
#

yeah that should be default

icy beacon
#

that's another brain fair

#

brain fart*

#

wait again

tardy delta
#

should be @CommandAlias("report") on your class

ivory sleet
#

Well its an interesting view point

ivory sleet
#

So its worth being knowledgeable about it

icy beacon
#

so if it's /report for fallback and there's /report <name> <reason>, do i need to annotate both with @default?

floral pewter
#

Why is null bad?

tardy delta
#

just send the whole class instead of multiple code blocks lol

ivory sleet
#

Because it can be everywhere

#

Theres no compile time guarantee of null safety really

tardy delta
ivory sleet
#

I mean ides try to be useful

grim ice
#

so it's better to just not use null

ivory sleet
#

Well

#

If you can, express it at type level

#

Optional for instance

#

Altho Optional is suboptimal

drowsy helm
#

both can be default

grim ice
#

mhm

icy beacon
#
// package & import

@CommandAlias("report|rep")
public class ReportCommand extends BaseCommand {

    @Default @CatchUnknown @HelpCommand @Conditions("player")
    public void defaultCommand(Player player) {
        // fallback + help
    }

    @Subcommand("today|t") @Conditions("player")
    public void today(Player player) {
        // all reports today (works fine)
    }

    @Conditions("player")
    public void report(Player player, String reportedName, String reason) {
        // this
    }

}
#

so i want to annotate report with default?

tardy delta
#

hmm javadocs

drowsy helm
#

yeah both can be default

#

as long as they have diff params

icy beacon
#

alright that kinda makes sense thanks

#

will try now

ivory sleet
#

Personally @grim ice I have sth like

#

Well I dont use it for every except one project that is running on limiting resources but yeaa

eternal night
#

whats the point of IntNil over OptionalInt

ivory sleet
#

I have a subtype that ensures a value is always there, and one that contracts a value is absent

tardy delta
#

looks like rusts Option<u32> lol

#

with more boilerplate

ivory sleet
#

Its just a bit more powerful and expressive, but no real point Ig

#

Bootleg kotlin nullability :>

icy beacon
ivory sleet
#

I mean rust got it fairly figured out

tardy delta
#

are you still doing rust?

ivory sleet
#

Scarcely

tardy delta
#

reached lifetimes?

ivory sleet
#

Ive been busy with ugh well some stuff

eternal night
#

rust kekw

tardy delta
#

i stopped when i saw lifetimes

ivory sleet
#

:3

eternal night
#

I stopped when I saw the first actual usage of it

tardy delta
#

smh

ivory sleet
#

Hehe

eternal night
#

that syntax is painful enough to make me wanna code kotlin

ivory sleet
#

Lol

tardy delta
#

wrote some cool things

old geyser
#

Guys, I don't want that when a player die drops item with a specific enchant, how can I do it?

ivory sleet
#

I mean I like the examples they show everyone how good, innocent and satisfying rust is to write, but in practice its just not that 😔

tardy delta
#

i mean brrrr

#

all because it doesnt permit null values :🎃

ivory sleet
old geyser
#

Guys, I don't want that when a player die drops item with a specific enchant, can someone help me?

tardy delta
#

remove the enchants?

#

💀

old geyser
#

but...

#

When a player die

icy beacon
#

is this english

old geyser
#

what?

sterile token
#

Uanaa I think its better to translate the question into english

icy beacon
#

when a player die drops item with a specific enchant
i'm sorry but i didn't nearly understand what this means

old geyser
#

Guys.

eternal night
#

I presume they want to keep an item in the player inventory if it has an enchantment

#

a partial keepInventory based on an enchantment

old geyser
#

Not like keep inventory

eternal night
#

rip

icy beacon
#

failed to presume 💀

old geyser
#

Oh, do you know kitpvp?

tardy delta
#

he doesnt want that a death players drops its enchanted items?

icy beacon
#

well yes

sterile token
#

@old geyser please use a translator because its I possible to help

tardy delta
#

lol

icy beacon
old geyser
#

tf

tardy delta
#

lemme translate a big text, you wont even be able to understand

icy beacon
grim ice
#

i have a question

#

about the decorator design pattern

sterile token
sterile token
tardy delta
grim ice
#

why dont you just include the functionally from the other classes to the interface

#

in the examples here

#

he has TrimmedText PrintableText CapitalizedText and other stuff

old geyser
#

When a player dies they usually drops enchanted items, I would like them to not only release enchanted items with a specific enchant, how could I do this?

grim ice
#

why not have the interface Text contain methods contain, trim, toPrintable, capitalize

ivory sleet
#

Well remember yegor has very opinionated takes on design

eternal night
#

would they still keep the item

old geyser
#

Nope

eternal night
#

well

#

just remove the items from the drops then ?

old geyser
#

But

eternal night
grim ice
#

that way with the interface u will save like

#

128 bytes or so

#

lol

old geyser
#

How tf can I explain

eternal night
#

idk

serene egret
#

does somebody know why the meta hoe is still normal and not a customModel ? i edited the meta but it doesn´t work

            ItemMeta meta = stack.getItemMeta();
            meta.setCustomModelData(4);```
eternal night
#

did you feed the meta back into the stack

#

stack.setItemMeta

serene egret
#

yes

eternal night
#

have you inspected the item in game

old geyser
#

Ok so

serene egret
tardy delta
eternal night
#

and its nbt does not contain the custom model data ?

serene egret
#

no

eternal night
#

well then, double check you are actually setting the item meta back

#

I guess

#

your code snippet does not include it

#

so /shrug

#

the rest looks fine

grim ice
#

This design is much more flexible and reusable than a more traditional one, where the Text object is smart enough to perform all said operations. For example, class String from Java is a good example of a bad design. It has more than 20 utility methods that should have been provided as decorators instead: trim(), toUpperCase(), substring(), split(), and many others, for example

#

is what he says

eternal night
#

that is pretty dumb

ivory sleet
grim ice
#

tbf

#

i kinda agree with him

eternal night
#

a decorator for this makes no sense whatsoever

#

you don't want a lazily computed String#toUpperCase

#

if you would want that, write that decorator around the string class itself

tardy delta
#

dont see any reason why trim() and uppercase() and whatever methods should be provided as decorators

eternal night
#

like, if I want to print a string as upppercase, I'd call String#toUpperCase, which returns me a decorator which I then have to compute in order to get the upper cased string I want ?

old geyser
#

I try to explain it like this.
Player1 has in his inventory an iron sword with sharpness 4 and another with sharpness 5. I would like that when Player2 kills him he only releases the sword with sharpness 5. How can I do that?

tardy delta
#

smh wrote two pages of paper about my math solving algorithm and its slow asf

#

im out of ideas

eternal night
grim ice
#

tbf

sterile token
#

Java is shit

grim ice
#

i dont really agree with the 'ctors must be code free'

sterile token
#

😂 😂

grim ice
#

it makes 0 sense

eternal night
#

I mean, you use a constructor as a pure form of validation of its parameters

sterile token
#

Java lang itself its really oddy

old geyser
grim ice
#

hes literally

#

making problems

eternal night
#

literally you grab the list

grim ice
#

then making another class

#

just to solve it

sterile token
grim ice
#

in an ugly way

tardy delta
eternal night
#

and then remove the items from it you want ??

sterile token
#

Lmao being so rude I wont help

old geyser
#

I'm not being rode

#

I'm only mad

#

event.getDrops().remove(Material.IRON_SWORD);

eternal night
#

There

#
@EventHandler
public void on(final PlayerDeathEvent event) {
    event.getDrops().removeIf(i -> {
        return i.getType() == Material.STONE;
    });
}
#

🥄

tardy delta
#

on

#

on what

#

smh

eternal night
#

removes all items with the type stone from the drop list

old geyser
#

event.getDrops().remove(Material.IRON_SWORD);
remove all iron sword

eternal night
#

no

sterile token
#

Lmao being in that way you wont be helped by anyone

tardy delta
#

check the type of event.getDrops()

eternal night
#

whats the learn java command

#

?learnJAva

old geyser
#

Guys

eternal night
#

?learnJava

old geyser
#

Never mind

eternal night
#

awww

sterile token
#

?learnjava

undone axleBOT
eternal night
#

wow

upper vale
#

LMAO

tardy delta
#

rude lol

eternal night
#

anyway, you cannot just remove a material from a list of item stacks ?

#

thats not how anything works

sterile token
#

Agree

#

I just blocked him

tardy delta
#

wondering why the signature of the remove method isnt remove(T elem)

sacred mountain
#

there is a DamageCause.CONTACT, but i cant seem to get the block involved, is there another way? im trying to check if the player was impaled by a stalagmite/cactus/sweet berry bush

sterile token
#

Because he was being really painfull and i dont like that type of people

sacred mountain
#

i'm doing this in the entitydamagevent atm

old geyser
#

you are useless

eternal night
eternal night
#

I literally already spoon fed you the solution

#

what are you on about

sterile token
sacred mountain
sterile token
#

Lmao calling usless to use when we spoon poofed full code

sacred mountain
#

mojang doesnt even specify bruh

#

'pricked to death'

sterile token
eternal night
#

EntityDamageByBlockEvent

#

is crying

sacred mountain
#

damn

#

that exists

#

thanks

eternal night
#

yes

#

xD

sterile token
#

Lymx

#

Spanish?

eternal night
#

didn't even get my name right 😭

sacred mountain
#

you guys really save me a lot of time tbh

#

i woulda done some really hacky stuff if u hadnt told me that

#

lmfao

eternal night
#

but no

sterile token
#

Lymx its the Spanish thing that correct the words

eternal night
#

not spanish

#

I am so confused

sterile token
#

Because not many americans uses xd

eternal night
#

oh ?

sterile token
#

Its more used by Spanish

tardy delta
#

rust be like

enum DamageCause {
  PlayerKill(Player killer),
  Block(Block block)
}```
#

smh just needed to say that

#

👉👈

eternal night
#

imma change a single one of your dependencies in your cargo.toml and you grow old before your project builds

tardy delta
#

@sterile token what ya dont like bout it lol

sterile token
#

I dont like none highly typed lsngs

eternal night
grim ice
#

aight

#

i just read the whole eo principles blogs

#

and my brain is struggling

eternal night
#

I don't think you get more statically typed than rust

grim ice
#

to process

tardy delta
grim ice
#

i think ill have to reread a few times

sterile token
tardy delta
#

what

eternal night
#

rust is strongly typed

#

as a heads up

tardy delta
#

dont even know what that means

sterile token
#

Strongly typed is the correct way right Lynx?

eternal night
#

static/strongly vs dynamic types

#

yea

sterile token
#

Thanks man

#

Cuz my english is really bad

eternal night
#

but anyway, does not mean you should dislike rust

#

it has a very robust type system

sterile token
#

I just was bored

#

And had nothing to said

eternal night
#

lol xD

tardy delta
#

i was thinking about learning rust but i changed my mind

eternal night
#

learn go instead 😛

sterile token
#

Go what that shit

tardy delta
#

i saw some go syntax and it looked horrible

sterile token
#

Never heard about that

eternal night
#

saner than rust

sterile token
tardy delta
#

🤡

eternal night
#

I am impressed

sterile token
#

Hey man stop swearing

#

You are making my balls going to the floor

tardy delta
#

lol

#

cuz of the weed?

sterile token
#

Bajas

#

Yeah in the Last few days I have spend $50 ley day being weed

eternal night
#

it shows

sterile token
#

Lmao translator go really bad

tardy delta
#

then he tells someone to translate his question 🤓

sterile token
#

Its translator or word corrector?

old cloud
#

nice help development btw

sterile token
#

When we just serverd him the food on his mouth

old cloud
sterile token
#

Oh

#

We are not in general?

old cloud
#

no

sterile token
#

Oh

#

My bad

#

Sorry conclure 😍

ivory sleet
#

Yes please be nice, relevant and all that stuff in between thanks <:

sterile token
#
  • conclure "preparimg ban command for Alexito2060"
#

😂 😂

shadow zinc
#

does CompletableFuture.runAsync(new Runnable() work with spigot okay?

eternal night
#

As well as any other off main thread computations

#

don't touch the main thread inside the runnable and you are fine

tranquil dome
#

@ivory sleet one more question, in which module should I put the resources such as config files?

sacred mountain
#

fully auto generated lore :D:D:D:D:D:D

eternal night
#

1 times

sacred mountain
#

bruh ill make a quick method for that

#

u got me

grim ice
sacred mountain
#

:(

grim ice
#

how would u not know golang

#

its mad famous

tender shard
#

well

eternal night
#

and it just got generic support 😛

grim ice
#

ez

tender shard
#

there are many "famous" languages

tardy delta
#

fuck i confused it with typescript

upper vale
#

*time(s)

vivid skiff
#

Is possible to detect when another plugin is unloaded?

tender shard
#

java will never die out, C will never die out, and the worst thing is, cobol will never die out

grim ice
#

yeah

tardy delta
eternal night
#

cobol is the lang of the future

upper vale
#

Is Fortran still used lmfao

eternal night
#

what are you talking about

grim ice
#

one major reason is that there are way too many code bases

#

on them

tardy delta
#

what about that carbon shit?

#

is it useful?

eternal night
#

too early to tell

grim ice
#

not yet

tender shard
#

my bank is using fortran in their mainframe

sacred mountain
#

any improvements? idfk my english well so

upper vale
#

LMAO

sacred mountain
#

ignore the extra param

tardy delta
#

imma learn c++ instead then

tender shard
sacred mountain
#

o yeah

tender shard
#

potato -> potatoes

#

and other things

sacred mountain
#

got it

tender shard
#

child -> children

#

mouse -> mice

sacred mountain
#

bruh

upper vale
#

entry -> entries

tender shard
#

you cannot do it generically

sacred mountain
#

im gonna add the o and the y-ies

upper vale
#

deer -> still deer

sacred mountain
#

thats it

tender shard
#

there are too many "exceptions" of the rules

tardy delta
#

woman -> women 🤓

sacred mountain
#

enlighs moment

tender shard
#

you couldnt even do it generically for latin

tardy delta
#

womans

upper vale
#

kekw

tardy delta
#

🤓

sacred mountain
#

womans

#

yes

tender shard
#

latin has such a strict grammar and it won't even work there because you don't know whether something is a-decliniation or 3rd declinitation

tardy delta
#

i fucked up my algorithm again

#

takes 6 steps to calculate 2+3*8^2-1

tender shard
#

e.g. terra -> terrae. but also, dux -> duces, virus -> vira, puer -> pueri, filius -> filii, bellum -> bella, dominus -> domini, mensa -> mensae, meus -> mea

tardy delta
#

first going to the end and them looping over it twice 🥺

smoky oak
#

can minecraft names display unicode characters?

tender shard
#

well

#

part of it

#

I mean a-z is unicode too 😛

smoky oak
#

screw you too

tender shard
#

I basically just do a regex to check for a valid name

#
name.matches("^\\w{3,16}$");
tardy delta
#

hmm regex

tender shard
#

but that's not 100% fool proof

#

because there are still certain usernames that are less than 3 chars, and some others still contain "."

#

but they are like >0.01%

tardy delta
#

isnt using a pattern faster?

tender shard
#

yes

#

a pattern would be faster

smoky oak
#

ah no what i meant is that i want to know if its possible to spawn in a npc with a name tag that contains greek letters

sacred mountain
#

thats all imma do

tender shard
sacred mountain
#

i cba to add more because there wll be no end to it

#

its useless anyway

#

im literally using it for one thing

tender shard
#

anyway, to whoever tried to do the singular -> plural thing:

#

you need to query some online dictionary

#

it's the only reliable way

#

there are just too many exceptions to the general rules (e.g. y -> ies)

#

as said... mouse -> mice

#

it's random

tardy delta
#

womans

tender shard
#

english is a weird language

#

yeah

#

woman -> women

#

but also

#

erm

smoky oak
#

men't

tender shard
#

what other word ends with "an"

#

?

smoky oak
#

spriggyan ?

tender shard
#

english is so weird in general

#

e.g.

#

woman, women

#

the last vowel changes

#

but the pronouncation only differs in the FIRST vowel

#

woman = woman
women = wimmen

#

kinda weird

smoky oak
#

alex

#

i write english

#

i dont understand it

#

big difference

sacred mountain
#

there lmfao

tender shard
#

english grammar is so easy but their spelling and pronounciation is just totally random

sacred mountain
#

the bart the

smoky oak
#

good thing 99% of the internet types

tender shard
#

yeah its not even correct lol

#

because bart is male

smoky oak
#

imagine everyone using voice chat

tender shard
#

it should be "Der Bart, der"

sacred mountain
#

der

#

yteahhhh

#

my german classes paid off

tender shard
#

haha

sacred mountain
#

my singular year of german B)

echo basalt
#

👀

smoky oak
#

mine didnt

#

i got what

echo basalt
#

german would probably simple to learn in my case

smoky oak
#

the equivalent to a D ?

tender shard
echo basalt
#

I'm already used to masculine and feminine languages

smoky oak
sacred mountain
#

i dont get it tbh

echo basalt
#

I just hope that german isn't like portuguese and doesn't have like 25 different cases for each verb

tender shard
#

english however skips the E part

sacred mountain
#

i dont see why an object has to have a gender

#

for languages

echo basalt
#

tree is feminine here

tender shard
#

you only have A (1), B (2), C (3), D (4), ... (5), and F (6)

echo basalt
#

so is table

smoky oak
echo basalt
#

but perfume is masculine

#

because fuck you

tender shard
#

"DAS Parfüm"

echo basalt
#

Das auto

tender shard
#

yeah

echo basalt
#

we don't have neutral here

tender shard
#

latin is even worse. they sometimes use the passive word for active meaning

smoky oak
#

URGH

sacred mountain
#

bro i hated latin

smoky oak
#

dont remind me

echo basalt
#

hocus pocus

sacred mountain
#

2 years of pain

smoky oak
#

my school was like 'youre taking two foreign language courses' and i had the choice between french and latin

sacred mountain
#

all those cases

smoky oak
#

and my dumb ass thought latin was easier

tender shard
#

e.g. you say "I murder md_5" (active form)
but in latin you'd say
"I was murdered md_5" but it still means that you murdered him

young knoll
#

Y’all get off topic in here a lot XD

smoky oak
#

yes

smoky oak
#

nobodys asking a question anyways

echo basalt
#

murder is the infinitive form

tender shard
agile anvil
echo basalt
#

here you say "I murdered" or "I had murdered" type deal

tender shard
tender shard
smoky oak
#

why use many word when few word do trick

tender shard
#

haha

#

kevin

echo granite
# sacred mountain any improvements? idfk my english well so

In my case I had exactly the same method like you did, but when I realized how many edge cases there were, someone made this class for me: https://github.com/eccentricdevotion/TARDIS/blob/master/src/main/java/me/eccentric_nz/TARDIS/utility/Pluraliser.java

GitHub

A Spigot / Paper plugin for all Doctor Who fans - create and use a TARDIS! It's bigger on the inside! - TARDIS/Pluraliser.java at master · eccentricdevotion/TARDIS

sacred mountain
#

Nominative, Vocative, Accusative, genitive, dative, ablative
all singular/plural

tender shard
echo basalt
#

I got a classmate that was named "quevin" just to fuck with people

smoky oak
#

fun times

sacred mountain
#

for the nice method

tardy delta
#

oh god

sacred mountain
#

i will be using walruses

echo granite
#

yeah I know the code sucks

#

it's horrible

#

but it works.

sacred mountain
#

i dont see the problem

smoky oak
#

you need to remember to optimize the right problems

sacred mountain
#

is he talking about the words

tender shard
#

fun fact: what's the plural of octopus?

sacred mountain
#

not the code

sacred mountain
echo granite
smoky oak
#

isnt it just octupus agin

tender shard
#

in german it's "Oktopoden"

#

I added this to wikipedia a few years ago

tardy delta
sacred mountain
#

💀

echo granite
#

This should be added to the english language

grim ice
sacred mountain
#

octopussys

tender shard
sacred mountain
#

ies*

tardy delta
#

indeed

tender shard
#

James bondies

sacred mountain
#

undies

#

what is this convo

smoky oak
#

okay calm down y'all were slipping

young knoll
#

Depends on how many are in the plural

#

2 is a hexapus for example

tender shard
#

identity theft is not a joke, LeGuernic!

ember estuary
#

Map<String, String> a = b.getOrDefault(xyz, ImmutableMap.of());

How can i rewrite this so it only creates the empty map when needed?
i know i could just do a null-check but that‘s so long, literally 4 lines 😭

agile anvil
#

isn't oit related to spigot ?

sacred mountain
#

possessive plurals when

eternal night
#

spigot development gotta touch grass every once in a while ngl

sacred mountain
tender shard
#

(if you wanna put it into the map as well)

eternal night
#

or use a shared empty map instance

grim ice
#

hexapussy

#

6x pussies

sacred mountain
#

bro

tender shard
#
Map<...> a = b.computeIfAbsent(xyz, __ -> ImmutableMap.of());
smoky lance
ember estuary
#

ahh thats good too

smoky oak
#

does b.get(xyz) just return null?

young knoll
#

If there isn’t an entry, yes

eternal night
#

^

#
Map<String, Map<String, String>> b = new HashMap<>();
final Map<String, String> a = b.getOrDefault("key", Collections.emptyMap());
#

shared instance

smoky oak
#

why not just do if a==null then return end

grim ice
#

tbf

tender shard
smoky oak
#

ah

grim ice
#

u cant avoid nulls as EO says

#

with libraries that use null

young knoll
#

Just wrap every single nullable object in an optional

#

:p

tender shard
ember estuary
#

actually now that u say it SecretX, it seems that it just uses the same static empty map every time

#

so no new map gets made i think

tender shard
#

emptyMap() reuses the same thing, yes

#

that's the point of it

#

the method is only there for generics and stuff

ember estuary
#

nah i mean ImmutableMap.of()

tender shard
#

otherwise you could use the static field directly

#

oh

#

no, ImmutableMap.of(...) creates a new one ofc

ember estuary
#

it does?

tender shard
#

how else would it work if you toss in stuff

ember estuary
#

two constructors

tender shard
#

oh wait you mean the empty one

ember estuary
#

one for no arguments and one with

#

yea

tender shard
#

sorry yeah

ember estuary
#

xD

tender shard
#

yeah the empty of() one just returns the static empty one

#

at least thats how guava does it

#

no idea if there's a builtin one, I only use java 8 JimDeadInside

sterile token
tardy delta
#

🤔

ember estuary
#

😂

smoky oak
#

the one advantage of java 8 is backwards compatability

#

plus

#

java 8 already has lambdas

reef lagoon
tender shard
#

java 17 doesnt do shit

#

it adds "nice to have things" that noone actually needs

#

they are nice to have but that's it

#

I would switch to java 17 if there still wouldnt be so many people on 1.16 that use java 8

#

if I do standalone apps like discord bots or GUI stuff, I always go for 17

#

or comissions, when they say "java 17 is fine" ofc I also go for 17

smoky oak
tender shard
#

1 sec

#

item = switch(...)

#

in java 8 it would be like this

smoky oak
#

huh thats interesting

tender shard
#

one sec

#

I do "instanceof Slime slime"

#

so in line 93, I can use "slime" and it's a Slime

#

I don't have to do Slime slime = (Slime) entity

#

it remembers from before that I did the instanceof, so I can be sure that "slime" is now a Slime instead of having to cast it "again"

#

or records for example

#

records are basically java's version of lombok's @Data

smoky oak
#

i dont think records are that useful

tardy delta
#

for immutable data they are

smoky oak
#

if you want to change a single value you recreate the whole thing

tender shard
#

well if you don't use lombok, then records can make your classes WAY shorter

#

lemme give you an example about why records are awesome

smoky oak
#

yea i do most of my work with mutable data

smoky oak
#

so i dont get much use out of records

tardy delta
#

i believe they should add the same way to defining a class as a record does

tender shard
#

I usually use lombok if I want mutable data classes

#

so yeah

  1. Wanna have it immutable and use Java 15+? Use records
  2. Wanna have it immutable and use Java 5+? Use lombok's @Data with final fields
  3. Wanna have it mutable and use Java 5+? Use lombok's @Data with mutable fields
  4. Using Java 4 or older? Damn where did you download this jdk bro
tardy delta
#

using java 1: die

smoky oak
tender shard
#

I'm still waiting for 1.20 to get rid of the enums

tardy delta
#

why

tender shard
#

wait

#

did you not read the announcement?

smoky oak
#

what announce emnt

tardy delta
#

nope

tender shard
#

basically ALL enums that implement Keyed will get removed "soon" (TM)

#

e.g. Material

tardy delta
#

ah from spigot

tender shard
#

yeah

smoky oak
#

what will they replace it with

tardy delta
#

i thought you were talking bout java 20

#

lmao

tardy delta
tender shard
smoky oak
#

...why?

tardy delta
#

im still waiting for generic enums in java

tender shard
#

e.g. something like this

public class Material {
   public static final Material DIRT = new Material(NamespacedKey.minecraft("dirt"));
young knoll
#

Because enums are for things that don’t change

smoky oak
#

well thats just the same problem in a different form

young knoll
#

Registries are slowly becoming modifiable

smoky oak
#

you still cant add a new material or biome

young knoll
#

They’ll likely be a getByKey or something

tender shard
#

of course you can

#

you can just do new Material(...) yourself

tardy delta
#

client would have to know about it smh

tender shard
#

I mean

smoky oak
#

i spent about half of the last week trying and failing to add a new biome

tender shard
#

just look at the PersistentDataType class

smoky oak
#

for various reasons

tender shard
#

it has a few public static final fields, like PersistentDataType.BYTE

young knoll
tender shard
# tender shard it has a few public static final fields, like PersistentDataType.BYTE