#help-development
1 messages · Page 585 of 1
Wym? im on 1.8 unfortunately so idk if thats a method
I tried just manually setting 0-5 to air and that didnt work either
just go a simple test
nah people are abusing a bug with it
ItemStack stone = new ItemStack(Material.STONE);
for(int index = 0; index < inventory.size(); index++) {
stone.setAmount(index + 1);
inventory.setItem(index, stone);
}
subtract 1 to each slot and find out
that'll tell you what slot is what
ah
Are you sure it's accurate though
the slot in bukkit is not the same slot in the protocol
Yeah... you can look it up
and from here
True but there are like 3 different definitions
Ive tried using InventoryClickEvent and just printing the int slot its in and I get the same results as this
Then yeah you're fine
try delaying a tick
just add it like you would to any itemstack
anything you want
doesn't mean they'll work
Nope still doesnt work with runTaskLater
makes no sense
player.updateInventory maybe



I love myself for bringing md to add this
shnitzel

you can have a list of keywords
and if the first word is in the keywords list
y'know
Stone would be a bit weird
Mhm
Just watch out for some things
Like IRON_INGOT
I’m sure a PR could be made for it
You could make a feature request
Check tool type then split tier xd
:p
:p
create a map in your onEnable and use that
Wha
Why are you casting the entity to fireball
And then later checking if it’s a living entity
It is
it is but you can't just expect it to be a fireball
And then check if that fireball is a living entity
The helmet slot is always 34 on every version? is there a class that universally says the helmet slot? something like... Slot#ARMOR_HELMET?
Yes
you should still make an instanceof check before. Otherwise you will get a ClassCastException every time another entity damaged someone
And you should not blindly cast
?
No
first check then cast
yes
Can't tell you. There is getRawSlot and I'd highly doubt it ever changes but I usually just deal with the latest version so I can't tell you with 100% guarantee
GG GR G yo
sad 😦 Thanks anyway!
being angry intensifies
Mhm
They should find their own target, don't they? Or do they only anger one target at a time?
oh I did not know
I mean he could change their TargetSelectorGoal but that's kinda harsh for someone who's new to coding
Let’s worry about variable names first
i still dont know whats that means
Those are very GG
🤔
Poor did you find a solution to your string problem? As in caching your calculation on startup?
Fair
how is it cursed?
Yeah for new tools you can't really adress it without an update but when did minecraft ever add new tools with different versions (gold, diamond etc.)
1.16 Netherite
Oh, I see
You can workaround that by collecting all tiers
basically getting all pickaxes and taking the part before the _
And then you would register all types of tools (axe, pickaxe, shovel, sword, hoe did I miss any?) and create a
Map<Tier, List<Material>>
Or in reverse for faster lookup.
Material, Tier
you would only hardcode the tools then. As long as they don't add different material shields or any other new tool you are fine
You could also do a cursed workaround for that by checking for things that have tiers.
E.g. going over the material enum and checking if you find anything that ends the same after the _ and starts once with WOODEN_ and once with DIAMOND_, IRON_ etc.
That's a lot more cursed though
welp discord got rid of my underscores
you probably still get the point
yes that would work
the tag
Hey I used to use this chunk of code for setting armorstand packet info, now im getting an error:
https://hastebin.com/share/vazagutiso.csharp
Error:
java.lang.ClassCastException: class net.minecraft.network.syncher.DataWatcher$Item cannot be cast to class net.minecraft.network.syncher.DataWatcher$b (net.minecraft.network.syncher.DataWatcher$Item and net.minecraft.network.syncher.DataWatcher$b are in unnamed module of loader java.net.URLClassLoader @1ed6993a)
at net.minecraft.network.protocol.game.PacketPlayOutEntityMetadata.a(SourceFile:21) ~[spigot-1.20.1-R0.1-SNAPSHOT.jar:3814-Spigot-64b565e-c1279f7]
at net.minecraft.network.protocol.game.PacketPlayOutEntityMetadata.a(SourceFile:41) ~[spigot-1.20.1-R0.1-SNAPSHOT.jar:3814-Spigot-64b565e-c1279f7]
at net.minecraft.network.PacketEncoder.a(SourceFile:45) ~[spigot-1.20.1-R0.1-SNAPSHOT.jar:3814-Spigot-64b565e-c1279f7]
at net.minecraft.network.PacketEncoder.encode(SourceFile:14) ~[spigot-1.20.1-R0.1-SNAPSHOT.jar:3814-Spigot-64b565e-c1279f7]
at io.netty.handler.codec.MessageToByteEncoder.write(MessageToByteEncoder.java:107) ~[netty-codec-4.1.82.Final.jar:4.1.82.Final]
at io.netty.channel.AbstractChannelHandlerContext.invokeWrite0(AbstractChannelHandlerContext.java:717) ~[netty-transport-4.1.82.Final.jar:4.1.82.Final]
at io.netty.channel.AbstractChannelHandlerContext.invokeWrite(AbstractChannelHandlerContext.java:709) ~[netty-transport-4.1.82.Final.jar:4.1.82.Final]
at io.netty.channel.AbstractChannelHandlerContext.write(AbstractChannelHandlerContext.java:792) ~[netty-transport-4.1.82.Final.jar:4.1.82.Final]
at io.netty.channel.AbstractChannelHandlerContext.write(AbstractChannelHandlerContext.java:702) ~[netty-transport-4.1.82.Final.jar:4.1.82.Final]
at io.netty.handler.codec.MessageToByteEncoder.write(MessageToByteEncoder.java:120) ~[netty-codec-4.1.82.Final.jar:4.1.82.Final]
at io.netty.channel.AbstractChannelHandlerContext.invokeWrite0(AbstractChannelHandlerContext.java:717) ~[netty-transport-4.1.82.Final.jar:4.1.82.Final]
at io.netty.channel.AbstractChannelHandlerContext.invokeWrite(AbstractChannelHandlerContext.java:709) ~[netty-transport-4.1.82.Final.jar:4.1.82.Final]
at io.netty.channel.AbstractChannelHandlerContext.write(AbstractChannelHandlerContext.java:792) ~[netty-transport-4.1.82.Final.jar:4.1.82.Final]
at io.netty.channel.AbstractChannelHandlerContext.write(AbstractChannelHandlerContext.java:702) ~[netty-transport-4.1.82.Final.jar:4.1.82.Final]
at io.netty.handler.codec.MessageToMessageEncoder.write(MessageToMessageEncoder.java:113) ~[netty-codec-4.1.82.Final.jar:4.1.82.Final]
at io.netty.channel.AbstractChannelHandlerContext.invokeWrite0(AbstractChannelHandlerContext.java:717) ~[netty-transport-4.1.82.Final.jar:4.1.82.Final]
at io.netty.channel.AbstractChannelHandlerContext.invokeWriteAndFlush(AbstractChannelHandlerContext.java:764) ~[netty-transport-4.1.82.Final.jar:4.1.82.Final]
at io.netty.channel.AbstractChannelHandlerContext.write(AbstractChannelHandlerContext.java:790)
Hastebin is a free web-based pastebin service for storing and sharing text and code snippets with anyone. Get started now.
I had lost my source code so I decompiled one of my jars, I think the decompiler might've put something in the wrong spot
Hi, how can i get the interacted slot from a chiseledBookshelf?
(not the lastInteracted one, the one that is being interacted with?)
I'm spawning in an ArmorStand with the below code but am finding that it can sometimes cause the server to freeze and then crash from a thread death
https://paste.gg/p/anonymous/9b0a8ffb33154a92a2952b924b2eeb76
It spawns an Armour Stand but it starts flickering on the floor in and out of existence while the server is crashing
according to some CraftBukkit PR's it looks like you can get the current slot, with PlayerInteractEvent
There was a method added called getClickedPosition which returns a Vector
This vector you can add to the Chiseled Bookshelf holder to get the slot
https://hub.spigotmc.org/javadocs/spigot/org/bukkit/inventory/ChiseledBookshelfInventory.html
https://hub.spigotmc.org/javadocs/spigot/org/bukkit/block/ChiseledBookshelf.html#getSlot(org.bukkit.util.Vector)
https://hub.spigotmc.org/javadocs/spigot/org/bukkit/event/player/PlayerInteractEvent.html#getClickedPosition()
declaration: package: org.bukkit.inventory, interface: ChiseledBookshelfInventory
declaration: package: org.bukkit.block, interface: ChiseledBookshelf
declaration: package: org.bukkit.event.player, class: PlayerInteractEvent
dude just use remapped
will make your life a million times easier
I am trying to
it turns out the way this packet works was changed "recently" and thats why it doesnt work now..?
Can you explain how I can use it again please..? i used to but forgot how
its been over a year
So once I run java -jar BuildTools.jar --rev 1.20.1 --remapped, how can I redirect Maven to use that jar instead? or will it just know?
read that post i sent you
*its not in my project directory)
they give an example pom.xml
remapped provides packet wrapperes so you don't have to use data watchers and all that
I assumed you knew what it was since you said "you are trying to" use it
Happen to have an example..?
Well, I have used it in the past
just not for this issue
I used it when trying to mess with entity ai
im also using ProtocolLib
assuming you're using 1.20
it shows you all the remapped names for everything
I just see stuff about PackedItems, ClientGamePacketListener..
not seeing how to set these values with/without datawatchers
you can use PacketPlayOutEntityMetadata
in protocol lib it should just be the index
idk the packet name in protocol lib tho
PacketContainer packet = protocolManager.createPacket(PacketType.Play.Server.ENTITY_METADATA);
thats for that part, but as for setting the values...
how do you do it without datawatchers..?
i think ive confused you
yes
if you're using protocol lib you have to use datawatchers
lol
im just saying protocol lib sucks
its abstracted so much to the point where you have to be doing stuff like this
where other methods just have wrapper classes
So how would I spawn an armorstand and set its attributes with just a normal packet in 1.20?
without plib
PacketPlayOutSpawnEntityLiving, PacketPlayOutEntityTeleport, PacketPlayOutEntityMetadata
using nms
NMS is the devil lol
Dont I need to do something special to use default packets..?
they arent showing in intellisense as options
to send it or just use it in general
both
?nms
Im doing that
You can import tho but don't have intellisense?
can you use any nms imports?
If you can import, try to invalidate cache
lientboundSetEntityDataPacket packet = new ClientboundSetEntityDataPacket(ClientboundEntity, )
or do you need to do this instead when using mojang mappings..?
Didnt work
Ah...yep
with mojang mappings you gotta do the above instead.
https://mappings.cephx.dev/1.20.1/net/minecraft/network/protocol/Packet.html Am I looking in the wrong place to find packet examples with mojang mappings..?
version: 1.20.1, hash: 9a317e2fab
(my armorstand entities are spawned with the following), they arent actual entitties they're just packet entities
PacketContainer packet = this.protocolManager.createPacket(PacketType.Play.Server.SPAWN_ENTITY);
packet.getIntegers().write(0, holoIDs.get(curHoloLine));
packet.getUUIDs().write(0, holoUUIDs.get(curHoloLine));
packet.getIntegers().write(1, 1);
packet.getDoubles().write(0, hologram.getLineLocation(curHoloLine).getX());
packet.getDoubles().write(1, hologram.getLineLocation(curHoloLine).getY());
packet.getDoubles().write(2, hologram.getLineLocation(curHoloLine).getZ());
packet.getEntityTypeModifier().write(0, EntityType.ARMOR_STAND);
Is it possible to have a clickable link in a book that is not yet signed?
ClientboundAddEntityPacket spawnPacket = new ClientboundAddEntityPacket((Entity) player.getWorld().spawnEntity(player.getLocation(), EntityType.ARMOR_STAND));
for(Player all : Bukkit.getOnlinePlayers()) {
((CraftPlayer) all).getHandle().connection.send(spawnPacket);
}
Unsure of spawning an ArmorStand packet with this system, then being able to modify it later..?
just use the entity id for the next packet
Can a "fake" entity even have an id?
the entity still exists it just isnt spawned in server side
you can still treat it as a regular entity
Which part of the ClientboundAddEntityPacket even determines the type? it looks like an entity has to already exist to spawn it..? kinda weird
Hey thanks, that really worked 😄
it takes it in the constructor
(int arg0, UUID arg1, double arg2, double arg3, double arg4, float arg5, float arg6, EntityType arg7, int arg8, Vec3 arg9, double arg10)
Hmmm..
doesnt really explain what most of them are..
Like what are you supposed to put for arg0, arg2, arg3..
im guessing position? but it doesnt really say
hmm, ok. https://i.imgur.com/Qm2DF0F.png
there was a resource for it im tryna find it
not sure why it needs an ID and a uuid both
look through the deobfuscated code and see how they convert entity to that in the constructor
and youll figure out what the params are
hmm ok I think I get that part now
but can I just make the ID the same as the UUID..?
weird it needs both
Just generate a random ID for ID then..?
To answer my own question for everyone: No, it is not possible
You sure, if you look at hypixel, you claim your daily reward with a book and link
Go look at the adventure api
It's mainly a paper lirary but does have a way to be implemented into spigot.
iirc you can just put raw json into the book?
How to check for item
could anyone help in this topic https://discord.com/channels/690411863766466590/1122182720659919068
How does it not work? Does it error? Does it not function? Does it turn your players into pig's?
Need a bit more than just "doesn't work"
My brother in christ be patient.
How to check if an InventoryView is opened or closed ?
But why ArrayList<Object>
Was just about to ask this. Tag in lol
Ay you have more experience than me, so..
Too late! Not it 🤣
*I'm about to go into a conference for the UK aerospace so I'm gonna be a bit busy 😅
Oh okay..
is buildtools.jar supposed to give a craftbukkit.jar
Move vanishedPlayers to outside the method, it should be a instance variable instead.
Idk why it is Object instead of UUID xd
this is no longer a book you can write and sign, is it?
my mistake sorry
for signed books, yes. For books that are still writable it is not clickable
why would you need a writable book with clicks tho
I use them to write configuration ingame. And there's also documentation in there.
Would be cool to have clickable links (e.g. to the Material enum)
but guess they'll have to mark and ctrl+c
wait, couldn't you check for a click and use a packet to the open link ui?
open books are entirely clientside
rip that's annoying
idk why it's client-side, if it were server side it would be a lot better
Same with the speed calculations and reach in mc
Basically I wanted the blue part to be clickable but it's fine like that aswell
Can someone help me with ClientboundContainerSetSlotPacket?
if you need input
neither are big enough
What if you wanna add a list of 20 effects here? Or locations?
you can create a button that checks or unchecks the options
Can someone help me with
and then have an integer or float input for the level
Maybe for a future version. That's all part of an engine. The potion effect configuration etc is not part of the engine but of different plugin using the api
hey how do i auto save the built plugin to my server file , i am using intelligi
im using intellij and am new to plugin making
import net.minecraft.server.v1_19_R1.EntityTypes;
gets an error, how to get nms working
create a brach or sh script
you need to use buildtools
i did
I might use extra inventories for enums. But then again there's enums with 1000+ entries (Material). I guess I'll see what user feedback I get
is it in ur m2 repo?
? , I just want to change the folder of my output file
in ur pom.xml I think
more like "super_annoying_guy" than "super_cool_guy" ngl
i had the same question
toxic part of stack overflow
does the buildtools need to be run in the .m2 repository folder?
no
you can run it anywhere you like, except on remote folders like onedrive etc
can i run outside of my computer
@tender shard could you help me a bit in parsing anvil chunk format

