#help-development

1 messages ยท Page 2163 of 1

tardy delta
#

check the block at their feet?

peak jetty
tardy delta
#

that will check the block under their feet i guess

peak jetty
# tardy delta 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

tardy delta
#

you are casting an event to a fking player

peak jetty
#

how do i make it work then?

#

because i tried it other ways but it made errors

tardy delta
#

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

peak jetty
#

like here?
Player player = PlayerMoveEvent#getPlayer;

tardy delta
#

event.getPlayer()

#

i sent how it would look in the javadocs

#

?jd-s

undone axleBOT
peak jetty
peak jetty
# tardy delta event.getPlayer()

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!");
        }
    }
}```
tardy delta
#

what are you even doing

keen star
#

hi

peak jetty
#

i want to make it so when the player walks on coal ore they get rabbit foot but with a 15 second cooldown

tardy delta
#

hi

keen star
# tardy delta hi

hmm in bukkit 1.16 i found alot of water material what is the real one?

#

and what is legacy_water?

tardy delta
peak jetty
tardy delta
#

so dont use that

keen star
peak jetty
tardy delta
#

sec

peak jetty
#

k

#

kill05 is typing...

misty current
#

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?

tardy delta
peak jetty
keen star
#

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?

misty current
misty current
keen star
misty current
#

there are docs tho, i suggest using

misty current
keen star
misty current
#

google PotionEffect spigot on google

misty current
#

it explains what does each method and constructor do

tardy delta
misty current
peak jetty
peak jetty
keen star
peak jetty
#

(im new)

misty current
#

Bukkit.getScheduler().runTaskLater(plugin, runnable, cooldown as a long in ticks)

chrome beacon
#

?scheduling

undone axleBOT
peak jetty
# misty current `Bukkit.getScheduler().runTaskLater(plugin, runnable, cooldown as a long in tick...

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!");
        }
    }
}```
misty current
keen star
#

Using for is allow?

#

oh forgot what i say

misty current
#

oh hold on i saw it

#
Bukkit.getScheduler().runTaskLater(pluginInstance, () -> {
  player.getInventory().addItem(new ItemStack(Material.RABBIT_FOOT));
}, 15 * 20L);
tardy delta
#

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;
}```
misty current
#

i was gonna comment about the if tower too but

#

then i would have to explain

keen star
#

then it can break normaly

chrome beacon
sharp flare
misty current
sharp flare
#

it takes a bukkit task as the consumer, you can take the parameter and cancel it if the condition is met

misty current
#

basically this happens

chrome beacon
#

I guess reload is too late then. I don't really know never used that way of registering commands

misty current
#

even if this msg is from my executor

keen star
misty current
#

i think i'll try to check the protocol to see if there is a packet for it

misty current
#

but iirc there is one and it is sent when you join

misty current
peak jetty
chrome beacon
misty current
#

is it me or is that outside of a method

#

or a constructor

#

lmfao

chrome beacon
#

^

keen star
sharp flare
# peak jetty

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

misty current
#

im pretty sure you didn't understand the issue

#

also i am not registering commands the way the video does it

tardy delta
#

please

misty current
sharp flare
#

lol

#

that makes it worse

#

but does he know java though

misty current
#

he doesn't

#

most probably

sharp flare
#

thats unfortunate

#

you are dwelling above your powers there

misty current
#

he is putting everything in the class extending JavaPlugin

keen star
# peak jetty

bruhh just ctrl + z then make like @sharp flare this not need to have BukkitscheduleRepeating

peak jetty
# chrome beacon You can't just place it there

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!");
        }
    }
}```
misty current
misty current
tardy delta
#

?di to get the plugin (dont put everything in one class btw)

undone axleBOT
sharp flare
#

this just makes your life hard, please learn java, it hurts not learning the prerequisites

peak jetty
#

Cannot resolve symbol 'i'

#

@keen star

sharp flare
#

this makes it worst too, I thought they were true. ?learnjava

keen star
tardy delta
peak jetty
#

someone just please asnwere and i get it over with

chrome beacon
#

?learnjava It seems you're lacking a bit of Java knowledge

undone axleBOT
earnest forum
#

have you actually made the variable "i"

chrome beacon
#

I assume they put it in the wrong scope

peak jetty
chrome beacon
#

... they told you?

chrome beacon
earnest forum
peak jetty
#

yes but i dont understand

earnest forum
#

learn java

peak jetty
#

f off

#

im trying rn

tardy delta
#

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

chrome beacon
#

Yeah that would be smart

tardy delta
peak jetty
chrome beacon
#

Could you please learn java or hire someone instead of asking us to write the plugin for you

tardy delta
#

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?

keen star
sharp flare
chrome beacon
tardy delta
#

๐Ÿฅฃ

chrome beacon
#

Which is why I've been trying to get them to learn java

#

But we got told to f off

sharp flare
#

people here are good resources while he wants us to f off for not learning java

peak jetty
#

like if i was talking to u

tardy delta
sharp flare
peak jetty
#

????????????????????????????????????????????????

earnest forum
#

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

peak jetty
#

@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);```
peak jetty
earnest forum
#

