#help-development
1 messages · Page 1365 of 1
Sounds a bit like hell if you dont use nms for that...
it is a bit of a hell thats been goign on for a few hours now
I get visibility packets to work, but not the customname
Faking the DataWatcher alone seems like a ton of work at first glance...
WrappedDataWatcher watcher = new WrappedDataWatcher();
//watcher.setObject(new WrappedDataWatcher.WrappedDataWatcherObject(0, WrappedDataWatcher.Registry.get(Byte.class)), (byte)0x20);
//watcher.setObject(new WrappedDataWatcher.WrappedDataWatcherObject(2, WrappedDataWatcher.Registry.get(String.class)), "{\"text\": \"TEST\",\"bold\": \"false\", \"extra\": {}}");
//watcher.setObject(new WrappedDataWatcher.WrappedDataWatcherObject(2, WrappedDataWatcher.Registry.get(String.class)), "test");
// watcher.setObject(new WrappedDataWatcher.WrappedDataWatcherObject(2, WrappedDataWatcher.Registry.getChatComponentSerializer()),
// WrappedChatComponent.fromText("TESTTT!!").getHandle());
watcher.setObject(new WrappedDataWatcher.WrappedDataWatcherObject(2, WrappedDataWatcher.Registry.getChatComponentSerializer()),
WrappedChatComponent.fromChatMessage("TESTTT!!")[0]);
watcher.setObject(new WrappedDataWatcher.WrappedDataWatcherObject(3, WrappedDataWatcher.Registry.get(Boolean.class)), true);
watcher.setObject(new WrappedDataWatcher.WrappedDataWatcherObject(5, WrappedDataWatcher.Registry.get(Boolean.class)), true);
watcher.setObject(new WrappedDataWatcher.WrappedDataWatcherObject(11, WrappedDataWatcher.Registry.get(Byte.class)), (byte) (0x08 | 0x10));
the first one with index = 0 is visibility (the 0x20 byte)
What version are you on?
that works so the entityid works fine, but you can see all the iterations ive done with custom names
1.16.5
Ok
Would you by chance have any idea what I could do
In many cases metadata packets fail because the entity ids do not match up so the client just throws the packet away.
Have you tried just spawing the ArmorStand as marker instead of making it invisible?
Ill get rid of all the watcher objects and just leave the marker instead
Whats the expected behaviour here?
A marker has not physical body. So its not visible and has no hitbox. Then you just need to set the name somehow.
watcher.setObject(new WrappedDataWatcher.WrappedDataWatcherObject(14, WrappedDataWatcher.Registry.get(Byte.class)), (byte) (0x10));
Can you confirm that this is correct?
Bc nothing is really happening now, its just a plain armorstand
- Maybe I should show you the spawnentityliving packet too
PacketContainer packetSpawnEntity = new PacketContainer(PacketType.Play.Server.SPAWN_ENTITY_LIVING);
packetSpawnEntity.getUUIDs()
.write(0, usingUUID);
packetSpawnEntity.getBytes()
.write(0, (byte)yawRad);
packetSpawnEntity.getIntegers()
.write(0, entityId)
.write(1, 1);
packetSpawnEntity.getDoubles()
.write(0, location.getX())
.write(1, location.getY())
.write(2, location.getZ());
try {
protocolManager.sendServerPacket(player, packetSpawnEntity);
Bukkit.broadcastMessage("sent1");
} catch (InvocationTargetException e) {
e.printStackTrace();
}
PacketContainer packetModifyArmorstand = new PacketContainer(PacketType.Play.Server.ENTITY_METADATA);
//Bukkit.broadcastMessage(packetModifyArmorstand.getWatchableCollectionModifier().getFields().toString());
WrappedDataWatcher watcher = new WrappedDataWatcher();
watcher.setObject(new WrappedDataWatcher.WrappedDataWatcherObject(14, WrappedDataWatcher.Registry.get(Byte.class)), (byte) (0x10));
packetModifyArmorstand.getWatchableCollectionModifier().write(0, watcher.getWatchableObjects());
packetModifyArmorstand.getIntegers().write(0, entityId);
try {
protocolManager.sendServerPacket(player, packetModifyArmorstand);
Bukkit.broadcastMessage("sent2");
} catch (InvocationTargetException e) {
e.printStackTrace();
}
entityId is just a random integer right now
maybe thats why it doesnt work?
If you keep track of that int and re-use it in other packets then it should be fine.
Yes thats what i do 🙂
Ill have to read the protocol specification again to validate this packet.
I could send it to you if youd like
Should be this one
https://wiki.vg/Protocol#Spawn_Living_Entity
Ok the spawn packet looks alright so far
Yeah thats working as expected
A custom name
what version r u using btw
watcher.setObject(new WrappedDataWatcher.WrappedDataWatcherObject(2, WrappedDataWatcher.Registry.get(String.class)), "test");
watcher.setObject(new WrappedDataWatcher.WrappedDataWatcherObject(3, WrappedDataWatcher.Registry.get(Boolean.class)), true);
``` Something like this doesnt work
1.16.5
im pretty sure it changed a couple versions ago to some kind of chat component bullshit
let me check
watcher.setObject(new WrappedDataWatcher.WrappedDataWatcherObject(2, WrappedDataWatcher.Registry.getChatComponentSerializer()),
WrappedChatComponent.fromText("TESTTT!!").getHandle());
Is this what you mean @quaint mantle
yeah i think so
Still no result 😦
give me a sec
Thanks
Try just setting the objects like the marker byte by index pure.
So watcher.setObject(14, (byte) 0x10);
I dont know what I should look for visually here
java.lang.IllegalArgumentException: You cannot register objects without a watcher object!
Then index 2 is of type OptChat. This will screw up stuff quickly so we will look that up last.
Then the third value you need is index 3 boolean=true
So watcher.setObject(3, true);
I get this error message @lost matrix
java.lang.IllegalArgumentException: You cannot register objects without a watcher object!
at com.comphenix.protocol.wrappers.WrappedDataWatcher.setObject(WrappedDataWatcher.java:399) ~[?:?]
at com.comphenix.protocol.wrappers.WrappedDataWatcher.setObject(WrappedDataWatcher.java:409) ~[?:?]
Right makes sense.
I will be right back ~ 5 mins
try using WrappedDataWatcher.Registry.getChatComponentSerializer(true)
instead of WrappedDataWatcher.Registry.getChatComponentSerializer()
your string (your custom name) will then need to be wrapped in an optional
watcher.setObject(new WrappedDataWatcher.WrappedDataWatcherObject(2, WrappedDataWatcher.Registry.getChatComponentSerializer(true)),
Optional.of(WrappedChatComponent.fromText("TESTTT!!").getHandle()));
watcher.setObject(new WrappedDataWatcher.WrappedDataWatcherObject(3, WrappedDataWatcher.Registry.get(Boolean.class)), true);
like this
Lets try
You're a hero @quaint mantle
That was it
Np
@lost matrix Also thanks so much for your effort
What should I do? I state that I can program in Java but I have never programmed a plugin
What is the question @feral ridge
Programmed Java but never used dependencies?
I study at school xD
Add spigot to your dependencies
Im this far right now:
final PacketContainer metaPacket = new PacketContainer(Server.ENTITY_METADATA);
final WrappedDataWatcher dataWatcher = new WrappedDataWatcher();
WrappedChatComponent chatComponent = SomeSheit
dataWatcher.setObject(new WrappedDataWatcher.WrappedDataWatcherObject(2, WrappedDataWatcher.Registry.getChatComponentSerializer(true)), chatComponent);
dataWatcher.setObject(new WrappedDataWatcher.WrappedDataWatcherObject(3, WrappedDataWatcher.Registry.get(boolean.class)), true);
dataWatcher.setObject(new WrappedDataWatcher.WrappedDataWatcherObject(14, WrappedDataWatcher.Registry.get(byte.class)), (byte) 0x10);
metaPacket.getIntegers().write(0, entityID);
metaPacket.getDataWatcherModifier().write(0, dataWatcher);
@lost matrix ay.ngel helped me to a solution already. it was the following:
PacketContainer packetModifyArmorstand = new PacketContainer(PacketType.Play.Server.ENTITY_METADATA);
WrappedDataWatcher watcher = new WrappedDataWatcher();
watcher.setObject(new WrappedDataWatcher.WrappedDataWatcherObject(2, WrappedDataWatcher.Registry.getChatComponentSerializer(true)),
Optional.of(WrappedChatComponent.fromText("TESTTT!!").getHandle()));
watcher.setObject(new WrappedDataWatcher.WrappedDataWatcherObject(3, WrappedDataWatcher.Registry.get(Boolean.class)), true);
packetModifyArmorstand.getWatchableCollectionModifier().write(0, watcher.getWatchableObjects());
packetModifyArmorstand.getIntegers().write(0, entityId);
@lost matrix The trick was to use a chatcomponenserializer with an optional
I was just thinking about how the optional part of OptChat was structured.
But nice 👍
Thanks for your effort dude
have fun coding bro
So uhm, I'm trying to create a world generation
and I want to create the biome generation, does anyone have an idea on how to do that
You should look into perlin noise, Minecraft uses it for cave generation currently.
using a perlin world generation is like trying to draw a number from a drawer.
Stacked perlin noises for humidity and temperature. OpenSimplexNoise is the way to go probably.
And also biome generation and village generation and almost everything generated actually 😄
If youre just looking into world generation, there are plenty of javascript implementations of that. Im sure that with some practise you can make it into minecraft
Wut?
Theres lots of videos on youtube thats what i mean
They show their perlin noise code, you could copy part of that
As stated: OpenSimplexNoise
https://gist.github.com/salmonmoose/67008c1c55abeb00d264
You pretty much generate a 2D array of doubles that range from 0.0 to 1.0. Then you just need to specify what biome should be used for what value range.
but why from 0 to 1.
Thats just the nature of noise generation. You can multiply it by 5000 if you feel like it. Then the values are from 0.0 to 5000.0
uhu
so I should use various PerlinNoiseGenerators.
to determine the biome.. right?
Thats up to you. One could be enough. But you could also create an arbitrarily complex system where you have 2 noises for humidity 1 for average temperature, 1 for continents, 1 for geographical composition
and then calculate a thousand different biomes from that.
Im actually not sure how to give a visual representation of that... but ill try.
Okay.
Can anyone help me with this problem? I have a BungeeCord server set up but when I start it I get this error message.
run it thru a yaml validator..
So you generate multiple 2D arrays of doubles with the simplex noise. Then you evaluate what type of biome should be generated at that position. The actual implementation of those array values is up to you. This example was made using "humidity" and "temperature" just because i felt like it...
I did that, but it says "Valid YAML!"
Yea no
This is from an old game i wrote in java a long time ago.
It also uses OpenSimplexNoise to generate mountains and determines where resources could be found. So a 2D array of my tiles and if the value was >0.8 then some resource is placed there.
That won't happen if it's valid
uhu
Simplest question of your life
Do I just combine the values?
with "+" signs?
Thats completely up to you. The implementation could be
If temp is between 0.8 and 1.0 and humidity is low (lets say below 0.2) then you generate a desert.
If the temp is high and the humidity is high then you generate a tropic forest. And so on.
You could also just create one noise for the beginning and just have 10 biomes that are generated
0.0 -> 0.1 Biom A
0.1 -> 0.2 Biom B
0.2 -> 0.3 Biom C
and so on
Procedural generation is a pretty complex topic
does frequency, octaves & amplitude have anything to do with this?
if yes, how should I change them
Kind of. Your amplitude is the maximum value that is reached. Working with doubles from 0 to 1 is perfectly fine. But you can alter those values by simply scaling each value.
The frequency changes how "stretched" the noise is generated. So in your case it would define how far certain biomes stretch. So high frequency means only small biome groups and high frequency means large groups of chunks with the same biome.
octaves is just the offset. This would be set by just adding a value to each tile. But "frequency" and "octaves" just add to the readability for the human. You can get away with just altering the frequency and working with values from 0 to 1
Procedural generation is complex. You have to really understand random number generation and instancing so you can generate the exact same thing from the same seed every time.
so
question
i am trying to keep entities in a list
simple ArrayList of LivingEntities
if there's a better way of keeping track of creatures which are currently spawned i am completely open to suggestions
What do you need a List of currently spawned LivingEntities for?
i have a 'name plate' mechanic
they're gonna despawn naturally tho under vanilla conditions
then just mark the ones u give a nameplate to
keep track of their uuid if you give them a nameplate
then again, i dont think you need a list
the entities are cleared if no players are within around 30 or so blocks, and there is a hard limit to how many 'nameplated' mobs can be spawned in the world
hmm
i could use PersistentDataContainer to store extra information
that way if the entity happens to despawn, it doesn't really matter if the data is lost
Using the PersistentDataContainer of those entities and listening for ChunkLoad/ChunkUnloadeEvents & EntitySpawn/EntityDespawn or death events should be enough to add/remove the name plates.
No need to keep track of them. Also lists are really bad collections if you use remove or contains often on them.
*arraylists
hmmmm, alright
I dont know any list implementations that scale O(1) on those operations. There might be one ordered implementation where you have O(log(n)) because of binary search capabilities but then the adding suffers.
But LinkedLists are trash anyways. The only reason why i would use them is for the constant time removal or insertion operations while iterating.
hi, anyome knows where i can find a deobfuscated minecraft server jar?
You need to apply the mappings yourself. Distribution of the deobfuscated jars is not allowed iirc
that's what i'd hoped i skiped
linked lists have more use cases than that 😭
Yeah
Name one and the answer is almost always ArrayDeque is just better
array deque lol
when you don't to want jitter when adding or removing
like growing the internal array
it can be pretty expensive
it's quite expensive when it gets bigger
but otherwise arrays will always be better due to their better memory usage
choose the right growth factor. And its actually faster than one would think.
"choose the right growth factor" seems like a fun task tho
doesn't system array copy use native shit?
yes
ThreadLocalRandom.nextInt() should suffice
yeah thats what i thought
But i remember the days where i benchmarked a ton of javas collections and came to the conclusion that LinkedLists are just slow and bloated. Speaking of CPU time and memory footprint.
blame the class footprint tho
could someone explain me what
Material.GRAY_STAINED_GLASS,1,(byte) 15);
is in
ItemStack nothing = new ItemStack(Material.GRAY_STAINED_GLASS,1,(byte) 15);```
the byte 15 is what i dont get
The iteration for example. 5-10 times slower than ArrayLists. Probably comes from the fact that arrays occupy a consecutive memory address space and thats just nicer to access.
Thats unsupported magic from ancient minecraft versions.
isn't it still calling ItemStack(Material,int)
meaning? lol
Are you using 1.8?
1.16.5
it was a time when a material name has ids to display versions of that material
throw it away then
oh
(byte) 15 defined the black variant of colourable blocks (e.g. wool or glass)
what do you think i should use instead?
that's just the amplitude of a wave
"Your amplitude is the maximum value that is reached. Working with doubles from 0 to 1 is perfectly fine. But you can alter those values by simply scaling each value."
I didn't get it
i suppose it's how high your pattern can go
is there an easier way of what I'm doing
I'm manually writing out multiverse perm nodes in the plugin yml to disable the stupid tab auto complete even without perms
no
probably created before tab complete was a thing. and no one put perms in their plugin.yml
should upload this somewhere so anyone who needs it could get it
then how can I cap it from 0 to 1?
you did it
I didn't
kinda worked
tho the 3 values it generates, are always, ALWAYS exactly the same between all of them.
this is the code...
I gotta go to sleep,
if someone wants to help me
just ping me in your answer so I can use the "mentions" tab in discord, thank you, good night
dying inside
Wym
can i ask quest about skript here to ?
sure, but no one here will be able to help you
they probably have their own server
Im trying to make it so i can set player permission what am i doing wrong?java PermissionAttachment attachment = player.addAttachment(AntasianGUI.getInstance()); attachment.setPermission(race.get(player), true); AntasianGUI.getInstance().perms.put(player.getUniqueId(), attachment); player.closeInventory(); player.sendMessage("You are now " + race.get(player)); for (PermissionAttachmentInfo perm : player.getEffectivePermissions()){ Bukkit.broadcastMessage(perm.getPermission() + ""); } It brodcast that i have the permission in chat but when i do /lp editor it doesn't show there. I want it to work with multiple Permissions plugin other then LuckPerms so simply using there api is sadly not an answer
if a permission check returns true then you are fine. It won;t show up in the lp editor because its not a permission assigned by lp
on respawn:
if "%region at player%" contains "medievalpvp in world hub":
wait 1 tick
player command "/warp jungle"
```someone knows why this not works it reload succes
ArmorStand frame = location.getWorld().spawn(location, ArmorStand.class);
Does .spawn spawn it in the yaw of location?
Or just the x y z
yaw too
not sure if you mean pitch @eternal oxide
yaw is rotation, pitch is up/down
Ah
How do I detect when a player walks through or on an Armorstand
when I build my plugin it is not building the plugin.yml what should I do?
Im trying to make a plugin that gives effects when a player consumes somethings... I set this up and it run, but when I eat something, nothing happens
compare with ==
getItem() returns an ItemStack, you can't compare that to a material
that too
i tried that but just gave error, may have did it wrong
so create an itemstack for the food then compare?
with ==
this is why, get the type and compare that with ==
thanks you two
I'm surprised your IDE didn't warn you?
Intellij's normally pretty good for warning you about impossible stuff
Probably because it's equals though
it did
it wouldn't care as it was attempting an Object comparison.
You'd be surprised. Intellij has warned me about some crazy things before lol
It analyzes the code
Eclipse is dumber and lets you do whatever you want 🙂
well in this case their ide did warn them, they just didn't listen
ah
Ah is that what the yellow is
I figured it was highlighted by him
200 IQ intellij strikes again
IMAGINE using Eclipse.
I can;t see SS very well. Too damn small
this is the tooltip, a simple read would've gone a long way
You leave me and my Eclipse alone. We love each other!
Yeah ALWAYS read that stuff @quiet hearth
Intellij will prevent so many fucking bugs
But bugs make you a better programmer. When you spend two days trying to fix a stupid issue you definitely remember it the next time.
Not true. Been programming for 10 years now, still make stupid mistakes
over 30 here and I do too, but not as many.
It's just a minor accident sometimes
I mean all of SSL was compromised due to a tiny mistake
actually almost 40 years now I guess. Time flies when your head is buried in code.
I bet you are a lot happier now with the higher level languages vs disgusting shit like cobol
I remember back in 82 rewriting Z80 asm for a custom Spectrum rom.
It was the best time programming ever
we never had compilers, we wrote the mnemonic, then converted that to hex manually
👀
It doesn;t sound fun btu it was. Little notebooks full of snippets of asm for different functions
We didn’t have ASM
We had ASM but no internet, It all came from books and tech manuals 😉
Well, that was after the punch card machines.
We still write tests on paper
What is the precedence for commands? How can I override WorldEdit's /info command with my own?
‘PlayerCommandPreprocessEvent’ runs before a command is run
is there a way to call another method within a method. Im checking to see if the item in the players inventory is a certain meta, then when the egg in this case is thrown it will hatch a certain thing. However you cant, that ik of, have "event.setHatchingType" and "event.setHatching" within a method of PlayerInteractEvent
Where the errors are is what im reffering to
Alright so first of all, you should not have your methods static.
And you can't call methods like that when they include a object in the constructor, you would have to include a new instance of the event that you want to call.
Is there an easier way of doing what I am. I am just having a special entity spawn when an egg with a certain meta is thrown
when it lands
The best thing I will say is to learn more about Java and the Spigot API in general, but i'll try and clarify this more...
Are you trying for when a player right clicks a egg that where it lands it spawns a custom entity depending on the itemmeta for it?
yes
Okay 1 second gonna wright some psuedo code
Pretty sure you can just use the throw event and check the held item
Yep
Use the throw event, and get the thrown item and compare the itemmeta, then once you have that you should be able to set the target spawn entity.
You can’t get the throw item, but you can check the item in each hand
Use the event I linked. You can get the egg, and you can set if it will hatch and the type that will hatch
I belive the PlayerEggThrowEvent checks after the egg is thrown
I have the link pulled up already
it has a getEgg() method. you can check the meta on that as its still an ItemStack
No it’s not
actually its an Entity
?paste
I get a java.util.ConcurrentModificationException
But I don't understand why
I made sure to not make modifications on the iterator
line 10 removing from teh collection you are looping over
It's a copy of the collection
not the actual one :/
backup = new HashMap<>(AutoChunkRegenMain.getInstance().getOldChunksMap());
isRegenerating = true;
int chunksAmount = 0;
final List<BukkitRunnable> runnableList = new ArrayList<>();
for(Entry<String, List<String>> entry : AutoChunkRegenMain.getInstance().getOldChunksMap().entrySet())
{
final String worldString = entry.getKey();
final World world = Bukkit.getWorld(worldString);
final List<String> oldChunks = entry.getValue();
it's what is before
use an iterator and you can safely remove.
Let's try that
import me.chewie.CustomThrowableEggs.items.ThroweggItems;
import org.bukkit.entity.Egg;
import org.bukkit.entity.EntityType;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.player.PlayerEggThrowEvent;
public class ThroweggEvents implements Listener {
@EventHandler
private void playerEggThrowEvent(PlayerEggThrowEvent event) {
Egg egg = event.getEgg();
if (egg.getItem().getItemMeta() == ThroweggItems.throwEggCreeper.getItemMeta()) {
event.setHatching(true);
event.setHatchingType(EntityType.CREEPER);
}
if (egg.getItem().getItemMeta() == ThroweggItems.throwEggTnt.getItemMeta()) {
event.setHatching(true);
event.setHatchingType(EntityType.PRIMED_TNT);
}
}
}
this doesnt work
check it has meta
and comparing meta should be an .equals as its not a primitive nor an enum
ok
You will probably want to test something specific in the meta rather than just comparing the object
I feel like the meta of the held item won’t be carried over
If the event fires before the item is removed you can just check the players hands
true
its not cancellable so I'm going to guess it comes after the ItemStack is removed
You know what, I'm gonna scratch this idea for now, and come back to it later when more experienced, sorry for wasting yall's time
Is there any reason you don;t use the normal mob spawn eggs?
I just wanted to try and make them throwable
I've not used teh spawn eggs. Are they not throwable?
The regualr spawn eggs?
yes, with a little magic
just detect right click of the player in the interact event. look for a spawn egg in their hand. use player.launchProjectile to fire a normal egg. and set meta on it so when you detect it land in the projectile hit event you then spawn whatever mob the meta says.
Ooo, ill give it a try. Thanks
if you block teh ability to place them too, they can only be used as projectiles
Ok
You could even make them look like spawn eggs in the air
You can set the displayed item on a snowball
Alright
Thanks, it did the trick ^^'. I'll be more careful about that it's a stupid mistake ^^'
nice
Regenerating chunks is so resource heavy god sake
actually as you are launching teh projectile you don;t even need to set meta. you can just set the spawn type and setHatching to true. no need to detect it hitting
ok
And you can still call setItem on it
bummer egg materials are not keyed 😦
Hmm?
can;t use Tag to detect all spawn eggs
Ah
You can add one via datapack, but I don’t know how well spigot can integrate with that
even SpawnEggMeta is heavily deprecated with no replacements
Probably still usable (probably)
You could use a loop and match any material ending in _SPAWN_EGG
That’s the idea, you can populate a set with the loop at startup
um, how to get the EntityType thats spawned by a spawn egg. Seems to be no working method now
?
SpawnEggMeta#getSpawnedType() is deprecated adn just returns Caused by: java.lang.UnsupportedOperationException: Must check item type to get spawned type
however teh spawn egg only has a getType for material
seems to be no way to reference teh EntityType
Is sky node good
Not sure
I'd hate to have to create a cross reference table
What's the use case?
API would probably end up having a table, might be an oversight though
adapting them to throwables by detect PlayerInteract, spawning a projectile and adding meta to the projectile so I can either set teh spawned entity type on an egg or handle spawnign on the hit event
all is currently possible except no method to get the spawned entity type from the ItemStack
worst case I can simply strip _SPAWN_EGG from teh name then do a EntityType match
Or a lookup map
I’m not sure if all of the item names will match up with the entity names
Issue might be that the meta doesn't have access to the type
Can't recall
Maybe you could look into it
If this plugin doesn’t work with dispensers too I’ll be sad
lol
I'm only playing with it as someone asked in here and it seemed an interesting and doable project.
Welp, might be something I need to make now
I want to launch spawn eggs out of a cannon
that might be fun
A lot of things could be fun from dispensers
oh bum. PlayerEggThrowEvent fires the instant launchProjectile is called. No time to set meta 😦
yay works
Why shouldn't I use static methods instead of dependency injection?
It depends on yoru use case
Lets say I want to use a single method within another class should I make that method static or use dependency injection
if that class is a utility class then static is usually fine
public static String generateGraph(ArrayList<String> labels, ArrayList<Integer> values, String type) I have been using static but some people are saying dependency injection is the way to go
if that method requires no calls to other classes then static would be fine
I don;t see any external calls
Why not use the in built system with eggs?
the player throw egg event fires as soon as you launch the egg so you don;t have time to set any meta on it to indicate the spawn type
simple: edit the meta before it's thrown /s
What’s wrong with setting it right after it’s launched
you get the projectile from the launchProjectile call
as I said you can;t do it after you launch it as the player throw egg event will have already fired
you need the meta already on the egg to be able to set teh spawn type for the egg.
I did try with eggs but you simply can;t use teh player throw egg event
Yep, not on teh egg
event only 😦
That seems odd
this works with any projectile though and is very simple
Technically just setting the item is enough to identify the egg, without needing meta
true
Although I guess another plugin may in theory set a snowball to a spawn egg
Yep, at least this way its almost fool proof
no need as it only set when launched
Yes but what if the server stops while the projectile is still in the air :p
odds of teh server going down with an egg mid flight is slight
and if it does go down odds of teh PDC already having been saved is almost zero
Doesn’t it get saved on shutdown
I'm not actually going to use the code myself. It was just an interesting question someone came in with earlier.
fireballs that spawn blazes 🙂
🙂
doesn't mythicmobs have throwable spawneggs XD
no idea
Welp now I have to make a plugin that lets you throw a bunch of stuff
Throw a brick through someone’s window
lol
Sadly I don’t think player.breakBlock ever became a thing
Yeah I just wish I didn’t have to go into NMS to do it easily
Nah the break block option
It’s easier than manually calling a break event, but it requires NMS
the Hit event has a getHitBlock().breakNaturally()
Yes but that doesn’t respect protection plugins
true
The NMS method does, and manually firing a break event probably would too
the best way to have a player's inventory transfer between servers is to use a database with base64 data?
then i'd like, separate each item by a /?
well unfortunately lists don't really exist in sql
wouldn't it be encoded 
ItemStacks are already serializable so can be passed via almost any method
why not just throw it into a json array and push it to SQL as a string
and this is from experience with hypixel's api, where they have an inventory endpoint with gzipped base64 data
blegh
that sounds messy

encoding to base64 will just make teh data larger
I’d imagine something non relational would be better here
it really depends on what you mean by transfer between servers
e.g. a server, split amongst 3 different servers because minecraft fr some reason can't handle more than 60 people at once, but i'd need their inventories to be synced between all the servers
If they are on the same machine you could just use a json file
then yes, sql base64 and store as a blob
an actual db is not better than json when you are just throwing blobs at it
i'd argue network > hard disk
and plus, from my experiences with yml files and ig json, data is actually easily just erased for no reason
probably (is) a mistake on my part, but db saved my life
or gson.tostring?
you would probably be safer using base64 if you push to sql
Base64.getEncoder().encodeToString
encode the actual itemstack into base64?
no
there are two ways to do it.
one is Inventory#getContents() then serialize the collection, but you will also be including null and AIR slots.
the other is loop the collection and storing each ItemStack with its index as a key
that sounds optimal, considering the items would need to be placed into their actual positions, not just filling up the inventory as we go down the row
o
suggestions?
The second woudl be marginally slower but preferable
however restorign it is also slightly slower
if you simply store teh collection you can restore it just as easily. but at teh expense of extra data
preferable in which way?
size of data? errors that could occur with the former?
o you said, lmao i didn't seer
so extra data vs speed
why would they base64 it if it get zipped?
maybe 'cause of their internal util that does that ? 🤔
and they didn't bothered
🤷
how do I paste a schematic using worldeditapi?
I have a schem in the worldedit schematics foler
so basically I have this code:
createmap.java:
https://pastebin.com/cvhyFCB2
setstartloc.java:
https://pastebin.com/mGSBBajZ
and it just doesn't work, no errors just nothing happens
Hello, what's the best way to centre the yaw and pitch to the block?
You can get the direction by subtracting the location of the player by the blocks location
Okay thanks 🙂
anyone?
Did you register the commands
File file = new File(File.separator + "/worldedit/schematics/house1.schematic");
how do I get the file path for this?
yes, it creates the file the create command works but the location setter command doesn't change the file
No that's not how you do it
add try and catch
no?
Use JavaPlugin#getDataFolder
._.
You need to get the WorldEdit plugin instance
I did
Where
Now use getDataFolder on that
ik
And remove /worldedit from your path
yeah I did
this server need a smart bot that upload files to pastebin
That's for the idea I'll add that to my bot
Hello! I'm making custom recipe that's with itemstack.
public void onPlayerCraftItem(PrepareItemCraftEvent e){
if(e.getInventory().getMatrix().length < 9){
return;
}
ItemStack a = new ItemStack(Material.STONE);
// setting itemmeta.
checkCraft(new ItemStack(Material.GRASS) /* It will be custom item instead grass */, e.getInventory(), new HashMap<Integer, ItemStack>(){{
put(4, a);
}});
Bukkit.broadcastMessage("A");
}
public void checkCraft(ItemStack result, CraftingInventory inv, HashMap<Integer, ItemStack> ingredients){
ItemStack[] matrix = inv.getMatrix();
for(int i = 0; i < 9; i++){
if(ingredients.containsKey(i)){
if(matrix[i] == null || !matrix[i].equals(ingredients.get(i))){
return;
}
} else {
if(matrix[i] != null){
return;
}
}
}
inv.setResult(result);
}
``` It doesn't work.
i'm trying hard but i don't know what is wrong
(Not error on code)
have you registered it?
where should i go? and what should i do if i wanna learn how to make unique 3D shapes and rotations
as a pretty basic math guy like me
i thinking about block and practicles .. etc
and maybe some java 3d stuff for games
.
i were thinking that i should just test and write stuff and code for 3d shapes that i wanted to do in a plugin but i'm pretty sure it will be poorly with lack of propper understanding and it will be a mess
there are better ways to doing recipes with custom items
Yea, why don't you just create a custom recipe? https://www.youtube.com/watch?v=DZTKu3trOw0
Love the video or need more help...or maybe both?
💬Join us on Discord: http://discord.gg/invite/fw5cKM3
Thank you for tuning in to this episode of TheSourceCode! ❤️
If you enjoyed this video make sure to show your support by liking , commenting your thoughts, and sharing for all your friends to see and learn!
All code is available on Github:
...
TSC 
His videos aren't bad
can groovy stuff break thread?
like when i use groovy along a plugin the plugin freezes
what could be the issue?
What are you doing with Groovy
im using jda with side of spigot...
..... I'm about to finish this
with eval command of groovy
...
what is worldedit maven repo?
daysling why r u so active on both jda and spigot xd
i am coding an di need both area
use a better bin
hm
whats the url of ur paste service again?
Blue Tree's Pastebin
imagine having a vpn tho, it can't be me ):
xd
nice
Works for me
wow
😀🔫
made by lucyy
u just sent the code u didn't tell the issue
okay so the thing is
this command does not do shit
And you're blaming 1.16 
its a class?
Did you register the command
AdminUtils is a plugin
oh ur plugin
That's not going to work
so.... it doesn't let the server start
this isn't the GiveHouseCommand class
right?
yep
I never use spgiot commands
hmm, logs?
or give ur main class
this class doesn't help
or give the source code its the best
i mean
okay
wait
i can't fetch logs
as i have to kill the server
send me the plugin in dms
ty\
wait a sec
poor dyno
lool
1.8.8, TacoSpigot and offline mode
1.8 ;-;
it just get stuck on
[08:53:11] [Server thread/INFO]: [AdminUtils] Enabling AdminUtils v1.0-SNAPSHOT
ofc, its a pvp server .-.
ok
no..
@silk mirage
does your bot have server member intent enabled?
yep
i have privileged intent on..
I said debug
I mean
put a console print
on first line
to make sure onEnable is called
then after jda
see if it stop before/after jda
etc
sure
what printed?
@silk mirage I noticed you don't reload config before getting the token
saveConfig is after the login
how can the plugin know the token if it didn't load the config?
i mean
huh
u r right cracked server = poop
Yea don't support people with cracked servers
if (args.length > 0) player.sendMessage(usage());
if (args.length < 1) player.sendMessage(usage());
why is this not working?
what are you try do
Debug
Olivo wanna give me your opinion on my debug log? 
What log?
check DM
k
plz help me 😦
ok
What about this here.... Uhhh any help?
Hey how do i make luckperms bungee to stop giving default permissions when players uuid changes
You cant
Spoiler alert.
Make your uuid not change then, which is just using the same name
Well that's a rpboelm
Well my plugin changes uuid bcz offlinemode and online mode
Well nvm
Bungeecord config
If you're using bungeecord, enable ip forward and bungeecord at spigot.yml
Well yea but if i enable bungeecord at spigot.yml then the uuid forwards too and its complicated
Exactly you want todo that ..
No bcz the uuid will change and the plugins will not recognize it so it will be new data and everything
Tho you should be asking this at #help-server
Uhhhh
Remove all the player data.
And it should work.
No it wouldnt
Bcz if you do setOnlineMode true in bungee then the uuid changes to online uuid
If you do setonlinemode false then the uuid makes offline uuid
Are you using offline mode?
Yes
don't expect uuids to be identifiable then
I don't think you can do that.
you can in bungee config
Yeah ik i was just asking about luckperms
Might have to ask the LuckPerms developer or something.
Why is my discord crashing?
@sullen marlin sorry for the ping, could you please remove @tulip quest gif? it crashes every discord?
Is there any way to change a player's username via bungee?
?ban @tulip quest
🔨 Banned 101989860197285888 indefinitely
Should be ProxiedPlayer#.setDisplayName
Anybody familiar with WorldGuard API? I'm kind of tired and I can't figure out just how to get the value of a StringFlag on a region 😮
region.getFlags().get("my-custom-flag") just returns null 😦
@limber dust @quaint mantle Thanks, but I meant I want to use itemstack instead of material
For example, I don't want to make 1 stick + 3 emerald to make perun
and I want to make 1 perun + 4 admin's stuff to make big perun
You can use
really?
Yes
I can only use material
Yes
No
hm
New itemstack(Material);
oh yeah
Xd
I want that
thanks'
Okay
Yw
ohh
What
i didn't meant that
r.setIngredient('$', Material.STICK);
It only able to material
😦
I want to use itemstack
on this
r.shape("#% ", "#$ ", " $ ");
r.setIngredient('#', Material.DIAMOND);```
but thanks for help
use RecipeChoice
declaration: package: org.bukkit.inventory, interface: RecipeChoice, class: ExactChoice
can someone help with this?
been trying to fix this for 1 day already.
https://hub.spigotmc.org/jenkins/job/BuildTools/ here you go!
You can do maven or just google spigot download
idk how to use buildtools
@EventHandler
public static void onInteract(PlayerInteractEvent event){
Player player = event.getPlayer();
if(event.getAction() != Action.RIGHT_CLICK_AIR && event.getAction() != Action.RIGHT_CLICK_BLOCK){return;}
System.out.println(event.getItem());
Why does event.getItem() return null when i am interacting with a stick?
?bt
The home of Spigot a high performance, no lag customized CraftBukkit Minecraft server API, and BungeeCord, the cloud server proxy.
hello, spigot, i tried to find recipe symbals chart, but I couldn't found. does everyone know recipe symbal chart?
The event is called for both hands, just add a null check
Recipe symbol chart? What
wtf is recipe symbals chart
That seems really weird, thanks tho!
the item and block can be null, just saying <- interact event
like in r.setIngredient('$', Material.STICK); : its $
Not really, the player can interact with both hands
yeah you can use anything
Yeah you can use any character
yea but i want see chart
???
you do that further up when you make the recipe
The home of Spigot a high performance, no lag customized CraftBukkit Minecraft server API, and BungeeCord, the cloud server proxy.
(if you're on legacy, the recipe will change, just sayin)
thanks, but i'm using recipechoice so i can't use recipe.shapeRecipe(...)
Yes you can?
recipe.setIngredien(char, new RecipeChoice.ExactChoice)
declaration: package: org.bukkit.inventory, class: ShapedRecipe
it's right there in the javadocs
thanks everyone
yup, also setingradien
then used shapedrecipe
hello
hi
I guess
hmm... so can't i fix this?
oh okay! i understood thanks
I understood like
(I understood like) you said just use shapedrecipe instead of recipechoice
No, use a shapedrecipe instead of shapelessrecipe
okay 😉
And a RecipeChoice.ExactChoice instead of a RecipeChoice.MaterialChoice
it's been draft api for ages...
Indeed, the docs say it’s only for shaped recipes but I believe it works for furnace recipes too
At least
Yeah it does
ok thanks, i'll try
wait recipe.setIngredient I can only use material 😦
it's wired. why only shapless can use itemstack?
and cant i use itemstack with shapedrecipe?
declaration: package: org.bukkit.inventory, class: ShapedRecipe
it's right ther
look at the javadocs
Recipe.setIngredient(new RecipeChoice.exactChoice(item))
ah thanks i'm newbie on javadoc
need to set char too
Not for shapeless
Ah
also i believe shapeless uses addIngredient
Probably
I just wanna know what is this warning:
Class 'CLASSNAME' is never used What's the cause?
The docs state that exact choices are only supported for shaped recipes but they kind of work for all recipes.
I assume someone finished the API and never updated it
What IDE are you using?
Intellij
You're not using the class probably?
You probably can disable that warning then
Idk
IntelliJ loves to go insane with warnings
Yeah the warnings are great for improving your code
This means you never create an instance of that class or use its static attributes. So if you would delete the class then the application would run the same.
This is not true for some classes like the one that extends JavaPlugin as its used internally by the spigot class loader.
Those warnings (and the ones where EventHandler methods are being seen as unused) can be suppressed by installing the mcdev plugin for Intellij
Alright, thanks.
What a stupid warnig
Usually if you resolve all warnings then you drastically reduce exceptions like null pointer.
7smile7, can you help with this since you know about this?
Alright
Are you doing it at 0,0?
Wouldn’t surprise me if they were all the same at the origin
Test another point
every point is equals
Also amplitude 0 seems questionable
open simplex noise supports seeding. So try to change the seed. Maybe one master seed and eache noise just has something like master + 1 master + 2 and so on
master = seed?
Probably the amplitude tbh
0 amplitude seems nonsensical
Though I’m not familiar with noise
I used 0 amplitude since it was giving me a -3 value
and I want it to be from 0 to 1
as he said
is there block data for berry growth?
Thats true. As stated yesterday i would just use an amplitude of 1 and work with 0.0 to 1.0 double floating points
Check the docs kacper, probably Ageable
kk thanks
I use ageable
uhm so?
I have no idea how your noise generator looks like. Mind sending a paste of it?
Was talking about the PerlinNoiseGenerator but found it
I'm using only one
since it is still using the same seed.
you told that octaves are like "the offset", so I put them way apart..
but looks like it didn't really change s***
What event listener is it for a player putting an item in chest?
Perlin noise != Simplex noise
I have a course now. Ill look into it after that.
InventoryClickEvent
Ahh, ok
and drag
Hello, i having problem with recipe. my code: ItemStack ironIngot = new ItemStack(Material.GRASS_BLOCK); NamespacedKey key = new NamespacedKey(plugin, "reeac"); ShapedRecipe recipe = new ShapedRecipe(key, ironIngot); recipe.setIngredient('E', new RecipeChoice.ExactChoice(ironIngot)); recipe.shape("EEE", "EEE", "EEE");
Of course, i searched google, but i couldn't solved
set shape before ingredient
How to check if offline player is actually a real player or not?
thanks, can you give me more details?
Tried checking if it is not null or by checking if they have a UUID
oh ok so can you msg me when you know about it?
and what I did wrong etc?
yet it is not nullable
what other details do you need?
and has a valid UUID
ah i understood now sorry im bad at english buoobuoo
What, so Bukkit.GetOflinePlayer() with a fake UID is not null?
I would be certain that returns null