#dev-general
1 messages · Page 166 of 1
or just the compiled main class
ill send the jar
oh.serialize() I'm blind
very odd
interesting
i just tested on my local server and it works fine
delete PluginLibraries and try restarting
I think I know what's happening here...
and it's not good D:
UH OH
BM how do you check if the version had changed?
@static zealot MiniMessage needs adventure platform to send the component
And yeah BM
@prisma wave It worked! but on server restarts/reloads it fails
hm there was something about Kotlin having a way to have a variable be one of n finite possible classes. What was that called again, Mitten?
@empty flint sealed classes?
@empty flint sealed classes?
@prisma wave Ty
it just does it based on the dependency data @ocean quartz
@winter iron i'm fairly sure the lack of relocation is the problem
should've known it would cause problems
Oh okay, wouldn't it be easier to make a json file or something like that to keep track of it?
oh I see what you mean
it does
the gradle plugin generates a json file for group id, artifact id, version, and the repository url
then the runtime just reads that to find what to download
Ooh yeah that's what i thought it should do yeah, nice
Hi, is this channel already used ? OcO
Wym
If I can ask a question now
welp time to check what adventure platform is
bruh #738969308746612766
make me hypixel for $5
@prisma wave hey so I've been thinking of a better way to process sub commands in Octo than just making a field called subCommands in every command and making you override that with a list of sub commands, and I thought of retrieving nested classes that extend the Command class and handling them internally, just wanna know if you think this is a good idea or not lol
and also if anyone else wants to give me their thoughts on that idea, that would be really appreciated as well
retrieving nested classes that extend the Command class and handling them internally
with reflection?
Bard that’s smart
yeah @prisma wave
i'd do both
I mean, idk how else you'd do it lol
don't force people to have all the subcommands in 1 file
I could create a separate SubCommand class for that purpose if people want sub commands in different files
actually that makes no sense
@prisma wave You know what the issue with pdm is then?
also @prisma wave is it a good idea to support both inner and static nested classes? I mean, there's not a reason not to, right?
yikes, guess I stick with shadowjar build for now
okay
Hey, I know I asked the other day about web portfolios and stuff. Should I go about creating my own from scratch or use like a template/web builder
And if I was to make from scratch, how would I got about developing one, what sort of software should I use
depends how much you are confident / want to flex
Well I want to learn more about backend web development too
so I think from scratch is best
I havn't done alot of frontend either
No reason not to learn front end
Depending on the scale you might want to use a JS framework
or you might not
my current one is just pure html I think
Lol
React JS?
Sure
Recommend MERN as rest api
Angular is MVC which is possibly overkill
Vue is View only
Not sure about React, I think that is too
whats MVC
Might go from scratch html/css/js at first
and make a second one later
Just so i learn basics too
Fair enough
i hate html/css/js
Don't we all
They have their place
i dont like python peronally
Yeah
I personally hate Html/css with a passion
i find it
so fucking boring
I envy Web Devs, i dont know how they can do it
😮
Unless you wanna be unique and get Webstorm
:/

no student shit?
probably
You can grt all shit for free if your student
ez
Just dont make it explicit that you are using it for commercial reaosnz
when you have to make your own Announcer plugin using a specific 1.16 hex utils class in java because you dont feel like having 4mb jar files
what did you do to it
stuffed it
With what
😮
you're gonna what?
@prisma wave WebStorm > IntelliJ for web stuff any day, especially because personally I find separating IDEs like this makes it easier to separate your projects from one another
also why do all y'all developers use Windows
I mean, Windows is great for office, gaming, and usability, but the Linux kernel and the way most Linux systems are designed makes it objectively superior to Windows for development
@distant sun that shameless sellout in your status lol
i mean yea linux is better but do you not use your computer for anythning else
for your personal computer at least windows is better so its more versatile

