#help-development
1 messages ยท Page 343 of 1
make sure to send the update packet first
thanks :D it seems to work but i probably have to send the pose with a packet too
you have to do OnPlayerJoinEvent instead of PlayerJoinEvent because you register a listener and not call an event
omg
?
ye you have to pas in the class name
by emptying the usercache file, it allows me to reset the hasPlayedBefore() ?
idk
Is there anyone aware of a bug with the Warden entity? I got a plugin that registers UUID of mobs being spawned during a certain period. Then later it uses the remove() on the LivingEntity. All mobs are despawned except for Wardens
i mean not stored, but checking if it exist
Is there anyone aware of a bug with the
should i use Plugin or JavaPlugin if i want to manage a Plugin
manage in what way
Disbale | Enable | Register Events should generelly use JavaPlugin over Plugin ir not ?
Doesn't really matter, as iirc JavaPlugin is just impl of Plugin
are there other impl like KotlinPlugin ?
Heard of Liskovs Subsitution principle.
No?
No, that is not what java stands for.
It will be more or less same impl anyway lol
It will be the exact same implementation
Wrong itll look fancier
Cuz the new keywords kotlin has
okay guys tanks
Look up "Liskovs Subsitution principle"
maybe some day currently watching Better Call Saul
lol
is there a way to see if a block isn't a existing item? like POTATOES is a Material but it's not a real item, the real item is POTATO. same with carrots and so on. so is there a way to check this?
the item doesn't return null but if I tried to place it as an item on a inventory, it's like AIR ๐ค and i want to fix this
isItem() maybe ?
๐ฎ
didn't know that was a thing, thanks a lot, will try
it works
thank you again
awesome !
can i somehow move file sidebar in IJ to the right side and gradle and other to the left?
drag it
oh siht

