#help-development

1 messages ยท Page 2213 of 1

golden turret
#

yea

#

i was seeing the code behind it

#

and started to print the things

#

then i realised that the boolean could do something

spiral cape
#

    private void checkStyleAndColor(InventoryClickEvent event) {
        StyleSelector newStyle = StyleSelector.getByName(event.getCurrentItem().getItemMeta().getDisplayName());
    ColorSelector newColor = ColorSelector.getByName(event.getCurrentItem().getItemMeta().getDisplayName());
        // If the item selected wasn't even a style (e.g. the background), do nothing
        if (newStyle == null && newColor == null) {
            return;
        }

        OutlinePane pane = (OutlinePane) getPane();


        // remove enchant from previously selected color
        pane.removeItem(pane.getItems().get(activeStyle.getItemIndex()));
        pane.insertItem(HorseEditor.guiItem(activeStyle.getMaterial(), activeStyle.getName(), false, false), activeStyle.getItemIndex());
        // add enchant to newly selected color
        pane.removeItem(pane.getItems().get(newStyle.getItemIndex()));
        pane.insertItem(HorseEditor.guiItem(newStyle.getMaterial(), SELECTED_TEXT + newStyle.getName(), false, true), newStyle.getItemIndex());
        // save new color

    if (newStyle != null){
        activeStyle = newStyle;
            getHorseInfo().setStyle(activeStyle.getHorseStyle());
    } else {
        activeColor = newColor;
            getHorseInfo().setColor(activeColor.getHorseColor());
    }

        HumanEntity human = event.getWhoClicked();
        if (human instanceof Player) {
            Player player = (Player) human;
            player.playSound(player.getLocation(), Sound.UI_BUTTON_CLICK, 1, 1);
        }
    } ``` @ornate patio
#

even something like this, indenting is off cause just used a notepad ;p

echo basalt
golden turret
#

๐Ÿ‘

ornate patio
#

although a few edits should be made

true perch
#

I really like the smooth slow up and down animation of the pufferfish.
https://gyazo.com/f514fc58602cc5d1a306d24566c77f34

I'd like to use this to display 3D models.

Is there any way I could make the pufferfish render as an item or make a helmet slot of the pufferfish render?

ornate patio
#

because this will always be false

#

or wait

#

nvm

spiral cape
#

Don't worry, I've spent 3 hours today fixing a bug that wasn't there, as I realised that minecraft clients have this issue and relogging solves the problem ;p

golden turret
#

bruh

ornate patio
granite owl
#

imagine

#

sometimes i reload while the file hasnt finished compiling

#

causing runtime errors

#

๐Ÿค”

ornate patio
#

same

spiral cape
#

basically when spawning an armorstand inside a block, it will sometimes remove the block that the armorstand got spawned at..... it actually doesn't remove the block on the server, and relogging the client helps....

ornate patio
#

damn wth

spiral cape
#
        pane.removeItem(pane.getItems().get(activeStyle.getItemIndex()));
        pane.insertItem(HorseEditor.guiItem(activeStyle.getMaterial(), activeStyle.getName(), false, false), activeStyle.getItemIndex());
        // add enchant to newly selected color
        pane.removeItem(pane.getItems().get(newStyle.getItemIndex()));
        pane.insertItem(HorseEditor.guiItem(newStyle.getMaterial(), SELECTED_TEXT + newStyle.getName(), false, true), newStyle.getItemIndex());``` you could also split line 1-2 as a function, and 4-5 as a function/method
#

private void methodName(OutlinePane pane){}

golden turret
#

ok so now i have a new issue

golden turret
#

this guy works fine

#

but this one doesnt

#

why ๐Ÿ˜ญ

spiral cape
#

have you tried the debugger?

golden turret
#

yes

#

it give me no errors

#

but simply

#

i dont have capes

#

and hats

#

the same problem i had before

spiral cape
#

Unfortunately I'm not much of help here as never messed around with nms or packets

golden turret
#

@echo basalt you said i could let you know :D

echo basalt
#

welp

#

order of operations matters

golden turret
#

yes

#

i guess i am following everything

spiral cape
#

only starting to develop anything for minecraft 2 months ago

echo basalt
#

respect

golden turret
spiral cape
#

well, if you're a full stack engineer ;p

echo basalt
#

uhh

#

never spawned players through packets tbh

#

but huh

#

hmm

#

try

#

delaying the metadata packet

#

by 1 tick

#

usually fixes lots of issues

golden turret
#

let me see

echo basalt
#

am I the only one that hates the bukkit scheduler

golden turret
#

now i dont have even the player

echo basalt
#

create the metadata packet inside the runnable

#

weird ahh stuff

golden turret
#

nothing

echo basalt
#

wtf

golden turret
echo basalt
#

okkkkkk

#

welp

#

let's start working on readability instead of fixing the issues

#

just for a second

#

make a method to send a packet to a player

golden turret
#

๐Ÿ‘

echo basalt
#

And some scheduler methods like runAsync and runIn1Tick

golden turret
#

cool

#

now

#

it works

#

thanks

#

wait

#

it stopped to work

wide dirge
#

helloe

#

can any one help me ?

golden turret
#

?ask

undone axleBOT
#

If you have a question, please just ask it. Don't look for staff or topic experts. Don't ask to ask or ask if people are awake or available. Just ask the question to the channel straight out, and wait patiently for a reply. Make sure you use the right channel regarding the topic of your question. Create a thread in case the channel is already in use!

wide dirge
#

?ask Hello i need some help in pom.xml

undone axleBOT
#

If you have a question, please just ask it. Don't look for staff or topic experts. Don't ask to ask or ask if people are awake or available. Just ask the question to the channel straight out, and wait patiently for a reply. Make sure you use the right channel regarding the topic of your question. Create a thread in case the channel is already in use!

river oracle
#

you can really tell when people don't read

#

shit

golden turret
#

@echo basalt so, when i spawn im not sending the npc to te player. When i send the packet for the first time, it works fine and i send a destroy packet but when i send the npc the 2nd time, it dont work

echo basalt
#

destroy packet kills the npc huh

#

it's kidna weird

golden turret
#

yea

#

but

#

idk

#

i guess im seeing wrong things

#

because i did not touched the code

#

and it is working

wide dirge
#

@echo basalt can you help me in pom.xml ?

#

;-;

#

i need help guys

golden turret
#

say what you need

echo basalt
#

why me in specific

#

grr

wide dirge
#

i will send DM

golden turret
#

verify

echo basalt
#

oh god

golden turret
#

?verify

wide dirge
echo basalt
#

so am I

golden turret
#

verify

#

it is fast

echo basalt
#

got like 4 project to work on ๐Ÿ˜ญ

wide dirge
#

@golden turret ;-; soo ?

#

you see the DM ?

echo basalt
#

man chill out

wide dirge
#

can you tell me how i add the API in Maven ?

#

in Intelij btw

spiral cape
sage patio
#

This always return Cooked_Beaf

#

what should i do

spiral cape
#

