#help-development
1 messages · Page 770 of 1
Some javacord thing
how I fix that ?
Idk, too lazy to look into it. DSeems to want a DelegateFactotyDelegate implementation
Also do note
Running javacord in onEnable and not async might be a bad idea
i want to make a click listener and got this
import org.bukkit.entity.Entity;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.player.PlayerInteractEntityEvent;
import org.bukkit.event.player.PlayerInteractEvent;
import org.bukkit.Bukkit;
public class ClickListener implements Listener {
@EventHandler
public void onPlayerInteract(PlayerInteractEvent event) {
Action action = event.getAction();
String playerName = event.getPlayer().getName();
if (action == Action.LEFT_CLICK_AIR || action == Action.LEFT_CLICK_BLOCK)) {
Bukkit.broadcastMessage("Le joueur " + playerName + " a effectué un clic gauche.");
}
else if (action == Action.LEFT_CLICK_AIR || action == Action.LEFT_CLICK_BLOCK) {
Bukkit.broadcastMessage("Le joueur " + playerName + " a effectué un clic droit.");
}
}
and it's working on everything but mobs (and i want it to works on mob)
It’s another event when you interact with entities
Also please compare enums properly
And not by their string name
better?
Would I have to delay it by using a scheduler? 🤔
got this too but not my code and idk how to make it works for left click
@EventHandler
public void onPlayerInteractEntity(PlayerInteractEntityEvent event) {
Player player = event.getPlayer();
Entity entity = event.getRightClicked();
Bukkit.broadcastMessage("Le joueur " + player + " a fait"+ event.getEventName())
if (entity != null) {
player.sendMessage("Clic gauche sur une entité !");
}
}
}
?jd-s
Look it up here
May anyone else take a look please?
Yes
Idk exactly why but display entities just won’t interpolate the same tick they are spawned
my guess is that it uses SPI to discover something and that doesn't play nicely with relocation
it's just the login, it's fine
mfw DelegateFactoryDelegate
weird stuff
true
Al right it works, just doesn't scale the way I want it sadly
it scales up from the corner to the entire size, but I wanted it to scale up from the middle towards both sides
I wanted to ask what is the most optimal way to store messages in my plugin?
I found it is very hard to keep track of all the cases where I need to send a message to a player or a list opf players or the whole serveror just the admins and each group has thier own messages that i will need and it just gets very messy
what's an efficient and clear way of storing messages
There’s many ways
thank you! <.<
how do you retrieve permission for specific command in plugin.yml?
Do I have to loop through the commands list and do something there?
player.hasPermission(String permission)
xD that checks if player has a permission
what do you aim to do then? I may have misunderstood
Can I retrieve this permission string from plugin.yml for specific command? eg.:
I believe you will need to write your own handling for that, if you are trying to check the required permission for a command
what kind of messages and for what purpose?
things like " you do not have permission to do that!"
" you need to be in a lobby first"
"player has invited you to a game"
and so on..
ah.
and also need to dynamically add in the plugin prefix and the players' names
"you are missing permissions <permission>" type thing?
well, first you would categorize the messages. Error messages, info messages(can be sub categoried depending for who or where it came from). Once you do that, then you can create the variety of messages you want. But you only really need to store messages if you want them customizable or if you want to follow the Iln8 standard
in each Command class eg. CommandAfk, CommandCraft, im checking if player.hasPermission() and right now what i have is this:
I want to have a command that retrieves permission string part from plugin.yml for that command
You can have your command handling check if user has the required permission of the command being run, then return a message with the permission. But it all depends on how you handle your commands
Iln8?
meant i18n
hmm
its a type of standard that allows messages to be swapped out easily for translating purposes. So you would have one file per language etc
Sadly I cannot verify so I can't send screenshots
ah yea exactly what I need
the plugin comes default as english, anyone can edit the messages as they wish
It appears I have to load plugin.yml as a config and load values from it
I think thats also the easiest way
I believe ill save them in a config file then retrieve the one I need whenever
Yeah... idk if thats the best way though
You need to spend time in writing a proper subcommand/command handling system
but How do I replace the %PLAYERNAME%, %SENDERNAME% and so on?
i guess ill reseach that
And have the permission load as part of each registered command
I have written this I just need to retrieve the permission part
xD
So when you run a command, it can return your defined values
DM me and show your command handling
well instead of editing the messages directly, they would just provide a yml file with the language of their choice named appropriately with the two letter language identifier, then its a matter of them selecting the language they want by inputting it in the config, and then your plugin just searches for appropriate yaml file. If it can't find it, it can notify and default back to whatever is default. Same goes if any messages are missing
essentially all the yaml file structures would be identical, the only difference is which yaml file you are using
What do you mean with command handling though? I have a class per command
this allows you over time to provide translations as well as users to provide their own
and in onEnable I do this
Simple as that xD
Is there a way in spigot to add some kind of information to an item_display entity in order to be able to remove that specific kind of item_display and not regular item_displays?
yeah..
that sounds like a good way to go