i cant find minecraft in the net folder of .m2/repository after running buildtools
What is that
will be something very cool once i get this smoothly workin :p
Ohh oki
https://cdn.discordapp.com/attachments/934216676768096338/1122815743285792840/image.png
Does this mean no nms
What do inventoryMenu.active & inventoryMenu.checkReachable do ?
lemme rephrase it:
what does it mean that an InventoryMenu is active, what does it mean that its reachable ?
@drowsy helm @shadow night I know you two were talking about this yesterday and i just wanted to finally get off my lazy ass and try this xD
I converted most of forge's IEnergyStorage into spigots :p You can create an infinite amount od energy types, similar to how you can create infinite amount of Economys with vault :p
still really proofy of concept but :p
NICE
thats so cool
yes one moment
ill just show you my exmaple plugin for now, i still dont have source on GH
?paste
@tender shard how did the benchmark go?
having energy stuff without mods is really cool
hmm...
If there is a project like that being worked on, Im 100% down
you are in the right place then
we can make a general power lib that many plugins can use
BukkitEnergy (Impl of IEnergyStorage) https://paste.md-5.net/cudejecifi.java - this is made in mind similar to Vault's Economy where all plugins can hook into this class an effortless share energy between plugins
Example plugin from above (I made it one class just for simplicity sakes): https://paste.md-5.net/osiladitec.java - I need to make a Machine impl and this will be 10x shorter but i just got this entire API working, trying to mimic vaults compat feature where every plugin can easily use it
oh yea
wow thats cool
sec im gonna push this to gh
make a mineing drill
maybe that will get integrated into bukkit or spigot once
loool nah
why would they?
why not
if that was the case vault would of been implmeneted long ago
why is my math so god damn cursed
How many plugins have energy lol
cmon
I'm so close
why is it not doing the resolution math right arbitrarily
I can tell it's 2x what it should be, I'm pretty sure
oh actually it's not even mapping all sides correctly that's fantastic
they look like theyre overlapping almost 
it's 2x too large
it definitely looks weird
it's only doing this for multi-textured projects
it's not resolution-specific either
https://github.com/Burchard36/BukkitEnergy
uploaded source code, still needa clean stuff up tho like said only just now got this workin
because that resolution works just fine for other sizes
what energy related classes does forge even have?
forge basically provides energy/fluid interfaces for you to use by default
Anyone knows
- what is inventoryMenu.active and inventoryMenu.checkReachable
- what should i put in the revision/stateId parameter of ClientboundContainerSetSlotPacket ?
- should I put rawSlot or slot in ClientboundContainerSetSlotPacket ?
interesting
doesn't forge energy exist since like 1.12?
yeh thats not much
how is the uv source right for only one coordinate....
it's not even exactly 2x
weird because it looks exactly like 2x hm
ok no I was taking stupid pills it was 2x
minecraft please
is there someone who can teach me how to get nms because im dumb
?nms
much has changed
mappings are your friend
ok
you can do it without any NMS now
Take a look into Noteblocks for the easiest way (and if you do not care about losing note block functionality)
Mushroom blocks are another one but more annoying to work with, as when they break they update all surounding BlockFaces and meh annoying
yeh same i love noteblocks, always works amazingles and no ones gonna be using noteblock banjos 💀
yep unused states (instruments + notes)
you don't need to lose much in noteblock functionality
iirc there's a lot of unused data in there
you can specify a specific texture for each instrument and note
which ones? last time i used it i just used weird instruments no one used
it's been 2 or 3 years since I last checked but I thought you had a lot of usually unreachable states with the noteblocks you could use, if you jammed it just right
never actually used that knowledge though so ymmv
though that might change soon
cant wait till mojang gives us more modding power
How about player heads?
I mean you get a customized block, slightly smaller
ohh
pretty sure you can customize mining speed
yeh just a little trickery with mining fatigue
yall going to be using my amazing custom model api before you know it
olivo has a really good demonstration of it
ngl magma
could it render build-craft style pipes? 
or just tubes
I mean yeah
they're just models
you can render anything that fits the model rules
i have been sad because i was looking at blockbench/mythic mobs for ages thinking it was revolutionizing minecraft but it's just a bunch of texturepacks
😦
I am ironing out the last few bugs
probably release 1 this week
trying to figure out where my scaling math went wrong rn
thats all anything thats custom is
is just resource packs
ehh
yeah most good devs will make it where the resoruce pack gets sent to the client
you can enforce resource packs
me when i touch any kind of math:
plus atm i'm trying to make a plugin that uses armour stands and vanilla blocks to mimic mobs
but if players don't want them then you can't really do much about it, they're literally refusing the content
true
is there anything else you can do to the player if they refuse the rp? like deny them access to a world?
this sucks
resoruce packs arent per world really so no point your better just kicking em off if you wanna force packs
ah dang
looks fine?
the way I got it to work sucks
I don't know why 128x forces me to manually divide by 2
the math isn't right
bet 512 is also busted...
is it ok if the net.minecraft.server part has the [warning] prefix in cmd after buildtools was run
follow the page to the letter and you'll have no warnings
I wonder how much traffic I would need to handle if I allowed people to host their RPs on my hardware
hi , i made a custom gui plugin (Shop for my server..)
and i have problems with potions , enchanted golden apple ..
it does not show slot 1 ,2 ,3 , and slot 34
my plugins resource pack is 190mb so theres that xD
the weird thing is it show the 4th potion , but not the first and second and third .. in the gui ..
and when i did some debugging ..
this is my custom config :p
this is really annoying
what about where the items are being loaded into the gui?
wait a moment ..
how about the config?
config was posted, didn't see anything wrong
i send it
this one
the weird thing is it show the 4th potion but not 1th , second and third ..
item1 and item2 share the same slot?
what that getAllItems() method body?
in your config
its a List of Item [custom Class data for the itemstacks]
There are 2 slot 1 ?
Also is that Item class a bukkit entity or some class you made?
yeah i know it was 1, 2
i changed it to see if something wrong but its stil l same .
maybe slot 0, slot 1?
its likely your getAllItems method doesn't have anything for those slots, hence why its null and continuing on it (as your using item.getSlot() instead of a counter)
oh ok
thats why iwas asking what the method body was and what the Item class was :p
i cant send images i think but it threw an exception
i think i know why .. bcz its the same material , and in maps you can't have duplicate?
ik i tried 0 , 1 first
should this work?
https://paste.md-5.net/usevucical.rb
0, 1, 2, 3
Not sure why you have same slot twice though 😛
why not use Alex's more PDT types lib?
I just need this
I'd debug by seeing if other items work in the first three items as well, if you're still having problems with the first 3 items then you can rule it out of your config and look at your code instead.
close but no
top right, bottom
see a mismatch?
the uv thinks it's 2x larger than the image
imagine not only being a modeler but manually exporting this through your own code
and then getting it to display in mc
ok I have a theory
a game theory
yep
ok so
this is dumb
turns out blockbench has 1 uv size per project
so I could have 17 different textures all of different sizes but blockbench exports them all as if they were of the maximum size
so i need to resize the uv twice, once to adjust it to the size of the image I'm making a uv map for and then to adjust for the size MC expects UVs to be
which is up to 16x16
... I think, maybe I only need to do it once for the project size, gotta test it
Hello, I have a question. How do I make a paginated message ?
i fixed it ..
so the probm with the hashmap , i was setting the material name same for potions , and in hashmap you can't have duplicate keys ..
Anyone knows
- what is inventoryMenu.active and inventoryMenu.checkReachable
- what should i put in the revision/stateId parameter of ClientboundContainerSetSlotPacket ?
- should I put rawSlot or slot in ClientboundContainerSetSlotPacket ?
why are you messing with nms inventories?
Anyone?
tf is a paginated message
With a book o how
TextComponents, I guess.
And also commands 😆
Pretty much
with ACF, if I use the acf-paper & PaperCommandManager, will it still work fine on spigot? i know this isn't the paper server but maybe someone knows
Iirc yes
What is that
the model is for a tower defense game but that doesn't really matter for what I'm doign right now which is the plugin that generates the resource pack and manages the models from blockbench files and files with a custom extension
So cool man
I just have to fix the rotations and figure out why basic towers aren't displaying now
yes
is this the best way I can do it?
ty
Why not container.has
Also please add a nice if (item == null || !item.hasItemMeta) return false;
I'd rather do it like this:
public static int getLevelofMyCustomEnchantment(ItemStack item) {
if(item == null) return 0;
if(itemMeta == null) return 0;
return itemMeta.getPdc().getOrDefault(myKey, PersistentDataType.INTEGER, 0);
}
well but you need the level at some point. and checking if the enchantment exists is simply checking if th elevel is > 0
public static boolean hasMyCustomEnchantment(ItemSTack item) {
return getLevelOfMyCustomEnchantment(item) > 0);
}
looping over the keys is definitely unneccessary
either use has or getOrDefault and check if it's > 0
will do that
Alex were there interesting results on toList vs collector?
So does anyone know how to make a message with pages
TextComponents
@EventHandler
public void onPlayerJoin(PlayerJoinEvent e){
if(HypixelSkillCore.getInstance().getPlayer(e.getPlayer().getUniqueId()) == null){
HypixelSkillCore.getInstance().createPlayer(e.getPlayer().getUniqueId());
e.getPlayer().sendMessage(ChatColor.GREEN + "Welcome To servername! Your SkyblockSkills Account Has Been Created");
}
}```
is it gonna make it so the account is saved inside the actual main class or is it gonna just save the account on a virtual main class on this class?
im not really experienced with oop
The actual main class
is anyone here familiar with a display size trick one could use to make items on an armor stand larger?
Use display entities 
have you noticed how that doesn't even get close to answering my question?
Can you specify what you want to achieve ?
'cause just changing the display size in the item model for the slot you want sounds like a solution but I doubt you'd be asking that
that might be what I'm asking
I just want to make it larger
I know there's a trick somewhere but I have no clue of what it is
mind you it will change it for players as well for said slot
wdym
for example: if you change third person slot main hand
it will be scaled when a player holds it as well, not only armor stand
that's fine they will never be able to get this one
how do you do it?
oh actually I think I might already be using the method you were mentioning
that is the maximum
If you want more then use display entities
I know there's one more trick I can use in armor stands, that's what I'm trying to figure out
Why don't you want display entities
model engine does it and refers to it with
I guess I already did the display sizes but I can only go up to 80
not 112
so I'm trying to squeeze it a bit more
you can scale the model to use the whole 3x3x3 in combination with the display size
that would be the maximum for armor stand ye
hm am I being dumb or something
Well you are just making it harder for yourself
I want this to work on versions that didn't yet have display entities
Then combine multiple armorstands
how am I only getting 80 out of this and not 112
literally.... why
Unless you're making for 1.8.9 or 1.12 (for performance) I see no point in supporting older versions
fileconfig.addDefaults to write in file or?
?configs
See this wiki page on how to use custom configuration files: https://www.spigotmc.org/wiki/config-files/
because people want it
then tell people to use the newer version smh
you guys do whatever you want to do, I don't care to be review bombed with people asking to support more than two minecraft versions
2 right now. it won;t be long before it's 5
anyways, back to this:
Are you using BlockBench ?
If so can you show the model from the view in the program ?
Actually... is there any other program for models nowadays ?
there's nothing magical about the model
it works just fine in model engine and it doesn't work on my plugin because... reasons?
dafrick is model engine
the plugin I'm about to shakedown for their lunch money
I just need to figure out this limit thing and then do some rotation work
huh this is really odd
Sorry, won't be able to help with this one, would have to read thru the model engine and I can't be bothered doing that
what listener is used for checking if an entity damaged the player or vice versa
EntityDamageByEntity
declaration: package: org.bukkit.event.entity, class: EntityDamageByEntityEvent
I think I might be on to the issue
I'm starting to suspect that the model size boundary is not symmetrical
how to check if the damager entity is a player
use instanceof
Hi,
I have used this code : ```public class TNT extends net.minecraft.server.v1_16_R3.EntityTNTPrimed {
public TNT(Location loc) {
super(net.minecraft.server.v1_16_R3.EntityTypes.TNT,
((org.bukkit.craftbukkit.v1_16_R3.CraftWorld) loc.getWorld()).getHandle());
this.setPosition(loc.getX(), loc.getY(), loc.getZ());
this.addScoreboardTag("zombie");
this.setFuseTicks(0);
}
}```
to create a custom explosion in 1.16.4
But today I want to do the same with display entities but I don't know how to do it in 1.20
Can somebody help me ?
yes
alright thanks
ok... yeah I think I might be on to it
yknow minecraft it would be really cool if you told me what the model boundaries are
that way I wouldn't have to just guess
3x3x3 blocks
not quite
blockbench even disallows you to go further if you have the item/block model type
it's not symmetrical into negative values
what ?!
yeah that's the issue I ran into
I think you're doing something wrong tbh
-16 to 32 in all axis I believe
well I can tell you this much, -22 is too much
ye exactly
-16 to 32 sounds possible
that should be the boundry since: block is 16 pixels
and a corner is 0, 0, 0
it is not symmetrical since it is not from "center"
It is just the way it is, you have to work around it
yeah that's basically what I just found out
What exactly do you want to do with display entities ?
The code does not tell us much
could have saved time by reading the wiki lol
I read a bunch of wikis, guess I didn't find the correct page
define "fix"
what is the algorithm that minecraft uses to calculate the damage taken with armour points(when you wear an armour it increases)
I just want to have a display entity that loock like a camera where I can tp a player
which would work but that means model in high negative or positive values won't work
which... I mean is that really a problem in the first place
heeh ?
How is that related to custom explosion
just the way that I implement that in my code
I- I don't think I quite understand but I will try my best
you have to create a custom model for some item (prefferably with custom_model_data) and then set that item to the display entity.
I'm sorry i'm not clear.
I want to have a custom display entity that I can spawn when I want in my code
Ok so.. do you know how to spawn any entity with Spigot ?
Do you already have some code I could work off ?
what word can i use to signify both "enter" and "leave" lol
naming problems
Region???Listener
transit
Yes I know how to spawn an entity, I think the better way to do what i want is to create a class that contains my custom display entity and then spawn it
but idk how to do this
ty that works
RegionEntranceOrLeavingListener
/j
no
ha
At least not in the way you did with this tnt
ok what is your proposition ?
If you want to do this then go to fabric or whatever
'cause then you would not really be using the Spigot API
Which I suppose is why you're here
I guess you could create a method that spawns the entity (tho ppl here will not really like that I bet)
With all the settings you want
declaration: package: org.bukkit, interface: RegionAccessor
yes and ok ty i'll try that, thank for the time you gave me ❤️
Field 'uuidToPlayerMap' may be 'final'
what is final in java?
i get this warning very often
If its for variable, it means it won't be changed
isnt that static?
No
Final can alao be method or class, final method means that it cant be overriden in child class and final class means that class can't be inherited
a static variable is a variable that can be accessed without creating an instance of a class basically
a final variable is a variable that cannot be reassigned
No, when something is static it means it isn't tied to instance, but class itself
oh alright
hmm yes, high quality code
ignoring the look of the code
I guess I can see why you use variable names starting with capital letter but it does not look right
is there something like BungeeCord Build Tools?

bungee is public download
https://github.com/SpigotMC/BungeeCord
oh just now found it :D
I know, I'm already "fixing" everything
My eyes are burning rn because of my code 😂
Everything bad
honestly... ditch optionals
I'm using #orElse instead, with null checking (without nesting)
I guess that's an improvement?
ye that is slightly better I guess
But then the optional is kinda pointless lol
Hi ! I am currently making some plugins and the question came to me: where can I securely hide my database logins ? I know that .jar can be uncompiled and I prefer to have a secure plugin. Any ideas about this ?
Not really, optional still usefull for other implementations
if this is for a private server, there's no way your jar is decompiled unless you give access to somebody
and if you do give access there's almost way to hide info anyway
if it's not a private plugin then why would there be internal login and password data
I'm making a public plugin, trying to make it open source too
Why do you require database credentials in a public plugin?
yeah hiding stuff isnt gonna happen if ur os and public
the db stuff should be supplied by end user
^
I'm doing tests with those but I'm using data stored on database to use it in a website
what
add a line for it in config, add random data that similar to default without it working on a db
anyone knows how to get a TabPlayer from a Player? i want to show a scoreboard (https://github.com/NEZNAMY/TAB/wiki/Feature-guide:-Scoreboard#api) to a player but i do not know where to get a TabPlayer object
i currently see the way of fetching a player at PlayerLoadEvent and mapping them to their UUID for future access (and removing the object from the map when player leaves) but it seems like so much hassle and i was wondering if there was a "proper" way to do it
So full user-providing for the db
Avoid spamming
Create a thread instead
perhaps
?nocode
It’s hard to answer a programming question without code
Oh no! You ran into a problem. But no worries, people are willing to help, but first they need to see your code. This is because otherwise, they would be providing help based on guesses instead of concrete knowledge. Whether it be a compile error, runtime error, or an unexpected output, I'm sure that if you were to provide code, you'd receive a quick solution.
i would have no idea what code to provide tbh
the code for your custom mob?
and perhaps any code that does something with its behavior
zombie:
public class TestZombie extends CustomEntity {
public TestZombie(Location loc) {
super(EntityType.ZOMBIE, loc, "%%COLOR_GREEN%%Test Zombie");
this.setAggressive(true);
}
@Override
public void initItems() {
setItemSlot(EquipmentSlot.HEAD, CraftItemStack.asNMSCopy(new QuacHelmet().getItem()));
}
}
custom entity:
public abstract class CustomEntity extends PathfinderMob {
final Location location;
public CustomEntity(EntityType<? extends PathfinderMob> entityType, Location loc, String displayName) {
super(entityType, ((CraftWorld) loc.getWorld()).getHandle());
location = loc;
this.teleportTo(loc.getX(), loc.getY(), loc.getZ());
this.setCustomNameVisible(true);
this.setCustomName(Component.literal(ColorUtils.translateStringWithColor(displayName)));
initItems();
}
public void initItems() {
}
public final void spawn() {
ServerLevel nmsWorld = ((CraftWorld)location.getWorld()).getHandle();
nmsWorld.addFreshEntity(this);
this.setHealth(this.getMaxHealth());
EntityBase entityBase = EntityBase.getEntityBase(this.getBukkitEntity());
entityBase.updateStats();
}
}
what signifies that it can't die
this, after i restart the server, its still there normal but invincible and cannot be killed using /kill
now stuck with a zombie that cant die
You are probably spawning the entity twice, for each client and for the server. Choose one, not both
Because it exists for the client, but not for the server
I would recommend spawning the entity for the server, and then select the players you don't want to see the entity
And send them the entity destroy packet
how would i
that works
Of course it does, because you are spawning the entity for each client
Spawn it "for the server" and the server will spawn it to each client
After that, if you don't want player X to see or interact at all with that entity that you just "spawned", send player X the entity destroy packet, which constructor should be the entity you've just spawned ID
PacketPlayOutEntityDestroy packetDestroy = new PacketPlayOutEntityDestroy(new int[]{myCustomNMSEntity.getId()});
Not sure if that stills the constructor
But it was smth like that
Then send that packet to player X
currently i want everyone to see the mobs but ig all add a way to remove client entities
I want to create a GUI for my plugin, what would be the simplest way to do that (I want to use some library to make it easier)
worldServer#addEntity. This will add the entity to the server
ServerLevel nmsWorld = ((CraftWorld)location.getWorld()).getHandle();
nmsWorld.addFreshEntity(this);
?
Hello, how can I get the item who was used to place a block ?
Yes (I think)
That adds the entity to the server
After that, you don't need to spawn it for each client
As the server already does that
well i dont do that
but i still get this issue
Then that part of the code is being run twice at some point
I would recommend you to debug
I have looked at SpiGUI but it seems to lack documentation and the dependency doesn't seem to download properly
If you see the debug message twice, then it means that somethnig is being run twice
If you are using an scheduler for spawning the entity, try to make it singleton, or add some kind of validation before spawning
i think i fixed it
had smt to do with my custom stats system
every LivingEntity NEEDS and EntityBase, which creates on entity spawn but i had getType().isAlive() instead of instanceof LivingEntity, it also checks this if it takes damage so if i killed it with /kill it and it didnt have EntityBase it added the EntityBase when it got killed resulting it in having health whilst dead
new issue, it does not attack me
dont i want to automatically target the nearest player? or do i have to put that in a tick function or smt
the docs for PlayerFishEvent are ambigious "Thrown when a player is fishing"
is the event called whenever a player starts fishing
or when they catch something
prob has a variable for it
this makes me 100 times more confused
the method is not annotated with nullable/notnull too
Lets say i want to another variable to the damage event, like a boolean, so if that boolean is true i can change the dmg and whatever, what would be the easiest/best way to do this
damn, sick
Ooooh fancy
Any guide to create tablist on 1.8
Too old! (Click the link to get the exact time)
Does it have a pathfinder
it extends pathfindermob if that helps
If it extends zombie it should inherit it’s pathfinder goals
it does not extend zombie
it only extends my customentity class
which extends pathfindermob
Oh interesting
this is a thing
ChatColor.DARK_AQUA + "" + ChatColor.BOLD
or
ChatColor.BOLD + "" + ChatColor.DARK_AQUA
which one is correct
1st
thx
It doesnt matter
for me bold then color dont work
@drowsy helm do u know anything about this?
can you override registerGoals?
yea
there you go you can pathfind
and just pass it through pdc
of the entity
depends on the context of the boolean
like is the variable based on the entity in the damage event or some outside factor etc
well i have like an ability where i call Entity.damage(dmg, cause)
i want to pass it in there
and be able to access it in the EntityDamageByEntity event
what is the boolean exactly?
i was wondering, why is buildtools so dependent on java version? i tried running bt for 1.12.2 with java 19 but it required java 8. shouldn't it be backwards compatible?
(i need 1.12.2 for a commission)
because yeah unless you make some extended impl of EntityDamageByEntity event then youll have to do some workaround
i wanna pass in if the damage is from an ability or not
so basically "isAbiltiyDamage"
gotcha
i mean you could tag the entity with some abilityDamage flag
then remove it after the event
is that the best way to do it tho
pretty sure its just that versions less than 1.17 literally wont run on post Java 8
so it needs to be compiled in 8
i mean you could just make your own event and do the damage manually
i.e subtract the health manually then call your event
other way around sorry since it's cancellable
ah I see
public class CustomEntityDamageByEntityEvent extends EntityDamageByEntityEvent {
public boolean isAbilityDamage() {
return isAbilityDamage;
}
private final boolean isAbilityDamage;
public CustomEntityDamageByEntityEvent(Entity damager, Entity damagee, DamageCause cause, double damage, boolean isAbilityDamage) {
super(damager, damagee, cause, damage);
this.isAbilityDamage = isAbilityDamage;
}
}
would that work
yeah but you'll still have to call it yourself
then handle the health subtraction
wait no not like that im smart
and how would i add knockback?
it seems like the should be an easier way for this, no?
i mean this isnt that complicated
im pretty sure you can do 0 damage and it will apply knockback and do the hit animation still
why is MapPalette.matchColor() deprecated and still used internally?
is it fine to still use it?
yeah its fine to use
@EventHandler
public void onEntityDamageEntity(EntityDamageByEntityEvent event) {
if(event.getEntity() instanceof LivingEntity livingEntity) {
EntityBase entityBase = EntityBase.getEntityBase(livingEntity);
entityBase.takeCustomDamage(event.getDamager(), event.getEntity(), event.getCause(), event.getDamage(), false);
event.setDamage(0);
}
}
entityBase.takeCustomDamage is literally just a call for the new event
that would right?
this doesnt even need entitydamagebyentityevent, just event
public static void connection() {
String conenctionString = "url";
ServerApi serverApi = ServerApi.builder().version(ServerApiVersion.V1).build();
MongoClientSettings settings = MongoClientSettings.builder()
.applyConnectionString(new ConnectionString(conenctionString))
.serverApi(serverApi)
.build();
try (MongoClient mongoClient = MongoClients.create(settings)) {
MongoDatabase database = mongoClient.getDatabase("Plasmify");
try {
Console.sendConsoleMessage("&aSuccessfull connecting to &2" + database.getName() + " &amongodb database.");
} catch (MongoException me) {
me.printStackTrace();
}
}
}
im getting this error: java.lang.NoClassDefFoundError: com/mongodb/MongoException
ok so the colors of a map in minecraft is limited:
will matchColor return the byte thats already mapped to the closest color in the limited palette?
for example:
Color(1, 1, 1)
will matchColor return the byte of the literal color or first map it to the closest color (0, 0, 0)
in this case and then return the byte?
wait @drowsy helm, the EntityDamageByEntityEvent has a parameter called "DamageCause" which is an enum, couldnt i add custom values to enum to check if its abilityDamage??
are you shading mongo driver?
no
its an enum
shading?
cant be extended unfortunately
why cant u just add custom values to and enum 😩
that wouldve made it SO much easier
it will return the closest to the map pallete colours
are you using maven?
yes
wait is the error during runtime or in your IDE
there is no errors
yes
yes, only that error
yes is that during runtime or in the IDE
runtime
yeah so its a shading issue
so basically java needs to have the library during runtime, shading is just providing the library inside of the jar for java to use
Use libraries feature of plugin.yml
can you provide an example pls?
i always forget that exists
yeah the libraries thing will be far easier than shading
The home of Spigot a high performance, no lag customized CraftBukkit Minecraft server API, and BungeeCord, the cloud server proxy.
libraries:
- org.mongodb:mongo-java-driver:3.12.14
i believe
btw iirc this is broken with kotlin for some reason
player.sendMessage(ChatColor.DARK_AQUA + "" + ChatColor.BOLD + "------------------------");
player.sendMessage(" " + ChatColor.AQUA + "" + ChatColor.BOLD + "SKILL LEVEL UP " + ChatColor.DARK_AQUA + "Woodcutting " + ChatColor.DARK_GRAY + RomanNumber.toRoman(getPlayerAccount(player).getWoodcutting().getLevel() - 1) + ">>" + ChatColor.DARK_AQUA + RomanNumber.toRoman(getPlayerAccount(player).getWoodcutting().getLevel()));
player.sendMessage("");
player.sendMessage(" " + ChatColor.GREEN + "" + ChatColor.BOLD + "REWARDS");
player.sendMessage(" " + ChatColor.DARK_GRAY + "+" + ChatColor.GREEN + getPlayerAccount(player).getWoodcutting().getDamageRewards() + ChatColor.BLACK + " Damage");
player.sendMessage(" " + ChatColor.DARK_GRAY + "+" + ChatColor.GREEN + getPlayerAccount(player).getWoodcutting().getHealthRewards() + ChatColor.RED + " Health");
player.sendMessage(" " + ChatColor.DARK_GRAY + "+" + ChatColor.GREEN + getPlayerAccount(player).getWoodcutting().getDefenseRewards() + ChatColor.AQUA + " Defense");
player.sendMessage(ChatColor.DARK_AQUA + "" + ChatColor.BOLD + "------------------------");
how do i make it so the messages dont come one by one
but maybe i just did it wrong
wdym one by one?
though i use java as well, it's also cool
is it delayed when sending or smth
this is the one?
each message comes seperately
i want them all at once
yeah chuck that in your plugin.yml
like in one line?
no
i dont want a 0.0001s delay between sending messages
hm so MapCanvas.getPixel is also deprecated and I should use MapCanvas.getPixelColor which returns a Color object
instead. So I want to compare a new pixel color Color pixel with the current Color on a specific position on a MapCanvas.
The pixel provided by the user is any Color though and that means I first need to map the provided color to the
MapPalette's limited number of colors and the matchColor method returns byte instead of a Color object.
Do I really need to turn the Color into a byte then back to a Color and then compare with the current Color using getPixelColor?
or is it again fine to use the deprecated methods in MapCanvas which uses bytes instead of Color objects
cache all your variables you will be using in the string to a local variable in the scope
then use that reference
where did you find it
your sendMessages are hanging waiting for the methods to execute
refer to the link i sent earlier, thats just the mongo driver maven address
can't you send one message with multiple lines?
same error 😦
player.sendMessage("""
text
text
""");
@drowsy helm it doesnt work like this since when u melee hit somebody the EntityDamageByEntity gets called right? thats fine, call the custom damage event and it does the knockback and effect, but with custom damage like the ability i have to call the takeCustomDamage function cus else i cannot pass in that it is an ability, so does that mean i have to make the damage effect and knockback myself?
because with yaml iirc you can
message: |-
text
text
call Class.forName(... to load the driver
another option is to move the damage calculation and stuff outside of the event and just put it in a function where i then pass in if its an ability or not
wait thats WAY easier
if you want to use the custom event approach, yes
its the only real way of doing it if you want to pass the variable in the params
the reason i wanted to pass in the isAbilityDamage is so i can calculate the dmg with different stats
but if i just move that into a seperate function
its not needed to pass it in the event
also what is the difference between getPixel and getBasePixel:
getPixel:
Get a pixel from the canvas. If no color is set at the given position for this canvas, then null is returned and the color returned by getBasePixelColor(int, int) is shown on the map.
getBasePixel:
Get a pixel from the layers below this canvas.
what is a pixel from the layers below the canvas?
is there always a default layer?
public void takeDamage(Entity damager, DamageType damageType) {
//Calculate damage;
double finalDamage = 0d;
EntityDamageByEntityEvent event = new EntityDamageByEntityEvent(damager, entity, EntityDamageEvent.DamageCause.CUSTOM, finalDamage);
Bukkit.getPluginManager().callEvent(event);
}
@drowsy helm maybe i need to have installed JDK Development Kit?
you wouldnt be able to compile without jdk
you just need to call Class.forName(... to load the driver you want (so long as it's in yoru plugin.yml)
should be Class.forName("mongodb.jdbc.MongoDriver");
this would be the approach using the deprecated methods
public boolean setPixel(@Nullable Color pixel, int x, int y) {
byte pixelIndex = MapPalette.matchColor(pixel);
byte currentPixel = canvas.getPixel(x, y);
if (pixelIndex == currentPixel) {
return false;
}
canvas.setPixel(x, y, pixelIndex);
return true;
}
and this would be the approach without deprecated methods
public boolean setPixel(@Nullable Color pixel, int x, int y) {
pixel = MapPalette.getColor(MapPalette.matchColor(pixel));
Color currentPixel = canvas.getPixelColor(x, y);
if (pixel.equals(currentPixel)) {
return false;
}
canvas.setPixelColor(x, y, pixel);
return true;
}
the non deprecated method got some kind of double conversion
@umbral pendant
private void scrubSiegeData(DomainInfo domainInfo) {
SiegeDeclaration declaration = this.declarations.remove(domainInfo);
System.gc();
declaration.cancelTask();
System.gc();
SiegeDeclaration.deleteFile(domainInfo);
System.gc();
}
Any way I can improve this method guys???? I'm just kind stumped on how to improve performance here
A joke I hope
call System.gc() some more and i think it should do the trick
you sure??? I was scared I was calling it a tad too much
while true loop with System.gc()
should I run that Async or on main thread
both
thx <3
[...]
There is no guarantee that this effort will recycle any particular number of unused objects, reclaim any particular amount of space, or complete at any particular time, if at all, before the method returns or ever. There is also no guarantee that this effort will determine the change of reachability in any particular number of objects, or that any particular number of Reference objects will be cleared and enqueued.
so what your saying is I need to keep calling it to ensure it eventually works
got it
that paragraph is such a load of nothing lmao
it says that its not guaranteed running the gc at the end
is there ever a legitament reason to ever fucking call System.gc() like why does it exist
there kinda isnt
i could condense that whole hting into like 10 words
"This method may not have any effect"
done
but... how else are the developers suppose to
A) Sound Smart
B) meet the quota for overly long java docs
yea true, way better
I don't have the foggiest clue of how to do rotations with models
ty
just try harder ❤️
Probably for debugging purposes. You can disable automatic gc and do it manually
manually but its not guaranteed 💀
it rotates just fine at 0 0 0 for the origin but the origin scales in crazy ways compared to the raw model probably due to the scaling
ask it nicely
can you change the anchor point?
They can't guarantee there are any objects to clean up
oh smart or you could disable GC and do it manually
(for production purposes)
How are you supposed to beat C and rusts great memory systems
C++ simulator
you know what fuck it just use Unsafe for everything
New spigot fork with automatic gc
no GC needed
Never had a need for them in Java
not that whack ass reference shit
jsut makes some things way more efficient
i thought they were useless until i started using c++ a fair bit
same reason you use them in other langs
idk how I managed to get the lifesteal smp plugin owner to add a way to make it not lifesteal LOL
weirdest sentence alive ngl
Can you give me one
wait a sec. do u still gain a heart if u kill a player?
Objects are already "sent as pointer" in java, so there is no weird shit as copying in cpp for example
And dynamic allocation would make no sense
- can use pass by ref
- more precise memory management for large chunks of data
Java is already effectly passed by reference
.
I'm working on a menu and am currently trying to open a inventory/menupage by clicking an item. However, the new inventory will have invisible items. anyone know what I am doing wrong?
You shouldn't even dynamicly allocate in cpp anymore, one of few reasons I can't think of is if object must outlive current scope
show your code
we cant guess
public class SwitchMenuItem extends MenuItem {
final String destination;
public SwitchMenuItem(final String name, final String destination, final Material type){
super(name, type);
this.destination = destination;
}
@Override
public void onClick(InventoryClickEvent event){
Inventory inv = event.getInventory();
MenuManager manager = DynMarket.getMenuManager();
event.getWhoClicked().closeInventory();
manager.deleteMenu(inv);
if(destination == "Main"){
manager.openMenu(new MarketMenu(), (Player)event.getWhoClicked());
}
manager.openMenu(new CategoryMenu(destination), (Player)event.getWhoClicked());
}
}
this is the item class
pls use code blocks
and when you say "will have invisible items"do you mean some items dont show up?
None of the items will,
the way you worded it sounds like you plan on making items invisible
but I can click on them
https://www.spigotmc.org/threads/a-modern-approach-to-inventory-guis.594005/
I've used this apporach for the menumanger
you should not open a new inventory inside a click event
How should I open a menu inside a menu then?
I always keep in memory until the last possible moment to reduce DB calls. Though in any sense it'd be practical to set it up with a LoadingCache that provides you with an instance of the object regardless. With your cache though make sure you setup a refresh time that saves than loads the data back into the cache.
in short. Use a cache of Caffeine and set it up to refresh and such.
Whoever said java is pass by reference, that’s wrong, java is pass by value and has been that for a long time if not forever, semantically java is pass by value which is different to semantically being able to pass by reference
^
I said effectly
Same reason I added italic for "java is passing pointer", because you don't need to pass pointer or reference to edit actual object like you have to do in cpp
"an extra db call" can stack up when theres alotta players
Essentially its a Map with a shit ton of features. With a loading chache you have a CacheLoader interface you implement that gives you allows you to use your key to create a very basic empty object to be filled with data. It then adds your object to the cache without needs a Map.put call. Essentially with a LoadingCache you never need to add to the cache it'll always be added automatically when you try to get something from the cache, but it'll just return an object every time.
https://www.baeldung.com/java-caching-caffeine
Using caffeine for cacheing has so many other bennefits other than LoadingCaches too
e.g. RemovalListeners, EvictionListeners, Timed removal, Time refreshing etc
Java is really and effectively pass by value
Because by the definition of pass by value you go by semantic language specification
I mean sure implementation wise, java may be pass by reference (picking on ur words a bit now)
thats the same trap that mineplex fell into
yo guys wtf??
I tried adding a config file.
you kinda gotta remind yourself that even if you run it Async DB calls are still an expensive as hell operation. So you should use them sparingly, intelligently, and elegantly
I wouldnt call effectly passed by value if you can mutate object sent into method arguments for example. Also, we were talking about should java have pointers, as you can already mutate object, it makes cpp style send by reference redundant in java
EntityDamageByEntityEvent event = new EntityDamageByEntityEvent(damager, getEntity(), EntityDamageEvent.DamageCause.MAGIC, finalDamage);
Bukkit.getPluginManager().callEvent(event);
Does this just not work? my entities aint taking dmg anymore
this screenshot shows effectively nothing
?pastge
oh my bad
i know its not about plugin development but HOW THE DUCK DO I FIX COULDNT SAVE SETTINGS IN INTELLIJ IDEAAAAAAA
im not saying that method in particular is bad. Just the idea that "one extra db call" is a dangerous train of thought
