#dev-general
1 messages · Page 145 of 1
Ah sweet. didn't think of that, thanks!
IAL?
Kotsu
lol
oooo
We should
@split talon https://github.com/katsumag/ItemActionsLib
gotcha
@prisma wave Need some guidance 
I have a PersistentStorage class which handles the persistancy of spawner objects, (stores the spawner list with the custom object within it as well),
What would be the cleanest was of making the spawners map exposed to static methods so I can cleanly add shit into it (preferably not having all the static methods within the storage class) - end goal is to have it structured as an api so I can use it within another plugin down the line
Custom spawners oowww
@split talon done, use version 1.0.1 rather than 1.0 though now
Spigot system is doodoo Conclure 
Grazi.
Frosty couldn’t say it better myself
This library saves a ton of time aha.
Wait what are the custom spawners spawning?
The current goal isn't custom spawners yet, but to replace the spigot system with a custom one, which will hopefully be less shit
(Will also allow for an easy addition of custom spawners ofc)
So you basically want to track all spawners in some sort?
If you want to track them through the entire server lifetime you might want to store them in a data file
I have a PersistentStorage class which handles the persistancy
Oh yes ofc
I was thinking something like this
PersistentStorage.class
private List<Spawner>
PersistentWrapper.class
(initializes the persistent storage class and grants access to the spawner list)
public static addSpawner(...)
public static getSpawner(...)
public static removeSpawner(...)
But I've no idea on how to make a non shit api so open to suggestions 
Api for?
Not at all
We have TWO cute doggo pfps in a row now


Wdym api for.., What I'm making rn is a base to the entire system wide spawner system, after that there's going to be another which handles silk touch and shit meaning I need an api to access the spawners and manage them