you're asking

sharp flare
#

Kids nowadays......

earnest forum
#

a basic java question

terse raven
peak jetty
#

i cant just get a normal conversation here jeez

sharp flare
#

because u dont listen

peak jetty
#

u dont tell

terse raven
#

we told you multiple times to learn the basics of java

sharp flare
#

we aint being paid here to do ur bidding

terse raven
#

how have we not been clear

sharp flare
#

god i hate kids

#

im done

tardy delta
#

there is no god here

sharp flare
#

aight my bad

terse raven
#

if not then just load and save it in memory

chrome beacon
#

I'm not sure how exactly it works but I do know it's a map internally

tardy delta
#

its not about crashing something, its about trying to be as efficient as possible but ye ill look at the impl

sharp flare
terse raven
#

ye cashing is more efficient

tardy delta
keen star
#

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.

terse raven
#

API Version in plugin.yml

quaint mantle
tardy delta
#

cant you update some blockstate or smth?

#

idk if that woul work

quaint mantle
#

I tried to update
block.getState().update();

#

not work

eternal oxide
#

any time you call getState() you are getting a NEW copy.

eternal oxide
#

?paste

undone axleBOT
quiet ice
#

block.getState().update() will thus do pretty much nothing outside of physics

quaint mantle
#
        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);
            }
        }

...

eternal oxide
#

Don;t compare Locations. The odds of them actually matching is rare

quaint mantle
#

its not location

#

its UUID

#

public static final Map<Location, UUID> UUID_LOCATION_MAP = new HashMap<>();

chrome beacon
#

You're comparing locations when you call get

quaint mantle
#

no

eternal oxide
#

