#help-development
1 messages · Page 1507 of 1
It is exhausting to see someone complain that something does not work only to not know what does not work
there's no hope
And what it should really do and what it actually does
i mean i think 2 learnjava cmds were used
He is 
plenty of links to learn java
Which will probably be the case
So just curious, how expensive is World#getHighestBlockAt()? It's specifically this call that is giving some very heavy performance issues.
plugin is red
why
tbh not that expensive
Did you use EnumSet?
Yeah we know
Did you get an instance of plugin
like you should be able to spam it with little to no effect
Please learnjava
Odd, might be in combination then with nearbyTorches.parallelStream().forEach((l) -> { ? 🤔
idk what's enumset nor instance
He didn't
lmfaooo
not enough context
irrelevant for you
then learn java
do you have a plugin variable or not
He does not
bruh
Yeah fair point. Maybe I should just not do maths on sync 😂
i hink the problem is he is trying to learn java through plugin making
wich is an awful ideea
The guide he is following assumes you know how to create an instance of your main class, which he doesnt.
care as ur working with api so async will require some tricks
The bigger sin is not using SO
There is nothing wrong at it's core (of learning java with bukkit), but asking other people every time is wrong
Hm fair point. Not sure if World.getHighestBlock at does too though
actually, I could probably just scrap it alltogether
Hm, could you explain that further?
a snapshot will give you a full copy of the selected chunk
in main i have
public String ifConfigValueIsSet(String ConfigValue) {
return this.getConfig().getString(ConfigValue);
}```
so no more api related to it,meaning you can do async
I mean, I got into programming because of Bukkit. 🤷♂️
on it
Please learn Java
it returns a stringgggggggg
right 1 sec
this ^^^
Please use StackOverflow
Do not ask us, it only wastes YOUR time
bro fr you won't be able to do this w/o learning java
Does Bukkit have a snapshot function or would you say just Object#clone the stuff 🤔
bruh
Just using SO is enough
Can someone explain to me why you shouldn't name your plugin's main class "Main?" I'm trying to explain to a friend why they shouldn't, but don't entirely know the specifics.
.getString returns a string
not cloning, that far I can say
isnt main with a lowercase m a protected word?
Just confusing and bad practice
not that I think so
declaration: package: org.bukkit, interface: Chunk
and i put that where...?
dude
nowhere
O.o that'd work, I can just take the nearest chunks (radius / 16 I suppose, and use that)
can I compare getOpenInventory() with a custom inventory?
learn basic coding first
ok if you're gonna hate / say "learn java", i will block you :P
lmaoooooo
yes,you can grab the chunk and do all the checks async
@onyx shale Material.matchMaterial() was causing the lag. Material.getMaterial() works right
Welp good luck finding any help then
do me a favor and block me as well please
Maybe we should just block you
fax
Floofsys block list extends beyond infinity soon lol
Anyways floofsy what was the issue
I mean the whole method is still laggier then on my test plugin but meh...
conclure just look up in here
Yeah but what were you trying to do?
make a stored variable thing
sadly discord's block system is scuffed
I mean all variables store stuff
plese click that link
particularly this part
well on memory
i want on a file
Spoonfeed a newbie for a day and they'll come back with more questions. Teach them to find their own answers and you'll both be better off: you won't get stuck answering the easy questions and they'll be much more productive than before.
Mind resending, cba scrolling up in this chat 🥲
why are you doing such a heavy operation so fast?
Testing
It's basically non-static access. And he appears to be copy pasting code without any ideas of what things are
And IDK about "fast" clearly xD since the lumbjerack is lagging but clicking the arrow isn't
try moving stuff async
Im not using async with the arrow
I'm trying to match the speed
They are using the exact same checks xD
Thats why I'm so confused lol
Okay, so, I'm making a crafting thing where you drop a custom book and chestplate on the ground and get the enchantment on the chestplate that was dropped. I have the code for removing the custom book if it was dropped with a chestplate, but I now need to edit the dropped chestplate. I don't know how to access the chestplate from what I have here, can anyone at least point me in the right direction?
https://paste.md-5.net/ojasapetad.cs
He is trying to follow this guide: https://www.spigotmc.org/wiki/config-files/. However he does not seem to know much about code, thus gets stuck on this code not working.
The home of Spigot a high performance, no lag customized CraftBukkit Minecraft server API, and BungeeCord, the cloud server proxy.
Yeah I'm aware
Whoops, meant to tag Conclures message
please paste somewhere,md5paste throwing ssl error
idk why
Loads for me
For me too
Works fine for me
Strict browser settings
Any ideas on how to get the item and edit it?
oh sorry i meant these links:
https://i.imgur.com/VZGAq03.png
https://i.imgur.com/17a1fkn.png
Highly browser dependent if it works or not
The link works for everyone but you
Whitelist paste md5 that's what I had to do
@EventHandler()
public void onItemDrop(PlayerDropItemEvent event) {
Player player = event.getPlayer();
if (event.getItemDrop().getItemStack().getType() == Material.DIAMOND_PICKAXE || event.getItemDrop().getItemStack().getType() == Material.NETHERITE_PICKAXE || event.getItemDrop().getItemStack().getItemMeta().getDisplayName() == ChatColor.LIGHT_PURPLE + "Telepathy Core") {
for (Entity entity : player.getNearbyEntities(5, 5, 5)) {
if (entity instanceof Item && event.getItemDrop().getItemStack().getItemMeta().getDisplayName() == ChatColor.LIGHT_PURPLE + "Telepathy Core") {
entity.remove();
}
}
}
}
hmm beside ur problem i see some bad things
you should use the dropped item the pickaxe as the main entity the loop will be done
not the player
Use an EnumSet
also u are working with entities
Will look much cleaner
this is the new code for the Main class:
public boolean ifConfigValueIsSet(String ConfigValue) {
if (this.getConfig().getString(ConfigValue) != null) {}
return true;
}```
so you should be able to simply do Item chestplate = (Item) entity;
I mean, it's dropped items
no red lines, but the second class still has red lines
That code does nothing lmao
?conventions you should be following naming conventions
Java Coding Conventions: https://www.oracle.com/java/technologies/javase/codeconventions-namingconventions.html
so you should be able to simply do Item chestplate = (Item) entity;
this always returns true no matter what
Ye
oh yeah 1 sec
I hate that you can post more then one attachment
so nms block checking fkin ya?
fixed it,
public boolean ifConfigValueIsSet(String ConfigValue) {
if (this.getConfig().getString(ConfigValue) != null) {
return true;
}
}```
afaik there are like 5-6 ways each with different speeds
No the lumberjack just has more lag with the same methods xD
hmm strange
this code will not work
it wont compile
You mean something like this?
Item chestplate = (Item) event.getItemDrop().getItemStack();
for some reason the last curly braces are with red line below them
yes because you dont always return something
depends... however i would take another approach
i wouldnt rely on the drop event
fixed it
public boolean ifConfigValueIsSet(String ConfigValue) {
if (this.getConfig().getString(ConfigValue) != null) {
return true;
} else {
return false;
}
}```
btw floofsy this.getConfig().isSet(String path) exists
i would instead check every X ticks,each entity in the world,check if theyr items,check the type,check the nearby(a max range of 1),remove both,get location drop ur item
so this way if a item is alrdy on ground from a while
and you come and drop the rest
it will work
eh
nope, it's red
i mean red line below it
hm
hopefully makes sense
oh nvm fixed it
why does ifConfigValueIsSet have a red line below it? if (Main.ifConfigValueIsSet(uuid)) {
..
also this will pretty much work for everything,even if a dispenser
does it
If you hover over it, it will tell you
Floofsy what about yeeting every static in your plugin
?basics
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.
?spoon
Spoonfeed a newbie for a day and they'll come back with more questions. Teach them to find their own answers and you'll both be better off: you won't get stuck answering the easy questions and they'll be much more productive than before.
inbefore he asks what a static is
was just about to say "i don't even know what static is ¯_(ツ)_/¯"
Yeah we know no need to show us
Now take the advice and learn Java basics please
We're not here to write you a plugin
the harsh truth
also i can't help but notice that people that are blocked for me are talking (about this, i assume) and you guys do realize you're blocked which means i cannot see your messages, right?
Hi, I have a quick question: What is the best way to store a PlayerInteractEntityEvent that is passed in a method in a variable that can be accessed throughout the class? I know I can do this somehow with public but I don't know how exactly to do it because everything I've tried has given me an error message. I also know that this is part of the basics in Java but although I have learned it, I unfortunately have no idea how to do it right now.
Thanks in advance
Is there an armor euip event?
You do realize that you deny help for other people by your presence
sadly rn nope,md is working on one,but in the meanwhile you can only use libraries
Could you show us what you tried?
if you'd want to use it anywhere in your class you could use a private field
doesnt have to be public
Can't you pass it in a DI-style way throughout the methods of the class?
I sense static abuse otherwise
what is the outcome ur looking for?
If I use Bukkit.getOnlinePlayers, would I have to getPlayer before I can check a player for something?
getonlineplayers will return a collection wich you can loop
So I don't need getPlayer?
for(Player player : Bukkit.getOnlinePlayers())
I mean for something like this
Player player = (Player) Bukkit.getOnlinePlayers();
for (Entity entity : player.getPlayer().getNearbyEntities(3, 3, 3)){
}
which player doe
So I don't need getPlayer?
no
getPlayer basically returns the player instance
you're getting 1 player from a list, which player are you trying to get
the implementation is probably
public Player getPlayer() {
return this;
}
...
I know, what he's saying makes no sense when I'm going through every player
Getting the block player is looking at needs raytracing right?
You are not
You are casting a Collection<Player> into a Player
I think its a method of player
Which will CCE
you have to state the skull's owner, aka which user's head will be rendered on the skull
I mean i need to use raytracing for smthing
I wanted to create a villager where, when you click on it, an inventory opens in which you can change various settings by clicking on items. One of them should be that this villager is killed.
On another Discord server I got the suggestion (because the PlayerInterActEntityEvent is in a different method than the one I need) to store the PlayerInteractEntyEvent in a variable and then call it at the respective place.
Pretty much
so i basically need to add bunch of numbers to the players direction x y z
and then getting the block at that x y z?
Id just like to learn raytracing myself lol
Don’t be passing your event around
Store data based off the event @burnt current
Then you can access it in other places
that doesnt work with water tho
Thats why i thought bout raytracing
i need to check if player is clicking water
I watched few tutorials and I think I got some kind of understandment of how raycasting works
so i just wanted to ask here
So raytracing is just adding a specific number to players direction x y z and then getting block at that x y z?
How can I do that?
Do I need to have dealt with databases in Spigot for this?
No you can store in memory
And @vital ridge look at the client it’s your best source of knowledge
You mean minecraft src?
Either the client or the server
Not sure why he's recommending that
??? Why wouldn’t you go look at where all the knowledge sparks
How should i find raytracing snippets tho
and how would I have to do that in that case?
declaration: package: org.bukkit.entity, interface: LivingEntity
Use that
i cant check if targetblockexact is water
if i click on water it returns nothing
You can
Use the FluidCollusion setting
Okay but im just wondering
is this even close to raytracing?
cuz i watched bunch of videos
i still need help
And we've yold you what to do
@quaint mantle ?
Store it in a variable
yes but how exactly?
Here we go again
Is there a way to apply a BaseComponent to the name of an itemstack?
I can't see a method for it
because I'm converting from Adventure a minimessage parsed component into basecomponents, which can't be changed into strings
Yep
NMS is the only way sadly
bruh
Spigot API is a bit lacking with text components
Olivo?
can somebody please help
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.
This is an english only server
sorry but I've already learned the Java basics but for whatever reason I just can't figure out how exactly to store this variable from the method so that I can use it in other methods. I don't want you to write my plugin, I'm just looking for help for this one line of code.
learned the Java basics
can't figure out how exactly to store this variable from the method
these two don't go well together
sorry
¯_(ツ)_/¯
I don't want to argue with you now either. Thank you for your help
what else is it gonna do
switch expressions are awesome
switch expressions were also in 8
no i meant it doesnt say what version
i never saw then in 8 or never recommended them
that's not what they meant beast
or not
you can directly put it into a variable iirc
Either way they are pretty 🙂
yeah that is true
time to re-code some stuff lol
i prefer my method
nice one
Yes hide the evidence, nobody needs to know 😛
?snipe
I'm tireddd
lol
Ok, so my code looks like this but it makes this
But
I don't want that I want
Bro pre-increment, please.
you are checking if its a modulo of two
that is why its every 2 blocks
like the second block, 4th block etc
Instead, check that it isnt the first or last row, and not the first or last column
like for example
actually i cant give an example atm i dont got my ide open 😦
I'm trying to comprehend this
Well lets write the logic
here you know what maybe writing it would make more sense
for (int i = 0; i < 3; i++) { // column
for (int j = 0; j < 3; j++) { // width
if ((i == 0 || i == 2) && (j == 0 || j == 2)) {
setdiamondblock stuff;
} else {
setironblock stuff;
}
}
}
as an example
pre-increment, its faster on the loop
what?
for (int i = 0; i < 3; ++i) { // column
The performance is negligible
How is that any faster?
the way its grabs the value and returns it
I can almost guarantee that the JVM optimises it to be the same
it does double the work on post then pre on the value increase
this
the JIT does it for you
there is no point of doing it tbh
it doesnt lol
even so, it is a negligible difference
source?
Google it
for the JIT not optimizing it
What extra work would it be doing?
++i increments i and evaluates to the new value of i.
i++ evaluates to the old value of i, and increments i.
Ah i see, I will be wasting 1 nano second
Mhm
this isnt even a micro optimization lol
it all adds up
one nanosecond?? ARE YOU CRAZY??
but the value isn't ever used, so it just won't bother doing it
if i++'s return value is not directly used then it can be optimized, which is like 99.99% of the time
but how does that prove the JIT doesn't optimise it o.O
it's so un optimized omg
yea, I'd expect the JIT to just optimise it away
are u even a developer! No!
the difference is with i++ the old value has to be copied, before it can be returned
but you really shouldnt care about this lol
who cares??
^
++i; looks so fucking wrong
if u want to use ++i so then use it if u want to use i++ doesnt matter it isnt gonna be a big difference
Also, you could argue that i++ gives better developer performance since it's more ubiquitous which is generally something that companies care a lot about
And also you are using ++i in the wrong place anyways lmao
it makes other people think you arent using it correctly and/or dont know what it does
i personally think i++ looks more nicer
if it was that evil I bet my sonarlint would scream at me
yeah whoever uses ++i is probs gonna be mojang
it screams at me for everything
they use public fields too
lmao
like pretty often too
lol
i aint kidding if you look at their NMS
Didn't someone need actual help before this tangent?
you find a ton of public fields
im not saying ur kidding
🤷
im just saying that its pretty funny
tbh idk
was it you Ivan?
nothing wrong with public fields
i just came here
non-final public fields are a bit cursed though ;-)
uh yes they are
private final void
nothing is secret
just as a heads up, the i++ and ++i generate the same bytecode
yes it is
lmao
inside the forloop end
@gloomy edge this is probably the thing you care about. Replace the 2s and 3s appropriately. Also out of interest, where'd you learn to code? That code style is quite abnormal.
package;
public class Jochyoua {
private final String isSlow = "yes";
}```
my cars into some kinky shit
what if u have a private class
package;
private class Jochyoua {
private final String isSlow = "yes";
}```
if you reflect into my classes I will be angry
reflection is a killer lol
i cant since 16 made reflection harder
yeah u need a flag to use reflection?
lol
well, only final fields
thats why retrooper is pissed lmao
also only static final fields
which you couldn't even edit prior because they can/might have been inlined
theres one fix to it isnt there but ur not allowed to use it really
also it might get removed
where do you get this
cuz isnt there that flag
lmao
someone just called me "hello ma'am good day" -fucking ends the call-
joch whAt country?
just take the whole damn thing
india
lol take all of them
I want to but I don't have any spare cash atm
they're like 4$
f
better
each one 4 bucks, then 4 * 2 = 8. Then 8 * 4 rows = 32. Then 32 * 3 shelves
= 69
lmao
thought it was $104
cuz i counted each of one in that picture
and thats 26 i saw
my mom has sunburns
on her skin
:(
poor her
they really bad to
how did 32 * 3 convert to 69?
96
so close lmao
lol
he flipped the numbers
oh wait
he must of looked the wrong way
while using the calculator
and he thought he saw 69
@paper viper is that correct?
How are item lore stored? String, array...?
List<string>
Thanks.
i think
i read 23 instead of 32
lol
So with modern java you can no longer change private static final fields with just reflection, correct?
I mean true constants could never be changed in the first place since they're inlined at compile time
It's a map
I was hoping I could hook into Mojang's structure system with just a plugin, but alas it appears I cannot
Hey can anyone tell me if the Hexcolor codes work in 1.17 it doesn't work for me but there is also no error showing
?paste
Idk, Item Durabiloty dosen?T work :c
Knowes somone an alternative for a repair command?
Which spigot are you using
16.5
1.16.5
Cast your meta to that
Do note this is not the same as https://hub.spigotmc.org/javadocs/spigot/org/bukkit/entity/Damageable.html
is there anyway to detect a players version?
how come if the player doesn't have permission they can still break blocks ```java
public void onBreak(BlockBreakEvent e) {
Player player = e.getPlayer();
if (!player.hasPermission("volzo.build")) {
e.setCancelled(true);
} else {
return;
}
}
Could somone please help me?
something like this
ah no setDamage()
got the wrong import
Your event is either not annotated or your listener isn;t registered
It's registered
getServer().getPluginManager().registerEvents(new BreakBlock(this), this);
then its no annotated with EventHandler
what he said
the only other thing then can be is you are oped
testing with an alt
and they don't have op
also my annotated you mean @EventHandler correct
then the final two things. They have the permission or your plugin is not on the server
yes
This makes this?
right here, right now
dont put it in ?paste
I keep getting this error when running my plugin
[Server thread/ERROR]: Could not load 'plugins\TerrorGamesTest9.jar' in folder 'plugins'
org.bukkit.plugin.InvalidPluginException: 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
This error only shows up for my Main.class and all my other classes are working fine, also I compiled it in java 1.8 I don't know if there is anything else I need to add but thats pretty much it
IIRC ViaVersion has an API for this
thats fake right....
theres no such thing as 8243.8224
unless ur in like 8080
java 8000 when
I assume you have tried recompiling it
I've looked through the entire thing and those numbers never show up anywhere
I have an error when loading the plugin someone made me. Can someone help me? https://hastebin.com/fevezakoki.apache
yeah
its not inside your code, its whatever java version its compiled with
and idk how, but you must have some corrupt jdk
or something
lmao
Its compiled with javaSE 1.8
it couldnt find a class lol
Following the current version system, class file version 8243 would be java 8190
lol
How do I fix it? Here is the github https://github.com/SushiPython/textgen
assuming 6 month release periods how many years into the future would that be lol
idk u might have to shade jda in ur project
Sorry but it's,
You want to || not &&
? Srry im new to java
4087 years from now
ok
apparently I'm from the future or smth then
Thanks! @paper viper && @somber patio
@stone light are you 100% sure that you're compiling with java 1.8?
np
pretty sure I can send a screenshot if you want
Fix the build path error
wdym?
Also I'm not sure if that proves that you're using java 1.8 to build. To be honest I have pretty much no experience with programming Java in the context of MC mods, but that looks like a project Java version which I think maven probably doesn't use.
oh okay any clue how I can fix that? This is my first time ever trying to make a plugin
Check the problems window in eclipse
okay I'll look at it
if (SkyPremium.getPlugin().getConfig().getConfigurationSection("Users." + e.getPlayer().getName()).contains(String.valueOf(e.getPlayer().getUniqueId())))) {
ConsoleCommandSender console = Bukkit.getServer().getConsoleSender();
String command = "/authme forcelogin " + e.getPlayer();
Bukkit.dispatchCommand(console, command);
}
I would like to make like a /premium system but I am not sure if this condition works. Is it correct?
that seemss dangerous
like someone could take someones name
and if they have premium
they could just auto login
So what is the proper way to make a Goat ram something? Are we just calling the setTarget() on it or the attack() or is there some kind of "ramming" API that is planning to be added?
how could I use PlayerMoveEvent with a command?
u have to check for chat i think
idk
what are u trying to do??
So if someone had typed /blblab and they moved wihtin 50 seconds the command is cancels
Add their uuid to a set and then check that set in the move event
ok thanks
okay I think I figured out the whole time traveling into the future thing so now this is the only error I get and I don't know what I need to do
Syntax error on token "module", interface expected
This is the code causing it:
module TerrorGames {
}
how can i knockback all players in a radius away from a location
with the velocity decreasing as they are further awar from the loc
This is very speculative since I don't even know what modules are in Java, but I don't think whatever TerrorGames is should be a module.
ItemStack item = new ItemStack(Material.LEATHER_CHESTPLATE);
ItemMeta meta = item.getItemMeta();
ArrayList<String> lore = new ArrayList<String>();
lore.add(ChatColor.GRAY + "Health:§c +" + "35");
meta.setLore(lore);
meta.setDisplayName(ChatColor.DARK_PURPLE + "Chestplate");
item.setItemMeta(meta);
ShapedRecipe recipe = new ShapedRecipe(item);
recipe.shape("F F", "FFF", "FFF");
recipe.setIngredient('F', Material.ROTTEN_FLESH);
Bukkit.addRecipe(recipe);
}```
Is it possible to use custom ROTTEN_FLESH? like custom ItemMeta **named**, how?
RecipeChoice.ExactChoice
I don't know how or why but somehow my code was compiled by major class version 8243 still
How do I go about submitting a change to a NMS patch? I want to change nms-patches/net/minecraft/server/players/SleepStatus.patch, but the documentation I've found doesn't explain how to do that. Maybe I'm just being thick though.
u have to learn how to use patch files and stuff
theres probs like a patch file editor or something
idk
have you messed with your java JDK install?
Can someone please tell me how to fix this: https://hastebin.com/fevezakoki.apache Im new to java
INFO java.lang.NoClassDefFoundError: net/dv8tion/jda/api/hooks/ListenerAdapter
you need to shade it in
you are missing a dependency
i think you need maven or gradle
How do I shade
Do you use eclipse?
You may not have to shade. All depends on what the lib is
I use Intelij
i recommend watching https://www.youtube.com/watch?v=tlwn2YMnbrw&t
Love the video or need more help...or maybe both?
💬Join us on Discord: http://discord.gg/invite/fw5cKM3
Thank you for tuning in to this episode of TheSourceCode! ❤️
If you enjoyed this video make sure to show your support by liking , commenting your thoughts, and sharing for all your friends to see and learn!
All code is available on Github:
...
and then watching the next episode
It shows how to use JDA and etc
Love the video or need more help...or maybe both?
💬Join us on Discord: http://discord.gg/invite/fw5cKM3
Thank you for tuning in to this episode of TheSourceCode! ❤️
If you enjoyed this video make sure to show your support by liking , commenting your thoughts, and sharing for all your friends to see and learn!
All code is available on Github:
...
Intelij is putting warnings on these what should i do?
bump
You should probably know the difference between floating point and integer division if you're asking for help here.
Warnings should mostly be fine to ignore though.
(And to actually answer your question, change the 2 to 2.0 (or I think 2f should also work)
A dev made me the plugin. Here is the source code. I had to compile it. Maybe I did it wrong?
The developer probably should have shown you how to actually use their code. Is this something you paid for?
They showed me how to use it. I just think im doing something wrong. They sent me a java lib to import so I imported it. I dont know if I did it right though
How to plugin works is when someone in discord does !normal {message here} it will build it in game. It wont connect to the bot though
Are you actually getting any compilation errors? Warnings should be fine to ignore.
So you have a .jar file that you can put in the plugins folder? What happens when you open the server with the plugin in the plugins folder?
It should print out "Plugin Starting" at some point
It gives me this error in console https://hastebin.com/raw/fevezakoki
OK again I have very little experience with this but I think you might have to install the JDA plugin.
well that is a first i have npc's spawning for npc's lol
Can I get that in inteliJ
i think what he needs to do is shade jda into his jar
maven shade plugin ?
I paid a dev to make it for me
They said I needed to compile it and add the discord bot token to the code
I did both but I get that console error
well jda isnt a lib in mc
so u do need to somehow get it into there
like it cant find the jda classes
so u probs need to shade them into your plugin jar
Do other plugins use libraries? How are those added to servers? For forge mods you just copy the library's jar file into the mods folder, are bukkit/server libs the same?
no
can someone please look over my code
it is not giving me the item when i run the command
https://hastebin.com/yejazehasi.typescript
jda isnt a mc plugin
I have no other plugins on the server I am trying to use it on
its a lib for java
Oh you're right I really am just being thick.
u need to rename onDaily to onCommand
actually idk
thats not how u do things
your class also needs to extend CommandExecutor and that method needs to be @Override
it's very messy but it would work
I added the lib
then it says I need to rename my second onCommand
King, make multiple classes for each command
^
well one class for each command
he need override but he doesn;t need to extend. JavaPlugin does that
thats easier to handle to
and u wont get confused which command is which
The home of Spigot a high performance, no lag customized CraftBukkit Minecraft server API, and BungeeCord, the cloud server proxy.
I added the JDA lib. Now what
🤔 didn't realize you could register a command through just JavaPlugin
can someone help?
https://i.imgur.com/vWRHSs5.png
(in Main)
public boolean ifConfigValueIsSet(String ConfigValue) {
return this.getConfig().isSet(ConfigValue);
}```
it is automtically registered to your main class if you don;t redirect it
GIve people some time to reply.
i think hes talking about the onCommand event
or something
I don't think the way you've added the library has actually added it to the build environment
i do not know what an instance is / static abuse
i have
i have watched a long tutorial and i am following the code academy java tutorial
Are you compiling using maven? It looks like it's already adding it as a requirement at https://github.com/SushiPython/textgen/blob/main/TextGen/pom.xml#L79-L84
so I think if you're compiling with maven it should auto-add the stuff?
you aren't going to know a lot of things at the start, things should click however within a year for plugin development. I'm in the same position as you right now but i do enjoy making little plugins.
I’m compiling using intelij i think
install maven
and do mvn package
Ok
people find it hard to understand that i enjoy making plugins and learning along the way
?
ty so much guys ❤️
It's the best way to learn, I learn by example mostly.
i learn from forums
Ok
@EventHandler
public void onFireballHit(ProjectileHitEvent event) {
Fireball fireball = (Fireball) event.getEntity();
Player player = (Player) fireball.getShooter();
ItemStack item = player.getInventory().getItemInMainHand();
ItemMeta meta = item.getItemMeta();
String name = meta.getDisplayName();
Location fireballLocation = fireball.getLocation();
World world = player.getWorld();
if (name.equals("§6CUSTOM STICK")) {
if (item != null) {
world.createExplosion(fireballLocation, 10, true, true);
world.playEffect(fireballLocation, Effect.MOBSPAWNER_FLAMES, 10);
world.playEffect(player.getLocation(), Effect.BLAZE_SHOOT, 10);
}
}
}``` should I have ProjectileHitEvent for this?
click on the copyright in mc and hold space and ctrl lol
it's unlikely, but a player can switch a world between the time they fire the fireball and when the fireball lands
which could cause some big problems to your world
what event should I have?
ah ok
isn't he already doing that by setting the variable fireball to the proiectile parsed as a fireball?
how so
yes but he is parsing it as a fireball
true
um i don't know java and you clearly do but isn't he just setting a variable to the entity and parsing that variable to a fireball?
alright i got the fireball to cause the massive explosion however only when i fire two fireballs
if I fire a single fireball it causes a normal explosion
hmm do the spigot java doc have more then this?
PXXD another problem, a more likely one, the player can switch held items between the time they fire and when the fireball hits
all g 👍
Hey I come from python and i use sql in python. Im watching a tutorial and it says i need varchar(int) but in python i can do TEXT just wondering if this is accurate.
ok
java: cannot access su.nexmedia.engine.hooks.HookState
bad class file: /C:/Users/Mark/Documents/SkyWars 2020/2021/NETWORK/servers/skyblock/plugins/NexEngine (1).jar!/su/nexmedia/engine/hooks/HookState.class
class file is invalid for class su.nexmedia.engine.hooks.HookState
Please remove or make sure it appears in the correct subdirectory of the classpath.
does anyone know how to fix this issue? I am trying to change two lines of code in GoldenCrates, but the developer doesn't use maven so I have to add dependency jars manually. This error occurs when I try to compile the golden crate fork that I made. I tried two different versions of the NexEngine.jar but this errors keeps happening. (using intellij)
btw i still need help :/
Hey I come from python and i use sql in python. Im watching a tutorial and it says i need varchar(int) but in python i can do TEXT just wondering if this is accurate.
can someone plz help
^^^
@EventHandler
public void onFireballHit(ProjectileHitEvent event) {
Fireball fireball = (Fireball) event.getEntity();
Player player = (Player) fireball.getShooter();
ItemStack item = player.getInventory().getItemInMainHand();
ItemMeta meta = item.getItemMeta();
String name = meta.getDisplayName();
Location fireballLocation = fireball.getLocation();
World world = player.getWorld();
int randomExplosionPower = (int) Math.ceil(Math.random() * 20);
if (name.equals("§6CUSTOM STICK")) {
if (event.getEntity() == fireball) {
if (item != null) {
world.createExplosion(fireballLocation, randomExplosionPower, true, true);
world.playEffect(fireballLocation, Effect.MOBSPAWNER_FLAMES, 10);
world.playEffect(player.getLocation(), Effect.BLAZE_SHOOT, 10);
player.sendMessage(String.valueOf(randomExplosionPower));
}
}
}
}``` Explosion happens per two fireballs which means the explosion activates when the fireball hits another fireball, why is this going on?
yep
So it looks like it is hitting a fireball entity
Might need a check to validate the entity hit is not a fireball also
i hate concurrent errors lol the worst to fix
how would I do that? if projectile hit event is not fireball or something?
one sec
someone pretty plz pls help
There should be a object in that event that will let you get who you hit, then you check that class isntance to see if its a ball or w/e you want to check
ok
@lean gull I think we're gonna need more than just that code
Specifically it would be nice to know what's in Main
Anyone know if you can color the SPELL_MOB particle in 1.15.2?
if (event.getEntity().getLocation() != fireballLocation ) is that it or something close? still new to java
You'll probably want to use ! ...getLocation().equals(fireballLocation), just a heads up.
oh ok
But uh, judging by Doc's response, that's probably not correct to begin with.
Isn't exactly comparing floats generally not a great thing? Would it make sense to check that the distance is larger than some small distance?
Yea I have no clue what he's trying to do. I haven't looked at it. But what you're saying is true ye
just a simple fireball stick with stronger fireballs
Hey im wondering does anyone have a good sql class to create tabeels get values insert and update
I mean isn't that quite basic?
I normally use an enum class for that sort of thing
something like this
very messy but here
It is im still very new to java and learning databases today. I have a good one for python but not hava
Ah do you know sql itself?
@EventHandler
public void onFireballHit(ProjectileHitEvent event) {
if (event.getHitEntity() != null && event.getHitEntity() instanceof Fireball)
{
}
}
Lucy's Pretty Pastebin
no
You check if the hit is not null and is fire ball check
If you dont want to deal with sql directly. Give any ORM a try.
A good tip would be to learn SQL first before learning how to use it in Java
you can adjust the if checks
ok thanks
Ayy, you got accepted.
what is ORM
Object Relational Mapping
Do you get what its doing?
Uh no he pretty much abandoned everything when leaving the community I believe
rip
yeah it had such potential
I can pick it out, you are getting the hit entity and making sure it's not equal to nothing (which is what null is ig) and you are making sure that it is not an instance of fireball
wouldn't null not be instanceof Fireball, so you just need the second half anyways
that is why i said he can change it
oh
sometimes you need to give a little error so they can learn lol
round 2: is there a hard limit on how often a mob can damage different entities (not the same entity) within a tick?
yes : damage frames
that applies to non-player entities?
can I change projectile speeds?
is noDamageTicks for the damager or for the damaged?
damage frames are a time limit where the entity can take no damage at all
right so that's specifically what I excluded in my question
Your not getting it
EVERYTHING!! there is no one person limit it everything or nothing
round 3: is there a hard limit on how often a mob can damage different entities (not the same entity) within a tick?
no, cause its everything
once its hit buy one entity the damage frames are enabled and nothing can damage it
....
as in
a zombie that hurts 5 different players in the same tick
is there a limiter on that
oh that is not how that is worded lol
yes it is
I dont think theres a limit on that Magma
I'm not sure how to change this here?
is there a hard limit on how often a 'single' mob can damage different entities at the same time. (not the same entity) within a tick?
that would make sence to what your asking
I do not think there is a limit
how often a mob can damage different entities (not the same entity)
Yea that does not read the same for me, sorry lol
the predicate can be simplified
lol
well not how often, you can do it as often as you want, I am asking specifically within a tick
i dont think so
yea i coded that out day 1 lol
I have some code that iterates through players in a range and damages them but for some reason it keeps only picking up the first player
where can i find the changes to java reflection from 1.8 to 1.16?
what version did those changes take place?
.
Could you link us to the source?
.
private void doDamage(EliteMobEntity eliteMobEntity, double range1, double range2, double range3) {
for (Entity entity : eliteMobEntity.getLivingEntity().getNearbyEntities(range1, range2, range3))
if (entity instanceof LivingEntity)
BossCustomAttackDamage.dealCustomDamage(eliteMobEntity.getLivingEntity(), (LivingEntity) entity, 1);
}
sure
I'm going to spend some more time learning java
are videos a good learning source?
no
I use pluralsight
oracle has a pretty awesome tutorial site
Pluralsight is great
but you have to like reading
?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.
I do have a java book
link #4 was submitted by me
trust me, go for the last one
it would take much longer, but with less misconceptions
this is really annoying to diagnose, I can't even tell if it's working or not
If only there was a program that converted python code to java
hmm pretty sure a py -> java transpiler exists somewhere
but its probably not very good
they do
they aren't
fuck this
as far as I can tell this works 10/10
idk why some people report it not working
there's hardly any code to it too
it isn't
yea the loop looks fine
I can test it with zombies and this doesn't run any different, aside from a check to see if they're in creative or spectator mode
8 point grid
Might not be that hard to make a decent one, just time consuming 👀
north_east is 8 point north_north_east is 16 right
yea 16 my bad
Ahh that helps visualize
did you not have geography classes
oof
I didnt learn this in my geography class lol
Last time I had geography was probably 5-10 years ago
you'd think they'd teach compasses in geography classes
what is the correct way to run a task on the main thread that is currently inside an async thread?
last time I had geography was 12 years ago but I still remember the stuff that was vaguely useful
call back to the main thread
Bukkit.getScheduler().runTask(plugin, () -> {
});
I tried this:
Bukkit.getScheduler().runTask(main, runnable);```
nono
omg no
BukkitRunnable is capable of scheduling itself
no need to use the scheduler to schedule it
look into SynchronousOperation from a async thread
you can call a await with a SynchronousOperation and have it call back and wait for a response or not and have it just go.
is there even something called SynchronousOperation?
i might have called it that one sec let me check lol
oh yea oops lol
its the idea of it
Yes the idea is call SynchronousOperation
you can google that to see
the main issue is I have an async repeating tasks that calls this:
for (final Player player : Bukkit.getOnlinePlayers()) {
which works great in 1.16 but on 1.17 I get:
java.lang.IllegalStateException: Asynchronous Chunk getEntities call!
at org.spigotmc.AsyncCatcher.catchOp(AsyncCatcher.java:14) ~[spigot-1.17.jar:3124-Spigot-66f9d3c-384e116]
at net.minecraft.server.level.WorldServer.getEntities(WorldServer.java:1795) ~[spigot-1.17.jar:3124-Spigot-66f9d3c-384e116]```
do you need that operation to be within the async thread?
nope, just need a reoccuring task
ideally it'd be async but looks like I can't enumerate all players that way
Whats wrong with this tho
it is deprecated apparently. I get an error also
Try runnable.runTask()
that was the first thing I did and I still get the Asynchronous Chunk getEntities call! error
I am trying to get the block that was hit by a snowball, and looking at the javadoc, ProjectileHitEvent should have a #getHitBlock() method, however in my IDE this does not appear to be the case. What am I doing wrong?
What API version are you running?
spigot api version?
Oh, whoops. I'm adding this to an old project that has 1.14 imported
I'll update it real quick I'm sure thats the problem
all i know that its defiantly in 1.16.3 api
declaration: package: org.bukkit.event.entity, class: ProjectileHitEvent
it might of been added in 1.15?
i also know it didnt exist in 1.13.2
also now we know its not in 1.14
any1 know how to export to intellij with recaf
?
Yup, updated to the latest buildtools build and all is well. Thanks guys
the jar im tryna put there is a spigot plugin
You'll have to make a project & move the decompiled source to it, assuming intellij doesn't have some built-in method
why cant u use java decompiler
it is
it has like no export function for whatever reason
the export just gives me another jar
ok
it export as a jar tho
so u have to extract the decompiled code
out of the jar
by using something like winzip
how do i do that
winrar
.jar files a legit .zip files
lol
theres a plugin for it for intellij to
dont think its official
i mean doesnt intellij already decompile jars?
might be adding another decompiler u can choose
iirc intellij uses fernflower be default
intellij does decompile jars if u open one