#help-development
1 messages ยท Page 409 of 1
yes, why?
paper cancel the right click air
add (ignoreCancelled = false) after the event handler
but as i said, the sound and the sethealth still works
paper jank probably
So 12hours is hard limit per author id ?
What is his timezone
pst
I see who is simple exactly can you give me his tag ?
@sterile axle
Ty
How can i block all ClickTypes in InventoryClickEvent, wihout making huge if statement?
just dont make clicktype check and cancel event regardlessly ?
if I make a RPG game and store all the stats in PDC is there a problem with that or would it work fine?
yea but that is very difficult atleast for me
also there arent going to be too many stats
or use an yml file whatever
The Configuration API is a set of tools to help developers quickly parse and emit configuration files that are human readable and editable. Despite the name, the API can easily be used to store plugin data in addition to plugin configuration. Presently only YAML configurations can be used. The API however was designed to be extensible and allow ...
but mysql takes a while to set up
lol
and has weird cmds
lol
sql syntax is so eloquent
id go for more of annoying than eloquent
Is there a way to use a profiler for ones code?
Cause Intelij provides such for own made applications, but what about external enviroments.
How can I modify the item drops in BlockDropItemEvent?
check the docs
Looks like I can get the items but I can't modify them
Issue is that I got some code which I need to optimize, yet I'm not sure whre the issue is.
Why are you posting in #help-development then
Is there any method that is more lag-friendly than Block#setType?
Cause it seems that this method is cause for most of my lag within a function.
yo what is the best way to figure out spigot plugin development beside the spigotmc docs
is there like way to look at the source or something
just wanna dig a little deeper
?stash
bukkit is the api, craftbukkit is the impl, spigot is the server
does that contain it all?
yeah
Can someone help me with the vaultapi stuff
?
ok but with what
Like implementing it in the plugin and then just deleting some amount from users
are you using an economy plugin?
i got this in the onEnable ```java
if (!setupEconomy()) {
getLogger().severe("Vault or an economy plugin is missing!");
getServer().getPluginManager().disablePlugin(this);
return;
}
its for my plugin
but i dont know wheretf is setupEconomy coming
You have to make that method
found it in the github
does anybody know if there is a tag for concretes? I didn't find any, but maybe I'm a little bit blind XD
Not that I know of nms might be a few nanoseconds faster
Just because you don't have to go through the interfaces. However nothing meaningful you might need to look into work distribution post by 7smile7
?workdistro
That's what I was looking for ^
would getting an item from a array with VarHandle#getVolatile be slower than a simple a[i]?
Any way to get a random location from already generated chunks?
lowkey kinda scary that i just made chat GPT make a quite complex plugin demo in like less then 2 mins and i deadass works rlly well
Take care about CahatGPT not always give correct answer, its a helping tool but dont stay with only 1 answer read ot of them from dif sites too
yeh ik ik just this was kinda crazy since it worked within like secconds and i didnt even need to change any of the code XD
I wont event tell you to try Copilot
๐
Its fucking amazing for coding in my case lat year i was coding a crates plugin, and he made itself the 40% of the plugin
But on the other hand it make devs to lost ability for coding because you will most of the time dont even read what he gives you and instead plain example code he give you
RandomPos from NMS
How do I use that
Is there a way to get the server.jar within a plugin?
hm
what if I use bundler/versions and figure out from server software & version
grep was just used as an example. you'd do it in java
there is no way to know the jar name from within the plugin (not that I know of)
Well I don't exactly need the jar that got launched, just the spigot server, so bundler versions it is ig?
bundler?
plugin.getClass().getProtectionDomain().getCodeSource().getLocation().toURI()
coudnt you get the path of the plugins jar, back peddle out of the plugins folder and scan all the jars for Bukkit.getServerVersion or Bukkit.getVersion in a class name
that would probably give you the plugin jar
if the jar is renamed it won't work
yeah
What do I put in as an entity?
Oh, was it about the server jar?
wouldnt the jar still contain the version
Yep
you could try `Spigot.jar...
say it gets renamed to server.jar
sorry Spigot.class
but the jar would still contain the version class right
I guess
you just scan all jars possible
What EXACTLY are you trying to do?
starting with server.jar, spigotX.jar paperX.jar etc etc
I quite literally just need the server.jar path
Like literally that
then Spigot.class and as above
alr
if the security manager allows it
You mean Bukkit.class right?
I don't see a Spigot.class, unless you mean Server.Spigot
testing it
@eternal oxide @remote swallow It seems to give the API jar using Bukkit.class, which is still fine
the API jar is teh server jar when on a server
Server\bundler\libraries\spigot-api-1.19.3-R0.1-SNAPSHOT.jar
then try CraftBukkit.class
will probably give you the same, but worth a try
actually no, it shoudl give you the spigot server jar
in versions
I don't want to spawn them near a player always though. I just want them to spawn in random generated chunks
Hey Guys!
I have a quick question.
Is someone familiar with adding support for custom flag handling with WorldGuard?
We are currently supporting only the newest WorldGuardAPI version and noticed afterwards
that it doesn't fit with the other API versions and it seems like WorldGuard has a different structure
for like every version.
Is there a workaround? Or would be the way to go... to check the version and add a complete different handling for like
every single different version?
Thanks in advance!
How to make a circle of particles around an entity for 15 seconds? I tried to search, but there are some super hard mathematical calculations
is there some alternative for runTaskTimerAsynchronously with BukkitRunnable, that doesnt error out?
full error
GameListener.java:271
did you provide the delay and repeat?
yep
then Paper
also yep >_<
thought this will be same in Spigot, so I wrote here
cuz their discord is dead
what they are sayign is don;t pass a runnable, use teh runtask... of teh runnable
new BukkitRunnable() {} runtasktimer...
i dont get what you mean
or use Spigot and you won;t get a warning
U mean they use paper API?
instead of
Bukkit.getScheduler().runTaskTimerAsync(plugin, new BukkitRunnable {}, timer, timer );```
use
```java
new BukkitRunnable{}.runTaskAsync(stuff);`
create a class
ooh tysm
also kindof dumb
what is the diff between delay and period?
cuz I can't seem to understand it
delay = before it runs
Delay is the first run delay I think
period = time between repeatsd
Compilation failure
An unknown compilation problem occurred
With maven
I tried to do smth with Vault and then deleted all of vault
code and dependencies and Stuff
and now i keep having that error, what can i do?
[INFO] -------------------------------------------------------------
[ERROR] COMPILATION ERROR :
[INFO] -------------------------------------------------------------
[ERROR] An unknown compilation problem occurred
[INFO] 1 error
[INFO] -------------------------------------------------------------
nvm
just found it
not nvm
smone?
for developing Bungeecord plugins, are the versions backwards compatible? Like for exmaple I if I were developing a 1.8.8 and a 1.16 plugin, would I be able to use the latest build for both?
Yes, latest bungee supports back to 1.8.8
tyvm
Litwrally says like Unknown error
unkwnown ewror
open the drop down on the thing that appears when you build
Not verified? Upload screenshots here: https://prnt.sc/
on the poup at the bottom of your screen, do you see mutliple drop downs on the left of that popup
for using the mc dev plugin in IntelliJ, what would I select as the version? latest? or in pom.xml what for the dependency version
if you really need to, select a version then change it back
because mc dev doesnt support legacy project creating
So for 1.8.8 I would use that snapshot?
they are all snapshots
no like what would I put in <version>
1.8.8-R0.1-SNAPSHOT iirc
that was my guess as well but doesnt exist lmao
is there a way to browse the versions xD
yep
i think
yeah
bungeecord
not bukkit
is it different xD
the repo is <url>https://oss.sonatype.org/content/groups/public/</url>
fr
i doubt it works with 1.8.8
Cannot resolve net.md-5:bungeecord-api:1.8.8-SNAPSHOT
i believe you're correct
hi , do i need to use nms and spawn a entity , to get its entity id?
or i can create new Integer and set it to the packet paramter where it ask for the entity id?
What can ido?
on the left of that screen what do you see
you should see mutliple drop downs most likely one with your project name on
?paste
run mvn clean package -e
?paste

hello guys, i came back after 2 years of plugin dev break, trying to update my old plugins to 1.19.3, but i cant even seem to import the API properly?
?bootstrap
Bootstrap Jar
The main spigot-1.18.jar is now a bootstrap jar which contains all libraries. You cannot directly depend on this jar. You should depend on Spigot/Spigot-API/target/spigot-api-1.18-R0.1-SNAPSHOT-shaded.jar, or the entire contents of the bundler directory from your server, or use a dependency manager such as Maven or Gradle to handle this automatically.
Please read the release notes for further information: https://www.spigotmc.org/threads/9-years-of-spigotmc-spigot-bungeecord-1-18-1-18-1-release.534760/#post-4305163
Try removing the <configuration section for the compiler and see what happens
ahhhh
i would recommend using maven or gradle to make that easier
k
@sullen marlin https://paste.md-5.net/gapexikixo.sql
Change the java verions in your pom
Now add this to the properties section:
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
Simplest way
<properties>
<maven.compiler.target>1.8</maven.compiler.target>
<maven.compiler.source>1.8</maven.compiler.source>
</properties>
Oh yeah sniped
The original issue might be because you only set source not target, but try this
thank you so much
Sure. Just apply an attribute mod when they join
No you can just change the attributes of every Entity as you like
Why?
Have you tried setting Arrow#setKnockbackStrength to 0?
*-1 ?
is there a entityAccellerateEvent
cant u use that then?
wait lmc velocityevent
well
You can check for the ProjectileHitEvent before that
Not quite
cant you register the tick the arrow hits the player in a static list and check that list for said timestamp
Player#getVelocity only returns server-sided velocity
actually
Player-induced movement seemingly isn't considered
why dont you just cancel the arrow hit event and just call player.damage with the same damage of the event
I'm using RunTaskTimer to repeat a task multiple times after a delay but I only want it to repeat 5 times
whats the simplest way to do so
.runTaskTimer(plugin,1,1);
Count up 5 times and cancel the task.,
cant you remove that too and tell the nmsPlayer to stick an arrow into its representation
the arrow i mean
player#setArrowsInBody ??
check event, damage player, cancel event, remove arrow
pretty sure that's athing
new BukkitRunnable() {
private int ticks = 0;
@Override
public void run() {
if (++ticks == 5) {
this.cancel();
return;
}
action();
}
private void action() {
}
}.runTaskTimer(this, 1, 1);
But at that point you should create a LimitedBukkitRunnable class
just
manually apply it
get the velocity impact and rotate it to represent the direction of the hit. that rotated vector you just put into player.addVelocity
u can probably hardcode that part
i meant to rotate the vector such that the force gets readjusted to come from the 3d direction youre hit on
rotation isnt 2d limited
private boolean hitEvent = false;
@EventHandler
public void onVelocity(PlayerVelocityEvent event) {
if(hitEvent) {
hitEvent = false;
event.setVelocity(event.getVelocity().multiply(0.25));
}
}
@EventHandler
public void onHit(ProjectileHitEvent event) {
if(event.getHitEntity() != null && event.getHitEntity() instanceof Player) {
hitEvent = true;
}
}
Try this
Alternative is changing the attribute for one tick.
That sounds janky to me
You'll need to adapt this
but that's roughly how kb is handled
it might be 1.8 specific though
isCrounching -> isSneaking etc
idfk
So you suggest cancelling the knockback all together and calculating it yourself...
ehh
yep
It has to. If the hit event is cancelled then the velocity wont change.
Btw you can shorten this check
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
public void onHit(ProjectileHitEvent event) {
if(event.getHitEntity() instanceof Player) {
hitEvent = true;
}
}
Because instanceof accounts for null
Ah and set the prio to monitor
Just the hit event
As shown above
Is there an easy way to force a player respawn now? this is my very very old code which i tried to change but doesent work haha
((org.bukkit.craftbukkit.v1_19_R2.entity.CraftPlayer)p).getHandle().playerConnection.a(new net.minecraft.server.level.PacketPlayInClientCommand(net.minecraft.server.packs.PacketPlayInClientCommand.EnumClientCommand.PERFORM_RESPAWN));
/kill doesnt do it?
iirc theres an instant respawn option
cant u just enable that
it should be server side
Hmm i dont think it solves the issue because i kind of need to be able to controll it too but im not sure
i have a function where you respawn immedietly under certain circumstances as a zombie
i think it would interfere
player.spigot().respawn();
How do I create a "new world" in a server
Like if I wanna teleport players into a "new world"
kinda like what people use for different games on a server
not all the minigames are hosted on the same lobby
can I load a world
with builds n shit
not a fresh world
yes
Alex
if you load a world by a name that already has an existing world directory it will load the existing world
yes lol
no problem
If I make custom entities but intend for them to be ephemeral (i.e. world is reset upon every server restart), do I need to make sure serialization works with EntityTypes and everything? (1.12.2)
I'm unsure how to make sure custom entities are serialized but if I'm sure that they only are forgotten by the server on restart then I won't have to even concern myself with that case
Do entities get serialized on world unload or chunk unload
yes they do
they have to be registered to the server orelse they wont persist on chunk unload
or you can avoid registering the entity and listen to the ChunkUnload event and manually serialize and deserialize
How would I manually serialize the entity
find a way to serialize your entity which isnt too hard then on chunk unload store it somewhere
then on chunk load respawn the entity with that serialized data
Can I just store it into some EntityManager class and then run addEntity on chunk load?
Can I just keep the entity data in the server and just addEntity to the undeleted entity
Like hold a reference to the entity so it isn't GC'd
Then readd it later
uuh you can try im not sure how spigot would like it though
Thanks for the input brother
all good
?jd-s for self
oh good actionbars do take in a component
How do I remove a permission that is set by minecraft like minecraft.command.me ?
use a permissions plugin like luckperms or group manager
Yo thank you so much my addEntity idea worked
private HashMap<ChunkCoordIntPair, AbstractMob> chunkMobs = new HashMap<>();
@EventHandler
public void onChunkUnload(ChunkUnloadEvent event)
{
Chunk bukkitChunk = event.getChunk();
net.minecraft.server.v1_12_R1.Chunk chunk = ((CraftChunk)bukkitChunk).getHandle();
for (Entity bukkitEntity : bukkitChunk.getEntities())
{
net.minecraft.server.v1_12_R1.Entity entity = ((CraftEntity)bukkitEntity).getHandle();
if (entity instanceof AbstractMob)
{
chunkMobs.put(new ChunkCoordIntPair(entity.getChunkCoordinates()), (AbstractMob)entity);
}
}
}
@EventHandler
public void onChunkLoad(ChunkLoadEvent event)
{
Chunk bukkitChunk = event.getChunk();
net.minecraft.server.v1_12_R1.Chunk chunk = ((CraftChunk)bukkitChunk).getHandle();
World world = chunk.getWorld();
for (AbstractMob entity : chunkMobs.values())
{
world.addEntity(entity);
}
}```
Awesome
When I negate it is still accessible
sick
Custom coded.
minecraft.command.me is set by minecraft as far as I know since it doesnt have an attachment
you can try using just unsetPermission like normal
if that doesnt work idk what to do
This is what I've also been trying but it does not remove the permission
oh then I have no clue sorry
I appreciate you trying to help tho!
If anyone else does know please do help!
I've tried negating it by setting it to false but I'm still able to run the command.
which one
Yes, thatโs how you remove a permission, you set it to false on the attachment
Are you sure youโre setting the right permission
unset would be if it was granted on your attachment
what does that command do anyways
I'm taking plugin ideas, you can send detailed outline in the DMs. I'll share the sourcecode with you.
If it defaults to true you have to explicitly set it to false
If youโve granted it you can unset it
I have an idea, fix my code xD
Without a doubt since I copy and pasted and used find just to double check again
What is your code @pseudo hazel
well I am running into presumably some memory issues but its very hard to debug
Send me the snippet in the DMs
It is also set by minecraft and doesn't have an attachment
its not a snippet
but I was more joking anyways
like there is just some issue with my plugin I think but I dont know where to look
I'm just using bukkit's permissions method
brad, what does the command do in the first place?
Itโs the emote command
@topaz idol I believe you also have to disable bukkit.command.me
No, it defaults to everybody
weird
Why "Minecraft Plugin Requests" subforum is dead
It doesn't say I have that permission in player.getEffectivePermissions()
https://media.bradgamez.xyz/images/myPermissions.png
Try it and see what happens, you might be surprised
I assume it says minecraft.command.me in that list because you have it added as false?
I did not set it at all atm.
I've tried to set to false as one way of fixing it.
Use services thread
Those permissions are all permissions without attachments specifically.
Well of course they donโt have attachments
Theyโre set to default to true
You have to explicitly set it to false and add the attachment
Can I see how you tried to do that?
Also I donโt think bukkit.command.me exists, Google lied lol
I checked the code
maybe it did in the past
Guys, help, please. I've already tried a bunch of different checks and all to no avail.
I have several items in my inventory. Each of them has a specific slot in the player's inventory (EquipmentSlot). I need the player to get the potion effect when the item is in the right slot.
For example, leggings must be in the LEGS slot for the player to get the effect. While it still gets the effect if they are in HAND. I also have a pickaxe, which just gives an effect to the player if it is in HAND.
In general, please tell me how to fix this behavior?
that indentation ๐คข
I do not know how to remove extra spaces in the discord automatically
where?
to avoid else?
make if (!addEffect) return;
I want to store values in an item but persistent data containers are slow
My idea was to store data in the lore of the item but I also want my item to have a displayed lore
is there anyway to have hidden and displayed lore in the same item
Or any other method I could use to achieve this
no to unindent the rest of it
I havenโt seen the code but itโs to avoid nesting a bunch of if statements
assuming this is the whole function and there is not more stuff in it
slow how
And is it possible to put return in BukkitRunnable?
like if I want to update the data in the item every tick
for what purpose?
persistent data containers were being slow
what kinda data needs to get updated every tick
Hello mr alex what did you use to store charge in windblade on clanz
Oh, yes. there was an extra bracket, I'm sorry
using the items lore is just as slow as the pdc
like lore is also in the itemmeta technically
Itโs in the lore
Itโs serialized JSON
thank you
Does someone know how to spawn an entity in a chunk where player's aren't active currently? I've tried loading the chunk and nothing worked. I'm open for ideas. Here's my code:
nothing worked as in they didnt spawn?
Did
declaration: package: org.bukkit.entity, interface: Entity
Wait no
Nvm
declaration: package: org.bukkit.entity, interface: LivingEntity
Thatโs the one you want
But I never got an answer to the initial question
?paste your code @verbal slate
Thx I'll try
so the issue is that it adds the effect regardless of the slot?
Exactly. It works correctly with regular slots, but for some reason it doesn't work with EquipmentSlot.
oh btw sorry for the confusion but early returns in for loops should usually just continue the for loop, using continue instead of return, or you will skip the remaining items to check
Exactly.. I forgot myself too
so at what point do you check like leg slot for example
because right now it adds the effect for every item in the hand
because of the else
where you just check is the item in either hand, not what item it is
In general, as far as I know, using this line I have to get an item in a given slot (in our case, LEGS. But apparently it doesn't work that way or I'm confusing something.
I want to say that there is no need to check for slots here, because I get an item from the right slot right away.
Then I only check for the existence of a tag on the item, and if there is one, it means that the item is in the right slot and the item is an artifact.
ItemStack is = inv.getItem(slot);
so when do you want the leggings to add the effect, I assume only if its in the leggings slot right?
Right
and artifact.getEquipmentSlot should return LEGS for leggings right?
I mean to me it sounds like you need to check is the itemstack is has the correct tags or whatever
the method of getting the slot: EquipmentSlot slot = EquipmentSlot.valueOf(instance.getConfig().getString("artifacts." + artName + ".equipSlot"));
like is is very poorly named but looking at the code it represents the item that is currently in the slot that an artifact should be in
so then to addEffect, you need to check if that item is actually an artifact item
and there is
but I dont see you checking what kind of item is actually is
the item will be 100% an artifact because I get it from the player's artifact list
there are no problems with this
well is is directly coming from the player's inventory
What's really weird is that EquipmentSlot has all the artifacts HAND when it's not
okay
then see if eveyrthing returns hand
if not you need to read back at what I was saying
hm
I cant read that but I am assumig its what you wnat it to be since not everything is HAND
all right
okay so as I was saying
the is itemstack is created from what is inside the players inventory at the artifacts target slot
but you need to check whether that target slot actually contains an/the artifact
because an artifact object is not an itemstack right?
like does Artifact extend anything?
public class Artifact implements Iterable<ItemStack>
return false
that means that the item is not the artifact
wait
why is the artifact an Iterable<ItemStack> and not just an ItemStack?
iterable means it is a collection that can be iterated over
This method seems to use iterations, so so.
It was written before I started writing plugins, by an ex coder
okay
so an artifact has multiple items
idk what that means
can you explain what an Artifact is in this context?
In general, I'd better try to rewrite this moment now. And then I'll let you know what happened
yeah I agree, Artifact seems like a weird name for a collection of items
In general, items is for kits. For example, a set of a sword and a bow (which are also artifacts).
Honestly, I don't even use it, because it's nonsense. The kits need to be placed in a separate place.
I agree on this
because artifact generally refers to a single item, unless you want to pluralize it
Guys does someone know how to set entity knockback to 0
Like for example wither skeleton
so when they're hit with bow or regular hit they take no damage at all?
no damage? cancel teh hit event
simplest way is to set velocity to zero in the next tick
ik MythicMobs have that feature
so on every damage just set it to zero?
next tick
hi, i try this but its dont work, do you have anyidea ? ItemStack lapissss = new ItemStack(Material.INK_SACK);
lapissss.setDurability((short) 4);
p.getInventory().removeItem(lapissss, Integer.parseInt(String.valueOf(Main.getInstance().getConfig().getInt("UPGRADE_LAPIS1_COST")))));
?notworking
"Does not working" is a useless statement. Please describe what exactly is not working, what you expect it to do, and what actually happens. If you get any console errors, also ?paste the entire stacktrace.
The method removeItem(ItemStack...) in the type Inventory is not applicable for the arguments (ItemStack, int)
sorry wrong copy paste before
you are trying to pass an int to a method that doesnt take an int
declaration: package: org.bukkit.inventory, interface: Inventory
does anyone know of a plugin where people can make kits and use them and other people cant see them?
fuck cmi
thx but i dont understand
what is the integer you pass meant to do
i understand what you said but i dont know how the fix this
tell me what you expect the integer you pass to do
players
it isnt
players make the kits and use them and other people cant use them
i want to remove lapis lazuli from player inventory
@quaint mantle i been looking everywhere ;-; pls halp
bruh
that would take a little while
you did ask in help dev
because i want to remove a quantity and not all
im not asking for that
you pass the integer in the item stack
im asking if anyone knows one
that still doesnt explain why you have an itemstack of ink sacs either
essentials dont got that
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/
yea
either commission or do it yourself
no
u know crystal pvp ?
im tryna make a server for that
oh
its gonna be like a practice server
so peopple can make their own kits
yeah, you either need to make it yourself or comission it
Lmao
is anyone familiar with this error? org.bukkit.configuration.InvalidConfigurationException: unacceptable code point '' (0x0) special characters are not allowed in "'reader'", position 0 at org.bukkit.configuration.file.YamlConfiguration.loadFromString(YamlConfiguration.java:106) ~[paper-api-1.19.2-R0.1-SNAPSHOT.jar:?] at org.bukkit.configuration.file.FileConfiguration.load(FileConfiguration.java:160) ~[paper-api-1.19.2-R0.1-SNAPSHOT.jar:?] at org.bukkit.configuration.file.FileConfiguration.load(FileConfiguration.java:128) ~[paper-api-1.19.2-R0.1-SNAPSHOT.jar:?]
it seems to happen when I load a yml file for the first time
an empty file
when I open it there are some weird invisible characters but I know for a fact that the file its building from is totally empty
Paper
oof
however, it's probably your file encoding thats at issue
yeah probably
idk how it got messed up
when I look in the built jar its also wrong
but in intellij and vscode its fine
always utf8
I just use YamlConfiguration so I dont specify an encoding format
if you have resource filtering IJ will parse the file in your resources. If ij is set to the wrong default encoding I guess it could change it
whats resource filtering
a setting in your pom
oh well I don't use that
and I checked encoding settings and it looked fine
the weird thing is I use this file multiple weeks so idk why it would fail now out of nowhere
I mean I did mess a little with when the config is read but idk how I could find out if thats the issue
Anyone work with the DiscordSRV API?
?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!
aha, I think I was wrong, I think me shading a plugin is messing it up, because there it does do some filtering
weird because I am shading that thing for a month now and it worked fine
How can I specify what channel a message needs to go to through DiscordSRV API? I'm guessing I need to set the channel in an event like DiscordGuildMessagePreProcessEvent but the channel names are always final.
I tried but no help so far
But I'm trying to send a message to a discord channel that has the same format as what's configured in discordsrv already
I just wasted 5 hours of my life because I'm stupid -.-
i love it
stupidest reason ever. I ADDED THE WRONG LOCATION
welcome to plugin development
i spent like 3 hours on 1 letter
Daaamn
it took me like 20 min after i had slept
Know the feeling. Did that today lol used 2-3 hours on something i couldn't get working. Slept, got it working in 10-20 min -.-
gamechat is what you are wanting
in regards to events
guildmessage event is messages from the discord side not the mc side
I'm confused. How do I send the message with the right format?
what do you mean?
My chat plugin has multiple channels. Using the built in DiscordSRV send command it only sends to global. I need to somehow send that chat to Discord using DiscordSRV with whatever the user configured for that format.
gamechatevent allows getting the channel and changing the channel
at least that is what I see from the source
and sending with the default format?
idk what you mean by format
Discord bridging plugin for block game https://modrinth.com/plugin/discordsrv - DiscordSRV/GameChatMessagePostProcessEvent.java at master ยท DiscordSRV/DiscordSRV
if discordsrv allows a user to configure a format, then it isn't something you should worry about as that would be something taken care of by discordsrv
DiscordToMinecraftChatMessageFormat: "[<aqua>Discord</aqua> | %toprolecolor%%toprolealias%<reset>] XYZZZ %name%%reply% ยป %message%"
DiscordToMinecraftChatMessageFormatNoRole: "[<aqua>Discord</aqua>] %name%%reply% XYZZZ ยป %message%"```
this is the format defined in messages.yml of DiscordSRV
ok what do you want to do with it?
I need to send messages to Discord like DiscordSRV does by default, just to a specific channel
By default it only sends to global
then change the channel in the event
It says the channel is final
I don't see where it is set as being final
from the code there should be a method for setting/getting
I could only find getting not setting
Discord bridging plugin for block game https://modrinth.com/plugin/discordsrv - DiscordSRV/GameChatMessagePostProcessEvent.java at master ยท DiscordSRV/DiscordSRV
personally I would just use my own api for discord related things
Is there a possible way I can make a non redstone block send out a redstone signal?
Quick question: does anybody know if negative slimesizes still create an upside-down slime in 1.19.3 spigot?
you could try with NMS
IntegerProperty powerProperty = IntegerProperty.create("power", 0, 15);
nmsBlockState.setValue(powerProperty, 15);
can I use that to send a constant redstone signal?
like how a redstone block sends a constant signal
not sure, you gotta try it and probably you need to set it again everytime the blockstate gets updated
Whats the difference between PlayerInteractEntityEvent and PlayerInteractAtEntityEvent?
PlayerInteractAtEntityEvent
Represents an event that is called when a player right clicks an entity that also contains the location where the entity was clicked.
PlayerInteractEntityEvent
Represents an event that is called when a player right clicks an entity.
how can I look for block updates
is there a listener for that?
PlayerInteractAtEntityEvent also goes for armorstands
PlayerInteractAtEntityEvent is a subclass of PlayerInteractEntityEvent
The only distinction is that it contains location
๐ญ๐ญ
How can I get the third(result) slot of a custom anvil inventory? Only "test1" will be output
Inventory inventory = event.getInventory();
if(event.getSlot() == 0) {
player.sendMessage("test1");
}
if(event.getSlot() == 2) {
player.sendMessage("test2");
}
if(event.getRawSlot() == 2) {
player.sendMessage("test3");
}```
Don't compare titles, inventory has a equals and hashcode impl
well event.getSlot() is obviously 0 so ofc it'll never print "test2"
what event even is that?
Not sure why you're bothering with a system like that. It will get removed real quick by leakers
I have a question for you. Why do you think I write in here. To tell me not to do it or to get help?????
You haven't exactly given enough information to help
I have given you enough info
What is the MySQL object? Why would readValue return something, if you're not specifying where it should return from?
String value = null;
if(isConnected()) {
try {
Statement statement = connection.createStatement();
ResultSet result = statement.executeQuery("SELECT value FROM License WHERE server='BetterLobby'");
if(result.next()) {
value = result.getString("value");
} else
result.close();
statement.close();
} catch (SQLException e) {
e.printStackTrace();
}
}
return value;
}```
Commissioned plugin or is that your alt
Yeah but you can check if the event(slot) got left clicked. (just not present in the code I showed you) It still just prints "test1". It's the InventoryClickEvent
show your command method please
Is it possible to make entities like Zombies like a pet, so that it follows and fights for you
?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.
Sorry, but that is fundamental concept
@hazy parrot you don't know how many times I forget about it too ๐ญ
Ngl me too, but you know what it means to init var ๐
Nah, not really, we are here to learn
please use a try with resources and have a method that always returns a valid connection
You have to initialize object, code from kacper was a joke...
.
Hi, I'm trying to use Gson to serialize an itemstack and I have the following code:
Gson gson = new Gson();
String serializedItem = gson.toJson(item.serialize());
plugin.getLogger().warning("Test: " + serializedItem);
But when I run it, I get an error but only when the item has an item meta. I think its because of the way the meta is formatted in item.serialize(), so I tried the following to try to get around it:
Map<String, Object> serializedItem = item.serialize();
serializedItem.remove("meta");
serializedItem.put("meta", item.getItemMeta().serialize());
plugin.getLogger().warning("Test: " + gson.toJson(serializedItem));
And doing this seemed to work, but now the meta is lost when I try to deserialize.
Is anyone able to help out? Thanks
Basically my plugin is not writing data sometimes to the yaml file
configs.getConfig().set(uuid + " istemp", false);
configs.save();``` a little snippet of how I am trying to do this
what error?
Class x is in unnamed module?
Caused by: java.lang.UnsupportedOperationException: Attempted to serialize java.lang.Class: java.lang.String. Forgot to register a type adapter?```
Want me to send the entire trace?
what does item.serialize() return?
ah nvm
is the error at serializedItem.put("meta", item.getItemMeta().serialize());?
Oh yeah I forgot to say that Item is just an ItemStack, its whatever item is in the players main hand at the time
No
there is no error in that part of the code
The error is in the first snippit of code at the gson.toJson()
Quest plug-in
Hey guys, can someone tell me how to make a minecraft server using netty? Is there any info about this somewhere?
I am trying to make a Team and add the player and an entity to it so they can't attack each other. But when I add both of them, they can still attack each other
ScoreboardManager manager = Bukkit.getScoreboardManager();
assert manager != null;
Scoreboard board = manager.getNewScoreboard();
team = board.registerNewTeam(p.getUniqueId().toString());
team.setPrefix(ChatColor.DARK_PURPLE + p.getName());
team.addEntry(p.getUniqueId().toString());
team.setCanSeeFriendlyInvisibles(true);
team.setAllowFriendlyFire(false);
Hi, do you know what is the best free faction plugin
i need one but idk what to choose
Hi, I am currently working on a lobby plugin. I want to make players unable to place, break or interact with blocks in general. I already implemented some code for that in my plugin, but when a player tries to break a block they can break it and then it reappears. Same with placing blocks; it plays the sound of placing the block and the block stays there for like one tick before it disappears. How can I prevent players from starting to break a block and placing a block? I want to make it the same as on hypixel where players are unable to even get the block outline.
Current code which is causing problems:
@EventHandler(ignoreCancelled = true)
public void onBlockBreak(BlockBreakEvent event) {
event.setCancelled(true);
}
@EventHandler(ignoreCancelled = true)
public void onBlockPlace(BlockPlaceEvent event) {
event.setCancelled(true);
}```
You could just set their gamemode to adventure
You are such a genius
Seeing as there's no Citizens 2.0 discord server afaik I'll ask it. Does anyone know if it's possible to make an NPC only visible to a single or group of players?
lmao how did i not think of that ๐ญ
๐most friendly discord server
ok so I am having this problem with my project(a test mod/bot that integrates baritone api 1.19.2) how do i add a dependency for baritone api 1.19.2 as show in the below code and error. PS: can someone rewrite my way of adding the baritone dependencies cause the method i am trying does not work
What does spigot have to do with modding
idk there some really good programming minds here
my problem is not that of modding but adding dependencies
Ask forge I guess tho they aren't the nicest and most competent people
1.9.1.jar and depend of 1.19.3?
they just redirected me to a tutorial on basic java
wait waht
ah depend version not MC
oh nah if you got to the link the dev actually said that the version of briotne is 1.9.2
yes
idk how to write dependencies
i never learnt that
Oh shit
what happened
Yeah that's not how it works
wdym
Look at forge dependency and then baritone
I suggest you to learn gradle basics
gradle ๐
ElgarL
please, can you help me?
I have a running Thread in this discord:
I have 3 tasks (Walk a specified distance, pickup a specific item and kill a specified mob).
In your opinion, what is the best way to keep track of the progress?
Yes you are as you are very likely to get yeeted from that server.
They aren't very keen on helping with such questions.
Regardless, try using compileOnly instead of implementation
Also, have you defined the needed repository for baritone? If not, you must add it
but i need forge dependecnt too
i have not how do i do that
(okay actually now that I looked at it twice the answer is definitely no. Ugh, this will be fun)
We are going to do it the simple way: Do you have that baritone jar put in a subdirectory of your project?
If not, do it
Yes sir
ok this is gonna sound stupid but how do i put the jar into the subdirectory i am using intelij
geol?
Then add compileOnly files("path/to/your.jar") instead of implementation 'com.github.whatever:whatever'
ty
Then just add it in the project itself I guess
I am trying to make a Team and add the player and an entity to it so they can't attack each other. But when I add both of them, they can still attack each other
ScoreboardManager manager = Bukkit.getScoreboardManager();
assert manager != null;
Scoreboard board = manager.getNewScoreboard();
team = board.registerNewTeam(p.getUniqueId().toString());
team.setPrefix(ChatColor.DARK_PURPLE + p.getName());
team.addEntry(p.getUniqueId().toString());
team.setCanSeeFriendlyInvisibles(true);
team.setAllowFriendlyFire(false);
Never used IJ myself
so just go into project structure then
I'll look into it
now what
top left button plus
nnonononononono
what
Xemuain is suggesting a solution that is dangerous and wont work beyond IDE auto-complete
In fact, this window is the wrong one
well the bariotne issue fixed
but
a new pproblem is here
I think i might cry now
If I had to guess you followed Xemuain's suggesting and in that case - you did an error
no i folllowed yours from earlier
baritone fixed
Ah well that works too
remove the comma on the minecraft '[...]' line
either intelij wants to make me suicide
or
there is a problem with the dependiencie
` Task :compileJava FAILED
FAILURE: Build completed with 2 failures.
1: Task failed with an exception.
- What went wrong:
Execution failed for task ':compileJava'.
Changes are not tracked, unable determine incremental changes.
- Try:
Run with --stacktrace option to get the stack trace.
Run with --info or --debug option to get more log output.
Run with --scan to get full insights.
==============================================================================
2: Task failed with an exception.
-
What went wrong:
java.lang.StackOverflowError (no error message) -
Try:
Run with --stacktrace option to get the stack trace.
Run with --info or --debug option to get more log output.
Run with --scan to get full insights.
==============================================================================
- Get more help at https://help.gradle.org
Deprecated Gradle features were used in this build, making it incompatible with Gradle 8.0.
You can use '--warning-mode all' to show the individual deprecation warnings and determine if they come from your own scripts or plugins.
See https://docs.gradle.org/7.5.1/userguide/command_line_interface.html#sec:command_line_warnings
BUILD FAILED in 3s
1 actionable task: 1 executed
`
I just realized that this is the wrong way regardless.
But I am afraid I cannot help beyond that because I have used forgegradle too rarely.
Gradle moment
Since I guess you don't know how to use a terminal I think we are at a dead end
?paste Run ./gradlew.bat build --stacktrace, then post the results in the link below and give the resulting link
I have rarely worked with forge myself, so unfortunately I am of little help here
you are doin great
better position than i was yesterday
Most mainstream modding communities (i.e. forge, fabric, etc.) are cumbersome to work with.
ikr
Windows strikes again.
Do dir
Or ls -l? Idk what the proper command would be
lets try both
Windows doesn't have ls
Just run it - I want to see the contents of the directory
Figured. But this is powershell so maybe it is a bit different?
Wouldn't be surprised if they aliased ls to dir
It has been years since I last touched windows outside of school
Yeah
ls only works on powershell
iik this is wrong but this is the only thing that has not resulted in an error i am so happy
No, without the build [..] part
(like I guessed, you indeed do not know how to use a terminal)
Code
Just dir
so i just rut dir
yep
this will be fun
Yoo
what's the alternative for Player#isOnGround()? it's deprecated:
This value is controlled only by the client and is therefore unreliable and vulnerable to spoofing and/or desync depending on the context/time which it is accessed
What would be the best way of making a plugin that allows you to use spells/powers with a thing in your hotbar. Example:
You have a nether star in your first slot which, when right-clicked, opens up a new hotbar showing all your spells/powers. When you select one using one of your hotbar numbers you can left click to use the spell/power (and it has a cooldown). When you open your inventory with the spell-hotbar opened you have a custom inventory showing all the spells/powers you own, and you can drag them to your hotbar and move em around
The spells would be something like "Push" (Push the target you're looking at away), and choke (Choke the target you're looking at).
I want it to be easy to add new custom spells/powers to the plugin without having to change the entire plugin.
Check if the player isn't falling :/
Could you post the contents of gradle/wrapper/gradle-wrapper.properties? If that file exists of course.
this is fun wth you
ah ig could be sufficient
Yeah checking the vertical movement and the block below the player should suffice
distributionUrl=https\://services.gradle.org/distributions/gradle-7.5.1-bin.zip
not much more?
Regardless, that is all I wanted.
alr doofinshmertz evil inconperated
no laughs?
guess i am the only one
I need to hunt down a gradle 7.5 gradle wrapper file. That will take a while so bear with me
sleep is for the weak
@quaint mantle Copy https://github.com/FabricMC/fabric-example-mod/blob/bc4ffe06d1f1c0b420d7350664f79a83718616ae/gradlew.bat into your project.
i am 15
Ikr, who even sleeps?
where
as gradlew.bat
You need to create a new file
(thankfully we don't need to chmod it - at least I hope so)
so i create a file called gradlew.bat and just past that in
Yep
past*
*paste
Next to the build.gradle file
Run ./gradlew.bat build --stacktrace again
bashes head against table
@tardy delta What is the windows requivalent of curl or wget?
Also does > work on windows?
either he is playin Minecraft for 22 hours or he is running his bot
windows has curl ig
Yes
curl works on windows
POG
never used it tho, im used to wget
my suffering is comming to an end
@quaint mantle Run rm gradlew.bat && curl https://github.com/FabricMC/fabric-example-mod/blob/bc4ffe06d1f1c0b420d7350664f79a83718616ae/gradlew.bat > gradlew.bat
No it doesn't
in gradlew.bat right
You can always use a real shell
and turns out powershell has wget
No, in terminal
Since it appears that you are too dumb to paste a file I gave to you
How can I check if someone right clicked a specific item (with a custommodeldata) in their hotbar?
PlayerInteractEvent or InventoryInteractEvent?
lol
windows 11 moment
Well I guess then run:
rm gradlew.bat
Then run
curl https://github.com/FabricMC/fabric-example-mod/blob/bc4ffe06d1f1c0b420d7350664f79a83718616ae/gradlew.bat > gradlew.bat
rm doesnt work on windows hehe
oh no
only powershell ๐
fuck
del
microsoft wants us to use powershell and i understand
Fucking ms-dos not supporting unix commands.
Is there any easy way to utilise bukkit to identify a world folder?
uh what
If I recall correctly it is hard to do
?jd-s
Yeah i figured :S
My friends who never used Linux outside school know Linux commands better than cmd or powershell
And they often mistake them
Crazy
entity location seems to be their feet location, is there a way to get their head location
did it and no error
.add(0, 1, 0)
no?
God i love the simple fixes :L
entities are not all 1 block tall
or move up 2 blocks
bruh
Then you can run .gradlew.bat build --stacktrace ... hopefully
can i force give java and bedrock players rank?
Like Java players get rank called java and bedrock players get rank called Bedrock
bedrock players cannot join java servers?
(everybody brace for wall of text)
Yeah you probably use geyser right @oak lark
i'm pretty sure that bedrock and java players' uuid look different
man this channel is a joke
you can just check for their uuid and see if they're bedrock/java
๐ฅน
Or use some API geyser provides @icy beacon
maybe that too
I'd guess you have to use https://hub.spigotmc.org/javadocs/spigot/org/bukkit/generator/WorldInfo.html#getName() as a directory name and use that as the relative path to the world directory
Ya but can't devide ranks between them
not 100% sure though
i know nothing about geyser
Players on geyser also have different names
why not
Misunderstood the question, have you tried a nested if statement? ๐ xD
Those on bedrock start with a dot
๐ฅน indeed
Idk i didn't found any options to do that
I'm throwing a tantrum
just give an according rank depending on whether the player is java or bedrock
what "option" are you seeking
only gradlew.bat works no . or / or /.
Lol
should i dir again
die*, and yes
Best one ive seen all week was "guys why isnt knockback resistance workin on this config" and you could see clear as day they had spelt it nockbackresistance xD
well if only gradlew.bat works it is okay - what does it output?
an error