#help-development
1 messages Β· Page 1826 of 1
it will basically just loop thru every class and try to find the class which derives their base class
since its expected you wont have a spring library shaded inside that expansion
is it some one from norway that want to help me to learn java and make plugins?
im from Sweden
Here are some links to get you started on learning Java:
- https://www.codecademy.com/learn/learn-java
- https://www.sololearn.com/learning/1068
- https://www.learnjavaonline.org/
- https://programmingbydoing.com/
- https://docs.oracle.com/javase/tutorial/java/index.html
The last one is the only official one, however some of those concepts assume that you already know a bit about programming.
I'm here too if you need any help
thx
The separate jar will do this? how do you know it will do that after the plugin loaded though
wym?
so, i guess you have two jars: actual plugin and papi extension
well you dont, but your expansion jar should (hopefully) be operating lazily
Or do i miss something
yeah thats it
i assume it will get put in the plugins folder
But i have no idea how loading plugins works
well yeah idk also
might be the case papi loads the expansions when it bootstrap itself
Make your papi extension a plugin too
but instantiates the classes once startup has taken place
in plugin yml make it depend on your main plugin
actually let me go and look at papi source
Oh wait
I tried cant extend 2 classes
i could do another class ig
the tutorial didnt have any extension of javaplugin though
Oh i didnt think about extensions you download from papi ecloud
oh geegeetom
it tries to load on ServerLoadEvent
if ServerLoadEvent is not present (like the class, due to legacy version) then it will just schedule a task to run once startup has taken place
and that event ftr, fires once the startup has taken place
ServerLoadEvent is when startup is complete?
yes
ah ok
or after reload
ty
basically you're safe :p
i am too lazy to make my plugin not break on /reload
so i just give a huge red message
I mean I just implement whatever I can do as a plugin maintainer in onDisable
but if it still breaks
Idc
yeah i have ondisable all good for normal server stop
but my onenable is set up for nobody being online
Why
so no one gets put in their faction
It's really not hard
its honestly such a easy fix
And usually if a plugin isn't reload safe it means it's not doing something on shutdown that it should be
nah just startup for me
if people relog it works
i just dont do anything with online players on enable
Why
Making a plugin reload safe is a huge plus
Easier testing
You can hotswap on a live server to update a plugin without restarting and players won't notice a thing
It has saved my ass so many times
yea ill add it to my list
IllegalStateException: zip file closed goes brrr
should I use MySQL for player auctions
Use what you want
sql is a standart
Because MySQL is much heavier and slower
me using flat file storage
one mc server
It scales better and can be multithreaded though
And much efficient when you operate on lots of data smh
Yeah use sqlite
It is not hard to maintain both
thank you
Be careful though
Do I need good skills of MySQL btw
Make sure you don't allow stuff like 2 players buying the same item at the same time and both getting it
Yes you should be good with mysql
It's not hard to learn though
Learn the basics
yo what is a good way of getting rid of the long string of location to just the location: i wanna convert from what shown in the image to just simple ints. is that possible?
the hardest part of database class was making an ER diagram
sql is relatively simple
Hmm yes
Wat
Are you not able to just like
the basics should be easy right
Im following a tutorial to better my skills right now
ok thanks
but its from 2017
l.getWorld().getName() + " " + l.getX() + " " + l.getY() + " " + l.getZ()
as long as it works its fine
I used Netbeans in school
1970
@ivory sleet https://paste.md-5.net/anozowibup.java is the hcfplus variable in this going to stay assigned after canregister is called?
Can someone tell me the path to my main from here, I've tried everything and I can't get it to work lol. Main class is AutoMiner
I've tried:
net.test.autominer.AutoMiner
java.net.test.autominer.AutoMiner
https://i.imgur.com/sYfm2fu.png
Why wouldn't it
For the plugin.yml? Should be net.test.autominer.AutoMiner assuming that is your plugin main class
I tried that and it did not work lol
i forgot how java worked for a sec wasnt sure if it would have that variable if i never instantiate an object of the class
Send plugin.yml
main: test.autominer.AutoMiner
there ya go
that's what it was, it didn't work lol
You forgot net.
I've tried so many different things π
net.test.autominer.AutoMiner
sec, I think I tried that, I've been messing with it for a minute
Make sure its spelled correctly and with the correct capital and lowercase letters
org.bukkit.plugin.InvalidPluginException: Cannot find main class `net.test.autominer.AutoMiner'
I've even gone up the hierarchy:
net.test.autominer.AutoMiner
java.net.test.autominer.AutoMiner
main.java.net.test.autominer.AutoMiner
Checking my build settings now
Maybe it's something related to that
Hey guys, so I have made a custom item, given it a custom recipe, and added an event listener for right click. Is there any way to make the item available to /give? It doesn't seem to be "registered" in any way
Do you have more files named AutoMiner by any chance?
It was my build settings, thank you for the help!
Alright, no problem
Make your own give command
You could make your custom items just variations of "real" items, ex: if it has a specific durability do x
Hmmm thats true, but then to get said item I would need to do some weird /give stick[durability=1000] <- psueduocode
If I'm not mistaken, you won't be able to add it to /give any other way
totally fair, I want it to be a craft only item anyway and quite expensive
was just curious =]
This isn't showing all the classes for 1.17.1 for some reason
Lets say I have a command
/Test
You run it and it sends you a message of whatever num is set to, how would I make it so it adds 1 to num every time the command is ran and it wont reset.
store the number in a variable, then when the command is ran, increment the variable
for some reason when i try to cancel EntityAirChangeEvent it doesnt work
send code
use the maven repo π
?maven
The home of Spigot a high performance, no lag customized CraftBukkit Minecraft server API, and BungeeCord, the cloud server proxy.
neat i just guessed that would be a command
That doesn't include NMS?
use buildtools for nms
I'm new to this can you describe what I would need to do please?
I did
run buildtools for your version
Learn Java, or any programming language to teach you the basics
I ran Buildtools
then use this but change spigot-api to just spigot
got myself the jar, put it in the /lib/ folder
noono
ah
make sure youve run it for the proper version
With hikari, do I need to release connections back to the pool somehow?
your websites kinda clean btw
does that exist in 1.17.1?
how do people usually do that on here, should i just paste the code into chat or use a link
?paste
I need to use database to store basic datas, what is the most basic option?
oooh thats remapped stuff
ngl im not sure how to do that in newer version
Dangit
yeah but you need a maven plugin to "de-map" it
to transform it back into obfuscated nms
dangit
but idk which plugin it is
What do you mean?
im asking here since the skript api thing is dead as a dessert: do i need the curly braces for the variable?
to get the variable ofc
You want to obfuscate your files to Mojang mappings?
no reobfuscate the remapped nms usage
^^
yeah that should work
is there any method or better away to get to catch the entity the player is seeing?
raytrace
EntityAirChangeEvent event.setCancelled(true) not working
yes but how i detect if ray trace hit an entity?
maven special sources is only generating 3 jars, anyone know why/
i need the remapped.jar, not the remapped-obf.jar
is there a way using nms to detect if a ray3d hit a bouding box
@minor garnet im pretty sure you can just use World#rayTraceEntities
I'm trying to work with older versions
ah
anyone?
and this is what? i cant really see it
it was a video, but the author deleted it, basically it was where the player aimed at the player's '' hitbox '' and when it hit the hitbox this particle appeared
I would do something similar to be able to detect the bouding box and get the player
I would use this for two projects, one for weapons and one for ground loot
?paste
i dont have any method to show π‘
what exactly do you did
declaration: package: org.bukkit.util, class: RayTraceResult
..
yea i proposed this too ^
im trying using nms classes, vec3d and bouding box
How would I go about getting all chunks in a cuboid?
where could i see the code internal?
@minor garnet i have used this in the past to achieve something similar https://paste.md-5.net/vaponisiwi.cs
what's in that picture?
i noticed that sqlite update statements (prepared statements) are a lot slower in 1.18.1 in my plugin, does anyone know what might have changed or steps i should take to rewrite my code?
anyone know how to change the build location of specialsources?
how could i detect if the player deleted an item using the creative mode
Do you have autoCommit on
How can I make a blaze immune to projectile damage?
thanks for the response.
ya, while i was waiting for a response i started playing around with autocommit. so far it seems like that's the cause of the slowdown.
for whatever reason autocommit is just a lot slower now than it was in 1.16.X.
Can you set max health/health of offline players or nah?
Autocommit has always been slow
Just disable it entirely and commit every 5 minutes or so, that's what I do
SQLite with autocommit off is blazing fast
i wrote a startTransaction() and endTransaction() as my solution.
start just sets autocommit to false.
end commits then sets autocommit back to true.
so i'm using autocommit for one-off updates/inserts, then using the new methods whenever i'm doing lots of statements in a row.
You can just do commit() you know
Hey π
Is possible to handle spaces between arguments in command?
For example: /command arg arg
there are an existing api that supports send titles with 1.12-1.18?
ig no one supports 1.18
player#sendTitle()
searching for an api ifs posibble
i didn't mean that
spigot has a title api ?
Yes
2 of them right there, i recommend not using the deprecated one
I mean yeah its possible but why?
what differences?
i need it for my broadcast command
can someone help me, i made a thread but no one responded π₯²
i can see that the deprecated one is the same as 1.8 so if i use it then 1.8 and 1.18 versions will work with the title?
one of them (the deprecated one) is likely to be removed soon, so save yourself some time and don't use it
Spigot aims to be backwards compatible. It's deprecated but I don't see a reason for it to be removed anytime soon
i see, ok then
Oh you want spaces to count as one arg?
yeah
Ok is it the last argument?
yeah, now i have this String.join(" ", args)
As long as the text is the last argument all you have to do is loop from the starting arg to the length of args - 1
and add each arg to a string with a space between each arg
not working
/command arg arg = still 2 args
So if your text starts at args[1] you could do something like
for (int x = 1; x < args.length;x++) {
if (x == 1) text = args[x];
else text += " " + args[x];
}
yeah i know, but i need more than one space
for example
/command text with two spaces, now with one space
unfortunately I don't think there is really an easy fix for that
you could have the command expect " text to be in quotes"
nope
darn
I don't think that solves anything it would still not count the extra spaces as args
only solution i can think of is using _ for space
so /command text text__with__two__spaces
And then just grab the arg and do String.replace("_", " ")
but when i want to send message this is character _?
\_?
you wont get far with it. you only get the already modified arg strings
you will have to go deeper.
maybe the commandpreprocessevent will give you the exact string after the command
Yeah actually there is a getMessage method in that event
So maybe you could store the current comand message in a yml and then onCommand for each player get that message and use it
but i need to handle command from console, but preprocessevent is only for players
what are you actually trying to do with the command?
broadcast a message with multiple spaces in-between words
Canβt you just join all the args to get the message you want
spigot/bukkit doesn't support "" as an arg does it? hmm
No becasue they want to support multiple spaces
will not lead to the goal. the args are splitted before by " "
you could perhaps do some sort of syntax like _#_ where # is the number of spaces you want then parse those args to composite your message together
but i need it user friendly, i think replacing chars isnt user friendly
but that's really nonsensical
ya
idk, i think using _ and \_ for _ literals is probably the best option
Can someone please help i don't know where i am going wrong with this
Why does this:
String id = String.valueOf(auction.getAuction().getString("auctions." + playerId + ".itemID."));
System.out.println("ID: " + id);
Output this:
[AtlanticPrisons] [STDOUT] ID: MemorySection[path='auctions.f86f501a-0c94-4aa6-8753-e96373406046.itemID', root='YamlConfiguration']
Maybe if you really want it to be user freindly you can use the preproccess event for players and the _ method for console
Try a command framework that hooks brigadier
very good idea
so I was looking into making custom blocks, and I made my own model that works on the blocks, however when I try to assign it to a special block using:
{"predicate": {"custom_model_data":1234567}, "model": "block/creeper_totem_pole"} it doesn't seem to work. I tried to use meta.setCustomModelData(1234567); and it doesn't seem to do anything, any ideas?
Blocks do not support custom model data
oh, how can I give a block a custom data value?
The only way to make custom block textures is to replace states of existing blocks
Noteblocks and mushroom blocks are the common choice
so I cant have a new block?
A brand new block, no
You can also use armor stands or spawners, but that is much laggier
Noteblocks are generally the way to go
dam that sucks
Mhmm
I don't wanna change any existing block, ill have to figure something out
Origin realms has shown that tripwire and leaves can work too
How could I make my sources jar include the sources of libraries I depend on?
Barrier with an armor stand inside (will cause lag if used a lot)
I've got RedLib, which shades RedCommands
Yeah the armorstand or spawner method works great for like, custom machines
But not building blocks
I want people to be able to view docs of RedCommands in their IDE if they are depending on RedLib
But currently that's not happening, and I think I need to include RedCommands' sources in the RedLib sources jar
There are technically 2 unused blocks in vanilla now iirc
or structured blocks
help :}
please ahhahaha
Show config
auctions:
auctionID:
- f86f501a-0c94-4aa6-8753-e96373406046
f86f501a-0c94-4aa6-8753-e96373406046:
qgKb07:
amount: 1
cost: 5
expiresIn: 1
sellerName: Optic7409
meta: rO0ABXcEAAAAAXNyA```
I don't see any itemID property in here
ah see i removed it as that was from a bit ago lemme get the newest
and i am just outputting id
but its showing as ID: MemorySection[path='auctions.f86f501a-0c94-4aa6-8753-e96373406046.itemID', root='YamlConfiguration']
String id = String.valueOf(auction.getAuction().getString("auctions." + playerId));
How can I add Map to a List in a configuration? java final @NotNull List<Map<?, ?>> existingList = this.getConfig().getMapList("channels"); // Not thread safe! existingList.add(chatChannel.asHashMap()); this.getConfig().set("channels", existingList);
this is my code rn but it doesnt work
it throws a nullpointer whenever i try to read it back
public record ChatChannel(@NotNull String name, boolean sameWorld, int distance) {
public ChatChannel(final @NotNull String name, final boolean sameWorld, final int distance) {
this.name = name;
this.sameWorld = sameWorld;
this.distance = distance;
}
/**
* Constructs the {@link ChatChannel} as a {@link HashMap} that can be added to the configuration.
*
* @return A {@link HashMap} representing the {@link ChatChannel}.
*/
public @NotNull HashMap<@NotNull Object, @NotNull Object> asHashMap() {
final @NotNull HashMap<@NotNull Object, @NotNull Object> hashMap = new HashMap<>();
hashMap.put("name", this.name);
hashMap.put("sameworld", this.sameWorld);
hashMap.put("distance", this.distance);
return hashMap;
}
}
this is the ChatChannel class btw
so im still a little new to the idea of an API for my plugin. But if i want to make an API for my plugin while hiding all the actual plugin code, how would that be done?
I assume you would just not include the stuff you dont want people seeing, but then wouldnt it just give errors since its trying to use code it doesnt have access to?
Or would that not happen?
Use interfaces to define API and then use classes implementing those interfaces for your plugin's implementation.
You can then only give the user the interfaces, as long as those interfaces don't depend on the implementation classes.
e.g.
// Accessible to plugin devs/API users.
public interface User {
String getName();
}
// Accessible to only contributors.
public class UserImpl implements User {
private final String name;
public UserImpl(String name) {
this.name = name;
}
@Override
public String getName() {
return name;
}
}
You probably shouldn't do that for classes that don't need to be part of the API.
yea ofc
I actually don't know if it's a good idea to apply it to main class, as you'd likely need to use static or depend on the implementation in order to use it.
Wait but doesnt it need the main class to be seen
Cause when you get the "plugin" isnt it getting the main class?
declaration: package: org.bukkit.plugin, interface: ServicesManager
^ this can be used to provide API-specific classes
amazing, thanks
You can use Gradle modules to separate API and plugin
I don't know how to do the same with Maven tho
Yea, i dont use gradle
The reason for doing this is that it allows you to build two separate jars
One for API, which you can give to API users, and one for the plugin, which will also depend on the API and is given to server owners.
thanks again lol
how can I do it with leaves without changing a leaf texture on the server? Like I wanna have it so that all the main blocks in the game are still fine but theres custom blocks too
Is there any reason why i shouldnt have this in the top of my main class?
public final NamespacedKey entityTypeKey = new NamespacedKey(this, "bs.entityType");
could be wrong, but i dont think you can do that with blocks
Items yea totally
dang, cuz I want a custom block for my plugin but I can't get it into the game and I want it to be a physical block
look upo stuff about custom model IDS
Pretty sure its just items tho
is there a way to give someone a conditional chain command block?
I can give a chain command block but im not sure how to make it conditional
Cant they change it when they place
^
Its possible to obfuscate only some clases using Superblaubeere obfuscator?
Or do you recommend another obfuscator?
Duplicate drops on BlockBreakEvent
If anyone could send me any help it would be coolio
How to get the recent tps? Because ```java
MinecraftServer.getServer().recentTps
doesn't exist.
coolio?
Cool but better
would be neat to try doing custom obfuscation using an old scrabble set, a hat, and refactor/rename lol
ExecutorService cant run submitted task for some server
can someone help me i made a thread
What do you need? Explain more so we can help u...
my bad i put more info in the thread
No problem!
How can I make a blaze immune to projectile damage?
I think you have to change the entity properties
cant u just listen to the event and cancel if its for instance an arrow
That its the easiest wey
Wouldnt that consume more resources rather than changing the properties?
this would be nms no? unless i misunderstand what nms is
Please use simple English. Im not native speaker
my mistake
what you were referring to was an example of NMS right?
In other words dont talk with hard words :P
Yeah
hey guys, is there a way to set custom model data from the java / spigot api side? I have a custom item I have made, and a resource pack to texture it, but I don't know how to tell the ItemMeta, or whatever is responsible, to use the specific model data I want
Hmmm I see, nbt being like resource packs and all that right
no.
enchantments on items means that items have a enchantment nbt on it (if i remember right)
nbt will be handle by servers
the full name of it is uhh
So to do what I need here I will have to somehow edit the nbt of the item when it is crafted (I'm added a crafting recipe with Bukkit.addRecipe())
nah
i use dark discord
but black google doesnt look fit to me
Ohhh looks like ur right!
Lemme see what I can do here
meta.setCustomModelData(10); thats all I needed!
I think my custom item will look right for my friends now π thanks a bunch
i think the Spigot API itself is bugged, ive been searching and it looks like this is an actual problem, people arent able to cancel the EntityAirChangeEvent in general
which sucks a lot
idk how u would report this
jira
?
ohh
not development related but, how do i override an item texture using the custom model data?
nvm, just forgot the parent
Hello, I'm Geegaz ! As you may know, the first snapshots of the 1.14 introduced a new format for the JSON item models custom model data . It's also a...
How do I use spigot version 1.17 in my pom.xml file?
What should i do to disable specified "LivingEntity" not drop items?
My snowman have Villager spawn egg in this head, and i dont want to drop it
what are you using to make your assets
just put some transparent pixels in there by changing your brush opacity?
.
Alpha channel in your color
Any resource pack bois know what I'm doing wrong here? Trying to have a custom texture when an item has a given custom_model_data, but its just appearing as a purple and black cube.
ender_eye.json
{
"parent": "minecraft:item/generated",
"textures": {
"layer0": "minecraft:item/ender_eye"
},
"overrides": [
{
"predicate": {
"custom_model_data": 10
},
"model": "item/ender_bag.json"
}
]
}
ender_bag.json
{
"parent": "item/generated",
"textures": {
"layer0": "item/ender_bag"
}
}
{
"parent": "item/generated",
"textures": {
"layer0": "item/cocoa_beans"
},
"overrides": [
{
"predicate": {
"custom_model_data": 10
},
"model": "item/essences/low_essence"
}
]
}```
try removing the minecraft:
and remove the .json
ohhh good idea! lemme give that a shot
where do i get the mongodb download or whatever?
cause the dependency isnt working for me
@golden turret That was it! the .json I have been struggling with this for nearly an hour you are a hero
How can I use spiget (yes, the api) within my plugin?
im getting a unsupported class error
with intellij
leme get it
this is when shading inventory framework into the plugin
my java version is 16.0.2
wrong java version
shouldnt 16 be right?
prob that framework
You are probably trying to build for java 8
i dont think so
let me find my settiungs
If your framework is built for 16 you can;t shade it into a java 8 build
well, you can, but you can;t use it
well, i beleive its in java 16
whats in your pom?
<properties>
<maven.compiler.source>16</maven.compiler.source>
<maven.compiler.target>16</maven.compiler.target>
</properties>
https://prnt.sc/23cn5k6
whenever I put this dependency in its own dependencies it doesn't yell at me but the moment I put it with the rest of them it goes red. (can't have two <dependencies> fields)
show the full error
doesn't mc require java 17 now?
1.18
its a 1.16.5 plugin but i plan to update to 1.18 later
ahh gotcha
its for my server
serber
serber
Eclipse
man, i used to use eclipse but i can never go back
How do I create a void world?
with google
My guess is somewhere in Intelij there is another version setting for yoru project
nothing I found online worked
alright
i made one using google a while back
like i found stuff online
oh
google is indeed a good skill to have
anyways, how can I make a duels like system where the server teleports you into different worlds like Hypixel?
.
nevermind
i am back
did you ghost ping me
I edited the message sorry
Why tf do you have two dependencies blocks
I was trying just about anything because it was red in the regular dependencies one when I filled everything out (seemingly) correctly
that could be why LOL
When it's in a singular dependencies block it's red
because, you may ask why, it didnt done resolve the dependency
you didnt reload the maven
so it is red
"spiget"
so it quto-updates to the latest spigot version?
it's used to get a ton of stuff from the spigot site (resources, information about the resources including authors, etc.)
doesn't really have to do with the server version
im too lazy to looki into it
well the main issue is just that my pom.xml is trying to find the artifact I supplied in the paper repo for some reason
that's not what I want to use it for
what's your sdk set to I had a similar error yesterday
where do i find that
nvm
aha
i removed all others beside 17
how does one directly increase swim speed for the player
hmmm that's not the error I got nevermind
I had an issue where it said needed version 52 and I had 60 or something I'm not sure
check when they are swimming and change velocity
damnit
same issue
now everything is on java 17 tho
<dependencies>
<!--This adds the Spigot API artifact to the build -->
<dependency>
<groupId>org.spigotmc</groupId>
<artifactId>spigot-api</artifactId>
<version>1.16.5-R0.1-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.github.stefvanschie.inventoryframework</groupId>
<artifactId>IF</artifactId>
<version>0.10.3</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>3.2.4</version>
<configuration>
<dependencyReducedPomLocation>${project.build.directory}/dependency-reduced-pom.xml
</dependencyReducedPomLocation>
<relocations>
<relocation>
<pattern>com.github.stefvanschie.inventoryframework</pattern>
<shadedPattern>me.silent_program.inventoryframework</shadedPattern>
</relocation>
</relocations>
</configuration>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>shade</goal>
</goals>
</execution>
</executions>
</plugin>
are you using intellij?
ye
press ctrl+alt+shift+s to open project settings
go to modules
what SDK is your module using
you want to specify it there as well
@trail lintel language level?
that one as well, and then the third tab Dependencies
both should be on java 17
for module SDK
does it say 17 next to project sdk?
yea
aight yeah you good there
whats the usecase?
just use binary π
DataInputStream/DataOutputStream makes it really easy
tip: include a versioning number
yeah binary is the best you will get
depends on the usecase
(they're also quite fast, considering they're just abstractions over InputStream/OutputStream that count as DataInputs/DataOutputs)
You're trying to run java 16 on a lower-versioned JVM
Meaning that my actual computor has the wrong java version?
my pc is running java 17
everything i have found is java 17
@waxen plinth
it has to do with a dependency'
without it it works fine
its the maven shade plugin
Dunno then
you sure?
yep
fixed it with 3.3.0-SNAPSHOT
now im getting this
[19:56:14] [Server thread/ERROR]: Could not load 'plugins\BetterSpawners-1.0-SNAPSHOT-shaded.jar' in folder 'plugins'
org.bukkit.plugin.InvalidDescriptionException: Invalid plugin.yml
at org.bukkit.plugin.java.JavaPluginLoader.getPluginDescription(JavaPluginLoader.java:170) ~[server.jar:3096a-Spigot-9fb885e-af1a232]
at org.bukkit.plugin.SimplePluginManager.loadPlugins(SimplePluginManager.java:144) ~[server.jar:3096a-Spigot-9fb885e-af1a232]
at org.bukkit.craftbukkit.v1_16_R3.CraftServer.loadPlugins(CraftServer.java:381) ~[server.jar:3096a-Spigot-9fb885e-af1a232]
at net.minecraft.server.v1_16_R3.DedicatedServer.init(DedicatedServer.java:224) ~[server.jar:3096a-Spigot-9fb885e-af1a232]
at net.minecraft.server.v1_16_R3.MinecraftServer.w(MinecraftServer.java:928) ~[server.jar:3096a-Spigot-9fb885e-af1a232]
at net.minecraft.server.v1_16_R3.MinecraftServer.lambda$0(MinecraftServer.java:273) ~[server.jar:3096a-Spigot-9fb885e-af1a232]
at java.lang.Thread.run(Thread.java:831) [?:?]
Caused by: java.io.FileNotFoundException: Jar does not contain plugin.yml
... 7 more
name: Better_Spawners
main: me.silentprogram.betterspawners.BetterSpawners
version: 0.0.1-SNAPSHOT
api-version: 1.16
description: lal
commands:
open:
description: test
Itβs not being moved to the right place when building
Or itβs not being included at all when building
for why
what would cause this?
Not sure, I donβt really use maven
π’
I wanna make so when a player dies, his inventory is stocked in a static hashmap
When I will restart the server, the static hashmap will be lost right
Because random static is bad
It could just as easily be a instance variable in your listener class
Generally you only have one instance of those
True
There will not be multiple instances of it
static is useless in this case
So to not lose the HashMap content, I must parse the content into a json file and when the server is restarted, I load the content of this json file into the hashmap
Is there another way than creating a json file ? (easier way)
yaml
Not really, gson is fairly easy to work with
lol
json is probably your best option
json is best
Yaml exists too, but itβs not really meant for data
but you can use a data.yml
its easier to do
Of course another option is SQLite
but worse
good
pretty sure sql is easy to do
i havent worked with it
yeeees it is
but
but ?
idk
So when OnServerStop (idk the name of the event), how could I create a new json file in his own folder in the plugin directory, where the plugin is located
you could
plugins
myPlugin.jar
myPlugin
inventory.json
but you have to consider the server could crash
Why would it crash ?
I would advise you save it regularly
Say every 5-10 minutes
Actually you can probably just save it whenever someone dies
Ok I see, I do this in a thread with a sleep of 10 minutes
Nah
or just use a runnable
Just use runTaskTimer
onDisable?? lol
Actually, you can do runTaskTimerAsyncronously
good idea
No?
are you saying save ALL players whenver any player dies
or save the inventory of the player who died
No
no
But if multiple player dies, they will all write in the file at the same time
eum
just use a timer or whenever inventory is changed with a buffer
It doesnt take 1 hour but
What is buffering
you asking me when their inventory is removed ?
whats even the purpose of having this data?
No, when is it removed from the map
It is removed from the map when the "tombstone" is destroyed
Okay, so it isnβt just keep inventory, got it
i make the plugin in kotlin, idk if its important to say
Yeah you can write it to the file immediately to ensure nothing is lost in a crash
No one likes to lose items in a server crash
true
go little rockstar
The purpose of the map is to store inventories with the UUID of a player. When a player dies, it spawns a custom block and when he right clicks on it, he can collect his stuff (inspired by valheim)
i see
I must set the keepInventory gamerule to true so the items will not be duplicated
Pretty sure you can also just clear the dropped items in the death event
just clear his inventory thats all?
well he loses his stuff when he dies
but you can remove the drops
so nothinf will be dropped
Yeah there is a mutable list of drops iirc
Do metadata tags assigned to players reset when they die or change world?
I already saw a question like this about html
and it was a yes
but forget about what I said
Best way would be to test it
if thats directed at me, entity metadata and html are different
I can't, its a theoretical question for if anyone knows off the top of their head
how are you assigning said metadata
I would imagine via the method for adding metadata?
everything is so simple with kotlin maaaan. I recommend yall to use it for plugins
well he could use PersistentDataContainer
random thought
in which case it would be persistent
Entity#setMetadata(String, FixedMetadata(Plugin, String))
Im 1.8.8 which is bigsad
besides it doesn't need to be permanent, I just need to make sure it doesn't go away under any circumstance other than them leaving
I'm making a plugin that adds some custom items and I'm making a /givecustom command for getting them. Is it possible to have the custom items I have created show up like they do with vanilla /give?
you could always copy the code of the command where the external jars are decompiled in your ide
afaik there are unsafe bukkit methods that do it
im faily sure it will remain with world changes, and when they die
Not without remaking the command
aight thanks
wdym?
Create a copy of the command that also includes your items
I mean I'm making the command be /givecustom
So you want the possibilities to show up?
in minecraft when you do /give, you can see all the items
...
custom4
custom3
custom2
custom1
/givecustom
yeah
I thought they wanted to add their items to the vanilla give command
I've been trying to get a screenshot for the last few minutes but it won't paste lmao
If you just want them to show in your command, implement TabCompleter
I'm making a /givecustom
Also you cannot send images unless you verify
ohh
hahahah thats why I made a notepad
I just don't really feel like making an account lol
implement is for interface in java right?
Thanks!
it is
christmas vacations started, I feel my brain going away
Someone has an idea how to broadcast a message to all players with paper ?
uhm
it's different and I have no single clue
they have no documentation
Ask their discord
they are telling you why its deprecated
oh they have one
Also adventure has documentation
gooood
You can still use the deprecated one anyway
the ide put like every style possible to make it fckin weird
broadcast
same color as the background
lol
what plugin did you make in the past
or live
Hmm?
Im curious, do you have a portfolio or a place with your projects ?
Theyβre on my GitHub
omg ur pfp haha
i see you have a customcropcreator @young knoll thats quite a cool little project
You said to me to use task, could I use Kotlin coroutine instead @young knoll
No idea
If you want a new project idea, try doing a plugin 100% made in kotlin.
scala πΌ
Not really interested in Kotlin
How do I get the attacker from EntityTargetLivingEntityEvent ?
GetEntity() seems to get targeted entity
Entity Who targeted another entity
getEntity should get the targetter
getTarget returns the targetted
as seen here
declaration: package: org.bukkit.event.entity, class: EntityTargetLivingEntityEvent
show us what youve got
is the entity not null?
Not all entities have a custom name
yea its probably just the event being called on other entities
which causes the nullpointer
Jeez
for (int x = 0 ; x < ( config.getStringList(event.getEntity().getCustomName()).toArray().length); x++ ) {
You really should not be doing this
entityType = (EntityType) config.getStringList(event.getEntity().getCustomName().toString()).toArray()[x];
Your loop is O(n^2) for no reason
Store it in a variable at the very least
You also can't cast to EntityType from String
Yea
You need to do EntityType.valueOf
omg my eyes
And handle the exception
HAHAHAH
.toString().toString().toString().toString().toString().toString().toString()
Any time complexity ppl wanna look at my plugin
go
Player.getPlayer().getPlayer()
Ignore Venmo plug
Get him!
Ok let's see
I'm a time complexity person
I am made of complex time
Got any specific parts I should look at?
I don't feel like looking at the entire plugin
same
Its amazing always when I use:
JarOutputStream output = new JarOutputStream(new FileOutputStream(new File("C:\User\Usuario\Desktop\File.jar")));
I get: An error was thrown while executing run method. Reason: java.io.FileNotFoundException: C:\User\Usuario\Desktop\Lunar-Out.jar (The system could not find the route)
Any idea?
i think ur missing the jar file
why not use ZipFile
Im using it to write class node with ASM
^
It looks for Lunar-Out.jar
Ark Server Manager?
Lul
isnt ark c++ tho
No no
okay then im clearly out of my element, sorry goodbye π€£
Ive only know it to stand for ark server manager
ass sat mad
Its related to bytecode
idk I use github copilot
Apparently it just stands for ASM
ASM stands for ASM ?
Specifically ASMifier tool
I explain, im reading a jar
When reading/writing i got that the system cannot find the file
output is not reading
its writing
if only the problem was just that
Nooo
I have found the error
Btw
Its: C:\Users\
And i was writting C:\User\
Im an idiot
yes it is
I just realized that I didn't check if it was an entity with a CustomName.
So a WARN would have occurred, but still the code doesn't apply to entities with names :(
Is it possible to update the plugin without making people download a new version
like
I execute something and the plugin is modified
How do you mean? For those that have downloaded your plugin or specifically for the server it's on?
the server it's on
What?
/unload-/load(?) but this can and will break the plugin unless it's set up to repopulate necessary data fields such as online players. Since for example PlayerJoinListener will not be called again.
Can I save entities to a file with UUID? I tried to save an armorstands UUID but after restarting and trying to get the Entity from the UUID I saved the Entity was null.
The entity would have to be loaded to get it
Ok so what can I do?
Make sure itβs loaded
if(!=null)
Do you mean that the chunk must be loaded?
Ye but I need to add it to an hashmap
So I can use it
Yes the chunk must be loaded
About my plugin I talked about, the best moment to update the json file would be at each 10minutes with a coroutine or at each time someone dies ?
question like this. Im thinking
I would go with the later
And there is no way to bypass that?
the later ?
Yes, the later of the 2 options, aka the second one
oooooh, I never heard this term, im sorry
Store the chunk coords as well and force load it I guess
hahah thanks for your opinion
Or use the chunk load event to add it to your map when the chunk loads
Whatever you want
I thought it was like android studio
@Override
void onResume()...
but its event handler not override
so im dumb dumb
Json is only for string
HashMap<UUID, Inventory>
how could I parse this into json
Hi, i need cuz idk how to solve it : https://paste.md-5.net/iraforamat.bash
Presumably either some issues with mappings or you're just putting in the wrong name, because the actual class name is EntitySkeletonWither, not WitherSkeleton
thats what I was about to say ngl
ik but there's not EntityWitherSkeleton, just WitherSkeleton import net.minecraft.world.entity.monster.WitherSkeleton;
Yeah then you're probably using SpecialSource or something like that to use Mojang mappings
Yeah
Its a skeleton entity
Yes
Sorry i didn't mention this before but it's for a custom entity