#help-development
1 messages · Page 333 of 1
what do you mean? so I should addDefault with Material.valueOf?
to convert a string (like "DIRT") to a material, you need Material.valueOf(str)
boils down to the same shit haha
looks terrifying
sorry, Is this meant for me?
yes
Would it make a difference?
well it would be managed better
so you can think less about how it works and just about what to do with it
new BukkitRunnable() {
void run() {
//
cancel();
}
}.runTaskX()```
is the same as
```java
Bukkit.getScheduler().runTaskX(plugin, task -> {
//
task.cancel();
return;
}, delay0, delay1);```
and it looks a lot cleaner to pass in a lambda
doesn't it still think it's a runanble and not a task
what entity for bed explosive/explode?
i use org.bukkit.event.entity.EntityDamageByEntityEvent.getDamager() instanceof org.bukkit.entity.TNTPrimed but get only TNT explode 🥹
i want to know who sleep in bed and explode after that (in the end)?
ugh thats a bit wrong
oh, is it?
future.exceptionally(throwable -> {
e.setLoginResult(AsyncPlayerPreLoginEvent.Result.KICK_OTHER);
e.setKickMessage(ChatColor.RED + "Sorry, We were unable to load your user data. Please contact staff with this error message");
return null;
});
this could run after the event
conclure here to save me again
thats a good point.
Gotcha but doesn't solve my question yet. is what I did the better practice?
you could probably just use ::get or ::join with try catch
No
Calling the main method that controlls the game states from the constructor itself. runnable
exceptionally adds a hook right, so join should wait for all of them to complete no?
Hmmm
Not gonna lie haven't heard of a hook but I assume you mean wait until players join to begin with the logic
yes because it returns a new future
But wouldn't just state.WAITING cover that technically
again, exceptionally returns a new future
Oh didn't know that my bad.,
so do all other methods, but isnt the original future stored in the new one as a completion stage?
ye allg, forget those details myself sometimes even
so joining the last also blocks all hooks added on the other futures
@ivory sleet
@EventHandler(priority = EventPriority.HIGHEST) // make sure other plugins/events have time to deny
public void onLogin(AsyncPlayerPreLoginEvent e) {
if (e.getLoginResult() == AsyncPlayerPreLoginEvent.Result.ALLOWED) {
// if the join-cache already contains player's profile we just return
if (this.joinCache.containsKey(e.getUniqueId())) return;
// blocking
CompletableFuture<UserProfile> future = this.loadProfile(e.getUniqueId());
future.exceptionally((throwable -> {
e.setLoginResult(AsyncPlayerPreLoginEvent.Result.KICK_OTHER);
e.setKickMessage(ChatColor.RED + "Sorry, We were unable to load your user data. Please contact staff with this error message");
return null;
}));
try {
UserProfile profile = future.get();
this.joinCache.put(profile.getUniqueId(), profile);
}catch (ExecutionException | InterruptedException ex) {
ex.printStackTrace();
}
}
}
this should work normally then right?
id probably need a null check after my future.get tho
if im understanding this right
Since it's ? extends T, I'd assume that you're gonna get null on get if exceptionally has been called. But I don't know these fancy APIs.
Not sure what the advantages over a simple try-catch are in this case tho.
I was thinking you could try catch instead of the exceptionally
@EventHandler(priority = EventPriority.HIGHEST) // make sure other plugins/events have time to deny
public void onLogin(AsyncPlayerPreLoginEvent e) {
if (e.getLoginResult() == AsyncPlayerPreLoginEvent.Result.ALLOWED) {
// if the join-cache already contains player's profile we just return
if (this.joinCache.containsKey(e.getUniqueId())) return;
// blocking
CompletableFuture<UserProfile> future = this.loadProfile(e.getUniqueId());
try {
UserProfile profile = future.get();
this.joinCache.put(profile.getUniqueId(), profile);
}catch (ExecutionException | InterruptedException ex) {
e.setLoginResult(AsyncPlayerPreLoginEvent.Result.KICK_OTHER);
e.setKickMessage(ChatColor.RED + "Sorry, We were unable to load your user data. Please contact staff with this error message");
}
}
}
riight. so bassically what i had
haha
mye
well
this.joinCache.put(profile.getUniqueId(), profile);
that should probably go outside
Basically what you had before it has been overcomplicated by others, yes, haha. But I'd add everything to the try-block to kick the player on any exceptions, as you're not going to have the data available if something didn't pass. It doesn't matter why it didn't pass, from the viewpoint of the joining player.
yea, that make sense
not sure about why this tho.
what was the problem now actually?
Me neither
i just had a question about the thread being blocked lmfao
but u no likey my future code
Every new incoming client connection is being handled in a new thread. Blocking this event is totally fine.
Everything else would be insanity. You could get the server to block badly or have others being prevented from joining by just sending the login packet and then never responding again until the socket times out.
No idea why your simple question hasn't been answered right away, but rather your code has been obscured.
it had been answered
but we continues talking about my future code
since i don't know too much about futures
noone knows the future
In the way you're using them in that example, they're completely unnecessary.
what do you mean?
You block anyways, why not just straight up return your value? Why wrap it in another allocated wrapper? What's that good for?
uhhh
bukkitrunnable uses the scheduler methods internally
well its rlly cuz my method that loads the profile returns a future. but aperantly thats not needed either then.
thats why we still have that ancient Consumer
oh but now lambda features have made the bukkit runnables old fashioned?
the only reason to use them would be to extend them in my eyes
You could just return the value and get rid of the overcomplication in this case. That's your decision tho.
Hey I am using this code:
for (int x = -mX; x <= mX; x++) {
for (int y = -(mY - 1); y <= mY; y++) {
for (int z = -mZ; z <= 3; mZ++) {
Block block = loc.clone().subtract(x, -y, z).getBlock();
block.setType(Material.AIR);
}
}
}
That's the part where I replace the cage with air. It gets stuck at the first air block
This is my error: https://pastebin.com/BRJdQKKx
cuz u can basically invoke the instance method cancel() anywhere yk within the BukkitRunnable
could probably achieve the same thing with a runnable but whatever
probably wont do that tho. since if i do that i cant rlly detect what the problem was if something goes wrong.
it will just know the profile is null and could not be loaded
Then bubble up the exceptions? Declare your method as throws Exception.
my first question is why you subtract -y from the location
the method wont always throw an exception when it cannot be loaded.
That's basically the most sane way to achieve error reporting in a language which can only return a single value from methods, xD
How do you handle that in your future then? Do you have some sort of timeout for the future? Otherwise, you'll block forever. Not quite sure how your method actually works without any further details.
Sure thing, it's your code, your quality.
il see what il do maybe il take ur advice idk yet
if u wanna avoid possible dead locks etc, you could use get where u provide a timeout
i do have a timeout
not sure actually
While that's not how a deadlock is being defined, I'm sure it would block until a value is emitted. If you never emit, you're probably stuck forever, until the socket times out.
or until client gives up
Same thing, phrased differently.
ye well in this the deadlock would be caused by a process which is holding one resource and is requesting additional resources which are being held by other stuff
but anyway, get with a timeout is usually a good practice
Is there a way to use a debugger of some sort to run my plugin and then get a postreport of what methods were called, what order, etc?
Like not a breakpoint based debug
Or is the best way just sysout all the methods
Kinda sounds like you want to run a profiler
Tbh, that's what even the best devs do, as it's way faster than to have to instrument all methods. But it completely depends on what you actually want to achieve.
Well I wanna check that my methods are working correctly kinda find out where the logic is messing up
So I assume just sysout
well yeah, if you cant get breakpoints, using prints is the next best thing
You maybe could even make use of hot reloading to not have to reload every time you're adding/deleting/changing souts.
Some fast question i have, what happen if i call the translate method from BungeeCord in a spigot plugin? Im wondering to know because im programming a multi platform plugin and i need to know if its posible something like that
it would probably translate the string just like usual
Because from what i read mc colors and extra (bold, italic, etc) are none platform dependent, so they works both the same for bungee and spigot using the & but i dont wanna write my own parser. Thats the reason i asked if i can use the ChatColor method for translating color in
What's the difference inside a method that has a switch between return and break if it's being ran inside a runnable().
Example:
new BukkitRunnable() {
@Override
public void run() {
activate();
}
}
pubic void activate() {
switch (etcetc) {
< -------------- here return, break difference
}
}
Inside the switch specifically
return- means that the code below wont be executed and will re executeyour code from the start
yes
yes
thats what they are kinda meant for
Yeah yeah just the runnable confused me a bit
but I just use newer arrow switches usually
So if I return it'll wait until the runnable to run again
If there's nothing under the switch then it doesn't matter either one or
And then return after
and using returns to returns from teh function
but return isnt needed if its teh last line in a void function xD
since it will return anyways
activate is just a normal function that just called by something thats not your code
thats all
yes true, thats why i use enhanced ones most times
Steaf you ever made a plugin that has a State in a loop? It would really help seeing something
return is really used in case of doing "pre statements evaluation", so then in case of that condition not being success, it will check again that if until the condition is sucess and w then ill comtinue executing code of blocks below
Alright alright gotcha, thanks verano
What?
my minigame just works on events and the vanilla game
well I just meant like a game in the sense that it has a gameloop
na dont worry man, we are here for trying to help
like what kinda state
Well, i'm starting to think maybe the way I defined my gamestates themselves are wrong
can you give a simple example?
I can share what I have but it's confusing at the moment even for me and I wrote the damn thing
well sure
Let me write something up
What i ha said before are called "early returns" if you wanna read about them
Right
also referred to as guard clauses iirc
GameLogic
cuz they guard the code from going further
thats correct
the original future gets stored as a source
ugh i forgot what i wanted to say already
think it was if exceptionally() would run on join() or sth?
well
join will wait the thread wait until the future response is given
from what I know at least, join() would not invoke exceptionally()
but it makes sense sort of
ye nvm i forgot what i needed to know
Ye allg
Ah yes, so I think exceptionally().join() would invoke the function, but you’re creating a new subchain where the join() invocation is disjoint from the subchain (cuz parent doesnt know about children, tho children know about parent)
I'm not canceling block break & place event, but my plugin does not allow me to place / break a block even with full permission (op & *)
other plugins?
Either other plugin or cancelling PlayerInteractEvent wrongly
when i disable my plugin with plugman, i can break or place blocks
uh oh plugman
Please never do that, that cause many issues
i've restarted my server too
Are you listening to PlayerInteractEvent in your plugin?
yes
okay
right lemme check that
Yeah check that
Dont use player location because it will cause you issue
You should use getClickedBlock() if im not wrong
^^
Also please provide full code
it was for the ! in if check
Mye
thanks for help
in here
na bro its okay, atleast you realize. I lost many hours with that type of issues
Tho again this
What annotation should I use in my plugin library to indicate that what the method returns will never be null?
I recommend the jetbrains-annotations annotations
Jebrains annotation or any other
The annotations under the javax package (can't remember the official name) is the other well-known annotation lib but I am not a fan of that one
That method returns will never be null
only use contracts in addition to notnull/nullable annots
While IJ can parse contracts, eclipse will have a pretty hard time doing so
yeah but thats eclipse
One day I'll write an eclipse plugin to deal with these sort of issues, but in the meantime you'll have to wait or just not only use contracts
Guys someone remember the class type that only accept certains classes to extends?
i mean... public X Class accepts Class1, Class2
i forget the name xD
permits?
Why doesn't spigot use ChatComponents in the tab header/footer?
I need help. With a plugin to code, that plugin ensures that everyone starts with a pet of their choice. And optionally name a lead if needed. If that pet is dead you will be banned from the server.
What part do you need help with?
with how to make plugins probably
lmao fr
wtf
that idea is more stupid than my tax authority plugin lmao
can i get an elephant as pet?
brb I'll throw myself into the bathtub again
Well it's better than my "anarchy economy" (i.e. players can manage their currency and print money themselves) plugin
uh oh
I have no idea whether it works on large servers but it sure as hell doesn't work on very small servers
is it even used on big servers?
As of now I haven't bothered open-sourcing it as it does not have an economy API implemented. So the only plugin supporting it is a makeshift auction plugin and that is it.
\👀
https://github.com/Geolykt/playercurrency welp, open-sourced it anyways
Lmao
Sounds awesome
And the respective auction house plugin: https://github.com/Geolykt/playershop
Wheres the „blackjack and hookers“ plugin though?
I am not that motivated
Oooh i just got an awesome plugin idea. A back to the future plugin, where you can craft a delorean and than go back into time, gotta fight biff (an enderdragon) and when you go back into the future, biff‘s your bitch
I already have too much stuff to do
My home-made mavenresolver is haunting my dreams a bit too much
I shouldn't have submitted that as the besondere lernleistung for my abitur
If im running stuff inside a runnable how can I pause for x amount of seconds and then resume where I left off
Like if I wanted to do a "Starting in 10 seconds"
Don't.
Same as command cooldown?
You probably want to register a new runnable I guess
ig its safe to do Thread.sleep as youre in a worker thread??
Can get messy very quickly but there is no other way
it is not.
never use Thread.sleep in any thread you didn't create yourself
Otherwise the pool can get exhausted and the server will go haywire
What if I use HashMap<Player,Long> cooldown=new HashMap<>();
The same applies to I/O (mostly NI/O) operations
spigot uses a cached threadpool anyways so should be fine i thought
WeakHashMap if anything
Any alternative if I wanna wait 10 seconds before changing a variable?
NIO vs IO?
network I/O
Ah ok
A DDoS on the backend server can cause quite teh serious slowdowns
Is that meant for me? I assume not
wondering the same thing
It's meant to those recommending Thread.sleep
Runnables?
ah
For cooldowns
Map<UUID, Long> is best
just scheduling another task within the existing task then?
Alternatively, store the expiry time in a map
if you want changing variables, use the AtomicObject/AtomicLong/etc family
Why do you need to pause?
What could be the reason of enchantments not being added to itemstacks?
if it need to be sync, not possible without serious amounts of hackery (i.e. SSVM or any other JVM reimplementation)
Im using ItemStack#addEnchant()
Are you also changing the name etc?
switch (state) {
case WAITING -> {
}
case PAUSE -> {
}
case IN_PROGRESS -> {
}
case BOSS_FIGHT -> {
}
case RESETTING -> {
}
}
state = PAUSE:
Message sent: Starting in 10 seconds
after 10 seconds
change the state
That's what I wanna do
Runnables
And that switch is inside a runnable
yes, and the colored name and lore, appears
You can have runnables inside a runnable
Nono
Only current runnable is outside the switch. the switch is inside a runnable
Now i'm trying to do what I typed above
do a runTaskLater within your game loop?
But that means the current runnable gonna keep running no?
You can't pause the execution of your runnable without very cursed hacks, so don't try to pause execution of your runnable.
Calling ItemStack.addEnchant gets the meta, adds the enchant to the meta and sets it back. If you get the meta before adding the enchant, and then you set the item name and set the meta back, it wont have the enchat
oh rgiht that makes sense
Not trying to pause it I'm asking for ideas and I think fourteen is right
You can terminate it beforehand if needed
Look at fsmgasm @regal scaffold
How is it possible that this tomasinhues once appeared outta nowhere and now hes online 24/7 lol
It's a state machine good for building minigames
😦
Boss fights are basically a minigame
Will give it a look
Alex, I can promise you i'm the most online person you'll ever meet
Your mom‘s a finite state machine
When i set my mind onto something, I never stop
😦
Did you setup the script to upload ur file?
uh oh
Besides alex, unless you put the hours of work not gonna learn what you want to learn. And I wanna learn this at the moment hehehe
Instead of taking me years to get to high level with the effort you can make that a few months. Just gotta make sure you keep healthy
@regal scaffold can i see in what context you were using this?
I'll dm you the sc
Sure
Looking at SSVM?
I started like a week ago or something. And if I compared the first thing I did with what and how i'm doing it now it looks like a month of progress. I can't even look at my code a week ago it was terrible
I would prob get banned from the cord
What did u send?
You asked for the context
being healthy? I'm a bit late to that party. wanna see a pic of blood pressure lol
lmao
Take care of mental and physical alex
Otherwise that brain isn't gonna last to keep making stuff
Ok yeah it's bad😂
The organisation
What is activateDungeon supposed to do?
And reading other peoples projects which are considered good
Hm actually quite good rn
Run a loop and do stuff depending the game state
But everything is working btw
Like really well
I was just curious on how to do the "wait 10 seconds"
there should be a blood pressure plugin for MC
Here's how it should go
But I'll prob just do runtasklater and change the state there
Your game should have a start method
Which initializes the game, sets it to joinable etc
you can get your blood pressure measured using /bp, and if it' higher than 160/100 or lower than 100/60, you gotta call an /ambulance but if it's an american server and you don't have insurance, it bankrupts you
opinions?
Then it should have a nextPhase method that switches the phase OR you can use fsmgasm
Or you do have insurance but they don't cover ur care
fk man fsmgasm is actually so organized
But I wanna try without library
I'll improve as I do it
Recaf uses it for automatic deobfuscation
But can be used to sandbox anything. However it's properties make it suitable for more cursed things (such as pausing execution on the main thread)
:)
If cooldown is player dependant is a Map really necessary? I just need Long
could store it in your player wrrapper thing
Well if it is for everyone then it can just be long
That's what I thought. Dope
perhaps even Instant if you fancy that
Oh god another word I gotta go read on
Oh wait it's a class
👀
Nah bro that's too deep I need 10 seconds not 1000000000-12-31T23:59:59.999999999Z
good idea
"it's just a heart attack, get over it"
Im gonna send something that's a bit embarrasing
But whatever
new BukkitRunnable() {
@Override
public void run() {
if (coolDown != 0)
coolDown--;
if (coolDown == 5) {
messagePlayers("You have " + coolDown + " seconds to get ready! Starting level " + currentLevel + "!");
}
if (coolDown == 3) {
messagePlayers("You have " + coolDown + " seconds to get ready! Starting level " + currentLevel + "!");
}
if (coolDown == 2) {
messagePlayers("You have " + coolDown + " seconds to get ready! Starting level " + currentLevel + "!");
}
if (coolDown == 1) {
messagePlayers("You have " + coolDown + " seconds to get ready! Starting level " + currentLevel + "!");
}
}
}.runTaskTimer(plugin, 0,20);
There's definitely gotta be a better way to do this
switch
Or just if CD < 5
Or abstract it
Create a Countdown Runnable class
So you can use it for all countdowns
Switch same length:
cd < 5 is actually a good idea
Not sure it's worth abstracting for just a 10 second countdown
Hmmmm
Le tme think if I need it more places
Abstract it now so you don't have to later(unless ur lazy like me)
fk it I'll do it
brb gotta learn about abstraction
private void generateLevel() {
new BukkitRunnable() {
@Override
public void run() {
}
}.runTaskTimer(plugin, 10, 10);
}
I remember you told me or someone to change something about the runnable. Now I need to be able to cancel this task from a different method. i believe that's the reason they told me to change it.
Can't remember exactly what they said
BukkitTask task = new ExampleTask(this.plugin).runTaskTimer(this.plugin, 20);
It was this change, correct?
Probably something about lambdas and consumers
Hmmmm
Is that the correct way to cancel a tasktimer from a different method? I thought both of those were localized
^
Done
public enum Level {
ONE(5),
TWO(5),
THREE(5),
FOUR(5);
private final int killGoal;
Level(int killGoal) {
this.killGoal = killGoal;
}
public static int getKillGoal(int level) {
for (Level l : Level.values()) {
if (l.ordinal() == level) {
return l.killGoal;
}
}
return 0;
}
}
I'm using this enum to convert a level number to the amount of kills needed but enums don't allow you to have a number as a enum name.
How can I convert int ( 1, 2, 3, 4, etc ) to a respective value here
so you need to map a killGoal to a Level?
Yep!
Exactly that
I've done others that are working perfectly before but this one can't cause 2 numbers
dont check ordinal but check l.killGoal
public enum MobName {
MinerZombie(1),
Samurai(2),
ToxicZombie(3),
FrozenInhabitant(4);
int level = 0;
MobName(int i) {
this.level = i;
}
public static MobName getMobName(int level) {
for (MobName mobName : MobName.values()) {
if (mobName.level == level) {
return mobName;
}
}
return null;
}
}
But the level is a name
Not a number
wat
so you need String -> int?
Or another way of doing this, yes
If there's a better way than havinjg to convert the word one to 1
so Level.valueOf(name).getKillGoal()?
Level.valueOf(number).getKillGoal()
where "ONE" would return Level.ONE
Where "2" would return TWO(5), meaning 5
You'd need to store a static HashMap<Integer, Level> in your enum class and initialize it on class load via the static initializer
Then you just iterate over values() and do map.put(number, value) or something like that
ig im not understanding the question
I think this is correct
you need to get a Level from the killGoal and suddenly you say the level is in string form
The level is a int. A number like (1,2,3,4)
each level has a int killGoal\
map then yes
Alrighty
i hope that enum doesnt have a thousand entries
16 levels max
If you ask me though
You should just store Level.ONE and etc. in your MobName enum constants
Level.NINEHUNDRED_NINETY_NINE 💀
I'll always take advice
I also have another enum tho
I guess I could
could've combined them all
level, mobname and bossname
i.e. MINER_ZOMBIE(Level.ONE)
Oh wait no then you're gonna suggest me something else here
Safer, faster, and more readable
the level means which mob to spawn. not the level of the mob.
Example
currentLevel 1
killGoal -> ONE(5), -> killGoal = 5
mobTospawn -> MinerZombie(1) ->MobToSpawn = MinerZombie
Oh, I see
Yeah that's why i have the issue with ONE(5) cause "1" isn't the same as "one" obviously lol was just a placeholder
So if I do the map on the level should be good
You should use the SCREAMING_SNAKE_CASE for enum constants though
Well the issue with that lmao
Is that the name of the mob actually is the exact name I need to call it in a api func
lolol the plot grows
I thought you could only have 1 value inside the enum
Oh man that would've been handy
If you look into a compiled enum it's just a class with the enum flag + every constant you've declared
Compiled constants look like:
But you see this
public static final MobName MINER_ZOMBIE = new MobName("Miner Zombie", 1);
public static MobName getMobName(int level) {
for (MobName mobName : MobName.values()) {
if (mobName.level == level) {
return mobName;
}
}
return null;
}
I don't do MobName.MINER_ZOMBIE
I do MobName.getMobName(level)
I asked a day or 2 ago if doing it this way was considered terrible practice
I'd probably do it different, personally, but I don't see too big of an issue with it
I just don't like relying on "magic constants"
I don't 100% know the architecture of your plugin so it's hard to offer advice
Maybe I'll offer a PR if this is public, lol
lol
😦
I mean I'll definately learn a lot from it
Seeing how more experienced people do the same thing you're trying to do without rewriting the entire plugin is one of the most handy things
I agree
public static int getKillGoal(int level) {
for (Level level1 : Level.values()) {
if (level1.level == level) {
return level1.killGoal;
}
}
return 0;
}
LEVEL_1(1, 10),
LEVEL_2(2, 15),
LEVEL_3(3, 20),
LEVEL_4(4, 25);
I think that should work
At least the logic does suggest that
How can I check if a player is nearby a specific entity with a tag? I don't know if its possible with the getNearbyEntities method
¯_(ツ)_/¯
why not?
I think you can just use that and then check for each entity if they have the tag
and if you found one, return true
I'll try that
I'd use the entity-predicate of the nearby entity utility method, as that allows it to perform your query in a more efficient manner than if you filter externally. Something simple like this should do: https://paste.md-5.net/totaduzeti.coffeescript
The ones as arguments mean how far from that location to go into negative and positive axis direction from the location's point, so view them as a "radius" instead of a "diameter" and adjust as needed.
oh yes thats better, I didnt know the method had a predicate
So dev lads , been mucking about wi9th settings in vulcan. Is there a reason that lunar client gets pinged by vulcan specifically?
I'm using the 1.18 API, but since I want to leave the plugin for all versions, I want to be able to use Material.Seeds if I'm using 1.8, but in 1.18 it doesn't have Material.Seeds, what better way to do this?
Search for XMaterial in your favourite search engine
Hello I'v created a class that should extract textures in to folder in plugins but I get
26.01 22:58:19 [Server] WARN java.nio.file.NoSuchFileException: home/minecraft/multicraft/servers/server584001/plugins/woodaddons-v1.0-1.19.jar
What could be wrong?
Is that mean that it can't find my textures in plugin jar or it can't find path in plugins directory
How can I know what the highest version of cirrus-spigot is inside https://repo.simplix.dev/repository/simplixsoft-public/
curl https://repo.simplix.dev/repository/simplixsoft-public/dev/simplix/cirrus/cirrus-spigot/maven-metadata.xml | xq -x '//versioning/latest'
What a savior
(xq being https://github.com/sibprogrammer/xq)
Windows alt?
windows
lol
concerning its go I'd presume they have a windows build
worst case, just build it yourself 😝
Man either their steps are terrible or I'm an idiot
nono
Mb
Talking about this guys repo
I think they fucked up
Their pom is not in the folder

whats the specific issue ?
Lynx are you drunk or sth
Oh ok
?ask
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!
?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.
I was using their guide and before I was using what I thought was the latest version 2.0.0.
I contacted the dev and he told me if I was using version 2.1.0-snapshot or 3.0.0-snapshot and my mind exploded.
I found the 3.0.0-snapshot version but the 2.1.0-snapshot doesn't exist on the repo. Anyways
Added the 3.0.0-snaphot version and now getting this
Could not find artifact dev.simplix.cirrus:cirrus-spigot:pom:2.1.0-SNAPSHOT in spigotmc-repo (https://hub.spigotmc.org/nexus/content/repositories/snapshots/)
Send the repo url as text
Run „mvn clean package -U -X“
Caused by: org.eclipse.aether.resolution.DependencyResolutionException: Could not find artifact dev.simplix.cirrus:cirrus-api🫙3.0.0-SNAPSHOT in spigotmc-repo (https://hub.spigotmc.org/nexus/content/repositories/snapshots/)
Why does it think it's there
?paste your pom pls
<dependency>
<groupId>dev.simplix</groupId>
<artifactId>protocolize-api</artifactId>
<version>2.1.0</version>
</dependency>
``` had that added with different versions too but I believe the 3.0.0 includes that anyways or at least it's what IJ says
Hm okay i don’t understand why it doesnt work, however i can tell you how to fix it. Clone the cirrus repo, then do „mvn install“
😏
Yeah in intellij just do File > new project > from VCS > enter the github link, then do „mvn install“
Okay
And in your plugin‘s pom, use the same version for that dependency that it declares in its own pom
In the pom of the cloned repo
Yes
Doesnt matter
Use 2.0.0 in your pom after „mvn install“ed the cloned repo
If that still doesnt work, you should start to insult the dev of that lib in public lol
yea the repo is just fucked 
Probably, yeah
Building my project rn but last time it built too
Was when you tried using it
error
Not good looks alex after we said it looked interesting lol
People should not host nexus if they dont understand it >.<
wtf are they deploying
apperantly a built went out two days ago ??
their github repository has been dead since december ??
I mean, idk man
their api module does not have a target repository defined https://github.com/Simplix-Softworks/Cirrus/blob/v3/cirrus-api/build.gradle.kts#L13-L19
I'm seeing what the dev says lol
How can I delete the mvn install and cloned repo alex made me download
you can yeet it from your local maven repo at ~/.m2/repository/the/group/id/and/sutff
Is just deleting it enough?
How does luckperms access to spigot server cache? Is there a method for doing something like that
Because luckperms has a config option which allow you to get the player data which is cached on the server itself and not in the plugin cache
[01:44:26 ERROR]: null
org.bukkit.command.CommandException: Unhandled exception executing command 'gui' in plugin bpSurvival v0.2
at org.bukkit.command.PluginCommand.execute(PluginCommand.java:47) ~[purpur-api-1.18.2-R0.1-SNAPSHOT.jar:?]
...
Caused by: java.lang.ArrayIndexOutOfBoundsException: Index 0 out of bounds for length 0
at pl.botprzemek.bpSurvival.commands.CommandOpenGui.onCommand(CommandOpenGui.java:28) ~[bpSurvival-0.2-all.jar:?]
at org.bukkit.command.PluginCommand.execute(PluginCommand.java:45) ~[purpur-api-1.18.2-R0.1-SNAPSHOT.jar:?]
... 21 more```
``` @EventHandler
public void onInventoryClick(InventoryClickEvent event) {
Player player = (Player) event.getWhoClicked(); // 28 line
Gui gui = managerGui.getGuiByTitle(event.getView().getTitle());
if (gui == null) return;```
The problem is inside your command
Wth? event.getWhoClicked(); is out of bounds
Error: Index 0 out of bounds for length 0
The error is saying that you are trying to access to argument which doesnt exists on the array
What is the name of config option?
Wrong section of code
It states that the error occurs at pl.botprzemek.bpSurvival.commands.CommandOpenGui.onCommand
Show that method, not onInventoryClick
Verano is probably right that it's due to accessing an argument that doesn't exist
Ur the npc
Maybe you didnt really learn how to read stracktraces
Isn’t that just the offline players file
I think the idea is that like
It allows you to use a database so you can have a single source for offline player UUIDs across your network
Which is pretty smart imo
bukkit for example
From what i read that option is for you luckperms looking for player inside the sever cache instead of the plugin cache. So he can add ranks if the player havent already connected while the plugin was put
Do i explain?
basically getting offline player and after that their uuid
As I saw with this option, if I want to give the rank to a player who is not yet connected to the luckperms server I will not be able to, without having this option activated.
because in other way it will use database
which will make sense to not work if player haven't joined
That why i asked how luckperms get that cache, if the spigot server has a method or smth like that
.
oh right
Also i need a lighweight library for creating bungee and spigot components and also allow their colors/styles get directly translated depending if you are bungee/spigot
What?
Have you seen bungee chat api right?
Ye
Here I wrote it with the translator, what I need is to know if there is a lightweight library which allows me to create components for bungee and spigot, but which also supports color coding (blue, red, etc) and classic styles (italic, underline).
Okay well
Bungee and Spigot components are not actually too different
Spigot's API supports Bungee's Chat API (Player.Spigot)
But the main difference is that Spigot supports legacy text
Yeah i know more or less that, because components well json structures
New versions, I believe, must translate from legacy text to the new system which uses part of the protocol
Copy the file and the directory
Either way
Because of that, you should basically only use one or the other
The only incompatibility is cross-version, I don't think Bungee's Chat API is supported by all versions
The only library I can think of that does something similar is Adventure, but that's definitely not "lightweight"
Yeah i know more or less that, because components well are just json structures that are displayed them on the client. But i dont know how i can use the colors using the &
Isn’t there a fromLegacyText
hello everyone, I'm a little new to minecraft java, and I wanted to know for those of you who have understood for a while if it's possible to make a plugin that makes the block move from POINT A to POINT B and stop at point B.
Component#toLegacyText() is called
I agree
Yes that is the problem i have now
Sure it’s possible
Do you mean like
teleport the block, or animate it moving?
Animating might take a bit more effort since that'd require armour stands afaik
I asked prices for creating a custom component library lighweight and which support colors using &. And they told me around $60-80 with fully rights of course
Falling sand
Pfft, that's ridiculous
I could probably do that in a day
animate it moving
Still possible
Good to know
You work for $60/day? McDonalds workers get paid twice that.
Because the only issue i see on actual components are colors/styles, because i cannot directly call the method from ChatColor#translateAlternativeBlaBla() because you have 1 for bungee and 1 for spigot
It seems like what you want is probably just
Something to translate color codes to components
In us probably
Mainly just need some way for translating components colors/styles with the symbol & not wondering in which platform you are
I mean you can definitely do that with the existing apis
Yes i know that
So why does the platform matter?
I explain what i refering
Let say i have the next component, in this case colors wont be translated if i dont call ChatColor#translateAlternative() from bungee/spigot dpeending the platform
TextComponent component = new TextComponent("&cMy awesome text");
player.sendMessage(component);
But that is my issue i need something like a unviersal ChatColor
?jd-bungee
?jd-bcc
You just do
TextComponent.fromLegacyText("§cMy awesome text");
The constructor doesn't convert anyway
So then when i send the component no matter if sending to proxy or spigot player will be sent with colors right?
Yeah, all it does is convert the legacy text into components
And both proxy and player support receiving components afaik
And you can get the § symbol using translateAlternateColorCodes
it is possible in 1.8?
I cant use that method, because i dont know the platform they using, they can either use Bungee or Spigot. That is the whole point of the dicussion i open
Why does that matter
I'm pretty sure Bungee supports ChatColor
It’s part of the bungee api which is on both platforms
Weird
Once i imported ChatColor#translateAlternativeBla() from bungee and put the plugin in spigot and caused an exception
That is why i opened this dicussion
Does it have a different fully qualified name on the two platforms?
Do you know understand what i was asking about?
This should work just fine tbh
import net.md_5.bungee.api.chat.BaseComponent;
import net.md_5.bungee.api.ChatColor;
import net.md_5.bungee.api.chat.TextComponent;
// ...
public static BaseComponent[] makeComponent(String message) {
String fixed = ChatColor.translateAlternateColorCodes('&', message);
return TextComponent.fromLegacyText(fixed);
}
That should work either bungee and spigot right?
yeah
right i wil ltry that
I have an iterator to remove crafting recipes but the problem is I want to remove all beds no matter what their color is. Do I have to just check for each one of the 16 beds?
while (iter.hasNext()) {
Recipe recipe = iter.next();
if (recipe.getResult().getType() == Material.RED_BED) {
iter.remove();
}
}
you might be able to check the material, if you can check if the toString varient contains BED
I've still never liked using legacy text over Bungee/Adventure components
It just feels like an unnecessary step personally
Smart ebic, thanks
Is there a tag for beds
Lemme check
there is
Nvm
use ```java
if (Tag.BEDS.contains(Material))
cool lol
just like a list type thing of anything Keyed
declaration: package: org.bukkit, interface: Tag
Yeah it’s basically a fancy EnumSet
Well idk if it’s an enumset under the hood but yeah
Maybe
I'm pretty sure you can modify tags so
It would likely read from resources
But if it stores it in an EnumSet?
You can modify them with datapacks, Ye
Well, that's just good practice.
EnumSets are optimized for enums, lol
Who would've thought
john Enum
Can’t wait until material isn’t an enum
You could probably retain binary compatibility even when changing Material to a class
Oh sweet
If they didn’t care about binary compat it would probably have been done a while ago
Actually, wouldn't that bring Spigot closer to easily allowing mod/plugin bridges?
The main issue I've seen mod bridges face is that Material is an enum
Probably
im gonna say its your jira login
I don't know what my JIRA login is either lmaooo
lmao
my jira login autocompletes to the stash but the login doesnt work/i never set it up iirc
Beautiful
Bitbucket is unable to reset the password for your account because it is managed by a read-only external directory. Please contact your administrator to change your password.
someone call md
And lastly
sign it
In the same iterator I'm removing recipes. If I wanna replace one for alternative of it. Example
I want to make copper ingots give a different copper block
Do I need to go through the process of creating a new item, namespacedkey, shaped recipe, etc?
Or can I do something with the iterator result straight away to just give a different material
This is odd because I've had access to the stash in the past
Have I not signed the CLA??
I swear I did.
?cla
The home of Spigot a high performance, no lag customized CraftBukkit Minecraft server API, and BungeeCord, the cloud server proxy.
you can look at src code without an account but need an account + signing cla for pullrequests iirc
How am I supposed to know
did you make 1 jira account and signed the cla
I got 2 accounts too
then another and didnt sign the cla
I think one uses my email and the other uses a username
How can I check if I've signed
Idk
sign into jira then see if you can go to stash
It’s a shame stash doesn’t separate read and write perms for PRs
(That’s the reason you need to sign CLA just to view PRs)
It says I don't have permission when I try to login to Stash
I've got a JIRA account
i dont get why those are seperate
Logged into it rn lmao
lol
Different software
if you cant acess stash prs you havent signed the cla
One is probably Xenforo and the other is JIRA
spijank
Okay
Yes spigotmc is xenforo
Ahh okay I might've avoided signing it due to privacy
he is constantly flying all around the globe
Is that why he never talks in here
The CLA:
I though he travelled by kangaroo
md is secretly a pilot
flying kangaroo
he has to keep it hidden
so the spigotians dont steal it
A'ight time to read this agreement
The first legal document I've read
Besides homemade licenses
I like reading people's hacked-together licenses to find loopholes :)
Read the GPL. It will make your eyes bleed.
So, fun fact
Team CoFH has their own license
Not be a jerk**. Seriously, if you're a jerk, you can't use this code. That's part of the agreement.
I like the be gay do crime license
I'm a fan of the Hippocratic License
Although it's not as mature as something like MIT
(And probably not legally binding)
I often just license under MIT to say "I ain't liable for shit and this code is forever free-use, so if you need something fixed do it your damn self"
Eh y'know what, nevermind. Don't feel like giving my address away.
Oh its identicall to you
why do you have a gitar
Alex, your life confuses me lol
I dont have a life, im a bot
Dont remember that day that 12 diff people told me "you are a bot"
choco was talking to @tender shard
Verano you confuse everyone dont worry
most people here refer to people as their nickname
ohh ok, he confused me
Do SortedSet().iterator().next() loop to the start of the SortedSet?
yap, it will have ascending order
Make sure the size is >0 first
he's like australian santa claus
Just made an easy 30$
Client wanted a http server to run config defined actions in mc
o?
p
how do i get all the chunks a player is loading or are loaded around a player?
in simulation distance.
Listen to the packets?
and other players can load chunks too..
Exactly
protocol library?
So either you get the chunk load distance and assume that those chunks around a player are loaded OR
Listen to when a chunk packet is sent to a player
Also check the distance though, if it's outside the server render distance, ignore it
i will just compute it based on player position i guess
Why do you need that info?
since i also need a to know when a chunk is no longer in a player's render distance
i am trying to store data on whether a player has the permission to do modify a chunk (break blocks, place blocks, take items from chests, and maybe killing entities).
and i was thinking of loading that ahead of time
to make sure that there is no lag
Store it in the pdc
in case the player is using an elytra or something
Of the chunk
pdc?
?pdc
i am using a sqlite database to store this data, i am not storing this in chunk NBT or something like that
Or you can use the pdc to store which players jas which permissions
keeping a separate file for the data might be convinient though but I might use this for other projects.
Up to you
also, appreciate you telling me all this stuff!
so..
what is the efficient way of doing this?
is there an event that is fired when a player goes into a new chunk?
does that get triggered whenever a player moves?
even when a player is being nudged by another player?
or is in a minecart or something like that?
?tryandsee
yeah i kind of need it whenever the player moves.
Are you making a chunk claim thing?
yep.
Ah ok
id assume so
quick question. in version < 1.17 the jar archive to enable the libraries is not a simple library but a Main class. How can I execute the Main class to get the libraries?
r u tryig to use like NMS?
?nms
yes
Are you online bro? please i your op
Every 20 ticks the client will tell the server about its position. So yes it should still get triggered even if they are being nudged.
1 movement every second god that wouild suCK
its 20 movements a second i think
unless theyre idle?
then i think the client reduces its sendrate
If the player is actively moving it will get sent every tick.
Otherwise if not moving from the client but moving by other means it is sent every 20ticks
how can I make an inv auto-update for all viewers when one viewer modify it?
Open the same inventory for everyone
how can i use this class :l
PacketPlayOutEntityHeadRotation
no idea how Byte b is constructed
Look at wiki vg or at how Minecraft uses the packet
that b() method also gives you an idea of what the values are
:l
could you tell me how to rotate the head with x yaw and b pitch ?
still confusing
plenty of tutorials on youtube for this type of thing
there is but i found nothing about PacketPlayOutEntityHeadRotation
they use Teleport for it :l
which is not that smooth
Entity#setRotation?
its an npc
i assume
Learn how to create an NPC! The super-easy way using packets and NMS!
Patreon:
https://www.patreon.com/codedred
Donate to me :)
https://www.paypal.me/CGMax
Join my discord:
https://discord.gg/zMzXSgk
------ Links ------
Download Eclipse: https://www.eclipse.org/downloads/packages/release/2019-03/r/eclipse-ide-java-developers
Download Spig...
this tutorial uses it
i put a timestamp too
have you considered doing what it says
that packet only does yaw
pitch is done by the teleport packet
its a bit weird but it is what it is
make a method to teleport them to the location gradually?
I doubt teleport and head rotation are materially different
Maybe it doesn't work for players
it need entity ?
well yes
it needs the entity id
because with that the client figures out what entity is ment
to rotate its head
i dont know why this doenst crash
since when is that lol
how can i get that id in 1.17.1 ?
This shows how to get the id
but where to use it ?
so why it doesn't run ?
couldnt you just send a teleport packet
where u change the yaw and pitch
and maybe that works
this tells you to do that
probably the only way
not even a packet just use the api to teleport the player
rotate != teleport
the teleport method has a pitch and yaw argument
exactly
just plug in the players current x,y,z and only change yaw and pitch
:l you know the difference of teleport and running right ?
so you want it to smoothly rotate the player
rotate go from 3->4->5 not 3->5
?
yeh ?
well then