#help-development
1 messages ยท Page 2163 of 1
like dis?
if(event.getTo().getBlock().getRelative(BlockFace.DOWN).getType() == Material.COAL_ORE)
that will check the block under their feet i guess
why is this not working then?
@EventHandler
public void onPlayerMove(PlayerMoveEvent event) {
Player player = (Player) event;
int timeLeft = cooldownManager.getCooldown(player.getUniqueId());
if(timeLeft == 0) {
if(event.getTo().getBlock().getRelative(BlockFace.DOWN).getType() == Material.COAL_ORE) {
player.getInventory().addItem(new ItemStack(Material.RABBIT_FOOT));
player.sendMessage(ChatColor.GOLD + "10 Coins Earned!");
cooldownManager.setCooldown(player.getUniqueId(), CooldownManager.DEFAULT_COOLDOWN);
new BukkitRunnable() {
@Override
public void run() {
int timeLeft = cooldownManager.getCooldown(player.getUniqueId());
cooldownManager.setCooldown(player.getUniqueId(), --timeLeft);
if(timeLeft == 0){
this.cancel();
}
}
}.runTaskTimer(this, 20, 20);
}
} else {
player.sendMessage(ChatColor.GREEN + "You can get coins again in " + ChatColor.GOLD + ChatColor.GREEN + " seconds!");
}
}
}```
i have tried it on my server but it doesent work
you are casting an event to a fking player
get the player by doing PlayerMoveEvent#getPlayer
and i dont understand why people keep instantiating bukkitrunnables instead of using the scheduler
dunno why you would start a runnable in the playermove event tho
like here?
Player player = PlayerMoveEvent#getPlayer;
alright
any other changes?
@EventHandler
public void onPlayerMove(PlayerMoveEvent event) {
Player player = event.getPlayer();
int timeLeft = cooldownManager.getCooldown(player.getUniqueId());
if(timeLeft == 0) {
if(event.getTo().getBlock().getRelative(BlockFace.DOWN).getType() == Material.COAL_ORE) {
player.getInventory().addItem(new ItemStack(Material.RABBIT_FOOT));
player.sendMessage(ChatColor.GOLD + "10 Coins Earned!");
cooldownManager.setCooldown(player.getUniqueId(), CooldownManager.DEFAULT_COOLDOWN);
new BukkitRunnable() {
@Override
public void run() {
int timeLeft = cooldownManager.getCooldown(player.getUniqueId());
cooldownManager.setCooldown(player.getUniqueId(), --timeLeft);
if(timeLeft == 0){
this.cancel();
}
}
}.runTaskTimer(this, 20, 20);
}
} else {
player.sendMessage(ChatColor.GREEN + "You can get coins again in " + ChatColor.GOLD + ChatColor.GREEN + " seconds!");
}
}
}```
what are you even doing
hi
i want to make it so when the player walks on coal ore they get rabbit foot but with a 15 second cooldown
hi
hmm in bukkit 1.16 i found alot of water material what is the real one?
and what is legacy_water?
dont use a runnable but use your cooldownmanager to check when a player can execute the command or not
how could i implement this in code? (im new)
the legacy stuff looks deprecated
so dont use that
ok thank
@tardy delta
sec
hey, I am registering commands by injecting them into the knownCommands map, but when I reload my plugin to add new commands, they are there but when i try to tab complete them, the server acts like they don't exist until i restart
does anyone know what I should be doing to make them tab complete without having to restart?
i think its just Material.WATER
ye
hmm when i find about addpoison it have
org.bukkit.potion.PotionEffect.PotionEffect(@NotNull PotionEffectType type, int duration, int amplifier
but idk what is int amplifier can someone help?
legacy water i'm pretty sure it refers when item ids were still a thing
how do i do this??
amplifier means the tier of the potion
ok thank you so much
there are docs tho, i suggest using
what are you trying to do
can i get docs link?
google PotionEffect spigot on google
declaration: package: org.bukkit.potion, class: PotionEffect
ok
@misty current
it explains what does each method and constructor do
i would create a cooldownmanager that saves the time that the player has used the command for the last time
start a scheduler for 15 seconds
its not a command its a player event
how would i do this?
bukkit scheduler repeating if second <15?
(im new)
Bukkit.getScheduler().runTaskLater(plugin, runnable, cooldown as a long in ticks)
?scheduling
and where in my code would i put this and how would i imploment it?
@EventHandler
public void onPlayerMove(PlayerMoveEvent event) {
Player player = event.getPlayer();
int timeLeft = cooldownManager.getCooldown(player.getUniqueId());
if(timeLeft == 0) {
if(event.getTo().getBlock().getRelative(BlockFace.DOWN).getType() == Material.COAL_ORE) {
player.getInventory().addItem(new ItemStack(Material.RABBIT_FOOT));
player.sendMessage(ChatColor.GOLD + "10 Coins Earned!");
cooldownManager.setCooldown(player.getUniqueId(), CooldownManager.DEFAULT_COOLDOWN);
new BukkitRunnable() {
@Override
public void run() {
int timeLeft = cooldownManager.getCooldown(player.getUniqueId());
cooldownManager.setCooldown(player.getUniqueId(), --timeLeft);
if(timeLeft == 0){
this.cancel();
}
}
}.runTaskTimer(this, 20, 20);
}
} else {
player.sendMessage(ChatColor.GREEN + "You can get coins again in " + ChatColor.GOLD + ChatColor.GREEN + " seconds!");
}
}
}```
olivo do you know why does that happen?
i don't even know what does this do and where you need it
oh hold on i saw it
Bukkit.getScheduler().runTaskLater(pluginInstance, () -> {
player.getInventory().addItem(new ItemStack(Material.RABBIT_FOOT));
}, 15 * 20L);
i should more look like this
void onMove(MoveEvent e) {
if (! block under player == coal block) return;
if (player has cooldown) return;
do stuff;
set cooldown;
}```
Bukkit.getScheduler().scheduleSyncRepeatingTask(plugin, new Runnable() {
@Override
public void run() {
if (i <15) {
i--;
}
}
},20L,20L);``` i think this will help you
then it can break normaly
Does rejoining the server fix it?
just supply a consumer, no need to make a new runnable
i thought of that but i've tried and it didnt
it takes a bukkit task as the consumer, you can take the parameter and cancel it if the condition is met
basically this happens
I guess reload is too late then. I don't really know never used that way of registering commands
even if this msg is from my executor
hm aight
hmm i think you need to add tab
i think i'll try to check the protocol to see if there is a packet for it
i just got a ton of errors
but iirc there is one and it is sent when you join
?
You can't just place it there
^
i think this video can help you: https://youtu.be/839z-w7RFSI
as said, it takes a consumer with a type of bukkit task, you can then get the task instance to cancel it when you have a condition that is met
im pretty sure you didn't understand the issue
also i am not registering commands the way the video does it
please
he placed the code outside of a method
he is putting everything in the class extending JavaPlugin
bruhh just ctrl + z then make like @sharp flare this not need to have BukkitscheduleRepeating
where do i put it?
@EventHandler
public void onPlayerMove(PlayerMoveEvent event) {
Player player = event.getPlayer();
if(event.getTo().getBlock().getRelative(BlockFace.DOWN).getType() == Material.COAL_ORE) {
player.getInventory().addItem(new ItemStack(Material.RABBIT_FOOT));
player.sendMessage(ChatColor.GOLD + "10 Coins Earned!");
}
}
}```
he has this where you are supposed to put ur plugin instance
wherever you want it to execute
?di to get the plugin (dont put everything in one class btw)
Guide to dependency injection: https://www.spigotmc.org/wiki/using-dependency-injection/
this just makes your life hard, please learn java, it hurts not learning the prerequisites
what is "'i"
Cannot resolve symbol 'i'
@keen star
this makes it worst too, I thought they were true. ?learnjava
just private int i = 15;
i wanna see him create my kingdoms plugin
i get this issue: Cannot resolve symbol 'i'
someone just please asnwere and i get it over with
?learnjava It seems you're lacking a bit of Java knowledge
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 actually made the variable "i"
I assume they put it in the wrong scope
no because i dont know what @keen star wants it to be
... they told you?
.
..
yes but i dont understand
learn java
i would write a cooldownmanager like this
public class CooldownManager {
/* map which stores the user id and the epoch time when the cooldown finishes */
private final Map<UUID, Long> cooldownMap = new HashMap<>();
public boolean hasCooldown(UUID id) {
return this.cooldownMap.getOrDefault(id, 0) < System.currentTimeMillis();
}
public void setCooldown(UUID id, long duration, TimeUnit unit) {
this.cooldownMap.put(id, System.currentTimeMillis() + unit.toMillis(duration));
}
}```
actually i might remove the entry in the map when the user doesnt have cooldown
Yeah that would be smart
-<
ok done, now how do i add the cooldown to this?
@EventHandler
public void onPlayerMove(PlayerMoveEvent event) {
Player player = event.getPlayer();
if(event.getTo().getBlock().getRelative(BlockFace.DOWN).getType() == Material.COAL_ORE) {
player.getInventory().addItem(new ItemStack(Material.RABBIT_FOOT));
player.sendMessage(ChatColor.GOLD + "10 Coins Earned!");
}
}```
Could you please learn java or hire someone instead of asking us to write the plugin for you
well check if the user doesnt have cooldown and execute your stuff and after that set the cooldown
anyways is getting a string from config every time i need a translation a good idea, i heard the fileconfiguration is basically a map but cuz its requires some parsing to get the actual string it might not be really efficient?
like i said : private int i = 15;
the audacity man, people are trying to help you here
They don't understand that. You need to write the entire thing for them
๐ฅฃ
people here are good resources while he wants us to f off for not learning java
like if i was talking to u

