<Configuration status="WARN">
<Appenders>
<Console name="Console" target="SYSTEM_OUT">
<PatternLayout pattern="%d{yyyy-MM-dd HH:mm:ss} %level %logger{36} - %msg%n" />
</Console>
<File name="File" fileName="logs/app.log" append="true">
<PatternLayout pattern="%d{yyyy-MM-dd HH:mm:ss} %level %logger{36} - %msg%n" />
</File>
</Appenders>
<Loggers>
<Root level="debug">
<AppenderRef ref="Console" />
<AppenderRef ref="File" />
</Root>
</Loggers>
</Configuration>
#help-development
1 messages · Page 431 of 1
With fileName="logs/app.log" Try "logs//app.log"
why are you even putting a log4j in your plugin
trying to modify colors for logger and format
If you mean the bukkit.getLogger, I modify that easier without needing anything extra
how I want to modify color of time stamp and Log.Level
The timestamp is the normal timestamp that your console uses. An don't think you can modify the colours of the log level
Copy the raid world template directory to a new directory with a unique name, load it into the server’s active worlds, then start a new instance of a raid inside it. When the raid finishes, unload the world and delete the directory
Is there a way to get an inventory more specifically something maybe like a persistent data container or something similar to it instead of getting its title? (Clicked inventories)
Yo, have an issue where I'm tracking damage done to a specific mob via EntityDamageByEntityEvent, but my mob is a custom coded boss that sometimes has invincibility frames, however when tracking the damage, it still counts the damage as done torwards the mob. I'm using event.finaldamage to get the final damage done. Any ideas to fix it tracking damage when the mob is invincible?
heres my code
if(event.damager !is Player) return
event.damager.sendMessage(convertColorCodes("&cDAMAGE DONE NOW:&a " + event.finalDamage.roundToInt(), false))
if(!damageHashMap.contains(event.damager.name)) {
damageHashMap[event.damager.name] = event.finalDamage.roundToInt()
} else {
damageHashMap[event.damager.name] = damageHashMap[event.damager.name]!! + event.finalDamage.roundToInt()
}
event.damager.sendMessage(convertColorCodes("&cDAMAGE DONE TOTAL:&a " + damageHashMap[event.damager.name], false))
convertColorCodes is my own function that is just a util function
im coding in kotlin btw
How do i apply a PDC tag to a projectile? I want to check for a ProjectileHitEvent and then create an expolosion there, I just dont know how to set the PDC to the snowball.
Is there a easy way to spawn a nice build house when you type a command? The house is pre-build in my world but its kinda complex
Don't know about your specific problem, but you can refactor all if-else to damageHashMap[event.damager.name] = (damageHashMap[event.damager.name] ?: 0) + event.finalDamage
There is no reason to call containes then get, because map for contains internally just call get and check if its null
Also consider using uuids instead of names
Now to the problem, how do you declare your mob as invincible?
I found out a fix
Thank you for the refactoring though
Hi all. How to make permission with a number? For example furnaceQ.multiply.4 (the number can be changed), and depending on the number there will be a different multiplier for the group
Not the first post
But read the others
How I add a dependency on Maven for spigot from GitHub/Jar ?
either figure out how to use githubs package thing or use jitpack.io
It didn't help me(((
I have added a String permission variable. And still return 1
could you not just better split the permission by . and then take the last argument
i think you would need to add 2 instead of 1 to the last index anyway because this index is exclusive, so it doesnt actually include the number yet this is wrong mb
you mean URL
Yeah.. That...
are there any other "wooden" materials that I forgot?
Hey! I've got this piece of code, but I don't get the new name of the shears. Whats the problem with it?
wdym sorry?
ItemMeta meta = myItem.getItemMeta();
meta.setDisplayName("asd");
myItem.setItemMeta(meta);
getItemMeta() only returns a clone of the meta so you gotta set it back to the itemstack
yes
if you want to suppress the warning for setDisplayName(), you can also use Objects.requireNonNull
ItemMeta meta = Objects.requireNonNull(myItem.getItemMeta());
Thanks man
It works
How to reference to a sheep what is sheared and a baby sheep?
not sure what you mean
Because now I only got getType().Entity.SHEEP done, but I want this to wor on all kinds of sheeps, except mushrooms
You can see it here 🙂
you mean like this?
if(sheep.isSheared()) {
// Sheep is already sheared
}
if(!sheep.isAdult()) {
// Sheep is a baby
}
btw you are not supposed to identify your custom shears by it's name. remember people could just rename it on an anvil
rather use PDC tags to identify your custom shears
alright thanks, I'll try that too
and you want to prevent that?
I want the event to apply on all the sheeps, whether is sheared or not, adult or kid.
Forget the mushroom part sorry 😄
@EventHandler(ignoreCancelled = true)
public void onShear(PlayerShearEntityEvent event) {
Entity sheared = event.getEntity();
if(!(sheared instanceof Sheep)) {
// Don't do anything if the sheared entity is not a sheep
return;
}
if(!isMyCustomShears(event.getItem())) {
// Don't do anything if this is not my custom shears
return;
}
// Now do your stuff, it'll only run for sheeps, no matter whether already sheared or not, or whether it's a baby or not
}
private boolean isMyCustomShears(ItemStack item) {
// Check if the item is your custom shears, preferably with PDC tags
}
Thanks, it'll help for sure
Last question, this my is config.yml, but it doesnt save for the default config...
(after setting the location)
Do you call saveConfig() after changing the config?
after doing smth with .set
But it doesnt 😄
also copy defaults wont do anything if you dont add defaults
Theese are here
are you calling addDefault?
The included config also sets the defaults
No, where should I put it exactly?
Does your config.yml properly get added to your jar?
Is there a way to add custom skins for Villagers or is it only NPC Player Mobs?
Only players
Thank you 🙏
hm, how can I be sure?
change .jar to .zip and go look for it
So yes...
Does it override the defaults, or? I'm not sure why is not working, are you?
delete your config.yml in your plugins/ folder, then try it again
- stop server, delete plugins/YourPlugin/config.yml
- start server
- check if config.yml now includes the defaults
- use your command
- config.yml should now include the default setting AND the location
then you must have some other code that also does sth to your config
nah that's fine
idk maybe upload the whole project to github, otherwise it's hard to debug
but I gotta go in 5 minutes anyway
they changed the minecraft Development plugin UI?
is there some kinda of ai where i can upload my 500 lines long build.gradle and it says me wtf im doing?
not even gradle knows what it's doing, so no
working with ancient code 🙏
im seriously rethinking to rewrite it from the ground up but its just so many files
ah alright when will you get back?
I see they deprecated getWorldType() from World. Any alternatives to determine if a World is overworld, nether, or end?
Hey, if I want to access something inside com.mojang.authlib does this mean I need to use spigot mojang-remapped and correctly export my jar or is there an alternative?
no, just use the authlib maven artifact
Oh, sure
?jd-s
Exactly what I needed, thank you!
Im trying to launch the player in the direction they are facing and upwards, tho its only launching me upwards. What do i do?
https://paste.md-5.net/epilijifey.java
I think your second vector is overriding the first one, you need to combine them
Can't you modify the first vector and add the Y acceleration?
i dont know that is why im asking
How can I use the arguments in the code to be in the config file? For example I have {player} in the config, and I want it to be the same as event.getPlayer() for example.
Try this instead
Vector vector = player.getEyeLocation().getDirection().multiply(100.0);
vector.setY(4);
player.setVelocity(vector);
Can you clarify that a bit? Are you trying to store a player identifier in your configuration file?
So I want it so that when you do for example:
message: "{player} is now green!" in config.yml
it will send in game the name of the player that I have stored in the code aka:
Player player = e.getPlayer();
does that make sense
I see what you're trying to do, but that won't really work. I would do this in your config file:
message: "%s is now green!"
I'm not sure where you're showing that message in the code, but as an example:
String message = plugin.getConfig().getString("message");
Player player = event.getPlayer();
Bukkit.broadcastMessage(String.format(message, player.getName());
There's null checking you need to do there, but that's the general idea
Is that the only way
String message = getConfig().get("message").replace("{player}", player.getName());```
err
You can do that, by why not just use String.format?
That's what comments are for 😄
true, but loads just dont read them
So you're getting the message and replacing the "{player}" with the other string which is the player, correct?
yes
when player was kicked then playerquitevent is called?
Yes, kicking a player triggers PlayerQuitEvent
Btw can you replace multiple things with multiple things?
you can trail replaces
You can also use replaceAll if you need to replace multiple occurences of the same thing
Thank you very much 👍
Hey I have a config.yml but whenever I load it up, and execute a command which will et a location in the cvonfig, the default config is gone, can anyone help me?
before
after
you are overwriting your config is all
How so?
string.replace(...).replace(...).replace(...)
config.get("message").replace("{player}", player.getName()).replace("{bank}", something)
Is there a way to check for a MobCollision? Im trying to launch an animal from a player and then create an explosion on collision.
Nope. Best you can do: launch a projectile, make it invisible and mount it with your entity.
is EntityDamageEvent::setDamage setting the final damage? it doesnt say
or rather
idk what 'raw damage' is
No its the damage before the defence calculation
I know, but how can i do to not do that
be sure you save your default config. Can;t really advise without any code
Are you trying to see how much damage the player is taking with armor, or are you trying to do a set amount of damage to the player?
dunno wtf im doing
keeps complaining that it cannot find my lombok generated getters
second
to be specific
i want to apply a percentage reduction to the damage taken
adding useless dependencies
i dont even know
you have no repositories block, and you have the lombok plugin so no need for their deps
Hm don't you still need the deps?
i have 9 build.gradle files lol
Then just reduce the damage on the event... It shouldnt matter if you reduce it before or after the armor has reduced it
I was just thinking, if you're trying to apply a specific damage amount to the player you could just cancel the damage event and use player.setHealth()
with the plugin, no
i just need lombok in the :core module
fucking discord
with the plugin no, (dont quote me on this)
I would set the damage to 0 instead of cancelling it. This way effects like knockbacks still apply and you dont mess with other plugins
it still needs to happen with a damage event for things like being killed etc
other error now lol
i really dont want to handle all the edge cases
Dont use the damage event for detecting kills. We have the EntityDeathEvent for that.
dunno why one of the classes that i import is in the build folder??
i dont think the setHealth has that option
Then just reduce it...
Good point, I suppose the only issue would be if you wanted to reduce the damage taken after armor. You'd still need to know the amount
event.setDamage(event.getDamage() * 0.9);
There you go. 10% damage reduction.
didnt yall say that setDamage was before damage reduction via armor etc
Yes, but that damage will further be reduced by armor
ah
Yes but it doesnt matter if its before or after. Its multiplicative either way.
are all damage reductions multiplicative then?
now it cannot find a class that is generated by the annotation processor lol
not lombok one
You mean armor + potion effect?
I believe they are
alright that makes that viable then
Yeah the protection enchant caps at 80% damage reduction
someone recommend me a plugin that can give me a healer tool for rpg aternos
Is there any way to set a Snowball invisible? or another projectile
Wrong channel
which one
The only issue you'd run into is if the armor reduction calculated by the game isn't a percentage, but rather a set number of hearts
Set the snowballs material to air. (if thats allowed)
sounds like i need to do a bunch of stupid math then
is it only armor or enchantments too? i dont remember
The wiki talks about armor damage reduction. Looks complex to be honest
If you want to realise something like "Reduces incoming damage by 20%" then
simply reduce the damage in the event
That's the simplest way really, it looks like it's all percentage based anyway.
when i use bukkitscheduler for timertask and in the console i have "Craft Scheduler Thread - 23", can a large number of these threads cause some overhead?
ok
But its often a better idea to not spawn a bunch of tasks if they dont need to be run in parallel.
For example if you have a bunch of tasks that can run in series but just not on the main thread
then you should have only one task for them.
How exactly would i go about translating my plugin to be compatible with bungee servers?
Spigot plugins are always compatible with bungee servers... They dont know of each other.
What i want is to listen for certain events like chat messages, player kills etc. on all servers that are proxied
Or do you want the same jar to run on bungeecord and spigot
Any reason for that?
With spigot, i can only put my plugin on one of the servers, with bungee i can put the plugin on the proxy server thats distributing the players, am i understanding that correctly?
Yeah but the proxy should be very lightweight.
It should not have to handle a lot of logic.
What is your overall goal?
Probably want a bungee plugin to handle everything instead of plugins on the sub servers
I basically want to log certain events
You will need a plugin on the server to send the events to the Bungeecord
hmm
So it makes more sense to just have plugins on each server and connect them together?
If its just for logging then let each server write its data in a DB or Prometheus
Im sending them over http to another application
What you want me to do is just tell the application to accept requests from multiple spigot plugins rather then from only a single bungee one right?
How can i set a Snowball invisible?
The application should not talk directly with your plugins at all
Wdym
You should have a middle man like a database is what he means
The application (http server) needs and handles it though
Server talks to DB
App talks to DB
app is not on the server
Or prometheus
i saving data into database i uses async timer task for that, maybe is better way to do this?
Plugins publish events. Applications subscribe to events
i have no idea what a broker is
An application which you can publish and subscribe on
For example Apache Kafka is state of the art.
Or Redis.
Or something you wrote yourself.
So plugin receives chat, publishes it to the broker and then the broker redirects it to all subscribed application
Yes
Alright 👍
You dont need a timer task for that.
Just a normal single shot task.
I'd use a proper caching tool like caffeine to manage expiry tbh
You don't have to worry about size because you can just use spigot libraries feature to download and depend upon caffeine without bloating your jar size
How exactly do I fix this
A loop
For string in lore add a line?
Or

i want in future read values from database by discord bot in other application so i need to save data every one and then
:,]
How would that work
?nocode
It’s hard to answer a programming question without code
Oh no! You ran into a problem. But no worries, people are willing to help, but first they need to see your code. This is because otherwise, they would be providing help based on guesses instead of concrete knowledge. Whether it be a compile error, runtime error, or an unexpected output, I'm sure that if you were to provide code, you'd receive a quick solution.
The message about caffeine was for you
Check it out it deals with expiry and other things for you as well as being a great cache
.
So.. @river oracle? :|
However you do the lore
LeatherArmorMeta Iirc
ArrayList<String> itemLore = new ArrayList<>();
itemLore.add(lore);
Your getting it as a string why?
Your lore is a list
oh
i ask only about best way for make this, i don't need code fix
Caffeine isn't a code fix its a great tool to help you solve your problem
I'd argue it's the best way
Industry tested and proven java library
So you're saying get it as a list from the config?
ConfigurationSection#getStringList
like I know what that is
Bruh
Hey helper help this person I have to go 😎
You are helper you have to help
BukkitWiki
The Configuration API is a set of tools to help developers quickly parse and emit configuration files that are human readable and editable. Despite the name, the API can easily be used to store plugin data in addition to plugin configuration. Presently only YAML configurations can be used. The API however was designed to be extensible and allow ...
Who said they could read
yea bro who said I can read
Hey whenever I try to set a value in my config.yml, the default stuff gets overriden, why is it?
Are you saving the values?
?nocode
It’s hard to answer a programming question without code
Oh no! You ran into a problem. But no worries, people are willing to help, but first they need to see your code. This is because otherwise, they would be providing help based on guesses instead of concrete knowledge. Whether it be a compile error, runtime error, or an unexpected output, I'm sure that if you were to provide code, you'd receive a quick solution.
And reloading
Are you sure you aren't deleting the config file before putting it?
as I said earlier, you have not saved your default config so there is nothing on disc
No, If I run a command /setlocation, then it'll be gone
delete teh top line, it's pointless
alright, but it still overrides it
just saveDefaults
there is no way just setting a section will overwrite a config. show more actual code
im guessing the issue is there is no section its in, and the key doesnt exist already
Is there a check for all blocks that are openable
Like trapdoors, doors, and such
Are those part of a specific type
You mean to get all blocks which are implementing that interface?
nothing in either of those posts would cause your config to wipe
my guess you don;t actually have a config.yml in your jar
declaration: package: org.bukkit.block.data, interface: Openable
Cool lol
last class
I just noticed
That is why I was confused hahahaha
you don;t have a config.yml in your jar
wdym?
I'm going to guess you are using maven but building using artifacts instead
package
side note getdisplayname will throw an NPE if the item has no display name
@hazy parrot Obviously openable doesn't have the same methods as a door
Like, I can't even use getLocation on openable
So I assume I just need to check for all instances individually
You don't have to cast it to openable, just check instance of it
ok delete the config you have on your server in your plugins folder
What do I cast it to then/
Can you show code
Or do I just use the blockData
done
if I need to share a hashmap between two classes (used frequently in one of the classes), would it be better to just make the hashmap public+static, or to make a public+static method on the first class which returns the hashmap
this is in terms of performance
now startup and test it again
Block block = sender.getTargetBlockExact(10);
if (block == null) {
sender.sendMessage("§cYou are not looking at a block!");
return;
}
if (!(block.getBlockData() instanceof Openable)) {
sender.sendMessage("§cYou are not looking at a openable block!");
return;
}
//Here I need to get the location of the block, I guess I can use the block directly?
}
saveDefaultConfig will not overwrite any config which is already there
reloading the server
Yeah, just use block directly, you already checked its openable
Now this is the config now
Yup gotcha! Thanks
and this is the config now when I just typed /setlocation
ok makes no sense, what you are showing is impossible
store the config.yml?
your safeDefaultConfig copies the config.yml from teh jar to the plugins folder (IF) it doesn;t exist.
you have shown that works
Yep
as such you config can not be empty or wiped by set("Location"
its literally impossible
mhm
its possible.
because
it does it
😄
I made an enter at the start and:
its strange, how can I modify it's place
you can;'t
Why is it acting so weirdly
you can adjust the comment locaton
Yeah how?
don;t have it in the default config. add it using the API when you add the location
guys how would i make a custom rpg health system i tried to make one but it didnt work
better, I'll deal with the comments later 🙂
thanks man!
so getConfig().setComments("Location", "you can edit this location");
yes
in the main class?
do that after you set the location
getConfig().set("Location", ...
getConfig().setComments("Location", new ArrayList<>("you can edit this location"));
getConfig().save();```
it wants a list
however you want to do it
don't forget a new line at the end of your default config
how can I get first item that has on of Material in array?
oops
just at the end?
Maybe 😄
like that:
You can use the || operator with a Material, you can only use that with booleans
looping through it and stop on first found
okay, thanks
suggesting to use stream api
The .first method will return -1 if that item isn't present, so you need to do this instead:
if(inv.contains(Material.STICK))
ItemStack itm1 = inv.getItem(inv.first(Material.STICK));
yes, i made it before
I don't think you are understanding what he wants
Did you mean "on" or "one" in your original question
i mean first() with list of materials. So if I have in inventory Diamonds and Coal, i need to find, which is first
Just loop over inv or use stream api
heh
Guys, please help. I want maven to automatically select the version for the project + for plugin.yml. How can I achieve this?
resource filtering
and in plugin.yml set version to version: '${project.version}' iirc
now it just tells me it cannot find the getter methods i generated with @Getter
trash gradle
stop breaking stuff
And for changing in maven file, I just use sed in any kind of ci/cd
Maybe you know some guides? Specifically for maven, since everything turned out to be easier with plugin.yml
https://github.com/GoksiOrg/TabbyControl/blob/main/.github/workflows/publish_release.yml this is how I do it while publishing release
And check my plugin yml
why are you manually running buildtools
Why not
fair
It's basically same as adding another third party action
They are doing same thing anyway
wait untill you find out about https://repo.codemc.io/#browse/browse:nms
Nexus Repository Manager
org/spigotmc/spigot
just need to add the mojang repo
Well that can significantly speedup workflows, didn't think of it Mao
maybe this could help
still cant find methods generated by annotation processors 💀
and i have no clue what im doing
like what is this crap
because you are printing before the task actually started?
ye ik but there is another weird thing where the first if statement of the Event onPlayerInteract is never true
I would use a different approach to this.
Create a runnable which is started in your onEnable.
This runnable contains a collection of players.
OnCommand add -> add player to runnable
OnCommand remove -> remove player from runnable
On logout -> remove player from runnable
public class TargetDisplayTask implements Runnable {
private final Set<Player> activePlayers = new HashSet<>();
public void addPlayer(Player player) {
this.activePlayers.add(player);
}
public void removePlayer(Player player) {
this.activePlayers.remove(player);
}
@Override
public void run() {
for (Player player : this.activePlayers) {
this.markTargetBlockFor(player);
}
}
private void markTargetBlockFor(Player player) {
// Some logic
}
}
Pretty much like this
This runnable starts once and is never stopped.
Main benefit here is: You never have to worry about managing a ton of runnables.
You simply add and remove players from this single runnable.
ok so the runnable is always running but not for every player right?
so i can add and remove them
Right, you have just one runnable. This is started in your onEnable.
ok
How can i make a bell ring? I tried using NMS packets but it is not working
Pastebin
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.
and in this runnable is just nothing?

why did you implement the Runnable?
so you can start it easily
So that you can schedule the runnable using the BukkitScheduler
Again, no clue why we have no API for this. wtf? lol
Time to open a PR this morning!
can i just implement it in my main
But how can i do it using NMS?
I'll tell you in about 2 minutes when I implement the API
Ok
Though in a few days when it gets merged, I urge you to use Bukkit methods
private TargetDisplayTask displayTask;
@Override
public void onEnable() {
this.displayTask = new TargetDisplayTask();
Bukkit.getScheduler().runTaskTimer(this, displayTask, 5, 5);
...
}
bet its those 2 structure rotation bugs in vanilla
Maybe
i cant import TargetDisplayTask
Witch methods can i use from bukkit to do this?
Well when the methods are implemented he’ll tell you :p
None. I'm adding them now
Did you even create a TargetDisplayTask class?
oh lol haha im lost
?
little did he know, the plugins that i send to my orderers before they pay have a "time bomb"
good luck bozo
what kind of time bomb
well basically a seven day time bomb that will kill some server files like the world and plugin configurations
do you just have a scheduelr to check if its been like 3 days
In the meantime,
CraftBlockState state = (CraftBlockState) block.getState();
if (state.getHandle() instanceof BlockBell bell) {
net.minecraft.world.level.World world = (net.minecraft.world.level.World) ((CraftWorld) block.getWorld()).getHandle();
EntityPlayer player = ((CraftPlayer) player).getHandle();
BlockPosition position = BlockPosition.containing(block.getX(), block.getY(), block.getZ());
bell.attemptToRing(player, world, position, EnumDirection.NORTH);
}```
This will probably work
sounds like trouble
I wrote that all in Discord though so don't quote me lol
Might need to change World to WorldServer or something
"```java
CraftBlockState state = (CraftBlockState) block.getState();
if (state.getHandle() instanceof BlockBell bell) {
net.minecraft.world.level.World world = (net.minecraft.world.level.World) ((CraftWorld) block.getWorld()).getHandle();
EntityPlayer player = ((CraftPlayer) player).getHandle();
BlockPosition position = BlockPosition.containing(block.getX(), block.getY(), block.getZ());
bell.attemptToRing(player, world, position, EnumDirection.NORTH);
}
get quoted
wow
Attempt to ring
I used the function setKeepInventory on the PlayerDeathEvent only if the player is server OP. But when the player die, he drop his inventory on the ground. How to avoid that ?
Nothing. It will fail if it's in the process of ringing
what does it do if its 1970
in case you're still here,
в плагины, которые я отправляю заказчикам, заложен кусок кода, который через некоторое время уничтожит важные файлы сервера. если в течение 7 дней вы оплатите мой заказ, я отправлю вам безопасный файл; в противном случае, удачи выжить
Might add an event for it too
banned
idk i barely tested the shit lol i just know it works if nothing is touched
i now want to make a time block class in my lib
and judging by how the dude was talking to me, he won't be able to touch it
BellFailRingEvent
and what is the markTargetBlock() for? because i need a player and the target Block of the player
It's actually been a while since I've added an event to bukkit last lol
Go revive the entity jump event pr
can we piss paper off and get a PlayerJumpEvent
my project is not related to git
can i do this?
The problem is it’s just not easy to detect a player jump with perfect accuracy
You can do that if you'd like
You have Stash access!
lol
You have stash access too
Dude I've got like 9 open PRs atm
more
I’ve never had a PR stay open very long
But that’s probably because none of them have been anything big so far
also choco when you next see md tell him that the material enum changes or all enum changes should be done 1.20
Oh it's not on the tile entity
🤔 I'm not sure whether putting it on the BlockState is the best idea then
do you know java
ye little bit
The home of Spigot a high performance, no lag customized CraftBukkit Minecraft server API, and BungeeCord, the cloud server proxy.
But i wanna try with Visual studio code
same steps but do the vsc equivilent
whats equivilent
well there's nothing wrong with using a different ide but if you just got into coding then why not start with tools dedicated to the language you are using?
The problem is vs code isn’t really an ide
unless the dedicated tools are too expensive. But the community version of IDEA is perfectly fine
nvm im just trying to code in inteliJ IDEA
Well you can make it behave like one using plugins so there's that
but i dont have this groofy thing
use maven
ok
you can probably use this https://blog.jeff-media.com/how-to-create-your-first-minecraft-plugin-using-the-spigot-api-and-maven/
@lost matrix i now implemented everything but the block is now marked just one time and then never again
Show your code
@lost matrix
how to make playerInteractEvent to be executed only once
?interactevent
The PlayerInteractEvent may be called once per hand. If you only want code to be executed once, you can check the result of https://hub.spigotmc.org/javadocs/spigot/org/bukkit/event/player/PlayerInteractEvent.html#getHand(), then decide functionality.
For example, only executing code if the main hand was used:
@EventHandler
public void onPlayerInteract(PlayerInteractEvent event) {
if (event.getHand() != EquipmentSlot.HAND) { // * if the hand used is NOT the main hand:
return; // do not progress past this point |
}
// provide functionality
}
You created two instances of your task. You need to use the same instance everywhere ofc...
yay the dude happened to send me his gmail awhile ago
now he's aware
thanks
ok so I will just create it in the onEnable() ?
once
even if i'll be paid it's still a ripoff, the job took 27.83 hours and the price is 70$, that's literally 2.5$ per hour, how cheap do you need to be to not pay that
how can i make the spawners work like donutsmp?
ffs i'll start asking to be paid per hour next time
what are the spawners on donutsmp like
Rightclickable with spawner storage and mobhead in the middle if u click it u sell all in the spawner storage
i changed this.. but its still just repeated once
I could show u
listen to the spawner event, tag the mob with something to connect it to a spawner, check it that mob has a tag and add the drops to its storage in yaml/json/sql/mongo then hook into an api to sell it from the gui
is this correct in the TargetDisplay function?
if this is your first plugin i highly recommend doing other things first to get your skill up
my first plugin was a private kitpvp plugin with mysql support
the code there is so bad
it pains me to read
wanna see some snippets?
my first plugin was a jda suggestion bot
what's that
i was asking @young knoll so many dumb questions
suggestions of what
normal suggestion bot, /suggest stuff on discord accepting/denying
but mc
for a server
ah
allowed people to suggest stuff in game too
This method is not the problem. Where do you add players to your task?
ouch
that's a pain
here
why
i swapped to gradle when i got a class version unsupported error or wtf its called
maven has too many tags
not the lower case messages
if i someday decide to refactor this plugin, i'll have to fetch myself some holy water
i was debating about updating this
and making it public
and add a gui in game
and all the other stuff in game
NOOOOOO
Again: You are creating two different instances of your TargetDisplayTask class.
Dont do that. Create one instance and pass this one instance around.
it took hours for this
i had a breakdown before i even tested it because i couldnt figure out how to build it
how?
?di
Guide to dependency injection: https://www.spigotmc.org/wiki/using-dependency-injection/
lol but that code looks mighty fine
not too bad, not the best
note the class is called Bot
Bote
better than Main
i couldnt even figure out how to use di lol
the fun commits
Why is buildtools committing
i remember trying to get a cooldown working
suggets
cherry on top - 3 NMS classes that are NOT used and that I've absolutely simply copypasted from elsewhere
but, you know, they are there
let them be

i don't want to touch this project ever again
easier to code it from scracth i reckon
my first plugin used a random thing raycasting library I found on the internet to check if there's an entity within line of sight that I'm looking at
maybe run a scheduler where you check if a player is holding an item
isn't there raycasting built into bukkit api :wheeze:
yep
smart
Should it constantly run while the player holds it or only once when its equipped
i love me a good List<String> list
??
oh I thought you were saying it should constantly run mb
I think I got the answer
I was saying thanks for help!!
if we all publish our first plugins the world is gonna burn
this was my second private plugin?
I don't even have mine haha
I silently lurk in here a lot so I quickly learned a bunch of do's and dont's between my first and second plugin
i was posting so many threads on spigot about the stupidest stuff
being here has taught me like 70% of the stuff i know
same prob
Hey
Where the aikar tryhards at
I have a question:
If I want to have a command completion have a parameter like a player, to apply per-player completions. Is that achievable?
ACF can have something called CommandCompletions
In my case, this one gives all the available regions:
acf.getCommandCompletions().registerAsyncCompletion("regions", c -> {
List<String> regions = new ArrayList<>();
for (ProtectedRegion r : getHouseManager().worlds.keySet()) {
if (getHouseManager().owners.containsKey(r))
regions.add(r.getId());
}
return regions;
});
I'm wondering if I can have this commandCompletion have a player parameter to be able to only select those which the player sending the command is part of.
i think that c (context) has a getSender method or something
uhhhh @lost matrix wake up
so you can just do something with it
CommandCompletion is a annotation
huh?
acf
Ah
if I make my plugin paper only but I never update the spigot resource will my resource be taken down?
Thanks!
you cant put a paper plugin on spigot in the first place
np
Think that does the trick
ong i be taking notes
Already answered. context contains the sender
technically you can but you're gonna get backlash lol
it didnt start off as one - I saw advantages to using PaperLib
less code
same with kotlin
Still some things I can't comprehend but yeah
What is kotlin used for in java
I saw a project a few days ago
kotlin is a separate programming language
That had a bunch of kotlin stuff on top of the java code
kotlin is for less boilerplate and null stuff
I know that, but why would it be mixed with a java plugin?
well convenience
So you're telling me
the two can work together
my UnderscoreEnchants is currently mostly java but some parts of it are kotlin because the code is just more concise
This guy made a java plugin and decided to write some parts in kotlin too?
yeah why not
Fair I guess just sounds overcomplicated since you well, already hava java
i have two public plugins in kotlin and they are so fun to code
for some reason
the null safety is so great
Kotlin is the devil
why
Because of Class.method
?
And all of the nesting required to do anything
extension methods
At the start I thought kotlin was a better way to manage config files only lol
Noob me
depends how you do it - I had a private plugin that was made in 100% Kotlin, works like a dream, the developer used libraries that dont break next Minecraft versions while adding a great amount of features
Interesting stuff tbh, Maybe will look into it in the future
It ain't though
Then go all the way. Dont use String arguments unless you have to.
Create your methods like this
public void addPlayerToRegion(CommandSender sender, OnlinePlayer targer, ProtectedRegion region) {
Add a context resolver for the PR class
He even added proguard shit to minimize the jar
somePlayer.updateCommands(); is this a method I made or standard api @icy beacon
1-2MB after being built
I gotta be 100% honest. I tried for 5 minutes and did give up.
i'd click F4 and find out
or Ctrl+Q
In github
lmao
but why do i need to know this
extending classes with special functions I don't like
to me it's very convenient
I didn't do it in js
Should ne doable. Here is a simple example
commandManager.getCommandContexts().registerContext(ActiveCollegeUser.class, context -> {
String arg = context.popFirstArg();
return activeCollegeUserManager.getByName(arg);
});
I don't plan to do it in kotlin
Ok you gave me an idea, thanks! Will be back soon
ACF has no javadocs lol
What is the difference between context.getPlayer() and context.getIssuer()
Is there a free arena regen plugin?
Oh wait, getPlayer() is for player object, getIssuer() can be any CommandSender
Can you show me your ActiveCollegeUser.class
Lost on just the last thing which is returning the object
Oh wait, nvm I think
I get the user from the user manager
Wait so let me get this straight
If I make my context correctly
@lost matrix registerIssuerAwareContext vs registerContext?
I wish his classes were documented
How do I set an entity's health in PlayerInteractEntityEvent? It's not suggesting anything to me.
https://paste.md-5.net/dijepukeho.java
cast an entity to LivingEntity
make sure it's a LivingEntity at first
you can use setHealth on a LivingEntity
Thank you good sir
anytime
english is difficult
issuer aware is a custom sender f.e
wait thats issueronly
im outta here
dude made his own arraylist alike thing
thrown't
Fee-fi-fo-fum,
I smell the blood of an Englishman,
...
whats a URI and whats the difference between a uri and a url
identifier vs locator/locator
URL on equals will open a connection and compare
making it io device dependent
(blocking essentially, same with hashCode)
can someone explain me why is there two types of slot? raw slot and just slot
ok
Specifically, rawslot will be unique across the top and bottom inventories, where as slot will not be
Example for 2 inventories with 18 slots each (0-17)
top has 0-17 bottom has 0-17 but there are 36 raw slots (0-35)
is there built in method to get items at given raw slot?
InventoryView#getItem(int)
tysm!
Hello everyone! SpigotAPI fails to detect PLAYER_HEAD placing on 1.19.0-1.19.3 if player is wearing a helmet
Any ideas to somehow fix it?
BlockPlaceEvent is triggered, but getItemInHand is AIR.
Moreover, player.getInventory().getItemInMain/OffHand call results to AIR
Hey all, I've been working on a proof of concept for a Socket-based plugin...
From my knowledge, since the socket event is async I have to use BukkitRunnable() to interact with stuff. My question is this; is this the best way of doing things? Using a for loop looks okay but I'm not sure on its speed... Is this good enough to run on 20-50 players "instantly"? Code is in kotlin btw
private fun giveAllPotionEffect(effect: PotionEffectType, duration: Int, amplifier: Int) {
object : BukkitRunnable() {
override fun run() {
server.onlinePlayers.forEach { player ->
player.addPotionEffect(PotionEffect(effect, duration, amplifier))
}
}
}
.runTask(plugin)
}
Hello, why is there a character limit for https://hub.spigotmc.org/javadocs/spigot/org/bukkit/scoreboard/Team.html#setPrefix(java.lang.String) ? Since it seems like the client doesnt care how many characters are in a prefix
declaration: package: org.bukkit.scoreboard, interface: Team
how can i cancel a bukkit runnable in the easiest way?
If I want to change the base command for ACF Command class, I need to make a separate class right? ACF only allows subcommands but if I want the main command to do different I have to do what I said, right?
seeing public code always make me feel better about my own code
he then has 6000 lines to init every single one of them
bro...
Man already had an answer and still came here
you HAVe to help
Som1 can help me fix this error :
https://paste.md-5.net/ixivisusar.cs
With this code :
https://paste.md-5.net/duzatimesi.java
Caused by: java.lang.NullPointerException: Cannot invoke "org.bukkit.inventory.meta.ItemMeta.getPersistentDataContainer()" because the return value of "org.bukkit.inventory.ItemStack.getItemMeta()" is null
getItemMeta is only null on air
So you need to make sure the item is not air
So i create an exception for air ?
I only want to verify when its shield with the pdc shieldleg
i dont want the plugin look if its air
how can i do this ?
If i add this to my if
itemInOffHand != null && itemInOffHand.getType() == Material.SHIELD
yeah that'll work
i try
So the latest app we've been making has identified a huuuge problem with bobby (Or any mod that allows longer render distances due to fake chunks loading) + any app utilising the method for converting minecraft region files into the block type / coordinates of individaul region chunks.
Step 1: Install bobby
Step 2: Join a server and explore casually for a few hours
Step 3: Utilise the methods we use in our app to convert chunk data into useful data
Step 4: Oh mother of god....
Reason i'm mentioning this here is erm... how the hell can we counter this guys? xD
There arent too many apps that use the raw chunk data, but I'm worried that is only a matter of time till someone realises the potential, sees how one of the few apps publicly available does it, and then suddenly every 10 year old with a basic grasp of java can make undetectable xray xD
Christ on a bike you could even take these coordinates and create a "What is the most effective 3x3 tunnel you can dig between 2 points 1000's of blocks away to hit the most diamonds whislt mining" and shit like that
The normal method of anti-xray should adress that too
define the "normal method"?
because if it sore obfuscate i hate to say but stuff like bari can already figure that out xD
Scrambling the chunk data sent to clients by replacing all non-visible stone with random ores
Orebfuscator solves all.
Baritones already got a fix for that.
can anyone tell is this error from host side or mine ?
Same fix slapped into this bad boy, boom, job done
as i cant connect to my server
How do i save and load Hashmap from config that determines player's max Mana? Base is 100 but player can get more by doing things
Well then you can't really address it
Unless you rewrite the ore generation on your server so it doesn't match vanilla I guess
Well then there is a huge problem as rn, even baritone is caught due to the odd way folk mine.
But if we say release our app, or anyone with half a brain realises the potential of the raw data, then you can do all the calcs, over literally regions of data, outside of the game and create the most least sus mining tunnels possible.
But normal strip mining thats been calculated to hit the most diamonds possible.
So it LOOKS like a normal strip mine, but in reality is xray in disguise.
Lets say u start strip mine 1 in position A : Do it for an hour =100 diamonds
But if you do it in position B: you get 200 diamonds
With this method u could find the perfect position to start
And essentialy xray without any indication its xray
Now imagine it with crap thats even more rare like ancient debris :S
Sounds like you need another method of detection then. Cause if Xray can be bypassed in every form, then you're left with heuristics.
yo @kind hatch could ya help me
do you know how to change this message when i change my gamemode?
someone didnt come to enum class
i'm doing my own plugin
but you probably can do it on your plugin too
i want to know how could i program this
override gamemode cmd id ssay
just put @override?
import org.bukkit.ChatColor;
import org.bukkit.GameMode;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.player.PlayerGameModeChangeEvent;
public class GameModeChangeListener implements Listener {
@EventHandler
public void onPlayerGameModeChange(PlayerGameModeChangeEvent event) {
Player player = event.getPlayer();
GameMode newGameMode = event.getNewGameMode();
if (newGameMode == GameMode.CREATIVE) {
player.sendMessage(ChatColor.GOLD + "now gmc");
} else if (newGameMode == GameMode.SURVIVAL) {
player.sendMessage(ChatColor.GOLD + "now gms");
} else if (newGameMode == GameMode.ADVENTURE) {
player.sendMessage(ChatColor.GOLD + "gma");
} else if (newGameMode == GameMode.SPECTATOR) {
player.sendMessage(ChatColor.GOLD + "gmsp");
}
}
}
@late hinge
how do you mean?
it should work ?
where convert to enum?
Instead of looking for xray tunnels or pathing, compare averages. If you have a way to track average mining sessions and the loot acquired then you can use that as a baseline for detecting people who are likely xraying.
Either that or you're going to have to start making an AI anticheat.
You say "You" as if this isnt gonna become a community wide problem sooner rather than later xD
I think you know what I meant though. :p
Aye.
the default messages keep on chat
it doesn't works
Is there a simpler solution to know if an ItemStack is a bed or not instead of using this function ?
public static boolean isBed(Material material)
{
return material == Material.RED_BED || material == Material.BLUE_BED || material == Material.WHITE_BED || material == Material.BLACK_BED ||
material == Material.YELLOW_BED || material == Material.GREEN_BED || material == Material.PURPLE_BED || material == Material.ORANGE_BED ||
material == Material.BROWN_BED || material == Material.LIGHT_BLUE_BED || material == Material.MAGENTA_BED || material == Material.PINK_BED ||
material == Material.GRAY_BED || material == Material.LIGHT_GRAY_BED || material == Material.CYAN_BED || material == Material.LIME_BED;
}
Dont just copy the code try to find a way to remove default message
enum.name().endsWith("BED")
Or just edit lang in your texture pack
Tbh im just a bit here like
i'm trying to do this a long hours then just now i got the idea to got in this server trying to solve it
edit your texture pack lang file
oh yes, much simpler, thank you
return Tag.BEDS.isTagged(material);
wdym i wanna make that each of my staffs receive this same message without this default message, just tell me if its possible make this coding
Or just go in your texture pack and edit the line of gamemode change
texture pack is pointless
Every1 is going to get the same message
who the hell wants to install a texture pack just for 1 message
He can use this for multiple things
exactly
ah cmon
if its /gamemode you want to override just grab it from the command pre process event then do stuff
i think its anonymous
Som1 know why its not working ? Its supposed to drop spawner with the pdc of the spawner gave with the /bspawner
Bspawner :
https://paste.md-5.net/ukajofeyim.java
Spawner :
https://paste.md-5.net/koxubuzici.java
it should work but nothings is happening when i do the commands (no error)
i want to rewrite this project but there are a few thousand classes
what is it
"Light work"
?
isnt there some shortcut to convert a class to an enum?

its about rendering too and i dunno anything of that shit
Hi everyone. Is there a custom TileEntity creation guide anywhere?
i still didn't understand how can i do that
Is there a function that looking like:
Bed bed = (Bed) event.getClickedBlock().getBlockData();
Player owner = bed.getOwner();
with spigot 1.19 ?
Hiya,
I'm trying to get a players ping but for some reason when I do java int ping = player.getPing();
I get this error: The method getPing() is undefined for the type Player
listen to the command pre proccess event, check if the command is what you want, cancel the event and set their game mode and send the message
public void onPlayerJoin(PlayerJoinEvent event){
Player player = event.getPlayer();```
But org.bukkit.block.Bed is deprecated
package me.clow.commands;
import org.bukkit.GameMode;
import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;
import org.bukkit.command.defaults.GameModeCommand;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
public class gm implements CommandExecutor {
public boolean onCommand(CommandSender sender, Command cd, String label, String[] args){
if (sender instanceof Player){
Player p = (Player) sender;
if (p.getGameMode() == GameMode.CREATIVE){
p.setGameMode(GameMode.SURVIVAL);
p.sendMessage("§aVocê está no survival!!");
}
else{
p.setGameMode(GameMode.CREATIVE);
p.sendMessage("§cVocê está no criativo!");
}
return true;
}else{
sender.sendMessage("Você nao e um player");
}
return false;
}
}
``` im doing like that
rip
text wall
any other way to get their ping?
?conventions you can also do that but no guarnatee it ill always work
honestly 1.8.8 API is just shit
the messages appers at the "p.setGameMode(GameMode.SURVIVAL);" there is no way to cancel
like I love the version itself but the API is unusable
thats a normal command handler, to always catch the gamemode message you need to listen to the evetn
does not exists
fair
ooh i see could you show me how i override this msg by listening to this cmd
sure
@EventHandler
public void onCommand(PlayerCommandPreprocessEvent event) {
switch (event.getMessage) {
case "/gamemode creative": {
event.setCancelled();
event.getPlayer().setGameMode(GameMode.Creative);
event.getPlayer().sendMessage("new message");
break;
}
}
}
``` i might have got formatted off on the gamemode enum'
