#help-development
1 messages · Page 759 of 1
nono
like this
/**
* Tries to look up a [value] in an enum, returning null if not found.
*/
Ahh
its inline
Gotcha
tbh i prefer the javadoc style it seems more precise but hey thats convention
Yup, I'll look into that
I get this error when exporting a spigot project
The following artifacts could not be resolved: io.papermc:paperlib🫙1.0.6 (present, but unavailable): io.papermc:paperlib🫙1.0.6 was not found in https://hub.spigotmc.org/nexus/content/repositories/snapshots/ during a previous attempt. This failure was cached in the local repository and resolution is not reattempted until the update interval of spigotmc-repo has elapsed or updates are forced
?whereami
In case you wonder how I approached the problem, this is what I came up with. I've ought to test it now haha
Good question
am I using paper or spigot
its the spigot logo on top left
spigot logo on this
I think im using spigot
You seem to not have added a paper repo
paperlib is paper so not in the spigot repo
And you are trying to use some paper dep
thats a thing?
What exactly
Shouldn't be
essx casually having a transitive dep on paperlib
I mean they might be hosted at paper repo
I don't know how freely people can use it
The docs of essentialsx should tell you exactly how to add it
But you seem to be adding paperlib
Yeah its a transient dependency on paperlib
Oh ffs
what does it mean
in basic english please
Essentials depends on paperlib and so your project also does
ok thank you
who here got too much time and wants to go error hunting with me
ive been looking for like
3 hours
and i cant find it
make new a project
add parts of the plugin chunk by chunk
and see that chunk causes the error
im not gonna rewrite 2k lines of code
because of a simple logic error
there are no errors
its a logic error
i just dont know where
What’s your problem
first of all ive done this a million times before no idea why it doesnt work no
Im saving data to a database
that works
when i retrieve the data it doesnt exist
so my code trys to save it again
and guess what
SUDDENLY IT DOES EXIST AND I CANT SAVE IT
AND I CANT FIND THE MISTAKE
LIKe
IM GONNA GO INSANE ISTG
That's strange debug each part of your database connection aswell if that makes sense
how to know if someone that has a open inventory is the same as the custom inventory I made?
like if 2 people has the same inventory open
I ain't worked with Database with Java so I'm not 100% sure
i did that....
like
literally
i added like 500 debug statements
and i still cant find it
the connection works just fine
the part that annoys me the most
do u check your database if it exists?
yes its a localhost i also checks if it creates the table which all works
its only about getting the data
that seems to be the only error
i beliebe
believe
but like
its 5 lines
and its completly correct
idk why it doesnt work
even these few lines i wrote to test it dont work
This is probably the result of a race condition where you read right before its being written to the DB,
start to write the data, and at that time the first write is done.
no its not
i could wait 20 seconds
and it say its not there
i could wait an hour
and it says
its not there
to put it simple
i click item
i put item tag in database
i click same item again
its supposed to say its already in database
but it doesnt
it trys to save it again
and then says its already in database as an sql error
I just came. Let me read the whole rant first
.equals returns true for the same inventories
What do I do
Show how you test this code pls. We need a bigger picture
Drink tea and carry on
the additional print statements are from within the database class
but the new config state
is so confusing
when do i send packets
does an event fire when the person passes the config state?
Your DB methods might be the problem. Show us the impl of your find and create methods.
or do i have to wait for them to pass the config state
alr but i dont think so cause i used it in 6 other plugins
give me a sec
actually
?paste
Gonna look at it later. Got called
alr :-
WAIT I GOT IT OMG
WTF
BUT HOW
THE UUIDS ARE COMPLETLY DIFFERENT IN BOTH METHODS??
Why are you passing the uuid using a String type instead of the UUID type?
cause there is no uuid type in a database?
.toString?
there is in some
thats what i did?
Neverming, it seems you fixed the issue anyways :)
Well, the hastebin does not have info code in it that one could assess it
i think i found hwy
yey
Bros codebase prob like ☠️
woooooow not i only have to remove about a million print statements
i error i did while turing the string back to a uuid.
I can only strongly recommend to use the inbuilt debugger from intellij or some kind of debugger, as it really makes your life easier when you can dynamically place break points
The home of Spigot a high performance, no lag customized CraftBukkit Minecraft server API, and BungeeCord, the cloud server proxy.
Well "remote" as in a local development env.
I don't think you can send the data across the internet, tried that once and it failed, I might have just done it wrong though.
aw man no ptero server testing
Well you could sync up your target directory with a remote online server and fire it up via SSH, im sure you'll somehow be able to write a script for that for IntelliJ
But for breakpoints and shit, nah
Sounds stupid have you thought about making a new plugin then recode the database system just in case something is triggering it within the plugin?
i already fixxe dit
Ah what was the issue?
Not really a script needed. You can connect intellij with your host and remote debug it
.
therefor it saved the data under the wrong uuid
Ah
cause it saved under my playername but i tried revieving it from my uuid
So it was something with your DB methods 
nope
it was in my model
someone here yesterday begged me to turn the uuid into a string and other way around inside my model
so i did
i made an error there though
but i completly forgot i even mde it
I use UUID then convert the UUID into the string
Or you could use a DB that supports UUIDs.
what db supports uuids
I was talking when I use configs tho
yh
MySQL for example
wait what
Yeah they support loads
mysql supports uuids?????
Or Postgres
Yeah
Wait let me double check
A Computer Science portal for geeks. It contains well written, well thought and well explained computer science and programming articles, quizzes and practice/competitive programming/company interview Questions.
I see, they use a binary format for that
yeah there is just the uuid helper function
but thats still pretty useful
no need to use strings
Well, shows that Postgres is just the better DB imo. It has a dedicated uuid type.
there are tons of db engines that support uuid type lol
strings are still not the end of the world
everything better than saving player objects into your db 💀
They are kind of garbage in sql dbs
oh well
MariaDB has one as well
yeah mysql is just bleh
i like mysql
iirc even msft sql server supports it lmao
Its very... basic
how can you look at this cute doflin and not like it
I'm trying to create a player message util do you think it's too much to keep recalling a new class should I just make an instance of that class to make ```java
public class MessageUtil {
private final String message;
public MessageUtil(String message) {
this.message = message;
}
public static MessageUtil message(String message) {
return new MessageUtil(message);
}
public MessageUtil setPlaceholders(Player player) {
String raw = PlaceholderAPI.setPlaceholders(player, message);
return new MessageUtil(raw);
}
public MessageUtil color() {
return new MessageUtil(ChatColor.translateAlternateColorCodes('&', message));
}
public void send(Player player) {
player.sendMessage(message);
}
}```
I would def rename this class because its not a util class but a wrapper
mmh okay, I will do thank you for the tip
But keeping it immutable and creating a new instance is fine
Okay thank you, I wanted something easy to use and it might be helpful aswell with commands and events
I really wish java would only error when attempting to run code from a package that is not present instead of erroring at the moment it accesses the class
That's one thing I need to learn more about is naming classes
Command is not run and usage message is given
?mappings
Compare different mappings with this website: https://mappings.cephx.dev
?notworking
"Does not working" is a useless statement. Please describe what exactly is not working, what you expect it to do, and what actually happens. If you get any console errors, also ?paste the entire stacktrace.
that's for me guys no worries