do Bukkit.getLogger.info(type.toLowerCase()); before the switch and see what you get

golden turret
#

new issue!!!!!

golden turret
sage patio
#

ow, i got it thanks

#

i'm a little lazy at 4AM so ... i've typed Rife insted of Rifle

spiral cape
#

typical typo problem ;p

golden turret
#

btw the yaw is -179.999

spiral cape
#

not sure what is your expectation of the yaw, but you want it to be 180 correct?

golden turret
#

yes

#

but that is not the problem now

#

the skin is not being applied properly

spiral cape
#

ooooh ;p its front on the back of him ;p

#

haven't noticed until you mentioned

spiral cape
#

because there is 180 and -180

pastel juniper
#

what should be in keys place???

sacred mountain
#

string

#

key

#

nvm

#

there's a pdc key

#

namespacedkey

#

there

tender shard
vocal pine
#

straight up at a loss rn - why is it when i sit in my custom entity minecart (same code) i hold A/D and it will literally move sideways off the track

#

it's like the standard one resets the entity movement (the entity moves then cart snaps to it visually at least) but mine doesnt, but nowhere does that actually happen

grand flint
#

How do you create regions

tender shard
#

what regions?

grand flint
#

Like to detect if a player gets in a certain area

tender shard
#

cuboid regions?

grand flint
#

ye

tender shard
#

BoundingBox is a simple "region like" thing in bukkit

#

for example:
BoundingBox.of(firstBlock,otherBlock)

grand flint
#

something like

#

pos1 pos2

tender shard
#

yeah

#

BoundingBox

grand flint
#

Ok thank you

tender shard
#

it's not tied to any world though

grand flint
#

Wdym

tender shard
#

you have to check for the correct world yourself

grand flint
#

Ok

tender shard
#

it basically only stores X1, X2, Y1, Y2, Z1, Z2

grand flint
#

so it would trigger event if its in the nether

tender shard
#

then you can do stuff like isInside(Vector) etc

grand flint
#

so the vector would be the boundbox variable?

tender shard
#

no, the vector is the location you want to check

#

Example:

#
BoundingBox myRegion = BoundingBox(firstBlock, otherBlock);
#

now you want to check if player is inside that

#

then you do

Vector playerPosition = player.getLocation().toVector();
if(myRegion.contains(playerPosition)) {{ ... }
#

not sure if it's called "contains", but definitely sth like that

grand flint
#

Ok but where would this code be?

#

Does it run every second?

tender shard
#

you can do that however you want. Every second, or in PlayerMoveEvent, ...

grand flint
#

Which one would be more performance better

tender shard
#

depends. Do you care whether it only detects a player entering after a second, or do you want to detect it on the exact same tick?

#

like "how precise does it have to be"

#

?

grand flint
#

Doesn't matter, just the performance

tender shard
#

then just run it once per second

#

you know, checking whether a player is inside is just extremely simple math

grand flint
#

Ok thank you, ye I just wanted to know what "boundbox" was

tender shard
#

basically all it checks is

  1. Is player's X > bounding minX and < bounding maxX
  2. Same for Y
  3. Same for Z
grand flint
#

Thanks :)

grand flint
#

How can I fix the error that intellij gives me, permission denied or something

#

Can't be bothered to check it for the millionth time

tender shard
#

never had that error

#

where does it say that? in the gui? in the console?

#

or is it from the maven output?

grand flint
#

Console

tender shard
#

maven or "intellij console"?

grand flint
#

It can't build the file

#

Because it doesn't have permission to build in the folder that it's assigned

tender shard
#

then it probably doesn't have write access or cannot replcae or delete an existing file because you have it open somewhere

grand flint
#

I also get this error when using cmd, visual studio or any other thing that needs access

#

How can I give it write access

tender shard
#

no idea, maybe you created that directory as admin

grand flint
#

No but like

mortal hare
#

?paste

#

!paste

tender shard
#

IS THAT BOT DOWN AGIN?!

grand flint
#

I go to my folder, in some locations when I try deleting a file it litearlly says I don't have permission lol

tender shard
#

?paste

mortal hare
#

...

upper tendon
#

There a way to detect what items were shift clicked?

odd sentinel
#

so there is no mangrove in TreeSpecies, is that intentional? trying to detect mangrove boats

grand flint
#

Where do you learn to make stuff like this?

tranquil viper
#

Is it possible to force it to rain in the desert?

tender shard
#

the animation is client side

tranquil viper
#

So no, gotchya

tender shard
#

you coud tell the client that it's actually another biome

#

but then also the color of leaves etc would look different

tranquil viper
#

Yea it's all good I don't want to do that

grand flint
#

Where do you do thiiiiiis

#

Where do you learn it

#

Is that java??

tranquil viper
#

That's probably bedrock

grand flint
#

I meant the language bro ๐Ÿ’€

tranquil viper
#

c++

tender shard
#

and english

tranquil viper
#

^

grand flint
#

damn

#

thoguht it was japanese or sum

#

thx

tranquil viper
#

๐Ÿ˜‚ ๐Ÿ˜‚ ๐Ÿ˜‚ ๐Ÿ˜

grand flint
#

thats how ur mom laughs at ur jokes

#

is there a documentation for bedrock development?

tranquil viper
#

Not even trying to be rude that has to be one of the worst jokes I've ever heard

tranquil viper
#

You can try this

grand flint
#

arent these basically mods

tranquil viper
#

I believe so

winged anvil
# tender shard and english

yo alex, I think I'm having the same issue you were having way back like a year ago with luckperms. im trying to setup redis with it, no pass no user and im leaving both fields blank but its saying it cant get the resource pool. I was looking if anyone had the same issue in the lp disc and found you lol. idk if you remember how to fix it though

#

not a year, back in december mb

tender shard
#

or per-server permissions

#

sth like that

tender shard
#

maybe I then remember what the problem was

winged anvil
#

just curious how you got yours to work, im doing the same but its throwing an error

tranquil viper
#

Uhm, does anyone know why this is happening and how I can fix it?

I have a chest that I put at this location, but when I compare they are just slightly off like so, so they aren't considered equal.

[STDOUT] CHEST ___ x: 85.0 y: 63.0 z: 15.0
[STDOUT] LOCATION ___ x: 85.02878949616395 y: 63.0 z: 15.117772265223364
humble tulip
#

location.getBlock.getLocation.equals(chest.getLocation)

#

do it like that

#

compare the block location

tranquil viper
#

Ah ok thank you

humble tulip
#

np

tender shard
#

IIRC it instantly worked fine :/

winged anvil
#

interesting

#

i would try using setting a pass but idk how to update the redis password for pterodactyl so it crashes my web interface thing

tender shard
#

oh you mean it maybe doesn't work because you don't have any password setup at all?

winged anvil
#

yeah yeah

tender shard
#

because I definitely always used a password

#

yeah hm

#

you could try changing it and see if it works, then change it back to keep ptero working

#

then at least you know if "no password" is the problem

winged anvil
#

true, lemme see

