#help-development
1 messages Β· Page 873 of 1
Is there a way to hide or disable the Wither health bar in version 1.8.8?
i think so but i haven't looked into it
whatever is the main class or?
Whatever is the class you want to pass your config to
public class TaserCommand implements CommandExecutor {
new TaserCommand(getConfig())
You need to call the constructor from your main class
sorry im new to java so im trying to learn
?learnjava
Here are some links to get you started on learning Java:
- https://www.codecademy.com/learn/learn-java
- https://www.sololearn.com/learning/1068
- https://www.learnjavaonline.org/
- https://programmingbydoing.com/
- https://docs.oracle.com/javase/tutorial/java/index.html
The last one is the only official one, however some of those concepts assume that you already know a bit about programming.
host them
serve the index.html that you get or use something like reposilite to extract the jar and host it inside it
There is some maven plugin that creates them for you
cloudflare pages >>>
but yeah
thanks
ill do lol
but its cool
literally just
upload files
(you need to have a domain)
and yeah
only that
@young knoll pineapplechat-legacy coming soon???
Why you making spigot api again?
I'm not?
y tho
Hey guys,
I'm creating shop plugin
I want to build bungeecord system so to share data with each serer, I saved my data on mysql not via caching, just retrieve data directly with using query
But I think this way have many problems (like security & stability)
so I've been searching many documents I found redis caching tool
Are you guys recommended Redis? If you recommend Redis I want to know the reason
Also I'm considering Mongodb
Please Recommend which is better
I'm sorry that I didn't know the Redis
Could be really fancy and use websockets to stream it π
For a shop though you'll want to make sure that only one item is bought at a time. To do that you'll likely want to use redis to prevent duplication bugs. Many servers suffer from shop and auction dupes because they don't validate purchases properly
Beaming | Help | Maven Dependency Issue
Thank you for answer but Is it similar HashSet on Java to do prevent duplication bugs?\
there is a really cool thread that can be useful for you: https://www.spigotmc.org/threads/how-to-cross-server-communication.407298/
No, so in this case a duplication bug would occur if you did the following:
(assuming the shop is for players and not a server shop)
- User lists item
- Item is either broadcasted or updated in db
- 2 users on 2 other servers see item and click at almost the same time
- Send request to delete to DB
- Give item to player and subtract cost
(note that canceling and buying at the same time would duplicate the item as well. Allowing a user to list and delist spam on multiple servers to potentially game the system and dupe expensive items)
To solve this, step 4 and 5 need to be modified. It can create delay but delay is unavoidable in creating a system that doesn't have duplication exploits across servers/realms.
- send request to delete from DB await success response (1 row modified/whatever redis says) then you can continue with the transaction.
- ~
I am not quite sure if this will answer your all questions but should answer some
Hmm so To solve thesse problems am I have to use redis?
To prevent multi-tick delays yes. You'll likely end up having to create a system where you asynchronously update your DB, parse the response, then spawn a task on the main thread to run on the server to complete the transaction. It will have delay but at best it'll be 50ms (1 tick) and at worse you'll be looking at 150ms give or take. It'll be a bit of a delay but the tradeoff is total security and the prevention of any possible database-related dupe bugs.
Sounds fancy but is quite easy to implement. Just create an async task that executes a sync task through Bukkit's scheduler and you're good to go
Yeah, it's not difficult. Just takes a bit of tuning to make it feel as nice as possible and to ensure total security.
TheMulti-Tick delays are same that 5 steps? to use redis?
When I say multi-tick delays what I mean is that the write/read operation could take longer than 1 tick (50ms) to complete. Redis will help with this by providing the fastest possible method of writing/reading changes.
confused what the issue with mysql is
Probably nothing? I mean most peoples servers won't see a delay that insane unless the server is hosted in Antarctica
you just need to make sure to lock appropriately
I think thats what they were concerned about
we're concerned about this
- What exactly prons to use
redisandmongodbvsrediswhich is better to prevent these steps
- User lists item
- Item is either broadcasted or updated in db
3 users on 2 other servers see item and click at almost the same time - Send request to delete to DB
- Give item to player and subtract cost
mongodb
I find mongodb to be quite bloated for a db. Personally I agree with md_5 I think you'd be okay just using sql.
Yeah sql goat
Postgres π€€
Why are you guys not hate SQL query?
I like NoSQL 'cause If I code with SQL it look just below
String actionSQL = "INSERT INTO `" + shopItemTable + "` (`itemstack`, `slot`, `sell_price`, `buy_price`, `max_stock`, `remain_stock`, `popularity`, `commands`) " +
"VALUES ('" + encoded + "', '" + slot + "', '" + sellPrice + "', '" + buyPrice + "', '" + maxStock + "', '" + remainStock + "', '" + -1 + "', '" + commands + "') " +
"ON DUPLICATE KEY UPDATE itemstack = VALUES(itemstack), slot = VALUES(slot), sell_price = VALUES(sell_price), buy_price = VALUES(buy_price), " +
"max_stock = VALUES(max_stock), remain_stock = VALUES(remain_stock), popularity = VALUES(popularity), commands = VALUES(commands)";
It's too dirty isn't it?
I mean ORMs exist for this exact reason lol.
what is ORMs ? haha
Nooooo
object relational mapping. It allows you to map an object to a DB table so that you can easily perform CRUD operations without needing to write any SQL
Just use jooq
Also, you should never be doing a "on duplicate key". If you've pulled an object you should know if it's new or not. You never really want to make it so that you're guessing and writing queries that are longer than they need to be
If you want to learn a library that business overuse you can always go with hibernate
. Really bloat things up
Plus
I asked this question 'cause I want to upload my plugin on SPIGOT premium So I think I have to use Scalable SQL Guys What do you think is most scalable SQL?
Technically if you use an ORM (hibernate, JOOQ) or any driver that supports multi-db that would be for the client to decide.
Soo your recommendation is SQL not mongodb or Redis
Yes. Redis is only if you get to the point where you're seeing considerable delays in your queries.
Which is rare
You prob gonna have 30-100 concurrent players
Thank you guys for answers ! β€οΈ
That's extremely optimistic
yes, this can only be solved with a transaction lock
Am I don't have to use Redis? If I use SQL
yes sql is fine
in fact your example is so simple it doesnt even need a lock
just check the item was deleted before giving the money
Andd for NoSQL I have to use jooq or the other things
If (rowDeleted) giveMoney(); else // item was already purchased
Ahh got it!
What If the value is changing too many times on real-time like change cost of the items ?
Is it still fine to use SQL?
Yes, SQL is the right tool for the job here. You just need to be defensive how you code and use locks if necessary
Got it thank you for advice, I was honored to talk you guys!
No worries
Anyone got a list of all the events I need to handle for region protection?
Does anybody know if acf-paper works on purpur? It apparently doesn't work, this error is thrown when my plugin is loaded https://pastebin.com/ZmncTyhg
Pastebin.com is the number one paste tool since 2002. Pastebin is a website where you can store text online for a set period of time.
how can i change an inventory's title
You need to shade it
I believe the newer versions have a setTitle method
For old versions you need to send a window open packet
will this work: create the inventory again but with a new title, initialize the items and display the inventiry to the player?
That'll reset the cursor's position
okay
I did it https://pastebin.com/2WinRnAG
Pastebin.com is the number one paste tool since 2002. Pastebin is a website where you can store text online for a set period of time.
And are you building with shadowJar?
also it works perfectly when I start a server with the runServer task
Decompile your jar and see if it's actually there
no, just build
playerAccount.setMithrilPower(playerAccount.getMithrilPower() - cost);
this.inv = Bukkit.createInventory(null, 9 * 6, "Mithril Management | " + ChatColor.DARK_GREEN + playerAccount.getMithrilPower());
initializeItems();
openInventory(e.getWhoClicked());```
will it work like this?
```java
public void openInventory(final HumanEntity ent) {
ent.openInventory(inv);
}```
hey look another hypixel clone
oh cmonnnnn you can litteraly see how shitty of a clone this is
oh, it's not there
idk why though, my gradle.build looks right
nevermind
there are two final jars, one of them ends with "all"
everything is relocated inside this jar, but I was picking the other one
"all" is the default classifier for shadow's shadowJar task's output
you can set the classifier to an empty string instead to make gradle bahave like maven and replace the existing .jar
tasks.getByName("shadowJar", ShadowJar::class).apply {
archiveClassifier.set("")
}
that is an insane configuration syntax
how do you like ths
tasks.shadowJar {
archiveClassifier = ""
}
well not always possible otherwise
Yea, I mean functional for 90% of plugin developer usecases 
only because none of them properly use buildSrc
thank god they merged the assign shit for kotlin dsl in 8.5
what actually is a pain is seeing all those build files generated by mv "dev" plugin
plugins {
id 'java'
}
group = '${GROUP_ID}'
version = '${PLUGIN_VERSION}'
def targetJavaVersion = ${JAVA_VERSION}
java {
def javaVersion = JavaVersion.toVersion(targetJavaVersion)
sourceCompatibility = javaVersion
targetCompatibility = javaVersion
if (JavaVersion.current() < javaVersion) {
toolchain.languageVersion = JavaLanguageVersion.of(targetJavaVersion)
}
}
tasks.withType(JavaCompile).configureEach {
options.encoding = 'UTF-8'
if (targetJavaVersion >= 10 || JavaVersion.current().isJava10Compatible()) {
options.release.set(targetJavaVersion)
}
}
processResources {
def props = [version: version]
inputs.properties props
filteringCharset 'UTF-8'
filesMatching('${MANIFEST_NAME}') {
expand props
}
}
like wtf is this ^ Why not just this:
plugins {
id 'java'
}
group = '${GROUP_ID}'
version = '${PLUGIN_VERSION}'
java {
toolchain.languageVersion = JavaLanguageVersion.of(8)
}
tasks.compileJava {
options.encoding = 'UTF-8'
}
processResources {
filteringCharset 'UTF-8'
filesMatching('${MANIFEST_NAME}') {
expand "version" to version
}
}
but I'm already happy there's no // Build file start logic and // Build file end logic comment in their build.gradle
tasks.compileJava {} configures only that one task by the way, whereas the other thing configures all compilation tasks
there is only one task
if there would be more, it should be split up into a buildSrc part anyway. and even if not, then one would just use tasks.withType(JavaCompile).configureEach too, it's still unneccessary to spend 14 lines to define the java version
I mean, under what circumstances would you even have different compileJava tasks in one project for a plugin? that sounds like a scenario that's only gonna happen if one strictly refuses to split up logic into proper subprojects
tests
@tender shard Is there a way to relocate a transitive dep on maven?
Basically my library depends on lib2
and I depend on my library and would like to relocate lib2
then you'd either publish a shaded version of myLibrary that already got lib2 relocated, or the user of myLibrary would have to declare the relocation for classes from lib2
I don't think the shade plugin can differentiate between classes that came from "current project" or another dependency while relocating
That's fine
Trying the second approach
It relocates the library but breaks import statements
huh? are you excluding things from relocations or sth?
Doubt
if you unit test a spigot plugin then I assume that the logic is already split up into a plugin and a "core" part or similar, and hence you'd include the whole stuff as java-conventions from buildSrc anyway?
fancy, that's only 33-50%
screw it here
This is the project that's using the conversations module
(this specific branch)
https://github.com/Browsit/ConversationAPI This is my lib
And the lib we depend on is Adventure
you're not using paper api, do you?
Uh no
ok because if you relocate adventure, you won't be able to throw those objects at any paper methods anymore
It's fine
Understandable
Actually 
Yeah it's fine we use legacy serializers n stuff
I just call the Audience.sendMessage method
and create the audience with BukkitAudiences
but from your included adventure
that's fine
what you can not do is e.g. PlayerJoinEvent#joinMessage(aComponentFromMyShadedAdventure)
I mean, sure, but you still have a specific test compilation task
Yeah that's expected
We don't use paper api on the Quests project
Now I'm thinking like
the pom structure is slightly fucked
at least for conversation-api
I wonder where tf he got the kyori import from
configuring generic stuff like encoding and release/target for compilation tasks is usually desirable to be done globally, specifying those properties for individual tasks is counter-productive
why didn't this specific class relocate
yeah so instead of looping over all compileJava tasks you got from <where-ever>, why not just have exactly one java-conventions in buildSrc that sets the toolchain and java plugin, and then include this everywhere you want to have a java compile task
This is what happens when you have a programmatic build system
maybe (idk) your <includes> section also limits which artifacts classes get relocated from? hmm
You can do a million things a million ways
@echo basalt show the output of mvn dependency:tree
I don't see the point you're making
having a java convention is nice, but what are we discussing here exactly
Nothing really. I'm just complaining about people who scram their whole logic into the parent build file instead of separating it properly kek
I was talking about tasks.compileJava {} vs. tasks.withType<JavaCompile> {}
Not home anymore
Is md5 a gradle hater? The world wants to know
Is there a way to make a parrot go really quick? I tried changing movement and flying speed attributes and the speed is still capped at quite low. I also tried changing the speed in the pathfinder goals and it is still capped
sounds like you missed something
i remember having a similar problems with minecarts, turned out there was a flag that limited the maximum speed
@obsidian drift
they all have datawatchers and there the flags are stored
or entitydata if i remember correctly how mojang calls it
Does Spigot have a built-in method to get an OfflinePlayer by name?
I know I can use Mojang's API, but it would save me time and effort if it is already in there
yeah, Server#getOfflinePlayer(String) or something similar should exist, I'm pretty sure
Yea, but it's deprecated and not persistent
did you try to modify this?
If the player changes their username, the server will not have the new username of the player
What did you expect
Deprecated just because getting an offline player by username is bad and you should use UUIDs
Like I said, requesting directly to Mojang's API, you do get the up-to-date usernames
No idea about that and no idea why you would want to know their new usernames
The reason to not use the method is because the server's persistent player cache only gets updated for the player when he joins. When the player changes their username and not join the server, the server is still holding the old username
Ye, but why would you want their new username
I'm making a plugin where I can look-up players based on their name
UUIDs aren't user-friendly
The player has to simply be able to enter a player's name rather than their UUID
the goals seem to not take into account attributes, so you have to modify the moving goals to take it into account
Well, then mojangs api is your best friend
Spigot/Bukkit was made to interact with the game, not with mojangs api
I figured that, but I was wondering if Spigot had this built-in so I don't have to set up the request and what not
???????????????? π€‘
The new profile stuff might work for this
Thank you. Any docs on it?
Wtf does that even mean
Gotcha. Thanks π
@obsidian drift parrot.getNavigation().setSpeedModifier(speed) should do it the easiest way
the parrot being nms
ill try but I did change the goal speed so it probably wont work
you can disable your goals and see if this work, might save you time
and later on maintenance time
hello
intellij question
how to change this font and size
use google?
how to make mobs not attack a certain player?
cancel the EntityTargetLivingEntityEvent
ty
How do I measure code coverage into a spigot plugin?
how do you get a block in a chunk using ChunkSnapshot?
What do you want to do with the block?
You don't get teh Block. There is only ever one instance of a Block so a snapshot only contains a copy of its data
^ A snapshot does not allow you to get a live block instance
Libby when
Itβs hard to answer a programming question without code
Oh no! You ran into a problem. But no worries, people are willing to help, but first they need to see your code. This is because otherwise, they would be providing help based on guesses instead of concrete knowledge. Whether it be a compile error, runtime error, or an unexpected output, I'm sure that if you were to provide code, you'd receive a quick solution.
you still haven't sent the code you're actually using to load gson
well your stacktrace claims it cannot find gson and the code you sent is definitely not from a spigot plugin?
so obviously i have no clue what you're talking about or trying to do. why does your stacktrace mention gson if you don't use it? why do you say you use an old api version if you got a psvm method, so obviously not a spigot plugin at all, etc
and now you say you're not using gson but then you say "i already have gson in my dependencies"
and then you say gson isn't the issue but the stacktarce is all about it not being able to find gson
I have a really weird bug with my code, and i am trying to find it, but am getting closer and closer to think that it has to do something with this event being depricated.
I am wondering if anyone knows something about some sideeffect that this event has because of it being depricated, and if there is a event that i can check if a player picks something up
maybe just ?paste your build file and your whole main class
EntityPickupItemEvent
and the issue you get when using that event nonetheless is a warning in console when registering it
BaboonPickupFungusEvent when
it will work as intended it's just that a broad event was introduced
so it will be removed
and it will print a nag warning when registering the listener
aha okay, then thats probably not the bug but i will still replace it with EntityPickupItemEvent to be future proof
what's the issue?
X to doubt
Why are boats fuckin weird
This is comparing the players position to the players position when the task started... how does it just magically increase
I am not moving the boat
@topaz kestrel am i being pranked rn
Just make it so u only check if the diff is bigger than 2
What font is that
idk
Can u check I really like it
Is it on a site or ur ide
a site
random paste from person who sent it here
then deleted it for some reason
you're not being pranked. I've got confused too
like it is weird it cant find it if you're using it but idk
i am creating bingo, but I am making it in a way so you could theoraticly make any type of task you want (from picking up items, to making amongus figure in a chest when underwater (not a real task, but its possible) )
currently i only made a task which called "ObtainTask" which is basicly the task you would expect when playing bingo, just pick up an item, and then that item will be done in your card
However, this bug is so weird,
60% of the te time, it works fine.
20% of the time it will for some reason send the message that you obtained the item twice, but other than a double message it works fine
20% of the time you pick up an item that is not on the list ,and it will say you obtained a task that did not exist, and sometimes it even replaces a task with this task that did not exists
its not an issue with the event, its your code.
yea XD, i am trying to find it a few days in a row
We'd need code to help
well, i would love to, but idk how i am going to, its probably really complex because it involves a lot of structure, also probably need to create a class diagram for this lol
I have one question though, these events, when will they activate, and in what order, and can i make it so the Pickup is before Inventory or verse vica for example?
before inventory what?
well, for example EntityPickItemEvent, when will a method tagged with this as eventHandler be called
is it whenever an item gets pickedup. or is it every tick for every item picked up in between the last and current tick
or maybe something else
it fires once for any item that is picked up
yea, but is that imidiatly, or in groups per tick?
i know, but it could be possible that whenever you pick up, a callback to your plugin is done imidiatly
but it could also be possible that whenever you pickup, it will be send to a buffer, and every tick iteration or gametick iteration they will go over this buffer and send it to your plugin
it does not matter for my plugin, but i would love to know some background on how its done lol
it doesn;t matter how it does it behind the scenes. Only ONE item will be processed at a time
uh, why do you think it won't be removed?
i guess neither playerchatevent wasn't removed
API almost never gets removed
that's cool to know
API only gets removed if it has a higher maintenance cost than its value
?ban @quaint mantle pron
Done. That felt good.
Iβll take your word for itβ¦ Iβm in public atm lol
"that felt good"
@young knoll PineappleChat legacy adapter coming soon 
is onfirst join inheriting join event
What
what
like if its players first join is it going to construct stuff at PlayerJoinEvent
there is no difference with the PlayerJoinEvent no matter which join number it is
it could be join 10,000 or join 1 the event always function the same
PineappleChat!
Ur a legacy adapter
actually i'm a pineapplchat-bungee adapter you're pineapplchat-legacy adapter
What does that even mean
any maven ppl around? im noob
what you need to know
I'm not advanced but I know my fair share
basically I have like 3 modules and I'm having shading issues
because idfk what I'm doing
so I need someone to help me setup shading
because relocations are fucked
what type of shading issue? You trying to shade all the modules into some core module or what
or is it just not relocating
A shades Adventure and relocates adventure
B shades A, Adventure-Bukkit and relocates adventure-bukkit
π₯²
yes im noob
step 1. Use PineappleChat
does b shade a's shadow configuration ?

or just a
it's maven

Step 1. Library system
no clue then mb
are the relocated packages not being shaded?
Booo 1.8
it's a library for a public plugin with like half a million downloads
I had it working where B shaded A and relocated everything
but A's imports weren't relocated and that caused issues
relocation is a mess sorry I barely ever touch that shit out of fear π¨
@young knoll #1 example of what happens to people who don't use PineappleChat
take notes you're next
next Y2K_ PR. Remove Library Loader if Detecting Jishuna's System
public void onBreak(BlockBreakEvent e) {
Block block = e.getBlock();
for (BlockFace face : faces) {
if (block.getRelative(face).getType() != Material.LAVA ||
block.getRelative(face.getOppositeFace()).getType() != Material.WATER)
continue;
block.setType(type); // set type of the block will drop but i dont want it
}
}```
Is there a way for me to set the block type will form as in BlockFormEvent but in BlockBreakEvent?
I need it cuz i wanna use Player object.
what?
use BlockDropItemEvent if you want to alter a BlockBreak drops
^
No, i want to change the type of the block that will be formed from the cobblestone generator, and I need the Player object to get their Generator.
Then you need to associate this position with a player and use the BlockFormEvent
then why are you in the break event at all if you want to control it forming
Cuz i want the Player object.
you want to get teh player who broke the block?
What determines which block is generated?
The player who placed the water/lava or the location at which the block gets generated (an island for example)
just had to mention it is possible to have more events in a method
but this ain't probably no help
As you can see i checked for cobblestone generator here and now I just need a way to change the type of the block that will be formed.
What determines which block is generated?
The player who placed the water/lava or the location at which the block gets generated (an island for example)
I mean
have you tried excluding all transitive shit ?
im maven noob dont forget
ah
Well like, if you depend on the shaded artefact
those classes for module B should already be relocated
like B should not see net.kyori but a.kyori
why i'm having troubles here
ProxyServer.getInstance().broadcast(content);
}```
'getServerInfo(java.lang.String)' in 'net.md_5.bungee.api.ProxyServer' cannot be applied to '()'
So I guess try smacking a
<exclusions>
<exclusion>
<groupId>*</groupId>
<artifactId>*</artifactId>
</exclusion>
</exclusions>
at the dependency declaration in B for A
or just don't depend on a relocated artefact
that seems counter productive in the first place
why does A need to shade when B consumes it
Is A used outside of a consuming module like B ?
You need to pass the name of the Server if you want to get its ServerInfo.
Your code makes little sense to me. What are you trying to achieve?
i'm doing when someone click a gui on server A it send a brodcast to all the other server exluding the server A
You need to simply not send your message to the server the gui was clicked from.
The code snippet from above doesnt tell us enough. Pls send more code.
that all the code in the server A plugin
@Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
if (label.equalsIgnoreCase("opengui") && sender instanceof Player) {
Player player = (Player) sender;
// Apri la tua GUI e interagisci con essa
// Dopo l'interazione con la GUI, invia un messaggio a tutti i server tramite Redis
sendMessageToAllServersExcept("sumo", "Evento sumo startato da " + player.getName() + " /join sumo per entrare all'interno dell'evento!");
return true;
}
return false;
}
private void sendMessageToAllServersExcept(String excludedServer, String message) {
try (Jedis jedis = new Jedis("localhost", 6379)) {
// Pubblica il messaggio su un canale Redis (ad es. "guiInteractions")
jedis.publish("guiInteractions", excludedServer + ":" + message);
} catch (Exception e) {
e.printStackTrace();
}
}```
Alright, now show your subscribed method on the proxy
public void onEnable() {
String redisHost = "localhost";
int redisPort = 6379;
// Inizializza il client Jedis
try (Jedis jedis = new Jedis(redisHost, redisPort)) {
// Iscriviti a un canale Redis per ricevere le interazioni con la GUI
new Thread(() -> jedis.subscribe(new GuiInteractionsSubscriber(), "guiInteractions")).start();
} catch (Exception e) {
e.printStackTrace();
}
// avoid a java.lang.IllegalArgumentException: Channel must contain : separator (attempted to use <...>)
this.getProxy().registerChannel("custom:mytestchannel");
// this seems to be like a regular event listener for bungeecord
this.getProxy().getPluginManager().registerListener(this, new Event(this));
}
private class GuiInteractionsSubscriber extends JedisPubSub {
@Override
public void onMessage(String channel, String message) {
// Decode the message to get server information and actual message content
String[] parts = message.split(":", 2);
if (parts.length == 2) {
String excludedServer = parts[0];
String content = parts[1];
// Broadcast the message to all BungeeCord servers except the excluded server
if (!excludedServer.equals(ProxyServer.getInstance().getServerInfo().getName())) {
ProxyServer.getInstance().broadcast(content);
} else {
ProxyServer.getInstance().broadcast("Sei in un server escluso dal brodcast!");
}
}
}
}```
You need to iterate through all servers and exclude the one that has your "excludedServer" name.
A simple .equals() wont do.
ProxyServer.getInstance().broadcast(content); will send a message to all servers. No exception.
why is there nothing that i can do with unifiedjedis, even tho there are definetely methods?
The player has broken that block
The javadocs look like all methods are package-private
So the player who has broken the last block determines which new block will be generated?
In that case:
- BlockBreakEvent -> associate Player with Block
- BlockFormEvent -> Check if Block is associated with Player and act accordingly
you mean this protected thing that no one uses?
package-private. Private to package classes
Not event that. It has no access modifier which results in something called package-private access.
and it is used
and how can i do?
does this mean i can only access this stuff when i have it in the project that im using it in?
(im currently using this via my own api for the redisconnection=
you can only access it when you are in the package where the methods are declared
declaration: package: net.md_5.bungee.api, class: ProxyServer
It means that you pretty much cant use those methods
@inner mulch here is an example in my chat library
https://github.com/PineappleDevelopmentGroup/PineappleChat/blob/main/pineapplechat-core/src/main/java/sh/miles/pineapple/chat/tag/TagFactory.java
none of the classes that are package-private can be accessed outside of this TagFactory class. However, TagFactory can access them because they are in the same package
i tried smth like that too
if (!serverName.equals(excludedServer)) {
ProxyServer.getInstance().getServerInfo(serverName).sendData("Channel", content.getBytes());
}
}``` but not working too
What is a "Trie"
Never heard a prefix tree being called Trie
okay
the original creator called it a "trie" pronounced "tree" originally. The base Trie structure differs from a Syntax Tree because it does whole word matching only
e.g. if I have a Trie with the value "hello" "hell" and "he" won't return true from the contains method. That is pretty much the only difference
Why are you sending random data into a channel called "Channel"?
i put it to guiInteractions but not working
wait so i've tried something, when i use the jedis dependency in the project from my screenshots then i can access it, but when trying to access unifiedjedis through my own data API that already has this dependency than it doesnt work. Is this also what package-private describes?
no are you sure you have the dependency passed as transistive
String excludedServer =...;
String message = ...;
for (ServerInfo info : ProxyServer.getInstance().getServers().values()) {
if (!info.getName().equals(excludedServer)) {
broatcastMessageOnServer(info, message); // Implement this
}
}
this is the dependency in my data API
if its not transistive java won't know what to do with this random object it doesn't know exists in some other random library
how do i make it transistive
then
try clearing caches
public void onBreak(BlockBreakEvent e) {
Block block = e.getBlock();
for (BlockFace face : faces) {
if (block.getRelative(face).getType() != Material.LAVA ||
block.getRelative(face.getOppositeFace()).getType() != Material.WATER)
continue;
blocks.put(block, e.getPlayer()); return;
}
}
@EventHandler
public void onForm(BlockFormEvent e) {
if (e.getNewState().getType() != Material.COBBLESTONE) return;
if (blocks.get(e.getBlock()) != null)
e.getNewState().setType(Material.DIAMOND_BLOCK);
}```
damn it actually works
This might lead to an unspeakable amount of problems but you will find them out if they cause problems.
For now its nice to see it working.
yeah thank you anyway
and what i have to write within the broatcastMessageOnServer(info, message)?
This has probably been answered online multiple times.
Get the ProxiedPlayers from your ServerInfo and send each one the message.
I made a simple custom join message plugin. I added config.yml, now how do I add colors to it? For example:
customJoinMessage: "&5Hey, welcome to the server!"
declaration: package: org.bukkit, enum: ChatColor
How do I let user change colors in config.yml?
by telling them to use &c etc in the string?
By using PineappleChat π π π π π
But fr just use the ChatColor#tranalateAlternateColorCodes
why this code return true if region id equals - https://paste.md-5.net/yihixoboni.cs
That's exactly what I needed, thanks
oh wait
it doesnt. it returns true as soon as any region exists that does not have the same id as id. idk but what even is the purpose of that?
check that there are no other regions in this location besides this region
that will return true as soon as it finds 1 region
you need to set a variable outside the loop
1 not = id region
so that mean "empty region"
okay so
lets say you have 5 regions
the region that it is, is at position 3
you do the first entry, and its not the region so it ends the loop because of the return
it doesnt get to position 3
I just need that either there are no regions in this place or there is ONLY the specified region in this place
which requires you to loop all entries
????
you loop 1
Are you implying that there is another way?
stream api?
instead of returning set a variable outside the loop
or wdym
you arent understanding
oh
what does that even mean
return inside a for loop cancels the loop
you loop 1 entry every time
you need to loop them all
no
well
yes
return breaks the loop
you need to set a variable outside the loop and not break it on the first iteration
and in what cases should this not be done?
Here are some links to get you started on learning Java:
- https://www.codecademy.com/learn/learn-java
- https://www.sololearn.com/learning/1068
- https://www.learnjavaonline.org/
- https://programmingbydoing.com/
- https://docs.oracle.com/javase/tutorial/java/index.html
The last one is the only official one, however some of those concepts assume that you already know a bit about programming.
returning creates something? do i just return the result or do you mean equals method
lol
public boolean foreignRegion(Location center, String id){
if(center == null || center.getWorld() == null || id == null) return false;
ApplicableRegionSet regionContainer = getRegionContainer(center);
if(regionContainer == null) return false;
boolean matches = false;
for(ProtectedRegion region: regionContainer.getRegions()){
if(!region.getId().equals(id)){
System.out.println(77);
System.out.println(region.getId());
System.out.println(id);
continue;
}
matches = true;
}
return matches;
}
super hard
if you ever pick cmarco as a tutor reconsider your life choices
lol
wait, it seems to me there is no difference, because there is a condition inside and if the regions are not equal, then it returns true 1 time, not several times
and that means the variable is created 1 time
how then is it different from "continue"
because if the condition is false, then the loop just continues to go without creating anything
well, with this guy I would send cmarco to not waste a good tutors will to live
Ilmir do you know the difference between a primitive and an object?
Heyo
How do I set per-player thunder ?
I found setPlayerWeather but that one has only CLEAR and DOWNFALL
No that's.. lightningbolt or whatever
But there has to be a variable for the sky darkening.
packets?
maybe
So I'm just gonna assume it's not exposed in the API
yes do you mean "return" is an object?
ty for the double check tho
Hey, if you have time could you please help me fix it?
besides, if you get to the bottom of the code, you can say that it seems to me that βreturnβ will be faster because it immediately returns the result
but βcontinueβ needs to go through the entire cycle (almost) provided that there are a bunch of regions at the point
Hello, I'm using Maven, I got a dependency, which has a dependency, when trying to access the dependencies dependencies, i cannot access those classes any ideas?
you have to add the dependency in your pom.xml and mark them as provided I think
so adding the depencies dependeny as provided?
thanks, but that sounds kinda inconvenient telling ppl they have to do this to fully access all the classes, but still thanks.
In maven there is something called scopes which is used to tell maven how to handle dependencies, in case of using the scope provided. You tell it that this dependency is only for development and that it doesn't need to be included in the compiled (the jar of your project). It is commonly used for utilities like Lombok, jetbrains annotations and more.
Hi, a friend and I are making a server with items customized by textures and we don't know how to block the renaming of items on the anvil, does anyone know?
cancel InventoryClickEvent when taking out renamed versions of your items
How can i cancel This?
declaration: package: org.bukkit.event, interface: Cancellable
Hi , how to get ispname in java ?
i want to get name of isp ( Internet Service Provider ) of a ip in java
you get the IP address of a player and then you use some kind of whois service to get the ISP
Is there an event that eavesdrops on the middle of the furnace melting process?
not start, not end
or how check does the furnace burn after finishing melting 1 unit of item?
in end event
i know even i used api of ipinfo and ip2location but i need a better whois api
even now i working on ipinfo api
but i don't like this api
Smelt event? Check the docs. Pretty sure it's every item
ipstack
is free ? isn't like ipinfo that need trial ?
I guess all the proper apis will cost money
why do you even need a player's ISP's name?
is World#getNearbyEntities() quick? like do i have to worry if its called potentially a couple times in a tick (not continuous) in a short radius
or is there a quicker method to get players in a small radius
doesn't have to be circular either
getNearbyEntities just loops over the list of entities and does some tiny math
totally negligligable
ngliblae
neglblgb
fuck that word
agree
you can use it many times per tick
epic
nothing just learning and for my plugin
I just tried ipstack free version and at least that tier doesnt give you any info about the ISP it seems
mvn dependency:tree
always useful to look at it
Can't you just whois?
You'll need some logic/parsing but not much
yeah that works - even though the mentioned unitymedia is meanwhile dead
does it use an offline database or how does whois work?
ok and what was the issue again?
ah I see, handy
whois shows ? for special char cities lol
Alex on an encoding crusade today
api shades and relocates adventure-api and adventure-platform-api
impl imports api, shades and relocates adventure-text-serializer-legacy
bukkit shades api, impl, shades & relocs adventure-platform-bukkit
now Ill see if I can get it working that sudo asks me for fingerprint instead of password on mac
why is your API shading things..
I mean, in gradle I'd say expose it as transitive to consumers via apiCompileOnly
We also have a fabric module somewhere and we'd like to keep the same relocations
this is maven
yea
supporting legacy chat be like 
but yeah with the current setup I can't compile the bukkit module
legacy chat? which changes have there been between 1.8.8 and 1.20.4?
Yea idk, I think your API might be better off no shade things
lets see if there is a fun scope for that
in maven
I don't use strings anymore
so I call it legacy
Quite a few chat changes since 1.8
because it is
it wasnt
AsyncPlayerChatEvent has a string for format, and a string for message
no need i used ipgeolocation.io and worked
your bukkit should then be able to shade those
So I import everything as provided and on bukkit I shade and relocate it all
no you import everything as compile but don't shade
yeah for the exposed API, but its fenagling into components under the hood
provided isn't passed to deps is it ?
not passing a scope rn
Just because stuff is all strings in Bukkit api doesnβt mean it is internally
well no scope is just compile
:p
I guess that's it
so I think you just put it as compile but disable shade
seems to work

just nuked all shading on the other modules
compile scope
and shade and relocate all on each platform module
which is a bit icky but whatev
Β―_(γ)_/Β―
F
I'm also running on 1 hour of sleep
do you need a coffee machine? I got 2 leftover
@young knoll which version was it you could start using hex again
had a red bull at ~hour 5
coffee machine at home:
was that 1.16.5
I'll accept dinner money though
yo and now everyone get back to basics!
someone write a tp, tpa module
someone write a storage thing
wrong channel
no
:(
I am this weekend :P
I'm not even writing any basics code all my contributions are just pasting utils I wrote like a year ago
I want everyone to contribute! even people like obama, etc
except cmarco
contributions from cmarco will not be accepted in any way
Structure starts are their own phase of chunk generation
But the actual structure gets placed during the decoration phase
I just realized I can't support 1.8.8 anyways since I use java 17
guess I'll go up to latest xD
I didnβt find a single event indicating the end of the stoveβs burning. I found only 3 events not related to the burning animation
I'm talking about side animation
Oh fun seems like transitive dependencies aren't relocated or something
lol
Alex you might know?
The jar I built works fine but when shading it the relocations roll back 
could be a jitpack thing
did you disable dependency-reduced pom?
prob
we pray
dont
hi
seems like I dont touch it
in all three modules or whatever, you never disabled it?
because the problem you describe sounds exactly like my example from my "dont disable this setting" blog post
only place where I might have that is the uh
module that's using my api
like the quests plugin itself
Could that cause the problem?
ugh well which .jar exactly is the one that is "wrong"?
Quests-jar
and that depends on which lib exactly? conversations-api?
and conversation-api depends on conversation-impl and conversation-bukkit?
and the .jar in your local maven repo for conversation-api looks correct, including the shaded and relocated things?
conversation-bukkit depends on api and impl
if yes, the issue is that the shaded stuff are still mentioned as dependency in your dependency-reduced pom for whatever reason
and shades and relocates both
and if you mvn install it, then does the result in your local maven repo look good for that?
ok then show the mvn depencency:tree of that quest plugin
think this is trying to import the entire uber jar
which idfk how to import bukkit only
huh? by using the artifactId you made up for that project? π
what is that lol
it's an empty module for some version conflict lmao
yeah I got it
testing now
mf
no errors
which is gucci
is that so?
yeah this is just me messing up proxy config
?paste
Hiya
I am currently trying to create a plugin with spigot and am trying to use bungeecord to move players between servers but whenever I build and run the command, I get this issue:
https://paste.md-5.net/ohuragoziq.nginx
Here is my pom.xml
the bungee api is meant for plugins running on the bungee itself
you cannot just access bungeecord api in a spigot plugin
you'll have to use plugin messages
Ahh ok, is there documentation for that?
The home of Spigot a high performance, no lag customized CraftBukkit Minecraft server API, and BungeeCord, the cloud server proxy.
Take a look at Connect and ConnectOther to send players from one server to another
Thanks
(and dont forget to remove the bungee api from your pom completely)
np
Hey I am using MockBukkit to run unit tests and when I try to run a unit test on DB I get
java.lang.RuntimeException: Failed to load driver class com.mysql.cj.jdbc.Driver in either of HikariConfig class loader or Thread context classloader
I have shaded hikari in my maven and it runs fine on a spigot server
just not during unit test
Mysql driver is scope runtime so not sure it will appear in tests
thanks
[22:54:32 INFO]: [Plugin] Enabling Plugin v${project.version}
why isnt it saying the correct version?
You need to enable resource filtering
<resources>
<!-- Resource configuration for messages.properties with filtering -->
<resource>
<directory>src/main/resources</directory>
<filtering>true</filtering>
<includes>
<include>messages.properties</include>
</includes>
</resource>
<!-- Resource configuration for all other resources without filtering -->
<resource>
<directory>src/main/resources</directory>
<filtering>false</filtering>
<excludes>
<exclude>messages.properties</exclude>
</excludes>
</resource>
</resources>
<resources>
<!-- Resource configuration for messages.properties with filtering -->
<resource>
<directory>src/main/resources</directory>
<filtering>true</filtering>
<includes>
<include>messages.properties</include>
<include>plugin.yml</include>
</includes>
</resource>
<!-- Resource configuration for all other resources without filtering -->
<resource>
<directory>src/main/resources</directory>
<filtering>false</filtering>
<excludes>
<exclude>messages.properties</exclude>
<exclude>plugin.yml</exclude>
</excludes>
</resource>
</resources>
``` like this?
Yep
woked thatnks
@young knoll found some time and smacked https://hub.spigotmc.org/stash/users/coll1234567/repos/bukkit/pull-requests/1/overview up
I think the rest we can probably just have you implement with some more feedback on the PR
especially naming obvs remains to be discussed
Pogress

