#help-development
1 messages · Page 1930 of 1
How can I make it so whenever a player interacts with a noteblock, it places the block on their hand just like it would be when they click stone or something while also running the blockplaceevnet instead of interacting with the noteblock please im going to die
whats wrong with lombok
So you want to write a getter method instead of annotations?
no
nah ive found the solution
gepron helped me
OH
honestly this is a java question that im disappointed on myself that im asking
uh
so
should I make a class
for my fields
no...
I have way too many fields on my main
why...
class
why would you do that...
Technically, it's a compiler hack - the Java compiler isn't designed to modify code, so it can cause difficult to debug errors, or worse.
Breaking, like, on every major java release.
is it fine having 15 fields on my main
yes.
But there's philosophical reasons as well
ok
nah
its just easier to use
Well, for one, I don't think you should use setters at all. Immutable objects are a much better way of transferring data than mutable ones.
For two, you should avoid getters if you can, and instead move behavior into the object rather than operating on it externally. This enables better design choices; it lets you do things like use multiple implementations of the same interface. You end up with less casts, less switch statements, and more polymorphism. It's a more object-oriented style of code and is much cleaner overall.
i remember when pass to java 16 how break my plugin xd
When you debug and review lombok code, you have to think in terms of the code which would be generated. This is non-negligible mental overhead, and for what gain? It would be better to write the code yourself or have the IDE generate it, depending on the demands of the situation.
well call the class#get
the annotation generate this later not directly in your code..
To be honest, i don't find lombok too much useful in my code base
if you need make things in the get better make the get method
you need an intellij plugin. Cringe!
although lombok has @Delegate.. Java pls add
Use your IDE's auto-refractor thing instead tbh
can IDEA generate delegate method calls?
Does blockplaceevnet place the block?
?
calling blockplaceevent
You mean when you dispatch it
will it place the block...
No
so I have to place the block and then clal the event?
Also blockplaceevent is for players so i dont recommend calling it from your plugin
Why do you want to call the event
im listening for interact event
and if the player clicks on a noteblock
i need to cancel the interact event
and call blockplace evnet
okay
uh
other question
is tehre a way to check if a item is placeable/a block
nvm i can just check the material
yes
and another one
iirc u can do it with nbt
idk why would u ever do that
but yes
interact event, get item, how can I aget the hand the iutem si being held
getHand()
i want to set someone to spectator then when they do a command it exits spectator to their location they joined spectator and the gamemode they joined from
will i need to use a database?
No
whats best way to do it then
Just get the user's current gamemode
when someone does
/vs spectate <player> it needs to save location for when they do /vs leave and teleport them to the location they ran /vs spectate and to set them to the gamemode they were in
Map.
Map.
I'm trying to get the number of xp a player has but I can't seem to find a method?
#getTotalExperience() is total overall ever
#getXp() is a percentage
#getExpToLevel() is xp to the next level
Doesnt exist
why do you need it?
?jd
Integer.MAX_SIZE prob or even long
how do i exit out the startup process
the onEnable of a plugin? or are you talking about a server?
nvm i foind it
._.
getTotalXp returns the xp the player has
wouldnt make sense to store all gained xp ever
did anyone else get a dude on spigot DMing you about promoting their online code course for a % of the profits on class sales?
why does this happen
are you doing it in onLoad?
yes
thats onEnable
man this is a bit of a shady one
what is your name - yes
any forums staff lurking
yes
custom enchants
eehh
yes
it says it stopped and it started
It literally doesn't read the docs
it still says Error occurred while enabling VulcanSpectate
It doesnt but thats what they do
what that wasnt in my jd
@obtuse ferry You'll probably have to calculate their current experience yourself
load or enable?
load
Just use the exact same formula Mojang uses to calculate experience per level, add those all up, and then use getExp() to find the remaining based on the percentage
dont do stuff in onLoad unless you know what youre doing
no i want to display my own message
last call before I give up any forum staff lurking?
Yup, just checking if there was another way
Yeah, I don't think there is 
...i mean do you have depend: [Vault] or something in your plugin.yml?
or softdepend
I like how they use different formulae for different level ranges 😃
Yay....
?paste your plugin.yml
i dont
i dont want it to say the ugly massive message
true i dont need this cusotm message
this isnt custom
two things to do
for your dependencies (lemme take Vault as an example)
- let your plugin depend or soft-depend on Vault so add **depend: [Vault] ** or softdepend in your plugin.yml
- place the code from your onLoad in your onEnable
Pretty sure he's just removing all of it and going with depend:
how can I make it so if PlayerInteractEvent in one class is cancelled
the same interact event in another class will be cancelled aswell
bruh
ChatMessageType.ACTION_BAR + "" will call the ::toString method of ChatMessageType
Yeah that’s not
use player.spigot().sendMessage(ChatMessageType.ACTION_BAR, /i belive it takes a textcomponent/)
How you do that
whats the text comonent for bukkit
And what happens when they dont have enough 😐
Use the event api’s priority api
Pretty sure they already are? You just need to use EventPriority and set the 1st one to a lower priority.
check if they do
🤦♂️
okay so uh
I looked at th jd
it says Normal is the default
Yes
I set the 2nd eventlistener to low
Therefore you want one of your callbacks to have a different priority
^^
Low comes first
oh/
Such that the order of execution is guaranteed to not be arbitrary 🙏
If you cancel in low it will be canceled in normal
ohhh
If you cancel in normal it will be canceled in high
I thought it would be reverse?
check it as total exp
It makes sense when you think about it
does it tho?
It does
Low is first so it can be overriden by higher priorities
^
The highest priority has the final say
MONITOR, duh
For anyone who found this message https://gist.github.com/Jikoo/30ec040443a4701b8980 this utility is cool.

