#help-development
1 messages ยท Page 2085 of 1
in fact most people do they just tell you to not use it
apart from some generous people
It's very rare that you find an essential really important everyday usage feature that exists in non legacy versions but not in legacy
ignoring BoundingBox
which you can replicate easily tbh
What does a non legacy version mean?
1.13+
Ah, is it also possible to just use the 1.18 library and if I don't use features that only exsits in non legacy version it will work?
damn
PDC?
look at the other half then
I believe PDC was introduced in like, 1.14
pdc is not really that good
ehh
abstraction of nbt
pdc is great
For my own server, Limestone, I plan on just supporting NBT as opposed to some abstraction like PDC.
gotta find the persistent data type I want
It doesn't find the dependency
and then make namespacedkeys for everything
Also wanna figure out some cross-version solution to packets :)
codemc is down T-T
;(
thats gonna be a pain ๐
I will figure it out somehow...
i wanna make a minecraft ide
I just have to analyze EVERY PROTOCOL VERSION and find some pattern.
no pointers from viaversion crew?
That works, thanks for the help!
Wdym?
Can i convert a string into a colour code? For instance the string is DARK_AQUA but it's a string and not a ChatColor
i'd imagine they have a list of stuff they use to get compatability to work
/runcode Bukkit.getPlayer("2Hex")?.invoke("setHealth").param("20"):nothing
would set 2Hex hp to 20 if it exists otherwise nothing
ChatColor.valueOf
Thanks
an ide made of signs
Lol
or like
C/S{Bukkit}M{getPlayer."2Hex"}M{setHealth."20"}
C/S static class
M method
. is input
oh god
so input to something
and V for variable
V{int x.1}
"." inputs something to the thing before it
or ..
outputs
No enum constant org.bukkit.ChatColor.DARK_CYAN
Is what i got from ChatColor.valueOf
V{Player hex..{C/S{Bukkit}M{getPlayer."2Hex"}}}
Player hex = Bukkit.getPlayer("2Hex");
looks like it doesnt exist then ๐
But... doesn't dark cyan exist?
oh wait
no
aqua
it doesnt
๐คฆ
LOL
yea u rlooking for dark_aqua
no
He does
Doing a check for this seems pretty useless if you can just catch the exception
True
or am i misunderstanding
why not catch NPE then :troll:
I'm gonna check to see if the config is a valid colour and if it isn't then throw a custom error that doesn't shutdown the plugin
i would just do a check, why throw an exception just to catch it
avoiding every "anti pattern" for the sake of it is pretty useless
control flow through exceptions becomes a problem with bigger methods
and multiple types of exceptions
I would get myself used to good practice though
theres no problem with a simple if check, but there CAN BE with a catch
the check really is not that simply
i would go with the safe one for the long term
oh right
or keep your Set somewhere
ig
didnt think about that
i doubt it matters in performance
but ig u dont wanna do that
I mean, depends on the enum
mhm
what about Material
Yeah
not always important to be O(N). ๐
The problem is that catching an exception for control flow is that it's the unintended solution to error-handling.
There's actually some overhead to be had with raising (throwing) and capturing (catching) an exception, as instantiating an exception is heavy. Although this is likely negated for exceptions like NullPointerException when the JVM raises the exception, due to it being raised in native.
Regardless, stacktrace operations are expensive, you want to avoid needlessly handling exceptions and only use them for exceptional situations, as the name suggests.
Furthermore, an if statement is less code than try/catch, lol.
Exceptions should not be used for error handling
actually
if you hit an error, it most likely is something that is going to be unrecoverable from so your application should crash and burn
And, yeah you should follow best practices at all times as the quality of your code matters, and consistency issues can arise from using both checks and catches for control flow.
Nope, there's a big differentiation here.
I mean flame java for not having a nice rust Result
bestsss, this is clearly the most appropriate solution. Throwing an exception to implement a type of exists() method is bad practice. While you may think that your implementation is more efficient due to it not looking O(n), it is in the underlying framework which is not visible. Also using try {} catch adds overhead. Plus, it's just not pretty.
Exception is just for exceptional situations, Error is for unrecoverable situations.
found in StackOverflow
Errors in Java are not Exception
public static HashSet<String> getEnums() {
HashSet<String> values = new HashSet<String>();
for (Choice c : Choice.values()) {
values.add(c.name());
}
return values;
}
Then you can just do: values.contains("your string") which returns true or false.```
seems to be best practice
At that point just use an index
And I use the term "error-handling" here to refer to any recoverable, exceptional situation that must be handled.
Having a hash set that only stores if the value exists
well that would be incorrect usage for java
I don't think there's an incorrect usage of that term, regardless of language :p
not like hashset doesn't use that
Errors in java are not Exceptions two completely different things.
they said use hashset if its a large enum
for instance OutOfMemoryError
otherwise use the enum
See I don't think "error-handling" should apply to handling of Error, regardless of what the name implies
You never should handle Error
nope you shouldn't
So I use it to refer to handling Exception or any similar thing like it
However most exceptions don't need to be handled either
For instance, error-handling can also be stuff like Optional
Since a null return usually implies something wrong
plugin.yml
(Although that's situational)
if you expect it to throw an exception probably should change your code. You shouldn't design code around catching exceptions whenever possible ๐
๐ฟ
I disagree, checked exceptions make catching exceptions a necessity, unless you want to propagate all the way outwards to main or whatever your entrypoint is.
Although actually...
Well, I have yet to see the industry standard change on that
You can't propagate an exception within the body of a lambda
You are required to catch it
Sure you can then propagate it as a RuntimeException but still stands that there's catching beforehand
yes you are required to catch an exception doesn't mean you have to do anything with it either
I also personally prefer catching exceptions in my entrypoint so I can properly log them.
(And that also allows me to handle closing my resources)
Well, you don't have to catch the exception to log them o.O
yeah not required to do that to log them
Still preferable :p
JVM already logs it
I can add additional context to the error
e.g. when it occurred
Like
"Error occurred during parsing of a response body" or smthn
(Although that would apply to catching elsewhere)
is there a way to set a param of a method to optional?
^either that or just pass null/Optional altho latter is considered an antipattern
Kotlin default parameters + nullable types ๐๐
mye thats pretty much Optional but better in every possible way

are you trying to change an existing param with reflection, or you just want to create a method that has optionals?
if an attribute is nullable, how do I register it ๐ค
nope hahaha
Then don't talk shit about Kotlin
โค๏ธ
If you can't speak the language, you can't point out why its bad
I dislike kotlin
I mean I kinda hate love kotlin
I did once make an annotation processor for optional params
That project is discontinued and buggy tho
(Lombok style, yes)

Lemme tell ya smthn
I mean it would be cool
Working with Javac APIs is fucking scarring
lol
but it's also the most fun thing I've ever done
I made a tool for reverse-engineering what code would be parsed as
That way I could figure out how to actually create AST trees
com.sun.tools.javac.tree.TreeMaker ๐
Theoretically
I could implement language-level nullable types with a compiler plugin
It would require modifying Javac's code through instrumentation :)
i wanna make
a machine learning algorithm
that generates
method and class and variable names
for you
based on your description
as well as an interface for it
but that sounds hard
nah i dont even know how to train it
LOL
i know 0 shit bout ML
Or else you'll get a lot of NamedDomainDuckFactoryInterfaceGeneratorAbstractFactorys
FactoryFactory sounds yummy
(hyperbole, Gradle only really goes as far as NamedDomainObjectContainer)
"No swearing" servers are retarded imo
The minimum age on Discord is 13 and any 13-year-old has heard the word fuck
Either from their parents, the internet, or their friends
There's also just not anything special about swears
and they def watched porn at least once
either by ads or googled it
same but it was hentai
which is anime porn basically
Lol
This is why you supervise your children's computer usage btw
Dang you were a lot smarter than me at that age then
That was how I learned how to remove history lol
lol
Later on I just used incognito :p
Firefox Focus ๐
still tho
i prefer arguing without swear words
what the fuck and stuff are ok
but not stuff like fuck you
Honestly swearin' is just part of my fuckin' vocabulary
Oh yeah I guess that's fair
If someone swears in a conversation I'm excited with
it ruins it for me tbh
I probably would never argue with them anymore
What I don't understand
Is how people can get angry at words that are designed to make them angry
Like slurs
Like you have the choice not to give slurs the power they have on you
This is why most common insults don't work on me
passive aggressive ๐
When people come up with an insult they're just like
irl i would beat them up as long as im not an adult
"How many instances of f*g can I put in one sentence?"
i dont care about insults but not in a conversation i care about
Instead of anything actually clever or demeaning
usually something about coding
You gotta get personal with that shit for it to hurt :p
I also have high expectations
for developers I talk with
thus it also disappoints me
sometimes doesnt when I know who im talking with though
Something that triggers me a bit though
is when multiple people agree with someone
that they know is wrong
but they like them more
Meanwhile, British people: "Why does this guy keep calling me a cigarette?"
LOL
we have that too
Ooh it's kinda like social nepotism
Yeah I would reasonably get pissed off about that
idk why people think i have a big ego then instantly hate me
some kids thought i had a big ego cuz i said i have experience with childish parents
(which i actually do)
dunno how thats a big ego
When my parents are casual and not being stern with me
They're kinda just teenagers
Like my mom just plays videogames all day basically lol
my parents are seriously sick in the head
Mine are actually p'great
Couldn't ask for better parents... but yeah that doesn't go for everyone
Lucky
Pretty much all of my friends have some issue with their family
You know what pisses me off?
after im 20 or 19 smth like dat
Feminists arguing we shouldn't like, celebrate Father's Day
Since "mothers work harder" :p
Exactly
Radical feminism is just sexism trying to disguise itself as a progressive movement
mothers have their thing to do as well as fathers
usually a father gets money for the family, the mother manages the house or works too if she wants to
This is why I only support egalitarianism and some men's rights movements (like intactivism)
and the father can also help with house work if he has time for it
and same goes for like R
Modern feminism is less about equality and more "getting more rights for women than men" (which they've successfully done)
I don't know what that means
elaborate
again, elaborate
this proves nothing and means nothing
feminism is good for men, men just aren't the primary focus
by my understanding radical feminism is feminism that focuses on the complete removal of gender roles from our culture
which is beneficial to men
gender roles are harmful to men as well as women
social development help
feminists are not trying to destroy men, gain an advantage over men, etc
I mean sure you'll find some who claim to be feminists who do that, but that's not what the ideology is about and it's certainly not the majority that act that way
modern day feminism is just that though
it is not
.-.
they've ruined the word "feminism"
Anyone who's been paying attention knows what the political climate is on issues like these
this is a perfect screenshot my god
and yet I don't see any evidence other than "some morons on social media said 'men are pigs' so now I'm raising the alarms"
yeah tiktok is just one source of where this sort of "feminism" inspires others
in your feminism is evil phase, are ya?
wait
No, most movements are just incredibly flawed.
lmao I had one of those too
nonono the idea of feminism is great
๐ค
show me an institution that has been corrupted by feminism and now disproportionately advantages women
We all did
I feel like trying to dumb down my argument by saying "Oh, you're just in your <blank> phase" is incredibly disrespectful to my opinions and is entirely ad hominem.
look, I'm trying to engage in a good faith discussion here
Actually I think I've seen one in the past
On my wall
guys we should hold this convo somewhere else
I don't remember it I'd have to find it
alright
I completely agree with Maow
It was a couple of years back
me too
feminism debate channel
good
Can the entity firing the InventoryClickEvent not be an instance of a player?
no
getWhoClicked returns an HumanEntity so no
Oh then I can cast it to Player and not worry that it would return an error?
I mean you could pretty much raise an AssertionError or sth if its not a Player
What's an AssertionError?
Well that an assertion is false
because as of now, and generally speaking the only entity instances that are of type HumanEntity are also of type Player
I mean mojang might change that in the distant future, but as of the present moment thats how it is
But if it's not every type of HumanEntity than couldn't it cause a problem?
well
if you somehow would encounter a HumanEntity that is not an instance of Player it ought to be some plugin doing funky stuff under the hood
Ahh I see, then if I want to be absolutely sure that it wouldn't cause an issue I will need to check for the instance
What does raising errors mean?
Try and Catch?
Ah I see, thanks for the help!
In the case of an assertion error, you don't throw that one
You have to assert a condition
assert (entity instanceof Player)
However I'd not really assert that because it is possible to change
Aren't those disabled by default?
Don't recall
yeah, I mean there are possibly better exception types to raise
Either way, I'd opt to instanceof return instead, especially now that you can variable it
if (!(entity instanceof Player player)) {
return;
}
// continue on with a player```
Or, if you can, just operate on a HumanEntity
There are some cases where you can. e.g. just sending a simple message
speaking of which, Choco right now only players are instances of HumanEntity, or am I wrong here?
Sorry if I'm asking a lot of questions but if I want to make an item that can't be thrown away from the inventory or deleted with creative, I would have to do that with several events right?
Or is there a better way I'm not aware of?
nope
yeah
InventoryClickEvent, another inv event and InventoryCreativeEvent
let me check the second one
InventoryDragEvent
The thing is, when I cancel the InventoryClickEvent after detecting the specific indestructible item it kind of creates a weird duplicate and then it disappears when I put the duplicate in my inventory
Yeah it's because of Creative, it has been an issue.
creative inventory is... welll.... interesting
at least how its handled
- very poorly per say
Ah
p.addPotionEffect(new PotionEffect(PotionEffectType.INCREASE_DAMAGE, 400, 2));
This would give the player strength 2 for 20 seconds, correct?
Strength 3 maybe?
I actually don't remember lol whether it's starts from 0 or 1 on the amplifier.
I am running into difficulties with firing an event when a player equips a player head as a helmet. The code below works in creative mode, but isn't reliable in survival.
public static void onInventoryClickEvent(InventoryClickEvent event) {
HumanEntity player = event.getWhoClicked();
ItemStack item = event.getCursor();
if (item.getItemMeta() != null) {
if (item.getType().equals(Material.PLAYER_HEAD) && ((event.getRawSlot() == 5 && event.isShiftClick() == false) || (event.isShiftClick() == true && event.getRawSlot() != 5))) {
player.addPotionEffect(new PotionEffect(PotionEffectType.FAST_DIGGING, 999999, 2));
} else {
player.removePotionEffect(PotionEffectType.FAST_DIGGING);
}
}
}
I think it starts at 0 for the amplifier.
Alr thanks
I want to check if the inventory clicked in the InventoryClickEvent is the player's inventory but this doesn't work
if(event.getWhoClicked().getInventory().equals(event.getInventory()))
Any idea why?
is there a way to change the friction of a block
and will it make the client want to kill itself or will it actually work
event.getInventory is not player's inventory
Oh wait
You can maybe do player.getOpenInventory.getBottomInventory
Use InventoryView
Yes I meant InventoryView
Research it out, I believe the bottom inventory is always the player's inventory so if the click happened on the bottom inventory, it would be a click in the player's inventory
Oh, how do I check if its on the bottom inventory?
.
Might not be exactly that, but you can figure it out... it's very similar to that.
I see, thanks!
Compare the bottom inventory with the clicked inventory
Maybe you can do like this too but compare it with InventoryClickEvent#getClickedInventory instead InventoryClickEvent#getInventory.
Because InventoryClickEvent#getInventory will return the primary inventory, which is the upper inventory according to javadocs.
somehow my plugin is trying to give 2k+ health to bees https://paste.md-5.net/avaparapis.cs
Maybe you need to cap value?
but why is it giving it 2k if a bee has like 4 health, it should only be 8
I don't know, you need to show me some code
i did
Oh I didn't see it, my bad.
lol
Can you show me the giveMobBuffs method?
private void giveMobBuffs(LivingEntity entity) {
entity.getAttribute(Attribute.GENERIC_MAX_HEALTH).setBaseValue(entity.getHealth() * 2);
entity.setHealth(entity.getHealth() * 2);
entity.getAttribute(Attribute.GENERIC_MOVEMENT_SPEED).setBaseValue(2);
entity.getAttribute(Attribute.GENERIC_KNOCKBACK_RESISTANCE).setBaseValue(999999999);
}
Presumably every time that same bee spawns, its health is doubled
wdym how does it spawn again tho
Looks like the bee above is going in and out of a beehive
ok
Also, @EventHandler(ignoreCancelled = true) btw, instead of checking if (!event.isCancelled()) yourself
btw is there like an internal clock or smth
that keeps track of time
cuz ik in some cases pressing f3 can show the time elapsed
how do i access that
It must be something to do with the World
oh ok
would that be in ticks, i asume?
lol watching people get bullied in the forums
bruh i have a plugin that spams lightning when it rains and it so annoying when every time im looking at forums my ears get blasted with lightning spam noises xD
make the item not lose count
i have code that runs when a wither's health reaches 300 (its max is 600) that is meant to trigger when it goes into its second phase, but for whatever reason, the code runs early before half health
any ideas?
theres probably an event for when a player's inventory changes, just listen to that and check if the pearl has infinity, then cancel it
probably use it in PlayerInteractEvent
then check if the item in main hand is a pearl enchanted with infinity
and if the event is a right click on air or a right click on block event
then do event.getPlayer().getInventory().getItemInMainHand.setAmount(event.getPlayer.getInventory().getItemInManHand().getAmount())
@quaint mantle
anyways can someone help
Maybe because the wither spawns at 300 health, you know the recharging thing
can someone help me figure out why this vector is kinda just shooting things up
Vector yeetvec = block.getLocation().toVector().subtract(event.getLocation().toVector()).multiply(10).normalize();
it just pops them straight up
and not even very far
past 10 speed they kinda just disappear into items
thats the full thing
(yes ik i subtracted the locations height, but thats because otherwise the blocks just shoot back into the ground)
guys i made an event but its not triggering
did u register it
++
increment
--
decrement
%
modulo
modulo
shutup

thats a dumb name anyways

should be called the remainder operator
#justiceformodulo
I think "remainder operator" is actually an interchangeable term
hey people
It would help explain it to newcomers ngl
what the f event is not working
public class JoinEvent implements Listener{
static ArrayList<ItemStack> kitItems = new ArrayList<>();
ItemStack sword = new ItemStack(Material.DIAMOND_SWORD);
ItemStack bow = new ItemStack(Material.BOW);
ItemStack arrows = new ItemStack(Material.ARROW);
ItemStack food = new ItemStack(Material.COOKED_BEEF);
KitManager kitManager = new KitManager();
@EventHandler
public void onJoin(PlayerJoinEvent e) {
e.getPlayer().sendMessage("a");
food.setAmount(16);
arrows.setAmount(32);
kitItems.add(sword);
kitItems.add(bow);
kitItems.add(arrows);
kitItems.add(food);
DefaultKit defaultKit = new DefaultKit("DefaultKit", kitItems);
Player p = e.getPlayer();
p.sendMessage("this is working");
kitManager.giveDefaultKit(p, defaultKit);
}
public static ArrayList<ItemStack> getKitItems() {
return kitItems;
}
}```
yes
is it being registered?
yes
that would be the only reason it doesnt work unless you get an error
getServer().getPluginManager().registerEvents(new JoinEvent(), this);
im getting an nonsense error
but modulo sounds cool
not wrong
?paste
remainder is more simple tho
send it :))
you have 2 copies of your plugin on your server
oh
1.7.9??????
what am I reading
im dealing with 1.7.9 spigot
I'm sorry to hear that
why do you add items to a list every time someone joins
its prolly for mods
i did it for just check if event works
sout gg
what
ah yes sorry i did it
so why is this going off before half health https://paste.md-5.net/pewirezicu.cs
oh for whatever reason it spawns with 545 instead of 600
that code is a mess yikes
how hard is it to toss a Entity entity = event.getEntity()
lol i just do that a lot srry
disgusting
Would be better to turn some of that into variable actually
also why does the wither bline straight for the ocean every time it spawns
mobspawning is off btw
is there an event for the growing of blocks like wheat and potatoes?
BlockGrowEvent doesnt include the other stuff
just wheat, sugar cane, cactus, watermelon, pumpkin, and turtle egg
no potatoes or anything
It should
My first spigotmc commit is going to be for putting a (this list is not exhaustive) at the bottom of the list
I have this as a config file:
server_selector:
- GRASS_BLOCK:
display_name: "&dSurvival"
server: "survival-2"
lore:
- &7Have some fun on a highly
- &7Customized survival server!
- FEATHER:
display_name: "&dSky Gens"
server: "skygen-3"
lore:
- &7Survive in a world in the
- &7sky with many generators!
how would i iterate through the list in this scenario and get each value in it?
Alright, thanks!
ye I think alternatively getList and then instanceof check and cast the elements to ConfigurationSection
I'm trying to create a chat formatter for my plugin using AsyncPlayerChatEvent, how would I format it using event.setFormat ?
How could I make my command only do actions on players in a certain radius from the person who executed it? Similar to vanilla selector @a[distance=..50]
declaration: package: org.bukkit, interface: Server
Well, wouldn't be entirely necessary. You can just use World#getNearbyEntities()
are there any explanations/examples of setFormat
The first is the display name, the second is the message
So, for instance, a format message may look like "<%s> %s"
Resulting in "<Choco> Hello world! This is my message"
ok and how could i edit that
You can't change what gets sent to the format, just how it's presented
You can change it to "%s: %s" for instance, which is Choco: Hello world! instead
but you can't add new format values or anything like that
yea ok
so thats why
when i used that
and people typed % in chat it fucked my plugin up
thanks choco
lol
Yep
ok how would i actually do that though
it automatically does it
setFormat("%s ยป %s")
Yes
Is this my sign to switch to netbeans?
You can do with it whatever you want so long as it's String#format()-compliant and accepts two strings
Running out of memory perhaps? You've got a lot of apps open there lol
and I've heard IJ is a memory hog as of late
Oh that's not on startup lol
yeah my poor pcs dying 24/7
:(
Eh
good gpu just dogwater cpu
I was running 32gb with my ryzen 3 3100
running 4 servers and 4 clients on it makes it almost 100% cpu usage lmao
eventually ill upgrade probably when i get paid hopefully
TBH I didn't notice a huge difference once I upgraded
@EventHandler
public void onMessage(AsyncPlayerChatEvent event) {
event.setFormat(""+ChatColor.DARK_AQUA+ChatColor.BOLD + "%s" + " " + ChatColor.DARK_GRAY + "ยป" + " " + ChatColor.GRAY + "%s");
}
I'm guessing this is very wrong @worldly ingot , i still don't really understand
ram and disk speed was the biggest difference
it will for me, i play rust a lot so that ram is really helpful
so thats all i'd have to do
Yep!
and not to mention running multiple mc instances on here takes almost all my ram
its amazing my pc wont crash lmao
You can concatenate some of those strings together but yeah looks good and would work fine
event.setFormat("" + ChatColor.DARK_AQUA + ChatColor.BOLD + "%s " + ChatColor.DARK_GRAY + "ยป " + ChatColor.GRAY + "%s");
Bear in mind though that the first %s is the player's display name, which might also be coloured
Not in a format
well its work nicely rn so thank you
Does anyone know how to make being above layer 60 give you a negative effect?
I have edited my config.yml for my plugin and then compiled and restarted the server, but the config.yml for the plugin on the server hasn't changed and doesn't include the new items i added fixed
any assembly dudes here
Can someone confirm that this is what i think it is?
.text:04339730 loc_4339730: ; CODE XREF: sub_4339710+3Aโj
.text:04339730 push ebx ; String2
.text:04339731 push ebp ; String1
.text:04339732 call __stricmp
.text:04339737 add esp, 8
.text:0433973A test eax, eax
.text:0433973C jz short loc_4339755 ; IF EBX == EBP THEN JUMP
.text:0433973E mov eax, [edi+14DCh]
.text:04339744 inc esi
.text:04339745 add ebx, 21h ; '!'
.text:04339748 cmp esi, eax
.text:0433974A jnz short loc_4339730
my brain conversion to c:
char* ebp, eax;
while (esi < eax) {
if (__stricmp(ebx, ebp) == 0) goto loc_4339755;
esi += 21;
}
you're probably best off asking somewhere like programmers hangout
most people here will be java or kotlin devs
Is there any way to get an Enum LootTables from a LootGenerateEvent?
what formula lol
lmao my man forgot how to add and subtract corners
Yes
Why when i compile my plugin after editing config.yml, when i restart the server it doesnt update config.yml
The code using the new config works as normal
but i cant edit it since its not there
in the config.yml in the plugins folder
So uhm, when using World#playEffect HUGE_EXPLOSION is it expected behavior for it to not break blocks (which is fine) but break entities like ITEM_FRAMES?
mvn clean then try again
how do i do that, im not good with maven im just using it on intellij
On the right side there is a maven tab. Inside it is mvn clean
oh nvm im retarded i see what was wrong
nope still not working
do you call saveDefaultConfig or something
@Override
public void onEnable() {
// Loading Plugin Config (config.yml)
getConfig().options().copyDefaults();
saveDefaultConfig();
// Commands
getCommand("map").setExecutor(new MapCommand());
getCommand("reloadmfp").setExecutor(new ReloadCommand());
// Listeners
getServer().getPluginManager().registerEvents(new Chat(), this);
getServer().getPluginManager().registerEvents(new JoinLeave(), this);
getServer().getPluginManager().registerEvents(new DurabilityDamage(), this);
Bukkit.getLogger().info(ChatColor.DARK_GREEN + this.getName() + " Enabled");
}```
here ^
yeah it's good enough
so why doesn't it work ๐
no
then why are you expecting it to magically update
it's a config, not a showcase file
ok but then how would u update a config.yml while saving it's values
addDefaults
and how would u add comments with that?
you don't
that seems like an issue tho
if i wanted to add a new feature to my plugin
so had a new section in my config.yml
i couldnt add comments
This could be helpful https://www.spigotmc.org/threads/configupdater-keep-comments-and-values.398466/
What is it
That's more of a question for #help-server
@quaint mantle #help-server
?paste
https://paste.md-5.net/apafukuvuf.cs how can i fix this
By teleporting the player to a not null location
tho that should have errored before ๐ค
actually, holy shit you are running 1.7.9 ๐
hes likely using 1.7 for modding purposes
People arent very willing to help 1.7 anymore as its an old version
But the error here is your variable named to is null, ie the Location you have is null when getting the world
racist ๐ก
more like versionist :p
If I want to check the item a players is holding and also that it will work on both 1.8 and 1.18
I have to use the deprecated method player.getItemInHand() right?
Yes, correct.
Also, I've noticed that the way you get the material of painted glass is different between the versions, so I would have to use a new api and just detect the version of the client?
I guess
or just use xmaterial or something
Oh thanks!
you would use a string identifier that can be changed dynamically
either fetched from config or from a command
if you are referring to the API then you have to look at placeholders API but not hard to have your own place holders either ๐
o.O
You will need to use PlayerInteractEvent
And check if they interacted with a block
How can I check if a player has punched another player? both in survival and creative
But that wouldn't work in creative as the player won't receive damage
When I googled, someone said he somehow did it with the PlayerAnimationEvent but I can't figure out how
At least not in an overcomplicated way
wdym?
don't necessarily need to ray trace
However, not sure why you would need to listen for when a player hits another player in creative lol
I'm creating a ban gui, and I want the user to be able to hit another player and then he would have the gui opened
listen to both PlayerInteractEvent and EntityDamagedByEntityEvent
It isn't going to necessarily be easy
mainly because what you are wanting isn't something that is inherently supported directly
if you use right click, it would be very easy xd
there is a lot of events that don't get fired from creative side
Hm, right click and left click on a player isn't detected by PlayerInteractEvent
that is the main problem
there is PlayerInteractEntityEvent for right clicking an entity
I did manage to get it to work in survival with the EntityDamagedByEntityEvent
or PlayerInteractAtEntityEvent
But this will only work with right click
Well you are just going to have to play around with the events lol
as I said not something entirely supported directly
I see
creative alone is finnicky
it gets hard when that game mode decides to not send information ๐
Yeah, it's a bit of a headache haha
forcing you to use rudimentary methods and hacks lol
and its not because the server doesn't support it, but the client just not sending appropriate information
basically yes, because in creative mode there is some things that stops getting sent to the server and certain behaviors are changed
It just has to do with how they designed the client and the server in where the server isn't always in complete control
well you can be relieved to know even for the most experienced it is a headache for them too ๐
Lore is a list of string, you just need to parse the String and then add them onto the lore
it is usually easier to just not support creative
then it is to support it lol
way too many problems with creative
just parse the string when you add a line into the list string for the lore
so many checks need to be in place and measures incorporated to prevent other types of stuff like giving items away etc
Minor criticism, doesn't matter all that much, but English doesn't use the inverted versions of the exclamation mark (ยก) or question mark (ยฟ)
this is the example on how to use papi api https://github.com/PlaceholderAPI/PlaceholderAPI/wiki/Hook-into-PlaceholderAPI#setting-placeholders-in-your-plugin
Nice catch lol
im trying to make /setspawncommand. Its working on join but when reloading server, the location is resetting. How can i provide it
i put it to arraylist but the list is setting too.
save whatever youre using to store it to a file in some way, and load it on server start
for example, you could do it using a YamlConfiguration
Lists contain heap-allocated memory, which is stored in RAM
(This applies to all instances btw)
so?
What?
Anyway
So basically RAM is never persistent
When the JVM shuts down, all memory is deallocated, therefore the state of the program is lost
Through saving things to files, which are persistent memory stored on the hard drive, you can have the state persist when the JVM shuts down, i.e. when the server closes.
yeah
^
use a database or some kind of data language
you can also serialize the list using ObjectOutputStream
Databases are good if you're handling a lot of data or need data to be accessible by multiple servers, like with networks.
Although
A bit complicated for a beginner
Note that it's not a good idea to always save to a file. RAM is used because it's basically immediate, while reading/writing a file has some overhead (unless you absolutely over-engineer the fuck out of your code)
Sorry if that was a bit to take in :p
In summary:
Save your shit to a file when the server closes
Does anyone here have experience with pushing from IntelliJ to github?
its rather buggy at times
Hi this is my code and i am onely landing in water and its a bad block
https://paste.md-5.net/gezolizuno.java
pls help
I think most people just use Git lol
'
your better off using Github Desktop
you're*
Yesterday they told me to use it in the browser hhaha
who tf told you that lmao
Thats gotta be the most aids thing to do
ew imagine pushing changes through the browser, god
Imagine using a GUI for git
Eww only cli
Hi I want my players not to end up in water but that's the only thing they end up in why?
https://paste.md-5.net/gezolizuno.java
pls help, tag me
Idk they said its easier cause intelliJ does most of it by it self
and now I have to push at least 3 times at the start of every project
bc I fuck something up
cant be bothered
i would rather click 2 buttons to commit than sit there and type shit out anytime i wanna make a commit
Desktop is a very poor app rn
how?
If it works it works
But anyway ... what branch do I push to?
I ended up using cli for most of the stuff I do
Ive used it for well over a year now and no bugs at all
master / main
It's not buggy just poor
Whichever one is available
idk what you mean by poor lol
i made that shit
but i failed
(main is the retarded thing Git decided to rename master to because apparently master is too closely tied to slavery)
(I absolutely love activism that achieves nothing positive and is just pointless)
GitHub uses master, GitHub desktop defaults to main
Okay because it pushes to master even though main is titled as default or smth
Wait rly lmao
World these days
I use IntelliJ to push commits, and I've never had any issues.
intellij git always bugs out for me idk why
Gitkraken is nice but too overwhelming for new users
Okay thank you all :)
They're too scared to offend people because god forbid some popular moron go and rant about how their VCS used a single innocuous word :p
"Master" is literally a fucking honorific lmao
Here
Tho GitHub defaults to master and git to main and it's cancer as fuck
You don't really see it anywhere anymore, but it does exist.
So yeah, pointless change done out of some bullshit social politics thing idfk
Just made me go "But why?" when I first saw it.
Why does programming go so far in politics
That is a fantastic question
Cmon we only make software
Every time programming and politics collide
HELL
BREAKS
LOOSE
I've seen it too many times
Like holy shit just keep your fucking politics out of our programming goddamn
ohyeah
github defaults to main these days
Ah, node-ipc?
Hey ima add file encryptor to my npm module because protest
Yes
And it happened before to colors i think
if i have a question regarding sipgot settings i can ask it here right?
Was funny seeing the maintainer of node-ipc go and close all the GitHub issues that called him out on his bullshit lol
Those idiots end their career in matter of seconds
Uhh that probably goes in #help-server
Yeah
thanks
God the best part is uhh
I first saw his project uhh
peace-not-war or smthn
Which I then traced back to node-ipc cuz of issues
Nah node-ipc is the wiper, peace-not-war is basically just spam
Some motherfucker make pull request to also encrypt polish and French people
But it was closed
Anyone who happens to be close to the area of Russia/Belarus
Without merging
Since geolocation is not perfect
Belarus is Russia
peace-not-war basically saves a file to the desktop of a computer
spouting some bullshit message about
you guessed it
"peace not war"
Then it was accidentally picked up as a dependency of a lot of major projects...
such as vue-cli
So yeah the main problem was just how it would save a file on every program run, if the file didn't exist
So basically it was kinda uhh
adware?
-ish?
It's illegal what he's done
Yeah
He said himself that FBI raided him
Really cracks me up though
"War is not the answer, no matter how bad it is. War brings tragedy and destruction, ..." wipes Russian computers
I don't even think it really affected anyone
There was an issue on node-ipc that suggested a human rights organization with a server stationed in Russia were actually affected by node-ipc
I'm not quite sure the validity of this statement
But I don't really have a reason not to believe them
Lemme see if I can find it...
I hope he faces consequences
Like computer ban or something at least
Ofc some organisations look into what he's done
I mean even if this isn't real
it does pose really shine some light on how shit this could've been had it been real
Anyway yeah node-ipc was some fun drama
And a perfect example of why programming and politics do not mesh well
@lavish hemlock i stored it but when im trying to teleport player its not triggering
Hi I want my players not to end up in water but that's the only thing they end up in why?
https://paste.md-5.net/gezolizuno.java
pls help, tag me
i stored players location to config. When im trying to reach it and teleport, its not triggering.
what can be the problem
@eternal needle
Wrong:
return !(bad_blocks.contains(below.getType())) || (block.getType().isSolid()) || (above.getType().isSolid());
Correct:
return !(bad_blocks.contains(below.getType()) || (block.getType().isSolid()) || (above.getType().isSolid()));
what fucked you up here is the way boolean operations work
I don, t see a difrence
Found it
:P
i don't now way but how do i still land in water?
have you changed the code as i suggested?
is it possible to declare an HashSet<HashSet<T>>[]?
(i know i can use list here but its supposed to be immutable, but also instanticed inside the code)
i did still land in water but is not often
@eternal needle try printing out to chat/console the type of below. Maybe there's a water type you missed
how about this: replace bad_blocks.contains with a !is_solid
yeah
HashSet<HashSet<Item>>[] array = new HashSet[]{...}; like this then?
well as i said above its immutable but generated in the code
but then i can't add blocks if i want after
its not generic
i can youst have it like that its fine
well and for other lbocks you can add another check later on if you really need to
tbh i have no clue why it wouldnt find all water
what i think is happening here is that the or is your problem
try inverting the statement
!bad_block_contains(below.getType()) && !block.getType().isSolid() && !above.getType().isSolid()
@eternal needle
ok testing it
World oww;
World nw;
World ew;
if ((oww = Bukkit.getWorld("NW_OverWorld")) != null) {
Bukkit.unloadWorld("NW_OverWorld", false);
deleteWorld(oww.getWorldFolder());
}
if ((nw = Bukkit.getWorld("NW_Nether")) != null) {
Bukkit.unloadWorld("NW_Nether", false);
deleteWorld(nw.getWorldFolder());
}
if ((ew = Bukkit.getWorld("NW_TheEnd")) != null) {
Bukkit.unloadWorld("NW_TheEnd", false);
deleteWorld(ew.getWorldFolder());
}
World nwOverWorld = new WorldCreator("NW_OverWorld")
.environment(World.Environment.NORMAL)
.createWorld();
World nwNether = new WorldCreator("NW_Nether")
.environment(World.Environment.NETHER)
.createWorld();
World nwTheEnd = new WorldCreator("NW_TheEnd")
.environment(World.Environment.THE_END)
.createWorld();
``` why doesn't this delete the worlds?
you sure it doesnt just recreated them
nope
they are just getting reloaded
if I join the world after the code ran, it remains the same world
not sure what deleteWorld method looks like
however, you need to unload the worlds to actually delete them
public void deleteWorld(File path) {
if(path.exists()) {
File[] files = path.listFiles();
assert files != null;
for (File file : files) {
if (file.isDirectory()) {
deleteWorld(file);
} else {
assert file.delete();
}
}
}
assert path.delete();
}
Bukkit#unloadWorld returns true
the only world you wouldn't be able to unload however
is the overworld
or the default world of the server
it isn't the default world
