#help-development
1 messages · Page 1820 of 1
thxx
ок
I can only understand ok so far
плагин Geyser нажимаю на npc открывается меню я выбрал в меню сервер команда выполнилась в консоли и меня не куда не тепнуло
если что это мобильная версия
поддержка
лол
его учить просто
Да-да
да
help
the Geyser plugin I click on the npc opens the menu I selected the server in the menu the command was executed in the console and I didn't achieve
anything if it
supports the mobile version
Where are you from?
как много людей разговаривают на русском здесь
да да
uhm help Error: Unable to access jarfile Nitrous
он явно не русский
So why exactly are you asking for help with your client here
да русский удобный просто простой язык
Легко тебе говорить
да
на самом деле не очень простой
how strange
Далеко не простой
слишком много исключений
один из самых сложных в мире^^
ну не знаю )
English only people
plugin
String name = plugin.getConfig().getString("player-name");
What i should put in the plugin place
im using exectuor
why
you mean we're prohbiten to speak on other languages?
Due to moderation purposes, and it’s a rule btw
Bo tak kurwa XD
it isnt really polite
sry i know English only lol
Hello. Does any1 have a plugin that supports 1.17 - 1.18 and it detects only first time join and random teleports you? Idk if i should write it in server help or development help, or somewhere else
so what do you know you're not alone here)
Anyways this is the rule.
so i will speak chines
Anyways, rules are made to be broken
?
the Geyser plugin I click on the npc opens the menu I selected the server in the menu the command was executed in the console and I didn't achieve
anything if it
supports the mobile version
"Rules are mostly made to be broken" ©️ Douglas MacArthur (1880-1964)
any1 please?
I don’t care about a quote, if you can’t follow the rules whilst chatting here, then leave.
Hey is it possible to check every time a command is run though console?
PreprocessCommandEvent or smth
ah
thank you
Thats only for players though
Must be possible to test the CommandSender is Type of ConsoleCommandSender, is it?
or "not-type Player"
i know, this sounds very stupid, but why can i not do use Replaceall to replace all "(" in a String with ChatColor.WHITE?
msg.replaceAll("(", ChatColor.WHITE.toString());```
the IDE literally gives an error because of ``) expected``, even though the ( is clearly inside quotation marks
Yea, But the method is PlayerCommandPreProcessEvent
PlayerCommandPreprocessEvent
help
Oh you're right
pretty strange, but consider that Strings are immutable so replaceAll yields new string, not changes the "msg"
i figured it out, like with square brackets in a string, we have to put \ \ before them, so "\ \ ("
the Geyser plugin I click on the npc opens the menu I selected the server in the menu the command was executed in the console and I didn't achieve
anything if it
supports the mobile version
though it's kinda stupid imo
it is!
"Escaping the Character"
Assuming you're right ofcourse
yep, i checked
after like 5 minutes more of searching i found the answer on the holy texts, aka stackoverflow :D
oh Geyser, i have run geyser before!
can you rephrase your question @ripe sun , i have a hard time understanding it
Whats that to do with coding development. Do you want to set a map into an itemframe or what are you trying to do?
If so, look at this example thread on spigotmc: https://www.spigotmc.org/threads/spawning-item-frame-with-rendered-map.453779/
the Geyser plugin when I clicked on the menu selected the server I was not teleported to another server
this channel isn't the place to get help for a plugin, this channel is for if you're writing code and need code help
Did gradle version change with needed to update to java17?
I think not, what does this two things have to do with each other..
You need gradlew 7.3
There are some versions in between, would be interesting to see which does actually build the new versions and which doesnt.
I'll always keep the latest version
Is sb there to help me with some db connections,...
#919671213113102367 message
Now the fun part all the nms changes lol
oh crap that is right org.json.simple is gone in 1.17 well lol
there's a few reasons bukkit/spigot exists and this is one of em
Hello! How to remove a permission ?
shadow jar time 🙂
similar if you deserialize to JsonObject
but in most cases you should just serialize/deserialize directly to your data class
I'm not even using LivingEntity in that entire class what's goin on here
Yea have been meaning to build something like that just to lazy to lol
Please...
Wym?
read the docs of your permissions plugin
you can negate by prefixing with - usually
I thing that it's on #help-server
Oh
and I need to remove a permission
Then, just remove the permission u added before.
attachment.unsetPermission(); doesn't work...
Thank you, but how
It's been already 5h I'm trying to fix it
What version do u want the plugin.
1.8.8
I use on 1.8x unsetPermission#
You mean this ?
should work
PermissionAttachment example = perms.get(player.getUniqueId());
example.setPermission("hello.hello", true);
Yeah, that's how I give a permission
I will try, since I saw many people saying It's bad
a unset permission just falls back to the default specified in plugin.yml (true/false/op)
hmm time to make a 2.0 revision of my plugin
It worked with false
System.out.println(test.toString().length()); how would I make this broadcast instead?
Bukkit.broadCastMessage
I just get an error
Whats the error?
Required type: string
Provided: int
provide a string
declaration: package: org.bukkit, class: Bukkit
why u don't use getLogger
Epig
Integer.toString() / String.valueOf
theres no reason to
How not
smh i'm the guy who uses Integer.toString
Integer.toString(test.toString().length()); like this?
yes
Bukkit.broadcastMessage(Integer.toString(test.toString().length())); gave me an error
Bukkit.broadcastMessage(String.valueOf(test.toString().length()));
just the same but whats the error
Not actually the same. There are some differences
How can i edit this to customize it?
I just got An internal error occurred while attempting to perform this command but it may be an issue with smth else
whats the error?
its on console
If you want help you just need to send the error
I was typing the wrong command thats the issue -_- :(
but this it the Banlist and i cant edit that in PlayerLoginEvent
worked, thanks
Im assuming the #serialize method for ItemStacks is there so you can store the item in a file, but Im getting an error
Nvm, I have found a resource that nicely explains serialization in general
nah thats for ConfigurationSerializable impl
Well then I had the completely wrong idea of what that method does
How would I get the first 3 characters of a string?
wdym
there is no slice in java
it isnt, so it's (0, 4)
ah
oh sry xd
wait isnt it 0,3
indeed, but we are doing it in IT class in school :(
And we are "learning" oop with it
I'm trying to format something as like ?e?? (scientific notion) how would I get the first 3 numbers of a number (not string)
str.substring(0,3)
Integer.parseInt(str.substring(0,3))
also doesnt the DecimalFormat class provides scientific notation?
Have you looked at DecimalFormat?
yeah it does
ah yea
is it possible to hook into watchdog and have some code execute when the server hasnt responded in a while?
or would i be better off making such a detector myself
You can pass a DecimalSymbols instance to it or smtng iirc
when do the UUIDs for offline players are being generated
On theyr first join
Bukkit.broadcastMessage(String.valueOf(Integer.parseInt(test3.substring(0,3)))); I'm getting an error of https://pastebin.com/hmwWyLwk
Afaik its likely the same every time as its generated based on the username
please
{"name":"Dovias","uuid":"bf35cc01-5df1-355c-aaa6-44ed8a1bbbd7","expiresOn":"2022-01-12 22:33:33 +0200"}
for example
dont make a string an int to make it back a string
in usercache.json there's an expiration date for UUID
why string -> int -> string?
isnt that the cache expiration date?
does that mean UUID will be regenerated after the expiration?
yes
Because I am dumb
why do UUIDs expire???
cause theyre not tied to an account when used in offline mode
ah
just dont touch offline mode
testing plugins
its more trouble than its worth
still good for testing stuff
Hi
i asking for help, or atleast advice,
im not much satisfiet with minecraft world generation.... is just repetitive fractal.... i wanna make a continent... about size 30k x 30k where are biomes logicaly chained a sourounded togrther by climates... (on north cold... over moderate, subtropic and tropic on south) and i dont know how achieve it.... with generator help...
i looked many world generators but no any can solve my problem... your abandoned project with map from image feature was closest to solving it... but is dead....
thanks
any ideas?
thanks
Afaik no,a uuid is never generated twice
doesnt that make plugins vulnerable to this expiration date
imagine storing UUID in the database
for a cracked player
Even if it is generated its not a problem as its always gonna be using the same name to generate the same one
and the fetched data after expiration date is stale
that means technically you can reverse engineer cracked player's UUID on the server, right?
or does the server contain some kind of unique SALT key to generate the UUID
what should I do?
Dont think it has,uuids are generated based on the username so its likely that all servers will have the same uuis
just cut the conversions
It caches user data, the cache entries expire on a certain date and they'll need to be re-fetched from Mojang servers.
^ its the date for NMS for trying to retrieve the UUID from the mojang servers, if that fails UUID doesnt update until its updated.
Hi! Any useful link that talk about netty injection on Spigot?
if you want to listen for packets, https://www.youtube.com/watch?v=rst3-wE14OQ&t=1s
Love the video or need more help...or maybe both?
💬Join us on Discord: http://discord.gg/invite/fw5cKM3
Thank you for tuning in to this episode of TheSourceCode! ❤️
If you enjoyed this video make sure to show your support by liking , commenting your thoughts, and sharing for all your friends to see and learn!
All code is available on Github:
...
I want to get Netty instance running on BungeeCord, to then subscribe a custom channel
String test3 = (e.substring(0,3));
Integer Result1 = int.valueOf(test3);
Integer Result2 = ```
how do I make result2 1/100 of result1
Not sure where I would ask, but I got a question about spigots rules. Being have they made a change to animal breeding mutations (brown pandas, blue axolotl) I've bred over 2000 axolotl and nothing has come from it yet so figured I'd ask
Btw Integer.parseInt() is better to use than the primitive valueOf method
In reguards to 1% multiply it by .01 IIRC (Im bad at math dont quote me)
I think this is more of a #help-server this is for programming
Unless your asking a question about the breeding api?
Whos that lol
whos who?
this is the channel for java/other programming language plugin development, not for questions about server configuration
ngl i dont know anything about this im just trying to get my friend a christmas present, thanks 😄
use #help-server
done
😕
?
so Integer Result1 = Integer.parseInt(test3);?
Yes and try/catch NumberFormatException
Integer Result2 = Result1.; what would I do for this though?
One moment i actually have code from an old project for this method
Use that method
I'm very new and this is very confusing
public int getPercentOf(final int toGet, final int percentage) {
return Math.round((toGet * (percentage / 100.0f)));
}```
ugh
stupid discord formatting...
why havent i wondered about this class earlier
this is a godsend for returning collections which are not meant to be modified
Put this method inside you main class, and make Integer 2 = yourPluginInstace.getPercentOf(integer1, 1);
Anyone know a snazzy way to get the items a player drops on death? Apparently, you can get the ItemStack drops from a player drop event but not the entities themselves
Or you can wrap the list in a new ArrayList<>(thatList);
public int getPercentOf(final int toGet, final int percentage) {
return Math.round((toGet * (percentage / 100.0f)));
}```
this in the main class?
doesnt that make a copy of the list
Yes, you can make it static if you like
You can just clone it then?
But yeah Collections are nice
cause its NMS
so Integer Result2 = E2.getPercentOf(Result1, 1);
What should i do
yes but please stick to javas naming conventions please
eg variable names are camelCased
that's the point i dont want to neither clone or modify the list, i just want for other people to access the view of the list safely, Collections static class provide a wrapper to make existing collection safe to read and impossible to write without copying the objects
and class names are UpperCase
You need to use build tools
I have build tools
okay thats not a command rip
Thats fair enough, good for APIS tbh
yea
What can i do with build tools
Did you instal-file it?
What?
If your using maven + build tools you need to install-file the buildtools jar IIRC since your importing it from a local file
As its not coming from a central repository
getting a error on the spigot level
seems entityplayer and entityliving are clashing
I havent done too much NMS, but i think you import BuildTools.jar via maven with install-file commands
ill get you an example
Result 1 = 123
Result 2 = 1
its meant to be 1/100 of the original?
1/100 = 1% = yes
well no since your setting 2 to equal 1 which isnt 1% of 123
oh is it because its Integer not number
why are you even setting the second variable to be 1 anyways
Can i do it in IntelliJ?
Yep! Use the m button on your IDE
Trying to make it 1.23
1/100 of the first one
Whatever button opens your maven command line
Thats what it is for me, its differnt for you
oh you wanted a double
Why are you using a Integer as the second result then
Yep and use the install-file for BuildTools.jar there
and then reimport maven
that dependency should resolve after its isntalled to your repo
I made it a double it went
350.0 ---> 4.0
Like this? mvn install --file
What should i type there
got it working.
Sorry for tag you but with this i can register a custom netty channel?
I cant find how to register a custom netty channel on spigot/proxy side
its really exaust
Yep make sure to remove Math.round though like this
public static double getDoublePercentOf(final int toGet, final int percentage) {
return toGet * (percentage / 100.0f);
}
god why cant discord format code correctly
Read the page i sent
I got it working, thanks for the help
can anyone use citizen's api?
Yes
how can you make an npc attack a player
oh that i never doen
But you would likely need to give it an AI + a Trait
I dont wanna modify. I want to register a custom channel for data sync betwen bungee-spigot
Maybe ask in citizens discord?
weird they added a whole feature for me in like a day
maybe authors are busy this week
its close to christmas time almost so maybe people are on vacation
i mean i asked stuff sometimes and i got replies but few hours later
i've been checking a bit around but i can't really find either a trait or a method to make an npc attack
Maybe something with BahvaiorStatus by chance?
I used mvn install:install-file -Dfile="C:\Users\Sohqil RF\Desktop\BuildTools 1.8 - Copy\" -DgroupId=server -DartifactId=net.minecraft -Dversion=1.8.8 -Dpackaging=server but i got an error
How are you getting the NPC
traits already took me a while
send the error
i've built my own packet entity api
oh
i mean inside the goalbehaviour thing
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-install-plugin:2.4:install-file (default-cli) on project bukkit: The specified file 'C:\Users\Sohqil RF\Desktop\BuildTools 1.8 - Copy\Bukkit\"C:\Users\Sohqil RF\Desktop\BuildTools 1.8 - Copy\" -DgroupId=server -DartifactId=net.minecraft -Dversion=1.8.8 -Dpackaging=server' not exists -> [Help 1]
you didnt point it to the file
am I supposed to pass the npc in the constructor
you pointed it to a directory
I think you register it to the NPC?
Wdym
i've managed to get entity metadata, entity targeting, movement tracking api's working on my lib
C:\Users\Sohqil RF\Desktop\BuildTools 1.8 - Copy\
Directory
Sry to budge in, I had a quick question about particles, is there any way to define a time for them to exist, or do I need to replace them using a scheduler?
What file should i point
hm lemme try to use the navigator
open source by chance?
BuildTools.jar
maybe you can make it follow an entity instead of a location
Is Sentinel open source?
yeah
not yet, its still indev
might as well check that later
The specified file 'C:\Users\Sohqil RF\Desktop\BuildTools 1.8 - Copy\Bukkit\"C:\Users\Sohqil RF\Desktop\BuildTools 1.8 - Copy\BuildTools.jar"' not exists
https://github.com/mcmonkeyprojects/Sentinel
For you later 🙂
that should defo be helpful they have npcs that attack
aight thanks
Ah ik why
ima try few things before
Particles are ephemeral, it just sends a packet that tells the client that a particle exists in a specific location. You can't change anything about the particle after it's sent
in my API, you can make your own entity trackers, you can even make packet entities track other server living entities not only the players themselves only.
i forgot that cant isntall from external foolders
i've made flying bat NPC yesterday 😄
I already have it
and make the path when installing the file BuildTools.jar
It uses the local directory eg project directory
it wont use C:\ or D:\ etc only ./ or /
BATMANNN
Thats actually pretty good pathfinding
for it not to just run into walls constantly
That's just literally server bat being tracked by packet entity
you can even see Bat in the clip
Hi
ahh so your basically overriding bat AI
nope
Which netty maven version use the bungeecord?
that include no NMS at all
the getEntityType in EntityShootBowEvent doesnt seem to work is it getting the projectile type or smth?
im just listening to the entity's movement and sending them back to the player as packet entity's movement via packets
its kinda vague
its packet level
ahh
I assume its likely getting the entity type that fired the bow
well its not seeming to work
i did a check for if it was a skeleton and the thing didnt log
is the skeleton vanilla?
ye
is the event itself firing?
ok
Can you show some code?
And this EnchantInventory is the one not getting loaded/not handling click events?
Is there any code example about getting netty INSTANCE of spigot server or bungee server? Please i cannot find anything!!!!
im like 99% sure thats a private method?
It has to be related to how your checking the inventory on click events
You have to code dive through the like original mojang jar cause thats the code that actually handles opening the server iirc
You can look through spigots code too but i highly doubt it would open the TCP connections with netty there
Besides why do you even want netty?
I wanna make a plugin which register a custom channel for sending/receiving data without players
is it possible to hook into watchdog and have some code execute when the server hasnt responded in a while?
or would i be better off making such a detector myself
Please dont tell use message broker!!!!
idk all to well how netty works in itself but why dont you make your own instance when the plugin starts and handle it that way?
the plugin watchdog right
no
spigot watchdog
the thread monitor
which kills the server if the main thread blocks for too long
https://www.spigotmc.org/threads/is-there-an-api-for-watchdog.357533/
This has a few nice details in it
i've found the method
to make it attack a player
i'll finish to code it tomorrow
specifically these 2 things
noice
yeah i figured that's what i'd probably have to do
I will get netty instance when my plugin get loaded. But i cant found how to get the netty instance itself
superSneaky
yuh tho thats decompiled code?
yeah cuz im too dumb to find the source
🥲
just finding the patch files
Do you know how to get netty instance via spigot plugin?
google spigot source LMAO
it shows right up
then im incredibly blind
?
it was for Ivj
arent those just the patches
That bukkit source
Idk where watchdog file is
or else ide find it myself
I think i know which class its the netty one on Bungeecord. Do you think that the correct class?
bruh im actually blind
the second link in this message is everything spigot
from NMS, to patches, to bukkit source, to build tools
thanks!
civis Bukkitus sum
Hi! Anyone can tell me how i can do ch#method() with reflections? I want to access the value ch
Until now
thats just a formal argument?
does anyone know why vault api isn't working with maven?
there are no version package in 1.14+ i think
even minecraft stop that lul
1.17 exists
wait then idk what is your jar idk
would entity metadata be persistent?
No but persistentdatacontainer is
Brigad is already provided in the server for newer versions right?
yes
1.13+ iirc
Yeah
whenever my server restarts, the custom enchantments that i put on my items are gone, how can i prevent that
depend how you are setting the custom enchants....
im using Itemstack.addEnchantment
and are added to the items?
if you not specify if the enchantment is compatible then this method not works and need addUnsafeEnchantment
wdym im confused
if you use addEnchantment you are sure the enchant is in the item?
remember custom enchantmens are not displayed in the item "lore" by client-side
after i add it or before
yeah ik
i have a thing that updates the lore
later
yes it has the enchantment
Can you show how you implemented them
Hey how can I set NBT data on items?
package io.github.narutopig.bors
import io.github.narutopig.bors.util.General
import org.bukkit.NamespacedKey
import org.bukkit.enchantments.Enchantment
import org.bukkit.enchantments.EnchantmentTarget
import org.bukkit.inventory.ItemStack
import java.util.*
import javax.annotation.Nonnull
class EnchantmentWrapper : Enchantment {
private val name: String
private val maxLevel: Int
private var conflicts: Array<Enchantment> = arrayOf()
private var cost: ItemStack
constructor(key: String, name: String, maxLevel: Int, cost: ItemStack, conflicts: Array<Enchantment>) : super(
NamespacedKey.minecraft(
key
)
) {
this.name = name
this.maxLevel = maxLevel
this.cost = cost
this.conflicts = conflicts
}
constructor(key: String, name: String, maxLevel: Int, cost: ItemStack) : super(
NamespacedKey.minecraft(
key
)
) {
this.name = name
this.maxLevel = maxLevel
this.cost = cost
}
fun getCost(level: Int): ItemStack {
val newLevel = General.power(2, level - 1) * this.cost.amount
val newCost = cost.clone()
newCost.amount = newLevel
return newCost
}
@Nonnull
override fun getName(): String {
return name
}
override fun getMaxLevel(): Int {
return maxLevel
}
override fun getStartLevel(): Int {
return 1
}
@Nonnull
override fun getItemTarget(): EnchantmentTarget {
return EnchantmentTarget.BREAKABLE
}
override fun isTreasure(): Boolean {
return false
}
override fun isCursed(): Boolean {
return false
}
override fun conflictsWith(@Nonnull other: Enchantment): Boolean {
return Arrays.stream(conflicts).anyMatch { enchantment: Enchantment -> enchantment.key == other.key }
}
override fun canEnchantItem(@Nonnull item: ItemStack): Boolean {
return true
}
}
its in kotlin but hopefully you can understand the gist of things
also all the enchantments are instances of this class
Jesus
Do you want a better solution
wdym by better
I mean
public class HelloEnchant extends CustomEnchant {
public HelloEnchant() {
super("Hello", 1);
addTrigger(EnchantTrigger.MINE_BLOCK, (e, l) -> {
e.getPlayer().sendMessage("Hello");
});
}
}```
This is all the logic required to implement an enchant
what is customenchant
can anyone answer a simple question for me please
how the hell do i get the specific field components
thats all i want
chatcomponents.getfield(0) only works for chat messages
i need all messages like death messages
sometimes the field is a
sometimes the field is components
and its pissing me off
?xy
Asking about your attempted solution rather than your actual problem
i want to cancel any message thats sent to players with a certain string (the ${ string)
anyone know how i can add nms to my dependency list in maven
including death messages
You need to do this why? And you can’t use the chat event for this why?
Find information about the log4j2 security patches here: https://www.spigotmc.org/threads/spigot-security-releases-—-1-8-8–1-18.537204/
because the chat event doesnt include death messages or any other message other than players
Yes, but it’s already been fixed
i dont give a shit about the server i already have that fixed
i need to fix it for clients
because they dont know how to update forge
Most forge versions are fixed iirc
In any case there’s like 2763 plugins that do this already
If they don't update their client, thats on them.
And how is ${ getting in a death message anyway?
Item names
because you can name a sword or name a zombie?
and even then i dont want to have to worry about any commands either
simplest would be to just cancel any message packets being sent from the server to the player with that string
You probably just shouldn't care.
As I said, their fault if they don't update their client.
https://www.spigotmc.org/resources/log4j-prevent.98338/
https://www.spigotmc.org/resources/log4shellfixer.98308/
https://www.spigotmc.org/resources/log4shellfixer-schließt-eine-sicherheitslücke.98297/
https://www.spigotmc.org/resources/miniantilog4j.98283/
https://www.spigotmc.org/resources/chatfilterplugin.98275/
https://www.spigotmc.org/resources/behaviordection-log4j-bug-fix.98274/
https://www.spigotmc.org/resources/minecraft-log4j-exploit-fixer.98259/
https://www.spigotmc.org/resources/crashexploitfix.98260/
https://www.spigotmc.org/resources/fix4log4j.98249/
Why do you need to code yet another plugin to do this
?help
selfrole Add or remove a selfrole from yourself.
cleanup Base command for deleting messages.
embedset Commands for toggling embeds on or off.
info Shows info about CafeBabe.
licenseinfo Get info about Red's licenses.
mydata Commands which interact with the data CafeBabe has about...
set Commands for changing CafeBabe's settings.
uptime Shows CafeBabe's uptime.
findcog Find which cog a command comes from.
names Show previous names and nicknames of a member.
userinfo Show information about a member.
listcases List cases for the specified member.
reason Specify a reason for a modlog case.
permissions Command permission management tools.
?help 2
ima run all 11 of those plugins
how do i get the name of an enchantment (the actual one)
like Sharpness
Isn't there a getName
that returns somehting like DAMAGE_ALL or some weird stuff like that
Does anyone have any idea how this is happening? That entire class doesn't import nor reference at any point LivingEntity.
getKey may be more readable
yeah but is there a way i can get the name that is displayed in minecraft
like in the item lore
The key should basically be that
I mean, is that really necesary xD?
ezpz already wrote a yet another tool to do that https://github.com/alerithe/log4noshell/
yer mom's not really necessary >:3
yes
someone should make a Log4j patcher patcher
o fuk
Nah i did a fix on a 1.8x forked spigot
Someone made a repo on github that uses the exploit to patch the exploit
i thought they would do something like cancel the message then send a jndi back to the client or something to troll them back lol
This is hilarious, but also still very much illegal
i think some1 i know did this for their server
if they try jndi it just sends it back @ them
Why does java do this:
directoryisEmpty method: https://www.toptal.com/developers/hastebin/imaqawurel.kotlin
And then my IDE tells me that it might be null:
Yet its specifically null checked in that method and returned?
Exact ide error btw
I assume this is just an intellij thing? Because if this ran during runtime it wouldnt be possible for playerDirectory to be null
probably intellij thing
Okay i can just add @SuppressWarnings("ConstantConditions") to the top of the class but i dont really want to do that as something else might be null i want to see hmm
guess ill just suck it up and use this annotation
I could but my goal with this method was to reduce the code size
and i dont want to shove annotations on top of multiple methods
i always thought that writing a single line of code without getting intellij warnings is impossible bro, dont need to care about it lol
if it makes u feel better i have a mod project in C# from a decompiled game that has warnings out the ass bc the dev was pretty Meh and didnt follow conventions
i might try and fix them one day but
just gotta ignore them...
unrelated kind of related note but VS is so ass cheeks at actually showing me errors and warnings so i usually have to restart it to see them
Isnt C# debugging kinda ass cheeks in itself though
i remember stack traces being useless as hell
might of been c++
?paste
For some reason it isn't sending a message to the person I told it to but I don't know why
Can any of you help?
you are checking if strings >1
means your command have to look like /trust player nqjdjd
I've had multiple projects without any IntelliJ errors.
Sooo... it's not IntelliJ's fault.
probably ==1. not sure what you are trying to achieve
I'm trying to make it that when you type "/trust (Playername)" it tells the (Playername) that they have a friend request
so you want the arg length to be 1
yeah you are sending the sender of the command the name of himself
they r checking if the array is null in the other method, it is a little strange that intellij cant understand that
How would I change that?
also your Bukkit.getPlayer(args[0]) is just unnecessary currently
well IntelliJ's assertions use implicit contracts
likelihood is that the "non-null" part of the contract wasn't generated
Player target = Bukkit.getPlayer(args[0])
if(target != null) {
target.sendMessage(player.getName() + " wants to friend you");
} else {
// targetted player is offline
}
something like that
otherwise your Bukkit.getPlayer will remain a dead store
Oh
Thanks
if (target == commandSender) { null } This doesn't work, Do you know what would work?
Just a question how do deal with picking colours for the return messages?
in the chat.
commandSender.sendMessage(ChatColor.RED + "Hello world"); Is this what you mean?
How do you pick what colours to use?
Yea it's all good thankyou
removing null and return instead
Will this stop it?
incompatible types: missing return value
Do I type return false?
return false would mean that the usage will be sent to the sender
sent the sender a message that he cant friend himself and return true
its the NMS version
The home of Spigot a high performance, no lag customized CraftBukkit Minecraft server API, and BungeeCord, the cloud server proxy.
So I can make my plugin support as many versions as possible
why does Chunk have getBlockAt(x,y,z) but not setBlock? How do i change blocks?
I'd look in the documentation but i cant access it atm for some reason
iterate through every block in the chunk and set it
iterate through the blocks in the chunk and set them per block. there is no method to change all at once
selfrole Add or remove a selfrole from yourself.
cleanup Base command for deleting messages.
embedset Commands for toggling embeds on or off.
info Shows info about CafeBabe.
licenseinfo Get info about Red's licenses.
mydata Commands which interact with the data CafeBabe has about...
set Commands for changing CafeBabe's settings.
uptime Shows CafeBabe's uptime.
findcog Find which cog a command comes from.
names Show previous names and nicknames of a member.
userinfo Show information about a member.
listcases List cases for the specified member.
reason Specify a reason for a modlog case.
permissions Command permission management tools.
is chunk.getblock(int, int, int) faster than both world.getblockat(int, int, int) and world.getblockat(location), and if yes, by how much?
chunk#getBlock probably invokes world#getBlockAt
nvm, the other way around
chunk#getBlock would be faster because world#getBlockAt first fetchs the chunk and then returns chunk#getBlock
but that shouldnt really matter because it will be unnoticable
is there a way to run code right after spigot enabled all plugins (completed onEnable() for each plugin)?
ok, but i found something else interesting. If searching blocks relative to the player, using location is marginally faster. 10k iterations, time in nano.
im going to assume getBlockAt(x,y,z) converts it into a location
can probably set ur plugin priority to be enabled last and then run ur code there?
no it is a library
so it have to be enabled before other dependents, and finish up with some code when no plugin going to register itself
run your code in your onEnable delayed by 1 tick
https://bukkit.org/threads/calling-an-event-after-all-plugins-are-loaded.152257/ looks like using a BukkitRunnable can do the trick
When my plugin starts up it loads LandPlots from a file and calls an event for each loaded. My second plugin depends on LandPlots and also needs to...
unless theres an api provided event then idk
Would anyone know why on 1.18.1 this would be happening:
[13:26:52] [Server thread/ERROR]: Error occurred while enabling ArmorStandEditor v1.18-31 (Is it up to date?)
java.lang.IllegalArgumentException: Team name 'ASLocked' is already in use
at org.apache.commons.lang.Validate.isTrue(Validate.java:136) ~[commons-lang-2.6.jar:2.6]
at org.bukkit.craftbukkit.v1_18_R1.scoreboard.CraftScoreboard.registerNewTeam(CraftScoreboard.java:167) ~[spigot-1.18.1-R0.1-SNAPSHOT.jar:3360-Spigot-f65de01-c2e0bbd]
at io.github.rypofalem.armorstandeditor.ArmorStandEditorPlugin.registerScoreboards(ArmorStandEditorPlugin.java:206) ~[?:?]
at io.github.rypofalem.armorstandeditor.ArmorStandEditorPlugin.onEnable(ArmorStandEditorPlugin.java:88) ~[?:?]
Source for where the scoreboards are:
Main of the plugin:
//Implement Glow Effects for Wolfstorm/ArmorStandEditor-Issues#5 - Add Disable Slots with Different Glow than Default
private void registerScoreboards() {
getLogger().info("Registering Scoreboards required for Glowing Effects");
scoreboard.registerNewTeam("ASLocked");
scoreboard.getTeam("ASLocked").setColor(ChatColor.RED);
}
private void unregisterScoreboards() {
getLogger().info("Removing Scoreboards required for Glowing Effects");
team = scoreboard.getTeam("ASLocked");
if(team != null) { //Basic Sanity Check to ensure that the team is there
team.unregister();
} else{
getLogger().severe("Team Already Appears to be removed. Please do not do this manually!");
}
}
Socreboard handling:
private void toggleDisableSlots(ArmorStand armorStand) {
if (!getPlayer().hasPermission("asedit.disableSlots")) return;
if (armorStand.hasEquipmentLock(EquipmentSlot.HAND, ArmorStand.LockType.REMOVING_OR_CHANGING)) { //Adds a lock to every slot or removes it
team = plugin.scoreboard.getTeam("ASLocked");
armorStandID = armorStand.getUniqueId();
for (final EquipmentSlot slot : EquipmentSlot.values()) { // UNLOCKED
armorStand.removeEquipmentLock(slot, ArmorStand.LockType.REMOVING_OR_CHANGING);
armorStand.removeEquipmentLock(slot, ArmorStand.LockType.ADDING);
}
getPlayer().playSound(getPlayer().getLocation(), Sound.ENTITY_ITEM_BREAK, SoundCategory.PLAYERS, 1.0f, 1.0f);
if(team != null) {
team.removeEntry(armorStandID.toString());
armorStand.addPotionEffect(new PotionEffect(PotionEffectType.GLOWING, 50, 1, false, false)); //300 Ticks = 15 seconds
}
} else {
for (final EquipmentSlot slot : EquipmentSlot.values()) { //LOCKED
armorStand.addEquipmentLock(slot, ArmorStand.LockType.REMOVING_OR_CHANGING);
armorStand.addEquipmentLock(slot, ArmorStand.LockType.ADDING);
}
getPlayer().playSound(getPlayer().getLocation(), Sound.ITEM_ARMOR_EQUIP_IRON, SoundCategory.PLAYERS, 1.0f, 1.0f);
if(team != null) {
team.addEntry(armorStandID.toString());
armorStand.addPotionEffect(new PotionEffect(PotionEffectType.GLOWING, 50, 1, false, false)); //300 Ticks = 15 seconds
}
}
sendMessage("disabledslots", null);
}
what's line 206 in ArmorStandEditorPlugin.java
and also line 86
and also
?paste
for when you want to send large amounts of code
Ah good to know, throwing your way now:
ArmorStandEditorPlugin.java L206:
scoreboard.registerNewTeam("ASLocked");
L86 in the same class - Is the onEnable portion.
L88 which I also see mentioned is the call to register the Scoreboards: registerScoreboards();
I knwo that work around is to restart he server but wondering how best to perma fix this. I guess check if scoreboard exists before registering?
👍
Also, I think teams are stored in scoreboard.dat or something like that (i may be wrong)
So basically see
scoreboard = this.getServer().getScoreboardManager().getMainScoreboard();
if scoreboard.getTeam("ASLocked") == null{
//Create team
} else{
//Do something if team already exists
}```
and go from there?
do not try to encapsulate much
Hrmmm ok. Just wondering how best to proceed 🙂
pretty much just
if (Team#getTeam("ASLocked") == null) Team#registerNewTeam("ASLocked");
wait no
yeah you do you, I am a bit tired
🤣
No worries, thanks for helping though 😄
but yeah, in the future just look over the javadocs and read the error
and if you didn't knew already, look in the error to see where it comes from
is there any damage cause in damage event for a created explosion?
declaration: package: org.bukkit.event.entity, class: EntityDamageEvent, enum: DamageCause
how to remove everything from item's PDC?
I saw this before...
::getKeys and then ::remove for each key
it work on 1.14.4?
i don't see
stack.getItemMeta().getPersistentDataContainer().getKeys();
The meta is just a configuration
try custom or on damage event get cause and send it to chat
You need to set it back
declaration: package: org.bukkit.persistence, interface: PersistentDataContainer
1.14.4
Maybe this was added quite recently
and how to do that on 1.14
Idk, might have to operate on the implementation
yeah updating is good, bot i want to support 1.14.4
Well you'll have to jump into the implementation then
i found workaround, storing all keys that i ever added in list
That’s a better way as it wouldn’t interfere with other plugins which also use pdc api
you mean other plugins editing same item?
In principle yeah
that's bad
i want to delete EVERY entry
i clone itemstack
than delete everything
and check whether they're equal
cuz PDC don't implement correct equals method
it does not ?
Pretty sure it does
it just equals the internal map
all of the nbt tags also have correct equal methods
same items with same PDCs are duplicating as hashmap key
but same items without PDC don't
=> PDC is the problem
Can you pls try to replicate this in the latest version btw
idk i want to support 1.14
if the hash function of the pdc is broken you should notify the spigot maintainers
no but like
mb they added correct impl in newer
pretty certain the hashcode and equals function existed since the introduction
Only thing I can think of is like a broken PersistentDataType’s type’s hashCode
the types are not stored in the pdc tho
are you really adding EXACTLY the same data to both PDC?
Not really what I asked. Is there any way your method could add different PDC data
version?
oh pdcs r bukkit api? idk y but i thought they were part of spigot instead lol
most new API is bukkit api
hm
yet it has spigot specific things itself .. smh
does it ?
.spigot() methods no?
OH
yea
Well the concept of spigot patches still exist
¯_(ツ)_/¯
a result of some fun minecraft server software history
this games history is something alright
has anyone registered custom entities yet?
I did it once with 1.7.10 nms
i can't
one of my projects really need it
not sure why they don't load
1.17 just worked without any fancy stuff
not sure what they changed
how do i best generate a known structure via plugin? Speak, how do i store it in the plugin, and how do i put it into the world?
whats the correct way to update block data
i.e store it
and update it at a later date
atm im just re-setting the type to what it originally was
but id like to keep the block state next time
it all depends on the block
for most blocks you can use https://hub.spigotmc.org/javadocs/spigot/org/bukkit/block/data/BlockData.html#getAsString(boolean)
Hey! Could it be that IntelliJ IDEA packages the classes without modules when packaging from a child module? I had to specify the class without any modules prefix, otherwise, it would fail
Use the new structure api, it’s worked well for me
im making my own version of spigots watchdogthread, and and i've got a bit of a problem. spigot watchdog does busy waiting, sleeping in a basically infinite loop. is this a problem/can i do this a different way?
I got NoClassDefFoundError for asm class when enabling my plugin ._. but I supposed to already add them into built jar
basically use any third party dependency seems always give NoClassDefFoundError, despite I have added flatten classes into the plugin jar
are u using the right jar when ur putting it in plugins
uh probably
because there is org/mydependencies/... folder inside the jar
uh maybe because I did not add classpath into the manifest
well, doesnot work ;_;
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>3.2.4</version>
<configuration>
<artifactSet>
<includes>
<include>org.ow2.asm:asm</include>
</includes>
</artifactSet>
</configuration>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>shade</goal>
</goals>
</execution>
</executions>
</plugin>
Did I make any mistake in pom? I am super confusing because I can actually see the package & classes I need in the jar but spigot still produces NoClassDefFoundError
Spigot doesn;t use the manifest
if you want to include something and are having issues with shading, use the libraries entry in the plugin.yml
I am checking it out, thanks
Does TabCompletor need to be registered like an event?
it need to registered like a CommandExecutor iirc
I am using a custom Command handler, so i inject a BukkitCommand into the Bukkit CommandMap
So im not sure how this changes reistering TabCompletors
okay more confusion: I added asm into libraries entry, and spigot download the dependency when load my plugin, then I get NoClassDefFoundError again when enable the plugin ._.
you need to pass it through both ::setExecutor and ::setCompleter
Then your issue is with your plugin build. Remove teh shading/relocation
BukkitCommand doesnt have this method though?
I kinda forgot how to use the default bukkit command API
lol
So i would need to use getPluginCommand and then set the completors on that?
I dont think my command would get registered to that map though
uh or JavaPlugin::getCommand
I register my commands like this
But isnt getCommand only for commands in plugin.yml?
Or would it pickup commands from Bukkit CommandMap as well?
yep they do
w h a t is that background
its this
Oh interesting
obtrusive background lol
So it just uses getPluginCommand under the hood
nah thats why it has opacity
barely even notice it while using the ide tbf
bump
ugh sounds fine?
so it wouldnt really be a problem
dont think so, I mean have you tried (yes I know multithreading and concurrency is hard to test)?
not yet
just asking before i get bombarded with "tf you doing that's basically illegal"
lol
how else would you want to keep a thread alive
if (!Thread.isAlive) Thread.hospital.keepFeedIt;
getHospital smh
is there a way to get these progress updates from a plugin? having set the plugin to load at startup this sounds like a possible thing to do but I couldn't find much on google
You have to make them, calculate the value you want to display, and display it on enable or during the loading process
make them as in make a new world?
If your plugin does create a world, you can make them, that's a bit complicated cause you need to know some sort of max value to have a percentage of loading
how would I know how much has loaded?
sad, it doesn't seem like this event gets fired when the default world loads on server startup
That's because the world load before the actual plugin manager loaded is embedded in the server jar
ah, I thought doing "load: STARTUP" might've some how made it so the plugin loaded before the world
I was especially thinking that because the load message appears before the world loading
It does load before the world is loaded
but the world's load is server side, you can't interact with it
oh... sad
hmm thought registering the event callback in onLoad would do the trick
That could work yeah
But doesn't the events register loads up after the server is up ?
anyone know good command creating APIs that don't require install plugin dependency?
Use the spigot api ?
it's shit
Oh.
You can do it... ^^'
yes
but it requires more code
there's CommandAPI plugin
which makes everything clean and easy
Make your own api then
but it requires it to install it
🤦 I forgot to register the listener... now the chunk load event fires
what would happen if you get map's value view: Map.values() and add another element via: Map.values().add(), will this throw UnsupportedOperationException or what?
Depends on implementation
But mutations made on the collection object of the map’s values should be reflected on the actual map.
At least some I think
with remove() it makes sense, since it does not require a key
while .add() method only requires an object
and not the key
this could break the whole map implementation
declaration: module: java.base, package: java.util, interface: Map
It does not support the add or addAll operations.
@mortal hare
thanks ❤️
good question tho, had to look it up myself!
I need to get the world coordinates of a chunk's 0 0 0 block, how do i do that?
or rather the location there
chunk's corner coords are afaik X*16 Z*16
chunk.getX() << 4 and chunk.getZ() << 4
will return the x and z coordinates of the world
afaik its the same thing but faster, since this just shifts the int primitive via bitwise shift operator
or you could do chunk.getBlock(0,0,0)
its also just standard from what ive seen
bitshift or chunk.getBlock faster? i need the biome in that chunk (its nether so it should be the same regardless of height)
are you in 1.18?
ye
the biome is NOT the same regardless of height
even in the nether?
correct
i need to know with a simple/fast check if there's a warped forest or a crimson forest through that chunk
also multiple biomes can be in one chunk, i think u know that though
in the 0 0 corner
and my idea was 'check 0 64 0' of that chunk
correction only the warped forest check needs to run
since 1.16, biomes are being generated in three dimensions, not in two.
that means two or more biomes can exist at the same chunk at different heights
i know that but i need to know with a good chance of being right if there's a warped forest in that chunk
i wouuld use this
declaration: package: org.bukkit.generator, class: BiomeProvider
with chunk.getX() << 4 and chunk.getZ() << 4
it tells me to implement methods for biomeProvider?
world.getBiomeProvider
cant i just call getBiome on world directly?
you could but it would return the biome at the highest point in the world. It's deprecated and subject to future removal
oh youre right
i didnt see that in the jd
declaration: package: org.bukkit, interface: RegionAccessor
Biome biome = chunk.getWorld().getBiome(chunk.getX() << 4, 64, chunk.getZ() << 4);
boolean warped = biome.equals(Biome.WARPED_FOREST);```
?
ah wait that has to be ==
no 🥄
arrow1.setVelocity(arrow.getVelocity().rotateAroundY(Math.toRadians(30))); Why does this not work?
why not?
what are you trying to dfo
have you tried adding to the yaw direction directly
how can I check the player jump event?
There is no jump event
If there was he would do :/
how can I check the player jump?
depends how accurately you need to check
You could check the jump statistic when it increases, but it would not be accurate timing wise
there is a complicated packet check
else you could check the block below the player in teh Move event and check they are not crouching
when player touches space one time I want to run code
You can;t detect key presses
not unless they trigger some event, and space doesn;t
It doesn't trigger any spigot event
for example fly state
why is structure on the bukkit api page 403 forbidden?
i just want to know how to place one
yo what exception does the server throw if there is no suffix found for a player? nullpointer, right?
declaration: package: org.bukkit.scoreboard, interface: Team
annotated with @urban grotto
LOL
oops random ping
neither of those is working
new File(getDataFolder(),"resources/nether_house_blue.nbt")
new File(getDataFolder(),"nether_house_blue.nbt")
look at the jd, it tells you what happens
IllegalStateException - if this team has been unregistered
if you didn;t saveResource( they will not be in your plugins datafolder
._. I put my jar file into resources folder for maven to package it, but somehow maven corrupt the resource jar file
then don;t try to get them as a file
i know there was some stream weirdness but i cant recall how
aka doesnt exist?
if its not registered on the server
a team object can exist without it being registered
can i just cast that to structure?
public void jump(PlayerMoveEvent event){
Location firstPosition = event.getFrom();
Location lastPosition = event.getTo();
Player player = event.getPlayer();
Block block = player.getWorld().getBlockAt(lastPosition.getBlockX(), lastPosition.getBlockY(), lastPosition.getBlockZ());
if(Math.floor(lastPosition.getY()) > Math.floor(firstPosition.getY()) && !player.isFlying() && lastPosition.getY() - firstPosition.getY() != 0.5 && block.getType().isAir()){
System.out.println("Jumped");
}
}
I'm using this code for check whether move event. Is there any better way to check it?
no
any idea how to fix the issue? I can make it work by manually drag jar resource into final jar package if I dont package it using maven (but just quite annoy)
you can check i suppose.
why are you packaging a jar file into your jar file