(!player.getUniqueId().equals(EventoBlockPlace.UUID_LOCATION_MAP.get(block.getLocation()))){

quaint mantle
#

this is a map

#

that returns an UUID

eternal oxide
#

block.getLocation()

chrome beacon
#

I'm aware

eternal oxide
#

use teh block x/y/z not a Location

tardy delta
#

the map will compare locations internal

quaint mantle
#

so this will solve my problem?

terse raven
#

no

eternal oxide
#

probably not

quaint mantle
#

ok

eternal oxide
#

but it needs fixing

quaint mantle
#

can you guys see how LWC works?

#

because idk this happens to it

chrome beacon
#

LWC is open source

quaint mantle
#

yeah, but I could not find out

eternal oxide
#

I was the maintainer of LWC for a few years

tardy delta
#

whats LWC?

quaint mantle
#

lwc container protection plugin

eternal oxide
#

Sorry I was maintaining Lockette

quaint mantle
#

cancel the event, like I'm try to do

tardy delta
#

ah

quaint mantle
#

bu not sure that glitch happens

#

gonna prove

terse raven
#

just decompile the other plugin and look at what they do different

quaint mantle
#

its open source

terse raven
#

even better

quaint mantle
#

but I coul not find anything

chrome beacon
#

What are you looking for?

#

How they cancel the event?

chrome beacon
quaint mantle
#

thx

chrome beacon
#

Also line for their method

eternal oxide
#

All lockette does is cancel the event. Nothing more

tardy delta
#

i see pyramids

quaint mantle
#

first I need to make sure this is not happening

#

I mean, make sure its not a client glitch or something

#

installing lwc

sharp flare
#

as pairs

#

key and value

#

thats what I do for my config manager

chrome beacon
#

That's what FileConfiguration already does

#

Which you can see highlighted in that image

sharp flare
#

oh my bad, didnt know it does that already

#

i should remove my cache map soon

quaint mantle
#

lmao I got it

#

I was cancelling playerInteractEvent at the same time

chrome beacon
#

Ah

quaint mantle
#

I need to check only left click I guess

#

thank you

bold copper
#

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
        }
    }```
eternal oxide
#

check you onl;y run the code for one hand

#

it will also trigger for offhand

bold copper
quaint mantle
#

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().

eternal oxide
#

Even when you right click the event also fires for the offhand for placing torches

manic furnace
#

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

eternal oxide
#

how much data are you writing and is your SQL host on the same machine?

manic furnace
#

It is on the same machine

quaint mantle
#

remote server or local?

manic furnace
#

I write 20 records and for each of them 30 other records

manic furnace
quaint mantle
#

have you tried to use sqlite?

eternal oxide
#

4 seconds to write to file tends to indicate you are writing a Lot of data or your PC is a toaster oven

eternal oxide
#

ok a LOT of data

terse raven
chrome beacon
#

Why do you need that many files ๐Ÿ˜“

manic furnace
quaint mantle
#

can you guys tell me why is not goo idea compare locations? even while working with blocks?

manic furnace
chrome beacon
#

Ah

manic furnace
eternal oxide
terse raven
manic furnace
#

Objects

quaint mantle
terse raven
quaint mantle
#

i got you

eternal oxide
terse raven
manic furnace
# terse raven smh

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;

eternal oxide
#

It will probably work, most of the time, but the odds of it messing up are high

terse raven
#

then there shouldn't be a problem

manic furnace
#

I know

#

And thats what so strange about it

terse raven
quaint mantle
#

yeah, so should i store data to a block or use location?

#

which is the best?

terse raven
quaint mantle
#

ok

manic furnace
manic furnace
#

Sqllite is not a database

misty current
#

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?

terse raven
manic furnace
#

Its just a system that manages files

#

Its not a server

misty current
eternal oxide
terse raven
manic furnace
#

I don't want to use my files option

bold copper
#

I have 1 more question ... Is it possible to use Location as a key for HashMap? Or is it possible, but not recommended?

manic furnace
#

I want to make kt with databases

#

So its faster

terse raven
#

just use SQLite

#

it's a local database

#

in a file

quaint mantle
#

so I think I'm gonna compare the location to string

terse raven
#

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

misty current
#

you can use one as long as you are sure you store locations that are always gonna be the same

#

and not slightly different

manic furnace
# terse raven in a file

Yeah but it should work for much bigger data too and should be usable to save it on external devices

misty current
#

like block locations

terse raven
#

you can just easily replace it with a MySQL database once you need to store more

#

as it both uses sql

manic furnace
#

But that doesn't solve my problem. When i switch to mysql later on, i will have the same issue

terse raven
bold copper
manic furnace
#

That is why i posted my question

terse raven
#

then optimize your queries

#

and cache results

bold copper
terse raven
#

^^^

manic furnace
#

Ok thanks

bold copper
#

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

manic furnace
terse raven
#

send code

manic furnace
#

What code?

bold copper
terse raven
#

the one that you said is slow

manic furnace
#

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();
}
eternal oxide
#

what is in your getPlayers()?

eternal oxide
#

are they actual player objects? or somethign custom?

bold copper
#

if the data is updated

manic furnace
eternal oxide
#

k

manic furnace
bold copper
#

so that the main thread does not wait

manic furnace
manic furnace
manic furnace
#

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?

keen star
#

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

bold copper
manic furnace
#

ok thanks

misty current
#

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?

bold copper
misty current
#

could it be because i messed up the reobfuscation plugin in my pom?

eternal oxide
undone axleBOT
#

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

bold copper
#
                @Override
                public void run() {
                    //do something
                    new BukkitRunnable() {
                        @Override
                        public void run() {
                            //do something sync                        }
                    }.runTaskLater(YourPlugin.getInstance(), 0);
                }
            }).start();```
manic furnace
#

Ok i make evrything in a new thread except the things like caching because i need the data seconds after

tardy delta
#

uhm

manic furnace
#

And in mysql, should i open a new connection evry time or keep it open?

tardy delta
#

close it after you did your stuff

manic furnace
#

Ok

kind hatch
#

You should use HikariCP for mysql. It reuses connections.

tardy delta
#

if you have a big plugin you might use connection pools

#

ah

quiet ice
manic furnace
#

but i dont know if i use it right

tardy delta
manic furnace
#

i connect me to the db and than keep the connection open

tardy delta
#

close it

#

you dont want to waste resources

ivory sleet
#

Yeah altho connections are made to be long lived for most part

misty current
#

im not sure why is it causing an issue now

manic furnace
tardy delta
#

use a connection pool then

