#help-development
1 messages · Page 2014 of 1
Snow block is a full block
player names could get purged after a while
otherwise looks fine-ish
so what do I use if they even never joined
hey ive copied an embedded config.yml to my file and then set values, but all the enters (returns) and comments are gone?
?jd-s
get the Offline Player from the UUID then check their name. if its null, they've never played on your server
I think, if I remember correctly
anyone/
and how to get the name of the people who never joined before?
player profile afaik
They won't have a name as its a local lookup
do you use dashes or underscores in custom yml files?
dashes
kk ty
Something like this
offlinePlayer.getPlayerProfile().update().get().getName();
Just note that this would block
define "effect"
potion effect or another effect?
Like harming effect
thats potion effect
Hero of the village effct
still
you cannot make them directly like a custom potion effect, but you can implement it by overwriting something else or using the same effect and adding new attributes
^
Oh
Just note that clients will not see this effect
yup
Oh, so if I wanted to make a potion effect called "peace" the players would not see it?
Particles on what?
set their removeparticles to true
in the effect
depends on which particles
there are hundreds of particles that are created via hundreds of different ways
boolean particles to true
no, i mean particles from spawnParticle, not from potion effect
yep
Well then
Except if you use data packs and sacrifice an already existing potion effect (such as luck)
U can't get luck in game right? 1.18.2
i dont think someone uses luck
only in EliteMobs, there is a sword that gives luck
not without plugin/datapack/mod (probably)
Ok good, I might do that
However the implementation of luck might not be NOP, so you would need to offset the effects
how do i set comments in a custom config file
Custom as in?
# comment
# comment2
key: value
how do i set it in code tho
Snakeyaml didn't support comments until recently so unless you are willing to use something like sponge's configurate you likely cannot via bukkit's API
https://hub.spigotmc.org/javadocs/spigot/org/bukkit/configuration/MemorySection.html#setComments(java.lang.String,java.util.List) or just read the docs my dear
declaration: package: org.bukkit.configuration, class: MemorySection
https://minecraft.fandom.com/wiki/Potion#:~:text=in a cauldron.-,Custom effects,-In Java Edition
check this
Potions are bottled substances. Most of them are brewable items, many of which give the consumer a time-limited effect when drank.
The water bottle is the base item that is used to create potions. It is obtained by using a glass bottle on water, catching one with a fishing rod, or through piglin bartering.
That is a custom potion. not a custom potion effect
oh ye nvm
you can make custom effects
but i dont think you can show the player they have it
nom maths
wha
how much ram will a server with max 100 players, just vanilla and some simple plugins for security chat and maybe buycraft take?
and the rest just pure vanilla stuff
max gigs is always 20
ever heard the soup story?
isnt 20 a bit overkill for a simple server
are you sure that your file is in your resource folder
wat dat mean
that prob wont even get 100 members on it but just a 100 member cap
yes
20 is more or less the upper limit
Going further than that is usually causing more harm than good
not by me. https://paste.md-5.net/yipibihovo.txt
what is then good? like 10 or 12?
myloo read this
but imagine it with 20 ram or idk
while(this.isIndex++ < this.isContent.size())
{
//...
}
```does this kind of incrementation cause out of bounds exceptions?
try something like that and yu can eventually lower or higher it
ok
but ive got this
it depends on what the body is
12.03 15:24:27 [Server] Server thread/WARN Caused by: java.lang.IndexOutOfBoundsException: Index 9 out of bounds for length 9
12.03 15:24:27 [Server] Server thread/WARN at java.base/jdk.internal.util.Preconditions.outOfBounds(Preconditions.java:64)
12.03 15:24:27 [Server] Server thread/WARN at java.base/jdk.internal.util.Preconditions.outOfBoundsCheckIndex(Preconditions.java:70)
12.03 15:24:27 [Server] Server thread/WARN at java.base/jdk.internal.util.Preconditions.checkIndex(Preconditions.java:266)
12.03 15:24:27 [Server] Server thread/WARN at java.base/java.util.Objects.checkIndex(Objects.java:359)
12.03 15:24:27 [Server] Server thread/WARN at java.base/java.util.ArrayList.get(ArrayList.java:427)
12.03 15:24:27 [Server] Server thread/WARN at utils.IniParser.getNextLine(IniParser.java:152)
12.03 15:24:27 [Server] Server thread/WARN at utils.IniParser.getNextLinePtr(IniParser.java:269)
like this it will not throw an exception
protected boolean getNextLine()
{
if (this.isOpen)
{
while((this.isIndex++) < this.isContent.size())
{
if (this.isContent.get(this.isIndex).length() > 0)
{
if (this.isContent.get(this.isIndex).charAt(0) != '[')
{
SplitString(this.isContent.get(this.isIndex));
return true;
}
break;
}
}
}
return false;
}
isOpen = boolean
isIndex = int
isContent = arraylist
SplitString worked before and hasnt been changed at all so id exclude that as possibility
Yeah, then it will throw an exception
You'd need to do ++this.isIndex
Why not use a for loop here?
ah
right
increment before
not after call
xD never used that before teye
because the old method was with a BufferedReader, and ive translated it 1:1 into an arraylist syntax
lmao continue exists for a reason
could
well
done so above xD
protected boolean jumpToHeader(String str)
{
if (this.isOpen)
{
for (this.isIndex = 0; this.isIndex < this.isContent.size(); this.isIndex++)
{
if (this.isContent.get(this.isIndex).equals('[' + str + ']'))
{
return true;
}
}
}
return false;
}
The bracket style is really confusing me
C does not have a (as in THE) code style standard
if (!isOpen) return false lol
its called via reflection
why call this via reflection..
you just call it like a field so what?
i store internally in a boolean if ive opened a file yes
I'd just throw an exception there tbh
because if i update the methods
i dont have to update every individual plugin later on
if they use reflection
It's Allman style
The eclipse compiler might though
java standards superiority
But doubt so, only JIT and AOT (such as graal) compilers should inline methods
also geol before ive used native methods
i wanna make a "bot" that when you say a command that starts with !, it says something. for example
input: "!say hi"
output: "[BOT] hi"
So if you were to change the method body it would not result in a change
but my server provider blocks .so file binary code execution
so ive rewritten it in dll style for java
shrugs
and both the .dll and .so file worked under my local server
Using reflection is more or less a big no-no in java space when you can avoid it
Technically no - you should NEVER use reflections
Use method handles instead
because its not encapsuled?
JNI is not reflection just to be clear
iknow
JNI is calling binary code from libs
reflection is within java
but JNI didnt work because most server providers block binaries
for obv reasons
lol i didnt know spigot had a conversation api
thats java native
it's old :)
u have to export ur C functions using JDKs wrapper api
I don't really see why though ... most destructive things you can do with natives you can already do with java
like ive said
years before ive programmed very sloppy
like every plugin had its own ini parsing implementation
so now ive wanted to standartize it
in 1 file
so that if i make changes to the methods i dont need to update all plugins
read the appropriate documentation?
and ive already tried to call bukkit methods via reflection, does not work
because its in a different thread apparently
anyone know?
and throws a nullptr exception xD
Never call bukkit methods off-thread unless it is explicitly specified that it is safe to do so
well ive tried to test the limits of reflection only anyway
what is the question?
look at the message i was replying to
that's not a question
But as I said, I recommend you to switch to method handles, they are much faster than reflection - even though as of J18 method handles are used by reflection
that wasn't a question either
the question is how do i make it..
How do you make plugins for spigot? Use an API for Discord i.e. JDA, Discord4j or, Javacord, learn the API, and make stuff. Simple and easy.
how do i seperate the command prefix, the command and the things after it?
@quiet ice ```java
public static Object IniParserPtr()
{
return new IniParser();
}
public static boolean openFilePtr(Object obj, String str, boolean b)
{
return ((IniParser) obj).openFile(str, b);
}
declaration: module: java.base, package: java.lang, class: String
its simple java
That is ... horrendous
i need something that can seperate it even if it's complex, like "bot please say "hello" and "hi" for me"
machine learning 
String#substring, String#codepointAt, String#indexof and String#split should suffice here
aww
thats on the plugin side
public IniParser()
{
try
{
ptr = (Object) IniParserPtr.invoke(IniParserClassPtr);
}
catch (IllegalAccessException | IllegalArgumentException | InvocationTargetException e)
{
e.printStackTrace();
}
}
i mean
it works
what's startindex and endindex
always rethrow an error
ok can anybody but geol help?
i don't mind reading the docs but i do mind how he's asking it
At some point I get fed up, the amount of people that are unable, incompetent or simply unwilling to read the documentation is just stpid
How can I call a sync method from an Async event
Scheduler
hm?
being inpatient in a help channel is just stupid
i might need you to explain a lil more
we should make a video on how to read javadocs kekw
https://hub.spigotmc.org/javadocs/spigot/org/bukkit/scheduler/BukkitScheduler.html#callSyncMethod(org.bukkit.plugin.Plugin,java.util.concurrent.Callable) really, there is no excuse
declaration: package: org.bukkit.scheduler, interface: BukkitScheduler
Is there a way to change the command response?
Like reload, when I us that commodity, is there I way I can change the message it sends?
btw one side question
A simple search on the spigot or oracle javadocs answers a third of the questions on here
if i wanna run dedicated tasks like own fireball logic
oh so you meant scheduler like that
is there a better solution than running it in a bukkitsheduler/multithreading it?
sorry
Is there a way to do that?
do operators pass all player.hasPermission() checks?
I do not think so
they do not
^^
If it comes to a point where you need to do that, yes
Was that for me? Or wally
wally
What can I use to test for an item in an inventory that has a specific item meta?
Oh,im big dumb
But your answer would also be I do not think so
for each loop through and check for the item meta
How do I check for the itemmeta?
/bukkit:reload probably uses sender.sendMessage to send the message
With .contains
Your welcome. Nice to hear that
/reload
could use a stream and check for anyMatch
Set().stream().anyMatch() or List().stream().anyMatch()
/reload as in /bukkit:reload (or /minecraft:reload, but I think it is the former)?
hm okay
also @quiet ice btw ty for the help it works as intended now
Idk, I just do /reload
Depend on what you are using List? Set?
And it says server reloaded
also had to start the indexcount at -1 though for files that dont work with headers
i think list
How do you lock the Weather to clear in a specific World?
What are you trying to do? Send code here: ?paste
gamerule doweathercycle?
Unless a plugin defines it's own reload command, it'll default to bukkit's reload command (/bukkit:reload)
?paste
Nice bot sometime doesnt work
and its bukkit implementation
the message has to start with the ?paste
it just checks the first part of the message
minecraft:reload reloads datapack/loottables/functions/advancements stuff afaik, idk if this is different on a server but I assume not
How do I change the response, can I even o that
And plugins
oh!
As I said, I do not think so
Bukkit.getServer().getScheduler().scheduleAsyncRepeatingTask(this, new Runnable(){
public void run(){
for (Player p : Bukkit.getOnlinePlayers()){
}
}
}, 20l, 10l);
lol
As it will probably use sender.sendMessage
all i want to do is check every 10 ticks if a player has an item with an itemmeta
You could use packets to intercept the messages, but that is about it
do they have to be wearing it or holding it?
Just have it anywhere in the inventory
is there a way i can fix a lighting bug with lava in my custom generator it appears very dark i need to calculate light again or something?
well, you have to loop through all players, then do the stream.anyMatch for the itemMetas of each item and then do whatever
aight
hey, small question about design, i have an island object that is meant to store the owner, location and some statistics
so i was wondering, should I have a separate object inside Island that holds the statistics?
quick question, what is the max amount of chars display name can have
good morning lol
it makes it more maintainable and readable, why not?
I might be doing this wrong, but List.stream isnt a thing
?
it exists
ssh
ah I got it thanks
you got it working?
not yet; im still trying to figure out this stream thing, ive thever heard of them
I may be able to help, not sure wether I got it right tho.
Aight
So how will this know to check the inventory?
code which I think might work, spoonfed tho if its correct
Il try that
this?
myeah
Should i just use config.yml to store a players money, or should I use mySQL
cause mySQL looks a bit advanced for me ngl
make a per player yml flatfile storage perhaps
Wouldnt that mean a file per player or smth
Also any tutorials on that
yep
uh probably
google around a little bit
in case you dont find anything at all come back here and we can discuss it a little bit Ig
dont you have to filter for notnull elements?
I made the itemMeta null because fast
but a filter is easy to slap in
dont all items have itemMeta which isnt null?
air is out there to get you
I see
if and only if ItemStack#getType#isAir then ItemStack#getItemMeta must be null
gotcha, thanks 🙂
Nope
will throw IllegalArgumentException: Plugin already initialized!
as your main class has only one instance, which is the one made by Bukkit
only pass the instance around with
?di
Guide to dependency injection: https://www.spigotmc.org/wiki/using-dependency-injection/
How may I do so I can use fireworks without having to click them on the ground?
HashSet<UUID> deadPlayers = new HashSet<>();
public HashSet<UUID> getDeadPlayers() {
return deadPlayers;
}
public void setDeadPlayers(HashSet<UUID> deadPlayers) {
this.deadPlayers = deadPlayers;
}
@EventHandler
public void onJoin(PlayerJoinEvent e) {
Player p = e.getPlayer();
if(deadPlayers.contains(p)) {
p.setHealth(0.5F);
p.setWalkSpeed(0);
}
}```
this is what i made last
check interact event?
remove the getter and setter
also im not sure if you wanna have Death threats in your class name xD
anyways you might wanna name your class something like JoinListener
not sure how is "Die" related to "PlayerJoinEvent"
or is that only a portion of the class?
dont call your class die
im not sure if playerjoinevent should be in a class named die
or you will die
i did. Is it workable rn?
ah
yeah at least capitalize the first letter 😛
make methods like addDeadPlayer and removeDeadPlayer, depending on what you want
seems like a NPE
ah yes lmao
nullpointerexception
literally
filter null itemstacks out
useless
idk what he s doing
you're trying to abstract away the field from other classes that arent even using the field
lmao
@grim ice can i execute?
this is hard :C
send what you currently have
just needto make sure cuz eventpriority is confusing
if i check if the event is cancelled on a event priority that is LOWEST
and broadcast smth if it is not cancelled
and cancel the event on a priority of HIGHEST
the broadcast wont happen right
Bukkit.getServer().getScheduler().scheduleSyncRepeatingTask(this, new Runnable(){
public void run(){
for (Player p : Bukkit.getOnlinePlayers()){
if (Arrays.stream(p.getInventory().getContents()).map(ItemStack::getItemMeta).anyMatch(n -> n.equals("" + ChatColor.BLUE + ChatColor.BOLD + "Glowing Pendant"))) {
p.sendMessage("You have the item!");
}
}
}
}, 20L, 10L);
Idk how to get rid of the null pointer exception
Nothing is working :C
after the map() you have to put in a .filter(n -> n != null)
How do I mix multiple ChatColor arguments together?
ChatColor.BOLD + ChatColor.GOLD doesnt work
thats how you keep all but null objects
Swap em
bold after
okay so
chatcolor + "" + chatcolor
ChatColor.BOLD + "" + ChatColor.GOLD + "YourText"
but why would you ever use that
ah ok
when you can use colour codes with a colourize function
No I want to get the display name
make a static variable for the display name
and check the display name
thank you bro
also you probably shouldnt use display name for data storage is what im guessing
i fixed it thanks to you
or anything like lore tbh
lore isnt safe either if people have plugins to make lore
type in 1 message pls thx
String glowingpendant1 = glowingpendant.getItemMeta().getDisplayName();
It will be called
@EventHandler(priority = EventPriority.LOWEST)
public void low(Cancellable event) {
if (!event.isCancelled()) {
Bukkit.broadcastMessage("Hello");
}
}
@EventHandler(priority = EventPriority.HIGHEST)
public void high(Cancellable event) {
event.setCancelled(true);
}```
"Hello" will be printed
Order is LOWEST, LOW, NORMAL, HIGH, HIGHEST, MONITOR
Because a higher priority event is called after a lower priority event, it can override the cancellation status of an event. It thus has a higher priority of cancellation
it feels confusing
cuz priority feels like it the higher should be ran first but also highest having hte last say also makes sense
Yeah, it's confusing at first but you get the hang of it
All you really need to remember is LOWEST = first, HIGHEST = last
alr
I hate when stuff is confusing but it actually makes perfect sense lol
?paste
it feels like it shouldnt be named priority but it also does
hey im getting a value from like config like this:
config.getString("items.cooldown-toggle.self.on");
my config looks like this:
items:
cooldown-toggle:
self:
on: "Test message"
It works for the rest of the values in my file but not for this section. Any ideas? i havent made a typo im sure of it.
there is no stacktrace before someone asks, just prints "null" in chat when i do player.sendMessage(config.getString(...)
so basically, this a player move event, im checking if the player is moving, not just a pitch/yaw change, and then if the distance between him and the ground is higher than maxY, or if the distance between him and the ground is lower than minY, cancel the event and send him a message
however
if (moveTo#getY() > maxY) e#setCancelled(true)
am i missing smth
moveFrom.toVector().equals(moveTo.toVector())
idk
that doesnt calculate teh distance between the player and t he ground
okay
for the first part
how to check if itemstack is slab?
that means its null
i know but idk how
is the path correct, is the string there?
theres another value in my code right next to it called "collisionmessage" and it works just fine
yeah there arent any typos
its been like this for a few days
yep
it works with -'s with me
Any help with it?(
You would be able to get more assistance in their Discord
perhaps, that is probably the only value containing it
i will check
ProtocolLib have no discord
F
Ok, i can reask question
How I can show player that was destroyed by a packet?
((CraftPlayer) observer).getHandle().b.a(
new PacketPlayOutPlayerInfo(
PacketPlayOutPlayerInfo.EnumPlayerInfoAction.a,
((CraftPlayer) watched).getHandle()
)
);
((CraftPlayer) observer).getHandle().b.a(new PacketPlayOutNamedEntitySpawn(((CraftPlayer) watched).getHandle()));
```This shows player, but it lose overskin and equipment
nevermind there is lots of keys containing hyphens
reload-msg: '&aConfig Reloaded!'
reload-permission: vlu.reload
game-msg-type: CHAT
error-msg: '&4[ERROR] &cAn unexpected error has occurred. Please see the console!'
all those are using dashes
Hm
Might just try separating the path up and see where it's failing to actually retrieve it
So do getConfigurationSection("items") for example
ill troubleshoot it later as im just about to leave but thanks anyway
5L is 5 seconds right?
in what sense
whats the best way to find the exact location
5L is 0.25 sec
5L just means a long with the value of 5
Scheduler#taskTimer()
just sysout messages
It's 5 ticks
20L is 1 second
Hee?
https://paste.md-5.net/ayixohebab.java
@red sedge
What the heck
20 ticks in 1 second
tahts what i do now
Yes
the issue?
And wait the arguments said: plugin, runnable, l?
Making ref to long?
Really aamzing
in what measurement 20 = 5 seconds?
so uh even if the distance between me and the ground is over maxY, it doesnt send me anything except if i click w or s or d or a, however flying upwards stops me, but it does even if im under maxY
i have a java timeunit to ticks converter that i never used
would have been useful
the getDistance() is not mine, I got it from googling for a bit, (my old one was really the same, but i still used the one from google since i thought i mightve missed smth)
check what distanceToGround does
also probably get the abs of that
Bukkit.getScheduler().runTaskLater(plugin, runnable, 100L); // Will run after 5 seconds?
ye
Allrgiht
a sec
private int getDistance(Location e) {
Location loc = e.clone();
int y = loc.getBlockY(), distance = 0;
for (int i = y; i >= 0; i--) {
loc.setY(i);
if (loc.getBlock().getType().isSolid()) break;
distance++;
}
return distance;
}
How I can make the player exit a boat if he is in a boat
Dismount him from his vehicle
or that
what's the method for that?
Idk look in the docs
#leaveVehicle() as you'd think it'd be if you used your thinker https://hub.spigotmc.org/javadocs/bukkit/org/bukkit/entity/Entity.html#leaveVehicle()
?jd
ok thanks
brains are useful tools
How to utilize tool?
Why not make them look at the docs ):
what is a tool?
Agree
tool.
Come on people, you can serve the people food but dont give it cutted. In other worlds, you should help them but dont give all the solution. Sometime they have to learn how to use the documentation and do it byself
yes :)
in other words
ahh ok
90% of questions are either a lack of java knowledge or people too lazy to read the docs
Probably 95%
I agree with Mike
It sounds rude, but sometime you get annoyed because you try do on your own reading and reading. And one without reading the docs ask something and they serve the complete thing
no shit sherlock kekw
does anyone know what i need to learn in order to be able to generate cool lookin trees with noise generation?
make 1x10x1 trees B)
"Java would be a good place to start--" is what I would say, but y'know.
Does anyone know why I'm getting this no brainer error lmao
Click Open Project Settings and see what it wants you to change
Everything is 17
Alr
I have all of these methods which all involve the condition if the player is not in creative @EventHandler public void onDrop(PlayerDropItemEvent e) { if(e.getPlayer().getGameMode() != GameMode.CREATIVE) { e.setCancelled(true); } } @EventHandler public void onBreak(BlockBreakEvent e) { if(e.getPlayer().getGameMode() != GameMode.CREATIVE) { e.setCancelled(true); } } @EventHandler public void onPlace(BlockPlaceEvent e) { if(e.getPlayer().getGameMode() != GameMode.CREATIVE) { e.setCancelled(true); } } @EventHandler public void onDamage(EntityDamageByEntityEvent e) { if(e.getDamager() instanceof Player p) { if(p.getGameMode() != GameMode.CREATIVE) { e.setCancelled(true); } } } Would there be a more efficient way to do this instead of repeating the condition over and over?
I think if it's before 1.17 it complains about that
I originally had 17, tried downloading the newest version
?paste
java 17 or mc 1.17?
Mc
lmao wtf
what is your pom/build.gradle?
anyone?
im using the spigot tutorial for custom config
The errors are all runtime errors
you can happily compile plugins with java 17 even for minecraft 1.8
Huh
<source>${java.version}</source>
<target>${java.version}</target>
This doesn't work...
Do u want me to paste my code there?
You need to give it concrete values
I copied this pom from another project and it worked
i. e. 17 or 16
interesting
Likely because you were running it with javac 17.0.0 and not javac 17.0.2
or you defined java.version in your properties block
Yeah the latter sounds more likely
actually, you can remove these two lines as you already define source/target in your properties block
The whole compiler plugin block can technically be removed if you expand on that logic
I see, thanks for the help!
what packet can I send to "fake" update the player's skin?
(even tho it may technically update it, the clients to whom i'm sending will show the updated one)
Why would you want to fake update a players skin?
Whats the point in that?
Doesn't the skin need to be downloaded from mojangs servers? I imagine trying to make a gif of a skin will have unintended consequences
I dont even think you physically can call updates to a player skin. I know you can do it with player heads n such.
no this is possible
But other than that, it cause lag and performance issues trying to.
You can physically update someone's skin
i'm a master at handling those i've done plenty of animated stuff in the past
including animated gif (maps), animated armor with gradiant
etc
yeah, updating a player's skin should be possible
Well then xd
I have 0 words, go ahead but me personally, idk IF thats possible
but it might so xd
Outside of perhaps editing the PlayerProfile of the player I have no idea on how to do it however
^^^
anyone know why this happens? i'm using the spigot tutorial for the custom/multiple config files
yeah i thought so too
send the jar
but i'll give it a test
It cant locate the YML file your searching for.
thx guys
Needs to be a valid YML file.
pov: when you know you're writing bad code but you just want it to work so you continue as you near 1.000 lines in a gui class
isn't it supposed to create it
Nah, it is just not present
Well, the yml file needs to be in your jar
Can you send your code please? Also, I recommend learning java first.
If it isn't this expection is thrown
I made that mistake 2 days ago.
Watched a 2 hour tutorial on java and now im good w/ it
The YML validity has nothing to do with it however
do i make a yml file in the place where the plugin.yml file is stored? i don't get it
"The embedded resource 'gun-stats.yml' cannot be found in plugins\DerpPlugin.jar"
one thing im good at is error tracking
Do you even know what you want to do
@lean gull What are you trying to do exactly?
= there is no gun-stats.yml the the plugin's jar
Yep
By that error, your attempting to get a file that never existed.
No, they are copying a file that does not exist
Or better yet, they are reading a file that does not exist
i am?
?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.
JavaPlugin.saveResource
You clearly dont have java experience, learn it first.
?stash
incoming
ngl i just copy pasted the code from the tutorial cause i've already spent like 2 hours on making custom yml files before
Yep, dont copy n paste code.
Read the links I sent above.
Dont make a plugin if you dont have java experience.
Cause otherwise, you wont understand anything.
Also, I HATE copy n pasters, Just saying :/
I love copy & paste
read my about me, you'll learn a thing or two
car go vrom
Im not making fun of you?
...not that part
lmao
Im simply letting you know, do not try to make a plugin without java experience.
they block anyone who tells them to learn java
So they are just a begger.
Thats nice.
i meant the part where some people might not be able to just learn java by watching a 10 hour tutorial
*beggar
ofc you wont
If you actually were to watch it, and learn.
Yes you would.
i tried ._.
It sometimes takes longer to click however.
nobody will be able to learn java with a ten hours tutorial
So keep trying til it clicks in your head.
do your homework
I am on team "tutorials are useless"
I mean I learnt java in 2 hours
xd
Once you get the ball rolling that is
i mean yo are noob
I wish someone would write a tool to compile normal java code to reflection-only code
so that one can use it without needing any imports
Hi, how do I get the key of the last entry of a configuration section? :)
At that point stackoverflow, spigot and javadocs are far better for anyone
anyways can someone help me with my error
Hey, are you using DataPersistant...?
there is probably an obfuscator that does hits
Show us your code
Stop begging please. Learn why its not working. This is for plugin help not java errors.
hm maybe but I'd like to see this in general, not just to obfuscate 😄
@quiet ice hes talking about the error from earlier
I know
?learnjava PLEASE
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.
Why
you copy and pasted too
if they dont click on it that wont help
Hmm no, I mean the configuration section of a .yml file
i meant people who copy exactly what a tutorial says
at least once, you've copy and pasted
I like spicing things up
yea fair
https://paste.md-5.net/cocacubuhu.java
code moment
also @tender shard I see why you got annoyed with me about my questions
btw as u know roblox lua is it worth learning
lma\
I spent 3 years learning it.
I regret it.
SO MUCH.
jdherobrine, this time, don't bother helping
what does getHandle do?
configuration sections are basically maps internal and maps are unordered so im not sure how to get the last one, probably manually navigating then
how to delete all the drop from EntityDeathEvent?
Look, you keep begging and you arent giving enough information for others to help you.
- Whats the error or issue
- Whats the code
You only ever send code, and say "help"
i sent the code, i sent the error
e.getDrops.clear()
You might be able to disassemble to JASM bytecode and then reassemble it which might be doable if you want to dodge the spigot requirements
now please, leave me alone
cool thanks
can someone nicer help please?
@lean gull Your file location is invalid.
hehe my bird is helping me coding sitting on my schoulder
maybe I'll try my own luck and write some thing to parse simple code
File locations usually start at me.
thats what i saw in paperapi docs lets hope its the same in spigot and that it works
thats what they call package names
jdherobrine that tells me nothing
remove line 46
If you knew java you would know what I mean, its a very easy fix :)
Or do this, it seems p useless
seems like you dont know it either
but how will it create the file
please when will you learn what constructors are and use dependency injection?
isn't that the line that makes it?
And then move line 53 to line 45
You cant write to a file that doesnt exist. Thats kinda obv isnt it?
move 54 to 57 to a newly created else block
- its looking for a file w/out a path
send github
yours
And for saving use customConfig.save()
jk, but at least give a hint kek
wat
https://hub.spigotmc.org/javadocs/bukkit/org/bukkit/plugin/java/JavaPlugin.html#getDataFolder() customConfigFile = new File(getDataFolder(), "gun-stats.yml")?
Yes, its there, but read saveResource("gun-stats.yml", false).
If its finding a datafolder to store it in, wouldnt you have to input the path to the datafolder?
So basically you'd have something like
customConfigFile = new File(getDataFolder(), "gun-stats.yml");
if (!customConfigFile.exists()) {
customConfigFile.getParentFile().mkdirs();
customConfig = new YamlConfiguration();
customConfig.set("slazor.maxLength", 15);
customConfig.set("slazor.damage", 4);
customConfig.set("slazor.reloadSpeed", 30);
customConfig.set("slazor.chargePerUse", 5);
} else {
try {
customConfig.load(customConfigFile);
} catch (IOException | InvalidConfigurationException e) {
e.printStackTrace();
}
}
that already got mentioned. anyways, everything you currently say here is mostly garbage. then jumping on him for not knowing java, lol. ¯_(ツ)_/¯
They still need to save the config file
How that is done is up to them
But at that point I'd redirect them to ?jd-s
luzifer u always have too harsh criticism smh
A little harsh but alr
it doesn't make the file
did someone try first experimental snapshot of 1.19? I updated spigot to 1.19_deep_dark_experimental_snapshot-1, everything works as it should, except when warden spawns, it changes its poses twice. I can't test if it's vanilla or spigot bug as I can't start mc because of some weird java issue. does anyone know if it's vanilla bug or maybe someone can test it on vanilla?
Send code.
declaration: package: org.bukkit.configuration.file, class: FileConfiguration
spigot does not have snapshot releases iirc
what code exactly do you mean?
Oh wait, you meant as in you were testing it out, thats probably a bug on that end lol
I updated it myself
Realized what you mean, read wrong
geol you spoonfed me with no explination, then when i ask something that obviously i won't know you do that
Im sorry.. you are using spigot on a snapshot when they dont exist?
Well thats why its cause your trying to make compatability for a snapshop
because at this point it is just a simple search.
Snapshots are buggy lol
that's kinda true ngl but u should learn how to search it
?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.
Just entering save in the search bar of the javadocs suffices to find the correct method for it
brb
for the last time please
its rare to see someone holding hands in coding communities
that won't help
drill it in his brain maybe idk lol
im a bit annoyed now tho
any idea why the f*ck zombie don't implement Ageable interface?
it is just useless spam and does the exact opposite of what it should do
The command should be removed
mm yes line numbers
only people that did it for me were ElgarL and frostalf and SolarRabbit
its dead
When I joined here I got SPAMMED with that
but it can be and adult, and baby
I avoid the command for a reason, instead spamming ?jd-s and ?stash
Helping him would
was a joke. it does extend Ageable https://hub.spigotmc.org/javadocs/spigot/org/bukkit/entity/Zombie.html
declaration: package: org.bukkit.entity, interface: Zombie
well maybe in 1.18 but in 1.13 it don't seem to
Because in bukkit world, both commands are much more valuable than all the linked tutorials combined
well holding hands isnt ur job but its nice to do
lmaooo
are you sure
can you create a new instance of a method in a class?
fine.
It's
customConfigFile = new File(getDataFolder(), "gun-stats.yml");
customConfig = new YamlConfiguration();
if (!customConfigFile.exists()) {
customConfigFile.getParentFile().mkdirs();
customConfig.set("slazor.maxLength", 15);
customConfig.set("slazor.damage", 4);
customConfig.set("slazor.reloadSpeed", 30);
customConfig.set("slazor.chargePerUse", 5);
try {
customConfig.save(customConfigFile);
} catch (IOException | InvalidConfigurationException e) {
e.printStackTrace();
}
} else {
try {
customConfig.load(customConfigFile);
} catch (IOException | InvalidConfigurationException e) {
e.printStackTrace();
}
}
like new UserData::createUser(uuid)

or will that crwate both the userdata class and the method
hes gunna complain your spoonfeeding him like earlier watch
I updated spigot to 1.19_deep_dark_experimental_snapshot-1. experimental snapshot was released about 3 weeks ago: https://www.minecraft.net/ru-ru/article/a-very-scary-snapshot
I can't test if looped warden poses is because of I updated some patch wrong or is it snapshot's bug, because I can't launch mc rn because of some weird java issue. that's why I asked
he probably doesnt understand smth
That's good.
hello
Some cases it is
Hey
I have a problem
Most if not all
Whats your issue?
with a plugin
If its not a problem with a plugin your coding, contact the devs of the plugin
whats wrong with FileConfiguration c = YamlConfiguration.loadConfiguration(file)?
idk
seems fine
ok
🧠
but it was a doubt for a plugin
I want to do this but I don't know how to do it
LOL
you're giving way too many details
invalidconfigurationexception just means youre noob
my brain cant comprehend the huge amount of inforamtion you have about your problem
my brain also fried reading that
also stop dming me pls
LOL
yes uwu
owo
priv
oh no...
please
Use my filehandler: https://paste.md-5.net/ecedisedux.java
we need more information lol
what your telling us is basically "help i have an issue"
Hello, i made some custom items in my plugin but they are usable in craft like for book and i don't want it, so i made that but it doesn't work
@EventHandler
public void craftItem(PrepareItemCraftEvent event) {
System.out.println("Testing craft item event");
CraftingInventory inv = event.getInventory();
for(ItemStack stack : inv.getStorageContents()) {
if(CustomPaper.contains(stack)) {
inv.setResult(null);
}
}
}```
I put the image
without any info
Stop friying your brains
If you just can explain me why
What your issue?
i had a stroke reading the last bit
am i an idiot or smth
What wrong?¡
Explain i listen
So i can improvee
Its possible to loop a list of custom object, compare a method value and them execute a void?
Yes?
I tried with ```java
list.stream().filter(object -> object.equals(bla)).map(object::remove);
But seems i cannot use the object var inside the map
why do yu have the boolean 'parent'?
Because if you wanna load a file with content from a file inside resource folder. Or just want to create an empty file
lol parent doesnt seem the right name for that
javadocs
Oh which would you put?
imagine catching yourself
Best way to check if block is a wooden gate without having to check for every material type that is a gate?
boolean loadFromJar or something
and have a fallback in case it isnt included in the jar
If I have a String with color codes and I want to split it in 16, 15/14 (depends on chatcolor) and 15/14 (depends on chatcolor), how can I copy over the colors to the next substring?
wait wha
I put parent because i dont like much using Capitals on vars
String1 = normal text
String2 = &a + test (& color from previous string)
String3 = &a + text (& color from previous string)
hey i have this and i want if player has enough money to dispatch command but i dont know how to. java public class HealMe implements CommandExecutor { @Override public boolean onCommand(CommandSender commandSender, Command command, String s, String[] strings) { Player p = (Player)commandSender; if(p.getHealth() <= 0.5F) { if(command.getName().equalsIgnoreCase("healme")){ Bukkit.dispatchCommand(p, "givemoney hastane 2000"); Location hastane = new Location(p.getWorld(), 192, 4, 799); p.teleport(hastane); p.setHealth(20F); p.setWalkSpeed(0.2F); p.sendTitle("Iyilestin", "Durumun Iyi"); } } return true; } }
assuming the whole first string is colored?
block.getType().toString().endsWith("_GATE")
I'm using The New Economy
Depends, it could also be non colored
I just want to check if object exists inside list and them remove it from the list
List<CustomObject> list = new ArrayList<>();
list.stream().filter(object -> object.getName().equals(name)).map(list::remove); // Pretty lovely told me that the map part its ignored
list.removeIf
bruh
Did you read full question?
Dang thats sweet. Okay thank you.
iirc if you check if the string starts with § or & it is colored
Yes sure
Wait i will send a cap
But colors could also be somewhere in the middle
list.removeIf(o -> o.getName().equals(name))
ChatColor.getLastColor() works fine
Oh thanks, i was overcomplicating my self
are there any limitations to Bungee plugins or do they have the same capability as Spigot plugins
Heyo 😄
Since I couldnt find much on the internet I might just ask here if anybody found a way to create a clickable URL in the kick screen of bungeecord/spigot?
Maybe Reflections or something?
TextComponent setClickEvent did not work sadly :/
well they are pretty alike as spigot ones but the API is more limited than the spigot one so thats your limitation i guess ^^
hmmm alright
That text isn’t clickable. It’s not part of the core UI. Otherwise there would be a button for it.
when you tell people you're busy but all you're doing is doing useless stuff
ah okay thank you c:
because I need an event to be fired across all servers from a bukkit plugin so im not sure how to accomplish that if bungee is more limited
TextComponent component = new TextComponent("Message here");
component.setHoverEvent(new HoverEvent(Action.SHOW_TEXT, (new ComponentBuilder("hover message")).create()));
component.setClickEvent(new ClickEvent(ClickEvent.Action.OPEN_URL, "url here"));
Id say you could use the BungeePluginMessagingChannel and catch that to use it in your own code again, should be possible?
Ill have a look, thank u
tried exactly that but no success 😅
Plugin message channel has a big issue, if you want to receive or send data you should have atleast 1 online player on the server
If not the data its never received or its queue until a player joins
uh oh
That why for cross-server its mostly used Redis
Because with redis you dont depend from a player
isnt redis just a memory store how would it come useful here 🤔
Redis is a message broker
Pub sub
Yeah
PubSub allow you to publish data on a specifc channels and once the data its send you receive it on every server, listening on that channel
TextComponent[] components = new ComponentBuilder()
.append("Message here")
.event(new ClickEvent(ClickEvent.Action.OPEN_URL, "url"))
.event(new HoverEvent(HoverEvent.Action.SHOW_TEXT, new Text("click on this")))
.create();
player.spigot().sendMessage(components);```
@celest lichen
What i sent
its different
Also why creating an array?
yeah in Chat but those dont work in the disconnect menu :/
So i was thinking anybody might have a hacky workaround xD
@tardy delta @sterile token he’s asking for the message in the kick screen not when they are on the server. Which isn’t clickable.
What are you trying to do?
because thats what a componentbuilder returns
wait wha in disconnect menu
I want an early GDPR acceptance question connected to a website where you click I accept.
But everything later like in chat would be annoying to code preventing UUIDs from being used yk?
oh kick screen
I don’t think UUIDs are covered in GDPR lol
Idk what its GDPR, someone?
general data protection rule
Do clickable components work in the kick screen
general data protection regulation
EU law on personal data usage
EU data privacy law
Yar har fid- aww
not for bungeecord tho as I tried it 🤔 or do I miss out on anything?
the Player#kickPlayer only works with a string as message :(
PR!
yes but the player.disconnect works with TextComponents
nms i assume?
You’ll need to use NMS components for that
would that work out technically? 🤔 and NMS in Bungeecord?
Not bungee ones
dunno
Im saving player object like this on mongo, how i would get each user object? Im a bit confused
{
"mongo-uuid": {
"uuid": "user-uuid",
"name": "user-name"
},
"mongo-uuid": {
"uuid": "user-uuid",
"name": "user-name"
}
}
ugh a pain in the ass to update that if mojang decides to write more .a.b,c methods ._. (ik its obfuscation)
Use mojmap
There’s always the mojang mappings
Use the mappings?
oh 🤔 fair point, didnt know of their existence O.O
I’ll look into PRing components for that tho
Put it on the list of things to do when not lazy
Im really confused :(
I mean by its key
I dont know the key
I mean the json representation is just a json representation
Wft
Document document = mongo#find("collection", Filters.eq("_id")); ?
That what you mean
