#help-development
1 messages · Page 1088 of 1
thanks
If it's json endpoints usually I just make gson do the heavy lifting
we tried this. eyeLocation and location have no difference when calculating direction
Wuat are you trying to do?
head vs body rotation is also not a thing
eyeLocation is literally location + height
wrapper has been deprecated for a while
Kekw
there is no instant health so i did HEAL
9 years old that's why
maybe it should work as instant health because health boost and regen exists
Guys, I need some help, now I'm trying to code with Kotlin, I'll take a head and enter /addhead (name) to make the head disappear with that name into the json.
But there is a problem
I bought the head from a site called minecraft-heads and got the head that way with the command block.
Can't register this correctly
How can i do
where can i get the list of type of the block entity
Read the profile from the head and store the texture.
ok thank you
Yeah makes sense, the craftbukkit implementation just adds an offset for the head
how do you get the block that a dispenser is pointing at?
(not ray casting, I want the immediate block)
like, the one right in front of it
getRelative maybe?
Block next to is Dispenser#getRelative(Dispenser#getFacing())
starting looking for it too lol
yeah, ty
there's no Dispenser#getRelative though
since it's a block state
get a block
yes
when i trying to use net.minecraft.network.chat.Component it says that no def found
nms version 1_20_R3, how to fix it?
During compile or runtime
runtime
Is there a good way of placing blocks async without using FAWE? (there are reasons I cannot use it as I'm not the lead on the project and it should not use more than paper itself as a lib)
^^
?workdistro
no i dont forget
gradle*
tyy :)
Who know what the event need for detect item move usage number buttons in keypad
?
File f = new File("plugins/Wicklow2/players/" + player.getUniqueId() + ".yml");
This is in my onPlayerJoin handler. Why is the file not getting created?
remap
remapping
you aren't make sure the remap task is actually running
you're jar isn't remapping
spigot doesnt have component class
make sure the remap task is actually running
already remapping
i am not stupid and remapping jar
you are not remapping the jar
why not
make sure the task is running
because Component should remap to IChatBaseComponent
but it isn't at compile time
public class onJoinLobby implements Listener {
private final Main NeoWorldPlugin;
public onJoinLobby(Main main) {
NeoWorldPlugin = main;
}
private static void sendTitle(Player player, String title, String subtitle, int fadeIn, int stay, int fadeOut) {
IChatBaseComponent chatTitle = ChatSerializer.a("{\"text\": \"" + title + "\"}");
IChatBaseComponent chatSubtitle = ChatSerializer.a("{\"text\": \"" + subtitle + "\"}");
PacketPlayOutTitle titlePacket = new PacketPlayOutTitle(EnumTitleAction.TITLE, chatTitle);
PacketPlayOutTitle subtitlePacket = new PacketPlayOutTitle(EnumTitleAction.SUBTITLE, chatSubtitle);
PacketPlayOutTitle length = new PacketPlayOutTitle(fadeIn, stay, fadeOut);
((CraftPlayer) player).getHandle().playerConnection.sendPacket(titlePacket);
((CraftPlayer) player).getHandle().playerConnection.sendPacket(subtitlePacket);
((CraftPlayer) player).getHandle().playerConnection.sendPacket(length);
}
@EventHandler
public void onJoin(PlayerJoinEvent event) {
Player player = event.getPlayer();
List<String> serverName = Arrays.asList(Bukkit.getServerName().split("-"));
System.out.println(serverName);
if (serverName.get(0).equalsIgnoreCase("lobby")) {
Inventory inv = player.getInventory();
inv.clear();
player.setHealth(20);
player.setFoodLevel(20);
player.setGameMode(GameMode.ADVENTURE);
player.teleport(new Location(player.getWorld(), 0.431f, 103, 0.622f, 0.5f, 2.1f));
sendTitle(player, "&4 Test", "", 1,2,1);
}
}
}
``` Why I don't see my title 😦 ? (1.8)
which means its likely the task isn't running
ahh
That's what you'd say
tasks.jar {
finalizedBy(tasks.remap)
}```
File f = new File("plugins/Wicklow2/players/" + player.getUniqueId() + ".yml");
This is in my onPlayerJoin handler. Why is the file not getting created?
because you never create the file
how do you create it?
also hard coding that is dumb
this always worked for me before
File f = new File(plugin.getDataFolder(), "players/%s.yml".formatted(player.getUniqueId());
Server owners can change the location of the plugins folder
this is the only safe way to direct youreself to that file
thanks
thanks
please consider learning more java or using google for super simple things like that
not works
> Task :1_20_R3:remap
Successfully obfuscate jar (1_20_R3, MOJANG_TO_SPIGOT)
I never learned how to create the file properly because in the past that line of code did it
I dont understand why it worked before and isnt working now
I never did anything else to create the file, new File() just did it automatically if it didnt exist
new File doesn't actually write to disk
hmm, whenever new players joined it would create a file for them on my old server with the same code
cfg.save(f)?
yes
Everything is very close to a solution...There is one more problem left to solve: I log on to the server, it says in the console that I am logged in, but in minecraft it connects me to the server and does not let me through to the server, I am kicked with the inscription "Disconnect"
That would do it
Stay in #help-server
@earnest girder anyway fyi, File itself is pretty much just an object that contains the path to a file (whether that file actually exists or not on disk is another question, finding out about that is usually done by using some method() on the file object)
There is my gradle, why my plugin not remapping?
https://paste.md-5.net/ezixaxahuk.pl
how to combine projects and remap each project?
when i remapping one project its work but in all in one project remap is not appear
When i implementation my two projects (one of these has remapped) into one, remap dissappear
hey im trying to change the sound that the ender dragon makes
so like instead of its original roar it will make a diff sound
any ideas how i could go about doing this?
Use a resource pack
guys help with remapping pls
i have multiple projects, and result jar dont have mapping, but separately it has remap
what should i do?
what is shade
he means shadow
I'd actually remap than shadow
if you have different versions remapping after shadowing will cause issues
i have multiple project, separately it has remap, but when combining into 1 jar there is no remap
why?
show your configuration for the fat jar
fat?
gimme your gradle configs
General build.gradle.kts
https://paste.md-5.net/abidasotof.pl
1_20_R3 build.gradle.kts
https://paste.md-5.net/ipihonomoj.cs
bukkit build.gradle.kts
https://paste.md-5.net/vusiyireki.js
why does discord say that is a download
idk
what command are you running to compile
build
right that's true if you have more than one nms version
currently i have two projects, one of them use nms
currently I have 8 projects, one of them uses minecraft
alright in your nms configuration
build.get().dependsOn(remap) remove this line
Then in your bigger one tasks.jar {enabled = false}
shadowJar should then handle everything theoretically given your other modules are shaded properly
not works
Do you mean a Collection? Like Map or List?
yes
I'm not sure then tbh
Yes
The data itself in a database is (usually) always unsorted.
With ORDER BY you can sort a result-set by one or more columns (see https://www.w3schools.com/sql/sql_orderby.asp)
As u should be sorting in actual query
Yes, it's a database operation
Not service layer logic
Why would extra functionality be inappropiate?
Also the ORDER BY keyword is in the SQL reference
Which means every database that is SQL based, should have it implemented
This is current build.gradle, and it works!
https://paste.md-5.net/ocawusigab.js
i added new line
nmsVersionList.forEach { dependsOn(":${it}:remap") }
@EventHandler
public void onPlayerJoin(PlayerJoinEvent event){
event.setJoinMessage("Welcome To The Server");
System.out.println("A player Has Joined The Server");
}
@EventHandler
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
// Queues You For 1v1s
if (command.getName().equalsIgnoreCase("Queue")) {
if (sender instanceof Player) {
Player p = (Player) sender;
p.sendMessage(ChatColor.GREEN + "You Are Now Queued For 1v1");
}
}
return true;
}
}```
it rly doesnt like CommandSender public boolean onCommand(CommandSender sender, Command command, String label, String[] args)
?
That is not how commands work in spigot...
I’m just trying to learn. It is a old video I’m watching tho
Basically the same way as you register Listeners for events, you set CommandExecutors for single Commands
So you should end up having a CommandExecutor for every command in your project
EntitiesUnloadEvent, e.getEntities() seems to be empty every time,
@EventHandler
public void onEntitiesUnload(EntitiesUnloadEvent e) {
Bukkit.broadcastMessage("Plain Entities: " + e.getEntities().size());
What event do I use if I want to check if the player picked up xp?
PlayerPickupExperienceEvent
Its from Paper
Oh nvmd yeah your right
I use Paper yet use this discord cause 🤷♂️ lmao
What are you trying to do with the information? Can find alternative solutions
i mean there's the exp change event but that'll fire for more things with next to no context
Increasing the received experience
Thanks
Guys, I need some help I will send a code
only 8?
rookie numbers
Tracing my beloved ❤️
heads:
test1:
==: org.bukkit.inventory.ItemStack
type: SKULL_ITEM
damage: 3
meta:
==: ItemMeta
meta-type: SKULL
display-name: Enderchest
I get the head from the Minecraft-heads website and access it through the command blog. When I take it and type /addhead test1, it saves the config like this.
However, the one below does not add the internal, and when I say /gethead test it gives the alex head. I manually typed internal into config and reloaded it, and again I said /gethead test1 and I got the head successfully.
I want it to save the internal as well when using the /addhead command, but I couldn't do this.
internal: H4sIAAAAAAAAAE2PzU6DQBzE/5qYIPExvJKwsEB76MFYa5d0QVo+yt74WEJhF5sWGuhz+YDizePMb2aSUQFUeDm0gxBfl+/qJLgCj6SE1xKbqEILrFkmxho2qlLLsbXQCiszSuRgJ8OOCupcOvNLf+LXZ1B6PvbDhV9VAHhQ4CnOxMDhh0+uzo61Xh5dUUzEnnV40IVPmrNDunjK34lN5My3b/ZuWv7LWn2WWCI13Zp1wZDLWN+Ze8G3e1TI6JY2G8nkRrCwGKmkJlvXLQ29Jm3o6CeR6YXp6K9blEpXeGFkpJIi2nxgNnsspBa9B3/8Pm+0fkJ075OOpEPLKlit5gfwC2I59wQcAQAA
This looks like 1.8 code
TRUE
?1.8
Too old! (Click the link to get the exact time)
He is younger than me lol
Yeah thats how i picture the average 1.8 playerbase
Do you mean current 1.8 playerbase or like back when it was still acceptable
The previous plugin was also recording without any problems, it was also 1.8.
Current
The problems are rather internal kek
Mmm
1.8 is just old man
So how do we define the head?
I know it is old version
NMS or stop maintaining 1.8
No you don't.
Like no one gonna help with ancient spigot
My server will be installed on 1.8.9
Because it's a pvp server, and the best version for pvp
❌
Ah yes, the good decade old argument
Still being used
Who's destroys the mouse first, wins
If you wish to use a 10 year old version, you need to know what you are doing.
And don't even dare to bring up hypixel rn
I think it's a rule, it's a game, it's great in the beginning so it's still preferable for 1.8 pvp
"bUt HyPiXeL aLsO dOeS tHiS" 🙃
And they have a team of like 50 devs I think
and they all know what tf they are doing
And they aren't even using spigot
The only reason it’s preferable is because your playerbase isn’t full of devs lol
They don’t understand what it means to maintain ancient technology
For example, Pubg Mobile was great in the past, but now it's terrible 🤷
No components 🤢
Nah I just shade all of adventure in my plugins lol
🤷.
Adventure has the bukkit extension anyway so
yeah
e I feel like an old turtle while playing the new versions. 😂
I think the old version is great for pvp
Build your own combat system then
Idk how ppl program and dont just change what they dont like
Truth
real
I've been playing Minecraft for 11 years, I still think the old versions are great for me, if I'm just going to play for survival purposes.
Of course, the current versions are better.
But for pvp the old version is always better
.
Nope
It’s really not that bad
1.8.9 <3 me
Your loss man gl
Tastes and colors are indisputable
Get well soon
to all of us 🙏🌹
how can i get the position of a particle after respawning it?
Cant
A particle doesnt exist on the server. You simply send a packet to the client and tell it where a particle spawns
what about computing its positon based on speed, ticks passed etc?
Depends on the particle. Most particles have random movement patterns. It all depends how each client interprets the particle.
Some particles can have momentum and a direction.
ok thank you
What are you trying to do?
When creating BlockData from a material and using World#setBlockData does it also get updated correctly to the material etc? (might seem like a dumb question but i never really worked with blockdata so yea)
Yes, setBlockData will update the blocks Material
oke, ty :)
Hey, I want to create multiple profiles so I need to save inventories to a database. Can I just store Inventory#getContents[] asString or should I encode it to base64?
I obviously want no item loss or dupes so I want save the inventory to the database async everytime it updates or every x ticks but at least every minute but rather sooner. But I'm not sure if it is bad for performance or anything else to spam database writes. My server won't have vanilla storage such as chests so I don't have to worry about those for dupes.
Any thoughts?
From what I've seen, people usually go for base64
Is it less storage? because it's a shorter string or because the datatype becomes binary or something else?
¯_(ツ)_/¯
Bro I 100% fucking agree. The logs are so clean and easy to tell apart
xd
REAL
Also what do u think of the ecs though
Made it myself
You can query for any amount of components as you want
With mutable/immutable references
Totally async too
None
I'm using RwLocks
To allow multiple readers
Every component is rwlock'd
Checkout the repo if u want
what's the repo
I think
Oh damn you have actual regions
What
You talking about Mc regions?
Oh, still working on the chunk stuff
It'll be saved in embedded db eventually, that's the plan
But you can join the server currently, just no chunks are shown
The packet system is also clean af
But it needs an update to the state system
hey how can I check what class is stored if any in the Material enum? need to check for doors and trapdoors
and I'd rather not list them all individually
Try reflections
meh chatgpt had a better idea, just checking if it ends with _door or _trapdoor
does the job fine
aren't there tags nowadays
the reason I asked is because I'm sure there's a way to do it via api
there should be one for trapdoors as well ^
createBlockData n type check that shit
Why does this give me the motivation to reimplement the minecraft server myself
The 101231239123812th mc server in rust implementation™️
hello i tried making a customentity but it does not spawn at all (1.20.1)
?notworking
"Does not working" is a useless statement. Please describe what exactly is not working, what you expect it to do, and what actually happens. If you get any console errors, also ?paste the entire stacktrace.
?paste
You need to put it in the pastebin
Are you extending NMS entities?
how to make it safer?
It's fun af
I only know 2
Feather and valence
Graphite
BlockState state = Objects.requireNonNull(e.getClickedBlock()).getState();
if (!(state instanceof Beacon)) return;
int tier = ((Beacon) state).getTier();
p.sendMessage("" + tier);
``` any ideas why I don't get tier level? in older versions used to work
- You should do a proper null check. This code will throw exceptions. (A lot)
- Explain what is happening and what you expect to happen instead
in PlayerInteractEvent trying to check if player hits a beacon if its beacon it should print out it's tier level
Alright, what is actually happening?
I want to know what's beacon tier by hitting it
interract event should do the thing
Alright, thats again what you expect to happen. Now explain what is actually happening right now?
Any errors in your console? Do you get any message? Do you get the wrong tier?
Yeah I get errors on int tier = ((Beacon) state).getTier(); line
But the thing is it used to work in older versions
1.13.2
what error
Did you /reload at any point in time?
Alright, try this one:
Block block = event.getClickedBlock();
if(block == null) {
return;
}
if(block.getState() instanceof Beacon beacon) {
p.sendMessage("" + beacon.getTier());
}
If this still throws an exception, then there is a serious problem at order
It works, thank you 😅
Can sm1 help
?ask
If you have a question, please just ask it. Don't look for staff or topic experts. Don't ask to ask or ask if people are awake or available. Just ask the question to the channel straight out, and wait patiently for a reply. Make sure you use the right channel regarding the topic of your question. Create a thread in case the channel is already in use!
Oh ok
what
Hello how do i edit the drop spread (if a person dies the loot spreads in all ways i want to make it that it drops below there feet)
probably the easiest is collect all drops in the event and then spawn them in yourself
Its not like that
I have a elytra pvp and if people fight
The items spread all around
And my communtiy doesnt like either do i
Hello how do i edit the drop spread (if a person dies the loot spreads in all ways i want to make it that it drops below there feet)
well thats what I was trying to explain
liste for the player death event I think
then get all the drops
and spawn them in yourself
I dont understand
So, when a player dies, the PlayerDeathEvent gets called, you understand?
I dont know what a playerdeathevent is😅
Its like that
😂
Pls explain
Then you are in the wrong channel
Oh so this is not a channel where people help,
are you a developer?
Bro, you are in the SpigotMC Discord, so I assume you know at least a bit about java plugin coding, if not, please first learn the basics for minecraft plugin development, then you can most likely solve the problem you have, yourself
No im not
then use #help-server
Then im sorry
Okay thanks
This is the channel for development related help.
For administrative help refer to #help-server
Im sorry i wasted time guys
np
its fine
To the other devs here, does anybody know a bit about texturepack vanilla shaders 1.20.1? I'm adding a custom texture for my hotbar, but the y positioning is sometimes 1 px off if i fullscreen or have a weird aspect ratio or have the GUI scale 1 or 2
(what's going on)
So basically the problem is between pic 1 and pic 2. The Red and blue bars are custom unicode textures from the actionbar, since I can't use the vanilla hearts and hunger bars in my project. So the actionbar, the xp bar and the selected slot icon are all positioned by minecraft, but my custom hotbar is positioned by me via the position_tex.vsh core shader
Try asking in the shaderLABS discord
thank you, I'll do that
This is handled by the position_tex of the gui_overlay shader. But im not sure how you would fix this offset.
Thanks!
You want to be in the vanilla shaders channel and provide as much information as possible
yeah, so i fixed the GUI scale positioning by checking what the Screensize.y size is, and from there i could position it slightly different for every gui scale
thank you, I will
any news about the API for can_break and can_place ?
How to decrease jar size?
I am using only one class from this library
implementation("it.unimi.dsi:dsiutils:$dsiutils")
Who knows how to get only necessary classes from libraries?
hello legend
thanks
*Im assuming you are using the shadow plugin
? 🫨
yes thanks
Hi everyone, I am currently updating my plugin from 1.20 to 1.21 and I want to spawn an Armor Stand with a shield which has a banner on it. I use this code which worked in the previous version:
[...]
flagBanner = new ItemStack(Material.SHIELD);
BlockStateMeta flagBannerMeta = (BlockStateMeta) flagBanner.getItemMeta();
BlockState state = flagBannerMeta.getBlockState();
Banner banner = (Banner) state;
banner.setBaseColor(DyeColor.RED);
flagBannerMeta.setBlockState(banner);
flagBanner.setItemMeta(flagBannerMeta);
[...]
ArmorStand flagStand = (ArmorStand) NMS.spawnNMSArmorStand(loc, true).getBukkitEntity();
[...]
flagStand.setItem(EquipmentSlot.HEAD, flagBanner);
In 1.21 the Armor Stand only has a shield on its head but the banner is missing. It also does not work when using banner.setType(Material.RED_BANNER);
Not with Spigot
It’s a shame because downstream is not ready for production
im really sad
I develop an item plugin, I have almost implemented the whole spigot API to create very personalized items and I need that to be perfect 😱
Pull request to Spigot
If your draft is not “good enough”, they will let you know. Once you apply changes, if everything’s right it should be merged.
the can_break and can_place api basically is terrible to implement in 1.20.5 and above
given that that component can do a lot more
yeahh
What can it do now
okayy i have a "solution" for the can break
it can match block entity data
so an API would have to expose that somehow
which sounds just horrible
and not doing that would be an insta data loss issue sooo, it's ass
with the configuration of my plugin I define that my item has a default mining speed at 0.0 and I define the blocks I want to break with a speed greater than 0
tool-component:
enable: true
damage-per-block: 1
default-mining-speed: 0.0
rules:
materials:
- materials:
- TINTED_GLASS
speed: 8.0
correct-for-drops: true
Wild
So you can make items that can only break chests that contain a specific item
yea sadly not, who knows if the empty inventory of a Chest block state was set by a plugin or if that is it's default and should not be matched.
sorry but i dont understand how it works, when i trying to add this to my multy project gradle its do nothing
Here is my gradle
https://paste.md-5.net/ibiyijawud.js
It sounds like work. Like a new abstraction layer is needed. And someone needs to write that without committing sudoku halfway through.
Pull it out of your tasks scope. No idea why you threw that in there.
And if everything shades regardless, then there is some linking between those classes.
what
reload gradle
Its in tasks for kotlin dsl
Yeah, i did an oopsie. Would be
tasks.shadowJar {
minimize()
}
For kotlin dsl. Which is the same as your previous code.
then, what i should do
if nothing happens
i dont think that all classes is depends which other
Getting better at gradle /s
(I have no idea)
wdym
I dont know what to do in that case. Pray to the gradle gods.
Make sure to run clean before compiling.
How to correct minimize my libraries
You can use spigot's library downloader to reduce your plugin jar. But library needs to be in maven central repo.
An abstraction layer that will die the second block entities are moved over to data components
🙃🙃
Are we sure that’s happening
ye
Could be 100.0000003% as well
very much so
What does the extra .00000003% result in
slicedlemon DM'd me and told me
I see
oh also John Minecraft told me (we're friends on instagram)
I have him on msn, checkmate
And he told me that you lie
why was my message deleted?
I have him on the telegraph (we connected our house with wires). And he said he is messing with you
Im hiring developers
If you wish to request or offer development/art/building/administration services, please do so at https://www.spigotmc.org/forums/services-recruitment-v2.54/
u gotta hire someone offering
not post
well they could also post a request too
but probably better if they look to see who is offering services first lol
They don’t meet the requirements
What is the equivalent to getSpawnedType() for trial spawners? In other words grab the mob type
TrialSpawner#getNormalConfiguration#getSpawnedType
Or the same with getOnimousConfiguration
Keep in mind the type of mob it spawns changes often in vanilla
Strange but the interface is only on BaseSpawner not TrialSpawner. im using this to copy one that exist
TrialSpawner spawner = (TrialSpawner) block.getState();
What interface?
TrialSpawner#getNormalConfiguration#getSpawnedType. its not under that one.
well yeah
BaseSpawner probably shouldn't even exist, but they share some data ig
TrialSpawner and regular Spawner are so different them sharing much data at all would be more of a burden
Right. i was trying to follow a similar path with how i did regular spawners. but its missing a bit of methods.
CreatureSpawner spawner = (CreatureSpawner)block.getState();
spawner..getSpawnedType() <- gets the mob type
TrialSpawner trial_spawner = (TrialSpawner) block.getState();
trial_spawner.getType() <- oddly get the material id
you have to remember the API of one of those is probably over 10 years old at this point and the other one was added like last month
It’s basically two entire sets of spawner data attached to one block
things change
TrialSpawners are such a cool Idea
I'm gald they got added
Fair, there are extensive attributes to trials. well, would you mind giving me a example of getting such string of the current mob type. im grabbing it on block mined
The GetSpawnedType for trials is under BaseSpawner interface, which doesnt match what you say about the configuration. the api is kind of going back and forth lol
BaseSpawner is inherited by TrialSpawnerConfiguration not TrialSpawner
what Coll said holds
You’d have to check the block data to see if it’s ominous or not
Based on that you can get the correct configuration and then getSpawnedType
its not ominous
Well then just use getNormalConfiguration
hi frostyalf
Though getting the spawned type isn’t super useful as all naturally generated trial spawners have multiple possible spawns
what exactly trial spawners? do they expire or something?
yea they do run out of spawns
and then gives you a gift
weird
A trial spawner summons a limited number of mobs, scaled based on the number of nearby players. When these mobs are defeated, the spawner drops a reward for each player and enters a cooldown period.
All mobs spawned by the trial spawner must be defeated before the trial spawner can drop loot. A mob is considered defeated when is either killed or transformed into another entity (excepting the transformation of creepers into charged creepers; the charged creeper must be defeated before completion of the trial spawner).
I should probably add a getActiveConfiguration that gets the correct one for you
Pretty easy addition
running to steal Coll's PR
I mean, go ahead if you want
nah I'm good I got to finish a commission by saturday 😭
collaboration ⭐
Yea thanks for showing me the configuration. definitely helpful now. Just trying to figure out why it wont show the import, feels so noobish rn but ive not messed with this yet so here we are.
what would be really cool is if all these features they keep putting in were able to turn off or on
Right, im running this. same issue
I mean you can just disable the structure with a datapack
?bootstrap
Bootstrap Jar
The main spigot-1.18.jar is now a bootstrap jar which contains all libraries. You cannot directly depend on this jar. You should depend on Spigot/Spigot-API/target/spigot-api-1.18-R0.1-SNAPSHOT-shaded.jar, or the entire contents of the bundler directory from your server, or use a dependency manager such as Maven or Gradle to handle this automatically.
Please read the release notes for further information: https://www.spigotmc.org/threads/9-years-of-spigotmc-spigot-bungeecord-1-18-1-18-1-release.534760/#post-4305163
not using maven?
for plugins that i only need the spigot api for I dont go with maven, makes it have a cleaner project folder
Also makes it 100% less portable
ok but that isn't all the features though =/
only reason I would like to be able to enable or disable features is so that the server isn't literally doing all kinds of stuff to the point where only a single player realistically can play
What other features are you concerned about
not sure, but the more stuff added the more processing it requires or resources
can't infinitely keep adding and expect no negative impacts lol
who knows the equivalent of new PathfinderGoalNearestAttackableTarget<EntityHuman> in 1.20
i cannot find the import
Hey guys is there any way to change inventory title?
I tried this :
InventoryView inventoryView = player.getOpenInventory();
AsyncExecutors.run(() -> inventoryView.setTitle("Hello there"));
but the error said :
java.lang.IllegalArgumentException: Only creatable inventories can have their title changed
how can I changed normal chest inventory title?
The jar maven generated works, even without maven. But its not shaded like such post describes, the shaded. Thank you to both of you, it returns the entity type with getnormalconfiguration
can someone help?
https://www.spigotmc.org/threads/change-inventory-title-reflection-1-8-1-20.489966/
I saw this resource but there's no longer exist MINOR_NUMBER variable in
https://github.com/CryptoMorin/XSeries/blob/7477ef5c434c40c89b9a6f4e180f4d5d69672e2f/src/main/java/com/cryptomorin/xseries/ReflectionUtils.java
this code
You're not changing a chest inventory title
this.targetSelector.addGoal(1, new NearestAttackableTargetGoal(EntityType.PLAYER, this, false));
this errors what can i do
?paste
then how can I make a animate gui?
Make sure you got a chest open
Also don't run it asyncrhonously
open new inventory every single second?
no
like make a new inventory
then check for certain items
then change that item
if u wanna animate glass, lets say
just check for glass
They probably wanna do texture pack fuckery
tah
Just use items with different model data
Switch the model data every second
hmm but I created unicode gif (title change) 'cause I thought it would worked for the lower version but in 1.20.+ seems it changed 😭
y2k_ do u know what to do for this https://paste.md-5.net/uxenefigij.java for the target
Pathfinders should be added in the registerPathfinderGoals method
Or whatever it’s called
sorry to ask but does anyone have the syntax for the
NearestAttackableTargetGoa
idk if this will work this.targetSelector.addGoal(1, new NearestAttackableTargetGoal<Player>(this, Player.class, false));
?tas
ty bill wurtz
Is there another way to use code to set a single line comment in the order it is placed in code? i know there is setComment() but that requires going based off of the config keys. id like to make several lines of comments
config.set()
config.comment
config.comment
```This sort of way
Is there a way to get the "pretty" name of a Material? the name method only returns the direct String like "OAK_PLANKS", is there a function to get "Oak Planks" from it? or do I need to use Regex?
public static String capitalizeWord(String str) {
String words[] = str.split("\\s");
String capitalizedWord = "";
for(String w : words) {
String first = w.substring(0,1);
String afterFirst = w.substring(1);
capitalizedWord += first.toUpperCase() + afterFirst + " ";
}
return capitalizedWord.trim();
}
```wrap it in this, and add `.replace("_", " ");` if you want those underscores gone. Full use capitalizeWord(type.toString().replace("_", " ").toLowerCase())
ServerPlayer moves head, but does not move body.
public static void absMoveTo(double d0, double d1, double d2, float f, float f1, ServerPlayer npc) {
ClientboundMoveEntityPacket packet = new ClientboundMoveEntityPacket.PosRot(
npc.getBukkitEntity().getEntityId(),
(short) (d0 - npc.xo),
(short) (d1 - npc.yo),
(short) (d2 - npc.zo),
(byte) ((int) (f * 256F / 360.0F)),
(byte) ((int) (f1 * 256F / 360.0F)), true);
// Send to all players who are allowed to see the NPC
Bukkit.getOnlinePlayers().forEach(pp -> ((CraftPlayer) pp).getHandle().connection.send(packet));
}```
not in terms of rotation, he does not get translated
does anyone know a fix?
hey guys I'm trying to set a anvil's maximum repair cost
so I tried this :
((AnvilView) event.getView()).setMaximumRepairCost(maxCost);
but the compile error said :
'org.bukkit.inventory.view.AnvilView' is declared in unstable package 'org.bukkit.inventory.view' marked with @ApiStatus.Experimental
'setMaximumRepairCost(int)' is declared in unstable package 'org.bukkit.inventory.view' marked with @ApiStatus.Experimental
how can I change anvil data?
dont change at the view object, try with inventory object
what can cause this artifacting on the right side (the lines) and cause it not to fully draw?
and also I seem to see slight lines where the item frames meet
yeah the shades of gray look different
the lighting is baked into this world, but I don't think that would impact the artifacting on the right side
I cannot find any method to change anvil properties
that's a warning not an error
it wouldnt
oh, so can I ignore it?
hi guys how can i get structure recognition when i move to it? i mean when i enter stronghold it will send message that i am in a stronghold?
There are a couple locateNearestStructure methods, use whichever you need
Do you have any examples of usage?
I've never used it before, but I can gpt it kek
Location param would probably be player location, structureType is any type of structure you'd like to search for, int is a search radius, true or false whether or not to locate (previously) discovered structures
Uh I'd avoid doing this onPlayerMoveEvent, perhaps a task every 10-15 seconds or something? I'd also probably do something that will prevent message spamming if the player was already in the structure as well
I am making a replay system. I made an architectruy:
/record player
first we should get the envrionnement (all blocks in a 25 bloc radius) and all entities. Then we wait our player packets and load it as a list and all packets which concerns what surrounds the player. to replay it we just reproducte "inverted" packets.my system is good?
It should be possible with a packet lib like packets events but in certain camera plugin they also use nms? Is there something I forgot to think about?
i tried in the player move event but it doesn't work, it returns "No" even though i'm in or some distance away from that structure
@EventHandler
public void onPlayerMove(PlayerMoveEvent e) {
Player player = e.getPlayer();
UUID playerId = player.getUniqueId();
String playerIdString = playerId.toString();
if(!databaseManager.getVerify(playerIdString))
{
}
else if (databaseManager.isPlayerSitting(playerIdString)) {
e.setCancelled(true);
}
Location location = player.getLocation();
StructureType structureType = StructureType.STRONGHOLD;
StructureSearchResult result = location.getWorld().locateNearestStructure(location,structureType,35, false);
if(result != null)
{
player.sendMessage("no");
}
else {
player.sendMessage("yes");
}
}```
if null, you send "yes"
I mean even though I set the range to around 35 blocks and stand away from the stronghold it still returns No instead of Yes.
.
if(result != null) {
sendMessage("no)
else{ gets printed
wait
I'm cooked
It just wont print
i stand away from the structure but it still returns "No". Instead of standing inside the structure. That's what i meant @@
Hello, I need help compiling my plugin. As it supports 1.18-1.21, I'd like to compile it using Java 17. However, I also use NMS (paperweight plugin) and the 1.21 module is build using Java 21.
v1_21_R1 build.gradle.kts:
java {
toolchain {
languageVersion = JavaLanguageVersion.of(21)
}
}
dependencies {
// NMS and other dependencies
}
plugin build.gradle.kts:
plugins {
id("com.github.johnrengelman.shadow") version("8.1.1")
}
dependencies {
implementation(project(":nms:v1_21_R1"))
// More NMS versions and other dependencies...
}
tasks {
shadowJar {
minimize()
// Shade adventure to support Spigot
relocate("net.kyori", "net.kyori")
archiveFileName.set("${project.parent?.name}-${project.version}.jar")
}
}
I am migrating from maven to Gradle, and the maven toolchain plugin worked. How can I compile the v1_21_R1 module with Java 21 and the plugin module with Java 17?
I tried adding this in the root build.gradle.kts
// Tried "subprojects" too
allprojects {
apply(plugin = "java")
java {
disableAutoTargetJvm()
toolchain {
languageVersion.set(JavaLanguageVersion.of(17))
}
}
}
I tried setting that java block in the plugin build.gradle.kts block too, I've tried all combinations of setting disableAutoTargetJvm() in only specific modules or everywhere and I keep getting the Unsupported class file major version 65 error no matter what I do
space, not enter 🤓
paper 🤡
I use Spigot's API but shade adventure API
And paper, spigot, whatever, the issue is the same
i am using nms 1.20.4 version and compiling with java 8, idk why you have troubles with java
Because, as I said, I am using Gradle and I need the plugin to be compiled using Java 17 except the 1.20.5-1.21 modules which need Java 21
You need to use a Java 21 JDK so set the toolchain to 21
You can then tell it to target an older Java version with the release or target/source settings
how to correctly use minimize() shadowJar method?
Or can i optimize plugin using libraries?
implementation("org.bstats:bstats-bukkit:$bstats")
implementation("com.zaxxer:HikariCP:$hikaricp")
implementation("org.jooq:jooq:$jooq")
implementation("org.apache.commons:commons-math3:$apachemath3")
implementation("it.unimi.dsi:dsiutils:$dsiutils")
basically all of that is on maven central so if your 1.17+ you can use the libraries feature
^^
That worked, thank you!
if its an air ingredient dont add it, also whats the point of matchMaterial if you dont use the output
I was just debugging
Thanks btw, the error went away :)
hi, im adding custom commands with aliases, let us say my custom command is /hi, the aliases are appearing like /hi:alias not /hi alias
can I use getContents() (use the method to read) on async context? private List<ItemStack> contents;
async context
depends on the impl of Backpack?
getcontents return list<itemstack>
ggwp
ggwp emily
not the return type
the impl
but yea, emily is probably right
why do you want
What is "Backpack"
things are generally not safe to call from different threads
so unless the Backpack implementation has logic to make it safe
it won't be
How would I make this safe?
Well, that would generally be safe
unless you also have a thread that writes to the contents list
so getContents().add or something
hm let me see
if you stick to setContents for mutation, you'd be fine because you'd be setting it to a new list
via just backpack.setContents(Arrays.asList(something.getContents())) ?
or something along those lines
List<ItemStack> contents = new ArrayList<>();
for (int i = 0; i < backpack.getSpace(); i++) {
contents.add(inventory.getItem(i));
}
backpack.setContents(contents);
and setcontents(null)
So can I use backpack#getcontents asynchronously?
the issue happens with you read and write the same list instance on multiple threads
Yea if you adhere to the above restriction ^
now, you may still have the problem that the list obviously changed
I don't understand why my server is crashing then
post the stacktrace 😅
latest.log?
?paste
yea
PandaSpigot 
which the probelm
it's the gongas guy
that kid who got banned on 3 accounts
making another fourth one ain't smart buddy
twinsmc
pandaspigot
1.8
mhm what a coincidence that three accounts came here with these exact same things
your issue isn't the insetOrUpdate method
then?
you literally posted a screenshot of your server hanging on BackpackService#get
but w/e, I cannot be bothered to read 1.8 stacktraces 
How do i check what my plugin is doing most of the time? Like if ik that method X is ran a lot i try to optimize it
spark
That does not mean anything. twinsmc is a company and has several developers

mhm mhm and why was the exact same kid named reeachyz all three times and saying he was a diff person
what is the prejudice? it won't change anything
I only see minecraft processes not plugin specific 90% of the times
prejudice?
I'm not even going to waste my time answering you. I created an account in 1999 and went back to the future!
no I am just saying, the screenshot you posted literally showed your issue is something else
aight reeeachyz_
Can you tell me what is causing the problem?
@ivory sleet hey buddy
what is IO?
Input Output of files generally
writing to files and stuff
or in this case, network
wdym
you are doing a database request on the servers main thread
in any case writing to places that dont instantly give feedback
but with my api it is impossible to do this
what
my api takes care of the threads, it's not me
I don't think you understand how that works
well it doesn't look like it kek
show the code of BackpackListener#onInventoryClose
plugin.getBackpackService().get(player.getName());
how is that get implemented
and respectively, how is BackpackRepository#findOne implemented
i mean it shows you are calling CompletableFuture#join on the main thread which is very monkaW
Yea so, the backpack isn't in the cache
it then does a blocking database request
and dies
there ya go
Why not just cache it lmao
imagine
But i only access it once, is that enough?
Well idk how slow your db is
Load the data from db to cache and when the server turns off the plugin save the data
but that is what your server is dying on
the db timed out should be 30 seconds, ok. but the api is supposed to be in another thread
but also you store the backpack under the backpacks name and lookup based on the players name?
"the api is supposed to be in another thread"
what
yea Database#execute does its work in a separate thread
findOne then joins the CF
which means you'll hang the thread you call that on until the one that does the IO is finished
what is cf
oh completable future ok
yes, I understand, but it shouldn't crash the server because it's not the server thread~
you are blocking on that request, waiting for it to finish on the main thread
and it's taking way too long to complete
therefore, the watchdog trips
~
but why is the request on the main thread? That's what I don't understand
it isn't
the request happens on a separate thread
but you make the main thread wait on that thread to finish the reuqest via CompletableFuture#join
and how do I solve this? decrease t imed out?
https://paste.md-5.net/puwuwisopo.coffeescript @eternal night
So do I have to have the method return completionablefuture and deal with completionablefuture to access the backpack?
And can you tell me a good timed out value? I think it's currently 30 seconds, but I think it's too high because it's on the same server
yes
But you should cache the backpack data
i love decompiled code
I must then keep all created backpacks in cache and only update the database when there is an updated item in the cache
But in cases where you can only go to the DB once per player, I shouldn't keep everything in the cache, right?
But when a query has nothing, shouldn't it return empty?
What
@Override
public Backpack findOne(String name) {
return database
.execute("SELECT * FROM backpack WHERE name = ?")
.readOneWithAdapter(statement -> statement.set(1, name), adapter)
.join();
}
If there is nothing in the db, will the join stop the thread for the seconds configured in the mysql config? or does it simply return empty and will return null?
i have this nms method, and it works 50/50. I mean in some coordinates its just not showing blocks (blocks are filled totally)
public void setBlockInNativeChunk(World world, int x, int y, int z, int blockId, boolean applyPhysics) {
if (nmsWorld == null || this.world != world) {
this.world = world;
this.nmsWorld = ((CraftWorld) world).getHandle();
}
int chunkX = x >> 4;
int chunkZ = z >> 4;
if (this.x != chunkX || this.z != chunkZ) {
this.x = chunkX;
this.z = chunkZ;
this.nmsChunk = nmsWorld.getChunk(chunkX, chunkZ);
}
LevelChunkSection[] sections = nmsChunk.getSections();
int y4 = y >> 4;
LevelChunkSection section = sections[y4];
BlockState existing;
if (section == null) {
existing = Blocks.AIR.defaultBlockState();
} else {
existing = section.getBlockState(x & 15, y & 15, z & 15);
}
BlockPos blockPos = new BlockPos(x, y, z);
nmsChunk.removeBlockEntity(blockPos);
if (section == null) {
sections[y4] = sections[y4 << 4];
}
nmsChunk.setBlockState(blockPos, Blocks.STONE.defaultBlockState(), false);
this.nmsWorld.getMinecraftWorld().notifyAndUpdatePhysics(blockPos,nmsChunk, existing, Blocks.AIR.defaultBlockState(), Blocks.AIR.defaultBlockState(), chunkX, chunkZ);
}
every 2 chunks blocks are shown and 2 chunks not shown (but blocks exist)
https://imgur.com/a/InymnBS @young knoll
If it returns empty, it doesn't crash....
It's not join's fault, it's something else's fault
It's bukkit's fault
Facts
I'm also creating async itemstacks, I can't do that, right?
no
command /offhand:
trigger:
if player's tool is not air:
set {_item} to player's tool
set player's offhand to {_item}
send " " to player
else:
send " " to player
Guys it doesnt work can someone help
what is it man
i see it, but it is code in yml file?
this looks like skript
yes
It is
wha
its not really development
UP
Ok
its a glorified scripting language even worse than kotlin
most people in here know about java development for plugins
Jo
if you want support on skript syntax or bugs you would have to ask in a server that supports it
why bukkit methods slower than nms?
well, shockingly, bukkit has to call the nms so it has extra overhead probably
bukkit methods sucks
true
just switch to fabric at that point
hey kotlin isn't bad even purple said that yesterday
is there a distinction made from pressing buttons for the hotbar and scrolling through it?
not that I know
kotlin baad, java has more hacks and features
you used it comparatively and that made kotlin bad sounding
well yeah that was the point of the joke I guess
tell me you've never used kotlin without telling me
but its still a valid opinion
...that's the point
sorry but 10 minutes aint enough to do anything
even if you read through the docs for 10 minutes you'll know it has more features than java lol
java has all the kotlin features
yeah it should have more features compared to java because its built on java
..no?
how do I use kotlin builders but in java
use lombok builders
wtf is lombok
compiler fuckery
the fact that lombok isnt in the standard language feature set says enough
if it was really that good it would be in standard java
lombok is java library
right
tell me you've never read this without telling me
you kinda proved kotlin is better by saying you need a library to get java closer to kotlin
what is so funny about this
"better"
What's stopping you from using java libraries?
the fact that I don't need them :p
because you use kotlin ☠️
Yes
yea and I don't need to rely on any other libs like lombok for that
How dare you summon me
hi 14b
Hi
Hey, can someone here recommend a command framework for 1.21
1.22
Once you've downloaded the kotlin, you've downloaded the lombok features.
acf or cloud
what 💀
commandapi is good too
maybe bad translate
I think what he means is that this kotlin code:
class Foo {
var name: String? = null
}
Will produce:
private String name;
public final String getName() { ... }
public final void setName(String name) { ... }
In Java
forgot the class definition there buty ea
Oh yea
Do you know any more command apis that are like heavily annotation based
ACF
@Getter
@Setter
private String name
also @ivory sleet have you banned the gongas kid again? :D
Would you happen to know some GUI frameworks
ugh wait what
interfaces, inventoryframework
@ivory sleet
?gui
alright, ill keep an eye, ty for the info :P
update intellij and use java 21
I do use java 21 but does this mean that intelliJ will show this as an error but it would work anyway?
What IJ version are you on?
You just won't be able to use 95% of bukkit classes
So update to a 2024 one
god I love early day classes
what
Is there any event called before player change worlds so i can cancel it if needed? PortalEvent is not suitable
PlayerChangedWorldEvent
why is it not suitable?
can't cancel it nvm
Changed is after player changed worlds
Because i am teleporting player to worlds that are not accessed via portal
PlayerTeleportEvent??
Why are you trying to cancel change world?
Just asking because there could probably be a different approach
Because i am teleporting player to worlds that are not accessed via portal
teleport event would work
I'm not sure what he meant by that. I'm confused how you would cancel changing worlds without cancelling the teleport. You could just use teleport event and check the destination world
I am making a system where players process an ingredient into a product, and takes 10 seconds per item they process. I want them to start the process with a GUI button or whatever, and then they can sit and wait while it slowly processes their entire stack of items one at a time. I tried doing this with multithreading and it created some really weird lag and bugs.
Here is the code I used:
@EventHandler
public static void lab(InventoryClickEvent event) {
Player player = (Player) event.getWhoClicked();
int amount = Math.min(LabManager.getIngredientAmount(player, Material.KELP), 64);
for(int i = 1; i <= amount; i++) {
System.out.println(player.getLocation().distance(LabManager.getLocation())); //NEVER CHANGES, EVEN WHEN MOVING???
if(player.getLocation().distance(LabManager.getLocation()) > 6) {
player.sendMessage("You moved too far away");
break;
}
ItemStack ingredient = findIngredient(player, Material.KELP);
try {
Thread.sleep(10000);
} catch (InterruptedException e) {
e.printStackTrace();
}
ingredient.setAmount(ingredient.getAmount() - 1);
addItemAndDropExcess(player, ItemManager.getKelpProduct());
player.sendMessage("Processed 1 Kelp (" + i + "/" + amount + ")");
}
player.sendMessage("Done Processing");
The distance from the player to the lab never updates, even when I move further away. It gets stuck at the player's position when the loop starts. If the player moves far away, the loop continues, but then they get teleported back after it completes. ALSO, the item stack of ingredients stays full and everything gets removed at the end, rather than one at a time as the loop goes.
What am I doing wrong??
the whole server?
yes
why do people hate lombok
oh wait
I forgot I removed the Bukkit runnable
no theres multithreading in there
Don't use thread sleep
You have no reason to do so
Just schedule your task in 10 seconds
No, you need to make a new thread if you're sleeping else it will sleep the main server thread, regardless just use runlater
the whole for loop was inclosed in this:
new BukkitRunnable() {
@Override
public void run() {
}.run();
That will run it next tick
Bukkit.getScheduler().runTaskLater()
compilation fail, missing a }
it was there in the actual code
Right, still use runLater
so if theres a whole stack of items and one should be processed every 10 seconds until it is done, how do I schedule each one?
ah unfortunate
for i loop
You could use recursion until a condition is met and keep running the runnable, but there could be better ways
schedule each one for (i * 10 seconds)?
yes
got it thanks
one problem with this is that i cant break out of the loop to cancel processing halfway through when something happens like the player leaves the area
how do I cancel the current and all future tasks if I need to?
You could use a hashmap / list of players that are currently processing, then if they move in the move event break out of the loop
but if they start processing again and there are still scheduled tasks from their previous interaction, it will continue
then in the loop check if its still in the processing list, or create a new object that has isProcessing and set it to true or false, and query on that in the loop
