#help-development
1 messages · Page 2074 of 1
vs doesnt suck that much i guess if its your only option but you should get the plugin at least
consumers avoid issues like your armor stand being visible client-side on the first tick
wdym
where you give it
I'm lazy and tired so here's just how I used consumers in this one class
LivingEntity livingEntity = (LivingEntity) spawnLocation.getWorld().spawn(spawnLocation,
customBossesConfigFields.getEntityType().getEntityClass(),
entity -> applyBossFeatures((LivingEntity) entity));
this makes sure that everything you set is set before the entity spawns, at least events-wise
it also avoid client desyncs
and avoids plugins messing with your baby before it's ready for prime time
because between the spawn line and the line where you set it as invisible the whole creature spawn event runs and your entity might get modified
yea
or yeeted and deleted as the kids say
i always sort of just default to using spawnEntity
never really gave the other methods a chance
tbf it took me like 4 fucking years of spawning quite literally millions of entities before I even learned about this
lol
actually probably closer to billions
That's pretty much how it goes lol
You stick to what you know until you just happen to find something better
yeah and it really sucks when you know nothing
I am new to this, is there any way I can make a player use an item?
Elaborate
not through the api my man
I want to make a plugin that boosts an elytra when the player sneaks and I want it to force the player to use a firework.
Ah, XY problem
modifying AI is NMS territory, we don't go there
You just want to add velocity to the player
someone made a plugin for it
NMS is a thing
last I checked it was out of date
ik
Ok, can I do this with player.setVelocity()
and several people abandoned it too
Yes
Set their velocity to their current velocity + Whatever offset
does deleting the world reset the maximumnodamageticks of a player?
So I just straight up add to the velocity like:
player.setVelocity(player.getVelocity() + 1);
No
.multiply
no not even close
what's 1
in 3d space
get up from your chair and please move 1
Use methods from the vector to do operations
1 is 1
If you want to use 1 value, multiply is the way to go, if you want to add it relative to 3d space, use add
Ok
What does 1 mean in this context, is their point
1 != 1
🤯
Of course multiplying by 1 will just make it the same value
at org.bukkit.plugin.messaging.StandardMessenger.validatePluginMessage(StandardMessenger.java:535) ~[server.jar:2991-Spigot-018b9a0-f3f3094]
at org.bukkit.craftbukkit.v1_16_R3.entity.CraftPlayer.sendPluginMessage(CraftPlayer.java:1274) ~[server.jar:2991-Spigot-018b9a0-f3f3094]
at dcg.npplugin.com.commands.CommandHub.onCommand(CommandHub.java:37) ~[?:?]
at org.bukkit.command.PluginCommand.execute(PluginCommand.java:45) ~[server.jar:2991-Spigot-018b9a0-f3f3094]
... 19 more```
Just an FYI
Yeah, 1 was just an example number
If I had to guess I would assume that the plugin source is null
theres no null il my commandhub.java
Your plugin instance is not being set when you try to get it
I suppose the only other option then is that the console is lying for no reason
?di
Guide to dependency injection: https://www.spigotmc.org/wiki/using-dependency-injection/
@shrewd solstice
player.sendPluginMessage(main, "BungeeCord", out.toByteArray());
the probleme is the main and in the first line of my Command there's
private main main;
don't name your main class main
lol
Well I mean, you can
it's bad practice in a plugin
Thats fair, I think they should correct the capitalization issue though
?main
are you ever setting "main" to anything?
public static Main instance;```
does instance ever get set
ok so how i do it
....
Your onEnable method
instance = this;
my Main.java
package dcg.npplugin.com;
import org.bukkit.plugin.java.JavaPlugin;
import dcg.npplugin.com.commands.CommandFly;
import dcg.npplugin.com.commands.CommandHub;
import dcg.npplugin.com.commands.CommandNick;
import dcg.npplugin.com.commands.CommandSpeed;
import dcg.npplugin.com.commands.CommandUnnick;
import dcg.npplugin.com.commands.CommandVanish;
public class Main extends JavaPlugin{
public static Main instance;
@Override
public void onEnable() {
instance = this;
getServer().getPluginManager().registerEvents(new Listener(), this);
getCommand("nick").setExecutor(new CommandNick());
getCommand("unnick").setExecutor(new CommandUnnick());
getCommand("fly").setExecutor(new CommandFly());
getCommand("speed").setExecutor(new CommandSpeed());
getCommand("vanish").setExecutor(new CommandVanish());
getCommand("hub").setExecutor(new CommandHub());
getServer().getMessenger().registerOutgoingPluginChannel(this, "BungeeCord");
}
}
and in CommandHub?
i juste copy code ':)
import java.util.ArrayList;
import java.util.List;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.command.TabExecutor;
import org.bukkit.entity.Player;
import com.google.common.io.ByteArrayDataOutput;
import com.google.common.io.ByteStreams;
import dcg.npplugin.com.Main;
public class CommandHub implements TabExecutor {
private Main main;
@Override
public List<String> onTabComplete(CommandSender sender, Command cmd, String label, String[] args) {
List<String> list = new ArrayList<>();
return list;
}
@Override
public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {
Player player = (Player) sender;
if (args.length == 0) {
ByteArrayDataOutput out = ByteStreams.newDataOutput();
out.writeUTF("Connect");
out.writeUTF("hub");
player.sendPluginMessage(main, "BungeeCord", out.toByteArray());
}
else {
player.sendMessage("unknow args number");
}
return true;
}
}
so idk what i did x)
Oh, thats your first issue
you need to pass the main instance to this class
Learn Java first, so you can diagnose your own problems correctly
?learnjava
Here are some links to get you started on learning Java:
- https://www.codecademy.com/learn/learn-java
- https://www.sololearn.com/learning/1068
- https://www.learnjavaonline.org/
- https://programmingbydoing.com/
- https://docs.oracle.com/javase/tutorial/java/index.html
The last one is the only official one, however some of those concepts assume that you already know a bit about programming.
Copy pasting code will not get you anywhere, itll just make you more confused
Well to be fair copy and pasting code and taking other code and learning from it are different
im alredy confused
If he's just straight up copying and pasting without taking anything from it then that's an issue
They seem to have just copy pasted and not looked into it at all
also if you're making a lot of commands that involve bungeecord, you should really make it a bungee plugin instead
In that case you're definitely right lol
when i copy i, in first place, try to understand x)
Look into learning basic Java first before trying to develop plugins
i juste want to send my player to the hub
well in that case, just add a dependency injection into the constructor and set the plugin there
?di
Guide to dependency injection: https://www.spigotmc.org/wiki/using-dependency-injection/
.
good luck!
Btw, you're making a completely new instance of Main, and not setting it
Again again, I highly recommend learning some more basic Java before tackling something like this, you seem confused about some common Java aspects as a language and not necessarily plugin development
You already have an instance of Main in your Main class, that has been set to your instance
You shouldnt be using static references to your main class in the first place, look into this
If you really do want to keep using the static reference, you can just do Main.instance
To get the instance of your plugin
Or at the very least make a getter, (If you know how to do that)
he doesn't
Yeahhhhh
what i do with this x)
Thats how you can get the static instance of your plugin
my first language is not English
create an instance of your plugin, pass it around to the other classes or use a getter
Line you would want to change here:
player.sendPluginMessage(main, "BungeeCord", out.toByteArray()); to player.sendPluginMessage(Main.instance, "BungeeCord", out.toByteArray());
don't spoon feed him
They clearly do not intend on learning basic Java at all
I mean, it doesnt make much difference
to everyone having popular free plugins that rely on certain links containing spigotmc links to be present: You'll have to put the "https://" stuff into methods, otherwise aternos replaces those strings with "null" and you'll get NPEs......
Haha thats ridiculous
it is
Aternos.....
aternos sucks
HOLLY F***ing SH** IT WORK (srry for the caps im so happy all work thank you a lot)
Im begging you, please learn basic Java
yeah for you i'll try
I feel so special, thank you
😄 im so happy i lose like 2 hours in searching on google
but i think google dont want to be my friend x)
how do you paste a structure with the structure's nbt file from a structure block
WorldEdit has API for structure block nbt loading I believe. I also dont think Spigot has any API for that
theres loadStructure()
declaration: package: org.bukkit.structure, interface: StructureManager
but ik this sounds dumb, but how do i get the file? do i put it in resources or smth
getStructureFIle() just gets a file in world/generated/file.nbt
Im a bit confused as to what you're trying to do
i already have a structure file saved, i just want to know how to access it in any server
wdym
do i put it in resources or smth?
I mean, you can? Just get the file through your plugin
how tho
The .nbt file already exists within your server in some directory?
Or are you trying to embed the nbt file into your jar
Ohhhh I see, okay you're gonna need some funky googling for that
You can put it in resources, you can get files in your jars resources via, a couple of ways
Googles your friend here
If it’s in the plugin, you can just use Plugin.getResource
Oh thats nice
declaration: package: org.bukkit.structure, interface: StructureManager
stuff like this really makes me regret making plugins on 1.8
i had to make an entire seperate strucutre system that was incredibly horrible to maintain
declaration: package: org.bukkit.plugin.java, class: JavaPlugin
how can i detect the name of the server in the bungee?
<serverinfo>.getName();
what the fuck am I even looking at
int time = (int) ((restockTime - Instant.now().getEpochSecond()) * 20);
Developer.message("time = " + time);
Developer.message("Restock time: " + restockTime);
Developer.message("Instant: " + Instant.now().getEpochSecond());
Developer.message("Formula: " + restockTime + " - " + Instant.now().getEpochSecond() + " * 20");
how is this value positive? does casting to int mess with it?
wait what's the int limit again
so i have my file at this directory but when i do endcrystalcage = this.getServer().getStructureManager().loadStructure(new File(getClass().getResource("endcrystalcage.nbt").getFile())); it can't find the file
Just use Plugin.getResource
thx
what is the event for when a message is sent (bungeecord api)
Normally you have to wait for blocks like furnaces to finish.
Is there any way to manipulate the tick speed for one specific block? (Preferably without nms)
yep it was me being dumb and using int when it should've been long
I don't want this to only work with furnaces, this should work with all ticking blocks (Like crops)
I think I'm not understanding how CompletableFutures work correctly
CompletableFuture<String> future = CompletableFuture.supplyAsync(() -> {
try {
Thread.sleep(1000);
} catch (InterruptedException e) {
e.printStackTrace();
}
return "abc";
});
future.thenRun(System.out::println).get();
future.thenApply(String::toUpperCase).thenRun(System.out::println).get();```
I thought this would wait 1 second, then print abc followed by ABC
But there is no output when running this
There is output if I do System.out.println(future.get());
Doing future.get is dumb though
I know, since it makes it blocking
Mhm
Defeats the purpose of having it run async
But that's not what I was testing here
I added .get() to both because when I saw no output without using it, I figured maybe it was lazy and would only be run if get was called
What is going on here? Why is nothing printed?
Oh
Wait yeah I'm dumb
Nothing is being printed because I'm doing thenRun instead of thenAccept
I'm passing a runnable
It takes no args and just prints a newline
🤦
So they do work how I expected
Then the issue I'm having makes no sense
I'm trying to put a structure on each end pillar, but how do I get the location for the top of each one?
aren't we all?
@waxen plinth have you ever used minimessage/adventure?
No
ok 😦
Why
oh I was just wondering because you like to do library stuff
and minimessage is a damn fine api
Still waiting on an answer lol
are you talking about those pillars the dragon flies around?
there is another method
assuming the end dragon hasn't been defeated and what not, just locate the ender crystals
or just locate the obsidian
I tried that, but it doesn't find them in ChunkLoadEvent
then locate the bedrock
ender crystals sit on top of those, but they don't go away like ender crystals also ender crystals are entities just fyi
Like what, if the bedrock level is greater than/equal to 70?
Cuz I'm pretty sure the middle is 64
grab a chunksnapshot
interate it for the one bedrock block
once found, that is one pillar
if it further helps
10 pillars generate
and in 43-block radius circle around the exit portal
A 3-block radius pillar ending at y=76 (total of 1596 blocks of obsidian);
A 3-block radius pillar with iron bars ending at y=79 (total of 1659 blocks of obsidian);
A 3-block radius pillar with iron bars ending at y=82 (total of 1722 blocks of obsidian);
A 4-block radius pillar ending at y=85 (total of 3145 blocks of obsidian);
A 4-block radius pillar ending at y=88 (total of 3256 blocks of obsidian);
A 4-block radius pillar ending at y=91 (total of 3367 blocks of obsidian);
A 5-block radius pillar ending at y=94 (total of 5358 blocks of obsidian);
A 5-block radius pillar ending at y=97 (total of 5529 blocks of obsidian);
A 5-block radius pillar ending at y=100 (total of 5700 blocks of obsidian);
A 6-block radius pillar ending at y=103 (total of 9167 blocks of obsidian).
there is all your heights 🙂
now just have to look between those ranges in a 43 block radius 😄
EntitiesLoadEvent
Or something like that
Hello, how do I get this working in bungeecord? ((CraftPlayer) player).getHandle().playerConnection.networkManager.getVersion();
Tried casting to ProxiedPlayer, but there's no such methods
Yeah those are NMS methods they won't work on Bungee
Protocollib doesn't work on Bungeecord
😦
I have no idea how to get it any other way
I want it for minimessages, to determine whether to send RGB formatting to player or legacy
Why not use MiniMOTD?
It's not for MOTD
Then ViaVersion and such should handle this
Oh, ok, thanks!
Hi this code do not work
https://paste.md-5.net/ufugoricin.java
pls help me
?notworking
"Does not working" is a useless statement. Please describe what exactly is not working, what you expect it to do, and what actually happens. If you get any console errors, also ?paste the entire stacktrace.
just by looking at this your not setting that Plugin instance
also
?conventions
Java Coding Conventions: https://www.oracle.com/java/technologies/javase/codeconventions-namingconventions.html
Yeah was about to say
:p
Damn didn't know we had a command for that
Which one?
Conventions. I like. Some people name their classes coollistener
main
main main = new main()
Name all of the main
maine
pain
Who needs an obfuscation plugin if you make your code unreadable
im an obfuscator myself
manual obfuscation go brrr
I prefer to just not make it work in the first place
Avoids all the hassle
Yeah like the plugins you get from those plugin groups that crowdsource teenagers to write "plugins"
community project: everyone is allowed to PR 5 lines of code
My five lines will be 0 width spaces
would be interesting to see what kind of project this would be
i wanna see this ngl
see what bullshit the spigot community comes up with
time to make this idea before someone else does
I would probably make a maven library and import it
Then I could make an arbitrary amount of code with one line
will fail on the contribution
Imagine it just installs a Trojan that mines bitcoin on ur server
well certain rules would have to be applied ofc
like declaration of classes construcors and methods dont count as lines, no libaries other than spigot
lol, community project: you are allowed to write 20 lines of code, but deleting lines restores them.
we need to write out like a specific ruleset tbh
but arbitrariness is prohibited
and end goal in mind
Just delete all the contents of 20 files and you got 2k lines more
and prevent things like that ^
imagine a simple plugin as goal but it turns into minecraft2
but arbitrariness is prohibited
ngl im really curious what people would create
would the plugin be a new essentials? skyblock plugin? no one knows
Just write everything on one line and skip the line limit 🧠
Watching a bunch of random people try to create the physics engine would be hilarious
sec imma make like a ruleset rq bc this idea is good asf cipher
You are allowed to only commit {x} amount of lines of code in your lifetime
- removing lines of code will restore the amount your able to commit
- you cannot remove random code to restore your lines, there has to be valid reason for removal
- You cannot put multiple lines of code onto one line (IE multiple if statements on one line, but having returns and variable declarations on one line is fine)
- Class, Constructor, Variable, Method & brackets do not count torwards you total code count line
- You cannot import any external libraries other than the Spigot API itself (NMS is fine)
- You can endlessly replace lines of code, as long as there is valid reason the previous code there wasnt needed

🚨
remove those
- You cannot put multiple lines of code onto one line (IE multiple if statements on one line, but having returns and variable declarations on one line is fine)
- Class, Constructor, Variable, Method & brackets do not count torwards you total code count line
- You cannot import any external libraries other than the Spigot API itself (NMS is fine)
i wanna die of boilerplate
see how creative people get
You really want people to add 200 lines of code on one singular line lmfao
the last two can prolly be removed but gonna make people mad lmao
specifically brackets and declarations counting as lines 🤣
You are allowed to only commit {x} amount of lines of code in your lifetime
- removing lines of code will restore the amount your able to commit
- you cannot remove random code to restore your lines, there has to be valid reason for removal
- You can put multiple lines of code onto one line
- Class, Constructor, Variable, Method & brackets DO count torwards your total line count
- Imported libraries must be open source and linked in the readme.md
- You can endlessly replace lines of code, as long as there is valid reason the previous code there wasnt needed
there
it is a project for cohesion
someone can make the methods
others can implement it
everyone writes one line per method
true
people could colaborate
or they could not
someone makes methods while others actually use them in logic
yeah
i feel bad for the person who makes the main class
there goes like 40% of your line count just doing that
okay cipher make the repo xd
see what plugin people make
i think we wouldnt find much contribution
constantly advertise it in here
"Hey {name} i see you havent contributed to {repo} you should commit something!"
randomly dropping "just changed something, fuck just got 3 lines left!"
only thing is
imagine someone wasting their lines on insulting people in a comment
managing peoples lines would be aids
LMAO
not sure how managing lines you go, maybe make people comment theyre github username next to said line
PR is a thing
yes but if someone removes someone elses code
that would be in a commit then
hmm fair enough
"Cipher" would even be a good name
since you won't understand the code anymore after 20 people commit
thats the point right?
javax.crypto.Cipher
how can I store a custom datatype in a persistent data container
Highly recommend https://github.com/JEFF-Media-GbR/MorePersistentDataTypes
thanks, is it possible to create a data type, that can store any instance of a class? For example I have a class like Party and then store it inside a Player
If you're using this you simply have to implement ConfigurationSerializable
if i would have a Gun class with the methods canShoot and shoot, should i check in the shoot method that i actually can should or should i check that manually so the shoot method only has to handle the shooting self and not the checking?
that depends on the implementation. if you have a magic lasergun which can summon a laser beam out of nowhere canShoot probably doesn't matter
so how would it shoot if it's out of bullets
not
there you have your answer
couldnt you just check canShoot inside shoot and return if canShoot is false
that way you only need to call shoot()
is it safe to do config file reading/writing async? heard some bukkit/spigot stuff isnt safe to do async
As far as I'm aware it's fine
cool
Hey,
Is there a way to force tick a block without nms?
Like furnaces and crops
you can set the cooktime
And the age of crops, sure, but I kinda hoped for a universal way to tick all blocks which can tick 🤔
How do I use PAPI with my (custom lang) config yml file, so if the text in one of the fields contains %vault_eco_balance% it uses PAPI to replace it when it sends the message to the user
is this the correct way to delete a world?
Bukkit.unloadWorld(world, false);
FileUtil.deleteRecursively(world.getWorldFolder());
(imagine FileUtil#deleteRecursively is a recursive directory deletion method) Is there anything else I need to be doing?
Make sure no one is in the world
good point, thank you
Papi.parsePlaceholder(string, player)
I might be wrong about this but let me check
you want to extract the placeholder from the config.yml too btw
split by strings and check if the arg[int] begins and ends with %
oh
you can just parse the whole string
oh alright thanks!
How to detect premium player on cracked server
to do what
IIRC there was a API endpoint for mojang that checked if a users name was paid, but it might of changed now with the recent migration to microsoft
here this plugin does it
you can check its source
yeah I have looked at that plugin
can't find the part specifically
where it differentiates between cracked and premium
doesn't it run the server in a semi-online mode
yeah but that still doesnt differentiate
between cracked and premium
because a cracked player
servers either run in online mode or not
can have a premium username
ohh yes i see
i forgot about that
in that case
there likely isnt a good way to do this
as mc clients dont send that data to the server
what are you trying to achieve?
just differentiating between the two
so certain conditions apply to cracked
and premium players
on the server
yeah i dont beileve there is a way to do that tbh
maybe someone else may have an answer here though
I mean the solution is to not allow cracked players on your server
^
Totally is an option.
what about sending a player to a small premium server on join
via bungeecord or something
and if they connect
then register as premium and send to main server
and if they dont
register as cracked
would that work
it would require running your proxy in offline mode but honestly i dont really see a reason to do this
When you're in offline mode you're in offline mode end of story
is there not some packet i can send
have a seperate server
on a cracked server to differentiate
that in online
and when the player joins that server have a redis cache setup tht the cracked server has access to
well
nah
wouldnt work
security issue
manually authenticate?
You can't because there is no feasible way to tell if the person actually owns the account
^
Unless you literally get them to sign in with their official MC account
yeah but i mean cant i just immitate a premium server's authentication
I'm sure if you wrote a huge spigot patch you could
This would be something that you'd have to change within spigot itself
you can setup a third party authentication where players can prove they have a premium account by joining a premium server but you would need to manually check each and every players request via a ticket on say, discord
yeah that will take too long
This is voided by the fact someone can just join the server with a random name that is an actual name of another player. Then when the official owner joins their account is taken
You can't fix this
you can't
So stop trying
Yes exactly
So if someone cracked joins with TechnoBlade then the actual TechnoBlade can't join
yeah but I can check before they join if their username is taken by a premium player
using mojang api
if so deny login
You could. But that's a lot of usernames
so theres no way i can differentiate
between cracked and premium
on cracked server
You'd need a server with auth aka either write your own auth into spigot or make an auth server
not via a plugin no
auth server is your best bet
you can set it up to a discord bot too to automate authentication if you really needed that
so can I not have a premium server feed into a cracked server
why not like
run the server in online mode?
and make people actually support the official release
^
offline-mode is mainly for dev testing
because this guy wants cracked
Yeah well he's cracked
Honestly whenever someone comes to my server asking if it's cracked me and the gang start laughing at them. Tell them to buy MC.
yeah im not asking whether server should run in online or offline mode
im asking if its possible
You'd need a server that's online which would be it's own thing to authenticate them
Using a database yes. However, this still doesn't solve your issue
People would still be able to take legit players names
Auth server -> Have player join -> on player join generate a code for them to use -> have a command to /link discord -> have a discord bot inside your plugin that sends them a DM if theyre in your server
Cracked server received code + username -> player authenticates with code from auth server -> have that player be able to overwrite the /login password set in case someone previously joined on theyre account
voila
youll need to link the auth codes with a database like mike said
This still doesn't solve the issue that offline can steal online names
it does because if someone tried to use that account they cant /login anymore
technically with this method
online player would steal cracked players accounts
which is fine
iirc AuthMeReloaded has an API to reset /login passwords
When a server is in offline mode there is no authentication
i dont have to authenticate
i can just check if a premium account
with the same name exists
if so deny entry
so if i join your server with the name notch
and you request notch to mojang api
its gonna come back as premium
yes
you dont see the issue here?
thats what im saying cracked players with premium names
are just not allowed
in the server
many other names to choose from
so you would need auth server like i explained above
You'd have to get offline player every time someone joins which people could use to effectively DDoS the server
i know
?
they just need to pretend to join with hundreds of accounts and boom server offline
OfflinePlayer is pretty resource intensive
And it still doesn't solve the problem
you could send the players name to mojang and if the account comes back as premium just kick them saying to change name
wait
no
thats what i just said
theres really just not a good way to handle it
only way to do this is via using a auth server
just send in your login
But how do you know it's a premium user unless they authenticate on a legit server
Which is just so much work
thats what im saying
yeah thats why i said no that clicked in my brain last moment haha
Can you imagine joining hypixel and seeing some nonsense like that?
Your best bet is to have a system similar to this
You're going to kill interest in the server
it will kick them
any other way simply isnt going to work
and tell them to join the auth server if they're actually premium or change name
I can't imagine the amount of players who'd hate to do the authentication game
Imagine needing to change name -> attempt to join -> name taken -> repeat
I'd just give up and not play your server
^
not my server
Yeah no shit
yeah
you would
https://cdn.discordapp.com/emojis/535240040503312392.gif?size=96&quality=lossless


Sometimes server owners don't know what's best for themselves 
its my support server

@vocal cloud contribute https://github.com/Luziferium/the-cipher-project
i dont even know why people run offline move servers anymore
oh lemme create main class
btw
check your thread
wait
Cause they think it'll generate money. It's kinda sad ngl
I have the best sticker
The server owner doesn't use the sticker slots so I stole them and they're mine
if it is the rich presence
you can simply ask to it to reload
tools -> discord -> something related to reload
maybe you simply did not allowed that
main
or
adjust it
misconfig
in the settings
Main main = new Main();
main main = new main();
what will you call it
aaaaa
okay was about to say
better
Cipher
main main = new main();
main.main(main);
doing it rn
im using up part of my 35 lines for this
better be grateful
i prefer to use the intellij template thing
if it didn't crash all the time that'd be great
it is better
intellij template be like
i generated mine in between sending messages
pom doesn't count
^
or does it?
technically its also lines of code
pom shouldnt count
because if it did
im already waaaay over
and i havent even written anything yet
lmao
this is already aids
wait
wait
minecraft plugin did that
weird
not really you just remove final lmao
hell yeah 4 lines
31 more to work with
look
im saving lines
i gotta do what i gotta do
yes
thats the point 
were likely gonna make some type of rule for that
something along the lines of no more than 200 or so chars per line
if someone wants to use 3 lines to create a class thats on them
not hard just name them what they do
seems fine to be but uh
DoubleOrNothing lmao
funny name
ohhh
i thought it was like a class for checking if something is a Double
can be useful so your not always parsing and catching NumberFormatException
tbh i thought it was a class that would return a parsed double or nothing (null)
seemed clever to me
i just saw something funny and focused on that lmao
Question about records: I know they cant extend classes but is there any other limitations of using record classes?
Is there any other "disadvantages" to using record classes?
you cant create variables outside the constructor
you can only create static final variables
actually, not final
but it must be static
They're immutable so you only use them as a record not as a mutable type
public record MyClass(int var1) {
private static int myVar;
}```
records are pretty useful
Yeah i use them for api things currently rn, i was just wondering if i could use them so i didnt have to manually create constructors
but in order to DTOs/value objects it will safe lines
good way of making the project attractive
how do I make console output colors? some other plugins do it but mine it just outputs §dName: instead of a colored 'Name:'. I'm concatenating the string using ChatColor.x + "Name:"
Bukkit.getConsoleSender().sendMessage(ChatColor.RED + "No");
instead of using the logger
right so are we SURE there's no timed dialogue api cause this scheduling is kinda disgusting
§ supremacy
only doing it to make variables look more obvious, so things like "yes"/"no"/"live" etc are coloured, nothing else
thank u ily
Dm07
WizarldyBump17
or ChatColor.translateAlternateColorCodes('&', string);
I have more men then u ❤️
and your string can just use &6hi
that could work
thank ❤️
not when you're a bottom
I accept being the beta
it is
I am the bitches 😎
so you consider yourself as being multiple people?
uhm I resorted to using this instead ```java
List<String> messages = new ArrayList<>();
messages.add("Hey!");
messages.add("You there, " + player.getName() + "!");
messages.add("You're new around here, aren't you?");
messages.add("Come here so that I can show you some jobs");
scheduler.scheduleSyncDelayedTask(plugin, new Runnable() {
@Override
public void run() {
if(messages.size() == 0) return;
player.sendMessage(messages.get(0));
messages.remove(0);
Runnable r = this;
scheduler.scheduleSyncDelayedTask(plugin, new Runnable() {
@Override
public void run() {
r.run();
}
}, 20L);
}
}, 20L);```
lambda brrrr
sir we don't associate with lamas around here
😶
actually after seeing some lambdas in python two years ago I decided to never learn about lambdas
You're new around here, aren't you?
yeah
Come here so that I can show you some jobs
ah i forgot the you there player.getName
what are you trying to do lol
that code looks weird
why two runnables then?
well I was planning on using recursion but the issue with that is that whenever I called itself it didnt re-schedule itself it just executed itself immediately
what in the flying flippety fuck are you trying to do, mister?
i guess you want to send all those messages with a one second delay in between them
yeah
will do ty
yesh
hey guys
package we.are.project.cipher;import org.bukkit.entity.Damageable;import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;import org.bukkit.event.entity.EntitySpawnEvent;import org.bukkit.plugin.java.JavaPlugin;
public class ProjectCipher extends JavaPlugin implements Listener {
@Override public void onEnable() {this.saveDefaultConfig(); this.getServer().getPluginManager().registerEvents(this, this);}@Override public void onDisable() {}
@EventHandler public void onSpawn(final EntitySpawnEvent event) {
if (!this.getConfig().getStringList("DoubleHealthMobs").contains(event.getEntityType().name()) && !(event.getEntity() instanceof Damageable)) return;((Damageable) event.getEntity()).setHealth(((Damageable) event.getEntity()).getHealth() * 2);}}
Any ideas on how to make my code cleaner
no
dont doubt project cipher
best plugin 2022 incoming
#961533327435788348 you should come contribute bush
🤷
to prevent people from putting 200 lines of code on one line
could use lambdas though
oh wait
@hybrid spoke
nice begin
Its allowed to have up to 3 semicolons
darn
so you can have one two or three haha
what even is it lol
im still confused lol, too many messages
i sent the repo check the readme.md for full description
basically each contributor can only have 35 lines of code
you can steal lines from people if you find a mistake they made in a sense
and let yourself have more lines to work with
awesome! the more people involved i feel the more fun it will be :p
i wanna see devs get mad at each other for managing to steal lines from them lmfao
essentially all out war, and theres no end goal so you can essentially add into the plugin whatever you like
oh shit
and just add extra semicolons on the end of your line
LOL
and force people to use a new line LMAO
im so doing that
if the persons smart they could remove it
but thats fucking hilarious
but people may not think of it
oh yeah
yea but is it a "reasonable change"
my dumbass would've just created a new line
if it decreases line count, its considered one in my books
just dont remove peoples code all out like removing theyre whole system
i would accept it if it has anything to do with your change
;-;
but we somehow have to count the lines
we should make contributers keep count of theyre own lines tbh
maybe in readme.md
there can be a section for it
until we make some type of bot
i just read that whole thread lmao
its hilarious
not it for making that
"KABOOM - 10 players left"

