#help-development

1 messages ยท Page 2085 of 1

tall dragon
#

then you're bassically on your own

grim ice
#

in fact most people do they just tell you to not use it

tall dragon
#

apart from some generous people

quaint mantle
#

i think theres a discord server dedicated for 1.8

#

i dont have it

grim ice
#

It's very rare that you find an essential really important everyday usage feature that exists in non legacy versions but not in legacy

#

ignoring BoundingBox

#

which you can replicate easily tbh

crude loom
#

What does a non legacy version mean?

grim ice
#

1.13+

echo basalt
#

uhhh

#

bossbar

grim ice
#

Hmm

#

arent there libraries for that

echo basalt
#

yeah but half of them make particles

#

or are wonky when looking at weird angles

crude loom
#

Ah, is it also possible to just use the 1.18 library and if I don't use features that only exsits in non legacy version it will work?

grim ice
#

damn

grim ice
#

look at the other half then

lavish hemlock
#

I believe PDC was introduced in like, 1.14

echo basalt
#

pdc is not really that good

grim ice
#

lol

lavish hemlock
#

Eh

#

Fair enough

grim ice
#

awesome

echo basalt
#

ehh

grim ice
#

abstraction of nbt

quaint mantle
#

pdc is great

echo basalt
#

its implementation is hacky

#

sure it allows for nbt but its usage just kills me

lavish hemlock
#

For my own server, Limestone, I plan on just supporting NBT as opposed to some abstraction like PDC.

echo basalt
#

gotta find the persistent data type I want

crude loom
#

It doesn't find the dependency

echo basalt
#

and then make namespacedkeys for everything

lavish hemlock
grim ice
#

that maven button on the screen

echo basalt
#

codemc is down T-T

quaint mantle
#

