#dev-general
1 messages · Page 608 of 1
Actually I read it wrong, they said streams allocate new collections and objects which cause memory leaks
Still doesn’t make sense though
Like are they just claiming it? Or have they done some actual research (like read written code, and used a profiler etc)
The first part is true but… so do you in regular for-loops to achieve the same thing
Arguably the only "real" overhead is the inherent abstraction, which is full of method calls, vtables are slow yada yada
Not to mention the jvm has decades of experience in optimizing for-loops as well
Not good enough!
Why do people prefer IDEA over VSCode? What features make IDEA better? I'm thinking of switching to VSCode as its less heavy on the system
You mean VS?
No he means VS Code
For Java etc
Here’s my truthful opinion on VS Code vs Jetbrains products..
It’s decent, but take it from experience auto completions and suggestions are not as good on VSCode, no matter how many extensions you throw at it
I tried to use VSCode to replace PHPStorm, it was a no no, auto completions sucked, and you lose productivity
Using VS atm cause not sure if IJ has the extension I need, and I gotta say, VS is garbage compared to IJ
Yeah, only only time I like VS Code is for JavaScript based projects
Admittedly does well there
But for anything else it’s awful
I mean I only use vsc for editing configs
Oh I use jetbrains CLI for that
It opens up rq so it's nice
“pstorm <file/folder>” opens up in a lite mode
Like what fleet has
Any jetbrains product works the same
Once it’s setup from CLI it opens in a less feature rich window (for quick editing)
I'm personally using VSCode for CPP, and I've had a much better time on that compared to on Clion. It's lightweight enough that I can install TabNine (at least till I get copilot), which has better complete than Clion imo
That's all right? IJ just has better autocomplete?
I’ve tried doing similar in the PHP realm, I end up always going back to PHPStorm, maybe fleet will change that - as I agree rn often most jetbrains stuff is heavy
Thankfully I no longer suffer any form of battery drain with jetbrains IDEs but I used to
Oh yea, laptop noob
Ye lol, my old laptop I suffered drain, my new one takes forever to go down even with jetbrains shit open etc
bull shit
Yeah I think it was Hypixel article
Because I remember them mentioning
Hey!
This is another one of those in-depth dev blogs in which we explain what happens behind the scenes to maintain a seamless experience for you, the players. Today we're going into a little more technical post since we'll be talking about how we were able to scale from 30,000 players to...
That’s what I was thinking lol
yeah allocation != a memory leak though
streams have memory (and therefore cpu) overhead but they don't leak
It looks like their exact words are from that Hypixel post lol
So that's the secret behind https://downloadmoreram.com/!!
They just spin some streams in the background!
indeed
wait actually?
damn. that's cool
I've been using this website for a few years now. it helped a lot
Made my first post on Stack Overflow
I shall be hiding in a bunker for the next few days
send link
Hey, I need help making a loop to go thru all of the colors I've set in my config and take all the info that I've done for each one of color and put it in GUI.
I have the GUI thing set already but I need the loop that'll take all the info. can someone explain me how can I do that?
EXAMPLE OF CONFIG
colors:
red:
material:
displayname:
lore:
- "test"
- "test"
blue:
material:
displayname:
lore:
- "test"
- "test"
Also if you can help me with that too,
How can I get the color he choose easier so when I want to actually change it to his chatcolor I'll have to put the variable?
switch (e.getCurrentItem().getType()){
case RED_DYE:
HashMap<Player, String> colorinfo = new HashMap<Player, String>();
Player p = (Player) e.getWhoClicked();
String color = e.getCurrentItem().toString();
colorinfo.put(p, color);
e.getWhoClicked().closeInventory();
e.getWhoClicked().sendMessage(Colors.color("&e&lChatColor &8» &7You've changed your chat color to &c&l&nRED&7!"));
}
that's what I've done so far
*Please mention me if you've got a solution, thanks everyone. 😄
Configuration#getKeys(false)
what?
final ConfigurationSection section = this.getConfig().getConfigurationSection("colors");
section.getKeys(false).forEach((colorName) -> {
final String material = section.getString(colorName+".material");
final String displayname = section.getString(colorName+".displayname");
final List<String> lore = section.getStringList(colorName+".lore");
});
If i didn't misread the question this was what you asked right?
the color name will be red & blue
yep..its getting the parent keys from the config section
It's getting it from the main config?
or external file?
it can do both FileConfiguration has this method
After some testing ive come to a conclusion on the PlayerInteractEvent:
Throwing item at air
Equiping item at air
Teleporting on the same tick you click a block
When you right click with these actions they all fire the event with the same hand twice.
while doing these actions with the item in the offhand its not completely expected behaviour either.
Version 1.18.1
using paper or spigot makes no difference to the result as they both do the same thing.
I’m pretty sure I’ve heard of that bug with teleporting
at this point i might aswell just implement a check that returns if the hand is the same as the last hand in a space of like 50ms
should nullify the duplicates since they seem to occur on the same or 1 millisecond as the first
a check on a per player basis
for left and right air and block click.
Yea I noticed some weird behavior with the interact event like that
It seems to fire twice sometimes and a bunch of other weird stuff
multiple events firing when you teleport on the same tick is a bug thats already been reported on the spigot jira,
throwing and equiping items when clicking air just firsts a left and right click of air because of how the client handles it which means its expected behaviour
for now my fix is to just run the teleport on the next tick instead of the same tick
and im guessing just cancel whichever section of the event doesnt want to be used for everything else
there will be a range of checks that i can deal with
after all this debugging ive actually gained a slightly better understanding of when this event fires and what it fires
CPP: Let's make types complicated
short: minimum 16 bits
int: minimum 16 bits (but usually 32 bits)
long: minimum 32 bits
long long: minimum 64 bits
All of the types above can have the int suffix, except for int. So you can short int, which is exactly the same as short
Then you have integers with fixed limits
std::int8_t: Guaranteed 8 bits (but treated as a char)
std::int16_t: Guaranteed 16 bits
std::int32_t: Guaranteed 32 bits
std::int64_t: Guaranteed 64 bits
But on some system, creating 32 bit integers could take longer than 64 bit integers. So you also have fast integers, which chooses the fastest integer bit value, with a minimum you specify.
std::int_fast8_t: Minimum 8 bits, can be increased for optimisation
std::int_fast16_t: Minimum 16 bits, can be increased for optimisationstd::int_fast32_t: Minimum 32 bits, can be increased for optimisation
std::int_fast64_t: Minimum 64 bits, can be increased for optimisation
And because you have absolutely no idea of how many bits an integer type takes, there are least types
int_least8_t: The smallest possible integer value offered by the system that's at least 8 bits
int_least16_t: The smallest possible integer value offered by the system that's at least 16 bits
int_least32_t: The smallest possible integer value offered by the system that's at least 32 bits
int_least64_t: The smallest possible integer value offered by the system that's at least 64 bits
And there are "unsigned" variants of all these values, which means that it cannot store negative numbers, but allows for more whole numbers to be stored.
And ofc int_fast#_t and int_least#_t is discouraged cause not a lot of people know how to use them :/
Rant over
isn't unsigned a type itself too?
unsigned without a type defaults to unsigned int, which ig is fairly logical
Till you realise that you have not idea what an int is
I mean short and long aren't in themselves types
they're modifiers or whatever they're called
that's why you can do short int, because... it is a short int 
you're not a type in yourself
Then you have integers with fixed limits
those are not required by the standard to exist in any particular stl, the fast and least variants instead are
realistically they will exist, but it's not required
same with long and short, they aren't themselves a type but they're type modifiers for int
just stick with the std::int8_t etc and you'll be fine lol
just stick with a different language
nah
☹️
Dead chat
rip
rip

