#help-development
1 messages · Page 1889 of 1
i searched ContainerMeta and Shulker(Box)Meta
Check the docs
alr
Actually no that only shows blockdata type
can i maybe create a virtual block data and then get the item from it?
How would I be able to check for an ItemStack lore?
I tried searching but cant find anything
Get the meta and check the lore there
alr
actually its a block state'
how can i get the default block state from a material tho
what should I use, Math.random() or ThreadLocalRandom.current.nextInt()? I mean, whats more efficient and better?
Don’t think there really is a default state
Empty I guess, since state stores NBT data
Model data?
@EventHandler
public void onTamedAttack(EntityDamageByEntityEvent event) {
Entity attacker = event.getDamager();
Entity defender = event.getEntity();
if (attacker instanceof Projectile projectile) {
ProjectileSource source = projectile.getShooter();
if (source instanceof Player shooter) {
attacker = shooter;
} else {
return;
}
}
if (!(attacker instanceof Player)) {
return;
}
if (!(defender instanceof Tameable tameable) || !tameable.isTamed()) {
return;
}
event.setCancelled(true);
}
And if this is still too nested you should outsource checks to other methods.
@EventHandler
public void onTamedAttack(EntityDamageByEntityEvent event) {
if (hasAttackingPlayer(event) && hasTamedDefender(event)) {
event.setCancelled(true);
}
}
private boolean hasTamedDefender(EntityDamageByEntityEvent event) {
return event.getEntity() instanceof Tameable tameable && tameable.isTamed();
}
private boolean hasAttackingPlayer(EntityDamageByEntityEvent event) {
Entity attacker = event.getDamager();
if (attacker instanceof Projectile projectile) {
ProjectileSource source = projectile.getShooter();
return source instanceof Player;
}
return attacker instanceof Player;
}
This way your code gets more clean as the methods really tell you what they do.
15 method complexity
?bootstrap
Bootstrap Jar
The main spigot-1.18.jar is now a bootstrap jar which contains all libraries. You cannot directly depend on this jar. You should depend on Spigot/Spigot-API/target/spigot-api-1.18-R0.1-SNAPSHOT-shaded.jar, or the entire contents of the bundler directory from your server, or use a dependency manager such as Maven or Gradle to handle this automatically.
Please read the release notes for further information: https://www.spigotmc.org/threads/9-years-of-spigotmc-spigot-bungeecord-1-18-1-18-1-release.534760/#post-4305163
Huh that doesn’t actually mention NMS
Anyway you want whatever jar is largest inside spigot-server
Or use a build tool
is it possible to create an texture+signature ?
Path is probably wrong
but it is correct?
placed_blocks
in config
also here its correct
Show the config
it returns 0 in mc
in ondisable?
You dont need an NBTInputStream. Try just using the example from their documentation page.
still returns 0
Why would you do that on disable
You want to copy the config from inside the jar on enable
sure will do on on enable
now i have this. still returns 0 (in on enable)
would this work?
public void hasLore(Player player) {
for(ItemStack item : player.getInventory()) {
if(item.getType() == Material.DIAMOND_CHESTPLATE && item.hasItemMeta()) {
ItemMeta meta = item.getItemMeta();
if (meta.hasLore() && meta.getLore().equals("Gives you the invisibility effect")) {
player.addPotionEffect(new PotionEffect(PotionEffectType.INVISIBILITY, 10000000, 1));
} else {
player.removePotionEffect(PotionEffectType.INVISIBILITY);
}
}
}
}
}```
You can use contains
o
You only this this.saveDefaultConfig();
What did you even name ur config?
config.yml?
anyone know the dependency for packets?
Probably
Is it better to use Math.random() or ThreadLocalRandom.current.nextInt()?
i usually use ThreadLocalRandom
it uses a random instance on each thread
so every thread has a diferent seed
And what do I do if when I add a potion effect with an threadlocalrandom random amplifier it sometimes makes the effect level 101
Even tho max is 11
Then you’ve done something wrong
^
thankyou so much! this was really helpful
It was something like and what could go wrong? It did
p.addPotionEffects(new PotionEffect(PotionEffectType.HEALTH_BOOST, 120, ThreadLocalRandom.current.nextInt(11)));
Are you sure your client mod showing you the number isn’t just broken
Or you are overriding it with a higher effect somewhere else
ok i have a small question about the api; if my plugin relies on features that probably work in really old versions, how do i make sure my plugin stays compatible with the latest versions but doesnt break on 1.18 if i update it for 1.19
if that makes any sense?
Hmm not sure. I sure didn't had any effects at all. The client mod to show the number I'm using is lunar clients gui so idk
by testing
things can break in updates, just test it
ok so i need to test it, but if i have the api version set to 1.18 and depend on the 1.18 spigotapi
will spigot complain if i try to use it on 1.19
like warnings errors etc
assuming they dont
Shouldn't I think, as long if the features you use aren't deprecated in 1.19
so when minecraft updates, i dont need to make any changes until the spigot api doesnt change anything i use?
eactly
exactly*
Yes
thanks for the help
Maybe a version mismatch between the schmatics
You want to support versions below 1.13?
How do I check for a players potion effects?
Player#getActivePotionEffects()
Thx
i'd use an event really
to debug your problem
declaration: package: org.bukkit.event.entity, class: EntityPotionEffectEvent
Ok
why would you
why use legacy? People create new and better, legacy is old and worse.
is there a limit on the length of the message you can send to a player using #sendMessage("STRING")
Probably yes
how big?
Not sure
do u know a place where it might be specifie
maybe the docs
How many letters that you want to send anyway?
I dont think its bigger than 256
it's 256 yeah
Spigot
Unfortunately, your recent report has been rejected: Resource Update in '✪ LuckyStock ✪ [1.16 - 1.18] Unique | GUIs | 50+ Stock | 120+ News' - Description contains substantive text in images without having a text version available.
Is someone know this issue means?
Where'd you get that?
Your plugin page needs to have a text version too
Yes I do have it
how can I contact them
Isn't 256 chars is the chat message?
they rejected me twice and the first reason is no text version
Like the limit when player type in the chat
oh yeah
pretty sure its 32767 bytes
btw the config still resets every time... this is the way i get the variable
then
that's strange
any errors?
and this is the way i increase it
no errors, it works fine, it just resets on every reload
oh ofourse
you need to save the config
so you can do
getConfig().setInt("x", value);
as you just get a value from the config, you need to give it back
bot i do that
do you do saveConfig()
do the normal one yeah
You need to save it everytime you set a value.
saveDefaultConfig is usually used for the first loading
always saveDefaultConfig() at the beginning of onEnable(). After any changes you make, saveConfig()
ohhhhh
did someone else notes that since 1.18 when a player hits another player the UseEntity packet is sent from the client but it contains no action when it should contains ATTACK, or did only I notes that?
Hello, could someone explain to me why does zombies spawn at end of block?
Zombie z = (Zombie) world.spawnEntity(location, EntityType.ZOMBIE);
because you need to center the location
How do i do that?
Add 0.5 on both x and z
ok
My name is Walter Hartwell White. I live at 308 Negra Aroya Lane, Albuquerque, New Mexico, 87104.
loc.add(0.5, 0, 0.5);
??
your pfp
yeah
ok tysm
anyways, the variable in config also defaults to 10, EVEN THOUGH I HAVE SET IT TO 0 IN INTELIJ
and deleted the config
clean the project
wdym
am I missing something? maybe its a ProtocolLib bug?
then your config has it set to 10 and you are not changing/saving it
aka decompile?
its blank
set it to 0
oh
the copydefaults(true) line is not needed at all
lets see
Add it to the config.yml and compile
saveDefaultConfig() shoudl be at teh very Beginning of onEnable, before you attempt to do anything with your config
did you forget to save the config?
You must be setting it to 10 somewhere
delete the config.yml from ur server files and restsrt the server
ok
you are setting a Default value. That is only used when an actual value is not present.
Show some code
what code?
To where ur setting blocks placed
its acc block break event. but i will organise later
You update teh value you got from teh config, you never put it back
yes
Which versions of the api does bstats work for?
I'm getting
Error occurred while enabling HeckStopGrowling v1.0.0 (Is it up to date?)
java.lang.NoClassDefFoundError: org/bstats/bukkit/Metrics
You need to shade it.
shade?
Are you copy pasting the class or using the maven dependency?
uh ive depended on it in gradle
dependencies {
compileOnly 'org.spigotmc:spigot-api:1.18.1-R0.1-SNAPSHOT'
implementation 'org.bstats:bstats-bukkit:2.2.1'
}
unsure if i need compile or implementation yet but either way i still have problems
Compile it with shadow jar
what does shadowing do?
Basically adding the classes that you want to be added into your project.
I don't know how to explain it properly.
So when you haven't shade it (bStats in this case), the class is not exist on the compiled jar, so that's why it's giving you NoClassDefFoundError exception.
but why dont i need to shadow spigotmc?
Because the spigot is exist on the runtime
sorry idk how this works
You're using it on your server
right
That make sense right?
Meanwhile the plugin doesn't know where bStats is so you need to shade it so it exist on the compiled jar
Hello, i have error with gradle for spigot
> Could not resolve all files for configuration ':compileClasspath'.
> Could not resolve org.spigotmc:spigot:1.17.1-R0.1-SNAPSHOT.
Required by:
project :
> Could not resolve org.spigotmc:spigot:1.17.1-R0.1-SNAPSHOT.
> Could not parse POM https://repo.dmulloy2.net/repository/public/org/spigotmc/spigot/1.17.1-R0.1-SNAPSHOT/spigot-1.17.1-R0.1-20210708.170253-1.pom
> Could not resolve org.spigotmc:spigot-parent:dev-SNAPSHOT.
> Skipped due to earlier error
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
i use Shadow for compiling
the version is latest, it now sets the number from the ide. now i need to edit it
yeah i think so
is there a good example of shading java in gradle with spigot plugins
i cant find somewhere simple to learn it
i did find this but i cant work out which parts of the shadow stuff are custom and what i need https://github.com/jpenilla/WanderingTrades/blob/master/build.gradle.kts
this is the code currently. it only changes something once the plugin gets reloaded
Take a look at this, this is one of my project that use gradle. https://paste.md-5.net/iqomefiloj.cs
saveConfig() not saveDefaultConfig()
tried that. doesnt work
i think ive got it now?
tasks {
build {
dependsOn(shadowJar)
}
shadowJar {
minimize()
relocate("org.bstats", "dev.lhvy.heckstopgrowling.lib.org.bstats")
}
}
Your blocks value will stay the same because you didn't do anything about it, and you're setting the same value on the config.
How can I send the player a message in which theres a link he can use to open a GUI
ok the issue is solved
gg
does EntityDamageEvent include all damages?
also if damaged by entity?
does the event still trigger then?
is there a way to fix this?
u could name the methods accordingly
Needs an actual type
like uncacheKey and uncacheValue
ah uhm that fixes it
when compiled teh Generics will be erased so both methods look identical.
but can i fix it without specifying the generic type?
no java kinda sucks in that regard
if i do this, what should my import be for bstats?
like in the java file
normally i just copy the bstats class?
works fine for me
then no import is needed
im depedning on it in gradle
and then tryng to import it in java
but then i get an error and i was told i need to shade it
so now im struggling through that
How can I open a GUI when a player clicks on a message (I have the TextComponent but dont see a option in it for opening a GUI)
Alright so there isn't any way or like a stupid way to check if player has stopped left clicking?
Yup but it only gets sent once :/ So I can't check if they stopped holding left click
Yea then I think there aint a way
ugh- I'd use right click but since im using a charged crossbow there is always like an ugly animation since im trying to cancel it
dont know if there is a way to completly remove it so crossbow doesnt charge and just stays still
it works!!!!!!!
Maybe the same as the relocated location
Just try both maybe
the relocated one doesnt really let it compile
ok so apparently after relocating, i just need to make sure i use the .jar that has -all on the end
and thats the one with the shaded libs
and it works fine
ugh i will need to do some more reading of docs soon to understand this better
well anyway thanks for all the help
i now have a very minuscule demo plugin that works! https://github.com/lhvy/HeckStopGrowling
if a player doesnt have access to a command you execute it through a TextComponent.Click does it execute?
so sorry for the mess of questions with shading and basic spigot api stuff...
I don't think so, perhaps make the command executable from console
https://github.com/rookieCookies/CreateFile/blob/main/CreateFiles.java
hey can someone give feedbac
the important part is the createFile func
what r u trying todo
I mean simplest way would be to rename one of them to sth like uncacheByValue
Yes because if not how anticheat will detect autoclicking?
That happens when the player sends a lot of left clicks
not when he is just holding it
I think I had an anticheat for checking your current cps
Uhh sorry I didnt know
having two methods to remove something by id and by value
Is there a way to prevent charged crossbow shooting? I tried to just cancel the event but then there is like an ugly animation because he's constantly trying to shoot it .-.
run it as a command?
theres always a risk of the player finding the command to open it
Maybe try to make a command so it takes a player as a parameter and only an operator can run it
so console could send it for you
But that is not possible
you cant execute a command form the console using a TextComponent.clck
you can?
how
one way would be differentiate said types in type constructor by making one derive a marker interface
tho really, a refactor would do as well
message.setClickEvent( new ClickEvent( ClickEvent.Action.RUN_COMMAND, "/kit FNALFHLAJFLhjdkla " + s ) );
wont that run it as the player?
it will, but consider the following
create some kind of hashmap thing
on text send, create a specific UUID for the player
@trim creek ask your question here, you'll get a better answer
and make that the command, like /command UUID
then on execute, check if it's correct. if it is; execute the command from console
no one will ever guess the UUID
is there a datastrcuture like a map but with multiple keys
Are you talking about Multimaps
Anyway to disable item animation on right click?
Animations are client side. If canceling the event doesn't work you can't
So could I detect when player stops holding a left click using only a client mod?
@trim creek so what you should be doing
is building spigot via buildtools, take that compiled output and depend on that
OR use something like maven and just use the api
(which is what id recommend)
I am dumb for maven. 🤣
The home of Spigot a high performance, no lag customized CraftBukkit Minecraft server API, and BungeeCord, the cloud server proxy.
And another fact: I use Eclipse, but thank you...
Wait. Setting a displayname will overwrite the nametag?
https://github.com/rookieCookies/CreateFile/tree/main
can someone give feedback
nametag sets the display name...
so yes if you set a display name it will overwrite that
Hm
This is weird, because now I removed all the setDisplayname codes, and it is still dead.
It still does not do anything.
Just creates the team, and applies its effects
hi guys. my command arguments are not suggested when i type the command. what should i do in the plugin.yml for it?
when i just type "mor" it suggest "morexp reload" but when i type "morexp ", then it doesnt suggest reload argument
probably its because i defined them as separate commands in the plugin.yml
if you type /morexp r then push tab does it autocomplete?
no it doesnt 😦
commands: morexp: description: Main command usage: <command> morexp reload: description: Reloads the plugin usage: <command> permissions: morexp.reload: description: Reloads the plugin default: op
its probably wrong
how should i define the arguments then?
oh okay thanks. i will try
for oracle cloud waiters, frankfurt compute is open
make sure to claim yours until its too late
god bless intellij for making switch java versions this easy, I would lose my mind having to constantly relaunch servers with different java versions
declaration: package: org.bukkit.command, interface: TabCompleter
So basically... I removed every setDisplayName code that affects players... What else I need to remove, because it still doesn't works...? :c
I'd die if I had to restart intellij after figuring out the MESS of my PATH, having to spend like 20 minutes changing my fkin java version lmfao
so I'm trying to spawn fully grown wheat block but
e.getBlock().setType(Material.WHEAT);
only spawns wheat of age 0
how would I set it to be fully grown?
oh damn it I baited myself with a feature that didn't exist for java 8
I knew this sounded super new to me
declaring variables while running an instanceof is so cool, too good to be true I guess
check if the blockdata is an instanceof ageable then set the age to maximum age
oh yeah, thanks!
:D
yeppers, java 16 feature iirc
which was the update that started updating java, was it 1.16.5?
1.17.1 I guess
1.16.5 recent versions support java 16
dang
At least that is a version that requires Java 16, but not sure with 1.16.5
1.18 uses java 17
I'm still technically supporting 1.14 and up
1.16.5 supports java 16 but you can use anything from java 8-java16
(me who only supports only 1.18.1 c.c)
though
iirc
a shocking 47% of my users are actually on 1.18.1
Ey I have installed java16 some time ago to run mc 1.17.1 servers
Oh. So 1.17 is the one that forces Java 16, and 1.18 forces Java 17.
I think you can compile plugins on 1.8 and they still work on 1.18 tho
Right?
I don't know what 1.17 forces, never played it
possibly because I distribute maps and those have harsher requirements, and it's targetting survival servers which tend to update
Forces 16 as I know
I've heard of java backwards compability but I'm not sure
hm 95% of my userbase is running 1.16.5 or later
dont...
you shouldnt make arguments their own commands
I use 1.16.5 only because of some visual mods
I usually just compile against lowest if possible, so most of my plugins compile with 1.8 and they still worked on 1.18
No wonder if it isn't a 1.8 pvp server
actually higher than 95%
Holy moly
Thats awesome if your playerbase aren't 30 players...
actually pretty damn near to 95% nvm
uh
I'm talking servers
and it's 799 servers currently reporting
his plugin is popular
not very popular
https://imgur.com/a/Y7U2PzR
Is there a method I can use on a player object to change the name displayed above the head?
What if it was 799 pvp servers (1.8 pvp)? 99% 1.8?
plenty of much much larger plugins out there
hell I could probably make a plugin with more installs in under a week, just make something with very broad appeal
Scoreboard teams. I am messing with ths too
cool I'll look into it
I have been setting the player's displayname, and now, it never displays it, when my plugin is enabled.
weird.
But note that it will change the player's playerlist name too
(which is something I also set)
I honestly have never even known exactly how the minecraft teams thing works.
teams suck
Got a vague idea, but i never mess with it
A good 1.8 pvp plugin, I've seen some but they were like oof, the main stuff was good, the other stuff was bad coded. And no one would like to setup a server on 1.8
that's perfect for me.
they really weren't made for the thing we use it for
Then how would you make nametags?
teams are one of those things that were added in ancient times and haven't been touched since because there's been no reason for them to be touched
I mean, like the one Hunter has been asking for
it's not outside the realm of possibility to use armorstands to do it
a lot of plugins do it
libsdisguises recommends it over normal nametags actually
Lol
if it's not broke, why change it? Sounds good to me.
I can't get it. .-.
iirc a ton of people use packets for it
nevermind if it ain't broke, if it ain't used why touch it
I don't even know of anything that mojang has actually created using teams
For nametags? It would require ProtocolLib then, doesn't it?
how can I modify packets to change a player's above head name?
that's how libs does it
Well... Then I will need to figure out mostly everything...
personally I sync my damage indicators with the entity location and it works wonders
Probably will try disabling the join event class
but then again that style of display doesn't need great accuracy
Will be back
Is there a discord for help with coding Minecraft Mods? Also, is it more difficult to develop mods than plugins?
yes, it is harder. There's Forge ans Fabric discords
is it actually harder?
yes
Even if you have a solid understanding of java?
I feel like I spend half my life trying to stretch existing minecraft assets into more minecraft assets
Then not much
I personally have a lot of room for improvement, but I feel I have a solid base understanding of java.
I have little less but almost the same
It requires understanding of how game works
Modding requires a good understanding of java. There isn't much documentation and a big part is understanding how things work and reading the code
"Use your IDE"
- Someone from mc modding server
modding hurts me
I am a flawless master of java who truly has transcended this mortal realm with my 5000 iq understanding of java
simple mods arent hard to do, but if you do something more advanced.. Welcome to reverse engineering
I don't see code anymore, I see NPE, CME, stack overflow....
The hardest kind of modding is making an all-in-one mod
all in one solutions always suck
a lot of forge "guides" are as follows:
"Read the X Minecraft class to see how they do it"
I'm personally getting pretty tired of vanilla limitations. I want to be able to add more armors, I want to add more NPCs, I want larger GUIs.
tbf that's probably good advice
it is
"Use your IDE"
- Someone from mc modding server
Thats how you do mods no shit
people get angy when they're told there's no documentation
I mean not always but it helps
spigot documentation spoils you 😔
You may need to ask someone to get started but it's just the start
couldn't they just use the IDE and look at other's source code though? Also asking for help in the Mc Modded discords should be enough?
And some minecraft blocks
except for the few bits of the API which do not because the last time a human looked at it was probably 2010
bukkit conversation api
It is useful though
you can see where it gets sketchy when the names aren't standardized and some of the fields are named the inverse of what they became
the only thing bukkit conversation api has is something the original guy wrote afaik
some parts of the world gen stuff was like that last I saw it
Before I've even learnt java looking at code seemed like "what the sh.t is this I'm never gonna be able to write that" and now I do
bukkit is ancient 😔 its like how when they added the #addPassenger() method and deprecated #setPassenger(), #addPassenger() didn't have the check for if you do entity.addPassenger(entity); so it'd crash the server kekw
took a long time for that to be noticed
quick what's an mc world type and what's an mc world environment and what's the correct value for setting it to amplified, you have 30 seconds
💣
is this a trick question like how weather has a misleading name in code
I mean if you find it intuitive and can guess correctly I guess it's not a trick question to you
I genuinely don't know and I've been had by this issue quite a few times
Is records slow?
I think env is the nether, normal and the end (and custom, for the server versions that aren't bugged) and the other one is the setting you'd need for amplified and superflat but I could have it backwards
iirc both have NORMAL in them so it can get real hilarious real quick
nope
Hello !
Does someone have a json file with all 1.18.1 items and textures data ?
There's more than one json file
It exists one file for previous versions, so maybe a file for new version exists
is a bimap less efficient than a hashmap or is it about the same?
I'd expect it to be about the same
You could benchmark it though
i'l look that up
Is Bukkit#getOfflinePlayer really a heavy task?
ah it has two reversed maps internal, i thought they were only reversed when an application asks for it
if it has to find a player that hasnt been on the server before, yes
^ and depends on internet speed
Oh okay
does a method that takes UUID makes a web request aswell?
Right now I'm testing a reputation plugin, and I think that's the cause because I'm trying to search offline player that hasn't been on the server.
lemme look into paper
If the offline player has joined the server before, it will all be fine, correct?
yep
Alright, thank you guys
but how did it get user's nickname
It doesn't
it creates a gameprofile i guess
@Deprecated
public OfflinePlayer getOfflinePlayer(String name) {
Validate.notNull(name, "Name cannot be null");
Validate.notEmpty(name, "Name cannot be empty");
OfflinePlayer result = this.getPlayerExact(name);
if (result == null) {
GameProfile profile = null;
if (this.getOnlineMode() || SpigotConfig.bungee) {
profile = this.console.getUserCache().getProfile(name);
}
if (profile == null) {
result = this.getOfflinePlayer(new GameProfile(UUID.nameUUIDFromBytes(("OfflinePlayer:" + name).getBytes(Charsets.UTF_8)), name));
} else {
result = this.getOfflinePlayer(profile);
}
} else {
this.offlinePlayers.remove(((OfflinePlayer)result).getUniqueId());
}
return (OfflinePlayer)result;
}```
public void addToAdmin(Player player) {
Scoreboard scoreboard = Bukkit.getServer().getScoreboardManager().getMainScoreboard();
if (scoreboard.getTeam("admin") == null) {
scoreboard.registerNewTeam("admin");
adm.setPrefix("§cA §8| §f");
adm.setColor(ChatColor.WHITE);
adm.addEntry(player.getName());
}
}
This code should work, right? Or I messed up something?
Yeah I'd expect that
You're only adding players to the team if the team doesn't exist
are minecraft servers running on one or multiple cores?
make sure you get an existing team or create it
and if they are on one, is that bad or good?
it only has 20 tps so i dont think its bad
Isn't scoreboard.registerNewTeam("admin"); the creator code?
idk what adm is
It is the Team adm; string a bit upper
do something like Team team = scoreboard.getTEam("admin")
if team == null team = scoreboard.registernewTeam
Can I somehow increase the max tps from 20 to 30 or 40 or like that?
and then apply the things to it
Yes but why
main thread runs on a single core, but it's only 20 tps so it's not a crazy heavy workload
I wanna make the game (and my friends pc) go crazy
i think you need a fire insurance
Is it even possible?
Yeah
Yeah and multiplayer
HOW?!
Can I load plugins into my mc client? Because when you load a world it create an internal server
no lol
Use datapacks
no
that loads a vanilla server whereas you need a spigot server to run plugins
my ProxiedPlayer.connect(ServerInfo target) isnt working. The player is already on the network when i call this
Then make a mod for that?
there is no bukkit interface to depend on
no thanks
i don't even know modding if i did want to do that
Things like magma and mohist work. Why not try moving them into the client?
monkaS
Actually. To my problem: Her's the code:
public Team adm;
Scoreboard scoreboard;
public void onJoin(PlayerJoinEvent e) {
Player player = e.getPlayer();
if (player.isOp()) {
addToAdmin(player);
}
}
public void addToAdmin(Player player) {
Scoreboard scoreboard = Bukkit.getServer().getScoreboardManager().getMainScoreboard();
if (scoreboard.getTeam("admin") == null) {
scoreboard.registerNewTeam("admin");
adm.setPrefix("§cA §8| §f");
adm.setColor(ChatColor.WHITE);
adm.addEntry(player.getName());
}
}
mohist
Ik
u only add someone to a team if the team "admin" doesn't exist
How would I check if a player took knockback from a hit when wearing netherite armor with knockback resistance
Ah ####.
dont expose variables ._.
olivo mentioned that earlier
:)
get their velocity when they're hit
well
maybe 1 tick after
if (event.getDamager() instanceof Player player) {
if (event.getEntity() instanceof Player target) {
if (target.getVelocity().getX() == 0 && target.getVelocity().getY() == 0 && target.getVelocity().getZ() == 0) {
target.setVelocity(player.getLocation().getDirection().multiply(0.5));
}
}
}
Didn't work, so ig 1 tick after?
try 1 tick after
quick question, in PlayerGameModeChangeEvent
e.getNewGameMode is the game mode that player changed in to
and e.getplayer.getgamemode is the old gamemode right ?
correct
i would do ```java
@EventHandler
public void onJoin(PlayerJoinEvent event) {
if (event.getPlayer().isOp()) {
addToAdminGroup(event.getPlayer());
}
}
private void addToAdminGroup(Player player) {
Scoreboard mainScoreboard = Bukkit.getScoreboardManager().getMainScoreboard();
Team team = getTeam(scoreboard);
// apply other stuff
}
private Team getTeam(Scoreboard scoreboard, String name) {
Team team = scoreboard.getTeam(name);
if (team == null) {
team = scoreboard.createNewTeam(name);
}
return team;
}```
¯_(ツ)_/¯
you op your admins 
is there a way to give knockback to all entity is in front of me
Hello, I did that to spawn an entity but I don't see the entity on client side, do you know why pls?
world = ((CraftWorld) location.getWorld()).getHandle();
if (world == null)
return null;
result = new EntityEscortedEntity(world);
result.setLocation(location.getX(), location.getY(), location.getZ(), location.getYaw(), location.getPitch());
world.addEntity(result, spawnReason);
(I need to use nms because it's a custom entity)
Show code for custom entity
This still is errored.
thats not pastebin ._.
Hello guys im trying to code a swear filter plugin And the bad words are not quite triggering. Whats wrong with this code - https://pastebin.com/ZktBU7nS
I did at onEnable
um command to reload the plugin
ArrayList#contains is something
??
he want to see if the message contains a badword
not if the message is only a badword
instead of ```java
for (int i = 0; i < bannedWords.size(); i++){
if (msg.contains(bannedWords.get(i))){
event.setCancelled(true);
Bukkit.dispatchCommand(console, command);
}
}```
use java if (bannedWords.contains(event.getmessage())) { // other stuff }
ah
if my message is "Hello man ***", you don't want to compare the full sentence
or else it will bypass every message
ah wait
you need to see if the sentence contains each badword in the config
this doesnt makes sense
so you need a loop
exactly
ah my bad why am i still coding
:(
but whats not working?
it just doesnt trigger?
yes whenever i type a bad word nothing happens
it just shows the msg
while it should not
also i think you should break out of the loop
first you can loop all the String list
it's better than getting them by id
and I don't understand why you dispach a command?
i dont either
yes
why reloading plugin if the user typs a bad word??
to reload the config
that means when a user type a badworld your plugin will stop working
probably
but i used the same code in my others plugin and it did reload my config
nono the reload command is for me. whenever i add a new badword in the config rather than restarting the whole server i can just reload the config
fu3ck
but it reloads (a part of) your plugin in the chat event?
idk what drugs fourteen is on
Custom Entity invisible client side
the command inside the chat event is a mute command which will run as console when a bad word is triggered
well you said me this
sry my bad
wanna have some 😳
guys any clues how to fix event not triggering?
debug a bit
did you register it
command is working but bad word not triggering
the plugin reload command*
ahh im so bad at explaining things. guess i will find a fix myself
Or you can show us the enable of your plugin and the command code
ok
@vocal cloud
maybe learn java. havent see what you done but this mostly the correct way
?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.
have you debugged the list of words and are sure the words you're looking for are in there?
yes
its there
is the event firing?

I can fix things by just existing
So I'm trying to get the villager profession after it changed profession, how do I do that? Currently I have a event listener, and it activates when the villager changes profession (VillagerCareerChangeEvent), but it activates as it changes, so if I ask for the profession, it returns as NONE, as the villager changed from a plain villager to a farmer.
magic

is there any smart way to find out why i lose 10mb/s of my memory in the server ? xD
learnjava moment
but that returns the villagers profession before it changes
Does someone know why I'm getting this compile error? In the code I can use the package but when I'll compile I'm getting this error..
Did you import the jar directly and then compile with maven
Um no?
Lamo
So you did
And how do I'll import it with maven?
Change spigot-api to spigot in your pom and run BuildTools
Okay
Oh for spigot lol
But now this gets red
Yes
This sounds like a "just learn Java" question but anyway...
Why can't I list the files like this?
File pluginFolder = Bukkit.getServer().getPluginManager().getPlugin("EzBooks").getDataFolder();
pluginFolder.listFiles();
Yeah you haven't ran BuildTools yet
Run BuildTools
Okay
org.spigotmc
pom:1.17.1-R0.1-SNAPSHOT was not found in https://hub.spigotmc.org/nexus/content/repositories/snapshots/ during a previous attempt. This failure was cached in the local repository and resolution is not reattempted until the update interval of spigotmc-repo has elapsed or updates are forced
What's the issue
can you set the combine cost in an anvil?
You still need to run BuildTools ;-;
?bt
pluginFolder doesn't have any "subclasses" (might be the wrong term but you get what i mean, the . stuff)
so i can't list the files
Why do I need to run buildtools?
To compile spigot so you can use it in your project. It's also the only official way to get spigot
Okay
Since you already have the craftbukkit jar means you got it from an illegal upload of it
Currently running
you mean... methods?
I used the Minecraft Development Plugin from Intellij
they are using listFiles which returns File[]
that returns String[]
listFiles is to be called on folders to get their children
Then use file.listFiles();
It does not give you the jar
you need to put this in a method you know that right?
also the ". thingys" are called methods
Use dependency injection don't do that huge Bukkit.... Just pass getDataFolder() from the plugin into it
ah, ty
So I added the spigot jar now
how do I get the entity who reveived the effect?
Don't add the jar directly
How then?
I mean I can remove them?
help?
What event
What should I do then?
EntityPotionEffectEvent
Use maven since your project is a maven project
And how do I'll import the 2 Jars?
This is how
Okay?
So just reload your project
EntityPotionEffectEvent how do I get the entity
By getting the entity whats wrong?
You got the right event in there?
yes
oh it appeared
I didn't added the Jars directly
there you go have fun
Did you build 1.17.1 with BuildTools
Just execute in a cmd?
In which maven LifeCycle its the jar created?
maven is so nice, havent touched build tools in ages lmfao
Yeah
cuz im doing a plugin for auto exporting the jar output to another directory
Because i couldnt find a solution for changing the jar directory
Whenever I pass the inventory click event variables in my own event I lose the e.getHotbarButton variable. In the listener for the inventory click event e.getHotbarButton returns 2 (or any other number that has ben clicked) but whenever I listen to my own event e.getHotbarButton returns -1
Are there any good NPC API's for 1.17 development
nothing wrong with that right ?
Send the code idk why you're redacting it send the whole listener in pastebin
Okay, i am really confused on this (mainly because IntelliSense isn't working on file objects for some reason) but how would i load multiple config files that i could have an unlimited amount? E.G:
/books/rules.yml
/books/anotherFancyBook.yml
/books/anotherFolderForBooks/anotherBook.yml
How would I load all those in a list of FileConfigurations that I can iterate over?
reading screenshots is zzz please use either a paste for longer code snippets or discord code blocks
Afaik you'd have to recursively go through every folder
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.
well yes, but how would i do that, none of the intellasense is working with file objects so i have 1/2 a clue of what i'm doing
anyone any idea why my mvn site isn't working?
...
[ERROR] Generating C:\Users\mfnal\IdeaProjects\JeffLib\target\site\apidocs\index.html...
[ERROR] Building index for all classes...
[ERROR] Generating C:\Users\mfnal\IdeaProjects\JeffLib\target\site\apidocs\allclasses-index.html...
[ERROR] Generating C:\Users\mfnal\IdeaProjects\JeffLib\target\site\apidocs\allpackages-index.html...
[ERROR] Generating C:\Users\mfnal\IdeaProjects\JeffLib\target\site\apidocs\index-all.html...
[ERROR] Generating C:\Users\mfnal\IdeaProjects\JeffLib\target\site\apidocs\overview-summary.html...
[ERROR] Generating C:\Users\mfnal\IdeaProjects\JeffLib\target\site\apidocs\help-doc.html...
[ERROR] 5 errors
[ERROR] 100 warnings
[ERROR]
[ERROR] Command line was: cmd.exe /X /C ""C:\Program Files\Java\jdk-17.0.1\bin\javadoc.exe" @options @packages @argfile"
[ERROR]
[ERROR] Refer to the generated Javadoc files in 'C:\Users\mfnal\IdeaProjects\JeffLib\target\site\apidocs' dir.
[ERROR] -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException
Process finished with exit code 1
Intellisense is not intelligence. Don't rely on it for everything. On that not you just need to recursively iterate over every file and check if it's a directory. If it is then do the same thing to that directory as the main one. Rinse repeat
I finally managed teams to work, but enabling the scoreboard disallows me to see my prefixes (my nameplate will be white). Code:
public void createBoard(Player player) {
ScoreboardManager manager = Bukkit.getScoreboardManager();
Scoreboard board = manager.getNewScoreboard();
Objective obj = board.registerNewObjective("Lobbi", "dummy", "§6Lobbi");
obj.setDisplayName("§6Lobbi §7(" + Bukkit.getOnlinePlayers().size() + ")");
obj.setDisplaySlot(DisplaySlot.SIDEBAR);
Score line15 = obj.getScore("§0");
line15.setScore(15);
Score line14 = obj.getScore("§7Neved §8» §6§n" + player.getName());
line14.setScore(14);
if (player.isOp()) {
Score line13 = obj.getScore("§7Rangod §8» §4§lOperátor");
line13.setScore(13);
} else {
Score line13 = obj.getScore("§7Rangod §8» §6§nN/A");
line13.setScore(13);
}
Score line12 = obj.getScore("§7Érméid §8» §6§n0");
line12.setScore(12);
Score line11 = obj.getScore("§1");
line11.setScore(11);
Score line10 = obj.getScore("§7Jelenlegi szerver §8»");
line10.setScore(10);
Score line9 = obj.getScore("§6§nLobbi§7 (#1)");
line9.setScore(9);
Score line8 = obj.getScore("§2");
line8.setScore(8);
Score line7 = obj.getScore("§enein");
line7.setScore(7);
player.setScoreboard(board);
}
Question: what did I do wrong? :c
full error msg: https://paste.jeff-media.com/?09b4f1bab6c7e548#51QALV7wP7vg5h9hNkmBxcJsY3kx8UzTC84HcFGCxF2s
Post and share your source code or server logs here.
UwU I've been chosen
Wait does this involve a custom spigot fork?
no, I just want javadocs for my library
Hey people finally i have find how to export Maven Project artifact directly to another directory, but its not moving the shaded jar
What i can do???
and it generates the javadocs fine, it's just that it still fails, which means maven stops execution and doiesnt upload the files
I dont even get a proper error message, it just says Error and exits lol
[ERROR] C:\Users\mfnal\IdeaProjects\JeffLib\core\src\main\java\de\jeff_media\jefflib\ItemSerializer.java:95: error: self-closing element not allowed
[ERROR] * <p/>
[ERROR] ^
[ERROR] C:\Users\mfnal\IdeaProjects\JeffLib\core\src\main\java\de\jeff_media\jefflib\ItemSerializer.java:127: error: self-closing element not allowed
[ERROR] * <p/>
[ERROR] ^
[ERROR] C:\Users\mfnal\IdeaProjects\JeffLib\core\src\main\java\de\jeff_media\jefflib\ItemSerializer.java:162: error: self-closing element not allowed
[ERROR] * <p/>
[ERROR] ^
Looks like you did something funky
Fix that and you should be g2g
Fix those </p>
fixed, same thing
I fixed another javadoc error where I used "List<Block>" in the description instead of List<Block>
now it succeeded :3
There you go
thx

I always thought the javadoc plugin would continue on those errors
I too love using § over chatcolor
Naw it needs to be solid
I prefer to use a marker on my monitor to color the text
What is Dpackaging?
I prefer Adventure
Jar, war whatever the packaging is
Okay so just jar?
If it's a jar then yes
okay
Can someone explain this to me please?
(I am working on it since 12:30, and its now 18:36)
uugh @vocal cloud mvn clean site works now, but mvn clean site-deploy still does weird things 😦
https://paste.jeff-media.com/?4eaf170c3cdacaa7#3iQk6fS6eQiPrqwK31DBYzoYbiwWz8JHFLA9kHCdPLnD
Post and share your source code or server logs here.
i shouldnt create the board every time
Caused by: org.apache.maven.model.building.ModelBuildingException: 18 problems were encountered while building the effective model for net.Indyuce:MMOCore:1.6.2
yeah but what can I do about it? I can't just exclude MMOCore. I don't even get why MMOCore's pom must be working just so mine is working lol
am i allowed to send plugin message asnyc
Would this fix the problem? 😐
update the objectives
probably not
I mean I've never encountered this issue but the error it here
[ERROR] 'dependencies.dependency.systemPath' for org.spigotmc:spigot-api:jar must specify an absolute path but is ${basedir}/lib/spigot.jar @ line 115, column 19
[ERROR] 'dependencies.dependency.systemPath' for com.bekvon.bukkit:Residence:jar must specify an absolute path but is ${basedir}/lib/Residence.jar @ line 122, column 19
[ERROR] 'dependencies.dependency.systemPath' for com.Zrips:CMI:jar must specify an absolute path but is ${basedir}/lib/CMI.jar @ line 129, column 19
[ERROR] 'dependencies.dependency.systemPath' for com.sainttx.holograms:holograms:jar must specify an absolute path but is ${basedir}/lib/Holograms.jar @ line 136, column 19
[ERROR] 'dependencies.dependency.systemPath' for com.gmail.filoghost:HolographicDisplays:jar must specify an absolute path but is ${basedir}/lib/HolographicDisplays.jar @ line 143, column 19
[ERROR] 'dependencies.dependency.systemPath' for io.lumine.xikage:MythicMobs:jar must specify an absolute path but is ${basedir}/lib/MythicMobs.jar @ line 150, column 19
[ERROR] 'dependencies.dependency.systemPath' for net.citizensnpcs:citizens:jar must specify an absolute path but is ${basedir}/lib/Citizens.jar @ line 157, column 19
[ERROR] 'dependencies.dependency.systemPath' for me.clip:placeholderapi:jar must specify an absolute path but is ${basedir}/lib/PlaceholderAPI.jar @ line 164, column 19
[ERROR] 'dependencies.dependency.systemPath' for me.vagdedes:spartan:jar must specify an absolute path but is ${basedir}/lib/SpartanAPI.jar @ line 171, column 19
yeah they don't know how to use maven
but it can't be tur ethat I can't build the site just because MMO's pom is stupid, right?
You don't make a new scoreboard every time. Imagine if in a soccer game every time they wanted to add a point to the scoreboard they installed a new one. That's what you're doing for starters
No matter if I make an updating one, or a non-updating one, the nametags always disable themselves.
This is kinda already ####### annoying
I mean to me it seems that the only error in this log is MMO 
yeah but that makes maven not deploy my site 😦
and that's the only thing I want to do
lol
What about site:site
or whatever the option is
wtf why is this possible
Cursed
1.18.1
that does of course work, but I need deploy-site 😦
wtf
scoreboards are a pain
Wack idk tbh.
i saw Jordan Osterberg making a wrapper a long time ago
which supports dynamic objectives allocation or something
Do you have another plugin installed that maybe affects it
nein
Only an API and a Core. XD
Both made by me
c.c
I made teams be registered in another class, and the same to the scoreboard.
The teams are registered, but the tablist and the nametag doesn't shows it on me.
All the effects are set
The team admin, instead of admin, shows Rendszergazda in color red.
Its settings are correctly set (never show nameplate, and see players who are invisible, and in the same team)
https://github.com/JordanOsterberg/JScoreboards
maybe this will help
Is this an API?
did you run buildtools
I don't work with APIs
Hello, I'm trying to restore a map by unloading all of its chunks and loading them back again, the problem is when I unload the chunks they get saved so when I try loading them back again the chunks aren't getting restored. Does anyone know how I can prevent chunks from getting saved? The restoring feature works on version 1.8 but it won't work on any versions above that. Here's a pastebin of the world restore method: https://pastebin.com/nkAixcLG if you could help it would be much appreciated.
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.
is there even a remapped version for 1.16.5?
Wasn't that started in 1.17
anyways without that the error keeps sending
like you never have before or just wont work with them?
what?
Will never work with them.
Mostly because they use Maven, which I don't understnad.
that the error is the same without remapped
did you run buildtools?
you should learn maven then
Bruh ignorance is the #1 reason to learn
yeah
That would be only possible with a knife or something. c.c
You will need maven or gradle at one point or another
no
no
?bt
🤣
?bt
I see buildtools
XDD
?buildtools
This is hilarious. XDD
ah damn

this right?
Hmmm
no this
I guess I got an idea... But not seriously sure...
?bt
lol
Time to use my API which I do understand cause it uses a secret type. 🤔
but i have to run buildtools in my pc?
Yes
Secret type?
Yes
lul
With --remapped
he's on 1.16.5
pst
no talking about it
its secret
Give yourself an hour, search for a yt video that explains what maven is and how to use it and then ascend to the next level of development
LMAO
And yet he has remapped-Mojang
that was fast
Lul
Realised I cannot do what I wanted, so I started doing the commands.
I need 'em.
FOR SURE
D:
Don't reinvent the wheel
Hello, how can i set a backend server as default server? (Bungeecord)
I mean that the players are always connecting to this server if they join, not to any other even if they played on another server the last time
Same but after ive read some code of the plugins i did depend on i decided to never use external plugins again.
Now all i need is ProtocolLib.
sometimes that's just what programming means
Same thing for me tbh
But that’s still an external plugin :p
I dont use any external plugins