I mean frosty do something and then let us look at it. You’re underestimating yourself
hmm, mk
You’re pro developer nocap
I've been programming for a while but nothing beyond simple things, and being here makes me realize how much I don't know lol
I was exactly the same when I joined
¯_(ツ)_/¯
I mean I'm still not the best don't get me wrong
I learned java here 
I learned half of Java and all of Kotlin here 
I learned java from yt tuts, this and some other coding discords
helpchat is DEFINITELY the best place for kotlin
pff helpchat > tsc
idek what tsc is so I gotta agree with that
The Source code
helpchat coding utube channel when????????????????????????
i can’t comment on quality, I’ve never actually watched their shit
They have some really good devs
^ their bukkit tutorials aren't very good however they do highlight the api instead of being java good
what do you define good by conclure?
People who know a coding language inside out ?
And also computer science really well
Yeah
Conclure how would we go about adding NBT support and why is that useful?
Conclure, would you consider me a good developer?
Nope Better than that
Very subjective
I have no formal education, none at all especially in computer science
In the grand scheme of things I don't think any of us are "good"
Compared to the gurus writing textbooks on OOP principles and stuff
Well piggy you’re good compared to many other devs here not to mention you’re full stack?
oh full stack is just a buzz word
Yeah alex True
it’s meaningless these days
but many of us are decent
languages these days work everywhere, people can call themselves a full stack developer even if they only know js
Piggy, TSC doodoo, he uses eclipse 
anyway, enough rambling, my point is conclure, I think you should change your idea of good. Like brister said
it's relative
Piggy StringBuilder cannot be final on my case, it gets reset on line 44
oh
must have missed that
anyway it looks relatively clean to me
I’d assume a compiled regex would out perform it though
Well not really I’d generally say good to someone who knows java decent
How old are you btw?
117
Have you even seen his Spigot profile?
Most of the comments are just: "how do you live this long" and Piggy goes: "Just don't die"
not hard 
ez
I wonder, because regex was being pretty complicated to get working, the rules were getting too big
Kotsu I mean it could be nice to have a built-in NBT support just because it looks more feature rich 
Layout:
Main - https://paste.helpch.at/ujutapibuz.java
SpawnerWrapper - https://paste.helpch.at/dasomokaro.java
PersistentStorage - https://paste.helpch.at/voqinuxiqo.java
This is what I currently have, suggestions?
Don’t hardcode the keys matt
True but like, why would it be useful Conclure? I've never used NBT don't hurt me
assuming they’re all the same format
I can’t really read regex, so I’m not sure of the exact semantics
katsu, cause nbt is easiest when it comes to storing data on items
plus, end user can't see nbt shit
frosty you asked me if something was a bad idea earlier. Frankly, I’ve got no clue
Piggy how old are you?
Yea already figured out it was a bad idea
hes 117 smh
Anyhows, I need guidance on the above thing 
I mean srsly
on phone rn sorry
Since you said you got no official education?
Someone end this..
public void onBlockBreak(BlockBreakEvent breakEvent) {
Player player = breakEvent.getPlayer();
Block block = breakEvent.getBlock();
String noBuildReason = GriefPrevention.instance.allowBreak(player, block, block.getLocation(), breakEvent);
if (noBuildReason != null) {
GriefPrevention.sendMessage(player, TextMode.Err, noBuildReason);
breakEvent.setCancelled(true);
}
}```
That is a fragment of code of GriefPrevention about handling block break. Instead of making `canBreak()` or smth like a normal person, they did that
He's 117 seriously smh
18 iirc

I know his age >:}
Conclure, mind checking out what I currently have and giving some input
au
What continent?
Ah, but like you done with high school?
Mysterious
KM, I need your guidance 
It would be interesting to know as that would give me more info on how good you are relative to your age
If you've got time ofc KM
Lemme get breakfast and I'll come on pc
HOW
conclure don’t think of people as good or not. Just take their advice, do your own research, and make a decision.
^
What the fuck is wrong with your sleep schedule
@errant geyser 2pm is normal time what?
No it's not jesus
LATE??????
I could say the same to you
i literally went to sleep at that time
imagine choosing to wake up before 10am
couldnt be me
early bird
Piggy yeah that’s probably better although I’d probably say good to someone who I feel is formed. Well might not actually good but compared to me atleast I guess.
I go to sleep at 12am/1am and wake up at 7-8am
I’m in a constant state of chronic sleep deprivation
even though I get loads of sleep these days
me too
like on a week day lol, sleep easily for 12 hours, and I’m still tired
what’s up with that

bodies are weird
very true
that's a lot of EVIL scratch files
the hell are they
hard to explain
like mini code files that aren't part of your project
You can use them for testing stuff
Without making a new class normally
theyre cool
i mainly use them for clash of code
speaking of which.... 😳
who wanna play
KM, you available now?
Sheesh
Like man, I've taken 3 years of comp sci classes and I'm still shitty at it
Join the club
Hey welcome
I find most of the actual important stuff just comes from experience and practice
I have literally never needed to write a sorting algorithm by hand for example
I mean for something that isn't school
Ok then yeah, no
My last class I took was all data structures/algorithms bleh
Data structures are useful
Yeah but I don't find that aspect of CS very enjoyable
some algorithms are, in most high level languages they will already be done for you though
Networking is super fun imo
totally
I've barely dipped my toes into networking so far
very interesting stuff
I mean I love it and its really interesting & not too hard
you guys in uni?
Just started my first year of my CS degree aha
what are you majoring in?
Going to uni in 2 years for me
Computer science, ironically @quiet depot
oh
how would one convert a string like this
"""
One of
These
Strings
"""``` into a List<String> where each line is a line on that string
uni I'm looking at offers a computer science degree, majoring in cyber sec or software engineering
assumed other unis would be the same
Split at the newline char?
^
does kotlin just chuck a \n in it?
Yes
aight
yeah
so splitting @ that should be good?
String[] lines = contents.split("\r?\n");
ew java
this is kotlin 
tryna make a fancy item builder
crussade
never insult the hive mind like that again
never used kotlin, ew
Jax you made a good first impression and you're using IAL so I don't wanna do this but you leave me no choice
CRUSADE!
Kotlin good Java bad
Java dooodoo kotlin good
Kotlin looks really promising actually
Phew
thats what i thought
Pack it up guys
Oke everyone pack it up
that was close!
im thinking something like this
val item = item {
material = Material.STONE
lore = """
Line one,
Line two,
Line three
"""
}.build()``` idk if that would work
Crusade averted
too close 😅
Time to fire up notepad and code in some kotlin
notepad??
make sure you use the newline char for line checking cause , is ew
Kotlin deserves better
class Item{
fun build():ItemStack{
val stack = ItemStack(material)
val meta = stack.itemMeta
meta.lore = lore.lines()
return stack
}
var material:Material = Material.STONE
var lore = ""
}``` this how you would do it?
notepad++ at best
If it ain't IJ, you don't deserve it 
Ehh
^
Pretty much
fun item(initializer: Item.()->Unit):Item{
return Item().apply{ initializer }
}```
sublime
^
found that online for the item method
Atom >sublime
that will mostly work
you're objectively wrong
Lmao
you probably want to return the build() call?
Jax no. I was there with ya, but I tried sublime and I couldn't go back
oh
I'm just joking around. I use intelliJ and sublime already
yea that makes sense
KM, you on pc? 
katsumag, I'm worried. sublime might not be the top dog for too much longer
Just about
vscode is nice
In terms of speed it is I think
oh no
vscode looks nicer
it's not lol
sublime is still the fastest
I honestly doubt that'll ever change
but everything else wise, they're comparable
Not unless they stop using electron
I absolutely despise vs
AJ implement a Supplier<ItemStack> perhaps? Could be useful if spigot will accept my pr
most cases they're comparable, some cases vscode is winning
can I make it so im forced to give it a thing?
sublime might not be the top dog for too much longer
NOOOOOO
You can’t implement interfaces in kotlin?
Thought so
but java's functional interfaces are not an idiomatic thing in kotlin
anything with "visual studio" in the name gives me ptsd from my shitty laptop days. So much code lost from VS deciding to stop responding
wdym
because first class functions exist
Yeah ofc
Eg in the build() function if they haven't set the material, throw an exception
or use a default value
I'm aware, but og visual studio really tarnished the name for me
hm ok
I don't like the whole "visual" family but thats just me
likewise
vscode is nice, Vs not so much
vs is a nightmare
whats kotlins onEach?
Then again any IDE compared to a jetbrains one feels infinitely more clunky imo
onEach?
mm
nvm lol
same thing
onEach returns the collection doesn't it?
like a function?
that just sounds like map
Big thonkers time here
🤔




wait maybe not lol

I’m not a nitro

So can’t use external stuff
Well you do got Nitro
I love this discord already
Just not boosting I assume
I boost 3 other servers :/
Yikes you pay for another boost
No someone paid me to boost them
oh
Imagine paying money just for emotes
He has Nitro BM
It’s cheaper to buy another one if you have nitro
😦
Almost a week ago now I think
=multi
=multi spin
ayy
oooo
❗
o
not bad
😦
I mean
could be worse
rip
Its better than nothing I guess
Might boost again at some point for a better one 😎
the only reason I bought nitro was for the multi
@prisma wave meeee toooo 😎
😎
very good
kotlin kotlinkotlin kotlinkotlin kotlinkotlin kotlin
But do we circlejerk in here or #off-topic
KM
so onEach is like peek?
FP good OOP bad
Very good smart big words
kotlin good intellij good gradle good java bad maven bad eclipse bad
You know what I'm gonna ask right?
Noice
fp, oop
kotlin good intellij good gradle good java bad maven bad eclipse bad
Wise words Kali
i forgot what you were talking about
You on PC?
anyone tried out data oriented programming?
Foop
Fdoop
I have not
@quiet depot nope @hot hull yes
BOOP when
functional data object oriented programming
that's something you could achieve in graal
EWWWWW
Agreed, but I'd rather have it made in something I sort of understand
ew
DI
Frosty this is why I need to make that wrapper for you so that you can pretend your advancement API is written in kotlin
😎
wait what's it called
inversion of control?
or make it non static
Piggy, that's why I need suggestions :((
dependency inversion
yeah
But I need static so I can use it in the other shit
this is a bit nitpicky but I think SPAWNERS should be a Set rather than a List
Honestly frostiboo
I'm not about to use DI for the entire api lmao
well if you insist on static
Also frosty if you want to use it for externally, use ServicesManager
inb4 "UsE gUiCe"
make the PersistentStorage variable a constant
initialize it using a static initializer
get the plugin instance via JavaPlugin#getProvidingPlugin
there is literally no reason to pass the plugin instance via constructor
Never used guice almost because I feel like it doesn’t give that much
don't bash it until you try it
Guice is very nice in large codebases
And writing explicit DI doesn’t matter to me
for a few classes it's overkill of course
conclure you have to know how to use it with proficiency before it's value becomes apparent
True
registerListener(final Listener... listeners) "listener"... "listeners" 
Essentially from what I understand it just hides the keyword new ?
no
well
forgot an s KM 
not exactly
new is still used with guice
however exclusively on data objects
use it on anything else, and you're probably not understanding guice correctly
same with spring autowiring
Another question, I need to access storage within the class where the player wrapper gets initialized, do I just use a getter or do I make the storage constant public?
depends
Frosty registerListeners(Listener listener, Listener... listeners) {
Lists.asList(listener, listeners).stream()
}
Or maybe it’s newArrayList()
Can’t remember
you might want a getter that wraps it in an immutable collection
But it takes a single object and then a vararg
obligatory "kotlin has mutability in the type system" message
that's redundant conclure
immutable wrappers bad
Not rly
why not?
See KM, the storage part should not be modified (apart from the spawner set ofc)
Avoid calling it empty?
Cos like, this is much cleaner than a sperate getter
private val _layers = mutableListOf<Int>()
val layers: List<Int>
get() = _layers```
that's also gross
True although I like when the compiler tells me not to
if anything, you lose more performance doing it your way, as you now have to concatenate two arrays, or two streams
mutability in general is gross
Well you’re only registering onEnable?
Stream.of
That takes varargs only?
illusion I'd recommend reading the context before replying
Destroyed
I'm stupid I know
Yes it’s not as performant true but shouldn’t matter that much if it’s just invoked once in a while
Damn I shoulda said rekt
can we go back to circlejerking
Clojure meh
lisp meh
blasphemy
Scratch good
I can type very long paragraphs
Remember our deal tho
PSL welperino = Clojure for me + free xp for you
K
a pin would be good
a pin for what?
O
So
pls
skript good
Heh
skript is very good
kotlin just isn't as extendable as clojure
dude clojure just isn't as extendable as skript
Block programming is good
although fun fact apparently they are adding support for compile time checking in kotlin 1.4 or something
What to do with the storage constant now which I need to access within the class where the wrapper get's initialized
I like how Brister just evolves every day while we just follow him without learning anything just to seem cool xD
Nothing can ever be as extendable as block programming
so you can ensure at compile time that your int input is more than 0 or something
idk how it'll work
yeah you're onto something conclure
but sounds cool



