#help-development
1 messages · Page 2099 of 1
mye?
= mmmmm, yes
o lol
how would you get mappings then?
I followed the guide I posted earlier but it doesn't seem to be working
@tender shard (sry for the ping)
kk
did they change the api for 1.18 cause this doesn't seem right and i cant import anything
I would use maven to import
ok
(you can google using maven in spigot)
Its a much better way to do it
Not to mention that you can also use other libraries
alr
Hey, how do i make my plugin support placeholderapi? Not add placeholders, but just replace the %placeholder% stuff
like some plugins have stuff like 'Support for lpaceholderapi'
and allows you to use other plugin's placeholders within their plugin
how do i do that
why did I again get a ping here
this
i think its this, that you need to hook into ithttps://github.com/PlaceholderAPI/PlaceholderAPI/wiki/PlaceholderExpansion#common-parts
well
I mean the ItemStack is just a context object
is not actually stored itself once put in an inventory
as the inventory creates a copy with CraftItemStack iirc
when you use chatcolor translate, what is actually outputted?
is it the §
instead of the &
how would i strip a message of all its color codes?
ChatColor#stripCOlor
theres a method for that
yeah, stripColor definitely exists
^my code
^what I'm trying to emulate
o thx
how can I get the instance of the NPC within the inner class?
can do it like this but that seems weird?
To the AbstractListener?
yeah
Probably not since you are already calling the constructor.
Also those are called anonymous classes, not inner classes.
Trying to do stuff with my database and I got an error. Anyone know whats wrong as I cant seem to figure it out https://pastebin.com/Lq2c1X6s
ah kk, thx
Inner classes are just classes within other classes, while anonymous classes are in methods.
I like anonymous classes a lot
This is my first time making a util class; dont hurt me.
How can I access readPlayer in another class and pass in uuid?
public class MongoUtil {
public String readPlayer(UUID uuid){
DBObject r = new BasicDBObject("uuid", uuid);
DBObject found = players.findOne(r);
if(found==null){
return null;
}
String name = (String) found.get("name");
return name;
}
public void updatePlayer(UUID uuid, String name) {
DBObject r = new BasicDBObject("uuid", uuid);
DBObject found = players.findOne(r);
if (found == null){
return;
}
DBObject obj = new BasicDBObject("uuid", uuid);
obj.put("name", name);
players.update(found, obj);
}
}
i would make a method for that
I personally don't believe inner or anonymous classes should exist, but that's just my opinion.
inner classes can have their use
(One way to rectify this would be to just allow multiple classes in one source file, like every other language)
kk, how come?
no more small utils classes if you only use them at one place :)
dunno what that means
Im going to end up using them in multiple places :/
well i wasnt particulary talking to you
kek
I love stuff like that
code to make a pig launcher
initialzing a field spawn it
I personally think anonymous classes that are any larger than a single method are obnoxious as they take up a considerable amount of space in code.
big brain time
Methods shouldn't be so many lines.
(Still, single method anonymous classes can be replaced by functional interfaces, i.e. lambdas)
the main alternative I see to doing this type of stuff is to pass in lambdas as a parameters which then makes huge constructors
i had to make an inner functional interface for a supplier
and I find that anonymous classes allow for far more flexibility
Or... just actually extend the class?
Which is, theoretically, better, since it separates concerns?
yeah but then u end up making loads of classes for every implementation
I dunno I guess actually extending really wouldn't be that bad
Well this is just a fault of the API then :p
especially if you did as an inner class
If you have to extend like 500 classes.
;-;
Either way, you're still extending 500 classes, it's just you separate their declaration from a method when using proper classes.
true
AKA more readable.
(Not to mention the "anonymous" part of anonymous classes mean the idea of the implementation isn't portrayed through its name)
I tried to get my code from github but now the files look weird did I do smth wrong? Cant build aswell....
did I pull it right tho?
is it there?
dunno how to do it :(
anybody else know?
Right click the java folder and set as project source
"Mark directory as" -> "Sources root"
now everything is red tho
It doesnt recognise your pom. Make sure intellij recognises the project as a maven project.
and how do I do that? On my other computer everything worked fine like this
how would i return something in an async bukkit runnable
code:
Bukkit.getScheduler().runTaskAsynchronously(JavaPlugin.getPlugin(Main.class), () -> {
return Integer.toString(Main.SQLManager.getLevelEntryLevel(p));
});
Never had this problem with intellij. Just properly push the project to git and then pull it again. Intellij should recognise it without a problem.
if you just need to do computations off the main thread, look at completable futures
You dont. Best you can du is BukkitScheduler#callMethodSync(Callable<T>) to return a Future<T>
du
Wait could I do the async part in my SQLManager then return the value without doing it async in that file?
Oh you want to call async methods from a sync context. Then look at completable futures like lynx suggested
ok
if i have Players: (UUID): Kills: Deaths: Etc... in a yaml configuration how would i delete players and the data it has?
bump
load data -> remove element -> write data again
just remove players?
What JDK are you using?
I think I pulled it wrong... I just click this right? and then the first one and i put the url in? But then it only looks like this (3rd picture)
12
First update. Then -> What TLS version are you using?
@lost matrix Do you have an idea what I can do?
How do i check my TLS verison?
No idea. Looks scuffed.
?
how do you send a message to all players in the same world your in?
Bukkit.broadcastmessage()
loop over the onlien players, check the world, then send a message to them?
so like:
oh yeah
for (Player players : Bukkit.getOnlinePlayers())
if(player.getWorld() == players.getWorld()){
yes
sth like that
alr
but
do .equals?
calling the local var "players" is pretty stupid
since it's only always one exact player
it makes no sense to call it "players"
I always call them target
no
the point of the command is to send a message to all players in the world when running a comman
Ok
so I am getting the world of the player and then the OTHER players
what programm are you using?
For ?
I'd use a stream though
Player somePlayer = null;
Bukkit.getOnlinePlayers().stream()
.filter(player -> player.getWorld() == somePlayer.getWorld())
.forEach(player -> player.sendMessage("You are in the same world as " + somePlayer.getName()));
sth like this
vsc
[23:33:45 WARN]: org.bukkit.plugin.InvalidPluginException: org.bukkit.plugin.InvalidDescriptionException: name '${project.artifactId}' contains invalid characters.
[23:33:45 WARN]: at org.bukkit.plugin.java.JavaPluginLoader.loadPlugin(JavaPluginLoader.java:94)
[23:33:45 WARN]: at org.bukkit.plugin.SimplePluginManager.loadPlugin(SimplePluginManager.java:415)
[23:33:45 WARN]: at PlugMan.jar//com.rylinaux.plugman.util.PluginUtil.load(PluginUtil.java:356)
[23:33:45 WARN]: at PlugMan.jar//com.rylinaux.plugman.command.LoadCommand.execute(LoadCommand.java:114)
[23:33:45 WARN]: at PlugMan.jar//com.rylinaux.plugman.PlugManCommandHandler.onCommand(PlugManCommandHandler.java:95)
[23:33:45 WARN]: at org.bukkit.command.PluginCommand.execute(PluginCommand.java:45)
[23:33:45 WARN]: at org.bukkit.command.SimpleCommandMap.dispatch(SimpleCommandMap.java:159)
[23:33:45 WARN]: at org.bukkit.craftbukkit.v1_18_R2.CraftServer.dispatchCommand(CraftServer.java:905)
[23:33:45 WARN]: at net.minecraft.server.network.PlayerConnection.a(PlayerConnection.java:2306)
[23:33:45 WARN]: at net.minecraft.server.network.PlayerConnection.a(PlayerConnection.java:2117)
[23:33:45 WARN]: at net.minecraft.server.network.PlayerConnection.a(PlayerConnection.java:2098)
[23:33:45 WARN]: at net.minecraft.network.protocol.game.PacketPlayInChat.a(PacketPlayInChat.java:46)
[23:33:45 WARN]: at net.minecraft.network.protocol.game.PacketPlayInChat.a(PacketPlayInChat.java:6)
[23:33:45 WARN]: at net.minecraft.network.protocol.PlayerConnectionUtils.lambda$ensureRunningOnSameThread$1(PlayerConnectionUtils.java:51)
[23:33:45 WARN]: at net.minecraft.server.TickTask.run(TickTask.java:18)
I nned transfor dis code source in jar code
use that for error messages please
Vsc
that's just saying a part of the plugin.yml is invalid
you added maven placeholders to your plugin.yml but didn't properly filter them
?paste your pom.xml
@light tendon
?
is this plugin your own? what are you trying to do
I will block everyone immediately who ignores that and then even continues to send .rar files to me
I cant put folder here
is it a custom plugin or is the code posted online?
so what are you trying to do
Its source code ,I need transform in .jar code
its already in a jar file
just download the release lol
bruh you shouldn't be running a server on any capacity given you don't know how to download stuff
like are you trying to change something and recompile
But
best real advice
You seing me
You have added Maven placeholders to plugin.yml, but you have not filtered them properly
How fix
?
contact the plugin owner lmao
I cant fix ?
Hello, I have a little java question :x
Does annotations work when I extends a class ?
I mean, imagine I have this class:
public interface TestListener extends Listener {
@EventHandler
void onPlayerJoin(PlayerJoinEvent event);
}
Does this work ?
public class CraftTestListener implements TestListener {
@Override
public void onPlayerJoin(PlayerJoinEvent event){
}
}
you have given us literally zero information
I cant fix ?
yes they carry over on methods you override
👍
I cant fix?
Thank you ♥
dude ask the plugin owner how is this a spigot issue and not a plugin issue? Its with a maven placeholder thats in the plugin? Plus it literally has his github open an issue if its not working
Considering that's an interface though that seems like a bad example
if you need the plugin, it's on spigot. download it. if you want to compile it yourself, look up how to use maven
implementation still has to do the logic related to registering events
from what i've gathered he's had issues with it starting but thats not really a spigot issue moreso something that needs to be settled with the plugin developer
he said he was using visual studio code so I figured he was trying to edit something 🤷♂
Why do people who haven't ever touched code try to edit code and expect it to work
the plugin itself is fine
I just checked the plugin.yml, maven filtering is working correctly so he has to be editing it
lmfao
Is it okay to have protocollib phobia
yes
Nothing gets thrown when I connect to my database at the start:
But when I try to access it: Caused by: com.mongodb.MongoTimeoutException: Timed out after 10000 ms while waiting for a server that matches AnyServerSelector{}. Client view of cluster state is {type=Unknown, servers=[{address=localhost:27017, type=Unknown, state=Connecting, exception={com.mongodb.MongoException$Network: Exception opening the socket}, caused by {java.net.ConnectException: Connection refused}}]
make sure database is actively allowing connections
How can I confirm this is happening?
make sure mongodb is installed on your localhost
@Eventhandler (priority = EventPriority.HIGHEST)
public void onQuit(PlayerQuitEvent e) {
e.setCancelled(true);
}
cursed
only if
The server console looks fine
try to use 127.0.0.1 as the host instead of localhost
yea
unless you can connect with localhost
I remember having problems with that before, god knows why
same lol
i remember having to use the internal IP
not sure why
something like 10.0.0217
oki 1 sec
bukkit runnable that goes faster as longer as it exists?
the longer it lives, the faster it loops?
yea
run it every tick from the start and then have some logic that only runs the code every X passes which decreases for each pass
can you use variables in the delay
Still doesn't work; il try this
Do I set it to the internal IP in the mongod.conf too?
and it does the logic every 20 ticks (thats a second), but it goes faster by 0.1 second every 20 ticks
yeah so do what I told you
not sure, i remember doing it on ubuntu a while back
but youll have to mess with that
what IP is mongo binding to
I had it going to 0.0.0.0, but now its set to the internal ip
Still isnt working :(
which IP did you set it to
try ipv4
make sure you restart it too, assuming you already did but
What?
I did lol
what is bind_ip in mongodb.conf set to
I set it to the internal IP, it used to be 0.0.0.0
that should be fine then
sadge
is it running in a docker container?
Im running it on a server hoster. Here is all the startup stuff.
[Pterodactyl Daemon]: Finished pulling Docker container image
:/home/container$ mongod --fork --dbpath /home/container/mongodb/ --port ${SERVER_PORT} --bind_ip 0.0.0.0 --logpath /home/container/logs/mongo.log; until nc -z -v -w5 127.0.0.1 ${SERVER_PORT}; do echo 'Waiting for mongodb connection...'; sleep 5; done && mongo 127.0.0.1:${SERVER_PORT} && mongo --eval "db.getSiblingDB('admin').shutdownServer()" 127.0.0.1:${SERVER_PORT}
about to fork child process, waiting until server is ready for connections.
forked process: 17
child process started successfully, parent exiting
okay and I should set it to bind to that IP?
bind it to 0.0.0.0
kk
How to make za warudo ability plugin
if that isn't the correct address, you will have to find the address some way
Should I ask my hoster maybe?
I would possibly
ask about remote connections
I've never seen mongo run through pterodactyl before
depends which exception you are catching
Im catching UnknownHost
could just catch Exception so it can get any
kk
that way you can print all exceptions that happen, not just specific ones
Im still not getting any errors... maybe I'm writing or reading wrong
i'l try just sending a message to console
anyone know how to make a graph that looks like this? I've been trying for a while and can't seem to get it
For my database(mongodb) when I save the data It doesnt realise there is already a document with the exact same uuid. so it creates another document to store it in (picture below). How do I get a document if it is already created?
findOneAndReplace if it already exists
Can I see your connection code? Im really struggling here lol...
thanks
Ok, here's what I did
public void set(PlayerData val) throws NullPointerException, IllegalStateException {
if(val == null) throw new NullPointerException("PlayerData to save cannot be null!");
UUID uuid = val.getUuid();
if(uuid == null) throw new NullPointerException("PlayerData uuid to save cannot be null!");
Bson filter = uuidFilter(uuid);
long count = collection.countDocuments(filter);
if(count > 0){
collection.findOneAndReplace(filter, val);
Bukkit.getLogger().info("Updated document " + uuid);
if(count > 1) Bukkit.getLogger().warning("ALERT: More than one player data entry registered under uuid " + uuid + "!");
}else{
InsertOneResult response = collection.insertOne(val);
if(response.getInsertedId() == null){
throw new IllegalStateException("Could not insert document " + uuid);
}else Bukkit.getLogger().info("Inserted document " + uuid);
}
}
here is the uuidFilter() method:
public static Bson uuidFilter(UUID uuid){
return Filters.eq(Key.UUID, uuid);
}
(Key.UUID is just a constant meaning "_id")
What this does is searches through all documents using the filter "_id value is equal to player uuid to save" and if it finds one, it uses the replace method instead of the add method
anybody know how to fix Unsupported class file major version 60
for shade plugin, im trying to fix this stupid NoClassDefFoundError that I get for mongodb
I need to surround with try/catch on mongoClient initialization right?
Update Java on your server or compile to an older version
how do I compile to an older version
What dataType is collection?
anyone?
object
Are you using maven or gradle?
maven
MongoCollection<Document>
nvm i forgot a semicolen
<properties> <maven.compiler.target>1.8</maven.compiler.target> <maven.compiler.source>1.8</maven.compiler.source> </properties>
var points = plugin.playerCollection.find().sort(Sorts.descending("Points")).limit(5);
var firstPoints = points.first();
var secondPoints = points.skip(1).first();
var thirdPoints = points.skip(2).first();
var fourthPoints = points.skip(3).first();
var fifthPoints = points.skip(4).first();
Can't really test, this would give me the top 5 player's with points correct?
Ugh on mobile so spacing got messed up
just paste that into pom?
Yes
also what about these
<maven.compiler.source>17</maven.compiler.source>
<maven.compiler.target>17</maven.compiler.target>
they are in my properies tag
should I remove them
Ah you can just change 17 to 1.8
Okay
that didnt work
its saying my shade plugin is unsupported file major version 60
this plugin is what I manually added to my pom btw
everytime i try to mvc package command
Uh I gtg. Will be back tomorrow, hope you can fix the issue
the maven shade plugin doesn't yet support Java 16. To solve the issue I had to use a snapshot version of the maven shade plugin (3.3.0-SNAPSHOT) since 3.2.4 doesn't support Java 16 yet. - this is what someone said, ill try it
okay cya
anybody know how to fix java.lang.NoClassDefFoundError: com/mongodb/client/MongoClients
Happens because the library maybe its not being shaded correctly
That one of the reason
Send your actual pom
Okay
Im making progress
Anyone have an example of shading in Mongo driver? It's not working :(
how does ur pom.xml / build.gradle(.kts) look
I acually fixed it, but I have another question. How do I create a collection and add to it?
MongoCollection<Document> mongoCollection = mongoDatabase.getCollection("PlayerData");
Am I creating it correctly?
How?
I try shading it, and it says my plugin yml is wrong when I use my shaded jar instead
The collection its automatically created (if it doesnt exists) once you add data
Do I need to create a Document object? Sorry, I'm brand new at this.
Yeah
Once you add data = create a new document
this is confusing
I explain
1- Create a doucument with some data
2- If collection doesnt exists it will be created, and then will add the documents
i done a custom enchant but when i apply it to items they don't glow and they don't have it in the lore, but i debugged and they actually have it, how do i fix?
when I use my shaded jar for mongoDB it never works
Your issue is related with plugin.yml
Yeah
I have just realized something, go to your shaded jar, right click, open with winrar. And check if plugin.yml its inside
Anyone plz?
how can i get it in there without having to always package this shaded jar and manually put my plugin.yml in it?
Patient...
Sorry
As usual say you are not paying for having instant support
yeah ik
do I need to change my location of my plugin.yml?
it gets everything but plugin.yml in shaded file
what happens if I shade my plugin.yml file?
nvm I cant
my plugin.yml is just being ignored from being added. wtf
What is this?
otherwise try to manually exclude artifacts based on
mvn dependency:tree -Ddetail=true and the above output.
See https://maven.apache.org/plugins/maven-shade-plugin/
what is this warning, and is it why I cannot create a properly shaded jar
Can anyone help me with maven shade plugin issues
so for some reason my plugin.yml file is never relocated into my shaded jar
it just skips over it
I'm not sure why
I Fixed it :D
@fossil lily can you help me
maybe
did you ever have issues with the shaded jar not including the YML file?
no, what folder is the plugin.yml in?
its in my com.C200 folder
send a ss of the file structure
wait
thats wrong i need to see it
I think I just fixed it
Make sure you have a resources folder 📂
And make sure it's in maven
Yeah it finally works after 12 hours of trying to solve the issue
anybody know what this warning is?
[18:18:14 WARN]: SLF4J not found on the classpath. Logging is disabled for the 'org.mongodb.driver' component
[18:18:14 WARN]: SLF4J not found on the classpath. Logging is disabled for the 'com.C200.libraries.org.bson' component
Oh I see
I need to add SL4J as a classpath by adding it as a dependency
i wish I could just use npm
man why am I so dumb
method runs twice because it runs based on a removal of a thing and I put in on the removal code the check to see if it should run, and I put the same method at the end of the removals if it's empty
gigabrain
class lombok.javac.apt.LombokProcessor (in unnamed module @0x30c1da48) cannot access class com.sun.tools.javac.processing.JavacProcessingEnvironment (in module jdk.compiler) because module jdk.compiler does not export com.sun.tools.javac.processing to unnamed module @0x30c1da48
Anybody know how to fix this issue
I'd guess out of date Lombok for java 16+
RayTraceResult ray = player.getWorld().rayTrace(player.getLocation(), player.getLocation().getDirection(), 20, FluidCollisionMode.NEVER, true, 1, null);
Entity hit = ray.getHitEntity();
i have this set up but its returning me the player where it starts from as the entity
how do i make it ingore the start player when it does the raycast?
Can always add the player's current direction to the start location
Or at least a multiple of it
Location location = player.getLocation();
Vector direction = location.getDirection();
location.add(direction.multiply(0.5));
// Then ray trace with location & direction```
Probably want to start at eye location though
oh so it starts half way?
A little bit in front of the player
thatd just be y location +1?
getEyeLocation()
do i pass in direction or location.getDirection()
wait nvm
dumb question
alright its still somewhat attacking me
should i just mulitply it by a higher number
How can I test if a document exists in MongoDB?
Yeah might need a bit more.
Hello, I have a question. Can I make more than one plugin in Spigot?
.-.
what?
are you asking if spigot servers can run more than one plugin at a time
like what
twelve
I don't know if I can make more than one plugin in my account
Can try 0.75, or just leave it normalized
why would you not be able to
I don't know I didn't know that and where I also wonder why I already have one but can I do more?
of course you can
really where?
Wut
Desktop
Or documents folder
On your hard drive
Recycling bin
what
Idk what you want lol, make a new Java project
why?😐
I mean, you mean delete the one I have and make another one, is that what you mean?
Do you hear yourself?
You can make another plugin by making another one, the same way you made the first one but in a different folder
mmm.... I was referring to the page on the PC that I already
?????
Hey, I’ve been making a land claim system which will prevent other players from building / breaking claimed land. I’ve got it to work, however, the blocks are a little laggy, which would be caused by the database stuff with the event. I’ve tried to use async task scheduling, but you cannot cancel the events this way. I’ve also tried to set the block to air on placement, however this didn’t work very well, as water would be destroyed. I’ve also tried using callbacks, but those can’t cancel the event either. Is there any solution to fix this? Thanks.
is getCommand().setExecutor possible in 1.8
I think it’s getCommand()
what i meant
is it possible in 1.8
also, what's the best way to have a config file that doesn't update every time you start the server? (i'm trying to avoid dbs for now)
I meant that if you can make more than one plugin on the spigot page
Like storing data?
The website?
mmm.... if the website is the one I am referring to
yes
There’s stuff similar to this on spigot too, just go searching around https://www.spigotmc.org/threads/guide-creating-custom-configs.333804/
Basically you just make a “config” that you can read and write to
Event Lag Solutions
thanks i'll look into it
how do you add color to a broadcastmessage
chatcolor
i already have that
but I noticed that doesn't save every time I rerun the server or push a new version of the plugin out
does anyone know how to remove these console warnings from mongodb on server startup ? https://gyazo.com/013e1bfcf00d1a7d05707f1e0478a433
I think I’ve either saved the config when the plugin disables, or after I make a change to it.
On disable will probably work since the config works until restart with my experience
i tried that
what do you recommend the size be?
i don’t get what the size does
I've saved the changes, but it still resets
im doing this right, right?
Red and bold need to be before the text
oh
Anything after red + bold will be
and just so you know, bold always has to come last (which you did), otherwise it wont apply
also, do Bukkit.broadcastMessage instead of p.getServer().broadcastMessage
yeah, in your case you gotta do ChatColor.RED + " " + ChatColor.BOLD + "text"
my bad, empty string so "", no space
ok thnx anyways
I don't use those ChatColor enums personally, I use the Minecraft color codes directly since it's more compact
"§c§lEnding game manually..."
Yeah it's also prone to breaking on systems that don't support that encoding ;p
oh alr
You should use ChatColor constants, or at the very least, #translateAlternateColorCodes()
(you're fine doing what you're doing, juzi)
? Looking at the actual ChatColor#toString implementation it's literally just using a hard coded § literal
It is, but it uses the unicode
Putting the character in your source means you have to encode your project differently
Do you have any actual examples of UTF 8 characters causing problems with projects when used in strings
This guy didn't show an image of it, unfortunately. I always struggle to find images of it
how do i split this into multiple files?
1st answer is a solution though
On top of encoding issues, you then have to remember the arbitrary colour codes that have no meaning whatsoever.
They have meaning
Well-defined constants with proper names are going to read far easier
i thought i had to put a decorator or smth
I don't know wtf &c is
it's red
How do you expect anybody to know that?
light red to be exact
it's inside the ChatColor source code, or look at a color code index on the web
In reality you only have to memorize 8 codes for colour
It's effectively a magic number
the lighter variation follows a pattern of +8
Code that requires no explanation and no memorization is the best kind of code
I mean I'd rather not quadruple the size of my string just to change the chat colour
It improves readability especially when you have to bold text & change the colour repeatedly
It really doesn't but ok
Like if you want you could make a tool to format it
<red>hello! or whatever
There are plenty of existing tools that can do that already
Avoid magic numbers
If you're just using a few colors it's no big deal, but once you start going crazy with color + bold/strikethrough/etc have fun splitting your string into 3+ lines just to read your 2 sentences in chat
Hello there, so I'm looking into a bug and I think this could possibly be some type of spigot and/or PlaceholderAPI bug
I am using this method here: https://hub.spigotmc.org/javadocs/spigot/org/bukkit/event/block/BlockBreakEvent.html#setDropItems(boolean) to cancel drops of an item
I am using the command /papi parse me %statistic_mine_block% to get the block drop count that the player has broken
The issue with that method, is when called and using that placeholder after breaking the block break count does not change, i removed the method calling this method and it appears works just fine after this
In the screenshot below:
blue = Calling our method that calls setDropItems
red = after removing that method (Ignore 2 increment i broke 2 blocks by accident)
Could the Statistic addon for PAPI be a issue here when calling that method, or could this be some type of Spigot bug?
This is the method Papi is using to get the Statistics of blocks broken for a player, i personally don't see anything that would be causing this
I know the obvious fix here would be "Just add one to the players blocks mined statistic" but, would rather not do that
Okay did some tests
100% not something on our end
Created a test plugin & removed ours:
and still same output
Ill ask in PAPI discord, maybe theylle have something
@noble lantern it's likely using the Minecraft statistic
Those are built into the game
You can try cancelling BlockDropItemEvent instead of calling setDropItems to false
Yes but thats a whole nother listener we need to implement as well as just more overhaul, when that is false according to spigot docs its supposed to not call that event entirely
Its a lot easier to just have this rather than adding a whole brand new class and listener added in (Yes i know for below 1.12 the block break statistic wont be added, ill manually increase the statistic in that version, our issue is on 1.18.2)
i feel like under the hood on spigots side setDropItems could essentially just be cancelling the block break event and setting the block to air, or it could be on Minecrafts end
Time to view the source

ill look
doesnt seem so
that boolean only handles calling BlockDropItemEvent
its something added by spigot too, so it couldnt be a MC bug (theoretically)
Say what do you need papi for exactly
this is something one of our users is using, I assume they just want to get block break count so they use the Statistic addon for PAPI and then use the placeholder %statistic_mine_block%
parsing for that placeholder is here, i dont see anything out of the ordinary
Oh so is this just like a plugin you're making for a guy
hence why im strict on not wanting to manually increase the statistic or add a new listener for BlockDropItemEvent
how is the parent here not a directory?! this is an archive decompiler where the test archive is compiled on windows, not programmatically, and holds a single directory named 'new folder' with a file inside by the name of .data
System.out.println(ze.getName());
newFile = new File(ROOT, "zzzoh/" + ze);
File parent = newFile.getParentFile();
System.out.println(parent + " : " + parent.isDirectory());
prints
New folder/.data
C:\Users\Braun\Desktop\boaty\boats\boats-build\zzzoh\New folder : false
did anyone use mongodb with gradle kts? How dependencies will looks like? I have classnotfoundexception
Did you forget to shade?
Emm, what do u mean by that?
include mongodb in your jar using maven shade plugin
u mean shadowJar?
yeah
as apposed to what?
well, maven shade plugin does also support that
im in oxford now
yeah
this place nice
Want even lower file size ProGuard can hep quite a bit
lol
it got that code shaking as well
make sure you obfuscate it whilst you’re at it 
i have no idea how to obfuscate a jar
there are tools
Like ProGuard
i dont really have a reason to, no one can understand my code anyway
lol
like mojang have to for legal reasons but their obfuscation is fairly minimal honestly
you should see mfnalex's obfuscation
just class/field/method names and removing a lot of packages
I'm trying to learn how to use the Vault api to manage economies, can anyone link me a link to their javadocs? or something that explains all the methods and stuff?
spigot had a page for that
and its like 6 lines to fully implement economy
Yeah read the page
Oh, found it, thank you!
By the way, this should be able to manage the economy even if it's used by multiple plugins right?
Yes
just remember to put
depend:
- Vault
``` in your plugin.yml
Oh, and also this right?
<repository>
<id>jitpack.io</id>
<url>https://jitpack.io</url>
</repository>
</repositories>
<dependencies>
<dependency>
<groupId>com.github.MilkBowl</groupId>
<artifactId>VaultAPI</artifactId>
<version>1.7</version>
<scope>provided</scope>
</dependency>
yep
Thanks!
And if I also use the world edit api I need to add WorldEdit to that right?
yes
Read their wiki
never used gradle sorry
Any idea as to why am I getting Dependency 'com.github.MilkBowl:VaultAPI:1.7.3' not found ?
I've added the jar file to the project
And when i want to test mongo with running normal psvm in Java shadowJar will work?
I'm wondering how to get the nbt data from a tile entity in 1.12.2, sicne I've never really worked with getting info taht way?
Ima try the NBTAPI
Don't do that when you're using maven
As long as you use the shaded jar, yes
Otherwise, currently i try to connect to the mongo in psvm. Then i run that as normal console program. I added compileOnly("org.mongodb:mongo-java-driver:3.6.4") to dependencies and I can import mongo classes, but when I run it throws me classnotfound exception. Idk how can I use shadowJar with it.
Hello !
I have a little question for event priority...
I want my event to have the "highest" (for my minds) priority.
Example: I have an a method with InventoryClickEvent, and I cancel it. I want to cancel this event no matter what happens.
So which priority should I use and why ?
See the doc below, someone told me to use the "LOWEST" priority, but I need the monitoring one ? No ?
Monitor is used for monitoring you should never cancel the event there. If you always want the event to be cancelled you don't need to specify a priority the default normal priority will work fine
But what if another method do event.setCancelled(false) with a higher priority ?
T o o b a d .
I don't want to ignore a problem that another one could do using my API, I just want to fix it
Just leave it default
Alright
hey, can someone help me shade spark webserver into my plugin?
my plugin is 2.9MB because the webserver didnt shade
How can I make a void consumer, what should I put on Consumer#accept?
why when i send this packet, the sign opens and then closes quickly
well, idk what to use, basically i just want to do something after something has completed
Do you mean it's 2.9MB because you shaded?
yes a runnable
probably, I honestly have no idea what I'm doing
Then what's the problem?
https://github.com/fizzrepo/RoseAPI/blob/main/pom.xml
This is my pom.xml
the plugin is 2.9mb and should be much smaller.
is there even a way to make it smaller?
it includes a fairly large webserver package
Yeah it's large because you put something large in it
You can use the minimize option in to the shade plugin config. That will try remove unused classes
do you have an example? can't find it online
or even pseudo is fine
public void doLater(Runnable doSomething) {
// do work
doSomething.run();
}
doLater(() -> {
// Will execute after do work
});
perfect, thank you so much!
Oh, could you provide an example please?
Thank you
<minimizeJar>true</minimizeJar>
put it in the configuration section
when i want to remove the entity player from the tab list the skin also goes away, how can i fix this?
connection.a(new PacketPlayOutPlayerInfo(PacketPlayOutPlayerInfo.EnumPlayerInfoAction.e, npc));
Using nms 1.18
I recommend using Mojmaps
? All you need is to copy paste a thing and run BuildTools
Aight
Anyways if the skin goes away I'm not sure how you would handle that
Not sure if you can
Ohw....
anyone help
I mean why keep skin info of a player that's not supposed to exist
wait. can i use teams!?
Try delaying the editor packet
i can only find nametagVisibility...
Yeah not sure teams will work
You can fill the tab list with fake players and then sort them to hide your player
Why doesn't AsyncPlayerPreLoginEvent finish before PlayerLoginEvent is fired
Simply being async is not a justification though... as you know it's completely possible to schedule an event to run on the next tick after an async task is finished
Its perfect justification. Async means it runs on its own thread. No guarantee it will finish before teh main thread
It all depends on what you are doing in the Async thread. You could take 10 minutes and it will obviously not finish before the Login fires
Its Async, NON blocking. Own thread
May I ask what exactly you're trying to achieve?
If ignoreCancelled is false, will this mean that if I cancel any event that has ignoreCancelled set to false and is of the same type and happens later won't run?
So what event should I use to access a database to grab player stats
if set to false it means your event will still be triggered even if another plugin cancels the event before you
.
eh
what
open a sign editor with packets
if true your Listener will not be called if another plugin cancels the event before your it gets to your plugin
Alright
the fact that the PlayerLogin triggers before AsyncPrePlayerLogin finishes
Seems weird but I won't question it
So basically I'm going to have to make my own implementation to stall a player from logging in until I've done stuff like check if they aren't banned, and getting their stats? since AsyncPrePlayerLogin doesn't finish in time
Look at the Luckperms source. it uses the Async event to do what you are trying
Are you properly blocking the thread ?
I have used AsyncPrePlayer a bunch of times to do blocking operations and it properly delayed player joining
Wait I've misunderstood the bug I'm having my bad
If I connect to the server as it's loading the world up (almost ready to accept players to join), I'll join the server without that event firing (it's registered on enable)
It does? That would be news for me. Ive used this event to check for bans and load a players data for ages without any issues.
See my newest message
What version are you on?
Tbh smile might be a spigot thing (idk if you are running paper) but we have some patches there
ScoreboardManager manager = Bukkit.getScoreboardManager();
Scoreboard board = manager.getNewScoreboard();
Objective obj = new registerNewObjective("e", "a");
}```
im on 1.8.8
board.registerNewObjective
oh right
I don't think I've ever tried to initialize a method as a class before lmao
well in python methods are objects and classes are objects soooooo
how did they make it organized with scores set to 0?
You send them to the client in that order
Is the opened ender chest an actual block?
Yes
Can I somehow spawn an opened chest like that without no physics? that means I can get through of that block like it doesn't exist.
No
Alright, thank you
what that mean
player.sendBlockChange
sends a change with packets
imagine you have 15 of those and your just sitting there waiting for the thing to stop spinning lmao
anyways im having a problem with sendBlockChange
why when i send the editorPacket
a sign opens and then closes
and no chest spawns, i checked sending the change right at player's location
Hey do you know how I can cancel an EntityDeathEvent ?
No thats not implemented
respawn the mob with the previous health it had
Yeah, not gonna do that xd
I just want to rotation and the chest opening
yep that is
could work better
check if health will be 0 by using event.getDamage()
smh
dont forget to throw new RuntimeException
I can't cause I have a Event when a entity spawn x), I want change his name when he is dead but I want he nnot die
add a metaData tag to the new mob you spawn
and on entity spawn ignore if it had meta data tag
or
dont forget to access put Unsafe stuff too
use the even brush said ^
ngl i played around with that class
its so weird
getDeclaredField("theUnsafe");
i was so confused when reading examples, because i thought it needed to specify the field that was unsafe, not the string "theUnsafe" lmfao
rust is better in the unsafe stuff
you can declare methods as unsafe in rust
also like doing stuff which cannot be done by default
well i was trying to modify a private final static field in minecraftserver for my case
ight
so i couldnt really set that as an unsafe variable even if it was rust :((
ah you can even access private fields in rust
thats rigged
why when i send a block change with oak sign, nothing will change
not funny
well you arrre sending a empty block data object
💀
wdym empty block data
whats supposed to change when it doesnt know what to change?
oak sign
yes that just creating a empty OakSign block data
ok how to make it not empty
should be a method to Block#getBlockData() or similar
just send that after you change it
does the return type of Bukkit.createBlockData has methods to change its state?
it would only change it for that block huh
i mean not the block in the world file
just client side
Objects::requirenonnull 😂
for that you need packets and send a fake sign to the player
idk how that all works
but any type of blocks you only want one client to see, need packets
{
player.sendBlock.......
}``` you could use that Java feature it's more clean IMO
tbh i use that an my entire codebase besides that part ty for reminding me
idk why i chose to use that there
i guess there a .forEach hidden there too
cringe
yee it just runs off the page
why returning when the current entity isnt a player instead of skipping it?
i used this method a lot before (block is a material)
and it worked
and the world block that was in the file was not the thing that i sent
skipping in lambda is return iirc
but now it is not working with signs in 1.18.1
nope that will just end the method
im just trying to open a sign editor to a player with packets
but the clients needs a sign at the exact location
and you cant use continue in a lambda you need a normal for loop 🥺
(i send the editorPacket)
well i changed it now, so it only fires if instance is a player
🎃
but the sign opens and instantly closes
Try using your mc client debugger
you can use it in the launcher settings
how can a sign open?
using optifine 💀
sign editor
aah
Thats my first time with MetaData do you know why thats not work ?
\\KILL EVENT
Entity entity = e.getEntity().getWorld().spawnEntity(e.getEntity().getLocation(), e.getEntityType());
entity.setMetadata("compacted", new FixedMetadataValue(Main.getInstance(), true));
\\SPAWN EVENT
if(entity.hasMetadata("compacted")){
entity.removeMetadata("compacted", Main.getInstance());
Bukkit.broadcastMessage("00");
return;
}
like this
modded versions have that optionto open it
but im trying to open it
also i find anvils better for things like that
signs have a limit of characters thats very small
how can client debugger help
removeMataData(string) is all you need for second part
other than that your good 
sec
what
ok how can it help
should show any invalid packets/blocks states in there
I can't do this
sec lemme check our src
it needs a plugin?
@noble lantern nothing
ok
okay yes you put the plugin instance there mb
im not entirely sure then TBH
simply there is no sign being sent to the client
np 🙂 so do you why thats not work ?
ive never really worked with sending fake signs to a player
What doesnt?
idk x) When i kill a pig and I respawn it thats didn't say "00"
would need more info on the code for that
🥲
what is that instance check
spawn the mob one tick later in a task
if (!(e instanceof something) && otherShit) {}
btw
How can I spawn a opened Chest with Player#sendBlockChange
I'm guessing cast it to a Chest?
https://www.spigotmc.org/threads/make-a-chest-look-open.256243/#post-2540220
Idk if Chest has anything for this tho
just something i found on google
Same didn't work
Entity entity = e.getEntity();
entity.setMetadata("compacted", new FixedMetadataValue(Main.getInstance(), true));
new BukkitRunnable() {
@Override
public void run() {
entity.getWorld().spawnEntity(entity.getLocation(), e.getEntityType());
}
}.runTaskLater(Main.getInstance(), 5L);
quick question, should I use append or an if statement to check for null
you mean assert?
im not entirely sure then tbh hmmm
tbh ?
to be honest
try debugging
see if that meta data exist directly after spawning it in
yeah
ok x) sry I'm French I don't have all word like this
i prefer if because you can throw appropriate errors to the user
baguette
😂
i also know chroissant and maison
Do you know why when an Entity spawn the class loop 3 times ?
its likely other entites spawning in the world as well
anyone know why anything that could be null has this on it. Really annoying when it will never be null (that one highlighted is only like that as I didn't import Player)
It's probably saying that because you're not casting to Player after that
So it doesn't make sense to check instanceof
I sorted that line out but it is the same for sender, cmd, label and loads of other things in different classes
Send another example for those
Hi ! Do you know how to move (to let him walk, not teleport him) an EntityPlayer using NMS in 1.18.2 ?
Ah, the first one is because the superclass annotates them with @NotNull so it wants you to do that as well, and ItemMeta actually can be null for the second one.
Ok thanks!
any ideas how to fix this
loading is bricked
it started
but it took like half a minute to start loading it
#help-server for server help
If I want to use vault in my plugin, I will need both vault and an economy plugin in my server right?
well vault has economy built into it
Oh, so is it not necessary for testing?
Huh, I'm getting this for some reason altough I have vault installed on the server
20.04 16:26:27 [Server] INFO org.bukkit.plugin.UnknownDependencyException: Unknown dependency Vault. Please download and install Vault to run this plugin.
is vault loading
How do I check that?
Do /pl
It does appear on /plugins if thats what you mean
green or red
green
Your plugin is probably loading before Vault then? Did you add depends: into your plugin.yml
Huh, it now loads but because of this piece of code:
private boolean setupEconomy()
{
RegisteredServiceProvider<Economy> economyProvider = getServer().getServicesManager().getRegistration(net.milkbowl.vault.economy.Economy.class);
if (economyProvider != null) {
economy = economyProvider.getProvider();
}
return (economy != null);
}
@Override
public void onEnable() {
if(!setupEconomy()){
System.out.println("Disabled due to no Vault dependency found!");
Bukkit.getPluginManager().disablePlugin(this);
return;
}
}
It disables itself
Probably because you dont have an economy provider
So that would be the economy plugin?
yes
does anyone know how to make like a timer for auction items? like how should i do it
(every item has a time in ms)
should i start a new task for each item? or is there any efficient way of doing it
wdym by reloading an arraylist?
I'm trying to use method .reloadconfig()
but its not working for me
Someone said me you need to reload ur array list
Any idea as to why am I getting 'currency is null' when trying to deposit money to a player with my plugin using vault?
you should save it after reloading.
I tried everything
does it give any errors?
i forgot it
yeah
ok thanks
No, it says config reloaded still the values arent updated in game
20 ticks = one second
np ^^

