#help-development

1 messages Β· Page 788 of 1

storm crystal
#

I dont want it for learning purposes, I already told you what I want to store in it

wet breach
#

even so, there is too many variables where we can't tell you which to exactly use

#

all we can tell you is what is out there, and some of the benefits and cons of them

#

its really up to you to choose which you want to use

#

and the one you choose may not even be the best at first and you won't know that until later down the road

floral drum
#

I love mongo

#

oh wait the copyleft thing

#

ugh

#

I hate that one thing

wet breach
#

lol

floral drum
#

other than that, mongo is cool

wet breach
#

there is literally hundreds. Mysql, postgresql, mongo, sqlite, h2, MsSQL, IBM DB2, Cassandra, NoSQL, CSV, Orient, Dynamo, Neo4j, Firebird. And this isn't event a complete list

#

that link is for relational DB's

#

there is even more if we consider the non-relational DB's

#

such as transactional

river oracle
wet breach
#

most people would recommend you to use sqlite or Mysql namely because they are the easiest in terms of learning, using, and a bit forgiving in terms of screwing up stuff

storm crystal
#

So how the hell am I supposed to pick correct one

wet breach
river oracle
storm crystal
#

?xd

wet breach
#

you can't look at it in terms of correct, you won't know if its correct until later when its not providing what you need or its not performing how you need it to

#

but it also depends on your level of skills to use them as well

river oracle
storm crystal
#

Ill just stick to configs as long as itll work

wet breach
#

if its working for you and not providing you any issues right now, then I don't see a reason for you to need to change

river oracle
#

but if you insists not an issue

wet breach
#

but it does happen where you figure out how you are storing data does need to change, but you shouldn't need to worry about that until the time comes for it

#

and yeah, it may be wise at some point to learn about DB's

#

especially the common ones because then when you do need it, it won't be such a daunting task to learn it or try to use it

#

and as I have said, not all DB's are equal each one has its pro's and cons and some are tailored to very specific kinds of things or tasks

#

so when you do decide you want to use one, its up to you to research which ever and determine if it fits your needs or not

storm crystal
#

Idk man sitting in IDE and just doing homework is plain and boring as hell

#

In plugins it can at least be applicable right away

wet breach
#

well, programming is not always exciting and filled with thrills πŸ˜›

#

some of us here have been doing this stuff for a couple of decades

#

some others they are probably hitting or already hit their first decade πŸ˜„

lament slate
#

Hey frostalf I have reached a roadblock in my code can I have some help?

storm crystal
wet breach
lament slate
#

Thank you

wet breach
wet breach
lament slate
#

Errors with the thing you sent me and performComamnd

wet breach
#

well the thing I sent wasn't complete

#

also, I wasn't using my ide, so the size() method might not have been correct

#

could be length() not entirely sure XD

lament slate
#

it seems to be neither actually

wet breach
#

also, my for loop assignment may have been wrong πŸ˜›

#

it probably should have been Player player

#

for (Player player : Bukkit.getOnlinePlayers())
lament slate
#

WEll that fixed every error

#

Except the one I have with perform command

#

since I am confused on how to use it

wet breach
#

alright, well you didn't say anything about a command XD

#

so what do we have now?

lament slate
#

Well I cant even upload the photo

#

1 minute

wet breach
#

why not verify?

#

!verify

undone axleBOT
#

Usage: !verify <forums username>

lament slate
#

!verify SkiiTahoe

undone axleBOT
#

Rate limited. Please try again later.

lament slate
#

