#help-development
1 messages Β· Page 1163 of 1
no because I'll use custom model data, so I need to use an ItemDisplay
is bukkit yml busted
yes
for (final String key : MESSENGER_FILE.getConfigurationSection("texts.contact-gui-letters").getKeys(false)) {
HEADS.put(key, MESSENGER_FILE.getString("texts.contact-gui-letters." + key));
}
You can loop getKeys(false)
yes
using ItemDisplay the one you want is alwasy going to be a positive Y distance
from the broken blocks location
what do you mean ?
ooh okay
and what about the X and Z ?
the display you want should always be +0.4 on all axis from the broken block
so I substract -0.4 ?
block location + 0.4
here are the locations for this configuration
shoudl give you the ItemDisplay location
ye that worked thanks Olivo
when breaking the top left one, it breaks the bottom right one
okay thanks
it may be +0.5 but try it and see
okay thanks
Block location is based on its corner, ItemDisplays are centered
I see
so shoudl alway be +0.4 or +0.5 to find the correct display
so I need to make it's position like a block/BlockDisplay
block.getWorld().getNearbyEntities(block.getLocation().add(0.5,0.5,0.5) ,0.1 ,0.1, 0.1)
you can also predicate for an ItemDisplay too, then you'll only get teh one
can i make like huge itemdisplays just in spigot
I already done it
okay thanks
yeah just change the scale
rn im using armorstands is ther another way to do itemdisplays
believe you can't force close the player inventory
since its always open
They probably have some listeners that prevent inventory closing
Should work if it's open is it really open when you call the close?
Is it flickering?
nah they dont
literally nothing
u can close it normally if u want
but when u call that method
nothing
What version?
are you calling close in a click event?
1.19.4
You're doing something wrong here
yes
Ohppee
InventoryClickEvent consumer
aight thanks g
in the javadoc for the click event
?jd-s
Hey hey, i updated my spigot api for my plugin from 20.1 to 21.3
in this update, i noticed that Enchantment.DURABILITY seems to not be a thing anymore. and it now is Enchantment.UNBREAKING. But i currently found out by breaking my code,
However, i was wondering if there is a changelog where i can find everything in a nice list just like mojangs changelog?
is it possible to make itemstacks amount like 1, but like actually show the number 1
no
swear ive seen it before
but that probably is a mod and not a plugin
na obv not
plugin is only server sided, while that number is client sided
kk
The visual number i mean
not the quantity ofcourse
Resource pack probably could do that
Just retexture every item with a 1 kekw
if you are going to do that, i would just retrexture the base model to have a second layer that contains the 1 if i where you. saves a lot time since you dont have to texture them all individually
and besides, its also pretty much the only way to do that for the 3d items
But before you do that, If yea want the 1, you can also think in alternative ways. Is there for example an empty item slot nearby (below, or on the right for example)
What you can do is in that itemslot, place an item that you retexture to be the one, and make the texture with such an offset that it apears to be 1 slot highter / 1 slot to the left
a good example are these locks and checkmarks for example. Those are not actually part of the item below it, but instead are in a slot above it
hey, i made a new project on IntelliJ but instead of showing life com.fourseven.skyblock like a package it shows as separated directorys, also i can't create packages, i just can create directories
Use a build system. And reload it
Maven or gradle
i thought abt that, but i wasn't that sure, it does work
ty
so i'm doing a plugin recode and copied the pom.xml, reloaded IntelliJ and now i have my proyect skyblock-recode like this
sorry if it's a stupid/easy-to-solve question
ur module name is different from directory
I know, how can i un-do that?
I just copied the proyect i want to recorde pom.xml but that happened
u can move things where they need to be lol
My module name turned into the other plugin name
and the directories i created for the recode are now inside the module
See the developer notes on the release post
It usually gives a brief overview on the major changes
Hello, what is the wiki to see how is made the packet for PacketType.Play.Server.ENTITY_DESTROY ? (I want to get the entity involved)
thanks
np
also
wiki.vg has mojang mappings, you can search spigot mappings in mappings.dev
Wiki vg doesn't really use any specific mappings
okay thanks
no problem π
Did Attribute constants got renamed in latest API? My plugin code seems to be broken after the update to 1.21.3
seems like the pom created (in its sense missing) directories/modules for it. Personally I redo the pom manually in such a case just to update everything and often its not too much work. I would just move/rename your packages to desires place/name, update the pom accordingly and call it a day :)
A couple of things got renamed
but your old plugin jar should continue to work
Yeah, but it results i forgot the directory "java" so i wasn't able to do a lot of things, then reloaded maven and all good
Or if you're trying to compile against the newer version you'll need to change the code
I know the server will do some ASM magic for me. Uh I'll have to face the tough renames in code...
tysm
afaik basically do what the name says, patch some stuff over other stuff, like patching a road and putting new stuff ontop of old
olivo said it better
But what do they exactly do?
yo, offtopic but this looks really good
On their own nothing much, but they're used to apply the changes they contain on to another file
Basically turning the old file in to the new file you want
A patched file if you will
Ohhhh like they modify the file
For example Spigot uses patches to take the decompiled code and apply their changes on top
Ohh i see
Microsoft restricts others of constributing modified software of them, so by having patches the original source code is used as a base and only modified at the users end, basically a way of altering software without breaking their policy
Legal gray zone
But why do forks use that? can't they just grab the code in java and manually code it? (sorry if im so wrong)
Oh yeah i totally forgot about that
changes does not work without original code
they are just patches
But is it possible? maybe if i want to do a private fork
Yes but you're not distributing the original
which is what i said, they use the original source code as a base which is then modified
Afaik you can use microsoft code just for you, right?
True as buildtools download it from Mojang server, which is legal
Yes but just a bad idea
Oh alright
kinda funny how it can get really messy easily
that is what Hypixel does
they have Hygot
Doubt
Yeah, that's why i thought abt that
for example, paper is patching spigot which is patching bukkit which is patching the original source
No need to go that route
yeah that is a chain....
You can just use the patch tooling on your private fork too
Yeah LMAO
yeah as well as your fork users could access your patches according to GPL license?
And it will ever be
it is interesting to have GPL on Bukkit
it totally does not work with Mojang code but still exists so what is the meaning of it
just protect Bukkit itself?
I wonder what's CraftBukkit creator doing right now
I had no interest on these legal issues as current dev env had solved this for us but interesting to learn why
Bukkit is just the API so it works fine
until the number climbs to a point, where we have a 10 adic numbers eventually representing 0 ;--;
CraftBukkit is a bit different
dinnerbone still works for Mojang and idk where is EvilSeph
Bukkit is API CraftBukkit is server
yeah i wonder bout evilseph
yeah so is GPL applicable on CB code?
I remembered that CB uses LGPL
awww
i'm so glad evilseph and md_5 didn't forget about the project after EULA update
yea
yeah
then we wouldnt have spigot, paper, purpur, pandaspigot and all the other forks out there all depending on each other
yeah Spigot is where the modern MC server plugin modding begins
altough spigot isnt used much anymore its one really important piece of software we have to keep going
If spigot is discontinued every fork is too
basically
will not but will lack of a strong dev power
Well... not if paper hard forks and becomes their own thing.
i know paper had some plans on hardforking, but thats not really a good option, spigot is really the backbone of everything
so Spigot is still important for everyone
Minecraft servers would not be that famous without craftbukkit
yeah really not good as devs will have pain on incompatible changes
but what incompatible change will happen if hardfork really happens?
will all Deprecated Spigot methods in Paper got removed?
in the case craftbukkit and spigot got discontinued on EULAs changes, servers would still in 1.7.10, servers would not be popular or they would be so many forks out there
Probably :kek:
I don't like incompatible class change errors, really painful haha
Sometimes I think back to mojangs 'Modding API' which has never seen the daylight because 'theres so many community option available so an official api is not necessary but then on the other hand, just these immense constributions like spigot, forge, paper, bukkit, fabric etc etc, im kind of glad they never did it, especially as we're now basically capable of doing what their api would allow us to without their api
Hello, I want to reproduce EntityRemoveEvent for before 1.20.4 by using Protocollib
Everything is working except the fact that the packet is sent after the entity was deleted, so how can I get the entity before it's deleted ?
i recommend using last spigot version
I want to support a bit of other version
1.20.4 is REALLY young
i mean you can use viaversion
just give it a try first, if it work then you can do backports
and viabackwards
I already gave it a try
so it works on 1.20.6 but not on 1.20.4?
I want to support more, but EntityRemoveEvent doesn't exist before
it works on 1.20.4 because EntityRemoveEvent already existed
then you may have to implement it yourself
have you ever checked CraftBukkit source?
but I want to support before 1.20.4
what's entityremoveevent
i can post a paper plugin as a resource under spigot right?
imma go read javadocs
no
I need to do some nms tricks ?
where would it be posted
if it is Paper-only then go hangar
?whereami
it's when a Entity die, instead of a Living one for EntityLivingDeath or smth like that
"Called when an Entity is removed.
This event should only be used for monitoring. The result of modifying the entity during or after this event is unspecified. This event is not called for a org. bukkit. entity. Player."
what makes it paper only
you can look at the patches applied in the newest version and try to recreate what theyve done in your desired version
using any paper-only methods
if you have only paper-plugin.yml as the plugin descriptor then it is
why not to use EntityDeathEvent?
that is how I define Paper-only plugins
cuz i've seen paper plugins posted as a resource
Why not use the EntityDeathEvent
declaration: package: org.bukkit.event.entity, class: EntityDeathEvent
Because my entity is a ItemDisplay
that's an entity
it's not a LivingEntity
It's not a living entity
They may just have better functionality on Paper as they could support Spigot for basic option
yeah right
patches are files or directly in code ?
saw it, sorry
files containing patch code
diff files, they tell you what was removed, added etx
interesting
But it will be tough to read patches instead of patched code
where can I find them/patched code (so what I need basically) ?
You can open Spigot-Server as a maven project in your buildtools work dir directly
then just search for references to what you want to see then you'll found how it works
declaration: package: org.bukkit.event.entity, class: EntityRemoveEvent
Update spigot
so i wanna post my plugins on spigot, and i've heard paper has more things and most servers are paper, spigot works in them too. should i use paper or spigot?
look at jd
a really common issue. That is up to you
what things does paper have that spigot doesn't
is it anything that is used often
Actually my preference is Paper as I'm a minigame dev and Paper acts actually better on minigames
if you wanna post your plugins @ spigot mc page, you need to use spigot api
Paper has stuff that spigot doesn't have. So if you utilize those things that paper offers, then your plugin will not work on spigot.
You need to check some kind of hit or health event
just more API for plugin devs and better performance for users
seems interesting
When health reaches 0 run your custom event
What's the difference between 20.0 TPS and *20.0 TPS
there is health for ItemDisplay ?
*20 TPS has a star
Approximation
All entities have health
LivingEntity be like
Items have like .5 if i remember right
yeah but didn't though it was monitored
equals to entity instanceof Damageable
why does it show 20.0 TPS and *20 tps?
they're either dead or alive
so if it is damageable it should have
THIS IS PAPER AAAAHHH π£οΈ π₯
They technically do, that is why they can take damage sometimes and instantly die
You can also implement the event specifically in different modules
eh
that is common structure for plugin dev
Not properly
create event by yourself Β―_(γ)_/Β―
but DamageEvent works on them then ?
techinally right but is there a value tracking health?
afaik vehicles have health, and they aren't living entities
frosty don't try to debate over this imma just copy-paste the entire nms entity class and whoop your ass
Imagine if it was pushed upstream. :3
imagine :O
then see Paper source to know how it works
and implement by yourself, it seems to be tough but really a working way
So I just wondering if API backports is possible on Spigot?
Bro just do it by yourself
we can just imagine as current API does not cared this situtation....
I'll just try, it costs nothing
Wdym?
Items do have health. Nbt tag says otherwise
Items have a health of 5 and reduces to 0
Items have health and they happen to be non-living, this doesn't mean that every non-living entity has health too
For example, marker armorstands
Or area of effect clouds
pretty sad
you mean like, spigot accepting API backports? That's a no
Armorstands have health too. Just if they are invisible they are invulnerable
I monitored 4 killed rabbits
you are free to fork Spigot and backport API there though
but not my ItemDisplay
yes so I was just imagining
ideally, you use something like Ignite so you could backport API between multiple versions with a single plugin/coremod
Whoah, Mixins on Bukkit?
really hackful but useful on private use, not suitable for distrubted plugins
as I don't think will it work with hybrids as I'm a cross platform dev haha
But they do have an invulnerable tag lol. But you are right it doesnt appear they have health from the docs.
I would have to look at mc code to see exactly what it does though
there's only one hybrid, and that's spongeforge
would barely call that an hybrid considering it was built from the ground up to be compatible with forge
anything else is just a disaster
there's solutions like architectury but it doesn't support bukkit so it is all the same
hum
I've got the patch that I need
but I don't really see what to do with it
should I just loop every tick for killed ItemDisplay entities ?
and check with the old list, and get the killed entity in the old list basically
I'd try weak references to the entities
just caught up with the whole convo, this should work, more or less
we should have a command like ?downgrade that answers with the md_5 answer to a thread
eh, those commands are somewhat aggressive, ideally you just answer their question with a warning that it is unsupported so they'll have to figure stuff out
most if not all of the support threads are for older versions too so it is hard to expect people not asking questions about older versions
discord killed any kind of searchability issues with spigot/paper had
maybe you'll need to see where fires EntityRemoveEvent
it's useless to check that kind of thing, since it often hooks into inaccessible code from a plugin
yes maybe tough in that situtation but will be good as a start to understand it
I already done that, it's unreachable from my plugin as said
π
a good idea for trial, but need optimization
sure
-# just hook into the method with CGLib
their readme said it no longer work well in newer JDK
would have been hell anyway
particularly 17+
ah, that's a shame
they had suggest ByteBuddy as fallback haha
it made hooking into methods you didn't have access to really easy
bytebuddy is fine, but it isn't as easy
yeah I've used it before but its API confuses me
still, if I wanted to do some serious backporting of functionality, I would probably go that route anyway
for private use it is ok but still not good for public plugins
eh, it is fine
there's a couple of plugins which do it
as long as it is done for versions that aren't updated anymore that is
since behavior isn't going to change
then I think they have some good way to do so if they really implemented something we can't imagine
anyhow, I gotta keep reading this scala book
I can't concentrate more than 5 minutes, my brain is broken
Did they change the head rotation packet for 1.21.3?
Does anyone know why PersistentDataContainers are not saving any data to the player?
bro this old username
same and they really want you to pay like $10 to change it
what
how is it not saving data, like, you restart the server and it isn't there?
Mb, it just doesnt save at all
that just leaves me more confused lol
when you set into the PDC, it should save the data to its respective playerdata
though I don't know if it does so as soon as you write it, or it is done in batches to avoid doing too much IO
the way minecraft handles saves is rather (unfortunately) undocumented
Is there a method I have to call to initialize the change maybe? π
/save probably works? lol
or was it /world-save, something -save
it should do that automatically, but maybe you're closing the server before it has the chance to
though if you close it the proper way, it should definitely save before close
Is it possible to save pmc and get those new changes in the same method?
Ah Iβll just send my spaghetti code which isnt working
Pastebin.com is the number one paste tool since 2002. Pastebin is a website where you can store text online for a set period of time.
Alright so Iβll briefly explain what Iβm doing to test this.
Iβm adding a player using /trust add (player) but when I then do /trust list it shows an empty list
More context - this is part of a command class π
I mean, your list command only seems to be sending whether the key exists or not, unless you've cut up the logic that actually sends the contents of the list
I gotta ask even though unrelated to your question, why in the lord's name is there an atomic reference there
That might be dead code holup
Nvm itβs in a foreach loop of a list of all the playerβs online
what does that have to do with an atomic reference
did you use it so IDE wouldn't complain about the perceived lifetime of the variable?
you can just use an array with a single element if that's the case
an atomic reference however has thread-safe checks which are overkill for whatever you're doing there
or just use a regular for-loop
It was a suggestion from Intellij yes π
Not sure exactly π
Oh alrighty
String playerName = null;
for (Entity entity : worldEntities) {
if (entity.getName().equals(strings[1])) {
playerName = entity.getName();
break;
}
}
you should just be able to do that
no reason to use a foreach there
Ohh ty
as for you issue PersistentDataContainer#get might return a copy of the list
so you'd have to set it back after you mutate the list
and i will also say your (im assuming) limit of 30 trusted players is done in a very convoluted way
just check if the length of the list is >= 30 or something
if it is don't add the player
Ohh ik dw π I just for some reason didnt want to set the list size to something like 255 for some odd reason
Iβll change that later
lists can be any size?
Ohh alrighty
they allocate memory dynamically
Iβll try that when I can
Using list.add on the list gotten from pdc.get throws an UnsupportedOperationException
oh i see why
its because #get returns an immutable view of the list
changes to the original list are reflected but you aren't able to make any modifications yourself
For that I would use pdc.set?
create a new ArrayList<>(trustedPlayers)
modify that list
set the pdc back to that list you just created
yeah np! if you encounter any more issues feel free to ask again
Ty !π
what's the best way y'all know to make a singleton
Enum
Effective java
Item 3
// Enum singleton - the preferred approach
public enum Elvis {
INSTANCE;
public void leaveTheBuilding() { ... }
}
This approach is similar to the public field approach, but it is more concise,
provides the serialization machinery for free, and provides an ironclad guarantee
against multiple instantiation, even in the face of sophisticated serialization or
reflection attacks. This approach may feel a bit unnatural, but a single-element
enum type is often the best way to implement a singleton. Note that you canβt
use this approach if your singleton must extend a superclass other than Enum
(though you can declare an enum to implement interfaces)
please don't do this
the benefits of this over just doing a normal singleton with a static final class are not worth the unreadability of that code, the intent isn't clear at all here
@chrome beacon
I saw this re-linked in general
https://hypixel.net/threads/dev-blog-6-keeping-up-with-the-masses.2251554/
We added an ID to the NBT compound, then when we first compare items, if they are equal we sync up their IDs and we know for certain that theyβre the same, we also track the parent of each NBT Tag, so when something changes within it we change the ID and thus the process begins again, this makes it much faster for us to do just as many comparisons.
How possible do you think this would be for the item monitoring plugin? There'd definitely have to be a bunch of checks (and NBT calls, obviously) so that vanilla functions as expected, but I think that it would make things easier?
Hey!
This is another one of those in-depth dev blogs in which we explain what happens behind the scenes to maintain a seamless experience for you, the players. Today we're going into a little more technical post since we'll be talking about how we were able to scale from 30,000 players to...
:)
Hm what does that have to do with me?
I've never said they don't mess with nms
What I did say is that they most likely still use the patch tooling
recreating it with spigot & NMS calls. Think that's relatively better than maintaining a completely separate list of items & stuff
Couldn't modify spigot directly so there'd be some pain to it but if it would be better done this way then it could be worth writing all the utilities and listeners needed
well it looks like you're not setting the Lore tag if it does not exist
Are you just modifying vanilla code ?
With MCP or something ?
Well I wish you the best of luck with whatever you're doing
'cause that version is incredibly limited and has shitty code as far as I know
public void sendActionBarWithFade(Player player, String message) {
// this is the fade in code
int defFadeInTime = 1;
for (int i = 0; i <= defFadeInTime; i++) {
Bukkit.getScheduler().runTaskLater(plugin, () -> {
player.spigot().sendMessage(ChatMessageType.ACTION_BAR, new TextComponent(ChatColor.RED + message));
}, i);
}
int defSecondsLeft = 15;
for (int secondsLeft = defSecondsLeft; secondsLeft >= 0; secondsLeft--) {
int delay = defFadeInTime + (defSecondsLeft - secondsLeft) * 20;
int finalSecondsLeft = secondsLeft;
Bukkit.getScheduler().runTaskLater(plugin, () -> {
if (finalSecondsLeft > 0) {
player.spigot().sendMessage(ChatMessageType.ACTION_BAR, new TextComponent(ChatColor.RED + message + " (" + finalSecondsLeft + " seconds left)"));
}
}, delay);
Bukkit.getScheduler().runTaskLater(plugin, () -> {
player.spigot().sendMessage(ChatMessageType.ACTION_BAR, new TextComponent(ChatColor.GREEN + "You are no longer in combat. You may leave the game now"));
},defFadeInTime + (defSecondsLeft + 1) * 20);
}
Bukkit.getScheduler().runTaskLater(plugin, () -> {
player.spigot().sendMessage(ChatMessageType.ACTION_BAR, new TextComponent(ChatColor.GREEN + "You are no longer in combat. You may leave the game now"));
}, (defSecondsLeft + 1) * 20 + defFadeInTime);
}```
Can anyone tell me why the final "You are no longer in combat. You may leave the game now" message won't show up for 20 ticks after the countdown
what are you trying to do
an action text countdown, 15 seconds to 1, then it says "You are no longer in combat" in green text
i made it a method so i can use it in my combat thingy
and why the weird fade thing?
yeah
ill remvoe it
i thought it was going to act like a fade effect like in titles
but action bars are stiff, they dont have any fade effects
They do?
You just can't change it
yea, no need for fade effects
but can you help me with the problem
the final message wont show
public void sendActionBarWithFade(Player player, String message) {
int defSecondsLeft = 15;
for (int secondsLeft = defSecondsLeft; secondsLeft >= 0; secondsLeft--) {
int delay = (defSecondsLeft - secondsLeft) * 20;
int finalSecondsLeft = secondsLeft;
Bukkit.getScheduler().runTaskLater(plugin, () -> {
if (finalSecondsLeft > 0) {
player.spigot().sendMessage(ChatMessageType.ACTION_BAR, new TextComponent(ChatColor.RED + message + " (" + finalSecondsLeft + " seconds left)"));
}
}, delay);
Bukkit.getScheduler().runTaskLater(plugin, () -> {
player.spigot().sendMessage(ChatMessageType.ACTION_BAR, new TextComponent(ChatColor.GREEN + "You are no longer in combat. You may leave the game now"));
},(defSecondsLeft + 1) * 20);
}
}```
Here is the code without the weird fade thingies
just run a timer task lol
timer task? those exist??
task timers
good idea iβm going to use timer task for myself
I want to give players Enderman vision via packets.
man.setAI(false);
ClientboundSetCameraPacket cam = new ClientboundSetCameraPacket(((CraftEnderman)man).getHandle());
ServerPlayer cp = ((CraftPlayer) p).getHandle();
ServerGamePacketListenerImpl ps = cp.connection;
ps.send(cam);
man.remove();```
Problem is that this will teleport the player into the entity and even removing it makes the player unable to move afterwards.. It's liike being in Spectator mode without being in spectator mode. Only way to come around this is killing the player, afterwards he is able to move + has the vision.
Anyone know a possible workaround?
possibly just packet log the packets that are sent when you exit endermen from spectator mode and send those
Sounds promising, gonna try that ty.
And why not just use the API?
Didn't know spigot had it
declaration: package: org.bukkit.entity, interface: Player
Player has to be in spectator mode for this.
Setting the camera in other gamemodes is extremely buggy and is rather UB
hii
UB?
Well I want that vision in any gamemode with free movement for the player.
undefined behaviour
alr
Not possible I believe, since the players camera needs to be set to an enderman which also locks the position
If you kill the entity + the player it does work.
Problem is just that I want to avoid the "killing" the player.
Well hard to kill em without killing em kek
that still sounds very buggy lol
Yes thats why I am looking for an alternative way?
shader in a resourcepack
Not without UB
none of that is supported
Honestly just do this ^
You can copy the vanilla shader into your shaders and trigger it based on game time
so i saw this deprecated, is there any method i can use instead?
oh alr ty
iirc player teams are just entries with the players getName()
i've just realised that hybrid of both spaces and tabs is the best imo
prove me wrong
for example i have such table:
Name\tType
Foooo\tCat
Bar\w\w\w\tDog
this would allow me to adjust spacing between columns but wouldnt alter leading padding of the Name column with Bar as a Name
that's such a stupid deprecation reason lol
i mean it doesnt really represent the intial purpose of the scoreboard system in minecraft's nms code
but yeah
just because teams can contain more than just players doesn't mean that method should be deprecated
why not let me get the team of a player? players are valid team members
i guess spigot is trying trying to thin out the line between Bukkit API and NMS lately
yeah lol
getEntityTeam isn't deprecated, so I can pass an Entity, but i am not allowed to pass an OfflinePlayer? π
sigh
damn, yea that method is deprecated since 2015 
nvm me i'm lookingat the wrong jd run

i blame papir run
papir
where are you running
the rainbow road
Hello, how can I do a synchronous bukkit task from an asynchronous task ?
Use the scheduler runTask
Hello I wonder whether there is a way to place a sponge to not soak up water, like any property or something. I already tried:
-sending block change to the player that the sponge is there (even if it is not), but this works weirdly for example if I send another block change on top of the previous one
-setType(Material.SPONGE, false /*Physics*/)
but none work
I know I can cancel the absorb event but I wonder whether I can just somehow switch off this behaviour
the actual thing I am trying to do is to immidiately place the sponge down, but make it absorb water in stages (customly)
You need to use the event
Hey, I have this code using NBTApi to put a NBT on an item (made for blocks especially) and i can't pass a door (1.12.2) (Material.WOODEN_DOOR or any type of doors)
public void giveTierBlock(Player player, Material material, int amount, int tier) {
ItemStack item = new ItemStack(material, amount);
ItemMeta meta = item.getItemMeta();
int life = getConfig().getInt("tier." + tier);
List<String> lore = new ArrayList<>();
lore.add(" ");
lore.add("Β§8[Β§7TierΒ§8] Β§c" + tier);
lore.add("Β§8[Β§7HPΒ§8] Β§c" + life);
lore.add(" ");
meta.setLore(lore);
item.setItemMeta(meta);
NBTItem nbti = new NBTItem(item, true);
nbti.setInteger("Tier", tier);
nbti.setInteger("Life", life);
player.getInventory().addItem(nbti.getItem());
}
Hi can I make my plugin carries a datapack just like mod?
I want to make wither no able to break blocks, so I want to add all blocks to #minecraft:wither_immune
Probably easier to just use a plugin for that
EntityExplodeEvent/EntityChangeBlockEvent iirc
Do I have to stop using creaturespawnevent for my mob plugin because I need to spawn mobs on blocks like clay?
When is creaturespawnevent called? Is it called when the chunks are loaded (chunkloadevent) or is it simply a runnable that goes through all players and selects a coordinate for each nearby player and calls the creaturespawnevent for that player?
can someone help me with my code? i made this countdown thingy for my combat log plugin, and im having trouble with the countdown. I want my countdown to restart everytime a player hits someone but it only registers the first hit.
yo
can text displays have more than one color
like background color
or if i wanted more than one background color i would have to use more than one text display
all i see is this
You'd need more than one text display
int y = world.getHighestBlockYAt(x, z);
Location randomLocation = new Location(world, x, y, z);
player.teleport(randomLocation);
Will this suffocate the player?
No...
why would it....
Since, it's getting... The highest Block at that location?
I don't need to add +1 to Y?
What would they suffocate in air?
so the returned block is always air?
If you want them to be on top of the block yes
Last time I check my feet to suffocate
wdym
The players feet will be inside said block
getHighestBlockYAt corresponds to the coordinates of an AIR always?
Since ur getting the location of the block
It's going to return the highest Block, that most likely, don't quote me on this is transient
Isn't*
So a solid
So the players feet will be inside the solid block?
Yes
Do + 1 if you want them above, but they won't suffocate either way
I don't know why this isn't happening
What is happening?
my feet are in AIR
and the block below the feet is a solid block
Without the + 1 or with?
i'm using getHighestBlockYAt but is the same thing ig
That's what the API says
Maybe Minecraft itself handles unsafely teleports
everything is ok then
You said it was a solid but it's an AIR
if thats incorrect, it sounds like a bug
Try logging the location and look what's at that location
yeah makes sense
btw do u know the method to make the text bigger
on a text display
cant find it
The transformation has scale
ah yeah
final Transformation transformation = header.getTransformation();
transformation.getScale().mul(10);
header.setTransformation(transformation);
its not getting any bigger
theres no setter for setScale tho
Make a new transformation
yh
final Transformation transformation = header.getTransformation();
final Transformation transformation1 = new Transformation(transformation.getTranslation(), transformation.getLeftRotation(), transformation.getScale().mul(10), transformation.getRightRotation());
header.setTransformation(transformation1);
idk doesnt do anything
Is it possbile that if you cancel the InventoryClickEvent because of swapping a item in the inventory to the offend does not work 100% and displays a ghost item in the off hand ?
switch is faster but uses more processing than if (condition || condition || ...) ?
they are two entirely different things
I'm doing this
display.setAlignment(record.isLocal() ? TextDisplay.TextAlignment.LEFT : TextDisplay.TextAlignment.RIGHT);
And putting the text display at a location, but the location is still like the center of the text display
not the allignment
I'm guessing its cuz when I spawn it, this isnt taken into consideration
only after ofc
so what can i do?
Aight before I go copying NMS classes directly into my plugin, any idea on if spigot has something similar to the DifficultyDamageScaler class built into it already? It handles calculating difficulty stuff, used for things like if zombies should pick up loot & stuff like that
NMS class code: https://paste.md-5.net/olosehujoc.java
can anyone help with this please
hello, a death a equivalent to a world changing (according he respawn in a different world) or i need to use the PlayerDeathEvent in addition of PlayerChangeWorldEvent ?
In my mob generation plugin that is being made to replace vanilla mob generation, should I run entity#setRemoveWhenFarAway(false) and do my own task to despawn the mobs? If I leave it true, I can't control the mobs that were despawned because they were far from the players, or can I?
guys is it possible to make text displays too long text only downwards instead of up and down??
For me to control all the mobs that I spawn, can I store them with a List<LivingEntity> or do I have to have a list of all the ids?
I would store them in a list of their UUIDs
if i have a brigidier command how can i register it so it can show up in /help with the info
Nms
And then make your own help command
wat
Bukkit draws from the command map
Which I belive should include brig
declaration: package: org.bukkit.help, interface: HelpMap
grab the servers help map, smack an entry in there
when i register a command through the plugin.yml it shows the description and the aliases and the usage
where would i put that in the helpmap
what is a amendment
Amendment means to add
nvm i was looking at helptopic

You've been coding minecraft stuff longer than I've been using a computer
Hush
π΄ fair
Let that set in old man
?nms
is it just org.bukkit:bukkit:version
Why did I never know that exists
ok thakns
too bad the topic factory requires of a Command subclass
one could create a dummy Command that delegates to brig but eh
ig everyone just believed it was some obscure bukkit feature and would rather replace the help command with a custom one anyway
I did know it existed, but forgot of it for the longest time
hey guys, is there is any solution for this error when running my plugin(to create Target folder, .jar)Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.13.0:compile (default-compile) on project firstplugin: Fatal error compiling: error: invalid target release: 21 -> [Help 1] [ERROR] [ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch. [ERROR] Re-run Maven using the -X switch to enable full debug logging. [ERROR] [ERROR] For more information about the errors and possible solutions, please read the following articles: [ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException
update your Java version, and make sure Maven is using the same version as your project
also, don't use the target/source entries, you can use the release entry nowadays to replace these two
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>idk_your_version</version>
<configuration>
- <source>21</source>
- <target>21</target>
+ <release>21</release>
</configuration>
...
like this
this is my run config: https://i.postimg.cc/x1y3Tz1w/image.png
Why am I seeing the name "ANIMAL"?
entity.setCustomName("ANIMAL");
entity.setCustomNameVisible(false);
Youβll always see it when looking directly at them
but I would like to set a name without being visible
you're using JDK 20
Ctrl + Alt + Shift + S, and where it says project version change it to jdk 21
there is no jdk 21 option here(just amazon corretto), there is openjdk 23, is that ok?
Java is not C#
Why not
Okay but is it Rust?
keen observation
Why bro deleted the messages π
to make you look dumb
it totally worked btw!
CustomFish caughtFish;
do {
caughtFish = simulateCatch();
if (caughtFish == null) return;
} while (!canCatchFish(player, caughtFish));
handleCatch(player, caughtFish);
int xpReward = calculateXpReward(caughtFish.getRarity());
plugin.getPlayerLevels().get(player).addXp(xpReward);
}```
how can i cancel the vanilla drops from this?
if i use event.setCancelled it doesnt allow the player to reel in the rod
e.getCaught().remove() ?
perfect thanks
why not 23
does Spigot also do ASM shenanigans which aren't forwards compatible?
Yes
sadge
hope someone smart enough comes along to standarize stuff like that across the various server platforms so that it stops being necessary to explicitly support newer jdk versions
it isn't about it leaving, it is about figuring out a way to do it without it being a show stopper for newer java versions
Ask the ASM library devs :p
they could if they hired me on
I mean I made inventory PR I can pretty much do anything
too bad they don't hire
yep precisely the issue
meanwhile I'm on a downstream spigot forks payroll to stop the production of the greatest bukkit competitor ever conceived redacted
My bad totally redacted that statement
I mean theoretically it could be a possibility
But definitely isn't
Exactly
certainly isn't
Good, next time itll be john lawenforcement
or john concrete shoes
Speaking of John
john horse head comes around first
He'd start mooing before that happens.
arrow.setVelocity() acting weird? It shows the arrow going not straight from the player.getLocation().getDirection() but even if a block is not in it's visible trajectory it hits the block. What causes this issue and is it fixable?
Edit: The arrow does travel straight but not it's animation or something like that
its travelling from the player's eye level
velocity.length not the height of teh arrow
oh
Is it more expensive to spawn 100 entities in a location even if there are no players nearby or should I check if there are players in that location to spawn the entities?
wouldnt the entities despawn if there werent players nearby?
I already do this but I have a spawn mechanism
And I would like to know the best way to spawn the mobs
define "best". what do you mean by that
only spawn when there is a reason to spawn. No players = no reason to spawn
I have to go through all the players close to a location since most of the time there are players nearby
and checking whether there are players close to this area is checked quite frequently
Check if the area is loaded first
Then you can do some distanceSquared checks if you want
and you don;t need precise checks. Just check chuhnk coords of player to the cunk you want to spawn in. +/- X
That works too
Checking if the chunk that the mob will spawn in is loaded is less costly than going through all the players? It's just that a world has more chunks than players
much less costly
if its not loaded it means there is no player anywhere near
um
you are doing a spwn system?
But isn't going through all the chunks more expensive than going through all the players? There are more chunks to go through than there are players online
yes
You donβt go through all chunks to check if itβs loaded
in all chunks?
How not?
There are more chunks loaded than players too
Yes, that part is already done. Now I'm making a separate system that has more mobs in a specific area
All chunks loaded*
Hi guys, im trying to make that all the living entities that spawn have a chance to be a life stealer, and when it hits a player it takes away from them 1 heart, and once a timer runs up they give it back, also i wanna make that the mob are invisible until they attack a player, the error is that:
1 The mob takes away the heart but he won't gave it back
2 The mob spawn as invis but when it attacks a player it stays the same
https://paste.md-5.net/icehubahuf.java
That's the code
if anyone could tell me whats the error pls
World#isChunkLoaded
alternatively you could pick a random chunk around a player
if that chunk is in your "special area" then, run that special logic
My special area? π³
but this method loops through all loaded chunks. Through all players is less expensive
Are you sure it does that
I suppose so
Iβm going to guess Mojang has some sort of coordinate mapping for chunk lookup
public boolean isChunkLoaded(int i, int j) {
return this.chunks.containsKey(LongHash.toLong(i, j));
}
Does this hashmap not contain all loaded chunks?
the "hash" in "hash map" is very important
how they work
Ok, I saw it here and I already got it
boolean isChunkLoaded(int var1, int var2); Are the ints the x and z of the coordinates?
chunk coordinates
How do I get these values ββthrough x and z coordinates world?
x >> 4 and z >> 4
there's also a isChunkLoaded(Location) in case you didn't see it
and is it possible to get a randomly loaded chunk with cost O(1)?
sure, generate a random number between 0 and size of array returned by getLoadedChunks, then get the Chunk at that index
Ok thank you
Yay efficiency
If only the average developer had more time to care about that these days
That's why it's average xd
This is the most efficient way, right?
public static Location getRandomLocationInChunk(Chunk chunk) {
World world = chunk.getWorld();
int x = chunk.getX() << 4 + random.nextInt(16);
int z = chunk.getZ() << 4 + random.nextInt(16);
int y = world.getHighestBlockYAt(x, z);
return new Location(world, x, y, z);
}
looks good
Bonus points for using << because it looks cool π
actually true and accurate usage of chunk & block coordinates
unbelievably based gigachad
ok thanks
For some reason this chunk (and there are many) are loaded LOL: mobSpawn: Location{world=CraftWorld{name=world},x=-2240.0,y=69.0,z=-6815744.0,pitch=0.0,yaw=0.0}; type: COW
and the world only has players from -1000 to 1000
hold up
you wanna do (chunk.getX/Z() << 4) + random.nextInt(16)
those parentheses are very important lmao
@bold plume
those coordinates looked very strange
let me see
otherwise, + takes precedence over <<, so you end up doing chunk.getX/Z() << (4 + random.nextInt(16))
which is gonna be a lot
i was more so pointing out the fact they were using it
ahem
many people just do * 16 and call it a day lol
negative chunks:

What's wrong with doing * 16 in negative chunks?
you go up not down
Does the compiler not replace * 16 with << 4 for example?
the compiler doesn't really do many optimisations besides constant folding
hotspot does all the cool stuff
was the infestation potion effect added to the api?
iirc the issue isn't with going from chunk to block coords, but from block to chunk coords
except for the edge case where the bits overlap the sign bit but the game will shit the bed before that ever happens
Yea, your issue basically is that int division -10 / 16 isn't the same as -10 >> 4
how do i get methods from a different plugin, ive got the depend: [] in there and the bukkit.getPlugin whatever but im not actually sure on how to get the methods
But in this case the problem would not be with * 16 but with / 16
yeah but it doesn't hurt to be consistent
Add the other plugin to that depends and then import it to your project
After that you should be able to use the other plugins classes
Iβve tried it just says something about the spigot repo
I didnβt put a repo idk what to put
Twos compliment goes so crazy
Fucks me up hardcore
Depends on the dependency
When I'm working with bytes in Java I sometimes forget they're signed
yeah that throws me off at times
Iβll send it in a second
Yes
PotionEffectType.INFESTED
yeah for some reason my gradle wasnt importing it correctly but after restarting the IDE i got it to work ty
Idk if im not remembering correctly but I swear I have used mining fatigue at a value of -1 before and it makes it so the player cannot break blocks without a slowdown of swing speed but I cant seem to replicate this in minecraft 1.21.1 am I just crazy or did this used to be a thing?
they call HEIGHT(c) a lot
what the fuck
that's linux x11 dwm code for you
this code is older than me
its somewhere around 23 yrs old
I knew it
I believe I'm actually changing that code
If I want to send a player to a limbo when they afk in the backend server should I use the plugin messaging channel?
you can do that, yeah
Is there a better way?
Also do I need a plugin on the proxy for that?
Yeah that's fine?
How should I send the player to nanolimbo
Also isn't this a bungee error
anyone happen to have a system for player nametag prefixes using teams for 1.8
is there a way to simulate a player you can control or something
like to test a plugin
or do u need another acc
if you don't have another account, just turn online mode off and you can use one of those bot clients to join the server aside from your usual account
either that, or spawn a NPC, but it won't do anything unless you send the packets to make it do things, which is way too much work for testing a plugin
my usual recommendation instead is to just use a different entity other than a player, since that's easier to spawn and control
does wurst work lol with like the cracked account thing
cuz like i need it to send a command
im trying a plugin and seeing if that works tho first
you can make any entity send a command
can you see like the messages they get
i wanna have like a prompt that says click here and like it runs a command
you can probably use /execute as ... for that, yeah
still, why are you not able to test this by yourself
is there a way to hide a block from a player but show for everyone else
like maybe send the player a packet that the block changed to air
Player#sendBlockChange to air
that'll only "hide" the block for the player in question
though since it only sends the block change, you have to be careful of physics updates and whatnot reverting the change
you mean, to only display warn records, or to make all records warn level
for either choice, you can use a Filter
first
public YourPlugin() {
super();
getLogger().setFilter(this::displayingOnly);
}
private boolean displayingOnly(LogRecord record) {
// or another type of filter...
return record.getLevel().equals(Level.WARNING);
}
damn, not even running that on onEnable?
just going full force in the constructor?
absolutely wild, buckaroo
eh, the place doesn't really matter, the constructor is going to be the earliest so I used that but onLoad/onEnable are just as valid
doing it on the constructor makes the "loading YourPlugin" log dissapear lol
public class VillagerGossips extends JavaPlugin {
public VillagerGossips() {
super();
getLogger().setFilter(this::displayingOnly);
}
private boolean displayingOnly(LogRecord record) {
// or another type of filter...
return record.getLevel().equals(Level.WARNING);
}
@Override
public void onEnable() {
getLogger().info("testing if it warns");
getLogger().warning("should actually warn");
getLogger().log(Level.SEVERE, "testing");
}
}
never realized how sneaky one can be by doing something like this
loading/enabling record should actually be sent from the parent loggger and not the plugin's to avoid this tbh
wonder if behavior is the same on Paper considering they use a completely different logging backend
how would i go about copying world using another world folder ?
like without using worldCreator ? do i need to use NMS ?
hm? Could you not just copy the folder?
Or do you just want another world with the same seed
my template worlds path ./plugins/MyPlugin/template-maps/.
lets say i wanna start a game, so i need to create/generate a new world from the template maps folder (making a new copy)
so i would copy the entire world folder from the template-maps folder into the WorldsContainer (which is .)
then i would rename that folder's name (world name) . and everything is good at this point ..
BUT the issue is i can't just load/get this new world using its folder. i need to use WorldCreator then worldCreator.createWorld()
and this method will make a new world folder with the same name only
irdk what i supposed to do, i just wanna make a new copy of the world thats it.
Create the world using the world creator
It will read your folder as long as it has the same name
this is gonna duplicate the world folder ?
tysm, Olivo
<groupId>czr.fishingServ</groupId>
<artifactId>MainFishingAlgorithm</artifactId>
<version>1.0-SNAPSHOT</version>
<scope>provided</scope>
</dependency>```
is that your plugin?
MainFishingAlgorithm is the plugin i want to use methods from
That didn't answer the question
What was the question sorry
.
Itβs in the pom.xml of my plugin yeah
I was talking about MainFishingAlgorithm
MainFishingAlgoritm is the plugin that i want to get the methods from, MainCustomRods is the plugin that uses those methods
yeah I understand that
So how do i access the methods
Iβm so confused what do you mean? Is it the plugin im getting the methods from or is it the plugin that im using the methods in
I think he's asking if you created that plugin
I am
I want to know if you made the MainFishingAlgorithm plugin that you're trying to depend on
So you don't have a repo for it
No
Run mvn install in that project to use your local one
Alright thanks
Run again in an empty folder
yo does anyone know why morepersistantdatatypes stopped working?
> Could not resolve all files for configuration ':compileClasspath'.
> Could not find MorePersistentDataTypes-2.4.0.jar (com.jeff_media:MorePersistentDataTypes:2.4.0).
Searched in the following locations:
https://hub.jeff-media.com/nexus/repository/jeff-media-public/com/jeff_media/MorePersistentDataTypes/2.4.0/MorePersistentDataTypes-2.4.0.jar
Possible solution:
- Declare repository providing the artifact, see the documentation at https://docs.gradle.org/current/userguide/declaring_repositories.html
It worked fine a few weeks ago, now I load the project without changing anything it doesn't work anymore. I compared it to the example on github and its the same
implementation 'com.jeff_media:MorePersistentDataTypes:2.4.0'
}```
```repositories {
mavenCentral()
}```
It seems my other projects using morepersistantdatatypes get the same error
@tender shard whatd u break
does it not work for you either?
idk, just figured id ping him for u
can anyone with a project depending on morepersistantdatatypes try to compile it pls and tell me if it works
wait how did gradle search alexs repo without it being in ur config
Looks like the repository got removed
bru
yeah thats what im doing
2.4.0 from maven central
and it aint working
Error says it's searching mfnalexs site
and not central
You might have a cached failure, force an update
ok refreshed, its using maven central and it works now
thx π
nice folder name
"fuckit"
LMAO
fukkit? i dont even knowit
bukkit? I hardly know her!
hey, is there a way to tab complete after a custom character instead of only in commands?
You send fake player information with what you want to autocomplete as their username
how would i go about doing this tho?
example use case:
@(tab complete all online player names here)
send one fake player info for each thing you want to auto complete
declaration: package: org.bukkit.entity, interface: Player
this exists?!
yup
USEFUL AF
my exact reaction rn
not me manipulating what players write to the chat by giving them weird chatcompletions