tender shard
#

sorry no idea. have you looked into the redis logs?

humble tulip
#

How do i know when to uncache data with redis?

#

And save to sql

#

Can i maybe use timestamps

winged anvil
patent horizon
#
    @Override
    public boolean onCommand(@NotNull CommandSender sender, @NotNull Command command, @NotNull String label, @NotNull String[] args) {
        if (sender instanceof Player player && player.isOp()) {
            if (args.length == 1) {

                switch (args[0]) {
                    case "shockwave" -> {
                        Shockwave.play(player.getLocation());
                        Bukkit.getOnlinePlayers().forEach(p -> p.sendMessage("watch me whip"));
                    }

                    default -> {
                        player.sendMessage(ChatColor.RED + "Specified effect \"" + ChatColor.GOLD + args[0] + ChatColor.RED + "\" not found.");
                        return false;
                    }
                }

                player.sendMessage(ChatColor.GREEN + "Playing effect \"" + ChatColor.GOLD + args[0] + ChatColor.GREEN + "\".");
                return true;

            }
            else player.sendMessage(ChatColor.RED + "Incorrect usage.");
        }

        return false;
    }``` im not sure why the switch statement isn't being triggered
ivory sleet
#

you can set redis to be lru

pastel juniper
#

If I want to use EntityVillager, do I have to install spigot.jar???

winged anvil
#

not who asked just like

#

who?

#

what are you tryna do

pastel juniper
#

I want to extend the class to EntityVillager

winged anvil
#

is that nms?

pastel juniper
winged anvil
#

so you need nms

#

are you using maven

pastel juniper
winged anvil
#

you have nms in your project already ?

pastel juniper
#

No.... I think

winged anvil
#

go to your spigot dependency in your pom and remove the -api part

pastel juniper
winged anvil
#

yes

pastel juniper
#

Nothing changed,

winged anvil
#

you reloaded maven?

pastel juniper
#

yes

winged anvil
#

hmm

#

lemme test

pastel juniper
#

@winged anvil What you told me to do was right, I 'm just an idiot

winged anvil
#

shi i couldnt get it to work so im glad you did

pastel juniper
#

Instead of deleting the -api, I deleted the whole <dependencies>

#

Thank You

winged anvil
#

were you able to extend EntityVillager tho?

#

cause my nms didnt let me for some reason

pastel juniper
winged anvil
#

word

#

np

pastel juniper
winged anvil
#

it says?

pastel juniper
winged anvil
#

no idea how that works

#

you can try using the remapped version ?

pastel juniper
quaint mantle
#

https://paste.md-5.net/imaxipolom.cs

i dont get it, i followed a video and the only difference in our code was that his example event was in his main file while mine was in an events file, but i fixed it and now this.plugin is null which he (seemingly) didnt get as an error yes i am absolutely new to this file thing

winged anvil
#

where are you passing in your plugin instance at

#

send that code

quaint mantle
#

wdym?

#

sorry my brain inst functioning atm, where should it be lmao

winged anvil
#

holdup

#

yeah

#

send where you pass in the plugin instance at

#

probably in your onEnable() since i assume youre watching codedRed's video?

quaint mantle
#

INDEED

#

yep 1s

#
@Override
    public void onEnable() {
        // Plugin startup logic
        statsManPluginGrab = this;
        this.SQL = new mySQL();
        this.data = new SQLStatsHandler(this);
        this.dataManager = new SkillsManager(this);```

right here?
winged anvil
#

yes

#

hmm

#

i mean you could try passing in statsManPluginGrab but its the same as just this

#

might as well try it tho

#

i cant see any reason why it would be null

quaint mantle
#

would you like the whole main class?\

winged anvil
#

uh sure

quaint mantle
#

be warned, you will need bleach, i have a lot of stuff from when i had just begun so some things are there which serve no real purpouse

winged anvil
#

idk where it could be null considering you have like 4 different instances of the plugin

#

