#help-development
1 messages Β· Page 270 of 1
Did that work?
Nice
only thing that makes no sense tho is that if u add it under it for some reason
idk why but it ladders it weirdly,
like let me explain
Scoreboards in MC are in general no fun to work with so yeah, I believe it
lines:
- "&lLine 1: &r%player_name%"
- "&lLine 2: &r%player_health% hearts"
- "&7Line 3: &c%player_name%"
- "&fno"
- "&cBalance: &6%vault_eco_balance_commas%"
Then for some reason its inverse,
So its like balance no line 3 2 1.
is there a way to like change that so its like how it is in the config?
tbh ig it aint the worst
I think it auto orders it, but there should be a way for it to not do that...
Oh.
It will order by the score.
So yeah, it's probably in reverse order of your config.
Since your score is being set to i.
So, I guess you can make your for loop go in reverse, lol.
hm
start at i = lines.size, go until i = 0, decrement each time
tell me if this might work:
for (i < lines.size(); int i = 0; i--) {
I forgot how to remove 1 from the loop...
whats your updated loop look like
for (int i = lines.size() - 1; i >=0; i--) {
Then the rest of the code obviously,
String text = PlaceholderAPI.setPlaceholders(player, lines.get(i));
objective.getScore(ChatColor.translateAlternateColorCodes('&', text)).setScore(i);
thats all thats in the loop is those 2 lines
which part didn't work, does it order the same way as before or something
it still is inverse from how it would be in the config
damn scoreboards suck
yeah im not sure sorry, maybe someone else will know about ordering
wanna know something funny
I got an AI to make this scoreboard plugin for me because i was lazy...
lol
Action bar I think. Also why would you use packets for chat
hi , i am thinking of making a kit system for my plugin
i was thinking of doing a kit per file (json) , and inside each kit file there is
1- kit name
2- items[]
3- permission
my question is , what else i must add to a kit system?
i just need ideas .. if possible
tbh, i would use json too if yaml wasn't pretty much enforced π
better structured overall
yeah because admins love editing file like these
{
"List of Cars" : [
{
"car registration number":"011",
"car name":"Civic",
"owner of car":"Zaim Khan",
"model number":"xyz",
"price":"20 lacs",
"color":"black"
},
{
"car registration number":"012",
"car name":"Mehran",
"owner of car":"Sara Khan",
"model number":"xyzasd21",
"price":"10 lacs",
"color":"white"
},
{
"car registration number":"013",
"car name":"Cultus",
"owner of car":"Taimur Ali",
"model number":"xy12z",
"price":"15 lacs",
"color":"grey"
}
]
}
yaml is so much better for humans
Both of them are loaded as /pl shows that theyβre enabled and that I can execute some of their commands
I do
Have you checked
In your plugin
That it is enabled
All are overrated. Use normal txt files
i store my data in straight raw binary
well when you have no formatting yeah it looks awful
Yep
Sounds abt right
{
"List of Cars":[
{
"car registration number":"011",
"car name":"Civic",
"owner of car":"Zaim Khan",
"model number":"xyz",
"price":"20 lacs",
"color":"black"
},
{
"car registration number":"012",
"car name":"Mehran",
"owner of car":"Sara Khan",
"model number":"xyzasd21",
"price":"10 lacs",
"color":"white"
},
{
"car registration number":"013",
"car name":"Cultus",
"owner of car":"Taimur Ali",
"model number":"xy12z",
"price":"15 lacs",
"color":"grey"
}
]
}
but this is very easy to understand, also won't get a mind fucking error cause I have an extra space somewhere or somehow a wierd invisible character next to spaces so it would throw errors π
Is there a way to retexture an arrow to a shulker bullet using a resource pack and/or a plugin?
what? the api integration?
Oh and cooldown
Cooldown if any, is it single use
I mean its just a superset of json, like you can use = instead of :, not that different tbr
Just run like getServer#getPluginManager#getPlugin and then #isEnabled or smth similar
imagine calling getServer() instead of calling everything on the Bukkit class
couldnt be me
For yaml just depends on what you use to parse
ClientboundPlayerInfoPacket doesn't exist anymore in 1.19.3...
Does anyone know what the replacement is?
Player info exists in 1.19.3 as per that link
So not sure what makes you think it stopped existing
PlayerInfo still exists, the class doesn't though
still total shit to edit
you miss one quote and everyone dies
or a comma
also the weird difference between [ and {
don't tell me that admins know the difference between { and [
because they don't
Same with yaml
no, yaml doesn't need quotes in 99% of cases
It's still very funky with syntax though. Yaml Syntax errors are very common
use an editor that shows you errors
that is true, but json is a hundred times worse
what channel does bungeecord use to answer requests?
what requests?
the channel is called "BungeeCord"
not sure if this is the right place to ask, but how do i broadcast messages from minecraft to discord? i've already got a bot set up and i've been looking for ways to execute it. what i want is not just plain messages (could've done that a long time ago easily), but creating fake user profiles for discord (see attachments). i've taken a look at this (https://github.com/VampireChicken12/Minecraft-Discord-Chat-Bridge) code and apparently it's done with webhooks, but i do not know typescript so i could barely read the code, so if anyone has any tips i'd greatly appreciate it
thanks
isnt typescript js with types?
i really do not know, javascript is not my field of expertise either haha
yet youre using it
no i am not?..
kinda, yes
isnt index.ts a typescript file?
ah whatever
this is just an example of what i want to do but i do not know where to start
and with a plugin
it has come to my attention that it's done with webhooks
what exactly is your question though lol
which i'll probably have to study for this
how do i broadcast messages from minecraft to discord
and then i elaborate
just spin up JDA
i already have it
then listen to the PlayerChatEvent and send a message into discord?
what i want is not just plain messages (could've done that a long time ago easily), but creating fake user profiles for discord (see attachments)
have you read this? https://github.com/DV8FromTheWorld/JDA/wiki/9)-Webhooks
Java wrapper for the popular chat & VOIP service: Discord https://discord.com - 9) Webhooks Β· DV8FromTheWorld/JDA Wiki
-edited-
not yet, i was going to study webhooks, but i was just asking if you got any tips for this
670 forks lol
this channel here only fits if you wanna fix it yourself
They donβt .-.
time to decomp the plugin and fix the bugs yourself π
will probably take another couple months
Just a spigotmc automated dm and him saying use nuvotifier
seems like a jerk move
plugin is enabled as i don't have any error messages (i should have sent a message if !getServer.getPluginManager.getPlugin("GemsEconomy).isEnabled)
I love IJ's spring boot project wizard
Then try to wait a few seconds after your plugin loaded to hook into the api
Bukkit.getPluginManager().isPluginEnabled(String) is a thing
i'm hooking into the API when executing a command that I execute sometimes 5 minutes after the server turned on
I hate GUIs so extremely much
also why is there no combobox
oh I found it
what a weird sorting syste
now I hate GUIs even more
jetbrains doesn't know how their own IDE works
ugh and there is literally no up-to-date docs for the GUI designer to be found ANYWHERE, so I now have to watch a huge ass youtube where someone with a bad indian accent explains how to click a button
ahaha
for real, intellij gets worse with every update
changing Enum#toString() to int? Please tell me how you would perform such magic, IJ
ah yes, thanks for this working quick fix. It helped me so much. IJ totally worth 599β¬
public int getMajor() {
return Integer.valueOf(name().substring(2).toLowerCase());
}```
oh there's another bad joke in IntelliJ
doesn't matter which wizard you use, you can always easily change the maven group id
unless you want to create a normal maven project
then it's hidden under "Advanced Settings" that you have to open manually first
great job, whoever thought of this, deserves to hit their toe somewhere
quick question, how can i use color codes in logging?
don't, it's annoying
On spigot you should be able to just throw them at the logger
well it strips the colors
use Bukkit.getConsoleSender()
according to craftbukkit source code it also strips color
also it doesn't support other levels
can i use ANSI?
that's great
that way plugin developers cannot spam your console with useless colors, and everything stays clean and tidy
the console should only have 3 colors
normal one for info, yellow for warn, and red for error
well i think colors make it look better, besides the fact it should be only 3 colors
is there a way to modify the world render with spigot api? im trying to create a plugin that adds custom blocks to the world but struggling to find a solution
what is it supposed to make better-looking?
colours in the log only looks "better" whilst in console. 99% of logs are read as files and then colours spam the crap out of them making them very unreadable
no
?jd-s
just making it colored in console and nothing in logs, without any & or stuff
noone, in the history of anything, ever looked at their console and then said "Oh, I am so glad that this plugin printed 20 lines of ascii art in fancy colors when it was enabled. How could I ever live without this again"
You can;t make it coloured only in console
idk bro lots of plugins do colors which is what makes console less boring to look at
how do some plugins do it then Β―_(γ)_/Β―
imagine being bored so you look at your console and then you are not bored anymore because you saw some colors
wtf
oh yeah
by using NMS
i managed to do it on a project tho, it should be implemented
technically you can, but will require some voodoo magic and hooking into the jansi stuff
papermc does this perfectly, messages are colored in console and not in logs
although I fucking hate the idea of having colors in console, because it's useless and stupid, please send an example of a plugin that can do it on spigot, then we can easily see how they do it
well... no plugin seem to do it on spigot without crappy logs
I have no issue with a coloured console, only in the logs.
ah ok, great. that will maybe stop some people from using colors in the first place
wrong reply
why the heck is it not possible to remove the "reply" from a message
hm, maybe ill not care about colors its not a big deal
well, you can technically already do it with plugins for spigot, it just requires more from the developer in order to do it
how can I use kyori components as Item displayName in spigot?
have to edit the message with the reply, hit the x button that appears above the chat box to make reply disappear
even tho I have annotations; it still returns the default variable
test
doesn't work for me
it only works for the latest message
it should work
ESC will do the job
do your annotations have
@Retention(RetentionPolicy.RUNTIME)
hmmm, could have sworn it being possible to remove replies from your messages
oh damn
forgot about that
thx
wonder if it was a feature and then they removed it
it is, but only for the latest message or sth
wait
now I cannot even remove it from the latest msg
huh
I swear I was able to remove it from latest message like 2 minutes ago lmao wtf
yeah discord being weird, think they might have accidentally removed that feature
anyone know if/how it's possible
load all player data manually
how do i send potion effect packets per player?
@Override
public String onRequest(OfflinePlayer player, String params) {
if (params.equals("hearts")) {
return String.valueOf(HealthHelper.getHeartsShort(player));
} else if (params.equals("isdeathbanned")) {
return DeathbanHelper.checkDeathbanShort(player) ? "true" : "false";
} else if (params.equals("deathbans")) {
return String.valueOf(DeathbanHelper.getDeathbanAmount(player));
}
return null;
}
the placeholders return NOTHING
they dont return null, they dont return a value
they return nothing at all
with no errors
also makes me time out
https://paste.md-5.net/wadizuzugi.java <-- full class
and there is no way of reading other world inventory files?
each world itself can have its own inventory file, which is only used if its the default world
there are, when you have multiple worlds, those are other world files
which is only used if its the default world
ik, and im trying to see if I can access them in anyway
n o p e
ALL worlds use ONE inventory. There is no per world inventory system in Spigot
not get told that other world files dont have inventory data stored
if you want players to have multiple inventories for diff worlds just use a per world inventory plugin or use a database to store inventories in your plugin
okay, a no is more helpful that invalidating the question
thank you
im working on my own, which is why I came with the question
and I wanted to see if I could read the inventory for the world they join and save it to allow it to have the data of other inventories
from the player, or stopping particles?
from a player
.
let's say the player is invisible using an invisibility potion, i want another player to be able to see the said player as without
is anyone aware why gradle demands a dependency even tho an other dependency provides it (its shaded inside)?
or not the dependency itself, but rather it's repo
thats the line of code:
player.setDisplayName(ChatColor.translateAlternateColorCodes('&',"&8[&4Hunter&8] "+player.getName()+"&f"));
why does it say hunter hunter???
fixed it!
Is there a way to determine the protocol version of a backend server that a player is on? I'm aware of the getPendingConnection, but that returns the clients version I believe(correct me if i'm wrong)
anyone got any clue about Velocity? I have no clue on how to use the conditionals in an assignment properly.
Also I need to to remove everything after the second dot from a string, e.g. 1.19.2 -> 1.19
but no clue how D:
from what I know, I can just write java methods that I can use in velocity, but - erm - where do I put them lmao
I'm writing a maven archetype btw
how to make players transparent per player?
or how to remove the invisibility potion per player
you gotta send packets I guess
these fucking docs only say "the java code" but they nowhere explain WHERE this "java code" is supposed to be located or anything
BuildTools 1.8 is broken?
Exception in thread "main" java.io.IOException: Server returned HTTP response code: 403 for URL: https://s3.amazonaws.com/Minecraft.Download/versions/1.8/minecraft_server.1.8.jar
isnt 1.8 down?
Update BuildTools
no, works fine. although it would be nice if 1.8 would be down, it's ancient
also don't use 1.8.... at least use 1.8.8 π
and with "1.8.8", Olivo means "1.19.3"
True
i send a packet but i don't think it's all i gotta do, i guess i have to trace back from craftbukkit
which packet did you send
works, thanks
why not simulate the effects instead?
in this manner you would be free to use the api to make players visible or invisible of your choosing
but if you really want to do it via packets you need to utilize the metadata packet
Override onPlaceholderRequest, they're different methods
do you happen to know how to copy the datawatcher?
i don't wanna modify the player's one
Nms or protocollib?
that should give you some clues/ideas in how to do it
[23:17:38 INFO]: [TownyWebhooks] Enabling TownyWebhooks v0.0.1
[23:17:38 WARN]: [TownyWebhooks] The plugin is deactivated because you left the webhook-url blank in the config file...
[23:17:38 INFO]: [TownyWebhooks] Disabling TownyWebhooks v0.0.1
[23:17:38 ERROR]: Error occurred while enabling TownyWebhooks v0.0.1 (Is it up to date?)
java.lang.IllegalStateException: zip file closed
at java.util.zip.ZipFile.ensureOpen(ZipFile.java:831) ~[?:?]
at java.util.zip.ZipFile.getEntry(ZipFile.java:330) ~[?:?]
at java.util.jar.JarFile.getEntry(JarFile.java:518) ~[?:?]
at java.util.jar.JarFile.getJarEntry(JarFile.java:473) ~[?:?]
at org.bukkit.plugin.java.PluginClassLoader.findClass(PluginClassLoader.java:167) ~[patched_1.16.5.jar:git-Paper-794]
at java.lang.ClassLoader.loadClass(ClassLoader.java:587) ~[?:?]
at org.bukkit.plugin.java.PluginClassLoader.loadClass0(PluginClassLoader.java:119) ~[patched_1.16.5.jar:git-Paper-794]
at org.bukkit.plugin.java.PluginClassLoader.loadClass(PluginClassLoader.java:114) ~[patched_1.16.5.jar:git-Paper-794]
at java.lang.ClassLoader.loadClass(ClassLoader.java:520) ~[?:?]
at com.tr.denizusta.townywebhooks.Main.onEnable(Main.java:50) ~[?:?]
at org.bukkit.plugin.java.JavaPlugin.setEnabled(JavaPlugin.java:263) ~[patched_1.16.5.jar:git-Paper-794]
at org.bukkit.plugin.java.JavaPluginLoader.enablePlugin(JavaPluginLoader.java:370) ~[patched_1.16.5.jar:git-Paper-794]
at org.bukkit.plugin.SimplePluginManager.enablePlugin(SimplePluginManager.java:500) ~[patched_1.16.5.jar:git-Paper-794]
at org.bukkit.craftbukkit.v1_16_R3.CraftServer.enablePlugin(CraftServer.java:518) ~[patched_1.16.5.jar:git-Paper-794]
at org.bukkit.craftbukkit.v1_16_R3.CraftServer.enablePlugins(CraftServer.java:432) ~[patched_1.16.5.jar:git-Paper-794]
at net.minecraft.server.v1_16_R3.MinecraftServer.loadWorld(MinecraftServer.java:599) ~[patched_1.16.5.jar:git-Paper-794]
at net.minecraft.server.v1_16_R3.DedicatedServer.init(DedicatedServer.java:298) ~[patched_1.16.5.jar:git-Paper-794]
at net.minecraft.server.v1_16_R3.MinecraftServer.w(MinecraftServer.java:1074) ~[patched_1.16.5.jar:git-Paper-794]
at net.minecraft.server.v1_16_R3.MinecraftServer.lambda$a$0(MinecraftServer.java:291) ~[patched_1.16.5.jar:git-Paper-794]
at java.lang.Thread.run(Thread.java:833) [?:?]
Hello π,
How can i fix zip file closed error there is my code:
https://github.com/FoudreStudios/TownyWebhooks/blob/main/src/main/java/com/tr/denizusta/townywebhooks/Main.java
If webhhok-url is empty, its disabling it self and giving this error in embed
1.19.3 doesn't seem to have the PacketPlayOutPlayerInfo anymore, what is being used instead?
?switchmapping
?switchmappings
did you properly restart your server?
Are you integrating JDA into spigot plugin?
i tried CTRL + C and > stop
what are you trying
see what I replied to
1 min
oh god, another life steal plugin? aren't there already like 1928 existing ones?
I never understood the idea behind it anyway, I mean - doesn't it make strong players even stronger, and weak players even weaker?
well I am going to add custom items and stuff to it to make it more exciting
and better than the "usual" lifesteal experience
also I am working on a unique gamemode which will require a lot of time and dedication but I think I can do it
note: I have never played lifesteal
me neither, but it always sounded like the shittiest idea ever lol
well people like it
according to the github wiki
I am correct
and you are wrong
however in reality it is the inverse
wdym
what exactly is the issue
public String onRequest(OfflinePlayer offlinePlayer, String identifier) {
if (offlinePlayer == null) {
return "";
} else if (!offlinePlayer.isOnline()) {
return "";
} else {
Player player = offlinePlayer.getPlayer();
switch (identifier.toLowerCase()) {
case "hearts":
return String.valueOf(HealthHelper.getHeartsShort(player));
case "isdeathbanned":
return DeathbanHelper.checkDeathbanShort(player) ? "true" : "false";
case "deathbans":
return String.valueOf(DeathbanHelper.getDeathbanAmount(player));
}
}
}
here you go
please use java code blocks
didnt tried
np
the placeholders return NOTHING (quite literally) and timeout me from the server
bump?
@misty ingot
and yes I am a valid player than you for asking
they also dont give me an answer
you're probably running IO / database stuff in the main thread
yes, placeholders may be run on the main thread
where's your code?
you'll have to scroll up a bit
I did, couldnt find it
Are you talking to me or wonky?
here
wonky
oh okay
ima try that
all my database code is async
I cba regarding your issue
doubt
print out the value of "params", what does it show?
also is the identifier correct?
just use this @misty ingot
bump
@torn basalt thanks, it works
what's line 50 in your "Main" class?
a temporary end to my torment
plugin = Bukkit.getPluginManager().getPlugin("TownyWebhooks");
wait i take look
yes its
You're welcome, man, anytime. :)
public static Integer getDeathbanAmount(OfflinePlayer target) {
CompletableFuture<Integer> amount = new CompletableFuture<>();
Bukkit.getScheduler().runTaskAsynchronously(plugin, () -> {
try {
PreparedStatement statement = null;
// get deathban amount
statement = plugin.getConnection()
.prepareStatement("SELECT COUNT(*) AS AMOUNT FROM deathban_history WHERE UUID = ?");
statement.setString(1, target.getUniqueId().toString());
ResultSet resultSet = statement.executeQuery();
if (resultSet.next()) {
amount.complete(resultSet.getInt("AMOUNT"));
}
} catch (SQLException e) {
e.printStackTrace();
}
});
return amount.join();
}
this method is still causing my server to crash
(called when placeholder used)
@misty ingot return a completeablefuture instead of an Integer
ok
bump again
let me try
No @rotund ravine
[19:46:49 INFO]: [TownyWebhooks] Enabling TownyWebhooks v0.0.1
[19:46:49 ERROR]: [TownyWebhooks] The plugin is deactivated because you left the webhook-url blank in the config file...
[19:46:49 INFO]: [TownyWebhooks] Disabling TownyWebhooks v0.0.1
[19:46:49 ERROR]: Error occurred while enabling TownyWebhooks v0.0.1 (Is it up to date?)
java.lang.IllegalStateException: zip file closed
at java.util.zip.ZipFile.ensureOpen(ZipFile.java:831) ~[?:?]
at java.util.zip.ZipFile.getEntry(ZipFile.java:330) ~[?:?]
at java.util.jar.JarFile.getEntry(JarFile.java:518) ~[?:?]
at java.util.jar.JarFile.getJarEntry(JarFile.java:473) ~[?:?]
at org.bukkit.plugin.java.PluginClassLoader.findClass(PluginClassLoader.java:167) ~[patched_1.16.5.jar:git-Paper-794]
at java.lang.ClassLoader.loadClass(ClassLoader.java:587) ~[?:?]
at org.bukkit.plugin.java.PluginClassLoader.loadClass0(PluginClassLoader.java:119) ~[patched_1.16.5.jar:git-Paper-794]
at org.bukkit.plugin.java.PluginClassLoader.loadClass(PluginClassLoader.java:114) ~[patched_1.16.5.jar:git-Paper-794]
at java.lang.ClassLoader.loadClass(ClassLoader.java:520) ~[?:?]
at com.tr.denizusta.townywebhooks.Main.onEnable(Main.java:102) ~[?:?]
at org.bukkit.plugin.java.JavaPlugin.setEnabled(JavaPlugin.java:263) ~[patched_1.16.5.jar:git-Paper-794]
at org.bukkit.plugin.java.JavaPluginLoader.enablePlugin(JavaPluginLoader.java:370) ~[patched_1.16.5.jar:git-Paper-794]
at org.bukkit.plugin.SimplePluginManager.enablePlugin(SimplePluginManager.java:500) ~[patched_1.16.5.jar:git-Paper-794]
at org.bukkit.craftbukkit.v1_16_R3.CraftServer.enablePlugin(CraftServer.java:518) ~[patched_1.16.5.jar:git-Paper-794]
at org.bukkit.craftbukkit.v1_16_R3.CraftServer.enablePlugins(CraftServer.java:432) ~[patched_1.16.5.jar:git-Paper-794]
at net.minecraft.server.v1_16_R3.MinecraftServer.loadWorld(MinecraftServer.java:599) ~[patched_1.16.5.jar:git-Paper-794]
at net.minecraft.server.v1_16_R3.DedicatedServer.init(DedicatedServer.java:298) ~[patched_1.16.5.jar:git-Paper-794]
at net.minecraft.server.v1_16_R3.MinecraftServer.w(MinecraftServer.java:1074) ~[patched_1.16.5.jar:git-Paper-794]
at net.minecraft.server.v1_16_R3.MinecraftServer.lambda$a$0(MinecraftServer.java:291) ~[patched_1.16.5.jar:git-Paper-794]
at java.lang.Thread.run(Thread.java:833) [?:?]
Have you tried adding a webhook url to it and see if you still get the error
My target is to prevent an error when webhook-url is left empty.
yo @echo basalt nerd
you got some ideas for my plugin
the idea behind it is like a proc gen cloud island plugin
so far i have implemented raining
was wondering about structures on top?
whats the best way to go about setting like 300-1000+ blocks without causing lag
Why are you getting your own plugin
Instead of using thjs
This
Question, is it safe to store a LivingEntity in an array to fetch it afterwards? Or should I use the UUID and bukkit to fetch by the ID again?
There is no TownyAdvanced addon for this because
I mean the Bukkit.getPlugin....
oh
Then using that to disable your own plugin not this
split it over many ticks, 7Smile7 had a guide
is it on spigot or smthn?
yeah
Bukkit.getPluginManager().disablePlugin(this);
Yes
[20:04:09 INFO]: [TownyWebhooks] Enabling TownyWebhooks v0.0.1
[20:04:09 ERROR]: [TownyWebhooks] The plugin is deactivated because you left the webhook-url blank in the config file...
[20:04:09 INFO]: [TownyWebhooks] Disabling TownyWebhooks v0.0.1
[20:04:09 ERROR]: Error occurred while enabling TownyWebhooks v0.0.1 (Is it up to date?)
java.lang.IllegalStateException: zip file closed
at java.util.zip.ZipFile.ensureOpen(ZipFile.java:831) ~[?:?]
at java.util.zip.ZipFile.getEntry(ZipFile.java:330) ~[?:?]
at java.util.jar.JarFile.getEntry(JarFile.java:518) ~[?:?]
at java.util.jar.JarFile.getJarEntry(JarFile.java:473) ~[?:?]
at org.bukkit.plugin.java.PluginClassLoader.findClass(PluginClassLoader.java:167) ~[patched_1.16.5.jar:git-Paper-794]
at java.lang.ClassLoader.loadClass(ClassLoader.java:587) ~[?:?]
at org.bukkit.plugin.java.PluginClassLoader.loadClass0(PluginClassLoader.java:119) ~[patched_1.16.5.jar:git-Paper-794]
at org.bukkit.plugin.java.PluginClassLoader.loadClass(PluginClassLoader.java:114) ~[patched_1.16.5.jar:git-Paper-794]
at java.lang.ClassLoader.loadClass(ClassLoader.java:520) ~[?:?]
at com.tr.denizusta.townywebhooks.Main.onEnable(Main.java:102) ~[?:?]
at org.bukkit.plugin.java.JavaPlugin.setEnabled(JavaPlugin.java:263) ~[patched_1.16.5.jar:git-Paper-794]
at org.bukkit.plugin.java.JavaPluginLoader.enablePlugin(JavaPluginLoader.java:370) ~[patched_1.16.5.jar:git-Paper-794]
at org.bukkit.plugin.SimplePluginManager.enablePlugin(SimplePluginManager.java:500) ~[patched_1.16.5.jar:git-Paper-794]
at org.bukkit.craftbukkit.v1_16_R3.CraftServer.enablePlugin(CraftServer.java:518) ~[patched_1.16.5.jar:git-Paper-794]
at org.bukkit.craftbukkit.v1_16_R3.CraftServer.enablePlugins(CraftServer.java:432) ~[patched_1.16.5.jar:git-Paper-794]
at net.minecraft.server.v1_16_R3.MinecraftServer.loadWorld(MinecraftServer.java:599) ~[patched_1.16.5.jar:git-Paper-794]
at net.minecraft.server.v1_16_R3.DedicatedServer.init(DedicatedServer.java:298) ~[patched_1.16.5.jar:git-Paper-794]
at net.minecraft.server.v1_16_R3.MinecraftServer.w(MinecraftServer.java:1074) ~[patched_1.16.5.jar:git-Paper-794]
at net.minecraft.server.v1_16_R3.MinecraftServer.lambda$a$0(MinecraftServer.java:291) ~[patched_1.16.5.jar:git-Paper-794]
at java.lang.Thread.run(Thread.java:833) [?:?]
same error
Any way to hide commands?
Example: A player in chat types "/vi" and something called "/viewinv" pops up
How would I prevent that?
-Hi, here I can request a dev?
?services
If you wish to request or offer development/art/building/administration services, please do so at https://www.spigotmc.org/forums/services-recruitment-v2.54/
I gave you the event the other day
ty
how I can post here
you did?
sorry i must have gotten sidetracked
Idk how that happened when they replied the same minute
if i just do null its work?
if (getConfig().getString("webhook-url").equals("") || getConfig().getString("webhook-url").equals(null)) {
getLogger().severe("The plugin is deactivated because you left the webhook-url blank in the config file...");
Bukkit.getPluginManager().disablePlugin(this);
}
```to```
if (getConfig().getString("webhook-url") == null) {
getLogger().severe("The plugin is deactivated because you left the webhook-url blank in the config file...");
Bukkit.getPluginManager().disablePlugin(this);
}
ty
Hey, everytime a player dies in the server, it seems like they stay "alive" for an extra second and I believe it's because on the PlayerDeathEvent on my plugin I have a code to send a discord webhook message on a channel to inform that the player died(since its a webhook it takes some time).
Is there a way to make some code on player death but not influenciate the ingame death itself("lag" the death from happening)? I want to reduce this lag, not that it matters much since the players die anyways, but it's kinda annoying and in the long run want to fix it.
Is there anyway to prevent another plug-in from messing with the entities of my own plug-in?
make webhook do stuff async
run the discord webhook async.
I fixed it by sending the message when the player respawns instead. when dying it stores their death message and then sends when respawning.
what do u mean by "do stuff async"?
bruh what
make it run off the main thread
?scheduling
bruh Double[]::new works but not with primitives
Does someone know why I'm getting this error from the buildtools? https://pastebin.com/VPQV6CX9
Pastebin.com is the number one paste tool since 2002. Pastebin is a website where you can store text online for a set period of time.
\π
Double[]::new 
ok multiple arguments finally seem to work
it ignores others but i should probably fix that
the code is horrible tho
where is operator overloading in java
I feel so stupid right now why tf am I gett a null return from Material#getMaterial here?
final Material material = Material.getMaterial(section.getString("material"));
if (material == null) {
throw new IllegalArgumentException(
"Invalid material for background item: " + section.getString("material"));
}
it throws the exception java.lang.IllegalArgumentException: Invalid material for background item: GRAY_STAINED_GLASS_PANE last time I checked GRAY_STAINED_GLASS_PANE is still an item lol
isnt it Material#matchMaterial?
getMaterial does the same thing???
I'm honestly dead confused
so it is match? I wonder why getMaterial worked on my last project
magic prob
it wont work now
frick
in what version are you try this?
exists the enum for this?
I'm on 1.17.1 (comission please don't kill me)
or if the string has spaces or any
so it should definitly exists
I seriously just typed it out
again for the 3000th time so I am still like confused
im trying to change the enum value to something else now
okay what the fuck
only for test try using this directly with the enum.. like Material.GRAY_STAINED_GLASS_PANE.name() and pass this to the method
or... get the material for item in hand and test
yeah musta been an invisible character
wait there is def an invisible character no way
then you need validate this... clear invalid characters
I always wonder when people talk about that, how do they get into the code to begin with?
probably was copilot in this case
I just deleted the line and retyped it and it worked again
Proof the bot copy pastes
I am listening to AsyncPlayerChatEvent and want to get the exact text that is sent in chat (line 3 in image). My current code looks like this:
@EventHandler
fun onAsyncPlayerChat(event: AsyncPlayerChatEvent) {
val player = event.player
player.sendMessage(event.format) // Line 1 in image
player.sendMessage(event.message) // Line 2 in image
}
Neither the format nor the message returns what I want it to return, which is &r<&4Doorkeeper&r> t. Does anyone know how I could obtain this?
Does someone know why I'm getting this Buildtools error?
https://pastebin.com/gc0aLrCA
Pastebin.com is the number one paste tool since 2002. Pastebin is a website where you can store text online for a set period of time.
mutate the format respectively the message
event.format = ...
event.message = ...
I don't want to change the message, I want to get the formatted message
ah
I need the contents of the entire message, so player name, prefix and all + the color codes in it
String.format(format,player.name,message) iirc should give u that
That won't give me the color codes tho
if the format includes it
How do i check if a block was exploded by something like a a Creeper, or Tnt?
Im trying to deny all damage and movement sources in a specific location. (Block Location)
Im using : To handle hands, Pistons
@EventHandler(priority = EventPriority.HIGHEST)
public void on(BlockBreakEvent e) {
if (activeBlocks.contains(e.getBlock())) {
e.setCancelled(true);
}
}
//prevent piston from moving blocks // Dupe fix
@EventHandler(priority = EventPriority.HIGHEST)
public void on(BlockPistonExtendEvent e) {
if (e.isCancelled()) {
return;
}
e.getBlocks().forEach(b -> {
if (activeBlocks.contains(b)) {
Adapt.verbose("Cancelled Piston Extend on Adaptation Foundation Block");
e.setCancelled(true);
}
});
}
//prevent piston from pulling blocks // Dupe fix
@EventHandler(priority = EventPriority.HIGHEST)
public void on(BlockPistonRetractEvent e) {
if (e.isCancelled()) {
return;
}
e.getBlocks().forEach(b -> {
if (activeBlocks.contains(b)) {
Adapt.verbose("Cancelled Piston Retract on Adaptation Foundation Block");
e.setCancelled(true);
}
});
}
Bit in the event that TNT blows up, what do i Check for? as BlockExplodeEvent is not it
but else assuming you use essentials, then it might be better to listen to their chat event
Dont tell me i need to like do a raycast or generate a sphere around tnt
because thats annoying
I am using essentials, but I want it to work with any chat plugin. DeluxeChat is another one for example.
yes, but with dchat u'd just have to listen to their event if you wanna support it properly
EntityExplodeEvent
BlockExplodeEvent is for when a block explodes such as a bed in the nether. TNT becomes an entity before exploding
Yeah
lemmecheck, and thank you
Can anyone help me make an event that checks if an item is in the players inventory?
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!
Is this the wrong channel?
no dude we aren't gonna spoon feed you code
go figure it out yourself and ask more specific questions
dude just ask
what do u have right now?
I don't really want to have to support different plugins. I just want it to work on its own without any dependencies
thats problematic
because AsyncPlayerChatEvent for instance does not give a fuck about prefixes, suffixes and so on sadly
Is there any other event I can listen to that does?
well, paper has some events, but idk if its easier there, and that would remove spigot support also, otherwise no, I believe you have to do it case by case which... yes is a bit annoying
one way would be to hook into vault
and use its chat, eco and perm api to determine certain data that is added by external plugins
namely prefixes, suffixes and ranks
tho should be mentioned vault does not provide an event afaik
I guess that is a way to get a player's prefix and such, but sadly won't provide the exact formatted message. I'll have a look at what paper has to offer tho.
@tranquil dome It should be in the format. AsyncPlayerChatEvent #format
is there a way to prevent a BlockCookEvent from producing an item without cancelling the event? setting result to null doesn't work since the parameter has the NotNull annotation and causes an assertionerror
Format does not include color codes, at least not on spigot.
why you dont want to cancel event ?
i need to replace the drop of a campfire cook but since the event lacks details on the recipe actually being cooked i have to determine this manually, and there are also no details on which campfire "slot" is currently being used so i have to use a delayed task to compare before and after
if i cancel the event i cant compare a before and after
Why does it not?
It returns <%1$s> %2$s
That's how the message is formatted without colors
Does your chat plugin not change it?
Or is your chatplugin canceling it and sending their own messages.
In this case I would want something like &r<&4%1$s&r> %2$s. &r being white and &4 being red
Is your chatplugin not setting it?
I am just trying to get the message. My plugin is not setting or doing anything with the chat
This is what my event looks like
im guessing its a mojang issue
Essnetials set it @tranquil dome as long as you change it https://github.com/EssentialsX/Essentials/blob/2.x/EssentialsChat/src/main/java/com/earth2me/essentials/chat/processing/AbstractChatHandler.java
they probably just didnt consider it much since a block cook event is usually just needed for furnaces but then they added basically a quadrafurnace
I don't want to change it though, just get the message including the colors in that message
Someone know how to use BoostedYAML?
ah figured out how to do the campfire stuff, you can determine which slot has been cooked by looking at the CampFire's cook times and total cook times
They have a support Discord if you need help
You are just using it wrong, and also expecting chatcolors to show in chat without changing em
Ignore the top part. I just used the plugin I had open. https://puu.sh/JuKLi/360ab6e1c3.png
The problem, my format does not include anything like 'Β§' to replace with '&' in the first place.
player.sendMessage(event.format.replace('Β§', '&'))
It's what is displayed in that image
He wants to do the opposite
@tranquil dome Not entirely sure what is happening on your end. Seems weird.
What does you config in essentialschat say
This outputs the message in color also
player.sendMessage(String.format(event.format, player.displayName, event.message))
@tranquil dome
Do you even have essentialschat
Ignore zaken
He hasn't read the whole issue.
ess chat is built in
It is not
maven
Do you have essentials chat @tranquil dome ?
If not htat is why you format does not change
I do not have ess chat, just EssentialsX
the color is simply essentials setting the display name to &4name&r
Then the format will just be standard
That makes sense
The color is coming form the displayname
So how would I then de-translate the displayname?
That changes the display name right?
yes
that's fine tho, as that is what eventually will be displayed in chat too
actually, not guaranteed
either way, do you know how I can de-translate it?
this.player.displayName.replace(ChatColor.COLOR_CHAR + "","&")
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!
like im having issues with them
im not
i just have a issue with a plugin
alr
thanks
Works, thank u
Now another question. I want to not only listen to player chat messages, but also listen to messages that are broadcasted to players by other plugins (or the server itself). An example of this is essentials sending a message &a&l[+] &fDoorkeeper &7joined or a player getting an achievement. What event should I use to listen to these, because BroadcastMessageEvent does not seem to be fired.
Well, join was used as an example. There's also plugins that broadcast messages themselves. For example: Player just sold something on the auction house for $100
pluginManager.getPlugin().getConfig().getStringList("Warlock players").clear();
isnt that supposed to clear the Warlock players list from the config.yml file??
k thx
will do
ok i will save it
thx
pluginManager.getPlugin().saveConfig();
i wrote this and it still doesnt work
still sgows my name there
wdym change the path?
ok but if i want to remove the player that runs a command then i dont want to clear the path
ok will try and if i need help ill ask
pluginManager.getPlugin().getConfig().getStringList("Warlock players").remove(player.getName());
pluginManager.getPlugin().saveConfig();
but sholdnt that work?
i'm reading a text file and sending its contents to the player. if there's a line break, a CR symbol is inserted (i assume because of CRLF?) how can I get rid of it?
File motdFile = new File(plg.getDataFolder(), "info.txt");
String motd = Files.readString(Paths.get(motdFile.getAbsolutePath()));
String toSend = ChatColorFormatter.FormatToChatColors(motd);
e.getPlayer().sendMessage(toSend);
this is what i'm working with right now
Instead, split the string into two and send two separate messages
i'll try that, thanks
np
It's to get the format in a way he is used to see it.
Im getting this error
And i don't know how to fix it in line 7 of the main class LXAntiBild is public final class LXAntiBuild extends JavaPlugin {
Too old! (Click the link to get the exact time)
Guide to dependency injection: https://www.spigotmc.org/wiki/using-dependency-injection/
Guide to dependency injection: https://www.spigotmc.org/wiki/using-dependency-injection/
Me gusta singleton pattern (I like , don't kill me optic)
It's actually no me guata π€
my code https://pastebin.com/cLNTYZ2F is supose to set blocks from a certain distance from a center location, but its only setting 1 block, my config https://pastebin.com/C3fmsDef
ok
md5 looks hotter \π
true
but the best is still mine
Visit this link to see the note. Giving the URL to anyone allows them to access the note, too.
ours is haste bin
it has @onyx fjord's turtle in mine
you look weird
What the best option for calling player off hand? So they cant use it
MY HAIR IS DYED
but soon it's gonna be pink or green
dye it again
Im opened for suggestions, i realize i can use the next events PlayerSwapHandItemsEvent, InventoryClickEvent, InventoryInteractEvent or InventoryDragEvent
Which would be the best option for cancelling the off hand usage? (Second one which appeared on 1.9+)
?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
}
Why? Did you had had issues?
oh okay, that why it wasnt being called π€¦ββοΈ
use InventoryClickEvent :P
Im 100% idiot that i didnt CTRL + click over the class to see the decompile
But there i cannot get the off hand?
bruh
idk what your on about InventoryClickEvent is anything related to the invfentory
bump
you can do anything with it its the most powerful inventory even thats called afaik
why not
if (event.getHand() != EquipmentSlot.HAND) return;
How do i make a mob always walk towards the nearest LivingEntity?
he probably is wanting to see when its clicked in the inventory i'd assume
i mean what the bot is saying
I need to disable any posibility of "off hand/second hand usage", that why im opened to suggestion
InventoryClickEvent is the way to go :) just use logger to figure out how
you dont
it okay I know its shocking
literally
if (event.getHand() != EquipmentSlot.HAND) return;
// If it is hand this code will execute
It also just looks shit imho
i wouldnt wanna look at Gsit code with {} if statements everywhere
yeah but why
one you can send do extra stuff in
why are you returning then
forgot about that
its too late
is there an event or a way to detect when the ender dragon sprays its dragon breath while perched? I want to replace it with a different area effect cloud
150 -> 50
you gotta make a custom pathfinder
and mess with the entity navigation
they do indeed matter
why isnt everyone making one-file plugins then
π€
ides will fuck up
yeah all IDEs are fine except eclipse
i prefer to have my syntax colored tho
was somehow stuck at brains, but pathfinder really is the way, thanks!
most IDEs refuse to work after certain limit of lines
because of performance issues
its not hard to reach that tho
also even below its still a performance hit
here's why eclipse sucks
can you try not to deafen me in future pls
what ide
but yes it sucks balls
intellij has some things i dont enjoy but its better than eclipse
everything is better than eclipse
havent touched netbeans and i refuse to
netbeans is a joke too
Totally agree man, sorry for those eclipse lovers
Eclipse is love β€οΈ
eclipse is poop
at least eclipse is somewhat lightweight
sure, just cast everything to ItemStack
or have a brain
that's eclipse's favorite quick fix
"method XYZ cannot be resolved? Let's just cast it to something totally unrelated"
yeah because its that simple π
I can't remember the last time I use any quick fix/suggestion
we are making spide
sure bro
eclipse is just pure shit
OUR HOUSE
IN THE MIDDLE OF OUR STREET
why do you have it even installed
have you heard baggy trousers
just use vscode
it was my first IDE
and then, 4 years later, I installed it again to check it out
i had it on my pc before i swapped to ssd
turned out it's still shit
i dont have it anymore
my pc runs better
i blame my pc being slow on hdd on eclipse
boom
eclipse is bad
wtf is wrong with itunes
use spotx
audio software is not supposed to play things >= 0.0 DB lmao
my friend is making a item caps plugin, he has made it where you can only have a certain amount in a stack but the SMP owner wants it where you can only have 1 stack in your inventory and it wont let you hold more than 1 stack, is that possible and how?
cuz he cant figure it out and apariantly lifesteal has it so he needs help
or be a real chad, download .ogg files and play them using a DAW like cubase lmao
wtf is an "item caps plugin"
you can only have X items in a stack not 64
also just to confirm this, you only want a player to be able to hold 1 stack of 1 type of item?
the most items you can hold of a item, so like gaps only let you hold 24 gaps in a stack and pearls only let you hold 8 in a stack, but they want it where you can only hold 1 stack though
wtf is a "gap"
golden apple
golden apple
listen to item pickup, inv click and inventory drag and item swap event
sounds like css
do you also say "dpick" instead of diamond pickaxe
check if there inv already contains that block
grid-gap: 10px
some call it gapple some call it gap
this the code he needs?
yes
lol
totally
thats not true
this is what he needs to do
no one will give you the entire code for it
that what the general idea is
he needs help
listen to events
loop over the inventory
check if it matches
if it does cancel the event
what events? can you send me lik to send him?
sure give me a sec
https://hub.spigotmc.org/javadocs/spigot/org/bukkit/event/entity/EntityPickupItemEvent.html
https://hub.spigotmc.org/javadocs/spigot/org/bukkit/event/inventory/InventoryClickEvent.html
https://hub.spigotmc.org/javadocs/spigot/org/bukkit/event/inventory/InventoryDragEvent.html
https://hub.spigotmc.org/javadocs/spigot/org/bukkit/event/player/PlayerSwapHandItemsEvent.html
declaration: package: org.bukkit.event.entity, class: EntityPickupItemEvent
declaration: package: org.bukkit.event.inventory, class: InventoryClickEvent
declaration: package: org.bukkit.event.inventory, class: InventoryDragEvent
declaration: package: org.bukkit.event.player, class: PlayerSwapHandItemsEvent
might be a few extra
Why just dont your friend joins this server, i think it will be easier
alr, I sent him those, he said "ooooooo" so Im asuming he figured out something
this would be smarter
maybe they got banned
may be the case ig
I also got banned from paper's discord
so I guess they can use their weird "hangar" system on their own lol
noone's gonna use it anyway
alr, I told him to join
Hi, is possible to convert a fabric mod to forgge mod? Im no the owner of the mod
do you realize where you are?
both fabric and forge are upper shit
this is spigot not forge or fabric lol
we are here in a place where we fancy a nice across-version API
instead of weird mixins that break on every new update
Can you help me
no
lol
you didnt ask any question
sorry .-.
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!
I'm trying to make a plug-in where you can only have a certain amount of one item in your inventory can I do that
and what should happen when a user attempts to picks up a similar item nonetheless?
I tried making the plug-in but it didn't work at all
send code
listen to EntityPickupItemEvent, then check the already existing amount of items in their inv. If it's too much, just cancel that event
ok
you have other events to listen to as well
which ones?
the inv ones
if any
no like I don't know where to put it exactly
listeners*
public final class IDK extends JavaPlugin {
@NotNull
public static HandlerList getHandlerList()
This is what i got
have you ever made a plugin before
doesnt seem so
Do you know Java?
no lol
?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.
learn java then start to make plugins
a little
?event-api
you gotta be at least a bit proficient in java before you start doing plugins
no need to know everything, but at least the basics
To be fair the handler list is a piece of magic that is hard to grasp for anyone that has never worked all too much in java world
Hi I thinking how in spigot source I can add method from plugin (if I add method to source spigot I get error ClassNotFound)
in EntityDamgeEvent is there a method that gives us the person/entity that caused the damage
?paste the full stacktrace
event.getEntity().getDamager or something
but there isn't a method called get damager in getEntity
thought there might, guess i was wrong
there is getlastdamagecause
isn't it just a list of methods that are going to be called?
I've never really touched it, so not sure
There is more to it
And the fact that the method and field need to exist are purely arbitrary, which is my point
which field? the handlerlist one?
that one doesn't have to exist
there has to be one static and one non-static method
getHandlers() and getHandlerList() or sth
but yeah that alone is weird
one should be enough lol
It's not that hard to understand
seriously wondering why this man is using StrictMath and not math \π’
gotta save those method calls
please explain why both, a static and a non-static method needs to exist
because I for myself cannot understand it
and still it manages to be sometimes faster than my parser
strickland
that stuff is literally hardcoded lol
whats wrong with StrictMath never used it before
nothing
im not even able to insert custom functions \π’
StrictMath basically just makes sure that you get the same results on different platforms IIRC
Have you heard about that Netflix found an issue related with processors cache which affect JVM?
like wtf?
no
i should be reading newspapers to know all that stuff
this lines up so well its super satisfying
<relocation>
<pattern>com.jeff_media.customblockdata</pattern>
<shadedPattern>sh.miles.customblockdata</shadedPattern>
</relocation>
@EventHandler
public void damagee(EntityDamageEvent ede){
if(ede.getEntity().getLastDamageCause().getEntity() instanceof Player){
Player player = (Player) ede.getEntity().getLastDamageCause().getEntity();
if(playerclass.containsKey(player.getName())){
if(((customPlayerAttributes)playerclass.get(player.getName())).getPlayerclass().equals("ARCHER")){
ede.setDamage(ede.getDamage() * 2);
}
}
}
``` I'm trying to make it so certain people can deal more damage with bows and this is what ive tried but it doesn't work anyone know why
If you have a question, please just ask it. Don't look for staff or topic experts. Don't ask to ask or ask if people are awake or available. Just ask the question to the channel straight out, and wait patiently for a reply. Make sure you use the right channel regarding the topic of your question. Create a thread in case the channel is already in use!
?notworking
"Does not working" is a useless statement. Please describe what exactly is not working, what you expect it to do, and what actually happens. If you get any console errors, also ?paste the entire stacktrace.
Wrong command sorry tho
- I would suggest calling ede, as event, which is the proper convention i would use
- Why playerclass? I should recommend reading java conventions
- I would never use player name as key
playerclass because when the player first joins they are meant to chose a class such as archer beserk or tank
This is what i got
Mainly coding a faction plugin !π€
package coolmod.idk;
import org.bukkit.Material;
import org.bukkit.event.Listener;
import org.bukkit.event.player.PlayerPickupItemEvent;
import org.bukkit.inventory.ItemStack;
public class Cool implements Listener {
public void PlayerEventListener(PlayerPickupItemEvent event){
if(event.getPlayer().getItemInHand().getType()== Material.GOLDEN_APPLE){
if(!(event.getPlayer().getItemInHand().getAmount() <= 24)){
ItemStack item = event.getPlayer().getItemInHand();
item.setAmount(24);
}else{return;}
}else{return;}
if(event.getPlayer().getItemInHand().getType()== Material.ENDER_PEARL){
if(!(event.getPlayer().getItemInHand().getAmount() <= 8)){
ItemStack item = event.getPlayer().getItemInHand();
item.setAmount(8);
}else{return;}
}else{return;}
}
}
?ask
If you have a question, please just ask it. Don't look for staff or topic experts. Don't ask to ask or ask if people are awake or available. Just ask the question to the channel straight out, and wait patiently for a reply. Make sure you use the right channel regarding the topic of your question. Create a thread in case the channel is already in use!
No problem explanation, no code format π¬
e
what why not use playername as a key
?codeblock
You can use the discord code block format to display code or just text in a more pleasing way:
```java
public class MyPlugin extends JavaPlugin {
@Override
public void onEnable() {
}
}```
Becomes:
public class MyPlugin extends JavaPlugin {
@Override
public void onEnable() {
}
}```
yeah, player name can change, uuid is unique
oh yeah i was planning to changing it to uuid when ifigured out playername returns their name not the uuid
In your case you are using a Map, where the key is the player name?
yea
okay
and i'm wrapping the player class with a custom one
Ok
make that changes i told you, also please format proper your code
ok thanks
Like this
How?
?codeblocks
remember that names can change
You can use the discord code block format to display code or just text in a more pleasing way:
```java
public class MyPlugin extends JavaPlugin {
@Override
public void onEnable() {
}
}```
Becomes:
public class MyPlugin extends JavaPlugin {
@Override
public void onEnable() {
}
}```
read Bruh
yes
what everyones been talking about lol
oooo
ooooo lol
package coolmod.idk;
import org.bukkit.Material;
import org.bukkit.event.Listener;
import org.bukkit.event.player.PlayerPickupItemEvent;
import org.bukkit.inventory.ItemStack;
public class Cool implements Listener {
public void PlayerEventListener(PlayerPickupItemEvent event){
if(event.getPlayer().getItemInHand().getType()== Material.GOLDEN_APPLE){
if(!(event.getPlayer().getItemInHand().getAmount() <= 24)){
ItemStack item = event.getPlayer().getItemInHand();
item.setAmount(24);
}else{return;}
}else{return;}
if(event.getPlayer().getItemInHand().getType()== Material.ENDER_PEARL){
if(!(event.getPlayer().getItemInHand().getAmount() <= 8)){
ItemStack item = event.getPlayer().getItemInHand();
item.setAmount(8);
}else{return;}
}else{return;}
}
}```
so should i use UniqueID
add java after the ``
at the start
okay that's good but you still missed the "java" part
package coolmod.idk;
import org.bukkit.Material;
import org.bukkit.event.Listener;
import org.bukkit.event.player.PlayerPickupItemEvent;
import org.bukkit.inventory.ItemStack;
public class Cool implements Listener {
public void PlayerEventListener(PlayerPickupItemEvent event){
if(event.getPlayer().getItemInHand().getType()== Material.GOLDEN_APPLE){
if(!(event.getPlayer().getItemInHand().getAmount() <= 24)){
ItemStack item = event.getPlayer().getItemInHand();
item.setAmount(24);
}else{return;}
}else{return;}
if(event.getPlayer().getItemInHand().getType()== Material.ENDER_PEARL){
if(!(event.getPlayer().getItemInHand().getAmount() <= 8)){
ItemStack item = event.getPlayer().getItemInHand();
item.setAmount(8);
}else{return;}
}else{return;}
}
}
yay
yes
there are probably like 5 or 6 different events you will have to listen to
yeah
^^
InventoryDragEvent
InventoryDragEvent
they listen to player pickup so thats fine
I'd do it sth like this:
private void preventStuff(InventoryEvent stuff) {
// Do your stuff;
}
@EventHandler
public void onClickEvent(InventoryClickEvent event) {
preventStuff(event);
}
@EventHandler
public void onDragEvent(InventoryDragEvent event) {
preventStuff(event);
}
.......
so
although "preventStuff" shouldn't take an event, but rather everything you need from that event, e.g. the entity and stuff
so how can i do this and th for all the help
Sorry for being rude, but have you learnt java before coding?
Because its not worth to help someone with a ibrary which havent learnt atleast the lang where he is coding
ahh ok - sorry man
see
I just sent you an example above
you are probably better off paying someone to code this for you
check my bio π
1.5) Listening to events
To listen to any given event in your listener class, you must create a method with the org.bukkit.event.EventHandler annotation attached and the event is specified by the type in the method's argument. The method may be named whatever you wish. Example:
public class ExampleListener implements Listener {
@EventHandler
public void onPlayerJoin(PlayerJoinEvent event) {
}
}```
> Taken from spigot events wiki - https://www.spigotmc.org/wiki/using-the-event-api/
The home of Spigot a high performance, no lag customized CraftBukkit Minecraft server API, and BungeeCord, the cloud server proxy.
?eventapi
yeah
hahaha bro we are connected
for the longest time
/billy joel
?billyjoel
@quaint mantle we need a ?billyjoel command that sends a random billy joel song
no we dont
we do