#help-development
1 messages ยท Page 43 of 1
i dont need them, but essentialsx does
it doesnt let me package without it
ah dependency i mean
yea but you can exclude it from the essentialsx dependency
hey, ive never built plugins with gradle, what do i do with this error?
just google "maven exclude transitive dependencies"
Aikar's Maven repo is down
Either it's just got some downtime and Aikar's working on bringing it back up, or it's been permanently relocated. Not sure. Aikar's been mostly MIA for a while
so i basically cant compile the plugin rn
Task #1 for Plugin v1.0-SNAPSHOT generated an exception
java.lang.ArrayIndexOutOfBoundsException: Index 12 out of bounds for length 8
what does it mean
it points to line which if i remove it works fine
the line just plays sound
How can I upgrade seeds to the next state? Basically like bonemeal
Share your code.
I believe that seeds fall under the Ageable class.
declaration: package: org.bukkit.block, interface: Block
how do people understand mojangs fields
Trial and error. And the mappings I guess. :PP
i've seen videos of people just coding with it
like on the fly
bru ok
thought there was some sort of tutorial for it
Not really. It's easier to pick up on if you do normal modding like Forge and what not, but besides that, it's the culmination of everyone's efforts that help us understand what their fields do.
Thanks
how do you make text not italic with the component system?
Give it a color code. Vanilla minecraft applies an italic look to custom text for some reason. So if you want to get rid of it, you need to overwrite the default styling.
or ChatColor.RESET + "test"
are you using mojang mappings?
thought this was paper discord
truthfully, it can sometimes take me hours to understand the code even with the mappings
deciphering all the decompiled code can be tricky
oh
reset will not get rid of the italic
reset will reset the text do its default state in context
e.i. if i used reset on an item name, it would be italic, because custom item names are normally italic
Code Review & Suggestions
How can I modify the way damage/knockback works in 1.8? I have this method, but the animation isn't sent (ex. the player doesn't flash red), the knockback is too consistent (isn't different based on where the player is hit, what item is used to hit them, etc.), the damage isn't affected by armor (they take the same damage as if they didn't have armor), etc. Is there a way to only affect knockback? I want to specifically modify the knockback the player takes and reduce the amount of damage an arrow deals.
Event Listener: https://sourceb.in/31lklRP6Zd
Combat class: https://sourceb.in/b6wGxxn4g9
?1.8
Too old! (Click the link to get the exact time)
I'm using 1.8 for the way PvP functions in that specific version.
add that to the bingo card
Then deal with the drawbacks that come with using such an old version. Support was dropped years ago
and the playerbase of 1.8 is vanishingly small. If you want 1.8 support then dig in old forum posts from half a decade ago.
That's fair enough. Mb
1.19 can definitely do very similar PvP. Not only that but if you want a successful server you'll either need to innovate on an ancient system or get really lucky.
How to respawn player without killing him first
Uh in order to respawn they kinda have to die
You can always clear their inventory and such manually then move them to their spawn
How could I convert a string (command argument) into EntityType?
EntityType is an enum
Is there anyway to fake respawn
Asking about your attempted solution rather than your actual problem
elaborate
Thanks!
Wipe the player inventory, reset levels, teleport them to where you want them to be?
What are you doing with this information?
Converting a string to EntityType
I tried setHealth(0) then spigot.respawn()
But that make chunk around reload
Anyone know any libs or apis that can easily do full armor set effects like particles or potion effects?
You dont say... i wanted to hear your specific approach
once again
?xy
Asking about your attempted solution rather than your actual problem
Have you tried just clearing their inventory and resetting levels then teleporting?
EntityType enType = EntityType.valueOf(args[0]);
you should probably do args[0].toUpperCase or something like that
Thats done in like 30 mins. You just need to utilize pdcs and a manager that keeps track of effects
good
I know it is but I don't have time ๐ญ
I know how to google stuff ive coded plugins for like a year but sometimes my brain just farts and I be asking the most basic shit :D
I have an update in like 10 mins and I forgot to put haste on the full set
Better yet you can add the ability to have autocomplete and pass in all the enum values so they can tab complete the right entity
Yeah, though that's done in a tab completer and I'm just implementing the command :)
Hastily putting in code like that into production is bound to cause major problems. Postpone the update.
Ah time constraints. Bugs I hardly knew ya
eh people will just have to deal with it for 30 mins until I finish it tbh
Is this some type of kit pvp fkery?

nah
i mean ideally you would wait until the code is complete to announce an update
and between announcement and release youre constantly testing it
I mean announcing an update is fine as long as you aren't announcing some date it's being added.
Cancel the damage in 50% of the events to have effectively 50% more durability
Cancel PlayerDamageItemEvent
You can also limit the damage taken to 1 point per hit maximum
Yeah
declaration: package: org.bukkit.event.player, class: PlayerItemDamageEvent
Does your armor have unbreaking
Cause that's what unbreaking does
It just completely cancels the damage a certain % of the time
Use a combination of the suggestions
Bro
Snort a tonne of cocaine and write your own durability system works too
Anyone know why intellij dies every time I paste
Probably windows
Like it freezes up and takes 37 years to process
potato pc
and maxes cpu usage
Certified MC plugin moment
It's a $3000 pc
Windows moment
If you're using the MC plugin that's a part of it
Shouldnt have bought 200 kg of potatoes with that money
lol
Also increase the max memory
This is what I pated for reference:
ArrayList<String> decentLore = new ArrayList<>(Arrays.asList(format("&c"), format("&f&m &r&f[EFFECTS]&m "), format("&l&7ยป&r &eHaste II"), format("&c"), format("&f&m &r&f[STATS]&m "), format(" &8(In Deep Mines)"), format("&l&7ยป&r &cMob Damage &f-40%"), format("&l&7ยป&r &aPlayer Damage &f-20%"), format("&c"), format("&8Must Have Full Decent Set")));
player.getInventory().addItem(createLeatherArmorPiece(hexColor("#2935FFDecent Cap"), Color.fromRGB(41, 53, 255), Material.LEATHER_HELMET, 1, decentLore, "DECENT"));
player.getInventory().addItem(createLeatherArmorPiece(hexColor("#2935FFDecent Tunic"), Color.fromRGB(41, 53, 255), Material.LEATHER_CHESTPLATE, 1, decentLore, "DECENT"));
player.getInventory().addItem(createLeatherArmorPiece(hexColor("#2935FFDecent Slacks"), Color.fromRGB(41, 53, 255), Material.LEATHER_LEGGINGS, 1, decentLore, "DECENT"));
player.getInventory().addItem(createLeatherArmorPiece(hexColor("#2935FFDecent Booties"), Color.fromRGB(41, 53, 255), Material.LEATHER_BOOTS, 1, decentLore, "DECENT"));
pated
Disable MC plugin try again
Love how that freezes intellij
I did already
wdym?
Alternative to cocaine is putting on nightcore music and having a bottle of vodka
my progress lmfao
Disable MC plugin then
It's just a blank maven project
Do you have the MC plugin?
Oh well then ur PC is a potato
It's not tho
Only works for eastern- and northern europeans and balkans though
I was only half joking about it being windows
average linux user
There's a very good chance that if you run it on linux you would not encounter that issue
probably not the OS, nor the the pc
Get jetbrains toolbox and update to the latest version. Then make sure your plugins are up to data.
Im almost certain that this is caused by an external ij plugin, your anticheat, a virus or your potato specs
its intellij
Well it might not necessarily be windows itself
I can't be asked to learn linux
I can run intellij on my raspberry pi...
It might be something else about the environment
Linux is so horrible
And if you run it on linux it will be in an entirely different environment
do you have any code inspec plugins?
So it'd probably be different enough to work
I have no plugins
Update your ide
I mean for me to learn bro ๐
I know it's better than windows
have u tried restarting ur pc
Have you tried reinstalling intellij
Do you have any other things running that might be hogging cpu
are u using community edition
Ok then that's why I recommend trying to run it on linux
Get the toolbox and check for updates
Yeah you could try running it within wsl
alr
Imma just go back to eclipse if this don't work
ultimate edition ๐
I have like 20 mins to code this
Oh
Could as well just use notepad then
Why so little time
Cause I have an update and forgot to add a feature
or the ms paint editor
Gotta pay for intellij
Bump
Nobody's gonna be so mad if it's one hour late
or literally just say this feature will come tomorrow
my players would kill me
This chat is for developers
Go to #help-server
get new players
For an hour delay?
Thx
It's 12 year old hcf players
Bruh
You gotta make them used to delays
Start with 15 minutes
Next update 30
Is there anyway I can compress a Location object? I just want XYZ
Then an hour
Vector
Why would you make a promise about the exact time an update will drop anyways
imma just perm shutdown
toVector
flights when you are rushing be like:
Slowly get them used to it c:
ty
I didn't promise anything I could pushback I just don't want to
Normally updates are at some unspecified time within a 24 hour window
If you are me within a 24 day window
i mean
I always do mine monday night at 3 AM
Automated update with a 1h notice.
we're not the ones to complain about your poor planning lol
we help with dev solutions
not necessarily server management
Having an exact schedule for updates is important for production servers.
You can also get me to write the feature
public static HashMap<Vector, Material> blocksForIceman = new HashMap<>();
Whytf does intelliJ ask me to generify my class
hcf = 1.8 you fool
There is no functionality that is specific to HashMap that isn't exposed by the Map interface
So use the Map interface
oh yea
It's always best to use the least-specific type you need for every field
It makes things more flexible
Make this private and non-static
^
?di
Guide to dependency injection: https://www.spigotmc.org/wiki/using-dependency-injection/
I'm so bored right now I'd do it anyways
bro dont get me started, (this is what i work on) and they have 50% DI, 50% Static Abuse
Now the 50% static abuse is
- 50% usingg
.getInstance() - 50% using
.instancestraight up
- Half of the package names are in spanish ๐
blocks for iceman
I need to ask the guy what specific package means just so I can work on it
oh yea and checkout this monstrosity
?paste
How do you name half of the packages in english and half of them in Spanish?
Its not me
Ah yes. I can smell the undebuggable errors where something in a static block throws an exception and suddenly you get
classloader exceptions with cryptic messages
https://paste.md-5.net/huwakeletu.cs
Check thiis out
Like if they were all in Spanish it would be understandable but HALF?
yea i swear you could perform a satanic ritual with some of those errors
Having trouble changing the skin here's my code
same with the serialization errors
sometimes i regret working here but man is the pay good
What is it actually trying to achieve?
i dont know
Setting a player's skin, presumably
I've done that before, I think it's a lot more involved than that
Like a lot
Best to use an existing api if you can
The last solution I made for that was for 1.12 and used nms
This did cost me 12 hours of raw debugging
oh so its basically like tryna set a ice block back to water after X seconds, this is what i m working on, i need to make it go to the original state rather than water cuz that floods shit
JSONSimple :giga-chad:
shill
lol
oh i finally found you
Do you now a API for 1.19?
you are the guy who names his plugins with the prefix Red right?
gson is a lot less robust than i wish it was
Yeah, which ones have you seen
RedLib
Setting a players skin in 1.19 is like 3 lines
Where did you even see it
Okay but I was ment to fix a bug with an existing plugin for a server I play with friends, instead ive spent 2 hours straight working on my own rpg stats plugin
PlugWoman 
PlugTheySlashThem
Oh lol
PlugXheSlashXhemCauseIDontWantToGetCancelled
๐คจ
but did they actually change the name to PlugWoman?
I made PlugWoman
i shouldnt have said anything.
PlugPerson(Xey/Xer/AttackHelicopter)
i love how there is literally 0 docs on how pdf encryption works
WOAH
I PREFIX MY PLUGIN WITH "Nerd"
NerdNovato xd
yo red, so i searched up "PlugWoman", and the 2nd result is butt plugs
Usually when I can't think of a better name lol
Like literally every plugin ive made in the past few months as personal projects have started with Nerd
It's a funny story, it's cause only nerds will ever use my plugins
(me)
Must be personalized search results, vinesh
man i want a plugin idea that i can make a youtube video out of
like fundee made snake in minecraft
Butt plugs in minecraft
oi no i use duckfuckgo
duckfuckgo?
yea
which is what
i find ddg too goofy of a name to use
public void changeSkin(Player player, URL skinUrl) {
PlayerProfile profile = player.getPlayerProfile();
profile.getTextures().setSkin(skinUrl);
player.setPlayerProfile(profile);
player.spigot().respawn();
}
Something like this
its basically duckduckgo but red theme
oh you gotta get nms into this?
Nope
Oh for real?
all api
idk why i wet my pans when I see nms
Holy shit the api has come such a long way
indeed
from being made by a nerd to being sold to metaverse
Context: #announcements message
fym
based
Ordinate > RedCommands
Purple
well
Genuinely, purple is my favorite color
i havent looked at ordinate, lemme take a gander
orange > purple
Ollie can I show you some code samples
then name it RedPurpleLex, the prefix is longer than the name
A function from each
i read that as gender โ ๏ธ
that is paper isn't it ?
Yes but the spigot thing is quite similar
Whoever asked for an idea just make chess into minecraft with 3d models n stuff
Yeah it worked differently.
Like you have to aim at the piece on the board and then at the spot to move it on
this color beats any paper in the whole dayum world
And it just works as chess
thats actually a sick idea
lemme go vomit
imma make it
๐ญ its my fav colour
nah
oh actually
transparent is the best colour
or white cuz it can be anything
This flag is set as my profile mostly because purple is so aesthetic and it has a lot of purple lol
Neither of those are colors
not the straight flag tho
Imagine planning projects and not just vomiting on your keyboard and hoping that it works
transparency is the absence of color
This is exactly my problem
33% of my time goes to coding 33% to listening to music and 33% to talking random crap on discord
dont ask where that 1% goes you dont want to know
only 1%
publishToMavenLocal
your a Nun
Yeah man i dont last long
Are you trying to use Ordinate
yes
lol nice
More time for coding though
It's not really in a workable state right now
Like it'll work but you have to do some things yourself
You can append it to the build task
Essentially just implement CommandManager
But all CommandManager does is return other dependencies
Which you also have to implement
great
I basically wrote the core of the framework and all it needs to work
But then didn't write the platform-specific implementations of it
FYI you need a mavenCentral() in the spigot module
it doesnt fuckin work if not
It did for me
couldnt find guava or some shit
Weird
The spigot repo should provide it
Because spigot pulls it transitively through its own repo
The stuff with chat signing and adventure honestly really killed my motivation to finish the implementation of the command manager
Yeah, you get the dependencies of the dependencies you use unless they scope them as provided
- brigadier support
All the stuff I would need to do to make it properly professional
No motivation for it
this ComponentFactory is ๐ตโ๐ซ
we all man, we all
i honestly never bother with command frameworks and just register them normally
wrong chat lmfa
looks cool, but not necessarily designed to just be a simple boilerplate killer
โ๏ธ cloud โ๏ธ
lol, anyways i need to get back to finding any documentation on PDF's
my mind is kinda fucked up
so
import com.annihilation.core.kits.*;
import com.annihilation.core.JuegoAnni.*;
import com.annihilation.core.mapaAnni.*;
import com.annihilation.core.utils.*;
Why do star imports not work sometimes
define not work
ou so, when i compile, it works
they should always work
maybe intelliJ is drunk
ur ide must just be fucked
yea
is it on the right java vesion
Build -> Rebuild Project sometimes works
uhm so
I got two plugins, lets name em X and Y
Y uses X as a dependency, I made a change in X, now what do I do to get the changes in Y, do I just need to reload my IDE?
its not maven, its my local jar
nvm it is
Install the one you want to use and use it
<dependency>
<groupId>com.annihilation.core</groupId>
<artifactId>AnnihilationCore</artifactId>
<version>1.0-SNAPSHOT</version>
<scope>compile</scope>
</dependency>
and boom now intelliJ thinks it doesnt exist
the dependecy or?
Yea that's how you build it to the m2
public void SetLore(ItemStack IS, String piece) {
ItemMeta IM = IS.getItemMeta();
if (IS.getType() == Material.LEATHER_BOOTS || IS.getType() == Material.LEATHER_LEGGINGS || IS.getType() == Material.LEATHER_CHESTPLATE) {
LeatherArmorMeta LM = (LeatherArmorMeta) IM;
LM.setColor(Colour);
LM.addEnchant(Enchantment.PROTECTION_ENVIRONMENTAL, 1, true);
LM.addItemFlags(ItemFlag.HIDE_ATTRIBUTES, ItemFlag.HIDE_DYE, ItemFlag.HIDE_ENCHANTS);
LM.setDisplayName(ChatColor.LIGHT_PURPLE + Name + " " + piece);
Key = new NamespacedKey(GreatGear.getPlugin(GreatGear.class), Name);
PersistentDataContainer container = LM.getPersistentDataContainer();
container.set(Key, PersistentDataType.INTEGER, 1);
IS.setItemMeta(LM);
} else {
IM.addEnchant(Enchantment.PROTECTION_ENVIRONMENTAL, 1, true);
IM.addItemFlags(ItemFlag.HIDE_ATTRIBUTES, ItemFlag.HIDE_DYE, ItemFlag.HIDE_ENCHANTS);
IM.setDisplayName(ChatColor.LIGHT_PURPLE + Name + " " + piece);
// SET PDC
Key = new NamespacedKey(GreatGear.getPlugin(GreatGear.class), Name);
PersistentDataContainer container = IM.getPersistentDataContainer();
container.set(Key, PersistentDataType.INTEGER, 1);
IS.setItemMeta(IM);
}
}
How can I make this more efficient
i feel like this could be done another way
no
you need to install the dependency to your local maven repo
mvn clean install on X
beyond that, you have a lot of duplicate logic
and your IDE should re-index the changes on your local maven repo
oh i need to clean as well
i was like, i m mvn installing, and then i m reloading but still
i mean clean is just good practice
ou
is it worth to check if an item is a hoe by Tag.HOE.isTagged(material) or is hoe material.name().endsWith("HOE") also good?
use the tag
tag ends with stuff is like,
idk, jumping from the building hoping a trampoline is down there
while a parachute was right there
hmm i was thinking about storing some Map<Tag, SkillCategory> but cant really get a tag from somewhere
i mean like is the if statement nessecary
it was supposed to be right there
but i stole it
that if statement is only required for the colour
and tbf kind of useless
like meh
just do an instanceOf check on the item meta
and check if it is a leather meta
instead of the material check
package aioplugin.aioplugin.events;
import com.mongodb.client.MongoCollection;
import com.mongodb.client.MongoDatabase;
import org.bson.Document;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.jetbrains.annotations.NotNull;
import java.util.UUID;
public class PlayerJoinEvent implements Listener {
MongoCollection<Document> NewJoins;
@EventHandler
void onPlayerJoin(org.bukkit.event.player.PlayerJoinEvent event){
if(!event.getPlayer().hasPlayedBefore()){
@NotNull String PlayerName = event.getPlayer().getName();
UUID uuid = event.getPlayer().getUniqueId();
Document document = new Document();
document.append("Name", PlayerName);
document.append("UUID", uuid);
NewJoins.insertOne(document);
} else {
System.out.println("User has Played Before.");
}
}
}
``` im trying to Log a new User in MongoDB whenever they join for the first time, but when i tested it it did not log the new user in the db
oh god @urban grotto
uhm so guys
I made a change in my local dependecy
I did clean, using intelliJ< and then install
I reloaded my plugin in the IDE
but still it aint showing my changes
it also didnt give any errors
iirc hasPlayedBefore is basically always true in the join event
did you register the event?
How would i remove the "Custom" and "Burst" from the lore of a firework star
Yup
pings that guy
package aioplugin.aioplugin;
import aioplugin.aioplugin.database.DBConfig;
import aioplugin.aioplugin.events.PlayerJoinEvent;
import com.mongodb.ConnectionString;
import com.mongodb.MongoClientSettings;
import com.mongodb.client.MongoClient;
import com.mongodb.client.MongoClients;
import com.mongodb.client.MongoCollection;
import com.mongodb.client.MongoDatabase;
import org.bson.Document;
import org.bukkit.plugin.java.JavaPlugin;
public final class AIOPlugin extends JavaPlugin {
// Setup Mongo
ConnectionString connectionString = new ConnectionString(DBConfig.AIO_CONNECTION);
MongoClientSettings settings = MongoClientSettings.builder()
.applyConnectionString(connectionString)
.build();
MongoClient mongoClient = MongoClients.create(settings);
// Get Db
MongoDatabase AIO = mongoClient.getDatabase("AIO");
// Get Collections
MongoCollection<Document> AIO2 = AIO.getCollection("NewJoins");
@Override
public void onEnable() {
// Log to Console Once Plugin is Enabled
System.out.println("[ AIO ] - AIO Plugin Has Been Enabled");
saveDefaultConfig();
getServer().getPluginManager().registerEvents(new PlayerJoinEvent(), this);
}
@Override
public void onDisable() {
// Log to Console Once Plugin is Disabled
System.out.println("[ AIO ] - AIO Plugin Has Been Disabled");
saveConfig();
}
}
setLore?
so its related to you sending data to mongo
im already setting the lore but thats just appearing with it
https://hub.spigotmc.org/javadocs/bukkit/org/bukkit/inventory/ItemFlag.html
ItemFlag#HIDE_ATTRIBUTES
declaration: package: org.bukkit.inventory, enum: ItemFlag
yeah maybe idk where to ask so i asked here
ah ty
why is the colour useless
it is required for my usecase
wait could i use a try except
to set colour
ohhh i found the issue
Keep in mind that some items are weird. So you may need to use HIDE_ENCHANTS in some cases.
hm?
MongoCollection<Document> NewJoins;
You add stuff to this
but never send it back to mongo
ohhh
or idk cuz i have never used mongo
ok
all iknow is that it uses BSON, Baby Script Object Notation
a lil bumpy
no like, lemme grab the spoon
whats the point on telling me its useless if your not going to tell me why
that is why I am getting the spoon
final ItemMeta itemMeta = ...;
if (itemMeta instanceof LeatherArmorMeta leatherArmorMeta) {
leatherArmorMeta.setColor(color);
}
itemMeta.addEnchant(Enchantment.PROTECTION_ENVIRONMENTAL, 1, true);
itemMeta.addItemFlags(ItemFlag.HIDE_ATTRIBUTES, ItemFlag.HIDE_DYE, ItemFlag.HIDE_ENCHANTS);
here
why do you use the exact same code twice?
why does maven not load my changes from my local plugin
additionally, checking all material types is useless if you can just instanceOf check the item meta
it does
unless you're doing something wrong
.
Yea
I am doing smth wrong
are you sure that the version you built is the same as in your other pom?
so maven creates a new version everytime you install?
I want to generate custom armour sets and sometimes they require colour and other times they require iron armour so no colour
no
try File -> Invalidate Caches
and then?
then basically check everything and click on Restart
aye aye sir
Why does this work (AKA SHOWS THE CORRECT LOCATION)
Location middle = location.clone();
Location edge1 = middle.add(length/2, 0, width/2).clone();
Location edge2 = location.add(-length/2, 0, -width/2).clone();```
But this doesn't
```java
Location edge1 = location.add(length/2, 0, width/2).clone();
Location edge2 = location.add(-length/2, 0, -width/2).clone();```
?notworking
"Does not working" is a useless statement. Please describe what exactly is not working, what you expect it to do, and what actually happens. If you get any console errors, also ?paste the entire stacktrace.
sorry but "not working" is totally useless
I thought you can understand from the variable names but ok
I do understand what you are trying to do
what I don't understand is what's not working
it shows the incorrect location when using the second part
but for some reason works using the first one
but I used .clone()
You need to clone first
but you used it wrong
Location edge1 = location.clone().add(...)
clone first, then add
not the other way around
still da same
Oh I get it, tysm
np
?paste both of your plugins' pom files
Hello, I am receiving this error. Anyone know what might be happening?
Error:
Caused by: java.lang.NullPointerException
Code:
public File getPlayerDataFile(String playerUUID) {
return playerDataFile = new File(plugin.getDataFolder(), playerUUID+".yml");
}
The file is in the path
NPE ๐
File is probably null.
plugin is null
are you in a java version under 14?
?paste the FULL stacktrace
cuz man is it hard to debug NPEs under java 14
well only if you got like 100 variables in one line
I mean, it normally tells you exactly the line number
if only one would use an updated java version ๐ญ
I still remember when java 8 was the new shit
and every plugin had something like "YOU MUST!!!! USE JAVA 8 FOR THIS PLUGIN TO WORK"
and they all got 1 star reviews because "why no workings"
lmao xD ngl I am very happy with the current JDK development
my school be using java 7 smh
ready
you should also send the link lol
the changes to the 6 month iteration is really doing nice work for jdk
yeah definitely
unfortunately it will again take months for people to update ๐ข so I'm still using java 8 for public stuff
Called it. File doesn't exist.
what's IFileManager line 40?
@tender shard ๐
non existent file != null pointer exception
what I said
alex is never wrong lynx
hmmm
return playerDataFile = new File(plugin.getDataFolder(), playerUUID+".yml");
true
oooh I am
not wrong once before
but when I'm wrong, I delete all my previous messages
when you said i m secksy, u were wrong

thats a big brainer move
Where is plugin defined?
I have a method to create the playerData with the same route (File(plugin.getDataFolder(), playerUUID+".yml");" that if it works, it only fails when it tries to get it
probably a field that was never assigned any value
IFileManager constructor
show the whole IFileManager class pls
Did you give it a value?
Yes
https://paste.md-5.net/gutebihisa.xml
https://paste.md-5.net/opapujugok.xml
My poms, when I make a change in the dependency (my own local dep), it doesnt show up in the plugin, even after clean, install and reload
Then yea, please share the class.
check your own plugin in your local repo, decompile it and see if it actually contains what you think it contains
your local repo is at ~/.m2/repository
I send it here directly or on the paste page?
?paste
Are you trying to setup a multi-module project?
How do i in the InventoryClickEvent get the block just clicked? So when the player clicks a chest, i can do stuff with the chest
show your main class code please
InventoryClickEvent doesn't relate to any blocks
@tender shard It's looking more and more like a missing file. ๐
what exactly are you trying to do? detect a chest being clicked inside an inventory, or detecting if a "real" chest is about to be opened?
no
because new File(nonExistent) doesn't throw a NPE
how else would you create files
uhm its compiled stuff
i dont think i have enough braincells to read it
that's why I said "decompile it" ๐
Hello Guys, i have a question...
Heres the code: https://paste.md-5.net/ocusiyifug.cs
Is it possbile so the messages are like "Acacia Planks" like with the pickup event but when i craft acacia wood e.g. to planks i get "WOOD" in chat and all is toUpperCase and with "_". Do you guys have any ideas how i can fix this?
Thx ^^
download JD-GUI or Luyten or Recaf or whatever can decompile .jar files
Well this is still the generator thing if you remember. Basically there is a chest in the center of the generator, that when the player clicks open some UI. That works. In the UI i have a button to pickup the generator. So i thought the best way to do that and the easiest would be to just get the coordinate of the chest clicked, and then set it to air, and the surrounding blocks around it that form the generator. So i need to access the chest block they clicked when opened the UI
oh yea it doesnt contain
Create the file every time a player enters the server, the IFileManager is created like this:
PlayerJoinListener:
https://paste.md-5.net/diheridajo.java
MainClass:
https://paste.md-5.net/ajimepepux.java
It may not throw one directly, but a file can be null.
can't you just do getInventory().getHolder() in the InventoryOpenEvent, to get the chest block?
show your maven log when you compile it pls
where is it generated?
it can definitely not be null if you do file = new File(...)
oh yeah that works, but what do i put after getHolder()?
cause i dont see any .setBlock or anything
nothing. you can cast it to Block
np ๐
or wait
in intelliJ, click the uppermost thing on the left (which I marked)
alex?
i would maybe
then the full log is on the right
ou
Block chestBlock = e.getInventory().getHolder();
will that work?
if you could try to use text components
and use the translation feature
no, you need to cast it
that would give you what you want
Block chestBlock = (Block) event.getInventory().getHolder();
mfnalex here it is
Ohh
Thanks man!
did you create the datafolder?
myPlugin.getDataFolder().mkdirs();
?paste
https://paste.md-5.net/avujupexec.sql
from maven install
does bungee chat even have translations?
Yes, when entering the server it does create the file and the datafolder. The only thing that doesn't seem to work is the getPlayerDataFile()
huh
sometimes i think my code tests me rather than me testing it
I am so bored I will write someone's code for them
maybe do a command framework
so, i got u
write an minecraft speedrunning AI
third times the charm
yea
@tender shard ๐
lets get a life bois
write a jar that can replace strings in compiled jar files
Write the file-based language system I suggested quite a while ago. :3
๐ญ
write a jar that writes itself
e.g. something to replace %%__USER__%% with something else
[Server thread/ERROR]: Could not pass event InventoryClickEvent to MyFirstPlugin v1.0-SNAPSHOT
org.bukkit.event.EventException: null
I get this error in the console
That's easy
then do it
I'll write a bash script
show the full error
send it when you've done it pls
lol
you do realize that .jar files do not contain plain strings lol?
mfnalex
sed -i s/%%__USER__%%/hello/ filename
Do they not
that will work for .java files
but not for compiled stuff
I have
its squigly characters
it once formed (this is really rare) a ascii art
it would say "ur mum" and then "sus" and then "never gonna give you up"
Pastebin.com is the number one paste tool since 2002. Pastebin is a website where you can store text online for a set period of time.
๐
The build succeeded. What's the problem?
its not taking my latest changes
i added two variables in a file and they aint there
Did you clean install?
what's line 25 in "ClickEvent" class?
switch (e.getCurrentItem().getType()){
there is no "getCurrentItem" in this case
doing clean from inteliJ and then install works?
I do it like this https://github.com/JEFF-Media-GbR/JarStringReplacer
in IntelliJ, click on the maven "m" button, then simply enter "mvn clean install"
enter?
install takes your changes and installs it to your local maven repo. Which in turn allows your IDE to recognize that changes have been made to that module.
yes
terminal right?
what
ou foq
DAYUM THIS SHIT IS COOL
they updated the icon i think
getCurrentItem can be null
it's annotated with @Nullable
that means, sometimes it's null, so you cannot use getType() if it's null
so, simply check if event.getCurrentItem() is null. If no, you can do your switch thing
thoughts on making a block (a specific itemstack) unplaceable? Blockplaceevent.getblockplaced.equals doesn't work
just did that and it still didnt upload the changes
Here you can see it works, it get the current item clicked, so it works with different. But when i add ```java
Block chestBlock = (Block) e.getInventory().getHolder();
chestBlock.setType(Material.AIR);
It stops working, that single item
when i click that item only
the barrier to be exact
Any recommendation to execute it using CompletableFuture?
Because the shity ComplatableFuture doesnt allow to execute code which throws exception
^
patient bro you are not paying anyone
e.getBlock().getType() == Material.TYPE_HERE
specific itemstack
Then compare it to e.getItemInHand()
alr
How do i get the block the player is currently looking at?
Isn't it raycast or something
what's the error message
mfalex nice to see you
Oh it's Player#getTargetBlock
ofc it does
declaration: package: org.bukkit.entity, interface: LivingEntity
heo ๐
It doesnt mfalex
I always suggest getTargetBlockExact, because the other one is weird sometimes
or maybe I am too stupid to use it
the one i sent
it does, but you gotta use unchecked exceptions, e.g. RuntimeException
It probably depends on how accurate you need it to be
Redempt, where's the jar string replacer now
Basically the same shity i have said
I demand to see it
well why don't you just wrap your code into a try / catch, then rethrow the checked exception as runtime exception?
aso WTF
why do you instantly do join
Could I give you a json parser instead
copilot recommendations
that's like not using a future at a
no but I could need a good and simpe java csv parser. one that aso properly accepts "quotes, and stuff"
Copilot is clearly 13 steps ahead
https://github.com/JEFF-Media-GbR/JeffLib/blob/master/core/src/main/java/com/jeff_media/jefflib/data/CSVParser.java I wrote this but obviously it's total shit
Im also figuring how to do a CompletableFuture which allow me to throw checked eceptions
it's good enough for what I needed lmao
yes please
Alright
Oh really?
One parser coming right up
basically I only needed to parse this https://github.com/JEFF-Media-GbR/JeffLib/blob/master/dist/src/main/resources/mcversions.csv
Wait so why does it need to support quotes
ohh => <=
And why parse to string instead of int?
I thought he was going to help me
so I can reuse it for other stuff too
Do you want a fast dedicated int[][] parser?
right now it doesnt need to support quotes properly, but obviously it would be good for future stuff
Or do you just want String[][]
Why not use an existing one then
I checked and they were all like 2 MB
and people would then think "why tf is this plugin 5mb" lol
I'll write you a one-file csv parser
โค๏ธ
Could I just get credit for it if you use it
Ok
ill send one too
โค๏ธ
what mail program is that?
lmao where is that
in an email we exchanged lol
LOL
bump
hump*
well well well @golden kelp now decompile the .jar in your target folder
does this include your changes?
No Sir
id hump someone if i would
e.g. ~/IdeaProjects/MyPluginThatDoesntWork/target/
oh yea it does
do all the donations go to him?
he maybe donated to the other contributors as well
Does the player have to be online for Player#sendBlockDamage to work?
uh dont work with invalid player objects ig?
im making a request-response type pattern for some servers, in which i want to be able to retrieve all online servers of a specific type
currently
I have this:
erm of course
private ArrayList<ServerInfo> requestServers(ServerType serverType) {
UUID requestId = UUID.randomUUID();
infoResponses.put(requestId, new ArrayList<>());
new RedisRequestServerInfo(new ServerInfoRequest(requestId, serverType));
try {
Thread.sleep(2000);
} catch (InterruptedException e) {
throw new RuntimeException(e);
}
ArrayList<ServerInfo> serverInfos = new ArrayList<>(infoResponses.get(requestId));
infoResponses.remove(requestId);
return serverInfos;
}```
I was wondering
if infoResponses should be a ConcurrentHashmap
is it possible to send block damage without a player
(its being updated in a different async thread)
But I want to send block damage to an offline player so a random part of their real life house starts to break
no, it makes absolutely no sense
whom would you show the block damage?
the next nearby skeleton?
it doesn't care about that
fair enough
in the getTargetBlock() i need to set "transparent:" to something. What does this do? The description says: "transparent - Set containing all transparent block Materials (set to null for only air)" But im too stupid to understand it
pls don't send block damage to me though
what does it want me to set it too?
I will show you an example
I'm looking at LEAVES right now
if however OAK_LEAVES would be inside the "transparent" set, it would just ignore it, and gimme the grass block undernearth
so it's basically a list of materials you can "look through"
normally you just want to set it to only have AIR or maybe WATER as transparent
exactly ๐
I basically just wanted it to show block damage to nearby players
like that
bump number 69
so you do have players nearby
I really don't understand why you want to get rid of the player object
Thanks!
to invoke a method on that player
wait-
does it only show for that player?
obviously, yes
oh bruh
thanks
otherwise it'd be part of Block or World class, instead of Player ๐
๐
NO THIS CANT BE REAL, I SPENT 1 HOUR TRYING TO FIX IT
apparently the problem is i also imported the jar which overwriten the changes
it means that this variable cannot be reassigned
it's basically useless
but
?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.
Why CompletableFuture is so shity and try-catch checked exceptions ๐ก ๐ก
probably you didnt understand it
bruh
CompleteableFuture is not shit
Lmao its really shity bruh it doesnt allow to execute methods which THROWS Exception
I think they are called checked exceptions
:(
don't do me like that I need to feel validated for finaling most of my fields and local variables
so just wrap it into a try / catch yourself
I dont understand the problem
im doing but said shits like should return, and many things
you could create a method that just wraps a completable future
Okay can you help me?
Because also the CompletableFuture#get() throw exceptions
๐ก
can i use spaces in the commands.yml commands
no
dam
yes, what else would it do
you should never have to use get() anyway
Wait wait i will send code because im on fire
if you use get() on a future, you shouldnt have used a future (in most cases)
this makes noooo sense at all
you think that this makes it async?
because it doesn't
you still query the database directly on the main thread
Okay so i need to define an executor right?
what are you actuay trying to do?
To run aysnc queries without needing to try-catch that method when call it
you realize that the main thread still has to await the result of this async query right
whenever you do .get() or .join() or simiar on a future, you lose all the advantages that futures have
it makes no sense
it doesnt work like this
thats not a proper implementation of async
and how? My friend @peak depot says thats dumb and is very shitti to code
by calling get(), you make it wait for the result
it's not dumb
but it's indeed annoying to code
It's complex because it allows for complex behavior
well philb is a loser
components are dope but yes annoying
I mean i need to do something like:
ResultSet result = ClassName#query("sql here");
take a look at the lowest one
I can confirm
I have never met him or talked to him, but
I can confirm
thi mfalex and y2
this will not magically make it async
it still blocks the main thread whereever you call it
I know so that why im asking help for doing it
well if your needing an async result and you slap that on main theard what you think going to happen. The initial query will make it async, but the main thread will still need to wait every time you call it
Ok so its really diff from javascript
IThat what i most hate from java
In java async need much shities
yeah well is there any other way bc thats just ugly lol
java script is one of the most ass things ever created lol
Will check ro
you can actually read a lot of stuff async on spigot
Where u using async?
well i dont even think you can add translations with the current component api
bro i have nothing to to with that
implemented in the persistence/Storage class
apparently you did lol
no, it works like this in basically every language
that's just not true
JavaScript has that weird magic with await
you just don't understand that you can't just do calls to a synced method and then expect it to magically go async while still returning something instantly
So give a small example
meh i nearly got it
your method should either return a CompletableFuture<ResultSet>
JavaScript ๐ can we just get something better already
or return it directly
you cannot make it do something in a future but then just use get() to return the object
it literally makes no sense
McMMO2
just use a callback with a Consumer
gotta implement the tools too
waht?