i would just have ```java
public static ThunderLearn getInstance() {
return instance;
}

private static final ThunderLearn instance;

@Override
public void onEnable() {
instance = this;
}

#

lmfao

#

hold

quaint mantle
#

yeah im aware i have a lot but i cant delete instance as its in use by a lot of my other classes

winged anvil
#

ah

#

hmm

#

idrk then cause I don't see where it could be passing in as null

tranquil viper
#

@quaint mantle this is what I do for my plugins (yes there are better ways to do it but I like this :|):

public static MyPlugin INSTANCE;

@Override
public void onLoad() {
    INSTANCE = this;
}

@Override
public void onDisable() {
    INSTANCE = null;
}

Then in my other classes I can use:

private final MyPlugin instance = MyPlugin.INSTANCE;

Boom, you're done! Now you can use your instance without any worry of it ever being null. You can also do it onEnable() but I usually prefer having it onLoad() just because there is no chance of anything loading before you get an instance of your plugin.

winged anvil
#

^

#

use DI when you can tho

quaint mantle
#

then i will do this if it works for ya

quaint mantle
#

I made enderworld using WorldCreator, but there is no ender dragon and portal. is it just bug?

#
    @EventHandler
    public void join(PlayerJoinEvent e) {
        if (!check(e.getPlayer())){
            World source = Bukkit.getWorld("world_nether");
            File sourceFolder = source.getWorldFolder();
            copyWorld(sourceFolder, new File(Bukkit.getWorldContainer(), e.getPlayer().getUniqueId() + "_nether"));
            World a = new WorldCreator(e.getPlayer().getUniqueId() + "_nether")
                    .environment(World.Environment.NETHER)
                    .generateStructures(true)
                    .createWorld();
            Bukkit.getServer().getWorlds().add(a);

            WorldCreator worldCreator = new WorldCreator(e.getPlayer().getUniqueId() + "_the_end");
            worldCreator.environment(World.Environment.THE_END);
            worldCreator.generator((ChunkGenerator) null);
            World c = Bukkit.createWorld(worldCreator);
            Bukkit.getServer().getWorlds().add(c);

        }
stoic vigil
native nexus
#

Anyone familiar with google guice?

drowsy helm
native nexus
# drowsy helm whats your question

bind(SettlementService.class).to(SettlementServiceImpl.class).in(Singleton.class); (This is inside a the module configure function) I have created a singleton class out of my SettlementServiceImpl and I am not able to get a field with anywhere I want to get an instance of it.

boreal seal
#

im wondering guys

#

i want to store an block location in hashmap

#

and an integer

#

but not sure if storing Location in hashmap is a thing i should do

desert tinsel
#

you can store int as key and location as value

#

Or if you really want to store the location as a key, you can create a method that returns a location with integer coordinates.

humble tulip
#

It depends on what you're doing

neat meadow
quaint mantle
#

if you arent holding anything

#

and i give you an apple

#

and then i ask for a banana

#

will you know that i actually want the apple?

#

yeah

quiet ice
#

(ReadyItem โ‰  createReady)

tranquil viper
#

Hiya! I want to make a plugin that I can post on spigot, problem is I only know mongodb and I need a db for the plugin to function properly. What other db language should I learn that everyone will have access to?

tranquil viper
#

well yea but what db? I was thinking h2

vocal cloud
#

MySql?

#

Just the base SQL driver

tranquil viper
#

Don't you need to install a mysql server?

#

With h2 it's just a file

#

I'm not too sure

vocal cloud
#

Could use SQLite

#

If you want it file based

tranquil viper
#

Alright I'll probably go with that, thank you.

vocal cloud
#

Do you set the meta back onto the item?

deft rain
#

What plugins do i need for exelentcrates to work

drowsy helm
#

you need to set the meta back on the item

#

yeah

dark arrow
#

is it possible to make a passive entity fight using nms

stoic vigil
#

how do i set and check perms for commands?

brave sparrow
brave sparrow
stoic vigil
dark arrow
brave sparrow
green prism
brave sparrow
#

Define โ€œnot workingโ€

brave sparrow
green prism
brave sparrow
green prism
brave sparrow
#

Your IDE should have one built in

#

What IDE do you use

green prism
#

intellij

brave sparrow
#

Yeah IntelliJ has an autoformatter

#

You can customize it but the default one should work for you

green prism
#

How can I use it?

brave sparrow
#

Google it

#

What does โ€œdoesnt workโ€ mean

#

Is it doing nothing?

sage patio
#

Why this calls PrepareItemCraftEvent ??

brave sparrow
#

Doing something but not the right thing?

wind sphinx
#

How do I remove / decrease amount of dispensed item by 1 from a dispenser even if the event is cancelled? (BlockDispenseEvent)
I have tried ((Dispenser) block.getState()).getInventory().removeItem(itemRem); but it doesn't affect the item in the dispenser if it has an amount of 2 or lower, even if the amount of itemRem is set to 1.

brave sparrow
#

Did you register the listener in your plugin class?

#

Letโ€™s see your main class

green prism
sage patio
brave sparrow
#

You have to register every listener

#

Not just the plugin

sage patio
brave sparrow
crimson terrace
#

try ctrl alt L

sage patio
brave sparrow
#

You can fork spigot if you want to

#

And remove that functionality

#

Other than that, no

sage patio
#

I've coded this event a long time ago, but it was not like this

brave sparrow
#

It may have changed

#

Or you might have a bug in your code and it isnโ€™t doing what you think it is

#

That registers the listener in your plugin class

#

You have to register each listener individually

green prism
#

or just remove recipes from the server

brave sparrow
sage patio
green prism
brave sparrow
#

You donโ€™t put onEnable in each class, you just register the listeners

green prism
#

it'll hide the result of the recipe

sage patio
brave sparrow
#

@quaint mantle you have to register each instance of a Listener class that you wish to be able to handle events

#

Itโ€™s the same method

#

It sounds like you need to spend some more time learning Java before trying to make plugins

#

Doing that through spigot is a mistake

#

Spigot requires a decent grasp of Java to really do anything

#

You donโ€™t understand the object oriented programming structure enough to use the api

#

Yes, you need to learn Java properly before you start trying to do things with spigot. Spigot isnโ€™t a language, itโ€™s an API in Java. This is like trying to write a book in German before learning German

green prism
#
[10:04:05 WARN]: Initializing Legacy Material Support. Unless you have legacy plugins and/or data this is a bug!
[10:04:07 INFO]: Enabled in 2618 ms.
[10:04:07 INFO]: ===========================================```
Is it normal that it takes this long to start for the first time (with the folder already created)?
brave sparrow
#

Your plugin is forcing spigot to load a bunch of backwards compatibility stuff which is increasing your load time

eternal oxide
#

include an api version in your plugin.yml

wicked bluff
#

Does anyone know how to tell if an entity is inside of a Structure in 1.18.1-1.19?

sand sphinx
#
    @EventHandler
    public void onDropItem(PlayerDropItemEvent e){
        e.getPlayer().sendMessage(ChatColor.RED+"I'm sorry, you can't do this!");
        e.setCancelled(true);
    }```
Why not working :/
I want to when my dropped a item, it should set cancelled
And no have a error in the console
#

Btw I registered

eternal oxide
#

That code will not throw any errors

sand sphinx
eternal oxide
#

Nothing wrong with it at all. I'm going to guess you didn;t register the Listener

sand sphinx
#
    @Override
    public void onEnable(){
        getServer().getPluginManager().registerEvents(this, this);
        getServer().getPluginManager().registerEvents(new Perms(), this);
    }
}``` It's my main
#

I think I did ๐Ÿ˜„

vale ember
#

hey, i wanted to ask a question
is the only way to have vanilla-like weapon description with custom attack damage/speed is to add it manually via hiding the HIDE_ATTRIBUTES flag and ItemMeta#addLore() ?

earnest forum
#

are you getting the message

sand sphinx
eternal oxide
#

Then your plugin isn;t running

sand sphinx
#

Bruh

#

I reloaded too much

#

I will restart the server

#

1 min

#

Oh
My plugin was working
But not now

wind sphinx
#

Hey, I am trying to make a dispenser place blocks but for some reason the removeItem() method does not work when the block itemStacks have amount of 2 and under.