Sorry these aint java discord, no one gonna spoonfeed you here with java except spigot
????????????????????????????????????????????????
we dont teach java
we help with spigot api
its up to you to get a basic understanding of java
shouldnt even be doing spigot without that
@keen star like this?
if(event.getTo().getBlock().getRelative(BlockFace.DOWN).getType() == Material.COAL_ORE) {
Bukkit.getScheduler().scheduleSyncRepeatingTask(this, new Runnable() {
@Override
public void run() {
if (i <15) {
i--;
player.getInventory().addItem(new ItemStack(Material.RABBIT_FOOT));
player.sendMessage(ChatColor.GOLD + "10 Coins Earned!");
}
}
},20L,20L);```
who asked?
you're asking
Kids nowadays......
a basic java question
please just leave
i cant just get a normal conversation here jeez
because u dont listen
u dont tell
we told you multiple times to learn the basics of java
we aint being paid here to do ur bidding
how have we not been clear
there is no god here
aight my bad
but can anyone tell?
just look at the code of the config loader if it cashes it
if not then just load and save it in memory
I'm not sure how exactly it works but I do know it's a map internally
its not about crashing something, its about trying to be as efficient as possible but ye ill look at the impl
you mean translation of other languages?
ye cashing is more efficient
uh kinda ye, im having a lang.yml file for all the messages and i wanted to know if getting them from a map is more efficient than getting them from the fileconfig every time
-<
hi all bro
I use eclipse and 1.16.5 buildPath to make my acidIsland Plugin but i got this warn how to fix it?
Legacy plugin AcidIsland v1.0 does not specify an api-version.
API Version in plugin.yml
The home of Spigot a high performance, no lag customized CraftBukkit Minecraft server API, and BungeeCord, the cloud server proxy.
can you guys help me please, i have cancelled block break event, so this happens when I try to break a large chest, I have this glitch until I touch the chest again ๐
https://media.discordapp.net/attachments/977231946977525794/979344217144954890/2022-05-26_08.22.58.png
any time you call getState() you are getting a NEW copy.
show your canceling code
?paste
block.getState().update() will thus do pretty much nothing outside of physics
Player player = blockBreakEvent.getPlayer();
Block block = blockBreakEvent.getBlock();
if (block.getType() == Material.CHEST) {
if (!player.getUniqueId().equals(EventoBlockPlace.UUID_LOCATION_MAP.get(block.getLocation()))){
blockBreakEvent.setCancelled(true);
}
}
...
Don;t compare Locations. The odds of them actually matching is rare
its not location
its UUID
public static final Map<Location, UUID> UUID_LOCATION_MAP = new HashMap<>();
You're comparing locations when you call get
no
(!player.getUniqueId().equals(EventoBlockPlace.UUID_LOCATION_MAP.get(block.getLocation()))){
block.getLocation()
I'm aware
use teh block x/y/z not a Location
the map will compare locations internal
so this will solve my problem?
no
probably not
ok
but it needs fixing
LWC is open source
yeah, but I could not find out
I was the maintainer of LWC for a few years
whats LWC?
lwc container protection plugin
Sorry I was maintaining Lockette
cancel the event, like I'm try to do
ah
just decompile the other plugin and look at what they do different
its open source
even better
but I coul not find anything
This is a more maintained version
thx
Also line for their method
All lockette does is cancel the event. Nothing more
i see pyramids
first I need to make sure this is not happening
I mean, make sure its not a client glitch or something
installing lwc
you cache them in a map
as pairs
key and value
thats what I do for my config manager
That's what FileConfiguration already does
Which you can see highlighted in that image
Ah
hello everyone, I have encountered such a problem. When I click 1 time on a block (let's say a stone), this code is executed 2 times in a row. Tell me how to fix it
public void onPlayerClick(PlayerInteractEvent e){
if(e.getAction()==Action.RIGHT_CLICK_BLOCK) {
//do something
}
}```
You mean that the event is triggered as a result of the fact that I somehow click with both my right and left hand at the same time, right?
javadoc says Represents an event that is called when a player interacts with an object or air, potentially fired once for each hand. The hand can be determined using getHand().
Even when you right click the event also fires for the offhand for placing torches
I use hikari cp and i think i use it wrong. I compared the speed with the file system. Writing all the data to file it only took 4sec. But with hikari it took 8.7 min for the same task
how much data are you writing and is your SQL host on the same machine?
It is on the same machine
thank you you helped a lot
remote server or local?
I write 20 records and for each of them 30 other records
Locale
have you tried to use sqlite?
4 seconds to write to file tends to indicate you are writing a Lot of data or your PC is a toaster oven
It creates 4000 files
ok a LOT of data
what are you saving?
Why do you need that many files ๐
No, because i want to include a mysql option for my plugin
can you guys tell me why is not goo idea compare locations? even while working with blocks?
For each player. its just a simulation
Ah
Serialized data
Locations use Doubles for precision. Which means its very unlikely for two doubles to match
what kind of serialized data
Objects
he is comparing blocks
ok but Im comparing the same object
smh
i got you
You are not, you can calling getLocation and comparing that to a Location stored in a map
if both are locations of blocks
This are the members private ArrayList<UUID> players;
private GuildColor color;
private GuildColor tagColor;
private String name;
private String tag;
private UUID head;
private GuildMetadata guildMetadata;
It will probably work, most of the time, but the odds of it messing up are high
then there shouldn't be a problem
why are you saving it in 4000 files??
location, there shouldn't be a problem
ok
This is only a simulation. The file option is only for small server with like 20 player
just use SQLite
Sqllite is not a database
hey, I am registering commands by injecting them into the knownCommands map, but when I reload my plugin to add new commands, they are there but when i try to tab complete them, the server acts like they don't exist until i restart
does anyone know what I should be doing to make them tab complete without having to restart?
then what is it?
for some reason that was not an issue in 1.8
This is why we don't compare doubles https://www.baeldung.com/java-comparing-doubles
but how is yours better??
I don't want to use my files option
I have 1 more question ... Is it possible to use Location as a key for HashMap? Or is it possible, but not recommended?
it is possible ofc
so I think I'm gonna compare the location to string
and if you want to switch over to MySQL, then you can just change the java connection thingy and reuse your SQLite code
as you interact with both using the same protocol
you can use one as long as you are sure you store locations that are always gonna be the same
and not slightly different
Yeah but it should work for much bigger data too and should be usable to save it on external devices
like block locations
yea just use SQLite
you can just easily replace it with a MySQL database once you need to store more
as it both uses sql
But that doesn't solve my problem. When i switch to mysql later on, i will have the same issue
SQLite - Java, In this chapter, you will learn how to use SQLite in Java programs.
what problem?
Here I also think that the Location fields is not final and wouldn't it be faster to convert the location to a string and use a string in HashMap as a key, too?
That mysql is so slow when i use it
That is why i posted my question
You just probably don't know how to write queries. You can set a limit on the number of requests and the speed will be several times higher.
^^^
Ok thanks
You can also keep data in RAM that you need quick access to, and save it to the database when the server is turned off
What should i use as limitation?
I already do that
send code
What code?
I won't say right away, I prefer Postgresql.. 5 minutes
the one that you said is slow
Ok give me a minute
public static void createGuildRecord(GuildObject guildObject) throws SQLException {
StringBuilder players = new StringBuilder();
for (int i = 0;i<guildObject.getPlayers().size();i++){
players.append(i!=guildObject.getPlayers().size()-1?guildObject.getPlayers().get(i).toString().replace("-","") + ",":guildObject.getPlayers().get(i).toString().replace("-",""));
}
execute("INSERT INTO guilds VALUES ('" + guildObject.getName() + "', '" + guildObject.getTag() + "', '" + players + "', '" + guildObject.getColor().toString() + "', '" + guildObject.getTagColor().toString() + "', '" + guildObject.getHead().toString() + "', '" + guildObject.getGuildMetadata().getCreationDate() + "', '" + guildObject.getGuildMetadata().getCreatorName() + "')");
}
The execute method:
private static void execute(String statementString) throws SQLException{
connection.prepareStatement(statementString).execute();
}
what is in your getPlayers()?
use update ?
are they actual player objects? or somethign custom?
if the data is updated
This is a arraylist with uuids
k
No its created
maybe a solution like working with a database in a separate thread will suit you?
so that the main thread does not wait
I trim all uuids and seperate them with a ','. Than i just put them in the column as a string, bc mysql doesn't has lists or arrays
I have to wait because some of this values are updated when a player joins
why?
Ok you are right because i have them already cached
so i actually doesn't matter
Should i just use a new BukkitRunnable each time and run the task asyncronosly?
hi i am going to coding plugin zombie simullator but i don't know how to check if above player head have a block not air can someone help
Block block = p.getLocation().getBlock();
Bukkit.getScheduler().scheduleSyncRepeatingTask(plugin, new Runnable() {
@Override
public void run() {
for (int b = block.getY(); b <= worldmax;b++) {
if(p.getWorld().getBlockAt(block.getX(),b,block.getZ()).getType() != Material.AIR) {
blockh = p.getWorld().getBlockAt(block.getX(),b,block.getZ());
}else {
blockh = null;
}
}
if (blockh != null) {
p.damage(2.0);
p.addPotionEffect(new PotionEffect(PotionEffectType.POISON, 200, 5));
}
}
},0L,4L);```
this my code
new Thread(() ->{code here}).start()
ok thanks
but this not working
java.lang.NoSuchMethodError: 'net.minecraft.server.level.ServerLevel org.bukkit.craftbukkit.v1_17_R1.CraftWorld.getHandle()' i'm pretty confused, how is getHandle not there at compile time?
if you need to spawn a mob - or something similar - run a synchronous task inside the new thread
could it be because i messed up the reobfuscation plugin in my pom?
?bootstrap read the nms section in the 1.17 post it links to.
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
can someone help pls
@Override
public void run() {
//do something
new BukkitRunnable() {
@Override
public void run() {
//do something sync }
}.runTaskLater(YourPlugin.getInstance(), 0);
}
}).start();```
Ok i make evrything in a new thread except the things like caching because i need the data seconds after
uhm
And in mysql, should i open a new connection evry time or keep it open?
close it after you did your stuff
Ok
keep it open
You should use HikariCP for mysql. It reuses connections.
Generally, do not create new instances of thread directly
i am currently using it
but i dont know if i use it right
it still closes them x)
i connect me to the db and than keep the connection open
Yeah altho connections are made to be long lived for most part
i had already read it and I have already developed once a 1.18 plugin using mojang mappings
im not sure why is it causing an issue now
i tryed this but than it is much slower
but idk if youre talking about the connection opening being slow or the actual database stuff
the actual db stuff
why
databases are relatively slow yes
That might come down to your query, but it could also just be your internet connection in general.
thats why you dont interact with them on the main thread
embedded databases for the win

