#help-development
1 messages Β· Page 1979 of 1
Anyways
Eh, I don't understand this
gpg: skipped "2Hex myemail@gmail.com": No secret key
gpg: signing failed: No secret key
error: gpg failed to sign the data
fatal: failed to write commit object
still malding on how to fix this
Lool
Do you have gpg installed?
Do you have minGW installed or anything like it?
And the node id?
Then it is a certified Java IDE moment
wdym
right axed off the node on accident lol, although not technically required depending which version you want to use π
fixed it lol
Honestly this is too much low level fkery right now... im gonna save it as "might be true"
how do i make sure the block face of the new type of the block is the same face as the one before?
Block b = e.getBlock();
if(b.getType() == Material.JACK_O_LANTERN) {
Location l = b.getLocation();
ItemStack i = new ItemStack(Material.TORCH);
//Block target = e.getBlock().getWorld().getBlockAt(l);
e.setCancelled(true);
//b.getFace(target);
b.setType(Material.CARVED_PUMPKIN);
e.setDropItems(false);
b.getWorld().dropItemNaturally(l,i);
}
block data or something like this
You need to copy the BlockData like geol suggested.
kk
And with copy i mean just creating a variable because getBlockData() returns a snapshot anyways
it is pathfinding to the left here, the yellow stained blocks are the nodes that it has considered... what i mean is why does it consider all these extra nodes which end up not being needed? There must be an issue with my heuristic no?
gpg: skipped "2Hex email@gmail.com": No secret key
gpg: signing failed: No secret key
error: gpg failed to sign the data
fatal: failed to write commit object
Still looking for help
Try using an alternate git client I guess
how
You need to weight your nodes using the distance to your target destination
what are you trying to do?
Install Github desktop, git bash, there are a few git clients out there
committing to github
Pushing or creating a commit?
commit
github needs your key
intellij should do quite a bit for you in that regard
you actually need to upload your key to your profile on github
intellij is giving me the error sir
so that it can verify
how do i get my key
Well in that case GH is not the culprit
GitHub does have an article on this
Also how long are we speaking? Several hundred blocks?
He likely does not have a key
yee
He does not know how to install gpg
And Choco to the rescue
Windows moment
with the links
It also has an article on creating keys as well
thats the first time this happened to me
See above link
it depends on the method of committing. If you are making use of a method that isn't https then you need a key
It's mostly copy/pasting commands
if you use https you need your secret random password GH generates
Right. Do you usually sign your commits?
no idk whats that
Then you should first do a 2D pathfinding using chunks.
Then do a separate per chunk pathfinding. Chunks can be snapshotted which means
you can even multithread this if you wanted to.
Probably something like https://gpg4win.org/download.html
May have enabled it in your config then. You can disable it. Sec
idk
Hmmm that seems like a weird way of going about it. I already use chunksnapshots to allow me to do this off main... i see what you mean about weighing them differently though
Correct, but just Material.POTION should be your water bottle
error: invalid key commit.gpgsign=false
But if the per chunk stuff is too much hustle:
Weight your nodes when computing A*
Get all surrounding nodes, calculate the distance sqaured to the target of each node and
proceed with the one that has the lowest distance to your target.
Thats called weighting.
Mustn't be set in global then. Maybe on the repo. git config commit.gpgsign=false
(in the repository directory to which you're trying to commit)
Yeah which is a water bottle
declaration: package: org.bukkit.potion, enum: PotionType
Yep
Beat me to it
ItemStack potion = new ItemStack(Material.POTION);
PotionMeta meta = (PotionMeta) potion.getItemMeta();
meta.setBasePotionData(new PotionData(PotionType.WATER));
potion.setItemMeta(meta);```
btw
declaration: package: org.bukkit.potion, class: Potion
it is deprecated but you could just do setType on the potion
well it doesn't specify why it is, probably because there is PotionMeta
I would open your .gitconfig manually then, @grim ice
ah I was right about the deprecation
On Windows, go to %UserProfile%
it states it at the top instead of in the method lmao
You should see a .gitconfig file there
well generally should avoid deprecated methods but it doesn't mean you can't use them
If you see any of these, Hex, remove them from the .gitconfig, save, and try committing again
I am not entirely sure, haven't kept up with all the new stuff in the game
Do you want to get a water bottle?
A message that tells you about your outdated client...
Bungee
I. e. what is the output of /icanhasbukkit on that instance?
Either you are misunderstanding me or we have found you issue
prob smarter to tell them to run version as its hardcoded, while the hasbukkit command can be easily removed in the commands yml
pff, that is half the fun
fair lol
so um...
I defined a command in plugin.yml, made a class implement CommandExecutor, overwrote it's onCommand, then used getCommand("name").setExecutor(new CommandExecutorClass()); in my onEnable. Issue being... when i reload the plugin and type it in, it doesnt trigger
Yeah i solved this by using a exponential curve, where they are weighed more important as they get closer. Thanks tho!
Anyone here used EDB Lib?
unlikely. What is it for?
I am getting many errors on ubuntu when using this lib in my plugin
What sort of errors?
java.lang.ArrayIndexOutOfBoundsException: arraycopy: last destination index 168 out of bounds for byte[112]
What is the full stacktrace?
I am not so pro in java. so I can't get whats wrong on that lib
When I try to make a stats folder, nothing shows up
Main class (under playerjoin event, line 109): https://paste.helpch.at/ehewasuvop.cpp
Data Creater class: https://paste.helpch.at/dotacibahe.java
YML: https://paste.helpch.at/ulagubebow.makefile
But this sounds very much as if it is a library issue, in which case I'd suggest opening a bug report
okay
geol, any idea why registering a command isnt working?
Did you change your plugin.yml?
yes
it just echoes back the 'usage' from plugin yml
instead of executing
but i have it registered
written, registered, reloaded the plugin in fact
thats why im so stumped as to why it isnt working
.
also you don't need Bukkit
you can use getServer().getPluginManager().registerEvents(this,this);
that does not do this
Then show us the main class and the plugin.yml
Chances are there is a typo somewhere
do you want everything or the relevant parts?
wait a moment
it errors out on reload?
why
Reload or restart?
When I try to make a stats file, it doesnt work. I am trying to save the players UUID under the players:, and then like 12 stats under the uuid
Main class (under playerjoin event, line 109): https://paste.helpch.at/ehewasuvop.cpp
Data Creater class: https://paste.helpch.at/dotacibahe.java
YML: https://paste.helpch.at/ulagubebow.makefile
iirc returning false from a command shows the usage as well
Calling an NPE on startup because you made a typo in the plugin.yml
Stacktrace would be helpful ;p
(& the plugin.yml)
reload. The issue was that i updated the handling on reload, which required an instance of the plugin to be cached. However, that instance of the plugin got cached after that code block, which i did not realize until i looked in the console just now
ergo the error was absent on restart
Stacktrace would be helpful ;p
(& the plugin.yml)
well the stacktrace is literally Plugin cannot be null, im fairly sure i found the issue
When I try to make a stats file, it doesnt work. I am trying to save the players UUID under the players:, and then like 12 stats under the uuid
Main class (under playerjoin event, line 109): https://paste.helpch.at/ehewasuvop.cpp
Data Creater class: https://paste.helpch.at/dotacibahe.java
YML: https://paste.helpch.at/ulagubebow.makefile
i just did not realize ther was an error since the COMMAND showed nothing in the chat
try not to spam
Yeah, the command is just going to reverb back to you itself if your plugin failed to load in any capacity
sorry no one is repsonding tho
Why are you registering events 3 times? This is asking for trouble
just in case

Also not entirely sure why you're implementing the plugin message listener and not doing anything with it
actually what would registering two different commandexecutor classes do?
i know actual EventListeners are desinged forthat but commands?
Nothing. Would override it
Commands can only have one executor
ah thanks
okay that explains more
You're doing config.set("", something) somewhere
How do I do this exactly? I tried it
Block b = e.getBlock();
if(b.getType() == Material.JACK_O_LANTERN) {
Location l = b.getLocation();
ItemStack i = new ItemStack(Material.TORCH);
BlockData bData = b.getBlockData().clone();
e.setCancelled(true);
b.setBlockData(bData);
b.setType(Material.CARVED_PUMPKIN);
e.setDropItems(false);
b.getWorld().dropItemNaturally(l,i);
yea
this.sbdata.getConfig().set("players.", player.getUniqueId().toString()); is illegal
Just remove that line
it's illegal
ok
Well, no, but you're setting players. to something, which isn't valid
Do not question my descision
You probably wanted to set "players." + player.getUniqueId() instead
To some value
this.sbdata.getConfig().set("players." + player.getUniqueId(), 1); for instance would set everyone's value to 1
but it would work
You canβt end a key with a .
However it would make later lines illegal iirc
no error so far
So just remove it
How so?
It would just override previous sets
It worked!!!
hm, would it
Yeah you can set over the same path multiple times
I know. If it's a different player it would be a different path π
well it worked by removing it
it is now this:
players:
db0be134-f6ce-4991-a404-0707a576e524:
health: 100
defense: 100
strength: 100
speed: 100
critchance: 30
critdamage: 100
intelligence: 100
miningspeed: 100
seachance: 10
magicfind: 100
petluck: 10
truedefense: 10
ferocity: 0
abilitydamage: 10
miningfortune: 100
farmingfortune: 100
foragingfortune: 100
But given of the tree-like structure of the config system, you probably are right

please help here
You need to set the block data after setting the type
Corrector
handcrafted flatfile formats on top
block data
I'm using the <World>.dropItem() method but the item flops around, can I make it so it just drops
what do you mean?
You might want to use dropItemNaturally, but mostly it is the same thing
What do you mean by that?
Do you want to use a hashmap as a key?
?stash
Would you mind explaining? No idea what thats supposed to mean...
No, just save a Map on mongo
Basically you can serialize everything you want in the way you like when you craft your own format
As long as you can serialize it you can save it in mongodb. No problem.
I would recommend serializing to json as the conversion json to bson (mongodbs format)
is quite easy.
Json
Omg everyone told me that
Oh im still confused how to encrypt to stop people skidding when a jar its running on JVM
I wish java would be easy
Perhaps Graal's ahead of time compiler could be one way, but I never dabbled with it
I prob will have to spent 512 dollars on ZellixKlassMaster
Java is pretty easy to crack
Most obfuscators are trash if you want to only protect a single thing
Well, perhaps all of them
In 99% of cases you only want to protect a string that represents a discord webhook
I dont wanna see fucked skidders skidding my code
If you just want to obfuscate your code then you can just use a free solution.
I want to UE to sell plugins on mc market
And free options are discsrted no one its good
However, this is where the issues arise: Because most people only obfuscate if they have something to hide, obfuscation basically means malicious jar
Why mcmarket allow it so? &
Dont bother with that. If someone wants to reverse engineer your application then they will simply do it.
Obfuscating will just make it a bit harder.
Now explain....
So don't obsucate (especially due to bukkit's nature it is quite trivial to inject malicious code at the onEnable method)
A friend has ZKM and never get something deobf
Then its probably nothing worth deobfuscating lol.
Why would you want to prevent deobfuscation?
Already answered
If there is no DRM integrated, noone is going to bother
And skidders can just ignore obf
Also this one of main reason
There are automated tools to just add malicious code
Do you have a multi hundred hour project with great features that you want to sell for a higher price?
Sure, the spigot antivirus is going to detect this, but usually it is not the case
Oh no one cares that. Because if not mc market wouldnt make money from people selling obf plugins
I dont know why you still annoying with that of virus
These days no one care
Im 99% sure that nobody wants to "skid" your code
Even non-noob code is usually not getting skidded
No but you dont have a single resource on spigot.
You put too much time into thinking about protecting your code instead of writing it.
But as soon as you add DRM to it, someone is going to deobf it
me seeing these people try to obfuscate resources when i swear i spend countless hours on my open source projects...
honestly saddens me
Resell what? What do you sell?
It is
This will sound socialist but idk how you take it:
I think that open source Project its to serve the food to the richers
exactly
I diagnose you with fatal stupidity
So many developers put countless hours into developing their own open source projects, just to get ruined by some other developer who frickin obfuscated their own code.
Be glad that open source exists
Cuz they use your free work that you put effort on it. And they get money from it they dont give anything
You dont work on open source projects for money.
If you want money then you get a job as a software developer
or freelance. And in both cases you will be very thankful for
open source projects.
I dont know I thimk obfuscation its to keep your thing with you so one else cant use it
Well, you see, the issue here is that obfuscation only makes it harder for other people to use it, it doesn't prevent them
lmao
But with this society its I possible to sell deobfuscated things
Yeah imagine reading an error report
a, b, c, d, e
You cannot debug stacktraces at all
Your code is definately not gonna be flawless either
I would love to see you all trying to deobf a obfuscator of +512 dollars (ZellixKlassMaster) and even Stringer +3.000 dollars
Verano imagine if Spigot (an open source project) would be obfuscated...
I once passed a null value to some bukkit event and it caused an error in an obfuscated premium plugin. I was only able to guess what caused it thanks to someone sending me the jar
I mean, it kinda is
And it makes everything painfull
I would love to see you trying to solve an exception in your plugin that is obfuscated
Hm?
do you have a stacktrace example?
Don't even mention debugging
All the classes will be replaced with a, b, and so will methods and variables
You mean net.minecraft.server. Spigot is not obfuscated in any way...
so nms then
no, prolly worse
oh right
And wait who debug obf code?? The obfuscation its done before its working
eh true they just do that to methods
exactly
How do you debug non-working obfuscated code?
Lol
Proguard kinda is able to aid you, but proguard isn't really obfuscating
Why you need to debug!! That should be done by the autor
sight Then go ahead and obfuscate your code.
Dont forget to remove all the mapping files. And dont
make any backups. They can be used to deobfuscate your precious code.
yes, and how is the author going to read bug reports?
As well as other plugin devs
give them the steps to reproduce the bug
then repeat on a private unobfuscated version
:D
You'd be astonished at how often you cannot reproduce a bug
oof
Do you realize how much a pain in the ass it is for not only yourself, but also other developers to fix these issues if your plugin is obfuscated.
I need something that ofuscate method, field, methods and clnstrutor params
oh then proguard does this
No
It does
It doesnt i test it
Bukkit calling doesnt get obf too
wait i found a reason for why to do it. It says that At the same time it shrinks the code size drastically, which helps to reduce the startup time of the application.
lol
I have seen ZKM obf cose and you literally see the strucutre and them just |||| chstacter everwhere
How should it... do you know that its a third party.... what? How do you think obfuscation works?
Which is why proguard is one of the most known deobfuscators on the market
website?
This is an amazing obf
You can do stupid stuff with method handles
But weren't you the guy that wanted to save every inch of performance?
obfuscation makes your code slower too sometimes
lol
by adding a ton of unnecessary shit
Because those two are mutually exclusive
So if they are exclusive why telling that they are shit?
I do T understand your thoughts
if you care so much about micro-optimizations read https://www.thriftbooks.com/w/introduction-to-algorithms_clifford-stein_thomas-h-cormen/254823/item/7510033/?isbn=0262033844&idiq=7510033&gclid=CjwKCAiAvOeQBhBkEiwAxutUVBbbnkpPS37yxj1mA6MJjtw0T3ej1R_bC9lbC_AarQmfCaJvfUNJPRoCq4sQAvD_BwE π€‘
lol
They are agree, dont agree, agree and that everytime
I'm pretty sure that half of the URL is useless
It is
Im more and more convinced that verano is just trolling us big time.
Who would write Backend developer (JavaScript) in their desc.
He has to be a troll.
Minecraft configurator
Oh shit
i just realized that
LMFAO
nodejs goes brrr....sst and then it dies
Because with Javascript you can write many things hmn
I have seen header people but here
https://shapez.mod.io/it-runs-doom
js everyone
Also, verano there is this thing called the GPL
What that?
You are legally obligated to disclose the source of your plugin
The most important descision is not a line of code, it's the license
And Bukkit's license it the GPL
I dont care I just see that people on mcmarket sell really good obfuscated resources and no problems happen
i mean technically no
but it still happens
no like isnt the code yours
do you mean in general or for publishing on spigot
I dont care about license file I just delete them
like it has to be compatible
you guys right now
Infectious licenses go brrr
It's cause there are a lot of plugins that don't do that, but also the fact that nobody is going to enforce it either
Ok now im convinced. That one was a bit too much.
then you are outside the realm of law
Why are you even here?
leave lol
This is what I was saying. They said yes, them no
Why do you want help from an open source project if you reject the very foundations of the open source world?
general
At least for bukkit plugins
When I ask for help its not to sell
What oos?
dont open source projects usually have a license saying to use their license too?
What do you expect as an answer? You are literally asking whether if you want to obfuscate in a strongly open source community. At this point you are trolling
They are not asking whether, they are asking how
that's only for certain licenses
I dont care license because dont anything. They dont prevent people doing mlney etc
Is it safe to use "this.format" as config key ? Or should I replace dot with something else? I don't want nested keys in this case.
do you know what a dmca is
lmao
Bukkit died thanks to this
Yeah
A friend buyed dmca and he demande one for resseling his plugkns and they are still in fight since March 2021
Dots split your path. You would need to escape them.
"bought dmca"
Dont you have to pay for it?
waitwaitwait so using the bukkit api means your plugin must be open source
What is escape character for dots in FileConfiguration please?
\
yes
\ or / ?
\
I think its just html escaping
Wouldn't it be bash-like syntax
\nNew line here
Alright "this\.format"
What trying to do
If even it would be \\., but this doesn't sound like valid yaml
Finalizing the dicussion if in future I sell plugins prob will have to spent money in a good obfuscator
in yaml I have used String keys before and there was no need to escape dots... you just enclosed it into ""
What doing??
"this.is.key"
So something like this?
However I doubt that snakeyaml supports that
it has always been pretty bad when it came to whack features and this is an extraordinarily whack feature
why escaping dots in yaml?
list-of-key:
key-1: "key one"
key-2: "key two"
Config#getString("list-of-key.key-one")
you misunderstand
How do you broadcast across all servers with bungeecord
probably with plugin messaging channels
which results?
getConfig() returns a fileconfiguration objects which holds a map internal
getConfig() always hits the file afaik
getConfig is cached and uses hashmaps internally
usually you save returned FileConfiguration somewhere
However it depends on the situation. I assumed JavaPlugin#getConfig here
Other getConfig methods may have different behaviour
YamlConfig.class works with that right?
Any config object is, as soon as it is read, cached with hashmaps
don't use ".class"
Oh ok
well, depends on when, but in this case you can just use the simple name
And no
In the last 10 years bukkit and spigot only lost a few classes, if any at all
But any valid json is valid yaml so there is no need to have a json config
And json intentionally does not support comments, so it makes little sense to use json for configs
yaml just doesnt keep comments lmao
Do you know the command to build that?
now it does thankfully
idk im using the 1.17 api
And it was a snakeyaml issue
ah they fixed it
Hello, does PluginDisableEvent event triggers when self plugin disables? Lazy to test it lol so if anyone have tested this, tell me
if you want to detect your own plugin disabling use onDisable instead
ik that and no, I want to know when my plugin disabled, does plugin disable event triggers too
Yes
onDisable runs when your plugin disables
And I assume the event will trigger as well
But Iβm not sure if you will receive your own plugins disable event
Depends if it runs before or after the actual disable
I think what he wants to know if the listener which is registered by his plugin
handles the event that is fired when his own plugin disables. So does it catch itself.
.
Cancel the entity damage by entity event if the arrows shooter and the target are the same entity
The arrows shooter would be event.getDamager.getShooter
EntityDamageByEntityEvent
Check if damager is Projectile
get ProjectileSource
check if its a Player
check if the source is equal to the damaged entity
what will happen when i call FileConfiguration@getBoolean on a path which returns a long?
just wondering
exception
i should test it lol
ye
can you get colored glass from a chatcolor constant?
the rust in me is saying switch statement
my java self is saying map
thats my idea unless there is a fancy method i don't know of
switch (color) {
case BLUE -> Material.BLUE_STAINED_GLASS;
}
i forgot the java syntax
it used to be easier when the glass color depended on the damage
assign it to a variable outside of the statement
not actually making the function for them
oh
public Material matchChatColorMaterial(ChatColor color) {
return switch (color) {
case BLUE -> Material.BLUE_STAINED_GLASS;
default -> null;
};
}
i really need to stop changing languages every month
return Material.matchMaterial(color.name() + "_STAINED_GLASS");
yep
True but there are matches
return color == ChatColor.BLUE ? Material.BLUE_STAINED_GLASS : null;
Gold -> orange
im not retarded
Aqua -> cyan
giving the switch example
even though you can just match material
if null, return the default
but shorter code != better, right
short code runs faster π
package me.imaginedev.program;public class Main{public static void main(String[] a){System.out.println("Hi");}}
haha no
thats what peak performance looks like
How can I test if the open inventory is an ender chest with the InventoryMoveItemEvent?
I dont see how this event should ever be fired with an ender chest as context...
check if the inventorytype is a enderchest
I tried that, its not a method of thge event
InventoryType.ENDER_CHEST is a thing
Guys stop. This event is not fired for ender chests. How should a hopper transfer items into an enderchest?
xd
lmfaoo
CustomEnchants thanks :D
Are you guys ignoring me?
He will come back soon...
so glad hoppers are moving items into my enderchest π
You canβt hopper an ender chest
Are you genuinely asking or being ironic, I am confused given the context
You cant lmfao
Not with that piss attitude
"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.
gpg: skipped "2Hex email@gmail.com": No secret key
gpg: signing failed: No secret key
error: gpg failed to sign the data
fatal: failed to write commit object
its trying to tell you that you don't have a secret key
Duh
Was a sarcastic question
but how do i fix it lol
give it the secret key it wants
you would need to assign the chest to a player
howΓ
then you can
Can someone help
You would just have to make the interaction yourself
gpg: skipped "2Hex email@gmail.com": No secret key
gpg: signing failed: No secret key
error: gpg failed to sign the data
fatal: failed to write commit object
not possible in vanilla
i've been malding over this
How can I make my server to make sure no mobs will spawn? Thank you for helping βΊοΈβΊοΈ
What plugin?? π
Reminds me of that thread...
https://www.spigotmc.org/threads/how-do-i-remove-one-item-from-the-players-inventory.547933/
I was so done after that#
jezus
That's sad
I mean it isn't as bad knowing they're teenagers
it's worse when the adults you live with everyday are worse than that
yes
!!
public enum SuccessfullyRemovedOneFromTheSpecifiedInventory {
YES_IT_DID_SUCCESSFULLY_REMOVE_ONE_FROM_THE_SPECIFIED_INVENTORY,
NO_LOL
}
public static SuccessfullyRemovedOneFromTheSpecifiedInventory removeOne(Inventory inventoryToRemoveFrom, ItemStack itemToRemove1From) {
int sizeOfTheInventoryToRemoveFrom = inventoryToRemoveFrom.getSize();
for (int iterator = (9 - 9) + 1 + Math.pow(5, 0) - 2; iterator < sizeOfTheInventoryToRemoveFrom; iterator++) {
ItemStack itemInInventory = inventoryToRemoveFrom.getItem(iterator);
if (itemToRemove1From.isSimilar(itemInInventory)) {
int amountOfItemInInventory = itemInInventory.getAmount();
if (amountOfItemInInventory > (9 - 8) * 8 - 1 * 5 + 15 - 17) {
{
itemInInventory.setAmount(amountOfItemInInventory - 1);
}
} else {
{
itemInInventory = null;
}
}
inventoryToRemoveFrom.setItem(iterator, itemInInventory);
return SuccessfullyRemovedOneFromTheSpecifiedInventory.YES_IT_DID_SUCCESSFULLY_REMOVE_ONE_FROM_THE_SPECIFIED_INVENTORY;
}
}
return SuccessfullyRemovedOneFromTheSpecifiedInventory.NO_LOL;
}
the most efficient and clean way
to do it
actually it isnt possible to do this with java, learn Fortran
assembly
nah binary
do it with manipulating each bit to form the text you use to code in Fortran
yes
manipulate each bit to form the java source code, then attach and flip switches in the cpu to run javac, jar and java by hand
ah fuck
let me fix
there fixed it
what did i miss
no naming inconsistency is good
good practice
its going to create a .sk file that steals your data
i forgot
#general message
a .sk is a skript file btw
ii know
thats why the review is ridiculous
its a reference to a review kacperleague got
yeah
at google
yes
and steal files
of course
get the location and then fly a drone there to physically pick up the computer
thats a great idea
and then fly back
and then remove 1 from the other person
because you stole it
you can use this handy method for that
how i can send title for cooldowns like 1, 2 , 3, go
Should return a boolean for whether it was successful in removal
yeah
Use the scheduler
No
Don't use a bukkit runnable
People
Stop using bukkit runnables
Then you're using it wrong
Schedule a delayed task that waits 1 second and sends "3"
Another that waits 2 seconds and sends "2"
3 seconds and "1"
Or
4 seconds and "go" and then does whatever else
Use 1 task
Yeah you could also use a repeating task
i need something for spam title (i need that for teleport delay)
fixed it
i used a better design
lmfao
yeah that was my idea too but the enum is better
for readabiliity you know
you want developers to know that it successfully removed one from the specified inventory
oh yeah
Cooldowns should always be done using timestamps. No exception.
The task that shows a cooldown is just an observer
so uhm
done lmfaoo
worst code snippet ever
Do you know "terrible plugin"?
nah
first thing i click on
i have no idea how i can do that π
0 of 0
that is real coding 
There are a number of approaches.
Recursive runnables. Iterative runnables with a delay of t(n) = t(n - 1) + 1
Timestamps with an observer pattern. And so on.
Let me write an example
i dont understand nothing but, its that a good code?
20L * (long)teleportToHomeDelay
using scheduleSyncDelayedTask for teleport delay
waiting for it!
This is the recursive approach:
public void invokeEachDeltaThenRun(JavaPlugin plugin, int delta, int count, IntConsumer nConsumer, Runnable action) {
Bukkit.getScheduler().scheduleSyncDelayedTask(plugin, () -> {
if (count == 0) {
action.run();
} else {
nConsumer.accept(count);
this.invokeEachDeltaThenRun(plugin, delta, count - 1, nConsumer, action);
}
}, delta);
}
Ew not a repeating task
That would be the iterative approach π

Example usage:
public void tpAfterSeconds(JavaPlugin plugin, Player player, Location destination, int seconds) {
this.invokeEachDeltaThenRun(plugin, 20, seconds, n -> player.sendMessage("TP in: %ds".formatted(n)), () -> player.teleport(destination));
}
Uhmm
I didnβt know ββ.formatted was a thing
how does spigot actually launch the server? I've looked at the only package there is and this is everything
Parameters of his method:
1 - The plugin.
2 - The amount of ticks between iterations.
3 - The amount of times it will run.
4 - The code to run every iteration, 'n' is the iteration.
5 - The code to run at the end
Itβs a bootstrap jar
Btw this is the iterative implementation of the method:
public void invokeEachDeltaThenRun(JavaPlugin plugin, int delta, int count, IntConsumer nConsumer, Runnable action) {
new BukkitRunnable() {
private int internalCounter = 0;
@Override
public void run() {
if (internalCounter++ == count) {
action.run();
this.cancel();
} else {
nConsumer.accept(count - internalCounter);
}
}
}.runTaskTimer(plugin, 0, delta);
}
you wont have a possibility of stackoverflow then
if you need like 1000 iterations for some reason
You wonβt either way
oh yeah
Because of the delayed task
But the iterative one is nicer
But with the other one you can use the word recursive and people will think you know what you are doing even when im not...
no crashes :(
IMO
Sure if you have like a 64mb stack...
thanks guys love you all its work and i understand
does anyone know why i get this error? java.lang.IllegalStateException: Already scheduled as 22
when as far as i know i check if its not running yet if (!Bukkit.getScheduler().isCurrentlyRunning(regenService.getTaskId()) && !Bukkit.getScheduler().isQueued(regenService.getTaskId())) regenService.runTaskTimer(this, 5 ,5);
bruh
Hey guys π - I'm thinking about making some custom projectiles and wanted to know if anyone had any ideas on how to implement. My current ideas are using a location and velocity, then use a ray trace each tick (looking ahead the distance the projectile will travel in the next tick) to see if there would be any collisions with entities or blocks and act accordingly. Could then also move an item along the same path (having disabled it's gravity) or/and particles. Thoughts?
For regen you should have a single task that gets started once the server starts and never stops.
I can just set it's velocity
you might be able to set the init velocity
yea i have to deal with plugin reloads though
yeah
snowball could work nicely I suppose π€
https://www.spigotmc.org/threads/guide-on-workload-distribution-or-how-to-handle-heavy-splittable-tasks.409003/
If you want to know how i handle plugin reloads with one of my newer plugins i can show you a snippet.
are there any disadvantages of using a snowball?
sure
what are the disadvantages of the system I proposed?
This is what i do with particle projectiles currently. Just ray trace every tick then move.
It is. I wrote a modern weapon system for a server once where they could define everything from the energy density of the powder
to the mass of the bullet. And i added a lot of physics like wind and earth rotation (Coriolis force) to calculate the bullets trace
and impact energy.
And i stand by it
lmao
that's sick
Only problem was that they disabled some features because the players where too confused why their bullets didnt fly straihgt... too much cod
hahah
So I'm guessing I'd have an abstract class for the projectile base, with the basics like raytracing etc
then for any one projectile I can make a child
I still need to do my super realistic survival plugin
I keep starting it then giving up for some reason
punch a tree: dies
dig a single block: exhausted for the rest of the day
like srsly, digging a meter cubed would take forever
backhoes?
lmao
Uh
the name is pretty dumb rn
but ignoring the name, can you give code suggestions
Yea
Your Factory<T, Y, Z> is just a BiFunction<T, Y, Z> π
Possibly
o
didnt think of that
should i replace it
but it feels cooler having my own interface
Nah keep it.
stuff inside core are supposed to be like
the internals
and the stuff inside api directory can be used by developers
What's the difference between EntityDamageEvent and EntityDamageByEntityEvent
Wait... you spawn it and then you get every entity in a radius just to filter out other entities again.
This looks like there is a better solution for that.
EDBEE is an entity damaging an entity, EDE is an entity getting damaged in general
EDBEE: e.g player killed player
EDE: e.g player died from fall damage
Not all damage involves a second entity
EntityDamageEvent will also be fired by falldamage or firedamage for example. The other only if a second entity inflicts the damage.
Like hugging a cactus
i dont spawn it
i place a structure
so i dont have access to the entity
well i can use getEntities() but im not sure if that would work
So you turn the entity into a NBT structure to save it
so i have 2 methods atm
Clever
I should credit @hexed hatch
Wait a second. I just realised that you are just serializing the entitiy into a structure.
for that
ty
Probably not as efficient as NMS
Interesting
But hey, itβs all API
π
and im gonna make some documenting on how to use it
and also test it
since its untested rn
there are 2 methods
one that uses getEntities() of the structure
one that returns an EntityResult
that you can later spawnAndGet()
or spawn()
better than exposing structures api to the user
which seems dumb imo
how hard would be decompiling original mc server file and add /home command in it and compile it again
just make a plugin
lol
private String lol = "";
I think that's delhome command, and that this is the only not logicaly named variable
yes it is delhome
but what if I wanna vhave vannila mc server????? then decompliling it would defenetly be a challange to me
Why would you need to have a vanilla server
redstone gangπ
Spigot doesnβt change redstone
it breaks some machines
I havenβt had any issues
I know paper changes redstone, but I donβt recall spigot doing anything
Either way, fabric exists
why anyone wants me to go to third party servers, ik that performace is batter and plugins are good but that's literaly all
yes do that
(joke)
alr
wait so you get EntityResult from that method?
and you can just spawn it from that?
without placing the structure?
Ah
Figured. Still, it's all api
When you reload your plugin onDisable & onEnable gets called?
Yes
Those two things outweigh pretty much everything a vanilla server has
EntitySerializer.setPlugin(this);
EntityHolder holder = EntitySerializer.getHolder();
then later:
holder.serialize(entity, namespackedkey);
holder.deserialize(namespacedkey);
or holder.deserialize(namespacedkey, true)
second one returns an entity result
which u can use to spawnAndGet() or spawn()
what do you think about its complexity?
seems as simple as it needs to be to me
im just gonna use my library later in the plugins ill make
cuz rn it needs testing, not sure if it will work
ngl i suck at making READMEs
Probably EntitySerializer
and for the config?
String.replace(β%delay%β, number)
Hello, how can I make it so that when a player places a block, they have to wait 10 seconds for it to break?
Hm?
btw
if someone uses the dependency
<dependency>
<groupId>com.github.2Hex</groupId>
<artifactId>EntitySerializer</artifactId>
<version>e08535f18f</version>
</dependency>
why is the version like that in jitpack
someone know how to?
he just told u how
if you didnt understand what he just said u dont know basic java concepts, u prob should read or watch some tutorial
String.replace dont exists lel
String being your string
How would I access and loop over this configuration```yml
Some-section:
- Some-Thing: true
Some-Other-thing: false
Some-Final-Thing: false
Information:- "String"
- "String"
- "String 69"
- Some-Thing: false
Some-Other-thing: false
Some-Final-Thing: true
Information:- "Information"
- "Or Something"
- "String 420"
Some-Unrelated-value: false
```How would I go about looping over the "Some-section"?
getMapList iirc
hi im new to development, i was wondering why for the following event empty lines get printed to the console for each of the trades the villager has (so if the villager has 4 trades, 4 blank lines are printed to the console) ```.jar
Merchant merchant = ((MerchantInventory) event.getInventory()).getMerchant();
List<MerchantRecipe> recipes = new ArrayList<>(merchant.getRecipes());
for (var recipe: recipes) {
System.out.println(recipe.getResult().getItemMeta().getDisplayName());
}```
getKeys is also an option
Alright, thanks for the speedy reply, Ill check those out
<3
I mean itβs a list
Do the village trade results have display names?
wouldnt it just be like 'Emerald' and 'Bookcase' for each of the trade results etc
i tried that and it printed blank too
nno they dont
So youβll have to toString the material
like so? System.out.println(recipe.getResult().getType().toString());
Mhm
thanks
-2/10
yeah? its done by default? what do you mean? it gets saved with the world
well
Yeah but that doesnβt let you copy and paste em
and we're not doing that much shit
we're using structures api
bukkit will do the rest of nbt copyng shit
2Hex I don't understand the point of the 2 deserialize methods
Why are there 2 and why does 1 have a useless param lol
well
first one might not work
second has a higher chance of working
its still in development
ill test both and see which to remove
Why not just use the second one then lol
Ah gotcha lol
Just one other thing
In EntityResult you throw RuntimeException, might be better to throw something more specific
Ok good
I usually program in c# .Net framework, and in there theres a method called Any(), and you use it like itemlist.Any(item -> item.name == "exampleName") and it returns a bool true or false if the list contains an item with name "exampleName", so my question is, are there any methods like that i can use in java?
list.stream().anyMatch()
thanks!
hey i am seeking a developer for my server dm me if your wana take a change
?services
If you wish to request or offer development/art/building/administration services, please do so at https://www.spigotmc.org/forums/services-recruitment-v2.54/
Anyways I have a question
ATM I've realised I might have a mistake
which is making a structure everytime I need one
(it's only 3 blocks btw)
should I make some sort of StructurePool
if so any ideas for its logic?
A structure pool sounds smart
i need some logic tho
maybe make a ton of structures
check if theyre used or not
or
add structure when placing it to arraylist
or actually
nvm
Hey, I'm currently trying to integrate the Ebean ORM into my plugin. Although when I start using my models, I get an error saying java.lang.IllegalStateException: Service loader didn't find a SpiContainerFactory?.
I have looked this up and found a thread with my exact problems on the forums (https://www.spigotmc.org/threads/spigot-ebean-orm.452192/). They stated that the solution lies in correctly shading the Ebean framework into my JAR. However I am already shading it, and have verified it by seeing the packages inside the final JAR.
Is there anything I might have missed?
im not sure what logic should i do when making a structure pool tbh
Are you talking about a vanilla structure pool or a pool system that you want to make
a pool system i want to make
so im making a structure using structure api introduced in 1.17.1
but
is making a 3 blocks structure every time i need one
how would i make a sort of "suction"/orbiting effect kind of like gravity to an object without it murdering the tps
good
Ebeans integration
prob not
Why can't I find a spawner in my server in my inventory in creative mode???
Because that is not something that is in the inventory.
Just like fire, portal and end portal etc.
do /give @p minecraft:spawner instead
where do I place the config.yml file in the plugin(before compileing)
In the resources folder, next to src
k, thx!
correction: inside src/main, next to your package name
ok, thanks!
i tried but it says unknow object...
Screenshot?
I can't send the picture in this channel and its in my language btw
i dont get it
inventory.getItem() returns null if ItemStack is empty
i get itemstack object of air
from the same method, even though it should return null in that case, since its empty (zero)
usercache.json caches player's uuids which played in the server
although there should be wrapper methods to access it
^^
Like this one
Player
like, is there a player#setPlayedBefore()?
No
You could probably do it with NMS
nms?
yes