flex
xD

I like how Brister just evolves every day while we just follow him without learning anything just to seem cool xD
(removed the quote for xp reasons) but how else do we provide him with the endless stream of xp


brister you should make an actual mitten
with all your names in it
brister, kotlin, skript, clojure
all the languages you use
SKRIPT?
and love

my god
what?
Piggy trying real hard over here to start a crusade
that's a good idea
You goddamn sinner 
Piggy really wants a crusade huh
although only people in this server would get it
which is like 10 people
¯_(ツ)_/¯
xD
that's ok, awkward inside jokes are the best kind
Worth it
NO
Defo
What to do with the storage constant now which I need to access within the class where the wrapper get's initialized
WAIT
yeah
wHAT
when 10 people laugh and everyone else is looking at you
Nononononononon
then you start laughing at them because they can't laugh with you
im sorry 
😡

getter it is
frosty
ez
instead of making all these methods static
we should do that more often 
have a static instance
xD
Frosty are you slowly evolving into Niall?
public static final SpawnerWrapper INSTANCE = new SpawnerWrapper();
I feel like you are
nah
I am fucking disgusted Piggy
niall would have at least 8 layers of abstraction
it's better than what you've got frosty
and much more enterprise code
enterprise code at its finest
i managed to create images in java yey!
8 layers weak
no
15 here
do it in skript
👀
interesting
truly the pinnacle of code design
Indeed
I mean
I think he'd be proud of that
revolutionary
ManagerManager >
DAMN how could I forget the Enterprise Manager™️
FactoryFactoryManager
hm
perfection
NiallGetterSetterBeanFactoryComponentServiceBuilderRecieverManagerFactoryBuilderManagerManagerHandlerCallerRecieverBuilder™️
I have something similar in rpf
™️
now THAT is future proofing 
wtf
Its our revolution at its finest

