#help-development
1 messages · Page 817 of 1
is also easier on the server cause it doesnt need to constantly create new inventories
Best to avoid InventoryHolders unless you can't
why would that be
it's to do with cloning when accessing (I believe), so not performant
any way i can check if an entity is an "animal" is there any such class
https://www.spigotmc.org/threads/why-items-with-lots-of-metadata-actually-cause-lag-an-inventoryholder-psa.607711/ @valid burrow
declaration: package: org.bukkit.entity, interface: Animals
instanceof Animals
yh got it thx
WHAT IS HAPPENING TO MY LLAMAS
THEY ARE LITERALLY TELEPORTING
Llamao
bc you wouldnt want that in your release
Learn about CustomBlockData here:
https://www.spigotmc.org/threads/custom-block-data-persistentdatacontainer-for-blocks.512422/
On default
Fuck you
the article is very useful thank you, the only question is whether we are sacrificing time https://www.spigotmc.org/threads/guide-on-workload-distribution-or-how-to-handle-heavy-splittable-tasks.409003/
Time?
code execution time is minimal in comparison to not overloading a tick
I mean if you distribute the task into ticks then the execution time will be longer as I understand it
The whole point is to prevent lag
This approach will produce a small amount of overhead. But i would rather have 10 ticks with 6ms each (totaling 60ms)
instead of one tick with 50ms
the task taking longer with no lag over it taking less tim but everyone freezes untill its done
using this tactic, AsyncWorldEdit or whatever it’s called became faster?
Asyncworldexception
what about fast async world exception
But I didn’t understand a little: the task without distribution tries to be completed in 1 tick, but with distribution we divide the task into several ticks?
Pretty much
If only CPUs had access to coke...
and after the end of the tick the task just stops or what?
in the distribution
I think its decently explained in the post. During a tick it keeps track of the nano seconds available.
You simply tell the task to only run for 2.5ms each tick for example.
when using commands animals always take over the aid of the mob riding it why isnt this the case when i spawn them through my plugin
am i missing something
If I distribute the task can the speed stay the same but without lags?
What
What speed
wdum what
code execution
What aid
Ai*
Obviously distributing it over ticks will cause it to be somewhat delayed
No. If you run your task at once, then that is the lowest possible execution time.
If you split it over several ticks, then you are doing a small amount of work each tick.
Its like working 10h on one day vs working 2h for 5 days.
i see
Why I Have this problem please ?
[18:24:35 WARN]: [ShinobiLegacy1-16-5] Task #7 for ShinobiLegacy1-16-5 v1.0 generated an exception
java.lang.IllegalArgumentException: Channel must contain : separator (attempted to use shinobilegacy)
at org.bukkit.plugin.messaging.StandardMessenger.validateAndCorrectChannel(StandardMessenger.java:503) ~[forge:?]
at org.bukkit.plugin.messaging.StandardMessenger.isOutgoingChannelRegistered(StandardMessenger.java:428) ~[forge:?]
at org.bukkit.plugin.messaging.StandardMessenger.validatePluginMessage(StandardMessenger.java:543) ~[forge:?]
at org.bukkit.craftbukkit.v1_16_R3.entity.CraftPlayer.sendPluginMessage(CraftPlayer.java:1312) ~[forge:?]
at fr.spectr2155e.shinobilegacy.proxy.PacketListener.sendTextToPlayer(PacketListener.java:200) ~[?:?]
at fr.spectr2155e.shinobilegacy.stats.listeners.JoinStatsEvent$1.run(JoinStatsEvent.java:35) ~[?:?]
at org.bukkit.craftbukkit.v1_16_R3.scheduler.CraftTask.run(CraftTask.java:90) ~[forge:?]
at org.bukkit.craftbukkit.v1_16_R3.scheduler.CraftScheduler.mainThreadHeartbeat(CraftScheduler.java:461) ~[forge:?]
at net.minecraft.server.MinecraftServer.func_71190_q(MinecraftServer.java:1046) ~[?:?]
at net.minecraft.server.dedicated.DedicatedServer.func_71190_q(DedicatedServer.java:345) ~[?:?]
at net.minecraft.server.MinecraftServer.func_71217_p(MinecraftServer.java:998) ~[?:?]
at net.minecraft.server.MinecraftServer.func_240802_v_(MinecraftServer.java:815) ~[?:?]
at net.minecraft.server.MinecraftServer.func_240783_a_(MinecraftServer.java:267) ~[?:?]
at java.lang.Thread.run(Unknown Source) ~[?:1.8.0_202]
?paste
That's cool, but I don't think it'll speed up my locator code, but thanks.
Is it your plugin?
yes
The error says it all
So you decided to run java 8 after all? 🙂
anyone know why?
I mean it has nothing to do with your exception. Just wondered.
Oh ok I just understand my error I just switch on 1.16.5 since I was 1.12.2 so my packet change
I find the solution
When a mob is spawned, it is never ridden by anyone. I dont understand this question.
No?
chatGpt -> It looks like the error you are experiencing is related to the plugin sending a message to Minecraft using an invalid channel. According to the fires report, the channel must support the ":" delimiter and trying to use "sinobilegacy" caused this error.
To resolve the error, you need to check and fix the original channel for sending the added message. Make sure the channel contains the correct ":" delimiter format and meets the requirements for adding posts to your plugin or mod.
If you have more information about thousands of errors or how you tried to send a message, this can help pinpoint the problems and their conditions.
i know that i never said that i am talking about the AI
anyone know how to check if a plugin is enabled in bungee?
"when using commands animals always take over the aid of the mob riding it"
This sounds like bogus to me. Idk what that even means.
translate error?
i correct myself right after
you can easily test thats hypothesis. Mount wolves, then spawn a sheep and see if the mounts go for the sheep
AI = aid*
let me make it very simple
i put zombie on chicken using command
chicken will be hostile
This doesnt make the sentence less confusing
then just read what i just wrote
A bungee plugin or if a plugin on one of the proxied servers is enabled?
The mob on top should always have control over the mount. How do you check if yout jockey is aggressive or not?
i stand in front of it in survival? xd
Show your spawn method
.
?paste ill only put the crucial stuff cause theres like alot of other stuff in there
https://paste.md-5.net/kucogacova.js thats about it
for the spawning related stuff at least
Looks to me like you need to get the PluginManager and then call getPlugin(String) to check if its loaded.
Try a minimal example. And try using a callback for spawning as well.
declaration: package: org.bukkit, interface: RegionAccessor
This one
hi , so when spigot game server arena close i send this to the lobby server :
and i remove it once its requested .. am i doing anything wrong?
also the uuid is diffrent each time server is opned :
Could be anything.
how could i check it then?
What is your concrete problem?
seems to work now even though i didnt really change anything well
thx ig
in addition to that any idea how i can stop messages like these Named entity EntityDolphin['mosasaurus'/22115, l='ServerLevel[world]', x=-147.99, y=68.26, z=456.60] died: mosasaurus was blown up by Creeper from being printed out
theres like a thousand names entites bc of my plugin i dont want contstant death messages by them
when a game server close :
it should update the gui :
updat this so , when a server game arena close , it should remove one from the size ... but it does not do that , so it keep increasing each time a the same server is opned.
that's my problem now
Hi, how can I make itemstack of material stick with customModelData not stackable?
add a random value to its PDC
random namespacekey or random namespacekey value?
ok
would it be possible for me to change the colour of a glow effect ?
from curiosity, does PDC is bukkit fancy wrapper for NBT
or PDC data and NBT data are 2 different things ?
PDC is stored in NBT
nothing was send to lobby server :
this is the LobbySync class :
https://paste.md-5.net/evexagiroh.cs
specifically with this
@outer brook
Did you disable its AI?
Yes, if it has no AI then it wont be ticked
If ound out I can set a velocity on the armorstand if it has gravity and is not marker. If it is marker or has no gravity or both then I can't set a velocity on it
Is there no opposite void for this? setEnabledSlots or something
(i tried setEnabledSlots)
Are you using paper? Since there is no method called "#setDisabledSlots" for ArmorStand, at least I can't see it.
https://hub.spigotmc.org/javadocs/bukkit/org/bukkit/entity/ArmorStand.html
declaration: package: org.bukkit.entity, interface: ArmorStand
quick question why is this the only one that can produce a null pointer exp
It has a varargs parameter. You need to pass all values which are disabled to it.
armorStand.setDisabledSlots(EquipmentSlot.values())
For all slots
Integer can be null. If you unbox it to int and is null, then it will throw an NPE.
ahh thy
i need help,
public void onArmorStandInteract(final PlayerInteractAtEntityEvent event){
final Player p = event.getPlayer();
final ItemStack macchinetta = new ItemStack(Material.PURPUR_BLOCK);
final ItemMeta itemMeta = macchinetta.getItemMeta();
itemMeta.setCustomModelData(16);
macchinetta.setItemMeta(itemMeta);
if (p.hasPermission("eternitystaff") && event.getRightClicked().getType() == EntityType.ARMOR_STAND) {
final ArmorStand armorStand = (ArmorStand)event.getRightClicked();
if (armorStand.getEquipment().getHelmet().getItemMeta().getCustomModelData() == 16) {
getServer().dispatchCommand(getServer().getConsoleSender(), "dm open basics_menu " + p.getName());
}
}
}
}```
i did this, but doesn't work cause of worldguard
Could you be a bit more specific pls?
thanks
What doesnt work. What have you tried to debug it
Is there a way to know when the client is ready to have a map rendered? If I send it too early it doesn't get rendered, so I delay it, but that sometimes also isn't enough. Is there any specific packet (either client or server) I could listen for to know that I can send the map now and have it be rendered?
To any kotlin devs:
When can one use closures? I assume that I can use them whenever the only argument of a method is a functional interface, but are there any extra limitations (e.g. how many arguments the functional interface can have)? Are there additional usecase where closures can be used (e.g. if there are arguments before the method, as would be the case with void myMethod(int i, IntConsumer intConsumer) or with return types such as Consumer<Object> myMethod())?
Does anyone know if there is a type of Cache which works similarly to a time based one, except that you "tick" it manually in the code?
So something where you have a cache and say, that it should clear all elements older than X "ticks".
So the code could go and "tick" the cache and that then performs the culling.
Wouldn't be too hard to write it yourself
you can use them for any method with any parameters as long as the last parameter is a function type iirc
function type being a first-class kotlin function or a java functional interface
You can use a guava cache with a ticking time source, normally used in unit testing
Check the bungee expiring list test
Ah great, so a bit more lenient than I first assumed 👍
FixedTicker
By any chance, spigot doesn't have something like this already built in. A chace that has this property for a server tick?
So the return type is irrelevant, so for example I wouldn't be able to use closures to invoke https://docs.gradle.org/current/javadoc/org/gradle/api/tasks/TaskContainer.html#register-java.lang.String-java.lang.Class-java.lang.Object...- (TaskProvider<T> register(java.lang.String name, java.lang.Class<T> type, java.lang.Object... constructorArgs)) for example?
anyone?
I might be misunderstanding what a closure is
my only knowledge of that word comes from groovy
Same here.
the invocation of the method you linked would be just container.register(name, type, arg1, arg2, ...)
Yeah, now the question is whether I could use the returned provider to configure the task after registering it
gradle probably has either their configuration dsl, or you can just use the kotlin stdlib apply function to operate on it as a receiver
I guess I would be able to manually configure it container.register(/* ... */).configure { /* ... */ } though, so shouldn't matter now that I think of it
Yeah I am a dum-dum
if you're making a plugin, you can apply the kotlin-dsl plugin into your plugin's buildscript to get some kotlin niceties
which would probably have the necessary extension to skip the .configure
Nah, I'm writing my own version of gradle. However unlike most attempts I figured that the buildscript isn't that bad of an idea
I am sure it will be as good as gradle if not better 
Depends on how you define good
I mean I guess, you can make a terribly specific build tool for a terribly specific case
and maybe be more useful than gradle
Try to support java versions within 3 months of them being released and you are already a step ahead

Yeah the usecase of the build tool will be working with multiple java versions. And the only real headache that I will get is whether kotlin supports a given java version, but thankfully that is only needed for running. For compiling I'll most likely go very fancy and use janino which I deem to be surprisingly debug-able
kotlin's earliest supported version is 8 nowadays iirc and there shouldn't be any problem with newest and future versions
Well great
Better than groovy which always seemed to break with every new java version
there used to be targets for 1.5 and such but those are removed/deprecated now iirc
Meh, I don't intend on running that low anyways.
goes anyone know from the top of their head how generic attack attribute damage scales
like how much is 1 heart
1 damage = 1 health being taken.
One heart in vanilla is equivalent to two health.
So 1 damage = 1/2 heart
alright thx
why do the results of complex recipes return air
mmmm
your method is returning string
design a format to serialize the location into and decode it
while you expect Location
how do i get around that
?learnjava this also seems like static abuse
Here are some links to get you started on learning Java:
- https://www.codecademy.com/learn/learn-java
- https://www.sololearn.com/learning/1068
- https://www.learnjavaonline.org/
- https://programmingbydoing.com/
- https://docs.oracle.com/javase/tutorial/java/index.html
The last one is the only official one, however some of those concepts assume that you already know a bit about programming.
as that class doesn't seem like utils class
?
you could for example do something like world:x:y:z
public static Location decodeLocation(String str) {
// world:x:y:z -> location im too lazy to write
// and u should learn to solve it urself
}
public static String encodeLocation(Location loc) {
return loc.getWorld().getName() + ":" + loc.getX() + ":" + loc.getY() + ":" + loc.getZ();
}
u still need to write the decode thing
my plugin stopped building
How to make packet entity glowing?
happened after I added the bottom one
I create it using packets
and why do these 3 have different icons?
got it
.
Nah not using api
XDD
what java version do I use for 1.20.1?
like
17
17+
damn, there's java 21 already?
I guess I need help ;-; I'm using 17 and org.bukkit cannot be imported
wdym 'cannot'?
what are you using
NOOO
Eclipse
no
IntelliJ superiority
and no build system 
In this episode, I show you how to create your first plugin using the Spigot API and the Minecraft plugin for the IntelliJ IDEA. #Spigot #SpigotPlugin #MCCoding
Spigot: https://www.spigotmc.org
Code: https://gitlab.com/kody-simpson/spigot/your-first-plugin
⭐ Kite is a free AI-powered coding assistant that will help you code faster and smarter....
can probably follow this series
thank you so much guys
uses intellij ^
nicee
DataWatcher dataWatcher = entityPlayer.getDataWatcher();
entityPlayer.setGlowingTag(isGlowing());
Map<Integer, DataWatcher.Item<?>> map = null;
try {
map = NMSUtils.getF(dataWatcher);
} catch (IllegalAccessException | NoSuchFieldException e) {
}
if (map == null) {
return;
}
DataWatcher.Item item = map.get(0);
byte initialBitMask = (Byte) item.b();
byte b = initialBitMask;
byte bitMaskIndex = (byte) 0x40;
if (isGlowing()) {
b = (byte) (b | bitMaskIndex);
} else {
b = (byte) (b & ~(1 << bitMaskIndex));
}
bitMaskIndex = (byte) 0x01;
b = (byte) (b & ~(1 << bitMaskIndex));
dataWatcher.set(DataWatcherRegistry.a.a(0), b);
PacketPlayOutEntityMetadata metadataPacket = new PacketPlayOutEntityMetadata(entityPlayer.getId(), dataWatcher, true);
NMSUtils.getConnection(player).sendPacket(metadataPacket);
Why the fuck he is not glowing? 1.17.1
dunno man
you be doing some serious
bit shifting
Yea you have to
you copied this from GlowAPI?
Its not serious you basically put 1 in index 0x40
Nah i did it on my own in 2min and it should work
Cuz i change 0x40 index to 1
oh that's smart
using a singular value for many possible states
and retrieving that using bit operations
hello, how can i start to develop my plugin's api, like with maven repo dependency and stuff?
cant find a good tutorial or post
just the part of creating the api, lets say EnderchestPlusAPI class and how to publish it to github packages
and the communication between the API and the real plugin
How separated do you want the API to be
Lets say the API is imported like
One way is to keep the API it it's own maven module
compileOnly "github.cirosanchez.enderchestplus:EnderchestPlusAPI:0.0.1"
in gradle
is smth like that
and that will interact with the Plugin
EnderchestPlus
that will have the classes like
EnderchestPlayer, etc, etc
did you publish it
Basically what you'd do is have a module for the api and one for the implementation
Assuming it's a buildable project without any manual dependencies you can use Jitpack
Alternativly you can setup Github actions so automatically publish maven artifacts
https://uploadir.com/82530/Ytc1VcZagW
Code: https://pastebin.com/vy7UiZJpDoes anyone know how to show the last action? 😐 What i'm doing wrong?
tried also with:
cloneInventory.setContents(event.getClickedInventory().getContents()); Main.getLive().getBot().openInventory(cloneInventory);
still not working 😢
i just went to test this and thought over it again and thought i cant have it compact down to one @update bc it would someone could go from 1.0.0 to 1.0.1 and i also have a 1.0.2 but if i only have from 1.0.0 but they have 1.0.1 update it would break. So idk how i could add updates to it without like adding a load of annotations or some wrapper object(s)
I don't exactly know what you need the update for really for a simple configuration wrapper
i just thought over it over and i dont think i could do it without some like hard rewriting so i think i might just leave this for now untill i can think of a use for it and how i might need it updating
uh how can I check the itemstack used to destroy a block within BlockBreakEvent
bc i have something along the lines of ```java
if(stuff) {
event.setDropItems(false);
/* Manually drop items... */
}```
im not sure if getting the player's currently held item is viable because that may be delayed as in the player could've swapped items by then, right?
it may also have been broken by another plugin
yeah thats the issue
should i just create a queue of "the player successfully broke this block" and pop 1 every time 💀
seems like a weirdchamp play
or maybe i should dispatch a custom event
or maybe there's a less clown way of doing it
what exactly are you trying to do?
when the plugin detects a custom block as broken, it calculates custom drops
wait cant i just setdrops
lmao
oh no ic ant
sad times
you need to set the drops in teh BlockDropItem event
lol
it only has setCancelled 💀 🙏
you have to detect your special block in that event, clear drops and drop your own
and the getters still dont provide itemstack at time of breaking
yeah but to drop my own I need to do custom checks to make sure the player was holding an item that allows drops
well in BlockBreakEvent the broken Block would be broken by the item in the players hand?
what is so hard?
^ as it only fires for player broken blocks
the event doesnt pass the item in the player's hand and im worried the player might be able to change item by the time i get the itemstack in the hand
not possible it happens in the same tick
what if the player has like 1 microsecond ping and quickly swaps before i get the itemstack or sumthin
or am i paranoid
alright thanks
well also
the BlockBreakEvent fires before its actually broken
at that point if the player were to switch the block would stop being broken
Yo i got a question
i wanna try base64 serialization for items
itemstack
somth like this public static ItemStack[] itemStackArrayFromBase64(String data) throws IOException {
try {
ByteArrayInputStream inputStream = new ByteArrayInputStream(Base64Coder.decodeLines(data));
BukkitObjectInputStream dataInput = new BukkitObjectInputStream(inputStream);
ItemStack[] items = new ItemStack[dataInput.readInt()];
// Read the serialized inventory
for (int i = 0; i < items.length; i++) {
items[i] = (ItemStack) dataInput.readObject();
}
dataInput.close();
return items;
} catch (ClassNotFoundException e) {
throw new IOException("Unable to decode class type.", e);
}
}
will cover everything on itemstack?
like enchantments, custom data holder, etc
I think you can just read and write the array directly
uh
this PDC aint containing
persistentDataContainer.set(CustomItemKeys.IS_CUSTOM_ITEM_KEY, PersistentDataType.BYTE, (byte) 1); // set
// later
return persistentDataContainer.has(CustomItemKeys.IS_CUSTOM_ITEM_KEY, PersistentDataType.BYTE); // false```
oh i see
i did some fuckery my bad
k
ill take that
but i just wanna know
really covers everything?
nvm i didnt 😭
cause i dont wanna write something that doesnt work
for that i can use gson and the adapter
It uses the same data that would be saved to a config file for an item
Which afaik covers everything
Is there an API to set an entity to target a specific location., rather than an entity?
There is setTarget(LivingEntity)
But I would like something like
setTarget(Location)
you can with paper
?whereami
if there is no item in the player's hand, RIGHT_CLICK_AIR will not work.
is there an event that can detect this?
he did it 🥳
Can spigot handle kotlin corutines?
spigot corutines 💀
Yes
Thanks
i think it can only detect ARM_SWING
this doesn't seem to work when you right-click "AIR".
@EventHandler
public void onAnim(PlayerAnimationEvent e) {
Bukkit.broadcastMessage("a");
}```
I made it like this, but it doesn't print when I right-click air.
🤔 🤔
then you can't
no packet is sent from teh client when actions are taken which produce no result
okay, thanks for your help!!
the animation packet was your only chance
no reason to make a janky method really
no reason to tell people paper has it when they are asking in the spigot discord
you're right it makes more sense to gatekeep information!
This is spigot so give spigot advice
is there any way to get a colored material based off of a Color type that is already implemented? Or would I have to create my own mappings for that
Spigot 1.8.8 doesnt have persistentdatacotainer amd I will not use NMS, can I solve this issue with a hashmap to store itemstacks in it?
nbt api's
How do I convert a kyori component to nms component?
Iirc nbt api didn't exist in 1.8.8
it does
" 1.81.91.101.111.121.131.141.151.161.171.181.191.20"
I mean they exist but can a hashmap do it's job
Loooks like a library to me
anyone know
I mean I want a player that buys a potion to just store that potion in a hashmap until he uses it
You'd need to also save the map to disk then
No because it is a minigame that is erased on restart
since nobody answered I just created a little utility for it, just for reference https://gist.github.com/aparx/b4a41550967eec29f3d2c846f98dea45
the load distribution looks something like this? https://paste.md-5.net/cugomiqune.cpp
and I understand it's called a thread pool.
in the database used, too.
By the way, if I distribute tasks by ticks in the main thread, I won't be able to do anything at that moment? Just watch without lags how everything is loading?
It is possible to run code after your tasks are ready by using a CompletableFuture or a Callback via Runnable|Consumer|Supplier
I have a weird error which I've never had before, could anyone please help?
java.lang.RuntimeException: Directory 'plugins\Raycasting-1.0-SNAPSHOT.jar' failed to load!```
?
Fixed it, all my modules had a <build> tag, not just the main one.
it go?
i have an entity that is supposed to be a bird with a resourcepack later
but
problem is
i dont know what entity to utilize
cause i want the bird to be able to land and walk too
this not only causes animation problems but also
well
theres no entites that can walk and fly
aye the amount of switch branches is crazy
Yeah, but it works
Haven't updated it in a while though, but I do not think that anything changed since
i guess
but i definitely prefer my implementation of this if im honest
more flexible, less repetitive and also more performant (in another world)
just the memory overhead is different
That class was developed in a time where everyone complained about performance with my plugin
i mean if it works
Won't for long though
The great thing is that I'm working on a Gradle alternative so eventually I will be able to fix the issues raised by the material refractor with compile-time bytecode transformation
Noone can take my switch-on-enums away babyy
i mean thats why i was wondering why you were using switch statements since the compiler at its own as is won't be able to optimize your code due to the argument (maybe JIT* could, but dont think it would)
since the argument isnt known at CT
It is
e.g. switch (this) will result in compile-time optimizations, but switch(arg0) wont i think
Switch-on-enums will be compiled to a switchtable with an array lookup
makes sense
It is compiled to switch (MyClass.$switchMap$org$bukkit$Material[arg.ordinal()]) afaik
thats what i thought initially but didnt know it was an actual thing at ct
well we're kinda similar in the end
like implementation wise
i use an EnumMap which underlying also uses the ordinals in an array
(I changed Map to EnumMap after realizing I used an enum as a key lmfao)
yh i just made that wrapper in like 15 minutes or so with a couple tests to ensure the right behaviour really
EnumMaps might be faster in the far future. But they WILL break till then unless you stay on old versions
i mean we talking microseconds of performance differences, that doesnt matter with plugins if im honest
Though the Material enum probably uses jumbo EnumMaps which may be different
yeah
i have a material associated to its dyecolor, thus the "key universe" of the enum map is not that large
and the lookup really fast, but in turn I use a couple more instances allocated -> more memory complexity
but again, all this stuff doesn't really matter for plugins imo, go with what suits your requirements the most and works efficiently and good is
this custom ore use noteblock or?
ye
Is the hardness the same?
ye
so if player will use hand, block will breaking fast?
no it will break slower?
if hadness like noteblock
this will be breaking fast
or you use effects
the hardness is custom made
but you not can change hardness becuse this use in client
or he really have big hardness?
we can
hm
watch the video
You have to use a system with mining fatigue magics
breaks like stone, feels like stone
will feels like stone if you will use hand?
not tools
for hardness
i mean that isn't really a build tool thing but a compiler thing, you can like do that already with a compiler plugin, at worst post-compile classfile processing
I make custom blocks too and in the process I learned that strength and break/paste song cannot be changed
so how you was do this
magic
lol
I don't like doing compiler plugins, they are not reliable (flashbacks to Lombok breaking everything). Adding ACC_ENUM and then removing it and rewriting #ordinal() suffices
so how
magic
you are not a wizard but a programmer
umm actually 🧙
magic is prohibited outside Hogwarts
Can I make a player go up with SetVelocity and the player is simultaneously riding on an armor stand that is invisible? Or will the player not go up as it is a passenger to the Armorstand
why is the player on an AS?
How do you mean?
Why do you have the player on an Armor Stand?
Because the player must sit down
You would have to setVelocity on the armor stand
Only armor stand or both armorstand and player?
AS
only the stand
Okey
hey guys, i made a spigot plugin, i want to know if it also works on proxy servers
i dont know much about proxy servers
You mean the proxy itself
no, spigot plugin and bungee plugins are different
Or servers connected to it?
like i want my spigot plugin to function across the whole network
is that possible?
not the plugin itself
okay
you can put the plugin on each server and connect them via redis or a central database
instal redis so each plugin can talk to the others
redis is a plugin?
bungee plugins are just what the name suggest, but they only have access to proxy stuff. No server things like worlds
How can i make a block unique
without saving its loc
This is the first time I've used the modules, how do I make sure that "Core" is activated as "JavaPlugin"?
it wont do shit for the servers but yeah if the whole network is routed through one proxy
a bungee plugin is very restricted in what it can do
its not capable of installing or loading spigot plugins on your backend servers though
it only has access to players (sort of)
well it can install it if u have a dynamic server instancer or some shit
What is your end goal?
in a nutshell, my plugin only puts all players on the server that are currently online in a db
so i dont need access to the world
i just need access to commands (so i want to make my own command) and the playerjoin events
no, spigotmc
and the players
Sounds like you only need a bungee plugin
you'd have access to all servers and players
so i should make a bungee plugin?
okay
you can move them to different servers
probably
and would bungee plugins also work on single-servers? (so spigotmc)
okay
I mean, if there was one server and a bungee proxy
a bungee plugin goes on a bungee proxy
and spigot plugins on bungee work but they need to be installed seperately on every server, right?
they don;t exactly work on bungee. they run on Spigot
wait so proxy servers are just a collection of smaller spigot servers?
i still dont really get it
a proxy is the head of a collection of Spigot servers
every connection goes through the proxy
basically, unless you manually do something about it by installing software which can talk to eachother on all servers and the proxy, your proxy is completely seperate from your servers and the only thing it does is manage player connections
and bungee plugins have access to the whole network?
imagine you have many computers at hoime which all connect to the same modem. The modem is the proxy and the computers are Spigot servers
okay
idk what u mean by "whole network" but they have access to player connections and proxy settings yeah
and does the modem have access to all players on the computers?
bungee has access to all connections which run through it
yes
u can send messages, titles, tablist, etc
u could even open a GUI with packets
so if i create a plugin that funstions on the modem (so a bungee plugin) it can see every player on the computers?
but u cant modify anything on the server itself
yeah
hmm
i see
so i need to essentially make 2 plugins; a plugin on spigot that works for smps and smaller server that are basically the computers themselves and another plugin for proxy servers
is that correct?
yes
if your plugin is just to move players I don;t see why you need a spigot plugin
if u need to communicate about a player you can do that with plugin messages over a player connection
wherre woudl they be going on a single server?
private void createCustomConfig() {
customConfigFile = new File(getDataFolder(), "custom.yml");
if (!customConfigFile.exists()) {
customConfigFile.getParentFile().mkdirs();
saveResource("custom.yml", false);
}``` At here isnt it every time creates new customConfigFile?
otherwise youll need to set up something like redis or rabbitmq
for general communication
no my plugin just needs to be able to have access to all players in the network/server and send them messages
so no world stuff
you dont need a spigot plugin for that
ok
unless you have no bungee, then yes
you can actually combine a spigot plugin with a bungee plugin so you only have one plugin
saves duplicating code/distribution
no, basically the plugin should be a public plugin that everyone can download, its not for me only
really??
thats cool
i usually dislike doing that tho just adds more to the file size
that would save a lot of time
ig it works if its a small plugin
it is relatively small
not much, it's only a bungee.yml, plugin.yml and two main classes, one for bungee and one for spigot
so idrc much about file size
well your plugin probably does something different for bukkit or bungee
so youll have code for both sides + maybe like a velocity platform in one jar
an alternative to bungeecord
another proxy
okay
works in generally the same way
so do i need to code anything special for velocity too?
idk if u want to support it yeah
or is it basucally like spigot that it also works on papre
it doesnt implement the bungeecord api so you will have to if u want it to work
no its not a fork of bungee
because maybe i should add also support for velocity
Velocity is generally better, the only bad thing being that it has less plugins available and that's it
lol
i know but not everyone knows that
i think bungee is a bigger name
especially for beginners
and is it possible to also make it support velocity in a single jar?
so spigot, bungee and velocity
yeah it uses another resource velocity.yml or velocity.toml i forgot
okay
so u just add another main class and more support code
okay
if u want to do it that way
so and it will only activate ONE of the main classes if its that software, right?
yeah
okay
and is there a good yt tutorial that demonstrates how to make a bungee or velocty plugin?
okay
ok
whether theyre good idk
Nope dude you use an annotation and add an annotation processor to your pom to generate the resource which is a json you shouldn't write yourself
ok
why dont go package?
?
?
dont build
Don't build what
Light mode 😨
"Does not working" is a useless statement. Please describe what exactly is not working, what you expect it to do, and what actually happens. If you get any console errors, also ?paste the entire stacktrace.
Yeah, fucked me too at first
Cyclic reference
how i resolve it?
Core can't depend on Lobby if Lobby depends on Core
Solve it by properly structuring your plugin
If this were a mc modding server and also not a help dev channel it would mean a totally different thing
a... how i can do it?
it's the first time I've worked on models.
You mean the mod?
Yes
It's so poorly made 💀
Would this work with Velocity for getting the address they connected with? (This doesn't mean their IP address right, it means what IP they used to connect to the server)
Isn't it just random shit put together
Kinda like xu2
It has some cool items and features
But they will tank your tps
Beacause of how they're implemented
Which crashes when you shift more upgrades into a slot than it can fit
no im pretty sure thats the players IP
idk if theres a way to get the ip the player used to connect
I don't think you get that data
@chrome beacon this?
dont think so either
Mc isn't a http server
at the very least it isnt provided by TCP or UDP
and i dont think it is by minecraft itself
in the login packet or smth
Core can't depend on itself
eeee
It isn't, unless you implement it yourself
so theres probably no way to get the ip the player has in their server address box
how i can do?
Yes
Remove the dependency
Definitely
isn't there a getVirtualAddress or something or is that only on bungee api?
I believe you can
Bungeecord should have that feature
Being able to send your to a specific server depending on the adress used
oh isn't there a bungee plugin message for that
oh sick
hi, im new to plugin development, i need help
i tried to import vault api trough pom.xml and it colors red
Are you using Intellij?
yes i am
Click the reload icon
Hi !
I am trying to use the docker api to create a manage my containers from a java APP but it seems i have an issue: https://paste.md-5.net/qovutawuye.http
Here is my pom.xml file: https://paste.md-5.net/ozajunukot.xml
And here is my testing code: https://paste.md-5.net/robehaneze.java
Note that i have no issue compiling my jar with mvn package, the issue appears only when the jar is loaded by spigot
Java cannot run code that doesn't exist
Therefor you need to load that Docker API
If you're on 1.17+ you can use the libraries section of your plugin.yml (assuming the api is hosted on Maven Central)
If not then you need to shade it with the maven shade plugin
Isn't it already loaded with my pom.xml ?
No
You're just compiling against it
basically saying this code will exist during runtime
So i need to get a jar of this and shade it in my final jar ?
nah maven already downloads the jar so it can do the work for you, look up maven shade plugin on google bc idk maven
damn im glad i use gradle
This is really weird, because from the docs and blog tutorials they don't need to shade 🤔
Well thanks i'll try !
an API developer assumes you know to somehow load the code at runtime
They probably assume you know how to load stuff in to your runtime environment
I use both, depends on the project
interesting
Maven ❤️
nah
I like goth, besides when gradle is kotlin'd
i agree
Agreed
Can anyone help teach me to code plugins and custom items?
What part do you need help with?
All of it, I have no idea where to start and need so much help 😭😭
?learnjava
Here are some links to get you started on learning Java:
- https://www.codecademy.com/learn/learn-java
- https://www.sololearn.com/learning/1068
- https://www.learnjavaonline.org/
- https://programmingbydoing.com/
- https://docs.oracle.com/javase/tutorial/java/index.html
The last one is the only official one, however some of those concepts assume that you already know a bit about programming.
Start with Java
I’m trying to start up an smp with custom plugins and items
sounds like you might not have the time to learn
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/
Ends soon tho, that’s why I’m trying to learn
Can’t afford to hire someone
As a young high school student, I’m broke af
Well it'll take a couple of months to learn
I personally started understanding java after like a month or two of practicing it
Sounds like a part time job 8 weeks
or just use something that already exists
You won't be learning how to code and how to make complex things over night
Is there a way to make customs items with plugins that already exist?
Plugins like Oraxen and ItemsAdder exist
There definitely are plugins to make custom items
or just use some mods
Do they also allow items to drop from mobs and have different rarities?
No mods
Then everyone has to install mods
It’s a mess
Any free options?
Ones preferably on aternos
Maybe check out mythicmobs
For just items it's pretty overkill though
Tested with this, it seems nothing happens with velocity but the player sits on the armor stand
ArmorStand armorStand = victim.getWorld().spawn(victim.getLocation(), ArmorStand.class);
armorStand.setVisible(false);
armorStand.setGravity(false);
armorStand.setInvulnerable(true);
armorStand.addPassenger(victim);
Vector velocity = new Vector(0, 10, 0);
armorStand.setVelocity(velocity);```
I think setting gravity to false disables velocity
It should only disable vertical velocity
It will affect the horizontal movement but shouldn't cancel it out
disabling gravity disables all velocity
you cant even put custom plugins on aternos
so your only option is what oraxen/itemadder whatever thing is on aternos
Ik
I’m not sticking with aternos
Just tryna test stuff out rn
Before I buy a server
Hello everybody! I'm making a plugin where players have to manage their lives. I want to implement a system where the player's nametag's color change based on the amount of health they have. My problem is that I have a scoreboard which uses teams to display and color the text on it. Because of this I can't add the player to a team to color their nametags above their heads. p.setDisplayname() doesn't work as it sets the name on TAB and in chat. Is there any workarounds for this?
What is the name of the thing that suggests command arguments?
TabCompletor
Thanks
<<<< TabExecutor (bundle of TabCompleter and CommandExecutor)
why does md_5 relocate the net.minecraft.server each version?
Kennytv just said so on his stream while replying to me?
mh
CraftBukkit is relocated but not nms
ohhh
tbh no clue why CB is relocated though
feel like that's something we could maybe look into getting rid of though it depends on what the slime thinks
?? does anyone know?
what do you want to achieve
You want to copy some inventory contents and then show these contents to another player?
yes
getClickedInventory can be null if an inventory was clicked out of bounds.
whats the issue you're dealing with?
🤔 no
What would be the safest way to storage a discord token in a plugin?
Do inventory override hashcode()?
Hi ! I work on a bukkit plugin and I have a problem... Someone can help me please ?
the problem is when i put an item in the first inventory, the player to who i want to show that item is not displayed from the first time, and if i put another item in the inventory, the player to who i want to display that item only now sees the first item that i put first, like the last action is not displayed on the secondary inventory.
?jd-s
getContents just retrieves an array of itemstacks at the code execution time.
No idea what could it be. It should work. I'm not home so I can't test this but its not logical that it wouldn't retrieve the last itemstacks...
someone pls 🥺
Yeah you'd have to use Scoreboard API
and use teams
https://hub.spigotmc.org/javadocs/spigot/org/bukkit/scoreboard/Team.html#setPrefix(java.lang.String)
declaration: package: org.bukkit.scoreboard, interface: Team
no need for setdisplayname
i am using a scoreboard api that's not the problem. The problem is that I want to add a color to the nametag above the player's head. First I wanted to use teams but with the scoreboard API it doesn't work (I suppose it uses the max amount of teams?)
Could you share the code of how you're using the scoreboard
You don't store it that tends to be the safest way. Read it from a file. And do NOT distribute this file with your plugin
I am using this
public class ScoreHelper {
private static HashMap<UUID, ScoreHelper> players = new HashMap<>();
public static boolean hasScore(Player player) {
return players.containsKey(player.getUniqueId());
}
public static ScoreHelper createScore(Player player) {
return new ScoreHelper(player);
}
public static ScoreHelper getByPlayer(Player player) {
return players.get(player.getUniqueId());
}
public static ScoreHelper removeScore(Player player) {
return players.remove(player.getUniqueId());
}
private Scoreboard scoreboard;
private Objective sidebar;
private ScoreHelper(Player player) {
scoreboard = Bukkit.getScoreboardManager().getNewScoreboard();
sidebar = scoreboard.registerNewObjective("sidebar", "dummy");
sidebar.setDisplaySlot(DisplaySlot.SIDEBAR);
// Create Teams
for(int i=1; i<=15; i++) {
Team team = scoreboard.registerNewTeam("SLOT_" + i);
team.addEntry(genEntry(i));
}
player.setScoreboard(scoreboard);
players.put(player.getUniqueId(), this);
}
public void setSlot(int slot, String text) {
Team team = scoreboard.getTeam("SLOT_" + slot);
String entry = genEntry(slot);
if(!scoreboard.getEntries().contains(entry)) {
sidebar.getScore(entry).setScore(slot);
}
text = ChatColor.translateAlternateColorCodes('&', text);
String pre = getFirstSplit(text);
String suf = getFirstSplit(ChatColor.getLastColors(pre) + getSecondSplit(text));
team.setPrefix(pre);
team.setSuffix(suf);
}
}
and here's how I make the scoreboard for the player:
public void CreateScoreboard(Player player) {
ScoreHelper helper = ScoreHelper.createScore(player);
helper.setSlot(4, "Line4");
helper.setSlot(3, "Line3");
helper.setSlot(2, "Line2");
helper.setSlot(1, "Line1");
}
@river oracle will help you with this 😂
but you are using static wrong and if checks in setSlot
Does anyone have any suggestions for a DI framework I should use? I have been looking at Weld, but got completely overwhelmed with it's API (Not from the DI/CDI side of things, but like how to obtain objects, etc. - since I don't think you can or should be getting objects like I am used to)
you can check out DI framework I've made a time ago. Its pretty easy to use https://github.com/jwdeveloper/DepenDance
Is the framework also able to invoke constructors with args? This has been the main gripe I had with weld
Hm, and what happens for like rather basic arguments, such as MyClass(int a, int b, MyComponent c)?
Hi again, sorry for bringing this back again but i have been struggling with it 😅 I cannot seem to succeed shading docker api and i have not found any other solutions. If you have any ideas that would be nice ^^
When creating a plugin with simple placeholders that describe a player's current victim, do you usually have two options?
-
Use the own system plugin for placehoders
-
Use the PlaceholderAPI
Or do you usually only offer PlaceholderAPI?
Using PAPI is probably the most user-friendly approach
For this case you would need to register class with resolver, like that
public class ExampleModule {
}
public class ExampleClass {
public ExampleClass(int a, int b, ExampleModule module) {
}
}
registerSigleton(ExampleModule.class);
registerSigleton(ExampleClass .class, container ->
{
ExampleModule module = (ExampleModule) container.find(ExampleModule.class);
int a = 12;
int b = 23;
return new ExampleClass(a, b, module);
});
the most well knowen DI containers has this nice feature that they are not using reflections, but generate code class for your container
Okay great. I'll look into your library then!
my library has this benefit that is small and simple, but it use reflections
Tbh, from a performance point of view there is no difference in my usecase
So having stuff be on a simpler side might be more comfy for me
ye especially when you register everything as Singleton, performance will be not an issue
how i can give permission intelji read my file in windows
Windows has permissions?
We need more information mah dude
i not can read file
I'm betting he's talking about trying to build a plugin into a running server
What are you reading? system32?
lol no i read file css for some project
i mean i was create code for read file
but windows not give me do this
what is the file, where is the file, how are you trying to read it?
Access is denied
file in C disk
i always get FileNotFoundException (Access is denied)
then your path is wrong
so I wanted to know where I can change file access? I heard that in the properties but I got completely confused when I tried to change
its not file acccess
not not wrong i was copy and paste
the file is not where you are looking
The information you have given us is quite incomplete and we can’t offer valid help
correct because after the error there is a clear explanation of the reason "(Access denied)"
do you actually want to know this?
Just start IJ as admin 💪🏻
you are trying to read a file. Its not there. it does not exist. Your path is wrong.
average java script developer
What’s not clear is that I’m trying to read a css file through a special class. The file itself is located on the C drive. When I try to read it, I get the error "'path' FileNotFoundException (Access denied)"
You never shared the path
Nor code
C drive isn’t really that informative
bc he is trying to scam u into writing it for him
The error isn’t that informative
He usually isn’t he is just really bad at english
path to file is wrong. Probably due to spaces in directory names
?paste
i rename all my drives to match my crushes initials
Almost creepy
after a couple of days of debugging it works
and i totally never lost 800gbs of data doing that
https://paste.md-5.net/fucopuyiri.java this code
her drives are JT now
nuh uh not while @molten hearth and md5 is alive
Ur reading a folder
no problem he won't be alive for long ong
yep, path wrong. no file
😲
oh
blud put an absolute onedrive path in his code
Stop being sussy all the time smh @grand flint
pranked
does onedrive make a virtual fs or smth
No
it just syncs ur files?
ah
Thouugh, it can i suppose have undownloaded files iirc
just seems like a potential security vulnerability
u can too with drivers
but doing that for cloud storage seems risky
does the 1.20.3 update contain /tick command?
yes
how does it work?
It can modify the internal tick loop speed
I only saw singleplayer tests, wonder how it works on a server
Pretty much the same
alright thanks
tried dagger?
not yet
bruh all the chat events are depracated which one do I use
?whereami
i mean aint it kinda the same thing just paper is a fork with some performance enhancements
Different api’ish
Rip
not big
What ur looking for is AsyncChatEvent @proud badge
ah ok thx
Obviously not since spigot plugins can run on paper
He just needs to ask over at paper for proper paper help instead of here
Ok
paper has some own events like tickEvent
basically that's all as I understand it
There so much more lol
By the way, surprisingly, there are much more assets here than there
?help
selfrole Add or remove a selfrole from yourself.
cleanup Base command for deleting messages.
embedset Commands for toggling embeds on or off.
info Shows info about CafeBabe.
licenseinfo Get info about Red's licenses.
mydata Commands which interact with the data CafeBabe has about...
set Commands for changing CafeBabe's settings.
uptime Shows CafeBabe's uptime.
findcog Find which cog a command comes from.
names Show previous usernames, global display names, and server...
userinfo Show information about a member.
listcases List cases for the specified member.
reason Specify a reason for a modlog case.
permissions Command permission management tools.
SpigotMC maintains the Spigot server. If you are using a fork of Spigot (such as Paper, Airplane, Purpur, or other derivative works), you should seek support in the appropriate Discord servers.
its event.message() for paper
and to get the content, you should cast it to TextComponent too
((TextComponent) event.message()).content()
Hey guys do u know how to prevent spawning ancient debris in nether? some datapack or something
1.15
OreSpawnEvent when
what will it do
this method is still working to refresh players on 1.20.3
however it takes now 1kms
do yall know any better method
Be called when ores are placed presumably
final Location location = player.getLocation();
final ServerPlayer ep = ((CraftPlayer) player).getHandle();
ep.connection.send(new ClientboundPlayerInfoRemovePacket(Collections.singletonList(ep.getUUID())));
ep.connection.send(new ClientboundRespawnPacket(ep.createCommonSpawnInfo(ep.serverLevel()), ClientboundRespawnPacket.KEEP_ALL_DATA));
player.teleport(location);
ep.connection.send(new ClientboundPlayerInfoUpdatePacket(
ClientboundPlayerInfoUpdatePacket.Action.ADD_PLAYER,
ep));
ep.connection.send(new ClientboundPlayerInfoUpdatePacket(
ClientboundPlayerInfoUpdatePacket.Action.UPDATE_LISTED,
ep));
player.updateInventory();```
that the reason i want the people on the server not to mine it but get it from bastion
is there any tutorial how to do that?
Listen for block break event
It block is ancient debris -> event.setDropItems(false)
Anyone know who's responsible for the Jira and Bitbucket?
?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!
I am asking this way because I don't wanna necessarily share this information publically
?support