#help-development
1 messages · Page 923 of 1
fuck the jvm *
Why was kotlin written for the jvm?
Why can't it be a seperate lang and just not fuck me off in this channel
"ah fuck yes let's make our code easily reverse engineerable for fun"
Lol
Bro has NOT seen KotlinC output Before
Nah
Groovy has more built in obf
I stopped trying to decompile shit longer ago
But it’s definitely harder to read than just pure java compiled
Nah its because it had to add so much glue code which you would have had to write in to get the same effect
and also nullability chr king
But you can remove that with compiler options
I would migrate over to kotlin if I didn't enjoy java as much as I do
Yeah its getting better
Fair, I was a java nerd until I used Kotlin for work
And now ive stuck with it since
I kinda wanna migrate over to C sooner or later
Kotlin has been great for me
I started making lots of standalone apps recently and I might wanna go for performance
C is java with hidden surprises called segfaults and memory leaks
Well C is not java
Damn bro, my brain is already melting with I/O streams, chill out
It is, until you try and scale beyond 3 source files which don’t require dynamic allocation
true
The only assembly I might learn is 6502 assembly or whatever it's called cuz I like the challenge old consoles offer
Zamn
Have ya guys seen that guy who made a CPU in excel?
Like, a literal cpu with ram, rom and a screen, all in excel?
Ik
I made something similar in mc before
A PRNG
Bitwise operations are usually faster but this is microoptimization lmao
& 1 a by about 1 nanosecond
And thats if the compiler doesn't just switch % 2 to & 1 automatically
Anyone has some type of idea?
?
project ideas
uh
you can help me develop my antibot
it's pretty sick
you could add like BungeeCord and Velocity support
or what did you mean by project ideas?
preferably a new project
create a fork of spigot and rewrite it from scratch
WITH A BUILT-IN ANTIBOT
what antibot
also, that's not how that works
many plugins rely on CraftBukkit
and on reflected fields
so you can't really rewrite everything
Hi. Im making a countdown on a bossbar but ive run into an issue and it just doesn't work.
The plugin is supposed to start a countdown with /startclock, pause it with /pauseclock and resume it with /resumeclock.
Im not sure of the issue.
Main Class:
https://pastebin.com/23TxdVAA
Bossbar Class:
https://pastebin.com/PAHn4ph7
Error:
https://pastebin.com/AP748fpC
Thanks for any help. I am really stuck
Cannot execute command 'americanfootballenhanced:flag' in plugin AmericanFootballEnhanced v1.0 - plugin is disabled.
The plugin is disabled
how do i enable it
bc it worked fine before i added the other commands
wait yeah it does disable like instantly
Check startup logs
[21:50:04 INFO]: [AmericanFootballEnhanced] Disabling AmericanFootballEnhanced v1.0
My bet is you forgot to add a command to plugin.yml
Hi! Just wondering, how performant is the copy partial matches method here https://hub.spigotmc.org/javadocs/spigot/org/bukkit/util/StringUtil.html#copyPartialMatches(java.lang.String,java.lang.Iterable,T) ?
I'm expecting to be dealing with a list anywhere from 1 element in size all the way up to a couple thousand elements. Given that I'll be calling this within a tab completion method, I'd like to ask, how performant is this method? Would I be better off implementing my own method to get partial matches?
declaration: package: org.bukkit.util, class: StringUtil
it's pretty straightforward
ig you could reuse a pre-sized list so you aren't creating a new one that is getting resized all the time
but the actual checking is very simple
also, how would i be able to display the time remaining like, 4:26
bossbar class
https://pastebin.com/PAHn4ph7
alternatively use a prefix tree or smth
I'm not sure haha. I guess there's maybe the option of using a hashmap somehow (Although I'm not sure how that would look), but I'm wondering whether I'm looking to micro-optimise here and worrying too much about something which doesn't matter a whole lot.
I mean, depends on the actual size of the collection you are passing
as emily said, prefix tree would be a potentially faster alternative
however, that is only really nice if the elements in that collection don't change too drastically too often
I would just not bother that early
its super simply to switch out later
go with the existing method and if you run into performance issues with it down the line, revisit it for improvements
It could vary. The data is all stored in a database, and could range from 0 elements all the way up to hundreds of thousands (Although I'm not expecting any more than a couple thousand). The list I'll be using is just an in-memory cache of a column in the table.
But yeah, I think based on what everyone's saying here I'm probably looking to micro-optimise something which, as you say, can be easily fixed later should any issues crop up.
Yea 
Alrighty then lol. Thanks all for your input! Hope your days go well.
Depends what you doing you could easly cache them in a memory database*, like Redis to mention one its has a great way for catching huge amount of data. It also support easly clustering, meaning you can distribute many databases around world and have the same data
Yeah that might be worth-it long-run actually. I have some other data which is a bit too large to store in a Java hashmap so I'll look into that in the future
oh nice, its always good to try new things
Yeah for sure, that's what males it fun :P
Also redis is not limited just to catching, you can also send something like push-pull. Where you publish data and then subscribe to it, getting it anb/or sending it back in different servers
Oh interesting. Not sure how I'd be able to use that, but It's nice to know that's a thing
have you seen those fast data updation or messages sended across many servers? Most of time they make use of redis pub/sub for that
Trying to implement database functionality with hashmaps is a bit tedious and time consuming to do
I haven't, no. Interesting to know they use Redis
Do you know whether I'd need to still interact with Redis within an async task, or is it performant enough to access from the main thread?
well, there is as every database. No database is recommended to be handled non async
Because what if the connection goes off by any reason? Whole app or server is freezed until the connection recame back
Yeah fair enough. The main advantage for me with using Java HashMaps is that I'm able to access them from the main thread, but there is still data that could benefit from the performance gains with Redis anyway, so it would still be useful.
Plus data to take in care that Redis is coded on native lang (C++) so its too fast for usage, supports data replication again many instances and even distribute it via many different locations by using clustering concept. Also data types it support is mainly binary and strings so that make it usable in any languages no mattering their data types
By chance, are you a sales person for Redis :P
Redis is my whole life haha, i used it for deploying a "big network" which was expecting to be distribute against 2 locations, one for American and another for Europe. I take the big care of sincronizing data between server-proxy and proxies-proxies. There i have said anything you could think haha
i mean, no network IO op will be as fast as local memory access
I'll take your word for what you've said then haha. Nice to meet someone which such enthusiasm
no hahaha, i just love the things you can do with clustering, distribution and with programming
Right yeah
Of course, it's like everything else, but you always have the incognito called memory. Where without memory you do nothing. hahaha
@round finch https://github.com/mfnalex/CustomBlockData
Hi. Im having an issue where the bossbar doesnt update and the clock doesn't count down at all. /pauseclock, /resumeclock and /final do not work at all
Here is the code:
https://pastebin.com/pvNbQhD7
There were no errors
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.
please be patient and remember not double posting same messages. In case not wondering to being losted across many messages we suggest opening a thread on this channel
this is a different issue
oh my bad 😂
lol its good
lmao weird my country detects that site as blocked because of suspicious domain actions
lol
also makes sense because the site is all in white, maybe thats one of it reason Hahah
is there anything you can see that is causing the error?
i wish could but the page starts loading and after some ms appears the message the web is not secure and blocked by my country because of privacity reasons and security risks. Sorry tho
can you use the next paste?
?paste
sure
right it works, which was the issue?
/pauseclock, /resumeclock, and /final just dont work
no error in the console
it just doesnt work
okay, is the bossbar even created?
yeah
/startclock works
oh yeah, the minutes:seconds things doesnt work
it prints like 6:1
and is like that the entire game
Could you describe the mainly idea of each command
So i can check it more in detail and try to help better
yeah sure.
/startclock - will start the countdown on the bossbar. it goes for 361 seconds. That is the countdown variable
/pauseclock - should save the bossbars progress, save the seconds remaining (pausedCountdown) and is supposed to pause it (Doesnt work)
/resumeclock - uses the saved variables from /pauseclock and resumes the countdown
/final - makes the bossbar title Final and displays each teams name and score. those are in other classes. it also sets the bossbar progress value to 0
@sterile token
right perfect, sorry for not answering fast. Im currently working but i will check it
thats fine. ive got a while. thanks for the help though
update: i put all the code in a different class to see if the startclock command would be interfering with the class name considering there are other commands there. it didnt work. startclock is still the only one that works which means there is something wrong with the code of the other commands
and the minutes:seconds thing
how do you get a block face at which the block was broken?
I want to cancel the BlockBreakEvent and then spawn a particle on the opposite direction of the block face that was clicked to be broken
red is the block face
blue is from where i want to spawn a particle
this is an example for blockface top
yhhh iam working on something else
so iam working on a package system daily , etc etc
so when a player click on it , he can recive it only 1 time a day , and after that he can recive it after 24h
Are u using something for animations? If you know smth i would be greatfull if you cand recommend me one
how i can convert long to h , m , s?
TimeUnit is the simple one
no animation yet
oh right, thanks tho
Self Proclaimed inventory Genius Stumped WIth Inventories truly Tragic
rayTraceBlocks, get the face from the result
thanks emily 
I also asked all time the same question why spigot doesnt add some useful things, like something for time parsing in formats, getting indivual units like seconds, milliseconds, hours, etc of the parsed time. Also being allowed to re formatt it to display it in another format, etc

Countdown Bossbar - /pauseclock, /resumeclock and /final fail to work

I dont think doing something like this is difficult just take some hours to code it and test it
But idk as far as is not my own product i dont care, but definitly would be something i would always think for my own products
ideas?
what's the velocity of a fully charged arrow? i want the arrows fired from bows to always be the speed of a fully charged arrow, no matter how much the bow was drawn back.
Arrow arrow = (Arrow) e.getProjectile();
arrow.setVelocity(??);
what value should be in setVelocity to make this happen
The question is though, how do you set the particle direction 😂
or rotation?
they moved to https://repo.papermc.io/repository/maven-public/ since a long time ago
updatable lore each seconds
so it decrease the time by 1 second ..
still not importing
and now this dud is red
need java 17 for velocity
appreciate it
well
u chache the inventory
and each second
you update the item
you want to animate
does Player#setResourcePack support local paths?
what is "data" ???
Cannot invoke org.bukkit.craftbukkit.v1_20_R3.block.data.CraftBlockData.getState()" because "data" is null
how can a block be null at a blockbreakevent
on top of that, I never call getState
only http and https are supported for resource packs URLs
But there are things out there to host a small http server
gg
alongside your spigot
i need to dynamically generate the pack
then youll need to put the pack in your little http server
figure out some way to host it then
basically you host a mc server at :25565 and an HTTP at :80
How do you get a location of blockFace? to spawn a particle at that location? at the blockFace side? xD
you dont need HTTPS
block centre + 0.5 in whichever direction the face is
alrightt
while you don't need https, it isn't hard to get a cert for it and most browsers like to complain about http these days lol
nice explorer crashing again
just kill com surrogate
i usually just open up my cmd and do /taskkill /f /im explorer.exe and then type explorer lol
it isn't explorer that froze up
hmm
its com surrogate
what's its exe?
that is it
with a space?
Well that its process name, the actual exe is DLLHost.exe
but you can't just kill that
since it provides other processes
and yes the process name has a space
Windoze
so just use quotes or use task manager
killing com surrogate will not kill the task of moving or copying files
what it will do is force it to restart and stop processing other things it doesn't need to be doing and restart on the thing you want it to do
may take it a few seconds to do that
if you see multiple processes, just kill them all 😉
there will be one that you seem to not be able to kill as it comes back and thats the one for your copy process lol

Hey! How can i do that a lightning strike don't delete items on the ground?
Did it work?
it started working all of a sudden right after i killed explorer.exe... as always
i couldnt find com surrogate
Do you have the expanded view for task manager?
Killing explorer also kills com surrogate
Frostalf do u suggest ending random processes that take too much resources ?
yes its always expanded as much as possible
xDD
Not necessarily, but if you are ok with potentially having to restart go for it. If its a critical os process task manager will let you know. By saying something like if you end this process it will force windows to shutdown
is there a way to make this work so the method enforces the pipe which is being added to have the previous's pipes value as key?
If you get that message best to probably leave that process alone lol
Then why did you choose wednesday? Lol
I didn't
that's the time of the notification
You probably have all kinds of services that run
Apparently it still has bloat
So one of the things i recommend renaming is the game bar
Especially if you dont use the xbox stuff
I dont but I actually need to have it installed to play games such as Sea of Thieves
which utilizes xbox login
Its called gamebarpresencewriter it still runs even if you disable xbox stuff and likes to take up io time on the disk. Just navigate to where the exe is at. Take ownership of the file and rename it
rename it to frostalf.exe
If you want
frostalfwashere.exe
Windows updates reinstalls that file from time to time
frostalf-the-bytes-lover.exe
So a little annoying
It does a lot of things when it updates
resets some of the settings
to its preferable state
Yeah, i need to refind the defendet screen exe
I was thinking of switching to zorin os
I always use Sophia Script to mass change settings and debloat
I keep getting this text input exe that runs and it comes from that process yet again even if its supposed to be disabled
lol
Just use plain debian 
Hi. Im having an issue where the bossbar doesnt update and the clock doesn't count down at all. /pauseclock, /resumeclock and /final do not work at all
Here is the code:
https://pastebin.com/pvNbQhD7
There were no errors
/startclock - will start the countdown on the bossbar. it goes for 361 seconds. That is the countdown variable
/pauseclock - should save the bossbars progress, save the seconds remaining (pausedCountdown) and is supposed to pause it (Doesnt work)
/resumeclock - uses the saved variables from /pauseclock and resumes the countdown
/final - makes the bossbar title Final and displays each teams name and score. those are in other classes. it also sets the bossbar progress value to 0
Not sure why microsoft puts disable options if processes just continue to run
You're never updating the minute nor second variable
how do i?
oh
what abt the commands?
please create objects instead of having everything in one class it would make it more readable. And your pause command should work in theory
wym by objects
im newer to java sorry if i sound stupid
so in java we have objects that are used to define stuff, your command is an object too. In your case it would be reasonable to create a CountDownBar object with a start() stop() function etc. and the logic within and then pass an instance of it to your command to manage it
Object oriented programming language is java... that being said everything you code has to do with an object. In your case multiple objects, such as strings, ints, etc stuff like that
if you dont understand what i told you here I'd recommend watching 1-2 videos on OOP
i can send you some if you want
?paste
Hey this command violates ocp
/s
/s ?
?
?learnjava
For Beginners:
Codecademy - Learn Java: Interactive Java programming course from basics to more advanced concepts. Perfect for absolute beginners.
https://www.codecademy.com/learn/learn-java
JetBrains Academy - Java Developer Track: Learn by doing with projects and challenges. It covers Java fundamentals to advanced topics.
https://www.jetbrains.com/academy/
Udemy - Java Programming Masterclass for Software Developers: Updated courses that cover Java 8 to Java 17 features. Suitable for those who prefer structured learning.
https://www.udemy.com/course/java-the-complete-java-developer-course/
For Intermediate to Advanced Learners:
Oracle Java Tutorials: The official guides by Oracle for Java programming—great for understanding the depth of Java.
https://docs.oracle.com/javase/tutorial/
Baeldung - Learn Java and Spring: Focus on Spring Framework and modern Java technologies. Best for intermediate learners aiming to expand their knowledge.
https://www.baeldung.com/
Practice and Hands-on Learning:
Exercism - Java Track: Solve exercises and get feedback from mentors. Great for practicing coding skills.
https://exercism.io/tracks/java
LeetCode: Practice your coding skills and prepare for technical interviews with Java.
https://leetcode.com/
Free Resources and Documentation:
Java Programming and Documentation: A comprehensive collection of Java programming guides, tutorials, and API documentation.
https://docs.oracle.com/en/java/
Community and Support:
Stack Overflow: A vast community of developers. Great for getting help with specific problems or understanding concepts.
https://stackoverflow.com/questions/tagged/java
r/learnjava on Reddit: Join the community of Java learners and get advice, share resources, and discuss projects.
https://www.reddit.com/r/learnjava/
Remember: Learning to program takes practice and patience. Don't hesitate to experiment with code and participate in community discussions. Happy coding! 🎉
Here is some helpful resources to help with learning
Ah alright
i want this method to enforce this.
Pipe<?, K> previousPipe;
Pipe<K, ?> nextPipe;
it should take the previous's value as a key.
it doesnt work tho cuz i cant save the previouspipe
i was told to use a builder but couldnt quite get that to work as well
Might be able to use pair's here
whats that
An api in java
Nvm
Probably not going to be useful
Only because after looking it seems it is only present in fx
And i doubt you want to rely on fx lmao
I wonder if the jdk has something similar kind of dumb it only exists in fx
Will have to look into that at some point
Pretty easy to make
Isn’t pair just a class that with 2 generic objects
Basically Map.Entry
Think so
newPosition < 0: (-1 < 0) I get that error when trying to deploy my plugin, what does that mean?
That is the only thing
Nothing else at all?
Not unless this helps https://sourceb.in/Alst0dHbfL
Happened after i added ```java
@EventHandler
public void playerJoin(PlayerJoinEvent event) {
Player plr = event.getPlayer();
String joinmsg = this.plugin.getConfig().getString("join-msg");
joinmsg = PlaceholderAPI.setPlaceholders(plr, joinmsg);
event.setJoinMessage(ChatColor.translateAlternateColorCodes('&', joinmsg));
}
@EventHandler
public void playerLeave(PlayerQuitEvent event) {
Player plr = event.getPlayer();
String quitmsg = this.plugin.getConfig().getString("quit-msg");
quitmsg = PlaceholderAPI.setPlaceholders(plr, quitmsg);
event.setQuitMessage(ChatColor.translateAlternateColorCodes('&', quitmsg));
}
@EventHandler
public void onChat(AsyncPlayerChatEvent event) {
Player plr = event.getPlayer();
if(plr.hasPermission("palasset.staff.format")) {
String staffFormat = this.plugin.getConfig().getString("chat.staff").replace("%msg%", event.getMessage());
staffFormat = PlaceholderAPI.setPlaceholders(plr, staffFormat);
event.setFormat(staffFormat);
} else{
String chatFormat = this.plugin.getConfig().getString("chat.normal").replace("%msg%", event.getMessage());
chatFormat = PlaceholderAPI.setPlaceholders(plr, chatFormat);
event.setFormat(chatFormat);
}
}```
I only changed version to 0.1
It worked
Then i added those events
And got that error
it is likely an issue with a file in your src.main.resources directory, not those events
Probably my config.yml
name: PalassetCustom
version: '${project.version}'
main: caneless.com.PalassetCustom
api-version: '1.20'
depend: ['PlaceholderAPI']
That is my plugin.yml
Yea
Inside lifecycle
Never had this issue before
And how i do that?
: Deployment failed: repository element was not specified in the POM inside distributionManagement element or in -DaltDeploymentRepository=id::url parameter -> [Help 1`]
deploy puts it in a remote maven repo, I doubt its worked
you can sendMessage to console
hyh?
does anyone know the packet responsible for showing the main hand on the limbo server?
Showing the main hand is clientside
You can either 1. Let them have spectator
- Give them invisibility
Or 3. Maybe try to spoof some arm animation of them
Or even 4. Spoof that their attack delay is a large number
if I change the mode to the spectator, how will it show their hand?
It won't
But they'll think they have spectator so it's not a great idea
I can send an hand animation packet, but I do not know how to get an entity id on a velocity
Pretty sure they support it
Personally I'd go for solution either 2 or 4
that is, if you make the player invisible, will his hand be displayed?
why
It will not
Cuz they're invis
I still don't understand, you say that i can solve the problem by making the player invisible or changing his gamemode to spectator, but when I ask why and whether this will really display the hand, you say - "It will not"
also, I can't send the packet I need without an entity id.
"Will it display the hand"
"It will not"
"Why"
"Cuz they're invisible"
oh yeah this one's a banger
but my goal is to make the hand visible
Okay, I'll make a spectator as you advised
java 8?
jackson or gson or another api
?
i chose jackson cuz gson's serialization sucks imo and i barely got it to serialize and i couldnt get it to deserialize, however... the plugin is like 2mb larger now, it quintupled in size
can i remove the stuff i dont use in jackson and not shade it in?
what are you serializing?
"Pet" object
need alteast java 16 for tolist, ur java version and make sure u got also java 16+ language level in project settings
if i want to like use a bukkit runnable, for 10 seconds, do i make it with 1 second delay and add 1 to a var and if var is 10 stop the task?
you wanna repeat it multiple times or only once?
when player hits another player, i set a pdc key to true, then after 10 seconds remove it
and send an action bar while 10 seconds are running
with You're in combat for x seconds
Bukkit.getScheduler().runTaskLater(plugin, () -> {
}, delay);
something like that would do it
isn't it BukkitRunnable?
delay is in ticks
i thought of this
with 1 second delay
and if timer is 10 stop the task
wouldn't that work?
yes
you can do something like this
Bukkit.getScheduler().runTaskTimer(this, (task) -> {
if (ticksPassed[0] >= 20 * 10) {
task.cancel();
}
ticksPassed[0] += 40;
}, 0L, 40L);```
just increment ticksPassed by the delay not by 1
int array?
why array
yeah, put the value in teh runnable and you don;t need final
it showed me that when i put the timer var out of the runnable, so i just put it in runnable, out of run() method
The solution i provided is valid
Bukkit.getScheduler().runTaskLater(plugin, () -> {
}, delay);
Bukkitrunnable uses same methods but this is just smaller
ok
runTaskTimer as you need a repeat
i don't need to register it in the main class, right?
no u dont, u just need to provide plugin for the task
Why insist on json and not yaml?
leave it empty is lambda
you are serializing an object and Bukkit has all this built in
no, you can also run it in any class without a proper instance using the builtin method; MainClass.getPlugin(MainClass.class) which returns an instance of the plugin
but usually not recommended just to use randomly stuff you are not familiar with, excample lambdas and anonymous classes&functional interfaces
smh
when i use yaml
people tell me use json
when i use json people tell me yaml
json is a sub set of yaml
error
btw do i just add var++ and send the action bar
and save the var out of the scheduler
i was using yaml but it gets very complicated since there might be cases for a hashmap inside a hashmap inside a hashmap
Its just opinion, unless its some huge peformance impact with big opetations and stuff it doesnt matter what you use
so i opted to use json for serialization since bukkit doesnt have serialization
yes it does
no it doesnt
ConfigurationSerializable
1.20.4 mc plugin version
u have 1 ) too many
oh mb
i mean u have ) in wrong place
ig thats it
O-O
this is the 5th thing im going to use for storage
first yaml then custom serialization then gson then jackson then back to yaml
Its the best to try everything to learn them :)
next sqlite then mysql then use some orm and then mongodb
I'd always use Yaml for Spigot, unless you are wanting to send json in packets
honestly idek how the database system works for persistence, no one has a clear explanation
Spigot db was removed a while ago. only drivers remain
not sure what u mean english is not my strongest lkanguage, persistence?
persistent variable is a variable that stays when the server restarts
Well i can promise if u go for database without any experience u will have tons and tons of problems with async stuff or freezing server/locking database ect
PDC, depending on what the variable is used for
the problem with a file is if they modify a single value everything is gone
on disable u save to db, on enable u load from db, also could save to db for example every 5min so u wont lose stuff
learn dependency injection
yeah i do that but with a file not a db
actually is the db hosted on the server that has the plugin or what?
u need separate host for database,
or u could use sqlite or something to store database as database.db file locally
but u should proably go yml or json
if i use separate host cant they just reverse engineer it and get values they're nto supposed to get?
database requires passwords,username, adresses to be able to connect there
so no they cant
you can never protect everything 100%
if they decompile the plugin they would have the password
unless i obfuscate it
also u can limit so your database can only be connected from your servers ip then they need to hack your server host to be able to connect to ur db
if it's in the jar it can be read
u dont save the password in the plugin
you should not be accessing a remote db from a plugin with any password, unless it's read only
then how does the plugin connect?
what is the remote db for?
storage
u can just have config.yml with the credentials
...
you fill the yml , server creates empty one
so jar doesnt contain credentials
alr
thats how all/most of the plugins do
so people who have access to your server files have access to database credentials
but anyways they couldnt connect to it unless they execute stuff throught your server console or plugins since u can limit which ip can access the database
How can I use the e.getRequest().getCallback() method to check if the player is connected to the server successfully
@EventHandler
public void onServerSwitch(ServerConnectEvent e) {
ProxiedPlayer player = e.getPlayer();
ServerInfo currentServer = e.getPlayer().getServer().getInfo();
ServerInfo targetServer = e.getTarget();
if(currentServer == null) {
for (ProxiedPlayer proxyPlayer : ProxyServer.getInstance().getPlayers()) {
if(proxyPlayer.hasPermission("neptune.staff.servers")) {
Message.SERVER_JOIN.send(proxyPlayer,
"{player}", player.getName(),
"{serverName}", e.getTarget().getName());
}
}
return;
}
for (ProxiedPlayer proxyPlayer : ProxyServer.getInstance().getPlayers()) {
if(proxyPlayer.hasPermission("neptune.staff.servers")) {
Message.SERVER_SWITCH.send(proxyPlayer,
"{player}", player.getName(),
"{targetServer}", targetServer.getName(),
"{currentServer}", currentServer.getName());
}
}
}
nah client side day/night time
that's some really bad documentation tbh
look at setPlayerTime for better documentation
Isnt the time serverside?
yes but you can set it per-player
it can be if you override it with that API
Ok I see
?paste
My question is a little off topic from bukkit and towards Spring boot jpa, but I’ll ask. Is Spring jpa and requests via @RestController necessary when interacting with the database and issuing them to another microserver if gRBC is used?
why i keep getting this error for this code ?
victim has no PDC entry
probably should check for null before assuming something is there
or the type isn't correct
what exactly?
oh you mean the pdc
however you shouldn't assume that either one has data to begin with
yea im trying to remove it, because i thought it may be it
you should check first that neither of them are null before doing your equality check
the pdc or the victim & attacker
where you are doing your get
they will always have a PDC, just it will either be empty or not empty
i get this now https://paste.md-5.net/wiyefotapa.css
warning
i removed victim pdc parts
Can't cast a pillager to player
This makes sense because Player is actually unique
can't just simply cast something to it
no more warnings or errors
but
first it sends the line after the runnable, then sends you're in combat with x for 1 second
new BukkitRunnable() {
int timer = 10;
@Override
public void run() {
if(timer <= 0 || !player.isOnline()) {
cancel();
}
timer--;
Common.actionBar(player, "&cYou're in combat with " + e.getEntity().getType() + " &cfor " + timer + " &csecond(s).");
//Common.actionBar((Player) victim, "&cYou're in combat with " + ((Player) victim).getName() + " &cfor " + timer + " &csecond(s).");
}
}.runTaskLater(PvpManager.getInstance(), 20L);
pData.remove(Keys.STARTED_PVP);
//vData.remove(Keys.STARTED_PVP);
Common.actionBar(player, "&aYou're no longer in combat.");``` it sends `you're no longer in combat` then `You're in combat with SKELETON for 1 second`
the runnable executes after your other code.
runTaskLater. ALL runnables run later
well, theres one exception, but thats an adge case and will only be confusing
you rtask only runs once as it's runTaskLater not runTaskTimer
this good?
that will start after 1 second, then terminate in half a second
after spamming 10 messages in 1/2 a second
what should i do then
why am I getting this error?
im trying to get float from float, but it says me about double
probably put the numebrs in the right place
0, 20L?
try it and see
Hi! I'm probably missing something obvious here, but how would I create these command suggestions, as shown with CommandAPI? Is this something I'll require an external dependency for, or is this possible with Spigot? Thanks!
what is your roatation field?
btw it still does the youre not in combat then does the task
for some reason
i did it RunTaskTimer
Need a tab completer
yes because your task will ALWAYS run after your other code
I am playing with NBT tags a little bit. I have mojang mappings nms 1.19.2 and I found on Internet that to give item a NBT tag you need
NBTTagCompound compound = new NBTTagCompound(); You would then add compound.a(tagKey, value); and then just nmsItem.setTag(compound); However nmsItem.setTag(); doesn't take NBTTagCompound as a parameter, but it takes CompoundTag. So I changed it to this: https://pastebin.com/J23xKWd9
Now if I create an Item with my ItemBuilder and read the tag right after creating it using this:
new ItemBuilder(Material.IRON_SWORD).addNbtTag("SomeTag", "SomeValue").readNbtTag("SomeTag"); it returns what I put in it. But if I give the item to player and than check with /data it doesn't have my tag anymore. I know that my explaining is probably a mess, but does anyone have any idea what am I doing wrong?
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.
You can use TabCompleter
runTaskTimer and runTaskLater are only ones with periods and delays
now it does the you're not in combat very fast then a normal timer
I've got a tab completer, but if I returned <Player>, for example, the player would be able to press tab and have the text "<Player>" autofilled.
I'm looking for something which can't be tabbed on, but merely suggests what sort of arguments the player should enter.
I'm guessing I'd need to return something different from my tab completer besides a regular list of strings?
That would be brigadier
Model line 199 seems to be using a double
you just need to return a single string then I guess, just return the string "<Player>" in a list? Unless I am misunderstanding
Right okay. I was hoping that this wouldn't require the use if Brigadier, but if not then I'll just make do for now.
Did you add teh rotations as Floats or Doubles?
runTaskTimerAsynchronously?
no
like float
it keeps doing you're.. then runnable
No, these are like "type suggestions" for lack of a better term. If you return a regular list of strings, the player is able to hit "tab" on their keyboard, and then the text "<Player>" would be filled in to their command. I need it so that the player can't press tab, but merely have it has a suggestion for the type of input. I'm not sure I'm explaining that great, but I'm not sure how else to word it.
then you want another runnable (or change the current one)
Yea, that is not a list of floats
then put all the messages in the runnable and only output the first message if the counter is max
you can't just cast it
so should I use double?
ok
yes
thank you
or manually convert the List<Double> into List<Float>
Ah I get you now
but casting isn't the solution
How i can achieve the time thinggy?
and how i can make it update every seconds without the need of removing items , add it again .. etc
You'll need to replace the item
is that the only way?
You just set the meta
ah right that's true
wouldn't that make some performance issuse?
if(sender instanceof Player) {
Player plr = (Player)sender;
String worldName = this.plugin.getConfig().getString("spawnlocation.world");
int spawnlocationx = this.plugin.getConfig().getInt("spawnlocation.x");
int spawnlocationy = this.plugin.getConfig().getInt("spawnlocation.y");
int spawnlocationz = this.plugin.getConfig().getInt("spawnlocation.z");
World spawnWorld = this.plugin.getServer().getWorld(worldName);
Location spawn = new Location(spawnWorld, spawnlocationx, spawnlocationy, spawnlocationz);
plr.teleport(spawn);
plr.sendMessage(ChatColor.translateAlternateColorCodes('&', this.plugin.getConfig().getString("prefix")
+" &bDu har nå blitt teleportert til spawn!"));
}``` How does that code send me to 0 0 0 and not 0 71 0? As my config says ```spawnlocation:
world: "world"
x: "0"
y: "71"
z: "0"```
I think i might have fixed
im trying to apply a potion effect to a player, it works, but it sets a duration of it much more lower than I specify
playerMenuUtility.getOwner().addPotionEffect(new PotionEffect(playerMenuUtility.getEffectType(), playerMenuUtility.getEffectDuration(), playerMenuUtility.getEffectLevel(), false, true, true));
playerMenuUtility.getEffectDuration() is equal to 7200, which should be 120 min, but it gives me 6 mins instead
np
because u have x, y and z as strings in the config, but in the code you get them as ints
how do i migrate to a new storage system without making people lose their data?
Yea, i figured that out
i already got the new storage code i just dont know what to do now
batch update
patch?
tf is batch update
an update with a large dataset
use simpler terms please
Does anyone here know how i can add like options to different arguments? Like the first argument is command and then it's a certain amount of subcommands as options dropdown?
which storage you want to move from and to
yaml to json
the yaml one was so bad, it sometimes wasnt fast enough to save when you do /reload confirm
you better use databases to store your data
Then you really should've specified that earlier
??
its never late to start
if i'm going to use databases id prefer to at least work with them for 2 weeks on testing plugins
and yaml is too bad rn to stay another 2 weeks so i want to migrate to json
which i salready way better right now
it is, but consider moving to databases sometime anyway
what makes you think writing JSON is going to be crazily faster than writing to a YAML file
do i just keep code to convert the old yaml file to json and if it detects it, it loads the storage from there?
^^
Parsing a yaml file isn't much slower. The slowest part is usually just getting the data from disk
json has libraries that support it and are imo way better than the spigot one like jackson and gson
wtf does this mean
with good serialization
u can use external libraries for YAML too
^^
Have you actually tested the performance difference?
nvm 
if i'm going to switch to an external library either way why would i use yaml
🤷
yeah, yaml sometimes is too slow when reload and when you restart because of how i was trying to "serialize" the data and just doesnt save half of it
i can reload 10 times in a row with json and it's perfectly fine
i mean thats a matter of preferencies, but YAML is a more "standart" way, if were talking about bukkit plugins
yaml is for configuration
i dont think yaml is supposed to be used for storage
json is literally made to be storage
YAML is a data serialization language
so it is
It's not
json was designed for transmitting data, not designed to be used as a permanent storage format
Why when im setting the sword-type in the config to "abc" (just for testing) it only gives to the items before the sword and cancelles the sword and all the items after, but if the sword-type (in the config) is set to ex. IRON it works and im getting everything
@eternal oxide , may I ask your opinion? How can one disable logging for the MongoDB Driver?
"The MongoDB Java driver uses the Simple Logging Facade For Java (SLF4J). SLF4J allows you to specify your logging framework of choice at deployment time. For more information about SLF4J, see the SLF4J documentation." (https://www.mongodb.com/docs/drivers/java/sync/current/fundamentals/logging/)
honestly idek why this argument started, i needed an external library either way and to change entirely how i store data because of how dumb i am, if i'm already going to do that i just opted to json instead, i had issues with yaml and even if json is slower or isn't faster i didn't have issues with it
it's working smoothly right now unlike yaml
yaml is a superset of json
i'll move to a database when i get some experience
Also frostalf, what do you think about this?
Wikipedia straight up says
Due to the conciseness, JSON serialization and deserialization is much faster than YAML.
lol
create a handle since I think mc uses this too? And from what I know only one logging thing can be registered at a time
so create and register a handle and you should be able to control the logging for that
I am not super experienced with messing with these things because logging shouldn't need to be this complex and I don't really care to control the logging
Oh okay, so it wouldn't be a bad practice to create a whole class just for that, am I right?
if I had it my way, I would have everything logged 😛
well I am pretty sure you would have to regardless
so whether its bad practice or not is moot XD
Well... Yes but
Configuration files can execute commands or load contents without the users realizing it.
Oh yeah this idea seems pretty good
where is that from?
wouldn't trust wikipedia
it depends on the yaml implementation you are using
but both are flat file storage
yaml and json are not storage formats in of themselves, rather a data format.
in order for them to be storage formats and not just some flat file, they would need to be their own file type
YAML () (see § History and name) is a human-readable data serialization language. It is commonly used for configuration files and in applications where data is being stored or transmitted. YAML targets many of the same communications applications as Extensible Markup Language (XML) but has a minimal syntax that intentionally differs from Standar...
YAML is a spec
therefore it is up to whoever implements it
second, as for comparing to php in being insecure, I am not entirely what they mean by insecure by default ?
technically you could say exe's are insecure by default
How do i add options to commands? Like you do /<plugin> <options> and make a dropdown like it is for playernames ingame
anyways, as for the whole .load() this is dependent on how its implemented. It should load something in relation to yaml, but the spec doesn't say it can't sanitize
why would it even consider running code?
it depends on the interpreter
php by default doesn't use the CLI to run
the only way php could be insecure is if you allowed it to use the CLI or allowed the webserver global access
does the spec even say anything about code execution?
implementor fucked up then
most stuff is left to you to implement, the Spec only defines what yaml is and how some things should be done
but its not definitive
in fact, you are free to stray from the spec as you please as well
nothing prevents you from doing so since there isn't like some validation of whatever spec of yaml you are conforming to
whst it meant for php by unsafe by default is that it doesn't provide a safe yaml parsing option unless you enable it in the configuration
well yaml is flat file therefore no special parser is needed
most libraries will give you something like parse() and parse_safe() but in php I guess you need to change a setting to make parse safe by default
you can parse safe already, just don't use some weird library
idk tbis article says otherwise
I have never known a time I needed a lib to parse a flat file with php
but whatever, I guess the newbies are dumb
Hi iam having a problem :9
?ask
If you have a question, please just ask it. Don't look for staff or topic experts. Don't ask to ask or ask if people are awake or available. Just ask the question to the channel straight out, and wait patiently for a reply. Make sure you use the right channel regarding the topic of your question. Create a thread in case the channel is already in use!
idk how you are deriving the time
and this how i do it :
iam in vc but i can't hear you xD
it should say 24h , cuz this package i have is set to 24 hours only
so it should start removing one second ..:
23 h , 59 m , 58s .. and goes on till it hit 0
well you add claimtime
how long is claim time?
duration is set for 24, but if you start adding to it, its going to be more then 24
people still on java 8?
most likely
better use a Duration from that, then getMinutesPart() or whatever it was called
using java 17
then also use java 17 constructs
rate my svg symicon
for exit pls
i made this in inkscape
nothing special but im not sure if its good
hmm are .c files supposed to be 6MiB?
no
looks a bit awful, nah c3
another lang that tries to be a replacement for c
the fact that c2 also exists says enough
does anyone know what the name of the spawn player packet is in 1.20?
Why is 'org.bukkit.ChatColor' deprecated
because your on paper
Paper on their way to deprecate Player (I would bet money on it)
Soft spoon 😭
oml.
I will use that from now on @remote swallow
I-
(spoiler papermc repo)
absolutely
Player is an overrated interface anyway 
I agree.
Once I am able to restart CabernetMC softspoon name will be joke compares to yummy-grape
Splorf
💯
I was going to start from nms but now I will yummygrape paper it'll he the most severe doomsday counter for bukkit type server software as we know it
Make sure to include revolutionary patches like Add synchronised to every method
thread safety
Exactly 
i will patch all the patches and remove everything and make the vanilla server run
probably could get by with just offlineplayer
we dont need no plugins
We already have mache xD
Thats useless as fuck I'm going to do something beneficial such as patching in cabernet grapes into the game
truee
I keep getting tempted to start this project then I realize I need money 😭
It sounds so fun like I can't stay away
and probably mental sanity
Lol you think I have that? You fucking ammature you know nothing about me
I mean, glowstone tried and yea
Meh well I'm not going from scratch that's fucking wild
I'm starting with nms as a base
Ah
Atleast I'm able to acknowledge while mental ill I'm not am entire dev team
I can't update versions and such all by myself
I'm a freeloader mojang can do that for me
I feel like adventure just made it more overdone
I don't really know I just get that vibe
I just prefer being simple
simple strings over TextComponent etc (I do not code plugins that often fyi)
i mean minecraft hasn't used section formatting in over a decade, it's all components
adventure or not
say that to the stardew developer
only a single person created and updates that game
:P easier to do from scratch than maintain updates you don't know are coming
you don't need to maintain updates if its your own code anyways
You need to add the stuff mojang is added though
no, just have to support the protocol is all
add stuff at your leisure
better yet, create a custom client
now you are free to implement whatever protocol you want as long as you keep the account verification stuff intact
ikr
to make a simple chat message u need like 20 lines
?paste
https://paste.md-5.net/xuduqoraxe.java
Why is my TestRule never called?
you should be getting an error in the console saying you cannot listen to org.bukkit.event.Event
there where no errors and i could register it, but do you know how i can implement my concept without E then?
i'm pretty sure that there were errors
you are printing before the registering happens
registerEvent with your own EventExecutor i assume
Eh you can prob merge those
ah no i know what's wrong
the event handler method is private
and in a superclass
that should fix it yes
but still, the generic thing applies
so you'd have to do the ^
yes now i get the error
i also recommend doing an instanceof check
e.g. if you are listening to a subclass of an event but it's the superclass that holds the handlers list, and it's the subclass that is called
the event system is very cringe
Well... I've tried almost everything and, didn't work... Do you think it is so ugly to keep here? 🤣
(It's almost 50 lines long)
you're right "And from what I know only one logging thing can be registered at a time"
do you not know how to debug your own code?
and?
1 sec
Even
this.getLogger().setLevel(Level.SEVERE);
Doesn't work! 😅 🤣
you have to use a handle and set the level your handle wants to capture
or the levels or whatever
How can I use an handle?
I'm already overwriting spigot's logger level setting to severe
and doesn't work
is it possible to get the advancement default title color
I meant register one
you can register handles with the logger, its like registering a listener
does anyone know the placeholder name to show VIP on tab scoreboard
It can be named anything, we don't even know what plugin you're using. I suggest you ask the plugin creator or go to the website you got the plugin from and check the source code
How do you get a rectangle from bottomLeftY and topRightY block locations?
hi i have this code to get player's prefix and suffix, but the if ... != null doesn't seem to work ```java
String prefix = LuckpermsUtils.getInstance().getPrefix(player);
String suffix = LuckpermsUtils.getInstance().getSuffix(player);
String group = LuckpermsUtils.getInstance().getGroup(player);
String format = plugin.getConfig().getString("chat-format");
format = PlaceholderAPI.setPlaceholders(player, format);
if(prefix != null) {
format = format.replace("%player_prefix%", prefix);
}
if(group != null) {
format = format.replace("%player_group%", group);
}
if(suffix != null) {
format = format.replace("%player_suffix%", suffix);
}
format = format.replace("%message%", String.join(" ", message));
event.setFormat(Utils.colorize(format));
i added that because it sends error if player doesn't have a prefix or suffix
I can send you a method for finding if a player is within a region using the middle of the region + size int if that would help, its not from corners tho
Yea sure
https://pastes.dev/ISUbhopjBJ hope it helps
tnx
I might have found a solution... will try
declaration: package: org.bukkit.util, class: BoundingBox
Check the error and read what is giving the nullpointexception, could be the config, could be the player or maybe something else
yes
no
its the prefix
if i remove player's prefix or suffix it sends the error
if i give him no errors and works
Which line does the error talk about
maybe placeholders are null or wrong
chat-format: "%player_prefix% &f%player_name% %player_suffix% &8» &7%message%"``` this in config
it sends error only if i remove the prefix or suffix of player using command
i mean, seeing the error would help more than going blind
i did
a
.
b
that's a download link xd
ChatListener.onChat(ChatListener.java:45)
Objects.requireNonNull(plugin.getConfig().getList("bad-words"))
getList seems to be returning null
and the Objects.requireNonNull is throwing the exception respectively
its not null
well it clearly is
why when i build my plugini get the error: 502 bad gateway ?
but i only get error if i remove player's prefix and suffix
it says the line
74
at me.hothifa.chatfilter.listeners.ChatListener.onChat(ChatListener.java:74) ~[ChatFilter-1.0-SNAPSHOT.jar:?]
yeah okay that is a different issue
thats setting the format
event.setFormat(Utils.colorize(format));
the problem is with prefix and suffix
well its not a null error
this is the error
java.util.UnknownFormatConversionException: Conversion = 'p'
yea but what 'p' lol
it doesn't like the %p because it's trying to parse that in String.format
what 💀
you need to have a valid String.format string with two %s, one for the Player.getDisplayName, another one for the event message
why when i build my plugin i get the error: 502 bad gateway ?
When this event finishes execution, the first format parameter is the Player.getDisplayName() and the second parameter is getMessage()
Parameters:
format - String.format(String, Object...) compatible format string
502 is server error
probably a response from a maven repo or something
shitting itself
What can i do then ?
i never used getDisplayName() tho
report to the site maintainers ig
would need to see what site is responding with that
you need to pass a valid format string
that follows this criteria
Is it that ?
e.g. event.setFormat("%s drinks dish soap: %s")
i mean, i don't know what site is giving you the error
you would need to check your build logs
%s is a placeholder, the first gets replaced with the player display name, the second gets replaced with the message
just try it, doesn't matter if it works or not because you will learn if it works or not
but where should i put that 
I get a Bad Gateway error
Could not HEAD 'https://oss.sonatype.org/content/groups/public/net/md-5/bungeecord-chat/1.8-SNAPSHOT/maven-metadata.xml'. Received status code 502 from server: Bad Gateway
https://oss.sonatype.org/content/groups/public/net/md-5/bungeecord-chat/1.8-SNAPSHOT/ does this open for you on your web browser?
Yes it does
weird
skill issue

xD
Do i just wait?
Can I spam communications with a MongoDB database, or will that cause lagg and should I try to minimalize that by saving data every few minutes + onDisable, and loading data onEnable & onAsyncPlayerPreLoginEvent
I build the plugin with a gradle task
hm
So I can spam the database? cause if I for example have an int that goes up quickly its updating every second
So I can spam it async? I don't need to hold the data in collections and send it every few minutes
Yeah but you say to send the data everytime it updates so why should I cache it if it updates quickly
Hi so iam trying to get the date so this package is 24h , 1 day
but it give that weird number
So I can spam update data, but not spam read data
Alright thank you
Crazy how reading can be more performance heavy than changing the data xd
i do this to load it :
what is the difference between bad performance and lag
what iam doing wrong?
Shouldn't the day always be 0 as the moment you claim it its 23h59m
Alright thank you
but when i click on it :
Although idk if some of the methods of MongoDB will read the data again when I for example use the eq method