#help-development
1 messages Ā· Page 877 of 1
what is the name of that site for creating lines for publishing a maven repository on the Internet
for creating lines?
do you mean jitpack?
yes
Hi there! Just wondering, is there a way to check if an inventoryCloseEvent was triggered by a player or my plugin itself?
For example, check whether the player pressed "e" or escape to close the inventory, or whether I did player.closeInventory()?
Thanks!
Why do you need to check that?
Sorry, should clarify that I'd like to do this within an inventory close event listener
I'm working on a gui plugin, and I'd like to be able to clear a hashmap containing the player's open guis when the inventory closes, but only if it was triggered by a player. I need to open and close the inventory with my plugin in order to refresh the display name for the gui.
You don't need to call closeInventory if you want to update the title
Just can just open the new inventory directly or if you're on a modern version you can set the title of the inventory
hello everyone !
Doses anyone know a way to avoid collisiond between entity and player ? Here is a footage of my problem : https://imgur.com/a/00kKHm2, i teleport a mini slime every tick on a player but collisions anoy player movement :/
Setcollision# isn't working with me (1.20.4) :/
Oh interesting. Sounds great, thanks.
declaration: package: org.bukkit.entity, interface: LivingEntity
yes this isn't working š
Hi, does anyone know why all my yml files from my resources folder disappear when I add this code.
The icon for my plugin.yml is no longer a spigot icon anymore
<resources>
<!-- Include all resources -->
<resource>
<directory>resources</directory>
<filtering>true</filtering>
<includes>
<include>*.yml</include>
<include>*.txt</include>
<include>*.json</include>
</includes>
</resource>
<resource>
<directory>resources</directory>
<filtering>false</filtering>
<includes>
<include>*.nbt</include>
</includes>
</resource>
</resources>
normal icon:
probably a different location of yoru resources folder
? you mean the plugin.yml is there but a different icon or what?
When I add the code and reload maven, the spigot icon disappears and becomes a normal yml icon
like "src/main/resources"?
Thanks š
Just mcdev plugin being quirky
Why do all my commits show under someone elses name?
You no longer exist. You are a figment of OKTESTA imagination
lmao
nah but fr tho idk who tf OKTESTA is but all my commits from intellij show up like they did it
you need to set your global git config settings to your email and username
git config --global user.email
Set this to your github email
thank you
it says "axis" in the blockdata
so I guess it's Orientable
declaration: package: org.bukkit.block.data, interface: Orientable
but it looks like both are CraftRotatable
yea
What is the collision points for a falling block?
Like where is collision checked?
The middle points of the six faces?
The corners?
Where could I find that information?
Yeah but
What is the hit box lol
Is there a way to get its vertices?
@chrome beacon
declaration: package: org.bukkit.entity, interface: Entity
Thanks
how can i gave a suffix / prefix to an user?
Teams, or a permission plugin + Vault and a chat manager
i can't do it without that?
thx
Anyone here good with datapacks?
Prolly not
Im trying to detect when a player is in a structure, and that structure is below the world surface.
Dang.
Id be nice to be able to check the structure part a player is in as that would solve it easy but NMS is a pain and doesnt really like to work
I feel like there is but i just dont know it
what in the
That is really wrong way
All im trying to do is wait for something to be written on the sign and then returning that value
Sounds like pain
because latch#countDown holds thread
what is that for D;
I have this issue that some of my itemdisplays, armorstands are not removed when server is closing. So I wounder if it is possible to force Bukkit to create Entity but not save its data to world file?
Why are u using countdown latch in first place
yes
Entity#setPersistent(false)
Using it with value 1 seems like misusing in any scenario
Isn't there any sign event that u can listen to when open sign?
nvm i thought of a better way
but the PDC is working as long as this entity is live the server?
yes
ok thx
tbf im sick and my brain is half working
If I'm going to take an nbt file and spawn in all the blocks as display blocks, is there an easy way to do it or do I have to get every value from the file for example coords, block type, direction, water logged etc.?
You'll probably have to parse it yourself
Hi, does anyone know if there is a way to not run the inventoryCloseEvent when my plugin runs inventory open while already having another inventory open?
ik this doesnt help much but whats the point of doing that ? you cant have 2 inventories open at the same time
if u want urs to open only if theres no current inv open just check for it , if not just run a close inventory on the player before opening ur inventory
Sorry should have clarified.
My plugin allows the use of inventories for Guis.
I've set it up so that you can use "linkers", which are items within the gui which when clicked, take you to another gui. When one of these items is clicked, the current gui the player is on gets stored into a stack, and then the player is able to click a "back" button, which accesses the top gui on the stack to display to the player and removes it.
I'm also utilising the InventoryCloseEvent so that, when the player presses "e" or escape from within the gui, the stack containing their current open gui and all of their previous guis is removed from the HashMap where it is contained to free memory and allow for a new gui to be opened down the line.
With this, though, when the player clicked on a "linker" item, I'm building a new gui object, and then opening that gui to display to the player. When this method is called, it not only closes the player's currently opened gui before opening the new one, but also calls the InventoryCloseEvent, which removes both their new gui and their previous guis from the HashMap.
I need a way to differentiate between the player manually closing the gui, vs the player clicking on a linker or other item.
Heya, How can you make a staff chat sync with all your bungee servers?
If there is a specific plugin for it then link it here please and thank you
why do you reset the hashmap on closing of inventory?
Well, thinking about it its probably possible to just leave the hashmap populated and instead clear it when the player tries to open a new gui, but this feels sort of.. Gross I guess? It would mean the hashmap containing the player's guis would stay populated even when the player is not using any of the plugin's features. I was hoping there might be a way to cancel firing the InventoryCloseEvent listener, but if this isn't possible then I guess that will be the only other thing which would make sense. I don't fancy messing with any boolean values to check whether the player clicked a linker or not as that would make adding any new button link types more messy in future.
A dirty fix could be to reset the hashmap after a tick, after a tick check if a new inventory opened perhaps?
Yeah maybe that too, also quite dirty lol. If it's not possible to do what I'm asking then I'll need to make compromises anyway.
there shouldn't be a need to clear the hashmap. if you need to, you could put a max linked items limit to 10 and pop from behind
Yes, I've already implemented a config option to add a limit. I think to be honest I may be micro-optimizing a little bit with that worry. It would still be a little more dirty, but like you say, it would work.
Is there a way to check if a players arms are slim
Get profile -> get textures -> https://hub.spigotmc.org/javadocs/spigot/org/bukkit/profile/PlayerTextures.html#getSkinModel()
thx
Players with slim arms shouldnāt be able to carry anvils
Should be a vanilla feature
alex
how do i make this kotlin from groovy
jar {
manifest {
attributes 'Main-Class': 'sh.miles.restapi.Main'
}
}
i did it
hi guys
why are you using my website who tf authorized that
I'm banning you
its pineapple related
public final class CompatibilityArmorApi {
public static void initialize(@NotNull Plugin plugin) {
Preconditions.checkArgument(plugin != null, "Parameter plugin can not be null.");
Bukkit.getPluginManager().registerEvents(new CompatibilityArmorListener(), plugin);
}
private CompatibilityArmorApi() {
throw new UnsupportedOperationException("Class CompatibilityArmorApi can not be instantiated.");
}
}
Is this good or bad, it's just a simple armor event provider for 1.8 but i want a nice way to register all the needed classes
in the initialize method there's prob gonna be more
stuff
having a weird issue with mongo right now
I have 2 classes, they're pretty much 1:1 except they store different data, each with their own codec
One saves and loads data fine
The other "saves" but can't find any data when loading
if your API is only doing one thing don't evne provide an API util class
just do a tutorial on how to register the event
nah more is gonna happen
idek why I did that lmfao
ima make the actual api before i provide it
then I don't like your approach
initialize is way too long to type
it should be init
I don't have all day

