#dev-general

1 messages · Page 166 of 1

winter iron
#

ye

prisma wave
#

or just the compiled main class

winter iron
#

ill send the jar

prisma wave
#

that's the important bit

#

ok

winter iron
static zealot
#

oh.serialize() I'm blind

prisma wave
#

that's interesting

#

and no warnings in console before? @winter iron

winter iron
#

nothing

#

just the class not found

#

thats the startup

#

everything is downloaded

prisma wave
#

very odd

#

interesting

#

i just tested on my local server and it works fine

#

delete PluginLibraries and try restarting

#

I think I know what's happening here...

#

and it's not good D:

winter iron
#

UH OH

ocean quartz
#

BM how do you check if the version had changed?

prisma wave
#

wdym?

#

for the jars?

ocean quartz
#

@static zealot MiniMessage needs adventure platform to send the component

#

And yeah BM

winter iron
#

@prisma wave It worked! but on server restarts/reloads it fails

empty flint
#

hm there was something about Kotlin having a way to have a variable be one of n finite possible classes. What was that called again, Mitten?

winter iron
#

so I guess its just not loading depdencies at all

#

unless it downloads first

prisma wave
#

@empty flint sealed classes?

empty flint
#

@empty flint sealed classes?
@prisma wave Ty

prisma wave
#

it just does it based on the dependency data @ocean quartz

#

@winter iron i'm fairly sure the lack of relocation is the problem

#

should've known it would cause problems

winter iron
#

RIP pdm 0.0.20

#

here come 0.0.21

ocean quartz
#

Oh okay, wouldn't it be easier to make a json file or something like that to keep track of it?

prisma wave
#

oh I see what you mean

#

it does

#

the gradle plugin generates a json file for group id, artifact id, version, and the repository url

#

then the runtime just reads that to find what to download

ocean quartz
#

Ooh yeah that's what i thought it should do yeah, nice

reef maple
#

Hi, is this channel already used ? OcO

steel heart
#

Wym

reef maple
#

If I can ask a question now

steel heart
#

This isn’t really a support channel but mainly a developer chitchat

static zealot
#

welp time to check what adventure platform is

surreal quarry
jovial warren
#

@prisma wave hey so I've been thinking of a better way to process sub commands in Octo than just making a field called subCommands in every command and making you override that with a list of sub commands, and I thought of retrieving nested classes that extend the Command class and handling them internally, just wanna know if you think this is a good idea or not lol

#

and also if anyone else wants to give me their thoughts on that idea, that would be really appreciated as well

prisma wave
#

retrieving nested classes that extend the Command class and handling them internally
with reflection?

steel heart
#

Bard that’s smart

jovial warren
#

yeah @prisma wave

prisma wave
#

i'd do both

jovial warren
#

I mean, idk how else you'd do it lol

prisma wave
#

don't force people to have all the subcommands in 1 file

jovial warren
#

I could create a separate SubCommand class for that purpose if people want sub commands in different files

#

actually that makes no sense

winter iron
#

@prisma wave You know what the issue with pdm is then?

prisma wave
#

lack of relocation

#

probably

jovial warren
#

also @prisma wave is it a good idea to support both inner and static nested classes? I mean, there's not a reason not to, right?

winter iron
#

yikes, guess I stick with shadowjar build for now

prisma wave
#

yeah it's in the works

#

@jovial warren can't think of a reason not to

jovial warren
#

okay

winter iron
#

Hey, I know I asked the other day about web portfolios and stuff. Should I go about creating my own from scratch or use like a template/web builder

#

And if I was to make from scratch, how would I got about developing one, what sort of software should I use

prisma wave
#

depends how much you are confident / want to flex

winter iron
#

Well I want to learn more about backend web development too

#

so I think from scratch is best

prisma wave
#

you probably won't need much backend for a portfolio

#

if any

winter iron
#

I havn't done alot of frontend either

prisma wave
#

alright

#

that's the main bit

winter iron
#

I want to learn tho

#

so I guess from scratch is better right?

prisma wave
#

i guess so

#

I've made 2 portfolios from scratch and they both suck

winter iron
#

What sort of tools am I looking at to use

#

XD

steel heart
#

No reason not to learn front end

prisma wave
#

Depending on the scale you might want to use a JS framework

#

or you might not

#

my current one is just pure html I think

steel heart
#

Lol

winter iron
#

React JS?

steel heart
#

Sure

winter iron
#

Angular JS

#

😮

#

options

steel heart
#

Recommend MERN as rest api

prisma wave
#

Angular is MVC which is possibly overkill

#

Vue is View only

#

Not sure about React, I think that is too

winter iron
#

whats MVC

prisma wave
#

Model View Controller

#

It's a design pattern for structuring programs

winter iron
#

sounds alot for a portfolio

#

Xd

prisma wave
#

Exactly

#

Probably not necessary

winter iron
#

Might go from scratch html/css/js at first

#

and make a second one later

#

Just so i learn basics too

prisma wave
#

Fair enough

remote goblet
#

i hate html/css/js

prisma wave
#

Don't we all

winter iron
#

What about with python

#

i still need html

#

and css

#

right

steel heart
#

They have their place

remote goblet
#

i dont like python peronally

winter iron
#

python is just for backend right?

#

mainly

steel heart
#

Yeah

remote goblet
#

I personally hate Html/css with a passion

#

i find it

#

so fucking boring

#

I envy Web Devs, i dont know how they can do it

prisma wave
#

Python can be for anything

#

Well

#

Maybe not frontend

winter iron
#

what program should i use for html

#

to develop

#

like intellij

prisma wave
#

Intellij can do pretty much everything

#

With plugins

#

So yeah

winter iron
#

😮

prisma wave
#

Unless you wanna be unique and get Webstorm

winter iron
#

I c intellij do be doing javascript

#

pog

remote goblet
#

not really

#

it doesnt directly support it

winter iron
#

:/

remote goblet
winter iron
#

i might just install webstorm

#

anyways

remote goblet
#

its paid

winter iron
#

no student shit?

remote goblet
#

probably

analog crater
#

You can grt all shit for free if your student

winter iron
#

ez

analog crater
#

Just dont make it explicit that you are using it for commercial reaosnz

remote goblet
#

cringe when you have to make your own Announcer plugin using a specific 1.16 hex utils class in java because you dont feel like having 4mb jar files

winter iron
#

@remote goblet relax, my jar be 13mb

#

😦

remote goblet
#

Cringe what did you do to it

winter iron
#

stuffed it

remote goblet
#

With what

winter iron
#

DEEZ NUTS

#

HA

#

GOT EM

remote goblet
#

ima cute those nuts in a second

winter iron
#

😮

versed ridge
#

you're gonna what?

remote goblet
#

You hurt me

winter iron
#

🤬

#

whats create assosications

#

i feel like i tick them all

remote goblet
#

uh

#

yeah do that

jovial warren
#

@prisma wave WebStorm > IntelliJ for web stuff any day, especially because personally I find separating IDEs like this makes it easier to separate your projects from one another

#

also why do all y'all developers use Windows

#

I mean, Windows is great for office, gaming, and usability, but the Linux kernel and the way most Linux systems are designed makes it objectively superior to Windows for development

#

@distant sun that shameless sellout in your status lol

surreal quarry
#

