#help-development
1 messages · Page 246 of 1
it shouldn't be null, rather it should be the projectile as the killer
But, all you should need to do though if you have a projectile is to get the ProjectileSource
Both codes are the same but the one in the non-actualy-event class does not works. Everything is set up. Class is registered, method has @EventHandler.
How is attacker null when it is a palyeR?
Thanks a lot!
?paste
There is no error actually.
Only thing when I added a check if attacker is null it returned yes
and idk how or why
ok, but being able to see the code you are working with would be very handy
https://paste.md-5.net/xewevunuxi.java - this is the kill class - that is NOT the actual class for managing kills, this does something else
https://paste.md-5.net/puqomimobo.cs - and an actual class, that manages kills and stats
which works
fine
and the reason why the first class almost looks the same as the second is... because I even copied the code from the second class into the first class, "maybe then you will do your job". Still I am null
because you are using the wrong event
no matter what event I used actuall
Entity or Player
both return the player as null
yes because they are both wrong events
oh...
by the time those events are thrown it is generally too late to do anything, don't even think they are cancellable
however
there is events you should be listening to though for your purpose
if you need to know if they are going to die
check their health if its at 0
declaration: package: org.bukkit.event.entity, class: EntityDamageByEntityEvent
you just can't cancel the death event if I recall
you have to do it before they actually die
correct, and the event that would give them a killer is the one I provided above
all you do is check for their health being at 0
And is even better and also easier I think
but still can't figure out why is killer null
I wonder what if I replace Player to LivingEntity
oh wow one codeline won't work xd
^^^^
no need to set lore to a mutable list
it should still be noted, also noticed what they were doing wrong, that killer is not a player if an arrow kills the player and the code needs to be modified to handle such things to get the real killer
Seems logical
btw the code you sent I tried... Still sends me as null 😹
I swear Minecraft is the best game ever lmao
now my graph has died 💀
has to do with the way it is implemented
it is the whole reason projectilesource actually exists
by palyerslol
I guess that should not matter. One event works, but the other doesn't. One detects the killer, the second doesn't.
And both code are almost the same.
Both classes are registered.
Which means... Either I am a stupid man who just mistyped something, or Java or Spigot/Paper is having trouble reading the same code at the same time lmao
It will throw NPE
Beucase killer cannot be set to a player
and code requires player
aaaand even trying to send a message to the killer does not appear lmao
Even made a new event to send messages to both killer and killed player. Killer is still null
Why do like this? return this.lore == null ? null : new ArrayList(Lists.transform(this.lore, CraftChatMessage::fromJSONComponent)); when you only want to compere x lore with y lore (should be some raw method to get i also). Or method were you can check if two lore is equal.
It cost performance if you try access it to often, how it constructed.
I mean some say use spigot api were you can, but things like this I start to think on use nms instead and is not the only bug some has stick around for 10 years ether.
Hey, i'm struggling so hard to spawn Paricles in minecraft 1.8 can someone tell me what command should i use ?
I've already tried spawnParticle, but for some reasons i can't manage to cast it
Iirc that's going to vary depending on which particle you want
Also depending on the effect you want maybe just use https://dev.bukkit.org/projects/effectlib
Event for naturally spawned villagers?
How can I check the interaction result of a player when he right-clicks with an item in his hand? Something like targetBlock.getInteractResult(playerItem)
I don't think you can? Since you have the block you could wait a tick and see if its state has changed desirably.
Never used them but I'm seeing #useInteractedBlock and #useItemInHand return a Result
Do you have a link for like any particle, just to see where to start ? cause everything i've seen does not work
No, but if you tell me which particle you want I could try searching.
You can save the state at the event and a tick after.
If you have the time to help me, SNOWBALL_POOF would be nice, i appreciate so much ur devotion
ya'll i had IntelliJ installed but it was acting weird, so i uninstalled, re-installed, and now it doesn't recognize Bukkit as a dependency in IntelliJ even tho it compiles fine ... help?
like if i type getLogger() it doesn't show the Bukkit import at all
if i use the import from another file it then it highlights getLogger as an error
I've seen that there is playEffect() that exists but
Effect effect,
T data)```
i don't know what the data stands for
Looks like you were on the right track. For 1.8 it seems to be player.playEffect(player.getLocation(), Effect.SNOWBALL, 1f); where 1f appears to be speed but doesn't apply to all particles
It's extra data depending on what Effect you're using
Make sure your Minecraft client has particles enabled
That argument can only be a float? I think there's an overloaded one (+1 more argument) that is extra data
He sent that one, no?
We're you using maven?
yeah
If not probably time to switch it'd only be logical to if so. Make sure the project is loaded correctly try invalidating caches
Could not pass event EntityDamageByEntityEvent to pluginOneCube v1.0 org.bukkit.event.EventException: null thrown in my cmd.exe
when i cancel the AsyncPlayerChatEvent my message is still sent?
tysm
it's weird how it works i haven't seen something like that
then it's not being cancelled or called. what's the code?
// Staff chat is enabled
e.setCancelled(true);
plugin.sendStaffChat(p,msg);
}```
Most of them will just have data be null, but something like... RECORD_PLAY wants the disc ID as the data.
the plugin.sendStaffChat(p,msg); is happening
full code
@EventHandler
public void onChat(AsyncPlayerChatEvent e){
Player p = e.getPlayer();
String msg = e.getMessage();
if(staffChatToggled.containsKey(p.getUniqueId()) || msg.startsWith("#")){
// Staff chat is enabled
e.setCancelled(true);
plugin.sendStaffChat(p,msg);
}
}
I hate intellij so I can't help to much sometimes invalidating caches works with idea products tho
it didn't work
try also doing a blank return
Thank u so much, it works, but if i want to summon more particles, do u know how i could do, except casting the command multiple times ?
its such a crazy bug.
i had to do the reinstall because it kept freezing up on me with no plugins
its a void function
then do a return;
Uhh, playEffect doesn't have any count or delta arguments that I see. You might just have to call it multiple times.
which is unnecessary
it exits the function
not in a void
even inteli will tell u
add code after it then it wont shout
eg
public void onBlockPlace(BlockPlaceEvent event) {
if (event.getPlayer().getGameMode() == GameMode.CREATIVE) return;
``` will scream at me
```java
public void onBlockPlace(BlockPlaceEvent event) {
if (event.getPlayer().getGameMode() == GameMode.CREATIVE) return;
event.getPlayer().sendMessage("Block placed");
``` wont shout at me
skill issue
public void listhomes(Player p) {
int e = homeConfig.getConfigurationSection("Homes.Players." + p.getUniqueId()).getKeys(false).size();
StringBuilder message = new StringBuilder();
while (e > 0) {
message = new StringBuilder(message + homeConfig.getStringList("Homes.Players." + p.getUniqueId()).get(e));
e++;
}
p.sendMessage("Here is a list of your homes: " + message);
}
what does the config look like
why are you making message a new string builder when it already as one
?
StringBuilder message = new StringBuilder();
message = new StringBuilder(message + homeConfig.getStringList("Homes.Players." + p.getUniqueId()).get(e))
Variable 'message' might not have been initialized
e++ your loop will never end as it starts non zero
what are you trying to do with that code?
its gonna be a homes sort thing
ah danget it errored again
public void listhomes(Player p) {
int e = homeConfig.getConfigurationSection("Homes.Players." + p.getUniqueId()).getKeys(false).size();
StringBuilder message = new StringBuilder();
while (e > 0) {
message = new StringBuilder(message + homeConfig.getStringList("Homes.Players." + p.getUniqueId()).get(e));
e--;
}
p.sendMessage("Here is a list of your homes: " + message);
}
Why not just for loop homeConfig.getConfigurationSection("Homes.Players." + p.getUniqueId()).getKeys(false)
yeah
i dont know how I would go around doing that im used to while loops
for (int i = 0; homeConfig.getConfigurationSection("Homes.Players." + p.getUniqueId()).getKeys(false) > 0; i++ {
code
for(String key: homeConfig.getConfigurationSection("Homes.Players." + p.getUniqueId()).getKeys(false)) {```
what is the output for that message supposed to look like?
forgot about that
"Here is a list of your homes: e1, e2, e3
I recommend looping over the keys of "Homes.Players." + p.getUniqueId()and joining them with a StringJoiner
public void listHomes(Player player) {
StringBuilder message = new StringBuilder();
for(String key: homeConfig.getConfigurationSection("Homes.Players." + p.getUniqueId()).getKeys(false)) {
message.add(key);
}
}
Cannot resolve method 'add' in 'StringBuilder'
it's append or something like that
try append
you need to learn how to use java docs
ill try it
also, if you want to have a delimiter I recommend using a StringJoiner instead.
declaration: module: java.base, package: java.lang, class: StringBuilder
you mean a comma?
yep
so if you want home1,home2,home3
using a StringJoiner instead of a StringBuilder would make that easier
alr im using string joiner ima test it
for example
StringJoiner joiner = new StringJoiner(","); // each string will be separated by a ,
joiner.add("a");
joiner.add("b");
System.out.println(joiner); // prints a,b
it works!
StringJoiner message = new StringJoiner(", ");
for (String key : homeConfig.getConfigurationSection("Homes.Players." + p.getUniqueId()).getKeys(false)) {
message.add(key);
}
p.sendMessage(message + "");
}```
For anyone who might find this useful here is my code
you could just String.join(stufFromConfig, ",")
actually yeah you could do that too
he
he
player.sendMessage(homeConfig.getConfigurationSection("Homes.Players." + p.getUniqueId()).getKeys(false).stream().collect(Collectors.joining(", ")));```
player.sendMessage(String.join(", ", homeConfig.getConfigurationSection("Homes.Players." + p.getUniqueId()).getKeys(false)));```
second is smaller
and don't use stream
so i guess a lot better
thanks oneliners for small codes
How can I delete a specific string list? For example:
Homes: Players: EthanGarey: E: X...
I want to delete "E" and everything in it.
Do you know the best way to add nametags next to a player's nickname?
add nametags?
Set it to null and let the garbage collector do its magic
but how? nametagedit has errors, protocollib not sure how. I was looking for some api and found nothing interesting.
config.set("Homes.Players.EthanGarey.E", null)
config.save()
pc lagging this might take a while
Anyone know a resource to listen to the sounds in the Sound enum?
/playsound?
only done manually in game?
yeah
it worked thanks guys
shouldn't be a problem for developer ig
if i have something like ```yml
RTP-Menu:
buttons:
North_America: "Image.png"
South_America: "Image.png"
Europe: "Image.png"
Africa: "Image.png"
Asia: "Image.png"
Oceania: "Image.png"
how would i loop over these keys like "North_America"
is it getConfigurationSection
config.getSection("ripmenu.buttons")
loop over that and youre looping over the entries
for (String key : config.getConfigurationSection("path") { sysout.(key) }
you cannot loop over configuration section
"foreach not applicable to type 'org.bukkit.configuration.@org.jetbrains.annotations.Nullable ConfigurationSection'"
oh sorry
yeah
for (String key : config.getConfigurationSection("path").getKeys(false)) { sysout.(key) } if you want my one
I have yet to find a good solution for putting subcommands into their own classes. Anybody who can lead me somewhere?
it depeneds
https://paste.md-5.net/cocugurezo.java
Caused by: java.lang.NullPointerException: Cannot invoke "org.bukkit.configuration.ConfigurationSection.getKeys(boolean)" because the return value of "org.bukkit.configuration.file.FileConfiguration.getConfigurationSection(String)" is null
at BetterServer.commands.Homes.onTabComplete(Homes.java:229) ~[?:?]
Idk why it's null though, i created the file..
what should I do?
one moment
change it to look like
File motdConfigFile = new File(plugin.getDataFolder(), "motd.yml");
if (!motdConfigFile.exists()) {
motdConfigFile.getParentFile().mkdirs();
plugin.saveResource("motd.yml", false);
Bukkit.getConsoleSender().sendMessage("§4§lCould not save the file, is it being used by something?");
}
try {
motdConfig.load(motdConfigFile);
} catch (IOException | InvalidConfigurationException e) {
e.printStackTrace();
Bukkit.getConsoleSender().sendMessage("§4§lAn error occurred while reading your motd.yml file, if you need help just join our discord with /betterserver help!");
}
replacing it to work with the correct vars ofc
oh lol
ill try it
at java.lang.Thread.run(Thread.java:833) [?:?]
Caused by: java.lang.NullPointerException: Cannot invoke "org.bukkit.configuration.ConfigurationSection.getKeys(boolean)" because the return value of "org.bukkit.configuration.file.FileConfiguration.getConfigurationSection(String)" is null
at BetterServer.commands.Homes.onCommand(Homes.java:70) ~[?:?]
at org.bukkit.command.PluginCommand.execute(PluginCommand.java:45) ~[spigot-api-1.19.2-R0.1-SNAPSHOT.jar:?]
... 23 more
is the config section null or not exist
?paste the new file
when i do that it says line 88 is null
what does the config section look like
yaml
epic code block fail?
show us the actual file
the config section is null because theres nothing there
but that doesnt make sense for the tab completer
add a home and it wont be null
if its null it cant add anything
so errors out
also use StringUtil.copyPartialMatches
bukkit class
return StringUtil.copyPartialMatches(args[num], gethomes, new ArrayList<>()):
gethomes?
args?
probably should see if the section even exists before randomly trying to access it
what should I replace num with
the arg number
starts at 0
/comand arg0 arg1 arg2
args.length starts at 1, args[] starts at 0
thanks C and pointers for it
it isnt tab completer if there isnt atleast 1 arg technically
Hello! I made an update checker but doesn't works... Anyone knows why?
public class UpdateChecker
{
private SimpleSetSpawn plugin;
private int resourceId;
public UpdateChecker(SimpleSetSpawn plugin, int resourceId) {
this.plugin = plugin;
this.resourceId = resourceId;
}
public void getLatestVersion(Consumer<String> consumer) {
Bukkit.getScheduler().runTaskAsynchronously(this.plugin, () -> {
try (InputStream inputStream = new URL("https:/api.spigotmc.org/legacy/update.php?resource=" + this.resourceId).openStream(); Scanner scanner = new Scanner(inputStream)) {
if (scanner.hasNext()) {
consumer.accept(scanner.next());
}
} catch (IOException exception) {
this.plugin.getLogger().info(plugin.name + ChatColor.RED + " Cannot look for updates: " + exception.getMessage());
}
});
}
}
Main class:
public void updateChecker(){
new UpdateChecker(this, 106488).getLatestVersion(version -> {
if (this.getDescription().getVersion().equalsIgnoreCase(version)) {
Bukkit.getConsoleSender().sendMessage(name + ChatColor.GREEN + " It's up to date (Running version: " + ChatColor.WHITE + version + ")");
}else{
Bukkit.getConsoleSender().sendMessage(name + ChatColor.RED + " You are running an old version of the plugin, please update to the latest version.");
}
});
}
?notworking
"Does not working" is a useless statement. Please describe what exactly is not working, what you expect it to do, and what actually happens. If you get any console errors, also ?paste the entire stacktrace.
"Please describe what exactly is not working" ok so basically it's not checking if there's any available versiom.
errors?
is scanner.hasNext true ?
scanner::hasNext doesnt trigger ig
https://paste.md-5.net/vorunizugi.java
/home and /homes are just not returning anything (no errors either) anyone know why? also i tested it and my tabcompleter does work so i didnt have to modify that
any errors
nope
sysout in points in the code then
see whats happening
bukkit.broadcastMessage better
write the outputs to a file instead
I think the problem it's it marks like a //comment
What
write the outputs to a file in base64
thats just a link
oops
if it was a comment it would remove everything after that
/* */
Update checker it's broken! https://api.spigotmc.org/legacy/update.php?resource=106488106488
It gaves me this output
the exception basically it's "Invalid resource"
the resource id isnt valid then
But, I'm putting the resource ID correctly
I don't understand
whats the plugin
dm
?paste the full class with the update checker in
Does anyone know why this would happen when using a custom MapRenderer and editing the MapView
Here's the code where I only edit my custom cursors, and center location of the view
https://gist.github.com/braulio-dev/ee0f9740c3e3acf825c5de54b95815e4
print the resource id when it runs and see if its changing somehow
Server returned HTTP response code: 503 for URL: https://www.spigotmc.org/resources/simplesetspawn.106488/106488
i mean at the top of the getLatestVersion method
System.out.println(String.valueOf(resourceId)):
got problem with this code
holder.getViewer().getOpenInventory().getBottomInventory().removeItem(targetedItem);
targetedItem is itemStack amount of 10
but for example my whole item stack get's removed
iirc it just removes the item not checking for size
that sucks
is there way to remove proper amount
hm
Most likely error on spigot side
I am doing shop so I am trying to check whole item for unstack items
and remove specific amount
Update checker it's broken! Server returned HTTP response code: 503 for URL: https://www.spigotmc.org/resources/simplesetspawn.106488/106488
same problem @remote swallow
oh
ffs
I realise
was a very dumb thing
lul
i feel so dumb
xd
What was problem?
Okey, so basically
I was getting the resource ID twice
try (InputStream inputStream = new URL("https://api.spigotmc.org/legacy/update.php?resource=106488" + this.resourceId).openStream();
so I just removed the 106488 from the URL
Now it's working perfectly
Oh, then 503 shouldn't really be right response for that
Probably 404
Is api part of spigot on github?
i think it is
spigot
The error message that I send it's because I didn't updated the resource and I have the new one xD
Just use GitHub 
tag_name supremacy
github api supremacy
Is there way how can I disable learning recipes for player naturally?
I tried HumanEntity#hasDiscoveredRecipe, but there is no way (at least i didn't find) to give player recipe.
How do I delete an entity in its entirety?
For instance, chest boats. When I do .remove() on one, it drops the items instead of deleting itself as a whole
try setting the health to 0
I can't really do that to boats
Does anyone know how to cancel a packet from being sent to client by bungee?
Which packet and why
Respawn so that the loading world screen doesnt show when changing servers
in a for loop, can I get the number of times the loop has executed?
int i = 0; // This is the amount of times ran
for (Object o : object[]) {
i++
code
}
ahh ok
How long takes spigot to update the api, becsause this one stills on the old version and I actually posted the new one
I just started coding, I don't know how to do that at the moment :)
That's fine there's always room to learn
So basically spigot api takes a lot to update right?
Does anyone know how to properly render a default map in a MapView
Or make the default renderer render the whole map and not just what's explored
idk if this right channel but when I define a __global region with worldguard is global for every world in the server or just the world i am in?
just that world iirc
I'm woking on a custom crafting system, and need to listen for when an Item is crafted. Would the proper way to do this be to listen for something like CraftItemEvent, or instead listen to InventoryClickEvent, and just check if it's a crafting inventory and the result slot has been clicked?
CraftItemEvent
this event is notated in the javadocs as when the recipe is satisfied- is this a misnomer then?
or is the description wrong
what do you need the event for
I'm working on a custom crafting system with custom amounts and such
and need to subtract the correct amounts of items when the user crafts the item into the result
probably inventory click event
thank you!
Is there any design pattern that would force subclasses to have an empty constructor?
Why would you want that?
trying to make a cool util to insert/get objects to/from sql databases
But why would forcing subclasses to have empty constructors solve this?
but i have no way to guarantee i can create an instance of the class with reflection if i cant guarantee an empty cosntructor
this is probably an x y problem
where i'm going abt it wrong
Just add it to the documentation
Most libraries throw an error if that happens
At least that I know of
Yup. Throw an error and wherever the error materializes add some documentation.
will do
btw for basics, are any other annotations needed to mark fields?
I would probably default to @NotNull but I guess that's a design choice
for sql not null is implied
Well in your screenshot you have @NotNull
oops
i meant for sql not null must be set, it's not the default
you can put null values unless otherwise specified
So you're invalidating this statement right?
Yes
I was going to say. Not null as default would be different from what SQL actually does
I have probably a really stupid question, but if I run an event from my plugin would another plugin
(that has no correlation with my plugin other than being on the same server)
be able to use the event?
if (enteredxp <= player.getExp()) {
player.sendMessage(InfoKeeper.getInfoKeeper(player, InfoKeeper.successfulWithdraw, enteredxp, (int) player.getExp()));
ExpBottleHandler.giveExpBottle(player, enteredxp);
ExpBottleHandler.removePlayerExp(player, enteredxp);
} else {
player.sendMessage(InfoKeeper.getInfoKeeper(player, InfoKeeper.notEnoughXp, enteredxp, (int) player.getExp()));
}```
whats is the issue here . i am having 400 xp and i am trying to withdraw 100 xp it shows i dont have enough xp
I have not understand it
What are you actually trying to do here
Decreasing the xp of a player?
i have a command /myxp 100. here 100 willis args[0] so i want to validate the sentence like . if args[0] is less than my current xp then xp bottle will be given and 100 xp will be removed from user given else message will be sended to user.
Any errora?
no err
Have you debugged the ifs?
it show i dont have enough xp even i have xp
Is it entering the first if
when i debuf player.getexp i get value like 0.8
and my xp level is 108
multiply your xp by 135 and try again
Like if(enteredxp <= (player.getExp() * 135) { //Stuff }
why to multiply with 135
if your xp level is not enough, the xp number that is determined is probably a simplified version of the number that should look normal.
And to make 0.8 ,, 108.0, you need to multiply it with 135
And cast the xp to integer
ys
its weird
i want to get user xp point in game from spigot that also i cant get
If your talking about the normal events provided by spigot, the short answer is no. If you have your own custom events, and other plugins depend on your plugin to use those events, then yes those plugins can use your events.
You might want to use Player#getTotalExperience() instead of Player#getExp() then. The latter method is to get the experience of your current level. This is what is reflected on your XP bar.
If you go with the former method, keep in mind that this method will be effected by everything that gives xp. It might also reset to 0 when players die. So unless you have systems in place to prevent this, you might run into some issues.
Actually, now that I think about this, that might not be ideal either.
If you are wanting to take xp from the player, you'll have to follow the same math that is used for normal experience.
Which varies based on what level you are.
So you're going to have to calculate their total xp based on their level and then subtract the proper amount.
okok
?paste
When spawning an armor stand on a placed block, can I have the armor stand facing the player in the opposite direction, i.e. a full block at the player? I've been trying for a long time, I couldn't manage
hi guys , iam having very stupid problem ..
as you can see , lore is not line by line .. that's mistake ..
this is the code :
i want it to be line , under line
You should be able to get the player's eye direction as a vector and multiply it by -1 to get the opposite direction.
What does the code in your super method do?
Where does that list actually get set to the itemstack?
Well, it looks like you're somehow applying it wrong. Where do you make that specific itemstack?
thanks
[09:44:21 ERROR]: com.mysql.cj.jdbc.result.ResultSetFactory.<init>(ResultSetFactory.java:61)
[09:44:21 ERROR]: com.mysql.cj.jdbc.StatementImpl.<init>(StatementImpl.java:259)
[09:44:21 ERROR]: com.mysql.cj.jdbc.ConnectionImpl.createStatement(ConnectionImpl.java:1089)
[09:44:21 ERROR]: com.mysql.cj.jdbc.ConnectionImpl.createStatement(ConnectionImpl.java:1083)
[09:44:21 ERROR]: CoinAPI-1.0-SNAPSHOT.jar//de.dark.coinapi.utils.MySQL.executeQuery(MySQL.java:70)
[09:44:21 ERROR]: CoinAPI-1.0-SNAPSHOT.jar//de.dark.coinapi.utils.Coins.getCoins(Coins.java:94)
[09:44:21 ERROR]: CoinAPI-1.0-SNAPSHOT.jar//de.dark.coinapi.vault.EconomyProvider.getBalance(EconomyProvider.java:50)
[09:44:21 ERROR]: tablist-lp-1.0-SNAPSHOT (2).jar//net.milkbowl.vault.economy.AbstractEconomy.getBalance(AbstractEconomy.java:20)
[09:44:21 ERROR]: RealScoreboard.jar//josegamerpt.realscoreboard.utils.Placeholders.money(Placeholders.java:140)
[09:44:21 ERROR]: RealScoreboard.jar//josegamerpt.realscoreboard.utils.Placeholders.setPlaceHolders(Placeholders.java:193)
[09:44:21 ERROR]: RealScoreboard.jar//josegamerpt.realscoreboard.scoreboard.ScoreboardTask.lambda$run$0(ScoreboardTask.java:53)
[09:44:21 ERROR]: RealScoreboard.jar//josegamerpt.realscoreboard.scoreboard.ScoreboardTask$$Lambda$8909/0x00000008024a4458.apply(Unknown Source)```
Can anyone say me why the Server is crashing? Is it because of the mysql query execute or what is the problem?
I'm not gonna lie. I have no idea what I'm looking at here.
is there a way to set the motd to default? (serverpinglistener)
event.setServerIcon(default <-- here);
Look, setting itemstack lore is as simple as this.
List<String> lore = //whatever your list is.
ItemStack item = new ItemStack();
ItemMeta meta = item.getItemMeta();
meta.setLore(lore);
item.setItemMeta(meta);
Hi
and in the gui i just do this :
when i start my server test the plugin have problem whit the main class
?paste your code @rose ibex
the thing is there are 2 types of quests :
1- challenges
2- Quests
this is an intellij problom you might want to look it up
(he deleted his image)
That shouldn't change how the lore is applied to an itemstack.
no is the console
is not intellj in the image
ItemMeta takes care of newlines if you use the method.
What image?
i know
delete SimplePluginManager, it is stopping the error message from continuing
than reload
What does your InventoryDesignConfigKeys.VALUE.getStringList() method do?
Cause that looks like where your issue would be.
Am I missing messages here? I don't know what both of you are talking about.
He's not verified though so how did he post an image?
Also, that's blank.
thx
thats his image
he posted a link bypassing it
just check split.length
just put the right link to your main class in your plugin.yml
eeeee
yes
Not verified? Upload screenshots here: https://prnt.sc/
tf is a filled_map
Does your SolarCore class extend JavaPlugin?
yes
why solarcore.solarcore 🤔
pom.xml @rose ibex
ok
?paste your pom
what does that have to do with it
eeeeeeeeeeeeeeeeeee
Could be compiling weird. File structure looks fine, but maybe the main class got moved due to a wierd shading or smth
Your pom looks fine, but in all honestly, you don't need the plugins section. Intellij will use it's local version of maven to compile for you.
Your file structure also looks fine and if your main class extends JavaPlugin, then maybe you didn't copy the file over to the server properly. It happens sometimes. Try recompiling it and see if you still have an issue.
|||||||||||||||||||||||||||||||||||||||||||||
Wdym to the default?
Idk, maybe pass in null? That image is provided when there is no server icon found.
is this right?
Looks fine to me.
ok
You might have to send packets. I think the server image is cached locally on your machine, so you'd have to make the client think that it isn't there.
how tf..?
Have you not noticed how when you launch the game and go to the multiplayer list, the server icons are still there?
The icons are cached somewhere locally.
yea
So maybe a packet can tell the client that it's no longer necessary to keep that cached icon since it's no longer on the server.
It looks like if the server-icon file is removed, it is relayed to the client somehow.
You'll probably want to look into the server ping packets as that's when the icon is updated.
@wary topaz Looks like there is a packet field you can use.
Only problem is that you'll also have to send the MOTD as well.
This is 1.19 NMS not 1.19.2
But, you can send a null icon.
Sup guys
I have made NEAT ( Machine Learning )
But I don't know how to hook it up to Minecraft Plugin.
Im creating Anti Auto Clicker.
Any clues how should I rate different clients in NEAT?
Optional 🤡
Constructor params aren't optional though. :/
Any luck or are you still having problems?
anyone know a fix for this kind of problems?
iam getting the quest Lore , and set it ..
You're problem is right here. You are trying to concat a list of strings into a string variable, so the #toString() method gets called instead.
alright
still have problems
Same issue or something else?
same
Have you tried removing the plugins section of your pom?
nop that didnt work xd
this is the how the config looks like :
the lore is a list of strings
one string per line
if your description is already split by line just return that
so for each quest i set the value for lore like this :
can someone help me devlop a lifesteal server please
please join genral 1
I pay him 8 dollars / 2 hour
$4/hr? That's less than minimum wage. No thanks. 🙂
i have resolved the problem
are u expert?
it was in the plugin.yml
how much u need ?
if the description is already split by newlines just return that
otherwise use something like
public List<String> getLore(Quest<?> quest) {
// create output list
List<String> lore = new ArrayList<>();
// for each line in description
for (String ln : quest.getDescription()) {
// split the line by \n (newline)
// and add the lines to the output list
lore.addAll(Arrays.asList(ln.split("\n")));
}
// return output lore
return lore;
}
ItemMeta takes care of new lines so long as you provide a List<String> to the #setLore() method.
ah
wait but in his example its showing \n in the lore
oh i see what i was doing wrong
thank you !
Probably doing something wrong then.
Either that or thats the output of a List<String>#toString()
please use Collections.singletonList
is it safe to do stuff with particles async?
shouldnt matter though right
its not only 1 line
its multi line ..
but iam adding it in the config
that is the default
some of them are
Well, if he is including them, he should remove them as ItemMeta takes care of it.
?sevices
i dont see that
nop still
you are calling toString on some list and its fucking everything up
Ye
I'm certain it does though. At least that's how it's rendered in game. I don't put \n at the end of any of my messages in my lore.
no i know
maybe problem from this?
i mean wtf
can you show the code where you create the item stack
i do have code for that tho i never used it
hi guys, does anybody know a simple way i can create a folder inside the plugin folder and create a file inside of it ? i am running an http server in the plugin so i need a folder to put the html css and js files in, thanks :D
you asked for it : https://paste.md-5.net/ezucimapac.java
i added skywars support so i had to create seprate gui for skywars
xd
can you show getStringList
I think we are getting at the same thing.
List<String> lore = Arrays.asList("Line 1", "Line 2", "Line 3");
ItemStack item = new ItemStack(Material.RED_BED);
ItemMeta meta = item.getItemMeta();
meta.setLore(lore);
item.setItemMeta(meta);
That will return an item with 3 lines of lore.
yeah
ij just says fuck you when i paste it
in paste
welp it already have /n
i just noticed xd
i think problem from here ?
this is the lore for each quest
its just like "im gonna do 4 slashes anyway fool"
split uses regex idk if just \n will work as a split
its giving a warning as well
show the warning
on split("\n")
with one it probably just escapes?
You can split like that. It's valid.
or doesnt escape sry*
Although there is no point in splitting if you are working with a List<String> in the first place.
That codebase is a mess to read.
It took me a while to find that he was concating a string list with a string.
you might have a \n in a string
😳
Sure, but in this case, we are talking itemstack lore. There isn't a point in using \n because the newlines are handled if you provide a List<String>
yes but in the config for convenience or something i dont know you might want to use \n
Well, ideally if you are storing a list, you'd put it in list format.
# You would do this
my-list:
- "Line 1"
- "Line 2"
- "Line 3"
# Not this. This is painful to write.
my-string: "Line 1 \nLine 2 \nLine3"
Or just use yaml provided multiline
You're passing a valid list in that case.
What is the most reliable way to store Class instance inside ItemStack? Class structure might be changed with plugin updates so serialize Object to byte[] is not an option. For now I consider serialize class to JSON or Dictionary<String, Object> and then save it with PersistentDataType.BYTE_ARRAY to itemstack. What do you think?
Multiline?
Field: -|
Multiline
Things
anyway , this is how iam setting lore for each quest :
Idk, I guess it just comes down to preference at that point. I hate using that format.
bad
?
¯_(ツ)_/¯
when you develop stuff configurable by end user you gotta put yourself in mind of average end user with no programming knowledge or just no yaml knowledge
wow thats my longest sentence of the day
Good advice. If they can break it they will.
so what i can do to fix it ?
average plugin dev: their problem
i must remake the system on how to set the lore xd?
and then you have 10 github issues open
Greetings fellow humans,
Anyone know what event it is to prevent blocks from growing? such as skulk moss, trees ect
I want to avoid the blocks growing into certain areas
- dont have github
- theyll jump to your discord then
I was looking at https://hub.spigotmc.org/javadocs/spigot/org/bukkit/event/block/BlockGrowEvent.html and it has a source block, but it doesnt seem to have a list of blocks that grow from the source?
declaration: package: org.bukkit.event.block, class: BlockGrowEvent
I think you'll need multiple events. BlockSpreadEvent, BlockGrowEvent, etc
*snow
imagine having snow already
Ah, BlockSpreadEvent should handle the moss/skulk and it has a .getBlock and .getSource which is good
but BlockGrowEvent doesnt have a source block
so if a player decides to grow a tree right on the border, the trees leaves for example could go into another persons claim right?
is there another event more suitable for this that anyone knows of?
how do i render html css and JS in an HttpServer ?
Has a convient #isFromBonemeal() method as well.
o, thanks ill look into that
bump
You might want to also listen to the BlockFormEvent to prevent cobblestone casts and concrete mixing. However, this will also prevent snow and ice forming from snow storms. Maybe there's a check you can add for that.
yeah, so I just got a list of claims
and then im checking if the source block and block that was grown/spread is in the same claim
Im Currently listening to BlockPistonEvent BlockSpreadEvent and StructureGrowEvent
not sure why you went with machine learning to solve this. All you need is heuristics to solve a problem like auto clicking
i fixed my problem :
thanks for everyone .
And BlockFromToEvent, nearly forgot that for water/lava
I got a question around https://hub.spigotmc.org/javadocs/spigot/org/bukkit/event/block/BlockFromToEvent.html
declaration: package: org.bukkit.event.block, class: BlockFromToEvent
if I cancel this event
will it stop trying to move?>
or will it keep trying to move and call this event frequently?
Probably the latter since water is physics based.
However
The docs say
So maybe it won't.
never heard of that
how does that work?
heuristics basically works by collecting data such as measuring your users clicks. How fast they click in a given period, how long they click and how many times. This data is then used in a way you can compare to see if they are using an auto clicker because the data from an autoclicker would be outside of this range of what is normal
and the best part is the more data your heuristics has, the more accurate it becomes 🙂
oooh tysm
but what about Auto Clicker with random offset?
will it go thru?
That'd just be another set of data.
it can catch such things, basically if you have a decent enough data for your heuristics approach it is almost impossible to use an auto clicker better then a human can do it lmao
Always, no solution is perfect and there will always be exceptions, but if it can detect 99% of people, that's probably as good as it'll get.
great i fixed something and another thing broke xd
ok now the lore dissapered
gg
rewards part just dissapered :
on replaceLore you are only returning 1 string out of that lore
I watched some videos of heuristics
but all of them are Pathfinding solutions
even website mention it as Pathfinding
https://www.tutorialandexample.com/informed-search-heuristic-search
Informed Search/ Heuristic Search in AI with tutorial and examples on HTML, CSS, JavaScript, XHTML, Java, .Net, PHP, C, C++, Python, JSP, Spring, Bootstrap, jQuery, Interview Questions etc.
- or I think its pathfinding
but it worked .. now it dosen't work
but i lose the other values ..
other values don't show
are you using replaceLore on that lore value
theres why, on anywhere you use replaceLore you will only get 1 of the strings out of that string list
it only give the first line of lore
yeah
how i can fix that?
xd
if i only do descirioption
if i use this , it will not work
bcz it will show side by side
i mean the lore
"this is lore " ,"";
?paste that method so its easier to read
the lore one if (questi.isSomething)
ive got it
ok
one problem you'll have is your setting the lore to the description, then settng it to quest lore
over writing the description lore
ill write somethig for you one moment
Hi, so I don't know if this makes sense but my PlayerJoinEvent code gets called from someone leaving? It then starts calling it ALOT like, just calling it infinetely -> (https://sourceb.in/ksQKAcUdb7), it starts spamming the rejoin message from -> (https://sourceb.in/5eNWEuCuCA). The result of this is that in the console you literally cant type "stop" and you just have to end the process manually. (It just spams "'s frozen screen has been re-applied (They left)")... This can happen if they get kicked etc; If you need any more code (Like my main class). Just say!
ok 1 part is fixed , other part is not ..
rewards part fixed , but the old part is broken xd
Add questLore to the description.
And set the lore just once.
List<String> lore = new ArrayList<>();
if (quest.isChallenge()) {
for (String descriptionLine: description) {
lore.add(InventoryDesignConfigKeys.CHALLENGE_GUI_ITEM_LORE.getStringList().replace("challenge-description", ChatColor.GRAY + descriptionLine)
}
lore.add(InventoryDesignConfigKeys.CHALLENGE_GUI_ITEM_LORE.getStringList().replace("challenges-remaning", questUserData.getCurrentValue())
what about quests xd?
there is quests , challenges
change that for the right situation
description.addAll(questLore);
questItem.setLore(description);
i guess this will work , let me try
heuristics is basically collecting data in what is normal
do that after you initialize the questLore
so you would collect stats on, how long players click for, how many times they click in a given time and so forth. You would then use this data as a comparison in detecting an auto-clicker because an auto-clickers data would be outside of what you have that is considered normal
there isn't a specific way to collect heuristics or how to implement it. But the more data points you have the more accurate it is and the more data you collect as well
Couldn't an autoclicker "randomise" the length of time it clicks for, the amount of times it clicks and so on.
machine learning for what?
sure, but the point of using such things is to make an auto-clicker not any more better then what a player can do, thus rendering it almost useless
yeah, thats why to make an anti auto clicker is hard
Anyone know how to change a block that's fallen once its landed?
Tried numerous ways none work
there are so many scenarios and its very hard to not false positive
absolutely, that is why you need a data set to work with, the more data you have the more accurate it becomes 🙂
especially in minecraft where you dont receive the actual clicks but only the results
there is plenty of data points to use, just have to be creative is all
more or less. the CPS and average clicks are very individual and you cant just get a schema out of it
the only stuff where i think of could work are patterns or like the offets the crosshair does while clicking high frequently
while it is individual, the more players you have to compare and collect data from, the better you can get your upper bounds
and the more non-high clicking players you have, the more false positives you will have
and with that, in autoclicking you cant be sure whats legit or not
sure, and this is why you can implement a system for manual checking or something else
so players could just raise your upper bounds up
well there is a physical limit in what humans can do
Hi, so I don't know if this makes sense but my PlayerJoinEvent code gets called from someone leaving? It then starts calling it ALOT like, just calling it infinetely -> (https://sourceb.in/ksQKAcUdb7), it starts spamming the rejoin message from -> (https://sourceb.in/5eNWEuCuCA). The result of this is that in the console you literally cant type "stop" and you just have to end the process manually. (It just spams "'s frozen screen has been re-applied (They left)")... This can happen if they get kicked etc; If you need any more code (Like my main class). Just say!
really depends
saw people click 70+ cps legit
I think you need to track where the block will be landed.
mhmm how
its readding the lore
You can stop the majority if you use enough data points for it, not saying it is easy because it all depends on how creative you can be in determining what is or is not a data point
i mean yeah. you shouldnt only concentrate on the clicks itself, but on the timings between
you can do so much with that
Can't lie there should be another text channel for people discussing things about development
just open up a thread
but once you have a decent enough size of heuristics though it becomes harder and harder for an auto-clicker to hide itself
but on what would you rely that heuristic
because your heuristics is based on human players in what they can and can't do, and while yes you will have edge cases like some players capable of doing more, you won't have that many because most players are not capable of this
on the CPS? timings? averages? patterns?
you would compare everything you could
if the data you are comparing starts going out of bounds then you know they most likely are either using an auto-clicker
for instance, timing is a good way to know
humans can only click so fast as well as the time between their clicks and how many
but then you could compare to what they are doing
are they moving? or are they standing still etc
easier said than done
can you see the pic xd?
.
there can and will be so much going wrong
certainly, but once you get it right though its a powerful tool
as do most things lol
You are adding a string list to a string, that's why.
it isn't useless, most of the best anti-cheat software out there uses heuristics to measure what is known to be impossible as well as what is not typical. You will get some false positives but when that happens its up to whoever to determine what to do in those cases
as I said, not everyone is some pro player
u told me to xd
No, see your code block in quest.isChallenge, you do + description, and description is a string list.
@hybrid spoke I don't know how to explain it any better. Heuristics isn't something to be perfect.
yeah, but in an anti autoclicker, especially in minecraft, thats very risky. also the reason why no anti cheat has further auto clicker checks
you cant really. i get what you mean, also already thought about that, but it isnt as possible as you said
there would be so much things to check for and keep care of
well from what you can do from just the server is limited, ideally you would want to go the route of packet inspection first, and then divert it to some other system if you can't tell from the packets.
yeah, thats more or less what my anti auto clicker is doing for example
but in that case the best i could come up with is to let the plugin do some analytics and suggest the owners a change of the config values
unfortunately in the realms of anti-cheat stuff or the related you can't really do a whole lot in regards to edge cases except either flag them or ignore them as edge cases. The best you could do is instead of relying on a dynamic boundary is to artificially create a hard set one
yeah thats what i have, given to the server owners
and settings to adjust each check
personally I am not against auto-clickers in themselves though, I have combated them but for me it wasn't all that hard because I only cared in where they were used
to use an auto clicker right is also a skill lol
I didn't care if people used an auto-clicker for some farm stuff
you can perma click and be defeated by one-clickers
but if they used it in combat and the related though it was easy to pick up
but its annoying in like bedwars or stuff
when they just godbridge above the whole map
lol
the only other decent systems in regards to this would be to simulate the actions of the players on another server where you can watch it
as in rewind or go forward etc
If I want to place like a schematic/specific prebuilt structure, how would I do that?
so basically a replay system
and then see if what they were doing was even realistically possible
basically
but to connect that with an anti auto clicker can be memory heavy
since that will just save every little flag lol
that wasn't it
the person is a long time member of spigot, just can't remember which it was
as they haven't really talked here in a while
basically it would save all the packets, and then on another server replay those packets
and then you could watch the player or players to see what they were doing and at what time
in this manner you were free to look at everything in any view you wanted
this does the same as it seems
except it uses protocollib
but i imagine that to be cool
imagine you pause the replay and a bunch of stats appear next to every player
with their recent cps
patterns
averages
etc.
this is exactly what that system did
only you didn't need to stop anything, it was just displaying the information you wanted displayed
or that it could
but it was handy though to stop the action
and the only resource intensive thing was just the replay server, saving the packets overall wasn't all that space consuming
it was cool nonetheless, at some point I will check out that plugin but that isn't the one I was referring to but maybe it can become just as cool too? lol
if you can hook into it and inject your own stats that would be cool for my AAC
feel free to ping me once you found it
finally fixed all errors .. 🙂
Bed Wasrs experience and title has 2 quests in it
nice
Other than that 10/10
yes i see
not sure if it exists on spigotmc as a plugin you could download lmao
its configurable from a config file so i can easly delete the second Quest ..
however maybe I could re-create such a system though
Hi, so I don't know if this makes sense but my PlayerJoinEvent code gets called from someone leaving? It then starts calling it ALOT like, just calling it infinetely -> (https://sourceb.in/ksQKAcUdb7), it starts spamming the rejoin message from -> (https://sourceb.in/5eNWEuCuCA). The result of this is that in the console you literally cant type "stop" and you just have to end the process manually. (It just spams "'s frozen screen has been re-applied (They left)")... This can happen if they get kicked etc; If you need any more code (Like my main class). Just say!
All the code is also on my GitHub (pretty much) https://GitHub.com/chopkeys/FreezeGUI-legacy (Check active development branch)
so....
why is it you don't listen for players leaving?
Because I listen for them to join to the re-open a window on them
The issue isn’t them leaving it’s the fact that when they leave for some reason it spam calls the PlayerJoinEvent
because you have a task running in there, but you never listen for them leaving....
thus you never remove them from some lists
Their UUID needs to remain on the only hash map they are needed on so I can check if they should have a window on them
I have (off the top of my head) no other lists
you still need to listen for them leaving or should....
onPlayerQuit(playerquitevent event) {
//do some cleanup
}
Hmmm, ok.
if a player quits with an inventory opened
the server never gets a packet that they closed an iventory
so the logic for your quitevent listener
is to instead count that as also closing the inventory
and clear them out of any lists that are necessary lol
Erm
just remember when the player leaves, player object becomes stale
So the window is opened to stop them from destroying a ghost client etc so it needs to be re-opened when they shut it
So I have a hash map so that I store the UUID with a Boolean attached
That Boolean is whether they should have a window open
alright, well when they leave probably shouldn't be trying to re-open windows on non-existent players lol
Yeah that’s what I think
Use a Set please.
Set<UUID>
Map<UUID, Boolean> --> big no no
?paste
a hash set uses a hash map under the hood
also, you you have to iterate a set as opposed to just a hashmap
also, hashmap is a key value pair, which their above usage of such is valid, and a set doesn't have this assoication
Nah, Set is far superior here because #contains()
There are almost zero situations where you should be using a Map<Object, Boolean>
Unless you want nullable booleans, in which case you need to rethink your design
there wouldnt be a way to distinguish between null and a nullable boolean then
you could use contains if they are in the set, but you would need to iterate to get who is in the set. If I was to recommend on the basis of optimizing, I would go with a player wrapper and have the boolean on the custom player object itself
but really these are all just micro-optimizations at best. What they are doing I am sure they wouldn't really notice a difference
can i register a command at the highest level? so it overrides any other plugins?
helps if you also explain what exactly you are trying to accomplish
if you are needing to override plugins there is other methods to do so that doesn't require registering commands at the highest level
just wondered that event listeners you can set priorities. wondered if commands were same
no they are not, basically its on a first come first serve basis in regards to command registration
so whoever registers it first
but you have other ways though to handle duplicate commands stuff
you can for instance allow aliasing your commands
if you don't care how it will affect other plugins, you could unregister other plugins commands and register your own don't really recommend this lol
another option is to ensure your plugin loads first so you could register the command first
but personally allowing your commands to easily be aliased without resorting to the bukkit alias commands would probably be a far better approach as you could allow it to be customizable
so when i use PlayerInteractEvent, and click at a block, it registers both actions, LEFT_CLICK_BLOCK and LEFT_CLICK_AIR
?interactevent
The PlayerInteractEvent may be called once per hand. If you only want code to be executed once, you can check the result of https://hub.spigotmc.org/javadocs/spigot/org/bukkit/event/player/PlayerInteractEvent.html#getHand(), then decide functionality.
For example, only executing code if the main hand was used:
@EventHandler
public void onPlayerInteract(PlayerInteractEvent event) {
if (event.getHand() != EquipmentSlot.HAND) { // * if the hand used is NOT the main hand:
return; // do not progress past this point |
}
// provide functionality
}
tysm :D
uh, now it doesn't work in adventure mode
@EventHandler
public void playerMouseInput(PlayerInteractEvent event) {
Action action = event.getAction();
Player player = event.getPlayer();
PlayerStats playerStats = PlayerStats.getStats(player);
if (event.getHand() != EquipmentSlot.HAND) {
return;
}
if (playerStats.spellTriggers.spellMode) {
playerStats.spellTriggers.continueNormalSpell(action);
return;
}
if (action.equals(Action.RIGHT_CLICK_BLOCK) || action.equals(Action.RIGHT_CLICK_AIR)) {
playerStats.spellTriggers.enterSpellMode();
}
}
this is my code
== on enum values
whats this PlayerStats.getStats(player);
getting the player stats saved in config
that isn't static?
what?
for each player a SpellTriggers class is created
what should i do here?
does spigot create new CraftPlayer objects everytime certain player joins?
i mean it is safe to make HashMap<Player, Object>()>
?
don't save players to hashmap (good way to cause a memory leak)
player objects are only created once when they join, it gets recreated if they left and then came back
use UUID
in other words, your player object will become stale when they leave
ok thanks
can someone explain why i am not getting the "killed by zombie villager!!!!" message when i am killed by a zombie villager
if thats the death event the killer will only be player iirc
Wdym?
are you using the PlayerDeathEvent
the killer can only be player from what i remember
your still checking if the event killer is something which isnt a player
entitydamagebyentityevent and check if the health is 0
then you can get the cause
and killer
Wouldn’t I have the same issue w checking if a skeletons killed the player?
Or would the projectile trigger the byentityevent aswell