#help-development
1 messages Β· Page 1172 of 1
but I don't want the material name
so that when I hold a poppy it returns "poppy" and not "RED_FLOWER"
Those are translatables
String itemBlockName = i.getItemMeta().getItemName();
p.sendMessage("item holding is: " + itemBlockName);```
what does that mean?
am looking for developer volunteer for experience and who wanna help out also trust worthy
dm me.
They are rendered on the client dependant on the language
?services
If you wish to request or offer development/art/building/administration services, please do so at https://www.spigotmc.org/forums/services-recruitment-v2.54/
so... I can never get "poppy"?
I just need it in english
I'm not sure if there's an API method to get the English name
i cant post
What version you running ?
1.21.1
some Material name changes happened after the 1.8 or smth near that update
but that's not the issue
the issue is Material names are different than what the User sees
if you were on 1.21.2 you could probably get the item_name component, use the translatable to index into that versions lang file
you can possibly do the same on older versions, but idk the exact way
man.. too much work for a little video idea.. nvm
there is one in pandaspigot
I'll just make do with materials
The server does contain the en_us language file
Though you should probably just use a translatable component?
or that lmao
Yeah I mean that doesn't work with the IM API :p

HI, i have a backpack plugin, and when an item is placed in the backpack, I want to add <amount>x | in front of the item's name. The problem is that if the item doesn't already have a custom name, I'm not sure how to add this prefix while keeping the original Minecraft item name. I could use something like <amount>x | item.getType().name();, but that would display something like 194x | OAK_WOOD, which isnβt ideal. I really want to keep the item's default display name as shown by Minecraft.
public static ItemStack addAmountToTitle(ItemStack item, int amount) {
ItemMeta itemMeta = item.getItemMeta();
if (itemMeta != null) {
String itemName = itemMeta.hasDisplayName() ? itemMeta.getDisplayName() : item.getType().name();
itemMeta.setDisplayName(ColorUtils.color("&7&l" + amount + "x | " + itemName));
item.setItemMeta(itemMeta);
}
return item;
}
is the only way is to use nms ?
@deft summit don't know what to tell you, because I just tested it and it worked fine for me lol
both in IJ and vscode
as a matter of fact, I had more troubles with IJ than with vscode lmao
maven
shouldn't have any effect tho
how does your attach configuration look like again, and how do you run your test server
Test Server:
{
"type": "shell",
"label": "Start server",
"command": "java -agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=5005 -jar ./paper.jar nogui",
"problemMatcher": [],
"options": {
"cwd": "./.server",
},
"runOptions": {
"instanceLimit": 1
}
},
Attach Config:
{
"type": "java",
"name": "Attach",
"request": "attach",
"hostName": "localhost",
"port": 5005
}
I just ran the server with this:
java -agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=*:5005 -XX:+AllowEnhancedClassRedefinition -jar .\spigot-1.21.3.jar nogui
and this is my launch config:
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"type": "java",
"name": "Attach to Remote Program",
"request": "attach",
"hostName": "localhost",
"port": "5005"
}
]
}
I didn't run the server inside vscode tho, if that changes anything at all lol
I doubt it, but I can try running it manually I suppose
yeeee I know xD
I tried asking the question in the paper help discord, but they werent able to help either
and I thought "welp, it shouldnt matter what kinda server i have, right?"
I can also try doing it on spigot I guess
is that with JBR? or just a regular JDK21?
I can never get screen capture to work well lmao
JBR, regular JDK doesn't have the allow enhanced class redefinition flag
well, JBR for the server, the attach process probably uses whatever JDK is set to my java home
which I believe is zulu 23
"administrator: powershell" hmm
I always run pwsh as admin
it's for a test server anyway so it doesn't matter
:concern:
windows has no concept of sudo, UAC isn't easily trigger-able so it's better to just run as admin
windows has way more safe-guards than linux to make sure you don't fuck up anyway so it's fine for the most part
Most of the time you shouldn't need admin kek
not like I'm running actual servers in my personal pc lol
I use powershell to not use admin
just editing system path alone needs admin lol
also chocolatey complains if you run it in user mode
(extracting contents of an msi cuz I don't wanna run it as admin)
Gimme a sec, I need to shadow adventure into it lmao
just test with a blank test plugin first
I've seen this one at some point, don't know why I never took interest on it
I imagine it makes UAC easily triggerable
UAC?
I swear every app on windows I've ever used requires administration privilages
its absolutely crazy
tbf yes ubisoft does make shitty apps
nothing that doesn't touch the system files should need admin privileges
I forgot when I switched to daily driving linux already I feel like its been forever lol
I could never do that to myself again
just having things working is a bless
I just have too many programs which are windows only
I have for like 5 years
the only thing I hate about windows right now is how slow git is in comparison, but other than that eh
I started using linux when I was 13, not too rare
I hate the ads personally lol, I also really just don't like the UI anymore
but that's because I'm so used to gnome idk if I could go back
Yes
Yeah my dad is
not liking windows UI
using gnome
something is wrong with these statements
that's crazy I didn't get my first computer until I was like 14
I started using windows at an age so young I could barely read noo
even when I did I was tech illiterate as fuck
I got my first computer when I was uhh, 11 I think? My mom decided to buy us one so we would stop asking for money to go to the cyber cafe
I feel in love with gnome at like first sight idk whats with the hate for it
stock gnome kinda is meh, but I customize mine a tad to fit my wants
mostly with the lack of task bar its unusable
I didn't have my own PC for a good while, but I was usually able to use the family PC (nobody else really used it KEK)
I got like a rPI at 7 or so and abused that thing to oblivion

before that I used the family pc
I have a Pi 4 which I got a couple years ago
pi2 babi
It's just unusable
they are useful
how?
and not really customisable
I've always found arduino is way more fun lowkey
gnome mentioned 
gnome πͺ
Blank plugin, simply put in one command, no configs changed nothing, does not work lol
arduino is fun, but not as powerful so you can't do as many fun things with it
Extremely unintuitive, shitty stock settings, no customisability, need plugins for anything, no tiling (iirc?)
fuck gnome
I do use one
looking forward to cosmic
I prefer to actually have a usable computer though which is why I don't use one
I found this on reddit
but well, das a bit till its done
I tried GNOME for like a month on my laptop
so real
I use something similar, just minegrub
let me try with gradle I guess, maybe that's a thing
and everything being left-oriented together with that padding looks weird
if thats it... I will literally shoot myself
xD
is that a corrupted mp4?
oh I don't have VLC on my laptop
idk if I accidentally recorded in 4k or smth x3
I can't even decode it
Wrong encoder ig
ah, or that yeah
Use x264 or some shit
I wonder how people make the beautiful UIs I see at random lmao
I have my OBS set to AV1, thats prolly the issue ye
Lack of skill issues
like look at this shit (r/unixporn)
I could never make UIs outside of HTML or compose
Oh that's just eww
as in
elkowars wacky widgets
Which is EVEN WORSE to use
I just browse the sub like "woaaaaaaaaaah"
yeah
rad stop taking those drugs they are not good for your brain
https://www.reddit.com/r/unixporn/comments/hgba3b/i3_razer_blade_stealth_highlighting_shortcuts_and/ and this is amazing
I don't know if my keyboard can do it
probably can since it has some sort of rgb lighting
I've never really tried awesome
I guess I should but I don't really have the time currently kek
https://www.reddit.com/r/unixporn/comments/uvaat7/gnome_3d_desktop_and_other_fun_effects/ this is really funny
I have that wallpaper on my phone
You can do some really cool shit with Wayfire too
the issue with these kind of setups is that they're overly specialized
unfortunately it's wayland
well yeah! But they're nice to look at
100%, it's so annoying and hard to replicate
it just takes one gnome program to make everything look out place
mvn package in your terminal
you do need maven installed though
frick
Or maven wrapper
I want to take a month of my time someday and just set up a linux install how I like it
also, side note, is there a way to change my name on spigotmc? lmao
like get all the looks down yk
?changename
Name changes on the forums are granted to those who have donated to the project. Donations are processed manually and generally take up to 24 hours. The donation widget can be found on the home page of SpigotMC at: https://www.spigotmc.org/.
dammit -w-
a month? oh you sweet summer child
it's very pointless in the end
trying to match certain aesthetic I mean
eh it's fun
I recommend just making it flexible, not fancy
This shows the most basic plugins: Move, Resize, Wobbly, Grid
spending time setting up visuals when the thing you look at 99% of the time is a webbrowser, discord, intellij and your terminal is crazy
That's why you customise those
jesus the vscode java extension struggles hard with gradle in comparison to maven performance wise lol
well yeah but you can indeed just match a specific look
I mean, customizing discord is annoying
web browser is w/e
terminal sure
and IJ, I just like the default theme
customizing discord is easy
intellij can be customized too, just so you know
i know
generally people who do that are the ones who use 3/4 programs the whole time. A terminal, an editor and a browser
I was working on a full redesign inspired by Juxtopposed's redesign
then gave up for a bit
so, me!
customising firefox is pretty good
full redesign is pointless, you're going to burn yourself out just by trying to keep up with canary channel lol
is that just stock firefox xD
no
Genuinely I use the following:
Discord
Browser
IntelliJ
Steam
and that's it I think
my firefox is super customized
it looks like stock firefox
looks completely stock theme 
no vertical tabs smh
this isn't my usercss
very custom
will never use that bullshit
Okay so... Good and bad news btw.....
why did discord have to make the on top emojis' color so close to the dark theme color
with maven it works
ah, you are wolf
I thought it was a completely different person, compact mode has betrayed me again
now why tf does it not work with gradle QwQ
have you tried building with clean build instead of just build
maybe it isn't pickup up the changed classes at all
fair, imma try that
tab bar disappears when unfocusing cursor
why not what
Firefox forks
looks literally just like edge

explode
sometimes I wish I had ban powers on this discord too
why did I just get a gmail notification from 60 days ago π€
yeah I don't think that's possible without modifying NMS is it
(cancelling those)
what would even be the point of cancelling a tick oxD
Well, yes, 100% of my project isn't possible without modifying nms
great question! probably not
nopes, doesnt work
keep the server alive but not processing
just defeats the entire point does it
not really
I mean your "write once, run anywhere" kinda doesn't work when "anywhere" has to be modified to work with your things
vanilla already has that built in xD
where exactly?
yeah, sounds like the extension isn't really taking the updated classpath
-1 for gradle I guess
1.21.3 starts skipping ticks after 60 seconds without players online
well, for the extension rather, this is totally on them lol
until the first player joins again
just use IJ kek
Guess I'll swap my entire plugin to use maven instead Β―_(γ)_/Β―
well I can't just plop this on say fabric and it will work without mixins
well, yes, 1.21.3
plus what if you want more specific behavior
if you use NMS and paper, you won't be able to use userdev
mixins are different from patches
yes
FUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUU
and why not just use IJ
why must the universe hate me
there is an unofficial userdev for maven but idk what the state of that is
well yeah on fabric, mixins exist. but on spigot you'd have to have the server running your patches kek
So essentially, my options now are:
A: I change my entire plugin to use maven instead of gradle, and hope to get the unofficial userdev working
B: I do not change anything, and just restart my server each time I make a change
C: I have to use IntelliJ
Well, yes, which is why I may just not support Bukkit derivatives, or provide a wine-like platform for it Β―_(γ)_/Β―
what's so bad about option C
I dont want to xD
....and then what else would you support
hidden option D: debug the extension itself and PR a fix
let the man dream rad damn
Quilt, Fabric, Forge, Neoforge, etc
no need to be so depressing about it
it sounds like torture but if you're willing to go this far to use vscode
idk rad just likes shooting ideas down π
maven > gradle, so yes.
sponge with extra steps fr
How is it sponge?
IntelliJ is good and all, don't get me wrong. I've used it quite a lot in the past, but I just simply prefer using Cursor nowadays (aka VSCode), so yeah
sponge but maintained by one guy β’οΈ
Sponge is a hack at best, mine is a carefully thought out and designed API :P
I've really taken a liking to maven honestly, too bad the Paper guys aren't really interested on it

sounds like a skill issue ngl
yeeeeeeeahhhhhh..... I might have experience in programming, but I feel like that would go way above my knowledge xD
damn, I mean you can be cocky about your ideas but calling sponge trash is out there
sponge is the future
π
doubt it
Major skill issue
trash is a harsh term, but everyone knows it isn't it lol
if anything, it is overengineered
I mean sponge made mixin and configurate
yeah
Yea, the API is painful
Well, the fact that sponge tool are more popular than sponge says a little bit
they also got massive API version fragmentation issues
Hey guys, how can i use spring with spigot? Someone here has a exemple to share?
they got like 5 versions above 8 but everything I've seen around uses api 8 too which is eh
why
@chrome beacon when π«
this is kinda insane lol
average open source project
final var world = server.worlds().byName("world").orElseThrow();
world.events().register(WorldBlockBreakEvent.class, event -> {
});
```weeeeee world-specific events
byname 
well, I mean, there is also byId
what id
A UUID
thats a bukkit thing
me when bots are #2 and #3 (configurate repo)
idk why you'd wanna add that lol
I know but I like it :P
byId is nice if you want to quickly encode the world and have it be more resistant to users renaming shit
what does worlds() return
WorldManager, manages worlds lol
bad method name then
server.worlds().list() gives the entire list
worldManager or sth
Maybe you just have a skill issue
I mean, if you are doing a bukkit competitor, maybe don't copy the arguably trash dimension to world split
why not just call it Worlds instead of WorldManager
yea
I hate Manager suffix, it is so ugh
I mean I can but if you have to type the name World and Worlds are really similar
and?
why does that matter
Thought about it then figured that WorldManager would be easier to understand at a glance :P
you don't have to double check if it has an s or not
wdym
and the method name worlds implies that it returns a list of worlds
and not a manager
I mean yes
but consider the fact that
it's type is not a list
you can't really mix up worlds() returning a list, no?
what
Server worlds list makes sense as a sentence
??
server worlds by name
why not just have WorldManager/Worlds implement Iterable
yea or extend list or some shit
that is... not really the point, I mean it does, anything that is a list-like object implements iterable
don't extend list
call it Plugins and Worlds kek
yeah but it can get annoying
having List in the name kind of implies it is some kind of List implementation
public void add(Plugins plugin) this can happen and be annoying
you're acting like worlds() returning a manager cannot get annoying kek
eh, I don't see that being a big deal honestly? Which one does the IDE recommend first
the plural or the singular ones
singular
plural before you complete the word
then it isn't an issue
I have this a lot with e.g. RegisteredSprite & RegisteredSprites (Registry<RegisteredSprite>) and RegisteredSprite is always first
instance should be renamed*
yeah, that's kind of annoying then
because you use it more
intellij reccomends familiar types more
I love how list does not return a list
I mean, would you rather it return a list?
list in this case is being used as a verb
why not
list <stuff>
ah yes conventions
lmao
for once you're right
I always hated how std lib methods return Collection
The vanilla level "name" is just the folder name
What this is attempting to be is the level key
"folder"!?!?!??! it's directory π€
Like minecraft:overworld
well yes that's exactly what I'm going for
hence "byName"
So world encompasses all it's dimensions?
yea
byName("world") would make 0 sense in vanilla terms.
Given there are three levels that are under the "world" level name
Using the overworld, the_nether and end keys respectively
Yep
yeah I like the split of world vs world_nether and world_end ig, but you did give me an idea
hold on lynx you gave me a GREAT idea
1s
I hate that split
It's garbage and makes everything harder
yea
you're such a pessimist rad smh
on a side note, please don't use gradle if you are planning to use vscode for java
I get that a lot
I used to get it a lot too, mostly due to my skepticism
Please just don't use vscode for java kek
i dont see the issue, but ofc vscode for java is a red flag already
learn to words thing in ways that do not picture me as just some pessimist
the experience with maven is 100% better
eh, it's come a long way
Is that a vscode specific thing or your opinion
just the gradle integration that it is wonky
the extension struggles a lot more with gradle integration, it isn't as refined as the maven integration
which makes sense, since the extension is just headless eclipse lol
sounds plotted af lol, but fair enough
Guys, how do I set a player's permission with vault?
player.setPermission?
just scroll up to see an issue with the java extension gradle integration lol
hot reloading doesn't work
final var world = server.worlds().byId(Identifier.minecraft("world")).orElseThrow();
final var overworld = world.dimension("overworld").orElseThrow();
```Yes?
I like it
each world becomes a container for N dimensions
too much var tho
yeah ignore that I wanted to type little
Eh I don't want that long ass type that takes up half the message
hm not a thing ig
it would just be World and Dimension but whatev
Hmm I guess
But it's still quite long, especially since I'm on mobile
yeah
what does world.dimension() return
Optional<Dimension>
better than your ensureWorld thingy or whatever
I removed all ensure
π€
good
Then wtf is the point of vault if vanilla has everythinf
yeah that method does not exist as I realised further up kek
PermissionAttachment exists
Each invocation of an API method of yours will have a getOrThrow() at the end making it essentially a rust unwrap() equivalent
lmao, not all, just ones that deal with external resources
or resources that are not guaranteed to be there
So, likey 70% of stuff?
cuz vault interfaces it better
nah nah getById("MInEc!"Β§raft:ijas!!") exists as a world
π
yes.
So how do I set it then
final var testWorld = server.worlds().create(Identifier.plugin(context.plugin(), "test")).orElseThrow();
```bap
PermissionAttachment as ike said ^
world creation!!
aaand what about generators
Ty
and all the custom world stuff
you'd do that on a dimension
fair
noice
it's the standard:
Getters are the name of the property
Immediate setters are setProperty
Deferred setters are updateProperty
it's easier to understand at a glance if something is a getter, an immediate setter or a deferred setter
I'll explain the difference later but yeah it's just a readability thing
Your standard you mean
yes
yeah I'm writing with one hand, drinking a cup of tea lol
shower thought: what was the point to mojang migrating from username authentication to UUID based authentication? We still cant have duplicate usernames in Minecraft?
There are users with duplicate names
on bedrock i guess
on Java
i havent seen one in java
yeah, it is a bit, but it is easy to understand this quickly
so what's the point of UUID's
^^
it is more stable to use UUIDs
you could also change nicknames before
Not before uuids
tbh sounds like missed opportunity to have duplicate usernames allowed just like in bedrock
it would bring more parity between two versions
/op duplicatename
bring UI to that
Parity is already quite off between the versions
the console:
what's stopping from implementing tags
for currently active users on the server
if you want to give op to user which is offline just get the uuid
hm yes
Can't wait for Bukkit.getOfflinePlayer(name) to return a collection
Duplicate names are just stupid and shouldn't be a thing
Even Steam has unique usernames
Your display name however does not need to be unique. You can change that to whatever. But every Steam user's username is still unique
Java Edition has this. We have player display names
we have player display names, usernames and UUID's
two of them act as unique identifiers
why so mad
Like I said, Steam does the same thing
It has a unique username and a unique steam id
Chat should I make the tick event per world
Technically speaking, Bedrock Edition does have the same system. Your username is unique - it's your Microsoft account name
technically speaking, I don't care
Also that
A server is a context which holds world which are a context which hold dimensions which are a context
perfect
i guess youre right
username is just for convenience, but i dont see why you cant change your display name tho for ./op you could just use username, but with tab completion which maps display names to usernames if the player is active on the server
final var mcServer = context.server();
mcServer.events().register(TickEvent.class, event -> {
});
final var vanillaWorld = mcServer.worlds().byId(Identifier.minecraft("world")).orElseThrow();
vanillaWorld.events().register(TickEvent.class, event -> {
});
final var nether = vanillaWorld.dimension("nether").orElseThrow();
nether.events().register(TickEvent.class, event -> {
});
perfection
UUID's although unique, but has the same problem as IPv6, its too damn verbose to be used widely
can someone tell me how can i check which version has which nms namespace or whatever it is called?
like certainly i need what versions does v1_21_R2 cover? does it cover 1.21.1 or only 1.21.2?
idunno
i believe packages are no longer namespaced with tags anymore
in modern versions
but how
am i wrong though
im pretty sure i've saw that packaging of NMS at around 1.16 was changed no?
1.17
i havent touched spigot in at least a year now, but i think in order to develop against NMS in 1.17+ right now you need to use Bukkit.getBukkitVersion() method to retrieve bukkit api version and then use mojang mappings to develop in NMS and use instantiate specific version of NMS-dependent classes which would be remapped to back to obfuscated ones
i think that R tag changes when there's breaking changes within client-server protocol
if in https://wiki.vg/ protocol id list there's multiple id's for the same version, there's certainly a great chance that version has more than one R candidate probs
i may be wrong though, as i said i havent touched anything minecraft related long enough for my info to be accurate
Hello, I want to make a custom inventory in my plugin, but I can't add an item inside it. What could be the problem?
My code:
public class TestGUI implements Listener {
public static Inventory inventory = Bukkit.createInventory(null, 9, "Menu");
public void CreateGUI() {
ItemStack item = new ItemStack(Material.POISONOUS_POTATO, 1);
ItemMeta meta = item.getItemMeta();
meta.setDisplayName("Potato");
List<String> lore = new ArrayList<String>();
lore.add("Unbelievable");
meta.setLore(lore);
item.setItemMeta(meta);
inventory.setItem(4, item);
}
}
what is the issue with this code
it opens the inventory, but there is no item
where does it open the inventory ?
in a separate class:
public class OpenTestGUICommand implements CommandExecutor {
@Override
public boolean onCommand(CommandSender commandSender, Command command, String s, String[] strings) {
Player player = (Player) commandSender;
player.openInventory(TestGUI.inventory);
return true;
}
}
you don't call CreateGUI anywhere
and when do you call the createGui =
also, please use lowerCamelCase for method names
ideally, you'd just make it the constructor
?guis
basically i have a method called generate hit
which will take a players data i will give and do something with it
but idk how to access it without errors
give the variable a type ?
oh thank you, i forgot that
oh like this?
yes. thats java basics
im trying to look through all the players online n check if they are sutible but it seems it only detects player "zar1f" and not also "Zarif"
the print system is for debugging
and it only prints zar1f
never Zarif
maybe because you return in the middle of the for loop?
when should i return?
after the loop
to loop through all the players, find one that isnt you
if you need to look through all players that are online then dont return
your formatting looks really weird
it fr be
so weird even that its the cause of your errors
like when should the No players found message appear
it should appear when the it loops through all the players and none of them meet my conditions
okay
does it do that?
well right now its gonna print regardless after the if check
oh no it does that for all of them
fix your formatting first
to the compiler it doesnt matter but to whoever is reading it, they will interpret it wrongly, including yourself
whitespace is not important in java like it is for python
you have to use brackets explicitly
i hope you don't make a getting high plugin lol
that was yesterday
a what
alr done that
oof lol
you need to learn java basics
true
yeah you don't need this whole loop by the looks of it
maybe before loop make
boolean found = false;
in the loop if a player is found then
found = true;
after loop check if it was found or not
or not
because you return
just check if the list is empty
there is no list
you can just print no players found after the loop, because if a player is found ,you return, so it will only get to the code after loop if you dont return = if you dont find any plaer
should i ignore this?
but why would he check if its empty
he wants a player which is not the player given
so list should be probably empty or 1 element hwich is the player
no you shouldnt, read what i just wrote
i know
after the loop im checking if its found
but it says found is always false
even tho i set it as true
as i said, if you get to the place after the loop, it means you havent found any player so you havent returned
. here i said that nevermind and dont make the boolean, just print after the loop
ye
my grandmas crying in the other room
why
she wants to go back home (flight is months away) and the days arent passing by
i dont get it but i guess good luck
that code just hurts
ow yeah
i dont see a reason for it to be static, its not named correctly and i dont think ur checking its the right player how you want
yeah, name it generateHit not generatehit because you start with lowercase, then another word starts with uppercase letter, also instead of doing .toLowerCase() on two strings, just use string1.equalsIgnoreCase(string2); this method already ignores the case
also
you placed the "!" adter "is" not after p.getName()
that is the correct place for the !
or if ur talking about the message doesnt really matter
yeah message
is there a way to randomize the players?
like i know if thers 3 sutible people
theres one person thats always gonna get picked
also you dont need the extra braces in if statement,
instead of
(condition) && (condition)
it can just be
condition && condition
thats becasue there are 2 booleans with only one AND operator, if there would be more operators and you would want to change the order, which one will be first, then you add braces
wait a second
dont choose the first person then
idk
who i choose
I guess ill store the sutible players in something then randomly pick them?
figure out who is a valid option to pick and choose a random element
i dont know the best way to do it, but you should read what i have just written, and understand it
what do i do to check if some object is instance of class x, not instance of child of this class
getClass and compare
okay
i mean arrays have set length which you cant change
but you can use arraylists
but you should know that, if you don't its gonna hard to make a plugin probably
but
i started programming because i tried to make plugins for minecraft, but i didnt understand a thing so i started learning java later
I learned java as I made plugins
but I had existing principles
i know other languages
and had been coding in other languages for a while
so i know how arrays and stuff works
and by other languages I don't mean html
xD
i have practiced
scratch
and I wasn't making a clown of myself
c++, python and javascript
is he?
ye
he's been refusing to learn and just brute forced it
idk
why not static though, its a method which u use, no need for objects, i guess
you trolling rn?
i love static aboos
no i just dont understand
Cool so let's cover it briefly
Is there any way to get the jarfile of a plugin, or of all active plugins on the server? doing some scripting fuckery (Kotlin, not any other bad shit kek) and would like to add all active plugins to the classpath
When you're self-taught you end up facing every bad habit imaginable because it's the shortest route
JavaPlugin#getFile but it's protected
fuck
okay but does it make a difference in small plugin?
This leads to things like static abuse, "async=fast" and some other misconceptions
Take some pride in your work
what does it mean
hey illusion whats this
just a thought
u mean efficent
reflection it is then
eh you're doing IO the extra 0.1ms from reflection isn't an issue
just cache the method and move on
method handle wooo
i dont know whats that, what do you do instead, make objects every time or have a singleton
or what
β¨ it depends β¨
yeah,,
hes too used to kotlin 
i love compiled objects
primary language at work
and I might be using it at a diff company if I pass the interview process
Static access isnβt bad per se, however like illusion said it depends, itβs hard as a beginner to understand what qualifies an object or a field to be static
compiled objects have static fields but singletron'd methods
why will playersthatcan.size() always be zero?
Static access is for a somewhat niche use-case but most ppl abuse it because "how do I pass an object"
can you change what i told you to change in your code?
I'll leave this here
I'll also suggest using equalsIgnoreCase and seeing if your if statement goes through
And using UUIDs instead of names
and do
List<String> playersThatCan = new ArrayList<>();
not array list 2 times, and also no "String" 2 times
but wtev he isn't here to listen
Here are some links to get you started on learning Java:
- https://www.codecademy.com/learn/learn-java
- https://www.sololearn.com/learning/1068
- https://www.learnjavaonline.org/
- https://programmingbydoing.com/
- https://docs.oracle.com/javase/tutorial/java/index.html
The last one is the only official one, however some of those concepts assume that you already know a bit about programming.
https://media.discordapp.net/attachments/694661573125472256/998143126373941248/6n0v4g.gif
dis is like
this good?
why is my key randomly red
why don't you just use an init block
fuck I am dumb
or inline the variable because kotlin lets you
rad what the fuck is that
also there's a minor issue if I decide to delete my .jar at runtime
getKey
then you will just be fucked
don't run scripts and delete jars fr
no, it's key()
I moved Vault dependency lower down in my dependency list and it fixed it
no comment
going to get ur oil changed and the mechanic starts talkin about some wind shield wipers
oh yeah doesn't vault have some transitive dependency for 1.13
no im pretty sure TrimPattern implements Keyed
are you actually stupid or just pretending?
idk what ur talking about
which uses get key
getKey is deprecated
paper moment iirc
you sure ur on spigot 
ngl sometimes i actually dont know
you outed yourself lets go
fr π
uh
still dont like it but it looks fine
Cool so let's break it down: When someone gives you good quality advice you should listen. Being ignorant because it doesn't fix your immediate issue is not gonna work long-term. There's a reason why me and countless other people wrote guides
Some nice variable names there
why there is _ in name
python
BUT ITS NOT PYTHON!!!!!!
so?
it works
and still there is no equalsIgnoreCase() π i give up
?spoon fr
Spoonfeed a newbie for a day and they'll come back with more questions. Teach them to find their own answers and you'll both be better off: you won't get stuck answering the easy questions and they'll be much more productive than before.
I'm surprised you lasted this long
will it make a performance difference?
are you ever gonna touch this plugin again in the future?
dont know but its looks bad
is this it
That's what she... oh wait nvm π
programming is not always about performance
you can remove the braces
dawg you're a dev who's she
he has a gf i think
premature optimisation moment
he doesn't belong here
thats what she woulvde said
hey im a devv and i am a girlfriend
Add debug to both of those conditions so you know which one is failing
shioku does too
from what I've seen you advocate for static abuse so you're not a dev
choco has a husband
at least not a respectable one
so does simple
could he use player.equals(player2)?
no because its Player objects
yeah right
solid chance yeah but is it really good practice to store players in a list?
it will, pretty sure even == passes
bukkit doesn't do throwaway entities
so you could have 2 player objects "from 1 player" but one could be changed? or im not right
thats an implementation detail i feel like
only reason why that'd occur is if you have a memory leak
player object is tied to the player's lifecycle so if you keep it beyond that it's your problem
can you clone it πΊ
I paid for my memory, I'm gonna use it!
is an arraylist with nothing in it size 0? or null
try it out and lmk how it goes
size 0
it's an empty list
so if i add one player to it
how can a constructor return null
idk how to clone player objecet
its not null
shh its hard language
(it's not both of y'all just refuse to learn it)
im not saying for me.. for hi
m
so.. interface type shit
leaking this type shit
well yeah
public interface MyObjectProvider {
MyObject provide(MyParam one, MyParam two);
}
luckily
factory ahh
Lists.newArrayList type shit
yeah thats an L way to do it
my code feels messy as hell
go figure
interesting
bet 5 bucks it has some library dependency it isn't loading
nvm it errors in the logs
maybe it says something like "list is always empty"
wait it probably isn't by default
purpur
Bro got the rand_int1 integer π
purpurp
u shouldnt do -1
Random.nextInt(4) is 0 or 1 or 2 or 3, no need to subtract
I'm surprised java doesn't have a CollectionUtils.getRandom type thing
yeah same
kotlin πͺ
I was wondering about that too
i think i see the error
CollectionsKt my beloved
dont subtract 1
if its 0 then 0-1 is -1
i mean its 1
odd, the plugin itself should be in the classpath which should provide the stdlib
yes
random will return 0 or 1
i understand it now
what's the confusion about generating a random number
i keep reading this as literally read what we say bitch
if its 0, then you cant put 0 into nextInt() method
good
hah
hm
can we rephrase that as "if the list is empty there's nothing to get"
probably that its 0 1 2 not 1 2 3
let him figure that out instead of just spoonfeeding
idk
he wants to figure it out
that's the reason he ain't reading
so don't pretend he doesn't
i think this will work
I don't
its not true
if it says so
it literally is
why is it alwways size 1?
it isnt
if size > 1 ? ----> else if size > 0 ? , if it gets there, the size must be between 1 and 1
oh.. okay..
didnt even see that if else if
Nightmarish
u right
You don't even need the else if
i do
no, just check if its bigger than 0
!isEmpty()
you can also rewrite the entire method
right, ur gonna be generating random number between from 0 to 0, but yeah
Theoretically can i access the target variable from the main file?
No, from 0 to 1