#help-development
1 messages Β· Page 293 of 1
go piss
mfalex you use maven right? I have a question
For some reason my maven properties are not being replaced from the plugin.yml
you don;t have it set to filter
What? Explain please
it will not parse your files unless you have <filtering>true</filtering> in your resource section
ph pk
yes
Wait i think that Elgarl already answered it
I can ping you when something funny happens if you like
if you remember lol
i think today i woke up with the most pings ive had from here
at 4
Something funny
?
yes
^
also did you even define a bot.token property in your pom?
yes, in properties label
cannot share full thing, because token is there
mvn clean package
np
you should usually always run "mvn clean" after changing anything in your pom
if you didnt change the pom, clean is not required in 99.9% of cases
probably not the best thing but I only run mvn clean package lol
50 ms = 1 tick right?
yeah, when i ran maven i always used mvn clean package
if everything works as expected, yes
no, usually not at all
assuming your tps is 20 yes lol
i thought theres like 1000 millis in a second
Okay something must be incorrect because the time is run every 5 seconds
but maven saw "oh the plugin.yml with the same timestamp is already in the target folder, no need to do anything". But they now enabled filtering. And yeah, that's why filtering only worked in this case after cleaning

is there any reason to be using millis hee
here
maven things
Doesnt it work as git hashes?
How?
dont call .toMillis
I dont udnerstand ticks conventions
20 ticks is 1 second
so tl;dr - no, clean is not always required, only in very edge cases. but these are the times where you spend one hour debugging it, so most people just always run clean before package
thats pretty much it
So seconds / 20?
what for
ok
?paste
Code: https://paste.md-5.net/macogotege.java
Stacktrace: https://paste.md-5.net/keliceruco.cs
this.task = new BotTask(this);
this.task.runTaskTimerAsynchronously(this, config.getInt("Bot.Update") * 20L, 1);
why not just shade JDA? No idea if this was going previously just it seems like a really weird way to make a discord bot
yeah
Answeing to?
lol ik y'll were gonna say that
minion probably
you didnt shade JDA
i know
show your pom / build.gradle
i'm trying to load it
at what code?
the code they sent, first link
just wanted to test if it's possible
on the other paste
Im alex?
what?
wtf are you doing @humble tulip , why do you access jda with reflection? and also does it even have a start method?
most of the time by alex we mean @tender shard
@tender shard here
no no
read the code
Verano is called alex too, but nobody ever here calls you alex because it's not in your username lmao @sterile token
VERANO I'm talking about the person's name who is 'mfnalex', I call people in here by nicknames not actual discord names
most of the time i would guess people here would call you verano
^
lmao
dude smoked too much "wheel" again
are you on 1.16+?
is this even a plugin
if so, no problem. just use the library loader in plugin.yml
good question tbh
doesnt look like one
Why?
not a plugin
yeah I dont think it is lol
it's a discord bot java program
at the end
where do you expect that class to come from? out of the sky?
every library needs to be shaded somewhere
just shade it my dude stop making this so complicated
so how does spigot load libraries dynamically from the plugin.yml?
rotate vector function causes server to crash?
File file = ...
URL url = file.toURI().toURL();
URLClassLoader classLoader = (URLClassLoader)ClassLoader.getSystemClassLoader();
Method method = URLClassLoader.class.getDeclaredMethod("addURL", URL.class);
method.setAccessible(true);
method.invoke(classLoader, url);
oo i'll try
STILL not the thing to do with Discord bots
you are just gonna hate yourself later when you have to debug this and wonder 'why the fuck did I do this'
by downloading that .jar from maven central and then opening that .jar file and throwing it into the classloader
To resume dynamic jar loading π€
that's kinda what im trying to do
Take a look at luckperms
except i dont need to download the .jar
They does that
this doesnt wok
im too tired for this convo
system class loader isnt a urlclassloader
ofc you have to download it
you either gotta shade it, or download it
I already have it downloaded
the jar exists
i just want to be able load it at runtime and use it
Well, if someone download your app, they will have to dl it somehow
Download
download
On newer Java that classLoading is going to fail
download
download
im still wondering why you want to do this
yeah total shitty idea, just shade JDA
I'll just look at spigot code
it's not for jda
IT
it's just to see if something like this is possible
You can shade anything, not just JDA!
I KNOW
yes ofc. Just use a URLClassLoader and point it to the .jar file you wanna load
I did
it doesnt work
show your full code
this is my main class
wanna see discordbot class?
?paste
the error message doesnt match your code
the error is in line 15
your line 15 is empty
the error message comes from a .jar that has another source code than the one you sent
oops
Is system maven scope deprecated or I mixed it up with something
it is
Right
?paste
if you actually need to include a local .jar, you are supposed to mvn install:install-file it to your local repo
https://paste.md-5.net/iyafuxuzar.cs <- Stacktrace
https://paste.md-5.net/kokozidazu.java <- code
@tender shard
The error message does match the code
I'm so confused π wtf sqlite?
public void insertIsland(MinerIsland island) {
try (final PreparedStatement statement = this.connection.prepareStatement(INSERT_ISLAND)) {
statement.setString(1, island.getUuid().toString());
statement.setInt(2, island.getLevel());
statement.setInt(3, island.getBlocksMined());
statement.setString(4, Boolean.toString(island.isPayedForLevel()));
Bukkit.getLogger().info(statement.toString());
statement.executeUpdate();
Bukkit.getLogger().info("Inserted island: " + island.getUuid() + "into database");
} catch (SQLException e) {
Bukkit.getLogger().severe("Failed to insert island into database!" + e.getMessage());
}
}
why does this convert into bruh I even printed the statement out and it literally makes 0 sense all of the things are in the right order lmfao
what exactly is the problem?
PrepareStatement#setBoolean()
does sqlite even support booleans
no
yes
Lol
I used to use SQLite and support booleans
π wtf okay lets figure this out
It's using 0 and 1 for bool
why are u using strings for booleans?
Yeah sql is weird too
Im more a NOSQL user
weird, that looks okay to me. I have no clue
because I had tried booleans already and nothing was even going into my database and I was confused as fuck
so I tried strings, and it visualized this weird shit happening
just use tinyint then?
What even is the problem
Older SQLite drivers doesn;t support boolean
String is going into the int spot and int going into the string spot and Its confusing the shit out of me
you can't shade a newer driver into your plugin
Can you show query
it will use the default resource in the spigot jar
its not shaded though I am using spigot libraries feature
oh
okay
well that fucking sucks
one second
they can easily if they relocate it
won;t work with SQLite due to native methods
Yap, nearly like 60% of sqlite size is native
I only added support for SQLite in GroupManager due to this annoying driver issue
Spigot 1.14+ has a driver which supports booleans
I'm on latest
spigot
[19:52:12] [Server thread/INFO]: INSERT INTO miner_islands (island_uuid, miner_level, payed_for_level, blocks_mined)
VALUES (?, ?, ?, ?);
parameters=[4243cd84-defd-43e0-ac56-898311f464de, 1, 0, true]
this is my query
then it supports boolean
wait nvm
this is what it outputs though
why...
And what is wrong there
oh wait I see it
I don't see problem
lol
what did you do
He?? did you just assume my gender??
π
i can english
I'm a fucking bad bitch π
watching boobies on anime π
funny, I didnt know that
what else do people use for local dbs h2?
yep
guess I'll use that in the futrue
you mean hentai
nah, currently watchign "The World's Finest Assassin Gets Reincarnated in Another World as an Aristocrat"
its a bit of a slog
Hey with my friend we are having bot issue it doesnt want to join to the sever?
i got side tracked
discord server? minecraft server? more details mr .wheel pls
On discord
how are you inviting it
via discord develoepr panel
what url scopes do you add
what are scopes?
@tender shard figured it out
had to create a urlclassloader and explicitly set the parent to null
huh yeah I said to use a URLClassLoader
what did you set the parent to earlier?
i didnt set one
oh I missed that
it auto set to the classloader of the class constructing the urlclassloader
works now π
Are you sure? I remember it always setting it to the system class loader
But yes, custom class loaders have gotten ass with Java 9+
well in my case the parent was the system class loader so you could be right
CB passes a reference to the "this.getClass()" classloader of JavaPluginLoader
but what that refers to, no clue
LMAO i just realize how they have put so many shits on the discord api
mfalex, are you still alive? I need some help with JDA
Im trying to get an embed message from a channel and modified it, but im not sure how do i get the embed id
Hmn im messed
Because im not sending a message, im sending directly an embed
hm the jΓ€ger is still half full
Bedtime is when the bottle is empty
"in a bedroom with no windows or doors"
hi
I stalk everyone all the time
it's kinda my job
dont know how you drink that shit
tastes like medicine
is there a way i can make it so whenever i compile my plugin in intellij, the jar automatically gets uploaded to my server? i use a dedicated server on pterodactyl, is there a way i can use the pterodactyl api somehow?
Jagger π₯
how do you make it so a bash script is run when you press the "Run" button in intellij? is that something you can change in the project structure?
Bro we just raided a bar in London with German darts viewers after the match LMAO
you can edit your pom.xml/build.gradle to run a script after it's done building
Quick question. How would I go about teleporting a player forward from their position(make them go forward 10 blocks) and detect all entities within their path? This would also need to not allow them to teleport through blocks.
You'd need to get the players location, then check all blocks in the x direction infront of the player. Then check if those blocks are air. Then you'd check if there any any entities in those 10 blocks infront of the player. If it's all good. You'd just use the player.teleport method to teleport them
That would specifically only move them in the x direction. I am looking for something that would move them in the direction they are looking.
How do I use the rayTrace world function?
Specifically if I want to base it off of player attributes.
Hi guys. I wonder if can we detect loaded chunk is new or not.
I saw it thanks!
Can anyone tell if there is a way to reload my plugins without crashing the server or stopping and starting the server again?
Like i want to reload the plugins from inside minecraft?
Can i do that?
I should have asked that in help-server right?
This is what I have for my raytrace: p.teleport(p.getWorld().rayTrace(p.getLocation(),p.getLocation().getDirection(),10, FluidCollisionMode.NEVER,true,1,null)); how would I use this to A: Teleport the player to the furthest position away from them(with a max of 10 blocks) and B: do damage to all entities within the distance they would be teleporting.(only ones they would collide with)
medicine makes you healthy, right?
watching darts is so boring lol
I mean playing it is nice
but watching it?
How efficient is this? The desired outcome is to have a system to detect all entities that are within ten blocks in front of the player. ```List<Entity> entities = new ArrayList<>();
for (double i = 0; i <= 10; i += 0.5) { // loop through each block up to 10 blocks away
Block block = location.add(direction.multiply(i)).getBlock(); // get the block at the player's location plus the direction multiplied by the current loop iteration
entities.addAll(block.getEntities()); // add all entities at the block to the list
}```
Dont u have getNearbyEntities?
Yeah I figured out that didn't work pretty fast and had to make modifications. This is the new system I have. ``` List<Entity> entities = new ArrayList<>();
for (double i = 0; i <= 10; i += 0.5) { // loop through each block up to 10 blocks away
Block block = location.add(direction.multiply(i)).getBlock(); // get the block at the player's location plus the direction multiplied by the current loop iteration
entities.addAll(p.getWorld().getNearbyEntities(block.getLocation(),0.5,1,0.5)); // add all entities at the block to the list
}```
Is it better worse or...?
There is a method to get a list of blocks in the direction the player is looking. Blocks have locations so you can use this method to get your path and do whatever else
I figured out how to get the blocks now I have a raytracing issue
Dont need it
Just get entities in surrounding area. Compare the location with your path. If they are not on your path they are obviously not in the way
No raytracing needed for this and would be less optimal
Your saying its more optimal for me to run a loop to check each block in my path and determine if it is air or not and whether their are entities their and if their are entities to damage them and if not to move on until I have reached a certain distance and then teleport the player to said end point?
Yes because you can do all those things at once with a loop. Raytrace is a separate function that requires its implementation to do other things for it to work
Thus would be less optimal. Since you need a path of blocks. Blocks have locations and entities have locations you can just compare the locations and get your direction of teleporting in a single for loop
No reason to over complicate when you have everything you need to implement your feature.
What would the best way of storing the list of entities within the area to then compare against?
You dont need to store them. The method to get entities returns a list just like the method for getting a list of blocks the player is looking
whats the current ideal way to create inventories
is there a popular library atm or should I just use the API
and is there an up2date item builder?
I just use my own api
Api isnt difficult. Depends what exactly you need to accomplish but overall probably better off just coding it yourself
similar to IF
all right, and what about item builders
idrc what I use I just don't want to write all of the constructor and setter non sense
unless there's a builder pattern in the API now, though I doubt it
Could use lombok to generate your getters and setters
Still applies
yes I can create my own builder pattern, but surely something exists already?
If you dont want to create all the code to make setters and getters you can use lombok for that leaving you just with the actual implementation to code yourself
Probably. Better question to ask would be. Are any of them decent enough lol
this is also true
@echo basalt am sorry for the tag but I checked your github for your api and I can't find it
will admit only scrolled around the first page for a minute but a name doesn't pop to me
probably because I didn't post it on github
ah I see
Lol
I made it for work, not for charity
Explains the not finding part
indeed
there are a lot of utils i don't share
Interfaces is only for paper and that's the only one I'm quite certain about, Incendo things tend to be well written π€·ββοΈ
triumph
Vector direction = location.getDirection().normalize();
for (double i1 = 0; i1 <= 10; i1 += 0.5) { // loop through each block up to 10 blocks away
Block block = location.add(direction.multiply(i1)).getBlock(); // get the block at the player's location plus the direction multiplied by the current loop iteration
p.getNearbyEntities(10,1,10).forEach(entity -> {
if(entity.getLocation() == block.getLocation()){
((Damageable) entity).damage(2);
}
});
if(block.isEmpty() == false){
p.teleport(location.add(direction.multiply(i1-0.5)).getBlock().getLocation());
return;
}
}```Sorry to be asking so many questions I just can't seem to get it to work... I have this code to check up to 10 blocks in front of the player for entities and blocks and to damage entities and to teleport the player to just before the block that is in the way. for some reason this doesn't work at all. when I used a raytracing method it semi worked as whenever I would be in any kind of indentation in the ground the teleport would then teleport me to ten blocks away from the block i was looking at. This was supposed to be better but either its not or I have no idea how to do it.
Blocks dont use doubles for locations
Also entity location wont match a block location
Need to modify the block location to increase y value by 1 if the blocks are at ground level
But i assumed you would implement to check 1 to 2 blocks above your path for entities
Since some entities are on the ground and some others fly
Also why do you need to damage entities? Are you killing them or just want to hurt them?
If you want to kill them could just remove them lol
Also the way you are obtaining your location isnt what i had in mind to do and probably shouldnt be multiplying either
Your final location object is going to end up far away doing that lol
I'm sorry if I'm being annoying asking so many questions. I'm really tired and I really want this to work but I just cant for the life of me actually translate your help into my code(I know I can understand it normally but I just am struggling rn).
declaration: package: org.bukkit.entity, interface: LivingEntity
This is what i was referring to in how you can get your path in the direction the player is looking
Would be best to use a floor method though in case they are looking up in the sky lmao
Floor method would then give you locations for blocks all along the ground
The player is meant to be able to use this to go any direction(up, down, left, right, etc.)
and do damage to anything in the path
not just go flat on the ground.
Ok then this method is perfect as is for your purposes
It gets all the blocks in their line of sight up to the distance specified
So if you put 10 for distance which ever way the player was looking it will return a set of 10 blocks out in that direction to include air blocks
Which is convenient for you because you can use it to detect non air ones in the set
From there, you can check while you are interating or looping for entities. And then at the end of the iteration or loop should have your final coord to teleport player to
Anyways i can only tell you how it can be implemented, up to you to learn how to actually apply it or implement it. This is how you learn. 
I'm trying some stuff. Would you be willing to tell me if I do it wrong when I've made something?
Nope. Currently at work on a phone
So my helping capacity is severely limited for the next 6 hours
In the mean time would have to illicit help for such things from someone who is more capable then me at present lol
Just saying I still have the same issue I had with raytracing. If I am not facing straight it will teleport me to the wrong location. As in if I look at the block that is on the same level as my feet(so if I was in it the upper half of my character would be exposed lower half inside the block) it will teleport me backwards... on top of this when I teleport it forces me to turn south every time but teleports me to the right spot...
Please ping me for any and all further responses
This is the current code associated with the above: List<Entity> entities = p.getNearbyEntities(10, 2, 10); List<Block> block = p.getLineOfSight(null, 10); block.forEach(block1 -> { entities.forEach(entity -> { if(entity.getLocation() == block1.getLocation().add(0,1,0) || entity.getLocation() == block1.getLocation().add(0,2,0)) ((Damageable) entity).damage(2); }); if(block1 != null){ p.teleport(block1.getLocation()); } });
thx
that might be client side
I'm using a HashBasedTable which allows me to record all the items in a custom inventory. The map contains <String (Action), CustomItem, Integer (Slot)>. Could you tell me why if one of these columns has equal value, they "merge"? I would like to prevent this.
whats a HashBasedTable?
@echo basalt explained me that
It's like a Map<With, Three, Objects>
two keys?
Based and hashpilled
hannah, could you help me?
no, idrk wat ur trying to do tbh
Thank you so much!
Table
well its a Map<R, Map<C, V>>
Is a key-key-value
ILLUSION, PLEASE
What am I doing wrong!!!?!
https://guava.dev/releases/19.0/api/docs/com/google/common/collect/HashBasedTable.html looks to be part of guava
But synchronized with shitty concurrent perf
if R has duplicate keys, it will be overwritten, same for the combination of R and C ig
?paste maybe idk
So, theorically , if I have a Cell:
CustomItem Item = new CustomItem(Item.PORK);
put(12, Item, NONE)
put(13, Item, NONE)
They shouldn't merge, because the row is different... Right?
yes
LOVE YOU, BROTHER
[11:31:58 WARN]: Event ServerConnectedEvent(player=botprzemek, server=net.md_5.bungee.ServerConnection@41b3a42c) took 442ms to process! How to handle the events without latency
BungeeCord
@EventHandler
public void onPlayerJoinEvent(PlayerDisconnectEvent event) throws IOException {
ProxiedPlayer player = event.getPlayer();
discordWebhook.addEmbed(new DiscordWebhook.EmbedObject().setDescription(player.getDisplayName() + " quit the server!"));
discordWebhook.execute();
}```
Is there a Special bungeecord discord or am I allowed to ask a question here?
Spigot and BungeeCord here
Is it possible to listen for a BungeCord chanel in a BungeCord Plugin? I would like to provide the possibility to tell my plugin I do not accept more players out of a spigot Plugin.
Fixed it by setting interval and adding message to list, idk it's working but i think it can be made better ``` instance.getProxy().getScheduler().schedule(instance, ()-> {
if(discordWebhook.getEmbeds().isEmpty()) return;
try {
discordWebhook.execute();
discordWebhook.clearEmbeds();
}
...```
what is the name of the different math formats?
really trying to figure it out so
I can learn to convert math equations into 1 lines
what math formats
Bodmas
or bidmas
Brackets
Indices
Division
Multiplication
Addition
Subtraction
sometimes google is a pain
ye
Not sure what you are asking
what is the type of formats?
What are math formats
idk bruh
my brain lack knowledge
Β½
Your brain is not braining
A fraction?
https://imgur.com/a/xrZBul2 how to make buycraft STFU
Dont use it i guess or just use a custom plugin
oofer
Personally i just always made my own. Paypal api isnt hard at all and paypall freely lets you use their stuff for web commerce stuff lol
wow they really just be out here flooding every server's logs? thats wild to me
All you need the plugin for is to listen for callback stuff
Buycraft uses paypal api just fyi
So i mean nothing special
Only pointing this out to let you know it is easy to use something custom and dont actually need to pay for buycraft services that paypal already offers for free lol
Minus the plugin part but the plugin part is like 1-2 classes with minimal code lol
How?
There is bukkit api for it, BukkitScheduler#runTaskAsynchronously
You can get scheduler with Bukkit.getScheduler
He is on Bungee
Bungee doesn't have smth like that?
ProxyServer.getInstance().getScheduler().runAsync
Ignore what I said, use this ^
woah
noted
Not hard to use java scheduler stuff or make your own either
never touched bungee runnable
thanks for sharing it
Yeah there is also Java api such as executors or completable future
Isn't runnable just funct interface?
A Runnable doesnβt run on a separate thread by itself tho
Neither do the bukkit ones
Thatβs what this is for
The async stuff in bukkit do not execute on another thread
Async is not threading
Two different concurrency mechanisms
I should re word
There is smth different then threading in java? Afaik there is no thing as coroutines in java
Async just means spread out processing
Spread out where
If it doesnt complete the job in one cycle it will continue it in a future cycle but not guaranteed to be the next cycle
It is also not guaranteed for it to run on another thread although it could
Oh, thanks for clarification π
Yeah asynchronous processing is like a hybrid concurrency thing without necessarily needing threads.
private final Executor executor = Executors.newCachedThreadPool(new ThreadFactoryBuilder().setNameFormat("Craft Scheduler Thread - %d").build());
Thatβs what the Scheduler is using for async tasks
Would talk more but time for me to head home from work 
Yup, different tasks may run on the same re-used thread though
You sure can
Itβs a cached thread
having an issue with some logic, I am trying to create roads, but the problem is that the road on the x-axis becomes vertical and i am having trouble debugging it
Vector direction = block2.toVector().subtract(block1.toVector()).normalize();
for (int j = -2; j <= 2; j++) {
double xOffset = direction.getY() * j;
double yOffset = direction.getZ() * j;
double zOffset = direction.getX() * j;
currentLocation = new Location(world, x + xOffset, y + yOffset, z + zOffset);
OuterPath.add(currentLocation);
xyz[0] = xOffset;
xyz[1] = yOffset;
xyz[2] = zOffset;
}
Is it possible to listen for a BungeCord chanel in a BungeCord Plugin? I would like to provide the possibility to tell my bungee plugin I do not accept more players out of a spigot Plugin or something else.
could this be a pitch/yaw problem?
why is road up?
are you talking about the one on the y axis?
yeh!
just guessing you're testing vectors right
i am using vectors yes
road is up because 2 parameters are given and one of the params was above the first one
How can I solve this error message?
I tried to compile my plugin with 1.8 and 18 java, neither of them works.
compile with java 8 (and do it properly)
Okay, can you explaing what do you mean by do it properly?
you said you tried compiling with java 8 and it didn't work, while it should, so my guess is you messed something up
hence the do it correctly
I don't even know what to ask. If I could do it correctly, I would have not asked for help..?
Use a builttool and the proper jdk and itβs easy
I can't guess how you're compiling your plugin
Google your question before asking it:
https://www.google.com/
Well, I put the jdk first to 1.8 and run the mavenbuild, I got the error message,
so I changed the jdk to 18 and run the maven build, got the same error message.
As I said
.
and what does your maven compiler plugin config look like
Do you want to see my pom.xml?
or the inner configurations of maven
Just send all of it.
?paste
at first glance, check source and target. Believe that has to be your java version
in your pom there is <source> and <target>
18 stands for java 18, 1.8 stands for java 8
Ah. I see.
you specified java.version, which I believe only works for spring boot projects
How can I change the instanceof part to compile with J8?
change sdk in project structure
if (x instanceof Y) {
Y y = (Y) x;
// Code
}
If you're developing for recent minecraft versions, change java to a newer version, (17 is LTS 19 is current)
ah i thought you wanted to change java version
while spigot does use a cachedthreadpool for that, that doesn't mean it is required for asyncronous tasks. Asynchronous tasks are as I stated where the work is spread out and doesn't block the main thread.
which is what I was trying to explain in what exactly Asynchronous is lol
@hazy parrot only pinging as it is relevant to our convo earlier
you meant this?
that shouldn't matter because you can still specify source and target version
no lol
if sender instanceof Player { Player p = (Player) sender }
the JDK version in most cases is not relevant to the version you are compiling for caveats being if you are trying to compile for a higher version then the JDK version or a super old version that the JDK does not support.
Yeah, thanks for explanation again
Receiving the same error from compiler
what error
show code
show your pom
bruh remove that p
source code isn't going to matter here
gave you the code
the error if you read has to do with setting the source version in the pom
I don't have 17 jdk downloaded, does that matter?
is he willing to change his sdk to 17 or to 8 now
people talking thro each other
change the source and target to the java version you have. To find the java version you have
type in command prompt
java -version
yeah, but If I compile at java 18, I get an error from the server.
this error
then set the target and source to 17
you are allowed to set the target and source to a version lesser then the JDK because the JDK is capable of compiling for lesser versions
it has a range it supports
aight, I'll download 17
oh
just set the target and source
JDK 18 can compile for 17
because 17 is less then 18
shoudl I change this to 17 too, right?
why only 8?
Does someone knows which is the latest Bungee version working with 1.8.8 ?
what message?
only see the one where it complains about pattern matching not existing in source 8
that is easy to fix
update the JRE
then they need to update their JRE and compile for 16, idk what mc version they are using
but I don't support old versions therefore anything I say should always be assumed for up to date versions
1.16 isn't too bad in terms of old versions
the fix is easy for them
update their JRE to 18
on the server
then they can compile for 18 etc etc
kotlin π
the others do
Idk who deleted message about kotlin, but they have to shade stdlib
I get the same error as I sent earlier in a pic
proabaly me, I should have send it as a paste ionstead of a discord file
update the java version you are using to run on the server
I can run the server from 1.8 only, higher versions reject the server from starting
what mc version you using?
you shouldn't have problems running 1.16 with java 16 or java 17
not sure why it must specifically require 1.8
Yeah just shade stdlib
don't even know what mohist is
obviously seems terrible if it requires outdated java versions
is it a plugin or what? I am new to it in general
Its dependency, same as spigot is
You have to add it to pom
then good luck to them
I suppose
we also don't support forge/spigot hybrids either and can't really help in some instances in regards to that
or just get the relevant mod
Well, thanks for the help, I try with other java versions and change the server.
has a permission manager π
so yes it exists
also
forge has permissions api stuff
so...odds are you can find a mod for such things now π
they didn't use to back in the old days π
but they have since progressed
anyways point is, odds are you can typically find relevant mods these days
thanks to them finally creating and updating their api
and as pointed out
pretty much unnecessary for hybrids
the only reason hybrids existed back in the day was due to the fact forge had non-existent api and thus certain things were plugin exclusive IE permissions being a big one lol
however that has since been rectified and thus hybrids are mostly obsolete now
okay, thanks bro
Im facing the problem where the BukkitRunnable is needing a plugin but Im in the event class is there a way to fix this?
@EventHandler
public void onPlayerItemConsumeEvent(PlayerItemConsumeEvent event) {
Player player = event.getPlayer();
player.sendMessage("You consumed something!");
if (event.getItem() != null && event.getItem().hasItemMeta()) {
player.sendMessage("Item is not NULL and have ItemMeta!");
if (event.getItem().getItemMeta().equals(ItemManager.potionBerserk.getItemMeta())) {
player.sendMessage("You drank a Potion of Berserk!");
new BukkitRunnable() {
@Override
public void run() {
getServer().dispatchCommand(getServer().getConsoleSender(), "say lol");
}
}.runTaskTimer(this, 0, 20);
}
}
}
Guide to dependency injection: https://www.spigotmc.org/wiki/using-dependency-injection/
BlockPosition blockPosition = new BlockPosition(location.getBlockX(), 0, location.getBlockZ());
PacketContainer fakeSign = ProtocolLibrary.getProtocolManager().createPacket(PacketType.Play.Server.BLOCK_CHANGE);
PacketContainer openSign = ProtocolLibrary.getProtocolManager().createPacket(PacketType.Play.Server.OPEN_SIGN_EDITOR);
PacketContainer signData = ProtocolLibrary.getProtocolManager().createPacket(PacketType.Play.Server.TILE_ENTITY_DATA);
fakeSign.getBlockPositionModifier().write(0, blockPosition);
fakeSign.getBlockData().write(0, WrappedBlockData.createData(Material.OAK_SIGN));
openSign.getBlockPositionModifier().write(0, blockPosition);
NbtCompound signNBT = (NbtCompound) signData.getNbtModifier().read(0);
IntStream.range(0, text.length).forEach(v -> signNBT.put("Text" + (v + 1), "{\"extra\":[{\"text\":\"" + text[v] + "\"}],\"text\":\"\"}"));
signData.getBlockPositionModifier().write(0, blockPosition);
signData.getIntegers().write(0, 9);
signData.getNbtModifier().write(0, signNBT);
try {
ProtocolLibrary.getProtocolManager().sendServerPacket(player, fakeSign);
ProtocolLibrary.getProtocolManager().sendServerPacket(player, openSign);
ProtocolLibrary.getProtocolManager().sendServerPacket(player, signData);
} catch (InvocationTargetException exception) {
exception.printStackTrace();
}
signData.getIntegers().write(0, 9);
Looks like someone had a similar issue on here:
https://www.spigotmc.org/threads/could-not-pass-event-inventoryclickevent.460324/
people still instantiating bukkitrunnables π
thanks you
welcome
what is the right way?
Bukkit.getScheduler().runTaskTimer(plugin, () -> {/* code here */}, x, y)
I don't think that's the problem.
signData.getIntegers().write(0, 9);
An error occurs in that code.
wdym di
File file = new File("spigot.yml");
FileConfiguration yml = YamlConfiguration.loadConfiguration(file);
yml.set("messages.unknown-command", Major.MU("&cUnknown command. Type \"&e/help&c\" for help."));
try {
yml.save(file);
} catch (Exception e) {}
the spigot.yml is not saving? am i did that wrong?
I was trying to execute a command after 100 ticks when a person finish drinking a potion
looks like on that thread the person checked if the item was null. well, actually, I should ask: when is the issue occurring in game?
signData.getIntegers().write(0, 9);
If you remove the code, the fake sign opens well.
However, the desired title is not written on the sign.
menu.open(
player, new String[]{"&a&lThis", "&e&lis", "&d&lan", "&b&lexample!"},
(player1, text) ->
Arrays.stream(text).forEach(player1::sendMessage)
);
Then youve been 10k people in a hall singing songs together and having costumes on them like carnival
this run the task on repeat of a timer iwas trying to run a task once after a specificed tick
one moment, I'm actually in a Zoom meeting rn lol. I'll check it out in a second
ohh,, sorry thanks
tysm i think i misunderstand the method and mb
so you want players to be able to click on the sign to open a menu?
Is there a way to merge the meta to ItemManager.potionBerserk.getItemMeta()?
Bukkit.getScheduler().runTaskLater(plugin, () -> {
getServer().dispatchCommand(getServer().getConsoleSender(), "kill " + player.getName());
}, meta.getCustomEffects().get(0).getDuration());```
to
```Bukkit.getScheduler().runTaskLater(plugin, () -> {
getServer().dispatchCommand(getServer().getConsoleSender(), "kill " + player.getName());
}, ItemManager.potionBerserk.getItemMeta().getCustomEffects().get(0).getDuration());```
BukkitRunnables is also the right way. Donβt shame him for that
What I want is a packet-generated fake sign.
I want to put in a sign message.
I'm looking at this and making it.
\
i think GUI shop might have an issue with the Sign Menu plugin, perhaps? Maybe try disabling GUI Shop and then running the server again.
I have an issue with lineOfSight. If I am not facing straight it will teleport me to the wrong location. As in if I look at the block that is on the same level as my feet(so if I was in it the upper half of my character would be exposed lower half inside the block) it will teleport me backwards... on top of this when I teleport it forces me to turn south every time but teleports me to the right spot...List<Entity> entities = p.getNearbyEntities(10, 2, 10); List<Block> block = p.getLineOfSight(null, 10); block.forEach(block1 -> { entities.forEach(entity -> { if(entity.getLocation() == block1.getLocation().add(0,1,0) || entity.getLocation() == block1.getLocation().add(0,2,0)) ((Damageable) entity).damage(2); }); if(block1 != null){ p.teleport(block1.getLocation()); } });
I'm trying to use a sign when setting the item price!
OK, so you're clicking on the sign to set the price and then the error happens?
you can't update signs before the editing is finished
you have to wait till the done editing button is clicked from the client to then do whatever it is you want
No! There's no problem with clicks.
All I want to do is create a default sign message!
this
it all depends at what point you are trying to update the sign
if you just want a sign that exists or is generated by the server and isn't dependent on waiting for the player to place one
then you can easily do that with packets
however
there is a caveat
signData.getIntegers().write(0, 9);
```There's an error in that part.
not sure what getIntegers() does
indicates the type of the block entity
Why does this code print ss instead of Β§rss?
var item = new ItemStack(Material.IRON_SWORD);
var meta = item.getItemMeta();
meta.setDisplayName(ChatColor.RESET + "ss");
item.setItemMeta(meta);
System.out.println(meta.getDisplayName());
Because the reset character resets the colour and formatting to default
So, it's doing exactly what it should be doing π
color codes are not printed when you use the ChatColor class api
is there a way of getting the original string which would contain ALL color codes including reset
cuz when i get the string from getDisplayName and set it again it becomes italic
how can i avoid that?
ChatColor.stripColor
wdym? what should i strip?
the colored string?
when i set the stripped string to display name it becomes italic
makes sense?
how can i avoid that?
ChatColour.reset
well you are coloring it using ChatColor.translateAlternateColors somewhere
no
should i just add reset to the start of the string EVERY time i set a display name?
Spigot unfortunately "cleans" the string - as such color codes can be lost
This behaviour was introduced in an early 1.16.0 build if I remember correctly
If you are talking about printing the string to sysout - then idk how you can escape Β§ there
yeah, including the reset color codes
Multiple sucessive color codes can be removed
i don't
I.e. Β§0Β§aΒ§bHello! will be cleaned to "Β§bHello!"
then use String.replace('Β§', '&')?
". Β§0Β§aΒ§b" nice sense lol
There was a plugin that I forked due that reason
And it's almost definetly intended on spigot's part - so yeah, so much for cross-version compatibility
so if i just add a reset code to the start of every string i am setting to display name, will it fix the italic problem
For display names yes
k thanks
The MC Client implicitly adds italics and grey color to item names should they have a custom name
Bruh
wtf
uhh
Choco is around
ping choco as well
inb4 it's OP
no idea
I missed drama, heck I need to pay attention
yeah I missed it too π¦
Wat happened
someone send a load of screenshots blocking the channel
didnt read what they said
Lol
btw is it safe to do doubleValue == 0 or should i do Double.compare(doubleValue, 0) == 0?
did you translate it?
very funny
doesn't really matter
but if you really care you do
Math.abs(d - 0) < 1e-6;
(or some other epsilon)
-0 is just for completeness, you can omit it
compare is really only useful for two things
locality and using custom comparison rules
more handy on strings then say numbers
with numbers you are better off with operator comparisons instead
unless for whatever reason you need its object form then it would be equals
comparing nearly identical numbers goes brr
what happens if i use a get method of ConfigurationSection and the key i provide doesn't exist?
does it return null or does it return a default value?
read teh javadocs. int is a primitive which can;t be null
aight thanks
quick question! whenever the server starts, the config is loaded to memory, correct?
so there shouldnt be any "big" perf impact if we're getting any values from it synchronously.. riiight?
Yeah, they are loaded into map
sweet.
is there a way of checking if a string is a valid color name via net.md_5.bungee.api other than using deprecated methods or catching IllegalArgumentExcpetion?
its an enum so check the return of valueOf
Color is an enum
The config.yml is loaded whenever someone calls getConfig()
Might happen at saveDefaultCongig() too
Iirc
π€ loaded from memory and not storage, hopefully?
can an enderman hold enderchest?
depends how the blocks they hold are rendered
if it just shows whats in their hand or something yes
if its an entity model in resource packs and some nbt data probably not
The first time #getConfig() is called, it is read from the file. Once in memory it stays in memory until the config is reloaded (#reloadConfig() iirc)
are you sure? from what I know, it loads the config on startup
ah. should've checked the source myself. thank you!
yeah I've seen that, but doesn't the java plugin loader already do that somewhere?
idk if entities have that
you might have to get their inv and set a slot
it doesnt. Only LivingEntities can have equipment
it doesn't afaik
on which slot?
it has :/
weird, I always thought it would
no.
no idea
nah it makes sense cos not every plugin uses a config, and it would just print an error in console if it tries to load a non existing plugin
I create the the enderman this way
bro. that's an Enderman, not just an Entity
ofc Enderman extends LivingEntity and so you have the getEquipment() method
the question was wether the Entity interface declares that method, and it doesn't. It's declared in LivingEntity
so.. this should technically make it so that when I set a new value in the config, I can get it again later (without restarting, of course) without saving?
yeah
cool beans
but really you should cache the file and have a reload command
Is it bad style to use sender.hasPermission instead of super(name, permission, aliases); in bungee or does it not really matter ?
The second option seems not to work well with sub command permissions
wdym with super(name, permission, aliases) ?
calling super in a command executor doesn't really do anything
I just saw that the command class hast two Constructor:
public Command(String name)
{
this( name, null );
}
/**
* Construct a new command.
*
* @param name primary name of this command
* @param permission the permission node required to execute this command,
* null or empty string allows it to be executed by everyone
* @param aliases aliases which map back to this command
*/
public Command(String name, String permission, String... aliases)
My Question is if using the one with no perms and than using sender.hasPermission later on is bad code style
Is there a way to remove from the boss bar the bar without a texturepack?
if you pass the permission to the constructor, bungee will handle the permission thing for you. Your executor won't run if the player doesnt have the permission, they won't see the command in tabcomplete, and they will be shown the default "no perms" message
no
if you check the permission yourself, ofc you can send any message you like
Okay
for subcommands, it depends on whether you have one "general" permission
e.g.
myplugin.mycommand.subcommand1
myplugin.mycommand.subcommand2
If you only have those permissions, then you cannot use the constructor option anyway
if however you have
myplugin.mycommand
myplugin.mycommand.subcommand1
myplugin.mycommand.subcommand2
then you could call the constructor with the "parent" permission myplugin.mycommand
Okay thats what I expected
some1 know how get the head point location of armor stand?? especially when rotates
I would check the perms myself so you can make the message configurable
?paste
armorstands are entities
yes?
Maybe one additional question is it Really intended to Create commands like this:
public class CommandJoinMe extends Command {
public CommandJoinMe(String name) {
super(name);
}
@Override
public void execute(CommandSender sender, String[] args) {
sender.sendMessage(TextComponent.fromLegacyText("Β§8Β» Β§c Jey"));
}
}
and in on enable :
ProxyServer.getInstance().getPluginManager().registerCommand(this, new CommandJoinMe("joinme"));
?
Still Bungee related
declaration: package: org.bukkit.entity, interface: Entity
yah i know i can #getEyeLocation() but i want the exactily point on the image understand ?
Hi guys. Is there any way to find a specific block in a chunk without for loops? When I fly with spectator mode, it is finding blocks with for loops but gets so much lag. Is there any way to improve the code?
Why isn't ChunkLoadEvent called on the chunk in which the player is?
is it hard to modify a location?
get eye location, modify it with the height of the entity
but wouldn't the height be the size of the entity?
no idea
Yeah the eye location will not ever change
because the chunk was already loaded?
so thought consider rotating the head but I dont know if that could help me get that specific point
How is it loaded before plugin is enabled?
if it's around the spawn, it gets loaded before that
did you set your startup to LOAD instead of POSTWORLD
in plugin.yml?
only thing I can think of is to keep track of the pose to therefore know where the head is at
although not sure why you need to know this exact location
for a system nvm
but how
well what is setting the pose to begin with?
Pose takes a Eular Angle, going to have to do use math to translate angles to coords
i already have that code but
to make life easier i use player head rotation
How can I check what load type or level a chunk has?
I wanna check if a chunk is level 32 or higher since then its chunk ticks arent being processed
i changed to STARTUP and it fixed it,
but i'm just curious is it too performance intensive to listen to chunk load event and iterate through all PDC keys of it?
Not really especially if they are all your own keys I mean how many keys could you have
Generally I'd just do an o1 check though as that's definitely reccomended
i have keys for custom blocks i need to initialize on startup
You should be fine.
k thanks
I have something similar I have a class called
LightLocation that has a x y z double and I have a PDC type of chunk as a List of LightLocatiln
nah. the server loaded that data anyway, you are just looping over sth that already exists
yes then how i get the location?
do i need to close InputStreamReader or URL#openStream manually?
i always tend to forget it π€
try with resources supremacy
yes
or you let try do it for you
or you forget it
try(InputStreamReader myReader = ...) {
myReader.doSomething();
}
yeah
basically me cuz i never know whether i should close it
this autocloses it
like JavaPlugin#getConfig or smth opens a inputstream and never closes it
Is there a way in maven to do for example if i run mvn clean package test it will use custom outputDirectory in shade plugin and if i do command without test, it normally exports it to target folder
i don't need to put url's InputStream in separate variable right?
i always thought the reader closes the delegate input stream but im not sure
i mean i can use profiles, but it basically requires to write plugin config two times
Is there no ingame tabcomplete for bungee plugins ?
dont think so
So how to work around ? write a spigot plugin for tab completing bungee commands ?
yes, with profiles
although I cannot give a concrete example for your specific question rn
wait, lemme check, I'm using profiles in jefflib I think
hm nah must have been some other project
okay so basically, you can just define properties
I'll try to write sth
<profiles>
<profile>
<id>default</id>
<activation>
<activeByDefault>true</activeByDefault>
</activation>
<properties>
<jarLocation>.</jarLocation>
</properties>
</profile>
<profile>
<id>exportToServer</id>
<properties>
<jarLocation>C:\MyServer\plugins</jarLocation>
</properties>
</profile>
</profiles>
...
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<version>3.1.0</version>
<configuration>
<outputDirectory>${jarLocation}</outputDirectory>
<finalName>MyAwesomePlugin</finalName>
</configuration>
</plugin>
sry for formatting, I typed it directly into discord
and then mvn clean package -P exportToServer
actually you don't even need the default profile, you could just define it as normal property, the exportToServer profile would then override it
wow cool, thanks
np
not sure if this is 100% correct, but it at least comes very close to how it should look π
yap π
yep just tested, and this works. you dont need the default profile
<properties>
<jarLocation>.</jarLocation>
</properties>
<profiles>
<profile>
<id>exportToServer</id>
<properties>
<jarLocation>C:\mctest\plugins</jarLocation>
</properties>
</profile>
</profiles>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<version>3.3.0</version>
<configuration>
<outputDirectory>${jarLocation}</outputDirectory>
</configuration>
</plugin>
</plugins>
</build>
this is all you need
is there an event called when a player stops mining?
something similar to how the player dig packet works
yeah it's called like that
thanks
np
is it called both when a player stops mining and finishes mining?
with stops i mean doesn't mine the block but stops clicking
BlockDamageEvent is called when he starts iirc
I don't know, you gotta try
aight thanks
yeah but we're talking about BlockDamageAbortEvent
that is unforgivable
yup that one i managed to find
sorry bosss!
yeah okay it's alright
thank god
so I found this class: net.md_5.bungee.api.plugin.TabExecutor; but do not know ho to register it
just tested right now, works like an charm, thanks again π
what are you trying to do?
great! np
btw you can also make profiles activate automatically through criteria
e.g. "when OS is linux, activate exportToServer profile, otherwise not" or sth
I try to add tab complete for my bungee commands
and you need data from the backend servers for this?
yeah that could be also useful, because I literally need it to export to target folder only in workflow
example:
<profiles>
<profile>
<activation>
<os>
<name>Windows XP</name>
<family>Windows</family>
<arch>x86</arch>
<version>5.1.2600</version>
</os>
</activation>
...
</profile>
</profiles>
more details about which values you have to put in there can be found here: https://maven.apache.org/enforcer/enforcer-rules/requireOS.html
Maybe ... don't know ... I just want to type /f and my command foo should be there and with net.md_5.bungee.api.plugin.TabExecutor; i try to add /foo bar and whatever
can't you just override the onTabComplete(...) method then?
the second thing is already working
?jd-bc
?jd
huh where is that class
https://ci.md-5.net/job/BungeeCord/ws/api/target/apidocs/net/md_5/bungee/api/plugin/TabExecutor.html#onTabComplete(net.md_5.bungee.api.CommandSender,java.lang.String[]) yeah just override the onTabComplete method?
i think he's saying the primary command isnt being tabcompleted
exactly
oh isn't there a bungeecord setting for that or sth?
subcommand is already working