net.md_5.bungee.api.chat.TextComponent
sure but youre making an enchanting system thats useless
if youre making a enchanting system you want to check the total exp
not the exp on the current level tf
Yes
use that
if it works it works 😎 
Are you dense. The spigot API only tells you the xp on the current level. That utility tells you the total xp.
wha-
getTotalExperience();
ah yes
i agree
very much
Seems pretty useful, kinda odd there's no method in the API that can do this 
Even vanilla is weird
read the docs...
nvm xp is weird
I literally already sent them
With commands you have to change level and points separately
keep calm ladies and gentlemen ._.
Minecraft is very weird
Screw the warden we want an XP system rewrite 
💯
Nah
data driven block states please
System works fine for players
ive never seen a warden in vanilla are they even ingame
no
🙄
The city looks like it’ll be cool
actually no it doesnt make sense
because the highest priority would have the highest priority to check
so it would check the first
The highest priority has the final say in canceling
^^
yeah but it has the HIGHEST priority so it should be the first
It can override the cancellation of lower priorities
since like in a queue if you have a higher priority than someone you dont go behind them
maybe i shouldnt think of events as queues huh
Think of it as a queue for a ride
But the later people can kick the earlier ones off when they get to the front
And yes I know no ride queue works that way
yeah so higher priority should come the first
like
:enterance:
a
b
c
d
think of it
No
Because you can’t kick someone off if they haven’t got on yet
eh ig if i stretch it enough it makes sense
ig
lowest is executed first as it can be cancelled by higher priorities
decompile EventPriority enum kekw
if I want to save a serialized and encoded object to a player's datacontainer, would I be able to retrieve it from the OfflinePlayer interface?
yh
no
then I could probably save it to the playerprofile, thanks
nevermind, it just seems to not exist
doenst worek
player.spigot().sendMessage i said
indeed you did. sorry for my dumbness
What's the most efficient data type for several items all of the same data type with set length which doesnt change BUT I want to add the collections of items together
I would use Object[] but I need to be able to add them to make one of said collection of items
Can i add multiple at once
before I had
Enchantment[] enchants = {BLADEBEAM, SWORDSDANCE, SPINATTACK...};
lets say a player has 500 chips and I want to check if they can bet but they need to have double of what they have. How would I go about to check that
so if they have 500 they would need 1000 etc...
*2..
if (chips >= neededamount * 2) {
wtf
double of what they have?
I assume to bet 500 you need 1000
So player x has y amount and player z must bet y * 2 or what?
So check if they have >= bet * 2
Geolykt overcomplicating things again
can someone explain whats happening there ?
but now if they bet 2 and they have 500 chips it won't work
because
if the player has 500 chips
they would need 1000 according to the if statement
but if they bet 2 they should still be able to bet still
.
HashSet is more performant right?
Hashset is primarily fast for .contains
but then if I bet 500 it will it go through
No it won’t
but why exactly 4
Because 2 * 2 is 4?
their chip amount can go as high as 20000
Okay
anyways
So what?
it did go through still
but then they can't bet let say 3
nope
I just tested it
Balance >= bet * 2
Substitute balance and bet
Balance >= 3 * 2
So as long as balance is 6 or more, it will be true
Would this code work?
public void FullIron(ArmorEquipEvent event) {
Player p = event.getPlayer();
if(p.getInventory().getArmorContents().length == 4) {
level = 2;
}
}```
Maybe
What is level
Actually no getArmorContents will always be 4 long
The entries may be null/air thought
it's public int level = 1
Also the first line in that event does nothing
Define performant?
in terms of time complexity HashSet wins in most cases
basically what i'm trying to do
Hello,
any one know if is there a max particle that player can see / spawn?
however you cannot have duplicates with a Set
is when someone has full iron, make level 2
16k ish
and a Set does not give you RandomAccess for instance
Hashset should probably have worse (base) iteration time too
Neither did I heh
🥲
is it possible to change it?
Up to you
fabric
I just discovered this, and this solution
// pick a random enchant from the set of possible enchants
int index = ThreadLocalRandom.current().nextInt(possibleEnchants.size());
Iterator<Enchantment> iterator = possibleEnchants.iterator();
for (int i = 0; i < index; i++) {
iterator.next();
}
Enchantment enchant = iterator.next();
probably shoulve just stuck to arraylist 😐

Blah
I still need to write my own enchanting table since the vanilla one doesn’t like custom enchantments
I just took the easy way out
Hi guys! How can i send an Action Bar message in 1.17?
i'm using this but it does not work, nothing shows up
Wdym it doesn't like them
You can still make it work with them
Don’t show them in the preview
Yeah, but you can still make them work
I did it 😛
I just prevented them from displaying
But they can be added as secondary enchantments
Yeah but I don’t want that
Welp 
How do i check if an armor stand is able to be placed at the block the player is looking at?
?ask
If you have a question, please just ask it. Don't look for staff or topic experts. Don't ask to ask or ask if people are awake or available. Just ask the question to the channel straight out, and wait patiently for a reply. Make sure you use the right channel regarding the topic of your question. Create a thread in case the channel is already in use!
what is blocking spawning the armor stand is the question ^^
Why when im tryin to send hover message in spigot server im gettin errors?
But when i test it on a server that its connected to bungee doesnt throw errors
🤔
Anyone know how to use ChatRender in event AsyncChatEvent?
how would i use a map to store
command_location
UUID
gamemode
so when someone does /sv spectate <player> it stores their current gamemode, UUID and location so when they do /sv leave it returns them to them coordinates and gamemode
ok time to stack overflow lol]
You don’t know how to make a class with 3 fields?
na im rubish at java
Learn java before trying to make plugins
i guess its same as my sub command handler
random AF question but how do i delete a plugin while the server is running?
Stop the server
i used to be able to replace them without restarting the server
Or use something janky like PlugWN to disable it
ahh i see
ohh u right, replacing works, thank u @young knoll
this?
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.
Yes it is
baso i need to select gamemode and location where UUID = player uuid
Map uuid to a class containing game mode and location
TY! Nice to see you again, you are being so friendly : )
We aren’t here to teach you how to make a basic data class, the internet has plenty of resources for that
Intellij doesnt show my folders?
there is external libraries
but its empty
hold up
uhm... i tried and it still doesn't work, no errors and no info in console
there you go
can I DM you the SS because it doesnt let me upload it and I refuse to verify
what would Bukkit.getBossBars return?
new ActionBarMessage(player, message).send()
ive been searching up things about my issue and what im trying to do and it doesnt seem anyone has done anything like this even though i know it is possible, im new to coding although ive been writing most of my plugin so far all by myself im in 1.8 btw, but everything in this code works except for the fact that the event happens too fast, i tested it to send a message to me aswell as make the furnace cook instantly and it sends the message and it shows the arrow at the spot it should be but when i put the item in it makes the cook time instant before the item is even processed as being in there, is there any way to fix this
@EventHandler
public void CustomFurnace2(InventoryClickEvent e) {
Player p = (Player) e.getWhoClicked();
FurnaceInventory finv = (FurnaceInventory) e.getView().getTopInventory();
Furnace f =(Furnace) e.getInventory().getHolder();
ClickType ctype = e.getClick();
if(e.getView().getTopInventory() instanceof FurnaceInventory) {
if((e.getSlot() == 0 || e.getSlot() == 1) && e.getCursor().getType() != Material.AIR) {
finv.getHolder().setCookTime((short) 200);
f.update();
p.sendMessage("You clicked with an item in the furnace");
}
}
}
it wouldnt let me post it as a txt file for some reason but this is the code
@ivory sleet (ping for help)
i posted this in this and help server because i didnt know where to post it
Why do you refuse to verify
because eh
can you set a gamemode and location on leave ?
can you do something faster in nms than one tick?
does anyone know how to change the speed a furnace cooks in 1.8
like you mean save or execute?
1.8 isn't supported
i know how and have some working code but i have 1 issue
.
im thinking if using runnable is really safe way
when someone leaves i want to tp them somewhere and set their gamemode
but i doubt its possible
???
ugh fine i will verify
for what you like need it you could just do it when you join
Save it
i need to ask smth, does my discord name change according to my spigot username or the spigot displayname
Pdc, json, SQL, etc
you can save it with a config you know that dont you?
Java scheduler?
so its not possible to change a players location on leave?
just change their location on join
save the data on disable
you can try tp on PlayerDisconnectEvent but Idk if that will work
b
what would Bukkit.getBossBars() return?
static Iterator<KeyedBossBar>
getBossBars()
Gets an unmodifiable iterator through all persistent bossbars.
better use a database and save data when it updates
no when a player disconnects
spigot username
yeah thas what I ment
but what inside
the name i guess
:dynoError: The AFK module is disabled in this server.
nah namespacedkey
is using lombok bad
like what you need to pass in the method?
yes very bad go to the shame corner
it just kinda makes the source code cleaner
Yes
pretty much an opinion game with lombok.
isnt there parameters for it
just don't use it when writing API
Nope you're forced to @Getter for each static field
Why
tf?
wrong message
because it can make people reading the source code confused
especially if htey dont know what lombok is
bro what
you need a NameSpacedKey
just make stuff idiot proof
if they dont know what would @Getter mean, they wouldnt understand any code either
gg
Well, lombok is pretty much not as easy to follow as you might think it is
I mean I've heard that
it is tho
I'm an extreme beginner on it
some magic annotation on top of a class does not really govern why I can call a getter
in my non lombok plugin vs code
where I just want to use your API
besides its far better than using public variables(ew)
records are a thing
and when designing API you should focus on interfaces anyway so, not much space for lombok in the first place
we will.. eat it...
yes
idk prob
gollum. gollum...
can someone help me with this issue im having with the making the furnaces cook faster in 1.8
nah thats bad
nah i cant read your mind
so i dont know thr issue
well i was just wondering if someone wanted to try to help
Don't Just Say "Hello" in Chat.
ty
so how do i deocompile this
oh yeah quick question whats the difference?
jdgui
declaration: package: org.bukkit.plugin, interface: PluginManager
ew, use luyten
its just for him to look it up I normaly use luyten
then why recommend something that you dont use?
no I used it back then it works for just copy pasting code
FernFlower
ew, use Recaf
wtf is the difference
And QF > FF imo
its just a decompiler use whatever tf want
Recaf is not really a decompiler
Recaf is a bytecode editor isn't it
It is a bytecode editor, but it can also decompile with Forgeflower (I think), CFR and Procyon
Better start investing Im thinking big things coming from them
Pretty sure it's FernFlower
<!-- http://files.minecraftforge.net/maven/net/minecraftforge/fernflower/ -->
<dependency>
<groupId>net.minecraftforge</groupId>
<artifactId>forgeflower</artifactId>
<version>${ff.version}</version>
</dependency>
why cant i just use return in java
What where is that lol
because in your current context it is nonsensical
Interesting lol
In which way it is nonsensical I cannot say without looking at the code
Issues include attempting to use return in lambdas (well, it would work, just not as intended), or when a return value is expected
If you want to return from a method no matter what, use throw new RuntimeException("Programmer laziness"); instead
Wdym ?
How could i get the name of the server in the bungeecord?
I've tried using messaging channels
I had over 200 spigot servers
Minigames, etc
how do i get the config in a command file
if(sender.hasPermission(VulcanSpectate.getPlugin().getConfig().getString("permission"))){
doenst work
wtf
If you need a permission use (sender.hasPermission("PERMISSION:STRING"))
You don't need to get a plugin's plugin.yml
i want to have a config.yml
i have
where your plugin.yml is
i need to fetch the value
i have
getConfig().options().copyDefaults();
saveDefaultConfig();
but i want to get a config value from an external file
# The permission required to use the plugin
permission: 'vs.use'
config ^
i want to get the vs.use in a command
._.
String permissionString = plugin.getConfig().getString("path.to.permission.string")
Non-static method 'getConfig()' cannot be referenced from a static context
if (player.hasPermission(permissionString))
you can
can i ingore this
are you calling getConfig in a static context?
use dependency injection instead
example:
public class CommandManager {
private final MyPlugin plugin;
public CommandManager(MyPlugin plugin) { this.plugin = plugin; }
}```
and then use plugin.getConfig().bla bla bla
This is a thing that must be pinned. I have been messing with this for like two weeks. 🤣
?di
Guide to dependency injection: https://www.spigotmc.org/wiki/using-dependency-injection/
I’ll try it tomorrow! Ty
ew public variables
Does somebody else have maven problems when making a spigot project?
is someone able to help me with an issue im having with furnaces in 1.8 where my code works but the event happens too fast so it doesnt actually make the cook time for the thing i put in the furnace faster
in vc?
because this issue is very weird to explain
this is the code:
@ivory sleet
poor conclure, got two tags now
Uh this is weird
why? it says ping for help
code looks weird too
Sorry i meant to answer to the other message
The one with the code
how so
dont assume it is a furnace you're clicking in i think
im not there is a thing checking for the furnace inv
also it works
the message i have at the end only sends if you click in one of the 2 spots in a furnace inv
Sorry I don’t understand the problem
FurnaceInventory finv = (FurnaceInventory) e.getView().getTopInventory();
if the top inventory is a players inventory
what will happen do you think?
so basically the code is happening too fast
i can show you the issue with a screen share
Okay
its very confusing and it seems no one else is having this issue
Delay setting the cook time.
also wont it throw a classcast exception?
Yes
Can some one help with this error Cannot access central (https://repo.maven.apache.org/maven2) in offline mode
does the 1.18 api work on most other versions
Depends on what you're doing
Probably will be fine then
best to use the API of the oldest version you want to support
How would I test if for if the sides of a mushroom block are true or false
could I use BlockFace for that or does that handle which way a block is facing like a piston
Hi
I make the spawners fall out when breaking. Faced with such a problem that the spawner of other mobs drop the spawner of a pig
Thank you
How can I change a mobs movement speed? (I am on 1.8 if that matters, it is a commision)
it doesnt
I was really hoping I wouldnt have to go there
Yes
ok, that doesnt exist on 1.8
idk how to find one of those
check the forums I guess
Or google
cant find much relevant
Oh well NMS it is
why doesnt this work? ``` ScoreboardManager m = Bukkit.getScoreboardManager();
Scoreboard b = m.getNewScoreboard();
Objective obj = b.registerNewObjective(e.getPlayer().getName(), "dummy", "rank");
obj.setDisplaySlot(DisplaySlot.BELOW_NAME);
obj.getScore(e.getPlayer().getName()).setScore(e.getPlayer().getLevel());
objectives.put(e.getPlayer(), obj);
e.getPlayer().setScoreboard(b);``` it does nothing
Seems to work fine for me? I changed it to Sidebar since you can't see your own BelowName.
wdym?
Only thing I changed in your code was the display slot and the objective name.
but if you press F5 you can see your nametag ive also tried it will vanilla scoreboards and i could see it
?
You must have a mod doing that, and it's not displaying your scoreboard. I bet it's working and you just can't see it.
What a precautious skin
My username is Masks what'd you expect
🥲
:)
Yeah that seems like the work of either a mod, or if you've seen it on another server, an armour stand above the player's head
that part works but when i join its setting my number to 0 but i have 40 levels so it should be 40 <text> but its showing as 0
?
40 xp levels
i have 40 xp levels and i make it set the number to the amount of xp levels
but it doesnt show as 40 it shows as 0
When are you calling that code
every player will have a different amount of xp
and what if 2 players have the same amount of xp
Why would that matter
you cant have multiple of the same number on a scoreboard?
Yes you can
oh?
😄
Why wouldn’t you be able to
i thought i tried it before and it didnt work
That would be silly
Indeed it would
How else would a simple death scoreboard work
Guess you'd just have to kill new players a bunch of times
so now when a player joins it works but when another player joins the player that joined 1st gets their scoreboard set back to 0 then the 2nd player's works fine
obj.setDisplaySlot(DisplaySlot.BELOW_NAME);
obj.getScore(e.getPlayer().getName()).setScore(e.getPlayer().getLevel());
objectives.put(e.getPlayer(), obj);
e.getPlayer().setScoreboard(Levels.b);```
in main class
``` ScoreboardManager m = Bukkit.getScoreboardManager();
b = m.getNewScoreboard();```
also the updater
OnJoin.objectives.get(p).getScore(p.getName()).setScore(p.getLevel());
}```
Add them to the same objective also, name it something like "rank" instead of the player's name.
wdym add them to the same objective? how would that work
Right now you're adding the scores to different objectives
Help me with kotlin
but if i made it static that wouldnt work since i use the objective to update the players score in a hashmap
i tried making it static but its just giving errors and says 0 xp levels for everyone
obj.setDisplaySlot(DisplaySlot.BELOW_NAME);
obj.getScore(e.getPlayer().getName()).setScore(e.getPlayer().getLevel());
objectives.put(e.getPlayer(), obj);``` obj is static and when a player joins it says 0 xp levels so now it doesnt work at all
Which events would I have to track to only allow specific ItemStacks in an inventory?
Just a InventoryMoveEvent?
That’s for hoppers
oh oops-
InventoryClickEvent
ah thank you
How do I import a plugin into intellij, I only know how to create fresh projects and apply spigot or paper to them.
Like when I open them, I get errors in all my classes, https://gyazo.com/4ac8e66f09f16fe04c81075a11c20b21
So my question is how to open a project up in spigot
You should be able to just import it
anyone?
Or if it’s a gradle/maven project, import it as one of those
its a gradle project
But when I open it, it doesnt tell me to select anything?
Just loads everything with errors
Ok so I got a question
I've been trying and trying to edit a .jar file
but I keep on getting different and different answers online
None of them workng
What do you want to edit?
how in the world do I just edit a .jar file in eclipse
.jar is like .zip (you cannot edit the file because it is a binary)
I can see it with JD GUI
Yeah you'd have to extract the files inside the .jar file and edit them and then combine them again to a .jar
Can I "Unzip" it?
ok
Yes
How do i do that
Just think of a .jar file like a .zip file
You wouldn't ever edit a .zip file, rather the content in it
Alright
You could download WinRAR
I have that
Ok
Have you got it working?
I see the .class files now, I just import them all into eclipse?
Yeah you could
Just drag and drop
"The class file is not on the classpath"
I would recommend you to first extract them from your Winrar to a folder named the same as your jar
why can't i mvtp world?
Now its saying "Source not found"
I told him
I feel like this should be something that can be done easily IMO, I don't understand why developers make it hard to work with
Tbh I am not very experienced with Eclipse, rather with IntelliJ
Wait do you want to import the .jar so that you can access the classes of the .jar in your own code
Or add the content of your .jar so that you can edit it
Developers can make it easy, it’s called open source
Which language do you speak natively?
To be frank I'm trying to mod an existing plugin
English, but to be fair, I'm not good at that either
first one to dm me and help me solve this, gets $5 paypal.
Cringe Intellij
java
the hell?
the hell what
why is intellij cringe
Java is cringe so Intellij aswell
fair

why doesnt this do anything Silverfish as = e.getPlayer().getWorld().spawn(e.getPlayer().getLocation(), Silverfish.class); e.getPlayer().addPassenger(as); as.setCustomName("testname"); as.setCustomNameVisible(true); as.setInvisible(true); as.setGravity(false); the silverfish doesnt spawn
did, you, actually spawn it?
am I blind?
Are you blocking the spawn event anywhere
oh I see
wdym block? also its registered, no errors
Or using something like worldedit to block spawning
no
Peaceful mode?
AlphaWolf wolf = new AlphaWolf(p.getLocation());
WorldServer world = ((CraftWorld)p.getLocation().getWorld()).getHandle();
world.addEntity(wolf);
this is how i spawn my custom Mob
works fine
import org.bukkit.entity.Wolf
import org.bukkit.entity.Player
import org.bukkit.
public class entity {
@Override
Player p =
Wolf wolf = (Wolf);
player.getWorld().SpawnEntity(player.getlocation(), EntityType.Wolf);
Wolf.setTamed(true);
Wolf.setOwner(player);
Wolf.setAdult();
}
am I forgetting something?
player - .setTamed - .setOwner - setAdult - are all errors.
public class entity extends EntityWolf
i created a scoreboard to go below my name i removed the plugin that made it now the scoreboard is stuck there i tried removing the scoreboard with vanilla commands but it isnt working do i need to make a plugin to fix it or?
:D
public class Differentname { is this what you meant?
I made a new class and for some reason all of my imports are now invald 😒
?paste
Jesus I am mistyping xD had an extra {
would anyone mind giving me some pointers of pulling Lists from config to do what i want?
How do I know what is inside of spigot.jar to use?
ex : setCustomNameVisible
like is there somewhere that tells me what to import to use?
you mean looking at the docs for the spigot API?
Am I able to get an instance of a class with reflection and setting all fields to public?
org.bukkit.craftbukkit im guessing
@quaint mantle
bukkits connection to net.minecraft.server basically
Idk I have no idea how spigot works I just semi-learned java basics and now want visual learning results.
this will show you all the classes and descriptions for each
Thats exactly what I have been missing. Thanks @solid lion @quaint mantle
np!
"Shitaru" ;(
Can someone give me some help with my Config and pulling List values from it
for example
Check BlockList in blocks section
if player mines block stated in config then check droplist for drops from corresponding block, set original drop to air, drop item
blocks:
IRON_ORE:
- IRON_INGOT```
Want a youtube tutorial that I learnt from?
thatd be great! I already have my config setup and all my instances pulled to the class i wanna write the method in but god i suck at lists
scream eclipse
Old tutorial 🤷♂️
Eclipse is just for OG´s
i had to migrate to intellij cause of 1.18
I learnt Java faster then I learnt how to use eclipse
did u tried Python? best lang in my opinion
Had to because of school 😭
i dropped out of my java class in highschool cause my teachers accent was too thick for me to understand
what accent
uhhhhhh i dunno never asked it was def a thick asian accent
World getWorld(@NotNull am I not supposed to use @NotNull?
depends on what you want and whether you have parameters
how can i check if in a radius of 5 blocks ( 5x5 ) there is a stone block?
i have a position and i don't know how to do it
triple nested loop
example? i know how to make a loop but idk how to make the verification
@NotNull is an annotation for the parameter
You don’t write that when you’re calling the method
so how would I make a method check correctly?
what u want 2 check
Make sure they aren't in a world thats dangerous, such as nether or end upon execution.
Hello can i do like this on config ?
Role: { Admin: 000000000000000000, Staff: 000000000000000000 }
Sec ill send what I got fully so far
You can call getWorld, that’s not an issue
use indentation
what indentation ?
You just call getWorld(“world”) or whatever
Role:
Admin: 111111
Staff: 111111
Okay so i'm overcomplicating it?
Pig pg = e.getPlayer().getWorld().spawn(e.getPlayer().getLocation(), Pig.class);
e.getPlayer().addPassenger(pg);
pg.addPassenger(as);
PotionEffect fc = new PotionEffect(PotionEffectType.INVISIBILITY, 1000000000, 1, false);
pg.setGravity(false);
pg.setCollidable(false);
pg.addPotionEffect(fc);
as.setCustomName("testname");
as.setCustomNameVisible(true);
as.addPotionEffect(fc);
as.setGravity(false);
as.setCollidable(false);``` why doesnt the pigs customname show?
the pigs spawn
? '-
iterate from x-5 to x+5 then z-5 to z + 5 etc
you can get a semi-accurate result using distance-squared ≤ 25
you did spark a problem
ok
there is no easy way to do this
wdym its super easy
what constitutes a block to be out of reach
dont they just want to check if a certain block is in a radius
is there a java equivalent for kotlin's let
I don't know Kotlin, but if it's just automatic typing, Java has var
uh no
it basically makes this super easy:
Bukkit.getPluginManager().let() { //whatever the syntax is
it.registerListener()
it.registerListener()
it.registerListener()
it.registerListener()
it.registerListener()
}```
I mean, not really. You could fake it I guess lol
Consumer<PluginManager> consumer = it -> {
it.registerListeners();
// etc.
};
consumer.accept(Bukkit.getPluginManager());
theres consumers ig
but that's just... not great 
hmm
yeah
thought there would be something a bit closer
like maybe lambda or map()
couldn't get it to work in intellij though
what would be the benefit of using that
i can't see how that would be more advantageous
registering every listener on plugin load
It just avoids having to set a variable, that's it
Which is quicker I guess but meh, Kotlin devs and their shorthands
To answer your question, no, Java has no direct equivalent
idk if its what you're getting at but you can use varargs?
So i watched the video and thats basically the code i used however i have a class that i call instead of getConfig and for some reason equalsIgnoreCase and getStringList error out
public void registerListener(Listener... listeners){
for(Listener listener : listeners){
//whatever the register thing is
}
}```
then you can just pass
registerListener(
new listener1(),
new listener2(),
etc...);```
for (x in 0 until (block.location.x + 5).toInt()) {
for (y in 0 until (block.location.y + 5).toInt()) {
for (z in 0 until (block.location.z + 5).toInt()) {
val detectedBlock = block.world.getBlockAt(x, y, z)
}
}
}```
that's right? (I'm using kotlin)
why is there no method to make a snowball invisible
you can
how
As far as I'm aware, snowballs can't be invisible unless they don't exist ;p
give them 500000 speed 
i have them as a player passenger
uh not sure about kotlin but this is what i would do in java
for(int x = loc.x-5; x <= loc.x+5; x++){
for(int y = loc.y-5; y <= loc.y+5; y++){
for(int z = loc.z-5; z <= loc.z+5; z++){
Location blockLoc = new Location(x,y,z);
//do stuff
}
}
}```
because spawning silverfish is broken -_-
you give the snowball a custom model with 1 pixel
Hm... workaround to making a snowball invisible might be to set the item stack to a
Yeah
lol, beat me to it
that wont work i dont use a resource pack
Well, no, but you would have to make one ;p
what if you set itemstack to air
Is a reason but not an obstacle
could you possibly use packets to delete the snowball entity?
but serverside it would still be there
well i could also use silverfish but im 99% sure spigot is broken with silverfish spawning because Silverfish as = e.getPlayer().getWorld().spawn(e.getPlayer().getLocation(), Silverfish.class); doesnt work
use spawnEntity
we need invisible arrows
ah that works thanks
thx
how am i supose to make the customname show up because this doesnt work (name doesnt show up unless i go in gmsp)
Silverfish as2 = (Silverfish) e.getPlayer().getWorld().spawnEntity(e.getPlayer().getLocation(), EntityType.SILVERFISH);
as2.setGravity(false);
as2.setInvisible(true);
as2.setCollidable(false);
as.setGravity(false);
as.setCustomName("test");
as.setCustomNameVisible(true);
as.setInvisible(true);
as.setCollidable(false);
as.setCustomNameVisible(true);
as2.addPassenger(as);
e.getPlayer().addPassenger(as2);```
if someone could help me figure out why this is erroring out thatd be appreciated
try use setVisible(false) instead
if that is available to you
nope
why u have 2x setCustomNameVisible?
didnt know i did
wings:
- red:
image: purple.png
duration: 1000
name: "&c&lRed Wings"
lore:
- "&7These blood red wings will"
- "&7show your intense pvp status"
- "&7when worn!"
- ""
- "{duration}"
- blue:
image: red.png
duration: 100
name: "&9&lBlue Wings"
lore:
- "&7These ocean blue wings will"
- "&7show your adventurous mindset"
- "&7when worn!"
- ""
- "{duration}"
idk whats wrong with this YAML, its giving me this error
did not find expected key while parsing a block mapping at line 2 column 5
Shouldn't -blue be in line with -red
oh
did not find expected '-' indicator while parsing a block collection at line 2 column 3
i get this now
wings:
- red:
image: purple.png
duration: 1000
name: "&c&lRed Wings"
lore:
- "&7These blood red wings will"
- "&7show your intense pvp status"
- "&7when worn!"
- ""
- "{duration}"
- blue:
image: red.png
duration: 100
name: "&9&lBlue Wings"
lore:
- "&7These ocean blue wings will"
- "&7show your adventurous mindset"
- "&7when worn!"
- ""
- "{duration}"
@grand flint
I don't know, I'm not good at spigot development 🤷♂️
oh i fixed it it was that the sub properties were not indented properly
this is why json is better lmao
why u calling setCustomNameVisible twice
how can i check if an item has certain tags?
what kind of tag
i think nbt
im checking if an item is a custom item from a different plugin
this is what i was told in the support discord
only verify if has two tag
MMOITEM_TYPE
MMOITEM_ID
and verify with a builder if exist
u using nms or just spigot api?
what api version
1.18.1
then it might be PDC not nbt
whats that?
?pdc
1.14 above uses pdc
ill try that, thanks
if you don't know the key for the pdc of the custom item, you can try #getPersistentDataContainer#isEmpty
ItemMeta exist too if u want to know if its an custom item
I was able to get my code to compile with no errors but now when i mine blocks the drops just thanos snaps out of existence
show code
what are u trying to do
its an autosmelt plugin, instead of hardcoding all my blocks and ores like usual im now creating a list in the config to choose what blocks drop what items on blockbreak
after breaking the block, it doesn't drop anything?
nope not at all
show your blockbreak event
ItemStack item = null;
inside your forEach
and the position is always 0
oh nvm thats correct
lol
how about create a list for your itemstacks
I'm having a hard time reading your code, use methods pls
how to verify if the player has any slot empty?
and your cancelling your event at the bottom
Basically its reading the config file like
IRON_ORE:
- IRON_INGOT ```
oh lemme test that
loop the inventory contents then if slot == null
okay that event cancel is if the variable allowAutoSmelt is false
so if the allowAutoSmelt is set to false it will just drop the block drops instead of smelting it directly right?