#help-development
1 messages · Page 194 of 1
mye
OOP has nothing to do with mutability
no not really
No since you’re accepting it from inside the class itself I'd say
class First {
fun createInstanceOfOther() {
Other(
this.methodInOther()
)
}
}
Just from a high level overview, intellij autocomplete says this references the outter class
no thats not what I said
but you should design against mutability if possible
makes unit testing easier for instance
Yeah true and actually it’s unnecessary here because that’s no real state change
This is the function where I make the instance of MaterialListMenu, my end goal is that the line back(it.whoClicked) will reference the back(HumanEntity) method inside the instance of MaterialListMenu
private fun createStandardRegennableGui() {
gui.addItem(BasicItem(
ItemBuilder(regennable.getReplaceMaterial())
.name("&aReplace Material")
.addLoreLine("&7Current: &a${regennable.getReplaceMaterial()}")
.addLoreLine("&7Click to change")
.build(),
onClick = {
it.isCancelled = true
MaterialListMenu(
"&aSelect replace material for ${regennable.getIdentifyingBlockName()}",
onMaterialClick = { onClick, material ->
onClick.isCancelled = true
regennable.setReplaceMaterial(material)
back(it.whoClicked)
},
previousMenu = this
).show(it.whoClicked)
}
), 3, 2)
}
the onMaterialClick BiConsumer is called with an InventoryClickEvent and a Material determined by what was clicked by the player in the given event
What’s it?
hm?
The variable it
Oh, it's the InventoryClickEvent from onClick on line 8
onClick = {
kotlin just names them it by default
so it.whoClicked is InventoryClickEvent#whoClicked
You can introduce another parameter like backAfterClick and then do the back() after accepting the consumer
Ah I see, that's a smart approach
But yeah consumers should be independent from their accepting instance
So that would be a way
Right right
Thank you for the help, just needed some other brains that haven't been looking at this project for the past 4 hours lol
thats usually how it goes XD you look at it so long you cant figure out what may be wrong with it
I am using MCreator and when I try to build a procedure It gives errors and the command doesn't work. This is the error it gives
error: cannot find symbol
getServer().getPluginManager().registerEvents(new FMapProcedure(), this);
isnt MCreator for mods?
There is also the same error for
this.getCommand("fallmap").SetExecutor(new FallMap());
Yes, but there are extensions to allow building plugins
is your command in plugin.yml ?
Nope, it didn't do that, I will add it
why don't you just code in java with maven depndency
I don't know a lot of java
what you do here is basically copypaste from actual plugin code
registering listener and a command
you just need to
?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.
Hey how can I limit water so that it doesn't flow more than X blocks?
Hey, im again fucking, but what can cause exception when doing deserialization?
Because im using the ConfigurationSerializable and my class is not getting deserialized
Are you getting an exception?
you didn't register the class
Yes
I have done it
or you missed one of the requirements of ConfigurationSerializable
Post it
you MUST register it before you attempt to access the config the Object is in
ohh
that the reason
LMAO
I have been calling the config before doing class registration
anyone know a good method to recreate the teleport created by a chorus fruit?
Chorus fruit?
yes
Reason unacceptable code point '' (0x0) special characters are not allowed in "'reader'", position 0 - Loving fucking yaml
And the file is empty LMAO!!!
🤣 🤣 🤣
Hey how can I limit water so that it doesn't flow more than X blocks?
You can use the event
which one?
Maybe you can use BlockFromToEvent and get the block type, but im not sure if that is the best one
Hi, what way do you recommend to save inventories in config files? Reading in forums, they recommend get each item like ItemStack and save it in a specific section, later, get that section if you require the items. Is that the only way? I got serialize the Inventory object but I can't get it back Inventory object again
Inventory is wrapping Iterable<ItemStack>
you just need to serialize it's contents
and name + size
then build it with Bukkit.createInventory(null ,name, size);
and then set contents from what you stored
yes chrislo
mainly because the notion of serializing inventories is a bit ambiguous
in nms they seperate this by container contra ui
and so then the container (which just represents a stack of itemstacks) is serializable
well you can store classname of Holder and use reflection to create new instance
which is why the forums presumably directed you towards that solution
and put it to inventory
so it would be
inventory-one:
name: '&dBruh'
size: 45
holderClassName: 'MyHolder'
contents:
1: 'null'
2: ITEMSTACK #DEFAULT ITEMSTACK SERIALIZATION
and then just build inventory with name size and new instance of holder class
after that loop through contents section and add items
Thanks for the help, I will look into it. If anything, I'll ask around here 😁
good luck
But there is a problem how do I get the origin block to measure the distance?
well you can create a cringe alogrithm
which would loop through all blocks in max radius(which you set manually with your plugin) from the block in the event
if block type is water
you get it's blockdata and cast it to Levelled
declaration: package: org.bukkit.block.data, interface: Levelled
The source could also be a waterlogged block tho
if level is maximum level
then allow event to happen
if there is no block with max level around, then cancel the fromtoevent
in legacy mc there were 2 types
STATIONARY_WATER
and FLOWING_WATER
but now it's all just water and have Levelled blockdata
Was rather hoping not to do that but well then I have to do it anyway thanks for the help
yeah sadly there is no WaterFlowEvent
its either Spread or Form event
int e = Integer.parseInt(args[2]);
if (e == null) {
sender.sendMessage("null");
}
sender.sendMessage("debug lol" + e);
ping me when you reply
what's the question?
there is no error in this code you sent
!
if (s.name().toLowerCase().startsWith(args[1].toLowerCase())) {
change to args[0] probably
don't ask
Operator '==' cannot be applied to 'int', 'null' for the if (e == null)
args[0]? why?
im just checking if its a number
Was going to say, that error isn't even yours
your int is primitive
tho that's not even the error you should have
in my opinion its very useful for localhost servers
Also Integer.parseInt will throw a NumberFormatException if it fails. You shouldn't simply null check it after but instead go by try catch
ill do a try
then don;t come asking what the error is when it blows up, like it just has.
do
try {
int i = Integer.parseInt(string);
// work around your i
} catch (NumberFormatException ex) {
player.sendMessage("not a number");
}```
yes, for making empty array lists
oh wait I needed it lol
you can just use java's Collections.emptyList()
without importing google stuff
since when google adds stuff to Java?
or that's some random Google JDK which i don't know about
Guava
It's shaded into Bukkit
Collections.emptyList() will return an unmodifiable empty list, so if you want an empty list you can modify, just do new ArrayList<>();
Guava is amazing ❤️
he returns it to tabcompleter, no need for modification
now let's have a code review
Yeah that's fine then. In fact that's better so a new list isn't created every time
I quit halfway
got addicted to rick and mort
i'll get the links ready for the code review 😉
dm
its gonna be a github but alr
Colour comes from the Particle particle
As far as I know, only REDSTONE, SPELL_MOB and SPELL_MOB_AMBIENT can use custom colours. The rest can't
Those particles allow you to use the Particle#dustOptions
I haven't done it in ages, So can't remember exactly. I just remember that's how I did it
Just open javadocs
declaration: package: org.bukkit, enum: Particle, class: DustOptions
you need to spawn particle with custom dust options added
like (..., ..., new Particle.DustOptions(Color.AQUA, 1));
iirc
You need the spawnParticle() methods that accept T data
ye
and paste dustoptions as data
Whats the difference between extends and an implement interface?
Only interfaces can extend interfaces
Though beyond that, you implement an interface, you extend a class. That's about the only difference
Oh, i see
Hey there, I am beginning to trawl through plugin creation files, is there anyone around willing to answer a bunch of inane beginner questions so i don't have to spam a bunch of dumb easy to answer questions everywhere?
is there such thing as a player kill event? like a player killing another player, if so i cant seem to find it in player events
also where can i find the bukkit schedular
?scheduling
PlayerDeathEvent as well
EntityDeathEvent
if entity.getKiller() is not null and is instance of player then here is the player who killed the entity
got it
then player killed another player
free java lessons/free spigot lessons
you can only extend ONE CLASS, but you can implement MULTIPLE INTERFACES
and yeah interface can extend another interface to become sub-interface🤓
does anyone know about this error? : java.io.StreamCorruptedException: invalid stream header: 5B424033
I can't solve this error 😦
Please help me...
Here is my code that read Object from yaml configuration by using ObjectInputStream
public void setObject(String path, Object obj) {
try {
ByteArrayOutputStream baos = new ByteArrayOutputStream();
ObjectOutputStream oos = new ObjectOutputStream(baos);
oos.writeObject(obj);
oos.close();
byte[] btarray = baos.toByteArray();
String data = new String(btarray);
getConfig().set(path, data);
} catch (IOException e) {
e.printStackTrace();
}
}
public Object getObject(String path) {
try {
byte[] buf = getConfig().getString(path).getBytes();
ObjectInputStream ois = new ObjectInputStream(new ByteArrayInputStream(buf));
Object obj = ois.readObject();
ois.close();
return obj;
} catch (IOException | ClassNotFoundException e) {
e.printStackTrace();
}
return null;
}```
what's the best thing to use for spigot nms in paper?
since alvinss paper nms changes everything
and it bad
why don't u just use nms as they are
because its paper, can i do that?
probably yes
damn
i don't think paperspigot changes nms
so you can access them same way as in spigot plugins
alr, i gotta wait for my git to remap spigot
i'll come back
since i dont got a 1.19.2 version
Paper has Paperweight for nms
which is way different than spigot's
i just wanna make an nms way to set blocks
people have sent me examples but they all spigot
Just use the api?
i use alvinss api
for paper nms
which should work
but its wayyy different
or im doing something wrong
but i dont think i am
this for example
// 1.19.2
@Override
public void setBlockSuperFast(Block b, Material material, byte data, boolean applyLightUpdate) {
WorldServer nmsWorld = ((CraftWorld) b.getWorld()).getHandle();
Chunk nmsChunk = nmsWorld.d(b.getX() >> 4, b.getZ() >> 4);
BlockPosition bp = new BlockPosition(b.getX(), b.getY(), b.getZ());
IBlockData ibd = CraftMagicNumbers.getBlock(material).m();
ChunkProviderServer chunkProvider = nmsWorld.k();
//modify blocks
nmsChunk.a(bp, ibd, false);
//update lights
if (applyLightUpdate) {
LightEngine engine = chunkProvider.a();
engine.a(bp);
}
// send to client?
chunkProvider.a(bp);
}``` is so much different than alvinn's remapped version
Just use the bukkit api
You don't need nms for placing blocks
#setType(mat) is laggy asf
And you can use Spigots for Paper
This has been fixed for a while
The only way to make it faster is to make it unsafe
And you really don't want to break the world
You can always make block placing fancy and make it do 10 per tick
what settings disables "vanilla bug fixes"
ehhh
200x200x1 area
it'll be used for prison enchants which will be decently sized
this prison enchants are always weird
calling all weird enchantments prison
xD
i guess prison servers are like ultra fancy
i'm in a prison mining 200x200 blocks with wooden stick
i really dont trust #setType(material)
would #setBlockData() be faster than #setType()?
For large areas split the load over multiple ticks
no
how many blocks do you have to set, anyway?
i'll say like 5k blocks every second ish, depends on the player count tho
5-15K
5000 isnt that much, have you tried to disable physics?
are there any way to save object in configuration file?
yes
let me try
the method is called set(String, Object), and your object should implement ConfigurationSerialitable
your object's class also needs a proper deserialize() method, it's all explained in the javadocs for ConfigurationSerializable
i wonder, what the heck are you doing that you need to paste 5-15k blocks PER SECOND per player
well, i wouldn't say per player
every like 4 players
but prison enchants, aka looping blocks getting how much the block costs, adds cost, gives money to player, set's block to air
which some "enchants" will be pretty big
no idea what prison enchants are
i just explained it
.
basically this
i still dont get it
How can I create a plugin that shows me how many players there are in the world where the player is?
placeholder suport
anyways, how would i set a large amount of blocks fast
how is it supposed to show it to players?
i would switch to spigot but im using minimessage
with NMS, or using FAWE api or similar
yes, but paper nms is way different than spigots
setting blocks in NMS is like 1000% faster
since paperweight
nope, it's the same
wrong reply
anyway
i've tried
paper's NMS and spigot's NMS is the same
many examples
both use the original obfuscated mappings as released by mojang
and in both you can just use mojang maps for coding
with placeholder api
so you want to add a placeholder to PAPI, e.g. like %myplugin_online_player_in_this_world% ?
if so, the PAPI docs already explain everything you need
yes, without putting the name of the world
then why is it different, i srs dont understand. Or im doing something wrong
its different for me
nms still works
just everything is different
yeah, no problem. PAPI gives you an OfflinePlayer object
you can just check if the player is online, then do getPlayer()
then you know their world
what exactly is different?
?
if this stupid dependency would download i'll show you 😅
this is an example from Epic
// 1.19.2
@Override
public void setBlockSuperFast(Block b, Material material, byte data, boolean applyLightUpdate) {
WorldServer nmsWorld = ((CraftWorld) b.getWorld()).getHandle();
Chunk nmsChunk = nmsWorld.d(b.getX() >> 4, b.getZ() >> 4);
BlockPosition bp = new BlockPosition(b.getX(), b.getY(), b.getZ());
IBlockData ibd = CraftMagicNumbers.getBlock(material).m();
ChunkProviderServer chunkProvider = nmsWorld.k();
//modify blocks
nmsChunk.a(bp, ibd, false);
//update lights
if (applyLightUpdate) {
LightEngine engine = chunkProvider.a();
engine.a(bp);
}
// send to client?
chunkProvider.a(bp);
}```
you should usually just use spigot as dependency, add the "remapped-mojang" classifier, and add the "special source" plugin to your pom (when using maven - on gradle, you're quite fucked)
that's using the old, outdated names
e.g. since 1.16+, it should be ServerLevel and not WorldServer
1 sec pls
😦
you can use this website
in the top, click on "Spigot", then enter "WorldServer"
now it tells you that the "actual" new name is ServerLevel
and you do that for all classes that your IDE cannot find
%online_world%
Have you read PAPI‘s guide on how to create custom placeholders?
then you should do so now
np lol
np lol
the Three Common Maven Questions
it seems like it cant find the version 3.1.0
of maven-jar-plugin
3.1.0 should be on maven central, but tbh it's probably already outdated again
one sec
the latest version is 3.3.0
change it to 3.3.0, if it still doesnt find this, hit the "maven reload button"
ofc
you are using intelliJ right?
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<version>3.3.0</version>
<configuration>
<outputDirectory>C:\Coding\Minecraft\Testing Server\plugins</outputDirectory>
<finalName>Bound_Plugin</finalName>
</configuration>
</plugin>```
thx, 1 sec
works fine for me. have you tried Ctrl+Shift+O, then waiting until it's done doing its stuff?
oh it just popped up
if that doesnt work, hit "ctrl" twice quickly, then enter "mvn clean package -X" and send the full output pls
just doubling checking if it works rq
import me.clip.placeholderapi.expansion.PlaceholderExpansion;
public class Expansion extends PlaceholderExpansion {
@Override
public String getAuthor() {
return "Monkey";
}
@Override
public String getIdentifier() {
return "world";
}
@Override
public String getVersion() {
return "1.0.0";
}
}```
np! :3
you should normally have an onRequest method that takes an OfflinePlayer, and a String
you can then just check if that offlineplayer is online. if yes, do getPlayer(). if no, just return null
now you have a Player object where you can get the world from
sth like this should do what you're looking for
ain't bad at all
umm
?
And how do I make the variable work?
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.
how would i write to a packet?
im looking at the protocol docs
but seems like it doesn't like it
public void playPacket(Player player, double x, double z) {
CraftPlayer cPlayer = (CraftPlayer) player;
WorldBorder border = new WorldBorder();
ClientboundSetBorderCenterPacket borderCenterPacket = new ClientboundSetBorderCenterPacket(border);
borderCenterPacket.write(0, x);
borderCenterPacket.write(1, z);
cPlayer.getHandle().connection.send(borderCenterPacket);
}``` Expected 1 arguments but found 2
damn 😭
you just need to hook into the network manager via NMS to send a packet or use protocollib but I think it is good experience to learn how to do it though
😭
which variable?
would it be like this, by chance?
public void playPacket(Player player, double x, double z) throws NoSuchFieldException, IllegalAccessException {
CraftPlayer cPlayer = (CraftPlayer) player;
WorldBorder border = new WorldBorder();
ClientboundSetBorderSizePacket borderSizePacket = new ClientboundSetBorderSizePacket(border);
write(borderSizePacket, "a", x);
write(borderSizePacket, "b", z);
cPlayer.getHandle().connection.send(borderSizePacket);
}
public void write(Object instance, String name, Object value) throws IllegalAccessException, NoSuchFieldException {
Field field = instance.getClass().getDeclaredField(name);
field.setAccessible(true);
field.set(instance, value);
}``` there
I put return onRequest?
like that?
you need reflection to get a player connection which then you can get a handle
so you can then send a packet
oh, okay
this could work, but here is a link to a utility class that can help too
so am trying to spawn a particle using World#spawnParticle
but instead spawning static particle its spawning particle with a velocity
i want them to stay on their position
What's the plugin that lets you rtp when entering a fake end portal
use any plugin that execute command when entering portal and just set rtp command
do u know any plugin?
This is the development channel..
I would just make one yourself, it ain't that hard
Its like 3 classes not even
umm anyone know the solution or anything related to this ?
3 classes ? sounds like 3 line of code to me
@wet breach OMG... everything I had to do this whole time was to click this play button in Intellij 😭😭
not build artifacts ... just this play button and it output remapped version of my plugin 😭
and everything works now
build artifacts isn't the same as building project
glad you figured out the issue
why doesnt this work??
be more specific
I can tell you first off that you are using equals incorrectly
so basically i want to detect if the dragon egg is thrown in the void
maybe because an item cant get damage
wdym?
items can take damage
all items have a health of 5
is there a library with a method to get the direction from one vector to another?
that being said, it doesn't take much for them to die, 1 damage from the void is enough for them to die XD
you need to use a different event since the current entity events don't pick up stuff for items even though items are entities
declaration: package: org.bukkit.event.player, class: PlayerDropItemEvent
use this event instead if you want to detect if a player threw an item
and then you can track if the item is falling into the void
where do you take this from?
they dont even have a health
they do
https://minecraft.fandom.com/wiki/Item_(entity) why tf do items have a health
so how should i fix it?
it even puns itself Items have essentially no health
Health: The health of the item, which starts at 5. Items take damage from fire, lava, falling
this is an nbt tag part of items
it does, that is how they die and or despawn
the server isn't constantly checking if items are below that
it just kills them with damage
https://minecraft.fandom.com/wiki/Item_(entity)#Despawning its all written down
they dont take damage by the void
they despawn after 5 minutes of ticks and/or falling below the descripted height
e.getLocation().getWorld().spawnArrow(e.getLocation().add(0.5, 0.5, 0.5), e.getLocation().getDirection(),0.1F,0.1F).setVelocity(e.getEntity().getVelocity());
it does spawns a identical arrow
but spams in console about stackoverflowerror exception
also its at -128 for the overworld that number is for the other worlds. Anyways since I don't have my IDE up to see exactly how items despawn in the void I won't debate it further
https://hub.spigotmc.org/javadocs/bukkit/org/bukkit/event/entity/ItemDespawnEvent.html you could listen to this or do what frostalf said
declaration: package: org.bukkit.event.entity, class: ItemDespawnEvent
yeah i was looking for the end
but items have like such small health the smallest of damage kills them
I might load up my IDE later to make a PR to add items to entity events
as well as update the item interface to get their health
Hastebin is a free web-based pastebin service for storing and sharing text and code snippets with anyone. Get started now.
this is full logs
ah wait nvm
apprently the error isnt in logs
weird
so it doesnt take damage but it dies?
so DeathEvent?
nvm it doesnt work
the entity events don't work for items
you have to make use of the few events there are for items, if you need the items health however need to currently resort to using NMS
https://discord.com/channels/690411863766466590/1033441342484918363 some who has good skills on math, can help me?
EntityDamageEvent works for items tho
XY problem, what's the end result with this step? what are all the particle locations you want to have?
xz*
i want get those red locations dud
start from the middle of the block, add 0.5 to any axis to get your offset
this is rotating on 45 graus
and rotate your offset by 90 deg
but if want rotate to 35 graus?
furthermore i would need to rotate from 0 to 90
what is the end result
I don't care about those 4 points
what would you do with those 4 points
obb intersection
Can I keep adding 0.5 ?
how do i make a wrapper class of a player
without having to retype everything
or copy paste
nvm
make it wrap a player instance lol, or even better an uuid
how do make it wrap the instance
i wanna have stuff like User.setBanned(true);
User u = (User) player;
or something like that
just do ```java
class UserWrapper {
private final UUID id;
public Player getPlayer() {
return Bukkit.getPlayer(id);
}
}```
user.getPlayer().setBanned(true) dunno if that method exists but anyways
I don't understand why you need to rotate
you cant just make a class implementing Player or you'd have to write all the nms impl yourself
if you need to rotate 180 degrees, then all you have to do is just apply the inverse of the numbers you currently have
for my obb intersection system, I need to define 3 angles, one from the right and one from the left, same as axisalignedbb you know?
just imagine an abb just that you can rotate it,
this is what i've done
but in my case, I'm just going to rotate it sideways
for my code i need but nvm
in the case of two angles then
ok
if you rotating evenly
then you just need to use inverse operations
given x,z if you replace it with x,-z this will rotate clockwise 90 degrees
-x,-z is 180 degrees, -x,z is 270 degrees
basically i'm creating an obb based on the player's yaw so it can look at 360 but i'm going to divide it to 90
he might just implement that himself in that class
see you never stated this
i would need to know how to rotate this from 0 to 90
alr bro
and boring besides explaining it off that I have to use a translator all the time
well it is annoying for us to give a solution to only have someone say it doesn't work because of a hidden requirement they never bothered to state
but that was it, rotate between 0 to 90 based on the player's yaw
might need to use raytracing to get the appropriate angles to do the math since now everything is relative to how the player is looking
i already have ray trace method
once you have your angles, the math I gave above still works
only need to use inverse operations to rotate
wdym appropriate angles?
well, you need a way to setup a grid, can't do that only from the players position, need also where they are looking, if you know where they are looking and their position that gives you the angles to setup the grid, once you have your grid you can rotate. Can't really rotate something arbitrarily if you don't have known points
well you can just use #getDirection, but if you are referring where player is looking, or to a point of an infinite line it intersects a point
you could but you wanted it based on yaw
alr let me code
Hello, I would like to know how I can add an outline like in the screen below to a grade as a prefix
Texture pack
Map it to an unused unicode Texture than set a prefix to that unicode char
Okay but how do I do that? Isn't it like a normal texture pack?
Idk what a normal Texture pack is
But you'd have to look into the details
Google has many tutorials on this stuff
Ok I see thanks for the help

Is there someway to bypass the isInWater boolean for something like riptide?
what do you mean bypass boolean?
why doesnt this work?
(it prints every item)
how do u make it only say the location of the dragon egg
you really need to learn java or do some more reading
this is the second time you have come here asking why something isn't working and it is because of something so trivial
instanceof Item
is all that is needed
But they have that?
Or am missunderstanding what you meant
they have Item item Not just Item
thats fine, its java 14?
auto creates a local variable if its true
it works tho
seems error prone and unecessary
Is a dragon egg considered an item
???????????????????????????
It’s java lmao
its handy at times
Saves an if statement and variable declaration
I would love to see a use case for that in where it is better
how u do it then?
99% of the time
apparently I wasn't aware of Java 14 features fully
commandsender and player
if (sender instanceof Player player)
if (something instanceof Cool)
Cool cool = (Cool) something;
is identical to
if (something instanceof Cool cool)
how is it error prone
it's literally against errors
ye i knew that already lol
seems like YOU need to do some reading bro
lol
yeah i was talking to frostalf
Obviously you don't see where errors can arise, demonstrate you can't have errors with it and I will believe you
Roxy im on phone rn
wtf now lmao
But try if you can just do entity instanceof DragonEgg
you just can't admit that you were wrong about "learn more java"?
Because Material.DragonEgg is refereing to the itemstack
wdym by DragonEgg
Isnt there just a DragonEgg class
I would have said I was wrong about the Java 14 feature but then you came in here accusing of things because you failed to see where it is error prone
Or whatever the name of the class is
but hey I can block you that is fine
no, i dont think so
Well thers gotta be a wrapper class for it
no, there isnt
thanks, this was delightful
I probably know more about java longer then you been alive but that is cool though 🙂
help-development is my fav place 
that is the problem with arguing with strangers, don't know them and you assume something
oh, I thought you wanted to block me?
well im looping through every entity in the world
sorry for distracting you from that
and the dragon egg can be an Item
I can still see message from those blocked, just saves me from being pinged later in the future from you
@wet breach what i need to do now?
still can't get over it?
What are you talking about?
that's right
you want to argue like a child? Is that what you are trying to instigate ?
well, the thing is that its printing EVERY item in the world
i just need to somehow sort it
I don't care to get personal, there isn't anything you could possibly say that would hurt me
Where are you printing it
ok
that method
anything else you wanna tell me?
I cant see a print method
i'm all ears
Oh that prints it?
Uhh thers no way all items satisfy that if statement
you were the one instigating now you want to attempt to reverse it? o.O
ok
Bruh just shutup
this dude still trying to prove something to me 🤣
even if i dont drop the egg it still goves me random cords
I have nothing to prove to you
lol
Print out the getType
you are not someone of significance to me to be worth that
See what material it is
k
This code is fine, IF you actually have an egg floating on teh floor and not placed
Yeah thats what im saying
It’s not an itemstack
It’s an actual entity or block
Not sure which the egg counts as
Yeah
a Placed egg is a Block. a falling egg is an Entity and a dropped egg (floating item) is an Item
let me check real quick lol
Dropped egg is an omelette duh
or a mess 🙂
even better if its someone elses mess 😉
Im not sure how to read this
I suppose you could read it either way
and it be accurate lmao
its DROPPED_ITEM
? that pick shows nothing other than an egg in your inventory
Yeah placed drgaon egg is definitely a block
its the code
DROPPED_ITEM is the Item not the ItemStack
ohhhh
Item is a wrapper
nope
yes
there are also other dragon eggs in the world and it says its DRAGON_EGG
sry i forgor to getItemStack
yes
oh now i understand
Item gets placed blocks (Blocks) and dropped items (DROPPED_ITEM)
like the inventory on a particular donkey or just an inventory that looks like one from the donkey?
both are possible
donkey inventory is just a player inventory just with the title of donkey
a very quick question: i need to detect the location of a dropped item, so i use for (Entity entity : Bukkit.getWorld("world").getEntities()) etc...
now my question is do i have to do a for loop for all dimensions or is there a way to like .getWorld("all") or sth
Sorry I misunderstood your question
its ok
you can do World world : Bukkit.getWorlds() and then Entity entity : Bukkit.getWorld(world)
you could use two loops
one loop for the worlds and then stuff the getEntities inside of that with its own loop
yeah
how do i do the worlds one?
for (World world : Bukkit.getWorlds()) {
for (Entity entity : Bukkit.getWorld(world).getEntities()) {
}
}
nvm .getWorld(world) doesnt work
just use world.getEntities()
make sure you imported the Bukkit one
oh ok
also yeah no need to do Bukkit.getWorld(world)
either way works
but getWorld() only accepts UUID or a String
which you could have done world.getUUID() or world.getName()
its either UUID or Id can't remember
damn I didn't know Worlds had an UUID
but why would you call those methods, if you just get the world to begin with?
because I haven't been looking in the World methods
they are all valid ways to accomplish the same thing
true
yes and they are handy for when you have dynamic lobby worlds sometimes 😄
instead of dealing with a string name which could change
the UUID's of a world do not change
me neither
yeah this is very true
UUIDs are very good thing I like that entities have it too
it is really the only way to know if you are dealing with the same world
code wise
since names can change
true
does it load?
send to me and I'll test it
kk
just drop nbt in here
How can i add lines to a item lore?
@vivid skiff itemMeta.getLore() wihch returns a List then you can modify the list after that itemMeta.setLore(modifiedList) and then item.setItemMeta(itemMeta)
how I can get the the /data get storage NBT provider
I'm just running some tests. Structure loading may be bugged in Spigot
maybe it isn't gzipped ?
hello, i write this,
private CustomPlayer customPlayer;
public getCoins(CustomPlayer customPlayer){
this.customPlayer = customPlayer;
}
the name of class is obv the same as constructor, but when i register a commands the customPlayer object asks me, how do I solve it?
well should say compressed
interesting
it loads fine, if read via it's NamespacedKey
if that same file is placed in the jar as a resource it fails to load and complains it's not GZIP
yeah, the loading must expect it to be compressed
could just compress it or just extract it for reading
its a zip when placed in the jar, so calling plugin.getResource("backrooms.nbt") should feed an InputStream of the zip resource
I would need to look into it, but maybe the file extension has something to do with it?
what happens if you change it to some other extension lol
maybe, unless the method does something differently if it has .nbt
external I loaded it using NamespacedKey so it only has a name and it applies the extension
external (file in the world folder) loading using its Namespaced works fine
I'll change the resource name to zip
have a feeling it will work
?paste
line 48 is Bukkit.getStructureManager().loadStructure(plugin.getResource("backrooms.zip"));Doesn;t matter what extension when its included as a resource
I wonder if the InputStream is somehow affecting it
thats a pain as you can;t then use the native Plugin#getResource
actually I know the issue
getResource probably wraps the stream with GZIP
when doing this, it expects all resources to be GZIP'ed which means all files need to have a gzip header
the appropriate method to extract if just tossing into the jar would be to just get it raw
that is just use inputstream without wrapping it
it is the only thing I can think of that will cause that
I don;t see anywhere it could be wrapping it
getResource should be a raw InputStream
can you show a better example? I don't see a constructor here
if that really isn't the problem then it is down to encoding problem
how can you not see it? this.customPlayer = customPlayer;
let me guess, isn't he a constructor?
that isn't a constructor
off
whats the event called again that fires if u place a block in a container?
a constructor is a method that has the same name as the class and generally is located at the beginning of the class
InputStreams don;t have an encoding. It's just a byte stream and the file is exactly as placed in teh jar. This is odd
inputstreams do have encodings o.O
InputStreamReader has an encoding
okok, now I understand thanks ... and instead what I did because how do I raise the customPlayer request in the command registration ??
I will need to load up my IDE to look at this further but because I don't I can't really say anymore then that at the moment lol
np
it is strange nonetheless however
can you show the code you used?
which code?
that you used to do your test
literally just System.out.println("Loading Structure..."); try { this.room = Bukkit.getStructureManager().loadStructure(plugin.getResource("backrooms.nbt")); } catch (IOException e) { e.printStackTrace(); }
I wonder if it is loadstructure that is causing it
it seems to be
loading from an inputstream is different
From InputStream - https://hub.spigotmc.org/stash/projects/SPIGOT/repos/craftbukkit/browse/src/main/java/org/bukkit/craftbukkit/structure/CraftStructureManager.java#142
From NameSpacedKey - https://hub.spigotmc.org/stash/projects/SPIGOT/repos/craftbukkit/browse/src/main/java/org/bukkit/craftbukkit/structure/CraftStructureManager.java#57
ok, so with inputstream it needs to be binary stream
as that is what it expects
getResource() probably isn't doing that maybe?
let me try something
only thing I can think of doing is to toss plugin.getResource("backrooms.nbt") into a byte array
well no matter what I do it complains about not being in GZIP
in a music disc how can i hide for instance who its by?
example: C418 - far <- How can i remove this from showing? I tried:
stalmeta.addItemFlags(ItemFlag.HIDE_ATTRIBUTES);
but that doesn't seem to work even after i added it to the item meta,
try stuffing the resource into a new ByteArrayInputStream
and then feed that to the intputstream
if it still doesn't work, then for whatever reason loadstructure however it is implemented is wrapped with GZIPInputStream
and probably should be changed possibly to detect if the structure file is actually compressed
it makes sense why it is most likely wrapped
and that is because NBT data can sometimes be compressed with GZIP, which isn't the same as just compressing the file overall
.
pls
{
this.customPlayer = customPlayer;
}```
This is a constructor
what you don't understand?
and what is your problem?
?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.
yeah
yeah, i kn but when I create the command in main and I do getCommand("coins"). setExecutor(new getCoins (here it asks me to insert customPlayer));
, how do i solve?
there is the point
not the constructor
it asks you because you have a constructor
naming conventions pls
you have made a constructor if it asks you to put a parameter
you dont just name a class the name of a getter
Also, why new getCoins() ?
Please follow the name conventions tho
?conventions
sure, i created a constructor to implement customPlayer
okat thanks
and then you need to put a CustomPlayer because you have made a constructor
yes
Same error, not GZIP with java ByteArrayInputStream stream = new ByteArrayInputStream(ByteStreams.toByteArray(plugin.getResource("backrooms.nbt"))); this.room = Bukkit.getStructureManager().loadStructure(stream);
then what you want?
its an odd one
weird
I would recommend opening a discord thread
So you dont disturb other pp
?
I said it before, I needed a constructor and I created it, now that I made the constructor it doesn't let me register the command because it asks me to insert customPlayer ... I don't understand what's absurd
let's make a thread
this is gonna be a long day
is there an api or something for armorstand clientside? Because I had already tried 1 month ago to do it with protocollib but I had not succeeded I had errors with the devbuild
(I used to do it in nms but it's not available anymore)
?ask
If you have a question, please just ask it. Don't look for staff or topic experts. Don't ask to ask or ask if people are awake or available. Just ask the question to the channel straight out, and wait patiently for a reply. Make sure you use the right channel regarding the topic of your question. Create a thread in case the channel is already in use!
?nohello
I was just answering him to be polite
oh my bad
sry
na i mean is okay
okay
But we have to follow the channel rules😂
🤔
🤔
I mean if pp want to chat #general
stop saying "pp" pls
If pp want sever help #help-server and etc
Я си гледайте работата
english only pls
You must speak english
thanks for repeating me
Млъквай
Follow rules if u dont want to get ban/punished
Shut up
no u
Does anyone know about hCore library? And if it's good or buggy
What do you need?
I'll thank you if you stop bothering in a channel that is for asking for help. There is no need man. Please
@ancient plank i would be really thankful if you take actions. This man is disturbing and not following rules
ok and
Please tag adele so he takes actions faster
Im on fire with that man being annoying
why don't you tag yourself
This guy just called verano's mom a gypsy
i have alr done it
Little he knows Verano is latino 🤨
"Bulgarian"
he is using Ъ so true
Also adele thanks for taking actions 👏 👏 👏 👏
Много ми пука, ще пиша на какъвто искам език
Lmao he joined again 😡
people being assholes again
Yes!!
you will get muted/banned
do it at your discord server
we need to communicate here
Божий дар, if you don't need help, leave
I found the issue. It seems Maven uncompresses filtered resources. I just have to find a way around it now
lol
Оправи си българския
bojidar knows english, for a reason they are answering in their language
does 1.19.1 spigot work with 1.91.2 server
why are we supposed to translate while it could be you? i mean, you are already doing it 🤨
Are u making a plugin right?
no, for my server to run plugins.
wait what
he is just being fucking asshole
1.19.1 plugins work on 1.19.2 servers
lower api version doesnt work unless your not using newly added features in higher versions iirc
gotcha
no, im using russian 🙂
Hi a question how i can make pick up the item to the nearest player and none else
i once was working with 1.1.6.1 or whatever and server was 1.16.2 and i got a nomethodfound exception for smth specific 1.16.2
depends on what you touch
NMS or blockbreakevent
true
what?
just let player go and pick item up
Your mother is fucking asshole
Classic Bulgarian
Only the player who is near to the item can pick it up and none else
PlayerPickupEvent check for a radiuos and the player
Yes but getting the nearest player to it
Isnt what you want?
And with i can check it
Yes
just cancel the pickup event
How i can get the nearest user to it?
for all players whos nicnkame is not nickname of nearest
umm
you need to loop through all entities in radius
i would use uuid insrtead of name?
that's just example
woudln't really change anything tho
on server restart item would probably get removed anyways
@EventHandler
public void onDropUp(PlayerPickupItemEvent event) {
if (event.getItem().getItemStack().getType() == Material.CARROT_ON_A_STICK || event.getItem().getItemStack().getType() == Material.CARROT_ON_A_STICK) {
List<Entity> near = event.getItem().getNearbyEntities(1, 1, 1);
for (Entity entity : near) {
if (entity instanceof Player) {
Player nearPlayer = (Player) entity;
nearPlayer.sendMessage("near");
}
}
}
}
Like this?
you need
external variable
to which you would write entity
add if statement which checks distance between current nearest entity
and new entity in loop
if new entity is closer, modify current nearest variable
that is even more interesting
In that case distance squared would be the best one right?
ping me when you are about I have the fix
@EventHandler
public void onDropUp(PlayerPickupItemEvent event) {
if (event.getItem().getItemStack().getType() == Material.CARROT_ON_A_STICK || event.getItem().getItemStack().getType() == Material.CARROT_ON_A_STICK) {
List<Entity> near = event.getItem().getNearbyEntities(1, 1, 1);
for (Entity entity : near) {
if (entity instanceof Player) {
Player nearPlayer = (Player) entity;
if(event.getItem().getLocation().distance(nearPlayer.getLocation()) <= 1) {
nearPlayer.sendMessage("near");
}
}
}
}
}
like this?
distanceSquared() is better*
ok changed in this way should work just fine
both of you are idiots
hey guys is it possible for players to have variables?
Do you guys have a plugin for banning people when they die?