i mean yea linux is better but do you not use your computer for anythning else

#

for your personal computer at least windows is better so its more versatile

remote goblet
jovial warren
#

@surreal quarry nope lol

#

@remote goblet what is that

remote goblet
#

an auto announcer plugin i made in like

#

10 minutes max

#

maybe 15m

onyx loom
#

but why

remote goblet
#

because I needed an auto announcer plugin that uses the same hex utils as all my other plugins mmSitStareMocha

#

gotta have them gradients & rainbow text

prisma wave
#

@jovial warren separating IDEs is nice but at the same time I don't want to have to completely customise the IDE over and over again. Intellij supports everything that Webstorm does with plugins, so not much reason not to use it

ocean quartz
#

@steel heart \n now works
Example: <g:#eb4034:#34c6eb>***test** test ~~test~~*\n**test** ~~test~~ __test__

south parrot
#

what's the difference between using normal imports for MySQL Implementation and using Maven for use HikariDB?

#

i mean, why people says "Hikari" is better?

surreal quarry
#

Hikari is a lot faster

south parrot
#

at perfomance?

surreal quarry
#

yea
basically what hikari does it it establishes a connection, then uses the connection whenever is needed.

what you would do without hikari is establlish a connection, use it, then close it every time.

becuase of this hikari is a lot faster

south parrot
#

some devs told me that is better for prevent leaking information

#

or smth like that

surreal quarry
#

im not sure about that, but i do know that its a hell of a lot faster for getting stuff out of your database cause it doesn't need to establish a connection every time you want to do something

south parrot
#

thanks alot, you're helping me alot.

surreal quarry
#

np fingerguns

tacit cave
#

can someone help me

