#help-development
1 messages · Page 893 of 1
I'd try this https://www.jetbrains.com/help/idea/convert-a-regular-project-into-a-maven-project.html#develop_with_maven
then you only have to add spigot-api to the pom and then hope that it doesnt require any further dependencies
Pls tell me that the Extensions folder doesnt contain the whole compiled spigot jar.
I see. Whats in the bin folder?
Weird name. Well at least he didnt push his dependencies with the project.
But you wont be able to compile it like this 
why does this always say "Your not in the chunk where you saved the location!"?
https://pastebin.com/eFJ16xWi
Pastebin.com is the number one paste tool since 2002. Pastebin is a website where you can store text online for a set period of time.
Why no extension 
Right click the folder and Mark them as source
Because the chunks are not equal 
but thats the thing, the player is always in the same chunk
i even tried not to even move
Print out if the chunk is maybe null.
After that print out x and y of both chunks.
why is there a "," missing there ?
Print out both chunks pls
here, just use this https://github.com/mfnalex/Instruments
thats what i did
p.getLocation().getChunk() and chunkGlobal. Before
if (p.getLocation().getChunk().equals(chunkGlobal)) {
oh ok
wait, chunkGlobal is null
but i put chunkGlobal = chunk;
Yeah, what i expected
thanks
how do i make chunkGlobal equal to chunk then?
yeah I had a typo at first, fixed it
Add this constructor and tell me how often you get this msg
private static int counter = 0;
public CommandExecutor() {
System.out.println("> Command instance created: " + (++counter));
}
Also: Make your fields all private
the Location locationGlobal; and the Chunk chunkGlobal;?
it works
i made them all private static
thanks for the help
Can someone tell me how i can get my YamlConfig out of another class then main?
Anyone else?
Is it possible to somehow reflect fake online in the server menu when the player sees the title icon, etc.? nms
Dont make them static please!
?di
Guide to dependency injection: https://www.spigotmc.org/wiki/using-dependency-injection/
what is a dependency injection
Read the link
yes. just send some player packets
ok
You mean multiplayer menu?
Like the server list?
Quite easy there
Ah okay, is it the same with setting something in the yaml config?
which ?
No its a generall programming concept you should def learn
if anything I'm not talking about the tab when logging into the server
This ? @upper hazel
yes
Sorry im new to coding in java, i will def learn the basics but right now how can i set something in my config from a different class
?di
Guide to dependency injection: https://www.spigotmc.org/wiki/using-dependency-injection/
ok-

what was the modt event called again?
static works just fine
tell me which package is needed 1.17.1
oh
Default spigot does not expose it in the ping event
Because static is dangerous and it masks your actual problem.
You are probably creating multiple instances of your command class. Dont do that.
this in nms or spigot
You’d have to edit the packet
is there a way to just deny the ServerListPingEvent event? So that the pinger never gets an answer
No
Intercept packet i guess
Yes
there is an event for it
and what can replace ClientboundPlayerInfoPacket in versions starting from 1.19.4
declaration: package: org.bukkit.event.server, class: ServerListPingEvent
I can't just deny it tho, can I? Like, just not send an answer at all
hmmm, I guess it doesn't have cancellable
nvm about the event, however though you can use the event to change some things
Kinda outdated
I know, I already use it to change the max player count
However, if the packet is not sent, it makes the server show up as not online
Paper has a more customizable one if ur just coding for urself https://jd.papermc.io/paper/1.20/com/destroystokyo/paper/event/server/PaperServerListPingEvent.html
declaration: package: com.destroystokyo.paper.event.server, class: PaperServerListPingEvent
but it doesn't prevent a client from connecting
Using a proxy?
why would I use a proxy
Well proxies have better events for it so you would be in luck
I need to change the current quantity
Would this work? i put that in my main class
No need to load it like that
getConfig and saveDefaultConfig / saveConfig works
but it does work, right?
i just want it to work
because they are obviously new
yea sorry
and don't understand how objects can be manipulated
i see i only need one im dumb
I wouldn't necessarily call someone dumb who lacks knowledge and understanding of what they are using
just you need to learn more about the basics though
Can you tell me how i can run setSpawnCoordinatesXYZ from my command class SetLobbyCommand
?di
Guide to dependency injection: https://www.spigotmc.org/wiki/using-dependency-injection/

You pass your JavaPlugin instance throgh the constructor of your SetLobbyCommand class
Remember the world too
new SetLobbyCommand(this)
You speak german by any chance and can join a vc rq in a server
who needs that?
just use the same coords for all the worlds 😄
i have a variable anyway in the main class for the world i dont get it out of the config
who needs dependency injection when you can easily store the memory address to "this" in the system properties, and then in another class get the address from System.getProperty("my_super_plugin_instance_address") and use Unsafe#getObject(...) to get the instance? isn't this much easier?
- I do
- Currently not. Im in another DC call
ok schade
I have a yaml config that looks similar to this:
group:
leader:
canExplode: true
amount: 1
leadTimeInMinutes: 10
citizen:
canExplode: false
amount: 10
How would I go about grabbing the information from the config and putting it into an array? The creator of the config would be able to create additional groups, and I want my plugin to be adaptable to that.
ConfigurationSection groups = myConfig.getConfigurationSection("group");
for(String groupName : groups.getKeys(false)) {
// groupName is "leader", "citizen", ...
}
ty
Alright, in 2min if you still need help
https://paste.md-5.net/ifagavapub.java - why in some versions it is not possible to create a player info in the tab?
1.19.4
1.20
?notworking
"Does not working" is a useless statement. Please describe what exactly is not working, what you expect it to do, and what actually happens. If you get any console errors, also ?paste the entire stacktrace.
?
it is possible
if something is not working with your code, then tell us what exactly doesn't work and whether you get any errors
well, the problem is that the package with data about the fake player is not displayed in the tab
even if I send it to the player
the code seems to be correct
Maybe some package is missing?
hey does someone know how i could display a balance like this in a gui/ Inventrory? https://prnt.sc/DFQ3vo9-1qYr
all of it 😄
i need to know how to do it i thought about making a item for every number from 0-9 and coding something that formates it to the items. but i realy hope there is a easyer way
How close to that image do you want it to look? And do you plan on using a resource pack?
i have a costume resource pack so ya
it should display the balance it does not have to be a beauty
So you just want to show items as numbers?
How do you do when you have to work with multiple git branches and have ignored dist, node_modules and package-lock.json files in each branch. But when you switch branches, the damn ignored folders and/or files still persist in directory you changed branch what's the solution to this?
well this would be my methode if yours is a other that is easyer that would be nice 😄
lock files shouldn't be ignored
also just npm install when you switch branch
right, but what about the files being persisted?
they're still tracked in these other branches it seems. Try git clean -xdn, this shouldn't do anything but only print those files. Then if you want to delete them (from the repo, not the files itself) run git clean -xdf
I mean it's up to you and how you want it to look
what would be your methode?
Come up with a design and then start implementing it
right, but there is no way that dist files and node_modules persist only in the branch they are, but being ignored to git. And also, if you changed to another repo they just persist in their own branch*, no across all the branches you change ¿?
hey i dont quite get what modules are used for, as in my case i cant even access the modules classes without having it as a dependency even tho they are in the same project?
if they different projects, needs to install them on a repository, can be remote or localy
How do I get started making plugins?
do you know basic java?
Kinda still learning but I know Varibles, type casting, Syntax, and a bit more but I mainly know C# and they're pretty similar so far
You're in for a treat.
Ohh
ok so, here's a guide on how to setup your IDE using maven, to get a basic project layout for spigot plugins: https://blog.jeff-media.com/how-to-create-your-first-minecraft-plugin-using-the-spigot-api-and-maven/
After that, there's a ton of guides on the forums, e.g. how to listen to events: https://www.spigotmc.org/wiki/using-the-event-api/
or how to create a simpe command: https://www.spigotmc.org/wiki/create-a-simple-command/
They get different pretty fast
For Beginners:
Codecademy - Learn Java: Interactive Java programming course from basics to more advanced concepts. Perfect for absolute beginners.
https://www.codecademy.com/learn/learn-java
JetBrains Academy - Java Developer Track: Learn by doing with projects and challenges. It covers Java fundamentals to advanced topics.
https://www.jetbrains.com/academy/
Udemy - Java Programming Masterclass for Software Developers: Updated courses that cover Java 8 to Java 17 features. Suitable for those who prefer structured learning.
https://www.udemy.com/course/java-the-complete-java-developer-course/
For Intermediate to Advanced Learners:
Oracle Java Tutorials: The official guides by Oracle for Java programming—great for understanding the depth of Java.
https://docs.oracle.com/javase/tutorial/
Baeldung - Learn Java and Spring: Focus on Spring Framework and modern Java technologies. Best for intermediate learners aiming to expand their knowledge.
https://www.baeldung.com/
Practice and Hands-on Learning:
Exercism - Java Track: Solve exercises and get feedback from mentors. Great for practicing coding skills.
https://exercism.io/tracks/java
LeetCode: Practice your coding skills and prepare for technical interviews with Java.
https://leetcode.com/
Free Resources and Documentation:
Java Programming and Documentation: A comprehensive collection of Java programming guides, tutorials, and API documentation.
https://docs.oracle.com/en/java/
Community and Support:
Stack Overflow: A vast community of developers. Great for getting help with specific problems or understanding concepts.
https://stackoverflow.com/questions/tagged/java
r/learnjava on Reddit: Join the community of Java learners and get advice, share resources, and discuss projects.
https://www.reddit.com/r/learnjava/
Remember: Learning to program takes practice and patience. Don't hesitate to experiment with code and participate in community discussions. Happy coding! 🎉
Thank you!
What IDE do you use?
IntelliJ
That's what I was downloading with a free trial, was it worth buying in hindsight?
You can use it for ever free downloading the free version
Oh I didn't see the free version thanks.
np, we are here to help to each others
How do you get CLI arguments passed into a gradle.kts task e.g. if I want to run task ExampleTask how would you retrieve/verify the arguments. My current setup in buildSrc
open class ExampleTask : DefaultTask() {
@TaskAction
fun testAction() {
// how to verify / get CLI arguments here?
}
}
^ nvm had wrong search terms found the answer I was looking for on the web
What happened to EntityCombustByEntityEvent? It doesn’t exist anymore and breaking my plugin along with others when I update spigot to latest. Did it get renamed or removed?
well the other args are also tasks
you can either pass properties like -PmyVar=asd
or you can take a look at how this plugin does it: https://plugins.gradle.org/plugin/com.dorongold.task-tree
That somehow is able to capture the "args" that were passed behind that task
or what do you mean exactly with CLI arguments?
It still exists for me on latest spigot
I got this to work, but thie tutorial was java I wonder how you could minimize this with kotlin
private var sourceVersion: String = "v1_20_R3"
@Option(option = "sourceVersion", description = "sets the version to copy the NMS source from")
fun setSourceVersion(sourceVersion: String) {
this.sourceVersion = sourceVersion
}
@Input
fun getSourceVersion(): String {
return this.sourceVersion
}
@TaskAction
fun upgradeNMS() {
logger.info(sourceVersion)
}```
can't you make the var non-private and move the @Option and @Input directly to the var?
not sure lemme check
both annotations can be used on fields, that I'm sure
yep @tender shard thx
does this actually allow you to do gradlew upgradenms 1.2.3 or how do those options work?
going to do
./gradew upgradenms --source v1_20_R2 --target v1_20_R3
I need to still make a java parser so I can give out a document of changes
@get:Input
var blah
is the correct way
parsing java for type tokens and parsing it through MojMaps is still quite a pain though
so I'm saving that for further down the line
its something that will need to be done in a separate project way to hefty for a simple buildSrc script
I will probably add it inside of our remapper along with our upgrader and such
if @remote swallow would ever finish the remapper :P
🤔 now what the fuck did I do wrong lol
> Command-line option '--source' does not take an argument.
@set:Input
@get:Option(option = "source", description = "sets the version to copy the NMS source from")
var source: String = "v1_20_R3"
@set:Input
@get:Option(option = "target", description = "the version to copy the NMS implementation to")
var target: String? = null
get input
maybe its a conflicting name
iirc
that does it
yeah I had it switched around lmao
?paste
can someone help me on which version should i build my plugin if im running 1.16 server and plugin is using spigot api for 1.16 i changed sdk version accidentally and i dont know to which version should i reverse it back to also bonus question do i need to change something in pom.xml also or no only in project structure of intellij
any help myb ?
yes
i need to know on which version of java should i compile plugin for it to work to get enabled
i run server on java 8 and i compile plugin on java 8 but it doesnt enable plugin properly
where can i find that
yes
if it is this <source> and <target> i set it to 11 and it is not working
it worked until now until i changed on which sdk it is compiling it on
so you are saying in maven i should set target and source to 1.8 and in project structure i should set it to 1.8
no no it is still the same thing
?paste
which version of hikari?
4.8.3 is the latest that works with java 8
you're probably using a newer JDK to run maven
but set it to 8 in IJ
hikari 5 requires java 11

Is there a good guide on menus? I have heard that menus are very easily exploited if done wrong
command when
there's any guide about hotswap?
download jebtrains runtime, download hotswap agent and put it inside lib/hotswap start the server with -XX:+AllowEnhancedClassRedefinition -XX:+AllowRedefinitionToAddDeleteMethods -agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=*:5005 -XX:HotswapAgent=fatjar and jetbrains runtime, create a debug task in intellij then set a keybind for compile and reload then press that every time you want to hotswap
both are intellij plugins?
just to let you know i allready have 2 digits that displays in the right way 😄 https://prnt.sc/MonHxlxgVsYG
are there any good tutorials for ACF?
no, jars online
yes but I meant like youtube wise / in video form
Fr @young knoll command when??
whats the event for like water expanding sand falling etc
Math problem:
for (int i = 0; i < totalPlayers; i++) {
double angle = 2 * Math.PI * i / totalPlayers;
double x = centerX + circleRadius * Math.cos(angle);
double z= centerZ + circleRadius * Math.sin(angle);
Player player = alivePlayers.get(i);
Location location = new Location(world, x, spawnHeight, z);
Location blockLocation = new Location(player.getWorld(), x, spawnHeight - 1, z);
blockLocation.getBlock().setType(Material.BEDROCK);
player.setVelocity(new Vector());
player.teleport(location);
}
I need to spawn the player in the middle of the block not next to it, not on the edge, in middle
To spawn the player in the middle of the block rather than on the edge, you need to adjust the x and z coordinates by half of the block size I think
Yeah just add 0.5 to the x and z
Assuming they are integers
If not just floor them then add 0.5
i tried that
it didnt work xd
some people spawned in the middle
some spawned 1 block away in the middle
Flooring rounds down
It rounds down to next whole int
its arlguth i found the problem
and a fix
i used the location objects i generated using pi
so instead of using them
i got their block
and then the location of their block
and did +0.5 on them
it works now
There you go. But was explaining the discrepancy you experienced lol
So it doesnt seem so mysterious lol
lol nother match problem
i have x locations
all looking west
i need them all to look to 0-0
face*
Set yaw and pitch to 0
One message removed from a suspended account.
One message removed from a suspended account.
One message removed from a suspended account.
?support
if its server related ask the question on #help-server
One message removed from a suspended account.
One message removed from a suspended account.
?ask
If you have a question, please just ask it. Don't look for staff or topic experts. Don't ask to ask or ask if people are awake or available. Just ask the question to the channel straight out, and wait patiently for a reply. Make sure you use the right channel regarding the topic of your question. Create a thread in case the channel is already in use!
they are all at dfferent points in the word
i need them to look at the cord 0-0
Oh
Get the vector between the location and 0,0 and then use that to set the rotation
You can get the vector between two points by subtracting them
And you can convert a location to a vector with .toVector
Anyone know what "your-plugin-handler" would actually be from?
ChannelPipeline pipeline = ((CraftPlayer) player).getHandle().playerConnection.networkManager.channel.pipeline();
pipeline.addBefore("your_plugin_handler", player.getName(), channelDuplexHandler);
Like... what is it? Just the plugin .tostring?
Some sort of unique string for your plugin
Could just be a string representation of a namespaced key to keep it simple
This isnt hard. You just need to map the directions
[20:22:40 ERROR]: Could not pass event PlayerJoinEvent to AesopianProject v1.3.0
java.util.NoSuchElementException: aesop_proj_handler
at io.netty.channel.DefaultChannelPipeline.getContextOrDie(DefaultChannelPipeline.java:1073) ~[netty-all-4.1.68.Final.jar:4.1.68.Final]
at io.netty.channel.DefaultChannelPipeline.addBefore(DefaultChannelPipeline.java:302) ~[netty-all-4.1.68.Final.jar:4.1.68.Final]
at io.netty.channel.DefaultChannelPipeline.addBefore(DefaultChannelPipeline.java:290) ~[netty-all-4.1.68.Final.jar:4.1.68.Final]
at co.lotc.aesopianproject.PacketTestClass.injectPlayer(PacketTestClass.java:39) ~[AesopianProject.jar:?]
at co.lotc.aesopianproject.listeners.SpellListener.injection(SpellListener.java:94) ~[AesopianProject.jar:?]
etc
the first string in addBefore is the handler you want to add yours before
e.g. timeout, packet_handler, packet_decoder, etc
or w/e the names are
i have no idea what the names are
the ones already in the pipeline
if you have nms set up you can find them in the Connection class
where the pipeline is configured
I do have nms set up but they don't seem to be like an immediate subclass of the connection class
they aren't subclasses afaik
there's a static method where the pipeline is configured but i don't know what it's called
eh
let me just see if any of the three you listed
as strings
work
works
sweet
ah
damn
i was hoping for a way to drive an entity i was spectating
but it seems like all my packets for movement really are dead
@slender elbow you wouldn't happen to know a way to get spectate shaders while still being able to move, would you? ;p
hm while in spectator, i think not
it seems like the client skips all movement packets entirely when it's spectating another entity
Help
if (blockUnderPlayer.getType() == Material.TNT) {
System.out.println(player.getName() + "玩家移动到了TNT上");
Vector direction = player.getLocation().getDirection().multiply(1);
direction.setY(knockback); // 设置击退的力度,可以根据需要调整
player.setVelocity(direction); // 对玩家施加击退效果 if (blockUnderPlayer.getType() == Material.TNT) {
System.out.println(player.getName() + "玩家移动到了TNT上");
Vector direction = player.getLocation().getDirection().multiply(1);
direction.setY(knockback); // 设置击退的力度,可以根据需要调整
player.setVelocity(direction); // 对玩家施加击退效果
#欢迎使用本插件
#设置TNT击退的强度
knockback: 2.5
saveDefaultConfig();
FileConfiguration config = getConfig();
// 从配置文件中读取击退值并传递给 TNT_Listener
double knockback = config.getDouble("knockback", 1.0);
Is there a problem with my 3 pieces of code?
Why did I change the knockback value to knockbackWhy did I change the knockback value to knockback
It didn’t work, because I was printing out the block every time this event was called and it just printed out the block above the hopper. But I think I have a solution to this. Each time this event happens get the below block of the hopper and check if it’s a PLAYER_HEAD and then trigger a function with the rest of the logic
(Offline Server) Is there a way to change player name? I mean literally player name, not display name. (Idk, something with packets, reflection or only normal functions)
I want to implement this in a Login plugin
You can use protocollib
PacketType.Play.Server.PLAYER_INFO
I can cook you up a minimal example for how to do it but it'd be kotlin
No problem
Oh wait
When i said packet method, i mean a packet that direct changes player name for joining offline server, something that impacts on serverside
class PacketLoginListener(private val instance: JavaPlugin) : PacketAdapter(
instance, ListenerPriority.LOWEST, PacketType.Play.Server.PLAYER_INFO
) {
override fun onPacketSending(packetEvent: PacketEvent) {
if (packetEvent.packet.playerInfoAction.read(0) != EnumWrappers.PlayerInfoAction.ADD_PLAYER) return
val newPlayerInfoDataList: MutableList<PlayerInfoData?> = ArrayList()
for (playerInfoData in packetEvent.packet.playerInfoDataLists.read(0)) {
// Work on each player.
if (playerInfoData?.profile == null || Bukkit.getPlayer(playerInfoData.profile.uuid) == null) {
// Unknown player, add it to new players.
newPlayerInfoDataList.add(playerInfoData)
continue
}
newPlayerInfoDataList.add(
PlayerInfoData(
playerInfoData.profile
.withName(NAME)
.withId(UUIDSTRING),
playerInfoData.latency,
playerInfoData.gameMode,
playerInfoData.displayName
)
)
}
packetEvent.packet.playerInfoDataLists.write(0, newPlayerInfoDataList)
}
}
something like this
This isnt only client-sided?
This changes the login packet
the server will see the modified packet
and will register accordingly
how I got this, I don't remember
but I've had this snippet in a plugin I'm working on for a while
and I know it does work
Hmmm, so, i will make a verification if the player is a cracked player or not, if it is, a "#" will be placed on name
I want other plugins that save data on nicks instead UUID, save "Nick#" instead "Nick"
It will do it?
It should, yes.
This modifies the player's actual UUID and name
and gets rid of the old one
It will intercept the login packet
I don't think it's possible really to change the player's name and UUID while they exist still
that would be... hard.
Xd
No problem
Ty bro
I will save your code
And try to convert to Java
Bro, im thinking right now
Its useless if its used on a network
Yes or no?
Network //BungeeCord
I suppose
Ill try to find an alternative using Protocolize
You technically could arbitrarily change their uuid. The only place you wouldnt be able to is during the login process. Otherwise auth/validation checks would fail. Also player skin may not show properly unless you fetch it appropriately as well.
Not sure if the client would be aware of it though
However i dont really see why it would be necessary to change their uuid though
The client as far as i am aware doesnt care about uuid except during login
Fun to know
Because if you were in offline mode the client doesnt send a uuid and its the server that makes one up but doesnt tell the client the uuod either except to other players in the tab list
Same is true for online mode, but in online mode the client does send uuid to say hey this is me, server takes that and then asks mojang servers if that is true and then after that server doesnt really care about the uuid except for consistency in stuff
Now it may be a pain though to make something work for changing player uuids though because nms and there is a lot of places that you might have to check lol
Like for example, when you ban a player via name the server does a lookup of the uuid of said name to ban
I never really looked too hard into the whole packet pipeline, a lot of back and forth and keeping track
wiki.vg is nice though
what could be some reasons my config file is generating empty?
how can I make the spawner work at any time of the day?
Mob spawners care about the time of day?
they depend on the level of light
they just depend on the spawning conditions of the mob they spawn
which for monsters means it needs to be dark
Do you need a player to listen to the package or is it not necessary?
You can just write code to spawn mobs
Is it possible to somehow bind the listener to the server?
What are you talking about?
newer vanilla versions added custom mob spawn conditions
too lazy to check the API for this
does somebody know how i can get both the shaded and unshaded jar when i use the mvn install command?
-original should be the non-shaded one
okay, thank you
not work
Why the heck are you trying to use NBT for that
I checked and Spigot does have API for this......
(also, what version are you using, better be something sensible like 1.20)
and in any way, I think you did it wrong, you forgot to set the spawnPotentials to the compound
But again, use the API for this lol
1 16 5
none
send me link to is api, please
cool
outdated version moment
Is there any particular reason for PlayerInteractEvent to not trigger when right clicking air with an item?
pretty sure it does
send it anyway, maybe I can get the code from there?
Tell me what kind of package is used when sending information about an online player to the client menu
approximate name
I mean we're using tens of interact events and checking the item for our abilities
so it def works
unless some spigot commit broke it
there are no methods that would help me: https://hub.spigotmc.org/javadocs/spigot/org/bukkit/block/CreatureSpawner.html
declaration: package: org.bukkit.block, interface: CreatureSpawner
perhaps you are doing something like checking if hand is offhand then return when they only have item in offhand?
¯_(ツ)_/¯
oh, addPotentialSpawn(SpawnerEntry spawnerEntry)
Nope, I dont have any checks. The event doesn't even trigger when I right-click air
uhmm
can I somehow disable the spawner update?
i'm getting that error from like 2h but idk what is the cause
public void onEnable() {
instance = this;
MongoClient mongoClient = MongoClients.create("link to the db");
MongoDatabase database = mongoClient.getDatabase("sews");
ItemManager = new ItemsManager();
gangmanager = new gangmanager();
String collectionName = "playerdata";
if(!collectionExists(database, collectionName)) {
database.createCollection("playerdata");
}
if (getServer().getPluginManager().getPlugin("Vault") != null)
economy.register();
if (getServer().getPluginManager().getPlugin("PlaceholderAPI") != null)
PlaceHolderAPIHook.registerHook();
this.configFile = new FileManager(this, "config.yml");
loadlisteners();
loadCommands();
}```
might wanna censor that mongo url...
yes
ye done hahah
maybe something like blockphysicsevent, I'm not too sure, block update api is a mess (this is where I love Sponge's Cause API)
is there some way to force the players attack cooldown to start? trying to make dual wielding a thing but attacking with offhand (uses LivingEntity#attack()) is not starting an attack cooldown and so you can use things like axes without attack cooldown
nope
you know how can i fix it?
basically mess around until you find the right event, there are a few iirc
blocks dont have a PersistentDataContainer, all data is lost when placed
you can use jeffmedia's block pdc library though and apply pdc to a block anyway
but you'd need to place the item as pdc on that block and have it drop it again when broken
etc.
I don't think it's synced with the client, iirc the server and client just track it themselves
events like that usually happen before the thing actually happens, thats why they're cancellable
so the player will still have the item
I do not, sorry
ok np
also afaik BlockPlaceEvent does have a getItem() method
someone can help me?
looks like the host cannot be resolved?
did u just setup the host maybe?
it was working like 3h ago
what do u need?
I guess at least the ForwardedRedisPacket class
where is the error happening
i.e.
the stack trace
13,9
show your stack trace
top left -> file -> invalidate caches -> invalidate and restart @inner mulch
not really
RedisPacket?
okay
?
what tf is RedisPacket
data sent over redis pub/sub
yes
it didnt resolve the issue, it has to be some kind of caching issue as the constructor obviously takes RedisPacket<P> as a valid parameter.
alr did that
I don't mind
[ERROR] /C:/Users/ichma/IdeaProjects/ServerNetwork/ServerNetwork-CorePaper/src/main/java/de/mars/servernetwork/corepaper/friends/commands/user/ForwardedPacket.java:[13,9] Konstruktor ForwardedRedisPacket in Klasse mars.sql.RedisBuilder.ForwardedRedisPacket<P> kann nicht auf die angegebenen Typen angewendet werden.
[ERROR] Erforderlich: keine Argumente
[ERROR] Ermittelt: de.mars.servernetwork.corevelocity.networking.FindPlayerPacket
[ERROR] Grund: Liste der tatsächlichen Argumente hat eine andere Länge als die der formalen Argumente
[ERROR]
[ERROR] -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoFailureException```
Guys I'm not a yaml expert but essentially it's just a key value map right
With lists
it's slightly more
yaml is like a map of object or map
i.e. each value can hold N amount of values
not a list
example
ok here
section: # Holds multiple named values
valueA: A
valueB: B
etc: etc
mhm
How does minecraft sync local coop with mods
Yeah when you just host your world
A map can be a value
Without bukkit stuff
and the value can be another map
it just starts a server @fluid river
or it can be a list of maps
If you're running fabric it's basically just a fabric server that starts up
But how does it sync mods
Sync mods?
if you're talking about bedrock edition then that's another story
Yeah i got it but the sync between clients
No
There is none
Well industrial craft for example
Map<Object, Object> according to SnakeYAML @quaint mantle
One player places modded block
Packets, all packets
Another player sees that the block is placed and can interact with it
Yeah it just sends to the server "hey I placed this block with this ID", if the server knows about it cool and sends the change to the other clients
it's no different from vanilla blocks
Yeah but its lan hosted stuff
LAN is the same as a normal server
Most interaction is done client side, the only thing the server knows is when you put shit into slots
So when you start lan server, server is also "modded" then
yep
So server knows block id
yep
Did you know your client needs to send packets to itself in singleplayer
Yes
Well, the client server
Yeah ig
A single player world is just a one player server, and when you open to LAN it accepts outside connections
One guy on Fishnet told me about it
Registries and init events
i'm coding a multiplayer moddable game on unity
Oh gosh
and so i need a way to make lan coop with mods possible
i already made mods working for some scenarios
Now rewrite the whole game
but i haven't coded the game itself
i just coded the modloader
and a test mod
which just works on app launch
and writes everything to log file
@fluid river the best way is to assign each mod an ID and a client-side, server-side or both tag, the clients load only with client-side and both, the server loads only with server-side and both, if a client is missing one of the mods tagged as both that the server has then deny the connection
i.e.
Also do version checks
yeah true
^
Bugrok editio'
let the users download manually
Ye
so well, what do i actually start with rn
You can make dynamic mod reloading hopefully
I have a button "LAUNCH COOP" where you set difficulty and that's all
okay wait, what do the mods do
one minute
you need to probably provide an API and have something to load and initialize the mods
also keep track of them and relevant metadata
?paste
what is FindPlayerPacket
this one takes in a <P extends RedisPacket<P>> and you're providing a RedisPacket<FindPlayerPacket>, the easiest fix here is not using generics and just accepting a RedisPacket<?>
for example explosive arrows
RedisPacket<FindPlayerPacket> is the same a P extends RedisPacket<P>???
or new mob creatures
or am i wrong?
which spawn in zones
Type erasure babyyyyyy
whats that
Types are only things for the compiler
Generics are casts, nothing else
runtime doesn't have them
already did
ok so just redispacket<?>
ye, try it out
RedisPacket<RedisPacket<P extends RedisPacket<P>>> is technically the type, or I'm hallucinating hard
wait but i need to use generics in my case
How so
processData, needs to have the exact packet
instanceof
what site i need for check remapped values nms
1s
there has to be a correct way of casting it tho
1s
seems to work for me
public interface Packet<P> {
}
public class PacketA<P extends Packet<P>> implements Packet<P> {
public PacketA(P packet) {
System.out.println(packet);
}
}
public class PacketB implements Packet<PacketB> {
}
@inner mulch
so it works?
that works yes
so the casting happens somewhere else 😠 but i dont cast anything :(
@inner mulch stop deleting stuff
we won't steal your shit
and we can't help you if you keep deleting
ok
so well:
- Start Game
- Press Multiplayer button
- Create new LAN world with difficulty preset
- Open the lobby(you get to the "Awaiting players..." screen) -> Here the server should start
- Another player presses Multiplayer button
- He finds your lobby, clicks join -> Here is where modcheck should happen
- If passed, both players are loaded to Intro scene, where they create a character and add a name to it
- They just play
does it happen at compile time or runtime @inner mulch
yep
send me the error @inner mulch
do you wnat it as pasted?
Ah
so in case i start a singleplayer, i also start a server(but private for 1 player), right?
yep
just don't accept outside connections
Could u start a separate thread for this issue
okay
There's a lot of writing in this channel
it's time to figure out how to code lan server in unity game
gl cya
Hmm having a weird issue rn
It seems like registerEvent(Class<?>, Listener, EventPriority ...) doesn't work for PlayerInteractEvent somehow
Show code?
https://paste.md-5.net/sevubugeco.java <- Event bus
https://paste.md-5.net/yijalecocu.java <- Abstract Item
The debugs for registering work fine and I never dispose the items or the event bus
what the packet i need listen for get olnline count in minecraft menu
were located econ
Is there maybe a plugin that lets u change the entities size like pehkui
there isnt a packet to get the online count it doesnt work like that
not yet possible, once 1.20.5 is released that will be doable with attributes
then how client get online info lol
but that isnt a packet sent to the player right
it is
but the player isnt online
wdym
he means in like the server select menu i think
the player does not necessarily need to send the packet
it returns the players connected to the server
sent already
you can estimate how many people are looking at your server list based on how many IPs ping
does it take information from a file?
nope
But you can get the info from this event
https://hub.spigotmc.org/javadocs/spigot/org/bukkit/event/server/ServerListPingEvent.html
declaration: package: org.bukkit.event.server, class: ServerListPingEvent
what this a packet
This is an outbound event probably
wdym with attributes
i.e. lets you change the data before it is sent to the player
they added scale attributes in 1.20.5
Maybe he should tell us what he wants to actually do, instead of asking about packets.
attributes are minecrafts way of doing stats
so things like attack speed and attack damage are attributes
I need to receive an information package
about online players sent to the client.
oh
Why? What are you trying to accomplish?
so you want to spoof your player count
to increase or what
I sent you a link with the packet.
in client menu
yes
this @upper hazel
This is the packet you want.
https://wiki.vg/Server_List_Ping#Status_Response
TIL that if you have an abstract class that implements Listener, its event handlers wont register
thenks
I swear he has been told the same before
I'm sure there are plugins which already let you spoof the player count, so either use one of them or borrow their code.
are you hoping your server looks more active than it actually is or what
in 1.20 not exists
bc protocolLib not exists in 1.20
they use protocol
spoofed count -> 100
online -> 3
super duper popular server
but uh anyway, anyone know of a way to get the player to attack something and starting their attack cooldown appropriately
using LivingEntity#attack() attacks, but no cooldown
attackspeed is attacks/s
i know
1 / attackSpeed to get the cooldown
you need to do it manually
darn
Hey, so i want to use a library, but i dont wanna add that extra plugin to my plugins directory, so i want to "include" it in my own project/plugin, how can i do this ?
is the library a plugin or nah
set the dependency scope to "compile"
as I said earlier the visual cooldown is most likely clientside
ok gonna try that
yeah and i wanted to see if there was a solution anyway
isn't there a resetcooldown
unfortunately not
man
just look at the implementation of that and do it manually using reflection or something ig
maybe i can use some nms stuff then
yeah
well that was easy
it doesnt give the player the visual attack cooldown bar but it does seem to work
It's trained on it's shitty outputs
Its seen too much. It's having flash backs
degenerative AI
huh why does this happen? I get there could be an ambiguity between Consumer<Item> and Item -> Unit, but why also with the method that doesn't take a Consumer?
but it can't be the first one, that'd need 2 parameters and not 3
sad
is there any better solution than to wrap the dropItem(Naturally) call into a separate function then?
also location param was first
aaay that was the issue lol
with the proper order it works kek
but wouldn't I then have to duplicate the marked line?
val dropMethod: (Location, ItemStack, Consumer<Item>) -> Item =
if (naturally)
world::dropItemNaturally
else
world::dropItem
val droppedItems = mutableSetOf<Item>()
for (item in remaining.values) {
item?.let {
droppedItems += dropMethod(location, it, consumer) // I#d have to duplicate this line
}
}
val dropItem = world::dropNaturally if (naturally) else world::dropItem
dropItem(location, item)```
My friend told me to not use InventoryHolder to indentify inventories why?
Why
You shouldn't extend bukkit interfaces
Why
ABI incompatibility
https://hub.spigotmc.org/javadocs/spigot/
Because the docs say so
package index
And what will happen if i do that?
have you not read it?
What is ABI?
it's explained in the javadocs I sent
Application binary interface
[It] can sometimes work, it is not guaranteed to do so and resulting bugs will be disregarded
there is 0 benefit of using a custom inventoryholder though
a better solution is to create a normal data class that hols all the information you need for an inventory, then store it in a Map<Inventory,MyInventoryData> or whatever
Wha
no, I never properly learnt java, I'm a lawyer
embed fail
Well if you don't know why ABI breakages are bad you have a problem
Laugh at this user - lol
Isn't ABI designed to work on Java code and native code written in other languages, allowing them to interact seamlessly?
Simple answear yes/no
Yes, but if an interface receives a new method, ABI breaks: This error at link time (runtime in the case of JVM languages)
bukkit api doesn't guarantee that the methods etc of the InventoryHolder interface change in the future. Hence your stuff would become incompatible if bukkit changes that interface. it doesn't even guarantee that it will stay to be an interface, it might be an abstract class in the next updatre
It will not be an abstract class - that much is guaranteed
but it could
As invokevirtual and invokeitf are two different opcodes
Not without a transformer
Like yes you could migrate the relevant invokeitf instructions to invokevirt - but why?
You have probably said the most stupid and nonsense thing i have ever read in my career
I am working on some big minecraft server and I had to work with several other developers who told me that I should not implement InventoryHolder and I just wanted to find out what people had in their heads to write such shit
can you advise me a server selector plugin? whitout bungeecord
Yes it mainly is related to the fact that the InventoryHolder interface can get new methods, breaking your plugin
If you are fine with the above - fine by me, but that is like breaking userspace
So you are not implementing InventoryHolder cuz it can get a new method but didn't get it since version 1.8 XDDDDDDD
And then you check inventory by title
Like Vulcan did
If you stay on 1.8 and maintain your own spigot fork: why the hell did you ask?
1.8 is a whole different world: everything goes
How do you know that i maintain my spigot fork? I never said so
Well unless you are using abandonware (or simply never updating your software, which has the same effect) the only way to ensure the ABI never breaks is to maintain said ABI
🤣 🤣 🤣 🤣 🤣 🤣 🤣 🤣
Look I am an API designer, I know this shit better than you do
I doubt it, in work i rarly use java but i really doubt that you know this shit better then i do
And if i am not mistaken while you are API designer you know when InventoryHolder will receive new method?
Or you can avoid giving InventoryHolder new method
And leave open gate to the deveopers leaving them a easy way to check for inventories
Not if you are reliant on others
And if you don't develop some software you are reliant on some aoftware
What the fuck
can you advise me a server selector plugin? with bungeecord even for a fee it's fine
@worldly ingot do you in hypixel implement InventoryHolder? You i mean whole development team
Is it better to try and put as many features as possible in 1 plugin, or spread it around?
Nah i don't belive
I think its best to check inventories by PDC
Though I never do that because too lazy
Well, it sounds like it wouldn't matter for minigames
My server barely has any inventories either way, and I check for if player has permission on InventoryClickEvent
You can do that if it's an inventory that belongs to some block but probably not with one you open with commands
You can split the plugin inti modules
No
No
By the inventory instance
A list (or something) with all currently open invs of a type ig
Implement InventoryHolder and hope for gual to not add method to this interface
If the inv is in the list, it's an inv of your plugin
But if you are making for 1.19 and less just implement it XD
But the best is probably to just write some handler to handle shit for you lol
if you are scared of implementing inventory holder just do something like PlayerAction and make InventoryAction and save it in user
No absolutely not lol
Then do you check it by names?
Then how do you do that let's take a sneak peek
Reminds me of that recent exploit in the anticheat lmao
Yeah sure lemme just violate my NDA for you 
Well i am sure you can give us a hint about that
Yeah I mean just from experience, all you really need to do is keep reference to an InventoryView
Violate your NDA for a random stranger whose name is a number? Fuck yeah
Well probably you have never signed NDA but in my company we can not share any source code evern snippets, but i can speak freely about what techniques we use
That way you can just describe how your code works ._.
Nothing wrong with that i can do that
The other thing is that you need skill to implement that
Of course i can not say everything
But i could save how we manage inventories
Didn't know hypixel have that strict NDA
That's actually insane and not a very good NDA
One of the main stipulations in an NDA is to keep trade secrets lol
The secret is the spaghetti
inventory.getTitle().equals("title")
I was too lazy to say everything because instead of one point saying that you can't talk about anything, we have a multi-page list of what you can and can't talk about.
ew
Definitely
Laughs in Vulcan
But really, if you want to create a GUI, it comes down to this:
// Somewhere, store this in a map
InventoryView view = player.openInventory(inventory);
theMap.put(view, new MyGuiClassThing());
// In a listener
@EventHandler
private void onClick(InventoryClickEvent event) {
MyGuiClassThing gui = theMap.get(event.getView());
if (gui != null) {
// You have your player's GUI view thing, yeah, do your thing
}
}
Hehehe
best method :)
No, this isn't Hypixel code, this is just how I would do GUIs personally
@Simon !!!1111
Lol
@hypixelbigman
Bdw you said "most of the team understand that implementing InventoryHolder is bad idea". Are there people who think it's good?
Or am i solo
No probably not lol
It's generally understood as not a good idea to implement Bukkit interfaces
implements Listener :(
Unless you are developing craftbukkit
which one should I do
what does data functions do?
Hi I am looking for plugin that with commands turn on and off pvp and nothing else do someone know something?
#help-server unless youre coding the plugin yourself
in general I think its more reasonable, and often necessary to have the initialization part inside onEnable, primarily since ur classes usually demand a fixed order in how they're created
ok 33 ill do that
Be patient
No need to post that everywhere
"scared of implementing" 
Imposter syndrome
At least how most applications handle it is by keeping a reference to the inventory itself or it's content. My GUI library for example handles it that way. When interacting you just use referential equality and you're set
you monster
why, its the best method, trust me bro
Ewwww
😵🤢
Exactly. Just use uuid as titles
¯_(ツ)_/¯
Lmao
Enjoy your force op exploit or whatever

10,000,000,000,000,000 IQ
10,000,000,000,000,000,000,000
I mean, yes, we need more of those
Because when a new one appears, someone makes a new video on it
And then I can have lunch while watching it
10E69
no u
how the fuck is Files#create throwing a NoSuchFileException>???
yeah no shit it doesn't exist lmao
private fun replaceFileContent(originalFile: Path, file: Path, replacements: Map<String, String>) {
var content = originalFile.readText()
replacements.forEach { (key, value) ->
content = content.replace(key, value)
}
if (Files.notExists(file)) {
Files.createFile(file)
}
file.writeText(content)
}```
Caused by: java.nio.file.NoSuchFileException: spigot-v1_20_R2/src/main/java/sh/miles/pineapple/nms/impl/v1_20_R2/inventory/scene/PineappleSceneFactory.java
at PineappleNMS.replaceFileContent(PineappleNMS.kt:78)
line 78?? Files.createFile(file)
You're just not creating it good enough
clearly
smh I did a fail
no
the path doesn't exist smh
I supplied a bogus absolute path
bogus path
fr
How would I create a HashMap<>() that returns something, based on if .get() is invoked with 1 item that is present in the keys Set()?
what are you trying to do
Im creating a event system for my packet system, and i allow that every listener can subscribe to as many topics as he'd like (topic = different packet channel) and when a topic is called that has been subscribed to, then the listener should be called.
So Im storing every listener in hashmap, that has a set of topics as key.
so why can't you just run something like
private val EMPTY_SET = Set.of()
private val map = HashMap<Class<TopicThingy>, Set<Things>>
fun callOrWhatever(topic: Class<? extends TopicThingy) {
map.getOrDefault(topic, EMPTY_SET).forEach { value ->
value.execute()
}
}
// ORRR
fun getCallers(topic: Class<? extends TopicThingy>) : Set<Things> {
return map.getOrDefault(topic, EMPTY_SET);
}
ofc this is simplified and excludes any objects you need to insert, but what stops you from doing something like above
thank you for helping, but i think i found a different solution, i will just register the listener for each topic, instead of trying to create a set of topics

its probably the easiest way
listener for each topic ?
