#help-development
1 messages · Page 667 of 1
if there's a one
ofc my code doesn't work
So 0101 in decimal is as simple as
1 * 2^0 +
0 * 2^1 +
1 * 2^2 +
0 * 2^3 ...
You run it in reverse order n magic
thanks for explaining but i already know that much 😄 i'm just confused with why chunk shit works this way. anyways i really gotta stop procrastinating or i'll crash the comm deadline
Not that hard
user is loaded async
Can it be hard?
so as imillusion said, load async, when you know user is loaded fire event
how is firing an event gonna help
so you know your user is loaded in your fired event
they want to disallow the login event
you can't do that after it's happened lol
the way i'd do it is, trigger the load in the AsyncPlayerPreLogin, then block that event until the user is loaded (it won't block the netty ELs, it runs in its own thread), then get the user in the login event and disallow accordingly
how do i block an event
dont make request to database async
in bungeecord you can register an intent, run your stuff, and then complete intent, during that time the user will just be left hanging on the login screen. if you plan on making your server in bungee, consider doing it this way
you join on your loading future in the APPLE
but i make the request in asyncplayerprelogin event
should i not?
don't make it async*
*with respect to that thread (the APPLE thread)
ok
why is it called apple thread
rule 11
because typing APPLE is just more convenient than typing AsyncPlayerPreLoginEvent
much thonk
rule 11 is no hating on cats
that's rule 1
the primary rule
so rule 6
lol, didn't notice its abbreviation
i knew it refrenced the async thread, but i didnt know why
mmmm
flat code
no cheats
np i guess
also i suggest u have a getOrCreate method for that
and have a cache layer
no reason to kick unless something goes horribly wrong
insertandget is getorcreate
anyone know why the colours don’t work?
``` player.sendMessage(prefix + message);````
and my prefix is: &#fb0000[&#dd0020C&#c0003fR&#a2005fE𔠧fA𐇙eTጤbeEb00ddS�d00fd]
wtf
because
- you didnt use ChatColor.translateAlternateColorCodes
and - that's not even a valid color code
Any expert in generating custom worlds here?
think smart not hard
widac ze polak
no
bro xd
the legacy hex format is &x&a&b&c&d&e&f for e.g. abcdef
for any other formats, you have to parse the message yourself
hex better bro
Heya, I wanted to know if there's a way to let me be able to return an Integer when I specify "clazzCast" to be Integer.class?
Thats hex tho?
what are you trying to do @zealous osprey
no, the result is the same
Yes it is what are you on about
cast it to T
@zealous osprey u dont need the T clazzCast param
its like you would say hex and rgb is the same
that is literally legacy hex though
its the same thing
under the hood it is legitametly hex it just looks slightly different due to how legacy processes colors
No thats a completely different thing bro
I don't want to return Object if I know exactly that it should be an Integer for a certain NBT path
it returns whatever u want
cast it to T
read about hex please and what is it
Can't; I tried to, but apparently that's not allowed
int something = getSimpleDataFromCompound()
I know what it is, hence telling you why your “hex better bro” is invalid
stop pinging me
AHHH, thanks @north nova <3
wait, your type parameter is wrong
public <T, K extends Class<T>> T getSimpleDataFromCompound(K clazz, NBTResult nbtResult)
public static <T> T getSomething(Class<T> tClazz) {
return (T) something;
}
look at his T
his T extends Class
Ahh, yup, thanks alot :D
yes, that's wrong
with his usecase its wrong
Is there a web api, that can get the donwloads and those kind of stats from ur plugin on spigot?
thanks 😄
can't do premiums, but works for all free
works for paid plugins too
however the builtin API also can show the downloads and other stats
how?
wdym how?
nobody mentioned anything about downloading the plugin
@tender shard I could just parse the downolads sting from the return right?
yes, it's just json
basically you parse the whole thing to a jsonobject, then you get the element "stats" as json object, then you get "downloads" as int
it's the stuff after the dot
weird question, how do i move a 6gb file from android to windows? usb connection is ruled out because my phone is half dead and does not handle usb correctly (namely, no more fast charging and no more usb transfer)
and google drive flips me off when i try to upload the file for some reason
my bad, it's a string
ssh?
TeamViewer
teamviewer does not work in russia unfortunately
hmm
never thought of sshing to my pc actually lol
wait how exactly would i do that
maybe you mean ftp?
just install openssh-server on either the pc or the phone
there's also bluetooth
then from the other device you sftp into it
although 6gb will take ages via bluetooth
lemme see
How can I make this generate trees in more than 1 chunk?
public void populate(World world, Random random, Chunk source) {
for (int x = 0; x < 16; x++) {
for (int z = 0; z < 16; z++) {
if (random.nextGaussian() < 0.15){
world.generateTree(new Location(world, source.getX()>>4+x,64, source.getX()>>4+z), TreeType.BIRCH );
}
}
}
}```
populate with a World object? where is that from? 1.8?
does your phone work enough for manually overriding the usb connection type in developer mode
you can actually go into developer settings in android and change the connection type to specific things
1.16.5
why did my cmd just stop recognizing commands??????
this entire day everything is going weird
Hello, I'm sorry if this doesn't belong here, I have a problem with spawning after /kill, setworldspawn is set but it still doesn't spawn where it should, could someone please give me some advice? Thank you!
idk how it is in 1.16 but in recent versions, the populate method gets passed a LimitedRegion that you can use
how do i get list of all chat color
Uninstall Windows.
declaration: package: org.bukkit.generator, class: BlockPopulator
u dont use that
how the heck did you get § in chat
1.17+
u use ampersand
tab completion
lol nice
keep flexing that you use unix big guy
echo %PATH%
i'm fine with using wsl
Custom world generation has been overhauled in 1.17.1
use & and do replaceAlternateColorChar or whatever
that does work
then idk, I haven't used 1.16 since 1.17 came out
I used to use Windows.
yeah but what does it contain?
no i want list of all chatcolors: WHITE,BLACK,RED
windows or linux, makes no difference for writing spigot plugins
Depends on hardware.
??????
i'm not sure why it's relevant but C:\Program Files (x86)\OpenSSH\bin;C:\Users\user\.cargo\bin;C:\Program Files\MySQL\MySQL Shell 8.0\bin\;C:\Users\user\AppData\Local\Programs\Python\Python36\Scripts\;C:\Users\user\AppData\Local\Programs\Python\Python36\;C:\Users\user\AppData\Local\atom\bin;C:\Users\user\go\bin;C:\Users\user\.dotnet\tools;C:\Users\user\AppData\Local\Microsoft\WindowsApps;;C:\Program Files\JetBrains\CLion 2021.1.3\bin;;C:\Program Files\JetBrains\DataGrip 2021.1.3\bin;;C:\Program Files\JetBrains\IntelliJ IDEA 2021.1.3\bin;;C:\Program Files\JetBrains\GoLand 2021.1.3\bin;;C:\Program Files\JetBrains\JetBrains Rider 2021.1.5\bin;;C:\Program Files\JetBrains\PhpStorm 2021.1.4\bin;;C:\Program Files\JetBrains\PyCharm 2021.1.3\bin;;C:\Program Files\JetBrains\RubyMine 2021.1.3\bin;;C:\Program Files\JetBrains\WebStorm 2021.1.3\bin;;C:\Users\user\AppData\Roaming\npm;C:\Users\user\AppData\Local\Programs\Microsoft VS Code\bin
installing modern java is easy on windows too ? lmao what
you're missing C:\WIndows\system32 in your path
how the fuck did that happen
no clue
lmao
enum.getName()
you want me to do that with all the colors?
name()
ChatColor.values()
you should cache ChatColor.values() somewhere though, it constructs a new array everytime
i mean it's 2003 software
but still
ok i readded system32 but this is so stupid
i wonder how much stuff was in my path
my OpenSSH is from may 2023 😛
are tostring() and name() different?
yes
how
name() is the actual name of the enum as declared in code (unless overriten)
tostrfing
seems that I have not worked with enums in some time :D
it does, but from what i remember, the pc just stops recognizing my phone as a data source after like 2 seconds
i'll try it though
space
whatsthat
ok
yeah it doesn't even recognize my phone now
in my notification tray i also used to have a prompt for what usb connection mode i was going for but it's not there anymore
fucks sake
what's wrong with your phone?
you might have to pop the storage out and see if you can get it directly off the drive
depending how old your phone is it probably has a SSD granted it might be sautered
You love to see it XD
use primitives!!!!!
I could, but that isn't the issue
primitives can't be null
u should*
so that would be a valid use case
assuming the method returns null if the tag is missing
Well, it doesn't matter here, cause lateron it'll be set into a new Location, so it'll be converted anyways
oh god
yup
why does it say class member declared outside of a class
import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import java.util.UUID;
private final HashMap<UUID, LONG> cooldown;
public class ReroolCommand implements CommandExecutor {
@Override
public boolean onCommand(CommandSender sender, Command command, String s, String[] strings) {
if (sender instanceof Player){```
because ur tryna declare a hashmap outside the class
because you declared the field outside of the class
someone say it again
everything has to be inside
class
{
your stuff
}```
make sure he knows
IK
ok guys he knows
to be fair, the error message should have already told them, soooo once wasn't enough apaprently
JESUS I FIGURED IT OUT YOU DONT HAVE TO SAY IT MILION TIMES
lol
(what the fuck man)
fancy
you know me, always helpful with the art!
I got one question about the vanilla /Reload command. Right now you can only reload by doing /Reload confirm, and you get a warning message. But i got a few questions about this:
- Is reloading like this safe? and if no, what is a better solution?
- Is there a way to just type /reload? because the confirm after is for me just extra typing.
- Is there a way to remove the whole warning message?
reloading isn't safe
unless the plugin is designed to support reloading
I think you have to turn on developer mode
reloading fucks up a olt of things
Well i got a server with only my own plugin and worldedit, and i keep using /reload, but i just read online its not safe because of memory leaks
well if you know what you're doing
for testing its fine imo, in production environment, please just restart the server
Till now i had no issue thats why i am supriced
you can use /reload
I just use it for testing
Till now its just a simple minigame (prophunt) and make some prefix like ranks and stuff
Just to update the code, so my new code can be tested
are you replacing the jar or updating config values
replace Jar
i did it already, and i switched the default mode to usb transfer. it's that my phone is half dead which makes all usb connections basically unmanageable\
You're totally fine to reload in a testing environment. We only really discourage it in production environments
Is there a way to just type /reload? because the confirm after is for me just extra typing.
Is there a way to remove the whole warning message?
Paper feature. Probably not
Try repairing the USB port?
So everytime i change some code, its better to fully reboot?
can't be bothered. the phone is old anyways and is running out of storage, i'll be looking for a new one
it really depends, but yeah
I see, so maybe lookin for a script that fully restarts the server is better i assume
omg thank you
hahaha
since ur replacing the jar i assume you're on linux?
I am on windows
so how are u overriding the jar then what
building directly
Why?
I just run the file, creates an jar file and replace the old one
replacing does work fine, just removing it won't work on windows
windows is weird
Yeah it locks the file because it's in use
idk ive been on linux for a while now
But you can definitely replace it
I am working in IntelliJ IDEA Community Edition 2022.2.2
How life there?
its cool
There i just build the file, run it and reload the server
I drag and drop replace my plugins while my server's running all the time 😛
:start
title MC-%version%
java %args% -Dio.papermc.paper.suppress.sout.nags=true -DIReallyKnowWhatIAmDoingISwear -Xmx4g -jar %first_jar% nogui
echo Server restarting...
echo Press CTRL + C to stop.
timeout /t 5 > NUL
goto :start
java quine???
I just edited the path so it already places the jar in my minecraft folder server
ah yea classic i really know what i am doing i swear
yeah i wrote a quine earlier
why 😭
I changed it outputDirectory so you dont even have to drag and drop anymore
also send the code 👺
is there an entity/player land event?
package com.jeff_media.javaquine;
public class Quine {
private static final char quote = 34;
private static final String[] code = {
"package com.jeff_media.javaquine;",
"",
"public class Quine {",
" private static final char quote = 34;",
" private static final String[] code = {",
"};",
" public static void main(String[] args) {",
" for(int i=0; i<5; i++){",
" System.out.println(code[i]);",
" }",
" for(int i=0; i<code.length; i++){",
" System.out.println(quote + code[i] + quote + ',');",
" }",
" for(int i=5; i<code.length; i++){",
" System.out.println(code[i]);",
" }",
" }",
"}",
};
public static void main(String[] args) {
for(int i=0; i<5; i++){
System.out.println(code[i]);
}
for(int i=0; i<code.length; i++){
System.out.println(quote + code[i] + quote + ',');
}
for(int i=5; i<code.length; i++){
System.out.println(code[i]);
}
}
}
a quine
this is why we don't write quines in java
oh
that's a program that outputs itself
why would anyone wan this tho
it's not as easy as you'd think
no im not being rude or anything
some people apparently have too much free time
there is none
Yo, Is Player nullable on PlayerTeleportEvent? The docs say its nonnull, but im getting alot of people sending me stack traces saying its null.
Is there any valid reason this could be null? or is it a bug?
java.lang.NullPointerException: Cannot invoke "org.bukkit.entity.Player.getLocation()" because "player" is null
at com.iridium.iridiumskyblock.database.User.getCurrentIsland(User.java:35) ~[IridiumSkyblock-4.0.4.jar:?]
at com.iridium.iridiumskyblock.managers.IslandManager.getTeamViaPlayerLocation(IslandManager.java:88) ~[IridiumSkyblock-4.0.4.jar:?]
at com.iridium.iridiumteams.listeners.PlayerTeleportListener.onPlayerTeleport(PlayerTeleportListener.java:28) ~[IridiumSkyblock-4.0.4.jar:?]
it's just a "well I'm bored, why not write a quine in <language> today" thing
can we have some code?
Actually, I forgot I added this in an task, I guess if the player logs of in the same tick it could be null?
pls use dependency injection in these things 😭
nerd shit
singletons >>>
PlayerEvent just returns the field
TRUE
honestly
i was thinking
to re-invent java
and create a new class for each entity
(player)
with static methods
and fields
make everything static
what exactly are u talking about
what is "classes"
im not very familiar with that term idk
i write Skripts for a living
i only know .sk file
75 cents an hour 16 hours a day
hmm? so even if they log off it shouldnt be null?
Potentially its another plugin manually calling an event then? or a spigot bug?
use player#isOnline
https://github.com/Iridium-Development/IridiumSkyblock/blob/master/src/main/java/com/iridium/iridiumskyblock/database/User.java#L17 the issue is that you set player to getPlayer() in line 31 of your User class
dont check if player object is null to check for that
how? thats not used in the context of PlayerTeleportEvent?
and that method is returning null - so no, it's not the event that returns null
ofc it is
it's right here in your stacktrace
in the teleport event you call IslandManager.getTeamViaPlayerLocation() and that in turn calls User.getCurrentIsland
looks like you know my code base better than I do lol
i just looked at the stacktrace and the User class lol
How can i create custom entities?
Now ayyyyu
what exactly do you mean with custom entities?
Its the iridium skyblock guy
Yo
is there a way to get spigot src without making a stupid jira account?
yeah
Like a zombie that has 50 hearts and can do specific stuff when it gets damaged
run buildtools
you can look at source without
you need jira and stash access for pull requests
i dont want a pull request
so look at source
i just wanna be able to look at the src in my ide
hearts -> attributes
do specific stuff when it gets damaged -> EntityDamageEvent
run buildtools, then open the CraftBukkit directory in IJ
git clone https://hub.spigotmc.org/stash/scm/spigot/spigot.git
ah, easy enough then
No i want to store it in a class and spawn it whenever i want. There isnt EntityStack... right?
EntityStack?
git clone https://hub.spigotmc.org/stash/scm/spigot/craftbukkit.git & git clone https://hub.spigotmc.org/stash/scm/spigot/bukkit.git
and now you have all 3 current sources
Like itemStack
if you want to extend NMS entity classes, you have to use mojang mappings - did you already set that up?
looks like that reflects the latest version u have builded tho?
no clue what you mean
why the fuck would you
why would an Entity have Stack
might better to takes epicebic's route then
its a singular mob
then you'll have to apply the patches manually https://www.spigotmc.org/wiki/guide-contributing-to-spigot/
The home of Spigot a high performance, no lag customized CraftBukkit Minecraft server API, and BungeeCord, the cloud server proxy.
Whatever
I want to have an abstract class containing an entity's custom attributes and stuff and its listeners and a build function which glues all the things and creates a mob which i can spawn.
you have 2 options for custom mobs, a) fully custom, custom path finding, custom modeling and more, b) re skinning an already existing mob
Reskinning
you can easily do that but keep in mind that you will always have to extend an existing entity class, you cannot create totally new ones
and whenever they get unloaded and loaded again they'll be the normal vanilla version again
Like
public class CoolerZombie extends EntityZombie?
No i want to do it without nms
then you cannot extend existing entity classes
In 1.17.1
you need NMS to extend the existing classes
hmm, why is jitpack showing me No build artifacts found what could be the cause?
Thats what i said
I want a class containing an entity's attributes and code and stuff and then have a method spawn(location) which spawns it and stores a unique id for it in the pdc and in a map in the Main class
i configured everything correctly i think
its jitpack
well then just do that using normal bukkit entities
so what should i do?
Do i still have to extend or implement anything?
I'd just create a MyCustomEntityFactory class that has a spawn method and applies all the given attributes using the consumer method
In the entity class
not use jitpack
no, you'll be using the normal bukkit entity, e.g. it'll return / spawn a normal zombie / pig / whatever
well then just call it EntitySpawner or whatever lol
lol true, i could make my own repository ig
i uploaded shit to maven central today, it was so annoying
maven central can fook off
It takes 10 minutes for me to create a new minecraft project bcz its unable to download versions list and i have to close and reopen 50 times for it to work
wdym with version list?
The place where you chose the version in the new project tab of intellij idea
just use my maven archetype https://github.com/JEFF-Media-GbR/spigot-plugin-archetype
or the GUI for it https://github.com/JEFF-Media-GbR/Spigot-Plugin-Generator
the mcdev plugin is shit. just use a maven archetype, e.g. the one I linked above
oh i tried but absolutely nothing happened xd
?tryandsee
have you read the output?
well it opens an external console and instantly peaces out
btw why are there 2 epics
well
open it from CLI
does fleet have both packages and folders?
@tender shard this was its output. i guess my fork cannot be named spigot or somethn? xd
Run it in the correct directory
And you also have to provide the path to your buildtools thingy
Wdym? Packages are just folders
alex how did you claim ur namespace on central
like what do i do with the verification key
./applypatches buildtools/path/work/decompile-latest
I host my own
yeah i could do that ig
I pay 22.50 a month for my vps which isn't bad tbh
selfhosting or repsy
I use it for a ton of stuff other than my repo though
repsy is pretty decent
you might be able to rest api to query it
get latest version and then update ur url
oh
this type thing
except it dont work
would be up to reposilite to add probably
i don't think so buuut that's pretty pointless, as maven by default automatically updates once per day to the latest snapshot
or do you explicitly declare a certain snapshot in your pom?
because that's pretty unusual
e
they wanna link javadocs on discord
why 2 different answers
oh that's what you mean
for that I manually upload my javadocs
and update them as needed
plain old http directory https://hub.jeff-media.com/javadocs/
am i not meant to be running it from the root of the forked project?
Theirs a maven plugin for that btw too
erm yes, that's correct. idk I only ever edited bukkit and craftbukkit, but never spigot
well i did the buildtools thingy but same result
Spigots patched need to be merged at some point :P
yeah having bukkit and craftbukkit and spigot separated makes little sense nowadays
there should only be spigot-api and spigot
np. you could ofc also create an issue on reposilite and ask them to add a "javadocs viewer" or sth
yea i got no clue how this whole patch system works
send the link to the issue when you created it, I wanna +1 it
maybe just rephrase it and ask about a "link that always points to the latest javadoc view"
usually they'll add the labels
is there a way to set a time out to intelli sense?
i don't want it to crash if i click on Material anymore
just download the javadocs/sources, then it won't have to decompile
but no clue how that works in vscode
wait, i did this already somehow
oh i used the maven javadoc plugin, that must've done it for me
the maven javadoc plugin is to generate a javadoc jar for your own project
yeah but i messed with the configurations
something to do with offline mode
i tried to do something wild
have u tried clearing cache
Okay so i have a gui system that denies players from taking item out of them or putting them in
but how do i stop players from shift clicking items into the gui?
Since the InventoryClickEvent the inventory clicked is not a gui inventory it doesnt cancel it
Is the only way just to keep a list of all players who have a gui open and deny all inventory interactions when a gui is open or is there a way to tell that a item has been shift clicked and where that item is going to end up
InventoryClickEvent#getClickType
MOVE_TO_OTHER_INVENTORY
and use InventoryClickEvent#getClickedInventory
^
Returns the players personal inventory
not the GUI
why am i forbidden from using external emojis
well then there's your problem?
no boost
yes, what else? it's the inv they clicked
Issue with creating custom player heads
aha
if they clicked their own inv, the type is MOVE_TO_OTHER, and the top inv is your GUI, then deny it
Is there a way to get the "top inv"
getView().getTopInventory()
public void spawn(UUID spawner, Location location){
this.spawner = spawner;
LivingEntity mob = (LivingEntity) location.getWorld().spawnEntity(location, type, false);
mob.setCustomName(name);
mob.setCustomNameVisible(true);
mob.setMaxHealth(health);
mob.setHealth(health);
if(hasArmor) {
mob.getEquipment().setBoots(boots);
mob.getEquipment().setLeggings(leggings);
mob.getEquipment().setChestplate(chestplate);
mob.getEquipment().setHelmet(helmet);
mob.getEquipment().setItemInMainHand(hand);
}
mob.getAttribute(Attribute.GENERIC_MOVEMENT_SPEED).setBaseValue(speed);
if(hasBossBar) {
bossBar = Bukkit.createBossBar(name, BarColor.RED, BarStyle.SOLID);
bossBar.setVisible(true);
bossBar.setProgress(1.0);
bossBar.addPlayer(Bukkit.getPlayer(spawner));
}
uuid = UUID.randomUUID();
mob.getPersistentDataContainer().set(HypixelCustomMobs.getPlugin().getIsCustomKey(), PersistentDataType.INTEGER, 1);
mob.getPersistentDataContainer().set(HypixelCustomMobs.getPlugin().getUuid(), PersistentDataType.STRING, uuid.toString());
HypixelCustomMobs.getPlugin().getMobManager().addMob(uuid, this);
}
can anyone take a look at this code for spawning a custom mob and telling me what is missing and what i can improve?
When you want to spawn a custom entity, e.g. with a custom name or certain items equipped, you must use the method World#spawn(Location, Class, Consumer) unless you give a shit about compatibility with other plugins. I’ll explain why. The shitty way Usually, you can easily spawn entities like this: That is fine, as...
wtf is a consumer
a consumer is a function that takes in one argument
I forgot what a consumer is too
it's like a runnable but it has a parameter
Callback function?
Basically, yeah
Runnable: No args, no return value
Consumer: One arg, no return value
Function: One arg, one return value
BiConsumer: 2 args, no return value
BiFunction: 2 args, one return value
... etc
what shoud i do to not give shit about other plugin compatibility?
ok
yoo hello @worldly ingot
Bad:
Pig myPig = location.getWorld().spawn(location, Pig.class);
myPig.setCustomName("oliver193");
myPig.setCustomNameVisible(true);
Good:
Pig myPig = location.getWorld().spawn(location, Pig.class, (pig) -> {
pig.setCustomName("oliver193");
pig.setCustomNameVisible(true);
});
EventPriority.MONITOR, setCancelled(true) 
I've done that kinda stuff before, just that instead of using given classes (Runnable, Consumer) and I just made an interface with a run method. And due to how interfaces work with doing new, it worked. (Or was it an abstract class? Idk)
Lambdas are doing that too, it just looks nicer
both won't work
Sure it will
well I mean you cannot instantiate an interface or an abstract class
Sure you can
you can instantiate an anonymous class that extends/implements them
Pig pig = ...spawn(location, Pig.class, new Consumer<>() {
@Override
public void run(Pig pig) [
// hi
}
});```
yeah but that's an anonymous class and not instantiating a consumer itself
yeah sure
I was just worried about the "due to how interfaces work with doing new"
I wish interfaces would allow to declare constructors
Due to multiple inheritance there's no way for that to be possible
can not resolve method getPDC
yeah I know D:
getPersistentDataContainer()
getPersistantDataContainer()
that method does not exist on whatever you're trying to call it on
i know
well what are you trying to call it on?
Only other reasons you'd not see it is if the object isn't a data holder or you're on < 1.14
entity pdc
so which version are you on?
1.17.1
show your code
Sorry for writing here, I just don't know where to write on the site. I really need help please!!! I need to add everyone who has a tag to the group, but you can’t use @a in the plugin, I don’t know what to do, it’s very necessary (((
/Извините что пишу сюда, просто не знаю где писать на сайте. Очень нужна помощь пожалуйста!!! Мне нужно добавить в группу всех у кого есть тег, но в плагине нельзя использовать @a, не знаю, что делать, очень нужно(((
And is it the correct Entity import? Because there's one in AWT iirc
LivingEntity mob = (LivingEntity) location.getWorld().spawnEntity(location, type, false, (m) -> {
m.getPersistentDataContainer().set(HypixelCustomMobs.getPlugin().getIsCustomKey(), PersistentDataType.INTEGER, 1);
m.getPersistentDataContainer().set(HypixelCustomMobs.getPlugin().getUuid(), PersistentDataType.STRING, uuid.toString());
});
what's type?
wdym
what is the type of "type"?
String... maybe
wait, spawnEntity doesn't even allow to use a consumer
yeah because it returns entity
wtf should i do then
declaration: package: org.bukkit, interface: RegionAccessor
you need to use the class
for the consumer to work, type has to be a class
you can do type.getEntityClass()
EntityType.getEntityClass() i believe this was a method
yes
yes but i'm pretty sure that gives you
Entity as return type
not sure it's the best
it returns a Class<? extends Entity>, yeah
it didnt break anything
Excuse me please, how to write on the forum?
are you logged in?
Yes
do you want to reply to a thread or open a new one
Open new
Thanks
nice
where can I vote?
did my part
?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!
ask
Excuse me again please, but can I write something from the phone?
public void spawn(UUID spawner, Location location){
this.spawner = spawner;
LivingEntity mob = (LivingEntity) location.getWorld().spawn(location, type.getEntityClass(), false, (m) -> {
m.getPersistentDataContainer().set(HypixelCustomMobs.getPlugin().getIsCustomKey(), PersistentDataType.INTEGER, 1);
m.getPersistentDataContainer().set(HypixelCustomMobs.getPlugin().getUuid(), PersistentDataType.STRING, uuid.toString());
m.setCustomName(name);
m.setCustomNameVisible(true);
((LivingEntity) m).setMaxHealth(health);
((LivingEntity) m).setHealth(health);
if(hasArmor) {
((LivingEntity) m).getEquipment().setBoots(boots);
((LivingEntity) m).getEquipment().setLeggings(leggings);
((LivingEntity) m).getEquipment().setChestplate(chestplate);
((LivingEntity) m).getEquipment().setHelmet(helmet);
((LivingEntity) m).getEquipment().setItemInMainHand(hand);
}
((LivingEntity) m).getAttribute(Attribute.GENERIC_MOVEMENT_SPEED).setBaseValue(speed);
});
if(hasBossBar) {
bossBar = Bukkit.createBossBar(name, BarColor.RED, BarStyle.SOLID);
bossBar.setVisible(true);
bossBar.setProgress(1.0);
bossBar.addPlayer(Bukkit.getPlayer(spawner));
}
uuid = UUID.randomUUID();
HypixelCustomMobs.getPlugin().getMobManager().addMob(uuid, this);
}
heres the new version.
why shouldn't you be allowed to write from your phone?
I can't find the button
Oh you mean on the forum
Okay...
Can eco armour custom sets have custom models? So it doesnt look like leather? There is this one server and i was wondering if its possible to get the custom models
alex sent you a screnshot
which subforum do you wanna post in? some forums are only for accounts with certain criteria (at least 30 posts, at least 8 week old account, stuff like that)
what's eco armour?
On forum about plugins
Like idk how to add custom models to that armour
Can you please upload the link?
yeah much better. but you could also just cast it only once. and if you don't need the "mob" variable later on, just do it like this:
location.getWorld().spawn(location, type.getEntityClass(), false, entity -> {
LivingEntity mob = (LivingEntity) entity;
// do stuff with mob
you could also cast type.getEntityClass, then you don't have to cast the entity itself
location.getWorld().spawn(location, (Class<? extends LivingEntity>) type.getEntityClass(), false, mob -> {
// do stuff with mob
is that a java development question, or a question about some specific plugin?
then you're on the wrong discord
isnt that axillors plugin
I think so
if i store the mob variable on a HashMap, will it change it's data?
yeah sure, the hashmap only stores a reference to the mob
that'd be a great feature
finally statements before super method would be allowed
pls add
it always annoyed me that I had to write all my logic into a method to be able to do stuff before super
wdym? will it change the health according to the health of the actual mob?
yoo
yea same, i always constructed private method that returns the same value
that's amazing
it's the same entity
it does not "change accordingly", it's the exact same thing
can i set a javadoc location in fleet?
Person mfnalex = new Person("mfnalex", 27);
Map<String, Person> peopleByName = new HashMap<>();
peopleByName.put("mfnalex", mfnalex);
// THe following lines are changing the SAME object
mfnalex.setAge(28);
peopleByName.get("mfnalex").setAge(28); // We already set this age in the line above
i mean if it gets damaged, will it get changed on the hashap?
the javadocs are supposed to be in your maven repo
the entity in the hashmap is the SAME object
ok
Objects are passed by references not by value so it will stay in field you will add synced more to say
try pressing shift twice, then enter "download documentation"
that's how it works in IntelliJ
ok
btw fleet sucks, why don't you just use IJ
objects in java are like pointers in c/cpp
they point to some data, not copy it the pointed data everytime you pass it
it eats my cpu
i made a server and i would like to make a simple chat, can i do it with intelji?:
i use eclipse normally
fleet was pretty useless last time I tried it, but that was months ago
i like the ui
you can make any plugin with intellij
intelliJ should be pretty resource-friendly if you disable the mcdev plugin
ofc you can, check the events in spigot api that execute whenever someone sends the message
then send it via the server back
no not plguin'
client-server
what exactly are you trying to do?
client - server - client
still doesnt explain it to me
yes. Tools -> Code with me -> send someone invite link -> type random stuff in a random file, others can write back
very useful
??
you want to talk to people in intellji?
- profit
on par with the documentation
wait you can do stuff before the super constructor? How? Init block?
lol
ehh yes??
why
i do it by creating a private method that returns the same object
and inside that private method you use preconditions
and if it throws the constructor fails
oh yeah that's possible
bossBar.setProgress(mob.getMaxHealth() / mob.getHealth());
will this show the mob's health on the bossbar?
I train to make all sorts of chat programs, etc., not in minecraft
reverse the order
I just liked the interaction between client and server
naaah more like...
won't work:
public static class MyClass {
public MyClass(String name) {
if(name == null) {
throw new IllegalArgumentException();
}
super(name); // won't work
}
}
works:
public static class MyClass {
public MyClass(String name) {
super(checkForNull(name)); // works
}
private static String checkForNull(String string) {
if(string == null) {
throw new IllegalArgumentException();
}
return string;
}
}
and yes, I know Objects.requireNonNull exists, it's just an example
yea that's what i do exactly
yeah it's just so much more readable, e.g. imagine you got a List<String> and wanna map it to a List<EntityType> and are forced to do it directly in the super() call
it's so stupid that it's not possible to just do this normally
that's actually dumb, yes. Should just lead to a compile time error if you try to set/read variables inside the class (since those don't exist before super)
Everything else would work just fine as your workaround shows
why is it easier to write client-server interaction (not in minecraft) than writing plugins!?
unfortunately I doubt it'll already be a normal feature in java 21
probably because you haven't understood how plugins work properly
is there any way to spawn baby skeletons?
this is a minecraft question idk if yhis is the right chat
Baby skeletons dont exist
ok ty
I think zombies are the only monsters that can be babies
i can only imagine how annoying those would be
Ikr
little cunts' runnin round shooting you
baby zombies are annoying already imagine baby skeletons 😂
nah unfortunately
Only slimes have variable size
unless you wish to use resource packs
then you can apply custom model data as a nbt tag
to apply it to baby zombie and then code it to act like a skeleton
Only for items
Custom model data doesn’t exist for entities:')
baby skeletons riding chickens
wha??
texture not exists for entity?
If you change the model of a mob it will be applied to all mobs of that type
So you can't have a blue and a red creeper
for items you can specify the id of entitymodeldata and it will apply the model that's mapped to the id inside the json file
i not can add customModelData?
previously before that people tend to use custom durability values that aren't accessible in vanilla to map to custom models (legacy versions from 1.9 iirc to up to 1.12)
for 1 for 2
No, not for entities
You can change the appearance of a creeper but all creepers will look like that after it
That's probably one of the worst limitations mojang gave us
but the more i think it the more i think that could be possible, but im not sure
iron golems recently got an update
where he cracks
maybe there's some kind of mechanism that handles model and texture data
how would that be possible without client mods?
according to the damage
but there client doesn't care about that
Well the client reacts to the damage
But you can't use that for other mobs obviously
to be honest, the bukkit api is somehow not a fully functioning api. Many restrictions
honestly i'm surprised why they havent added entity model mapping alongside item mapping
You might be able to have custom iron golems based on the damage. That does entirely depend on how the cracks are loaded clientside. Whether the original texture changes or it's an entirely new texture
its old
like what?
yeah pretty weird
what do you expect from 12 year old community api
wdym, it gets awesome new additions every other day
this math
what math
and then there's people still struggling with 1.8
yeah well that's their problem lol
complaining about missing features but refusing to update for 8 years
its amazing to think that people collaboratively developed an api for over a decade and continue to do so free of charge
exactly
many years have passed and until now it is impossible to get the biomes of the world directly
It is free of charge but they do get paid by donations and sponsors obviously
still
World#getBiome(int, int)
oh that's deprecated
get the BiomeProvider, then get the biome from there
bukkit api in the field of generation locations and so on is so-so
Api support for custom pathfinders would be neat
declaration: package: org.bukkit.generator, class: BiomeProvider
yeah it was a pain doing that in jefflib
Yes? Well, try to find all the biomes you need without coordinates
without coordinates?
yea
you can't really do that in NMS?
declaration: package: org.bukkit.generator, class: BiomeProvider
Just the basics like addGoal(Type.TARGET_ENTITY, EntityType.PLAYER) or something like that would be cool already
https://hub.jeff-media.com/javadocs/jefflib/com/jeff_media/jefflib/ai/goal/package-summary.html jefflib can do that
declaration: package: com.jeff_media.jefflib.ai.goal
I'm aware there's libs. And I've also done it with nms. Having that in spigot would be cool though
end how you get all locations in biom
all locations in biome?
declaration: package: com.jeff_media.jefflib.data, class: SimpleLocation
yea
why this class doesnt have any methods?
no clue what you mean with "all locations in biome"
lombok?
yeah lombok, shitty javadocs
lombok is fine for many things
Generate getters and setters in IDEs exist
all locations related to this biome
I did not know that lombok is not considered in javadocs
I know
also equals and compare
what would be the use case? btw there's an infinite amount of locations even between 0,0,0 and 0,0,1
i got rid of it because how pain in the ass is to setup it with libraries properly
TL;DR you cannot get a list of all locations inside a biome because there are infinite locations between every 2 locations X and Y where X != Y
well, for example, get all the blocks on the surface of the biome and create a dungeon there by checking the blocks for materials
the biome provider doesn't even store a list of all blocks inside a given biome. the biome is merely the result of some maths. you also won't find a way in NMS to get a list of all blocks that belong to a biome at a given location
https://hub.spigotmc.org/javadocs/spigot/org/bukkit/Chunk.html#getChunkSnapshot()
Does this create a chunk snapshot or does it already exist and it's just a getter?
declaration: package: org.bukkit, interface: Chunk
there is also no concept of "this is biome 1 and this is biome 2" if both are desert
the biome is also just like a noise map
it creates one
it's pretty fast though
Do you see any restrictions? Because of this, you have to suffer with the search for biomes for spawning structure
that is how world generation in minecraft works. it doesn't do things like "okay, let's place a desert biome here, and another one there"
it basically does "okay, let's throw in the x, y and z coordinates and see what
the result is: Okay, desert"
in the field of generation, interaction with locations there are big restrictions
I'm not using it at the moment, I was wondering about performance when using it in excessive events or per tick schedulers though
for example?
you can't even get vanilla structures
end this
shut up
not this
then pull request a feature for that
Do you see any restrictions? Because of this, you have to suffer with the search for biomes for spawning structure - this
oh btw you can get vanilla structures using AsyncStructureSpawnEvent
you claim it's a bukkit issue while it's just how minecraft itself works
How is that an async event? Isn't world generation sync?
lol what?
Well on a new map you could keep track of the structures by listening to that event
the structures are spawned in a future
no clue what you're talking about, that's the source code of craftbukkit
Also that is part of the api
oh I didnt even know that
it's not worldedit lol
why is there a bracket in the middle of the parameters? lol
fancyyyy I love it
lambda
oh lambda
true true
have you played HL 1 and 2?
No I did not. I only know the memes
Especially HL3 confirmed?!
Which is sad because I would love Portal 3
Gabe Newell is here to help announce all of your Dota 2 matches!
Subscribe to GameSpot Trailers! http://youtube.com/GameSpotTrailers?sub_confirmation=1
the javadocs have a search field
I only see the worldedit website
declaration: package: org.bukkit.event.world, class: AsyncStructureSpawnEvent
oh now i see
I will keep that "can only count to two" meme in mind lmao
but I still think the bukkit api has more restrictions on working with locations
and as fabsi mentioned, you can also locate structures easily from the World class
You are free to add features to the api
like, what?
If you have any suggestion, suggest it and someone might add it - or you do it yourself
as I said above, working with biomes
I have already explained to you that it's not possible
let me explain. biomes work like this:
public static Biome getBiomeAt(int x, int z) {
if(x % 3 == 0 && z % 4 == 0) return Biome.DESERT;
// etc.
}
There is no list of biomes, and a biome doesn't have any boundaries - they are just the result of some random math
even if 2 adjacent blocks have the same biome, are they actually THE SAME biome? no, a biome doesn't have a start or end
oh
that's just how world generation works in vanilla
Oh I didn't know that either. If it's just decided by modulo, how comes a biome is a large area and isn't totally mixed up?
incorrect
nah that was an example ofc
and the biome gets stored after it was generated
the way mc is designed a chunk generator is supposed to announce what biomes it will generate
yeah it gives a list of all "biomes I might create for this world"
but it's not possible to say "ok, there's a desert biome at 1,2,3 - now I want ALL blocks that belong to THIS desert"
there is no THIS desert, it's not like the world generator says "lets put a desert here, and a large one over there"
but more or less it's true, let's take a look at the vanilla biome provider for normal worlds, one sec
technically u can pull some veinminer shit and find all attached blocks with the same biome, but that would be a terrible idea performance wise
yes. but there's no way to basically say whether two adjacent deserts are one desert, or just two next to each other
it's just one desert though, there's no such thing as two connected deserts
Minecraft uses noise for Biomes (and for the rest of the world generation such as terrain)
A good video how Minecraft world generation works is this one:
https://youtu.be/CSa5O6knuwI
In the Caves & Cliffs update we radically changed Minecraft terrain generation, rewriting large parts of it from the ground up. This video summarizes how this actually works, how simple math and code can be used to generate interesting, beautiful, and dramatic terrain.
00:00 Intro
1:14 Size
3:11 Procedural terrain generation
8:47 Perlin noise
1...
the vanilla thing just generates a noise thingy, just like it does for mountains etc, and then says sth like "if val <= 0.1, it's desert, if <= 0.2, it's snow etc" Now it'll return 0.1 928571571 blocks away, is this now the same biome? People always think of a biome as "THIS biome" as in "THIS desert" but the vanilla way is just rolling a dice for every single block, more or less
And a longer talk from him:
https://youtu.be/ob3VwY4JyzE
The past year and a half I've worked almost full time with Minecraft world generation. We've radically changed how the world is generated, to enable dramatic new caves, massive mountains ranges and overall more natural-looking terrain.
In this talk we'll geek out on the gory details of this. How does Minecraft procedural world generation actual...
iirc it's some combination of temperature/humidity/continentalness/erosion/weirdness
it actually makes sense and is kinda cool mathematically
yeah something like that - what I just wanted to say is that, while biomes are generated, there's no way to differentiate between one desert and another
They did try to implement logic that certain biomes aren't next to each other though. So it's not completely random. For example you'll rarely find ice spikes next to a desert
(or maybe never, dunno how good their system works, it had issues in the past)
yeah sure, but still there is no way to differentiate between "this biome X" and "another biome X" and also no way of knowing "how large a certain biome actually is" without manually checking all adjacent blocks
so it's not something that bukkit's API misses, but just how vanilla works
Maybe having an uninterrupted desert counting as a single desert is fine
now what really truly sucks is the weird differentiation between bukkit and spigot-api
we add new things to bukkit all the time but sending action bar messages was moved to Player.spigot(), why lol
no clue lol
idk why but I read that as "target_cactus cannot be empty"
SyncStructureEvent can work if i delete world end ganarate again?
it gets called whenever a structure is generated
I initially thought that everything that was created by the player and not the world belongs to the structures
structures are naturally generated things - villages, desert temples, ocean monuments, etc
Damn, what a cool thing turns out to be documentation. I have never heard of this on the internet.
gotta read it all
I had to create custom structures because of this
and the plugin started to cost a lot
Greedy plugin
well, if you can’t get the location of the desired biome, how can you select it so that all the generation logic takes place there
Math
eh?
how undestand this?
understand what
And a map that maps values to a biome
More or less -
Are you talking about world generation?
psevdo
there's a function that takes in something (for biomes that is a lot of different values created by noise like humidity, etc) and outputs something (the biome for exactly this input)
Roughly speaking, take the formula from the game responsible for the generation of biomes?
that formula will help you not at all as you can already get the biome at a given location
I need to get a biome without a location, but I won't go through the for loop around the world lol)
Codec is Mojang's library to serialize and deserialize objects, e.g. read custom biomes from datapacks. It does not have anything directly to do with world generation.
simplified: there's a function that takes in x,y,z and outputs a biome for that
the world generator itself doesn't even know how large or small this biome is or going to be
it only calculates which biome a given location is that it was asked for
ok