#

thats faster

manic furnace
#

yeah i am using hiakri cp

#

*hikaricp

tardy delta
#

but idk if youre talking about the connection opening being slow or the actual database stuff

manic furnace
#

the actual db stuff

tardy delta
#

databases are relatively slow yes

kind hatch
#

That might come down to your query, but it could also just be your internet connection in general.

tardy delta
#

thats why you dont interact with them on the main thread

#

embedded databases for the win

manic furnace
kind hatch
#

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?)

granite owl
#

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)

manic furnace
#

i dont have settings. i just have the username, url and password

tardy delta
#

not that i know

#

isnt there an inv event fired when the items go to the other inv?

bold copper
#

you can also implement a request queue in a separate thread, so as not to create a new one every time

granite owl
#

hm

tardy delta
#

request queue?

#

i normally run my database stuff on a threadpool so the queries dont have to wait

bold copper
# tardy delta request queue?

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.

tardy delta
#

why not using a threadpool then?

ivory sleet
#

^ a thread pool with an appropriate blocking coefficient would be much more sophisticated and scalable here

misty current
#
            <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

ivory sleet
#

Are you using reflection?

tardy delta
#

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?

misty current
#

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

kind hatch
#

Well if you are using the remapped version, the names of NMS methods will change. Also, 1.17 remapped was a little jank.

ivory sleet
bold copper
misty current
tardy delta
#

i saw the FileConfiguration#getString uses some internal parsing first to get the actual value

ivory sleet
#

Yes but thatโ€™s negligible

#

It just grabs the value from the linked hash map and tries to turn it into a string basically

kind hatch
misty current
#

i meant remap the jar

kind hatch
#

Yes and no.

misty current
#

so the names are not mismatched

ivory sleet
#

Ye

tardy delta
#

and i didnt really find a good tutorial for resourcebundles

kind hatch
#

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.

ivory sleet
#

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

misty current
tardy delta
#

i saw essentials also using it but i didnt understand their code

misty current
#

that's the mojang mapping name

ivory sleet
#

Ye

kind hatch
#

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.

bold copper
kind hatch
#

The player connection. Similar to normal NMS, CraftPlayer#connection#getHandle(), but instead with mojang names.

misty current
#

this is the obfuscated class and getHandle is there but returns the object with the obfuscated name

#

and my jar is not getting remapped

manic furnace
misty current
#

somewhere i cant spot

kind hatch
misty current
#

then how are my jars imports supposed to match the obfuscated ones?

kind hatch
#

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

kind hatch
kind hatch
#

You aren't getting any errors with maven are you? Just on the server?

misty current
#

yup

#

only at runtime

dense falcon
#
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?
misty current
#

get the name of the held item of the player

tardy delta
#

uhm that doesnt look valid

#

?event-api

undone axleBOT
misty current
#

also yes

#

the event api usage is wrong

river oracle
#

Wtf is that

misty current
#

what the fuck is init

#

lol

river oracle
#

Why Is it static more importantly

kind hatch
# misty current only at runtime

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);
misty current
#

it looks more like a main method of a java program than a listener

crisp steeple
#

how you gonna place a null block

misty current
#

getHandle to be precise

#

throwing a NoSuchMethodError

dense falcon
#

Thank you man !

tardy delta
kind hatch
#

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()

misty current
#

the exception is about the .getHandle call

keen star
#

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

misty current
#

on CraftWorld

