#help-development
1 messages · Page 2039 of 1
No that's an awful idea
the compiler should at least scream at you
Not only does that introduce unnecessary compiler complexity
but it's incredibly opinionated
I mean, for one
uh..
by checking the case of method names? lol
oh yeah that'd work of course
it should just check whether method start with lowercase
and classes with uppercase
I guess I'll wait until I can post my error..
this..
Sometimes I will give public static final fields lowerCamelCase names because they aren't technically constants, although you're basically supposed to always use UPPER_SNAKE_CASE with public static final fields.
remove your whole buildtools folder, reboot windows, download buildtools and try again
oh wait
are you kidding me I have to reboot my computer?
only now did I read
sometimes that does indeed help but wait
your problem is something else
Also MEAT_FACTORY.produceHam() just looks kinda wrong if you ask me
I much prefer meatFactory.produceBeef()
"java -jar buildtools.jar --rev 1.18.2 --remapped"
(Also: There's different popular conventions in Java -- The two main ones being Google and Sun/Oracle)
(I don't like Google conventions bc they use 2-spaces and not 4-spaces)
that's if meatFactory is variable..
Or a field
non-static variable*
"static variables" don't exist
weird, should work. delete everything in your buildtools directory except buildtools.jar, then try again
but yeah it doesn't matter if it's static or not, I still think meatFactory looks better
didn't work
rename NoPermission to NoPermissionMessage
I have this new, innovative technology called
"an IDE"
which shows me when fields are static
just by the colour of their names when used
and also maybe add @ DefaultPermission
like
OP, NON_OP, EVERYONE, NONE
and a @ Cooldown would also be nice
like @ Cooldown("1m") makes every player be able to run it only once per minute
and ofc all those annotations must be able to read values dynamically
e.g. from a config file
yes, definitely
well tbh start by getting the basic stuff done
then add new things
no need to have a plan for everything right from the beginning 😄
I always just start coding and 2 years later, I have a 1500 lines config file lmao
yeah me too
but ANgelChest's base config is 1500 lines
BuIlDtOoLs sLoW aF tO dOwNlOaD.. F
does it work now?
I've just ran it.
I'm waiting for it to reach the part it did that annoying error..
worked updating BuildTools..
?paste that pls
can someone explain to me in very simple terms what a linked hashmap is? lol
is this for me if so I already put the log below the question
yes but noone wants to download a huge log file
please just paste it on the website
click expand and it shows the whole thing
wait, that's not a plugin problem. You should ask in #help-server
oooh
so it's like a list. but as map
makes sense
it's "basically" a List<Entry<Key,Value>>
yeah makes sense
I always wondered what it is
Hola alguien habla español
english pls
use google translator
I just looked at them but a huge wall of text came and I didn't bother to read it for a simple question 😄
my brain is already hurting from all the generics
hello can someone help me to make a Network md pliss
what exactly do you mean
I've been writting stuff like this the last 2 hours so please excuse me if I can't read any docs right now lmao
static <M extends Map<K,V>,K,V> PersistentDataType<PersistentDataContainer, Map<K,V>> asMap(PersistentDataType<?,K> keyType, PersistentDataType<?,V> valueType) {
you poor soul
I manage to get it working but it's really not very relaxing
I need help to make a 4-modal Network
lol yeah but it was really long overdue
This is why typealiases should be in Java
what is a 4 modal network?
oh yeah that'd be quite helpful
I recently had to always specify java.util.List
4 modes
because my IDE imported java.awt.*
import org.bukkit.whateverthefuck.PersistentDataContainer as PDC for example
Why does Java not have import/type aliases?!?
I mean 4 types of server
because aliases are for liberals
yeah that'd be nice indeed
stop trying to bring your liberalism into good ol' Java
what's next? java pronouns?!!??!1
I am a pro-slavery, anti-homo, republican liberal christian gay atheist
and my pronouns are cov/fefe
Are you
ignoring the "christian atheist" part?
I feel like that is the funnier one
static <M extends Map<K,V>,K,V> PersistentDataType<PersistentDataContainer, Map<K,V>> asMap(PersistentDataType<?,K> keyType, PersistentDataType<?,V> valueType) {
Holy shit
thank god that rust has type definition
That's what I said above lol
yeah we were just talking about that lol
Also surprises me that Lombok doesn't have aliases
Seems like something they'd add
perhaps it's not possible to do that with their AST model...?
I don't that'd work without compiler hacks
...Lombok is nothing but compiler hacks lol
lombok isn't nearly as dirty as people think 😦
yeah maybe a bit
lol
but not as much as everyone claims
be in denial some more why don't you
I mean
Lombok is founded upon a compiler hack
which is casting ProcessingEnvironment to JavacProcessingEnvironment (or Eclipse's, if Eclipsec is being used)
wdym? do you want to imply that lombok requires an IDE?
Hi, how can i send player death screen to player with packets?
Eclipse uses their own compiler
and Lombok supports both Javac and Eclipsec
but yeah Lombok takes advantage of annotation processors as an entrypoint
JavacProcessingEnvironment grants you access to Javac's Context object, which then gives you access to every other part of Javac
Ah, like this (this code is from my own discontinued Lombok-inspired project)
that codes sexy
hey guys it's possible to make a casual players spawners? in specific points
uwu
ulu
die
what the fuck
oh no
love you too
BELU-DAD?
cock situation?
DADDDDDDDDDDDDDDDDDDDDDDDD
who the fuck are you?
is it possible? lol
someone who was hacked ig
Maows ex's showing up in chat
i think they got hacked
beluga hacked version
WHO IS MY DAD?
maow is cool, you are not
L
waaait
daddddddddd
DADDDDDDDDDDDDDDDDDDDDDDDDDDDD
DaDaD
you are my belu-dad?
@lavish hemlock oi you removed me D:
md_5 obviously
you are finally back with the milk
I love that
maow now go hug them
please stop
otherwise they'll get kicked for spamming
i search my dad i not search kicked
I'm not really in the mood for a family reunion :p
I search for grammar, you obviously don't
im italian
ok go search for grammar then
can you be italian in #general pls
I'm part-Italian
Anyway so
You say that but
protected Element getClassElement(Element element) {
switch (element.getKind()) {
case CLASS:
return element;
case METHOD:
case FIELD:
return element.getEnclosingElement();
case PARAMETER:
return element.getEnclosingElement().getEnclosingElement();
}
return null;
}
and instead if I wanted that only the blocks of the map cannot be broken but those that place the players can be broken, can it be done?
??????????
Okay so if I'm interpreting you properly
You want players to only be allowed to break the blocks they place?
protected Element getClassElement(Element element) {
switch (element.getKind()) {
case CLASS -> element,
case METHOD | FIELD -> element.getEnclosingElement(),
case PARAMETER -> element.getEnclosingElement().getEnclosingElement(),
default -> null,
}
}
doesnt this owrk too
Yeah but the lib was developed for Java 8
Since compiler hacks are broken on Java 9+
And I didn't know how to fix them yet
Basically very specific reflection hacks to export modules at runtime
Or, if you want, at compile-time https://github.com/Project-Transparent/Diamond
comedy*
oui oui
That doesn't make you exempt from corrections
The only people exempt from my wrath are the dyslexic ones.
votekick?
that's also spelled incorrectly
!votekick @quaint mantle
I need your opinions. So I now have the following methods in DataType:
List: asList(...)
ArrayList: asArrayList(...)
Set: asSet(...)
HashSet: asSet(...)
<? extends Collection>: asCollection(?, ...)
Map: asMap(...)
HashMap: asHashMap(...)
LinkedHashMap: asLinkedHashMap(...)
<? extends Map>: asGenericMap(?, ...)```
that's inconsistent, because once I have asGenericMap for maps and asCollection for lists, since unfortunately there's nothing like Collection <> List as there is for my Maps D: does anyone have a better idea? Should I rename my "asCollection" to "asGenericCollection"?
-> <https://github.com/JEFF-Media-GbR/MorePersistentDataTypes/blob/96f7b14f09cbb7e7f0cb25aaebad7d501650a22e/src/main/java/com/jeff_media/morepersistentdatatypes/DataType.java#L90>
Nah the names here are fine.
.
I don't like that I have to add "generic" to the map method
no
Can you stop being annoying pls
check if the block thats broken has metadata if not then cancel the event
anyone else wanna murder everyone on earth?
YES
except the cool people
some people
you speak broken english?!
imagjin is cool, shut yo mouth
if u wanna see how i speak on my phone i be speakin like dis fr
calm down, you're like 12 D:
beluga fanboy
point and laugh at the beluga fanboy
ha ha
Why are you in possession of 3-year-olds?
?kick @quaint mantle immature asf
Done. That felt good.
Good call
(I ship it)
thank you ❤️
Whos
yea
Does anyone know whether I can get rid of those warnings without just suppressing them?
Have you tried the diamond operator
"When you stop texting first and they don't complain, you realize you've been watering a dead plant"
yes, it starts to cry when using it
Either way, it needs to be suppressed
The type parameter system isn't perfect
Sometimes you do just need to suppress shit :p
yeah I guess I'll just add a suppress to the whole class
@DamnitIntellijStopWarningMe
I couldn't manage to add the correct types into the <diamond>
it's always screaming unless I just use the raw thingy lol
but it's working fine so I guess it's no problem lol
oh dear..
@tardy delta re-open the threat please..
threat?
i already gave you your answer
ehm....
check if the block thats broken has metadata if not then cancel the event
whenever a player places a block add the metadata to it
oh ok
lol
but the IDE doesn't show errors
casting it however works on compile and also @ runtime
I wonder
can fields in an interface be @ Deprecated? 
@waxen plinth were you the person with the PDC data library that supports collections / maps?
Asking about your attempted solution rather than your actual problem
💀
example server start and count 2 minute and execute the code
?scheduling
i don't know how to use that
no
try { // Timer //
Thread.sleep(10000);
} catch (InterruptedException e) {
Thread.currentThread().interrupt();
}
//code
exact?
oh yea that will work perfectly
ok tank you
Is it possible to change server.properties values using a plugin at server start?
of course but it's too late then
the server.properties get read before the plugins enable
Darn
what do you want to change?
I knew I could get the properties file, but was unsure when it gets read
Texture pack url if possible
FileConfiguration spigotConfigurationYamlFile = YamlConfiguration.loadConfiguration(new File(new File("").getAbsolutePath(), "spigot.yml"));
But then properties file
spigot.yml?
okay so, you can't change the ResourcePack at runtime but you can send a different URL to your players
that doesnt work like that
its not a yml file
yeah ignore what @quaint mantle said, it's not helpful
@neon nymph in PlayerJoinEvent, you can send them a custom resource pack URL
Oh, right!! Change the redirect inside the url instead
declaration: package: org.bukkit.entity, interface: Player
You mean like send the URL in chat?
no
Oh I never knew abou this method
what MC version are you using?
if you're on a recent version, you can make them get kicked if they don'T accept the resource pack
if you're on older versions, you can only show the "accept the resource pack yes/no" screen to them
Couldn't I simply use the force bool to force them to accept the pack?
Yep ur right, mb.
yes, on recent versions, you can
But on legacy, it's different, right
sorry didnt mean to be rude, I just realized you didn't really read their question 😛
Alright, I thought server.properties file was the only way to provide players a resource pack
How can i make a /pvp command (activates pvp) if disactivates player not get damage
Thanks!
no idea how it works in old versions
Yea my fingers where faster then my eyes.
I see
- Have a HashMap<UUID,Boolean>
- Listen to EntityDamageByEntityEvent
- If the damager is player, check the boolean of the damaged player in that map
- if the boolean is false, cancel the event
so yeah it's about 30 lines in total, if not less
Ok tank you
wdym
It's not build tools its you ™️
?
??
is buildtools.jar irrelevant anymore
i srsly don't know how to get around making a plugin
buildtools.jar is very relevant
if you really dont want to use buildtools, you could just download a copy of paper since thats already built
lol
ok :(
i'll tell you the full details of how buildtools fails to download in a moment
Well you still have to run the jar but ye
With that being said this is Spigot and not Paper
Hey I want to make a sandwich. Don't make a sandwich make a sub. If paper worked on spigot 100% then I'd say yes.
ok taco man
i'm tryna make a plugin that i find to be really cool 😏
for a semi-hardcore world i have
Sounds intriguing
but maybe something like it already exists
i want a plugin that allows for multiple respawn anchors
and for a dead player to choose which respawn anchor they want to respawn at
I assume you don't know a lot of java.
no but i know c++
Oo
if that helps at all
Somewhat I suppose
Java will feel like dancing butter combined with sweet sugar
for(int i=0; i<9; i++) {
if (player.getInventory().getContents()[i].getType().equals((profile.getRefill() == Refill.SOUP ? Material.MUSHROOM_SOUP : Material.POTION)))
//remove one first```
Does anyone know how to remove first item that's MUSHROOM_SOUP or POTION. I've already made a part code, but idk how to remove just 1 item since I have int set to 9 items
Java will feel like dogshit
I want to remove just 1 items
Nah
Only bad thing Java has is its way of dealing with null
Else it’s extremely robust and solid
👍
i just need to know how to make a plugin
Java will feel divine. Because intellij exists
🥲
And javadoc
Guys

Can someone help me please
?ask
If you have a question, please just ask it. Don't look for staff or topic experts. Don't ask to ask or ask if people are awake or available. Just ask the question to the channel straight out, and wait patiently for a reply. Make sure you use the right channel regarding the topic of your question. Create a thread in case the channel is already in use!
This
that easy 🤷
good luck (:
if your using intellij, download https://plugins.jetbrains.com/plugin/8327-minecraft-development
sets up the development environment for you 🙂
tysm
if (player.getInventory().getContents()[i].getType().equals((profile.getRefill() == Refill.SOUP ? Material.MUSHROOM_SOUP : Material.POTION)))
player.getInventory().getContents()[i].setType(Material.AIR);
break;```
Like this?
yes
I'll try
wait don't u need curly brackets to scope the if statement
if its only one statement then not required
It’s optional for one liners but generally you do wanna have it there as it solidifies scopes
then he should add the curly braces
Oh ye
Ye
iirc
getContents returns a shallow copy
So you might wanna use getInventory().getItem(i) and setItem(i,stack)
so not lvalue
if those were the names
🥲
i think i'll find writing plugins really fun
Block b = player.getWorld().getBlockAt(x, y, z);
b.setType(Material.AIR);```
im trying to set a block to air, but for some reason it's also setting the block right under it to air
i think i faced this problem before but i cant find anything on spigot about it
i love to improve minecraft survival
Yeah I hope you find it fun too
setType(AIR,false);
interesting
may i ask what the boolean is for?
Apply block physics

quick question, does calling .thenAccept() of an async completable future run the consumer on that same thread, or the thread that i called the method from (in this case the main thread)
ah ok
thenAcceptAsync would switch thread (default would be ForkJoinPool::commonPool or if you pass a custom Executor implementation)
┬─┬ ノ( ゜-゜ノ)
I am once again stupid
wtf do I need in the ? fields lmao
generics sound so simple but they are so complex
What does it tell you to pass?
One of the arguments would be a
(Function<? super String,? extends E>)(str -> enumThing) and the other would be the reverse
yeah I've tried Enum::valueOf and Enum::name
it didn't like that
one sec
IntelliJ even suggested me to use "valueOf"
Yes as said
but once I add it, it says "cannot resolve"
(Function<? super String,? extends E>)(str -> Enums.tryParse(enumClass,str).orNull())
Or sth
Might be able to reduce that to a method reference
But sth like that might be what you’d have to pass
yeah but I only have the class and although the class extends Enum, it doesn't let me call me valueOf D:
I don't get it
isn't valueOf a static method
OH
Because Enum::valueOf takes two parameters
which is changed by the compiler for any Enum subclass
and I don't understand why
As it infers the class
I'll ignore the whole enum thing for now
🥲
I am already so glad I got all collections and maps working, fuck enums now, let people parse their enums themselves
that follows you
lol
using the MapRenderer
the NMS cursor is immutable too IIRC
how would i use jitpack for a private github library of mine?
I'm confused about the settings.xml thing, i have made a settings.xml in my user's .m2 folder but it gives a 401 unauthorised error
then you did sth wrong. show your settings.xml and censor your password
(but jitpack sucks anyway)
jitpack is the WORST repository available
<settings>
<servers>
<server>
<id>jitpack.io</id>
<username>(censored)</username>
<password>.</password>
</server>
</servers>
</settings>
the password is just .
thats the whole file
uhm
does your password use any special characters?
host your own 
wdym with "use ." ?
jitpack tells you to use "." as password?!
wow
wtf
I'm using ReFX Nexus
oh wait ReFX Nexus is the VST I am using lmao
Im using SonaType Nexus for my repo
Nexus Repository Manager
I could just give you an account for my community repository
what's private? your stuff? then you can't use jitpack anyway
huh
everything on jitpack is public
at least that's what I thought
Just host your own 
oh didnt know
how
Got a rasberry pi or don't mind running a local webserver?
i dont mind running a webserver
well if they only need it locally, they don't need any server at all
just do mvn install
yes but i find that rather annoying
thats kinda why im switching
i also want future developers to be able to use it
hm yeah I can't help with jitpack
but if you get 401 it definitely means something's messed with your settings.xml or your deployment URL or that jitpack sucks
Yeah I host mine locally but it's still public
I need to switch from what I'm currently using which is dav
tbh I'd just get a cheap VPS somewhere
netcup has awesome servers for as little as 2.69€ per month
then just spin up nexus in a docker container there
Yeah I used apache2 so I could have a webserver on it as well.
yeah sure I also use apache as reverse proxy
but nexus itself runs in a docker container
whatever works for you tbh.
I have tried to use jitpack so many times
I'm just lazy it took 5 hours to set it up
Cannot resolve (idk if i should show it) failed to transfer from https://jitpack.io during a previous attempt. This failure was cached in the local repository and resolution is not reattempted until the update interval of jitpack has elapsed or updates are forced. Original error: Could not transfer artifact (idk if i should show it) from/to jitpack (https://jitpack.io): authentication failed for https://jitpack.io/(idkifishouldshowit), status: 401 Unauthorized
I gave up after trying to get it to run with java 16
thats a new error
it NEVER works
everyone ends up just compiling oraxen themselves
jitpack sucks ass so hard
and not in the good way, #yeshomo
thats my error
yeah no idea. tl;dr: I'd just not use jitpack, you'll spend up hours trying to get it working
for <3€/months you can get a full KVM server and host a nexus yourself
mvn install it until you actually need to share it
Is it possible that getCursors returns a copy?
I feel like md_5 when 1.13 came out
nope
getCursors() returns a "changable" collection

I know that because I once removed sth from getCursors() and it crashed all clients viewing that map
I wonder if it's firing at all. I would check to see if that if x == oldx stuff is even firing.
yes
I'd try setting the cursor to invisible instead of removing it to see if that does anything.
that dont exists
canvas.getCursors().removeif should
is there any code of the default mob ai's? (in deofb server code) or no?
is writing plugins on vscode acceptable
Yes but generally people use Intellij Idea
use notepad :D
this shit is CONFUSING though
Automates the boring stuff
Yeah its' got a curve but you learn one of their IDEs you learn them all
it's been a year since i used this emoji it looks satanic
someone answer the man's question
what specific advantages does it have over vscode
are there any premium plugins authors online right now here?
makes sense ig
Same people who made Kotlin so you know they're crazy
i think he means the website that generates plugins on demand
ah, they must mean the plugin button
I hope not
where you press a button and receive the plugin of your choosing and specifications
Just make it free ™️
depending on what u do, nothing
Can FallingBlock's move
sideways ✨?
with the either x or z set to 1 and the y being 0?
like if ur writing the most basic stuff and dont need a lotta features then vsc is fine
since both vsc (with extensions) and intellij support things like maven+gradle
both have version control support
both have things like debug runs
yes they can move sideways. but probably not in the way u want
oh, damnit
because everyone who approves the resources works there for free
I have experienced waitings up to 3 months
u want them to like act as they are falling, but sideways?
my first paid plugin took 3 months to get approved, my last one took 12 hours
I mean I just wanted to know if it was possible or not
u could manually do it with math, probably
ew, math
Where is the NMS guy pushing the custom fallingblock where it doesnt have physics
nms is scary
it looks powerful, but scary understanding it
nice
ok
does anyone want in on what im making to try and improve it or direct me generally
ig just dm me cause im about to go to sleep
You can always publicly share what you want to do here lol
it involves communal semi hardcore smps
oh nice
ok
thought it was a more technical channel
It's a discussion channel.
this is what i’ve managed to accomplish using datapacks thus far
- 10,000 block spawn radius
- beds do not serve as respawn anchors
- beds give you poison, can only be slept in if you're at 1hp
- maximum health reduced to 10hp (half health)
- loot given to you on death: temporary tools, raw meat, 1 ender pearl and a saddle + more
- sleeping percentage is 33%
- slight buff given at respawn
basically the feature that made me realize imma have to use plugins is that
(and it’s actually pretty essential to the gamemode)
a difficult to craft/ create spawn location that can hold multiple respawn slots
and people can join multiple of these and decide which ones to respawn at
its recipe will involve items that are only given to players upon respawn
its goal is to force people into building villages, playing communally
because they only have enough resources to share a spawnpoint
that’s all
Yeah that's simple with spigot. Just gotta read the documentation for things you want. Learn how to setup a project then you're g2g
perfect
i should probably like, remake the stuff i’ve already done as a plugin as well
cause god i hate the minecraft command block lang lol
even though it’s the first “programming” i’ve done as a kid lol
😄 i killed chat
that easy
Yes
Answer
Plss
You don't code plugins with a website you use an IDE or integrated development environment
Yes. You can't create a plugin using a website unless you pay someone else to do it
i mean their about me says it all
by clicking it
If you need help using an IDE you're not going to be able to write plugins.
Oh
If your not a troll please don't attempt to make a plugin it's not going to end well. There are many plugins out there I'd suggest seeing if one exists before trying to even start thinking about coding one
or you can be like me who decided if i can't code it myself i can't use it
don't be like me
Doesn't use Java or c or assembly must code myself
i must build the computer myself
must manufacture the parts for it myself
must harvest the resources for the parts myself
must create the atoms for those resources myself
i must build myself to be able to do those things
i will now spontaneously inexistent
How would I get the entity from a packet? (I cannot loop through World#getEntities(), the library I'm using does not have it's custom entity saved to that for some reason)
id say find an entity with the specified id but if its not in getEntities... hmm
does the entity only exist through packets?
yeah
interesting
Indeed, where are entities stored within NMS?
wdym?
everything's is stored in memory, ofc
Yeah but how would I acess an entity by its ID\
a pure NMS entity? sorry don't know
Yeah
there is probably a method in either the server class
or the world / ServerLevel class
oh well
if you're not on remapped, i'm out lol
on remapped, it'd probably take only a few minutes to find it
Oh nah you could tell me what is on remapped
I could just convert it using a website
I didn't say that I'm looking for it for you know 😄
maybe I'd do so tomorrow if you still need it then 🙂
Morning All - i would like to get started in plugin development for bakkit and spigot, but i am struggling to proper resources on the matter - can somebody suggest a website or ebook i can use. Already well versed in Java.
try coded red on youtube
he explains the api well but doesnt have good java coding practices
since you know java already shouldnt be too much of an issue
I just need api, thanks - ill check him out
?jd-s
The home of Spigot a high performance, no lag customized CraftBukkit Minecraft server API, and BungeeCord, the cloud server proxy.
ah yes, the bakkit API
do you already have any build setup, using maven or gradle or sth?
intelij has a minecraft plugin that downloads and sets up a gradle starter project, got most of the coding on the java side done for what i want to plugin to do, just need to figure out how to incorporate that into minecraft. But that is how far i have gone. Info i am getting of google feels inconsistent. Was just wondering if there is good place to look to get started.
alrighty, so you already have base setup, that's good.
the first thing I suggest is that you get an idea on what you want to do first, like an idea for a simple plugin
there are no real "how to learn spigot" tutorials
what you need is a very simply plugin idea that you wanna do
e.g., a plugin that allows you to create lightning at your current position, etc
just take a few minutes of time and come up with a REAL simple plugin idea
once you've got that, we'll tell you exactly how you can find out on how to do that
but trust me, there is no "definite guide on how to do spigot plugins"
you always have to know what you wanna achieve
I actually think that a simple /lightning command is a good introduction
😅 youtube it till you win. Got it. Ill follow your advise and also read the spigot wiki and check out that youtuber. Will probably come back crying for help later today. Thanks
ok 😄 but as said, feel free to tell us here once you've got an idea. almost all tutorials on youtube are outdated
or teach bad practices
yeah - i picked up on that. Like i said - no consistency in the guides atm.
The home of Spigot a high performance, no lag customized CraftBukkit Minecraft server API, and BungeeCord, the cloud server proxy.
this for example is a VERY basic guide on doing something when a player joins, etc etc
(you can stop reading at # 3 because that's definitely not something you'd care about now)
okay everyone
who is down to test something for me
I need a few people please to test my PDC library and try to break it somehow
how the fuck does that not work
HashMap<K,V> implements Map<K,V>
it works fine when I copy the same code as from the asHashMap method
but I don't want to have reduntant code
oh I got it
replace Map<K,V> with
? extends Map<K,V>
Well I can’t see asHashMap but remember
Consumer<Map> and Consumer<HashMap> are generically unrelated
but every Consumer<Map> also takes a Consumer<HashMap>
What
because the Consumer<Map> doesn't take a Consumer<Map> but a Consumer<? extends Map>
No looking from a semantic point of view they are extremely unrelated
I really started to learn generics today lol
Wym by take?
generics are just type constructors at most
Idk the entire takes thing
that's what you claim until you try to compile it!
Well I did some pdc types ages ago and it worked well
yes, but now try to "double" "generalize" them
I did
hm I must have done something wrong then
Idk you have to stop this entire take thing, I remember I kinda used that to reason with
anyway, I got it working by replacing Map with <? extends Map>
Yes it makes sense
and I really don't understand why that fixed it
Because Blah<HashMap> is not a subtype of Bah<? extends Map>
for HashMap, no problem
Whilst Blah<HashMap> is not a subtype of Blah<Map>
it's really just about the generic Map type
I guess a <interface> somehow works a tiny bit different than a <clazz>
idk
well then I don't know because I only need the <? extends when using it on interfaces o0
it works fine for
HashSet
HashMap
ArrayList
but it doesn'T work for
Colletion
List
Map
it's on github
generic types are fixed
JEFF-Media-GbR/MorePersistentDataTypes
Only reason for instance
Map<String,Player>::forEach
takes a BiConsumer<? super String, ? super Player> is so you can for instance pass a BiConsumer<CharSequence,LivingEntity> instance directly
It’s not about what takes and what gives
check out the last fields in DataType, and the DataCollection and DataMap classes
what other Map implementation do you know that has a no args constructor?
Map is just an interface
yeah so if someone wants go get a Map, they'll get HashMap
Well why have two methods then?
I wouldn't see a reason to give them a ConcurrentHashMap instead
if they want a ConcurrentHashMap, they can use asGenericMap(ConcurrentHashMap.class, ...) instead
Nah all I’m saying that the design is weird
how would you change it? 🙂
I would just have asMap conversely to you asGenericMap and then asHashMap
but sometimes people want to store a Map<K,V> into a PDC
Then they use asMap
okay but sometimes people want to get a SomeSpecificMapImpl<K,V> when reading from the PDC
then they use asMap?
they can't, since asMap would return a Map and not a SomSpecificMapImpl
In your case it does
but assume you have the type constructor
K,V,M extends Map<K,V>
no, asMap would return a HashMap that's just declared to be a Map
now Map and MapImpl are both passable
but HashMap is not a SomeSpecificMapImpl
Which is your design flaw
feel free to PR, I really don't understand how to fix this or amybe I don't understand your point
can you try to explain it again pls? 😄
Because you exposed an asHashMap, there’s literally 0 need for the asMap
I might be a bit "too much tired" and don't see the obvious things
THERE IS
one important thing
Which is?
you have a Map<A,B>
you write to PDC
no problem
but you wanna read from the PDC?
You can't
you cannot instantiate Map
you can only instanstiate a specific implementation
Yes that’s where implementation details comes in
For instance java Collector solves this excellently
that's why asMap actually uses a HashMap
they have a toMap, which never exposed the HashMap type
It’s merely an implementation
Which is dum
How can i use color codes in config?
i have color codes in config file
pls tag me
I need a no-args constructor
and Map has none
so asMap returns a Map but actually uses a HashMap
I don't understand why that'd be a problem
I mean, Arrays.asList also returns an ArrayList I guess
yeah how else would I do it?
Using a Collector
and then?
Well that’s pretty much it, I have school now so I need to go but gl
kkk
I highly suggest you to clone the repo and try to fix it because tbh I've spent hours on it and didn'T find any better way
I'd love to see a better solution, so yeah if you'd a PR, it's more than welcoe @ivory sleet :3
ok
I'll probably be asleep then, but yeah, please check it out :3
JEFF-Media-GbR/MorePersistentDataTypes
how do i get the ServerPlayerConnection for the nms player object
or is it just Connection
im using mojang mappings
nmsPlayer.connection.connection
there is no player.connection tho
getHandle returns a ServerPlayer
HI,How can i use color codes in config?
i have color codes in config file
pls tag me
ChatColor.translateAlternateColorCodes('&',getConfig("my-message"));
Fun fact: if you're using annotations, even if you don't shade them and/or set them to be <scope>provided, javac doesn't care. I didn't know that until 12 hours ago
TL;DR: javac doesn't care about "missing" annotations
i did try this but it don't work
ChatColor.translateAlternateColorCodes('&', instance.getConfig().getString("messages"));
tag me
?notworking
"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.
ChatColor.translateAlternateColorCodes('&', instance.getConfig().getString("messages"));
"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.
?paste
I'll start a rage now
Where the fuck is the problem in having public fields?
MHO: Getter methods are NOT needed if they simply return the original value. Java itself it like that, too. for example, stringArray.length
also everyone using kotlin can immediately stop telling me it's bad because you people are doing this all the time
what the fuck happened here
so yeah, why should we add getters and setters for fields if they simply return/set the field value?
nothing
aight 🙂
I just wanted to ask
I thought something was going to explode xD
it will
cant wait
I really don't get why Asd.getAsd() is better than Asd.asd
does everyone think that the java devs added public fields just for fun?
how is this worse than
somePerson.getName()
Umm, can you directly change the value of the fields?
that's why I mentioned setters in my original message
^
sure, it makes sense if the setter actually does validate input
but if it doesn't, it's 100% useless
Maybe because of consistency perhaps.
yeah but there is only "consistency" in using useless setters and getters because everyone does it
people often claim that kotlin is the "better" java, but people use public fields there all the time
so I wonder - is kotlin just "java without conventions" or are getters/setters actually useless?
(ofc all my above rage only applies to setters that don't do anything besides setting the value)
is this how to get the comments at the root?
if the config is like this does it eork then?
Messages:
- "&6hi"
- "&AHI"
?notworking
"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.
I don't understand why you don't read this message ^
can someone explain to me pls 😢
It’s expecting an array of objects of the Type D. I’m pretty sure doing Class<D> is the same as just D.
yeah
Is there a tutorial for configurable guis? I suck with the config api
I am making a shop and I want to do commands to add items like /additem <price> <quantity>
And it will add the item from hand
And store it in the config under the shop section
but Im 'sainy gD[ :<
fuck this
oh
lmao
wrong screenshot
sory
??? r u ok
fuck THIS ^
invalid YAML, obviously
both Slots: and 1: are the same indent
yeah now it's valid
except for
buyprice
it's empty
you can't have an empty value
empty value must be ""
it' sempty
So they only way you can prob do this is if you make the variable an array


