#help-development

1 messages · Page 666 of 1

hybrid turret
#

oooh nice

#

i forgot

#

lol

tender shard
#

in the proper GUI, the button was here, accessible with one click

#

but thanks

hybrid turret
#

ctrl + shift + k >>>>>

lilac dagger
#

it doesn't really matter tbh

#

as i said, same thing for most people

hybrid turret
#

minimizing mouse movement = less problems with ur body

#

like back, neck and sholder pain

eternal oxide
#

I claw my mouse so do very little arm movement

hybrid turret
#

i have a colleague that wrote his master exam in vim lmao

tender shard
#

there's soooo much free space at the top, why do they just remove buttons from there? an empty space is wasted space

hybrid turret
tender shard
hybrid turret
#

Something like this? (first line)

flint coyote
#

I like my Jetbrains furniture and have a screenshot of it as my desktop background /s

eternal oxide
#

Functional over pretty

hybrid turret
#

i generally agree

smoky anchor
hybrid turret
#

fuck u lmao

#

leave my verbose code alone :(

tender shard
#

professional tools should be cramped with buttons and stuff lol

flint coyote
#

steve has a point, use early returns / guard clauses

tender shard
# hybrid turret Something like this? (first line)

When you read this, chances are high that someone saw your code and decided that you did something that is considered horribly bad: using the arrow anti-pattern. What the arrow anti-pattern is Look at the following code: It looks like a huge arrow (>) symbol. It’s ugly, unreadable and hard to maintain. Now, let’s say...

smoky anchor
#

Also, use ChatColor instead of §
||Or better yet, components||

hybrid turret
#

why?

eternal oxide
hybrid turret
#

far more work

tender shard
#

because you're hardcoding a magic value that might change anytime

#

vanilla doesn't even use § anymore

sweet sonnet
#

whats a recommened way to store userdata? e.g i am making a report plugin and need to store user reports.

tender shard
hybrid turret
eternal oxide
#

depends on teh amount of data

hybrid turret
#

(which i could now put into the other method tbh)

tender shard
sweet sonnet
#

i was thinking sqlite

tender shard
sweet sonnet
#

are there any good tutorials?

hybrid turret
hybrid turret
tender shard
#
public void onSomeEvent(SomeEvent event) {
  if(!(event.getEntity instanceof Player)) return;
  if(!somethingElse()) return;

  ...
}
hybrid turret
#

bro my whole project is based on that verbose aah code

tender shard
hybrid turret
#

that would be a massive damn refactor

smoky anchor
hybrid turret
#

i mean i did have this in mind at some point

tender shard
#

well if it works now, keep it. but for future stuff, better make it right

hybrid turret
#

but it's a LOT of work...

hybrid turret
#

i hate if my code (in 1 project) is not in the same pattern

wooden hedge
#

why the tab completer for a command doesn't work? i registered the custom command tab completer but it just auto completes to my username

hybrid turret
#

i know the verbose code doesn't help with readability but since it's gonna be open source, it's supposed to be as readable as i can make it

undone axleBOT
#

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

hybrid turret
#

with options?

wooden hedge
wooden hedge
flint coyote
hybrid turret
#

because the default tabcompletion return onlineplayers

hybrid turret
vital ridge
#

I'm creating a reward system and you can get items but each item has it's own chance so you have a set chance to get a certain item. The way I'm planning to do it right now is that I'll make a list of 10 items, generate a random number between 0 and 9 and then you'll have 1-10 of getting whateveritem, then if the item you got from the list has it's getting chance set to lets say 1%, I'll generate another number between 1-10, and if it matches the old random number generated between 1-10 I'll give it to the player. Anyways idk if ya'll understand everything I just said, but I'm just asking if ya'll have any better ways I could do it?

wooden hedge
#
name: TikTok
version: '${project.version}'
main: org.shalevc1098.tiktok.Main
api-version: '1.20'
commands:
    tiktok:
        description: "TikTok Command"
        usage: /<command>```
hybrid turret
#

wellllll still

#

?nocode

undone axleBOT
#

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

smoky anchor
wooden hedge
#

here

#
@Override
    public void onEnable() {
        // Plugin startup logic
        config = new Config(this);
        config.saveDefaultConfig();
        if (server == null)
            setupWebServer();
    }

    private void registerCommands() {
        TikTokCommand tiktokCommand = new TikTokCommand();
        tiktokCommand.registerSubCommand("reload", new ReloadSubCommand());

        this.getCommand("tiktok").setTabCompleter(new TikTokTabCompleter(tiktokCommand.getSubCommands()));
        this.getCommand("tiktok").setExecutor(tiktokCommand);
    }```
smoky anchor
#

random question, does yaml care about the amountof leading whitespace ?

wooden hedge
#

idk

smoky anchor
#

so where is registerCommands called

sweet sonnet
#

your not calling ^^^^

wooden hedge
#

fu

#

i accidentally putted it inside the onDisable

hybrid turret
#

lol, happens

flint coyote
wooden hedge
#

my bad

hybrid turret
#

oh lmao

smoky anchor
wooden hedge
#

lol

hybrid turret
wooden hedge
#

btw another question: when rebuilding the plugin and reloading the server, i get alot of errors. i'm using jetty. is there a way to reload the server even after hotswapping the plugin without all these errors?

hybrid turret
#

what kinda errors?

flint coyote
hybrid turret
#

i don't think my code is horrible... just... verbose :|

wooden hedge
#

i'll send them here

hybrid turret
smoky anchor
#

for the love of god
burn this
throw this into a blazing volcano

hybrid turret
#

LMAO

#

my pretty arrow patterns :(

wooden hedge
#

okay

hybrid turret
#

also some of that is in progress of refactoring

smoky anchor
hybrid turret
#

yes.

#

but

wooden hedge
hybrid turret
#

errormessage-handling

smoky anchor
wooden hedge
#

lemme test with a brand new spigot server

smoky anchor
#

I am not saying that's the issue, just pointing out that you're asking in spigot DC server while running a paper MC server

flint coyote
hybrid turret
#

mhhhhhhhhhhhhhhhhhhh

#

chat gpt does goofy stuff with code

wooden hedge
vital ridge
#

How would I code so if you have a list of 10 items, you have 0.1% of getting a specific item out of it

wooden hedge
#

btw it happened again with spigot

vital ridge
#

Like Ik do have 1/10 chance I'll create a list of 10 items and generate a random number between 0 and 9

hybrid turret
#

that's what i meant

#

either sepearte ifs or checking the clauses twice just for the message

#

which is dumb

smoky anchor
# wooden hedge

idk what jetty or whatever is, but I think you have to close some connections or something ?
probably just wait for someone who knows what that is

smoky anchor
#

still better imo

wooden hedge
smoky anchor
#

then your reload might be wrong

hybrid turret
#

hmm makes sense tbh

wooden hedge
tall dragon
smoky anchor
#

I don't want to get burned alive here but
I use plugmanX to reload specifically my plugin
have not had any problems yet

tall dragon
#

plenty of resources on google

hybrid turret
#

oh god that's a lot of stuff to do... well i did similar large refactors (if i use it in the future i want the current stuff to be the same pattern.... for this project at least... because this is really important to me)

#

this project is pretty much how i started coding

#

and not only doing a little here and there but actually coding

smoky anchor
hybrid turret
#

yup

#

sorry lol

#

idk why i didnt think of that. i usually google first thing

smoky anchor
hybrid turret
clear panther
#

how to detect a player is wearing specifi armor?

#

UHm

pseudo hazel
#

check their inventory

smoky anchor
#

Does anyone know the progress on moving Material and other to classes ?
The feedback post has not had any activite in like a month and idk any other place for it.

clear panther
#

@EventHandler
public void onDamagePlayer4(PlayerInteractEvent event) {
if (event instanceof Player player)
if (player.getInventory().getHelmet() == SH || player.getInventory().getChestplate() == SC || player.getInventory().getLeggings() == SL || player.getInventory().getBoots() == SB) {
if (player.getEquipment().getHelmet().getItemMeta().getDisplayName().equals(ChatColor.GREEN + "Stone Helmet")) {
if (player.getEquipment().getChestplate().getItemMeta().getDisplayName().equals(ChatColor.GREEN + "Stone Chestplate")) {
if (player.getEquipment().getLeggings().getItemMeta().getDisplayName().equals(ChatColor.GREEN + "Stone Legging")) {
if (player.getEquipment().getBoots().getItemMeta().getDisplayName().equals(ChatColor.GREEN + "Stone Boots")) {
if (player.isSneaking()) {
player.addPotionEffect(new PotionEffect(PotionEffectType.DAMAGE_RESISTANCE, 60, 2));
player.addPotionEffect(new PotionEffect(PotionEffectType.SLOW, 60, 2));
}
}
}
}
}
}
}
will it work @pseudo hazel

eternal oxide
#

?codeblock

undone axleBOT
#

You can use the discord code block format to display code or just text in a more pleasing way:
```java
public class MyPlugin extends JavaPlugin {
@Override
public void onEnable() {

}

}```
Becomes:

public class MyPlugin extends JavaPlugin {
    @Override
    public void onEnable() {

    }
}```
smoky anchor
#

oh there's a command for it lol

pseudo hazel
#

will it work is a weird question

#

you should ask your server if it will work, not me

smoky anchor
#

my guess is no, since you're comparing ItemStacks with ==

pseudo hazel
#

also onDamagePlayer4 as a name makes me worried you have 3 others

smoky anchor
#

also, please, use early returns

flint coyote
#

so many arrows today

smoky anchor
#

And check isSneaking like second
better performence wise

tall dragon
#

😒

smoky anchor
#

oh god, I haven't even noticed that, I assumed it's the damage event XD

pseudo hazel
#

lol

tall dragon
#

or the fact its being checked if the event is a Player object

pseudo hazel
#

this wouldnt even be something you do in an event, but rather a runnable, assuming its just a passive effect

flint coyote
pseudo hazel
smoky anchor
#

can't wait to rename my Stone Boots
"oh, why do I no longer get the effects"

#

?pdc

hybrid turret
hybrid turret
#

lmao

clear panther
#

ikrr

icy beacon
#

why would event be instance of Player

#

this makes negative sense

hybrid turret
#

ykw fine i'll do it. i'll rewrite every single damn command lmao

smoky anchor
#

And the world thanked you

placid moss
#

is that php ew

pseudo hazel
#

if thats the only thing you're alarmed by you need a new set of brains

pseudo hazel
#

idk

#

depends on how you say it i guess

#

brain or brains

#

it sounded more fun than "a new brain"

placid moss
#

🧠

sweet sonnet
#
if (!config.getBoolean("reports.enabled", true)) {
    reporter.sendMessage("§c§l(!) §cReports are disabled!");
    return true; // ???
}

should i be returning true if i want this message to be sent then the command to end?

tall dragon
#

yes

smoky anchor
#

Based on docs:

 true if a valid command, otherwise false```
sweet sonnet
#

can i not just return true at the end of the command?

#

if i handle everything like not enough args, etc

remote gazelle
#

Does getFullTime() in World class returns tick?

tall dragon
#

most people handle their own failed command messages so if you do that, just return true

smoky anchor
undone axleBOT
remote gazelle
#

jk

smoky anchor
#

The docs on that one are not the best

remote gazelle
#

ima try rn

smoky anchor
#

imatree rn

remote gazelle
#

shutup

#

:<

smoky anchor
#

:D sry

clear elm
#

Okay my Idea is you can make /duel than for example 1b then someone can accept your duel like a Coinflip and you fight in an arena with the loot you have in the inventory winner gets all the money. Could anyone create an plugin like this ?

flint coyote
#

Sure, someone could

#

?services

undone axleBOT
remote gazelle
#

xD

clear elm
#

I can’t Create an forum

flint coyote
#

Well then work on your reputation. This is not the place for commissions

#

I think you need a small amount of answers on threads to post there

wooden hedge
#

How can i change command executer name?

#

In Bukkit.dispatchCommand

icy bone
#

Uh guys, I use this code to increase the speed of a player:

        AttributeModifier speedModifier = new AttributeModifier(
                "speed-boost", 
                2.5, 
                AttributeModifier.Operation.MULTIPLY_SCALAR_1
        );

        player.getAttribute(Attribute.GENERIC_MOVEMENT_SPEED).addModifier(speedModifier);

I made an error by putting 2.5 because yeah that doesnt make the player 2.5 times faster but alot faster. And i wanted to remove this from the player but its not happening anymore. I tried the same code but with .removeModifier. Nothing happend, rejoining, nothing happend, restart server, nothing happend. I even tried /attribute and it says its set back to 0.1 but i keep having a huge amount of movement speed, Does someone know how i can reset this?

smoky anchor
#

delete your player data file :D

icy bone
#

There is no other way?

hybrid turret
#

js

smoky anchor
#

it is definitely a way
no idea if there is other way

onyx fjord
#

p 😭

hybrid turret
#

yeah

#

lazy

icy bone
#

Ill try thgat

hybrid turret
wooden hedge
hybrid turret
#

"just saying"

#

not javascript xD

icy bone
#

Good to know

hybrid turret
icy bone
#

Thats kidn good to know for some special debuff in a minigame haha

#

The player.setWalkSpeed() also doesnt fix it

wooden hedge
#

My bad😂

hybrid turret
#

i mean deleting the playerdata is mandatory anyway

#

since the attribute is saved there

#

but for the next time you can just use setWalkSpeed and setFlightSpeed

icy bone
#

Yeah i think thats better haha

hybrid turret
# hybrid turret

these are the default values btw.
so i recommend having an argument like "reset" that does what is shown in the screenshot

smoky anchor
hybrid turret
#

sorry :(

#

nvm then @icy bone

icy bone
#

Ah okay

#

I assume i just only the delete the playerdata in the world where this is happening?

hybrid turret
#

maybe steve can help u then

#

i think so

icy bone
#

Cuz i got multiple worlds

#

Both playerdata files? like the .dat and .dat_old

hybrid turret
#

i don't think .dat_old really matters in this case but i've never done that really so yeah

icy bone
#

Ah okay

#

I did delete both hahaha

#

And it worked

#

Thank you for the information guys

wooden hedge
grizzled oasis
#

question about mongodb, how can i create a sub category, json example

{
  "buildinfo": {
    "Hellow": "hello"
  }
}
#

i tried searching on the internet without answers

tall dragon
glossy venture
tall dragon
#

you can simply nest bson docs

vital ridge
grizzled oasis
tall dragon
#

i'd do it like this

        Document topLevel = new Document()
                .append("Foo", "Bar");
        
        Document nested = new Document()
                .append("Foooo", "Bar");
        
        topLevel.append("Nest", nested);
#

it might be similar dont know that particular wrapper

grizzled oasis
tall dragon
#

looks like that library just does it for you. so if you start nesting objects it would probably store them like that as well

glossy venture
#

yeah

grizzled oasis
glossy venture
#

looks like it should be roughly supported

glossy venture
#
record A(String foo, B nested) { }
record B(String bar) { }
#

the library should convert that to

{
  "foo": ...,
  "nested": {
    "bar": ...
  }
}
tall dragon
#

yea that ^

grizzled oasis
tall dragon
#

yea for example

glossy venture
#

yeah

tall dragon
#

uuid probably wont be nested tho

#

i assume they just convert that

glossy venture
#

uuid will probably be stored as a byte array

grizzled oasis
glossy venture
#

i hope it is

tall dragon
#

would you absolutely require that to be nested though?

#

seems odd

grizzled oasis
#

i don't understand one thing how can i integrate it on the code tho?

glossy venture
#

it should do it automatically

tall dragon
#

well you can wrap the uuid in ur own object and then it would probably be nested but that makes ur code... questionable xd

glossy venture
#

check the docs of the lib ur using

#

you shouldnt nest the uuid

grizzled oasis
glossy venture
#

idk if that would even be filterable

#

goofy

tall dragon
#

i guess they still looking to improve the library in the area ur looking for ;s

glossy venture
#

yh but that should mean its already roughly supported

grizzled oasis
glossy venture
#

you should prob try to find a more active odm

#

library

#

then

tall dragon
#

i'd just depend on the official library and make it myself tbh

glossy venture
#

made an overengineered in the wrong place odm in typescript and never used it again

#

but it was fun at least

tall dragon
#

worth it!

glossy venture
#

i enjoy making systems more than writing content

tall dragon
#

honestly, same lmfao

glossy venture
#

bro ima spend like a month reinventing the wheel 26 times and then quit the project lol

tall dragon
#

but at least u learned shit right!

glossy venture
#

definitely

tall dragon
#

shit ur never going to use again

#

probably

grizzled oasis
#

if i try adding it by myself probably

#

seems not that hard

tall dragon
#

serializing/deserialing with mongo rlly isntr that difficult

#

just takes some looking at their docs

#

which are pretty good

glossy venture
#

mixed feelings abt bytecode analysis/transformation

glossy venture
#

but GETFIELD is legit slower than Unsafe.getObject(...)

#

prob due to some stupid access checks

#

just do that while linking

tall dragon
glossy venture
#

yeah

#

doesnt even check the pointer lol

#

you can cause some native errors with that

#

EXCEPTION_ACCESS_VIOLATION

#

love that

tall dragon
#

ah yes

#

havent managed to get one of those yet

glossy venture
#

i have while writing a graphics library

#

how is opengl so unstable

#

that when you pass a byte wrong stride

#

it crashes everything

#

didnt even use unsafe

tall dragon
#

ohh interesting

#

ive been making a little gameengine

#

also with opengl

glossy venture
glossy venture
tall dragon
#

so yea totally not reinventing the wheel either haha

glossy venture
#

lmao

tall dragon
#

opengl is quite interesting to learn though

glossy venture
#

yeah

tall dragon
#

but it does work very weird in java sometimes

#

since its not rlly a java library haha

glossy venture
#

its not that difficult if you understand the order of your calls and some weird parameters which dont have like any documentation for some reason

glossy venture
#

scuffed foreign memory api

tall dragon
#

honestly no clue

#

look at all the shit u need to get something proper on the screen xd

glossy venture
#

lmao

#

magic numbers

#

nice

#

nah but i think i had some kind of VertexFormat and VertexBuilder or smth

#

so you can dynamically change the vertex data format

#

which was a pain

#

oh yeah i remember this lamo

tall dragon
#

lmfao ye i just saw

glossy venture
#

someone gonna develop a broken jvm to get that

tall dragon
#

yeaa this is a real piece of art isnt it

glossy venture
#

pretty sure it worked in the end tho

#

i displayed a triangle

#

no way guys

tall dragon
#

were u doing 3d?

#

or 2d

glossy venture
#

3d is just some shader modification

#

but 2d for testing

#

3d wouldnt be difficult tho you can pass values to the shader and shit

tall dragon
#

if only i knew better how glsl shaders worked

#

i know the basics but the rest is black magic to me

glossy venture
#

this is what it looked like

tall dragon
#

.vsh files?

#

i guess u can just make the extention up urself xd

glossy venture
#

isnt that standard

#

i saw it in optifine shader packs lo

#

l

tall dragon
#

mine were called .glsl with vertex and fragment shader

glossy venture
#

ah

#

github accepts .vsh and .fsh too

tall dragon
#

and i saw .frag as well

#

with just fragment

glossy venture
#

its up to you how u name ur files tho

#

you could name it myshader.dll

tall dragon
#

still waiting for an intellij plugin that can preview my shader code like visual studio can

glossy venture
#

damn yeah

#

are you making a 3d game engine?

#

or just 2d

#

and is it open source

tall dragon
#

naaah just 2d

#

and its not open source yet

glossy venture
#

aigh5

#

ah k

tall dragon
#

i could throw it on github sometime tho

#

these are all acceptable i guess

#

ahh yes documentation

#

lmfao

quaint mantle
#

?paste

undone axleBOT
quaint mantle
#

thanks

dusky crane
#

What's a better way to give other classes access to the plugin class? Dependency injection or a public static instance?

dusky crane
#

I've used dependency injection in some other stuff.

#

a public static instance of the plugin seems a lot easier to manage.

#

Issues with creating custom worlds

tall dragon
dusky crane
#

private Main main everywhere and in the constructors too.

tall dragon
#

but using di is a lot cleaner and easier to work with in the long run imo

dusky crane
hollow beacon
#

i got the most annoying code error ever

#
public void addAllQueuedCommands(List<String> queuedCommands) {
        Bukkit.getLogger().info("QUEUE IN MODEL" + this.queuedCommands.toString());
        queuedCommands.forEach(command -> {
            if (command == null || command.isEmpty()) return;
            Bukkit.getLogger().info("ADDING COMMAND " + command + " TO QUEUED COMMANDS");
            this.queuedCommands.add(command);
        });
        Bukkit.getLogger().info("QUEUE IN MODEL AFTER" + this.queuedCommands.toString());
        this.changed = true;
    }
#

result:

[14:00:23 INFO]: QUEUE IN MODEL[]
[14:00:23 INFO]: ADDING COMMAND give %player stone TO QUEUED COMMANDS
[14:00:23 INFO]: ADDING COMMAND give %player stone TO QUEUED COMMANDS
[14:00:23 INFO]: QUEUE IN MODEL AFTER[, give %player stone, give %player stone]
#

somehow it adds an empty entry

smoky anchor
#

are you sure it does not contain this empty entry in the beggining ?
either sysout the size of the list or iterate and print all elements

hollow beacon
#

ah yeah somehow something is in there

#

ill just filter out the empty values then

smoky anchor
#

I would suggest looking into how it got there in the first place

hollow beacon
#

ah i know why

hybrid turret
#

Is this better? (less arrowy)

#

for reference

tender shard
smoky anchor
#

A tad bit ig
Btw, I think IntelliJ is yelling at you that you have some duplicate code

hybrid turret
#

yeah

#

that's bc both those screenshots are in the same class

tender shard
#

instead of doing almost the same thing for enabling/disabling death, why not just reuse the same code

quaint mantle
lilac dagger
#

rather than the nested ifs

hybrid turret
quaint mantle
#

my honest reaction

smoky anchor
#

fun fact, you can do

if (!(object instanceof Player player)) return;
player...;
tender shard
#
GlobealBooleanUtils.setDeathEnabled(deathEnabled);
String message = deathEnabled ? "msg enabled..." : "msg disabled...";
for(Player player : Bukkit.getPlayers()) {
  player.sendMessage(message);
}
smoky anchor
#

Yes!

hybrid turret
#

i thought u can't that's why i nested that one

lilac dagger
#

you def can, just make sure you don't return code that is below an if else

hybrid turret
#

i've seen this pic 3x today now

hybrid turret
#

i'm getting sick of it

smoky anchor
#

so fix your code some more XD

hybrid turret
#

i started this project years ago no wonder it's shit

#

at least code style wise

lunar wigeon
#

if you make your code more readable it's easier to fix 🙂

tender shard
#

usually stuff can be improved whenever you see the same line more than once

hybrid turret
#

the functionality is (mainly) okay

hybrid turret
#

u telling people not to talk but use the skull emoji

#

" 💀 "

tender shard
#

I also wonder why you're checking the command's name in the first line?

hybrid turret
#

right

lilac dagger
hybrid turret
grizzled oasis
#

Just asking the same question about https://github.com/sammwyy/milkshake, i tried adding support to it but java wont help me,

trying making a nested inside requires me to user the class User for example to access it

public static void CreateUser() {
        User user = new User();
        user.name = "Test";
        user.uuid = 0;
        user.test.uwu = "Hello World!";
        user.save();
    }

public class User extends Entity {
    @Prop
    public String name;

    @Prop
    public int uuid;

    public static class test {
        public String uwu;
    }
}

IntelliJ: Static member 'no.database.mongodb.example.User.no.database.mongodb.example.User.test' accessed via instance reference

quaint mantle
hybrid turret
#

bro is actually annoying

quaint mantle
hybrid turret
#

are ppl allowed to ping staff here

tender shard
hybrid turret
#

to deal with him

hybrid turret
grizzled oasis
#

so it needs to be static

lunar wigeon
smoky anchor
lunar wigeon
#

I put static everywhere

grizzled oasis
hybrid turret
grizzled oasis
lunar wigeon
#

its called clean code

quaint mantle
north nova
#

thats a joke right

grizzled oasis
#

so about this nested class giving unresonable errors

tender shard
#

a static class means that it doesn't need an instance of the declaring class

lunar wigeon
#
for (int i = 0; i < 100; i++) {
            if (p.getInventory().containsAtLeast(new ItemStack(Material.DIAMOND), 9)) {
                p.getInventory().removeItem(new ItemStack[]{new ItemStack(Material.DIAMOND, 9)});
                p.getInventory().addItem(new ItemStack[]{new ItemStack(Material.DIAMOND_BLOCK, 1)});
            }
            if (p.getInventory().containsAtLeast(new ItemStack(Material.EMERALD), 9)) {
                p.getInventory().removeItem(new ItemStack[]{new ItemStack(Material.EMERALD, 9)});
                p.getInventory().addItem(new ItemStack[]{new ItemStack(Material.EMERALD_BLOCK, 1)});
            }
            if (p.getInventory().containsAtLeast(new ItemStack(Material.GOLD_INGOT), 9)) {
                p.getInventory().removeItem(new ItemStack[]{new ItemStack(Material.GOLD_INGOT, 9)});
                p.getInventory().addItem(new ItemStack[]{new ItemStack(Material.GOLD_BLOCK, 1)});
            }
            if (p.getInventory().containsAtLeast(new ItemStack(Material.IRON_INGOT), 9)) {
                p.getInventory().removeItem(new ItemStack[]{new ItemStack(Material.IRON_INGOT, 9)});
                p.getInventory().addItem(new ItemStack[]{new ItemStack(Material.IRON_BLOCK, 1)});
            }
            if (p.getInventory().containsAtLeast(new ItemStack(Material.NETHERITE_INGOT), 9)) {
                p.getInventory().removeItem(new ItemStack[]{new ItemStack(Material.NETHERITE_INGOT, 9)});
                p.getInventory().addItem(new ItemStack[]{new ItemStack(Material.NETHERITE_BLOCK, 1)});
            }
        }
#

why does it lag?

#

16 tps

smoky anchor
#

this is not a serious question, right

hybrid turret
#

why are you checking 100 times for that?

lunar wigeon
#

to remove 100 times items

#

as many as they have

north nova
#

yepo

smoky anchor
#

Do that when item enters the inventory
And only until they don't have the items

lunar wigeon
#

I use it in BlockBreakEvent

tender shard
hybrid turret
#

but why 100, am i missing something???

lunar wigeon
lunar wigeon
tender shard
smoky anchor
hybrid turret
#

well you're using it in a BlockBreakEvent, right?

tender shard
hybrid turret
#

This is fired EVERYTIME you break a block anyway

#

so checking once is def enough, no?

hybrid turret
hybrid turret
smoky anchor
#

well do you need player for the else ?

hybrid turret
#

nnnnnnnnnnnnnnnnnnno

#

but stilllll

smoky anchor
#

? ? ?

hybrid turret
#

hold on

#

and i don't get how i'm gonna get around that instanceof nesting

north nova
#

????

hybrid turret
#

okay sorry i'll shut up

#

damn what is it with today

quaint mantle
#

How could I calculate the locations to get into a player?

smoky anchor
hybrid turret
#

line 28

north nova
quaint mantle
#

I can't use pathfinding

#

I just want to make the entity slowly rotate into the players position in real time

smoky anchor
# hybrid turret line 28

Uuhhh
hmm
Honestly... there is a shit load of duplicate code
why differentiate between Player and CommandSender
All you do is send message and test if it is in OnlinePlayers
It is literally the same result, doesn't matter if it is Player or CommandSender I think

#

ok, you test if player has permission, just make a method that takes in CommandSender and do the toggle there

hybrid turret
#

the original reason for me putting that instanceof there is for the permission check

north nova
#

?????

#

man just learn programming

#

this code is

#

horrible

#

sorry but

#

it is

hybrid turret
#

istg fuck you

quaint mantle
#

xD

smoky anchor
#

I'd rewrite it for you, but im at work and I get home in like 2 hours :D

eternal night
#

honestly, if you don't have a single useful thing to add, not typing anything might be the better tactic for you there noobdog

north nova
#

man

#

what do you mean

#

like

#

you're expecting people

#

to help you fix your code

#

when you have no idea what you're doing

hybrid turret
#

BRO

north nova
#

then you're the one saying fuck you?

eternal night
#

If you don't want to be the one helping

#

don't help

hybrid turret
#

have you ever heard of the proccess of FUCKING LEARNING

#

human trash

north nova
#

lol

eternal night
#

no need to flame people when others were trying

hybrid turret
#

thanks lynx

north nova
#

i was actually re-writing his code to show how to properly do it

#

when ALSO commenting that he should learn programming before asking stuff

#

but i guess you're learning by asking every possible there is, even if it's a google search away

#

: D

languid urchin
#

They have a point, developing a plugin as a first project is not a good idea

hybrid turret
#

yall gotta see: i started writing this when i had no idea about coding. legit 0. i did stuff from tutorials.
yes i learnt a lot in that time but i obv didn't learn everything. also because there was a lot of pause between coding sessions (e.g. bc of me graduating and stuff)

hybrid turret
north nova
#

man

hybrid turret
#

lol

north nova
#

whatever

#

im the human trash

#

enjoy learning code by fucking begging others to help you on the most basic thing

hybrid turret
#

yeah, you're trash talking

hybrid turret
smoky anchor
#

begging
we essentially got him to improve his code lol

languid urchin
#

but did he understand why? If not, it was useless

hybrid turret
#

also the only thing i was acc asking is how to get my code style to be proper... code style

hybrid turret
north nova
#

well you learn basic logical programming:)

hybrid turret
#

that's how i learn. i let people explain ONCE, make notes and then know

languid urchin
#

you won't always be able to rely on other people for learning

#

a lot of programming involves reading documentation and guides on your own

hybrid turret
#

i know

#

that wasn't supposed to only apply to ppl

north nova
#
            GlobalBooleanUtils.setDeathEnabled(!GlobalBooleanUtils.getDeathEnabled());

            Bukkit.getOnlinePlayers().forEach(loopPlayer -> {
                if(loopPlayer.getUniqueId().equals(player.getUniqueId())) {
                    return;
                }
                
                loopPlayer.sendMessage(ServerSystem.getPluginPrefix() + "§b" + player.getName() + " §7has " + (GlobalBooleanUtils.getDeathEnabled() ? "§aactivated" : "§cdeactivated") + "§3noDeath§7.");
            });```
hybrid turret
hybrid turret
smoky anchor
hybrid turret
#

one thing i wanna say: i didn't use forEach bc idk i don't like it. idek why but i just don't lol

north nova
#

it doesn't really matter in ur case

hybrid turret
#

that's why i used the enhanced for loop

north nova
#
        if (sender instanceof Player player && !player.hasPermission("therave.activate.nodeath")) {
            sender.sendMessage("Permission");
            return true;
        }


        if (args.length != 0) {
            sender.sendMessage("Syntax");
            return true;
        }

        GlobalBooleanUtils.setDeathEnabled(!GlobalBooleanUtils.getDeathEnabled());

        Bukkit.getOnlinePlayers().forEach(loopPlayer -> {
            if (loopPlayer.getUniqueId().equals(player.getUniqueId())) {
                return;
            }

            loopPlayer.sendMessage("[Prefix]" + "§b" + player.getName() + " §7has " + (GlobalBooleanUtils.getDeathEnabled() ? "§aactivated" : "§cdeactivated") + "§3noDeath§7.");
        });
    }```
#

here

#

is ur properly structured code

eternal night
#

commandSender is Permissionable

hybrid turret
#

that is

#

a lot less

lunar wigeon
#

no one uses forEach if you can use for each

north nova
#

i justlike lambdas

#

forEach/for is irrelevant in this code

hybrid turret
#

that's just prefecence whatever

eternal night
#

whats the point of the instanceOf

north nova
#

ur not using anything inside the lambda that's outside of the lambda

north nova
eternal night
#

ah

hybrid turret
eternal night
#

yea, if you dont care for that to be a player, hasPermission is a method available on all CommandSender

smoky anchor
eternal night
#

welll

#

usually you won't want anyything but a player to execute your stuff

#

given you might need their uuid later

quaint mantle
#

I want to execute myself

north nova
hybrid turret
north nova
#

streams are powerful

hybrid turret
eternal night
#

Well yea

#

if your command can work from the console

languid urchin
#

A server console doesn't have e.g. a UUID

north nova
#

think about a gui

eternal night
#

then go for it

north nova
#

a console can't open a gui

#

so you'd need to check if the sender is a player or not

#

or entity rather

eternal night
#

but if your command needs stuff like a gui ^ or you want to do stuff based on the location etc

languid urchin
#

Say a command that teleports you somewhere, wouldn't make sense for a console to be able to run that

north nova
#

it would

#

if it has arguments

#

if you can also use it to teleport somebody else

languid urchin
#

yeah, hence the "telports you somewhere"

north nova
#

🫢

smoky anchor
#

let's teleport commandblocks or real servers

#

teleport the server files around the drive :D

short raptor
#

In command, you can do:
Brain : { memories : { "minecraft:dig_cooldown" : { value : {}, ttl : 1000000L } } }
How can we do this in spigot? Or should I just call the command through my plugin, is that easier?

languid urchin
#

Huh?

north nova
#

lol

short raptor
#

Causes warden to not dig

north nova
#

use events

eternal night
#

LivingEntity#setMemory(org.bukkit.entity.memory.MemoryKey,T)

hybrid turret
eternal night
#

is the method you are after

hybrid turret
#

but only /tp player player

#

okay

#

not teleport yourself

eternal night
#

tho it looks like spigot is missing that memory key KEKW

hybrid turret
#

but acces the tp command to teleport other players around

north nova
#

also what u can do

hybrid turret
north nova
#

to make everything easier

eternal night
#

yea

north nova
#

use aikar's command framework

eternal night
#

open an issue on their tracker

north nova
#

or cloud command framework

#

or any command framework

eternal night
#

should be a terribly easy fix

north nova
#

vanilla command handling sucks

eternal night
#

Tho

#

Actually not, they don't have the concept of a MemoryKey<Unit>

#

I guess EntityPoseChangeEvent is your friend then

#

ugly but works too

short raptor
#

I just went on google again and I stumbled upon an NMS method, should I use that or pose event

#

((CraftWarden) warden).getHandle().getBrain().setMemoryWithExpiry(MemoryModuleType.DIG_COOLDOWN, Unit.INSTANCE, Long.MAX_VALUE);

eternal night
#

can just do that yea

short raptor
#

Okok

eternal night
#

if you already use NMS

north nova
#

yeah you need nms for that

#

u need buildtools

short raptor
#

I never touched nms tho

eternal night
#

then maybe not the vibe loil

short raptor
#

Ok

north nova
#

why not

short raptor
#

I'll use pose event lol

north nova
#

u might as well learn at some point

#

do it now

#

better now than later

eternal night
#

I mean

#

NMS setup for something that can be solved via API

#

is not the 5head move

north nova
#

overcomplicating things is my specialty

eternal night
#

I mean, you do you

smoky anchor
#

Does anyone know the progress on moving Material and others to classes ?
The feedback post has not had any activity in like a month and idk any other place for it.

eternal night
#

welp that even isn#t cancellalbe

#

so yea

#

NMS it is

#

and pls open an issue on the jira so someone can implement proper API for this

young knoll
#

What’s not cancellable

eternal night
#

EntityPoseChangeEvent

short raptor
#

PoseEvent isn't cancellable

#

lol

#

yeah

young knoll
short raptor
#

I just found

young knoll
#

Ah

short raptor
#

In the mean time, I'll just make my plugin run a command

#

Easiest way 🤷

smoky anchor
young knoll
#

There’s been talk of making some new apis that leverage the changes to get people more hyped

smoky anchor
#

that sounds interesting, where

upper hazel
#

I'm wondering, what kind of texture packs with x ray? Is not it
is there x ray or is it just texture packs

hybrid turret
#

what

#

i don't understand the sentences

upper hazel
#

texture pack with x ray

hybrid turret
#

yes, what is with that?

upper hazel
#

x ray exists in texture pack or this just package

#

this cheat?

hybrid turret
#

i don't think this is really the right server to ask this on, but anyway:

if you mean if using an x-ray texture pack is considered cheating, i'd say yes. at least for most servers. depends on the server rules of course.

And if you mean if x-ray is made using texture packs: yes. mostly. there are mods where you can make adjustments while the game is running but that's modded minecraft only

#

you basically have transparent pngs for most textures.

upper hazel
#

I mean in the texture pack itself there is a cheat or is it a regular texture pack that works and SIMULATES x ray

languid urchin
#

there are both x-ray texture packs and clients that give you x-ray without a texture pack, if that's what you're asking

#

you can use both, and both are considered cheating my basically all servers

upper hazel
#

I'm just wondering, you can't make the blocks transparent even if you put the glass texture, because only the texture changes and not the transparency property

#

but there are such texture packs, which means there is a cheat inside, yes
?

small current
#
    @Override
    public void setTag(ItemStack stack, String tag) {
        ItemMeta meta = stack.getItemMeta();
        PersistentDataContainer pdc = meta.getPersistentDataContainer();

        pdc.set(KEY, PersistentDataType.STRING, tag);
        stack.setItemMeta(meta);
    }

    @Override
    public boolean hasTag(ItemStack stack) {
        return stack.getItemMeta().getPersistentDataContainer().has(KEY, PersistentDataType.STRING);
    }

why hasTag is returning false on a tagged item

dusky crane
#

I've found out that whenever I generate a world using this custom generator the server freezes.

    @Override
    public ChunkData generateChunkData(World world, Random random, int chunkX, int chunkZ, BiomeGrid biome) {
        ChunkData data = Bukkit.createChunkData(world);
        data.setRegion(0, 0, 0, 15, 0, 15, Material.BEDROCK);
        data.setRegion(0, 35, 0, 0, 60, 0, Material.STONE);
        data.setRegion(0, 61, 0, 0, 64, 0, Material.DIRT);
        for (int x = 0; x < 15; x++) {
            for (int z = 0; z < 15; z++) {
                for (int y = 1; y < 35; y++) {
                    double noise = random.nextGaussian();
                    if (noise < 0.1) {
                        data.setBlock(x, y, z, Material.DIAMOND_ORE);
                    } else if (noise < 0.3) {
                        data.setBlock(x, y, z, Material.LAVA);
                    } else if (noise < 0.5) {
                        data.setBlock(x, y, z, Material.GOLD_ORE);
                    } else if (noise < 0.9) {
                        data.setBlock(x, y, z, Material.IRON_ORE);
                    } else if (noise < 0.95) {
                        data.setBlock(x, y, z, Material.LAPIS_BLOCK);
                    }
                }
                if (random.nextGaussian() < 0.1) {
                    world.generateTree(new Location(world, chunkX * 16 + x, 64, chunkZ * 16 + z), TreeType.BIRCH);
                }
            }
        }
        return data;
    }

}```
smoky anchor
north nova
austere cove
#

world.generateTree(new Location(world, chunkX * 16 + x, 64, chunkZ * 16 + z), TreeType.BIRCH); don't do this

zealous osprey
#

Sorry for the ping, but I figured out why my values were off in the web-editor.
It's cause JS converts everything to floats/doubles, meaning it legit had rounding errors with large long values like the ones I was trying to calculate/display.

dusky crane
#

Could that be causing the issue?

small current
#

what are you talking about they are my own methods

#

why am i calling a method that i made?

north nova
#

lol

#

okay bro 👍

small current
#

bruh what

small current
north nova
#

as i said

smoky anchor
#

It should, are you correctly updating the item afterwards tho?

north nova
#

have you checked that the item actually has the tag you're trying to apply?

#

obviously, if the method returns false, then the tag is not being set

small current
#

im tagging an item

#

and giving it to a bunch of players

#

should i clone it or something

north nova
#

show us how

dusky crane
small current
#

public void giveItem(Player player) {
player.getInventory().setItem(slot, stack.clone());
}

north nova
#

perhaps show the full code?

small current
#

what about the full code

north nova
#

no one will be able to help if you're not showing what what you're doing

small current
#

idk what part should i show

north nova
#

the setTag and hasTag methods should work, so there's something else that you're doing wrong

small current
#

i tag an item

north nova
#

all relevant parts?

#

show where u initialize the item, how you initialize it, when you give it, what tag u use

austere cove
small current
#
    public ItemBuilder modify(Consumer<ItemStack> consumer) {
        consumer.accept(item);
        return this;
    }
        ITEMS.put(name, new Item(
                new ItemBuilder(type)
                        .setDisplayName(display)
                        .setGlowing(glowing)
                        .setLore(lore)
                        .modify(stack -> identifier.setTag(stack, name))
                        .build(),
                slot,
                actions,
                sound,
                message
        ));
#

the second one is called onEnable

#

ok i got whats wrong

#

nvm

north nova
#

lol

upper hazel
final monolith
onyx fjord
#

is it possible to manually register a listener without the @EventHandler annotation?

dusky crane
#

What's a good way to populate a custom world with trees?

north nova
#

it is possible

compact haven
#

everything is possible in Java

#

there's an array of RegisteredListener[] or whatever inside of HandlerList

#

just reflectively insert into that

#

uh maybe it's not there

#

it's somewhere, I did this before

onyx fjord
#

hmm okay ill have a look

ivory sleet
#

Or use PluginManager::registerEvent along with ur own EventExecutor

echo basalt
#

I'd start by making a basic abstraction

compact haven
#

oh

echo basalt
#

And a shitty impl

compact haven
#

there's literally support for it

ivory sleet
#

Yeaa (:

compact haven
#

first W of the century for spigot api

#

btw my "I did this before" was not exactly registering an event

#

but instead moving it to a different spot in the pipeline

#

I did something weird

#

I can't even remember

slow sentinel
#

yo

#

does anyone know what replaced this?
org.bukkit.block.Block

onyx fjord
north nova
#

why would it not work

onyx fjord
#

generally ive noticed that generics have some issues

north nova
#

what?

echo basalt
#

It works, it's just that the for some reason that method doesn't use generics and just passes an event

slow sentinel
#

i need the getDroppedItems() function

echo basalt
#

Most likely because it's a stupid separate interface

onyx fjord
# north nova what?

EntityDamageByEntityEvent registered as EntityDamageEvent for whatever reason

echo basalt
median berry
#

Is there an event that works when a player opens a chat?

north nova
#

and that's not generics

#

what

misty zenith
#

Anyways to create connection between python and server ?
except RCON cause it isn't secure ?

echo basalt
#

ofc paper does its shenanigans

#

thinking it's superior

onyx fjord
#

asm for events wut

echo basalt
#

yeah

onyx fjord
#

doesnt look fun

slow sentinel
#

Guys does this function still exist? .getDroppedItems()
it seems it moved
it was previoiusly in org.bukkit.block.Block;

echo basalt
#

Just use a messaging service like RabbitMQ or Redis' PubSub

dusky crane
#
        Bukkit.getScheduler().scheduleSyncDelayedTask(main,
                ()->{
                    world = Bukkit.createWorld(new WorldCreator(worldName).generator(new ArenaChunkGenerator()));
                    world.setSpawnLocation(0, 64, 0);
                    world.setKeepSpawnInMemory(false);
                });
    }``` 
This ain't generating.
hazy parrot
#

Anyway you can really use anything to connect

#

Websocket, http endpoints

#

Raw socket 🤢

#

Whatever is suited for your use case

compact haven
#

rcon isn't the best

#

but yeah u literally have every option

#

idk what that question is LOL

young knoll
#

Put a shell script on a usb key and give it to the python

#

Then send the python on its way

tall dragon
#

thats too easy

hazy parrot
#

Yeah it's probably most optimal

tall dragon
#

print the data, take it where python is hosted. scan it and import

young knoll
#

Pythons are just more robust carrier pigeons

upper hazel
#

i tested 1 texture pack x ray but it shows nothing except cobblestones next to how ati X ray i works lol with the client

#

how peuple do this anti x ray

young knoll
#

?

dusky crane
#

Why doesn't this part of my chunk generator work?

    public ChunkData generateChunkData(World world, Random random, int chunkX, int chunkZ, BiomeGrid biome) {
        ChunkData data = Bukkit.createChunkData(world);
        data.setRegion(0, 0, 0, 15, 0, 15, Material.BEDROCK);
        data.setRegion(0, 35, 0, 0, 60, 0, Material.STONE);
        data.setRegion(0, 61, 0, 0, 64, 0, Material.DIRT);```
languid urchin
# median berry .

Pretty sure opening chat is purely client side, there's no way for the server to know that a player has simply opened their chat

dusky crane
#

Started yes

#

Working no.

#

Working can't be sure.

#

Maybe it works maybe it doesn't

#

test it.

languid urchin
#

How is Bukit supposed to know if your plugin is working?

sterile breach
#

Hi, the méthode server.getinfo.sendata() send a plugin message to all players in the server ?

restive mango
#

How many runtaskasynchronously’s can I have running at one time, really

#

An order of magnitude

#

Would be great

#

100s? 10s? 1000s?

#

10,000s?

languid urchin
#

depends on how good your cpu is

#

you can benchmark it yourself and see how it performs

dusky crane
restive mango
#

Like 12 cores

dusky crane
#

can be infinite but leave some CPU for you computer

restive mango
#

I don’t know how many threads I have

#

How do we find out the #

#

I have also heard about this thing called a virtual thread

#

Idk what that is

dusky crane
restive mango
#

Okay

#

That sounds reasonable

dusky crane
restive mango
#

I don’t KNOW

dusky crane
#

If you have 16 cores you might have 32 threads

restive mango
#

!

#

Okay

lunar wigeon
restive mango
#

Thanks

lunar wigeon
#

then just make it *2, threads in processors are usually cores x 2

lunar wigeon
dusky crane
#

Also subtract 3 for server and OS

lunar wigeon
#
Thread.activeCount()

this returns number of active threads

young knoll
#

The server and OS is probably using more than 3 XD

dusky crane
analog vapor
#

can someone help out with this lol, its annoying

young knoll
#

I mean the server has the main thread, chat thread, netty threads, worker threads, etc

dusky crane
#

Use linux or fix your path.

#

Linux is easier in terms of installing Java

hazy parrot
icy beacon
#

wait why is it in programdata and 0kb

analog vapor
icy beacon
#

this looks scuffed

hazy parrot
#

By using right path..?

icy beacon
#

unless it's normal for oracle installations

hazy parrot
#

Also are symlinks a thing in windows lol

icy beacon
#

i have custom installation paths so for me it's "C:\JDK (1.16)\bin\java.exe"

analog vapor
#

i did

hazy parrot
#

Isn't it shortcut in windows

icy beacon
icy beacon
analog vapor
sterile breach
#

Hi, (in bungeecord) the méthode server.getinfo.sendata() send a plugin message to all players in the server ?

hazy parrot
analog vapor
#

using the jdk installers

hazy parrot
#

I hope you haven't just xp it from some linux server

analog vapor
#

no

#

it said windows

hazy parrot
#

Why do you have symlinks

analog vapor
#

because its a feature?

#

of windows

hazy parrot
#

Why not just use real path to put in paths variable...?

analog vapor
#

how do i do that?

icy beacon
#

reinstall java and just let it create appropriate folders and put itself into path

#

there's no way the java installer made those symlinks for you

analog vapor
#

how do i reinstall then

icy beacon
#

delete it and install lol

analog vapor
#

like i need to use a uninstaller?

icy beacon
#

well yeah

dusky crane
icy beacon
#

why not

dusky crane
#

Maybe yes.

icy beacon
#

go to the control panel

dusky crane
#

I'm not a Windows user.

icy beacon
#

and uninstall

icy beacon
dusky crane
#

You don't need an unisntaller on Unix

hazy parrot
#

Good for u

icy beacon
#

this convo sounds like you want to flex using unix

analog vapor
icy beacon
#

go to programs and components or whatever it's called

#

you never uninstalled shit before?

analog vapor
#

i didnt understand you meant to uninstall as a program lol

icy beacon
#

...

analog vapor
#

okay so i install the development kit or what?

#

or the runtime environment @icy beacon

icy beacon
#

do not ping me

analog vapor
#

cold

icy beacon
#

tbh i have not installed java in a while but you need both iirc

#

an installer should cover both, no?

analog vapor
#

dont think so

icy beacon
hazy parrot
#

I think standalone runtime env isn't even thing anymore

icy beacon
#

choose the x64 installer for windows

#

it should install jdk and with that the jvm should also come

orchid trout
#

what does that mean

analog vapor
#

hmm imma do it

echo basalt
#

it means exactly what I said

#

PlayerJoin -> load user async -> cache user in memory and fire an event

dusky crane
#

What do the 3 ints here mean in:generateChunkData​(World world, Random random, int x, int z, ChunkGenerator.BiomeGrid biome)?

echo basalt
#

no clue where you're seeing 3 ints

analog vapor
#

after 1 day of self hate it finally works, ty ZBILL and Goksi ❤️

icy beacon
#

rule of thumb, if shit spontaneously stopped working and you can afford to reinstall it quickly, do it (jk this is a bad advice)

#

though it did help me today

#

i had to reinstall the entirety of wsl

#

for cargo to work again

echo basalt
#

me with my 19 jdks in my ide

icy beacon
#

lmao

#

good naming

#

don't ask

echo basalt
#

wtf is that font

icy beacon
#

i don't remember i changed it with winaero a while ago

icy beacon
echo basalt
#

I actually started making plugins with java 1.6

#

but it was on my old laptop

icy beacon
#

i have no further questions

dusky crane
echo basalt
#

Alright so x and z

icy beacon
#

i assume it's the chunk x and z

echo basalt
#

They're the chunk's position

#

yeah

icy beacon
#

yay i was good for something!!!!!

echo basalt
#

Anyways

#

To convert it to a "real" position

dusky crane
#

This seems to work in 1 chunk.
data.setRegion(chunkX*16, 35, chunkZ*16, chunkX*16+16, 60, chunkZ*16+16, Material.STONE);

echo basalt
#

int absX = x << 4;
int absZ = z << 4;

tender shard
icy beacon
echo basalt
#

something something negative numbers

icy beacon
#

well shit

dusky crane
#

Bitwise Left Shift Operator (<<)

echo basalt
#

multiplying by 16 works I just remember there were some edge cases

icy beacon
#

i'll have to learn bitwise operations one day won't i

echo basalt
#

I still don't know them all

dusky crane
#

Gives me C++ vibes. I hate C++

echo basalt
#

Like wtf is >>>

#

or <<<

icy beacon
#

i know none

icy beacon
echo basalt
#

I know << and >>, & and |

tender shard
# echo basalt Like wtf is >>>

The unsigned right shift operator ">>>" shifts a zero into the leftmost position, while the leftmost position after ">>" depends on sign extension.

echo basalt
#

that tells me nothing

tender shard
#

me neither

icy beacon
echo basalt
#

& is a bitwise AND

icy beacon
#

well fuck me sideways i always thought it was to evaluate both

echo basalt
#

So

0001
0011
&
0001

icy beacon
#

this somehow makes sense to me

echo basalt
#

yeah

icy beacon
#

i thought it wouldn't

echo basalt
#

| is a bitwise OR

icy beacon
#

so 0001 | 0011 would be 0011?

echo basalt
#

0001
0010
|
0011

#

Yep

icy beacon
#

damn

#

and what the hell is the shift operator

echo basalt
#

0001
<< 2
0100

icy beacon
#

oh

tender shard
icy beacon
icy beacon
echo basalt
#

it serves as a * pow(2, value)

echo basalt
icy beacon
#

yayyyy

echo basalt
#

<< 4 is the same as * 16

tender shard
# tender shard

it returns returnTrue2() although returnTrue1 is already true

echo basalt
#

because 2 ^ 4 = 16

tender shard
dusky crane
#

And I bet it's faster

#

Right?

echo basalt
#

not really

tender shard
#

& is basically non-lazy AND, which means it runs the second thing even though the 1st is already false

icy beacon
echo basalt
#

because you're evaluating more values

icy beacon
#

evaluates both

tender shard
#

basically: && or || stop when it can't be true anymore while & / | definitely runs both

echo basalt
#

You read from right -> left

#

and each number represents a 2 ^ something

icy beacon
dusky crane