#help-development
1 messages · Page 1278 of 1
true
Wait so attributes like that actually affect rather client sided actions?
/*
* (Blocks_Per_n_ticks / tick) * 20 = Blocks per Second
*
*/
Bukkit.getScheduler().runTaskTimer(Main.getPlugin(), () -> {
if (!player.isOnline()) return;
double speed = player.getLocation().distance(playerLocationHashMap.get(player).clone());
double BLOCKS_PER_SECOND = (speed / tick) * 20;
flyspeedHashMap.put(player, (short) BLOCKS_PER_SECOND); // CAN BE IGNORED
String title = String.format("%.2f", BLOCKS_PER_SECOND) + "B/s";
bar.setTitle(title);
bar.setProgress(BomberJetRules.setBossBarProgress(BLOCKS_PER_SECOND));
bar.setColor(BomberJetRules.setBossBarColorRules(BLOCKS_PER_SECOND));
playerLocationHashMap.put(player, player.getLocation().clone());
}, 0, tick);```
I'm trying to calculate the velocity of a player. It works fine but I face spikes during the process e. g in a constant flying speed the BossBar drops by 2 Blocks and goes back to the actual speed.
hey, LegacyComponentSerializer.legacyAmpersand().serialize give me the component with &a, &7 etc.. i want it with the real hex color, how i have to do?
theres Entity::getVelocity which should give a consistent result, does that not work in this case?
?whereami
it is component, i have to color the lore, and the lore is in component
ah, spigot don't use component for new versions? sry
it does in some areas but it's not compatible with what paper uses
okok tnx
Actually I've never heard about this function. I'll give it a try. Thank you!
hey guys i want to change my project version
in intellij
how?
Project JDK version?
how can I cancel the book and quil gui opening when clicking a book as I did canceled the interaction event but it didnt work?
Isn't it client side
I believe it is
hey does somebody know where the damage is calculated when the player/entity is wearing armor?
Just search for EntityDamageEvent or something
i did but i didn't find what i was looking for
i am looking for the method where it limitates the maximum armor value wich is caped at 30 but i want to increase it a bit and everything i am trying isn't working
doing the calculation yourself is probably a better idea imo.
.getDamage in entityDamageEvent returns the calculated value, you can check item attributes of which are needed ie: armor
Quick question. I'm working on a plugin that adds custom enchantments to the game that behave exactly like vanilla ones (as in being in the enchantment table etc...). I was wondering if you guys know a way to make an enchantment table still show possible enchantments even tho the item might not be enchantable. For example if i put a gold block into the enchantment table it should still send the possible enchantments of that item. Do i need to alter a value with NMS that makes it so the game thinks every item is enchantable?
Probably something to do with tags now
https://hub.spigotmc.org/javadocs/bukkit/org/bukkit/enchantments/EnchantmentOffer.html
could also play around with this
declaration: package: org.bukkit.enchantments, class: EnchantmentOffer
Hey any idea why i got this error on bungeecord with maven? i shaded the language module but its still not working: 23:12:21 [INFORMATION] [/127.0.0.1:48288] <-> InitialHandler has pinged 23:12:23 [WARNUNG] Error dispatching event ChatEvent(super=TargetedEvent(sender=ItzYami04x, receiver=net.md_5.bungee.ServerConnection@66fdbf52), cancelled=true, message=/pl) to listener net.sabermc.module.commandblocker.listener.ChatListener@5296f00c java.lang.NullPointerException: Cannot invoke "net.sabermc.module.language.LanguageModule.getLanguageManager()" because the return value of "net.sabermc.module.language.LanguageModule.getInstance()" is null at net.sabermc.module.commandblocker.listener.ChatListener.onChat(ChatListener.java:26) at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:104) at java.base/java.lang.reflect.Method.invoke(Method.java:565) at net.md_5.bungee.event.EventHandlerMethod.invoke(EventHandlerMethod.java:19) at net.md_5.bungee.event.EventBus.post(EventBus.java:49) at net.md_5.bungee.api.plugin.PluginManager.callEvent(PluginManager.java:448) at net.md_5.bungee.connection.UpstreamBridge.handleChat(UpstreamBridge.java:223) at net.md_5.bungee.connection.UpstreamBridge.handle(UpstreamBridge.java:207) at net.md_5.bungee.protocol.packet.UnsignedClientCommand.handle(UnsignedClientCommand.java:36) at net.md_5.bungee.netty.HandlerBoss.channelRead(HandlerBoss.java:151) at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:359) at io.netty.handler.timeout.IdleStateHandler.channelRead(IdleStateHandler.java:293) at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:357) at io.netty.handler.codec.MessageToMessageDecoder.channelRead(MessageToMessageDecoder.java:107) at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:359) at io.netty.handler.codec.MessageToMessageDecoder.channelRead(MessageToMessageDecoder.java:107) at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:359) at io.netty.handler.codec.ByteToMessageDecoder.fireChannelRead(ByteToMessageDecoder.java:346) at io.netty.handler.codec.ByteToMessageDecoder.channelRead(ByteToMessageDecoder.java:318) at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:359) at io.netty.handler.codec.MessageToMessageDecoder.channelRead(MessageToMessageDecoder.java:107) at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:359) at io.netty.channel.DefaultChannelPipeline$HeadContext.channelRead(DefaultChannelPipeline.java:1429) at io.netty.channel.DefaultChannelPipeline.fireChannelRead(DefaultChannelPipeline.java:918) at io.netty.channel.epoll.AbstractEpollStreamChannel$EpollStreamUnsafe.epollInReady(AbstractEpollStreamChannel.java:793) at io.netty.channel.epoll.AbstractEpollChannel$AbstractEpollUnsafe.handle(AbstractEpollChannel.java:479) at io.netty.channel.epoll.EpollIoHandler$DefaultEpollIoRegistration.handle(EpollIoHandler.java:307) at io.netty.channel.epoll.EpollIoHandler.processReady(EpollIoHandler.java:489) at io.netty.channel.epoll.EpollIoHandler.run(EpollIoHandler.java:444) at io.netty.channel.SingleThreadIoEventLoop.runIo(SingleThreadIoEventLoop.java:204) at io.netty.channel.SingleThreadIoEventLoop.run(SingleThreadIoEventLoop.java:175) at io.netty.util.concurrent.SingleThreadEventExecutor$5.run(SingleThreadEventExecutor.java:1073) at io.netty.util.internal.ThreadExecutorMap$2.run(ThreadExecutorMap.java:74) at java.base/java.lang.Thread.run(Thread.java:1447)
Yeah also saw that, but it seems that you can't alter those on the PrepareItemEnchantEvent event
you can just fetch them
https://hub.spigotmc.org/javadocs/bukkit/org/bukkit/inventory/EnchantingInventory.html
maybe fake the item being enchanted? You’re not allowing the enchanting anyway I assume so I feel like that could work
Can we see your Code
import net.md_5.bungee.api.chat.TextComponent;
import net.md_5.bungee.api.connection.ProxiedPlayer;
import net.md_5.bungee.api.event.ChatEvent;
import net.md_5.bungee.api.plugin.Listener;
import net.md_5.bungee.event.EventHandler;
import net.sabermc.module.commandblocker.CommandBlocker;
import net.sabermc.module.language.LanguageModule;
import java.util.List;
public class ChatListener implements Listener {
List<String> commands = List.of("/pl", "/plugins", "/version", "/help", "/v");
@EventHandler
public void onChat(ChatEvent event) {
ProxiedPlayer proxiedPlayer = (ProxiedPlayer) event.getSender();
if(!proxiedPlayer.hasPermission("commandblocker.bypass")) {
String[] args = event.getMessage().split(" ");
if(commands.contains(args[0].toLowerCase())) {
event.setCancelled(true);
proxiedPlayer.sendMessage(TextComponent.fromLegacy(CommandBlocker.getInstance().getPrefix() +
LanguageModule.getInstance().getLanguageManager().getMessage(proxiedPlayer.getUniqueId(),
"commandblocker.message")));
}
}
}
}
I do allow the enchanting, but i'm just gonna try to alter the NMS code where it checks if the item is enchantable i think
or at least try haha
i know i already change the value inside the registry to my new maximum but it still doesn't change at all
It's shaded fine. The error is just telling you it's returning null for getInstance()
are you using onEnable to initialise it?
In modern versions you should be able to make any item enchantable
With NMS shenanigans
Yeah thats what i thought as well
so lets try to do that without breaking the game
But just wanted to ask in case there was an easy workaround implemented in spigot
package net.sabermc.module.language;
import net.sabermc.module.language.commands.LanguageCommand;
import net.sabermc.module.language.listener.LoginListener;
import net.sabermc.module.language.manager.LanguageManager;
import net.sabermc.moduleSystem.ModuleSystem;
import net.sabermc.moduleSystem.module.Module;
public class LanguageModule extends Module {
private static LanguageModule instance;
private String prefix = "§7[§bLanguage§7] §7";
private LanguageManager languageManager;
@Override
public void onStart() {
instance = this;
languageManager = new LanguageManager();
languageManager.init();
ModuleSystem.getInstance().getProxy().getPluginManager().registerCommand(ModuleSystem.getInstance(), new LanguageCommand());
ModuleSystem.getInstance().getProxy().getPluginManager().registerListener(ModuleSystem.getInstance(), new LoginListener());
}
@Override
public void onStop() {}
public static LanguageModule getInstance() {
return instance;
}
public LanguageManager getLanguageManager() {
return languageManager;
}
public String getPrefix() {
return prefix;
}
}
``` but im initialized the getInstance method
https://hub.spigotmc.org/javadocs/bukkit/org/bukkit/enchantments/EnchantmentTarget.html
ah shit yeah “all” doesn’t exist in vanilla anymore
How is it registering itself to your ModuleSystem
Yeah and also, setting the target items isn't a problem. I can enchant the gold block with the /enchant command just fine, but when i place it in the enchantment table it just doesnt fetch any enchantments cause it thinks the item isn't enchantable
without actually checking its possible enchantments
Yeah you gotta add the item to one of the enchantable tags
^
There’s gotta be something better even if it is nms cuz that just means you have to apply all tags to every item right?
There are a bunch
here it loads the modules: ```java
public void loadModules() {
try {
File[] array = this.dir.listFiles();
if (array == null) {
System.err.println("No modules found!");
} else {
for (File file : Arrays.stream(array).filter(Objects::nonNull).filter(this::checkJarFile).collect(Collectors.toList())) {
JarFile jarFile = new JarFile(file);
try {
JarEntry entry = jarFile.getJarEntry("module.yml");
Preconditions.checkNotNull(entry, "Addon must have a module.yml");
InputStream in = jarFile.getInputStream(entry);
try {
ModuleDescription description = new ModuleDescription(ConfigurationProvider.getProvider(YamlConfiguration.class).load(in));
this.initializor.initModule(file.getName(), description);
} finally {
if (Collections.singletonList(in).get(0) != null) {
in.close();
}
}
} finally {
if (Collections.singletonList(jarFile).get(0) != null) {
jarFile.close();
}
}
}
}
} catch (Throwable var18) {
try {
throw var18;
} catch (IOException e) {
throw new RuntimeException(e);
}
}
}```
I believe these are all the tags
and here its triggers the onstart method ```java
public void initModule(String file, ModuleDescription description) {
try {
URLClassLoader classLoader = new URLClassLoader(new URL[]{this.moduleManager.findModule(file).toURI().toURL()}, this.getClass().getClassLoader());
Class<?> clazz = Class.forName(description.getMain(), true, classLoader);
if (clazz.isEnum() || clazz.isInterface()) {
return;
}
Object instance = clazz.newInstance();
if (!(instance instanceof Module)) {
return;
}
Module module = (Module)instance;
module.onStart();
this.moduleManager.getModules().add(module);
} catch (Exception var7) {
System.err.println("Error enabling... " + description.getName() + " - " + description.getMain() + " - " + description.getVersion());
}
}```
and why are you trying to reinvent the plugin system
but do you mean the list specific to a certain enchantment cause that i know off, but i should be able to alter a set of materials that store in general if that material is enchantable
Yeah this is completely unnecessary
Btw is there a list somewhere where i can find all minecraft tags?
plus since it's shaded it won't have a jar, so it won't be loaded
or docs
declaration: package: org.bukkit, interface: Tag
There isn’t a generic enchantable tag
and here its load the modules: ```java
@Override
public void onEnable() {
instance = this;
this.getDataFolder().mkdirs();
this.moduleManager = new ModuleManager();
databaseAdapter = new DatabaseAdapter();
getProxy().getConsole().sendMessage(TextComponent.fromLegacy("§8[§bModuleSystem§8]: §7Trying to start..."));
loadModules();
}
private void loadModules() {
getProxy().getConsole().sendMessage(TextComponent.fromLegacy("§8[§bModuleSystem§8]: §7Loading modules..."));
getModuleManager().loadModules();
if(ModuleDescription.DESCRIPTIONS.isEmpty()) {
getProxy().getConsole().sendMessage(TextComponent.fromLegacy("§8[§bModuleSystem§8]: §cFailed to load modules: No modules found."));
}
}```
Have you verified that it's loading the LanguageModule correctly?
mm yes sending messages to the console sender
I think minecraft:enchantable_durability is the most generic tag
Yea it loaded fine: 23:22:34 [INFORMATION] [ModuleSystem]: Successfully connected to the MySQL database. 23:22:34 [INFORMATION] [ModuleSystem]: Trying to start... 23:22:34 [INFORMATION] [ModuleSystem]: Loading modules... 23:22:34 [INFORMATION] Loading module » LanguageModule
Blocks have durability now right? Isn’t it in relation to the stack size?
Is that the shaded one though?
Presumably you can just add whatever to that and then manually remove unbreaking in the PrepareEnchantingEvent
the shaded one is a seperate module called CommandModule and thats loaded aswell
Idk it’s really hard to tell man
If you have such an elaborate system you should have measures of testing and debugging it
Yeah also just saw that. And creating a new one: for example enchantable/all would be a bad idea or will it just not load that?
I cant tell you much without going through the whole thing
I thought the all tag got deprecated
It’ll load it
But it won’t do anything
The actual enchantments themselves control what items they can be applied to
Idk if just registering a custom enchantment that can be applied to an item will make that item be valid in the enchanting table
hmm i see
Well no it doesn't cause thats what i'm trying to solve xD
registering the enchantment and setting supported items works fine
Sounds like you found yourself a free pr
Did you set the enchantment to appear in the table
yeah
There’s a tag for that
yeah the in_enchantment_table i think
and i set that yeah
The enchantment table works fine for any items that are enchatable in the base game
just not for other items
e.g. gold blocks
My bet is you’re accessing an instance of the class that wasnt initialised
I'll just try adding gold block to the enchantable/durability tag for now and see what that does
(Which your get instance should be checking for anyway)
I’d still look for a better solution cuz again I feel like this means you have to add the tag to every item
I don't think i do tho? Cause that tag stores item types
correct me if i'm wrong, but if i add gold_block to enchantable/durability, then when i add gold_block in the enchantment table it will check if its enchantable, then see it is by checking enchantable/durability. Then send back the enchantments of gold_block in the enchantment table
Thats what im hoping at least
I mean in the sense that you’re not just handling a single block/type, you’d still have to tag every possible item that you’d want enchants to show up for if I’m understanding
prob just coping lol
Still have to manually add all the types in this case tho
yeah, but in my registering for every item that is added to the supported items of the enchant i could add it to the enchantable tag
yes
but thats no problem
in my system at least
No it’s not a problem, just feels like it’s a lot of work for the use case
I mean i'm trying to build a custom enchantment builder for players with as little work as possible
I can send you a youtube video of what i already have if you're interested
and in my use case the user just specifies the item types the enchanment should go on
then i just register them
I mean if you can use the api over nms… api always but still
not a lot of work
with 'i' i mean the plugin ofc
yeah but a lot of stuff is just not possible with the api
Manually adding all types just to get possible enchants to show up, I figure you can “mask” the item in the table with some item that would show all the possibilities… might be easier
registering enchantments for example
Yeah idk how the game determines if an item can be enchanted
I figured there would be a generic tag but I guess not
just gonna test some stuff out
i'll let you know the results if i figure something out
@young knoll @worthy yarrow i finally figured it out. It's actaully really not that difficult once you know it.
You just need to add the DataComponents.ENCHANTABLE to the DataComponentMap. You do need reflection to set the newly built componentmap, but otherwise i think its quite safe.
// Example for GOLD BLOCK
DataComponentMap.Builder builder = DataComponentMap.builder();
builder.addAll(Items.GOLD_BLOCK.asItem().components()); // Copy old entries
builder.set(DataComponents.ENCHANTABLE, new Enchantable(10)); // Add new entry
DataComponentMap updatedMap = builder.build();
Reflex.setFieldValue(Items.GOLD_BLOCK.asItem(), "components", updatedMap);
I wonder what other cool stuff you could do by adding other DataComponents to items tho
Tbf I don’t know much about DataComponents
Seems like they are components built in to items?
Seems you can also set it per item stack
Items no longer operate on a big ass nbt component but rather as a list of "features" let's say
Where you have the base type and amount, everything else being controlled by components
Yeah I know that
But this seems to be something on the internal item field itself
So I assume it’s some kind of default component list
the prototype
the item definition itself has a set of item components which define all of the "material's" behavior, e.g. a stone pickaxe will have the Tool component
on top of that, item stacks will "patch" the component map with additional components, e.g. the durability of the iron pickaxe is in the patch which is applied on top of the "prototype" provided by the item definition
Yeah makes sense
Hello, I'm a little lost with how to do this and I'm wondering if one of y'all can help. I'm trying to make a stat that increases the speed to mine blocks. but I can't figure out how to increase the speed to mine blocks. any ideas?
you can add attribute modifiers to the player for the block_break_speed or mining_efficiency attributes
Hi , is there any simple way to get free project for get better resume and upgrading my experience and more learning in projects ?
You can just come up with your own plugins, that is free and gives you experience.
Or you could always offer free development services on the forums and see if anyone contacts you.
?services
If you wish to request or offer development/art/building/administration services, please do so at https://www.spigotmc.org/forums/services-recruitment-v2.54/
I wouldn’t do that lol… well the last part, you’ll get so many people contacting you about probably huge projects and things not worth the time given you’re doing it for free
just be like everyone else and remake hypixel skyblock but shittier
or donutsmp

