#help-development
1 messages Β· Page 2184 of 1
boolean[] bools = { true, false, true };
bools[0] = false; == bools << 1;
Yeah, it just doesn't make sense to index anything smaller than that
That's not how it works lol
So does it store it as 111111111
Or 00000001
The checks to determine if a bit shift would result in the desired mutation would take longer than just making the mutation normally
The reason it takes a bit longer to access is because you need to do 3 operations rather than 1 to mutate a boolean in that kind of setup
You have to read the value, flip the individual bit, then write the value back into memory
Whereas with a regular boolean you only have to write the value into memory
Reads are faster than writes so the difference won't be huge
Wtf is that
?
Anyways I'm gonna go get ice cream for real now
what ice cream
agreed
public Void a() {
return Void.valueOf(b());
}
public void b() {
return void;
}
kotlin π
it should return a String
Kotlin users are the Python users of Java
true
@crisp steeple
return void lol
what is happening
java
does anyone know why does CraftBUkkit still have the version in the package name?
To ensure that developers are updating their code between versions if they insist on using NMS
hm that's a pity
ok but if code runs on server jar then why bother?
final Field profileField = skullMeta.getClass().getDeclaredField("profile");
this could look so much cleaner when there was no version in the package name in CraftSkullMeta
(And yes, I know that meanwhile PlayerProfile exists, it was just an example π )
Beat me to it lol
if spigot would now also add a method to send the totem animation, I could get rid of NMS and craftbukkit code almost completely π
I mean π PRs are open
yeah I wish I could do that but
I don't know how that animation is sent though. I'd imagine it's an effect
when I clone the repo from stash, I always get some weird errors when building. I don't remember them right now
people always told me to just use the code that buildtools generates but that seems like a dirty workaround lol
i'll try it again tomorrow
Hm. It's not an effect. Lemme browse the item
an effect? wdym?
the totem animation?
that's simply a packet
this is my 1.18 NMS code to send the totem thing
@Override
public void playTotemAnimation(final @NotNull org.bukkit.entity.Player player) {
final ServerPlayer entityPlayer = ((CraftPlayer) player).getHandle();
final Packet<?> packet = new ClientboundEntityEventPacket(entityPlayer, (byte) 35);
final Connection playerConnection = entityPlayer.connection.connection;
playerConnection.send(packet);
}
at java.base/java.lang.Class.getConstructor0(Class.java:3585)
at java.base/java.lang.Class.getConstructor(Class.java:2271)``` ```java
public record Provider(String name, String description) {
}
``` kinda confused why this method is giving me an error first time using records so
we love magic numbers
that's not my fault :<
mojang decided to use 35 for totem animatino
whats your java version
wouldn't they get a "Unknown ... major minor version" message if that'd be the problem?
entity.playEffect(EntityEffect.TOTEM_RESURRECT);
is that new?
did this exist in 1.16?
anyway, thanks, that's nice!
one method less to have to update for every release :3
oh shit
So that's like 1.10 or something
lol
niiiice then I can completely get rid of the whole NMS thing for that. thanks
That effect was added in 1.11 though so it's really not too far out
tbh I only found out that EntityEffects exist when I decompiled some totally shitty plugin a few months ago lol
Yeah they're underused
there should be some kind of blog
Effect and EntityEffect
that announces new API features
that would definitely be useful
I also only found out about PlayerProfiles by accident
maybe I'll suggest this on the forums. can't hurt to suggest it π
PlayerProfile was probably only a couple months ago, so it's easy to miss that
it was in 1.18 definitely
md tries to state notable additions in majors, but between majors, those often get overlooked
17
yeah exactly, I'd love if we have a forums thread where people (or md if he has time) will simply reply with
"yo we now added PlayerProfile class"
Is there any way to get a player's Mojang UUID?
Player#getUniqueId()?
That returns an entity ID
unless server is offline getUniqueId will
a thread in the forums would be more than enough to announce new features I guess, so not really much work for anyone
That isn't even in the Player class
but a huge benefit for users
idk what API you're using then
because getUniqueId() is part of Entity, from which Player inherits lol
Is it because im java 17 im getting that error?
It's in that, but the javadoc is
Returns a unique and persistent id for this entity
Returns:
unique id
I know
for players it will return the "actual mojang" id
pretty sure a record cant be a function
for everything else it'll be a more or less random UUID
huh? of course you can "return" a record
no shit
I don't really understand what you're talking about
you cant return class
its like doing public class test(etc){} as a method
wtf
are you drunk or sth lol
what are you talking about
being drunk is my job and I'm not drunk
youre not catching my flow lol
So what something like public record Provider(String name, String description) { public String getName() { return switch (name) { case "t" -> "WA"; case "e" -> "LOO"; default -> "Unknown"; }; } }
unfortunately not lol
that makes no sense
yeah
okay okay it's just an example
who the fuck are you
who the fuck are you
π
ugh I still get the error
have you even sent your actual code yet
im not even gonna bother
why do you have a switch statement for a variable inside your record?
IT WAS JUST AN EXAMPLE
you just said
_
for this not the example
that's all you have and its giving that error?
dude thats not even the class thats mentioned in the error
com.test.base.command.commands.TestCommand.<init>
public record Provider
lmao
idk whats worse the fact that he provided the wrong class or that his record is named Provider
nice job follow the class and method naming conventions if that's what those are supposed to be
what
for (ClassInfo cls : result.getAllClasses()) {
Class<?> loadClass = cls.loadClass();
if (!loadClass.getName().contains("Command")) continue;
Constructor<?> cons = loadClass.getConstructor();
cons.newInstance();
tf
it clearly states whats wrong in the error message
im so fucking confused
throw away your entire project
why lmao
lmao
What is that for?
initializing classes with ClassInfo
why
You gotta give us more
Because it's nice
this is def an XY problem
fr
?xy
Asking about your attempted solution rather than your actual problem
i think they just smoked too much or too few crack
lmao
too few
It was working when I had the project in jdk 1.8 but ever since I switched it over to java 17 it just broke
You are asking an issue about Y (which doesn't really make sense), which is an attempt to solve issue X
Well whats your goal?
Here
To not have that error and learn how I can fix it
that isnt the true goal tho
Dude you're gonna have to give us more than that
how do i return void
Please send us like
Maybe ClassInfo doesn't support jdk 17
are you completely ignoring what we are asking
yes they are
no
you are tho
@SneakyThrows
public void initialize() {
ScanResult result = new ClassGraph().acceptPackages("com.test.base.command.commands").scan();
for (ClassInfo cls : result.getAllClasses()) {
Class<?> loadClass = cls.loadClass();
if (!loadClass.getName().contains("Command")) continue;
Constructor<?> cons = loadClass.getConstructor();
cons.newInstance();
}
}
No just thinking
my guy
Can you explain what your code does?
Instead of using that hacky strategy, just make a collection of all your commands
Rather than doing a hacky init strategy
to create a new instance of all of them
also this can be slow too
just sayin
wtf
all you have to do is type maybe 5 lines of code
instead you write all of this (Horrible) reflection bs
that doesnt even work
reflection is awesome but you're abusing it for stuff that doesn't erquire it. your way is hacky, dirty, prone to errors, and simply sucks. and not in the good way
Something like
Set.of(new CommandOne(plugin), new CommandTwo(plugin)...)
Then do whatever you need to do
hey guys, any idea on how I can affect the amount of knockback a player would get?
or just fucking write maybe 25 columns of code per command, dont even have to if you have copilot
uh
ya lol
You can listen to entity damage event and modify vector
But then the list will be long
bro π
bro
you've gotta be trolling
I already made a EntityDamageByEntityEvent listener, how would I modify the vector?
setVelocity
at least check if it extends commandexecutor instead of the checking the name π
i honestly given up on using built in one and just use a library cause its easier
My system is fine just slighty broken
method of which class?
Player
its not fine
well
its shit and unnecessary
Entity technically
slightly broken != fine
It's not shit
yes it is
from the current shit we see, it is
instead of writing
getCommand("a").setExecutor(new MyCommandA());
getCommand("b").setExecutor(new MyCommandB());
...
he writes
@SneakyThrows
public void initialize() {
ScanResult result = new ClassGraph().acceptPackages("com.test.base.command.commands").scan();
for (ClassInfo cls : result.getAllClasses()) {
Class<?> loadClass = cls.loadClass();
if (!loadClass.getName().contains("Command")) continue;
Constructor<?> cons = loadClass.getConstructor();
cons.newInstance();
}
}
It's not for a mc plugin....
so is a parameter of 2 a knockback of 2 blocks?
not necessarily
im almost 100% sure your method is still shit
its a vector one second
@limber mica whats it for
why are you asking in the spigot discord then lol
Sorry, don't know what that is
discord bot
Because I'm allowed too
why are you asking here tf
Something like
p.setVelocity(damager.getLocation().getDirection().setY(0).normalize().multiply(5));
go to the JDA or javacord discord
haha yeah
classic
nobody really likes to do math so i just decided to spoonfeed ig
But yeah play around with the values
listen to the event
ah yes, iβm allowed to ask how to make a discord bot in the spigot discord so that means i should
FUCKING HELL
what's wrong with that? I both asked and answered a shit ton of JDA questions here lol
?paste Put it in a fucking paste you are filling this entire channel
Chunk getEntities call java.lang.Throwable: null
damn 
what happened? I was afk for 3 seconds
so uh
dude posted an entire big ass stacktrace and code
more of the fact that you would expect βcommandβ being used in the spigot discord as a spigot commandexecutor
true
im looking through the jda and i see this
private byte[] generateNonce() {
long nonce = this.nonce.get();
byte [] n = new byte[nonceLength];
for (int i = 0; i < nonceLength; i += 8) {
n[i+0] = (byte) (nonce>>> 0);
n[i+1] = (byte) (nonce>>> 8);
n[i+2] = (byte) (nonce>>>16);
n[i+3] = (byte) (nonce>>>24);
n[i+4] = (byte) (nonce>>>32);
n[i+5] = (byte) (nonce>>>40);
n[i+6] = (byte) (nonce>>>48);
n[i+7] = (byte) (nonce>>>56);
}
return n;
}
lmao
what is this
they couldve just wrote a loop inside of the loop
generateNonce
thats what i thought
generate pedophile
imma pr that
Don't
y not
i dislike jda
It's most likely that way for a reason
I dislike javacord
whut wtf lol
nonce
we need a good java discord api
british
Optional<Pedophile>
lmao
let's hope that it's not present
yes, avoiding a loop for a micro micro micro micro optimization
π
I mean
wtf is going on here
.ifPresentOrElse
Yeah basically
thread local random 1 in 5, if you are 5 you become pedophile
some people dislike JDA and pedophiles are optional
I have honestly never seen >>> before lol
discussing the odds of a present Optional<Pedophile> generation
:slides_out_of_chat:
optionalPedophile.ifPresent(Person::stab);
you havenβt been saving that 0.00000001 seconds of performance then
ah
Bit shift ignore sign
unsigned bit shift
unsigned in java π
So back to my issue how would I about to fixing this
will keep negative numbers negative
The unsigned right shift operator ">>>" shifts a zero into the leftmost position, while the leftmost position after ">>" depends on sign extension.
But >>> will not
be normal
gonna forget about that in 5 minutes, and never use it
I am normal
I've had to use it before
donβt use google classpath to register commands
i've never used bit shifting except for finding chunks
lol talking about compression. have you seen Monsters Inc?
Yes
yes
who hasnt
I am thinking about the scene where the child gets crushed into a garbage cube
Only used bit shifting to encode messages in images for school lol
I'm not its class graph what im using
How to compress a child
imagine being smart enought to write a compression algorithm
she didnt actually?
It's not as hard as it sounds
yeah I know
actually nvm i can write one, but will it be good?
Probably not compared to what's available
but sully thought that it happened
I'm highly motivated by making tools
It's kind of discouraging how good a lot of existing tools are lol
Hi there, I have this BlockBreakEvent handler, but it never fires when I mine a block. Ideas? ```java
public void onBlockMined(BlockBreakEvent event) {
// Check if the player is mining a block
int randomNumber = (int) (Math.random() * 100) + 1;
log.info("Block RandomTNT: " + randomNumber);
if(randomNumber <= 50) {
plugin.getServer().broadcastMessage(ChatColor.YELLOW + event.getPlayer().getName() + ChatColor.RED + " tried to mine " + event.getBlock().getType().name() + " but got TNT instead!");
// Change the block to a primed TNT block
event.getPlayer().getWorld().spawnEntity(event.getBlock().getLocation(), org.bukkit.entity.EntityType.PRIMED_TNT);
} else {
return;
}
}```
I can write my own but often they will not be useful
I've managed to take a few niches though
yeah kinda hard to compete with the rest of humanity
did you forget @EventHandler ?
- Did you annotate it with EventHandler
- Did you register it
omg
lol
Sometimes you do manage to come out on top and it feels amazing though
def didnt
I'm tired lmao
we all do it
thanks
I, more than most
just smoke some crack
Making minecraft cursed
cant say the same
:)
Keep at it and you will
There are TONS of different niches to be filled
why arent you importing EntityType, also not saving event.getBlock or event.getPlayer as variables
dont even want to say how many times ive forgot an annotation or forgot to register it
i do this for fun tbh
You can be good at cs without being a cs student
hello a med student, i'm mfnalex
the drunk lawyer who has never lost a case
I'm evil. java @EventHandler public void shootBowEvent(ProjectileLaunchEvent event) { Projectile proj = event.getEntity(); float offX = ((random.nextFloat()) - 0.5f); float offY = ((random.nextFloat()) - 0.5f); float offZ = ((random.nextFloat()) - 0.5f); proj.setVelocity(proj.getVelocity().add(new Vector(offX, offY, offZ))); }
Jeff Winger
I'll soon be a flight instructor! And I'm not even drunk right now
LOL
@tender shard are you Saul Goodman
right now
it's spelt "imajin"
This is actually cool
Evil is under what this is
time for me to get sleep, and as always, fuck you Imajin β€οΈ
wholesome
goodnight and fuck you @dusk flicker !
@EventHandler
public void onMove(PlayerMoveEvent e) {
Location to = e.getTo();
to.setPitch(Math.random() * 360);
to.setYaw(Math.random() * 180);
e.setTo(to);
}```
good night and fuck you imajin β€οΈ
LMAO
oh my
hold up
you should run it
I wish I could hate imajin but he's so based
eeew
is this a "drunk simulator"
gold
It can barely handle the 3 intellij windows I have open
most based mod
mfnalex simulator
you aint a mod
haha
Helper looking ass
year 2,000 crisis lookin ahh
lool
Having seen lamp I realize the competition in command libraries is actually more fierce now
Lamp looks cooler than most
Lamp commands?
turn on the lamp
You have me there
i was making a plugin that gave a brick called shit to every player whenever the console executed a command
I will make my library cooler accordingly
lol
I use lamp
Lamp commands library is really amazing
/give @a brick{display:{Name:'[{"text":"Shit","italic":false,"color":"#6e1e08","bold":true}]',Lore:['[{"text":"It stinks.","italic":false,"color":"#cc9966"}]']}} 1
fucking hell I need to go through my entire command lib at some point and update it to adventure
I use it as well
I'll make a better one
joke's on you, I got less than 0.5β°
It's in the works
lol
Already shaping up
im a main contributor
It's not gonna be ready for a bit longer but it's getting there
Good way to get people to not use the library
fuck you
what is that? "No description ... provided"
lamp is poorly documented
lol
i have to ask questions in the discord alot
Lamp docs suck someone needs to make then
so pls document urs
just imajin what'd happen if everyone would actually go fuck themselves whenever they were told to. everyone would be so unproductive
Honestly it's really great, it works amazing and is unlike any other command library
to the point of finishing? i could drain everyone
Only issue is the internals suck and it's unmaintanable, hence the new library
how to get easy commits onto intellij
@tender shard go fuck yourself
I'd spend most of my day doing this
The new one is going to be largely similar to the old one
ok brb
@waxen plinth go fuck yourself
done
later
that took long
Again!
Imajin has said fuck 547 times
Too busy self-promoting now
Buy my merch
Only 547 fucking hell
Lol
I'm making a plugin and i basically have to copy code from another project but im too lazy to do it
Also holy shit I can't believe this has 71 commits already
I'm committing to it much more frequently than normal
547? no it's 4:57
For most projects I write like 200 lines and commit it all at once lol
For this one I've been committing every time I make a minor change
It's 9:58
lmao for my own projects i pretty much write whatever and commit before i head offline
That very bright section at the end is Ordinate
im surprised actually
Yea that's what I usually do too
opticfusion has mentioned "malware" 1310 times lol
fucked myself over once though
I'm taking it much slower with this project though
had to rollback
I've lost hours of work from a mistyped git command
switched branches improperly in intellij
Been there. Had to decompile a jar and pull my old code out.
i swear intellij runs git commands with unneeded arguments sometimes
THATS WHAT SHE SAID
My favorite part about when I had intellij was uninstalling it
same that was annoying asf
idk git so i rely solely on intellij
I then shared it with someone and they were very confused with why everything looked so weird and why things were named the way they were
noone?! ugh
When you learn git well it's a super powerful tool
Alex my flag is better ngl
Of course I never really use it like that because all my projects are solo
btw should i obfuscate my premium plugin?
No
same
Nah
Fuck obfuscation
what flag?
Open source your premium plugin π§
@waxen plinth copilot made this for me
or don't and be able to pay your rent
the whole thing
Make the plugin open source, don't offer support to those who don't buy it
And don't distribute the compiled jar for free
It works
I mean, premium plugins, ehh
They're hard to make money on
I did a lot of commissions
π¨π³
China
my flag has more colors
π³οΈβπ
Add an option to invert it
πΊπΈ my flag has more lines
[^a-z]
github copilut?
i think i signed up for that and got in
He's making a RedLex clone
and school shootings lol
shut the fuck up
π₯±
I just like the colors
oh yeah
looks like some trans flag
thats the bi flag
oh
you die
do it

