#help-development

1 messages · Page 2018 of 1

vivid cave
#

okay thx

lean gull
#

what's that do

vivid cave
#

1.8 had no cooldown at all right?

lean gull
#

in 1.8 you could hit 8 times per second

fossil lily
#
public class QuitEvent implements Listener {
    @EventHandler
    public void playerQuitEvent(PlayerQuitEvent e){
        Player p = e.getPlayer();
        World world = p.getWorld();
        for (Entity entity : world.getEntities()){
            if (entity instanceof Horse) {
                if (horsealive.containsKey(p.getUniqueId().toString())){
                    if (((Horse) entity).getOwner().equals(p)) {
                        entity.remove();
                    }
                }
            }
        }
    }
}

So I have this code, and im trying to make it delete the players horse when the log out. Whats wrong here? Nothing seems to be happening when a player logs out.

quiet ice
lean gull
#

it shows a red line

vivid cave
lost matrix
quiet ice
lean gull
lean gull
#

i'm on java 17 it appears

quiet ice
#

Then you did an syntax error

lean gull
#

prefix.translateEscapes();

visual tide
fossil lily
tardy delta
#

save the data in the pdc

maiden briar
#

JavaPlugin#getResource("duels/inventories/combo.yml") returns null??

#

🤦 misspelled, I just saw it

ivory sleet
#

🥲

waxen plinth
#

👀

#

it doesn't have to be though

red sedge
#

what database should i use

waxen plinth
#

Depends

#

I generally use sqlite unless I need the data to sync between servers

red sedge
#

so i cant really choose

ivory sleet
#

I mean there are a couple significant ones
SQLite
H2
MySQL, MariaDB and PostgreSQL
MongoDB

(Redis)

I mean there are tons more than what was mentioned but those are the most common ones around here to my knowledge

waxen plinth
#

You should take a look at RedLex, it makes it pretty trivial

red sedge
#

RedLex?

waxen plinth
#

My lexer generator library

ivory sleet
#

lol. A good start would be to learn SQL

waxen plinth
#

You give it bnf and it gives you a lexer that can take in a file of any context-free format and spit out an abstract syntax tree

#

I used it to make a json parser in 60 lines and a tinybasic interpreter in 400

red sedge
ivory sleet
#

SQL is the way you talk to MySQL

waxen plinth
#

SQL is the language

ivory sleet
#

etc

waxen plinth
#

MySQL, SQLite, all the different implementations of it have slight variations on the syntax and behavior

ivory sleet
#

^ but at a basic level they’re pretty identical

red sedge
#

hmm

#

okay

#

all of this is extremely new to me

ivory sleet
#

It’s worth learning, especially if you’re interested

#

Yeah

red sedge
#

so i should learn SQL first right

ivory sleet
#

Yes

red sedge
#

okay

waxen plinth
#

SQL is pretty easy to learn

ivory sleet
#

And just pick either SQLite, MySQL or MariaDB or PostgreSQL

waxen plinth
#

MariaDB is MySQL though

ivory sleet
#

