#help-development
1 messages ยท Page 629 of 1
You need to create the function getInstance();
Guide to dependency injection: https://www.spigotmc.org/wiki/using-dependency-injection/
?
i.e. pass a plugin instance along with the databseconnector constructor
Get outta here with ur dependency injection
lol
I mean in this it really doesnt matter
either make a static function or use di
no
bad help
bad advice
DI is good
quit being lazy
guys i installed the NMS in my intejill but somehow ServerPlayer doesnt work
(i cant send ss dm for ss)
?img instead
Not verified? Upload screenshots here: https://prnt.sc/
also, you saying "instaleld NMS" makes me question things
Hello, using a concurrenthashmap can be better than a caffeine cache? (for cache storage)
look at dm
Caffeine caches have specific uses
ConcurrentHashMap is better used as a plain old hashmap in a concurrent environment
ha, caffeine, Java
If you want it as a temporary cache with eviction, use caffeine
or because I'm lazy, guava
ah, for non-temporary cache is better a concurenthashmap?
So.. a collection
i was not aware that it is literally a library called caffeine, thought it was just a caching method called caffeine
Yes, if i want add a data to my cache on player join and delete his cache when he leave, what is the best option?
Isn't cache like temp by definition
make ur own ๐ its not that hard
isnt a cache a reserve
i dont trust this link
that is the normal lightshot link
Why make your own when caffeine is amazing ๐
i dont trust people with no embed rights
Fr just verify
Wtf is โThe Dupeโ ๐ญ
it has a very specific code style
dude never heard of packages
thats the image
how do I know if I should use a hashmap/competitor or a cache?
Look doesn't change its application :}
Show the Pom.xml
?paste it
SNEEZE
except i dont use it as a program but as library
Are you caching and need extra methods like timed removal etc. Use a Cache! Do you not need all that shit, use a map!
so it needs to be readable
Idk I don't go digging through the files when using a library
I just use the docs
Unless I'm curious about implementation of a certain aspect
Application has multiple meanings yk to apply, and those applications on your computer
i like how commons are coded by apache
so if I delete the data on an event and not after x time, it is better to use a map, and between hashmap rt concurrentthashmap which one?
Hey does anyone know how I would go about clearing player crafting slots/item on cursor? Right now I can just use a simple inventory tweaks hack to get items I shouldn't have on my server
Depends if you work and would need a concurrent environment
ze threads shall be safe
public synchronized void ...
๐
ai ohto pfp, nice
Can't have errors if it's all synchronized
:3
cant wait for a season 2 if they ever make it for wonder egg
depends you can still have race cionditions if you are not perfect with synchronise
Hi i was making UHC plugin and i got this error which is strange to me because i really do not have idea what is causing this problem so im just trying to ask you guys here if someone had this problem too or someone sees where is the problem ๐
Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.8.1:compile (default-compile) on project ZenithUHC: Fatal error compiling
It's not about speed it's about elegance
this occurs when im compiling my plugin to .jar file
true computers these days are powerful so who cares
and no signs of any errors in code
1.8 
You using mvn package?
ksksksks
gay.charon it is
was my domain before
wdym
how about Ch4r0n.dev
no
trol
Send ur Pom.xml??
ok
no i usually just build through intellij F5 and it builds whole project to .jar

Maven lifecycle package
what about it
Do it

๐
?whereami
what
FUCK I super reacted again
I hate this feature
cool what does it have to do with the screenshto
cool why seek help here
and why u delete messages
stop talking to yourself fam
paste teh full log
?paste
yeah lombok farted. No idea why
try updating maven-compiler-plugin to 3.11.0
dont forget "mvn clean" afterwards
lightweight command api lol. I've started from this ^^ and now i have this and not yet even halfway there
but isnt it good since you dont have to generate all those getters and setters yourself
i made one myself but it's smaller and only for the bukkit platform