// the dispensed item
        ItemStack dispensedItem = event.getItem();
        Block block = event.getBlock();

        // auto builder only uses blocks
        if(!dispensedItem.getType().isBlock())
        {
            return;
        }

        if(event.getBlock().getBlockData() instanceof Directional)
        {
            event.setCancelled(true);
            // the directional cast of the dispenser block
            Directional dir = (Directional) event.getBlock().getBlockData();
            // current location of the dispenser
            Location currLoc = event.getBlock().getLocation();
            // the location the dispenser is facing
            Location targetLoc = currLoc.add(dir.getFacing().getModX(),
                    dir.getFacing().getModY(), dir.getFacing().getModZ());

            // target location to place block has to be air
            if (!targetLoc.getBlock().getType().equals(Material.AIR))
            {
                return;
            }

            // item to remove from the dispenser (same as dropped item but amount 1)
            ItemStack itemRem = new ItemStack(dispensedItem);
            itemRem.setAmount(1);

            Inventory dispenserInv = ((Dispenser) block.getState()).getInventory();
            dispenserInv.removeItem(itemRem);
            targetLoc.getBlock().setType(event.getItem().getType());
green prism
sand sphinx
eternal oxide
#

Check your server startup log for errors

green prism
#

What's the "Best" MongoDB or MySql?

#

elgar?

eternal oxide
#

"Best"

green prism
sand sphinx
green prism
#

you

eternal oxide
#

A very subjective question. Depends on your use case I guess

green prism
sand sphinx
green prism
sand sphinx
green prism
#

When a plug-in is red is LOADED but disabled by the Server so the server printed an error line for sure

eternal oxide
green prism
sand sphinx
#

Oh okay
I did
Its writing: Plugin already initialized

eternal oxide
#

you did new Main() or whatever your main class is called

eternal oxide
sand sphinx
eternal oxide
#

If not, you have two copies of your plugin jar in the plugins folder

sand sphinx
#

This is not :/
madness..

green prism
#

Idk what to use rn

eternal oxide
#

If it is to be used by just this plugin then go something like SQLite. If its going to be used across servers Mysql

green prism
eternal oxide
#

no, its a file based sql on the local machine

#

Its memory based, but it stores to a single .db file on the local PC

green prism
#

at this point it wouldnโ€™t become like a yaml config but with another extension?

eternal oxide
#

kinda, but it has the features available of SQL and relational databases. search etyc

#

you get most of teh SQL syntax

sand sphinx
#

Only main class can start as "public class Main extends JavaPlugin", right?

eternal oxide
#

yes

green prism
sand sphinx
#

Oh okay

#

Thank you

eternal oxide
green prism
eternal oxide
#

Depends if the YAML is already loaded

#

If the file is already loaded the YAML will be quicker than Mysql

green prism
#

you made my day elgar thanks!

vale ember
#

how can i delete attribute modifiers only for specific slot AND attribute, there is only #removeAttributeModifier(EquipmentSlot) and #removeAttributeModifier(Attribute) but no #removeAttributeModifier(EquipmentSlot, Attribute)

round finch
#

is it possible update the ender-chest animation?
instead of it continually being open?

#

๐Ÿค” ๐Ÿคจ

vale ember
eternal oxide
#

yes, there is a base value method

eternal oxide
#

probably

#

you may have to store teh state and call update() after

round finch
gritty urchin
#

Is there an API for determining whether a player is cracked or premium on a cracked server.

#

Surely there must be a way somehow of externally authenticating a premium player

eternal oxide
#

if the server is offline

#

assume ALL are cracked

gritty urchin
#

yeah but I want to determine between the two

#

I know premium players are given cracked uuids

eternal oxide
#

Not in the API. the API is for premium only

#

well you could query Mojang

#

query their name and if the returned UUID does not match theirs they are cracked

gritty urchin
#

but surely that applies to all players

#

all players have a cracked uuid

#

regardless of their account status

#

Is there a way to externally verify

#

before

eternal oxide
#

When a player joins an online server, or via Bungee their UUID will be a valid Majang assigned one

gritty urchin
#

Yes

eternal oxide
#

that UUID will corespond to their player name

#

If the two don;t match they are cracked

#

?paste

undone axleBOT
eternal oxide
gritty urchin
#

hence all users uuids will be cracked

#

so there is no way of differentiating

pastel juniper
#

I used build tools to build spigot and then I changed in the pom.xml file the artifactId to spigot but still can't extend class to entityvillager

#

I get this

eternal oxide
#

NMS is obfuscated

pastel juniper
#

I have already tried this

eternal oxide
#

You didn;t do it properly

#

used --remapped ?

pastel juniper
#

I tried both

eternal oxide
#

both?

#

?paste your pom

undone axleBOT
pastel juniper
#

Both remapped and "non-remapped"

pastel juniper
eternal oxide
#

copy the link it gives here

pastel juniper
eternal oxide
#

remove the minecraft-server dependency

humble tulip
#

When it's deobfuscated it's no longer entityvillager but just villager

eternal oxide
#

You may want to make yoru pom easier to modify by adding in properties <project.spigotVersion>1.19-R0.1-SNAPSHOT</project.spigotVersion>

pastel juniper
eternal oxide
#

are you sure you are using the NMS Villager?

pastel juniper
earnest forum
#

you havent implemented the constructor

#

EntityVillager requires a constructor

#

in your constructor for Mob class you call super

eternal oxide
#

like ```java
public class NewWarden extends Warden{

public NewWarden(Location location) {
    super(EntityType.WARDEN, ((CraftWorld) location.getWorld()).getHandle());
}

}```

earnest forum
#

yeah

pastel juniper
eternal oxide
#

Villager probably only takes one arg of the ServerLevel (world)

tender shard
#

shouldnt the NMS constructor take an NMS world?

#

yeah

eternal oxide
#

its only Warden (new mob) that seems to require the EntityType

pastel juniper
#

I 'm really confused

eternal oxide
#

Why? Works for me```java
public class NewWarden extends Villager{

public NewWarden(Location location) {
    super(EntityType.VILLAGER, ((CraftWorld) location.getWorld()).getHandle());
}

}```

#

I didn;t bother to rename

pastel juniper
eternal oxide
#

mine is 1.19 code though

#

requires an EntityType now

#

so for 1.18 its super(((CraftWorld) location.getWorld()).getHandle());

pastel juniper
eternal oxide
#

Extend Villager and no EntityType

#

if 1.18

pastel juniper
eternal oxide
#

hm, shoudl be fine

pastel juniper
eternal oxide
#

I don;t have a 1.18 test bed to check on now though

#

sec and I'll change back

pastel juniper
eternal oxide
#

in 1.18.2```java
import org.bukkit.Location;
import org.bukkit.craftbukkit.v1_18_R2.CraftWorld;

import net.minecraft.world.entity.EntityType;
import net.minecraft.world.entity.npc.Villager;

public class NewWarden extends Villager{

public NewWarden(Location location) {
    super(EntityType.VILLAGER, ((CraftWorld) location.getWorld()).getHandle());
}

}```

#

works fine

pastel juniper
#

Finally, it took me months

eternal oxide
#

I'd not done anythign with NMS and mobs till someone in here yesterday was having problems making a custom Warden

west crag
#

can we make custom mobs or items using spigot?

eternal oxide
#

custom as in goals

west crag
#

okay...

#

nvm mb

misty current
#

can enums only implement and not extend?

west crag
ivory sleet
#

Thatโ€™s because they already extend a class

dark arrow
#

Why i am only getting one attribute in atribute editor in nms package

misty current
#

too bad it could've been useful to avoid to repeat boilerplate code in some enums of mine

#

interfaces are good enough

crude loom
#

How can I cancel fire spread to specific blocks?

drowsy helm
#

check BlockSpreadEvent

#

and see if its the block you want to cancel

tender shard
#

sometimes paper just sucks. How is the "UnusualXRepeatedCharacterHexFormat" in any way unusual? Like wtf, it's the spigot default builtin way for hex colors. it's the opposite of unusual

stoic vigil
#

where's the problem of my plugin.yml? if i give someone postermaker.* permissions, the player doesn't gets postermaker.create or any of the others...

api-version: 1.19
description: Plugin to create Posters
commands:
  poster:
    description: Create a poster
    usage: /poster

permissions:
  postermaker.*:
    description: permission for all postermaker dependent commands
    children:
      postermaker.create: true
      postermaker.edit: true
      postermaker.delete: true
  postermaker.create:
    description: create posters
    default: op
  postermaker.edit:
    description: edit posters
    default: op
  postermaker.delete:
    description: delete posters
    default: op
brittle lily
#

Guys It giving tnt to all players Where is my mistake,

eternal oxide
ivory sleet
brittle lily
eternal oxide
misty current
stoic vigil
eternal oxide
stoic vigil
eternal oxide
#

why are you not assigning permissions to commands in the plugin.yml?

dark harness
#

How can i prevent a person thats hidden for others have collisions with them?

stoic vigil
eternal oxide
#

add a permission line to each command

#

permission: postermaker.create:

#

you then don;t need to check in the onCommand

dark harness
eternal oxide
west crag
#

in sound enum is there XP sound?

#

i cant able to find it

crimson terrace
#

this what you need?

west crag
#

ah f

#

mb

crimson terrace
#

๐Ÿ™‚

west crag
#

i was searching for XP

#

xD

#

thanks btw

crimson terrace
#

it should still have shown

#

Experience does have an "XP" in it

west crag
tardy delta
#

cuz you are doing the objects.requirenonnull

#

as your ide said

#

null check instead

west crag
#

hey can anyone tell me which effect should i add when a mod spawn
means i dont know much about effects not even names

tardy delta
#

i told you to null check it

#

do you know what a nullpointer means?

west crag
#

why its showing this?

#

like

#

playEffect()

tardy delta
#

cuz its deprecated, meaning that you shouldnt use it anymore

#

go check the docs for what to use instead

west crag
#

ok

tardy delta
#

?jd-s

undone axleBOT
tardy delta
#

e.getItem will be null not the event itself

dark harness
#

Again how can i disable Collison for one Player to all other entities?

eternal oxide
#

Teams

dark harness
# eternal oxide Teams

I tried

Team team = p.getScoreboard().getTeam("Vanished");            team.setOption(Team.Option.COLLISION_RULE, Team.OptionStatus.NEVER);
            team.addEntry(p.getName());``` 
But that didn't worked
eternal oxide
#

all players need to be on that team

#

or all players you don;t want to collide with eachother

#

I think

tardy delta
#

i guess hes talking bout players with other types of mobs

eternal oxide
#

I think he posted earlier that he created a vanish but he pushes other players when he teleports to them

tardy delta
#

there is some LivingEntity#selCollision or smth but that didnt work for me

dark harness
#

Vanished Player cant push all types of entities^^
That's what i want

#

Tried ingame with commands and it worked

eternal oxide
#

Then the Team shoudl work

#

is the player in that Team?

pastel juniper
#

Why I can't use World Server in 1.18???

eternal oxide
#

oh, add the Player by UUID

dark harness
eternal oxide
#

or not. I forget if UUID is for player or mobs

pastel juniper
eternal oxide
#

sec I'll check

pastel juniper
dark harness
#

Can't use uuids there

eternal oxide
#

you add Entities by UUID.toString(). Players are added by name

tardy delta
#

ooh learnt smth new

pastel juniper
#

Can sb help me???

eternal oxide
#

ServerLevel world = ((CraftWorld) location.getWorld()).getHandle();

eternal oxide
eternal oxide
#

requires EntityPlayer not a World

#

or ServerLevel

eternal oxide
#

I don;t want to retype it all

pastel juniper
#
public class NPC {
    private static List<EntityPlayer> NPC = new ArrayList<EntityPlayer>();

    public static void createNPC(Player player){
        MinecraftServer server = ((CraftServer) Bukkit.getServer()).getServer();
        ServerLevel world = ((CraftWorld) player.getWorld()).getHandle();
        GameProfile gameProfile = new GameProfile(UUID.randomUUID(), ChatColor.DARK_AQUA + "" + ChatColor.BOLD + "ANFFGaming");
        EntityPlayer npc = new EntityPlayer(server, world, gameProfile, new PlayerInteractManager());
    }
}
eternal oxide
#

and your imports?

dark harness
#

Ok thx it works now

pastel juniper
# eternal oxide and your imports?
import com.mojang.authlib.GameProfile;
import net.minecraft.server.MinecraftServer;
import net.minecraft.server.level.EntityPlayer;
import net.minecraft.server.level.PlayerInteractManager;
import net.minecraft.server.level.ServerLevel;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.craftbukkit.v1_18_R2.CraftServer;
import org.bukkit.craftbukkit.v1_18_R2.CraftWorld;
import org.bukkit.entity.Player;

import java.util.ArrayList;
import java.util.List;
import java.util.UUID;

public class NPC {
    private static List<EntityPlayer> NPC = new ArrayList<EntityPlayer>();

    public static void createNPC(Player player){
        MinecraftServer server = ((CraftServer) Bukkit.getServer()).getServer();
        ServerLevel world = ((CraftWorld) player.getWorld()).getHandle();
        GameProfile gameProfile = new GameProfile(UUID.randomUUID(), ChatColor.DARK_AQUA + "" + ChatColor.BOLD + "ANFFGaming");
        EntityPlayer npc = new EntityPlayer(server, world, gameProfile, new PlayerInteractManager());
    }
}
tardy delta
#

i see static abuse every single day lol

eternal oxide
#

I found everything except for the PlayerInteractManager

wind sphinx
#

Anyone knows how to check if an activator rail is powered?

        if (railblock.getType().equals(Material.ACTIVATOR_RAIL) && railblock.isBlockPowered())
        {
            Bukkit.broadcastMessage("activated!");
        }

for some reason railblock.isBlockPowered() returns false although it is powered. I am using VehicleMoveEvent to check if a minecart is above a powered activator rail.
railblock.getType().equals(Material.ACTIVATOR_RAIL returns true.

dark harness
#

When i use
Team team = p.getScoreboard().getTeam("Vanished");
team.addEntry(p.getName());
It removes me from all other teams i'm in
Only when i use addEntry not by removeEntry

eternal oxide
#

pure speculation as I've not tested it nor used any of this before

eternal oxide
#

I thought you could only be in one Team at a time

#

No clue though as I've never tried to use more than one

#

Looks like you can be in multiple teams, but only on different Scoreboards

tardy delta
#

lol

dark harness
#

Oh yes ๐Ÿ˜ฆ

undone wraith
#

Hey, I would like to ask if there's any way I could do string subsitution (with RegEx or other methods) to substitute a value in the config on the fly.
Let's say I have this config file:

player-apples: 'Player has ${VALUE} apples'

How I may be able to subsitute that ${VALUE} with the amount of apples the player has?
Addendum; I have a function that retrieves the value, I'm just asking if in code I am able to subsitute it

crude snow
#

Where can I download the 1.18 spigot api for eclipse?

eternal oxide
#

and the spigot tutorial is shit too ๐Ÿ˜ฆ

crude snow
eternal oxide
#

use maven and it fetches the API

#

Eclipse comes with maven

crude snow
#

How do I use that?

#

Nevermind

eternal oxide
#

That will give you access to the API

formal bear
#
            <groupId>net.kyori</groupId>
            <artifactId>adventure-text-minimessage</artifactId>
            <version>4.11.0</version>
            <scope>provided</scope>
        </dependency>```
Can someone help me with linking api
#

Idk im doing wrong

eternal oxide
#

I thought minimessage was included in paper now

ivory sleet
#

it is

eternal oxide
#

I only use Spigot so can't advise

sand sphinx
#

@Override can be only in the main class?

eternal night
#

๐Ÿ‘€

#

No the annotation should be present on any method that overrides a method from a parent class

eternal oxide
#

override is used anywhere in a subclass that you want to override one in the parent

#

In your Main you are overriding methods which exist in JavaPlugin or higher

sand sphinx
eternal oxide
#

Its not a requirement to work, it simply makes checking your code/implementation easier

sand sphinx
#

๐Ÿ‘

#

Thank you bro

glossy venture
#

use the lp api

#

otherwise check if the code even runs

#

i dont really know the luckperms commands so idk if there would be an error in the command

#

also i think this will override their current rank, you would probably want to use parent add

desert tinsel
#

yep, it is parent add

dapper harness
#

What is the most efficient way of restoring an arena where you can place blocks every once in a while ?

#

Because I made a plugin that does that but it's very ressource intensive

trail lintel
#

Aye guys, lemme ask another custom item question =]

