#help-development
1 messages ยท Page 2059 of 1
lol
jkjkjk
is this the one am looking for if i want to do something when they touch an item in inventory ?
or this ?
^
oh okay thank you
inventoryMoveItemEvent ?
then how can i cancel players moving items around their inventory ?
is it the same one ?
its just inventoryclickevent
^
and them dropping items with inventory open ?
InventoryClickEvent
yeah but they could still drop by pressing q
if you want to disable that that would be itemdropevent
yeah how to fix that
that also fired inv click
ah thank you
dropping with q ^
Yeah thatโs still a click if an inventory is open
might not have been the exact name
okay thank you
amma try
and see if it works
the actual name is PlayerDropItemEvent
yeah with this one they can still drop using q with inv open
i tried it
ok yeah
playerdropevent is for dropping it from your hotbar
if you're cancelling all inventoryclickevents in the inventory it should stop items dropping in the inventory
yeah
did u cancel the event?
ah wait
i read wrong ingore that
would you use the var UUID to transfer a uuid over files? or just Strings
You want to convert a uuid to something you can store in a file?
^ best way for text files
cheers
?paste
having an extremely weird issue rn
I made a system where you can grab entities and throw them
for some reason, falling blocks seem to change their UUIDs whenever collisions are checked
either that or Bukkit.getEntity doesn't work for falling blocks ๐ค
no views bad
I cant tell if hes meming or not
just use the nms container ID
components bad
It should
dont use components
Falling sand would get considered an entity only for the time its falling
what if I call setGravity(false)
that might be the problem tbh
Should still be an entity
Is there a meta implementation for experience on an experience bottle
Not sure about that method tbf
Isn't there a ExperienceBottle class
Could be wrong
no
you need to use events for that
nms has methods for the itemstack, but seems like no meta for item in bukkit, only event
i don't want an event
Then as illusion said, events
pretty sure experience bottles are entities that drop exp when they "die" aka get thrown
might be wrong
PotionSplashEvent might get called using it, not sure
well, experience bottls are itemstack of Material.EXPERIENCE_BOTTLE that has methods for setExp and getExp.
in nms that is
odd
So why not use NMS to set the exp then?
Mmm stone food info
but that's the only nullable type of data shared across all items
ahh yes some bedrock. that will fill my apetite.
Or at least an issue ticket
oh yeah speaking of that
should i use custom config files for purely internal data storage
I reccomend json for data storage imo
Or sql
:)
Hold up
huh?????
Did you do that without resource packs
You can do that?
no I had to use a resourcepack
that I generated automatically
Dangit
Okay was about to say
but hey I can eat any item in the game
God damn it
and mobs too
Show
I really thought you had found some magical way to make nonedible items edible
I had so many ideas
Still donโt have a nice eating animation for my player heads
I did reimplement all the vanilla features so all of it works
armor, crafting recipes

