#help-development
1 messages · Page 116 of 1
there should be some mod somewhere to be found
but it cannot be done by the server solely
It is custom font with empty char
That would require replacing all the numbers
or making the entire scoreboard a texture
and simply not using the vanilla one
hey, simple question, how would i run a task every tick
i know its posible with a scedular
BukkitScheduler scheduler = Bukkit.getScheduler();
scheduler.runTaskTimer(this, task -> {
if (!Bukkit.getOnlinePlayers().isEmpty()) {
everyTick();
}
}, 0L, 1L);
``` But isn't there just an method or event that does this ?
If you mean the internet, yes you can
You can remove that red number with core shaders
And the background
Example from some smart people
I assume you can only do one or the other as well
you can also do it with resource packs
Shaders are part of the resourcepack??
nop
but now you can edit almost everything, i don't know how it's possible but i saw some guys succeed with just rp
pretty certain shaders are part of resource packs these days
idk which version added the ability to include GLSL code in there
but it was a rather recent one
I saw somewhere a minimap made with a resource pack
Just don't allow offline mode it's even more frustrating
just firewall your backend servers
then there is no way to join offline
yeah
but they're safe
just ignore it lmao
IPs are not saved so you'll have to write your own
but why ?
IPs are in most cases not static
so it's kinda useless
I recommend to disable it asap ^^
and if you host something, create another network
what's your ISP ?
I'm 90% sure you can disable it
you'll have to search your account parameters
you're an easy target for hackers but it's ok
it makes you more trackable from an adventisers perspective, but nothing really worse than that
unless you make someone mad on irc
?ban @urban kernel
Done. That felt good.
Hi im trying build the plugin with another method for obfuscating and it said missing class org.bukkit.potion.PotionData
i imported spigot-api builded from Buildtools 1.8.8
Yes, they promoted illegal sites in principle
And they didnt really behave well in chat
🥲
ChatColor.DARK_GRAY + "Edition: #" + (plugin.editionNumber++),
like for example if this lore shows #1
in the chat the message shows as #2 and not as #1
player.sendMessage(ChatColor.RED + ((Player)sender).getName() + " §egave you a§e §cDctr's Space Helmet§c " + ChatColor.GOLD + "#" + (plugin.editionNumber++) + ChatColor.GOLD + "!");
you are incrementing editionNumber
ye ik but it should be the same number
not go up
the lore number and the message number should be the same
you are doing plugin.editionNumber++
twice
that will increment it
just store it as a local variable
int editionNumber = plugin.editionNumber++;
item.lore(editionNumber);
player.sendMessage(editionNumber);
show your code
just send the code here
We track these errors automatically, but if the problem persists feel free to contact us. In the meantime, try refreshing.
huh
idk
which class is it
editionNumber++ increment editionNumber by one each time you call it
then what do I do
bro I literally said what I wanted to do
and YES I TRIED BOTH
THE editionNumber like the dude with the anime dude said
wait 1m
got a question tho its more a theoretical thing than actual code yet
couldnt i make custom blockbench models, apply it via custom model data and put it correctly centered onto the mobs head to give it a new appearence. and when i want it to say attack, i make a 2nd model thats having the attack animation, set the custom model data of the head item to X and after the attack is done i reset it to its default state?
same for hurt animation etc
hey the second just use plugin.editionNumber I tried that
it still said different numbers
the lore said 1 and the message said 2
but I want it to say the same numbers
or is that a part im missing
OH
so one I kep ++
what the heck
bro I ment 1 "+=1"
yes he is, there is no way
ok but what do I do for the second one
bruh
learnjava isn't useful here. don't know what to say
my goshhh
thanks
++ is the same as +=1
plugin.editionNumber += 1;
plugin.editionNumber++;
plugin.editionNumber = plugin.editionNumber + 1;
there is some example, all 3 of those are same
am i dreaming
but take a note that plugin.editionNumber++ will first display the value, and increment later
if you want to increment first do ++plugin.editionNumber
if u wanna increment by one only🤣
nice to know, didn't know this one
How can I store an item that the player clicked in the inventory?
store as a variable or store in config ?
that is a bit rude
Haha gj!
happy you finally solved it
Not that way, let's assume the player clicks on a wooden sword. After clicking on the sword, a different inventory will come and he will choose how many of that sword he wants in that inventory. However, if I do not store the wooden sword, I cannot calculate how much money I will withdraw from the player.
I guess you have a method to open the second inventory, so just add in the method an Itemstack argument, and when calling the method to open the second inv, pass the clicked item on that method
for what
if(e.getClickedInventory().equals(Pazar.swordGUI)) {
switch (e.getSlot()) {
case 20: p.openInventory(Pazar.getInv1(new ItemStack(Material.STONE_SWORD)));
case 21:
case 22:
case 23:
case 24:
}
}``` inv1 is the gui where we choose the amount of the item we will buy. But even if I assign it as a parameter, what good would it do me? As a result, another gui will open and I will choose the amount from there.
Or if you work like that, you can have like a map saving for a player the last item he clicked, and retrieve it in the next inventory
Map<UUID, Itemstack> or whatever
so just before opening the next inventory, put the player and the itemstack in the map
If I understood correctly :
You have a GUI containing items, when someone click on an item, it opens a second GUI to select the quantity of this item, and according to which quantity you have to compute the price right ?
then give the item and withdraw the money
yes exactly
Someone pls help me to make this ._.
I did this. but its not blocking shulkerbox on player inv
So when the player click on the item in the first GUI, put in your Hashmap playerUID -> ItemStack. Then in the other inventory, you can get the ItemStack back from the playerUID
@EventHandler
public void playerKillEvent(PlayerDeathEvent event){
if(event.getEntity().getKiller() instanceof Player){
event.setKeepInventory(true);
}
}
``` I got this code, but when I get killed it stays in my inv and also drops
Is there possibly another plugin in this list causing the issue?
yeah that's what i was thinking, would ii store parties in a hashmap though, and if so would it be party leader per party member or party member per party leader
i'd assume party leader per party member because it would be hard to tell who the party leader is
I am not sure. check essentialsX
i already made an sphere and a cube
but was thinking about some strange shapes
any idea?
I don't think it would be essentials ill try go through all the plugins 1 by 1
80% sure it might be AureliumSKills
can be. check it first
but my code isn't the problem right?
getkiller already return Player. so I think you should check if its not null
ah cool thanks
depends on what you would like to do ^^
Is this the player that remember its pzrty or the party that save players ?
the party that saves players
or should i do the player that remembers it's party
Two possibilities :
- give a name or id to each party and save in a map id -> Party, and for each players save the party id.
- save directly the Party reference for each players
then you can access it very easily
Hello Guys Can I ask something?
yeah sure
how to import the nms? in my gradle is below!
compileOnly("org.spigotmc:spigot-api:1.18.2-R0.1-SNAPSHOT") // The Spigot API with no shadowing. Requires the OSS repo.
compileOnly("org.spigotmc:spigot:1.18.2-R0.1-SNAPSHOT")
I think it's not work,
Did you run buildtool ?
Yeah I run that
java -jar BuildTools.jar --rev 1.18.2 --remapped
if(e.getClickedInventory().equals(Pazar.swordGUI)) {
switch (e.getSlot()) {
case 20: new HashMap<UUID, ItemStack>().put(p.getUniqueId(), new ItemStack(Material.STONE_SWORD));
case 21:
case 22:
case 23:
case 24:
}
}```
like this?
add mavenLocal() in your repositories and also
Ahh ok I'll
maven { url = 'https://oss.sonatype.org/content/repositories/snapshots' }
maven { url = 'https://oss.sonatype.org/content/repositories/central' }
your hashmap need to be a variable that you can access
repositories {
maven { url 'https://jitpack.io' }
maven { url "https://mvn.lumine.io/repository/maven-public/" }
maven { url "https://mvn.lumine.io/repository/maven-public/" }
maven { url = 'https://repo.codemc.org/repository/maven-public/' }
maven { url = 'https://oss.sonatype.org/content/repositories/snapshots' }
maven { url = 'https://oss.sonatype.org/content/repositories/central' }
maven { url = 'https://oss.sonatype.org/content/repositories/snapshots' }
maven { url = 'https://oss.sonatype.org/content/repositories/central' }
mavenLocal()
}
dependencies {
compileOnly("org.spigotmc:spigot-api:1.18.2-R0.1-SNAPSHOT")
// The Spigot API with no shadowing. Requires the OSS repo.
compileOnly("org.spigotmc:spigot:1.18.2-R0.1-SNAPSHOT")
compileOnly fileTree(dir: 'api', include: ['*.jar'])
implementation 'org.reflections:reflections:0.10.2'
}
rn you're creating an hashmap each time
is that right?
well you have some stuff that is duplicated but it should be
oh wait
refer to this page
The home of Spigot a high performance, no lag customized CraftBukkit Minecraft server API, and BungeeCord, the cloud server proxy.
there is everything in there
ahh
I don't know why should I build first to use nms
and
bad class file: C:\Users\SkyExcel.gradle\caches\modules-2\files-2.1\org.spigotmc\spigot\1.18.2-R0.1-SNAPSHOT\884b3b6772862b8898b8b837cea8c00c1055833d\spigot-1.18.2-R0.1-SNAPSHOT.jar(org/bukkit/craftbukkit/v1_18_R2/inventory/CraftItemStack.class)
class file has wrong version 60.0, should be 52.0
Please remove or make sure it appears in the correct subdirectory of the classpath.
!scheduler
what's the command
damn
I rebuild my project but it doesn't work
?scheduling
ty
update your java version
did you put everything of the wiki page ?
should i add the file build.gradle.kts? 'cause I can't find it in my project
I'm using Java
well can you try with the last version (1.19) ?
Ok just change the version 1.18,2 to 1.19? like
org.spigotmc:spigot-api:1.19-R0.1-SNAPSHOT
- No context nor code
- I see it's not Java nor Kotlin so wrong channel
- You're not using spigot
How dare you ? 😂
it's plugin load error
Yes please, just to be sure
Are you the author of Skript ?
no
So how do you want us to help you with a plugin that is not yours ?
i though u could help me
No we can't
#help-server probably can
go to #help-server
ok
It's still the same 😢 https://paste.md-5.net/ripeqokeyo.php here's my gradle
and did you build spigot 1.19 with buildtool ?
?bt
don't forget --remapped
Well you need 1.19 and not 1.18 but yes
I'm trying again in 1.18 and if it's not working I'm gonna change :>
Inventory inventory = e.getClickedInventory();
if(inventory.equals(Pazar.swordGUI) ||
inventory.equals(Pazar.foodGUI) ||
inventory.equals(Pazar.blockGUI) ||
inventory.equals(Pazar.mineGUI) ||
inventory.equals(Pazar.toolGUI) ) {
e.setCancelled(true);
}
``` Somehow its not entering this case. The GUI'S all instanced. I instanced the inventory too but still not entering the case.
minimessage works with 1.18+ correct?
Whats wrong here?
I am trying to make
if player open echest, and he try to put more then 5 shuklerbox in echest from his inv, it will break
Considering I think adventure works with 1.19 and MiniMessage was merged with Adventure... I'd assume it probably works
oh god you're still at this
so 1.19
alr
thanks
and yes they did merge
pls help ._.
You have to verify to do that
!verify
Usage: !verify <forums username>
check the distance when they move
after build tool
show your code
anyone can help me?
if (player.getLocation().distance(centerLocation) > distance)```
or event.getTo().distance(center)
isnt #distance quite expensive tho?
your code is testing player location not the event location of getTo
not really. Everyone says yes, but when you are telking about a few players sqrt is not that costly
is a utils class basically a bunch of static methods
usually yes
ah i was under the impression that i should avoid it as much as possible
It just depends how much you need to use it
if you used it for every player event single movement (not just when they move to a different block) it could get costly, but even then when it's a handful of players its nothing to worry about.
bit far fetched but is it possible to create a virtual server environment for JUnit testing?
yeah i remember there was one, just cant remember the name
Mockito
awesome thanks
How do I remove certain Items from dropps when a player dies? Ex: Player dies, only drops soups
listen to the event, get all drops from the event and remove those you don't want
hi guys
i got an general java question
i make a list contaning materials for example
each time i request from it will load it
how it works?
with lists
"each time i request from it will load it"
What does that mean?
I mean like what goes in the background
do you know what's the difference between arrays and lists ?
for example if u store an object in hashmap Object , integer ... and put once again it will replace
now
the question is how it would work
it would replace or re create a new one
i want to create a list of materials and accses it very often
lets say i will take if from config thanks for the answers.
depends on what list impl lol
a list is basically multiple boxes. each box contains a value, and the address of the next box. so to get the 3rd box you have to go through the 3 first boxes.
while array doesn't store address of the next box, they're all together
like the behavior of the java
So the List<T> holds references to your Objects.
A list can contain duplicate values and null. This means you can have
a list that looks like this:
[1, 1, 1, 2, 2, 4, 4, 1, null, 1, null]
If you call .contains(Object)
then it will iterate through all elements and check if
it is equal to your searched element.
an arraylist just stores an array with your stuff internally
Alright but once i made a list
it loads up to cache like hashmap once?
or it does a request eachtime like to an database
that doesn't make sense
Rolyn im asking because im wondering
Everything you do is stored in RAM. Every data you see is simply in RAM. Nothing needs to be loaded in a "cache".
its loaded into Ram once in start right?
like an hashmap
i'm not trolling guys dont lose your mind please.
If you mean "allocate memory" the answer is no, neither for hashmap
your program loads into the ram memory
There is no "loading into ram"
If you use the new keyword then you allocate a block of memory.
arrays allocate memory
thanks.
so basically once i made a one and it will be in the Ram thats it
i understand
it will not re make more and more lists and over load ram
i ask it because im not sure about the behavior of list
if you add stuff to the list it will grow
yeah yeah i know
it's not fix
i mean like so if Class A > asks list (it doesnt create another list and another list and another list each time...)
just an idiot told me something like it
oh no
so i was asking because i was kinda not gonna use that shit
You can have the same object stored a million times in a List if you keep adding it.
A List doesnt replace already contained object. It just appends them.
I clicked a item in gui. now how can I check if the item from upper inv?
nah i dont speak objects just someone told me a while ago that Lists work like Once lets say i need to read something from List it will load another list into memory
Check if the clicked inv is equal to the upper inv
sounds bullshit yeah i just had to ask because if it would work that way would be crazy damage to performance
lol
In java, your variable store a reference (address to the memory) except for primitives types (int, double, ...)
so you pass the address, not the list
Well there are some List implementations that will do a lot of copying like the CopyOnWriteArrayList
Its only used for very specific thread safe operations.
How do I export my jar with this org.apache.commons.io.jar included?
Switch your project to maven or gradle and we'll help
I'm sure someone can help with eclipse
You'll have to wait a long time
I'm not even sure it's possible with the Eclipse package system
No, you can't. You'll have to use Maven or Gradle
That being said, I want to say Commons IO is actually part of Bukkit?
I thought it was only apache commons lang
Link to Maven
You might be able to do it with the "Export runnable jar option"
But I am not too sure if it is possible to shade in just select few dependencies
will a runnable jar work for a plugin?
Yes, but I have never tested it out
Chances are it shades in ANY dependency, it has been a long while since I used it
It's not letting me proceed. Doesn't have any options in the Launch configuration: dropdown
Just use maven. That's the common way of doing it anyway
have you created a lunch configuration?
If not there will not be any there
Also, why do you want it as a runnable jar?
They want to shade a dependency
Thats definitely not how to do it
Maybe he's already swapping to maven or gradle
Then I am mistaken
Create runnable jar does shade stuff in, but it is a bit more complicated than that and as such not worth it
If you keep down that path, to get that to work you NEED a main method. You MUST have created a launch profilet to execute that main method, then you can export.
simpler to export as a jar, not runnable.
Yeah, crafting a launch profile from hand (Eclipse provides no fancy GUI for that afaik) just to shade in a dependency is a fool's errand
Best just not shade the dependency at all and declare the lib in the plugin.yml file
Its not hard in eclipse, just pointless
Is it easier to convert a project to maven or gradle from eclipse
https://paste.md-5.net/umiboyizet.md trying to implement a class system but the instance is null for some reason? i'm doing everything the way it's supposed to be?
idk i'm confused
Can someone tell my why my killer is always null?
@EventHandler
public void onDeath(PlayerDeathEvent event) {
Player player = event.getEntity();
Player killer = player.getKiller();
SOME MORE CODE
}```
error ```
Caused by: java.lang.NullPointerException: Cannot invoke "org.bukkit.entity.Player.sendMessage(String)" because "killer" is null
at koast.listeners.PlayerRespawn.onDeath(PlayerRespawn.java:29) ~[?:?]
at jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:104) ~[?:?]
at java.lang.reflect.Method.invoke(Method.java:577) ~[?:?]
at org.bukkit.plugin.java.JavaPluginLoader$1.execute(JavaPluginLoader.java:306) ~[spigot.jar:git-Spigot-21fe707-741a1bd]
... 40 more``` Line in Code: `player.sendMessage(Main.prefix + "You were killed by§6 " + killer.getName());`
Convert to maven
What happens if the player jumps in lava?
So Maven is a plugin, not an IDE?
Well m2e is the eclipse plugin
I can test, I also put a if statement if(killer != null) { do code } the code wont be executed
Maven is just a build tool, can be even used without an IDE
Is there a dedicated ide for Maven
And/or can I export with shading using the M2E plugin
The same, if I put a if statement to check ifs not null the code wont be executed, and I know why. But the problem is killer is always zero even if another guy kills the player who died
hey, anyone have any idea if I put a fake packet-only block on the map for a player and then fire an arrow from the server, how does the arrow resolve when going through the block client-side? Does it just get completely ignored?
NVM, found out why
I believe it just flies through the blocks like normal
No, but you can use m2e (which is installed by default) to run a maven goal (or well, lifecycle) to build the shaded jar
Ok, can you help me do this. I'm so frustrated
thanks
how could i remove a single block from the drops of a blockBreakEvent?
BlockDropItemEvent
I.e. using this
Everywhere I look online says there should be a "convert to maven" ption
Anybody know how I cancel knockback? And without cancelling the knockback and adding the damage to the player? If yes please let me know.
Then you did not install the eclipse m2e plugin
Which is strange given that that is the default
well yeah but how exactly would i remove the item? sorry im pretty new to spigot
1 tick after the damage event set their velocity to 0
okay I can try that
Iirc they are item entities, so just call .remove on it
I guess you probably made the beginner mistake of installing eclipse for java EE, and not eclipse for java se
how can I get the item I just selected from a inv?
getCursor or getOldCursor
getCurrentItem
From InventoryDragEvent
ah i porbably didnt expressmyself right, I'm making a replant enchantment and wanted to only remove a single seed/carrot/potato/beetroot see
Get the item stack from the entity, remove one, set it back to the entity
^
@thin delta Again, if you want to target only minecraft versions after 1.17.2, you can also declare the dependency in the plugin.yml, spigot will automatically download it at runtime then
I'm doing version 1.16.5 😦
thanks ill try that
oof
At worst install eclipse eierlegende wollmilchsau
Another reason could be that you already have the maven nature set, in which case the "convert to maven project" option vanishes
Someone help me :")
I just put an item from bottom inv to upper inv. how can I get the item from InventoryDragEvent?
Check the Javadocs
Looks like I've got the plugin
Oh boy that be old eclipse
Yeah, then you most likely have the maven nature already set. What is the icon of your project?
If there is a "M" next to the "J" everything is okay - you just need to manually create the pom.xml
If it isn't we got a problem - gradle would be the next-easiest solution then
hey guys, how do we run dispatchCommand sync
?jd-s developers these days
declaration: package: org.bukkit.scheduler, interface: BukkitScheduler
Yeah, gradle was an option, so I just used that
use runTask from the scheduler
Or just callSyncMethod which is meant for that
alright
then you have the gradle nature
your plugin
callSyncMethod is for when you need the return value
?di
Guide to dependency injection: https://www.spigotmc.org/wiki/using-dependency-injection/
callables do not have return values I think
Ah, actually no
So for exporting while my project has gradle nature, is it the same process as normal exporting with eclipse?
They are basically suppliers
how can i made it so when a PlayerChatEvent or AsyncPlayerChatEvent gets canceled a event gets triggered?
like a CancelListener(OnCancelEvent e)
No, you'd run gradle tasks
Listen for the event in the Monitor priority and check event.isCancelled
so i should pass the class
yes
Your plugin
How do i use the monitor prority? i know how to do @EventHandler(priority=EventPriority.MONITOR) but idk how to use it to get the cancel check
You have only one plugin
What is so hard to understand with plugin
You have one plugin, not more
yes......... im just asking if its the class lmao
Not the class instance
you just check event.isCancelled() and do stuff
but nothing to the event, just run your method or whatever
as docs, it should be getOldCursor() but not working
Thanks very much!
basically in gradle you'd click on the "shadowJar" option in the "Gradle tasks" view (which is a bit hard to get admittedly)
eclipse folders like from 1900
ok so i have MyPlugin extends JavaPlugin and im passing new MyPlugin() for the plugin
no
?di
Guide to dependency injection: https://www.spigotmc.org/wiki/using-dependency-injection/
geol going crazy
understandable
hope he understands anything of that guide tho
so this
Possibly, possibly not
if you're in your class extending JavaPlugin
....
actually its inside an event
What's your main class called?
Or better said: If it compiles yes, otherwise no
Lol
my plugins name
and what is that..
MineauApi
what's the name of your event class?
ok
Performance be dammed, but it works
its in onEnable, but im using a Timer
Just try to put this there and see if it works.
Ok, I need to figure out how to get to this
not sure
with the event
What is there to not be sure about?
You put this there, if it compiles then it's correct, if not it's probably wrong
cause its in an event
Just try it dude
.
And do NOT cast.
^
If you need to cast, something is wrong
He trying to do di or what?
how to check what plugin canceled the event ?
I just put an item from bottom inv to upper inv. how can I get the item from InventoryDragEvent?
from docs I found getOldCursor() but its not working
you can't iirc
No idea and at that point I can only recommend JavaPlugin#getPlugin
I think you can with some jank involving stack traces
Only if you are using a custom event though
I think the better question is, why would you need that
And in that case stack traces are not the only option
The conditions that require such a thing arise from time to time
i am making a plugin that detects event cancels for example if a server gets backdoored and someone is trying to run a command like !help or something in chat and it gets canceled i can easily know what plugin is causing that but if someone gets muted i want to know the name of the plugin before i tell the user that this event got canceled or something
I don't have the Shadow option 😦
Bukkit.getScheduler().runTask(this, () -> Bukkit.dispatchCommand(player, "command args")); did this, is it correct?
what are you trying to do?
ofcourse i will replace command args with my command
just give an item from another plugin
from my plugin
You need to have the shadow plugin for that
i.e crates/ranks
But since you have no gradle files yet, I'd go with build setup > init
but basically im just tryna make buy-craft without tebex and stuff
^^
^
the reason
Ok I just did that
Is it a event class you have control of?
what do you mean?
No
basically whether you can override the setCancelled method
Then if you are willing to wait I can write a library that does exactly that, but that might take at least a day and I'll warn your upfront: the solution isn't exactly "sane"
wait wait
are u sure u understand what i want to do?
i just want to make sure i can detect what plugin is doing setCanceled(true);
what does getOldCursor() return from InventoryDragEvent?
How?
Mass ASM
whats asm
As I said - the solution is not sane
Is there a better way to if the item with that name got clicked in a Inventory than if then else if and so on? If yea, please tell me
Modifing the bytecode of other plugins before they run
ohh i think i know a library like it its called javassist
You cannot use the in bukkit
Yeah that's the lib that most malware use
Okay thats okay
yea
thats how i know it
they use it to inject other plugins
listen if u can make something like that
thats great
Yeah, only that we actually don't inject into other plugins
Yep
but i cant pay money for it
i dont have money to pay
Nah, I'd be willing to do it for free
Okay great
I have most classes written for it, I'd just need to write the transformer
inb4 geol just infects you with malware now (just kidding)
Thanks very much
It is a double-edged sword
what does getOldCursor() return from InventoryDragEvent?
anyone can explain pls?
Mixins takes care of what I need
By the way, does anyone have any experience with the Minecraft plugin for IntelliJ? I used it to set up my plugin project, and when I compile it there's a plugin.yml in the JAR file, but it's not the plugin.yml that I have in my project, that one seems to get ignored.
Where did you put the plugin.yml?
Hey guys Can I get NBTData without NBT-API?
Yeah you can rewrite what NBT API does
What do you use for mixins
Which is a lot of work that isn't needed
Oh wait, it needs to go into the root src directory, doesn't it... I'm f***ing stupid lol
?
For some reason I was convinced that I had it in the right place
It needs to be in the resources folder
what does getOldCursor() return from InventoryDragEvent?
anyone can explain pls?
Really? I think many people say it should be the src directory
The Minecraft Dev plugin should already have put it there for you
OH WOW YES IT DID
Holy crap
It's gonna be so hard 🤣 Rather be using API Lmao :>
What NBT do you want to read?
Because there might be an API alternative
Ahh
Hopes you aren't using 1.8
Yeah I'm using 1.18.2
How can I get the dragged item from InventoryDragEvent?
Like ItemMeta?
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.
declaration: package: org.bukkit.event.inventory, class: InventoryDragEvent
Are you using them with spigot? Because I know you need some kind of program for that to work
- Haven't actually used it
I use Mixins when modding never used it in a plugin
Oh Are u asking to me?
Yes
Opps I want to save inventory
But just Itemstack it's not gonna save with nbt data So,, Yeah
Do you want to save it on to any item?
Yeah
https://github.com/JEFF-Media-GbR/MorePersistentDataTypes
^ and this small lib makes it super easy to store item stacks
Yeah
oh it can save the chest inventory too?
What I meant by that was the vanilla nbt that that allows placed tile entities (like chests) to have an inventory of items when placed
Sort of like a Shulker box
?
?? It work same as on it?
What's spigot bukkit
Ahh And it cannot save inventory as (Bukkit.createinventory)?
is it possible to add a second item as an output for anvil repairs without making a completely custom gui?
and if not, can i even make a functioning text input field in a custom gui
Does the spigot website have an API, and if so, can I upload new releases to my plugin automatically?
No
You need to register it
Its registered
Well, with the context you've given, nothing seems to be wrong then
I can't see anything that can block it. IDK what happening :/
Show the code...?
To save an inventory all you really need to store is the size, name and contents. That's easy to do
I have a huge task but I just tested by canceling. but problem is its not canceling all drag events
Everything related to the event that is
Oh perharps you're getting the notion wrong, dragging would clicking and dragging items along the inventory to spread them out: Maybe you want the InventoryClickEvent?
Umm, I think I can do my task with clickevent. Let me check
is Entity.getKiller(), null when the killer was in creative mode?
Thank uuu
so wait is it possible to make an arrow that doesn't stick to anything by creating that arrow only via packet?
Yeah
Ok, I did init, but it doesn't look like it added the shadow option yet
You also need to add the shadow plugin (for gradle - not in eclipse)
It gets a bit more complicated than that in gradle I am afraid
Just add (keeping previously existing plugins if there are any)
plugins {
// Apply the java-library plugin to add support for Java Library
id 'java-library'
id "com.github.johnrengelman.shadow" version "7.0.0"
}
to the top of the build.gradle file
Then you need to declare dependencies with the right scope (so provided for anything you don't want to shade and implementation for everything you want to shade)
Where do I find the build.gradle file?
nvm
refreshed the project and they are there
Ok, so this is what mine looks like now
plugins {
// Apply the Java Gradle plugin development plugin to add support for developing Gradle plugins
id 'java-gradle-plugin'
id 'java-library'
id "com.github.johnrengelman.shadow" version "7.0.0"
}
dependencies {
// Use JUnit test framework for unit tests
testImplementation 'junit:junit:4.12'
compile 'org.apache.commons.io'
compile group: 'commons-io', name: 'commons-io', version: '2.6'
}
Since org.apache.commons.io.jar is what I wanted included in the export?
compile != implementation
Also you'll need to fix that dependency so it has groupId:ArtifactId:version
Edited. Is it correct now?
Oh my. What's with all the static usage?
You'd want to remove compile 'org.apache.commons.io'
Dependencies are shaded in on a per-dependency basis
You know that you can use classes in other files without the use of static right?
So line compile group: 'commons-io', name: 'commons-io', version: '2.6' would already include commons-io in your shaded jar
Potentially. The static keyword has very specific usecases and when it comes to plugin development, it's seldom used.
Also, some things to note about yml files.
- Using #saveResource(string, true) will overwrite any existing file that is on the disk. It basically makes the config useless if you are going to overwrite changes every single time.
- The use of quotation marks in yaml isn't actually necessary in most cases.
#Both are valid sections!
section: "Hello there!"
section2: Hello there!
#However, when you need to use single quotes, you need to surround your string in quotation marks.
section3: "Let's go!"
#Alternatively, you could use the double single quote method
section4: 'Let''s go!'
Probably because your instance of FileConfiguration is null.
Because you never define it before using it
- Using #saveResource(string, true) will overwrite any existing file that is on the disk. It basically makes the config useless if you are going to overwrite changes every single time.
he checks if the file exists before saving resource
Oh, didn't catch that. 😛 He could replace it with a #saveResource(string, false) though. It takes care of that.
public enum FirstLevelDungeonStage {
S0(0, 0),
S1(1, 4),
S2(2, 6),
S3(3, 8),
S4(4, 10),
BOSS(5, 1);
private int n;
private int amountOfMobs;
FirstLevelDungeonStage(int n, int amountOfMobs) {
this.n = n;
this.amountOfMobs = amountOfMobs;
}
public int getN() {
return this.n;
}
public int getAmountOfMobs() {
return this.amountOfMobs;
}
}
If I wanted a method in another class called 'progress()', which moves the player to the next stage. How would I get the next item in this enum?
@fervent gate https://www.baeldung.com/java-enum-simple-state-machine
I have a multi module maven project with a "Commons" module, shared across the rest of the modules. For some reason, after an ide restart, Intellij/Maven added the module to the local repo and is now ignoring the "Commons" module, alongside any modifications I do. How do I make it assume the dependency from the project again?
Through the power of MATHEMATICS!
private static final YourEnum[] values = values();
YourEnum() {}
public YourEnum getNext() {
return values[(this.ordinal() + 1) % values.length];
}
public YourEnum getPrevious() {
if (this.ordinal() == 0) {
return values[values.length - 1];
}
return values[(this.ordinal() - 1) % values.length];
}
Also valid
Ok, I did this. It is erroring now...
Would having the version incorrect cause it to blow up?
im not 100% sure on the version
Yeah I'm looking at the versions right now
// https://mvnrepository.com/artifact/commons-io/commons-io
implementation group: 'commons-io', name: 'commons-io', version: '2.11.0'
oh, so not compile group?
Best use implementation
plugins {
// Apply the Java Gradle plugin development plugin to add support for developing Gradle plugins
id 'java-gradle-plugin'
id 'java-library'
id "com.github.johnrengelman.shadow" version "7.0.0"
}
dependencies {
// Use JUnit test framework for unit tests
testImplementation 'junit:junit:4.12'
implementation group: 'commons-io', name: 'commons-io', version: '2.11.0'
}
compile is deprecated
Yeah that should work
capitals in packages 
Will Entity#getHealth() always return <=0 in an EntityDeathEvent even when it was a creeper at full health exploding?
asking cuz I dont have access to a test server rn
Host one on your pc?
personally i think it will return positive hp
since im pretty sure when the event is fired the entity is not dead yet
its just about to happen
fair enough, just gonna assume that for now 🙂
yea defo wanna test that out when you get a test server running tho
The event is not cancellable so I'd assume it was after death, but before drops. So I would expect health to be 0
that could be an option as well

its all a big ruse!
im trying to set an int to an item using nbt api and then gather the int
public int getTierFarmerMask(ItemStack stack) {
return new NBTItem(stack).getInteger("tier");
}
Bukkit.broadcastMessage(String.valueOf(getTierFarmerMask(stack)));
and it is just returning 0 when i set it to 1
too old to use pdc?
It's a sad world we live in. Wen forge policy on versions 
You are more than welcome to pull out your abacus and give advice 😉
weeeeee
I think my gradle init screwed up....
Use pdc
whats pdc
?pdc
Hey why does "&r" not change the format of the string when in a Text element? It works perfectly when I send it as a string to the player, however, I'd like to send it as a hover event
The "&" sign doesnt do anything.
You need to translate the color code.
I have translate color codes already
This just means that the parent component has a style. Changing the style of a children wont do anything.
ah so in a Text component you can't have bold and unbold? Its just one or the other?
Does anyone know why, eventhough my player is spectating this armour stand, it doesnt rotate the player camera as well
you can chain components. One bold and one not bold.
Even in the hover event?
Yes
Alright ill try to find a way to make that work. Im trying to do it fully dynamic, so fun 😄
Maybe armorstands don't have that feature out of the box? Does it work on other entities?
How do I detect a specific item on itempickup? eg. I want to remove all tags from any type of wool block, plank, endstone, obsidian, terracotta, ladders, etc.
it did work a while ago i think, ill change it out real quich
Get the item material on pickup and return that instead of the original item.
Item -> getItemStack -> getType -> check if the type is in a Set<Material>
👍 ty!
is there a way to add a second item to the anvil output?
with a custom gui i wont be able to make the text input work and i dont think this is possible with the default gui
The anvil output is only one slot in size. How do you expect to add more items?
@kind hatch it works until it hits a limit for mobs
yeah thats what i thought
Weird, I would have expected your head to be tied to the direction that the entity is facing. It looks like there is some room for play.
i thought maybe i could put a second item in the same slot after you take the first one out but theres no event for pulling the item out
Sure you can make that work. But i wouldnt recommend it.
What are you trying to do?
Maybe you could cancel the output item on click. Then just let the player click the output until they get all the items they need.
wanna rework the way you repair tools
trying to implement left over scrap after repairing that you can later reuse
so i need some way to give the player that scrap
and just adding it into the player inventory feels cheap
Just add it to his inventory or put it in the output slot after you used the anvil
Why not use the input slots for that then? If you have extra repair material, they aren't removed.
I'm assuming that you would take item + scrap = repaired item This is essential what the anvil is. Are you doing something different from this formula?
i need some entity that is better for this 🤔
the problem isnt that, the problem is item + material = repaired item + leftover scrap
Well, are you in first person or third person? Or is this a weird mix of third person perspective but offset from the original location?
it will be first, but i was showing in the third
Yea, so can't you use the anvil as intended? If you have extra repair material, the anvil will only use what is necessary. Any leftover scrap will remain in the second input slot. So the player's can just grab it back out if there is too much.
the scrap and the material isnt the same item
i cant just throw it in the input slot
Oh? Then can you give an example for this?
its a completely separate, second output item
Does it look different in the first person perspective? I wonder if the third person perspective has some weird issues.
nope
lets say you have a broken diamond pickaxe
you throw it in an anvil with some diamonds, it repairs the item and leaves you with the left over diamonds in the second input slot, the pickaxe in the output slot and some diamond scrap that isnt a diamond, but a custom item
where do i put the scraps
i need a second output slot or some way to reuse the first one
that would be possible if there was an event for pulling out the item from the anvil, but theres just the prepare event
Yea, I was going to say, you might be able to use the first slot if you are only putting in one item.
so youre saying throw the scrap in the first slot?
where the broken pickaxe used to be
Yes, but you would need to do it after the pickaxe is repaired.
gonna try teleporting the player head aswell
Would have been my next suggestion.
has no effect
anyone can recommend good api for GUI
Does the CraftItemEvent not fire in anvils?
doubt it
triumph is decent
InventoryClickEvent
that might work
shulker bullet works, but is jittery @kind hatch
did you mess with your setttings.gradle
does running gradle manually compile ?
I don't think eclipse is known for great gradle integration
I'm still trying to figure out gradle...
I just need it to use its shadow feature on my project to include a library in my exported jar...
I mean, it might still work ?
have you tried just running gradle shadowJar from your terminal ?
Nope. I'm not sure how to
Oh, I think I need to update gradle?
of the shadow plugin?
no of gradle xD
well
something got screwed up
I no longer have the ability to show the gradle tasks view?
Yeah, gradle just got wiped from my eclipse IDE wtf
Yeah idk wtf happened... I just did updates on things that had updates and it screwed up my ide
I’m trying to read from the resource folder of my plug-in (Shaded) a txt file (updates.txt). I’m not succeeding, the only working method I found was taking too long to complete the execution. More than enough... Can you help me?
What are you trying to do, you can retrieve InputStream quite easy
With #getResourceAsStream
I’m trying to read this text file that contains information about the new update features. Inside are subdivided UpdateType and UpdateDescription that are then analyzed and transformed into heads to be placed within an inventory... I’m not finding anything that goes, apparently, for 5 lines of text it blocks everything... (Just to read them, does not get to create the heads)
the classic java brick to read the file, it works and has always worked but in this case, it freezes everything
wrong java ver
1.17 needs java 16 at least
properties > java.version?
i should be on java 16?
Mhm
[23:28:32 WARN]: java.io.FileNotFoundException: file:\C:\Users\andre\Servers\Server%20One\plugins\Identity-1.3.3-shaded.jar!\updates.txt (The filename, directory name, or volume label syntax is incorrect)
public String readResource(String filename) throws IOException {
ClassLoader classLoader = getClass().getClassLoader();
File file = new File(classLoader.getResource(filename).getFile());
String data = FileUtils.readFileToString(file, "UTF-8");
return data.trim();
}```
```java
totalText = readResource("updates.txt");```
Hum, help?
17 should also work, and it’s LTS
There isn't a good way to make it so that a plugin controls the message
"Player moved too quickly! x,y,z" huh?
You need getResourceAsStream() which returns InputStream and either convert that to a file and save it or convert that to String
Set the java_home correctly
show pom
^
ew
so change it
^
pom.xml?
?paste
It would help
1.17 is 17
Change that to the jdk 18 bin folder
Does it work? Will never know
same error
?paste
Again
why does he need to change java home
Look further
Some ide love to play pretend
Or show pom
You're compiling against java 17
With java 18
i did
It's java, not Minecraft
do you actually have jdk 17 installed?
yes
He have even 18
is it your java home 👀
🤣🤣🤣
check your project settings then
its clearly not on 17 then
i changed to this
but that broke it
so i changed it back
Unsupported class file major version 61
everything is java 17
idk
¯_(ツ)_/¯
update maven
how
dont you need to add the java version to your maven compiler plugin or whatever
huh?
like the
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.1</version>
<configuration>
<source>${java.version}</source>
<target>${java.version}</target>
</configuration>
</plugin>
its 17
oh
my java version is 17
what version is it on?
17