#

So I have registered about 10 different NamespacedKeys for 10 different items. Now I want to be able to check WHICH item the player has before performing an action. Is the easiest way to literally just have a bunch of if(meta.getPersistenceDataContainer().Contains(key) -> do this item logic, proceed to next if? There has to be a easier way right?

chrome beacon
#

Why not use the LuckPermsAPI?

glossy venture
#

yeah

#

also thats not the solution i sent

#

give more code

quaint mantle
#

Hello! I'm trying to replace the drops with something else, how do I do that?

public void onOreBreak(BlockBreakEvent event){
        Block block = event.getBlock();
        if(block.getType() == Material.DIAMOND_ORE){
            event.getPlayer().sendMessage("Daarin! Will you get me a diamond ring?");
            
        }
    }```
trail lintel
# eternal night A map?

A map of what though? I have a map of namespaced key to some item specific stuff, but I still need to iterate through every namespaced key on the object and check if its contained in the map

#

I guess let me ask this, this would probably solve it

#

given an item, is there a way to get the namespaced key of the recipe that was used to create it? I have combed through ItemMeta and ItemStack and I don't tthink theres a way

eternal night
#

No, item stacks don't know the recipe used to craft them

#

Unless you manually attach it in the PDC

trail lintel
#

Hmmmm, scratching my head on this one haha

eternal night
#

Generally,the way to go is one single key

#

And the value is the type of item

#

Like yourpluginname:itemtype as key

#

And then ehh "superdupersword" as weapon

trail lintel
#

I think that is how im gonna do it, somebody suggested to me yesterday to work with the namespaced keys rather than raw strings as "item identifiers"

eternal night
#

Then you just always grab the value and do a lookup through some map/index

trail lintel
#

but just having a simple string that has a "id" basically

#

seems to be the best way =]

eternal night
#

I mean, nothing stopping you from using a namespaced key as a value either

#

Just write your own data type

trail lintel
#

Thats a fair point ๐Ÿ˜ฎ

#

Sorry for the rapid fire questions lol one more

#

When you register namespaced keys for custom items, do you even bother keeping a reference to them?

#

If im not using them primarily for identification, I don't think I really need them anymore after recipe creation

eternal night
#

The namespaced key instance?

trail lintel
#

yup, like can I just make a new namespaced key and just let that baby fall out of scope

#

or should I hold onto these keys for some reason im unaware of yet ๐Ÿ˜‰

eternal night
#

Yea you can. But if you go with a single namespaced key for identification and use the value as the item identification this question is mood

trail lintel
#

So I do notice that I am not able to use the same namepaced key for multiple items, thats why I ask

eternal night
#

Hm ?

trail lintel
#

I have like 10 namespaced keys, but then im gonna have one namespaced key for holding the "item type" that will be common to all of them

#

when creating a recipe it wants a unique key

eternal night
#

Why

#

What purpose does a unique key bring

trail lintel
#

and if I try and reuse them it complains about duplicate recipes

eternal night
#

Ohhh

#

The recipe

trail lintel
#

yeah haha just the recipe part

#

so those keys I don't need to hold on to

eternal night
#

No

#

They are fire and forget

trail lintel
#

awesome ty =] im learning the spigot api slowly haha

green prism
chrome nova
#

Does anyone know why seeFriendlyInvisibles true isn't working with sscoreboard?

civic scaffold
#

Can someone help me with making a GUI user specific?
I have a GUI that modify items dynamically with user specifics infos but it changes the GUI for everyone in it

tardy delta
#

create a new gui

civic scaffold
#

yea but what's about the event listener ?

#

do i need to create an event dispatcher ?

tall dragon
#

uhhh no?

#

you just need to open a new instance of your gui for each player

quaint mantle
civic scaffold
#

(1.7.10)

tall dragon
#

1.7.10

civic scaffold
#

legacy plugin maintenance

tall dragon
#

it depends how your gui system is setup

#

i for example have 1 listener for all my menus

eternal oxide
#

same

civic scaffold
#

it get the event

#

filter with a gui list

#

and done ?

tall dragon
#

have an InventoryClickEvent -> see if clicked inv is your custom inv -> perform actions

civic scaffold
#

that what i said

#

thanks for your help

tall dragon
#

well then yea

#

exactly like that

glad spire
#

hey im trying to add custom recipes and I made a ShapedRecipe and added it thru bukkit but when I take things out of the ingredients slots when crafting the result shows up when there is nothing in there

tall dragon
eternal oxide
#

you are messing with the craft event to put a modified result

glad spire
tall dragon
glad spire
eternal oxide
#

that on its own will not produce the effect you are seeing

tall dragon
#

unless its a bug on 1.19 but i very much doubt it

glad spire
#

im on 1.19 but ig ill test on 1.18

iron glade
#

How ridicolously cheap have websites become

tall dragon
#

eh depends on the domain you want

iron glade
#

well I just got a .com domain for 2โ‚ฌ a month lol

tall dragon
#

oh nice

#

thats a score

iron glade
#

ikr

#

only problem is I'm really bad at designing websites lmao

dusk flicker
#

Who sells domains per month??

#

I've only ever seen them by year

hybrid spoke
#

a .com domain

#

for 24โ‚ฌ a year?

dusk flicker
#

Way overpaid there lol

iron glade
#

yea

hybrid spoke
#

i get them for 5-12โ‚ฌ

iron glade
#

Just the domain or anything else included?

hybrid spoke
#

domain

iron glade
#

ah yeah that explains it

dusk flicker
#

I can get one for a year at 6 euro

iron glade
#

I've got webhosting and some other stuff included I guess

hybrid spoke
#

webhosting 2โ‚ฌ
SSL 5โ‚ฌ

tall dragon
#

a year?

hybrid spoke
#

well not the webhosting

#

but the SSL

tall dragon
#

thats not bad

iron glade
#

the SSL was included for free here

#

"free" in the 2โ‚ฌ per month

tall dragon
#

so they say ๐Ÿ˜„

tardy delta
tall dragon
hybrid spoke
#

on namecheap 5.98โ‚ฌ/1 year for .com with 4.71โ‚ฌ/1 year SSL and optional webhosting for either per month or year

iron glade
#

When did websites become so cheap

summer scroll
#

It's always cheap

iron glade
#

damn

hybrid spoke
#

it just becomes expensive when it comes to making your own website

#

or even worse, forum

eternal oxide
#

host your own on a NUC or Pie

dapper harness
#

How do you copy a structure with spigot in 1.18 do you just have to change the blockData of each block ?

tall dragon
#

like a village house?

#

or just a region between 2 points

dapper harness
#

like something I would build

#

yea a region

tall dragon
#

when the player selects 2 points, he should do something to copy it.

#

use the player as origin

#

then map relative points to blockdata

#

with player location as origin

eternal oxide
dapper harness
#

omg this exists

#

thanks a lot

tall dragon
#

wow yea...

#

i created my own xd

#

good to know

eternal oxide
#
StructureManager sm = Server.getStructureManager();
Structure newStructure = sm.createStructure();
newStructure.fill(Location, Location, true);
sm.saveStructure(File, newStructure);```
tall dragon
#

what does that take as origin tho

#

when you want to paste it back

eternal oxide
#

or you can create a NamespacedKey and register teh Structure to use it

#

Origin I would guess is the center

tall dragon
#

ah

eternal oxide
#

but could be the first Location

tall dragon
#

so you cant specify the origin?

eternal oxide
#

There are two fill methods so would have to test

tall dragon
#

oh yea

#

the second one does take origin

eternal oxide
#

thats for copying to the Structure Object

tall dragon
#

i c

misty current
#

can anyone gimme some feedback on a design choice? I don't like it that much but i can't think of anything else

#

i've made an enum with these constants as a configuration for different armor tiers

#

i also have other enums similar to this one for pickaxes and weapons and i was wondering if I should merge them into a single one instead of using ICosmicMaterial as an identifier interface

#

the issue is that pickaxes have some slight differences compared to weapons and weapons are a bit different compared to armor

#

ex. pickaxes are indestructible but armor and weps are not, so I have to config durability for armor and weps

tall dragon
#

i think this is not that bad if its for personal use/a client.

misty current
#

it's a private plugin and it's not meant to be edited

tall dragon
#

then i think this is pretty acceptable.

misty current
#

aight thanks

gleaming olive
#

How can I damage a player naturally ? like some zombie has attacked him

eternal oxide
#

command not registered?

#

Not a CommandExecutor?

#

command not in plugin.yml

#

add @Override to the method and see that it doesn;t give you a warning

trail lintel
#

Hey guys, I want to get the face of a water block the player right clicked on. I have to use getLineOfSight() because water/lava doesnt register as a RIGHT_CLICK_BLOCK action. Normally I would use event.getClickedBlock().getRelative(event.getBlockFace()), but like I said water and lava dont count as a clicked block. Is there a way to determine what liquid face they clicked?

#

I could do some trig to determine the closest face, but that may not be where they placed it

eternal oxide
#

raytrace to the block

trail lintel
#

hmm looking into it now

eternal oxide
#

it has fluid collision

trail lintel
#

ah yup this returns a block face in the ray trace results, I think this will do =]