I gotta see what it looks like
ahem
i should have known that
RIP
fuck myself
Ayo there's an wmoji lmao
The asexual spectrum flag has no right to be as aesthetic as it is
when they walk adjust their velocity
im not even gay and i know the lgbt better than u
I know nothing about that scene
Like this is so visually appealing
I didnt even know that it's pride month rn

Hence why it is my background
Asexual flag is nice too but asexual spectrum flag is great
I'm just a big fan of purple
hve you seen minestom?
I give myself a purple role in every server I can
your name literally has Red in it, liar
I only knew because kids from my school post a bunch of homophobic shit all pride month
yeah ffs what a jerk
they probably won't have any friends anymore in 10 years
when you log on to spigot and think someone reviewed your plugin or something exciting happened
They will how it works here in the middle of nowhere less likely you find someone who isn't homophobic then is. We are also really religious in my area which lends to jt
that sounds like @waxen plinth 's highschool years 
the people who were the most popular in my class are now the biggest losers lol
the nerds are making the most money meanwhile
bass shop
yeah LOL
No one likes the country bumpkins at my school lol
The nerds are the popular kids where I go lol
and then there's me who was neither popular nor hated but I still don't have money lol
Nah my school was pretty accepting
my school is accepting
got the worst of both worlds
All the top athletes are straight A students lmao
there was a non binary person in my english class this year their fits were awful bruh
they were chill tho
just had awful drip
My drip is fire as fuck
I dont undertsand anything. fits? drip?
Outfits
aah
cant explain drip to someone unless they have it
I will check urban dictionary
read the readme then look at the code
adjective to describe your outfit similar to swag, sauce, steez, swank
Goodbye time to sleep
how were you not able to explain this?
π¨π³ π π¨π³
clearly you have no drip
maybe but I had 2 STDs this year, if that counts
yml, the worlds best database system
respect π―
read the Editing section
Nothing happened on June 4th of 1989 in China
I saw that
So I've gotten multiple keys from a json how can I add them automatically to options in a slash command without adding each one manually?
LOL
Truly ascended
wdym? tab complete?
bro
that's why imade this
it's spelt "imajin" and not "imade"
cuz it has a bug for the longest while that he coudlnt fix
No options
lmao
util saves data btw https://github.com/RRS-9747/EnderPlus/blob/main/src/main/java/me/rrs/Util/Util.java
with static fields
why the heck are all those methods non-static?
that makes no sense at all
not my plugin bro
anyway they were weird
that's "advanced java"
π
what's wrong about that?
the funny thing is that the try/catch only has player.playSound inside
what are they trying to catch? PlayerDidntLikeThisSoundException?
1.8-1.12 sound names
o0
wouldnt even work since its not catching an exception lol
of course it does
Β―_(γ)_/Β―
throwable
this application is not reasonable according to java documentation
this is making me want to look back at my old projects but they all got deleted because intellij decided to be stupid
found one of them
damn i really was not happy
its an incredibly advanced technique
most people arent smart enough to understand it
nice
not the ugly stuff java has
Join the dark side, write backend code only
i agree
public static void z() {
try {
while (true) new Thread(Main::z).start();
} catch (StackOverflowError | OutOfMemoryError e) {
z();
}
}
my city is flourishing
:() { :& :& };:
btw I'm thinking of a plugin where people can 'call' each other in mc
most readable c++ code
Oh my god
a call just means all chat messages that aplayer sends goes to the player in the call
I'm imagining it listening in on their mic and translating the sounds into note block sounds
lmao
no no
that'll sound like the talking piano
wouldnt you also need a client for that
I've seen that before
It was called /pmtoggle
You'd just do /pmtoggle <username> and then it would direct all your messages to that player's private messages
yeah but i also want there to be group calls
i guess i can have a PhoneCall object that stores uuid of participants
and map uuid to phonecall?
for each player?
That's the easy part. The harder part is that I want to have an Admin channel that player can call
I would model it like this
when u call the admin channel, player can connect to any one admin
private Map<String, Set<UUID>> callMembers;
private Map<UUID, String> activeCalls;```
Something like that
I could whip that up in a few minutes with my config + command library if I was on my desktop
It has my plugin template which skips all the annoying setup
It's not hard to implement, Im just thinking of how i should go about it
Don't forget to create a preset of ringtone too lmao
Map of players in a channel would be fine
I ACTUALLY HAVE ONE
hahahahaha
pog
sometimes the sounds come in a bit late and it sounds weird
not sure why that happens because it's a localhost server
i waas running intellij, my bungee and test server and mc
Something in your computer is experiencing a delay
Or youβre having a mini stroke lol
so could be that
Splegg.getInstance().getSongHandler().addPlayer(player);
Splegg.getInstance().getSongHandler().resume();
System.out.println(Splegg.getInstance().getSongHandler().getSongPlayer().isPlaying());
System.out.println(Splegg.getInstance().getSongHandler().getSongPlayer().getPlayerUUIDs());
System.out.println(Splegg.getInstance().getSongHandler().getSongPlayer().getPlaylist().getSongList());
||ignore all of the method calls I was doing it quick for debugging||
I'm not hearing anything in-game despite the fact that it says it's playing and my UUID is in the list.
can we see your resume method?
it just sets the playing to true
well can we see what plays the song?
like the songhandler class?
yeah
if u wanna paste the entire thing, that works too
Lol
well then we need to see the songplayer
π
wdym
ah
public void registerSongHandler(){
Song song1 = NBSDecoder.parse(new File("plugins/Songs/Windy.nbs"));
Song song2 = NBSDecoder.parse(new File("plugins/Songs/Pirates.nbs"));
Song song3 = NBSDecoder.parse(new File("plugins/Songs/IndianaJones.nbs"));
Song song4 = NBSDecoder.parse(new File("plugins/Songs/Megalovania.nbs"));
Song song5 = NBSDecoder.parse(new File("plugins/Songs/Clocks.nbs"));
Playlist playlist = new Playlist(song1, song2, song3, song4, song5);
this.songHandler = new SongHandler(new RadioSongPlayer(playlist));
}
that's noteblockapi
oh
songhandler is my only thing
I tested the api using a skript addon beforehand just to listen to the songs before deciding if I wanted to use it in my plugin
so maybe youre not using that properly, cant say
I tested it on a 1.17 server
the only thing I can think of is the version
(the server version my plugin was tested on is 1.18.2)
yes
unchanged from when I tested it earlier
I'm not sure I can test it on 1.17
it would be an extreme pain as I use methods provided by the 1.18 paper api
Change api-version to 1.17
ah
does it play for the other player that is listening?
no
@humble tulip @waxen plinth More :)
cursed minecraft
i vouch for that to be a public plugin
its going to
first person to beat minecraft with EVERYTHING ENABLED
and have VIDEO PROOF
20 USD PayPal
yup
should've made it a mod but a plugin works ig
post it with no documentation
just that it's a troll plugin
more power
package me.rudiemc.plugins.holoplus;
import me.rudiemc.plugins.holoplus.Commands.CreateHolo;
import org.bukkit.configuration.file.FileConfiguration;
import org.bukkit.configuration.file.YamlConfiguration;
import org.bukkit.plugin.java.JavaPlugin;
import java.io.File;
import java.io.IOException;
public final class HoloPlus extends JavaPlugin {
public void saveCustomYml(FileConfiguration ymlConfig, File ymlFile) {
try {
ymlConfig.save(ymlFile);
} catch (IOException e) {
e.printStackTrace();
}
}
public static JavaPlugin plugin() {
return getPlugin(HoloPlus.class);
}
public static File configuration;
@Override
public void onEnable() {
// Saving config
getConfig().options().copyDefaults();
saveDefaultConfig();
// Other
configuration = new File(plugin().getDataFolder(), "./holos.yml");
saveCustomYml(customConfig, configuration);
// Registering Commands
getCommand("createholo").setExecutor(new CreateHolo());
// Registering Listeners
}
error = > public static FileConfiguration customConfig = YamlConfiguration.loadConfiguration(configuration);
}
it says at line 49 that the file cannot be null
how do I fix that?
?pasted
bruh
?paste
:)
@humble tulip I can't believe I did this ```java
public void spawnEvent(EntitySpawnEvent event)
{
Entity entity = event.getEntity();
Location location = entity.getLocation();
World world = entity.getWorld();
switch(entity.getType())
{
case BAT:
{
world.spawnEntity(location, EntityType.PRIMED_TNT);
break;
}
}
}
I made bats go boom
that's not v bad though
give me i d e a s
cuz they wont spawn infront of you
it doesn't work on a 1.17.1 server
as a 1.17.1 plugin
hitting a creeper can instanly explode it
I was thinking
hm
honesty, im not sure what's going wrong
you should make it less tbh
so they're confused
The line thatβs erroring is a static variable assignment, so it gets run before onEnable
like 1%
I need it to be static because I need that variable in my other files
This is correct
You can create getters
and get it in your other classes
?di
Guide to dependency injection: https://www.spigotmc.org/wiki/using-dependency-injection/
Will try
pass your plugin instance and use getters
i want to send an inventory to a player who is already in an inventory, but without having the InventoryCloseEvent fire
make it non static
true
cant you just open it?
ah
i think
Pretty sure you canβt do it without firing the event
why dont u want it to call the event?
I mean you might be able to if you hacked around with packets and NMS but I donβt know how far you want to take this
because my inventory has multiple "pages" but i also need to check when the player closes the inventory
well if they open a next page, add them to a set, and when the inventorycloseevent is fired, if theyre in the set, u can ignore it
Simple solution, unregister the previous page before you register the next one
Yeah that works too
:v
but they can close the inventory on any page
They can
i know
so how do i check when the actually closed it vs when they switched page
but when they wanna go to a next page
u put them in the set
and remove them when the inventorycloseevent is fired
But when they proceed to a next page they canβt close the inventory in between the previous page closing and the next page opening
so when they actually close it, they wont be in the set cuz they didnt try to go to a next page
@humble tulip
yes
How do I access a non-static variable which is located outside my getter?
@humble tulip I'm thinking I have to create one per player or smth? though that wouldn't really make sense (or add all the players before I start playing)
@EventHandler
public void onJoin(PlayerJoinEvent event){
Song song = NBSDecoder.parse(new File("plugins/Songs/Windy.nbs"));; // Preloaded song
// Create RadioSongPlayer.
RadioSongPlayer rsp = new RadioSongPlayer(song);
// Add player to SongPlayer so he will hear the song.
rsp.addPlayer(event.getPlayer());
// Start RadioSongPlayer playback
rsp.setPlaying(true);
}
because this code - basically copied from the wiki works
and you add the player before in that
Is the player set up to loop?
Is there a chance the song is just over by the time your player gets added to it?
and in the other classes
no there are multiple songs in the playlist assigned to the songplayer
and I join pretty much when the server starts (when the player is initialized & started)
FileConfiguration customConfig = YamlConfiguration.loadConfiguration(configuration);
public static FileConfiguration getCustomConfig() {
return customConfig;
}
customConfig isn't accessable inside getCustomConfig()
Sounds like you need to debug more then
Figure out what the example code is doing differently
im pretty new to java
Not a static method, a regular method
and remove static from the getter
But I need to use the getter outside of my main class
You pass your main class around to the other classes when you create them
Guide to dependency injection: https://www.spigotmc.org/wiki/using-dependency-injection/
Does anyone know if there's an option for like maximum spawnable particles in a world or radius?
Like this?
public static JavaPlugin plugin() {
return getPlugin(HoloPlus.class);
}
public FileConfiguration getCustomConfig() {
Plugin p = this.plugin();
return p.customConfig;
}
nope
The maximum is how much your PC can handle lmao
ykw
one sec
and what is the name of your main
Than it's weird that my code is not firing
file
Show me
which class needs to get the customConfig tho?
final int points = 18;
final double size = 8;
int upper = 256;
int lower = p.getLocation().getBlockY();
Bukkit.getOnlinePlayers().forEach(all -> {
for (int k = lower; k < upper; k+=4) {
for (int i = 0; i < 360; i += 360 / points) {
final double angle = (i * Math.PI / 180);
final double x = size * Math.cos(angle);
final double z = size * Math.sin(angle);
final Location locnew = p.getLocation().add(x, lower, z);
all.playEffect(locnew, Effect.MOBSPAWNER_FLAMES, 1);
all.playSound(locnew, Sound.ENTITY_ENDERMAN_AMBIENT, 5L, 5L);
}
}
});```
getCustomConfig()
Is the sound playing?
yes which class is calling that method?
ye it's playing but only like once or twice until nothing happens anymore
it's not lagging either
DB.java
Put a sysout for every location you expect it to play something
cuz ur playing the same sound like 360 times
I'm so mad
well db.java is a class
the issue was me setting the sound category
I would tend to agree
That's too much I guess xd
WAY TO MUCH
I would still print it out to test
ye ik
actually much more
Iβve played a crap load of sounds and a crap load of particles to the point where the client freezes
So you can do it
I'll try to print it out give me a sec
Is there a way I can use MiniMessages (from Adventure API) and also have it work with Minecraft color codes?
this is not working
?paste
done
i would have to paste my entire project
then u can do plugin.getCustomConfig
^
ty
are you adding it before you open the page?
yes
well can i see your inv closeevent listener
and the snippet where u open the next page?
theres an error
ok
where?
Where do they get added
db class https://prnt.sc/F9WiImpRIO-T
plugin.getCustomConfig
https://i.imgur.com/zo0fMTl.png here is where they get added, i originally just had a getter and did = on the returned thing to set it but that didn't work so i tried using a setter too but it still doesn't work
nice π
Your client would appear to be filtering it out then yeah
There should be 18 points for every y value
no need to clone
just get and add
damn ily @humble tulip
(1/18D)
remove if contains
ok minion i changed it so there's no clone but it still won't work
why if contains
because then it'll always be like theyre changing pages
liek remove the uuid if it contians it
no because i immediately remove it?
in the inventory close event
When are you removing it
i will move the removing step to there and see what hpapens
we dont see a removing step
yeah it's in a separate place
can you show all your relevant code?
Where is it
no
Show us where the removal is happening
that line WaystoneInteractListener.renderWaystoneGUI() it is removed literally on the first lines
of that method
noo
but it doesn't matter dude
that's why