bold copper
# manic furnace I actually don't have any idea how to do that
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);
}```
ivory sleet
#

Ugh

kind hatch
# misty current on CraftWorld

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.

misty current
#

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

tardy delta
#

what am i looking at lol

kind hatch
#

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.

ivory sleet
kind hatch
#

?paste

undone axleBOT
kind hatch
tardy delta
#

why not checking if the queue is empty before making a thread?

ivory sleet
#

That implementation pattern will nonetheless run into concurrency update issues

tardy delta
#

tAkE tHe ThReAdPoOl

#

aight now i understand how resourcebundles work

ivory sleet
#

Pog

misty current
#

conclure do you have any ideas about my issue?

ivory sleet
#

Nope I havenโ€™t once used moj maps with maven sadly

misty current
#

ah rip

#

shadow can you try to remove the remapping plugin and try to run the same code again?

kind hatch
#

If I did that, I would have to rewrite the code to use the obfuscated methods, some of which I do not know.

misty current
#

don't remove the mojang mappings import, just the remapper plugin

#

i want to see if the error would look similar to mine

kind hatch
#

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?

misty current
#

sec

dense falcon
#

How can I check the name of an inventory?

misty current
#

you need to get the inventoryview

misty current
#

no

#

a player's inventory view

#

and then get the name from that

#

the method name should be getView from the player interface

kind hatch
# misty current https://paste.md-5.net/zecuyubori.xml

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.

dense falcon
#

I am using the InventoryEvent .

#

Ah getView!

misty current
#

it should have a method too

dense falcon
#

Yeah I found, getTitle.

misty current
#

also if you are using it to recognize guis i suggest to not do that, it's a sloppy way to do it

misty current
#

kinda annoying but eh

#

yea using the obfuscated jar works fine

#

thanks for the help

kind hatch
#

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. ๐Ÿ˜›

misty current
#

or even worse a player could rename a chest and place it down

#

at least it worked first try

misty current
#

the field name of playerconnection was "b"

#

took a bit to find

dense falcon
#

getSize*

kind hatch
#

Or you could just compare inventory instances and you won't have any issues with names, content, or conflicts with other plugins. ๐Ÿ˜„

misty current
#

it's like using lore to detect enchantments

tardy delta
#

wdym the file is empty ๐Ÿ˜‚

misty current
#

and what my gui api does

#

i suggest doing that

#

but up to u i guess

dense falcon
tardy delta
#

owh empty yaml files should contain [] or somthingg

dense falcon
#

Inventory instances?

#

Wdym?

misty current
#

do you know what does instance mean

tardy delta
#

you are an instance of the class Dog

#

wait

#

Human

dense falcon
#

It depends on the context, there I do not understand where you are coming from.

#

Ah.

kind hatch
#

No no, you were on to something there. lmao

sharp flare
#

sqlite doesn't require logging in right

dense falcon
#

You mean I have to check if it comes from Bukkit?

misty current
misty current
#

anyways no

#

also it's not about context

#

in java do you know what an instance is

dense falcon
#

That it comes from something.

For example sender instanceof Player

tardy delta
#

if (kill05 instaceof Dog) ((Dog)kill05).bark()

kind hatch
dense falcon
#

Yeah so what I have to check?

#

if inv instance of what ?

misty current
#

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

kind hatch
#

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()

misty current
#

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

granite owl
#

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

misty current
#

inventory drag event

granite owl
#

ty

granite owl
bleak oak
#

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

granite owl
#

prob has rather something to do within your command that breaks

#

than with the command api itself

bleak oak
#

My command work

granite owl
#

cause ur not relevant for a command to be recognized

bleak oak
#

Just the server make nothing

granite owl
#

u know sometimes code can help

#

xD

bleak oak
#

Look

#

I put

#

This

#
System.out.println("test 3");
#

Ok?

tardy delta
#

?paste the command

undone axleBOT
bleak oak
#

[16:14:37] [Server thread/INFO]: test 3

granite owl
#

just paste the code of your command

bleak oak
#

Nothing

sharp flare
bleak oak
#

You want just the command?

kind hatch
humble tulip
#

oh shadowmaster said it first

granite owl
sharp flare
#

yeah its an easy one since its same

bleak oak
#

My command is just

granite owl
#

iirc if ur using a command executor u need to inject ur command urself

#

into the command map

kind hatch
#

No, you just need to register it with #setExecutor()

worldly ingot
#

No no, you can set the executor ;p

bleak oak
#

You don't understand xd

#

The command work

#

Ok?

#

But

kind hatch
bleak oak
#

When i leave and re-join the server

#

It doesn't work anymore

#

I can make a record if you want

eternal oxide
#

we need to see code for this part java ModPlayer modPlayer = ModPlayer.instance(player); modPlayer.mod();

worldly ingot
#

Almost certain that you're using a Player as a Map key or something

#

Player instances are not the same between joins

tardy delta
#

lets see ๐Ÿ‘€

worldly ingot
#

(that's why we generally advise the use of their UUID as identifiable keys)

bleak oak
tardy delta
#

ahha

worldly ingot
#

Aw they use UUIDs :((

worldly ingot
#

Guess I'm wrong

#

lol

#

Yeah they're invalidated between joins

bleak oak
#

But I don't think it's that because

worldly ingot
#

Yeah you're using UUIDs. Can disregard

tardy delta
#

that code looks weird, what is it supposed to do?

eternal oxide
#
this.getPlayer().getInventory().clear();```You are storing a reference to a player object `this.player`
bleak oak
#

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