#
        if (e.getBlock().getType() == Material.STONE) {
            Bukkit.getLogger().info("Material type detected");
            int radius = 1;
            World world = loc.getWorld();
            for (int x = -radius; x < radius; x++) {
                for (int y = -radius; y < radius; y++) {
                    for (int z = -radius; z < radius; z++) {
                        Bukkit.getLogger().info("Radius detected");
                        Block block = world.getBlockAt(loc.getBlockX() + x, loc.getBlockY() + y, loc.getBlockZ() + z);
                        Block block2 = world.getBlockAt(loc.getBlockX() + x, loc.getBlockY() + y, loc.getBlockZ() + z);
                        // Check The Block Type and Check Level
                        if (block.getType() == Material.WATER && block2.getType() == Material.LAVA  && UpgLevel == 0) {
                            Bukkit.getLogger().info("Water & lava detected");```
#

hello

tacit cave
#

hello

#

can someone help me

#
public class OreUpgListener implements Listener {

    @EventHandler
    public void OnDestroy(BlockFormEvent e) {
        double maxDistance = 2;
        for (Player p : Bukkit.getOnlinePlayers()) {
            if (p.getLocation().distance(e.getBlock().getLocation()) <= maxDistance && p.getWorld().getName().equalsIgnoreCase("ASkyBlock") && p.hasPermission("island.stay")) {
                e.setCancelled(true);
                int UpgLevel = new CheckUpgLevel().CheckUpgradeLevel("ores", p);
                // Set Random Chances
                Random rand = new Random();
                int chance = rand.nextInt(100);
                if (e.getBlock().getType() == Material.STONE) {
                    Bukkit.getLogger().info("Material type detected");
                    Bukkit.getLogger().info("Water & lava detected");
                    if (chance >= 60) {
                        Bukkit.getLogger().info("Stone");
                        e.getBlock().setType(Material.STONE);```
meager cairn
tacit cave
#

why it's not working

meager cairn
#

I cannot help yoo, but you should explains your problem even I can read your code, but I don't know what's your problem

steel heart
#

What’s not working?

tacit cave
#

What’s not working?
@steel heart it's not replacing the block

#

it's still generates cobblestone

#

...

steel heart
#

Then it not reaches the code that does that

tacit cave
#

yes but why

#

that's why im here

#

it doesnt reach the chances

#

i guess

meager cairn
#

Why do you need to calculate radius when listen to cobblestone generator event? What about BlockFromToEvent

tacit cave
#

Why do you need to calculate radius when listen to cobblestone generator event? What about BlockFromToEvent
@meager cairn to check their perm sir

meager cairn
#

I don't know how to explain, but I think you can do a better way than this. It's not efficent to check radius, everytime the cobblestone regen, imagine the regenation speed and 50 players breaking the block with effiency 5. your tps will say good bye

tacit cave
#

I don't know how to explain, but I think you can do a better way than this. It's not efficent to check radius, everytime the cobblestone regen, imagine the regenation speed and 50 players breaking the block with effiency 5. your tps will say good bye
@meager cairn any tips?

meager cairn
#

As I say, I'm horrible at explaining so I don't really know until I code something myself 😭.

steel heart
#

First of all

#

Why are you creating a new Random instance each time

meager cairn
#

You can go and check other ore regen opensource

steel heart
#

You know it’s constructor is slow btw

#

@tacit cave

distant sun
#

btw if something has a X chance, you want to check if the random number it's <= not >= than your chance

#

also, use SplittableRandom instead

tacit cave
#

btw if something has a X chance, you want to check if the random number it's <= not >= than your chance
@distant sun java int chance = rand.nextInt(100); if (e.getBlock().getType() == Material.STONE) { Bukkit.getLogger().info("Material type detected"); Bukkit.getLogger().info("Water & lava detected"); if (chance >= 60) { Bukkit.getLogger().info("Stone"); e.getBlock().setType(Material.STONE); } else if (chance >= 21) { e.getBlock().setType(Material.COAL_ORE); Bukkit.getLogger().info("Coal");

#

.

#

it's just work like <=

distant sun
#

no lol

tacit cave
#

?

distant sun
#

<= 21 has 21 possible numbers while >= 21 has 80

tacit cave
#

oh

distant sun
#

when something is not working, add debug

tacit cave
#

yes

#

i added

#

it doesnt reach the chances

meager cairn
#
    public static boolean chance(double percent) {
        return new Random().nextInt(100) <= percent;
    }

I always use somewhat like this, you can store the random instance somewhere idk

distant sun
#

no no no

#

always use the same SplittableRandom instance

#

also, pretty sure you need nextInt(101)

steel heart
#

Why would he need a SplittableRandom

distant sun
#

it's better than Random from what I've read.

meager cairn
#

I have no problem of using this tbh

distant sun
#

* @param bound the upper bound (exclusive). Must be positive.

tacit cave
#

so

#

i have to change

distant sun
#

d e b u g

tacit cave
#

>= to <=

#

?

#

d e b u g
i d i d

steel heart
#

Should be a negligible difference for what he is doing

tacit cave
#

i t r e a c h e s t h e p l a y e r

#

b u t i t d o e s n t r e a c h t h e c h a n c e s

obtuse gale
#

print out the number

steel heart
#

Well it’s not thread safe but faster than Random

tacit cave
#

so

#

i have to change the chances?

#

to <=

#

and

#

int chance = rand.nextInt(101);

steel heart
#

0-100

tacit cave
#

the chance 0 - 100?

steel heart
#

Yeah

#

Btw

#

You should work with implicit else pattern

tacit cave
#

You should work with implicit else pattern
@steel heart implicit?

steel heart
#

Yeah

#
//dont
if (condition) {
  //todo
} else {
  //handle
}

//do
if(!condition) {
  //handle
  return;
}
//todo
tacit cave
#

hm

steel heart
#

I can give you example

obtuse gale
#

its covered in this isnt it?

#

?plsnoarrowcode

compact perchBOT
tacit cave
#
        for (Player p : Bukkit.getOnlinePlayers()) {
            Bukkit.getLogger().info("Player Handled");
            if (!(p.getLocation().distance(e.getBlock().getLocation()) <= maxDistance) && !p.getWorld().getName().equalsIgnoreCase("ASkyBlock") && !p.hasPermission("island.stay")) {
                return;
            }```
#

like this?

steel heart
#
//onCommand
if (!Player.class.isInstance(sender)) {
  //not player
  return true;
}
if (args.length == 0) {
  //invalid arg amount
  return true;
}
sender.sendMessage(“hi”);
meager cairn
#

anyways. funny question. does placeholderapi works with itemlore

steel heart
#

You could make it work

obtuse gale
#

works on any string you call the PlaceholderApi.setPlaceholders method

steel heart
#

Tbh they should make it work on any base component or so

#

Not having to manually convert on all strings there

hot hull
#

Go suggest it Conclure fingerguns

meager cairn
#

so its mean i have to call setPlaceholders everytime I need to replace something? or just one time onEnable.

steel heart
#

Ah man I don’t pr

#

I’m just too lazy

#

Everytime

hot hull
#

No need for a pr

#

@meager cairn No, call setPlaceholders however many times you want (so long it's reasonable)

meager cairn
#

hmm still cannot imagine it, I haven't use placeholderapi for a while now. The last time I use I have to extends PlaceholderExpansion that's all

steel heart
#

Ohd atleast one time per string, you can eventually cache it then

meager cairn
#

Cache it maybe not the solution for me, because I have to replace the string everytime the inventory open.

steel heart
#

Frosty then what? Just open a suggestion? Is that what you want

#

Ohd why?

meager cairn
#

the placeholder on itemlore is player money. it need to be updating

steel heart
#

Ah

meager cairn
steel heart
#

Bad tutorial

#

And it’s not even papi related afaik

meager cairn
#

yeah its not. but I'm looking for a way to replace every "placeholder" in my config when found. rather than create new ArrayList everytime and manually replace it

steel heart
#

make a utility method for replacing a string list

#

Else then that, calling the setPlaceholders method is necessary, you can make a shortcut method of it in worst case

tacit cave
#

hello

#

can someone help me?

#
    @EventHandler
    public void OnDestroy(BlockFormEvent e) {
        double maxDistance = 2;
        for (Player p : Bukkit.getOnlinePlayers()) {
            Bukkit.getLogger().info("Player Handled");
            if (!(p.getLocation().distance(e.getBlock().getLocation()) <= maxDistance) && !p.getWorld().getName().equalsIgnoreCase("ASkyBlock") && !p.hasPermission("island.stay")) {
                return;
            }
            Bukkit.getLogger().info("Perm checked");
            int UpgLevel = new CheckUpgLevel().CheckUpgradeLevel("ores", p);
            // Set Random Chances
            Random rand = new Random();
            int chance = rand.nextInt(100);
            if (UpgLevel == 1) {
                // Set the ore to iron_ore
                if (chance <= 20) {
                    e.getBlock().setType(Material.IRON_ORE);
                } else if (chance <= 30) {
                    e.getBlock().setType(Material.COAL_ORE);
                } else if (chance <= 50) {
                    e.getBlock().setType(Material.STONE);
                }
                // Check If Player's Level is 2```
#

it's not working

#

it doesnt replace the block

obtuse gale
#

debugged it?

#

Like printed chance and whatnot

tacit cave
#

yes

#

it doesnt print the chance

#
        for (Player p : Bukkit.getOnlinePlayers()) {
            Bukkit.getLogger().info("Player Handled");
            if (!(p.getLocation().distance(e.getBlock().getLocation()) <= maxDistance) && !p.getWorld().getName().equalsIgnoreCase("ASkyBlock") && !p.hasPermission("island.stay")) {
                return;
            }
            Bukkit.getLogger().info("Perm checked");```
#

succeded

obtuse gale
#

Where did you print chance

#

cos if nothing prints then the code isnt even reaching there

tacit cave
#

cos if nothing prints then the code isnt even reaching there
@obtuse gale i mean that's what i mean

#

the code isnt reaching it

obtuse gale
#

mm

#

just add a println after every if or whatever to see where it gets i guess

distant sun
#

is there any deprecated class on spigot?

#

Like, marked with @Deprecated

tacit cave
#

is there any deprecated class on spigot?
@distant sun no

#

everything's fine

distant sun
#

it's not related to your question lol

#

ty yugi

tacit cave
#

oh k

distant sun
tacit cave
#

yep

#

it's doesnt read

#

doesnt reach the chances

old wyvern
#

ayy nice gab!

tacit cave
#
    @EventHandler
    public void OnDestroy(BlockFormEvent e) {
        double maxDistance = 2;
        for (Player p : Bukkit.getOnlinePlayers()) {
            Bukkit.getLogger().info("Player Handled");
            if (!(p.getLocation().distance(e.getBlock().getLocation()) <= maxDistance) && !p.getWorld().getName().equalsIgnoreCase("ASkyBlock") && !p.hasPermission("island.stay")) {
                return;
            }
            Bukkit.getLogger().info("Perm checked");
            int UpgLevel = new CheckUpgLevel().CheckUpgradeLevel("ores", p);
            // Set Random Chances
            Random rand = new Random();
            int chance = rand.nextInt(100);
            if (UpgLevel == 1) {
                Bukkit.getLogger().info("Level checked!");
                // Set the ore to iron_ore
                if (chance <= 20) {
                    Bukkit.getLogger().info("Chance succesful!");
                    e.getBlock().setType(Material.IRON_ORE);
                } else if (chance <= 30) {
                    Bukkit.getLogger().info("Chance succesful!");
                    e.getBlock().setType(Material.COAL_ORE);
                } else if (chance <= 50) {
                    Bukkit.getLogger().info("Chance succesful!");
                    e.getBlock().setType(Material.STONE);```
#
 [06:33:11 INFO]: Player Handled
[06:33:11 INFO]: Perm checked```
#

anyone

old wyvern
#

Just use the debugger instead of printing redepic

tacit cave
#

Just use the debugger instead of printing redepic
uh

old wyvern
#

pretty sure UpgLevel is not 1 in this case

tacit cave
#

oh ye

#

im level 5

#

😂

old wyvern
#

uh
Yes?

tacit cave
#

wait

#

there is else if

old wyvern
#

Printing variables is much much more tedious than using the provided debugger

tacit cave
#

in the code

#

how do i debug?

#

never debugged yet.

#

i usually use print

old wyvern
#

I think piggy may have a better guide but I dont have the link so 🤷‍♂️

empty flint
#

What does the Any> in inline fun Any> findOrSetObject(defaultValue: () -> T): T
mean?

distant sun
#

I usually use soutv xd

old wyvern
#

xD

#

Trust me debugger god

distant sun
#

¯_(ツ)_/¯

tacit cave
old wyvern
#

What does the Any> in inline fun Any> findOrSetObject(defaultValue: () -> T): T
mean?
Are you sure thats the right declaration?

tacit cave
#

version

old wyvern
#

version
What?

#

What does that have to do with using windows

tacit cave
#

umm

old wyvern
#

Optionally add any extra arguments you want to run while starting server

#

Once done, click "Done"

#

Choose that configuration and press debug, and the server should start up with the intellij debugger

tacit cave
#

server directory?

#

does it work like normal server?

old wyvern
#

Thats just running the server with the debugger, nothing else

#

You can then add breakpoints to your code and check out variable values at that point

tacit cave
#

i cant click debug

old wyvern
#

?

tacit cave
#

eh nvm

true grail
#

this does not open the second gui

obtuse gale
#

show code

true grail
#

this is how the second gui config looks

obtuse gale
#

right

#

but is this a plugin you coded?

true grail
#

no

#

this is deluxmenus

obtuse gale
#

So then why are you in a development channel....

hot hull
#

@ocean quartz Quick suggestion for mf gui, any chance you could add some deserialize method which would return a gui from a given section (from a predetermined pattern), would make thing much cleaner fingerguns

distant sun
hot hull
#

You don't have to use it smh

#

But for making gui's quick and constant it'd be nice to have

errant geyser
#

You could make that yourself Frosty

hot hull
#

I could, but- Matt could as well fingerguns

errant geyser
#

Going by the usual rule of PR or shut up, PR or shut

distant sun
#

or make it an addon

dusky drum
#

oww

foggy pond
#

How do I display what class I am working on in my discord status message

#

I tried but it does not look like for example Frosty's

hot hull
#

It's a plugin

foggy pond
#

Intellij plugin?

hot hull
#

yes

foggy pond
#

What's it called?

#

I assume Discord Integration

hot hull
#

yup

foggy pond
#

Sweet thank you

#

It doesn't show what class I am working on 😞

hot hull
#

Have you set the project as visible in Tools > Discord

foggy pond
hot hull
#

That'll be 40$

obtuse gale
#

er

#

my database just inserted an emoji in chinese

steel heart
#

Stroke counter 27?

foggy pond
#

Winnie pooh is spying on you

obtuse gale
steel heart
#

Lol

heady birch
#

How do I register alias dynamically?

steel heart
#

Commandmap

heady birch
#

E.g I want a config option to disable registering /kb

steel heart
#

Unregister and reregister

heady birch
#

Require reflection?

steel heart
#

Yes

heady birch
#

Any other way?

steel heart
#

Not nms though

#

Uh

#

Listen to the event

heady birch
#

☹️

steel heart
#

Although reflection won’t be a problem

#

You’d only have to use it once to obtain the instance of commandmap

obtuse gale
#

first time thats ever happened

heady birch
#

As long as they dont change it in future

steel heart
#

Potato pc

heady birch
#

How long has commandmap been around for?

steel heart
#

Niall it hasn’t changed since 1.8.8 atleast

#

Still the same

obtuse gale
#

this dropbox thing is nice

#

The only thing ive gotta do when I open my laptop is right click the folder and click reload from disk

heady birch
#

Wheres this commandmap kept?

steel heart
#

Hmm I think SimplePluginManager might have it iirc

quiet depot
#

I feel like it's been around forever

#

and yeah, can confirm, it's in simplepluginmanager

hot hull
#

Conclure, correct fingerguns

steel heart
#

I used to get it in some other way though through the server instance iirc but I don’t think the commandmap was kept there since 1.8.8

dusky drum
#

anyone has any good like function to check if storage can accept item (has space for it) or no?

distant sun
#

Inventory#firstEmpty() != -1

steel heart
#

storage?

dusky drum
#

gaby what i inventory has that item but it can still stack up to 64?

#

example storage has 12 wood and i want to add 32 of it

#

i dont want to use empty slot

distant sun
#

there's Inventory#addItem which returns Map<Integer, ItemStack> which represents the items that couldnt be added

steel heart
#

Although I don’t think Inventory#firstEmpty cares about armor slots etc

dusky drum
#

ye but basicly that returns items that werent added i dont realy want to do that

#

if i cant add all items i dont want to add them at all.

distant sun
#

then firstEmpty() it's your best friend

steel heart
#

That map is very useful

distant sun
#

^

#

inventory methods are meh imo

steel heart
#

It’s like keys are the indexes of the vararg and the values are the itemstacks

dusky drum
#
boolean isFull(Chest chest, ItemStack item) {
        for(ItemStack slot : chest.getInventory()){
            if(slot == null) return false;
            if(slot.isSimilar(item)){
                if(slot.getAmount() + item.getAmount() < slot.getMaxStackSize()){
                    return false;
                }
            }
        }
        return true;
    }

i guess ill give this a try.

distant sun
#

<=

#

slot == null || slot.getType() == Material.AIR would also work I guess

steel heart
#

Just put System.exit(0); and Magic will happen

distant sun
#

:))

dusky drum
#

ye the best just shutdown the program

steel heart
#

Or Thread.sleep(Integer.MAX_VALUE);

dusky drum
#

yes

obtuse gale
#

String.MAX_VALUE is for the pro gamers

dusky drum
#

While the length of a String is theoretically Integer.MAX_VALUE, the length of a string literal in the source appears to be limited to only 65535 bytes of UTF-8 data.

obtuse gale
distant sun
#

<= not <

regal gale
#

Was gonna send a proof that that was real, then I realized how "ducky" my voice was 😂

lunar cypress
#

actually working with the audio is the hard part

regal gale
#

At least ik how audio byte works xD

pliant badger
#

I made some kind of voice recognition bot a while ago using pico voice and google tts/stt, was fun but it didn't pick up the wake up word easily

#

i tried working with audio once, i decided to stick to libraries

jovial warren
#

@regal gale 🤬

#

JDA 3!!!!!!!!!!!!!!

regal gale
#

I just got it randomly from internet lol

jovial warren
#

fair enough

#

just please, update

#

4.2.0_194 I think is latest

regal gale
#

I'm already at 4.2.0

jovial warren
#

phew

empty flint
#

@prisma wave I got a question about creation order in Kotlin. I am a bit confused about something rn

#
sealed class CmdArgument private constructor(val name: String, val abbr: String) {
    init {
        if(abbreviations.putIfAbsent(abbr, name) != null)
            throw IllegalStateException("The command abbreviation $abbr is already assigned to the argument ${abbreviations[abbr]}. The developer screwed up.")
        println("$abbr -> $name")
        println(abbreviations)
    }
    companion object {
        val abbreviations = mutableMapOf<String, String>()
    }
}

I have this sealed class that stores all created instances of this class and subclasses.

#

And I create a bunch of them in Companion Objects to their classes

#

But it seems that this code isn't executed until I actually access the classes.

#

How/when are companion objects created?

#

And is there a way to create them before anything else happens?

prisma wave
#

But it seems that this code isn't executed until I actually access the classes.
which code specifically?

empty flint
#
class Action private constructor(name: String, abbr: String) : CmdArgument(abbr, name) {
    companion object {
        val CREATE = Action("create", "-c")
        val EDIT = Action("edit", "-e")
        val DELETE = Action("delete", "-d")
    }
}
#

This one for example

prisma wave
#

oh yeah

#

that's just java

empty flint
#

wdym? This is Kotlin

prisma wave
#

things like static initializers (which is effectively what's happening here) aren't executed until classloading

#

which if i'm not mistaken is done lazily

empty flint
#

and class loading is done as needed?

#

right

prisma wave
#

I believe so

empty flint
#

so is there a way to force load the class?

prisma wave
#

why not just use an enum?

#

relying on classloading for functionality is probably an anti-pattern

empty flint
#

why not just use an enum?
@prisma wave Can I use inheritance with an Enum in Kotlin?

#

Because afaik in Java that's not possible, I haven't heard it being different in Kotlin but maybe I'm wrong

prisma wave
#

how do you mean?

empty flint
#

I have three classes that extend the sealed class CmdArgument and more to come. They represent different things but I want them all to be grouped under this one class so I can pass them to methods without typechecking unnecessarily.

#

That's not possible with enums

#

neither in Java nor in Kotlin (I checked)

prisma wave
#

enums can extend abstract classes afaik

empty flint
#

Enum class cannot inherit from classes says IJ

prisma wave
#

hold on

#

if it's a sealed class, why do you need the throw IllegalStateException("The command abbreviation $abbr is already assigned to the argument ${abbreviations[abbr]}. The developer screwed up.") checks anyway?

#

you know exactly what the input will be

#

i'm not sure what the issue is here

empty flint
#

That's just a safety check that should never be triggered except if I screw up. Users won't ever see that because it would happen at companion instanceation time which I thought was the same as static.

#

That's beside the point

prisma wave
#

it is the same as static

empty flint
#

Is there a way to force init a class companion?

prisma wave
#

I don't understand why that's necessary

empty flint
#

it is the same as static
@prisma wave No it's done lazily when the class is first accessed

prisma wave
#

so is the static block

empty flint
#

Not in java

#

Static variables are initialized only once , at the start of the execution. These variables will be initialized first, before the initialization of any instance variables

#

That's different to companion objects

old wyvern
#

That happens on class load

prisma wave
#

^

#

both of them will happen on classloading

old wyvern
#

mhm you can test that out if you want to

empty flint
#

I mean I guess it's possible I never noticed it, it would really only be an issue in my case where I basically extended an enum, which isn't possible in Java

prisma wave
#

sealed classes aren't enums

empty flint
#

hence the 'basically'

#

glorified enums

prisma wave
#

at runtime they're no different to normal classes

empty flint
#

True

#

Anyhow, any way to initialize the companions of its subclasses? could basically be done when declaring the companion of the sealed class

#

just dunno how to do that

prisma wave
#

not that I know of

#

it's a bad idea anyway

#

well if you wanted to be really hacky KClass.sealedSubclasseswould probably provoke classloading

empty flint
#

Hm could delegates be the solution, I'm not sure I understand what they do exactly

prisma wave
#

probably not

#

delegates are just for delegation like the name suggests

old wyvern
#

seems to be loading in the right order for me

#

Can you explain what exact problem you have rn?

empty flint
#

sure

#

Should I just paste my code?

old wyvern
#

Sure

empty flint
#

=haste?

old wyvern
#

Yes please

#

?paste

empty flint
#

what was the syntaxa agin=

compact perchBOT
#
FAQ Answer:

Paste Services
When asking for help with a config/menu/code issue please use one of these:
(However we do prefer if you used our paste :))
HelpChat Paste - Usage
Hastebin

empty flint
#

xD

#

ty

old wyvern
#

And the issue was that?

winter iron
#

Hello

#

Anyone know how I can make it so when I click something on a sidenav bar it scrolls to certain content on the page?

surreal quarry
#

set its link to the id, and set your scrolling to smooth

static zealot
#

usually you use IDs ^

surreal quarry
#

scroll-behavior: smooth;
then element id

ocean quartz
#

@ocean quartz Quick suggestion for mf gui, any chance you could add some deserialize method which would return a gui from a given section (from a predetermined pattern), would make thing much cleaner fingerguns
@hot hull What do you mean from a predetermined pattern?

winter iron
#

Where to do I set the id?

#

in my <a> tag?

empty flint
#

@old wyvern the issue is in comments in the last hastepaste

surreal quarry
#

@winter iron set the id on what you want to scroll to

winter iron
#

so my div

surreal quarry
#

yea

winter iron
#

then what do i put in my <a>

surreal quarry
#

just href to the id

winter iron
#

i tried that but its tking me to a page that doesnt exist

surreal quarry
#

<a href="someid"></a>

#

maybe #someid

#

i forget

empty flint
#

So basically the CmdArgument.abbreviations map is empty when I use it to substitute the abbreviations for the names of the arguments, and only when I use the actual values of the subclasses do they get initialised and the map filled

winter iron
#

yes

#

perfect

#

ty!

surreal quarry
#

np

hot hull
#

@ocean quartz let's take the serialization of itemstacks to config for example, something along those lines

ocean quartz
#

That's coming for the persistent guis in the next update but won't work on normal ones

empty flint
#

Any ideas @old wyvern ?

dusky drum
#

how to get direction of stem from block is it state or blockdata?

hot hull
#

Ah nvm tho, it'd be way too specific, but could work if you have menus which just display shit with no actions

#

@ocean quartz What you could add is a reopen menu method, since that get's repetitive quick fingerguns

ocean quartz
#

What would reopen do?

hot hull
#
private void reopen(final Player player, final Gui gui) {
        gui.close(player);
        Bukkit.getScheduler().runTaskLater(plugin, gui.open(player), 2L);
    }
dusky drum
#

anyone has idea how i could set where stem is facing it cannot be cast to Directional.

#

java.lang.ClassCastException: org.bukkit.craftbukkit.v1_16_R1.block.impl.CraftStem cannot be cast to org.bukkit.material.Directional

empty flint
#

KClass.sealedSubclasses
@prisma wave This doesn't compile, I'm not sure if I need a special import for reflection in Kotlin?

hot hull
#

or ya know since it'd be in the actual basegui class just close and open so you wouldn't even need the gui

old wyvern
#

Borz, Id recommend loading the values in while initializing the map

winter iron
#

scroll-behavior: smooth;
then element id
@surreal quarry Where would I put this

ocean quartz
#

I fail to see why that would be needed, just call update() it does the same thing

winter iron
#

scroll behavior

surreal quarry
#

in your css

winter iron
#

for what element

surreal quarry
#

I applied it to *

old wyvern
#

Since you probably wouldnt have to modify it later that should be more than fine

empty flint
#

Since you probably wouldnt have to modify it later that should be more than fine
@old wyvern Yeah that's what I'm trying right now with "KClass.sealedSubclasses

hot hull
#

smh Matt

empty flint
#

Look what I just caught in the wild!
Exception in thread "main" kotlin.KotlinNullPointerException I was told these were extinct. Last one I saw was over a month ago... What a specimen, boys. I tell you it was as big as my forearm and had teeth like razors...

ocean quartz
#

Seems like you're using the forbidden operator !!

empty flint
#

Nope ^^

#

has to be something else

#

looking through the trace rn

supple lily
#

Uhm how do i use a bungee queue for deluxemenu in the server selector ?

old wyvern
#

Stacktrace?

supple lily
#

if i have to /sudo

#

I have command bungee but now i need to config the servers in the Deluxemenu folder so that i can use /sudo once i click the connector

empty flint
#

hm it comes from delegates in the parser library

#

I dunno how to use them

#

toodumb.jpg

vestal grove
#

how do I use mojmap for buildtools

winter iron
#

yo

#

only done the links page so far

empty flint
#

WHYYYY

#

it worked before

#

what the fuck are delegates

#

and why even

#

just give me a method to pass data, the fuck is this shit?!

#

like what the fuck am I supposed to do with

val data by findOrSetObject { BlockyRanksCommandData() }
and
val data by requireObject<BlockyRanksCommandData>()
if it results in a null pointer exception?!

heady birch
#

For the love of god:

#

I have no idea

distant sun
#

where do people find these symbols lol

static zealot
#

IIJ

#

the selection is "broken"

heady birch
#

Lol

#

Column selection mode

static zealot
#

yeah where do I change that? xD

heady birch
#

Go to Edit -> Column Selection Mode

#

I remember when I did that

static zealot
#

ah xD

heady birch
#

I had no idea what it was called either

static zealot
#

ty ty

hot hull
#

Hopefully this gives me exactly 10 XP, please Barry.

hot hull
#

Please Barry, 3 XP, ktnxbye

onyx loom
#

OMG

#

thats one for the history books

#

now dont talk anymore, keep that nice xp number 🙂

jovial warren
hot hull
old wyvern
#

gg

hot hull
#

Quick question fellas, what would be a clean way of looping throw a players inventory mapping it's contents doing some checks, and then managing the inventory (removing certain items)

#

(Trying to avoid looping several times)

jovial warren
#

the same way you'd do that with anything else

#

iterate over all the items, map them and filter them

old wyvern
#

Sequence maybe

dusky drum
#

how often do unused objects get deleted

heady birch
#

As often as GC removes them

old wyvern
#

"Unused" not, Only onces that are no longer referenced anywhere afaik

#

as in more of "Unreachable"

dusky drum
#

i mean since i construct class eachtime someone opens gui

#

so

#

idk

#

if thats the best way=

old wyvern
#

As long as there are no held references for it, it will be GCed

empty flint
#

Who was working on the Elara parser stuff? I would just like to ask a few questions about the parser 🙂

old wyvern
#

Me?

dusky drum
#

okay

old wyvern
#

and Km and Katsu too

empty flint
#

Cool! What's the grammar files for when you have your own TokenType defined? Are the g4 files used? (there's a comment in the lexer file that says it isn't?...)

ocean quartz
old wyvern
#

You can ignore those, they were just initial example that were written down

hot hull
#

Matt, what's the syntax for multi lined?

empty flint
#

Thought so. Secondly: How do you build your Tokens from an input to use as parameters for the ElaraParser class? ElaraParser(tokenList: List<Token>)

distant sun
#

Yugi, link?

old wyvern
#

to what gab?

distant sun
#

Elara

empty flint
old wyvern
#

mhm

#

Parser is being redone a bit

ocean quartz
#

\n but it doesn't carry formatting, example:

**This**\n*works*

**this\ndoesn't**
old wyvern
#

Need to handle errors properly for usage for syntax checking later on... ect

empty flint
#

But do you have the code for Token generation? I'm mostly interested in that

old wyvern
#

In lexer package Borz

empty flint
#

Oh there it is

#

my bad

#

ty!

steel heart
#

@ocean quartz love you no homo

empty flint
#

@old wyvern What's the reason for the substring(1) here:

companion object {
        // Creating regex to capture tokens
        val MATCHING_REGEX by lazy {
            values().joinToString(separator = "") {
                "|(?<${it.name}>${it.regex})"
            }.substring(1) //why is this necessary? Side note: if you remove it, prepare your anus.
                .toRegex()
        }
    }

Can't you just do

companion object {
        // Creating regex to capture tokens
        val MATCHING_REGEX by lazy {
            values().joinToString(separator = "|") {
                "(?<${it.name}>${it.regex})"
            }.toRegex()
        }
    }
hot hull
#

Side note: if you remove it, prepare your anus.
:bruh:

empty flint
#

dw I lubed up just to ask this question.

hot hull
#

lmao

old wyvern
#

To remove the initial vertical bar

empty flint
#

But you can just use the separator "|" instead, no?

old wyvern
#

That is what we are using?

empty flint
#

separator = "" Are my eyes deceiving me?

#

I guess what I'm asking is, is there a reason you map the enum to the capture group with a separator instead of using the separator as the separator?

old wyvern
#

I guess not, wasnt done by me

empty flint
#

kewl. thanks. now I got lube up my bum.

old wyvern
#

katsu reffered to a old lexer I had written

#

There I had not used join to string

#

🤷‍♂️

prisma wave
#

Using regex in general is kinda gross

#

But it works

old wyvern
#

mhm

#

tbh we may have time to improve the lexer

prisma wave
#

Hopefully

old wyvern
#

😂

empty flint
#

Using regex in general is kinda gross
@prisma wave What would you suggest?

prisma wave
#

A typical lexer just iterates over the individual characters

#

Since tokens are usually very small patterns

#

You can just effectively hardcode things

hot hull
#

Setup a web server which forwards all the parses, then you manually type and send the string which get's returned to the user fingerguns

empty flint
#

hm

old wyvern
#

also

#

km

#

We should probably include line number in the token so the output can be more useful xD

distant sun
#

@prisma wave what are .g4 files?

old wyvern
#

ANTLR gab

empty flint
#

@distant sun ANTLR grammar files

distant sun
#

ic

static zealot
#

oh man making a [item] thing is harder then I imagined xD

hot hull
#

You've already doomed yourself Blitz

distant sun
#

because you have to serialize the item

hot hull
#

Especially cause you're trying to make it for Dchat which is going to be a bitch to get the actual message

static zealot
#

thanks for encouraging me xD

#

I'm using ProtocolLib packets now if that makes a difference 😦

empty flint
#

Here's my actual problem: I am trying to make a parser for my command parsing and every cli parser I've tried so far conforms to fucking GNU or posix command syntax so you can't make custom named subcommands and parameters. Idk what to do now 😦

hot hull
#

It kind of doesn't

static zealot
#

I thought so

hot hull
#

I gave up after like 10 hours, but you know I'm feeble minded so fingerguns

static zealot
#

yeah I'll give up after 30

#

well I do have the message. Just need to make the lore xD

#

:((

hot hull
#

Would probs be easier to bully clip into adding it into dchat itself

static zealot
#

I mean I could just use InteractiveChat as well

#

but yeah wanted to implement as much shit I could in my plugin

hot hull
#

But I've no idea why

old wyvern
#
while (amount > 0 && position <= contents.size()) {
      final ItemStack content = contents.get(position);
     if (content == null) {
         continue;
     }
...```
Infinite loop
#

at all the continue points

#

@hot hull

hot hull
#

oh shit :kek:, do I use return or?

old wyvern
#

increment position before continueing if you wanted to go on

#

or

#

rather use ++ in the position check

#
while (amount > 0 && position++ <= contents.size()) {
      ...
}```
#

Dont forget to remove the last counter in this case

static zealot
#

yo I'm confused. How do plugins that have teleport commands get the nearest safe location? Like going thru all blocks in the are seems kinda much to do.

hot hull
#

nvm I do yes

static zealot
#

oh that does make sense xD

#

so they just go thru x and z instead of going thru y as well

old wyvern
#

I mean you might still find "unsafe places" like in lava lakes and such

static zealot
#

yeah I know that. I just check what block it is there

#

and if its an unsafe block I just go to the next one

#

and I just have a list of unsafe blocks, Lava, Water, TrapDoors so far.

ocean quartz
old wyvern
#

lol

static zealot
#

just don't xD

ocean quartz
#

Yeah for now 1.8 is a no no for me

hot hull
#

Sad

static zealot
#

yo someone has a list of unsafe materials? Because rn I can't think of any other than just: trapdoors, signs, air, lava, water

#

oh what are they caled

#

the spiky things

#

that they added in 1.15

hot hull
#

string, piston, observer, redstone ore, some bitch ass bush

static zealot
#

ty ty

#

PRESSURE PLATES

#

as well

#

when I have a for in for and I use break in the second one it just breaks the second one right? (kotlin)

old wyvern
#

Yes innermost

ocean quartz
#

Alright, fun, it literally only works on 1.14+ it seems, the bungee chat stuff is different on other versions
Sucks but for now it's fine

old wyvern
#

If you want to break the outer one use a label

static zealot
#

yeah I remembered about labels I just wanted to be sure

#

thanks

hot hull
#

@ocean quartz I was gonna use it in FJ, but doesn't look like I will :(

ocean quartz
#

I'll make it compatible with older versions, not until i finish a bit of the main functionalities first

#

Hex in older versions will convert into similar legacy colors
again stolen from Nicole 👀

empty flint
#

@ocean quartz I really love this markdown syntax you got going.

#

@old wyvern So I read the parser class for Elara and I don't quite understand something:
How do you distinguish between two possible paths to parse if you consume tokens from a stack?

ocean quartz
#

Was gonna be done today but legacy versions killed it

hot hull
#

Bruh everyone just keeps stealing shit from Nicole kek

empty flint
#

Bruh everyone just keeps stealing shit from Nicole kek
@hot hull Who's Nicole?

ocean quartz
#

I mean she's the master of Colors

hot hull
#

Esophose @empty flint

empty flint
#

Oooooh

#

She's cool

ocean quartz
#

Noice, all formats can now be toggled on or off ;p
This is without nothing on
**bold** [hover](hover: hover test) [click](click: /hover test) *italic* __underline__ ~~strike~~ &clegacy color [#000](/guild/164280494874165248/channel/000/)hex color <g:#000:#000>gradient

#

5 Commits in a day, that's a new record for me lmao

#

23 issues though

dusky drum
empty flint
#

How would you indicate indefinite repetition of a parameter in a command?

#

like vararg but to it's understandable for the average 12 year old mc server owner

#

like if you want the user to input as many strings as they like but at least one, something like this?
/cmd <string>[, <string>][...]

prisma wave
#

/cmd <arg...> perhaps

empty flint
#

<arg...> or <arg>...?

hot hull
#

First

winter iron
#

take looky

#

🙂

static zealot
#

nice nice

winter iron
#

ty

#

spent the last 8 hours on it

#

Lmao

static zealot
#

American Footbal. +1 for that

winter iron
#

Yah yeet

static zealot
#

oh man I messed up 😦

prisma wave
#

pdm in the background

#

huge

remote goblet
#

free pdm publicity

prisma wave
#

although I'm not sure that code should be your main "selling point"

#

no offense lol

static zealot
#

xD

prisma wave
#

peperoni
typo

surreal quarry
#

get an ssl cert fingerguns

empty flint
#

So you turn pizza into code?

static zealot
#
    @EventHandler
    fun onPlayerTeleport(event: PlayerTeleportEvent){
        val cause = event.cause
        if (!event.isCancelled && cause != CHORUS_FRUIT && cause != END_GATEWAY && cause != END_PORTAL && cause != ENDER_PEARL && cause != NETHER_PORTAL) {
            mainClass.playerLastLocation[event.player.uniqueId] = event.from
        }
    }``` Isn't this suppose to register plugin teleports and other teleports like death location? I don't get why when I try to get the location that is saved I get that the location is null. I tried killing myself, teleporting using essentials tp, minecraft's tp and other teleports from other plugins but it still tells me its null.
distant sun
#

!event.isCancelled
Add "ignoreCancelled = true" on @EventHandler

static zealot
#

oh man I'm getting worse and worse xD. I forgot I removed a lot of stuff in my main class and forgot to register the event again ...

#

and I made the checks for the block the player teleproted from ... not the one under 😦

#

oh man

#

time to change 20 lines

#

oh genius. I made it in 1 line xD

jovial warren
#

@ocean quartz what's that?

#

the certification thingy

heady birch
#

^ Me asking this as well

ocean quartz
#

Codacy, it rates your projects code

jovial warren
#

of course it's Codacy lol

#

should've known that

#

a plugin that I have installed, but use merely because I like the little green box that comes up when it's suggesting methods

#

@static zealot classic: have you put that in a class that extends Listener and registered that listener?

static zealot
#

yeah it was the fact that I added the papi check and moved the listeners inside the check but forgot to move all of them and that one was not registered

#

xD

jovial warren
#

usually it's annotating my event handlers with @EventHandler that I forget

#

I mean, for Java, their method of making you implement Listener and then annotate your handlers with @EventHandler works because it's fully OOP, but in Kotlin, it gets annoying

static zealot
#

🙂

jovial warren
#

if only Spigot just scanned files for methods annotated with @EventHandler and registered them internally 🤔

static zealot
#

eh I don't mind it

jovial warren
#

whether that'd actually be handy or not (or even possible) is another story

static zealot
#

I just knew I registered it but forgot I deleted the lines and forgot to register one of my 4 listeners

prisma wave
#

possible

#

but unreliable

#

if you were scanning the classpath for methods then you would need to somehow get an instance of the class

steel heart
#

Ewww EventHandlers

compact perchBOT
#
HelpChat Paste

Please use a paste service to share configs, errors, code and long logs.
HelpChat Paste

prisma wave
#

so you'd either need to bundle a DI framework (and thus force all plugins to use that), or force every event handler class to have a no-args constructor

#

which in the end actually restricts developer freedom

#

rather than the opposite

steel heart
#

Well Bard I’d suggest a framework for you

jovial warren
#

it's always Java that ruins good ideas that would work well in Kotlin

#

@steel heart hit me with it

prisma wave
#

it wouldn't work well with kotlin either...?

jovial warren
#

why wouldn't it?

prisma wave
#

why would it?

steel heart
#

Helper by lucko, I don’t know if it works good with kotlin but you can do in java.
Events.subscribe(EventClass.class)
.filter(e -> true)
.handler(e -> {});

prisma wave
#

that's just reactive programming

jovial warren
#

I'd probably rather create that as a module for Octo lol

prisma wave
#

pretty much

steel heart
#

yeah

prisma wave
#

plenty of libraries for that

steel heart
#

It is

surreal quarry
jovial warren
#

also, do you think it would be a good idea/fun project to create a DI framework @prisma wave ? like just for the fun of it, because I am that bored lol

steel heart
#

Well guice and other di frameworks works good

prisma wave
#

depends on your perspective

steel heart
#

But sure

jovial warren
#

Koin is very promising for Kotlin as well

steel heart
#

It’s probably good for learning

jovial warren
#

but idk, I just want to use more reflection because reflection seems really fun

#

somebody will answer you when they're free and they know the answer

#

you rush people, they make you wait longer

ocean quartz
#

Matey, you posted there, someone will answer no need to come here ask ;p

prisma wave
#

reflection seems fun
doubt

jovial warren
#

lol

#

press X to doubt xD

#

but Kotlin reflection does though

#

from what I've used of it so far, it seems really nice to work with

#

also I really really really really really really really really wanna make use of annotations and experiment with annotation processing

steel heart
#

Ap is nice

jovial warren
#

AP?

steel heart
#

Annotation processing?

jovial warren
#

ah okay

#

I just wanna make use of more advanced things like reflection

prisma wave
#

annotation processing for DI frameworks is annoying

#

and by that I mean dagger

steel heart
#

I wouldn’t say reflection is necessarily more advanced

prisma wave
#

reflection is easy

steel heart
#

Well you can make yourself a nice looking spaghetti if you’d like to

winter iron
#

although I'm not sure that code should be your main "selling point"
@prisma wave
It was just meant for a quick image same with the putty shell crap

#

and then the pizza too

prisma wave
#

fair enough

winter iron
#

I think i'm gonna do a blur effect on it anyways

prisma wave
#

probably a good idea

#

it's a bit distracting

winter iron
#

I was gonna do it at the time, but I was struggling getting the slide shit working

#

even tho its very simple

static zealot
#

anyone better at math than me? xD https://i.imgur.com/aSnZ7no.png How would I go from 1 to 24 in a double for or something? I know I could just go 12-13-14-15-16-11-2-3-4-...-20 but its not that nice when I use it. This is for a teleport command that searches for a safe block near the teleport location if its not safe.

#

I mean would there be a easy way of doing it rather then just a lot of ifs or something?

#

I rly can't think of anything at this point. the little map I knew left my head 😦

surreal quarry
#

could you try and teleport them to the the place, and then if it isn't safe, loop through the blocks in like a x block radius and just pick the first one that is safe

static zealot
#

well that's not my dilema. I can just go thru all of them until I find a safe one but what I want to do is if the actually block is not safe I don't want to go like this https://i.imgur.com/Elt5wT2.png

surreal quarry
#

ohh

static zealot
#

because if the block number 12 is save it will just teleport to a further block

surreal quarry
#

i see you wanna go from the inside to the outside

static zealot
#

even tho 1 could be safe

#

yeah

#

searched for spiral formulas and things but nothing

#

couldn't figure one myself eithet

#

either

#

just with like an if for each block which is just shitty

ocean quartz
#

You want to go on a spiral?

static zealot
#

yeah

#

just like they are numbered

#

or something

#

dk how other plugins do it

surreal quarry
#

from inside to outside so he can get the closest block to the unsafe block

ocean quartz
#

You could save the base of it into a map and loop through the map

static zealot
#

hmm?

ocean quartz
#

Let me try writing something as example of what i have in mind

static zealot
#

loop thru it first

#

then check the closest one?

surreal quarry
#

that sorta looks like whatyou want maybe

#

actually you want it not for primes

ocean quartz
#

So I'm assuming in your case each number will represent an amount of coordinates right?
Let's say 1 will be -1, 0 2 will be -1, 1 right?

static zealot
#

yeah

steel heart
#

Blitz if we say there is an air block, you’d have to check if there is an air block y: +1 as well right?

static zealot
#

well I just get the highest block

#

from the location

#

so that's not a problem

#

I just check the one at y-1 that's all done

#

I just need to find another way to loop thru the blocks

#

but so far the best I have is go thru all blocks then save a map or something and check the closest one that is safe

#

I mean that could work as well I just thought maybe its an even better way to do it

steel heart
#

I was thinking of that you could maybe take usage or BoundingBox but sadly it has no iteration methods and doesn’t store more than 2 locations

ocean quartz
#

Okay so now i can do something like:

private val map = mapOf(
        1 to intArrayOf(-1, 0),
        2 to intArrayOf(-1, 1),
        3 to intArrayOf(0, 1),
        4 to intArrayOf(1, 1),
        5 to intArrayOf(1, 0) // etc
)

In this example, each digit will represent your coordinate, now you can loop through the keys 1 by one and check the coordinate modifier that is stored in it

static zealot
#

oh Ic what you mean kinda xD

ocean quartz
#

Basically:

map.forEach { key, value ->
  if (!isSafeLocation(location.clone().add(value[0], value[1]))) continue
}

Something like that

static zealot
#

yep but now that I think about it xD I have 30x30 blocks that I check

#

shit

#

I think I'll just check each block and then take the closest that is safe

#

because I don't think I'll be mentally able to do that for 900 blocks

ocean quartz
#

There should be some fast algorithms to do that, but this is about as high as my brain capacity gets without me being into it xD

steel heart
#

Well blitz iteration is kinda slow usually

#

Obviously depends on the context

static zealot
#

yeah I fully understand you. well my brain capacity is at full rn and I can't get it so that shows at what level I am and what level you are xD

#

or maybe I just thought what if I just go from i-1 & j-1 to i+1 & j+ and if it doesn't find it just goes from i-2 & j -2 to i+2 & j+2 etc.

#

oh wait thats just dumb

#

going thru the same blocks a lot of times xD

jovial warren
#

@static zealot where do you draw up that grid?

static zealot
#

the photos I just sent?

jovial warren
#

yes the grid

#

did you draw that by hand?

static zealot
#

my friend

#

:))

#

yes by hand

jovial warren
#

nice

static zealot
#

I need to have a visual representation or my brain jsut dies

#

but now it just died even with a visual representation

jovial warren
#

if I wanted to draw that I'd probably either grab my Amazon Fire tablet and use my stylus, or just grab out my massive notepad or something

#

@ocean quartz what does that do?

#

(what's map?)

static zealot
#

that's just an example to help me

#

but then I realised that won't work because I would have to add 900 elements

#

xD

#

or whatever they are called

#

inside the map

ocean quartz
#

It's just an example to show him my thought

jovial warren
#

ah okay

#

what you actually trying to do squidward? xD

static zealot
#

so you see the grid with green numbers? I'm trying to go 1-2-3-4-...-23-24 instead of rather going 12-13--14...-21-20

#

so I have a teleport comand and I want to get the closest safe location

#

I don't need to worry about y anymore

#

just x and z

#

but can't get a math formula or soemthing that won't just make it bad

jovial warren
#

the easiest way to do that would just to search the surrounding area in a certain radius for blocks that aren't air

#

but that is gonna take around 5 seconds if your area is big enough

static zealot
#

yeah but the thing is if I go from the farthest point it will get the farthest location most of the time

#

but I want the closest location

jovial warren
#

you could use AI training

static zealot
#

right

#

time to change subject xD

#

I barely can do a teleport command and you want me to go into AI training? xD

jovial warren
#

write an A* algorithm that finds the closest location to the attempted location, and when it finds locations within a specific radius you give it a treat, and when it finds a location really far away you give it a hard spanking

static zealot
#

yeah sounds easy. no way how to do that so ..

jovial warren
#

then it'll learn that closer locations are gooderer

#

anyway I'm gonna be out of here now

#

gn all

static zealot
#

gn