what do you use to (easily) SSH into linux machines on windows? I have putty installed but I'm struggling A LOT to configure it
I used to just use the ssh cli
super easy
clients like putty, termius, bitvise aren't really useful on desktop imo
my issue is that idk what user I should use to SSH
also this
I'm not using linux
ssh is on windows too
if you're using a VPS or smth they should tell you 🤔
for Raspberry PIs the default is pi (at least that's what mine is)
^ that depends on the image ur using
I just bought a VPS on losangelesvps.com
nice 🙂
29mb 👀
oh nice they emailed me with the credentials
🥲
bruh
wait u can have "aliases"?
ok I have more issues than I thought\
oh yeah
~/.ssh/config
there's a .ssh folder in your user directory
i thought u had to type ip/username/password every time
makes life so incredibly easy
I used to have icons on my task bar for commonly used servers
personal vps, helpchat vps, etc
click em and they opened ssh windows
ooh
hm?
rsa keys let you ssh without entering a password
there's newer and better formats
can you show me your id_rsa file as an example please?
of course santa
Thanks
no I mean what the actual contents is
what host does helpchat use?
mzungu
^
best vps provider
mzungu or ovh
I don't have this folder, if I create it manually, does it work?

yes
is there a way to set up ssh host with a login that uses string password?
not a way to automatically input the password, switch to ssh keys
passwords + ssh = no
I know, but I need to get in my server before I can do anything
you can allow string passwords after you first ssh in, probably
then just ssh in normally
ssh root@ip
you can put the host in the config, it'll just prompt you for the password when you ssh with the alias
also how do I link my registrar domain with my vps?
point the root record (@) to the ip
I already put the website on the VPS config, but I'm guessing I need to configure something on the registrar side
.
unless you're wanting to manage the domain entirely through your vps? as in dns too
I don't recommend doing that
I don't know what that means tbh
standard is to use cloudflare for dns
yeah my registrar is cloudflare
make an a record
with the name as @
pointing to your vps
yes
just change that one
changed, now I just have to wait I guess?
Hello i'm a fullstack dev i create website in PHP symfony, discord bot in JS, and many other things like apps, API etc
i'm searching a SPIGOT and BUNGEECORD dev for one of my projet if you are one, contact me ;)
thanks
pog
exams postponed, have to get the fuck out of dorm, go back home, at risk of infecting my family, more stress, more depression
lets gooo
time to code
sounds fun /s 😦
I basically know nothing about linux, I was upgrading my Ubuntu VPS from 18.04 (painfully) to 20.04, but at some point on 19.10 -> 20.04, I did ended up killing the terminal. I have screen installed (whatever it might be, I just installed it because of a guide), and apt update doesn't work because E: Could not get lock /var/lib/dpkg/lock-frontend. It is held by process 13863 (apt) N: Be aware that removing the lock file is not a solution and may break your system. E: Unable to acquire the dpkg frontend lock (/var/lib/dpkg/lock-frontend), is another process using it? How can I safely resume the upgrade process?
screen says that there are no screens to be resumedroot@secretx:~# sudo screen -D -r There is no screen to be detached.
Does screen -ls show anything?
it say that there are no screens, I guess I'll have to install the OS again to be sure
Restart fixes all
indeed
I want to make a deep storage unit using barrels and I'm wondering what would be best way to store such data? Should I use a database or should I just use a barrels nbt data to save the large amount of items there are
When you click the barrel it would open a custom menu not the normal inventory and noting would actually be stored in it
if you're storing a lot of items i think a database makes more sense
it'll make it much easier to modify how you treat the items if you decide to add more functionality down the line
Persistent data containers are also a good choice if the server version is 1.16 or something+
you can use nbt tags in older versions which are kinda same
PDC is cool
Old versions aren't

gradle is confusing me
i'm trying to exclude txt resources by doing:
sourceSets {
main {
java {
srcDir 'src'
exclude '**/*.txt'
}
}
}
but when i build the jar it still ends up packaging txt resources in
Yikes no
Heretic
listen it's a fun technical challenge
no judgie
i've tried other combos for the exclude like exclude src/main/resources/*.txt
but to no avail
Anyway, you'll want to edit the resources
sourceSets {
main {
resources {
exclude "**/*.txt"
}
}
}
I'm not entirely sure if this will work, I don't really touch source sets unless I'm doing silly stuff. See if that works, if it doesn't hmu
Yeeeee
thank you 🙂
Np
you're service muted
rekt
is there any twitter account that announce programming events?

How are you building it?
?imgur
You won't be able to upload images here directly to avoid spam, so please use https://imgur.com/ to upload images/screenshots.
You can also use a screenshot service like gyazo or jinx and post those links here.
what
what
what
what
what
what
/build/libs
i dont see /libs
Can you show all the folders of /build?
There is more under, i want to see all
though libs should be above tmp
Paste Services
When asking for help with a config/menu/code issue please use our paste bin:
(we prefer it over pastebin.com)
• HelpChat Paste - How To Use
1.8 pvp > 1.9
no and i don't care and both versions are ass anyway
if you're rating the entire game as a whole solely based on that one singular trivial minimal aspect, you're wrong
@obtuse gale i meant 1.9+, also 1.8 servers exist because of pvp
that's cool n all but my second statement still stands and 1.8 makes not even 7% of active servers lol
The current 1.8 servers are mostly pvp servers and bw
that doesn't change the % a bit lol
Is hypixel still in 1.8?
Yeah... I just mentioned it... Its more of a player decision IG, we used to host both 1.8 and 1.16 pvp back in days... And players would hop on to 1.8 one, those 1.16 would have something like 2-5 while 1.8 have a reasonable no... Same goes for bw... Thats the reason IG still many servers wont port them into newer versions
I bet most players joining hypixel don't even know the server is 1.8 they just play on the latest release
I mean we know nothing about hypixel in reality
all we can say for sure is that they use their own fork of spigot and uh that's it
Nah, they know...the majority i knew uses 1.8... Skyblock & Bedwars
not exactly. you might know people that know that but I've played with a lot of randoms that all have played with latest. Lunar client allows you to see others versions(only friends afaik). that's how I Know. Hypixel does advertise 1.8 for better pvp experience however.
1.7 😌
shut up dkim
i HECKIN love minecraft pvp!!!!
It's so good, i love spam clicking!
I love spaghetti
akcheually they use 1.7.10 on their backend 🤓
we know ivan. why do you have to pull a dkim?
smh
you're right i'm sorry i shouldn't have stooped so low
dw. there's still time for you. dkim however has been captured by the dark side and there's no way of getting him back
he will be missed
an error related to an undefined variable appeared while using custom javascript placeholders: https://pastebin.com/Hvuf16pn I never noticed it until now. Snippet of what we are using: ```javascript
var arenaRegion = PlaceholderAPI.static.setPlaceholders(BukkitPlayer, "%worldguard_region_name%");
var arenaState = PlaceholderAPI.static.setPlaceholders(BukkitPlayer, "%" + "mobarena_arena_" + arenaRegion + "state" + "%");
var arenaTwoState = PlaceholderAPI.static.setPlaceholders(BukkitPlayer, "%" + "mobarena_arena" + arenaRegion + "2" + "state" + "%");
var arenaThreeState = PlaceholderAPI.static.setPlaceholders(BukkitPlayer, "%" + "mobarena_arena" + arenaRegion + "3" + "_state" + "%");
var twoArenas = ["undeadtemple", "rattledmines"] // 2 arenas
var threeArenas = ["undeadtemple"] // 3 arenas
var fourArenas = ["undeadtemple"] // 4 arenas
function currentArenaInfo() {
var arenaInfo = PlaceholderAPI.static.setPlaceholders(BukkitPlayer, "%" + "mobarena_arena_" + arenaRegion + "_" + args[0] + "%");
if (arenaThreeState == "§6Running" && fourArenas.indexOf("arenaRegion") && arenaState == "§6Running" && arenaTwoState == "§6Running") {
var arenaRegionFour = arenaRegion + "4";
var arenaInfoFour = PlaceholderAPI.static.setPlaceholders(BukkitPlayer, "%" + "mobarena_arena_" + arenaRegionFour + "_" + args[0] + "%");
...
Does BukkitPlayer have to be defined somewhere, as I thought it was automatically set in the bukkit api
JavaScript 
shush, my coding knowledge is like 0
actually, this could be related to the player disconnecting the same second 
BukkitPlayer is from PAPI, yes
try using Player instead of BukkitPlayer. but I doubt that will work if the other one doesn't work.
So for some reason, this server keeps crashing and the crash logs (the paper's unresponding messages) keep referencing to one of my GUIs.. but it's not any specific part, it seems random
Anyone know how i'd fix this?
the server just randomly crashes :/
https://paste.helpch.at/esetixejoh.md
here's from one crash
(plugin name is ZombiesVSHumans)
Dkim moment
Is the best way to create a stopwatch to simply just create a runnable that adds 0.05 to a float every 1 tick or how are stopwatches made most effectively in spigot?
Does it need to live tick up? If it doesn’t, just store date and time they do something, and the date and time they finish doing it
Oh yeah good idea! It's just to time a parkour
Ah yeah, would be good to do that, then you can always add a placeholder which get the current time and the time they started if anything
And get it on the fly
So you would just store this data in a map<player, list<date, date>> or what?
Map<UUID, DateTime> being the time they started, and then have a method to get the current time taken, which would do current time - time from map
Then you can format it as needed
ah yeah I only need to store one of the datetimes
Tyvm
Anytime :) and I’d go for UUID and avoid storing the player object
Yeah good idea, I also need this in a DB so ye
I just need to format it to seconds - minutes etc. but yeah wouldn't be too difficult probably
ah
How would you even get the time in long?
Trying to avoid using stopwatches
System.currentTimeMillis()
btw
i didn't read anything up yet
so
But Java.util.Date has milliseconds? https://stackoverflow.com/questions/19577958/java-date-and-timestamp
Oh, just created it using it... lol
What should I use instead of it?
Instant presumably
dunno exactly what you're on about but that's the most general purpose class for "a point in time"
I want to time a parkour, so basically subtracting two times
d;Duration#between
public static Duration between(Temporal startInclusive, Temporal endExclusive)
throws DateTimeException, ArithmeticException```
Obtains a Duration representing the duration between two temporal objects.
This calculates the duration between two temporal objects. If the objects are of different types, then the duration is calculated based on the type of the first object. For example, if the first argument is a LocalTime then the second argument is converted to a LocalTime.
The specified temporal objects must support the SECONDS unit. For full accuracy, either the NANOS unit or the NANO_OF_SECOND field should be supported.
The result of this method can be a negative period if the end is before the start. To guarantee to obtain a positive duration call abs() on the result.
startInclusive - the start instant, inclusive, not null
endExclusive - the end instant, exclusive, not null
DateTimeException - if the seconds between the temporals cannot be obtained
ArithmeticException - if the calculation exceeds the capacity of Duration
a Duration, not null
Instant implements Temporal fyi
all of the "current"/"supported" api for time-related stuff is in java.time package
I'm using java 16, will this not be a problem?
Oh, I just saw Java 17, but yeah. So if I don't have both times to begin with, I can store one of them as an Instant right?
Also, shouldn't this work if Instant implements Temportal?
Wait no... Only if it extends
well because not every Temporal is an Instant
should be fine with using Instant btw
for the Map value type
Ohhh
Instant instantStart = parkourManager.getPlayerTimers().get(player.getUniqueId());
Instant instantEnd = Instant.now();
Duration duration = Duration.between(instantStart, instantEnd);
I assume it's like this then
yeeeeee
Today I learnt about “instant” shows how long I’ve been out the Java game
I've learnt last year.
Oh at least I don’t feel as bad now
😂😂
Was expecting a “dude this came out in 2014” 😂😂
Any tips on how I can store top 5 times on a parkour? I got the time differences and players stored separately atm.
pretty sure it came before 2014
Don’t make me feel worse :(
It was with java 8 iirc
How do you store the parkour times rn?
just store the best times for every player and then get best performance overall from there.
2013 according to https://docs.oracle.com/javase/8/docs/api/java/time/Instant.html
Close enough
might've misunderstood but "There are currently, as of 2013, two segments in the Java time-scale. "
Duration duration = Duration.between(instantStart, instantEnd);
long seconds = duration.toSeconds();
long millis = duration.toMillis();
player.sendMessage("Congratulations, you've finished the parkour in " + seconds + "." + millis + "s");
But how should those be stored? I need some kind of sorted map with every player and their best time
do you want these times to be persistent
Not sure what you mean
do you want them to still exist after the server restarts
or can the times be thrown away when the server goes down, if you're making like a minigame or something
I'll store them in MongoDB later on, yeah
okay
"myself" lmao
Then you can use sql to sort it
And yeah lol
My phone wanted to replace mysql with myself
Very silly
Kinda wanna learn mongodb though, already got plugins using mysql and sqlite
just store a map (uuid, performance_in_ms). that's the best repsonse I can give xD
But can maps even be sorted like that? Based on values
if you're asking how to store the 5 best times in memory, how about querying your db on startup for the 5 best times so far, then maintaining a sorted list of best times
where an element in the list is a PlayerTime object that has the player uuid or whatever, and the time
well you can make a custom method to find the top 5. or you can do as Ivan said, have a different map for best 5 and just update that map whenever a new better time is found
Why not?
why would you use a map
I need the username as well
a list is all you need
okay if you need the username store a list of MyParkourPlayerTime objects
where the object has both the time and the name
no reason to use a map though
yeah. if you have a PlayerTime object then a list is enough
Ohhh like a class called "PlayerTime" mb, I misunderstood
no worries
I don't see how that's easier than a map though
it's easier because it can be sorted according to the best time
so you can just compare the last element in the list to any new times and instantly know if the new time can be in the top 5 (or however many)
that is much harder to do if you have a map since maps are generally not sorted
So like just looping through the list and checking if the time inside the object is higher or lower?
you don't need to loop through the list if you sort the list
your list will be sorted from best time to worst time
How can I do that based on a variable inside the object though?
you can implement the comparable interface to your MyParkourPlayerTime object and then use a built in sorting method (Collections.sort)
or you can just sort the list yourself
i mean it's a list you can do whatever you want to it
if you're confused about variables inside the object; imagine a list of dogs. if i want to sort the dogs by age, i just call the Dog#getAge() method and use the result however i need to in order to sort the list
Yeah I see what you mean, just confused how you would sort it based on that getter without looping through the list, when it's already created
well you have to loop through the list once in order to sort it initially, when you first build it onEnable
(unless you can request your times in sorted order from mongodb which saves this step)
Yeah, whenever I add a new time I need to loop through it though
no
?
okay let me make a list of times
lets say
1,23,47,399,456,459,600
they are sorted from best time to worst
Yea
if i have a time 237
i only need to look at a single time in the list to determine whether or not my new time belongs in the list
i can compare 237 to the very last element in my ordered list, 600
since 237 is smaller i know that 237 qualifies to be in the leaderboard and i can insert it like normal, then kick out 600
Consider a TreeSet / TreeMap which will provide logn gets and adds (might behave weirdly if your objects are mutable though)
doesnt treemap sort by key
TreeSet then, with a comparator
treeset might be slightly better than a list then ye
but the concept for both is very similar
It should also include the player's own best attempt though
in the global top 5?
Or well, that list doesnt have to
you can use something else for the player's personal best
Yeah true
as bm said you can use a treeset which gives you all the benefits of a sorted list except it offers faster insertion times for the new time
Can it also sort objects though?
yes if you implement the comparable interface as he said
treeset will sort objects within it by default
The whole point is that it's always sorted
Based on what?
they are required to be comparable
so based on whatever they choose to implement for that
based
However as I said TreeSet can be weird when your objects are mutable so
Conclusion mutability bad
Tbf the same is true for hash based data structures...
Yes
not the contents of the list
It won't automatically update the order if the objects internally change
you dont have to worry about mutability for this usecase valde
as long as you dont go crazy
U sure? Even if I'm changing the duration variable inside the object?
player times don't exactly change afterwards, just add a new PlayerTime object containing the new personal best
see that would be considered crazy
dont do that
Ohhh
So you remove the old PlayerTime object and create a new one?
not necessarily
if it's a global best then is it not possible for a single player to have more than one high scoring time
like maybe i'm so godly i had 2 really good runs and got 2 of the top 5 times
so basically add the new time like you would any other time
the removal of the old 5th place time will be handled the same way as with any other time
this ^ changes a bit though if you only want each player to have one entry on the global leaderbord at most though
that makes things a lil harder
But won't I then just end up with a ton of those objects?
well the idea is each time you add an object to the leaderboard treeset you then remove the worst time
to keep the size of the leaderboard constant
So how would having more than one time on the leaderboard work? I think I'm confusing myself with personal best and leaderboard, you should be able to have only one personal best ofc.
have you watched minecraft mondays
nope
okay well imagine this scenario
youtubers are racing around the track
at the end of the event, there is a leaderboard for the best times
one youtuber did so well that both of his laps got on the leaderboard as having the fastest times
lets say he got a 30 second and a 32 second lap
that is first and second place on the leaderboard
3rd place was someone else with 35, etc
another example is having a high score on an arcade machine
Makes sense
the same person can get more than one score on the leaderboard for an arcade machine
okay
Not sure if I want someone to be able to have more than one time on the leaderboard or not
What's easiest? lol
Having multiple or limiting to one
easiest is to allow more than one time
that is how it would work by default
with no extra effort
you need to do some extra checks if you only want one time per person
Ah yeah
and at that point you lose a bit* of the benefits of the sorted list/set
well, not all
Okay so this should be immutable comparable, but not sure how the comparable method works
public class PlayerTime implements Comparable {
private final Duration duration;
private final UUID uuid;
private final String username;
public PlayerTime(Duration bestTime, UUID uuid, String username) {
this.duration = bestTime;
this.uuid = uuid;
this.username = username;
}
public Duration getDuration() {
return duration;
}
public UUID getUuid() {
return uuid;
}
public String getUsername() {
return username;
}
@Override
public int compareTo(@NotNull Object o) {
return 0;
}
I guess I have to specify the duration to sort
int compareTo(T o)
Compares this object with the specified object for order. Returns a negative integer, zero, or a positive integer as this object is less than, equal to, or greater than the specified object.
Oh, it was :))
Compares based on what though? It has to compare based on the duration and not username for example
if you want it to compare based on duration then do that
you're the one implementing the method, you can pick what it compares it to
But how? lol I just don't understand what it compares to "internally" or how to specify it
what you are doing right now is making a method for something else to use
oh no
they tell you how they want the method to behave (return a negative, 0, or positive value)
you have to make that happen for your particular class
(Duration implements Comparable<Duration> anyway so you can just do return this.duration.compareTo(other.duration))
besides that, imagine you're making your own MyInteger class like so
class MyInteger {
private int value;
MyInteger(int value) { this.value = value; }
int value() { return value; }
}
and now you want it to implement Comparable<MyInteger>, you can do this for instance
int compareTo(MyInteger other) {
return this.value - other.value;
}
you're the one defining the method, how it behaves, what you're comparing from your object
But compareTo can only return an integer right?
yes
I guess I'll have to convert it to int then
read what I strikethrough'd lol
yeah it can be exhausting
Wanna ask how I then check if a duration would be top 5 in the set but I'll just wait till tmr when I'm not half asleep ig.
well you asked now so:
just compare the new duration to the last element in the set
if the new duration is better than the last element, it deserves to be in the leaderboard
discord p-q
oh. don't think there's a way to do that?
ya how do I use it
what perks do u get for boosting?
just curious p-p
you can see them here
well it does have a GUI does it not?
just use that
okie how do I use https://github.com/Tyrrrz/DiscordChatExporter
it has a gui. you download it from here: https://github.com/Tyrrrz/DiscordChatExporter/releases/tag/2.31.1
how do I download it
you can then refer to their wiki on how to use: https://github.com/Tyrrrz/DiscordChatExporter/wiki/GUI%2C-CLI-and-Formats-explained#using-the-gui
they do offer step by step instructions
okie tysm
Does Maven central have some sort of api i can use to fetch artifacts? I dont want to use search.maven.orgs
why don't you do it the exact same way gradle/maven do it
is that somewhere i can see?
both tools are open source
but I doubt looking at their implementations would help you
I dont wanna go digging around until i find something
maven repositories have a fairly simple structure, with metadata files that tell you everything you need to know
that could take hours tbh
ya, just wanted to know if there was a cleaner way to do it...
Will the actual artifacts always be named "ID-VERSION.<whatever this is>"?
wat
It's ```
https://repo1.maven.org/maven2/GROUP_ID/ARTIFACT_ID/VERSION/ARTIFACT_ID-VERSION.jar
```gradle
org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.6.10
```will be ```
https://repo1.maven.org/maven2/org/jetbrains/kotlin/kotlin-stdlib/1.6.10/kotlin-stdlib-1.6.10.jar
```for ex
Snapshots are different but I think that's how releases are

Perfect, just to clarify, what if they publish a jar or artifact with the name not set to ARTIFACT_ID-VERSION.jar or something?
will be renamed
ok ty
Anyone know why
"com.lunarclient.bukkitapi.LunarClientAPI.isRunningLunarClient(org.bukkit.entity.Player)" because "this.plugin.LunarAPI" is null
player.sendMessage(ChatColor.BLUE + "You must be on Lunar Client to use this command");
return false;
}```
Main Class
```public LunarClientAPI LunarAPI = LunarClientAPI.getInstance();```
Hello! Does anyone know which characters does PaperMC "feature-seeds" parameter accept? Only numbers or characters as well? Length?
I could create random strings consisting of alphanumeric characters, length 100 or something.

pretty sure it's numbers only
Thoughts on toml file as config file?
y tho
Whem can I get un service muted
@echo steeple Accept my frienf request, please.
Weirdly enough there's no way to get the last element without removing it as well. pollLast() get's the last element but removes it from the set at the same time?
nvm.. there's .last()

hell yeah
better than yaml for sure
sexy
but if its for public plugin i would go w yml
Suppose because most people know yml?
yes
im sure anyone configuring a server can figure out toml
and if we can change the default file format to toml, that would be great
Eh, I mean you say that now, but the more and more small people that do it, the better it gets
ye
I mean that’s the nicety with toml
its not horrible?
lol
kappa
It's not like JSON where it uses a shit load of curly brackets, but it isn't like YAML which uses spaces (which are horrible af). It also has the subsections which are readable rather than stupid spacing
if you misstype a space or something you get a load of parse errors
plus it may be easier for users to use because they don't have to focus on adding spaces and then complaining in support (why no work)
yea, I see your point
Is it possible to serialize and deserialize a hashmap? Containing UUID and an object
for mongodb
My issue with JSON isn't really the brackets but the quotes, way too much quotes
so many quotes
Is there an api on deluxmenus? 🙂
No
.properties /s
that's where hocon comes into play 
Hell yeah
why config when you can hard-code things ??
it's json for dummies
Hocon best
Get all the Ho’s
I've seen a lot of "premium" plugins use JSON for configs.
By premium, I mean like $100+ plugins that aren't featured on spigot or MCM resources (but rather advertised in threads)
i mean yaml is easier to use, it's just json without any brackets and quotes
people who use yaml to store data 🤸♂️ 🗑️
lets use txt files lol
sus ngl
I mean, it can work
xD
You name a folder players
then add a folder with the player's uuid
then add whatever type of file with the name and value of each thing you wanna store
xD
voila
you don't even need to open the file
the name is the value

Yes
@obtuse gale is that ANOTHER redesign 👀
yes. 😢
I have made the backend of a bedwars plugin, how would I go about sending players to a bedwars game? The bedwars game will be on a different server than the lobby, I know how to do that, but how do I select what world to send the player to based on the game status? The lobby cant access the bedwars plugin, maybe through bungeecord messaging?
and I want the player to choose a gamemode and map through a npc
shameless self promotion for the server<->server messaging:
https://github.com/Ivan8or/RadioScanner
you can also use a 'real' messaging service to do the same thing like redis or rabbitmq but they require you to run their dedicated server alongside the minecraft instances, this will not - all it requires is an open port (1+) for the plugins to talk through
regardless of what you choose to use, tracking the game status should be trivial: send a message to bungee / your minigame manager from the server where the game state has updated, including the server name and the new status as parameters. On the manager side, you can just listen for the messages and update your map or whatever you use internally accordingly
also out of curiosity, are you dynamically allocating minecraft instances for your minigame? or will you just have a set number of servers running
maybe both
idk
not for a while
for the start just a set number of servers running
what does Hypixel do?
i imagine they dynamically allocate, at least to some degree
i haven't kept up with their dev blogs enough to know if they ever confirmed anything about that though
I'm in the process of doing a very similar dynamic-allocation project where i deploy new minecraft instances using docker swarm (soon to be k8s)
cool
if it's just that and no unique abilities then a yml file works great
i'm assuming class is going to be replaced with the name of the class
ah tru
so you'll probably end up with something like
archer:
name: "Archer"
rank: "class.archer"
color: RED
effects:
- type: RESISTANCE
potency: 1
- type: SPEED
potency: 2
dmgboost: 5.5
i would personally do effects as i showed there, where you store a list of them
that does seem a lot cleaner
but you can also do
effects:
resistance: 1
speed: 2
sure thing
ofc ofc 
hey is there a way I can make my placeholders work after a plugin is unloaded and loaded again?
I have the unregister method in my onDisable()
however when I do that, the placeholders just stop changing basically and stay the same until server restart
Anyone know of a decent way to parse maven pom files on the fly? Or a way to load a dependency(with all of its dependencies) from maven central at runtime? Ive been trying to parse the pom files myself and the minute it gets into properties its literally impossible...
ugh, well i may have figured it out actually, just have to go looking through the parent pom too....
You mean the search.maven.org thing?
no..
https://mvnrepository.com/artifact/org.apache.maven/maven-repository-metadata there's this one for reading maven metadata
or a library
Does it just do meta data?
there's one for the pom
can you send that one too?
i'm trying to find it
you have any docs on those? i cant find any for that one in particular
This is kinda starting to look pretty heavyweight
ty for the help, ill look at it a bit longer, but I was almost done writing a implementation myself
Alright, thanks! I super appreciate it!
» Give the helpers some details
» Ask suitable questions
» Be polite
» Wait
Any idea why when I add a new module, IIJ expands all the other modules?
seems safe to me
when you forget debug mode on
hahaha yes very true 😂
Help me wit my server
this is Helpchat server right ?
Where can I find the deluxechat dev builds?
dis is "HelpChat" server bro
that was a joke 
Head to #spigot-linking then #deluxechat and check pinned message
Help with what exactly?
@gusty glen Any specific reason why you turn an EnumSet into an unmodifiable Set? https://github.com/TriumphTeam/triumph-gui/blob/master/core/src/main/java/dev/triumphteam/gui/guis/InteractionModifierListener.java#L224-L242
Mutability bad
Why wouldn't you turn those into unmodifiable sets? You wouldn't want those to be changed
Wouldn't that copy it to a different set and kinda lose the advantages of an EnumSet?
No, Coll.unmodifiableSet wraps it and delegates to the given set (except mutating operations)
It's not Set.copyOf
Ah gotcha

I see there's also Sets#immutableEnumSet 🤔
I thought that EnumSets are already immutable, welp
Yeah that's guava
Effectively it's no different, it probably just skips the delegation part and is an immutable enumset impl itself
uh, anyone knows if saberfactions uses massive factions plugin/code?
Yeah, very nice Emily
I linked it and purchased the plugin but nothing showing - won't let me use /spigot check either
You'll have to wait till the database updates, then you'll get access to the channel
Ok thanks
Is 1.12.2 a more acceptable version to code for then 1.8?
i say this more in terms of performance since 1.13+ basically ruined server performance and hasnt caught up with 1.12 fully yet
just go with 1.18
1.13 and 1.14 were disastrous for performance
from then on it's really solid and kept improving
yep
@autumn stump can you accept my friend request?
So today I've updated some packages using the Pop Store (on Pop OS) and now Jetbrains Rider recommends me to use stuff like is not instead of !(X is Y) but when I try to build it breaks and throws a "Type Or Namespace not found"... I'm not sure what packages got updated. Also its a C# project. could it be that dotnet got updated and now Rider reads that but it actually builds against an older version? If so how could I fix this? I know I can just ignore and not make the recommended changes but still.
What's best, Bukkit Logger or slf4j logger - both in 1.17.1
"bukkit logger" is just the jdk logging library
i prefer slf4j personally but they do the same thing in most ways
?
What's better with slf4j?
its log level names make sense
jdk with "fine" and "severe"
slf4j with "error" and "trace"
also it can do formatting for you to a degree
btw shouldn't you just use the bukkit logger? or else you'd have multiple formatting types in console 🤔
Wdym? I want to decide between the two, atm I'm only using slf4j
which I'll keep doing I think
but bukkit already uses one
unless u mean in a separate program?
huh? I mean in the server
then bukkit already has one so idk if using another one would work with compatibility
¯_(ツ)_/¯
idk
Also the formatting is the same
idk what lib bukkit uses
The warn was sent with slf4j
Ye?
[21:38:25 WARN]: [net.valdemarf.parkourplugin.playertime.PlayerTimeManager] A document has been found! - Leaderboard
[21:38:25 WARN]: [net.valdemarf.parkourplugin.playertime.PlayerTimeManager] A document has been found! - PersonalBests
It just shows where it was sent from
Pretty nice imo
but slf4j too
okay
slf4j is the api
hi, Ive got two questions about deluxe menus.
-
when someone trade a object for other in a menu. He can have it in second hand and will get infinite of the item to get. Is there a way to fix it?
-
how does the [sound] event-thing work?
ping me at response
oh.. thanks... sorry. Im new at this discord
Also there's j.u.l. and java.lang.System.Logger lol
juul
If someone would take there time to review my plugin it would be amazing! Or just a part of it if someone wants - anything would be appreciated
Because mutability is bad (in this case), also it help maintainers because it signalizes that these values will never change in runtime (without them having to look every bit of code in the library).
Don’t think that matters in this case, like it’s just internal as well and I’d assume that listener is only instantiated once on the main thread.
Would this class be able to be final since all variables are? https://paste.helpch.at/hunomemeqe.java
adding final to a class means that it cant be extended by other classes
so if ur not extending it, sure
I thought only interfaces could be extended?
Oh, well no classes in my project are being extended, so should I make them final?
Or is it not as important as it is for variables?
everything in java extends Object
except primitives
and Object is a class
Oh yeah true
but by default you dont have to add to add extends Object
cause java already assumes
So should I add the final to all my classes? I extend none of them
its up to u, if u dont want this class to be extended by anyone, then make it final, but maybe if u want to let other people to extend the class, lets say in an api, then sure leave it non final for example
it all depends on each classes usage etc
i add it to my classes because it looks cool 
Hmm well it won't be an API, that much I know. And the plugin is finished, other than fixing the performance. So I think I'll just make then final
interfaces can be implemented, classes can be extended
All of that is literally just for a couple spring dependencies... Im pretty sure alot of artifacts are gettting loaded twice tho
~1,500 dependencies
whats a good rtp plugin that allows configurable cooldowns? but like dif cooldowns for dif ranks. if u know pls let me know! ping me or dm me!
BetterTP or Wilderness-Tp come to mind, but they don't do the per rank kind of thing you're wanting
do u know one thats per rank?
i think so?
U know a rtp plugin that has a bypass cooldown permission node?
acn u send the link
How tf do you send an HTML email if you only got source code?
I just wrote a nicely looking newsletter template, just to found out there is no way to paste code into outlook 😄
Do you know any software that can do it? I know I could code something but I suppose there's an easier way.
you can boot up your own smtp server to send the emails, inputting your html as raw, or you can use thunderbird, which allows you to inject html into your emails.
mailchimp as a mail api also supports triggering html emails
I want to send from an already existing mail account, so imma give thunderbird a try, thank you.
@quick flume about ur deluxe shop, how does it work? How can I link it to gems economy money? How do I change the prices? Does it sell everything?
Linked my spigot account and will not let me access deluxechat channel,so i can get a dev build?
Have you linked your spigot account and don't have the premium plugin role yet?
Spigot doesn't allow us to check for buyers automatically, so we have to do it manually. This means that we can only update the buyers list in our system every 24-48 hours.
If you wish to see when the database was last updated, you can by using the /buyercheck status command.
Once the buyer's list has been updated for that plugin, you can recheck your roles by using the /spigot check command, then you should have the role, and will be able to view the respected plugin's channel!
thanks much sir
My essentialsX keeps removing all the userdata of who's on while server restart 2 times or /rl confirm 2 times. please help
Well I generated the current item list (changeable in Placeholder/deluxeshop.yml) from all mats that I could
to link to gems economy should be as easy as changing the requirements/commands from essentials economy requirements/commands
oh shoot, you will also need to edit the dmshop-maxpurchase.js from%vault_eco_balance% to your placeholder
Thunderbird did the job, thank you!
Why tf does outlook not allow this tho, you can import the weirdest shit but not use HTML code to send an HTML email?! 🤷♀️
¯_(ツ)_/¯
Is it generally bad to have all managers and instances in the main class?
The managers not really, the plugin instance yes
The getInstance()?
Yeah, use Dependency Injection instead
I feel like you could pass some of the managers directly as opposed to the plugin instance and then invoke MyPlugin::getThisManager
Especially if you unit test, having direct rather than indirect dependencies will help with for instance "mock"-ability
No idea what you're talking about here tbh lol
And needless to say, I believe you achieve a class hierarchy where not every concretion is dependent on the highest ordered class, as such maintaining the overall system and having reusable classes will become easier and more accessible.
automated testing
not many devs do it for spigot plugins because just testing something (such as a command or that an event triggers) directly isn't that complicated
Ah I definitely am passing most of the managers through DI, but sometimes it can be very messy and then I decide to use the getter from the main class, if I just need the instance once or smth.
hmm 🤷
like I guess your main class can act like a context facade (problem is just, if its one of the highest classes, a lot of other classes will subsequently have to depend on that context facade)
I typically have a method in my main plugin class called <T extends Manager> getManager(Class<T> managerClass) which fetches the instance of the manager class given from a map I initialize when the plugin loads, that way I can just do ExampleManager manager = plugin.getManager(ExampleManager.class); whenever I need it
it just keeps the number of getters down in the main class, though I'm sure there are some people out there who are going to flame me for it lol
Not sure what you mean by this
problem is just, if its one of the highest classes, a lot of other classes will subsequently have to depend on that context facade
What would a "higher" class be?
so for instance you know how your main class has the function onEnable
which then in there, it instantiates all your managers in one or another way
so it bootstraps the plugin (sort of a self growing process)
It's a problem if the manager needs to extend another class as well though
Yeah this
// Register objects
checkpointManager = new CheckpointManager(this);
checkpointManager.setupDataFolder();
ConfigManager configManager = new ConfigManager(this);
configManager.instantiate();
playerTimeManager = new PlayerTimeManager();
database = new Database(configManager, this);
PaperCommandManager manager = new PaperCommandManager(this);
scoreboardManager = new ScoreboardManager(this);
parkourManager = new ParkourManager(scoreboardManager);
mhm
wdym with bootstraps though
bootstrap - self growing process iirc
because once the bootstrap proceeds, a lot of other objects such as your managers will be created
now I call it highest ordered which might not be the perfect term, but its due to this, it has the responsibility setup your plugin either, directly or indirectly
When you're saying bootstrap, do you mean this?
Like the order of instances
by providing a set of accessors(getters) we give it yet another responsibility, thus yet another major reason it might have to be changed in the future, so arguably it breaks sth called the single responsibility principle as it acts as a context facade as well as the bootstrap
From wiki
In general, bootstrapping usually refers to a self-starting process that is supposed to continue or grow without external input.
Hmm I think I understand. It's a bootstrapping process because it will go through and create the objects without external input?
yep
And how about the context facade? Never heard of that before
a context object is an object which couples a set of other objects
in simple terms, it simple acts like a vessel to access other objects
for instance, Event classes can usually be seen as that
a facade is a facade, its the face of something where you don't know what's, how and the complexity that happens behind it, a good example would be most interfaces in paper
your plugin main class isn't really a strong facade, but the methods do abstract away the way of reaching out to your plugin instance's internals directly
obv it can be quite nice to just pass the plugin instance along with all of its getters
Ummm, this is very confusing but I think I understand, kinda. So the issue is really that I instantiate the objects in the main class, but it's also the "vessel" for the objects, which can cause problems when the new objects are initializing?
it doesn't cause any direct issue
like having it that way is manageable
its just that your entire system becomes ridiculously coupled to that class of yours
Because if the order is wrong it will cause errors, right? Or not that way coupled
yes
I mean
you cannot call the function open() before the function close() for a file object or sth
since open causes a side effect
as well as close
Makes sense
(side effect is just when a function may return or do something differently in spite given the same input)
for instance this is a non side effect function
int multiply(x,y){
return x*y;
}
this will be one:
static int i;
void setI(i) {
self.i = i;
}
int getI() {
return self.i;
}```
self.i
It's non side effect because it doesn't use external functions or classes right? Or did I misunderstand
Well
if you have a side effect free function
You should be able to remember the given output for a given input
If you know the input, you know what output you’ll get
However getI for instance can return differently in spite of the same input (no input)
Ayy nice, I do something similar, definitely not copied from ktor, val manager = plugin.feature(ExampleManager)
and the first one doesn’t even return anything
So this would have side effect:
If playerTimeManager depends on database in the playerTimeManager constructor
playerTimeManager = new PlayerTimeManager();
database = new Database(configManager, this);
Since database hasn't been instantiated?
Yes
Like playerTimeManager uses a function from database or smth
Assume that’s inside a function
It changed the state of your system
so it’s impure
Or well, not side effect free
Anyways Valdemar
There are cons and pros to everything
I think I understand
So having all those getters might not be entirely wrong
But it’s definitely something to think about
Yeah, I can see how, I just need to look more into which of my managers are side-effect free I think
Because the order of the managers sometimes causes an error rn
Yeah yeah I know, I'm just running the side-effect free ones first, since the ones that are not side effect free might depend on them
The classical sign of a side effect is where depending on the order of in which the functions are declared may lead to an explosion or not
Yeah, I'll try and minimize my getters then, it'll also help later on if it gets more messy ig
Well think about it
If your main class provides everything
then almost everything must depend on the main class simply
Yeah and it sadly does right now
Most of the classes at least
Which is not nice
Yeah, the side effect thing isn’t as important rn
After all you write Java, object oriented code.
I'd just like if I could use the main class yet, because it's included in pretty much all classes atm
I could avoid it with using more DI I guess
The word di sounds very extravagant
But yeah, just passing objects directly can benefit you sometimes
Design choices always yield cons and pros
extravagant? Sorry my English is not the best lol
Ohh yeah true, DI is very simple, it's just a bit messy sometimes imo, idk why but I just prefer having 1-2 dependencies in a class, max.