#help-development
1 messages · Page 1964 of 1
yeah you have those good specs
But dont get sad, because every IDE consumes a lot
No matter if using Eclipse, Intellij Idea, Neatbeans, VS Code
currently my disk usage is only 3% so im good
you can run intellij on 16 gb ram fine as well
VS Code never caused lag for me
already told you what netbeans does
whether you choose to disable it or not is up to you
i'll just use Eclipse
if you want
no one here I think is telling you which to use. All I was doing was just telling you why netbeans was consuming your disk I/O when you were launching it
but Disk I/O is hardly a concern though unless you have a low end pc and trying to do a lot of things
my pc is low end
ChatColor#stripcColor("&eColored string") would would return the string without colors?
No
Oh lmao
Im in problems
Afaik it only strips the § colors
So you’d have to translate them first
Or make your own method
Because i have a custom item with colored name
And im saving the item with name non colored
So it always will tell me that the item doesnt exists
is there a plan to add comment support for config for older minecraft version in spigot api?
declaration: package: org.bukkit, enum: ChatColor
No
Spigot doesn’t support past versions
can run it through this method and then stripColor the resulting string, but this is generally counter intuitive since the color codes added are of your doing usually
You can do
Config:
key: "value" # write here
another-key: "another value" # another write
I mean through api...not manual 🙂
See my reply
Why?
i saw it...
spigot uses SnakeYaml. SnakeYaml is the lib that controls whether comments or not work. However people are also free to use whatever YAML Spec they want or lib.
There you go then
1.18 and above have comment support
1.17 and below don’t, and won’t be getting it
When i develop i create file.yml with the content inside and then using FileHandler class its being created the file with content i assigned, and can add/remove/get/etc
Move on or handle it yourself
Isnt better? Over having 10M of lines for setting values on config
why does setInvisible work before but not after
welp... was just asking...not requesting it..
?jd EntityDamageByEntityEvent
I responded with the necessary information
Does getEntity return different types between the two methods
Yes you did...thanks for the info..but the reply was for coll
Check and cast
then why does it work in creaturespawnevent
Tristan, you can read the javadocs
CreatureSpawnEvent returns a living entity
oh
Not for being mad/critice but imagine if documentation didnt exists, imagine the using apis it would be really hard to use them
lol
this is how it was in the old days
the API was just good enough
how do i make seconds into ticks? is it seconds * 0.5
20ticks = 1 second
Seconds * 20
yes
okay, what the fuck
Ah allright
1000ms = 1 second
What a crappy site
20 ticks = 1000 ms
its not even by mistake lol
they dont know math at all O.o
Yep
“This is possible because the functionality of the game is attained at a fixed rate of 20 ticks per second. This implies that one Minecraft tick will last for 0.5 seconds.”
They know it’s 20 tps
They just can’t do 1/20
maths is hard
its 12 times in the article wrong xD
Okay, and how many ticks are in a sqrt(N/kg/m)
2
"gaming tick"
Seriously, what the hell. This screams that the author has no idea about minecraft
alexito = mfalex
what
it is possible to add null objects to ByteArrayOutputStream, right?
what null objects and how adding?
how do i make an int into the period for scheduleSyncRepeatingTask with the L
yea
Probs long longvalue = (long) intvalue
long delay = (long) (time * 20L);
so, is it possible to add null objects to BukkitObjectOutputStream?
yes it is
Time conversions (seconds/minutes/hours/days/weeks/moths):
Miliseconds
1.000ms = 1s
60.000ms = 1m
3.600.000ms = 1h
86.400.000ms = 1d
604.800.000ms = 1w
2.419.200.000 ms = 1m
Ticks
20 ticks = 1s
1.200 ticks = 1m
72.000 ticks = 1h
1.728.000 ticks = 1d
12.096.000 ticks = 1w
48.384.000 ticks = 1m
@ivory sleet pin the message please
i mean, isnt this common sense
Someethign whee i can help you? Any dudes/issue jsut ask it and send the sample code
Duration.ofMillis(millis).toWeeks() smh
yea i don't think this is right
Why not?
(also, why tf is bukkit above java 17 in the google search results)
why?
😅
I mean its a pretty simple thing to google
I think its really useful, but up to know
may wanna ask md5 then
Allright
It should be common sense to know this
I will edit it and ticks
This is 11th grade knowledge
and like in code
you dont use stuff like 86400 to my knowledge, instead we favor 60*60*24
or sth
The compiler will do the math for you
yeee
And javac automagically computes it down to a constant
maybe jit then lol
I used to avoid those at first because I thought it would be slower
🥲
oh didnt know it was called that
But it makes sense that a static equation can be optimized to a constant
yea i used to do exactly the same
How many ticks would be 1 week?
well 1d x7 id imagine eh
Oh thanks
player.spigot().sendMessage()
Don't call toString on it
i didn't
Send code there please
TextComponent clickParaVer = new TextComponent(ChatColor.translateAlternateColorCodes('&', config.getString("messages.clickable-message")));
clickParaVer.setClickEvent(new ClickEvent(ClickEvent.Action.OPEN_URL, args[0]));
for (Player ptc : Bukkit.getOnlinePlayers()) {
ptc.spigot().sendMessage(clickParaVer);
}
here you go
https://www.spigotmc.org/threads/broadcasting-textcomponent.364045/ even broadcast shows the same
You use lambda instead of doing a for
Bukkit.getOnlinePlayers().forEach(player -> player.spigot().sendMessage(component));
It's not worth changing over
i'm testing the plugin on a test server
without bungeecord
may that be the problem...?
I think it should work with or without bungeecord
i don't think changing a for to forEach will solve, but not sure
It would throw an error if it wasn't
You cannot send text component without Bungeecord?
not sure
I thought that TextComponent was a format that get parsed
I mean
its loaded in both bungeecord and spigot
however Player.Spigot only exists in spigot
so thats not the problem right?
pretty much not the problem, mye
any ideas for how to fix xd?
as Olivo pointed out, problem lays in that something calls the toString method
and then send the stringed one
uh
don't think so
pretty sure you use some sort of legacy serializer
when u want to convert & format to a component
this is the code that i used to
TextComponent its a serializer and deserializer right?
Try doing it without Chat.Translate-bla-bla()
k
Maybe its causing you problems
nope same problem
TextComponent clickParaVer = new TextComponent(config.getString("messages.clickable-message")); clickParaVer.setClickEvent(new ClickEvent(ClickEvent.Action.OPEN_URL, args[0])); Bukkit.getOnlinePlayers().forEach(player -> player.spigot().sendMessage(clickParaVer));
Oh hmn
Are you also spanish?
si
Oh nice
md
Im spanish too
NOT working
I find a sample on github and was exactly the same as his code. And his code doesnt work
hm?
anyone know how to tellraw to everyone?
without using the command (for not flood console)
because this: {text:"Click Me!", color:"somecolorhere", clickEvent:{action:run_command,value:'/thecommandhere'}} works
Bukkit.getOnlinePlayers().forEach( p -> p.sendMessage ...
Hmn nice shitty, cannot remove from index
why ru using the Integer wrapper instead of its primitive counterpart
Explain
Integer --> int ?
Ahh
no reason to use the wrapper as far as i can see
Wrapped version should be avoided when possible
is this not the correct way to make a player skull? the only option is for me to cast it to SkullMeta however once I do that I get an error saying I cant cast it to skullmeta
have I what
Have you cast it?
well like I said
I tried to
but then it gave me an error
Caused by: java.lang.ClassCastException: org.bukkit.craftbukkit.v1_8_R3.inventory.CraftMetaItem cannot be cast to org.bukkit.inventory.meta.SkullMeta
Oh allright
Hey guys, so i'm using plugin messaging, it works pretty well except when it comes to sharing messages announcing that a player joins/leaves and that there is only one player online in the server that is being joined/quitted, because of
https://i.imgur.com/XhvwMdq.png
Do you know whether it's possible to create a fake online player? Although I would need to hide them from tablist, do you guys have a tip?
at java.util.ArrayList.rangeCheck(Unknown Source) ~[?:1.8.0_311]
at java.util.ArrayList.get(Unknown Source) ~[?:1.8.0_311]
at me.nuggets.historyplugin.GUIScreens.BanGUI.openBanInventory(BanGUI.java:105) ~[?:?]
at me.nuggets.historyplugin.events.ClickEvent.onClick(ClickEvent.java:20) ~[?:?]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_311]
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_311]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_311]
at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.8.0_311]
at org.bukkit.plugin.java.JavaPluginLoader$1.execute(JavaPluginLoader.java:306) ~[spigot.jar:git-Spigot-21fe707-741a1bd]
... 15 more```
```java
for(int i : GlassList) {
int index = GlassList.get(i); // this one
inv.setItem(index, glass);
}```
it worked for the first GUI, why does it not work for the second
do you know how? Also before i head into that, is it not to tedious to setup and is it bad for the server to have such a connection?
And will they be masked from tablist
when i do player.spawnParticle(Particle.SMOKE_NORMAL, entity.getLocation(), 1); for some reason the particle gets flung
any idea why this happens?
Event calling should be done at the final right?
Depends
If it's cancellable, then no.
Otherwise it really depends on what they can change within the event.
if there is only one player on, who would you be announcing to that they left?
How to create things like this?
https://gyazo.com/c77f84bbf1c49c38cf213752371b9d8a
alternatively who would you be announcing to that they even joined o.O
picture 1 - MenuEvent
picture 2 - MenuOpenEvent
on the other bungee servers, and no i do't wanna use bungee api/proxy 😛
Redis is your alternative
nah im not using any modules guys!
you could just query the amount of players on a server in that instance and just broadcast when that one player left I guess lol
Yeah so since it's cancellable you need to fire the event first before opening the menu.
And don't open the menu if they cancel it.
Allright thanks
i can't broadcast to other servers when there is no player online in this server anymore (onPlayerQuit), thats the whole thing about plugin messaging, needs at least 1 player online as a sender and 1 player online as receiver
I explain your posibilities
yes and if there is no one to receive it, who are you broadcasting to anyways?
MC clients don't have chat history
These are your solutions:
1- Using bungee plugin
2- Using plugin message channel
3- Redis/Any other message broker
there might be someone to receive in a different server, there is just no one to send
either way, if there is no one to receive it or send it to, why do you need to send it anyways?
no one is going to read it
Message Plugin Channel need a player, to receive the message
i'm doing 2) it works very well except for onplayerquit and onplayerjoin
and no one is going to even know it was displayed if someone joins afterwards
But its stupid doing plugin message channel in that way, because you could just use the server instance iselft as a receiver. This is what i think
it is stupid regardless because they are complaining about not being able to broadcast to an empty server
no you are wrong, there are players to receive on a different server, there are just no one to send it on the server whch player just left
then send it to the server where there is players
just use redis lol
For sending a plugin message channel when player left do it with delay of 5 seconds for example
as i have tried to tell you, i can't if the sender server doesn't have any players anymore, it needs a sender!
then don't send to that server
not sure why that is so hard for you
Sounds like you really need to rethink how you are going about this
there are multiple servers, server A, server B, in a bungee network
server A has 1 player called Alexis, server B has 3 players
Alexis decided to have a pee break, and left the server A, plugin is trying to tell server B than Alexis left the network, but server A can't, because server A doesn't have a sender anymore
But server B would love to know that alexis went for a pee break
it is so easy to do with redis!
thanks for ur imput but the whole spirit about my plugin is not use any other plugins than nms/spigot and forks
So yes you need to rethink how you are doing this then. You can make plugins communicate with each other directly first off, second people are already recommending you redis which is the alternative to plugins communicating directly. And your final option is to use a bungee plugin for this.
That's incredibly dumb but ok
or my fourth option would be doing what conclure said
a fake connection per server
idc how bad this design is
i don't want to install any other stuff
yes lets go the most difficult route
you are doing super dumb things, stop
making a plugin communicate with itself between servers is far easier then creating fake player connections
in fact you don't need NMS for direct plugin communication either
i'll reconsider maybe, thank you everyone
fake player connections are going to require a lot of NMS
i need it for other stuff 😉 😉 😉
You'd jusr spend your time on unreliable workaround dor NOTHING. There is better solutions which is very easy to install.
alright well you came here for help not the other way around
we can only tell you the easier options
public void forward(String channel, JsonObject data) throws Exception {
ByteArrayOutputStream bytes = new ByteArrayOutputStream();
DataInputStream input = new DataInputStream(bytes);
input.writeUTF(data.toString());
bytes.close();
input.close();
Bukkit.getScheduler().runTaskTimer(() -> Bukkit.getServer().sendPLuginMessage(pluginInstance, channel, bytes.toByteArray()), 5L, 5L);
}
whether you choose to use those is up to you. If you want to go the most difficult route so be it, doesn't mean it is the best option even if you think so
yes sorry, sorry if i seem rude or sth? 'm french 🙂
Thank you for ur time tho^^
yes i do agree with you
anyways have fun you have gotten your answers 🙂
thank you!
Frost wouldnt this work?
possibly, I don't use message channels all that much since there is better ways.
First i need to call the custom event and then check if it cancelled right?
but you need a player on a server to use message channels from that server
unless you are making a bungee plugin
well idk what you are making lol
I have my library and now i add it custom events
And i was told that before calling button.onClick() check if event was cancelled
But i dont know if i first need to call the custom event and then check if its cancelled?
you first call the event and then check afterwards
Allright thanks
how can I make the yaw entity look at me?
yaw entity?
how do you get the javadocs to show up in intellij
Do you use maven?
No
but i figured it out
I would use maven if i ever wanted to depend on 12 other plugins and 18 libs tho
so i will look into that
add .yml to the if check
Y
u already checking if it exists just wrong file name
where it says "/nickreq" need to be "/nickreq.yml"
maybe idk
i would try it out tho
use variabl
sweet
by using try, catch
Code
You would want to not catch that but check the arrays length.
As in show me the code @quaint mantle
The issue is args can be of length 0
So there is no args[0] to access
You need to check args.length and make sure it’s > 0
i put addUnsafeEnchantment but its not actually enchanting the item
What?
Yes, you can access that argument at index zero, but if there is no index zero, you can't get index zero lol
^
Yeah, but what if the array size is zero?
No
No you can’t
Because nickreq is the command
Your first argument will be args[0]
The next argument will be args[1]
/nickreq stuff
/<command> <args[0]>
And so on
lol i never understood why in coding languages a list starts with [0] instead of 1
I mean, Lua 👀
Because of pointers
like it happens in python, java, c#, etc.
Yes
Because of pointers
say you have a pointer to the beginning of an array of integers
*pointer will be the first int
*(pointer + 1) will be the second
And so on
Yea, you're 1 off. When you run /nickreq stuff, Your args[0] is going to be stuff
Not nickreq
nickreq is the name of the command, not a command argument
label
It's not an arg. It's a name
It’s the command label
label will be that value, yeah
Though you're best to compare against command.getName()
by default its commandLabel for some reason
but ye everyone renames it to label
Yeah whatever it's called. alias, label, commandLabel
The String parameter there lol
You’re not storing args[0]
Can we see your code please
It’ll be much easier if we can tell you line by line what the problem is
Well if you run /nickreq on its own, you won't have any args[0].
/nickreq -> args.length == 0
/nickreq stuff -> args.length == 1, [stuff]
/nickreq stuff otherstuff -> args.length == 2, [stuff, otherstuff]
^^^
^^^^
Check the length
Because you’re not checking the length of args
If the length is zero, an argument wasn't sent through
Args is not the same length every time
It’s based on whatever the player types in
Yes
return
return false is generally the "you didn't write this command properly" flag
return true for a successful command
If you want to send your own message, you'll probably want to return true
return false will send a message to the player automatically
The usage message, to be specific
itll stop it ¯_(ツ)_/¯
Yeah, by default it's just /label
But you can change that in the plugin.yml
Example
(<command> being replaced by whatever the label is)
Yep
How can I smoothly fill the blocks around the coordinate?
any idea why the enchantment/glint isnt there (yes ik im too lazy to make a glow enchant or any of that)
public static void createStrengthAmulet() {
ItemStack sa = new ItemStack(Material.GOLD_NUGGET);
ItemMeta meta = sa.getItemMeta();
sa.addUnsafeEnchantment(Enchantment.ARROW_INFINITE, 1);
meta.setDisplayName(ChatColor.RED + "Strength Amulet");
List<String> lore = new ArrayList<>();
lore.add(ChatColor.DARK_PURPLE + "Tier 1");
lore.add(ChatColor.BLUE + "" + ChatColor.ITALIC + "Legend says it contains mysterious powers that");
lore.add(ChatColor.BLUE + "" + ChatColor.ITALIC + "cause people to deal more damage");
meta.setLore(lore);
meta.getPersistentDataContainer().set(new NamespacedKey(Main.plugin, "strengthamulet"), PersistentDataType.INTEGER, 1);
sa.setItemMeta(meta);
strengthamulet = sa;
ShapedRecipe recipe = new ShapedRecipe(new NamespacedKey(Main.plugin, "strengthamulet"), strengthamulet);
recipe.shape(
"SSS",
"SNS",
"SSS"
);
recipe.setIngredient('S', new RecipeChoice.ExactChoice(strengthshard));
recipe.setIngredient('N', Material.NETHER_STAR);
Bukkit.addRecipe(recipe);
}
I'm trying to build somebody else's plugin with gradle to help fix an issue but I keep getting a ClassNotFoundException, even though the dependencies are there
java.lang.NoClassDefFoundError: net/kyori/adventure/text/Component
I tried to look up solutions but they didn't work
The glint will only ever render on the client if the Enchantments NBT has at least one entry
it does
Yes, Bettanation. If your command succeeded you probably want to return true
IntelliJ even recognizes the dependency
but it creates this
How can I smoothly fill the blocks around the coordinate?
Yeah because you're returning out of the method
and its not enchanted for some reason
public void myMethod() {
if (false) {
return;
}
System.out.println("This will never be printed");
}```
lol
Your IDE would actually flag that sysout call as dead code
@nova dagger set the enchantment after the meta
I would just use the meta to add the enchantment
u mean me?
yup, discord is wack
lol
but yeah the meta is what really contains the enchant
so you basically set it on there and then remove it again
ItemStack's enchantment methods are a bit weird
Choco
ItemMeta > ItemStack where possible. I'd really only ever use those ItemStack methods if you were adding just a single enchantment to it and that's it
Yessir?
btw ik this has nothing to do with developing, but how the fuck do i stop mv from changing my gamemode every time i restart/reload the server, change worlds, rejoin, etc.
its so annoying
How can I smoothly fill the blocks around the coordinate?
You probably aren't oped and have the force gamemode option enabled in the server.properties, Tristan
Gonna have to specify a little. Smoothly fill how with what?
Circle? Square?
i have it disabled and i am op
now the recipe doesnt work
Blocks Square
Essentials? WorldGuard? Multiverse? Anything else that changes your gamemode?
its mv everyone gets that issue but no one can find out how to stop it
lol
what do you mean by smoothly?, block by block?. or without lagg?
wdym
could i make a projectile collide with nothing?
block by block
like, it wont collide with blocks adn entities
oh im dumb so i changed the order for the other item as well and so the unenchanted one didnt work lol
Just gather all the coordinates in a queue and work on them N Blocks per tick
one sec
You aren’t checking if args[0] exists
@lost matrix actually meant to ask you. do you think i could apply workload distribution to my variation of private mines
it bassically generates a few blocks inside a cube every like 5 ticks
but there could be like 50 of these mines
That sounds like this is a splittable workload
will it still be viable with only a 5 tick delay though, maybe the first one isnt even finished before the next is supposed to generate
retusanf
args.length >= 1
I would need a bit more information on that. Do you check every region every 5 ticks and generate all blocks that are air?
i indeed check every region, get all air blocks, choose a few random blocks based on upgrades. generate those
hello, how can i make a projectile not collide with blocks and entities?
I need to not touch the block in the middle
Do you have a flag for regions that dont need any regeneration? When full -> set flag, when someone breaks a block -> remove flag
That would be the first optimization. Filtering.
You can just check if it == 1 then
ah thats indeed a good one. didnt think of that yet
3 for loops over xyz then check if x = y = z = 0 and dont apply the action
args[0] requires the length to be at least 1
I did it in cycles. But I need the blocks to appear smoothly around the player without affecting the block on which he stands
Another thing you can do is buckets. So you have 5 buckets with regions evenly distributed in them.
Then every tick you tick one bucket and move to the next one. This way the time between regenerations of a region are
still 5 ticks but you dont bulk them in one tick.
so say i have a 100 regions. i could split them into 20 buckets. and instead i take 1 bucket every tick
Yes. 5 regions per tick > 100 regions every 20 ticks
hmm
Works well for ticking players too
alright. il take a look into that as well
thanks for the ideas. really appreciate it 👍
Depends on your tps really
Why am I getting a NoSuchElementException using hasNext and next on an iterator?
At 20 tps, yes
hasNext does not throw such an exception. Only when you call next on an empty iterator
Let’s see the code
Faction factionFromList = plugin.getData().getFactionStrictFacName(iter.next());
if(factionFromList == null) {
iter.remove();
continue;
}```
second line throws the error ofc
oh shit
nvm
continue
spotted it
Those aren’t the same iterator
yep
yes but if thats in onCommand make sure to return true
or false to send usage from plugin.yml
cmd.getName().equalsIgnoreCase("nickreq") this line is really useless unless you use the executor for several commands
How do you register your executor?
I think maybe only commands registered in plugin.yml if you dont use commandexecutor
I would use that tho
If its in your JavaPlugin class then it will automatically be registered for every command in your plugim.yml
So depends on what you are doing
Do you use your "main" class as a CommandExecutor or do you have a separate class for that?
Which command framework is easier to work with, cloud or ACF
your own 🙃
Depends on what style you prefer. For annotations i would go for ACF. If you like the more reactive style approach then i would go for cloud.
how else you gonna execute your code
Why does everybody want plugins to use relational databases :upside down happy face:
To achieve what?
It does work in that case
The executors are so you can have a separate one for every command
Do. You. Use. Your. Main. Class. As. A. CommandExecutor.
Ive asked this 3 times now
i.e separate class
thats not what hes asking tho
does your main class implement CommandExecutor i think is what hes asking
They do by default
JavaPlugin alread does that
o
Okay
Im just asking if he overwrites the onCommand method in his JavaPlugin class
Is your onCommand method in your main class
Nothing
The main class is the default executor
you make a class for your command and implement commandexecutor then override onCommand in there, and you dont need to check for command name
setExecutor is only if you want to use another class for it (which you should)
No
Also ahhh UpperCamelCase
Commands
doesnt actually affect anything
No but that’s not a class
class name uppercase
It’s an instance of a class
variable name lowerCamelCase
- Why do you have nickreq twice
- Why do you have a single executor for every command?
Anyways instead of using one class-Commands you should make a class for every command- SmithingTableCommad NickReqCommand etc
So it’s not a class, it’s an instance of a class
and set executor for each one as new SmithingTableCommand etc
no reason other than organization
And it saves the name check
true
then the class and instance have the exact same name
you dont want that
differentiate
Naming conventions are the standards for how you name things in java
Yeah constants are UPPER_SNAKE_CASE
same
Same
same
Agreed
you should see my first few plugins
That’s why we have ?learnjava
Class
classInstance
CONSTANT_VAR
those are lambdas
-> is a lambda
When using the ChatColor class, should I be using the org.bukkit.ChatColor or the net.md_5.bungee.api.ChatColor. I'm updating some old code and was wondering if I could just switch everything to the bungee ChatColor class. I already use the bungee ChatColor for mostly everything as it offers what I need, but is there a valid use case for the Bukkit ChatColor?
This is my third plugin i ever made. not even my first and just look at the horror. https://paste.md-5.net/wakadusado.coffeescript
Use the bungee one
I think the Bukkit one has like
very readable command eh? hahahah
you said it brother
lol... i have a soft limit of 5 lines for my commands. This is quite the interesting sight.
What happens when u learn java from bukkit plugin tutorials
use my library 👍
Hm. Maybe i can find one of my first code pieces. XD from 2019 i think?
is that when you started coding?
Depends
Yeah around that time i started. With embedded C, Python and Java
ye. i keep all my events in one class tho prob not the best practice
Sometimes you need a class per thing if it's big
With my command library you use one method per command
I dunno if I would do one event listener per class either
With some command libraries you use one class per command
Personally I find that really excessive
Before that i finished my bachelor in applied physics and had no idea that i loved coding... and now im doing a second bachelor so i can do a masters in CS XD
dw, when i started like 5 years ago. my file structure sais enough https://gyazo.com/497f5965c27a5b0d230f967e0f7efc75
aha at least it is not all one class
Lul
Scary
nickreq is the command, stuff1 is args[0] stuff2 is args[1]
/<command> <arg0> <arg1> <arg2> etc etc.
Thx in the beginning i just loved it so much that i binged 12hours of coding and reading about new stuff.
Now i can hardly write 3 lines without getting side tracked by discord channels like this one ^^
you know who else is lazy?
Dead people?
susan
why do you check if the cmd is "nickreq" at least 3 times
Gotta be thorough,. lol
no its not?
its just not. provided you have it in its own class
you also check the permission like 4 times
why not once
at the beginning
After my 5 year hibernation due to the release of the most horrendous one-class plugin to ever release on spigot, I resurfaced in 2020 after learning that java is not a scripting language and I learned what a clas was: Behold, the next plugin to be released with FOUR COUNT THEM FOUR classes https://paste.md-5.net/elohujiwiy.cs (This is only the main class)
Because you are comparing a string which is the input from the user. There is no command lookup, but rather a simple string comparison.
Yes
Yes, that's how chained if else statements work.
If you wanted to make your life simpler, you could just make it a guard clause.
if (!cmd.getName().equalsIgnoreCase("nickreq")) {
return true;
}
That way, none of the code below would run unless the command is equal to "nickreq"
You'd probably want to do a permission check as well, but the idea is easier code readability.
how would I go about generating other files in the resources folder into a plugin's data folder, similar to config.yml?
JavaPlugin#saveResource()
ah, okay thank you
Keep in mind that you have to manually call saveResource() for every single file you want to write to disk. If you have many files, this could be problematic. Otherwise you may want to look into another solution. I might have one, but I'll have to check.
I'm suggesting you make your code easier to read. Everything you are checking for now is what you want, but the order in which it happens matters.
For example, you may want to check for the command name first. (Using the example I provided earlier)
Then you'd want another check for the permission to use the command.
Then you can get into the nitty gritty of argument checking. (Both length and content)
Which class has that method?
Is that a newer feature, because as of right now, using the 1.18.1 API, there is no saveResources() method in the JavaPlugin class.
I thought you were suggesting a method, were you not?
lol, my bad
why does https://paste.md-5.net/upezujofog.java not do anything
cause it's a link not code
and yes, the event is registered
shush
god that is very arrow code
lol
and yes ik oopsies on the /100 thing
but why isnt that working it seems to me like it should work
lol im dehydrated so i cant exactly concentrate rn
so i have no idea
what is wrong
did u literally just take the time to edit that
A whole pyramid fits there...
lol
neofetch
Yo I got another question now.
So I made a GUI. And ehm, well everything is working smoothly. But I've made an @event handler. And it triggers the event when the player drops an item. It opens up the GUI. But I don't want it to do that. Instead I want it to open when the player presses the 'e' button on the keyboard. And then it opens the GUI.
How do I go about doing that?? Also a little slight other question. What is the keyword e???? I've used it in my plugin from watching a tutorial, but I have no idea what e is...
You can't
Oh buggerrrrrrr D:
technically he could
You can do it with the offhand.
oh inventory?
go to their house and press E
that's so true it would work
you could make an event for when they open their inventory and then open the gui
idk if u need to cancel the event
I didn't know you could detect player keyboard input. Please share how.
You are saying strange things today. I have no idea what any of that meant: "neofetch | frendo it | sunglaseg' | retusanf"
I see that Redempt is a fellow linux user. very pog
not keyboard input
🍃 👤 👄
The vegans of linux users. Arch.
https://paste.md-5.net/idepagiqod.java less arrowy now ya happy?
I've enraptured a crocquette
For building a dependency injector would you do it async or sync?
a dependency injector which does what exactly
sync probs
most of the time sync is the better choice
but ye it depends
In the sense of
arch arch arch arch
now its an arrow with a giant spike coming out of it
or an arch
lol
archj
it is a trapezoid
sure
Instead of doing:
ClassName class = new ClassName();
public ClassName getClassName() {
return clas;
}
public void test() {
getClassName().methodName()
}
I would transform to so there is no need to do getters and setters:
@Injector
ClassName class;
public void test() {
class.methodName();
}
who
who said that
if(event.getAmount() <= 0) {
return;
}
Makes it even less pointy
ok
How do i change discord rich presence configuration?
https://paste.md-5.net/yicasukoje.java ya happy now
with the p[ower of music
cuz it doesnt say how many hours i have been working on the project
still trapezoid fuck
lol im so dehydrated i have a headache but im too lazy to get water
Me too
me too
Im so lazy that i put a mini fridge en my bedroom, so i dont need to go down for taken water
i've just bought an mini fridge for the leds
i havent drank in about 4-5 hours
yes grammar
wait is that correct grammar
im confussed
I wont lie, i think i haven't been went outside my bedroom since thursday
I just go outside for taking food Lmao
https://gist.github.com/Flo0/c6929a56fb79275b469de8686029bd2f
Here is a bit of formatting. Maybe you can get some inspiration out of there.
float your way out
i have an arsenal of arrows and im not afraid to use it https://paste.md-5.net/xufiriyita.java
lol pasting be like
oh my god

whats that
that is the most perfectly shaped arrow i have ever seen
someone needs to make arrow-shaped code to spawn arrows in the shape of an arrow
kinda like the donut code
AHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHH
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!
If you wish to request or offer development/art/building/administration services, please do so at https://www.spigotmc.org/forums/services-recruitment-v2.54/
no
okay
sorry for bothering
Just saw your status and figured i'd ask
in fact he made java
not only did he made them, he born them
invented programming
invented god
he's the owner of stackoverflow
nah he didnt invent me
why are you exposing me
oh I meant like God
there is no other god than me
Rack is notch
rack is notch²
Anyone else get a DM from them
from rack?
Rack is secretly all of us
Nah from this one
Interestingly they stopped replying when I linked them the services forum
btw arrow jokes aside, i still get strength 2 for whatever reason using a tier 1 amulet and it doesnt gain xp
Are you using 1 for the amplifier
updated code?
so i put the amplifier to 0?
lol
so player.addPotionEffect(new PotionEffect(PotionEffectType.INCREASE_DAMAGE, 11, item.getItemMeta().getPersistentDataContainer().get(ItemManager.strengthamuletkey, PersistentDataType.INTEGER) - 1));
god that looks like shit with discords formatting
Sure
and i still have no idea why nothing happens when absorbing xp
it loops every 10 ticks
Ah
and 10 makes it freak out
So we’re remaking EcoTalismans :p
i have no idea what that is but sure
Some premium plugin that adds effect talismans
well this is a custom plugin for some kids smp so ¯_(ツ)_/¯
did they pay for it?
no not rlly im the only dev that hasnt been paid in like the past half year
Sounds like a good time to yeet outta there
im also the only one working on the smp side of things, the others (and i) work on the shitty discord bots
lol
Is it possible to create a shaded recipe by making the Materials needed in a recipe as ItemStack?
new ItemStack(Material)
RecipeChoice.ExactChoice
ah
no what i mean is in a crafting table, to create something, you need a custom item, which Material does not offer
ive basically been trying to force the other devs to learn java but theyre too busy coding in python xD
.
inferior language
thanks
lmao the amount of worlds
theres 3 more but theyre above
rip whatever host hes using
why does he want like 7 worlds
nothing wrong with having a bunch of worlds on a server
anyways any idea why this does literally nothing https://paste.md-5.net/eredoxexaq.java
I mean technically the whole proxy server switching is just a manipulation of what the client perceives as world 😛
ik but hes planning on having like 100 people on it and its like 6 gb ram
Yeah proxies for mc are interesting when you get into how they work
Is there a way to adjust the damage that World#createExplosion gives off to entities?
You’d have to use an event
if you can't find a setting dealing with explosions or tnt in the configs there are plenty of plugins that allow this
oh right api wise you can do it too
Basically gotta check if the damage cause is an explosion and the damagee is near where the explosion happened
oh damn
^
but wouldn't that generalize all explosions caused by tnts?
i just want it to work in World#createExplosion
Hence why you gotta use a location
there are plenty of ways to narrow it down to what you are wanting, but I mean you are not being very specific either lol
just reduce the damage cause by World#createExplosion
it isn't that complicated xD
but i'll try what you guys told me
Thanks
There is no parameter for entity damage multiplier
is there a way to get whether an entity is hostile or not?
You can check if the entity instanceof Monster
ah, I did not know that existed
That will cover all hostile mobs except for slimes I believe
Mojankkkk
Who mentione that was building a DI framework? Please dm me if you are building DI framework
You can use:
public class Chat {
public static String style(String input) {
return ChatColor.translateAlternateColorCodes('&', text);
}
public static List<String> style(List<String> input) {
return input.stream().map(Chat::style).collect(Collectors.toList());
}
}
They literally said they dont want to translate the colors
Hmn
So he didnt explain good
So what you want?
Send messages to player?
for sending messages without color: Player#sendMessage(text)
If you use p.sendMessage, it won't be colored. If you use /msg, it's probably based on CMI permissions.
I assume CMI has coloring permissions, and if the sender has those perms then the message would be colored
It's a plugin
Probably language barrier
We all tell people to go to the right channels. Not just helpers.
You are a miserable person to help lol
if this is how you treat the people that you are asking for help
you may find you're not getting help much longer
^
@waxen plinth @hasty prawn @quaint mantle guys. I'd like to apologize for the shit that you guys have gone through these fast few minutes. Noone needs to help him, let him figure it out on his own. If he's too dumb to understand, don't be too dumb to give in
I only just got here
what the hell
Just move on
Poor Verano got the worst of it lol
dont cause drama. you got your help. move along
i like how you put a clown emoji on my message like its going to personally affect me
boo hoo
Eh lets just drop this please
true
Someone told me to change my switch statement into a hash map one time in here a long time ago
Well it can be preferable if there are a lot of values
Clearly a massive if else if chain is the best
Now is a massive if else chain any slower than a switch
fundamentally they work the same but a switch statement is a lot cleaner
use a switch statement
Switch’s should be faster
Since they just do one check and then jump to a label
a switch statement is not similar to an if else statement
What its better from developer view Annotated or extending classes?
a switch statement is dividing code into different cases and executing the case specified when the switch is called
That's preferential
Some developers might prefer using annotations, some might like using extended classes.
Yeah, i fell that annotation sometimes make code like "strange", in other hand its shorter than extending classes
how do i compare 2 itemstack objects without comparing their durabilites
My library has a way to do that
and also, i don't want to getType() the itemstack cause i want to compare 2 custom items
@SuppressWarnings("unchecked")
public static void copyContents(PersistentDataHolder donor, PersistentDataHolder receiver) {
Preconditions.checkArgument(donor != null && receiver != null);
PersistentDataContainer donorContainer = donor.getPersistentDataContainer();
PersistentDataContainer receiverContainer = receiver.getPersistentDataContainer();
for (NamespacedKey key : donorContainer.getKeys()) {
if(donorContainer.has(key, PersistentDataType.LONG)) {
receiverContainer.set(key, PersistentDataType.LONG.getClass().cast(PersistentDataType.LONG), Objects.requireNonNull(donorContainer.get(key, PersistentDataType.LONG)));
}
}
}
Anyone know where to go from here? I'm a bit confused as to why this isn't working
isn't there a way to just get this by the chunk object
well, what isnt working? what is it supposed to do?
whats the expected result?
I'm trying to copy the cotents of one data holder to another
im not sure, i've never made anything clientsided. but forge api says there is a chunk object
what size are we talking about? like how many non-air-blocks?
or like the KB size of the region file?
PersistentDataType.LONG.getClass().cast(PersistentDataType.LONG) what is this?
and you have to simulate it yourself since you can't access the region file
first google result literally
actually I'm stupid, I forgot to change the casting when I was using a loop to do all the prim types
🤦
thank you
What do you think?
I think lombok bad
Hmn

bad?
Bad.
why?
Lmao
Does loombook execute something on the IDE when you add it as dependency?
Oh
Does anyone know how to install java 17?
Linux or windows?
Ubuntu 20.04
Pog
I think you need a special repo for it or something
anyone know how the method to disable a bungee plugin
There is no method for disabling a plugin
You have to do it via reflections
Lombok just seems so pointless to me
Is there any other any simple library. For stop doing ClassName getters and setters?
wdym
ye used that
forgot it was an enum im kinda braindead
Untrue
How so? For me it is a massive time saver. And it makes my code super compact.
The only downside is that it hides some code that is only present during compile time.
But if you've worked with JavaEE then you'll know that this can also be beneficial.
For example this class im currently writing delomboked would not be 50 lines but over 200 lines. Would have to scroll to see all the content.
Is the Spigot code open source on github?
?stash