#help-development
1 messages Β· Page 121 of 1
I didn't block you, you even left me on unseen π’
Are you talking about JavaPlugin#getPlugin(Class)?
if you wanna access your own, either pass it to your classes or have a static instance of it
Yap
otherwise look at the answer above
?
nvm i though you needed to access your own main class
Hi my server crash when i try my plugin this is the code for the summoning https://sourceb.in/HChcuXJX7N
and from image to particle https://sourceb.in/aEmTnmfwOJ
Show us the error
only crash without error and the server stop working when i do /test summon
and everytime i restart i am in the last location before typing it
If it's crashing there's going to be something in the log
https://sourceb.in/jmJgjbOGOc here the error
at it.zerotwo.fastparticles.LegacyParticleType.spawn(LegacyParticleType.java:120)
Going to need that method
Looks like you gave it some bad data
Just use the spigot api π
can you send on how i tried but nothing worked fine
Particle.REDSTONE are not usable in effect?
entity.getWorld().playEffect(spot, Effect.COLOURED_DUST, particle.get(spot)); in this way should work
7 years woah make me feel old
Time to move on
Excuse me a question guys, I have a main class that contains public methods along with public variables that are used in other classes. I created my APIManager class precisely for APIs and wondered how I could hide, for those who access the API through the main class, all the other methods and variables and leave a getinstance method or something similar to that to reach the APIs instead.
one of the ways to do this, is by using the private identifier instead of public on methods
Well, I have a data.yml file and a lang that are initialized when you start the plugin and are set aside within a variable that can be invoked by other classes. I also have various methods that require you to be in the main to always be used by other classes... how can I do?
Usually, APIs are just interfaces
Your plugin implements these interfaces to run something
And the other plugins can interact with the interface
hm, so youβre telling me I shouldnβt do a separate class for APIs and then access it via the mainclazz?
usually but not always
people forget there is differing classifications of API's
Stop mentioning you blocked me all your sentences, damn i just asked if you know c++
this sounds more like you need to better organize and refactor your code where you stick methods that are related in a class and so forth. Not everything needs to be in the main class
from this im getting
[17:36:18 WARN]: Exception in thread "Craft Scheduler Thread - 258"
[17:36:18 WARN]: org.apache.commons.lang.UnhandledException: Plugin NextBot v1.0-Beta generated an exception while executing task 46
at org.bukkit.craftbukkit.v1_8_R3.scheduler.CraftAsyncTask.run(CraftAsyncTask.java:56)
at org.github.paperspigot.ServerSchedulerReportingWrapper.run(ServerSchedulerReportingWrapper.java:23)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at java.lang.Thread.run(Thread.java:748)
Caused by: java.lang.NullPointerException
at java.lang.Class.isAssignableFrom(Native Method)
at org.bukkit.craftbukkit.v1_8_R3.CraftWorld.playEffect(CraftWorld.java:864)
at org.bukkit.craftbukkit.v1_8_R3.CraftWorld.playEffect(CraftWorld.java:859)
at it.zerotwo.nextbot.commands.MainCommands$1.run(MainCommands.java:71)
at org.bukkit.craftbukkit.v1_8_R3.scheduler.CraftTask.run(CraftTask.java:59)
at org.bukkit.craftbukkit.v1_8_R3.scheduler.CraftAsyncTask.run(CraftAsyncTask.java:53)
... 4 more
You're plugin has an ArrayOutOfBoundException
And a NPE too
At MainCommands.java line 71
i can't understand where
We can't help you since it's and EOL version (and not spigot π but nw)
Eol?
End of life
Oh
now i understand why it didn't work i used an new method on old method
i used method new on java and some method for 1.19
Thank you, I managed to do what I wanted after fixing 56 errors π
no more public things
PreparedStatement ps2 = connection().prepareStatement("INSERT IGNORE INTO `cuud` (NAME, UUID, RANK, GEMS, XP, KILLS, DEATHS, GEMBOOSTER, XPBOOSTER) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?)");
What is the problem of this, that cause this?
java.sql.SQLSyntaxErrorException: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'RANK, GEMS, XP, KILLS, DEATHS, GEMBOOSTER, XPBOOSTER) VALUES ('NeonOwlGery', 'bd' at line 1
this is weird
why is this one plugin struggling with MySQL, while others of mine are working fine?
wtf is wrong with Java novadays?
usually not java's doing man
gets the same error
you put it like 'RANK'
because im pretty sure its throwing because RANK() is sql function
Β―_(γ)_/Β―
hi im getting https://sourceb.in/lhPwVF0LOj an error data should be class org.bukkit.Particle$DustOptions got class org.bukkit.Color and i provided the color (1.19)
yea you're right
help?
org.bukkit.plugin.InvalidPluginException: java.lang.ClassCastException: class it.myke.identity.Identity cannot be cast to class it.myke.identity.Identity (it.myke.identity.Identity is in unnamed module of loader 'Identity-1.3.3-shaded.jar' @652160af; it.myke.identity.Identity is in unnamed module of loader 'APITester-1.0-SNAPSHOT-shaded.jar' @47c75a4d)
I simply installed via maven inside my plug-in, the Jar of my other plug-in to test its bees. I made the shade and this is the result
Did you decide to skip 1.8 support?
java.sql.SQLSyntaxErrorException: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ''RANK', GEMS, XP, KILLS, DEATHS, GEMBOOSTER, XPBOOSTER) VALUES ('NeonOwlGery', '' at line 1
yea pretty much i used some code in 1.19+ and i decided to change to get better support on version and lag free in some case btw why this happens?
What's your sql request ?
try "
that is error 100%
PreparedStatement ps2 = connection().prepareStatement("INSERT IGNORE INTO `cuud` (NAME, UUID, 'RANK', GEMS, XP, KILLS, DEATHS, GEMBOOSTER, XPBOOSTER) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?)");
show ur main class
I'll go check the jd when I can, but are you sure you can spawn particle asynchronously?
yes
Ahha... Then the code will eventually will not be executed. Great lol
?
package it.myke.apitester;
import it.myke.identity.Identity;
import org.bukkit.Bukkit;
import org.bukkit.plugin.java.JavaPlugin;
public final class APITester extends JavaPlugin {
private final Identity identity = (Identity) Bukkit.getPluginManager().getPlugin("Identity");
@Override
public void onEnable() {
System.out.println("Drago903 Identity's has been found! " + identity.getAPI().getUserIdentity("Drago903"));
}
@Override
public void onDisable() {
// Plugin shutdown logic
}
}
Use a backslash before it \ "
the code in base works fine the but the error is on the color but not sure
you mean like \"RANk"?
Give it https://hub.spigotmc.org/javadocs/spigot/org/bukkit/Particle.DustOptions.html#<init>(org.bukkit.Color,float)
also no need for async particles. They are already just sent as packets
declaration: package: org.bukkit, enum: Particle, class: DustOptions
then \"RANK\"
yes
for convert it to color to dust option? like the float is needed?
Wait why Rank is the only one with "" ?
Float is size. Just pass a 1
ok thanks
rank is sql function, so if you have column in that name, you have to escape it
honestly no clue lol
Cause some other of my plugins uses RANK as a column name, and they don't get flagged
but then lets rename it to RANG
Β―_(γ)_/Β―
RANC π
@chrome beacon will solve it then, as always... thanks the same
Get the Identity plugin in the onEnable
lets hope so
i mean it should be able to wirk with ", not sure why it doesn't tho
howeveristillneedtorealizehowicanrenameacolumn
Cuz its an autist- *cough cough π
And you should depend on it in the plugin yml to be sure it is loaded after Identity
java.lang.ClassCastException: class it.myke.identity.Identity cannot be cast to class it.myke.identity.Identity (it.myke.identity.Identity is in unnamed module of loader 'Identity-1.3.3-shaded.jar' @13890a8f; it.myke.identity.Identity is in unnamed module of loader 'APITester-1.0-SNAPSHOT-shaded.jar' @4639cd2f) at it.myke.apitester.APITester.onEnable(APITester.java:12) ~[APITester-1.0-SNAPSHOT-shaded.jar:?] at org.bukkit.plugin.java.JavaPlugin.setEnabled(JavaPlugin.java:264) ~[paper-api-1.19.2-R0.1-SNAPSHOT.jar:?] at org.bukkit.plugin.java.JavaPluginLoader.enablePlugin(JavaPluginLoader.java:370) ~[paper-api-1.19.2-R0.1-SNAPSHOT.jar:?] at org.bukkit.plugin.SimplePluginManager.enablePlugin(SimplePluginManager.java:542) ~[paper-api-1.19.2-R0.1-SNAPSHOT.jar:?] at org.bukkit.craftbukkit.v1_19_R1.CraftServer.enablePlugin(CraftServer.java:565) ~[paper-1.19.2.jar:git-Paper-132] at org.bukkit.craftbukkit.v1_19_R1.CraftServer.enablePlugins(CraftServer.java:479) ~[paper-1.19.2.jar:git-Paper-132]
wait
Oh.. did you shade Identity in your plugin ?
obv
That's why
huh lol
You need to access the loaded Identity plugin, not include the code in yours
ur tryna get a plugin thats not actually in the server
no
Just use it as dependency, not compile it
put provided
guys a question less about plugins
in general models json
what are difference between 1.9 + and older versions?
why older version wont be able to display the texture correctly
for wildcard permissions to work in permissions plugins, do the permissions inheritance need to be defined in plugin.yml or is it something you can compute in another way? (assume I have code control over both the perms plugin and the cor plugin)
Resource packs as been totally recreated if I don't say bs. They are still a mystery for me
i think this depends on the perm plugin. for example LuckPerms is rlly smart and does this all automatically i believe
my issue is fixed, however now I have to deal with a DC attack π€£
yeah but 3rd models
that work with json files
ah, any idea how they do it or should I just delve into their src?
ill go for trial and error
well its open source so i suggest just looking at their src
alright, I assume they iterate over the commandmap, grab the perms and authorise all manually that go under the wildcard, I'll have a look for it, thanks!
Never really went into it
thanks gonna find out the answer today
since i'm not gonna update all my models from 1.8 to 1.9 manually
I bet there are some tools around to do it
yeah there are tools to steal even a model just from inspect in game lmao
so ;D
btw _Rolyn
wait ill send a picture tell me what do you see
its a model i might today
like what does it look alike?
And im using an image of a ps4 controller for testing
a floating bible
I know a girl who uses something very similar
what do you mean
it meant to be an explosive ;/ not a nokia
for my terrorist role play server
where you have to do different mission so i was making some new explosive models today
i want players have a bigger choice of explosives so thats pretty cool
balance and pricing u know
holy shit
sick c unt π
only now i noticed
lmao
1.19.2 remapped mojang seems to have a lot smaller size (15mb) am i doing anything wrong?
the server ?
Who ghost pinged me :c
No that's normal
It just doesn't include all dependencies
(they are in the pom instead)
hwo do i get all th crap
Why do you need it?
well
What are you trying to do
Maven will take care of what you need
i dont use maven
Gradle?
Gradle will handle it for you as well
wynn
real shit bra
Never been in a queue on wynn
π
Maybe it's time to start playing again
init brav
i can boost you up if you know what i mean
you wouldnt mind some LE for sure
I have more than I need on my main account
dayme
wynn has incredible loadbalancing and shit
you can see players from different nodes etc
they love packets, for sure
if Spigot-1_17_R1 is for 1.17, what is the name for 1.19.2
first time I saw those "fake" players, or rather the ones on the other nodes, I was blown away
1_19_2_R1 ?
Sounds like they didn't use remapped
If you want I can update the plugin for you
I'm bored
I am going to lose my mind with this utf-8 encoding
1_19_R1
i did for sure
guys I think we need to nuke all of asia
that way I don't need to support this character set
Not you the original authors
what is wrong with it?
they ship jars for some reason haha
1.17
the question mark is not an innovative new character
question marks just means that the character point doesn't fit into utf8 usually or the character point doesn't have a displayable character
usually spaces or the sorts
but it could be a character that is outside of the utf8 set
Problem of having a language with accents :3
here's the problem
that's also utf8 and it is taken from the file I am trying to clone
I have a translation file inside of the resources folder, it gets displayed just fine in utf8
now 588
once I try to copy it to a directory suddenly I am dropping characters
if you are trying to copy you need to ensure extra hidden characters do not also get copied as well
I need to check if compiling it might be changing the characters
pos 400 lets goo
this is also possible as well and might need to resort to using unicode escape sequence
i get a lot of this crap
Looks like unmapped
You're going to have to find the new names
oh god damn it
compiling it is causing the issue
no wonder it was always doing this
well... how do I fix that
Set the encoding in your pom or build.gradle
thing is it is set up
that's why I thought this wouldn't be the issue
//Fixes issues related to special characters being used
compileJava.options.encoding = "UTF-8"
compileTestJava.options.encoding = "UTF-8"
is there one that I missed?
1.19 "apparently mapped"
unicode escape sequence
how does that work?
bt/Spigot/Spigot-Server/target/
i got it from there ^
Kacper my offer still stands want me to help you update it?
Hi, I'm making a plugin that counts the number of team members in the scoreboard. So far I've made this code https://pastebin.com/Ks5VcC77 (more precisely it's related to onScoreboard() you don't need to notice the rest), but for some reason it duplicates the line every time I join a team. Does anyone know how to fix this?
Pastebin.com is the number one paste tool since 2002. Pastebin is a website where you can store text online for a set period of time.
i want ur help for sure, but i want to do that crap myself with your help
at one point 1.20 will exist
Remapped removes a lot of the work between updates
not sure how I go from that to preventing compilation from messing up my yml files
Anyways use https://nms.screamingsandals.org/ to find the new names
If something does not exist you will need to dig around in the source to find what you want
well, the other thing could be making sure filtering is disabled on the file
I don't know what your setup looks like and why the compiler is processing yml files
I have the translations in the resources folder of the plugin, under a folder called translations
though I don't know why it would mess with it when I already have it set to utf 8 for the compilation encoding
You can set encoding on your build management tool
use this
<plugin>
<artifactId>maven-resources-plugin</artifactId>
<version>3.3.0</version>
<executions>
<execution>
<id>default-resources</id>
<configuration>
<nonFilteredFileExtensions>
<nonFilteredFileExtension>yml</nonFilteredFileExtension>
</nonFilteredFileExtensions>
</configuration>
</execution>
</executions>
</plugin>
this should stop the compiler from filtering your yml files
They're using gradle
I'll be home in a bit
I am getting real tired of the uphill battle of doing stuff in gradle
I'm a gradle main
I love the compile speed but boy the time I've spent trying to get gradle to behave has far exceeded any time I would spend waiting for my programs to compile
maven is better π
bruh
it isn't slow, just you misconfiguring it
can't wait for the old white guys in my neighbourhood to go crazy over the queen's death
by default maven uses conservative resources
you have to tell it that it is ok to use more resources
???
?paste
they currently don't have one, they have a gradle build script
unless they do have one and just weren't using it
https://paste.md-5.net/amasoluvec.cs godspeed
how does one look
cant find anywhere
what do you mean look?
my best guess
just copypaste the mc-development script
processResources {
def props = [version: version]
inputs.properties props
filteringCharset 'UTF-8'
filesMatching('plugin.yml') {
expand props
}
}
this part in specific
I'm kicking player on join event (whitelist plugin) and setting join message to null, but server sends join message again (using essentialsx for handling that), any ideas?
the issue has to do with the bundling process
when the compiler puts resources into the jar, its not a straight forward copy and paste type thing
kick player in PreLoginEvent
hmm
what I had posted as the fix for maven, is basically telling the compiler to copy the file with that extension as is
maven groovy syntax
and not attempt to do any kind of filtering
Either handle it before they have successfully joined or set their join message in PlayerJoinEvent
it allows using groovy scripts, so technically it doesn't make maven use groovy syntax but you could just put everything into your groovy script instead lol
filesMatching probably wouldn't work if that's not my filename right
because that's not my filename
yea thats not even remotely close
just talking about the filteringCharset part
so change the file name to make it match
pretty sure this applies to all of them
you could change that in maven if you really wanted to
the reason maven uses target is because you can compile for multiple architectures
im talking about defautls
I know and I told you why maven has it named that way
just most people are not compiling for multiple architectures or require different binaries for such
well those in the MC scene that is
also "package" instead of "build"
because putting files into a zip file isn't really building
you can toss files into a jar without compiling
uh
what
hm
but build literally compiles everything
how else would it work
no it doesn't
updated file?
my jars have .class files in them not .java
by default if you didn't put any other options yes it would compile
but what do you think a sources jar is?
also, there is different types of archives too
yeah it works... weird
Possible to move a player minecraft??
isnt mavne literally the only one that calls it not build
set velocity
package and compile are two separate things and no its not just maven that does this
I want it like to control a user experience, so I can βpressβ w and so on
I made a plugin for that
don't know why but it does work now, thanks
Do you have a link?
we could argue all day, at the end of the day you will use maven and i will use gradle
I am hackerman
i can argue why chromium worse than firefox all day too
or windows worse than gnu/linux
optic will just tell me Meh. dab
what do you mean?
not sure how a wrapper relates to being better in terms of compiling
maven has a wrapper tho
if you want to be technical, maven doesn't actually compile
just that no one uses it
maven calls java compiler and puts in the options to compile the way you told maven you wanted it
technically maven itself is nothing more then a wrapper
technically gradle is nothing more than a wrapper
indeed
technically java is also just a wrapper π€
but I just don't understand what bringing up that gradle has a wrapper though
yea idk
has to do with anything
i never ever saw it in my life
everyone uses it
but all gradle projects i see have gradlew
just the IDE calls the maven wrapper automatically. You could pull up a console and invoke maven yourself too
Well on gradle it is a lot more important as the general DSL changes a lot more
what do you mean here with maven wrapper ?
the maven binary is nothing more then a proxy to the java compiler
average user has to install maven to compile something
but with gradle you just run gradlew
that is not what kacper was talking about tho
????
what
look, before on my pc i didnt have mvn
i had to install a package
same for windows
you don't have to install java
you just extract the maven archive and you use it right there or if you want it part of the global shell go modify the environment variables
Hello this is india tech support, we hav speciol offer for you, Sir. Download now more RAM for only $24.99 Doller
Still have to install it
install in what way?
no different then having to download gradle
You gotta set your environment variables etc
if you want to use it globally
its not a requirement
with gradle you just need the wrapper, when you run it it does all the other stuff
β― tree .
.
βββ mvnw
βββ mvnw.cmd
βββ pom.xml
βββ src
βββ main
βΒ Β βββ java
βΒ Β βββ dev
βΒ Β βββ lynxplay
βΒ Β βββ App.java
βββ test
βββ java
βββ dev
βββ lynxplay
βββ AppTest.java
9 directories, 5 files
other stuff such as what?
its very very small
lol
or how it looks
yea first time seeing it in my life
if you never saw it in gradle project, thats matrix at this point
Guys, when having a timer for something. Would it be smarter to compare the systems local time or have an AtomicInteger that handles it
I'm thinking when it lags it's not going to be accurate
depends on the kind of timing you need
Ideally perfect. 60 seconds
also depends on the type of lag
(name 1 project that does that, with over 10 downloads)
which ```
.
βββ .mvn
βΒ Β βββ wrapper
βΒ Β βββ maven-wrapper.jar
βΒ Β βββ maven-wrapper.properties
βββ mvnw
βββ mvnw.cmd
βββ pom.xml
better off using NIST for this then
I forgot the -a
pretty much exact layout of gradle
Well you don't really need it for maven
because like, when does the layout of the standard ever change
that looks literally like gradle haha
making the directory a dot directory isnt a good idea imo
yea
you wanna ship the wrapper
Nist?
soon kacper will learn that maven can build projects simultaneously and use multiple threads
I mean, just because it is a dot dir doesn't mean it won't be tracked
but yea
I feel your point
if(location.getX() >= Math.min(location1.getX(), location2.getX()) && location.getY() >= Math.min(location1.getY(),location2.getY()) && location.getZ() >= Math.min(location1.getZ(), location2.getZ())) {
if(location.getX() <= Math.max(location2.getX(),location1.getX()) && location.getY() <= Math.max(location2.getY(), location2.getY()) && location.getZ() <= Math.max(location2.getZ(), location2.getZ())) {
return true;
}
}
return false;```
ive written like 30 different codes and none of them work. pls someone explain ive been doing this for the past week
i trying to see if a player is in a area
Why make it so complicated
ive tried every design bro
add some indentaion or whatever bro
even bounding box
this only returns true if all of them are equal
can't be > and then <
those are differnt values
location1 and location2
you keep forgetting that maven is designed to be conservative because it was aimed at being used where you either can't or just don't want to give it dedicated resources. IE something like a CI where it can takes its time. Gradle aims to cater to those that want everything set to high settings, where as maven aims to cater to those that want everything set to low settings and only set certain things or everything to high settings at their choosing
Just check if Coord 1 X/Y/Z > Player < COORD 2 X/Y/X
wait i think i just saw my issue
bruih i did Math.max(location2.getZ(), location2.getZ())
i would accept maven in my life if it used groovy syntax
or basically anything else other than XML
compared to groovy xml looks like unreadable crap
was just wondering what that should do hahah
nvm still doesnt workkkk
what's your new code?
if(location.getX() >= Math.min(location1.getX(), location2.getX()) && location.getY() >= Math.min(location1.getY(),location2.getY()) && location.getZ() >= Math.min(location1.getZ(), location2.getZ())) {
if(location.getX() <= Math.max(location2.getX(),location1.getX()) && location.getY() <= Math.max(location2.getY(), location1.getY()) && location.getZ() <= Math.max(location2.getZ(), location1.getZ())) {
return true;
}
}
return false;```
debug one by one
i did
i did broo
yeah cause still doesn't make sense i guess
You never check for the player
Maybe you do
Please use good variable names
idk but worldguard is a mess at least api wise
public static boolean isLocationInArea(Location location, Location location1, Location location2) {
if(location.getX() >= Math.min(location1.getX(), location2.getX()) && location.getY() >= Math.min(location1.getY(),location2.getY()) && location.getZ() >= Math.min(location1.getZ(), location2.getZ())) {
if(location.getX() <= Math.max(location2.getX(),location1.getX()) && location.getY() <= Math.max(location2.getY(), location1.getY()) && location.getZ() <= Math.max(location2.getZ(), location1.getZ())) {
return true;
}
}
return false;
}```
full code
i used their api to check if a user is in region and it worked
new Location(world,1,1,1,)
lucky you, i was told to learn java
yeah i got told that too which is why i search docs instead
they mean asf
they can at this point close support section
Why are you using Math.min
to get smallest number for comparator
or wtv
Something wrong with you math then
π
I just want it like if i do /move <player> forward, the player is moving forwar
Create your own plugin then and play around with velocities
yes it does
First off all
Let's say you have an area with these two X values
2 and 69
Math.min will return 2
Lets say you are in the X-coordinate 105
Your shit will return true
is there a way to something like InventoryClickEvent#setCursor in a non deprecated way?
InventoryView#setCursor iirc
id assume that to be the same thing but aparrently thats not deprecated
ill try and see if that works
guess what. i just complicated stuff 300x times and it worked
int locX = (int) location.getX();
int locY = (int)location.getY();
int locZ = (int)location.getZ();
int minX = (int)Math.min(location1.getX(), location2.getX());
int maxX = (int)Math.max(location1.getX(), location2.getX());
int minY = (int)Math.min(location1.getY(), location2.getY());
int maxY =(int)Math.max(location1.getY(), location2.getY());
int minZ = (int)Math.min(location1.getZ(), location2.getZ());
int maxZ =(int) Math.max(location1.getZ(), location2.getZ());
if(locX >= minX && locX <= maxX) {
if (locY >= minY && locY <= maxY) {
if (locZ >= minZ && locZ <= maxZ){
return true;
}
}
}
return false;```
Hi, I'm making a plugin that counts the number of team members in the scoreboard. So far I've made this code https://pastebin.com/Ks5VcC77 (more precisely it's related to onScoreboard() you don't need to notice the rest), but for some reason it duplicates the line every time I join a team. Does anyone know how to fix this?
Pastebin.com is the number one paste tool since 2002. Pastebin is a website where you can store text online for a set period of time.
i legit grabbed a notebook and brainstormed lmfao
hello, im attempting to update my plugin from 1.17 to 1.19, can anyone point me in the direction of a tutorial as ive never done this before :3
change dependency if using maven or gradle or add the new jar
ah see ive tried adding the new jar, it erm, makes everything go red n i panicked XD
not sure what to do after adding it so thought it best to ask for a tutorial
Just why
idk if youre trolling or not
no im not
everything? Did you also remove the old jar?
ive been making this for the past week
yea, was i not meant to
no you should
what's it saying when hovering over red stuff?
can you show the window you added your jar?
?bootstrap
Bootstrap Jar
The main spigot-1.18.jar is now a bootstrap jar which contains all libraries. You cannot directly depend on this jar. You should depend on Spigot/Spigot-API/target/spigot-api-1.18-R0.1-SNAPSHOT-shaded.jar, or the entire contents of the bundler directory from your server, or use a dependency manager such as Maven or Gradle to handle this automatically.
Please read the release notes for further information: https://www.spigotmc.org/threads/9-years-of-spigotmc-spigot-bungeecord-1-18-1-18-1-release.534760/#post-4305163
How can I convert a MiniMessage component to a colorful string?
ez
next time use maven instead
@ebon ether where are homing arrows
i think you'll have better luck asking in their discord
who ghost pinged me
Where are intellij jar plugins keep?
Answering to?
U
I mean
Im wondering to find intellij plugins folder
Not the projects folder
I mean the folder where intellij locate the IDE plugins
That its what i mean
Oh dunno about that
thats gradle
But it's prob somewhere in the intellij forum
or gnu/linux
I need to get a pecific intellij plugin jar
good boy
you want btrfs
English-English please
btrfs
This is for pycharm, but should be the same for intellij
C:\Users%USER%.PyCharm%VERSION%\config\plugins
ikik but it only works this way
?
by default most distros use EXT4 filesystem, its good and fast
but theres also btrfs a bit slower but has snapshots
Not for u
WHat are you talking about mate!
i am
I cannot find that folder
verano...
Isn't there
What bruh
im saying it because you said you messed up your linux install
Ohh
Na dont orry about that
I know how to fix it
I just brokened up kgp packages
I mean its not really difficult Intellij should have a directory where he store the jar plugins you install
Sure
yeah if you have time
DM me the plugin
verano π
Ok thanks
Heh
Also you use intellij right?
Because i dont know where its maybe?
(he isnt talking to you)
Ohh
Lmao
People here makes a disastes haha
Because all talks about diff things together
Olivo my bae do you use intellij right? Do you know where the heck intellij store the downloaded plugins? i need to find where he stores the jars of the plugins
They are in the plugins folder
@chrome beacon https://github.com/KaspianDev/DatouNms
pr here if you can
thers a low chance original repo author will see PR
Which one?
might as well get rid of those spigot jars too lol
The one in app doesnt contain any jar one
ah right there are two of them
One in the install that contains the bundled plugins
and the other plugins folder
hmn
Which one so?
I need to modify a bit the discord sync plugin
that why haha
I have it installed with Toolbox so I have no idea where it is normally
if you have #distance, and you check if the value is smaller than 7 blocks, #distanceSquares you should check if the value is smaller than 7*7, right?
I have not failed maths right?
Never use #distance() method in Bukkit to compare distances
It uses slow square root operaion
If you need to compare, compare two distanceSquared() values
basically yeas
you better do distanceSquared() < 7 * 7
not distance < 7
mafs
Have you saved config afterwards?
The distance between 2 points is the hypot of a triangle where the start and end are the 2 locations you're checking
or in 3d space it's a little more complex
c^2 = a^2 + b^2
the math gives a squared number
Calling the regular distance number, just grabs distanceSquared and sqrt's it
Multiplying a number by itself is quicker in terms of clock cycles, than finding a root
because you're not saving the config
also saving to config on held item
yucky
he probably has his reasons
no he really doesn't
k
It's as bad as doing HTTP requests onPlayerMove :)
i mean i can see why thats stupid
doing IO on the main thread is stupid overall
im assuming this is place holder code right? also yeah dont use static if you can help it
also instead of throwing ioexception on the main thread like imillusion said, use try catch
thats what i thought at first, but in actuality its bad practice
yeah, id recommend looking into di as well
Guide to dependency injection: https://www.spigotmc.org/wiki/using-dependency-injection/
?di
Guide to dependency injection: https://www.spigotmc.org/wiki/using-dependency-injection/
it will help a lot with static methods
meaning you dont need to use hardly any static
yeah i used to do that, not fun
headaches for days
since java has import static
statics feel nice sometimes
Like you make a small Painter class which wraps Bukkit's translateAlternateColorCodes() method with name "paint" or something similar
then u can make static import of the method and use it
I mean about saving time
and having less code
by static imports
Cuz in class where you have like 20 messages, call method from class 20 times is kinda cringe
well it's kinda nice for me now
import static me.nukerfall.example.utils.Painter.paint;
and in code just use paint() everytime
instead of Painter.paint()
Well having method in each class is kinda sussy
But having a static import is one line
And auto-suggested sometimes
Basically LWJGL page says that they made all of their examples with import static
So if some code is not working you probably need a class name, or a static import
That was a headache for me in the beginning
But now i'm more into LWJGL
Your coding style is whatever your boss wants it to be
Haha true
That's why i have no boss rn
Tryina make some projects first
one with LWGJL
one with Spring
one MongoDB, one Hibernate
And then try to apply with all my knowledge
Spring is so heavy 
Well probably gonna start with Spring Boot
After that some other parts of spring
Every company wants you to know Spring so...
What is spring anyway
Well Spring Boot is for microservices and APIs/general backends. Spring in and of itself is also a collection of libraries.
That operation took far too long 
It went to get milk and hasn't come back with any data
Use Pastebin
?paste
: D
You'd want 1 thread rather than 1 for every player.
PlayerItemHeldEvent would only cover the player changing the active slot. I assume you'd also need to watch inventory events as well
1 timer with getOnlinePlayers().forEach();
only issue with that - performance
it's anyways better than stopping main thread lol
?
If you can getOnlinePlayers async you can run whatever you want on the main thread using sync threads when needed.
Still think you can do this without threads
What's buggy about it?
You can check
Are you also checking inventory events?
Yes you can.
test connect method?
Less a test and moreso a setup
make it nice. Name it setupTable() or something pretty 
Where is intellij plugins jar folder loxated?
no idea
Hmn okk
Unless you mean plugin as in spigot plugin
https://intellij-support.jetbrains.com/hc/en-us/articles/206544519-Directories-used-by-the-IDE-to-store-settings-caches-plugins-and-logs#:~:text=2-,Plugins (idea.,2%2Fplugins
First result on google
I need to locate it so then I can modify a specific plugin
But i need the ja rones
The jar ones, not the configuration
Like
I need the one that contains the jar not their config
But thanks for trying help atleast
No idea where what you want would be
not sure that idea plugins are jar files
i think they are jars
Quick question. If I add one incorrectly made line(that doesn't prevent compilation or throw an error). Would it stop my plugin from doing anything. As in it doesn't do anything its supposed to.
shortToLong(short a, short b, short c, short d) {
return ((long)((a << 16) | (b & 0xFFFF)) << 32) | (((c << 16) | (d & 0xFFFF)) & 0xFFFFFFFFL);
}```
so uh
Why tho?
yeah do u guys have an idea of what this does
short is so specific...
A bunch of bit shifting so you can convert 4 16bit numbers to 1 64bit number
well the bit shifting process is what im asking about
What does << do for each case here?
What does & do for each case here?
What does | do for each case here
Why are the hexadecimals different than each other? Why does this work
If I wanted help troubleshooting my plugin would the best way to do that be to just send all the code here and ask for help? Reason I am asking is because I recently added a segment of code to my plugin(it was working before and after the addition). Then I proceeded to modify that piece of code a little bit and it was still working. Upon further addition to limit when things would run(one if statement in one class) my plugin stopped doing anything other than loading and disabling. None of the listeners are being called and their are no errors anywhere(in the IDE or server console)
<< shifts a number. & is binary and. | is binary or.
Example with 4 bit numbers.
Bit shifting
0001 << 1 = 0010
0001 << 2 = 0100
0001 << 5 = 0000
0001 >> 1 = 0000
Binary and
0010 & 0011 = 0010
0101 & 1111 = 0101
0011 & 0110 = 0010
1001 & 0110 = 0000
Binary or
0010 | 0011 = 0011
0101 | 1111 = 1111
0011 | 0110 = 0111
1001 | 0110 = 1111
If your listeners arent enabled then you throw an excption when the plugin is enabled
"None of the listeners are being called" what does this mean then?
Its my best description of what is happening
because it literally does nothing
and i have loggers setup after each listener and if statement
and none of them ever get used
I don't know exactly how to explain things
One or max two are fine. More is a sign of unclean code.
if (event.getPacketType() == PacketType.Play.Server.ENTITY_EQUIPMENT && (p.getScoreboardTags().contains("shadowhuntactive") || p.getScoreboardTags().contains("shadowsneakactive"))) is my packet listener
or it was then I removed the && and everything after(within the parentheses) to see if it would work without
and it still wasn't working
Add a sysout before you do any logic
that will print to the console?
just a debugging message to see if the listeners work
Is it a ProtocolLib adapter?
I couldn't get ProtocolLib to work so I had someone help me setup and use PacketEvents
There is no such thing as a PacketEvent. Neither in spigot nor in nms.
The plugin/library called PacketEvents
I know it soft-depends on ProtocolLib
Ugh
My best guess would be that the scoreboard tag is missing.
log every of your conditions to see which one is false
Except that wouldn't stop my other classes and such from working. correct?
If they all make use of this scoreboard tag then it does
The only other reference to the scoreboard tag is 4ish lines in another class where that tag is added and removed
but to get their it has to first pass a bunch of other checks.
Just sit down and debug. We dont have enough information so all we can do is throw guesses at you.
Start with one part that isnt working and find out why its not working.
And I have loggers at each of the if statements(only one I don't/didn't is the packetone)
none of it is working...
its not even detecting right click events
Then pick one at random
Then your listener isnt registered.
Keep in mind that the client does not send any click packets when he has an empty hand
this makes a shit ton of sense
this is where the operator && originates from right?
and ||
Yeah. 2 4 bit number to 1 8 bit number:
0010 | (0000_1001 << 4) = 1001_0010
And back:
(4bitcast) 1001_0010 = 0010
(4bitcast) (1001_0010 >> 4) = 1001
Also 7smile7 is their any reason that lines of code from plugin.yml wouldn't be compiling with the rest of the plugin?
Smile do you mostly use Intellij right? Where i can find the folder where intellij put the jar of the plugins?
i get that in here
a << 16 gets the msb in a, since a has 16 bits shifting to the left by 16 will just result in msb and 15 other 0s
but the b & 0xFFFF makes 0 sense
since 0xFFFF is just 16 bits all turned on, so anding it with another 16bits will just result in the another 16bits
Only when you destroyed your whole setup and broke something really badly.
Why not modify the plugin code from whereever it's hosted and install it manually?
Depends on your compilation tool
Its done for the sign bit
How would I find what I broke? I've been having this problem of IntelliJ not compiling my depends or when my plugin is supposed to load into my plugin.yml in the plugins jar file.
Which dependency manager do you use?
As in maven and gradle?(I use maven)
How do you compile?
And uh how would that matter as the dependencies are plugins
I use the maven package button under lifecycle
Ok
Where is your plugin.yml located inside your project?
with my classes
Doesnt belong there
resources folder
then how does it still compile it with the rest of the stuff correctly done?
chars
so u do
0010 >> 4
then get
0000_0010 | 1001_0000
then do a normal oring
0010 >> 4 is always 0
0000
So you first cast 0010 and 1001 to 8bit
-> 0000_0010 and 0000_1001
Then you shift one of them
0000_0010 << 4 = 0010_0000
Then you or them together
0010_0000
| 0000_1001
____________
0010_1001
For signed values you need to & them with 1111 (= 0xF)
PS: You only need to & with the bits which will be on the left most side (msb)
Just make it a singleton
No. Singleton is an actual design pattern.
Making all methods static would lead to static abuse at some point.
public class SomeManager {
private static SomeManager instance;
public static SomeManager getInstance() {
return instance == null ? instance = new SomeManager() : instance;
}
// Dont forget to make the constructor private
private SomeManager() {}
public void someMethod() {
}
}
This is a template for the singleton pattern
lazily initialized
If you use static as a shortcut for object oriented problems then you are abusing it.
The biggest indicator for static abuse are states.
A mutable static field or an immutable static field with a mutable object in it is 100% static abuse.
Example:
// Not ok
public static String SOME_PREFIX = "CoolPlugin";
// Ok
public static final String SOME_PREFIX = "CoolPlugin";
// Not ok
public static final List<String> SOME_DATA = new ArrayList<>();
// Ok
public static final List<String> SOME_DATA = ImmutableList.of("A", "B", "C");
Static should be stateless
This means there is no state that could change. No variables
can be reassigned, no collections can be modified etc.
Everything has to be immutable and final.
They probably rely on a state like data from a config file
also whats a good example of static use?
Utility classes.
Singletons, Util classes and constants
Hello, I'm trying to spawn an item for a specific player through packets and ProtocolLibrary
ItemStack item = new ItemStack(Material.BEDROCK);
int x = player.getLocation().getBlockX();
int y = player.getLocation().getBlockY();
int z = player.getLocation().getBlockZ();
EntityItem displayItem = new EntityItem(((CraftWorld) player.getWorld()).getHandle(), x, y, z, CraftItemStack.asNMSCopy(item));
Entity entity = displayItem.getBukkitEntity();
player.sendMessage("spawned");
PacketContainer packet1 = ProtocolLibrary.getProtocolManager().createPacket(PacketType.Play.Server.SPAWN_ENTITY);
packet1.getIntegers().write(0, entity.getEntityId());
packet1.getUUIDs().write(0, entity.getUniqueId());
packet1.getEntityTypeModifier().write(0, EntityType.DROPPED_ITEM);
packet1.getDoubles().write(0, (double) x);
packet1.getDoubles().write(1, (double) y);
packet1.getDoubles().write(2, (double) z);
PacketContainer packet2 = ProtocolLibrary.getProtocolManager().createPacket(PacketType.Play.Server.ENTITY_METADATA);
packet2.getIntegers().write(0, entity.getEntityId());
WrappedDataWatcher watcher = new WrappedDataWatcher();
watcher.setEntity(entity);
packet2.getWatchableCollectionModifier().write(0, watcher.getWatchableObjects());
try {
ProtocolLibrary.getProtocolManager().sendServerPacket(player, packet1);
ProtocolLibrary.getProtocolManager().sendServerPacket(player, packet2);
} catch (InvocationTargetException e) {
e.printStackTrace();
}
This is what I currently have, and I can't figure out why it's not working. Whenever this code is ran nothing happens; no spawn, nothing. Can anyone help? Thanks.
Which version
1.19
Then you are using the wrong ProtocolLib version
You need 5.0.0-SNAPSHOT
Makes your code more robust. This way nobody will ever be able to create an instance of you singleton class.
Strongly enforces the pattern.
Thanks for responding so fast.
I've updated to 5.0.0-SNAPSHOT in my pom.xml and updated to the latest dev build of ProtocolLib on my server, however, it is still not spawning the item.
The only way to ever get an instance is through the getter.
Alright then let me take a closer look. What kind of entity are you trying to spawn?
A dropped item.
Then you fetch them through your other singletons.
it's possible to put a block that has a custom model data in the head of an armor stand using nms?
You can also do that with spigot
but helmet only accepts string: helmet.setString("id", "minecraft:structure_block");
What? What are you saying?
Uhm... it looks like you are using nms. Then there is no reason to use ProtocolLib. Just send a nms packet.
I was using EntityItem to get the entity's ID & UUID, is there a different / better way?
Create a random int and UUID. It doesnt matter because the server doesnt know the entity exists anyways.
And this wont work either:
watcher.setEntity(entity);
Gotcha
Here. Try sending those two packets after another:
private PacketContainer createDroppedItemMetaPacket(int entityID, ItemStack itemStack) {
PacketContainer metaPacket = new PacketContainer(PacketType.Play.Server.ENTITY_METADATA);
metaPacket.getIntegers().write(0, entityID);
WrappedDataWatcher dataWatcher = new WrappedDataWatcher();
// ItemStack property
dataWatcher.setObject(8, WrappedDataWatcher.Registry.get(ItemStack.class), itemStack);
metaPacket.getWatchableCollectionModifier().write(0, dataWatcher.getWatchableObjects());
return metaPacket;
}
private PacketContainer createItemSpawnPacket(int entityID, UUID entityUID, Location loc) {
PacketContainer spawnPacket = new PacketContainer(PacketType.Play.Server.SPAWN_ENTITY);
StructureModifier<Integer> intMod = spawnPacket.getIntegers();
intMod.write(0, entityID);
StructureModifier<UUID> uidMod = spawnPacket.getUUIDs();
uidMod.write(0, entityUID);
// Set type
spawnPacket.getEntityTypeModifier().write(0, EntityType.DROPPED_ITEM);
// Set position
StructureModifier<Double> doubleMod = spawnPacket.getDoubles();
doubleMod.write(0, loc.getX());
doubleMod.write(1, loc.getY());
doubleMod.write(2, loc.getZ());
return spawnPacket;
}
The only problem could be the registry...
Thanks.
I am getting this though
No serializer found for class org.bukkit.inventory.ItemStack
Yeah there is no serializer for ItemStack. We need to find another way
i need someone to test out a feature im working on. anyone up for it?
Ah found it:
dataWatcher.setObject(8, WrappedDataWatcher.Registry.getItemStackSerializer(false), itemStack);
Thanks so much for your help.
Am I some how messing up?
PacketContainer p1 = createDroppedItemMetaPacket(200, new ItemStack(Material.BEDROCK));
PacketContainer p2 = createItemSpawnPacket(200, UUID.randomUUID(), player.getLocation());
ProtocolLibrary.getProtocolManager().sendServerPacket(player, p1);
ProtocolLibrary.getProtocolManager().sendServerPacket(player, p2);
public void showFakeDroppedItem(Player player, ItemStack itemStack, Location location) {
int id = ThreadLocalRandom.current().nextInt();
UUID uuid = UUID.randomUUID();
PacketContainer spawn = createItemSpawnPacket(id, uuid, location);
PacketContainer meta = createDroppedItemMetaPacket(id, itemStack);
ProtocolManager protocolManager = ProtocolLibrary.getProtocolManager();
protocolManager.sendServerPacket(player, spawn);
protocolManager.sendServerPacket(player, meta);
}
There you go. Fake items.
Ah, I was sending them in the wrong order π
Yes you are sending the player a meta packet for an entity that the player doesnt even know. So the client just ignores the packet.
Thank you so much, I've been trying to figure this out for a long time.
I want to make a plugin where when a cactus breaks in the plot, it goes to a "virtual storage", I'm thinking of using a hashmap, but on second thought, if I put it in the hashmap whenever the cactus breaks, it will generate a lot of lag, which best way to do it?
Why would this create lag?
Just have a List<Inventory> and add your stuff there. If the last inventory is full then you simply create a new one and add it to the list.
Imagine a giant cactus farm
You can also use a Map or Set for this.
So? You can do millions of hashmap inserts per second.
And if you have a 1000x1000 cactus farm then you get maybe 10k per second.
Thats nothing.
The cacti will lag the server ages before a map becomes a problem
So just use a Map<ItemStack, Integer>
Wouldn't it make a big difference in performance?
It would be so little that you couldnt even detect it.
Maybe 0.001% of your tick
maximum
A hashmap doesnt get slower with more elements. Thats the whole idea of hash tables.
If you care about performance read this:
https://www.spigotmc.org/threads/guide-beginners-guide-on-improving-your-codes-performance.396161/
anyway to improve this?
i want the best performance
Bukkit.getScheduler().runTaskTimer(TimeAPI.TimerPlugin, task -> {
long timeleft = timer1.getTimeLeft() + time;
timer.setTime(timeleft);
if (timeleft <= 0) {
Bukkit.getPluginManager().callEvent(new TimerFinishEvent(timer1));
timer.delete();
list.remove(timer1);
timerMap.remove(timer1);
Timer.timerMap.remove(timer1.getID());
task.cancel();
return;
}
Bukkit.getPluginManager().callEvent(new TimerUpdateEvent(plr, timer1, update_timer));
}, update_interval, update_interval);```
Very confusing naming... And dont use lists if you do contains() or remove() often
And this is static abuse:
TimeAPI.TimerPlugin
wdym by static abuse
but yeah naming is weird
and remove() shouldn't happen that often
if you dont mind explaining, why is it an issue to do that? (static abuse)
Timers and cooldowns should always be done by timestamps.
Manually adding time like this is very unnecessary and inefficient.
π