#help-development
1 messages · Page 935 of 1
How can I start Discord bots with a Minecraft Plugin?
JDA
heres the link https://github.com/discord-jda/JDA
yeah thanks
what the difference between the 2
ok
But that will not works
why not
Wait I will see you the err
it wont work if you dont set it up correctly
you arent shading it
https://blog.jeff-media.com/common-maven-questions/ read the 1st one
People just getting started with maven always ask me the same 3 questions, so here’s a a short FAQ! How to change the output directory? Read this. How to shade dependencies and what it means Sometimes you are using certain libraries (for example, my CustomBlockData class, or similar stuff) that is not already present at...
did you follow the instructions of adding it to maven correctly
I have grandle
That has destroy my Plugin
?paste your build.gradle
you didnt read it at all you just blindly copied
also why do you have 4 different spigot api versions
Bro be doing something differently
what if he is gonna use abstraction to support multiple versions of NMS
then make modules
oops
https://paste.md-5.net/fohavogune.cs
https://github.com/crackma/PVPCore/tree/master/src/main/java/me/crackma/pvpcore/gui
no idea what this error means
Looks like an off-by-one error maybe
Like you can't access array[27] if the array is of length 27 because arrays are 0 indexed
Analogous with lists etc
Or you're iterating with a broken condition
Didn't read the code so idk
Hello, how can I check if a player can see an entity? (based on FOV)
I'll use the max one
hummm
but I only know the distance between the entity and the player 🤔
isn't the area you ca see also affected by the size of the players monitor?
humm, I think no
I check, and yeah it's a little affect
but who in the world play like that?
freddy fazbear
You can just limit it to quake pro
oh perfect thanks
...and check if it's higher than 55 deg
okay thanks
okay thanks
I learned sinus, cosinus and tangent this year so scalar products...
what?
what
Yea I mean scalar product itself isn’t that hard
But obv it can be used in more complex stuff and some theorems make complicated usages of it
Yea usually theta is used to denote an angle
okay thanks
how can I do a scalar product in programmation? I don't even know how to do it on a paper...
is there an equivalent or something like that? x)
x)
so Vector(x).multiply(y)?
you take each component
And multiple it with each other
usually we name it the dot product or sth like that
for instance x_1 * x_2 + y_1 * y_2 + z_1 * z_2
if A = (x_1, y_1, z_1) and B = (x_2, y_2, z_2)
I think bukkit vectors support dot product
(I named one entity.getLocation().toVector().subtract(player.getEyeLocation().toVector()).normalize(); and playerDir player.getEyeLocation().getDirection();)
hmm
a.dot(b)
dot product is goated
...when you know how to use
Ah yea, well ofc then yea
If I setY of both vector to the same value, I get the 2D angle, right?
...
+0?
but I'll be good?
Vector one = entity.getLocation().toVector().subtract(player.getEyeLocation().toVector()).normalize();
one.setY(0);
Vector playerDir = player.getEyeLocation().getDirection();
playerDir.setY(0);
double result = one.dot(playerDir);```
hey
or I can just pickup the function system
well you’re taking the dot product, u just wna ignore the z components
im accessing like 0-10
So a.dot(b) might not be as useful
everything works but every time someone clicks its just an error
when you do /plugins in the console or anywhere, why does it show "Bukkit Plugins:"? Could you have any other plugins? Not Bukkit?
Are you running paper
I am paper
okay thanks
for it to be a paper plugin it needs a paper-plugin.yml
Ohh I see alright
paper is not supported 🤓☝️ (That's what I would have said if I were a bad guy)
I should compare with 110/2?
the product of the modulo of each vector using what?
I have a problem: X and Y of what, where? 🥺
I was wrong, module for each vector but how?
scalar / (v1.x % v2.x) + (v1.z % v2.z) ?
here
I haven't learned using vector, how should I know that??
"the length of the vector" hmm
Vector.length okay
oh okay
yeah he's using the wrong words
hmm
what is the difference?
oh yes sorry
well
there's no reason you can't apply bitwise on fp but there's no reason to and you shouldn't
yeah
scalar / (Math.sqrt(Math.pow(one.getX(), 2) + Math.pow(one.getY(), 2)) + Math.sqrt(Math.pow(playerDir.getX(), 2) + Math.pow(playerDir.getY(), 2)));
yeah, really
Math.sqrt(Math.pow(playerDir.getX(), 2)
Hmm?
Ah wait didnt see the other brackets
Is this just the lenght of a vector? Why dont you use joml for this?
It returns true even if I'm not seeing the entity...```java
public static boolean canPlayersSee(Collection<? extends Player> players, Entity entity){
for(Player player : players){
Vector one = entity.getLocation().toVector().subtract(player.getEyeLocation().toVector()).normalize();
Vector playerDir = player.getEyeLocation().getDirection();
double scalar = (one.getX() * playerDir.getX()) + (one.getZ() * playerDir.getZ());
double ee = scalar / (Math.sqrt(Math.pow(one.getX(), 2) + Math.pow(one.getY(), 2)) + Math.sqrt(Math.pow(playerDir.getX(), 2) + Math.pow(playerDir.getY(), 2)));
if(ee < 55){
return true;
}
}
return false;
}```
it's for the x and z
"the magnitude in a 2D plan"
joml has 2D vectors iirc
But why 2D? If the player looks up or down he will also not be able to see it
it's true
but let's see that a bit later
I don't know what is radians, but I'll check for that
Just check if the angle between the players facing and spaning is > pi
what is "is"? what is "pi"
brb ill restart and show an example
Marco why cant u write the full sentence first time -_-
bro I said I learned sinus, cosinus and tangeant this year
I never used radians in my life
or is this an english-specific thing?
I don't think so
I never used sin in java
Is that a sin? (yeah, it's a joke, you're not obliged to laugh)
declaration: module: java.base, package: java.lang, class: Math
Here are the docs
?
I thought you don't sin
hum okay I think I can do that
I'm not giving them java 8
AHAH I haven't even saw for that
(sorry :3)
what the hell
(It was not intented, I promise)
what... 💀
public boolean anyOneLookingAt(Collection<Player> players, Entity entity) {
return players.stream().anyMatch(player -> isLookingInDirection(player, entity));
}
public boolean allLookingAt(Collection<Player> players, Entity entity) {
return players.stream().allMatch(player -> isLookingInDirection(player, entity));
}
public boolean isLookingInDirection(Player player, Entity entity) {
Location playerEyes = player.getEyeLocation();
Location entityLocation = entity.getLocation();
Vector toEntity = entityLocation.toVector().subtract(playerEyes.toVector());
Vector playerDirection = playerEyes.getDirection();
double angle = playerDirection.angle(toEntity);
return angle < Math.PI / 2; // 90 degrees because 2 * PI == 360 degrees
}
Why does that look like somebody cut sins balls
sin^2(x) + cos^2(x) = 1
you're definitely a magician so yeah thanks
now I understand the code x)
dot product
Doesn't angle just multiply the dot product by something?
oh I haven't thought of anyMatch that's a good idea
but his code works?
does this work if the player is really close?
It doesnt account for projection. This is just the general idea of what paul had in mind.
If the entity gets closer, then there is a decent chance that it is still visible on the side.
i see
But with 100° or 110° you might be pretty safe unless you are standing right next to it and bouncing it with your side
hmm okay thanks it's perfect
I'll be able to impress my math teacher tomorrow x)
IT'S PERFECTLY WORKING THANKS
you're now...
has anybody ever faced this error in intellij idea when trying to remove a jar dependency
remove it in maven
so now I have "culling" for my leaves
this is all i got in maven deps for this project if this is what you meant
its in pom.xml
not here
Doesnt citizens have a maven resource??
im trying to remove a jar of an api of mine
not citizens
getting rid of it works though
You simply shouldnt use jar dependencies with maven, ever
noted
permissionattachmentinfo holds a single permission, value and a permissionattachment and permissionattachment holds a map of permissions and booleans
someone explain
no :^)
protocollib
is there a way to do it wihtout relying on another plugins or shading protocollib cuz that causes issues
If you want to shade use PacketEvents
packet events
or TinyProtocol?
ok
Although technically packet events recommends you don't shade :p
ive found packetevents to be awesome and you can actually shade it
what is PacketEvents
is stuff the player types into the chat box sent to the server?
I remember some plugins have typing sound effects when a player was typing
so I assumed it did
packet wrapper & packet listening lib
Yes
then whats the point of it
theres none
It’s implicitly added if the class doesn’t extend anything else
why would you do that
retrooper packetevents?
Javadocs always show it
exactly
ooh thanks :>
some one help mee
?paste
is this okay ??
😒
broooooo .... i just need to know is there any other shorter version of this code to prevent player's coliding each other ????
Get hitbox of player A and check if it overlaps hitbox of player B
looping through every online player everytime any player moves might be performance consuming
Or just add them to a scoreboard team and disable collision
that sounds good .. lemme tryy
theen what should i do ???
dk
private void automatedBackupConfig() {
Bukkit.getScheduler().runTaskAsynchronously(this.plugin, () -> {
LocalDateTime now = LocalDateTime.now();
String backupFileName = "backup_" + DateTimeFormatter.ofPattern("yyyyMMdd_HHmmss").format(now) + ".yml";
File backupFile = new File(plugin.getDataFolder(), backupFileName);
try {
Files.copy(new File(plugin.getDataFolder(), "config.yml").toPath(), backupFile.toPath());
plugin.getLogger().log(Level.INFO, "Automated backup created: " + backupFileName);
} catch (IOException error) {
plugin.getLogger().log(Level.SEVERE, "Failed to create automated backup: " + error.getMessage());
}
});
}```
So uh is this a valid way of going about automated backups from plugin startup? I was thinking I'll probably run it every 5 mins or so also it might be wise to overwrite previous backup perhaps? Thoughts + notes please... it's commented out rn so don't judge the current implementation ❤️
You should absolutely limit the number of backups kept at once
For sure
Is 5 minutes really a backup
No one wants 288 files after 24 hours :=
Yeah
By the time you need it that was probably 1000 "backups" ago
So then I guess I could keep it and run it every day or perhaps just keep my other method (not automated), I was just trying to decide if it'd be better to have it automated or not
private void backupConfig(JavaPlugin plugin) {
File configFile = new File(plugin.getDataFolder(), "config.yml");
File backupFile = new File(plugin.getDataFolder(), "backup-config.yml");
try {
Files.copy(configFile.toPath(), backupFile.toPath(), StandardCopyOption.REPLACE_EXISTING);
plugin.getLogger().log(Level.INFO, "Configuration backup created successfully.");
} catch (IOException e) {
plugin.getLogger().log(Level.SEVERE, "Failed to create configuration backup: " + e.getMessage());
}
}```
I think I am going to just keep this, and run it every time the plugin disables? Sounds solid to me but if anyone has other thoughts, by all means please let me know.
You just have to decide how much of a rollback would make you quit a server
Considering it's a dynamic kits system the automated backup was kinda dumb tbf
Is there a resource that shows how to notify users when a new version of the plugins has been posted? I don't find it 😦
The only reason I'd need it is to handle my cooldowns in emergency cases I'm pretty sure
thanks!
?paste
https://paste.md-5.net/yisonitalu.js
Ehhhh am I doing this right? The kit structure that outputs to the config.yml looks correct as far as I can tell, however I haven't yet implemented kit configuration capabilities yet so it just looks like:
kits:
TestKit:
effects: []
cost: 0
contents: []
name: TestKit
cooldown: 0
permission: null
Disregard the effects, I removed all that logic
yeah that'd probably be better
I'm not sure how to handle the cooldowns... I should probably handle them internally correct? Or is there perhaps an easier way
Cooldowns should always be done with timestamps
Does a flat file + modifications based on kit interactions work for that matter?
Idk what "modifications based on kit interactions" means in this context
As in when a player claims a kit
Player claims a kit, record the timestamp, when they try to use the kit again check against the timestamp to see if the cooldown is expired?
But then the kit doesnt only have one cooldown. It has one cooldown per player.
Hmm
Well the cooldown in terms of the kit should be the global cooldown for all players allowed to use it
So if one player claims a kit, then nobody else can claim it for a while?
Now i am completely confused what that is supposed to mean. A kit claims a player?
Whats the difference between Material.getHardness() and Material.getBlastResistance()
Hardness is about how long it takes to break
So handle cooldowns per player, based on the configured cooldown of the kit... meaning: TestKit has a cooldown of 10 mins, when a player has claimed that kit, they cant use it for 10 minutes. Sorry I am quite cooked haha
Ah that makes more sense. In that case what you are doing is fine.
Ok cool then that's next on the list
will addEnchantment on an item that already has the same enchantment override the old one?
Wanna have a look at the whole thing? I feel like its pretty sloppy... I wrote it all in a 7 hour binge yesterday
Not in the mood to look at a kit plugin rn tbh 
Haha no worries, this is the current structure... so i don't blame you
Hello, I've got a big problem with my code, the more leaves there is, the more the server main thread stop working when doing iteration, is there a way to avoid that?
https://paste.md-5.net/ujisodoled.java
For the first task, I want to get some leaves in a radius of 10*8*10 and have 1/4 chance to create a leaf below the leaves block.
For the second one, I check if I need to remove the leaf from the list and delete it, if not then I teleport it to the next location
That's why I posted my source code in #1100941063058894868
Do you have some ideas to optimize my code?
Yes, tons. But first i need to understand your goal.
Why do you use blocks for this and not a FallingBlock entity?
because I need a certain gravity and something like wind
What if you pre-compiled the entire path for each leaf
and I want to make it looks like a leaf
(idk if it's possible with FallingBlock without resource pack)
And then before teleporting just make it check
humm
It could change
if someone break a block
How come
and I never made something like that 🤔
I have an idea in my head but well, it'll use a for loop
is there a way to avoid for loop?
I still dont understand what you are trying to achieve...
Just want to simulate falling leafs in the wind?
exactly
They are using text displays with a Unicode leaf character
yep
But setting blocks will prevent players from moving, stop projectiles and be a hinderance all the time.
It’s a text display
Ah
They work pretty well for custom particles
but so, first, is there a way to make a FallingBlock have the same look as the actual TextDisplay?
No
Nope, nevermind then. TextDisplay is the way to go.
following this?
Step one for me would be to create a FallingLeaf class which can be ticked.
public class FallingLeaf {
private final TextDisplay textDisplay;
public FallingLeaf(TextDisplay textDisplay) {
this.textDisplay = textDisplay;
}
public void tick() {
}
public boolean isDone() {
}
public void remove() {
this.textDisplay.remove();
}
}
And then you can simply scrap all your PDC nonsense because that its way slower than just having a LinkedList<FallingLeaf> where you call
leafList.removeIf(leaf -> {
leaf.tick();
if(leaf.isDone()) {
leaf.remove();
return true;
} else {
return false;
}
});
Then 100% dont use a SaveRandom. You dont need safe randomness.
if(ThreadLocalRandom.current().nextDouble() < 0.25) {
// Do something with a 25% chance
}
This should be your go-to for chances
u gonna need to keep leaf order?
no, it's not important
oh the idea sounds cool
they gonna be all ticked
I port mods in plugins
https://modrinth.com/mod/fallingleaves
wouldnt arraylist be better than linked
but with spigot limitations, and my own limitations x)
I already ported Better Than Mending, soon on Modrinth
Nope
teach me
most often arraylist is better but trying to understand the reasoning here, ur probably right just interested
LinkedList has the lowest CPU and memory footprint for removal while iterating.
LinkedList is an actual rubbish collection, but it outperforms anything else for removal during an iteration. (So basically removeIf())
Takes notes
oh okay good to know that:) another rare use case to remember from linkedlist:;D
can someone explain displays "void setInterpolationDelay(int ticks)"
"Sets the amount of ticks before client-side interpolation will commence." English isnt my main language and translation doesnt make sense
Hm, honestly the biggest performance improvement probably comes from choosing the right blocks as leaf emitters.
You dont want leafs in the middle of a tree crown to spawn leafs. Only the bottom layer really.
yeah
After that many ticks the client will begin interpolating changes to the displays transformation
public class CommandManager implements CommandExecutor, TabCompleter {
private final Map<String, CommandInterface> commands = new HashMap<>();
private final JavaPlugin plugin;
public CommandManager(JavaPlugin plugin) {
this.plugin = plugin;
commands.put("kit", new PlayerKitCommand(plugin));
commands.put("akit", new AdminKitCommand());
commands.put("reloadkits", new ReloadKitsCommand(plugin));
}
@Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
CommandInterface executor = commands.get(label.toLowerCase());
if (executor != null) {
return executor.execute(sender, label, args);
}
return false;
}
@Override
public List<String> onTabComplete(CommandSender sender, Command command, String alias, String[] args) {
if ("akit".equalsIgnoreCase(command.getName()) && args.length == 1) {
return new ArrayList<>(commands.keySet());
} else if ("kit".equalsIgnoreCase(command.getName()) && args.length == 1) {
return new ArrayList<>(KitManager.getInstance(plugin).getAllKits().keySet());
}
return Collections.emptyList();
}
public void registerCommands(JavaPlugin plugin) {
Objects.requireNonNull(plugin.getCommand("kit")).setExecutor(this);
Objects.requireNonNull(plugin.getCommand("akit")).setExecutor(this);
Objects.requireNonNull(plugin.getCommand("reloadkits")).setExecutor(this);
Objects.requireNonNull(plugin.getCommand("kit")).setTabCompleter(this);
Objects.requireNonNull(plugin.getCommand("akit")).setTabCompleter(this);
Objects.requireNonNull(plugin.getCommand("reloadkits")).setTabCompleter(this);
}
}```
So I'm wondering if this is good implementation or not lol... Just experimenting with an expandable command system...
Do you have an algorithm for that?
Should I do a paste for that?
Yes
choosing the leaf or moving the spawn to the block under?
?paste
Choosing the leaf
yeah, a really tps-suspicious method...```java
public static @Nullable List<Block> getSomeLeaves(Location location, Vector radius) {
if(location.getWorld() == null) return null;
List<Block> blocks = new ArrayList<>();
int radiusx = (int) radius.getX();
int radiusy = (int) radius.getY();
int radiusz = (int) radius.getZ();
for(int x = location.getBlockX() - radiusx; x <= location.getBlockX() + radiusx; x++) {
for(int y = location.getBlockY() - radiusy; y <= location.getBlockY() + radiusy; y++) {
for(int z = location.getBlockZ() - radiusz; z <= location.getBlockZ() + radiusz; z++) {
if(SafeRandom.randBtw(1, 8) != 1) continue;
Block block = location.getWorld().getBlockAt(x, y, z);
if(!FallingLeaves.leavesMaterials.contains(block.getType())) continue;
if(!block.getRelative(BlockFace.DOWN).getType().isAir()) continue;
blocks.add(block);
}
}
}
return blocks;
}```
Is there a free plugin similar to the MySQL Player Data Bridge plugin I live in turkey and paypal is closed in turkey I can not get the plugin can you help me
Getting leafs around a player, but skipping undesired leaf blocks
objects.requireNotNull is just there to quit the yellow highlighter from bugging me lol
Yeah that wont do
sql nerds, is there any better way i could desgin my db that this, do note data would not be a string on both and would vary per other table
lookup_name would be the table name that the id is from
What should I do instead?
?paste
https://paste.md-5.net/ifenativeb.cs
This should fetch only viable leaf blocks
1 idea could be easy for basic trees, you could scan for tree trunk block and when u find it scan upwards till u hit the leaf level and then scan to sides.
okay thanks
Give them an ItemStack with 30 as an amount
but for savanna trees?
ye thats why i said basic trees 😂
but anyways probably not anymore efficient
with this method ? product.getItem() returns and ItemStack
since u gotta find the trunk anywaysXD
but i dont know where to specify the amount of that itemstack
yeah
The ItemStack itself has a stack size. Set the amount of the ItemStack.
oh Tag, really good idea, I never thought of using them (and I didn't know it was possible in Bukkit, good to know)
for sure could take advantage of the world seed but that gonna be complicated, save/cache tons of data
Would swapping the random check and valid check be any faster
Hm good point.
ye true
it's done
thanks !
I might also change
for (int y = -dy; y <= dz; y++) {
to
for (int y = 0; y <= dy; y++) {
because the player wont be able to see leaves falling below him generally.
yeah
I would personally just pick N random locations near the player and check if they are valid
More random but also a lot faster
humm
It def, is. Let me cook something
I should cache already checked locations?
okay
also, I don't want leafs to spawn at the feet of the player, so I can add 1 to y?
public List<Block> fetchViableLeafBlocks(Player player, double chance, int dx, int dy, int dz) {
List<Block> leafBlocks = new ArrayList<>();
Block baseBlock = player.getLocation().getBlock();
int totalBlocks = (2 * dx + 1) * dy * (2 * dz + 1);
int probeBlockCount = (int) (totalBlocks * chance);
ThreadLocalRandom random = ThreadLocalRandom.current();
for (int i = 0; i < probeBlockCount; i++) {
int rx = random.nextInt(-dx, dx + 1);
int ry = random.nextInt(0, dy + 1);
int rz = random.nextInt(-dz, dz + 1);
Block probedBlock = baseBlock.getRelative(rx, ry, rz);
if (isViableLeafBlock(probedBlock)) {
leafBlocks.add(probedBlock);
}
}
return leafBlocks;
}
private boolean isViableLeafBlock(Block block) {
if (!Tag.LEAVES.isTagged(block.getType())) {
return false;
}
Block below = block.getRelative(BlockFace.DOWN);
return below.getType().isAir();
}
is there a way to convert a HTML color code to a ChatColor that works for minecraft?
ItemMeta meta = stack.getItemMeta();
if (meta.hasDisplayName()) {
return meta.getDisplayName();
} else {
String color = stack.getRarity().getColor().asHexString();
return ??? + stack.getI18NDisplayName();
}
}```
ChatColor.of(r,g,b)
ChatColor.of(color)
also works when hexadecimal color in string
there is no .of method for org.bukkit.ChatColor, there is valueOf but that doesn't work
java.lang.IllegalArgumentException: No enum constant org.bukkit.ChatColor.#55ffff
what's your version?
what version?
1.20.4
Gotta use bungee ChatColor
(and are you using net.md5's ChatColor?)
oh, it's bungee one?
Yes
nah, md5 one
oh my bad, sorry
import net.md_5.bungee.api.ChatColor;
It does say bungee :p
I got these but I always use org.bukkit
I don't know how to read :3
Especially docs
ew paper
ye thats paper:D
The bungee one is basically identical
I pretty much never use org.Bukkit.ChatColor anymore
Alright thanks
I still dont get it why people hate legacy colors so much, componentbuilders are just so horrible to eyes, i mean they have the good sides as well but for simple stuff colorcodes are fine
true
I tried paper one time, never returned since
😂
I think the main thing is the legacy converter is just a little cursed
oh man the converters what a pain
i wonder if there is anyone who hasnt done their own methods to use their converters:D
to me Paper API only has 2 useful features PlayerJumpEvent and teleportAsync, ofc i only noticed these from my small uses but it could have more useful stuff
oh they have playerjumpevent? i actually was making my own year ago trying to make it super specific, its so hard to make accurate jumpevent, 99.9% of the ones people have made count even leaf climb to jump and walking on top of a boat ect
hum, huston
You should add a random offset 0 - 1 for x and z when spawning
Yeah they have PlayerJumpEvent, but iirc it also counts leaf climb not sure about that, you can try it yourself
PlayerMoveEvent and PaperLib
oh okay
It would be a bit repetitive without x)
checking the code atm
If they dont move then you didnt tick them
Also, does anyone know how to get the name of a Smithing Template from the ItemStack, Material or ItemMeta? Cause the name is Smithing Template but I want to get a string of the "Tide Armor Trim"
yep its pretty basic jumpcheck, will falseflag a lot
did you try it
so this might be a weird question (especially how early i am in plugin development lol ), but, can I have a plugin that is dependent on another plugin.
like how some mods have libraries they are dependent on ?
looking at the code
Pretty sure you can use it to make your life easier in making your own accurate one and calling your own event
based.
The way the player movement is coded it's hard to detect jumps properly
hum, my tick method..
much better
How does your isDone() method look like?
1 day ill finish my event:D just so much stuff to check to make it actually accurate, i wish client just had jump detection or smthingD
Even papers jump event is just some filtering over how you would normally detect it with spigot
and for calling (london calling)
yep, good luck 🙂
also walking over slabs counts as jump
Thanks I was looking at ArmorTrim, TrimMaterial and TrimPattern
Having random next x and z like that will lead to a messy jitter
yeah
I add something to store it in the instance
Generally I use the StatisticIncrementEvent for detecting jumps
But you gotta still filter
🫡
// Leaf is done when it hits a block.
public boolean isDone() {
Block block = this.textDisplay.getLocation().getBlock();
return !block.getType().isAir();
}
why removing the culling method?
coded this 1+ year ago but its very unfinished
the statistics is good basecheck for the jump to detect that player might be jumping then u gotta just do bunch of checks after that:D
anyOneLookingAt is pretty expensive. I would not do a check like that.
okay
i think its good for a basic jump check but why are you creating a new ArrayList then passing Arrays.asList into it, you could just set climable to Arrays.asList directly
You should probably have a wind strength per world. Just a 2D vector for x and z.
This way all leafs fall in the same direction. The wind speed can fluctuate a bit.
One problem im seeing with your implementation: If a lot of players stand under the same tree, then they will turbo spawn a million leafs.
ye dont ask me i could just List.of
yeah that one too, in newer java only tho
hummm
Remember that asList is immutable
I think List.of is too
it is immutable
I'd use List.of in newer versions and Arrays.asList in older versions
someone said that it's just unresizable
aslist should be mutable
it's not mutable
rlly
anyways I think PlayerJumpEvent would already do that behind the scenes, and you just gotta do the rest to make it an advanced/accurate jump check
it calls new Arraylist but ye checked immutable
it is a local arraylist
asList calls
@SafeVarargs
@SuppressWarnings("varargs")
public static <T> List<T> asList(T... a) {
return new ArrayList<>(a);
}
AHAHA @lost matrix
ye, i only wish i had need for jumpevent XD so i would have motivation to finish that. started it, realized i have no use for it anyways and not worth the time:D
oh thats gonna be so sick
too much wind, I'm trying to see why
is that open source?
Well it would be cool to have your own accurate jump check to use in the future or publish it
yeah, I'm putting the latest code in github
would love to try to do my crazy scanning ideas XD
You could make your own API/collection of useful util classes that include the jump check too
true:D
here it is
enjoy x)
got so much under my plate i gotta finish:D sadly jumping is far on that list haha
sick!
im just trying to give you more motivation to complete it xD
oh nms , do i gotta build all versions? I never really wanted to get into the nms sht:D
haha XD thanks:D
there is nothing interesting in nms code of my plugin
just one method to get the foliage color
:D
Also i wonder how often they spawn and how heavy it is, would it be possible to utilise the old texdisplays to teleport it back to top when it reaches bottom?
so keep teleporting it back to original location until player is out of range
the old textdisplay?
If you really wanted to optimize it
yes
Go full packet based
wow
yeah, I thought of that
but ProtocolLib is really hard with displays
better to get prototype first without packets
yeah
Then you could do all the movement async
Actually you could probably do all of it async
Doesnt displayentitys have already thing for the movement?
setTeleportDelay(int) or something like that to move it to another location?
or some other method
so u dont need to teleport it 1000x, i might be wrong but i remember something like this
The absolute best performance would be to not tick the leafs at all. Just calculate their trajectory and then send
a TextDiplay entity with an interpolation and transformation. That would be smooth and extemely efficient.
yeah, but first, why is there so many wind? x)
True
it's strange
If it’s a straight line you can do it fully with interpolation
After otpimizeing the code this much, the next step will be packet based leaves, I promise
Multply your wind by 0.01
okay
People keep saying that displays arent ticket but doesnt they need to be ticked for passenger stuff, just some very light stuff
it's actually a ThreadLocalRandom.current().nextDouble()
gonna dig into ur code tomorrow and see what i can comeup with! hopefully ill have energy :D
thats good:D
To achieve ultimate performance all must be packet based
Don’t even have a server, kek
I mean you could run the backend in whatever you want
As long as it can send stuff to the network
There is a minecraft platform written in Rust
@eternal night i think ur list stuff is a bit brokey, if i store a byte array list on a chunk and log out then when i relogin and load the chunk it errors out saying the tag instance cant store List
yep i just need to wait for spigot to build kek

i just realised i dont have exact replication code but i can give a good enough example https://paste.md-5.net/dagoyowixe.cs ```kt
val contents = blockPdc.get(PDC_CONTENT_KEY, PersistentDataType.LIST.byteArrays())!!
.map { PineappleLib.getNmsProvider().itemFromBytes(it) }
.toList()
block pdc is on a tile entity and the itemFromBytes method is <https://github.com/PineappleDevelopmentGroup/Pineapple/blob/dev/pineapple-nms/spigot-v1_20_R3/src/main/java/sh/miles/pineapple/nms/impl/v1_20_R3/PineappleNMSImpl.java#L176-L184>
so just, items to bytes and shat into a chunk
I'll try
well, technically its on a tile entity block
Cannot replicate @remote swallow
Can you check the block data
/data get block x y z
(tbf I am on paper, but I don't know of any patches we have that diff that write logic)
current just has air, in ill check with a real item 1 sec
LOL
okay yea
that is not going to work
I guess we gotta error
tho
Yea I think I know what is happening
Actually
it still errors when given stone
no I do not know what is happening, it should properly set the type flag

what is the data then?
non null list of ItemStack(Material.STONE) atm
No like, the block data
somehow still the same except it should contain stone, 1 sec

somehow its not saving any data from that, im gonna sout the data its attempting to save
i mean if it fails trying to save air that could be a you bug
The only thing I can think of is that something else sets that list with an incorrect data type
or I missed the data type getting clapped to 0 on empty lists
but like, I can store an empty byte list and filled one just fine on paper ™️
You can always run spigot in debug
instead of whatever the fuck you are doing now 
Throw some breakpoints in matchesListTag in the CraftPDTRegistry
on all return statements
true
i have a feeling its something kotliny bc even trying to check the contents pre serialize it doesnt exist in the list
Hello, papermc wasn't much help,please be better than them mocking us for not using the paper library, we have our reasons,my mate can't get maven to recognize the bukkit library or even run simple stuff from it, any idea why?
their message:
I'm using maven with community Intellij right now, and I have a dependency that just is not working for some reason, if i comment out the dependency in pom.xml then some of the functionality of my plugin won't work(NoSuchMethodError).
[WARNING] The POM for org.bukkit:craftbukkit:jar : 1.20.2-R0.1-SNAPSHOT is missing, no dependency information available
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 0.464 s
[INFO] Finished at: 2024-03-19T20:09:02-07:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal on project NAME : Could not resolve dependencies for project tools.NAME:jar : 1.20.4-0.1: The following artifacts could not be resolved: org.bukkit:craftbukkit:jar : 1.20.2-R0.1-SNAPSHOT (absent): org.bukkit:craftbukkit:jar : 1.20.2-R0.1-SNAPSHOT was not found in https://repo.papermc.io/repository/maven-public/ during a previous attempt. This failure was cached in the local repository and resolution is not reattempted until the update interval of papermc-repo has elapsed or updates are forced -> [Help 1]```
theres no reason to be depending on craftbukkit
depend on spigot, make sure you have ran buildtools
they have ran it
can you show the whole pom
what do you guys think of a placeholder system that can also take params? is it a waste of time or can this be useful?
example: %ticket_information.<UUID, tickedID>%
^ fields can then be replaced with the stuff that is needed.
would be surprised if thats not already a thing
sorta negates the point of a placeholder though
hows that?
im assuming UUID would be for a specific player?
yea, lemme make a pastebin of it
yes
wdym?
whole point of a placeholder is it being static, and nothing have to change
say i want to display the tick information in a sidebar, using a plugin config
how do i set the uuid in the config
Yea, don’t depend on craftbukkit. Depend on spigot and spigot-api
<dependency>
<groupId>org.bukkit</groupId>
<artifactId>craftbukkit</artifactId>
<version>1.20.2-R0.1-SNAPSHOT</version>
<scope>provided</scope>
</dependency>```
paper api should include all the craftbukkit libs
tahts a good point, i didnt think of ppl that dont develop plugins
then how would i implement such?
why is there paper 1.20.4 but 1.20.2 craftbukkit
That too ^
like on paper it sounds like a good idea, but i feel there would be a lot of downfalls realistically
there's some things that we need from both, so we mismatched
the paper dependency you have should already have all teh craftbukkit imports
it shouldn't effect functionality, and it doesn't
what do you need from craftbukkit specifically
that wont work with nms
or on spigot if you use any paper added features
import org.bukkit.Material;
import org.bukkit.configuration.file.FileConfiguration;
import org.bukkit.craftbukkit.v1_20_R2.inventory.CraftItemStack; //TODO adjust to 1.20.4
import org.bukkit.inventory.ItemStack;
import java.io.*;
import java.lang.reflect.Array;
import java.lang.reflect.Constructor;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.sql.*;
import java.util.*;
import java.util.stream.Collectors;
:3
heres our imports
you can tell immediately which ones
lol
jsut use mappings
that wont work on anything higher than 1.20.2
Well uhh, 1.20.4 is R3 not R2
so why do you have paper 1.20.4
because then we can convert it into other stuff, but still, how would i implement the bukkit library from paper
more importantly
how would we grab stuff like this baby
import org.bukkit.plugin.java.JavaPlugin;
paper api should have that
WHERE
thats included in paper dependency
or just use the spigot depdenecy
^
now thats just me typing the wrong number LMAO
ugh i can't post screenshots
holup
?img
Can't send images? That's because you're not verified! Use !verify to complete verification.
Alternatively, you can upload screenshots to any image hosting site and share the link.
Here's some screenshot utilities that you can use to upload images.
Lightshot: https://prnt.sc
Imgur: https://imgur.com/upload
Flameshot: https://flameshot.org
org.bukkit classes wont be under anything paper
are you looking for JavaPlugin?
Are you manually writing out imports?
I'm looking for THEM ALL
they won't be under paper
search org.bukkit, if you dont have it your project is the wrong version upgrade to java 17 and reload
they are still under bukkit
your maven is probably messed up, because paper dependency should include all of that
It’s just org.bukkit.JavaPlugin right?
thats the same screenshot
theres more
nah
of you searching under a paper pacakge
^
yeah
oh it only showed 1 kek
yeah only thing i can suggest is use spigot dependency
yes the emc_core packages will be renamed
looks like the paper one just isnt resolving what it should be, and thats past anything we can help with
from buildtools too?
if you need that craftbukkit class yeah
I mean, if you need craftbukkit classes you gotta look at ehhh
going back to the error then, it seems like that won't be the issue, but we have another issue
lemme grab it
?nms
All you got to do to use nms is to depend on spigot after you run BuildTools with the remapped flag. :p
heh
even with the bukkit stuff commented out
das a paper method
im so confused what version your even on at this point sometimes is 1.20.2 then its 1.20.4
setCourse
but what lynx said
just live with it
lmfao
yea I know I'm busy refactoring everything
please don't remind me of my poor habits thx
but seriously
why is that erroring out
its a paper method
das a paper method
It’ll come back to bite them. :p
method paper a it's
because they patch
paper adds methods to existing types
paper forks bukkit
oh lmfao
they can add methods into the bukkit package
yea i forget thats something quite literally everyone can do
stoopid brain of mine
anyways
I'll go dip to papermc
and let them mock me again
lmfao
good luck

say hi to lynx when you get there
they have yet to say hi
Hey guys, I have Java experience. I was wondering if there is a go-to spot for learning Spigot development? Some book, video series, website, etc?
LMAO
tthere are a few good spigot series on youtube, none of them I would follow religiously, but it's good to get an idea
there are like 4 core concepts to spigot, once you understand that the rest is easy
Thank you! What are the 4 core concepts?
i just made that number up but pretty much
- event handler system
- how everything centres around ticks
- BlockState / ItemStack / Meta systems
TO BE SPECIFIC, I AM NOT. my developer under me was
use paper and paper api or spigot and spigot api
if i got my boss to ask questiosn for me on stack overflow i'd be fired
oops wrong person
his response was simply "o"
literally just "o"
the dudes a good programmer but damn when he blunders he blunders hard, and then i have to go hunting to figure out why
Gotcha, thank you. A lot of the plugins I see look complex especially game plugins with state, etc, but maybe they're more trivial once you actually learn it properly
most of that complexity is more to do with plugin design/archetecture rather than the underlying library itself
spigot itself, is really simple
awesome, thanks.
in what version did nms become version independent?

Never
The package name was changed in 1.17
ty
you just realized that?
What
Kinda rude ngl
I mean the chance of NMS code from 1.17 still working on 1.20 is fairly low
Do you know what "java.lang.UnsupportedClassVersionError: Preview features are not enabled for ....." means?
(class file version 65.65535). Try running with '--enable-preview'
Sounds like you are running something compiled with java 21
Which may be using preview features
how do I change it to a different version
?whereami

woah md did say sir this is spigot
Maven compiler plugin and ```
<properties>
<maven.compiler.release>17</maven.compiler.release>
</properties>
I am in spigot
I just noticed the decimal is also the max 16 bit value
unsigned, woo
XD
@remote swallow whats the verdict
y2k was being dumb and it was his non null list
yes he left
got sick of cmarco
I think my project is glitched or something lol
can put anything here and it'll compile
Yes that is how experimental versions are differentiated from releases
can delete the entire pom.xml and it'll compile
wrong working dir?
no
sounds like your not compiling with maven
Yep
So I restarted intellij and now it fixed itself but I changed this from 21 to 18 and reloaded changes and recompiled and it still gives me the same damn warning
Also for those curious in how to compile with preview or experimental features with maven
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.11.0</version>
<configuration>
<source>21</source>
<target>21</target>
<encoding>UTF-8</encoding>
<compilerArgs>
<compilerArg>--enable-preview</compilerArg>
</compilerArgs>
</configuration>
</plugin>
</plugins>
</build>
Think so but not entirely sure. Java 21 has quite a few jeps at the moment
That didn't work
java.lang.UnsupportedClassVersionError: Preview features are not enabled for dev/spexx/ranksigns/interfaces/config/DefaultConfigSyncer (class file version 65.65535). Try running with '--enable-preview'
how are you compiling
It's exported in
Think at the moment its failing in building
It says success
Also note to run a java application with preview features you need to use the command line argument for the jvm as well
worked like a peeled banana
hi bestie
who are you seeing on saturday
my girl
dont you live together
i thought you moved in together like last year
na?
we hopefully plan to move in together this year tho
would be good
we're off on a holiday to a beach together this year
so W
wot
you know exactly what i mean
sus
i spent half an hour searching for where minecraft stores its fonts and couldn't find it.
does anyone know where i can find the arabic font Minecraft uses ?
it's GNU unifont
v15
the font ZIP is an object now, not included
it's like sounds
wdym
it's not in the default resource pack
is it installed on the PC or does minecraft store somewhere ?
i found this
i don't know what is going on
BUT
my guess is
since this is refrencing a image inside of minecraft that has a limited ammount of characters
and seeing how there are A LOT MORE characters in minecraft
my bet is that this file is telling the game to override some of the default system font with these ones in minecraft.
and i will wait here 5 minutes till someone comes and tell me how i am wrong and should never open a minecraft file in my life.
✅
what's happening is
the default 'base' font is GNU unifont
minecraft then has its own textures that overwrite some of Unifont's
so when the game asks 'give glyph of "A"' it returns the minecraft one
but if I ask 'give glyph of "﷽" it cant find it in MC so it shows the unifont one
brother typed a really good sentence.
The font is the typeface that Minecraft uses. It was first added in Java Edition Classic 0.0.2a and has seen many revisions and additions since.
Its design has been present in all ports of the game.
In Java Edition, the font’s name is Minecraft Seven. It contains 2,426 characters. Multiple fonts can be defined and referenced with resource packs.
with that out of the way I will take a minute to thank the sponsor of this video
RAID SHADOW LEGEND
but yeah, thanks @rough ibex.
uh huh
thanks for the explenation baka
Usually it's straightforward. There is no need to overcomplicate things
But it really depends on your usage and what you want to store
I'm wondering if this is good implementation or not, it works fine in game and I'm just messing around with an expandable command system, notes / suggestions always appreciated ❤️
For small databases its straight forward. But you would need to profile the db and be having issues like slow queries to determine if the layout needs changing or if functions need to be created
It can potentially hide issues. It should only be used where you guarantee the object cant be null or if the api explicitly states it isnt null
Well it's just there because the warning highlight was bugging me, have you got time to check the paste? iirc it's only like 40 lines
Also plan on making command strings configurable...
Redis is not necessary if using something like mysql as it has memory only db capabilities
Functions are not scripts. They are commands or specific queries setup before hand or it might perform some operation on the db or multiple dbs
https://paste.md-5.net/ofuguvajup.java
Also this one is about 200 lines if anyone has got time for some notes / suggestions
am I blind or I can't find a tutorial on how to make a simple dynamic protocolLib sign??
I used to do this a lot but kind of lost projects and don't remember how to do it
It can be but mysql has some built in sort that you can use with queries
Like if you want descending order or ascending order
You can sort based on a specific column as well
Do you mean individual sign?
Yeah, that is just dynamic, based on who looks at it, it'll show their name for example
different on every client based on the username
I know this plugin maybe you can have a look at it: https://github.com/blablubbabc/IndividualSigns/tree/master