Hey guys what is the best spigot-repo to use for creating plugins for mc 1.20.1 i can only find 1.20.1-R0.1 SnapShot is there any newer one or more stable one for 1.20.1 Spigot Api ?
and that will work fine with MC 1.20.1 ? i am new to all of this so still trying to learn sorry for dumb questions
hmm nvm i tried that 1.21.5 but i am still geting my error's i was told it was because of spigot api do any of you know how to fix this error here
[ERROR] /C:/Users/IdeaProjects/NoName/src/main/java/com/nnn/nnnsn/commands/AddCommand.java:[38,42] cannot find symbol
symbol: method hasCustomName()
location: variable heldItem of type org.bukkit.inventory.ItemStack
[ERROR] /C:/Users/IdeaProjects/NoName/src/main/java/com/nnn/nnnsn/commands/AddCommand.java:[38,69] cannot find symbol
symbol: method getCustomName()
location: variable heldItem of type org.bukkit.inventory.ItemStack
[INFO] 2 errors
That method is part of ItemMeta
is there a particular reason you're using 1.20.1?
anyhow, if you want to work with 1.20.1 then using the spigot repository is fine, that'll have the latest available version for spigot 1.20.1 (whenever that was released)
make sure to set your api-version to 1.20 as well as using 1.20.1 API in your build script
is there a way to set blocks faster than fawe api? fawe api is fast but i want to change 4.5m blocks in the blink of an eye (i saw some server doing that)
it doesnt have to calculate lighting and all that stuff because all players have night vision anyways
Fawe is pretty much doing that
wait i noticed this
.relightMode(RelightMode.OPTIMAL)
if i make it NONE will it perform better
?tas
Yeah but it also won't relight
.
how do i run code after it fills the regions?
i want to teleport players to the surface after it's done
oh they have
don't you just put the edit session in a try with resources and execute whatever you need to execute afterwards
EditSession#close is blocking so that should do
yeah i just figured that out
my take: multiversion plugin jars are awful
it should be CI/CD pipeline jobs to version packages to specific minecraft versions
instead of developers with nasty reflections and leaky abstractions for multiple minecraft versions that might not make sense
they're only awful because the platform doesn't officially support it
it'd be fine if Spigot supported modules for example
i wouldnt even say that wouldnt be awful if it did support it. Look when you're configuring your own server, you are as a sysadmin of server software responsible for managing versions of plugins and other software
instead you bake in some bloat into your whole plugin just to make that not an issue for a sysadmin
worst of all sometimes you have to do compromises for features since newer versions of minecraft clients support better features usually and you need to downgrade your own plugins because something doesnt work in backwards compatible way
it'd be more reasonable if 50% of the people using these plugins weren't kids
but sadly that isn't the case, so you got to make it as dumbed down as possible
but it wasnt that a case in the old days of craftbukkit
each minecraft plugin had its own specific mc server version and package for each server version the plugin supported
something changed during the start of spigot's timeline around 2013-2014 that made multiversion jars popular
well, the bukkit frontend encouraged per-version jars, while spigot's one encourages single-jar downloads
the same way it's much more common in modrinth to have per-version jars since the platform encourages that
it really isn't about not making it an issue for the sysadmin rather when it comes to resources on spigotmc it doesn't really support multiple version specifications. In order to get something like that you need to have multiple resource pages of the same plugin for each version of mc
craftbukkit's dev site for plugins supports specifying specific uploads for specific mc versions and labels them
Hey I saw that this method is marked obsolete. What is the "up to date" way to send a message to a player?
Sending with a component
see first "see also"
?whereami
ah okay
yeah I'm using components now just noticed the obsolete tag on the older text
I just don't like how many inline methods the components have so I might just make a wrapper util
you can use the mini-message based methods too
Could you send me a link to the docs?
if it is just for sending chat messages, you can use Player#sendRichMessage and you don't have to deal with all the bs that is setting up the MM serializer
but there should be documentation about that as well in the API page under MiniMessage section as well
personally unless i need hover/click events or rgb colors i always stick to the legacy string color codes
alright I'll take a look. I can deal with the components system but I'll write a small wrapper class to reduce the amount of methods
the methods in adventure are meant to be statically imported so that they look less verbose-ish
it might not seem like it makes much difference, but it does. Take for example:
player.sendMessage(Component.textOfChildren(
Component.text("This is a layered message", NamedTextColor.RED),
Component.newLine(),
Component.text("Click here to run /home").clickEvent(ClickEvent.runCommand("/home"))
);
vs:
player.sendMessage(textOfChildren(
text("This is a layered message", RED),
newLine(),
text("Click here to run /home").clickEvent(runCommand("/home"))
);
does the api itself recommend to statically import as per the docs?
I don’t know
I am sure I’ve seen adventure people recommend it on discord but I don’t think they explicitly mention it anywhere
i wonder if there's any successful attempts of syncing player inventories with a database which are not buggy
the reason i dont do free plugins anymore
well without making use of heavy reflection, you would need to modify the server code
but it can be done
unless you justt want a copy of their inventory in DB
which is real easy to do
im thinking of trying to make a hybrid server network where one server is custom one made through minestom and another is NMS based one, basically one server is for mostly custom stuff and nother for SMP stuff
they're both technically part of one server but would be in a network of a sense
minestom + fabric
but that's sounds complex to do with NMS
i just cant seem to find any good syncing solutions between minestom and NMS one
that would involve lots of NMS hacking with mixins i guess
If you want to use a mixin you could just put one where it loads the playerdata
and make it grab inventory from db there
like what for example?
oh loading maybe be easy but what about persisting existing inventories
Hello. I don't mean to bother anyone but can any developers read this and let me know.
?services
If you wish to request or offer development/art/building/administration services, please do so at https://www.spigotmc.org/forums/services-recruitment-v2.54/
You can just bulk move exiting player inventories in to the database once
like a scheduling task or smth?
i once got 1 stared because my free plugin didnt auto install itself on all bungee servers and he had to do it manually
I just don't worry about reviews ever
Just checking them on server startup is fine
funny how some seem to live for those 5 stars
might take a while if the server has a ton of players, but it's probably fine since it's only being done once
alternatively just check the file as a fallback when missing in db
server start up times really shouldn't be a concern
oh you want to still use flat dimension file storage and when server opens/closes persist that data with the database?
its quite normal for game servers to have start up times of 5 minutes
I was talking about persisting the inventories in the db
instead of on file

i guess yeah, but what if lets say player switches from one server to another and he wants to keep the same inventory across servers, that means i need some kind of in memory database server
this seems like a solution to a problem where a inefficient monolith would be better
not really
make use of limbo mode
That's only really needed if the player switch servers often and there are a lot of them
that's not what i mean, i mean how to sync those inventories across the server without getting dupe exploits from desync issues
use some logic and make it work
limbo mode is where you put them in an area temporarily until data that is absolutely needed is obtained to then set them free into the server
its hilarious how some concepts have been forgotten magically
this is like asking how to code in java... learn it yourself.. code.. debug.. learn.. plan before you do a big project
its more like not understanding that concepts exist in how to handle when data is not available. Many people want speed and fast for everything and it can't be any other way
elaborate
when reality is, no one really has an issue waiting in some temp area for a few minutes at most
wdym by in area temporarily
loading screen/loading area in a minestom server for example
while it grabs data from db
oh
yeah this is why is the best to do a little research before doing anything.. think things through.. dont rush things
you make an area or world in the server where players can be placed and can't interact with the normal stuff in said server until data you absolute need is loaded for them
Probably overkill though since getting it shouldn't take that long
once that happens, you then teleport them to the place they are allowed after that
yeah that's not the problem i already do this
the problem i can see is that i dont see really good solution to build the glue code to NMS
ok, then switching servers shouldn't really be an issue
its all looking hacky as shit
serializing a inventory in db shouldnt take longer than a few ms
probably, but it never hurts to incorporate it in case though
handy for other scenarios like if your DB server went down or the connection died etc
then you don't just have players running around with all kinds of stuff because everything is erroring lmao
i know that, im just thinking for a solution that would help to sync the inventories when switching between servers on the network, like maybe persist changes on some kind of server switch event
i've never worked with proxy plugins
tbh
You'd block the prelogin? The player would be stuck on the login/loading screen
sure you could do that, however many people won't wait there log though
and allowing them to be in a temp area lets them talk and maybe do some things while stuff gets fixed etc
that isn't what I meant
I meant its handy to have such areas for your worse case scenarios
IE, DB died for some reason
I just wouldn't let the player in since there's no point in doing so if db is down
also i see more problems to it, if i want to sync inventories between minestom and nms i need to register every single item on the game
i feel like its just easier to use fabric or paper altogether without any minestom
sure we have our differences in how to handle that
I have no issues letting players connect and chatting in the common area that has nothing to do with the rest of the server until stuff gets fixed 😛
where as you, would rather let them be stuck on loading screen for however long that takes
until they realize they need to force close MC or hit the x button
I mean your solution probably is the better way of doing it, it's just not worth the time to implement when you're just getting started or have a small player base
it would be cool for mojang to implement in the client server sided prelogin status messages that could update whilst connecting to the server
something like ping based animated motds we had in 1.7 era
Hi! I have a question, is there any plugin for npc besides citizens that is paid? for spigot 1.20+
you want a paid npc plugin that is not citizens?
odd
citizens is free you just need to look at the description
you passed null value to @NotNull ItemStack stack parameter?
the problem i faced with this was, that velocity connects players to the target server before they get disconnected from the source server, meaning the inventory needs to be available on the new server before the client disconnects from the old one
now i have a redis server to store inventories. in the velocity preconnect event i publish a redis message requesting the inventory of the connecting player to be saved and read it from redis on the backend server as soon as they connect
in the time between saving the inv to redis and disconnecting you can theoretically dupe items but thats veryy unlikely and i dont know a way to circumvent this without modifying either minecraft or velocity substantially
did you just exposed a dupe for your server on a public discord server :D?
i mean that's very hard to pull off and requires timing
you can probably make a mod which drops an item by sending a packet before disconnecting from the server
and now you have the same item on server B since you captured snapshot of inventory before disconnecting and on server A you still have the original item dropped
well you are disconnected by velocity so its even harder to pull off
if your client disconnects, you get disconnected from velocity
i dont care, its not big enough
if youre on 1.20.5 and have access to the transfer feature i would just put the inventory in a cookie
:/
[16:22:23] [Server thread/ERROR]: Error occurred while enabling Citizens v2.0.38-SNAPSHOT (build 3806) (Is it up to date?)
java.lang.NoClassDefFoundError: org/bukkit/craftbukkit/v1_21_R4/boss/CraftBossBar
at Citizens-2.0.38-b3806 (1).jar/net.citizensnpcs.nms.v1_21_R4.util.NMSImpl.<clinit>(NMSImpl.java:2746) ~[Citizens-2.0.38-b3806 (1).jar:?]
at java.base/java.lang.Class.forName0(Native Method) ~[?:?]
at java.base/java.lang.Class.forName(Class.java:534) ~[?:?]
at java.base/java.lang.Class.forName(Class.java:513) ~[?:?]
at io.papermc.reflectionrewriter.runtime.AbstractDefaultRulesReflectionProxy.forName(AbstractDefaultRulesReflectionProxy.java:68) ~[reflection-rewriter-runtime-0.0.3.jar:?]
at io.papermc.paper.pluginremap.reflect.PaperReflectionHolder.forName(Unknown Source) ~[paper-1.21.jar:1.21-130-b1b5d4c]
at Citizens-2.0.38-b3806 (1).jar/net.citizensnpcs.api.util.SpigotUtil.lambda$getMinecraftPackage$1(SpigotUtil.java:175) ~[Citizens-2.0.38-b3806 (1).jar:?]
at Citizens-2.0.38-b3806 (1).jar/net.citizensnpcs.api.util.SpigotUtil.getMinecraftPackage(SpigotUtil.java:180) ~[Citizens-2.0.38-b3806 (1).jar:?]
at Citizens-2.0.38-b3806 (1).jar/net.citizensnpcs.Citizens.onEnable(Citizens.java:326) ~[Citizens-2.0.38-b3806 (1).jar:?]
at org.bukkit.plugin.java.JavaPlugin.setEnabled(JavaPlugin.java:288) ~[paper-api-1.21-R0.1-SNAPSHOT.jar:?]
Probably looking at a 1.21.5 build you'll find the right one eventually
You say spigot is better than paper?
Use a distributed lock
Paper has its own discord server
i wonder if someone tried to port glowstone server parts to minestom
If seen people use vanilla parts but not glowstone 🤷♂️
how would that fix it
i cant just "lock" a players inventory
The lock would interrupt the loading process if a save is occurring
it's a latency issue
its the fact that minecraft allows modification to the inventory on the old server while the player is already connected to the new server
which would be hard to circumvent
push the inventory once the player has disconnected
use a lock to prevent it from being loaded on the new server (blocking in async prelogin) until the old server is done pushing it
blocking in prelogin doesnt help because the player wont disconnect from their old server until they are connected to the new one.
and i need the inventory as soon as the player connectes because overwriting it once its available might have other bad side effects
i'm fairly certain the player disconnects from the old server before they can start logging into the new server
They do, but its so fast that no DB can update before they are in the new server
that's what the lock is for
yes but you can;t place a lock which is detectable by the second server in time
DB has not updated
sure you can
you can, im doing it this way right now and it works even on localhost with no delay
The safest way is to give them a blank inventory on join for a few seconds
what if they collect an item in this time, its gone then
you are talking fractions of a second.
all this is so much more complicated just to fix a highly unlikely dupe
just use a lock for it, databases support transactions and locking primitives
or delay every player in the pre login to give the db time to update
e.g. you can have the server the player is on lock the row holding the inventory data such that other servers can't use it until the lock is released
when the player disconnects, push changes and release the lock; the destination server will block the prejoin event until the lock is released, and will get the freshly pushed data, and locks the row for itself in an atomic transaction
well if this is the case then that works, but in my testing they didnt
I'm sorry for asking dumb question but tell me in one sentence what u tryin to do? (don't want to read it all lol)
Pretty sure when the disconnect event fires the player is already gone/negotiation with the other server
sync inventories between servers connected via a proxy
ye but it fires after they connect to the new server
yes
if the disconnect happens after the connect, then dunno, i don't see any way of actually doing it cleanly in such a case
so you can;t lock the db as theyt are already gone
add a delay on every pre connect
that won't work either if the player is still connected to the origin server
as their inventory may still be undergoing changes
give the old server time to lock/update the db
it'll only be safe to save once the player is disconnected
but if disconnection happens after connection to the new server, then by definition you're already on the new server before that happens
yep
so waiting won't help here
if you wait for 10 seconds in prelogin, the player just stays connected to the old server for 10 seconds longer
the race is unaffected
it will. it gives the old server time to run the event and update teh db,. The new server delays the login, then fetches the updated inven
yes, but you can't save before the player is disconnected
not an issue of time
if you save before disconnection, you risk missing changes being made to the inventory and duping/losing items
the two servers do not sync. the disconnect fires after the player has left but during the new server login
its litterally the proxy droping the connection to the old server and routing to the new
if you can get the player to disconnect from the origin server before they complete login on the destination server, it will work, but this has nothing to do with waiting in prelogin
if you can't, you need to jump through additional hoops
i am actually not sure if they disconnect first when blocking prelogin, but i assume they dont because you probably cant reconnect them to the new server then
hmm. interesting.
wait so different servers same inventory
we can't really sync after prelogin either without blocking the server thread of the destination server for the db query, though that's probably acceptable if the db is on the same machine
is it like horizontally scaled or completely different concept server?
an option is to toss the player to an intermediate server first so that they disconnect from the origin server, and then send them to the destination server, but this seems overkill
yeah well. you could send him to kind of a lobby. he won't notice it probably
but yeah. it would work.
they will definitely, you get the loading screen twice
and with mods that takes ages
good point.
this is somewhat suboptimal but you could listen to and cancel inventory interactions/item pickup manually after saving the inventory, to prevent it from being changed
well i mean the issue sort of is that the inventory is loaded and mutable on two servers at the same time during the transfer (supposing origin-disconnect really does fire after target-connect)
doing things faster or imposing delays isn't going to help with that
well the disconnect does fire after connecting, because i tried the save aproach first, what i dont know is if it fires after when prelogin takes longer
block inventory modification until it's loaded
How did you figure this out?
yeah. well like i said. minecraft doesn't give you a simple solution, go outside the box.
in both backend servers i injected into the save method to save it into redis, and that happened after it was loaded
connect each player to a redis, use locks to prevent mutation of the inventory
And you didn't consider the latency between your instance and redis?
unlock it once the target server read it (locked for source server)
and vice versa
yeah well depends
same machine? no
different machines yes
If you're opening a new connection to redis it can take 50ms
reusing a connection can make that 1ms
Your test is being influenced by external factors
reusing the connection would be more optimal
locking on redis doesnt help because minecraft will still modify the inventory, weve discussed this thrice by now
Then prevent it
my bad
it is true that the disconnection is delayed at least on velocity, idk about bungee, since if you try connecting to e.g. a whitelisted backend, you won't disconnect, fail to connect, and reconnect to the origin server; you just get a message in chat with the disconnection message
i.e. you stay connected to origin despite trying to connect to the target
Sure the connection fails on the LOGIN phase but it can still disconnect the player before advancing to PLAY
i'm not sure exactly at which point you do get disconnected from origin
you can even read it in velocity's logs, that it connects before it disconnects
after the target accepted the player
Inconclusive
is there a phase in between those where
- the target server inventory is not yet accessible for modification
- we can block asynchronously (without halting the main thread) to wait for origin server to save and receive the saved inventory from the db?
an option is the PlayerJoinEvent on LOWEST priority, at which point other plugins are relatively unlikely to yet fiddle with the inventory, but that's sync and blocking that for a millisecond or longer is haram
i would listen for the quitevent on source then somehow communicate to target that the source is done and saved everything and then target would get the info. might not be the best idea tho.
including locking it (would take some implementation with other plugins that access inventory)
if you lock it you dont need the other stuff
what instead of going server level we go proxy level. and "transfer" the inventory from proxy level when the player switches?
we would get rid of the communicating thing
this would not fix anything
the inventory still exists modifiable on the old server
personally i vouch for killing the player after saving the inventory so it can't be changed between saving and disconnection, and blocking on async prelogin on the destination server
if only because killing the player would be 🤡
alternatively, uh, i think if you manually kick the player from the origin server and then control the "fallback" functionality on velocity side, you can have the player disconnect from origin before even starting to connect to the target
hmmmmm
since by the time velocity realizes the player is kicked, the player is already kicked
this'd be incompatible with any proxy plugins manually sending players around as well as the default /server command etc. so not ideal either, however
but taking care of those might be easier than taking care of all inventory interactions
the most robust and probably straight-forward way is just to have an intermediate lobby server in between, but that does still seem like overkill and does suffer from increased loading times
if anyoone ends up duping i can think about this but for now its fine enough
I’m using a block display and I am using “block#getData” but when I try to display the block over the current block it doesn’t fully work for items like bamboo where they aren’t necessarily at the center location of their block. I kinda understand that, because I am spawning the display on the center of the block, but does anyone know how to spawn it sometimes off center if it is something like bamboo which isn’t centered?
thanks! I'll look into that
Hi, I have spigot 1.21, what npc plugin is compatible with this version?
Citizens
is there any hack to adjust draw order of container titles in minecraft?
im kinda new into resource packs, and first initial thought was core shaders, but i cant find anything particularly useful related to draw order
OlivoNPCs
hire third world country children to roleplay as npcs on the server
it's like chatgpt but cheaper
wonder how much you could charge for this 🤔
make an offer
\
its not a problem for me as i do have 32 gb of ram
but man is it sad to see such ram usage
i hate multi process browsers
someone should bring tiling windows into browsers
my firefox processes take up 25gb memory in total, though not all of that is in the active working set
kmp dev
that way there wouldnt be 50 tabs opened at the same time because you forgot it
it's not even an issue with the number of tabs, it's just monkey tier programming
dockers running, ktor server, android qemu, idea, firefox, spotify and discord
my old single-process browsers like palemoon run on under 2gb for hundreds of tabs
like just a bit of ram is being eaten rn
i've tried palemoon and it ran like crap for me for some reason
it was all stuttery for no reason
well it's old and mostly single threaded
but i'd still take it any day of the week on older hardware where you can't run shit on 32 cpu cores and throw 32gb of ram at it
the thing is i dont remember older pcs struggle that much with performance even if they were low tier compared to today
i feel like today's software is enshittified in a way that even basic functionality needs like mid tier pc to even work properly
windows xp could run on 64 mb of ram
512mb of ram were standard
for sure, for my low end machines i still use palemoon and other, older and lightweight software
they stopped optimizing
is the problem
half of the software r&d cost nowadays is dumped on the user in the form of "get more cpu cores to run the embedded browser so we don't have to figure .net"
i feel like its all agile's fault
basically since it is no longer for PC's to have 8-16GB on average
they stopped optimizing memory usage
and then games bloated into the hundreds of gigs because internet speeds got better so they stopped optimizing and basically no patching happens, just download the game again
they stopped optimizing anything, even heavily networked applications for example web apps take like 50 mb for basic static site
in other words developers became lazy
thats sad
indeed
cool apps were my primary point of choosing this field. I had the influence from my relatives who worked with computers mostly sysadmin but man it was fun to grow up with him, and now it feels its all gone
it irritates me when updates can be just mere megabytes instead of just redownloading the entire game again. Or that applications that are supposed to be not resource intensive are in fact resource intensive IE browsers
funnily enough i like torrents not because you can pirate things but because you can select what you can download 😄
it's not even devs being lazy, it's corporate being greedy; dev time costs and when optimization is optional you won't want to pay for it
i sometimes download through torrents just because it saves data for me since i dont need readme files, sdks and other shit
Yeah why do a lot of games do this for small patch updates and what not? Could you not just patch over the bit you're trying to fix and not make people redownload the entire thing
again. Its all agile's fault
vcs2 answered it other then devs being lazy
agile prefers half-baked products instead of flushed-down ones
So it takes more work to apply a patch over the whole code base instead of a small snippet or what have you
but it really did start with devs being lazy though and not corporate greed. Someone somewhere had the idea to shave time to just not optimize the patching etc
and just full send it
well, only the end user is affected
other then some bandwidth being used up
but cant you do this for anything basically by doing diffing of files and patching the binaries. it doesnt even require developer intervention, it can be integrated into distribution
the developers shaved "time" but really didn't
this is how binary patching works
and is basically the best way to go about patching usually
hello.. i got a question 🙋♂️
minecraft sends/used a multiplayer.message_not_delivered message through SYSTEM_CHAT packet when a message is not delivered
did that by chance change in 1.21.5? (or maybe 1.21+)
but if you send correct signature with the patch it shouldnt right
it doesn't, its just an extra step when you release an update though because you still have to compile
the update
at least 1 time
and then you can diff
but instead of doing that extra step they just compile and send
Well like eve for example, they have a client launcher and whenever an update occurs it just applies the patch over whatever bit they changed instead of reinstalling all files, is this easier because of the fact they introduced a launcher? or is the application of the patch still the same either way
you need software on the receiving end to actually do the patching
...well after thinking about it, steam is a launcher in itself so I guess it makes sense that it could be considered laziness
i.e. you need foresight
and when RAAAAH deadline the day after tomorrow massive crunch time you don't have foresight
you just ship it out as-is and worry about it later
Yeah I suppose
just seems like little work to make things easier on everyone
I figure with a legit patch system though, you'd also be introducing more security when it comes to the code base... not that it's exactly needed per se
I also know little of genuine game dev 🤷♀️
Someone knows why the whole chat-system breaks if i set the minecraft.command.me permission to false and use /me?
Does it still break if you rejoin the server / use player.updateCommands
this is mostly due to the fact that eve online comes from the period of time where optimizations like this mattered and they just haven't changed it
eve online was released in 2006 if I remember right
so xp was still prevalent and windows vista wasn't released until 2007
oh also is there a packet that verifies packet ids sent to the client?
maybe the message is client-sided now
Thank you! #updateCommands has helped :)
Hi im developer of this plugin and your reviews and suggestions would help me alot, thanks in advance!
https://www.spigotmc.org/resources/castle-siege-king-teams-kits-abilities-coins-multi-arena-stats-map-more.115123/
found a fix to this i think, just cancel sneaking while in vehicle
i dont know if this is necesary but as a precaution the player gets demounted and remounted after the event is cancelled
You mean #1100941063058894868?
I've been working on this plugin that lets the user define enchantments and then register them in the game so they work exactly like vanilla ones. What i've been working on now is that they can specify what are the "targets" for the enchantments. This is a list of strings that represents item or block tags (e.g. minecraft:swords, minecraft:gold_block, minecraft:enchantable/durability...). Using NMS i then get the references to those Item Holders and add them to my custom enchant tagkey for "target" items. Everything works fine, but i feel like right now the code is not optimal at all. https://gist.github.com/LGDTimtou/a7e18c87fe7addac0cbbce5a6b6786fb
I first look through the ITEMS registry and then if i can't find them in there (because its a block for example) i look through the block registry. I was just wondering if there are any NMS gods here that could tell me if i'm just doing some redundant stuff and maybe make this code less bloated.
Ok but why, datapacks already can define custom enchantments
for when your death chest needs that extra zing
I don't think i can make a gold_block enchantable with datapacks tho
and also just way more flexibility
I don't see why you couldn't
vanilla enchants are all datafied, I think the system is quite flexible already
"supported_items: Any number of item(s) (an [String] ID, or a [String] tag with #, or an [NBT List / JSON Array] array containing [String] IDs) — Items on which this enchantment can be applied using an anvil or using the /enchant command."
items aren't blocks or other
Also you only have a limited set of effects that an enchantment can do
Not really that flexible to me
But i mean its kinda besides the point i was just asking if someone knew a way to fetch the Item Holders in a cleaner way xD
Ye, this allows you to add the support to those items
And blocks are only the thing that are placed in the world, you need an item to place it.
Most blocks have an item to them.
Ye I understand
For that some modding server (like fabric) would be best probably
Don't think blocks fall into that category tho: https://minecraft.wiki/w/Item
Also when you put a block into the enchantment table it will never show any enchantments, because it doesn't have the Enchantable DataComponent.
I did find a way to alter that behaviour, but thats another thing that wouldn't be possible with datapacks
Yes it does tho ?
Lemme check the reports
I mean if you click on the "items" it refers you to that link i sent you which doesn't show any blocks
and blocks and items have a different registry assigned to them
so the item and blocks tags are seperated as far as i know
i'm almost certain that you can't make enchantments for blocks without changing NMS behaviour
the item for blackstone has "enchantments" component
so it can hold enchantments
I guess you're right with the enchantable component tho
That does require NMS to set by default
Yes, for blocks and for items
I can't explain stuff well but for example "blackstone" which is both block and item has an entry in both
So your search through blocks should not be needed
At least that's my understanding
I see, thank you. The problem was that with the code i had right now when i tried to search for a tag in the ITEMS registry (e.g. grass_block) it didn't find it
so thats why i went to look in the BLOCKS registry where it does find it
Very angelic
so i need help to fix this class thing were if i touch water i get damage but when i choose the class it no work'-'
?nocode
It’s hard to answer a programming question without code
Oh no! You ran into a problem. But no worries, people are willing to help, but first they need to see your code. This is because otherwise, they would be providing help based on guesses instead of concrete knowledge. Whether it be a compile error, runtime error, or an unexpected output, I'm sure that if you were to provide code, you'd receive a quick solution.
// For Lava Walker effects
@EventHandler
public void onPlayerMove(PlayerMoveEvent event) {
Player player = event.getPlayer();
if (!org.sportymp3.starter.RacesCommand.getPlayerRace(player).equalsIgnoreCase("lava walker")) return;
Location loc = player.getLocation();
// Fire damage boost - check if player is on fire
if (player.getFireTicks() > 0) {
// Apply effects with proper duration and show particles
player.addPotionEffect(new PotionEffect(PotionEffectType.STRENGTH, 100, 0, true, true));
player.addPotionEffect(new PotionEffect(PotionEffectType.FIRE_RESISTANCE, 100, 0, true, true));
} else {
// Only remove if they have the effects
if (player.hasPotionEffect(PotionEffectType.STRENGTH)) {
player.removePotionEffect(PotionEffectType.STRENGTH);
}
if (player.hasPotionEffect(PotionEffectType.FIRE_RESISTANCE)) {
player.removePotionEffect(PotionEffectType.FIRE_RESISTANCE);
}
}
// Water/rain damage
if (player.isInWater()) { // Better check for water
player.damage(2);
return; // Skip rain check if in water
}
// Rain damage check
if (player.getWorld().hasStorm()) {
// Check if player is exposed to sky (more accurate than highest block check)
if (player.getLocation().getBlock().getLightFromSky() == 15) {
player.damage(1);
}
}
}
And where do u set the race
in a command
?paste
Please for both
paste stuff
click save
send link
Why do you need to qualify this "org.sportymp3.starter.RacesCommand"
*looks at imports*
I feel like one of those is wrong
this is why we use enums
yep, that's the problem, you set "lavawalker" and check for "lava walker"
I forgot, this is bad right
it's not ideal
Also, these two classes are a mess. They do too much.
I don't think the command should hold the data
ngl i havent had a wink of sleep bc of this
if it aint broke dont fix it
pure sleep at last
thank you🥹
cant belive a space bar is wat cooked me
It may not be broke but at least next time learn how to do better
ill work on the area one later
indeed
but as of rn ima test it the go to bed
And for this I guess do learn enums
And write the imports normally, don't use so much *
Math.round?
Ah, yeah casting truncates
BigDecimal
Math.round doesn't always round n.5 up btw :x
huh, I must be mistaking this for something else
yeah I was confusing this with C# Math.Round where it rounds ties to the closest even number, haven't used C# in over 10 years, mfw
Didn't know C# was such a hoe for even numbers
so im kinda bad at math, maybe you guys can help me with this one. I'm trying to make hollow sphere.
Well i've done it using sin() and cos() multiplications, **the problem is that i want to have it one block thick with culling of non-visible blocks from perspective of inside sphere. **I want it to be as accurate from the inside of sphere, whilst leaving inside of the sphere looking like crap. that way my sphere surface would be one block thick. how can i achieve this kind of shape?
i want to sphere to look exactly like this:
from outside
from inside
Can you not calculate a second sphere and remove the blocks on that list from the list of the bigger sphere?
i can im just wondering if theres trigonometrical way to do this
Java rounds halfways towards positive infinity, C# towards even numbers, C/C++ away from zero
this is disaster
I don't think so tbh and instead of a second list, when placing, just check f the distance from the center is the outer most block and only place if that's valid
the problem with using distance is that it doesnt represent visual perception of distance of the sphere, when due to how minecraft is voxel game
those distances that are marked with arrows are different even if they visually look the best
youd need to calculate the cells as a grid, not in actual full 3d space, because then it doesnt work anymore
Look up midpoint circle algo and Bresenham's circle drawing algorithm
Wait, i think i had a pull request for spigot or paper where i proposed discrete shape calculations for something like that.
Let me check if i can find it.
?paste
I'm currently working on a component-based item system. There exists a BaseItem and an ItemInstance of that base item. Each ItemInstance has their item-specific components serialized (not the base ones) and their custom item key.
I want to make a versioning system that updates items when their BaseItem has changed (a new component, changed values, etc). So far, the hashcode for the BaseItem is serialized into each new ItemStack, but I'd like to know if anyone knows what the best approach to compromise between optimization and full coverage is.
Basically - when should I be updating these items before I lag the server to oblivion? Maybe when a chunk loads I scan every container in the region? Maybe when they're picked up? Has anyone done this before?
wtf is that cursed interface
I understand it, obviously, but it's so unconventional 
Store only the BaseItem in the ItemStack.
When an item is equipped, create ItemInstances.
Listen to outgoing Item packets and modify them based on your current BaseItem implementation.
I felt quirky and cool that day. I honestly dont remember why i sealed it, but i surely had a reason for that...
is this not too much overhead? I thought of this for just lore purposes since updating the entire item would be a nightmare
Im honestly not too sure. But im currently mapping item packets in my project, and im hoping that it will hold up for ~120 clients per server instance.
also - random thing. i remembered your name:
in case you care here's the final result lmao
That looks nice 🙂
is this just updating the item lore or the item itself as well? (pdc/metadata/whatever)
Everything that is not useful for the client is stripped. (Eg the pdc).
Im only modifying the lore and name at the moment. The lore is constructed dynamically, based on the "components" of the item.
itemstack pdc is sent to the client tho
it's chunk/entity(/what else?) pdc that isn't
Right, so my mapping removes them from items as well. 🙂
well I guess it depends on what you are using menus for
in some cases it's fine but certainly not all
Hm? Wait, so people add PDCs to ItemStacks to identify them as Buttons in Inventory GUIs.
I would not do that for GUIs because i think that sounds silly. But even then, only the server needs to know that those exist, right?
Is there a case where the client needs the PDC of an ItemStack? Maybe in creative when he wants to clone it.
well like I said, it depends on what you're using menus for, or maybe how instead of what, say you allow players to pick up and put down and merge items, maybe you want some to be mergeable with some but not others
there are cases where it's certainly fine to strip it, it comes down to the specific usage
Hello. When do people usually contribute to spigot, right when an update hits or before it?
anytime
Whenever they feel like it
if you want API to be added or fix a bug, you just pop in and do it whenever
I would like to contribute if that's possible.
?cla
?stash
thank you, I think I read the cla once, I will re-read it. If I remember it correctly you need to fill some form and send it?
yep
Show me your math
why do i need to apply 1 tick delay to change block from BlockGrowEvent
but i dont need to apply the delay in BlockPlaceEvent ?
What’s the use case
its actually not that bad, i kinda cheated by mounting the display over an entity but at the time there was no other way of doing what i wanted to do since displays were quite new
It just looks so smooth, and I may have to “take inspiration” from your math… I’m designing frisbee physics so
were you talking to me 🤔 ?
that's actually why i had to use an entity vehicle and not interpolate the displays myself
because otherwise it flickers
Yes, sorry give me a second
okay
Yes, it’s what I do as well it just seems you have a smoother algo
whats the safest way to edit an offline player's inventory and enderchest
I’m not 100% sure, if I had to guess it’s because the grow event wouldn’t directly allow you to modify the block at the time of the event being thrown since the grow event is already changing the blocks state
placing isnt?
its the same with structuregrow, the blocks are placed
and you have to add the delay
;-;
Well the place event is already aware of the state the block would be in, grow event the state of the block changes so I would assume that’s why
Ie: Applying block data to a block at the exact moment it's already being changed
GrowEvent
yeha but it changes after the code?
i mean i dindt know when to add the delay, i added it everywhere: BlockPlaceEvent, EntityChangeBlockEvent, BlockFormEvent, BlockGrowEvent, StructureGrowEvent, BlockSpreadEvent
It's a concurrency issue I think, you can't apply block data to the old state of the block which is what the grow event handles... only when the block has been "grown" would you be able to is what I am thinking
Resulting in needing a delay before your own additions
i mean, i think i understand that, but the placeblockevent should be the same
I don't think so, like I said the place event wouldn't be modifying the block data other than giving it a location value or something small
Even then, I don't think the location is even held in it's data, probably just a field in Block
uhm, so would you be able to tell when i dont have to add the delay?
Probably only the place event
Pretty similar, though tbf my physics are all over the place lol
I also modify my own calcs like 6 times before the final result is given/applied
@blazing ocean you up?
yea what's up
bit late now
smh
if you just want it to be equippable, consider adding this item component to it instead
was gonna inquire about adding lang:space.-18 support to my text visitor shit but I figured I can just use the utf characters nexo uses and add those widths to my font data
just make a custom MM tag resolver
Is there a good way to instantly load a plugin after making changes? I think it's a bit annoying to have to stop the server, press build, copy the plugin into the plugins folder and start the server again
hotswapping exists but is a bit buggy / annoying sometimes
Hmm about this plugin
I’m currious how can I reshape player model like that ?
Pretty sure you cannot model or texture your own skin into it
I believe it’s some magic with a player head and core shaders
Is there any way to make bukkit's config system not treat .'s like config paths
trying to make a font width thing and it's tripping
even with getValues
I think you can do #setPathSeperator somewhere
cool shit
lemme find an obscure character that won't bite me in the ass
let's see if 0x0000 works
It can be done using this resource pack:
https://github.com/bradleyq/stable_player_display
I suspected that much, but is there at least a way to get Maven to build directly into my plugins folder?
hotswapping is probably a better option if you can get used to the setup
as far as that question though, you can just add this somewhere:
<build>
<directory>your/server/folder/</directory>
</build>
with "somewhere" being the project tag of my pom.xml?
yes
it depends on what plugins you might be using though
if you're using shadow, you have to set the outputFile in the maven shadow plugin configuration
right now I'm just making my own as a test
if you're using special source for remapping, then that
oh you mean maven plugins
It works, thanks
it's a bit annoying that it also adds all the extra junk but that's easy enough to ignore
antrun to copy the artifact to the plugins dir and run plugman reload pluginname over rcon 🤡
what junk? You can probably skip it
Just seutp hotswapping at that point
joking aside i do prefer this over hotswapping since it's more representative of what will happen at prod and is still far faster and convenient than restarting the server
i.e. any issues you encounter will be more reproducible
it creates a bunch of folders ("classes", "generated-sources", ...)
I mean, unless you're editing the onEnable/Disable or other lifecycle related methods, hotswapping will be just as representative
i could be, and i could also have state in other classes that get hotswapped
it takes some getting used to, if anything. Like you'd expect state to be cleared if you're using to restarting and hotswapping doesn't guarantee that
but it is useful as a reminder that you have to manage state anyway so it isn't all that bad
that's exactly it yeah; if i'm doing changes to e.g. the config parser, i will then also have to manually reload the config using the new, hotswapped parser code
atp it's cleaner to just do a complete reload of the plugin
only exception i admit to is debugging things at runtime where you specifically need to make changes without touching state
welp, it's probably better to just modify the maven jar plugin configuration then:
<!-- this goes in project.build.plugins -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<version>3.4.2</version>
<configuration>
<outputDirectory>somewhere</outputDirectory>
</configuration>
</plugin>
Also I'd have no issues with using gradle instead, the only reason I use maven is that the gradle version of the spigot plugin setup guide was broken
I was thinking of making a HotswapAgent plugin to make this less annoying, but I haven't gotten to do that yet
patrick's remapper? I am using that one just fine
issue is that I don't understand HotswapAgent all that much yet lol, can't be bothered to research how it works
I'm talking about this guide
https://www.spigotmc.org/wiki/build-you-spigot-plugin-with-gradle-groovy/
that guide doesn't seem to be using any gradle plugins
but that guide is really old anyway
groovy 🤡
yeah, I assumed it was old because it has broken formatting, implying it hasn't been maintained
that's why I used the other guide that was on the page, which used maven instead
this is how I setup my spigot gradle plugins if it is of any help
should probably move the server location to a property tbh
And I'm not sure what this means, my project doesn't seem to have a project folder
oh sorry I meant build
obviously my project is a project folder
I meant here:
<project>
<build>
<plugins>
...
aah
completely unrelated but recently I learnt that you can pass files as JVM flags in java 9+
meaning you can do java @jvm.flags -jar server.jar to have a bit more clean of a startup script, jvm.flags being the name of the file
@blazing ocean facing weird issues with font spacing
Specifically for the uppercase I character
seems to like different values depending on how many I's I have
If I have 3 I's then a width of 4 is ok
If I have 2 I's then I need a width of 6
In short the more I's I have the shorter they are?
Dunno
default font?
because bitmap fonts don't do kerning
default font yeah
actually
not exactly
it's almost like the default font BUT with some ascents for menu work
the next lines are a bit to the right
odd
but they go more to the right the less I's there are
no combination of changing lengths fixes it
And it's not the characters either because it only happens with roman numerals
Regardless of name
Everything else renders fine
Wynncraft
type shit
Smol server
Oh there's an extra server for that? lol
But having read the code before, I don't think this should be the case
By the way, I actually made a tool that makes it very easy to correct for font width
https://github.com/HalbFettKaese/FontWidthConverter
can u add a space between the + and the text
No
D:
hello how can i add another bar for more amor ?
real
Resource pack with font magic
I think one of my PlayerInteractEvent may be cancelling another before it's even able to fire, does anyone know if this is a thing?
public void onPlayerInteract(PlayerInteractEvent event) {
Bukkit.getLogger().info("[DEBUG] onPlayerInteract called");
Tried adding this debug line but it doesnt even print on the second one
isn't ignore cancelled a thing on the annotation ?
could then see if it is cancelled
oh wait it does something different
uhm, you sure your event is registered ?
yes 100%
i dm'd you both class listeners i believe are interfering, if you'd like to take a brief peek
?paste exists, prefferably use this instead of DMing
And I don't have time rn
👍
ok found it was caused by Caused by: java.lang.ClassNotFoundException: net.minecraft.world.level.Level
ServerLevel world = ((CraftWorld) player.getWorld()).getHandle();
Is this legal in nms
actually im quite confused, it's giving me the classnotfound error with the nms level class but i already generated the mappings
are you using paper
no just spigot
I was using that in a listener to spawn fresh entity and it was indeed working for a while until today
no dependencies changed
ServerLevel world = ((CraftWorld) player.getWorld()).getHandle();
UUID kingdomID = kingdomManager.getPlayerKingdom(player.getUniqueId()).getID();
double spawnX = clickedBlock.getX() + 0.5;
double spawnY = clickedBlock.getY() + 1.0;
double spawnZ = clickedBlock.getZ() + 0.5;
if (customModelData == 1) { // CustomGuard
CustomGuard customGuard = new CustomGuard(world, kingdomID, new BlockPos((int) spawnX, (int) spawnY, (int) spawnZ));
customGuard.setPos(spawnX, spawnY, spawnZ);
world.addFreshEntity(customGuard);
customGuard.getBukkitEntity().getPersistentDataContainer().set(EntityTags.MOB_TYPE_KEY, PersistentDataType.INTEGER, 0);
customGuard.getBukkitEntity().getPersistentDataContainer().set(EntityTags.KINGDOM_ID_KEY,
PersistentDataType.STRING, kingdomID.toString());
Example
and are you reobfuscating your jar
reobfuscatint
im not sure, how do i know if i am?
do you use maven or gradle
gradle
do you have patrick's remapper or paperweight with target set to reobf
i thought paperweight was for paper?
i used the buildtools tutorial on the docs way back last summer and it worked
nvm looks like i was using patrick remapper indeed
ugh this is all so weird as the ClassNotFoundException happens on runtime
plugin compiles just fine
how are you compiling your plugin
running the jar build script; i used the intellij plugin to generate and have just been running that for the past few months with no issue
ah well ima go to bed and figure it out tomorrow
maybe my spigot test server got messed up
use the build task, not the jar task
weird, i just tested it by making an entirely new test server and it worked
i dont even know anymore ;-; im so confused
that fixed it and i dont know why anymore
i assumed jar would build the project too
all it does is compile the classes and throw them into a jar
doesn't run the remapper
public static void setBlackScreen(Player player, float fadeInV, float stayV, float fadeOutV){
PacketContainer fadeIn = new PacketContainer(PacketType.Play.Server.GAME_STATE_CHANGE);
fadeIn.getIntegers().write(0, 4);
fadeIn.getFloat().write(0, fadeInV);
PacketContainer stayBlack = new PacketContainer(PacketType.Play.Server.GAME_STATE_CHANGE);
stayBlack.getIntegers().write(0, 5);
stayBlack.getFloat().write(0, stayV);
PacketContainer fadeOut = new PacketContainer(PacketType.Play.Server.GAME_STATE_CHANGE);
fadeOut.getIntegers().write(0, 6);
fadeOut.getFloat().write(0, fadeOutV);
try{
ProtocolLibrary.getProtocolManager().sendServerPacket(player, fadeIn);
ProtocolLibrary.getProtocolManager().sendServerPacket(player, stayBlack);
ProtocolLibrary.getProtocolManager().sendServerPacket(player, fadeOut);
}catch(InvocationTargetException ex){
ex.printStackTrace();
}
}
😦
how do i set a black screen like it happens in other servers?
not sure what game state change is but other servers use a title with a custom font
I was thinking just shove them inside a solid black text display entity
are you telling me that you can send the player a title that replaces something like a custom emoji that takes up the entire screen? 🙄
Yeah
Lf some plugin developers if they wanna work with a MC server
?services
If you wish to request or offer development/art/building/administration services, please do so at https://www.spigotmc.org/forums/services-recruitment-v2.54/
item and block
hmm make sense
Singular and plural
I love the carrots block
at this point i would just add _BLOCK
just like minecraft item registry does
what..
the names in the Material enum are generated from the registry anyway
LEGACY_EMILY
yeah
at this point i would just make item and block type the default
at this point i would just get rid of material enums
just use the god damn registries
its not 1.7 anymore
cough item type and block type
argh i broke the GODDAMN WHEEL!
bringing registries in the api would allow to centralize custom items in a way that plugins could register custom items in centralized store and then different plugins could spawn different plugin items without any third party API integration
custom items are not a thing so that's not really a concern for a server API
yeah no
the most custom an item can get is changing its model
doesn't it just yell at you for the registry mismatch
it'll fully explode yea xD
but why though client doesnt support it
i mean i dont see a reason why it wouldnt? They can just use behaviour type approach like they did with data driven enchantments
because mojank didnt add it as a feature
it doesn't support it because the java code required to support it does not exist yet
item registries would be cool addition for datapacks for example as it would centralize how would the itemstack gets initialized with what lore and naming and material type, no more messy recipe hacks i see as i big win tbh
you can then ./give yourself a custom item by just using a command
i see so many possibilities with this if client supported it
making custom items would require of a lot of features to be added to datapacks that don't exist yet
they're slowly making every item interaction a form of data component in order to achieve this probably but we're not there yet
They have been for like 10 years now 
same with custom blocks and entities
but to get there, a LOT of work is needed
mojang is 100% working towards it but like, needs to be balanced with all the other shit
Yea
yet nobody on the bukkit derivatives really makes use of them
most people just don't bother and use the lore/pdc as that's easier to handle
its awful that's like using chat event instead of registering command inside the api
if something is native already api should be updated in a sense to deprecate such behaviour
tbf commands on spigot are essentially just a chat event
bukkit command api impl at least on spigot is awful too
it wraps brigadier in most disgusting way i've seen
it has worked for the longest time, can't really say anything about it
it doesnt even utilize brigadier's command nodes
it puts everything under one command node
just for the sake of backwards compat inside the api
the implementation side has never been beautiful per se, and it shouldn't be the goal anyway
not spigot's fault its just that bukkit api is old
and doesnt fit today's mc codebase that well anymore
some things are just fine the way they are
as long as the API is sensible, and the implementation is made in a way that will consider future changes to the game, I believe it's good enough
developers tend to be cleanliness freaks so anyone looking at it might just want to rewrite it all but everyone knows that is never a sensible option
spigot would never accept deprecating command api in favour of more like brigadier one
never a fan of destroying something that works
paper already does have experimental support for brigadier
but spigot is more conservative in terms of api changes
so what if paper does
they can do whatever they want
not sure what paper is doing has any concern of spigot o.O
nothing im just comparing this, but rn as it hardforked from it the comparisons would be even drastically bigger as projects move on
as they should be
whats the point of forking if you are not going to really do anything different
it isn't so much that it is conservative but rather that developing new APIs is hard and nobody has time to do that
and md himself has his hand pretty full keeping up with mc releases I imagine
and a lot of people dont want to sign the cla to contribute
I don't think that's much of an issue
i know it is for quite a few people
signing away ur rights + personal detains to random australian man
the bigger issue is that people get discouraged after a while if a PR doesn't receive attention
is that so
I'd be surprised honestly, CLAs are pretty common overall
i dont think the fact its a cla is an issue just a cla to who is the issue
well that'd make me even more surprised since I don't think md has a reputation of doing anything with that information lol
as long as they don't go a spree of removing and adding new classes it is relatively easy
CLAs are common in big corp, but we're talking about young adults and teens signing that with all the info it entails to John Australia for a Minecraft API
ironically when you contribute to an open source project you give up your rights anyways
you can't take back something you gave away freely
I think it’s just a matter of convenience and even though your address is “public information” I wouldn’t just give it away
