#help-development
1 messages · Page 553 of 1
Do any of them use inventory.get holder
depends on what each of those is doing
Yeah... real talk my friend... do any of them use inventory.getHolder
we already discussed this
Have you make a ticket about getHolder?
Uhrm, no, but is it relevant?
I've asked around and @sullen marlin , the guy who added the snapshot functionality to getHolder can explain why it can't be fixed now
Then it's probably time to stop bring it it up
What's problem with it?
Nope. Other way around. Its up to us as devs to avoid it
I mean with holder
You've been bring it up for two days now, in unrelated context. It's becoming annoying.
It gets a snapshot every time its called on a tileentity.
Its reloading the god damn inventory every single time an on click event occurs
This future I do not accept it. As an error only becomes a mistake when you refuse to correct it
didnt we already had this
i just use null for the holder xD
now out of context for what
In investigation it is quite literally the reason custom.items are laggy so, if we as devs collectively strive to remove them from on click events and other very highly called events, the performance gains will be big.
thats not a realistic expectation
you've been talking about it for the past 12 hours straight
me who uses it do identify his menu
Oops lol
== is the correct way to identify
thought the title
not the title xD
i love abusing the title
... this is why we can't have nice things
to titles?
Moment ur using getHolder uve done the bad thing. Don't matter what u used it for
just use the title as identifier and fake another title with packets
they'll never know
it work up to the point where you change the title
now you made him mad
Since when did spigot dev help become toxic?
🤯
since you keep hammering the same thing
could ask you the same
you make yourself more important than you are
Only when someone is annoying enough to piss enough of the devs off
we know what you were trying to say and we understand, but repeating it is not going to solve anything
You've stated what the issue is, you even discussed it with md5, it's time to give up
same
🤫
cant we just patch inventories out of the game
Let me ask you this.
If you saw someone not using getters and setters. You'd tell em straight yeah?
See someone doing 50 if statements in a row.. ur gonna give em the heads up.
I've seen something spiggot ain't gonna fix in house and have legit said it's up to devs to fix their end.
So if I see someone walking it into their events... why am I the bad guy for telling em?
I'd tell them ONCE!
It was someone new...
who did not ask for it
yeah everyone blames on that
but no one really cares
its like a make fun of them and move on thing
Oh and you lot don't don't good practigcs in someone's code if they ask another question yeah?
one thing is java basics
nothing more nothing less
another thing is this obscure api that no one knows better about
We tell them once, posibly twice if they ignore us. We do not keep going on for two days
what if I'm using holders for inventories with 2 random items that don't have enough metadata to kill an elephant?
So we... shouldn't tell devs...
That seems ass backwards
If you actually SEE someone using the getHolder method, you are more than welcome to advise them
you arent listening, besides they didnt even mention any holder nor did they show code using it
thats like if I started to list every single thing you shouldnt do in your program
Look ur probably right, I saw a guy talking about using 9 listeners of the same type in a code with no losses, I jumped the gun.
We should start reminding people to stop and have a drink
you literally had a 2 hour discussion about cloning itemstacks
just chill out and realize it's not the end of the world
overcompensating
Wait this isn't that
and take a drink
thanks
Cipher legit man shut up.
I was goofy with it. You legit don't have to be an arsehole about it
butthurt
At least everyone else is telling me why I'm an idiot
damn i hit a nerve
he hates GodCipher 🙂
I love GodCipher don't worry you are loved friend
At this point yeah.
His very first comments to me were "ur sever is shit, profilers can be inaccurate, you don't know what ur talking about"
Been using this channel for what? 6 months, discussed stuff with a lot of yall.
And I'll say rn never had someone be so rude.
Maybe they are a nice guy but I personally feel he has jumped down my throat last few days
Aye its fair
I guess it's the shock of finding it an realising how much of a resource drain jt is. Sorry guys.
Raz did a goof
Who was it
Cipher
No long term grudge or anything, life's to short but imo, I just feel he has jumped down my throat hard last 2 days
Real
Yup
🙌
My honest reaction

