#help-development
1 messages · Page 322 of 1
i dont like oop
Agree
Easiest solution for oop haters
If you wont learn Java basics and most useful things you musnt be programming on Java, take another lang
💀 🤣
Dont wondering to be gross nor rude, its just an opinion from someone who had a really bad past cuz he didnt learnt Java how he should and now he have lot of problems while coding
So if you wont effort on learning proper the lang, this is not the way for going. Just leave programming for devs who love what they do and do it because they like it
.... so update on why now our dev team be stressing the hell out. This entire manipulator uses the old Java Edition Alpha level format
bro that doesn't even look good 😭
Check my fork i fixed it
Easiest solution, World Edit 💀 💀 but you will have to use it really proper if not your TPS will be down all time
did I miss you mentioning this at first?
Editing out every single item of a type from a game world is something world edit just aint up to chief haha
What?
I thought you were looking for an api for working over regions
🤦♂️
Never used forks before, how do I add this via gradle?
?
you build it to maven local then dep on that, or build it and mvn install it from build folder
'getByName(java.lang.String)' is deprecated what should I use instead
on what
on spigot???
Enchantment enchant = Enchantment.getByName(args[4].toUpperCase());
bro whythe fuck would he need the class
Enchantment.getByKey(NamespacedKey.minecraft(args[4]))
how else am i gonna know what method you mean is deprecated
Because no one knows what the fuck getByName is from?
Bukkit has like a couple hundred classes ;p
there definitely more than one method with that name
d o u m e a n m e t h o d
no
yes
and that's what i needed
bro this is the most aggressive question asker I’ve seen in a long time
literally has no patience
https://hub.spigotmc.org/javadocs/spigot/org/bukkit/GameRule.html#getByName(java.lang.String) for instance is not deprecated ;p
who wants to do it
it is inspigot
Knowing it was from Enchantment lets us give you an alternative, which in this case is getByKey()
alr
how would I fix this then since it kind of relies on that
if (args.length >= 5) {
Enchantment enchant = Enchantment.getByName(args[4].toUpperCase());
if (enchant == null) {
player.sendMessage("Invalid enchantment.");
return true;
}
int level = Integer.parseInt(args[5]);
giveItem.addUnsafeEnchantment(enchant, level);
}```
That's all they were asking. We know it's under the Spigot API, but knowing which class holds the method that is deprecated helps us give a proper replacement
and that will give it to you
youll still get the enchant..
do you know Java, or how to read a javadoc, or how to ask a question 😔
I'd argue NamespacedKey.fromString(args[4]) is a bit of a better option given that this is (presumably) user input from a command, but yeah
?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.
You still have to assign it to a variable
Choco you are too patient
or simply we are all not patient
I was just going to say lol
why were you going to say "lol"?
Man that patience is running thin though 
he was just going to say he is too paitence
that isnt english
is it too patient
it is english
sorry
NamespacedKey key = NamespacedKey.fromString(args[4]);
if (key == null) {
sender.sendMessage("Invalid key: " + args[4]);
return true;
}
Enchantment enchant = Enchantment.getByKey(key);
if (enchant == null) {
sender.sendMessage("Unknown enchantment with key " + key);
return true;
}```
fuck me
This will be your replacement
ah ty
no ty
wtf epic
(NamespacedKey#fromString() just allows user input to be either minecraft:sharpness or just sharpness)
I was correct it’s patient
patience is something else
some gaslighting me
like you have patience
but you are patient
they aren't
you can’t say I am patience
but I can say you have patience
this is too much for my brain
That's why you say you are patient
im going to find food
you already know where it is though
you're just going to the food
no
find and going aren't the same thing
mate did you take a class on how to be annoying
yes
no you're rediscovering what food you have since you've already seen the food you've just forgot what it was
i havent
yes you have
okay so
bro is trying to gaslight you into thinking you bought and put away the food
also it's "haven't"
you've already done that once
yeah
damn bro is still readying my messages after he blocked me
what isn't
this entire damn convo
you
sorry a sentence needs to have more than just a subject
yes as in "you have patience" and "you've very patient"
well obviously
yes
who knows the difference between bow bow and bow (:
i learned that in like 2nd grade
Bow is to bend your waist in response to another entity
bow is an item that archers use to shoot arrows
wrong bow
you should've been able to read my mind and see what order I wanted it in
Bow is a thing that goes on your shirt, like a bowtie
well no you just didn’t graduate second grade yet
?paste
but an adjective???
I've created an abomination
I see
also putting all of those into one file made the file reduce 20kb so now it's just 13kb
i am still very proud of this command
how can i store an ItemStack in a sql file
One way to store an ItemStack in a SQL file is to use a plugin like PersistenceAPI or H2Conomy, which allow you to save ItemStack objects in a database. You can also manually convert the ItemStack to a serialized string using Bukkit's BukkitSerialization, and then store that string in the SQL file. When you need to retrieve the ItemStack, you can then deserialize the string back into an ItemStack using the same method.
which one would you choose
serialize
alright thank you
This looks like a ChatGPT answer
Basically create a new ByteArrayOutputStream and wrap it around that BukkitObjectOutputStream, get the result as an array of bytes
What version of gradle u using bro? This thing still using id maven in teh gradle builder :S
the fuck does that say
var stream = new ByteArrayOutputStream();
var bukkitStream = new BukkitObjectOutputStream(stream);
bukkitStream.write(itemStack);
byte[] bytes = stream.toByteArray();```
Use jitpack
And import with maven
Im both tired and dense what does this even mean?
or build normally then mvn install
one second
what plugin did you fork @humble tulip
you forked gradle?
I need some recomendations for my CommandParser class which extends BukkitCommand, that class manage the command and sub command parsing. My issue is the next, im overriding the execute(CommandSender sender, String alias, String[] args) from its super.
So when args lenght is 0 im treating it as normal command
When args lenght are more than 1 i parse it as a sub command
But what happens? Well pretty much obviously normal command, can have arguments, so when i have a simple command like "/msg <player> <text>", the parser treats it as a sub command because of the lenght. That is not expected tho
I was thinking the exact same thing lol
as for Verano
the solution is to treat it all as arguments, with sub commands being a literal argument that can only be a single value: the sub command. Or to use an actual command framework like CLOUD or ACF instead of once again reinventing the wheel
reinventing the wheel is not conducive to efficiency xd
itzd i know but acf for me its completly shit, anottations, weight, etc
then take a look at CLOUD
But listen to me please
What?
yes what
So whats the beef with this one? :S
mate I was literally going to help you, the no was sarcasm
but ain’t no way I’m staying in the convo with the thing u deleted and that latest message
hi i kinda need help how to get some old versions of minecraft after a year
the answer was actually already given to you
have commands be commands and sub commands be arguments
I mean dont play with me i dont like those play while im working
looks like its a gradle plugin, so you would need to use gradle to use it
Sorry man, my fault
to match a command you simply continue to attempt matching the possible arguments
so if you have the attempts /heal <player> 20 and you want the sub command /heal full <player>
I am using gradle, issue is the gradle builder they've set up is for an older version of gradle
you had a structure like [PlayerArgunent, IntegerArg] or [LiteralAegumenr(“full”), PlayerArgumenr]
once an argument fails to match, you try the next tree
at least your algorithm can be similar to that
that’s how CLOUD works, at least
So just for record you sent me and my team down a rabbit hole with this one chief "it'll take like 4 hours". 2 days later and a depreciated id for the builder, having to use gradle and now having to utilise and learn bloody jitpack too xD
Im not mad, not got the luxury of time for that but jesus what did I do to deserve this lmao
No
That's the import lol
how the hell are bedrock servers like cubecraft developing features
cause ik damn well they arent using addons
trying to look into creating stuff for bedrock and other sources arent giving me the answers i want\
You could've asked for help in those 2 days
I'd sent one of my team members to go do the majority of the leg work and they only realised the old region file issue tonight.
Im just doing the next:
SimpleCommand (will allow you to create single commands with/without arguments)
SimpleExecutor (extends SimpleCommand, will allow you to create executors for registering arguments (extending SimpleCommand) or sub commands (by extending SimpleExecutor)) and override the super method execute()
none of which is simple btw but alright
It's that the old format stored the data in a level tag but the new format saves it on the base compound
So what do you suggest?
ehm give me an example of what your framework looks like in the end
oh ok
An example - https://paste.md-5.net/sufemujeto.java
iim aware right so now im getting an unexpected token error trying to add this to my gradle fml xD
url = uri("url")
@compact haven so what i had earlier, BaseHandler would that be BaseProcessorImpl? so to say my brain did its thing and realised i was doing the completely wrong this
so im just trying the stuff you sent me again lol
and the implimentation?
sorry for the hand holding btw
this has been a stressful day xD
and i still have the damn code to run haha
implementation("stuff")
change the c-a ect to just a9842a668b
Finally
Thank you based based dev you
in a way
but like
there should be no constructor that takes an ItemStack for BaseProcessorImpl
or really a constructor for any of them at all
iirc it was a constructor
maybe it was a method overload for read with an ItemStack
in any case, BaseProcessor and the Impl should only return ItemStack, never intake one
yeah
i just figured that part out
i think im understanding it more?
but im tireder
brain works in mysterious ways
lol
https://paste.md-5.net/tipedamude.java does this look correct at a glance
yep
and it's incredibly embarrasing that I forgot to return Builder in a Builder pattern
yeah i noticed that
dw about it
and am i correct in saying BaseHandler should just handle type and amount
Base
BaseHandler makes no sense. if u want to change it from BaseProcessor name it ItemStackHandler and make it implement Handler while consuming a null ItemStack parameter
BaseItemStackHandler
no
the longest class name
no Base
ill use ItemStackHandler
alright
should i throw illegal arg exception if the types dont exist
the material and amount
uh
been as their required to actually make the stack
yeah I'd say so
mkay
makes my life like 0.5% easier
no need to make custom exceptions
i also need to do a null check i just realised
because materials
and btw if it implements Handler
yeah
I need explanations please, im really confused at this point
The condition will join only if args leght is more than 1 and command is instance of SimpleExecutor, isnt what i code there?
you are checking if it isnt instance of SimpleExecutor
Weird, instanceof doesnt make me confuse a lot
because: commnad instanceof SimpleExecutor its make you think that will return true in case of using command instead of SimpleExecutor type
if you use command instanceof SimpleExecutor simpleExecutor on java 16 or higher that will pass if command is an instance of SimpleExecutor and it gives you a SimpleExecutor instace
Both Class#isInstance() and instanceof are used to check if an object is an instance of a certain class, however, they have some key differences:
Syntax:
instanceof is a keyword in Java that is used in conditional statements to check whether an object is an instance of a particular class or one of its subclasses.
Class#isInstance() is a method that is used to check whether an object is an instance of a particular class or one of its subclasses.
Type Checking:
instanceof is used for type checking at runtime. It returns true if the object is of the specified class or any of its subclasses.
Class#isInstance() also performs type checking at runtime, but it is more flexible, as it can be used to check if an object is an instance of a particular class or any of its subclasses, or implement any of its interfaces.
Null Handling:
instanceof throws a compile-time error if the object is null, while Class#isInstance() returns false if the object is null.
💀
ChatGPT is fkg amazing
make your private variables private private
because it is
i feel like there is a way to pull this out into an interface and handle the cases in their own respective concrete classes no?
like less than one argument ok make this class and if its a sub command create classes for the sub commands
and then just pass in interface
Gh copilot > chat gpt
What happened
md doesnt like the getVanillaName or fromVanillaName
Why?
he just doesnt get it
Send link
What did he say?
if you search for messages in general from md you can probably find it
TL:DR it's kinda useless
sendDemoScreen like
this saves time
It's not really a workaround
It is
That is what the keys are for
No
The keys are only there because thats how mojang does it
They might change any time
They added them to get away from magic values
I doubt they would just yeet them and go back to 1.12
I am for that
yes please do that
I am not
im pretty sure choco has a pr for it somewher
Having a 1:1 connecting between „vanilla enchantment names“ and „internal enchantment names“ doesnt hurt anyone, so why NOT add it?
convincing md that its worth it is our only issue
Same for potion effects btw
?jd-s
wheres the "for me"
true
for me
i too vouch to have a way to easily use "SHARPNESS" instead of DAMAGE_ALL
I mean I still think the key way is easy enough
what the fuck is WATER_WORKER in game???
Aqua affinity
that would still be a pointless method hundreds of people are creating for no reason
bruh
point
fucking
proven
who wants to use water_worker over aqua_affinity
I guess for that one you need to replace space with _ first
So that is a bit more effort
That's a breaking change
Can't do that
we could move it to LEGACY prefixed no?
There is a 1:1 for vanilla names to Bukkit enchantments
It's getByKey()
we could
I'm with md on this and I knew before he even commented that he would disapprove of it because it really doesn't add much
fromVanillaName better imo
If anything it makes things a little more ambiguous because what type of string are you passing in?
NamespacedKey kind of restricts it
or only add to enchantment and keep the former Bukkit names alongside them
String vanilla = "Aqua Affinity"
NamespaceKey key = Namespacekey.minecraft(vanilla.replace(" ", "_"));
Enchantment.getByKey(key);
3 lines, not that bad
a little duplication couldnt hurt anybody 
The proposed methods don't even do that, Coll
Actually you'll want a toLowerCase as well
It's not converting English translations to Enchantment, it's just doing getByKey() without the namespaces
Auto appending the Minecraft namespace. That's all
Yes
There is only one class that does this sort of thing and it's Material#matchMaterial()
So if something like this were to be added, (1) getVanillaName() should be removed because it's useless, and (2) it should match existing nomenclature

I would say scrap what you have currently and mirror what #matchMaterial() does, only #matchEnchantment()
getVanillaName() doesn't need to exist imho
Then maybe do that for all keyed types
matchMaterial matchEnchantment and matchPotionEffectType 
Exactly
Time to steal his PR and do that
my pr will probably be denied so you can probably just do something like "replica of "807 with extra features ect"
can i change name of pr? or would that need new
ill probably do that, when i finish the other stuff ive gotta work on
Yeah you can edit the PR name
I think adding match methods would be something worth merging in
For everything that extends Keyed, ideally
Hey
Send me a region file with the item
Or show me what the item looks like
And I'll write code to do it for u
It's not the one with a c btw
nah im legit nearly there
I just need a loop that gets me every region file in a world
as i keep getting acces is denied
I have code
public static void main(String[] args) throws IOException {
File file = new File("region");
if (!file.isDirectory())
return;
for (File listFile : file.listFiles()) {
Region region = RegionIO.readRegion(listFile);
for (Map.Entry<ChunkPos, Chunk> entry : region.getEntries()) {
NbtList<NbtCompound> list = entry.getValue().getCompound().getCompoundList("block_entities");
for (NbtCompound nbtCompound : list) {
if (!nbtCompound.getKeys().contains("Items"))
continue;
NbtList<NbtCompound> itemList = nbtCompound.getCompoundList("Items");
for (NbtCompound compound : itemList) {
//check items here
}
}
}
}
}
See updated comments on your PR, @remote swallow
RE: @Contract annotations and Validate
Asking md for input before you start any changes though. What I think is mergeable and what md thinks is mergeable may differ
You haven’t seen that one yet?
So far not haha
Look that lmao its explained the error section like infinite times
😂
Okay im definitly dumb
that kotlin or java?
cause ngl we may of wrote in kotlin 0_0
that's java
Kotlin 💀, Scala ❤️
i send you a multithreaded version in java
Have you seen bro im an idiot, i created an infinite loop haha
lmfao
you're passing command to the command.execute
well a stackoverflow will happen tbh
Yeah, that why i get a new exception OflerFlow
yes
I sent the url
Were appear that
That why i first get without words, because the line where the problem was, was sent thousans times
Is it possible to get a block's hardness and make that hardness disappear by 1 each time it is hit with a snowball and the block disappears when that number reaches 0?
Is it possible to make a plugin that can override other plugins onPlayerJoin messages?
I mean, you can just register your listener later on in the chain ?
e.g. priority HIGH or HIGHEST
No
unless that is what the other plugin is already doing
I want first
wat
Like I want to cancel all the messages
From other plugins
Or even better
I want to get all the messages that would be sent, sort them with a plugin and then send them onJoinEvent
Are you talking about the actual join message (e.g. https://hub.spigotmc.org/javadocs/spigot/org/bukkit/event/player/PlayerJoinEvent.html#setJoinMessage(java.lang.String)) or what are you talking about
declaration: package: org.bukkit.event.player, class: PlayerJoinEvent
I mean byte code???????? It'd take Literal years of his life
you'd have to catch the outgoing chat packets
Would be changing the server .jar right?
Oh thays smart PacketEvents
Not even sure if modifying spigot is allowed
I mean, the packet catching only "works" partially tho
you can certainly fork spigot
your plugin should not tho
if you are going to publish it
So technically it could be done
I would 100% not publish a plugin to spigot that edits the server code
By forking spigot, making a custom version which can give access to a plugin
Seems like a dumb amount of work
What the fork
well you are trying to do something that isn't possible rn
Easier to prob just edit the plugins and rebuild them lmao
but not allowed on some
Def not easier than fork
fork is rather simple tbh
well
depends I guess, spigot fork sounds like a hassle
Forking isn;t the issue
The issue is somehow blocking every possible message sent
And then make a plugin that can handle that
Fork spigot
how is that the issue if you can fork 😂
would literally be a single event fired on sendMessage calls
and then your plugin just collecting them
I mean, this obvs only makes sense if it is for your private server and you can fork
Yeah yeah fair
no user is going to download your fork if this is logic for a public plugin
please help me..
?ask
If you have a question, please just ask it. Don't look for staff or topic experts. Don't ask to ask or ask if people are awake or available. Just ask the question to the channel straight out, and wait patiently for a reply. Make sure you use the right channel regarding the topic of your question. Create a thread in case the channel is already in use!
this
Do you know how to solve this problem?
Yes! It is possible
How can I do it?
EntityDamageByEntityEvent -> Detect when player throws a snowball, get the target block from the event
Create a itemstack and get the itemmeta from the target block if it wasn't null
Decrease the hardness, if it reaches 0 replace the block with air or make it drop normally
I believe are the steps
I'll try
@dull magnet I was wrong
Use ProjectileHitEvent
You don't care about who threw, just about the block hit
So what do we do?
Use ProjectileHitEvent
Same thing as I said but with ProjectileHitEvent
ProjectileHitEvent -> Detect when a snowball hits a block. add if so if the hardness is 0 then breaks, decrease the hardness
All right!
If you have any issues send it here I'll be more specific
OK
@dull magnet Just did some testing and it works perfectly, just have in mind the hardness of a block is not 100 as full
Doing some tests, blocks have different hardness
Oak log has 2.0
Dirt block has 0.6
OK
btw you might need to change how you do this
Or just group some block durability and set specific hardness
if you do not mind
Can you send me the code when it fails?
@dull magnet After some more reading you're trying to do something pretty complicated
oh great!
It's not really possible with spigot but instead with the actual minecraft API
I think you have to use something like Reflection but you can wait here maybe the more experienced people have another idea even though I doubt it
thanks!
hi , i have a bit of hard question , its something iam trying to do ..
so i have a quests plugin system ,
how it works server owners can create their own quests from yaml file .
and it does show the quests in the gui , my only problem with the system is the events handling parts :
so for example lets say there are 2 quests with the same event that trigger them :
1- Win 1 game of bedwars
2- Win 5 games of bedwars
the same goes for other type of quests :
- Play 1 game of bedwars
- ... etc
- Break 5 beds ..
..
my problem now its duplicating the values when i win so insted of increasing by 1 , it dupilicate to 2 , 4 , 6 , 8 ..
Stand on block
any ideas maybe on how i can create better event handling for all quests?
that's weird, I've got MHF_ArrowLeft displaying correctly but MHF_ArrowRight does not
sooo
this is not a question any sane person here will help you with, it has everything to do with your own implementation of quests and if you are having issues with implementing multiples of quest objectives then you probably already have a very bad structure for it
how i built it in the first place , there was only specfic quests to edit , and user can't add or remove quests
but i edited the system so it can work with yaml file to load the quests from their .. and it does work the loading part atleast , but the even'ts part to handle it not so much
yeah so it sounds like I was right
probably the one I wrote for my own yaml-based custom quest system which is free and open source and available to be viewed on github right now, or else I probably wouldn't have spent weeks writing it in the first place
can i see ?
only if you promise to stop spamming the same reaction to everything that gets posted
alright i promise haha
https://github.com/MagmaGuy/EliteMobs/tree/master/src/main/java/com/magmaguy/elitemobs/quests just don't look at the dynamic quests from too close, I never got around to fully polishing that up (though it sort of works)
Alright thanks
i already finished 90% of the plugin , its amzingly works , the problem only with the events part
get ready to find out you only actually did 15% of the plugin and the rest needs to be rewritten
i hope not ..
is MHF_ArrowRight broken?
hm seems fine when I give it but not when I assign it as owner of a skull
I coded so that the plugin gives jump boost 4 for 1 second to the player that is standing on the emerald block. Why could this not be working?
@Override
public void onEnable() {
// Plugin startup logic
getServer().getPluginManager().registerEvents(this, this);
}
@Override
public void onDisable() {
// Plugin shutdown logic
}
@EventHandler
public void onPlayerMove(PlayerMoveEvent event) {
if (event.getTo().getBlock().getType() == Material.EMERALD_BLOCK) {
event.getPlayer().addPotionEffect(new PotionEffect(PotionEffectType.JUMP, 20*1, 4, false, false));
}
}
}
that would mean the player is standing in an emerald block
do getRelative(BlockFace.DOWN).getType() == emerald block ig
ew not using vectors
icky
never used them ;-;
well maybe once when copying code from yt for an effects plugin like two years ago
;-;
wow
quite literally the first thing I did in modding used the hell out of vectors, it was my old just cause 3 adaptation of the grapple + parachute mechanic using fishing rods and elytras in mc
worked great too
uh oh
Perfectly Worked. Thank you!
heeheehee https://paste.md-5.net/gukezejeyi.java
wondering where the methodhandles are
i have this TextComponent which is supposed to be a clickable link that i wanna use for event.CancelReason. it just turns out to be a just piece of normal text.
TextComponent link = new TextComponent("click me");
link.setClickEvent(new ClickEvent(ClickEvent.Action.OPEN_URL, "<the link>"));
event.setCancelReason(link);
any sort of hint will be appreciated. thanks in advance
ps. i'm fairly new to java and plugin development
what event is that?
onPreLogin
@EventHandler
public void onPreLogin(PreLoginEvent event) {
// ** **
}
ah bungee?
yes
im sorry i dont have experience with that
i see
I'm looking for ideas on maintaining a good code structure here.
I have a huge Bukkit plugin project, but even though I split it into multiple Maven modules, it's still extremely mentally taxing to maintain.
The main problem is that the main plugin class maintains the reference relationships between modules, and basically any module of the plugin needs to get the other modules/classes it needs from this main class.
This leads to a rather cumbersome project to maintain, as shown in the figure.
Should I use dependency injection, or something similar, in order to minimize the use of the main class?
I'm not sure if dependency injection is necessary for use in the Bukkit plugin ...... or if there is a better solution
its recommended to use dependency injection if you werent already using it yes
does Bukkit already have a solution or example for dependency injection?
?di
Guide to dependency injection: https://www.spigotmc.org/wiki/using-dependency-injection/
thats the most simple thing you can do
thank you very much, I will check it out
werent you already using constructor injection?
You should rework your design, your stuff is way too tightly coupled
just a simple constructor passing and main-class getter
this worked well at begin, but became a problem as it grew faster and larger
And don’t pass the main class for everything, pass the objects you actually need
actually passes an JavaPlugin instance, but yes, no different
well, I think I need a major overhaul for plugin design, thanks for the suggestions guys!
Create interfaces to decouple your code
I have a dedicated maven module to put interfaces, but still ^^
wait are you having modules instead of packages?
is there really a point for doing that?
basiclly, api but also internal use
ah
It took me almost a year to make the API package independent
and created a lot of interfaces, which really made my life a little better.
hi, I wanted to know, how do we make it so that when I enter the nether it sends a msg in the chat I can't find the event
Your interfaces still sound very specific though
worldchangeevent
Thanks !
check if the world type is nether or smth or compare with Bukkit.getWorlds().get(1)
dont do too much of those diagrams before
arguably a bit too premature
like its good for general imagination, but you will eventually at impl stage write things differently, inevitably
and by dependency injection, if you mean one of those frameworks sure
it helps with mapping dependencies a bit
but honestly not such a big deal
else just do it in some factory methods
also
regarding your module system, do you mean you have a cyclic relationship between ur modules?
Maven doesn’t allow cyclic dependencies
I've got the circular dependency out of the way
yes it doesnt but thats the entire point
In fact, I didn't use much of the Maven Module
ye well i dont use maven so idk
I think I've gotten enough advice from there, now I'll go try them out and pick the right one
thanks for everyone
thank me for letting md5 add the 
Does anyone know if ProtocolLib has discord server?
been searching and couldn't find one
as far I know, no
Hoi, I want to seperate a string at all the single .. Issue is my string looks like this:
Items[1].tag.BlockEntityTag.Items[..], note the [..] term.
I tried using the following regex: [\w\]]\. but that matches not only the dots, but also the character before them. Is there a way of doing this without seperating the string with that character before the dot?
I guess I could just change the [..] to something like [§§] and then seperate at all the dots
(?<!.).
(?<!\.)\.
ah fk me, the look behind
Doesn't seem to work. But I think I can figure it out now by myself. Thx for reminding me that lookbehind and lookahead exist :D
Ah yes, regex is fun... \.(?=\w). This finds the first single . and then I split the string there to remove the first key of the str
Someone know where chunk forced load are saved ? in a file inside world fodler or something similar ?
huh?
Do any of you know how to do this in 1.19.2? :/
Or knows a better solution for this?
You could use the open book packet provided that you are using the obfuscation mappings.
@Override
public void openBook(JavaPlugin plugin, Player player, ItemStack book) {
int slot = player.getInventory().getHeldItemSlot();
ItemStack old = player.getInventory().getItem(slot);
player.getInventory().setItem(slot, book);
new BukkitRunnable() {
@Override
public void run() {
ClientboundOpenBookPacket packet = new ClientboundOpenBookPacket(InteractionHand.MAIN_HAND);
((CraftPlayer) player).getHandle().connection.send(packet);
player.getInventory().setItem(slot, old);
}
}.runTaskLater(plugin, 1);
}
is any event fired when an explosion is created via World#createExplosion?
Yes, those are RGB colors in the scoreboard. You can convert them using ChatColor#of() and providing a hex color code. RGB colors are only supported in 1.16+
The common way plugins do this is with a short and simple method.
public static final Pattern HEX_PATTERN = Pattern.compile("#[a-fA-F0-9]{6}");
public static String formatHexColorCodes(String string) {
Matcher matcher = HEX_PATTERN.matcher(string);
while (matcher.find()) {
string = string.replace(matcher.group(), "" + ChatColor.of(matcher.group()));
}
return string;
}
that took long lol
probably also want to do a ChatColor.translate blablabla at the end
Or just pass it in through another method.
public static String colorText(String msg) {
return TextUtils.formatHexColorCodes(ChatColor.translateAlternateColorCodes('&', msg));
}
Your choice though.
How can i check if a block is a LARGE_FERN or a TALL GRASS in legacy because they have the same id and Material name
There's a chance that the EntityExplodeEvent will get fired so long as you provide one in the method. Might be worth testing that out.
thanks i'll try that
I assume I would use the String returned by the formatHexColorCodes method in the team.SetColor method
hi @torn shuttle , could you accept my friend request ? i have further questions ..
Yes, but you might want to pass it through that second method I posted to ensure that other & color codes like &c get translated as well.
I am making a discord stats plugin to show bedwars1058 stats to discord
but stats not working for offline players.
I tried with API & placeholder. none of them works for offline players
thanks a lot i'll try that, see if it works
It seems that team.setColor only accepts org.bukkit.ChatColor and not String or net.md_5.bungee.api.ChatColor as a parameter
so I can't rly set a color
im pretty sure a method Player#openBook(ItemStack) exists
When did that get added?
you'll probably have to use the block state value damage shit
idk but ive used it in 1.19.2
I think that's how it always was
Uhh, not really. There's a reason we have methods like the one I posted earlier. It just didn't exist for a long time. I gotta learn how to navigate the stash. :3
Well, you should still be able to use ChatColor#translateAlternateColorCodes() and pass in the string. It won't do anything to already converted messages, so at least you'll be able to pass something through.
Any API for nametags? Without nametagedit
hi guys, how to control moving Items in Inventory?
does anyone know how to connect to mongodb using mongoimport? I always get sh No address associated with hostname using mongoimport --uri "mongodb://user:pass@cluster0.3oqgtcv.mongodb.net:27017/test?ssl=true&replicaSet=myAtlasRS&authSource=admin" --collection mc_scans --drop --file filtered.json
ChatColor.translateAlternateColorCodes returns a String
So it doesn't work either
Oh, my bad. That unfortunately leaves packets as your only option.
The only way I can think of doing this would be to include the player name in the team prefix and change the color from there
cause that works
But that means a team for each player
np. What do you think about my Idea?
I'm not sure as I haven't really dealt with scoreboard teams a whole lot, but I do think prefixes give you a little more flexibility.
Kk so how to do it fast
ok, thanks for the help tho
Is player change exp called when player's exp decreases like when enchanting or using anvil or dying?
Yes
Nt sure abt dying
But probably
?tryandsee
got it to work with mongoimport --uri "mongodb+srv://user:pass@cluster0.3oqgtcv.mongodb.net/mc_scans?ssl=true&authSource=admin" --collection mc_scans --drop --file filtered.json
is it actually needed to close a resource from JavaPlugin#getResource?
like a yml file
well if its needed i would have gotten in trouble for it by now I would assume
When I wasn't closing resources file IDE couldn't replace plugin file after project build
💀
Iirc it's using auto closeable
I wanna make a prison core and there is alot to do with scaling enchants / levels. So I dont have to predefine level 1 - 2 is 100 tokens then it will scale so like 100 - 101 is 12309133 tokens or whatever. Or scaling enchants so the price is higher each level?
Does anyone have a util or an efficient way to do this?
no it doesnt
u have to close it
just doing it like this lol
If you're specifically loading a configuration file from an input stream, YamlConfiguration#loadConfiguration() closes the stream
Or more accurately, #loadConfiguration(Reader) calls FileConfiguration#load(Reader) which wraps that reader in a BufferedReader and closes it, closing the wrapped reader
So in this case you're fine
oh here it does ye
Hi guys! I would like to change NPC Skins based on which player is looking at them. Is that possible?
If yes, what would be the best way to go about it
it is since npcs are created via packets, but it depends on how you create them
do you use any api?
or raw nms?
raw nms
releasing/closing it removes the file handle on it
hmm i should read about that
can I change gui title without creating new?
so i don`t have inv.setTitle()?
no
(still open to PRs on that by the way)
Is there a built in spigot way to just mute players, or just disable chat entirely?
I tried using an outdated ChatDisable plugin, but any time someone typed, everyone got kicked for chat validation failure
cancel the async chat event
I was looking into it but i have some quesitons
actually lemme do some testing first
and then
I don't know what that is
Is there a way to convert sounds from the client to spigot Sounds?
or a way to know what is what
huh?
That question doesn't make sense
Good afternoon,
Could anyone here point me in the right direction please?
I'm trying to create multiple YAML files for my plugin, but I can't find a single article / forum / post / whatever online that could help :c
Any help would be majorly appreciated.
Thank you,
Seb <3
like mob.horse.leather
to spigot sounds
some inventories aren't renamable(such as beacons)
or PlayerInventory
Still not very clear also makes no sense why you would do that
as in the name doesn't even show on the client. Also for horses, a packet isn't sent to open the inventory when e is clicked
I like the sounds a server used so I made a small script to find what sound they are sending
The home of Spigot a high performance, no lag customized CraftBukkit Minecraft server API, and BungeeCord, the cloud server proxy.
No clue
thanks for the API. So if it detects the chat event (player typing) it just doesn't happen?
you just setCancelled(true) it and nothing will happen
not for dying nor for /exp set
for enchanting: also no
anvil: also no
hey alex
hewwo
then this msg
thoughts?
i first of all gotta wait until my pull request is accepted before I do a new one lol
i wanted to make a pr for it
but do you think there should be a nameable interface for inventory?
I still advocate for the fact that this rename functionality belongs in UnsafeValues
it is horribly hacky
that entire functionality depends on an implementation detail in the client 
not even server
hence; hacky af
yea
flame mojang to fix shit ¯_(ツ)_/¯
mojang has done stuff for server software before
but yea, this is such a niche case
well not really
you don't have to i guess
but I'd rather do that as well most of the time
Does 1.19.3 not having mojang mappings?
every version after 1.17.1 has mojang mappings
it should
Running build tools with the --remapped flag still results in intermediaries
they are releasesd before spigot every version
make sure you followed the steps correctly
?nms
I'm not using maven, but yes special source is set up
uhhh
i didn't know special sources worked without maven
iirc thats been a long standing issue
are you sure you are depending on the correct artefact
Specialsource with gradle has been working just fine so far
Also, the issue is not even with packaging, the jar is not generated with mappings during the build tools run
Any NAMETAG API without nametagedit?
anyone know how I can make bitbucket know that my commits are actually from me / tied to my stash account?
what the heck is a NAMETAG API
nametag api but screamed at you 👍
Prefix, suffix in tab
if i have a class Bootstrap which loads a set of libraries from a Maven repo into a URLClassLoader, how could i load and execute a class Main with those libraries availible
i assume id need a child loader to load the class but just constructing a new abstract ClassLoader and using that doesn't seem to work
you can do that with scoreboard teams
I mean, if your main class is already loaded you are fucked
idk what exactly you are doing with an abstract classloader tbh 😅
Is there any github gists anyone knows for serializing and deserializing itemstacks?
the Main class isnt loaded before Boostrap
Can someone help with relocating kotlin-stdlib in maven, asked on the forums and someone said to ask here
Bootstrap is the actual main class
but its in the same jar ?
current attempted solution:
ClassLoader childLoader = new ClassLoader(parentClassLoader) { };
logger.info("Running ClusterMain.execute(...)");
try {
Class<?> mainClass = Class.forName("net.neonpvp.ClusterMain", true, childLoader);
Method main = mainClass.getMethod("execute", String[].class);
main.invoke(null, (Object) args);
} catch (Exception e) {
e.printStackTrace();
}
what explodes ?
java resolves and loads symbols when it needs them
i know, thanks
parentClassLoader is the url class loader with all the libs presumably loaded, and is parented to ClassLoader.getSystemClassLoader()
Id never voluntarily touch Kotlin without gloves
it's just maven dummy
he just needs to relocate his libs.
oh i cant read gg
?paste
kk
We can see it yes
you are getting fucked because the parent classloader owns the Main class
tf both of these pass
whats the package of stdlib
<project>
...
<build>
...
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>3.4.1</version>
<configuration>
<relocations>
<relocation>
<pattern>kotlin</pattern>
<shadedPattern>your.package.kotlin</shadedPattern>
</relocation>
</relocations>
</configuration>
</plugin>
</plugins>
</build>
@floral furnace
yea
its not even getting loaded by the class loader i specifid
because that loader does not know it ?
the loader cannot find that class its a NOOP classloader
it just forwards the request to the parent
until you hit the AppClassLoader
which knows the class and loads it/takes ownership
ah
hence why you don't do these things with in the same jar 😅
usually you do what like, paperclip does.
shade error Failed to execute goal org.apache.maven.plugins:maven-shade-plugin:3.0.0:shade (default) on project GBOQueue: Error creating shaded jar: null
bootstrap in the class and then unpack the actual application jar
to properly load via URLClassLoader
stacktrace?
what's NitrogenAPI line 21?
@JvmStatic lateinit var jedisPool: JedisPool
are you sure? then where does this "Intrinsics" class come from? o0
i have no clue
huh
i can send u the class if u want
NitrogenAPI is part of your plugin or someone elses?
different kotlin plugin
I have no clue. Does your .jar actually contain this Intrinsics class, in the relocated location?
its mine
I guess the other plugin doesn't have all the kotlin classes
Just looks like you're missing the Kotlin stdlib at runtime
trying to make it so player's can't /dupe when they have nothing in their hand.
code:
player.sendMessage(CC.color("&c&lERROR: &fYou can't dupe AIR!"));
}
player.getInventory().addItem(player.getItemInHand());
if(DupePRO.getInstance().getConfig().getBoolean("send-message")) {
player.sendMessage(String.valueOf(player.getItemInHand()));
player.sendMessage(CC.color(String.valueOf(DupePRO.getInstance().getConfig().getString("dupe-message"))));
}```
error: none this is just what i see
i sent the item stack thing for debuging
ye it does
in the relocated position
but it doesnt realise it ?
You can check if the type of the item in hand is air rather than checking if the item stack is another air item stack
You say it's a different jar that nitrogenapi right?
if (itemStack.getType() == Material.AIR)
kk
well it's the Nitrogen / NitroLib thing throwing the error
In modern versions you can do getMaterial().isAir()
Ofc there you gotta shade your kotlin stuff too
it wasnt before
You were clashing with it though.
it looks like your Nitrogen thing is trying to get the STDLib from your current plugin
but i will try now
in your nitrogen thing, also shade and relocate STDLib
yeye will
and ofc not to the same package that you currently use
uk.rayware.nitrogen.shaded.stdlib
uk.rayware.myotherplugin.shaded.stdlib
etc ...
sth like that
otherwise you'll again have the original problem lol
could also use the libraries feature of the plugin.yml
it's 1.8
lol
org.bukkit.craftbukkit.v1_8_R3.scheduler.
works, thanks guys
Wish that version would die an insufferable death
Been on life support for like 5 years now
true but new combat is too gross
rehashed a million times
let's not, please lol
ye buts thats ur opinion i prefer the old version and there is nothing wrong with that
Wouldn't say nothing XD
The thing wrong with it is that you're intentionally and willfully neglecting tools to make your life easier
Could have fixed your whole problem with just 2 lines in your plugin.yml
But that was post-1.17 or something
except that it's outdated, unsupported, and will never ever receive any updates
oh and the API is shitty and misses thousands of features
What do you mean I cannot set noAI on mobs ???
wait, does that mean I can not send action bar messages without NMS?
org.bukkit.command.CommandException: Unhandled exception executing command 'dupe' in plugin DupePRO v1.0
at org.bukkit.command.PluginCommand.execute(PluginCommand.java:47) ~[paper-api-1.19.2-R0.1-SNAPSHOT.jar:?]
at org.bukkit.command.SimpleCommandMap.dispatch(SimpleCommandMap.java:155) ~[paper-api-1.19.2-R0.1-SNAPSHOT.jar:?]
at org.bukkit.craftbukkit.v1_19_R1.CraftServer.dispatchCommand(CraftServer.java:916) ~[paper-1.19.2.jar:git-Paper-215]
at org.bukkit.craftbukkit.v1_19_R1.command.BukkitCommandWrapper.run(BukkitCommandWrapper.java:64) ~[paper-1.19.2.jar:git-Paper-215]
at com.mojang.brigadier.CommandDispatcher.execute(CommandDispatcher.java:264) ~[paper-1.19.2.jar:?]
at net.minecraft.commands.Commands.performCommand(Commands.java:305) ~[?:?]
at net.minecraft.commands.Commands.performCommand(Commands.java:289) ~[?:?]
at net.minecraft.server.network.ServerGamePacketListenerImpl.performChatCommand(ServerGamePacketListenerImpl.java:2294) ~[?:?]
at net.minecraft.server.network.ServerGamePacketListenerImpl.lambda$handleChatCommand$20(ServerGamePacketListenerImpl.java:2248) ~[?:?]
at net.minecraft.util.thread.BlockableEventLoop.lambda$submitAsync$0(BlockableEventLoop.java:59) ~[?:?]
at java.util.concurrent.CompletableFuture$AsyncSupply.run(CompletableFuture.java:1768) ~[?:?]
at net.minecraft.server.TickTask.run(TickTask.java:18) ~[paper-1.19.2.jar:git-Paper-215]
at net.minecraft.util.thread.BlockableEventLoop.doRunTask(BlockableEventLoop.java:153) ~[?:?]
at net.minecraft.util.thread.ReentrantBlockableEventLoop.doRunTask(ReentrantBlockableEventLoop.java:24) ~[?:?]
at net.minecraft.server.MinecraftServer.doRunTask(MinecraftServer.java:1341) ~[paper-1.19.2.jar:git-Paper-215]
at net.minecraft.server.MinecraftServer.d(MinecraftServer.java:185) ~[paper-1.19.2.jar:git-Paper-215]
at net.minecraft.util.thread.BlockableEventLoop.pollTask(BlockableEventLoop.java:126) ~[?:?]
at net.minecraft.server.MinecraftServer.pollTaskInternal(MinecraftServer.java:1318) ~[paper-1.19.2.jar:git-Paper-215]
at net.minecraft.server.MinecraftServer.pollTask(MinecraftServer.java:1311) ~[paper-1.19.2.jar:git-Paper-215]
at net.minecraft.util.thread.BlockableEventLoop.managedBlock(BlockableEventLoop.java:136) ~[?:?]
at net.minecraft.server.MinecraftServer.waitUntilNextTick(MinecraftServer.java:1289) ~[paper-1.19.2.jar:git-Paper-215]
at net.minecraft.server.MinecraftServer.runServer(MinecraftServer.java:1177) ~[paper-1.19.2.jar:git-Paper-215]
at net.minecraft.server.MinecraftServer.lambda$spin$0(MinecraftServer.java:305) ~[paper-1.19.2.jar:git-Paper-215]
at java.lang.Thread.run(Thread.java:833) ~[?:?]
Caused by: java.lang.NullPointerException: Cannot invoke "org.bukkit.inventory.ItemStack.getType()" because the return value of "org.bukkit.entity.Player.getItemInUse()" is null
at org.cartyoo.dupepro.DupeCommand.onCommand(DupeCommand.java:24) ~[DupePRO-1.0.jar:?]
at org.bukkit.command.PluginCommand.execute(PluginCommand.java:45) ~[paper-api-1.19.2-R0.1-SNAPSHOT.jar:?]
... 23 more```
```if(player.getItemInUse().getType().equals(Material.AIR)) {```
the itemInUse is obviously null
i tried what intelej suggested and if(Objects.requireNonNull(player.getItemInUse()).getType().equals(Material.AIR)) {
but that still errored
Objects.requireNonNull is pointless
maybe do not blindly apply quickfixes but think about the problem
if getItemInUse() is null, why on earth would you want to throw into Objects.requireNonNull()?
idk
you cannot do null.getType()
and player.getItemInUse() is null
because they don't use any item
Object.requiredNonNull throws an exception of its null
Do all nulls point to the same thing?
Or does it point to nothing?
Oh wait
LOL
Null pointer
i fixed it
I'm stupid
Well null is in fact pointer with address 0
At least in c
So it's probably same thing in java
null is a keyword
how the reference works:
no clue lol
very helpful right?
ever seen such a fucked up project strucutre?
omfg
what da fucj]
why are they not collapsed
also are you some sort of python person since you name your mainclass that
that's a maven archetype
lol
__mainClass__ gets replaced with the main class name defined in the properties
because I em editing those files lol
archetypes are probably the most useful thing in maven
yet nobody uses them
everyone generates their pom with the shitty minecraft dev plugin
I use them
thats good. you got a spigot archetype?
that do
they
they should change that default
not for spigot no, as I don't really need it
that's mine
it also has a GUI
next thing I'll add is kotlin support
add TaskChain to libraries
got a link?
you should totally add better item config when its full working
sure
everyone can easily pull request new libraries by editing the archetype-metadata.xml
the GUI automatically reads that file so it's also in the GUI then
fancy
oh you also gotta edit the pom.xml in archetype-resources
