#help-development
1 messages · Page 1218 of 1
Right rotation is applied first, then scale, then left rotation, then translation
will post testing results tomorrow
The "right"ness is to do with the matrix iirc
I have no promises that that works btw lol
And you asked what more physics I would need smh
i have a weird bug, so uh basically i have a list of things which does other things in order for example {"broadcast t", "broadcast tt", "wait 20", "broadcast waited"}, the problem is having "wait x" breaks the whole code and makes it so even the first 2 which is broadcast t and broadcast tt not work (i never even come near the wait x until broadcast t and broadcast tt finish working)
if that's not weird enough if i run the debugger and breakpoint the line that executes the code then click "Resume code", it just magically works
not to mention that if i try to print stuff before execution code it prints it but it refuses to execute
how do they get handled internally, then what provides wait 20. and if you have a breakpoint on the wait code its going to pause untill you resume?
your code first gets parsed as an queue of parsedelement which is "name" and "parameters" then your code get stored in a set with the event that triggers it
when the event occurs, it does a while loop checking if the code is empty or not and calls script.poll then does other stuff to know what it's supposed to do
1 sec
@Override
public void execute(Queue<ScriptStep> body, ExecutionContext context) {
context.setNextAction(TurboAPI.getScriptParserStatic().getNextAction(body));
while (context.getNextAction() != null && !body.isEmpty()) {
ScriptStep step = body.poll();
context.setNextAction(TurboAPI.getScriptParserStatic().getNextAction(body));
if (step instanceof ExecutableSection executableSection) {
context.setCurrentSection(executableSection);
if (executableSection.getSection().getSyntaxElement() instanceof TurboSection turboSection) {
turboSection.executeSection(executableSection.getSection(), context, executableSection);
}
continue;
}
ParsedElement action = (ParsedElement) step;
if (!(action.getSyntaxElement() instanceof TurboAction turboAction)) {
return;
}
action.executeArguments(context);
turboAction.execute(action, context);
context.setNextAction(turboAction.next(action, context));
}
}```
then what provides wait 20. and if you have a breakpoint on the wait code its going to pause untill you resume
a file provides the list, if i put a breakpoint on the code that calls the execute method then resume the code it works like there isn't a bug
that code means absolutely nothing without any info about it, how does the wait code actually work to wait
public class ActWait extends TurboAction {
public ActWait() {
}
public void execute(ParsedElement parsedElement, ExecutionContext executionContext) {
}
public ParsedElement next(ParsedElement parsedElement, ExecutionContext context) {
long ticks = (long)parsedElement.getNumberArgument(1, 0).intValue();
if (ticks < 1L) {
return super.next(parsedElement, context);
} else {
Queue<ScriptStep> body = context.getCurrentSection().getBody();
Bukkit.getScheduler().scheduleSyncDelayedTask(TurboLanguage.getPlugin(), () -> {
body.poll();
TurboAPI.getScriptEvaluatorStatic().execute(body, context);
}, ticks);
return null;
}
}
public boolean init(ParsedElement parsedElement) {
return (parsedElement.compareName("wait") || parsedElement.compareName("sleep")) && parsedElement.hasArg(1);
}
}
without asking for almost every single class, best i can say is just start adding debug statements and figure out whats running and when
use runTaskLater not scheduleSyncDelayTask too
whats the difference btw
Is it possible to spawn either a falling block or a block display and attach a bunch of leads to it that are all tied to individual chickens that float down above it?
u cant attach a lead to them
u can with them
can I attach to a marker armor stand>
or does it have to have hitbox
& whats the code to attach leads
ok thanks I will try that
nvm according to this i dont think armor stands can also be attached to a lead
hmmm
can you attach multiple leads to a single entity?
besides a player bc I dont want to deal with that
no
but u can do the opposite
u can attach multiple entities to one lead
it doesnt appear you can lead armor stands unfortunately
yeah
what r u trying to do
spawn a supply drop ( either a falling block chest or a block display chest) and lead it to a bunch of chickens that float down with it
is the only way to spawn a bunch of invisible living entities and lead the chickens to that?
hold on
cuz that would suck
r u trying to make it seem like it's attached to it or do u want it to actually fall
wdym?
like r u attaching it to chickens because u want the display block to move with the chickens or for decoration
the supply drop will fall down from sky if thats what you are asking. yes the chickens will fall down to decorate as a parachute
just put another ai-less invisible chicken in the middle of the supply drop and move it with the supply drop and attach the lead to that chicken
the question is there any entity I can summon that will let me attach multiple leads to it so I only need one
can you somehow summon an invisible no-ai humanentity and do it that way
hmm it seems spawning a player the normal way leads to an illegalargumentexception
hello could anyone help me with nantibot plugin ?
?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!
so i downloded nantibot but its not showing the capatcha
so to download it you need to complete a captcha?
@ebon pier @robust helm.
Little confused here, are we talking about nAntiBot or are you mispelling, and referring to a generic AntiBot plugin?
Why I'm confused is, nAntiBot is a plugin that is not on SpigotMC, as it's generally considered a premium plugin
And also, this isn't a development question so I dont know why you're here.
its part of a plugin called OpenNLogin which installs this plugin from your minecraft server
Okay. so see this? They have a support server.
Does anyone know how to link nms 1.21.4 (or any version) for maven? I mean I found this link but I can't find the actual maven stuff. https://www.spigotmc.org/wiki/spigot-nms-and-minecraft-versions-1-21/
Its Dead
Not my problem, and not related to this channel, move along so this guy can ask his question which actually belongs here
i dont get how i should run redis in a distributed server network. it says i shouldnt expose it to the internet but thatd mean all my servers using the instance would have to be in the same network?
they should definetly make this channel a thread 😇
well it says you should use threads if channel is in use
but yea ig dc forum would be simpler
and then wait for hours for an answer (i never tried the spigotmc forum)
yeah it was kinda like that
yeah tbh I've had the most success asking on the minehut disc server
lol i used to spent hours passing my plugin instance to a bukkit schedula cuz i didnt know how to use java and didnt want to use the forum 🥲
and then someone on the forum told me to use static 🤠
?paste
welp
Learn Java first
any other pastebins?
wym?
?paste is down
Good point.
Just google it?
pastes.dev is what a lot of giganerd here use
and I've never seen it go down
https://pastes.dev/XzICzRK4r2 would this code end up being laggy on large servers?
Anyways, why? You're running that code, 20 times every SECOND? For every player?
why are you making the function call Objects.requireNonNull() everytime?
intellij freaks out if i dont
store it is a AttributeInstance
._.
new BukkitRunnable() {
public void run() {
for (Player player : Bukkit.getOnlinePlayers()) {
// Store the return of the function calls HERE so you arent calling it each time
AttributeInstance attackDamage = player.getAttribute(Attribute.GENERIC_ATTACK_DAMAGE);
AttributeInstance maxHealth = player.getAttribute(Attribute.GENERIC_MAX_HEALTH);
// Make this if block sexier.
if (attackDamage == null || maxHealth == null) continue;
boolean shouldHaveBoosts = player.getInventory().contains(droughtItem) && isAridBiome(player);
boolean hasAttackBoost = attackDamage.getModifiers().contains(damageBoostModifier);
boolean hasHealthBoost = maxHealth.getModifiers().contains(healthBoostModifier);
// then the rest of your logic doesnt look like a clusterfuck you can do this.
if (shouldHaveBoosts && !hasAttackBoost) {
attackDamage.addModifier(damageBoostModifier);
} else if (!shouldHaveBoosts && hasAttackBoost) {
attackDamage.removeModifier(damageBoostModifier);
}
// Apply or remove health boost if needed
if (shouldHaveBoosts && !hasHealthBoost) {
maxHealth.addModifier(healthBoostModifier);
} else if (!shouldHaveBoosts && hasHealthBoost) {
maxHealth.removeModifier(healthBoostModifier);
}
}
}
}.runTaskTimer(this.plugin, 0L, 40L);
that is pretty sexy
And when I hear isAridBiome my brain jumps to, chunk loading or world checks, which can also be just as expensive as the dozens of inventory checks you're doing.
theres no other easier way tho
uh oh
You could make a hashmap, like playerBoostStates and begin by checking if any states have changed, so you can skip over some results.
that would use an event though
eh that would be more hassle than what its worth
What I meant was, instead of checking everyone's inventories, just have an event for inventory change, and if someone's inventory changes, update the hashmap. then use the hasmap in this code, and if their current inventory is as prior, skip.
ywkim?
yeah
hey guys does any one how to use FoodComponent, EquippableComponent, UseCooldownComponent ? Thanks 😛
?javadocs
?javadoc
https://hub.spigotmc.org/javadocs/spigot/org/bukkit/inventory/meta/components/FoodComponent.html https://hub.spigotmc.org/javadocs/spigot/org/bukkit/inventory/meta/components/EquippableComponent.html https://hub.spigotmc.org/javadocs/spigot/org/bukkit/inventory/meta/components/UseCooldownComponent.html
holy embed spam
much better
i know it but its a interface and a i need to create a new UseCooldownComponent but just implementing it at the class dosnt work because cant cast as CraftUseCooldownComponent
i think more context is needed to help you
private NamespacedKey group;
private float seconds;
public GenericCooldown(NamespacedKey group, float seconds) {
this.group = group;
this.seconds = seconds;
}
@Override
public Map<String, Object> serialize() {
return Map.of("seconds", seconds, "cooldown_group", group);
}
@Override
public float getCooldownSeconds() {
return seconds;
}
@Override
public void setCooldownSeconds(float cooldown) {
seconds = cooldown;
}
@Override
public NamespacedKey getCooldownGroup() {
return group;
}
@Override
public void setCooldownGroup(NamespacedKey group) {
this.group = group;
}
i dont understand what you want to make happen though
@EventHandler
private void customPotions(InventoryClickEvent ev) {
if(ev.getClickedInventory()==null) return;
ItemStack item = ev.getClickedInventory().getItem(ev.getSlot());
if(item==null || item.getType().equals(Material.AIR)) return;
if(!(item.getItemMeta() instanceof PotionMeta potion)) return;
if(potion.hasMaxStackSize()) return;
potion.setMaxStackSize(16);
NamespacedKey spk = new NamespacedKey(SpecificServerPlugin.getPlugin(), "potion");
GenericCooldown cooldown = new GenericCooldown(spk, 0);
potion.setUseCooldown(cooldown);
item.setItemMeta(potion);
}
change the cooldown for a specific potion, than i will use FoodComponet to change the consume_seconds but probaly i will be stucked in the same point
sorry wrong error
ah
[04:09:20 ERROR]: Could not pass event InventoryClickEvent to SpecificServer v1.0
java.lang.ClassCastException: class me.RaulH22.SpecificServer.cooldowns.GenericCooldown cannot be cast to class org.bukkit.craftbukkit.inventory.components.CraftUseCooldownComponent (me.RaulH22.SpecificServer.cooldowns.GenericCooldown is in unnamed module of loader 'SpecificServer-1738393755688.jar' @15dd0197; org.bukkit.craftbukkit.inventory.components.CraftUseCooldownComponent is in unnamed module of loader java.net.URLClassLoader @4e515669)
do not implement item components
i believe the API way to do it is to optain a component using the get method, modifying it, then setting it back
similar to item meta
forget its, was simpliest than i was thinking hahahah
thanks btw
Working...
@EventHandler
private void customPotions(InventoryClickEvent ev) {
if(ev.getClickedInventory()==null) return;
ItemStack item = ev.getClickedInventory().getItem(ev.getSlot());
if(item==null || item.getType().equals(Material.AIR)) return;
if(!(item.getItemMeta() instanceof PotionMeta potion)) return;
if(potion.hasMaxStackSize()) return;
potion.setMaxStackSize(16);
UseCooldownComponent cooldown = potion.getUseCooldown();
cooldown.setCooldownSeconds(500);
potion.setUseCooldown(cooldown);
item.setItemMeta(potion);
}
your little scheme using continue; threw me off for 30 minutes
mmy amateur java brain doesnt know how that works
you dont know basic english?
im pretty sure the word "continue" is self explanatory
oh
it wanted to continue but it never really did
idk why
because when i switched it to just a regular if block it worked 😭
damn i guess i wrote wrong
but also probabyl becuase i couldnt properly read ur code
i have a tendency to write code so bad that only i can understand it
Reference my middle school scratch projects
jesus dude
In protocolLib, how does one send a fake laying on ground animation?
The "BED" packet is deprecated so i genuinly have no idea at this point.
is there some way to cancel server start if plugin failed to load or should i js try catch the whole onenable?
Not really, a plugin shouldn't stop the whole server
alr thx
Looking around wiki.vg there's a packet called "Player Command" which seems to also handle that, I can't say for sure if that's the one, I think youd want to send a pose change packet
lying on the ground does not exist, it is exclusive to beds
there is swimming tho
which is just a pose
how does murder mistery do it?
i cant use nms, because fucking paper
and yes
?whereami
then use a corpse plugin
a plugin that creates a player corpse
why would i do that
can players even spectate when theyre lying on the ground?
should'nt protocollib have that already
???
PL will let you set teh pose but it will constantly change
wdym
it will keep getting reset to the player standing anytime the player meta gets re-sent
bro this is some bullshit smh
any other way to do it then?
even if you constantly send a fake meta packet it will still flicker with the player standing
a player corpse plugin
the player corpse plugin has a way to do it too
exactly
cant u just use npcs?
i can, but i also dont know how would that be done
me neither
bro😭
that requires nms
WHAT
YOU CANT SPAWN
NPCS
THROUGH PROTOCOLLIB
??
well you can, but its not simple
I am finna kill myself in this shit, hell no
just copy source code from corpse plugin :>
bro why did paper have to do me dirty like that, u cant just import it, and im banned on there if i want to ask questions😭😭
start coding against Spigot then
im banned there too lol
this IS spigot
WE BE FORMING A CLUB
xd
i acknowledge this, but there' no other places i can go
alt account
nah, i think it need to be verified, no?
in before teh ban for evasion
dont think so
wdym?
Spigot only allows you one account
but paper?
I don;t use Paper so no clue
and they cant rlly detect it
I've not played it in like fucking 6 or 7 years, how would I know
and this server is spigot so you are expected to be working with spigot here.
I don't understand how people get banned from discord servers this easily
look at my pronouns think
how on earth
By being incredibly disrespectful
Some servers ban at teh drop of a hat
You could've had any piece of information there and you chose that 💀
no they considered using pronouns field for anything other than pronouns offensive
bro😭
I'm not even a religious troll, I didnt even type, I opened a verification ticket and got insta banned
Weird, my pronouns field would fall under this category, I guess mine isn't offensive
so you WERE trolling me
What? how?
What are you talking about?
How was i trolling you?
moreover, i'd be mocking conservatives more than anyone, which is strange, they did a friendly fire
well you clearly understand how thats offensive
understand how what's offensive?
me being a religious troll or whatever
my pronouns field
when did i say you were a religious troll????
in dis one
NO. I was talking about ME.
comparing to myself
No?
I got banned from a religious server, before speaking, despite not being a troll (which is what people normally get banned for)
anyways not the channel, and probably not place for this
damn
ok
Y'all this ain't the channel for that
I'm going to guess you are also a memober of some other server they auto ban for.
if one of the actions gets the ExecutableSection object that it's in and does getBody, it returns the contents of persistentBody like none were removed
I assume it's a concurrency thing but that could be bs
?paste please
@sullen marlin just fyi
are you making a scripting lang
sortof
I don‘t really understand your issue tho
Yea?
if that turbo action gets the currently being ran executablesection then does getBody, it's supposed to getu the Queue<ScriptStep> of steps until that turbo action, but it just gets the full Queue<ScriptStep>
as if the poll part never existed
if that makes sense
omg
nvm i'm dumb, the code being executed is a clone of the executablesection and the context contains the original executablesection
it doesn't xd
~60 blocks away
the transformations seem correct
it's just that it's somehow in the incorrect position
Probably means you have some translation going on
right rotation is rotation after scale iirc
yeah, isn't it?
Does anayone know a good IDE as I didn't realise that Jetbrains idea is only a subscription or should I just pay for it
Some extra features
Most of which aren‘t neccessarily needed for plugin dev
So just stick to intellij
Oh wow I didn't know that thank you! :D
I waiting someone to say vscode
netbeans
please no
its the official ide of spigot 🙂
a what now
wouldn‘t call it official
md_5 uses it for spigot
I know
95% of other people use intellij tho
especially plugin devs
and for a good reason
and what reason is that?
because netbeans does everything intellij does minus maybe a feature or two lol
it‘s simply the best IDE for java out there
pretty opiniated more then anything
if its good enough for the owner of spigot to make spigot with it all these years, then obviously it must not be horrible
right I never said it was horrible
but I doubt everyone even uses all the features intellij even provides as well, therefore they would have no issues using netbeans and other then locations of some menu/options they probably wouldn't notice a difference
I use a pretty good amount of IJ‘s features
maybe you do, wouldn't say that is the majority
just like I make use of most of what netbeans offers
yet it barely has kotlin support
anyways as I said, most of it is preference base though in which one should choose. However netbeans in comparison to IJ isn't really lacking. There might be one or two features IJ has that maybe netbeans doesn't? not entirely sure
it has kotlin support
however, Jetbrains are the ones that created kotlin to begin with, therefore it makes sense their IDE natively supports it
its like saying IJ barely supports C or CPP in comparison to Visual Studio
and it's horrible
I mean, I work on codebases using both kotlin and java a lot
ok but everyone is not using kotlin
as I said, there may be a feature or two that IJ might be better for if you really need it. Aside from that though both are optimal and efficient. Both can refactor code, format and all the other frills
both can compile with gradle or maven which ever is your fancy or both if you want them both
both can decompile and debug and allow remote debugging
is netbeans foss?
ooh maybe ill try it
Oracle gave it to Apache some few years ago
Netbeans is kinda ass ngl
Does spigot use netty's setTcpQuickAck?
For a PerkRegistry that tracks selected perks of all players i have an implementation using mongodb, which requires some init stuff, now should i
a) add an init() method to the PerkRegistry interface
b) just make an init method in the implementation (could get kinda annoying cuz i first need to make a variable of the implementation type, then init it, then assign it to the actual perkRegistry variable)
c) just call init in my constructor
nope
wait no
here
it's the only option for the client channel
and the autoRead=false is only for the server channel when booting up
so still, no
see ServerConnectionListener or ServerConnection class
...it was the block's initial yaw and pitch that ruined it xd
how are you even supposed to account for yaw & pitch?
How do i generate a single biome world using the 1.17.1 logic for generation but with 1.21.3 version?
bumb
Find the 1.17.1 logic, put it in your plugin and then use that on your ChunkGenerator
PerkRegistry name is a bit misleading
as for the question it depends on what the init method does
it creates the mongodb collection
how about PerkTracker?
SelectedPerkTracker
How do i search that?
You're right. The wiki is wrong then
Or at the very least, inversed
chcooo
is there an alternative to block#setBlockData since it lags on large scale
it works if you use the local vector for the transformation
but do you know how to account for the block's yaw & pitch?
That won't be easy but you dig through the nms code
?nms
...the bukkit yaw is broken
initialRotation works with pitch, but not with yaw
is there an alternative to block#setBlockData since it lags on large scale
no, do less each tick
?workdistro
?blockchanger
w
why cant spigot have stuff like this built in?
Because spigot acts as an abstraction layer for NMS
It doesn't necessarily implement new features by itself
other than maybe virtual inventories
Yea but it won't hurt if they added improved ways to do stuff for example set blocks
it's like asking spigot to impl modelengine
since nms isn't the best for multi version
you're passing the responsibility to them
doesnot bukkit already do that?
That sounds like a you problem
okay xd
A lot of these hacky multi-block pasting techniques end up causing issues
Writing directly to the palette will cause ghost blocks on the client unless you update the client
Method 3 from the spigot post works fine with no issues
but I understand your point
Doesn‘t work on latest directly last time I tried
It gets faster if we rewrite minecraft in rust
I already implemented Method 3 using NMS and it works no issues for 1.21
it does actually kinda
well there is no arguing with that
Here it is btw https://github.com/Devlrxxh/BlockChanger, i was just wondering why stuff like this couldn't already be in spigot but i get the point now that they would need to manage a lot more other stuff
I can do massive amounts of block changes if I just develop an ASIC for it
Massive?
das a lotta reflection
yeah not possible any other way
since i needed a way a massive amount of blocks fast
I mean you could just not use reflection there
what else should i use?
nms directly?
I needed it to be MultiVersion and all in 1 class so i can just copy and paste right away and use it
something easy to implement
thats not how nms works
You know what else is massive?
wdym?
nms changes version to version (but not all)
LOWW TAPERERR FADEEEEE
yeah ik what about it?
you asked for multiversion and all in one class.
yeah?
how’s that possible wut
reflection
You just learnt that word, hush up kid
what?
Its probably better to tell us what you are actually trying to do
i made that lib xd
I’m bullshitting
Good morning,
I created a plugin in 1.21.1 that I'm trying to update, but I come across a problem that I can't solve... In my plugin I make a craft recipe or I use a custom item in it but in game the custum item appears as if it were a vanilla item (paper) whereas in 1.21.1 everything works fine.
goldenCarrotRecipe.setIngredient('P', Material.POTATO);
goldenCarrotRecipe.setIngredient('C', new RecipeChoice.ExactChoice(carton));
Can you help me please?
Thank you, Have a nice day.
Just a way to a lot of blocks fast while not killing performence and I was just asking if there is a way to do it directly using spigot without needing nms
whithout nms, no
Could you provide a full code source or the relevent function on pastes.dev
Maven Publish build.gradle, I need some help.
manually everything works fine but via the quick recipe book no
Hello, I am building a GUI. Is there a way to prevent moving items from the GUI to my inventory and from my inventory to the GUI? I also want to prevent dropping items from the GUI
?gui
use a menu api
thats not good advice
sorry boss
why not ?
cancel the events
i tried
cause it doesnt explain how guis actually work
its like telling someone asking how to write emails to use chatgpt
sure it works
but it wont help you understand
?nocode
It’s hard to answer a programming question without code
Oh no! You ran into a problem. But no worries, people are willing to help, but first they need to see your code. This is because otherwise, they would be providing help based on guesses instead of concrete knowledge. Whether it be a compile error, runtime error, or an unexpected output, I'm sure that if you were to provide code, you'd receive a quick solution.
i will try to cancel the events again
show me ur code
You should check this out https://github.com/NoSequel/MenuAPI
didnt i just explain why thats bad advice
he wont learn anything
what?
if you manually making your menu using events thats bad advice
its like telling someone to build a house with only hands
no? how do you think that library was build?
so yeah he should use a menu api and check how it works
Using a GUI API at least doesn't get you that vulcan exploit 
using hands so the next guy doesn't have to
XD
well but then the dude wont learn how to do it?
im 100% sure you use python
javascript ecosystem moment
yes it is? He should learn how a gui works internally
just pointing him to the next best gui api will fix his problem but not teach him the spigot api
and the fundamentals of Guis
can you just chill out god damn
Your the one not being helpful what is he learning internally? his whole issue is cancelling an event
there is nothing wrong with using a menu api
?gui
..
never said there is but if he doesn’t understand how guis work he should learn that first
i just want my code work ig
If he doesnt know how its done, do it atleast once so you understand how its done.
If he knows how it works, then he can use an API
A good rule to know:
Don't use anything you don't understand
thank you lunahd24
this
could you add a print message to print the invetory title
maybe its not the correct one
It’s hard to answer a programming question without code
Oh no! You ran into a problem. But no worries, people are willing to help, but first they need to see your code. This is because otherwise, they would be providing help based on guesses instead of concrete knowledge. Whether it be a compile error, runtime error, or an unexpected output, I'm sure that if you were to provide code, you'd receive a quick solution.
show us ur code brother
i did
?paste
here again
put it in here
Making a little statistic tracking system for my game instances, what would be the best way to store/track them? I was just gonna roll with something like this for the statistic itself: ```kt
public fun interface TrackableStatistic<G : GameInstance<G>, T> {
public fun get(instance: G, player: UUID): T
}
.fFA. is not as valid package path
yh
its works wdym
i can edit it anytime anyways
package names are specified to be all lower case
They are in maven
i use gradle
for group/artifact IDs at least
hey guys, is it still not possible to add custom enchantments to the enchantment table/anvil, even with a custom language pack?
it may work but some IDEs will error
okay so first things first
tracking by name does work
but its not the recommended practice
Enchantments have been data driven for a bit now
i use a kit editor
so items and names will be differenet everytime
Spigot doesn't have API for registering them but you can use datapacks
sure but u can track the inventory itself
every time a gui is opend
cache it
actually I'll just make a thread for this
voss are you talking to me or the other person
other dude xd
Statistic tracker
i wish i was skilled enough to give YOU advice haha
@kindred quest what i recommend u do is everytime a gui opens u add the inventory to a list and then when an event is fired you look for the inventory in the list if its not there its not a custom gui
just to confirm - this means we can register them with NMS and they will display on the hover in the enchantment list on a enchanting table?
I don't really wanna like Map<UUID, Map<StatisticKey, Object>> or something
Okay, I want to do the following, and tell me if it's possible or not:
My inventory cannot have items moved from the GUI.
Items cannot be moved from the GUI to my inventory.
Items in the GUI cannot be dropped.
There are some slots in the GUI that I want to always remain empty.
There are some slots in the GUI where I only want armor to be placed. Is this possible?
make a custom data object ig
@valid burrow
You won't have them appear in the enchanting table by default, no idea how you'd achieve that tbh
thats good idea
yeaj
all of that possible?
yep
sure thing
do item entities retain information about how they've been generated?
ie, block drop, player corpse etc
doubt it
things like chests contain data but for most items, no
ye but that wont work retroactively
PDC
see above
if you store the data
but stacked items breaks it
I meant via hashmap and yml file
if you wanted to do it that way you could easily put a custom model data and be done
wait are you saying that itemstacks retain coherence between ticks?
how do I get the mojang yaw from bukkit's yaw?
what
?mappings
Compare different mappings with this website: https://mappings.dev/
ya looking for this?
bukkit yaw is broken
whats wrong with it?
doesn't align with the client
the client and the server have two different yaws
I guess I should just read player flying and call it a day
guys is it possible to delete a review
like if i sent a review on someones plugin can i change/delete my review
yes
Troubles with library causing me issue to the plugins I add.
How do you do rank prefixes, rank prefixes on nametags, prefixes in tab, and tab sorting. All without scoreboard teams?
Because my sidebar keeps overriding teams.
law of demeter is bs
you end up with many static methods which act as a getters for the sake of avoiding chained getters
is there a way to get a list of all Blocks in the game?
i am trying to select a random block type but Material has stuff like AIR and DEBUG_STICK and VOID_AIR and whatnot
Registry.BLOCK
not all Materials are blocks, that's why Material#isBlock and #isAir exist
and air is a block lol
yeah but is it not the intenral id used by minecraft too
Yes but you shouldn't ever need to use it
it is used, but only for client <-> server communication packets because sending integer is cheaper than sending a namespaced key over the wire
inside NMS its not being used, instead those ids are being wrapped into namespaced string based keys
its actually even hard to even use them raw nowadays 😄
can you pretend (to the server) that more blocks exist than in vanilla, or do plugins load too late for that?
afaik you can't, i asked this about half a year ago on this discord server and someone said sadly no but i might be wrong
iirc you can register blocks, but server and the client will be just confused, you can't just add new blocks gracefully as the block types are still not tied to data driven components completely afaik, but minecraft is trying to make this happen (for example enchantments, mob variants are data driven)
idc about the client tbh
i was just wondering if i could do some internal nonsense waaaay easier using new blocks
why cant i remove blocks in an async task?
because NMS is mostly single threaded
you need to synchronize the threads on scedule to run the removal of blocks at next tick
then what does FAWE do
FAWE does some nimbly NMS hacking to achieve async removal of blocks
Bukkit API removes blocks as NMS servers intends, FAWE does its own way by hacking through NMS code and achieving it
correct me if im wrong
what can i do to make removing a ton of blocks faster?
the server really doesn't care, it is mostly the client that is the issue. But if you don't care about the client, then what purpose would these blocks have?
intermediate data so i dont have to handle that separately
intermediate data?
so...why does it need to be a new block?
when clearing an area of every instance of a specific block, i have to check the entire chunk (16x16xheight) times however many chunks which is a lot of processing to do sync
i mean sure it doesnt crash the server but it definitely lags it
im just throwing ideas at the wall to see whats feasible
look into async
this is false
wym
the processing time is however many actual blocks occupy the chunk, not the entirety of the chunk itself
well i cant remove blocks async
air and bedrock can be excluded
no but you can scan async
chunksnapshot
then rejoin main with the list of blocks to remove
but id have to check every block coordinate in the chunk in order to get a list of all the non-air ones, no?
no
enlighten me
no one knows? Please
I am not sure if the API provides the methods for it as its been a while since I have looked at it, however you can read the region file for the relevant chunk data. Air blocks are denoted at the end of the data. However the other way, (think you might be able to do it on the chunk loading with NMS) is listening for the chunk packet which also contains this
in other words the region file and packets have the info optimized and easily excludes the air blocks 🙂
yes, its a clone that isn't the same reference as the chunk so they are not linked
the downside of snapshot is that whatever happens in the chunk object is not reflected in the snapshot
problem is having to scan all locations when the options I presented gives all the blocks minus air blocks
so instead of scanning all of the blocks, we just check the blocks that actually exist
so its like 1/3 of the chunk you need to scan
and all the blocks presented is not air
if packets already exclude air block data, wouldnt be there a NMS method which can compute that for you?
probably
there must be some kind of serialization method lying there
just use a File object
so parse the data yourself
aren't they just nbt
i am going to do async chunksnapshot then
yeah, its not super hard to parse the nbt data
is it at least codecified now
we already have the format documented etc
idk what that means
do they use codecs
maybe for the compression if there is any
In #getLoadedChunks
does loaded refer to chunks that were loaded ever or only chunks that are loaded for some player actively right now
gets the current loaded chunks
so if i load a huge area then go stand somewhere it will only give me the chunks loaded in my render distance
no
it gives the current loaded chunks in the server at the time you invoke the method
chunks don't instantly unload
when do chunks unload
when the server has seen that nothing is needing it, and then it semi unloads it if it thinks it might be needed later
How do I use scoreboard teams and a scoreboard at the same time?
then fully unloads
My scoreboard is overriding my teams.
what about lazy loaded chunkks
it should count those since it is technically loaded, but that is something to test lol
i wonder if there's a fork of Paper or Spigot which is based on fabric loader
basically vanilla minecraft with bunch of optimization patches from Paper/Spigot and without bukkit api
it would be cool to make private mods for a server using mixins but have better performance than vanilla minecraft server
i just dislike bukkit api overall, so im wondering if there's any way to skip that altogether for a native way of developing serverside mods using fabric's mixins
I believe that is a thing, but paper/spigot patches are usually kinda ass
worst idea ever
why
folia breaks everything imaginable
developing on top of it without the paper api would be meeh
it breaks because its not designed for bukkit api
im looking for a way to skip any api's provided
and use straight up NMS
with mixins to develop what i need on top of NMS + optimization patches
it's designed for the api that it provides
with mixins you will suffer
i've already tried mixins and i think they are fine for private plugins
i like them tbh
sure version compat is ass, but the ability to do what i want and not follow the api is just pefect
just install lithium on your server and do your mixin stuff
is there any benchmarks for paper vs fabric + optimization mods
all i want is fast af NMS + mixins
the removal of bukkit api in favour of native code should result in some minor gains as well since you wouldnt have to create separate objects for bukkit api and overall sync the state of api and the NMS
but that's just premature optimization
most of the stuff leaf added to paper perf wise is now available as a mod called moonrise
paper devs really need to make headless-api versions of their patches
how would i get the current tick time of the server
ie how long (in ticks, or millis i guess works too) the server has been runing
how's that differ from lithium
just need it for simple timers that the scheduler is too overkill for
is there a way to check if a Material is naturally generate-able? as in, it can generate in a chunk naturally
i really want to develop a whole server private core on top of NMS using mixins
at least try to
with the introduction of mojang mappings its easier than ever to patch the server
we dont have to guess method functionality anymore
so why bother with 14 yr old api
im not trashing bukkit api or anything but i feel like its aging not well (there's plenty of info of how NMS works nowadays, also we have our almighty https://wiki.vg/ for packet and world related information)
its a good way to develop plugin across multiple implementations but besides i feel like its kinda meh
sponge is kinda ok'ish api, but its always marked as unstable. sure fabric mixins are not stable in terms of compatibility too, but if you're developing an api, you shouldn't mark your API as unstable for years
nvm
they seem to fixed that we now have recommended builds for 1.21.3 (like a year ago, sponge's recommended build was for minecraft 1.12.2, like wtf, im not changing API for that old version)
.
im not sure what's the solution but if i had to guess you can check NMS BiomeRegistry for the generator block types
what happened?
omg
it got merged with minecraft wiki??
god damn
that's a good thing
how the hell do i make a blockmask in FAWE
this is not the right place to ask, they have a support discord
for non-air mask:java extent.setSourceMask(new ExistingBlockMask(sourceWorld))
I'm trying to figure out how to clone a world (have one template world then make a full copy of it), obviously the only feasible way to do it is copy the files but I'm not sure if there's any data inside the folder which i have to be careful about
here's my code so far https://paste.md-5.net/jagedobepe.coffeescript, it runs in onEnable, it works except the middle of the world (from chunks -14, -14 to 14, 14, within r.0.0.mca and r.-1.-1.mca) ends up empty where there should be blocks
How to include Spigot server as a dependency in Gradle?
server or api?
server
?maven then run Buildtools
I've only noticed this what even is it 😭
what that is is a log prefix prompt
can someone cure me from perfectionism in programming overall. I feel like trying to avoid tech debt for me at first is trapping me so much in terms of trying to think ahead of time
it feels as if im wasting more time in abstractions and not real logic
but at the same time writing shitty code just feels wrong
even if you know you'll refactor it
but i believe writing shitty code first and the refactor it is quicker approach to solve it and to write the code productively
because then you know the context where to apply refactoring
am i the only one here who's in the same trap?
Yep its just you. We are all perfect devs who make no mistakes.
Don’t worry about what other people think about your code. Always write shitty code first so you can see it working and it motivates you
Does anyone know how I can stop saveConfig() and reloadConfig() from deleting code notes in config.yml?
Figured it out
just did saveDefaultConfig(); instead of saveconfig
the problem is that its not that im terrified of other who will see my code
im just putting mental barrier for myself to think about the future
Over time your code will improve
And you'll develop new patterns
Now, you must ask yourself: Will you really touch this code again in the future?
if it aint broke dont fix it 👍
I usually experiment with code style changes when doing commission projects because it gives me room to rack up teck debt I'll never pay off
And keep in mind that even big properly written projects rack up tech debt and often end up reworking things dozens of times
my problem is the prototype ends up becoming the final product then i come back 3 months later like wtf is this shit
once I get to the "proof of concept" stage I just rewrite it all
broke nitro spotted
Shut
Hi! I'm trying to implement Libby into my project, as some transcendent dependencies of my plugin conflicted with a different version of themselves that are in use by the Spigot server. I'm using AlessioDP's Libby 2.0 snapshot, which allows to manage transitive dependencies.
I've ran into an issue. First, when I download a library (A) with all its transitive dependencies (B,C) it will only relocate the main library but not its other dependencies. But, if I try to add the dependencies (B,C) as libraries, the "main" library (A) will fail to use the relocated version of B,C and instead will use the server's version, which causes conflicts as are not compatible versions.
What should I do?
oo pikamug's here
Data doesn't get read from the library when loading it in a different plugin.
bump ^
you might get somewhere looking at multiverse
template worlds are generally zipped and not loaded first
in this manner you can extract/copy it to where you need it then load it
also, if you are going to do async stuff make sure to use NIO file package
otherwise you will have to do it sync
how would running java.io on a async thread force it sync
I didn't say that
is it some file lock nonsense then?
probably, but you can't just use syncronized stuff in async without repercussions sometimes. Spigot creates another thread to run the async tasks
Yes. I am using that version. I’ve even compiled the latest commit, as it is newer than the snapshot on the repo
so, you are dealing with an additional thread, not just asynchronization
I said that just in a way to that denotes async doesn't mean an additional thread but in spigots case it does
You might ask there then, seeing as the issue is still open.
The last activity on that repo was 7 months ago. I don't think I will get answered, but I'll try it anyways though. I was asking here to see if someone has had a similar issue and know how they had solved it
Another option is AlessioDP's discord, there's a libby channel with more recent discussion
can you not just use libraries in plugin.yml?
which dependencies have conflicts with spigot?
Twitch4J, which depends on a version of Jackson, which is also used by Spigot, although Spigot uses an older version which is not compatible by Twitch4J
if you shade and relocate both twitch4j and Jackson it should make use of the relocated dependency
the maven shade plugin changes the imports to reflect that
or should anyhow
I cannot shade them in, as that will increase the jar size up to like 16MB (this btw works, but it's not what I'm looking for). Instead I would like them to be relocated by Libby, as it downloads dependencies at runtime and it's very light so it can be shaded without issues
if it works not sure what the issue is
How do I cancel an armor equip event if it's in the boots slot?
Spigot has no armor equip event
#1335427897888079982 someone please ?
im not reading all that
voss stop turning into neon
sorry :c
?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/
¿
Hi ppl
Hi
I have a question about my plugin
Actually 2
So i had this ban plugin from 1 year ago
You got banned from spigot?
?paste
When i run the command /isplayerbanned "player" and that player isnt banned it doesnt say "Player isnt banned or not existent"
and idk where the problem is
i made thehide nametag stuff with the team but if i put the plugin TABS in the server i can still see my nametag how can i fix that?
should show the code where it inputs data
nott just the code that tries to obtain it
oh
if you look at your two methods you provided you should spot it
specificially what you are inputting and what you are trying to obtain 😉
is it the dot in banned_players?
if its not obvious, you are putting the players UUID in which is correct, but you are trying to obtain the players name which is not what you put in and instead should be checking if the UUID is in there instead
player.getName() != player.getUniqueId()
yes but theproblem is
if the player is banned
it sends me a message saying that player is banned
but if he isnt
it doesnt send me anything
you are checking for a player name when you don't put a player name in the config to begin with
idk what you are talking about. You came here asking why it doesn't work and I told you what the problem is
you are looking for data that you never put in
is there a simple way to transform a mined container's inventory into NBT? i want to make Shulkers for/out of bookshelves
Yeah that's what the BlockStateMeta is for
Listen to the BlockDropItemEvent grab the state of the bookshelf and put it in to the dropped itemstack
is there any runtime penalty for referencing static methods like this?
return GenericFX.button("Registration", FormButtonFX::primary)
does does the function gets inlined
public static Button button(final Button button, final Consumer<? super Button> consumer) {
consumer.accept(button);
return button;
}
this is the function which accepts Consumer<>
it should in theory create runtime consumer object right
i wonder if that's true or if that's something that compiler optimizes
but if it will get optimized, how would it represent consumer overall as a heap object if i reference it in code
JVM optimization internals is quite complex
It wouldn't suprise me if that got inlined after being run enough
That doesn't seem to be something that runs very often so it might not be since it's not worth the time to do so
im using it kinda as a macro across various classes since java doesnt support macros
eh fuck it im gonna use it still
it saves me like 40 lines of code
The performance cost is negligable
If you want macros and stuff you can look in to the Manifold project
but I'd say that's quite overkill
public static Button login() {
final Button button = new Button("Prisijungimas");
FormButtonFX.secondary(button);
return button;
}
get converted into:
public static Button login() {
return GenericFX.button("Prisijungimas", FormButtonFX::secondary)
}
shorter and i have like 8 static methods like this
You can make that secondary method private static
if you don't plan on accessing it anywhere else
its being used across various classes
i have multiple form windows
that's why its public
this is a class of one of the form's elements (login form)
basically im doing react on JavaFX
React 💀
baaaack with this
I'm trying to query the first value in a result set. why do i get this: ResultSet is TYPE_FORWARD_ONLY
as error?
try(PreparedStatement statement = connection.prepareStatement(queryString)) {
insertKeys(statement);
ResultSet result = statement.executeQuery();
if(!result.first()) return null;
return result.getString(1);}
shouldn't the cursor be at, i dont know, the start of the result set lol
fixed it, though i have no idea why saying select data instead of select * helps
........ and? the table here is PK string | string
so getString(1) should be where the cursor is
im clearly missing something but i cant tell what
Can't use first on forward only
i - sure
but why does changing * to the column name fix this?
wouldnt it still be the first value
and the same kind of result set?
Might be some vendor specific fun
Explicitly tell it that you do not want a forward only rs or just use the next method which will work
ah right, the good ole where is index at
mysql starts at 0 as you just learned
OH COME ON
augh i cant even check if the result set EXISTS
wait
it says this errs on forward only, but how am i supposed to check if it conntains anything then
Call next
ah double duty methods. fun...
i hate everything about this
insertKeys(statement);
ResultSet result = statement.executeQuery();
if(!result.next()) return null;
return result.getString(2);
but it works. hooray?
by the way, this gets closed by the statement being in try(Statement...) right?
It's a cursor, it starts at the position before the first element (if there is one)
wait. the result set is ROWS
calling next will move it forward
yes
welp that explains it
Well, yeah, it's a collection of results lol
a set, even
A set :0
Yes. But your Connection is the one that should be closing, which will close the Statement too
well i did write the query and access such that the set size should always be 0 / 1 depending if it exists
wait, is it recommended to open and close the connection for every time you try to access something?
Yes
Or use a connection pool, but those also require you to "close" the connection
the connection in the twr then?
Never seen try-with-resources shortened to twr lol, but yes, that would go in the twr. You could put both in there if you wanted
someone else in here did it when talking to me + i do it now coz lazy
probably either frosthalf or olivio
wym both?
isnt that limited to one java statement?
I'm gonna blow your mind
try (Connection connection = getConnection();
Statement statement = connection.createStatement()) {
} catch (blah) {
}```
huh
It's an SQLite file
Oh then definitely close your connection each time
im using .db but i guess thats the same thing
Yeah that's SQLite
this about data corruption or file locks?
File locks. If there's a connection open, nothing else can read/write it
You can keep the connection open for the lifetime of your program that's fine
Just nothing can write to it in the mean time
or read for that matter
You can, but I would try to get into the habit that you shouldn't
oh i see why this didn't cause problems for me
I'm passing around the same connection as reference
and since access to this database is supposed to go via the interface i made it SHOULD lock too lol
im really unsure if i should move it into the try with resource now
Yeah you won't run into issues there, and you probably wouldn't ever run into issues, even in MySQL or another flavour. It's just not really great practice to keep open a connection stream that you're not actively using because it's consuming resources. Databases only allow a limited amount of connections, so if you're constantly keeping open connections, you're limiting the amount of simultaneous queries you can make
Again, SQLite only has a limit of one connection so simultaneous queries aren't a problem, but other databases do
As your program gets larger and larger, simultaneous queries are pretty much a necessity
Otherwise you might query for something that takes longer than expected and your other query fails
tbh im now trying to figure out how to use synchronized to prevent async threads crashing into each other, but is that even necessary?
For other databases you'd definitely want to close your connections. They can timeout themselves if you don't after a while causing issues
Probably not here tbf
wait
lemme check somehting rq
right i make the databases based on the plugin trying to store something lol
A class' thread safety only becomes a problem when you're actively using a class between multiple threads :p
so unless you pass another plugin instance the 'one connection per file' wont cause issues in this case
what's the resource consumption for that one open connection tho
Not much
I mean Olivio's mostly right here ^ It's probably a non-issue
The resource consumption I was referring to wasn't RAM or CPU cycles or anything, but the "bandwidth" of the database, for lack of a better word
ah. i'll just add the capability to manually tell it 'close the connection you have' so that if the accessing plugin wants threads they can deal with the synchronization demanded by one connection only + async themselves lol
how fast/slow is it to create that connection btw?
It's not normally the bottleneck in a program