Sorry md_5 please don't hurt me 🤣
Ok
template<typename t_element>
template<bool t_is_axis_const, typename t_iterator, typename t_const_iterator>
typename nonogram::Table<t_element>::Axis<t_is_axis_const, t_iterator, t_const_iterator>::iterator
nonogram::Table<t_element>::Axis<t_is_axis_const, t_iterator, t_const_iterator>::begin() const {
return {m_table, 0};
}
template<typename t_element>
template<bool t_is_axis_const, typename t_iterator, typename t_const_iterator>
typename nonogram::Table<t_element>::Axis<t_is_axis_const, t_iterator, t_const_iterator>::iterator
nonogram::Table<t_element>::Axis<t_is_axis_const, t_iterator, t_const_iterator>::end() const {
return {m_table, getSize()};
}
ah yes, very readable
EntitySpawnEvent maybe
or you can register one via NMS
iirc
back in the days you needed to open up NMS entity registries
to register your own custom mob with modified mob class
afaik
I'd suggest looking into mythic mobs as it's legit a sorta "someone else has already made a cracking api, might aswell use it"
...
Oh
create EntityRegistry class where you store entries of mobs you've spawned
if the registry contains one with that uuid
bam
its yours
EntitySpawnEvent or net.Minecraft.server
add an NBT tag
Just do EntitySpawnEvent then a switch case and make it a chance that it’s your custom mob
there is an NBT APi library
just use NBT lib
@quaint mantle
NBT is stored on the mob
if you get the entity of the same mob
no matter the event
nbt tag still persists
No
read its page
You can create an object of the mob
Then access it@later
https://docs.saucerswap.finance/ what is this
idk that's just a gif
huh
sounds like some kind of blockchain shit
modules
depends on what you are doing
if you do nothing specific and only api related its enough to use a lower spigot-api version
its fairly complex and you don;t seem too interested in learning
take the simpler route, check if the method you want to use exists
create your own utils method to see if the method you want is supported before using it
public class Supported {
/**
* Does Spigot support library loading (1.16.5+)
*
* @return true if supported.
*/
public static boolean hasLibraries() {
try {
// Doesn't exist before 1.16.5
PluginDescriptionFile.class.getMethod("getLibraries");
return true;
} catch (Exception ex) {
// Server too old to support getLibraries.
return false;
}
}
/**
* Does Spigot support Player.updateCommand() (1.14+?).
*
* @return true if supported.
*/
public static boolean hasUpdateCommand() {
try {
// Method only available post 1.14
Player.class.getMethod("updateCommands");
return true;
} catch (Exception ex) {
// Server too old to support updateCommands.
return false;
}
}
}```
switch :C
why no -> syntax?
ye
wouldnt work in lower java version
I don;t think lambdas in switches is supported in java 8
java 8 meh
im wondering, isnt it possible to have a java 19 source file and compile it to java 8?
ye
depends
i feel so free only having to support versions that I decide are cool 😄
How do you guys go with versioning your config.yml?
E.g. version 1.0.0 only has
Config:
example: true
And then with 1.1.0 you have
Config:
no-longer-example: false
something-else: 14
yeah java is backwards compatible
hmye forgot about that
"make sure to delete your config.yml"
i dont, I just tell users to save a backup and wipe the config
i have an enum with all config keys
but ye doesnt work with nested data
Well yeah I guess that's the easy route lol
same in most cases
i mean you could migrate the current config to the newer design
but for what
not your problem
because if I change the config its for a reason
yeah that will only add more 1 time use code
which is meh
Well mostly you would just add more keys to it
So you could have a config-version in the file and then add new keys based on the version
and with every update adjust them and so on
no thanks
users messing with config version 🙏
i cant be bothered to redo the comments though
straight to hell
exactly
thats essentially the "just delete your config" automated
and make them lose all their configuration 💀
nah they can also do somehting
im doing that for free so they can also go through hell to use it
I guess for my current project I'll still need some config versioning. Not for the config.yml itself but for some custom configs
for my future customers: this is obviously a joke
I nuke my custom configs since they arent supposed to be user editable directly
but only if I have breaking changes
which is pretty rare
Yeah mine aren't either but they still hold data that can be changed via GUIs
yeah same
So I kinda have to migrate instead of nuking
you gotta make sure to support migration from every version before
you have a list of changes since their version and run all of them
I use configurate and apply changes with transformations
I mean it's easy to achieve theoretically. I was just wondering if there's some best practice in spigot I'm not aware of
and then migrate1to2, migrate 2to3, migrate 3to4. If user uses an old version it runs through everything.
i somehow read that as transformations and vibrations
time to vibrate everyones configs
yeah I'll build something like that aswell
how do I turn off the weird ass looking symbols in intellij
++i vs i++
yeah no
i prefer ++i
you are wrong
how
yes
idk ++i is technically easier to compute. But it doesnt matter these days
requires a dlc
thanks mr googler
Might aswell start writing some code then
also is their a way to do auto imports in intellij
its kinda annoying having to do ctrl+f1 to import
when i use vsc I just press ctrl + shift + o which organized imports and imported un imported classes
bet im in my keymap
oh
its in settings
I don't see I blind
nvm
I unblind
oh now that I'm switching to idea I can finally use Kotshit
i mean Kotlin
"kotlin" is fine. the word shit is already in it if you read it in german
@quaint mantle doesn't this look so much better
lmao zacken on a hating spree
i hate theme too
also you are missing two spaces
C dev i see
Monokai for the win
i started using ++i too now because of c++ iterators
no this is a nice theme
everything is unused
they mean the keywords I think
but the blue is nice
I use that one. Which is the default dark theme of the new UI
I said I do
I'm so used to github copilot I decided to stop using it so I actually use my brain more
copilot is like "typing HEY THERE LETS TRY THIS"
thats exactly the reason i stopped using it
Lmao
There are pros and cons to stuff like that. Personally didn't like it.
its weird that the variables are blue and not the types
Yeah that I'd a bit odd. How many options are there?
imagine usin an ide
@see this#method or :: i forgot
Google your question before asking it:
https://www.google.com/
make a record xD
solution found https://www.jetbrains.com/help/idea/generating-code.html
ah yes

go to the java internals and disable reader mode 💀
go find out there
we sound like noobs that never write docs
uhm guys I really am starting to hate intellij rn
Execution failed for task ':test'.
> No tests found for given includes: [sh.miles.domainsiege.internal.TestLightChunk.testInRange](--tests filter)
* Try:
> Run with --stacktrace option to get the stack trace.
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights.
``` I can't do anything 😭
this looks okay
wtf why why won't it test
hating gradle yes
How is that intellijs fault
why red? Looks like there's issues
If you’re using maven or gradle then that’s the thing causing the issue
it works on VSC just fine? so I'd assume my setup is fine
Huh
thats what my teacher said
is it supposed to work like that 🤔
atleast use Arrays.asList instead of a stream, cmon
I mean ./gradlew clean test worked fine, but uhh it should be failing the method doesn't work
straight to hell
was looking at mapping changes for nms 1.17.1 aaand
That’s really weird
seems to be the case for all versions
While I do love streams, if you don’t need to map or filter and just need to foreach then Arrays.forEach will be faster
i dont believe, Arrays.asList simply assigns the array to a field
Oh nvm
write a for loop 💀
they will especially introduce Arrays.forEach for you
you are an issue
God being toxic again
imagine using this outside the constrcuctor
That’s so weird
okay even weirder it fails again if I specifically target the class
Execution failed for task ':test'.
> No tests found for given includes: [sh.miles.domainsiege.internal.TestLightChunk](--tests filter)
* Try:
> Run with --stacktrace option to get the stack trace.
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights.
* Get more help at https://help.gradle.org
gradle test --tests sh.miles.domainsiege.internal.TestLightChunk
It’s slightly different but super helpful
no like code usage
screenshare "ohh there is so much wrong in your code"
please someone help, i've created a customZombie using NMSv1_16_R3 i added PathfinderGoalNearestAttackableTarget to attack nearby LivingEntity. Everything working normally until when i restart server the old zombie not attack other mob only the new i spawn still have this pathfinder, how to fix it?
someone help please
That's not too bad
for who wants to read https://mail.openjdk.org/pipermail/valhalla-spec-observers/2023-May/002243.html
I would condense the enchant/enchantments into just enchant(Enchantment...)
tldr ?
In the new design document released by the Valhalla team on 31/05/2023, it seems like they've finally found a way to get rid of that .val and .ref syntax that wasn't that great. They also talk about non-nullable types, with the current idea to use ! to indicate non-nullable, e.g. Object! means non-null. They're also looking at explicitly nullable types, those required in generics, being represented with ?, e.g. Object?. They're also adding implicit constructors for primitive classes, so you'll be able to initialize them without specifying a value, and it'll use a zero default representation, just like how integers do.```
not my conclusion
Oh that sounds like a big progress!
later negative only ints: int:(
positive only int: int:)
unsigned int when
anyone know how to blind the "social interaction screen" that comes out when you "press p" with Minecraft plugin? I can't find this code
What do you mean "blind"
Like not show any players in there ?
what social interaction screen
I would guess it's the one where you can block players and also report them.
wait you can block players
those probably are clientside
since theres no reason to send them serverside
but i may be wrong
I do think you are correct
alright do u know btw how can i playsound on mining block ?
because event gets called probably once a time
try using interact event
playing sounds like this is possible im pretty sure
i tried
but i dont remember how
do u mean playinterect event and leftclick block ?
yea
i tried
works like interactevent
declaration: package: org.bukkit.event.player, class: PlayerAnimationEvent
this should call when player swings his hand
but you need to somehow track the block breaking state
start when the player begins mining (interact/damage), and repeat at a set interval. Stop if it breaks or you get a BlockDamageAbortEvent
or on animation
i try anim
it took a few hours of setup but this is the first time i've coded with intellij and not uninstalled it within an hour
with what were you coding before
used VSC
no vim
I don't like vim
I use nano for command line editing
gotta go before the vim users get here
can i control enchanting table with spigotapi ? i mean lapis slot and enchant slots item slots
@EventHandler
private void onEvent(PrepareAnvilEvent event) {
AnvilInventory inventory = event.getInventory();
if (inventory.getItem(1) == null || inventory.getItem(0) == null) {
return;
}
if (!plugin.getBackpackManager().isBackpack(inventory.getItem(0))) {
return;
}
ItemStack backpack = inventory.getItem(0);
int size = plugin.getBackpackManager().getBackpackSize(backpack);
int modelData = getCustomModelDataForSmallBackpack(inventory.getItem(1).getType());
if (modelData == -1) {
return;
}
ItemStack newBackpack = ItemStackEditor.of(backpack.clone())
.setCustomModelData(modelData)
.finish();
event.setResult(newBackpack);
inventory.setRepairCost(1);
}```
Why item is created and set to the slot but i can't taki it. When i click i just can't grab it.
i got something against that contains/ get idiom
When I unload a world or some chunks, the JVM doesn't garbage collect the memory. That means I see it is used yet trash. However, is it okay that we can safely use that memory whenever we need?
You dont decide when to use which part of the memory at all...
this isnt C
But in case it reaches the full memory
should probably figure out why the stuff isnt gced
then you have enough memory again because it crashed
because its not an anvil recipe
you just added the item to the inventory
could be wrong on this
If the memory limit is reached then the jvm will force a GC
But with the right jvm params you should never have to
worry about that. Take a look at aikars flags.
i love how aikars flag nearly let my raspberry pi start smoking
Why don't after unload a world or some chunks it releases the memory?
If you have a ton of memory then the jvm wont collect garbage as often
to save on cpu time
How can i place a fake item in the players inventory?
I tried
ServerPlayer craftPlayer = ((CraftPlayer) player).getHandle();
Packet<ClientGamePacketListener> itemPacket = new ClientboundContainerSetSlotPacket(craftPlayer.inventoryMenu.containerId, craftPlayer.inventoryMenu.incrementStateId(), defaultSlot, CraftItemStack.asNMSCopy(item));
sendPacket(player, itemPacket);
But no item appears. What am I doing wrong / how can you do it instead?
(The item is just a normal item like new ItemStack(Material.DIAMOND_BLOCK, 1), defaultSlot is just the integer 4 and sendPacket is my own packet sending function which works perfectly fine.)
I'm sorry for the late reply Sorry, I talked about making this UI invisible
if(ItemStacks.getEnchants(newItem).size() >= 1) {
event.setResult(newItem);
}```
but this code works
in other plugin of course
That's the point, why isn't Bukkit designed to ignore all references to that unloaded world/chunks?
a lot of stuff uses a weakref to the world
Do you have methods to accomplish this job? Or other way?
what are you even trying to say
that event was added after 1.16.5
int particleCount = 20;
double increment = (2 * Math.PI) / particleCount;
double radius = 1d;
double particleY = loc.getY() + 0.5d;
for (int i = 0; i < 20; i++) {
double angle = i * increment;
double x = loc.getX() + radius * Math.cos(angle);
double z = loc.getZ() + radius * Math.sin(angle);
Location pLoc = new Location(world, x, particleY, z);
world.spawnParticle(Particle.FLAME, pLoc, 1);
}
why are the particles flying off in random directions..?
use the spawn particle method you can pass doubles
pass zeros as it's a random vector
you did it wrong
world.spawnParticle(Particle.FLAME, pLoc, 1, 0d, 0d, 0d);
that?? cause it still happens
i may just be stupid lol
player.spawnParticle(Particle.FLAME, loc, 1, 0, 0, 0, 0)
oh PLAYER
4 zeros
okay thx
fucking legend. thank you.
Yeah, world is fine, it's just the 4th zero you need. That zero is the "extra" value, which for fire is speed
int is good enough, dont worry about your memory footprint
Hey man, reading can be hard sometimes
a neet in shorts. Horrifying image.
can you please voicemessage this for me
noone knows how to do it? :(
I tried using getStateId() instead of incrementState(), but that didnt help either
@eternal oxide how can i check block abort event in 1.16.5 ? bcs blockabort added after 1.16.5
you can't
oke but how can i add slow-digging effect when player block mining ?
or can i loop block damage ?
bcs block damage only works 1 time
not possible with the API without the abort event
possible with protocollib ?
no idea
i try
Hello, is it possible to remove zombie's attacking speed? like I removed damage tick delay, so I can take damage each 1 ticks, but zombies doesn't attack once per tick. so i wanna change zombie to attack every 1 ticks
or just upgrade to latest ¯_(ツ)_/¯
myes i love manual memory management
bruh all that stuff just to achieve this
meanwhile java: setWindowTitle("Zoom: " + camera.zoom) 😢
i need do with runnable ?
go back to the main thread with the scheduler
Does anyone know how to modify the item in suspisous Sand and Gravel?
I´ve tried this code, but it does not work:
public class modifyArchaeology implements CommandExecutor {
@Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
if(!(sender instanceof Player)) return false;
Player p = (Player) sender;
ItemStack sand = new ItemStack(Material.SUSPICIOUS_GRAVEL);
BlockStateMeta sandMeta = (BlockStateMeta) sand.getItemMeta();
BrushableBlock blockState = (BrushableBlock) sandMeta.getBlockState();
blockState.setItem(p.getInventory().getItemInMainHand());
sandMeta.setBlockState(blockState);
sand.setItemMeta(sandMeta);
p.getInventory().addItem(sand);
Bukkit.getLogger().info(blockState.getItem().getType().toString());
return true;
}
}
Tf is this Delphi?
I think you are casting it to the wrong item meta
it does not throw an exception
nvm, looks like it's correct
odin
You never updated the state
Oh, wait, this is meta
This code works perfectly fine for me
Copy/pasted it into my test plugin and it works as expected
Anyone know how i can fix this?
[INFO] Building Spigot-API 1.20-R0.1-SNAPSHOT [1/3]
[INFO] --------------------------------[ jar ]---------------------------------
[WARNING] The POM for org.apache.maven.plugins:maven-jar-plugin:jar:3.3.0 is missing, no dependency information available
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Summary:
[INFO]
[INFO] Spigot-API 1.20-R0.1-SNAPSHOT ...................... FAILURE [ 0.135 s]
[INFO] Spigot-Parent dev-SNAPSHOT ......................... SKIPPED
[INFO] Spigot 1.20-R0.1-SNAPSHOT .......................... SKIPPED
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 0.256 s
[INFO] Finished at: 2023-06-09T16:43:04+01:00
[INFO] ------------------------------------------------------------------------
Hello! Is there any way to get a list of all naturally generated block ids out of spigot source code?
Trying to build the new jar with Build Tools
There is a way to erase all updates in config file and put the defaultConfig ?
saveResource(path, true)
And how I load it into the config.yml?
reloadConfig()
package fr.program;
import fr.program.cmds.PartieCMD;
import org.bukkit.plugin.java.JavaPlugin;
public class Main extends JavaPlugin {
@Override
public void onEnable() {
System.out.println("[LOUP GAROU] Enabled.");
this.saveDefaultConfig();
this.saveResource("compos_jeu.roles", true);
this.saveResource("compos_jeu.nb_roles", true);
this.getCommand("partie").setExecutor(new PartieCMD(this));
}
@Override
public void onDisable() {
System.out.println("[LOUP GAROU] Disabled.");
}
}
Like this?
???
Well ignore it, I found a problem :(.
Just question, how I add and remove with .set in my config.yml if it's a List<String> ?
Is it the good way to get the curent list and add to it the string? 🤔
Question is how often do you update the list
To retrieve a list use Config#getStringList with key as parameter
To set the list just use the Config#set method you know
Just to start a game, basically players say play it and then it starts and then it doesn't move.
well, thats weird, tested it again , now it also works for me
List<String> currentList = plugin.getConfig().getStringList("partie.joueurs");
if (mode == "add") {
currentList.add(target.getName());
plugin.getConfig().set("partie.joueurs", currentList);
} else if (mode == "remove") {
currentList.remove(target.getName());
plugin.getConfig().set("partie.joueurs", currentList);
}
Keep the list in memory with all the players, and save it once
May have just had an older version of your plugin uploaded that didn't have this snippet
But careful with String list
Players are referred by UID and not Playernames
Playernames aren't a key
I know but it's to play with friends 🙂 so it's not very a problem.
how do you guys come up with ideas for projects?
block Ids?
those are long gone
what version are you working with
I don't know what is the correct term for those
Material names?
why does my plugin just not work if i try to use it in a different version
like it just wont work at all, doesnt even show up
public final Map<UUID, Collection<PotionEffect>> playerActivePotionEffects = new HashMap<>();
public void saveData() {
playerActivePotionEffects.keySet().forEach(uuid -> plugin.getConfig().set("data." + uuid, playerActivePotionEffects.get(uuid)));
}
public void loadData() {
plugin.getConfig().getConfigurationSection("data").getKeys(false).forEach(uuid -> playerActivePotionEffects.put(uuid, plugin.getConfig().get("data." + uuid)));
}
Something to ask, on the loadData i need to load all the potion effect as Collection<PotionEffect> but i can only pass it as object what can i do to re translate it to collection or how can i change the code to load and save?
Set<Material> blocks = Arrays.stream(Material.values()).filter((m) -> m.isBlock()).collect(Collectors.toSet());
``` should work
It's fine then ! 🙂
Won't this just give the set of all blocks?
yeah isn't that what you want
No
Just do you know how can I do a timer like: "1", "2", "3", "start!" ?
runTimerTask but if I remember it's deprecated.
you'd have to check https://hub.spigotmc.org/javadocs/spigot/org/bukkit/Tag.html
otherwise you'll have to compile a list yourself
declaration: package: org.bukkit, interface: Tag
For example, a block of diamond never generates naturally, so it shouldn't be on the list
you could also dig in NMS maybe to see if you could find a list internally in the world generator
Yes, that's what I was trying to do
I just don't understand where to look
And that's what I initially asked
Anything and Everything WorldGenerator so whatever spigot implements as BiomeProvider, Biomes etc
what addon are you using or theme?
gruvbox_dark_soft
intellij?
How I give a potion effect for an undetermined duration?
PotionEffect effect = new PotionEffect(PotionEffectType.BLINDNESS, 20*300, 10); // 20ticks -> 1s
undetermined as in infinite?
Yeah.
Alr thx.
Yeah, depends on your version
Modern versions, use the constant (for the sake of readability). Versions before 1.19.4 you would use the max value
Did you ask a dumb question?
I mean tbf, you did format your post strangely with colours where most would use inline code, created a resource that we see at least once every few months, and didn't open source it.
I'd be hard on it too lol
Because it's a developer resource. It's meant for developers to use but you failed to provide any Javadocs or source code, two things that developers tend to want to have when using a library
Definitely possible to do. Presumably (hopefuly!) you're using submodules for each version. GitHub can handle those. VeinMiner has 4 separate projects in one repo https://github.com/2008Choco/VeinMiner/
Submodules are just folders of separate projects nested inside your parent project
Perhaps documented, but no hosted/browsable Javadocs
Especially if the dependency on the repo doesn't have a Javadoc jar. The docs aren't retained at compile time
(I don't know if it doesn't have that, just figured I'd mention it)
Ah well there you go. Those should definitely be included in the thread
Though that aside, other two points still stand. The formatting is very far from what's expected. Flashy colours are often avoided because they're less readable and more abrupt to the reader. Like I mentioned, [ICODE] blocks are useful in situations where you want to highlight a method, class name, or some other small code snippet.
& it is a very common resource for people to make. If you search the forums for "ItemBuilder" you'll find dozens
No no, keep the thread up. Alternatives are always a good thing 🙂
It's just why you're seeing a little more heat is all
Some people may prefer your resource over others. I'm certain of it
I would just say try to standardize the colouring a little bit (use ICODE blocks instead), include the Javadocs if possible, and your thread's good
how do i set whether a button is clicked or not?
The way it's sectioned off is good though
There's a Button BlockData implementation which includes isActivated() iirc
e.g. [ICODE]ItemBuilder[/ICODE]
It's the equivalent of `` inline code in Markdown
Well anywhere you have orange can be replaced with an ICODE
Your of's for example can just be [ICODE]of(...)[/ICODE]
Should clean things up substantially 🙂
i could only find org.bukkit.material.Button which is deprecated
oh okay, thanks
how could you lie choco
I THOUGHT IT WAS BUTTON!
you're a button
I blame the one who made that api
Well originally buttons weren't switches
but then again, its probabkly reused for the lever
Also, the method isn't even isPowered(). It's isActivated()
I'm just stoopid
So really I told you a whole bunch of lies
Yeah that's probably fine
bro can u give me a idea ? i wanna give slow diggings effect when block damaging but else i wanna remove potion effect
can i do this on 1.16.5 ?
bcs blockdamageabort event isnt work 1.16.5
blockdamageevent only works for first damage
how do i this ?
thats why we now have the abort event
Why are you stuck with 1.16.5?
for trade
what?
my customers are playing in that version
You are being paid to write this for 1.16.5?
😄 no
for server, customers = players
cant say ive ever heard that
The brains of people living in my country don't work like that.
server owner decides version
just update to a version which has a workign API you can use properly
alright i think something
spigot have 1.20 ?
oke
player move event can check player head moves ?
Me at 4am: what?
I mean time and being awake do not have to be corelated
yes
how do I do text component things for the new .lore() on items and for the Bukkit.createInventory()'s component title? I dont know how to do a component string thing
I don't think you are in the right place
the component lovers are paper
paper is a fork of spigot smh
completely different api mate
Exactly
whatever I can still use strings
is there an event called when you pick an entity in creative with middle mouse button?
probably pickblock or someting
description: z[idfunbx[dofiggibn[xdf0gigbns[0ifdbs[0gkbn[0girinb||||}{LNBHAS{UNRFBP[FAB
nvm, you cant
ah that's too bad
public void deleteHologramsY(@NotNull Location l) {
for (int y = 0; y <= 255; y++) {
for (org.bukkit.entity.Entity entity : l.getWorld().getEntitiesByClass(ArmorStand.class)) {
if (entity.getLocation().getBlockY() == y) {
entity.remove();
}
}
}
}
Why does this remove entities around it?
around what
idk what you were trying do to, but looping through y probably wasnt the solution xD
looping through y is also a very inefficient way of doing that
if that was even what you wanted to do
nah i forgot to check that the x and z values
what is the better way
rn for every block below a y level
you get every entity
so you are getting every block and looping through them potentially 255 times
kinda a problem there
maybe first explain what you are trying to do
ok i got the solution
instead loop through the entities
im gonna get the blocks Y and just check 1 block up per 3 armorstand
then check if y < l.getBlockY()
public void deleteHologramsY(Location l) {
for (org.bukkit.entity.Entity entity : l.getWorld().getEntitiesByClass(ArmorStand.class)) {
if (entity.getLocation().getBlockY() < l.getBlockY()) {
entity.remove();
}
}
}
less looping
why does this work
public void deleteHologramsY(@NotNull Location l) {
for (int y = 0; y <= 255; y++) {
for (org.bukkit.entity.Entity entity : l.getWorld().getEntitiesByClass(ArmorStand.class)) {
if (entity.getLocation().getBlockY() == y && entity.getLocation().getX() == l.getX() && entity.getLocation().getZ() == l.getZ()) {
entity.remove();
}
}
}
}
and this doesnt
public void deleteHologramsY(@NotNull Location l) {
for (int y = 0; y <= 255; y++) {
for (org.bukkit.entity.Entity entity : l.getWorld().getEntitiesByClass(ArmorStand.class)) {
if (entity.getLocation().getBlockY() == y) {
entity.remove();
}
}
}
}
it is just checking shit
does getStringList consider [] as a list?
wait i cba to type man
yes
you making a public plugin?
this worked but if the hologram is too tall, it missed some armorstand
i will fix it
no
then why are you using annotations?
EntitySpawnEvent
ok but at leas the code is way more efficient
using those annotations just hides problems and doesn't guarantee something not being null as well XD
and most of those are for making API's
not implementation details
if you are going to do holograms, just save all uuids of teh armor stands involved in the hologram
because its good practice?
its not
then remove them when trying to remove the hologram itself
yes it is what..
show me where in the java standards it says to use annotations
definetaly some extra points if you do
you could say that for so many things
show me where in the java standard does is say anything about good practise
if its "not in the standards" just dont put any annotations
just never annotate anything
ever
thas just u lil bro
cmon
then thats your choice
ide annotations are not bad
they literally warn you when you input something as null
if api doesnt want you to
other people like having it warn them if they feed a null value into a value that shouldnt be nullable
if someone else fucks that up even with warnings then you could say its their fault
if its poorly documented its your fault
not sure why you refer to me as lil bro but whatever, you obviously haven't helped here long enough to see how annotations hide the real problems when someone encounters problems and its the annotations preventing certain errors from being thrown
also you can exclude runtime checks for all sorts of problems
he lil bro'd you
@Nonnull @Nullable dont hurt anyone
because IDE would warn you before compile time
How can i switch my spigot project over to paper?
i dont see why annotations are wrong
_NotNull_
spigot plugins work on paper
Ok
or are you trying to switch to paper api?
Did you check the type? EntitySpawnEvent#getEntityType()?
yes exactly
I never said they were wrong, I just said its not good practice like someone claimed. If you want to use it go for it, but to assume that its some kind of standard though would be incorrect.
exactly how are you arguining annotations are bad
You should ask that on the Paper Discord, i dont think Spigot Discord will be happy to help u with that xD
@Nonnull @Nullable imo only help
you ever seen when a value is null when you stated that it can't be ?
then what
error
it wouldve errored anyway??
the annotation hides the fact of what is null or even why because you said it couldn't be
there is plenty of objects that you can't guarantee as not null
it will still error
just because you used the annotation to say it isn't doesn't mean it never could be
you can still read stacktrace
the stacktrace for annotation error is called trap
Well originially i just wanted to check for when a player trades with a villager for a specific item and i found paper has an event for that
and if someone feeds a null into a @nonnull its not your fault anymore
not NPE
whats their invite?
but do tell me though how a trap exception is the same as a null pointer exception 😉
Really 🤯
can't send it in here ofcourse xD
i'll dm u
i can tell you it should detect it compile time
Does the same hold true for the CreatureSpawnEvent()?
I can tell you this is in fact not always true
the point of annotations is just to warn devs
if a dev decides to send a possibly null value
into a nonnull
thats their fault
sometimes it isn't the dev that does it
youve done what you can to properly document that it shouldnt be done
bruh is it that strict in here?
When im setting a UUID into my yml it puts this infront. Could someone tell me why and how I should proceed about fixing it? It kinda breaks my plugin so. (Looking to never get the !!java.util.UUID)
seller: !!java.util.UUID '751a9ab3-2822-48c4-b42c-3a1ab082f971'
the dev shouldnt allow for users to pass in a null value
this only works for stuff you create, not stuff you depend on
UUID#toString()
yet again on them
did you use the toString method
again, this only works for stuff you create, not stuff you depend on
you don'tt control the code of what you are depending on
or when or how something in there is or is not null
so, that being said if you took an object from something you depend on, put it in a method you stated couldn't be null
Did not. Obvious mistake. Thank you.
non null types when
then thats yet again your fault
bad implementations arent the fault of the dependency
sure but that doesn't argue the point of what I am saying
ok so we agree
no
not sure where you got that
anyways, when an object is null, and you used the annotations to state that it isn't or can't be
Np
the exception thrown is called trap, however trap exception isn't just for null stuff
so it isn't the same as NPE
also trap exceptions are one of the least informative exceptions as well
trap as in failed assertion?
we agree that if someone writes bad code on top of a dependency thats their fault
im thinking about os interrupts now 🤔
thats all im arguing here
all im saying is that its better to have it documented then not documented, as long as its documented it well
if that is what you want to argue. Since that isn't what I am arguing I won't respond to it as it implies you never make a mistake or that you know all code in all your dependencies regardless of what those are
thats why you dont annotate unless you are sure
@wet breach you're being a robot
but saying you cant pass a null value as a location for a method you literally just wrote
this entire argument started
with you acting like somehow
a obviously valid annotation was bad
obviously if that location was null there would be problems
anyways, if you are not making an api and your plugin isn't public, annotations are actually pointless unless you simply must be reminded to not do something? which a comment might have sufficed for such things
it would throw a trap exception before it was an NPE
yeah im making an api thats the api class
there would still be a problem
either way
the annotation just makes it so if you break it its your fault
anyways, since you can't objectively see my point I am going to stop trying to educate when you get trap exception its rather useless in telling you the problem
thats all im saying
no way mr devils advocate here is saying im not objectively seeing his point
public void doSomething(@NotNull String p) {
Bukkit.broadcastMessage(p);
}
so if this is null there will a trap exception?
it can break the other way around too
.
as long as its documented well
annotations is not documentation by itself
this is kinda usefule
idk man it shows in ide if you hover over the message
shout out to the ide
it shows in javadoc iirc
yeah
@wet breach
thats their fault for naming yourself notnull
@NonNull does, injects a null check
if used correctly yes they can do things, but they can also cause problems too
which apparently to everyone else that seems impossible
@wet breach
contracts are the best
okay so we agree. if used correctly they can do things
well yes, thats like any tool ever
if someone was to use that method and put a null value and ran it yes it would generate a trap exception because the method asserted that it could not be null
well it didnt
also i just noticed you used the same strategy for your new username frostalf xD
it just told me the regular error
what strategy?
he was disagreeing with this earlier so
adding a dot
i consider it progress
likely because the normal name was already in use
I was forced to
my current account has it taken
wdym
the usernames are also logins
I want my new username already
my login name is the username I wanted, but the system counts it as taken
oh
¯_(ツ)_/¯
I preferred the descriminators
I just want something easy and not miles184u47289294857282994
their excuses they made for removing them are literally none that I have encountered
you only have to remember 4 numbers lol
so it just seems the idiots of the world again just doing their dumb dumb stuff again
discord those lil bastards
not even unless someone was telling you in IRL their discord handle
what
I don't know your discriminator but yet I don't need it to message you right now
at what point would I need to know those 4 numbers?
i mean if you want to chat with people, just ask them for their name and num if thats what your trying to say
I am saying the only time those numbers are relevant are for telling people outside of discord
otherwise you just join the server they are part of, and just right click their name XD
myes
what.
still dont get it but whatever
source pls?
so now you have to remember unique usernames instead :/
not only that, it means that people are going back to adding numbers after their names
they will revert this
yeah, because not everyone wants their server subject to community server guidelines when their server isn't for the community
so there will be a lot of people who won't use it, and just use a bot to refresh their links for them
i remember the times discord wasnt that shitty 🥲
How can i enable/disable the end with the spigot api?
its not about opinions, its about people using it or not
if they don't get the numbers in regards to usage it will be reverted or removed or changed
what stuff?
its still the best we have
the only time you will get banned is if you don't abide by the api limits or attempt malicious things
otherwise make your own discord client
ye not really informed about that
mods have already spoken about that they are not seeking out those who use custom clients to ban them
they have quite a few pages about it
as well as disclosing the limits you have to abide by
how do i change the version of my spigotmc plugin? (im stupid lmao)
plugin.yml
on the page itself btw
oh
yeah lmao
you just put it as part of the plugin file name
oh wait just found it
every time i see an electron app i want to find an alternative 💀
its a piece of bloat shit
I have never seen a single electron app be better then a native one
better use webassembly or whatever that stuff is called
nor have I seen it being more optimal actually quite the opposite
yes
offtopic lmao
nobody cares
I made custom mob spawns and /kill @e doesnt kill them, they don't count as entities? Is there a way to kill them with a command
yes and has like 6 processes with 4 of them being useless and 2 of them actually doing anything
and because of that, it consumes anywhere between 200mb-1gb of ram because why not lmao
js not really a fun thing
I had it consume 3gb yesterday
lets make our own client lmao
the only downside of your own client
well definitly been worse before
is that the rate limit is lower then the vanilla discord client
ah smh
that is, vanilla client has preferential treatment in regards to the API
stuff like this would get people's accounts banned if they used the client
the mods have said as long as the client abides by the rules, people who use it are not at risk for being banned
is discord just http requests tho?
yes
that is why the vanilla discord client using upwards of 3GB is quite dumb when its just a bunch of rest api stuff
Tell me about it.
ye welcome to electron
also, you are not allowed to implement all features from the vanilla client either
node_modules heeheehee
more specifically, the nitro stuff
like those themes and stuff? just use custom css
or some other styling if you dont use electron
im quite happy with my theme
Hello, I have a problem with config detection. Namely, the issue is that it doesn't seem to read the config from the Main class.
package rpg.drop.main;
import org.bukkit.configuration.file.FileConfiguration;
import org.bukkit.plugin.java.JavaPlugin;
import rpg.drop.drop.Drop;
import rpg.drop.drop.Mobsdrop;
public class Main extends JavaPlugin {
FileConfiguration config = getConfig();
public static Main main;
public void onEnable() {
main = this;
config.addDefault("Anivoz", true);
getConfig().options().copyDefaults(true);
saveConfig();
getServer().getPluginManager().registerEvents(new Drop(), this);
getServer().getPluginManager().registerEvents(new Mobsdrop(), this);
}
public static Main getMain() {
return main;
}
}
if(entity instanceof Zombie) {
if(entity.getCustomName().equalsIgnoreCase("Test")) {
if(entity.getKiller() instanceof Player) {
Player k = entity.getKiller();
e.getDrops().clear();
if (executeWithChance(100))
{
k.sendMessage("§8§l[§e§lDROP§8] §7Cos wypadlo z tego potwora...");
if (plugin.getConfig().getBoolean(k.getName(), true))
{
k.sendMessage("Wpadlo do eq");
}
else {
e.getDrops().add(new ItemStack(Material.DIAMOND_BLOCK, 1));
}
}
}
}
}```
JAVA if (plugin.getConfig().getBoolean(k.getName(), true)) It doesn't detect it for me
I don't have errors, it just sort of doesn't detect the player's nickname in the config.
Config yml
could it be that the players name is not in the config?
does it actually trigger
Not possible, I have my nickname in the configuration and it does not activate this event, also it does not activate this event e.getdrops
Yes, it starts normally and creates a config
is there a way to add to an attribute? Like the item would already be set, have all the attributes, but if the item were to be upgraded, how could I add 5 to the damage attribute?
I was looking into the getAttribute, and its just kind of confusing me.
if you want to set the attack damage of a certain item, you could write a listener for EntityDamageByEntityEvent, then check that the entity doing the damage is a player, and that the item they are holding is the item you want to modify, then use event.setDamage() to set the damage
I'm thinking more of like actually modifying the weapon. Like I have this sword, that has a movement speed increase, and a smalled damage, only 3 hearts. I have an upgrade slate, that the player can drop on any weapon or armor piece, that will increase damage, by 5, and movement speed, by 2%. I just dont know how to add onto an attribute, instead of it creating a whole new one. becase right now, it just
+3 Attack damage
- 12 Attack damage
takes the original attack damage from the weapon which is an iron sword that has 7 attack damage, it adds 5 onto that, and makes a new attribute so it looks like that above. I think I was just creating a new attribute and adding it again, isntead of editing the one that was already made.
is there not a way to get a bukkit color using a string?
of coarse, you can use ChatColor.translateAlternateColorCodes('&', str) and you can use stuff like &c&lHello and it'll display red and in bold
how do i use my plugin with a different version of a spigot server?
does it use nms
no
Then depend on the oldest version you want to support
you just develop for the lowest version you want to support
i see
oh and set api-version to 1.13 in plugin.yml
how do you come up with project ideas?
walk around and write shit down on a notepad
their is an entire spigot thread on this
lemme see if I can find it
I have a giant txt file
ty
I haven't used a single idea on it though
I generally find a new idea before finishing the old project
How do you commit git stuff on intellij with the buttons
this UI is too different from VSC i'm panicking guys
I just use commands or Github desktop

