#help-development
1 messages ยท Page 1492 of 1
Ill show the code how im spawning my skull
something on your end
public PhysicalBox(Chicken chicken) {
Location skullLoc = chicken.getLocation();
ItemStack head = new ItemStack(Material.PLAYER_HEAD);
skullLoc.getBlock().setType(head.getType());
skull = changeSkin(skullLoc.getBlock(), "eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvNTA5ODcwNTk0OWZjNGM0YjI4ZWI4MzQ3NDVjNTc2YTFjMzVkOGQ3MDIyMGM5YTBiNTQyZGVmOGY0NzA5Nzc4YyJ9fX0=");
skull.getPersistentDataContainer().set(ChickenMap.key, PersistentDataType.STRING, UUID.randomUUID().toString());
skull.update();
spawnHologram(skull);
}
show us how you are adding the pdc data dn how you are testing it in explosion
I mean that seems pretty fine
@EventHandler
public void onBoxExplosion(EntityExplodeEvent e) {
List<Block> toRemove = new ArrayList<>();
for (Block b : e.blockList()) {
if (b.getType() == (Material.PLAYER_HEAD)) {
Skull skull = (Skull) b.getState();
if (skull.getPersistentDataContainer().has(ChickenMap.key, PersistentDataType.STRING)) {
toRemove.add(b);
}
}
}
e.blockList().removeAll(toRemove);
}
so yea no idea why it gets removed
maybe the b.getState() plays a role here
no idea
I would be more likely to suspect the setting of the PDC is wrong. perhaps your changeSkin method is not returning the correct BlockState.
its returning skull
can you check the existing head in the world
using like /data get block <x> <y> <z>
needs to be a blocke entity
i tried under interacting event
that if i click on a skull
it prints out the pdc
and it worked
are you setting the PDC data after the block has been placed? If you set it beforehand it will get removed
yeah
setting after block was placed
cant rly set it before anyways
I need to get the blockstate and cast it to skull
before setting the pdc
in your explode event try b.getLocation().getBlock()
just sysout?
In your explode event you are testing the block with b.getState() to then check if it has a PDC.
instead use b.getLocation().getBlock().getState() to ensure you have a current world BlockState and nothing funky is happening
i just need to change this
Skull skull = (Skull) b.getLocation().getBlock();
from getting the state to getting the block
It will probably do nothing, but lets just eliminate teh possibility that the explosion blockList is bad
I mean theres a cast error lol
block cannot be cast to skull
i need to use blockstate
yes, getState
how do you remove attributes from an item? Like the "attack speed" and whatever. Just need to hide from lore
declaration: package: org.bukkit.inventory.meta, interface: ItemMeta
combine the two, and voilร
thanks guys
maybe theres any other ways
i could check
if the skull was placed by my plugin
or is the mystery box
I mean, this should work
What was teh result of getting the skull from teh location?
you are 100% certain the placed skull contains the PDC value
yeah because
after its being placed
ive tried getting the pdc
in interacting event
by clicking the skull
placed skull has pdc
no fkin idea why it doesnt have it in entityexplode event
my plugin depends on the pdc
quick question, what version are you on
1.16.5
okay
What was the result of getting the skull from the location?
Casting error
OK, you ignored me.
b.getLocation().getBlock().getState()
I wanted you to get a fresh reference directly from the location to test if the explosion blocklist was a bad block copy
It shoudl be impossible, but there seems to be no other alternative, if as you say the block DOES have the PDC.
does that mean there's a bug in spigot for that event?
not sure ElgarL your method worked
it means the block list is not a deep clone
@EventHandler
public void onBoxExplosion(EntityExplodeEvent e) {
List<Block> toRemove = new ArrayList<>();
for (Block b : e.blockList()) {
System.out.println(b.getLocation().getBlock());
if (b.getType() == (Material.PLAYER_HEAD)) {
Skull skull = (Skull) b.getLocation().getBlock().getState();
if (skull.getPersistentDataContainer().has(ChickenMap.key, PersistentDataType.STRING)) {
toRemove.add(b);
}
}
}
e.blockList().removeAll(toRemove);
}
this code here works
It may be a bug in spigot, or teh block list in teh event is not a deep clone
there's nothing deep to clone about a block
a block is just a wrapper over a blocklocation
yes, however his code just proved a funkery
whether its new or old, the block instance is just a weakref to a world and three ints
whatever you retrieve from it goes through the world reference
It shoudl be, but if that were true his b.getState() woudl return the full Block with PDC.
the only case where that would happen is if b represents a different block than the other instance
it's a wrapper; there is no data stored in Block beyond the location
instead doing b.getLocation().getBlock().getState() does get the block with PDC.
getState deferences to the underlying world
Maybe some plugin is messing with the block list here
Somethgin is up with his explosion block list is all we know
Yes
im pretty sure
It will
I think it already did ?
fuck
Entities should now be stored separately similar to tile entities
i just implemented a parser in 1.16.5
oh
if its just adding entities
should be fine
but i dont want to fight the compact array again
The block pallet format isn't gonna change any time soon I hope
Thanks @eternal oxide
They already had to break that for 1.13 with material registry and block data/block state
Well yes but like. A parser had to already include them
and the chunk data format is a little different
Oh really ?
actually no
i read it wrong
\
they remvoed the amount of airblocks
in the packet
and turned it into this
mine didnt cause I didnt need it
still dont
public CraftBlockState(final Block block) {
this.world = (CraftWorld) block.getWorld();
this.position = ((CraftBlock) block).getPosition();
this.data = ((CraftBlock) block).getNMS();
this.flag = 3;
}
unless one of these is different on the returned Block instance, the end result is the same
getWorld and getPosition are self explanatory
public net.minecraft.server.IBlockData getNMS() {
return world.getType(position);
}
getNMS defers to the world
But yeah, I think 1.17 already moved entities out of the chunk data files
Into their own files
Besides that I don't know of any bigger change
there's no two ways around it; the block instance simply does not store any data
i didnt rly mess around
with 1.17 yet
REALLY HYPED FOR JAVA 16 THO
FINALLY
I CAN JUST SAY FUCK YOU
if the results are different for two block instances, then the blockpos/worldaccess of those blocks are different
WHEN SOMEONE ASKS TO SUPPORT JAVA 8
We will all miss reflection :(
Replied to the wrong one lol
?
Whaaaat
sorry ur stuck
in 1944
ye reflection is a bummer
but is it gone?
like for good?
no way
no it just got a vasectomy
The latter prevents you from modifying static final fields
Yes XD
Write those bytes yourself
wtf
just cuntpaste the java reflection impl from j8 and include it in a library
im quitting java
Good choice XD
i'm actually not sure which layer the new safeguards are on
going to just go full time rust
are they in the actual reflection impl that uses unsafe, or are they in unsafe itself?
Dunno either
based on how I haven't seen a "bring back j8 reflection" library that does what I mentioned I would guess it's actually in unsafe
then again I haven't really looked, either
i dare someone to use this https://wiki.vg/Protocol https://wiki.vg/Pre-release_protocol and make a cpp mc 1.17 or 1.16.5 server
Why would you ever want that
Like, java is already struggling with performance
muh interpreted language
I think there is a project for MC server in cpp
there are like a million c rewrites of minecraft servers out there
There is feather-rs for rust
check out feather-rs on github
weve been working on a rust implementation
Than you
of the minecraft server
1.16.5 tho
Quill is actually genius ngl
i dont think so
Sure npm 2.0 man
its literally just as fast
i dont think it is
I don't think he really knows what he is talking about ๐
he doesn't
fair
cpp is probs almost the fastest programming language
Sure ๐
java isnt fast lol cpp is faster than java
Yes. No one said otherwise
Concerning that java is basically interpreted it isn't much of a surprise it doesn't reach cpp speeds
but doesnt cpp have more performance
compared to code that runs natively like c/rust its obviously not as fast
yes it does
You don't get the fully compiled machine code speed rust/c offer
Lol nah
js is pretty fast
actually js is pretty fast
its close to cpp
eh
speeds
HAHAHAH
Oeh, JIT + Rust talk, fun times!
yo
not kidding
Latest js runtime
js is close to cpp
rConsole?
ye
:"D Nice
think its sick
Havent had much time to work on it lately unfortunately, school and such, should be able to do more work on it soon though ๐
The plugin written entirely in rust ? XD
The majority is
Lol
37% Rust to 29% java ๐
zit je nog op de middelbare?
I was actually thinking of writing some sort of Rust wrapper around Bukkit ๐ค
anyway cpp is faster to boot than java lol
java takes like 1 min or something
making a minecraft server in rust with plugin support
Worked on a modular plugin system in Rust today, pretty easy, and working on a library with proc macros to make JNI easier, so it should be an easy combination
Dunno what Java apps you code m8
think its gonna be a pain ngl
But 1 Mon is trash
java for me takes like 30 seconds - 1min
Oh probably, considering Bukkit is huge
Your minecraft server, or the JVM?
lmk when if u want help with that
jvm
What the :thonk
was doing something similar
Shag
when i start mc it takes like 1min
Your JVM needs 30 seconds to start ?
That's odd
isnt mac java outdated
I've never run into that anyways ๐ค
same as the opengl
Mac runs java 16 just as well as Windows or Linux
yup
i need to try on my pc
on there
u cant run opengl 4.5?
Interestingly, people are using Java 16 more than I though too!
rlly dont care tbh
Guys wanna move this into general maybe ? XD
These are Metrics I collect from my plugins, btw ๐
๐
Got a little far off help for spigot plugin development ๐ ๐
ye true
why are the colors a little off
Fair point yeah :"D
They arent ๐ค just some shading
uh but theres pure yellow and then in the thing yellow is fricking like more orange than yellow
thats kinda confusing ngl
Well no one said it's yellow ๐ It's whatever colour grafana gave it ๐คฃ
Yup ^_^
I'm also curious how fast the 1.17 adoption will be, since that's graphed too!
depends on what kind of plugins u have
the mc version section dont look accurate
They are accurate for the people using my plugins ๐
lol
Since I only can collect metrics from those servers ๐
cant you check other plugins metrics?
I could if I programmed it to I suppose, but I havent
Have a good nap Kitsune :"D
someone make a mc 1.16.5 server in haxe
Also working on a mechanism of doing over-the-air updates for the metrics library, should be pretty easy
well i mean it compiles to alot of languages including cpp so its kinda like making it in cpp still but
lol
who cares
lol
its another language
kinda
C++ :pepechrist: never again
its a bit like java
and maybe csharp
nap bro imma sleep LMAO
well, long nap then! :"D
lol
This is the metrics lib I use to collect those metrics above btw ๐ https://github.com/TheDutchMC/PluginStatLib
Cuz J16 it's amazing
Yep :"D I dont use it yet in development due to the lack of support by the majority of people, but hopefully soon โข๏ธ
I mean - I tend to just support the version that is newest so I will probs move to Java 16 for development
yeah Im on 11 now.
Up until now I have been using 8 but itโs a bit ehh
there's not much in 8+ that i miss
Its a good idea to move to 16 now as MC will require is very soon. See what issues you have before you are forced to.
diamond notation for anonymous classes, vars, and List.of and co, but that's about it
i guess some of the matcher methods introduced in j9 are nice qol stuff too, but I can do without
Oh MC is switching to J16?
I'm guessing they'll do J17 though, since thatll be an LTS release
Ooo did some reading into J16, JNI is finally on its way out :poggers:
Already did
And I just noticed, J9 introduced modules, which adds private fields you cant access with reflection. Hope mojang stays away from that ๐
is it possible to get the timestamp a player was last damaged or do i need to keep track of that myself
how much normally changes from version to version. I created a pretty large mini game in 1.16 and I wanna upgrade to 1.17 if possible, what in the past has changed from version to version?
Will have to track it yourself
also java 16 too
if you used reflection hacks to load jars at runtime
that will break
How bad is the strategy of force changing the library to the new one it's using and seeing where the ide yells at me
lol
I want to have a user input for my command and event
something kind of basic
like i do /explosionpower 10 and it sets it to 10
if (event.getAction() == Action.LEFT_CLICK_AIR) {
if (event.getItem() != null) {
if (event.getItem().getItemMeta().equals(ItemManager.wand.getItemMeta())) {
Player player = event.getPlayer();
player.getWorld().spawnEntity(player.getLocation(), EntityType.FIREBALL);
}
}
}``` event code
Player player = (Player) sender;
if (cmd.getName().equalsIgnoreCase("givecustomitem")) {
player.getInventory().addItem(new ItemStack[]{ItemManager.wand});
player.sendMessage("Left click to throw fireball, right click to blow up things");
return true;
}``` command i use to get the item
Item Managing class ```v
private static void createWand() {
ItemStack item = new ItemStack(Material.BLAZE_ROD, 1);
ItemMeta meta = item.getItemMeta();
meta.setDisplayName("ยง6CUSTOM STICK");
List<String> lore = new ArrayList();
lore.add("This stick was made in java");
meta.setLore(lore);
meta.addEnchant(Enchantment.DAMAGE_ALL, 32767, true);
item.setItemMeta(meta);
wand = item;
}
hi is there a way to stop color code?
?
e.setFormat(Main.color("&e"+playerData.getKills() + " "+ " &7["+ prefix +"&7]" + player.getName() + ": " + e.getMessage()));
the &7 color
is keep going to player.getname
and e.getmessage
i dont want that ..
&r
do you need it to keep through server restarts
than you can have a public hashmap that is <player,int> or <uuid,int>
alright, not sure what that is but i'll look into it! New to java.
imagine an arraylist but instead of using an int as the index you use any object type
this one being player
ok
public static map<player,int> [name] = new hashmap<>();
whats your goal?
more specifically, think of a mathematical function
you know, one key mapped to one value
like a key -> value relationship
I just got server from peble host chunks are not loading good when spigot comes will be better?
I want to get to learn java by making cheesy little plugins, they really helped me learn plugin development and java as a whole, I watched a 4 hour beginner video to get a foundation
I just started a week ago
or maybe 2 weeks ago
I want to build bigger plugins for my server eventually
Here are some links to get you started on learning Java:
- https://www.codecademy.com/learn/learn-java
- https://www.sololearn.com/learning/1068
- https://www.learnjavaonline.org/
- https://programmingbydoing.com/
- https://docs.oracle.com/javase/tutorial/java/index.html
The last one is the only official one, however some of those concepts assume that you already know a bit about programming.
Yea i have a good resource
u could look at the java docs also
if u want to learn spigot api u use the spigot docs
don't think there is a direct api way to do that
maybe listen for the event and cancel the damage?
https://docs.oracle.com/en/java/javase/16/docs/api/index.html
https://hub.spigotmc.org/javadocs/bukkit/
https://hub.spigotmc.org/javadocs/spigot/
module index
package index
package index
spawn an explosion effect
anyone know why when a player is riding a horse and moves out of render distance, the player freezes while the horse moves, then teleports to the horse when its in render distance
it'll do neither entity nor block damage
the player tracking range is higher than the horse tracking range
so the server doesn't send an entity destroy packet for the player
how do i fix that
i think paper has a patch for it
is there like a specific version
of
can i ask for help (free not paid ) iam making some plugins for my network and i would have another opinon of how i did things ( maybe i did the code in a bad way or smth . )
someone to check codes with me and see if i did things wrong ..
What constitutes a command activating a command block itโs facing and how can I use that with a command in my plugin
Quick question anyone know why when I join the server the book opens for a second then closes automatically?
is it possible for me to get this.plugin from a static context?
can someone help me with builing my plugin
There is no this in a static context
by definition
you could make a static variable containing the instance of the plugin
why do you need the plugin in a static context
java: error: invalid source release: 16```I get this when i build can soone help me
how do i do that?
thnks in advance
you learn java
don't make it public
create a getter method
exposing state, especially non-final state, is bad news bears
.
I've got the book to open on PlayerJoinEvent
Did you try delaying it
no I haven't will try
but i cant set the mainclass as static
you dont set the main class as static, you set a variable within the class as static
you can have a static variable in a nonstatic class
..
Hm doesn't seem to even open if I add a delay
classes are by default static
you can in fact not have a static field in a not-static class
my ide keeps demandding that i remove the static modifier
but top level classes are all static by default
Modifier 'static' not allowed here
can't he just do```java
private Main plugin;
public MyClass(Main plugin) {
this.plugin = plugin;
}```
well then thanks for contributing in that learning ;)
?learnjava
Here are some links to get you started on learning Java:
- https://www.codecademy.com/learn/learn-java
- https://www.sololearn.com/learning/1068
- https://www.learnjavaonline.org/
- https://programmingbydoing.com/
- https://docs.oracle.com/javase/tutorial/java/index.html
The last one is the only official one, however some of those concepts assume that you already know a bit about programming.
so this?
an utils class generally shouldn't need your plugin instance, but yes
next you need to make all of the methods non-static as well
instead of a you would name it whatever you class name is
and then store and retrieve a canonical instance
If I add a delay task on the PlayerJoinEvent will that delay the person joining?
no
What is the preferred way of having a static API class that can access your plugin instance
it will delay the task
I've seen some interesting methods to do so
how i can detect if player hit the back of a mob
so this?
i suppose the conceptually right way would be to get the call stack and get the plugin of the calling class
but that is inperformant and cancer
I've seen someone reflectively set a private static variable in said API class
seems fair
don't want to expose that as api
and don't want to rely on access modifiers since then you'd have to have the provider and the api class in the same package
why arent you verified NNY
and why dont you show when you are typing
How long is 600L?
600/20 s
it's 600 units
I assume you mean in a runnable
Yes Coll
So 600 ticks / 20
if you are asking how long is 600 ticks
Thank you guys
then the answer is there are 20 ticks in a second
WHAT THE FUCK FUCK YOU
i'm sure you can crunch the numbers
lmao
lul
rip
lol
now save it
save it and reboot
at that point
i cant even undo it because intellij is cancer
and then close the ide and go find a java tutorial
just start over
i hope your legs have o be surgically removed
bro chill
i hope you can get off your ass and find a java tutorial
so 40L is 2 seconds correct?
yes
@crisp citrus ```java
private static PotFill instance;
public static PotFill getInstance(){
return instance;
}
@Override
public void onEnable() {
instance = this;```
SECOND * 20
Ok thank you
that is how you get this
wait wdym
he doesn't know how to make a static method
awesome it works properly now
it's debatable whether he knows what a constructor is
i'm not going to be the one trying to explain DI to him
bro why are you so mad today
you haven't seen me mad
idk i guess wishing surgical leg removal and shit rubs off the wrong way on me
r u kidding. He's very patient always answering very basic and usually lazy questions
haha yea
he firsts flames the shit out of you
saying "just learn java"
and then says the answer
lmao
perhaps thats his way of saying "listen to me" :think:
they just never actually go learn java so I need to keep repeating the same shit over and over
yeah i can see how that'd get annoying
it's one thing to ask cause you can't figure something out and it's another to ask because you don't feel like solving it yourself
^
wow if it isn't the discordsrv developer themselves
and thats how you find out what "just fucking google it" is
i remember trying to report an issue to discordsrv once
An argument as old as time
Dependency injection or static singleton for the plugin main class
and you got a feature added just for you https://lol.scarsz.me/GiajuS/DiscordCanary-1623289520.png ยฏ_(ใ)_/ยฏ
because you made little effort to actually identify your issue
i had already identified the issue
you just didn't believe me
you wanted me to plug my server into a memory profiler or some shit
i already knew the cause
discordsrv inspired me to make a settings migrator on my plugin whenever I add new stuff to my settings.yml
namely you comparing a bazillion permissions
not our fault you completely refused to follow the instructions we gave
be difficult and expect difficulty back
i gave you everything you needed
i most certainly did
you didn't need a memory dump
so now we've come full circle with you refusing to follow my instructions
thanks for proving my point
i gave you what you needed
cool
I forgot are you suppose to put registerEvents in onDisable() too?
what would be the point of registering events when your plugin is disabling
Ok thanks
bukkit unregisters all events after it calls your onDisable
and also cancels all scheduled tasks
oh ok
is it possible to not do that?
lets say you have a delayed task
hm idk that doesnt make much sense
spawn a thread and sleep it, but no, not through the bukkit scheduler
I'm pretty confident in saying that you do not need to be doing that
but would be cool
yea but this way you avoid the need to storage when the task is going to happen in case the server stops
wut
not even sure what that's supposed to mean
can anyone help me if i can detect if a player backstab a mob
Compare the players direction and the mobs direction
or more specifically the player's relative position to the mob and the direction of the mob
there should not be much in the way of difference but with the fucked up protocol we have, who knows what might happen
@EventHandler(ignoreCancelled = true)
public void onEntityDamageByEntity(EntityDamageByEntityEvent event) {
float alpha = event.getEntity().getLocation().getYaw();
float beta = event.getDamager().getLocation().getYaw();
boolean backstab = Math.abs(alpha - beta) % 360 <= 90;
}
example of this
backstab would be true if the two entities were facing within 90 degrees of each other
but that's naive on it's own, you should be checking the location of the entities as well to make sure they don't somehow hit the other entity while they're on the side of them
can anyone help me with checking how to tell if a player has stopped breaking a block
I keep getting this error running my plugin
Caused by: java.lang.UnsupportedClassVersionError: me/TerrorGames/SurvivalGames/Main has been compiled by a more recent version of the Java Runtime (class file version 8243.8224), this version of the Java Runtime only recognizes class file versions up to 59.0
But I didn't compile the plugin in version 60 so idk what this means can anyone help Thanks!
Version 8243.8224
What
Double check your java installation and make sure the project is compiling with the right version
Also is java 59.0 a thing XD
yeah I think java 60.1 came out in may
Class file version != Java version
Thought it was?
yeah and I'm using JRE 1.8 to compile but it still shows the same error
No
Java 1.2 uses major version 46
Java 1.3 uses major version 47
Java 1.4 uses major version 48
Java 5 uses major version 49
Java 6 uses major version 50
Java 7 uses major version 51
Java 8 uses major version 52
Java 9 uses major version 53
Java 10 uses major version 54
Java 11 uses major version 55
Java 12 uses major version 56
Java 13 uses major version 57
Java 14 uses major version 58
Java 15 uses major version 59
Java 16 uses major version 60
Makes you wonder what the first 45 were
very basic question but how do i tell if a method is sync or async
I would assume checking whether it's on the main thread, or a thread synced with the main thread
In the bukkit API, everything is sync unless it mentions async
When are you doing it
Spammz0r
How can I add support of 1.12 to my plugin?
Itemstack & packets
Are you saying to implement via version?
Itโs a library
Mhm
Holly shit it's hot here
Gradle can handle maven repos
Iโm pretty sure there are sites to convert the pom entries too
I'm forking Bungeecord and I'd like to have the name of the fork be different from Bungeecord, similar to how other forks have their name, which files do I change?
what do i need to do to get buildtools to build the jars for java 16? i changed my java_home environment variable, downloaded the newest buildtools, and deleted the old bukkit, craftbukkit, and spigot folders that buildtools uses.
i still get "has been compiled by a more recent version of the Java Runtime (class file version 59.0)" errors on server start (as it tries to load my plugin) and im unsure what im missing.
Run the server with java 16
As far as I know you donโt need to do anything with buildtools
Hello! when I send player a packet, PacketPlayOutOpenWindow, I change inventory title, it affect on player see, but it does not affect in InventoryClickEvent. That mean in InventoryClickEvent it still in the old title(event::getView()::getTitle()) while player sees new title.
So, is there a way to change both sides?
Not with the API, probably with NMS
I can work with current situation, but just want to know if it is possible
Yes, then how about that?
You shouldnโt be using the name to identify inventories anyway
hmm so that would mean my environment variables are still incorrect then? im using: java -Xmx2G -Xms2G -jar X.jar nogui
to launch the server, do i need to change a different environment variable besides java_home?
(where X is the spigot server)
But can you tell me the way that using that NMS, what packet and how to do?
Not a packet
Youโll need to change whatever variable controls it
Of which I have no idea, youโre on your own with NMS
Don't tell me that if it is possible with NMS
No idea
If the API from spigot, sure it can't. But can with NMS?
Inventory sizes arenโt designed to change
Okay, I just see ShopGUI+ can do it
Are you sure they donโt open a new inventory
Sure, the cursor is still the same. But not mean they set client's cursor
You can always check their source
did you updateInventory
when you changed the title
EntityPlayer::updateinventory(container)
There's Player::updateInventory() too, but Idk what different. But just above, there is a container parameter exists, but Player::upda... does not have any parameter
alright found it
public void updateInventory(Container container) {
a(container, container.a());
}
ye try using that
method
from the EntityPlayer.class
if you want
or you can use the interface Player
either one is fine
As far as I know opening a new inventory doesnโt reset the cursor
As long as you donโt explicitly close the old one
But it does not work well
Use already, but it can be updated only in client side, what about in the server? For InventoryClickEvent::getView()::getTitle() works?
have you tried closing it and then reopening it after like 1 tick delay
with a changed title
The cursor change
It's the main reason, and it also still sometimes show the close and re-open like a glitch
Maybe this method should be better
I think ShopGUI+ replace the contents on the inventory.
And maybe they use InventoryHolder that holds type of the inventory.
how do you get the current plugin instance from a static context? ive tried: java private static MyPlugin instance; public static MyPlugin getInstance(){ return instance; } but it returns null for whatever reason
Because youโre not assigning it
@rigid otter why do you keep referring to methods with :: lol
idk ๐ I just see others usually do it, then just follow them
because its faster to type possibly
Three buttons to press vs using two with a #
It can be easily to see too
:: is for lambdas, # is for method references
how dare you objectify me
Haha
so ```java
private static final MyPlugin instance = new MyPlugin();
public static MyPlugin getInstance(){
return instance;
}
โฆno, assign it in your #onEnable
@rigid otter will this possibly works? so the cursor won't be repositioned?
https://paste.helpch.at/zixipujewa.java
You do not make a new instance of your plugin class ever
Only bukkitโs plugin manager should be doing that
@summer scroll why do you care so much about the cursor being repositioned?
I have an inventory GUI library by the way, if you want to check that out
Someone asking how to do that, and I'm finding a way to possibly do that.
like this? sorry if this extremely basic https://g1ga.is-a-skid.wtf/857410c.png
Pretend I @โd whoever is asking that question then
No. You need to declare the variable outside of your onEnable
You need to assign it inside
Ohh
I guess it's just personal preferences.
For example If you have pagination inventory, and you want to change page multiple times.
It's easier If the cursor doesn't reset.
Yep!
private static MyPlugin instance;
public void onEnable() {
MyPlugin.instance = this;
}
oh
I usually just store reference in some variables too(example store a Map<Player, Thing> then when need that thing, just get from the map)
@aglerr
Does paper miss some nms code?
Are you sure itโs the right version
No errors being thrown
Well only the missing ServerConnection class
And since its around startup
It wont start at all
Your using paper? Correct
You may be best aslong on their discord
Alright ๐
Asking*
Thanks for your help
Np
You guys know on the f3 screen in the top left it says like โspigot serverโ or something - can I change that (packets is fine)
Ideally not packets but I imagine that is how
it is a packet
@opal juniper
Thanks
Yes all config values are strings
Or they can be returned as ones
Youโd get it with Plugin#getConfig()#getString("Mode")
Intellij didnt like that a minute ago which is why I was confused
randomly works now

The greatest programming rule
Amen
you mean adding to a argument to an existing command?
I've done it like this
public List<String> onTabComplete(CommandSender sender, Command cmd, String label, String[] args) {
if (cmd.getName().equalsIgnoreCase("lock")) {
if (arguments.isEmpty()) {
arguments.add("cancel");
arguments.add("set");
arguments.add("remove");
arguments.add("info");
}
List<String> result = new ArrayList<String>();
if (args.length == 1) {
for (String a : arguments) {
if (a.toLowerCase().startsWith(args[0].toLowerCase()))
result.add(a);
}
return result;
}
}
Thanks!
I think it might have something to do with the jdk or something
it never documented before i think
is this the best way to rotate custom armorstand [ loot heads]
https://paste.md-5.net/aladefayeb.cs
when a bunch of errors related to bukkit methods popped up on my code, it had something to do with my jdk/.iml file/.xml file
basicly, I configured it wrong
set infinity resistance
any ideas guys?
set rotation
or head pos
ArmorStand.setHeadPose
set the direction
thank you guys ! , but i want it to rotate .. without lag on server ..
u calling this every second
you creating tick
well it should rotate every second ..
i guess
if you want to have a clean rotation => every tick
yes exactly
and that does not cause lags
just set the direction of the armorstand every tick and you are fine
Why my event is not working?
@EventHandler
public void onPlayerInteract(BlockPlaceEvent e) {
if (e.getPlayer().getInventory().getItemInHand().getItemMeta().getDisplayName().equalsIgnoreCase("&aMy Profile &7(Right Click)")) {
e.setCancelled(true);
}
}```
explain "not working"
There are alot of potential null pointer exceptions in your event code
not like that
I made a PlayerJoinEvent so when the people joins the server they get a head that named My Profile and i want players to not place this head
probably didn't setup your SDK
it says i have to define my project jdk
click on the add maven dependency
go download one or something
BlockPlaceEvent , check for the item name and cancel it
mvn clean install or setup your JDK
I already check the name but its not working
did you register the event?
Yes
coloredChat.chat
If I was you Iโd strip the colours
check placed block, i think?
What is that
i use smth like this :
coloredChat.chat("&aMy Profile &7(Right Click)")
try this in your check
getDisplayName() is returning a string with colour codes correct?
yup
WHY I CANNOT USE getInvisible LMAO
use isInvisible()
does a blockbreakevent trigger when an enderman takes a block?
no
I'm making a custom ore generation plugin and i have error. When I'm generating custom ore, that triggering BlockPhysicsEvent and i have error.
public static void setBlockMeta(Block b, String name, Note note, Instrument instrument) {
b.setType(Material.NOTE_BLOCK); // <--- ERROR
b.setMetadata("custom_block" , new FixedMetadataValue(getInstance(), name));
BlockData data = b.getBlockData();
NoteBlock noteb = (NoteBlock) data;
noteb.setNote(note);
noteb.setInstrument(instrument);
b.setBlockData(data);
b.getState().update();
}
}
what is problem?
should be entitychangeblockevent
does a blockexplodeevent trigger when a block creates an explosion, such as tnt, or when a block breaks from an explosion?
and what kind of error is this?
that would make it not fire for players
Could not pass event BlockPhysicsEvent to zACustoms v1.0-SNAPSHOT
org.bukkit.event.EventException: null
so the block is null.
yeah because its an enderman 
i need to place block before sets type?
yeah otherwise it doesn't exist
I need to make it fire for all mobs and players
could someone answer this?
but that detecting a type
@EventHandler
public void blockChange(BlockPhysicsEvent e) {
Block b = e.getBlock();
if (b.getType() == Material.NOTE_BLOCK) {
if (b.hasMetadata("custom_block")) Platinum.setOre(b);
}
}
make a custom event and fire it when one of the both events fire
answered to the wrong one
There is Platinum.setOre()
public static void setOre(Block b) {
Functions.setBlockMeta(b, "platinum",
new Note(1, Note.Tone.F, true),
Instrument.DIDGERIDOO
);
}
meant this
block can't be null
does the entitychangeblockevent fire when endermen place blocks?
should
any ideas?
i'll try
hey Iv'e made 2 plugins (economy and something that uses economy), the problem is that the plugin that uses the economy plugin loads before the economy plugin, how do I make it load after the economy plugin like other vault depended plugin do?
RegisteredServiceProvider<Economy> rsp = getServer().getServicesManager().getRegistration(Economy.class);
if (rsp == null) {
return false;
}
``` this returns false
while other plugins that use vault work
Depend on Vault, and listen to the service registration events to get the correct economy service
i have a problem when i respawn custom entity , only me can see it ..
other users can't
nice fps
I already have depend Vault
so the problem is with the Vault example code?
I am making a command block and have an issue
List<String> list = p.getConfig().getStringList("Commands");
if (list.contains(message))
In my config the command msg is allowed and when I do that command it works as expected. But when I use arguments in that command msg <player> <message> it says its not allowed. How can I see if the config contains just the base command (msg)
HELP .-.
Vault's example is wrong, yes - it tells you to retrieve the econ service once, but there's actually no guarantee the econ plugin will be registered if you do that
Ideally you should try and get the service on startup and listen to ServiceRegisterEvent to see if an econ plugin gets loaded after your plugin enables
Also, it's possible that someone might have two plugins with economies (eg EssentialsX/CMI and a dedicated econ plugin), and listening to the event lets you choose the highest priority service if it gets loaded later
got ya, thanks
are u use packets?
if it is, then send packets for all players
create for for Bukkit.getOnlinePlayers()
that doesn't help
Recently, I made a menu and i was testing it to see if it has a bug or not, after that when i clicked outside of the menu/inventory i got error, Can anyone help me to fix it?
For example when i click here i get error
check slot clicking
How?
InventoryClickEvent special for you
if(e.getSlot() == slotWhereYourItemIs)
/*do*/
ok
getClickedInventory returns null when you click outside the gui iirc
yeah or check if the clicked slot is -999 iirc
@EventHandler(priority = EventPriority.LOW)
public void onInventoryClick(InventoryClickEvent e) {
String Title = e.getInventory().getTitle();
if (e.getCurrentItem() == null) return;
if (e.getCurrentItem().getItemMeta() == null) return;
if (e.getCurrentItem().getItemMeta().getDisplayName() == null) return;
if (Title.equals(coloredChat.chat("&8My Profile"))) {
e.setCancelled(true);
if (e.getCurrentItem() == null) return;
if (Title.equals(coloredChat.chat("&8My Profile"))) {
Menus.MyProfileActions((Player) e.getWhoClicked(), e.getSlot(), e.getCurrentItem(), e.getInventory());
}
}
}```
Here is my listener
ItemMeta can not be null, i think
lol, check slot
method upper.
No doesn't it return -999?
it can
โฌ๏ธ
ok, then... Why he checking item before checking meta?
Wouldnโt that be getSlot and not getClickedInventory?
Returning an int in that method doesnt make sense
I thought u where talking about getSlot
Well getSlot probably returns -999 if youโre outside of the gui
Havenโt worked with spigot in a while ;P
I think u use getRawSlot() since you know
Everyone saying different things what should i do?
first check if the clicked inventory is null