#help-development
1 messages · Page 1313 of 1
where are you seeing htat
What the fuck
Why are they pricing by time lol
ah
look at that
$120 output for gpt-5-pro
fucking hilarious
50 cents for the large sized pro model
how long are the clips?
like at least 5 seconds right
i think they can go pretty far contiguously, i'd guess the limit is maybe 30 seconds but i have no idea, i've never used it, and the sora 2 release blog post is down
oh looks like it's only 10 seconds
i guess if you want to make a movie you have to switch scenes every 10 seconds
and yeah then pray that the people don't randomly switch places or the scene doesn't change
and regenerate each 10 second segment 5 times to get one that kind of matches with the others
neat, the agent builder is live on the platform
not that i'll use it probably
the main thing I wonder about is if sora 2 actually folows advanced instructions
which I am guessing no
I wanted to use it for generating highlights from my dnd campaign from session transcripts that have been auto highlighted
but they are incredibly bad at following anything more than a general vibe with 5 words
from what i've fiddled with the image models, they can do some relatively detailed positioning and detail instructions, not so sure about sora though
not when there's more than one actor
characteristics sstart bleeding
tell them character X has a sword, they all end up with swords, or the wrong person has a sword, etc
happens for everything
well to be fair i only tried it by applying different styles of lace and color to variously located pillows on a sofa and it did work for that, but maybe swords and people are different
from experience it just never gets even remotely close to anything specific you might want
haven't tried sora 2 yet but I did try pretty much all of the other ones
i have no clue how video models work, but for image models there are a lot of control tools, like controlnet, regional prompting and segmentation, that definitely can get your swords right
but i don't think chatgpt makes any use of them for image generation
it doesn't
in theory i'm guessing similar systems should work for video but i have no idea how video models work
oh did they not oepn up sora 2 yet
so you get to pay for the api but you don't have a way into sora 2
it's on the api but i don't want to write a client to try it
and it's not available in the "web client" for the api, i.e. the api playground
nothing useful ever is
according to some quora post, chatgpt users should have some free sora 2 generations on launch
maybe i can find my chatgpt credentials from 2 years ago and give it a shot
sora 2 isn't available in europe and also requires an invite code to use on their website
oh well
can't find the request format docs for it in the api docs anyway
or no there it is
seems to work
i've spent 5 dollars on A calico cat playing a piano on stage
it's terrible
do you have a prompt with swords or whatnot that you want me to try with it? or did you get access to it on your own yet
anyone here have ever done a smooth recoil system for guns?
it's like 8 months that in trying to find a packet that doesn't cancel the movements of the player
and runs on 60 fps
not 20
have you managed to successfully try the teleport one with all relative flags set ?
I already tried teleport flags before
yea it does cancel the movements
alright
but i can't move my head
Without getting lag spikes
or whatever
I actually found a way with packetevents but i have two issues, 1) i get stuck in mid air
2) sometimes after server restart i dont receive the packet at all
reading https://minecraft.wiki/w/Java_Edition_protocol/Packets#Synchronize_Player_Position
Due to latency, the server may receive outdated movement packets sent before the client was aware of the teleport. To account for this, the server ignores all movement packets from the client until a Confirm Teleportation packet with an ID matching the one sent in the teleport packet is received. The vanilla client will also send a Set Player Position and Rotation packet after the Confirm Teleportation packet with the position and rotation received from this packet, and horizontal collision and on ground set to false.
Is it possible that this feature is fucking it up for you somehow ?
PacketEvents.getAPI().getPlayerManager().sendPacket({_player}, new WrapperPlayServerPlayerPositionAndLook(0, 0, 0, {_yaw2}, {_pitch2}, 63, 0, false))
mmh
what abou this?
on 1.21.9 I tried this command execute as @a at @s run teleport @s ~ ~ ~ ~ ~0.2
Seems to work perfectly. No weird teleporting or camera warping. Tried on my server with 45ms ping.
Not sure how or if that can help you. But once again, I wish you luck.
Have you tried make a loop?
I ran this in a repeating command block
My server is on 1.21.4
and does this command work ?
i will try
i'm guessing you didn't set the relative flags for x y z as well
aren't like half of the plugins on the site prank or troll plugins
i thought that rule was only for premium plugins, because troll/prank plugins are considered low effort and not worth selling
Yeah I doubt you'll get banned for posting that as a free plugin
Just post it
If it’s premium and doesn’t follow the rules then it will get rejected when reviewed
Granted if this is your first time posting to spigot then it’s not going to be a premium plugin
No
You need 2 free resources to post a premium plugin
you first need to spam the free resources section with 5 troll/prank plugins
And you won’t get banned for trying to upload a plugin that isn’t fit for the premium category
(this is why half of them are troll/prank plugins)
Unless you keep spamming the same thing over and over again
Yes you need to give back to the community for free before being able to use the paid service
I just stops people whose sole purpose is to profit from plugins for a FREE server software
A lot of people will have a stripped down or demo version of their paid plugins for free. Maybe modify your Halloween one to some kind of free version and then you already got 1/3 resources
4-5 days for a premium plugin isn’t much
It's not even much for a free plugin
@worldly ingot probably spent more time than that on veinminer
10 years 
\o/
Dang 10 whole years of coding
Yeah never stopped once
That’s like 90,000 hours
Then you have stuff like world edit, and multiverse, both free, guaranteed more than 5 days
Quick how many lines of code is that per hour
it is a beta version
I mean VeinMiner definitely doesn't have 90,000 lines of code
So it's probably like 0.2 lines/day
Thank you for the response and suggestion. So far, you’ve been the most professional person in replying here. Sorry for the inconvenience, and I will follow your suggestion. Thanks again!
Can’t believe hypixel pays you for that slow of a programming speed
Smh
Caused by: com.google.gson.JsonParseException: Disallowed chat character: '§'
at com.mojang.serialization.DataResult$Error.getOrThrow(DataResult.java:287) ~[datafixerupper-8.0.16.jar:?]
at org.bukkit.craftbukkit.util.CraftChatMessage.fromJSON(CraftChatMessage.java:250) ~[leaf-1.21.8.jar:1.21.8-124-7a09871]
at org.bukkit.craftbukkit.util.CraftChatMessage.bungeeToVanilla(CraftChatMessage.java:364) ~[leaf-1.21.8.jar:1.21.8-124-7a09871]
at net.minecraft.network.protocol.game.ClientboundSystemChatPacket.<init>(ClientboundSystemChatPacket.java:21) ~[leaf-1.21.8.jar:1.21.8-124-7a09871]
at org.bukkit.craftbukkit.entity.CraftPlayer$2.sendMessage(CraftPlayer.java:3453) ~[leaf-1.21.8.jar:1.21.8-124-7a09871]
at org.bukkit.craftbukkit.entity.CraftPlayer$2.sendMessage(CraftPlayer.java:3441) ~[leaf-1.21.8.jar:1.21.8-124-7a09871]
at org.bukkit.craftbukkit.entity.CraftPlayer$2.sendMessage(CraftPlayer.java:3421) ~[leaf-1.21.8.jar:1.21.8-124-7a09871]
If you follow this error and look at the code, you will know that it has been available since 1.21
- Leaf. Third party fork. Could be their doing
- Are you sending the section symbol next to a valid chat colour?
No, it has nothing to do with third parties. I looked at the code of spigot and it also has the same judgment operation.
and what does your code look like?
player.sendMessage("§chello") works perfectly fine
I have tested it before asking, and there is no problem with using &, but there is a problem with §, just like you
please show some code
sender.sendMessage("§etest")
welp, that works for me so leaf server broke something or something in your code is broken
https://github.com/emilyy-dev/BetterJails/blob/d14f20db96eeffd95e2f81439879e5abca52e3b1/betterjails/src/main/java/io/github/emilyydev/betterjails/commands/CommandHandler.java#L348 which the & get translated to § in https://github.com/emilyy-dev/BetterJails/blob/d14f20db96eeffd95e2f81439879e5abca52e3b1/betterjails/src/main/java/io/github/emilyydev/betterjails/util/Util.java#L60
Very strange problem, I tested it before and it was broken, but now it is normal again.
Normally, it should output normally as you said, instead of reporting an error. Then, my paper core test reported an error yesterday, and it is normal again today.
I don’t think CraftChatMessage#bungeeToVanilla even exists on spigot
Maybe I should ask the Leaf developers.
that would be pretty wise
World world = p.getWorld();
List<BoundingBox> boxes = new ArrayList<>();
for (Location eachBlock : locationsList) {
BoundingBox box = new BoundingBox(eachBlock.getX()-1, eachBlock.getY(), eachBlock.getZ()-1,
eachBlock.getX()+1,eachBlock.getY()+3, eachBlock.getZ()+1);
boxes.add(box);
}
for (BoundingBox boxBlock : boxes) {
for (Entity nearbyEntity : world.getNearbyEntities(boxBlock)) {
nearbyEntity.getWorld().strikeLightning(nearbyEntity.getLocation());
}
}
}```
if you cancel the chatevent for a player, are there any ways they can bypass that and still send a message or communicate in chat
This, by the way, is exactly why we always tell people to ask for support in the Discords of the server maintainers. We don't say "Ask Paper" or "Ask <insert fork here>" to be ass holes
I guess I can't tell you what you are or aren't
I'm just emily idk
Verifiable fact
Emily when can we expect an update for jails
@slender elbowI found the problem. When he sent BaseComponent, suggest_command appeared &f. After careful investigation, I found that it was returned by the ComponentSerializer.parse method. After giving the {"text":""} parameter, I got &f instead of an empty text, which led to the illegal symbol.
This is very strange. If there was a problem, it should have appeared earlier, but it only appeared in 1.21. I am confused about this.
changes happen
Are you talking about me?
mainly the suggest command was changed, now it actually needs to be a command
tho idk what exactly you're trying to send
Yes, you are right, that is used to click to automatically write content in the chat bar, but because ComponentSerializer.parse returns &f, it is parsed as § and an error is reported. But what I don't understand is why it is not empty text, but a color.
components to legacy text parsing has always been finicky and sometimes straight up bad
that is definitely some kind of an implementation error
So I used ChatColor.stripColor to process it and it gave me &f&f, which became empty text after removing it.
I don't know if this problem will be fixed later (referring to the version that has stopped maintenance)
Just check if the string is empty?
that'd roughly be isBlank i think
yep
isEmpty is if length is 0
also string interning :Clueless:
string.ameliorate()
No, it's because the output is very strange. Logically, {"text":""} should be output as "", after all, there is no other content, but he finally gave "&f"
The use of stripColor is just because the final result is &f, which causes the check § to report an error when json is sent
Found the reason, it is because of the color added in addFormat in TextComponent#toLegacyText method
Guys which APIs do you prefer for making GUIS
I use the foundation api
I see
Want a GitHub link?
Well I am trying rn IF GUI
Fs
Just wanna try all
And see which one suits me most
Alright
?
I heard the news that he is banned from spigot
Crazy
So I might refrain from using the API
Fair enough
I honestly don’t know that much about him but the API is pretty good
Could be but it seems like a completely new fork for making plugins like paper
It’s kinda weird but effective
I see
depends on the scenario
I usually just run my own
Every lib does things a lil different and most of them are a little too basic for my needs
I see so did you just made your own api from the scratch up
Ah I see
Is there an event for when the console executes a command in bungeecord? ChatEvent doesn't seem to trigger
Anyone have an example of a working block cracking animation cancel? I've looked all over for how to stop block cracking animation but I can't seem to find an updated one or an older one that works.
What version are you on?
I’m not at my pc anymore but I think 1.21.0
Doesn’t that slow down the swinging animation?
It doesn't
So if I wanted to mine blocks slower and make the cracking animation take longer, I just adjust the mining fatigue and hide all portion effects?
Oh I definitely will then, I just hadn’t updated my server at all
Where can I find the docs for the updated servers?
?jd-s
You're probably looking for https://hub.spigotmc.org/javadocs/spigot/org/bukkit/attribute/Attribute.html#BLOCK_BREAK_SPEED and https://hub.spigotmc.org/javadocs/spigot/org/bukkit/attribute/Attribute.html#MINING_EFFICIENCY
declaration: package: org.bukkit.attribute, interface: Attribute
I’ll experiment with it tomorrow, but do you think that is the same as adding efficiency to the pickaxe? I ran into problems before that any pickaxe with efficiency 5+ and haste just insta broke blocks. I’m just trying to have more control over mining effectiveness
If your mining speed is too high you will insta break blocks
you can reduce the block break speed to control that
or mining efficiency
though that might be a bit off due to latency. Maybe tweak the attribute modifier on the pickaxe itself
Feel free to ping me tomorrow if you need help with anything
Is this under an event? I don’t see it on block damage
Nvm I found it, thanks. I’ll let you know what I get tomorrow
Hi
Anyone plz give me item adder plugin
@everyone plz anyone give me item adder plugin
Hmm nah, we pass
That's not how you ask for help
Stop being annoying child
Ok
- head to #help-server
- ask normally
Steve you can give me item adder plugin
No
oh wait that's the paid one, no
But I saw in YouTube some are telling it is free but I open link it not opening only
Tera are some free item adder plugin also
So you can give me @smoky anchor
Bro is out here trying to get cracked plugins on the official Spigot discord
You can’t get paid plugins for free.
You have to buy them yourself
Using someone else’s copy is bannable
?mappings
Compare different mappings with this website: https://mappings.dev/
yo
i have a problem with adding a plugin to my project
i added a plugin called Wanted to project structure > depandencies with compile scope
but when i reload my project with maven(compile included) the jar will disapear in depandencies
Please dont promote piracy
Oh ok sorry.
Idk but I think you need to build it with the ide and not maven or just add the plugin to your local maven dependency and then add it in your pom.xml and compile it using maven
🛠️ Join the ShardBound MMORPG Dev Team!
ShardBound MMORPG is a dark fantasy Minecraft MMORPG, fully custom, with rich lore, unique quests, and one-of-a-kind cosmetics. We’re looking for volunteer developers to help bring this world to life!
Roles Available:
Plugin / Spigot / Paper developers
Datapack creators
Modders (Forge/Fabric)
What you’ll do:
Implement custom mechanics, quests, bosses, and abilities
Create systems for items, events, and special cosmetics
Collaborate with lore writers, builders, and artists to integrate gameplay with story
Requirements:
Basic to advanced experience with Java, Minecraft plugin/modding, or datapacks
Willingness to work in a small volunteer team
Motivation to learn and contribute, even if you’re not an expert yet
What you get:
Portfolio credits and in-game recognition
Creative freedom to help shape a unique MMORPG world
Experience in collaborative Minecraft development
How to apply:
Just send me a DM using this format:
Discord Tag / Username:
Age:
Experience / Skills:
Availability:
Portfolio / Examples (if any):
What you hope to contribute:
“Help us bring ShardBound MMORPG to life — your code could shape the next great fantasy Minecraft world.”
It does but i found a weird bug, i tried to apply this loop to an item. Lets say i hold right click and i move away from A location and then release the right click it teleport me back to A location
?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/
ty
O.O So it breaks on interact...
Do you just dispatch a command for every tick a player is holding right click ?
And use slightly less chatgpt for the post 😆
yes
wait this is really funny
now that i remember, this excact bug happen when i tested teleport flags
well that shouldn't be happening, wait a sec I'll check fixed bugs
'cause I think I recall some TP bugs being fixed
paper teleport flags
Hey eNot sure if this is the correct place for this, if not i will remove it, but I could really use some help with this.
I’m currently using the RivalPickaxe plugin together with JetsPrisonMines, both work perfectly on their own and even together.
Now, I wanted to add custom coin blocks inside my prison mines using ItemsAdder, and I managed to get that part working. However, there’s one issue: RivalPickaxes doesn’t recognize or mine the custom ItemsAdder blocks when they’re spawned by JetsPrisonMines.
If I mine the block with a vanilla pickaxe, everything works as expected, so the problem seems to be on the RivalPickaxes side.
I’ve been in contact with the Rival developer for about a year now. He keeps saying support will be added, but nothing has changed so far. So I’m reaching out here to see if anyone else can help or maybe provide a workaround.
This is pretty important for me since RivalPickaxes integrates with PlayerPoints, which is how I handle my coin system.
Any help or suggestions would be massively appreciated 🙏
so somehow the command doesn't actually update the player position server side until the tping is done
which is really dumb, lemme test on 1.21.10
You could probably commission someone to update or fix RivalPickaxes
Or fork it and fix it yourself
?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/
or check the pinned post on #general
Thanks!
Yes, 1.21.10 did fix that bug
Do you need to do this on 1.21.5 or whatever you were using ?
Well yes
Well in that case - I'm out of ideas
From what I can see theres only a getter for that attribute, not a setter
declaration: package: org.bukkit.attribute, interface: Attributable
Get the attribute instance then either add a modifier or change the base value
declaration: package: org.bukkit.attribute, interface: AttributeInstance
Please don't expect people to do free work
shartbound
Many people, unfortunately, have become only looking for free work because of some people in Spigot.
Hey, is there any way to check if a player has an inventory open currently?
Thanks, but that's an event. I'd need a check that I can do anytime.
there's a method to get the player's current inventory(view)
call it and check if it's the players own inventory; if it isn't, the player has an inventory menu open
if it is, the player may or may not be looking at their own inventory
The method returns the players own inventory if none is open. But the problem is that I am trying to fix a bug, that also occurs in the players own inventory. In any inventory from which you can drop items.
The server doesn't really know when the player has their inventory open
yeah, I figured...
Could you not keep track of who has their inventories opened with this event, then run a check if their UID is contained in list?
I'm scared of that being unreliable
On a larger scale idk but I did something similar in my last plugins
Mhh. I'll try it. Just gotta do lots of testing then. Anyway, thanks for the help
Mind telling us what the exact issue you're trying to solve is
perhaps there's a better way of fixing it
I have a selection item, similar to the wand in WorldEdit. To detect if it has been clicked or not it listens to the PlayerInteractEvent and specifically Action.LEFT_CLICK_AIR and Action.LEFT_CLICK_BLOCK.
Problem is, if you drop an item from your inventory while having the tool selected in your main hand, it triggers for some reason. So my solution was to block the tool from being used while an inventory is open.
rather than that, i'd maybe listen to the item drop event and ignore the interact event if an item was dropped in the same tick
Yeah... that could also work maybe
you can't for certain tell if a player is looking at an inventory or not, since the client simply doesn't tell the server when it opens/closes the player inventory menu
well, i recall there being some hack that involved listening to the "taking inventory" advancement being completed and immediately resetting it, but that isn't ideal
Yeah, I wouldn't do that either
Your solution probably makes a lot more sense
Thanks
Holy Olivo I'm finally editing the values correctly and changing mining speed. Right now I have it set to a static number but it seems to be working as I need it
For a while I was trying to block or edit the animation packets being sent to the player but lets just say that doesnt work
nice
There actually is a trick to do the animation packets which is what I was talking about yesterday
Basically you give mining fatigue to stop the block from breaking on the client. Then from the server you manually send the correct block break animation with a different players id and then handle the block mining entirely server side
ahhh ok
That's how you'd do it in older versions and it's a lot more work since you basically need to rewrite the entire mining system to make that work relatively smoothly
doesn't mining fatigue make the arm item swinging animation much slower
I for the life of me couldnt figure out how to block the packet
Not if you overflow it to a negative value
basically send mining fatigue 255
I have a question
That REALY REALY matters.
How to debug my codes?
99% Commands of my plugins not working with error : an error ...
Helpful
u read stacktraces it produces
and then u look on stackoverflow :LeTroll:
but fr stacktraces are your frienemy
claude, analyse my stacktrace
claude:
Ai, fix
computer, compute
Jarvis, engage the ragebait protocol
Is it safe to delete Jetbrain caches from /home/<me>/Library/Caches?
/home/me :(
~me :)
Heh, me/me
useradd -D me 🤞🏻
are schedulesyncrepeatingtask aka runnables good for efficient updating of stuffs
like updting items and titles in a gui according to different conditions
this feels like an xy problem
?
Can you even modify items in a gui async
check this
this is what i made ( textures will be changed ) , a feature involving changes in title ( custom fonts if yk abt them ) and item lore change
and i did it in sync not async
assuming, your clock is to detect if the player has enough of a particular item every X amount of time? or what would you be using that for
~ is self but you can also do ~someuser
it works like this if you have 4 gold ingots or more in your inventory then the trade will show yellow in color and if not the trade will become red along with item lore update through runnable inside a command executor
no
can i send you dm abt what exactly i am doing
command executor contains all the modifications gui will undegoes along with runnable and the gui open thing
but the gui variable and strings for title are outside of it
eh, nothing guarantees that i’ll know how to solve your problem, and it would take away context if someone else runs into this issue in the future
yeh
actually not an issue rather suggestions like how i can improve my code further
like it works but will runnable cause glitches or memoery leaks for updating the gui
well it will glitch because its hammering the main thread every time its updating
so what could be a possible fix / workaround
if i add a condition to stop the runnable will it be feasible
i think you could keep an async task but like, read-only, checking the items inside of the inventory and just kick an update (sepparated, in sync) only when it needs to
like could you give me a rough template
something like this idk
thanks got it so first it set the title in async and then in the next runnable it updates the title am i right ?
every creation and modification of the inventory should be in sync, this async is just to check changes in the inventory
so you dont have a constant clock in your background updating your main thread when it doesn't need to
org.bukkit.plugin.IllegalPluginAccessException: Unable to find handler list for event org.bukkit.event.player.PlayerEvent. Static getHandlerList method required!
hrm forgot how to not spam code...
its just basic listeners all right out of the api
no wonky stuff
apparently you forgot the handlerlist
i have never done anything that required a handlerlist
its just basic stuff
<code> @EventHandler
void onBlockBreakEvent(BlockBreakEvent event) {
Player player = event.getPlayer();
if (player.getWorld() == plugin.getSpawnWorld()) {
if (player.hasPermission("voidspawm.editspawn"))
return;
else
event.setCancelled(true);
}
}
</code>
maybe im just loading it too soon
Your onEnable has a problem.
send it.
Error means you tried to register a base event class instead of a proper subclass that has a getHandlerList() method. But the event you did was a proper subclass, so you probably have a problem where you're registering it.
@Override
public void onEnable() {
reloadConfig();
String spawnWorldName = getSpawnWorldName();
spawnWorld = getServer().getWorld(spawnWorldName);
if (spawnWorld == null)
new BukkitRunnable() {
@Override
public void run() {
createVoidWorld(spawnWorldName);
cancel();
}
}.runTaskLater(this, 1);
String rtpWorldName = getRTPWorldName();
rtpWorld = getServer().getWorld(rtpWorldName);
if (rtpWorld == null)
new BukkitRunnable() {
@Override
public void run() {
createWorld(rtpWorldName);
cancel();
}
}.runTaskLater(this, 1);
if (!getConfig().contains("max-step")) {
getConfig().set("max-step", 5000);
saveConfig();
}
maxStep = getConfig().getInt("max-step");
File spigotFile = new File(getDataFolder().getParentFile().getParentFile(), "spigot.yml");
YamlConfiguration spigotConfig = YamlConfiguration.loadConfiguration(spigotFile);
spigotUnknownCommand = spigotConfig.getString("messages.unknown-command");
getServer().getPluginManager().registerEvents(new VoidSpawnListener(this), this);
getServer().getPluginManager().registerEvents(new SpawnProtection(this), this);
}
?paste
Looking to paste something? Try a code block or one of the following websites:
- https://pastes.dev/
- https://sourceb.in/
- https://mclo.gs/ (best for server logs)
we would need the voidspawnlistener and spawnprotection classes
other classes man
no need to stress him lol
I'm not? Watch yourself bud.
looks fine to me, can you send us the full stacktrace please?
declaration: package: org.bukkit.event.hanging, class: HangingEvent
getEntity does not return a Player
it returns a Hanging
it could be the PlayerBucketEvent, since that is an abstract event
maybe try to listen to bucketempty and bucketfill instead
oooo
ok yea the bucket thing makes since
and the hanging thing thats a bug on my part but it should just not work not cause an error
exactly, but it will throw an exception most likely, so keep that in mind
thank you I'll try fixing the bucket
also use HangingBreakByEntityEvent
yes I just changed it to that
aight now as a service charge, going to need you to donate to Children in Gaza.
ok sanity restored, thank you so much peoples 🙂
Heh my wife has been donating to some gaza charity every 2 weeks when she gets paid dunno if its children though
Good!
now instead of having those comically tall up/down arrows for scrolling, make it a handlebar with the arrows at the top/bottom only and a rivet in the middle that moves/scales to indicate where your viewport is; like in normal scrollable guis in real life interfaces
looks good apart from that
editing inventories async is iirc "safe" in that the backing structure for them is synchronized somewhere, but there's no way to do atomic operations to, e.g. "check if inventory has x of y and remove it if it does"; another thread can change the contents in between the check and the set (removal)
yeh exactly what i was thinking
so what could be better alternative
i have set the remove and add item to separate items using inventoryclick event
so for my purpose i dont need them to be inside the runnable
i just update the item lore and the title thats it nothing much complex
helleuh, I might be asking for the obvious but I seem to be blind.
I've got a minigame plugin and I am implementing custom rewards. Part of this is that I want to give the server admin creative control over the rewards, so I want the admin to be able to make custom rewards by adding the option to run commands.
I got the configuration part, but how does one run a command? I think this is something pretty obvious but my google searches only mount to "spigot command creation", which is not what I want. I want command execution
Bukkit.getServer().dispatchCommand() iirc
you typically pass it the console command sender which you also get from bukkit/server
Awesome! this is exactly what i was looking for, thanks!
does anyone know a good gui library for making a trading UI
I would suggest IF API or Inventory Interface API but spigot's api should be enough
?gui
Hello, did the bungee-chat 1.8 artifact get removed from the repo?
Is there anything that i could use as a replacement?
Great tutorial
You can manually install it to your local maven repo
hi, does anyone know how to send an entity metadata packet using protocollib for modern versions
?mappings
Compare different mappings with this website: https://mappings.dev/
take a look at the packets format here ^^
are these classes
ProtocolLib is just a reflection based wrapper
ik the packet format as it hasnt really changed since 1.8
If you know what the packet format is then just get/write the data it contains
private void updatePlayerLine(@NotNull Player ply, @NotNull Entity entity) {
PacketContainer packet = ProtocolLibrary.getProtocolManager()
.createPacket(PacketType.Play.Server.ENTITY_METADATA);
StructureModifier<List<WrappedDataValue>> watchableAccessor = packet.getDataValueCollectionModifier();
packet.getIntegers().write(0, entity.getEntityId());
WrappedDataWatcher.Serializer chatSerializer = WrappedDataWatcher.Registry.getChatComponentSerializer(true);
Component component = this.generateLine(ply, entity);
String json = GsonComponentSerializer.gson().serialize(component);
watchableAccessor.write(0, List.of(new WrappedDataValue(2, chatSerializer, Optional.of(WrappedChatComponent.fromJson(json).getHandle()))));
ProtocolLibrary.getProtocolManager().sendServerPacket(ply, packet);
}
this doesnt crash my client but it doesnt update the name either
it has a name, already so i shouldnt have to set the customnamevisible flag
but i also tried that and it still didnt work
Are you capturing outgoing packets as well?
yeah, which works fine
im implementing a leaderboard that players can customize
(f.ex. displaying different time periods)
when the player joins they have the correct leaderboard visible, but it doesnt update after this
@Override
public void onPacketSending(PacketEvent event) {
PacketContainer packet = event.getPacket();
Entity target = packet.getEntityModifier(event.getPlayer().getWorld()).read(0);
Player ply = event.getPlayer();
if(target == null) {
return;
}
LeaderboardHologram holo = this.leaderboardManager.getHologram(target);
if(holo == null) {
return;
}
Component component = holo.generateLine(ply, target);
String json = GsonComponentSerializer.gson().serialize(component);
List<WrappedDataValue> values = packet.getDataValueCollectionModifier().read(0);
values.get(1).setValue(Optional.of(WrappedChatComponent.fromJson(json)));
packet.getDataValueCollectionModifier().write(0, values);
}
``` (this works)
Try removing getHandle from WrappedChatComponent
this causes the client to crash
ill get the error for u 1 sec
io.netty.handler.codec.EncoderException: Failed to encode packet 'clientbound/minecraft:set_entity_data'
at net.minecraft.network.codec.IdDispatchCodec.encode(IdDispatchCodec.java:62)
Caused by: java.lang.ClassCastException: class com.comphenix.protocol.wrappers.WrappedChatComponent cannot be cast to class net.minecraft.network.chat.Component (com.comphenix.protocol.wrappers.WrappedChatComponent is in unnamed module of loader 'ProtocolLib (5) (1).jar'
What version are you on?
I'm making a sort of Twitch integration plugin. Currently I have done the OAth2, you can use the command msg to send a message in Minecraft to your Twitch chat and next I will be adding in events that will run a command when people follow or subscribe and other things. After that it's integrating ranks for followers / subscribers.
You think people will use it / will you use it?
And also if you have any feature ideas let me know...
Someone might 🤷♂️
Anyone know where to find (if it exists) the lastest protocollib version compatable with mc version 1.21.8?
Did you google it
Yeah, I downloaded the latest dev build from here: https://github.com/dmulloy2/ProtocolLib/releases/tag/dev-build, but it wont enable on the server and has no errors in the console or anything. I may be wrong but I think it's the wrong version or something
Ill give that a try then
Read the second line of the Spigot page
I see now, thanks!
Because there's other requirements and also you might not have waited more than 3 seconds
The page is pretty clear
So many people only in it for da monies
I can post premium resources and I didn't even try...
I can post resources and i dont even.
the only time I sold a premium resource was when I paywalled src
and the guy was also a developer
just wanted to see how I handled data saving
Hey guys, any recommended open-source wiki/docs project that has built-in editor?
Trying to create wiki for my plugins and want one of my friend to help me to create the wiki.
Wasted his money. Could of just checked https://www.spigotmc.org/wiki/flat-file-generic-save-load/
It's easy asf, just use a Data class and save/load it
The home of Spigot a high performance, no lag customized Bukkit Minecraft server API, and BungeeCord, the cloud server proxy.
🙄
was doing mysql with locks
to avoid race conditions
and using redis and whatever
Ah fancy data handling
I'm working on a plugin right now and am thinking about making it premium so maybe I shouldn't judge...
Or maybe free i duno
... I just know if I make it free someone will copy it and make a premium version
would anyone know why PlayerSpawnLocationEvent never gets called? im only getting AsyncPlayerPreLoginEvent and PlayerJoinEvent when joining
I have no idea unfortunately
use git?
https://docs.zetaplugins.com/ < like we do
High-quality, open-source Minecraft plugins that are highly customizable and easy to use.
Each page is just markdown and can be editted on GitHub
its better than an integrated editor bbecause version control
Fumadocs, nice, thank you!
lol i forgot the name of the doc implementation so i just said git for the editting part. my bad! glad u got it either way
How big plugins like essentials,vault,luckperms etc.
store datas like hashmaps?
probably a database ?
Essentials uses yaml files last I checked; vault doesn't store anything; luckperms various.
But in memory all some firm of hashmap likely
You could use local databases like h2 or sql lite that luckperms use too as well as yaml or if you don't want to use databases just store everything in persistent data containers of the world or entitys or the player if the situation allows it. If the world doesn't get deleted.
Using the player PDC for anything is almost always a mistake
all my plugin's data is stored in a block, at 0,240,0
What’s wrong with the PDC
hard to manage
not that easy to see all the data
unlike db table or usm
Pfft who needs to see data
I can feel the data in my bones
it's also impossible to clean up, and doesn't really support useful data formats (half of the time you will be encoding shit as base64 strings or json strings)
unless you're on paper you won't be able to access data for offline players at all, and even on paper that's read-only i think
I mean, the primitive types are useful data formats
it's super convenient but also a trap, in the sense that once you use it and need anything it doesn't support well (i.e. anything more complex than primitives), it's very difficult to move away from it
PDC for like
Does sql even support that many other data types
gameplay related data is just ass
it doesn't in most flavors, but it checks every other box
but that is a given considering that the storage is so tightly bound to the lifecycle of an entity
"Who has the most kills", lemme just load all offline players and read their PDC
Well yeah if you need anything like that it isn’t good
"I wanna migrate my data format", lemme just read all offline players
But if you just need to store something persistent on a player it’s nice
Yea
sure, but needs evolve
Something small, something throw away, perfect
that something simple and persistent might be needed somewhere else later, like statistics
or it may become more complicated and need a better representation
in my experience, of the many times i've used the player pdc for anything that isn't very very transient (at which point maybe metadata is better), i've always regretted it and felt i've painted myself into a corner
I throw some per player settings in it for one of my plugins
Yea I have it for settings too
i did too, then i needed them to be network wide
hm I wonder if we could train ai to do image compression, what that would look like
technically there's ai upscaling but I don't know that I've seen someone trying to reduce fize size with ai
pied piper
how can i install fawe as an api for my plugin?
should i just add the dependencies and repository text or install something?
yeah just add it to the deps
Invalid content was found starting with element '{"http://maven.apache.org/POM/4.0.0":dependency}'. One of '{"http://maven.apache.org/POM/4.0.0":parent, "http://maven.apache.org/POM/4.0.0":description, "http://maven.apache.org/POM/4.0.0":url, "http://maven.apache.org/POM/4.0.0":inceptionYear, "http://maven.apache.org/POM/4.0.0":organization, "http://maven.apache.org/POM/4.0.0":licenses, "http://maven.apache.org/POM/4.0.0":developers, "http://maven.apache.org/POM/4.0.0":contributors, "http://maven.apache.org/POM/4.0.0":mailingLists, "http://maven.apache.org/POM/4.0.0":prerequisites, "http://maven.apache.org/POM/4.0.0":modules, "http://maven.apache.org/POM/4.0.0":scm, "http://maven.apache.org/POM/4.0.0":issueManagement, "http://maven.apache.org/POM/4.0.0":ciManagement, "http://maven.apache.org/POM/4.0.0":distributionManagement, "http://maven.apache.org/POM/4.0.0":dependencies, "http://maven.apache.org/POM/4.0.0":pluginRepositories, "http://maven.apache.org/POM/4.0.0":reports, "http://maven.apache.org/POM/4.0.0":reporting, "http://maven.apache.org/POM/4.0.0":profiles}' is expected.
i get these issues
should i just the fawe core or fawe bukkit and core
can you show your config file?
config of the plugin?
worng pom. xml
its been years since I have used maven haha
so what should i do
pastebin
it's too big and i can't send txt files
?paste
Looking to paste something? Try a code block or one of the following websites:
- https://pastes.dev/
- https://sourceb.in/
- https://mclo.gs/ (best for server logs)
the fawe dep is not inside the list of dependencies
When you're done with that
My custom warden insists on despawning after its 60 seconds if I restart the server. I've tried several methods of making it persistent. Does anyone know of any besides these?
- warden.setPersistent(true)
- nms get brain and clear all behavior on spawn
- clear it again in the entity change pose event which fires when the warden burrows
It's fine until the server restarts. Would really like it to survive that.
i copied everything from this link
https://intellectualsites.gitbook.io/fastasyncworldedit/api/api-usage
that kacper send
should i just add separately everything to my normal code
?
well they messed it up
iirc its supposed to be in a dependencies tag
dependencies-> dependency
so i just change the name dependencies to dependency
try
?tryandsee
oh i got it
okay so... about my warden?
nah. I haven't tried manually naming it. that would not be ideal because it's spawned out of a custom spawn egg and I'd have to go rename it every time
well I am fairly it just sets persistent to true when using a nametag, but if it works, then you can look at how it works and replicate that in the plugin
maybe its just a bug
going back to me it doesn't give me any error but i still can't use fawe
ai is practically equivalent to compression
I've got an idea for the warden. brb
the crummy 1.5gb open source llama models are strange hybrid between babel's library and a 1.5gb lossy archive of all text ever written by anyone so far
with a little bit of luck you can extract the bible and several other books out of it, at a compression factor far higher than any conventional algorithm
for images, i'm not too sure; technically the tokenized form of an image is it being compressed, but i think that might be a one-way process for most models
the pom.xml for fawe doesn't give out any issues, but i still can't use any fawe methods
how to fix it
?
What happens when you try to use their api?
that's it but it has to be wrong because normal things like components etc. now not work
Warden no longer despawns ^-^ had to use EntitiesLoadEvent
that's my original code without fawe things
yo i heard mojang changed up AuthLib again but alot of changes this time, anybody know what changed?
?xy
https://pastebin.com/1xV9sWTp
i fixed some things and now there's no errors and it shows that fawe is installed as core and bukkit version in maven dependencies but i still can't import anything from fawe / worldedit
maybe you get more help on their discord https://discord.gg/intellectualsites
okay, ty
ello, mind if i ask. what version did ItemModel released on Spigot?
do you mean ItemDisplay?
or do you mean the setItemModel for an item
iirc item displays got added in 1.19.4 and this version of setItemModel is probably like 1.20.5 or later I cant remember
yup that
I think before it was a string but it got changed to a namespaced key because of how vanilla does it
Yeah, I'm currently making a plugin using that and I do need it to support to all version soo yeah I need to check what version did that API released.
But thank you tho
its pretty recent
Like in 1.21.x?
just check if the class exists before using
yeah maybe , def after 1.20.5
anyone how to add model to a custom item i mean i have a model which work in item adder but i want to add it to a custom item which have power so how do i do it
it was added to the API in 1.21.2, along with Minecraft itself
if you're talking about doing it with a plugin, with the ItemMeta::setItemModel method
you do have to send a resource pack with the model to the client, though
How do i download legacy fawe? https://ci.athion.net/job/FastAsyncWorldEdit-Legacy/
I cant see what versions these are for
you will just have to pick a build and see if it works on your version, there's no compatibility table that I know of
if you're lucky just using the latest build there might work
thx, someone told me all of them are for 1.8-1.12.2
Hey, how can i remove the warning?
go in survival mode and/or deop yourself
is that actually a minecraft thing
yeah
thanks, is there a way that it doesnt shows to operators to?
i don't remember exactly what about an item triggers it, i think a tile entity in the item data
e.g. a spawner with the mob type set
you could probably use some of these plugins that send a fake op level to the client
though ideally, you shouldn't have operators in the server
Hm, ig aslong it doesnt show to regular players its fine
It wont show for regular players, no.
its dedicatingly to /op
regular survival players won't see it, but i'm not sure whether it's being op or being creative or being both that triggers it
Tooltip contexts have both an advanced and creative flag so it might just be both
advanced is i think the f3+h advanced tooltips setting
Even if you have * perm and creative mode its not going to show. you need /op. It will show regardless of survival or creative as long as you have /op
so it is just dependent on the op level huh
that doesnt make sense, why would a warning like that only be available to Ops
that's the main target group for "forceop book" style exploits
you can do it for not-op players as well, but what are you going to make them execute? /me?
yeah but still its kinda pointless imo
this app could harm your pc
Cannot use setOwnerProfile on player's own profile on 1.21.10 (4541-Spigot-6e369ba-aa5381f).
Caused by: java.lang.IllegalArgumentException: The skull profile is missing a name or textures!
at com.google.common.base.Preconditions.checkArgument(Preconditions.java:143) ~[guava-33.3.1-jre.jar:?]
at org.bukkit.craftbukkit.v1_21_R6.profile.CraftPlayerProfile.validateSkullProfile(CraftPlayerProfile.java:53) ~[spigot-1.21.10-R0.1-SNAPSHOT.jar:4541-Spigot-6e369ba-aa5381f]
at org.bukkit.craftbukkit.v1_21_R6.inventory.CraftMetaSkull.setOwnerProfile(CraftMetaSkull.java:204) ~[spigot-1.21.10-R0.1-SNAPSHOT.jar:4541-Spigot-6e369ba-aa5381f]
at se.file14.procosmetics.util.item.ItemBuilderImpl.lambda$setSkullOwner$12(ItemBuilderImpl.java:279) ~[?:?]
at se.file14.procosmetics.util.item.ItemBuilderImpl.modifyItemMeta(ItemBuilderImpl.java:327) ~[?:?]
(Works on Paper, but broken on Spigot atm)
better report it to the JIRA
?jira
that being said, does the setOwningPlayer method work properly?
I don’t think I have an account there. I’ll look into it later then :)
Yes, when creating a new PlayerProfile it works, so I guess it's data not being set correctly in the PlayerProfile of the player instance
i've underestimated KVM/QEMU Windows VM speed. Its more than capable of running simple programs like MS Office or photoshop. You can even use single gpu passthrough to make it run gpu intensive tasks
awesome
prob sth todo w internals being refactored with the new class NameAndId, just a guess- reporting it would be the right option here ^^
you nailed it. is there a way to see for specific versions? I need to map from 1.21.10 to 1.8 packetplayintransaction and clienttickend also ping and pong
it should have a protocol history
oh ye here i think?
nope
https://minecraft.wiki/w/Minecraft_Wiki:Projects/wiki.vg_merge/Protocol_version_numbers the "last known documentation" column has a link to the respective packet documentation
snapshot versions of course don't have one
ye thats the one
Hmmm
they all take to the same page
nope
I was looking into it, seems like since CraftPlayer now returns a CraftPlayerProfile built with NameAndId and not the actual GameProfile, the textures property is never populated
and since CraftPlayerProfile#buildResolveableProfile expects a full GameProfile, it ends up like that
I am not too sure but it probably can be solved by just changing the returned ResolveableProfile.Static to return a partial profile instead of a full one, though I don't know why md made it so it always return a partial profile when the server has resolved the gameprofile anyway
I guess in a near future it'll be made so no profiles are resolved on the server maybe? Idk
ye but there's an invariant check also in setOwningProfile I'd assume
or whatever the method call
yeah, CraftPlayerProfile#validateSkullProfile or something like that
Guys what the actual name in wiki.vg for the PacketPlayInTransaction?
Like I see confirm transaction but the description doesnt seem like its the one
It seems like transaction confirm is the correct one
Based on a excel i found on internet loll
is ther an easy way to get a player's body yaw?
I know there is a non easy way
I've done it
but I was wondering via api
https://docs.google.com/document/d/1fLFvz2t9JK0X2sM0Pd5DIpo6bJF9X8V2bFUeMQpUhFk/edit?usp=sharingdid some mapping!
Minecraft Wiki:Projects/wiki.vg merge/Protocol version numbers – Minecraft Wiki https://minecraft.wiki/w/Minecraft_Wiki:Projects/wiki.vg_merge/Protocol_version_numbers ALL SERVERBOUND -1 means doesnt exist I COLLECTED THIS INFO OF MC 1.8 to 1.21.2.6FROM A SOURCE CODE SEEMS CORRECT TO_SER...
not in spigot, no
if you don't mind using internals it isn't hard tho, just nms.LivingEntity#getBodyYaw
hey guys, just curious, is there any resource to learn about when to use factory, registry, controller, lifecycle, or any of the fancy terms? Its getting kinda annoying putting everything into one manager class :/
It depends on how niche you'd like to be
you're fine to just stick 90% of things in a single class if it means achieving the result you want
Ah I see, but I think having things separated out is always the best approach no? Single responsibility class type shii
Different data structures and patterns are suitable for different things and it's more of a matter of how much you'd like to enforce the standards
at the end of the day you spend 3x the time to achieve the same result
But hey if you'd like to learn then sure
A registry holds data (usually identified by a key)
A factory transforms data in a polymorphic way
the wiki.vg names for older versions (pre-mojmap) mostly match the searge mappings and post-mojmaps it matches well, mojmap for the most part. If you're looking at 1.21.1+ packet documentaion, the resource location field on the table comes in handy
For example, if you have a Reward interface with different implementations, like CommandReward, CoinsEngineReward, ItemReward etc
And you'd like to load it from a shared medium (like a ConfigurationSection)
You could define a "factory interface", have a registry of them
and the factory interface converts the data into that impl of the interface
this is all really cool stuff, really interested to see how I could start implementing it into my projects
I got this idea when looking at your minigame demo sample code, super well structured btw
I wrote that forever ago
public interface RewardType {
Iterable<Reward> create(ConfigurationSection node, String key);
}
public class CommandReward implements Reward {
public static final RewardType TYPE = new CommandRewardType();
private final String command;
private CommandReward(String command) {
this.command = command
}
...
public static class CommandRewardType implements RewardType { // can this be private?
@Override
public Iterable<Reward> create(ConfigurationSection node, String key) {
List<Reward> rewards = new ArrayList<>();
for (Stirng command : node.getStringList("commands")) {
rewards.add(new CommandReward(command));
}
return rewards;
}
}
public final class RewardTypes {
private static final Map<String, RewardType> TYPES = new HashMap<>();
public static RewardType get(String name) {
return TYPES.get(name);
}
public static RewardType register(String key, RewardType type) {
TYPES.put(key, type);
return type;
}
private RewardTypes() {
// Prevent init
}
public static final RewardType COMMAND = register("command", CommandReward.TYPE);
}
@wraith dragon https://refactoring.guru/design-patterns/java this site comes in handy to explain all the different design patterns in java
holy moly, thanks
the support in this server is insane
Something like that
is a registry + factory polymorphic kinda deal
or you can save 15 minutes of your life and just
List<String> commands = config.getStringList("commands");
for (String command : commands) {
Bukkit.dispatchCommand(..., command);
}
it's uglier and less elegant but gets to the point 10x faster
the main drawback being that the imaginary developer that'll totally hook custom rewards into your plugin cant add them anymore
^^ this
but who are we kidding it'll probably be you anyways
but its definitely nice to have more scalability in the future, even if it is a personal project
practice ig
it makes the code fancy
in short, yes
and impresses whoever's reading your github projects
(yes it can be private, for the record)
hurray
also true
I had to check to make sure lol
It's 6:30am I'm watching shows off my laptop aint no way im testing it
jshell makes it very easy tho (also 02:25am here)
I'm gonna stim all over this website
I've been on a teaching trend for java lately
In practice a registry of factories can also be considered to be the "strategy pattern"
I've looked over this code around 5 times already and still can't figure out ~40%, seems I still have a skill issue
We have a common reward interface and discrete factories for creating that given type of reward
We then have a registry of those types
ahhh I understand it now, thankies
@echo basalt would you be down to teach me this design pattern by breaking down a project that I made? I'm not done yet, just asking for future purposes. If you don't mind ofc
lemme rephrase
so im jumbling everything into my manager class rn
and I would like to know how and when to separate the roles into diff classes
ok so now that I'm explaining it, kinda sounds stupid
Practice is the best teacher out there
Turn the class into an interface
the first impl is how you have it done right now
make a second impl and make it better than the first
if you're not happy with the second impl think real hard about why
and make a third impl that fixes that
should I first get it working then do the abstraction or the other way around?
Think of the ideal API and then build towards it
make a mental model of all the different components you have
what creates them, what uses them
Sometimes different concepts are just the same abstraction applied in different ways
Abilities and quests are fundamentally the same base but applied in a different way
something happens -> runs through some filters -> runs an action
That action can be rewarding you with some exp, launching a fireball or changing the state from on -> off
if you put it that way, a lot of things really build on simple conditions and actions
but understanding that "common dna" is the icky part
and you should know all of it to write a good abstraction
that's where practice comes in
practice and intuition
Back on the rewards topic I start by knowing the different kinds of rewards I'll need
and I also know I have to load them from a config somehow
So I make a class for each kind
and I make an interface they all share
kinda like a blueprint
then every class has a different shaped house but same foundation
sorry to interrupt, please continue
when in doubt, make interfaces
write some demo code on how things would work on an ideal scenario
You can even leave it in and revisit later if it feels overengineered
I have some at work myself
that's pretty cool, so you make sure to not stray from the original path
Uh no
The current impl goes like
if type is number
result.add(sum(one, two))
else
result.add(overrideValue(one, two))
it does the same with 3x less work because I haven't reached the scenario where I need the elegant overegineered one
ohh
I think I'm starting to see it now
I guess I should just start on making things work, then finding ways to abstract it and make diff implementations
then just build from there
You should always find a good approach
definitely not going to learn this design overnight thats for sure
finding a great / the best approach is just icing on the cake
but don't settle for mid
how are you supposed to differentiate between good and great?
pride
You feel happy about good code but you feel prideful about finding the bestest solution
There's no pride in premature optimization
Write code with a standard of performance in mind and optimize if it's a problem
🙏 thanks for the advice
I need a dev
if only this channel was called "help-a-homie-out-finding-a-developer-please-i-do-not-have-the-technical-ability-to-check-spigot-forums-if-perhaps-there-is-a-place-to-find-developers" and not "help-development" 😕
for a comission is payed
its not for help
r u a moron?
?
irregardless. is this channel called, or baring a description that has ANYTHING to do with recruiting a developer?
Theres no channels like that idk
In here theres a lot of ppl that do know coding then why ur mad from me to ask that
read my message. see through the sarcasm.
?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/
could u not read this?
I am not reading a message that of someone is being sarcastic with me
U could just typed this and i leaved
.
@vagrant stratus sorry for the ping but how to transfer a my paid resource to another dev as i want him to maintain the plugin from now
create a ticket by reporting your resource and state what it is you want to happen
I have personally taken control of others resources and given them back so its really easy to do 🙂
If i want to make some .yml files for my plugin can i do it with just making the code that makes all the files do i need to make the 1st file (config.yml) in the resource folder? or can i just make all files in code
Yeah you definitely can do it programmatically
alr thx, because i dont know exactly how to do it and everything i have found in spigot has the config.yml file you create
what was that plugin again with the animated structures
the thing with like doors and windmills and shit
There’s a plugin for that?
I only know of the create mod :p
looks kind of jittery in the video, i guess they don't have interpolation set
I have an example for you
this is how you create/load yml files other then config.yml
because for my purposes it didn't need to be dynamic
thx i have this now, idk if you want to see it
https://pastebin.com/NEwQnDN0
nice, you are on the right path it seems
secret package codes
my way I showed is not the only way to do it as someone has noted, but it is one of the easiest 😉
Hawkfalcon originally created ServerTutorial. After some time he became busy in real life and since the majority of the project was my code anyways gave me full rights. I just never bothered to change the package naming
is there a good place to look up if i need help with something like this again? because i dont know where to look or ask
ahh i see
alr thx
🍔
original repo
Both Hawkfalcon and myself used to be bukkit dev staff, that is how I was introduced to his project
how's bukkit doing nowdays?
no images on the readme boo
have no idea, haven't been on those forums in years
I have thought about taking over bukkit though a few times, but I don't really have the time to do that nor a sufficient group for it
as far as I am aware bukkit is still technically up for grabs
hmm
okay it turns out i don't like the way how animated architecture does the animations
what they do is they manually adjust the rotation and translation transforms of the blocks to make them appear to rotate around a point
this means that having any interpolation is going to have artifacts, so they have no choice but to use no interpolation, which makes everything jittery
use transformation matrices and quaternions with a defined pivot
im a bit confused about how the configs work... if i create the config.yml by myself i can add all the values by typing them in, but if i want to do it with coding i need to add all the lines on onEnable
so if i create the config.yml can i still do so if it dosent exist it creates the file and it dosent override every time the server starts and how do i get the values from the config.yml in my command class?
that's roughly what they do, but the problem is that the client interpolates rotation and translation separately
I am assuming you mean from other yml files? Because there is api methods already for config.yml to do all what you are wanting
e.g. if you transform a block to say 5 blocks to the left of its origin, and then change the transformation so that it goes 5 blocks above its origin, what'll happen is that the block gets translated in a straight diagonal line from left to up
while for rotating things, you'd want it to interpolate over an arc maintaining a 5 block distance from origin
it's tiny for small rotations, but causes things to get noticeably squished
you can get a headache from this
no matter, I guess I can explain how it works when loading files. The first important thing is you need to load the yml file and you need to ensure it only loads into a single object and not lose that object otherwise you end up with two different instances of the same file which is normally a bad thing. You are free to look through the project I linked and use code from there as it is under the MIT license which means only have to give credit if this is something public you are making.
there is a trick around this, however, which is to not touch the transforms at all and instead teleport the display itself; this also supports interpolation
this is the class where most of the loading happens
in regards to server tutorial plugin that is
You can’t rotate the display with a teleport
you can
Well you can, but only on the Y axis
the downside is that you're locked to only two dimensions of freedom; the yaw/pitch rotation of entities, no roll
but this is sufficient for most things
especially doors, which rotate horizontally
not sure about windmills though
js make a mod bro
Idk if im explaining it good enough
but i jsut want to have more than 1 config file and i dont really know how im going to use your code for it because idk what i need to make more than 1 config because i use the values from both configs, example from permissions.yml i need that value for a command and i also need a message from config.yml (this is just an example)
you can use the spigot/bukkit apis when it comes to config.yml
you would only need to have a separate class to load/save other yml files
yea but what i mean is dosent it make more sense to load and save all my .yml files from serperate class so its easier to find everything from 1 class?
right, you will need to make it dynamic from what I gave
which is not hard since the methods I use allows for adding in strings
so this link, shows a method in dataloading and is how I always ensure I am using the same object instance
it also takes care of loading the object if it wasn't already
this is called a singleton method but should answer how I was doing it
you don't have to do it this way if you don't want to. Also I am not a fan of just giving someone the answers rather I am more fond of pushing people in the right direction and having them try to make the code themselves
why would the permissions be in a config
I am assuming they are trying to do dynamic permissions?
which ironically if they look through my plugin I have that in there 😛
shouldn't be too hard to find it
alr thx
i think i see it now but its because i meant to make the whole thing in 1 method/function or what its called insted of using 1 method to make 1 config so i could make 12 configs with the same method if understand what i mean
public void loadData() {
File f = new File(plugin.getDataFolder(), "data.yml");
if (!f.exists()) {
try {
f.createNewFile();
} catch (IOException e) {
e.printStackTrace();
}
}
dataFile = f;
data = YamlConfiguration.loadConfiguration(f);
if (plugin.getConfig().contains("tutorials")) {
ConfigurationSection section = plugin.getConfig().getConfigurationSection("tutorials");
data.set("tutorials", section);
saveData();
plugin.getConfig().set("tutorials", null);
plugin.saveConfig();
}
}
so as you can see this is in dataloading class if we wanted to make this dynamic without much change you would do like the following
public void loadData(String fileName) {
File f = new File(plugin.getDataFolder(), fileName);
if (!f.exists()) {
try {
f.createNewFile();
} catch (IOException e) {
e.printStackTrace();
}
}
dataFile = f;
data = YamlConfiguration.loadConfiguration(f);
(This section below is not needed and simply moves data from config.yml to data.yml)
if (plugin.getConfig().contains("tutorials")) {
ConfigurationSection section = plugin.getConfig().getConfigurationSection("tutorials");
data.set("tutorials", section);
saveData();
plugin.getConfig().set("tutorials", null);
plugin.saveConfig();
}
}
so now loadData takes a value of a String which is fileName and it will load any file with that fileName
this is not the only change you will have to do there is some others also you will need a mechanism to ensure you always have the same object because as I stated before it is possible to end up with 2 objects of the same file
this is generally bad because you can be editing the file from one object, and saving data from the other object and then get some weird problems 😛
this is why I went with the singleton method
sry but wdym with objects?
Classes = Objects
yea sry i just havent heard that
you can load a class more then once which equates to 2 objects
and this can be done accidentally and fairly easy
ive never seen you give low effort help and I've been in this server for a good 4-5 years
I have helped people on more then one occasions
yeah it's amazing tbh
it is one of the primary reasons I am here after all
Anyways back to what I was saying, you will notice with my class dataloading that it doesn't have a constructor
and this is also due to the singleton method
so the only way you can load this class and its methods is through the method at the bottom in that class and thus ensures you always have one object and the same object
the downside of this is that it does not really allow for a whole lot of dynamicness to it
but as I said previously I didn't need the class for that purpose
Singletons are handy for manager classes(because they ensure a single instance of an object), thus you could instead make this class a config manager, and then make additional classes coupled to this one and get your dynamic stuff you are wanting all the while you getting the protection the singleton provides 🙂
i’ve never got spigot devs obsession with dependency injection when they never write unit tests anyways
maybe people have started to tbf
Well in regards to debugging it makes it easier and for newer developers its realitively easy for them to follow until they progress onto more advanced stuff
and receive help if they need it
i guess yeah
i would argue that good dependency injection is harder than “good” singletons
a lot of the time u end up with like a massive get chain
which is low-key gross and the indirection can’t help for performance
maybe, but I can say singletons is sometimes a lazy way to do things and a bad habit to rely on them as it does go against the OOP
well I wouldn't say that is the only benefit
the other benefit is it allows others to utilize your methods more easily without resorting to some hacks
but it depends on the purpose of your plugin. My old plugin for example provides an API thus it shouldn't be necessary for someone to depend on the main portion of the plugin
hence, I am not worried about the main portion being easy for someone to use or not 😛
i guess it’s more expansiveness than ease of use ?
if u don’t want people using ur managers in a new way anyways
like instantiating them
it doesn’t really make that much of a difference
but yeah the main reason as far as I am aware why many here harp on DI is mainly for new devs and just makes it easier for both lol
I have helped with some when it comes to static or even some other types of stuff where you can get some confusing results that don't really make sense in how something is happening since its not obvious from the errors
yeah that makes sense
the thing with DI aside from unit testing is that it ensures that the dependencies are available, because they're provided by whoever is responsible for constructing whatever needs them
compare that to e.g. a class initializer in a singleton that just get()'s something from some static accessor elsewhere
if anyone causes that class to be initialized for any reason at an unexpected time, it will explode and possibly permanently fuck up application state
DI gives you more control by making sure that the logic only fires when someone intentionally constructs the object, and also clearly indicates what dependencies must be initialized before that can be done
DI frameworks like guice completely throw this out of the window of course with "lol bruh it comes from a .properties config or some shit don't worry about it"
what about the “lazy” singleton pattern?
you have a dag of dependencies anyways
do you think that manually arranging and piping the dependencies helps on a logical level
lazy implies that it's initialized when it's needed
and you can't control when it's needed
the idea with a lazy singleton pattern is that the dependencies are implicitly loaded, it’s top down instead of bottom up
which doesn’t work if the developer accidentally adds a cycle in the dependency tree
idk if im doing it right but im trying to understand it.. but i just want to hear if i am on the right path
import java.io.IOException;
public class FileManager {
private static FileManager instance;
public final Main plugin;
public FileManager(Main plugin){
this.plugin = plugin;
}
public void createConfigFile(String fileName){
File file = new File(plugin.getDataFolder(), fileName);
if (!file.exists()){
try {
file.createNewFile();
}catch (IOException e){
e.printStackTrace();
}
}
}
public void loadConfigFile(String fileName){
File file = new File(plugin.getDataFolder(), fileName);
if (!file.exists()){
try {
file.createNewFile();
}catch (IOException e){
e.printStackTrace();
}
}
}
public static FileManager getConfigFile(Main plugin){
if (instance == null){
instance = new FileManager(plugin);
}
return instance;
}
}```
```public class Main extends JavaPlugin {
private FileManager fileManager;
@Override
public void onEnable() {
fileManager = FileManager.getConfigFile(this);
fileManager.createConfigFile("config.yml");
}
@Override
public void onDisable() {
}
}```
so you should never have a problem of things not being around when they are needed
unless you need to instantiate things at a specific time
maybe i’m misunderstanding what you mean
You don't need plugin in the getConfigFile method, and would break if any other class tries to use it/make it redundant. Second you are not even using main class instance in that class thus also not needed. Third it is wise that your main class not be named Main but for the time being I suppose it is fine
that does probably work though i've never tried it in practice; i'd assume that it's easy to run into a situation where something up the line can't be initialized on demand
this is roughly what guice and similar do
yeah, i think it might be down to personal taste tbh if u aren’t worried about mocking or reusing components (you know for a fact that there will only ever be one instance that you own)
i also use dependency injection for everything
dont use static
in the way it is being used it is perfectly fine since they are making use of the singleton method
No the static should never be usef
lol
it has to be static for it to be used properly since it doesn't have a constructor
if i remove the main plugin from getConfigFIle i get an error at instance = new FileManager(); expected 1 argument but found 0