#help-development
1 messages · Page 1283 of 1
let me verify, but I believe you should have the docker executor if you want to define image
so if i remove the image it should be fine
technically, yeah
okay thank u
lmc
okay i changed the config to ```yml
pls work?
stages:
- deploy
deploy:
stage: deploy
tags:
- mcscans_runner
before_script:
- echo "$ENCODED_SSH_KEY" | base64 -d > ~/.ssh/id_tmp_id
- chmod 600 ~/.ssh/id_tmp_id
- eval "$(ssh-agent -s)"
- ssh-add ~/.ssh/id_tmp_id
- ssh-keyscan -H $PROD_SERVER_IP >> ~/.ssh/known_hosts
script:
- echo "Deploying via SSH..."
- rsync -avz --exclude=".git" ./ root@$PROD_SERVER_IP:/var/www/api/
environment: production
still Checking pipeline status without the job being assigned correctly ig
is this a new one, because your other one had a only no-masters rule
i mean i just cut that out because i stopped caring and i only have one branch
well, just check the logs for the runner then ig
sudo journalctl -u gitlab-runner
yea i was checking
well
not epic
wait
i truncated the log gg
not sure if there's usually logs after Initializing executor providers
I just skimmed through it but there doesn't seem to be anything weird on these logs
have you tried just re-registering the runner
Does spigot Mess with the Jars that are uploaded? Compress, Tweak, or Modify at all? If not, Who should i email or talk to about a concern?
?support
Spigot only modifies premium jars for resource placeholders
What do you mean by that? Im more referring to a resource i own (Iris) and im noticing that in the upload binary the decompiled version seems to be different than the decompiled un-uploaded one
as an example
are you sure you're comparing the right version of these jars
the resulting code SHOULD do the same thing.
but if you are doing reflection, or whatever its problematic
yes
we are doing a sanity check the next release just because this was off enough that out sentury analytics made us question our sanity
welp, email tmp-support and see if they tell you anything
but if this is intentional like compression or whatever its technically in violation of the tos lol
if they do, please share results as I am also curious as to whether spigot does anything to jars
Spigot's ToS?
ill shoot them an email and let you know whats up, and yea
more an err
as its nolonger the jar we uploaded
if that makes sense. and this is all IF any compression or modification is done
only modification that i know of is https://www.spigotmc.org/wiki/premium-resource-placeholders-identifiers/
im not pointing fingers, and we are doing a sanity check, and im still reaching out
better to double check tho
also ignore the flavorful language here haha, one of the people who bought it was doing something and flipped out. and thats what brought it to our attention
it's alright, kind of understandable reaction lol
though, tbf, what is said there doesn't really prohibit Spigot from modifying the jars, be it through compression or anything, it just waives legal liability
not that I think it's alright even if it was compression, if I were to do code-signing that'd fuck up my jars and I'd be in a pickle but welp
are you sure you decompiled those two jars the same way
because method parameter names do not by default get included in compiled bytecode
yes
which is why decompilers just generate names for them programmatically, e.g. paramInt2
I assume they compiled the jar with -parameters to keep them
or they're decompiling them through an ide/using a bytecode inspector and the ide infers them from the project sources
the jar files are compiled with -parameters and both jars were decompiled with jd-gui
the only diff is that one is downloaded from spigotmc and one is the one before the upload
that rules out most of the decompiler related causes
i haven't heard of spigot doing any processing on the uploaded jars but presumably that is what is happening; best hear from someone who actually works there
definitely seems a bit iffy if they waive liability on the downloads and also fiddle with the downloads in unspecified and undocumented ways
my current guess is that the placeholder modifier drops the parameters and runs even if you are not using any
if it's a premium resource, i could maybe see that string substitution thing causing the parameter names to be lost
I also don't know of any compression that would remove param names from bytecode, so it's definitely very iffy yeah
well there's r8 but that's android stuff
One of the issues i see with Jdgui is its been deprecated for ages Procyon is what im trying to get @slim crown to use, and or just another MODERN decompiler as another sanity check. because we could all be stupid and the decompiler could just be crap haha
you'd have to like modify the constant pool which means shifting around most of the bytecode which means offsets are fucked which means you might be easier off doing asm on it instead, which i could definitely see nuking parameter names
like, i dont think Spigot is going around modifying jars as thats far more effort for no reason, nor would it make sense. so im almost certain its either on OUR end, or the decompiler.
I've seen people use Recaf nowadays
I use a variety. Just depends on if luyten works or not 
or that yea, but just not an almost 18 year old decompiler haha
i mean from what i understand he's uploading and downloading the jar and it changes along the way, specifically losing the encoded method parameter names
so it shouldn't be an issue of the decompiler
it'd be more understandable if it was just file metadata but param names do sound weird
Out of these the java ones are:
jd-gui, luyten, bytecode-viewer, and recaf
bytecode-viewer supports a few too, but they're not guaranteed to all be the same version
well, except engima I guess
enigma's exe & dll
wtf with refac & procyon the debug param names are back
yea i just did it on my end too
It would seem that the jdgui was the issue
Yea, different decompilers do things differently
who would have known it was the barely legal age of 18 deprecated decompiler.
It's why I have 4 different Java decompiler. 2 of which have multiple which are built-in
cool, fire put out.
If all of them break, then something's fucky with the jar itself 
still a bit strange but ig the placeholder processor is dropping some backwards compat stuff
Lkely not. The premium placeholders are only for premium stuff and is likely just string replace & code adding
I liked jasmin representation better when that was a thing
well we are talking about a premium plugin
Same thing applies. If spigot's system is the same as the one I have (quite likely) spigot's not at fault 
nah xD
nah?
you are in your own simulation xD
so you don't have the same spigot
I've got access to the same exact jar(s) as you do 
oh there's a spiritual successor apparently: https://github.com/Storyyeller/Krakatau
and it's being rewritten in rust™
it was a joke i got that xD
are in the final spigot jars only spigot mappings (if any?)
depends on the version
I am not sure what that means
Spigot always runs Spigot mappings on the server
You can create mojang mapped jars for development but by default end user servers are always spigot mapped
can you even get mojang-mapped jars to run
ig if you just take the compiled artifact out of the target folder in the Spigot-Server repo that has the mojang mappings you could run that
legacy versions had spigot mappings only, on the modern versions as I can see they are spigot mappings on the server, but in dev mojang.
then buildtools remap them on compilation
but since I have reflection that will be no help to me
mojang mappings are only used during development of spigot itself
every running server out there is using spigot mappings
yes, but since I am using reflection I need to only look for spigot mappings
I could also use indexes, then I don't need field names at all!
the order of the fields usually doesn't change
Well especially the index of specific types
Filter fields by type, then index those
Definitely not impossible for those to change though. There could be some obscure fork that adds a new field of the type you're looking for
But at that point it's no different than that fork removing the field you're looking for, so fuck 'em
Thanks, I think this is what I will go with:
- return type
- name (if present) OR index (if present)
two fields with the same name cannot exist anyway so it is always either by name or by index (declared fields only)
Good to have both, yes
Just make sure you cache your reflective lookups. Don't want to be doing name and index lookups each time you want to get the field. Cache it, it will stay the same at runtime
already do ;)
public static Field cachedFieldFinder(Class<?> clazz, String firstConstant, Class<?> retType, int index, String... alias) {
FieldData data = new FieldData(clazz, firstConstant);
if (fieldData.containsKey(data)) return fieldData.get(data);
for (String constant : alias) {
data = new FieldData(clazz, constant);
if(fieldData.containsKey(data)) return fieldData.get(data);
}
GamePair<Field, String> fld = fieldFinder(clazz, firstConstant, retType, index, alias);
if (fld == null) throw new NullPointerException("Could not find a field specified by the name: " + firstConstant + " of the class: " + clazz.getName());
data = new FieldData(clazz, fld.getValue());
fieldData.put(data, fld.getKey());
return fld.getKey();
}
I'll have to modify this specifically though
Perfect
btw,
Field field = fieldData.get(data);
if (field != null) {
return field;
}
Saves you from making 2 map lookups with containsKey() and get()
fair enough, I will refactor the whole thing though, as you can see it was made to serach by names
do you know how computeIfAbsent compares to that?
just curious
It basically does what I show, only it puts into the map if it's empty
I also have that yes, for caching almost everything I use computeIfAbsent
default V computeIfAbsent(K key, Function<? super K, ? extends V> mappingFunction) {
Objects.requireNonNull(mappingFunction);
V v;
if ((v = get(key)) == null) { // Set v to get(key), if value doesn't exist
V newValue;
if ((newValue = mappingFunction.apply(key)) != null) { // Get new value from function. If not null,
put(key, newValue); // put it in the map
return newValue;
}
}
return v; // If the value (v, from get(key)) wasn't null, return it
}
So, same thing, just with a value setter if null
is this code free software that one can redistribute it and/or modify it under the terms of the GNU General Public License version 2 only, as published by the Free Software Foundation? and is this code distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE? should one have received a copy of the GNU General Public License version 2 along with this work; and if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA?
should one contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA or visit www.oracle.com if one needs additional information or have any questions?
lol
radio silence..... i think choco is violating that code's license
hilarious how you put that together
thank you
computeIfAbsent my beloved
So I haven't used spigot in a while, and this is really confusing me lol
Somehow my command isn't being registered?
I'm calling getCommand(..).setExecutor(..) on enable
and im sure the command is in the commands list in plugin.yml
yet it's as if the command simply isn't there, when I test it ingame
some tips why that might happen: is the plugin correctly loaded and compiled?, command just prints its name when executed? -> something wrong with plugin.yml (is it in resources?)
Nevermind I'm kinda slow
I restarted the server before putting the plugin there 😭
so fried
F
Now what if I told you I wrote that code myself
It just so happens to be almost identical to the JDK's
I ADDED COMMENTS!
AND STRIPPED 4 LEADING SPACES SO IT WOULD JUSTIFY LEFT!
so you are admitting to having redistributed it and/or modified it under the terms of the GNU General Public License version 2 only, as published by the Free Software Foundation?
how do private mine plugins work? is it a packet to update one block or is there some way to update blocks on a large scale?
guys how can i make hex code scoreboards. why it gotta be so hard😭
how can i things like this?
There is a multi block change packet
Or you can resend entire chunks
custom font
do you know how can i make hex supported scoreboards?
the player skin?
component or legacy?
usually some weird shader magic beyond my understanding
component
you mean color:#hex?
Is the handler that handles Minecraft server inbound packets still called "packet_handler" (in netty pipeline) in spigot 1.21?
there is an api method for it, even!
have some private mine plugins available for free?
realmines
how to check if player has caught something, while fishing?
@Nullable
public Entity getCaught()
Gets the entity caught by the player.
If player has fished successfully, the result may be cast to Item.
Returns:
Entity caught by the player, Entity if fishing, and null if bobber has gotten stuck in the ground or nothing has been caught
I only see this in PlayerFishEvent but it dosen't return boolean (or im just stupid)
It tells you what it returns if nothing has been caught
if you're asking how to discriminate between fishing up items from the water vs. catching an entity by hooking it, you can probably look at the fishing state to determine that
And what do the mine plugins do, for example, to prevent the block from disappearing when you right-click on them?
Are you making a plugin?
yes
Then there's a packet that gets sent when a player right clicks a block
you'll need to handle that case and resend the block change
what packet name?
and even with that, it still has more performance than the conventional mine plugin?
and another thing. when you move away the blocks that were modified on the client side can return to the original (server side). how do plugins deal with this? And also with alternative clients that can change this
Most mine plugins don't use packets directly
even private mine plugins?
anyways you'll need to listen for when a chunk is loaded for a player and apply your changes to it
@chrome beacon
define private mine plugin
to get fully per-player packet based functionality you're looking at replicating large parts of the game code which will be nontrivial to implement and maintain
replicating a mine schematic and having each player mining in a physically separated location/world will be far easier and the performance difference is negligible
is it just me or i like to write my own implementations of SQL without ORM's using plain old JDBC api by designing query interfaces and use cache like Caffeine?
overall it feels better experience than having to use hibernate or mybatis
it just integrates better with your code when you design the persistence instead of using generic solutions
Depends on use case tbh. I find ORMs a lot easier when dealing with large objects. Especially ones that are growing or changing often
Same reason why large companies for the most part use ORMs aswell, they do everything automatically. No need to manually update potentially hundreds of queries when something changes
"they do everything automatically" until you need to debug some kind of sql query which doesnt execute properly or gets into performance issues
i despise session based orms
Hibernate has verbose mode
its a debugging nightmare
i just store data as json blobs and call the sql job done
instead of controlling sql queries yourself you're giving it to external tool which does its job worse than you do if you weren't lazy to do proper implementation
If ORMs were so horrible these mega companies wouldnt use them
you write sql migrations anyway
But their use alone should be proof of their capabilities
mega corps push shit for public investors. just take a look into websites. google till this day doesnt use semantic html and uses divs everywhere
i like how google does give advice on accesibility to use semantic html but itself doesnt use it properly
hipocrisy at its finest
you think they write that manually
you can automate semantic html
for example why tf this is not <ul> <li>?
and has to have aria role listitem
that just doesnt make sense
Tech debt
And why change something that isnt broken
Roles seem correct at least
they do have proxy for that
if it was truly legacy it wouldnt use flexbox
<li> is supported since like IE 5
that's just incompetency
You talk as if you are better than a team of thousands of developers. You dont think they have their reasons?
"do as i say not as i do" ahh tech company
that's the thing they have thousands of developers
well, see, dev time costs money
and yet they do this
and probably codebases older than most of us here
if you had to pay for their huge dev team to rewrite this, would you tell them to rewrite this?
conversely, telling others to use semantic whatever whatever is optics which is pr which is money, so of course they would do so
you might not like it but it makes perfect sense
it all comes down to money
i just hate hipocrisy
i dont care if its div or ul
i just hate to see megacorps telling others what to do when they themselves dont taste their own medicine
i don't really care about that part, i only wish the google ads interface wouldn't take 15 gigabytes of memory to run and OOM my browser after 45 minutes
Google always has been a bad example
Just look at how slow the YouTube UI is
Takes ages to hydrate
It's also quite buggy
Loves to play two videos at once and the channel banners sometimes flicker like it's two of them fighting
Hello, is there a GUI API to easily make sections ? (I mean, by clicking on items, it opens "another" inventory with items in)
IF is one
If mentioned
because div's on their own do not apply anything unlike those other tags you listed it is interpreted by the browser and each broswer does it differently or can. So you use Div and then setup the rules for the styling how you want.
would say Div is probably one of the most useful tags which is ironic because on its down it doesn't really do anything lol
Oops! All div
The world runs on Div
Yea at this point we should also make text input elements as divs because they generally do not get styled. The argument is dumb. Html semantic elements exist for a reason. And user agent stylesheets nowadays are pretty standardised between browsers
Just pointing out why div tag is preferred. Also ul li as interpreted by browsers indents them and may not put it where you want it and each broswer may format it differently. Instead of one style rule with div you need 3 or 4.
this is why I don't use html elements and instead just make my website a png
then I can be sure they get exactly what I wanted
semantically <ul> is preffered. You just cant code your website for specific browser or user agent stylesheet, that's just bad. That would be justifiable if they wanted to make page loads quicker, thus saving some data, but this obviously not the case because their whole website is div container hell and could be broken down into specific classes with way less html elements than It is right now
Its component-based autogenerated page, you can see it from class hashing and controller attributes.
Component css scoping is also dumb, like cascading stylesheets are cascading for a reason. instead of creating fine tuned css global classes with sass or heck vanilla css, frameworks opt-in for component level based css hashed classes which contains duplicate css properties per each component because those css classes are only used per element and cannot be optimized due to how frameworks dont analyze html tree for css classes
all of this nonsense and bloat is for "developer experience" for pushing quick and dirty apps which run like shit on mobile devices but kisses investors ass because "muh innovation"
its terrible and im tired of pretending its not.
i might sound like a boomer, but I believe that agile ruined the quality of todays software
companies nowadays prefer labelling their apps as AI powered and doing cashgrab from investors instead of doing real innovation or improving the quality of their existing software for example
just take a look at microsoft and what Windows became during the last 15 years
it's crazy how I get to relive and rewitness the same arguments that were going on 15 years ago
looking forward to 15 years from now when someone else says the same exact thing
These days browsers almost behave the same however there are times you have to make code for specific browsers. It was a lot worse years ago in this regard. Point is you absolutely can just sucks when you have to and as I said there is still cases where you do. Not sure what you mean semantically ul is preferred. Anyways, as far as html goes it doesn't really matter what you use as far as tags go since no matter which you choose to use it won't speed up anything if you are using a stylesheet file anyways unless you want to put the style in the element itself in which case it would but that is not the standard no more and frowned upon in doing vs using stylesheet lol.
MDN says you should semantic list html elements for such uses cases
and?
i've replied to your " Not sure what you mean semantically ul is preferred"
so because one browser said so means it applies for all?
oh your concern is over accessibility
why do all items' meta extend damageable?
how do i check if an item actually has durability
like sword, pickaxe, etc
because i have /repair and it can creates unstackable items
nvm am stupid
data component types make damageable kind of a thing of the past
bruh
i barely got used to damageable
it's been a thing for a solid 10 years
fortunately ItemMeta is very flexible and quite close to the system adopted by vanilla
i'm used to durability
each one has their own mine
but this mine has to evolve in size for each player without teleports
make the area large enough to accommodate the largest possible size ahead of time
alternatively, create a world per mine
but the mine will improve in size according to the user's level
yes, so have an empty area around the mine at first
and then expand the mine into the empty area as it grows
space the mines 1000 blocks apart
but this part has to be filled in
cannot be empty
then fill it in
and i make 1 world for each player?
that is the other alternative
tthen server will have 5000 worlds
ideally, use a custom world generator that makes the world solid stone, and then paste the mines into the solid stone
you don't have 5000 concurrent players
I thought they weren't at the same time but that they had already logged in.
you only need a world per online player
still, 100 worlds is a lot
alternatively, do what i said first and space the mines apart 1000 blocks
and wouldn't it be better to do all this with packets? I don't think it's too complicated
because believe me doing this with packets isn't something you want to attempt yourself and probably can't afford to pay someone to do for you
you will have to replicate large parts of the netcode and game code to achieve this
and you will have to maintain it across versions
just need use packetevents
you do you but i'll advise against it
packetevents do this
🤡 sure buddy
keep in mind that packets and game behaviour change across versions
packetevents is only a wrapper for the protocol
any changes made to it will still require changes on your end to be compatible
I only have doubts regarding when I send a block change packet on the client side for example, for n factors the block can synchronize with the server block and no longer see the block and I don't know what these factors are. if it is by moving away, etc.
I just need the plugin to be compatible in one version. Then sending packets from the server to the different versions that the client is using is handled by viaversion
you'll have to intercept all sent block change packets for the affected locations, all chunk packets for chunks containing affected locations, and probably light packets and a handful of game event packets
wdym light packets
for the chunk packets, you will have to decode the chunk contents and rewrite it to contain the blocks you need it to contain by accessing/modifying the palette and nibbles
PacketEvents actually has a nice wrapper for that
that'll be quite convenient
then after that you'll want to either use nms or manually calculate the breaking speed of the tool on a given block and send block damage packets accordingly, and later once the block has been fully broken, compare the serverbound block break packet with the timing to see if the player is cheating (anticheats won't help you here since the blocks are clientside) and respond with an ack packet accordingly; damage the tool (remember to account for unbreaking); then create the dropped item with that new fancy EntitySnapshot API and send a spawn and set metadata packet for it, and similarly validate the player picking it up and manually add the item into the player inventory; or alternatively make the entity only pickable by that player and use the entity show/hide api to only show it to that player
overall i don't really think this is going to be worth the effort but you can take a crack at it if you like
like if this is for a prison server where the mine is like 90% of the server functionality, it might almost be more straight forward to rewrite a basic server in C or whatever that just supports movement and basic block breaking; that way you could actually have those 5000 concurrent players
or just use minestom which is still in java but parses basic movement and inventory/container syncing
apart from that you handle everything yourself
But muh 5000 concurrent players
I suppose java performs decently well nowadays if you avoid allocation traps
How do i reset Arenas using ASWM?
There's the API docs
tbf gen zgc is really doing good given u provide it enough ram
Lol do you have expirience with that
runTaskAsync is a poll of how many threads? and is this poll done for plugins only or does server.jar also use this poll?
I ask this because I don't know if I should use runTaskAsync to do database operations or if I have my poll for that
If you're on a modern version you can use VirtualThreads for database operations
They're perfectly suited for I/O
in a server network when I need a new minecraft server for a minigame, do I create that using Kubernetes or what?
That's one way to do it
whats another way?
or is there any other sane way?
it really depends on how you want to scale
For a small server running Kubernetes is overkill
hm lets say 50 players
Yeah then you do not need Kubernetes
You should ask yourself if creating servers on demand is even necessary on that scale
stale servers are expensive
is there anything better than kubernetes if I want on demand servers?
but then I need 2-3 servers for each minigame running the whole time right?
which is fine
how do I cleanup the server after the minigame ends then?
Depends on what needs cleaning
so u mean I should only e.g remove the world but not the whole server?
Consider not saving the world in the first place
correct. A single MC server can easily host multiple minigame worlds at once depending how much resources you dedicate to each instance
I see. static servers are kinda silly if everyone wants to play the same minigame tho, isnt it? howa bout this?
you would need to create a custom system if you want something better
have done it, and it takes quite a while to make one
then I need to modify every chat event, tablist listing, etc right? so it looks like its isolated
i could actually do some docker kill and docker exec..
for the chat event no, you just use conversation api and make a channel for every minigame
and put the players in there
well plus use this for smaller gamemodes like duels
it doesn't really matter on the size
just matters how much resources you dedicate, whether or not the server is custom or not
I generally used custom servers where the internals have been gutted out except for what was needed for the games
everything not needed was tossed out
Unbounded
If there isn't a free thread to take up the task immediately, a new one is spawned for it
the implementation is pretty self-explanatory, so if you want more details then just take a peek at it
Hi again. I'm working on this airstrike thingy that can shoot projectiles from a specified origin to a specified destination. If the origin is very far away, the projectiles won't load and move (obviously). But, if I load all the chunks between the projectile and the destination, the projectiles still don't move, unless I move closer to the projectiles
any idea what the issue could be?
i'm pretty sure loading chunks through bukkit makes them the highest ticket level and hence entity ticking, but now that i think about it, i think mojang might have changed the way how entities are ticked recently
that's bukkit though, I'm using paper
bukkit as in through the bukkit api
this includes paper, yes
in fact it is a pet peeve of mine that they still haven't added api for the various ticket levels
i would like to preload a bunch of chunks in memory for faster teleports/less gc spikes, but don't want to spend cpu on block/entity ticking; border chunks would achieve this but for that i'd need nms
and the chunk ticket bullshit is like one of the 3 places in nms which i refuse to touch
either way make sure you load the chunks before spawning the entity rather than after; paper has some settings where fireballs and other projectiles don't get saved on unload
and do a sanity check i suppose seeing a few ticks afterward if the projectile isValid
it's also recommended that you ask in their discord if you're running their software. Some of the things vcs2 pointed out don't apply to Spigot so if they didn't just happen to know them you could be in a pickle
something something entity activation range v2
though i don't think that affects projectiles
I wonder if that patch is still relevant nowadays, or just diminishing returns
it definitely was back in 1.12, not so sure now
is it possible to make permenent trims? for example you do /trims then select chestplate then silence then white
now any chestplate that you wear will have silence trim with quartz but when you remove the chestplate the trim gets removed
depends on if it implements vertical activation range, which i think it does
back in the day it used to work like chunks, i.e. only horizontal distance would count
which was incredibly dumb
i know i could just check for when they remove and equip the armor and then remove the trim but that would cause lag if someone spam removes and equips it i'm guessing
tbf it was made in pre-flattening era
not really an issue with lag, but it's kind of troublesome to catch every event that might modify the armor slots
the closest thing we have is paper's armor change event, but i don't remember if changes made to the old armor item are reflected in the item
dunno we might have it in spigot now
but eyeballing by the way paper implemented it, it might not always be possible to reflect the changes made on the old item
since iirc it just checked the slot every tick
not sure how the spigot pr is implemented
should i just listen for set equipment packet and change the trim from there? because it's jsut a cosmetic
that'll only make it visible for others tho, not for the player itself
don't overcomplicate it and just set the trim when they equip
why not? can't i just do sendEquipmentChange on the same player?
ah, I forgot that was an API method yet again
ig if you don't care about the item not reflecting the trim, that's fine
it won't change the item in their inventory i don't think, which might look a bit confusing, but yeah that'll work for other players and in third person
How do I serialize Material to string and vice versa?
but the thread will always be free because it will be unique and exclusive to make the connection that will already be guaranteed to be executed in the previous query
why a string
Material#getKey#getKey and Material#matchMaterial
oh material, I thought you said item meta
and on 1.8
just Material#toString and Material#valueOf
don't remember if there was any way to get the minecraft name of a Material back then
why is there Material.matchMaterial in 1.8 then
no, the threads will die if they aren't used
and then the pool will spawn new ones
Minecraft is like the only game where fking community plugin devs know completely different api calls on 20 different versions at the top of their head, kinda crazy
there is a cache for them but it only retains a certain number of them for a certain period of time
if you use Executors.newFixedThreadPool the thread will never die
You should use that
It just handles stuff like casing for you
you can use that if it existed back then, I didn't think it did
but havent material.getkey
yes, but the bukkit scheduler doesn't
just use the output of Material#toString on it
and that's what you were asking about afaik
or were you asking about completablefutures with a custom executor?
I was asking about using Executors.newFixed or newcached
right
I am confused, I am pretty sure you asked about the bukkit scheduler lol
yeeeah
then I should use valueof, why I would use matchmaterial?
just use Material#toString and Material#matchMaterial
as Jish mentioned, it handles things like casing for you
but why not Material.valueOf instead matchMaterial?
wdym casing
technically if what you intend to do with the string is to call the enum value getters, you should use Enum::name, since toString can be overridden
valueOf is more strict, if you pass it a lower case string it will fail for example
It also handles namespaces in the modern version
but if i use material.name i never will pass it a lower case
I mean, you can use whatever you want
one is just more convenient
and whats difference between getMaterial and matchmaterial?
i think the docs do say this but one throws an exception if nothing matches and the other returns null
I understand that matchmaterial is even less strict than getmaterial
Both return null, matchMaterial() does some processing on the input such as lowercasing, stripping of whitespace, and replacing spaces with underscores
Prefer matchMaterial() if you're accepting user input
odd, i remember getting an exception from them but maybe i just misremember
valueOf() will throw the exception because it's Enum#valueOf()
i specifically remember being moderately annoyed because i thought it would return null but it exploded instead; i specifically picked it instead of valueOf because I wanted null out of it
god only knows though, i seem to be remembering things that never happened in recent years
I've been the same
is there another one for legacy versions too ? (1.13-)
I am aware that the more you remember things, the less it's an actual memory but just a reconstruction of what your mind thinks happened, but I didn't think I'd have it this bad lol
🤷♂️ haven't made a plugin in quite a bit
okay np
I'll try to figure out how to do it by myself, thanks for letting me know about IF, can be useful later !
often times it's easier to just use bukkit API directly
?gui
if you want to make your own
I was going to suggest looking at the implementation for the methods but forgot the stash doesn't have tags for versions in the bukkit repo
the craftbukkit repository does so ig you could just cross-match commit refs but eh
Hello 👋 does someone know if there is any fix for this bug? Been having this issue for quite a while now
no clue what i'm looking at
hes dead
💀
So, whenever a player dies and once they respawn, they can still play and they're like shown in the screenshot
Hello! not enough context to actually provide you with an answer
That usually happens when a plugin heals a dead player
Now if this isn't caused by your plugin I suggest heading over to #help-server
Why LURED is not up here?
LURED Is paper api
caught red handed
i forgot im using it XDD
Get him!
org.bukkit.PortalType.CUSTOM makes me very curious : what is the purpose ? doc says "This is a custom Plugin portal", but I have no idea what to make of it
I searched on google and some plugin codes, didn't find any usage
probably just future proofing
unless theres some programmatic way to make a custom portal which im unaware of
there was that one minecraft update
I guess if a plugin wants to manually fire the event for their portals
the april fools one
that was a snapshot though
I looked at PlayerPortalEvent and it doesnt seem to take a PortalType
probably, it has been added in 2013 and it seems that there is nothing on it anywhere
yeah probably just a forgotten relic atp
hey i mean it only took us like 11 years but we got pretty close to almost making use of it
Heya, does anyone know how I can activate the second layer on my NPC? Because at the moment the skin of the NPC is only 2D
are you just using an nms implementation?
yes
You have to set the entity data
one sec i have a snippet
this.getEntityData().set(DATA_PLAYER_MODE_CUSTOMISATION, (byte) 0xFF);
this was for 1.19.1 but will be pretty much the same for later versions
Oh wow, thank you so much!
That was easier than I thought
hey, can anyone help me with Messaging Channels (Spigot / Velocity)? I dont know what I did wrong..
?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!
my PluginMessageEvent isn't fired even tho its registered in ProxyInitialization, the PluginMessage is sent and also the channels are registered
Could you send the relevant code
how do I get a NetworkManager from a Player / EntityHuman? It used to be player.networkManager.(channel), now it's something else?
?mappings
Compare different mappings with this website: https://mappings.dev/
no I actually cannot find the method lol
What are you trying to do
I basically need to get the Player's netty.io.Channel
PlayerConnection connection = ((CraftPlayer)player).getHandle().playerConnection;
ChannelPipeline channelPipeline = connection.networkManager.channel.pipeline();
but this is legacy
I found it
ah you're using Velocity
I recommend heading over to the Paper discord
Ok
but I'm not sure why you're using the forward channel
as that's intended to send messages to servers
and you appear to want to keep the message in Velocity
yeah its Not the original Version of mine. I asked chatgpt First and it messed a few things up
but it also didnt work before and i tried everything. The Event isnt Even called
Why is the answer always because GPT told me every time 💀
also you're never closing your streams, use a try with resources
is PlayerInputEvent works only on clicking. not holding? Can I make somehow holding button.
input event is only called when the input changes
i have to click each time
i thought this event loops
no?
@EventHandler
public void moving(PlayerInputEvent event){
Player player = event.getPlayer();
BoatSession session = MoreMinecraftBoats.instance.getSessions().getOwnerBoat(player);
if(MoreMinecraftBoats.instance.getSessions().getOwnerBoat(player) == null){
return;
}
Input input = event.getInput();
if(input.isForward()){
session.moveForward();
}
if(input.isRight()){
session.rotate(3);
} else if(input.isLeft()){
session.rotate(-3);
}
}
like if i am holding that for 3 ticks. it will work 3 times
have I to do scheduler for this? and stop after forward input is false
Yes
Bukkit.getScheduler().runTaskTimer(plugin, () -> {
for (Player player : Bukkit.getOnlinePlayers()) {
if (ArmourChecking.hasFullTrimmedArmor(player, TrimPattern.SILENCE)) {
if (!player.hasPotionEffect(PotionEffectType.STRENGTH)) {
player.addPotionEffect(new PotionEffect(PotionEffectType.STRENGTH, Integer.MAX_VALUE, 1, true, false, true));
player.getPersistentDataContainer().set(effectKey, PersistentDataType.BYTE, (byte) 3);
}
} else if (player.getPersistentDataContainer().has(effectKey, PersistentDataType.BYTE)) {
player.removePotionEffect(PotionEffectType.STRENGTH);
player.getPersistentDataContainer().remove(effectKey);
}
}
}, 0L, 20L);
}``` this is not causing lag on the server till now but i want to make a better way for this to make my plugin better anyone got any suggestions?
Use the infinite duration constant instead of int max
and instead of checking every couple of ticks you can listen for the armor changing
woah thanks! this will really help optimize my plugin
Do the mine plugins that frequently add balances to the player normally update the database in real time or do they just update the cache which will be updated in the database periodically?
Probably the latter
and to add/remove balances with commands like /money pay, should I update the database right away or do I do it periodically as well?
Those things you could probably make manual update calls cuz I figure they won’t be happening as much as the automated ones
Even so.. I don't think it makes sense to update one thing directly in the database and another thing periodically.
If you’re sure your caching system is solid then I don’t see the issue… they both deal with balance updates so just clear your cache whenever an update to the db occurs
Whether that happens manually or not, you’re still keeping things clean and updated
I guess you could keep like a transaction cache and total the amount from each one and modify db with that result just once in a while if you’re worried about that
can I force player to user F5 using plugin? Maybe Mojang created ability to do this, they created camera distance attribute.
no
the camera_distance is being added because you can ride ghasts and such, so to look nice they added that so the view is further away
but no way to force 3rd person view
Hello again, I made this airstrike plugin that shoots shulker_bullets, disguised with a block display towards a specific destination from a specified origin, and then explode. The issue is, by divine intervention a shulker bullet sometimes gets magically removed, and leaves the block display floating in the air
I am checking the following events:
projectile hits
entity damaged
entity dies
projectile collides with entity
entity killed
I'm cancelling the event on each of these (for these shulker bullets), but somehow there's still some shulker bullets that get magically removed
Any ideas what could be happening here?
Are there any other events that might be run?
chunk/entity unload will probably not save the bullet
wdym?
if the chunk unloads the bullet entity will probably be deleted, not saved. So your display gets saved but the bullet does not
hm alright
I force load all the chunks that the bullets go through though
so I doubt that's it
force load or chunk ticket?
if I stop the explosions from breaking blocks (so, it still hurts entities but no blocks), then this is a lot rarer. Just spawned an insane amount of bullets for a min and only got 1 floating block display
what's the difference?
Hey anyone here can help me? I got problem with plugin compilation.. please im not experienced
a chunk ticket = stay loaded until the ticket is removed, forece load = unload later if not needed
it's force loaded
?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!
I have the full code for a plugin, but I can't get it to compile in IntelliJ. I always get a COMPILATION ERROR saying package com.onarandombox.multiversecore does not exist and package net.milkbowl.vault does not exist.
I've tried many solutions for adding the dependencies (Maven repos, local JARs) but nothing seems to work. I think the problem is with my local environment setup.
You are using Artifacts to build instead of Maven
Right side of screen in the Maven Tab select package
i got again "package com.onarandombox.multiversecore does not exist"
and is multiverse in your pom
What that mean?
should i put u fully pom.xml file? can you help me please?
?paste
Error adding document. any other site?
thats not your pom
its mine,here it is https://paste.ofcode.org/eBhFuWXjFTGqgB8t8Zutcv
<systemPath>${project.basedir}/lib/MultiVerse-Core.jar</systemPath> Bad idea
Why with IntelliJ IDEA and jdk 17 i cant create plugins for 1.16.5?
what? force loaded chunks will not unload, the entire point is that they don't unload when there is no activity and have the same ticket level as a player
I thought he meant he manually loaded them instead of placing a ticket
i'm thinking of the World#setChunkForceLoaded mechanism
Yeah one of us is correct 🙂
I though he just ment he manually loaded them as the projection flew
i hope at least one is lol
Sorry for my lack of knowledge, AI helps me create the first plugin but it can't handle these errors
Hello, is this the right place to search for plugin/skript developers? Payment included
?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/
Hey my pom will not load my 1.21.1 for nms and bukkit also.
i'm trying to support all the versions of minecraft only not 1.12 and lower
https://pastebin.com/zkUKrW1r
my nmshandler
https://pastebin.com/9x7wkcan
Any idea why some particles, e.g. large_smoke can't be rendered at distances larger than ~30 (+-20) blocks, but other particles such as explosions can be rendered at 200+ blocks?
I'm trying to make a shockwave using particles
but a lot of particles don't want to be rendered far
Did you set the force Boolean to true
So i have a createInventory. I use to be able to open another one when selecting an option with putting the player.performCommand("othermenu") to open the other menu assigned to the command "othermenu" but its no longer working and just closess the inventory without opening the other one or saying unknown command... any ideas?
Why are you using a command
- Don't use commands for your GUI control flow (or however it should be called)
- Is it your own command ? Are you sure it exists, is it properly registered ?
If u still wanna do it that shitty way. Close inventory, wait a tick. Make them run the command/
yes, i can run the command seperatly and it opens the menu so they both are register
and idk, i was following a course and they set it up with a command
You are meant to wait a tick before opening another inventory in a click event
id add the wait in the listener part since that has the player.performCommand right
How are you gonna wait?
with a bukkit scheduler?
Good then sure
this seems like a trap
I would find a better guide
Or course or whatever
Using commands for your code flow is Wack
?gui
I agree with Jish guy
If I have plugin A that is dependent on plugin B, am I guaranteed that plugin A will shut down before B?
not by default
how can id o this?
are you making the plugin
I need to do this because I have an ExecutorService shared by all plugins and I need the plugin that has this instance to shut down after all the others
Are all of the mentioned plugin yours?
yes
maybe do check this in on disable:
https://hub.spigotmc.org/javadocs/spigot/org/bukkit/plugin/PluginManager.html#isPluginEnabled(org.bukkit.plugin.Plugin)
declaration: package: org.bukkit.plugin, interface: PluginManager
plugins do disable in the reverse order in which they enable
is Craftplayer removed? because of i can use it on my plugin idk why
Does anyone know why i need to wrap it in StringValue i've tried doing that and it didnt work or atleast not what i want to happend.
private final BlockyBoxCore plugin;
private final Random random = new Random();
private final MiniMessage miniMessage = MiniMessage.miniMessage();
public MOTDRandomizer(BlockyBoxCore plugin) {
this.plugin = plugin;
}
@EventHandler
public void onping(ServerListPingEvent event){
List<String> motdArray = plugin.getConfig().getStringList("motds");
if (motdArray.isEmpty()) return;
String rawmotd = motdArray.get(random.nextInt(motdArray.size()));
Component motdComponent = miniMessage.deserialize(rawmotd);
event.setMotd(motdComponent);
}
No it is not removed
First off don't use any jar dependencies like that
and split each version in to it's own maven module
For versions 1.17 and above I recommend you follow this:
?nms
For multiple modules you can read this https://blog.jeff-media.com/maven-multi-module-setup-for-supporting-different-nms-versions/
Hi there! Today I’m going to explain how to setup a multi-module project using maven to support different NMS versions. Important notes about this tutorial: Every step will have detailled screenshots using IntelliJ. I explicitly chose not to include everything as copy/pastable source code, but normal screenshots (you can click on them to show ...
mojang mappings are great only for people that don't use reflection
we now suffer of not updated spigot mappings
because a string is required, and you have a component
hello everyone i was wondering if i could get a hand with my coding for mc forge 1.20.1 for some reason my coding is being thrown even tho it all shows to be curract and cant seem to figure out why if someone is down to help id be down to hop into a call i havent modded since 1.12.12 and 1.7.10 virsions of forge so i know some things are differnt i am using intellij witch has always worked for me before when trying to mod past 1.12.2 and i know as far as right now that
IEventBus modEventbus = FMLJavaModLoadingContext.get().getModEventBus();
the .get is massive being thrown witch isnt a problem game still runs but when i go to register my item everything starts to get thrown if i could get a hand that would be awesome i have a lot of items mobs and even entitys that needs to be made and register but if its giving me this much of a problem im not gonna be able to get the items register the way i need dms are open so if you want to dm me thats fine just plz some help would be awesome
Going to need a bit more context than that lol. Usually a pastebin of what's going on
i can send screen shots of the code in the main class and moditems class
can someone help me for compile a plugin cz evrey time. i tried it say pom. xml is worng
show your pom
?paste
I am not sure what code being thrown entails, do you mean it throws exceptions?
being thrown is slange for throwing an error
okay, but what kind of error
an exception, it crashes the game, it is highlighted red in your IDE
yeah even more so after rewatching the video 5 times for 1.20.x when the errors aint being thrown it loads into the game just fine but the item registery keeps refusing to register my items i have screens shots i am able to send but has to be send trough dms
eror addong document
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.owner.plugins</groupId>
<artifactId>MyPlugin</artifactId>
<version>1.0-SNAPSHOT</version>
<name>MyPlugin</name>
<repositories>
<repository>
<id>spigot-repo</id>
<url>https://hub.spigotmc.org/nexus/content/repositories/snapshots/</url>
</repository>
</repositories>
<dependencies>
<dependency>
<groupId>org.spigotmc</groupId>
<artifactId>spigot-api</artifactId>
<version>1.12.2-R0.1-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.1</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
</plugins>
</build>
</project>
this. my pom.xml
it say version is worng
red version
what version is wrong
the maven compiler plugin version or the spigot-api version
also, use a paste service to send long texts like that next time
?paste
ok ill check tomorrow because i I turned off my pc and ill slepp now thank you anyway
?img
Can't send images? That's because you're not verified! Use !verify to complete verification.
Alternatively, you can upload screenshots to any image hosting site and share the link.
Here's some screenshot utilities that you can use to upload images.
Lightshot: https://prnt.sc
Imgur: https://imgur.com/upload
Flameshot: https://flameshot.org
okay ive been verify let me send some screen shots so you can see what im talking about
this is after redoing all of my coding 4 times last night and had the game running and then went to register the item before adding the textures and models the first one is of the moditems class and the second one is the main class
i do still also have all of the original coding up and loaded that has all of the classes textures and models if you would like a screen shot of thoes let me know
Please format your code and don't send it as an image 🙏
And follow naming conventions
Now what you need to do is use the context from the constructor argument rather than getting it like you're doing
okay i see what your saying let me make some changes
I try to add the external jar of spigot to my projects, but my JDE (eclipse) doesn't seem to recgonize it. I can't even use extends JavaPlugin. I am using the shaded snapshot of the spigot file like usual but it isnt working
?bootstrap
Bootstrap Jar
The main spigot-1.18.jar is now a bootstrap jar which contains all libraries. You cannot directly depend on this jar. You should depend on Spigot/Spigot-API/target/spigot-api-1.18-R0.1-SNAPSHOT-shaded.jar, or the entire contents of the bundler directory from your server, or use a dependency manager such as Maven or Gradle to handle this automatically.
Please read the release notes for further information: https://www.spigotmc.org/threads/9-years-of-spigotmc-spigot-bungeecord-1-18-1-18-1-release.534760/#post-4305163
no I am using that, like I said earlier. But it doesnt work still!
its also making this module info class and that wasnt being made before
java 9+ moment
Time to just use maven
can someone please teach me how to use/download it
its something i know exists but can't like wrap my head around
If you're on windows download its zip extract it where you want it installed and then add the path to the bin folder to the path environmental variable
Alternatively you can use Intellij as your IDE it comes with maven preinstalled and it can help you setup Spigot projects with the mc dev plugin
I wouldn't mind explaining cli maven too
ok, but what does it really do? I understand its like a setup but what does that actually mean
Maven is a build tool/system. It helps manage dependencies and other build steps
Making your project more portable
i will right-align 0-indent all of my code and send it as a bmp
like that one weird line in your word document essay that for whatever reason the spaces are larger but the rest don't do that
What is full alignment ever used for
alignment-adjusted space size is my sworn enemy
Is there a way to completely remove the nametag of an npc?
you can mount something to them and it should dissapear
if it is a player npc, if it is just a mob then you can just set custom name visible to false
the other option is to use team options, but that's kind of annoying in its own way
well, I'll be damned then
It’s always visible if you are close and looking at the mob
Making it “visible” just makes it always show when the mob is on screen
well then mounting or team options it is
Yea, it's a player NPC. What do you mean by mounting?
mounting an entity to it
you may use something without a hitbox if it is meant to be clicked, like a display entity or an armor stand with marker option
All right, thank you very much. I'll try something out :)
I think display entities actually don’t hide the name tag
Intentionally
But a marker armorstand or a 0 size interaction entity should work
Alternative use teams
I have never seen a text display overlap with a nametag
though an interaction entity is also a good option, I always forget those exist
You can definitely have a mob with a normal name plus a text display
I'm probably doing something wrong, but unfortunately the nameplate is still there.
private void createNPC(@NonNull LobbyNPC lobbyNPC) {
final NPC npc = NPC.create("", lobbyNPC.armorStandLocation());
npc.setClickHandler(lobbyNPC::interact);
npc.spawn();
ServerPlayer serverPlayer = ((ServerPlayer) npc.getSpawnedNPC());
serverPlayer.setCustomNameVisible(false);
serverPlayer.setCustomName(null);
Location loc = npc.getLocation().clone().add(0, 2.03, 0);
org.bukkit.entity.ArmorStand bukkitStand = (org.bukkit.entity.ArmorStand) loc.getWorld()
.spawnEntity(loc, EntityType.ARMOR_STAND);
bukkitStand.setMarker(true);
bukkitStand.setVisible(false);
bukkitStand.setCustomNameVisible(false);
net.minecraft.world.entity.decoration.ArmorStand nmsStand = ((CraftArmorStand) bukkitStand).getHandle();
ClientboundSetEntityLinkPacket linkPacket = new ClientboundSetEntityLinkPacket(nmsStand, serverPlayer);
ClientboundRemoveEntitiesPacket removePacket = new ClientboundRemoveEntitiesPacket(nmsStand.getId());
for (Player player : Bukkit.getOnlinePlayers()) {
CraftPlayer craftPlayer = (CraftPlayer) player;
craftPlayer.getHandle().connection.send(linkPacket);
craftPlayer.getHandle().connection.send(removePacket);
}
npc.setLookingAtPlayer(lobbyNPC.isLookAtPlayer());
npc.show();
}
oh gosh i hate discord formatting
If anyone could help me out, I have a post on the forums: https://www.spigotmc.org/threads/help-with-nms.693521/
can't you just add the bow attack goal to the zombie
In the post it says that I tried to do this but you can't because the bow attack goal takes an entity that implements IRangedEntity which the zombie class does not. So it draws back the bow and when it tries to shoot it throws an exception trying to cast the zombie and just removes it.
you could use a Drowned which I believe is a ranged entity
Yeah but the point is to have this work for any entity so can't do that
Make your own goal I guess
This is exactly what I am doing, the reason why I am using NMS is to make the entity use the item so that the bow can draw back. There isn't any bukkit API for this.
So I am trying to mimic the NMS class in my custom goal and skip the cast to ranged entity.
you can probably use MobChipLite for it
I am using mob chip lite for creating goals. It is the same issue with mob chip lite, you can't make an entity shoot the bow since mob chip lite just hooks into the vanilla bow shoot goal class.
Paper also has a mob goals API but it is paper only so, yeah
let me check if there's anything special about the bow goal attack goal, perhaps you can just clone that class
I meant to use MobChipLite's API to create the goal, pretty sure they have a goal creation API
Interesting enough I just found that mob chip lite does have a hook to make an entity use the item in its hand which is perfect for me. But I tried calling it on my zombie and it does nothing still.
which method are you talking about exactly?
So either there is something very unique with the bow attack goal class which I am not seeing or I am not calling it properly, I am just calling once after spawning the entity and setting its main hand to a bow
Or were you talking about the NMS method?
no, that was the one
I have the feeling you'll have to create a custom entity to implement the necessary method, but let me check just to be sure
I was planning on doing that but for these zombies I have a unique way I want the arrows to fire so it would make more sense to just create a custom goal rather than making the custom entity. I was thinking it could be some restriction of drawing the bow back in the item use call that is silently failing but this can't be the case because the vanilla bow attack class can be put on the vanilla zombie and it does draw the bow back.
It is very strange because if I call the useItem method from mob chip lite on a skeleton then it will draw the bow back just fine and will get stuck at the max pull back position. But when I do the exact same thing to a zombie that has a bow in its main hand then it does nothing.
@sly topaz Thank you for the help but I just solved it. For some reason you just have to wait 2 ticks after the mob is spawned before you call the use item method. Lol I wasted so much time on this XD
Everything always work after u wait a few ticks totally
Welp, glad you solved it lol
nooo, everything must be done now and instantly
I did it with Teams now, and yea its working :)
if I need each player to have their own scoreboard for stats
and I also need players to only be able to see the nametags of players in their faction
is this possible with teams?
what do you mean by scoreboard for stats? The sidebar display?
if so, yes it should be possible
yes
each player needs to have their own stats on the side bar,
and each faction of players needs to have a team that restricts nametag visibility to just each other
yeah, it should be fine
unless you're like in 1.8 and are using team prefix/name/suffix in order to extend scoreboard line length
it would still be possible, just a bit more annoying
hey i noticed you're able to use 1.21.6 spigot api now
i couldnt figure out how to set the harness for a happy ghast though
API probably isn’t even there
I am trying to remove items from my GUI if a player leaves their items, except if they shift click the item and then close the inventory it dupes the item
public void onCloseRunicTable(InventoryCloseEvent event) {
Inventory inv = event.getInventory();
if(!event.getInventory().getName().equals(TITLE)) return;
Player player = (Player) event.getPlayer();
User user = Server.getUser(player);
ItemStack enchantingItem = inv.getItem(20);
if(enchantingItem != null && enchantingItem.getType() != Material.AIR)
user.addItem(enchantingItem, true);
ItemStack runeItem = inv.getItem(24);
if(runeItem != null && runeItem.getType() != Material.AIR)
user.addItem(runeItem, true);
}```
I wish.. survival
and it's not a ghost item?
the item's client sided so idk if that has an effect on it
but i would try it in case
Thank you!
and even then it shouldn't be a big issue anyways since it is a ghost item and the player won't be able to use it
np!
how tf can you put efficient SQL persistence without sacrificing on performance in OOP without going anemic
i just dont understand how people push rich domain models but still put persistence in service classes
doesnt that still make your code anemic in a sense that you still manually sync persistence between the database
right now i made a service which constructs lazy loaded proxy classes which loads data according to repository class method operation (get, create etc), but i see this approach as brittle one since it only works simple CRUD operations
this just kinda proves that DDD is broken, and doesn't reflect real life apps without ORM.
this just proves that anemic operations are simply better with validator predicate interfaces for validating data instead of making mapping and bashing gc for no reason
I don’t see how having low blood oxygen would help
If I have an economy plugin and I keep the nickname with a uuid, there may be 2 or more identical nicknames with different uuids. How do you solve this? For example, I need to have nickname support for commands like /money pay <nickname> and have it work for offline players. I was thinking about the solution of /money pay <nickname> searching the database for the player with that nickname with the most recent login time if they are not online, that is, it would add a timestamp to the database that was the date of the last login. Is this the best approach?
Don't let two players have the same nickname
or give them another identifier you can use to pay them
impossible on cracked servers
premium player logs in with nickname A. premium player changes nickname to nickname B, cracked player registers account with nickname A and premium player with nickname B has not logged in yet. There will be 2 nicknames with different uuids in my database
?offline
so my idea would be this timestamp thing and it would solve the problem
💀 Offline mode
If you don't like money that's fine, but I do
the more players the better
How many threads are responsible for calling AsyncPlayerPreLoginEvent?
It gets called on the player's thread
which comes from a thread pool that's configured in the server settings iirc
is it safe to check an item's pdc everytime a player drops it?
or can it cause a crash
it's fine
Interviewing Casey Muratori!
Full interview coming soon, please comment down below and i'll release it sooner ;)
https://twitter.com/cmuratori
Recorded live on twitch, GET IN
https://twitch.tv/ThePrimeagen
MY MAIN YT CHANNEL: Has well edited engineering videos
https://youtube.com/ThePrimeagen
Discord
https://discord.gg/ThePrimeagen
i love this
I think they conflate a bit too many things there
clean code doesn't have to have horrible performance
My custom NMS entity causes this very funny connection error. How does one get a EntityDataAccessor or otherwise store a EntityReference<LivingEntity> in nbt without causing this?
most of guys love this just because they dont understand oop concept.
There is a philosophy of abstraction in all basic sciences.
Hey guys, when creating a plugin with a bunch of subcommands, is there a good way to pass the tabComplete functionality down to the individual subcommands?
I have My main executor which contains the "entry point of my sub commands"
So: ```
MyExecutor
- UsersCommands
- UserCmd1
- UserCmd2
- ...
- GroupsCommands
- GroupCmd1
- GroupCmd2
- ...
So in this case my command will be:
`/myCommand <Users|Groups> <cmd>` so each command behaves diffrently and have their own format, some are `<playre_list> add <property_list>`, and other ones are simpler like `<player> delete`, etc...
Currently my main Executor's tabComplete only shows `users` and `groups`, then I want the Users command wrapper to show all possible user commands, same with the Groups wrapper. I found a way to do this but I'm not sure if it's the best approach - is there a standard/better way?
What is your current way.
something like this:
@Override
public List<String> onTabComplete(CommandSender sender, Command command, String label, String[] args) {
List<String> completions = new ArrayList<>();
if (args.length == 0) {
return completions;
}
if (args.length == 1) {
String userCmd = args[0];
for (SubCommand sub : subCommands) {
if (sub.getName().startsWith(userCmd)) {
completions.add(sub.getName());
}
}
return completions;
}
String userCmd = args[0];
for (SubCommand sub : subCommands) {
if (sub.getName().equalsIgnoreCase(userCmd)) {
String[] subArgs = new String[args.length - 1];
System.arraycopy(args, 1, subArgs, 0, args.length - 1);
return sub.onTabComplete(sender, command, label, subArgs);
}
}
return completions;
}```
THis is my tabComplete executor
subCommands is this:
subCommands = List.of(
new HelpCommand(),
new ListCommand(pm),
new UsersCommands(),
new GroupsCommands()
);
```So UsersCommands and GroupCommands are subCommands and Help/List are top level (so u can just do `/mycommand list|help`
seems sensible, but replace that for loop and name equals check with a hashmap.get by name
yeah thats what I had before, i had a map like sub.getName(), sub but i though why not access it just by the sub.getName()
I dont think that time complexity is gonna be a problem since I will always have < 10 items in the list
not for the sake of time complexity, but it will be clearer to read and more concise
mh ok, but other than that its fine to make things like this
because i have the same structure in the sub commands
for example my UsersCommands is:
@Override
public List<String> onTabComplete(CommandSender sender, Command command, String label, String[] args) {
List<String> completions = new ArrayList<>();
if (args.length == 0) {
return completions;
}
if (args.length == 1) {
return Bukkit.getOnlinePlayers().stream().map(p -> p.getName()).toList();
}
for (SubCommand sub : subCommands) {
if (sub.getName().startsWith(args[1])) {
completions.add(sub.getName());
}
}
return completions;
}```
this is as close to the "standard practice" as one gets by implementing commands and tabcomplete from scratch; recursion, command nodes in a tree structure, and oop
U can move the stream to a private function that getPlayerNames
Jkjk
no one says that you shouldnt abstract
people in video state that they shouldnt abstract until they fully have working prototype
as you cant predict proper abstractions you might need until you see whole context and your development time will be greatly reduced
nah casey muratori is very radical on this
"Premature optimization is the root of all evil." - Donald Knuth
this gets overthrown too much in the current context of modern programming. if it was truly the root of evil we wouldnt have react based windows start menu which utilizes 90% cpu usage while opening
the problem is using windows
“The real problem is that programmers have spent far too much time worrying about efficiency in the wrong places and at the wrong times; premature optimization is the root of all evil (or at least most of it) in programming.”
the problem is that programmers dont even care to think about efficiency due to this rule
the only performance-critical code is only %3 of program, you dont have to worry about performance till you make a program.
im not saying it should be very efficient, but sometimes there's blatant performance issues lying around in the code and no one bothers to fix them because muh clean code practices
you shouldnt design your programs like API's, you expose api's for a reason
if i cared about efficiency i wouldnt program in java
and opt in for assembly or c
what
Clean code is a major scam.
However, modular code, while still having abstraction, is literally the best thing ever
some people do so many abstractions in their internal code that it looks as if the program's code itself was designed to be used externally and not its functionality
clean code comes as a bi-product of a well-engineered, highly-modular and scalable system
next topic. how do you guys stored dates in databases? do you use local dates with UTC conversion prior or just store the timezone anyways
The issue isn't premature or not, it's that they don't do any ☠️
i mean from clientside you can also seek for system time's timezone for conversion so what's the point of storing it inside db apart from storing for audits or smth
just an integer timestamp, usually just millis since Jan 1 1970 (normalized to UTC, or any other works I suppose)
Casey has an approach that throws things like tdd,ddd right out the window. Abstraction is needed when you deal with complex domains such as e-commerce, banking, insurance
you cant basically apply that to these domains
i mean his approach
DDD is applicable in all domains though
yes i know
i give it a example
some low-level coders dont know what domain is
im explaining it in this way
well i dont agree on this approach but I agree with him that you should have working prototype first which has little to not abstractions as a checkpoint for refactoring phase first
i mean lower level language devs by saying low-level
fair point
predicting abstractions without having proper working code is very hard unless you've solved similar problem before
thats why we have domain experts
if you dont have any experience about new domain
you have to practice more and try to find best practices
each domain have its best practices
There are 2 main concept in DDD -> Tactical Design and Strategical Design
but isnt that overcomplicating a problem tbh? I mean good architecture is great but the software will never get perfect anyways and as the days gone by it will become dead code anyways so why bother. There's a saying "code duplication is far cheaper than wrong abstractions" which clearly denotes this.
in big domains without DDD, product will be big ball of mud and basically you cant even update it. DDD solves that and seperates contexts(bounded context -> which is we use in real world in microservices).
i'd rather have a huge chunk of functional code which can be refactored into abstractions than having to deal with improper ones in the first place
each update will make it more complex and hard to maintain
bad oop practices is also reason of big ball of mud
but you cant produce pure oop that's inferior
java is not inferior itself as its mix of OOP, procedural and functional paradigms
java is pretty efficient, what are you comparing it to in regards to it being inefficient?
c
in what ?
garbage collection and byte code interpreting slows it down
does it really?
byte code interpretation only happens once
it's very much comparable, sometimes it's faster, sometimes it's slower
that is when the class is loaded
uh
"C is faster" was the case 20 years ago
not strictly once
casey muratori's fans says clbg tests are maded by ignorants
i get this error al the time
Could not find artifact org.spigotmc:spigot🫙remapped-mojang:1.20.1-R0.1-SNAPSHOT in spigot-repo (https://hub.spigotmc.org/nexus/content/repositories/snapshots/)
I forgot the exact names but there were 4 stages
bytecode interpretation was the first stage
I just get shit done, then I care about cleaning it up
the guy which is started this debate against uncle bob
as the code is hotter and hotter it runs in the different areas
he is successfull person but radical af
cool I still don't care
😦
he's not that radical, but this one is:
I support the Free Software Movement, and I support the Second Ammendment. To me, supporting both seems a natural fit. I see a lot of similarities between the kinds of freedoms that both movements are fighting for. Yet, I don't see enough of the "free software" crowd here in the US standing up for gun rights.
WANT TO SUPPORT THE CHANNEL?
...
Everyone worries about performance but few of us have the time to truly understand it. Fortunately, our modern JVMs and CPUs are capable of some amazing performance tricks, but those same tricks only make reasoning about performance that much harder.
In this talk, we'll take a look at some surprising and often unintuitive performance problems a...
recommend watching this
Looks like you forgot to run BuildTools
look how fast that is
anyways, Java has come a long way in terms of efficiency however that is also thanks to hardware becoming efficient too
otherwise if that wasn't the case then yeah Java would probably still be somewhat horrible XD
predicting optimizations without having proper app is also problem in real world. some of domains have thousands of contexts
such as insurance
But then i need to create an lib folder
Depends on this. Like if you know you will need a DB and you know your DB is going to be massive then its not hard to know your DB will need to be optimized to keep up
but sometimes, you don't need to do anything though. Someone waiting a second or two isn't the end of the world either lol
https://www.youtube.com/watch?v=a-U0so9FfqQ good one too
HotSpot promises to do wonders for us by Just-in-Time (JIT) compiling the "right" code for us, but how does it makes those decisions? And, perhaps more importantly, what happens when it's wrong?
In this talk, you'll learn through real code examples just how the JVM decides to compile your code, deoptimize your code, and stop-the-world for a GC....
yeah you are right if you have knowledge about domain you can write optimized code but if you are on new domains this is hard to think because there are no entity to think how to make it optimized.
for example if you have expertise on insurance and zero knowledge on banking
you have no clue about optimization
not entirely true
you have to build your domain knowledge first if you are new on that domain
then you can optimize it
you might not be able to do all the optimizations you might otherwise be able to do because of that, however its just a matter of breaking down what is important and what is not so important
transactions being processed quickly is more important then the app being responsive for example
many developers just think everything is important is all
and try to optimize everything XD
i mean that only 3% of the software is performance critical; trying to optimize the rest is a waste of time
more important is domain knowledge
that is not accurate
if you say so, you don't need domain knowledge to know how to break stuff down to what is or is not important
they used to teach this in school you know
this is Donald Knuth's famous quote
don't care
they are a person I have not once followed or heard about so they must not be a big enough deal
i'll disagree this
sure, software isn't dependent on the domain, it works the same regardless
i wonder what you understand while saying domain
you just mean categories
you are just using domain as a way to use a different word then that, but its just categories or areas of business that is different. They have different needs, before your fancy use of domain this has not been a mystery or something new
we all know that insurance use different parts of a calculator then a banker does, but at the end of the day its still a calculator
hmm then where is the abstraction we made, how we can express our apis behaviors?
was it even needed to begin with?
If you don't want to play it by ear with other employees on the team, it's necessary. there are ubiquotes language in DDD just for this.
not everything needs to talk to each other, IE does the calculator really need to connect to the internet to function? Does it need to communicate with some other apps what would the benefit be if some other app connected to it?
in otherwords, just keep it simple 🙂
so i need all the version on my pc and then it's works
you don't need all the versions? unless you are trying to support them all
