#help-development
1 messages · Page 1550 of 1
can i get the item stack of an arrow from a projectile launch event
I'd like to only get it from a Child of keys. So all keys after
Player.Homes
all depends how you have it stored
getConfigurationSection("Player.Homes").getKeys(false)
Thank you that should work!
I'm confused on what you're trying to do, to be completely honest
yes
though that's a super confusing question
So, I am trying to hide the auto tab complete page but am apparently doing something wrong. This is what I have and I am not sure what is wrong. I know the event is registered because I tried another event and it worked.
Not spigot then
Hmm?
Yea, I know but the debug message didn't go through
I think there's a command pre-autocomplete event
I've never used that event but I'm certain command updates are only sent when the update is called or permissions are changed
In any case, I think you'll need to use protocollib or nms
Yeah, I saw that but then I saw this on the docs
the command map is sent on player login and when update is called
That method is only when they make a selection
Yeah, ik it was the method I tried to make sure the event handler was registering
Are you expecting a list of commands to be sent every time the player opens a command prompt?
isn't there another event?
fuck you discord
Basically
Thats not how it works
wont auto read channels i go to :(
Wdym?
The command map is sent when a player joins the server or a manual update is called.
otherwise no update is needed so no event
The client already has a populated command map when they open the command prompt. It needs no event
Press 'Esc', or go to the bottom of the channel
yeah
If you want to block commands you have to use the other event, but that only fires when teh initial map is sent. and that could be when the player logs in
u sure the command map just get sent when the player joins? im pretty sure if you edit the command map when players are on im sure it does actually update for everyone
guyz one thing is driving me crazy is that i need admin perms to drag and drop a new version of my plugin into the server plugin folder
and after i authorizr admin perm
Yes, there are specific times it can be sent. On join, when a command is changed or an update is called. but its not when he's expecting, when the player opens a tab complete
it said access deny
for blocking commands couldnt use just use onCommand?
Not what he's trying to do
but i am admin of the computer
whats is he trying to do
so why it doesnt allow me to copy and paste the plugin
I'm trying to hide the default commands
i thought TabCompleteEvent fires when someone presses tab?
thats only for args
How can I get all the Advancements a player has obtained?
Stop your server before replacing the jar
declaration: package: org.bukkit.advancement, interface: AdvancementProgress
get admin perms
@eternal oxide you dont need to do that before
I got admin perms
but it just say access deny
Yes your jar is in use
I mean yeah, but how can I get all of a player's AdvancementProgresses
it doesnt say that if you copy and paste
:)
just copy and paste easy fix
without me needing to STOPPING the server every time i compile
you need to restart the server anyways to refresh the plugin
i gotten used it
i used copy paste
just stop the server and add the plugin
ctrl c ctrl v?
I AM USING COPY PASTE
but it said i need admin perm
it should prompt a replacement
Pretty sure you would just use
then your fucked your pc some how
You are misreading my question
I want to get all the Advancements a player has completed
Then getAwardedCriteria()?
I don't want to have to iterate through all the advancements and test to see if it isDone
Sidestepping that, how can I reset the advancement progress
Not sure what's the best channel for this but I found another mobcap issue https://hub.spigotmc.org/jira/browse/SPIGOT-6618
This is somewhat related to another issue of mine https://hub.spigotmc.org/jira/browse/SPIGOT-6278
Basically, fish and axolotls don't get their persistenceRequired set to true after bucketing so they always count to mob cap, and piglins still have isTypeNotPersistent return !this.isPersistent() instead of true so piglins always count to mob cap
or maybe
declaration: package: org.bukkit.event.player, class: PlayerAdvancementDoneEvent
Only solution seems to be to iterate through AdvacementProgresss
You use https://hub.spigotmc.org/javadocs/spigot/org/bukkit/Bukkit.html#advancementIterator() to iterate over all Advancements, then check its state using https://hub.spigotmc.org/javadocs/spigot/org/bukkit/entity/Player.html#getAdvancementProgress(org.bukkit.advancement.Advancement)
yeah im doing that
It wouldn't be that bad on performance
It would also probably have to do it internally anyway
Its an iterator so you could probably run it Async reasonably safely
Can't run async, need to block, its a long story with jank code
Should just rewrite it
Plus yeah it prob wont be that bad
If you are making changes then yes sync, if only reading then Async is fine
Well then blocking should be fine since I do need to write changes
Iterator<Advancement> advancementIterator = this.plugin.getServer().advancementIterator(); // Bad, but this is the only way to do this.
while (advancementIterator.hasNext()) {
Advancement advancementToCheck = advancementIterator.next();
AdvancementProgress advancementProgress = player.getAdvancementProgress(advancementToCheck);
for (String criteria : advancementProgress.getAwardedCriteria()) {
advancementProgress.revokeCriteria(criteria);
}
}```
¯_(ツ)_/¯
You basically want to reset all advancements?
Effectively, yes.
Bukkit.getServer().advancementIterator()?
wouldnt that be the same as this.plugin.getServer().advancementIterator()
yes
and it is
i'm just doing the latter for consistency's sake, and i prefer it that way
both return functionally identical objects
do you even need advancementToCheck ?
How can I have a delay before doing a function?
Nah I could make it a oneliner
also for the for loop if u wanted you could remove the {} since its a the end of the while loop and its one line
but you can keep it i mean its kinda nicer to keep it
i want my code to retain some readability so nah
k
omggg ctrl shift t is a life saver
i accidently closed a tab i didnt want to close
lol
<?php include 'something.php'; ?>``` didnt know this would work lol
since i thought it wouldnt work one line
lol
whitespace is irrelevant in most scripting languages
lol so the space kinda acts like a newline/seperator apparently if you put it in one line cuz if you remove the space between <?php and include it will error
<?php include'something.php';?>
``` <-- cursed
Hey my illagers sometimes spawn as captain when i summon them with my plugin, i can't find online how to guaranteed not make them captains does anyone know?
read the docs :)
declaration: package: org.bukkit.entity, interface: Raider
Illagers extend that Raider class so you can use it on a Illager object
im pretty sure it is that
Ive looked there and used both set methods to false but some were still spawning as patrol/raid captains (or at least with a banner)
¯_(ツ)_/¯
I might just listen to the entitypotionevent thing and check if its caused by a captain and then cancel it
Oh well
Just dont want them to give bad omen (custom raid so omen is gonna mess it up)
🎊
Are you using a broken permission plugin?
I had an idea of doing that before
removing a permission shoudl remove teh command from tab complete
not all permission plugins do this
GroupManager does
yeah if the developer decides to use plugin.yml permissions but some just use their own permission checking
I don't have a perms plugin installed on it rn because it's just my code testing server
oh I thought u were doing tab complete checking 😂
what if you had essentials:creative i believe essentials.creative isnt the permission for it? unless it is
Use a decent perms plugin and all your code is redundant
they're trying to prevent command completion
I'll try adding a perms plugin but I don't think it will change anything. All the other commands were hidden properly
It's just been the default Minecraft/Spigot/Bukkit commands that are being difficuilt
If the player doesn;t have the command permission pushed to Bukkit calling a Player#updateCommands() will remove it from teh command map thats sent to the layer
It does for plugins but I don't think it does that with the built in server commands
even luck perms does this elgar 😂, if you don't have permission for /plugins the tab completion will still show
at least when i did it
🤷
It doesn;t I tested this exact thing with /plugins only yesterday
wtf
I'll try it one sec
ig my install is fucked lemme update
whats a good font?
- -bukkit.command.plugins removes plugins from tab complete using GroupManager
its a default permission setting in GM
Ugh, okay. One sec
cast what to itemStack
i cant cast the .getEntity to an itemStack
It somewhat worked
somewhat?
have you tried negating their perms?
i dont think bukkit.* or minecraft.* works
the bukkit one did
yeah
um, sec. It seemed to work here
nope, my mistake
Yeah, he's trying to remove from tab complete
no you can remove perm minecraft.command.help or whatever?
tab complete is updated via permissions for all commands EXCEPT base MC commands
Nice
yes, you can remove teh permission, but tabcomplete still shows that command (MC only)
ik
I’m sure we’ll survive with them in tab complete
ye
is it possible for me to stop snowballs from being thrown if i right click snowballs at a specific block
like obsidian
Yes
you check if a player rightclicked a block
and if they did check if the block is the block you dont want snowballs being able to be thrown at
then check if they are holding a snowball
if so cancel the event
i think PlayerInteractEvent is what you need
You’d be better off not checking the trajectory of the snowball and cancelling the throw event and instead just cancelling the projectile hit event on the specific block
well i did cancel the playerinteract
but the snowball is still getting thrown :/
Try cancelling the projectile launch event
declaration: package: org.bukkit.event.entity, class: ProjectileLaunchEvent
idk then try disciples idea
problem is
i cant see if the player is aiming at a block
in that event
i have a idea
but it might be a bit weird
so i make a boolean
aimAtBlock
and i set the booleans to true through playerInteract
and if it is true
then i cancel the projectileLaunch
I'd use a method
hi, im trying to change type of every mob that spawns to creeper, the problem is EntitySpawnEvent (and CreatureSpawnEvent) events are not fired for some mobs
@EventHandler(priority = EventPriority.HIGHEST)
public void onEntitySpawn(org.bukkit.event.entity.EntitySpawnEvent e) {
if (plugin.isActive()) {
if (e.getEntityType() != EntityType.CREEPER) {
if (!ignoredEntityTypes.contains(e.getEntityType()) && e.getEntity() instanceof LivingEntity) {
e.getEntity().getWorld().spawnEntity(e.getLocation(), EntityType.CREEPER);
Bukkit.getLogger().info(e.getEntityType().toString());
e.getEntity().remove();
}
}
}
}
this is my event handler
as i said, not all mobs are changed to creeper,
i can still see sheeps, pigs, cow (mostly passive mobs)
am i a genious or something :>
Something like:
public void onProjectileLaunchEvent(ProjectileLaunchEvent event, Material block)
etc...
okay
I'm not positive if you'd pass it as material tho, it might be something else
Its something like that though
btw how do i get the item stack of a fired arrow
i cant convert the projectile from ProjectileLaunch to a itemStack
I thought you were firing a snowball?
Don’t cancel the event
i also fire arrows
Iirc it’s event.setUseItemInHand
wait which event
are you talking about
The interact event is special and has two things you can cancel
Actually it looks like setCancelled just cancels both
So it should work
e.setUseItemInHand(Event.Result.DENY);
yea no
it didn't work
anyways
i fixed that issue
btw how do i get the item stack of a fired arrow
[10:41 PM]
i cant convert the projectile from ProjectileLaunch to a itemStack
theres a EntityShootBow event
but i dont think the .getConsume method gives you the consumes arrow
it gives you that?
- why aren't you just importing the event at the top
- why are you checking if the plugin is active? that's redundant
What else would it give you
hmm if it does give you the arrow
then i messed up somehwere
I said I made it based, so it is similar. And if you are noticing this kind of stuff, you will surely be able to make your own.
import is because of a mistake, i have a class with same name so i cant import event
i have a isactive boolean in main class, and i am checking for that
isactive boolean is true by default, so there is no problem about that
You do know you can still import it
yes but if the plugin is active it'd work anyways, and if it weren't it wouldn't work
and you should probably refactor the class
:this:
Unless you have a class with the same name in the same package as the bukkit one which you don’t
oh i see
it worked
i got the itemStack
but how am i gonna track the arrow now
What
i can completely delete that line, that line doesnt effect the code, its always true
i cant get an instance of the arrow as a projectile
What are you trying to do
no its in my own package
so when arrows with custom model data gets shot and picked up
they lose the data
so im trying to track the arrow with custom model data
it's still redundant 🤷♂️
they lose the data
i pick up a noral arrow
normal*
can you get teh data you are missing from teh AbstractArrow?
is there a way to convert itemstack to entity?
its still an Entity there
You really need to learn to use the javadocs
and the event has getItem so you can see the itemStack
true
getConsumed*
out of interest, what ide do you use?
waht?
shhh
i use Intellij
im having like 4 convos at the same time
ohh rip
anyways, doesn't it give you autocompletes?
it does
because you can usually just scroll through those to see if it does what you want
you're fine haha
Iirc it won’t unless you use it again
I’m not sure there is a way to break an item other than setting it to null and playing the break item entity effect
that might be true
but the item's like
durability bar
didnt chage
le deprecated method
change*
that means you shouldn't fucking use it
i remember removing an item from the player inv is possible with in-game cmds
:/
Use the replacement
what are you trying to do
Which the javadoc should tell you
if you want to break the item then set the inventory slot to null...
cool
And play the break effect if you want that
i did exactly that
[14:27:53 INFO]: [GameManager] Disabling Game v0.0.10
[14:27:53 INFO]: [GameManager] Enabling Game v0.0.10
[14:27:53 WARN]: Enabled plugin with unregistered PluginClassLoader Game v0.0.10
How do I fix this
the hell you doin in the onDisable bro
what
Probably storing your plug-in instance in a static var 🤮
I just use the same
public void reloadGameManager(CommandSender sender)
{
PluginManager pluginManager = Bukkit.getPluginManager();
Plugin plugin = pluginManager.getPlugin("Game");
if(pluginManager.isPluginEnabled("Game"))
{
pluginManager.disablePlugin(plugin);
}
pluginManager.enablePlugin(plugin);
}
Umm why
what....
Why as in?
That whole function
You can reload your plug-in without literally reloading it
No Im not trying to reload the config
Im reloading the jar
Because I'm developing the plugin being reloaded aswell .-.
Show us your main class
Sure
Don’t reload plugins like that
It's pretty big and it worked fine when I reload with ServerUtils
Restart the server, use plugman, or use /reload
Just wanna see your onenable and ondisable
Plugins shouldn’t be reloaded on a live server
Why not
Because it breaks things
am I suppose to restart the server every time I make a single line of code of change?
Have fun breaking more things then
Breaking what
the plugin that's designed to work with reloads?
It's just a warn
not an error
Get an instance of your main class and then disable/enable the plugin using PluginManager
it works fine
There might be a reload method, I'm not sure
Does doing that even reload the contents of the jar
That's what I was thinking
[23:36:50] [Server thread/ERROR]: Tried to load unrecognized recipe: bukkit:122a26e0-0351-4025-a8ed-5eb34c1c9779 removed now.
[23:36:50] [Server thread/ERROR]: Tried to load unrecognized recipe: bukkit:3732c498-6089-4a9e-885b-d3dd9ee4bb44 removed now.
[23:36:50] [Server thread/ERROR]: Tried to load unrecognized recipe: bukkit:122a26e0-0351-4025-a8ed-5eb34c1c9779 removed now.```
wut is this
It should?
Last I checked plugman had to do a bit of hackery to release the lock on the jar
Ah, it may but I figured it just called onDisable();
But I was just going based off the log
absolutely just use plugman reload
Oh. That looks fun.
It's not even that big wdym
132 lines
Most are error messages
Why would you use plugman to reload a plugin with its own reload command?
It doesn't have one; he's trying to create one
why would you have a reload command that disables and enables the plugin within the plugin itself
🤦 /essentials reload
Testing purposes
I know xD it was just an example of the Plugman reload command
no.. just use something like plugman for that
He doesn't want to download it for some reason
use PlugWoman then, can vouch™️
*Plugperson
PlugApachiHelicopter
Oh wait, apparently that is a real plugin. I thought that was a joke
ManPlug
nah it is a real one xd
no joke
is it possible to make custom enchants appear in enchantment tables?
not with the hover, but you can modify the end result
https://github.com/Geolykt/EnchantmentsPlus i would take a look at how this one does it
thanks
same way that server-side enchantments don't show on items, they won't show in the table
And what about combining efficiency 5 in the anvil to get 6?
l1 == l2 ? l1+1 : Math.max(l1, l2)
Do they just not appear in the table, or they just don’t visually show since they lack a localization
the latter
Ah
custom enchantments show the glow but no text
So you gotta use lore
I’m surprised it doesn’t show minecraft.enchantment.name.4 or something
we were talking about the display for the client
What's the difference between using Player#hasPermission & vault's Permission#has/Permission#playerHas?
Is there any reason to use vault's over Player#hasPermission?
So there's no real reason to use vault for permissions checking in this case?
no
ty
plugins like luck perks directly inject code into the Player class and override the behaviour of the hasPermission method to make sure it works
luck perms*
It’s stuck
In a wood chipper
i’m sorry to hear that
I can’t get it out
anyways i am mmaking a plugiin to ban noobs form my server
can someone give me workign code that do this
ok
get my dick out of the wood chipper and you will give me the codes to make it work
good deal
Code: Bukkit.getBanlist(Type.NAME).addBan("CreeperCry04", "idiot", null, null);
?
UUID!!
Lmao, it's a joke lol
asshol
mods ban
he use d inapropriatee lanGuage
Do you think you are funny?
elllo
Do you think I asked
🤣 🤣 🤣
What a sussy impostor
No, I am asking? lmao
Time is almost 4:20 so I suppose it’s almost time to give birth
wish them happy birthday
well it’s not like they’ll be alive for their next birthday
or tomorrow for that matter
oh my god ITS HAPPENING
okay the weirdness has somewhat left me
Aïe 🤐
mans sleeping
the heck did I miss
leave him be
That's exactly what I want to do, but as I said, I don't know how to start ><
I mean an easy way is to skip verifying an inventory is that inventory via names and use custom inventory classes
First, just implement the same way as in the video and then tweak it how you think it's good
Mh okay, let's see
ill show u my inventory template rq
public class InventoryThingy implements InventoryHolder {
private final Inventory inventory;
private final somepluginname plugin;
public InventoryThingy(somepluginname plugin) {
this.inventory = Bukkit.createInventory(null, 9, "title or whatever");
this.plugin = plugin;
}
@Override
public Inventory getInventory() {
return this.inventory;
}
}```
then u can check if the opened inventory is an instance of that class
something like this
if (!(event.getInventory().getHolder() instanceof InventoryThingy)) {
return;
}```
So I don't have to check things like inventory's name etc 😱
Insane, ty 😱😱
also you don't even need the plugin variable, it's just part of my template
good night
Ty, good night too
how would i disable crafting in the 2x2?
its morning here 😂
you can check inventory apis for further
for example portlek's smartinv
https://github.com/portlek/SmartInventory
@EventHandler
public void onInventoryClick(InventoryClickEvent event) { // disables crafting in the inventory 2x2
if (event.getInventory().getType().equals(InventoryType.CRAFTING)) {
event.setCancelled(true);
}
}```
this completely disables clicking in the inventory
dont use equals when comparing enums
o okay
use == instead
and are u sure that // disables crafting in the inventory 2x2 ?
probably will disable 3x3 too
oh sorry
all g
i hate namings in spigot/bukkit/minecraft
nah that disables the inventory too
gonna just figure INVENTORY and CRAFTING are both always opened together
lmao 😂
so i'd have to check for raw slots
maybe prevent items from being put into the crafting inventory idk
now I'm go bed now for real
go and sleep, its morning here
i can handle this guys 😂
11 am here, u are at gmt-5 xD
gotta be a way to modify the output of the 2x2
on this server, placing a leather chestpiece and a dye in the 2x2 makes the output (of a white chestplate) appear for a second, then quickly disappears
i'm just not sure if it's possible w the spigot api
just prevent users from opening their inventory
yea ok
😂 no dont do that
InventoryOpenEvent is not triggered when a players inventory is opened sadly
so you'd have to spam open them a new inventory every tick and close it one tick later to bypass any inventory from being opened
just try to check top inventory's size. Dont sure will it work
I mean unless they interact with the inventory nothing will happen which fucking sucks balls
I hate client sided things
ok ok for real sleep
idk how this would manipulate the output of the 2x2
think ur on the wrong page
but night
e.setcancelled() if the size is 4/
?
I was mainly joking
couldn't tell lmao
sorry
is coo sleep well
yes.
is there a way to modify all recipes dealing with dye
the only issue is being able to dye armor in the 2x2
this does actually work, and produce an output of 5 for the size
which made me realize
instead of event.getInventory() i should've been using e.getClickedInventory() which solved all my issues
lmao thanks
😂
so, just use
yes i was talking about "top inventroy"
theres getTopInventory and getBottomInventory methods
nah because top inventory is always CRAFTING when the inventory is open
.
then, theres no problem with it?
you gonna just check size
CRAFTING or anything doesn't matter
my issue's already solved:
@EventHandler
public void onInventoryClick(InventoryClickEvent e) { // disables crafting in the inventory 2x2
if (e.getClickedInventory().getType() == InventoryType.CRAFTING) {
e.setCancelled(true);
}
}
🤷♂️ oki
What's the best way to get rid of the first item in a String[]? In python you'd use splicing: arr[1:], In Java I'm using Arrays.stream(arr).skip(1).toList(), although it seems there's probably a better way..
I know this isnt spigot but does anyone know how I can add string nbt data in 1.16 nms
?pdc
awesome
the problem is, that uses spigot and I need to use nms
why?
That seems like a terrible idea
copyOfRange is Java 9+
nice, yeah I'm doing 1.17 anyway so that's great
Java.util.Arrays.copyOfRange() Method - The java.util.Arrays.copyOfRange(short[] original, int from, int to) method copies the specified range of the specified array into a new array.The final index o
k
basicly, my codebase is in 1.8 spigot (please dont shout at me, I just dont want to have to completely recode everything in newest version) but I want to add 1.16 support. So I need import packages that are version specific
does TagAPI support back to 1.8?
👍 Arrays.copyOfRange(arr, 1, arr.length-1)
Ok, I'll have a look, thanks
does this change the attack speed value directly? or just the same as spigot attribute modify?
What I mean is the green value that states item's default value instead of the blue/red (in negative) value that is modified
Nbts very simple. Make it into an nms stack. Create your tag if not, set the tag. Add your values to the nbt. Turn it back into a Bukkit whatever then reapply it in the case of an item set the slot again with the new item
hi, how can I get the health of an entity who has damaged by something (I've early created the EntityDamageByEntityEvent event but I didn't found a way to get health of the entity)
(and It can by all sort of entity)
no it didn't exist
Well here’s the thing, items don’t have health
They are entities too
You need to specify which entities
so how I know if this entity is a damageable so
I guess if they’re damaged in that event but you need to cast it to it’s type and grab the health that way
thx I will test that
Should work
if (e.getEntity() instanceOf LivingEntity)
LivingEntity l = (LivingEntity) e.getEntity();
its in discord so i keep it simple XD
there are exceptions
if I one-shot the zombie it don't work
Cuz they’re dead
cuz the zombie is dead
Entity or Event are common ones
Lol
Yeah, but even those
yes I need to know when the zombie death by another entity
Just ble
As long as you don't additionally use the var type, there is nothing to be afraid of
Entity death event
so I used an ! but it don't activate it
The issue only becomes noticeable in megamoths
I can't get the last damager
get its health and test if subtracting the finalDamage will kill it
var entity > LivingEntity entity
I've never used that
And recommend for everyone else
I mean it’s a Lombok or kotlin thing
wait the health of a dead entity should be 0 or negative, isnt it?XD
in damage event its not
<= 0
nah, var is jls since j10
What is jls?
java language specification
Ah
Yea Lombok had it much earlier same with kotlin
Does anyone here use Kotlin?
likely
I personally hate the syntax
so u want to get the damager when the entity is dead?
It's so unfriendly
The name before type, ble
Can do cooler things too 🙂
yes
Such as?
? You don’t have to specifics a type everytime
Extensions
Not file class specific
Syntax is not really a priority, the bigger question is whether it is actually useable - I've seen quite a lot of languages where the compiler segfaults or where the compiler is hard to obtain in the first place
The only interesting thing I see is the null safety
Extensions are very cool
to be exact, before, at, after dead?
What's that?
I just want to get the last damager who killed the entity
i see...
I think you can use the entity damage by entity event?
how about getDamager in EntityDamageByEntityEvent
You can call extensions off any type. fun Int.add(): Int { return this += 5 } just a simple example
and cal the damage they will deal on the entity
You need to check whether the entity would be dead before that though
what are you trying?
do the math yourself
i mean, if ( living.getHealth - damage <= 0)
return e.getDamager();
it needs to be final damage
And the < operator, not the <=; an entity is still alive with 0.0 health iirc
e.getFinalDamage() then
I didn't work so I will try this
And it’s just simpler more verbose
Now I'm sleeping and waiting for a kiss from prince charming before I wake up
oh
guys, is it possible to simulate knockback enchant? or can I set knockback is conflict to some itemstack (custom item)?
i know if i gonna simulate knockback, i will need velocity
it's just a bit of vector maths
I would have to take a look on that, since I don't understand that from your code snippet
Extensions iirc are whack
Whack in java
I do not like the idea
How so?
It is interesting, but someone will abuse the hell out of it
but the point is when i use entity.getLocation().getDirection().mulitply(-1)
the knockback direction is depends on the entity instead of damager
it work thx!
welcome 😊
there are other methods you can invoke for vector maths, such as #add
That’s why you only use it at the right times
I just looked that up and it seems wiered to me
umm im bad at vector ;-;
gonna take some time to study
So am I, so I cannot really help you
Yea, but I already imagine use cases
Such as?
I understand the basics of it, but not how you can use them to get the thing you want to be done
If I understand it correctly, you cold for example add a function to the Player interface. For example something like removing them fro tab?
Sure Player.Anything
But now I don't know if it would be possible with an interface
Ofc it is
Are , you able to acces private fields of the extended class?
I do not think so
Unless kotlin has class transforming abilities - but I highly doubt it
Ik bcs I've done it in legacy versions. The issue is, what class do I use for a string value. The method takes an interface called NBTBase
Yeah, but you are making a function for that class, right?
Extension function off that type yes
So it would make sense to be able to access it's private fields?
No
Why would that make sense?
It’s not going into player literally and adding that function
I think the compiler just compiles it down to add(Int var1, Int var2) in an arbitrary class instead of a method add(Int var2) in the class Int
It’s just allowing you to call it off that object
Basically - it does not do code weaving
Of that particular instance only?
Yes particular instance of that type you use
What’s the topic?
kotlin extensions
Oh pog, doesn’t something like that exists in lombok also btw
Why does lombok have everything that kotlin has and vice versa?
lmao
Lol I wouldn’t even compare there extensions
Kotlin doesent really use getters and setters
Tbh very different in that sense
Yeah I mean not as methods/functions
Is it possible to manipulate the world name in the F3 debug menu?
event.setJoinMessage(plugin.getConfig().getString(event.getPlayer() + "PlayerJoinEvent"));
this doesn't work
, how will I pull the players name
event.setJoinMessage(plugin.getConfig().getString("PlayerJoinEvent"));
does work btw
event.getPlayer().getName()?
makes sense
event.getPlayer() + "PlayerJoinEvent" is basically event.getPlayer().toString() + "PlayerJoinEvent" at the bytecode layer
the implementation of the #toString method in the CraftPlayer class is not the player name method however, which can result in issues
so essentially, what do I put in here
for a string
in legacy versions you did this
Uh is that craftbukkit classes or your own stuff?
Thats craftbukkit
Didn’t know craftbukkit had nbt classes
Ah fair
I think you can call NBTTagCompound#setString
no?
Else try just pass a normal string, and btw have you looked at the implementation of the method?
where can I find that
CTRL + Left click the method
Cheers
anyone know stuff about luckperms wait
waits
waits some more
I tried to follow the example given by https://www.spigotmc.org/threads/override-base-item-attribute-value.236434/#post-2387235
but it doesn't work
the attack speed is gone in NBT tag
and the attack speed is still 4 (default value
Ever used spigot api?
yeah I tried but the value is like -2.8 attack speed
You do know that spigot api provides a fully working api for attributes tho
weight
i mean yeah the value it does is correct
Luckperms api? @delicate fractal
also i have a problem with homes
Tang_n I am just telling you to use the api instead of miserably damn nms
wdym
you can't modify base attributes
i have tried
they're hardcoded into the game iirc
so not even nbt api right?
Like are you coding this or what’s the deal?
oh
i see.. so i cant deal with the negative sign except i hide the attribute
anyone know how to stop Giant head spining around when it's spawn?
Bukkit.shutdown()
The answer to all problems
what's the best way to get an items name, so like if you use ItemStack#getType and it's andesite, it'll return stone, so how do i make it return andesite instead? (this must work will all types of stone, wood and everything)
String obtainedData = plugin.config.getConfig().getString(useCustomWorld + "respawn-world");
if(obtainedData.isEmpty()){
respawnWorld = deathWorld;
}
in config i have respawn-world: ''
but it says isEmpty may return null...
do i need to add assert as it says in quick action
no, and an assert won't help
isEmpty doesn't return null, the warning doesn't say it may return null, it says something else
String name = itemMeta.getLocalizedName();
if u talking about the item instead of the name, ItemStack#getType() actually returns Material.ANDESITE (if it's andesite)
btw getDisplayName(); also works
thank you so much, that's exactly what i needed! 😄
😊
Check javadocs next time, it will help you through many questions
Is there a way to load my economy plugin before any other one?
Like a vault implementation?
I mean you could use onLoad but it should mostly be used for super early internal plugin loading
why do you want to load early?
There is something like load-before in plugin.yml
Though listing every existing economy plugin would be a tedious process and arguably impossible to a degree
Yea
Some shop plugin disables itself before letting economy provider to load
then fix the shop plugin. its coded badly
Axilirate hmm you could load before vault?
then don't use a buggy plugin or let the author know so he can fix it
Load before vault and provide your Economy implementation
Use what Tomasan said to load before vault then just in onEnable
getServer().getServicesManager().register(Economy.class, new EcoImpl(),this,ServicePriority.High);
I'll probably switch the plugin, found an alternative free one
Bruh
But even so, the solution I told ya works perfectly fine
whats funny is that I see a lot of bots giving 1 stars to the free and saying they should get the premium one
It would provide compatibility for any vault economy dependent plugin
i'll do this if I will encounter this again, thanks.
What doesn’t work
Since the event is called twice, once where the anvil is started and where it lands and at the end I need the result so that I can sort it out again. But what is the best solution
what
Hello. How can I connect nms 1.17 to maven?
it is in the spigot jar you build with buildtools
artifactId is spigot for spigot's dependency
I has this error (screenshot -> https://skr.sh/s8r3b1knfgQ)
hi can we get location of respawn anchor? or tp to it...as i am creating random spawn after death
guys im extremely confused, im not even sure if im in the rigth channel, im working with multiverse on an aternos server, and im having an issue since i have 2 worlds, and smp world and spawn, but when i create a nether portal on the smp, and i go to the nether everything is fine, but if i try to go back to my home base, i go back to spawn.
doing this :
if (ApiUtil.isAvailable(PlayerRespawnEvent.class, "isAnchorSpawn") && event.isAnchorSpawn()) {
Location anchorLocation = event.getRespawnLocation();
event.setRespawnLocation(anchorLocation);
return;
}
or just return will tp me to 0 y 0
no, you are not in the right channel
this channel is for development and programming
oh, im sorry, where should i go?
in the other help channel
their discord server
so can you help me with this 0 y 0 respawn anchor error
probably not
im not sure about this, may want to change a directory to build, or see https://www.spigotmc.org/wiki/buildtools/#wikiPage if any of the issues applies to you
even if i left it default and do nothing it goes to 0 y 0.
?jd
is the way you make items for 1.16 the same as 1.8???/
How can i remove this from the item?
Probably some flags
How do I separate the Ender Pearl Damage from Fall damage?
I have successfully made a "spigot-1.17.jar" file and imported it into intellij idea. But I can't add it to pom.xml. What am I doing wrong? (screenshot -> https://skr.sh/s8rxaTTJBv0)
it seems correct, try adding a repo instead:
<repository>
<id>spigot-repo</id>
<url>https://hub.spigotmc.org/nexus/content/repositories/snapshots/</url>
</repository>
(Opinion Question)
What item do you guys think represents form?
what
i was thinking clay
form? form is a very vague word
like the form a spell comes in
What's the best and easiest way to store locations locally? It'll be a per player thing also.
thx
i guess pdc
PersistentDataContainer?
?pdc
u know the /data command in mc
If you were to reboot the server would it stay and can you re-load it?
yep
I've not actually touched /data before ngl.
ok, it just stores info on the player
just do /data get entity @s in game and u will see
my gosh it has a lot of data
If you were to reboot the server would it stay and can you re-load it?
yes, that is what persistent means
ok, my bad didn't realise
I wont help for one plugin!
What's the best way to get the player's facing direction? https://hub.spigotmc.org/javadocs/spigot/org/bukkit/Location.html Has a get direction method which returns a vector, can you get the horizontal looking compass direction?
declaration: package: org.bukkit, class: Location
Do you need to get the angle and then figure it out, if so, which method do you use?
you can just get yaw
oh nice
Afaik you have to work it out manually
thanks
yeah you could do yaw and use a basic system to use a util
yup got it
apparently, the yaw returned ranges from -360 to 360
well for some reason this doesnt give me the distance travelled by boat but something that is 50x higher
meta.setDisplayName((p.getStatistic(Statistic.BOAT_ONE_CM) / 100) + " blocks travelled with boat");
divide by 50 then
Will this break the boat when stepping out of it?
@EventHandler
public void onVehicleExit(VehicleExitEvent event) {
if (!(event.getVehicle() instanceof Boat)) {
return;
}
event.getVehicle().remove();
}
I would say that the boat just plops out of existence
no, it will remove it
the player probably hasn't exited the boat yet by the time that fires
but that should be fine, probably
Anyone mind helping me tho? I want to manipulate fall damage dependent on plugin variables but exclude ender pearls from it
i want to break the boat when the player exits so thats no porblem
so i have to simulate the drop myself?
well the remove function removes the boat. Is there a break function or something like that?
otherwise yses
*yes
shouldnt there be an internal function for that?
well i want to drop the corresponding boat
@tardy delta let me just look at the ap for a sec
Spawn a boat item on that location?
yea im trying to drop the corresponding boat
will damaging th boat break it?
not sure lemme try
Take the slot, check for nulls and then for the material type
but how do i damage it? 🤔
You would need to store the config in memory and have a slot -> name map/list
Its an entity so cast to damageable and damage it
oki
mind explaining it bit more?
if i just do 20.0 would that be enough or too much? idk
try it and see?
Just do a really large amount of damage
Like 2000
Then no matter what it will die
does this checks for the boat?
event.getVehicle().getType() == EntityType.BOAT
yes
Alternatively, instanceof
likely
@summer scroll Manipulating fall damage so that i can change how bad it is to fall down, but the problem is that pearls are also counted as fall damage. But I don't want to increase pearl damage
ah
Caused by: java.lang.ClassCastException: org.bukkit.craftbukkit.v1_16_R3.entity.CraftBoat cannot be cast to org.bukkit.entity.Damageable
What event are you using?
not damageable then
well, Boat does not extend Damageable so I would be surprised if that was the case
maybe livingentity
Boat does not extend that either
nope, not damageable
@summer scroll eh thats the question what SHOULD I use
becakse
*because
OnEntityDamageEvent...
ender pearl is listed as damage cause FALL
just .remove() and drop a new boat in its place
because that is how it is handled internally
Well you can check if the damage is from ender pearl from EntityDamageByEntityEvent perhaps.
wait does that not still trigger EntityDamageEvent anyways?
EntityDamageEvent will still be called i think
yea that menas the code still runs doesn't it
yes, on the EntityDamageEvent