#help-development
1 messages · Page 255 of 1
e.getPlayer().getInventory().setItemInHand(new ItemStack(Material.COMPASS,1));
How can I set Item in especific slot?
you can use e.getPlayer().getInventory().setItem
there is a picture of the item slot numbers
slot as in what?
Mainhand vs offhand or what?
inventory slot you dingus
So how would i make an armor stand face towards a location?
Because i suck at math
And couldn't find it on google
I would need advice on these two plugins
https://www.spigotmc.org/resources/2ls-antibot-the-ultimate-antibot-plugin.62847/
Which one is better?
Judging by the title? Latter. Judging by pure intuition? Neither, yo shouldn't need either
private Vector getDirection(Location from, Location to) {
double dx = to.getX() - from.getX();
double dz = to.getZ() - from.getZ();
double yaw = Math.atan2(dz, dx);
double dy = to.getY() - from.getY();
double pitch = Math.atan2(dy, Math.sqrt(dx * dx + dz * dz));
return new Vector(yaw, pitch, 0);
}
Ty kind sir
best way to compare if item is same with same meta data
to sell it in shop
any suggestions
?
probably could just do ItemStack.equals(ItemStack)
Might want to use isSimilar instead
if you are fine with the stack sizes being different
depends on what is your library
im using JDA
iirc you shaded jda, so its pretty normal
ah ok
isn't max size on spigot like 4 megabytes
Gonna have to host the plugin on github or something if you plan on having it on spigot
If you're not redistributing the plugin it doesn't really matter it'll run fine
you just can't upload it to spigot
ok so then how do i specify what NOT to shade
im not
Then you're fine
()
google translate maybe?
Alright I must not be seeing a method somewhere or something, why doesn't ConfigurationSection#getMap exist?
because ConfigurationSection#getConfigurationSection
what
moment
kann jemand programmieren
bruh
weil ich brauchte developer die mir helfen mein netzwerk wieder auf zu richten was gelöscht würde
Use a translator
4 years of learning German doesn't help
College German class?
I think they are looking for developer to help on server network or whatever
The only language my school has is Spanish and the teachers aren't very good, I'm glad I got my two years done and never have to do it again
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/
Discord API moment
No problem
Is there any way I can use components inside ItemMeta without needing to touch Paper API?
I would like to stick with Spigot 🙂
You would have to shade the Adventure Platform for Spigot into your plugin
Could someone give me a small hand with my tab completer code because everything is working as it should, but when i have the command or argument permission it should tab complete me the completations from the argument, which are not tab complete. I have tried debugging but i still havent success understanding what its happening https://paste.md-5.net/idonixedol.coffeescript
To see clearly what is going on and keep code reliable I would recommend you to make Unit tests for tabComplete method. https://github.com/MockBukkit/MockBukkit this is grate library for Bukkit mocking
ok really thanks
I will try that
And IMO this is better way of forrmating lamda code ``` public List<String> tabComplete(CommandSender sender, String alias, String[] args) {
if (args.length == 0 && hasPermission(sender, permission))
{
return arguments.stream().map(BukkitArgument::getName).collect(Collectors.toList());
}
BukkitArgument argument = getArgument(args[0]);
if (argument == null)
{
return arguments
.stream()
.filter((arg) -> hasPermission(sender, this.permission) ||
hasPermission(sender, arg.getPermission()))
.map(BukkitArgument::getName)
.collect(Collectors.toList());
}
if (hasPermission(sender, permission) ||
hasPermission(sender, argument.getPermission())) {
return argument.tabComplete(sender, alias, Arrays.copyOfRange(args, 1, args.length));
}
return super.tabComplete(sender, alias, args);
}```
ook
So Jacek, i have tried mocking it but i couldnt
So i will give a 2nd round to primary debug
why, here is Simple unit test I made maybe it will help https://paste.md-5.net/ganupadoka.java
Hay alguna manera de recuperar mi cuenta? Perdí el generador de códigos del 2FA.. Tengo todo excepto eso..
english only on here
you have to email support
?support
Thanks!
I am doing a mvn clean package to generate the plugin
but plugin.yml isn't getting outputed? smth about invalid plugin.yml
what does the correct project structure look like?
anyone know what this means
The plugin.yml should be in the resources folder
yeah it is
oh shoot my sources folder is the main not the java
it says the issue... cant start with a %
why?
so my recourses folder is not in the main directory
ask the creator of snakeyml, its their library thats throwing the issue
its not starting with it tho
Can you send a picture of your project structure? Also, are you using maven or something else
thank you for the reference 😅
I am using maven
I just had my recourse folder in the wrong spot
ah got it
rather it is the spec
the creator snakeyaml while you could say it is them, really they are only implementing the spec, and the spec says that tokens can't start with a special character
So i was trying to do a check on if the last instance of damage was a player but it wasn't working so i got rid of the check to see what was wrong and its saying that the last instance of damage came from an entity "CraftZombie" even though a player killed it?
all i did was
Player player = (Player) event.getEntity().getLastDamageCause().getEntity();
does getLastDamageCause not work the way i think it does?
Where are you checking that
in the console log after i killed a zombie in a test server
you are doing your check wrong
first you need to check if the entity is a player before casting, and second you just said you were killing a zombie
so it makes sense that the last damage came from a zombie o.O
nononono that wasnt the check
sorry im explaining this badly hold on
public void onMobDeath(EntityDeathEvent event) {
if (event.getEntity().getLastDamageCause() == null || !(event.getEntity().getLastDamageCause().getEntity() instanceof Player)) {
System.out.println(event.getEntity().getLastDamageCause().getEntity().getType());
return;
}
if (event.getEntity().getType().equals(EntityType.ZOMBIE)) {
final Player player = (Player) event.getEntity().getLastDamageCause().getEntity();
System.out.println("It was a zombie");
}
}```
so what im saying is the event.getentity.getLastDamageCause() is returning a zombie when a player kills the zombie,
i thought the getlastdamage.getentity returns the person or entity that killsed the entity in entity death event
Yes
That's supposed to happen
That method returns EntityDamageEvent
getEntity() is always the entity that got damaged
To validate whether another entity caused the damage, use instanceof to validate whether getLastDamageCause() is a EntityDamageByEntityEvent
and within that casted object you may retrieve getDamager()
Alternatively you may also simply use event.getEntity().getKiller()
Keep in mind that if you want to continue to use getLastDamageCause(), that there are things like Arrows and other Projectiles
You'd also have to validate whther the damager is a Projectile and if the shooter of the Projectile is a player
wait so if i do event.getEntity().getLastDamageCause().getEntity().getType() it should return zombie if a player kills it
(i accidently sent event.getEntity().getType)
but either way it both returns zombie which is why im confused
getKiller() works tho thanks alot its just i thought the entity in get last damaged cause was the damager itself not the one who got damaged thanks tho appreciate it
I am not exactly sure what you mean, but I am sure that the interface is just wrapping and invoking NMS methods and not by itself actually implementing those enchantments
Yes, that's because it simply returns the last time EntityDamageEvent was called
You may read into that docs
The entity could also have been damaged because of falling or whatever
OHHHHHH thats why ok yea that makes alot of sense
I have a system setup to send a command from our shop thats: "commandname storecode username pricepaid" but im having an issue as its not registering the pricepaid part.
Player player = Bukkit.getPlayer(args[1]);
player.sendMessage("You paid: "+args[2]);
Long ltl = Long.valueOf(args[2]); <--- this is where I am getting my issue
int ecosend = ltl.intValue()*100;
player.sendMessage("Recieving: "+ecosend+" coins");
return false;
Caused by: java.lang.NumberFormatException: For input string: "0.01"
Can anyone point me in where I can understand how to fix this issue?
0.01 isn't a long
I have also tried int
I appreciate the info, will adjust my code
@river oracle i never used Maven/Gradle so how i can solve my problem ?
learn maven/gradle
its a standard and its useful as fuck
using the standard java build system is 💀
Thanks for no help
Maven Tutorial, Apache Maven is a software project management and comprehension tool. Based on the concept of a project object model (POM), Maven can manage a project's build,
Learn Maven tutorial for beginners and professionals with topics on maven example, plugin, pom, dependency, eclipse, repository, web application, eclipse example, servlet, jsp, struts, hibernate, spring etc.
Yeah bro, sorry for the word but its stupid trying to do fix something that you havent learnt it. Its the same as me trying to fix a ciber security issue without learning the basics things from ciber security, doesnt make sense
So if you want to fix and issue, atleast learn how maven or gradle works, depeding which building enviroment you want to use
you should first be checking that the argument is a valid number
second, after it is determined it is a valid number, what kind of number
if you are accepting numbers that can have decimals, just automatically assume it is a double then
How can I achieve a command like this?
/cmd player c: eco give player 1000 m: &aCongrats, you got 1k
this doesnt work
you cannot LivingEntity shooter = (LivingEntity) arrow.getShooter() because getShooter returns the Source@2db596f0 from that message
I literally said another method if you scroll down a bit
oh!
oops!
lemme see 😄
thats so awk
im sorry! thanks then 😄
sorry, could you explain this? what am i checking specifically?
i see that theres a BlockProjectileSource in the docs, but im unsure of how to get that value
i dont know what id check to see if its a dispenser
the only things im seeing would check if something is an entity, but a block isnt an entity
Just cast to BlockProjectileSource
I think such a source is always a dispensed though? What other blocks fire projectiles
Okey so i migrate to maven but now how i can add jar to dependencies when the jar doesnt have maven
Cause im using this lib
https://www.spigotmc.org/resources/lib-armorequipevent.5478/
the getShooter that ive been using is giving me a projectilesource
if (!(arrow.getShooter() instanceof Entity))
cause then itd have to be a block
i see i see
cast what, e.getDamager()?
Shooter ?
Just use mfnalexs
Its on github
And it uses maven and Alex is amazing
@tender shard ^ youre amazing
Okey but how i can get the buildtools version with Bukkit and spigot ?
Google your question before asking it:
https://www.google.com/
For people who having the same problem you only need to download bungeecord through this link: https://ci.md-5.net/job/BungeeCord/ and add it to your java build path
you dont need maven or gradle
thnx Y2K to make me loose my time
should i use .getDamage() or .getFinalDamage() when checking to see if enough damage was dealt to kill a player
since ik getfinaldamage returns the damage value after damage reduction, but does it really matter?
Are you dumb lmao it's a standard and should just be used it's not a waste of time to learn a useful skill. The unwillingness to actually learn a useful skill is crazy
How would i create a custom tab in my server for players to see?
None of the tutorials online work; they are outdated.
Creating a invsee command
you could try seeing if chatgpt could help you. Some of the code from there doesn't work for me but it gets me started
getServer().broadcastMessage("if detected 3 ");
Player nearplayer = (Player) player.getNearbyEntities(6, 6, 6);```
i debugged it and it doesn't get into the if statement anyone know why?
Because that method returns a list
oh a list of players?
So would u j have to go thru the list and output the amount of player entities found in that list?
that's what im thinking
oh ok thanks
Could check .equals() or instanceof each value in the list and j output that amount
oh yeah that makes sense thanks
if you use the method in World you can pass a filter https://hub.spigotmc.org/javadocs/spigot/org/bukkit/World.html#getNearbyEntities(org.bukkit.Location,double,double,double,java.util.function.Predicate)
declaration: package: org.bukkit, interface: World
so what ive done so far is store the players in a list but how do i check in the if condition
What do you want to do
check if the nearby entities are players
Pass in a predicate that checks instanceof player and then check .isEmpty on the returned list
How can I achieve a command like this? Like actually get the c and m string. I know I need to use regex but I'm not familiar with regex.
/cmd player c: eco give player 1000 m: &aCongrats, you got 1k
How to properly stop Async Task? At now I'm calling task.cancel() when OnPluginDisable event is triggered but task is still running, what can I do to kill task???
generally the server automatically kills tasks
does Server wait unitl task execute its body? for example when task contains infinite loop, will server kill it?
yes server will kill it
when the server is stopping, it will give a small bit of time to allow plugins to save but it will force stuff to stop
you can use a library, I recommend TriumphGUI or whatever it's called
using apis?
yeah
Is there a way to stop chunk ticking of a specified chunk
cancel everything that happens in there probably
cancelling wont stop the chunk from ticking though
Why do you need to do that?
you cant then
I basically need to stop cactus from ticking in specific chunks
or unload it
block grow event
but not too sure if that actually stops it
this is not what I need
check if its cactus, if it is, stop it
I dont need to stop the stuff from growing I need to stop it from ticking
for lag reasons
basically /gamerule randomTickSpeed 0 but only in the chunk
Cactus doesn't cause much lag since it's handled by the random tick
it does if you have a huge player base spamming millions of cactus
*cancel*
Not really
The items can but not the cactus block itself
canceling the event wont stop the tick, but the action which most likely causes the lag
I've ran timings with cancelling the items
the ticking is what causes the lag
well the items lag more but even with them being not spawned
the ticking is still contributing alot
Could you send that timings report? I'd like to see it
okay
this is just on my test server
vanilla cactus
not vanilla cactus
with 162,000 cactus
so relatively small in comparison to real cactus farms on a live server
Could you use spark so we get a more detailed report
whats spark
Aikar's garbage collection flags: https://aikar.co/2018/07/02/tuning-the-jvm-g1gc-garbage-collector-flags-for-minecraft/
okay give me like 10 minutes to retest both vanilla and not vanilla
should i just use the spark command instead of timings
I'm trying to intercept the Tab Complete/Command Suggestions packet for vanilla commands to remove my username but it just keeps kicking me with this error: io.netty.channel.StacklessClosedChannelException (I have no idea what this means and I'm trying to avoid using ProtocolLib)
And how are you intercepting the packet
By checking if the packet is an instance of ClientboundCommandSuggestionsPacket in my listener.
Show your listener
The file is 130+ lines long.
I have a feeling you're causing an infinite loop or smth
Probably.
?paste just past the whole class then
All searches I've done on the error just show that I might be sending the packet at the wrong time.
The listener method is the same one that I'm using to modify chat log for clearing announcements etc.
That works fine, it's only this that breaks.
The error you sent just means the connection was closed while it was writing stuff
How do I avoid that?
all good things are 3 huh 
hey is there a way that say a player has vaults.5 vaults.10 and vaults.20 permission nodes, then I get the maximum one (vaults.20) and then put 20 as the value of a variable?
all I can think of is to just put if conditions for every number but even that would just catch the lowest one
and then you could split it at . and check for Math.max
hello, im having mental breakdowns during the use of md5's specialsource-maven plugin
it's configured so far correctly and it should work on compiling.. it just doesn't do anything
?paste your pom
how are you building
mvn clean install
try mvn clean package
what part doesnt work
ah, idk what else could cause it i dont use maven
😦
Sounds like you are just using the wrong jar
why
the pom you linked is fine
then I don't use the wrong jar
because the pom also includes the dependency which works fine
whats the full name of the final jar you are using?
there's no other jars than the main one and the source one
also this is a multimodule project so it should also compile in that jar
idk if that's the case though
weirdly enough though... https://www.spigotmc.org/threads/spigot-bungeecord-1-17-1-17-1.510208/
in here md5 mentioned the version 1.2.2 which i use
however
that version isn't even here
https://mvnrepository.com/artifact/net.md-5/SpecialSource
ymm
why is 1.2.2 even on my pc..
?paste
wot
guess I didnt see it
clean package
why are you building 1.18.2 with java 8?
because the project is supposed to work for lower versions as well
it doesn;t work like that
jt does
you build EACH module for it's relevant java version
well when i do that spigot doesn't load it unless it's java 17
the main plugin you build for 1.8
relevant modules you build for the correct java version they require
your internal API controls what classes are loaded depending on your server version
honestly imma try that cuz fuck it
wrong. it controls what are the used classes
all of those will be loaded
No, your API shoudl manage what classes are loaded via it's imports/class loading
you can't load ALL classes or your plugin will explode with a java version error
i mean, if they only require java 8 stuff then its totally fine
i use jdk17 and it compiles to java8+ bytecode
it should be fine
even java 17 didn't change anything
just tried
still didn't work
you can stop being a clown and just force everyone to update :)
It's a bit more than a version change
"you can stop making this cookie and force everyone to drink your tea"
that's my last plans for now because I don't want to move to the obfuscated version that fast
Just saying like
if you do a multi-java-version project
with multi-module and all
You're going to be doing a lot of dirty work
Some libraries don't like java 8
so you're either forced to use outdated versions, or to duplicate your code to handle both
Example: HikariCP
well it seems to not like java 17 as well
im not gonna use libs my project is a small lib
im getting java.lang.NullPointerException: Cannot read the array length because "elements" is null at java.util.List.of(List.java:1037) ~[?:?] at me.epic.epicpresenthunt.PresentClickListener.onInteract(PresentClickListener.java:32) ~[EpicPresentHunt.jar:?]l on https://paste.md-5.net/ozojipeban.cs and line 32 is List<Location> locations = List.of(pdc.get(plugin.getStorageKey(), DataType.LOCATION_ARRAY));, anyone know why
to alex's server to complain i go
don't put your hopes too high 💀
also still java 17 doesn't fix it
Yeah cactus isn't a huge problem here
It's not like every cactus or crop is ticket every single tick like tile entities are
I mean this is an extremely small sample on a single player server
Again it's not a problem
Things like mobs are 100 times more performance intensive
You should focus on those
have you seen the magnitudes of cactus farms on big servers
im talking like 10s of millions of cactus blocks
this is a sample of 100k
You can load in how much cactus you want. Other things will be more intensive
Cactus performance is negliable
You will be bottlenecked by other things before it becomes a problem
there are already lag measures for mobs and other things
cactus is the only thing left hence my problem
Cactus isn't a problem though
Obviously in my small sample it doesnt look like its a problem
it was just because you wanted to see it
I just needed to know if its possible to cancel chunk ticking of specific chunks, wether i do it or not and if its a bad idea or not is besides my question
reduce the chunk ticking size in your spigot.yml then
If you want to disable the chunk ticking other things will break
thats why i said specified chunk
I don't think its possible anyways so ill just try to find another solution
@eternal oxide i figured out the problem
You can make your own patch then
i was too blind to see it
it was?
i put the plugin inside <pluginManagment>
Originally if it was possible I was going to cancel the cactus from ticking and count the cactus in the chunk and manually calculate how much cactus you should get per hour
but ill try something else
That would be more intensive than just letting it tick
I really am blind
I did notice that and wondered. Didn;t know it made a difference as I had seen profiles in that block
The cactus counting would be done once
10 million cactus ticking vs 1 time adding a number is not more intensive lol
wild guessing: cant you just dig into NMS and disable ticking for certain blocks
actually
I think i can just disable cactus entirely and manually count the cactus on chunk load
yeah that should work
the only issue is finding the correct hopper to move it to
without chunk hoppers i mean
my current plugin tracks where the first cactus goes to and marks the hopper
then transfers all new cactus from that chunk to the hopper
No that's not how crop growth works
Every cactus doesn't tick
I think the best API for making GUI inventory https://github.com/stefvanschie/IF/
they tick everytime they need to get to the next crop stage
which there are 15
so yes that is how they work
They are not ticked every tick and thus the load is spread out over time
Causing no lag
i didnt say they tick every tick
if they ticked every time thatd be absurd
cactus does not need 15 crop stages though thats whats dumb
What you're worried about is a few random calls and a block update
It's not intesive what so ever. You're just wasting your time
anyone know why this event is not being called?
// Event Handler Code
@EventHandler(priority = EventPriority.LOWEST)
void scoreboardPlayerJoin(PlayerJoinEvent event) {
plugin.getLogger().warning("JOIN EVENT CALLED: " + event.getPlayer().getUniqueId());
boards.put(event.getPlayer().getUniqueId(),
ScoreboardBuilder.newBoard("kitpvp").title(displayHeader));
updateScoreboardFor(event.getPlayer());
}
// Event Register Code
public ServerModule(ServerPlugin plugin) {
this.plugin = plugin;
Bukkit.getPluginManager().registerEvents(this, plugin);
}
it does not show the line in console
it should be one of the first things called too
because of the lowest priority
right
lowest is called last iirc, highest is first
Listeners with lower priority are called first will listeners with higher priority are called last.
Listeners are called in following order: LOWEST -> LOW -> NORMAL -> HIGH -> HIGHEST -> MONITOR
i thought that was the other way round
Nope
Higher priority means their effect are more important so shpuld be done later so less plugins can affect them
If higher priorities are done first, then other plugins are able to undo modifications to the event that the higher priority listener did
ah makes sense
do note that monitor tagged event handlers may not change the event. It's a convention, but an important one
cuz well, they're supposed to 'monitor' and logging stuff
Hello, is there any chance that spigot has archived old resources?
old webpages?
yes
wdym by that
the old javadoc is available if search for something including version number
resources sorry
also u can still build the old servers using the --rev arg on buildtools
as in version or no longer on the site resources
might be that
Nope
That is something completely else
You won't find it on the net that's why I am asking if spigot have archived resources
no idea then, the staff might have old versions but probably wont give them out
I don't take might and probably as an answer
Are there any in depth explanations on how to do config files w spigot that anyone knows of?
only the staff can give you a full answer
Who should I contact?
yeah one sec
?support probably
🫶🫶
The home of Spigot a high performance, no lag customized CraftBukkit Minecraft server API, and BungeeCord, the cloud server proxy.
temporary solutions are the most permanent ones
Hey Guys, which version pdc support version?
1.14+
if u compile a nms plugin for one version, how likely is it to break if ran one major version later? I'm aware that recompiling has an almost 0% chance of working, but what is with compatability mode?
atleast 90%
Quick question, maybe someone happens to know right away: In BungeeCord, is the ServerDisconnectEvent called in all cases in which a player disconnects from a server? Including in cases in which also the PlayerDisconnectEvent , the ServerKickEvent , or the ServerSwitchEvent are called? I.e. is it sufficient to listen for the first event to detect cases in which a player disconnects from a server for whatever reason?
100% if you don't use the mappings. 95% chance to break otherwise. Sometimes the patch versions also break compatibility. 1.16 was a good example. Even 1.19 has plenty of stuff changed between .2 and .3. That's why we make version specific code.
guess its time to look into writing libraries lol
you can import multiple versions of nms and enable them based on server version
Any way to remove displayed name from an item in inventory ? I tried blank or space, but it shown something
you cant, best you can do is have it blank
No, you cannot remove that.
ok thanks
ive seen the code for that once, it was horrifying
if (Bukkit.getVersion().equals("1.19.2") trigger 1.19 module stuff
probably better to do a switch lol
yeah
can a variable refer to two BukkitRunnable objects at the same time?
so i would be able to do var.cancel(); and cancel both of them?
write a wrapper object
java references are (virtual) memory addresses. Therefore, one address can only point to two objects if those two objects are wrapped together in another, singular object.
This is also why we need to call .clone() on location or similar objects if we want to do math on them and need the original unchanged.
read variable = reference here
ShapedRecipe recipe11 = new ShapedRecipe(new ItemStack(modularbow)).shape(new String[]{"*&%","@#$","^+^"}).setIngredient('*', new RecipeChoice.ExactChoice(r6)).setIngredient('&',new RecipeChoice.ExactChoice(trident))
.setIngredient('%', new RecipeChoice.ExactChoice(r5)).setIngredient('@', new RecipeChoice.ExactChoice(r2)).setIngredient('#', new RecipeChoice.ExactChoice(bow)).setIngredient('$', new RecipeChoice.ExactChoice(r3))
.setIngredient('^', new RecipeChoice.ExactChoice(potion)).setIngredient('+', new RecipeChoice.ExactChoice(r7));
alright il try
why this did not work
How do I get protocollib 1.19?
Right now im receiving a ClassNotFoundException for WrappedChatComponent
<dependency>
<groupId>com.comphenix.protocol</groupId>
<artifactId>ProtocolLib</artifactId>
<version>4.8.0</version>
<scope>provided</scope>
</dependency>
not im unsure if this is the correct version or not
No way to get an instance of Player with someone offline ? Should I only use OfflinePlayer ??
If user is online, I can use Player instance and if not offlineplayer ? Is there something easiest to use for having not to check if player is online or not ?
thats the correct version iirc
also whats ur full stacktrace? pls paste it
?paste
hm
do u have the protocollib in ur plugins folder
cuz if ur using provided thats required
u cant
u have to say how u include it
or well
dont include it
if u say compile (?) it puts it into ur plugin
so do i just add the protocollib jar into my server than
if u say provided u say 'its in the plugins folder'
yea
best option too
buncha plugins use the same libraries
including them multiple times is stupid and just increases file size for no reason
iirc both have isOnline methods and u can get player from offlineplayer
If you need to get a player that is offline, then you'll have to use OfflinePlayer. Player is nullable so it will become null when the player leaves. You can use this to check if they are online or offline, but OfflinePlayer#isOnline() is also a thing.
Thanks for clarify
whats the event that handle when i put a water removes a flower?
i want to disable it
what is the default number of in-love ticks does the animal get when you feed them?
might be the physics event, or a event related to water flow
30 seconds. Thanks a lot!
the message indicates that its an issue with mojangs chat reporting stuff in the new versions.
im guessing its because the generated key no longer matches the name.
long as you allow disguises theres only two ways around it
- disabling chat reporting
- echoing messages via the server
This is due to the plugin not correctly setting the signature to the profile when you change the skin
but I didn't change the skin at all
same for name change
i changed the name fine
anything using a fake profile requires you copy the signature
yes
then how
yes how o.o
one sec I'll have to open my ide
ServerPlayer nmsPlayerToAdd = new ServerPlayer(nmsPlayer.server, nmsLevel, newGameProfile, nmsPlayer.getProfilePublicKey());```
hmm?
You have to copy the getProfilePublicKey() or you have the issue you found
i just modify the name with reflections
yes
yes
i just realized i forgot again how to cast from api to nms 😓
uh thats how to add remapped
what im talking about is casting BukkitPlayer to nmsPlayer
isnt it just normal casting
no
nmsPlayer?
getHandle 
for utils i would rethrow the exceptions
FileConfiguration pdata = PlayerData.getInstance().getData();
String c = String.format("%s.Crates."+name, p.getUniqueId());
pdata.set(c, pdata.getInt(c)+amt);
PlayerData.getInstance().saveData();
i just change the name with reflections
I want it to just save as a straight number
you dont save it
PlayerData.getInstance().saveData();
I am, it does save to the file
its just, when I run it and use the amount of to
*2
My code changes skin and name so it uses a new profile
it sets it as '02'
whats the copyright on that
and if ran again goes to 04 and so forth
free to use
kthx
and whats it meant to do
hold on i see the issue
same for mine
its how im saving
except it changes it when needed only
I'd make the class final instead of the methods
with a private constructor
no point in making final methods in utility class, there's no hierarchy
~~I wonder if anyone ever made an NMS abstraction that provides all the methods but in a universal format ~~nvm bukkit is a thing
yea but it aint complete or we wouldnt need nms
Hey im coding an gui plugin. so i have an enum with entrys for head ids out of the headdatabase api.
I try to fetch entrys out of the enum and check if they are exists. if not set the unknown head. But the enum says every time when i check if the value is "null" that this is everytime null
ServerTypes serviceType = ServerTypes.valueOf(service.getServiceId().getTaskName()) != null ? ServerTypes.valueOf(service.getServiceId().getTaskName()) : ServerTypes.UNKNOWN;
This is the line with the error. But idk how to check otherwise the valueOf is null
The service ist the cloudnet service, idk if this is needed
so i must throw with exception?
Catch them
ah okay thanks :D
bruh what is this indentation
Mild 200 character indentation
It's tabs. 💀
Why 2 doe
why in the hecc does it say "unexpected return value"?
it has to return a bool and its returning a bool
am I going crazy?
cuz youre returning as a lambda
youre not returning something outside of the lambda
welcome to async programming
oh for f-
make it return a CompletableFuture<Boolean> or use callbacks whatever
If you want something asynchronous to return a value, you'll want to look into CFs, yeah
concurrency is a bitch
but can be super fun with CFs if you know how to use them
true
There's nothing more satisfying than chaining together CFs lol
you mean like multiple instances? .. never done that tho
i usually let all my stuff run sync and then wrap one cf around it
No, with thenCompose(), thenApply(), etc.
ah, well its not that hard
Will pull an example
dysonFan.connect()
.thenCompose(DysonFan::requestEnvironmentalSensorData)
.thenAccept(data -> {
double temperature = data.getTemperature(); // Measured in Kelvin
int relativeHumidity = data.getRelativeHumidity(); // Measured as a percentage from 0 - 100%
int particles = data.getParticles(); // The amount of particles in the air, from 0 - 9999
int volatileCompounds = data.getVolatileCompounds(); // The amount of volatile particles in the air, from 0 - 9999, or -1 if initializing
SleepTimer sleepTimer = data.getSleepTimer(); // The active sleep timer, or SleepTimer.OFF if none
})```
This is my Dyson fan library
mhmm
:>
i never heard of thenCompose lol
It basically accepts the result of the last future and returns a new CompletableFuture
kinda like map
Sort of but not quite. thenApply() is more like map()
Think of thenApply() as sync, thenCompose() as async
thenApply() converts from T to U, thenCompose() converts from T to CompletableFuture<U>
:o
thenCompose is more like a flatMap
never understood flatmap so get out
basically
<T,R> Stuff<R> flatMap(Function<T,Stuff<R>> f){
return f.apply(someValue);
}
i don’t know if it makes it easier to understand, but under some circumstances a flatMap takes the function argument, invokes it on some value and returns the result, but not always (for instance you have Optional::flatMap which only does it if there’s a present value)
it "unwraps nested streams" or sth like that
let me guess, conclure was typing on phone again
Well, a finer name for the pattern is monad Ig
i think ii heard of that
Yeah “a monad x is just a monoid in the category of endofunctors for x” or sth iirc 
\😵💫
Hey, do you know if when noone is connected to a server some classes can be emptied ?
bad idea imo
Mind elaborating?
Cause I have a command that's working when i'm connecting for the 1st time, I disconnect and then it doesn't work
Sounds like a bug more like, mind sharing some code?
well all player related objects are either deleted or put into the corresponding offlineplayer
And as I don't want to use a DataBase for now, i was wondering if the private attributes were deleted
I'll show you
if u dont have handling for savving data it gets deleted when disconnecting
but conclure is right that this is a bit ambiguous
public class Main extends JavaPlugin {
private static FServer fserver = new FServer();
@Override
public void onEnable(){
System.out.println("Le plugin de faction est lancé ! :)");
getServer().getPluginManager().registerEvents(new PluginListeners(), this);
getCommand("sell").setExecutor(new Shop());
getCommand("bal").setExecutor(new Shop());
getCommand("fPlayers").setExecutor(new FCommands());
}
public static FServer getFServer() {
return fserver;
}
}```
this is my main
public class FServer {
private Set<FPlayer> fplayers = new HashSet<>();
public void addFPlayer(FPlayer fPlayer) {
fplayers.add(fPlayer);
}
public boolean firstConnexion(Player player) {
for (FPlayer fplayer: this.fplayers) {
if (fplayer.getPlayer().getUniqueId().equals(player.getUniqueId())) {
return false;
}
}
return true;
}
public FPlayer getFPlayer(UUID uuid) {
for (FPlayer fPlayer: this.fplayers) {
if (fPlayer.getUUID()==uuid) {
return fPlayer;
}
}
return null;
}
public Set<FPlayer> getFPlayers() {
return this.fplayers;
}
}
FServer class
?paste
use that
public class Shop implements CommandExecutor {
public Set<ItemShop> shopBlocks = new HashSet<ItemShop>();
private FServer fServer = Main.getFServer();
public Shop() {
this.shopBlocks.add(new ItemShop(new ItemStack(Material.IRON_AXE, 1), 100, 20));
}
@Override
public boolean onCommand(CommandSender sender, Command cmd, String msg, String[] args) {
if (!(sender instanceof Player)) {
return false;
}
switch (cmd.getName()) {
case "bal":
if (args.length > 0) bal((Player) sender, args[0]);
else bal((Player) sender, "");
break;
}
return false;
}
public void bal(Player sender, String name) {
int bal = -1;
String targetedName = "";
if (name=="") {
FPlayer fSender = this.fServer.getFPlayer(sender.getUniqueId());
System.out.println("Données corrompues");
bal = fSender.getBalance();
targetedName = fSender.getDisplayName();
} else {
for (FPlayer fPlayer: fServer.getFPlayers()) {
if (fPlayer.getDisplayName() == name) {
bal = fPlayer.getBalance();
targetedName = fPlayer.getDisplayName();
break;
}
}
}
if (bal == -1) {
sender.sendMessage("§cIl n'y a pas de joueurs s'appelant ainsi.");
} else {
sender.sendMessage("§2Argent de " + targetedName + ": §7" + bal + "$");
}
}
}```
And this is my Shop class
I was just trying to run the /bal command
I've done messy stuff in order to see if I could avoid to get the errors haha but it should be understandable i guess
k so i'll have to use DataBase rn in order to continue ?
or writing it into a file but 🤮
not necessarily, u could save it in the player pdc
but the player object itself gets deleted when the player leaves the server
Could you give us a TLDR of what you are attempting to do?
I highly doubt that either step is necessary
TLDR ? English is not my native langage sorry
Too long; didn't read
Too Long; Didn't Read
The issue I assume is that you are using identity comparision on non-interned strings
Oh, well i'm creating a HashSet of the players that has already joined my Server, and when someone uses the /bal command (which tells how much money they got), i'm going throught the Set of players looking for him, and returning the money he has
You should use Obeject.equals() for string comparisions
The thing is that when I disco/reco it's null
Why not just use a Map<UUID, BigInteger>?
Why that is the case is a long story so just accept it as fact. One day you'll understand
Because I won't create as many maps as my players have characteristics (idk if it's correct to say this)
Example:
if (name.equals("")) { // <-- here
FPlayer fSender = this.fServer.getFPlayer(sender.getUniqueId());
System.out.println("Données corrompues");
bal = fSender.getBalance();
targetedName = fSender.getDisplayName();
} else {
for (FPlayer fPlayer: fServer.getFPlayers()) {
if (fPlayer.getDisplayName().equals(name)) { // <-- and here
bal = fPlayer.getBalance();
targetedName = fPlayer.getDisplayName();
break;
}
}
}
If i add experience point, jobs etc etc i won't add as much maps, should I ?
Oh, well yea. A proper object would be better in that case.
I know what's the difference, i've studied it in class, but I don't think it's the problem, as it worked perfectly before disconnecting ?
That is actually the case
Common symptom of non-interned strings: They seem interned until they are not
Are you trying to run the command in console? Or are you rejoining and trying to run the command again as a player?
there's no profile public key on 1_19_R2
After editing, it still doesn't work
I'm running it as a player
In your case if (fPlayer.getUUID()==uuid) { in FServer:getFPlayer(UUID) would also be a blunder and probably is the actual root cause of your issue.
Yes, but are you leaving and rejoining the server?
It was the problem, tysm <3
Yes I was
And do you guys know if I have to pay to implement DataBases or can I get some basic access to it freely ?
what did you mean by player pdc btw ?
persistent data container
stores anything and is uniquely identified for each plugin storing data
look it up
do you have to init it or smth?
What is the best and easiest database for storing LARGE amount of playerdata
anyone know off the top of their heads what mojang changed about 1.19.3 that broke custom icons I was using for menus?
Yeah
There were a few changes in the snapshots. Version got bumped to 12, then a bunch of texture loading changes along with a new atlas config file section. https://www.minecraft.net/en-us/article/minecraft-snapshot-22w46a
That mostly applies to blocks and textures, but maybe it screwed something up for you.
Uh ill check but real quick is it not backwards compatible?
Doubt it, but cannot confirm.
Ah i think i see the issue
Don't think it's backwards compatible, no, but the short of it is that any assets outside of ../models and ../textures aren't loaded unless specified in a texture atlas
I mean if I make that texture atlas it should still be backwards compatible right
Don't think that 1.19.2 clients will understand a pack version < 1.19.3's version
I mean, in theory, so long as the structure hasn't changed and the only addition is a config file, then anything below 1.19.3 would likely ignore it.
that was my thinking, I'm trying to find out how I can make / generate a texture atlas
Choco has a point though. I'm not sure if the game would be able to parse things correctly with a newer pack version on an older version of the game.
You can use older resourcepacks on newer versions, but I don't think you can do it the other way around.
Then again, I haven't tested that. I don't have a reason to go back to older versions of the game.
historically you have been able to run resource packs from future versions on old versions
boy I sure wish mojang provided an example atlas to see how they can work
also I sure hope you can have multiple atlases on a single resource pack or else this is going to further complicate the merging process
hey what's up fellow kids, anyone have an atlas configuration file I can copy look at?
Bump
Hello how can i get vanilla name of a minecraft item in 1.19.2 like "String name = nmsStack.getItem().a(nmsStack);"? this method doesn't exist in 1.19.2 or any newer version and i can't find anything on google
is messing with the chat format possible to cancel mojang encryption
I recommend taking a look at mojmap
Is this related to chat signing or something else?
is it possible to get an event after one event?
basically i can only access BlockBreakEvent but I need to handle BlockDropItemEvent
hello guys
If you have a question, please just ask it. Don't look for staff or topic experts. Don't ask to ask or ask if people are awake or available. Just ask the question to the channel straight out, and wait patiently for a reply. Make sure you use the right channel regarding the topic of your question. Create a thread in case the channel is already in use!
I have a question so if I put seperatly an block x and a block z loop in a async task would that be more effective ?
You can't do that safely unless you work off a chunk snapshot
very good thx
oh ok thx
thx
async better /j
hmm I have a question, im working on some survival games, is it better practice if I register my own events and fire them from other events or should I just execute my code from within the event? eg if someone has the kit assassin and eats an apple I want some stuff to happen, is it better practice if I do checks within PlayerItemConsumeEvent and register something such as AssassinTriggerAbilityEvent and do custom logic there or is it better practice to just do it from the PlayerItemConsumeEvent?
Hey, could someone explain me what's the 'msg' field in this command ?
public boolean onCommand(CommandSender sender, Command cmd, String msg, String[] args) {
But this is the 'cmd' field, isn't it ?
for instance if i'm runnin /giveApple me 2
Well, i don't get something then
i've used this until now
@Override
public boolean onCommand(CommandSender sender, Command cmd, String msg, String[] args) {
if (!(sender instanceof Player)) {
return false;
}
switch (cmd.getName()) {
case "bal":
if (args.length > 0) bal((Player) sender, args[0]);
else bal((Player) sender, "");
break;
case "pay":
break;
}
return false;
}```
and while running /bal
it works :')
i haven't started to code it yet
that's a good question. Personally I'm lazy and would just do the ItemConsumeEvent.
anyone have documentation on the atlasses that are new with 1.19.3?
it's giving me a hard time
I'll read more doc, but do you suggest i should edit it like this ?:
@Override
public boolean onCommand(CommandSender sender, Command cmd, String msg, String[] args) {
if (!(sender instanceof Player)) {
return false;
}
switch (msg) {
case "bal":
if (args.length > 0) bal((Player) sender, args[0]);
else bal((Player) sender, "");
break;
case "pay":
break;
}
return false;
}```
K, tysm for your help !
guys you like nms?
even the microsoft documentation doesn't seem to mention atlasses, this is some bs
cuz like I switched from 1.8 to 1.19 and there is no nms package
?bootstrap are you aware of the bundler?
Bootstrap Jar
The main spigot-1.18.jar is now a bootstrap jar which contains all libraries. You cannot directly depend on this jar. You should depend on Spigot/Spigot-API/target/spigot-api-1.18-R0.1-SNAPSHOT-shaded.jar, or the entire contents of the bundler directory from your server, or use a dependency manager such as Maven or Gradle to handle this automatically.
Please read the release notes for further information: https://www.spigotmc.org/threads/9-years-of-spigotmc-spigot-bungeecord-1-18-1-18-1-release.534760/#post-4305163
how do you guys add a player to the tab in 1_19_R2
(also, you should use mojmap and not NMS directly)
friend talked about that but how
arcane magic?
ClientboundPlayerInfoPacket
that's removed
maybe UpdateInfo one you mean?
?
it was there in 1.19.2, not looked in .3
yes it was
Sorry, but I am not someone that has any knowledge of using mojmap in standard setups. For nonstandard setups though ...
k i am going to google it
Can't you use Recaf to search what the replacement could be?
Well then, obscure magic it is...
And uh, unless you are willing to use something ontop of JDT such as an alternate buildchain (that may translate to JDT) or a JDT plugin (which you'd need to develop yourself), it's a big no
It's easier to just use eclipse's great maven integration through m2eclipse
Another question, what's -in ur opinion- the best way to define errors to be sent ?
I mean, when I have to send a lot of times the message 'User not found' to a player, should I define some errors in an enum rather than in an interface ? I've seen both on the internet
ClientboundPlayerInfoUpdatePacket
This is the code I have currently to use slimewords to make a map reset system
Would this work
Interfaces are very rare.
At least for that purpose
// Check if the game has ended
if (gameHasEnded()) {
// Get a list of all online players in the current world
List<Player> players = Bukkit.getOnlinePlayers();
// Iterate over the list of players and teleport each one to the lobby
Location lobby = new Location(Bukkit.getWorld("lobby"), 0, 64, 0);
for (Player player : players) {
player.teleport(lobby);
}
// Unload the current world
Bukkit.unloadWorld(Bukkit.getWorld("currentworld"), false);
// Delete the current world folder
File worldFolder = new File("/path/to/world/folder");
worldFolder.delete();
// Import the template world from the plugin folder
WorldCreator creator = new WorldCreator("templateworld");
creator.copyFrom(new File("/path/to/template/world"));
World world = Bukkit.createWorld(creator);
// Load the imported template world
world.load();
}
I'm relatively new to bukkit
And slimeworlss
I've been getting an error on that
That should compile.
Yea meant that
So best fix is to extend as player
getOnlinePlayers doesnt that return a Collection<? extends Player>?
K
it does
I'd rather kill myself than accept that generics would cause that sort of issues
new ArrayList<>(Bukkit.getOnlinePlayers());
have fun
It shouldn't compile. You can't assign a method result of Collection to a List (without a cast)
Ah
I haven't put this in an ide
I just used notepad
Cauee I'm on my phone
Sudo code
Psuedocode
How might I create a folder with a template world?
Would it be like
File.create
Or smth
mkdirs
Folder = createDirectories/mkdirs depending on what you use
Kk
Hi, I tried plugin buildsystem which can be obtained from github but it shows me there
- What went wrong:
Execution failed for task ':buildSrc:compileKotlin'.
A failure occurred while executing org.jetbrains.kotlin.compilerRunner.GradleCompilerRunnerWithWorkers$GradleKotlinCompilerWorkAction
https://github.com/Trichtern/BuildSystem/releases/tag/2.20.6
And don't expect the plugin dir to be present - common noob mistake
Help Please
stop self adv
jd-gui > recaf /j
I have little involvement over Recaf outside of emotional support
Wait can I not put the world folder inside plugin resources
And then link the path from there
Uh sorta? But no, don't do that if you have no experience with ZipInputStream
Yea
Please
File f = new File(plugin.getDataFolder() + "/");
if(!f.exists())
f.mkdir(); ```
Would that work
Would this work? In order to be able to answer that I would need to know what you want and what you do not want. Furthermore I would need to know all parameters of your environment, including operating system and installed userpace applications.
Since evidently I cannot know that since I am not a fortune teller and do not have the patience nor time to caclulate all possible outcomes - including all quantum fluxiations that could cause charged particles to hit the computer's working memory - it is not possible to answer this question without guess work.
The degree of aforementioned guess work depends on how many parameters are already known and how many parameters are safe to ignore. In this circumstance it should be rather safe ignore charged particles, as well as the operating system (although I've seen quite a few people using the wrong tool for the wrong task, so I shouldn't be assuming too much too early).
Ignoring charged particles is only something a fool would perform and while it having an effect on the outcome is rather slim - given enough time it is almost certain. Needless to say that the so-called technology of "Error-correcting-code" (ECC) is also rather pointless here too, while it certainly reduces the aforementioned chances drastically - they will never be 0. In the event of a solar storm a fatal failure is almost to be exepected. If it isn't the memory that breaks it is the power grid that will fail. Even if you use something that is worthy of being called an uninterruptible power supply (UPS), it would fail eventually anyways. If it isn't the power supply then it is the test of time.
Nothing, nothing truly escapes the heat death of the universe. Not even your puny question.
Thus the answer is a clear no with all currently known parameters about the laws of physics, and perhaps everything else too.
I know, underwhelming - you expected something more cheering - but really, what is the point of it all? There is no point. Go outside; enjoy life.
Nice
I had to do it eventually. this was just the final straw
Nah I wrote it on my own - copypasta style
Map reset system, Linux Ubuntu 22.0, by kicking all players, unloading the world deleting the world importing a template then loading it back in and marked as player reeady
I have pterodactyl panel
I would've written a longer nonsensical text but alas discord has a message size limitation
Chunk it into 2 messages
Eh, this suffices. Back in my IRC days I had to contend with ~220 characters
I never even used an irc
Same
Alas being a youngling
is that so?
yes, did you not hear what I just said?
let me try again, NOT EVEN A REAL IRC USER
The only real IRC client is irssi - and perhaps sic
hexchat
Big security vuln
Well
live fast die young
It can leak your system specs
I answered your questio
buddy I share my specs every opportunity I get
I even share pictures
Crazy
I love flexing specs
You do realize my question was purely rhetorical and one out of spite
Ah
If I had any knowledge about slimeworld I might answer, but I do not
I wonder if the other devs that rely on resource packs are also waiting for someone else to figure out atlases for them lol
Good thing I don't use resource packs I suppose
Resource packs are semi nice but overused sometimes for trivial reasons
Whats an atlas
Is it like some custom model thing
Anyone able to tell me the differences between the spawnParticle method available through world and the one available through player?
If you are spawning more than one particle at one place, is it generally more efficient to run through the player list to get all the nearby players and just use the spawnParticle method on all of them instead of spawning a particle using world?
Also ping me
the main difference is that the one available through player will spawn the particles at the player
where as the one through world will spawn them at a location you specify
I know that
then not sure why you asked if you already knew
But every time you use world spawnParticle, is it checking through every player to see who it should send a packet to?
Doesn’t the player one only display those particles for that player?
If I use world spawn particle 100 times, is it running the player list 100 times to check for people being within render distance of the particle?
Compared to myself running the player list once and adding all those nearby players to a list which I think iterate through with the player spawnParticle method
server automatically sends a packet to whoever is nearby on entity spawning. Even if you were to spawn it at a player, if another player is nearby they would still get an entity spawn packet
packets are not something you really should worry about
I mean I should when I’m sending 100 packets a tick to 100 players
It’s like 10000 extra packets
its not
and no it isn't running through the player list
it checks the nearby chunks of where entities were spawned
if no players nearby then no it won't send a packet
if there is, it only sends it to the players that are nearby not everyone
unless everyone is near it, but it isn't extra packets
because without the packet, obviously a player won't see it spawned
but packets are small in size, and unless you have player with shitty internet to begin with, like latency of 500+ it won't really have much affect
I mean I get server lag when I spawn lots of particles
No.
yes
Ticks per second goes down
My own screen lags, sure
But /tps shows a drop
Too
Which is the actual problem
if your TPS goes down, then probably should look into why your server is lagging on particle entities
But it’s not the packets which cause it, you think?
no
Kk
Maybe I could just send the actual packets
times that by 1000 and we are only at 56kb
56kb is something a dialup modem can handle
so, no odds are the server is lagging on the entities itself and not the packets needing to be sent
So when you spawn a particle you create a particle entity
also packets are queue as well, so it isn't like all 1000 packets get sent at the same time
so that isn't 56kb all at once, that would be 56kb spread out over a few hundred milliseconds
this would be more optimal if you don't actually need the server to track the entity
Usage: !verify <forums username>
glad I was able to clear up or clarify where your issue is most likely at and not where you thought it was at 😉
Yes you’re very smart
Now answer my next question
How much more taxing do you think it will be to make every projectile a trident
I hear they send entity updates 8x the frequency of arrows