gg wp
also changing entity max health is changed by using attributes smh
thats more lines to add
you can use the deprecated method
i couullld
reject oop
hold on im creating a really aids way to do this without deprecated methods
also @hybrid spoke that could be a decent rule to spice things up
no deprecated methods

reflections 💀
feels like code golf
Objects.requireNonNull(((LivingEntity) event.getEntity()).getAttribute(Attribute.GENERIC_MAX_HEALTH)).setBaseValue(((LivingEntity) event.getEntity()).getAttribute(Attribute.GENERIC_MAX_HEALTH).getBaseValue() * 2)
💀
even null checks too lets go
this is fuckin aids
but funny
imagine someone just requests a feature
and you have to do it with less lines as possible
lol giving away a certain amount of lines for successful implemented feature requests
as motivation
or more like salary
?giveaway run 3d 10 lines of code
React to enter
"follow us on instagram and like our latest picture to get a chance of winning 100 lines of code!"
kek
react to enter
yes
Why not use world edit api?
if we ever release this plugin
"idk exactly what this plugin does, my current stand is something in the direction of factions"
literally speedrun the cipher project
so far i spend 2 hours working on a single package of my core
so then i can start working on it
what that
is the information if a player is an admin stored in the player file?
the actual info
Why would you want to open the file?
op: true
just Player.isOp()
i dont think so
ops are stored in ops.json
oh is it yml
ah
idk
json
i use my own op system to set ops, and the server works fine with it
but its not written to the ops.json
so like your own permission system basically
reflections kek
ya
but .setOp(...) works fine
also beyond server restarts
but the ops.json isnt touched
so the actual info must be stored somewhere welse
else
then see the code of craftbukit
its stored in the ops json and .setOp() accesses the api
to write to the ops file
however setting an offline player op seems to work by the api but to store the player incorrectly in said file
and then breaks the /deop autocomplete returning a null error
because the player name doesnt get stored
apparently
💀
[
{
"uuid": "...",
"name": "TheTimeee",
"level": 4,
"bypassesPlayerLimit": false
},
{
"uuid": "...",
"level": 4,
"bypassesPlayerLimit": false
}
]
``` The First is what happens when you .setOp(true) an OfflinePlayer instance who is on the player, the second if you do it to a player who is offline
then when the parser tries to read it again, it breaks
💀
great answer
i know
I need some help bungeecord side, i need to check if player is banned in an specified subserver, how i'm supposed to check that?
so how can i set a player op from an OfflinePlayer instance who is actually offline?
then this happens
or save his uuid
and it breaks the servers parser
and when he joins, set the op
hm
Actually i can't, it is a public plugin
setOp is derived from PermissibleBase, which is not found in an OfflinePlayer. It is only on Player
Your second entry is missing the players name
well
if a player tries to join in a server where he is banned
he not even see the login screen
so maybe there is something for that
so setting a player op only works properly for online players?
otherwise fills certain fields with null?
iknow
assert worldName != null;
World world = getServer().getWorld(worldName);
world is null
even though worldname aint null and it exists
is it cuz im importing static getServer() from Bukkit
right name?
ye
but you do know that assert only applies if you explicit state it when starting the JVM?
just discontinue it and start working on #961533327435788348
bro u seen this
ill do the same
LOL
@hybrid spoke lines of code can easily be abused
LOL
ok so i have
public class RecipeMatchTree implements NodeLike {
// ...
public interface NodeLike {
// ...
}
public static class Node implements NodeLike {
// ...
}
}
``` why is this giving me some weird `cyclic inheritance` error
how do I make cuboid region
i mean ur implementing urself
no its implementing NodeLike not itself
BoundingBox
its static tho
still
how?
k
new BoundingBox(x1, y1, z1, x2, y2, z2);
i lf a way to call methods the same as onLoad(), so before the plugins event callbacks are beeing hooked
or in this case after they've been unhooked
in what way
can I cancel a task from within itself?
I was originally gonna do java BukkitTask t = scheduler.runTaskTimer(plugin, () -> { t.cancel(); }, 20L, 20L); but that throws variable t might not have been initialized and I dont seem to have access to this.cancel() so is there another way or I should just call an external function to handle that
use BukkitRunnable
well that still has the same issue
oh I also get incompatible types: org.bukkit.scheduler.BukkitTask cannot be converted to int
guess I gotta use BukkitRunnable
rip
okay so i store the offline players in ram now using a hashmap
ive calculated that per 10k accounts i use 0.85MB ram
i doubt thats gonna be a problem anytime soon
ram is cool and all but its not persistent
thats about yesterday