DM
why
Ok dw, I won't help you then 👍
I dont need any more help, I asked how to retrieve permission string part from plugin.yml and you're asking me about my command handling 
What even is a MinecraftScreenshot
You cant do that async obvsly
Because the world could change while the ray marches in another thread.
This would completely scramble the consistency
Yes... because you are obviously trying to get the permission from a command, no? Retrieving it from plugin.yml isn't the best option... I am trying to help you, but you're being cocky asf 💀💀
Sure
You either want help, or you don't... jeez
Chunk chunk = ...;
ChunkSnapshot snapshot = chunk.getSnapshot();
What size is your image?
Because this could take a few minutes to render
not that I know, you can make a wrapper class or something similar though, or they probably have a uuid
Ok a few hours in this case
Ah you are not doing any material calculations and dont have any light sources
But interesting idea to calculate a server side view of the player
A what
So the server can spy on the client or what
Hmm
That's a simple client mod
Well, no
Both sided
Yeah
Packets are ass
wait u can take a screenshot via spigot??
can i see the output
is MinecraftScreenshot something you made
will it be open source 👁️ id love to try it
It’s not a real real screenshot, but more of a representation of what they should be seeing
that's probably a better idea since you can process ChunkSnapshots asynchronously too
i mean, i was gonna have some sort of this in my ml image plugin
ml?
machine learning
the first interesting CMarco plugin
So how does the bible correlate to this
😈 hey marco if there is any plugin to make premium it'd be this one
screenshots you can then displayon maps etc would be a wild idea
easier said than done
its not possible for plugins to access screenshots right
unless you upload the screenshot somewhere first
ofc not lol
No
but at that point you might as well just use imagemaps or smtn
oh my you guys he is just doing lots of fucking math
im a bit confused.. you write it as a png then save it in the data folder, so why cant you just access it lol?
It’s missing the usual bible flair. I am dissappointed
when using multiple maps you could but you might as well let another map plugin do that
so if im getting this right you're basically constructing a screenshot, brother
insane, but very cool when pulled off
will the blocks themselves have textures or will you be doing solid colors for them
He wants to have textures, but he’s lazy 100%
Hey, how to get commandmap/list of all commands in the server?
Google your question before asking it:
https://www.google.com/
might as well create a little rendering engine that constructs the minecraft blocks the player can see and make a literal screenshot with that with like lighting and stuff
unless thats what you're doing
Answer: mainClass.getCommand("commandName").getPermission();
Yes
It was there or intended to be there at some point https://hub.spigotmc.org/javadocs/spigot/org/bukkit/Material.html#isTransparent()
declaration: package: org.bukkit, enum: Material
Try and see if it was ever implemented 🤷🏽♂️ Else time to cry over an enumset with transparent shit ahaha
Hey that's my line :(
You can borrow it, it's okay
i mean sure, the point is that it
does not have an implementation which is well linked to the underlying server
which is why it says contributions welcome