no i mean it is same thing still it doesnt change anything
and it really seems lombok is the problem for some reason once i removed it it passed build normally without any errors
tbh constructing commands is pain in the ass but i'll be adding builder classes soon and factory classes to get the default Handlers
so that i wouldnt need to specify how its handled everytime when i want to design just a generic command from the core plugin
how would I split this string "19d" into "19", "d"?
i'm aware that String#split takes regex but i can't quite figure it out
you can use regex to parse that instead of String#split
ty i'll see what i can do with this
fun String.timeToSeconds(locale: Locale): Long {
val regex = Regex("([0-9]+)(${locale.years}|${locale.months}|${locale.days}|${locale.hours}|${locale.minutes}|${locale.seconds})")
val matches = regex.findAll(this)
var seconds = 0L
for (match in matches) {
val number = match.groupValues[1].toLong()
val unit = match.groupValues[2]
seconds += when (unit) {
locale.years -> number * 31536000
locale.months -> number * 2592000
locale.days -> number * 86400
locale.hours -> number * 3600
locale.minutes -> number * 60
locale.seconds -> number
else -> 0
}
}
return seconds
}
this works perfectly, can even optimize this by storing the regex for locales somewhere
precompile that pattern
yeh something like that
ye
alr
for (message in messages) {
// :snip:
locale::class.java.getDeclaredField(term).set(locale, definition.formatColor())
}
locale.timeRegex = Regex("(\\d+)(${locale.years}|${locale.months}|${locale.days}|${locale.hours}|${locale.minutes}|${locale.seconds})")
lgtm, hope it will work first try lol
does anyone have any ideas on how to prevent this exploit?
maybe clear the inventory fully when a player joins the lobby?
well yes, but there doesn't appear to be any way to clear the crafting slots/cursor item
from what i know, there's no way to set an item into the player's crafting slots with the api, but maybe the packets allow for this
teh crafting matrix is accessible via the player inventory
its just slot numbers
we talked about it like 2 weeks ago
somebody else wanted to set the crafting matrix items
but the slots weren't those unfortunately
get teh Player inventory and set teh correct slots to air
if you want to clear everythign just loop over the inventory size
I donโt know how to use that
paste your code, click save, copy link to here
Ohh ok
By banning them
ban the player from the main server
you mean ban the player in the main lobby?
yes
this doesn't work
if you have multiple lobby instances, you can have a main main main server, to which you send all the players, and then distribute them to lobbies
and ban the player from that very main server
sub servers should only be accessible via the lobby (so long as you properly secured your bungee install)
yep
So a OnJoinEvent in Bungee and kick them if they want to join with a message is not that good?
I donโt have any experience coding (other than scratch 3.0) and need help figuring out how to make this code work as a plugin https://paste.md-5.net/igafapewol.java
Data base ban list
well it's a bit weird
you need a main file and a plugin.yml, and on top of that a build system to build your plugin
a tutorial on creating a spigot plugin is easily found in youtube
Ok Ty
but overall a tutorial on java is an expected prerequisite
if you don't know java it'll be very painful for you to code a plugin
it's like trying to read a german book but only knowing arabic
So in Bungeecord there is no way to ban someone? So I need to ban a player in the main lobby and kick him if he gets banned because he could be on another server instance and only if he goes back to the lobby he gets kicked
well yeah after you ban a player on the main server you should find the player in question and kick them from wherever they are
unless you write/install a bungee ban plugin
Can I ban the player on the main server via my bungee plugin?
So the ban on the main server gets send from the proxy
if its a bungee ban plugin it woudl ban them from all
I want to build a bungee ban plugin
But there are multiple people which are telling me different options and many sound wierd...The first one is onJoin and looking if a player is banned and the other option is to ban him from the main lobby and the other option is to ban the player from every server
Which one is the right way for bungee?
if you are doing a bungee ban plugin you don;t have to worry about any servers
Can someone can read my question in #help-server
if you ban a player in a bungee plugin you log it so you remember it and can refuse their connection when they try to join again
you also disconnect them so they are kicked
?paste
So onJoin just cancel their join and show the ban reason?
?jd
?
PendingConnection? You just the Login Event and then cancel it right?
no
you are using bungee
so this is a Bungee plugin
in the LoginEvent I linked
check the PendingConnection to see if the Proxied Player UUID is banned
then cancel and setCancelReason
Events are from the API
for what reason?
you can cancel the events themselves
question is too vague to give an accurate answer
however
you can't "delay" a packet so you can do your async tasks.
Packets come in order and are processed in order
I mean it depends
All packets are received async yet some of them might need processing done in the main thread
Think of entity or block interaction packets
Packets may not be received in tht order they are sent, but the actions the perform required an ordered sequence.
Because the block API is not thread safe
Thanks Mojang smh smh smh everything should be thread safe ๐
do it then
I've been thinking of making a packet-based block system where you can track blocks based off outgoing packets and have a snapshot of the player's world
Thread safety after teh fact is a nightmare
yes
they don;t really care about the order of their packets
ie chat
to ME ? HEH
WTH
Does the client send its name when requesting the server MOTD?
I don't think so but I do believe I've seen some plug-ins save users IPs and generate custom motds based on them
So like user a joined with ip 123, oh look ip 123 is pinging us let's give them a different motd with user a in it or something
it sends its uuid iirc
uuid, client version
maybe even name
MOTD is just status 1
so actually no it doesn't send anything
How can i check what slot was a item moved using the keyboard numbers in the player inventory using the InventoryClickEvent?
Is RabbitMQ or Apache Kafka more suitable for exchanging free arenas between servers? Message plugins are not suitable, and I do not want to use sockets
Redis 
is there any performance losses if i switched from arraydeque to arraylist?
depends on the use case
they're both backed by array so i think they should be identical on the insertion
i want to have list interface
why Redis?
well yeah
list has get index and remove index
arraydeque is optimised for fifo filo
Rabbit
so i've decided to use ArrayList instead with .add() and .remove(list.size() - 1), for push() and pop()
tbh it depends on what you want to do
Redis isnt actually good for messaging
^^
Its just that its an option
iirc kafka is good for micro apps
But it fails on a larger scale
i did this because i dont want to copy the deque to list
just to support the interface which needs list as an arg
i'll use a socket myself
I'm just planning on doing an extension
Yeah but thatโs a bit rural and becomes a pain (most of the times) if you decide to go with on when scaling a system
For instance rabbitmq clusters feature
Implementing that for urself raw socket wise is painful
i'll see
there's also Stack which seems to implement list interface but idk if its an array based since it an old legacy class which should not be used naymore
it's similar to bungee's from what i've seen
Kafka isn't bad either or ActiveMQ or some prefer even Pulsar
none said kafka is bad
But RabbitMQ is just really really good for enterprise and high scalability + availability
The 3 I listed are all from Apache which is widely known and trusted ๐
All boils down to personal preference and needs of course!
it's a vector so yes
but it's definitely outdated
Indeed
holup did I just read kafka fails on a larger scale ๐. Kafka is amazing at scale - it was designed for it.
conclure what's your opinion on just using redis pubsub
my biggest complaint is that you can't send messages bigger than 32mb
Kafka was designed from the ground up for scalability, availability with great failover capabilities and insanely big environments.
You decompress and compress data
That decreases throughput
Kafka is known for being clumsy
eh i've decided to use arraylist instead
it seems it works how i expected it to be after replacing deque
I mean kafka overall doesn't have a throughput issue.
Yea I think its fine
Like its convenient
Hell linkedin processes millions of messages per second.
linkedlist is another list you might like
Myea, well it sort of depends what exactly youโre using kafka for
tho it creates an object per element
Its just that, rabbitmq, or activemq goes further
eh, its slow
I mean active is multi clustered
Advanced kafka usage is... advanced and complicated - easy to mess up. RabbitMQ allows u to do a lot more stuff on-broker which some people like and definitely is better in some situations.
So u sorta compromise some speed there but whatever
My MC server was using rmq before but I moved it to kafka coz it made sense for what I was doing. The k8s operator for rmq was also annoying me (tbf the strimzi kafka one aint much better)
i prefer using ArrayDeque over LinkedList since linked list is really useful only if you have like bazillion insertions, but even in that case its not really worth it, since resizing arrays on modern machines seems as cheap as using linked list with high memory consumption and lots of cache misses
for like 8-9 insertions LinkedList is not worth it
I think kafka is just fine at streaming data as is
But it fails on a larger scale in regards to the flexibility u want in enterprise
What kinda flexibility? Plenty of enterprises love it
Like if you stream messages where messages are expected to be completely independent of each other including failure, and messages are not supposed to be altered myeah it does scale there
free java lessons are back again
can you teach me kotlin?
no, i only teach funny stuff
so no paper either? :(
true
in english?
"free"
i guess like b1
xD
jree fava
nuker we have a verified voicechat where we can stream now
teach me if-else statement
Where I sign up?
if (statement) {
//do something
} else {
//do something else
}
if (joeMomDead || joeDadDead) { leaveTheConversation(); } else if (joeGrannyDead) { startANewConversation(); } else { spamArguments(); }```
XD
ez
idk
By the way, the best way to download my update jar file? I'm making an update class for my plugins. I've got an api endpoint and a link and if you access it, it starts to download the file, depends on the parameters. Any download async methods? Or what I should use?
you just ask straight away
why not just a thread for downloading stuff
idk what spigot might say about that tho
also why not just tell guys to update manually
If(JoeFamDiesInAfire){
Troll()
}Else{
FlintAndSteal();
}
I could provide a download link in the console but.. I don't know
Is that a proper way?
I mean if you do it this way, it becomes optional which is kind of better I guess
just send a link like 99% of plugins
Yeah alright
Essentials/LuckPerms and other plugins also just tell you that your current version is outdated
and toss a link
tho update-check can be disabled in config
Yeah I've done that
Spigot has an update folder that you should put your plugin in
wha
Though I don't recommend having an auto updater
^
Also a proper way to detect if server has an internet connection? Without try catch crap
you just check a server
I'd just try catch the connection
and see if you get the statement or something like expected
is there even a purpose to check that
there's no Internet.hasConnection();
Otherwise you'd end up like Samsungs Galaxy Store which doesn't work on Ethernet
Because they didn't think of it
why is try catch crap?
I'm actually making a minigame sort of that synchronizes with the db and need to periodically check if everything's ok. I'll write a wrapper for the connection I guess, I hate using try catch in main classes xD Unless if I create my own Exceptions
I generally love to handle everything so that there are no exceptions possible
So I kind of hate try catch
Connection#isValid(int timeout) returns a bool (though it can throw an SQL exception iff timeout < 0) so you can catch that and ignore it
then why do you check for internet connection
also iirc isValid(...) is not implemented on the SQLite driver included
if you can just check if db conenction is alright
Does <Player>.rayTraceBlocks() start the ray trace from the player's eye location? Or somewhere else?
how do i send pictures for reference in this channel?
i can look for you
?img
Not verified? Upload screenshots here: https://prnt.sc/
!verify
Usage: !verify <forums username>
https://prnt.sc/nPh8TqCyqtnB
how do i give players the name i want, like this ?
TAB is open source you can go and take a look. Anyways it's the prefix and suffix of a team I believe
but what about the nametags below and above the normal nametag?
Probably passengers
Awesome, tysm <3
If you don't mind, how did you check for this?
I tried ctrl+clicking with intellij, but it brought me to LivingEntity interface, and when I tried ctrl+alt+b (or right click -> goto -> implementations) intellij couldn't find any: https://senpai.plz-choke.me/Pcu2u9cI
i like to first see which interface has the method then i use CraftInterface
players can have armor stands as passengers?
Yes
now it depends if you have used buildtools to get the spigot server dependency
i ve tried that once but the armor stands werent really following the player like a passenger
?
Sounds like you didn't add it as a passenger
Hello, I am making a plugin that generates a world called "uhc", that coexists with the worlds "world", "world_nether" and "world_the_end". When entering the nether from the world "uhc" and leaving, you appear inside "world", but I want the players to appear inside "uhc". I have coded this, which works most of the times, but sometimes nether to overworld portals don't work, they don't teleport you anywhere. Am I doing smth wrong?
is it a great way to make a GOOD interface with good abstraction by creating a OWN interface for EACH method?
elaborate
this code just screams you should learn java, and debug it, print out the world name print out info about the location etc
that's what I'm doing rn, the thing is it seems to happen really sporadically, I thought I had fixed it
the only plugins I'm using are worldedit and the one that has the code I sent, there's no event listener for any teleport events other than the PlayerPortalEvent
may a small world border have to do with my problem? I have tried getting really far inside the nether and creating a portal, but it tps me to a place inside the world border when it works
have you debugged it
I'm doing that right now
elaborate
Anyone know a good particle lib for 1.8-1.20 support
I have the exact world, with the exact portal where the issue happened while playing with some friends
now that I'm alone, with the worldborder set to the same size, I have gone to that portal in the nether and when I enter it, it generates one inside the overworld, which didn't happen when I was playing with my friends, they couldn't tp to the overworld
someone gotta explain to me why on a player death event i can get an entity but not player
This helped a lot
Hey there! I am having issues moving the new display entites (the item display in particular) smoothly. I previously used armorstands and just teleported them, but that doesn't seem to work. I've also tried having the movement be on the matrix and having interpolation set up, but this does not seem to help. I've tested sending every tick (20/s) or every other tick (10/s) and have tried setting the interpolation duration to any value from 0-4 for both of these, but nothing seems to work. The weird thing is that I have no issues with rotation whatsoever, rotation is how I expect it to be when I update every tick with an interpolation duration of 2. How can I solve this?
val display = sender.world.spawnEntity(sender.location, EntityType.ITEM_DISPLAY) as ItemDisplay
display.itemStack = ItemFactory(Material.DIAMOND_HOE).setCustomModelData(6).build()
display.itemDisplayTransform = ItemDisplay.ItemDisplayTransform.HEAD
var tick = 0
Bukkit.getScheduler().runTaskTimer(BandiCore.instance, Runnable {
tick++
if(tick < 100) {
display.interpolationDelay = -1
display.interpolationDuration = 2
val matrix = Matrix4f().translation(0.0f, tick.toFloat() / 20f, 0.0f)
display.setTransformationMatrix(matrix)
}
}, 0, 1)
Here is some example code of how I have done this (this is purely for testing so please ignore me not stopping the timer)
is this supposed to follow something?
Later this will follow a precalculated track
However right now I am just moving it up in a straight line
How do you enable editor scroll zoom in Intellij IDEA?
(Ctrl + wheel up) is zoom in
(Ctrl + wheel down) is zoom out
How did you get to that
I just switched from Eclipse to it, after around 5 years lol
there's a search bar in the settings
np
awesome
Do you know about these too?
what's the shaded version and what's supposed to be original-..?
Ohhh
Just take the normal one
Yeah I am just figuring this out because its all new
it's kinda nice though
better than eclipse for sure
imo
all those jars are from maven.
its maven build configuration
its not ide specific, maven is build tool
you can use it in eclipse too
should I ever touch it?
sure lol
When you want to change/update dependencies
or edit overall build config
or when you want to change how your plugin is built in other ways ^^
ok so I've added vault I dont remember how but as a JAR. i haven't messed around with pom.xml. That's ok too?
But it works
It won't compile
no
How do you add it normally
in the pom
read the vault-api documentation
usually the resource /plugin has documentation for it
Oh ok
bump
I love intellij
Try finding where the other commands are registered
Is this how the folder structure should look like though?
I am not a fan of main and java things
and resources
yes
src/main/java is the default location for gradle and maven projects to detect classes
you can change it
but in general no one does it
since it logical enough
In eclipse I used to do
main plugin class was located in .Main package
all events classes were located in .Events package
etc..
package names all lower case
I wanna play around with it how would I change it?
you can remove main and java if you choose
it will build fine, you just have to specify your src folder for resources in your pom
Got it, thanks
Also a shortcut to import all missing imports?
If you know
In Eclipse it used to be Ctrl+Shift+O
I don't recall IJ having anything similar. I know you can import specific ones with Alt + Enter or something
I remember being frustrated trying to just import everything necessary and not being able to -,-
there can be multiple imports for something however, so it's best to just check
So if I use protocol lib I can do that to not require it in the plugins?
Yeah I kind of feel the same right now lol. thanks
plugin?
naaaaaah i'll leave it as it is
Also is there a way to show file extensions? I'm kind of used to it xD
Do you guys miss the java.util.List; from the import class context in intellij?
It auto imports the java.awt one
Like why?
I don't have that problem
I mean its all gonna be .java anyways
I'll do a fresh install of windows + apps since i haven't done it in a long while
only if i work with swing
since then awt has a * import
then you can just go to list, ctrl+space and reimport the right one
if a file is empty it'll show the extension i reckon
is it just me or when I write my code in java the more i look at the solution, the more i hate it?
its not bad code, but its that feeling this should be better, that could be probably minimized etc
I know the feeling but I tend to minimize my code as much as possible with my knowledge xD
getting text form an anvil
So that it doesn't piss me off further on, and I recently started adding all possible methods annotations and function header comments.. The code is so much better and readable
Helps, if you abandon the project and decide in a few months/years to return to it
You'll know exactly what you were doing and what is where
its fine as long as the codebase is not big
not because its not clean coded
depends on what you mean by minimized, but yes I feel like that too
that means the OOP has taken over your brain autopilot
i mean i've nearly finished my command api, that i've done in like 24 hours, it works fine, it has automatic tab completion, custom permission, execution, usage handlers, yet it feels like i've done some kind of shitty code
Thats normal. To complete an entire project in 1 day feels akward..worthless.. in the first place
I am happy when I complete long-term projects that took me a few weeks
If it's like a few days project.. then it's whatever
is there any painless way to do integration/unit tests in spigot?
the thing is i have some OBC code so i cant just use mockbukkit
Manual
everything that doesnt need visuals can be tested
just write code that works ๐คท
To be honest i don't make that many mistakes anymore
I feel like testing code id such a tedious process
I bet there are ways that you forget to account for to still face bugs
we had that with pathetic
we thought of everything
but thats the issue
since you maintain a big ass project you cant think of everything
changing stuff in this module could break stuff in that module
even tests could pass but bugs will still appear
and those who will run into the bugs are the ones using it
since they are the closest
Whats the problem here?
[20:56:56 ERROR]: Error occurred while enabling HytteMiner v1.0 (Is it up to date?)
java.lang.NullPointerException: null
at com.marqus.hytteminer.DatabaseManager.DatabaseConnector.<init>(DatabaseConnector.java:12) ~[?:?]
at com.marqus.hytteminer.HytteMiner.onEnable(HytteMiner.java:23) ~[?:?]
at org.bukkit.plugin.java.JavaPlugin.setEnabled(JavaPlugin.java:321) ~[patched_1.8.8.jar:git-PaperSpigot-445]
at org.bukkit.plugin.java.JavaPluginLoader.enablePlugin(JavaPluginLoader.java:332) [patched_1.8.8.jar:git-PaperSpigot-445]
at org.bukkit.plugin.SimplePluginManager.enablePlugin(SimplePluginManager.java:407) [patched_1.8.8.jar:git-PaperSpigot-445]
at org.bukkit.craftbukkit.v1_8_R3.CraftServer.loadPlugin(CraftServer.java:359) [patched_1.8.8.jar:git-PaperSpigot-445]
at org.bukkit.craftbukkit.v1_8_R3.CraftServer.enablePlugins(CraftServer.java:318) [patched_1.8.8.jar:git-PaperSpigot-445]
at net.minecraft.server.v1_8_R3.DedicatedServer.init(DedicatedServer.java:203) [patched_1.8.8.jar:git-PaperSpigot-445]
at net.minecraft.server.v1_8_R3.MinecraftServer.run(MinecraftServer.java:563) [patched_1.8.8.jar:git-PaperSpigot-445]
at java.lang.Thread.run(Thread.java:748) [?:1.8.0_312]
[20:56:56 INFO]: [HytteMiner] Disabling HytteMiner v1.0
[20:56:56 ERROR]: Error occurred while disabling HytteMiner v1.0 (Is it up to date?)
java.lang.NullPointerException: null
at com.marqus.hytteminer.HytteMiner.onDisable(HytteMiner.java:59) ~[?:?]
at org.bukkit.plugin.java.JavaPlugin.setEnabled(JavaPlugin.java:323) ~[patched_1.8.8.jar:git-PaperSpigot-445]
at org.bukkit.plugin.java.JavaPluginLoader.disablePlugin(JavaPluginLoader.java:360) [patched_1.8.8.jar:git-PaperSpigot-445]
at org.bukkit.plugin.java.JavaPluginLoader.enablePlugin(JavaPluginLoader.java:336) [patched_1.8.8.jar:git-PaperSpigot-445]
at org.bukkit.plugin.SimplePluginManager.enablePlugin(SimplePluginManager.java:407) [patched_1.8.8.jar:git-PaperSpigot-445]
at org.bukkit.craftbukkit.v1_8_R3.CraftServer.loadPlugin(CraftServer.java:359) [patched_1.8.8.jar:git-PaperSpigot-445]
at org.bukkit.craftbukkit.v1_8_R3.CraftServer.enablePlugins(CraftServer.java:318) [patched_1.8.8.jar:git-PaperSpigot-445]
at net.minecraft.server.v1_8_R3.DedicatedServer.init(DedicatedServer.java:203) [patched_1.8.8.jar:git-PaperSpigot-445]
at net.minecraft.server.v1_8_R3.MinecraftServer.run(MinecraftServer.java:563) [patched_1.8.8.jar:git-PaperSpigot-445]
at java.lang.Thread.run(Thread.java:748) [?:1.8.0_312]
Connector class: https://paste.learnspigot.com/ucuqimijej.java
Main class: https://paste.learnspigot.com/vuzopufoye.java
LearnSpigot provides a free web-based pastebin service for storing and sharing code snippets with anyone. Powered by hastebin.
LearnSpigot provides a free web-based pastebin service for storing and sharing code snippets with anyone. Powered by hastebin.

you're loading your connector class before you set your static instance. Such traps can be avoided by properly using dependency injection
Their wiki tells you how to: https://github.com/PlaceholderAPI/PlaceholderAPI/wiki/PlaceholderExpansion
I generally just do this
So you can do registerPlaceholder("name", Player::getName);
and it'll be %whatever_name%
?json
does anyone got a util or a guide on how to handle json config files?
just use gson
honestly I don't know much about it for java
So gson is basically magic
got a link I can look at? or any info
Thanks
No NullPointers xD
nah just static
Oh ok but I'll do it myself. It wouldn't be a challenge if I didn't ๐ค
Any downsides to json? compared to yaml
Not as readable
I'll use it to store user data that isnt expected to be edited by hand
uhh
you want a database for that
if its cross server
not a shitty adaptation of a config server
sqlite is a thing
No i dont want a db
you could use sqlite and with some minor changes support mysql too :p
or just go binary instead
wouldn't reading&writing to binary take longer than just pure json files
depends on how it's set up
but no that's not how it works
json files are just binary encoded in a standard format
Sure if you know exactly what lines to write maybe it's faster
I'm generally looking for a faster solution compared to yaml, and it doesnt have to be user friendly
Then yeah go binary
How am i supposed to handle reading and writing to it
Just use guava's ByteArrayDataInput / ByteArrayDataOutput
colors support, etc..
Im just using JSON because i cant be bothered to have binary, and somebody should be able to edit it just in case
Yeah I'll go with json/gson what imillusion sent me
yml files for configuring, json for storing data
Here are some links to get you started on learning Java:
- https://www.codecademy.com/learn/learn-java
- https://www.sololearn.com/learning/1068
- https://www.learnjavaonline.org/
- https://programmingbydoing.com/
- https://docs.oracle.com/javase/tutorial/java/index.html
The last one is the only official one, however some of those concepts assume that you already know a bit about programming. https://media.discordapp.net/attachments/694661573125472256/998143126373941248/6n0v4g.gif
Bruh
No
I jeas just getting confused on smth in the for and catch statement
Just reviewing that
Otherwise I told you iam the next Google CEO : )
cringe
xD
is there a way to send through plugin messaging a command that the proxy should execute?
you don't need PMC to execute commands on the proxy
yes but why
^^
Coded a ban hammer. The ban system is on the proxy
it has its own command interpreter
you can just code ban command for bungee
i also coded a ban hammer
which builds a pen*s below banned player
shoots him to the sky and then laucnhes a firework when he reaches 255
There is one. But how does the spigot plugin execute the proxy command
Any idea?
can't
Well
create some sort of bridge
Not even with plugin messaging
With some clever engineering you can
Like?
well why don't you just put banned player in db
exactly
.
so every server knows he is banned
also yeah you can send things to the bungee with a plugin channel
just send a message with like banhammer:execute channel
or smth similar
or just send player name
Also you can just create the pen*s thru packets :)))
and when proxy receives the name it just bans the player
okay thanks!
okay
feet
feet
Sick ty
@umbral ridge
hello, do someone know how can i delete itemflags and unspecifics meta from an item pls ?
hello guys what is duplicate entry: net/minecraft/core/particles/Particle.class
item.setItemMeta(null);
100% sure
i tried, but still not working
wdym
jree fava lessons
๐ฉ
Alpacsus
How should I go about having my plugin ignore an existing config while testing? I'm currently developing a config, and don't want to code it to always over-write in-case I forget to undo it, but also don't like having to delete the config file manually every time. Is there a built-in way to handle this?
Unsure of the name of the option in IJ but it's probably called "Code mining". You should be able to search options
At least that's what it's called in Eclipse and most other IDEs
I mean no, but neither is starting up the server but people (including me) have came up with all sorts of different ways to have the server automatically start when we build the plugin lol
It's just tedious to have to do it every time you want to test a minor change to your plugin
Bruh
I do have my server copy a fresh set of plugins on startup.
I do not envy your testing method lmao
Write better code and you need less testing ๐
Do more testing and you can write better code
well true I guess
Thanks. I've found it. So much better now 
?paste
must be silly to ask but i cant figure out where i messed up basically i have setspawn command and i register it in function registerCommands which is called in onEnable and i still get error that Setspawn was not found
case
?
oh class not found
open your jar with any compression utils and see if the class is there
Hi there
I'm learning spigot and I have an event problem
I'll send it
@EventHandler
public void onPlayerWroteOnBookEvent(PlayerEditBookEvent bookEvent) {
BookMeta newBookMeta = bookEvent.getNewBookMeta();
newBookMeta.setPage(1, "FUCK YEAH");
bookEvent.setNewBookMeta(newBookMeta);
}
it is there but it is all lowercase but in IDE it is with first letter Uppercase
So, the problem is that for some reason it only changes the page 1 when i write stuff in a new page or when I swap the book slot
I can;t help with kotlin
silly cocklin
but good call with opening jar cuz i would never see this literally
I think I know the problem now
It changed only server side
Hey, does aybody know how to fix this error https://pastebin.com/Y0NwuzxT ?
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.
My pom.xml is apparently correct
<dependency>
<groupId>org.geysermc.geyser</groupId>
<artifactId>api</artifactId>
<version>2.1.2-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
<repository>
<id>opencollab-snapshot</id>
<url>https://repo.opencollab.dev/main/</url>
</repository>
Is making plugins a good way to learn programming?
sure
anything is
you don't have GeyzerMC on your server
Could I make a check and use the API only if it's present in the server?
or will it always throw that error?
yes you can check
add a method that returns a bool isGeyzerMC
in that Class.forname(... and check for a valid GeyzerMC class
if its found return true, false on error
ok, thanks
what about ```java
if (getServer().getPluginManager().isPluginEnabled("GeyserMC")) {
geyserApi = GeyserApi.api();
}
yes
if thats the plugin name
you will need to add GeyzerMC to your plugin yml in softdepend
what's y'alls thoughts on CompletableFuture?
some people tell me not to use them
ever
but i disagree
i kinda like them
I got a whole guide on them
there'll come a point in your time making plugins where you'll start to dabble in concurrent environments and they'll be great
because honestly who wants to deal with using runTaskAsynchronously for database IO
They're nice but you need to know how to use them
You'll also need to know how to work in a concurrent environment so you don't have weird issues because things will not work in order
But the end result will end up looking sleek
there's always the same discussion on whether a future makes sense if all you do inside is to supplyAsync(). Imho it makes little sense.
someone who'd want to run this async could just create a future themselves with that method
Imho a future only makes sense if you do more than simply calling supplyAsync. If someone wants that done async, they could just wrap it into a future themselves
if however ofc you offer both variants, e.g. public X getX() and public CompletableFuture<X> getXAsync(), that's fine
Does anyone know how I can set an extremely large portion of blocks to be different in the most optimised way? something about batches I really donโt know? thanks
it just makes little sense to wrap EVERYTHING into a future, e.g.
public CompletableFuture<Void> touchFile(String name) < - that's pointless
I say extremely large, litterally any number
Not necessary Alex
True, I do know how to use them and how to handle exceptions, ect. Their better than bukkitrunnables in some ways
Sometimes itโs good to complete a Void future when thereโs even the slightest chance you need to depend on the action being completed
That's all that's in the class I dont just do supplyAsync ๐
otherwise you need to guess โit might be done after 70 ticksโ and hope it didnโt errror
Anything that does IO deserves a future
CompletableFuture everything in an api if it has the chance to be async, please
otherwise api misuse can end up in some severe freezes and people will blame you for it
wrapping a basic Map#get in a future is stupid
That's what I do in my ConfigLib, somethings that's in ConfigInstance are async with some methods having synchronized since I dont want people who dont know what their doing have issues
Try to minimize the stress
or is it just not possible to update blocks in batches?
Because starting the plugin and then shutting it down immediately due to an invalid config can get pretty tedious
If I want like a async method that's delayed I'll use BukkitRunnable else I'd usally use CompletableFuture
I tend to cheat and use a TaskChain lib... so if I need a sync callback I can do that easily without gross nested BukkitRunnable stuff
yeah but what if you're writing a public API
Ig, it's harder to understand
But I have async and sync methods so if people dont know what their doing can just use the sync methods
For example on my Skyblock core (v2) I'm using futures for most non-instant tasks, like pasting an island, as well as anything that requires communication between multiple instances, like claiming ownership of an island
And ConfigLib is available to the public
Yeah that makes sense, sense it takes time to create a thread
you can have both sync and async methods. Just have the sync methods call .get on teh Future
So threads are kinda paused
n o
Oh
yes
I strongly advise against joining futures
@worldly ingot when payoneer payment method coming ?
Nah I don't do that
- that'll have some performance issues
get makes the method calling the Future wait for the return
Since it has to wait for the thread to complete
wtf is payoneer?
and there's no point in pausing a thread, spinning up a new one just do do a basic task
Ong
It's like telling your friend to do XYZ and then waiting for them
That's like paypal
instead of just doing it yourself
and not doing anything else until they're done
Also my country doesn't have PayPal ;-;
sounds like a you problem
I'm pretty cautious with using CompletableFutures anyways
I only use it for things that will probably be done once or not so often
Ehh there's no inherent danger
I'd still recommend adding all those futures to some kind of collection so you can join them all onDisable
Just to be sure because the server might die while some futures are unfinished
Ye
But I made sure everything is thead-safe that is getting accessed through async
Everything else is just normal
I like to just be lazy and slap a ConcurrentHashMap everywhere
ConcurrentSkipListMap is love
xD dont worry I do too ๐
Everything is somewhat neat tho
public synchronized static ConfigFile<?> createConfig(@NotNull ConfigFile<?> configFile, @NotNull List<CachedConfigField<?>> cachedFields) {
if (!configFiles.containsKey(configFile.getFileName()))
configFiles.put(configFile.getFileName(), configFile);
if (configFile.getDefaultFile().exists()) {
Bukkit.getLogger().info("[ConfigLib] Config file " + configFile.getFileName() + " already exists, skipping creation");
return configFile;
}
long amountOfTime = new Timer().start(() -> {
ConfigCreator.writeFile(configFile, cachedFields);
return null;
}).get();
Bukkit.getLogger().info("[ConfigLib] Created config file " + configFile.getFileName() + " in " + amountOfTime + "ms");
return configFile;
}```
I do gotta make a system so it checks all the paths and sees if theres one missing
Easy enough tho
I made one like that pretty recently
Want the code?
It's pretty simple: get the existing file, and the newest file (copy into a file that you'll delete at the end of the method). Get the newest lines, and write the existing file whenever two lines that are the exact same up untill the ":" symbol (as the rest is user configurable). After that just write the newest lines with the user configuration into the existing file and delete the newest file. Auto-update without any downsides
Why... chicken tender?
But I guess you've got some custom classes, so I don't really know if you need this system
that's great. it was just a general thing I wanted to say, not really related to what you sent
If you only want it for the async execution I use ForkJoinPool
Completable Futures, more like JS promises.
[01:23:52] [Server thread/ERROR]: Error occurred while enabling HytteMiner v1.0 (Is it up to date?)
java.lang.NullPointerException: null
at com.marqus.hytteminer.HytteMiner.onEnable(HytteMiner.java:36) ~[?:?]
at org.bukkit.plugin.java.JavaPlugin.setEnabled(JavaPlugin.java:321) ~[patched_1.8.8.jar:git-PaperSpigot-445]
at org.bukkit.plugin.java.JavaPluginLoader.enablePlugin(JavaPluginLoader.java:332) [patched_1.8.8.jar:git-PaperSpigot-445]
at org.bukkit.plugin.SimplePluginManager.enablePlugin(SimplePluginManager.java:407) [patched_1.8.8.jar:git-PaperSpigot-445]
at org.bukkit.craftbukkit.v1_8_R3.CraftServer.loadPlugin(CraftServer.java:359) [patched_1.8.8.jar:git-PaperSpigot-445]
at org.bukkit.craftbukkit.v1_8_R3.CraftServer.enablePlugins(CraftServer.java:318) [patched_1.8.8.jar:git-PaperSpigot-445]
at net.minecraft.server.v1_8_R3.DedicatedServer.init(DedicatedServer.java:203) [patched_1.8.8.jar:git-PaperSpigot-445]
at net.minecraft.server.v1_8_R3.MinecraftServer.run(MinecraftServer.java:563) [patched_1.8.8.jar:git-PaperSpigot-445]
at java.lang.Thread.run(Thread.java:748) [?:1.8.0_312]
Command https://paste.learnspigot.com/deleduroyu.typescript
Database https://paste.learnspigot.com/ihetiyosad.java
Main class https://paste.learnspigot.com/jirovitozo.java
LearnSpigot provides a free web-based pastebin service for storing and sharing code snippets with anyone. Powered by hastebin.
LearnSpigot provides a free web-based pastebin service for storing and sharing code snippets with anyone. Powered by hastebin.
LearnSpigot provides a free web-based pastebin service for storing and sharing code snippets with anyone. Powered by hastebin.
whats the problem?
what's HytteMiner line 36?
its command
you didnt dexlare your command in plugin.yml
hytteminer not found
np. ever thought of using a command framework?
can highly recommend ACF
it's made by aikar
Uhmm, can you link?
Also add like description: or permission: after that to avoid further errors
there's a ton of other command frameworks, but
- this one was made by aikar, one of the (former?) paper devs
- it's extremely flexible, no need for any stuff in plugin.yml
- but unfortunately the documentation is a bit bad and you gotta figure some things out yourself.... or ask here again
basically using ACF you can reduce your normal command code by like 90%
do you mind if I dm you about it? ๐
you mean glow?
Only leather cam be dyed
Here's an example:
Imagine you have this command:
public class ExampleCommand implements CommandExecutor {
@Override
public boolean onCommand(final CommandSender sender,
final Command command,
final String label,
final String[] args) {
if (!(sender instanceof Player)) {
sender.sendMessage("Only players can use this command");
return true;
}
if(args.length == 0) {
sender.sendMessage("Please specify a player");
return true;
}
final Player playerToSayHelloTo = Bukkit.getServer().getPlayer(args[0]);
if(playerToSayHelloTo == null) {
sender.sendMessage("Player not found");
return true;
}
playerToSayHelloTo.sendMessage(sender.getName() + " says hello to you!");
return true;
}
}
Otherwise it's a custom texture
I don't think so, I just know its possible to set the tint on any item and use it in a resource pack
in ACF it'd be like this:
yeah thats what i mean
@CommandAlias("example")
public class ExampleACFCommand extends BaseCommand {
@Subcommand("hello")
public void onHello(Player sender, OnlinePlayer playerToSayHelloTo) {
playerToSayHelloTo.getPlayer().sendMessage(sender.getName() + " says hello to you!");
}
}
oh actually the normal example would be more complicated, I forgot that the normal command also needs a subcommand "hello"
but yeah as you can see, with ACF you can reduce all the boilerplate code from commands like parameters being another player, subcommands, player-only commands, etc bla bla
Man, just make your own custom command
no problem
So what's the problem?
I don't know how to tint it
Well you make a texture pack
And you can either change the whole item
Or just an item with CustomModelData
well I know there's a way to do it without custom model data
But you'll have search that one up, I haven't really used that, ever
origin realms allows you to dye any item
I have the tint setup in the model i just need to figure how to modify the nbt or what method i need to use
A client cannot use textures that he doesn't have
So the texture must be provided in some way, by using a texture pack is the easiest probably
ooooooh i see thanks
Oh lol, my bad
Ong
never checked but yep
Whaaat
Server with RPs ๐
You can tint a non-leather item without a txt, and only using leather horse armour and some voodo magic?
well I was mistaken, it only works on leather items but you can modify the model of it so it doesn't matter
how can i get rid of these LF squares
Letโs see the code
What's the server platform that has no api? Like it's the bare minimum for an mc server you get to create your own api?
I keep forgetting it
I wanna try it out
Minestom
and i have -Dfile.encoding=UTF-8 in jvm flags
Ty
Remove the \n
makes sense lol
yea
it's not even "create your own api" but also "no vanilla mechanics at all builtin"

@clear panther