worldly ingot
#

Mmmm, actually, yeah. Does your ModPlayer hold a Player field?

#

Or does getPlayer() return Bukkit.getPlayer(playerUUID)?

tardy delta
#

i guess it holds a player

#

๐Ÿ‘€

bleak oak
#

Player field define in the object constructor

worldly ingot
#

Yeah so that's the issue then

bleak oak
#

Really? I don't think so, I delete the ModPlayer object when the player leave

worldly ingot
#

Correct, but remember that the Player object is invalidated

bleak oak
#

I will test that

worldly ingot
#
private final UUID playerUUID;

public ModPlayer(Player player) {
    this.playerUUID = player.getUniqueId();
}

public Player getPlayer() {
    return Bukkit.getPlayer(playerUUID);
}```
bleak oak
#

So I need to replace the player by Bukkit.getPlayer(playerUUID)

worldly ingot
#

Crude solution would be this

bleak oak
#

I test that

tardy delta
#

just pass in an uuid tho

worldly ingot
#

I mean yeah, whatever you want lol

tardy delta
#

go to the shame corner, now!

worldly ingot
#

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()

bleak oak
#

It works, thanks, I learned something today lol

worldly ingot
#

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

little panther
#

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?

flat olive
#

Yeah so somehow you access the rain property and if the rain is touching a player damage, else donโ€™t.

summer scroll
tardy delta
#

toxic rain aaa

little panther
#

because it continues to damage even if it stops raining or if they go below a block

little panther
little panther
summer scroll
little panther
wanton remnant
#

Hello, does anyone know how to prevent entities from colliding with a particular player? Thanks in advance

little panther
#

wrong line, 29

#

checked the whole class, sorry ๐Ÿ˜„

summer scroll
little panther
#

is there a better way to do it?

summer scroll
#

I guess you can create one runnable and loop through all players.

#

No need to listen to any events.

little panther
#

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

summer scroll
#

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.

little panther
#

so i should instead make a runnable that checks the correct players world and if its raining?

summer scroll
#

Yes, one task that's it.

little panther
#

ill create it, is it okay if i come back and double check with you if its correct when im done?

summer scroll
#

Sure thing

little panther
#

thanks for now mate ๐Ÿ˜„

summer scroll
#

no problem, good luck

harsh totem
#

I have this but the IDE says Cannot resolve symbol 'ITEM_BREAK'
player.playSound(player.getLocation(), Sound.ITEM_BREAK, 1, 1);

void shale
#

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

wet breach
harsh totem
#

wdym

tardy delta
#

isnt it block_break

harsh totem
#

how can this sound not exist

tardy delta
#

Sound.SLENDERMAN doesnt exist either

#

:(

harsh totem
#

oh its ENTITY_ITEM_BREAK

void shale
#

well I will assume its impossible

crisp steeple
#

Nothing is impossible

pastel elm
#

is there a plugin that brings back the arrow physics from 1.8 Minecraft

vast abyss
#

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.

undone axleBOT
void shale
humble tulip
#

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

tardy delta
#

isnt Entity#setCollision a thing?

humble tulip
#

does the first one send data to the client?

tardy delta
#

also for disabling collision between players you need to put them in the same team with the collision rule disabled

humble tulip
#

ps i want to send data to a player on a server

tardy delta
#

didnt seem to work between a player and a sheep

#

not for players atleast

harsh totem
#

I use player.getItemOnCursor() when the player holds a pickaxe and it returns air

#

wtf?

humble tulip
#

@harsh totem is this on inventory click?

humble tulip
#

what event then?

harsh totem
#

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?

humble tulip
#

player.getItemInMainHand?

#

or do you mean the cursor item?

#

they wont have one if inventory is closed

harsh totem
#

I used item.setDurability((short) 0); and it does nothing, why?

void shale
#

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

tardy delta
#

check out their docs

#

hmm i guess i shouldnt be using suppliers for strings

harsh totem
tardy delta
crisp steeple
crisp steeple
#

i donโ€™t really see the difference

harsh totem
#

the sound and animation

crisp steeple
#

well you could just play the sound

harsh totem
#

yes but the animation

crisp steeple
#

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

harsh totem
#

I know for sure that the line was executed

crisp steeple
#

try using the non deprecated method(s) then

#

it would be Damageable iโ€™m pretty sure

worldly ingot
# tardy delta hmm i guess i shouldnt be using suppliers for strings

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)
harsh totem
worldly ingot
#

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

harsh totem
#

Cannot resolve method 'setDamage' in 'ItemMeta'

crisp steeple
#

look at what i sent

tardy delta
worldly ingot
#

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

harsh totem
#
                damageable .setDamage(Integer.MAX_VALUE);``` it also does nothing
