#help-development
1 messages · Page 1008 of 1
this isnt printing anything
no
i just want it to tell me to install economy provider
?paste the class and show your plugin list
?
then if (rsp == null) sendMessage
im doing that look
Well, like I explained. You can use the web interface to create smileys and register them with MC.
looks fine
On a live server.
hmmm
plugin.getlogger
oh thats what you were meaning
Fine level will nto show by default
code looks fine, check your code is actually running and use your pluigins logger
use INFO or WARNING
ill take info
It's a pretty fun nifty concept. You couldn't do that 8 years ago.
I had the idea yesterday and thought I'd try it out.
I also implemented some basic features like detecting whether the player's skin is wearing a hat or not.
it worked
That gets reflected in the chat avatar.
Then you hook it up with some macro detection in the chat like ":-)" and allow player's to register the gzipped base64 strings with the macros for their own avatar.
So the players can draw their own smileys and stuff for their characters.
And register them with a command with no support needed from resource pack.
Sans for the 8x8 grid of characters.
Which is always the same. You just color the pixels.
Oo I like this
It would be better if the website had a layer you can draw on above your character. Then the graphics could be merged on top of your avatar in-game.
But it would be more work 🤔
how do i make "floating" item displays
Spawn them in the air
like undespawnable, unpickable dropped item
with the floating effect thingi
Theres item displays on 1.20
im talking abt the go up go down thing
transformations?
Have you tried a display entity? Not sure if the Item entity has an animation when its being displayed by the EntityDisplay, but i doubt it.
I did that code day before yesterday
so figure out why its lagging
then slowly increase ir every tick
ok
to best match the floating effect you need to apply a sine curve to it
well I used Math.cos
At that point you might as well spawn an Item entity and set its gravity and pickup to false
?paste
https://paste.md-5.net/gafehunija.java Must use import org.joml.Math;
I do think the no gravity tag applies to items now, so that's possible :p
Probably the easiest way
It does
how can i use hex colors?
my old approach probably still works
why do I feel like we all have that exact same class
Using Components or a cursed legacy string format.
do you have that in text form?
thanks :)
wouldnt something like this be faster?
public static String colorizeWithHex2(String input) {
StringBuilder out = new StringBuilder("§x");
for (int i = 0; i < 6; i++) {
out.append("§").append(input.charAt(i));
}
return out.toString();
}
``` im new to spigot development and java generally so i might be wrong but it seemed like the old one just returned the string with §'s in between each character
that § fuckery is awful to look at
and you still gotta figure out all hex pattern occurrences
wdym
that would convert your hex eg 112233 to the spigot hex format but it wouldnt convert My cool 112233text
well it good enough for me so im gonna use it cause im scared of regex
Does anyone know why the sources are missing in IntelliJ? I still encounter this issue even after removing the .lastUpdated files. I have also disabled all compiler plugins.
I did, nothing happens ;c
So, um. How do I ban someone indefinitely using the Spigot API?
There doesn't seem to be a permanent option.
duration - how long the ban last, or null to imply forever
Well, yes. But all the addBan methods come with duration etc and none of them accept null.
:p use null
they do?
They're nullable arguments
cast the date null to date
Errors out on null.
cast it to date
Cast a null to Date?!? Java is insane.
probably some overload stuff
It's to avoid ambiguity because that could apply to either of the two methods
those calls are ambiguous
Which method do you use when the signatures match? :p
?
(Casting null to a type as an API requirement).
Here
Same
i think you have to generate sources for build tools
just do double shift and type download sources
Using null seems to have done the trick. But now I have a problem. The duration is now shown as "never", which seems to be hard coded.
I did there are spigot-api-1.20.4-R0.1-SNAPSHOT-sources.jar.lastUpdated
It do nothing ;c
I create a new Project, it download something, but the same error:
try reinstalling intellij
or invalidate caches
altho i don't think this counts as a cache
why does intellij crash every 10th second
well no one is forcing you to use it
are you using materials?
Its fresh windows + fresh IntelJ
yes
if you don't download sources you'll get crashes 😄
i've found this too the hard way
probably why shiro wants sources too
or well it doesnt crash it just turns the cpu up too like 100% suddenly and then i crash it myself
well, that sounds exactly like material crash
just give it more resources
material class is very long and intelijj's decompiler sucks
i mean it's a great decompiler
but not compared to material
IntelJ is so smart it cuts it off, so its not crashing. But i cant see how functions works.
shame it doesn't show you compiled code
maybe you're using jdk 17 for jdk 21 version @fallen scaffold
NB does
why are you a netbean user for wanting the source?
why wouldn't i like sources and documentation on the api?
inside my project
cuz javadocs and general knowledge?
you can't beat having the sources right under your nose
sources dont have a fuzzy finder, javadocs do
it's one method click away from finding exactly what a method does
oh sure
for that i was javadocs
but where i can i just find the library and manually scour it for what i think i need
it's closer than java docs
I am indeed a NB user
so is md 🙂
also, not sure why sources are an issue here when buildtools give you them
i have the sources but i don´t now why there are not showing
it does have the compiled classes that you can package yourself
you have to use a flag like -generate sources or something like that
and this ^
yes,m it still never makes a jar. Only creates teh files/folders
it is all you need
yep, its just a pain to make a jar and add to maven
i think it has a flag for packaging too, not sure
just use spigot api and click download sources
it's all you get sources for anyway
or need realistically
unless you need NMS stuff
i guess, but i was the remaps so not very helpful there i bet
I try to download all again
pain
mvn source:jar install
Inside the api repo
still same error
Which of them, all i did. Nothing changed
simply depending on the spigot-api artifact and clicking the download sources button
restart intellij, should fix itself, or maybe hit the choose sources button and point it to the downloaded file (it should be next to wherever it opens the explorer)
Did, both of them nothing changes
why not?
what does "doesn't really work" mean
5 row chest is glitchy
It means that Bukkit.createInventory(owner, 45, null)
Returns a null inventory
choosing the sources manually should most certainly fix it
and, well
i ran out of ideas besides "it works on my machine"
Bukkit.createInventory(null, 45, "Test")
try this
yeah, the title can't be null
and using the inventory holder is usually misused
TILEENTITY?
Nothing change.. :c
Its the error commes when download resouce from the jar itself:
com.intellij.openapi.diagnostic.RuntimeExceptionWithAttachments: Read access is allowed from inside read-action only (see Application.runReadAction()); see https://jb.gg/ij-platform-threading for details
Current thread: Thread[#416,DefaultDispatcher-worker-34,5,main] 1779701858 (EventQueue.isDispatchThread()=false)
SystemEventQueueThread: Thread[#78,AWT-EventQueue-0,6,main] 1134316415
at com.intellij.util.concurrency.ThreadingAssertions.createThreadAccessException(ThreadingAssertions.java:177)
at com.intellij.util.concurrency.ThreadingAssertions.softAssertReadAccess(ThreadingAssertions.java:129)
at com.intellij.openapi.application.impl.ApplicationImpl.assertReadAccessAllowed(ApplicationImpl.java:908)
at com.intellij.openapi.roots.impl.DirectoryIndexImpl.checkAvailability(DirectoryIndexImpl.java:145)
at com.intellij.openapi.roots.impl.DirectoryIndexImpl.getOrderEntries(DirectoryIndexImpl.java:129)
at com.intellij.openapi.roots.impl.ProjectFileIndexImpl.getOrderEntriesForFile(ProjectFileIndexImpl.java:108)
at org.jetbrains.idea.maven.utils.MavenAttachSourcesProvider.getMavenProjects(MavenAttachSourcesProvider.kt:138)
at org.jetbrains.idea.maven.utils.MavenAttachSourcesProvider.access$getMavenProjects(MavenAttachSourcesProvider.kt:31)
at org.jetbrains.idea.maven.utils.MavenAttachSourcesProvider$getActions$1$perform$1.invokeSuspend(MavenAttachSourcesProvider.kt:47)
at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
the project is local on my machine
okay, but where?
because it seems like it's in a permission area or it has read only flag
let me see
Hmm. the mark means write protection. But i don´t think thats the problem
probably not
seems the write protection is the issue
probably would had helped if you visited the link the error gave you
Hello, do someone know how to play animation with packets (eat, drink, use bow... etc) ?
player action 0x21? doubt it tho
What do you mean, that only the problem when im trying to download the source from the file itself. i had the source file to it shout not ne that problem
Nop
I'm looking at, but I've found nothing
could be that some things are client side too
anyone know how I would go about making a custom crops/plant plugin? I have been trying for while now and theres always errors.
Probably use a existing crop like wheat and change its meta data.
I think if you have custom meta data you can make a custom texture pack for it.
?paste
You're going to have to be more specific than that
how do i make some entity sit on me? (player)
player.getPassengers().add(display);
i have tried this
read the javadocs on that method
that's only for processing
you can't add
The returned list will not be directly linked to the entity's current passengers, and no guarantees are made as to its mutability.
specifically ^
and then use Entity#addPassanger
oh ok
ItemDisplay display = location.getWorld().spawn(location, ItemDisplay.class);
player.addPassenger(display);
this doesnt work?
Use customblockdata
This allows you to save data to blocks
ocp ocp
😔
Guys no WorldEdit for Spigot?
After running some tests it does appear that Entity.damage() does account for armor!
there is
Could u send me a link?
first google search
As Paper builds upon Spigot and Spigot upon Bukkit, Bukkit plugins are compatible with Spigot and Paper, Spigot plugins with paper
https://dev.bukkit.org/projects/worldedit/files/5326355 just tested this version for 1.20.6 works fine
bukkit/spigot same thing
^
is there a way I can attach a custom Enum to an event i trigger in my code?
or even just a number
then get that later
Thx <333
what did i say xd
Hey guys
So I get Bozo was last seen on blah blah, but he never joined the server
Here’s where I code for this
I would like to remove the Was Last seen on
And put that only if a player was fr seen on a date
well.. just check if they've played before
yeah I know it's in your code
but the logic isn't quite right
You don't want to send last seen when they haven't played before
Wdym?
Should I remove it from the brackets of the command?
I don’t understand
Just don't send the message if they haven't played before
Is there some manual for nms for dummies? I have been making pluginhs for a few years but havn't touched nms yet. wanted to mess a bit with path goals etc with mobs, but am a bit confused on how I compile or "finailize" the plugin for use?
someone said I use a different compiler for it which confused me.
Hello, how do I give a phantom gravity so it falls out the sky?
- set its velocity to go down
- calc nearest block down and teleport it
- set a really high amount of levitation (not sure how mcuh exactly) and it will levitate in the opposite
why is it that if i use streams for admin-only messages, it doesn't send it but if i use for loops it sends it
Bukkit.getOnlinePlayers().stream()
.filter(player -> player.hasPermission("plugins.alert"))
.forEach(player -> player.sendMessage(...);```
it used to work with for loops
should work
nope
comment that and do the exact same with a for loop in its place, see if that works
im pretty sure it'll work cuz i tried it afew minutes ago but i'll try again
show the for loop
Can anyone please give a good tutorial on how to add custom enchants 1.20+ (sorry if repeating myself :( )
You can add a "fake" enchantment. Give it a lore with the enchantment name and use PDC to keep track of that item, when the player uses it in your desired event check if it has that PDC and if it does, do your thing
is there a way to make an enchant that would be in the enchanting table?
oh wait my dumbass was doing !player.hasPermission(...) in the for loop before and forgot to give owner rank the permission
exactly why I told you to do the same functionality with a for loop instead :)
is there a vault discord
speaking of that, how do u give ranks full perms
* just gives me some perms but not all
if you want to give all perms, you should preferably op them
is there a way to make an enchant that would be in the enchanting table?
that's just *, it gives minecraft commands and some perms that does default: op
Not that I know of
if u register one it shows up pretty sure
op will give all perms except ones that are set to false by default
otherwise there wouldnt be a single reason to register an enchant vs use pdc
no
never use star perms
some plugins have features eg as disabling a feature. by giving that permission you might be accidentally disabling a feature
ah
but it's not that hard
i asked 9 people
😄
try eclipse
actually
it's easier to compile
can u compile it for me
Hi @dreamy sleet
;-;
Just buy the plugin
?
Jesse is mocking you @stoic summit
where
that is the last suggestion I expected to see here
;=-;
Doctor Java
;-;
well, eclipse is easier to compile with
you don't need to set up a jdk
you just export as jar or something like that
and you're mostly good to go
Intellij can do that too
I suppose so, but IJ should automatically download a JDK on first start
^^
Well I remember this because in the IJ flatpak it's impossible to bring your own JDK
eclipse is very beginner friendly with it's 1970s looks
stupidest choice ever but https://imgs.xkcd.com/comics/sandboxing_cycle.png I guess
windows 95 ui looks more modern than eclipse
oh wait eclipse is here cough
how do i get the plugin that owns the command from this Bukkit.getCommandMap().getCommand(command)
i agree
also i noticed that even if you remove commands from PlayerCommandSendEvent and someone tries to execute it, it still executes
but i guess intellij looks modern too
which means with a simple bruteforcer with all popular plugins it could theoratically get bruteforced
the difference between eclipse's modernity and idea's modernity is the difference between the temprature of the earth and the temprature of the sun
at least it doesnt pop up with bs "CoPiLoT" every second
coll uses it too
hey can u compile?
i can, but if it's premium plugin i won't @stoic summit
even Elgar uses it (although that should be to noone's surprise)
why tho
they are being gaslit over at the recaf discord, don't worry
how tf do u even manage to get the source code of a premium plugin (stolen) but cant compile it
It's open source: https://github.com/Darkxx14/FFA
then compile it for him
Bruh, as if I'm gonna run gradle buildscripts I am unfamilliar with
yes
cough
i think im screwed
how tho? during the compilation process it doesn't run the file
I could verify the wrapper or install gradle manually, but I ain't gonna do that
if i do it through intellij would it be safe
it executes the buildscript using the gradle wrapper. Both are potential attack vectors.
Doesn't IJ warn you of this when importing gradle projects?
this is so weird about gradle
idk
the tools are so dangerous, maven is so much more safe
How can I inject user data into my plugin when a customer downloads it?
who even doesnt compile their stuff and give it to people
I see some plugins doing it
u mean spying on your customer?
it's a commercial application
use bStats
probably as a mean of verifying/tracing a purchase
Yeah, and also just so I can see the user id when checking if the server is using leaked resource
use your local installation?
the exact same problem exists with maven fwiw
but bStats can be disabled, ur better off just DMCA takedown all leaked resources
Don't have any. Kinda pointless under gradle as it bricks every few weeks. Where as maven does not
Well gradle 7 won't compile gradle 8 projects, and so on and so forth
Bro I mean the user id from spigot into my plugin. I'm looking if anyone knows a way I can easily inject it to grab the user id
not strictly true but sure
bstats don't have that feature
tfdym user id
I'd make a license system if it was allowed but it's against spigotmc rules
gradle 8 was released two full years after gradle 7 
authors/perrier.1399540/ example
idk I mean, if you are worried about gradle wrapper binary being compromised, they have a sha256 hash endpoint
well there are also java compatibility considerations and more
last numbers are user id
yeah ic
Well but that is more than 10 seconds of work
if they have the jar file they can just reverse engineer it (they all do), you could also do a discord thingi with /verify <userid> and if ur verified u download the plugin from there (not sure if spigot would like that)
this way u could have all user ids that own ur plugin
check premium placeholders
appreciate it bro
That's true, but still some protection is better than none ykwim
god forbid you work in any collaborative project
As u said DMCA probably works the best
Well if it put's you at ease: I don't.
lynx you should totally check build tooling support
(this is also the reason I will almost instantly accept PRs to most of my repos if they LGTM)
I left
pineapply
smh
new version of apply patches
Them pineapple nerds can’t figure stuff out themselves? Smh
i just wanna have a normal shadow jar task time
but nah, I have not run into that issue so I didn't have any comment
give --debug a go
it should publish a report with like, timings split up
it looks like its a load of aquiring and releasing workers
you mean --build-scan?
how do i remake hypixel skyblock in one line of code
or that
whatever the one is that sends your personal data to gradle
executeImagination();
running with -d and looking at shadow jar i get
GRADLE SHADOW STATS
Total Jars: 63 (includes project)
Total Time: 5.072s [5072ms]
Average Time/Jar: 0.0805079365079s [80.5079365079ms]
*******************```
Have you tried asking nicely for it to go faster
yeah
63 jars?
i even gave it 8gb of ram
Das a lot of jars
nah
got have my logging
and my annotations
and my discord
and my guava and gson
and kotlin logging
and my optons
and my exposed
just compileOnly guava and gson, it's already included in minecraft \s
software that isn't Minecraft?
wtf is it exposed
impossible
irony switch
Oh then do an even bigger brain move and download all the dependencies at runtime using https://github.com/stianloader/PicoResolve
bot
I know right?
Hides their galimulator mods behind their back
how would you spawn vex's that dont attack you but attack others?
Add a pdc tag or use some kind of map to save who they shouldn’t attack
And then cancel the target event
Probably some sort of chat bot to reply to you because you’re so lonely coding a chat bot
Is it just me that my IDE does not correctly index certain bukkit classes in the latest version (1.20.6)? Does anyone know how to fix this?
I'm using Intellij
update
Intellij?
yeah
what's the best way to make a custom breaking system for client side blocks
i found a forum but its outdated
i got a system working but its janky
how do i spawn a frozen arrow
What’s a frozen arrow
wdym by spawn
set velocity to nothing and setGravity(false)
All 0s
how do i get the hand position
explain the "hand position"
You can approximate it with some maths
what part does getLocation give u
Since you know where the eyes are and which way the player is facing
True, you could get the approximate Y
getLocation is the bottom of the hitbox
How can Arrays.asList(player.getInventory().getContents()) be throwing an NPE when getContents specifys the return value as NotNull
paste teh actual error
[21:15:17 ERROR]: Could not pass event InventoryClickEvent to Plugin v2.01
java.lang.NullPointerException: Cannot invoke "java.util.List.set(int, Object)" because "this.items" is null
stacktrace doesn't have relevent info besides the Arrays.asList call
?paste teh full stacktrace
I'm not sure what info that will provide you with
KitEditor.java:99
As I said at the start that is the Arrays.asList call
the code you posted is not throwing an NPE. wherever you access this.items is
this.items is not in the code you posted
oh shit
im sped
lmfao
I was thinking this.items was in the internal PlayerInventory
🤣
my faul
np
When you're making a mini game, how do you handle multiple instances of the map? Do you make separate worlds, or paste the map multiple times within one world? Or do you make a "virtual world" which is not even a real world file?
It depends
on teh size of yoru game
loading and unloading worlds is costly, soyou want to avoid it if at all possible
spreading out instances in a world is a good way to avoid that.
slowly restore an area after the game is finshed.
once done you flag it as available for the next game
What do you mean by map?
could be like a duels arena, or like skywars
does anyone have a list or resource for changes coming in 1.21?
from a plugin dev perspective
What most do is to keep a master of the world. Make a copy of master and load the copy. Then unload the map that was destroyed. You need a lobby server or world.
im having problems including a library and chatgpt literally told me to go ask to a gradle community. im trying to parse json, im using the kotlin-xserialization-json library, but apparently its not being shadowed into the final jar for some reason, even tho it is doing it for some other dependencies. im doing it in kotlin btw, idk if that matters. there is no output if i do theplugin.jar -tf | grep serialization. this is the build.gradle.kts file
the error is java.lang.NoClassDefFoundError: kotlinx/serialization/json/Json in case i wasnt clear
why do all CombatLogX addons say " Jar does not contain plugin.yml"
when i try to load my server, all of the extra addons i added to the server just dont load
combatlogx works fine
I'm guessing they aren't supposed to be loaded as plugins, but through some other system specific to combatlogx
last time i used combatlogx, i just dragged and dropped all of the extra addon plugins directly into the plugins folder and it worked, im not really sure whats up with it
it didnt work when i tried recreating the "expansions" folder and putting the plugins in
never mind im just stupid
how can i specify which potion for this recipe
Hello! I would like to know if there is any change in PersistentDataContainer in version 1.20.6.
I have a problem in that in this method where I return an ItemStack, I assign a value to the key "entity_type". I assign the value "pig", so in that broadcast that says "saved value:", it has the value "pig", but then when I check the value again in the place where I call that method, it returns null. Do you know why this happens? I am also including the getStringData method for you to see. Thank you :)
It's pseudocode of what happens, it's not the actual code, which is why there isn't a PersistentDataContainer.set after getting the PersistentDataContainer from the ItemMeta, but in my real code, it is there.
Nothing wrong with your pseudocode. So long as you are updating teh ItemStack instance
I tested it in 1.20.2 - 1.20.4 and it works fine, but in 1.20.6 it doesn't. I would like to know if there is any change or if it's a bug in Spigot?
Did spigot 1.20.6 remove ChatColor, GameMode, Material? All I did is update 1.20.4 →1.20.6 and now a few classes are not found:
@echo basalt so i was implementing your tracker today and using a custom Wrapper of EntityDamageByEntityEvent that just also stores the special Weapon involved in the damaging if there was one. It works great for everything and for things like my gust spell when i just create my own EntityDamageByEntityEvent and Wrap it with the gust sword weapon and send it to the tracker. But the issue is when I try to use entity.damage() along with my gust spell that fires its own EntityDamageByEntityEvent and then inside of that listener i end up sending another Wrapper to the tracker just from using the damage() method. So basically its causing an extra entry to be made when there was only one attack. So i dont know how to basically ignore the event or just not trigger the event caused by damage(). I could just use that one and not send my own to the tracker but then I have to same issue of not being able to attach my Weapon to the event
And obviously i could just subtract the health manually but i want to account for armor and stuff and damage() does automatically
I was thinking maybe ill just attach something stupid to the entity.damage() like this and in my listener just not send a Wrapper to the tracker for this specific damage because it wouldnt be from an entity anyways. But there has to be a better way lol
wait i think im so stupid. this entire time ive been doing entity.damage(10, killer)
but you dont even need to add a second param
thus it wont have any entity attached and wont get sent to the tracker
sometimes it really helps to just type things out sorry all
hi, how can i report a spigot resource ?
Update your intellij, it's broken
see thread here on 1.20.6 imports bug fix https://www.spigotmc.org/threads/imports-not-recognized-when-updating-to-1-20-6.647843/#post-4731078
@autumn cave
I have an enum and each one stores some unique values. I created a method which returns an itemStack with these values which works fine, except for PersistentData. It gets written to the itemStack correctly, the only problem I have is when I get a new instance using the method from the enum (which writes the default values to the itemStack) the PersistentData is the same as the one before (the PersistentData of the before one has been modified). Shouldn't it be item specific or am I doing something wrong?
(If u need the code I'll try providing it, I'm currently on vacation so over mobile I might take a while)
I'm making a fishing plugin and im trying to have the fish spawn in much like how they do in vanilla minecraft. I can't seem to get it working how i'd like it to. any ideas appreciated! https://paste.md-5.net/ekeyuriboy.cs
Pretty sure you can pass a reason to the damage() method
And then just filter out by it
Watch the stream here:
https://piratesoftware.live
#Shorts #Twitch #PirateSoftware
Quick how to remove embeds on mobile
bump
Seems like it
Material -> BlockType
No clue about the rest
but material isn't just blocks
Is it finally happening ?
I believe so
Lesgooo
ItemType idk
While this API is in a public interface, it is not intended for use by plugins until further notice. The purpose of these types is to make Material more maintenance friendly, but will in due time be the official replacement for the aforementioned enum. Entirely incompatible changes may occur. Do not use this API in plugins.
okay no, Material it still is
interesting
gotta change half my plugins updating it 💀
So, negative spaces can move text horizontally towards left.
But.
How do I move reliably and consistently text horizontally towards right - to position text, symbols, and graphics?
Do I just spam space characters?
you can get positive spaced charactesr aswell
most negative space fonts have positive aswell
Oh, I see. So I should do that.
Well, I just thought I'd do this:
{
"providers": [
{
"type": "space",
"advances": {
"\uF101": -1,
"\uF102": -2,
"\uF103": -3,
"\uF104": -4,
"\uF105": -5,
"\uF106": -6,
"\uF107": -7,
"\uF108": -8,
"\uF109": -9,
"\uF111": 1,
"\uF112": 2,
"\uF113": 3,
"\uF114": 4,
"\uF115": 5,
"\uF116": 6,
"\uF117": 7,
"\uF118": 8,
"\uF119": 9
}
},
Should work, right?
didnt even know that was a thing lol
use an enum
Although dealing with strings might have been a mistake.
Right, exactly.
I really should.
this is how i implement mine
I didn't even know enums in Java can do that. I mainly use C#. Thanks for the tip.
@drowsy helmWell, I tried that and I can't find any errors in my syntax, but:
you dont have a constructor
Oh, I see. It is required explicitly for enums?
i just made an appendNegativeSpace(Short) method on my component builder that appends a translatable
How to get the player you are teleporting to in spectator mode?
new project time
i have a question, how do you know which unicodes are available/not really used normally? I am resorting to using weird emojis cuz idk what characters I can reliably use for it
Idk if this will help you but make sure you arent using valueOf for getting the enums
It’s different than the actual name string you might have put in the constructor
Idk how you are doing it exactly
By the unicode standard i think like plane 4-13 are unsued, but minecraft only has a few thousand or so printable unicode chars so theres heaps of unused planes
I tend to use F-E range, you wont get many clashes, if any
I see
Yeah thats what i was gonna do but actually just using entity.damage(float) worked for me because it doesnt pass along a damager entity by default
yeah chatgpt says "BMP Private Use Area: U+E000 to U+F8FF"
Some dumb reason i kept putting entity.damage(float, killer) and was pissed the event had the killer 😂
Its working really really good now tho
Appreciate you sharing that with me it helps to see data structures like that
nope, not using that, thx tho, I'll try providing my code as soon as I can (prob tomorrow or somethin unfortunately)
without code its not really possible to determine what you did, like how you actually save the pdc to the item or how the enum stores this information
Also for everyone tweaking about no material in 1.20.6 this has been brought up so many times and the answer is your intellij or java jdk needs to be updated
Google imports not working 1.20.6 and the first thread is pretty much what you are all asking
if i set itemmeta of item will persistentdata reset?
if that meta doesnt have the updated pdc, then it will get reset
the itemmeta contains the pdc so if you use a different meta, the pdc will also be changed
bruh
but if you do getItemMeta/setItemMeta it should retain everything except the changes
mhm
a way to look at it is that the meta contains everything thats not in the itemstack and is persistent, and the pdc is a part of that meta that you can put stuff in
how can i send a message with this color code ? B7416
you mean from code?
player.spigot.sendMessage(ChatColor.of("#2B7416") + "my message")
there are better ways but this is the easiest one to explain
make sure to use the bungee chat color version, not the bukkit one
okay
ideally you would make a message using the chat components from bungee like new TextComponent and then color it
or using the ComponentBuilder
inv.setItem(10, new ItemBuilder(Material.EMERALD).setDisplayname(ChatColor.of("B7416") + "ᴍᴏɴᴇʏ ʟᴇᴀᴅᴇʀʙᴏᴀʀᴅ")
why is this wrong
this is in a gui
setDisplayName does not return an ItemStack
item builder
and a builder normally requires you to actually .build()
now it works i removed the first &
ok I was way off base then
yeah but a Builder "should" return teh Builder until you call .build()
this doesnt seem to work
It sure doesn't
When I send /firstseen Egitto in game, it sends 3 times this
getItemMeta returns copy
How do I solve it?
meh
setItemMeta
You are sending the messages inside a loop
Idk what the loop is doing but my guess is that it loops 3 times
also why not getString(join_date_players. target.getUniqueId())
I got also a LastSeenCommand class
But it only works when someone does /lastseen
So not possible
Yea this would be nicer
So, anyway.
Is it possible to override existing Minecraft commands?
I was thinking I'd like add an announcement + delay to server restart. But I would prefer to keep the /restart command.
Instead of coming up with new names I can't remember.
Plugin commands should generally override
Oh, hey md_5.
Okay, so I intercept commands going to /restart, I cancel that, and then I reroute the command to my own differently named command? Or can I directly hijack the command?
restart is a bukkit command, not sure if you can override them the same way
its not vanilla atleast
Get it from the command map and override fr fr
Command map. Hm. I will look into that. Thanks.
Question, ok, in the .yml file, the players are stored with their UUID, but when a player sends the command he won’t write the uuid. And the plugin now checks if the section is the same as args[0] what do I do?
sends what command
get player by name, then their uuid
ah
Bukkit.getOfflinePlayer(args[0]).getUniqueId()
dunno the semantics of that method
if (args.length == 1) {
UUID playerUUID = null;
for (OfflinePlayer player : Bukkit.getOfflinePlayers()) {
var playerName = player.getName();
if (playerName == null) {
continue;
}
if (playerName.equalsIgnoreCase(args[0])) {
playerUUID = player.getUniqueId();
break;
}
}
if (playerUUID == null) {
sender.sendMessage("Player not found: " + args[0]);
return false;
}
You can do it like this.
oh god
With this method you have to iterate the collection, but you avoid using deprecated methods.
To avoid using deprecated methods.
i mean the deprecated method aint gonna get removed
at twice the cost
dunno if that was the one that could do a mojang lookup
But it is deprecated. I'm sure md_5 & co know what they're doing.
Or who who ever keeps deprecating useful methods.
theres no forRemoval=true
It's only deprecated because seraching a player by name isnt reliable
its not going to be removed
Of course you can do it any way you want. Just an example.
and your method functionally odes the same thing, less efficiently
If only the reason for the deprecation was described in the javadocs 
Persistent storage of users should be by UUID as names are no longer unique past a single session.
It's amazing. It's been 8 years since I last modded Minecraft and the Javadocs are ... nobody has done anything to improve usability during that time.

I meant
It must be concerted from getName to UUID, since in the config, the players is saved in UUID
players sends /firstseen Egitto, Egitto must be converted to UUID, checks if the UUID matches any UUID in the file, if so, sender.sendMessage Egitto was…..
Well the command in question I drew the example from was a ban command, and I'm not going to write/copy paste UUIDs to ban people. That's just not happening.
So this is the best I can do.
not all deprecated methods have alternatives, so sometimes methods are deprecated because they had nothing better to do I guess or because it uses magic numbers, but are still perfectly usable
If something is marked deprecated in the API, I'm not touching it.
then you might get issues with some more advanced stuff
I think the meaning of deprecated differs wherever its used xD
its more to scare off people who dont know what they're doing
I mean, the non deprecated solution here is to just Bukkit.createPlayerProfile(name).update().thenAccept
having a fun argument at work rn
🤔 Interesting.
tho that will be a web request
Oh.
Well as much of a web request as getOfflinePlayer would have to be
I think I will stick with my "inefficient for loop".
it is terrible tho
Yes, it is pretty terrible.
sometimes terrible is good enough
no like, that loop is so inefficient, I think a web request is going to be faster
But I don't expect to ban people every 20 seconds, so it will be fine.
it works terribly, but it works
Well it'll hang your main thread
given the method has to read all player profiles from disk
How many can there be.
Unless you clear them, as many as your server had unique logins
depends how many different players logged into the server
My point exactly.
I mean, ok. Maybe I'll check out your suggestion. I guess it would the adde benefit of being able to ban people who have never visited the server.
It tells me Bukkit.getOfflinePlayer() as being deprecated 💀
just use the createPlayerProfile thing. Its going to use the profile cache if filled so like, if they are online, you are good too
As long as the servers are not down.
That would be embarrassing trying to ban someone and not being able to because Mojang servers are down.
have you missed the conversation for the last 10 mins
is it me or has 7smile7 not been around lately
he was on yesterday
and like 10 days ago
If they are online, it would work without mojang servers. If they aren't you should really be doing a web request for banning anyway
I mean, why though?
I can just change my name? xD
But it wouldn't change in offline players. I get the stored UUID based on the name.
But still, it would have the UUID ..
IIRC at work we had a layered system to do UUID lookups :)
Well if my offline player record on your server has the name "lynxplay", and now someone else has that name, you have two offline plaeyrs
do you ban both?
my old data file isn't going to get updated
I mean. My understanding is:
- Person has never visited the server.
- I check the offline players.
- Obviously the person is not there.
- The person logs in, does bad stuff, and leaves.
- Now his data is forever unchanged in offlineplayers unless he logs back in.
So... what's the problem with that?
I log onto your server in 2019 with my name "lynxplay"
I log off
change my name to ehh, lynxplayButCool
Yes. Your UUID is stored and same.
in 2024 someone takes lynxplay
joins
you iterate over all offline player profiles, there are two with the name lynxplay
you are fucked
And UUID would not match.
did I miss something?
you don't compare that to anything
because your caller only passes in a name
you have nothing to compare that to
Yea, what if your loop first runs into my old profile on your server with the name "lynxplay".
Which is outdated, my current name is "lynxplayButCool"
but I haven't joined your server since I changed the name
you are trying to ban coll, who changes his name to "lynxplay" since its now free
but your for loop first picks up on my old offline player profile that is outdated, it grabs my uuid and then bans me
Yea I mean, preferably the only people you ban by name is people currently online
if you ban people offline, you have to do so by uuid
PlayerProfile#update yields you a completable future
CompletableFuture#thenAccept is invoked once the future is completed
Ah.
Does it need an action or do I just pass null to it?
"Action to perform before completing"
Well you'd pass a Consumer<PlayerProfile>
which is invoked with the "updated" player profile
e.g. the one with uuid filled
On a second thought a web call wouldn't really help with the issues we discussed.
I suppose the ban command should just refuse to ban the person without UUID if that person is offline.
Yea
But it's incredibly inconvenient.
which is why usually your entire system (e.g. reports and whatever) all store uuids
they can display names for sure
but the actual banning should be done by uuid
I want to check if a player is at a certain location (example: between x:100 and z:100)
Instead of watching over the player move event, would it be better for me to run a task timer every 10-15 secs to see if the player is at the location, or monitor the PlayerMoveEvent?
I'm just using the above as an example, as I plan on doing this for a few regions
PlayerMoveEvent can be incredibly taxing.
if (event.getFrom().getBlock() == event.getTo().getBlock()) reeturn;
But on the other hand, you can do a lot of cool stuff with it.
I'm aware, but I know I can limit the amount of calls to it. I could probably make a custom event to somehow 'run' a call of player move event every x seconds (I guess a combination of timer & event)
Would this be more efficient than running a timer though?
Because doing this check every time a player moves a block vs checking all online players every 10-15 secs
actually maybe there's a chunk event or something I can look into
depends what exactly you want to do
You could probably check all online players every 10 ticks, if you wanted to, with no problems.
It's just for a quest plugin, once a player reaches a certain area it would mark the quest objective done and move them to the next objective
I would likely use a timer or a hook from WorldGuard or something.
I'd just do it in the move event. It has already fired, both locations and blocks are already in memory. and early ext and a simple check is not heavy
the problem with the checkin all online players, is that the time to completion is linear. Thatt is, the more players that are on, the more time it takes to go through the list and so forth. Where as events you check the information the event gives and only when the event happens. Most of the time what you have going on in your listener isn't really causing that much of significant performance unless you start doing things that block or you running through massive lists first before the listern can be done with the event.
I guess you can do it however you want as long as you check what kind of performance impact it has.
otherwise checking on player move some innocuous information isn't going to be detrimental
Yeah... my only checks would be to see if the player's quest objective is to meet at a location, other than that it wouldn't be too much. Thank ya'll
I just needed some convincing I think, I wouldn't want the player to miss out on the correct location during the timers being ticked
Imagine if it was a race, or a parkour of some sort, that would kinda suck
Caused by: java.lang.NoSuchMethodError: 'void org.bukkit.entity.Entity$Spigot.sendMessage(net.md_5.bungee.api.chat.BaseComponent)'
how i can replace sendMessage method, server version is 1.8, i need to use BaseComponent
so all you need is a conditional check on the location to check against objective location. If it don't match early return it and let it move on
and only do something once its matches, doing it this way the impact is so insignificant you probably could barely measure it
except for when it matches
^Even easier, the objective condition is saved on player data, so just need to match the condition with the event, instead of grabbing any locations
and to make it more convincing
the player move event location given is going to not match more often then it is going to match
therefore the code is most of the time doing nothing
Sweet, okay- that's all I needed for now. I love programming 😝
When the 'void org.bukkit.entity.Entity$Spigot.sendMessage(net.md_5.bungee.api.chat.BaseComponent)' method was invented?
i need to know the version when this method was invented
idk then
a long time ago
if you are unsure just use a little reflection to check it exists before you try to use it
i need to know the version when this method was invented
U know?
why?
Dont answer to my question with questions
as I said, just use reflection to see if it exists. If it does, use it, if not don;t use it
Why do you need to know why I need it?
Are you stupid?
to see if you really need to know or you are just stuck on an idea]
i cant not use it
Look up commit history
in my case, no
Where is it
eg```java
public static boolean hasUpdateCommand() {
try {
// Method only available post 1.14
Player.class.getMethod("updateCommands");
return true;
} catch (Exception ex) {
// Server too old to support updateCommands.
return false;
}
}```
Spigot stash I would assume
or just run git shell in the buildtools directory
That can work too ig
There is no search on spigot stash
There is
seems to be from before 1.8 even
Yeah I'm pretty sure that method is from 1.7 since json chat existed
rude
its not working in 1.11
and working in 1.12 and higher versions
It exists in 1.8.8
its under Player.Spigot not Entity.Spigot
It was moved in 1.12 from Player.Spigot to CommandSender.Spigot
if you get it from Player.spigot().sendMessage it shoudl work in ALL versions
It will only work in 1.12+ from Entity.Spigot
Its working, thanks!
why is this not possible :(
public <V, T extends V> void foo(Class<T> type) {
...
}
not that that is particularly useful
the class has V
the method has T
it returns T but ensures T is some kind of V
i do this because I want that depending on the type the casted class is returned
BUMP
then you can do it in the generic basically like shown above, but extending the class' type parameter instead
Idk if that helps, but since some version minecraft reworked the entire metadata stuff
When i use InventoryView.getItem(Slot) it gives me an IndexOutOfBoundsException. How do i check if the slot is not out of bouds i thought it would just return null if its out of bounds
inventory.getSize
Thats for inventory not inventoryview
And the countSlots() says it can be bigger then the actual slots so idk if that works
I dont know what unsused inv slots are
.countSlots()
https://hub.spigotmc.org/javadocs/bukkit/org/bukkit/inventory/InventoryView.html
or you can even do getTopInventory() if you only want the top inventory
theres many ways
reading docs helps#
Yeah i read it but what means the note
yeah ok thats actually smart thanks
Did you find a solution? I suppose it happens in 1.20.6 just like it does for me. It's fine that the ItemMeta is a copy of the original, but I think it should also copy the data contained in the PersistentDataContainer
explain why you want the id?
Why should i tell you that? I just want that
💀
Because its outdated af
because your answer may affect my answer
Yea no shit sherlock?
I didn't know thanks god you told me
Why are you being so rude
Why is everyone so contrary today?
If you're asking about a 1.8 plugin I'm pretty sure there's a website that says how old it is now
generally you'd only neeed an id for sending packets, so it would not be API, which is why I asked
I am using 1.18
I need data that is stored in class that extends Item and API does not provide acces to it
So could you now tell me if there is any not depracted way to get an id?
then just use getId()
well its deprecated, but does it still work
deprecated does not mean don't use
if it works youre good to go
deprecated usually means its an unorthodox way to do something
So there is not a not depracted way?
no
Okay
Oh i forgot to tell something
@quiet ice you are bad at coding get better. Last time you were telling me why i should not extend InventoryHolder to identify Inventories, and now paper post https://docs.papermc.io/paper/dev/custom-inventory-holder that you SHOULD do that
This is Spigot not Paper.
Or you just have no knowledge but you speak
Yea
I am pretty sure
Inventory system is VERY VERY similar
Spigot says do not extend InventoryHolder
My source is @worldly ingot - I think. Blame him
Because it is coded by geol
We were talking with him also abt that, and he was telling that everyone in Hypixel Team understand it's bad idea but did not provide any justification
also, I have no clue who you are
There are cloning issues with InventoryHolders
I have a feeling there is a Spigot post about it
Yea there are cloning issues on spigot
mb mb