#help-development
1 messages · Page 1525 of 1
okay so I have tried to update the block. I order to connect the chest.
I command thee, CONNECT
maybe don't delete random files with the server running
now I got errors
and yes, some scores pull from the stats
and edit
peak 1.8 server administration
like just view it before doing anything
i mean..true
do I actually need to?
i guess the question wasnt answered
it might be the easiest way
why 1.8?
pvp
try deleting your scoreboard.dat
that might help
with the server offline this time around
where is that located?
wait what scoreboard you even have?
a custom one
plugin
@wraith rapids
i understood you like this:
Chest chestLeft = (Chest) block1.getBlockData();
chestLeft.update();
is that correct or what did I wrong?
nope
oh wait
chest should be casted to blockstate
not blockdata
k i removed the minecart and chest textures XD
hold up
haha I think im getting an error because its trying to calculate the kdr
while there isn't any deaths or kills
ah okay thanks I will try
of course you did
wow
also what are you trying to do?
have you ever seen a 1.8'er tell the truth
I'm getting a index out of range 4 so lets see where its telling me
ahhh
yea
fixed it
that's not good
though
this is what was the issue String decimal = decimalValueStr.substring(0, (indexDot + 1) + desiredDigits);
literally what are you even doing
I want to place double chest. The currect issue is that two single chests do not connect. I will try something out, so I hope I am not bothering you guys.
getting their kdr
have you tried simply calling a physics update?
not yet
were at a point when every problem ever,a thread exists for it
every beginner problem anyway
more complicated issues have threads too, but they're usually populated by dumb dumbs misundersanding the question and giving nooby answers
I love Double.NaN
Okay, so I have read already about so many threads but havent crossed that one.
i just typed on google spigot spawn double chest
and i find like 10 threads with a solution
Thank you, and sorry again for asking. I just dont want to open another thread.