lethal roost
#

is there an event listener that gets fired whenever a player moves around items in their inventory

tall dragon
#

InventoryClickEvent

eternal oxide
#

and drag

tall dragon
#

yep

lethal roost
#

oooh i was searching for player something, thank you!

tall dragon
#

your class is not a CommandExecutor

eternal oxide
#

Thats a Listener class. No CommandExecutor

#

Thats why we use @Override ๐Ÿ˜„

#

Tells you instantly there is no method to override so your parent is wrong

lethal roost
#

wait i ran into another problem now

how do i like get the player who clicked in their inventory

my motive here is to give the player an effect whenever they click in their inventory but i don't know how to do that with InventoryClickEvent since i can't seem to getPlayer on it

eternal oxide
#

getWhoClicked()

lethal roost
#

got it, tysm!

#

sorry , but why am i getting an error here? bit new to developing plugins so i apologize for the endless questions

eternal oxide
#

cast it

quaint mantle
#

add (Player)

tall dragon
#

it returns a HumanEntity

eternal oxide
#

^

tall dragon
#

but im not rlly aware of a case where it will not be a player

quaint mantle
#

Player player = (Player) event.getWhoClicked();

rugged cargo
#

could check if its an instanceof player if you want. its probably not needed, but idk

tall dragon
#

