#help-development
1 messages · Page 881 of 1
have you guys ever taken content down from 9minecraft
'member how you did it?
I just wrote to their email, told them "yo this is my project, I have only uploaded it to spigotmc <link> and I don't want some other person to upload it to your site without my permission" or sth, and then it got removed
thanks
out of curiosity, I don't even want to try it out but do they even distribute the correct jars or is this just malware
oh I don't remember whether I even checked the download
I believe it's the correct jar but usually quite outdated
They just make a ton of money from ads on the site
yeah these are outdated and worse yet they have automatic hyperlinks based on keywords that link to the wrong software
what? ok then adguard home is working pretty well
so my spigot page mentions worldedit and has the correct plugin link but here they are automatically directing to client-side worldedit
I swear I use my professional game studio email for takedown notices more than anything else
guess I made something worth stealing
My plugin is on there :/ but we are kind of afraid of writing to them, since previous devs got doxxed by a similar website after asking to take it down
the message limit on gpt 4 is such bs man, come on
lol, they are crack dealers and you are all junkies
Hey! Does anyone know if there is EnderDragon death event? Is it separate from Entity Death event?
I'd like to create a plugin that places dragon egg every time dragon is killed.
Maybe there already is some API I could use.
If not, then I probably could iterate blocks at "0,0" and start Y from 0, going up and check if it's bedrock and if bedrock next block is not bedrock then place dragon egg on next block.
Something like this:
Location egg = null;
for (double y = 0.0D; y < 256.0D; y++) {
Location loc = new Location(world, 0.0D, y, 0.0D);
Location loc2 = new Location(world, 0.0D, y + 1, 0.0D);
if (loc.getBlock().getType() == Material.BEDROCK && loc2.getBlock().getType() != Material.BEDROCK) {
egg = loc2;
break; // Exit loop early since condition is met
}
}
if (egg != null) {
egg.getBlock().setType(Material.DRAGON_EGG);
}
Or maybe there is easier way to get egg location? Without iteration?
Ig you're right I'd use runTask they do the same thing. Maybe those are missing the deprecated tag is my guess
is there an event that's called when the player right clicks with an armor in their hand to equip it ? or do we need to use player interact event
How am I supposed to get a random material from the material enum that isn't legacy when I can't filter them by #isLegacy()"?
The documentation states: Do not use for any reason.
https://hub.spigotmc.org/javadocs/bukkit/org/bukkit/Material.html#isLegacy()
declaration: package: org.bukkit, enum: Material
Look at which ordinal legacy materials start and cap it there iirc legacy materials are at the bottom
Sounds hacky but guess imma do it
You can always filter by name
That's not hacky at all :P another alternative is to get the values and run a boolean check isLegacy
That's deprecated as I stated in my question
Pretty sure the legacy ones won’t be in the enum if you have an api version set
They are when accessed via reflection since the enum hasn't got a fixed type. But I'll filter by name I guess. Can save that in a static variable.
Because it could be any enum. I'm basically trying to map a unique material to each enum value using the enum values hashcode
or "unique" since obviously if there would be too many options it can't be unique
It's any enum but I want to display all options in a GUI inventory and therefore want to map materials to the gui buttons
I see
Anyway, yeah legacy stuff is at the end
The first one is legacy air, so any ordinal after that is legacy
Choop choop hacky legacy stuff
Can't wait for ItemType
I'll just check if the enum is a material enum and give that a special handling so I can use the non-reflection way
Im surprised values() isn’t part of Enum
Yeah all you got is
#.getEnumConstants()
Wdym enum has a values call I stg it does
Not in the base class
Unless for the past 3 years I've been hallucinating this
Not the abstract enum class
How come every enum has a values method then?
I mean couldn't you just method handle it then
Method Handles are pretty much just as fast
Idk will the asm catch that
compiler generates a synthetic method for this
I'm liking the changes to the ItemType and BlockType interfaces
it is though?
its an Enum function
Class<? extends Enum<?>> won't let you call #values()
you can't extend an Enum anyways o.O
you looking for Class::getEnumConstants? returns a copy though
It's the same for Class<Enum<?>>
yeah I had that already but it will return legacy materials for the material enum
Well not sure if its because of generics, but ord and values are both functions of enum
Since only values() is overwritten
values() is not class member, it's generated by compiler
mmm right I suppose it does make a difference between after and before compiling lol
I swear I remember doing that
you can simulate an enum
and then extend that class that simulates being an enum
I’ve discovered a small hatred for records
did you finally join the club?
they reduce the bytecode size though
They are as object holders
not entirely sure if this was even an issue
they do, their equals/hashcode/toString/etc implementation needs to be generated through a bootstrap method at runtime
thus the compiler doesnt generate those methods
apart from that..
ok, but was it an issue before?
because I don't think it ever was lol
When we develop api we often need to modify things that Mojang has made private or final
if youre concerned about milliseconds of vm startup times, otherwise it isnt
So I had to wrap the entire thing with a normal class
less bloat than a normal class, but the sacrifice of giving up setters
not sure if traditional ways was or is bloat
well, I don't have a particular use for them unfortunately
however I don't really care that they exist either lol
same goes with lambda's I don't really use them
They're only useful for immutable data which isn't super common depending on how you code
for me its a way to compensate the lack of tuples
Just reimplement the tuple
oh wait type safety or whatever
Executor async = task -> scheduler.runTaskAsync(plugin, task)
would be awful without support of the language
could probably get it to work in kotlin, where there are destructuring semantics
Tuple<A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,U,V,W,C,Y,Z>
Should work for most cases
if only we had template <typename... Args> generics
I love how Marco forgot what a tuple was
sounds like something mojang would do (and probably has done)
Problem it works?
Isn't that all that really matters
Tuple#getTwentyFourth
fuck dedicated classes we tuplin
wouldve been maybe only 200 lines of code if they decided to write that in kotlin data classes
dinnerbone or fry probably
just don't look at arrowkt
i mean thats the cost of going fully functional in java
Google is great for these simple kind of questions
I use yandex
any good search engine should be able to help you find answers to those simple questions
Sometimes i cant find it on google
You're writing in paradoxes
No worries haha, I'm also on like 8 different meds so I've certainly not been "normal" as it were
Hi, how to get the statistic BLOCKS_PLACED? It isn't in Player#getStatistics
Well... it was more like skateboarding without a helmet. I got a solid 7-8 foot fall, to be fair it was a near death experience... if you're interested I have a couple videos haha (nothing too gruesome)
There isn't a blocks_placed statistic. there only is one per block type
What would be the best way to get the total blocks placed? No matter the block type
keeping track in your plugin of that value
the server doesn't keep track of that for you, it only tracks blocks mined and items used. items used includes block placements, but also other things
You could probably loop through all blocks and get the item_used statistic for each and then add that together though
Hi, im trying to make a custom fishing plugin, my plugin listens for the "onPlayerFish" event, how can i ensure that the hook got into the water?
Third time that you've mentioned you are on meds
By the way don't forget to remind me you're on meds
Are you on meds by chance?
Why don't you go clutter your phone storage with more cat gifs
Dear god I knew it when I saw the poorly animated discord pfp
I just looked up blehh in tenor directly lol
Btw idk if I should mention this but I'mm still not taking shots, I'm just overly sarcastic
It's alright man I can take it
😛
You think after almost (accidentally) killing myself while skating, I cant take a joke? cmon now
Well you are on meds (btw you are on meds (btw you are on meds (btw you are on meds))) so I just felt the need to clarify myself
make sure to include the accidentally
btw did you get in an accident? you're taking pills for that right?
Some people make assumptions... also I have never read spigot discord rules so I am not exactly sure on what is appropriate to mention
benzodiazepines are great
Clearly I have an issue with being on meds how many times I've said it...
Well this discord server has seen some shit
So you can probably talk about whatever but in #general
yeah being on meds is pretty light compared to some of the stuff I've seen
had mfs try to doxx me
I was just replying to the comments cuz I got tagged in here haha
Holy fuck what'd you do
called a guy a skid
Probably anything
💀
what even is that, I only find stuff about antibiotics when googling that
skript kiddie
oh
Skid is like calling someone a crackhead imo
If that can get you doxxed then what can't
If you've ever seen the show letterkenny, you'll know why i think that
thing is he came up with the wrong person lmfao
I mean he did dox somebody which is not better than not doing that at all
To be fair the most people want to do is act scary so in most cases the worst thing that happens is you get send a google pic of your house... either that or the whole doxfile lol
I mean yeah but dude posted "my info" here
and got banned
and joined on an alt and got banned again
The fool-proof solution against people that dox others is to dissolve their organs in fluoroantimonic acid
goofy goobers am I right?
april fools: replace all the soap in your house with sulfuric acid
I'm just a little goofball 😛 Here's your doxfile ❤️
Best youtube prank:
Oh did I mention, I am on meds?
Also wanted to make it clear, I am on meds guys just so you know
Ok back to dev questions tho... could someone show me an example of how to properly manage commands + arguments? I've always just used the generic one class per command / their arguments, but I've seen a couple of other methods of handling commands, if anyone has a better method than this please let me see an example haha
i've been trying to properly read from it for like 3 hours
the easiest way is to a command framework such as ACF
That looks rather large haha
alternatively, which is more annoying but also more flexible, is to just get args[0] in your executor, and then do a switch or sth
public boolean onCommand(...) {
String subCommand = args[0];
args = shift(args); // Remove the first entry
switch(subCommand) {
case "sub1": return onSubCommand1(args);
// ...
}
}
Bruh I was thinking about just doing that ahaha
yeah that's how I usually do it
or make your own flexible command api 😌
WIP modular core plugin for modern Spigot versions - SpigotBasics/basics
I've never designed any api before...
Ah yes I like it, it's very simple and clean to be fair... also really easy haha
Oh oh and perhaps configurable 😄
As in allow people to change the command arguments (not sure why you'd want that but hey more configurability am I right?)
Never too late to do so
Not as hard as it may sound
My year of using spigot or so I've learn to read people's examples for how to use spigot for some reason never took the time to look at apis D:
Spigot is an api
I know, but in the sense of using the api as opposed to designing one
Plus it would seem I'm still not that great at using spigot lol
Well this is a very simple API:
package some_package;
public class MyAPI {
public void doNothing() {}
}
Create it as a maven project for example (because I have no idea how to do it with gradle), run mvn install
Now you have this API in your local repository
Import it into your other projects and use it
doNothing.doNothing lol
some_package.MyAPI.doNothing()
“Method isn’t static!”
actually imports a complete index of custom player evnets for a skyblock core kek
Yeah that's basically APIs in a nutshell. Absolutely nothing difficult
I mean I'd call this a library over an API but technically API is also perfectly fine
Well I just kinda saw the difficult part is in designing the functions related to the api calls, I'm not very creative and wouldn't really even know where to start
for example MyApi.doNothing() I would have no idea where to start with the functions... When it comes to what you can do with that method
This method, evidently, does nothing
Well yeah but just as the example at foot
It's not like you are just sitting there thinking "ah, yes, I need more methods for my API"
It's when you need to do something that your API is designed for but doesn't have, that you come code it
For example, you are coding a math library, you are out of ideas
Then you need to find the hypotenuse of a right triangle and you think
Wow this could be in my library
So you go and add it to your library
So essentially just try to come up with some sort of base idea that is broad enough to expand into something great
Exactly
https://github.com/NukeCaps/SilentSkyCore
Perhaps I could start with this, it's already a project that I've had on the backburner for a couple months... it's uh imo poor design, but should be fine as a starting point eh?
I'm too tired to check the code rn but I assume you could put some of that stuff (if not all of it (i have no idea what's in there)) into an API yes
is there a way to hide player or just make them invisible but their nick wont be hidden?
ehm
I mean to be fair I think I'm just slow... it already looks pretty similar to your example when it comes to the island logic
player.addPotionEffect
It's pretty old and a lot of the stuff written in there is deprecated I'm pretty sure haha
Basically if you have a project you don't need to put all of that into an API. For example, if you have a homes plugin, you can create an API which allows developers to get people's homes' location
This could be done like this:
// Your API
public interface HomesAPI {
/** Some docs */
@Nullable Location getPlayerHomeLocation(@NotNull UUID uuid);
}
// Your plugin
public class MyHomesPlugin extends JavaPlugin implements HomesAPI {
@Override
@Nullable Location getPlayerHomeLocation(@NotNull UUID uuid) {
// some implementation...
}
}
// Someone else using your API
HomesAPI api = null;
if (Bukkit.getPluginManager().isPluginEnabled("MyHomesPlugin") {
api = (HomesAPI) Bukkit.getPluginManager().getPlugin("MyHomesPlugin");
}
api.getPlayerHomeLocation(uuid);
This requires you to publish your API somewhere like Maven Central or Jitpack (for which there are sufficient guides) and for the developer to import your API in their project with maven/gradle. In this particular case, since the API depends on your plugin (because the API itself is just an interface that does nothing, and your plugin implements the methods of the interface), the plugin is also required to run on the server.
Your plugin class shouldn't implement HomesAPI
Instead just initialize a dedicated thing
Use the service provider system on bukkit
Or a static provider class (LuckPermsProvider.get())
Imma refactor my plugin to use the service provider system
You should callback when inited
Right yeah I get the usage of an api, It just opens up some base methods available for other devs to use for rather "custom implementation" of my project right? Essentially more times than not the api is written into the git repo?
Or the project itself?
I see a lot of "api" folders that look like entire projects dedicated to the api functionality
APIs can be extensive yes
But it could be either right? Instead of making it as complex as another project, could just be included in the "plugin" for simplicity eh?
talking about dev stuff here, I made a siri shortcut "turn on the bathtub" lol
I mean you could combine the API and plugin projects but I wouldn't do that
Just separate the responsibilities
Is it possible to replace all enchantments over 5 Lvl with attributes?
Lmao nice
How exactly
it only sets two timers 🥲
20 minutes and 25 minutes. after 20 minutes it's full of burning hot water, then I turn on cold water for 5 minutes and then it's perfect temperature lol
Yeah that's fair, better practice for sure
Lmao nice
Did I just say Lmao nice twice
I am very emotional clearly
yeah




This reminded me that if I somehow manage to get so much free time that I can do nothing the entire day for months on end, I wanna (at least try to) make a Rust core for plugin development
Wonder if I'll ever get my hands on that project
Isn't minecraft / rust comparable in prices?
How would this sentence even make sense then lol
About 9302 times
I think its been a couple more than that
Why don't level 11 enchantments work?

?notworking
"Does not working" is a useless statement. Please describe what exactly is not working, what you expect it to do, and what actually happens. If you get any console errors, also ?paste the entire stacktrace.
This is not a code, I’m literally talking about enchantments beyond level 5 that don’t work when you give them to an item
the item has them, but they just don’t work and it’s not the code
How do you apply the enchantments
item.setUnsafeEnch.(Ench,level)
You can see the enchantment tag on the item, correct?
yes
Seems like a skill issue
Yeah something like that
And by "don't work" you mean that they behave as if there's no enchantment? As if there's an enchantment of a different level?
Etc
yes
Run /data get entity @s SelectedItem and verify that the enchantments are on the item
pluggg definitely regrets to for the most part inform you that unfortunately, they essentially are unable to definitely assist with definitely your enquiry, which essentially is fairly significant. Please simply really ask again later or possibly kind of ask someone else about this enquiry, demonstrating that the person that ran this command generally regrets to kind of inform you that unfortunately, they for the most part are unable to generally assist with actually your enquiry in a subtle way. Thank you very sort of much for kind of your time and the person that ran this command specifically wishes you a really good day, so the person that ran this command really regrets to actually inform you that unfortunately, they literally are unable to definitely assist with very your enquiry, or so they particularly thought.
I remember someone said that enchantments beyond lvl 5 do not work and need to be replaced with attributes, but are there all attributes suitable for all enchantments?
if (CooldownTimerTask.hasCooldown(targetPlayer.getName(), "TownHop Cooldown")){
CooldownTimerTask.addCooldownTimer(targetPlayer.getName(), "TownHop Cooldown", 0);
}
void addCooldownTimer(String, String, int) Target, cooldown type, duration... Given the inputs, this should (probably) remove the cooldown?
Theres no remove cooldown timer method for towny's cooldown system aha
assuming that's what you're using? if so, you can access the cooldown map directly and remove it from there I guess
Yeah
Oh..
gross ok let me try
CooldownTimerTask.getCooldowns().remove(targetPlayer.getName());
This should be fine yeah?
It looks like it forms the key from key(string object, string cooldownTypeName)
so removing CooldownTimerTask.key(targetPlayer.getName(), "TownHop Cooldown") from the map is right probably
just glancing at the code
Well the map itself takes String "playername", Long "duration (i assume)
it transforms the 2 parameters into a string key with that key method
Ah gotcha
a uuid would be better than a name
same concern @glad prawn, Every other input has requested a string not UUID
But then again, to their point, I'm not sure it matters
scheduleAsyncDelayedTask is deprecated, what should i use instead?
runTaskLaterAsynchronously
thanks
String subcommand = args[0];
switch (subcommand){
case "remove":
Player targetPlayer = Bukkit.getPlayer(args[1]);
if (targetPlayer == null) break;
if (!CooldownTimerTask.hasCooldown(targetPlayer.getName(), "TownHop Cooldown")) break;
if (CooldownTimerTask.hasCooldown(targetPlayer.getName(), "TownHop Cooldown")){
CooldownTimerTask.getCooldowns().remove(targetPlayer.getName(), "TownHop Cooldown");
player.sendMessage(ChatColor.translateAlternateColorCodes('&', "&l&c " + targetPlayer.getName() + "&r&f have had their cooldown &l&c removed&r!"));
break;
}
break;
case "start":
targetPlayer = Bukkit.getPlayer(args[1]);
if (targetPlayer == null) break;
if (CooldownTimerTask.hasCooldown(targetPlayer.getName(), "TownHop Cooldown")){
player.sendMessage(ChatColor.translateAlternateColorCodes('&', "&l&c " + targetPlayer.getName() + "&r is already on&l&c cooldown!"));
player.sendMessage(ChatColor.translateAlternateColorCodes('&', epirateTownyAddon.getRemainingCooldownHours(targetPlayer)));
break;
}
if (!CooldownTimerTask.hasCooldown(targetPlayer.getName(), "TownHop Cooldown")){
int cooldownTime = Integer.parseInt(args[2]);
CooldownTimerTask.addCooldownTimer(targetPlayer.getName(), "TownHop Cooldown", cooldownTime);
player.sendMessage(ChatColor.translateAlternateColorCodes('&', "&f Started cooldown on &l&c" + targetPlayer.getName() + "&r for &c&l" + cooldownTime + "&r seconds!"));
break;
}
break;
default:
player.sendMessage(ChatColor.translateAlternateColorCodes('&', "&f Usage : &l /cooldown &c remove &f | &a start &f {Player Name} (duration, in the case of starting a cooldown)"));
break;
}```
Does this look correct?
I can put it in a hastebin if needed
Balls
String subcommand = args[0];
Player targetPlayer = Bukkit.getPlayer(args[1]);
switch (subcommand) {
case "remove":
if (targetPlayer == null) {
break;
}
if (CooldownTimerTask.hasCooldown(targetPlayer.getName(), "TownHop Cooldown")) {
CooldownTimerTask.getCooldowns().remove(targetPlayer.getName(), "TownHop Cooldown");
player.sendMessage(ChatColor.translateAlternateColorCodes('&', "&l&c " + targetPlayer.getName() + "&r&f have had their cooldown &l&c removed&r!"));
}
break;
case "start":
if (targetPlayer == null) {
break;
}
if (CooldownTimerTask.hasCooldown(targetPlayer.getName(), "TownHop Cooldown")) {
player.sendMessage(ChatColor.translateAlternateColorCodes('&', "&l&c " + targetPlayer.getName() + "&r is already on&l&c cooldown!"));
player.sendMessage(ChatColor.translateAlternateColorCodes('&', epirateTownyAddon.getRemainingCooldownHours(targetPlayer)));
} else {
int cooldownTime = Integer.parseInt(args[2]);
CooldownTimerTask.addCooldownTimer(targetPlayer.getName(), "TownHop Cooldown", cooldownTime);
player.sendMessage(ChatColor.translateAlternateColorCodes('&', "&f Started cooldown on &l&c" + targetPlayer.getName() + "&r for &c&l" + cooldownTime + "&r seconds!"));
}
break;
default:
player.sendMessage(ChatColor.translateAlternateColorCodes('&', "&f Usage : &l /cooldown &c remove &f | &a start &f {Player Name} (duration, in the case of starting a cooldown)"));
break;
}
Idk how you do that haha
You can use the discord code block format to display code or just text in a more pleasing way:
```java
public class MyPlugin extends JavaPlugin {
@Override
public void onEnable() {
}
}```
Becomes:
public class MyPlugin extends JavaPlugin {
@Override
public void onEnable() {
}
}```
now tell me how to send three ` without converting it into a code block like this 💀
ow back slashes
Yee
public static Location findNearestLocation(List<Location> locationList, Location targetLocation) {
return locationList.stream().min(Comparator.comparingDouble(targetLocation::distanceSquared)).orElse(null);
}
any idea how can i return this in a async runnable?
Depends
Does it need to return a value NOW
or can it return it at any point in the future
now
what about one tick later?
Ohhh haha thank you
thanks
public static Location findNearestLocation(List<Location> locationList, Location targetLocation) {
return CompletableFuture.supplyAsync(() -> locationList.stream().min(Comparator.comparingDouble(targetLocation::distanceSquared)).orElse(null)).join();
}
using get(); throws exceptions and i don't want to handle those for now, is .join(); ok?
Attribute of the tool, not an attribute of the enchantment
Enchantments beyond 5 work fine
They just don't display properly without a resource pack
Well that's why you code it your self like essentialsx
I don't think they do that
Wdym
u can do /enchant any level
And?
yeah so it sets the lore it self no?
anybody else got this where intellij just completely hallucinates errors for kotlin?
Also I was wrong, the display breaks after 10
no but Analyze Code is broken for me
it analyzes the whole kotlin-dsl stuff
@tender shard do you know how I could create a buildSrc for something like if I wanted to beable to add a plugin that applies a standard set of settings for some of my modules right now I use some weird if checks but I'd much prefer to use a plugin. e.g. I can just add something like this to a subproject
plugins {
id("mybuildsrcplugin")
}
Did bukkitEntity from nms entities get removed in 1.20.4?
idk lets check
which class is this from?
you put the script into buildSrc/main/src/kotlin/mybuildsrcplugin.gradle.kts
you also have to setup your buildSrc/build.gradle.kts to use kotlin-dsl as plugin
I can't do the configuration though in there because when I try to do tasks.checkstyle it just doesn't find it
nms entity
if (finalKill) {
teamVictim.getPlayers().removeIf(playerInTeam -> playerInTeam.equals(victim));
arena.getPlayers().removeIf(playerInArena -> playerInArena.equals(victim));
// error here
arena.getTeams().removeIf(team_ -> team_.getPlayers().isEmpty());
}
why i get ConcurrentModificationException???
import org.gradle.kotlin.dsl.checkstyle
plugins {
id("checkstyle")
}
tasks.checkstyle { // error doesn't exist??
}
Stacktrace & code pls
Shouldn't that be fixable with a simple server-resource-pack?
?paste
where doesn't it find it?
Changing the language file*
in the buildSrc script or in the other one
buildSrc
no
it still exists
what? I am confused, you are mixing things up I guess
https://hastebin.skyra.pw/iwiniroxav.kotlin
@tender shard is this correct? As in the command arguments handling
if you want to change the checkstyle settings in your buildSrc script then your buildSrc script must ofc declare the plugin
it does I'll explain better one second
It's pointing to a line that doesn't exist but I'm assuming it's the teamsToRemove iterator remove call
That looks problematic
All the nms entity classes, I probably did something wrong while updating to 1.20.4? I use remapped mojang and all the rest is fine, just the bukkitEntity reference are all missing. Any clue why?
@tender shard nvm I'm stupid
it is /* if you look
it isn't a task
try getBukkitEntity ik you're on kotlin and all but yeah that's the official name
my problem is arena.getTeams().removeIf(team_ -> team_.getPlayers().isEmpty()); @tender shard
it can give error beause is a removeIf.
get error getPlayers
isEmpty is just checking for comod, you're probably editing getPlayers on another thread
?
i have wrong tag
arena.getPlayers().removeIf(playerInArena -> playerInArena.equals(victim));
replace that with
arena.getPlayers().remove(victim)
no, only in it code
But honestly you shouldn't have any sort of player collection
thx, my mistake
and instead store UUIDs
@echo basalt No one can figure out how to do it and I'm getting desperate.
is not here the problem
world.createEntity now returns a bukkit entity instead of an nms one
IJ's code inspection is so stupid...
@echo basalt the problem is arena.getTeams().removeIf(team_ -> team_.getPlayers().isEmpty());
team.getPlayers() is being modified in that case
I'll blame your poor structure for this
i know
but if i do .size() == 0 get error
Also
It's still poor structuring, not the wrong call
I tried with itenerator, Removeif and Steam.
I can't understand the problem
@echo basalt Do you have ideas?
How did i ever dislike kotlin, its so awesome
I will never use java again unless i have to
iirc yes
well idk
conclube can you type ?ban @tender shard
Doesnt it require a javac plugin
❤️
ive seen ppl in helpchat use it alex lmao
na
Huh ok well kotlin has everything that lombok adds
@Getter? @Data?
mfnalex just upgraded from checkers to 4d gpu accelerated chess
yeaa
data classes, public vals / vars
gotta agree tho
immutability by default is so nice
and semantic nullability types

what's the dif between
checkstyle
and id("checkstyle") in build source
@young knoll control conclube
lol
it's the same thing
alr
checkstyle is just a DSL accessor cause it's an org.gradle plugin
how can I grab a projects sourcsets in gradle kotlin?
project.sourceSets isn't a thing
You wot
sourceSets
java plugin applied?
yeah
plugins {
java
checkstyle
}
checkstyle {
toolVersion = "10.12.5"
configFile = file("config/checkstyle/checkstyle.xml")
sourceSets = listOf(project.sourceSets.main)
}
ig we will see
works for me
I'm switching from gradle groovy I still got a lot to do before i Can test
@rotund ravine it breaks when I use the explicit checkstyle instead of id("checkstyle") in plugins
yes that is correct
whatever ig I'll just use id("checkstyle")
it is? afaik
it is a core plugin
oh ok mb
me using groovy 
has a bit more safety and ease
Me also using groovy
yeah remove him from the trello pls
i bet he doesnt even hear kotlin underpants smh
I have dreamt in kotlin before, it was unpleasant and didn't get to sleep the full night.
Would rather dream about irl stuff
Uh yeh
Otherwise
CreatureSpawnEvent
Does the regular spawn event not fire for that?
Probably would
yeah creaturespawn has a reason alr
I need to store 3 strings, 2 enum, a list of item stacks, a list of strings, 2 ints in an SQL table. I assume creating a new column for each would be horrible inefficient. So what would be the best way to store it?
having many columns isn't super inefficent its how SQL works
Yeah but wouldnt it better just to store in one column in binary?
no at that point don't even use SQL
throw everything into a binary format like NBT
and store it in a flatfile
It has to be stored in MySQL cant be anything local
So the best way is to just have a ton of columns?
why
what does ur types represent
client wants it like that unfortunately
nothing is wrong with having 7 columns
how is this a problem?
its not inefficent its just 7 columns
did they tell you to use blobs instead?
We would want to know what ur saving
Like
We can tell u how to optimize and shitz
What else do you want to know
What ur types represent
JSON/GSON and Datatypes
Does anyone know why it wont send the embed?
This is the code:
https://pastebin.com/ZQ9i4yF9
https://pastebin.com/GGyhUfQh
The bot is online and the plugin is green in /pl but it dosent send the embed when a players dies
The bot has "admin" permissions
You're not verified.
they meant a discord embed with a bot xD
Oh, woops
because chatChannel is null
Strings:
Quest name
Quest desc
Quest permission
Enum:
Quest objective type (Break blocks, Place blocks, etc)
Item stack list is a list of items to give to player as rewards
List of string is for commands to run on player as rewards
integers:
xp amount to give as rewards
coin amount to give as rewards
why do you need to store the quest description?
or permission shouldn't those things be retrievable from some form of registry
you would realize that if you added just one print statement, and see that whole method isn't executed
Client specifically mentioned it
Should be fine to have that as a table
Wym by permission though?
Thought
A quest could be a table of itself
and a quest could have an idf
id
and the whatever ur doing now
could just reference that id
I would put all the single stuff in one table
Then another table for rewards
and another for the commands
Yes
Rather than combining them all into a single column, you store a row per command
I was thinking quest gets a ascending reward ID which correlates to a reward table entry that has all of it stored there
There's nothing wrong with adding a null check. They are in fact necessary sometimes.
Whats wrong with just concating a list of commands in a column?
Alright thanks
Plus you’d have to use something to divide them, and what if you then want to use that something in a command
Would that be better performance wise since you can limit to 1 row? Instead of having to go through all of a tables entries?
Hello! I see that you are looking for the best way to store multiple data types in an SQL table. You are correct that creating a new column for each data type would be inefficient. There are several ways to store multiple data types in a single column. One way is to use a varchar column and store the data as a JSON string. Another way is to use a sql_variant field, which can store multiple types and preserve the type metadata (type, precision, scale) ². You can also create a separate table for each data type and use a foreign key to link them to the main table ¹. I hope this helps!
Source: Conversation with Bing, 02/02/2024
(1) sql - What is the best way to store multiple data type into database .... https://stackoverflow.com/questions/5724618/what-is-the-best-way-to-store-multiple-data-type-into-database.
(2) mysql - How to store multiple data types for same column (for many .... https://dba.stackexchange.com/questions/286540/how-to-store-multiple-data-types-for-same-column-for-many-columns.
(3) sql server - Best way to store a value which could be multiple types .... https://dba.stackexchange.com/questions/140518/best-way-to-store-a-value-which-could-be-multiple-types.
(4) Multiple data types in column – SQLServerCentral Forums. https://www.sqlservercentral.com/forums/topic/multiple-data-types-in-column.
(5) undefined. https://stackoverflow.com/questions/10455783/different-types-for-the-same-column.
(6) undefined. https://www.sqlservercentral.com/forums/topic/multiple-data-types-for-the-same-column.
(7) undefined. http://rads.stackoverflow.com/amzn/click/1934356557).
Ignore me just getting my msgs up
thought bing might be right
i didn't read shit
True ig you would still recommend your way?
I assure you going through more rows isn’t going to destroy your performance
This is what sql is built for
👍
You are correct that creating a new column for each data type would be inefficient
Wild it suggests just storing json
over actually idk using SQL properly
?learnjava
Here are some links to get you started on learning Java:
- https://www.codecademy.com/learn/learn-java
- https://www.sololearn.com/learning/1068
- https://www.learnjavaonline.org/
- https://programmingbydoing.com/
- https://docs.oracle.com/javase/tutorial/java/index.html
The last one is the only official one, however some of those concepts assume that you already know a bit about programming.
basics
fuck sql
Idk if im just really dumb rn but can you tell whats wrong with this?
if (chatChannel == null) {
System.out.println("ChatChannel is null");
} else {
if (chatChannelID != null) {
chatChannel = jda.getTextChannelById(chatChannelID);
}
}
yeah also we don't store different types of objects. they're all the same type. they're all JsonElements 🙂
lol
Btw its the same as
if (chatChannel == null) {
System.out.println("ChatChannel is null");
} else {
chatChannel = jda.getTextChannelById(chatChannelID);
}
Functionally there is no difference here.
What do you expect to happen, and what is actually happening?
@tender shard like this?
plugins {
id("java")
id("io.github.patrick.remapper") apply false
}
dependencies {
compileOnly(":pineapple-nms:api")
}
tasks.jar {
finalizedBy(tasks.getByName("remap"))
}

I know it would be smarter in a switch or something, but rn its just for testing
Ill fix it up when its working
lgtm merged to master
i recognise that
Bootleg specialsource
yes but in the parent you usually define a version
basically you do it like this
parent
plugins {
id("com.johnrengelnman:shadow") version "1.2.3.4" apply false
}
some other thing
plugins {
id("com.johnrengelman:shadow")
}
Just add debug messages
this is in buildSrc
You never initalize the TextChannel. Hence it's always null.
so it has no specific parent
Is storing UUID's as binary in MySQL the proper way? (The person who told me many sql columns is inefficient also told me this and im starting to doubt some of the things he said)
the issue is I keep getting this error because I haven't specified a version
Plugin [id: 'io.github.patrick.remapper'] was not found in any of the following sources:
Sorry, but i dont understand what you mean
^ mind you the plugin is on maven central
ah yeah then it's different
Binary for uuid is fine
?learnjava
Here are some links to get you started on learning Java:
- https://www.codecademy.com/learn/learn-java
- https://www.sololearn.com/learning/1068
- https://www.learnjavaonline.org/
- https://programmingbydoing.com/
- https://docs.oracle.com/javase/tutorial/java/index.html
The last one is the only official one, however some of those concepts assume that you already know a bit about programming.
Char(36) probably won’t kill you though
There is a UUID method in mysql though.
Ah yeah that too
mc uuid dont work for it
i thought
He means that you never initalize the TextChannel so it's always null.
You can take that literally
Why would they not
UUIDs are the same format.
It doesn't matter where they come from.
ok like this:
buildSrc/build.gradle.kts
dependencies {
implementation("com.johnrengelman:shadow:1.2.3.4")
}
buildSrc/src/main/kotlin/myscript.gradle.kts
plugins {
id("com.johnrengelman:shadow")
}
I swear I saw someone say that on the forum
i just realised something
There are multiple versions of uuid but they are all 128 bits
godnattid is <none>
ohh okay
Alright thanks, ill try fix that
If you use the Java UUID class for everthing, you'll be fine.
👍
classic
did it work?
What would be the best way to read enchants from a yml file and apply them to the item?
- DIG_SPEED: 1
- LOOT_BONUS_BLOCKS: 2```
``` for (String key : keys) {
item.addEnchantment();
}```
I have the loop loping through them, but how do i pull the name and convert it to an enchant and then pull the value and set that as the amount
yep 👍 thanks
don't use a list, but use a configuration section
enchants:
DIG_SPEED: 1
LOOT_BONUS_BLOCKS: 2
then you can loop over it like this:
ConfigurationSection enchants = myConfig.getConfigurationSection("enchants");
for(String enchant : enchants.getKeys(false)) {
int level = enchants.getInt(enchant);
// enchant = "DIG_SPEED", level = 1
currently your enchants thing is a MapList where each map only contains one entry
Ok but now i have the name of the enchant, but how would i convert the String to an acual enchant becouse the add enchant function only takes in a valid enchant
Enchantment.getByName or something
You should use the key instead though
Since they have better names
yeah getByName will work but it's deprecated
Namespaced keys for the win
getByKey is deprecated too, one shall use the registry it says
Registry.ENCHANTMENT.match("unbreaking") ? or how does it work?
So i shouldnt use the deprecated stuff?
match should accept unbreaking or minecraft:unbreaking
you should avoid it if possible
so yeah just do Registry.ENCHANTMENT.match("fortune") etc
that's the easiest way
Ok
it also uses the proper names and not DIG_SPEED, LOOT_BONUS_BLOCKS etc
It is complainign about using ConfigurationSection object as loop
foreach not applicable to type 'org.bukkit.configuration.ConfigurationSection'
^
Notice the getKeys in the code
oh ok
Huh? java.sql.SQLException: Unknown data type: 'UUID'
which database?
Looks like your database doesn't support uuids
MySQL
you must be using a really old mysql version
then use varchar(36) and toString the uuid
👍
looks uggo
don't you need 2 different columns tehn
yes
yeah you do
min and max
composed primary key or some bs
leastSig and mostSig
Store a BINARY(16)
either varchar(32) or varchar(36) or binary(16) or get rekd
same same
Smh why varchar and not char
TEXT !
oh yeah
nah I'd rather have 1 int column for each char that represents its index in the ascii table
36 columns
there
CREATE TABLE my_table (
col1 CHAR(1),
col2 CHAR(1),
col3 CHAR(1),
col4 CHAR(1),
col5 CHAR(1),
col6 CHAR(1),
col7 CHAR(1),
col8 CHAR(1),
col9 CHAR(1),
col10 CHAR(1),
col11 CHAR(1),
col12 CHAR(1),
col13 CHAR(1),
col14 CHAR(1),
col15 CHAR(1),
col16 CHAR(1),
col17 CHAR(1),
col18 CHAR(1),
col19 CHAR(1),
col20 CHAR(1),
col21 CHAR(1),
col22 CHAR(1),
col23 CHAR(1),
col24 CHAR(1),
col25 CHAR(1),
col26 CHAR(1),
col27 CHAR(1),
col28 CHAR(1),
col29 CHAR(1),
col30 CHAR(1),
col31 CHAR(1),
col32 CHAR(1),
col33 CHAR(1),
col34 CHAR(1),
col35 CHAR(1),
col36 CHAR(1)
);
perfect
ah is that why his name is @young knoll
no way @young knoll reference?!?
frick you
I even was faster than md5 today when he demanded tree fiddy again
👀
sus
yes I wrote a shell script today
cd /home/minecraft/buildtools && java -jar BuildTools.jar --rev 1.20.4 && cp spigot-1.20.4.jar /home/minecraft/singleplayer
i didnt remember the flag name
Ur disgusting smh
--o or --output-dir
too fancy
I rather cp it
oh btw I wrote a zip task for basics
tasks.register<Zip>("zipDistribution") {
group = "basics"
description = "Bundle the plugin and all modules into a single zip file."
archiveFileName = "basics-$version.zip"
destinationDirectory = file("build/dist")
from(project(":plugin").tasks.getByName("shadowJar", ShadowJar::class).archiveFile)
for(module in project(":modules").subprojects) {
from(module.tasks.getByName("shadowJar", ShadowJar::class).archiveFile) {
into("Basics/modules")
}
}
}
i use this for some stuff
@echo off
set source="C:\Users\immrt\Desktop\Epic Plugins\RestAPI\build\libs\RestAPI-1.0-SNAPSHOT-all.jar"
set destination="C:\Users\immrt\Desktop\RestAPI"
echo Copying JAR file...
copy %source% %destination%
echo JAR file copied successfully.
exit
i should find out how to hash check stuff and auto restart jars
just compare the output of sha1sum <file>
meanwhile I wrote an abstraction around if checks
is that an actual windows cmd
windows
it's part of git bash
@echo off set source=“C:\Users\immrt\Desktop\Epic Plugins\RestAPI\build\libs\RestAPI-1.0-SNAPSHOT-all.jar” set destination=“C:\Users\immrt\Desktop\RestAPI”
echo Copying JAR file… copy %source% %destination%
echo JAR file copied successfully.
echo Adding hashcheck… set hashcheck=“C:\Program Files\HashCheck\HashCheck.dll” regsvr32 /s %hashcheck%
echo Hashcheck added successfully.
echo Adding autostart… set autostart=“C:\Users\immrt\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Startup\RestAPI.bat” echo @echo off > %autostart% echo cd %destination% >> %autostart% echo java -jar RestAPI-1.0-SNAPSHOT-all.jar >> %autostart%
echo Autostart added successfully. exit
wow can it get even more complicated
sus amobus
windows cmd is so overly shitty
:)
disgustng
I can't bother dealing with some startup exception and then more exceptions onDisable
because variables never initialized type deal
I was joking, tbh that would be smth i'd write to disregard nullchecks
There's also this
islandManager?.let { it.disable() }
no thsnka
ugly ahh
like fuck does that mean
if u didnt know kotlin how does it make sense
it means "if islandManager != null run islandManager.disable()"
Hi im a noob with all this. Actually just started today developing some Plugins, because I wanted to host a server for my friends. Im writing a plugin, that kicks everybody from the server, then deletes all the world files and then restarts the server. The world files keep getting deleted, but they are kinda coming back in the process of shutting down the server??!! is there any way to turn this off?
tf does let do
uH it's janky
I've had this kind of issue before
my way of solving it was to just delete them on startup
Instead of onDisable
I'd legit just write some empty file and see if it existed in the world folder
Hello! I'm glad you're exploring the world of Spigot plugins. It sounds like you're trying to delete all the world files on your server, but they keep coming back when you shut down the server. I can help you with that.
To delete a world's data directory on a Spigot server, you need to first unload the world and its chunks. After that, some files and directories may still not be deleted. Here's some sample code that should work for you:
Server server = getServer();
World world = server.getWorld("world");
File active = world.getWorldFolder();
// Unload the world and its chunks
server.unloadWorld(world, true);
// Delete the world's data directory
deleteDirectory(active);
The deleteDirectory method is defined as follows:
public static void deleteDirectory(File file) {
if (file.isDirectory()) {
File[] files = file.listFiles();
if (files != null) {
for (File f : files) {
deleteDirectory(f);
}
}
}
file.delete();
}
This method recursively deletes all files and directories in the specified directory. You can use it to delete the world's data directory.
I hope this helps! Let me know if you have any other questions.
Source: Conversation with Bing, 02/02/2024
(1) How to to delete a world's data directory on a Bukkit server?. https://stackoverflow.com/questions/46747905/how-to-to-delete-a-worlds-data-directory-on-a-bukkit-server.
(2) How to delete a world folder (PROPERLY) - Bukkit Forums. https://bukkit.org/threads/how-to-delete-a-world-folder-properly.156344/.
(3) github.com. https://github.com/glotovauv/Messenger/tree/ab69b3dfbd0f0a41cae9a4368cbfdca5d14ef31d/src%2Fmain%2Fjava%2Fmessenger%2Fservices%2FTalkServiceImpl.java.
shut up bing bing
ahaha
very intuitive!
hi how i get spigot api?
it's in the maven repo
?buildtools
?jd-s
Its not as if i didnt try that already 😭
Hmm thats a possible way to go
But that would always remove the world when i need to restart the server, right?
tnx
well basically whatever you call "let" on, it can be referred to as "it" inside the block
val name = "my dog"
name.let { println("$it has pooped on the sofa again") }
By combining it with the ?. operator, you can make it run only if it's not null
let it be my dog
thats the top 7 question science cant solve
interesting reasoning
almost as poetic as cmarco using half a percent of his exceptional skill
i guess it's like how in some languages you do let a = 3 or sth
so here we just do let whatever = it, no clue
The usage of let can be seen as "letting" the object on which it is called to be available within a temporary scope in the form of a lambda parameter.
tbh I think is a masterpiece
it's probably the best code I have ever written
i like being able to use it in a block like a this value
but id prob do smth like
expr -> { statement... }
commands.create("abc") -> {
then(otherocmandorsomrthing);
}
otherocmandorsomrthing
yes
What about for items another for that too?
would make sense if you recomend doing it for commands
Sure
Anybody experienced with PAPI can answer this?
I just updated my papi extension (had to remake it cause i lost project files) but I basically just updated the onRequest function and thats it. Supposedly the end user is testing and only the old placeholder is working and the new one just displays the %% text he typed for the placeholder. Is there anything else needed for the new placeholder other than the onrequest function or is the user just not updating correctly?
if its built in w the plugin ik u need to override the persists() function
Frick. I forgot to jump back to the master branch and now my changes from the other branch I was working on are now a part of this new branch.
Is there an easy way to fix that?
have you commited it already
Yea
shit thats out of my knowledge but im quessing if you bring the new branch to head of that then revert commit it should be fine
i hope
dont quote me
@tender shard you've been doing git stuff
help this man
wasnt he reading a book on it
and an interactive website
just cherry-pick the changes
- check the commit id of the commit you wanna move over
git log - switch to master
git checkout master - cherry pick the commits
git cherry-pick <commit-hash>
if you also want to remove the commit from your other branch, you can go remove the last X commits with git reset --hard HEAD~X (e.g. HEAD~1 for the last commit)
{
public interface TestInterface
{
Object getObject();
}
public interface DefaultInterface
{
default Object getObject()
{
return this;
}
}
public class Class implements DefaultInterface, TestInterface
{
}
}
why does this not work 😦
{
public interface TestInterface
{
Object getObject();
}
public interface DefaultInterface
{
default Object getObject()
{
return this;
}
}
public class Class implements DefaultInterface, TestInterface
{
@Override
public Object getObject()
{
return DefaultInterface.super.getObject();
}
}
}
Is this legit?
yes that's also what IJ suggested
lame
this is some locked ass java code
why doesn't the first snippet work
that's so weird
hm I guess it's just so that it's the same behaviour as if both interfaces would have a default method, then you'd also still have to implement an actual method
I am, under a GABA depressor
you're drunk?
shh, don't be that smart.
kek cheers
Heading to bed soon or smth
I can't figure out what's going on now and you're telling me there's more?! 😭
What's the best way to store an ItemStack in a MySQL DB? I know many people use itemStack#serialize() but I am not sure what to do with the map it returns
you can use a BukkitObjectOutputStream to get a byte[]
the absolute best way is to dive into NMS convert the ItemStack into a CompoundTag than serialize it into bytes
otherwise do what alex said
you can also use my json lib to turn it into json if you want it to be human readable
then BukkitObjectOutputStream, that's the easiest way to safely save it
or however its called
alex do you know why when I depend on my library called PineappleChat it simply doesn't provide any of the classes? I'm so confused you can find the code at https://github.com/PineappleDevelopmentGroup/PineappleChat/blob/main/build.gradle.kts
it doesnt provide which classes?
any of the classes in my library
but I downloaded the jar and they are all there
which is why I'm confused
so what exactly do you depend on? which artifact?
beause your parent thing doesn't have any sources and hence probably has no artifact?
I just add the dependencies like this
implementation("sh.miles.pineapplechat:pineapplechat-core:1.0.0-SNAPSHOT")
implementation("sh.miles.pineapplechat:pineapplechat-bungee:1.0.0-SNAPSHOT")
ah ok
do I need to configure something in the jar plugin?
all of my subprojects logic is in the subprojects section
what's the purpose of this?
add the aggregated javadoc jar
adds the javadoc jar to the publishing artifacts
this.artifact(tasks.jar)
this.artifact(tasks.aggregateJavadocJar)
does it add it, or does it set it to only publish that?
docs say included
Creates a custom MavenArtifact to be included in the publication. The artifact method can take a variety of input:```
does kotlin say that the stuff there is this = publication or is it using this as project
the javadocs are fine the published jar is seemingly fine I mean it has all of the classes you'd expect to be there
do ur balls not absorb it
JanTuck is def on those GABA depressors
which java version does the other project use?
1.13
every project uses java 17
hmm is it just IJ not showing the classes, or can you also not compile it if you try to access any
oh im judging you on publishing under sh.miles.pineapplechat over sh.miles
tbf always try to compiel with gradle and see if IJ sucks ass
question though how do I refresh my dependencies with gradle
buttons
clean reload or that jar caching thing i sent you
I just published a new jar with the changes
caching thingy
./gradlew build --refresh-dependencies
I'm gonna do ./gradlew clean --refresh-dependencies
that should work right
my project doesn't build atm
too many java errors
@remote swallow send me the depependency thingy thingy again
We love setting cache changing modules to 0
configurations.all {
resolutionStrategy.cacheChangingModulesFor 0, 'seconds'
}
vroom vroom
I tried this instead
publications {
create<MavenPublication>("Maven") {
this.artifact(tasks.jar)
this.artifact(tasks.aggregateJavadocJar)
this.groupId = "sh.miles.pineapplechat"
this.artifactId = project.name
this.version = rootProject.version.toString()
}
}``` but adding the tasks.jar result didn't do anything either
i mean
from whats on there the jar exists
check external libraries on the project menu
- check you have the right repo extension
wtf
tf you got that from
that's in the external libraries section
oh right at the bottom
i mean in the end project
that wants to use pineapplechat
must be sth in your new project because in a random maven project, it works fine
wtf
I gotta say
wonder if invalidating my caches might work
Coming from 1.7 - 1.8.8 Spigot API to the latest version, i feel like a lot has changed and im so happy their is new methods, and Ray tracing!!!
Yeah a lot tends to change in 10 years
You don't say. Lol
@young knoll when ItemType 
||/s but not really||
enums suck
has raytracing not been there forever?
No they don't and why do they 'suck'?
If it’s registry based
It hasn't
oh
Not in 1.8
It shouldn’t be an enum
using enums for registires be like 
Had to use a public library for raytracing
Oh ima be honest, im not on the nerd level you guys are on
did that fix it
So i dont understand what u mean by registry
But i use enums for PlayerStates, and CooldownTypes shit like that, Enums are great for the things i do
registries are dynamic and data driven data structures backed by usually a map. Enums are non dynamic non data driven data structures driven by wtf java does under the hood
Hmm okay. Ill probably understand this in a week
but does mc even allow custom blocks meanwhile?
I mean real custom blocks
Nah definitely not thats why i suggested resource packs
with the shifts that have been happening its probably coming eventually
OOO no way!*
I believe Blocks moved to a Codec recently
which is good news
granted this is the mojang timeline so it could still be years
coq?
^
Yes blocks moved to codecs
i didnt know blocks were gay
yeah that's french for crossaint or sth, i dont remember
It’s Mojangs fancy and maybe a bit over engineered serialization system