I spend more than 3 hours on this one. Will go to bed now and take a look at that later.
How to move a location relative to its rotation?
reorder the vector components and flip the signs
^ ^ ^ ?
it should, though
But you need to figure out how much of a variable goes into the x, y, and z first
if you rotate at 90 degree intervals, you don't
Because, for example, moving forward would change the x and the z
Yeah, 90 degrees it would work but I also need it to work with other rotations
in that case, you need to get into vector math
I have searched far and wide and the closest I have found was that one code snippet I sent a while ago
loc.setZ(loc.getZ() + forward * Math.cos(Math.toRadians(yaw)));```
@wraith rapids You like how I calculate their kdr ```java
double kdr = p.getStatistic(Statistic.PLAYER_KILLS) * 1.0 / p.getStatistic(Statistic.DEATHS);
String decimalValueStr = String.valueOf(kdr);
int indexDot = decimalValueStr.lastIndexOf('.');
int desiredDigits = 2;
String decimal = decimalValueStr.substring(0, (indexDot + 1) + desiredDigits);
kdr = Double.parseDouble(decimal);
okay thanks, it works.
Does anyone know a good language API?
🤔
do you worship satan
public void on(EntityDeathEvent evt) {
if (evt.getEntityType() != EntityType.WITHER_SKELETON) return;
if (!(evt.getEntity().getLastDamageCause() instanceof EntityDamageByEntityEvent byEntityEvt)) return;
if (!(byEntityEvt.getDamager() instanceof Creeper creeper) || !creeper.isPowered()) return;``` this made me commit unsavory acts
its 2 less letters
many times adds up
if you type evt instead of event on 1000 events thats 2000 less letters typed
and if you do Bukkit.shutdown() you save everyone lots of time
public void onEntityDeathEvent(EntityDeathEvent entityDeathEvent) {
if (entityDeathEvent.getEntityType() != EntityType.WITHER_SKELETON) return;
if (!(entityDeathEvent.getEntity().getLastDamageCause() instanceof EntityDamageByEntityEvent entityDamageByEntityEvent)) return;
if (!(entityDamageByEntityEvent.getDamager() instanceof Creeper creeper) || !creeper.isPowered()) return;```
There, I fixed it.
entityDeathEvent
No ambiguity there!
i think you mean EntityDamageByEntityEvent entityDamageByEntityEvent
how big can the name possible get?
Fixed!
thank you
Anyone know the Material. type for Enchanted golden apple in 1.8
if (event.getItem() != null && event.getItem().getType() == Material.) {
so how would I do it like this?
ItemStack item;
boolean isEnchantedGoldenApple = item != null && item.getType() == Material.GOLDEN_APPLE && item.getItemMeta().getDurability() == 1;
I think
dont use 1.8 👍
thank you conclure
...
oh man I never thought of that. @sage swift
Die frog @sage swift
how else would someone know I talking to you
_ _
imagine adding an to your text
old trick
very interesting
Does anyone have experience with the world edit api? I am trying to paste a schematic from a file and i can't figure out how to get the worldedit world, I get an error if i try to cast bukkit.World to Worldedit.World
EditSession editSession = WorldEdit.getInstance().newEditSession(pos.getWorld())
is their a chat bridge plugin that anyone uses?
dont ask the same question in multiple channels
with the BukkitAdapter
Anyone know how to get the nearest player, at a target block on rightclick
public static Player getNearestPlayer(Player checkNear) {
Player nearest = null;
for (Player p : checkNear.getWorld().getPlayers()) {
if (nearest == null) nearest = p;
else if (p.getLocation().distance(checkNear.getLocation()) < nearest.getLocation().distance(checkNear.getLocation())) nearest = p;
}
return nearest;
}
tried this but just got, eh
why did you use haskell for the code block highlighting lmao
hey, just so you know, you're coding in java
idk im used to it
also that will always return the player you are passing, you are not checking if the player in the loop is the player itself
Thanks i figured it out
player.playSound(player.getLocation(), Sound.UI_BUTTON_CLICK, 1.0, 1.0);
Cannot resolve method 'playSound(org.bukkit.@org.jetbrains.annotations.NotNull Location, org.bukkit.Sound, double, double)'
dahell
1.0F*
Your two last parameters are floats
👍
does spigot have this bug fixed? https://bugs.mojang.com/browse/MC-190055
trying to write a datapack for my server but ran into this and cant run it in singleplayer
(im asking because sometimes spigot has bugs fixed before minecraft does such as the piglin dupe in 1.16)
How can U create a Fake Player entity, which has No Knockback and the players cps as its name?
getnearbyentities i think works ?
oh at a target block
like when i rightclick, i need to get the nearest player at the block im looking at
oh if it's a right click maybe try getNearbyEntities
the thing is it returns a list
yeah so filter if it's instance of player
then map as cast to player
should be maybe
Well then use the 1 one outta that list u guess
getNearbyEntities().stream().filter(entity -> entity instanceof Player).map(entity -> (Player) entity).collect(Collectors.toList()) maybe
there is a nearbyPlayers one
bump
getNearbyEntities().stream().filter(Player.class::isInstance).map(Player.class::cast).collect(Collectors.toList()) 
in 1.8 i assume? kek
sMHhh
Hi Im have problem with plugin protectionstone or idk how to use it. So after setting plot and making them for sale, normal player can buy plot and lost his money but he won't be owner if person who sell this isn't online. Idk its my mistake or bug
yes
hahahaaaa
nice and timely
outdated versions are unsupported
;7
¯_(ツ)_/¯
maybe they have a reason?
no reason is good enough to use 1.8.
idk what reason that would be I'm waiting for 1.18
pvp? plugin.
yes
there are so many missing features in the 1.8 api
PDC
custom recipes
it has very few features compared to the current versions
well but 1.9 killed pvp soooooo ;7
again, use a plugin.
hahaha
dafuq?
you can change everything in the game..
1.8 cringe
make it basically like 1.8
viaversion will allow your retarded players to continue connecting on 1.8 if they so choose
but don't use 1.8 on the server side.
wh
ok ok calm down
I’ll never get the fixation on old minecraft pvp
Not that the new pvp is any fun but like
Why is pvp so big for a game with such a terrible combat system
Anyway I'll never get it, I'm into terrain generation!
well then ima make my plugin seem 1.16 pvp like 1.8
or use an existing plugin :D
you're not gonna use coreprotect?
I like that
gecko I do what he does
nah
some stuff is just stupid not to make
PlaceholderAPI?
he got it
viaversion?
1 step at a time
seems like a waste of time
Of course there are some things to not bother with
but I don't use them all
like I said I'm into terrain generation
ah viaversion i download
good man
thats to tedious
Yup
but the rest. manageable
Yes good luck and have fun with your server
yep thx
Hey, can someone help me out with Bukkit schedules, I can't seem to figure out how to use them
Bukkit.getScheduler().runTask(plugin, () -> {/*code here*/});
plugin is just an instance of the plugin ?
mhm
k, thanks 🙂
How can I remove all elements from hashmap. I've tried to do something like this but it gives me concurrent exception.
for(UUID uuid : entityMap.keySet()){
// Remove the entity
entityMap.get(uuid).remove();
// Remove the element from the map
entityMap.remove(uuid);
}
use an iterator
hashmap.clear?
oh true
he wants to do stuff to em first
wtf
well that cleans all of it
that might be it, i forgot there is Map#clear
public void removeAllEntity(){
// Loop through all uuids
for(UUID uuid : this.entityMap.keySet()){
// Get the entity and then removes it
this.entityMap.get(uuid).remove();
}
// Clear the map
this.entityMap.clear();
}
alright, thank you so much!
np
worked?
anyone found the method for changing world height for 1.17? i must be stupid because i see WorldServer#getMinBuildHeight but i can't find the actual method anywhere
...
although there could be a way i dont know it
My connection to my database worked fine yeasterday and suddenly today I have a java.lang.NoClassDefFoundError: pro/husk/hikaricp/pool/HikariProxyResultSet error
it doesn't show up as an existing method, idek anymore
oh ok
Can you show the entire class please ?
it's nms...
World.java
just tryna find the method, and from there the number i can change for height
i guess i'm looking for getMin and getMaxBuildHeight
neither show up as methods, maybe im missing something
yup, that worked.
good thing
you return in the for loop ?
that pops the entire method off the stack.
including the for loop
I am saying, returning inside the for loop means that, after the first iteration, the return statement ends the entire method logic flow
e.g.
for(int i = 0; i < 100; i++) {
System.out.println(i);
return;
}
will only print a single 0, as after the first print the return statement is reached which signals the end of the current method.
learn java
ouch
visible pain
dafuq he wants to do with that loop?
uses it 1 time
burns it to hell and beyond
take this traveler https://www.codecademy.com/learn/learn-java
?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.
sooo much java xd
dont understand i do
you're not modifying item in the loop; it's aways the same
lul
that's bad
there are libraries that try to do it
but they aren't super reliable
because bukkit doesn't really let you listen to everything involved
now i am forced to use MySQL + HashMap
and that's so shitty
if its just actual BlockData you use getAsString and Server.createBlockData(String)
have you tried to take BlockData from a gravel or a barrier, say?
but what
createBlockData?
blockdata isn't related to storing data on a block
blockdata is what bukkit calls minecraft block states
that is, the orientation of fences and shit
going off now. no more premium tech support from me. bb
Why
yes
yes, minecraft block states
but this is not suitable for custom blocks
yes, and as I said you use getAsString if you want to store that data elsewhere
Gravel or Barrier haven't blockdata
Gravel has BlockData
but what about barrier?
So does Barrier
every block has blockdata, it just doesn't have fields if there is only one state
All block Materials have BlockData
but again, blockdata does not store arbitrary data
you can not use it to store random shit
only tile entities can do that
It would probably be an idea that you tell us exactly what you are attempting to store
I'll start from the very beginning
I need to store any string in them, and also spawn the frame in that block.
frame?
item frame
thats why forge or fabric is cool
and what "string"?
You can not place an arbitrary String on an item frame
but we talking about barrier
and i can.
simply nbt
ok, you can not place an arbritrary String on a Barrier
barrier is not a tile entity
it can not persist arbitrary data
i feel like i'm repeating myself
it is.
it is not
Non TileEntity Blocks do not support NBT beyond the pre defined tags of the blocks data
that is to say, non-tile entity blocks do not support nbt at all
^^ which aren't even stored as NBT yea
instead they have a pre-baked list of possible states
I would love to use note blocks for what I intended, but they are have full-block type and I have to use a barrier + item frame
neither barrier nor ItemFrames support NBT tags
item frames ?
they do yea
Not in teh world. As ItemStacks they can
that's lie
in the world they are an entity
item frame is entity
what
entities implement persistendataholder
entity support nbt
itemfram is an entity?
an item frame is not a block; it is an entity
same with paintings
yes
it needs to be an entity because blocks can't render stuff like that properly
for example the flower pot requires a separate block state for each item put in it
there are some exceptions like skulls and signs
I wrote a regen plugin for blocks and entites like pictures and item frames, but it was a while ago
a new problem arises
if there are too many frames, it can cause server and client laggs
In which case ItemFrames yes you can store data in its PDC
then don't spawn too many item frames
but i should
then you will lag
Tell us what you are trying to achieve and we will almost certainly have a better alternative
wait a second
custom blocks with textures presumably
with the barrier for collisions + item in itemframe for texture style
which is viable if you only have a few such blocks placed in the world
You can do custom block textures with a texture pack and damage states
because itemframes are laggy as shit in high numbers
the preferred blocks for that are noteblocks and mushroom blocks
noteblocks especially so as you can replicate their functionality server-side so you don't necessarily override any vanilla textures
I'm going to make a lot of my custom blocks where some of them are vases. There are 512 variations of them, and that's why I have to use frames and the subject in them to configure CustomModelData. Others, full blocks, are note blocks. All note blocks and barriers currently have metadata, which falls off immediately after a server reboot,
and I have to store all this data somehow.
https://imgur.com/Dfoycul
well
store it to disk or a db, I suppose
but beyond that, there is no solution to your "itemframes cause lag" problem
the best you can do is spawn them via protocol and make them client side
store it in the chunk PDC
that will not lag the server, but will still lag your players to shit
chunk PDC? wtf
only really viable if the players cannot modify the map
if players can use pistons, explosions etc
chunk pdc is nearly unmaintainable
does bukkit block metadata account for that?
or is it just a dumb blockpos -> shit map
doubt
its dumb
k, now i using the MySQL
supposedly you could implement a specific tile entity and place that in the world, but I don't know how that works persistence wise
smth like: https://imgur.com/WEHBwTC
anyway, i need to storage them location
remember to make network requests to the remote db in the chunk load and unload events
that will boost performance by 100x
:mind_blown:
Bukkit will complain about random TE's on blocks that should not have them. It will also attempt to fix them
use a octree
all date applies to blocks
I had no practice with it
can also just stick with a map and the long key representing a block
paper has a method to calculate those
i wonder what paper is going to do with the long block key
what with the world height being customizable and shit
cry
there's only enough bits in the long key for y values up to like 512 or 1024 or something
i'm using this now:
private static final HashMap<Location, Tuple<Integer, Tuple<Blocks, Material>>> storage = new HashMap<>();
Why not just make a class instead of a bunch of nested tuples
use an object
:p
records are sweet
at least it's not public
use another item. not everytime the same one
but that's about the only saving grace here
only changing meta is dumb
i'll change it)
🥳
Do I need to change the "full" world date application to chunk loading
that's because you're working with the same item every time
learn java
go read a tutorial
then re-read your code
use for
Hello I have a problem with the mcduel plugin when I install it on my server everything goes well but when I do /arena it marks me in the arena chat
who are you talking to?
with him
okay thanks
or i am retarded just noe
Memes?
Emm I just paid a plugin then, It doesn't in my Purchased Resources
Give it time
I bought it 6 hours ago🤔
It can takes up to 1 day, depend on the author's paypal.
Maybe you can try to contact the author.
ok thanks
what the hell is a tuple
its like a list of 2 things iirc
honestly this still looks ok
nvm i take that back
I didn't see the tuple inside tuple
yeah
wtf
its kinda rough
If I update my plugin to 1.17, am I required to update the java on the plugin to 16 too?
nope
oh thank god
in fact can prob even write with java 7, correct me if im wrong
So long as you use no NMS
Yeah you could in theory
yeah, Java is backwards compability so..
Well, probably ok with NMS
Can someone explain to me what does remapped-mojang do?
Tho java 7 didn’t have stuff like lambdas and streams and pseudo function first class objects so some stuff will probably not work like the BukkitScheduler#runTask(plugin,consumer) for instance
does the InventoryOpenEvent get called too, when switching between 2 menu's with Player#openInventory?
Ye
I think it does in newer versions
1.16.5 in my case
definitely
good. ty
And I read that it's required, but why?
Hello, how can I do a list with a YML file ?
getConfigurableSection(.....).getKeys(false)
Using the Bukkit config thing?
the false is for shallow list
Like that, I would like to list the chunks
When choosing to use the 'Mojang Mappings', it is absolutely imperative that you are aware of the conditions attached to them as well as the Mojang EULA. These are not restrictions you can simply ignore. In particular you may only 'use the mappings for development purposes'. This means that you must only use the remapped-mojang jar for development and must remap your plugin prior to distribution. For those not using Maven you can download SpecialSource to help you do this here, and we encourage the creation of instructions/tools for other build systems.
This one, I'm kinda confused.
i see
ohhh, that is if you use it
then you are required to remap it back
you must only use it for development
IF you use it
you cant use it for anything else
aglerr basically you’d use the mappings at compile time and then turn it back to the obfuscation when compiling it (like your nms imports and stuff)
yea nms
i don't use the nms, so i can just use the api right?
so by remap the mojang library, it'll be easier for developer to use nms?
but even if you are writing with nms, you prob wont need the remapped-mojang jar lol, can just deduce from method signature >.>
yea
ah i see, thanks
Well first of all there’s no list in that yaml
alright, that's probably a dumb question, but idk.
I have a Class named Settings, and then another Class named GameruleSettings
GameruleSettings extends from Settings, and both classes implement Bukkit's Listener.
do i need to register both to the PluginManager, or would it be enough to register the Settings one?
probably both tho
if GameruleSettings extends Settings then afaik you just need to register the GameruleSettings because it will implement all of its superclasses methods
(i think)
yeah that's what i thought of. i'll try it, and see if it works lol
Each individual instance that inherits Listener needs to be registered
wait
if (event.getInventory().equals(SETTINGS_MAIN)) {```
this is not working? know a better way of checking which inventory someone is in?
I use InventoryHolder but what is SETTINGS_MAIN btw
Im assuming a custom class
public final Inventory SETTINGS_MAIN = Bukkit.createInventory(null, 27, "§bMain-Settings");```
the inv, where i am clicking
Hmm maybe try == instead
use something like the holder (or if you have to) the name
well, it's a public gui without a specific holder
Sometimes comparing with == works so give it a shot I guess
not in this case
{
Player player = (Player) event.getWhoClicked();
if (event.getInventory() == SETTINGS_MAIN) {
event.setCancelled(true);
switch (event.getSlot()) {
case 1:
initGUI(player, SETTINGS_CHALLENGES);
player.openInventory(SETTINGS_CHALLENGES);
break;
default:
System.out.println("1");
break;
}
} else {
System.out.println("2");
}
}```
it always gives me 2
Oh well you could try InventoryView although if I personally would advice something, it would be InventoryHolder
like i said, it actually has no holder. it's a public gui, not player specific at all
Make one 🙃
You’d use InventoryHolders to identify inventories. No they can’t
no - thats why people sometimes use the title
then why dont i just use the title
well, i'll try it tho
well... is there actually a method for getting the inventory title? don't see one
InventoryView
md69 in his infinite wisdom has decided that inventories do not have titles
inventory views do, however
(off topic) anyone able to answer a physics question
Give it a shot
is that not like a kindergarten grade question
myes
i just cannot understand what it is asking me to do
and i have done about 50 of them so brain is gone
it's asking you what the velocity will be in 2 seconds from being thrown
well, what i wanna do is basically smt like java if (event.getView().getTitle().equals(SETTINGS_MAIN.getTitle())) {
isn't possible right?
Yeah
at t0 it is 15m/s
yeah
and a = -10
it is
yeah, but flip the sign, apparently the question calls downwards velocity positive for some reason
so you'd actually start at -15 and add 10 twice
yep
seems rather silly but maybe it's some convention I don't know about
or just rmb v = v0 + at
i was expecting more of a parabolic shape than for it to just start going down
immediately
well it is
yeah fair enough
the actual position is
shouldn't mix downward vector with horizontal
but the speed is linear
they did
wait 
huh they ddin't state horizontal velocity
and only ever decreases from that
they didn't no but horizontal velocity doesn't matter
🤷
class Rivex implements InventoryHolder {
final Inventory inv = Bukkit.createInventory(this, ...);
//override getter to return inv
}
class Real implements Listener {
@EventHandler void onClick(InventoryClickEvent event) {
var inv = event.getClickedInventory();
if (inv == null || !(inv.getHolder() instanceof Rivex)) {
return;
}
//inv is your inventory (;
}
}``` @sullen dome something like this might be worth trying otherwise. Wrote it on mobile so prone to errors
downward acceleration is the same regardless of horizontal or vertical speed
oh well im dumb thanks though
oh wat I meant is if the 15m/s they state includes horizontal velocity
that's what I meant by they didn't state horizontal velocity
i suppose yes
the problem is, that it isn't always me who is using the gui. it can be everyone. and as the gui is public, people can live-time change stuff inside it. so it probably cannot even have a holder to do that, without doing complicated stuff.
so i guess i'll just stick with this:
if (event.getView().getTitle().equals("§bMain-Settings")) {```
but thanks!
That won't saving
https://paste.md-5.net/imamugupor.js
god
?paste
Rivex was just the name of the class
obvly it is
just compare the inventory or inventory holder
Well the holder is persistent
that.
comparing inventory should be enuf
It sometimes isn’t
wat times
supposedly comparing holders is bad bad because reasons
hard refs to plugin classloader something something
but everyone does it anyway so it's fine
so... comparing holders is bad... comparing titles is gay... comparing inventories directly isn't working
so what would be good lmao
it is working
the mysql.async().execute() doesn't works idk why
if you do it right
you just need to not do it wrong
if (inventory == myInventory) do shit
you just need to retain the inventory instance somewhere for later comparison
it doesn't matter really
comparing holders would be if (inventory.getHolder() == myholder) do shit
every time someone views the gui, you can recreate it
Use the way conclure made
using == is gay
Well Bukkit might decide to just create a delegate of your inventory. Let’s suppose you have your inventory instance with the memory address a1. Now once an InventoryClickEvent fires Bukkit might decide to reconstruct or your inventory instance a1 (like a shallow clone sort of) so when you call InventoryClickEvent#getInventory you’d get a copy of your inventory instance (of course any trivial changes will be reflect onto the actual inventory) but this instance has the memory address a2 which also means we can’t use == comparison.
as if inventories could implement equals in some sensible fashion
do you compare enums with .equals() then solar? or just in this instance
the thing is that bukkit doesn't decide to create delegates
get ya
that's not a thing it does afaik
Hmm weird cuz I did some testing for quite some time ago and from what I experienced it did.
using holders is recommended against because that involves holding references to plugin objects inside bukkit/nms itself
which means that on plugin unload they need to either be evacuated, or you risk leaking the entire classloader
.equals() == ==
.equals should definitely be the way to go about comparisons... unless enum
no
🤨
at least I've never run into bukkit creating delegates or wrappers for inventories
or really heard of that happening
or, well, maybe for things like chests?
Hmm interesting I will do some tests and see if that was just a random occurrence
but custom inventories that you open yourself, basically never
i could see a chest or a vanilla container being created a wrapper for
but that's not a custom inventory at that point
is there some code to change the name above the users head?
wait is that for inventory?
yes
Singletons can be used with ==, things which you wanna compare identities to (instance a == instance b iff a is b).
inventory does not usually implement equals
I think it is this
declaration: package: org.bukkit.entity, interface: Player
wait no
That is just from the base Object class.
nor is there usually a sensible way to implement equals, beyond just ==
equals method can be overridden, you shouldn't look at that
I know
I was hinting at the base methods
can take a look at ItemStack's equals()
yes, but an itemstack is quite different from an inventory
setDisplayName() ?
is just targeting that statement
I dont think it works
Ngl it would certainly be nice if each Inventory had a persistent UUID.
no thats chat
CraftX inventories do not implement equals
which means they delegate to Object::equals by inheritance
which is ==
but it shouldn't matter a class implements equals imo, that's the point of information hiding
just a better design practice to use equals() instead, but i get you
i suppose you could use whichever, but in case of bukkit it doesn't really matter
it highlights that this inventory need to be this exact inventory
not a wrapper or a clone or a similar inventory
what if equals was implemented by comparing name and contents?
what does it mean for an inventory to be equal to another inventory, to begin with?
I mean depends if you wanna do a content comparison vs an identity comparison
implement it
ok also depends on implementor's intent
point is that I don't know whether the implementor's intent aligns with mine, therefore I use the stricter comparison as that is what the actual API guarantees
does bukkit.getPlayer return null when the player is not on the server?
Fair point
the docs dont mention it
i get you
Yeah
if I open an inventory for a player, it is guaranteed that when events or queries happen about that inventory, it will be the same instance
i get you
It’s null if the player is absent from the server
ok
yeah - use getOfflinePlayer()
if you want the player object no matter what
just know that if you query by name, it may make a blocking network request to mojang
so you should probably not do that on the main thread very often
deprecated
im using uuids
Paper getOfflinePlayerIfCached
yes, but you can still use it even though it is deprecated
doesn't deprecated means
It’s not deprecated for removal
it is not subject to removal, it is simply there to act as a note for people who might not know about UUIDs
querying offline players by name is still a perfectly valid operation
ah ok
bukkit deprecations are hardly ever 'we're going to remove this' deprecations
because bukkit never fucking removes anything
Yeah compatibility
guys is there a bug in 1.16 that keepinventory only affects a single dimension or is it an intentional feature?
the rest is mostly "never use for any reason" deprecations, which you can use in certain cases for certain reasons and your use of them will still be perfectly valid
its a per world rule
so intentional ok i get it
bukkit deprecations aren't really deprecations, they're little warning or reminder messages written on post-it stickers attached to the methods
which teaches the many new and aspiring developers learning development in the bukkit ecosystem some really bad lessons
nobody reads the javadocs
people won't give a shit until their compiler issues a deprecation warning
im not nobody 😠
I must have been dropped on my head as a child cause i dont really mind reading documentation
(as long as it is written well)
normal people do read documentation
but normal people account for a pretty slim minority of the new and aspiring section of bukkit's developer base
i mean, how else would you know how to use the method lol
Lmao
I mean Bukkit docs are filled with docs like
/**
- this returns the team entry
*/
Entry getTeamEntry();
yeah, reading some classes it feels like they were machine generated
we are just build different
no it is
/*
* Returns team entry.
* @return team entry
*/
built to hate
what a downer
i feel like NNY irl is a very polite person however once online he turns into a reincarnation of hitler
lol
I mean, there is some javadoc where you really don't need more.
Team entry isn't the best example but things like straight forward getters
Yeah
This is my favourite piece of code:
https://gist.github.com/zivce/f08a0eefff21b55a63ffa3b4cc9044f0#file-enchantment-java
LMAO
😈
use maven checkstyle plugin
i am going to build an array of remote controlled mirrors
so I can concentrate sunlight on things
and set them on fire

how many mirrors do you wager i'd need to set an aeroplane on fire mid flight
the question should be how big of an area do you think you can get
well yes
pyromaniac tendencies checked
assuming that you have the best tracking system and/or the plane is at a constant speed and all the mirrors are pointing at a 1cmx1cm area not very many
i will be the modern day archimedes
You
i'll declare myself a sovereign nation
Not many if they're dome shaped
issue with parabolic mirrors is that the focal length is fixed
lmao
i suppose you can adjust it very slightly but doing that accurately is pretty difficult
just use a very big lense
yeah I recently looked into some scalable laser designs
though it's pretty difficult to find any documentation for anything past the some hundreds of milliwatts range
can you actually repel moon with mirrors
Sunlight is much less... diluted... when you're in space
MOON LAZER
Make a satellite that focuses sunlight at planes passing under it
Put it in geostationary orbit over your sovereign nation
Location exactLoc = child.getLocation();
exactLoc.createExplosion(10, false);
child.setCustomName("Goose");
if (!exactLoc.add(0, 5, 0).getBlock().isSolid()) {
child.teleport(exactLoc.add(0, 5, 0));
so this worked used to work 1 week ago same api 1.16.5 and everything but it doesn't work now, when i try to make a package it errors on me
And it can cover your nation and also about half the world
i don't live on the equator sadly
Good luck shooting down that many planes at once though
oo you guys are shooting planes?
Doesn't matter, there is a geostationary orbit that would cover your location
That is what NASA is doing on the moon - They have a giant fucking lazer and they are cooking our heads
well yes but not 100% of the time
Thats why i stay inside all the time 
maybe... you should not...
just an idea
Well then just send out a satellite that can use a solar sail or ion propulsion or something it won't run out of that pulls a big asteroid into earth
Big enough to wipe out cities but not kill every person, you know?
yeah it's only going to take a few million years
china will have killed everyone with covid Mk. XI by that point
:+1:
tbf if not for this covid, I wont be playing mc
mass extinction already in progress
CreateExplosion is now a method under world.
isSolid is now a method under Material, so add a getType to that bish
so
exactLoc.getWorld().createExplosion(exactLoc, 10)
getBlock().getType().isSolid()
:/
well tyvm
np
how do i fix "Name cannot be null"?
oh sorry im stupid
no worries
i'm getting an error on this:
if (!file_en.exists()) file_en.createNewFile();```
```console
java.io.IOException: No such file or directory```
ideas how to fix it? i mean...
Lol
Make sure that the directory exists
No
If u want to make directory's I do makeDirectory I think
There's a method to make the directorys but idk what it is
yeah mkdir
Ye
make directory = mk dir = mkdir
U either make it Ur self or use mkdir method
if (!Challenges.getPlugin().getDataFolder().exists()) Challenges.getPlugin().getDataFolder().mkdir();
try {
if (!file_en.exists()) file_en.createNewFile();
if (!file_de.exists()) file_de.createNewFile();
} catch (IOException e) {
e.printStackTrace();
}
guess this should do it?
you don't need to check if it exists
k
the return value of mkdir and createNewFile indicates if it was created or not
yeah it works. ty
How to fill the player.setGameMode(); is it "creative"?
@Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
if (command.getName().equals("gmc")){
Player player = (Player) sender;
player.setGameMode();
}
Yes, Exactly. Just Choose a GameMode enum
Hey, I got this code so far, whenever you join the server, your inventory gets filled with boats. Ive got a few problems tho, when you die, I want it to fill again, and when you rejoin it should fill again. Another thing is that when someone steps on a pressure plate or something similar it should reset. Thanks
@EventHandler
public void handlePlayerJoin(final PlayerJoinEvent event) {
final PlayerInventory inventory = event.getPlayer().getInventory();
for (int i = 0; i < inventory.getSize(); i++) {
final ItemStack item = inventory.getItem(i);
if (item == null || item.getType().isAir()) {
inventory.setItem(i, new ItemStack(Material.OAK_BOAT));
}
}
}
And the last problem is that every single slot fillst, also armor slots, all I want is the inventory without the offhand
The way that you are looping solves the last issue
but you just need to listen for more events
Well I know a bit about coding but not much. I had help from someone else, could u tell me what to replace in the plugin
How?
what is an enum?
I have a class that lets me change skins but how do I add it to a runnable that is in my Main class? ```Bukkit.getScheduler().scheduleSyncRepeatingTask(this,
new Runnable() {
@Override
public void run() {
}}, 0L, 1200L); ```
try BukkitRunnable?
can I do this? ```private SkinGrabber sg = new SkinGrabber(this);
Player player;
public void onEnable() {
System.out.println("YT is enabled...");
Bukkit.getScheduler().scheduleSyncRepeatingTask(this,
new Runnable() {
@SuppressWarnings("static-access")
@Override
public void run() {
sg.changeSkin(player);
}}, 0L, 1200L);
}```
Just make sure there's nothing bukkit in changeSkin
can anyone help me with my problem above
Sorry idk
I have a runnable inside SkinGrabber
is that bukkit?
No I mean anything in the method run can't be anything bukkit
oh ok
Change skin method doesn't contain bukkit stuff right
I have this in change skin ```java
public static void changeSkin(Player player) {
GameProfile profile = ((CraftPlayer)player).getHandle().getProfile();
PlayerConnection connection = ((CraftPlayer)player).getHandle().playerConnection;
connection.sendPacket(new PacketPlayOutPlayerInfo(
PacketPlayOutPlayerInfo.EnumPlayerInfoAction.REMOVE_PLAYER,
((CraftPlayer)player).getHandle()));
profile.getProperties().removeAll("textures");
profile.getProperties().put("textures", getSkin(player));
connection.sendPacket(new PacketPlayOutPlayerInfo(
PacketPlayOutPlayerInfo.EnumPlayerInfoAction.ADD_PLAYER,
((CraftPlayer)player).getHandle()));
}
Uh idk just try it and see
ok
hi, how can i detect Lore one a item
example : item.getItemMeta().getLore().equals("my lore") but its a error
Lore is list
U can't just check if it equals a string
Or is it a collection idk
ok so how can i do ?
Loop through it and check every line idk
yes but how can i do this ?
?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.
thx
@granite stirrup so i do that ? if(item.getItemMeta().getLore().get(0) == "my lore")
U could but if u want to check every line you would loop through it
.equals("my lore")
Maybe use .equals also
.equals is different to == I don't know how to explain it sometimes .equals is technically more accurate but u can't really say that
Yea, Object#equals should compare the actual content of an object and return if the content is equal. == only checks if the identify of both objects are the same. aka the object is actually just compared to itself
So == compares memory addresses ?
yeah
well on objects yea, tho I don't think that is actually defined. pretty much implementation detail
primitives are a different story
Lol
So .equals is if u have a string it actually compares whatever text u put and mostly == is memory stuff ?
well you could actually do smtng like
boolean isSame = str1.intern() == st2.intern()
could dumb it down to that yea. One is content the other identify
don't you bring the string cache into this
🥲
Lol
Is it possible to simulate a player being 2.5 / 3 blocks tall?
teleporting and Armor stands?
to detect collision
u teleport when the armor stands collide
but u will have to do some math
to figure how far to go back and stuff
probs not worth it
maybe
u will still have to do math and stuff
and u have to use armor stands still to figure out the collisions
i know i can grab the players location and everything but is it possible to find out if a specific point in space is air?
no i meant coordinates with comma
i think
so that i can see if a specific point is air even if the upper half of that block is I.E. a slab
if (player.getLocation().getWorld().getBlockAt(0,0,0).getType() == Material.AIR) {
}```
well that works only for full blocks
if you wanted ```java
public Material getTypeOfPoint(World world, int x, int y, int z) {
return world.getBlockAt(x,y,z).getType();
}
World world = player.getLocation().getWorld();
if (getTypeOfPoint(world,0,0,0) == Material.AIR) {
}```
does it?
it says Gets the Block at the given coordinates
declaration: package: org.bukkit, interface: World
i think you got the idea. I want to target a coordinate given by float values and see if that point in space is , quote, 'air'.
As in if i target a slap block, depending if i target upper or lower half itll tell me 'true' or 'false'.
Also, thanks for linking the method I'll see if it could work

