#help-development
1 messages · Page 1995 of 1
yea. which is your package name right?
yes
it also has a filename behind it right?
yes
the eror says something about this sting
public static String a = this;
and whatever a nulleraccepton is
can you show me the whole class then.
no thx
a nullpointer happens when you try to access something that does not exist bassically
it has important secret code in it that i canot show or else you could steal it
so blur it or something
Trust me, we have no interest in stealing code that generates a null pointer exception lol
yea... but its alright
this is what it has
if (funytestcool.a == "test") {
sender.sendMessage("chungus");
well looks like funytestcool.a is null then
do you have a being defined anywhere?
yes
can you show us where its being defined?
no thx
well how are we supposed to help you with so little information.
well we cant help you if you dont provide the info we need to help you
sounds like a personal issue
what
huh?
if your doing an if-else statement you should also put a else {}
you don't need an else.
if the only thing it should be is test
then a isnt being defined as test
are you SURE you have something defining a as "test"?
and that the function is being called?
yea 'a' is definitely not set. hence you get a nullpointerexception.
yes but it still null
are you sure you define it before you attempt to run this code?
yes i am sure
Also you can’t compare strings with ==
the comand does dotest() before checking for tes
can we see dotest()'s code?
yeah no sorry its not supost to be public code
is code for my upcoming spigot pugin
to me it sounds like your a total beginner
i wouldnt recommend making plugins for the spigot resources yet
really. every person here has no interest in stealing your code. we are all here in our own time to help some people out.
thats the code you were afraid of leaking..
still doesnt provide much more information tbh haha
we need to see where its being called
it being called in commad
okay and where is that check being called
asking for help but don't want to get helped
where you test if a == "test"?
public boolean onCommand(@NotNull CommandSender sender, @NotNull Command command, @NotNull String label, @NotNull String[] args) {
if (funytestcool.a == "test") {
sender.sendMessage("chungus");
}
dotest();
}
well this would not work already
your calling dotest() before you check if its "chungus"
how fix that
put dotest(); before the if statement
sine a and a syringe it is probably not being initialized
im really not sure what you are trying to achieve with this code but.
public boolean onCommand(@NotNull CommandSender sender, @NotNull Command command, @NotNull String label, @NotNull String[] args) {
doTest();
if (funytestcool.a.equals("test")) {
sender.sendMessage("chungus");
}
}
this would initialize a before testing it.
you are probably using == I'm comparing strings
i do not trust your code
really!?
Use .equals()
ur trolling right?
first off when you're trying to ask for help with your code, source code is a way for others to help you
?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.
edited it
its the exact same as your code just edited so that it works
ok
gtfo rs
and asking for help and expect others to help you without trusting anyone would be easy
I keep encountering this error when I try to build, can someone help?
considering all the code does is check define and check a string, it doesnt take much to know its not malicious
Stealing someone else's code to compare strings
show tablist line 79
fakePlayer.a(IChatBaseComponent.a(this.items.getOrDefault(i, "")));
Some1 can help me with that
im reporing you
you make dangosu code
lmfao
hmm. odd im not too familiar with this I'm sorry.
omagawd report me to the government im hacking people oh no!
whats the problem mate
but i think you cant use the class Dynamic
you are bad person i call fbi
It's annoying
@minor garnet might i advize you to use this ? https://www.spigotmc.org/resources/nbt-api.7939/ its really good in my experience
Any time I use ChatComponentText it throws this error, why?
fakePlayer.a(new ChatComponentText(this.items.getOrDefault(i, "")));
Or actually, it's only for setting it's display name it throws that error.. strange.
Hi guys, srry but im a so confused with the docs, im trying to use the method "setSpawnLocation" that belongs to the class "World" but how?
get the world object and use the method?
Yea but i mean im not sure if i have to create an instance of the world class or what
No
How can I find the amount of damage done by a player?
No the world already exists
EntityDamageByEntiryEvent?
Where are you trying to do this from
When the player connects to the server
I wanted to do in wothin a PlayerInteractEvent but I guess I can make another class
I mean I think you can get their attack damage attribute
But that won’t account for crits or anything like that
Yea okay
ohh ill check, thanks
so you're trying to set the world's global spawn whenever a player joins the server?
Yea
This is what I want correct?
Ah
I want to deal 10% of the damage dealt right back at the player
Ah
Also, will this work?
yo
im tryna make a spiderman plugin which dream made
and my bat is moving even though I gave is slowness 100000
so I did bat.setAI(false);
would this work?
try it
okay
Guys, some one knows why when i start my server it show me a lot of message like this: [Worker-Main-2/INFO]: Preparing spawn area: 0% ??? and it remains at 0
it remains at 0 and after a while the server start to run as normally
but im not sure if because of that the server takes some time to start running
Do you have installed the SetSpawn Plugin from Bukkit?
No
mmm well i guess that if the server doesnt crash is not a problem xddd
works very well
Is there a way of altering the piglin trades you get?
You can do it via datapack
Is there no way of doing it in spigot? cause i don't really know how to create a datapack
“Stores all data related to the bartering interaction with a piglin. This event can be triggered by a piglin picking up an item that's on its bartering list.”
Seems like you can’t make something barterable with that, just change the result
Which may work
Just important to note
Yeah may just drop the item on the piglin so im losing the throwing animation but i think it should be fine
Yeah I assume you’d have to use a datapack to make an item barterable
I don’t think spigot can assign tags without a bunch of NMS
Someone should add an API for that 😉
I’m not sure how easy that would be
Actually you can load datapacks at runtime
So tags should be mutable
Did a bit more research and found this https://www.spigotmc.org/resources/custom-piglins-trades-1-16-custom-trades-with-simple-gui.81234/ may be able to decompile to get a more realistic animation and such.
but im still wanting to do my own custom and this seems to much for just a throw
I am looking at a timings report trying to optimize my server, i am noticing that a large portion of the tick is spent on sync chunk loads, is there anyway that i could load them async? it is my plugin that is causing the this. my tps is fin it is at 20 and my MSPT hovers around 15 - 20 but it should be a lot lower in theory so im trying to optimize it
Are you using Paper?
Use PaperLib if you want to maintain spigot compat
im using paper but not the paper api
Otherwise just use the paper API
PaperLib ✨
im teleporting players to a unloaded chunk, do you know if the paper api will load those chunks async? or sync via teleport
They have a teleportAsync method
N i c e
thank you
I'm looking to have a weak spot revealed for 1 player with a bow for other players, after deciding the location of it I'm thinking along the lines of spawning an xp orb via packets on the player and update it whenever the player moves but I feel that'd be too many packets and if it were server-side, it'd take up too much resources. Does anyone else have any other ideas?
is there any code to import a custom map? just like multiverse plugins did?
What do you mean by import a custom map
map world that i download from external source
when i paste the custom world in my server folder, server can't detect the world
Bukkit#getServer#createWorld
Bukkit.getServer().createWorld("newworld", World.Environment.NORMAL);
'createWorld(org.bukkit.WorldCreator)' in 'org.bukkit.Server' cannot be applied to '(java.lang.String, org.bukkit.World.Environment)'
ah it works, thanks!
is that line 33?
i believe your plugin variable is wrong
it should be an instance of main, not the class
example of my plugin
yeah i cant because of the command framwork im using, im learning how to switch to ACF or the default bukkit.
acf?
you should also checkout lamp which Is what i've been using it looks a great deal easier than acf
List<Entity> nearby = p.getNearbyEntities(2, 2, 2);
beastStands.removeIf((stand) ->
{
Someone who can tell me the meaning of '(stand) -> {' ? Never seen that before when coding.
I don't know what that is
complicated
Who cares it great 👀
Uh...
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 27.222 s
[INFO] Finished at: 2022-03-06T02:41:16-06:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-install-plugin:2.4:install (default-install) on project craftbukkit: Failed to install metadata org.bukkit:craftbukkit/maven-metadata.xml: Could not parse metadata C:\Users\Mic_g\.m2\repository\org\bukkit\craftbukkit\maven-metadata-local.xml: in epilog non whitespace content is not allowed but got > (position: END_TAG seen ...</metadata>\n>... @17:2) -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException
Exception in thread "main" java.lang.RuntimeException: Error running command, return status !=0: [C:\WINDOWS\system32\cmd.exe, /D, /C, C:\Users\Mic_g\Desktop\e\apache-maven-3.6.0/bin/mvn.cmd, -Dbt.name=582a, clean, install]
at org.spigotmc.builder.Builder.runProcess0(Builder.java:973)
at org.spigotmc.builder.Builder.runProcess(Builder.java:904)
at org.spigotmc.builder.Builder.runMaven(Builder.java:873)
at org.spigotmc.builder.Builder.main(Builder.java:698)
at org.spigotmc.builder.Bootstrap.main(Bootstrap.java:27)
This has never happened before? and then today randomly wont let me build any jars
How would I check if a player has an entity on a leash, and get what the leashed entity is
Delete the mentioned xml file, its broken
hi md
ok let me try that
thats quite specific lmfao
decimalformat is something
yes i know its a joke
i forgot to add that bit of code in
when i recoded the plugin
HASHMAAAAP
hm?
lmfao
I thought he was making a relationship between two entities but no I’m wrong
One sec
total participation relationship
@grim oak
I believe this should help
thanks
Oh yea
Wait
A hashmap would be used here
@grim oak so what I sent isn’t nescessarilly gonna help
Just
Make a hashmap
And put the player and the entity every time a entity is leashed
Then also remove it when unleashed
Only problem is@leads break on their own sometimes
isnt it just html format?
Maybe there’s an event for it?
In my config it setted a MemorySection. Why?
Formatting the channel descriptions
oh
Cause the config is stored in memory
and how does that look like 🤔
translate:
'5143': MemorySection[path='translate.5143', root='YamlConfiguration']
'6850': MemorySection[path='translate.6850', root='YamlConfiguration']
'14321': MemorySection[path='translate.14321', root='YamlConfiguration']
'16136': MemorySection[path='translate.16136', root='YamlConfiguration']
'6228': MemorySection[path='translate.6228', root='YamlConfiguration']
'8593': MemorySection[path='translate.8593', root='YamlConfiguration']
'11605': MemorySection[path='translate.11605', root='YamlConfiguration']
'9077': MemorySection[path='translate.9077', root='YamlConfiguration']
'11999':
default: §6Datenschutzerklärung
translation: §6Datenschutzerklärung
Hello!
How can i use persistent data container here?
I’ll help with this
I want to give data to the block i'm setting, the chest
Ik persistent data very well
TileState#getPersistentDataContainer
😡
but
from the block i'm setting?
Place the block
dont you need to update the block when changing the material? 👀µ
Then modify it
Yes
are you trying to set/ obtain a list?
No
@lavish wave look up codedred config on YouTube
but how?
I still use it
Set the chest
I make my own ConfigurationSystem
Oh wait
with #setType right?
Why
codedred is bad grr
Yea but you need to place the block at a location
Some stuff
hmh
Because I want to have the control of the Configs, so I can change the system any time
i learned the basics from him and after that i had to learn it again cause it was bad
Ok well look at how codedred does it
🤔
And then modify it
Cause whatever your doing isn’t right
where the block is broken
yea?
So
In your code
Just do state.getPersostentDataConrainer()
Does that not work?
Or did you not do that
but
A
persostent data conrairer 👌
spelling
i want data for the chest
Yes
not for the block i'm breaking
You changed it to the chest
You changed the block to the chest
It’s a chest now
You can do one of two things
You can crate a new chest
And set it tk the broken block
Or do what your already doing
Wich is better probably
wait a sec, is not working i'm trying to fix it
Wdym “not working” what’s “not working”
not spawning the chest
Is there an error
Or is nothing happening
Cause if nothing happens
Then it’s probably your probability check failing
did you cancel the break event?
now works
Also that
yea
now works xD
the thing is
I want to give this chest a persistent data
with e.getBlock works?
Yea
Cause you changed it to a chest
As long as it becomes a chest before you modify it
Then it is a chest
But only if you make it a chest
It won’t spontaneously turn into a chest
You must make it a chest
Got it? @acoustic pendant
wdym
Set the material to chest
And it is a chest
@acoustic pendant say it with me. If you turn the block into a chest, what does it turn into?
you mean when i break it I check if the block is a chest?
yea
That’s the first thing you should do
Then you do block.setMaterial chest
And now the block
Is…
yea yea
I know you can do this
but i mean
What does the block become?
is the check necessary?
Never said to check lol
I’m literally just saying tk set the material to a chest
Couldn’t get more simple
ig
Set the material to a chest and it becomes a chest. Then you can get the chest data
Got it?
yes lol
You can’t go back in time just because you did e.getBlock before it was a chest
Hello, does someone know how to make some kind of communication between plugins?
yes
how to disable break for specific block? like only grass block
List<Player> blockbroke = new ArrayList<Player>();
public void onBlockBreak(BlockBreakEvent event) {
Player p = event.getPlayer();
if(blockbroke.contains(p)) {
event.setCancelled(true);
p.sendMessage("You can't break a block!");
}
}```
check e. getBlock(). getType() i think
compare with grass in Material class
(...worked for you?)
hmm still didnt get it
oh, event, not e, i just name it "e"
event. getBlock(). getType()
if i remember it right
== or .equals Material. GRASS
(without spaces of course)
where should i put this?
after that
i would make an EnumSet<Material> with either a blacklist or a whitelist with the blocks which can be broken
I mean the most basic way is this
Don't.
Use HashSet<Material>
Do all plugins have same class loader?
Can they modify each others' global variables
No, every plugin has it's own classloader
You mean "System" properties?
Then yes, they can still see each other's classes
or how else can they communicate without own custom socket?
Hi! how can i get the blocks in radius of an entity? I want to make a Redstone Armor that activates all the near redstone circuits
thanks its work
ok
Just make sure plugin x loads before plugin y if plugin y requires a class from plugin x
but what about modifying
i confused why its nnot working, and i forget call it from main class xd
If you can see a class, you can also modify public fields within it - that is how java works
ok, thanks
wait, but how do I control that
The classloader in general is always irrelevant in java, however the consumer classloader must provide the supplier class from the supplier classloader if it is requested otherwise a ClassNotFoundException will be thrown
plugin.yml
ok, never saw anything about it there
never heard of (soft-)dependencies and loadbefore?
maybe, not sure
anyone?
for loops ought to do the trick
maybe check all blocks one by one?
yeah but the question is how do i get the blocks near the entity
pos1 = subtract distance from each element of pos
pos2 = do the opposite of pos1
loop over all blocks from pos1 to pos2, and check if its what you want
maybe like this? It's my old code for finding is there a block nearby
for (int x = -3; x < 3; x++) {for (int y = -3; x < 3; x++) {for (int z = -3; z < 3; z++) {/* apply Pythagoras' Theorem here */}}}
but actually if I remember it checks a cube, not sphere
Yeah, you need to apply Pythagoras' Theorem
Location pos1 = pos.clone().subtract(dist, dist, dist);
Location pos2 = pos.clone().add(dist, dist, dist);
World world = pos.getWorld();
int minX = (int) Math.min(pos1.getX(), pos2.getX());
int maxX = (int) Math.max(pos1.getX(), pos2.getX());
// do the same for y and z
for(int x = minX; x <= maxX; x++) {
for(int y = minY; y <= maxY; y++) {
for(int z = minZ; z <= maxZ; z++) {
Block block = world.getBlock(x, y, z);
// Do something
}
}
}
This if for a box
to check if within a sphere do
Math.sqrt(Math.pow(x1 - x2, 2) + Math.pow(y1 - y2, 2), Math.pow(z1 - z2, 2)) <= radius * radius or it was just radius instead of radius * radius, i forgot
try both
^
item frames are entities, can we rotate them (not their content, i mean the item frame) to precise angles, position them on precise positions (more than just facing down, facing up, facing forward backward to the left/right, and more than just placing it to an extremety of the block, but like placing in the middle at coordinates 11.5 5 2.5 instead of 11 5 2)
iirc no
only cardinals
tho try
hm okay
don't use sqrt
Does anyone use gradle?
Actually, wtf is this
yeah i forgot alot of stuff
Yes, but gradle bad
its been a while
hi, another question. How can i activate the redstone wire?
how does the BlockState work?
Yeah but PaperMC needs it for NMS apparently lol
Ah, paperweight?
It's x * x + y * y + z * z to obtain the square of the distance between two positions
*the squared length of a vector
Oh, also, can I modify block state? And maybe even without updating blocks around it
oh yeah good point
let's not be that specific
Yes i think there is an option that prevents physics updates.
And what about forcing to update the blocks?
i used it when i made physics in mc, very scuffed physics, but still
like to make them connected right
wdym
Ye gradle pog
Also, fun fact: Math.hypot computes sqrt (a² + b²) all while still acting correctly for very large values where an overflow would otherwise happen
I mean you set a wall of wall blocks and they don't get normal blockstate without an entity touching them (at least the tripwire block)
guys please
?jd-s
https://hub.spigotmc.org/javadocs/spigot/org/bukkit/block/data/AnaloguePowerable.html#setPower(int) read the documentation
declaration: package: org.bukkit.block.data, interface: AnaloguePowerable
could someone tell me why is this spawning the grass block instead of the thing that drops seeds? xd
that should be right. Perhaps you are overriding your block change afterwards?
I mean maven is pretty much inferior to gradle in almost every possible way
yeah but how do i access it from the blockstate
it is more reliable, otherwise yeah, inferior
no, maven is the superior (build tool?) out of the two
Nah
there is GRASS_BLOCK
its different thing
Gradle is just as reliable in my experience
GRASS is what he wants
until you update the java version
exactly
What
I haven’t had any issues with that lol
maven is much more stable
Not really
Gradle 6 (or better said, groovy) breaks with J16+ for example
yep
Just update then
making fabric mods is a pain
Old FG breaks with J9+
Many other gradle plugins break with J16+
Many gradle plugins?
i use j17 and latest gradle iirc, it always, ALWAYS gives me problems
Gradle is pretty nice deprecating its api
not once have i had it to what i wanted first try, unlike maven
So no radical changes are being pushed directly
the cadix licenser plugin broke with J16+
That’s one plugin
@quiet ice
I know of many that didn’t break the slightest
The shadow plugin also probably broke similar to maven's one
Again, read the documentation: https://hub.spigotmc.org/javadocs/spigot/org/bukkit/block/BlockState.html#getBlockData()
declaration: package: org.bukkit.block, interface: BlockState
Updating still takes time
No lol
And in case of updating the wrapper is not as straightforward as running a command
You just change the version number in your respective module
I mean it’s extremely simple once you understand how to do it
And it doesn’t take that much time to change version
Sure downloading the new gradle wrapper takes time
But that doesn’t inherently imply more unstability whatsoever
i'm not doing nothing after that
Either you do it manually (at which point you have to find a "donor" project which has an updated wrapper) or you downgrade java, then run the update command, then re-upgrade java. In Windoof world this is absolute pain, but thankfully there is alternatives
So you would think at least
I don’t know what you’re talking about
meanwhile, maven:
write your pom once, most likely never change it
Like, you just change the version declaration and then reload the project basically
Gradle from time to time, chooses it's own (invalid) java home and I have no fucking idea from where it obtains it
ofc you have to update dependencies, but thats that
It’s not going to be more advanced than that
Never ever happened to me
Gradle can be just as simple as maven
Yes it can lol
It only happens if I clone foreign gradle projects, likely they have a misconfigured gradlew script
But it just shows how much can go wrong
Idk still that has never happened to me
Probably because you are not on a rolling release version so you never noticed that gradle is using a nonexistent java installation
Only issue I have with gradle is their radicalism when updating api and such, tho it’s reasonable as the benefits of that exceeds the drawbacks
Exclusing transient dependencies with Gradle gives me nightmares
gradle:
- Add repositories manually
- Confusing syntax
- Its gradle
maven:
- You have mavencentral by default, that's a win ig
- Clean syntax
- Its maven
Conclusion: Maven wins over gradle any time of the year
I tried for like 3 hours
why?
read the 1.18 release post
Confusing syntax is bs, learn the semantics and it’s just as intuitive
Adding maven central is literally one line
No it isn’t
Gradle also has the pro of having more scopes
repositories {
maven {
mavenCentral();
}
}
What
compileOnlyApi, compileOnly, api and implementation are all lifesavers
oh lmfao, wait yeah
And you have to declare the repositories block in maven also
Wym still
it has mavenCentral by default
Yes but if you wanna add other repos
Also, gradle doesn't use mavenLocal by default, that can be a plus
Pretty sure you can disable that with maven?
Lmao i believe this is totally not biased towards gradle
probably, but it's a lot more complicated and I don't want to be biased
if somewhere is a more complicated, it might be as well impossible
Well I don’t have anything against maven, tho I don’t believe a tool should be dissuaded from overall usage just because it might look less intuitive or be somewhat more complicated
Yeah
Anyhow geol, in regards to the java home thing, I haven’t personally encountered that issue of yours but it doesn’t sound implausible that it could happen
I'm not sure how it even resolved the java home in the first place, it was an installation that once existed but then did not and wasn't my actual java home anyways.
But my system has a lot of bugs noone can understand (such as audio breaking whenever I close minecraft until I switch the audio output and apply a constant audio signal)
I don’t understand how can I access it
Casting???
lol, well, even if that’s the case it could very much be a problem of gradle I yet haven’t discovered
So i should cast to the AnaloguePower?
yes!
Oh
(just note that #getBlockData returns a clone, not the actual block data)
As least I think so, either way calling #setBlockData is safe
it isnt longer an enum i guess
It still is an enum, but not for the long term
oh i still use it anyways
how do i get a block's break sound in 1.18?
Sound sound = Sound.valueOf("BLOCK_"+block.getType().toString()+"_BREAK");
breaker.playSound(breaker, sound, 1, 1);
im currently using this, is this like really bad or is it fine
Is there a way to create real "invsibile arrows"?
i'm trying to create a flying rock (riding the arrow), which should explode or something, once it lands.
currently i'm really struggling with the arrow itself,
i found out that i can destroy the package that is sent to the player, which contains the arrow.
But also "destroys" the fleight itself, so my rock just stands on the same position (until i rejoin, then it "landed" succesfully)
exactly
okay I followed your suggestion, and i now have a hashmap and every time a player leashes and entity if the player is not in the hashmap then it creates an entry which includes the player as the key and a list of Entities as the other value as the entry is make up of a player and a list of entities they have leashed Hashmap<Player, List<Entity>>. But i am new to this and I feel like the function i made to remove the entity is probably really inefficient and it works but returns some errors, and the main difficulty is that when an entity is unleashed the event doesnt give the player it was leashed to. this is how i did it, how else should i do it so it works more efficiently java public void onEntityUnleashed(EntityUnleashEvent event) { for (Map.Entry<Player, List<Entity>> entry: leashedEntities.entrySet()) { for (Entity entity: entry.getValue()) { if (entity.getEntityId() == event.getEntity().getEntityId()) { entry.getValue().remove(entity); getServer().getConsoleSender().sendMessage("Removed entity from the Hashmap. Entity id " + event.getEntity().getEntityId()); } } } }
i forgot but what's the difference between Collections.unmudifiableSet(set) and ImmutableSet.copyOf(set)?
You could reverse the map and make it a map of entity to a player? (List of players if more than one player can leash an entity at a time I don't remember). That way when the event occurs you can get the entity from the map and the player and do what you want to do. The rule of thumb is if you're iterating over your map a lot you're not doing it right.
aight ill try that thanks
The first one generates an immutable view
Second one generates an immutable shallow copy
let’s say you were to manipulate an element in set FourteenBrush brush
The former would also be updated accordingly to the manipulation, however the latter wouldn’t
Is it possible to change item nbt without the update animation for the player? (if he holds it)
Maybe some packet magic lol
No
ok
If is visual for player yes
how do i get a block's break sound in 1.18?
why can you change item nbt only for other players except player
you want to set the target of a lodestone?
You need to call CompassMeta.setLodestoneTracked(false)
But iirc even this way it moves in hand every target update
the update animation
it moves when I set the meta
error: https://paste.helpch.at/yawitimavo.bash
core:
else if (!plugin.invisibleList.contains( player )) {
for (Player members : Bukkit.getOnlinePlayers()) {
members.hidePlayer( plugin, player );
}
plugin.invisibleList.add( player );
String playerInvisible = plugin.config.getInvisiblePlayer(player);
player.sendMessage( ChatColor.translateAlternateColorCodes( '&', prefix + " " + playerInvisible ) );
}```

It's not a new problem for me, just still looking for possible solution
1.8 :)
1.8 what?
The issue is 1.8
java, or API?
API
oh...
are you sure
you can use plugin, player arguments
I think its because you need both variables as players
hm..
or even only 1 player
i used this for older version (I mean newer version, sorry)
just 1 arg
yea
i see
1.8.8 api
1.18+ have 2 arg
les see if that work in all versions
should
yea its work perfectly

is there a way to change an offline player's gamemode/health/position?
hello, for some reason this is spawning the grass block instead of the grass that drops seeds, could someone help me?
you can probably do that in 2 ways. either edit the save file. or remember the changes you made yourself & apply them when the player logs in.
yeah using the latter
i have a question: how would you guys go about making a plugin that randomizes the loot drops every time you do let's say /randomize?
would it make sense to write into a datapack?
like change the loot .jsons
I'd have a single random instance, and on block break get a random material, and drop that
or whenever you run /randomize, i use the random to generate a map like, original -> randomized
just have a list of items & every time you type randomize. pick a certain amount of random items from the list
and then drop accordingly
okay yeah
ok thanks
np
well first off. that for loop is doing nothing?
can i change block drops with <LootTables>?
but then i would need a list of all possible things and mark all used ones as not availible anymore since i want the drops to stay consistent
is it possible to know if player holds shift when clicking inventory slot?
and store every block drop
and not random every time you break it, grass always = log
yes
well then you would need a list of items that could be dropped for every block specifically
also, if you want drops to stay consistent you could use a weight system
what it thought was to (re-)generate a datapack everytime that contains all the .jsons idk if that makes sense
minecraft also uses a weight system for their loottables
yeah
does not make much sense to me
ic
why are there random {}?
no clue
Hello,
I in 1.8.8 and I look for how have the block the player set when he empty à bucket. I have use PlayerBucketEmptyEvent but the block is final and I can't have.
Thanks for your repons.
Excuse for my english but I from french
you want to edit the block the player placed a bucket on?
It would make sense if they declared a new variable in that scope
But that’s pretty useless as of now
oh
I store all the blocks in a list and at the end of the game I want to transform them all into areas
But I can't have the block of bucket
why not. you can do PlayerBucketEmptyEvent#getBlock
ok i think datapack it is becaaauuse i have multiple worlds and i have no fukkin idea how to only make the plugin work in one world and not the others and these worlds will get deleted and recreated and bla bla. Placing a datapack into the world folder upon creation is the best bet i think.
https://cdn.discordapp.com/attachments/745676095352995840/950004358043545640/bl.PNG
It don't find the block
@tall dragon
Is it possible to generate structures in a void map with a ChunkGenerator? I made #shouldGenerateStructures return true but it doesn't seem to work
im not sure why you are using datapacks at all.
what version are you developing on
1.8.8
why not
ehh okay.
haha
PlayerBucketEmptyEvent#getBlockClicked
the getBlockClicked is the block whitch the player click and it is not the set block
use PlayerBucketEmptyEvent#getBlockClicked().getRelative(event.getBlockFace())
it works thanks you
np
does anyone know if persistent data container on items can be seen by players (as item tags)?
Yes
well, shet
i know it says "4 tags"
or something like this
(depeneding on how many there are)
If you have a mod you can view them
well, that's bad then
i need to store a password on a book and the players not to see it
encrypt it :D
that's what I'm also thinking
I don't want any other storage
I also been thinking about 2 way decryption
but makes thing even more complicated
and I don't know how to do it
like I want players to encrypt a book content and decrypt using a password
but I also want server owners to decrypt without knowing the password
FileConfiguration ple;
File file = new File("plugins/VaultTax/PlayerData", "balance.yml");
ple = YamlConfiguration.loadConfiguration(file);
ple.set("Balance_" + player.getUniqueId().toString(), VaultTaxMain.getEconomy().getBalance(player));
try {
ple.save(file);
} catch (Exception e) {
}
ple = YamlConfiguration.loadConfiguration(file);
Bukkit.broadcastMessage("save");
}```
this file is not getting saved
if i store an entity in a variable/ array, is that entity unique for is it just a general entity type (say if i wanted to store a cow, would it store that specific cow i passed in, or will in just store the entity data for any cow in general)
the "save" is broadcasted
new File(plugin.getDataFolder(), "balance.yml")
i know that is not the problem as when it try to save it from other methods it works
you shouldn't use / in file paths
only on this method it does not work
use File.separator
why not?
but.. it works on other methods
different separators for different OS
oh
found out by bugging my os once
thinking there is a folder somewhere when it was not
cringe who doesnt use linux or windows
The file constructor handles that for you
ok i will do that but does anyone kknow why is it not getting saved?
im on windows
then \\ should be used
that doesnt make a difference
.
You need a file.createNewFile in there
the file already exists
I used on a linux machine plugins/pluginName/customFolder and created a folder I couldn't delete or didn't actually exists even tho winscp was seeing it 🤣
probably it created an actual file instead with that name in the jar root folder and winscp thinking it was a folder xD
hmm other classes and methods can acces and modify it
even this method can accces it but just can't modify it
shit
public static void saveBal(Player player) {
FileConfiguration ple;
File file = new File(plugin.getDataFolder() + File.separator + "PlayerData", "balance.yml");
file.mkdirs();
file.createNewFile();
ple = YamlConfiguration.loadConfiguration(file);
ple.set("Balance_" + player.getUniqueId().toString(), VaultTaxMain.getEconomy().getBalance(player));
try {
ple.save(file);
} catch (Exception e) {
}
ple = YamlConfiguration.loadConfiguration(file);
Bukkit.broadcastMessage("save");
}```
i fixed it i dont know how
okay ty
i will do this now
so i should use getInstance() instead of plugin
as it is the main class
yes, but don't use static as is bad practice 🙂 change it later 😛
also, forgot to do if (file.exists)
don't recreate the file if it exists 🙂
but when i try to stop runnable like this, doesnt work
yea i make the file on enable
FileConfiguration ple;
File file = new File(getInstance().getDataFolder() + File.separator + "PlayerData", "balance.yml");
ple = YamlConfiguration.loadConfiguration(file);
ple.set("Balance_" + player.getUniqueId().toString(), VaultTaxMain.getEconomy().getBalance(player));
try {
ple.save(file);
} catch (Exception e) {
}
if(file.exists()) {
}
else{
try {
file.createNewFile();
} catch (IOException e) {
e.printStackTrace();
}
}
ple = YamlConfiguration.loadConfiguration(file);
Bukkit.broadcastMessage("save");
}```
count is always going to be 0
its not, count is ok
my problem is runnable does not stop
Hi, I've creating a Bukkit Runnable like this
BukkitTask record = null;
and using that like this
if (args[0].equalsIgnoreCase("start")) {
record = new BukkitRunnable() {
int count = 0;
@Override
public void run() {
count++;
}
}.runTaskTimer(Main.getInstance(), 1, 1);
}
and stopping that in this way, but doesn't stop
if (args[0].equalsIgnoreCase(("stop"))) {
if (record != null) {
record.cancel();
Utils.sendActionbar(player, "&dDone !");
} else {
Utils.sendActionbar(player, "&dYou didn't recorded anything yet ...");
}
}
whats a clean way to make java switch going thru all types of InventorySlot
like case: "FEET" etc..
switch (player.getInventory().getArmorContents().toString()) {
case "FEET":
Bukkit.dispatchCommand(Bukkit.getConsoleSender(), "cosmin openwardrobe FEET " + player.getName());
break;
}```
like that?
you're trying to dispatch a command based on the slot
yea
i assume a player is executing a command
but how will the console know which slot to use?
public void onClick(InventoryClickEvent event, Player player) {
if(event.isRightClick() && event.isShiftClick() && event.getSlotType().equals(InventoryType.SlotType.ARMOR)) {
switch (player.getInventory().getArmorContents().toString()) {
case "FEET":
Bukkit.dispatchCommand(Bukkit.getConsoleSender(), "cosmin openwardrobe FEET " + player.getName());
break;
}
}
}```
your eventhandler signature isnt valid, remove the Player player
and get the player instead with event.getPlayer()
it doesnt error or warn
compiler not
ye
the best thing to do is probably check if the player even clicked an armorslot or just a random slot
so 100 to 103 are the slots you want to check for?
Minecraft is odd
wait
Although can't you actually retrieve equipment slots?
there is a slottype
Yeah
forgot that
You're also able to get the off-hand slot iirc lol
i think just do a switch which checks for the event.getRawSlot()
so like 100 -> FEET, 101 -> PANTS etc
public void onClick(InventoryClickEvent event) {
if(event.isRightClick() && event.isShiftClick() && event.getSlotType().equals(InventoryType.SlotType.ARMOR)) {
Player player = (Player) event.getWhoClicked();
switch (event.getSlot()) {
case 100:
Bukkit.dispatchCommand(Bukkit.getConsoleSender(), "cosmin openwardrobe FEET " + player.getName());
break;
}
}
}```
like that?
isnt there a way to just switch FEET HEAD etc...?
the slot doesnt have a name
and you can just change the event.getSlotType().equals( to event.getSlotType() == (
Exception: ionetty handler.codec Decoder Exception io.netty handler codec.Encoder Exception: Javaio.EOFException: fieldSize long! Length is 14129, but maximun is 5
help
?notworking lol
"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.
what are yo doing
im sorry i dont have my consumers talking
can someone help?
what is protocol? protocollib?
(Not what he asked)
lol what is that protocol you said
340 to 393
💀
(What the fuck does that even mean)
maow give me some bird seeds
the game protocol
Oh the server protocol?
and what is that for a beast?
I wouldn't describe it as the same thing since the "game protocol" doesn't exist.
to update so the players can join from 1.13(updating from 1.12.2)
How I can create infinity locations ?
creating a location each tick in a runnable
it does
i dont see how would that help
I'm sorry but no it doesn't
The only protocol in Minecraft is the one used for communication with a server
go to game file
@lavish hemlock hi can u explain this
You wouldn't expose methods that are meant for internal use
it is called protocol: (number) lol
Consumer = Person using library
just less straight forward
yes but how would i do what he talks about
Only let consumers use your interfaces and enums, not your implementations (concrete classes)
example? or how
It doesn't mean that it needs to be a fully fledged implementation
You can just expose it as an interface
what
Create an interface, have your implementation implement the interface, privatize that internal method, and only pass around the interface
You also need a method or factory that creates your implementation
OOHHH
public interface ICar {
public void driveInto(IDestroyable object);
}
Something like this
Fun fact: All methods in an interface are public by default
I prefer to have implicit modifiers explicit
class Tree implements IDestroyable
Also fun fact: DON'T PREFIX IT WITH I
It's unconventional for Java
Conventional for C#, not Java
Java prefers shit like Car (interface) and CarImpl/BasicCar/BaseCar/DefaultCar (impl/concrete class)
Because Minecraft developers are retarded
And ftr it's mainly conventional in Forge
Anyways, I used it to show that it is an interface, not a fully fledged class
who cares about the I just let him continue explaining lmao
especially because it leads to situations where you don't realize that a field in an interface is static if you don't do it
but i need other classes to use the internal method
Well it's a semantic property of an interface
OH
I don't think you should be catering to people who don't know all interface fields are static
Well then you use package-private visibility
?
so protected?
No
Package-private
Define no modifier in a concrete/abstract class, that is package-private
Well, without explicit modifiers you have problems detecting the problem with this code: #help-development message
No
Read
You will treat the interface like a class, and thus forget that all fields are initialized when the class is loaded
Oh
I mean I immediately saw a problem though
The fact that that is an improper way to use an interface
Nope
That only applies to interfaces
Since interfaces, until newer versions, cannot have non-public members
Like, fields in interfaces are designed for constants
And that's just a property of convention
But, as you said, it is also just wrong
(hence why they are public static final)
but idk if i can make an interface
for my main class
Illegal modifier for the interface method method; only public, abstract, default, static and strictfp are permitted
What version?
J8
Private methods were added to interfaces in Java 9
Exactly
You can still use it though
Sure but it has no semantic meaning
For the lulz
Is for me?
(Not only that but it is also a great example of ✨ tethering)
(Wait what word am I looking for)
heh saw it too
tbf
i still dont get how would that apply
to me
Because having public internal methods goes against object-oriented programming principles (and therefore the point of OOP)
E n c a p s u l a t i o n
Only give people what they need and should use
At what point should I drop support for 1.8 -> 1.12? I paid someone to help with adding support and I feel like dropping support will be a waste of money to myself
there is no internal method
in the class conclure was referring to
Yes, there is
/**
* IMPORTANT NOTE: THIS SHOULD NOT BE USED OUTSIDE OF API INTERNALS. THIS IS NOT FOR YOU.
*
* @return StructureManager Object
*/
public StructureManager getManager() {
return manager;
}
is there some library for database operations?
Although I'm not sure to help...?
java.sql :)