#help-development
1 messages · Page 1136 of 1
I just did a powershell script lol, couldn't be bothered to do something proper
yeah, having to restart every time is annoying, though I often mistakenly make code unreachable with hostwapping considering it doesn't re-run the necessary logic lmao
can anyone explain how JavaPlugin.saveResource works? the docs just say saves the resource at the filepath, but like, how does it get the data to save
I have been meaning to make a hotswap agent plugin to do that, but cba to do it yet
i wish you could just do arbitrary code execution with a debugger
you can
if you set a breakpoint, it allows you to execute expressions on the go
I mean, if you have hotswapping setup, ideally that'd be the case with the debugger
the javadoc is pretty clear
though the name is misleading
transferResource would've been more clear
it transfers a file from inside the jar to the plugin's data folder
oh
its to load like templates from the jar into the plugin folder
for like defaults
for whatever you want really, but essentially yeah
well thats the only usecase I can think of
Checking in a .idea folder should be punished by a court
lmao
okay so anyways, how would I save a resource properly
.editorconfig can do the same
like I have this data that needs to go in this place
which is some folder inside the plugin folder
whats the standard way to do that
editorconfig can lick dn
"last_opened_file_path": "/home/radsteve/IdeaProjects/inventoryjam/code-red",
I hate it

editorconfig is unbelievably based
How can I interrupt commands that comes from the console?
I like the concept
I mean, you just create a file?
you can use JavaPlugin#getDataFolder to get your plugin's data folder path
shame that there is no method that returns a Path
and does the PlayerCommandPreprocessEvent trigger on commands from the console?
oh so there is no spigot approved way I guess