but why
because I needed an auto announcer plugin that uses the same hex utils as all my other plugins 
gotta have them gradients & rainbow text
@jovial warren separating IDEs is nice but at the same time I don't want to have to completely customise the IDE over and over again. Intellij supports everything that Webstorm does with plugins, so not much reason not to use it
@steel heart \n now works
Example: <g:#eb4034:#34c6eb>***test** test ~~test~~*\n**test** ~~test~~ __test__
what's the difference between using normal imports for MySQL Implementation and using Maven for use HikariDB?
i mean, why people says "Hikari" is better?
Hikari is a lot faster
at perfomance?
yea
basically what hikari does it it establishes a connection, then uses the connection whenever is needed.
what you would do without hikari is establlish a connection, use it, then close it every time.
becuase of this hikari is a lot faster
im not sure about that, but i do know that its a hell of a lot faster for getting stuff out of your database cause it doesn't need to establish a connection every time you want to do something
thanks alot, you're helping me alot.
np 
can someone help me
if (e.getBlock().getType() == Material.STONE) {
Bukkit.getLogger().info("Material type detected");
int radius = 1;
World world = loc.getWorld();
for (int x = -radius; x < radius; x++) {
for (int y = -radius; y < radius; y++) {
for (int z = -radius; z < radius; z++) {
Bukkit.getLogger().info("Radius detected");
Block block = world.getBlockAt(loc.getBlockX() + x, loc.getBlockY() + y, loc.getBlockZ() + z);
Block block2 = world.getBlockAt(loc.getBlockX() + x, loc.getBlockY() + y, loc.getBlockZ() + z);
// Check The Block Type and Check Level
if (block.getType() == Material.WATER && block2.getType() == Material.LAVA && UpgLevel == 0) {
Bukkit.getLogger().info("Water & lava detected");```
hello
hello
can someone help me
public class OreUpgListener implements Listener {
@EventHandler
public void OnDestroy(BlockFormEvent e) {
double maxDistance = 2;
for (Player p : Bukkit.getOnlinePlayers()) {
if (p.getLocation().distance(e.getBlock().getLocation()) <= maxDistance && p.getWorld().getName().equalsIgnoreCase("ASkyBlock") && p.hasPermission("island.stay")) {
e.setCancelled(true);
int UpgLevel = new CheckUpgLevel().CheckUpgradeLevel("ores", p);
// Set Random Chances
Random rand = new Random();
int chance = rand.nextInt(100);
if (e.getBlock().getType() == Material.STONE) {
Bukkit.getLogger().info("Material type detected");
Bukkit.getLogger().info("Water & lava detected");
if (chance >= 60) {
Bukkit.getLogger().info("Stone");
e.getBlock().setType(Material.STONE);```
Is this a good idea to replacing a placeholder (not placeholder api) of a weapon
https://www.spigotmc.org/threads/wip-replacing-placeholders-with-reflection.282095/
why it's not working
I cannot help yoo, but you should explains your problem even I can read your code, but I don't know what's your problem
What’s not working?
What’s not working?
@steel heart it's not replacing the block
it's still generates cobblestone
...
Then it not reaches the code that does that
Why do you need to calculate radius when listen to cobblestone generator event? What about BlockFromToEvent
Why do you need to calculate radius when listen to cobblestone generator event? What about BlockFromToEvent
@meager cairn to check their perm sir
I don't know how to explain, but I think you can do a better way than this. It's not efficent to check radius, everytime the cobblestone regen, imagine the regenation speed and 50 players breaking the block with effiency 5. your tps will say good bye
I don't know how to explain, but I think you can do a better way than this. It's not efficent to check radius, everytime the cobblestone regen, imagine the regenation speed and 50 players breaking the block with effiency 5. your tps will say good bye
@meager cairn any tips?
As I say, I'm horrible at explaining so I don't really know until I code something myself 😭.
You can go and check other ore regen opensource
btw if something has a X chance, you want to check if the random number it's <= not >= than your chance
also, use SplittableRandom instead
btw if something has a X chance, you want to check if the random number it's
<=not>=than your chance
@distant sunjava int chance = rand.nextInt(100); if (e.getBlock().getType() == Material.STONE) { Bukkit.getLogger().info("Material type detected"); Bukkit.getLogger().info("Water & lava detected"); if (chance >= 60) { Bukkit.getLogger().info("Stone"); e.getBlock().setType(Material.STONE); } else if (chance >= 21) { e.getBlock().setType(Material.COAL_ORE); Bukkit.getLogger().info("Coal");
.
it's just work like <=
no lol
?
<= 21 has 21 possible numbers while >= 21 has 80
oh
when something is not working, add debug
public static boolean chance(double percent) {
return new Random().nextInt(100) <= percent;
}
I always use somewhat like this, you can store the random instance somewhere idk
no no no
always use the same SplittableRandom instance
also, pretty sure you need nextInt(101)
Why would he need a SplittableRandom
it's better than Random from what I've read.
I have no problem of using this tbh
* @param bound the upper bound (exclusive). Must be positive.
d e b u g
Should be a negligible difference for what he is doing
i t r e a c h e s t h e p l a y e r
b u t i t d o e s n t r e a c h t h e c h a n c e s
print out the number
Well it’s not thread safe but faster than Random
0-100
the chance 0 - 100?
You should work with implicit else pattern
@steel heart implicit?
Yeah
//dont
if (condition) {
//todo
} else {
//handle
}
//do
if(!condition) {
//handle
return;
}
//todo
hm
I can give you example
for (Player p : Bukkit.getOnlinePlayers()) {
Bukkit.getLogger().info("Player Handled");
if (!(p.getLocation().distance(e.getBlock().getLocation()) <= maxDistance) && !p.getWorld().getName().equalsIgnoreCase("ASkyBlock") && !p.hasPermission("island.stay")) {
return;
}```
like this?
//onCommand
if (!Player.class.isInstance(sender)) {
//not player
return true;
}
if (args.length == 0) {
//invalid arg amount
return true;
}
sender.sendMessage(“hi”);
anyways. funny question. does placeholderapi works with itemlore
You could make it work
works on any string you call the PlaceholderApi.setPlaceholders method
Tbh they should make it work on any base component or so
Not having to manually convert on all strings there
Go suggest it Conclure 
so its mean i have to call setPlaceholders everytime I need to replace something? or just one time onEnable.
No need for a pr
@meager cairn No, call setPlaceholders however many times you want (so long it's reasonable)
hmm still cannot imagine it, I haven't use placeholderapi for a while now. The last time I use I have to extends PlaceholderExpansion that's all
Ohd atleast one time per string, you can eventually cache it then
Cache it maybe not the solution for me, because I have to replace the string everytime the inventory open.
the placeholder on itemlore is player money. it need to be updating
Ah
so yeah. I'm actually okay with replacing string everytime, but it getting annoyed me. So I try to seek for a alternative solution. Anyone actually try this before? Is this a good idea?
https://www.spigotmc.org/threads/wip-replacing-placeholders-with-reflection.282095/
yeah its not. but I'm looking for a way to replace every "placeholder" in my config when found. rather than create new ArrayList everytime and manually replace it
make a utility method for replacing a string list
Else then that, calling the setPlaceholders method is necessary, you can make a shortcut method of it in worst case
hello
can someone help me?
@EventHandler
public void OnDestroy(BlockFormEvent e) {
double maxDistance = 2;
for (Player p : Bukkit.getOnlinePlayers()) {
Bukkit.getLogger().info("Player Handled");
if (!(p.getLocation().distance(e.getBlock().getLocation()) <= maxDistance) && !p.getWorld().getName().equalsIgnoreCase("ASkyBlock") && !p.hasPermission("island.stay")) {
return;
}
Bukkit.getLogger().info("Perm checked");
int UpgLevel = new CheckUpgLevel().CheckUpgradeLevel("ores", p);
// Set Random Chances
Random rand = new Random();
int chance = rand.nextInt(100);
if (UpgLevel == 1) {
// Set the ore to iron_ore
if (chance <= 20) {
e.getBlock().setType(Material.IRON_ORE);
} else if (chance <= 30) {
e.getBlock().setType(Material.COAL_ORE);
} else if (chance <= 50) {
e.getBlock().setType(Material.STONE);
}
// Check If Player's Level is 2```
it's not working
it doesnt replace the block
yes
it doesnt print the chance
for (Player p : Bukkit.getOnlinePlayers()) {
Bukkit.getLogger().info("Player Handled");
if (!(p.getLocation().distance(e.getBlock().getLocation()) <= maxDistance) && !p.getWorld().getName().equalsIgnoreCase("ASkyBlock") && !p.hasPermission("island.stay")) {
return;
}
Bukkit.getLogger().info("Perm checked");```
succeded
Where did you print chance
cos if nothing prints then the code isnt even reaching there
cos if nothing prints then the code isnt even reaching there
@obtuse gale i mean that's what i mean
the code isnt reaching it
deprecated elements
oh k
@old wyvern ❤️ https://i.imgur.com/9V5wLY1.png
ayy nice gab!
@EventHandler
public void OnDestroy(BlockFormEvent e) {
double maxDistance = 2;
for (Player p : Bukkit.getOnlinePlayers()) {
Bukkit.getLogger().info("Player Handled");
if (!(p.getLocation().distance(e.getBlock().getLocation()) <= maxDistance) && !p.getWorld().getName().equalsIgnoreCase("ASkyBlock") && !p.hasPermission("island.stay")) {
return;
}
Bukkit.getLogger().info("Perm checked");
int UpgLevel = new CheckUpgLevel().CheckUpgradeLevel("ores", p);
// Set Random Chances
Random rand = new Random();
int chance = rand.nextInt(100);
if (UpgLevel == 1) {
Bukkit.getLogger().info("Level checked!");
// Set the ore to iron_ore
if (chance <= 20) {
Bukkit.getLogger().info("Chance succesful!");
e.getBlock().setType(Material.IRON_ORE);
} else if (chance <= 30) {
Bukkit.getLogger().info("Chance succesful!");
e.getBlock().setType(Material.COAL_ORE);
} else if (chance <= 50) {
Bukkit.getLogger().info("Chance succesful!");
e.getBlock().setType(Material.STONE);```
[06:33:11 INFO]: Player Handled
[06:33:11 INFO]: Perm checked```
anyone
Just use the debugger instead of printing redepic
Just use the debugger instead of printing redepic
uh
pretty sure UpgLevel is not 1 in this case
uh
Yes?
Printing variables is much much more tedious than using the provided debugger
The home of Spigot a high performance, no lag customized CraftBukkit Minecraft server API, and BungeeCord, the cloud server proxy.
I think piggy may have a better guide but I dont have the link so 🤷♂️
What does the Any> in inline fun Any> findOrSetObject(defaultValue: () -> T): T
mean?
I usually use soutv xd
¯_(ツ)_/¯
https://www.spigotmc.org/wiki/intellij-debug-your-plugin/
@old wyvern im using windows
The home of Spigot a high performance, no lag customized CraftBukkit Minecraft server API, and BungeeCord, the cloud server proxy.
What does the
Any>ininline fun Any> findOrSetObject(defaultValue: () -> T): T
mean?
Are you sure thats the right declaration?
version
umm
Open run config
Add Jar Application
Optionally add any extra arguments you want to run while starting server
Once done, click "Done"
Choose that configuration and press debug, and the server should start up with the intellij debugger
Thats just running the server with the debugger, nothing else
You can then add breakpoints to your code and check out variable values at that point
i cant click debug
?
eh nvm
show code
@ocean quartz Quick suggestion for mf gui, any chance you could add some deserialize method which would return a gui from a given section (from a predetermined pattern), would make thing much cleaner 

You don't have to use it smh
But for making gui's quick and constant it'd be nice to have
You could make that yourself Frosty
I could, but- Matt could as well 
Going by the usual rule of PR or shut up, PR or shut
or make it an addon
oww
How do I display what class I am working on in my discord status message
I tried but it does not look like for example Frosty's
It's a plugin
Intellij plugin?
yes
yup
Have you set the project as visible in Tools > Discord

That'll be 40$
Stroke counter 27?
Winnie pooh is spying on you
Lol
Commandmap
E.g I want a config option to disable registering /kb
Unregister and reregister
Require reflection?
Yes
Any other way?
☹️
Although reflection won’t be a problem
You’d only have to use it once to obtain the instance of commandmap
As long as they dont change it in future
Potato pc
How long has commandmap been around for?
this dropbox thing is nice
The only thing ive gotta do when I open my laptop is right click the folder and click reload from disk
Wheres this commandmap kept?
Hmm I think SimplePluginManager might have it iirc
I feel like it's been around forever
and yeah, can confirm, it's in simplepluginmanager
Conclure, correct 
I used to get it in some other way though through the server instance iirc but I don’t think the commandmap was kept there since 1.8.8

anyone has any good like function to check if storage can accept item (has space for it) or no?
Inventory#firstEmpty() != -1
storage?
gaby what i inventory has that item but it can still stack up to 64?
example storage has 12 wood and i want to add 32 of it
i dont want to use empty slot
there's Inventory#addItem which returns Map<Integer, ItemStack> which represents the items that couldnt be added
Although I don’t think Inventory#firstEmpty cares about armor slots etc
ye but basicly that returns items that werent added i dont realy want to do that
if i cant add all items i dont want to add them at all.
then firstEmpty() it's your best friend
That map is very useful
It’s like keys are the indexes of the vararg and the values are the itemstacks
boolean isFull(Chest chest, ItemStack item) {
for(ItemStack slot : chest.getInventory()){
if(slot == null) return false;
if(slot.isSimilar(item)){
if(slot.getAmount() + item.getAmount() < slot.getMaxStackSize()){
return false;
}
}
}
return true;
}
i guess ill give this a try.
Just put System.exit(0); and Magic will happen
:))
ye the best just shutdown the program
Or Thread.sleep(Integer.MAX_VALUE);
yes
String.MAX_VALUE is for the pro gamers
While the length of a String is theoretically Integer.MAX_VALUE, the length of a string literal in the source appears to be limited to only 65535 bytes of UTF-8 data.
<= not <
Finally I made a small "detector" if anyone speaks in voice channel
I mean, I just found out the usefulness of this: https://ci.dv8tion.net/job/JDA3-Legacy/javadoc/net/dv8tion/jda/core/audio/AudioReceiveHandler.html, so why not give this a shot? 🤷
Was gonna send a proof that that was real, then I realized how "ducky" my voice was 😂
actually working with the audio is the hard part
At least ik how audio byte works xD
I made some kind of voice recognition bot a while ago using pico voice and google tts/stt, was fun but it didn't pick up the wake up word easily
i tried working with audio once, i decided to stick to libraries
I just got it randomly from internet lol
I'm already at 4.2.0
phew
@prisma wave I got a question about creation order in Kotlin. I am a bit confused about something rn
sealed class CmdArgument private constructor(val name: String, val abbr: String) {
init {
if(abbreviations.putIfAbsent(abbr, name) != null)
throw IllegalStateException("The command abbreviation $abbr is already assigned to the argument ${abbreviations[abbr]}. The developer screwed up.")
println("$abbr -> $name")
println(abbreviations)
}
companion object {
val abbreviations = mutableMapOf<String, String>()
}
}
I have this sealed class that stores all created instances of this class and subclasses.
And I create a bunch of them in Companion Objects to their classes
But it seems that this code isn't executed until I actually access the classes.
How/when are companion objects created?
And is there a way to create them before anything else happens?
But it seems that this code isn't executed until I actually access the classes.
which code specifically?
class Action private constructor(name: String, abbr: String) : CmdArgument(abbr, name) {
companion object {
val CREATE = Action("create", "-c")
val EDIT = Action("edit", "-e")
val DELETE = Action("delete", "-d")
}
}
This one for example
wdym? This is Kotlin
things like static initializers (which is effectively what's happening here) aren't executed until classloading
which if i'm not mistaken is done lazily
I believe so
so is there a way to force load the class?
why not just use an enum?
relying on classloading for functionality is probably an anti-pattern
why not just use an enum?
@prisma wave Can I use inheritance with an Enum in Kotlin?
Because afaik in Java that's not possible, I haven't heard it being different in Kotlin but maybe I'm wrong
how do you mean?
I have three classes that extend the sealed class CmdArgument and more to come. They represent different things but I want them all to be grouped under this one class so I can pass them to methods without typechecking unnecessarily.
That's not possible with enums
neither in Java nor in Kotlin (I checked)
enums can extend abstract classes afaik
Enum class cannot inherit from classes says IJ
hold on
if it's a sealed class, why do you need the throw IllegalStateException("The command abbreviation $abbr is already assigned to the argument ${abbreviations[abbr]}. The developer screwed up.") checks anyway?
you know exactly what the input will be
i'm not sure what the issue is here
That's just a safety check that should never be triggered except if I screw up. Users won't ever see that because it would happen at companion instanceation time which I thought was the same as static.
That's beside the point
it is the same as static
Is there a way to force init a class companion?
I don't understand why that's necessary
it is the same as static
@prisma wave No it's done lazily when the class is first accessed
so is the static block
Not in java
Static variables are initialized only once , at the start of the execution. These variables will be initialized first, before the initialization of any instance variables
That's different to companion objects
That happens on class load
mhm you can test that out if you want to
I mean I guess it's possible I never noticed it, it would really only be an issue in my case where I basically extended an enum, which isn't possible in Java
sealed classes aren't enums
at runtime they're no different to normal classes
True
Anyhow, any way to initialize the companions of its subclasses? could basically be done when declaring the companion of the sealed class
just dunno how to do that
not that I know of
it's a bad idea anyway
well if you wanted to be really hacky KClass.sealedSubclasseswould probably provoke classloading
Hm could delegates be the solution, I'm not sure I understand what they do exactly
seems to be loading in the right order for me
Can you explain what exact problem you have rn?
Sure
=haste?
what was the syntaxa agin=
Paste Services
When asking for help with a config/menu/code issue please use one of these:
(However we do prefer if you used our paste :))
• HelpChat Paste - Usage
• Hastebin
And the issue was that?
Hello
Anyone know how I can make it so when I click something on a sidenav bar it scrolls to certain content on the page?
set its link to the id, and set your scrolling to smooth
usually you use IDs ^
scroll-behavior: smooth;
then element id
@ocean quartz Quick suggestion for mf gui, any chance you could add some deserialize method which would return a gui from a given section (from a predetermined pattern), would make thing much cleaner
@hot hull What do you mean from a predetermined pattern?
@winter iron set the id on what you want to scroll to
so my div
yea
then what do i put in my <a>
just href to the id
i tried that but its tking me to a page that doesnt exist
So basically the CmdArgument.abbreviations map is empty when I use it to substitute the abbreviations for the names of the arguments, and only when I use the actual values of the subclasses do they get initialised and the map filled
np
@ocean quartz let's take the serialization of itemstacks to config for example, something along those lines
That's coming for the persistent guis in the next update but won't work on normal ones
Any ideas @old wyvern ?
how to get direction of stem from block is it state or blockdata?
Ah nvm tho, it'd be way too specific, but could work if you have menus which just display shit with no actions
@ocean quartz What you could add is a reopen menu method, since that get's repetitive quick 
What would reopen do?
private void reopen(final Player player, final Gui gui) {
gui.close(player);
Bukkit.getScheduler().runTaskLater(plugin, gui.open(player), 2L);
}
anyone has idea how i could set where stem is facing it cannot be cast to Directional.
java.lang.ClassCastException: org.bukkit.craftbukkit.v1_16_R1.block.impl.CraftStem cannot be cast to org.bukkit.material.Directional
KClass.sealedSubclasses
@prisma wave This doesn't compile, I'm not sure if I need a special import for reflection in Kotlin?
or ya know since it'd be in the actual basegui class just close and open so you wouldn't even need the gui
Borz, Id recommend loading the values in while initializing the map
scroll-behavior: smooth;
then element id
@surreal quarry Where would I put this
I fail to see why that would be needed, just call update() it does the same thing
scroll behavior
in your css
for what element
I applied it to *
Since you probably wouldnt have to modify it later that should be more than fine
Since you probably wouldnt have to modify it later that should be more than fine
@old wyvern Yeah that's what I'm trying right now with "KClass.sealedSubclasses
smh Matt
Look what I just caught in the wild!
Exception in thread "main" kotlin.KotlinNullPointerException I was told these were extinct. Last one I saw was over a month ago... What a specimen, boys. I tell you it was as big as my forearm and had teeth like razors...
Seems like you're using the forbidden operator !!
Uhm how do i use a bungee queue for deluxemenu in the server selector ?
Stacktrace?
if i have to /sudo
I have command bungee but now i need to config the servers in the Deluxemenu folder so that i can use /sudo once i click the connector
hm it comes from delegates in the parser library
I dunno how to use them
toodumb.jpg
how do I use mojmap for buildtools
yo
anyone give some feedback on my website atm pls
http://35.193.45.157/index.html
running on google cloud and i havn't got my domain name yet
only done the links page so far
WHYYYY
it worked before
what the fuck are delegates
and why even
just give me a method to pass data, the fuck is this shit?!
like what the fuck am I supposed to do with
val data by findOrSetObject { BlockyRanksCommandData() }
and
val data by requireObject<BlockyRanksCommandData>()
if it results in a null pointer exception?!
For the love of god:
I have no idea
where do people find these symbols lol
what have I pressed? xD https://i.imgur.com/KOoIl22.png
IIJ
the selection is "broken"
yeah where do I change that? xD
ah xD
I had no idea what it was called either
ty ty
Hopefully this gives me exactly 10 XP, please Barry.
Please Barry, 3 XP, ktnxbye
OMG
thats one for the history books
now dont talk anymore, keep that nice xp number 🙂
https://cdn.discordapp.com/attachments/339674158596358145/746045247301091448/level-stats.png dw we got the picture covered lol

gg
Quick question fellas, what would be a clean way of looping throw a players inventory mapping it's contents doing some checks, and then managing the inventory (removing certain items)
(Trying to avoid looping several times)
the same way you'd do that with anything else
iterate over all the items, map them and filter them
Sequence maybe
how often do unused objects get deleted
As often as GC removes them
"Unused" not, Only onces that are no longer referenced anywhere afaik
as in more of "Unreachable"
i mean since i construct class eachtime someone opens gui
so
idk
if thats the best way=
As long as there are no held references for it, it will be GCed
Who was working on the Elara parser stuff? I would just like to ask a few questions about the parser 🙂
Me?
okay
and Km and Katsu too
Cool! What's the grammar files for when you have your own TokenType defined? Are the g4 files used? (there's a comment in the lexer file that says it isn't?...)
@steel heart 👀
You can ignore those, they were just initial example that were written down
Matt, what's the syntax for multi lined?
Thought so. Secondly: How do you build your Tokens from an input to use as parameters for the ElaraParser class? ElaraParser(tokenList: List<Token>)
Yugi, link?
to what gab?
Elara
@distant sun https://github.com/ElaraLang/Elara/tree/parser
\n but it doesn't carry formatting, example:
**This**\n*works*
**this\ndoesn't**
Need to handle errors properly for usage for syntax checking later on... ect
But do you have the code for Token generation? I'm mostly interested in that
In lexer package Borz
@ocean quartz love you no homo
@old wyvern What's the reason for the substring(1) here:
companion object {
// Creating regex to capture tokens
val MATCHING_REGEX by lazy {
values().joinToString(separator = "") {
"|(?<${it.name}>${it.regex})"
}.substring(1) //why is this necessary? Side note: if you remove it, prepare your anus.
.toRegex()
}
}
Can't you just do
companion object {
// Creating regex to capture tokens
val MATCHING_REGEX by lazy {
values().joinToString(separator = "|") {
"(?<${it.name}>${it.regex})"
}.toRegex()
}
}
Side note: if you remove it, prepare your anus.
:bruh:
dw I lubed up just to ask this question.
lmao
To remove the initial vertical bar
But you can just use the separator "|" instead, no?
That is what we are using?
separator = "" Are my eyes deceiving me?
I guess what I'm asking is, is there a reason you map the enum to the capture group with a separator instead of using the separator as the separator?
I guess not, wasnt done by me
kewl. thanks. now I got lube up my bum.
katsu reffered to a old lexer I had written
There I had not used join to string
🤷♂️
Hopefully
😂
Using regex in general is kinda gross
@prisma wave What would you suggest?
A typical lexer just iterates over the individual characters
Since tokens are usually very small patterns
You can just effectively hardcode things
Setup a web server which forwards all the parses, then you manually type and send the string which get's returned to the user 
hm
also
km
Now finds all errors
We should probably include line number in the token so the output can be more useful xD
@prisma wave what are .g4 files?
ANTLR gab
@distant sun ANTLR grammar files
ic
oh man making a [item] thing is harder then I imagined xD
You've already doomed yourself Blitz
because you have to serialize the item
Especially cause you're trying to make it for Dchat which is going to be a bitch to get the actual message
thanks for encouraging me xD
I'm using ProtocolLib packets now if that makes a difference 😦
Here's my actual problem: I am trying to make a parser for my command parsing and every cli parser I've tried so far conforms to fucking GNU or posix command syntax so you can't make custom named subcommands and parameters. Idk what to do now 😦
It kind of doesn't
I thought so
I gave up after like 10 hours, but you know I'm feeble minded so 
yeah I'll give up after 30
well I do have the message. Just need to make the lore xD
:((
Would probs be easier to bully clip into adding it into dchat itself
I mean I could just use InteractiveChat as well
but yeah wanted to implement as much shit I could in my plugin
So for some reason this instantly crashes my server :p
https://paste.helpch.at/axafivexap.java
But I've no idea why
while (amount > 0 && position <= contents.size()) {
final ItemStack content = contents.get(position);
if (content == null) {
continue;
}
...```
Infinite loop
at all the continue points
@hot hull
oh shit :kek:, do I use return or?
increment position before continueing if you wanted to go on
or
rather use ++ in the position check
while (amount > 0 && position++ <= contents.size()) {
...
}```
Dont forget to remove the last counter in this case
yo I'm confused. How do plugins that have teleport commands get the nearest safe location? Like going thru all blocks in the are seems kinda much to do.
nvm I do yes
@static zealot
https://hub.spigotmc.org/javadocs/spigot/org/bukkit/World.html#getHighestBlockYAt(int,int,org.bukkit.HeightMap)
declaration: package: org.bukkit, interface: World
oh that does make sense xD
so they just go thru x and z instead of going thru y as well
I mean you might still find "unsafe places" like in lava lakes and such
yeah I know that. I just check what block it is there
and if its an unsafe block I just go to the next one
and I just have a list of unsafe blocks, Lava, Water, TrapDoors so far.
1.8 is always great to work with
lol
just don't xD
Yeah for now 1.8 is a no no for me
Sad
yo someone has a list of unsafe materials? Because rn I can't think of any other than just: trapdoors, signs, air, lava, water
oh what are they caled
the spiky things
that they added in 1.15
string, piston, observer, redstone ore, some bitch ass bush
ty ty
PRESSURE PLATES
as well
when I have a for in for and I use break in the second one it just breaks the second one right? (kotlin)
Yes innermost
Alright, fun, it literally only works on 1.14+ it seems, the bungee chat stuff is different on other versions
Sucks but for now it's fine
If you want to break the outer one use a label
@ocean quartz I was gonna use it in FJ, but doesn't look like I will :(
I'll make it compatible with older versions, not until i finish a bit of the main functionalities first
Hex in older versions will convert into similar legacy colors
again stolen from Nicole 👀
@ocean quartz I really love this markdown syntax you got going.
@old wyvern So I read the parser class for Elara and I don't quite understand something:
How do you distinguish between two possible paths to parse if you consume tokens from a stack?
Was gonna be done today but legacy versions killed it
Bruh everyone just keeps stealing shit from Nicole kek
Bruh everyone just keeps stealing shit from Nicole kek
@hot hull Who's Nicole?
I mean she's the master of Colors
Esophose @empty flint
Noice, all formats can now be toggled on or off ;p
This is without nothing on
**bold** [hover](hover: hover test) [click](click: /hover test) *italic* __underline__ ~~strike~~ &clegacy color [#000](/guild/164280494874165248/channel/000/)hex color <g:#000:#000>gradient
5 Commits in a day, that's a new record for me lmao
Oooh nice A grade straight up without needing change 👀
23 issues though
gotta friking love this
http://images.virtusdevelops.eu/shareX/g360ok8u.png
How would you indicate indefinite repetition of a parameter in a command?
like vararg but to it's understandable for the average 12 year old mc server owner
like if you want the user to input as many strings as they like but at least one, something like this?
/cmd <string>[, <string>][...]
/cmd <arg...> perhaps
<arg...> or <arg>...?
First
nice nice
American Footbal. +1 for that
Yah yeet
oh man I messed up 😦
free pdm publicity
xD
peperoni
typo
get an ssl cert 
So you turn pizza into code?
@EventHandler
fun onPlayerTeleport(event: PlayerTeleportEvent){
val cause = event.cause
if (!event.isCancelled && cause != CHORUS_FRUIT && cause != END_GATEWAY && cause != END_PORTAL && cause != ENDER_PEARL && cause != NETHER_PORTAL) {
mainClass.playerLastLocation[event.player.uniqueId] = event.from
}
}``` Isn't this suppose to register plugin teleports and other teleports like death location? I don't get why when I try to get the location that is saved I get that the location is null. I tried killing myself, teleporting using essentials tp, minecraft's tp and other teleports from other plugins but it still tells me its null.
!event.isCancelled
Add "ignoreCancelled = true" on @EventHandler
yeah but that won't solve my problem this is the start of my code and it never goes past this. https://paste.helpch.at/amiduligop.coffeescript
oh man I'm getting worse and worse xD. I forgot I removed a lot of stuff in my main class and forgot to register the event again ...
and I made the checks for the block the player teleproted from ... not the one under 😦
oh man
time to change 20 lines
oh genius. I made it in 1 line xD
^ Me asking this as well
Codacy, it rates your projects code
of course it's Codacy lol
should've known that
a plugin that I have installed, but use merely because I like the little green box that comes up when it's suggesting methods
@static zealot classic: have you put that in a class that extends Listener and registered that listener?
yeah it was the fact that I added the papi check and moved the listeners inside the check but forgot to move all of them and that one was not registered
xD
usually it's annotating my event handlers with @EventHandler that I forget
I mean, for Java, their method of making you implement Listener and then annotate your handlers with @EventHandler works because it's fully OOP, but in Kotlin, it gets annoying
🙂
if only Spigot just scanned files for methods annotated with @EventHandler and registered them internally 🤔
eh I don't mind it
whether that'd actually be handy or not (or even possible) is another story
I just knew I registered it but forgot I deleted the lines and forgot to register one of my 4 listeners
possible
but unreliable
if you were scanning the classpath for methods then you would need to somehow get an instance of the class
Ewww EventHandlers
Please use a paste service to share configs, errors, code and long logs.
• HelpChat Paste
so you'd either need to bundle a DI framework (and thus force all plugins to use that), or force every event handler class to have a no-args constructor
which in the end actually restricts developer freedom
rather than the opposite
Well Bard I’d suggest a framework for you
it's always Java that ruins good ideas that would work well in Kotlin
@steel heart hit me with it
it wouldn't work well with kotlin either...?
why wouldn't it?
why would it?
Helper by lucko, I don’t know if it works good with kotlin but you can do in java.
Events.subscribe(EventClass.class)
.filter(e -> true)
.handler(e -> {});
that's just reactive programming
I'd probably rather create that as a module for Octo lol
pretty much
yeah
plenty of libraries for that
It is
also, do you think it would be a good idea/fun project to create a DI framework @prisma wave ? like just for the fun of it, because I am that bored lol
Well guice and other di frameworks works good
depends on your perspective
But sure
Koin is very promising for Kotlin as well
It’s probably good for learning
but idk, I just want to use more reflection because reflection seems really fun
somebody will answer you when they're free and they know the answer
you rush people, they make you wait longer
Matey, you posted there, someone will answer no need to come here ask ;p
reflection seems fun
lol
press X to doubt xD
but Kotlin reflection does though
from what I've used of it so far, it seems really nice to work with
also I really really really really really really really really wanna make use of annotations and experiment with annotation processing
Ap is nice
AP?
Annotation processing?
I wouldn’t say reflection is necessarily more advanced
reflection is easy
Well you can make yourself a nice looking spaghetti if you’d like to
although I'm not sure that code should be your main "selling point"
@prisma wave
It was just meant for a quick image same with the putty shell crap
and then the pizza too
fair enough
I think i'm gonna do a blur effect on it anyways
I was gonna do it at the time, but I was struggling getting the slide shit working
even tho its very simple
anyone better at math than me? xD https://i.imgur.com/aSnZ7no.png How would I go from 1 to 24 in a double for or something? I know I could just go 12-13-14-15-16-11-2-3-4-...-20 but its not that nice when I use it. This is for a teleport command that searches for a safe block near the teleport location if its not safe.
I mean would there be a easy way of doing it rather then just a lot of ifs or something?
I rly can't think of anything at this point. the little map I knew left my head 😦
could you try and teleport them to the the place, and then if it isn't safe, loop through the blocks in like a x block radius and just pick the first one that is safe
well that's not my dilema. I can just go thru all of them until I find a safe one but what I want to do is if the actually block is not safe I don't want to go like this https://i.imgur.com/Elt5wT2.png
ohh
because if the block number 12 is save it will just teleport to a further block
i see you wanna go from the inside to the outside
even tho 1 could be safe
yeah
searched for spiral formulas and things but nothing
couldn't figure one myself eithet
either
just with like an if for each block which is just shitty
You want to go on a spiral?
from inside to outside so he can get the closest block to the unsafe block
You could save the base of it into a map and loop through the map
hmm?
Let me try writing something as example of what i have in mind
So I'm assuming in your case each number will represent an amount of coordinates right?
Let's say 1 will be -1, 0 2 will be -1, 1 right?
yeah
Blitz if we say there is an air block, you’d have to check if there is an air block y: +1 as well right?
well I just get the highest block
from the location
so that's not a problem
I just check the one at y-1 that's all done
I just need to find another way to loop thru the blocks
but so far the best I have is go thru all blocks then save a map or something and check the closest one that is safe
I mean that could work as well I just thought maybe its an even better way to do it
I was thinking of that you could maybe take usage or BoundingBox but sadly it has no iteration methods and doesn’t store more than 2 locations
Okay so now i can do something like:
private val map = mapOf(
1 to intArrayOf(-1, 0),
2 to intArrayOf(-1, 1),
3 to intArrayOf(0, 1),
4 to intArrayOf(1, 1),
5 to intArrayOf(1, 0) // etc
)
In this example, each digit will represent your coordinate, now you can loop through the keys 1 by one and check the coordinate modifier that is stored in it
oh Ic what you mean kinda xD
and I just follow this yep I get it https://i.imgur.com/8lYoGsY.png
Basically:
map.forEach { key, value ->
if (!isSafeLocation(location.clone().add(value[0], value[1]))) continue
}
Something like that
yep but now that I think about it xD I have 30x30 blocks that I check
shit
I think I'll just check each block and then take the closest that is safe
because I don't think I'll be mentally able to do that for 900 blocks
There should be some fast algorithms to do that, but this is about as high as my brain capacity gets without me being into it xD
yeah I fully understand you. well my brain capacity is at full rn and I can't get it so that shows at what level I am and what level you are xD
or maybe I just thought what if I just go from i-1 & j-1 to i+1 & j+ and if it doesn't find it just goes from i-2 & j -2 to i+2 & j+2 etc.
oh wait thats just dumb
going thru the same blocks a lot of times xD
@static zealot where do you draw up that grid?
the photos I just sent?
nice
I need to have a visual representation or my brain jsut dies
but now it just died even with a visual representation
if I wanted to draw that I'd probably either grab my Amazon Fire tablet and use my stylus, or just grab out my massive notepad or something
@ocean quartz what does that do?
(what's map?)
that's just an example to help me
but then I realised that won't work because I would have to add 900 elements
xD
or whatever they are called
inside the map
It's just an example to show him my thought
so you see the grid with green numbers? I'm trying to go 1-2-3-4-...-23-24 instead of rather going 12-13--14...-21-20
so I have a teleport comand and I want to get the closest safe location
I don't need to worry about y anymore
just x and z
but can't get a math formula or soemthing that won't just make it bad
the easiest way to do that would just to search the surrounding area in a certain radius for blocks that aren't air
but that is gonna take around 5 seconds if your area is big enough
yeah but the thing is if I go from the farthest point it will get the farthest location most of the time
but I want the closest location
you could use AI training
right
time to change subject xD
I barely can do a teleport command and you want me to go into AI training? xD
write an A* algorithm that finds the closest location to the attempted location, and when it finds locations within a specific radius you give it a treat, and when it finds a location really far away you give it a hard spanking
yeah sounds easy. no way how to do that so ..
then it'll learn that closer locations are gooderer
anyway I'm gonna be out of here now
gn all
gn