are the != and == operators faster, or just as fast as the <,>,... operators when used on integers?
tryina kill a runnable on player death
Smelling premature optimizations
im using death count statistic
imagine if it were just mappings.dev
🥸
yes, but its a very simple one so i dont see why i shouldnt do it
this part is much more suspekt lol
wait im dumb
thats not what im supposed to do here
they can be equally fast. but even if they weren't, this isn't something you should think at all
Yeah but
what hes tryna make is a util
he just ended up making a wrapper
Use static
and remove the constructor
I think his approach is perfectly valid. His class clearly has states, which makes it pretty infeasible for static usage.
how does it have any state?
It's just a bunch of utility string methodsas an object for some reason
the field?
public class MessageUtil {
public static String setPlaceholders(Player player, String message) {
return PlaceholderAPI.setPlaceholders(player, message);
}
public static String color(String message) {
return ChatColor.translateAlternateColorCodes('&', message);
}
}
could be simplified to this lol
anyone here worked with PAPI? i want to know if i can just enable the remote debugging like normal for extensions or not
it's just showing the placeholder text when calling the parse me command
No reason to have a field
there is arguably no reason to make this class anyways
but whatever
wrapper vs util class
"https://www.spigotmc.org/threads/sending-players-to-bungeecord-server-through-bukkit-spigot.368837/" how i can it with Velocity?
this case doesnt require a wrapper
?whereami
i know
I'm trying to make a message builder wrapper which makes the static invalid for my use
youre trying to make a message builder?
but i am using Spigot
also its showing the version and author correctly wtf
am i not understanding how papi parse works?
You just said velocity
The builder pattern is a design pattern designed to provide a flexible solution to various object creation problems in object-oriented programming. The intent of the builder design pattern is to separate the construction of a complex object from its representation. It is one of the Gang of Four design patterns.
read this
i want tp player in an another server using Spigot but is Velocity
Just use the plugin messaging channel
how?
no
is normal
hey smile do u have papi xp?
Sure
The home of Spigot a high performance, no lag customized CraftBukkit Minecraft server API, and BungeeCord, the cloud server proxy.
im calling /papi parse me %placeholder%
any clue? It clearly packaged correctly or it wouldnt spit out it's version on the papi info thing
Isnt getVersion called way earlier already?
uh... I'm not sure. but how could that be the issue
Show how you register your placeholder
u can use --null if placeholder doesnt require an online player 😛
i wont velocity dont Bungeecord
its depending on another plugin and that plugin provides specific player data hence me using me
i know
As shown in their detailed documentation
https://docs.papermc.io/velocity/dev/plugin-messaging
You should read that
like seriously why is it not calling the onRequest method lol
That’s true but I’m not exactly doing it like that as my end result is to send the message
is there a way to run a task sync inside an async task?
right now im running 2 different ones, one sync and one async, the async one gets the data for the sync one to put out there to the server. but cause of server latecy, the sync one is happening after the async and not doing the thing I want anymore.
This explains how to load data async and use it sync
my problem is that it's a repeating task
it's not just get data, apply data.
it does a check every 2 seconds
So you have 2 tasks, one async and one sync. And each task runs every 40 ticks?
yeah
How about you still do what i posted and just let the async task start a sync task which applies the data.
i made the async to check the data and make every verifications/updates on it, and then the sync to update what the player gets
Unless you need to sync task to run independently on a different rate.
so i make a repeating async task that once completed does the sync(not repeating)?
Right
oh i thought your tutorial was to not repeating async tasks
It was for async IO in general
oh ok, i checked it qucikly and saw just normal tasks.
sorry about that
thanks, i will check it out
Even without unit tests they are completely irrelevant. This is just IntelliJ being absolutely stupid
This is a typical case of "oooo, but security!" even though the bug cannot be reproduced under the conditions whatsoever
Hey, can someone help me setup HikariCP? I can't get intelji to import the libraries after adding the decency into my pom
Reload the maven project
Dont know what that means. But you can send your pom and the code you are writing which doesnt "get imported"
?paste
This is my class for hikari and it wont import
https://paste.md-5.net/vujanicaxi.java
Those look like Hikari imports to me...
yeah, I know, but the import isn't tho
Alright, how do you compile the project?
through the build/run
Do a maven clean and then install
install or package
after clean
And always build your projects like that. I have no idea whats in your current run configuration but im suspecting that it doesnt use maven.
that worked!
nvm
it did not work xD
and it works
buggy, but it worked, thank you so much
Anyone can tell me a tutorial video for making sub commands appear as a suggestion in minecraft? plss
How does one extract a Folder from a JarFile at Runtime
Are you wanting to recursively copy the files from your plugin into its config directory?
I have a method for this you can copy/paste if you'd like,
https://github.com/2008Choco/DragonEggDrop/blob/master/src/main/java/wtf/choco/dragoneggdrop/DragonEggDrop.java#L261-L280
CodeSource src = plugin.getClass().getProtectionDomain().getCodeSource();
if (src != null) {
try {
ZipInputStream zip = new ZipInputStream(src.getLocation().openStream());
and this way you have access to the folder
oh
there's getFile?
nice
Yeah, protected under JavaPlugin
is it well protected?
I sure hope so
You should be able to write protected, but also PROTECTED to let Java know that you're being very serious 
final and sealed are very real at runtime lol
if you mean fields sure, if you mean classes and methods that takes a bit more effort
you know what else is fake? the entirety of the os kernel
entityId is just a server-wide integer counter for entities right? its not something special?
yeah well I was actually going to replace entity IDs with UUIDs till I realised they're built into the mc protocol
i guess ill add both
id say it's entities version of uuid
alright so its just a numerical id tx
it's the entity id in the protocol
well it does return an int
No I wanna extract the minecraft data files from the client Jar I download at runtime
Dont ask why, its a long story
because it's much easier to just write an integer and the UUID is only used for serialization type deal
you'll never have enough entries to hit the flag bit so who cares
just compress it
as a byte
works every time
kotlin?
uh sure who needs more than 256 entities
💀
Hello i can't use EntityPlayer import import net.minecraft.server.level.EntityPlayer; but i can use import net.minecraft.server.level.ServerPlayer; why thats happning
😂
something something mappings
import everything;
Solved ✅
💀
holy
basically using namespace std;
wait nvm
what did static do exactly in imports?
Means you can call static methods without the class name
namespace std indeed
import **.*
so much power!
i just wanna try it just to see how long it takes to find a missing class
*** java.lang.instrument ASSERTION FAILED ***: "!errorOutstanding" with message transform method call failed at src/java.instrument/share/native/libinstrument/JPLISAgent.c line: 876
now that is an error I haven't seen yet.
Seems like it was caused by a stack overflow though
Very minor experience
let me put it this way
did the code you wrote run
cuz that damn function aint getting called
nice one dad
hey stop laughing i genuinely have no idea why it's not catching the 2nd breakpoint
its just printing back out whatever i put into papi parse
As far as I know yeah
What are you putting into parse
something something ?nocode
https://github.com/Geolykt/Presence/blob/main/src/main/java/de/geolykt/presence/PresencePlaceholders.java yeah I think that worked. But that is code from 2 years ago
Are you parsing the right thing
Did you register your expansion?
probably yes and yes in that order
your placeholders will be under the name of your expansion
this means the exception call chain is too large
Yeah figured it out
So it’s not just %poop% its %myexpansion_poop%
hm interesting
was it a circular depedency ?
A recursive algorithm but I forgot the part where it returns
wouldnt that cause a stackoverflow error outright
ah that would do it too lol
Yes but I was in my debugger so it also caused another fancy error
catching stackoverflow exceptions is interesting to do
you can inadvertently cause more threads to be created lol
I once did that
whats the exact way of formatting that? I tried and got no result
do i have to compare with the entire string, i.e. ...equalsIgnoreCase("myexpansion_poop") ?
It was a treefeller plugin, if it recursed too much I caught it and then said the tree was too big
Kek
lol
lmao
is there a uncatchableexception for this thing?
wdym
this
just catch Exception, much easier
You should never catch Error though, as some subclasses like ThreadDeath are actually not to be caught as-is.
Paper?
Catching error will catch oom
At which point idk what you’d do xd
actually what the hell...
r u talking to me or
Yes but actually no
how would i go about making my /ban command take priority over the vanilla one?
@quaint mantle Do you have bukkit on your runtime classpath?
Is the a main method
wdym
Tf are you doin
im just making a bunch of vector and location utils
I dont need the server to be running for this
should do this when you are out of memory 😉
cause the location and vector classes are like data classes
they are only primitives
Lol
Or could you just give us your pom or build.gradle in conjunction with the script you use to start the main method up (sorry, I don't use IJ so I cannot be more specific than that)
That looks right
Don't forget Elgar either!
he uses it too?
There are literally dozens of us!
well better then IJ I suppose 😛
I know that this screen is actually hiding some important detail from you, could you expand everything there?
Meanwhile md on netbeans
I basically need a poke at the actual runtime classpath
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>me.skinnynoonie.bukkit.locationutils</groupId>
<artifactId>BukkitLocationUtils</artifactId>
<version>1.0-SNAPSHOT</version>
<properties>
<maven.compiler.source>17</maven.compiler.source>
<maven.compiler.target>17</maven.compiler.target>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<repositories>
<repository>
<id>spigot-repo</id>
<url>https://hub.spigotmc.org/nexus/content/repositories/snapshots/</url>
</repository>
</repositories>
<dependencies>
<dependency>
<groupId>org.spigotmc</groupId>
<artifactId>spigot-api</artifactId>
<version>1.20.2-R0.1-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.jetbrains</groupId>
<artifactId>annotations</artifactId>
<version>24.0.0</version>
<scope>compile</scope>
</dependency>
</dependencies>
</project>```
oh
wdym
The de-jure the classpath should be right as per your pom - however you don't run your project like you should so idk
As I said, the runtime classpath will be hidden deep within this screen
k
How you can access this I cannot say
did you ensure that your import is for the Bukkit vector and not the JDK vector?
There should be enough people out there that use IJ according to all people that make fun of eclipse's userbase size
yeah it says in the error does it not
But alas that is really not the case
I don't fucking know
Modify options? Or the cogwheel? Idk.
Running a maven project from within the IDE
by chance what jdk does the log say you are using?
i think 17
are you sure? Beecause the way you are defining 17 is no longer supported if I remember right and need to define the maven plugin to set the jdk version explicitly
yes that can happen when you don't use the right JDK version
I mean really you should be using unit tests and run them from within maven but whatever
idk what any of that means lol
Make sure to have that checked
As I said, IJ is big stupid
Worst IDE I have ever touched - and I have only touched two so far.
Do you have this -cp <no module> thing next to module not specified?
cause it's not saving
You need to check use classpath of module
Oh - and add dependencies with provided scope to classpath
yay it works
That is off by default for whatever reason
can u explain this stuff tho
sounds important
Basically by definging a test framework via https://github.com/Geolykt/Presence/blob/main/pom.xml#L90-L96 and then defining the surefire plugin via https://github.com/Geolykt/Presence/blob/main/pom.xml#L109-L113 you can run unit tests via maven (or more specifically, mvn test - although they are also executed with mvn install and mvn deploy).
Unit tests can look like https://github.com/Geolykt/Presence/tree/main/src/test/java/de/geolykt/presence/test in practice - they are always within the src/test/java folder (as opposed to src/main/java)
Unit tests are frequently used to test out small parts of your code and verify that everything runs as intended
Also I really like that it has to be an eclipse user of all people that helps people with IJ problems.
Nah, it's just a bunch of people that say that noone will help with eclipse issues 😆
are you just copy and pasting the methods into a test
either its some hidden menu item
or their cache is faulty
and need to get rid of it
whats the reasoning behind running unit tests on build
which ironically I don't understand what is up with that cache if so many people end up having issues with it
should I impl unit tests on my skyblock stuff
Verifing that nothing broke between builds?
there is all kinds of stuff you can test for
Yeah revolutionary - you can change source code!
i do it after writing some code, not after writing a lot of it
I'm only at ~150 classes and ~9k lines of code and I want to add a bunch more before I actually add real content
You can also use tests to not test for stuff too
may be wise
I'd need to make a whole mock platform
and it's annoying
but it's a great way to add ~5k lines of code without doing anything meaningful
@quiet ice how long have u been coding?
too long
either this or I merge this current test branch and work on a platform-agnostic menu system
which prob means platform-agnostic itemstack system too
4 years? Maybe even 5 by now
unit tests took like 10 minutes
sit down figure out how to properly setup JUNIT and you're good to go
the only downside with junit tests is that they are only as good as you code them
unless you're doing something fairly common I can't see any other way to do it
etc if you're working on sockets you can test by just throwing random ass data at it to make sure it fails gracefully or whatever
be harder to find something less common like did my item get put in my minecraft chest
what are unit tests 😭
its just a check to see if you're code works as expected
if you use maven surefire plugin the tests are run at c ompile time
and your build will fail if your tests fail
generally they are good for ensuring if changes occur to a system or you're writing a system no matter the implementation you recieve the desired result
Hey, anyone got an accurate server sided onGround check?
Full tutorial on creating Unit Tests in Java with JUnit!
Do you write Java code that you're just not confident is 100% right? You can create unit tests using the JUnit testing framework to verify your Java code, and I'll show you exactly how to do it.
Many beginners don't know there's a great way to test their code with simple, fast tests and...
this is a good video right
problem with that is that movement is mandated by the client
it has complete authority
im getting this error in the console:
Caused by: java.lang.ClassCastException: class org.json.simple.JSONObject cannot be cast to class org.json.simple.JSONArray (org.json.simple.JSONObject and org.json.simple.JSONArray are in unnamed module of loader java.net.URLClassLoader @2b71fc7e)
and this is the line its screaming at:
JSONArray ja2 = (JSONArray) jo2.get("textures");
I mean. Thats as descriptive as it gets. The "textures" property is a object {} instead of an array [] meaning you cant cast it to an array.
Yeah i know that one but it can be spoofed
so can onGround :kekw:
take their location, check if its %0.5 = 0, check if block below em is solid
ur only getting an approx anyway
and remember to check the adjacent blocks if player on edge
how would i fix it
take location, move down a tiny amount and check if you are inside a blocks hitbox
Ok thx
Dont cast it to JSONArray
what do i cast it to then
What about slabs
Edges yes, that could be an issue
You can combat that by checking each corner of their bounding box
To whatever is in the "textures" property. Im guessing its an actual JSONObject so you dont cast it to anything.
there is another array in textures tho
Are you talking about this here:
{"textures":{"SKIN":{"url":"http://textures.minecraft.net/texture/46cf412fb0bf1934da4eaf29d9079653d3d20b29e23d0f037bb043491e25af01"}}}
how did you know lmao
There is not a single array in this
alternatively just store the serialized skin lol
If you're on ladders does the client send it's on ground?
{
"textures": {
"SKIN": {
"url": "http://textures.minecraft.net/texture/46cf412fb0bf1934da4eaf29d9079653d3d20b29e23d0f037bb043491e25af01"
}
}
}
I would usually just use Gson for this:
Gson gson = new GsonBuilder().create();
String json = ...;
String url = gson.fromJson(json, JsonObject.class)
.getAsJsonObject("textures")
.getAsJsonObject("SKIN")
.get("url")
.getAsString();
Yeah with json-simply its hella ugly in a single line
JSONObject jo = ...;
String url = ((String) ((JSONObject) ((JSONObject) jo.get("textures")).get("SKIN")).get("url"));
JSONObject jo = ...;
JSONObject textures = (JSONObject) jo.get("textures");
JSONObject skin = (JSONObject) textures.get("SKIN");
String url = (String) skin.get("url");
This is cleaner
thank you
btw, what do you need this for?
Its... already on the internet. You could just get the image from the url and not transport it XD
I see
the code is falling of my screen 😭
Thats where you know that you need to replace your lambda with an actual method reference
unfortunately I can't :(
I mean I could make a method for each type but that'd get cluttered
like for this one making a method was good enough
ExplosionPrimeEvent includes tnt explosion?
Should be covered
can't that be replaced with a for loop?
but the menu type
I'm sure the reflection required will be much less strenuous then doing it the current way :P
probably gonna switch over now
Reflection really is quite easy
testing my new database abstraction system
forgot that I need to copy builtin config files

I enjoy this lib https://github.com/EsotericSoftware/reflectasm
why is intellij deciding to explode with my cpu
It’s working
Jetbrains now mines monero on free versions 
I wouldn’t even be mad
If it used very little cpu time
Letting them take 20% sure
avg jetbrains experience
using 90% cpu and 14gb ram
Its a java app so its very lenient with the resources it is given 🙂
and copilot making sure to break because intellij released a new major version where they fixed aws and kubernetes support and that one bit of text in a nested menu
ok my logic is broken
.. how
only u know
Please don't use reflection in CraftBukkit code
I'm begging you lol
If you're going to loop that, at least just make an array of the menu types and iterate with an index
I was joking
I scared you tho :P
Smh
you'd have to make some insane fucking reflection for it to be anywhere near as effective as using a map
It’d be funny
Stop using it.
I present to you Notepad++, will use less of your CPU and does the same.
:Kappa:
how come i have to relog to see the changes to this block?
newBlock.setType(Material.STONE);```
Do you have other addons?
I think there is a second parameter in settype you can try. It shouldn’t be needed though
What's the best approach to reduce Protection Level Programatically?
I'd like to keep the respected Protection Level on an armor piece, but in the code, half it.
nope
the second parameter you can add is applyPhysics
but i dont think that will help lol
also i have tried updating the block state which also didnt work
Block newBlock = world.getBlockAt((int) coordsx, (int) coordsy, (int) coordsz);
blockState = newBlock.getState();
.setType(Material.STONE);
blockState.update();
Oh nice, I'm also trying to make one using rust
use block.getState() to get a snapshot state of a block which will not be modified. https://hub.spigotmc.org/javadocs/spigot/org/bukkit/block/Block.html
declaration: package: org.bukkit.block, interface: Block
fixed it, was running it Asynchronously :|
Smh
yep 🤦♂️
mm still struggling with my cyclic dependencies code (I have no clue why, it should work)
maybe sets should be replaced with lists 
grr I fucking hate this
How do you get cyclic dependencies in your code?
config based
Ah
and I want to check for cyclic dependencies but chatgpt's algorithm doesn't work
so imma write my own :)
should just be as simple as making a linkedlist of strings
and if I find a duplicate element it's cyclic
Write something else. A join message plugin for example.
lmao
nah this is a passion project
yay it loads
now let's try cyclic
shit
ah, yeah
okay I revamped the config
a lot ismpler now
whys this happening:
Caused by: java.lang.ClassCastException: class java.lang.Long cannot be cast to class java.lang.Integer (java.lang.Long and java.lang.Integer are in module java.base of loader 'bootstrap')
this is the code that is being bad:
if (layer == true){
return new BufferedImage[] {PlayerFace.get(Objects.requireNonNull(player.getSingle(event)).getUniqueId(), size.getSingle(event), true)};
}
else{
return new BufferedImage[] {PlayerFace.get(Objects.requireNonNull(player.getSingle(event)).getUniqueId(), size.getSingle(event), false)};
}
} catch (Exception e) {
throw new RuntimeException(e);
}```
yay
is there something wrong with calling events e
no
you can if you want
some people are against naming variables single letters
if you're working with a group ask your group what they prefer
what about player p
same logic
if it's only going to be you working on it do whatever you want
if you think you might someday want others to help it wouldnt hurt to be a bit more descriptive with your names
especially if you're dealing with multiple players in the same context
like an entitydamagebyentity event
having your vars be p1 and p2 is more confusing vs attacker and victim
Or damager vs target
@EventHandler
public void onTabComplete(TabCompleteEvent e) {
if (e.getSender().hasPermission("admin.colon-commands")) return;
if (e.getBuffer().contains(" ")) return;
e.getCompletions().removeIf((s) -> s.contains(":"));
}
why doesn't this work?
no errors, just nothing happens (colon commands are still tab completed)
it's 100% registered as other events in the same class work too
There is something wrong with e especially
Exceptions have e
Use verbose names normally, a bit less verbose in functions
yeah thanks, i'm more concerned about how it doesn't work right now though
yaml looks so bad now :(, toml is truly superior
Found out event isnt even running
The asyncchatevent is in the same class and it works fine
@EventHandler
public void onTabComplete(TabCompleteEvent e) {
System.out.println("1");
if (e.getSender().hasPermission("admin.colon-commands")) return;
System.out.println("2");
if (e.getBuffer().contains(" ")) return;
System.out.println("3");
e.getCompletions().removeIf((s) -> s.contains(":"));
}```
nothing gets printed at all
Need help with that?
I've done that before
Yes
It happens when you type in a command
And then you try to auto complete
with tab
It only runs after you type the command I think
Yeah pretty much
Does it not even print 1?
nope
Did you register event?
How sure are you?
1-150
yeah boi code leak time 🔥 🔥
This fixed it
Thank you
I just changed it into that
That event must be broken or something
You're probably using it the wrong way
It works fine for me
I use it for auto completion
how complicated is it to edit a villagers prices
alr thx
how to check if 2 players are viewing the same inventory? I try to use InventoryClickEvent with getViewers but it doesn't work
Hello, do you know a good tree blocks finder algorithm ?
in what way? like naturally connected log blocks?
like that yes
recursion
not sure if there is a universal algorithm for that case
but you could look up other treechoper plugins
I just want the way to a good tree blocks finder algorithm
I'll check
You could use recursion, find all the adjacent faces/blocks, add them to some universal list I suppose and stop when none are found. And you could add limit etc
not me detecting my wood house
that's exactly the problem
<insert troll emoji here>
What is?
detecting the wood house
i mean you could use recursion and additionally check for a leaf sphere at the end of the tree
You could use recursion
but if someone broke a leaf?
humm
I think it'll solve your problem
it wont
He's trying to detect a tree, no?
Thank you!
https://github.com/SourceWriters/SmoothTimber/blob/legacy/src/main/java/com/syntaxphoenix/spigot/smoothtimber/compatibility/logblock/LogBlockResolver.java
you could check for player placed blocks and ignore them
@cinder abyss Could you explain what you're exactly trying to do?
But when the server restart...
yes, but just simple recursion would also detect every wood house in as a tree
thats what he doesn't want
cutting the tree when breaking any of his wood log
And you don't want houses to break?
you could use block pdc for that
Tree capacitator
exactly
because a house is not a tree
(like a house is not a motel)
(private joke)
okay I'll check on internet thanks!
too heavy
I want something light and fast
an algorithm
By any chance,
that would be part of your algorithm
no
or just natural trees
natural trees
then you have no other choice
It'll detect
cause if you want that, you can just check if the block is naturally spawned
okay thanks
why not
why ?
save every block human place or what
but it will correctly work on newly generated block
exactly
or more like flag the block as human placed
hummm
or
I heard you can access biome / world generator
I know
You can get the block at that location placed by world generator
and then what, save it?
hummm
no, cause then you'll know it's naturally placed
and no need to check if it's a house
Well, I'll just try thank you!
or if you just want a simple solution use PDC
there is no method to check that
i just said you can cheeck if the block was naturally generated by accessing world generator
unless you're saying there is no supposed method to check that
cause I remember vividly someone asked that here before as well
There is no method in worldgenerator to tell if a block was placed by it.
Interesting
I must've been hallucinating
well good luck
o7'
?blockpdc
Learn about CustomBlockData here:
https://www.spigotmc.org/threads/custom-block-data-persistentdatacontainer-for-blocks.512422/
Can't you just give each block that is placed not by worldgen a pdc
jokes on you
Yo I've got this stringlist in my config yml (assume that the nulls are actually populated with uuids). It'll always be the same length (8 items), is there a way that I can set a specific index individually or must I set the whole stringlist at once?
The whole list is a value. If you have to load individual elements from it then a list is not the right structure.
Oh okay, I thought about doing an individual config value for each one (e.g. holder-0: blah, holder-1: blah...) but I thought that would be bad practice lol
Should I do that way instead?
If you have exactly N elements then this is probably better.
But what speaks against just loading the whole list and keeping it in memory?
Never came to mind
I'll do that instead
You should really define the scope of your data 🙂
Read the The scopes of data section of this guide
https://www.spigotmc.org/threads/working-with-data.562421/
I wonder how wedit handles cross-platform items 
Dont they have a huge abstraction which would allow WE to be used in pretty much any voxel game?
maybe 
thinking of making a whole menu engine for my skyblock shenanigans
needs to work across spigot and minestom
they both have their own itemstack api
Spigot's is mutable, minestom's is not

Should be as simple as making a cross-platform itemstack and inventory api and then just porting all my layer and selection stuff from my existing menu stuff
but that's the problem..
what if I make an nbt api
but then I have to deal with nms
ffs
I guess worldedit's item api is simple enough
this looks like an overweight version of pep
should I take the minestom approach of immutable discrete item metas
or the bukkit approach where all meta types extend a common point
think I'm going with the bukkit approach
I guess I'm early enough
watch me about to reimpl half of bukkit
bim bim bam bam
Yeah the minestom approach won't work because I don't have a huge nbt file
I could do it with a map 
converting these to a bukkit itemstack is going to be really monke
yeah, i don't think it's worth the platform agnostic stuff
I want to remake craftbukkit in forge
famous last words
It'll take a few years
Like everything and always!
My reason is: yes
Fabric is cool
But forge <:(
;(*
:(*
forge = visitor pattern everywere
why is fabric better than forge ?
@shadow night I actually got a better idea
I am going to abuse the everloving shit out of the JVM
but I actually have an idea to put spigot w/ fabric (stable)
Don't put spigot into fabric, put fabric into spigot
My friend is doing the 2nd and is almost done
I am doing the first so you get plugins in single player
Nice, nice that you got friends
When did I specify plural
Replace internal server with spigot
technically
Still 1 more than I have
how is that possible ?
Fabric has been put into like every java app in existance
Because it just works
Wait, why haven't we injected fabric into forge yet
Okay gaben
expectes
Damn good luck lol
Currently I'm implementing the final steps of the login sequence
how am i supposed to write junit tests for a bukkit plugin i mean it doesnt even have a proper entry point and the whole codebase makes 0 sense without its observer that is the server
You need to mock it like usual in unit tests
🙏
Or just code against the interfaces and use mockito
Hello, what is the default potion amplifier for PotionEffect?
0
Yes
okay thanks
Does anyone know why i get 309 errors in my mcp? all my com.google, com.mojang,authlib and org.apache, org.lwjgl isnt working
The heck is 309?
probably 309 errors
309 errors
Ah i thought http status
Dependency manager not set up properly i would guess
Hey,
I have this
final Block block = player.getLocation().getBlock().getLocation().add(0, -1, 0).getBlock();
When I check block.getType().equals(Material.AIR), non-solid blocks return true. How do I fix it?
?img
Can't send images? That's because you're not verified! Use !verify to complete verification.
Alternatively, you can upload screenshots to any image hosting site and share the link.
Here's some screenshot utilities that can use to upload images.
Lightshot: https://prnt.sc
Imgur: https://imgur.com/upload
Flameshot: https://flameshot.org
meow
check for block.getType().isSolid() instead
also, checking for air only is inconsistent because there's also CAVE_AIR and VOID_AIR
in caves your method would return false
and check enums with == instead of .equals() plox
Isnt this correct?
https://prnt.sc/g3fGCGfTyE_t
https://prnt.sc/tK3wMSW5z_MT
so true
why arent you using maven or gradle
the point is, i want to check if there is a block there, shouldn't things that are non-solid return that it is not air?
me?
well what do you mean with checking if a block is there
do you consider tall grass a block
so you only want to exclude air