tardy delta
#

very hot

harsh totem
#

oh bruh

#

nvm

tardy delta
#

cant barely hold it

harsh totem
#

im an idiot

harsh totem
tardy delta
harsh totem
#

that's what i've done

tardy delta
#

i guess you have to set the itemmeta back

#

yep

worldly ingot
#

getItemMeta() returns a clone, yes, you have to set it

tardy delta
#

why is it actually returning a clone?

harsh totem
#

I did item.setItemMeta(damageable); and still nothing happens

crisp steeple
#

are you sure the item you have is working at all?

#

try changing the name of it or something

worldly ingot
harsh totem
#

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.

worldly ingot
#

You can create ItemMeta independent of an ItemStack and just re-apply that same meta to numerous items

tardy delta
#

hmm

worldly ingot
#

Item meta isn't necessarily owned by an item stack, it's just a property of it

harsh totem
#
                damageable.setDamage(Integer.MAX_VALUE);
                item.setItemMeta(damageable);``` why isn't it breaking the item?
crisp steeple
#

can you send the code on how you get the item

harsh totem
#

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

crisp steeple
#

and youโ€™re sure the item meta is actually an instance of damageable?

kind hatch
#

Because not all items are damagable. Like food for instance.

harsh totem
#

its a pickaxe

#

it must have durability

kind hatch
#

That's fine, but not all items are like that. Hence why you need to check if the item is an instance of Damagable.

harsh totem
worldly ingot
#

iirc, ItemMeta does implement Damageable

#

So technically speaking, they do all have damage, they just may not do anything with it

tardy delta
#

ye it checks for instanceof

worldly ingot
#

Yes. All ItemMeta is Damageable. You don't need to instanceof check it

crisp steeple
worldly ingot
#

Not for Damageable

crisp steeple
tardy delta
#

wait ye

#

itemstack is

tardy delta
#

wait no it isnt either

#

๐Ÿ˜‚

worldly ingot
#

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

harsh totem
#

guys please help

crisp steeple
#

btw does anyone know why that class isnโ€™t public?

#

i was wondering that when trying to do something with it

worldly ingot
#

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

prime kraken
#

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
worldly ingot
#

but its public (non-overridden) methods are off limits ;p

crisp steeple
#

rip

tardy delta
#

because its the bukkit implementation?

worldly ingot
#

CraftBukkit's CraftMetaItem, yes

crisp steeple
#

i was trying to access its serialized inner class before

tardy delta
#

does this include querying databases too?

quaint mantle
#

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.
harsh totem
#

what should i do

tardy delta
quaint mantle
#

yes

#

was that the wrong thing?

tardy delta
#

lol im looking at all those archetypes

kindred valley
#

hello when im building artifacts its not showing on ide

tardy delta
#

are you working with maven or gradle?

kindred valley
#

?paste

undone axleBOT
kindred valley
tardy delta
#

did you specify the right path to your main class in your plugin.yml?

tardy delta
#

do you even have java installed?

quaint mantle
tardy delta
#

looks fine

kindred valley
tardy delta
#

uhh idk then

quaint mantle
#

what about me?

tardy delta
#

specify your api version btw

harsh totem
#

Why does it repair the item instead of break it? damageable.setDamage(Integer.MAX_VALUE);

harsh totem
#

why

quaint mantle
#

cuz it might break it

tardy delta
quaint mantle
quiet ice
tardy delta
#

everything works for me

quaint mantle
kindred valley
quiet ice
#

I personally never used maven archetypes because defining the maven pom manually is much nicer

quaint mantle
quiet ice
tardy delta
#

broke my ide

quiet ice
#

damage is in short iirc

quaint mantle
#

geol please help make me do what you do

quiet ice
#

I do it, but I either use sublime text or eclipse - but never vscode

quaint mantle
#

why not VScode?

harsh totem
quiet ice
#

I grew up with sublime text - too complicated to switch at this point heh.

harsh totem
#

in damageable its int

quiet ice
#

?jd-s

undone axleBOT
quaint mantle
#

geol, if i get sublime text 3, will you help me?

#

just for the maven thing or whatever this is

#

please

quiet ice
#

Just define the maven pom manually, it will work just as well

river oracle
#

Use notepad++ it's the best ide

kindred valley
#

i willfuck with intellij, really

quiet ice
#

I know that it (building projects) works via the command line for me, so the editor really should not be an issue

quaint mantle
#

how often are player movement packets sentout? 20/s ?

quiet ice
#

Which is the good thing about maven

harsh totem
quaint mantle
quiet ice
harsh totem
quiet ice
#

?stash

undone axleBOT
quaint mantle
#

mh so at max 4/s huh

quiet ice
#

Well it can still be quite often

quaint mantle
#

well i want to send out packets like player movement but not sure how much is too much

final monolith
final monolith
#

someone can help me?

quiet ice
#

I'd still go with Short.MAX_VALUE though because legacy software heh

worldly ingot
#

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
quiet ice
worldly ingot
#

Shapeless recipes are no more than a list of required materials

worldly ingot
#

I know

#

But you seem to want to implement something similar to vanilla recipes

#

Both shapeless and shaped recipes, no?

final monolith
#

oooh, yeah! sorry

harsh totem
#

ignore the type for a sec, it repairs the item instead of break it

#

why

quaint mantle
quiet ice
#

Per player? Hell no

quaint mantle
#

lol

quiet ice
#

Well the type would be important because in the event of trunctiating to a short Integer.MAX_VALUE could become -1

quaint mantle
#

geol for helping me you get this star emoji
โญ

final monolith
#

that can help me?

quaint mantle
#

though i still have yet to get this working. I'm still trying

worldly ingot
#

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

final monolith
#

๐Ÿค”

worldly ingot
#

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

final monolith
#

but what about 2x2 recipes?

worldly ingot
#

You'd have to figure out some way to shuffle around recipe requirements

final monolith
#

what you mean?

worldly ingot
#

Say you register recipes that look like this:

x x o
x x o
o o o```
(`x` being an item, `o` being air)
final monolith
#

