#help-development
1 messages · Page 1113 of 1
Every time you create a new instance of SkyPVPHandler
since that's when the constructor is called
i will create it once only
in the main class for example
and then i use lombok to get ann instance of it
Seems to still happen on latest
you can just inline new UserSessionHandlers
nice chunks
idfk why they so buggy but istg im sending the entire chunk. 24 sections.
I also just tried to verify this by adjusting the code formatting similar to your example earlier and it definitely is just returning a null profile
Send your current code
that's cool
That is mind boggling
public @Nullable String getTextureValue(@NotNull ItemStack itemStack) {
if (!itemStack.hasItemMeta()) {
return null;
}
if (!(itemStack.getItemMeta() instanceof SkullMeta skullMeta)) {
return null;
}
PlayerProfile ownerProfile = skullMeta.getOwnerProfile();
if (ownerProfile == null) {
return null; // Currently is returning null here
}
URL skinUrl = skullMeta.getOwnerProfile().getTextures().getSkin();
return skinUrl != null ? getBase64FromUrl(skinUrl) : null;
}
just messing around with chunk data
At that point the bandwidth is probably your bottleneck
i was thinking about streaming youtube videos and shit but i think the client cant handle it :<
Reminds me of that trippy game where by moving the camera you'd be mutating the world around you
Sadly I forgot the name of it
Wow that looks like it should work once you're passing a skull
are you talking about that 4d minecraft game?
Unlikely. It's rather unknown actually and has some extremely nauseating graphics
It worked by warping the same image to some kind of fractal? It's been a while though
The only thing that I noticed that I thought could potentially be of interest was that the log shows a "name=" value with nothing more about midway through, idk if that is of any importance though
ItemStack{PLAYER_HEAD x 1, SKULL_META:{meta-type=SKULL, display-name={"text":"Monitor","italic":false,"underlined":true,"color":"gold","bold":true}, lore=[{"text":"Custom Head ID: 100670","italic":false,"color":"gray"}, {"text":"www.minecraft-heads.com","italic":false,"color":"blue"}], skull-owner=CraftPlayerProfile [uniqueId=99da7d1a-4167-437c-93c6-fc85a8305b51, name=, properties={textures=[{name=textures, value=eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvOTUyNDVjMGQwOGQ2YTk3ZGM5MWY4Nzg0NTY1NTQ1MTRlY2NhOTQ4ZGIxMGYyYzk0NzE4MGMxMzM1NTQ4NjI5In19fQ==, signature=null}]}]}}
I don't think it should be
can you help me with my plugin for my server i would credit you as a dev and add you if you want
ImIllusion is known to work for exposure
Here's what you should try @scarlet gate ,create a skull with a texture and then just see if you can read the texture from it
damn imbroke
get better at coding then
It only takes like a year to get decent at it
Currently I am only trying to get skulls with textures from minecraft-heads, should I just give myself a random head from elsewhere or do you have something in mind?
private static void applyTexture1_18(SkullMeta meta, String url) {
PlayerProfile playerProfile = Bukkit.createPlayerProfile(UUID.randomUUID());
try {
playerProfile.getTextures().setSkin(url == null ? null : URI.create(url).toURL());
meta.setOwnerProfile(playerProfile);
} catch (Exception e) {
e.printStackTrace();
}
}
With the amount of stuff you can do after that, it's quite the deal.
Just create a skull like this and then try to get the url from it right away
But at the same time you'll be selling your soul to the devil
Don't give the item or anything
Sure
Is there any reasonable way to get all the loaded spawn chunks on plugin startup
would it be a safe assumption to loop through all loaded chunks?
Bukkit.getWorlds().forEach(world -> {
for(Chunk chunk : world.getLoadedChunks()) {
}
});
That should do it
alright thanks wasn't sure if that was a fairly safe assumption
If your plugin enables on STARTUP instead of POSTWORLD then you will catch all chunks in the ChunkLoadEvent and WorldLoadEvent
I depend on plugins that load POSTWORLD so its probably just smarter to capture and do the loop
Yap. Honestly, i think JavaPlugin should have onLoad() onStartup() onPostWorld() methods instead. Depending on POSTWORLD plugins as a STARTUP plugin is impossible and cumbersome to workaround.
probably. Maybe one day I'll get around to the plugin loader
Hey, how to do that if a player fishes another player, the second player cannot use elytre while being on the fishing rod,
the problem is that i dont see a way to detect where a player stops fishing another player
I would assume that the PlayerFishEvent has you covered
Test the ProjectileHitEvent as well since FishHook seems to be an instance of Projectile
No I'm not
Dont lie, you always code plugins for free and only care for exposure because you are rich and dont need any money. Just fame.
i mean when player for example changes slot so the fishing line stops fishing, it doesnt detect it
Damn you caught me
I'm batman
xdd
Hm, did you check if the FishHook is mounted on the player?
First check the ProjectileHitEvent and EntityRemoveEvent
Those should both be fired for the FishHook when it hits -> put it in a Map<UUID, UUID>
When it is despawned -> remove from the Map
so.. how do i check if its despawned? when?
and probably Map<UUID, Set<UUID>>
how to listen to when player opens inventory?... but... InventoryOpenEvent only check for like opening chests or something but not opening their own inventory
The player inventory is assumed to always be open
@pure dagger so there's no way to tell
oh..
so... like, i need to make cooldowns and i would like to set item lore to the cooldown, i could like check every second and change lores, but its too lagy i guess, so i wanted to update them only when the inventories are actually opened
what should i do? im sure its common problem
most people update it every second or something
why is it laggy
maybe you did it wrong
no, my friend just told me it shouldnt be done this way
well then how should it be done
i didnt do it yet
like what does your friend say how you should do it
Is it cooldown per item?
umm he talked about inventory open or something but he isnt really sure i see, he said he hasnt been doing minecraft plugins for 5 years
what do you mean?
its either per item or for a certain material or whatever
like what is the cooldown like
if its for a material you can use the api to set a vanilla cooldown on that item type
umm its for items with specific namespacedkey
i know.. i tried to do it but yeah, its for entire material
what does player cooldown or item cooldown mean
is the cooldown for the player that uses it
yeah
or does the item itself have a cooldown
and you already have the part that sets the cooldown for the player?
and do you also already have a way to get what items the players have that need to be updated?
You can show it on use
yeah thats I do too
I just have a message in chat when you use an item that has a cooldown still
i dont get that sentence
I guess not
items with cooldowns have namespacedkey
and my idea was to check every second every item in every players inventory
and update it
to
player's cooldown on this item
??? what
But you can just check cooldown players and find the item and update it
OR keep track of the inv slot
And update that single item
but when they need to see? open invntory and
see
in lore
you mean check every player that has cooldown? instead of all players
how do you store the items that have a cooldown for a player
aaaa
its like
i didnt know how to do that but i made a hashMap for each item
and it has UUID and Long
and how do you add and remove stuff from it
like what if the player puts the item away or whatever
well if it was for individual items you can just keep track of them and pdate the cooldown
but I see what you mean now
but what should the cooldown say if its in a chest
lets say there is cooldown for eating carrots,
when a player eats a carrot i add the player to a map, and the current time, when he wants to eat carrot again i check if the needed cooldown has passed
it will say cooldown of the last person thath put it
there
yeah it wouldnt be perfect
but idk what to do
maybe just give up
I reckon it's something to do with this, I tried with a different head that does work and compared the content and the only obvious difference was the lack of the name
This is a working head:
ItemStack{PLAYER_HEAD x 1, SKULL_META:{meta-type=SKULL, display-name={"text":"","extra":[{"text":"Active Grass Cube","obfuscated":false,"italic":false,"underlined":false,"strikethrough":false,"color":"blue","bold":false}]}, skull-owner=CraftPlayerProfile [uniqueId=04049c90-d3e9-4621-9caf-0000aaa42450, name=HeadDatabase, properties={textures=[{name=textures, value=eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvMTgxOGFiZjRiNzUzMjFkMjJmNWY5ZDI4YzAzMzhlMDM2ZjQxNDBhYzQzMzQwYjk4OTM2N2MxNWNmZjYzOTA3MyJ9fX0=, signature=null}]}]}}
but like you would have to remove the cooldown for it I guess..
but its hard to just update all items correctly because the lore on an item changes for everyone that sees the item
can i just do it every sec?
and stuff like chat messages only appear for a certain player
yeah sure
just try it
This did work perfectly fine by the way
check all the open inventories
or player inventories I mean
and then update the items
oh, i can also check opened inventories
like a player opens a chest
and it after max 1 sec updates correctly
and ofc the first thing you want to check for each item is if any player has tracked cooldowns for it in the first place
and it wont be too laggy because there is not many opened inventories
no i cant
there can be 2 players opening the same chest
yeah
i think maybee.. give up with this thing in lore?
you reset items that are in chests
or just hide the cooldown
like remove th cooldown from lore
and when the item gets pulled into a player inv it would appear for that player
players cant normally see each other's inventory slots
you would use inventory click and drag events
cool
Like you were able to get the url from this meta?
I was able to get the profile
idk what to do ;c
i think ill just do that when player tries to use an item that he cant use bc of cooldown ill just msg himm
I reckon it's related to the empty name but am not certain
not pluign for me anyway
you can also skip the lore and just focus on like a chat message or smth
Maybe
and come back to it later if you get ideas
public static String getUrlFromSkull(SkullMeta meta) {
try {
GameProfile profile = ((GameProfile) profileField.get(meta));
if (profile == null)
return null;
Optional<Property> optional = profile.getProperties().get("textures").stream().findFirst();
return optional.map(property -> new String(Base64.getDecoder().decode(property.getValue().getBytes())).split("\"")[7]).orElse(null);
} catch (IllegalAccessException e) {
e.printStackTrace();
}
return "";
}
return null 💀
@scarlet gate this is a method I used pre 1.18, not sure if it works for newer versions
I would either return an empty string or null, not both
profileField = ((SkullMeta) skull.getItemMeta()).getClass().getDeclaredField("profile");
profileField.setAccessible(true);
Yeah i just realized lmao
I don't use this code anymore
Just from an old repo
Yeah I do something similar for legacy versions:
@Nullable
public String getB64(ItemStack itemStack) {
try {
if (itemStack.hasItemMeta() && itemStack.getItemMeta() instanceof SkullMeta skullMeta) {
if (skullMetaProfileField == null) {
skullMetaProfileField = skullMeta.getClass().getDeclaredField("profile");
skullMetaProfileField.setAccessible(true);
}
GameProfile gameProfile = (GameProfile) skullMetaProfileField.get(skullMeta);
Iterator<Property> iterator = gameProfile.getProperties().get("textures").iterator();
if (iterator.hasNext()) {
Property property = iterator.next();
return property.getValue();
}
}
return null;
} catch (Exception exception) {
return null;
}
}
Ah
based64
im on the new buildtools and i checked the generate-docs arg, but its not showing up in the 'ur about to run this command' info thing. will it still run said docs?
🤔 It's showing up fine for me
and I'm not sure if it will still do it
try it and see ig
@scarlet gate that method will still work
This top one doesn't allow to get the profile from SkullMeta#getOwnerProfile for me but the bottom one works fine, only difference was adding the name to the profile
/give @p minecraft:player_head[profile={id:[I;-1713734374,1097286524,-1815675771,-1473225903],properties:[{name:"textures",value:"eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvOTUyNDVjMGQwOGQ2YTk3ZGM5MWY4Nzg0NTY1NTQ1MTRlY2NhOTQ4ZGIxMGYyYzk0NzE4MGMxMzM1NTQ4NjI5In19fQ=="}]}] 1
/give @p player_head[profile={name:"HeadDB",id:[I;-1713734374,1097286524,-1815675771,-1473225903],properties:[{name:"textures",value:"eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvOTUyNDVjMGQwOGQ2YTk3ZGM5MWY4Nzg0NTY1NTQ1MTRlY2NhOTQ4ZGIxMGYyYzk0NzE4MGMxMzM1NTQ4NjI5In19fQ=="}]}] 1
Yeahh but ideally the API should work
yep
hm it shows once it updates after hitting the compile button
Why does it do that 😨
name is probably null
Almost certainly
Not sure why that should mean it can't get the profile though
I understand that is happening but I don't quite get the reasoning
cuz spigot says so!!
😭
minecraft-heads.com haha
they should atleast put a dummy name
I do agree
fatal: detected dubious ownership in repository at 'D:/Creation/Minecraft/Bukkit'
'D:/Creation/Minecraft/Bukkit' is owned by:
(inconvertible) (S-1-5-21-3364630119-807111168-251932798-1001)
but the current user is:
AORUS_M/MOTERIUS (S-1-5-21-3738764286-1943144298-2269993401-1002)
To add an exception for this directory, call:
ok whats going on here? this never happened before
a plugin?
Nah a website https://minecraft-heads.com/
oh wait it provides a fix
They have a plugin too though (The heads from the plugin work perfectly fine)
wait so you're getting the broken heads from the command?
marking the directory as safe with the provided git command didnt work. ill try running the exe as admin
Exactly
From the "Give Code" section, for example: https://minecraft-heads.com/custom-heads/head/100670-monitor
oh for gods sake it quit with the same error again
can i just get a working buildtools please lol
PlayerProfile has the name as nullable so it shouldn't have to do null checks in skull meta
Ooh ok
alright so im changing the owner of all object and, well...
how do you get player heads ? (i need rubiks cube head xD)
simple or guaranteed-to-keep-working way?
umm the second one i think but idk what this means
you can generate a head without an actual user owning it
by providing it a properly encoded skin it will have that skin
i dont quite recall how exactly it works though
Hm, so I'm trying to add a custom glow effect to an entity which specific player watchers (I don't want all players on the server to be able to see the effect). I've managed to get each Player's scoreboard and add the entity id and themselves to the team. I can't use Entity#setGlowing because that sets it glowing for everbody so I used packets to send to a specific player.
But for some reason, when I send the glow packet to a person, it still makes it glow for everyone else (code here). I used entity metadata packet and tried to udpate it for one player only
you're still updating the entity's data
You might want to instead dump the data and modify / insert a DataValue on the list instead
Hmm so getEntityData().getNonDefaultValues() , and then modify 0th index byte
and then send the packet?
or if it doesn't exist, insert an element yeah
Might return an immutable list, defensive copy is recommended
yeet
hi i have this issue can someone help me ? Failed to get ProtocolManager instance.
if it doesn't exist does that mean the whole List would be empty?
or would just the first index be empty
or could it be either
It would mean that the first index is set as default
Oh ic so 0
@pure dagger
See this
solution found: delete everything
Something like this https://paste.helpch.at/gabipoveya.java
I tested it in game and it worked
no guarantee that the list is sorted
Oh
whats that
dont get that code
How you apply a skin to a player head
You need the skull url
how to get skull url
how would i resolve this issue though like just sort by ids?
Under the developers section you'd see the url
look through the list for your value. If you can't find it, construct a new one
Kk
this should do it https://paste.helpch.at/ubariqulix.java
You can nuke the found boolean by having foundIndex default to -1
oh yea true
How do I set the texture profile property to a player head?
Ty btw
can you manipulate the amount of armor indicators armor gives without nms nonsense?
i opened the jar with winrar and config.yml is in it
yeah, its not
thats your project not the jar
then thats not teh jar you are testing on your server
do NOT replace teh jar without stopping the server
i didn't
open the config.yml that is in the jar on your server
Not possible
If you really did replace teh jar with the server stopped and that really is the jar on your server it would be impossible to have that error message
idk man it just happened
Throw PC out the window, its haunted
no its just microsoft
Someone's a bummer to be around
what does microsoft have to do with this
i forgot to depend on vault, i think that fixed it
im about 95% sure the entirety of the problems i had with buildtools are a direct fault of windows 11
not sure how config is related to dependencies, but this is coding; everything is possible
im just salty
I will
oh windows 11
hehehaha
yeah windows 11 sucks and has too many issues
boo
waiting for windows 12 where they remove the strict hardware requirements
since whoever implemented that with windows 11 was quite dumb XD
Well hey there rad
hi
I bet you touch signs saying "Do not touch" too
They're just gonna double down and make it worse lol
chad activity
and I step on grass where it says "do not stop on grass"
I'm a lead revolutionist
true rebel
nah, if history proves anything every other version is good lmao
windows 11 was a big fail more so then vista was
I also push doors that say pull but that often doesn't go too well
I'm on Win7. Still waiting for a good OS
windows 10 is a good OS
is there an event that triggers on each block breaking stage (when texture changes)
nah Win10 is a tablet OS
linux is an everything OS (except of smartphones for now, excluding android)
have fun gaming on linux
I like linux, btu I dislike forced command line
(it runs minesweeper pretty well!)
i do for 2 years now exclusively, never dual booted
one day this might change if the GPU's would support linux better
if that day comes, i'm switching to linux
nvidia made the open module driver a default now
progress on fully free driver continues
this is obviously a lie
I have, it is why windows continues to be the number 1 OS for gaming
I could actually believe it, what with all teh bloat Windows has
windows is filled with ads and bloatware which makes games perform worse
idk what it is but yea most likely the overhead of windows being windows
windows is the no 1 os for gaming becauses linux support sicks
the performance really isn't an issue
its good enough if you dont play hugely comp games
you run windows because you get to install rootkit malware from your fav company
All my games are mostly 10 years old or more
with weird anticheats, but then why would you want software comparable to crowdstrike on your pc that could also end up the same as crowdstrike
can InventoryClickEvent.getClickedInventory ever be null
yes, if the click was outside the window
...
riot games
haven't seen a game do that
how
would be nice if you didn't spread myths lol
its not
?
you probably mean 15, GTA V is 11 years old :pepeold:
Vanguard also has control level above your windows OS
how can you click outside
it doesn't
it does
idk what it does but it bypasses all the system restrictions
vanguard uses a driver
has absolute control over the system
sounds like a root kit
It basically is, but it's just like ever other kernel level anticheat
Sony liked installing those 20 years back
Ghensin Impacts anticheat driver was used to bypass antivirus software
That was a funny story
windows defender is unique in that it can remove infected system files
how do you mess up genshin this bad
I only have defender
anyways any clue? (we can move above convo to #general maybe)
no
not in the spigot api atleast
no only start of breaking and end/abort
Even genshin impact have rootkit 😭🙏🏻
can can i check manually if player is digging currently?
for someone who has been in this discord for a long time, I am surprised you don't even know how to check for events existing
maybe with packets
but not with just the spigot api
anything like the player holding down their mouse is basically impossible
suprised us gov fights titkok while chinese games install rootkits on your system
yes you can check if a player is digging
use a set and add the player when they start breaking and remove when they stop breaking
one is actively taking money the other isn't
we all know its to stop the competition
even if tiktok gets banned in the US it mostly just means they are forbidden from US economics
people will bypass it with vpns, similar to the turkiye roblox situation
not sure why you love tiktok
turkey vs roblox is wild, what was the reason it happened?
reels are so much better than tiktok
I would prefer it not existing in the US anyways
more content i like
but know this, businesses don't have a right to exist in the US
unlike other countries, businesses actually need permission to exist 😉
tiktok's algorithm is made to "force" you to not stop scrolling
reels are spamming me with "funny animal" videos
you don't like funny animals?
that means its good, because i dont want to leave
my turtle is enough
is there an event that is called before server is closed? the player quit and kick event are not called in this case
JavaPlugin#onDisable
There is not
I mean, the plugin is being disabled, so onDisable makes the most sense
You could add a shutdown hook, but that would only fire after teh server has terminated
shutdown hooks don't work
as the players are all already disconnected
i need the connection before the close
onDisable it is
No event exists
i think i will onDisable and check if the server is not running
in this case it should be the sutdown
no
why not
the server will be running while onDisable fires
it may not
i dont think so
may not?
Server#isStopping should be accurate
ah
yes
there is no stopping api lmao
what
Is lynx spreading paper witchcraft again?
wait
do i really need to use nms for this...
Looks like
sorry
it
my condolences
theres only
shutdown()
wow?
wow like in "wow thats bad"
I guess its more like, not been any demand
I mean, an event would be nicer for sure
but as a certified bungeecord cookie contributor, adding a new event to spigot should be a piece of pastry
you mean bungeecord collaborator?
what should the blabla correspond to? in https://textures.minecraft.net/texture/blabla
it doesn't seem to be a uuid (I'd like to get the texture of a player's head from its uuid with mojang api)
sure 👍
i also need the event for bungee but i think in bungee i can use onDisable
how to initialize an instance of an object using reflections? considering that there is no known constructor, no params constructor or parameter types. As gson does it I know that you can initialize class instances without importing anything and without requiring an empty constructor
Would i need to use Unsafe for achiving that?
yeah that the problem, if they define one, they can or not. That makes me struggle
I mean you can get all constructors
because if they dont define constructor perfect i can use that one, but if they define constructor with parameters. I wont have those parameters to initialize the class
Find if there is one that match your types
yeah i know
but i dont know types
because data can be anything
yeah
thats when you have to be cheap and use gson
i mean i just want to understand how they do it
how what
my final conclusion is using Unsafe
initialize a class instance without knowing any parameter from constructor
yes or yes not mattering if having / having not constructor
but i wont use json, that the problem
is not even relevate to json
letme use translator
I understand what you mena
i think im not explaning well
Don't
I want to create a simple system that serializes me from a file with content to Java objects, as an object mapping would do. But to initialize the object I have problems with the constructors and their parameters, because I don't know completely which consturctor parameters I have or don't have
Gson is just using the class fields
okay, could you explain a bit more without taking much of your time?
It's assuming every field is a parameter in the constructor
Unless it's annotated to not be
so gson just loop over constructors and class fields, so when he find a match he create the constructor?
And that's only if there is no no-args constructor
yes that the problem i having
as far i dont know the args from constructor i cant initialize the object
Just make it have an empty constructor
i know the solution but its cumbersome and jank having to manually add empty constructor / forcing
i would be using Gson but i cant because gson is designed for Json
Empty constructor is the most basic thing for deserialization
Lombok has an annotation
oh cool, i didnt know that one, written in notes
i dont think you understand
you can use gson to get the instance's type
without calling the constructor
okay
if data going to be deserialized/serialized were Json no problem i use it
ohh cool, you catch what i mean
of the gson.fromjson
but i dont think
anyone here can really explain to you how it works
under the hod
hood*
na its perfect i was asking in general to know if was osible or not
it might
i dont know what it actually does
if you take a look you might figure it out
good luck
thanks man
I seen from the hood is mix of constructor, params, matching them and Java Unsafe like final option
Unsafe#allocateInstance
Very useful, I use it all the time
okay thats perfect, i was looking for that
i seen that i can like enforce class initialization without taking in account constructors
you should still just use a real constructor
unsafe's capabilities were reduced greatly in the latest jdk releases and the entire class is going away in the future
Yo, this class is sick
well what would be the solution if you needed its instance
but you already had a constructor with parameters
fill the parameters
yeah but what if it can't be null?
it needs to be a parameter
for the user they need to input one
but for your development
you know ur project and what it is
you can basically enable yourself to create one
/\
huh
you are allowed to create an instance of that class without parameters
but someone else using your lib or whatever is not
because they are using it for another method or something, but you need it to invoke a method inside
if you have explicit default constructors in every class
it would be confusing for everyone using your lib
because then they have to look and see what they need to provide as its not declared unless you don't provide a default constructor
I'm not sure what you're trying to say, we're talking about de/serialization of transparent data carriers, right?
not necessarily
example: jackson can deserialize json and bind it to an object through either a no-arg constructor and getters+setters/non-final fields (iirc) or a constructor with named parameters or parameters annotated with a special annotation that carries the parameter name
for most data carriers, the second method works just fine and no unsafe
how to make a plugin that gives player an effect?, i used playerHeldEvent or something like that but how to actually detect when player stops holdin the item?
i understand what you mean and this works with actual json objects
but i had a similar issue when it came to invoking methods in a class that had a constructor with parameters
it isn't a dto either
and yes having a default constructor explicitly can solve this
but it leads to confusion and other sorts of problems
You could have a loop every x ticks and check the players hand
or do something with packets using protocol lib
yeah, its kinda always like that, some bukkitrunnable or something can just solve it but its not the most efficient way i thing
you can make it more efficient
i wish i knew what that is 😔
and only loop when the playerHandEvent is called
and then stop when the item was removed
so its not looping every tick
yeah ill maybe do taht
so when player starts holding an item i give him the efect every maybe 3 seconds, and alaways check if he still holding otherwise cancel()
thats good i thingk
yeah but make it like
1 tick
so you dont have multiple loops
because if it only checks every 3 seconds
they can dequip and equip the item back when its not checking
what horrible will happen then ?
and it thinks that the player hasn't changed their item, although you could just cache it now
you'll have multiple loops
but you can either make it 1 tick or cache the loop
so you can only have one present
per player
orwhatever you'd like
You would create a hashmap with the UUID and the bukkitrunnable
oh yeah
and then check if that hashmap contains the uuid and so on
yes
and it would be better than 1 tick for performance wise
everything else like when you're checking it is up to you
thank!
s
i have so little time to finish a plugin... and i started a few days a go and i had to remember everything because i didnt do minecraft plugins for a while im like speedruning so im posting here a lot of questions lol
ah ok
also, does anyone know how to make that:
when a player catches another player with fishing rod, the catched player cant do something, but when he is not longer on the fishing rod, he can do it
the problem is that there is fishing rod event, but i dont know how to detect when player isnt catched anymore
Let's say a player sends a command. He opens chat, and clicks the arrow up button.
Is it possible to either remove the suggestion record of that command or at least change it?
that's dictated by the clients commandhistory.txt
I have a moral question.
Let's imagine the following situation: there is a platform where some open source projects are stored, both official and user (popular).
If a user wants to remove his project from the site, then there is a situation in which I would not like to be in.
On the one hand many people will be angry that an important project was deleted, on the other hand if I as an admin try to restore it by ignoring the developer it will be rude.
how to avoid this
it all depends on the plugin license
if redistribution is allowed you cna do nothing
open source
still depends on the license
OS is a gerneral term for many license
open source with restrictions
some have specific restrictions
open source just means the ability to see the source without having to do anything special
it doesn't make it free or allowed to redistribute
I would argue that that is generally defined as source available.
Open source is usually a bit more aggressive than that
you can argue it all you want
can someone give me an example pom? can't find mine
an example pom of what?
for a plugin?
your IDE should generate one
ye but it doesnt have the spigot stuff in it
which spigot stuff?
like,,,, 'use this api'?
thats just a matter of adding a dependency
and declaring the repo where it resides
in that case just find some random plugin that has a github
look at their pom
or if you have other projects already for plugins, just open one of your projects
recommend creating a project template for plugins so you don't have to worry about this
well with netbeans its easy to create a project template couldn't tell you how to do it with intellij
it resides in the same place
uh, typically you don't have to import javadocs but javadocs typically reside in the same location as the api so that your IDE can auto pull it in if you want it to
idk when i tried last time i had to manually import it
been a while tho
yep no doc here
that is not the javadoc
those would be called comments
package index
this is the javadoc
[21:09:59 WARN]: java.lang.IllegalAccessException: class me.vlink102.personal.Laser$Packets cannot access a member of class net.minecraft.network.syncher.SynchedEntityData with package access
:(
https://www.spigotmc.org/threads/laser-guardian-and-crystal-beams-1-9-1-20.348901/ I was trying to map this for 1.21.1
yes
no luck so far, the methods seem to not be accessible idk why
are you saying its no longer available in-ide?
it was never to begin with
spigot api didn't have any
other apis/libs might
its optional
Can we see your code
i know that i could read the javadocs in ide with that before
hmmm nop
its why i run the --generate-docs arg in the first place
oh
think i may be stupid
mb
it would help if i open my eyes before posting
do u know how to force maven to do so?
<classifier>javadoc</classifier> apparantly
right now im using hashmap for a kit cooldown but what do i use if i want multiple kit cooldowns
you are using Map<UUID, Long>?
Id suggest long to use the time you started the cooldown
yeah was planning on swapping
would be best, i think you could use tables for UUID, String, Long where as string is your kit identifier
so you dont store the whole object as key
how would i make this work with multiple cooldowns though?
because i think this one will only let me have 1 cooldown
Since you have a table its like you having two columns pointing to a value
you can have
UUID-1 Kit1 Cooldown
UUID-1 Kit2 Cooldown
UUID-2 Kit3 Cooldown
instead of
UUID-1 Cooldown
this sounds like gibberish to me tbh, is there a doc for this
But you could also use a Set or maybe directly a map with a list as value with your cooldowns like
public record KitCooldown(String kitIdentifier, long start) {}
private final Map<UUID, List<KitCooldown>> playerCooldowns = Maps.newHashMap();
im going to send you the docuemntation for the table one sec 🙂
thank you
this is best for beginners
how do i exclude group 1 from group 0 in regex
i've been trying to test out map changes in the latest version of spigot, and i have this bit of code:java @EventHandler private void onMapCreate( MapInitializeEvent event ) { event.getMap().addRenderer( new MapRenderer() { @Override public void render( MapView view, MapCanvas canvas, Player player ) { canvas.getCursors().addCursor( new MapCursor( ( byte ) 32, ( byte ) 32, ( byte ) 0, Type.RED_MARKER, true ) ); canvas.getCursors().addCursor( new MapCursor( ( byte ) 32, ( byte ) -32, ( byte ) 0, Type.TARGET_POINT, true ) ); } } ); }
but the cursors it produces is
im not able to create the red version of the player marker, is this a bug?
Dear,
I got a problem with my Discord Plugin Bot, where the class TextChannel is never found, even with the good imports.
It would seem like it
Here the current code of it:
`package com.illamaplugins.illamadiscord;
import net.dv8tion.jda.api.JDA;
import net.dv8tion.jda.api.JDABuilder;
import net.dv8tion.jda.api.entities.Message;
import net.dv8tion.jda.api.entities.TextChannel;
import net.dv8tion.jda.api.exceptions.RateLimitedException;
import net.dv8tion.jda.api.requests.RestAction;
import javax.security.auth.login.LoginException;
public class DiscordBot {
private final JDA jda;
private final String channelId;
private Message pinnedMessage;
public DiscordBot(String token, String channelId) {
this.channelId = channelId;
try {
jda = JDABuilder.createDefault(token).build();
jda.awaitReady();
} catch (LoginException | InterruptedException | RateLimitedException e) {
throw new RuntimeException("Failed to initialize Discord bot", e);
}
}
public void connect() {
// Already connected in the constructor
}
public void disconnect() {
jda.shutdown();
}
public void updatePinnedMessage(String content) {
TextChannel channel = jda.getTextChannelById(channelId);
if (channel != null) {
if (pinnedMessage == null) {
channel.sendMessage(content).queue(message -> pinnedMessage = message);
} else {
pinnedMessage.editMessage(content).queue();
}
}
}
}
`
Did I missed something somewhere?
A Hashtable is almost identical to a HashMap
Only that it‘s old, less performant when you don't need it to be synchronized, and doesn't allow null keys/values
i also suggested the use of recors as a map with a list of cooldowns
could also make map in map but idk
i did some more testing, and it seems like im not able to send the map packet with the red marker by constructing the map packet with the corresponding icon otherwise it throws an error: io.netty.handler.codec.EncoderException: Failed to encode packet 'clientbound/minecraft:map_item_data' at net.minecraft.network.codec.IdDispatchCodec.a(SourceFile:55) ~[spigot-1.21.1-R0.1-SNAPSHOT.jar:4300-Spigot-a759b62-7070de8] at net.minecraft.network.codec.IdDispatchCodec.encode(SourceFile:14) ~[spigot-1.21.1-R0.1-SNAPSHOT.jar:4300-Spigot-a759b62-7070de8] at net.minecraft.network.PacketEncoder.a(SourceFile:26) ~[spigot-1.21.1-R0.1-SNAPSHOT.jar:4300-Spigot-a759b62-7070de8]... Caused by: java.lang.NullPointerException: Cannot invoke "net.minecraft.core.Holder.a()" because "var0" is null at net.minecraft.core.IRegistry$1.a(SourceFile:189) ~[spigot-1.21.1-R0.1-SNAPSHOT.jar:4300-Spigot-a759b62-7070de8] at net.minecraft.core.IRegistry$1.a(SourceFile:186) ~[spigot-1.21.1-R0.1-SNAPSHOT.jar:4300-Spigot-a759b62-7070de8] at net.minecraft.core.Registry.c(SourceFile:25) ~[spigot-1.21.1-R0.1-SNAPSHOT.jar:4300-Spigot-a759b62-7070de8]
Map<UUID, List<Cooldown>> is totally fine
Someome got an idea for my problem there of my dependencies?
a Cooldown class that has a policy (stack vs override) and wraps a Map<UUID, Long> is my go-to approach
You need to shade external dependencies
I can't find net.minecraft.server.dedicated.DedicatedPlayerList in the spigot stash, any idea?
I can find CraftServer where its referenced just fine
thats nms and will not be in stash
Huh ?
To view nms you gotta clone cb and apply patches
or look in your buildtools work directory
ah
Okay so
-Dorg.gradle.java.home= just doesn't work
it being there and not being there is the same
if its not modified by spigot its not on there
windows 7 spotted
yepers
RIP mans security
solid as a rock
that's what they want you to believe
more solid than Win 11 🙂
the only known exploit I havn't patched is teh IPv6 exploit, but I'm behind NAT on IPv4 so not vulnerable.
Win 7 still usable now ?
fully
Even for gaming ?
you have to install a few patched/updates yourself, but its great
I've had no issues
Dear,
I got a problem with my Discord Plugin Bot, where the class TextChannel is never found, even with the good imports.
Here the current code of it:
`package com.illamaplugins.illamadiscord;
import net.dv8tion.jda.api.JDA;
import net.dv8tion.jda.api.JDABuilder;
import net.dv8tion.jda.api.entities.Message;
import net.dv8tion.jda.api.entities.TextChannel;
import net.dv8tion.jda.api.exceptions.RateLimitedException;
import net.dv8tion.jda.api.requests.RestAction;
import javax.security.auth.login.LoginException;
public class DiscordBot {
private final JDA jda;
private final String channelId;
private Message pinnedMessage;
public DiscordBot(String token, String channelId) {
this.channelId = channelId;
try {
jda = JDABuilder.createDefault(token).build();
jda.awaitReady();
} catch (LoginException | InterruptedException | RateLimitedException e) {
throw new RuntimeException("Failed to initialize Discord bot", e);
}
}
public void connect() {
// Already connected in the constructor
}
public void disconnect() {
jda.shutdown();
}
public void updatePinnedMessage(String content) {
TextChannel channel = jda.getTextChannelById(channelId);
if (channel != null) {
if (pinnedMessage == null) {
channel.sendMessage(content).queue(message -> pinnedMessage = message);
} else {
pinnedMessage.editMessage(content).queue();
}
}
}
}
`
I used windows 7
for years
I only went for win11 this year
and it was genuinely an amazing experience
relatively better than windows 11
aside from the software that I can now use
hey, why is my plugin importing bukkit 1.15? im setting my import for spigot to 1.21
and I do't have any import for bukkit 1.15 anywhere within my build.gradle
depending on vault?
move it down in priority
that means move it down from my dependency list?
just make sure it is below spigot in your build.gradle
actually nvm
everything is below spigotmc
repositories {
mavenCentral()
maven {
name = "spigotmc-repo"
url = "https://hub.spigotmc.org/nexus/content/repositories/snapshots/"
}
maven {
name = "sonatype"
url = "https://oss.sonatype.org/content/groups/public/"
}
maven { url "https://repo.oraxen.com/releases" }
maven { url 'https://redempt.dev' }
maven { url 'https://jitpack.io' }
maven { url "https://maven.enginehub.org/repo/" }
maven {
name = "CodeMC"
url = uri("https://repo.codemc.org/repository/maven-public/")
}
maven { url 'https://nexus.scarsz.me/content/groups/public/' }
}
dependencies {
compileOnly "org.spigotmc:spigot-api:1.21-R0.1-SNAPSHOT"
implementation 'com.github.Redempt:RedLib:6.6.1'
compileOnly 'net.luckperms:api:5.4'
compileOnly 'com.sk89q.worldguard:worldguard-bukkit:7.0.2-SNAPSHOT'
implementation 'com.github.Zrips:Jobs:v5.2.2.3'
compileOnly 'com.github.LoneDev6:API-ItemsAdder:3.6.1'
compileOnly "me.NoChance.PvPManager:pvpmanager:3.18.7"
implementation 'org.mariadb.jdbc:mariadb-java-client:2.1.2'
testImplementation 'com.h2database:h2:1.3.148'
implementation 'com.zaxxer:HikariCP:2.3.2'
compileOnly 'com.discordsrv:discordsrv:1.27.0'
compileOnly 'io.th0rgal:oraxen:1.173.0'
}
was it always?
think so
no clue with gradle then. wityh maven you can get a dependency tree
ok I fixed the inclusion
now I can't access what I want 💀
How do I use Attribute? https://hub.spigotmc.org/javadocs/bukkit/org/bukkit/attribute/Attribute.html
my IDE won't recognize it from spigot 1.21
do i need to include something else?
wdym red?
in your ide
ah yeah
intelij?
yep
try updating IJ. if not updated it has problems with Java 21
We love intelliJ sometimes
Hi elgarl
hi 🙂
Whatcha been up to
Nothin, how about you?
ah nice
bad commit name, 500 changes deserves a "small changes" comment
I just finished a private commision for an Essentails replacement myself. So not really nothin 🙂
I didn't know commits had names tbf, I use git just to keep code safe this laptop is old and my projects are not on the ssd (don't ask why)
I also just started actually making commit messages
didn't work, sadge
ah I love commit messages.
btw why cant i upload images?
?img
Can't send images? That's because you're not verified! Use !verify to complete verification.
Alternatively, you can upload screenshots to any image hosting site and share the link.
Here's some screenshot utilities that you can use to upload images.
Lightshot: https://prnt.sc
Imgur: https://imgur.com/upload
Flameshot: https://flameshot.org
How long did that take jeez?
I imagine you're probably faster than I am
um, about a month on and off
it had to be original code as it was a paid commission
doing better than me to be fair, I'm probably at like 20% and git says I made the repo aug 1st
yeah fair
i cant get my thing to work D:
nope, didn't work
so...
it seems like worldguard was including that bukkit 1.15 thing
so I did this:
compileOnly('com.sk89q.worldguard:worldguard-bukkit:7.0.2-SNAPSHOT') {
exclude group: 'org.bukkit', module: 'bukkit'
}
and I thought spigot's dependency would include the Attribute class and stuff
but for some reason it does and does NOT at the same time (????)
it does
I can't show it but there is org.bukkit.attribute.Attribute under spigot's jar, but within the code, trying to do that same text won't work, there's nothing to autocomplete for that
I can't help you with gradle though
i fckn hate oraxen istg
for some reason their dependency doesn't work with maven so I had to move my project to gradle
and now there is this
do you use 'org.spigotmc:spigot-api or org.spigotmc:spigot?
api
I have a feeling I remember someone else saying somethign about that class a while back. But my memory is so bad
isnt that 2nd remapped?
what
both are legit imports and i think the second was for remapped
yes if you setup for remapped, else its just obfuscated
idk what that means lololol
access to NMS thats not just a string of letters and numbers lol
would that have something to do with my problem?
doubtful
remapped is usually internal stuff. it really should not influence other plugins
how can i directly import bukkit? 🤔
I was able to acces the thing through bukkit, but I couldn't use it right bc it was bukkit 1.15 and I need 1.21
i think the buildtools have arguments to build bukkit instead of spigot
you might not be able to include it if its not in .m2
whats .m2?
he's using api and has the repo so no need for .m2
ah
nevermind then
its where buildtools puts stuff after you run it so that its available offline
is it only that class which is causing issues?
yes
nope, i didnt xd
No because at that point the items haven't dropped yet
Try checking out
https://hub.spigotmc.org/javadocs/spigot/org/bukkit/event/entity/EntityDropItemEvent.html
Not sure If this triggers under that scenario you may also want to check out ItemSpawnEvent.
declaration: package: org.bukkit.event.entity, class: EntityDropItemEvent
That event doesn't give you the entity that it derived from though
Only thr Item entity
The workaround would be a temporary cache with a 1 minute expired period
Or whatever expiry period you see fit
In such a case you'd need to track pickup and drops of these items closely
Otherwise you could end up with a memory leak
@echo basalt you felt that?
barely
Earthquake in lisbon, just woke me up here in coimbra
tbf I do live on the other side of the country
thought my leg was twitching my desk a bit
nothing major, fairly light
Same but I heard my wardrobe making nois3
lotta people yapping about it
Well it is 5.9 in lisbon
prob like a 1.5 here
Is lisbon still standing because I can't tell of the people I know there are sleeping or under rubble
still standing
Damn
praying I actually have to use my doomsday knowledge one day
Nearly had a chance to redesig that shithole again
dunno
my city has some slight tsunami risk given that y'know
I live like 2km away from a beach
at the same time it's like a 10m drop to actually go for a swim so it'd need to be something pretty big
and then the water would have to travel for another 2-3km uphill
We also have a tsunami risk in coimbra by the 2012 movie standards
yeah you have a river aite
unless it's coming from Figueira da Foz
which would surprise me
if that were to happen I'd be fucked 
hm should I get the discord monitor
let's not pretend like it was 600€ 2 hours ago and the promo is complete BS
Well let's hope the reason no one is answering messages is because they're asleep then
Shouldve bought that monitor instead of putting mine vertical
it's a weird 4k 16:18
whats the convention for tests in java
like what package do i use, how i should name clases
to make it readable and managable
country skill issue
in poland all sellers must show the last price from 30 days before the sale
no
i only found one for 1.14
complex topic
sadge
u gotta understand packets well
yeah i'm using nms and i think i understand packets fairly well
You either use packets or make actual fake player entities with a bootlegged connection
Just use your package like always com.kacperleague.project.tests
Units are appended with Tests for example CircleShapeTests
And your project should have a subdir for tests
damn mister smiles is writing gson 2
i was thinking the same package as the class im testing
and test suffix for test classes
https://www.spigotmc.org/threads/how-to-create-and-modify-npcs.400753/
this was the guide i found. tho apparently enough changed that it makes the guide pretty much useless sadge
use packetevents by retrooper
eh you just need to send like 6 packets
but the library handles backwards packet compability for u
and i don't think packets are that hard to comprehend (?)
worth it imo
well no but mojang code is so ass it'll make you wanna jump off a building
more confused about what stuff i have to use e.g. instead of the EntityPlayer from the 1.14 guide
i found the guide was helpful, just some names changed and not much more, a bit fiddling around and it worked fine :)
like they make every fucking constructor private
doesnt sound so bad 😎
/j
you have to use reflection or modify the server to construct some packets
very fun!!
oh i see then maybe i'm just too dumb to find the 1.19 equivalent to the EntityPlayer? lol
okay , that's a bit monkaS, but i'm doing this project to learn so yeah whatever
okay i cant even find the packets, ig everything was like fkn renamed between those versions? :/