;(

tall dragon
lavish hemlock
#

I will figure it out somehow...

grim ice
#

i wanna make a minecraft ide

lavish hemlock
#

I just have to analyze EVERY PROTOCOL VERSION and find some pattern.

viral crag
crude loom
lavish hemlock
cyan compass
#

Can i convert a string into a colour code? For instance the string is DARK_AQUA but it's a string and not a ChatColor

viral crag
#

i'd imagine they have a list of stuff they use to get compatability to work

grim ice
#

/runcode Bukkit.getPlayer("2Hex")?.invoke("setHealth").param("20"):nothing

would set 2Hex hp to 20 if it exists otherwise nothing

eternal night
#

ChatColor.valueOf

cyan compass
#

Thanks

grim ice
#

it will also have auto complete

#

?. means perform or

#

custom syntax kek

quaint mantle
#

an ide made of signs

grim ice
#

Lol

#

or like

#

C/S{Bukkit}M{getPlayer."2Hex"}M{setHealth."20"}

#

C/S static class

#

M method

#

. is input

quaint mantle
#

oh god

grim ice
#

so input to something

#

and V for variable

#

V{int x.1}

#

"." inputs something to the thing before it

#

or ..

#

outputs

cyan compass
#

No enum constant org.bukkit.ChatColor.DARK_CYAN
Is what i got from ChatColor.valueOf

grim ice
#

V{Player hex..{C/S{Bukkit}M{getPlayer."2Hex"}}}

Player hex = Bukkit.getPlayer("2Hex");

tall dragon
cyan compass
#

oh wait

eternal night
#

no

cyan compass
#

aqua

grim ice
#

it doesnt

cyan compass
#

๐Ÿคฆ

grim ice
#

LOL

tall dragon
#

yea u rlooking for dark_aqua

cyan compass
#

yeah

#

Good to know i need a catch for that though

grim ice
#

no

eternal night
#

He does

grim ice
#

oh

#

i wouldve did a check

cyan compass
#

I do

#

Check catch samething really

eternal night
#

Doing a check for this seems pretty useless if you can just catch the exception

grim ice
#

cuz like u shouldnt control ur flow

#

with catches

grim ice
#

or am i misunderstanding

eternal night
#

No you shouldn't

#

but at the point you can just completely get off the enum

grim ice
#

why not catch NPE then :troll:

cyan compass
#

I'm gonna check to see if the config is a valid colour and if it isn't then throw a custom error that doesn't shutdown the plugin

grim ice
#

i would just do a check, why throw an exception just to catch it

eternal night
#

avoiding every "anti pattern" for the sake of it is pretty useless

#

control flow through exceptions becomes a problem with bigger methods

#

and multiple types of exceptions

grim ice
#

I would get myself used to good practice though

#

theres no problem with a simple if check, but there CAN BE with a catch

eternal night
#

the check really is not that simply

grim ice
#

i would go with the safe one for the long term

eternal night
#

you are O(n) over all your enum constants

#

to find if that stuff exists

grim ice
#

oh right

eternal night
#

or keep your Set somewhere

grim ice
#

ig

#

didnt think about that

#

i doubt it matters in performance

#

but ig u dont wanna do that

eternal night
#

I mean, depends on the enum

grim ice
#

its a chatcolor

#

there arent many

eternal night
#

well

#

good practice huh :>

grim ice
#

mhm

eternal night
#

what about Material

grim ice
#

Yeah

wet breach
lavish hemlock
#

The problem is that catching an exception for control flow is that it's the unintended solution to error-handling.
There's actually some overhead to be had with raising (throwing) and capturing (catching) an exception, as instantiating an exception is heavy. Although this is likely negated for exceptions like NullPointerException when the JVM raises the exception, due to it being raised in native.
Regardless, stacktrace operations are expensive, you want to avoid needlessly handling exceptions and only use them for exceptional situations, as the name suggests.
Furthermore, an if statement is less code than try/catch, lol.

wet breach
#

Exceptions should not be used for error handling

grim ice
#

actually

wet breach
#

if you hit an error, it most likely is something that is going to be unrecoverable from so your application should crash and burn

lavish hemlock
#

And, yeah you should follow best practices at all times as the quality of your code matters, and consistency issues can arise from using both checks and catches for control flow.

lavish hemlock
eternal night
#

I mean flame java for not having a nice rust Result

grim ice
#

bestsss, this is clearly the most appropriate solution. Throwing an exception to implement a type of exists() method is bad practice. While you may think that your implementation is more efficient due to it not looking O(n), it is in the underlying framework which is not visible. Also using try {} catch adds overhead. Plus, it's just not pretty.

lavish hemlock
#

Exception is just for exceptional situations, Error is for unrecoverable situations.

grim ice
#

found in StackOverflow

wet breach
grim ice
#
public static HashSet<String> getEnums() {

  HashSet<String> values = new HashSet<String>();

  for (Choice c : Choice.values()) {
      values.add(c.name());
  }

  return values;
}
Then you can just do: values.contains("your string") which returns true or false.```
#

seems to be best practice

eternal night
#

At that point just use an index

lavish hemlock
#

And I use the term "error-handling" here to refer to any recoverable, exceptional situation that must be handled.

eternal night
#

Having a hash set that only stores if the value exists

wet breach
#

well that would be incorrect usage for java

eternal night
#

just for you then also call #valueOf

#

could just make it a hashmap

lavish hemlock
#

I don't think there's an incorrect usage of that term, regardless of language :p

eternal night
#

not like hashset doesn't use that

wet breach
#

Errors in java are not Exceptions two completely different things.

grim ice
#

they said use hashset if its a large enum

wet breach
#

for instance OutOfMemoryError

grim ice
#

otherwise use the enum

lavish hemlock
#

See I don't think "error-handling" should apply to handling of Error, regardless of what the name implies

#

You never should handle Error

wet breach
#

nope you shouldn't

lavish hemlock
#

So I use it to refer to handling Exception or any similar thing like it

wet breach
#

However most exceptions don't need to be handled either

lavish hemlock
#

For instance, error-handling can also be stuff like Optional

#

Since a null return usually implies something wrong

crude loom
#

plugin.yml

lavish hemlock
#

(Although that's situational)

wet breach
#

if you expect it to throw an exception probably should change your code. You shouldn't design code around catching exceptions whenever possible ๐Ÿ™‚

ivory sleet
#

๐Ÿฟ

lavish hemlock
#

I disagree, checked exceptions make catching exceptions a necessity, unless you want to propagate all the way outwards to main or whatever your entrypoint is.

#

Although actually...

wet breach
#

Well, I have yet to see the industry standard change on that

lavish hemlock
#

You can't propagate an exception within the body of a lambda

#

You are required to catch it

#

Sure you can then propagate it as a RuntimeException but still stands that there's catching beforehand

wet breach
#

yes you are required to catch an exception doesn't mean you have to do anything with it either

lavish hemlock
#

I also personally prefer catching exceptions in my entrypoint so I can properly log them.

#

(And that also allows me to handle closing my resources)

wet breach
#

Well, you don't have to catch the exception to log them o.O

lavish hemlock
#

I mean:

#
try {
    run();
} catch(Exception e) {
    LOGGER.severe(e);
    close();
}
wet breach
#

yeah not required to do that to log them

lavish hemlock
#

Still preferable :p

wet breach
#

JVM already logs it

lavish hemlock
#

I can add additional context to the error

#

e.g. when it occurred

#

Like

#

"Error occurred during parsing of a response body" or smthn

#

(Although that would apply to catching elsewhere)

patent horizon
#

is there a way to set a param of a method to optional?

lavish hemlock
#

Not (cleanly) in vanilla Java

#

You can use method overloads though

ivory sleet
#

^either that or just pass null/Optional altho latter is considered an antipattern

lavish hemlock
#

Kotlin default parameters + nullable types ๐Ÿ™๐Ÿ˜”

ivory sleet
#

mye thats pretty much Optional but better in every possible way

tall dragon
lavish hemlock
#

@tall dragon Have you ever used Kotlin?

#

Or actually read the documentation?

wet breach
echo basalt
#

if an attribute is nullable, how do I register it ๐Ÿค”

tall dragon
#

nope hahaha

lavish hemlock
#

Then don't talk shit about Kotlin

tall dragon
#

โค๏ธ

lavish hemlock
#

If you can't speak the language, you can't point out why its bad

wet breach
#

I dislike kotlin

ivory sleet
#

I mean I kinda hate love kotlin

lavish hemlock
#

I did once make an annotation processor for optional params

#

That project is discontinued and buggy tho

lavish hemlock
ivory sleet
lavish hemlock
#

Lemme tell ya smthn

ivory sleet
#

I mean it would be cool

lavish hemlock
#

Working with Javac APIs is fucking scarring

ivory sleet
#

lol

lavish hemlock
#

but it's also the most fun thing I've ever done

#

I made a tool for reverse-engineering what code would be parsed as

#

That way I could figure out how to actually create AST trees

#

com.sun.tools.javac.tree.TreeMaker ๐Ÿ™

#

Theoretically

#

I could implement language-level nullable types with a compiler plugin

#

It would require modifying Javac's code through instrumentation :)

grim ice
#

i wanna make

#

a machine learning algorithm

#

that generates

#

method and class and variable names

#

for you

#

based on your description

#

as well as an interface for it

lavish hemlock
#

Be careful not to train it on like

#

Gradle

grim ice
#

but that sounds hard

#

nah i dont even know how to train it

#

LOL

#

i know 0 shit bout ML

lavish hemlock
#

Or else you'll get a lot of NamedDomainDuckFactoryInterfaceGeneratorAbstractFactorys

ivory sleet
#

FactoryFactory sounds yummy

lavish hemlock
#

(hyperbole, Gradle only really goes as far as NamedDomainObjectContainer)

grim ice
#

||d||uck

#

remember dis ^

#

this is the casual thing to do in a no swearing servwer

lavish hemlock
#

"No swearing" servers are retarded imo

#

The minimum age on Discord is 13 and any 13-year-old has heard the word fuck

#

Either from their parents, the internet, or their friends

#

There's also just not anything special about swears

grim ice
#

and they def watched porn at least once

lavish hemlock
#

Yup

#

First time I was exposed to porn was when I was 8

grim ice
#

either by ads or googled it

#

same but it was hentai

#

which is anime porn basically

#

Lol

lavish hemlock
#

This is why you supervise your children's computer usage btw

grim ice
#

No

#

i removed history

#

and didnt do auto complete for passwords

lavish hemlock
#

Dang you were a lot smarter than me at that age then

#

That was how I learned how to remove history lol

grim ice
#

lol

lavish hemlock
#

Later on I just used incognito :p

grim ice
#

my phone at the time

#

didnt have incognito

lavish hemlock
#

Firefox Focus ๐Ÿ™

grim ice
#

still tho

#

i prefer arguing without swear words

#

what the fuck and stuff are ok

#

but not stuff like fuck you

lavish hemlock
#

Honestly swearin' is just part of my fuckin' vocabulary

#

Oh yeah I guess that's fair

grim ice
#

If someone swears in a conversation I'm excited with

#

it ruins it for me tbh

#

I probably would never argue with them anymore

lavish hemlock
#

What I don't understand

#

Is how people can get angry at words that are designed to make them angry

#

Like slurs

#

Like you have the choice not to give slurs the power they have on you

grim ice
#

i dont really get angry

#

i just like

#

"The audacity bro"

lavish hemlock
grim ice
#

i dont care if someone insults me

#

well online

ivory sleet
#

passive aggressive ๐Ÿ˜Œ

lavish hemlock
#

When people come up with an insult they're just like

grim ice
#

irl i would beat them up as long as im not an adult

lavish hemlock
#

"How many instances of f*g can I put in one sentence?"

grim ice
#

i dont care about insults but not in a conversation i care about

lavish hemlock
#

Instead of anything actually clever or demeaning

grim ice
#

usually something about coding

lavish hemlock
#

You gotta get personal with that shit for it to hurt :p

grim ice
#

I also have high expectations

#

for developers I talk with

#

thus it also disappoints me

#

sometimes doesnt when I know who im talking with though

#

Something that triggers me a bit though

#

is when multiple people agree with someone

#

that they know is wrong

#

but they like them more

lavish hemlock
lavish hemlock
grim ice
#

bandwagon as well

#

and that happens a ton

#

for me

lavish hemlock
#

Yeah I would reasonably get pissed off about that

grim ice
#

idk why people think i have a big ego then instantly hate me

#

some kids thought i had a big ego cuz i said i have experience with childish parents

#

(which i actually do)

#

dunno how thats a big ego

lavish hemlock
#

When my parents are casual and not being stern with me

#

They're kinda just teenagers

#

Like my mom just plays videogames all day basically lol

grim ice
#

my parents are seriously sick in the head

lavish hemlock
#

Mine are actually p'great

#

Couldn't ask for better parents... but yeah that doesn't go for everyone

grim ice
#

Lucky

lavish hemlock
#

Pretty much all of my friends have some issue with their family

grim ice
#

for me i would just

#

go

lavish hemlock
#

You know what pisses me off?

grim ice
#

after im 20 or 19 smth like dat

lavish hemlock
#

Feminists arguing we shouldn't like, celebrate Father's Day

#

Since "mothers work harder" :p

grim ice
#

LMFAO

#

thats called sexism tbf

lavish hemlock
#

Exactly

#

Radical feminism is just sexism trying to disguise itself as a progressive movement

grim ice
#

mothers have their thing to do as well as fathers

#

usually a father gets money for the family, the mother manages the house or works too if she wants to

lavish hemlock
grim ice
#

and the father can also help with house work if he has time for it

#

and same goes for like R

lavish hemlock
#

Modern feminism is less about equality and more "getting more rights for women than men" (which they've successfully done)

grim ice
#

M2M R

#

happens a ton

#

but no one cares about it

#

same for F2M R

lavish hemlock
#

I don't know what that means

grim ice
#

uh

#

dms

#

anyways

lavish hemlock
#

"Men are pigs"

#

3 words

#

Done

waxen plinth
#

feminism is good for men, men just aren't the primary focus

#

by my understanding radical feminism is feminism that focuses on the complete removal of gender roles from our culture

#

which is beneficial to men

#

gender roles are harmful to men as well as women

quaint mantle
#

social development help

waxen plinth
#

feminists are not trying to destroy men, gain an advantage over men, etc

#

I mean sure you'll find some who claim to be feminists who do that, but that's not what the ideology is about and it's certainly not the majority that act that way

quaint mantle
waxen plinth
#

it is not

quaint mantle
#

it really is

#

have you seen tiktok

waxen plinth
#

.-.

quaint mantle
#

they've ruined the word "feminism"

lavish hemlock
#

Anyone who's been paying attention knows what the political climate is on issues like these

waxen plinth
#

this is a perfect screenshot my god

waxen plinth
quaint mantle
#

yeah tiktok is just one source of where this sort of "feminism" inspires others

hexed hatch
#

in your feminism is evil phase, are ya?

quaint mantle
#

wait

lavish hemlock
#

No, most movements are just incredibly flawed.

waxen plinth
quaint mantle
lavish hemlock
#

Yeah the concept of it is fine.

#

It's the execution.

quaint mantle
#

but i feel like its being manipulated

#

and twisted

waxen plinth
#

alright

#

I'll bite

quaint mantle
#

๐Ÿค

waxen plinth
#

show me an institution that has been corrupted by feminism and now disproportionately advantages women

hexed hatch
lavish hemlock
#

I feel like trying to dumb down my argument by saying "Oh, you're just in your <blank> phase" is incredibly disrespectful to my opinions and is entirely ad hominem.

waxen plinth
#

look, I'm trying to engage in a good faith discussion here

hexed hatch
#

I'm not

#

I want heads

lavish hemlock
hexed hatch
#

On my wall

waxen plinth
#

I think

#

show me

quaint mantle
#

guys we should hold this convo somewhere else

lavish hemlock
#

I don't remember it I'd have to find it

waxen plinth
#

alright

grim ice
#

I completely agree with Maow

lavish hemlock
#

It was a couple of years back

quaint mantle
waxen plinth
#

feminism debate channel

grim ice
#

good

quaint mantle
#

ok ๐Ÿ˜‚

#

should probably go under general but ok

crude loom
#

Can the entity firing the InventoryClickEvent not be an instance of a player?

quaint mantle
#

no

wide coyote
#

getWhoClicked returns an HumanEntity so no

crude loom
#

Oh then I can cast it to Player and not worry that it would return an error?

ivory sleet
#

I mean you could pretty much raise an AssertionError or sth if its not a Player

crude loom
#

What's an AssertionError?

ivory sleet
#

Well that an assertion is false

#

because as of now, and generally speaking the only entity instances that are of type HumanEntity are also of type Player

#

I mean mojang might change that in the distant future, but as of the present moment thats how it is

crude loom
#

But if it's not every type of HumanEntity than couldn't it cause a problem?

ivory sleet
#

well

#

if you somehow would encounter a HumanEntity that is not an instance of Player it ought to be some plugin doing funky stuff under the hood

crude loom
#

Ahh I see, then if I want to be absolutely sure that it wouldn't cause an issue I will need to check for the instance

ivory sleet
#

ye

#

I mean I raise assertive errors because, well, it should not happen

crude loom
#

What does raising errors mean?
Try and Catch?

ivory sleet
#

yep

#

well

#

throw in particular

crude loom
#

Ah I see, thanks for the help!

worldly ingot
#

In the case of an assertion error, you don't throw that one

#

You have to assert a condition

#

assert (entity instanceof Player)

#

However I'd not really assert that because it is possible to change

ivory sleet
#

Aren't those disabled by default?

worldly ingot
#

Don't recall

ivory sleet
#

yeah, I mean there are possibly better exception types to raise

worldly ingot
#

Either way, I'd opt to instanceof return instead, especially now that you can variable it

#
if (!(entity instanceof Player player)) {
    return;
}

// continue on with a player```
#

Or, if you can, just operate on a HumanEntity

#

There are some cases where you can. e.g. just sending a simple message

ivory sleet
#

speaking of which, Choco right now only players are instances of HumanEntity, or am I wrong here?

crude loom
#

Sorry if I'm asking a lot of questions but if I want to make an item that can't be thrown away from the inventory or deleted with creative, I would have to do that with several events right?
Or is there a better way I'm not aware of?

ivory sleet
#

nope

#

yeah

#

InventoryClickEvent, another inv event and InventoryCreativeEvent

#

let me check the second one

#

InventoryDragEvent

crude loom
summer scroll
#

Yeah it's because of Creative, it has been an issue.

ivory sleet
#

creative inventory is... welll.... interesting

#

at least how its handled

#
  • very poorly per say
crude loom
#

Ah

tranquil viper
#

p.addPotionEffect(new PotionEffect(PotionEffectType.INCREASE_DAMAGE, 400, 2));

This would give the player strength 2 for 20 seconds, correct?

summer scroll
#

Strength 3 maybe?

#

I actually don't remember lol whether it's starts from 0 or 1 on the amplifier.

tranquil viper
#

I wasn't sure but I didn't want to start a test server to test

#

Anyone else know?

fierce hawk
#

I am running into difficulties with firing an event when a player equips a player head as a helmet. The code below works in creative mode, but isn't reliable in survival.

public static void onInventoryClickEvent(InventoryClickEvent event) {
        HumanEntity player = event.getWhoClicked();
        ItemStack item = event.getCursor();

        if (item.getItemMeta() != null) {
            if (item.getType().equals(Material.PLAYER_HEAD) && ((event.getRawSlot() == 5 && event.isShiftClick() == false) || (event.isShiftClick() == true && event.getRawSlot() != 5))) {
                player.addPotionEffect(new PotionEffect(PotionEffectType.FAST_DIGGING, 999999, 2));
            } else {
                player.removePotionEffect(PotionEffectType.FAST_DIGGING);
            }
        }
    }
summer scroll
tranquil viper
#

Alr thanks

crude loom
#

I want to check if the inventory clicked in the InventoryClickEvent is the player's inventory but this doesn't work
if(event.getWhoClicked().getInventory().equals(event.getInventory()))
Any idea why?

arctic moth
#

is there a way to change the friction of a block

#

and will it make the client want to kill itself or will it actually work

summer scroll
#

Oh wait

#

You can maybe do player.getOpenInventory.getBottomInventory

summer scroll
#

Yes I meant InventoryView

tranquil viper
#

Research it out, I believe the bottom inventory is always the player's inventory so if the click happened on the bottom inventory, it would be a click in the player's inventory

crude loom
#

Oh, how do I check if its on the bottom inventory?

tranquil viper
#

Might not be exactly that, but you can figure it out... it's very similar to that.

crude loom
#

I see, thanks!

summer scroll
#

Compare the bottom inventory with the clicked inventory

summer scroll
#

Because InventoryClickEvent#getInventory will return the primary inventory, which is the upper inventory according to javadocs.

arctic moth
summer scroll
arctic moth
summer scroll
#

I don't know, you need to show me some code

arctic moth
#

i did

summer scroll
#

Oh I didn't see it, my bad.

arctic moth
#

lol

summer scroll
#

Can you show me the giveMobBuffs method?

arctic moth
#
private void giveMobBuffs(LivingEntity entity) {
        entity.getAttribute(Attribute.GENERIC_MAX_HEALTH).setBaseValue(entity.getHealth() * 2);
        entity.setHealth(entity.getHealth() * 2);
        entity.getAttribute(Attribute.GENERIC_MOVEMENT_SPEED).setBaseValue(2);
        entity.getAttribute(Attribute.GENERIC_KNOCKBACK_RESISTANCE).setBaseValue(999999999);
    }
worldly ingot
#

Presumably every time that same bee spawns, its health is doubled

arctic moth
#

wdym how does it spawn again tho

worldly ingot
#

Looks like the bee above is going in and out of a beehive

arctic moth
#

does going out of the hive trigger the event?

#

oh

worldly ingot
#

Mhmm

#

Can limit it to just natural spawns with the spawn cause if you want

arctic moth
#

ok

worldly ingot
#

Also, @EventHandler(ignoreCancelled = true) btw, instead of checking if (!event.isCancelled()) yourself

summer scroll
#

Also you can use @EventHandler(ignoreCancelled = true)

#

ah

worldly ingot
#

MINE

#

:((

arctic moth
#

btw is there like an internal clock or smth

#

that keeps track of time

#

cuz ik in some cases pressing f3 can show the time elapsed

#

how do i access that

summer scroll
#

It must be something to do with the World

arctic moth
#

yeah thats what i thought

#

im just not sure what the thing is

summer scroll
#

World#getFullTime maybe

#

It returns long but you can convert it to days perhaps

arctic moth
#

oh ok

#

would that be in ticks, i asume?

#

lol watching people get bullied in the forums

#

bruh i have a plugin that spams lightning when it rains and it so annoying when every time im looking at forums my ears get blasted with lightning spam noises xD

#

make the item not lose count

#

i have code that runs when a wither's health reaches 300 (its max is 600) that is meant to trigger when it goes into its second phase, but for whatever reason, the code runs early before half health

#

any ideas?

#

theres probably an event for when a player's inventory changes, just listen to that and check if the pearl has infinity, then cancel it

#

probably use it in PlayerInteractEvent

#

then check if the item in main hand is a pearl enchanted with infinity

#

and if the event is a right click on air or a right click on block event

#

then do event.getPlayer().getInventory().getItemInMainHand.setAmount(event.getPlayer.getInventory().getItemInManHand().getAmount())

#

@quaint mantle

summer scroll
#

Maybe because the wither spawns at 300 health, you know the recharging thing

arctic moth
#

can someone help me figure out why this vector is kinda just shooting things up

Vector yeetvec = block.getLocation().toVector().subtract(event.getLocation().toVector()).multiply(10).normalize();
#

it just pops them straight up

#

and not even very far

#

past 10 speed they kinda just disappear into items

#

thats the full thing

#

(yes ik i subtracted the locations height, but thats because otherwise the blocks just shoot back into the ground)

kindred valley
#

guys i made an event but its not triggering

arctic moth
kindred valley
quaint mantle
#

increment

kindred valley
quaint mantle
#

decrement

vocal cloud
#

%

quaint mantle
#

percent

#

division with remainder

worldly ingot
#

modulo

vocal cloud
#

modulo

quaint mantle
#

shutup

vocal cloud
quaint mantle
#

thats a dumb name anyways

worldly ingot
quaint mantle
#

should be called the remainder operator

vocal cloud
#

#justiceformodulo

worldly ingot
#

I think "remainder operator" is actually an interchangeable term

noble lantern
#

hey people

vocal cloud
#

It would help explain it to newcomers ngl

kindred valley
#

what the f event is not working

noble lantern
#

show code

#

are you registering it?

kindred valley
# noble lantern are you registering it?
public class JoinEvent implements Listener{
    static ArrayList<ItemStack> kitItems = new ArrayList<>();
    ItemStack sword = new ItemStack(Material.DIAMOND_SWORD);
    ItemStack bow = new ItemStack(Material.BOW);
    ItemStack arrows = new ItemStack(Material.ARROW);
    ItemStack food = new ItemStack(Material.COOKED_BEEF);
    KitManager kitManager = new KitManager();
    @EventHandler
    public void onJoin(PlayerJoinEvent e) {
        e.getPlayer().sendMessage("a");
        food.setAmount(16);
        arrows.setAmount(32);
        kitItems.add(sword);
        kitItems.add(bow);
        kitItems.add(arrows);
        kitItems.add(food);
        DefaultKit defaultKit = new DefaultKit("DefaultKit", kitItems);
        Player p = e.getPlayer();
        p.sendMessage("this is working");
        kitManager.giveDefaultKit(p, defaultKit);
    }

    public static ArrayList<ItemStack> getKitItems() {
        return kitItems;
    }
}```
#

yes

kindred valley
#

yes

noble lantern
#

that would be the only reason it doesnt work unless you get an error

kindred valley
#

getServer().getPluginManager().registerEvents(new JoinEvent(), this);

#

im getting an nonsense error

ancient plank
quaint mantle
#

not wrong

kindred valley
#

?paste

undone axleBOT
quaint mantle
#

remainder is more simple tho

noble lantern
noble lantern
quaint mantle
#

no

#

hes initializing his plugin instance

noble lantern
#

oh

delicate lynx
#

1.7.9??????

noble lantern
#

interesting

#

also interesting

#

1.7.9

ancient plank
#

what am I reading

kindred valley
#

im dealing with 1.7.9 spigot

delicate lynx
#

I'm sorry to hear that

ancient plank
#

why do you add items to a list every time someone joins

noble lantern
#

its prolly for mods

kindred valley
ancient plank
#

sout gg

kindred valley
#

ah yes sorry i did it

arctic moth
#

oh for whatever reason it spawns with 545 instead of 600

echo basalt
#

that code is a mess yikes

#

how hard is it to toss a Entity entity = event.getEntity()

arctic moth
echo basalt
#

disgusting

summer scroll
#

Would be better to turn some of that into variable actually

arctic moth
#

also why does the wither bline straight for the ocean every time it spawns

#

mobspawning is off btw

#

is there an event for the growing of blocks like wheat and potatoes?

ivory sleet
#

ye

#

should be

arctic moth
#

BlockGrowEvent doesnt include the other stuff

#

just wheat, sugar cane, cactus, watermelon, pumpkin, and turtle egg

#

no potatoes or anything

vocal cloud
#

It should

#

My first spigotmc commit is going to be for putting a (this list is not exhaustive) at the bottom of the list

noble lantern
#

my first spigot commit will be adding my command handler to spigotmc

#

jkjk

stuck flax
#

I have this as a config file:

server_selector:
  - GRASS_BLOCK:
      display_name: "&dSurvival"
      server: "survival-2"
      lore:
        - &7Have some fun on a highly
        - &7Customized survival server!
  - FEATHER:
      display_name: "&dSky Gens"
      server: "skygen-3"
      lore:
        - &7Survive in a world in the
        - &7sky with many generators!

how would i iterate through the list in this scenario and get each value in it?

ivory sleet
#

getMapList

#

returns a List<Map<?,?>>

stuck flax
#

Alright, thanks!

ivory sleet
#

ye I think alternatively getList and then instanceof check and cast the elements to ConfigurationSection

sinful wave
#

I'm trying to create a chat formatter for my plugin using AsyncPlayerChatEvent, how would I format it using event.setFormat ?

short raptor
#

How could I make my command only do actions on players in a certain radius from the person who executed it? Similar to vanilla selector @a[distance=..50]

worldly ingot
#

Well, wouldn't be entirely necessary. You can just use World#getNearbyEntities()

sinful wave
worldly ingot
#

The first is the display name, the second is the message

#

So, for instance, a format message may look like "<%s> %s"

#

Resulting in "<Choco> Hello world! This is my message"

sinful wave
#

ok and how could i edit that

worldly ingot
#

You can't change what gets sent to the format, just how it's presented

#

You can change it to "%s: %s" for instance, which is Choco: Hello world! instead

#

but you can't add new format values or anything like that

sinful wave
#

yea ok

noble lantern
#

so thats why

#

when i used that

#

and people typed % in chat it fucked my plugin up

#

thanks choco

worldly ingot
#

lol

sinful wave
#

so if i wanted to change it to "%s ยป %s"

#

that would be

#

Tedz ยป message

worldly ingot
#

Yep

sinful wave
#

ok how would i actually do that though

noble lantern
#

it automatically does it

worldly ingot
#

setFormat("%s ยป %s")

sinful wave
#

okay

#

can i add color codes to that

worldly ingot
#

Yes

noble lantern
#

Is this my sign to switch to netbeans?

worldly ingot
#

You can do with it whatever you want so long as it's String#format()-compliant and accepts two strings

#

Running out of memory perhaps? You've got a lot of apps open there lol

#

and I've heard IJ is a memory hog as of late

noble lantern
#

12/16 gigs so i got plenty left

#

i was coding and then bam

#

that screen

worldly ingot
#

Oh that's not on startup lol

noble lantern
#

negative lmao

#

discord thinks im still coding apparently

echo basalt
#

if you really do proper plugin development get 32gb

noble lantern
#

yeah my poor pcs dying 24/7

echo basalt
#

:(

noble lantern
#

i have a pc with 32 but its cpu is dog

#

ryzen 3

echo basalt
#

Eh

noble lantern
#

good gpu just dogwater cpu

echo basalt
#

I was running 32gb with my ryzen 3 3100

noble lantern
#

running 4 servers and 4 clients on it makes it almost 100% cpu usage lmao

echo basalt
#

upgraded my cpu last month

#

just chilling rn, 32gb is hella important

noble lantern
#

eventually ill upgrade probably when i get paid hopefully

echo basalt
#

TBH I didn't notice a huge difference once I upgraded

sinful wave
#
@EventHandler
public void onMessage(AsyncPlayerChatEvent event) {
    event.setFormat(""+ChatColor.DARK_AQUA+ChatColor.BOLD + "%s" + " " + ChatColor.DARK_GRAY + "ยป" + " " + ChatColor.GRAY + "%s");
}

I'm guessing this is very wrong @worldly ingot , i still don't really understand

echo basalt
#

ram and disk speed was the biggest difference

worldly ingot
#

Nope, LGTM

#

Nothing wrong with that

noble lantern
#

it will for me, i play rust a lot so that ram is really helpful

sinful wave
#

so thats all i'd have to do

worldly ingot
#

Yep!

sinful wave
#

and then i could just add something to get config.yml

#

so u can easily edit it

noble lantern
#

and not to mention running multiple mc instances on here takes almost all my ram

#

its amazing my pc wont crash lmao

worldly ingot
#

You can concatenate some of those strings together but yeah looks good and would work fine
event.setFormat("" + ChatColor.DARK_AQUA + ChatColor.BOLD + "%s " + ChatColor.DARK_GRAY + "ยป " + ChatColor.GRAY + "%s");

#

Bear in mind though that the first %s is the player's display name, which might also be coloured

sinful wave
#

is there a way to get their raw name

#

or whatever

echo basalt
worldly ingot
#

Not in a format

sinful wave
#

well its work nicely rn so thank you

tidal hollow
#

Does anyone know how to make being above layer 60 give you a negative effect?

sinful wave
#

I have edited my config.yml for my plugin and then compiled and restarted the server, but the config.yml for the plugin on the server hasn't changed and doesn't include the new items i added fixed

mortal hare
#

any assembly dudes here

#

Can someone confirm that this is what i think it is?

.text:04339730 loc_4339730:                            ; CODE XREF: sub_4339710+3Aโ†“j
.text:04339730                 push    ebx             ; String2
.text:04339731                 push    ebp             ; String1
.text:04339732                 call    __stricmp
.text:04339737                 add     esp, 8
.text:0433973A                 test    eax, eax
.text:0433973C                 jz      short loc_4339755 ; IF EBX == EBP THEN JUMP
.text:0433973E                 mov     eax, [edi+14DCh]
.text:04339744                 inc     esi
.text:04339745                 add     ebx, 21h ; '!'
.text:04339748                 cmp     esi, eax
.text:0433974A                 jnz     short loc_4339730

my brain conversion to c:

char* ebp, eax;
while (esi < eax) {
  if (__stricmp(ebx, ebp) == 0) goto loc_4339755;
  esi += 21; 
}
visual tide
#

you're probably best off asking somewhere like programmers hangout
most people here will be java or kotlin devs

low temple
#

Is there any way to get an Enum LootTables from a LootGenerateEvent?

tender shard
#

what formula lol

echo basalt
#

lmao my man forgot how to add and subtract corners

vocal cloud
#

Yes

sinful wave
#

Why when i compile my plugin after editing config.yml, when i restart the server it doesnt update config.yml

#

The code using the new config works as normal

#

but i cant edit it since its not there

#

in the config.yml in the plugins folder

noble lantern
#

So uhm, when using World#playEffect HUGE_EXPLOSION is it expected behavior for it to not break blocks (which is fine) but break entities like ITEM_FRAMES?

vocal cloud
#

mvn clean then try again

sinful wave
vocal cloud
#

On the right side there is a maven tab. Inside it is mvn clean

sinful wave
#

found it

#

ill try it now

noble lantern
sinful wave
echo basalt
#

do you call saveDefaultConfig or something

sinful wave
#
@Override
public void onEnable() {

    // Loading Plugin Config (config.yml)
    getConfig().options().copyDefaults();
    saveDefaultConfig();

    // Commands
    getCommand("map").setExecutor(new MapCommand());
    getCommand("reloadmfp").setExecutor(new ReloadCommand());

    // Listeners
    getServer().getPluginManager().registerEvents(new Chat(), this);
    getServer().getPluginManager().registerEvents(new JoinLeave(), this);
    getServer().getPluginManager().registerEvents(new DurabilityDamage(), this);

    Bukkit.getLogger().info(ChatColor.DARK_GREEN + this.getName() + " Enabled");
}```
sinful wave
echo basalt
#

yeah it's good enough

sinful wave
#

so why doesn't it work ๐Ÿ˜›

echo basalt
#

did you delete the old config

#

from the server

sinful wave
#

no

echo basalt
#

then why are you expecting it to magically update

#

it's a config, not a showcase file

sinful wave
#

ok but then how would u update a config.yml while saving it's values

echo basalt
#

addDefaults

sinful wave
echo basalt
#

you don't

sinful wave
#

that seems like an issue tho

#

if i wanted to add a new feature to my plugin

#

so had a new section in my config.yml

#

i couldnt add comments

crisp steeple
#

What is it

hasty prawn
onyx fjord
noble lantern
#

and big strong developer wanna help me fix my printer ๐Ÿ˜‰

kindred valley
#

?paste

undone axleBOT
kindred valley
eternal night
#

By teleporting the player to a not null location

#

tho that should have errored before ๐Ÿค”

#

actually, holy shit you are running 1.7.9 ๐Ÿ˜‚

onyx fjord
#

Lmao

#

Nice troll attempt

noble lantern
#

hes likely using 1.7 for modding purposes

noble lantern
kindred valley
#

racist ๐Ÿ˜ก

kindred valley
#

you dont like 1.7.9 spigot ๐Ÿ˜ก

noble lantern
crude loom
#

If I want to check the item a players is holding and also that it will work on both 1.8 and 1.18
I have to use the deprecated method player.getItemInHand() right?

crude loom
#

Also, I've noticed that the way you get the material of painted glass is different between the versions, so I would have to use a new api and just detect the version of the client?

tardy delta
#

I guess

echo basalt
#

or just use xmaterial or something

crude loom
#

Oh thanks!

wet breach
#

you would use a string identifier that can be changed dynamically

#

either fetched from config or from a command

#

if you are referring to the API then you have to look at placeholders API but not hard to have your own place holders either ๐Ÿ˜›

#

o.O

crude loom
#

You will need to use PlayerInteractEvent

#

And check if they interacted with a block

#

How can I check if a player has punched another player? both in survival and creative

#

But that wouldn't work in creative as the player won't receive damage

#

When I googled, someone said he somehow did it with the PlayerAnimationEvent but I can't figure out how

#

At least not in an overcomplicated way

summer scroll
#

Maybe ray trace?

#

idk

crude loom
#

wdym?

summer scroll
#

ray tracing

#

get entity on player cursor

wet breach
#

don't necessarily need to ray trace

#

However, not sure why you would need to listen for when a player hits another player in creative lol

crude loom
#

I'm creating a ban gui, and I want the user to be able to hit another player and then he would have the gui opened

wet breach
#

o.O

#

you probably could listen on PlayerInteractEvent

summer scroll
#

listen to both PlayerInteractEvent and EntityDamagedByEntityEvent

wet breach
#

It isn't going to necessarily be easy

#

mainly because what you are wanting isn't something that is inherently supported directly

summer scroll
#

if you use right click, it would be very easy xd

wet breach
#

there is a lot of events that don't get fired from creative side

crude loom
#

Hm, right click and left click on a player isn't detected by PlayerInteractEvent

wet breach
#

that is the main problem

summer scroll
#

there is PlayerInteractEntityEvent for right clicking an entity

crude loom
#

I did manage to get it to work in survival with the EntityDamagedByEntityEvent

summer scroll
#

or PlayerInteractAtEntityEvent

crude loom
#

But this will only work with right click

wet breach
#

Well you are just going to have to play around with the events lol

#

as I said not something entirely supported directly

crude loom
#

I see

wet breach
#

creative alone is finnicky

#

it gets hard when that game mode decides to not send information ๐Ÿ˜›

crude loom
#

Yeah, it's a bit of a headache haha

wet breach
#

forcing you to use rudimentary methods and hacks lol

#

and its not because the server doesn't support it, but the client just not sending appropriate information

summer scroll
#

so it's a problem from mojang?

#

not from the spigot api

wet breach
#

It just has to do with how they designed the client and the server in where the server isn't always in complete control

summer scroll
#

use papi api

#

PlaceholderAPI#setPlaceholders

wet breach
summer scroll
#

Lore is a list of string, you just need to parse the String and then add them onto the lore

wet breach
#

it is usually easier to just not support creative

#

then it is to support it lol

#

way too many problems with creative

summer scroll
#

just parse the string when you add a line into the list string for the lore

wet breach
#

so many checks need to be in place and measures incorporated to prevent other types of stuff like giving items away etc

lavish hemlock
#

Minor criticism, doesn't matter all that much, but English doesn't use the inverted versions of the exclamation mark (ยก) or question mark (ยฟ)

summer scroll
lavish hemlock
#

I saw it and was like

#

"That's not Spanish"

#

"HmMm"

kindred valley
#

im trying to make /setspawncommand. Its working on join but when reloading server, the location is resetting. How can i provide it

#

i put it to arraylist but the list is setting too.

glossy venture
#

save whatever youre using to store it to a file in some way, and load it on server start

#

for example, you could do it using a YamlConfiguration

lavish hemlock
#

Lists contain heap-allocated memory, which is stored in RAM

#

(This applies to all instances btw)

glossy venture
#

so?

lavish hemlock
#

I'm

#

Responding to Limpeex

glossy venture
#

oh

#

when

lavish hemlock
#

What?

#

Anyway

#

So basically RAM is never persistent

#

When the JVM shuts down, all memory is deallocated, therefore the state of the program is lost

#

Through saving things to files, which are persistent memory stored on the hard drive, you can have the state persist when the JVM shuts down, i.e. when the server closes.

glossy venture
#

yeah

#

^

#

use a database or some kind of data language

#

you can also serialize the list using ObjectOutputStream

lavish hemlock
#

Databases are good if you're handling a lot of data or need data to be accessible by multiple servers, like with networks.

#

Although

#

A bit complicated for a beginner

#

Note that it's not a good idea to always save to a file. RAM is used because it's basically immediate, while reading/writing a file has some overhead (unless you absolutely over-engineer the fuck out of your code)

#

Sorry if that was a bit to take in :p

#

In summary:

Save your shit to a file when the server closes

slim kernel
#

Does anyone here have experience with pushing from IntelliJ to github?

noble lantern
#

its rather buggy at times

eternal needle
lavish hemlock
#

I think most people just use Git lol

eternal needle
#

'

noble lantern
#

your better off using Github Desktop

lavish hemlock
#

you're*

noble lantern
#

its discord

#

im not gonna use perfect grammar lol

lavish hemlock
#

Still gonna correct you

#

It's habitual

slim kernel
noble lantern
#

Thats gotta be the most aids thing to do

lavish hemlock
#

ew imagine pushing changes through the browser, god

eternal night
#

Imagine using a GUI for git

lavish hemlock
#

lmao

#

I used to use GitHub Desktop

#

my commits were quite clean

#

now I use Git

onyx fjord
eternal needle
slim kernel
#

Idk they said its easier cause intelliJ does most of it by it self

lavish hemlock
#

and now I have to push at least 3 times at the start of every project

#

bc I fuck something up

noble lantern
#

i would rather click 2 buttons to commit than sit there and type shit out anytime i wanna make a commit

onyx fjord
#

Desktop is a very poor app rn

noble lantern
#

how?

lavish hemlock
#

If it works it works

slim kernel
#

But anyway ... what branch do I push to?

onyx fjord
#

I ended up using cli for most of the stuff I do

noble lantern
#

Ive used it for well over a year now and no bugs at all

lavish hemlock
onyx fjord
#

It's not buggy just poor

lavish hemlock
#

Whichever one is available

noble lantern
#

idk what you mean by poor lol

kindred valley
#

but i failed

lavish hemlock
#

(I absolutely love activism that achieves nothing positive and is just pointless)

onyx fjord
#

GitHub uses master, GitHub desktop defaults to main

slim kernel
lavish hemlock
#

Yes :)

#

The Git Windows installer says so iirc

onyx fjord
#

World these days

summer scroll
#

I use IntelliJ to push commits, and I've never had any issues.

noble lantern
#

intellij git always bugs out for me idk why

onyx fjord
#

Gitkraken is nice but too overwhelming for new users

slim kernel
#

Okay thank you all :)

lavish hemlock
# onyx fjord World these days

They're too scared to offend people because god forbid some popular moron go and rant about how their VCS used a single innocuous word :p

onyx fjord
#

Master Yi

#

Let's cancel riot

lavish hemlock
#

"Master" is literally a fucking honorific lmao

onyx fjord
#

Master means like greatest at X thing

#

Master at chess etc

lavish hemlock
onyx fjord
#

Tho GitHub defaults to master and git to main and it's cancer as fuck

lavish hemlock
#

You don't really see it anywhere anymore, but it does exist.

#

So yeah, pointless change done out of some bullshit social politics thing idfk

#

Just made me go "But why?" when I first saw it.

onyx fjord
#

Why does programming go so far in politics

lavish hemlock
#

That is a fantastic question

onyx fjord
#

Cmon we only make software

lavish hemlock
#

Every time programming and politics collide

#

HELL

#

BREAKS

#

LOOSE

#

I've seen it too many times

onyx fjord
#

Oh yea

#

Those npm protestor morons

lavish hemlock
#

Like holy shit just keep your fucking politics out of our programming goddamn

noble lantern
#

ohyeah

eternal night
#

github defaults to main these days

lavish hemlock
onyx fjord
#

Hey ima add file encryptor to my npm module because protest

onyx fjord
lavish hemlock
#

It was a file wiper

#

Not encrypter

onyx fjord
#

And it happened before to colors i think

lavish hemlock
#

Oh interesting

#

Yeah I remember hearing about that

onyx fjord
#

People ended up forking it and kicking creator out

#

L

lean escarp
#

if i have a question regarding sipgot settings i can ask it here right?

lavish hemlock
#

Was funny seeing the maintainer of node-ipc go and close all the GitHub issues that called him out on his bullshit lol

onyx fjord
#

Those idiots end their career in matter of seconds

lavish hemlock
onyx fjord
#

Yeah

lavish hemlock
#

God the best part is uhh

#

I first saw his project uhh

#

peace-not-war or smthn

#

Which I then traced back to node-ipc cuz of issues

onyx fjord
#

That's the virus module

#

It encrypts Russians

lavish hemlock
#

Nah node-ipc is the wiper, peace-not-war is basically just spam

onyx fjord
#

Some motherfucker make pull request to also encrypt polish and French people

lavish hemlock
#

And it also wipes Belarusians btw

#

And

onyx fjord
#

But it was closed

lavish hemlock
#

Anyone who happens to be close to the area of Russia/Belarus

onyx fjord
#

Without merging

lavish hemlock
#

Since geolocation is not perfect

onyx fjord
#

Belarus is Russia

lavish hemlock
#

spouting some bullshit message about

#

you guessed it

#

"peace not war"

#

Then it was accidentally picked up as a dependency of a lot of major projects...

#

such as vue-cli

#

So yeah the main problem was just how it would save a file on every program run, if the file didn't exist

#

So basically it was kinda uhh

#

adware?

#

-ish?

onyx fjord
#

JavaScript developer ended war

#

Lmao

lavish hemlock
#

Surprised that guy's not in jail yet

#

At least

#

I don't think he is?

onyx fjord
#

It's illegal what he's done

lavish hemlock
#

Yeah

onyx fjord
#

He said himself that FBI raided him

lavish hemlock
#

Really cracks me up though

onyx fjord
#

Read first line of readme

#

Btw he looks like stereotypical programmer from memes

lavish hemlock
#

"War is not the answer, no matter how bad it is. War brings tragedy and destruction, ..." wipes Russian computers

onyx fjord
#

I don't even think it really affected anyone

lavish hemlock
#

There was an issue on node-ipc that suggested a human rights organization with a server stationed in Russia were actually affected by node-ipc

#

I'm not quite sure the validity of this statement

#

But I don't really have a reason not to believe them

#

Lemme see if I can find it...

onyx fjord
#

I hope he faces consequences

#

Like computer ban or something at least

#

Ofc some organisations look into what he's done

lavish hemlock
#

I mean even if this isn't real

#

it does pose really shine some light on how shit this could've been had it been real

#

Anyway yeah node-ipc was some fun drama

#

And a perfect example of why programming and politics do not mesh well

kindred valley
#

@lavish hemlock i stored it but when im trying to teleport player its not triggering

eternal needle
kindred valley
#

i stored players location to config. When im trying to reach it and teleport, its not triggering.

#

what can be the problem

smoky oak
#

@eternal needle
Wrong:

return !(bad_blocks.contains(below.getType())) || (block.getType().isSolid()) || (above.getType().isSolid());

Correct:

return !(bad_blocks.contains(below.getType()) || (block.getType().isSolid()) || (above.getType().isSolid()));
#

what fucked you up here is the way boolean operations work

eternal needle
#

Found it

smoky oak
#

:P

eternal needle
smoky oak
#

have you changed the code as i suggested?

eternal needle
#

yes

#

oh sorry

#

id did not update the plugin

smoky oak
#

is it possible to declare an HashSet<HashSet<T>>[]?

#

(i know i can use list here but its supposed to be immutable, but also instanticed inside the code)

eternal needle
#

i did still land in water but is not often

smoky oak
#

@eternal needle try printing out to chat/console the type of below. Maybe there's a water type you missed

eternal needle
#

nope its just water

#

and did check there is no more type of water

smoky oak
#

how about this: replace bad_blocks.contains with a !is_solid

glossy venture
smoky oak
glossy venture
#

oh yeah

#

generic array creation is a bit of a pain

#

but it is possible

smoky oak
#

well as i said above its immutable but generated in the code

eternal needle
smoky oak
#

its not generic

eternal needle
smoky oak
#

well and for other lbocks you can add another check later on if you really need to

#

tbh i have no clue why it wouldnt find all water

#

what i think is happening here is that the or is your problem

#

try inverting the statement

#

!bad_block_contains(below.getType()) && !block.getType().isSolid() && !above.getType().isSolid()

#

@eternal needle

eternal needle
#

ok testing it

simple silo
#
        World oww;
        World nw;
        World ew;
        if ((oww = Bukkit.getWorld("NW_OverWorld")) != null) {
            Bukkit.unloadWorld("NW_OverWorld", false);
            deleteWorld(oww.getWorldFolder());
        }
        if ((nw = Bukkit.getWorld("NW_Nether")) != null) {
            Bukkit.unloadWorld("NW_Nether", false);
            deleteWorld(nw.getWorldFolder());
        }
        if ((ew = Bukkit.getWorld("NW_TheEnd")) != null) {
            Bukkit.unloadWorld("NW_TheEnd", false);
            deleteWorld(ew.getWorldFolder());
        }
        World nwOverWorld = new WorldCreator("NW_OverWorld")
                .environment(World.Environment.NORMAL)
                .createWorld();
        World nwNether = new WorldCreator("NW_Nether")
                .environment(World.Environment.NETHER)
                .createWorld();
        World nwTheEnd = new WorldCreator("NW_TheEnd")
                .environment(World.Environment.THE_END)
                .createWorld();
``` why doesn't this delete the worlds?
smoky oak
#

you sure it doesnt just recreated them

simple silo
#

nope

#

they are just getting reloaded

#

if I join the world after the code ran, it remains the same world

wet breach
#

not sure what deleteWorld method looks like

#

however, you need to unload the worlds to actually delete them

simple silo
#
public void deleteWorld(File path) {
        if(path.exists()) {
            File[] files = path.listFiles();
            assert files != null;
            for (File file : files) {
                if (file.isDirectory()) {
                    deleteWorld(file);
                } else {
                    assert file.delete();
                }
            }
        }
        assert path.delete();
    }
simple silo
wet breach
#

the only world you wouldn't be able to unload however

#

is the overworld

#

or the default world of the server

simple silo
#

it isn't the default world