#help-development
1 messages · Page 782 of 1
redis can be used for persistent storage too
and generally speaking, redis is the "better way" (as opposed to, e.g., plugin msg or sql polling/probing (ew))
No
nothing that interacts with the world/entites etc can be done async unless explicitly stated
pls no probe
Is that refering too the first or second question?
"No, yes"
Ahaha until smth weird breaks
And you can’t find the cause
Cause it’s caused by you doing smth async
it's a ticking bomb, essentially
It will hopefully not be an issue in my case. Cause noone will be on the server while I run that code.
And I'm running Chunk#getBlockAt in seperate chunks. So there will be one thread doing Chunk#getBlockAt for one chunk, another thread for another chunk, etc.
best case scenario, you actually get an exception being thrown
Keep a backup
worst case, something gets corrupted silently
and you never find out
and then the server crashes trying to load the chunk
although a Block is nothing but a funny Location, operations you do on it (get/set type etc) that won't be very nice
Question, once I get a TranslationKey (Type is String) with getTranslationKey how do I acutally translate it so I can display it? I am trying to set the text on the top of a GUI with a name I get from a Entity but that apparently doesn't get translated.
You don’t actually translate it, but send/set it in a TranslationComponent that then gets sent to the player who translates it
@rotund ravine
I take everything back, you were right... it went wrong pretty fckn quickly XD
What funny stuff happened
Except there is no TranslationComponent in the Bukkit API and createInventory takes a string to use as the title.
It’s in the bungee chat api
Nothing special, just sometimes it kinda skipps/uses the same block data multiple times
And yesh blame @worldly ingot easy
So I am guessing its part of the Bukkit api that hasn't caught up with times.
Ye
Also it being part of the bungee chat api doesn't help much when I am working on a Spigot Plugin that needs to work without bungeecord 😦
you're in luck, the bungee chat api is available on spigot
Still doesn't help solve my issue at all, but I have found that my issue isn't currently solve-able. (At least not properly).
that'd be correct as pointed out
Going to have to fall back to using the Deprecated getName() function.
Ah yes, when you do small optimizations and your code goes from running between 12-15 seconds to... 140ms; WTF
Negative optimization
why negative?
Though I had that happen aswell... multiple times
Congratulations on increasing ur speed (delay) by 10 times 💪🏻 jkjk
Isn't it x100?
Well i was still building on my first assumption
12-14ms to 140ms
Everything else is a lie
Realisation that I can't take a joke
Welp...
Vanishes
look into ChunkSnapshot if you just need to reed blocks in a chunk. Once a ChunkSnapshot is captured on the main thread you can read it to your hearts content asynchronously
That's what I'm using now
I do this in one of my plugins which scans hundreds of chunks top to bottom for blocks
its pretty efficent given you distribute tasks efficetively
Ye, I changes from Chunk to ChunkSnapshot and one other small tweak; That caused the major performance increase.
Also, do you know of an efficient way to checl for the highest block in a chunk, except for looping over every block and checking with the ChunkSnapshot(true, false, false)#getHighestBlockAt(x, z)?
just use getHighestBlockAtY
remember that those coordinates are relative though
e.g. must be between 0-15
ye
how can I set summoned armor stand same position as my players?
as in to make them look in the same direction
Any idea if its possible with a FurnaceInventory to set its burn time and progress for displaying in the GUI? Or is that not possible with the Inventory alone. (This an is Inventory I created with Bukkit.createInventory so it has a null holder.) Would I have to make a holder for it?
?jd-s
Huh, guess not
Yea, I already read the docs and I can't see any way of doing it, which is why I am asking.
who knows in which class the class responsible for the vanilla chunk generator is located (craftBukkit)
i try found but I come across solid multi-level interfaces
what??
So I will have to make a holder for my inventory then. Since I don't think furnace related events would fire for my FurnaceInventory instance since it isn't actually attached to a block.
I tried to find the right answer on the forums, but many do not understand the essence of the question...
why does this line of code trigger twice?
the method is triggered with right clicking on entity with a bone
When you right click it probably clicks with both main and off hand.
Yeah
First of all: Fix this problem 🙂
it doesnt give any problems
Is the first screenshot from your ability method?
guys, who can help me with gd.py? i need use this code without async func: python async def Download(id): song = await client.get_song(id) file = open("audio.mp3", "wb") await song.download(file) return song.name, song.artist, song.size
only health bar changes twice
This wont be true
Print out a message on top of your ability method
when I type code to write a message to a player its executed once
Then remove async and just block for the result
I am
Never, ever compare Strings using ==
def Download(id):
song = client.get_song(id)
file = open("audio.mp3", "wb")
song.download(file)
return song.name, song.artist, song.size``` like this?
Sometimes you get lucky and your strings are in the string pool.
Comparing strings with == works sporadically
now i have 2023-11-08 20:12:42,125 (__init__.py:960 MainThread) ERROR - TeleBot: "Infinity polling exception: 'coroutine' object has no attribute 'download'" 2023-11-08 20:12:42,126 (__init__.py:962 MainThread) ERROR - TeleBot: "Exception traceback: error
is it possible to cancel the full gamemode 3 interaction? like click in players or something
What package are you using for your coroutines? Just asyncio?
Then just call the method blocking
import asyncio
...
result = asyncio.run(Download(123))
ok, but i have new error.. File "/home/container/Downloader.py", line 6, in Download song = await client.get_song(id) ^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/container/.local/lib/python3.11/site-packages/gd/client.py", line 1351, in get_song model = await self.session.get_song(song_id=song_id) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/container/.local/lib/python3.11/site-packages/gd/session.py", line 787, in get_song response = await self.http.get_song(song_id) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/container/.local/lib/python3.11/site-packages/gd/http.py", line 2707, in get_song response = await self.request_route(route, data=payload, error_codes=error_codes) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/container/.local/lib/python3.11/site-packages/gd/http.py", line 696, in request_route return await self.request( # type: ignore ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/container/.local/lib/python3.11/site-packages/gd/http.py", line 848, in request error = HTTPStatusError(status) ^^^^^^^^^^^^^^^^^^^^^^^ File "/home/container/.local/lib/python3.11/site-packages/gd/errors.py", line 67, in __init__ super().__init__(HTTP_STATUS.format(self.status)) ^^^^^^^^^^^ AttributeError: 'HTTPStatusError' object has no attribute 'status'
i'm using lib gd.py from nekitdev
You get some type of http error. Debug it and find out what the problem is.
why getting PDC of armorstand gives me null
fun fact. on windows pc all working, on linux hosting not working
Figured it how to set the burn time and cook time on my custom furnace inventory, from my inventory, I can get all the viewers and from there I can using InventoryView I can use setProperty to set my things I wanted. Just figured I let you know I found a way to do it.
PDCs cant be null. A PersistentDataHolder always has a PDC
PDCs cant be null. A PersistentDataHolder always has a PDC
What is EntityPDC
So its a String stored within your PDC.
Well in that case your PDC doesnt have a String with that key when you call your method.
A namespaced key cant be a single word like "bone".
It needs a namespace and a key. So "namespace:key".
The proper way to construct a key is to pass your JavaPlugin instance to the constructor of a namespaced key.
and it has those
NamespacedKey key = new NamespacedKey(yourPlugin, "some_key");
This looks like it has no namespace
?jd-s
A namespaced key cant be a single word like "bone".
It needs a namespace and a key. So "namespace:key"
The proper way to construct a key is to pass your JavaPlugin instance to the constructor of a namespaced key.
NamespacedKey key = new NamespacedKey(yourPlugin, "some_key");
Using mcs namespace smh
so just namespace:bone?
"namespace" is a very questionable name for a namespace
idk man it literally works here normally
Then all you need to do is find out why your armorstand doesnt have this PDC value attached
I did ask
Hello, can anyone help me with nuvotifier? I can't get it to work, it tells me there is no listener
Code:
public class NuVotifier implements Listener, ForwardedVoteListener {
@EventHandler
public void onVote(final VotifierEvent event) {
System.out.println(event.getVote().getUsername());
}
@Override
public void onForward(Vote vote) {
System.out.println(vote.getUsername());
}
}```
Errors:
```cmd
[21:33:51 ERROR]: [Votifier] A vote was received, but you don't have any listeners available to listen for it.
[21:33:51 ERROR]: [Votifier] See https://github.com/NuVotifier/NuVotifier/wiki/Setup-Guide#vote-listeners for
[21:33:51 ERROR]: [Votifier] a list of listeners you can configure.
Did you register the listener?
but the thing is
why this suddenly works
was it not able to get the PDC in time and it assumed that its null
or what
Could only be the case if you do some scheduler fkery
Yes
@Override
public void onEnable() {
this.pluginManager = Bukkit.getPluginManager();
pluginManager.registerEvents(new NuVotifier(), this);
...
There is no such thing as "not getting a value in time" because everything is handled sequentially
No idea then. Documentation might have the answer 🙂
https://github.com/vexsoftware/votifier/wiki/Vote-Listeners-and-VotifierEvent
I've already read the documentation and it doesn't help me at all 😦
GO TO RUN>
Oh god...
still have one issue tho
when I trigger it on the enemy for the first time, hp is deducted from HP bar twice
damage is dealt once
and every other cast works normally (60 damage, -60 hp on health bar)
should i be questioning it
Print out how ofter the ability method is called.
And you should not deduct from your health bar. Let the health bar read the actual health and display it.
I mean go to is messy.
But this doesnt look like any syntax to me. More like pseudo code.
only once
on right click
If a method is only called once, then code within this method can also just be called once unless you
are using loops. Do you call the health bar update on another piece of code as well?
nope
sounds right for a tv show
Do you call this method in an entity damage event?
no
Well then the method can only get called once.
Debug it again.
well for some resaon theres this problem again
Looks like you try to get your value before you set it
Did you account for the armorstands in the world which dont have your pdc tag?
Some more tips to make your code more clean and readable:
- Dont use single letter variables like
iandj - Dont nest so deeply
- Create more methods and make your lambdas only one line long
isEmpty() will throw a NullpointerException if the entity doesnt have this value in its pdc.
whats so bad in any of those
its not even deeply nested
Short answer: It makes your code look dirty and hard to read
And this is too deep
thats not literally even nested ifs
im not working with anyone else
Nesting means opening a deeper scope. You dont need ifs for that.
But you are asking questions regarding your code.
And it will 100% help you to write better code which is easier to debug. Trust me.
you didnt ask what i and j is so it doesnt seem that it was confusing
This is not causal
correlation != causation
w/e it doesnt work so ill just rewrite it all again someday
does entity.damage(value) trigger EntityDamagebyEntityEvent
Should be relative to the src root.
But why do you need to know this?
Yes
Well no
It triggers the EntitiyDamageEvent
I have healthbar manager here as well
Hm?
I dont fucking get it because healthbar is triggered twice for the first time only
and then its triggered accordingly
I feel dumb, does Spigot not have any sort of API to access the Tag system build into minecraft since 1.13? Tried searching for Tag in the docs and I only get something relating to ItemTags used before the PDC stuff.
does anyone here happen to know how to give a block with custom model data like an item texture without making the default one broke
Not possible
bruh
There is only a trick where you place a spawner which has an item in it which has a scaled block in its head.
Hacky and hogs your CPU bc its a TileEntity
sad
Nvm found it, just turns out need to be careful with the search on the docs.
will just have to replace the block items with item items then
you say too deep I say not quite deep enough
arrow pattern is truly the best
if you're going to shoot an arrow it better atleast fly off your screen

for what even is an arrow if it never leaves the bow
like
weird knife ig
legolas stabbed a guy with an arrow one time
that was kinda cool
again asking how to fix this (ProtocolLib 5.1.0, mc 1.19.4):
public static class ItemFrameDataPacket extends PacketContainer {
public ItemFrameDataPacket(int entityId) {
super(PacketType.Play.Server.ENTITY_METADATA);
getModifier().writeDefaults();
getIntegers().write(0, entityId);
}
public void setInvisible(boolean invisible) {
List<WrappedDataValue> values = List.of(
new WrappedDataValue(0, WrappedDataWatcher.Registry.get(Byte.class), (byte) (invisible ? 0x20 : 0))
);
getDataValueCollectionModifier().writeSafely(0, values);
}
public void setMap(@NotNull ItemStack map) {
if (map.getType() != Material.FILLED_MAP) {
throw new IllegalArgumentException("ItemStack must be of type FILLED_MAP.");
}
List<WrappedDataValue> values = List.of(
new WrappedDataValue(8, WrappedDataWatcher.Registry.getItemStackSerializer(false), map)
);
getDataValueCollectionModifier().writeSafely(0, values);
}
}
it is caused by setMap
I am having problems fixing it because the error is not showing where its coming from
yeah ik
You shouldnt need nms when using protocollib
^
I'd say make an issue with protocol lib but seems like you're running an outdated version, not sure if they support those
I mean shouldn't protocol lib handle the bukkit to nms stuff
im running newest protocollib
the problem occured after I updated from 5.0.0 -> 5.1.0
👍
even if its not you'll get an answer from the people who know the library best
this is why I just use NMS i prefer to abstract myself so I can have fun with mojanks code
yo are big names like this ok
nah hurts my eyes. In all realness though yeah its absolutely fine
it wouldn't object oriented if the names weren't obnoxiously long now would it
Object nmsMap = BukkitConverters.getItemStackConverter().getGeneric(map);
List<WrappedDataValue> values = List.of(
new WrappedDataValue(8, WrappedDataWatcher.Registry.getItemStackSerializer(false), nmsMap)
);
let me try :D
no error, but the maps are not getting send over to the player
ngl this is so cancer
Doesnt the player need to be sent some kind of map data before he can see the map?
iirc the map item just contains a map ID and what is redered is sent by an additional packet
I am using player.sendMap(view) for that
created an issue, I will see
thanks for the help though
when you do HashMap#values() it should return a list, right?
Iirc it’s a set
i mean it says it returns a collection but since duplicate values can exist it should be a list right
A Collection. No order, no random access.
^
If you want a list do new ArrayList(values)
will duplicate values still exist in it though or will they be gone
it will
epic
would be stupid for them to be deleted right
just making sure its not a set lol
But what do you need a list for??
trade secrets
i need to allow duplicates for this use case, i guess
Well, then keep it a Collection
not necessarily for the order
huh
The only real benefit of the list is order and index access
does anyone know an api for particles
or maybe like a location api
so i dont have to do math for custom effects
For custom custom effects, you'll need math
hey, is there a way to hide the enchanted glow effect on an item?
without manipulating packets or NMS
use chatgpt for maths
don't enchant it 👍, otherwise yeah you gotta use packets
even then I'm not sure how well packets will work
Damn alr
since the client would know its enchanted based off its NBT and apply the glow effect
you'd have to spoof the client a fake item that isn't enchanted while maintaining the fact they have an enchanted one on the server
was only gonna use packets as last resort
it'll be weird and there is probably going to be a lot of desync but I can't see any other way
or you can use pdc and do all the calculations yourself 😈
pdc?
?pdc
its just persistent data
any way to get console input whenever the sever starts? i have code that runs on server start and I want to ask to run it or not with a prompt such as "y/n"
No
sounds like a terrible idea
Couldn’t you make that a config option?
hmm, maybe
it would be annoying to change the config whenever i wanna run the code which is frequently but not all the time
ig il just make it a command
It depends on whether or not you want that value to be mutable
Oh, sorry, I see what you mean. The constructor one
Yeah, probably safe to clone it, otherwise I could do something like this:
Vector vector = new Vector();
Line line = new Line(vector);
vector.setX(10);
System.out.println(line.getDisplacement().getX()); // This is 10```
Convenience mostly
Anyone know of a way to set a mob to be in its panicked state?
Like when you hit a cow and it starts tweaking and running around and spinning and shit for a few seconds
You could deal 0 damage to it
dude great idea ill try that
hmm no luck, also its being hit acknowledgement "red overlay + sounds + animation" is something i'd like to avoid
looks like a player has to hit it
i've had the most luck with just burning the chicken, otherwise i'd probs have to use nms
Can't u do pathfinders
One way to set it to alarmed state is to set an enemy for it but then it would target that specific enemy
or run away from it
how i undestand this class create vanilla chunk? - https://paste.md-5.net/ahumekinom.java
What is your question
each one contains a String
so it's a Set of PermissionAttachmentInfo which contains a getPermission() method
you have to itterate it to get all permissions/values
no
just stream
Do it once, cache them, then you can delete them at any time for little cost.
How to cache
Compare different mappings with this website: https://mappings.cephx.dev
How do I tell apart its map of this players stands and not the other players
But how do I tell apart if its that specific armor stand
Wouldnt it remove all armor stands of that player
Idk what that is
uh still not a good idea to store entities and such on a map
So how do I do it
Can I just make pdc of name:uuid and loop through armorstands to delete the ones who have it matched
playerid : standid
the proper way is to make an entity that follows the player's lifecycle
and track that entity's position
if the entity dies, you respawn it
but tbh I have no context of what you're doing so
overrated
Hashmap map<UUID, UUID>
you mean
private final Map<UUID, UUID> referenceMap = new HashMap<>(); // PlayerID : EntityID
:)
Why a map?
Hashmap would be fine or concurrenthashmap if you want to use it in other threads
imagine performance
What do you mean?
am I overly sleepy or is this a sarcastic question
I'm a night owl and it's 9:30am what do you expect
Hashmap is better to use. Should only go with map if you need to be more generic or working with making an api. But if you have no specific reason for it then its better to use the one that is specific for it.
Where you used map in your example
How can you prevent players from breaking a block owned by another player? Say we already have the hashset of chunks to player mappings done
part of the dependency inversion principle of SOLID
always rely on interfaces, not concrete implementations
this is ass
this is not
Agreed
time to re-read the basics frosty
yesn't. in some cases it is recommended to rely on the implementations.
so real
Well liskov substitution and dependency inversion arent quite the same
They compliment
It depends on what you are doing. In this case specifying hashmap is no different then specifying map with a hashmap value
There is always a reason for something. Doesnt mean it is better or it should be used for everything.
The advantage of using a map like in your example is the ability to change the implementation without breaking the contract. However as i said this is usually more of a concern when developing an api then anything else because if you need to change the kind of collection you are using odds are you need to change more then just that anyways.
Otherwise its perfectly fine to use the more specific stuff if that is what is needed
You also don't expose irrelevant information like the kind of map you're using
If you specifically need a HashMap, sure use a HashMap
If you specifically need an Deque and a List, sure you can just have a specific LinkedList
Yeah isn't that part of like encapsulation
I dont see an issue with this or why this would even be a concern
It has to do with encapsulation
Always rely on abstractions, not concrete implementations
I remember reading something about it
Frosty's argument is the kind of argument cmarco would make
"I'm the only one working on my code why would I go out of my way for it to be clean"
you both argue the same thing. "use specific stuff if its needed"
you just add personal opinion
which will lead to nothing
we cooking
so imma just grab my popcorn
I really don't want to have this argument tbh
Its not anymore unclean. The stuff in the jdk is meant to be used. I would only worry about something in the jdk is when its up to the jdk implementation in how it works like floats for example. The amount of precision a float has is dependent on both system and hardware
no i like to be explicit and write down every single entry
arraylists are just fancy arrays
I want to spawn like 10 armor stands on right click that would disappear 4 seconds after
didn't I give you code for this?
what is the point
"it is in the jdk so use it"
yeah the interface is as well, so use it
Ik but like arrays aren't that flexible and can be weird to work with
like a week ago
Idk who it was yesterday but It ended up not working
At all
lol
it always depends on the context
in most cases you may wanna use a list
in some cases wanna use an array
if you got a fixed amount of data, there's little points in using a list. if you want it to be flexible, use a list
You dont need to use generics just because. If you need a hashmap then use a hashmap. If you need it to be flexible then sure go with a more generic type.
I'd argue it should be flexible by nature but I'm not here to argue
I mean from an api standpoint
depends
so imma make a sandwich
maybe show an example
so you agree with our point to go with DIP, since you want to have your software to be flexible usually
great
what is DIP
Everything worked for a while but then armorstands werent being deleted, I kept getting null pointer exceptions etc
Apparently applying value and key to armorstand and then checking it is illegal
dependency inversion principle
basically that you depend on abstractions
hm well number 3 and 4 seem kinda stupid
I set key and value to an armorstand, literally what it sounds like
4 basically says you can't impl something twice
which is kind of applicable
except for proxy classes
no clue why you'd do so
code I gave you worked, I used a ConcurrentHashMap specifically
only think I can think of is chunk unloads
No clue why Id use PDC for what PDC is meant for?
What code
might not have been you but the project concept was literally the same
right click and it spawns an armorstand that goes in a determined direction for 4 seconds and then kills itself
And why not use pdc
Because we don't need PDC here
We're not storing data across restarts
we're just running an animation
What can happen if I dont use consumer to spawn entity
data gets sent on the next tick
I wrote this on 1.8 because the guy that asked for it wanted it specifically on 1.8
if you can use the consumer, use it
It depends. It doesnt always need to be flexible.
I dont know what an interface is so im not using it
Reason
So u can tell ur friends
? They dont program
This is liskov’s sub principle, good summary
Tho, reason why you so often use Map term = HashMap() is not always because of liskovs or dep inv
@ivory sleet remember when you showed me that luckperms storage snippet
Uh yeahv
What pattern is that called
Are you referring to the StorageImplementation and Storage?
Its not just one pattern
We follow the humble object principle, adapter, delegation and wrapping
Are good quality servers written 100% by hand or use any external ready to use plugins
External
A mixture
Hypixel uses tebex I think
Whats tebex
They use citizens but forked iirc
Is it possible to spawn player npcs w/o any external shit
What do you consider as external
Anything that I dont write down or just write import
Whats nms
Using Minecraft server internal code directly
yes
just painful
so thats why ppl use these s.c. shortcuts
You gotta do all packet fuckery manually
Any guide for that?
Isnt this plagiarism
Just make sure to follow the license if you wanna include their code
Depends. Anything that uses cb/spigot code not necessarily. However anything else most likely
I'm pretty sure citizens have one license covering entire project
You cant relicense code that isnt yours
Look what I said above
What happens if i dont do it
Well its personal use only I am not setting up public server
Depends on the license, again
With GPL you don't have to release code used internally, but you need more context
I did and my point is, the license only covers code that is theirs. Any code not belonging to them such as anything in the spigot/cb api or server code is not subject to their license as well as anything to do with the mc protocol.
Gnu faq is a good source of information
Since citizens used spigot API it's gpl anyway
Both spigot API and citizens
Yeah thats why I wanted to do it myself
Can't look up the repo rn
AGPL for example considers network use as distribution
But that's mostly for web related stuff
@storm crystal if your code will also be public with the same license you shouldn't have any problems
There is licenses that are compatible with gpl. Not saying citizens isnt gpl. Just that just because something is gpl doesnt mean it has to have a gpl license as well
You can additionally mention where the code was taken from
Well yea but rare case
Ofc no im not gonna post my plugins amywhere
Then make sure you're not violating the license
But also what's the point of copying large parts of citizens
If im not gonna post it how they gonna know tho
If you wanna modify you can fork
By accident/ accidentally leaking in game
No
Just write it yourself or use citizens
You can also expand by using their api
And just make an addon
I dont know how to use apis so no thanks Id just write it myself then
Using an API is Def easier than writing your entire implementation
You use spigot api o.O
Using an api from another plugin or jar is no different then using spigot api in java
dusktaler considering the fact that you havent done java nor minecraft for very long
unsure if writing citizens urself is the best idea
Why
because its not a small project directly
Do it in python
oh god Citizens rewrite would be a nightmare, even for the most experienced of programmers
5 fps
Before you know how BIG the task it you quickly jump in. It would be a real nightmare, but you would learn a lot if you spend time doing it
I found myself rewriting more often as I gained more experience. It's a vicious circle.
yep
Whenever I look at your old code I think the same 😄
Honestly not seen any of your code 🙂
everyone does about everyones code
unless it's by 7smile7, then we all look at it and think, what the hell does it do.
im not too fond of relying on someone else's project
but it's not something simple to write yourself
I dont know what fork is
his old code 
how can i check onPlayerInteract and PlayerToggleSneakEvent in the same moment? with the same @EventHandler?
that is not how events work
because i want to check if player on rightclick with the picaxe is shifting or not
you can check player.isSneaking inside the interact event
oh ok thx
for check 2 thinks in the same if it's && right?
if they both must be true then && yes.
if only one have to be true then ||
&& = AND
|| = OR
oh cool thx
btw my problem wasn't it it was i didn't remember to put the commands in the plugin.yml
Ehh k
the first one is true then the next one is evaluated
*And
with & both are evaluated, even if the first one was false
with | both are evaluated, even if the first one was true
there is no short circuiting?
Well for && and || there is.
anyone happen to know if brushing a suspicious sand/gravel block triggers like a BlockFromToEvent or a BlockPlaceEvent
how can i cancel that the player cant click on another players in spectator mode? i already tryed the playerinteractevent and the playerinteractentityevent but it dont works.
?jd-s
Good question
What's a good use for that
Does || evaluate both, even if the first statement was already true?
For example
if(someCheck() | otherCheck()) {
}
If you want to make sure that both methods are called
no
^
But why would I want that
those are for bitwise operations
Yeah, I thaugt so, the msg from smile made me worry. Cause I otherwise I would have created so many unintended issues XD
Are you asking why you want a method to be called?
Yeah
If it's for an if check
To create functionality in your program...
But in that specific case
^
you usually dont use them if you aren't fucking with bits
so your question is justified
Ehm
in case you want to check both, that's it. 🤷♂️
Smile just wrote them a sshorthand
He didn’t mean the bitwise operators
Basically if you want AND or OR
he meant the bitwise operators
Or did he
that was the whole topic lol
^^
Great pun from my side
Ok here a concrete example:
You want to equip both a main and an offhand weapon.
In case both where equipped: Add a special attribute to a player.
You want both methods to be called in either case.
if(equipMainWeapon(player, mainWeapon) | equipOffhandWeapon(player, offWeapon)) {
addDoubleWieldAbility(player);
}
But if the first is false, then the offhand method should still be called no matter what.
That makes sense
Or if you just want to do a bitwise OR 
Lol
Oh yeah. Looking cool is always a plus.
Get some bit shifting in
Yeah. Screw dividing by 4. Just do x >>= 1;
I had some fun with bit shifting recently
@Override
public int hashCode() {
int hash = minBlockLight;
hash = (hash << 4) + maxBlockLight;
hash = (hash << 4) + minSkyLight;
hash = (hash << 4) + maxSkyLight;
return hash;
}
Yeah but this is reasonable because you are essentially creating a bit mask 🙂
I would probably not have mixed bit operations and arithmetic here...
alt + import -> generate hashcode 😛
Apparently shifting is after addition in order of operations
Doesnt this essentially do the same?
public int hashCode() {
return maxSkyLight | (minSkyLight << 4) | (maxBlockLight << 8) | (minBlockLight << 12);
}
Wait let me think if the sign bit matters here
how can i check if all the block in 2 location (the 2 corner) it's == Material.Air?
pro tip: make a cuboid class that's also iterable
for (int x = minX; x <= maxX; x++) {
for (int y = minY; y <= maxY; y++) {
for (int z = minZ; z <= maxZ; z++) {
Location blockLocation = new Location(world, x, y, z);
Block block = blockLocation.getBlock();
block.setType(resetMaterial);
}
}
}
}```
but idk how can i loop form 1 to the other within that
Step 1: Create a method which can iterate over all Blocks within a BoundingBox
Step 2: Create a BoundingBox with those two corners
Step 3: Iterate using your util method
The method stub could look like this
public static void forEachBlock(BoundingBox box, World world, Consumer<Block> action) {
// TODO: Impl this method
}
I should add a method to BoundingBox for that
You are doing too many PRs lately...
Shame bounding box isn't worldbound, otherwise it could be Iteratable<Block>
issue? :p
talking about PRs coll
😏
have you had time to look at the feedback on the BlockType and ItemType one ?
I have
My only issue with these types of methods is that it creates so many CraftBlock instances :(
If you really did want to implement something like this though, you could do it just by passing in a RegionAccessor
ye
BoundingBox#forEachBlock(RegionAccessor, Consumer<Block>) would be fine
I felt like it was off the last time i looked at it. Especially the ItemType#getBlockType() was weird to me
nice 👍 idk what your point of view on this is, but I certainly hope we can find some way to get rid of ItemType<?> across the entire codebase
MD seems fine with the current impl
I mean
Not sure how @worldly ingot feels
He feels hypixely
half the point of the rewrite was to not make the same mistakes again 
I don't mind the generics
another has and then get call just to not blow up
when you could instead do this with the type system
Nothing prevents you from just BlockItemType extends ItemType { getBlockType }
I understand why you want an option without the generics
oh coll i forgot to ask @young knoll why is ItemType a generic when the generic will never have an applicable use
I dont know why but i feel like we gonna see a lot of
@SuppressWarnings("unchecked")
...
ItemType<?> generic = ...;
ItemType<Specific> something = (ItemType<Specific>) generic;
But you gotta convince MD not me :p
What does >>= do?
I mean he gets the say on if he merges it
well yea
Its like x += 1; but instead of adding 1 you right shift x by 1
but I think it would be worth to at least halt merging this a bit to explore a potentially less verbose option
Who knows 😅
I don't think its even about the verbosity tbh ItemType just doesn't make sense having a generic tbh
I mean, I 100% get it for nicer builders
but yea, beyond the builder there is literally 0 usage for them
getItemMeta with no casting 
Yea, but that is literally only the case in the builder
not really plausible, unfortunately
Sure it is
I mean yea it 100% could be
but again, only really in the context of you specify the constant you call on
the API does not really have many places where it can yield you back an ItemType with anything but <? extends ItemMeta>
actually, probably like nothing ?
idk if anyone has an example
I guess ItemStack would have to become generic too
If you wanted stuff like getItemMeta
I mean, you are just moving the problem one layer up
mhm
||Stream<Block> stream(RegionAccessor)||
gtfo
I will mark the PR as draft for now
hey, at least you can short circuit!
Just in case he does plan to merge it
you can't shortcircuit a forEach(consumer)
tru
the only thing about the solution machine posted that is not optimal is that you cannot have a
void createBlockData(Consumer<BlockData> consumer)
on BlockType directly
I'll short circuit u
do it
because the Generic<T extends BlockData> extends BlockType cannot overwrite that
given that those don't erase to the same thing
ok
you know what PR isn't draft 😈
I actually do I have a few quirks to fix, but otherwise yeah
there is one with chests not opening properly if you create its menu bound to a world position
it creates a new menu at that location instead of using the block's chest
I think that's the only inconsitency though
of what
Inventories
From what I gather an inventory is just an array of items, and the view controls how they are displayed
yep pretty much
Inventories are pretty much just glorified lists lol
So a crafting table is just a list of 10 items
What happens if the inventory has more items than the view expects
the view only displays the amount it expects
Or if it has less
the less doesn't matter
imagine you have an array of 10 slots you can still put an array of 9 slots in it just fine
inb4 ArrayIndexOutOfBounds
if you have a maximum array size of 10 slots and you put in 11, well the way inventories work is it simply will ignore everything after 10
I mean you could make an inventory of size 10 billion, but you can still only display 54 items max
I miss the old glitched 6+ row inventories
And then there is bedrock, doesn't support 1,2,4 or 5 row views
bedrock jank
yes bedrock is jank
@young knoll Inventory PR internals are just a ton of patching and my favorite, Deletion of CraftContainer and CraftInventoryCustom
Is backwards compat all working?
Bedrock transactions 💀 😬
yep no backwards compat errors, there are technically some breakages in API contract, because previously a bunch of inventories form Bukkit#createInventory wouldn't work as intended in vanilla, but now they do, however, I'm hedging my bets on these not actually being used seeing as there is nothing to do with them anyways
That's deprecated
:c
you either use MenuType#create, Bukkit#createInventory, or Bukkit#openContainer(Location)
doesn't matter you can edit that type of stuff in the view
Hello, I still have this problem so I'm coming to do a little UP, please help me 🙂
that type of stuff is fully deprecated, I was thinking of adding a Consumer in MenuType#create so you can edit the view before you get it back, that or adding <T extends InventoryView> T openInventory(MenuType<T>, Consumer<T>)
I'll probably do the latter rather than the former is redundant if you're creating hte view from MenuType its implied you're editing it anyways
Fair enough
I realized something silly the other day
We have a half api for spawners, but no api for spawner minecarts
I have question
tbh I forgot spawner carts existed
And apperently everyone else did too since no one has complaied about the lack of api :p
?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!
making a jira issue right now
guys if i want to hide trails (particles) of another players in server can i do it by protocolib?
Probably
ProtocolManager manager = ProtocolLibrary.getProtocolManager();
manager.addPacketListener(new PacketAdapter(Main.getInstance(), PacketType.Play.Server.WORLD_PARTICLES) {
@Override
public void onPacketReceiving(PacketEvent e) {
Player p = e.getPlayer();
//if(Main.getInstance().data.getParticles(p.getUniqueId()).equalsIgnoreCase("Disabled")) {
e.setCancelled(true);
// }
}
});
reminds me that we need more Jira issues for inventories so i can truly collect them all, I only have 8 at the moment
lol
finally solving one from 2015 too lol
I didn't do that for the express reason of 8 being way too much
that and when it was a draft I didn't find all of the issues yet lol
Hey so I'm currently trying to spawn a custom made mob the problem is the SpawnCreature Event is getting called but the entity does not spawn does someone got a idea (No errors | Version: 1.20.1)
Spawn Function
Mice mice = new Mice(new Location(Bukkit.getWorld("world"), 9, -11, 526), new Location(Bukkit.getWorld("world"), -3, -11, 526));
ServerLevel world = ((CraftWorld) Bukkit.getWorld("world")).getHandle();
world.addFreshEntity(mice, CreatureSpawnEvent.SpawnReason.CUSTOM);
Entity
public class Mice extends Silverfish {
public Mice(Location loc, Location point) {
super(EntityType.SILVERFISH, ((CraftWorld) Bukkit.getWorld("world")).getHandle());
//this.setNoAi(true);
//this.setSilent(true);
//this.setPosRaw(loc.getX(), loc.getY(), loc.getZ());
this.setPos(loc.getX(), loc.getY(), loc.getZ());
this.goalSelector.addGoal(1, new MicePathfindingGoal(this, point.getX(), point.getY(), point.getZ()));
}
}
What is the location of it in SpawnCreatureEvent?
Let me try to log it
..
I'm trying here to cancel particles packet
But it doesn't work
anyone have idea?
It is at the right position
?
I mean if SpawnCreatureEvent is firing the thing should be there provided that it's not being instantly killed
You're not spawning it in the ground are you? -11 on Y seems a bit weird considering that screenshot makes it look like you're on the surface
Its on the ground level
Like, -11 IS ground level or above it?
How do I send a message that redirects to a url when clicked?
Go to the bungeecord chat
but I use spigot
spigot bundles bungeecord chat
its a shared library between bungeecord's API and spigot's
You’d sent a component with a openurl clickevent
I have looked thru all the spawn methods I could find, and I can't seem to find one that will check if the mob's spawn requirements are meat.
Don’t think they can be meat, but I don’t actually know if there is a Bukkit api to check that
met*
i give up xD And this is why spell check exists.
Otherwise I was just going to implement it myself, mostly I can about that not being inside a block part. Since I don't care about light level in my case.
(I am implementing a powered spawner that will spawn as long as its loaded and has fuel.)
It is gound level
I guess I can't check it in the event if it is alive or?
So I can say the entity is not dead
What are some of the ways we can detect what inventory is opened and any way to keep track of them individually?
What is the way ur doing it now?
No clue then
I'll tried to check if it is dead but its not dead so it should be alive
checking inventory names.
projectile.setBounce(false); for 1.20.1?
Okay entity is not valid
event.getEntity().isValid()
Returns false
Weird
Yeah it is
What is the intended purpose?
About that, I got this
component.setClickEvent(new ClickEvent(ClickEvent.Action.OPEN_URL, url));```
and I don't know how to send it
I tried component.toPlainText() but then it didn't redirect
Player.spigot().sendMessage
^
Well a lot, but my current purpose is just to display my achievements to the user. So all I need to do is cancel click events, and make the achievements glow if they have them or not.
thx
Like can I give an inventory a identifier of some sort? on the code level.
The inventory object can be identifier
how would i keep track of those?
List<Inventory>
A set would be fine if u don’t care about the order
nah i just need to know whats what
I'm making a simple userInterface creator so its easier to make menus for me, and I want to have the option in there to auto block user input, I'd have an event that checks for every inventory event, and if it has whatever indentifier to block input it will. How would I do that? only way i know is by having it in the name and that just doesnt look good.
Quick question again:
Is there a way too tell someone, maybe via a keyword, that a function should be async; Or do I just have too mention that in the java docs?
wrap the inventory object
then you can store whatever you want
No, ItemStack cannot be generic unless you remove setType to change the itemstacks type.
The vast majority of types someone will use ItemType, BlockType, EntityType will be in situations where the generic is useless. Think about when you use generics on Java Collection types. You, most of the type, know the generic type. That isn’t true here
There is a use for them, but only when directly referencing it via the field, which is what the pattern I suggested does. It keeps the generics where they are useful, and doesn’t include them everywhere else.
hello guys, i want to install hackintosh macOS sonoma 14.1 on my pc, who can help me find kexts?
Dafuq
i don't know any about my uhd graphics 630 startup on this macOS version
Go ask in a hackintosh discord
lol
ok
i will try install without help
Ok
Thank you.
It’s working without kexts
lol
Why would you do that lmfao, just buy a Mac lol
Bro, I don’t have money(
It probably won't even work properly
Then use Linux
I don’t like Linux
so buy a Mac 🗿
There are so many distributions; you can make them look like macOS
I want to use normal macOS
as a macos user my self, linux gets really damn close. people love mac who use linux ( some of them) those that do build those themes, you can turn your entire linux distro to be a lookalike mac.
can I apply this to entities as well? to manage them the same way as inventories?
no idea
Which part?
like handling certian actions for them. when they target an entity, when they hit an entity etc. to manage what to do with them when those things happen.
Sure you can do that
exactly what I was saying too. I also have a Mac, but I know that on Linux, you can make it look almost (if not exactly) like macOS
why my cpu is unknown??
Cause it’s not apple

ok, but on ventura it's shows my cpu model, intel core i5-9600k
Okay
So on the plugin Manager there are functions to register events. Is there a way to unregister a handler?
Yes
Yeah I love linux, I've done it countless times my self, I only just use a macbook because of just how god damn efficient they are. i will always hate spending the money, but the 15 hours of battery life i get is insane.
There are unregister methods on the HandlerList
I don't really care about money. If you think about it, a maxed-out desktop PC with the latest top-of-the-line components will still cost you about the same as a MacBook. Many say $7k is a lot, but on that MacBook for that much money, there's an 8TB SSD lol. I used Windows for many years, but it doesn't compare to macOS. Plus, I like to have everything synced on all devices
I tend to stay away from Apple due to their love of making it hard to do anything, and also just leaving old devices to rot / not pushing out updates just to get you to buy the new stuff. (I still use my iPad mini I had to get for senior year of high school, on iOS 12 xD) My MSI gaming laptop when new had a 7 hour battery life, provided I didn't kick on the GPU, used it for classes alot in College.
Not to mention you get locked into their eco system
🤨 Apple provides updates for devices for another 6-7 years
Question, when the server is shutting down, I want to assume it does the sensible thing and unloads all the chunks before say saving them to disk. Want to only save the data for my power spawner on chunk unload, and load it on chunk load (using PDC of the chunk to store it.)
Yes?
Nah most Apple devices stop getting updates about 4 years after release if that.
I don't have any issue with that at all. I prefer a closed ecosystem; it's better than an open one where developers find it impossible to make an app run decently on all devices
Well they did for my Ipod 4gen, Ipad Mini 2 and iphone 7. It does updates differently for its laptops.
Apple is a nice experience imo
It is nice, but it just hard to get stuff done. Can't even make an app for an Iphone with out a mac. (Plus it also has to be on the latest update or you can't install the IDE for it.)
?paste
i wanted a Mac to develop iPhone apps
BTW I have been having weird issues where my server (even with no plugins) will hang after typing stop to stop it. It will hang untill it does that dump becasue it was sitting for so long.
Now get ready for 100$ dev license
https://paste.md-5.net/efuvicukac.cs
The events aren't being fired.
its going to be increased soon irc
i pay for it 😦
Did u register them
yes i registered the entitylistener class
I wouldn't overide the listener
If you are going to do that add the event handler annotation again
wdym?
@Override
@EventHandler
public void onAttack(EntityDamageByEntityEvent event) {
PolarBear bear = (PolarBear) event.getDamager();
Player[] onlinePlayers = Bukkit.getOnlinePlayers().toArray(new Player[0]);
MonsterType type = MonsterType.getMonsterType(bear);
Ability.iceStomp(bear, type, onlinePlayers, 20, 10, 20, 5.0, 3, 0.13 );
}
This?
Yeah like that
Interesting, the server does not fire the ChunkUnloadEvent when its shuting down, even if players were on.
yeah no still not..
You could probably report that as a bug
If it isn't already
Is it possible to make blocks render on client only side?
?jira
Yes use the Player#sendBlockChange method
Ah okay I was just curious tbh
Anyone know if there is a way to put a container tile entity in the world on a block in the world, to make it interact with hoppers?
i need help
?ask
If you have a question, please just ask it. Don't look for staff or topic experts. Don't ask to ask or ask if people are awake or available. Just ask the question to the channel straight out, and wait patiently for a reply. Make sure you use the right channel regarding the topic of your question. Create a thread in case the channel is already in use!
?help
selfrole Add or remove a selfrole from yourself.
cleanup Base command for deleting messages.
embedset Commands for toggling embeds on or off.
info Shows info about CafeBabe.
licenseinfo Get info about Red's licenses.
mydata Commands which interact with the data CafeBabe has about...
set Commands for changing CafeBabe's settings.
uptime Shows CafeBabe's uptime.
findcog Find which cog a command comes from.
names Show previous usernames, global display names, and server...
userinfo Show information about a member.
listcases List cases for the specified member.
reason Specify a reason for a modlog case.
permissions Command permission management tools.
When I want to forward the gmail spigot to my account, it does not do it.
?
just do it better
Agreed
My account is not verified on the spigot page because I am not receiving any gmail from spigot.
Check ur spam?
Yes, I checked everything and there's nothing 😦
Building a fresh Spigot build with a new copy of buildtools just to make sure it wasn't something fixed. (And maybe the server dumping due to not stop will be fixed as well.)
Try messaging
okk ty
https://paste.md-5.net/efuvicukac.cs
Why events no work?
Did u register both
You got two listeners
oh my....
@echo basalt why are there so many methods
which one is for getting spawned armorstands and deleting them
istg forgetting to register shit is always my problem...