#help-development
1 messages · Page 992 of 1
make a variable of your class
Class c = new Class()
then
register c as an event
and as a command
@polar forge
Mmmmmh
smh single letter variables
Class c = new Class(); should be in the main class right?
its an example i have no idea what his class is called
yeah but it should be your class
the way you named it
not Class
Ofc
but it right before you register it
in the onEnable
if you dont need the class instance anymore at least
please use a set of uuids
It asks me to write something inside the brackets
show what you wrote
what did you have in them previously xd
Class c = new InvestigateCommand();
first of all
yikes
Here are some links to get you started on learning Java:
- https://www.codecademy.com/learn/learn-java
- https://www.sololearn.com/learning/1068
- https://www.learnjavaonline.org/
- https://programmingbydoing.com/
- https://docs.oracle.com/javase/tutorial/java/index.html
The last one is the only official one, however some of those concepts assume that you already know a bit about programming.
https://media.discordapp.net/attachments/694661573125472256/998143126373941248/6n0v4g.gif
exactly, first of all learn java
no this won't work
do InvastigateCommand command = new InvestigateCommand
it's been going like this for like 3 weeks
no 🥄
look at the end of the day
It still asks me for something in the brackets
check your constructor
Guys why are u so worried lmao, I am learning Java
we can see that
in the InvestigateCommand class
you're not, you just hopped into spigot directly
voss in 2 months when he has 90 people asking for help in his dms
i already do
but i usually tell them either join my server or ask in spigot
The Italian guy banned me from ur server :c
For no reason lol
But
Let’s continue
Wdym?
he's basically telling you to check your command class constructor
.
public InvestigateCommand(Invastigate “”) {
this.”” = “”
}
What should I write instead of those “”?
whats „“
delete the whole thing and you're ready to go
you should know lmao its your code
and now they go back on the no help list
Places that need something but idk what I should write there
cafebabe needs to have a ?vote command that allows people to cast votes to disallow people to use #help-development until they complete a basic 15 question java test without failing
because whatever the fuck we are doing right now is NOT productive
bet
you will write the code you want eventually
agreed
what the fuck is the use if you don't undesrtand anything about it
„hey chef I came up with this recipe but i have no idea what ingredients i used can you tell me“
Guys I’m trying to understand
learn java. stop doing spigot.
until you have basic java knowledge
I am learning Java
well its normally 95% of us tell them to learn java but then theres 1 random person that just appears and spoonfeeds
you dont know day 1 of java stuff how are you learning java
look up "learn java with exercises" on youtube, find a playlist and complete the course
actually day 0
Im in the meanwhile excercising
or at least have a background in any other programming language
you shouldnt be driving an uber while learning to drive should you
Yes u should?
what the fuck
ok if you are learning to drive then maybe
if you still confuse gas and brake then no
If you’re in an empty parking lot then yes
you aren’t though
you are not in an empty parking lot and no you shouldn't be doing that even in a parking lot
there are tons of obstacles
snd you keep breaking your car
because you dont even know how many wheels it jas
you are coding with a library (framework if you insist)
it's like you are on an obstacle course
not a fucking empty parking lot
Guys, why are u worried? I am learning Java, without doing such plugins I would never learn Java
.
because you arent making any progress
"why are you worried" because we cannot help you with your problems. you are not progressing and all your questions eventually go down to spoonfeeding
Now I am learning something new, and that is to register a listener class that also contains CommandExecutor
that is not half related to learning java
you don't even need to learn that
Well I need
so you just avoid the first message
?
.
It is related to Java
Spigot and Java are the same thing?
no java guide will go "don't forget to register your listeners and especially if they are commandexecutors"
WHAT THE FUCK
no!?
WEROTYUHINRIENSVUYHBERSuiyTSVRDUIYHNDFYNTGRDFKH][
this message disproves everything you said
about "i'm learning java"
no the fuck you are not
if you think java and spigot are the same thing
it's like saying that a cow and cottage cheese are the same thing
you are objectively fucking wrong
Well and 10s of professional and semi professional devs on this server with you are not making progress
and you wouldve made alot
if you listened to us
I am watching those videos of Java that won’t help me with what I am doing but hey at least “I am learning Java”
yes because if you are purely consuming you will not do any progress
do JAVA exercises
not SPIGOT PLUGINS
ofc they would it you watched them enough and actually learned what they teach
That’s the same? I don’t understand
make a "guess a number" console app
i didnt learn java when i first started and it got me no where, when i finally decided to actually learn it properly and figure out whats happening and how stuff works it made making stuff so much easier
java is a programming language
spigot is a library
a set of tools
yep yep.
Ok guys let’s do a promise together
Ill learn Java
will you
Can I at least get help on this? And I promise I’ll learn Java and tomorrow u can test me
tomorrow
And if I fail
do you think learning a programming language is a one day journey
learning the basics takes weeks
understanding advanced stuff 2 years
(unless you have a good background in programming which he does not)
fully understanding OOP can take decades
i started getting into programming 5 years ago, been doing java for about 3
Who Tf created Java? I could have done that and if I WOULD have done that it would have made the life of million coders easier
every. day.
you realize theres other languages
Yes
But guys
learn Lua :)
It’s #help-development and not #general
so?
we are talking about development xd
it's #help-development not #spoonfeed-me
So let’s help our brothers who just started making plugins
do you read a book in chinese without knowing anything about chinese
thats hard if they dont want to listen
this is fun
but translate every character separately with google translate to see if that yields other results
I am listening but I don’t understand what u mean
??? LEARN JAVA NOT SPIGOT API
I am, how many times I am telling u
You guys make me crazy
Crazy? I was crazy once. They locked me in a room, a rubber room, a rubber room with rats and rats make me crazy.
you are making this harder for yourself
it's okay just wait for elgar he'll spoonfeed you the project
he's old and apparently has too much time on his hands
we can all explain what we say its just you most likely wouldnt understand it
old as in
great grandad
Hes the kind of person to give his grand children all his money because he just loves them too much and couldn’t say no
elgar is the best grandad of spigot
Yeah the best and only
We all love Elgarl 🥰🥰🥰
i cant tell if y'all r joking. is he actually a grandad?
yes
yep
:o
one of if not the oldest person here
But guys let’s get on the right track
how old are you
I hate everyone equally. No favorites 😉
u think im older than Elgar 😭😭
where have i said that
Lmao
im turning 18
nice
Guys how do I register a listener class, if the listener class also implements CommandExecutor?
welp
Alex makes sure to tell it everyone
you make one instance of it, then register it as a Listner and command executor
Did I ever tell you what the definition of insanity is? Insanity is doing the exact... same fucking thing... over and over again expecting... shit to change... That. Is. Crazy.
we already solved this..
So like, instance of what? Of the entire class?
You my have told him but he doesn;t understand instances yet
nah just a part of it
try 1/3rd
yes, just like how you register anything else in spigot
no i straightup spoonfed him the code
You didn’t
i'm back to geometry bye have fun explaining day 1 basics
yes… that is.
It’s not
that is exactly what an instance is.
Instances come after “public”
What
what?
Like
If you have two applesjava Apple one = new Apple(); Apple two = new Apple();I have two apples, each one is it's own instance. They are identical but not the same Object(instance)
what am I reading here
public Class() {
//instance
}
yh and whats different about the thing ive shown you?
Not simple enough 😦
Ok uhmmmm, I already wrote one
Voss helped me
the "new" keyword creates an instance of the defined class
What’s next?
In main class or listener class?
So everything in main class?
just instead of typing new x inside of there
so if you want to use ONE instance you make sure to only create one instancejava Apple one = new Apple(); registerAsListener(one); registerAsExecutor(one);
type the name of the instance
yes
Note registerAsListener is not a real method, just an example
I really needed the note thx
So uhm
public InvestigateCommand(Investigate plugin) {
this.plugin = plugin
}
I know it’s wrong
so where in your code you kept doing new class() when you wanted to use it... thats wrong
But should it have the same structure?
whats wrong with it
wdym
6there is nothign wrong in that code
So is this it?
depends on what you are trying to do.
no, thats a DI constructor
If you need an instance of your plugin in your investigate command then this constructor is correct.
I already said it, trying to register listener, the listener also implements CommandExecutor
the fact it implements multiple interfaces had nothing to do with anything
your Constructor has nothing to do with registering
thats kind of how its designed
cause you dont know basic java.
ignore what is IN your class for a moment
only focus on the instance/registering
Bc it also implements a CommandExecutor
doesn;t make a difference
Why not have them in separate classes tho
who told you you cant use it
Bc I get errors
They shoudl be in different classes, but this is a good leaning experience too
True
WHERE YOU ARE REGISTERING
he just said he understands nothing from what you're talking about
currently you do a lot of new
ThissetExecutor(new InvestigateCommand(this)); makes a NEW instance
you only want ONE instance
so create a variable (not a field)
InvestigateCommand command = new InvestigateCommand(this);
But it tells me an error
ignore for now
Ok done
then replace all your current uses of new InvestigateCommand(this) with command
you missed one 😛
Unexpected token
oopsies
And ; expected
why r 2 commands using the same class lmao
yeah one thing at a time 😉
they are actually 3 commands
show us the code you currently have in your onEnable
i admire your patience
excellent
learn from w3schools
Sure but, why do you have this
now you want to register it as a Listener too
yeah delete 12
Ok
do you know how to register an Event Listener?
yes
yea
do that for command
Idk
bukkit is fine, just static access
yes
Ok now errors
at this point just ask elgar to write the plugin for you
No im learning
In all you are creatign a single instance of your InvestigateCommand class and registerign it as a Listener and the executor for three commands
youre wasting his time
any errors/warnings?
So I’m now setting it as an Executor and as an event
Yes
and his own
mind sharing what errors you have?
Yes
No, at least he has a investigation plugin :p
double check your brackets
do you find it a bit weird that you open one bracket and close two
does your InvestigateCommand class implement Listener?
because java sure does find it very weird
so weird in fact it won't compile
implements CommandExecutor, Listener
line 40, 41 and 42, delete teh last bracket )
PluginManager#registerEvents takes 2 parameters, a Listener and a Plugin 😜
^
So (command, this)?
lmao
np
as long as you know how to do it in the future its fine xD
hello, I create a block with custom name, some persistant data but when I place it and I pick it I lose all the data 😦 , how can I make sure I don't lose the data ?
If I want a subcommand eg:
/test reload
/test reset
They are coded in different classes, how should I register them?
PDC does not transfer from an ItemStack to a Block
and for attributes ?
what attributes? Blocks have none
Same command
a sub command is just an argument
you have have noticed that the constructor of a command has 4 inputs
my item has the attribute GENERIC_MAX_HEALTH
What item and what block?
it's a end stone block
ok
Ahh, so then in the plugin.yml I have to make a subcommand for it instead of a new command?
commands:
test:
description: Test reload
usage: /test reload
permission: test.reload
subcommands:
test-reset:
description: Reset Test
usage: /test reset
permission: test.reset
so, do I just register the main command?
subcommands dont actually exist anywhere but in your code they arent a thing in spigot
yea
lets say you have the command
/gamemode
survival
creative etc
they are just arguments
I wrote that directly on discord without checking mb 💀
dont worry
if you want "subcommands" to show up in tab you will need to make that yourself
Arguments are your sub commands
using a tabcompleter class
you can tab complete in ur main command class
Args[0] is your command, like /gamemode
no
thats not true
args[0] is the first argument
yes
I get it, I'll do some testing and let you guys know if I face issues!
What are u trying to do?
red is the command green the arguments
sure
remember that lists in java start at 0
so the first argument is 0 :)
and the second is 1
and so on
yes 😄 I learned basic java so yeh
nice!
hello any idea about this issue
https://pastebin.com/t40vsM2L
my code is this
https://pastebin.com/ndQRpY1F
are you using a mod api with spigot
why is getStorage() using NMS? Wrong import by chance?
yes
yes im using arclight and im planning to call infomation of cobblemon mod and use on plugin
?whereami
Im still not into this change with mojangs component system but do you guys think, the enchantment change will bring breaking changes like registration or maybe enhancements (thinking about custom enchantments adding a lore by default finally)?
this is abandon project plugin for spigot use in cobblemon and the developer dont have the raw source but the dev have some info give for that and when i use i got that error
just decompile it lmao
yes i decompile it and thats how i got the source and i get that error
well youre in the wrong place
we are the spigot server
and we dont provide support for any weird fork
?fork
SpigotMC maintains the Spigot server. If you are using a fork of Spigot (such as Paper, Airplane, Purpur, or other derivative works), you should seek support in the appropriate Discord servers.
Try going to the right discord server
IF you setup nms in your plugin it may not error but thats about all you can try
?nms
How can I get a LivingEntity to use the item in it's main hand? For example, use a goat horn they are holding
Then you are wild as fuck
Components reduced my nms lines by 3 fold for anything item related. So much more concise and sensible system
nice new pfp
Hi I'm Kazuma
hi kazuma
Okay I didnt expect to hear that, might need to get a bit more informed about that. Thanks for your opinion tho
actually plz tell me about it
i still don't understand the difference between components and nbt per se. to me they just replaced { with [ and added some new properties like stack size
1.20.4
@NotNull
@Override
public ItemStack setItemLore(@NotNull ItemStack item, @NotNull List<BaseComponent> lore) {
final CraftItemStack craftItem = ensureCraftItemStack(item);
final net.minecraft.world.item.ItemStack nmsItem = getItemStackHandle(craftItem);
final CompoundTag tag = nmsItem.getTag() == null ? new CompoundTag() : nmsItem.getTag();
if (!tag.contains(net.minecraft.world.item.ItemStack.TAG_DISPLAY)) {
tag.put(net.minecraft.world.item.ItemStack.TAG_DISPLAY, new CompoundTag());
}
final CompoundTag displayTag = tag.getCompound(net.minecraft.world.item.ItemStack.TAG_DISPLAY);
ListTag loreTag = new ListTag();
for (int i = 0; i < lore.size(); i++) {
loreTag.add(i, StringTag.valueOf(ComponentUtils.toJsonString(lore.get(i))));
}
displayTag.put(net.minecraft.world.item.ItemStack.TAG_LORE, loreTag);
return CraftItemStack.asBukkitCopy(nmsItem);
}
1.20.6
@NotNull
@Override
public ItemStack setItemLore(@NotNull ItemStack item, @NotNull List<BaseComponent> lore) {
final CraftItemStack craftItem = ensureCraftItemStack(item);
final net.minecraft.world.item.ItemStack nmsItem = getItemStackHandle(craftItem);
nmsItem.set(DataComponents.LORE, new ItemLore(lore.stream().map(ComponentUtils::toMinecraftChat).collect(Collectors.toList())));
return CraftItemStack.asBukkitCopy(nmsItem);
}```
Hey, so turns out the reset command works well but the reload one does not work at all.
I think the issue is with the plugin.yml. Can you give me a example on how it would look like?
I see. What I don't understand is the reason for renaming NBT to components. They could've just done the changes to NBT lol
Components != NBT
its built upon NBT
somewhat
I'm starting to get it probably lol
its a worth while abstraction
Will need to work with it myself to see the changes better
I will probably need to do some component parsing from string in my plugin
Is that easy?
Im not that into nms but is it basically manipulating the lore?
components absolutely wipe the NBT
Surely there's some built in
From the syntax that's used in commands like /give
🤷♂️ probably about as easy as NBT
the plugin yml should look just like its a normal command
No idea, haven't done it with nbt lol
it should not contain any info about the arguments
Well I guess I'l see
cuz Ive been thinking about maybe moving my lore systems to some packet based system so I could add multi-language support as well as be able to dynamically change enchantment names etc but Idk if this is a good idea, especially with components
commands:
test:
description: Test command
usage: /keyallx <reload | reset>
permission: OP
Do you mean like this?
sure this works
usage is ofc a exception
u can put anything there
as it doesnt effect the command at all
How can I override the callEvent implementation the CraftServer calls to?
since it's in SimplePluginManager, which is a final class
and creating a new class with that implementation change disallows overriding the Field, as the vm sees it as a different class
The reload still does not show up for some reason
wdum does not show up
show me ur command class
okay! wait a sec
its an argument where would it show up xd
what are you doing now lol 😭
you've been doing so much code hijacking md_5 might be on a hunt for you
why did u want the cat btw
it looks cute
they all do thats why i have the catbase
this is me
actually my gf send it to me lol
well shit
xd
well I tried to simulate the login packets by directly copying what the server sends the player originally, by creating a dumy user and storing the packets the server sends
but the client just disconnects
refuses to join
no idea why
you terrify me
you mean the tab completion?
good
yess!
oh wait I think I found out
so, after wasting 40 hours of my life
omg
are you registering the tab completor?
Magmaguy was messing around with logging in a fake user a while back
I'll have to probably scrape this idea
Yes I am!
cuz no idea what could be wrong, I read the contents
So did you find the issue now or not xd
and it seems just fine
im confused
who's that
I am checking if this works istg
and what did he do by that
he's got some stupid name here now / somethign junk
look in users, he's a donor
^.^
@torn shuttle
yep
he started a few years ago, but if I remember right he was messing with logging in a fake player using packets
YES
THAT'S WHAT I NEED
wait no
logging in a real player using fake packets
that's what I need
wtf does that even mean
well it would probably work the same, other than the encryption part
but this could also help
like normally you join the server and the server sends you the correct packets, otherwise the user disconnects
and here I'm hijacking the function that sends those packets
and using my own, fake ones
but
this mfo still disconnects
and so I passed a dummy player and a dummy network manager
and instead of sending, the network manager stores the packets
translates them into PacketEvents' packets so I can change a bit
and then invokes the removal of that dummy player
and I send those exact packets
but the mfo still disconnects
idk im being stupid rn
set -> set
is there a javadocs for this somewhere out there
the first is the input, the second is the output
ok basically right i kinda wanna do this as an input for something?
f.apply
claim(boat ->
boat.name = "test"
boat.claimed = "real"
)
kotlin?
claim(boat -> {
boat.name = "test";
boat.claimed = "real";
return boat;
});
no
i dont know my brain hurts and ive been up for too long lately
Yo, im messing around with resource packs, is there any way to embed a resource pack inside a .jar, or do I have to download it from the interwebs?
You can embed it in your jar
and then in the claim function i would retreive the data how?
as long as you also embed a web server
but you have to host it
so unless you do dumb stupid stuff, you have to upload it to the webs
thats dum
:/
you can host a webserver on your server
Yes, I know, I was just wondering if you can embed a folder inside a jar, and then send it via packets or something to the player
basically what you want is self hosting a webserver inside the plugin
cannot
no need
btw, could you make a dynamic server like that?
nah, my ideal solution would just be to load the texture pack server side, then send it all through packets.
But I guess internally it just sends a packet with a URL in it which the client downloads
yes
if thats the case, ig uploading it to dropbox or mediafire or whatever is fine
Otherwise I have to worry about firewall ports and other stuff which sounds like more of a pain
Yeah you can run an internal server but you need to open a second port for it
i have a project just for U 
coll does too
(disclaimer its mine)
imagine manually writing the manifest
i do a lot from scratch smh
Hello! I need to remove particles after a few seconds. All works great but if my particles caught into water or vine it just keeps and don't remove
don;t add your projectile to a task list. mark the projectile with a PDC tag and detect it on hit
Yeah, which kinda just feels like it would cause more problems than it would solve
especially if its a public plugin, since I dont know if something else is running on that port, if the firewall is configured for it ect
thanks i'll try
oh I see you are running a task on every projectile, then cancelling it 10 ticks after it hits
That's why you let them confiure it?
you need to also stop your runnable
as its a taskTimer
currently every projectile that hits leaves a new runnable ticking
so how do I stop certain events from being invoked?
You don't
you can't stop it but you could consume the packet
Nope, ignore me, was a silly idea
instantly or after a few seconds?
not sending keep alives?
it acknowedges that join_game is correct
keep alives are AFTER
this is complete
also, they're not instant
k
also this is when I do a server start
but after a reload
wait, are server classes not reloaded?
during a reload
why would they? its not a class loader reload for the game
damn, that's why
I'm also curious why the client sends a custom payload
and the server responds (originally)
brand etc is sent in a PMC packet so that would be a custom payload
it is
there ya go
this is the server join sequence
Never knew the client got informed of the server's brand
Hey, so i'm trying to sout that Stringlist but it is returning empty, why is that happening?
ConfigurationSection s = data.getConfig().getConfigurationSection("islands");
for (String keys : s.getKeys(false)) {
ConfigurationSection section = s.getConfigurationSection(keys);
System.out.println(s.getStringList("members"));```
you do nothing with section
how I can create an Item entity from an ItemStack ?
World#dropItem
is that all there is?
no
you can construct it yourself using this source code
ok
Is there a way to make an Allay fly to an entity, just like they do normally when picking up items?
#setTarget and #setMemory don't work and I can't find anything on google
I'd assume you also have to put an item in its inventory
What can i use instead of PersistentDataContainer?
in older versions use an NBT api
without any api
nothing
I need create own class?
there was a lightlimbo project on github doing it
Hello, how can apply a glow effect on a player with a custom color?
I found 2 limbo server implementations
Before
And uh
I might just be doing something wrong but the client still just disconnected
Is this code create new object if map has same uuid
protected static final Map<UUID, FastPlayer> FAST_PLAYER_MAP = new HashMap<>();
public static FastPlayer getFastPlayer(UUID uuid) {
return FAST_PLAYER_MAP.computeIfAbsent(uuid, uuids -> new FastPlayer(uuids, false, "", ""));
}
yea but its a bit goofy that u have it static (singletoned?)
Not really
Yes really
Hello, can anyone tell me why does my scheduler does not cancel a task when I cancel it.
Here is the code https://paste.md-5.net/huximoyusi.java
Start timer is called before stop timer, exactly once?
yes
static because only one map for Players
Wdym "singletoned"?
It's a normal Map
And static access is convenient
Hello, how can apply a glow effect on a player with a custom color?
Scoreboard teams
player.addPotionEffect(new PotionEffect(PotionEffectType.GLOWING, Integer.MAX_VALUE, 1, false, false));
player.setGlowing(true);
player.setGlowingColor(glowColor);
This should work!
Okay thanks, I'll try that later 👍
Remember to set glowColor
There is no setGlowingColor for Player as far as the docs tell
Hmm
How can I do it with scoreboards?
You set a team color
HashMap<Player, Team> tempTeams = new HashMap<>();
public void glowColor(Player player, ChatColor color) {
assert Bukkit.getScoreboardManager() != null;
Scoreboard scoreboard = Bukkit.getScoreboardManager().getMainScoreboard();
Team team = scoreboard.registerNewTeam("temp-color-team-" + UUID.randomUUID());
team.setColor(color);
team.addEntry(player.getDisplayName());
tempTeams.put(player, team);
player.addPotionEffect(new PotionEffect(PotionEffectType.GLOWING, Integer.MAX_VALUE, 0));
}
public void stopGlowing(Player player) {
player.removePotionEffect(PotionEffectType.GLOWING);
tempTeams.get(player).unregister();
tempTeams.remove(player);
}
"Borrowed" from this thread: https://www.spigotmc.org/threads/how-to-make-a-player-glow-a-color.621213/
Okay perfect thanks, I'm on phone so I didn't search on Google yet, but you did it for me sooo, thanks ! 😄
Impossible to find the specified file track. Here’s the code for HomeFiles: https://paste.md-5.net/abixopazex.cpp
I get it every time I /sethome
conclube ur gonna hate me when you look in verified
No it hinders modulization, it fucks up testability and reusability, it often causes leaky abstractions and if you at any point migrate said module code to work in a multithreaded environment you may fuck up publication and consumption of mem visibility, as well as thread safety, partly why SimpleDateFormat is objectively annoying to touch. You also weaken the expressiveness of your type system infrastructure.
Yes there are places where stateful static behavior makes sense
but often if you come across a static mutable map, its bad design
often as in 97% of times
anyone have a suggestion on how I add a stay function with a updating scoreboard title? ie. I want it to stay on one text for a certain amount of ticks and then continue to the next index in the List
bc i rememberede about it and thought it woul dbe funny
also the fact you didnt like it before
probably using a tasktimer
finally developers are getting the respect they are definitely owed
nuh uh
once in a bluemoon
physically or u mean like code wise?
lol alr
whoever invented squats must surely be burning in squatting hell right now
do you not want fat ass
at this point I am working backwards, my quads are getting so big I can't use a whole category of pants anymore
I forget what the site is called for thinning a project's github repository via the same github
I think it started with an 'i' or something like 'ilj'.
what
reposilite? jitpack? repsy?
yes jitpack
what happened here
Hello, how can I translate a md5 ChatColor to bukkit ChatColor? Does it works with custom colors?
And how can I put a custom color using hexadecimal in md5 ChatColor?
bukkit chat color does not afaik (support RBG)
but I can translate md5 Color to bukkit Color?
Well not without loss of information
https://javadoc.io/static/net.md-5/bungeecord-chat/1.20-R0.2/net/md_5/bungee/api/ChatColor.html#of-java.awt.Color- this is the method to create a chat color from RGB
okay thanks
so let's translate hex to rgb
😎
I can't click 😭
how can I translate md5 color to bukkit Color then?
Hello! I have made a sqlite database which stores info about player's choosen effect. Player need to choose effect in GUI and then it will be stored in database. All works great but I have problems with database. Can someone help please: https://paste.md-5.net/obifofacit.cs
All works great but sometimes plugin sends null errors in console after a long usage
simplest I found https://gist.github.com/Vexentric/1a2a565377a0970951172a39283dad53
okay thanks
Hello, how can I change the color of the player's name when he send a message in chat?
Edit the chat format
eyo
how can I edit the chat format ?
can i toggle glow for players? so they dont see glow
im guessing i have to listen for packets
You can do so in asyncplayerchatevent
Event set format
okay thanks
If you want to change the name eveywhere you can set custom name
okay 👍
Are u using /reload command
ok thanks
maybe that was really problem
cause that error happened only today after i started reloading plugin
using plugman I bet
yeah)
plugman is bad with statics
What
makes data application bound rather than session
what are you gonna do, make everything static?
yes
you can be happy you haven't seen any of my projects
Hello, why event.getFormat returns me that?
placeholders, one is for name one for message, dont ask me the format though
probably positional arg and representation
hmmm
That Map was final
It's not unmodifiable
But I don't directly see what's exactly wrong with that
Hi everyone.
Why can I compile my plugin in JDK 8 with Spigot 1.20.3, but not with Spigot 1.20.4?
Has Spigot 1.20.4 dropped support for JDK 8?
To be clear: I'm using JDK 8 for compatibility reasons, as I'm developing a plugin compatible with a range of Minecraft versions
spigot 1.20.4 api is compiled to java 17
what about spigot 1.20.3?
that one still compiles to java 8
ohh
Remind them that the new version requires higher java version, done.
its a normal HashMap
its susceptible to mutations
unlike Collections.unmodifableMap or ImmutableMap::copyOf/of
Map::copyOf/of
does anyone know how can i transform this query from sqlite to duckdb ?
SELECT MAX(LENGTH(artist.name)), ar.name, artist.name
FROM artist
inner join area ar on ar.id = artist.area
group by ar.name
order by ar.name
this query in sqlite gives expected output (picture 1) while in duck db i also have to add artist.name into group by clause which later on makes query result unexpected (picture 2). Anyone knows solution ?
duckdb?
Does Bukkit.getPlayerExact() return offline players, too?
Is the return type OfflinePlayer?
No, its Player
That's your answer
Then there you have the answer
The heck is duckdb
idk, looks like sqlserver like database which i have to use at internship
DuckDB is designed to support analytical query workloads, also known as online analytical processing (OLAP). These workloads are characterized by complex, relatively long-running queries that process significant portions of the stored dataset
thing is i have to add everything from select into group by clause, and that fuck up results
I can't find the maven for md5 repository that contains libsdisguise dependency
The home of Spigot a high performance, no lag customized CraftBukkit Minecraft server API, and BungeeCord, the cloud server proxy.
is it possible to make text displays FIXED and 2 sided?
ik i can make 2 text displays but who has enough time for that 😴
Could not find artifact org.spigotmc
pom:1.16.1-R0.1-SNAPSHOT in minebench-repo (https://repo.minebench.de/)
?paste your pom
unmodifiableMap is subject to mutations
It’s just an unmodifiable view of a map, not an immutable map
Map.copyOf != Collections.unmodifiableMap
that's not the full stacktrace
what's DatabaseExecutor line 93?
with mysql no errors occur, but with sqlite yes
connection or commadn ull?
looks like you can't print out "unprepared" prepared statements in sqlite or sth?
what is sth
or something
like, what I said was just a wild guess
try to not print out the statement before you filled in the ? values
I didn't underst
and what you meant by that
That's not the problem, look here
with mysql i not have problems
yeah but apparently sqlite does not support that
it seems like sqlite requires you to fill in the prepared statement values before you can print it out
while mysql just uses ** NOT SPECIFIED ** when toStringing() the statement
but before I didn't even print it and it caused the problem
I only printed it because it was having problems
well idk what you did before, I can only tell you what the problem is from the code you sent
Before it was like this, I'll run the code then
and it will give an error on line 93
check the state of your connection
"it seems like sqlite requires you to fill in the prepared statement values before you can print it out"
isClosed()?
and what even is line 93 again lol
if you send code screenshots, please include the line numbers
isclosed returns true, ok
then you can;t sysout a closed connection
but I don't understand why it's closed
are you using hikari or sth?
check hikari out. it'll manage connections for you, both for mysql, sqlite, and more. your connetion is maybe closed because you created it within a try-with-resources ealier (wild guess, haven't really looked at the code) since I gtg now
uhh
how do i fix that if theres 2 text displays inside of each other
sqlite has it in spigot, I don't know why this happens
actually this is just happening without even 2 inside of each other
Which hikari version are you using?
did you set any other options for the hikariconfig? for sqlite I really only give it the jdbc string and nothing else , works fine for me
idk, maybe try the absolute path of the db file name - other than that, I also got no ideas - except that, as I said, I do not set any other config options for sqlite, only for mysql
another difference is that I create a HikariConfig and use that to create the datasource, instead of creating the DataSource directly - maybe that automatically handles getting the correct driver?
try to create your HikariDataSource using a HikariConfig object, then set the jdbc url directly in the config object, then pass that config to create the DataSource
no idea if that helps but maybe it does
i will try
anyone?
then sorry, no idea
1.8.8 most likely doesnt have the sqlite driver
if it does its not loaded load it with Class.forName
normally hikari should handle that itself, at least version 4.0.3 does that for me
well they're using 1.8.8 so I guess they kinda rely on java 8 🥲
if i have this line, the error is different
well as said, sqlite doesn't support stuff like connection timeout etc
I don't depend on Java8. a plugin that doesn't work without java8 which is fawe
simply set the jdbc string (and load the driver, no clue why it's required for you, it works fine without that line for me) but all the other options are kinda pointless (and apparently unsupported for hikari + sqlite)
also you're still directly creating the DataSource instead of using HikariConfig
??
But I already did that and it didn't solve the problem
I simply use this to create a HikariConfig: https://github.com/SpigotBasics/basics/blob/main/core/src/main/kotlin/com/github/spigotbasics/core/storage/backends/HikariConfigFactory.kt
and then I pass that HikariConfig into the HikariDataSource constructor https://github.com/SpigotBasics/basics/blob/main/core/src/main/kotlin/com/github/spigotbasics/core/storage/backends/SQLiteBackend.kt
i already make this
HikariConfig conf = new HikariConfig();
conf.setJdbcUrl("jdbc:sqlite:absolute_path_to_database.db");
HikariDataSource source = new HikariDataSource(conf);
(or sth like that)
What happens if you ONLY do this and nothing else? Still erroring out?
directly use source.setJdbcUrl is fine
yes, still erroring out
apparently that requires manually loading the driver, while using HikariConfig does not require that though
can't be, your log still complains about you trying to set a connection timeout
so you're still trying to add some mysql-only options to your hikari config / datasource
like this?
yep
if that still doesn't work: idk. the following is my whole code for both mysql + sqlite + other backends and it's working fine me, so no clue what your issue is coming from :/
Do you use spigot 1.8?
It could be a problem with the sqlite driver that comes with spigot 1.8
yea, would be my guess regarding the abstract method exception
in which case, bundle your own one
third ??
do I import sqlite myself?
ok
yeah add the latest compatible sqlite driver to your pom with scope compile (you'll also need the maven-shade-plugin)
or on gradle, shadow plugin + implementation scope for the sqlite driver
yeah looks good. no idea if that uses a different driver class name though, you'll have to check their docs
this is what spigot 1.20.4 includes
1.8.8 doesn't seem to include ANY sqlite driver, at least from my quick glance at their ancient pom
It does
gives error like this. Now I'll see loading the class
hm I didnt find it in spigot's nor craftbukkit's 1.8.8 pom
huh weird. I only checking in IJ
isn't the correct class name org.sqlite.JDBC instead of org.sqlite.jdbc4?
yes yes you are correct.
guess I didnt find it because Ctrl+B into the pom from another project's pom probably shows the dependency-reduced pom or sth
idk ¯_(ツ)_/¯
but it includes, because I use class.forname and the exception is not called
im too 😂
Im just gonna say this is too old of an adapter for hikaricp
yep
?paste
but didnt they shade the newest one like 10 minutes ago?
I didn't see that
okay just for fun:
try this
try {
Class.forName("org.sqlite.JDBC");
HikariConfig config = new HikariConfig();
config.setJdbcUrl("jdbc:sqlite:" + DatabasePlugin.INSTANCE.getDataFolder() + File.separator + fileName);
config.setConnectionTestQuery("SELECT 1"); // Add this line
hikari = new HikariDataSource(config);
} catch (ClassNotFoundException e) {
throw new RuntimeException(e);
}
to construct your hikari instance
if that works, the issue highly is that you either didnt properly shade the latest adapter, or something like that - idk
not really
when a class is queried for, a class loader will first reach to its parent class loader before itself
Yeah whatever - just wanted to say: if my above snippet works, the issue is that the outdated sqlite thingy was used
In that case, relocate your shaded driver and use that. Or live with the workaround and use thw outdated one
fixed
Great!
except that sqlite is not relocation friendly because it uses jni :p
but I'm supposedly using the updated one
Oh that sucks then. Then @sleek estuary use my workaround with „SELECT 1“ and live with the outdated sqlite jdbc 🥲
YEP
what is jni?
Native shit
of sqlite?
And what does it mean
According to Emily, i dont know myself, it means you cant shade or relocate a newer sqlite jdbc
pretty sure you can't relocate sqlite due to natives
yeah
Solution: dont use 1.8.8, use 1.21 or 1.20.4
I can't allocate sqlite in the plugin because spigot has already allocated it?
correct
this plugin not for me
Why do you need a newer sqlite jdbc?
ok, I will use the mfnalex alternative. Thank you both for your help
Np!
it was just to solve the problem. Nothing else. But it's always good to have things up to date.
can someone explain how to get the lore of an item because all the ways ive tried just dont work
check first if item is null