thank u for this niall 
yes

what's up with java beans though
cant wait till humanity makes Artifical Inteligence that accualy works
why are they called beans
inb4 frosty yells "Baked BEANS HA Gotem"
neither of those things are true
Graphics2D g2d = bufferedImage.createGraphics();


apparently it's to represent versatility and reusability or something
I mean
The name "Bean" was given to encompass this standard, which aims to create reusable software components for Java.
big enterprise a____ n____ s____
Are beans irl reusable
guys which Java version do you use?
8
11
8 usually
and 11
1
11 if I can help it
5
🤮
Get out

7
This one can't be saved
Imagine using Java lmao
okay so i was trying to upgrade to 11 but like 88% of users of my plugin still use 8 ...
Not really
KM, dissapointment intensifies
yeah plugins will probably be on 8 forever
nah
hear me out
they won't
Sad
public ones

you have var, the standard library gets some nice upgrades similar to what kotlin has, and like
it's faster or something idk
modules are cool too
I mean its better
eh i still prefer using int,long,string and that stuff
But not Kotlin worthy
as opposed to what @dusky drum ?
var
oh
well
once you have to type List<List<Map<String, Optional<Player>>> every time you might disagree

not realy
crap
type inference is, most of the time, better than explicitly declaring the type
type inference is great
assuming that the actual type can still be obtained from context
kotlin good, java bad
var age = 30;
``` is just as readable as ```java
int age = 30;
i've managed to make G2D in java :
http://images.virtusdevelops.eu/shareX/mttpz9kl.png
nice
some nms stuff can be async iirc
G2d
yeah afaik NMS can be async a lot of the time
?
well
because nms won't synchronize your shit
Well you kinda can't Piggy
spigot won't sychronize it either
I need to replicate almost exactly that, but can't figure out the G2D methods to use Gasper
forcing the game onto a single thread seems like such a waste
i mean its 2020 we have like insane cpus for multi threading and eh mojang is still mostly on single thread..
they could step their game up
imagine
We need to start HCCCE 2.0 but make it a server impl rather than a plugin
my bad they changed name to mojang studios*
yeah nah thats just not gonna work katsu kek
you're welcome to PR my barely functioning server impl
look how far we got with v1 
oh and if you want my G2D code i can send you entire code just sec
it would be cool if clip merged my PR before hiding the channel 😦
katsumag, idk if you've got any idea how much effort that would take
whoever asked for my g2d code.
https://paste.helpch.at/firazelubi.java
not a single fully functional nms alternative exists, even to this day
yeah server impls aren't trivial
glowstone & cuberite come close
just recode mc 
but they just aint it
get good Piggy
making it all thread safe is gonna be even harder
thats the correct one:
https://paste.helpch.at/uvudokubuz.cpp
Since y'all don't like BukkitRunnable so much, what alternative should be used instead?
java runnable XDDDDDDD
personally I don't see a problem with BukkitRunnable
I'm aware of the effort it'd take guys, but it'd be funny to sweat our asses off (or in your case, Piggy, Bacon) and then laugh at how disfunctional it is
Neither do I KM, hence why I'm asking
no thanks
apart from it being ugly
@errant geyser the minecraft protocol is a pain in the ass to implement
ye
Conclure swears by the scheduler and lambdas for some reason
@onyx loom i already recoded my entire World expansion 👀
the protocol lol
mc is wierd
i saw
but whyd u comment out the worlds placeholder
world generation
well yeah it's the least of your problems
World generation eZ
but i cant belive they fixed fps in 1.16 i get 300+ fps, in 1.15 i mostly get 45 fps.
but whyd u comment out the worlds placeholder
@onyx loom probably for the meme :p

