#help-development
1 messages Β· Page 2208 of 1
how to get a players target block, and look direction, and place an itemframe with the same direction there?
why does playNote() say that it requires a note block when it seems to play regardless of a note block being there or not
Probably outdated javadoc
click on the marked m up there
and enter the command
the terminal can be quite weird sometimes
.
be patient
nvm for some reason it's a v, not an m
or create a thread and wait
^
sry, but it may get under, cause others also post their question... but jee, i'll wait
then make a thread
^
I'm having an issue where data in PDC is not saving after a reload
or the plugin fails to read the data
I've set this data using PDC on a horse, and you can even see it in the NBT data:
however when I try to read the data after a plugin reload using container.get(new NamespacedKey(plugin, "trust"), PersistentDataType.DOUBLE);, it returns null
TargetBlock location & look direction
anyhow, if i send a command, it sends me the command, i executed, but also correctly run it o.0 someone has an idea?
does someone know how to write a doclet for javadocs? e.g. like @FunctionalInterface adds this at the top of a class
I'd like to do the same with a custom annotation
its what you are returning
md5 told me that's called a doclet but I haven't found a simple example for it
you're returning false which shows usage
false shows usage, true shows nothing
how can i make an itemstack with items with nbt data?
i'd like to convert this: minecraft:filled_map{"map":"%d"} as ItemStack Object
are you on 1.13 or lower?
nope, 1.19
you can directly turn this into an itemstack with Bukkit.getUnsafe() IIRC
like ItemStack item = Bukkit.getUnsafe(String.format("minecraft:filled_map{"map":"%d"}", ids[0]))?
no no
so first you'D have to split it up
into {"map":3}
then create an ItemStack with a FILLED_MAP
and then you can do ```java
Bukkit.getUnsafe().modifyItemStack(myStack,"{"map":3}");
do you ONLY need this for maps?
jap
ooh
then just create a FILLED_MAP, cast the ItemMeta to MapMeta and set the ID
https://hub.spigotmc.org/javadocs/bukkit/org/bukkit/inventory/meta/MapMeta.html#setMapId(int) it's deprecated but it also explains why and what you should use instead
declaration: package: org.bukkit.inventory.meta, interface: MapMeta
definitely everything is better than raw NBT parsing
I now got it to work to at least show the annotation in the docs - funnily enough that simply required some annotations on my custom annotation lmao. However I'm still wondering how I could so something like the @depracted thing that it automatically shows a bold text box in the docs. Noone an idea? :/ Doclets seem to be overly complicated
guess I'm looking for custom tags / taglets instead of doclets
is there an intellij shortcut to automatically create an instanceof check and a class cast?
Is there a way of resetting the hasBeenPreviouslyKilled method of a world for the ender dragon ?
Sounds like you might have to dig around in NMS
can you check if a BukkitTask is cancelled/has stopped running?
declaration: package: org.bukkit.scheduler, interface: BukkitTask
dont you mean a BukkitRunnable?
nvm
why always nms
π©
You're trying to access stuff that isn't meant to be accessed
So that's why you need NMS
Hey guys ! I made a plugin that make goats immortal :
public class Immortal implements Listener {
@EventHandler
public void onDamage(EntityDamageEvent e){
Entity entity = e.getEntity();
if (entity.getType() == EntityType.GOAT){
e.setCancelled(true);
entity.setInvulnerable(true);
}
}
}```
Now I would like to make so if it's a player who damaged the goat, we send him a message, but idkn how to verify who did damage to the goat π€
Yea I tried, but since they're invulnerable they don't take damage
I did this :
@EventHandler
public void onPlayerAttackGoat(EntityDamageByEntityEvent event) {
if(event.getEntity() instanceof Player p && event.getDamager() instanceof Goat) {
p.sendMessage(ChatColor.RED + "Les chèvres sont immortelles sur le serveur !");
}
}```
Mh, maybe a problem in my code then haha
and did that work?
- Do NOT listen to EntityDamageByEntityEvent
- Just listen to EntityDamageEvent and cancel it everytime its a goat
- Do NOT set the goat to invulnerable
- Check if the event is instanceof EntityDamageByEntityEvent. If yes, cast it
- Then get the damager. If they are a player, sed the message
because they want goats to be immortal, not only from players
so two separate listeners would work too
sure but why not put it into one
cuz ugly idk π
I'd do it like this
@EventHandler
public void onGoatDamage(EntityDamageEvent event) {
// Do not do anything if the victim is not a goat
if(event.getEntityType() != EntityType.GOAT) {
return;
}
// Cancel damaging the goat
event.setCancelled(true);
// If it's a player, send a message
if(event instanceof EntityDamageByEntityEvent) {
EntityDamageByEntityEvent damageByEntityEvent = (EntityDamageByEntityEvent) event;
Entity damager = damageByEntityEvent.getDamager();
if(damager instanceof Player) {
Player theJerk = (Player) damager;
theJerk.sendMessage("Don't hurt goats you imbecile.");
}
}
}
and I don't think it's ugly, also it requires one less reflection call on every damage event π
How can I get the wool that a sheep should drop from the color?
Oooh okay I see, thanks for the tip, i'm quite noob and didn't know the event instanceof EntityDamageByEntityEvent was a thing !
I'll try all that, thanks a lot for your help guys !!
of course you can also use two listeners
@EventHandler
public void onGoatDamage(EntityDamageEvent event) {
// Do not do anything if the victim is not a goat
if(event.getEntityType() != EntityType.GOAT) {
return;
}
// Cancel damaging the goat
event.setCancelled(true);
}
@EventHandler
public void onGoatDamageByPlayer(EntityDamageByEntityEvent event) {
if(event.getEntityType() != EntityType.GOAT) {
return;
}
if(event.getDamager() instanceof Player) {
Player player = (Player) event.getDamager();
player.sendMessage("Do not hurt the goat, you imbecile!");
}
}
Oh nice, thanks a lot for this version, it makes it easier to understand for me haha
you are a goat yourself smh
Do not hurt the goat, you imbecile!
whaat
cute
thanks π
lol
cute
ahahah
Looks great
How to make a delay of 1 tick using tasks?
like delaying code by one game tick?
Y.
bot still dead gimme sec
I need to play a sound more times.
xd
The home of Spigot a high performance, no lag customized CraftBukkit Minecraft server API, and BungeeCord, the cloud server proxy.
Bukkit.getScheduler().runTaskLater(plugin, () -> yourTask(), 1L) one tick
or just runTask is 1 tick too
Thanks.
Thanks too.
discord is so weird
did i show you the dark theme thingie?
why does it show "one blocked message", but at the same time offer a show message button
yea
looks nice
coff coff
I tought that the dark theme would be enough
lets make the font dark so you cant see anything
it's not dark enough
it'll never be dark enough
oh btw fourteen
can you send me that thing in dm's?
the next level is to use a TOR browser to access it
dark web stuff
so i can't forget it
sure
how are these done anyway, is it css?
you cant really say as its developed by discord itself
wait, so you didn't create that yourself?
it sets some kind of flag to either use preexisting code or download code to use
nah
i'm confused
dunno if its easy to inject stuff into discord
the client?
afaik it is, but monkaTOS
it is very easy if we talk about the mere client
lmfao
oh
someone needs to create something that is like discord, but doesn't suck dick
people have done it
more darker.
not enough.
just that their accounts get bamboozled
anyways for the people that think they are stuck with this, right click the gear icon right of your name scroll down and disable :)
i dont talk about shit that looks like irc 2012 bs
better disc...
that's not what i meant
completely from scratch
i meant an own standalone app
basically
so not using 1 million bloated dependencies
bd is against tos, so i will probably never use it on this acc
tho tbf, default discord isnt that bad all things considered
well
people want simple skin features for years now
and they dont even add it to nitro users
dunno why better discord would better apart from the themes
it has way more features than just themes
you can see hidden channels
features that go deep into "enjoy getting banned"
optimizations and other cool ignorable stuff
afaik it can even log messages, which is probably the main reason discord even says it's against tos
ye
discord bots ccan log messages too :)
yea, but bd can log like EVERYTHING
which is dumb cuz like its so easy to log messages
understandable
mye, probably 1 reason why self bots arent allowed apart from being overly "harmful"
is discord now owned by microsoft or not?
nope?
i dont think so
ah then they didnt finish the deal i guess
Discord has yet to be bought out
heard smth about it
microsoft will probably buy activision tho, which i am kinda happy to hear
That was like 2 years ago lol
they just changed font or whatever it was, the colors
which still sucks tbh
yeah lol
ooooh I changed exactly 100 files in this commit
they have been doing so much stuff for nitro users
666 files committed
hehe yeah
its kinda nice
(for nitro users)
useful stuff tho?
it's mostly just bullshit features
yea treu
Why is spigot fiat multipla and paper lambo hurracan when starting server?
well the profile banner thing is kinda fancy
because people will be on so many servers lmfao
fr fr lol
discord begins to lag your entire pc if youre on more than 10 servers
no normal person is on more than like 20 servers
hehe
whut?
Depends on your PC
ye when i change to another server, my cpu usage goes up with 15% π
Im in like 173 iirc
ryzen 5 3600 overclocked to 4.2ghz too slow for discord lmfao
im in 25 lol
rookie number x)
how can I check how many servers I am on?
ryzen 5 4000 π₯Ί
15 here
Count
kekw
52 currently
poor 5 servers
lets see on my aly
lol
π
no friends :(
yea it's the account which i use for verified servers
40 or so servers I think
on my other account it's probably 20 servers or smt
why the heck does intellij count 43 errors but maven counts 0?!
intellij moment
might be intellij specific inspections
most of the errors intellij counts on me is grammar on variable names lmfao
it was stuff like "package not found" etc
strange
yeah maven compiled it just fine
lol same
custom javadoc tags are awesome
god i'm bored, got nothing to do
Make a plugin to tell you how bored you are.
you can write a doclet for me if you like
no thanks
no thanks
you can help with our mmorpg server
no wonder you're bored if you don't wanna do anything
god, no, not thanks
Play some league and int botlane
you can play chess with me
you bad af
good, then I'll win
i barely know how it works
Join the challenge or watch the game here.
yes
Go on YouTube find some 13 year olds smp server and ruin it 
not right now ugh
I meant in half an hour or so
i guess i'm gonna play genshin and enjoy the dm's, that call me weeb lmfao
then anyone else?
see ya
bb
why does triumph only support paper?
just try it and see when you get a NoSuchMethodException
Ehm, running 1 task, without putting a delay, is 1 tick for default?
kinda made my day
why are we in #help-development anyways
runTask is the same as runTaskLater(1)
Something went wrong.
why not
general sucks
fun
that was fast
Caused by: java.lang.NoSuchMethodError: 'boolean org.bukkit.persistence.PersistentDataContainer.has(org.bukkit.NamespacedKey)'
mismatched api/ server version?
on what did you call it
oh wait
what version?
yeah
1.18.2
PDC definitely has .has(NamespcaedKey)
ooh no wait
it only has has(NamespacedKey,PersistentDataType)
I think it's cause of triump guis using components for the guis
compiler should say that
anyone looking for a job?
doesnt work means what exactly?
?services but what type of job?
The home of Spigot a high performance, no lag customized CraftBukkit Minecraft server API, and BungeeCord, the cloud server proxy.
yes, as flight instructor. do you have one for me?
I can find
bot dead
Commands still not fixed :/
Just a potential lead dev for our networks
is the bot actually down or what
got a site?
no site
Think it probably crashed due to discord bumping their api every fucking second
can staff still kick people?
website
I'm just a manager bro, owner will hire
Yes Alex
fun
yes manually
like optic does all the time lol
optic is a man of culture
I don't understand a ?kick command why don't you just manually do it its so easy
who needs a bot to kick
faks bro
people who dont have kick perms but only bot perms
all ?kick does is make you look like a fool if you do it wrong
Myeah think md5 can log and track it easier with the cmd
with the most bots you cant kick without the perms to kick
what does getEnchants() return?
doesn't look like it returns Keyed
but rather a collection
drop us your website now
Collections obviously are not Keyed
yeah of course getKey doesnt work on that
I mean not for a namespacedkey
idk what you are even trying to do
map doesnt have a getKey function
it's confidential bro
then check if the map contains Enchantment.UNBREAKING
or do getOrDefault(Enchantment.UNBREAKING, 0) and see if it's 3
why are you looking for a lead dev if you cant show anything then
Bro it's a long story
so I need to hire a dev, but I can't tell you what your making good luck
containsKey
lol
learn java bruh
That's why I'm good at my job bro, I provide the impossible
it's a normal map
you should know how that works
google "java collections tutorial"
sure you can but you should have sorted it BEFORE you get a resultset
if your job is to hire people def. not
you should sort in the query itself
SELECT * FROM whatever WHERE condition SORT BY key ASC
it's not π
for example
but I can do anything
Anyway this place isn't for hiring people, and even if it were, just some genuine advice, you should show plausible applicants something in advance why they should apply for said position.
google "mysql sort by two columns"
just wondering - is there a way to move in taxicab way or move twice a tick
with minecarts at high speed they become kind of shitty because to corner you'd have to just cut it and fly across, wondering if theres a way to instead do X, then Z or vice versa
not asking for solution to be written just wondering if a fn for that exists and/or if i can call move twice and it will work how i imagine
enchantments are not
damn that's ugly
just like, getEnchantments().get(blah) == level
int knockbackLevel = meta.getEnchantLevel(Enchantment.KNOCKBACK);
no idea why you're doing it so extremely complicated
does your IDE not have any auto completion?
declaration: package: org.bukkit.inventory.meta, interface: ItemMeta
in principle not
same
im bored
I do that time to time
imagine bot dying
in a dev discord
oopsie
bro I wanted to read that
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.
for anyone who wants to send this while bot is down copy this
- <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.
lets create a github repo with all those bot commands
yes
lol
you sure?
100%
Haskel looks fine. uses a lot of formatting standards of Pascal
π
i mean i got kinda into fp
with Lua
but tables are still nothing compared to objects
lua legit works only on hashmaps btw lol
x)
an array is just a hashmap with a number as the key
and an object
is a hashmap
with each function name being the key
and the value is its function
same for variables
and people try so hard to mimic oop with it
but the indexing in lua is disgusting
int blocksZ = realSpeed.z > 0 ? Mth.ceil(realSpeed.z) : Mth.floor(realSpeed.z);
int blocksCheck = Math.abs(blocksX) + Math.abs(blocksZ);```
More of a logic question than a development one - Is there a smarter/more efficient way to do this kind of calculation? Racking my brain and not finding anything but it seems slow
what is realspeed
Hello everyone, I want to make a configurable command system for example the player does not want the command /moderation but wants instead /staff or /admin, how I can do (and make sure that in the plugin.yml the command is detected in all cases?)
Entitybowshootevent
in the https://hub.spigotmc.org/javadocs/spigot/org/bukkit/event/entity/ProjectileLaunchEvent.html test to see if its yoru bow. Then apply a flag on the arrows PDC.
in ProjectileLaunchEvent, apply a PDC tag or metadata on the projectile if the shooter had your bow. Then in EntityDamageByEntityEvent check if the damager is a projectile and if it has the custom metadata or PDC tag
Check bow, add stuff to pdc, check arrow pdc on some damage event
in the https://hub.spigotmc.org/javadocs/spigot/org/bukkit/event/entity/ProjectileHitEvent.html check the arrow for the PDC flag and adjust the damage as you want
just a vector sorry i wasnt looking at this chat so its just float values
mmm doing absolute then ceiling would give same result actually and cut a check out, think that's the best ill get
ye sorry lol couldn't figure it out at the time but best solution of any problem is walk away for 5 minutes :D
i always get the best ideas while sleeping
yeah i have a huge notes list of ideas i had that i'll probably never make cus of that
Same. I write code in my sleep to solve problems
bruh i only sleep when i sleep...
I've designed and written complete projects in my sleep. The mind is the clearest then
when I do that I wake up next morning and just look at the bs I did
I get the best ideas when I'm extremely sleep deprived
Hi, I've a config.yml contains smth like this
upgrades:
Diamond_Sword:
A: 2
B: 4
Iron_Sword:
A: 3
B: 5
And I want to check if item in players hand contains in this list to do something, any idea?
like optimizing Math.abs at the bit level
or rewriting String#split
to not support regex, but like 0.13% faster
insane performance gain!
worth it
my method for checking resturns a string. Diamond_Sword should be a string
thing is your strings are formatted in a fun way where you'd have to loop through the keys and do equalsIgnoreCase checks
because they're neither lowercase or uppercase
or you could format your strings
but then someone types in lowercase and it messes with the checks
so getStringList("upgrades") returns Diamond_Sword and Iron_Sword in string?
getConfigurationSection("upgrades").getKeys(false)
Those aren't strings, so it wouldn't return the proper value.
you have sections, not a stringlist
so how to convert them to a string?
Either change your config to the proper type or change how you access your data.
like this? :I
or this is selection too
because its red
That's a section too.
can u help me in easier way
If you want a string list, you need something like this:
mysection:
- "String 1"
- "String 2"
- "String 3"
but i want to get something like upgrades.awp.price
Then you need to loop through your configuration sections.
You'll need to use a loop and iterate over #getConfigurationSection("path.to.your.value")#getKeys(false)
Then use that value to build the proper path in your config section.
umm ok lemme try
thank you
Maybe BockFromToEvent idk
tried that too
are historical javadocs available somewhere for spigot? specifically 1.18?
BlockFormEvent is supposedly the correct one, at least according to the spigot javadocs
oh actually
miss read
its "BlockSpreadEvent"
Hello, I will do encryption for my scripts, but I do not have access to the links below, how can I encrypt?
I need to download two of these but I can't.
https://www.spigotmc.org/resources/obfuskator-skript-tool.60791/
https://www.spigotmc.org/resources/skrambler-skript-obfuscator.67294/
wha why would you obfuscate script :/ that sounds 300x more useless than obfuscating java and thats saying something
Neither are working >:C
π₯²
what a joke
https://www.spigotmc.org/threads/cancelling-obsidian-cobblestone-forming.520011/
this thread wasn't really solved as far as I can see, but it might give you an idea
I believe you might need an account sir
Is there any way to modify / remove a players message in chat, after they've already sent it?
I'm trying to make a DiscordxInGame chat plugin for my server, and I'd like it to modify / remove a message thats, well, modified or removed in the textchannel.
I've seen in a youtube video before someones chat being censored out after it already showed up in chat
believe the only way some plugins do it is by copying everything that has been sent to the chat and send it again just modifying that one message
π
declaration: package: org.bukkit.entity, interface: Damageable
just set the players health
^ Fire that event. If its not cancelled, set the players health
plugin.yml is invalid or missing
something in your yml is invalid
show us your plugin.yml
no they dont
you don't use / inside the yml either
agree
lol someone on my discord made a funny plugin
yea
wait
you need to extract all jda libs into your jar
you use maven i suppose?
well, idk how to do it in maven tho
just shade it?
i personally always use the artifact way
you shading it?
because i run an integrated server in intellij
check out my pom https://github.com/JEFF-Media-GbR/JeffBot
the <plugin> with maven-shade-plugin is the important part
alex's pom will help the most probably
basically all you need is to add this
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>3.3.0</version>
<configuration>
<minimizeJar>true</minimizeJar>
</configuration>
<executions>
<execution>
<goals>
<goal>shade</goal>
</goals>
<phase>package</phase>
</execution>
</executions>
</plugin>
now when you do "mvn package" it includes JDA in your .jar
yeah
well the important parts are there
make sure you have <plugins> and </plugins> (and obv the build one)
what's the problem though?
you MUST use maven to compile
how did you compile?
and what jar are you using?
the one that's called "original-YourPlugin.jar"
or the "YourPlugin.jar"?
you can also just go this way btw
no
you have to use the one WITHOUT original
and WITHOUT -shaded
just YourPlugin-1.0.0.jar
that's the correct one
is it also the "biggest" .jar in your folder?
it'll be big
yeah it should be at least 5mb
12mb minimum if all jda libs are included
I always exlude voice stuff and use minimizeJar
so I got it down to 5mb
that only shades the classes that you need
well
not exactly
lets say it tries to not shade classes you dont need
yes
π¨ Reload is dangerous π¨
never ever ever use plugman
please
it's the worst thing you can do
dont do that
still dangerous
why is Everyone Talking About Plugman Suddenly
are you using jda.shutdown() or jda.shutdownNow() ?
because redempt advertised it
Again?
use shutdownNow()
the one in help server was cause someone was complaining about it or smth like that
shutdown() is async IIRC and shutdownNow() is blocking
no, they were Asking for a AutoPluginUpdate Plugin and got Responded use Plugman
oh well close enough
Yeah
i should make an auto updater plugin
much love, Rack
i should make a bedwars plugin
Reported for threat
Spiget Based?
lol
1.19 bedwars server yes pls
lmao
thats easy
// use microsoft-provided allocator
#[cfg(target_os = "windows")]
#[global_allocator]
static GLOBAL: mimalloc::MiMalloc = mimalloc::MiMalloc;
no
bedwars sounds doable in like 1-2 hours
Yeah, Bedwars is not that big of a Deal, a Small Bedwars at Least
well hypixel copied bedwars...
with not too Much Features
i was actually planning on making a bedwars plugin
making it scalable would be the issue
but i keep putting it off to work on this package manager
Intellij is Cool
lol
[target.'cfg(target_os = "windows")'.dependencies]
mimalloc = { version = "0.1.17", default-features = false }
[target.'cfg(not(target_os = "windows"))'.dependencies]
jemalloc = { version = "0.3.0" }
poor
You can not wait on teh main thread
oh
you mean you want to run something on every tick?
you could use a runTaskTimer
Bukkit.getScheduler()
ultimate is so expensive for features that I've never needed nor really know about
i think ultimate is mainly for commercial use
that's why university email addresses are nice to have
I don't understand the problem you're having
then schedule a repeating task
no idea what you mean with "to the side"
The ONLY way to wait is with the scheduler
d.
d.d.d.
d.d.d
.d
.d.d.d.d.d.
d.d.d.d.d.d.d.d.d
.d.d.d.d.d
.d.d.d.d.
there you go
long code to the bottom
no idea what you're talking about
new BukkitRunnable() {
int current = 0;
@Override
public void run() {
// Run your code
current++;
if(current == 15) cancel();
}
}.runTaskTimer(this, 0, 1);
he means long lines basically
hey there, how can i check if a item has been renamed by a anvil or if its display name has the display name because of a plugin?
e.g a anvil from my plugin has the name "super anvil", which will be needed for further interactions, but i dont want that a user renames his anvil to "super anvil" that he basically doesnt need the special item
add a custom PDC tag to the ItemMeta
wasnt there a check if the item got renamed by a anvil?
no
i wonder... what's the difference between yours and
Bukkit.getScheduler().runTaskTimer(plugin, () -> {
int current = 0;
// Run your code
current++;
if(current == 15) cancel();
}, 0L, 1L);
hope if have right syntax lol
i mean difference in a usecase-way, not just how it looks
if you want to use the Consumer<BukkitTask>, then I can tell you what the difference is π
oh
huh
what you sent is the same
because ive read so many people rant at me when i use the one i sent
and i always wondered why
you mean this I guess
int current = 0;
Bukkit.getScheduler().runTaskTimer(this, task -> {
current++;
}, 0,1);
?
i'm confused rn
^ would need an AtomicInteger
exactly
well
google it
mvn -T16 package
gimme time to write it in intellij with autocomplete lmfao
oki
16 threads
with 1 thread my current project takes 1 minute 20 seconds. with 16 threads it takes 39 seconds
so yeah still long
edited
Bukkit.getScheduler().runTaskTimer(plugin, new BukkitRunnable() {
int current = 0;
@Override
public void run() {
// Run your code
current++;
if (current == 15) cancel();
}
}, 0L, 1L);```
that is exactly the same basically
my huge ass project takes ~20 seconds on normal installs
I also run mvn clean install every time, no idea if there is a better way lol
yea, i wrote it in intellij directly
thats why i said i hope i had the syntax right
apparently i didnt lol
oh wait
that's deprecated and throws UNsupportedOperationException
what
tf
the first sets it to 10 hearts, the second sets it to their max health
depends what you consider "full"
well their maxHealth could be higher or lower than 10 hearts
Attributes
cause sometimes u have ticks being 60ms, and another one to compensate is slightly faster at 40ms, thatd avg to 50, but if u set it to 50ms, then the avg would be like 55
Is that true^^
if(message.contains(badWord))
I mean wth are you looking for
obviously
you can't
what if someone writes
oh shit. wtf is this and fogets the space, it would think shit.wtf is a domain
chat filters are almost always useless
you cant really filter a single word with regexs
it depends on how you set them up
a server ive worked for had a very strong one
one can always get away with it
but they had to also manually maintain it
wowowo.ogooooogoloeo.odoeo <- yo guys go to this website but remove every second letter
who would do this xD
idk but it's possible to get around every chat filter
also it was just the stupidest example that came to my mind
the only proper chat filter is a staff member who is online
Try to get around Robloxs chat Filter lol
Have a message queue and run the messages thru a a trained ai
make people pay per message
New problem is now training ai
Just use perspective API 
lets make a strong chatfilter
I'm having a weird issue with inventory names. I recently multi-language support to my plugin, which gives me the ability to translate the custom GUI names depending on which file is selected. I'm currently saving inventory instances in a map tied to a player UUID. The issue I'm facing is when the language setting is changed and the plugin is reloaded with the built in command, it grabs the proper value, but when the inventory is updated with one specific interaction, the name changes to the previous language name.
I'm currently reopening the GUI for the player so it can update that one item. (Probably not the best approach, but it's what I'm currently working with) I'm aware that some issues may occur if you open an inventory while another one is open, but I haven't had issues with this before. I also went ahead and made the player close the inventory before reopening it and the issue still occurred.
The part that baffles me is that the inventory instance doesn't change, but the inventory name does. The values grabbed from the language manager are also correct, so how could this happen?
My hands are cold.
private static String[] uselessWelcomeMessage = new String[] {
"Hello dear server admin! You probably didn't know it,",
"but this super awesome plugin is currently in the stage",
"of enabling itself.",
"",
"Just wanted to let you know. Have a nice day!"
};
Can we see code?
Reload code to be specific
there you have code
?paste
Bot no work
oh he's a magician
I gotta send md5 and example for my custom string encryption but that requires that I first write an example plugin with lots of text... someone have any good ideas?
naaah it should be at least a bit funny
Where u open the new invs
Compilation of every meme essay. (What the fuck did you just say to me... Rawr x3 nuzzles, etc)
oh yeah I'll include some script for an episode of The Office
good idea
I open the inventories when I need them. E.G new MyInventory().openGUI(player)
Once the inventory opens, that specific instance is added to the map.
Wdym? You can only set the inventory name during creation with Bukkit#createInventory(). AFAIK, there is no method to rename the inventory once it has been created.
correct
That's what confuses me about this. There is no reason the inventory name should change.
Yes
It's the same instance.
So are u sure u inv name is changing after its opened
it probably reopens the previous instance at some time
so either the cache is not cleared correctly
or some other stuff is happening
Would that be a spigot cache?
there is no new inventory name without a new inventory
no your UUID, Inventory map
Hmm, well I add the inventory to the map every time it's created.
Map<UUID, Inventory> yourPreferencesGUIs = new HashMap<>();
Then I add the player to the map every time the openGUI() method is called. https://paste.md-5.net/gexeqivixi.cs
In theory this should keep an up to date instance. Maps can't have more than one value per key right?
How I can search for a item stack in players inventory and for count and index of that item?
Like i want to know a player has 36 Dirt in slot 16 of inventory
Well I just tried clearing the maps on reload and it still did nothing.
Print the inv name
Title*
When it's being opened
You'll have an idea of what's going on
I'm not using InventoryViews so I don't have access to the #getTitle method.
Nvm, can access it in the event. Regardless, It's kinda useless as the title changes and it outputs what I see on the screen.
Just checked the hash codes of the inventories. They are the same.
I should also mention that if I change the item in the GUI, go back to a previous one or close it, then reopen it like I normally would, it has the proper title name. It's just for some reason that the name changes when using that one item, despite it being the same instance.
Also just confirmed that it's not a 1.19 issue either.
Then it's an issue with something you're doing
When you call ooenGui
Print the inventory name ur opening
Line 30 is null
I can't do that because of the lack of the #getTitle method.
Well print the hash or something to identify the lang that's being opened
how do i schedule a task to run every hour or so
create a bukkit runnable
BukkitTask runnable = new BukkitRunnable() {
@Override
public void run() {
// code
}
}.runTaskTimer(Main.getInstance(), delay, ticks);
?main
Bot back
will this task cancel when the plugin is unloaded?
Ye
Yes
Disabling plugin cancels all tasks
neat
I have already done that. They are the same.
fine now, thanks
Ok, I think GodCipher was onto something. It looks like the inventory instances are somehow different, but seem to return the same one after about two or three clicks.
Does anyone know how to force update the inventory when using a packet to set a slot to an item? (i'm trying to have items in the players crafting slots)
player.updateInventory
u can really just use that even tho its client side?
try it
didn't work
ok
Now I'm really confused. Somehow the map gets an instance, then when I click in the inventory, it gets updated with the proper instance.
shouldnt that already update it?
it should in theory but when I open the inventory its not there until after I click
Ok, I found out what I need to do to solve my issue. The problem is I don't fully understand what causes it. For some reason, the inventories that are created and the ones that are in my cache aren't matching up for the first two clicks. Maybe it has something with me creating the inventory in the constructor instead of the method.
https://paste.md-5.net/tawemewuya.java
this doesnt ever get triggered and yes it is registered
I'm trying to create a custom PersistentDataType with a primitive type of Byte to a complex type of Boolean
here's what I've got:
public class BooleanTagType implements PersistentDataType<Byte, Boolean> {
@Override
public Class<Byte> getPrimitiveType() {
return Byte.class;
}
@Override
public Class<Boolean> getComplexType() {
return Boolean.class;
}
@Override
public Byte toPrimitive(Boolean complex) {
return complex ? (byte) 1 : (byte) 0;
}
@Override
public Boolean fromPrimitive(Byte primitive) {
return primitive == 1;
}
}
the problem is
i have no idea what im doing lmao
im getting red underlines like this:
anyone know what I can do?
not use vscode
shut
try the quick fix
also I'm confused because both Byte and Boolean aren't primitives
oh that kinda worked
vscode is based
how do i use this custom type also
this clearly is in the same folder as the class definition
do i use new BooleanTagType() because that looks cursed
What dependencies do i have to shade from jackson library to use json and yaml?
anyone here used redis before? It's my first time learning/using redis and I'm curious if you're meant to do stuff in redis asynchronously.
You can use thread for that
Or if you are using Lettuce (Redis java client), its already contains sync, async and reactive things
20 ticks = 1 second
1 tick = 50ms
ticks are not ms, they are like a custom format
Oh ok
The only thing you ever need to bear in mind is if a server lags and runs at less than 20TPS, something like a scheduled task will as a result run later.
That's only normally important if the tasks you are running are over a long duration.
Many game servers are tick based to provide a schedule where the server and client update each other.
It's then just a unit of measurement to represent how often this happens.
Lol nice wiki
Inded its freaking fu** amazing the jackson library
Its has many sh***s
Im trying to discover what i need to shade for using yaml and json stuff but its so big that i cannot figure which i need to shade
Hahaha
i mean it is?
Why do u need jackson btw?
I used to use it and I've done all I can to use gson wherever possible.
For parsing json and yaml
Because im doing a lib for parsing files in bungee and spigot plugins in the same way
If it's causing you so many issues how come you don't use Gson and for example snakeyaml
how should i store logs for my plugin in a sql db?
there are diff types of logs, should each get it's own table?
Hmnn
I dont know why most of people when find something diff to help just say "do it in another way"
ps
Because you're clearly having a lot of problems with both the product and their documentation, and there are viable and much more popular alternatives.
I've also had a much nicer experience using Gson over Jackson
I have all the code done, i just dont know what i need to shade
wdym by u don't know what to shade?
If you're using the dependency and it's not provided by spigot or bungee, u need to shade it.
Yeah that what im doing
So in shading the dependencies but then when i try the plugin it fallback because the shade dependency doesnt contain everything
That why im annoyed
if your shading it correctly it should contain every module your using
If you decompile the JAR, is what it says it's missing actually missing from that file?
Also make sure you're not accidentally using the methods from Spigot or Bungee, that might then be using the versions/libraries they shade separately.
The only thing not being shaded is the ObjectMapper thing
Like debug type logs or server events
I dont know why
Are the purchases tied to the items given? Or are there also free items
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/
Are you using maven or gradle?
well u can purchase em or u can get em from a command
Maven
Oke I don't know maven so I probs won't be able to help any more, coz it seems like it's a maven issue, but if u send ur pom someone else can probs help.
so that's why i wanna log when they're given out, by who, if they paid, how much, who got it and how much
Yeah you could have them be separate tables with an null-optional foreign key to the purchase ID
Yeah, 1 sec
<build>
<finalName>${file.artifact}</finalName>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>3.2.4</version>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>shade</goal>
</goals>
<configuration>
<relocations>
<relocation>
<pattern>com.fasterxml.jackson.core</pattern> <shadedPattern>${parent.groupId}.${file.name}.com.fasterxml.jackson.core</shadedPattern>
</relocation>
<relocation>
<pattern>com.fasterxml.jackson.dataformat</pattern>
<shadedPattern>${parent.groupId}.${file.name}.com.fasterxml.jackson.dataformat</shadedPattern>
</relocation>
</relocations>
<createDependencyReducedPom>false</createDependencyReducedPom>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
I cannot fix the tab
Discord has horrible tabulation
?paste
Ok
hey
bruh
Google doesnt respond
I cannot paste the code
Idk what happen to my shit pc, its has a ryzen 5 3600 and 32gb and runs worst than an old pc
Oh lmao, more than 5m to just copy-paste a ** code
https://paste.md-5.net/tawemewuya.java
this doesnt ever get triggered and yes it is registered
if(!(player.getInventory().getItemInMainHand().getItemMeta() == null)) return;
if meta not null return
π
aside from that im not sure if checking if the toString of the lore contains a phrase is the best way to check for a custom item
agreed
i tried just comparing item to item and it wouldnt work
same for display name etc
lore is what works for whatever reason
what about instance of your enchantment
more weapons will be like that so it wouldnt work
i dont think i catch your meaning fully
use pdc
more weapons will have same enchant but iff effects?
give all your customs items a pdc tag that is the same
diff*
CUSTOM_ITEM_ID or something
Mnns
is it only one weapon with this effect?
this weapon will have more effects, another weapon will do the same as this one but thats it
oh im dumb, i though lore was tied to the enchant for some reason
its a vanilla enchant
yeah i realized
not as dumb as me not noticing the ! lmao
haha typos do be killin
idk theres prob some sort of custon item id, but that solution works
does the effect trigger now?
Scala is another sub-lang as Kotlin and Groovy right?
Im not sure exactly but Google says it runs on JVM & makes java bytecode
So it's in the java family
But it has more functional programming abilities
I never used Kotlin neither Groovy
I know that Kotlin in most cases for plugins, 100 lines on java = 50 lines in kotlin (same logic)
Haha yeah I've written in kotlin it's a little more condensed
But I still like java tbh
Also i want to take out an question
Spigot scoreboards are done in kotlin, because they can have more lines than doing it on java?
Or that its wrong
The language is completely unrelated to the game's features.
Doesn't kotlin have less lines?
It's just different code to get the same end result.
^
So coding a scoreboard on Kotlin or Java will allow the same amount of scoreboard lines right?
Yes
So i dont know why a developer told me that kotlin scoreboards support more lines