Can someone pin that cursed video pls
block breaking
Thatโs a lot of effort for a meme
this is what happens when you follow a bunch of separate tutorials for one project ๐
does anyone wanna nag me so that i get better uhh
orthodox coding
The code is kinda funky
.options().copyDefaults()?
I went through all the items in the game and wrote a 100 line method that automatically maps each item to an ID
yikes
then I saved each ID on a yml file so I could parse it on the plugin
saveDefaultConfig()
lmfao
Then I filtered invalid items
People pay for weird things
the yml looks like this
I also had to go through the language files to get the original item names
That requireNonNull isn't needed
You should know if its null or not
yeah ik was just making github commits at first and it sent me warnings so i thought it was necessary to resolve those warnings
and I also made a registry for all blocks each tool can break so I can automatically convert the "fake" tools to the real tools whenever you start breaking a block
bruh
I think that project took me like 3 days to make?
If you want a warning free file, sure go for it but its not necessarily needed
yea
be a chad and share this :D
I mean just look through the game files and do some basic regex
idk i just find the non-scoped unrelated onEnable() bullshit to look weird
the first step is just extracting the resourcepack from the game
second step is opening all the folders
ctrl C + ctrl V is easier tho :(
lol
Is this a question related to some code you wrote?
^
This is for Java development help, try #help-server like illusion said
I wonder
What is the most common usage for packets?
I'm thinking on writing an extensive packet tutorial and kinda need to know what are the most important packets to talk about
Client side entities
I would say particles but that api got added to spigot a while ago
Ah crap I'm having flashbacks
Like Claims plugin
I've made client-side entities
there's sendBlockChange
Oh guess spigot api is evolving then
it took me 10 hours of debugging to figure out why items were floating
it was a client prediction
sendBlockChange is old
true
Tf
Like, 1.8 old
I think the most repetitive code I've made and always hated
was writing a schematic -> clientside block parser
where stairs actually worked
client-side entities are fun because metadata packets are horribly designed
and I crashed my client enough times to know what to avoid
https://www.spigotmc.org/threads/json-configuration-files.212794/
following this guide but it gives me a myriad of errors
do you have a guide that you can recommend?
proprietary
just write your data to a byte[]
You can save and load json against Java classes
then write that into a file
Using serialization
then load it
and instead of having a neat human-readable file
you get an extremely small file that needs a hex editor to debug
lol
At that point why not just use sql
but hey you can turn millions of records into a 20kb file
idfk i'm using this so i can store data for a custom structure i'm making in my plugin
proprietary it is
trying to have a structure that's bound to an entity and stores ids of multiple users
Gson - Object Serialization, Let's serialize a Java object to a Json file and then read that Json file to get the object back. In this example, we've created a Student class. We'll create a
๐
basically the plugin is making a custom entity that can hold multiple players' respawn points
it's less dumb than that
hmm
but that's all you need to know
if you want absolute minimal file size
i'm fine with whatever man i just started writing plugins
Object serialization is as simple as you can get for raw json storage especially if your new to java
๐ tyty
or just do it in YML as like
Tbf json files are already small
<id>:
- id1
- id2
thought about this but seems sketchy
json is just yml but with braces
really?
Json is faster than yaml
and faster to read because the braces are a guide
so it's not uncommon practice to store stuff like this in yml?
No its not
You CAN use yml, but imo you shouldnt
but i still wanna learn json storage
not at all, but more experienced developers tend to avoid it
yeah i figured alr
if you have a big yml file, and it's not being loaded async
your server might take minutes to start
^
By the sounds of hes not storing much data though
yeah
which is why I go proprietary and make a 5kb file containing everyone's ip address and social security number
i should still learn json storage though
i really don't like to do stuff like this non-canonically
So yml would be fine for him, but if your wanting to learn more use json/sql
or traditionally rather
Look into Object serialization i sent, its stupidly simple
sweet
๐คฃ
lol
how'd that message go unnoticed to me
PlayerJoinEvent#getSocialSecurityNumber()
lol
an ip address is 4 bytes
Md_5 get to adding that method pls
it can be represented as an int
Typically with Java plugins theres no real need to shrink things down so far
Enterprise applications; sure yeah
But for player data files I wouldn't see a purpose
Even with 10k players joining if your just storing say stuff for your own vault economy I doubt you'd go over 100mb in storage
I mean even enterprise sometimes uses cheap mock implementations such as just yml flat file to test a few things out
Hell, doubt it would even hit 50mb
Indeed but it wouldn't be pushed to production (i hope)
given an SSN is restricted to 9 digits, and each digit has 10 combinations, I can probably assign a specific bit set and store an entire ssn in about 5 bytes
๐ค
So this is what overthinking looks like
๐
Jkjk
I know of a bank which sadly hasnโt migrated from a binary flat file format system as their persistence implementation, but yeah just hope :3
Please don't tell me it's chase
Sorry to tell you
NOOOO
source: you downloaded it
Lol
I'd only be disgusted if it wasn't compressed
Twitch leaks but instead its chase leaks
Well I heard it from a friendโs dad, who is a Java fundamentalist, not sure if they still use that thing but yeah
im sure they are
"If it aint broke dont fix it"
Lmao ye
cpu usage go brrrrt
Lmao bet
which is why ATMs take forever to read cards
I'm just not sure how i actually implement this ngl
sec
they can't afford the ram to cache the bank details or something
might have an example on one of my projects
oo
Line 36 and 51 you can look into this, and then look into JsonDataFile as its how i store the File object in this project
use transient for variables you dont want written to a JSON object
oh sick
Interesting that you decided to go with a record class
Lol
mixed those 2 classes up
lmfao
JsonDataFile should of been a record
smh
But, dont look at classes, just how the gson is actually used
I do reccomend you look into how all this works though, so you know how to write it yourself without needing an example
yeah
for now i'll just use yml because i already have that in my project and people are waiting on me to release this to a server lol
i hope this is your own server and not someone hired you to do this lol
my own lmao
okay good
yes i'm get paid $800 to do this ๐
brag
would be awkward if you got hired onto a server and said you knew how to do everything and got paid for it lmao
meanwhile, i offer servers free java development and get denied
maybe you need to be better at java
but i feel like its my mess to sort
lol
sorry im working with AE currently so that offers of the table
nice
im only level 3 java rn
you know it
30/50 EXP for level 4
lmao
there is no other way
wait thats just the site to download java LMFAO
dev.java
making my first class boys
ngl, totally forgot how to compile java without gradle/maven by now
I legit don't know what I'm doing wrong
fallingsand just seems to not want to have a UUID
"entity not found"
Does that setGravity turn it back to a solid block?
or still make it so you can pass through it
no
it makes a weird state where removing the block makes a ghost entity
but it's the best I got
and it still has gravity
I just honestly just set a counter-gravity speed every tick
weird, ive never really experimented with this so its odd you cant grab that entity by UUID, maybe @quaint mantle might have an idea about this
ah i see
let's hope this works
should I store a playerlist as a list of UUIDs? ๐ค
And yes
Storing UUID's > Storing Player instances
gucci
best bet is to add debug logs after every line and figure out wheres it stops being an entity at
the entity just decides to not exist on the server
might be a hidden air fallingsand
because mutability
Have you checked if its an entity right after you spawnFallingBlock?
and next tick it just decides it doesnt wanna be an entity anymore?
pretty much yeah
javadocs arent very helpfull on that class either :/
I found this from a little goolge searching: https://www.spigotmc.org/threads/controlable-fallingsand-entity.123114/
This is only for falling sand
but
might be useful
that config setting looks a little fishy to me
hey so am getting this issue
IMO you should be creating a new yml file for each player
๐
instead of one large data file for all players
make the name of the file the players UUID
thought about that, but ultimately decided against it for specific reasons
and store data accordingly
lemme see if i can find my thought process
and this is my code where the line of code with error is
Inventory inventory = Bukkit.createInventory(
null,
45,
"Server Selector:"
);
for (String server : servers.getKeys(true) ){
ConfigurationSection serverSection = servers.getConfigurationSection(server);
Bukkit.getLogger().info("start of section");
Bukkit.getLogger().info(serverSection.toString());
Bukkit.getLogger().info("end of section");
inventory.setItem(serverSection.getInt("position"), getServerItem(server) );
}
return inventory;
}```
@echo basalt doubt this is what's causing your issue, but I do know falling blocks have weird properties with proximity to other blocks that can be fixed by changing a certain field on the falling block entity
let me check real quick
but that's a whole other pain in the ass
idk am confused cuz the serverSection isnt returning null when i log it
sec reading
Ok yeah so each nest is supposed to have a finite amount of members, including a leader.
Time
The number of ticks the entity has existed. If set to 0, the moment it ticks to 1, it will vanish if the block at its location has a different ID than the entity's TileID. If the block at its location has the same ID as its TileID when Time ticks from 0 to 1, the block will instead be deleted, and the entity will continue to fall, having overwritten it. When Time goes above 600, or above 100 while the block is below Y=0, the entity is deleted.
Try modifying the time field, make it a high negative value perhaps
okay thank you
For one your shouldnt be calling ConfigurationSection#toString(), thats kind of pointless
Whats the yaml file look like?
It's resting time value may be 0 which is why it might be fizzling out of existence
I'd try setting it to -32768
i really reccomend seperate files for each player either way
And just like each data file with a next ID
i called that just for log
YAML file:
Servers:
bedwars:
material: 'BED'
position: 234
lore:
- '&cITEM LORE YES'
ehh
structure is not that good
what about it
ok yeah but if i have a new player trying to join a maxed out Nest then it'll be hella difficult to figure out if it's actually maxed out
How are you getting servers
And yes you should store those in likely seperate files in a servers directory
sand seems to actually float now
servers = plugin.getConfig().getConfigurationSection("Servers");```
not at all, you should have a Nest manager, with a HashMap/Map/Whatever of <UUID, NestDataClass> where UUID is the UUID of the Nest, and NestDataClass actually holding that cached data of said Nest
From there NestDataClass will hold a list of UUID's of players as well as variables for max members and any other settings you want
never worked wish hashmaps before but sounds promising
it was just the true thing
Welp
I think I found a horrible solution
spawn the falling block on the player's eye view
then re-assign its uuid whenever it's not matching
just make sure you are calling putIfAbsent when adding to a HashMap, to prevent duplicate entries
feel like it is just simpler to have 1 class for an entire nest though
explain the benefits of doing it this way
Its simpler, but not how you should do data storage
Having alllll your data in one file is just generally bad practice
Imagine a bank, storing every single users data in one file
Im sure you can see the issues that arrise
right
Look at how Essentials stores its users data
and from there, it then stores any information it needs about the user
ohh nooooo my ip address uwu
snappy
because a Nest is a whole structure on its own
has its own properties
Looks ready to release on spigot! 20$
?
maybe I can let you scrutinize over my semi-updated notion page for this specific project
but maybe that's too much
You know
It might be easier to throw that sucker on top of an invisible armor stand
and just move the armor stand around
the armorstand's hitbox doesn't really match
and when you "throw" it, just unalive the armor stand and apply velocity to it
I'm just saying use the armor stand for when it's in gravity gun mode, not in motion
invisible and marker
well, marker is actually all you need
it removes it's hitbox and rendering entirely
I can't say I'm sure how well falling block entities play as passengers though
Thats what the article i linked said :((
:((((((
time to go cry
the fallingblock is detatching
just gonna ignore those buildings are better than anything I could ever even think of building
Ive yet to see one developer who can build a good house besides giz now
I think I just wasted hours on something extremely stupid
It might be that I'm running 2 clicks (1 for each hand) and it breaks stuff
lmao time to ctrl + Z for an hour
imagine it didnt store your undo history far enough
there's a limit
are you saying that as a statement or question
statement
ah xD
oop
it's 2am and I wasted like 2 hours of my life trying to make throwable blocks
any programming after 12am typically doesnt go very well
unless your used to staying up till 5am xD
it got to the point where I'd wake up at 10pm, so I'd be in the depressing late-night coding environment 24/7
huh what the fuck
latest ive woken up is 2pm thankfully
if I don't set a passenger
it works
if I set
it doesn't
well I'm an idiot
trying to teleport entities with passengers
as good as it gets
Just a private smp which I lazily use as a testbed for plugins sometimes
Over 75% of the island is artificial and the basement system spreads like tumors
That looks awesome. There is a newer entity called a Marker, I'm not sure if mounting entities as passengers plays nice with it
I'm using a marker ye
but it uses even less server resources and has no appearance whatsoever
Not a marker armor stand
hm
a completely separate entity called a marker
oh
so you are
weird that the armor stand is showing up for a split second
Wait, is the marker just a variant of an armor stand?
Have I been lied to?
not really
it's kinda a separate entity
but also a metadata of the armorstand
kinda weird
anyways it's like 3am
in that video you posted, were you using an armor stand or a marker at the time?
I'm just trying to wrap my head around why one is visible for a split second
Is there an event for entity generation? Like item frames in the end naturally generating?
damn that sick
You can listen for the ChunkGenerationEvent (Whatever its called) and find the ITEM_FRAME block
if block == that block
Ok cool Iโll check it out
ChunkLoadEvent
check if chunk is new
And then check blocks in ChunkSnapshot (Saves resources) going from highest Y value down (Since end cities always generate in higher elevation rather than lower ones)
@low temple
if the block you run into is endstone, dont keep checking lower y values (save more resources of looping)
be careful with this event
Chunksnapshots are nice because you can check them async
chunk snapshot won't do you too much good I don't think
You're going to want to look for the item frame entity to identify it instead of looking for a specific block arrangement
that's the most performant solution I'd say
Chunk#getEntities perhaps?
Maybe look in to ChunkPopulateEvent and see if item frames on end ships are present on that event
Well iirc it would still trigger some type of block to match a material of ITEM_FRAME from there he can just get the Item Frame meta via getLocationOfBlock or grtLocationOfEntity
Item frame isn't a block
it's an entity
therefore iterating through blocks looking item frame will return nothing
Fair enough, kind of just assumed it would trigger some type of material match in there
It could trigger EntitySpawnEvent but not sure
And check if the spawn reason was of a natural cause
it's worth a try, but with entities that are already present in the world, it tends to be a little weird
I don't think I had much luck with that last time I attempted but I may very well be wrong
If a entity is already present in the world, i would hope it wouldn't call EntitySpawnEvent again ๐
If so thats definatly a bug
well he's looking for entity generation, an event to get entities that spawn alongside chunks
but idk how spigot works with that lol
I imagine chunkpopulateevent will do but who knows
spigot is spigot
Yep EntitySpawnEvent/CreatureSpawnEvent won't work
Chunk_gen deprecated big sad
ChunkPopulateEvent it is
@low temple ^
Read up a lil bit
Will do thanks
how can I check if two players are the same?
With .equals or ==?
ok thanks, I think == is enough bc Player has no own implementation of .equals I think
well... I usually used getUniqueId for this
I don't think that == will work here
yea thats much safer
just check uuids
yea ty
Tried both this and ChunkLoadEvent and event.getChunk().getEntities() is always empty
event.getChunk().getEntities().length always returns 0
Entities are loaded after the chunks
They have their own load event
declaration: package: org.bukkit.event.world, class: EntitiesLoadEvent
Ah okay
how would i check if an offline player has a permission
Vault has an API for that
the method that asks for an offlineplayer also asks for a world
can i put * for the world?
A world or a world name?
How can I prevent player in spectator gamemode entering mob view?
maybe PlayerInteractAtEntityEvent
is it possible to add libraries to the library loader on runtime
I think it would work.
If your store a player in cache, you can use ==:
- If you check the player 1 and the player 2, both players have a different instance and so a different location in memory
- if you check player 1 and player 1, that's the same instance and so the same location in memory.
I think you should use == btw, because you don't have to get the player UUID and your code will be faster. (Mainly if it's often called)
It has
It checks for the unique id and the entity id
Ah, so it's just safer
really didnt saw it and already did it with UniqueID
Doesnt matter
can you apply a @SuppressWarnings to your whole project?
oh wait can i add a compiler flag for that
You can do it yourself with a custom classloader
i lowkey just yoinked the libraryloader class and changed it up
xd
Beware of player relogs
How can I set the bottom right item in an player inventory?
I found out that PlayerInteractEvent and PlayerTeleportEvent being called, but I've tried to cancelling it and the entering mob view still happen.
hm let me check
if you mean the last hotbar slot, use slot index 8
and use that with ```java
player.getInventory().setItem(index /* 8 in this case */, item)
thanks
did you try cancelling PlayerInteractAtEntityEvent or only PlayerInteractEntityEvent?
is setItem() only for hotbar?
Yes, even tho those event are not being called at all.
but then index 8 should be wrong
oh
so it would be 35
well then 35
yea thats what I thought
bruh then idk how to cancel that
Ok and how can I check at an event that it is this particular item and not the vanilla version. For example, I give the player a stick while joining, how can I check that it is also this stick and not a vanilla. With ItemMeta?
There are different ways, either checking the ItemStack similiarity or by storing PDC inside the item, but yes mostly by ItemMeta.
ok thanks, how can I use pdc?
?pdc
ty
@maiden thicket @quiet ice i have 80% certainty the library loader doesnt not violate mvn central ToS
Wdym by library loader?
the one in spigot for plugins
Best api implemented in spigot ever right here^
the libraries: [] u specify in plugin.yml
it uses eclipse aether to traverse repos and resolve deps which if maven didnt like, im sure they wouldve contact eclipse over
No that shouldnt violate anything on maven as long as you arent shipping any additional jars in it that shouldnt be allow (IE, premium resources, things like the MC server jar)
If that wasnt allowed, you basically wouldnt be allowed to have an ClassLoader classes in your project
and the actual terms for maven central (https://repo1.maven.org/terms.html) just kinda say "dont mass-download"
i wonder what they consider mass downloading
Attempting to download all or large portions of Central (a.k.a., scraping or mirroring any content) Excessive consumption of artifacts or metadata Excessive requests or bandwidth
And you dont do any of that?
not personally, no
So then you should be fine
I want to have a custom texture on my custom item, how can I do this?
CustomModelData
resourcepack
what arguments to pass in custommodeldata?
which is the correct event for player right click?
can you give me a example?
there is a guide for this on spigot
PlayerInteractEvent, make sure on 1.9+ your listening for the correct hand
and check if ClickAction is RIGHT_CLICK
ok ty
ok
^
theres a video tutorial somewhere i used a few years back but dont remembe the exact video
resourcepack still needed tho
yep
no serverside only way here
well, it technically could be server sided if you set the resource pack in server.properties
Or send the resource pack to the client via code
ok tysm
yea but thr client still has to do smth
server sided in the sense that the player doesnt need to manually download anything
now for armor models though
that needs to be done on the client side, as you need optifine to render those in
but if i give my custom item model data 12345, then how do I define this in the resource pack?
^
what is the best way to store information for each player, that will not reset
making a .txt or yml file for each player imo
depends on what information and how much information it is
if its for a very small server storing it in the config file is viable too
Hey so, if i make a custom entity by extending lets say the zombie class, i assume it wont be custom upon restart, how would i handle restarts with custom entities?
On chunk unload remove and save your entities somewhere. On chunk load spawn them again
That's the easiest way
ahh
alright thanks, thats what came to my mind aswell, but maybe there was another way. guess not
thanks!
There are other ways it's just that they are harder to implement
Anyways you can use pdc to store your entities
?pdc
pdc
if its too big
a yml file for each player
bad suggestion
you would need to parse the text file yourself
its easy if you know what youre doing
and as I said, depends on what data you want to store
if you wanna store something like a set of strings or ints you could just write them all with a / in between and then get the string and split it up at the /
how do I use apply custom texture to my custom item using customDataModel?
:dynoError: The Fun module is disabled in this server.
hey
no
dont
thats the worst advice
youre reinventing the wheel
- its not gonna be as good as whats included with spigot
txt for key value data storing is shit
dont follow that advice
anyone?
Well you need a resource pack that matches the material and custom data model
And then you can just just that number on an items item meta
@modern valley did you not see this msg?
I saw this message but this article uses a vanilla item, I am talking about custom items
yes
ohh
This is help for Java related questions
Ask about textures in theyre discord
why? I am making the plugin for myself. Is there a plugin customItems?
can setLore and getLore be done async or its just not thread safe
You said Yes here...
oh, I didn't knew that there is a plugin like this.
So what do you mean by CustomItem, do you have a class named this that builds it to a ItemStack?
yes
So that article will work fine
I did everything but it didn't work
CustomItems are vanilla items just with spedical PDT/NBT tags that make them function as other things, and have theyre MetaData changed to have a different CustomModelData
So that article should work just fine and just use getMetaData().setCustomModelData(int)
ohk tysm ๐
In the json file of resource pack, do I have to use the ItemStack name or the set display name of the item?
So here's a puzzle
I have several marker armorstands
Which use nametags to form a image
How would I verify and do something if the player is looking at those nametags
My first though was a custom AABB, but how would one consistently raycast for a hit to those without murdering the tickrate
can you even hit them when they are marker?
No, hence why I'd need some sort of custom collision
The idea is to raycast to the custom colission on left/right click and process from there
Ray hitbox intersection is relatively cheap iirc
You can also do some very basic range check using distanceSquared
Iirc the spigot BB has a raytrace method already
Like, your raytrace becomes cheap because you don't actually have to run an in world raytrace that includes blocks and entities etc until your initial plain ray from player head only against your inflated BB of the armourstand group lands
(if you even need an in world ray)
Hey, what version was this method deprecated in would anyone know by chance?
ah in 1.13, nvm
What software do you think I should use on a 1.16.5 server?
why are you still on 1.16.5?
that version is over a year old
inside a hub server
just use paper
Is there a way to get the width of a nametag in world coordinates?
wdym? the width of the item itsef? or the width of the hologram?
but I can't find 1.16.5 papaer software
of course not, that version is outdated and unsupported
The width of the hologram
you can't, it's client sided. depending on the client's font, the hologram could be tiny, or very large
We're assuming default resourcepack here
burda ne yapmam gerekiyor? buldumda?
no hablo turkish
what should i do here? when i found it?
download the version you've been looking for
thank you bro, have a good day
thanks, you too!
I just got sent this log:
[14:31:39] [Server thread/INFO]: [AngelChest] [DEBUG] * PLAYER INVENTORY CONTENTS END
[14:31:39] [Server thread/INFO]: [AngelChest] [DEBUG] *********************************
[14:31:39] [Server thread/ERROR]: Could not pass event PlayerDeathEvent to AngelChest v7.3.0
java.lang.NullPointerException: null
[14:31:39] [Server thread/INFO]: GaetanoXD fell out of the world
[14:31:39] [Server thread/INFO]: [GaetanoXD: Killed GaetanoXD]
does someone know why the full error message isn't shown?
they use pufferfish as server software
does anyone know if there's some setting that suppresses the full stacktrace?
hmm
you might wanna ask them
they have a discord.
on their github
they do also have this on their github Sentry Integration Easily track all errors coming from your server in excruciating detail
tho idk what that means.
hmmm
Is Location#equals() the recommended way to compare Locations?
yea. that should be fine
but depending on your needs it might be different what u want.
because that will test an exact match. while you might want to test wether or not its the same block location.
hi, i have problem with Tntprimed because it doesnt destroy obsidian
code;
TNTPrimed tntPrimed = player.getWorld().spawn(
new Location(player.getWorld(), location.getX(), location.getY() + 1, location.getZ()), TNTPrimed.class);
tntPrimed.setVelocity(location.getDirection().multiply(ConfigLoader.velocity));
tntPrimed.setFuseTicks(ConfigLoader.fuseTick);
Tnt doesn't break obsidian?
yes
no
Yes
tnt destroys obsidian
wait, i must check it XD
Ya can't
You'd have to manually try to find obsidian blocks when the entity explode event triggers
Nah, this isn't worth it
so its pretty weird on the wiki obsidian's blast resistance is set to 1200
as opposed to the 3.6 million from something like barrier.
no it doesn't lol
I'm an idiot and I thought it destroys
yea thing is my shitty school only has delphi courses and i had to learn java from w3schools and google
yea
RIP
shit school in a shit country
delphi was already dead when I started coding like 20 years ago lol
yep
if u want it to. ur going to need to manually find the blocks and destroy them if they are in the blast radius.
welp its the 92% of south africans that were retarted enough to switch from java to delphi
"and that's a dick too much fucking"
Cool
@quaint mantle where do u live btw
Is there a non-axis aligned bounding box in bukkit?
Guess I'll have to make my own then
hello, im currently looking for a way to set my players in spectator for a specific amount of time and then back to survival when the times up after death, ideally only for one of the worlds tho, i couldn't find any plugin that would fit my need? do you guys know a plugin that can help me with that?
Is there a way to check if a player is holding a item with a specific custom name?
you can always get the item the player holds in his hand/s
And detect if he is not holding anymore?
๐ฟ๐ฆ
i was also thinking someone would like to code that?
Via inventory I guess?
vice versa
vice versa?
declaration: package: org.bukkit.inventory, interface: PlayerInventory
Thanks
I have that code:
@EventHandler
public void InventoryClick(InventoryClickEvent e){
Player p = (Player) e.getWhoClicked();
if (e.getView().getTitle().equals(p.getInventory().getItemInMainHand().getItemMeta().getDisplayName())){
String name = p.getInventory().getItemInMainHand().getItemMeta().getDisplayName();
switch (e.getCurrentItem().getType()){
case GRASS_BLOCK:
plugin.getConfig().set(name+".spawn", p.getLocation());
p.sendMessage("Ai setat spawn");
plugin.saveConfig();
break;```
and I get an error: ``Caused by: java.lang.NullPointerException: Cannot invoke "org.bukkit.inventory.ItemStack.getType()" because the return value of "org.bukkit.event.inventory.InventoryClickEvent.getCurrentItem()" is null``. Why?
probably clicked an empty slot
not
because e.getCurrentItem() is null
why
use the deprecated way
iknow
doesn't Bukkit#getOfflinePlayer already does that?
but that's deprecated
so just getofflineplayer
yes
i mean
condition check it vs null
well
it wont be null iirc
hasplayedbefore
is a member of offlineplayer tho
then ill use that
i mean who targets players by their uuid?
makes sense server internally, but not for a user
Hi! Am I able to persist NBT data for item placed into armorstand? (head)
I have custom PLAYER_HEAD with custom NBT data, but they get lost when I put head into armorstand
but
if the player hasnt logged in before
it will send a request to mojang servers
wont it
well
only getOfflinePlayer(name) does a web request
and also only if the player never joined before
so yeah better loop over Bukkit.getOfflinePlayers
getOfflinePlayer(String) should ONLY be used if you are sure the player joined before
unless you have a user which has 20k accounts, which is a pain.
tried to reverse the code ive been given before
this loops the array and returns the first result if there is one?
Arrays.stream(Bukkit.getOfflinePlayers()).map(OfflinePlayer::getUniqueId).findFirst();
returning the first uuid instance?
yea
how do i safely check this for being null
Optional<Player> pTemp = Arrays.stream(Bukkit.getOfflinePlayers()).map(OfflinePlayer::getPlayer).findFirst();
wdym safely check
Optional is supposed to be safe
whatchu wanna do
i wanna get a player like this
public static Player getPlayer(String player)
{
Player p = Bukkit.getPlayer(player);
if (p == null)
{
Optional<Player> pTemp = Arrays.stream(Bukkit.getOfflinePlayers()).map(OfflinePlayer::getPlayer).findFirst();
if (pTemp.get != null)
{
}
}
}
if you intend to do sth directly after, you can do ifPresent(Consumer<OfflinePlayer>)
If you intend to pass on a nullable
?pastebin
you can do orElse(null)
i wanna get a player regardless of if hes online or not, as long as he has been playing before
and write myself a standardtized method for it
which is not deprecated
like I said, Optional is meant for null safety
https://paste.md-5.net/rijiwipimi.cs
doing yaml shit for the first time, is there something i'm doing horribly wrong yet?
it still threw a nullptr expection
read what I wrote
many things
if i were you i would just use a normal for loop. as that would be more performant in this case.
- fields should have lowerCaseNames
- methods should also have lowerCaseNames
also why are you setting only default values in a method that clearly is not supposed to only set default values? what is that code supposed to do at all?
I love that emoji lol
by stop calling addDefault(...)
hm
I don't understand the purpose of that whole class in the first place tbh
isnt there an indexed way to do it?
like if i iterate too many players it can get laggy doesnt it?
How can I make an NPC spawn naturally and rarely in the world, like zombies but only once (they can't respawn in the biome, or 100 block radius) and I want them to spawn in a group of 4-5
tryna store a "nest" which has certain properties in a yaml file
your current way it always loops all entries then picks the first one it finds. while with a normal loop you can break the loop as soon as you find one.
No
if you want to store something, why do you only add default values and not the actual values?
.
for (OfflinePlayer p : Bukkit.getOfflinePlayers()) i guess
how do i do that ๐ญ
set(name,value)
๐
instead of addDefault(name, value)
do you mind explaining your statment
Is there a 1.16.5 bungeecord, I couldn't find it, could you please post it?
also, if you scroll down you'll find the method that idk how to do at all
I believe the idea of stream is lazy evaluation, unless I'm confusing myself with sth else
how do you iterate through entries of nests?
that's true