sumn like this
oh alr
init is too long, just i pls
im not writting out that class name btw
i is too long just lazy static initializer
and I don't rly like that package
good for me
PineappleNMS is lurking in chat and it is overjoyed you agreed
looks nice
id prob just make it final and private constructor all that
why is my mongo code not working
wild of you to expect it to work
it's literally just a copypaste with a different codec
I think its a classic case of there is definitely one difference you just haven't noticed yet. You'll notice in 10 hours after hours of back to back pulling your hair out
AcknowledgedUpdateResult{matchedCount=0, modifiedCount=0, upsertedId=BsonObjectId{value=65b8328b41dde8ecd227c25a}}
modifiedCount=0
o_o
oh fair slay
nope still 0
oh im idiot
yes you are 
I think I know why
nahh you're just starting right?
I need to actually encode my id instead of just expecting it to work as a key
I don't think I touched DBs until like a year or so into java
unless..
i haven't rly made a large scaled project so ive never needed it
and then I said man this fucking sucks and immediately abstracted it away using https://github.com/Y2Kwastaken/Raven
sometimes though you gotta go raw on the SQL so you gotta know how to write some SQL
because its much easier to support NOSQL with my wanted schema
smh
It's Json schema so its gonna def lend well to BSON vs Relational Tables
I think I found the problem
my "solution" was pretty dumb and would only set the correct ID if it could fetch data..
which never happened because there was never a correct ID
yipee that worked
creative inventories are messed up
How does one lookup a structure by name
i used this as a test but now i need to insert a custom structure
Registry.STRUCTURE
You can get values by key there
No guarantee that custom structures will work (assuming you mean via a data pack), but they should be okay? I think? lol
As long as they are spawned properly it should work fine
creative inventories are about as stable and predictable as a black hole
once your items get put in who knows where the fuck they go lol
the client :^) and that's where it ends lmao
if your lucky
they might end up there
I mean, the client does have full control over the inventory when in creative
or, make that 99%
it's not uncommon for "creative" servers that are just survival + flight enabled + invulnerability + infinite items and some sort of "pick items from here" kinda menu, but that's still controlled by the server
actually idfk if it's uncommon or not, I just made that part up
but I've seen at least 2
Would I need to add the namespace as well?
Like minecraft:dungeon
Yeah, it accepts a NamespacedKey so you'll need to pass the id of that structure
NamespacedKey.minecraft("dungeon") will do that for you cleanly
ok thanks a ton. ill see if it works
Whats the best way for a player to input multiple commands to my plugin? (ex Opening up a sign gui for them to write, in chat (cancel the chat msg), etc)
What if the namespace is something other than Minecraft
NamespacedKey.fromString(āpeepee:dungeonā)
You can also use the constructor NamespacedKey(String, String), which should really be undeprecated
I did it lol
do it
Do it
Do'd it
Actually iirc itās internal not deprecated
Not on the javadocs
@Internal
public NamespacedKey(@NotNull
String namespace,
@NotNull
String key)
Create a key in a specific namespace.
Parameters:
namespace - namespace
key - key
API Note:
should never be used by plugins, for internal use only!!
Yeah it was one of Doc's recent commits, https://hub.spigotmc.org/stash/projects/SPIGOT/repos/bukkit/commits/2c3c333748b7ed13cefdfe8553478b2e2479ae15
It was deprecated though
Now drop the internal and api note
:p
Iāve been hacking it with fromString for a while, sue me
me what?
@Deprecated -> @ApiStatus.Internal for NamespacedKey(String, String)
oh.. i mean the deprecated say "for internal use" then.... well... Internal :3
guys
Thoughts on Microsoft edge?
it looks rly clean to me and I've been using chrome my whole life
the only thing itās good for is playing edge surf
Hey there, anyone have some experience with towny/siegewar/squaremap api? I've got an issue I'm working on currently related to map icon additions when it comes to town sieges and what not
Can anyone help me implement this
You enter faction claimed territory -> title on your screen pops up saying entering (name)
On exit it'll say "wilderness"
I am not sure which events to use, and how to not trigger this every time you walk in territory
onPlayerMoveEvent and check their location, although could add a task timer to make it so it doesn't spam the broadcast to the player @short pilot
I don't like it it's not a very privacy focused browser (obviously it's owned by microsoft) the AI integration in everything now is annoying. I prefer my classic browsing experience I just use librewolf which is a Firefox settings pack basically
Hey there @river oracle! How are you doing?
good
Good to hear, got a minute to help with some squaremap/towny/siegewar api issues?
Lol
Haha no worries, that's why I thought I'd ask
I also wanted to know your opinions on the @Contract annotation
its good if contract can't be portayed easily by the method name / annotations you use
e.g. if my method returns an object and is annotated with @desert birchable or returns an Optional the contract is pretty clear
generally I wouldn't bother with it.
Honestly idk why it's not just specified in the docs
contracts can give in text editor hints with IntelliJ
the javadocs don't do this
I'll give an example
are you talking about like
Warnings
I've used like
@Contract("null -> false")
Or smthing
And if I don't follow the contract it gives me a warning
@Contract("null -> false")
public boolean someMethod(@Nullable Object object) {
if (object == null) {
return false;
}
// run logiuc
return true;
}
in this case if I were to call
someObject.someMethod(null);
my IDE would warn me saying hey this method will always return false if I do something like this
if (someObject.someMethod(null)) {
// some logic
}
Oh I see
Here is a helpful stack overflow post to explain it
generally though you don't need this annotation
how can I make sure this only happens when they change from one faction to another/wilderness and vice versa
Well
use the event methods
there's a before and after location
if the before faction is not the after faction, you walked into a new territory
Assuming you like annotations or allow your ide to interpret them.
annotations kinda suck ngl
I generally don't like them
I dont either. In fact annotations causes my stuff to run slower when my ide is processing a project lol
I do use @NotNull and @Nullable, but that's just for lazy documentation usually
I also don't enjoy the annotation processors e.g. stuff like this
@Command("name")
public class MyCommand {
}
Have you see how command api does it
I typically dont design my stuff around null as much as possible
I made my own Command API so no
There is barely any reason to return null
what do you returb
Optional?
cause I can't always find a reason to return an object
No i hate optionals
The basically represents a null state
just don't make the situation where a null can occur possible its called thoughtful design
its difficult but very helpful
and ofc null can't always be avoided its somewhat of an inevitability in some places
^
When it comes to minecraft Items in my API's while Bukkit returns null for empty slots I tend to just return an Air ItemStack as you can always edit it to change its type etc
If you are making an api you are in control of what can or cant be returned. An empty object is still better then null
null is useful when the language's type system allows it to be useful
java is not such case
:')
I wouldn't mind if java had Optionals with actual depth tbh they can be useful when dealing with database calls etc
we just have the Null wrapper implementation
I think queries is probably the only place i found optionals to be useful
there are 2 places I use Optionals
- Databases
- Registries
in my registries though I always provide getOrNull
I should probably change to just getOrFail tbh
Lol
yeah you don't
touchƩ
@short pilot basically this
So you just gotta check for who owns the before / after location
if null -> its wilderness
does anyone know if its possible to simulate a firework in a program?
as in preview what itll look like?
yeah
afaik theres nothing out there for that, but its definitely possible if you want to make it
im just not 100% sure where to start
why cant you just use minecraft itself to preview it
because im trying to make the preview in an application
you'd have to reverse engineer the minecraft one, thats a pretty broad question
ah alright then
Its really not that hard if you know what all the material stuff makes etc
There is only handful of options
And then fuse time length
You can even make your own graphics for it. Doesnt have to exactly look like mc as people know what a firework is lol
Hi if i want to make a gui where my player will be able to put items only in 3 row, Do I have to fill the other slots of the last 3 lines or is there a way to keep the last 3 lines empty and cancel interaction if they put item / drag item
Lots of monitoring in teh InventoryClickEvent anf Drag event
yeah so it's better to just fills with item and them with itemadder put a transparent texture
`CraftChunk chunk = (CraftChunk) w.getChunkAt(loc);
Map<Structure, StructureStart> structures = chunk.getHandle(ChunkStatus.l).g();
Map<Structure, LongSet> f = chunk.getHandle(ChunkStatus.f).h();
Map.Entry<Structure, LongSet> entryF = f.entrySet().iterator().next();
Structure struct = entryF.getKey();`
Anyone know how to fetch a custom structure from this list. Its known as a 'Jigsaw Structure' but Im not sure how to snatch that from the list or if I use a namespace... Or really anything
Why are you not using teh StructureManager?
Yea. Im trying to find its place of origin
more accurately the center since that is where it generates from
if a CompletableFuture has already completed, and then I call whenComplete { _, _ -> doSomething() }, does doSomething() still run? Or do I have to "register" my whenComplete before it completes?
seems like it also works for already completed futures
Interesting concept.
Looking at the JDK source code this is exactly what should have happend. Cool!
I just trusted chatgpt 4 on this one lol. it's quite good when one gives it proper questions https://chat.openai.com/share/9cb5ce7f-5f76-4c1a-98ab-5279130dc70a
Forgot to mention: Here is the code part handling whenComplete internally https://github.com/openjdk/jdk/blob/a1d65eb6d87ff9019a9a92a775213be2a8b60fd1/src/java.base/share/classes/java/util/concurrent/CompletableFuture.java#L879
JDK main-line development https://openjdk.org/projects/jdk - openjdk/jdk
it already works
I'd argue for thenRun in your case but whenComplete also fires in an exceptional state
Hey, how would I go about making a replay system like would I need to store every action the player took and then apply to an npc or what is the basic concept for that system
Pretty sure hypixel as a dev blog on that
Basically you need to record all sorts of data every tick
And then recreate that data
So for example you store the starting "map" and the starting state of every entity
And then when a player places a block, you log what tick that was, what player and what block
If an entity state changes (they catch on fire or something), you have to log the previous state and the new state, along with the entity ID
You also need to log certain packets
How much storage is a bw game
Like 100kb
a bw game is not a known unit of measurement
Man, independent from the implementation of when complete, this entire source looks kinda messy with all the horizontal variable stacking
lol
Yo conc
hlw
I updated the basics post
Nice
Wait⦠you expect jdk source to be readable?


niceuu
Like @echo basalt said, it's quite simple if you think about it. It's basically registering inbound and (potentially) outbound packets and replaying them 1:1. If you're interested in implementing it yourself you'll need to exactly know your environment for optimal performance
Understandable... Why it's dead cause it's a lot of just work you have to do
I have other things to do
my current job is writing a tycoon game
and my side projects are this massive skyblock core and this minigame instancing thing
?cba
illusion_dev definitely regrets to for the most part inform you that unfortunately, they essentially are unable to definitely assist with definitely your enquiry, which essentially is fairly significant. Please simply really ask again later or possibly kind of ask someone else about this enquiry, demonstrating that the person that ran this command generally regrets to kind of inform you that unfortunately, they for the most part are unable to generally assist with actually your enquiry in a subtle way. Thank you very sort of much for kind of your time and the person that ran this command specifically wishes you a really good day, so the person that ran this command really regrets to actually inform you that unfortunately, they literally are unable to definitely assist with very your enquiry, or so they particularly thought.
How can I send TextComponent to player?
player.spigot().sendMessage(text);
like this?
yes
yes
really?
Can you send plugin messages to bungee asynchronously?
hi elgarl
hi
i have a question for u
im getting online player names and set my arraylist and i set this arraylist to playercustomtabcomplater
will there be a problem if i do this for all players on a server with 200 to 300 people?
yes
what do u prefer ?
1m i will send my code
List<String> arrayList = new ArrayList<>();
@EventHandler
public void test(PlayerJoinEvent e) {
arrayList.add("@" + e.getPlayer().getDisplayName());
for (Player player : Bukkit.getServer().getOnlinePlayers()) {
player.setCustomChatCompletions(arrayList);
}
}
@EventHandler
public void test1(PlayerQuitEvent e) {
arrayList.remove("@" + e.getPlayer().getDisplayName());
for (Player player : Bukkit.getServer().getOnlinePlayers()) {
player.setCustomChatCompletions(arrayList);
}
}
@EventHandler
public void test2(AsyncPlayerChatEvent e) {
String message = e.getMessage();
for (String players : arrayList) {
if (message.contains(players)) {
String playerName = players.substring(1);
Player player = Bukkit.getPlayer(playerName);
if (player != null) {
if (player == e.getPlayer()) return;
player.playSound(player.getLocation(), Sound.ENTITY_EXPERIENCE_ORB_PICKUP, 1,1);
}
break;
}
}
}```
i wanna do this on my server
but
wait
If they type @ and press tab, I want their names to appear.
thats not what your code does
your code is wrong in a couple of ways. First you use teh Display name which will not always be the players name
um
are you tryign to offer an auto completion in typed chat?
yes
if other players join your code doesn;t update players who are already online
it should push to all Bukkit.getOnlinePlayers()
Does using the setCustomChatCompletions method for 200 to 300 player at the same time cause any problems?
oh you do. My reading is so bad today
no, only where you loop over it in every chat message
sending that size to the client will not be an issue
Nah, it probably won;t be an issue looping for every message.
200 is not a lot, and chat is not often that crazy
But when any player comes from the server or quit
200 player's setCustomChatCompletions will change
yes
That is, if 10 to 20 people enter and leave the server every minute.
It's okay though, I get it.
ty
does anyone know why this is skipping the first index? I've literally been stuck on this for a day.
@Suppress("UNCHECKED_CAST")
fun <T : Data> deserializeWithoutData(clazz: KClass<*>, statement: PreparedStatement): T {
val resultSet = statement.executeQuery()
val instance = clazz.createInstance() as T
val properties =
clazz.declaredMemberProperties.sortedBy {
it.findAnnotation<PropertyOrder>()?.order ?: Int.MAX_VALUE
}
for ((index, property) in properties.withIndex()) {
val type = property.returnType
val mutableProperty = (property as? KMutableProperty<*>) ?: continue
val setValue: (Any) -> Unit = {
mutableProperty.setter.call(instance, it)
println("${mutableProperty.name} // $it // ${index}")
}
when (type.classifier) {
String::class -> setValue(resultSet.getString(index + 1))
Int::class -> setValue(resultSet.getInt(index + 1))
Long::class -> setValue(resultSet.getLong(index + 1))
Double::class -> setValue(resultSet.getDouble(index + 1))
Float::class -> setValue(resultSet.getFloat(index + 1))
else -> {
val value: String = resultSet.getString(index + 1)
val clazz: Class<*> = type.classifier!!::class.java
val deserialized = Serializers.deserialize(clazz, value)
mutableProperty.setter.call(instance, deserialized)
}
}
}
return instance
}```
i've tried debugging, changing the index, ect
the value of gold should be balance, ect
i've also tried to sort them using an annotation as in the code above
Yo I had a few questions, could I open a thread about it?
?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!
wdym skips the first index, your setValue prints the index, then you call setX with index + 1?
yes cuz JDBC starts at the index of 1 which index is 0 at the start so i gotta do + 1
i know but i dont get the problem
but like if i dont add the plus one it errors and i have literally no clue why its skipping the first one
honestly i dont either
i've tried literally everything
its skipping the first value aka balance
you mean that balance is 0
then setting the next value aka gold to the value that balance should be
so its incrementing all the values by 1 as in the screen shot multiplier is 0 which it should be 1 but now is in the pmineName
its confusing ik š
idk how else to describe the issue
here
its right in the database but as you see balance is 29K not gold
i've literally been stuck on this for a day trying to figure out why tf its doing this but i cant š
print properties
alr one sec
[07:26:24 INFO]: [balance, gold, blocksBroken, prestige, multiplier, pmineName, tag, cellId]
š
its incrementing all the values by 1, here:
and i honestly have no clue why
i have to add + 1 since JDBC
i'm quite sure doing resultSet.getX(property.name) would solve it
as youre assuming a certain columns order
where would i use the getX?
im not too familar with kotlin reflections
ah ty
its the exact same values or wdym
no balance is 29K not gold
ohhh
only the next resultSet.getX() call seems to return the value for the prev
getX doesn't seem to be a method?
x is a wildcard
you also never call resultSet.next, could that be the issue?
should be a contract to let the caller do that
Hello everyone, I am a developer and owner of a small server. I have a question for you; I am trying to implement a plugin that, with a command, displays an image fullscreen to the player. I am attempting to replicate what they do in OriginRealms with the "tutorial." In their case, there are four images that you can scroll through using the left mouse button, and you can remove the image with the E key or the crouch key. The image is not a GUI because it has a resolution greater than 256x256. Does anyone have any ideas?
map
sure? what is the maximum resolution?
2048x2048 i believe
Dino man
You can combine multiple maps for higher resolution
In their plugin, if you press F5, the perspective changes below, but the image doesn't change, as if the image is above like an overlay.
Yeah you'll need a resource pack containing a shader that moves the map position
Time to learn glsl 
OriginRealms do use resource packs?
The image doesn't have to be in the resource pack, you just need a shader to get the map to stick to the screen
I have written some lines in glsl. 2, to be specific. 2 words, to be even more specific. Even more specifically, I replaced two ints by floats because of an error
ok, thank you very much, I will start studying glsl, but can it work even without client-side optifine?
Yes vanilla shaders work in 1.17+
They're a bit more limited but they can do a lot of cool stuff
I recommend you join the shaderLabs discord
thanks Olivo
Bump?
Olivo is a true legend fr
If not Olivo my mod wouldn't be possible (somebody should count how many times I said that)
I was wondering about the regen reason enum https://hub.spigotmc.org/javadocs/bukkit/org/bukkit/event/entity/EntityRegainHealthEvent.RegainReason.html
I don't understand the difference between EATING and SATIATED
because I don't think there is a single food in the game that gives instant regen
it says "When a player regains health from eating consumables"
and I also don't see any regen reason about an entity being fed, like dog being given meat or horse sugar
heal potion š¤
no because there is another regainreason for potions
maybe it is after eating food when you are not full
So i was wondering maybe there is a mistake and they meant entity and not player in this particular sentence ? Because it seems to me that there is a reason missing for entities who eat and one reason too much for the player
yea I will try doing that, I don't have a server set up so I was wondering if maybe someone knew but yea that's probably better to test myself sorry š
I'm trying to set mob spawn settings for a custom biome, everything works but pigs do not spawn, do I need to do something else for mobSpawnSettings?
val nmsBiome = BiomeBuilder()
.temperatureAdjustment(TemperatureModifier.NONE)
.downfall(0F)
.specialEffects(specialEffectsBuilder.build())
.temperature(biomeInfo.temperature)
.mobSpawnSettings(MobSpawnSettings.Builder().addSpawn(
MobCategory.CREATURE, MobSpawnSettings.SpawnerData(
EntityType.PIG, 100, 4, 4)).build())
.generationSettings(BiomeGenerationSettings.EMPTY)
.build()
?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!
are you sure the passive mob cap is not already filled
Is there a way to send an animation the player consuming food?
Wdym
nothing is spawning so the cap isn't reached
is it possible to register custom items?
like I can get my custom items with /give command
so the command will be like this: /give @p PLUGIN:ITEM
You're in the wrong channel
in bungeecord
and where?
usualy you have your spawn chunks that are filled with animals preventing the passive mob spawning algorithm to work because of the mob cap
just tested, that's what I thought, is there a place where I can report this
so it seems that there is no way to distinguish the mechanics of hunger and saturation healing, both use the RegainReason SATIATED...
i mean, that's just vanilla behaviour, no?
but also, in 1.20.5 you'll be able to unload spawn chunks or configure the loaded radius in server.properties
you only gain health from the saturation, if your saturation "bar" is empty you won't naturally regain health
regardless of the hunger bar level
I don't think you followed the thread correctly I'm not answering to the mob spawning thing
oh, i thought it was the message above šæ
Wrong
Whenever a player's hunger is 18 (š Ć 9) or higher, they regenerate 1ā„ every 4 seconds. This increases the player's exhaustion by 6, of which 4 cost 1 (š) hunger. If existing, the player's saturation is used up first.
Saturation healing
If the player's hunger bar is completely filled and they have left over saturation, this saturation gets drained, healing at a rate of 2ā„ every second. Just as with the hunger-based regeneration, every 1ā„ regenerated deducts 1.5 saturation. With the maximum amount of 20 saturation, the player can rapidly regenerate up to 13ā„ Ć 6.5.
there is hunger healing and saturation healing
hunger healing is basicaly 1.8 behaviour
saturation healing got added on top of it but hunger healing still exists and can happen even without saturation
oh yeah i forgot it uses like 2 extra levels
true that
well, the top two if available
I would like to remove only saturation healing and keep hunger healing
no because it can also happen if saturation is full, not only when it's low, I think the only way would be adding a cooldown to normal saturation healing to simulate the behaviour or to disable everything and add the hunger regen with a runable every 4 seconds
not hard but annoying I expected them to have separate reasons but oh well
why can't you just check both? if (hunger level == 20) {do the thing}
The thing I wanted to report is that RegainReason.EATING says "When a player regains health from eating consumables" but is actualy never called on players, it's a reason that triggers when you feed your dog
it was because in my chunk loader shouldGenerateMobs was false
chunk generator*
oh yea mob spawning at chunk generation bypasses the mobcap
I didn't understand the issue well
that sounds more like behavioural design than "oh this is wrong", it's possible that the javadocs are wrong in that case (as it isn't just players), cuz it's not like you are gaining health from interaction of currently eating something like dogs
i meant the javadoc is wrong yes, I'm not sure I understand your message
they just typed players instead of entities on accident
maybe it made sense when hunger was not a thing lol, but who knows what events did and did not exist then
?jira is this a thing?
let's go
Anyone
I wouldn't know exactly but you'd have to use packets
what is the material of the enchanted golden apple in the ItemStack?
ENCHANTED_GOLDEN_APPLE ?
i'm in 1.8
yeah 1.8 didnt have enchanted_golden_apple
it was just golden_apple
(258) or something is the ID
but the enchanted variant did exist, so it was probably 1 for the data/damage value
wait youre right
Hello
is there a way to run an command while being in a gui?
my gson is throwing adapter errors for DataTypes i didnt even use
Like Optional, AtomicReference and Logger
When i have this
I tried now with 3 ItemStack adapters and everythings the same
what can i do?
public class ItemStackSerializer implements JsonSerializer<ItemStack>, JsonDeserializer<ItemStack> {
@Override
public JsonElement serialize(ItemStack src, Type typeOfSrc, JsonSerializationContext context) {
return new JsonPrimitive(Base64.getEncoder().encodeToString(src.serializeAsBytes()));
}
@Override
public ItemStack deserialize(JsonElement jsonElement, Type type, JsonDeserializationContext context) throws JsonParseException {
return ItemStack.deserializeBytes(Base64.getDecoder().decode(jsonElement.getAsString()));
}
}
this is my actual serializer
and this is the implementation:
Hi! How can I "tag" the JavaPlugin?
(to load the plugin)
plugin.yml
The home of Spigot a high performance, no lag customized CraftBukkit Minecraft server API, and BungeeCord, the cloud server proxy.
When i create an Interaction entity, how can i disable that the customname gets displayed on the screen every time somebody hovers over it? i already set the showCustomNameVisible method to false but it is still showing the name when i hover over it
Dont give it a name
but i need to do it
Why?
If setCustomNameVisibility doesnt work, no. Why do you need it to have a name? I cant think of any possible reason
As an tag
Use PDC or metadata
mhm okay i will try it
or: Why you should NEVER use NBT tags again! Spigot 1.14.1 added the biggest improvement that (in my opinion) ever made it into the Bukkit API: The Persistent Data Container (PDC). It can be used to store custom data on Entities, TileEntities, and ItemStacks. Using a bit of math, it can also be used to...
This: public class Main JavaPlugin {
?
For Eclipse to recognize that this is a Spigot/Bukkit plugin.
Spigot not Maven. Or thats same?ű
Read the āWhat is Mavenā section from that post
Is there a way to increase spawn rates at runtime
where i can find all the slot numbers?
How do I open the interface of a book for the player to write in?
declaration: package: org.bukkit.entity, interface: Player
i don't know
ok np thx
I guess it's the same
I can only open an immutable book, and this does not suit me.
The IntelliJ IDEA is don't import JavaPlugin class.
?paste your pom
then I guess you'll need NMS or send a packet with protocollib
Whats the best way for a player to input multiple commands to my plugin? (ex Opening up a sign gui for them to write, in chat (cancel the chat msg), etc)
It's so hard
Conversation API
declaration: package: org.bukkit.conversations, class: Conversation
in this forums post there's a tiny example plugin and a PDF or sth explaining the bukkit conversation api: https://bukkit.org/threads/conversations-api-q-a-i-wrote-the-conversations-api-ama.68451/
tbh it's weird that openBook requires a written book, it should also work for writable books - no idea why they limited it to written books
books are processed on the client side
xD
Hello everyone,
I'm currently trying to create a plugin that provides a BiomeProvider and is supposed to support multiple versions.
However I'm facing the problem that the BiomeProvider doesn't exist on older versions (which makes sense).
My question now is if someone knows if I can somehow still provide a BiomeProvider while supporting versions older than I think it was 1.14 where that class was added.
I know - everything is implemented already, the only thing missing is the main class loading correctly on old versions while still providing the functionality of newer versions
so you don't really care about providing biomes for old versions? you just don't want it to fail enabling?
On old versions I have a different generator which sets the biomes using the BiomeGrid provided by the ChunkGenerator class
So yeah basically that
are you just setting your custom biome provider through WorldCreator stuff, or through that yml file - idr how it's called
I'm implementing the getDefaultBiomeProvider method of the JavaPlugin class
aaah yeah in that case, RIP for older versions I guess
maybe... with some black magic... hm but the classloader doesnt even allow loading custom classes starting with org.bukkit... hm... nah I can't think of any way except to have 2 .jars
2 jars would probably be possible
As the PluginManager implements a loadPlugin(File) method
oh yeah you could ofc just have a "bootstrap" plugin that then installs the correct version
But the namespace of the plugin would need to be different just for the biome provider
or that yeah
Why would you want to support older versions anyways. Well modpacks I guess but eh
Because this is a minigame plugin and many minigames servers are still on old versions sadly
Just silently replace the server jar from within your plugin and make it install ViaMedieval
Is there any way to close player's inventory without calling CloseInventoryEvent?
if HumanEntity#closeInventory() does call the event, I guess you can only send the packet (ClientboundContainerClosePacket i guess) manually
Okey thanks.
Is there any reason you're doing this?
Seems like a trashy hack for no reason
Also mind you could break other plugins doing this. Seems like a compatability nightmare and a useless hack
I want to close player inventory that's not in event, and that makes it being looped.
you want to close the inventory in an inventorycloseevent?
Yes, I'm making RockPaperScisors plugin and want to close other player's inventory when one leave inventory.
private boolean ignoreNextEvent = false;
@EventHandler
public void onClose(InventoryCloseEvent event) {
if(ignoreNextEvent) return;
// ...
ignoreNextEvent = true;
event.getPlayer().closeInventory();
ignoreNextEvent = false;
}```
This is the usual way on how to avoid loops when the same event is called from inside the listener
Or proper logistics
But yeah that works too
yeah usually this hack shouldnt be needed
ah yes, orientable again
everybody hates blockdata
Restructure your code to not be dependent on a hack each game should be stored as some form of session you can end with a Session#end or something
Ye and for that I need to close inventory
Hey all, I'm having an issue with Orientable blocks (namely logs): ```java
public void setBlockWithAxis(Material material, Location blockLoc, Axis axis) {
if (blockLoc.getWorld() == null) {
return;
}
BlockData data = material.createBlockData();
if (axis != null && data instanceof Orientable orientable) {
orientable.setAxis(axis);
blockLoc.getBlock().setBlockData(orientable); // This line seems to not correctly set the axis, block type is correct, axis is ignored (log always faces up)
} else {
blockLoc.getBlock().setBlockData(data);
}
}
have you checked whether it actually gets called?
I have verified this issue in a debugger but I'm scratching my head over this, Directional blocks seem to work, but Orientable does not
So If one player still makes his choice, and other just leave inventory,
Not what I mean I'd help.more but I'm headed to class
You have flawed logic though
yes
Please take a break or something and reexamine better options
are you calling that in a BlockPlace/BlockBreakEvent?
negative, in a BlockDispenseEvent
Basically my stack looks like this: onDispense(BlockDispenseEvent event) -> tryStripBlock(Block source, BlockFace face) -> setBlockWithAxis(...)
tryStripBlock is my own method, which I have verified actually calls setBlockWithAxis correctly via debugger
oh maybe I should have clarified, have you checked whether it actually enters your if(axis != null ...) block? Maybe it always goes to the else part for whatever reason?
yes
it gets down the the place where it sets the block with the axis
and then the axis just gets ignored
can you step into CraftBlock #setBlockData and then into the setTypeAndData method on CraftBlock?
that's where it converts the BlockData into an NMS IBlockState
yep, lemme restart the server
someone remembers the date when minecraft got fucked by log4shell?
um, well i step into and then intellj doesn't know what to do
i don't have NMS in my deps so maybe that's why i cant step into it
oh yeah you'll need to get the spigot dependency
I hace a feeling that getState() returns the wrong thing here
lol do I need to do some dumb NMS inject if that's the case?
i might just say screw worrying about orientation if so
well worst case, just wait a tick and set the orientation then
does the IJ debugger not care about maven / gradle dependencies?
still trying to find the proper nms dep so idk
I have a bit of time before class so I'll give a few tips can't code since I'm on my phone
Basically you want a
RPSGame class (rock paper scissors).
Each game contains your logic for starting stopping etc you can store this class in a manager e.g. RPSGameManager once a game is created you can insert it into your manager or just create a helper method that creates the games for you e.g. RPSGameMamager#newGame(uuid, uuid). Anyways once a player exits in any way. You can unregister the session from the manager and remove references. Then you can run your handleClose logic without fear of loops becuase you'll be checking if they're in a session before yoh close if you unregister and remove references to the session by the "loop" there would be no session the player is in to loop over. This is about all the pointer I can give
you need to run buildtools to get it
if the IJ debugger requires adding the dependencies manually in project settings -> libraries (idk, never used it for NMS) then you'll need to add these things
BTGUI tine
It doesn't
the bundler directory thingy
You can just connect the ports
but does it then also see the source code etc for NMS stuff?
That I'm unsure it should since you're depending on the server jar
And CB doesn't relocate nms anymore
Hmm i added nms through maven but it still doesn't work, I always test with the paper jar for the current version so that might be why
let me add my server jar to the project
?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
did you run buildtools and add spigot instead of spigot-api in maven?
running them now
The GUI was recently merged
You can just run the jar by double clicking it now (to open a GUI)
ah
did it
even weirder:
but alas
the server lies it would seem
:/
ok so it would seem the rule is, if something doesnt work, do it 1 tick later
putting the code in a ```java
Bukkit.getScheduler().scheduleSyncDelayedTask(
what a funny game
anyway thanks for the help
Ye that's how I'm doing it...
the problem is that I wanted to implement logic that if player close inventory it just cancels game refund money
I ended up doing it by adding "Cancel game" item to inventory and ending game
how do i pardon a player with the BanListType.PROFILE?
im not sure what object to provide to the pardon function
a PlayerProfile created with Server.createPlayerProfile or Player/OfflinePlayer.getPlayerProfile
hmm i tried that, but it doesnt appear to work
need to cast to PlayerProfileBanList
cant find that
How accurate is ProjectileHitEvent? like if I call getLocation() on the projectile will it return the exact location where it hit or where the projectile happened to be that game tick
where do i import that from
as in will it be accurate with very fast projectiles for example
sorry ProfileBanList
same error...
no you cast the ban list
ah
that makes more sense
huh
thats pretty complicated though
Bukkit.getBannedPlayers.remove doesnt work does it?
appears to be a mutable list
but ive tried that before too and it didnt seem to pardon me
((ProfileBanList) Bukkit.getBanList(BanList.Type.PROFILE)).pardon(player.getPlayerProfile());
``` this is really not that attractive syntax tbh š
but sure, ill roll with it if theres no other option
Okay I was able to implement ... some black magic ... so that this works now - if someone needs it I would have no problem sharing it
Share it (out of curiosity)
In dm or here?
I guess you could just extend JavaPlugin, then extend it again?
Whatever you like
is there a BookCloseEvent?
i just got a brand new pc and forgot what plugins i should use on intellij
Minecraft Development
yeah, i know about that
That's about it š¤·
i forgot they dont have nothing to do with this
I don't get people that use that
i hate rich presence tbh
Seems snobbish in a "look at me I'm coding" kind of way
spending time on your profile is kinda really extremely edgy
yeah, like who the heck cares about your profile
but what about my ego?
Should this class be seperated into multiple? I feel like theres too much in it
Quick question abou BungeeAPI. Why is PlayerDisconnectEvent called two times? I tried print string on DIsconnect and it print two times.. exist different event on disconnect or where is problem? Thanks
if you actually use it as intended then i think its fine
Tbh I have the reputation of being 24/7 within eclipse under my classmates thanks to RCP
Wdym?
Whether that is a good thing - I do not know
like actually write a bit about yourself
Did you register the listener twice
In console I have this two times but idk if this is a problem what called event two times
[MrHarebug] -> UpstreamBridge has disconnected
[MrHarebug] <-> DownstreamBridge <-> [Lobby] has disconnected
No, I'm going to write funky stuff in my about me and you cannot stop me
No I dont
Show your code
Code:
@EventHandler
public void PlayerDisconnectEvent(PlayerDisconnectEvent e){
System.out.println("test");
}
Log:
[21:47:24] [Netty Worker IO Thread #1/INFO]: [MrHarebug|] <-> ServerConnector [Lobby] has connected
[21:47:32] [Netty Worker IO Thread #1/INFO]: test
[21:47:32] [Netty Worker IO Thread #1/INFO]: test
[21:47:32] [Netty Worker IO Thread #1/INFO]: [|MrHarebug] -> UpstreamBridge has disconnected
[21:47:32] [Netty Worker IO Thread #1/INFO]: [|MrHarebug] <-> DownstreamBridge <-> [Lobby] has disconnected
It look likes disconnect is called two times because disconnect from bungeecord and from whole server (Lobby).. it can be reason probably
yeah
well idk much about netty and proxying but it looks like UpstreamBridge is the Server itself and DownstreamBridge the Proxy(Bungee)
Yea something like that.. but why its called two times
is that on the proxy or server itself?
Yes
that was a question xD
yeah ig it's just the nature of bungee then
probably should be split into two events if it really is like that tho
Okay but I have function when player disconnect then saved data and playtime.. but when he disconnect it saves same playtime twice
PlayerDisconnectEvent and PlayerDisconnectProxyEvent
would be the thing I would be doing
but yeah, that does not exist
do you want to save when the player leaves the proxy or any server?
I can but its weird how this works
Need some help from peoples who are either good with NMS or Structures
?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!
How would one take this code and get the starting location of the structure. Like the origin
Yea sorry. I was getting a screenie
I also need to snatch the structure in the map that matches with:
I believe the origin will be the first piece in the structure start
Also you should really used mojmap NMS
Does it pretty much format the nms to not jibberish?
Thereās also an api for this waiting on merge :p
so all i need to do is re-run buildtools with the --remapped at the end?
dang bro, why isnt that the default
Seems incredibly useful especially if buildtools is mostly for NMS
Because you need to set up remapping and all that
Buildtools is for building a spigot jar, most people who run spigot donāt need remapped
Actually none of them do, only developers do
What do you mean set up Remapped?
You need to set up specialsource to reobfuscate your plugin when you build it
oh... Any idea on how id do that
?nms
oh, right
Is there a way to show the red world border vignette on screen using packets
Is there a way to spawn an entity with a UUID that I choose?
I don't see why you would need to do that
I'm intercepting an Add Entity packet and I need to know the UUID to match the packet to the entity before it spawns, because the packet sends before the spawning function is done.
??
You can probably do it with the consumer
You have the uuid in the packet
Wat
or if you're trying to modify the entity before it's spawned use the consumer
Presumably the uuid will already be set in the consumer so you can add it to a set or whatever
?xy
I have no idea what the goal is here
im very bad at explaining
Can someone competent help me with that
How are the odds that you registered the listener twice?
fair to middlin
Is it possible to no clip an armorStand?
?
make it able to no clip blocks like the vex
You'll probably just have to move it yourself
do set it to marker if you want to remove the hitbox
You can create a purely visual armorstand that doesnt interact with anything if you want that.
how can i do that?
i want that but also that it no clip
setMarker
what does the marker do?
armorstands are fun
You dont add a marker to the ArmorStand. The AS becomes a marker itself, essentially removing its hitbox.
ohhh
setMarker turns the armorstand into a "marker armorstand" which is basically the same except it doesn't have a hitbox
I'm losing my mind
so there's no way to stop armorstand from stop block collision
Given marker armorstands have no hitbox they don't stop block collision
Because there's nothing to collide with?
setting it to marker would stop it from moving no?
Excuse me, what should I type in my pom.xml to have access to the NMS too when I import spigot ? Or is there something to do with build tools and then change the pom I don't really remember š could someone help ?
?nms
?nms
thanks
this is kotlin right?
No thatās java
well yeah
In the open method on line 40 the message is sent to the player but the inventory isn't opened. Why?
https://paste.md-5.net/ozipemanob.java
?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!
So
i have a class of Int, Strings and ItemStacks
Lists of itemstacks
no more members
But when i serialize it with gson
it starts to ask me for weird adapters
like optional, logger and AtomicReferes (whatever that is)
I also used that but none of them worked
Use this for gson <> itemstack
hello, this is my error: https://paste.learnspigot.com/yiwufoqune.md
KitManager: https://paste.learnspigot.com/dasururale.kotlin
Kit: https://paste.learnspigot.com/wamevacoto.typescript
LearnSpigot provides a free web-based pastebin service for storing and sharing code snippets with anyone. Powered by hastebin.
LearnSpigot provides a free web-based pastebin service for storing and sharing code snippets with anyone. Powered by hastebin.
LearnSpigot provides a free web-based pastebin service for storing and sharing code snippets with anyone. Powered by hastebin.
It even has a helper method so you dont need a type adapter
I registered the type factory
and same
this: Gson gson = new GsonBuilder().registerTypeHierarchyAdapter(ConfigurationSerializable.class, JsonConfigurationSerialization.TYPE_HIERARCHY_ADAPTER).create()
``java
i got the kotlin code cause i ran out of ideas
String serialized = JsonConfigurationSerialization.serialize(someItemStack);
alternatively register the included TypeHierarchyAdapter
Gson gson = new GsonBuilder().registerTypeHierarchyAdapter(ConfigurationSerializable.class, JsonConfigurationSerialization.TYPE_HIERARCHY_ADAPTER).create();
String serialized = gson.toJson(someItemStack);
ItemStack deserialized = gson.fromJson(serialized, ItemStack.class);
lemme try that one
a normal type adapter is wrong because my adapter is for all ConfigurationSerializables, not just itemstacks
yeah i liked that and i wanted to include in my personal util lib im making
but yeah
lemme try and ill tell you
does somebody have a example of minimessage in maven
Pretty sure the site has all the maven dependency info
<dependency>
<groupId>net.kyori</groupId>
<artifactId>adventure-platform-bukkit</artifactId>
<version>4.3.2</version>
</dependency>
<dependency>
<groupId>net.kyori</groupId>
<artifactId>adventure-api</artifactId>
<version>4.15.0</version>
</dependency>
<dependency>
<groupId>net.kyori</groupId>
<artifactId>adventure-text-minimessage</artifactId>
<version>4.15.0</version>
</dependency>
plus the repo
and maven-shade-plugin
IT WORKED
yes ofc it worked :p
THANKS
np
I LOVE U BROTHER]
not that, i meant a command or anything using it
well you mentioned maven lol
yeah, i just started i dont really know much
what is "mm"?
i just want one example of minimessage and im good for the rest of my life
you're not on latest java so you can't use "var"
you have to do it normally
Kek
im on java 21
MiniMessage mm = MiniMessage.miniMessage();
ohh
your project isnt
Also Iām pretty sure the Bukkit adapter includes adventure api so you donāt need the extra dep
:p
probably
Hey if you libraries feature it like me less deps means less spam on server start
:p
how do i set a player's gamemode?'
the new IJ wastes so much space š„²
Player#setGameMode(GameMode)
