#help-development
1 messages · Page 281 of 1
@fluid river I'm open for lessons. Do you want to do it in dms or anywhere else?
i think a doctorate is like 7 total
3+1+3
again though, depends on course and how long you take
yes call me and ask questions
k let me get a mic and all
lol
it's all standardised for russians
fair warning, someone's drilling in the wall under my room now and then
i don't care meh
Can i change server motd with plugin?
Hey, what packet is sent to cancel the particles of a torch?
change the description
thanks
You can't. They're client side
damn
Fatal error trying to convert Chat v1.0:net/multylands/chat/listeners/Book.class
29.12 15:09:20 [Server] INFO org.bukkit.plugin.AuthorNagException: No legacy enum constant for WRITABLE_BOOK. Did you forget to define a modern (1.13+) api-version in your plugin.yml?
what does this mean?
that you have to put api-version: 1.13 in your plugin
shouldn't this be working?
I am trying to check if a block is any type of container (chest, furnace, hopper, etc)
but it doesn't seem to work
isnt it the blockstate?
It is
yah
declaration: package: org.bukkit.block, interface: Block
(event.getClickedBlock().getBlockState() instanceof Container)
Hello, I am getting this error when using this class.
I converted packages to version 1.16 and have no idea why the server is returning a warn. Thank you in advance for your help
https://gist.github.com/jonahseguin/2c21843806b7c03b42ad ->.
I have changed:
import net.minecraft.server.v1_16_R3.PacketPlayOutScoreboardTeam;```
?paste
@wooden steeple
Okey
Use components and not strings
Could you please explain where?
I'm supposed to replace everything with? ChatBaseComponent
changed it to the block state and it worked now thanks
how do i check if ItemStack is tool?
I tried this but thats true even for blocks and other stuff
what blocks are damageable?
apparently?
the statement i sent returns true even if the itemstack is block
can u answer my original question?
which block?
ANY BLOCK
.
yeah
but doing a null check?
yes
You'd need to do that check manually
its just not null assertion
?jd-s unless there is an API there, but I doubt so
if that doesnt work then, just create a Set<Material> of tools
java.sql.SQLException: No suitable driver found for mysql
I guess you could check the creative category, but that is a dangerous check
was hoping for a better solution but i will have to create a list of all tools then
¯_(ツ)_/¯
https://github.com/Geolykt/EnchantmentsPlus/blob/4xx/resources/magicCompat.yml#L285-L347 A reference list for all the tools you may want to add since you are bound to forget a few
(outside of enchanted_book that is, that is not a tool)
hardcoding materials?
At worst you' softcode them just like I did - I.e. throw them in a .yml file and call it a day
what about roughcode?
there is only hard and soft
Is there any way to exclude a spectator mode player from spectating specific players? I want to allow selective spectating per each spectator... if that makes sense
I am considering somehow using ProtocoLib to literally hide players who arent needed - but is there any easier way?
why not just do player#hidePlayer(JavaPlugin, target);
declaration: package: org.bukkit.entity, interface: Player
^
tho you would need to store info somewhere, cuz afair they are hidden forever
lmao
so you might end up with player never see each other again
if you forgot to reshow them
but you can loop through all players and on playerLeaveEvent you can show them again
I just reshow everyone on join lol cuz I'm a lazy minigame dev
)
im actually not sure if it stays after leave
that's why i said afair 💀
sorry idk what afair means
as far as i remember
Sorry, I don't know in which channel to ask. A good kits plugin for 1.7.10? They are all not working
help server
not right channel lmao
dm me
Oh lol
for free
Free java lessons!
yes
Freew java lessons! With nukerfall
POV you have nothing to do and force others to ask you to make plugins for them
XDD coming here after a while and the first thing i read is this. Spigot never changes.
He wants the animation with block hitting
So, from those jokes, I understand there's no a working kit plugin?
Come on man
teach you to code own kit plugins in one day
1 hour
essentials
Just use lunar for block hitting 1.8
Does essentials work on legacy versions that old
idk
Meh seems to easy
it worked on 1.5.2 in good ol' days
I think he should use 1.7.10
I tried with that, but first there's no a /createkit command and, I don't know how to take ids for items with other mods
Damn probably a skill issue then
LOL bro
yeah, you create it manually
xddd
bro just write your own 5 lines
What's a config ?!?
damn 💀 x10
Where I can get item ids from like mods, or minecraft items in general
Google your question before asking it:
https://www.google.com/
^
Bing your question before asking it:
https://www.bing.com/
?yahoo
Yahoo your question before asking it:
https://search.yahoo.com/
Why a name field? Because is the cache identifier that redis need. Because he can manage many cache at the same time
Why generics? Because i want to be able to work more confortable when catching saving directly object instead of strings
🤡
hashmap
cool! apparently I wont have to mess with packets I barely understand then 😄
jepp
guy reinvented map
did smth similar years ago
lol
did this in c++ several days ago
goal was to figure out why the fuck is hash needed in hashmap
c++ map didn't use hash but i got why it was needed i njava
Because it's a hasmap
cuz its in the name 💀
why can't java have NoHashMap
OnMap
And now i know why
If you don't want a hash use another map impl
i guess
there is none
man just made an O(n) map
just make a linkedlist and call it a hashmap
yes, the most primitive and easy one
Set<Entry<Key, Value>>
Anyone have an idea how I could manipulate the result item in a villager trade without creating a new recipe?
which is AbstractSet impl
events?
anyways
But which one?
Google your question before asking it:
https://www.google.com/
Map uses Set inside
I have already
so u found nothign? hmm
Nothing that suits my case
I tried setting the result item in InventoryClickEvent and that worked
But not when shift clicking
Since the result item is taken from somewhere else then
@fluid river map uses an array of linked nodes ^
inventoryinteract event may uses shiftclick
Yes but the MerchantInventory doesn’t act the same when shift clicking
And there’s no way to set the result item in a MerchantRecipe
hmmm
maybe just create a villager with custom recipes xd
Yeah but that’s exactly what I’m not trying to do 😄
but whyyy
Because that would be hundreds of recipes
damn
wouldnt make sense that the storage field would be null
but why would it be easier with the manipulation?
i found something
but you have to use nms
here is an event https://purpurmc.org/javadoc/io/papermc/paper/event/player/PlayerPurchaseEvent.html
declaration: package: io.papermc.paper.event.player, class: PlayerPurchaseEvent
or you dont create a recipe you modify it
What’s weird is I already tried modifying the recipe via reflection in InventoryClickEvent
and what happend
Then checked the result item in PlayerTradeEvent and it was in fact the item I wanted
But I didn’t receive that item
and do you know why?
No
InventoryClickEvent should be called before any trading logic is performed
So I don’t know why that wouldn’t work
No the GUI never changes
I also tried simply setting the result item in the inventory
That works but not for shift clicking
That doesn’t solve the problem tho 😂
yeah ik but its a start lmao
did u work with PlayerPurchaseEvent? just found it
idk much about villagers
I can’t image PlayerPurchaseEvent being called before InventoryClickEvent
but you can try
But I will try
It has a setTrade method so that should actually work
The problem when I tried that in PlayerTradeEvent was that I couldn’t get the ingredients anymore
Maybe they are still available in PlayerPurchaseEvent
who knows
I want to do something like this in a cutom yml file called "arenas.yml", i already have the arenas.yml created but, how can I put the data like this format??
i love this
wdym
you can use YAMLConfiguration or something like that
just do YAMLConfiguration#set("name.data1", VALUE);
just do YAMLConfiguration#set("name.data2", VALUE);
just do YAMLConfiguration#set("name.data3", VALUE);
trueeeeeeee
ez as that
omg ty u helped me a lot
<3
can i sck your nevermind
good luck with your yml :3
how can I set an expiration for a ban using the banPlayer function? I didnt find anything about it in the docs
you could store the timestamp and on join you check if the time is passed on the timestamp and remove the ban
you can get the timestamp with System.currentTimeMillis() and convert it with new TimeStamp(System.currentTimeMillis())
you store then the timestamp + the ban time in milli seconds
and on join you check if System.currentTimeMillis() is greater than the stored time
thats a way how to
Hi guys, I’m new in developing in Java.
I was trying to develop a plugin that , when a player executes /ally [ player ] , to the selected [ player ] , sends message "Do you want to accept Ally? [YES] [NO].
If the player in question accepts, those 2 players will not be able to hit.
How can I do that?
this is a community that develops in Java
What would be the best way to go about getting any/all players in a radius of a location?
I meant Java, sorry for the distraction error
World#getNearbyEntities
I'm going to be honest but i think you should learn some Java before coding
So many server owners just jump into plugin dev without learning java they come in here crying cause of npe or smthing
oh okay.
?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.
damn internet so fast the speed test page doesnt even want to load in
While this is very good advise, I do get the fact that it just sucks to go ahead and "learn Java" if what you're really interested in is actually modding a game. This would take a lot of self-discipline which many people just cannot get together.
I also started out with plugins and had an immensely hard time (and asked tons of stupid questions). I just believe that this is part of the journey. As soon as one knows enough and has seen what real programming knowledge can achieve, they'll learn Java (or other languages) "properly".
can i do something like
libraries:
- org.mongodb:mongodb-driver-sync:4.1.1
- org.ow2.asm:asm-all:6.0_BETA
- com.github.docker-java:docker-java:3.2.14
for bungeecord in the plugin.yml? (all dependencies are in maven central)
or will i have to shadowjar them in
did u try "try it out before asking"?
then finish it lol
bruh
xddd
selfish thinking really
do you know how irritating it is for us who help those here to only get someone coming in here asking super basic questions because they couldn't be bothered to take time to learn the language?
for us to then teach them what they could have learned themselves
thanks
yo frost you know if i can use libraries: in bungeecord plugin.yml?
i cant find shit about it online
would be very nice
what is that supposed to do o.O
well in bukkit you can do
libraries:
- org.sus:sus:1.0
``` and it will download and load the `org.sus:sus:1.0` library from maven central
was wondering if i could do that in bungee
oh yeah smart
Selfish? Are you not in control of yourself? If you don't want to help somebody because you think the question is too basic for you, then just ignore it. I don't get the big deal. I think that it's immensely selfish and ignorant of you to judge that easily. Not everybody is able to learn this crazy shit on their own, and maybe they'd still like to accomplish some of their goals.
calm down guys
many people are plenty capable
holy bing chilling
if (angry()) {
calmDown();
}
?tryandsee
?tas
Who's agitated? D:
they forgot the "it"
lol
Selfish? Are you not in control of yourself?
it is selfish in that you don't consider that you might just be wasting someones time by not learning the basics and just hoping into some discord to ask what we perceive rather dumb questions.
What exactly is wrong with that? I'd like a bit more than a superficial "lol".
if you think learning the fundamental language to modding a game is not worth your time don't assume your question is worth the time of other people who are willing to help
you getting on ppls nerves really quick ig xd
if someone calls you selfish just ignore it
I see the new people have some learning to do >>
Anyone know why it's sending the path and not just the value in the path?
^
You cannot waste somebody's time if they don't give you permission to. Learn to defend yourself against what bothers you, rather than telling others what they can and cannot ask.
yes and I have no problems calling out the ignorants
you telling us that?
guys what the heck
i dont f know
Didn't tell you that you can't, didn't tell anybody anything. I only added my opinion, which again: you can ignore.
If you do not want to assist someone here, just ignore them then? Not a big deal
^
To be fair he can learn how he likes and if you don't want to help just ignore him
Too many spigot developers with big egos
Exactly what I said. I just said that some people may need this way of starting out, even if it "goes on your nerves". Read all of my messages. I never ever said anything offensive.
actually tru
mb
I have no problems ignoring people, but just wait till someone comes in here with basic questions and everyone ignores them and some other lesser experienced person helps them with even worse code and examples 😛
I started out with spigot first
guess I shouldn't have a problem with that
Why do you care lmao
because us experienced devs actually rather people learn the right way
You can't control how everyone learns lol
it seems you all have a problem that we want this of others
I just got a "selfish thinking really" thrown on my head and reacted a bit over the top. I'm sorry for that. Let's just let this topic rest, we all added our opinions and aren't going to change each other anyways.
That was encouragement??
life is more cruel
Very encouraging, people like these almost made me quit when I tried to start. I'm happy that I persisted and am today where I am now.
Anyway, can anyone enlighten me with this? 🙂
that is a command and not a statement to someone
it gives links to resources
to so you can learn
?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.
see
i learnt the hard way
by people doing that
the man who told me a lot of stuff here is kicked or banned
Could you share what's in your YAML? You seem to not ask the direkt value's path, but a key upwards, and thus getting a key-value tuple (map) back.
It doesn't matter what that string of characters represents, it matters how people interpret it. It just has this snarky side-taste.
just fyi there is a big difference between wanting clarification on some code piece because it seems ambigious or not very clear and asking why you can't cast a string to an int
Yeah, sure, we all do. (almost) nobody has a full-time mentor.
yeah unfortunately for you and fortunate for me, others opinions of me doesn't matter to me
I've never used this entrymap etc so I am new to it
so how you perceive me or whatever else is just on you I guess 🙂
Can you only post the line where you read from the config? Sorry, I coded so much today I'm literally braindead rn, xDD
Very true, it is on me. That's why I added my opinion, nothing more.
Yes, so I use a method. I'll paste method
?paste
you're missing a + ".kills" there, if you want to get the kills value.
I get kills seperately
that will get a section then
But you return a String value?
You cannot access another key from a string value
But from a map.
So just do it all in one?
I'd advise you to do so, and not spread calls and try to get "sections" beforehand to then drill deeper down into them later on.
The whole configuration API is in memory anyways, you're not going to get any more performance by doing so.
Yeah Im using a method to get the player name and then i just get player kills by it's self as I need to add the name and kills seperately
So I can set them out in the broadcast
I need seperate variables for them is what I mean
You need to be aware of the fact that a yaml configuration is basically a map at it's top level, mapping string keys to either a map, a list or a scalar (int, string, boolean). So if you don't access a scalar by it's path directly, you'll get a map or a list in response. If you call #getString, it internally stringifies the value, which is why you get the string representation of a section in your chat.
you need all the information in that yaml file right?
Yeah the name and kills
I would change those player names to include UUID's
since player names can change
and UUID's don't
Yeah fair point can add UUID
You got the name already, as you have to know it ahead of time to look the path up. So just call getInt on Player.<name>.kills
Anyways, make a player wrapper that works on when player joins
I don't have the name already
and it pulls that that information
kk
you shouldn't need any looping for that
Ooh, you're trying to print a top 10 list or something similar?
Yeahhh#
Top 3
since you should be able to pull the data by calling their UUID
Yeah i'll do uuid
Okay, then I'll help you out with that specifically by giving you a small example. One second.
kk
so, the way you would get the data is getInt("player." + playerUUID + ".kills")
you don't even need their name
and you already have their UUID
only thing you need to handle is when the player is not in there and thus returns null
but if u wanna make a top 10 you have to get the name from the uuid
Bukkit.getOfflinePlayer?
I use offlineplayer
maybe
you can get names using offlineplayer with UUID
yeah
mc server will use the cache and if the player isn't in cache it will do a lookup on mojang servers
Something simple like this will give you all values you need: https://paste.md-5.net/babehimoxi.cs
You need to decide on how you process them by the exact thing you want to accomplish tho.
kk cool
You're going to have a far easier time with YAML once you understand it's internal makeup. It's very simple, intuitive and uses a recursive key-value pattern. You just drill down and can get "intermediary levels" through sections.
Yeah got it working, I understand where I went wrong now.
Cheers man appreciate it
Happy that you solved it! :)
Although now it's not finding the kills?
@humble tulip Oh, btw, are you still interested in the whole topic of packet interception, where I've sent you a small example of mine? I got a clean way to get every packet since the Handshake now, if you'd like I can also share that with you.
Sure
You got all paths right? I think your config section actually wasn't just Player, but there were parent keys to it. Did you take that into account? You did not post your whole config, so I cannot tell exactly.
All good I made a typo lol
Guys i have a question.
Gradient color working in Minecraft plugin message?
i have created /discord command but it happened
Share your code
`package me.sussolino.juicepvpcore.juicepvpcore.commands;
import me.sussolino.juicepvpcore.juicepvpcore.JuicePvPCore;
import org.bukkit.ChatColor;
import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
public class Discord implements CommandExecutor {
@Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
if (sender instanceof Player) {
Player p = (Player) sender;
sender.sendMessage(ChatColor.translateAlternateColorCodes('&' , ""));
sender.sendMessage(ChatColor.translateAlternateColorCodes('&' , "&r &#e010d4&lDI&#aa1da2&lSCOˈe84&lRD&f!"));
sender.sendMessage(ChatColor.translateAlternateColorCodes('&' , " &f➥ &e&ndiscord.gg/5vgG9uy5aX"));
sender.sendMessage(ChatColor.translateAlternateColorCodes('&' , ""));
}
return true;
}
}`
strong
idk what is this
thats the not working discord link
ah lol , thanks for info
xd
.
uhh
How can #setDisplayName be null checked? Surely it would be null if the item is null and i've checked that?
normal chat color? &e , &6 ecc
oh ok , thanks
but idk how to make gradiants
np
^
Guys , for create a place holder , i need PlaceHolderAPI as dependecy?
yes
thx
@humble tulip
Here's a little example of the interceptor I talked about: https://paste.md-5.net/agijuxikil.java It still uses my library called BBReflection, which is public on my github, as you know.
I'll very probably still make a lot of architectural changes and fix stuff, but you got everything you need to know there, if you just follow the method calls. Like this, you can easily intercept all packets, like server-list pings and early player packets.
Relink your gh pls
@humble tulip
Aaaaand I refactored it already, lol. https://paste.md-5.net/adodoqolij.java
Can i copy and modify some of your code and put it into my plugin? I just need to intercept 2 play packets
Of course, feel free to do so. I still need to add the MIT license once I feel like it, but just go ahead in the meanwhile, :).
Guys , how i can implement totem animation?
without packets, the easiest method i can think is set there main hand or off hand to a totem then damage them the amount of their health
thanks
for create a title like this:
how i can do?
player#sendTitle ?
@Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
if (sender instanceof Player) {
Player p = (Player) sender;
((Player) sender).sendTitle('&b&lStore ');
((Player) sender).sendTitle('&fclick in chat ')
sender.sendMessage(ChatColor.translateAlternateColorCodes('&' , ""));
sender.sendMessage(ChatColor.translateAlternateColorCodes('&' , "#6ec0fa&lST#4882a5&lO#2a4858&lRE&f"));
sender.sendMessage(ChatColor.translateAlternateColorCodes('&' , "&f➥ &e&nhttp://www.juicepvp.eu"));
sender.sendMessage(ChatColor.translateAlternateColorCodes('&' , ""));
}
return true;
}
}
like this?
you can remove the Player p = (Player) sender; and change if (sender instanceof Player) { to if (sender instanceof Player player) { then you can use the player var where you need it, the gradient i doubt will work but the rest looks fine
looks better if u invert the instaceof check and return it
in "if (sender instanceof Player player) {"
then dont
ah , how i can update it?
change java verison
^^
depends what server version this is for
1.19 lmao
yeah you can update to a higher java version
18 is highest
site?
19 exists now
switch to 18
?java17
Install Java 17 at https://adoptium.net/?variant=openjdk17&jvmVariant=hotspot
thanks tvb
i kinda like 17 and that more
i like every version that supports the nice shit like the instanceof with variable declaration
17 would be better if this is gonna be public, otherwise select the version your server runs
ok thx
lol
they are pretty cool
+1
same for 1.8
/delete-all except java-17+
yes
Can legacy methods be used? I need to set the speed for the boat (if possible). I use .setMaxSpeed() and it's deprecated and nothing changes.
thats probably fine to use, just checked the jds and boats are complex and many of these methods do not work correctly across multiple versions.
boats are complex and many of these methods do not work correctly across multiple versions.
Welcome to java
If something is deprecated read why they are in the Javadocs
its bad when my first thought of seeing that was thinking they were using paper
it was a joke but nice ig
wish me luck guys im in game rn pls i need luck gimme luck
Oh i gotta question why is java 8 the last java version on oracles website?
and harder to download
"create business account"
Yeah which is why use use an openjdk distribution like adoptium
and if the method is outdated, then I should forget about the idea? Or does the new take the place of the old?
some deprecated methods are just deprecated because its not recommended to use, others have been replaced with their replacement in the deprecation method
How can I use hex codes in TextComponents? Both broadcast and hover are strings that already have working hex code chat colors. But once I make a TextComponent and a HoverEvent, they no longer work. (see image for reference)
val broadcast = getMessage("minecraft.format", message.content, *placeholders)
val hover = getMessage("minecraft.hover", message.content, *placeholders)
val component = TextComponent(broadcast)
val hoverEvent = HoverEvent(HoverEvent.Action.SHOW_TEXT, Text(hover))
component.hoverEvent = hoverEvent
plugin.server.spigot().broadcast(component)
What do you mean by that?
This is essentially how I set the color to the strings
// Replace hex color codes with the respective chat color.
val pattern = Pattern.compile("&#[a-fA-F0-9]{6}")
var matcher = pattern.matcher(message)
while (matcher.find()) {
val color = message.substring(matcher.start(), matcher.end())
message = message.replace(color, "${net.md_5.bungee.api.ChatColor.of(color.substring(1))}")
matcher = pattern.matcher(message)
}
return ChatColor.translateAlternateColorCodes('&', message)
Yeah don't use those
You should be coloring the component
The home of Spigot a high performance, no lag customized CraftBukkit Minecraft server API, and BungeeCord, the cloud server proxy.
Can someone explain to me what the problem is here? When I execute /track, only the selected area is executed. I want to have it so that if I then execute /track again, that the effect is gone.
Remove the effect don't clear the effect list: https://hub.spigotmc.org/javadocs/bukkit/org/bukkit/entity/LivingEntity.html#removePotionEffect(org.bukkit.potion.PotionEffectType)
declaration: package: org.bukkit.entity, interface: LivingEntity
Would there be a way to use this while not having many lines of code? My messages contain a lot of different colors
I would use MiniMessage with the Adventure library
It's easy to setup and works great
It comes bundled with Paper but if you want to maintain Spigot support you can shade it
lookin terrible
https://cdn.discordapp.com/attachments/709007310072315916/1058129902571892756/image.png yo isnt this correct?
?di
Guide to dependency injection: https://www.spigotmc.org/wiki/using-dependency-injection/
ty
?main
TextComponent#fromLegacyText()
Components in general use a lot of code
I’d avoid fromLegacyText() unless you absolutely have to use it
choco is alive
Yeah I’m just on vacation lol
poor dogs
I don't like text components in many cases
just seems like too much code :P
Just let me write my magic string shit
i would rather use paper components over the spigot/bungee components
<gradient:000000:FFFFFF>STG this is easier than having 10,000 lines of code for my components</gradient>
Use MiniMessage 
parsing 💀
ye
i stole that code
it was very cool
did you find the bug I had in it lol, cuz I had to patch it out in my lib
you couldn't nest <word:[insert color]> statements
oh lol
i should probably update the stuff i have
i also need to implement it into my translate method
I still need to make my translations API
seeing as I know some spanish might as well translate my plugins and setup API for it
What's the maven repo for MiniMessage? I can never seem to find just a standalone version of it.
its on kyori
Idk what that is.
you what
just use spigot libraries feature with it can't you?
Does no one care about file size anymore? :3 I already have dependencies that are large enough.
guess not
apparently not
I was only looking into adding support for it, but maybe I'll just write my own parser at this point.
you absolutely do
if you don't you'd be banking on people using paper
so if you get even 1 person not using paper it causes a comparability error
yes
thats like the whole point
Spigot doesn't though.
if you don't shade it it wouldn't work then
So write for Spigot and don;t use Components. It will work on both
or you use paperlib and code different stuff for each server version
a lot of people here prob just use paper api, but paper discord is meh so people just come here
I use paper api a good amount of the time
same
i always run paper for server but never use their api
always use spigot api
oh papers latest fuckery is
- We have deprecated the PluginLoader and SimplePluginManager class as future plans may cause this API to no longer function. We highly recommend moving away from using these classes.
- We have added the new Position (experimental) api, which can represent coordinates that aren't tied to a world.
wtf 💀
are they going to hard fork finally
i thought they wanted to keep compat with spigot api
I remember Lynx saying something a while back, but tbh I don't remember exactly what he said so I won't even try
Couldn't that second note be resolved by just making a Location constructor that doesn't have a world param?
send the docs
I'm curious
I have "Light" verisons of all the Things Bukkit has
Why does having Location and world separate help?
If anything it becomes less clear
represent coordinates that aren't tied to a world. this seems very easy
whats the point of that
Isn't that just a Vector at that point?
you can super easily construct that though
BlockPosition has no world component so already exists
That's NMS isn't it?
yes
quick someone PR this to spigot before paper finishes xD
lol, it's not hard. It would be literally an API class to wrap BlockPosition
you could just overload the Location taking methods and just use the current world then?
No, but fr though. Isn't what they are describing as Position just a fancy Vector class? If it only takes x, y, z as params, then what's the difference?
kinda, but using a Vector to represent a Position is kinda an abuse of the Class.
with transverse, vector is hard.
but a vector is just 3 points
😅
Yes, but it's name imples that it has no origin
i see
so should not represent a position
that’s fine
i don’t live in 4D world, sorry
Guys I got an idea what if
@Getter
@Setter
public class Position {
private int x;
private int y;
private int z;
public Position(final int x, final int y, final int z){
this.x = x;
this.y = y;
this.z = z;
}
}```
I don't think so
lombok best
I'll look lol
I've used the ComponentBuilder to create a BaseComponent[]. Now how can I broadcast this component array as one message?
Yes, sendMessage / broadcast
iirc all the component things take in The array
You have to use Player#spigot#sendMessage() to send an array to the player though.
I'm getting this type mismatch
there seems to be a Mutable block pos too
yep I'm looking at src rn
I happened to have 1.19.3 maps up
?jd-s
declaration: package: org.bukkit, interface: Server, class: Spigot
Maybe a kotlin issue idk
seeing as paper is adding the Position api I now wonder if spigot has some equivalent
The method exists
It's still experimental for them, so likely not for spigot.
hmmm I wonder where this is used at in NMS
my decompiler can't search entire projects
Would you look at that. BlockPos takes Vec3 as a parameter.
public static Iterable<MutableBlockPos> spiralAround(final BlockPos firstDirection, final int secondDirection, final Direction center, final Direction radius) this seems cool
it extends Vec3 itself
nms has an internal Position class would you look at that
I wonder if paper is just bringing that forward
Wait, what's the difference between Vec3 and Vec3i?
no clue
ones in the core and ones in hte phys package
whats a good decompiler where I can search cross class
I just use jd-gui rn
Looks like MutableBlockPos also exists.
yep
Also, what tf is #withinManhattan() supposed to mean?
Nukes 💀
it was, needed to send my array as vararg using *:
plugin.server.spigot().broadcast(*components)
kotlin 💀
kotlin weird
yeah kotlin.
It is actually quite useful.
- can be used for lots of shit
private fun getBlockPosition(block: Block): Array<out Any> {
return when (ReflectionSupplier.getLegacy()) {
ReflectionSupplier.LegacyType.OLD_OLD -> arrayOf(block.x, block.y, block.z)
ReflectionSupplier.LegacyType.OLD -> arrayOf(
ReflectionSupplier.NMS_BLOCK_POSITION_CONSTRUCTOR.invokeWithArguments(
block.x,
block.y,
block.z
)
)
else -> arrayOf(
ReflectionSupplier.CRAFT_BLOCK_METHOD_ACCESS.invoke(
block,
ReflectionSupplier.GET_POSITION_METHOD_INDEX
)
)
}
}
fun boneMeal(block: Block, player: Player, config: Triple<Boolean, Boolean, Int>, cooldown: Pair<Boolean, Int>) {
if (config.first && !player.hasPermission("twerktree.twerk"))
return
if (cooldown.first){
flushMap() // Flush old cooldowns
if (config.first && !player.hasPermission("twerktree.cooldownexempt") || !config.first) { // Check for permissions
if (cooldownMap.containsKey(player.uniqueId)) // Check if player has cooldown and return
return
cooldownMap[player.uniqueId] = System.currentTimeMillis() + cooldown.second // Set player cooldown
}
}
ReflectionSupplier
.NMS_BONE_MEAL_METHOD_ACCESS
.invoke(
null,
ReflectionSupplier.NMS_BONE_MEAL_APPLY_INDEX,
boneMealItemStack,
ReflectionSupplier.CRAFT_WORLD_METHOD_ACCESS.invoke(
block.world,
ReflectionSupplier.CRAFT_WORLD_HANDLE_METHOD_INDEX
),
*getBlockPosition(block)
)
applyEffect(block, player, config)
}
Don't hate on my triple use
Uh
But there isn't on 1.5
Lol
Wtf
get with the program md all the cool kids use 1.5 nowadays
1.5 is shipped with https://offlinemo.de
whilst there was indeed bonemeal on that version
i didn't want to extend the functionality to that.
Lol
I had Old and new at the start
do you move
do you just move NEWEST each update
Newestest
NEWER_NEWEST
I don't actually change it anymore
shouldnt you not care after 1.18
I just haven't updated it since 1.17 and haven't been told it is broken yet.
bruh yur plugin works with 1.5?
wtf
eh well can't recall
craftbukkit does tho
what does your plugin do?
The getMessage method returns a translated message using ChatColor.translateAlternateColorCodes(). In the while loop I split my message into multiple components, giving each a hex color of their own. At the end I send the components. For some reason my components will only have the last assigned hex code as color (see images for reference).
private fun getComponents(path: String, content: String, vararg placeholders: Pair<String, String>): Array<BaseComponent> {
var message = getMessage(path, content, *placeholders)
val componentBuilder = ComponentBuilder()
val pattern = Pattern.compile("&#[a-fA-F0-9]{6}")
var matcher = pattern.matcher(message)
var color = ""
while (matcher.find()) {
println(message)
println(color)
componentBuilder.append(message.substring(0, matcher.start()))
if (color.isNotEmpty()) componentBuilder.color(ChatColor.of(color))
color = message.substring(matcher.start() + 1, matcher.end())
message = message.substring(matcher.end())
matcher = pattern.matcher(message)
println(message)
println(color)
}
if (color.isNotEmpty()) componentBuilder.color(ChatColor.of(color))
componentBuilder.append(message)
return componentBuilder.create()
}
twerk to bonemeal shit
sounds fun
twerk
hi so
hi
uhh
uhh
im doing text components
ok
and im getting an error
nice
?paste it
lemme send the code one sec
sure
I'm trying to copy the world and send players currently in world 1 to the copy I just made. Unfortunately, bukkit.getWorld() is not working for me whatsoever :\
?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.
says that this line is wrong
TextComponent duelaccept = new TextComponent("§a§l[YES]");
or well that line has an error
ah
Bukkit.getWorld() returns null. I've tried calling it in onEnable and everything. Nothing works
idk why
that isnt a method
what's the world name?
Bukkit.getWorld(name) is
Bukkit.getWorld() isnt a method according to the jds
Yes. I need the world to be loaded in order to be able to get it with getWOrld
*getWorld
yeah
I meant getWorld(string)
ah
I know about world creator it pops up all the time in my research. The problem is that it creates a new world
I want a copy of a world
or a world with stuff already in it
if you have the world in your plugin you can use JavaPlugin#saveResource
One quick question. Root folder for plugins in spigot is the folder containing spigot-1.19.2 (or whatever version you are running)
so I call Bukkit.getWorld(name) and the world folder should be in the same folder as the spigot jar
or am I mistaken and the world folder needs to be in the plugins folder (where the plugin.jar is)
createWorld is more like loadOrCreateWorld
If the world already exists it loads the world. Otherwise it makes a new one
to call bukkit#getWorld the world file would be in the base directory
this directory would have the plugins folder, server jar
ect
yes
What’s better? Auto parsing JSON with toJson and fromJson or manually parsing it with JSONObjects?
The world folders i'm trying to load are in the same folder as the spigot.jar
yeah you would probably need to use the world creator or Bukkit#createWorld to load it
From what I understand from research, you must call bukkit.getWorld(name) in the onEnable method of the plugin
Otherwise it will not load
but i've tried this for even the default world (just world) and it still doesn't find it
and how exactly would I do that?
?stash
i just google spigot stash and then the class youre looking for with 'craft' in front of it
like world impl is craftworld
Didn't realize it needed to be all lower case. I've changed that real quick and ill see if it fixes it
It doesn't have to be?
it does that itself
It automatically converts it to lower case
^^
It converts the input to the function to lower case, but if the folder has upper case in it that might cause an issue
thats what im checking real quick
i would guess it converts that to lowercase too
no
if you want to load a world you need to call createWorld
as I said before the method is really a loadOrCreateIfNotExists method
getWorld only returns already loaded worlds
I understand that I saw that in the docs. I thought that calling getWorld(name) in the onEnable it would load the world, but according to you this is not the case. I am using createWorld(worldCreator) now to load the world. Hopefully that works
If that really is the problem, then its even more unintuitive than scoreboards are
Is it possible to support hex codes inside a hoverevent?
for HoverEvent.Action.SHOW_TEXT
yes just use another component as the value
oh, it's deprecated tho. Is it fine to use that method?
youre adding the component as the hover
you need to make a new component
new HoverEvent(..., new Text(new ComponentBuilder()....hex component)))
hot take light mode isn't that bad
hot take you need to leave
omg lombok
No no i didnt write my self a whole cache
I made my own cache serializer/deserializer for working with Redis cache simplier, because redis only allows strings or bytes data type
?jd
do anyone knows how I can make players glow in colors without any scoreboard teams?
why do you not want to use teams?
the tablist of players and ranks is with teams
and that two has problems with it
what?
Read my code
what about it
what doesnt work
i just think its really bad joke
really smart
is it really funny to you ?
yeah
im sorry
ik , im stupid
Hmm. So I am copying the world to a different "world" and moving all players over to it when I issue a command
and the first time works perfectly fine. Fantastic. When I go back to the overworld and issue the command again, the chunks end up corrupted and the copy is all screwed up
Bro what kind of ide is that wtf.
a good one
like?
netbeans
bruh netbeans
i haven't heard anyone talk about that in ages
but why is it in light mode???? light mode just seems painful
it looks like notepad++ with extra features tbh
cause I dont live in a basement
not only that it kinda looks like eclipse... xD
i bet you have a house
well i dont either
imagine
I bet hes a millionaire and thinks we're all stupid
honestly i wouldn't even deny that
okay im a go take a hike now at 7:53 PM cya lmao
idk why he would think were stupid when he knows we are
You guys have any idea why it works only once per server restart? lol
are you trying to copy a loaded world
probably something to do with saving
with no code, no idea
are you using different world names each time
Yes i am trying to copy a loaded world
Where are you cpying to? Another loaded world?
Now that I think about it, maybe I should do world.save() before I do the copy
you cant safely copy a loaded world
You just straight can't?
but it works the first time lmao
idk share code
creating a discord bot and i want to create a logger so that anything logged is saved to a file similar to how mc works
does anyone have a link to an easy way to do this?
I am thinking the reason I am having issues is because I am not unloading the second world (the one im copying to)
discordsrv github
The first time it is not loaded, which is why it works. The second time it is (probably) loaded which is what is causing the issues
my first thought was using the System.out and modifying it to a custom one that writes toa file
where?
not a discord bot in spigot
just a discord bot in java
discordsrv has console logging options
using jda
so you could check how that listens to console
Also you can Google about logback, as JDA uses slf4j
It has file appender
so i'm making a plugin for me and friends that will let us write plugins in Lua. many reasons but the biggest one is that i'm the only programmer in my friend group and lua is easier to learn then java.
i'd like to make this plugin as automatic as possible via reflection methods and such, even if it means having to use a java preprocessor (which seems to be on the table)
i've found a way to make a class that binds every listener to one function that executes the relevant lua function, but there doesn't seem to be any way to pass arguments to the handlers through this method, which kind of makes this pointless. is there any way at all to automatically register listeners and have their arguments get passed to the function? or do i have to use a java preprocessor/codegen
the arguments that spigot passes to the event handlers
like? player, block, item etc?
yers
PlayerMoveEvent(Player player, Location from, Location to)
whats enclosed in the parenthesis
spigot sends those to event handlers
how can i actually capture what it sends
...oh.
yep
can you show how you'd want the lua code to look
for playermoveevent for example
function OnPlayerInteract(action, block_clicked, block_face, item)
io.write(action)
end
of course io.write(action) is dummy code but you get the idea
oh wait
declaration: package: org.bukkit.event.block, class: BlockBreakEvent
like this
you can set if the event drops items
i just read code i wrote earlier and realized that this isn't how spigot does it either
it just passes the event as an argument
yep
two hours of research might have been saved if i had remembered this
😂
and opening up a stackoverflow post on why i can't get this java preprocessor working with intellij
i don't really see how this would help?
and also if i can keep this free of other required plugin dependencies i will
is lua oo?
does it work similar to java?
How i can give to new people a role named member?
no not at all
What's wrong with just passing the event
i have not worked with lua before making this plugin tbh
just tell your frineds learn java 😂
i refuse
a. lua is easier to learn
b. i will refrain from ranting in a server full of java users about why i hate java so much
How i can give to new people a role named member?
luckperms?
do you use luckperms
yes
you could do that
or you just make member a parent role to default
or just use default as your default rank
and give it the member prefix and that
What's wrong with just passing the event
thx
i had forgotten this was how it should be done
?stash seems like ur friend lol
and spent way too much time focusing on what the doc showed for the instantiation function
)