Gotta start somewhere (c

ivory sleet
young knoll
#

Each one has slightly different syntax just to mess with you

quaint mantle
#

Whats the difference in bukkit runnable between runtasklater and runtasktimer?

waxen plinth
#

I thought mariadb was just an implementation of the mysql server

waxen plinth
#

The other only runs one time

quaint mantle
#

ok

#
    @EventHandler
    public void onAsync(AsyncPlayerPreLoginEvent e) {
        UUID profileTwo = UUID.randomUUID();
        for (Field f : e.getClass().getDeclaredFields()) {
            if (f.getName().equalsIgnoreCase("uniqueId")) {
                f.setAccessible(true);
                try {
                    f.set(e, profileTwo);
                } catch (IllegalArgumentException e1) {
                    e1.printStackTrace();
                } catch (IllegalAccessException e1) {
                    e1.printStackTrace();
                }
                f.setAccessible(false);
            } else {
                System.out.println(f.getName());
            }
        }
        System.out.println("SPOOF: " + e.getUniqueId() + " | " + profileTwo);
    }```
I'm trying to create multiple profiles for each player i use many plugins like mcMMO, auction houses and others
#
[18:28:03] [User Authenticator #17/INFO]: UUID of player MYNAME is 59XXX20-4XX0-4aXX-86XX-1e3XXXe718```
#

worked for a second*

waxen plinth
#

..

#

Don't do it that way

quaint mantle
#

I tried doing it another way

waxen plinth
#

That is so bad

red sedge
#

wait databases are stored locally right

waxen plinth
#

They can be remote

quaint mantle
red sedge
quaint mantle
red sedge
#

okay

waxen plinth
#

Why do you need to "create another profile"?

quaint mantle
young knoll
#

Just doing it properly by interfacing with all your plugins would be better

waxen plinth
#

^

young knoll
#

And yes I understand that is more work

waxen plinth
#

You could have a plugin that swaps inventories and such per profile

#

It's more work but it's a way better solution

young knoll
#

Agreed

waxen plinth
#

Trying to hack it like that is going to cause so many issues

quaint mantle
waxen plinth
#

Then you'll have to rewrite those

#

Or find a way to hotswap the player data

sacred mountain
#

redempt dont you have a config api util whatever thing

#

or is that a command framework

quaint mantle
#

I want to hack it tho?

sacred mountain
#

cant remember

quaint mantle
#

Take an example quests plugin it gets weekly updated

#

I have to weekly update it

#

Or be stuck at old version

#

So hacking it is the only way

sacred mountain
#

@waxen plinth

young knoll
#

RedLib has a config API

hybrid spoke
#

i would not fuck with the gameprofiles

quaint mantle
quaint mantle
lost matrix
waxen plinth
#

Config and commands

#

Why?

sacred mountain
#

wanted to check it out but didfnt know which one it was

#

i looked at the redlib github

#

it looks really clean ill give it a try

lost matrix
sacred mountain
#

mlao

waxen plinth
lost matrix
waxen plinth
lost matrix
waxen plinth
#

Exactly

#

I'm very much a backend guy

#

I like making all the cogs and the frameworks to support things, but when it comes to actually implementing features I drag my feet because it's so much more annoying

#

You have to worry about appearances and such

quaint mantle
#

same

carmine pecan
#

Anyone here know if it's possible to get the time a packet from the client was sent using Protocollib? For instance the BLOCK_PLACE packet

kindred valley
#

?learnjava

lost matrix
undone axleBOT
hybrid spoke
ancient plank
#

back end is pog

carmine pecan
ancient plank
#

I can only do front-end guis in minecraft inventories

hybrid spoke
#

if you want to have the time the client actually sent the packet, you would need to do it clientside

carmine pecan
#

I see

echo basalt
#

Ehh the closest you got is subtracting the ping from the current ms

grim ice
#

i need a lib idea im bored

quaint mantle
grim ice
#

like copying chunks?

grim ice
#

check my github

echo basalt
grim ice
quaint mantle
# grim ice lmao

Fine, library has the ability to store any object, get any object efficiently stored in sqlite

grim ice
#

@quaint mantle alr has

#

ChunkSerializer in my github

echo basalt
#

Make a library that allows you to spawn any NPC and take control of it

echo basalt
#

Basically operating multiple accounts in one

quaint mantle
grim ice
#

u mean morph into npcs?

echo basalt
#

So you do like

hybrid spoke
#

ChunkSnapshot youknow

echo basalt
#

/testsubject one

#

would spawn an npc called "one"

#

/override one

grim ice
#

its really easy to use tho

echo basalt
#

would make you take control of the npc "one"

#

effectively allowing alt-less testing

grim ice
#

really hard

#

or impossible

#

probabl

echo basalt
#

nah

#

tons of npcs

#

and fetching data

grim ice
#

and how would u morph into it

echo basalt
#

or you do it entirely through packets

#

/override one spawns a copy npc of you

#

and teleports you to the other player

#

and sends skin packets

grim ice
#

yeah

hybrid spoke
#

despawn the NPC, change players skin and name, set NPC once done

grim ice
#

and?

#

thats a npc

#

it wont be able to do anything

echo basalt
#

syncs permissions, inventory

quaint mantle
#

Already done

#

WorldQL

grim ice
#

yeah thats like impossible, to completely copy it

quaint mantle
#

something like it

lost matrix
echo basalt
#

worldql shards a minecraft world

#

I mean copypasting player data

#

much like a funky controllable spectator mode

quaint mantle
grim ice
#

better check ur method names doe

#

onAsync says nothing

#

about a preloginevent

quaint mantle
#

Checked it too

#

ill check again

lost matrix
quaint mantle
#

ill try protocollib

lost matrix
quaint mantle
#

Well i thought of it at the first when i started but i was like what it has to do with packets

lost matrix
# lost matrix Like somewhere in here

And you probably would want the server to never receive any unspoofed packets at all. So this should
preferably done at proxy level (bungee, waterfall, velocity)

#

Either way you have to let the player re-login

quaint mantle
lost matrix
#

The problem is: The client still knows it own UUID. So you need to listen to all incoming packets on proxy level
and use a Map<UUID, UUID> to translate them for your server.

#

I'll lean out the window and say that something like this would take at least 4 months to develop.

quaint mantle
#

Can i boost this process by making the server offline/making it on bungee?

lost matrix
#

Probably a bit

#

It will be a lot easier this way

quaint mantle
#

Why when this event executes nothing happens?

public class PlayerMoveListener implements Listener {


    TestPlugin plugin;

    @EventHandler
    public void onMovement(PlayerMoveEvent e) {
            Player player = e.getPlayer();
            World world = player.getWorld();
            Block block = player.getLocation().subtract(0, 1, 0).getBlock();
            Material type = block.getType();
            if (type != Material.GLOWSTONE && type != Material.AIR) {
                block.setType(Material.GLOWSTONE);

                new BukkitRunnable(){
                    public void run(){
                        block.setType(type);
                    }
                }.runTaskLater(plugin, 60L);

            }
        }
}```
quaint mantle
#

is plugin null?

quaint mantle
quaint mantle
lost matrix
somber sequoia
#

how would i send a player to a different server with bungeecord while using a bukkit plugin

somber sequoia
#

could you elaborate on that

quaint mantle
#

everything works except bukkitrunnable

lost matrix
somber sequoia
#

ok thank you

lost matrix
quaint mantle
#

So how do i change uuid in bungeecord?

#

This is only thing that doesnt get executed

                    public void run(){
                        block.setType(type);
                        player.sendMessage("asd");
                    }
                }.runTaskLater(plugin, 60L);```
lost matrix
lost matrix
grim ice
#

@Override btw

quaint mantle
#

omg

#

im idiot

#

plugin was null al ltime im idiot

grim ice
#

lol

sage dragon
#

Is there any info of how long the swing animation takes?

lost matrix
grim ice
#

singletons do the same right

sage dragon
naive loom
#

im setting a permission attachment to a player and when they relog it removes the permission entirely, does anyone have an idea?

eternal oxide
#

when they relog its a new player object. you have to apply the attachment every time they join

quasi patrol
#

Does event.getCommand(); for ServerCommandEvent return the command and the arguments, or just the base command?

dusk flicker
#

?tas

undone axleBOT
quasi patrol
#

And does it return the / too?

dusk flicker
#

stupid bot don't embed

young dome
#

Can we detect if an inventory is not a default inventory in spigot with packets or else ? (an inventory created on the client side)

maiden thicket
#

shouldn't
mob.targetSelector.addGoal(0, new NearestAttackableTargetGoal<>(mob, Player.class, 10, true, false, entity1 -> !entity.getUniqueId().equals(player.getUniqueId())));
make it so it'll choose a target nearby where the entity uuid does not equal a player uuid

elfin atlas
#

Is there a packet to set a player a spectator target? (That the player is going inside the entity in gamemode 3?)

golden turret
#

how could i edit the slow falling effect

#

i would like to make it slower

wet breach
#

what is with people wanting to only mess with packets o.O

wet breach
quaint mantle
#
playerData.getStringList("players." + player.getUniqueId().toString() + ".treaties").add(clickedPlayer.getUniqueId().toString());
                            playerData.getStringList("players." + clickedPlayer.getUniqueId().toString() + ".treaties").add(player.getUniqueId().toString());
#

When setting the data, its not updating at all.

#

Even with EmeraldsPlugin.data.saveConfig();

#

Did I do something wrong?

elfin atlas
wet breach
#

why do you need to use packets for it?

elfin atlas
#

Because I have packet based entities

wet breach
#

to answer your question yes there is a packet for it

molten hearth
#

say my config is yml cmdInfo: hugthem: description: "gib a hug" permission: "example.hug" senderMessage: "" receiverMessage: "" what would I need to do to read everything command under cmdInfo

#

getStringList was empty and get apparently returns a configuration and I cant loop those

kind hatch
molten hearth
elfin atlas
kind hatch
elfin atlas
lost matrix
#

Oh nvm you have packet based entities

#

If you want to use the API then you have to implement the spigot interfaces i guess

quaint mantle
#

My event, InteractEntityEvent, takes more than 1 item if they have more than 1, when interacting (2)

#

Any way to stop that?

tardy delta
#

hmm?

lost matrix
quaint mantle
lost matrix
kind hatch
#

Check to see if the item they are holding is in their main hand.

quaint mantle
#

Okay.. then how do I make it only take 1 item?

lost matrix
quaint mantle
#

@lost matrix

lost matrix
# quaint mantle
  @EventHandler
  public void interactEntity(PlayerInteractEntityEvent event) {
    ItemStack item = event.getPlayer().getInventory().getItem(event.getHand());
    
  }

instead of

  @EventHandler
  public void interactEntity(PlayerInteractEntityEvent event) {
    ItemStack item = event.getPlayer().getInventory().getItemInMainHand();
    
  }
#

This way you support both hands

quaint mantle
lost matrix
kind hatch
#

You could also compare the hand the player uses with PlayerInteractEvent#getHand(). That way you can only make specific things work if it's in the main hand or the off hand.

quaint mantle
patent horizon
#

i.setPickupDelay(-1); how come this doesnt work?

#

i thought that was how to make items non-pickup-able

kind hatch
#

Set it to the max value instead.

patent horizon
#

ah ok

#

how do i do that again

#

like int.max_value or smth

kind hatch
patent horizon
#

ah cool beans

#

nvmd

#
java.lang.IllegalStateException: No API implementation set. Is Holographic Displays enabled?
    at com.gmail.filoghost.holographicdisplays.api.internal.BackendAPI.getImplementation(BackendAPI.java:36) ~[Plex-1.0-SNAPSHOT-all.jar:?]
    at com.gmail.filoghost.holographicdisplays.api.HologramsAPI.createHologram(HologramsAPI.java:46) ~[Plex-1.0-SNAPSHOT-all.jar:?]
    at net.plexpvp.core.combat.BountyHologram.draw(BountyHologram.java:24) ~[Plex-1.0-SNAPSHOT-all.jar:?]
    at net.plexpvp.core.combat.CombatCore$1.run(CombatCore.java:58) ~[Plex-1.0-SNAPSHOT-all.jar:?]
    at org.bukkit.craftbukkit.v1_18_R1.scheduler.CraftTask.run(CraftTask.java:101) ~[paper-1.18.1.jar:git-Paper-177]
    at org.bukkit.craftbukkit.v1_18_R1.scheduler.CraftScheduler.mainThreadHeartbeat(CraftScheduler.java:483) ~[paper-1.18.1.jar:git-Paper-177]
    at net.minecraft.server.MinecraftServer.tickChildren(MinecraftServer.java:1547) ~[paper-1.18.1.jar:git-Paper-177]
    at net.minecraft.server.dedicated.DedicatedServer.tickChildren(DedicatedServer.java:480) ~[paper-1.18.1.jar:git-Paper-177]
    at net.minecraft.server.MinecraftServer.tickServer(MinecraftServer.java:1470) ~[paper-1.18.1.jar:git-Paper-177]
    at net.minecraft.server.MinecraftServer.runServer(MinecraftServer.java:1264) ~[paper-1.18.1.jar:git-Paper-177]
    at net.minecraft.server.MinecraftServer.lambda$spin$0(MinecraftServer.java:317) ~[paper-1.18.1.jar:git-Paper-177]
    at java.lang.Thread.run(Thread.java:833) ~[?:?]```
#
    public void draw(Player p, Double bounty) {
        ThreadLocalRandom random = ThreadLocalRandom.current();
        double dx = random.nextDouble(-0.75, 0.75);
        double dy = random.nextDouble(0.5, 2.0);
        double dz = random.nextDouble(-0.75, 0.75);
        long until = System.currentTimeMillis() + 1500;

        Hologram hologram = HologramsAPI.createHologram(Main.get(), p.getLocation());
        //colorize("&6&l$${round(bounty).toInt()}")
        hologram.insertTextLine(0, "&6&l$" + round(bounty));

        BukkitTask task = new BukkitRunnable() {
            double i = 0.0;

            @Override
            public void run() {
                i += 0.2;
                if (System.currentTimeMillis() > until || !p.isOnline()) {
                    hologram.delete();
                    cancel();
                    return;
                }
                hologram.teleport(p.getLocation().clone().add(dx, dy + sin(i), dz));
            }
        }.runTaskTimer(new Main(),0L, 1L);
    }```
lost matrix
#

cloning a players location is obsolete in newer versions

patent horizon
#

wdym by obsolete

lost matrix
#

literally obsolete

patent horizon
#

lemme just

#

dictionary

#

ah ok

lost matrix
#

unnecessary

#

not needed

patent horizon
#

alr

#

removed

#

omg wait

#

i see where it went wrong

lost matrix
#

Anyways this looks like a problem with Holographic Displays...

patent horizon
#

new Main() notlikethis

lost matrix
#

Oh yeah. Dont do that for once.

patent horizon
#

lmao

#

that wouldnt cause the error though, no?

lost matrix
#

Also important: Do not shade in Holographic Displays
Show your dependency just to be safe

patent horizon
#

not a shade

#
dependencies {
    compileOnly 'org.spigotmc:spigot-api:1.18-R0.1-SNAPSHOT'
    compileOnly 'me.clip:placeholderapi:2.11.1'
    compileOnly 'com.github.MilkBowl:VaultAPI:1.7'
    compileOnly 'net.luckperms:api:5.4'
    implementation 'com.github.Redempt:RedLib:66b8ea8'
    implementation 'com.gmail.filoghost.holographicdisplays:holographicdisplays-api:2.4.9'
    implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8"
    compileOnly 'com.sk89q.worldguard:worldguard-bukkit:7.0.6'}

def targetJavaVersion = 17
java {
    def javaVersion = JavaVersion.toVersion(targetJavaVersion)
    sourceCompatibility = javaVersion
    targetCompatibility = javaVersion
    if (JavaVersion.current() < javaVersion) {
        toolchain.languageVersion = JavaLanguageVersion.of(targetJavaVersion)
    }
}```
sturdy heron
#

Output less information about var in config

worldly ingot
#

Is implementation not an implied shade?

#

Or shadow, I guess, for Gradle?

tardy delta
#

?

grim ice
#

Events should start with 'on'

#

e.g onInventoryClick

worldly ingot
#

Meh, preference there

grim ice
#

or am I Csharping

dusk flicker
#

i mean, yes that makes sense but there is no convention about it

patent horizon
grim ice
#

oh then I am csharping

dusk flicker
#

I doubt it says anywhere in bukkit about the naming of event methods

patent horizon
grim ice
#

and even then

#

your method/var names should describe what they do

quiet ice
#

it is more of an unwritten convention if anything

dusk flicker
#

yeah ^

worldly ingot
#

I think compileOnly would be fine for that, Wally

#

I don't know why they're suggesting implementation

grim ice
#

interactEntity doesnt describe that its an event for entity interaction

worldly ingot
#

You don't need that at runtime (because Bukkit handles runtime dependencies)

quiet ice
#

But I think it is more of a byproduct of descriptive method naming

grim ice
#

i feel like we should use on

#

since

#

i might have a method called

#

interactEntity(Player player, Entity entity)

#

for making a player interact with an entity

#

so it doesnt make sense for an event to be named like that

#

onEntityInteraction would tho

#

as well as 'item', I think it should be named 'itemUsed'

#

it can be any item

patent horizon
grim ice
#

I think a variable having 2 words is a decent rule of thumb

worldly ingot
#

I'd notify filo about that because that should definitely not be implementation

ivory sleet
#

lol yeah

patent horizon
#

u have his discord or smth

ivory sleet
#

could just pr

#

takes 2 seconds in principle

worldly ingot
#

PRing is an option, yeah, or creating an issue on GitHub if it's in the wiki and not publicly editable

#

Or just sending them a message on Spigot. I believe they have an account 🤔 If not, they have a DBO one for certain

ivory sleet
#

yeyeye

tender shard
#

why is there a CloneNotSupportedException? Why would someone implement Cloneable if it's not supported?

ancient plank
#

yeyeye

ivory sleet
#

I mean it becomes supported if you implement it and use super.clone()

tender shard
#

try, so I wonder why does Object even have a clone() method?

#

true*

#

why did I write try

tardy delta
#

its native in java.lang.Object lol

tender shard
#

I wonder - in what circumstances would there be a public clone() method if clone() is not supported

robust pike
#

Anyone see this error before, if so any suggestions? I've removed all plugins.
Exception Connecting:QuietException : Unexpected packet received during server login process! Followed by a string that looks like a UUID.

tender shard
tardy delta
#

looks weird

tender shard
tardy delta
#

will the native impl determine whether cloning is supported or not?

#

👀

tender shard
#

I have no idea how it works, that's why I asked 😄

ivory sleet
#

no fourteen

#

Object::clone will clone the object

tardy delta
#

so a new object with the current fields?

tender shard
#

so when would the exception be thrown?

tardy delta
#

smh just closed my ide

tender shard
#

I don't understand it

#

why implement clone just to tell people it's not support?

tardy delta
#

how can you call it if its protected

tender shard
#

why not just... not implement it in the first place?

tardy delta
#

java weird lol

tender shard
#

super.clone()

ivory sleet
#

yes the clone thing is a bit weird altho justifiable

tardy delta
#

smh right

#

imagine #clone only works if you implement Cloneable and call super.clone in the public method

tender shard
#

and I've never seen a clone() implementation that looks differet from either

clone() throws CloneNotSupportedException { super.clone(); }

or as you sent it with Location where it catches the exception itself

tardy delta
#

does that makes sense 👉👈

ivory sleet
#

like the entire design resolves around encapsulation and defensiveness

#

since unnecessary clones are, well... not necessary

tardy delta
#

is clone exception thing unchecked?

tender shard
#

imho it's a bit like making something ConfigurationSerializable, then making a static serialize() method that throws the exception

#

why not just stop implementing ConfigurationSerializable then

#

I don't understand it lol

molten hearth
#

how would I type in the player's chat bar when they click a message?

tardy delta
#

a command or just normal text?

molten hearth
#

oh perhaps its SUGGEST_COMMAND

molten hearth
tardy delta
molten hearth
#

basically im gonna send a text that says ```

/xyz``` and if they click it I want their input to autofill to /xyz

#

alright thats what im looking for then thank u

tardy delta
#

also Player#chat is something

quiet ice
tender shard
#

I mean sure, maybe someone decides to do that, so yeah it makes sense a bit, but it's weird nonetheless imho

quiet ice
#

API Classes or something idk. The whole cloneable interface is too outdated that this is likely one issue

tender shard
#

maybe I should finally buy a java book

quiet ice
#

Or if it is just physically impossible to clone because the superclass has private fields with no direct accessor

#

Unless you were to use reflection but eh

#

For me that suggests bad API design - but in our days you cannot be sure to what bad design actually is so ¯_(ツ)_/¯

#

It's a similar case with the serialisable interface though arguably you have a even larger reason to throw an exception there

ebon stratus
#

Hi, I tried making a plugin with the mojang mappings and the server doesnt keeps saying NoClassDefFoundError to every import, how can I fix?

molten hearth
#

I might be wrong, but it seems that there's no builtin cooldown is there

tender shard
#

Player.setCooldown(Material)

#

that's e.g. how the cooldown works for throwing enderpearls etc

molten hearth
#

my bad, for commands

young knoll
#

Don’t forget the int

tender shard
tender shard
ebon stratus
molten hearth
#

are there any libraries for it lol

quiet ice
#

It's not that hard to write it anyways

#

It's just a simple hashmap and a System.currentTimeMillis

molten hearth
#

that perhaps add something neat like @Cooldown(time="30")

tender shard
molten hearth
#

pain but that works too

tender shard
#

then if someone run the command, check if current time = lastTime + cooldown

#

done

dawn hazel
#
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
        if (!(args.length == 0)) {
            try {
                OfflinePlayer oPlayer = Bukkit.getOfflinePlayer(args[0]);
                try {
                    if(args.length >= 2){
                        StringBuilder message = new StringBuilder();
                        for(int i = 1; i < args.length; i++){
                            message.append(" ").append(args);
                        }
                        message.toString();
                        WebhookPresets.NewReport((Player) sender, oPlayer, message.toString());
                    }
                } catch (NullPointerException e) {
                    sender.sendMessage("§cPlease state a reason!");
                }
            }catch (NullPointerException e) {
                sender.sendMessage("§cMust be a player");
            }
        } else {
            sender.sendMessage("§cUsage: /report <player> <reason>");
        }
        return false;
    }```
#

anyone know why it doesnt detect the arguments?

#

it doesnt throw an error if the player isnt defined

#

or if any of the arguments arent defined

#

nor does it work if all the arguments are defined appropriately

tender shard
#

well you're just passing null to your NewReport method

#

if the player isn't found

#

just do a nullcheck yourself

#

if oPlayer == null { showError(); }

dawn hazel
#

alright

tender shard
#

there's no reason why that code would throw an error itself

dawn hazel
#

normally if an exception isnt properly defined in a try catch it throws an error

#

or atleast thats how it worked for me

#

odd

#

i changed the trycatch to a nullcheck and its still not detecting the argument

ebon stratus
tender shard
#
    <build>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-jar-plugin</artifactId>
                <version>3.2.2</version>
                <configuration>
                    <outputDirectory>C:\mctest\plugins\</outputDirectory>
                    <finalName>MyAwesomePlugin</finalName>
                </configuration>
            </plugin>
        </plugins>
    </build>
ebon stratus
#

i have only have maven-compiler-plugin, i ll add this

#

it works, thnx

tender shard
#

np 🙂

woeful crescent
#

how do i cancel not a player casting their rods,

#

but cancel them actually fishing?

#

maybe check the state?

tender shard
#

isn't there some kind of getAction in PlayerFishEvent?

#

cancel the PlayerFishEvent when the event's getState() == PlayerFishEvent.State.CAUGHT_FISH

hasty prawn
#

Someone should listen to that event, check for FAILED_ATTEMPT, and then call them slow in chat

tender shard
#

or reward them for being friendly to the fish

dawn hazel
#
if (!(args.length == 0)) {
            OfflinePlayer oPlayer = Bukkit.getOfflinePlayer(args[0]);
            if (oPlayer != null) {

                try {
                    if(args.length >= 2){
                        StringBuilder message = new StringBuilder();
                        for(int i = 1; i < args.length; i++){
                            message.append(" ").append(args);
                        }
                        message.toString();
                        WebhookPresets.NewReport((Player) sender, oPlayer, message.toString());
                    }
                } catch (NullPointerException e) {
                    sender.sendMessage("§cPlease state a reason!");
                }
            } else {
                sender.sendMessage("§cMust be a player");
            }
        } else {
            sender.sendMessage("§cUsage: /report <player> <reason>");
        }
        return false;``` and heres the updated code in question
misty current
#

what does the update part do in findOneAndUpdate from mongo?

#

what does it actually update

woeful crescent
#

how do i get the inventory of an offline player?

#

and enderchest?

crimson terrace
misty current
#

enderchest i don't know

#

inventory you can't get

serene rampart
#

How can i trigger a Listener only in one world?

misty current
#

check the event world

#

if applicable

woeful crescent
misty current
#

catching a NullPointerException

crimson terrace
#

or do you mean saving the inventory?

dawn hazel
#

The only thing is it’s not detecting any arguments

tender shard
woeful crescent
#

nah how does it retrieve a player's inventory when they join?

misty current
#

i dont know and im not reading it to not cry

crimson terrace
woeful crescent
#

can i use that savedata aswell?

#

why isn't it just in offlineplayer x_x

crimson terrace
#

its normal minecraft, not spigot

tender shard
#

you can store information in the player's PersistentDataContainer

woeful crescent
#

ik

tender shard
#

well offlineplayers are not loaded

#

so of course you can't access their inventory etc

woeful crescent
#

but...

crimson terrace
#

you have to serialize it and save it in a file yourself

woeful crescent
#

like...

#

the data is THERE

#

y'know?

#

can't i just access it the same way mc does?

misty current
#

good luck with that lol

tender shard
dawn hazel
#

Alright welp time to rewrite some code

woeful crescent
#

im just confused

serene rampart
misty current
#

i'd rather make a stash a player can access when they login rather than getting their inventory while offline

#

depends on the event

woeful crescent
#

when a player joins, what happens that makes that data suddenly accessible?

misty current
#

the playerdata file is loaded

#

if you fancy doing that have fun

lavish hemlock
tender shard
lavish hemlock
#

(or so I've heard)

woeful crescent
#

how does offline player get the bed spawn location?

tender shard
#

but yeah sure, that's another reason

misty current
lavish hemlock
#

Throwing

woeful crescent
#

throwing

tender shard
#

creating the exception alone is already heavy IIRC

woeful crescent
#

how?

#

could the same thing be done for inventory?

tender shard
misty current
#

some data stays loaded most probably

#

you can always go ahead and decompile nms code

woeful crescent
#

also i was thinking about a website idea that runs buildtools online for you

#

and you can input whatever version you want

#

completely clean, clientside

#

no setup required

misty current
#

there's already a website with decompiled nms code i think if thats what you mean

woeful crescent
#

nah

#

i meant like, instead of hosting spigot downloads illegally, just legally run buildtools on browser

misty current
#

if you mean actually downloading the decompiled code i'm pretty sure it's illegal

misty current
#

oh not sure how would that work but

tender shard
#

seems like it doesn't really return the bed location

#

only when the player is actually online

#

but not sure

lavish hemlock
#

You'd have to rewrite BuildTools in JS so it could run client-side

#

Running it on the site's server would require downloading, which doesn't solve the problem

#

Either way the best solution is what Paper did

tender shard
lavish hemlock
lavish hemlock
tender shard
#

after all buildtools only calls maven

misty current
#

this is the implementation on 1.18 in craftofflineplayer

tender shard
#

which then calls javac

woeful crescent
#

on the server, not the client i mean

#

but still it's fine

lavish hemlock
#

Applets are deprecated and unsafe

#

Most browsers disable them by default iirc

chrome beacon
#

Yeah they're dead now

woeful crescent
#

but there are other ways probably

tender shard
#

and if you run it on the server, you'd still provide the download to other people

woeful crescent
#

yea

#

welp cya guys mauybe a OfflinePlayer#getInventory prq is in my future

misty current
#

anyways if you manage to get an instance of PlayerDataStorage you can call a method to get the playerdata

dawn hazel
#

is this more appealing to your eyes

#
    @Override
    public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
        if (args.length == 0) {
            sender.sendMessage("§cUsage: /report <player> <reason>");
            return false; 
        }

        OfflinePlayer oPlayer = Bukkit.getOfflinePlayer(args[0]);
        if (oPlayer == null) {
            sender.sendMessage("§cMust be a player");
            return false;
        }
        if (!(args.length >= 2)) {
            sender.sendMessage("§cPlease state a reason!");
            return false;
        }
        StringBuilder message = new StringBuilder();
        for(int i = 1; i < args.length; i++){
            message.append(" ").append(args);
        }
        message.toString();
        WebhookPresets.NewReport((Player) sender, oPlayer, message.toString());
        
        return true;
    }
}```
misty current
#

which is getPlayerData

lavish hemlock
misty current
#

yes it is

#

far better

tender shard
#

if you send a message, return true

dawn hazel
#

also yeah ur right about the stagnation

misty current
#

yeah

dawn hazel
#

its a lot better without the staircasingh

lavish hemlock
#

Do like

#

< 2 iirc?

misty current
#

you should also not use §c for color codes

lavish hemlock
#

Yeah lol

#

ChatColor.translateAlternateColorCodes

misty current
#

you should use ChatColor

#

or yes that method

tender shard
#

and said, return true instead of false

lavish hemlock
tender shard
#

returning false will show the command description as defined in plugin.yml

lavish hemlock
#

You can also use ChatColor.RED and such for the colors, which you would then concatenate with your message

#

And, if you want, there's also the Bungeecord Chat API and Adventure for a "component" style.

dawn hazel
#

like this?

#

wow

#

for once my code is actually readable

tender shard
#

lol

lavish hemlock
#

I'm wondering what all of those warnings from IntelliJ are

#

Well I know what the one about args is

tender shard
#

"could be final"

lavish hemlock
#

You can't directly use args's toString method

#

It would just output some nonsense, I think it's like <type>:<hashCode>

#

You'd have to use Arrays.toString(args)

tender shard
#

args is highlighted because no for loop is needed

lavish hemlock
#

ohhh yeah

#

you're not retrieving the index, actually

#

args[i]

dawn hazel
lavish hemlock
#

This is what all my old code used to look like lol

dawn hazel
#

yeah

#

im probably going to refactor this entire thing

vocal cloud
#

Imo never try catch if you can avoid it

dawn hazel
#

but i dont have time to do that

tender shard
#

also wait

tender shard
lavish hemlock
dawn hazel
#

oh hey thats some progres

vocal cloud
lavish hemlock
#

IOException

#

actually, just all checked exceptions

tender shard
#

or just make every method "throws Throwable" lol

lavish hemlock
#

and you shouldn't allow something like NumberFormatException to propagate

dawn hazel
dawn hazel
#

[Ljava.lang.String;@738206d2

lavish hemlock
#

Ah I was correct

#

[Ljava.lang.String; is so odd I dunno why Java stylizes it like this

#

I mean I know where it comes from

#

it's a weird combination of binary names (java.lang.String) and internal descriptors ([L<reference type>;)

#

They should just pick one

#

Go full descriptor like [Ljava/lang/String; or go full readable like java.lang.String[]

dawn hazel
#

hmm

quaint mantle
#

Are there tutorials on how to make a server w/ a lobby and gamemodes?

#

I cant find any.

dawn hazel
#

in confused

tender shard
#

java.lang.Object@3b9a45b3
[Ljava.lang.Object;@7699a589

dawn hazel
tender shard
dawn hazel
#

hmm

lavish hemlock
#

There's also

#

shit like

#

[Z for boolean arrays iirc

ornate patio
#

what does PotionEffect.hasIcon do?

young knoll
#

I assume checks if it has a display icon

ornate patio
#

uhh

#

it's a param you can set in the constructor

young knoll
#

Hides the icon in the top right

ornate patio
#

damn i didnt know thats something you can control

quaint mantle
#

Any way to improve my interaction event?

vocal cloud
#

?paste code rather then sending files please

undone axleBOT
dawn hazel
#

thats a large chunk of code

quaint mantle
lost matrix
quaint mantle
lost matrix
#

With another method

quaint mantle
#

Ill see if I can.

lost matrix
#

Example nr 1:

    private void clickEvent(PlayerInteractEvent event) {
        switch (event.getAction()) {
            case RIGHT_CLICK_AIR -> handleRightClickAir(event);
            case RIGHT_CLICK_BLOCK -> handleRightClick(event);
        }
    }

    private void handleRightClickAir(PlayerInteractEvent event) {

    }

    private void handleRightClick(PlayerInteractEvent event) {

    }
quaint mantle
tender shard
# quaint mantle

first thing that comes to my mind: create your namespacedkeys on init and reuse them

#

no need to create a new key every time

quaint mantle
lost matrix
tender shard
#

also yeah as others said, I'd probably have at least 20 methods for this instead of just one

quaint mantle
#

20???

tender shard
#

I haven't looked at it really

#

I just guessed 20

lost matrix
tender shard
#

for the namespacedkeys I usually just have a public class or a static inner class that holds all the keys, like this

    public final class Keys {
        public static final NamespacedKey NAME = new NamespacedKey(myPlugin, "name");
        public static final NamespacedKey AGE = new NamespacedKey(myPlugin, "age");
        public static final NamespacedKey SEX = new NamespacedKey(myPlugin, "sex");
        public static final NamespacedKey ADDICTION = new NamespacedKey(myPlugin, "addiction");
        public static final NamespacedKey WEIRDNESS = new NamespacedKey(myPlugin, "weirdness");
        public static final NamespacedKey PING_FOR_HELP = new NamespacedKey(myPlugin, "conclure");
    }
quaint mantle
#
package me.emerald.emeraldsplugin.data;

import org.bukkit.NamespacedKey;

import java.util.HashMap;

public class NamespaceKeyList {
    static HashMap<String, NamespacedKey> keyList = new HashMap<String, NamespacedKey>();

    public NamespaceKeyList(NamespacedKey key, String identify){
        keyList.put(identify, key);
    }

    public static NamespacedKey getKey(String identify){
        return keyList.get(identify);
    }

    public static NamespaceKeyList addKey(NamespacedKey key, String identify){
        return new NamespaceKeyList(key, identify);
    }
}
#

And add all the ceys on startup

#

then retrieve them later on

tender shard
#
    private final HashMap<String,NamespacedKey> keys = new HashMap<>();
    
    public NamespacedKey getKey(String name) {
        return keys.computeIfAbsent(name, s -> new NamespacedKey(PLUGIN, name));
    }
#

this creates a new key if required or returns the already existing one

quaint mantle
#

also i need a bit of help

halcyon mica
#

What is the ideal way of getting a Material from a ResourceLocation

quaint mantle
#

in a sec

halcyon mica
#

i.e. minecraft:stick -> Material.STICK

ivory sleet
#

yup

#

I do

tender shard
quaint mantle
# tender shard ?
public class InteractionEvent implements Listener {
    Player p;
    ItemStack item;
    ItemMeta itemMeta;
    PersistentDataContainer itemPerst;

    Block block;
    TileState blockState;
    PersistentDataContainer blockPerst;

    @EventHandler
    private void clickEvent(PlayerInteractEvent event){
        p = event.getPlayer();
        getItem(event);
        getBlock(event);

        switch(event.getAction()){
            case RIGHT_CLICK_AIR -> handleRightClickAir(event);
            case RIGHT_CLICK_BLOCK -> handleRightClick(event);
        }
    }

    private void getItem(PlayerInteractEvent event){
        item = event.getItem();

        if(item != null){
            itemMeta = item.getItemMeta();
            itemPerst = itemMeta.getPersistentDataContainer();
        }else{
            itemMeta = null;
            itemPerst = null;
        }
    }

    private void getBlock(PlayerInteractEvent event){
        block = event.getClickedBlock();

        if(block != null){
            if(block.getState() instanceof TileState){
                blockState = (TileState) block.getState();
                blockPerst = blockState.getPersistentDataContainer();
            }else{
                blockState = null;
                blockPerst = null;
            }
        }
    }

    private void handleRightClickAir(PlayerInteractEvent event) {

    }

    private void handleRightClick(PlayerInteractEvent event) {

    }
}
tender shard
#

no we're all still on 1.6.4

quaint mantle
#

Am I setting this up correctly?

wet breach
tender shard
#

erm tbh imho this is very dirty, you use instance fields to store stuff that will change on every event, right?

#

while that will work, I don't think it's a good idea although I can't explain why I think that

quaint mantle
tender shard
#

that doesn't change anything

quaint mantle
#

oh

tender shard
#

well it'll work, I just don't think it's a nice way of doing things

wet breach
#

it should, valueOf takes in a string o.O

halcyon mica
#

formatting of the materials class and the minecraft vanilla keys are very different

tender shard
#

isn't it always just the same thing but in uppercase?

wet breach
#

you could do String.toUpperCase()

tender shard
#

I am 99.9% sure that it's always the same name just in uppercase

lime jolt
#

anyone know why this does not work

#

import org.bukkit.plugin.java.JavaPlugin;

public class Main extends JavaPlugin{
        
    @Override
    public void onEnable() {
        
        new HelloCommand(this);
        
    }
}
tender shard
#

what is it supposed to do?

lime jolt
#

import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;

public class HelloCommand implements CommandExecutor{

    public HelloCommand(Main plugin) {
        plugin.getCommand("hello").setExecutor(this);
    }
    
    @Override
    public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {
        if(!(sender instanceof Player)) {
            sender.sendMessage("Only players may execute this command!");
            return true;
        }
        Player p = (Player) sender;
        
    
            p.sendMessage("Hi!");
        
        return true;
    }
    
}```
#

when you do /hello

#

it send back "Hi"

tender shard
#

and what happens instead?

lime jolt
#

nothing

tender shard
#

there must happen something

lime jolt
#

I am very new to plugin dev

tender shard
#

does it say "command not found"?

#

do you get any console errors?

lime jolt
#

says unkown command

#

no it just says that no such command exists

tender shard
#

your console probably tells you during loading your plugin, there's a nullpointerexception at "plugin.getCommand(..." because you did not register your command in plugin.yml

#

when you do /plugins, does it list your plugin at all? is it green or red?

lime jolt
#

no

#

-<

#

;-;

tender shard
#

look through your latest.log

#

it will tell you what's wrong

ornate patio
#

how do i spawn an item in the world with a velocity

#

i'm trying to make the illusion of a player dropping items out of their inventory

#

without actually removing any items from it

tender shard
lime jolt
#

can I copy and paste my log here?

tender shard
undone axleBOT
lime jolt
#

ok

#

jar is called helloworld

tender shard
#
[23:14:17] [Server thread/INFO]: Using epoll channel type
[23:14:17] [Server thread/ERROR]: Could not load 'plugins/HelloWorld.jar' in folder 'plugins'
org.bukkit.plugin.InvalidDescriptionException: name is not defined
    at org.bukkit.plugin.PluginDescriptionFile.loadMap(PluginDescriptionFile.java:898) ~[patched_1.8.8.jar:git-PaperSpigot-445]
    at org.bukkit.plugin.PluginDescriptionFile.<init>(PluginDescriptionFile.java:232) ~[patched_1.8.8.jar:git-PaperSpigot-445]
    at org.bukkit.plugin.java.JavaPluginLoader.getPluginDescription(JavaPluginLoader.java:157) ~[patched_1.8.8.jar:git-PaperSpigot-445]
    at org.bukkit.plugin.SimplePluginManager.loadPlugins(SimplePluginManager.java:136) [patched_1.8.8.jar:git-PaperSpigot-445]
    at org.bukkit.craftbukkit.v1_8_R3.CraftServer.loadPlugins(CraftServer.java:293) [patched_1.8.8.jar:git-PaperSpigot-445]
    at net.minecraft.server.v1_8_R3.DedicatedServer.init(DedicatedServer.java:202) [patched_1.8.8.jar:git-PaperSpigot-445]
    at net.minecraft.server.v1_8_R3.MinecraftServer.run(MinecraftServer.java:563) [patched_1.8.8.jar:git-PaperSpigot-445]
    at java.lang.Thread.run(Thread.java:826) [?:1.8.0_312]
Caused by: java.lang.NullPointerException
    at org.bukkit.plugin.PluginDescriptionFile.loadMap(PluginDescriptionFile.java:891) ~[patched_1.8.8.jar:git-PaperSpigot-445]
    ... 7 more
#

you didn't define a "name" for your plugin in plugin.yml

ornate patio
lime jolt
#

[23:14:17] [Server thread/ERROR]: Could not load 'plugins/HelloWorld.jar' in folder 'plugins'

tender shard
#

do you actually expect people here to help after you started insulting people in DMs for net sending your a spigot.jar?

ornate patio
#

oh ok

lime jolt
#

._.

quaint mantle
#

?ban @fallow hare slur

undone axleBOT
#

Done. That felt good.

vagrant stratus
#

rood

tender shard
#

thanks

quaint mantle
#

mine

vagrant stratus
#

I wanted to do it

native gale
#

Hello my fellow spipos, can anyone explain when exactly the ban check happens?

vagrant stratus
#

bans imagine

quaint mantle
#

i havent banned someone in months

young knoll
#

Demoted!

native gale
#

Also, how can I override the ban check logic

lime jolt
#

what does this mean

tender shard
lime jolt
vocal cloud
tender shard
subtle anchor
#

guys how do you craft hearts tell me pls

lime jolt
#

commands:
  hello:```
quaint mantle
tender shard
#

your plugin also needs a "name: PluginName" and "version: 1.0"

subtle anchor
#

how do craft hearts

quaint mantle
lime jolt
#

the video said it was unessesary

#

I am just watching tutroial >_>

tender shard
sharp flare
#

Bad tutorial then

native gale
subtle anchor
#

k ser

young knoll
#

Name and version are not optional

hexed hatch
#

god that's like the billionth person asking how to craft hearts

lime jolt
subtle anchor
#

whos dev

young knoll
#

How should we know

#

We don't even know what plugin you use

tender shard
#

how would I know, you didnt even mention you were tlaking about a plugin

subtle anchor
#

lifestealpluguin

tender shard
#

@rough drift

#

change your plugin's spigot description

lime jolt
#

so I need name and version, for yml

tender shard
#

people join here all the time because you wrote they should "see discord" for the recipe

tender shard
native gale
#

Why do you ask here?

vagrant stratus
#

I should really do a series on plugin dev once I get a good enough mic setup 😂

native gale
#

There's a dedicated server

tender shard
lime jolt
#

._.

#

so is this better

#
version: 1.0
main: org.potatocode.Main

commands:
  hello:```
lime jolt
#

okok I will try

tender shard
#

somehow lifesteal plugins attract a large amounts of the biggest noobs

young knoll
#

Is that why they keep coming here?

tender shard
#

yes

#

it's @rough drift's fault lol

young knoll
#

We'll just ping him every time someone comes

#

<3

tender shard
#

good idea lol

hexed hatch
#

Ike please make a huge section on your description saying "click here for discord" in big letters

native gale
#

Okay, so everyone just ignored my stupid question

#

How do I override ban logic

quaint mantle
#

reflection proxies 🙈

tender shard
#

PlayerLoginEvent

#

has a setResult method

#

you can set it to ALLOWED, KICK_BANNED, etc etc

young knoll
#

I would use the AsyncPreLogin

#

I think that has the same methods

native gale
tender shard
young knoll
#

What

lime jolt
#

OMG IT WOOORKS

native gale
#

And how do I disable the original ban list?

lime jolt
#

@tender shard thank u, ABOSLUTE LEGEND

#

^^^

young knoll
#

That ain't a paper

young knoll
#

Ah yeah I just shortened it

#

Forgot paper has events like that

#

Dangit paper

tender shard
#

yeah I entered what you wrote and got no result

#

lol

young knoll
#

AsyncPlayerChatEvent -> spigot
AsyncChatEvent -> paper

tender shard
young knoll
#

very sadge

native gale
tender shard
#

it works like this:

  1. player tries to join but he is banned
  2. server calls the (Async)PlayerPreLoginEvent with the Result already set to KICK_BANNED
  3. you set it to ALLOWED
  4. player SHOULD be able to join now
young knoll
#

Alternatively if you want to ignore the vanilla ban list, just don't use it

tender shard
#

yes that's also a viable solution lol

ancient plank
#

true

quaint mantle
#

if my account gets hacked just know i was downloading gta 5 mods 😙

young knoll
#

Do you not have 2fa

quaint mantle
#

i do

#

but tokens exist

young knoll
#

Oof

#

What do we do if a staff account gets hacked

#

I guess we need to ping md

tender shard
#

I'd just grab popcorn

ancient plank
#

or a mod

quaint mantle
#

we should test if adelemphii can ban me

ancient plank
#

mods are higher rank than helpers

young knoll
#

Yeah I think the sidebar order is all the hierarchy

ancient plank
#

if a helper gets hacked u go to a mod, if a mod gets hacked u go to md

tender shard
#

where do we go to if md gets hacked

young knoll
#

So Choco should be able to ban optic, optic can ban adele, and adele can ban me

quaint mantle
#

if md gets hacked then grab popcorn

ancient plank
#

abandon ship

young knoll
#

Run away

young knoll
#

With popcorn, of course

tender shard
#

salty popcorn

lime jolt
#

does anyone know why

#

this

#

import org.bukkit.Bukkit;
import org.bukkit.plugin.java.JavaPlugin;

public class Main extends JavaPlugin{
        
    @Override
    public void onEnable() {
        
        new HelloCommand(this);
        Bukkit.getServer().getConsoleSender().sendMessage("potato");
    }
}
#

does not print potato

#

in chat

#

Bukkit.getServer().getConsoleSender().sendMessage("potato");

dawn hazel
#
        int cooldownTime = 30;
        if(cooldown.containsKey(sender.getName())) {
            long secondsLeft = ((cooldown.get(sender.getServer().getPlayer(sender.getName()).getUniqueId())/1000)+cooldownTime) - (System.currentTimeMillis()/1000);
            if(secondsLeft>0) {
                sender.sendMessage(ChatColor.RED + "Your on cooldown for " + secondsLeft + " seconds!");
                return true;
            }
        }
        cooldown.put(((Player) sender).getUniqueId(), System.currentTimeMillis());```
anyone know why the cooldown does not work?
tender shard
dawn hazel
lime jolt
#

oh

#

so would that print in chat

#

or something else

#

System.out.println("potato");

dawn hazel
#

what

tender shard
#

no

#

?learnjava

undone axleBOT
dawn hazel
#

that would print to console

lime jolt
#

cause I thought that was for terminal

#

so how would I get it in the chat

#

like miencraft chat

tender shard
#

player.sendMessage

ornate patio
#

i have this code which is meant to drop a ton of soul sand (that's unable to be picked up) rapidly:

for (double i = 1; i <= iterations; i++) {
    scheduler.runTaskLater(main, () -> {
        Location playerLocation = player.getLocation();
        player.getWorld().dropItem(playerLocation.add(0, 1, 0), throwupItemStack, (Item item) -> {
            item.setVelocity(playerLocation.getDirection().multiply(.45));
        });
    }, (long) (i * THROW_UP_DELAY_SECONDS * 20));
}

This works as intended, however how would i then remove all the items after 3 seconds or so? The soul sand all "merge" together into one stack on the floor, how would i target this?

dawn hazel
lime jolt
hybrid spoke
#

broadcast

tender shard
lime jolt
#

so

#

Bukkit.broadcastMessage("potato");

dawn hazel
#

yes

lime jolt
#

okok, thank you

hybrid spoke
pliant oyster
#

How can I increase someones heart cap? and decrease it

tender shard
#

lol

#

jk

#

look at the player's atrributes

#

attributes

hybrid spoke
#

his heart rn 💓

tender shard
#

he deserves it

pliant oyster
#

attributes confuse me

quaint mantle
pliant oyster
#

fr

dawn hazel
pliant oyster
#

oh

#

alr thanks

hybrid spoke
tender shard
#

note: 20 means 10 hearts

pliant oyster
#

yeah

dawn hazel
#

yes

#

+2 health = 1 heart

pliant oyster
#

mhm

dawn hazel
#

thats the conversion factor

lime jolt
#

big boi problem guys

#

import org.bukkit.Bukkit;
import org.bukkit.plugin.java.JavaPlugin;

public class Main extends JavaPlugin{
        
    @Override
    public void onEnable() {
        
        new HelloCommand(this);
        Bukkit.broadcastMessage("potato");
    }
}```
#

did not print potato

#

Bukkit.broadcastMessage

#

= no working

tender shard
#

you print potato during onEnable

dawn hazel
#

theres usually no players on when the server enables

tender shard
#

if you want it to do stuff in your command, obviously you have to put it into the commandexecutor

dawn hazel
#

you have to do it when players are on

tender shard
#

also it's pretty weird to register your command inside the commandexecutor class

dawn hazel
#

otherwise no one will see it

#

usually in the form of an event or command

hybrid spoke
#

the console will see it

#

or the players after a reload

lime jolt
#

console doesnt see it

hybrid spoke
#

did you update your plugin?

#

and reload/restart the server?

lime jolt
dawn hazel
#

do broadcasts even print to console

hybrid spoke
#

yes

hybrid spoke
#

?jd

dawn hazel
hybrid spoke
dawn hazel
#

oh wait

#

thats registering the executor

hybrid spoke
#

the command ?jd <class> would be nice

tender shard
lime jolt
#

ok

dawn hazel
#
public class HelloCommand implements CommandExecutor {

    @Override
    public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
        someLogicHere();
    }
}```
#

basic command class

lime jolt
#

so I always put it in there

dawn hazel
#

huh

lime jolt
#

some of the times?

#

half?

#

1 quarter?

#

10 cents

#

a nickle!

tender shard
#

yes

lime jolt
#

okok

#

I will try it

ornate patio
# ornate patio i have this code which is meant to drop a ton of soul sand (that's unable to be ...

ok well i just tried something, and it works.. is this efficient though?

for (double i = 1; i <= iterations; i++) {
    scheduler.runTaskLater(main, () -> {
        Location playerLocation = player.getLocation();
        Item item = player.getWorld().dropItem(playerLocation.add(0, 1, 0), throwupItemStack, (Item item2) -> {
            item2.setVelocity(playerLocation.getDirection().multiply(.45));
        });

        scheduler.runTaskLater(main, () -> {
            item.remove();
        }, 60L);
    }, (long) (i * THROW_UP_DELAY_SECONDS * 20));
}
quaint mantle
#

how would I create a playerHead as an ItemStack?

ornate patio
quaint mantle
#

w/ a username attached to it

tender shard
dawn hazel
# lime jolt some of the times?

//main class
public class Main extends JavaPlugin{
        
    @Override
    public void onEnable() {
        
        this.getCommand("hello").setExecutor(new HelloCommand(this));
    }
}

// command class
public class HelloCommand implements CommandExecutor {

    @Override
    public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
        Bukkit.broadcastMessage("potato");
    }
}```
dawn hazel
#

thats how you broadcast it

hybrid spoke
tender shard
#

WHAT THE HECK

ornate patio
#

thanks

hybrid spoke
tender shard
ornate patio
#

when 2 items merge together, are they considered 1 item or no?

tender shard
ornate patio
#

for example when i drop 2 diamonds next to each other

#

and they merge into one stack

hybrid spoke
tender shard
#

it's one Item, holding an ItemStack with amount 2

tender shard
ornate patio
#

ah ok

#

thanks

hybrid spoke
#

in the dev forums

tender shard
#

hm tbh I doubt that changing the textures actually works

#

because it's gotta be signed after all

hybrid spoke
#

try it and be the first

tender shard
#

maybe tomorrow lol

#

yeah I'll do it tomorrow

#

would be really awesome if it works

hybrid spoke
#

ping me if it works 👍

tender shard
#

will do 🙂

lime jolt
#

does anyone know how to get player who typed the commands name