@slender elbow I expect to see you implement it within a week
Even ItemType doesn't move that method over
he is in fear
I mean yeah probably. That's what the docs say lol
How often do servers have a gpu
oh no
You could make a server player with cmarcos thingy
GPU used by render sections of servers or some ai
According to the server however, they allow light to pass through, which is transparency
I know, which is what Material#isTransparent() is doing
Remember that Bukkit is a server API
just wait till it isn't
im gonna put bukkit-1.20.2-R0.1-SNAPSHOT.jar in my fabric folder
Do it
im sure that'll go well
I dunno what to tell you. The implementation is correct
Not great, but it's accurate
cpu is not for graphics
I have my own utility tag class with these
?jd-s
But I use
private static final Set<Material> ALL_GLASS = EnumSet.copyOf(Arrays.stream(Material.values())
.map(Enum::name)
.filter(mat -> {
return mat.endsWith("_GLASS") || mat.endsWith("_GLASS_PANE");
})
.map(Material::matchMaterial)
.collect(Collectors.toSet()));
dont we have a tag
No
declaration: package: org.bukkit, interface: Tag
Just checked
🥲
Minecraft tags are very limited
private static final Set<Material> ALL_GLASS = EnumSet.copyOf(Arrays.stream(Material.values())
.filter(mat -> mat.toString().contains("_GLASS"))
.collect(Collectors.toSet()));
Shouldnt that be enough?
They only really exist when Mojang has need for them in vanilla, and even then idk when they need em cus the things you'd think would have tags don't
Ye it should
I was too lazy to change the endswith
I yoinked it from this channel
What about Material.GLASS thats also kinda left out
Imagine using fahrenheit without telling us
North Florida*
I also had this problem this morning :(
Happy summer 🗣️
I'm also sore as Frick because I moved my queen mattress by myself twice yesterday
Weak
Once to try something new, the second time in the middle of the night to put it into it's normal position
Move it twice again in two days and repeat every two days
XD
Until u can move it whilst sleeping
That would be pretty impressive
Buffelemphii
@ancient plank omg you're back
ive gone from struggling for coal to having more coal than ill ever need again and not having enough oil
y2k im tearing ur house down and mining oil
@young knoll do you know what I did today
idk how im even gonna find more oil bc ive already had radars scanning my local area
bought factiorio
no even better
resolved all of Marvin's Comments yk what that means right
Inventory Improvement PR on top again
but no one else has power so i cant go and rob their oil without taking power with my train
i didnt even realise this was help dev
guh time to study for midterms
don't have the game yet
just make way more power than you currently need
I go to an american college I've just waisted over 2,000 dollars if I don't pass a class
ratio
I have a commission to work on too
what is it
Generator plugin with sum plugin hooks!
Am addicted to garlic
extra optimized :3
power gen or item gen
your priorities are wrong
factorio > commission > > > > > > > > school
item / currency generators
Colleges gets advantage of people who dependent.
how many monies do you get for the comission
doing it for my friend so tbh I haven't calculated yet I just started working cuz it sounded fun
probably more than 150 tho
shake a my head
considering I have to basically make TileEntities 😭
yes... nvm its epic I won't bother
if only it were that simple
just make it super laggy
That’s quite cold
NEGATIVE 900 C??!?!?
I believe you have broken some laws of physics
Laws are just suggestions
is there any way to set item frame's content just for a specific player?
what packets?
so with protocollib?
the fact you remember that is crazy
still advisable to check wiki
and the history for the version you’re dealing with
cause i remember i had a long issue with someone where they reported issues but the actual issue is the index changed
by 1
over the versions
and thats the reason why it didnt work
I'm sorry what is going on here
so confusing =)(
Why is OJ simpson banning me from a thermostat for leaking government documents while I sit in a room that is colder than the laws of physics
The temperatures below absolute zero are government secrets
hello everyone, i am trying to make a custom block plugin with rewards etc, its currently published on spigot etc. but i want to add WorldGuard support, i have tried visiting EngineHub discord but to be honest its pretty dead and their approach hasn't worked out for me
I currently have a custom flag called epicblocks-break which defaults to false and have a check that does this
public boolean canBreak(org.bukkit.Location bukkitLocation, Player player) {
Location location = BukkitAdapter.adapt(bukkitLocation);
World world = BukkitAdapter.adapt(bukkitLocation.getWorld());
LocalPlayer localPlayer = WorldGuardPlugin.inst().wrapPlayer(player);
boolean canBypass = WorldGuard.getInstance().getPlatform().getSessionManager().hasBypass(localPlayer, world);
if (canBypass) {
player.sendRichMessage("<red>can bypass");
return true;
}
RegionContainer regionContainer = WorldGuard.getInstance().getPlatform().getRegionContainer();
RegionQuery regionQuery = regionContainer.createQuery();
return regionQuery.testState(location, localPlayer, STATIC_PLUGIN.getEpicBlocksFlag());
}
The only problem is that this flag to work also needs the block-break allow flag and i need to cancel each event that doesn't match a custom block, sadly my tries have indeed failed and can't seem to get this to working AS EXPECTED, in my various implementations i got players to break custom blocks but couldn't break any other blocks in regions that didn't even have the flag to allow, tho they were inside a bigger region with it as allowed. can anyone help me?
this is whats in my BlockBreakEvent listener
Optional<PlacedBlock> placedBlockOptional = epicBlocks.getPlacedBlockManager().get(blockLocation);
boolean isCustomBlock = placedBlockOptional.isPresent();
if (epicBlocks.isWorldGuardHook() && !WorldGuardUtil.canBreak(blockLocation, player)) {
if (isCustomBlock) blockBreakEvent.setCancelled(true);
return;
}
if (placedBlockOptional.isEmpty()) return;
PlacedBlock placedBlock = placedBlockOptional.get();
if (!placedBlock.getCustomBlock().testRequirements(player, player.getInventory().getItemInMainHand()) && !player.hasPermission("epicblocks.bypass")) {
blockBreakEvent.setCancelled(true);
return;
}
I mean if the people who made the shit can’t help you👀 Don’t you think you are doing smth wrong
i indeed tried their implementation but sadly it doesn't match the requirement i need
what should I use here?
players can only break the custom blocks and nothing else as they said and i allowed the block-break flag else it wouldn't even break the block because its more protection
Maybe NBT tags are a solution for this?
?pdc
could shorten that sentence by using the word subzero
How to change player skin?
PlayerProfile API WOOOOO
Is there anything to specifically lock an item into players inventory ? So u can throw it, store it, craft with it, and doesnt drop when u die ?
https://blog.jeff-media.com/creating-custom-heads-in-spigot-1-18-1/ @kindred sentinel this example is how to do it on player heads however the same applies for players yo ucna get their player profile using Player#getPlayerProfile() iirc
Spigot 1.18.1 added the new PlayerProfiles class, which finally allows us to use custom heads without needing any reflection! You can obtain them as normal items, or actually place them down into the world. I’ll show you how both works: Creating a new PlayerProfile First, we gotta create a new PlayerProfile object. To do so,...
What is the problem?
Caused by: java.lang.IllegalArgumentException: Cannot get data for not block ITEM_FRAME
this is the line: java p.getLocation().getBlock().setType(Material.ITEM_FRAME);
actually an item frame is not a block
hey
indeed
what are the chances of concurrent yaml config modification??
does it happens when config is modified in the same tick multiple times? or how does that work
why would you ever need to concurrently modify a yaml config
that error should never occur unless you are wildly misusing configuration files
then why does exception for it exists? because it should never occur?
because it could occur if someone is doing something dumb
which exception? ConcurrentModificationException?
exceptions are in place for unexpected behavior not expected behavior
yeah
that exception isn't specific to yaml files
I mean to File in general I guess?
that exception is thrown when something is modified conurrently that isn't supposed to be
My question was how does it happen? If file is modified in the same millisecond? tick? How does that happen in Yaml?
asynchronous processing
or more accurate concurrent modification
you really shouldn't need to worry about it as long as you don't well conccurently modify your configurations
if you want to concurrently modify a yaml config there is two ways, you can modify the yaml config data in memory since yaml file contents are stored in memory, or you can create a memory mapped file object
however, snakeyaml does not support concurrently modification if I recall, so you may have to either modify this or use some other yaml library that would support such a thing
no no I'm just patching things up so there won't be any unexpected errors. each player has its own config so i guess there shouldnt be any problems
conccurently modifying a yaml file reeks of using it as a database
it isn't really to do with modifying a file, usually it's because you're misusing a collection (adding/removing items from a list/map/set etc while iterating it), but it could be anything, would need to see the stacktrace to see exactly what's throwing that
please use a proper database at minimum SQLite, spigot provides the driver for you so you don't have to worry about jar size
well it is a flat file storage, which is technically a form of DB albeit not very efficient one usually beyond a certain limit lol
ironically most servers won't get big enough for it to cause problems, but still especially if the plugin is being released publicly doing something right is important
YAML is definitely far from a good storage format
well it is a storage format, not sure what you mean it is far from it when it already does this
yaml is a super set of json
When dealing with a larger amount of players and player data, is it still ok to use yaml? json/gson? or is sql server the best option?
if you are doing data driven development YAML and JSON definitely have their uses their, but as an actual database its not ideal
never said it was the best, just that it does meet the criteria in terms of flat file DB's lol
json is really no better than yaml as a databse. Think about the scale of your data though. Data that is required for each player? That screams use a databse to me. Maybe you're saving some basic world data that maybe go with NBT. Not a lot of data to store you doubt their will be more than 20-30 entries JSON, YAML is fine enough seeing as you can parse it and just keep it in memory.
you can easily store 1GB of data in yaml just fine
Ok thanks :D
but to do so you need to memory map it
however, if for some reason your data is getting this large and you insist on not using a normal DB
you could go with binary storage
that is mempory mapped
this is efficient enough if you do it right, that you can technically store 20million blocks of data and save it in 3 seconds and load it in 6
I usually just use NBT for stuff stored on the world 🤷♂️ however when it comes to player data there is definitely going to be a better way than giving each player their own YAML file. While you probably could do as you say with YAML and storey a lot of data with a memory map. Why though when you could just use a Database.
probably can do this faster since the numbers I have are about 6-7 years old from a test that was conducted
easier for the end user if they don't have to set anything up prior
something like SQLite is good for up to a few millions of entries no?
it can be, but it is no more efficient then what I described with binary storage
I need to store a block in a list, I tried storing both a Set<Location> and a Set<Vector> (using the block's int x y z) but it doesn't really seem to work, anyone got ideas?
what using it for?
turn it into a string
what
and save it as a string list instead
Checking for some blocks in an event
It's not persistent so idgaf if it gets removed lol
isn't that like inefficient
if it isn't persistent then why do you need to store it?
It needs to be stored for a lifetime, it's not persistent across restarts*
what's wrong with using a Location or int array
ok, but why does it need to be stored then? Couldn't you just like keep it in memory?
List<Block> doesn't work?
but list Location/Vector doesn't work fyi
why
no clue
oh yeah locations are weird
wonder if this would have worked List<Integer[][][]> 🤔
why would oyu need a 3d array just use a int[] and enforce a length of 3
because it terms of memory its more efficient
a 3d array allows each dimension to not have to be right next to each other in memory
How
where as a single dimension array it does
that's only in languages which don't optimize 2D arrays
langs like C# use a 1D array and do the math under the hood for [x][y]
Hello, how can i use my own plugins classes in another plugin, like an api?
ok, well 2d wasn't specified
well it's also for 3D arrays
ddfghfgh whats going on
2d array would be the same as 3d, just 2dimensions. Each dimension can be in separate areas in memory
Storing blocks in a map?
still doesn't work though
yeah
so in terms of memory efficiency, a multi-dimension array is better if its able to be used then a single dimension array
I need to do that temp
As a key?
since when is memory fragmentation a good thing
yeah
even mc uses multi-dimension arrays for location stuff
this isn't memory fragmentation
you are not allowing it to be a contiguous blob in memory, so, yes, it is memory fragmentation
no
okay
but I am not going to explain something you don't understand either
yep
You can't guarantee contiguous space for everything, if there is not enough contiguous space for an array Java throws OOM
multi dimension arrays, each dimension doesn't not need to be right next to each
because there is a pointer for the next dimension if the next one is needed
so each dimension can have its own contiguous space in different parts of the memory
not always
yes it does when it needs memory
anything touching native code can't be moved on the heap otherwise it gets a new pointer, hence why using JNI the GC will not touch that area of memory at all otherwise you get all kinds of errors on both sides because pointers changed
so no GC can't always move stuff
what does native code even have to do with anything
most times it can because not everything is touching native code
this is jvm heap we're talking about
and what i stated is true either
no its not
lmfao
i do understand how pointers work
Java doesn't magically bend the rules of native stuff it can only work around it
you clearly don't understandd how the jvm heap works
did you follow the steps at above link ^
I understand it more then you do and there is only like 2-3 other people in this discord who probably have the same level of understanding as me
aren't you a bit too full of yourself
i think i know what i'm talking about
i think everyone here would appreciate it if you stopped being an asshole
just saying
ladies I think we can settle this by just looking at JVM internals its time to get digging 
frostalf is right though
clearly he has the entirety of hotspot in his brain so no need for that
my guy I don't think you understand that if there isn't enough space for an array it will crash
I don't care what everyone thinks obviously
that's not the thing
Emily believes the GC can touch native stuff and just move it around willy nilly
well it can't
I know this
I mean it can edit the JVM's memory as it pleases
that is literally not what i said at all
stop putting words in my mouth lmao
I was left under the assumption that a process can change it's own memory as it pleases
idk how tf the JVM works but that is true, whether the JVM enforces some kind of standard is the real question
if it doesn't ofc arbitrary memory editing would be possible
but I would see that as potentially dangerous
it can to an extent, the issue is that when it comes to native stuff, pointers can't just change without stuff just dying. So anything in memory has a pointer, this includes any memory reserved for a process. You still need pointers to know where it is at in memory. If the GC starts moving around space that is for native stuff, the pointers will change and the native stuff won't know where it went because there is no way to tell it
the jvm has control over its own heap, if the heap itself has and needs X bytes available, but it is not available contiguously, it can and will move stuff around within the heap to make up that for that contiguous space
so, instead, anything native is cordoned off from the GC until its done
the GC works around it
ah yeah makes sense
ps: the jvm heap is contiguous, so if this can happen without reallocating the entire heap, it will
wouldn't an array just be stored in the JVM heap though not native
it would
it is only contiguous if Xmx and Xms are set to the same size, otherwise if its dynamic allocated this is not true
also, if objects are large enough, they will sit outside of the heap as well
which is far worse then fragmented in heap
there is even a jvm flag for this to increase space for such things so you don't end up with objects outside of the heap
Yes, but arrays are backed by an integer
however my point wasn't that an array couldn't be moved, just was correcting the belief that the GC has the ability to move anything in heap to anywhere it wants. Technically it does, but it doesn't do this for the reasons I stated
I mean yeah I was talking about what it could do, not what it should do
anything within the jvm heap, it can and it will
it probably won't
it depends on the circumstances
it doesn't do it arbitrarily every 3 seconds for no reason ofc
demonstrate to me that a native code will not cause some kind of error if you move its pointer
no
man you sure are annoying
this has nothing to do with native code, i am very much explicitly saying within the jvm heap
i don't have time for you
🧌
memory is memory
it doesn't change because of the process
would you demonstrate to me that the hardware of memory changed because Java reserved Addresses of the memory from one point to another? even though the address space between those points are reserved for java, java still has to specify where in between those points stuff is at
there is no way to tell some native code that a pointer changed
and therefore, Java and its GC will not move such things in its memory space if its for native use
Nice
have no idea
I don't use such things
if its for native use
except that it isn't
depends, there is some things in java that are tied to native
anything IO for example
that lives outside of the jvm heap
my point was clarifying that the GC does not move everything as you claimed and there is stuff it simply won't touch at all and for good reason
🤓 ok sir yes sir
Objects for IO don't live outside of the heap, although technically it could if maybe you had an insane amount of objects for a single stack
managed objects live inside the jvm heap, but the native buffers live off-heap
Objects can end up outside of the heap
no they cannot
there is even a JVM flag for this to help prevent that happening
prove it
Hello, how can I get a random location in a radius with the player for center?
alright, give me a moment to find the JVM flag
like this
black dot is player,
red circle is possible locations
Create vector with (n, 0, 0) and rotate it by a random number between [0, 2pi] around the y axis
the bukkit vector type has utilities for rotation around the y axis
okay thanks
can someone link me the mapping website again?
thanks
and how can you search for a specific packet/class in there?
what is your ide ?
select the version and use the search field ?
2pi is the radians translation of 360° btw.
and it'll show that class' changes throught all versions?
ye?
it shows you the names in the different mappings
if you mean "mappings" when you say versions 
I mean versions
there is a clock icon on every class page that you can click to have a cross-version overview of the class
how do you know that huh
😝
the old page was better
lynx, what is your favourite amount of degrees from 0-360?
degree users are cringe
radian enjoyer
for sure
then tell me in rads
epic
0pi obviously
Few days late on that reply :p
oh ok
no u
like this?java Vector initialVector = new Vector(5, 0, 0); double randomAngle = ThreadLocalRandom.current().nextDouble(new Random().nextDouble(), 2 * Math.PI + 1); Vector rotatedVector = initialVector.rotateAroundY(randomAngle);
well that's a length of 5
do you want ANY place in the circle or with the specified radius of 5?
specified radius of 5
ah ok
If I want any place of the circle I do another random between center and max
what is that random number selection code
yea
stackoverflow
pls no
With threadLocalRandom can't you just do nextDouble(0, 2 * pi)
Just ThreadLocalRandom.current().nextDouble(Math.PI * 2) is fine
ah true 0 is the default min
oh okay thanks
decompile minecraft no x)
I mean
is the only option
Buildtools already has that available for you
You want the source package?
In the work folder
How can I get the window ID to send a spoofed PacketPlayOutWindowItems?
I'm assuming window ID is container id
so ServerPlayer#containerId
version 1.20.2
uh

Mojang : obfuscating code
Also Mojang : creating a mapping for developers
use Mojang Mappings 🔫
I dunno how to answer that
before 1.14
nu
before 1.17
really?
yes
specifically before 1.17.1 is when spigot support for mappings first came out
oh okay
doesn't mean its not possible simply means spigot didn't have mappings yet
so you'd have to make your own plugin to remap afaik
its a field in ServerPlayer
called containerId look at the obfuscated equivalent from the mappings site
EntityPlayer, take it or leave it
Yeah it'll be EntityPlayer.some letter
can I just listen to some packets instead?
or can I retrieve it from the Inventory object?
1.14 plus
So it sounds like several
TLABSize
MinTLABSize
TLABAllocationWeight
TLABWasteTargetPercent
TLABRefillWasteFraction
TLABWasteIncrement
GCDrainStackTargetSize
CodeCacheMinimumFreeSpace
MaxDirectMemorySize
UseMallocOnly
ZapJNIHandleArea
all of these are for controlling stuff that are outside of heap space, took a bit of time to find these since the darn list of options is huge now -.-
bruuuhh
https://mappings.cephx.dev/1.14.4/net/minecraft/server/level/ServerPlayer.html do ctrl+f+"containerCounter"
version: 1.14.4, hash: d68245377d
final code:
if (players.size() <= 2) {
Player choosenPlayer = players.get(ThreadLocalRandom.current().nextInt(1));
Vector initialVector = new Vector(5, 0, 0);
double randomAngle = ThreadLocalRandom.current().nextDouble(Math.PI * 2);
Vector rotatedVector = initialVector.rotateAroundY(randomAngle);
return new Location(players.get(0).getWorld(),
choosenPlayer.getLocation().getX(),
choosenPlayer.getLocation().getY(),
choosenPlayer.getLocation().getZ()).add(rotatedVector);
}```
so after going through the JVM options lists, I came across that I forget there is a JVM option for self destructing after a pre-defined time
Why are you remaking choosenPlayer.getLocation()
lol so random
I'll use Location instead of Player for the variable
also you might like this one
but is the code correct?
ZapUnusedHeapArea - Zap unused heap space with 0xBAADBABE
Looks like it'll work
lol
Correct may be another thing :p
okay thanks
oh also there is a jvm option to swap out the system time methods with fake timers
not that any of this info is probably useful to you
just a bit of curiousity
wonder who this is useful to
JVM developers I assume
I modified .add(initialVector) by .add(rotatedVector)
I'm silly
?
If you add or rotate or multiply them
It'll modifiy the initial object rather than creating a new one
hey can i spawn a zombie in the server, but make the client think it is a player
how would i do it?
What version
Yes
and just change the entityType to player
In 1.20.2 players use the same spawn packet as other entities
So changing the type should be fine
how would i catch the packet?
yea
when was this changed?
UseMallocOnly this jvm option which I listed above, removes heap space and uses only native space
maybe I should give this a try at some point as I haven't really tested what happens if you force MC to use native space only
these are all some really weird falgs lol
that option no longer exist and neither does the zap jni handle area
but it doesn't have to inject into the player right?
i just have to catch it from the server
right?
I mean I think either way you inject into their connection
but you inject to detect serverboundpackets right
not clientbound?
hmm ye, but do i "need" the connection
or is there a other / easier way
to catch packets yes, you need a connection otherwise where are you going to be catching packets?
clientbound packets are packets that are heading out to the client, and server bound is from client to server, you can listen for either and catch either and do stuff with them before its sent or fully received(processed in this case)
or you can just swat them if you just don't want those packets leaving at all or being processed by the server XD
up to you in whatever is you are doing
does anyone know what the last ItemStack is for?
it's the item on the player's cursor
so like
when I'm spoofing the items
do I just input the constant
that's with the null material?
uh sure? if you want the cursor to be empty then passing the air item might do it, never messed with that
how do highest priority in eventHandler
can you elaborate on what the cursor is?
It's the cursor
@EventHandler(priority = EventPriority.MONITOR)
Yknow, the thing you move with your mouse
i mean @EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
not work
when you click on an item, you hold it on your cursor
until you place it down or drop it etc
yeah prolly
i don't think it'll like it being null lmao
Ah yeah it does do operations on it
not null
the material will be null
this one
that's the one yeah
this not worked((
wdym?
?notworking
"Does not working" is a useless statement. Please describe what exactly is not working, what you expect it to do, and what actually happens. If you get any console errors, also ?paste the entire stacktrace.
I'm trying to block another same event in another plugin
what
i try cancel BlockBreakEvent but this not cancl cuse another plugin use it
Incredibly random question, but is CMPXCHG16B for 64 bit values or does it also support 128+ bit stuff?
what
like
what?
does somebody really use event.setCancelled(false)?
like the plugin uncancels the event?
iirc 64 yeah?
And sometimes 128
Then why is it suffixed with 16B - wouldn't that entail 128 bits at 8 bits a byte?
whats the right bungeecord event for getting the player on intial server connect
Yeah, but that suggests it's either or
lol
Now I only need to randomly stumble uppon the ARM equivalent and I'm set for really stupid stuff.
Or well, I could use GCC and hope it uses the right equivalent but what is the fun in that?
Hello, when NamespacedKey was introduced?
Uh, long enough for it to be not of an issue?
if think 1.14
I wish there was some javadoc site for ancient bukkit versions that was compiled with modern Java
DWCAS on ARM is done with double-width LL/SC instructions
how intense are raytraces to servers, like if i do a relatively short trace of a couple blocks every tick for maybe a couple players is that a big deal or nah
Anybody can help me here?
My Plugin always says Vault not found even its installed.
Nope, it's been there since 1.12 according to https://helpch.at/docs/1.12/ versus https://helpch.at/docs/1.11.2/
is it your plugin or is it just chunky
if its your plugin show the code for vault detection
otherwise we cant help you
is there a way to set an ItemMeta's display name to an empty string?
Chunky is my Plugin and it says it cant find Vault
ok then show your code
and if you plan to publish it consider picking a different name because chunky is already a widely used plugin
I can't
since I want it to be the heritage for an anvil input
and I want the input to be empty
then 0-width space?
Thanks but will only be used privatly
?
a space with 0 width
like
select whats in that box and you got a 0 width space
U+200B
might wanna double check if that displays properly in minecraft tho
nope because its a character
it just has 0 width
because its 16 bytes, there is 4 bits per byte, thus giving you 64bits, the instruction here is for double width so 128 bits because 16bytes:16bytes. The other instruction 8b is 8 bytes, double width gives 64bits. 8b is primarily for if you are dealing with 32bit registers, like integers for example and it works from 64bit cpus, but is also handy when on a 32bit cpu as well. and 16b is only available on 64bit cpu's but handy if you need double the width or dealing with only 64bit registers
to give you further clarification
fuck
it does not
display as widthless
sad
it's some weird symbol instead
hm, 4 bits per byte is something I haven't seen yet.
I mean
I'm opening an anvil gui
and the input is the renaming
and the primoridal input is inherited from the item's display name
so it will probably turn into
I am tired lmao
16bytes = 128 bits
\u00A7
the equivalent of a paragraph
if you're using the anvil just for text input stuff you might wanna consider using chat instead
8bytes = 64bits they are double width
the point is that I'm adding functionality
so tis a custom feature
Ah I thought I have just seen some low-level specifics that I have never been taught.
But yeah, so it is what I assumed. I just each time confused the 64 bit and the 128bit variant as they are usually listed besides each other
8b is used when dealing with 32bit registers or 32bit cpu. and 16b when dealing with 64bit registers which means 64bit cpu but that is a given 😛
and DWCAS has always been available in ARM as well, and its the instructions I gave above but in double width, so it shouldn't be hard to convert over for whatever you are trying XD
Yeah most AMD and Intel CPUs should support both instructions so I am not worried on that front
And those that do not support these instructions cannot support modern OSes anyways as it appears so
ldrex/strex (ARMv6 and v7), and ldxr/stxr (ARM version 8)
I mean I don't need those instructions just yet - it was more of a nice to know question
okay thanks
Honestly I thought it was there for longer, but 1.12 was the time I started with bukkit so makes sense
NamespacedKey -> 1.12
PDC -> 1.14
it's old
(not you)
RayTraceResult result = p.getWorld().rayTrace(p.getEyeLocation(), p.getEyeLocation().getDirection(), 5, FluidCollisionMode.NEVER,
true, 0, null);
how come this isnt hitting a block when im looking right at it? definitely under the 5 block radius
result.getHitBlock() returns null
yo what the f-
listConstructor = listClazz.getConstructors()[0];
this threw an OutOfBounds error
then it empty
but it's a
constructor
array
so what the fuck
it must have some sort of constructor
anyone?
does listClazz represent an interface?
what is it exactly?
what about getDeclaredConstructors
maybe because it's protected
oooh
yeah I'm sorry for swearing
okay now I'm mad confused
but
did not throw an error
but this did
what does the getMethod call do?
this is the original
gets the method
it didn't throw an error
only the call to it did
well what I wanted to know is what's in the getMethod method lol
you need to pass an instance to invoke the method on
just pass null if it's static
so invoke(null, item)
oh yeah
hello, how can I clone an entity at another location?
not really possible with the api yet
okay thanks
What’s the nms create list thing
this basically
creates this
What arguments does reflection say clazzConstructor takes?
I'll debug em one sec
???
you need
do someone have an explanation?
that's what I do?```java
public abstract class CustomMob<T> {
public T entity;
public HMobsType type;
public CustomMob(Class<T> entity) {
this(entity, false);
}
public CustomMob(Class<T> entity, boolean silentSpawn) {
this(entity, HMobsType.GENERIC, silentSpawn);
}
public CustomMob(Class<T> entity, HMobsType type, boolean silentSpawn){
if(!entity.isInstance(Entity.class)) throw new IllegalStateException("T entity must be an Entity!");
T spawned = SpawnMob.getRandomLocationWithinPlayers(new ArrayList<>(Bukkit.getOnlinePlayers()))
.getWorld()
.spawn(SpawnMob.getRandomLocationWithinPlayers(new ArrayList<>(Bukkit.getOnlinePlayers())),
entity, (pig) -> {
pig.setCustomName("oliver193");
pig.setCustomNameVisible(true);
});
...```
Both generic types are from different places
hum
First of all: Make your fields private pls
why not just use Entity instead of T
why?
I'm modifying my code, I'll change that
public net.minecraft.network.protocol.game.PacketPlayOutWindowItems(int,int,net.minecraft.core.NonNullList,net.minecraft.world.item.ItemStack) so as expected
idk the difference between accessing variable and accessing function accessing variable
Because you never want other classes to have access to your fields.
Strong encapsulation is one of the most important principles to write robust code.
oh okay
or atleast make them like final
wait...
it's probably this mfo
Lets see what the problem with your generics could be
Try to specifically define a call type for your method like this:
T spawned = SpawnMob.getRandomLocationWithinPlayers(new ArrayList<>(Bukkit.getOnlinePlayers()))
.getWorld()
.<T>spawn(SpawnMob.getRandomLocationWithinPlayers(new ArrayList<>(Bukkit.getOnlinePlayers())),
entity, (pig) -> {
pig.setCustomName("oliver193");
pig.setCustomNameVisible(true);
});
just add extends Entity>
okay thanks all!
You are going to have huge problems btw because you are getting the world from one player and then spawning the entity on another players location.
If those two are not in the same world, then an exception will be thrown.
why is bro spawning a pig with oliver's name
When you want to spawn a custom entity, e.g. with a custom name or certain items equipped, you must use the method World#spawn(Location, Class, Consumer) unless you give a shit about compatibility with other plugins. I’ll explain why. The shitty way Usually, you can easily spawn entities like this: That is fine, as...
code isn't finished
I made a variable containing the Location
also, I do that:```java
public static Location getRandomLocationWithinPlayers(List<Player> players) {
List<Player> filteredPlayers = majoritary(players, Player::getWorld);
World world = filteredPlayers.get(0).getWorld();
...
}
....
public static <T, E> List<E> majoritary(List<E> elements, java.util.function.Function<E, T> classifier) {
Map<T, List<E>> grouped = elements.stream()
.collect(Collectors.groupingBy(classifier));
return grouped.values().stream()
.filter(list -> list.size() == grouped.values().stream()
.mapToInt(List::size)
.max()
.orElse(0))
.flatMap(Collection::stream)
.collect(Collectors.toList());
}```
dude that looks hacky asf lmao
perfectly working 👍
great
my code is working thanks
doesnt mean I understand whats going on though
wiat where
oh
@jagged quail
who you calling a pig

it's not even oliver it's literally oliver193
paul has beef pork 🐷
how do u cross a word 😭
This code makes very little sense. Why are you only selecting locations from a world with the most players?
h
This can also be shortened by quite a bit
~~word~~
This saves you the nested stream:
public static <T, E> List<E> majoritary(List<E> elements, Function<E, T> classifier) {
return elements.stream()
.collect(Collectors.groupingBy(classifier))
.values().stream()
.max(Comparator.comparingInt(List::size))
.orElse(null);
}
I have an entity item_display which I want a player to perceive to be at their Y level continously. Is this possible, without being too resource heavy?
With 1-20 players, the split and join would most certainly produce more overhead than just streaming this consecutively
Ive written a fork with some guys that had ~150 people on one instance with still 20 TPS
*Was 1.8 back then
just run minestom 🗿
What on earth is this code
Myeah. Really depends on what you are doing.
If its not survival then you can get 200 people on one 1.20 server without much optimizations.
In the end its just 200 entities with maybe 3x load resulting in effectively 600 entities. (Which you can handle with good hardware)
throwback to when I had 18k citizens npcs all wandering on a shared host
No thats not what paper is for
Their max load is pretty similar to spigots in that regard
But it's more optimized yeah?
It handles a select amount of systems in a different manner.
Some might be more optimized, but in most cases this only matters for survival servers.
Do you know how to utilize the changes of this fork?
Nope I don't use paper
I might start to use it though it would be nice to know
It would just take entity tick multithreading
Understanding the platform and optimizing your project for its purpose is much more important than choosing which fork you are using.
If you dont need entities, then dont spawn entities. If you dont need chunks from -64 to 256, then dont generate huge chunks. And so on.
We could easily make it happen at the cost of every second plugin breaking and it being harder to make plugins
Minestom already has multithreading capabilities and can def handle 250 players if not much is going on
The problem is that you need to reinvent the wheel, if you want to use it.
Yeah but that's running on C++
I guess aikar flags count too, a few changes to spigot and bukkit files