uncomment it
it just returns the world names formatted by a ,
e.g world, world_the_end, world_nether etc
BukkitRunnable is useless
no its not
It is
no
How isn’t it?
its good
No lol
yes
It’s useless
it's ugly
i use it for async data sync with databases XD
Conclure, elaborate your thoughts weeb
not just it bad it good
BukkitScheduler?
BukkitScheduler takes a Consumer<BukkitTask>
Fixing the cancel problem
And you can use lambdas
dont both work with lambada?
cancel problem?
BukkitRunnable is not an interface
just store it to class and then cancel it?
Runnable is working with lambda but doesn’t have a cancel method
It does
It does tho?
store it as variable and cancel it?
BukkitRunnable#cancel()
We're on about BukkitRunnable tho
We're not talking about Runnable are we tho?
Consumer<BukkitTask>
well if you want to cancel it?
Then better just use the scheduler ?
and as i remember isnt runnable just like task that you later on run scheduled?
Also initiating BukkitRunnable anonymous is ugly and invoking any method on it returns a BukkitTask anyways
If you want to store a BukkitRunnable just store a Consumer<BukkitTask> ?
Well I don’t do kotlin so no idea there but in java it’s useless
Fairs
bukkitTask = new BukkitRunnable(){
@Override
public void run() {
try {
syncCrops();
} catch (SQLException e) {
e.printStackTrace();
}
}
}.runTaskTimerAsynchronously(simpleCrops, 0L, updaterTime);
Then just use the BukkitScheduler and you don’t need to invoke the run method and all that boilerplate
//op BM stuff
lmao
you can do lambada
Not with BukkitRunnable
let me show ya
Consumers can, Runnables can, BukkitRunnables can’t
inb4 I use a goddamn Timer smh
Consumers can, Runnables can, BukkitRunnables can’t
@steel heart
Incorrect
What’s incorrect?
BukkitRunnables can’t
They’re classes?
Afaik it has to be an interface and the interface should only have a single abstract method
Prove me wrong
Anyways the BukkitRunnable is still in api because so many plugins rely on it although it’s useless now when they added Consumer<BukkitTask> to the scheduler
I know its not really a lambda, but IJ used to convert my BukkitRunnables to smth like
() -> BukkitRunnable() {
//do smth here
}``` can't remember exactly what it was, but I think thats as close as you can get without wrapping it yourself to use a lambda
that won't work
That wouldn’t work
¯_(ツ)_/¯
If you use older versions sure use BukkitRunnable but you shouldn’t use those versions anyways
AJ
There's many things you shouldn't
We need to expand the FuckEmpire™️
Such as use java, but here we are 
FuckJava?
That'd be interesting
ok
Gasper did you try ?
Maybe yugi can prove me wrong then
They’re classes?
@steel heart
Hmm I assumed they were an interface, nvm
Ok there you go
fast reply
as in?
Useless
but you can use Consumer<BukkitTask>
^
There are methods to take Runnable or BukkitRunnable, and recently a Consumer<BukkitTask> was added to those that take BukkitRunnable instances so you can lambda-ify them ;) That being said, sometimes you need a Runnable (if you need not cancel or further manipulate your runnable), others you need a BukkitRunnable. It depends on your use case.
Choco
Conclure for IAL do we store a list of ActionItems somewhere that I can loop through for the getByUUID thingy
Hmm we got maps?
hashmap
I don’t know I can check 1 sec
Multi maps
Lukman, no md5 said that BukkitRunnable is useless in newer versions where Consumer<BukkitTask> exists
And ask choco that as well
Only reason to use BukkitRunnable as I said before is if you’re using an older version.
idk when bukkittask was added
Ok its in the AbstractListener, we store a MultiMap<UUID, Action<T>>
1.8+
so i dont see an issue.
with runnables
Runnable or BukkitRunnable?
No issue with BukkitRunnable but it’s useless
@errant geyser doesn't that defeat the point?
of?

BukkitRunnable can’t have lambdas expressed on it which means when you create one you will need to add all lot of redundant stuff where as a consumer of a BukkitTask would allow lambdas, afaik they have pretty much the same methods.
i love when youtube plays 20 seconds non skippable add.
Imagine not having adblock
The only good use case for those macs with a slidey bar
Kotsu I will into that when I arrive at home
Also yeah, AdBlock is kinda 🔥
ehj
just use raspberry ruter and put all trafic thru it and block ads thru there
ez
But I think you just get all the uuids from the different map, we do have a map in the manager containing all different types
We do have a Map<ActionType<?>, AbstractListener<?>> in the manager yeah, so I can do dis
Yeah loop through values
Ew O(n)
Okay so when do we get another multi?
tell fc
(:

The global multiplier has ran out and has been reset!
rip
@pallid gale new multi
He spun it woooooooooooooo
Gg