yeah, something like this

worldly ingot
#

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
final monolith
#

i need create 3 variations?

worldly ingot
#

I think ideally you just account for those 4 variations when checking a recipe that has 5 air slots in it

humble tulip
#

Well 4

final monolith
#

lol

#

ok, thats A problem

celest nacelle
#

How do I check if an item is a crop/harvastable?

iron palm
#

whats the new name of initpathfinder in NMS Mojang mapping?

quaint mantle
#

@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

quiet ice
#

You can remove the <build> section

quaint mantle
#
<?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

quiet ice
#

I personally always build maven projects via mvn clean install (omitting clean with result in larger jars)

quaint mantle
#

Why is DevBukkit sad?

next stratus
#

maven

quaint mantle
#

geol are you saying I should ls my way to this file and then do mvn clean install?

#

im a little confused

quaint mantle
worldly ingot
celest nacelle
#

Thanks

quiet ice
quaint mantle
#

geol help

final monolith
quaint mantle
#

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
final monolith
#

D().a(x, y, z, speed)

quaint mantle
#

Should I reinstall?

quiet ice
#

Myeah, delete all maven-related files and reinstall

lost sedge
#

How do I get the Java version a server is running on?

iron palm
final monolith
#

oh, sorry

harsh totem
quiet ice
#

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

sacred mountain
#

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

granite owl
#

am i getting it right that there aint a GrindstonePrepareEvent?

distant forge
#

Hello, need help with my default configfile.
On reload it always gets overridden by the default values.

#

Already tried saveDefaultConfig()...

river oracle
#

1 use per listener so you can keep organized and readable code

#

Also more descriptive class names and documentation

crimson terrace
#

You could also make multiple methods in order to keep the code apart and then call those methods in one listener

sacred mountain
# river oracle Also more descriptive class names and documentation

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

river oracle
#

Lol

#

The events described when they are fired with the name I'm not sure what you expect

quaint mantle
#

As a Linux user I extracted apache-maven-3.8.5-bin.tar.gz and now I don't know what to do next

crimson terrace
#

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

quiet ice
quaint mantle
#

sudo apt install maven?

quiet ice
#

You may also need to have the proper java runtime installed, but that is a lesser issue

quaint mantle
quiet ice
#

Probably. I myself use fedora where maven is installed by default, but that should work on debian

granite owl
#

ive seen one in the paper documentation

#

wonder why of all crafting interfaces this has no cb

celest nacelle
#

How would I convert a material name to its minecraft id of minecraft:item_name?

granite owl
quaint mantle