import org.bukkit.ChatColor;
import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import org.bukkit.potion.PotionEffect;
import org.bukkit.potion.PotionEffectType;
public class Nvod implements CommandExecutor {
@Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
if (sender instanceof Player){
Player playerWhoToggled = (Player) sender;
if(playerWhoToggled.hasPotionEffect(PotionEffectType.NIGHT_VISION)){
playerWhoToggled.removePotionEffect(PotionEffectType.NIGHT_VISION);
playerWhoToggled.sendMessage(ChatColor.RED + "Visão noturna desativada.");
}else{
playerWhoToggled.addPotionEffect(new PotionEffect(PotionEffectType.NIGHT_VISION, 2147483647, 1, false, false));
playerWhoToggled.sendMessage(ChatColor.GREEN + "Visão noturna ativada!");
}
}
return false;
}
}
#development
1 messages · Page 11 of 1
return TRUE
not false
otherwise it will spam the usage text
each time you use the command
lmao
everytime
and clean up the empty lines
you added the command to the plugin.yml yes?
you are triggering my ocd
that too

yeah
i did
version: '1.0 Birth'
main: me.systemoutprintln.nvod.Nvod
description: Enables/Disables Minecraft Nightvision effect when the command is toggled.
commands:
nv:
description: Liga e desliga a visão noturna.
usage: /<command>
i will
also please put a space between ){, if(, }else,else{
i did this by myself (with help of course) 😎
because of your ocd?
dont worry about not understanding immediately, coding is a bit that way
it clicks at one point then becomes easy
cerberus
general rule of thumb about any topic
is if it feels too easy, then chances are you just have no idea yet
it doesn't feel to easy
i struggle way to often
but its not as hard as i thought it was
or, you just dont know enough yet
i mean coding is pretty hard
but the media portrays coding as something like
like that
i think im currently at valley of despair
well
everyone goes through mt stupid at some point
exactly
you already went through it
uhh Lunaiskey already went trough it
even kevin mitnick
considered one of the worlds best hackers
@merry knoll
question
can I just rename the folder i created my project without any problem?
or move it
for your dependencies etc
so yes
maven is not a compiler specifically
it keeps your project setup basically is the simplest way to explain it
@merry knoll
it didnt work
what did i do wrong
i think i did something wrong while registering the code
whats the error
the command i mean
or no error at all?
the command doesnt exist
ok
i got what the issue is
click on your jar
then open it with winrar
does it have plugin.yml in it
it does
whats on your onEnable?
public void onEnable() {
this.getCommand("nv").setExecutor(new Nvod());
}```
that looks correct
it implements command executor
not extends
version: '1.0 Birth'
main: me.systemoutprintln.nvod.Nvod
description: Enables/Disables Minecraft Nightvision effect when the command is toggled.
commands:
nv:
description: Liga e desliga a visão noturna.
usage: /<command>
plugin.yml
whats on your console?
me.systemoutprintln.nvod.Nvod
Isn't your main.
me.systemoutprintln.nvod.NvodMain is
to the main class?
that extends JavaPlugin
ok ok
Console would tell you this BTW
ill compile it and try again
Someone?
it still doesnt work @merry knoll
Read console for the error.
they would see it without
you need to send it to every new player that logs in
Unless I read wrong, they asked if they would be showing as mounted or not.
uhh it says that the nvod class doesn't extend java plugin
Server would register them as mounted wouldn't it?
but it's implementing command executor
not if they send a packet to clients
showing them as mounted
server doesnt know that they are mounted
Then you put the wrong class in plugin.yml I told which to put.
org.bukkit.plugin.InvalidPluginException: main class `me.systemoutprintln.nvod.Nvod' does not extend JavaPlugin
at org.bukkit.plugin.java.PluginClassLoader.<init>(PluginClassLoader.java:87) ~[spigot-1.12.2.jar:git-Spigot-79a30d7-f4830a1]
at org.bukkit.plugin.java.JavaPluginLoader.loadPlugin(JavaPluginLoader.java:129) ~[spigot-1.12.2.jar:git-Spigot-79a30d7-f4830a1]
at org.bukkit.plugin.SimplePluginManager.loadPlugin(SimplePluginManager.java:327) ~[spigot-1.12.2.jar:git-Spigot-79a30d7-f4830a1]
at org.bukkit.plugin.SimplePluginManager.loadPlugins(SimplePluginManager.java:248) [spigot-1.12.2.jar:git-Spigot-79a30d7-f4830a1]
at org.bukkit.craftbukkit.v1_12_R1.CraftServer.loadPlugins(CraftServer.java:305) [spigot-1.12.2.jar:git-Spigot-79a30d7-f4830a1]
at net.minecraft.server.v1_12_R1.DedicatedServer.init(DedicatedServer.java:205) [spigot-1.12.2.jar:git-Spigot-79a30d7-f4830a1]
at net.minecraft.server.v1_12_R1.MinecraftServer.run(MinecraftServer.java:545) [spigot-1.12.2.jar:git-Spigot-79a30d7-f4830a1]
at java.lang.Thread.run(Thread.java:750) [?:1.8.0_342]
Caused by: java.lang.ClassCastException: class me.systemoutprintln.nvod.Nvod
at java.lang.Class.asSubclass(Class.java:3404) ~[?:1.8.0_342]
at org.bukkit.plugin.java.PluginClassLoader.<init>(PluginClassLoader.java:85) ~[spigot-1.12.2.jar:git-Spigot-79a30d7-f4830a1]```
Wrong main like I said above.
Yeap
They aren't sending "mounting" packets. They are only sending the spawn packet to the player.
But again should test it anyways as it might not even let them mount.
ok what the fuck did i do wrong this time
i did everything you said
but now when i try to input /nv
it just says "/nv"
and nothing happens
its returning false in your command executor. Show me the code
ok
import org.bukkit.ChatColor;
import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import org.bukkit.potion.PotionEffect;
import org.bukkit.potion.PotionEffectType;
public class Nvod implements CommandExecutor {
@Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
if (sender instanceof Player){
Player playerWhoToggled = (Player) sender;
if(playerWhoToggled.hasPotionEffect(PotionEffectType.NIGHT_VISION)){
playerWhoToggled.removePotionEffect(PotionEffectType.NIGHT_VISION);
playerWhoToggled.sendMessage(ChatColor.RED + "Visão noturna desativada.");
}else{
playerWhoToggled.addPotionEffect(new PotionEffect(PotionEffectType.NIGHT_VISION, 2147483647, 1, false, false));
playerWhoToggled.sendMessage(ChatColor.GREEN + "Visão noturna ativada!");
}
}
return true;
}
}
@hoary scarab
you beat me to it
import org.bukkit.plugin.java.JavaPlugin;
public final class NvodMain extends JavaPlugin {
@Override
public void onEnable() {
this.getCommand("nv").setExecutor(new NvodMain());
}
}
ez
this.getCommand("nv").setExecutor(new NvodMain());
thats the issue
new Nvod());
Its not checking for any command. Also your typing this in game right?
of course
And what Luna said.. point to new Nvod()
they have to send mounting packets
armor stand does not exist serverside
public void onEnable() {
this.getCommand("nv").setExecutor(new Nvod());
}```
is this correct
?
yes
Ah yeah. Mybad.
If you send a mount packet to the player won't the server also receive the packet to tell others its mounted?
thank you guys
now i can enjoy my 60 years of night vision 2
Just gotta test it to find out at this point xD
trynna make my mount system for a minigame but at this point everything bugs xd
I'm pretty sure it shows as mounted because when I was testing my teacups ride I did this.
its a bit hard to guess, but as if they got nothing
would be my guess
they are just normal from the server side
so thats how they will show to new players
Is there a way to append to a component a newline?
\n ?
👍
#development message
#development message
#development message
anyone help me with these?
you just move it manually no?
and you can set its gravity
and as marker
to make it go through blocks etc
wdym?
mmmm
it doesnt create smooth movement
looks rly choppy
hmm, you could maybe send location packets
instead of teleport packets
@dark garnet
this is the packet you need
not sure if there is an api method thats exposed that does it
is there anyway to do it without packets?
Maybe u have to set the velocity
So that the client can predict the next place the entity will be
Oh wait ur trying to disable gravity
Didn't read context
Can u show code
i found a thread on spigot about it but they use packets and its from 2016, so there might be an easier/better way to do it without packets https://www.spigotmc.org/threads/armor-stand-no-gravity-velocity.135046/
// Spawn ArmorStand
final ArmorStand stand = (ArmorStand) getWorld().spawnEntity(new SceneManager(id, "1", "1").getPoint(), EntityType.ARMOR_STAND);
stand.setInvulnerable(true);
stand.setPersistent(true);
stand.setCollidable(false);
//stand.setVisible(false);
//stand.setGravity(false);
// Set velocity towards next point
stand.setVelocity(points.get(nextPoint).toVector().subtract(stand.getLocation().toVector()).normalize().multiply(0.75));```
Assuming u uncommented out the gravity?
yea
If PVP is turned off, player shot arrows are supposed to go through players right
I think they bounce off
i thought they just hit the player but do no damage?
what happens?
The arrow goes through players
But
The arrow shot becomes invisible to the shooter
Yet it's visible to everyone else + it can hit entities
huh
You seeing that right
if other players can still see it, issue is more than likely a client bug
It's vanilla 1.19.2 though
It's definitely an issue with Minecraft right
Could Paper maybe find a solution to it? Just looks like it's packets that are not being sent/received properly
wait how do you turn pvp off in vanilla mc?
i didn't know you could
server.properties
pvp=false
o
lmao
okay?
I'm just saying it's most likely a client bug
yeah it is
e.getCursor().getItemMeta().getDisplayName() ChatColor.RED + "test item"
im checking if these two are equal. when i send a message containing both of them, they both appear as "test item" in red text yet they aren't equal. how do i fix this?
why do you want to see if they are equal? are you trying to identify the item?
im trying to see if the item the player has in their cursor is the same as another item.
then the strings arent the same
i believe on new versions you can control + up to extract the item's data
do that and check the displayName
on intellij or minecraft?
minecraft
tbh, your better off stripping the color codes from the string before you check them
tho if your trying to identify itemstacks, using pdc and setting an id on the item would be better.
cause using an items displayname and lore for identifying if its the same as another item or not is pain
personally i just avoided using pdc and went with straight nms nbt
you could try to figure out if you can maybe counteract gravity
but packets is most likely way simpler
with that thread, it seems its possible but you will need to reflection instead since it uses a custom nms armor stand
yea i tried that by setting Y velocity to 0
but in a thread i read they said that nms resets the velocity every tick when gravity is off
use the method on the last page instead
they override the whole velocity calculation part
this?
@Override
public void g(float f, float f1) {
if (!hasGravity()) { // hasGravity() actually means hasNoGravity(), probably a mistake in deobfuscating.
super.g(f, f1);
} else {
move(motX, motY, motZ); // Give them some velocity anyways ;3
}
}
@Override
public void n() { // This method is called each tick. This also slowly multiplies each velocity by 0.98, so I just reset those values.
if (hasGravity()) {
double motX = this.motX, motY = this.motY, motZ = this.motZ;
super.n();
this.motX = motX;
this.motY = motY;
this.motZ = motZ;
} else super.n();
}```
yes
i tried but im not sure what class and imports and such i would use
you are going to extend the nms version of armor stand
then use the new custom armor stand as your armor stand basically
how do i get the nms version of armor stand? what dependencies do i have to add?
do i keep spigot-api and just add spigot?
alright what about repositories?
p.getInventory().setHelmet(e.getCursor()); this line is in an inventory click event. it is setting the helmet before i click which is an issue because then i just pickup the helmet again. (i.e. if i click with red stained glass, i get 2 red stained glass because im picking up the one in my helmet slot). how do i fix this.
cancel the event
if you cancel the event, nothing will happen
(and don't set the helmet when cancelling it)
ohhh cancel the click, thanks! do i set the helmet after cancelling it?
o didnt see this, how do i do that?
buildtools
you can find how on spigot site
or if you are lazy, you can depend on a compiled jar (which you normally get from buildtools as well)
where do i put it tho?
you dont, if you do it properly it will put the dependency on your maven local
then you put mavenlocal as your repo
and depend as normal
ok so i have BuildTools.jar, do i run it and keep the files it generates somewhere safe?
buildtools keeps it in your local maven repository
The home of Spigot a high performance, no lag customized CraftBukkit Minecraft server API, and BungeeCord, the cloud server proxy.
found in %USERHOME%\.m2
(I think that's the folder name)
and then just change spigot-api to spigot
all i had to do was run buildtools and change from spigot-api to spigot in the pom.xml
can i delete the files buildtools.jar generates in the folder its in?
yes you can delete the entire folder
alright
There is no default constructor available in 'net.minecraft.world.entity.decoration.EntityArmorStand'
public class ArmorStandGravity extends EntityArmorStand {
@Override
public void g(float f, float f1) {
if (!hasGravity()) { // hasGravity() actually means hasNoGravity(), probably a mistake in deobfuscating.
super.g(f, f1);
} else {
move(motX, motY, motZ); // Give them some velocity anyways ;3
}
}
@Override
public void n() { // This method is called each tick. This also slowly multiplies each velocity by 0.98, so I just reset those values.
if (hasGravity()) {
double motX = this.motX, motY = this.motY, motZ = this.motZ;
super.n();
this.motX = motX;
this.motY = motY;
this.motZ = motZ;
} else super.n();
}
}```
You need to state which constructor you want to use
It can't infer it automatically
yea nothing is working idk y
'x()' in 'net.minecraft.world.entity.decoration.EntityArmorStand' clashes with 'x()' in 'net.minecraft.world.entity.EntityLiving'; attempting to use incompatible return type
and for @Override for g:
Method does not override method from its superclass
'n()' in 'network.venox.lasertag.bukkit.ArmorStandGravity' clashes with 'n()' in 'net.minecraft.world.entity.decoration.EntityArmorStand'; attempting to use
Cannot resolve method 'hasGravity' in 'ArmorStandGravity'
Cannot resolve method 'move' in 'ArmorStandGravity'
Cannot resolve symbol 'motX'
Cannot resolve symbol 'motY'
Cannot resolve symbol 'motZ'
what version is this?
1.19.2
i have a while loop with a certain condition inside. at the end of each loop i want to wait a second so that it does not lag servers. how would i do this? i've seen stuff like this
p.sendMessage("timer");
}, 20L);```
but i don't think it's working.
don't use a while loop like that
while loops "stop time" until the loop has ended
what exactly do you want to do?
run code every second?
yeah, i want to run certain code every second while a certain condition is met. do i replace the while loop with the scheduler instead?
yes, and here's an example:
new BukkitRunnable() { // not using normal scheduler since we want to cancel inside
@Override
public void run() {
if (!condition) {
cancel();
return; // stop the code below from running
}
p.sendMessage("timer");
}
}.runTaskTimer(sh, 10L, 20L); // runs 10 ticks after this timer is created, then 20 ticks after that until cancelled
p.sendMessage("hello");
new BukkitRunnable() { // not using normal scheduler since we want to cancel inside
@Override
public void run() {
if (!condition) {
cancel();
return; // stop the code below from running
}
p.sendMessage("timer");
}
}.runTaskTimer(sh, 10L, 20L); // runs 10 ticks after this timer is created, then 20 ticks after that until cancelled
```It will send "hello", then 0.5 seconds later (which is 10 ticks) it will send "timer", then 1 second later (which is 20 ticks) it will send "timer" and keep sending every second until cancelled
thank you so much :)
ok how would i do packets
btw, for reference, im adding players as passengers to the armor stand
i have a conditional that checks the item data of the item in a player's cursor slot. when this appears as air, i get errors as air does not have any item data and therefore is null. how would i fix this? Cannot invoke "org.bukkit.inventory.meta.ItemMeta.getPersistentDataContainer()" because the return value of "org.bukkit.inventory.ItemStack.getItemMeta()" is nul
can somebody explain to me why this code still spawn a visible Shulker head?
player.world.spawn(location, Shulker::class.java) {
it.setAI(false)
it.isInvisible = true
it.isInvulnerable = true
it.isGlowing = true
it.addPotionEffect(INFINITE_INVISIBLE)
}
just check if the item has metadata? ItemStack.hasItemMetadata
or u can check if item meta is null
check if the item is not null, and that it has itemmeta, and that the pdc is not null
pretty sure shulker heads show no matter what, invisibility only hides the shell
if you're lazy you can also do something like
Optional.ofNullable(item).map(ItemStack::getItemMeta).map(ItemMetadata::getPersistentDataContainer)
but you're probably going to need to keep a reference of item meta if you want to persist changes in the PDC
yep, invisibility still shows the head
I'm solving that problem that apparently 99% of devs face one day, which is to make a block "glow" (have a distinct colored outline that is visible through walls)
use falling blocks
hmm, could you provide a small example?
if i have something such as if (item.hasItemMetadata && item.getItemMeta.getPers... etc
pretend item is an item stack
would that still give an error or would it cancel after the first req and not go to the second if it's air.
they go in order
seems like they had issues with making it invisible, but there r some other solutions in that thread i think
apparently spawning falling blocks destroy the current block in that location :/
Cance the blocktofrom event or entityblockchange
how to get the block state id (ID of the block state that the falling block will represent) to send on the spawn entity packet?
Use mojang mappings, it will both allow you to have names that make sense, and also fix this issue
outgoingRequests.get(p).remove(pl); why does this cause an error
Im getting a List from a map and removing a value
what error? it's very hard to figure why a thing happens if you don't know what thing is it, don't you think?
I googled it and it seems like I needed to initialize it as a linkedlist
rather than just array.aslist
could you copy paste the error here?
Caused by: java.lang.UnsupportedOperationException: remove
at java.util.Iterator.remove(Iterator.java:102) ~[?:?]
at java.util.AbstractCollection.remove(AbstractCollection.java:283) ~[?:?]
at dev.failures.core.Commands.FriendsCommand.onCommand(FriendsCommand.java:72) ~[DrugCore.jar:?]
at org.bukkit.command.PluginCommand.execute(PluginCommand.java:45) ~[paper-api-1.19-R0.1-SNAPSHOT.jar:?]
... 17 more
I couldn't .remove() from the list
yeah, seems line your map is holding an immutable list
idk about your code, but to solve this you can either change whatever populates this map to use mutable lists, or create a copy of the current list without the undesired item(s) and set that back to the map (you could use java 8 Stream for that)
Yeah I solved it my creating a linkedlist<>(array.aslist())
fyi you could use any implementation of list and that would work
got it
does entitydamagebyentityevent work if they're spawn protected
is spawn protected same as creative
wdym with work? it does fire whenever an entity is damaged by another entity, and is only fired is the target is vulnerable to damage iirc
so it most likely does not fire against players immune to damage (like players on creative)
would it work in spawn protected regions
like pvp disabled in spawn
or is that the same protection as being in creative
you mean a plugin disabling pvp in certain places (like WG) or disabling it through vanilla MC configurations? because basically plugin related stuff still fires the events, while vanilla MC stuff may not
okay got it
I've also been trying to disable console messages from mongo
but it still sends
Logger.getLogger("org.mongodb.driver").setLevel(Level.SEVERE);
I have this in onEnable()
I heard that disabling messages by configuring the root logger of the console is a pain in the butt, what you could do is filter them by adding a filter to the root logger. You would probably need to check what class the Logger belongs to, this guide should help setting things up: https://www.spigotmc.org/threads/how-to-hide-asyncplayerpreloginevent-result-kick_other-kick-message.559712/#post-4424866
wow thats a lot more complicated than I thought
idk maybe mongo has its own configuration for the log messages too 🤷♂️
considering this byte table, to get a flag for both invisible and glowing I would have to do 0x20 | 0x40, right?
seems right
nice, how do I get this thing?
the glow part worked, but not the invisible part :/
what if you do just the invisible effect
seems like it might not work for falling blocks? 🤷♂️
never used packets so idrk what other options you have
idk even how to properly set the packet object data, it seems that for some reason Jungle Wood id works (WrappedBlockData.createData(Material.JUNGLE).data), but most materials give me ID 0, which does nothing
yup, with air set, nothing happens
when using this code:
val block = player.world.getBlockAt(location)
val blockId = WrappedBlockData.createData(block.type, block.data.toInt()).data```
the spawned "falling block" also becomes a jungle wood
aaaaa was able to make it work, but at a cost I cannot pay
val block = player.world.getBlockAt(location)
val entityFallingBlock = EntityFallingBlock((player.world as CraftWorld).handle, location.x, location.y, location.z, (block as CraftBlock).nms)
val blockId = Block.getCombinedId(entityFallingBlock.block)
This Block.getCombinedId NMS method was the only thing so far that gave me the correct ID so the block materials matched the real thing
anyone know why I run into this error when using an online host
public class PlayerInteractAtEntityEvent
extends PlayerInteractEntityEvent```
PlayerInteractAtEntityEvent has 1 extensions, 1 all implementations, and 4 methods.
Description:
Represents an event that is called when a player right clicks an entity that also contains the location where the entity was clicked.
Note that the client may sometimes spuriously send this packet in addition to PlayerInteractEntityEvent. Users are advised to listen to this (parent) class unless specifically required.
Page 0 • Requested by: GabyTM | RO • spigot
Actually that might be it, I used 1.19.2 paper
When my plugin was 1.19 paper
hmm, is that a big deal?
AsyncChatEvent exists on 1.19 paper
Make sure you are using paper on the server, and not bukkit
got it
Also I'm getting Missing profile public key
is that a pebblehost thing?
I have viaversion in and I'm tryna join w/ 1.19.2
Idk
No that is a normal Minecraft server thing new to 1.19 server
But if he's connecting online mode on 1.19.2 shouldn't that error not happen?
Or could it be bc of viaversion
Pretty sure that will happen when people join with older versions
Yes but he said he's connecting with latest
does the invisibility potion also acts on the Entity Metadata packet, or is it a separated thing?
Is there any specific java version vendor I should use when making 1.19 spigot plugins?
not really
for itembuilder.skull(), is there a way to use UUID to get skull
I see one option for texture and uuid
talking about triumph-gui?
if so, you can use an offline player
and you can get an offline player from an uuid
Yeah I’m using skull from triumph
I don’t need an option for offline player for .texture
I don’t see*
there's a SkullBuilder#owner method
itemBuilder.skull().owner(OfflinePlayer)
does bytebuffer.asIntBuffer make the new buffer created share the old buffer's memory? or it is copied?
Creates a view of this byte buffer as an int buffer.
So it shares memory
oh alr thx
i didnt know what view meant for real
thought it was like some reference map or sth idk
nah it usually means it will update if the underlying thing changes, but can't be modified itself
for example @UnmodifiableView
ohhhhhhhhh
can I have different servers in different versions?
if you mean in bungeecord,yes
k
np
next time #general-plugins though
its a server software that can connect multiple spigot servers together allowing players to cross between them easily
The home of Spigot a high performance, no lag customized CraftBukkit Minecraft server API, and BungeeCord, the cloud server proxy.
are the test servers spigot servers
well yeah you can use bungeecord to connect them al
how do you truncate a nio bytebuffer
why do i have to connect them
i mean you dont have to
bungeecord for example would let someone join Test server 1, then type a command and switch to test server 2
thats not what I want
okay
im just asking if I can just have two different spigot servers in my computer
one for testing plugins in 1.12.2 and the other in 1.19
just make the ports different
even if i just run one at a time?
one server port by default can be 25565 and you could just set the other to 25566
you can start them at the same time
it just means connecting to the server will be a different ip
i dont want to start them at the same time
i know, but you can
how do I change ports though
server.properties
k
how do i start my spigot server specifically with java 17? (i have both java 8 and 17 installed for different versions of minecraft.)
Does anyone know why my plugin doesnt load when I add this to my plugins main.java?
@Override
public void onEnable() {
this.getCommand("gamemodecreative").setExecutor(new Main());
}```
It loads when the this.getCommand part isnt there
you need to find the path to the java.exe for the specific version you want
"<pathToJar>" -jar server.jar
i assume your command is your main class
First, Don't name your main class Main, name it the same as your plugin name because its good practice
secondly, you're making a new instance of your plugin when doing new Main(), you need to provide an already existing instance of it
so instead you can do setExecutor(this)
ahh thank you
i made this question once...
and im asking it once again
whats the event when a player sounds a goat horn
is it player consume event or interact event
they really could add a specific event just for this
id recommend that you create event handlers for all the events you think it kight come under, and on use of the goat horn have it send a message with the event name so you can figure it out
its what ive done before when i wasnt entirely sure which event it was
for figuringnout the type of sound you have to use nms to pull the nbt tag currently, woupdnt suprise me if they release an itemmeta for goat horns for getting the sound
i'll do that later
i just have to figure out the event first
Why would the goat horn fire the "consume" event?
I mean
I just want to make sure
its player interact event
consume is usually when you eat stuff
i'll test it regardless
hope i wrote the code correctly
would be embarrassing messing up such simple plugin
Everything is simple until you start making it.
surprise surprise
its player interact event
i did what you said
thank you for the tip
by the way
ill always do that now
weird how eating triggers two events
both consume and interact event
well consume event is called after you eat it
interact is when you first click
just to make sure
and interact is also for regular left/right clicking too
there is a way to prevent calling another interact event on cooldowns correct?
like the goat horn cooldown
uhhh idk how goat horns work
i didn't even know they were in the game
lol
interact event is always called though
you can cancel it though
you can't disable the event
i can sound a goat horn and it will be on cooldown, but if i try to sound them again
it will still trigger the vent
i think it is
if it isnt possible with spigot then its probably possible with nms
why wouldnt it be though
I don't think it's possible in spigot yet
not from what i can see
huh what are bundles
since when was this a thing 🥲
was looking in ItemMeta
theres no meta for horn
since telescopes exist
in minecraft ofc
i didn't know bundles were a thing though
they were announced in 1.17
o wow
does that mean my life will be 500% harder?
i think it does
I can't find out how to do it in nms
although im not in intellij rn so I can't search as well
here's a checklist of what i need to do:
- i need to get what horn the player just sounded
with nms
- i need to write a code on what should happen when the player sounds that specific horn
- i also need to check if its not on cooldown
- i need to increase the cooldown
sounds easy right? it isnt
Could set cooldown using https://hub.spigotmc.org/javadocs/spigot/org/bukkit/entity/HumanEntity.html#setCooldown(org.bukkit.Material,int)
declaration: package: org.bukkit.entity, interface: HumanEntity
maybe i can do it all but step 3 will be hell
hmm
int getCooldown(@NotNull Material material)```
Description:
Get the cooldown time in ticks remaining for the specified material.
Returns:
the remaining cooldown time in ticks
Parameters:
material - the material to check
Requested by: dkim19375 • spigot
wait a minute
will do something different
why don't you have any roles on my screen
does it say you have one
but the bot simply removed my roles
lol
and didnt add any new roles
💀 💀
kind of embarrassing if you ask me
server where most members are programmers and we have a bot that doesnt even work properly
💀
B.A.A.S - Too many caps!
No need to shout.
Barry's Anti Abuse System | v1.4.7
ha imagine having school
:(
didnt know the us starts that early
most people here dont go back for a few more weeks
but the break starts in mid july
😭
it's ok
currently i have a bukkitrunnable that stops once the helmet the person is wearing does not have certain nbt data. i want to add another conditional that stops the bukkitrunnable when they change their helmet and the items are the same (for example changing 1 diamond helmet with another). how would i do this?
Add a conditional statement in the runnable that stops it
private HashMap<String, Double> convertToMap(List<String> values) {
HashMap<String,Double> data = new LinkedHashMap<>();
Bukkit.broadcast(Component.text("" + values.size()));
for(String value: values) {
String[] split = value.split("-");
data.put(split[0]+"-"+split[1], Double.valueOf(split[2]));
}
Bukkit.broadcast(Component.text("test"));
return data;
}
anyone know why it gets stuck in the for loop? I checked the size and it shows up as 1
the test message is never sent
what input are you giving?
sorry, i meant what should i add in the conditional to stop it even when the helmet is changed to the same item
im dumb, I just checked it's cause I split by - and the UUIDs have -, so the map is messed
gosh darn
Does anyone know why I get this error when starting my server
probably have not declared your command in your plugin.yml
yes, it cant register it properly without being in plugin.yml
yes. bcz you don't null check the return of getCommand
it doesn't stop the plugin bcz the command doesn't exist, but bcz there's an NPE being thrown
oh
name: HepnosEssentials
version: 1.0
author: Hepno
main: dev.hepno.hepnosessentials.HepnosEssentials
api-version: 1.19
commands:
heal:
description: Heals player to max health.
usage: /<command>```
did i do it right?
show us your code as well
okay
package dev.hepno.hepnosessentials;
import dev.hepno.hepnosessentials.commands.Heal;
import org.bukkit.command.CommandExecutor;
import org.bukkit.plugin.java.JavaPlugin;
public final class HepnosEssentials extends JavaPlugin implements CommandExecutor {
@Override
public void onEnable() {
getCommand("heal").setExecutor(new Heal());
}
@Override
public void onDisable() {
// Plugin shutdown logic
}
}```
```java
package dev.hepno.hepnosessentials.commands;
import org.bukkit.attribute.Attribute;
import org.bukkit.command.CommandExecutor;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
public class Heal implements CommandExecutor {
@Override
public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {
if (!(sender instanceof Player)) { return true; }
Player player = (Player) sender;
if (cmd.getName().equalsIgnoreCase("heal")) {
double maxHealth = player.getAttribute(Attribute.GENERIC_MAX_HEALTH).getDefaultValue();
player.setHealth(maxHealth);
return true;
}
return true;
}
}```
Here you go
if you open the jar, and check the plugin.yml file is the commands: part there?
hmm
where did you put the plugin.yml file in your project?
and what build tool do you use if you do use any
/src/plugin.yml
IntelliJ w/ Maven
I believe with maven you have to put it in /src/resources/
tho. I wonder how it's creating another plugin.yml if yours is in the wrong place
I believe it is because it created one automatically when using the IntelliJ plugin I am using
I was wondering why it asked for plugin.yml option when creating it without creating a file
It just put it in a different directory
Makes sense now
Tysm
No issue on startup, lemme open MC and see if it works
WOO IT WORKS!!
Thank you so much!!
That feeling of both relief and frustration when youve been debugging for hours just to realise its the simplest of errors
package dev.hepno.hepnosessentials.commands;
import org.bukkit.attribute.Attribute;
import org.bukkit.command.CommandExecutor;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
public class Heal implements CommandExecutor {
@Override
public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {
if (sender instanceof Player player) {
if (!cmd.getName().equalsIgnoreCase("heal")) return false;
double maxHealth = player.getAttribute(Attribute.GENERIC_MAX_HEALTH).getDefaultValue();
player.setHealth(maxHealth);
return true;
}
}
}
Already fixed it but thank you
I can't get skull().texture(String) to work
ItemBuilder.skull().texture("bfdf6d33294dec03f449a97c0fdca701773f2e218ec11771d6b48bb71322ab03").build()
It comes out like this
And I got the texture from here: https://minecraft-heads.com/custom-heads/miscellaneous/52441-framed-cube-gray
wrong value
this is the one you want
I use the bigger one? gg
target.sendMessage(ChatColor.translateAlternateColorCodes('&', "&d&lHepnosEssentials &8» &a" + player + "&7 healed you full max HP!"));```
```java
Player target = Bukkit.getPlayerExact(args[0]);```
Does anyone know how to get it to display "Hepno" instead of "CraftPlayer{name=Hepno}
player.getName()
or player.getDisplayName() to get the display name
so i have a system where when you put on a certain block, you get a rainbow glass helmet. it constantly checks if the item on your head has certain nbt data, and if so, continues the loop. the issue, i want it so when you click on your helmet slot with the same item it stops the loop. although i do not know how to do this since they are same exact item. (clicking on rainbow glass helmet currently on head with glass would continue the loop as it would check for nbt data and obviously it would have that since same item).
Is there a feature like world.getTime() that gets the time in AM/PM time or 24h time, instead of in ticks?
no
and I dont think there will
you will need to parse it yourself
but it is easy
Ah, how do I do it?
1000 ticks is a minute iirc
let me check
no my bad
1800 ticks its a minute
you can parse it
to a 24h format
but it takes some thinking
thanks
why cant I get world?
hmm?
import org.bukkit.Material;
import org.bukkit.World;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.player.PlayerInteractEvent;
import org.bukkit.event.player.PlayerItemConsumeEvent;
import org.bukkit.inventory.ItemStack;
public class Listeners implements Listener {
@EventHandler
public void usedGoatHorn (PlayerInteractEvent e){
Player p = e.getPlayer();
Material goatHorn = e.getMaterial();
if (goatHorn == Material.GOAT_HORN){
World world = e.getWorld
}
}
}
I cant get world for material
which is odd
atleast for me
wait
yeah
I still cant do it
oh waait
now I can
I was copying code from another plugin I made
that one wasnt using a player object
just a projectile
so ig thats why
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.World;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.Player;
import org.bukkit.entity.Sheep;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.player.PlayerInteractEvent;
import org.bukkit.event.player.PlayerItemConsumeEvent;
import org.bukkit.inventory.ItemStack;
public class Listeners implements Listener {
@EventHandler
public void usedGoatHorn (PlayerInteractEvent e){
Player p = e.getPlayer();
Material goatHorn = e.getMaterial();
if (goatHorn == Material.GOAT_HORN){
World world = p.getWorld();
world.spawnEntity((Location) world, EntityType.GOAT);
}
}
}```
Will this work?
Ill just test it
no
it will throw an error
to be more specific, this cast will throw an errir (Location) world
error*
yeah thats what i thought
let me try to fix it rq
@broken elbow How do i fix this actually
yo
will anyone help me though
you get the location from the world
you don't cast the world to a location
you get the location from the player*
yeah
I'm assuming you want to spawn the goat where the player is?
yeah
its calling a goat
player.getLocation()
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.World;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.Player;
import org.bukkit.entity.Sheep;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.player.PlayerInteractEvent;
import org.bukkit.event.player.PlayerItemConsumeEvent;
import org.bukkit.inventory.ItemStack;
public class Listeners implements Listener {
@EventHandler
public void usedGoatHorn (PlayerInteractEvent e){
Player p = e.getPlayer();
Material goatHorn = e.getMaterial();
if (goatHorn == Material.GOAT_HORN){
World world = p.getWorld();
world.spawnEntity(p.getLocation(), EntityType.GOAT)
}
}
}```
i think im good now
probably yeah
let's try this out
its like
the first time i do something like this
only trigger a specific action from a specific item
so i guess my confusion is reasonable
guys
will a plugin made for 1.19.2 work on versions up to 1.18.1?
its a simple plugin
just a command that gives you infinite night vision
Always focus on lowest version
Set api-version in plugin.yml to 1
18
1.18
do I only have to do that
Yes
or do I have to do something else
Then it will work
The only thing afaik is that spigot doesn't convert Sounds
The Sound names changed in 1.13
Besides that it should work fine I think
thanks kotlin lover
Np
And also
For 1.12 and below, do not include api-version in plugin.yml
That will tell spigot that it is a legacy plugin
And will provide some conversions automatically
Sorta neat
oh cool
so uh
I just a code I made for a plugin to another project
its basically the same plugin
just in a more recent version
and I got 4 new warnings that weren't existent in the first project
is this an issue?
Not annotated parameter overrides @NotNull parameter
that's the warning
it repeats 4 times
in the same line
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
thats the code causing the warnings
it's also happening in my main class
Method invocation 'setExecutor' may produce 'NullPointerException'
this.getCommand("nv").setExecutor(new Nvod());
is this a problem?
you can ignore that
this is just saying that if nv (why is the command nv??) is not in plugin.yml, it will error
spigot has command aliases built-in
unless the cmd is actually just nv
it literally is
the command is just nv
and its already registered
properly
so if you have it in plugin.yml, you can ignore it
ye its good to know what the warnings mean
and btw this warning just means that spigot is saying that sender, command, etc are never going to be null, but your code doesn't show that it's not going to be null
but again that doesn't really matter here
it is helpful at times which is why intellij shows the warning, but in this case it's not needed
this plugin will work in 1.19+ correct?
yes
it gave it to me at level 11
wait no
not level 10
you're level 210
20
🤣
aka tier 2
wait no
ur level 11
actually i dont know lol
im on level 11
just evolved
I can send files now ✨
🎉
no more imgur
i literally avoided sending screenshots of my code here just because i had to use imgur and i was lazy
?imgur
You won't be able to upload images here directly to avoid spam, so please use https://imgur.com/upload to upload images/screenshots.
You can also use a screenshot service like gyazo or jinx and post those links here.
Requested by: dkim19375 • imgur
yeah lol
does anyone know why this code does not work? it runs just fine, the location of the block is correct, but it doesn't get updated (or removed in this case) by my client, the block still there. OBS.: checked with debugger, the player is me and the location is correct
// does nothing
player.sendBlockChange(location, Material.AIR.createBlockData())
// also does nothing
player.sendBlockChange(location, Material.JUNGLE_WOOD.createBlockData())```
Is something causing a block update as soon as you send the change which causes it to reset?
nop, I return as soon as I set that from the event listener
apparently scheduling this code 1 tick later works...
does an invisible block that has collision exist?
Barrier block maybe?
setting a block to air using packets might make it invisable, but it would be glitchy as your basically clipping through the block, but if you had air and set it to a block, it wouldnt be as glitchy
this worked
Does player.setPlayerWeather(); set the weather for just the player, or the entire server?
d;spigot Player#setPlayerWeather
void setPlayerWeather(@NotNull WeatherType type)```
Description:
Sets the type of weather the player will see. When used, the weather status of the player is locked until resetPlayerWeather() is used.
Parameters:
type - The WeatherType enum type the player should experience
Requested by: Brister Mitten • spigot
Ah. Is there any way to set the worlds weather?
public enum WeatherType
extends Enum<WeatherType>```
WeatherType has 1 extensions, 3 all implementations, 2 methods, and 2 fields.
Description:
An enum of all current weather types
Page 0 • Requested by: Brister Mitten • spigot
i guess a mix of setStorm and setThundering
But that can only change weather theres a storm
Is there really no event called when a shulker box is opened? (I can use InventoryOpenEvent but was hoping not to)
umm. I mean shulker boxes are inventories? why wouldn't you want to use IOE?
Well I don't want to do all the checks for the shulker opening like blocks above etc.. so I want the interact event to run. But say I wanted to stop the box from opening, I can't do that during InventoryOpenEvent (the box would still open even for an ms). Also I have to get the block from inventory etc.. and its just more code I was hoping not to write.
Basically I was hoping for a lazy way to do what I needed lol
Oh nvm canceling the event won't open the shulker at all.
ShulkerOpenEvent would still be nice cause the box has the opening animation so to run after the box is fully open or when it starts opening would be helpful
doesn't the inventory open immediately?
and I think the animation would be client side
Inventory does but the box does an animation. I don't need the inventory I need to know when the animation is done
It pushes entities
Yeah caused a dupe with my revamped minions cause I saved based on the entities last location and not their saved location.
💀
Just gonna cancel opening the box if it moves the minion.
shouldn't you save the UUID?
Or I guess if it's in an unloaded chunk it could still dupe
Entity changes
wdym
I can only find AnimationStatus btw
for the shulker
which is just opened, closing, opening, and closed
oh wait
nvm
I found progress
Like the entity can be renewed at any time. Removed, edited etc...
I would have to explain all my code to explain why lol
I already block that
and water
no gravity
ah
doesn't seem like spigot has a method for shulker progress
weird
https://hub.spigotmc.org/javadocs/spigot/org/bukkit/block/Lidded.html
just close and open
declaration: package: org.bukkit.block, interface: Lidded
what versions of mc?
1.19.2 - 1.8.8
Why
Cause even though I'm lazy... I'm not always xD
Bruh
wait a minute
yapperyapps
you only need to know if the animation is opening, right?
Done*
but can't it push while opening?
Yeap hence why I need to know when its "done"
No cause it doesn't dupe till the minion gets saved.
(When the server stops or minions are reloaded)
but what's the harm in checking when it's opening?
you won't have to change any data (or tp the minion back)
When its opening its at the same location and there is no issue. I need to know when its done opening so I can find the minions new location and teleport it back. If I teleport it while its still opening it can still be moved.
When its opening its at the same location and there is no issue.
Exactly
so you only have to check before it opens (inventoryopenevent) and there is no issue
I mean if you want you can use NMS (unless I'm blind and it's in the spigot api) https://nms.screamingsandals.org/1.14.3/net/minecraft/server/VVV/TileEntityShulkerBox.html & https://nms.screamingsandals.org/1.14.4/net/minecraft/world/level/block/entity/ShulkerBoxBlockEntity.html
I currently do this and cancel the event. But I'm trying to still allow the opening of the shulker inventory.

so you want to keep the shulker inventory open
and then after it opens
you close it again?
there probably is some nms method to cancel the animation
Yes I want the inventory to open but not the shulker
Or maybe
is it possible to cancel the event
but still have the inventory access
I don't really touch inventories so I don't know about the details
I was thinking get its inventory and send it to the player, but IDK if that would still use the shulkers inventory properly
ye thats what i was suggesting
I'd recommend trying that first
since it's prob much easier than nms
especially with both <1.14.4 and 1.14.4+
I need help!
?help
» Give the helpers some details
» Ask suitable questions
» Be polite
» Wait
Requested by: dkim19375 • help
ask in #1007620980627230730 for plugin and server help @floral nacelle
this is coding help
just saying in advance since many get confused
Has anyone here made a GitHub Action before where you create a jar in one job and then use that jar in another job?
I currently use a matrix to publish jars for four different platforms, but this currently has the major issue, that it basically creates all 4 jars 4 times.
I was considering using mvn --project :core,:${{ matrix.platform }} clean install to only build the required jars, but this would still make 4 separate calls to build core (Resulting in large amounts of dependency downloads), so preferrably would I like to make a single mvn clean install call here in the end...
I mean, if the projects dont depend on eachother, you can run the maven tasks by targeting each plugin one by one
Can you share the workflow? You probably have it setup so it goes over the matrix once and then again for each element
sigh because the code is in the InventoryOpenEvent I can't send the player the shulkers inventory because its creates an infinite loop
do a check for the shulker inventory then?
it does xD. I'm just creating a passthrough list that will skip the check if the user is in it
so there shouldnt be any infinite loop
Theoretically. Testing it now
why are you opening the same inventory again?
just don't cancel the event
or do you want to completely cancel the animation?
👍
Passthrough list didn't work either 😭
could you maybe open a cloned inventory and modify* the original inventory based on how the clone is modified?
I could but thats all just a waste at this point xD
store the inventory in a list
oh wait
sorry for ping
didn't read
Yeah I'm just canceling the event. They shouldn't try to push minions with shulkers anyways lol
yea I would just make it so that it sends a message saying that you can't use a shulker nearby
Message isn't needed. I do the same thing for pistons
couldn't you just cancel the packet that makes the Shulker play the open animation (block action packet)?
Read the whole convo (Its not just animating to the player)
What I understood of what you wrote is that you want players to open the Shulker inventory but not play the animation, right? Or is the other way around? Cause you can do both with packets
Its all written above lol.
Shulkerbox inventory opens the shulkerbox. I don't want the shulkerbox to open. Opening the shulkerboxes inventory opens the shulkerbox and causes an infinite loop.
I'm sorry, I didn't get what you meant with all you wrote, what is the difference between "shulker box" and "shulkerbox"? Which one is the block and which one is the inventory?
shulker box opening = playing animation = moves entities, so it's not just client-side packets
and he wants the inventory to be openable by players
All the same just typing fast, playing a game.
hmm isn't there an event for entity collision pushs that can be cancelled?
Maybe, I do not understand how that sort of stuff works before they were added tho
I presume using 1.19.2 as source and viaversion does the rest?
oh nvm
just only runs the shulker checks on 1.11+ servers, still no clue tho
there's also possibility of using nms to disable Shulker collision, maybe that would work?
in nms you can get the animation state
and the progress
and so I assume you can set it
(didn't check)
Lidded was shown earlier but it doesn't stop the animation
Only thing at the point that would work is create an inventory and mimic the shulkerbox but I didn't wanna do that. so I just cancel the event if its gonna push a minion
anyone know of a good file converter API?
do you mean specific files (ex png to jpg) or any file format?
yes
d;HumanEntity#getCooldown
int getCooldown(@NotNull Material material)```
Description:
Get the cooldown time in ticks remaining for the specified material.
Returns:
the remaining cooldown time in ticks
Parameters:
material - the material to check
Requested by: GabyTM | RO • spigot
What's the problem?
how do you use it
wanted to check the cooldown for goat horn
Player#getCooldown(Material here)
ok
import org.bukkit.Material;
import org.bukkit.World;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.player.PlayerInteractEvent;
import org.checkerframework.checker.nullness.qual.NonNull;
import static org.bukkit.Material.*;
public class Listeners implements Listener {
@EventHandler
public void usedGoatHorn (PlayerInteractEvent e){
Player p = e.getPlayer();
Material goatHorn = e.getMaterial();
if (goatHorn == GOAT_HORN){
p.getCooldown(GOAT_HORN);
if (p.hasCooldown(GOAT_HORN)){
return;
} else {
World world = p.getWorld();
world.spawnEntity(p.getLocation(), EntityType.GOAT);
}
}
}
}```
check if this is correct
please
you don't need the getcooldown, I checked the wrong method, sorry
why not
well getCooldown will give you the remaining cooldown, and you don't need that
Your method is wrong anyways... You would need to put goatHorn not GOAT_HORN
thanks
yup