Also unsure if I want Registry.ITEM_TYPE to yield ItemType.Typed or ItemType
Also needs some more helpers around the .typed functions on ItemType and BlockType respectively
Would the registry returning the typed one have any use
Well rn it does
because it makes the assignment easier
but we could just have the method in Item/BlockType call .typed() on the thing prior
and then do the unchecked cast there
because yea like, that is the reason we move generics to typed, for the places wheree you have 0 actual compiler level knowledge of the type
which is the case here
Ah right because the constants come from the registry
Yee
legacy magic
.components to our rescue

I think Lynx is volunteering!

PineappleChat has reached its true form
the ultimate MiniMessage competator for those of us who enjoy Pineapples

sept I can't figure out how the fuck to post these modules to my repo
for god sakes
How would you go about posting each module in a project separetly to a maven repository with gradle?
right now I have publish in my subprojects block, but that doesn't work well :O
cuz of this error
Execution failed for task ':publishShadowPublicationToMaven2Repository'.
> Failed to publish publication 'shadow' to repository 'maven2'
> Invalid publication 'shadow': multiple artifacts with the identical extension and classifier ('jar', 'null').
I mean, change the classifier ?
or change the artefactId
I presume you'd want to change the artifactId
ahh probably
yeah idk how to do that with shadow lol
I don't know very much about gradle I kinda copied this from the other library Ebic made where it all compiles into one jar, but I want multiple jar outputs. Not really sure how to achieve this yeah one sec I'll push again
I still suck at gradle :(
you can do that?
Yea lmao
says there is no property
> Could not set unknown property 'artifactId' for extension 'publishing' of type org.gradle.api.publish.internal.DefaultPublishingExtension.
no like, in the created publishing config
where you do publications.create
inside that block
next to your normal from(components["java"])
or whatever you source from
not that I want to know why the fuck you'd be publishing something that went through shadow
sounds pretty cursed
why not? How else would I shade the core module lol
isn't maven shade == gradle shadow
Yea but why would your published artefact need that shaded
well I did hear gradle had some built in shading tool, but I've heard it's a pain
like, that is what transitive dependencies are for
so you don't need to depend on both core and platform
so I don't need shadow 
spigot-api does not shade google commons
yet you don't have to declare it to use it
well yeah Minecraft does
a β¨ transitive dependency β¨
yea but your build tool doesn't know that
you can re-expose your dependencies to the consumer of your artefact via the api and apiCompileOnly configurations
it's kinda just trusting somewhere down the line it is shaded
you need the java-library
You are trusting yourself to shade it
or, if someone wants to shade your library they automatically shade the transitive deps too
and if they don't, they trust something else supplies your library
which, that something then would shade it
apiCompileOnly is a bit scary ye
because that something else would shade your library and well, back to this ^
So thatβs what api is for
Yea, just api is fine xd
I understand now
in your API yes
or whatever the fuck your stuff is xD
only the thing that wants to actually be a jar wants to shade in its needed deps
do I need to switch my core from implementation to api then?
is your core supposed to be depended on by plugins
or is it just a common baseline for other impls
just a baseline for other implementations
Well yea, you'd still put it as API to propegate it to the local transitive things
but you obviously don#t publish it to a maven repo
so a module would kinda look like
plugins {
id 'java-library'
id 'me.champeau.jmh' version '0.7.2'
}
dependencies {
api project(':pineapplechat-core')
jmh 'org.openjdk.jmh:jmh-core:0.9'
jmh 'org.openjdk.jmh:jmh-generator-annprocess:0.9'
}
configurations {
testImplementation.extendsFrom(compileOnly)
jmhImplementation.extendsFrom(compileOnly)
}
then how could I disable publishing for just one module?
should I just wrap an if statement and check for the module name or what
Da heck is jmh
java micro benchmarking

no
nah how it works basically is you have the core module which provides basically a parser template with some things for each module to implement
and then users depend on the actual platform implementations not the core
okay
then yea, you'd api that
and well, how do you define the publishing
by default, modules aren't published lol. You have to create the publishing block somewhere 
right now its in the subprojects block
Yea so
Either you move that into just each impl build.gradle
or you outside this into like buildSrc
as an extension
and then your build.gradles in the impl only call something like configurePublishing("bukkit")
okay this may be a big ask but explain buildSrc with groovy xD
fuck
I mean, its just a place to define extra shit that is shared between the modules 
As if Kotlin isnβt also scary
Has anyone here taken theory of computation / automata?
its not
Lies
'switch' expressions are not supported at language level '8'
bruh
L java 8 moment
Certified 1.8 developer moment
Well you did call it
when I did call it, there were NoClassDefs all the place lol
im getting a nosuchmethoderror, even tho there is the plugin on the server and im sure that there is such method, any reasons why? or do i need to provide more information?
which method?
show stacktrace
its one of my own methods
have you changed the return type of that method?
no
well then show the stacktrace, your code calling it, and the definition of the method
?paste
are you relocating any classes?
the RedisConnection class is defined from a "data-api" that i made for myself, i made sure im using the latest version of that data api on the server as well as having it installed on the server
your getJedis() method returns a mars.sql.internal.jedis.UnifiedJedis and not a redis.clients.jedis.UnifiedJedis
it looks like you're depending on the unshaded / unrelocated artifact
oh
that won't work for above mentioned reason
how do i depend on a shaded artifact?
normally, the maven-shade-plugin replaces the original artifact with the shaded one. Is it possible that you're depending on "data-api", but the plugin that shades your data-api is relocating them, and now you're having a second plugin that wants to access the data-api from the first plugin? or sth like that?
im not sure what exactly happens, but im sure that im not depending on the shaded version, earlier i was wondering why i couldnt interact with the jedis api in the main plugin even tho it depended on one that should've jedis shaded into it
show the pom files of all your related projects
?paste
ah yeah I think I already found your issue
https://blog.jeff-media.com/how-to-make-maven-automatically-put-your-plugins-jar-into-your-test-servers-plugins-folder/ scroll down to #3 "The wrong way"
If youβre using maven for your Spigot plugins (which you should do), itβs easy to make maven automatically save your pluginβs .jar in your plugins folder. Thereβs two ways of doing this: 1. The lazy way (not recommended) If you only work alone on one computer, you can just directly declare the output location in...
since you declared the output directory i nthe shade plugin, you get your shaded .jar on your server, but the unshaded .jar in your maven repo
which .jar is 5mb?
your data api .jar is 5mb because it shades hikari, mysql-connector, jedis, and commons-pool2
the data-api in your local maven repo most probably is not 5mb
oh
check out $HOME/.m2/repository/mars/MarsSQLAPI
there you got the unshaded version, and that one declares your method to have the original return type of unshaded jedis
and that's what your other plugin is trying to access
TL;DR just declare the output directory properly as explained in the blog post
(for both projects)
but there is the shaded one too, so can i just depend on the shaded one?
is the shaded one in your maven repo?
yes
how is it called?
both are
is it called blabla-shaded.jar?
-shaded at the end
in that case you could use <classifier>shaded</classifier> i nthe dependency
okay
but check the timestamps in your maven repo
are they both from the exact same time?
or is the shaded one a bit older?
well ok then it should work... still, you should always set the output directory in the maven-jar-plugin to avoid such issues in the first place
then you also don't have to declare that you're depending on the shaded artifact
derbawhat?
i dont know any of those lol
are you watching mc on yt ? or are still playing mc?
π₯² neither
he is well known, but in this case, if you dont know them it will probably dont make sense what i was about to say, so i will just say nothing
thanks tho, it works now :)
np!
For you, apparently
Mom said itβs my turn on the GitHub
Where are my emeralds
Oops my finger slipped on the kick⦠command
You havent played in 7 months just give
how do i generate something like this?
https://github.com/jgeramb/EazyNick/blob/ea6540465b381f3252897772f2c9d02781d98334/src/main/resources/nickNames.txt
the names are crazy like mc players
that is what happens when you don't wanna query mojang's servers
ig
could also be a rainbow table of random nicknames that aren't computer generated
How did I manage to randomly scroll to an offensive name
Mojang get yo filter fixed
Anyway they probably just queried Mojangs api for a bunch of names
tf π
i dont think you can do that
hey mojang api give me 5k names of players ordered alphabetically
I plead the fifth
sounds of super secret discord
No but you can probably query names somehow
Set up a server and just pull the name of everyone that joins kek
i doubt i can get 5k players
Tasty ram
how fulfilling is it to eat ram
20gb not enough for that mf apparently π¦