javadocs: Gets the player who performed the click.

#

idk why its not just returning a player

rugged cargo
#

well that answers that

#

maybe there is more than just Player for HumanEntity?

lethal roost
#

wait so does adding (Player) in front of the event.getWhoClicked() cast it from HumanEntity to Player?

ashen quest
#

Yea

#

A Player is a HumanEntity, so the cast is safe

ashen quest
#

Saves you and us time (not to be rude, just want to help :D)

#

are u returning false or true?

eternal oxide
#

did you extend CommandExecutor?

river oracle
#

What's the point of the command name check seems redundant

quaint mantle
#

did you add the command inside onEnable?

eternal oxide
#

extend CommandExecutor and register it

ashen quest
#

Can u show your code

crisp steeple
ashen quest
#

Implement

river oracle
quaint mantle
#

show us onEnable

crisp steeple
#

there is no point in checking the command name

ashen quest
#

true

#

u need to register it as well

wooden fable
rugged cargo
crisp steeple
ashen quest
#

but i m not sure

rugged cargo
#

maybe its for forks of spigot? \o/

wooden fable
#

Ty!

ashen quest
#

you need to register both

quaint mantle
#

no

ashen quest
#

that is for events as it says

quaint mantle
#
this.getCommand("mhhunter").setExecutor(new HunterCommand());
ashen quest
#
this.getCommand("yourCommandNameFromYourYAML").setExecutor(new HunterCommand));
quaint mantle
#

and you do not need to register listeners if you did not use one

ashen quest
#

yes only use register events when ur class has implements Listener

#

make a hashmap which stores players and booleans

#

if the boolean is true, make the player the god else dont

quasi patrol
#

Is there a quick way to check if a player has room for an item in their inventory without having to loop through their inventory contents?

humble tulip
odd sentinel
#

is there any way to tell who placed a boat? my best guess right now is tracking right clicking with a boat in hand and checking that against VehicleCreateEvent but yuck, that can't account for situations where spawn fails

quasi patrol
humble tulip
#

u can fist check if it contains your item

quaint mantle
#

Hey, is there an way to send the whole console output live to the ingame chat ? want to code an ingame console plugin

humble tulip
#

if it does, use Inventory#all(ItemStack)

#

and u gotta check all those stacks

#

oh yeah

#

it does

#

i always forget that

quasi patrol
#

Btw what is the new way of setting player's max health cause it says Player#setMaxHealth() is deprecated.

#

Ah.

eternal oxide
#

or add a modifier, if you don't want to alter the base