its on the same machine as the server
Then you might want to check your Hikari settings and take a look at your queries. You aren't making major changes with a single query are you? (E.G. modifying thousands of records at once?)
if i shift click an item from within the InventoryClickEvent, is there a way to retrieve the designated slot that the item will go to?(not the one it is currently)
i dont have settings. i just have the username, url and password
you can also implement a request queue in a separate thread, so as not to create a new one every time
hm
request queue?
i normally run my database stuff on a threadpool so the queries dont have to wait
a separate thread in which an eternal cycle is running, which comes out of sleep every 2 seconds, and executes all the requests that have accumulated during this time.
why not using a threadpool then?
^ a thread pool with an appropriate blocking coefficient would be much more sophisticated and scalable here
<plugin>
<groupId>net.md-5</groupId>
<artifactId>specialsource-maven-plugin</artifactId>
<version>1.2.2</version>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>remap</goal>
</goals>
<id>remap-obf</id>
<configuration>
<srgIn>org.spigotmc:minecraft-server:1.17.1-R0.1-SNAPSHOT:txt:maps-mojang</srgIn>
<reverse>true</reverse>
<remappedDependencies>org.spigotmc:spigot:1.17.1-R0.1-SNAPSHOT:jar:remapped-mojang</remappedDependencies>
<remappedArtifactAttached>true</remappedArtifactAttached>
<remappedClassifierName>remapped-obf</remappedClassifierName>
</configuration>
</execution>
<execution>
<phase>package</phase>
<goals>
<goal>remap</goal>
</goals>
<id>remap-spigot</id>
<configuration>
<inputFile>${project.build.directory}/${project.artifactId}-${project.version}-remapped-obf.jar</inputFile>
<srgIn>org.spigotmc:minecraft-server:1.17.1-R0.1-SNAPSHOT:csrg:maps-spigot</srgIn>
<remappedDependencies>org.spigotmc:spigot:1.17.1-R0.1-SNAPSHOT:jar:remapped-obf</remappedDependencies>
</configuration>
</execution>
</executions>
</plugin>
can anyone tell what is wrong with the remapper plugin? Im pretty sure im getting nosuchfield exceptions because of it
Are you using reflection?
well something else: for my messages class, should i get a message directly from the fileconfiguration like im doing now or should i use a map where all the messages are stored?
nope
hold on i'll send the line of interest
java.lang.NoSuchMethodError: 'net.minecraft.server.level.ServerLevel org.bukkit.craftbukkit.v1_17_R1.CraftWorld.getHandle()'
i'm pretty sure thats the case because gethandle returns an object with a different name when the jar is obfuscated
Well if you are using the remapped version, the names of NMS methods will change. Also, 1.17 remapped was a little jank.
Uh probably doesnโt matter altho I do suggest switching to something like resource bundles if you have the effort to
check the version on which you run the plugin and on which you compile
isn't the remapper supposed to fix them?
both 1.17.1
i saw the FileConfiguration#getString uses some internal parsing first to get the actual value
Yes but thatโs negligible
It just grabs the value from the linked hash map and tries to turn it into a string basically
Fix what specifically?
i meant remap the jar
Yes and no.
so the names are not mismatched
Ye
and i didnt really find a good tutorial for resourcebundles
We are not allowed to redistribute the mappings, but we are allowed to use them. Meaning that we can use the mappings for development but it will be converted back to the obfuscated methods when we compile it.
That's what the remapper does.
Hmm I can show you one of my projects once I get home in case you need some inspiration else I believe LuckPerms got a nice way of dealing with it
Altho its language class is gigantic so you might wanna split yours up a bit more
yea but in my case, i am guessing that it is not working since ServerLevel is not the name of the obfuscated class
i saw essentials also using it but i didnt understand their code
that's the mojang mapping name
Ye
Well 1.17 was a little jank. I think the getHandle method was under another class at that point. You may need to get the connection first then getHandle.
How?
the connection?
.
.
The player connection. Similar to normal NMS, CraftPlayer#connection#getHandle(), but instead with mojang names.
this is the obfuscated class and getHandle is there but returns the object with the obfuscated name
and my jar is not getting remapped
I actually don't have any idea how to do that
probably because of an error in this plugin
somewhere i cant spot
Well your compiled jar isn't supposed to be.
then how are my jars imports supposed to match the obfuscated ones?
Well, not sure if it'd make a difference, but you can try using the 1.2.3 version of the special source instead of 1.2.2
That's the point of the special source jar. It takes your code, then changes the remapped names back to the obfuscated ones.
nope, same thing
You aren't getting any errors with maven are you? Just on the server?
package fr.program.testplugin.events;
import org.bukkit.Material;
import org.bukkit.block.Block;
import org.bukkit.entity.Player;
import org.bukkit.event.block.BlockPlaceEvent;
public class BlockPlace {
public static void init(BlockPlaceEvent event) {
Block block = event.getBlock();
Player plr = event.getPlayer();
if (block != null && block.getType() == Material.CHEST) {
event.setCancelled(true);
}
}
}
````How can I know the name of the item which placed the block?
get the name of the held item of the player
Wtf is that
Why Is it static more importantly
So how are you getting the player connection?
Here's an example of how I send a packet to a player in 1.18.
((CraftPlayer) player).getHandle().connection.send(packet);
it looks more like a main method of a java program than a listener
how you gonna place a null block
this is the line giving an error ServerLevel level = ((CraftWorld) block.getWorld()).getHandle();
getHandle to be precise
throwing a NoSuchMethodError
Thank you man !
placing air ๐
Hmm, well I haven't dealt with block nms, but if it's throwing an NoSuchMethodError, then the method is either under another sub method. Or you are using the wrong approach.
For instance, in one of the versions, getting a player connection required calling getHandle().connection.connection.whatever()
https://pastebin.com/hj4VWCEG this is the whole stacktrace
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.
the exception is about the .getHandle call
help how to check if world is rain?
i have this:
Boolean weather = p.getWorld().isThundering();
but it only check if weather is thunder not rain someone help
on CraftWorld
private final ArrayList<Object> queue = new ArrayList<>();
public void run() {
new Thread(() -> {
if(queue.isEmpty())return;
//code save queue in bd
clearQueue();
try { Thread.sleep(2000);
} catch (InterruptedException e) {}
}).start();
}
public synchronized void clearQueue(){
queue.clear();
}
public synchronized void addInQueue(Object o){
queue.add(o);
}```
Ugh
Yea, just confirmed, it works on 1.18.
ServerLevel level = ((CraftWorld) player.getWorld()).getHandle();
System.out.println(level.getWorld().getName());
Willing to bet it's under another submethod or something for 1.17.
i am wondering why it doesnt for me
can you send me your pom.xml
not like they removed gethandle and then put it back a version after
also because i decompiled the jar and it was in there
what am i looking at lol
No, but they might have moved it around in a non standard way. Again, 1.17 mappings were really jank and it was partly due to how mojang write their code.
You better off using a SynchronousQueue as that implementation is not even thread safe
?paste
Here's my pom for my 1.18 module. https://paste.md-5.net/gudihuyuvu.xml
why not checking if the queue is empty before making a thread?
That implementation pattern will nonetheless run into concurrency update issues
Pog
conclure do you have any ideas about my issue?
Nope I havenโt once used moj maps with maven sadly
ah rip
shadow can you try to remove the remapping plugin and try to run the same code again?
If I did that, I would have to rewrite the code to use the obfuscated methods, some of which I do not know.
don't remove the mojang mappings import, just the remapper plugin
i want to see if the error would look similar to mine
Oh, well if I did that, the code wouldn't run on the server. As it would try calling the non obfuscated methods which aren't present on the server.
Wait, can you send your pom?
you need to get the inventoryview
no
a player's inventory view
and then get the name from that
the method name should be getView from the player interface
Hmm, I think this was part of why I just stuck to the obfuscated methods for 1.17. I remember having a lot of trouble with the 1.17 mappings. I'm trying to see if MiniMappings has anything on this, but it seems they only convert spigot to mojang and vice versa. No craftbukkit stuff.
it should have a method too
Yeah I found, getTitle.
also if you are using it to recognize guis i suggest to not do that, it's a sloppy way to do it
i guess i can code without the remapped jar too
kinda annoying but eh
yea using the obfuscated jar works fine
thanks for the help
Uh why?
Yea, sorry about the solution though. At least you have MiniMappings so that you can take any 1.18 mapped stuff and convert it to 1.17 obfuscated though. ๐
because any other plugin could open a gui with the same name
or even worse a player could rename a chest and place it down
at least it worked first try
yea i guess
the field name of playerconnection was "b"
took a bit to find
Yeah but my chest has not 27 slots but 18 so i can use getContents.
getSize*
Or you could just compare inventory instances and you won't have any issues with names, content, or conflicts with other plugins. ๐
it's like using lore to detect enchantments
wdym the file is empty ๐
that was gonna be my suggestion
and what my gui api does
i suggest doing that
but up to u i guess
Ah but how can I fix it?
do this
owh empty yaml files should contain [] or somthingg
do you know what does instance mean
It depends on the context, there I do not understand where you are coming from.
Ah.
No no, you were on to something there. lmao
sqlite doesn't require logging in right
You mean I have to check if it comes from Bukkit?
lmao
i mean not like an Inventory instance will ever come from another library
anyways no
also it's not about context
in java do you know what an instance is
That it comes from something.
For example sender instanceof Player
if (kill05 instaceof Dog) ((Dog)kill05).bark()
IIRC, that's correct. You just need the .db file.
what you described is an object being a child class of another one
an instance is what you create when you call a constructor
basically each inventory is a different object
and you can tell them apart by comparing them using ==
even if 2 different inventory instances have the same content, same title, etc, if you use == to compare them it will return false
meaning you have a way to tell them apart
Every time you call new WhateverObject() you are creating a new instance of the class. If you want to keep track of it, you need to assign it to a variable.
WhateverObject whatever = new WhateverObject(). Now you can access this specific instance by calling whatever.method()
so when you open the gui inventory, save an instance of it and when the player clicks in it, check if the instance of the top inventory is the same one as the gui you opened and stored
which event is fired if i click on an inventory slot with an item in hand but keep the mouse pressed, slide to the side and then release?
because inventory click event is not called then
inventory drag event
ty
its only possible to fire it placing an item, not picking one up?
Someone already got this issue? I have a plugin with a command, it works perfectly but when I leave and re-join, the command doesn't work anymore
The command is received by the server just it doesn't make anything
I need to reload the server to make it work again
prob has rather something to do within your command that breaks
than with the command api itself
My command work
cause ur not relevant for a command to be recognized
Just the server make nothing
?paste the command
[16:14:37] [Server thread/INFO]: test 3
just paste the code of your command
Nothing
I'm leaning towards sqlite in storing player info, I only have experiene with mysql and phpmyadmin
You want just the command?
Well sqlite is basically mysql, so it should be pretty easy to implement if you already know mysql.
my sql and sqlite is basically the same
oh shadowmaster said it first
sql always uses the same instruction set no matter what language the server is accessed from?
yeah its an easy one since its same
iirc if ur using a command executor u need to inject ur command urself
into the command map
No, you just need to register it with #setExecutor()
No no, you can set the executor ;p
Same for TabExecutor
When i leave and re-join the server
It doesn't work anymore
I can make a record if you want
we need to see code for this part java ModPlayer modPlayer = ModPlayer.instance(player); modPlayer.mod();
Almost certain that you're using a Player as a Map key or something
Player instances are not the same between joins
lets see ๐
(that's why we generally advise the use of their UUID as identifiable keys)
ahha
Aw they use UUIDs :((
Oh really?
But I don't think it's that because
Yeah you're using UUIDs. Can disregard
that code looks weird, what is it supposed to do?
this.getPlayer().getInventory().clear();```You are storing a reference to a player object `this.player`
Moderation mod
When you make the /mod command, if you're not already in the moderation mod, it gives you some item to moderate
And if you are already in, it gives your old items back
Mmmm, actually, yeah. Does your ModPlayer hold a Player field?
Or does getPlayer() return Bukkit.getPlayer(playerUUID)?
Player field define in the object constructor
Yeah so that's the issue then
Really? I don't think so, I delete the ModPlayer object when the player leave
Correct, but remember that the Player object is invalidated
I will test that
private final UUID playerUUID;
public ModPlayer(Player player) {
this.playerUUID = player.getUniqueId();
}
public Player getPlayer() {
return Bukkit.getPlayer(playerUUID);
}```
So I need to replace the player by Bukkit.getPlayer(playerUUID)
Crude solution would be this
I test that
just pass in an uuid tho
I mean yeah, whatever you want lol
go to the shame corner, now!
Could argue that passing a Player is better because you can at least guarantee it's associated with a valid player
Otherwise there's nothing stopping me from doing UUID.randomUUID()
It works, thanks, I learned something today lol

They will be equals() to one another, but invocations of any state-related methods on a Player that's logged out will do pretty much nothing
Hey, im trying to make a plugin where someone takes damage if it rains on them? But do not get it to stop doing damage, neither when it stops raining or if they get under some sort of block
do anyone have any idea how to make this possible?
Yeah so somehow you access the rain property and if the rain is touching a player damage, else donโt.
Check If the world is raining, and then check If player has a solid block on top of them, if not damage them.
toxic rain aaa
well, i thought i did. Idk if im using the wrong way to check if they have a solid block above them or if i used did something wrong with stopping it
because it continues to damage even if it stops raining or if they go below a block
Show code
will do, one sec
https://pastebin.com/54F7UX6u i sent the whole event. The first half is just normal damage from water
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.
You need to cancel/stop the runnable If the rain has stopped.
whats the best way to do that, i tried on line 79 but doesnt seem like it worked
Hello, does anyone know how to prevent entities from colliding with a particular player? Thanks in advance
Also your code can cause heavy performance impact, you're creating BukkitRunnable everytime player moves while it's raining.
is there a better way to do it?
I guess you can create one runnable and loop through all players.
No need to listen to any events.
wouldnt that have even more of a impact? Cuz right now it should only check one or two players who it will effect
oh okay
You're creating a task everytime player move while the world is raining, so you will have lots of tasks running at the same time.
so i should instead make a runnable that checks the correct players world and if its raining?
Yes, one task that's it.
ill create it, is it okay if i come back and double check with you if its correct when im done?
Sure thing
thanks for now mate ๐
no problem, good luck
I have this but the IDE says Cannot resolve symbol 'ITEM_BREAK'
player.playSound(player.getLocation(), Sound.ITEM_BREAK, 1, 1);
I have a cool idea but i dont know if i should even attempt to make it if its possible. so basically if i have some physical currency in server and person is getting charged for some action in vault balance, would it be able to somehow make it so it can delete your coins automatically if your balance is not enough. like so economy plugins can see coins in your inventory as /balance money effectivly
it probably sounds too good but it would give me chance to perfectly integrate physical currency with other plugins
check to see if you have the proper imports at the top of your class file
wdym
isnt it block_break
how can this sound not exist
oh its ENTITY_ITEM_BREAK
well I will assume its impossible
Nothing is impossible
is there a plugin that brings back the arrow physics from 1.8 Minecraft
Looking for a developer for a plugin similar to HeadHunter RPG. A kind developer offered an API they use for a similar thing. DM me If interested.
If you wish to request or offer development/art/building/administration services, please do so at https://www.spigotmc.org/forums/services-recruitment-v2.54/
someone can help me ?
how my idea sounds, any idea where should i begin?
ProxiedPlayer#sendData(String channel, byte[] data) doesnt seem to work but if i do ProxiedPlayer#getServer().sendData(String channel, byte[] data) the data is sent
isnt Entity#setCollision a thing?
does the first one send data to the client?
also for disabling collision between players you need to put them in the same team with the collision rule disabled
ps i want to send data to a player on a server
dunno if this is working
https://hub.spigotmc.org/javadocs/spigot/org/bukkit/entity/LivingEntity.html#setCollidable(boolean)
declaration: package: org.bukkit.entity, interface: LivingEntity
didnt seem to work between a player and a sheep
not for players atleast
I use player.getItemOnCursor() when the player holds a pickaxe and it returns air
wtf?
@harsh totem is this on inventory click?
no
what event then?
ok i think i get it. player.getItemOnCursor() should return the item that the players clicks on but the inventory is closed to its air
how do I get the item the player holds?
player.getItemInMainHand?
or do you mean the cursor item?
they wont have one if inventory is closed
I used item.setDurability((short) 0); and it does nothing, why?
If I implement Vault into my plugin, does it have event like balancechanged? so I could execute smth whenever player pays for something or otherwises looses some money
stupid question but if it is then i will be very happpy
how am i supposed to break the item?
are you trying to break it or just delete it?
break
i donโt really see the difference
the sound and animation
well you could just play the sound
yes but the animation
try doing setdurabilty 1 and see what that does
it might be that itโs goes the opposite way or that you canโt set something to 0
also
it did nothing
I know for sure that the line was executed
try using the non deprecated method(s) then
it would be Damageable iโm pretty sure
That depends on your context. There are cases where your message should be lazy. Conditional executions are a great example.
Preconditions.checkArgument(someValue, "This is an expensive operation: " + someObject.getClass().getName());
Preconditions.checkArgument(someValue, () -> "This is an expensive operation: " + someObject.getClass().getName());```
(I don't think Preconditions actually supports a Supplier, but you get the point lol)
if i use it as item meta, what function is the durability?
Class#getName() will be evaluated regardless of whether or not the condition is true, so the supplier helps lazify it so it's not evaluated unless it's needed
declaration: package: org.bukkit.inventory.meta, interface: Damageable
Cannot resolve method 'setDamage' in 'ItemMeta'
look at what i sent
i'm using them for error messages, which should only be printed when an exception occurs so idk actually
If you're just passing in a formatted string that isn't very computationally expensive, you don't need a supplier ;p
Also depends on how hot your code is as well
damageable .setDamage(Integer.MAX_VALUE);``` it also does nothing
very hot
cant barely hold it
im an idiot
ok so i thought that the problem was the space in line 2 after damageable but it wasn't
that's what i've done
getItemMeta() returns a clone, yes, you have to set it
why is it actually returning a clone?
I did item.setItemMeta(damageable); and still nothing happens
are you sure the item you have is working at all?
try changing the name of it or something
wdym
Reusability of ItemMeta, mostly
the code checks if it's the item i want and it is. it does get to the lines that should break the item but the item doesn't get broken.
You can create ItemMeta independent of an ItemStack and just re-apply that same meta to numerous items
hmm
Item meta isn't necessarily owned by an item stack, it's just a property of it
damageable.setDamage(Integer.MAX_VALUE);
item.setItemMeta(damageable);``` why isn't it breaking the item?
can you send the code on how you get the item
ok but I checked with System.out.println() and it says it's the right item
public void OnToolUse(BlockBreakEvent event){
if (isBreakTool(event.getPlayer())){
Player player = event.getPlayer();
ItemStack item = player.getItemInHand();
int randomNum = ThreadLocalRandom.current().nextInt(1, 21);
System.out.println(randomNum);
if (randomNum == 1){
Damageable damageable = (Damageable) item.getItemMeta();
damageable.setDamage(Integer.MAX_VALUE);
item.setItemMeta(damageable);
}
}
}```
is says that im holding a pickaxe
and it prints the random number
and youโre sure the item meta is actually an instance of damageable?
why wouldn't it be
Because not all items are damagable. Like food for instance.
That's fine, but not all items are like that. Hence why you need to check if the item is an instance of Damagable.
I used isBreakTool(event.getPlayer()) which returns true when im holding a tool that has durability
iirc, ItemMeta does implement Damageable
So technically speaking, they do all have damage, they just may not do anything with it
ye it checks for instanceof
Yes. All ItemMeta is Damageable. You don't need to instanceof check it
itโs the other way around
Not for Damageable
?
Your IDE might give you a cast warning and technically speaking, different implementations other than CraftBukkit may not have all ItemMeta be Damageable, so you should be instanceof checking, but as far as CB is concerned, all ItemMeta is Damageable
guys please help
ah
btw does anyone know why that class isnโt public?
i was wondering that when trying to do something with it
Because it's package private. It's only instantiated in implementation
You can still use its methods but you just can't refer to its type. You'd have to declare it as ItemMeta
Hi everyone, I've a little problem, I get this error ```[17:56:07] [Server thread/ERROR]: Error occurred while enabling DarkRP v1.0-SNAPSHOT (Is it up to date?)
java.lang.NullPointerException: null
at fr.darkrp.diabolex21.darkrp.manager.CommandManager.<init>(CommandManager.java:9) ~[?:?]
at fr.darkrp.diabolex21.darkrp.DarkRP.onEnable(DarkRP.java:22) ~[?:?]``` and I don't know how to solve that, IDEA ask me to change de language or something like that when I register the command and from this time it doesn't work
but its public (non-overridden) methods are off limits ;p
rip
because its the bukkit implementation?
CraftBukkit's CraftMetaItem, yes
i was trying to access its serialized inner class before
does this include querying databases too?
In Visual Studio Code I want to make the maven thing (maven archetype?) but this is what I get
[ERROR] Error executing Maven.
[ERROR] java.lang.IllegalStateException: Unable to load cache item
[ERROR] Caused by: Unable to load cache item
[ERROR] Caused by: Could not initialize class com.google.inject.internal.cglib.core.$MethodWrapper
The terminal process "/usr/bin/bash '-c', 'mvn org.apache.maven.plugins:maven-archetype-plugin:3.1.2:generate -DarchetypeArtifactId="maven-archetype-quickstart" -DarchetypeGroupId="org.apache.maven.archetypes" -DarchetypeVersion="1.4" -DgroupId="com.example" -DartifactId="demo"'" terminated with exit code: 1.
I printed damageable and it's UNSPECIFIC_META:{meta-type=UNSPECIFIC, enchants={DIG_SPEED=5, DURABILITY=3}, Damage=2147483647}
what should i do
did you click 'create maven project?'
yes
was that the wrong thing?
I wanted to follow this tutorial
https://www.spigotmc.org/wiki/creating-a-blank-spigot-plugin-in-vs-code/
The home of Spigot a high performance, no lag customized CraftBukkit Minecraft server API, and BungeeCord, the cloud server proxy.
lol im looking at all those archetypes
hello when im building artifacts its not showing on ide
are you working with maven or gradle?
fixed but want to ask something else
?paste
https://paste.md-5.net/izowezosob.rb keep getting this
did you specify the right path to your main class in your plugin.yml?
yes
have you tried again? it worked for me
do you even have java installed?
yes
uhh idk then
what about me?
specify your api version btw
Why does it repair the item instead of break it? damageable.setDamage(Integer.MAX_VALUE);
try lowering the value
why
cuz it might break it
tried again?
about 5 times now
Unless you know what maven archetypes are and what they do, I'd start with a blank project instead
everything works for me
I just wanted to follow this tutorial https://www.spigotmc.org/wiki/creating-a-blank-spigot-plugin-in-vs-code/ so that I can make a plugin even though I use visual studio code and not an IDE
The home of Spigot a high performance, no lag customized CraftBukkit Minecraft server API, and BungeeCord, the cloud server proxy.
bro wtf is this why am i getting this stupid shits
I personally never used maven archetypes because defining the maven pom manually is much nicer
so i can just create a pom.xml or whatever is called and that would work just as fine?
Are you sure that that class exists and isn't just an empty file
yep
At least in theory
broke my ide
?
damage is in short iirc
But isn't that what you do though?
geol please help make me do what you do
I do it, but I either use sublime text or eclipse - but never vscode
why not VScode?
thats with item.setDurability()
I grew up with sublime text - too complicated to switch at this point heh.
in damageable its int
?jd-s
geol, if i get sublime text 3, will you help me?
just for the maven thing or whatever this is
please
Just define the maven pom manually, it will work just as well
Use notepad++ it's the best ide
i willfuck with intellij, really
I know that it (building projects) works via the command line for me, so the editor really should not be an issue
how often are player movement packets sentout? 20/s ?
Which is the good thing about maven
๐คจ
Taking programming passion to the next level
On average less often than once per tick per player to say the least
๐
?stash
mh so at max 4/s huh
Well it can still be quite often
well i want to send out packets like player movement but not sure how much is too much
so?
https://hub.spigotmc.org/stash/projects/SPIGOT/repos/craftbukkit/browse/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java#511 I have no clue what this does, but well seemingly it is integer
someone can help me?
I'd still go with Short.MAX_VALUE though because legacy software heh
Ideally your system has a priority
- Search for shaped recipes first
- If no shaped recipes found, get the amount of materials in your grid and try to find shapeless recipes
Just go with a reasonable value and tweak it from there
Shapeless recipes are no more than a list of required materials
i didnt use Bukkit Recipes
I know
But you seem to want to implement something similar to vanilla recipes
Both shapeless and shaped recipes, no?
oooh, yeah! sorry
it's integer
ignore the type for a sec, it repairs the item instead of break it
why
is 30/s reasonable?
Per player? Hell no
lol
Well the type would be important because in the event of trunctiating to a short Integer.MAX_VALUE could become -1
geol for helping me you get this star emoji
โญ
ShapelessRecipes... how that works?
that can help me?
though i still have yet to get this working. I'm still trying
Well your 1x1 recipe in a 3x3 grid is "shapeless". You can put that item in any slot and it will make your recipe, right?
It has no specific shape
๐ค
So all you really need to determine what a shapeless recipe would craft is what items are in the crafting table
If you have one diamond in that slot, that one diamond is going to equate to some recipe result
but what about 2x2 recipes?
You'd have to figure out some way to shuffle around recipe requirements
what you mean?
Say you register recipes that look like this:
x x o
x x o
o o o```
(`x` being an item, `o` being air)
yeah, something like this
Searching for one placed like that is easy. But you'll also have to consider recipes that look like:
o x x o o o o o o
o x x o x x x x o
o o o o x x x x o
i need create 3 variations?
I think ideally you just account for those 4 variations when checking a recipe that has 5 air slots in it
Well 4
How do I check if an item is a crop/harvastable?
whats the new name of initpathfinder in NMS Mojang mapping?
@quiet ice i think i did what you told me to but i did it in visual studio code.
pom.xml
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>dev.tinypoo.spigot.lion</groupId>
<artifactId>Lion</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>jar</packaging>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
</properties>
<repositories>
<repository>
<id>spigot-repo</id>
<url>https://hub.spigotmc.org/nexus/content/repositories/snapshots/</url>
</repository>
</repositories>
<dependencies>
<dependency>
<groupId>org.spigotmc</groupId>
<artifactId>spigot-api</artifactId>
<version>1.17-R0.1-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
</dependencies>
<build>
<sourceDirectory>${project.basedir}/src/main/java</sourceDirectory>
<resources>
<resource>
<directory>${project.basedir}/src/main/resources</directory>
<includes>
<include>plugin.yml</include>
</includes>
</resource>
</resources>
</build>
</project>
plugin.yml
main: dev.tinypoo.spigot.lion.App
name: Lion
version: 0.1
I just don't know what to do now
You said something about the terminal
You can remove the <build> section
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>dev.tinypoo.spigot.lion</groupId>
<artifactId>Lion</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>jar</packaging>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
</properties>
<repositories>
<repository>
<id>spigot-repo</id>
<url>https://hub.spigotmc.org/nexus/content/repositories/snapshots/</url>
</repository>
</repositories>
<dependencies>
<dependency>
<groupId>org.spigotmc</groupId>
<artifactId>spigot-api</artifactId>
<version>1.17-R0.1-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
</dependencies>
</project>
I removed it
I personally always build maven projects via mvn clean install (omitting clean with result in larger jars)
Why is DevBukkit sad?
maven
geol are you saying I should ls my way to this file and then do mvn clean install?
im a little confused
honestly i feel the same
Depends how inclusive you want to be, but Tag.CROPS.isTagged(Material) will probably cover most of what you need
Thanks
Yes - or just start the terminally in your project folder from the start
anyone?
geol help
its D()
i get the same errors even in the console too
[ERROR] Error executing Maven.
[ERROR] java.lang.IllegalStateException: Unable to load cache item
[ERROR] Caused by: Unable to load cache item
[ERROR] Caused by: Could not initialize class com.google.inject.internal.cglib.core.$MethodWrapper
D().a(x, y, z, speed)
Should I reinstall?
Myeah, delete all maven-related files and reinstall
How do I get the Java version a server is running on?
i meant void initpathfinder()
thats also spigot mapping ...
oh, sorry
by the docs it should be int void setDamage (int damage) Sets the damage
Yes, but it doesn't mean that it is actually a short in nms
given that I do not have decompiled mc available I canot comment on whether it really is an int or not, but my first (and only) thought is that types are kinda incompatible
What's the best way to create a listener that does a lot of different things on mob/player death? It manages kill-rewards, kill-effects, stats, hitmarkers, combat tags
i should split it up into different classes/methods that do the individual tasks, but whats the best listener to use
am i getting it right that there aint a GrindstonePrepareEvent?
Hello, need help with my default configfile.
On reload it always gets overridden by the default values.
Already tried saveDefaultConfig()...
Create different listeners
1 use per listener so you can keep organized and readable code
Also more descriptive class names and documentation
You could also make multiple methods in order to keep the code apart and then call those methods in one listener
Yeah, the problem is after testing using EntityDeathEvent and EntityDamageByEntityEvent, if the death is by an entity it will run both the listeners. E.g. if i get shot with an arrow from a skeleton and die, both
EntityDamageByEntityEvent (arrow damager) and
EntityDeathEvent (ENTITY_ATTACK) will be called
i have removed almost all those bugs now, but since im recoding my plugin was just asking if theres a cleaner/easier way to do it
This happens if they are in the same clas too
Lol
The events described when they are fired with the name I'm not sure what you expect
As a Linux user I extracted apache-maven-3.8.5-bin.tar.gz and now I don't know what to do next
you can just make the code you put in the deathevent into the damage event and check whether the health is less or equal 0
oh if you are on linux just install maven through your package manager
sudo apt install maven?
You may also need to have the proper java runtime installed, but that is a lesser issue
is this what you mean?
Probably. I myself use fedora where maven is installed by default, but that should work on debian
this?
ive seen one in the paper documentation
wonder why of all crafting interfaces this has no cb
How would I convert a material name to its minecraft id of minecraft:item_name?
ItemStack().getType().toString() ?
Apache Maven 3.6.3
Maven home: /usr/share/maven
Java version: 17.0.3, vendor: Private Build, runtime: /usr/lib/jvm/java-17-openjdk-amd64
Default locale: en_US, platform encoding: UTF-8
OS name: "linux", version: "5.13.0-44-generic", arch: "amd64", family: "unix"