#help-development
1 messages · Page 480 of 1
Keep in mind that by default app metadata on the output will be lost
At least on the old one
Then yeah, first one
Alr
Instead the metadata from the input will be copied to the output
wdym?
Like the shaped and shapeless etc
Yeah just Bukkit#addRecipe()
Ight thanks
If you give the output of the recipe say, a name, it won’t appear when you actually try and use it
Instead the name from the input will be copied
Whats the difference between RecipeChoice.ExactChoice and RecipeChoice.MaterialChoice?
I know with things like shaped recipes you're able to add an item with metadata to a recipe and it would only work if it had that metadata almost as a way to make a custom recipe with a so to speak "custom material"
ExactChoice requires the entire ItemStack to match
Ah alright
Material choice just requires the same material
Alr
which input?
So i should do exact choice if I want it to be an iron ingot with a custom model id and name match?
Yes
👍
The left item
i definitely remember doing a plugin "CraftableBlastPickaxes" in which i simply set the output to my pre-made itemstack with name and PDC tags
and the result slot containted that exact item
when i crafted the thing
For a smithing recipe?
oooh
that's smithing
i just
fucked up
i need to sleep
i guess i had to check the first message in this topic
@ancient plank
@ivory sleet
could you guys help me with bungeecord
@staff
@worldly ingot
bruh
If you have a question, please just ask it. Don't look for staff or topic experts. Don't ask to ask or ask if people are awake or available. Just ask the question to the channel straight out, and wait patiently for a reply. Make sure you use the right channel regarding the topic of your question. Create a thread in case the channel is already in use!
bro its keep saying enable ip forwarding when its already on true
bungee + spigot?
Demon, we would appreciate if you didn't ping, be patient and someone will help you sooner or later
can you, you are staff
can you reset all chunks in a loaded world except some?
do i have to iterate through all existing chunks and delete them or is there a better way?
Of course but what about acf
Unless you make the user type /command confirm
Or repeat the command twice
Technically yeah
One way is to unload, delete file and reload
So I made an item and gave it meta data then gave it a smithing recipe but for some reason instead of coming out as an "Enderite Sword" it comes back as a normal wooden sword, anyone know why?
https://pastebin.com/6WF554L4
I think?
paste bin right there
The ingot is a legitimate enderite ingot tho the only issue is that the sword metadata isnt working for some odd reason
If you want to keep it you need to use the PrepareItemSmithEvent
Oh? What would I do in that event?
Like how would I be able to detect its prior meta data to set it's results meta
You’ll have access to the recipe and its output
event.getInventory().getRecipe()?
Yes
Alr last question
So for my server I use a resource pack that is downloaded on join from a direct download link (dropbox) but when i make changes it wont reinstall i have to delete the resourcepack from my server resource packs and then rejoin so it reinstalls is there a way to make it reinstall if I change the pack?
can you do that without having to unload the world? I'd rather keep the players in an area than move them to another world
if u know a chunk is unloaded
and its mem is gcd
then u can delete the file
w/o unloading world
but its somewhat unreliable
kept asking chatgpt to make me a donut
but it keep failing 😦
it couldn't make a 3d donut shape out of stone
yeah that's understandable
i'll do some testing, thank you
i will think of way to do it tomorrow
man shit got toasty fast over here
it's mega hot today, my computer is turning this room into a furnace
there's many ways to do that, from drawing multiple circles within a certain zone of parameters to scanning for nearby blocks withing range of an initial circle
I'm sure there's a math formula for it out there somewhere as well
Anyone gonna review my code : )
Dms
Do it here
Anyone know?
use this keyword if possible, you’re taking interface segregation principle way too hard and misunderstanding it, you don’t need a strategy object per function, this is what misusing design patterns look like, don’t name interfaces with the prefix I, that’s a bad practice in Java, the package name interfaces is extremely vague, packages should be named singular and be more specific regarding what the classes they contain are doing, for instance command would dictate the reader to think command related classes are contained within said package, you rarely dedicate an entire package to just all of ur interfaces.
Thanks
Enterprise is not synonymous to over engineering with design patterns and design principles
We use them patterns and principles to avoid code symptoms, to achieve consistency, to address business requirements, to address engineering requirements altogether you get maintainability and extendability
They are powerful tools
But they become a mess if misused
Yea.
In this case nazar
I would have a single facade interface for the configuration, and then for the spawn management, then you have concretions for those interfaces
Cause I think its important to centralize what is correlated
Guys i need your help,
So i've been trying to make Drowneds wear armor when they spawn in the ocean ruin structure.
Heres the code:
Im not good at coding ether
The event im using is AsyncStructureSpawnEvent
?paste for code
ask for a torus
I'm trying to make a custom inventory that has unobtainable custom items in it but I was wondering, how do I make it so when someone grabs an item from it that the item regenerates?
im using getBlockAt and im using it in a if statement but i dont know how to get a BlockType
BlockType?
like what would i use to check it because i have 0 clue
As far as I know that method returns a block
use getType on the block to get a material
You can then compare that
Is there anyway, without the block physics event, to stop a trapdoor from being affected by redstone?
The BlockRedstoneEvent doesn't appear to be fired for it and I can't think of any other event for it
I wanna install 1.19.4 using build tools but whenever I run build tools and type 1.19.4 and specify im using java 17 it just closes the cmd tab any reason for this?
Or how can I fix it I guess I could say
You havent tried with a 2d array?
Anyone know why this happens? And yes, I know reloading is bad.
I can give myself money with essentials with /eco give username amount
Then when I reload and check the bal, the correct amount stays.
Then when I reload a second time, it resets my balance to 0
?paste
So one thing i didnt mention and was hoping maybe you would see it on your own was to use an array that is thr same size as the inventory. In this manner you can use the same array index numbers to refer to the slot id's. Saves you on some kind of mapping and saves you from doing a lot of looping.
You could use a 1d array in this way too if it makes it easier for you
Essentials probably doesn't play nice with /reload
If the same behavior occurs on restarts report it to essentials
It does not and has its own reload command
I made a custom crafting menu.
https://paste.md-5.net/evijetuwif.cs
The large craftingMenuRequirementCheck method uses the bottom methods to check for the specified things for each recipe. The bottom methods run certain tests such as countItemsWithStackSize, which will return an int[] with element 0 being the amount of stacks with the correct amount, and element 1 being the amount of stacks iwth the incorrect amount
the needed tests are run based on the specifications of the item and the different slots or amounts that are found
For me to help coding wise will have to wait till i get home. Get off work in 7 hours lol
what I sent in pastebin might be pretty confusing. It doesnt really say what everything does, and its probably not the most efficient way of doing things
When you create your array that refers to your grid, you put a 1 or 0 if there is an item in that slot. 1 if there is 0 if there isnt. Then you use that array to check if it makes the shape of your recipe or use the shaped recipe api which i think might work not sure. But if i had to nake everything i would use an array that contains the various permutations to check against. In this manner you could just use one loop
It sounds complicated but it really isnt. Maybe it just makes sense to me lol
so is what I sent a really bad way of doing it?
What’s wrong with the click event
Gather the items in those slots into an array
And then compare it against recipes
I mean you don’t really need a list since it’s a fixed size
Arrays are used when you don't know what the final size would be. Would make your life easier to a 2d array
I would use a 3x3 array and put my item objects into it then use a nested for loop to see if any patterns in the current array are formed, and if they are the you associate it with the proper item
im trying to debug an error im running into but the error in the console is saying "... 22 more". Is there a way to have this show the extra lines? the content its showing isnt giving me the source
Usually the important part is at the beginning. Can you send the exception you are talking about in here?
org.bukkit.command.CommandException: Unhandled exception executing 'newkit t' in net.nebulex.alphacentauri.commandlib.bukkit.AlphaCommand(newkit)
at org.bukkit.command.SimpleCommandMap.dispatch(SimpleCommandMap.java:165) ~[paper-api-1.19.3-R0.1-SNAPSHOT.jar:?]
at org.bukkit.craftbukkit.v1_19_R2.CraftServer.dispatchCommand(CraftServer.java:929) ~[paper-1.19.3.jar:git-Paper-386]
at org.bukkit.craftbukkit.v1_19_R2.command.BukkitCommandWrapper.run(BukkitCommandWrapper.java:64) ~[paper-1.19.3.jar:git-Paper-386]
at com.mojang.brigadier.CommandDispatcher.execute(CommandDispatcher.java:264) ~[paper-1.19.3.jar:?]
at net.minecraft.commands.Commands.performCommand(Commands.java:313) ~[?:?]
at net.minecraft.commands.Commands.performCommand(Commands.java:297) ~[?:?]
at net.minecraft.server.network.ServerGamePacketListenerImpl.performChatCommand(ServerGamePacketListenerImpl.java:2288) ~[?:?]
at net.minecraft.server.network.ServerGamePacketListenerImpl.lambda$handleChatCommand$20(ServerGamePacketListenerImpl.java:2248) ~[?:?]
at net.minecraft.util.thread.BlockableEventLoop.lambda$submitAsync$0(BlockableEventLoop.java:59) ~[?:?]
at java.util.concurrent.CompletableFuture$AsyncSupply.run(CompletableFuture.java:1768) ~[?:?]
at net.minecraft.server.TickTask.run(TickTask.java:18) ~[paper-1.19.3.jar:git-Paper-386]
at net.minecraft.util.thread.BlockableEventLoop.doRunTask(BlockableEventLoop.java:153) ~[?:?]
at net.minecraft.util.thread.ReentrantBlockableEventLoop.doRunTask(ReentrantBlockableEventLoop.java:24) ~[?:?]
at net.minecraft.server.MinecraftServer.doRunTask(MinecraftServer.java:1341) ~[paper-1.19.3.jar:git-Paper-386]
at net.minecraft.server.MinecraftServer.d(MinecraftServer.java:197) ~[paper-1.19.3.jar:git-Paper-386]
at net.minecraft.util.thread.BlockableEventLoop.pollTask(BlockableEventLoop.java:126) ~[?:?]
at net.minecraft.server.MinecraftServer.pollTaskInternal(MinecraftServer.java:1318) ~[paper-1.19.3.jar:git-Paper-386]
at net.minecraft.server.MinecraftServer.pollTask(MinecraftServer.java:1311) ~[paper-1.19.3.jar:git-Paper-386]
at net.minecraft.util.thread.BlockableEventLoop.managedBlock(BlockableEventLoop.java:136) ~[?:?]
at net.minecraft.server.MinecraftServer.waitUntilNextTick(MinecraftServer.java:1289) ~[paper-1.19.3.jar:git-Paper-386]
at net.minecraft.server.MinecraftServer.runServer(MinecraftServer.java:1177) ~[paper-1.19.3.jar:git-Paper-386]
at net.minecraft.server.MinecraftServer.lambda$spin$0(MinecraftServer.java:316) ~[paper-1.19.3.jar:git-Paper-386]
at java.lang.Thread.run(Thread.java:833) ~[?:?]
Caused by: java.lang.NullPointerException
at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:?]
at jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77) ~[?:?]
at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:?]
at java.lang.reflect.Method.invoke(Method.java:568) ~[?:?]
at net.nebulex.alphacentauri.commandlib.CommandNode.invoke(CommandNode.java:362) ~[AlphaCentauri-003.jar:?]
at net.nebulex.alphacentauri.commandlib.bukkit.AlphaCommand.execute(AlphaCommand.java:59) ~[AlphaCentauri-003.jar:?]
at org.bukkit.command.SimpleCommandMap.dispatch(SimpleCommandMap.java:155) ~[paper-api-1.19.3-R0.1-SNAPSHOT.jar:?]
... 22 more```
not a single one of those is a class im working on
oh because of the lib, I see
Alright that's good because I just checked what the ...22 more means (as I've never needed it) and the result basically said "there's no more info"
lmao, always fun
thanks for the help!
ok, so basically my method jsut needed to be static.
Sure, if you need more help let me know
java.lang.NoClassDefFoundError: net/minecraft/world/entity/animal/Pig
Isn't this version related?
You finally did it?
Nicely done. Well its progress
This was what i was getting at
Glad it finally clicked in the end lol
There is an inventory drag event
Well you would use both
So the drag event would start it and then afterwards use the click event ensuring where they click is the inventory grid
What about the mappings
Hi! I am trying to make 2 or more java programs running on a same network to communicate with each other.
Typically I do not want to make a server, I just want client A to broadcast to client B, C etc, same with client B and same with client C.
Basically some peer to peer exchange.
Any clue what I should use ?
redis
You could use sockets but this would approx 200x your development time to solve the same problem.
Sockets often introduce a tremendous amount of security and performance problems that needs to
be solved
For a custom project i would recommend using redis.
You can use Redisson and create RTopics.
Topics are conversations where you can subscribe and publish to.
I know about redis (and thanks for your suggestion) however I am more looking into a primal way to do it with built-in java modules etc
Why
Lots of I/O bound delay in redis (database operation) in comparison to sockets
Topics dont store anything, they just broadcast messages. Also sockets are IO as well.
Both will transmit messages in <1ms.
I know but conceptually speaking redis is kinda a lot
But it should not matter if your message gets transmitted in 1ms or 60ms
because it should always be done async.
Communication through a database doesn't sound right to me and I'm also trying to improve in the socket / networking thinggie.
I don't manage to find proper P2P examples on the web
Are you concerned about the size of the redis driver?
No I'm not really concerned
It's just that i feel like even though it's a viable solution it isn't really beautiful to make it like that
Be prepared to fight with sockets for weeks on end then.
Without a framework that builds on sockets you will need
to write a ton of logic yourself.
Redis is the most elegant solution together with RabbitMQ when it comes to
cross application communication.
You can also look at Apache Kafka. But thats more for enterprise applications.
Redis is an open source (BSD licensed), in-memory data structure store, used as a database, cache, and message broker
literally exactly what you would want
Sockets are going to have the exact same issues
Redis is an in-memory data sharing tool.
With stateful and stateless communications.
Can I use my existing database with redis ?
Or does redis has to run its own thing
The thing is I don't want another program to run on my server
Ive written a minimal example yesterday:
private static void machineA() {
Config config = new Config();
config.useSingleServer().setAddress("redis://127.0.0.1:6379");
RedissonClient client = Redisson.create(config);
RTopic topic = client.getTopic(TOPIC_NAME);
// Listening for messages and printing them
topic.addListener(String.class, (channel, msg) -> {
System.out.println("Received message: " + msg);
});
}
private static void machineB() {
Config config = new Config();
config.useSingleServer().setAddress("redis://127.0.0.1:6379");
RedissonClient client = Redisson.create(config);
RTopic topic = client.getTopic(TOPIC_NAME);
for(int i = 0; i < 10; i++) {
// Broadcasting messages in the channel
topic.publish("Message [" + i + "]");
sleep(1000);
}
}
Okay I see
Redis uses (like every other messaging system) a broker.
So you need to run an instance of redis for this.
:/
That's also what I was trying to avoid with sockets tbh
I was trying to do some "serverless" architecture
If you dont write your own broker then your messaging system will be
extremely fragile.
Then think of redis as a separate microservice
serverless architecture in a minecraft server network 
What do you mean?
Redis provides autonomous functions by itself.
Also: Do you need to dynamically scale something?
I don't
Its not like you are constantly needing to adapt to requests
Aha
Then dont try to build serverles architecture
My solution right now is plugin messaging
However it doesn't work for every situation either.
Thats something you can do for a website that needs to be small when only a few people
are there and big when requests go through the roof
That's a bit my situation ngl
Plugin messaging is garbage. Ive even replaced transporting players between servers with redis.
But it's lightweight
That's what I'm trying to maintain
I feel like making a whole new thing run on its own (broker/server) is overkill for the simple things I want
If you care more about a few less mb in memory then go ahead and write direct communications
with sockets. But be prepared to invest a lot of time and then end up with a fragile and unsecure solution anyways.
Yeah
Shouldn't be too bad
It's just very new to me
Ive never really experimented with sockets before.
anyone know how i could make this like run faster or like not skip stuff, just tested it running 3 commands through every .5 seconds it should have gotten up to 900, it ended up getting to 205 with the code
So if you have any advice (library etc) I take them
@Override
public void handleCommand(CommandSender sender, String[] args) {
if (!(sender instanceof Player player)) {
sender.sendMessage("This is a player only command!");
return;
}
if (args.length < 1) {
player.sendMessage(plugin.getMessageConfig().getString("no-suggestion-provided"));
return;
}
SuggestionData data = new SuggestionData(SuggestionData.Type.MINECRAFT, player.getUniqueId(), String.join(" ", args));
System.out.println(plugin.getSuggestionHandler().save(data));
plugin.getInventoryHandler().openGui(player, new SuggestionViewerInventory(player));
}
idk if its the command or it saving the suggestion running slowly
this is the saving anyway ```java
@Override
public int saveSuggestion(SuggestionData data) {
Integer newId = getNextId();
suggestions.put(newId, data);
return newId;
}
Did you already think about which layer 4 protocol you want?
Netty for example
Nope. Do you know which one is the best suited for simple text data exchange ?
Depends. How important is it that sent data is delivered vs performance.
TCP: Slightly worse performance but you will know if packets didnt make it
UDP: Better performance because its fire-and-forget
Ah okay, interesting.
I think I will go with TCP then
Sockets use that on default.
Now you need to create a session protocol. When does a session start? When does it end?
Which data should be exchanged in the handshake? And so on. After that you establish
sessions between two clients and you can start sending data. (Which needs its own protocol as well unless you are only sending Strings)
Whats the issue here?
it would only actually save 1/3 of the commands ran
You should probably also implement a heartbeat
I hope saveSuggestions doesnt do any IO
Then make sure getNextId() doesnt overwrite old ids
funnily enough all it does is nextId++
A session starts when a backhand server starts
It will keep looking in the input stream for any new string (they come from other backhand servers) and may output stuff too (broadcast to the other backhand servers)
You cant create a session with only one participant
Then UDP might be more appropriate. Doesnt need any sessions. Just listening
on ports and throwing packets into the network in hopes someone catches it
Then print out the map every time it changes in any way
I don't even care about handshake and all that tbh
And make sure your SuggestionHandler is a singleton
Even if it sounds more fragile/less reliable
You just need to hope that nobody does port scanning on your server.
Because they can just bombard your UDP sockets with information or
even inject functionality if they find out how it works
atm im souting the id its returning, and that is also printing 1/3 of the commands
Does it increment in 1s?
yep
What if I don't open my port ?
Can't I just keep my port local ?
Like for private communication only
If all applications run on your machine then you can do that
This sounds like your command system is broken
Print out a message at the start of your command.
If it doesnt print on every execution then your command system is broken
Java is turing complete. You can do anything with it.
it somehow is broken
when it just forward requests from bukkits
ill test it with bukkits rq
Are you sure that this is not a permission problem?
Does every of those accounts have the right permissions?
i didnt even think about that lmfao
it might help if i looked at the other accounts wouldnt it
now its running every time
i feel very dumb
Gradle noob here again: What is the best way of adding your own dependencies that are generated at compile-time. Preferably without using maven - but sources MUST be attached to the dependency (using a file collection with the sources and the "real" jar does not work)
Implementing SelfResolvingDependencyInternal on my custom AbstractDependency instance doesn't seem to do the trick when running ./gradlew dependencies
like depending on a file?
yes - but I'd also like to have sources attached
sources i have no idea, but the file just cimpileOnly or impl fileTree("path") or file('path')
Trying to make a floating item currently
Setting gravity to false on the item object results in it floating up.
anyone know if theres any way to stop this without using a second entity? i.e. armorstand
Yeah that I have figured out long ago
set the velocity to nothing
ah, ill try that thanks
Hm, I wonder if using PublishArtifacts could work...
that could actually work, maven-publish plugin sources to local or something, then use them
is 7smile there i have a redisson question
worked perfectly, thanks again
he was here like 5 min ago lol
Ask
so basically for the RMap feature
epic ?ask fail
how does saving objects work
if i were to access it on another project
would i need the exact same class with the exact same package in the project files?
if so that would be a bit of a pain to maintain if i use it in a lot of places
I mean you need to depend on redisson at compile time wherever u wanna use it
what?
i use redisson on all my projects but i the RMap thing allows for storing a map
with any object
as key or value
Yes
But like if you need to use an RMap in another project, ofc u need the class? Or what exactly do you mean
ok
well that's what i was asking
i just wanted to see if there was a more convenient way
This depends on your codec
no clue what that is
now, something doesnt add up
oh
But if you share objects between applications then both applications need to have this object
on their classpath ofc.
i haven't changed that in a while
i dont advertise ip with it so i just disabled rpc for it lul
This can be solved by using a module setup for example.
You have a core module which contains your global data objects
and those modules get shaded into your applications
(or just added to the project with a provided scope if those are spigot plugins)
I Personally use a Gson backed codec.
A Codec can translate Objects into binary/Strings and back.
Codec stands for Encoder/Decoder
uh if i use this would i not need to share the class between each application
How else do you expect different applications to know classes of each other?
lol... no
surely it would work if i put it under the correct package
Depends on your codec. But you should never do that.
so you are suggesting i create a new project
for 1 class
and then upload it so i can use it for other 2 projects
What is your setup? Then ill give you an approach.
I have a direction vector between 2 locations
but i'm not sure how I alter it so its only ~.5-1 block away from one of the locations
proxy puts data of servers into redis
servers read it and create a menu where players can view all active minigames + click to spectate them
Normalize it -> length = 1.0
Then multiply it by X -> length will be X
i want to store the uuid+name of the players in minigames, the minigame's state, the alive player count in the minigame, and the minigame id
Why does the proxy need to do that?
ah thanks
That doesnt sound like something a proxy should do
the proxy has the server manager plugin
which is the one handling that
it accesses the pterodactyl panel api to create temporary minigame servers
oof. Well then minigames need to be very abstract anyways.
Both the proxy and the server need to know the data, right?
yes that's why i am putting them in the redis instance lol
Then create a new project which defines your minigame logic and shade it into you proxy
plugin and minecraft plugin.
minigame logic as in just a class that holds minigame info
Or shade the proxy plugin completely into the minecraft plugin (dirty solution)
If your proxy knows this minigame data but your server doesnt then you
have a very big design problem in the first place. Doesnt matter if you use
redis or not.
how come the server should know then? what benefits would that provide
i feel like 1 handler that creates and destroys servers is enough
Then why do you need redis?
for the spectating system
??
well lobbies have a system where you can view all active minigames and spectate them
Then the server needs to know your minigame logic as well...
Unless you store the data as pure JsonObjects and simply use them as is.
But that is not type safe.
what if i'm just storing strings and ints
Use Json then
also how would i even share the minigame info without a database?
hold on let me fully explain my system
Just throw Json into Redis. Explaining how to do this properly would
take its time and you are already deep into the project
When the proxy starts, the server manager (SM) accesses the pterodactyl instance and its server templates (eggs). It starts off by creating 3 servers by running the egg's install script and creating a BungeeCord ServerInfo. This is then stored in a list in the SM. It also adds it to a Redis map.
The minigame sends info through Redis pub/sub when it is ready to be used. The SM receives this and enables players joining for the server.
The lobby sends a request through Redis pub/sub to queue the player to the specified game. The SM receives this and sends the player to the server.
Lobbies have the ability to send a player to spectate a game. They do this by looking at the Redis map and adding all the servers that are in-game to a gui, where players can click on the item and be sent to the specified minigame.
Alright then you need 3 projects:
Common - Used by everyone (Proxy, Website, MCServer)
Proxy-Plugin <- Shade in Common
Minecraft-Plugin <- Shade in Common
The Common project contains your DB clients like Redis, SQL, MongoDB etc.
It also contains managers that can be instantiated by every project to access
the data in exactly the same way
Example for a class in common:
public class MinigameStatusManager {
private static final String NAMESPACE = "minigameData";
private final RMap<UUID, MinigameData> minigameDataRMap;
public MinigameStatusManager(RedisClient client) {
this.minigameDataRMap = client.getMap(NAMESPACE);
}
public void setMinigameData(UUID playerUUID, MinigameData data) {
minigameDataRMap.put(playerUUID, data);
}
public List<MinigameData> getCurrentMinigames() {
return List.copyOf(minigameDataRMap.values());
}
}
Everyone that has common will have MinigameData.
And accessing this data is done the same way in every application.
Doesnt matter if your website wants to access this data or your proxy or your servers.
Otherwise you need to do what public APIs do and use Json.
how can i change the message sent when i run /summon (mob) so that it outputs ChatColor.GREEN + "Success!" instead of Object successfully summoned?
If its not your command you'd have to override it and write your own
can i add custom textures to a plugins item with the itemmeta?
with a datapack
JSON would work, right?
I'll go with that but if I need more details in it then I'll try what you sent
Is there a tutorial on that or a documentation?
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/
GUI: https://sourceb.in/F9qVClet2J
Paginable: https://sourceb.in/H2GQiLqBZt
ERROR: java.lang.ArrayIndexOutOfBoundsException: Index 9 out of bounds for length 9
Does someone know how to fix it? i think is caused by getting items that don't count the arrows
Full stack trace
?paste the full stacktrace
InventoryConstructor line 44
Look here. You are accessing an array of size 9 with an index of 9
is the setPage(0)
the greatest index for an array is always 1 less then the size. Therefore, if the size is 9 you can't have an index at 9 as well.
so whatever it is you are doing, you are trying to access an index that does not exist thus the array index out of bounds exception
i know that, i tried many times to remove that but if i move them the error is again there
public void setItem(Icon icon, int slot) {
icons[slot] = icon;
inventory.setItem(slot, icon.getItemStack());
}
its nothing special is for setting icons
whatever line 44 is is where your error happens, trace baqck through the stacktrace to find it's cause
its litteraly the set item and the line is inventory.setItem
it would be nice if you just showed us the class so we could look at it
InventoryConstructor.java:44 <- PaginableInventory.java:79 <- GuiTest.java:44
Paginable: https://paste.md-5.net/xazoqitiwi.java
looks like your max page is 8
no?
would it not be 0-8 so 9 pages in total
the page is 9 (slots) / 28 (items) = 3 (page)
oh i understood now in https://paste.md-5.net/ribudidupa.java , line 40 is 9 and not 8
another "problem" i wanted to ask, is here (https://paste.md-5.net/xazoqitiwi.java), i made in 92 add item to the first slot, but can be useful setting it as next item and make it go one more and set the item
Like if 1 is used for something and i wanted it to make it in 1 the code skip 1 that is already full and put it in 2 and the rest will continue like that
Hello, I've tried hard on googling and as the result I come here. I intend to develop plugins for 1.12.2 server. I want to access to the source code of both spigot-api and - we normally say - nms. For BuildTools, I already build. I omit from spigot-api to spigot in maven, but still I could not get what I want.
well u have mojang mappings for nms
idk if it applies to 1.12.2 tho
thats the closest u get to source
Theres mcp though
What's that?
The other deobfuscation mapping for 1.12
Afaik there is pretty much only MCP and Spigot mappings
The go to deobfuscation before mojmaps
Ohh I see
forge users use mcp
hi, what is the most suitable version for scalable minecraft servers?
depends on what you use internally
and works well with other versions too?
i wanna make a minigame but i also want it to be scalable and i will be working on a large server i wanna be able to manage complexity of the project and a bunch of other things.
And it also depends on what you want to achieve
For minigames Minestom is the ideal solution
Minestom?
Granted you can't be afraid of packets and lots of reimpl yourself
Well not truely ideal because you don't have the luxury of bukkit but it is rather scaleable
Minestom is a completely rewritten minecraft server software that's extermely stripped down.
It works best for minigames
Java
Still Java
oh.
lame.
would probably use something more performant than java if i wrote my own server software.
BUT I AM NOT WRITING MY OWN SERVER SOFTWARE!
A rewritten mc server would probably be laggy or buggy
Besides minestom 
whats minestom like? Does it have an easy api to work with like bukkit? With large scale projects, maintainability is also important so i dont wanna use some overtly complicated api.
The main issue with minestom atm is lighting api
IMO it's significantly nicer
on the topic starting a new large scale project, what are a couple key things i should look for though?
For really fast redstone there is another implementation writtenin C (MCHPRS) but it only shines for creative servers and isn't great for minigames
Scalable data storage
i dont really wanna use redstone for this minigame though.
So it basically runs in more than 20 tps?
i could use a nosql database for that.
horizontal scalability.
Yep - you can set the redstone ticks per seconds to arbitrary numbers
what method should I use to read a config string and turn it into a material?
i've seen multiple in the Material enum
Plus it JIT compiles redstone which is super cool
Wow
much higher numbers that that, it is optimized for maximum redstone performance
Material#matchMaterial iirc
but anyway, in the regard of minigame servers, what do bigger networks do like hypixel and what not?
They use 1.8.9 but there is a catch
what is it?
i thought they used 1.7.10
Technical debt
Nosql is ideal I'd go with mongo
some use 1.7
Oh yes right
what?
alright thanks
Basically for most networks it would be very expensive to upgrade to newer implementations
why?
do they have to develop everything again?
Pretty much
also another thing, i'm working on a lib that is supposed to support all version from 1.8 to 1.19 and when working with materials, it's a bit of a mess because of legacy materials
is there a way to work around that?
ok so if i was starting a new large scale minigame server like hypixel, what would you guys recommend me doing?
1.8 and 1.19 are quite different
XMaterial api Is pretty good
XSeries in general is a solid set
Especially with combat there is a difference so you may need to rebalance a few things
i dont mind 1.9 combat for the time being.
what's that?
Some compatability material api
also, can bungeecord change blocks in the world?
you can use plugin messages to tell a server to remove blocks
i was thinking most of having most of the event handlers on bungeecord instead of spigot to optimise tps or the mspt for the main server.
a bungeecord is just a bridge from your client to the server so it has no access to the servers linked to it
yeah that was expected.
that sounds like a bad idea
how extensive is bungeecord in terms of event handling capablilites compared to bukkit?
a bungeecord is supposed to handle connections, nothing else
As I said - if performance is the issue you'd not want to use anything that is based on the notchian server
doing what you said would put extra strain on both the bungeecord and the server where you want the block to change
well its not that bad.
If it is only a potential concern I'd maybe take a look at that new paper fork
scrap the thing about changing blocks.
And run a monolithic instance that runs different worlds
purpur?
and if you want to make a super performant server based on 1.7.10, you'd be better off making your own fork of spigot
whats a monolithic instance?
Nah Folia
what you want to do is pretty ambitious
Basically a single server responsible for everything
Bungeecord is a proxy. It should not know the specifics of your minecraft server.
Just handle connections with it and keep it leightweight
but why different worlds? Does each world run on its own thread as opposed to a single thread doing everything?
Yes
At least for Folia
^
Under other servers it is complicated
Ram go boom
anyways any way to get non legacy material constants by using the old api? Can I import both 1.8 and 1.13 and use the two different Material enums based on the server version?
But its super experimental and very unstable
As in almost no plugins work
Well... better than running one server per world i suppose
Even vault doesn't work by default
Depends
meaning it could be worthwhile to run a minecraft server on a threadripper?
You need to write everything full custom
If it's minigame worlds type thing just pool em
Just use the slime world manager there
not sure if it can help your case, but if you look up asyncworld on github there's a lib that might help your case
Although I don't think it works with Folia
i have never used it but it looks pretty solid
i probably wont use any pre-existing plugins though, though that might mean I could suffer from some NIH syndrome but i would probably prefer to use my own stuff for the most part.
just so that i can keep the system comprehensive and i know exactly what is going on.
I've got this message for adding 1.12.2 dependency
Provides transitive vulnerable dependency maven:com.google.code.gson:gson:2.8.0
<dependency>
<groupId>org.spigotmc</groupId>
<artifactId>spigot-api</artifactId>
<version>1.12.2-R0.1-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
Stupid IDE warns smh
Just exclude all transitive deps
when were the old materials deprecated on spigot?
1.13
1.13 being the first version with LEGACY materials in the enum right?
Ye
alright thanks
btw, what about viaversion?
Thank you!
does viaversion have something for bungeecord or any other proxies?
I believe Viaversion can be installed on a proxy yes
because i dont really wanna run too much on the main server and try to keep tps running okay.
any tips on how to handle that? i don't feel like making a multi module project just for materials
Yes although it's generally advised that you keep it off the proxy. IIRC it's been known to cause some issues
But not sure if it can be installed on bungee or only on velocity
Xmaterial
what's that?
Look it up
why? its only translating packets.
and i really wanna preserve the tps or the mspt.
oh i couldn't find it before, thanks
There is a bit more to it than just that
on 1.19.4 chat encryption needs to be forged
do they not use via version?
or just disable it
doubt so
who uses chat report on their servers?
how are we supposed to know
You can only assume so much
They have a packet translator of some sorts
Via or not, idk
hm.
okay.
what is the most optimised version of minecraft right now?
with support for viaversion perhaps.
1.19.4
what?
the game is pretty simple though.
dont really wanna give away too much of the ideas but i just need access to wool blocks and tnt.
focus more on where the most players are going to come from.
also should i use spigot or paper, which one is more optimised?
Spigot for development
that could be any version though
which is why people use viaversion now, dont they?
not so. Most players have upt to date clients
they use viaversion to get the fringe players with hacked clients
i don't understand how i'm supposed to import it on maven, there's no repo
its on central
work out who your player/customer base is first
its on maven central, you dont need a repo
you can use bstats to see player numbers
they could be 1.8 players or 1.14 players or 1.19 players.
yes, work out which is going to be the majority. Focus on those.
the rest are fringe so you cater to them second
design and get it workgin for the majority. If you want to cater to fringe do that after
thanks
ok but i dont really wanna start developing for a version just because that is what most players use because new versions would probably be released and it may not matter.
you can't plan for the future, it's unknown
Just update then...
people dont really update their servers everytime mojang drops a new version now, do they? They use something like viaversion.
I always keep my projects on the edge
so if i am not updating the server, which version do i use? If i am picking one i gotta stick with, i have to make a good choice though probably.
Most servers I know update. Not immediately but they do
but why?
why what?
why update your server everytime mojang drops a new update?
you lose compatiblility for players playing on older verisons like 1,8 or 1.5.
In most cases it means more optimizations, more features etc
The instant gratification generation
and if you dont update you dont have compatiblility for newer versions.
so i think using viaversion or something else translate packets for versions would be most appropriate.
so i am keeping the version of the actual server same.
i might update the packet translater everytime.
If you have this kind of playerbase then you can just develop for 1.8 and dont worry about the bulk of players.
yeah but i dont really need the new extended world height either to be honest.
for this minigame at least.
Hello there, I still don't know how to use it. Can you provide me with link to some useful articles?
1.9 pvp sucks for fast paced games
and having something redundant means more of a performance cost for not a lot of gain probably.
If you dont need newer features then stay on 1.8
Nobody forces you to use the latest versions. But dont
expect help for software from almost a decade ago.
hm.
Invent your own fast paced combat system.
Its not like we are locked to what mojang gives us.
what is the most optimised version of minecraft right now without the extended world height?
we kinda are though
you can modify what they give us
because i dont really need another 100 rows and columns of blocks per chunk.
like attack speed
for this minigame at least.
Most optimised would be 1.19.4. Most performant would be 1.8
but shit like block hitting wont come back
hm.
i might go with 1.8 for this.
Depends on what you want to do. For minigames it doesnt matter.
Most of the performance hits come from world generation and
additionally ticked blocks/entities. You can have the same performance
from 1.16 to 1.19 if you properly optimize your minigame worlds
When we get world gen Async with a callback games will be so simple to create
"world generation", which is why i am asking which version is most optimised without the extended world height.
If thats your target audience then go for it.
I personally will never work in a 1.8 community again.
Most toxic, childish people i have encountered so far in mc.
Doesnt matter.
If your minigames dont generate vanilla worlds then its irrelevant
OH.
You can still clamp the world height to 256 if you feel like it
can i?
Sure
not in terms of chunk representation
but you can prevent people from placing above 256
i am actually planning on having an empty world.
a void world.
hm.
bascially this.
it doesnt make that big of a difference in memory though because each chunk is devided into 16 block high subsections
so if you dont use the sections it wont allocate them
Chunks can be truncated and extended below or above the current default value.
And this also impacts the size of packets that are being sent.
wtf fr
HOW CAN I DO THAT?
like only in packets or also server side
I think upper limit is 2048 currently
i also wanna suppress lighting updates too.
because this game involves a lot of blocks being changed and i wanna suppress any lighting updates and have a default ambient light value for every block.
how would i do this?
this game may involve about thousands of blocks change a lot.
lighting updates are terrible for performance.
is there an option disabling lighting updates?
you can use nms to directly set the block in a chunk without updating anything i think
hey @echo basalt, sorry to bother, with this code i'm still getting legacy materials, not sure if i'm missing something
public Material parse(Object value) {
Optional<XMaterial> material = XMaterial.matchXMaterial(value.toString());
return material.map(XMaterial::parseMaterial).orElse(null);
}
you can even System.arraycopy block data
not even lights?
dont think so
hm.
You gotta xmaterial more than that
also, how do i clamp the world height?
if it makes the game send fewer packets and actually optimises something.
Let me double check on how chunks are serialized for this. Might be only possible by forking.
what do you mean by that?
yeah i thought it was a public static final
so you either have to fork or fuck with the class at runtime
i might just go with 1.19.4 with a void world for now.
if its a void world, the game does not send any packets right?
no packets for any blocks if there are no blocks, right?
not big ones I think it does send data packets
but not big ones
also it wont allocate memory for the void
so thats nice
Ok it looks like chunk packets are even truncated for every height. It checks the max height
of a chunk and simply doesnt send anything above the highest block (because its all air anyways).
So simply having small chunks is enough.
meaning it depends on the heightmap of the world?
Yeah. Pretty much on the heightmap of each chunk
per column of blocks in the 16x16 area of the chunk or like per chunk?
sorry if i am asking too many questions but i am kind of curious.
eh nvm.
idk there are several height maps. Cant quite decipher what they are all for.
hm.
Are you expecting hundreds of concurrent players to play on a single server?
of course not YET.
but i think its good principle to have a good foundation to start on.
which is why i am asking so many questions because i am currently working on the foundations of the project which may include things that might be difficult to change in the future.
Just start servers as you need them.
Run like 3 minigames per server and if new games start, you simply check if one of the running instances has
some space for more minigames or if you need to start more servers.
Then get a CPU with 8+ cores and you should be set.
hm.
Youll need to do that eventually if you want to be scalable
Myeah, im assuming that it would look weird without some
additional magic.
Premature optimization is the root of all evil
ik but it is also probably not okay to not prepare properly though.
It just seems like you’re optimizing things that don’t need to be
And if you spend a year building optimizations for something that could happen in the future, you won’t have been spending that year gaining players
Which is more important anyways
Get something running
Get your players (very difficult)
Then as you need to scale up you can apply custom patches like that
yeah ik that.
getting actual players would perhaps be one of the most critical or all of this effort may end up being a waste.
i should probably not worry about scalability if i have no players to scale for and ik that but i am kind of serious about this project.
ok then.
do what you want
But hundreds of concurrent players is a lot of players
I’ve heard some rough estimates from someone at photon (they make networking solutions for unity engine)
DAU is 20x CCU and MAU is 20x DAU
so 100 CCU might not sound like a lot but that could be around 2000 daily active users and 40,000 monthly active users
It’s not worth scaling for 100 concurrent users if you aren’t likely to have it
If you have 100 active players every day, that might only correlate to 5-10 concurrent users most of the time
Of course just a rough estimate but
that probably only holds up for a large userbase
Sure
But 100 concurrent users is a large user base
You’re not gonna get there easily
For smaller userbases you are going to have the issue of the load not being spread out over a day
So I don’t see the value in designing infrastructure for hundreds of active players while you have zero
Just not worth the effort
The time spent on that is time that could be spent on player acquisition
I have a discord of 40 people who play on my little servers I release every few months
Highest concurrent is maybe 15-20 on launch day
And then 5-10 on peak hours after that
Anyways if you really want to design this
Like @quaint mantle if it’s something you’re passionate about
Then go for it
But if you’re just doing because you think you need to
Then I wouldn’t recommend it
If you think it’ll be a fun challenge then have fun
orrr just use Minestom hurr durrr
No point in doing all that work if you don't even know if players will like the game type, or you will even attract any players at all
That being said I do believe that it makes sense to put in some thought in how it is going to scale in the future and to act accordingly
as I said earlier, target the largest player base and get somethign workgin so you know if there is any interest at all
But the details needn't necessarily be figured out from the get-go
A rushed launch may be better than no launch at all
If he gets interest he can always rewrite for scalability/performance
lol i know that first hand because i have started a lot of servers before.
i might just wanna build a cool server though, not so worried about how many players it might end up getting right now.
and well, this is the start, and if i am already doing this, why not do it right?
so yep, that is probably what i wanna do.
hm.
you create a proof of concept and see if there is likely to be interest
ala Minecraft Alpha/Beta
the game is interesting, you will see once i finish it.
I don;t play any game modes
fair.
What is interesting to you may not be to others, which is why you always do proof of concept before going big
hm.
I made a little battle royale gamemode for my friends and I in about two days and the code is so disgusting
But it worked well enough for us to play it and have a good time
Imagine actually playing the game 😄
Good one!!!!!!
what's wrong
lol what is that?
get block on X Y Z
i, i1, i2?
bukkit be like
ikr.
that looks like nms not bukkit
world also has getBlockAt for ints
yep but i1,i2,i3 looks like decompiled
maybe
Download the javadocs in maven.
?nms
Your CommandCallback looks like a Runnable. Just with extra steps.
I would silently remove this class
ik.
but i might change it later so eh.
i was gonna pass the arguments to the function but.
doing this instead.
oh and it throws exceptions which regular runnables probably dont.
wouldnt you only need to do it when you have multiple databases
no need to standardize if i only have 1 databse
True but you can just make it once and copypaste across projects
standardize between projects
Dont create references of game objects on the heap.
Looking at CommandSender here
how do i disable a command if a if statement is true
unregister it?
then how do i register it again
Depends on what you mean by disable
disable = cannot be run
just return
how
return;
What are you doing to make it send the message
p.sendMessage("task completed");
well i tried doing this:
@EventHandler
public void onCommand(PlayerCommandPreprocessEvent event){
List<String> ignore_commands = new ArrayList<>();
for (String command : ignore_commands) {
if (event.getMessage().startsWith(command.toLowerCase()) && Commands.isEventRunning) {
event.getPlayer().sendMessage(ChatColor.RED + "This command is disabled!");
event.setCancelled(true);
break;
}
}
}
``` idk why its not working
I mean how are you igniting the TNT
this should work right?
Is it telling you the command is disabled?
with a flint and steel
nah it aint, thats the problem
Have you registered the event
yep
no there is something in the list
where do you add it
Not in the code you sent
i just didn't put it in the code cause then it will be long
?paste it then
what item can I use to portray animals in a hunting command menu?
in the fishing menu i am able to use Material.FISH but dunno what I could do in this one
uncooked meat
hm...
getServer().getPluginManager().registerEvents(new LightTNT(), this);
Just did some quick research, that event isn’t called when TNT is lit
That’s only called when a block catches fire
wow
Could use spawn eggs
Although continuing my search has yielded conflicting information, standby
Your options are fairly limited then
@EventHandler
public void onCommand(PlayerCommandPreprocessEvent event){
if (event.getMessage().startsWith("/help")) {
event.getPlayer().sendMessage(ChatColor.RED + "This command is disabled!");
event.setCancelled(true);
}
}
``` ok, this should work right
i just simplified it
maybe i could do a player head with a cow skin? :p
Theoretically
whats the COmmands.isEventRunning for
That would work
(skin randomized for animal options)
Just negate the permission?
i just need to find a player who has a cow skin who will never change it
ignore that
or actually no
assume that it is true
idk how im dumb
how
with a permission plugin
i want to do it for a specific condition
Delving into permissions seems like an over complication
The event is fine for this use case
@brave sparrow so why isnt it working?
You can’t compile a jar file for a later version of java with the java 8 SDK
It tells you what to do
Read the full thread, it gives you the information you need
how can I set the skin of a skull to one from a link?
what version
This code should prevent someone from running /help yes
You may want to include case matching though
Yes, the event includes the slash
hmm ok
thanks
the first one works fine :p
but only for 1.18.1+
rip 1.14.* - 1.18 support
nah im good
public void setTexture(SkullMeta meta, String texture) {
GameProfile gameProfile = new GameProfile(UUID.randomUUID(), "");
PropertyMap propertyMap = gameProfile.getProperties();
propertyMap.put("textures", new Property("textures", texture));
try {
Field profileField = meta.getClass().getDeclaredField("profile");
profileField.setAccessible(true);
profileField.set(meta, gameProfile);
profileField.setAccessible(false);
} catch (NoSuchFieldException | IllegalAccessException ex) {
ex.printStackTrace();
}
}
oh.
is there a way to make it so a player cannot close a menu if they try to do it with esc or something but if I do it from inside the plugin it closes
storeUser.thenCompose(data -> database.fetchStats(uuid)).thenAccept(stats -> ...)
you gotta keep track of where you close it, and where a player closes it
any listener which can tell the diff between those?
ñope
oof
I should use a concurrent map inside a asynchronous task, right?
Basically a cooldown. I’ll store a boolean value in a map to every player and some time after a player executes an action it’s value in the map must be set to false
But I would set it to false with an asynchronous task
I’m not
Why are you doing it async
u use it when u read and write to a map concurrently
Not necessarily, you can use it in that case but you don’t have to
if u have multiple threads, but lets say u have memory fences or other memory order effects then chm may not be necessary
Synchronized maps or synchronized blocks can be just as valid ways to accomplish that if you aren’t trying to achieve high throughput reads+writes across multiple threads
So far it doesn’t sound as if this needs to involve multiple threads at all
indeed truly
More just a general "you are spigot devs so i assume ya know" is there a place we take / can request commisions development wise?
Not got a particular need rn but just curious
?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/
cheers
Hi!
I'm just starting out and I'm trying to detect whenever a minecart is spawned and then set it's max speed.
I'm stuck on the first part, because I tried doing something like this:
public class Events implements Listener {
@EventHandler
public void MinecartSpawn(EntitySpawnEvent event) {
Entity entity = event.getEntity();
if (entity.getType() != EntityType.MINECART) {
getLogger().info("sorry no " + entity.getType() + " allowed");
return;
}
getLogger().info("yo no way: " + entity);
entity.remove();
}
}
and it seems to work on every other entity I have tried except minecarts.
is this some kind of unwritten rule that minecarts are weird?
I also want to know how to convert an Entity to a Minecart so I can use Minecart specific functions like setMaxSpeed()
I assume you are getting the guard check message?
wehn in stead you want the "yo no way : " message
Yeah I'm trying to use a guard clause
Im asking if the guard clause is what is proccing or not
i.e. which are you getting of the 2?
hi.
how do you decipher a complex api you have never worked with or have no context of what it does exactly?
How do i delete this NPC?
https://paste.md-5.net/kaxifutaka.cs
Pray they have good documentation
they do.
i don't understand, when I spawn a minecart just nothing happens\
no log
no nothing
not sure about it being good.
Put a try catch in
what plugin?
and see what the error is
Or even better
im an idiot MC logs do it auto usually.
Go to ur console and see if an error pops up when u try
Cause my answer wil be sliiightly differetn depending haha
Is there a way to make something unburnable so it isnt destroyed in fire/lava like how netherite is?
Not sure myself but one would assume bukkit has an item burn event of some sort
if(!p.hasPermission("nextcore.setspawn")){
return true;
}
Location location = p.getLocation();
plugin.getConfig().set("spawn", location);
plugin.saveConfig();
Can anyone help? So i try to make "fast return" or something call like that, but i dont understand too much. I watch some tutorial but yea...
Which DB are you using?
ywhea
INSERT INTO table_name (id, name) VALUES (?, ?) ON DUPLICATE KEY UPDATE;
i dont want to update
Whats your plan then?
No. So when they haven't permission, they cant set spawn
ok ill do on duplicate key update
early escape.
Yeah this should work.
If they dont have the permission then it wont run the code below
Ok thanks bro
Seems to work. but now if I want to do the same with boats.
I have this:
public class Events implements Listener {
@EventHandler
public void minecartCreate(VehicleCreateEvent event) {
if (event.getVehicle() instanceof Minecart cart) {
getLogger().info("got cart: " + cart);
cart.setMaxSpeed(10);
}
if (event.getVehicle() instanceof Boat boat) {
getLogger().info("got boat: " + boat);
}
}
}
it just throws an error whenever a boat is made:
jesus
what have i done
?paste
You think it will work if I switch to spigot?
Update your server and if the problem persists then complain on the paper discord
?tas
its a shortcut
idk
idk
Try And See TAS
it's up to date
so
time to complain
then why idc stands for I don’t care? It should be idnc
or in the grammar of 72% of spigot forums posts, why not "mnc" for "me no carings"
yeah i'm fine
