#dev-general
1 messages Β· Page 205 of 1
Then use a map?
Ye but idk how to get the certain Pet from a map
You want to get the the type by a pet or what?
I get the PetType from in-game and then I need to access the Pet subclass linked to that type
Make a PetType<T extends Pet> and then in your PetType class, have a getter for the class T
Then make constants of PetType<MyPet> MY_PET = PetType.of(MyPet.class)
(Or something)
This will have the type exposed
uhh
I have an idea how to do this but is ugly π¦
Why not just make your Pet a interface 
Develop
Huh?
Good morning, it's my first time to configure DeluxeMenus, and I don't know why the menu won't open
Nobody answers me xd
Smh frcsty
π€£
hello how make rest api with sprong, thankyou please xoxoxo
RestController
do I just make like my entities as per usual then just do fancy stuff with the controller
@obtuse gale just use rest repositories
thats a thing?
im following this atm and they just use a normal repo I think https://spring.io/guides/tutorials/rest/
or even better and use a lib like elide or crnk
rest repositories remove all the boilerplate but aren't as extensive as one of those libs ^
and that tutorial uses just normal spring which contains loads of boilerplate if you want a simple rest api
which is just plainly crud on entities
elide & crnk are libraries for spring
oh like in addition?
but it really depends on what type of rest api you are making
idk too much about rest apis tbh
most rest api's are mostly CRUD and then there's no reason to have to make the controllers etc yourself since all they do is CRUD, hence why there's spring's rest repositories which allows you to write a repo and they'll have the routing etc done automatically. And then you have crnk or elide which take that to the next level and all you do is write entities with a few annotations on em and you have fully fletched filtering, pagination, searching, crud etc
and what's even nicer is that crnk and elide use a json specification and an url specification (both JSON:API). Which means that your frontend (if you have one can use a libary which also follow that specification and therefore can communicate with your api without boilerplate once again
well I rarely use spring but crnk is more active and has some more integration into different systems from spring
while elide is even less boilerplate but less integration and less active
elide is made by yahoo btw
hm
Ill try elide I guess
actually
crnk
also do you know if i can use java 15 or whatever record classes for JPA entities?
yahoo lol
rip
since jpa entities are mutable
I miss kotlin π¦
and records are immutable
why not use kotlin with spring then
or is that too buggy
pretty sure it supports kotlin well iirc
im using java cos im doing something with someone who doesnt know kotlin
ahh
I think we will do php next semester π€’
π¬
I think I do that next year
$
and fucking ms access, like anybody on this planet uses it smh
lmfao
it's because most schools get all their tools via microsoft
they get this package deal
true
pretty cool ngl
wdym
that you don't want everything from one company
my school it guy gave be a book on ms access as a joke
MS should discontinue all other office programs except for PP word and excel 
Could not find io.crnk:crnk-setup-spring-boot2:.
No candidates found for method call mavenBom.
pass a version
or +
π₯²
oh wait
it says add them to youre classpath
is that the same as dependencies or is that something else
classpath means to add them to your project or smth
make sure you have the repo and the right group, artifact and version
have you added the plugin?
plugins {
id 'org.springframework.boot' version '2.3.4.RELEASE'
id 'io.spring.dependency-management' version '1.0.10.RELEASE'
id 'java'
}
bruh ive been sitting here for ages try na get this thing to work lol
Hello
im looking for someone who knows something about guilds plugin
Im considering buying it
#general-plugins or just read the spigot page and the wiki.
yeah but i cant find all supported languages
ugh @wispy oak https://i.imgur.com/md99BX1.png
why do i get this? started new project
http://images.virtusdevelops.eu/shareX/g1dn7iex.png
I've recently setup pterodactyl panel to use panel.<domain>, and whilst it works fine - it also works with <domain> which I'd like to use to display a different site. How would I do that? (I'm using nginx btw)
any idea why this never loads up:
http://images.virtusdevelops.eu/shareX/5bdu1www.png
and fucking ms access, like anybody on this planet uses it smh
@distant sun Hi
Our school uses it
disgusting
tf is that
You don't know ms access?
Let me tell you a story
once upon a time
micorosoft created an application and it bad. the end.
Building a database system without programming skills is pretty cool in my opinion!
Whip up a schema in access. I remember writing SQL in Access π
Stupid MSSQL syntax
So this application started to take over the world. Some people realised how bad it is and started an alliance to fight against it but it was to late. The application took over the world. But wait what is that? In the last minute a thing appeared in the sky. What could it be? An alien? A super human? No! It was Bill Gates, God himself. He said 2 words in an unknown language and the application vanished forever. After many years, hundreds of translators they figured out what the words were: "Begone thot". The End.
here @prisma wave a great story for you to read and farm xp
you're welcome
how bad it is - source?
So this application started to take over the world. Some people realised how bad it is and started an alliance to fight against it but it was to late. The application took over the world. But wait what is that? In the last minute a thing appeared in the sky. What could it be? An alien? A super human? No! It was Bill Gates, God himself. He said 2 words in an unknown language and the application vanished forever. After many years, hundreds of translators they figured out what the words were: "Begone thot". The End.
@static zealot cool
I have a authentic source
"Access is the biggest technological advancement in this century." - Niall, 2020
@ocean quartz how easy is it to make a bee follow a player like a pet using NMS
Pretty easy
setTarget makes them hostile i believe
Well yes..
but they get angy eyes 
Red eyes pet
Yeah i don't understand any of this matt 
Format#BAN_FROSTY
π
shouldRun is just so it doesn't do all the tracking stuff every tick, and it skips most of the time
I get the distance between the player and the entity then check how far they are, if too far, tp, if just a bit far follow, the walk to function is
internal fun NavigationAbstract.walkTo(player: Entity, movementSpeed: Double) = a((player as CraftEntity).handle, movementSpeed)
I can do that yeah Frosty
What about mine
Can also do
Ty bb
i'm confused 
What is confusing you?
I mean that's as much as i can explain everything else is pretty self explanatory xD
You use the navigation.a to make the entity move towards the target

π
ask that on stack overflow
π₯²
They'll eat you alive on stack overflow if you ask that 
bruh
this was on yahoo questions lmaoo
Can someone with too much time go judge, ktnxbye
First problem, Java smh
do you cast each of the afterwards? https://github.com/Frcsty/NicknameManager/blob/master/src/main/java/com/github/frcsty/nicknamemanager/storage/ProfileStorage.java#L82
Yes
because constants are static?
I could, but it's used 2 times so really not that much of a big deal don't you think?
It kinda is, using object array there doesn't really feel good
do you really need a NicknameProfile object if it just store one value, a String?
Yes Gaby, going to probably add other stuff in the future, hence it's made this way
But it can get rlly messy though
ok
Agreed
Im pretty sure its faster too
How would it be faster? lol
I mean that doesn't justify it being faster, making an object array in that situation does not make sense, it's confusing and require unsafe casting
It doesnt make sense and you wont know what kind of object it returns
It can be anything
Exactly you are proving my point
Results are better but arrays are ok if ya want that
Array are prolly faster, but has more disadvantages than advantages in this situation
It would not be faster in this situation
I think theyre faster, but really is not even much difference
Well the casting will slow the process abit
Object[] result = new Object[]{null, null, null};
result[0] = file;
result[1] = configuration;
result[2] = section;
Then
if (result[0] instanceof File) file = (File) result[0];
... etc
vs
return new Result(file, configuration, section);
then
file = result.getFile();
... etc
How is the first better? And how is it faster?
That makes no sense
Its not better at all, its accepted
Thats what i say, when you have to cast it, its gnna be awfull
It will also crash if casted wrong, you know that for sure
Then why are you defending it? lol
Like i said because you can doesn't mean you should
In that situation it 100% makes sense to have an object
In no way an object array will be "faster"
Unless you keep it an object
Which he doesn't
do you cast each of the afterwards?
Yes
Jesus, this argument
If my knowledge of the JVM is correct using an array will use slightly less memory
But I don't think there's any significant speed difference - they're both basically lists of pointers
Yes
And it's too neglible to consider, so yeah result object is better
Yes, i agreed
I mean isn't lists better for manipulating data
Consider the functions that comes along
It would be still an Object type
What's your point?
And since the amount of objects is always 3, you dont need a list
Idk the context but use array if you dont need the features a list implementation provides
My point is that Matts solution is the best of these 3, since:
It wont require casts
It wont require checks
It wont give errors
Arrays are quite level languaged which I assume gives benefits as elera stated "memory"
Doesn't give you enough benefits to be useful
Depends
Idk why y'all still debating about this, but I already changed it ages ago lol
it's neglible
^
Object headers on a 64 bit JVM are something like 24 bytes iirc
And considering it's a result object chances are it'll be disposed immediately after creation
This entire discussion is useless
Well apart from xp ofc
best way to cancel lava damage ?
Event prolly
Yea
??
i did but still damage
@prisma wave sweet sweet xp
Then you did it wrong
@prisma wave sweet sweet xp
@hot hull ikr
Also skedaddle over to #development
This chat isn't for support
This chat is for unnecessary arguments for xp 
For what purpose?
Well Caching
Yes but in what way? What is your intended use?
No I would not
Mostly just caching configurations
What downfalls specifically
Doesn't bukkit "cache" the main plugin config by default on startup?
Guava
Its lots of configs
Matt and I use a library called ConfigMe, but I'm unsure if that'll be useful for your case. Don't typically have a bunch of configs.
Oh well I've tried it and it works nicely but I have to shade it right?
I kind of want to avoid lots of dependencies
Yeah but it's only like 100kb or something
I personally like configurate more
Configurate is pretty good too!
I don't like Configurate that much
it's kind of over engineered
But well anyone else that has opinions about guava?
Idk if Niall is biased or smtng
I mean, if you're wanting to avoid another dependency, then yeah, just use Guava.
Yeah I mean, I could just go with my own implementation instead of their Cache implementation but Idk if it would be beneficial
I asumme a HashMap is more cheap than a ConcurrentHashMap
Is this simply for just caching a config that won't change?
Yeah
but it seems like guava was kind of using a CHM
And feels redundant if I don't need it
So why not just load the object on startup? What is the reason you need an actual cache for it vs just a reference to the config object that's loaded?
Well the config object is mutable
I like configurate, not that I have used it, my kind of style of programming
Guava however
yeah its not bad
Let me change the question. What does the config contain?
Let's not go there
A lot of serialized custom objects
Alrighty so you could probably just use a map of <key, object>.
Yeah I will go with that feels way simpler. Well thank you for your wisdom waffle
king
and naill
I actually just did this myself in the past week to load itemstacks from a config file.
Unfortunately not, but let me see if this is worth sharing.
But he don't care
So this project in particular is using Lucko's Helper lib. I literally just store it in a map via private final Map<String, ItemStackBuilder> cache = new HashMap<>();
And I don't store the itemstack itself but the builder reference because I have to change the contents of the items on-demand so I just modify the builder and build.
ah okay, well I used his helper lib until I realized the stuff I was using wasn't shaded correctly
what lib
This is one of my first times using it too, it's pretty cool.
Yeah if you want a fixed shaded version I got a jar of it
took quite some time but yeah its cool
I'll also preface this with I was thrown into this project when it was like just half-way done? Not half-way but if that makes sense like, I didn't originally start it, I just had to adapt to what was there from the previous developer.
Oww what are you working on that was half-way done?
Or like did the prev developer used helper or was that a choice of your own?
I probably shouldn't say right now, but, here is what I came up with to adapt to how the items currently were being stored in the config.
/**
* Helper method to load items from the config into the cache
*
* @param configuration the config object
* @param section the path of the item to load
*/
private void loadSection(final YamlConfiguration configuration, final String section) {
for (final String key : configuration.getConfigurationSection(section).getKeys(false)) {
final ConfigurationSection sec = configuration.getConfigurationSection(section).getConfigurationSection(key);
cache.put(sec.getCurrentPath(), ItemStackReader.DEFAULT.read(sec));
}
}```
So this basically just takes the config object, gets all the children from a section and then stores it into the map as an itemstackbuilder.
hmm yeah nice I will do something similar just that I cache like a lot of complex objects but really thanks for your time
a Town
Conclure, remember I have asked if I can link an enum value with a class? What if I put the class instance on the enum itself?
MONEY(other, values, here, new MoneyPet()...)
or I mean several of them
Uh sure Gaby but the thing is that generics doesnt work well with enums
Ahh. For objects like that, I don't even use config files. We straight up use mongodb clusters
What are you trying to do Gaby?
But I have a Rank object for instance which will be immutable unless you'd reload the config etc
I have a Pet class and multiple implementations of it, such as MoneyPet so I was looking for a way to store them all and access by a key. The original system uses enums so I thought I could do that but doesn't look like
enum PetType {
MONEY(/*...*/, new MoneyPet())
Pet pet;
PetType(Pet pet) {
this.pet = pet;
}
Pet getPet() { return pet; }
}
``` the problem here is that we will never be able to expose the type MoneyPet to the compiler
I also need them mutable since the value is loaded from config
We can make a getter for its class
but it wouldnt show us the type
Uh sure have a constant for it but let the object itself have mutable properties
enum PetType {
MONEY(/*...*/, new MoneyPet())
Pet pet;
PetType(Pet pet) {
this.pet = pet;
}
Pet getPet() { return pet; }
}
``` the problem here is that we will never be able to expose the type MoneyPet to the compiler
anyways the solution would be something like this
class PetType {
public static final Supplier<MoneyPet> MONEY = () -> new MoneyPet();
}
java
only 1
abstract class Pet<S: PetSettings>(
open val petType: PetType,
open val settings: S,
open val blocksMined: MutableMap<UUID, Int>
) {
companion object {
lateinit var MONEY_PET: MoneyPet
}
}```
Supplier<MoneyPet> money = MoneyPet::new
Well idk if the object maybe had a zero arg constructor
@distant sun why are the properties open?
uh
Yo alex how does it feel to play overwatch on your mobile
so each implementation can provide it own petType and settings?
@steel heart very fun
@distant sun it could be just passed as a constructor Param probably
Idk the full context but mutability bad
Unless builder
@steel heart builder pattern bad in kotlin
I guess, well I mean what would you do instead ?
Default parameters usually
so just invoking the constructor directly?
cab someone help me
Yes @steel heart
Can someone check my config?
Well I mean thats possible in java as well except if you have like a 37 param constructor
which I got with the beloved modding api forge
and it gets quite deefficient
that's not such a big problem in kotlin though
you can usually express every possible combination in 1 single constructor
hence the builder patten isn't necessary
yeah well I mean I had like many floats so it was kind of hard to distinguish in my case I guess but yeah very true
bm where is x.use { } coming from?
wdym?
tried to use it on some object and they don't have that property
oh
yeah well I mean I had like many floats so it was kind of hard to distinguish in my case I guess but yeah very true
@steel heart kotlin fixes that too
inline classes
wow why am I not using kotlin
good question
?. means it will only run the next code if the object is not null?
alex I feel like that particular question really needs a profound answer
sounds about right gaby
yes gaby
@steel heart um
wdym lol
a?.b()
if (a != null) a.b()
these are equivalent
does somebody know how to get an offlineplayer with a name in a bungeecord plugin?
afaik bungee doesn't have an offlineplayer analog
pretty sure that's not possible + even the spigot one is deprecated
your best option is to query mojang's api
that's probably a bad idea
it won't account for name changes and assumes that the player has played before
yup
because im working on a ranksystem over bungeecord and i wanna set a player's rank also when the player is offline
Wait? Is it possible to get all the offline players of all the lobbyβs?
a lobby which is a server? i think so
yeah that's what he means considering he's using bungee
Yes it is
Iβm using CloudNet so I have lobby templates
And there is always atleast 1 Server for the main lobby online
i have a map that i need to access. would u recommend creating 1 instance of the class that the map is in (that is created at startup) or just put the map as top-level?
ehhhhhh
depends
if the map doesn't need to be associated with a class / instance, don't associate it
it's basically static, so accessible from anywhere and could get messy if you use it too often
π₯²
object {}
object[]<> { object -=X> {
}
im going to have to stop u right there
-=X> would be a cool lambda
struct {
}
rust is nice btw
pub static extern "C" unsafe fn() {
}
just looked into it
Well I never had anything against it
I dont know why I liked it
My first introduction to lower level stuff really, references all that
ngl its neat
CloudNet seems pretty interesting.
whats that?
oh looks like a killer but what is it for simplified?
Hmm interesting
so does it aim to replace bungee or what
I just kind of feel like its little overwhelming
oh yeah it does seem to do that
It's basically like a panel without a panel
worth a try once it gets stable enough
@onyx loom I'm about to drop second dot typo fix, stay tuned

Oh dear
In gradle, how do I not compile with anything I'm not using?
:what:
My compiled jar is 2.8Mb and it barely does anything.
minimize()
I have that already
Well I mean why do you have so many useless dependencies then? :kek:
Not much else you can do then apart from removing dependencies
Well "useless"
or pdm ofc
dependencies {
//implementation "ch.jalu:configme:1.1.0"
compileOnly "org.spigotmc:spigot-api:1.15.2-R0.1-SNAPSHOT"
implementation "me.mattstudios.utils:matt-framework-gui:2.0.2"
implementation 'com.github.brcdev-minecraft:shopgui-api:2.0.0'
compileOnly "com.github.MilkBowl:VaultAPI:1.7"
}
//sort this out
configurations {
compile {
exclude group: 'ShopGUIPlus-SellGUI-1.0-all'
exclude module: 'com.google.*'
}
}
shadowJar {
//relocate "ch.jalu.configme", "net.mackenziemolloy.SGPSellGUI"
relocate "me.mattstudios.mfgui", "net.mackenziemolloy.SGPSellGUI"
minimize()
}
shopgui can be compileOnly
you mean the api?
Np
Anyone got any repo's I could contribute to 
@hot hull You want to contribute to my shit first plugin?
oh god
I did say shit for a reason.
Got any other ones?
Noice
throw RuntimeException("Get on the right version cunt")
throw Throwable(
pdm
@prisma wave hows relocation going![]()
π
Good luck minimizing that jar #should #have# used #announcements ]java
is it not java?
π€
@steel heart
It really depends on what you need to do.
Well they both do pretty much the same thing no?
As far as I know ACF gives a lot more control but it's also much more complicated
just wondering if there's anything ACF can do that MF can't
It is a steeper learning curve.
Idk if Matt's has contexts completions and conditions.
I'm more familiar with acf so that's not really a problem though
yeah that's what I'm concerned about too
I know that with acf I can do pretty much whatever I need, even if it is a little complex, whereas MF might be lacking some things
havent looked at acf tbh. but mf clean af
It also goes back to depending on what you're trying to do.
If you need runtime command generations and whatnot, you could try cloud.
It's new https://github.com/Sauilitired/cloud
acf's help message generation is nice, does mf have anything like that @ocean quartz ?
interesting
Not yet, coming on v2 though
I will be spending more time understanding cloud when I find a project that needs it.
all I'm really concerned about is: is there any point me learning MF when I'm already familiar enough with acf to get by with it?
cloud looks pretty complex
ACF has done everything I've ever needed to do.
yeah same
One thing I like about ACF is you can also make your own annotations
Yup. I've also written some wrapper that help with the language system so I can adapt Minimessage and whatnot
fancy
But yeah, ACF is handling 100+ commands with ease.
Not much reason tbh, only big difference and my main issue with acf is the message handling
yeah messages are a bit of a mess
the thing with acf is that everything works, it's just super complicated
now could be a good excuse to make BMF-CMD
very tempting
What do you not like about the message system in ACF?
I think my main issue is the limited documentation, so it usually becomes trial and error to get it working
That's valid. It's mainly community contributed wiki information
yeah which is a bit of a pain
and I seem to be banned from aikar's discord for some reason lmao
Β―_(γ)_/Β―
This link doesn't work?
oh actually I think I joined a long time ago on another account, maybe something similar to aj's problem is happening
where phone number verification goes wrong or something
Might be
One of my struggles lately was writing a clean way to have an item cache system which can on demand pass in a map for replacements. Finally got that going and integrated it into the item cache system and message system so the replacements are a lot easier.
Sounds fancy
am I supposed to know what replacements are or do you just mean like placeholders?
@frail glade Personally don't like the file based message system acf has, mine is all in code, it gives you the player and you send the message you want the way you want without any hardcoded stuff
kite-command
very hot
plugin.handleCommand<Player>("name") { sender, args -> ...}
even hotter :)
hmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm
Don't think so
we'll have to agree to disagree on that one
Same yeah
lol
thats what i use for handling basic commands then mf-cmd for all the other lmao
@steel heart
@obtuse gale ?
hi
Hi fofe
is it only my IDE which is acting weird randomly? I want to close a project, some classes that are opened are closing and then nothing happens lol
You have other instances of the IDE opened probably
Is this a channel I can get help with my code in?
thanks
I don't @old wyvern
you probably do
rpf > acf & mf & cloud
if I wanna store like a reference to an image in a datbase should i be usinf like a cdn then just store the link?
rpf includes commands as well?
yes
Can I have like
No
k thanks
A has a OneToMany relationship with B which has a ManyToOne relationship with C?
actually im confusing myself here lol
class A {
private String name;
@OneToMany
private List<B> bs;
}
class B {
private String link;
@ManyToOne
private A a;
}
class C{
@OneToMany
private List<B> bs;
}
``` I think thats what I want lol
or is that a bad way to do things? It seems like it could easily get messy
jesus
Well I mean what's the context
So a User needs to have a connection to a List of images, and each of those images needs to have a connection to a list of staff basically
class User {
Can staff be in multiple images at once?
wdym
what is the user connection- the one who made/uploaded the image?
each image has a staff member, multiple images can have the same staff member if thats what you mean
yes
public class User {
@OneToMany(mappedBy = "user")
private List<YourImage> images;
}
public class YourImage {
@ManyToOne
private User user;
@ManyToOne
private StaffMember staff;
}
public class StaffMember {
@OneToMany(mappedBy = "staff")
private List<YourImage> images;
}
Something like that
Remember to add getter and setters
each image can only have one staff member so would that change it from a manytomany to like a manytoone?
andd what does the mappedBy param do?
just makes the annotations connect properly
Does @CreatedDate actually handle it for you or do you still have to manually set it?
Never used it
is there a way to get the class of an instance during the instanceation of that instance?=
interface B<X>{
}
class A implements B<Y>{
}
class C<Y>{
@Autowired
private B<Y> thing;
}``` can I do something like this lol?
@frigid badge Go merge β€οΈ https://github.com/LemmoTresto/LemonMobCoins/pull/33
@empty flint getClass?
@hot hull neato I'll have a look at it
@hot hull you looking for contributions? draft me a group builder implementation in micrsoft doc
you can contribute to lemonmobcoins
;p
@hot hull what did you do with FileUtil lol
you can't use the bukkit plugin class there
since it's in the common package.
!smart
Yea I'm dumb ignore that, forgot to remove the plugin shit
don't question that Lemmo. Just merge the PR!
I give you classes- you implement sorted
So, on my project I have static methods like this one https://github.com/iGabyTM/tebex-java-sdk/blob/master/src/main/java/me/gabytm/util/tebexsdk/endpoints/bans/BansEndpoint.java#L34, is there an annotation or tag for docs I can use to let the user know is indicated to use the method from TebexAPI class instead of this one?
@ApiStatus.Internal from jetbrains should do the job ig
Bruh
BMF?
π€’
π¦
Too many frameworks
But why
matt's*
why not
You haven't given us a reason that benefits us
because there's none
this is much nicer for kotlin
π
it is very early stages but I think it's gonna be nicer for kotlin use
i can only support this
Got a repo for it yet?
What benefits does it bring for Kotlin?
well most command frameworks are annotation based (eg acf or mf-cmd), and cloud just seems like it would be a mess for anything big.
the benefits of targeting kotlin-first is you can have stuff like this kotlin val killPlayerCommand = command("kill", arg<Player>("target")) { target -> target.kill() }
so no annotations (much more extendable) and arguably more readable
the plan is you just define a file (not a class) which contains all your commands, and you're pretty much done
or an actually functional example:
val broadcastCommand = consoleCommand("broadcast", vararg("message")) { message ->
Bukkit.broadcastMessage(message.joinToString(separator = " ").color())
}
the plan is you just define a file (not a class) which contains all your commands, and you're pretty much done
Can you elaborate a little bit on this?
Well you'd still need to register them, but rather than defining a "Commands" class which is full of annotated methods, you just have a file full of top level variables which call command()
That's assuming your commands are smaller logic, right? You wouldn't want 20 big commands in the same class. Would get messy.
Indeed
but you'd still be able to put them in separate files, or a class
it just saves the overhead if you have lightweight stuff
Seems pretty useful if you don't need a bunch of extra stuff ya
what was the command to update your own database
?
I bought minecrates
Okay
Well, cube will have to update the database when he wakes up and then you can use the =check command.
spigot check
Ahh yeah, you guys have something different.
val messageCommand = playerCommand(
"message",
arg<Player>("target"),
vararg("message")
) { target, message ->
target.sendMessage("&6${sender.name} &7-> &6you: &7${message.joinToString(" ")}".color())
}
``` simple but effective π
but why can't I download the plugin tho
Sometimes paypal holds for 24 hours.
If you can't download it, the PayPal transaction hasn't fully completed.
Looks cool BM
ty
the money was sent, I will wait then.
Is there a way to detect the name of an inventory? I need to ensure it's something specific (this is for automation).
Inventory#getTitle
Yup, sent != Received. I'd say wait 24 hours and if it's still not letting you download, mention it again.
I'm pretty sure that was removed in like 1.14? Maybe 1.15?
Pretty sure you have to get the inventory view and then the title.
You won't be able to upload images here directly to avoid spam, so please use https://imgur.com/ to upload images/screenshots.
please no
not equals to recevied ?xd what
I blurred the name as it's for automation (which isn't allowed on the server) but
Just because it was sent doesn't mean it was received.
but what if he doesnt recieve ?
PayPal often will hold for up to 24 hours.
Well he doesn't have it setup to be manually accepted, so, it'll either clear or the money will come back to you.
oh same thing with vk pfff
cant you use a custom inventory holder that takes two parameters? @still lintel
You've probabaly done some sus stuff lately then.
player1, player2
I'm wanting to make a mod for automation I've got it to use a form of baritone to find the player and trade but it has some querks
I'm needing it to double check the name of the inventory of the trade menu then to select the slot
From testing if someone else sends the alt a trade request it will auto accept thinking that is the target
Btw this is for automation moving items got from alts just scripting mining cobble endlessly to deposit the cobble to a target

The new UI is so sexyyy
Does anyone have a good resource that talks about the Singleton design pattern?
Definitely gonna Google it on my own, was just wondering if anyone had a preferred resource
the correct channel is the #development xd
There they helped me, later I realized that.
That's for more specific issues. This is more of a general one
I understand, I'm quite confused with this discord even xD
@hot heron Singleton pattern generally isn't a great idea
@soft remnant I mean it's pretty simple, #development is on the support category, this one is on general, general normally is just for chilling and talking about random dev things
Yeah, I just was looking into learning more about it. It seems like I see a lot of singleton or pseudo singletons from plugin devs
And was wondering if plugins were meant to be singletons
But I'm just learning random things
Many people use the main class of plugins as singletons, which they kinda are but not really, since there is only one instance of it
But doesn't necessarily mean you have or should use singleton pattern with it
Heyo, i cannot, sorry
Damn ok
It's pretty late for me so I'll be heading out, but just be a bit more patient and someone will help ;p
a classic not null nullable :)
First one is ugly
What a smart man
final @NonNull @Nullable or @NonNull @Nullable final?
@ocean quartz the main class of a plugin is definitely an intentional singleton, and is one thatβs actually enforced afaik. While singletons arenβt great, you really have no control over the fact that this is indeed a singleton, so you should therefore use it as one.
how come proper names arent used for generics?
How come its always like one letter like T or something
To distinguish them from an actual type probably
@hot heron like someone else said, singletons generally arenβt a great idea, as they couple your code to itβs implementation, making it effectively untestable by conventional means (i.e. unit tests). So, the alternative is to simply carefully manage your instances, such as in the case of constructor dependency injection. Youβre merely ensuring that the same instance is being passed around, but this isnβt enforced, and is therefore not a singleton. Something important to note, is that di frameworks such as guice have βsingletonβ annotations, but these are not true jvm singletons, theyβre just the careful instance control I described above.
tl;dr dependency injection > singletons
Makes sense. I've just been trying to really dial down on why I do certain things or advocate for certain methodologies
singletons also go against oop
A singleton is just static in disguise
@steel heart annotations first imo
And I saw a lot of people doing the whole getInstance() thing and it's always seemed wrong to me
Not just with the JavaPlugin class, but other classes as well
@onyx loom yo same
Well the JavaPlugin.getPlugin is an IoC and Iβd say that a static singleton for your java plugin main isnβt too bad
Itβs only going to be one instance of it anyways so in a practical POV itβs not bad but PiggyPiglet and Alex have some good points
I think my biggest setback with oop is just the right way to organize my classes efficiently. Especially in plugins where you don't have full control
I think solid and the principles should be more of a blueprint than a strict format and something that everyone is forced to follow
I mean no one is forced to follow it but if you donβt youβre certainly gonna get flamed
ok time to learn how to use a maven repo lol
I made something with generics :))
oo
I think my biggest setback with oop is just the right way to organize my classes efficiently. Especially in plugins where you don't have full control
@hot heron as opposed to what?
Procedural / functional?
No no, just like the overall design. I think I psych myself out a lot. But I can never figure out exactly the way I want to setup my structure
Yeah writing clean code is very difficult
I think learning design patterns helps a lot
Small scale isn't bad. Like for instance, if it was custom stats for Mc, then the Stat itself would be easy for me, but setting up the system itself is where I'd start to psych myself out
Yeah, I find trying to scale OOP code is very difficult too
Usually becomes a horrible mess
I'm a bit of a perfectionist too so I have a hard time doing things in a way that I don't feel is great
Like most of the time I just see people with a singleton style manager that handles some stats stuff but that just feels gross to me
Because it is
Yeah, some people are capable of overlooking those things but it's hard for me. (not that that's a bad thing haha)
Especially since I want to learn the right ways to be prepared for professional development
I think generally there's always going to be improvements that you could try and make (or at the very least refactors), you have to find the balance between something messy and something overengineered
Doesn't help that as a system, Bukkit is inherently flawed
Indeed
Bukkit development seems to encourage bad practices a lot (or the community does at least)
I'd say it's because a lot of people start their learning with it
I think Spring Boot is pretty good for learning actually clean Java, because it encourages it a lot
Until you get to AbstractFactoryFactoryProvider
Yeah the majority of Bukkit developers are self taught with very little knowledge of clean coding techniques
And it's just "easier" to make stuff static and do hacky workarounds
imagine knowing java before bukkit
but bukkit == java
π§
but java == time, copy + pasting doesnt
Anybody want to diss some code?
@sxtanna... oh wait
π
@prisma wave would you say LuckPerms is over engineered even the slightest?
Itβs not bad code but some of the code got perhaps 3+ abstraction layers
@steel heart If you want api examples, lp is a gold mine
@steel heart itβs not
everything is comparatively under-engineered
lp isnβt my goto project for good code examples anymore though, Iβd recommend looking at sponge for that purpose
not to say that thereβs something wrong with lp, sponge is just better
Sponge is supreme
Piggy, did you happen to test my papi pr?
Cause I've not, got 3 exams next week, as well as driving license classes every day, and 2 exams this week, so I'm basically fucked
Hmm I havenβt tried sponge but other said itβs over engineered so really hard to know
@steel heart no idea, I've never looked at the codebase in much detai
i will have to relook at it. there was something i did not approve
'TabCompleter' is abstract; cannot be instantiated
```How do I fix this? ```this.getCommand("protocolperworld").setTabCompleter(new TabCompleter());``````public class TabCompleter implements TabCompleter {```Anyone have any idea?
Don't name it that
wdym
Since you're importing the wrong one clearly
oh
Name it MyTabCompleter or some shit
Refactor yes
That's why you don't stuff like that
I didn't think of that :P
StandardPPLTabCompleter
DefaultPPLTabCompletor
PPLTabCompleterImpl
No thank you π
IDefaultAbstractBeanFoctoryProviderImpl
π¦ protocolsupport api is so confusing
oh wait sorry
IDefaultAbstractBeanFoctoryProviderImpl.IBuilder.AbstractBuilder.BuilderImpl,BuilderPipelineSupplier
Question, what would be, in your guys opinion, a good config lib?
supporting comments, supporting migrating of all config entries even multi line entries, default values, easy accessing through a nice api and good serialization
Thank you, found a big limitation to ConfigMe that i really need, so really been considering writing my own or heavily modifying a fork of it
actual kotlin support
Matt, u got any repos I could contribute to?
One thing I'd like is to be able to specify that you want a String and if there's a List, it gets joined with \n as a separator
@frigid badge I'll push the change for the FileUtil tommorrow so you can accept the pr
neato, when you are working on it, fix the entire plugin as well kthx β€οΈ
@hot hull Go write the rewrite to mf-cmds 
And i want that too BM
π
I'm busy Lemmo
In two weeks when I've got 1 week free I'll see
Can you link me?
@ocean quartz Issue is I don't think I've got the braincells to do that
Aight, so if you want a quick "easy" contribution i think i have something for you
Why does hacktober have to be just when I have a shit ton of exams ;(
also internationalization another feature
you'd want for the config lib
@hot hull I need this method to add the passed items to the current page and save the page
https://github.com/ipsk/MF-GUI/blob/development/src/main/java/me/mattstudios/mfgui/gui/guis/PersistentPaginatedGui.java#L111
If the items fill the page, check if there is a next one and add it to it instead ;p
Ty Lemmo ;p
val locations = mutableListOf<Location>()
val locationsCommand = command("locations") {
root aliasOf "list"
subcommand("all") aliasOf "list"
subcommand("list", arg<Int>("limit").optional()) { limit ->
reply(locations.take(limit ?: locations.size).joinToString("\n"))
}
subcommand("create", sender<Player>()) {
locations += sender.location
}
}
thoughts on this?
Annotations seggsier
Alex do you know like more in detail how the message channel works, does it always have to take a player?
:what:
yeah like the PluginMessageListener or what its called
fukk
since it uses their connection to actually send the data between servers
no
@soft remnant I mean it's pretty simple, #development is on the support category, this one is on general, general normally is just for chilling and talking about random dev things
@ocean quartz I get it.
you'll need to use a seperate connection
plugin messaging relies on the player no way to not do that
you need to make your own socket connection or smth like redis etc
aww man
but what for data do you need to send?
elara will come with a native fix for this
cause what I for example use in one of my plugins is queuing plugin messages
Uh I was thinking
backend -> proxy -> (all other) backend
mainly for updating data
or would tcp be good?
depends what you're sending
sockets effectively are TCP afaik
you probably want to use some sort of protocol for the data (eg protobuf or CBOR)
sockets don't need to be tcp?
final variable
okay I need to read on some shit here jesus well, should I try implement my own type of connection or what do you guys suggest?
the 2 lines are effectively equivalent?
oh true
but java 10 isn't mainstream yet
@steel heart what I would do is sockets + some sort of serialization utility
that's not valid C# afaik
But what means Val
Means value
isn't it Console.WriteLine?
elera websockets specifically?
kotlin much better
Kotlin for .net when
@steel heart Well a socket is basically a UDP / TCP connection, so yeah that's probably the cleanest way of doing it (and most lightweight) assuming you don't want to rely on bungee
if your data doesn't need to be reactive you could use something like redis instead (eg as a cache for player scores or something, just query a redis server rather than accepting "packets" to update the score)
there's a reasonable chance I've said something wrong there though, so take it with a pinch of salt
Well I assume TCP would be good since it works with callbacks kind of right?
again it depends
TCP if you need to make sure that the data is valid, UDP if minor data loss isn't that big an issue
udp is for like streaming stuff
Oh well TCP defo also WebSocket or a TCP Socket?
ah yes
see no reason to use a websocket in a non web environment?
What does Redis use?
redis is a database that stores everything in memory
but at the same time why not use redis for this
so it's probably queried with TCP but idk
yes connecting to redis is using a tcp connection
But with redis I could easily set up some type of data update enviroment?
yea
Oh this is a database
an in-memory key-value store
redis is a database that stores everything in memory
@prisma wave π
hashmap
basically
you can use it for a lot of things
So where should I start? Like what do I need for this to work, I already know the database but except that? Which dependency would I be using?
caching, queue's, actual storage etc
Their website got a lot of stuff
redis isn't sql
Jedis is pretty popular
idk never used redis in java
Same
I rarely use java nowadays π
it ranges whatever my boss throws at me
which is never java cause I'm the only one that has knowledge of that language at a good enough level
lol what
shame
yeah I've tried convincing em
let var const val
yeah
idk the actual difference but there is one
elara everything
ye
let
ok would it under any circumstances be beneficial to use var still?



