#help-development
1 messages · Page 2225 of 1
Not me using the entire JetBrains suite.
it makes sense for the project I guess I could completely rip that out of the inventory, but it'd be a pain to implement any other way
If you are a student it is completely free
Or you just use jetbrains for everything 😄
oh god
thats what I meant nerd
fight me
yeah jetbrains ❤️
My only Enhanced Text Editor is vscode
I use it for every language
and no one can stop me
update, ffs
i will
I will
I'ma be honest I've used both IntelliJ and Pycharm and I didn't like either of them

what'd you do
i installed Clion and then i wondered why the heck i was doing c++ at first
If i were to use an actual IDE i'd rather use Eclipse or Netbeans
netbeans sucsk
also how much ram do you have? 4gb?
Intellij
why. It doesn't really offer anything I don't have that I'd use
ehehe
beans
also brave 👍
OPSTARTEN
dutch lmao
Not spyware?
Schijf. Sounds like your pc is about to sail away.
my pc is doing fine
chrome would've taken 5gb for 5 tabs lmao
i really need help
lmao german kinda same thing as dutch
can anybody help me with something really simple
?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!
?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!
Do you, by any chance, use arch btw?
I use ubuntu
yea
im usin windows cuz school lmao
Why not pop?
That's bpytop
lol...
because I chose ubuntu
I'm on a macOS school 💀
and my mac isn't getting updates anymore
good point
I removed a lot of stuff and got the least bloated version I could
idk how to setup intellij so i can make plugins
also removed their spyware :P
dont look at me, im talking nonsense cuz i got an exam maths tmrw
it would be great if someone walked me through it
create a maven project
and add the dependency
and your set
yes
so
i added the dependency
but i dont think that worked
because the java plugin thing which i put in isnt recognised
idk
if you added the dependency in your pom.xml it works 100% of the time
just verify
!verify
Usage: !verify <forums username>
?dm
I can help in dms
i literally cannot find this villager ai
maybe he lost his brain
It’s all over the place
im trying
kaboom
5
at least 3
how can i check if a block is a brewing stand in NMS
this aint rlly a spigot question but would any1 know how to change Pitch of a sound on the fly without changing playback speed like mc does?
Thats pretty hard to do. Let me call back some stuff from my signals and systems class.
gigahertz I mean
i have noticed as i could not find any information on this
but I always have 3+ghz of ram free
Its complicated because a sound emerges from frequencies. And shortening a wave function increases the pitch but also decreases the duration.
(Think of a sin wave that gets shorter. Higher frequency -> Higher pitch, but if you have n cycles then they will take slightly less time)
so are sounds with higher pitch in mc also slightly shorter?
how do i get a block at a specific location with nms
im just trying to exactly replicate what they do. but got no idea where to start on that
lmao what are you even doing
gl lol
ServerLevel#getBLockState(BlockPos)
thanks
lets code a linux distro
well now I have the block state but how do i check if its a brewing stand
Do you know the concept of Laplace transformations? Or for digital audio we really need z-transformations.
Add 37 trackers and perhaps Microsoft will fund you
is(Block.BREWING_STAND) (or whatever the name is)
(Also a system wide profanity filter to make the OS family friendly)
i most certainly do not
return serverLevel.getBlockState(new BlockPos(0,64,0)).is(Blocks.BREWING_STAND);
you lost me at concept
ty so much 🙏
its so hard to get nms help man
i need to know laplace for my exam
well teach me
laplace for statistics? How would that work?
how does that work
do they take the waveform of the original audio and mask a shorter wave over them or smth
i was working on this little application using Java FX but being unable to accurately replicate mc sounds with altered pitch is gonna be pretty useless https://gyazo.com/8dcba8fab382f86c3558aae92c91110e
ok my book is gone and i need to study it for wednesday smh
relatable feeling
it was smth like if all chances are equal to e/o then the chance that one of them happens is ... / amount of chances
Its probably that. Reconstructing the original audio with smaller harmonics.
if someone can find the villager ai that controls how they find their workstation that'd be insane im dying here 😔
Isnt there just an AI goal for that?
Is there a built in way to check if a player has still an empty slot in his inventory?
Villager AI is very different
#firstEmpty
Currently I'm using
public boolean hasFreeSlot(Player p) {
return p.getInventory().firstEmpty() != -1;
}```
Just digging through the brain stuff
i've been digging through the brain stuff for a while
im just trying to steal the AI to use in my horse
ah yes put villager ai in a horse
Why? What hinders you from just using normal AI goals?
trying to make the horse find a water source block that it can actually reach
I think thats pretty much it. But it doesnt tell you if the player has space for a certain item in his inventory.
man injecting your own merchant inventory causes such weird glitches
cancelling events just stops working
my horse just tries to reach the water on the other side of the wall and dies of thirst
Just do a quick A* to traverse the ground and then use one of the default walk goalks.
problem is
wtf is an A*
an algorithm
is it the same algorithm used for zombies attacking villagers and stuff?
Moral of the story: dont try to open merchant inventories for multiple people
?bootstrap
Bootstrap Jar
The main spigot-1.18.jar is now a bootstrap jar which contains all libraries. You cannot directly depend on this jar. You should depend on Spigot/Spigot-API/target/spigot-api-1.18-R0.1-SNAPSHOT-shaded.jar, or the entire contents of the bundler directory from your server, or use a dependency manager such as Maven or Gradle to handle this automatically.
Please read the release notes for further information: https://www.spigotmc.org/threads/9-years-of-spigotmc-spigot-bungeecord-1-18-1-18-1-release.534760/#post-4305163
it does not
then show your build.gradle
then we can'T help you now
there should be an error in your IDE
meow 
Sure you can
?jar
"Cant you just send the Spigot jar?"
No, we can't. It's illegal to distribute Mojang code, meaning that you have to use BuildTools to build the Spigot jar.
yikes
?jar
"Cant you just send the Spigot jar?"
No, we can't. It's illegal to distribute Mojang code, meaning that you have to use BuildTools to build the Spigot jar.
?bt
same here
"I use gradle" but uses an illegal jar file
why does that site still exists
illegal
using gradle but using illegal sites to download the bootstrap, then wonders why it doesn't work and refuses to send their build.gradle file? alright, good luck bro!
ur illegal 😏
that website is illegal
Using this is actually against the law. Thats what i mean.
why is it still on then
Using that site is the same as downloading a torrent off a sketchy website
it goes under the mojang's copyright
are you willing to go to court just to take it down
also extremely outdated
I mean you got nothing to loose
Either you win and that site goes down or you loose in which case spigot can drop BT
sorry how do i even go about this
i dont know how to do an A*
Simply do this. Just with code.
how-
type with your fingers idk
Am i really about to eyeball another pathfinding here...
Whats the range you have in mind? This will decide if it has to be done async or sync.
what is happenings here
about 20 blocks
and how would it determine if a block is completely unreachable?
Ok let me write a quick approach
this looks expensive to compute
ty
i was thinking the same thing.. how do zombies and villagers track their targets so fast?
probably they somehow cache computed data
and use it somehow to pathfind their goals feaster
?kick @quaint mantle
Done. That felt good.
oof
Rip
Wassup, is there any way to map all minecraft given commands?
whats that supposed to mean
Cast the PluginManager to SimplePluginManager. Get the declared field "commandMap", get the value and cast it to "SimpleCOmmandMap". It has a private final HashMap<String,Command> called "knownCommands".
that contains all plugin registered, vanilla, spigot, bukkit etc commands
thanks, love ya
reflection stuff 😎
try {
SimplePluginManager pluginManager = (SimplePluginManager) Bukkit.getPluginManager();
Field knownCommands = SimplePluginManager.class.getDeclaredField("commandMap");
knownCommands.setAccessible(true);
SimpleCommandMap commandMap = (SimpleCommandMap) knownCommands.get(pluginManager);
Field knownCommandsField = SimpleCommandMap.class.getDeclaredField("knownCommands");
knownCommandsField.setAccessible(true);
Map<String, Command> commands = (Map<String, Command>) knownCommandsField.get(commandMap);
commands.forEach((name, command) -> {
System.out.println(name);
});
} catch (Throwable t) {
t.printStackTrace();
}
this prints out all commands
what even the difference between getMethods and getDeclaredMethods alex?
i guess you know
getDeclared also getting privat eones?
getDeclaredMethod is DIRECTLY declared in this class, and also gets private things. getMethod only returns public things, and also stuff from super classes
the reason why both exist is:
You could have a class A that defines a method "asd" which is private. B now extends A and also declares a private "asd" method. So getDeclaredMethod("asd") would return different stuff for A and B.
ah so getMethod only gets accessible methods
If "asd" was public on class A and B doesn't override it, then getMethod("asd") on class B would return the method from calss A
mmh
same for fields
oki
yeah exactly. and it returns the method that is "as close as possible" in the class hierarchy to the class you used it on
use --rev 1.19 --remapped
yes
"latest" is 1.18 as of know however as 1.19 is in beta
Eh, you probably do not need that flag if you have never used bt before
Do you want to use nms or just setting up a server?
Okay no
https://hub.spigotmc.org/nexus/content/repositories/snapshots/org/spigotmc/spigot-api/1.19-R0.1-SNAPSHOT/ just download it from there
You can't do absolutely everything with it but it suffices for most stuff
That being said if you really were to use gradle - which I doubt - you wouldn't need to get the spigot-api jar
https://pastebin.com/VG1wPa3x How can i fix this error?
This is my code: https://pastebin.com/L9BfgHcp
I have no commands
look at the code
i sent the code
Really, make it yourself easy and learn the basics of gradle (or maven since that is a bit easier in my opinion). You will need to understand it one day and it is better if you do it while you are young
no no ik how to do commands and events perfectly fine
its just i dont understand what this error is getting at
Send your pom.xml/build.gradle
How can I get a percent representation of how much more fuel is available and how far along the smelting process is from a furnace?
I dont have 1.
What do you use then? JDT or IJ Artifacts?
- i never had this issue ever without one
Im using Intellij Idea
current/max*100
line 18 you are pulling a value from the config you have not yet saved.
but by default it should of saved the value
And that creates such an exception?
like i can send u the loaded config.yml
Discord:
ServerID: "Put your server id here!"
BotToken: "Put your token here!"
Activity:
Playing: true
Listening: false
Watching: false
Events:
Chat:
Enabled: true
ChannelID: "Put your channel id here!"
That's the config.yml
I believe your JDA version may be incompatible with the Log4j version provided by the server
hm
also this is a reload, test on a clean startup
well i have the server hosted on my pc
Or actually
ok
Ugh, why does the logger not know from where the classes come from
Could you send the built jar if you don't mind?
the thing is though i can make a discord bot ( outside of mc ) and start it up and host it on my pc and it works fine
sure
i cant upload it so im a dm u it
but u have to add me though bc i dont have my msgs on and i dont wanna turn them on
is there a way to change the amount of damage a sword does without enchants
Well yeah, but the question is how do I get max
The furnace interface only exposes the total cook time and burn time
Ah
Not sure if you are able to get the current recipe though
I'm tired already, how to fix the config loader
private final List<DropItems> dropListItems = new ArrayList<>();
public StoneDrop dropManager() {
ConfigurationSection stoneDrop = plugin.getConfig().getConfigurationSection("drop.stone");
if (stoneDrop == null) return;
for (String key : stoneDrop.getKeys(false)) {
ConfigurationSection section = stoneDrop.getConfigurationSection(key);
dropListItems.add(new DropItems(section));
}
}
drop:
stone:
0:
material: "paper"
1:
material: "paper"
size() returns 0 so theres "nothing" in it
stoneDrop.getKeys(false).size() is 0?
After u check if stoneDrop is null do getKeys.size and print it
ok i will chceck it
It’s actually not
A* is quite fast
It’s a variant of Dijkstra’s algorithm that uses a heuristic to guide the pathfinding
Why it pays off to take an algorithms class kids
Why does it compute the green parts faster
It is common knowledge that A* is one of the best all-rounder pathfinding algorithms
Ok so the first step was: Find the nearest block of a certain type.
https://gist.github.com/FlorianMineCrypto/e477fb19f9893735c2c8bfaef4b0d3d8
Ill do the pathfinding later or so.
It’s an animation
It isn’t a 1-1 depiction of an A* algorithm progressing
Ah ok
https://stackoverflow.com/questions/13031462/difference-and-advantages-between-dijkstra-a-star @humble tulip
I read this:
http://en.wikipedia.org/wiki/A*_search_algorithm
It says A* is faster than using dijkstra and uses best-first-search to speed things up.
If I need the algorithm to run in milliseconds,
It returns null everytime ;/
ConfigurationSection stoneDrop = plugin.getConfig().getConfigurationSection("drop.stone");
config.yml
but why ;/
It shouldn;t. You must be debugging wrong.
How would you get a player's head in spigot effectively
do you have the Player or OfflinePlayer?
Is there a way to change a player's GUI scale?
No
sadge
Asking nicely
that's a client side thing
Yes bet so
I don't believe you can do anything to influence that server side
You can’t even read their GUI scale
Player
?paste
ok thanks
Ok it does not return null but not looping either
public void dropManager() {
ConfigurationSection stoneDrop = plugin.getConfig().getConfigurationSection("drop.stone");
// not looping : (
for (String key : stoneDrop.getKeys(false)) {
Bukkit.getLogger().info(key);
ConfigurationSection section = stoneDrop.getConfigurationSection(key);
dropListItems.add(new DropItems(section));
}
}
Another dumb question: is it possible to show the "1" when an itemstack's amount is one?
that cant be efficient
Unlikely
not in large quantities at least
probably something the client handles
hm
thanks so much man your a lifesaver 🙏
im wondering, are plugins able to use the spigot server jar when they have the <provided> scope because the plugins and the server share the same classloader or smth?
the server classes are present in the plugin class loader
I’ll literally venmo u that’s a lot of work
ah i was kinda close
and do all plugins use the same classloader which the server provides or how does that work?
is there typo inside for loop od smh : /
not looping -> no entries
or it doesnt reach this for loop
its not null either so whats wrong?
relevant config section pls
hm?
in yoru config put quotations around your numbers "0":
It isnt. Its really heavy but i made it steppable so you can do it async
X D
it works
nvm
fc me
Would it be fine to use on hundreds of horses on a server at the same time
bound must be positive
int randomList = random.nextInt(dropListItems.size());
when
dropListItems.size()
``` equals 2?? why it says that bound is not positive
show the actual error
Caused by: java.lang.IllegalArgumentException: bound must be positive
at java.util.Random.nextInt(Random.java:322) ~[?:?]
at java.util.concurrent.ThreadLocalRandom.nextInt(ThreadLocalRandom.java:449) ~[?:?]
at pl.botprzemek.handlers.StoneDrop.onStoneBreak(StoneDrop.java:53) ~[?:?]
at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:?]
at jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77) ~[?:?]
at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:?]
at java.lang.reflect.Method.invoke(Method.java:568) ~[?:?]
at org.bukkit.plugin.java.JavaPluginLoader$1.execute(JavaPluginLoader.java:306) ~[spigot-api-1.18.1-R0.1-SNAPSHOT.jar:?]
... 23 more
Line 53 from error
ThreadLocalRandom random = ThreadLocalRandom.current();
int randomList = random.nextInt(dropListItems.size());
probably, also, #help-server
not when its used in an exclusive Random
ah
the size isn't 2. it's 0
upper bound must be greater than 0
List size is 2 so what else makes it 0
since when does java take unicode
are you doing this directly one line above the THreadLocalRandom part?
since always
that's just ligatures
that some setting?
List is loading when enabling, ThreadLocalRandom is in function on event
print out the list size in the event. it definitely is zero...
i guess that just shortens the display of the two symbols into one?
yep
== and other stuff too
huh no idea what kind of black magic that is then
why #help-server lmao
cuz you might ask here how you do that but not if your sever can handle it
it was a question concerning the efficiency of the algorithm
like despite how powerful the server is I wanna make sure it’s scalable
Uhhh
ah
i was looking at the other half of the conversation then
also it probably scales linearly regardless
alright
print the size before you call random. You are calling the method more than once.
random.nextInt can cause issues if the list size is 1 or 0
public final class ListUtils {
private ListUtils() {
throw new IllegalStateException("Utility class");
}
public static <T> T getRandom(Set<T> set) {
int size = set.size();
int index = ThreadLocalRandom.current().nextInt(size);
int i = 0;
for (T t : set) {
if (i == index)
return t;
i++;
}
return null;
}
public static <T> T getRandom(List<T> list) {
int size = list.size();
if (size == 0)
return null;
if (size == 1)
return list.get(0);
Random random = ThreadLocalRandom.current();
return list.get(random.nextInt(size));
}
}
I just use this
1 should cause no issues. it would completely invalidate any 0-0.99 number
he's just calling it with zero with his debug in the wrong place so he only see's the successfull call with a value of 2
yes 1 will work fine and just always return 0. otherwise the nextInt method wouldn't check if the given bound is <= 0
Same thing really. Like in an accident one person saw a red car, another saw a blue car and a third saw no car at all.
lol
urgh i now recall those psychodelic abonimations
cars with every part painted in a different eye watering neon color
illegal here in teh UK. Cars here must be registered with a single base colour
nice but unfortunately im not living in the uk so i have to deal with those nineteen sixty cars
public boolean shouldDrop(Random random) {
return random.nextDouble() > chance;
}
chance = 0.4 for eaxmple
ThreadLocalRandom random = ThreadLocalRandom.current();
int randomList = random.nextInt(dropListItems.size());
if (randomItem.shouldDrop(random)) {
player.sendMessage("item dropped");
block.breakNaturally();
}
why its always returning true?
you are using random so next double is an unbound double
You should be seeing a roughtly 50/50 split
If you are actually passing 0.4 as the chance
i want to make for example 30% chance of dropping, if it returns true then drop
you are going to have to post the actual code you are using not pseudo. You make too many assumptions and mistakes for us to comment on snippets
you'd probably want < rather than >
if chance was 10%, shouldDrop will return true in roughly 90% of the cases
Is there a way to increase player's swimming speed?
I'm doing it this way, but it automatically pushes me straight while I'm in water:
@EventHandler
void onMove(PlayerMoveEvent event) {
Player player = event.getPlayer();
Location from = event.getFrom();
Location to = event.getTo();
if (from.getBlock().isLiquid()) {
Vector changed = to.clone().subtract(from).toVector().multiply(Main.getInstance().getConfig().getDouble("Multiplier"));
changed.setY(to.clone().subtract(from).toVector().getY());
player.setVelocity(changed);
}
}
i did all the coding for a plugin
i have it all done
i just dont know how to make it execute with a command
did you make a commanexecutor or whatever
and commands must be registered btw
yes
damn bro use attributes
Please don't do that. This will look really ugly for anyone with a greater ping. Try to increase the walk speed (not sure if that works) or give the player the https://hub.spigotmc.org/javadocs/spigot/org/bukkit/potion/PotionEffectType.html#DOLPHINS_GRACE potion effect
declaration: package: org.bukkit.potion, class: PotionEffectType
why not attributes tho
that's an old mc version
wdym must be registered
welp good time to upgrade
There isn't one for swim speed
google "how to register a command spigot"
wouldnt walk speed work tho?
I don't know, he has to test it, as I already said
neither of these exist on ancient versions 😂
Is there a way to do that without this potion effect? Cause I'm running an old MC version with this plugin. I'll try changing player's walk speed tho
just update
thats what updates are for
to add new features, and you certainly need them rn
the plugin is not for me, I'd update
welp then tell the person theres no clean way to do it on that specific version
you are calculating the vector wrong
how can I calculate it right
even if it all was good, thats super bad approach
players with higher ping will be glitching
and your anticheat will scream at them
Is he modifying velocity on move event?
yes
I hope to make it work as intended at least
Wouldn’t that also cause it multiply exponentially? Lol
targetLoc.toVector().subtract(sourceLoc.toVector())```
You subtract Vectors not locations
that's my problem lmao
idk bro but thats certainly not a good approach at all 💀
You might want to cap the velocity too
So you don’t have people like
Flying through the ocean
how does dolphins grace code look like
it could be reverse engineered, but i dont think it will work
yeah, sure, but the main problem is in what u said above
if you want teh command to be accessible to some and not others
No but it's good if you do
Hey guys, if u do p.getInventory().getItemInMainHand().getItemMeta().getDisplayName().equals("NameOfItem") it doesn't retrieve the name of the item.
I'm trying to get the name of the item (here, it's a nametag that got named NameOfItem from an Anvil), any idea ? 🤔
output the name of the item to make sure it's actually getting the name, don't compare it
wdym with "it doesnt retrive the name of the item"?
It was a total missplay from me, I could do something way easier sorry
But now I'm getting a weird thing xD
public class RenameGoatEvent implements Listener {
public void onInteract(PlayerInteractAtEntityEvent e){
Player p = e.getPlayer();
Entity entity = e.getRightClicked();
if (entity.getType() == EntityType.GOAT){
p.sendMessage("Yes");
}
}
}```
With this event, when I right clic with anything on a goat, it doesn't send the message and I can't figure what I'm retrieving wrong
no annotation on the event
omg
the eventhandler
aaaaaaah
It's too hot for coding
I'm sorry guys, thanks for trying to help my stupid brain
the stupid MC dev plugin for intelliJ should throw a warning if one forgets eventhandler
then it would have at least one useful feature
Hahaha
lol I just thought "hey wasnt that the person who loved goats so much"
then I looked at your code
RenameGoatEvent
lol
There are goats in mc?
why does code in the .yml file keep changing after i press run
yes, best update
how do i make it keep the code
Uhh?
What're you talking about
you know the plugin.yml
every time i press run
it reverts back to how it was
how do i make it not do that
What do u mean run
1.18 I think ?
ye
feel like it happens more often than it should
usage should be under commands section like
commands:
whereisbrandon:
usage: /whereisbrandon```
u... have to type it
that would make sense yes
i never understood why it's called croque monsieur and croque madame
The home of Spigot a high performance, no lag customized CraftBukkit Minecraft server API, and BungeeCord, the cloud server proxy.
honestly i still read it sometimes
every time
I've never seen that happen before
Nice
Forgot to check if the target was a goat lol
anyone able to help me with code for a small plugin
?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!
do someone knows a vehicle api plugin?
that plugin must not have any preset vehicles
only the api
not sure but maybe LibsDisguises can do this?
I think I will need to create my own api 😭
because I need it to act like a vehicle
gradually increase and decrease speed
do damage on entities when they collides
how to check if bukkitrunnable is still running?
I guess you have an isCancelled
?jd-s
wdym with still running? that it's still scheduled, or that the run() method is currently still being executed?
run method still being executed
its for a chat game
there's no builtin way. just create a method for that
boolean running
does the task have to be async for that?
no
Uhhh
wdym?
Alex i doubt he needs to know if the run method is being executed for his usecase
Make a condition? If true then cancel the running task
Why would a chat game need to know if run is being executed
idk im a little new trying to learn
is a reaction game
a word is announced in chat.
and the first player to type the word wins but the game runs ever set seconds (set in config)
Oh well you don't need to know if it's being executed
U just need to know of it's cancelled
hey
if nobody responds in 45s it cancels
So if a player types tje correct thing u cancel
so i put the listener in the runnable?
No
Ok how do you plan to "end" a chat game
Send a msg saying no one did xyz in time
?
probably
He doesn't
Show your build configuration
wdym
Click the dropdown and click edit configurations
where is the drop downs
Next to the play button
if nobody types the word in 45 seconds it will cancel and send msg (nobody got it ...)
and if someone does type the correct word(PLAYER got the correct word) - give them reward
show your pom.xml
the only runnable you need is one that cancels the stuff after 45 seconds
When a game starts, schedule a runnable to run 45 seconds later to end the game
and what is that
If someone wins, cancel that runnable
ahh ok. so 2 runnables
lol I coded exactly the same today lmao
so how do i get it to do the chat game every 5m for example
does that not require a runnable too
by scheduling a repeating task that runs every 5 minutes
Oh yeah
that starts your game
My bad so yes 2 runnables
so is there something wrong with how it set it up
as to why my plugin.yml stuff is resetting after i press the play button
yeah
yes
you are editing the file in the target folder
wdym
edit the file in /src/main/resources and not the one in /target/
you should never do ANYTHING in target
target is the working directory where maven builds your stuff
np lol
actually imho intellij should show a warning when editing files in target
sth like "are you sure you wanna edit THIS file?! it'll get overwritten anyway when you build next time"
?paste
What is wrong with this? I havent implemented the actual event to stop them moving but it gives weird errors in console..
Class: https://paste.md-5.net/cecabogula.java
Error: https://paste.md-5.net/bagopejudo.bash
you are accessing the first element of the array "args"
although no args were entered
when args is empty, there is no args[0]
Ahhh
probably the plugin didnt enable at all, check your console
check console for errors
can u have 2 runnable in the same class?
what do you mean
you could even have... 3
oh
how?
new Runnable { ... ?
Runnable first = () -> { };
Runnable second = () -> { };
Runnable third = () -> { };
does that work for bukkitrunnables
of course?
public class Test extends JavaPlugin {
public static class Inner1 implements Runnable {
@Override
public void run() {
}
}
private final Runnable anonymousField = new Runnable() {
@Override
public void run() {
}
};
private final Runnable anonymousField2 = () -> { };
@EventHandler
public void onDeath(EntityDeathEvent event) {
Runnable localAnonymous1 = () -> { };
Runnable localAnonymous2 = new Runnable() {
@Override
public void run() {
}
};
}
}
there is a million ways
you can create anonymous classes, inner classes, use lambdas, do it as local var or field, ...
you can of course also just declare it in its own file instead
because you didnt check the console
can sb pls explain to me why this plugin doesn't correctly, it only prints false even if I 'm in spawn chunks
public static Boolean onSpawn(Player player) {
int spawnboardersize = config.getConfig().getInt("Spawn" + ".spawnboardersize");
int spawnboarderX = config.getConfig().getInt("Spawn." + ".spawnboarderx");
int spawnboarderZ = config.getConfig().getInt("Spawn." + ".spawnboarderz");
int spawnX1 = spawnboardersize - spawnboarderX;
int spawnX2 = spawnboardersize + spawnboarderX;
int spawnZ1 = spawnboardersize - spawnboarderZ;
int spawnZ2 = spawnboardersize + spawnboarderZ;
int ChunkX = player.getLocation().getChunk().getX();
int ChunkZ = player.getLocation().getChunk().getZ();
if (ChunkZ > spawnZ1 && ChunkZ < spawnZ2 && ChunkX > spawnX1 && ChunkX < spawnX2) {
return true;
}
else {
return false;
}
}
}
public void onMove(PlayerMoveEvent event){
Player player = event.getPlayer();
if(SpawnSystem.onSpawn(player) == true){
player.sendMessage("True");
}else {
player.sendMessage("False");
}
}
why the heck are you returning a boxed boolean
also you are checking chunk coordinates, and not block coordinates
I want to check for chunks
The chunk boarders are chunks
and you are also using chunk coordinates in your config?
yes
then print out those numbers and see why it evaluates to false
int SpawnBoarderX = player.getLocation().getChunk().getX();
int SpawnBoarderZ = player.getLocation().getChunk().getZ();
ohhh.....
@tender shard can you provide me with the code im not trying to copy just want to see your code to get my brain working
what code?
when i do /mine i get an internal error, here's my code...
package beegens.mines;
import net.md_5.bungee.api.ChatMessageType;
import net.md_5.bungee.api.chat.TextComponent;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.Material;
import org.bukkit.World;
import org.bukkit.block.Block;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.block.BlockBreakEvent;
import org.bukkit.inventory.Inventory;
import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.meta.ItemMeta;
import org.bukkit.plugin.java.JavaPlugin;
import java.util.ArrayList;
import java.util.Random;
public final class Mines extends JavaPlugin implements Listener {
public Inventory inv;
@Override
public void onEnable() {
Bukkit.getPluginManager().registerEvents(this, this);
createinv();
}
public String color(String text) {
return ChatColor.translateAlternateColorCodes('&', text);
}
@EventHandler
public void mine(BlockBreakEvent event) {
Player p = event.getPlayer();
World world = p.getWorld();
Block block = event.getBlock();
Material material = block.getType();
ItemStack i = p.getItemInHand();
String in = i.getItemMeta().getDisplayName();
int r = getRandomInt(100);
if(world.getName().equals("mine")) {
if(in.equalsIgnoreCase(color("&b&lMINER'S PICK"))) {
if (material.equals(Material.STONE)) {
event.setDropItems(material.STONE.isAir());
if(r < 101) {
if (r > 5) {
p.spigot().sendMessage(ChatMessageType.ACTION_BAR, new TextComponent(color("&7You mined a stone &8|| &a+1 shards")));
giveShard(p, 1);
}
}
if(r < 6) {
if (r > 0) {
p.spigot().sendMessage(ChatMessageType.ACTION_BAR, new TextComponent(color("&7You mined a stone &8|| &a+1 crystals")));
giveCrystal(p, 1);
}
}
}
}
}
}
private void giveShard(Player p, int i) {
ItemStack item = new ItemStack(Material.PRISMARINE_SHARD, 1);
ItemMeta itemmeta = item.getItemMeta();
itemmeta.setDisplayName(color("&3&lMine &b&lShard"));
ArrayList<String> lore = new ArrayList<String>();
lore.add(color("&b| &7use &f/mine forge &7to trade!"));
itemmeta.setLore(lore);
item.setItemMeta(itemmeta);
p.getInventory().addItem(item);
}
private void giveCrystal(Player p, int i) {
ItemStack item = new ItemStack(Material.AMETHYST_CLUSTER, 1);
ItemMeta itemmeta = item.getItemMeta();
itemmeta.setDisplayName(color("&5&lMine &d&lCrystal"));
ArrayList<String> lore = new ArrayList<String>();
lore.add(color("&d| &7use &f/mine forge &7to trade!"));
itemmeta.setLore(lore);
item.setItemMeta(itemmeta);
p.getInventory().addItem(item);
}
public static Integer getRandomInt(Integer max) {
Random ran = new Random();
return ran.nextInt(max);
}
@Override
public boolean onCommand(CommandSender p, Command command, String label, String[] args) {
if(command.getName().equalsIgnoreCase("mine")) {
Player player = (Player) p;
player.openInventory(inv);
return true;
}
return true;
}
public void createinv() {
Inventory inv = Bukkit.createInventory(null, 45, color("&v&lMine Homepage"));
inv.setItem(1, new ItemStack(Material.STONE));
}
}
dear lord use a a paste
-paste the error
?paste
alex you okay? lol
it's -paste on my discord lol
ah lol
Fixed it....
Thank You
?paste that error then

How to register and protect a custom plugin message channel
You can read all about it here:
https://www.spigotmc.org/wiki/bukkit-bungee-plugin-messaging-channel/
And what does protect mean?
The home of Spigot a high performance, no lag customized CraftBukkit Minecraft server API, and BungeeCord, the cloud server proxy.
Protection from injection / fake messages
fake messages? are you afraid that other plugins will use your channel to send messages or what? o0
Im assuming they are thinking of like players sending PMC messages from a client or smth
Yes
This only matters if:
- The player actually receives the packets
- The packets are unencrypted
Encrypted with base64 or something like rsa?
If you are truly concerned about someone seeing the packet or its data, I would just use something other than PMCs
Wait... it actually doesnt matter at all because the player sends packets in the other pipeline.
calling base64 an "encryption" is... brave
lol
Sir please
hm?
What should I use ?
base64 is an encoding, not an encryption
I run Redis's pub/sub system which is very similar to PMCs, and dont require players to be on/any part of it exposed
didnt you mix up client and server there?
The server sends the plugin message to the proxy...
PMCs are weird fuckery I never want to dive into lol
my bad i read "can"
And the client cant send any packets through the proxy on the bungee cannel iirc.
That would be super unsafe
So no need to protect the PMC
Honestly i think redis is just better for everything cross-server related.
+1 to that
btw what's going on with this verano dude. a year ago he announced "I'll write a plugin messaging library that will work even without players" and now he starts asking questions like "how can I check whether a player took fall damage in EntityDamageEvent" like wtf lol. Like, did he learn everything backwards lol
that dude should definitely stop smoking pot all the time lmao
@sterile token stop smoking so much weed lol
itsa hurta your brain-a
verano is another breed. I remember the first week he came here. He was constantly trying to call me
out and correct me.
lmao
ouch
also wouldn’t it be more efficient to only check for the closest block and when the algorithm finds it, it’ll stop? That way it does not need to go on to find the rest that it won’t even pathfind to
at first I thought he was russian because he was constantly talking about vodka and his name sounded russian too lol
Verano*
he said someone shouldent get banned for trolling, then if you look at his previous messages he said Troll = Ban lol
dude thinks I got beef with him because I call him an idiot
it only checks 27 blocks
jokes on him I call everyone an idiot
Yeah that would be more efficient. Ill think about that tomorrow.
that's nothing
i like him he helped me with a question 💪
didnt want to say that I don't like him, he's a funny dude, but still it's weir dlol
alright thanks man
no rush
you a real one 🙏

I'd like to deliver my job application
does it start with a P?
just look at the username
Ph
oh lol
💯
better question is why are you in that server
it's the hub
WOOOO 
i'm moderator there lol
Lol
Lmao
Since when
Hello, I updated to 1.18
And when adding it as a library to my project
It doesn't seem to be recognizing all of my bukkit things
However, my other deps are being read
I am on java 17
You cant use the spigot jar as a dependency anymore
Oh
What do I use now?
Also when did this change? :p
Maven or Gradle 😄
I'm not really a moderator but somehow, i dont know why, I have kick permission on that server
ugh I forget the command for that
time to learn
?bootstrap
Bootstrap Jar
The main spigot-1.18.jar is now a bootstrap jar which contains all libraries. You cannot directly depend on this jar. You should depend on Spigot/Spigot-API/target/spigot-api-1.18-R0.1-SNAPSHOT-shaded.jar, or the entire contents of the bundler directory from your server, or use a dependency manager such as Maven or Gradle to handle this automatically.
Please read the release notes for further information: https://www.spigotmc.org/threads/9-years-of-spigotmc-spigot-bungeecord-1-18-1-18-1-release.534760/#post-4305163
Then the server is f up, maybe all has kick perms xD
ah got it
nah definitely not lol. chaos would ensue
Unless u got a special role
Get the minecraft dev plugin for intellij and let it generate a maven/spigot project for you
Oh I see, also just a question
In reading the post it says to download the snapshot which is listed as 1.18.1. But the post says 1.18.x. Does that mean that now jars for ex. this one can be used as an apif or older version like 1.18?
you don't have to download anything when you're using maven
1.18.x means any number can be substituted for x
Ooh gotcha
Also since updating my server to 1.18 it attempts to generate the region for minecraft:overworld and appears to run out of memory trying this:
[00:48:47] [Worker-Main-2/INFO]: Preparing spawn area: 29%
[00:48:48] [Worker-Main-2/INFO]: Preparing spawn area: 31%
[00:48:48] [Worker-Main-2/INFO]: Preparing spawn area: 33%
[00:48:49] [Worker-Main-2/INFO]: Preparing spawn area: 33%
[00:48:49] [Worker-Main-2/INFO]: Preparing spawn area: 43%
[00:48:50] [Worker-Main-2/INFO]: Preparing spawn area: 51%
>./start.sh: line 1: 106838 Killed java -Xms128M -Xmx3G -DIReallyKnowWhatIAmDoingISwear -jar spigot-1.18.jar
Any idea on how I can either stop this generation or go around it?
Hub.instance is null
well but that's way too late
I see
np
wait I thought I fixed it...? Still give me error.. https://paste.md-5.net/bonisupacu.java
same error
yes, the error makes perfect sense
first, the class gets laoded into memory
then all the static stuff gets initialized
for example PREFIX
that tries to access Hub.instance
but that wasn't set yet
either make PREFIX not static, or only set it to a value in onEnable, the constructor, onLoad or in the init block
for example this would work:
public class Hub {
public static String PREFIX;
{
getConfig().getString("...");
}
no, that changes nothing at all
as I said - ALL static fields get "loaded" before any of your non-static stuff gets "loaded"
loaded is the wrong word but whatever
you should simply make PREFIX and NO_PERMISSION non-static
or, as said, only assign them after you have an instance
Currently, java does this:
- Oh, let's check out Hub.class. Let's check out all the class members (static fields) first
- Okay, I see there's a field called "instance" but it's not assigned yet. So it's null, okay, no problem, it will probably be assigned later on
- There's a static String called "PREFIX". And it has the return value of Hub.instance.getConfig()...
- Oh fuck. instance is still null
- RIP
Yes brother I fixed it, worked thank you! Just stumbled across a new error when doing the command... https://paste.md-5.net/liyisojape.cs
Colorize is only for chat util
Colorize.sendMessage(player, "");
etc
you pass "null" to ChatColor.translateAlternateColorCodes in commandFreeze line 25 / Colorize lines 17 and 9
package com.yanesagrybnow.project;
import org.bukkit.ChatColor;
import org.bukkit.command.CommandSender;
public class Colorize {
public static String format(String str) {
return ChatColor.translateAlternateColorCodes('&', str);
}
public static String stripColor(String str) {
return ChatColor.stripColor(str);
}
public static void sendMessage(CommandSender sender, String message) {
sender.sendMessage(format(message));
}
}
something wrong with this?
Thats odd
im passing
Colorize.sendMessage(player, Hub.NO_PERMISSION);
from the static Prefix and no permission in Hub
and what is Hub.NO_PERMISSION ?
public static String NO_PERMISSION; {getConfig().getString(PREFIX + "global_no_permission_message");}
yes, NO_PERMISSION will only have a value once your plugin instance was created
you shouldnt make all this stuff static if you don't know how that relates to class loading etc
doesnt look like you ever even assign it
there is not a single reason to have NO_PERMISSION static
I need to access it from the other class
oh yeah indeed, they don't even assign it in the init block
you simply get a string but never assign it to the field at all
hey, im trying to add permission attachments to players with mod rank, but it isn't working for some reason... can anyone help? https://storage.tape.sh/cl4jggs47000209jwmwu7ngvd/JjWBpVfpoZkLd3sqGD7G_.mp4?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=002acbaa1c55e0c0000000001%2F20220620%2Fus-east-1%2Fs3%2Faws4_request&X-Amz-Date=20220620T010801Z&X-Amz-Expires=604800&X-Amz-Signature=83fa3eea6b20941c2a70718e55dc081fba98bfebf81fd2296c8751e093c378b5&X-Amz-SignedHeaders=host
bc, the problem is explained there
so what would I change?
why does it not happen with the prefix right above
public String NO_PERMISSION = getConfig().getString(PREFIX + "global_no_permission_message");
yeah this tells a lot
yeah ain't nobody got time to decipher that video lol
ok, sorry
i mean it's more about what happens when i actually try to run the command than the code
and how all of the permission attachments are listed when i joined
there is no reason to make this static. YOu require an instance of your plugin anyway to get the config
so just skip to 0:38, i guess
I'll happily take a look once you just paste your code and the error
ah yes the 240p video
there's no error, but the code is here https://paste.md-5.net/ayalimepud.cs
hey it's not my fault, i didn't think tape would do me like that >:(
but you should skip to 0:38 to see what actually happens
?paste
noone wants to watch that video, it's annoying for us to have to scroll inside some video etc
^
uhhh ok, ill explain what happens in text instead?
you are getting the string at PREFIX + "global_no_permission_message"
what you want is to do this:
public String NO_PERMISSION = PREFIX + getConfig().getString("global_no_permission_message");
and NOT this
public String NO_PERMISSION = getConfig().getString(PREFIX + "global_no_permission_message");
np 🙂
nvm im gonna try something
Is there a straightforward way to check if a block is any type of log or do I need to check it against each log material individually?
Tag.LOGS.isTagged(type)
Thanks! I was looking into tags but couldn't quite figure it out.
np. alternate solution would be a set of materials:
private static final Set<Material> LOGS = new HashSet<>();
static {
Arrays.stream(Material.values()).filter(mat -> mat.name().endsWith("_LOG")).forEach(LOGS::add);
}
public static boolean isLog(Material mat) {
return LOGS.contains(mat);
}
for example, you might want to add the nether trees too. I am not sure if those are tagged as LOG
Makes sense, I will keep that in mind.
I'd yell at you for using streams but it's all cached
streams are nice
overhead go brr
you dont want to see some of my objects
They just don't add anything usefull
👀
it's only in the static init block
what is that actually from lol
a minigame project I'm working on
lombok is nice. but it's weird to see someone hating on streams while liking lombok lol
lombok does all its magic at compile level
if lombok parsed annotations during runtime I'd blow my brains out
and not use it anymore
When I do /freeze it gives me do /freeze <player>. But when I do /freeze qiwdojqwd it gives an error of target = null
👍
but /freeze myUsername works
missing a check if the player is online
is that different from if (target == null) {
if you get the player using Bukkit.getPlayer(...), no
?paste the error
can you show your code
Player target = player.getServer().getPlayerExact(args[0]);
no runtime, in compile time
streams go brrr https://cdn.rackdevelopment.tech/img/fGQ4UeVIiD.png
erm what
what
why do you get the server from a player object
you never check if target == null or not
I did
where?
thats not in your code either
Man that coloring hurts my eyes
you can not use isOnline when target is null
check if target == null, and if yes, send a message "player not found" and return true
oh nvm it is
Is there anyways to call getDataFolder() in a class that isn't main without injecting main into the class?
no.
line 10
you are calling target.getName() although you just confirmed that target is null
Using a static instance.
or JavaPlugin.getProvidingClass
I see

well
you already did that
args[0] ?
args[0].toString()
?!
XD
btw if you ALWAYS add your PREFIX to every message, just add the prefix in your sendMessage method instead of adding it manually to every message