lol
you mean like visible at the same time?
idk
i use the new ui style but idk if there are any differences on that regard
like one below each other
how would i fix it
i also use new ui style btw
hmm yeah then idk srry
git update-index --chmod=+x path/to/file
thank god for the chmod
how would i actually do that on the repo
do it locally and commit
you commit it ^
yea ./gradlew
same error
can u somehow throw exception with some additional message to it?
exceptions take messages ?
is it possible to make it the workflow use 2 java versions to run buildtools
im guessing something with this
forget i asked
found it on google
Cannot open an inventory of type MERCHANT
How do you open a villager inventory for a playuer?
you gotta have an entity id and all
and then create an NMS inventory iirc
because events and all
I am doing Bukkit.createInvetory(player, InventoryType.MERCHANT)
yeah that won't do
so how do you make an inventor using NMS?
Looks at how villagers open the inventory
It's a bit specific
Level nmsWorld = ...;
Player nmsPlayer = ...;
Villager villager = new Villager(EntityType.VILLAGER, nmsWorld);
villager.setVillagerData(new VillagerData(VillagerType.PLAINS, VillagerProfession.FARMER, 5));
villager.setOffers(new MerchantOffers());
villager.getOffers().add(new MerchantOffer(new ItemStack(Items.EMERALD, 1), new ItemStack(Items.DIAMOND, 1), 1, 1, 1));
villager.openTradingScreen(nmsPlayer, new TextComponent("Test"), 1);
remapped
thank u
hmmm what does that mean?
ooh I cant send photos
int pageNum = 0;
if (this.getConfig() != null) {
for (String page : this.getConfig().getConfigurationSection("book.pages").getKeys(false)) {
List<String> lines = this.getConfig().getStringList("book.pages." + page);
pageNum++;
for (String line : lines) {
if (meta.getPageCount() <= lines.size()) {
meta.addPage(line);
continue;
}
if (lines.size() < meta.getPageCount()) meta.setPage(pageNum, lines.get(pageNum-1));
}
}
that is a bad way to add pages
just make the config section a string list
then add that string to a page
it auto formats it
but I want to control the content in each page
why would you need that
new line
yeah but why
Hi my name is 7wdev.
my age is 5555555.
ip: 77777777.
imagine all of that in one line*
Just split on \n if it need to be configurable
using a single string should fix the nbt tag thing?
How to hide players from TABLisT?
Before and after of my code
suspend fun onEnable() thats all
@eternal night would you happen to know why i get an error saying that GIT_TOKEN doesnt exist when i pass it in from the env as seen below
yeah
repo_token: "${{ secrets.TOKEN }}"
mine looks a lil differetnt
I have TOKEN as a repo secrcret
wheres the place that you use the secret
- uses: "marvinpinto/action-automatic-releases@latest"
with:
repo_token: "${{ secrets.TOKEN }}"
automatic_release_tag: "latest"
prerelease: true
title: "Development Build"
files: |
build/libs/*.jar
not same thing but maybe try the ${{ }}
already has the ${{}}
you could try putting it in "'s
trying now
pretty good indeed, too bad he donโt have more videos
same error
Dont you need to use ${secrets.GIT_TOKEN} ?
no idea lol
Atleast that is how maven works
ill test it out when the thing im trying now finishes
I have my build destination to my server's plugin folder but it doesn't build to that?
?paste
your pom please
ughhh is it find that im using gradle as my project manager bcuz i just switched n don't know if it eve got a pom
paste your build.gradle then
easiest way you can build to another location is with gradle shadow
add id "com.github.johnrengelman.shadow" version "7.1.0" to the plugins and create a shadowJar section
shadowJar {
destinationDirectory = file("path")
}
now send me the secret . 
ghp
Hmm, how do people get texture packs to have a different texture if the item has some ID on it?
custom model data
for now I have made that whenever I click on the text, the command is executed, but is there anything I can do, so I can (on the player text click) run a callback or something, so I don't need to create external commands to run code on clicks
(for now I have: no.setClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/tpadeny"));)
https://paste.md-5.net/emigadiloc.java why is it in tab p+ but in scoreboard admin (admin is the right one)
org.bukkit.persistence.PersistentDataContainer persist through UUID or through nicknames?
uuid based
UUID nothing internally uses name anymore
How can I know if World ( name = "arena-100" ) does filter under arena-*?
so it's eternal to your account basically?
wdym?
yes, its under playerdata file
so yea, pretty much until the owner yeets your playerdata
okay
so it's safe to put non-bought things to a persistent data container?
I would highly highly recommand storing anything remotely connected to actual financial purchases into a proper database
sure, but for non-bought things, is this correct?
I mean, if you already store bought things in a DB
use the DB
but I guess otherwise it is fine
I mean I wouldn't replace a db with PDC
fair enough
like things that don't need a high precision and small tweaks?
anyone?
because... u coded it to be that way?
no it should be just an A not P+
well how did you code it then
is it even possible?
idk debugging also says it stops right but its setting to p+
No, unless you mean some library to create a bunch of temporary commands
When making a command with a lot of args should you use else-ifs or a switch to manage all of those args?
With click events being commands? Yes
ok
Switch, map, whatever you feel like
I use a map
Cuz I'm fucking cool
I am now following this: https://www.spigotmc.org/threads/chat-message-custom-click-event-handle-chat-message-click-callback.587564/ and it's fine, the player won't know that a command exsits if it isn't registererd
When I use CommandExecutor it has online player's as the default tab auto-complete how can I disable it?
implement TabExecutor
can i somehow optimize packet sending to player? (to prevent packet spam)
they dont seem to like it when theres too many packets
Send less packets?
I once generated UUIDs and added a leading slash to them, stored them in a map with a runnable and intercepted the command in the command preprocess event. That worked well.
im using the bukkit method to send particles
Use less particles
i kinda need the amount of particles im using
Then there's nothing you can do
How can i teleport a player at the center of a chunk?
(chunkX - 1) * 16 + 8
Same with the y? or only the x
ok thanks
couldnt you send many particles in one packet?
yo can any 1 help me with something?
basically i set the spawn location of a custom world on startup
If you have a question, please just ask it. Don't look for staff or topic experts. Don't ask to ask or ask if people are awake or available. Just ask the question to the channel straight out, and wait patiently for a reply. Make sure you use the right channel regarding the topic of your question. Create a thread in case the channel is already in use!
System.out.println(redWorld.setSpawnLocation(new Location(Bukkit.getWorld(REDWORLD), 0.5, redWorld.getHighestBlockYAt(0, 0)+1, 0.5)));
ignore the print
and then i have a command that tps me to the spawn location of that world, it works but it doesnt tp me on the block, instead it tps me to 0, 0
I mean that's what you set?
How are you teleporting
Player#teleport(Location)
What location.
Bukkit.getWorld(BLUEWORLD).getSpawnLocation();
But, that's blueworld not redworld
oh nvm ignore the world names, i have basically the same code for 2 worlds
but thats not the issue
Okay, wahat does getSpawnLocatio nreturn.
What does it hold
when you try to teleport
What is it actually, what is the object inside the location.
What is the object.
Not what class it is
the full code:
i did
the output
Then you didn't set it properly.
Set it properly.
wdym?
How does you plugin.yml look?
startup but delayed by 1 tick
Delay the spawn setting by another tick
so it loads
try that
but the thing is that its correctly set, but i think its like casted to an int or sth
so it removed the .5
Maybe, too lazy to look at the stash
lol
som1 know how to remove the placeholder from the essentials message in chat
Why did you ask in two places?
How does the rank prefix have a background?
event.getPlayer().getDisplayName() How do I get DisplayName using the maintained method?
did u find anything?
I was too lazy so i never opened it.
is it deprecated
if yes
ye
use spigot api
ahh aight
bc no one respond
someone has an idea for a slightly better system because I don't really like this one at the moment but it works (I think)
@EventHandler(ignoreCancelled = true)
void event(InventoryClickEvent event) {
Player player = (Player) event.getWhoClicked();
if (!event.getInventory().getType().equals(InventoryType.ANVIL))
return;
if (!Arrays.asList(InventoryAction.PICKUP_ALL, InventoryAction.PLACE_ALL).contains(event.getAction())) {
event.setResult(Result.DENY);
player.sendMessage("cancel action");
return;
}
if (event.getRawSlot() > 2)
return;
ItemStack item = event.getCursor();
if (!item.hasItemMeta())
return;
ItemMeta meta = item.getItemMeta();
PersistentDataContainer data = meta.getPersistentDataContainer();
String blockRepair = data.get(new NamespacedKey(main, "block-repair"), PersistentDataType.STRING);
if (blockRepair != null) {
event.setResult(Result.DENY);
player.sendMessage("cancel");
sendInfo(player, event);
}
}
ignore sendInfo method
The world's spawn location is a block position, which always floors to an integer. Your floating point values won't persist. If you need floating point values, you gotta store and correlate them to a world externally.
you could change this to use switch statements
or condense down your if checks
null checks should always be first
This is my pom why isn't my project being built to the plugins folder?
https://paste.md-5.net/nilaquyaho.xml
What's you mean about "use switch"
That Arrays#asList with it's contains call seems pretty wasteful for a simple check for two values, I'd most definitely get rid of that first. If it would be a long list, you should have it outside of your method to not re-generate it every time, but in this instance, a simple if (!(action == PICKUP_ALL || action == PLACE_ALL)) would suffice. You could also write if(action != PICKUP_ALL && action != PLACE_ALL) due to de-morgan, but that's just taste at this point.
ItemStack#hasItemMeta internally just compares the return value against null, so I'd rather do that myself. Just get the meta and return if it's null, rather than to have to generate the meta twice.
?whereami
๐งโโ๏ธ
everything you wrote I think it was improved but my goal at that moment was to make it work and go to sleep because I'm tired enough but thanks for the advice
Well, I thought you asked for improvements? If it works, you don't have to change anything at all. Seemed to me like you wanted to improve your solution.
well i mean
its a maven issue
dont know why ur telling them to go to paper just because they have the api
Goodnight bro
when you ask for improvements be prepared to hear things you may not like or don't want to do lol
if switch is something new to you
then I recommend you do some research and reading and learn how to use it to understand it. However if your code works and you are happy with it, you don't need to change it
but do remember you did ask for opinions
Good night, hope you get the sleep you desperately seem to need! :)
if you know, you can tell me how to do it so as not to exclude all InventoryAction because I have absolutely no idea and now I'm really going to sleep good night
How do I modifiy a packet using protocollib Im trying to modify the Display Name field
protocolManager.addPacketListener(
object : PacketAdapter(this, ListenerPriority.HIGHEST, PacketType.Play.Server.PLAYER_INFO) {
override fun onPacketSending(event: PacketEvent?) {
val packet = event?.packet
// Change Display Name to UUID.randomUUID() and its the 6th field
packet?.playerActions?.write(5, UUID.randomUUID())
}
}
)
I cannot figure out how to change a value ? I dont know how to get an instance of a TFIeld
Good idea is to use wrappers
Wdym
do you know the repo
Google protocollib packet wrappers
Do you know by any chance whether protocollib operates on a byte-basis, or whether it accesses fields of packet classes? That would be kinda interesting to know, but I've never worked with it.
Not using protocollib so no idea
Oh, lol
To be honest I even prefer nms packets
Yeah, same, I appreciate nms classes in general. I still think that operating on the byte layer is optimal, but it requires way too much effort to build properly.
I just noticed that you - in some cases - cannot rely on the field order of getDeclaredFields, which even it's documentation warns about. So it would be funny if they completely rely on that. Seems to work tho.
[15:15:12 ERROR]: [Test] Unhandled exception occured in onPacketSending(PacketEvent) for Test
java.lang.StackOverflowError: null
protocolManager.addPacketListener(
object : PacketAdapter(this, ListenerPriority.HIGHEST, PacketType.Play.Server.PLAYER_INFO) {
override fun onPacketSending(event: PacketEvent?) {
event?.isCancelled = true
val packet = event?.packet
// Change Display Name to UUID.randomUUID() and its the 6th field
val wrapper = WrapperPlayServerPlayerInfo(packet)
wrapper.data = wrapper.data.map {
PlayerInfoData(
it.profile,
it.latency,
it.gameMode,
WrappedChatComponent.fromText(UUID.randomUUID().toString())
)
}
wrapper.sendPacket(event?.player)
}
}
)
because nothing here specifies an output directory
Maven doesnt automagically know where your minecraft server is
i wish 
I did it through IntelliJ as I followed a guide.
ahh
@toxic haven since it looks like ur using the mvn shade plugin, u should probably set outputDirectory in the shade goal configuration
Not really much info provided. What prevents you from iterating all blocks in 3D space between two coordinates and storing their block state either in a list or persistently somewhere else? You could then always call update on that state and revert to the block at the time of the snapshot.
Not really, at least not if you're operating on a plugin. You could modify the world region binary files directly, but I wouldn't advise such a low-level operation. Otherwise, there aren't really any other choices.
For none programming question please use #help-server
alr mb
NO
never
idfk
i just copy-paste it from target anyway
doing it in the shade configuration would break many things, e.g. remapping
just run shade last 
surely something stupid, but how to have the autocomplete functions of spigot/bukkit on intellij?
I'm using maven and I thought it would automatically import the libraries
I don't even have the autocomplete to create an onCommand()...
If you just start writing on Command(without public boolean), nothing shows up?
nothing ๐ฆ
Make sure to implement CommandExecutor too
It should, as intellij autocomplete functions which can be overriden
Press ALT + Insert and Override methods
oh I just got it
I had to wait for the indexing that I had not seen
is it possible to change the meta (name, lore, enchant) of an item you hold in your hand?
Ye
player.getInventory().getItemInMainHand().getItemMeta
Obv need to set it back etc.
yeah
but I have to put it back in the inventory?
You shouldn't need to.
just back on the item
just enough?
Should be
should be
it is, thank you
how can I accept a sentence in a command to change the name of an item?
like /plugin set name "new name"
If you do not use a command library, you would need to pass the arguments.
from argument X I concatenate them?
If you want to cheat here is some spoonfed code that you won't understand:
if (parts.length >= 3 && parts[0].equals("set") && parts[1].equals("name")) {
String nameInQuotes = parts[2].replaceAll("^\"|\"$", "");
}
return true;
Wait nvm that's broken
I did that?
Remember indices start at 0
yes I have another arg before
Something like this:
if (parts.length >= 3 && parts[0].equals("set") && parts[1].equals("name")) {
StringBuilder sb = new StringBuilder();
for (int i = 2; i < parts.length; i++) {
if (parts[i].startsWith("\"")) {
sb.append(parts[i].substring(1));
} else if (parts[i].endsWith("\"")) {
sb.append(" ").append(parts[i].substring(0, parts[i].length() - 1));
break;
} else {
sb.append(" ").append(parts[i]);
}
}
String nameInQuotes = sb.toString();
}
this is exactly the construction of my command lol
the code is very clean thank you very much
Obv, you can also accept things not in quotes.
you can probably make < <= so it works for that 1 extra arg
I'm going to have to use it for every modification, might as well make it a utility, right?
Yeah it's a bit too complex to copy and paste it a lot.
something to say?
Yeah, looks fine. This i pulled out of my ass to both allow "/plugin set name xxxx" & "/plugim set name "xx xxx""
if (parts.length >= 3 && parts[0].equals("set") && parts[1].equals("name")) {
String nameInQuotes = "";
if (parts[2].startsWith("\"")) {
StringBuilder sb = new StringBuilder();
for (int i = 2; i < parts.length; i++) {
if (parts[i].startsWith("\"")) {
sb.append(parts[i].substring(1));
} else if (parts[i].endsWith("\"")) {
sb.append(" ").append(parts[i].substring(0, parts[i].length() - 1));
break;
} else {
sb.append(" ").append(parts[i]);
}
}
nameInQuotes = sb.toString();
} else {
nameInQuotes = parts[2];
}
// Do somethign with the name.
}
me when StringJoiner
Ah
๐
Just tinker with this line maybe - 2:
sb.append(" ").append(parts[i].substring(0, parts[i].length() - 1));
Oh wait
i see what happened
not that line
the game does not break the words on the lore of an item, I have no way to change the description via a command?
Hm?
if (parts.length >= 3 && parts[0].equals("set") && parts[1].equals("name")) {
StringBuilder nameBuilder = new StringBuilder();
for (int i = 2; i < parts.length; i++) {
nameBuilder.append(parts[i]);
if (i < parts.length - 1) {
nameBuilder.append(" ");
}
}
String name = nameBuilder.toString();
if (name.startsWith("\"") && name.endsWith("\"")) {
name = name.substring(1, name.length() - 1);
}
return name
}
Anybody know off-hand if ConfigurationSection#isDouble also returns true when ConfigurationSection#isInt is true?
I pulled somethign else out of my ass.
maybe.
The new thing i pulled out of my ass will remove quotes, but quotes are no longer needed
your ass has a lot of stuff in it
M8 my ass is so nice.
give your ass
o.o
hehe
jotututuck
Yeah, you need to make a split.
String input = "123\\n123\\n";
String[] substrings = input.split("\\n");
List<String> result = Arrays.asList(substrings);
Probably.
from ur ass again?
Yeah
discords formatting is a bit wack
well I'm going to go in your ass
yeah i've broken it twice so far i think
select it all and just drag ur mouse on and off the message
it breaks my selecting somehow
it's all good, just for to insert the sentence in the lore
The description can just be set as the lore.
Think that's what IJ is telling you too.
Show full code.
?paste
Well. Try doing player.setItemInMainHand(item) then
and this is literally your file ^^
nothing happens, and no error in the console
Ah
maybe the ParsingUtils.spliting(args) doesn't return what it should?
ParsingUtils.spliting(ParsinUtils.parsing(args))
Oh ur already doing that
Are you using \n in your lore?
nop
yes but maybe I should not do it directly in the utils?
I'm stupid, I thought the split was based on the number of words, I c/c ur fx without paying attention, sorry
Do smth like
List<String> result = null;
if (substrings.length() > 1) {
result = Arrays.asList(substrings);
}
else {
result = Array.asList(input);
}
return result;
Oh yeah
Sry it was just so you can put your own new lines in it.
Not based on words.
I should be the one apologizing, not you
description does not fulfill its role
splitting method does not split correctly in fact
Rip
I have tried many things but nothing works bruh
import org.bukkit.Material;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.entity.PlayerDeathEvent;
import org.bukkit.inventory.ItemStack;
import org.bukkit.plugin.java.JavaPlugin;
import org.bukkit.Bukkit;
public class Elizadrop extends JavaPlugin implements Listener {
@Override
public void onEnable() {
Bukkit.getServer().getPluginManager().registerEvents(this, this);
}
@EventHandler
public void onDeath(PlayerDeathEvent deathEvent) {
Player p = deathEvent.getEntity();
if (p.getName().equals("fioxu")) {
p.getWorld().dropItemNaturally(p.getLocation(), new ItemStack(Material.ROTTEN_FLESH, 1));
}
}
}
items after death are invisible only to player "fioxu"
what can i change to fix this...
?paste
dont only drop the item if the player is named fioxu?
yes but items are invisible for fioxu (me)
any client side mods?
What doesn't work? The string splitter?
I don't have mods on the server
i think so
client side ones
print returns this to me
[03:15:56] [Server thread/INFO]: [yes\nwhy\n]
on result list
How are you splitting them? Also, are you not able to use a List<String>?
you may be able to understand better https://paste.md-5.net/unakohesoy.js
it should not be [yes\n, why\n] ?
Hi,
I have this error
package com.earth2me.essentials.api does not exist
With this code https://paste.md-5.net/ujozimihem.java
Som1 can help me for fixing this error
I import vault in my maven
And its not working
?paste large code blocks. PLEASE
mb
utilise vault
Essentials as dep 
t'as importรฉ essentials/vault dans ton pom.xml ?
vault est importรฉ dans mon pom.xml
<dependency>
<groupId>net.essentialsx</groupId>
<artifactId>EssentialsX</artifactId>
<version>2.19.0</version>
<scope>provided</scope>
<exclusions>
<exclusion>
<groupId>org.bstats</groupId>
<artifactId>bstats-bukkit</artifactId>
</exclusion>
</exclusions>
</dependency>
pour essentials
make sure to reload maven
already do it
รชtes vous tous fr mdrr ?
je parle 4 langues xd
on est pas bcp
Stylรฉ
Something I want to clarify. I'm assuming that you have a config section that is just a normal string. Smth like
section: "My String that I need to\nput on multiple lines."
Is there any reason you can't make it a list?
section:
- "My String that I need to"
- "put on multiple lines."
It's fine if you can't or don't want to. I'm just trying to give suggestions here. Because if you did it the second way, you could just call FileConfiguration#getStringList("section") and it would give you your list.
excuse nous shakespear
Tu parles quoi a part francais anglais
espagnol allemagne ?
oh sorry I forgot to specify, it is from a command like /plugin set description lorem ipsum do...
je parle arabe et le dutch
Gotcha
merci
J'essaie ca
How are you making the string in the command?
The essential plugin for Spigot servers.
ebibic
ebicepic
that might be me
do
do?
od
You could just do a String#split("\n"). When you use String#split() it removes the characters you provide from the original string. So all you are left with is the sections you want. Then all you would have to do is iterate over the string array and put into a list. Or use Collections#addAll(). Your preference.
String[] message = args[2].split("\n");
List<String> itemDesc = new ArrayList<>();
Collections.addAll(itemDesc, message);
i was wondering what that 2nd \ was
Oh wait. You'd have to first collect all arguments as a string.
You should be able to do that with String#join()
cest tres facile pour moi xd
I don't already do it with .parsing(args)?
T'as langue premiere c l'arabe ?
https://paste.md-5.net/iwanoqajuc.java
Do you know why this line doesnt work and by what can i change the getEconomy ?
com.earth2me.essentials.api.Economy econ = com.earth2me.essentials.api.Economy.getEconomy();
oui
Tu sais par quoi je peux changer jai pas dev avec spigot depuis un bon bout c'est la seule methode qui marche pas
regarde la vidรฉo รงa t'explique l'initialisation du plugin
Okk
comme รงa t'auras la bonne maniรจre de faire
tu pourras faire ce que tu veux faire aprรจs tqt
atleast keep chat in english
yes sorry
It looks like you are yes. However, it seems that your method doesn't return the string with the characters that you are trying to split on. It just adds a space between characters.
String message = ParsingUtils.parsing(args); returns me this: first\nsecond
I rly dont find what i can use instead of the getEconmy
you have to use getEconomy()
https://paste.md-5.net/rumumimuga.java in your main class
and then in your command
Economy economy = Main.getEconomy();
in the buyticket ?
yes
hypixel using spigot software ?
https://paste.md-5.net/feqesolodo.java
is this ok ?
ils ont surement un spigot ou une api modifiรฉe
mdr
Hmm, you could modify your inpu then.
String[] message = ParsingUtils.parsing(args).split("\n");
List<String> formattedMessage = new ArrayList<>();
Collections.addAll(formattedMessage, message);
he using private software like own software
formattedMessage returns me same thg : [first\nsecond]
Now i have this error with the line 26
mdr j aime le langlais
put your mouse on the error, it will tell you what to do or even do it for you
Hmm, that's not what it gives me. My string was first\nsecond line\nThird line test\nFourth line and I got the results I was looking for.
you have to import your main class at the top of your file
okk
with System.out.println ?
Yea. I iterated over the list though.
omg
do you know why the import is gray ?
i forget the for ayaaaaaaaa
still not working
mais non gros con
frere je fais quoi jcomprend pas ๐
its case sensitive
Well, you shouldn't have to iterate over the list if you are applying it to an itemstack. You just have to provide it. The formattedMessage list should have the \n characters removed from the strings.
comme ca ?
public buyTicket(WOLoto plugin)
bv mdrrr jsuis debile
You can't declare methods inside of other methods. You can only call them.
yeah i just copy his screen i forgot to change it
Don't try to create a plugin if you don't know how to code. ๐๐
what the
?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. https://media.discordapp.net/attachments/694661573125472256/998143126373941248/6n0v4g.gif
I still don't have it I'm going to cry
The constructor inside the method ๐
What does your code look like now?
and it always returns the same: [04:06:50] [Server thread/INFO]: first line\nsecond line
Likely because \n is actually a recognized pattern in RegEx (which #split() accepts, a RegEx pattern) so it's looking for the actual whitespace char rather than \n explicitly
You can fix that by either changing your split to be "\\\n", or just use | to split lines instead like most people do
Also, rather than StringBuilder in your parsing() method, you might find StringJoiner to be a bit nicer to use
StringJoiner joiner = new StringJoiner(" ");
for (int i = 2; i < args.length; i++) {
joiner.add(args[i]);
}```
Are there are good 1.17 libraries for plugin dev?
I can't say I've ever seen anyone use the pipe character to split lines.
but why does it work on Shadow and not on me?
Literally Essentials does it 
Tf? lmao
essentials ๐ฆ
It has a /lore command iirc that does use the pipe symbol
Lol, that's news to me. I've always used EpicRename if I wanted to set lore on things.
That's the most Minecraft plugin-y name I've ever heard
epicpicpic
EpicRareLegendary
Sylfaen, I can also get it to work just with this small test snippet
String[] input = { "first", "line\nsecond", "line" };
String message = String.join(" ", input);
System.out.println(Arrays.toString(message.split("\n")));```
So I'm not sure why it's not working for you. Though I would still advise either using a pipe symbol or changing your split to be `"\\\n"` instead, because that also works and is probably a lot safer
It might even just be a platform-dependent thing
But \\\n will guarantee you that you're removing \n as a literal rather than the whitespace char
[04:21:44] [Server thread/INFO]: [first line, second line] ๐ฅน

[04:23:11] [Server thread/INFO]: [f, i, r, s, t, , l, i, n, e, |, s, e, c, o, n, d, , l, i, n, e]
Damn
uwu
Maybe you want to be special and allow both ๐ "[\\\n|\\|]"
thank you very much it was not won lol
no need to delete...
no need to explain...
less aggressiveness more positivity thank you
You're re-using ItemMeta
You should make a new ItemStack for each coupon. Move everything item-related into your loop
youhouuu
?paste
SINCE WHEN WAS THERE A GIF
.?learnjava has no gif ?learnjava**!** has a gif
i send that then see you in spigotcraft be like
?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. https://media.discordapp.net/attachments/694661573125472256/998143126373941248/6n0v4g.gif
Where
?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.
see
Lol that gif doesn't autoplay, I thought it was just a picture.
lmao
Is there a good util which converts seconds, minutes, etc to ticks and vise versa?
I'm like 99% sure I screwed up the conversion so I might as well use a util if one already exists lmao
Why do u need a util for that? Isn't it just 20 ticks per second?
(Minutes * 60 + seconds) * 20L?
๐ค
I fucked up the math majorly lmao
there was one that I used previously which also converted it to hh:mm:ss format, but I don't have that class anymore lol
I usually just make my own.
Like
Minutes = 0
Hours = 0
while (seconds > 60) {
Minutes++;
Seconds -= 60
}
While (minutes > 60) {
Hours++;
Minutes -= 60;
}
String time = hours + "h:" + minutes + "m:" + seconds "s"```
๐ค
Well, u could make math for it but sometimes the time isn't enough for hours or minutes
Do you even need loops I've achieved this same thing o(1)
Unless u want to check with a if
Idk, that's how I been doing and never gave problems ๐ค
fair
I am thinking about a problem for 2 days but no solution came in mind.
I have a plugin A and I have an Addonloader on plugin A
which use bukkit plugin loader(basically load spigot plugins as my plugin's addon from datafolder)
now one of my addon(named it** B**) need plugin C to run. but plugin C isn't in soft/depend list of plugin A. as a result, C load before A & Addon B don't work.
how can I fix it?
Yea, the one I used did all the math for converting back and forth, as well as converting it into a neat {0} hours, {0} minutes, {0} seconds format or something along those lines
The home of Spigot a high performance, no lag customized CraftBukkit Minecraft server API, and BungeeCord, the cloud server proxy.
theres a loadbefore option
doesn't necessarily have to be a depend
Isn't this what you need?
Well, won't depend make it so your plugin loads after those in the list?
But why isn't it?
Don't want to add depend as it will not be a solution. plugin A & its addon B made by me. so I can easily add all depends on main plugin's depend list
but what if another developer create any addon of my plugin? he can't modify my plugin(A)
.
but A can still load before the depends
Any addon of a plugin should depend of the main plugin
If your plugin depends of another plugin then make it a depend ๐ and then make your addons depend on your plugin
here is the loader
I never needed to use depend but if something needs to depend on other things then depending has to be depended for it to depend, u feel me?
main plugin don't need any depend. but its addons need
I dont see the problem then?
plugin C can load at any time
if B is being loaded after the fact
He said C uses its main plugin and another plugin
Why not depend on both plugins if requires both?
Then add depends on the addons like we have said already ๐คฃ
What's the issue with depend, have you tried?
A = my plugin plugin (It don't need anything to run)
B = addon of A (it need A ofc. also C)
C = a random plugin
Then add depend for both A and C
like i said B should depend A & C
but addons get loaded when plugin A enable
What's the issue?
Why is your plugin A enabling others?
Plugin.yml will load the plugins correctly and with its own depends
If not, then you make your own code to check plugin.yml of your addons and check if they have any depend and load it's depends ๐ idk how that works but sounds like a mess
Why are you even loading your addons on your plugin instead of letting it load by itself?
it register discord slash command on main plugin. so need to load with main plugin
to look cool
Why don't you check after few seconds if addon is loaded and so register the slash command?
If something is giving problems, then it needs fixing and sometimes to fix you gotta change the way you are making thinks.
๐ฟ๐ท
Can't you make a API on the main plugin to register slash commands and then on the addon use that to connect with the discord bot and register the commands? And use depend on the addon
It feels like you are connecting them already in some way anyways, why not make the addon itself register the command.
?jd-s for me
it would be impossible for addon plugins to load before your addonloader plugin
when create an addon loader, instead of the plugins depending on spigot API they depend on your loader plugin instead
the caveat of this, is that your addon loader needs to now re-expose spigot API as it can't be seen
man working with shader code is wicked fun
How can I make a 1.8/1.19 compatible plug-in?
Depend on 1.8
wdym
I was looking at this plugin https://www.spigotmc.org/resources/kitpvp-1-8-1-19-custom-kits-leaderboards-gui-levels-kill-streaks-abilities-more.27107/?__cf_chl_tk=7cIWrMUVdH4KPQH5L_2tNgp1gB0iDuPAllUaoKjJ1Zc-1675329571-0-gaNycGzNCFE
Inside its code there isn't any reflection. It is compiled with java 15.0.2 and should be compatible with both 1.8 and 1.19
woah
no need for reflection
8
you're amazing guys, thank you ๐
Works! :))
Im making custom resourcepack that displays server's gold
.../textures/gui/gold.json
{
"format_version": "1.14.0",
"elements": [
{
"type": "icon",
"x": 800,
"y": 20,
"width": 32,
"height": 32,
"icon": "textures/gui/icons/money_icon.png",
"scale": 1
},
{
"type": "label",
"x": 836,
"y": 20,
"width": 64,
"height": 32,
"text": "${money_amount}",
"scale": 1
}
]
}
How do i update resourcepack every time gold change?
ChatGPT said i shuold use packet but i couldn't find way in 1.19
why use a packet?!
is there any way?
What are you even doing
Just use a font character
and send that
search up on how to make custom font characters, then send that character
for example, if you bind the image to \uE000 if you just send players \uE000 trough a plugin and they have the res pack, they'll see the icon
Then it's up to you where you display it
using this pom.xml:
<dependency>
<groupId>net.coobird</groupId>
<artifactId>thumbnailator</artifactId>
<version>0.4.19</version>
<exclusions>
<exclusion>
<groupId>net.coobird</groupId>
<artifactId>javadoc</artifactId>
</exclusion>
</exclusions>
</dependency>
my exclusion doesn't work (screenshot coming)
anyone knows why not?
You can't just exclude package like that
how can I? ๐
interestingly the maven also compiles another plugin of mine with it
there is no trace of the plugin to be found
nvm its the decomiler
anyone with experience handling enchanted books, am I wrong in believing that enchanted books are books which are actually enchanted with the enchantment they contain?
enchanted books are a separate material
but yes they're enchanted
you can hit someone with a fire aspect book and they'll catch on fire
Ouch that would cause a loading screen every gold change
Given an arbitrary Listener class, can I "pre-process" the listener's events? (Such as changing data and the likes), or do I have to handle event registering on my own?
?stash
can I test this with you irl?
what are you, british?
anyone can help me? ๐
wagwan
man I should've rewritten the enchantment system I made 5 years ago a long time ago
yes so the openAI said to use the packet instead changing resource pack every time
but in AI's knowledge, it's stopped to 2021
and i couldn't search way in 1.19.3
A packet won't magically remove the need for the loading screen
If so why would you even have loading screens in the first place
i mean ai said use packet to give new data to player's resourcepack
but the ai said so
well
Here's a high-level overview of the steps involved in sending packets in Minecraft:
Obtain a reference to the player's connection.
Create a new packet object with the updated money amount.
Write the data for the packet to a ByteBuf using an appropriate protocol encoding.
Send the packet to the player's connection using the player's connection's sendPacket method.
ai said ^
yes we know but it will still load
It wonโt
i suppose they already have all textures loaded?
It is wrong.
They have loading screens once and then they do what IkeVoodo said
ohh what's the correct way?
The way IkeVoodo told you
ohh i just found this
Then we don't need resourcepack?
since it's custom character
but if i wanna display a number, should i make each fonts for each numbers?
how do I move a player to the bottom of the tablist? is there an api method or a packet for it?
Use teams
oh that could help yeah
with the name like "ZZZZZZ" or something?
for it to be the lsat
last*
You need the resourcepack to load the custom characters
ah also how do you display numbers next to that character(icon)?
1๏ธโฃ should i make each number's font?
2๏ธโฃ should i use action bar and create cusotm text for it?
How can I detect from the EntityDamageByEntityEvent, if the damage is going to cause the death?
check if damage is higher than entity health
final damage
ty Elgar
is listening to chunk load event, going through all entities and removing ones with PDC too performance heavy?
shouldn't be
ok thanks
You may find entites at chunk load will not actually be loaded
Is it possible to use a custom jar with specialsource-maven-plugin? Build tools doesnt have the proper mappings that my jar has, how can i go about getting the proper mappings passed through the maven plugin
?nms
is it possible to hide code but only allow to download Releases in github?
Sorry if my previous message is not clear, but I have a modified spigot that has mappings that build tools does not map for me. I have source for my spigot and would like to know how to make it use my custom jars mappings
Specifically want to know what I need to add to my local maven repo in order for my custom jar mappings to work with the maven plugin
What is the point of having it on gh then
I don't think you can control access on that granular level, no. You'd have to push the build results somewhere else. Or have a proxy which is trusted on the repo and relays calls to the downloads. But well, at that point you already need a server.
The only way to really do that is use an authenticated API to reflect the classes in on runtime but not only is that still exploitable but it's a lot of work
Why does it happen so that if i unload and then load again a chunk with certain entity that i have a field with, i am no longer able to teleport or remove it?
and how can i fix it?
Yes
you need a private repo
and then if you want a place to distribute binaries easily could just store them in your github page repo
think that accomplishes what you are possibly asking?
Player victim = event.getPlayer();
Player killer = victim.getKiller();
if (!(killer instanceof Player)) {
return;
}
if (!(victim instanceof Player)) {
return;
}
victim.setHealth(victim.getHealth() - 1);
killer.setHealth(killer.getHealth() + 1);
}
}```
Does any one know which one of these are more efficient
```java
Player victim = event.getPlayer();
Player killer = victim.getKiller();
if (killer instanceof Player) {
if (victim instanceof Player) {
victim.setHealth(victim.getHealth() - 1);
killer.setHealth(killer.getHealth() + 1);
}
}
}```
which way of making my code would be more efficient/better
&& ?
Player victim = event.getPlayer();
Player killer = victim.getKiller();
if (!(killer instanceof Player) && !(victim instanceof Player)) {
return;
}
victim.setHealth(victim.getHealth() - 1);
killer.setHealth(killer.getHealth() + 1);
}
}```
Like this ig
What? Why would you ever join two separate if statements? That's just not gonna add to readability nor efficiency.
is there a way to uniquely identify a spigot server on the internet, like a value that you cant manipulate or clone and that is unique for every server ?
i read about server uuids but you can change the vlaue from settings.yml
Why tho
need to identify different instances because the servers are going to connect to an api and some sockets
and i need to know which one is which
If you control the api/sockets and what the server sends, just give them a unique ID and have them send it
there is a method to play effect of totem with custom model data?
Is it not possible to use PlayerDeathEvent or something like that?
Have you ensured that your ServerMapRenderer is actually instantiated and rendering? Have you printed the map IDs of the item and the renderer? Are they the same?
im afraid my java plugin could get easily reverse engineered and decompiled to send cloned IDs
i am making a licensing system
plugins are interfacing with an api that checks if they have a valid subscription
The combination of the host's public IP as well as the socket's listening port should be unique, I'd say. With the IP you're unique to the machine, with the port unique to the process.
You can't even put plugins like that on Spigot
actually clever
never said i was going to
mac address + subnet?
I know, I'm just saying.
actually no just heavily obfuscate some uuid provided by your server
the plugins call an express restful api so i dont think i can retrieve the mac adress from the request, probably only the ip and port, and even then they could use a reverse proxy or vpn to change it
You're gonna have to call some public IP API and check the socket's port yourself. You can still probably intercept networking and spoof these values.
MAC is way too easy to spoof, you gotta at least make it hard for them.
you mean validating the ip and port combination with an ip api ?
i thought of session-based authentication aswell, with each session being a socket connection and upon disconnection the server sends a fresh session id that will beused by the server to start up next time
upon disconnection the current session id is discarded and a fresh one is fetched
Well, you're not gonna have easy access to the public IP otherwise. You need to make a call to an external host which can then tell you your public IP. And the port is only local, so you need to check the netty socket for that. Those ports are usually mapped somewhere, like for networks and the like.
req.connection.remoteAddress
req.connection.remotePort
req.connection.localAddress
req.connection.localPort
can i use this ? or is it spoofable
A bit more context wouldn't hurt. What's req?
wdym?
you can probably create a totem, with the data, and damage them to cause it to play
oh sorry lol, req is the request object containing the request data received upon an api call
it is syntax for express.js
Oh, you're talking about hosting your own public IP getter service? Well, then that's safe, as there's nobody to spoof it but yourself, xD
like :
app.get('/', function (req, res) {
res.send('hello world')
})```
res is the response object
so , i give it to a player and damage the player?
client-side , can't they manipulate the ip and port they make the request with ?
im guessing so
Clientside what? You're not trying to host that express server in the plugin, are you?
you do realize that so as long as you are using java
there is literally nothing you can do about reverse engineering nor preventing false data from being sent by it
you can't even accurately tell from Java if something is actually spoofed or not from the host because if there is anything the application should do is trust the host, and well it can't do much if the host decides to give it false data
the express server is an api i am hosting publicly for everybody, the clients need to perform certain calls to retrieve some data, but i want to know which server is requesting the data, because each server owner needs to have an account with a subscription (already handled all of the payment stuff and the authentication stuff). All i need now is a way of knowing who exactly is requesting the stuff
Then just give each server an API key or smth?
if you have a rest api, implement tokens, each server has their own unique token specific to them
that way one user could buy the resource and share the api key with all of their friends
You have these problems with every language on every system. Licensing-Systems don't work in general, but if somebody still wants to implement them, I'd say that it's up to them to invest the work.
You can track the ips of the requests and limit them
we came to the conclusion that it might not be optimal, i cant exactly retrieve the right ip:port
Then you just find out your socket port and add it to the request you make to your express server. The express server then has the port and the public IP (you cannot spoof, as your provider ensures that) and you can identify the host that way.
and how does your system stop someone from distributing it themselves vs this?
what are you trying to do prevent piracy of your plugin?
if that is the case you simply can't
yes
like this??
SpigotUtils.spigotCommand("o give " + p.getName() + " totem_discord" ); p.damage(Double.parseDouble("20"));
your licensing doesn't address if I decide to host your plugin somewhere for people to download
what do you mean by socket port ? sorry for the confusion
it also doesn't address if I just privately give it to someone else
im not scared of people decompiling my plugin
if that gives that totem, set it the item there holding to it
wont do anything otherwise
as my plugin only works if it can connect to this api and some sockets that make it actually work
The port of the mincraft server socket. That's just relevant if you also want to identify multiple servers on the same host.
doubt it
you are telling me I couldn't fool your plugin?
into thinking it connected to where it thought it should
what stops me from using the plugin legitimately to pull the data it so call needs and save it for later?
thats the goal, yes
so , i need to force a slot/offhand?
it is impossible to make a plugin that can't accept spoofed data
because the data is subject to dynamic updates, the plugin i have in mind is something really cool and ive never seen it anywhere else lol
especially with java
bet you I have
and there is probably a reason you haven't
good for you pal
bad for you
stop thinking you have this fool proof method for java
you are not the first you know
and obviously not the last to go down this road
yeah
brodie ate bread and frustration for breakfast
i actually give zero fucks about your little ego
Anyways good luck to your supposed fool proof method. I am sure if there was one, it would be used already ๐
change your tone as you are speaking to someone that is being respectful towards you
no
Are you adding drm
@worldly ingot
then go speak to somebody else or perhaps a friend if you happen to have one
Basically
I love fiddling around with that stuff
yeah whatever DRM they come up with Java will be defeated in just a few seconds
This reminds me I want to learn bytecode manipulation stuff
Oh yeah lmao
Isn't there a whole spigot thread on that still
think so
the thing is that you guys know nothing about what project i have in mind but the ego in the developing community is insane
good lord yall need to speak with more people irl ๐
There's no ego its just going to be cracked
I mean I'm not being rude I'm just stating an eventuality
don't need to. If it involves DRM there is literally nothing you can do that will be fool proof. We are not all kids here and some of us have been using Java since its release
im talking about the way frostalf was talking to me, as if he knew it all lol
but do let me know if you find some hidden setting in Java that would allow for an uncrackable DRM
not drm
only other thing would be SaaS
which you are going to have to address a MITM
have fun with that one
a man in the middle for a saas spigot plugin ?
how i can set my item?
p.getInventory().setItemInOffHand(?);
basically the middle person is the legitimate user requesting on behalf of those that want the data
Iirc you just gotta use the slot number I forget what it is but there are charts online with a full set of slot numbers for player inventories
make the item yourself
I think a thing that would be closer in terms would be a proxy
each user has data that is managed by the user itself on a web dashboard, i dont see why an user would like to send that data to other users that are now forced into using that user's specific data
thank god for the chmod