Thanks its rate limited :(

wet breach
#

lmao, just wait a minute and try again πŸ˜›

#

no rush as I am not going anywhere

lament slate
#

!verify Skiitahoe

undone axleBOT
#

Rate limited. Please try again later.

lament slate
#

Spoigot go brr

wet breach
#

?img

undone axleBOT
#

Can't send images? That's because you're not verified! Use !verify to complete verification.
Alternatively, you can upload screenshots to any image hosting site and share the link.

Here's some screenshot utilities that can use to upload images.
Lightshot: https://prnt.sc
Imgur: https://imgur.com/upload
Flameshot: https://flameshot.org

lament slate
#

Ok we good now

wet breach
#

if its code I recommend using the paste site

#

?paste

undone axleBOT
lament slate
#

what do I do for the paste site?

wet breach
#

copy and paste your code

lament slate
#

I did then

wet breach
#

on the right hit save, then share the link

lament slate
wet breach
#

oh didn't know you already had a foreach method

#

just fyi, the for loop I sent is the eact same as using foreach

#

so we can just move that bit up

lament slate
#

What do you mean move that bit up?

#

You mean your hashmap and my hashmap are the same?

wet breach
#

ok removed my for loop you put in, and moved it to your for each

#

since its the exact same

#

IE, no need to duplicate πŸ˜›

#

alright, that doesn't solve your whole command thing, but we will get to that. So are you trying to implement your own command for the plugin?

lament slate
#

No

#

I just want them to be able to do basic commands

#

randomly

wet breach
#

oh, need to move the assignment of the random too to be above that foreach

#

otherwise you get a NPE lmao

#

forgot to do that

lament slate
#

randomsMap.put(uuid, randomNum.nextInt()); above?

wet breach
#

see line 30 here, this thing needs to be above the foreach

lament slate
#

ok I did that however randomNum is still a error

wet breach
lament slate
#

well based off there number y es

#

if they get a 0 its help 1 its me hi basic stuff

wet breach
#

that is because you named it random instead of randomNum

#

either change randomNum to random or change the variable name

lament slate
#

kk

wet breach
#

either or it don't matter πŸ˜›

lament slate
#

Ok I did that then last thing I need is to somehow make the players run the command

wet breach
#

that isn't hard, there is a dispatchcommand method for players

lament slate
#

whats the difference ? or is there not many

#

Bukkit.getServer().dispatchCommand(Bukkit.getConsoleSender(), "someCommand");
would it be this

wet breach
#

so, do you want this in a loop or do you want this to happen when they do something?

#

like when they join

lament slate
#

Every minute if see the schedule builder

#

it runs

wet breach
#

not quite sure why you would want them to execute commands randomly lmao

lament slate
#

im goign to make it so that it uses a class plugin I have to just force switch class

#

if they run it

lament slate
#

Its going to be something called /class 1 /class 2 etc

#

However how would I make them do the command according to there id since i tried uuid and player but both didnt work for perform command

wet breach
#

might need to add a /

#

to the beginning of the command name

lament slate
#

I tested it you dont

#

Need a slash i think

#

I am getting a error forscheduler.runTaskTimer(plugin, () -> {

compact haven
#

well send the error?

lament slate
#

Cannont resolve method for runtask timer

compact haven
#

send ur code and error in a pastebin

#

error as in the whole stack trace

#

and code as in the whole class that has a problem

lament slate
#

kk

#

?paste

undone axleBOT
lament slate
compact haven
#
           if (randomNum==0){
                UUID.performCommand("help");
            }

how does this even compile

river oracle
compact haven
#

anyways this code makes no sense

#

you're invoking static performCommand from classes that don't have it

#

you're using some random ScheduleBuilder class

storm crystal
compact haven
#

and u have timers in timers :?

#

now send the error you got @lament slate the whole stack trace

wet breach
#

lol, they had it commented out when I was helping them

#

yeah probably shouldn't put the scheduler inside the scheduler

#

XD

wet breach
compact haven
wet breach
#

even I still learn stuff just on a different level

compact haven
#

It's not 10y of "just learning." It's 10 years of learning and producing

#

it's not like you're doing school assignments for 10 years to "learn"

#

you just learn while doing

wet breach
compact haven
#

seems like it Β―_(ツ)_/Β―

#

DusskTaler, ask your doctor why they didn't just spend a year learning and if they just quit learning now that they got their job

wet breach
#

but they fail to understand that without learning they won't understand the help being provided or why you should do something in a particular way, and instead accuse people of giving them half measures XD

lament slate
#

Ok let me do it now I got water and am back

compact haven
#

Any good doctor will tell you that they are constantly learning every time they see a patient and write a diagnosis, research a problem, etc

lament slate
#

What do you mean send the whole stack trace error?

compact haven
#

bro

#

in your console you told me you get "Cannont resolve method for runtask timer"

compact haven
#

everything in red in your console, or everything that looks gibberish

storm crystal
#

School sucks

lament slate
#

Ok i understand

compact haven
#

that was my point

#

programming is learning by doing

#

not learning by instructure

storm crystal
compact haven
#

you will learn by instructure your basics, then you will learn by doing everything else

storm crystal
#

So wheres the logic in that

compact haven
#

you still need instructure to learn the basics Β―_(ツ)_/Β―

lament slate
#

cannot find symbol for runTaskTimer(plugin

wet breach
compact haven
#

send your entire console @lament slate

#

not a single line

lament slate
#

ok

compact haven
#

anyways thats a compile error? not a runtime error?

#

are you programming in Notepad? I have no idea how you can write code that invokes non-existant methods

wet breach
lament slate
#

import org.bukkit.scheduler.BukkitScheduler; ihave tho

#

I have that though

wet breach
#

then maybe its because you stuffed the scheduler inside of a scheduler XD

compact haven
#

what are you programming in? Microsoft Paint?

wet breach
#

so probably should correct that issue

lament slate
compact haven
#

nah he wouldnt get that error for the stupid scheduler thing

lament slate
#

INtelliJ

compact haven
#

no you are not

storm crystal
lament slate
#

Yes I am

#

IntelliJ i am using

storm crystal
#

Pretty confusing to say the least

compact haven
#

where are you getting the error?

#

in your server console or as a tiny tooltip in IntelliJ?

lament slate
#

when I run I get this
cannot find symbol
cannot find symbol
non-static method performCommand(java.lang.String) cannot be referenced from a static context
non-static method performCommand(java.lang.String) cannot be referenced from a static context

compact haven
#

okay yeah

wet breach
compact haven
#

?learnjava

undone axleBOT
compact haven
#

you're writing code that isn't going to compile

wet breach
#

other then learning basics, I would recommend using a proper IDE

storm crystal
compact haven
#

like I wish I could help you more

wet breach
compact haven
storm crystal
#

I did w3school

lament slate
#

Well the main problem you are seeing is wit hthe double scheduler which I didn't add I used a util schedule builder for mine to work

compact haven
#

@storm crystal can you point me to your problem / the convo? maybe I can be of help?

compact haven
zenith gate
#

Could not find artifact com.github.ToastArgumentative:ToastRPG:pom:v1.0.1-2 in papermc-repo (https://repo.papermc.io/repository/maven-public/)

Why is maven trying to get my library from paper? i have jitpack in my repo which is where my library is suppose to come from.

lament slate
#

Ya thats the only error I am getting dominick also

compact haven
#

that's not a static method and therefore cant be invoked like that

lament slate
#

Ok well I do not know how to invoke it

wet breach
lament slate
#

thats why I was here XD

zenith gate
river oracle
lament slate
#

I am trying to make it so that players perform a command acording to the number but I do not know how hence performCommand

storm crystal
zenith gate
river oracle
compact haven
#

@lament slate ^

#

basically you were invoking methods out of context

you had Player.performCommand instead of player.performCommand. Player is a class, player is a variable
and you couldn't do player.performCommand because it was outside of the scope where you looped all players (it was outside the brackets)

wet breach
zenith gate
lament slate
#

Thats dominick Il ltry it

river oracle
lament slate
#

OH ok thatnks ill try that

river oracle
#

jitpack is so dumb why I just use reposilite or repsy

zenith gate
wet breach
zenith gate
wet breach
#

just fyi

zenith gate
wet breach
#

I don't mean just using tags

#

I mean actually providing a release

zenith gate
#

with compiled source code? or it just zipped?

wet breach
#

if you instead upload a release to the github repo using a tag for version

#

jitpack will use that release instead of trying to compile the project

wet breach
#

preferrably a jar

zenith gate
#

it is zipped.. but i can add a jar

wet breach
#

so you can just compile from ide, and then upload the jar as a release

#

and then jitpack will use it, and its faster that way πŸ™‚

#

jitpack sucks if it has to compile it and sometimes takes too long that the compiler will error before jitpack finishes

zenith gate
#

so I should just compile it before hand

#

that makes sense.

wet breach
#

sure why not? have to compile it anyways for a proper maven repo anyways

#

if you did have one

#

just most people who have a proper maven repo also have a CI that builds that stuff for them πŸ˜›

lament slate
compact haven
#

no

lament slate
#

Thank you!

compact haven
#

they need permission to run the command

river oracle
#

they even provide viewing of docs etc

wet breach
compact haven
#

@zenith gate how much usage do you expect to see? if its not a ton, I can give u access to my reposilite instance @ https://maven.dominick.sh

lament slate
compact haven
#

eh there might be, not sure

wet breach
#

typically all players have permission to run basic commands

#

like help for example

#

unless you specifically take that perm away from them

#

oh no, the bot is typing

bold pier
#

I'm new to spigot, and was wondering if it is possible to check an items stats, like how many blocks a pickaxe has mined and display that number in one specific line of its lore

wet breach
zenith gate
#

No no I think i know what the issue is, 1 prolly is timing out if it isnt ill still compile ahead of time, and I also had a few classes I updated, and i didnt update the supers, so it wouldnt compile anyways.

rough harness
#

can someone add 3 slot here i dont know how to dev and this came in a tutorial pack

sullen marlin
#

No that info isn't stored, you'd need to store it yourself

untold mauve
#

how would it be possible to wait to load the players inventory?
like for example when the player joins, their inventory is blank and then after the player runs a command their sever inventory is loaded

do i just copy the inventory to a hashmap, clear it, and set it later?
or is there a better way to do it

wet breach
#

jitpack won't provide anything if it fails compiling πŸ˜›

#

if you didn't provide a release, and zips can be used as a release just fine but the user has to specifically set the package type of the dependency as a zip instead of jar

#

so, typically better to provide a jar and not confuse your users

compact haven
#

look into github actions for a simple CI workflow to test compile on each commit btw

#

tho u can also setup IJ to do that pre-commit iirc

#

surprised the automatic code analysis on commit didnt catch that tho?

compact haven
#

not the place

rough harness
compact haven
#

that's not even code

rough harness
#

idk

lament slate
#

do you think this would work
Bukkit.dispatchCommand(player,"me hi")

compact haven
#

yes

#

with a semi colon after

rough harness
lament slate
#

Ya ik

#

I f orgot to copy it

compact haven
#

config != code

rough harness
#

that makes the menu?? i need to add 3 more buttons some how

wet breach
compact haven
#

skript?

wet breach
#

there it is

compact haven
#

mycommand?

#

yeah its neither of those aha

wet breach
#

I know lol

compact haven
#

I mean maybe mycommand, never used that

wet breach
#

but they would still be in wrong place if it was skript or something else

compact haven
#

agreed

zenith gate
rough harness
compact haven
#

no

wet breach
#

?services

undone axleBOT
rough harness
wet breach
#

that isn't our problem, its the appropriate place for what you are wanting

#

this channel is to help those who are developing plugins and the related. You already stated you are not a developer so what you are asking doesn't belong here, the other help channel is for help with the server related issues. That only leaves the forums for what you are requesting and not here. πŸ™‚

river oracle
#

@wet breach do you know a good bit about bit shifting I'm actually curious about something.
so this is the code for packing 2 ints into a single long long packedInts = (((long) left) << 32) | (right & 0xffffffffL);, but why does it work

#

I get pushing up the left int 32 bits, but besides that I'm not really sure

#

for example the Binary OR and AND

ivory sleet
#

Well

#

You bitmask the 32 bits to the right and then u just concat them

#

like the AND just makes sure that the 32 bits to the right are the remaining ones that should be

#

basically
yyyy|0000
->
0000|xxxx
->
yyyy|xxxx

wet breach
# river oracle <@227800863022907393> do you know a good bit about bit shifting I'm actually cur...

Here is an example of understand bitwise OR

The bitwise OR (|) operator returns a number or BigInt whose binary representation has a 1 in each bit position for which the corresponding bits of either or both operands are 1.

const a = 5; // 00000000000000000000000000000101
const b = 3; // 00000000000000000000000000000011

console.log(a | b); // 00000000000000000000000000000111
// Expected output: 7
#

so when we add 5 and 3 together using or, the result is 111

#

thus 7 and not 8

#

beecause we are not counting the numbers or doing addition

#

we are instead assigning the bits where they are filled and putting them together

ivory sleet
river oracle
#

hold up let me demo with 8 bits here and two 4 bit ints

int4 num0 = 0001 // 1
int4 num1 = 0111 // 7

int8 pack = num0 << 4 // this woud result in 00010000
int8 pack = pack | num1
/*
* 00010000
*     0111
* --------
* 00010111
*/

Is this kinda the idea

ivory sleet
#

since we don’t want them to influence the AND operation

#

yes

river oracle
wet breach
#

it won't wrap around

river oracle
#

oh I meant left shift

#

oops lol

wet breach
#

so right or left shifting kind of shifts the bits off into the ether

#

hence why when left shifting the sign gets lost

ivory sleet
#

And then with ur example u’d also use
0b1111 & num1

#

in case num1 > 0b1111

wet breach
#

but in your example other then the incorrect shift your answer is correct on the bits returned

river oracle
ivory sleet
#

no not rly

#

sorta tho

#

its like
0100 & 0010 = 0000

#

0101 & 0011 = 0001

#

AND

river oracle
#

oh wait I just realized what the front is lmfao

#

I thought that was hex for some reason

ivory sleet
#

but if you use the bitmask
1111 it will basically just allow 4 trailing bits of whatever input u take

#

oh lol

river oracle
#

I didn't realize it was just 1111 in binary

wet breach
ivory sleet
#

Yeah y2k

#

In the example i sent

#

they use the largest int as the bitmask

river oracle
#

mmmm i see

#

so when bit shifting like that you lose signage though huh

wet breach
#

yes

#

unless you do <<<

ivory sleet
#

indeed

river oracle
#

cuz the sign bit dies

wet breach
#

but there is no >>> for right shifting

#

so you can still lose the sign πŸ˜›

river oracle
#

so what would I do if I wanted to preserve signage πŸ€” wouldn't that be hard though

wet breach
#

typically its best to record the sign before doing any shifting so you can apply it later if sign is really important

#

however most bitshifting doesn't need the sign and thus ignores it

river oracle
#

right now I'm seeing if I can pack an location (x, y, z) into a long array with length 2

wet breach
#

for example 3 is still 3 even if its -3 because in binary, the very left most bit is either 1 for negative or 0 for positive

#

otherwise everything is on the right

ivory sleet
#

given xxxx and yyyyyyyy (binary)
we make xxxx0000 by xxxx << 4
we make 0000yyyy by yyyyyyyy & 00001111
we concatenate to xxxxyyyy by xxxx0000 | 0000yyyy

ivory sleet
river oracle
#

ahh okay

#

since I have you here conclube I'm wondering a good way to go about this, as I've been trying to think up stuff, but I'm not sure what the "best" way to do it is

wet breach
#

if you get really good at bitshifting, you can actually do very large calculations that exceed integer sizes by splitting up the numbers between two or more integers and working on each as appropriate and then you would just combine them together to get your result

ivory sleet
#

Yea

river oracle
#

Essentially I'm making a plugin where you can place Multiblock structures into the world, I am adding PDC to each chunk the structure is in which references the data of the structure, once its interacted with its loaded in from the chunk's PDC into a cache so I don't have to keep constructing the object while the chunk is loaded.
https://paste.md-5.net/emaxazijop.java. Right now I'm doing what is in the paste, but I feel like there may be a much better way to go about this

#

I generally want to be fairly efficent with this seeing as their could be thousands of these structures

#

they store very little data and do most of their functions lazily already, but actually storing them is another issue, I've got the PDC thing down pat for sure, but storing and retrieving them from memory is another story

wet breach
#

world.getMostSignificantBits(), world.getLeastSignificantBits() you can combine these together and store it as a single long

#

there is actually a method for this where you can get a UUID from a long

#

in fact there should be one for the UUID to get its long format

river oracle
#

an *efficent viable solution

wet breach
#

well, storing purposes you don't need to split them up like this

#

but as for unraveling a long into a UUID you can do it with bitshifting too if that is a concern

river oracle
#

not super concerned with the micro optimizations atm just want to make sure I'm somewhat on the right track, wasn't really sure how else to go about this

#

I feel like a data object isn't really needed here for the map either as it'd be a waste I'm only storing numbers

wet breach
#

can there be a different generator at each location?

#

or is it just per chunk?

river oracle
ivory sleet
#

Which version of uuid does the world have frost?

wet breach
#

should be version 3

ivory sleet
#

Ah ok yeah

river oracle
wet breach
river oracle
#

my default one is not, but one could create a schematic which is simple 1 block

ivory sleet
#

I know for instance world edit and worlguard uses octrees for their regions y2k

#

Or well I believe they do at least lol

wet breach
river oracle
#

they are always multiple locations

#

in this specific case its a grouping of 27 blocks

wet breach
#

then you are better off using a format similar to chunks for your coords

#

basically you would treat your coords as chunks but custom because of your requirements

#

in this manner, regardless of a coord you should easily be able to obtain any other part of it

#

since we are going with multiples of 3, it wouldn't be that much different then what MC uses where its a multiple of 8 or 16

#

not sure if you were aware, but you can actually obtain a chunk coord from the location coord via bitshifting by 16 I think it was

river oracle
#

x >> 4 z >> 4 for the chunk coordinates

wet breach
#

ah right 4

river oracle
#

so how would that work out though. I'd need to way to determine if I'm in a 3x3 area based upon a coordinate location

wet breach
#

so anyways, in MC, locations are all backed by a chunk, and each chunk backed by a region file, which is backed by the world

wet breach
#

if it makes it easier use base 3 system

river oracle
#

but remember since I'm using Chunk PDC i'd also need to beable to determine what chunk/chunks I'm in, but that'd be a completely separate concern huh, that really owuld have no bearing on how its stored in memory

wet breach
#

using base 3 would make it easier on you in terms of doing the math since it can be a bit hard to keep track or visualize with base 2

#

and its really not hard to go from base 3 to base 2 and vice versa

#

the math is actually quite simple for that

river oracle
#

wait wouldn't this fall through because you could technically place these generators inbetween my "chunks of 3"

wet breach
#

you mean you could place a generator inside the locations of another generator?

river oracle
#

I will just use 3 chunks as an exmaple here on a 2d plane
x is our first chunk
y is our second chunk
z is our third chunk
g is where the generator lays

xxgggyzzz
xxgggyzzz
xxgggyzzz
``` as you see my generator intersects with chunk x and y where you now have 2 y's taken and 1 x taken
ivory sleet
#

Y2K i don’t think ur current system is bad

river oracle
wet breach
ivory sleet
#

like u can change it and do it with what frosty suggested, but like… then u need to prevent intersections and possibly spaces of arbitrary n blocks between 2 generators

river oracle
wet breach
#

which is what asked in that you could place a generator inside the location of another generator

#

and you said no lol

#

but now you are saying yes

river oracle
#

I couldn't place a generator at the 2 x spots left, and the 1 y spot left

wet breach
#

ok, so then I am not understanding then since I am only concerned with generators

#

nothing else

ivory sleet
#

But as said, another way to represent these regions is in an octtree-styled fashion

wet breach
#

I suppose that is what I am getting at

#

in a way

ivory sleet
#

tree with 8 nodes per node

wet breach
#

but if your generators can't overlap at all you shouldn't have an issue in creating custom chunk structure and your own coord system to refer to each generator

#

basically each 3x3x3 is its own chunk coord, and from there you would get everything else in there, and then you could get real coords easily

ivory sleet
#

I think another issue is that there may exist 2 generators both with the volume of 3x3x3, but there might be 1 block spaces in between

river oracle
#

or trying to explain earlier

ivory sleet
#

Yea

wet breach
#

what would be in between the generators that would be important ? o.O

ivory sleet
#

Not sure if every volume was 3x3x3 axis aligned

#

But ye

river oracle
wet breach
#

well, you didn't say anything about other block spawners lol

river oracle
#

I could just force a snap to a 3x3 grid, but then again I feel like a better solution would be afoot then

wet breach
#

having it axis aligned would be ideal

river oracle
wet breach
#

however even if we are not doing axis aligned you could do a sudo alignment as well

#

but I think the easiest would just to treat those gaps as their own thing

#

you could just map those gaps as needed to whatever you needed them to be

river oracle
#

@ivory sleet I've got to head to bed, but would it be fine for you to explain the OCTOTREE to me more tomorrow night, If I can't get a good grasp on it I might just do an 3x3 grid as forst suggested for now and maybe switch it up later.

#

It'd be pretty easy to make a grid snapping system for them, so if I were to execute this I'm not too concerned about all that

wet breach
#

ah yes the historical misspelling of my name can't forget that πŸ˜‰

ivory sleet
#

Yeah miles, lets takr that tmrw then :)

river oracle
#

wavegif thanks for the help guys

#

I've exited this discussion a semi smarter man

wet breach
grim hound
#

Are you... Adding imports by hand?

lament slate
#

Yes however

#

The program works now

grim hound
#

Do you know about the IDE's auto import/import select?

lament slate
#

nope

grim hound
#

Also what do you program in?

lament slate
#

IntelliJ

grim hound
#

Yeah so

#

If there is "cannot resolve smthg"

#

Left click on that

#

The alt + enter

lament slate
#

huh more ya know

grim hound
#

Left alt

lament slate
#

Thanks for teaching me that trick

grim hound
#

It should suggest imports if there is more than one class with that name

lament slate
#

Ya I just tested it

#

with player

grim hound
#

Anyway gtg now, school's waiting

lament slate
#

Peace

icy beacon
valid burrow
#

whats the diff between creaturespawnevent and entityspawnevent

#

waitnvm

#

makes sense actually

lament slate
#

?paste

undone axleBOT
lament slate
#

Hi currently my plugin makes all players every minute randomly choose a number between 0-2 and a command happens based off that. However I found a error the player needs to have OP to use the commands or the perms to use them which is a problem for me. Does anyone know a work around to this? My idea was to make another class which grabbed the players name and stores it and then tells console to run it as the player with execute? I do not know if thats possible though and could use some guidance.
Code Here if you want to see it:https://paste.md-5.net/ijaharisin.java (Reply to this if you can or ping me since its late for me and I might not see it until tommorrow)

wet breach
#

give them the perms

smoky oak
lament slate
wet breach
#

they don't need creative perms to run commands?

lament slate
#

one of the commands is gamemode creative

wet breach
#

ok....then how you expect them to run that command ?

#

what are you expecting to actually happen?

lament slate
#

Well I am going to change it something that is a class thing later on for fighting however the point is you get the class and no switches until 10 minutes

wet breach
#

fyi, you can just change their game mode via the api

smoky oak
#

that too

wet breach
#

it should never really be necessary from the plugin to make a player do a command

lament slate
lament slate
smoky oak
#

add the string at the end but frosthalfs right, use Player::setGamemode

lament slate
#

ive been here for 7 hours I am not wasting that time :(

wet breach
#

I see we are going to get a bunch of new developers wanting to do the wrong things πŸ˜‘

lament slate
#

Ya frost you already know that with me tho

wet breach
#

well you may be new, but that shouldn't be used as an excuse for doing it wrong

lament slate
#

True

wet breach
#

its your plugin however, therefore you are indeed free to do whatever

#

just can't expect some of the experienced people here to keep their sanity in trying to help you

#

or help for that matter

lament slate
#

ya fair

#

The point of the plugin is to not change there gamemode i was just using that to test I have a /class plugin to set somenoes class and no one can acess it however I want it so that the server randomly chooses one for them every 10 minutes

smoky oak
lament slate
wet breach
#

like a kit?

lament slate
#

Ya

lament slate
wet breach
#

this isn't hard to do, and you don't need commands for this although you can implement a command for testing purposes that only you can access

lament slate
#

Well how else would I give them a random kit

wet breach
#

as I said earlier, it is generally never necessary to make a player perform a command

wet breach
lament slate
#

I suppose that would also work ya

wet breach
#

instead of running a command, you instead would invoke one of your classes for a kit to give

#

and you would turn this into a method that gets invoked instead of your command thing you are doing lol

lament slate
#

Ya true

wet breach
#

if you need something to provide some insight here is one of my defunct plugins that is handy for teaching

lament slate
#

Thanks

wet breach
#

its open source under the MIT license I believe so feel free to use what you find handy

lament slate
#

I plan for this plugin that im making to be a one time thing then since I did it so badly

#

so next time im better

wet breach
#

well as long as you are learning and plan to do better next time around. It is what makes some of us here so called professional

#

because we learn from our mistakes and try to not do them again πŸ˜›

lament slate
#

Ya next time I got so much to ad

#

add*

#

and a new way of doing it easier

wet breach
#

that is always a learning experience

#

always learning a new way

lament slate
#

Welp for now ima try to do it wrongly and make console run the command for the player but next time ima just do the kits thing where I make them equip the stuff

wet breach
#

lol

lament slate
wet breach
#

don't worry I have had projects where it took a couple of months

#

just take your time on it πŸ™‚

lament slate
#

public static Player getPlayerExact(){
return getPlayerExact();
} would this be a way of grabbing names and then sending them

wet breach
#

you could, but uh I recommend not using static though

#

if you want to use static then use the Bukkit method

#

Bukkit.getPlayerExact(name or uuid here);

#

that method is static already so no need to duplicate and create one

lament slate
#

so I do not need a new class?

#

or I do not need static

rotund ravine
#

Don’t need a new method

lament slate
#

how would I do it without a new method since getPlayerExact does not work

#

Then

rotund ravine
lament slate
#

I tried that it did not work for me

rotund ravine
#

?nowork

#

?notworking

undone axleBOT
#

"Does not working" is a useless statement. Please describe what exactly is not working, what you expect it to do, and what actually happens. If you get any console errors, also ?paste the entire stacktrace.

lament slate
#

Ok fine

#

Expected 1 arguments but found 0 is what I get when i do

wet breach
lament slate
#

Bukkit.getPlayerExact(name or uuid here);

rotund ravine
#

?jd-s

undone axleBOT
wet breach
#

name as in the player name which is a string

#

or you input their uuid

wet breach
#

oh I was right the first time nice

#

just doing it all from memory XD

lament slate
#

Wait so I am confused then what do I put inside the parentehsis

#

Bukkit.getPlayerExact();

wet breach
#

either a string which is the player name

rotund ravine
#

Are you coding for a singleplayer game?

lament slate
#

No

#

multiple people

wet breach
#

or a UUID which belongs to the player

rotund ravine
#

getPlayer for uuid

wet breach
#

oh, then their name

#

which is a string

lament slate
#

so what I am hearing is that for Bukkit.getPlayerExact(); it will not get the player name since it needs the player name?? im confused

lament slate
wet breach
#

it grabs the player with that name or closest match to the name

lament slate
#

Ok is there a way I can just grab all players names?

#

and then do the whole process of making them run a command through console

wet breach
#

you woul need to loop through online players

lament slate
#

Ok I can do that hwoever what is teh command to grab a players name?

rotund ravine
#

Skiita

#

?jd-s

undone axleBOT
rotund ravine
#

Use the javadoc

lost matrix
lament slate
#

Ok can you send the begginers guide for java again so I can find that

#

Please

lost matrix
#

Sometimes people prefer learning through videos. You should also look into that.
Otherwise:

#

?basics

undone axleBOT
lament slate
#

Thank you

lavish cliff
#

guys what i can do when intellij is bugged like this?

#

(im using 1.19.2)

shadow zinc
#

Why am I getting the following error for the following code: ```java
java.lang.NoSuchMethodError: 'net.dv8tion.jda.api.entities.TextChannel github.scarsz.discordsrv.DiscordSRV.getDestinationTextChannelForGameChannelName(java.lang.String)'
at com.neomechanical.neoperformance.integrations.discorsrv.DiscordSRVHook.sendMessage(DiscordSRVHook.java:16) ~[NeoPerformance-1.15.jar:?]
at com.neomechanical.neoperformance.performance.performanceHeartBeat.HaltNotifier.notifyResumed(HaltNotifier.java:53) ~[NeoPerformance-1.15.jar:?]
at com.neomechanical.neoperformance.performance.performanceHeartBeat.HeartBeat$1.run(HeartBeat.java:58) ~[NeoPerformance-1.15.jar:?]
at org.bukkit.craftbukkit.v1_20_R2.scheduler.CraftTask.run(CraftTask.java:101) ~[paper-1.20.2.jar:git-Paper-260]
at org.bukkit.craftbukkit.v1_20_R2.scheduler.CraftScheduler.mainThreadHeartbeat(CraftScheduler.java:480) ~[paper-1.20.2.jar:git-Paper-260]
at net.minecraft.server.MinecraftServer.tickChildren(MinecraftServer.java:1470) ~[paper-1.20.2.jar:git-Paper-260]
at net.minecraft.server.dedicated.DedicatedServer.tickChildren(DedicatedServer.java:446) ~[paper-1.20.2.jar:git-Paper-260]
at net.minecraft.server.MinecraftServer.tickServer(MinecraftServer.java:1379) ~[paper-1.20.2.jar:git-Paper-260]
at net.minecraft.server.MinecraftServer.runServer(MinecraftServer.java:1156) ~[paper-1.20.2.jar:git-Paper-260]
at net.minecraft.server.MinecraftServer.lambda$spin$0(MinecraftServer.java:315) ~[paper-1.20.2.jar:git-Paper-260]
at java.lang.Thread.run(Thread.java:840) ~[?:?]

rotund ravine
shadow zinc
#
package com.neomechanical.neoperformance.integrations.discorsrv;

import github.scarsz.discordsrv.DiscordSRV;
import github.scarsz.discordsrv.api.Subscribe;
import github.scarsz.discordsrv.api.events.DiscordReadyEvent;
import github.scarsz.discordsrv.util.DiscordUtil;
import net.dv8tion.jda.api.entities.TextChannel;

public class DiscordSRVHook {

    public void sendMessage(String message) {
        TextChannel textChannel = DiscordSRV.getPlugin().getMainTextChannel();

        if(textChannel!=null) {
            textChannel.sendMessage(message).complete();
        }
    }

    @Subscribe
    public void discordReadyEvent(DiscordReadyEvent event) {
        // Example of using JDA's events
        // We need to wait until DiscordSRV has initialized JDA, thus we're doing this inside DiscordReadyEvent
        DiscordUtil.getJda().addEventListener(new JDAListener());
    }

}
shadow zinc
lavish cliff
rotund ravine
lavish cliff
#

everything , it's like im using 1.13

rotund ravine
#

Classname

lavish cliff
#

"Info"

rotund ravine
#

What is info?

#

?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.

lavish cliff
#

wait i will send u the class

rotund ravine
#

What is your pom/gradle?

lavish cliff
#

wait

rotund ravine
#

@lavish cliff

#

Oh ok

hybrid spoke
lavish cliff
rotund ravine
#

@lavish cliff

#

Thx

#

I can tell you brandname does not work

#

It does not exist in the api

lavish cliff
#

also getPing?

rotund ravine
#

getPing is there i. 1.19.2 on Player

lavish cliff
rotund ravine
#

Curious

lavish cliff
#

so how i can fix that

rotund ravine
#

Ctrl click on target?

#

Then ctrl click on player

#

See what it bring up from what dependency

lavish cliff
#

why bukkit 1.13?

rotund ravine
#

Well blame maven

lavish cliff
#

i don't find any method added in "latest" version

rotund ravine
#

@tender shard tell hum how to look throigh his maven dependency tree

lost matrix
lost matrix
shadow zinc
#

Server is using DiscordSRV-Build-1.26.2.jar, I am using <version>1.26.2</version> api

#

all latest

#

the documentation on discordsrv is horrid

shadow zinc
#

no, because the documentation doesn't cover that

lavish cliff
shadow zinc
#

never said anything on literally nothing

lavish cliff
#

use JDA

lost matrix
lavish cliff
#

ty

shadow zinc
#

the pom doesn't relocate

#

i've asked on their discord server but there is 0 support lol

lament slate
# wet breach you woul need to loop through online players

Ok I figured out how to do commands without having perms to actually do said commands thanks to you and JanTruck and 7smile7
ConsoleCommandSender console = Bukkit.getServer().getConsoleSender();
Bukkit.dispatchCommand(console, "execute as "+ player.getName() +" run gamemode creative");
System.out.println("execute as "+ player.getName() +" run gamemode creative UPDATE TEST");

shadow zinc
lost matrix
lost matrix
lament slate
#

For my first program its acceptable :(

lost matrix
#

Sure

lament slate
#

Look I didnt even know what a class was until like 6 hours ago

#

This is progress to me XD

lament slate
lost matrix
#

Just as a future reference. Your code will probably look more like this

Bukkit.getOnlinePlayers().forEach(player -> player.setGameMode(GameMode.CREATIVE));
lament slate
#

Ok well lets say I want the command to be /supersecretcommand

#

Then it would work :D

lost matrix
lavish cliff
lament slate
#

Ok ya for gamemode though I am saving that command you sent me since I needed that

lost matrix
lost matrix
lavish cliff
#

ok

#

omg that's the problem

#

ty @lost matrix

lost matrix
#

I think luckperms pulls oder versions. Same goes for Vault

lavish cliff
#

ye i need to update them

shadow zinc
#

dear lord this is shameful

lost matrix
#

Nah i mean they always pull ancient spigot versions no matter what XD

shadow zinc
#

they made an example project that doesn't cover half of it and called it a day

lost matrix
shadow zinc
lost matrix
shadow zinc
#

in there

#

i haven't committed

#

did it just then

lost matrix
weak adder
#

i have a set of 2 coords minX Y and Z and max X Y and Z in a config file
how can i detect if a player is inside the region?
Something like this

areas:
  test:
    enabled: true
    world: world
    time_required: 10
    location:
      minX: -439.0
      minY: 95.0
      minZ: 386.0
      maxX: -432.0
      maxY: 89.0
      maxZ: 395.0
lost matrix
shadow zinc
#

yes

#

and its functional

lost matrix
shadow zinc
lost matrix
# shadow zinc

Idk then.
Make sure to never use plugman or the /reload command of spigot. Other than that it sounds like a problem with their API.

shadow zinc
#

oh

#

hold up...

#

that might be it

#

nope

#

i was really hoping that was it

#

might just tell the person who suggested that to get fucked

#

thank you for the help, once again

lost matrix
# shadow zinc oh

Could you send the exception again?
The path youve sent before looks scuffed

shadow zinc
#
java.lang.NoSuchMethodError: 'net.dv8tion.jda.api.entities.TextChannel github.scarsz.discordsrv.DiscordSRV.getMainTextChannel()'
        at com.neomechanical.neoperformance.integrations.discorsrv.DiscordSRVHook.sendMessage(DiscordSRVHook.java:13) ~[NeoPerformance-1.15.jar:?]
        at com.neomechanical.neoperformance.performance.performanceHeartBeat.HaltNotifier.notifyHalted(HaltNotifier.java:33) ~[NeoPerformance-1.15.jar:?]
        at com.neomechanical.neoperformance.performance.performanceHeartBeat.HeartBeat$1.run(HeartBeat.java:52) ~[NeoPerformance-1.15.jar:?]
        at org.bukkit.craftbukkit.v1_20_R2.scheduler.CraftTask.run(CraftTask.java:101) ~[paper-1.20.2.jar:git-Paper-260]
        at org.bukkit.craftbukkit.v1_20_R2.scheduler.CraftScheduler.mainThreadHeartbeat(CraftScheduler.java:480) ~[paper-1.20.2.jar:git-Paper-260]
        at net.minecraft.server.MinecraftServer.tickChildren(MinecraftServer.java:1470) ~[paper-1.20.2.jar:git-Paper-260]
        at net.minecraft.server.dedicated.DedicatedServer.tickChildren(DedicatedServer.java:446) ~[paper-1.20.2.jar:git-Paper-260]
        at net.minecraft.server.MinecraftServer.tickServer(MinecraftServer.java:1379) ~[paper-1.20.2.jar:git-Paper-260]
        at net.minecraft.server.MinecraftServer.runServer(MinecraftServer.java:1156) ~[paper-1.20.2.jar:git-Paper-260]
        at net.minecraft.server.MinecraftServer.lambda$spin$0(MinecraftServer.java:315) ~[paper-1.20.2.jar:git-Paper-260]
        at java.lang.Thread.run(Thread.java:840) ~[?:?]
weak adder
lost matrix
weak adder
#

Seems complicated

lost matrix
shadow zinc
#

yeah lol

warm mica
weak adder
shadow zinc
#

hmm

lost matrix
shadow zinc
#

i think its not there

#

maybe

#

idk

lost matrix
shadow zinc
#

i could set it to compile instead of provide?

lost matrix
shadow zinc
#

I'm going to set it to compile for it to shade

lost matrix
shadow zinc
#

oh

#

idk then

lost matrix
weak adder
lost matrix
shadow zinc
#

they said: DiscordSRV api users: if you need to use JDA please use the 1.27.0-SNAPSHOT version of the DiscordSRV api until we publish the next version of DiscordSRV

#

gonna try it

#

okay so maybe its just badly designed and appartently a pinned discord message is enough

#

this is utter shame

shadow zinc
#

just need to crash my server to test it

#

thats how its triggered lol

#

well problem solved

#

thank you again 7smile7

#

if i could updoot you i would

clear elm
#

i cant hit people

lost matrix
#

good

clear elm
#

?

inner mulch
#

why is /reload not being recommended?

lost matrix
#

Because spigot doesnt support it and plugins constantly break because of it

inner mulch
#

ok

wet breach
tender shard
#

spigot says it's unsupported when you run it

wet breach
#

not sure why, there is nothing in spigot itself that would cause it to not work

#

but it could just be because plugins historically failed to support it

#

so might as well say its not supported lol

tender shard
bitter rune
#

My language of choice is c; it's more universal. Is there a way to code plugins in c?

tall dragon
#

if you are brave enough

lost matrix
tender shard
#

it'd be much easier to just learn basic java

lost matrix
bitter rune
#

I know some java and I'm learning in college basic coding I can apply to all languages; just finished loops, arrays, and lists. File handling and applications is this week but I already know a little about that

lost matrix
#

Oh so C isnt you language of choice. You would need choices before you can clam that ^^

wet breach
#

another method may be to create a native lib and have it be loaded by the JVM. Kind of like a spigot plugin, but instead a JVM plugin

bitter rune
#

I just prefer c at least currently I'm more familiar and my environment is already setup.. Technically I have intellij setup for Minecraft as well and Python setup

valid burrow
#

is there a way i can set the hostality of a creature? For example make a zombie not attack players or a sheep attack players

ivory sleet
#

But like java will be so easy for u

lost matrix
storm crystal
#

Ew C

#

It has like mallocs and pointers

#

Thank god we have python classes

bitter rune
#

I'm also trying to learn unreal engine... I can't seem to find where the code goes though... Unreal engine I'm trying to learn for ark survival ascended but I need to start from scratch with this

#

Python looks less involved I like needing the brackets in c and Java

lost matrix
lost matrix
#

I mean that in the literal sense

storm crystal
#

I am forced to learn python cuz of classes at uni

#

But pace is pretty slow

bitter rune
#

It's best to learn universal concepts before focusing on one language; at least that's what they are teaching us

storm crystal
#

Just finished for and while loops

ivory sleet
#

Java has it

#

Just that its a bit higher level

storm crystal
#

Yeah memory allocation by hand is disgusting

ivory sleet
#

no not really

bitter rune
lost matrix
#

Cant be CS. No uni would teach python as first language

#

right...?

tender shard
#

I wish you could study Chicken Wing science

ivory sleet
#

Memory allocation by hand is not disgusting, in fact memory allocation not by hand is generally considered disgusting, I mean… we invented garbage collectors because we’re noobs at memory management

storm crystal
bitter rune
tender shard
#

I'm an expert in chicken wings, I could teach it

lost matrix
wet breach
storm crystal
#

Teachers know what we need on course better and they dont teach us it

bitter rune
#

Ah, I'm majoring in app development with a bit of history focused just because I like history

lost matrix
bitter rune
#

It's better to learn things or know things before taking a course that's supposed to teach you; you need to adjust your thinking to understand basic cis concepts I started about 7 months ago and I'm just taking my first core course which that plus khan acadamey and 7 months of messing around with code made it a lot easier to grasp

lost matrix
#

Meh

#

Remove him from the banlist

tender shard
#

?notworking

undone axleBOT
#

"Does not working" is a useless statement. Please describe what exactly is not working, what you expect it to do, and what actually happens. If you get any console errors, also ?paste the entire stacktrace.

upper hazel
#

what should the json file look like for a block that loads a texture for a specific state?

wet breach
valid burrow
#

but is there a way were i would not need to constantly update the target?

valid burrow
#

i feel like that is gonna be VERY bad for the usage

#

cause in my situation i would have to do it for EVERY living entity

wet breach
upper hazel
#

I mean how to add a texture to a specific block state

bitter rune
wet breach
#

your other method if its for all entities is just to set the server peaceful

glossy venture
valid burrow
upper hazel
#

I only know how to use ModelData

storm crystal
upper hazel
#

but idk how use block state

wet breach
#

in order to do it, you would have to disguise another entity as a sheep XD

wet breach
#

glitch

#

make it do weird things

valid burrow
#

okay sure i can disguise another entity

tender shard
#

sheep in real life are already bugged, they don't give bacon

wet breach
#

lol

valid burrow
#

but couldnt i do it the otherway around then too

#

and what about hitboxes

wet breach
#

what do you mean the other way around?

valid burrow
#

disguise a sheep as a zombie so the zombie doesnt attack the player

upper hazel
# glossy venture server resource pack

I know that textures require a texture pack. But I need to know how to bind a specific texture to a specific block state. How is this written in a json file?

lost matrix
bitter rune
#

You can stop mobs from attacking and it not bugging out if you want you can have my sneak skill that does just that

valid burrow
#

i need to be able to set every level of hostility on every creature

#

and im looking for the best way to do that

bitter rune
#

It's probably possible you just need to get all the edge cases, and probably a better way to do it then I am thinking

rigid otter
#

Hello, I'm looking for Android library that can connect with the RCON. Hard tried on the internet. Does it really exist one?

lost matrix
#

Isnt RCON just a protocol?

#

Yeah its just a TCP protocol. So any TCP lib will do.

rigid otter
#

But i couldn't find one.

#

I've found only a java library, but it doesn't work for Android enviroment

wet breach
wet breach
#

generally not recommended to use

#

but MC has it so whatever lol

lost matrix
rigid otter
#

The Socket class just does not work when I write it in an Android app

wet breach
wet breach
#

or better yet just make your own mc plugin for connecting

#

then you don't really have to worry about much

rigid otter
wet breach
#

for something basic and easy, the plugin only needs a single class really and all you are doing is using as a passthrough for console in essence

rigid otter
#

There are some of Android apps using RCON. Why can't we?

wet breach
#

not sure what you mean by Socket class just does not work

#

android has sockets....it must since it has internet

#

question is, what in fact is actually wrong with the class file that needs to be changed

#

as there is difference between android sdk and java sdk

inner mulch
#
     //code
}```
are there better ways to do this? or are better ways not needed because it is efficient?
wet breach
#

its a foreach

#

so its fine

inner mulch
#

so even with 100 players it would cause lag?

tender shard
#

depends on what //code is ofc lol

slender elbow
#

Thread.sleep of course

rigid otter
#

Depends on your code inside that for each

inner mulch
#

an example would be a tabcompleter for a command

lost matrix
inner mulch
#

that recommends all players

tender shard
#

if looping over a collection with 100 entries would cause lag per se, we wouldn't have anything coded in java

inner mulch
rigid otter
#

each is not all by the way, πŸ˜„

wet breach
#
//alternative way instead of the for loop. This is the Lambda way.
Bukkit.getOnlinePlayers.foreach(player -> {
    //do something here
});
lost matrix
inner mulch
tender shard
#

it wouldn't be better

wet breach
tender shard
#

it doesn't matter at all. just loop over it, it's not an issue

wet breach
#

some people like using the enhanced for loop

#

others like using the lambda

#

the enhanced for loop internally uses foreach

#

so, preference πŸ™‚

rigid otter
#

If you want more, I think that you can iterate each player in a tick. Do stuff with one player per tick. Hint is using Bukkit.getScheduler().runTask()

wet breach
rigid otter
#

Yeah

wet breach
#

not really necessary to use a scheduler just for iterating πŸ˜›

rigid otter
#

Now I still can't find the easiest way to use RCON on Android 😴 Maybe bye here. Suck Android limitation over Java.

hazy parrot
tender shard
wet breach
slender elbow
#

it compiles to using the Iterator

#

you can break out of an enhanced for loop, you can't break out of a forEach

wet breach
#

enhanced for loop uses foreach

slender elbow
tender shard
#

anyway, doesn't matter whether one uses Collection#forEach or a normal for loop or an enhanced for loop to loop over all players, in the end

wet breach
#

they are basically both the same except in a few different scenarios

wet breach
slender elbow
#

it doesn't make sense for the enhanced for loop to compile to use forEach, again you can't break out of forEach, you can break out of an enhanced for, so how does that work?

#

i'm surprised you don't know this one

wet breach
#

well too late now

#

I figured it was outdated specs when I was looking at it XD

wet breach
#

which makes sense

#

it doesn't say that enhanced for loop isn't the same as for each, just what the rules are for something to be an enhanced for loop. But this is isn't implementation though, more or less a specification. Big difference between a spec and an implementation

storm crystal
eternal oxide
#

a static initializer

ivory sleet
#

like constructor, but it runs when the class is loading

eternal oxide
#

runs when the instance is created

ivory sleet
#

So once per class basically

storm crystal
#

Why is there separate thing like that

eternal oxide
#

its usefull?

ivory sleet
storm crystal
#

Why?

#

Cant you just use constructor

#

If its like it

neat mesa
#

emily

slender elbow
#

powercas stfu

tender shard
lost matrix
tender shard
storm crystal
#

So no difference, its still loaded either way

tender shard
#

no, a normal constructor is called per instance, not per class

wet breach
#

I could be wrong, and it may be something else that is the same as the enhanced for loop

tacit thistle
#

you are wrong

storm crystal
#

In both cases

tacit thistle
#

the Iterable interface was introduced as a base for enhanced for loops

slender elbow
#

since day 1 an enhanced for loop has compiled to iterator usage

#

(for Iterables, indexed for arrays)

wet breach
slender elbow
#

you heavily suggested it changed in some versions which it clearly doesn't

tender shard
#

unlike a constructor which only runs when an instance is created

wet breach
storm crystal
#

And why you cant do it in constructor

tender shard
#

because the list is static

#

and the methods that access it are too

#

so the list would be empty if I would populate it in the constructor

storm crystal
#

Why method needs to be static to access static shit

slender elbow
wet breach
#

all I said is that enhanced for loop uses foreach, which foreach is a form of iterable itself so it doesn't mean it breaks the contract. As I said I will check the implementation this weeked

tender shard
slender elbow
#

man can't accept he's wrong

tender shard
#

but why should it not be static if it does not require an instance

tender shard
lost matrix
wet breach
storm crystal
#

Well people here told me to not make shit static

tender shard
eternal oxide
#

you don;t use static unless you know what you are doing

slender elbow
storm crystal
#

So make your mind

wet breach
#

thanks for confirming you are not willing to show implementation πŸ™‚

slender elbow
#

because you clearly do

tacit thistle
lost matrix
wet breach
slender elbow
storm crystal
slender elbow
#

feel free to scroll up

lost matrix
tender shard
tacit thistle