Obviously you mean Plugin#getDataPath 
I mean, that'd be reaching for the API
there's no need for such methods on the API when Java's one is perfectly fine for that use-case
lmao
it might be convenient to have a method to save directly to the data folder, but then people would complain about other methods not existing
anyways, thanks both for helping a fellow out
i have a project (pushed to gh btw) where ij just didn't add run to the gitignore so i pushed my server as well
have not been assed enough to remove it yet
i have no clue why that often isn't in the default gitignore
This code doesnt stop the server to execute commands ._. what can i do
public class ServerCommandListener implements Listener {
@EventHandler
public void onServerCommand(ServerCommandEvent event) {
if(event.getCommand().startsWith("/summon"))
event.setCancelled(true);
I don't think there is a slash in the server command event
xD im so dumb thanks
well tbf the inconsistency with these two events is kinda the API's fault
a
why would I care about a slash in the preprocess event
how do I get intellij to figure out which version of my core library to use correctly, I have a project that uses my core library AND implements another plugin that uses the same library but if there's a version mismatch the IDE just can't figure out that I am not using an older version of the core library despite using relocations for the shadowjar on the other plugin (guessing maven doesn't care about relocations)
this sucks
How can i change the color of the messages that players can send? like the name of the people who send these messages. like i want to change the color from their names to yellow and their message to dark purple
with gradle you can just exclude group
do the maven equiv
so I'd exclude the shaded library?
ye
hrm
oh shit look at the time
I have to go to the gym
or else I'll end up like illusion
don't be like illusion, kids
Is there an event called for shield disable
don't say that
you're putting the thought in their heads
Hi can anyone help me here? I want the first in yellow and the aftercoming message in darkpurple
public class ChatListener implements Listener {
@EventHandler
public void onChat(PlayerChatEvent event) {
String message = event.getMessage();
event.setMessage(ChatColor.YELLOW + event.getPlayer().getDisplayName() + " : " + ChatColor.DARK_PURPLE + message);
}
}
the sender name remains white in my case: <Stauder_Blaubaer> Stauder_Blaubaer (yellow) : Test(darkpurple)
dawg asks for help and still finds a way to diss me
The players display name likely already contains colour
You should probably strip it
Or use event.setFormat
Hi another question. and i cant find it in the spigot bib. how can i get the death location from a player who died? my code by far:
public class OnDeathListener implements Listener {
@EventHandler
public void onDeath(PlayerDeathEvent e) {}
}
e.getPlayer().getLocation() should suffice
Unless you need it elsewhere, in which case there's a Player#getLastDeathLocation() I believe?
Yes there is, it's used for compasses. But if you need it in that event, just get the player's current location. That will be the death location
Theres a little problem i think. i want to tell the player who died the coordinates of his death location cause hes doesnt use F3
public class OnDeathListener implements Listener {
@EventHandler
public void onDeath(PlayerDeathEvent e) {
e.getPlayer().getLocation();
}
}
and i cant do smt like e.getPlayer().getLocation().sendMessage() or smth else
sendMessage(getLocation().toString ())
Tho the toString format might not be what you want
you say diss I say make you aspire to be more like me
leg day 
have you done your leg day this week
Does anyone know if
World#getBlockEntity chunk loads if given a position that is outside a currently loaded chunk? (NMS btw)
Just look at the impl
yeah ik I didn't want to open up my project
Wondering why tf this entity won't move even though I'm sending packets
but I'm just doing that now 🤷♂️
did you try adding leg day to the entity's goals
wish there was a way to tag methods in a way that one could easily tell that it loads some kind of state in Java
annotations + comments?
hidden semantics bother me a lot
you'd rather do that through the type system, so it is enforced
tf is supposed to move here
but an annotation could do, too
pitch/yaw?
entity's just stuck in place
well yeah
second screenshot proves the method is called and a packet is sent
I cba timing my printscr button but it's not rendering at x934
Not always, just in this scr
neither
I made sure to check: No passenger packets are sent either
I'm also fetching the entity id directly from the nms entity
why do packets at all
just spawn the entity and hide it for everyone except the player that is supposed to see it
serialization n shit
you can use entity snapshot for serialization
sometimes you just want abstract entities
lack of serialization
Trust me there's a good reason
what's the tp thing like
pretty basic
This worked before Idk what broke
we did update 1.20.6 -> 1.21.1 and java21 -> java 22
that's the only diff
it's hilarious because I have the same code for my thing and it works since I stole your homework I came upon it after a long meditation session with the universe and pulled it from the ether
watch it be my java vendor again
and using graalvm or something cursed to make it work again
like lmao
I wonder where I've seen that
do you believe in coincidences
no
well you best start believing in coincidences mr illusion, because you're in one
totally
though there's one big difference between my code and yours
mine works
so it must be better
Nice git user
well yeah but I've had half the server break because we ran zulu instead of temurin
I mean
there's
an alternative 🤔
why calculate the distance squared manually when you could do oldPos.substract(newPos).lengthSquared() > 16 * 16
don't know either you're feeding it garbage or there's something really rotten in there
or both
both is good
I have a packet listener
because it's <4 on any axis iirc
that if check might be fucked
commiting as BuildTools 🗿
you also get to reuse deltaX
like I give a shit who I commit as, it's a solo project
nvm found the issue
trash data?
no just a cursed packet handler
cursed setup
yes sir
7.9999 whatever when going positive l
the fuck am I even reading there
getting entity async to update the position of the holograms that are rendering its name
I thought the entity was spawned by packets
yeah but it follows a real entity
it's entities all the way down
Imagine not using text displays with transformations
and I was returning before writing the original packet if the move packet was sent for a fake entity
bedrock 🗿
that's fine, you understanding it is not a requirement
Also that component system

people tend to do crazy stuff like we are still in 1.8.8 to do holograms when text displays make it so easy
unfortunately I'm building this network for bedrock
Man is making a minecraft server with unity
it's just that spigot is more stable than whatever is out there
wrote it myself :/
I've heard that, still amazes me that people would rather use a bridge between the java server rather than the official bedrock server
People would absolutely do that
opportunity for a rust fork
It's simply more stable
trying to do a same-tick move that 1:1 tracks the entity?
Have one component for a health bar and another for the entity itself
at a network level
Does bedrock have the bundle packet
I can imagine, but doesn't take away of the fact that the bedrock server is so janky that this is the better option lol
Because we like the bundle packet
oh cool there's still a desync
even though I'm sending packets on the same tick
unless there's something fucky going on
.
like I didn't try something like that smh
prob not
Lul
I managed to get it to work kinda stable by making the armorstand ride the player
hey can you even modify the default interpolation of whatever that is
but that causes a bunch of issues and I cba
I don't think you can
fuck it time to rewrite half this shit
interpolation is lag
if it's hardcoded into the client there's no solution other than modifying the client
as it even gets applied to teleports
I've only clocked in like 3 hours of "trying to synchronize holograms"
totally not a waste of time
See on java it’s easy
only as of us having text entities
because we can change the interpolation on those
scoreboards go brr
What are we trying to synchronize holograms with?
entities
ez
just program a forward projection of player movement loser
So... just mount a text display entity?
yeah but bedrock
predictive movemnet AI
no display entities
they're doing bedrock
get good
gotta mount some armorstand
but doesn't bedrock do server-side player movement?
Doesn’t matter, pretty sure interpolation is the same for all other entities
I think I'll just use a real entity and just not bother
might be now, it changed recently iirc
either that or I only started doing it when those displays came out
production servers get deleted after runtime anyways
wait what kind of cursed setup is this actually
It's quite cursed
it's moving with player movement so the underlying entitiy is a player
When I move the hologram moves with me
I'll mount the entity
ah
I just cba writing mounting logic for uh
that might do it
we all love invisible entities running all game logic
I heard my team has been programming invisible rabbits to do proximity checks based on aggro before I implemented zone entering and exiting in my scripting
after I made fun of WoW for doing that
so at least they're paying attention to what I say I guess
cool now that I implemented it using real entities and stuff
I can't teleport because teleports with passengers is big nono
hmm @jagged quail
yo
does someone know
how to make the player take damage
with player.setAllowFlight(true)?
I am inquiring about someone who knows the plugin Magic Spells
I don't think that affects damage....
omg md_5
Might disable fall damage?
No i mean fall damage
I think that’s only when they start flying tho
Because with that, player doesn't take fall damage
As expected MerchantMenu is a pain in the ass 😭
You can still mess with the health attribute even if their flying is allowed couldn't you?
you can mess with any attribute while the player is doing anything besides logged out ig
Well yeah I just said it in a non aggresive way ig kek
oh I thought you were asking a question lmao
It was more so for the guy asking about the fly thing lol
is this an option if the library is shaded in?
Still I feel like hes gonna have to induce his own fall damage checks which sounds like a pain
I'm starting to regret shading this library in
Every time I use minimessage by shading all of adventure kek
I wish MerchantMenu didn't exist
damned thing
it's stuck on a previous version
I can't tell if it's a cache or a resolution bug
hm
yeah I can't tell
I'm so braindead
Legit forgot to reasign my IMMUTABLE builders
I made them immutable how tf did I forget
If i remember there was a way to get the player by uuid, what was it?
Oh, forget abt it, already found
Bukkit#getPlayer
Bukkit.getPlayer(UUID);
lord our savior forgive me for my sins
public static void openMerchantMenu(EntityHuman player, ContainerMerchant merchant) {
final IMerchant minecraftMerchant = ((CraftMerchant) merchant.getBukkitView().getMerchant()).getMerchant();
int level = 1;
if (minecraftMerchant instanceof EntityVillager villager) {
level = villager.getVillagerData().getLevel();
}
minecraftMerchant.setTradingPlayer(player);
// Copy IMerchant#openTradingScreen
OptionalInt optionalint = player.openMenu(new TileInventory((unusedSyncId, unusedPlayer, unusedHuman) -> merchant, null));
if (optionalint.isPresent()) {
MerchantRecipeList merchantrecipelist = minecraftMerchant.getOffers();
if (!merchantrecipelist.isEmpty()) {
player.sendMerchantOffers(merchant.containerId, merchantrecipelist, level, minecraftMerchant.getVillagerXp(), minecraftMerchant.showProgressBar(), minecraftMerchant.canRestock());
}
}
// End Copy IMerchant#openTradingScreen
}```
this is so fucking scuffed
time to make it even more scuffed by ripping out openMenu nad replacing it with different code 🙂
I have a loop that sends admin all the key and values of an entry in the database
for example item.5 have price, min, max, type it should iterate through those and print it out to player
but it didnt print anything at all
Yaml?
item:
"5":
type: cobblestone
max: 7.5
min: 3.75
price: 5.625
category: BLOCKS
sold: 12
yep
Get the configuration section named "item" then do getKeys(false)
You can iterate to display the data
ConfigurationSection itemSection = database.createSection("item."+args[1]);
sender.sendMessage(ChatColor.GREEN+"Data of ID "+args[1]);
// Assuming 'database' is your FileConfiguration instance
// and 'player' is the player you want to send the data to
for (String k : itemSection.getKeys(false)) {
String v = itemSection.getString(k);
sender.sendMessage(ChatColor.GOLD + k + ": " + ChatColor.GRAY + v);
}
this is the current code
yaml never fails to be cursed
Just do get().toString()
The values have different types
My laptop too poor to run IntelliJ IDEA and Minecraft at the same time 😭
OS?
Good
.get() on what object?
oh v
yea it's still blank
Did you just use file configuration to get the keys?
I did exactly what you told
:/
ConfigurationSection itemSection = database.createSection("item."+args[1]);
sender.sendMessage(ChatColor.GREEN+"Data of ID "+args[1]);
// Assuming 'database' is your FileConfiguration instance
// and 'player' is the player you want to send the data to
for (String k : itemSection.getKeys(false)) {
Object v = itemSection.get(k);
sender.sendMessage(ChatColor.GOLD + k + ": " + ChatColor.GRAY + v);
}
use getConfigurationSection not create
Did it print out?
Hmm. Check the config file in plugins folder
item:
"5":
type: cobblestone
max: 7.5
min: 3.75
price: 5.625
category: BLOCKS
sold: 12
the full file is 26kb
real
Make sure configuration file exist on plugin's datafolder
Ofc because create override existing data to empty
😮 now I see
fixed it
thank you!
now my tab completer wont corrupt my database randomly xd
hiiii, i have a question: How do I get number from the config? I'm new to java T-T
Inventory gui = Bukkit.createInventory(null, 18, "Test");
How do i replace the number eighteen with the number in my config.yml?
gui:
gui_size: 9
instead of 18, i want to replace it with the number set in the gui_size: config.
getConfig() from your plugin then pass it down to whatever method you calling that piece of code then config.getInt("gui.gui_size")
Could you show me an example please?
Well I'm using my phone rn
Ah sorry my bad!
@Override
void onEnable() {
saveDefaultConfig();
Inventory i = Bukkit.createInventory(null, getConfig().getInt("gui.gui_size"), "Test");
}
Hello, need a bit of help.. Does this not work? just displays nothing java i.getItemMeta().getItemName()
If item isn't renamed, the getItemName returns null
it's marked NotNull in api
Item name differs from display name in that it is cannot be edited by an anvil, is not styled with italics, and does not show labels.
Plugins should check that hasItemName() returns true before calling this method.```
there are to many names etc etc so annoying
you looking for getDisplayName or getTranslationKey which you can wrap in a translatable component
Is there a way to detect packets?
like certain type of packets without protocol lib
PacketEvents
are they a part of spigot?
noo I dont wanna use a lib
otherwise you have to use NMS and inject into netty yourself
have fun good luck lol
you are on your own for that then lol
the libraries exist for a reason
and the ones out there are great
sometimes reinventing the wheel is just dumb
cmon its fun
If you want to toy around with it just don't come here for help :P The point of toying around is self exploration and pushing your boundaries
atleast look at what you know works
alr thanks
Guys, I have a hashmap that contains all online players' data, and it works by mapping player's uuid to their data. Is there any other way to stire and get data from a Player
pdc
Uhm
Okay idk how tf I didnt think about that
But lets say
I need to be able to load a player any time and save data in files
a database
Yeah I get it but like whats a good way of linking a player and their data
their uuid
So I just do it like I do it now?
pretty much
Big hashmap from uuid to data?
No
Big database with data
Yes
Hashmap stores stuff temporarily
Like when a player joins or someone runs a command for an offline players data
Yeah ik
how do i check if a player is riding an entity or not before they quit and take actions necessary?. I want to unmount players if they are riding an entity before quiting server
Hi, using InventoryClickEvent, can I get the clicked item?
Listen to them quitting and check if they have a vehicle during that
is there a way to get the dropped items of a block in a break event?
how would i get the drops
in the block drop items event
is it possible to do it if the break event is cancelled?
no
you can get the drops, but it won't be the exact same drops
Block#getDrops(ItemStack, Entity) works for the purpose of getting the drops a block might drop, issue is that there's a chance factor to drops, so it would be different to the one calculated in the BlockDropItemEvent
rather than getDrops it should be called calculateDrops tbh
how do i make my plugin compatible from 1.8.8 to the latest version?
or is it not possible?
thank you
hmmmmm ok
does that do anything?
because i want it cross compatible, like a core plugin
not aiming for that. because its not mainly for personal use
and i want to use the same thing on different versions
without any hassle
You mean like nms?
yeah
There gonna be 100% hassle supporting all that
sure
Make a interfaces like ActionBarNms then create modules for each version you willing to support. Then in these modules you implement the interfaces like ActionBarImpl. When loading you check the version and select the correct implementation.
i'll try that out, thanks mate
using enums also helps too to centralize as well
what's the event for right clicking on a blast furance?
PlayerInteractEvent
import org.bukkit.Bukkit;
import org.bukkit.Material;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.player.PlayerInteractEvent;
import java.util.EventListener;
public class smelting implements EventListener, Listener {
@EventHandler
public void onInteract(PlayerInteractEvent e){
Bukkit.broadcastMessage("triggered");
}
}
}```
it doesn't trigger for some reason
Remove EventListener use bukkit's listener
Smelting instead of smelting
Make sure that you registered the listener in onEnable method
Hello I Coded a gui but how Can i change the texture of the gui. I know I’m wrong here but Idk where to ask
Use a resourcepack and a custom font
did you register it?
yeah
Make sure youre holding an item
what's the event if their not holding an item?
There is no event for right clicking air without holding an item
All other actions when not holding an item will trigger PlayerInteractEvent
Packets are simply not sent
just put an interaction entity on the player's pov if you want to detect that
how come the code doesn't broadcast when i click on a blast furance thought
anyone know magic spells
Avada Kedavra
Guys, Gradle does not find the WolfyUtils dependency and classes at all
I tried to talk with the plugin owner and no success, and i tried to ask in his discord server and again, no success
is there any trick that i can do to solve this?
Well what did you try
thats not gradle
^^
the fuck
looks like js
imagine using a byte array
what even is that
i dont wanna see the implementation of that method 💀
C# but close enough ig
its just a matrix mask used for shifting
Burst intrinsic, nothing one should worry about really
Burst is a C# compiler to native for Unity, kinda like Graal Native Image
Utils.java
https://sourceb.in/QxF0lNWH9f
config.yml
prefix: "Creusa > "
reloaded: "%prefix%&aPlugin başarıyla yeniden yüklendi!"
vote:
- "&a----------------"
- "Vote Linki: <link:https://creusanw.com/vote:&#FF0000Tıkla>"
- "&b----------------"
- "&x&F&C&9&9&0&0ʜ&x&F&C&9&9&0&0ᴜ&x&F&C&9&9&0&0ʏ&x&F&C&A&3&1&Aꜱ&x&F&D&A&D&3&3ᴜ&x&F&D&B&8&4&Dᴢ &x&F&E&C&C&8&0ʙ&x&F&E&D&6&9&9ᴏ&x&F&E&E&0&B&3ᴛ&x&F&E&E&B&C&Cʟ&x&F&F&F&5&E&6ᴀ&x&F&F&F&F&F&Fʀ&x&F&F&F&F&F&Fɪ"
site:
- "----------------"
- "Site Linki: https://creusanw.com"
- "----------------"
https://i.hizliresim.com/85qxny9.png
how can i solve this?
hex colors are broken when using text component
is this your plugin?
If so, you'd have to parse the colors yourself wherever you parse that link placeholder
yes
i already parse link
okay
show the code that parses the link
since &#FF0000 isnt standard syntax for colors either
that is way better than the monstrosity below
<link:https://creusanw.com/vote:&#FF0000Tıkla>
public static TextComponent parseClickableMessage(String message) {
// <link:URL:Mesaj> formatına uyan regex
Pattern pattern = Pattern.compile("<link:(https?://\\S+):(.*?)>");
Matcher matcher = pattern.matcher(message);
if (matcher.find()) {
String url = matcher.group(1); // Link kısmı
String clickableText = matcher.group(2); // Tıklanabilir metin
// Renk kodlarını çevirmek için translateColorCodes fonksiyonunu kullan
clickableText = translateColorCodes(clickableText);
// Tıklanabilir TextComponent oluştur
TextComponent clickableMessage = new TextComponent(clickableText);
clickableMessage.setClickEvent(new ClickEvent(ClickEvent.Action.OPEN_URL, url));
// Mesajı tıklanabilir hale getir
String[] parts = message.split("<link:.+?>"); // Link harici kısımları ayır
TextComponent finalMessage = new TextComponent(); // Boş bir TextComponent başlat
// Hex kodlarını ve renk kodlarını düzgün işlemek için önceki kısmı işle
if (parts.length > 0) {
finalMessage.addExtra(new TextComponent(translateColorCodes(parts[0])));
}
// Tıklanabilir mesajı ekle
finalMessage.addExtra(clickableMessage);
// Eğer link sonrası başka metin varsa ekle
if (parts.length > 1) {
finalMessage.addExtra(new TextComponent(translateColorCodes(parts[1])));
}
return finalMessage;
}
// Eğer eşleşme yoksa sadece renk kodlarını çevir ve mesajı döndür
return new TextComponent(translateColorCodes(message));
}
can you print what clickable text is after translating the color codes
it is so well formatted that it looks AI-generated
yes
im new at java
i started yesterday
what does translatecolor codes even do
well, I'm out of this one, good luck Steaf
when I ask for what someing does im usually referring to the code that does the thing, instead of the result
public static String translateColorCodes(String text){
String[] texts = text.split(String.format(WITH_DELIMITER, "&"));
StringBuilder finalText = new StringBuilder();
for (int i = 0; i < texts.length; i++){
if (texts[i].equalsIgnoreCase("&")){
//get the next string
i++;
if (texts[i].charAt(0) == '#'){
finalText.append(net.md_5.bungee.api.ChatColor.of(texts[i].substring(0, 7)) + texts[i].substring(7));
}else{
finalText.append(ChatColor.translateAlternateColorCodes('&', "&" + texts[i]));
}
}else{
finalText.append(texts[i]);
}
}
return finalText.toString();
}
you need to print the finalText and see were the color went
also if you dont understand what code you write/paste in your plugin then it will really hard to get anything done properly
thanks
I would atleast take the time to thoroughly ask gpt why he spat out what he did
to help understand where it could be going wrong
because its pretty hard for anyone to judge if ai generated code even works because the bugs are usually very subtle
yes
ai generated code only works for code tailored models
not chatgpt
chatgpt is a conversational machine
it's a bullshit spewer
speaks yappanese
professional rambler
Hi, is there anyone who could help me with MySQL.
how can i use hex color code in plugin config.yml
&x&r&r&g&g&b&b
&#RRGGBB
§
the top one is the native one
the first one will work fine you just need to pass it through ChatColor.translateAlternate....
make sure to use net.md5.bungee or whatever ChatColor and not org.bukkit.ChatColor
what's the matter bob
Y'as t'il un fr qui s'y connais en MySQL ?
this server is english only sorry
excuse me
you are excused
preach
🙂
intel intrinsics
for SIMD operations
that specifically is for switching from big endian to small endian
well a snippet of it
Okay so my plugin started throwing NPEs and cant pass events and everything broke
But
Seems like noone replaced jar in runtime
Could it be because it threw 1 exception befire or smth like that
Cuz it throws exception when data for 1 player isnt loaded
this just looks like noise to me
do a bunch of samples and graph it
ma guy
thats with 150k samples
this is the other guys nbt
doesn't seem to be all that different in performance?
I mean, that's a ~0.5% advantage in performance that ferrum has on it, but that's only if the benchmark isn't flawed
sure
the fact that ferrum and simdnbt implementations are so fast they have to be measured in us at that point 💀
wonder if anyone ported their impls to Java yet
yeah but java doesn't allow low level control over pointers as much as rust so it'd be hard I suppose
that doesn't matter, the key part of the logic is the vectorization
at least for simdnbt, don't know what ferrum does
with the incubating vector API, I'm sure one could do it. I have an old processor so I wouldn't be able to test it effectively
Maybe you should see what sweattypalms activity rn is
are they a maintainer of ferrum or do they just contribute to it
What can I say bro
I'm the owner of ferrumc :)
nice, cool project you got going on
hopefully it sees the end of the tunnel and reaches feature parity with vanilla, unlike the ones in https://dayssincelastrustmcserver.com/
Days since the last release of a Minecraft server software written in Rust.
I mean I got some people helping me right now
And I'm not giving up anytime soon
Right now we're rewriting everything
Mainly because this was supposed to be a project to help me learn rust. But it turned to something bigger than I expected.
is your priority being fast more than it is feature parity
I mean like 2:1 ratio
I just want to learn cool stuff
I was thinking of stuff like implementing actual machine learning models into the AI
Although don't know how that'd go
my ultimate tip is just to not get lost on the benchmarks
it is hard to get the whole picture when testing individual systems, because when they are being used all together, they might shit the bed in unexpected ways
preoptimization is the root of all evil
I 100% agree with that
But then again, some is better than none I guess
Because otherwise you need to redesign complete systems
issue is the individuality that comes with performance
make them modular enough
dont think of it as „it needs to be good to run“ but as „once it runs bad, i can easily switch this out“
That's actually a pretty good mindset
I'll keep that in mind
Too much coupled stuff is just hard to change
Decoupling is always nice, future changes are way easier
thats great to hear!
"dude you must use distanceSquared"
Object2IntMap everywhere
...
and then they're using a ConcurrentHashMap without reason because "otherwise it throws exception when I loop it" lol
lol, peak use case for CMH...
ConcurrentModificationExceptions
smh
the exception says concurrent so that means I must use a concurrent map 
I feel like I'm being called out lmao
tbf in 99% of cases it's a valid fix
but not when someone complained about using .distance(...) once per tick earlier
I also saw like a 50% performance improvement by converting a bunch of locations to vectors and performing distance checks
as it no longer needs to do world checks
i blame the world
or create references when creating location objects
yeah i bet illusion's world looks like ass
location is the bane of my deserialization
it's an algorithm to pick the ideal mob spawning location off a surface 
why, it is just three doubles and two longs
and a world
two longs for the world UUID
every point in the surface is in the same world so the world checks are wasteful
nobody cares about pitch and yaw
yes
but that world is what breaks just readin the file if the world doesnt exist
atleast ot used to for file configurations
I mean, that's why you use the UUID, so you can check whether the world exists on deserialization
who's out there renaming worlds tho
im jjst using the api
I still feel like world uuids are slightly stupid compared to just world names
uuid/name, it doesn't really matter, as long as it is something that can be serialized
bukkit uses the name of the world when serializing a location
and I also hate the getUID method naming
kinda stupid
too late to change
getUID is the correct name though?
wonder which one would be more space efficient
yeah but it could just be getUniqueId like the rest of the api
since the uuid + doubles combo is predictable, you could probably compress it better
ok yeah true. I'd also like it if there'd be a UUIDable interface or sth lol
yaml is not space efficient
Identifiable
yeah
yeah if you save location to nbt bytes its better with uuid compared to name obv
4 ints
skill issue
take it or leave it
not talking about yaml specifically, just the serialized representation of a Location
\t
t
_ _
😌
4 ints is nice until you need to make the uuid out of it again
lmao
good one
Who could help me to synchronize my faction plugin in MySQL. Because I have a problem when I'm on the first server, everything works fine with MySQL, but when I go to the other server, nothing is taken into account. I have to restart the second server each time.
string is better if its a short name
5 bucks says he's loading every faction's data on startup
"yo I got this 48 gb big world. I wonder whether storing the reference to it as UUID instead of string will save me 4 bytes"
half of it being empty chunks anyways
and that is time well spent
When setting gamerules do they save on server restart, and is there a way to not have them save?
well you have to care at some point
Sounds like you're only fetching data from MySQL during startup
after the meeting we'll have a meeting to discuss our decision
you dont know how many locations are being used in that world file
and another meeting to see if it's financially viable
just send a proxy to the meeting
can't be velocity
Yes, but can I synchronize them live on other servers?
that sounds like a bunch of work
I'm on bungeecord
That doesn't really affect it
Could send data over redis or smth
It really depends on what you're trying to sync
and how it's being used
we love regex
can someone help me? does anyone know how to use Citizens 2 Mod? im trying to build a concert stadium with NPC'S, so does anyone know how i could like MASS spawn them instead of just one by one placing like 5000 npcs?
or atleast quicker rather than just copy pasting npc create 1 then walking to another spot? can i make a repeated command block that creates them at me?
i still need to make them look at the stadium tho
am i even on the right channel rn lmao
it's for plugin development
shit
not sure about mods(there might be modders too)
im just here asking for help for plugins not really on their development but uhh
#help-server if you dont program the plugins
go to #help-server
oh ok thanks guys
helb me pls
there is a line with numbers, splitted by random characters like this:
1\n1.1 12345/1e10]-1e-2
so basically they are 1 -1.1 12345 1e10 -1e-2
i need to read all those numbers from string with regex
so all possible variants are NUM [+-]NUM NUM.NUM2 [+-]NUM.NUM2 NUMeNUM2 [+-]NUMe[+-]NUM2
then convert all of them to float and add to final sum
i'm not allowed to use .split or .trim, but i can use regex
getItemMeta.getDisplayName() does the same thing.
Im just trying to display it to what the player sees Iron Sword instead of IRON_SWORD
i.getType().name().replace("_", " ").toLowerCase()) seems like too much to do this
you should really use components here
because the only proper way to do that is a translatable component
otherwise you can't really tell what a player sees
Something like ComponentSerializer.toString(i.getType().name()))?
you can't serialize translatable components to strings
they're only rendered client side
what is ComponentSerializer, is that a Spigot thing
Is there a way to deny players from being affected (having the effect applied to them) by strength and weakness?
yea listen to EntityPotionEffectEvent and cancel/modify it accordingly
Hey,
I take it Particle.REDSTONE changed recently(ish?)
Just came back to update a few of my plugins from 1.18-1.20 to 1.21+
but seems Particle.REDSTONE no longer exists.
does anyone have a snippet to show how I may use that same particle in 1.21?
my previous code was as follows:
public static void mark(Block b, Color c){
b.getWorld().spawnParticle(
Particle.REDSTONE,
b.getLocation().add(new Vector(0.5,1,0.5)),
1,
new Particle.DustOptions(c, 2)
);
}
I believe you just replace REDSTONE with DUST
Ah was just searching this chats history and came across that!
awesome, thanks
Any idea how I can achieve what Particle.SMOKE_LARGE used to be?
is that now CAMPFIRE_SIGNAL_SMOKE?
LARGE_SMOKE
How can i make players take fall damage with player.setAllowFlight(true)
calculate it yourself
☠️
look up the fall damage formula and calculate in PlayerMoveEvent
ok
Idk why you'd ever want to do that
me neither
I'd never use fly on your server if it was that shit
currently working on a system for an item that when the user drops, dies, or leaves the server the PDC on the item are removed and reset, how would i check if the item is moved between the containers of the players inventory and a chest, barrel, etc.
then apply velocity and disable the flight before they hit the ground
InventoryClickEvent, InventoryDragEvent, InventoryInteractEvent is something you might want to look at
ill look into it 👍 if i encounter issues with it like i have with the 'InventoryInteractEvent' before ill come back here
why not use 'InventoryMoveItemEvent'?
if it isn't supposed to be persistent, just don't use PDC
I'm aware that it makes handling the passing of data easier since you don't have to manage it; if metadata didn't have those leak issues I would recommend that but it isn't an option so you'd have to manage it yourself
it is for some cases but other times it wont be in cases like this, PDC are the easiest way i can do this
also leak issues?
Thank you, will look into it tmrw
That’s for hoppers
hey, i want to support every message format but my class is not working. I used Adventure api (minimessage):
if (message == null) return Component.empty();
String parsedMessage = fixHexColors(parsePlaceholders(player, message));
Component miniMessageComponent = miniMessage.deserialize(parsedMessage);
Component legacyComponent = legacySerializer.deserialize(legacySerializer.serialize(miniMessageComponent));
return legacyComponent.style(style -> style.decoration(TextDecoration.ITALIC, false));
}```
can someone teach me or notice what exactly im doing wrong?
then I use in some other methods
if (message == null) return;
Component parsedComponent = parse(message, player);
adventure.player(player).sendMessage(parsedComponent);
}```
don't mix components and legacy
it just doesn't work nor will it ever do what you want it to
use MiniMessage and make people adopt a sensible standard
all plugins should use mini message or a similar format legacy needs to just go away
and how to set components in display names, lore, signs, etc using spigotapi?
if they can't understand minimessage they probably shouldn't be making a server 🤷♂️ just my thought
NMS
then if i want to make a plugin 1.16+ i will need to do code per version 😢
yes
drop legacy support have you ever looked at the pie chart of server verison distribution
might change your lense on supporting legacy
by dropping 1.16 you lose around 7% market share negligable
if you only support 1.20 up you capture around 70% of the market share
aggg i dont want to use nms 😢
is there any other way to support minimessage to string?
legacy parser, but it sucks
you should really just use components with NMS
adding component support with NMS is pretty much little to no work
can u show examples? i dont know anything about nms
https://github.com/PineappleDevelopmentGroup/Pineapple/tree/dev/pineapple-bundle/pineapple-nms
https://github.com/PineappleDevelopmentGroup/Pineapple/blob/dev/pineapple-bundle/pineapple-nms/spigot-v1_20_R3/src/main/java/sh/miles/pineapple/nms/impl/v1_20_R3/PineappleNMSImpl.java
https://github.com/PineappleDevelopmentGroup/Pineapple/blob/dev/pineapple-bundle/pineapple-nms/spigot-v1_20_R4/src/main/java/sh/miles/pineapple/nms/impl/v1_20_R4/PineappleNMSImpl.java
just navigate to getItemLore and setItemLore
thank u
Having a compiled .jar, how can I recompile it and add a little prefix to its packages?
Basically just add a package prefix to a jar
I'd assume if its fully compiled you'd need obj asm
because you'd need to remap reflections
Not at runtime
Obj asm can be used outside of runtime
It's for a library
just relocate
How can I do that?
Okay so for example
so i’m looking to put a image for example like a png image onto a lord of a item so when they hover over it they seee the photo i know this is possible but any clue how?
Resource pack
only way?
Turn the image into a custom character in a font
Or recreate it with a bunch of square characters, but that’s not gonna look too good
i couldn’t put import the png to my dedi server and upload all the images and then put like a url in a sense?
No
that sucks
im struggling a lot with this, why does it only say 'Moved!' to the player only some of the time, and sometimes it doesnt even send it under the circumstances i set it to be
public void onInventoryDrag(InventoryDragEvent event) {
if (event.getWhoClicked() instanceof Player) {
Player player = (Player) event.getWhoClicked();
Inventory destination = event.getView().getTopInventory();
Inventory orgin = event.getView().getBottomInventory();
if (destination.getType() != InventoryType.PLAYER) {
if (orgin.getType() == InventoryType.PLAYER) {
player.sendMessage("Moved!");
}
}
}
}```
well i have one for click events but i assumed id only need one for shift click
i wish there was an easier way to detect this i have no idea what im doing :/
public void onInventoryClick(InventoryClickEvent event) {
if (event.getWhoClicked() instanceof Player) {
if (event.getClickedInventory() != null && event.getClickedInventory().getType() == InventoryType.PLAYER) {
if (event.isShiftClick()) {
((Player) event.getWhoClicked()).sendMessage("You moved the item out of your inventory!");
}
}
}
}```
heres all of that code if its needed
You can move an item out of your inventory without shift clicking
By just dragging and then placing it into the other inventory
well yeah i know thats what the InventoryDragEvent was for, i wanted the click event to check for shift clicks and the drag checking for drag ones, but again i have no idea what im doing
does the client ever send it's fov?
The drag event is when you drag an item over multiple slots, or if you move your mouse when placing it
When you just place it directly it’s a click event
I want to find the person who invented the maven/gradle cache and 1v1 them knives only in cs:go except it's not in cs:go
how do I create a configuration section thats not bound to any single file
ConfigurationSection.createSection is not static, presumably becuase it has different implementations
but I just want to create a section and then save it later
can't you just fake it by making a map and then converting it when you need it
how can i use dependancy injection in ACF (aikar commands)
not really, it would be a big mess
I believe you need to make a YamlConfiguration
Which has ConfigurationSection in its hierarchy
ah yes, thanks
if i need to check if player has a rank (from another plugin - luckPerms) do i need to add api to dependencies? - i have never written a plugin interacting with another plugin
so i dont have to actually
don't know exactly how group implementations work but it's probably using some kind of permission as well if I had to guess
or you can just get the permission you're looking for specificaly
okayy
how can i make in my plugin that command from another plugin invoked
this doesnt really make sense but im guessing you mean. you want to detect when a command from another plugin is executed?
no... like execute another command, is it possible even?
so why did you say it doesnt make sense?
because whatever you said isnt gramatically correct
the order of your words dont make sense
"How can i make in my plugin that" i dont know how to say that
How can I invoke a command from another plugin
I guess would be the correct phrasing
yeah, you just said it different way
Failed to register events for class events.BB because de/netzkronehd/wgregionevents/events/RegionEnterEvent does not exist
what is the problem
idk it kinda tells you
this is the code
@echo basalt
package events;
import de.netzkronehd.wgregionevents.events.RegionEnterEvent;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
public class BB implements Listener {
@EventHandler
public void onEnter(RegionEnterEvent e) {
if (e.getRegion().getId().equalsIgnoreCase("spawn")) {
Player p = e.getPlayer();
p.sendMessage("hello you're in spawn");
}
}
}
guys how can i parse link message from config.yml like link:https://google.com:&e&lClick
just use minimessage
legacy chat has no such capabilities
how can i use minimessage
note: using minimessage will require you to shade a bukkit platform adapter yourself
If you can, look into ComponentSerializer#deserialize
if you are OK with using JSON components instead.
im'na use Adventure Library for minimessage
alright
If you try to .get() a CompletableFuture<Void>, does the .get() block or not because the future is void
It will still block
Ic
What does async in AsyncPlayerPreLoginEvent mean? Like I don't really get it.
Does it mean that prelogin events arent handeled by main thread
Or what
It means that the event is being executed async, so you can run blocking tasks without blocking the main thread
So, it is indeed off-thread
everything?
everything.
not really
guys what happens when I call a function inside a completable future and an exception gets thrown inside the function
If you don't have correct error handling it might happen that cf just swallow the exception
And how do I have correct error handling
I'm looking for someone good at configuring tcpshield, I pay
Tcpshield have to be configured ?
Isn't it like just put their dns as CNAME for your domain and that is it
I think you have to configure the ports you want them to handle on the domain or how you want them routed
either way, it should be relatively straight forward though
You just need to install their plugin, sign up, add your servers and add the CNAME
not that hard
Takes 15min
is it allowed to shade JDBC jar into my plugin and distribute it free/payed?
Does anyone know any tricks that could optimize a player's existence on the server?
The player doesn't need to have the ability to do anything
For example, using 2 as the render and simulation distance
Setting him as non-collidable etc
Like any tricks to for example, stop the server from ticking the player?
Jdbc is part of java jdk, not sure why would u shade it
If I'm not wrong
ohh yeah nice
What makes more sense from a usability standpoint:
/teleport <player | here <target> | random>
or each being a separate command, e.g. how basically every other plugin handles it
Probably the one with sub commands as you can tab complete them more easily
Has anyone here ever used OrmLite?
Or does anyone have a library that offers a variety of different ways to save and retrieve data for different databases?
i used it for small project, it's alright and will do your basic orm stuff
https://java-source.net/open-source/persistence pick your poison
hibernate
recommending hibernate for a plugin is crazy talk
just stick to ormlite, it is the most common solution for this kind of environment
¯_(ツ)_/¯
Why is that?
hibernate is backend
It's probably overkill for what you're trying to do
Hibernate is quite a massive lib
and you probably dont want hibernate in your plugin
despite it working good and making your plugin enterprise software
but if you don't really care about that it is a valid option
^
Knowing a bit about hibernate can be quite useful so I'd say it's fine to use just to learn
Just don't shade it and load it with the library loader
Lib loader
No just massive
Also, how should I use it if I don't shade it?
didnt knew that
Load it on your own separately
A what
or use the library loader
is there a resource for that?
What's that tho?
for now im shading hibernate and relocating 😄
Wdym by that?
ah, i will stay to shading
It's quite simple but it only works with maven central dependencies:
libraries:
- "<maven dep goes here in gradle format>"
So a jarinjar?
That was for shadow not you
ik, but you said to not shade it, so i got confused
all good tho
Yeah don't shade it
That's one way of doing it but then you run in to the size problem again
what now 
And this is only 1.17+?
does spigot has a size limit?
4MB
I just link my github releases as the download
libraries:
- "org.hibernate.orm:hibernate-core:6.6.1.Final"
wait thats 5head
would download it for you
