#help-development

1 messages ยท Page 1792 of 1

eternal night
#

1.7 did not have titles

fast onyx
#

But the way for send the titles is different between versions

fast onyx
paper viper
#

why are you supporting legacy versions?

paper viper
#

simply

fast onyx
#

Why not?

paper viper
#

the client can interpret the packets

#

...

eternal night
#

what

#

๐Ÿ˜‚

fast onyx
eternal night
#

like, 1.7 clients simply do not know what titles are

#

so if you want to support till that version, you are pretty fucked

peak granite
#

can u view an enderchest of an offline player or no

smoky oak
#

yes

eternal night
#

you basically will need to check if the version is 1.8 or higher

peak granite
#

ok ty

eternal night
#

and then send the title

paper viper
#

why do you hate yourself lol

#

stop supporting legacy

fast onyx
#

I'm not going to support this version, all of my plugins works on all version but 1.7 is not supported and parts of the code may not work on different situations and I'm not going to provide fix

paper viper
#

stop supporting < 1.16

fast onyx
#

0 downloads then

eternal night
#

but if 1.7 isn't supported

paper viper
eternal night
#

and you are only supporting to 1.8

fast onyx
#

Ok that's not my problem

paper viper
#

you clearly havent made plugins before

#

then

eternal night
#

why can't you just use the method ?

paper viper
#

cause so many plugins are latest

fast onyx
paper viper
#

its not my problem then if u cant learn java and code...

#

for example that Objects.equals

eternal night
#

If you are not supporting 1.7, you can literally just use the APIs sendTitle method

paper viper
#

like wtf was that

fast onyx
#

I'm asking? Lol

fast onyx
paper viper
eternal night
#

okay, I have no clue what you are asking then

fast onyx
#

But gives error because as someone said before, the function changed every version

paper viper
#

๐Ÿ˜‚

eternal night
#

the internal representation changes

#

the API method should still be backwards compatible

grim ice
#

1.14+ is still cool

fast onyx
#

This

#

Is my problem

#

If you want to help, then help, if not, then not, but saying stupid things aren't going to help me

paper viper
#

then you're going to have to make per version implementations

#

good luck with that

summer scroll
smoky oak
#

would this work?

FileConfiguration ret = YamlConfiguration.loadConfiguration(configFile);
InputStream defConfigStream = Echo.getEchoInstance().getResource(configFile.getName());
ret.setDefaults(YamlConfiguration.loadConfiguration(new InputStreamReader(defConfigStream, Charsets.UTF_8)));
File newCFGFile = new File(getDataFolder(), "newConfig.yml");
ret.save(newCfgFile);
balmy coyote
#
                    Block blockAt = world.getBlockAt(x, y, z);
                    Material typeAt = blockAt.getType();
                    if(typeAt == Material.FURNACE){
                        Furnace furnace3 = (Furnace) block.getState();
                        System.out.println("3"+furnace3.getBurnTime());

                    }```
Anyone having idea why the following code drops me that error:

```[17:25:10 WARN]: [LCCommands] Plugin LCCommands v1.0.0 generated an exception while executing task 1170
java.lang.ClassCastException: class org.bukkit.craftbukkit.v1_17_R1.block.CraftBlockState cannot be cast to class org.bukkit.block.Furnace (org.bukkit.craftbukkit.v1_17_R1.block.CraftBlockState and org.bukkit.block.Furnace are in unnamed module of loader 'app')
        at lethalchief.listeners.player.TempListener.isCampfireNearby(TempListener.java:167) ~[LCCommands-1.0-SNAPSHOT.jar:?]
        at lethalchief.listeners.player.TempListener.playerTemperatureTimer(TempListener.java:224) ~[LCCommands-1.0-SNAPSHOT.jar:?]
        at org.bukkit.craftbukkit.v1_17_R1.scheduler.CraftTask.run(CraftTask.java:101) ~[patched_1.17.1.jar:git-Paper-381]
        at org.bukkit.craftbukkit.v1_17_R1.scheduler.CraftAsyncTask.run(CraftAsyncTask.java:57) ~[patched_1.17.1.jar:git-Paper-381]
        at com.destroystokyo.paper.ServerSchedulerReportingWrapper.run(ServerSchedulerReportingWrapper.java:22) ~[patched_1.17.1.jar:git-Paper-381]
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1130) ~[?:?]
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:630) ~[?:?]
        at java.lang.Thread.run(Thread.java:831) ~[?:?]
>
eternal night
#

the Player#sendTitle(String, String) method has existed since 1.8

ancient plank
#

?paste

undone axleBOT
stone sinew
eternal night
#

you are using blockAt for the material checks

#

and block to get the state

#

seems like two different blocks

balmy coyote
#

OHHHHHHHHHHHHHHHHHHHHHHHHH

#

I haven't noticed that typo

#

Thank you for pointing it out

balmy coyote
eternal night
#

no problem xD

ancient plank
#

๐Ÿ‘

fast onyx
summer scroll
eternal night
#

tho I guess that doesn't have the title docs

fast onyx
ivory sleet
#

adventu-... :p

eternal night
#

no conclure, don't you dare suggesting anything modern

sterile token
#

I having a NPE (Null pointer exception) that i think its caused because my client#publish() method its getting executed before the connection thread its started
Any recommendation?

mortal hare
#

have anyone tried to spawn shulkers with packets before

eternal night
#

the blocks ?

mortal hare
#

entities

eternal night
#

ah so shulkers

mortal hare
#

yes

sterile token
eternal night
#

it used to be "shulker boxes"

#

which I would consider the blocks with inventory

mortal hare
#
data.writeByte(19);
data.d(0);
data.writeByte(0);
#

im trying to set color for the shulker

#

via EntityMetadata packet

#

but it just defaults to the purple dye color (ID:10)

#

I'm constructing PlayOutEntityMetadata packet via PacketDataSerializer

#

although im sending the ID 0, which means the shulker should be white

ancient plank
#

0th

#

I love 0th

mortal hare
#

nulinis in my native language literally means 0th

#

my native language is not english

#

and its correct to say that

#

0th or zeroth, an ordinal for the number zero.

#

i literally googled that

ancient plank
#

ye

#

ik its correct but i've never seen anyone use it so it looks/sounds funny. personally I use naught/nought, like the UK-lings use

#

never said it wasn't correct :)

red sedge
#

how can I see if damagecause is sweep_attack

#

im just extremely confused rn

peak granite
#

how do i check an item's damage value

vale ember
#
if (event.getCause() == EntityDamageEvent.DamageCause.ENTITY_SWEEP_ATTACK) {
  // Do some stuff...  
}
sacred mountain
#

This is a section of my code that replaces a player's message with a custom one, and its not workng any ideas?


        if(e.getMessage().toLowerCase().contains("ez")) {
            for (Player online : Bukkit.getOnlinePlayers()) {
                if (online.hasPermission("ez.replace"));
                    p.chat(color("&e&lI love playing on this server!"));
            }
        }```
#

they have the permission btw

peak granite
#

is there an easy way to check if a player's held item is any helmet or any chestplate or any leggings or any boots or any sword or any pickaxe or any axe or any shovel or any hoe or bow or fishing rod or shears or do i have to make a LONG ASS line

stone sinew
ancient plank
sacred mountain
#

im having a brain block

ancient plank
#

#setMessage() in asyncplayerchatevent

#

i think

sacred mountain
#

im guessing you cant use
cmd.equalsIgnoreCase("ez")

#

because it isnt a command

mortal hare
summer scroll
sacred mountain
#

Implicit super constructor PlayerEvent() is undefined for default constructor. Must define an explicit constructor?

ancient plank
#

are you trying to listen to playerevent?

summer scroll
#

I'm guessing his class name is PlayerEvent

sacred mountain
#

i'm just learning to do the replace thing for the first time

#

im not that good at this

#

i just tried the default one and now i get how its meant to work

summer scroll
#

Maybe you could start with String#replace

balmy coyote
#

Anyone have an idea how i can force start a Furnace to consume a Fuel and be lighten and be able to smelt items?

sacred mountain
balmy coyote
#

Furnace it's lighten up on BlockState but not in GUI

balmy coyote
#

since i'm using both

                                furnace.setBurnTime((short) 1600);
                                furnace.setCookTime((short) 1600);
#

Neither one of those adds the light in the GUI that allows items to be smelted

sacred mountain
#

i have these two, should i create another one for the replace message class

wide coyote
#

it just runs the getMergedAmount method more than one

oblique wigeon
#

Hm- I'm trying to edit the players base health using attributes:
I have tried:

#
Double basehealth = e.getPlayer().getAttribute(Attribute.GENERIC_MAX_HEALTH).getBaseValue();
                    e.getPlayer().getAttribute(Attribute.GENERIC_MAX_HEALTH).setBaseValue(basehealth+2);```
#

as well as

#
player.getAttribute(Attribute.GENERIC_MAX_HEALTH).addModifier(new AttributeModifier("Vitality", bonus, Operation.ADD_NUMBER));```
#

Nothing seems to work

viscid ember
#
public class KickCommand implements CommandExecutor {
    @Override
    public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {

        if (sender instanceof Player) {
            Player p = (Player) sender;
            if (p.hasPermission("punishments.kick")) {
                if(args.length == 2) {
                    if (Bukkit.getPlayer(args[0]).isOnline()){
                        Player a = Bukkit.getPlayer(args[0]);
                        TextComponent KickMessage = new TextComponent();
                        KickMessage.setText("You Have been kicked");
                        a.kick(KickMessage);
                    } else {
                        p.sendMessage("Player is not online");
                    }```

Why this no work and give error
sacred mountain
#

How do i use my colour utility in the msg replace? it says it doesnt support it, but i want to replace the entered message to a colored one.

import org.bukkit.ChatColor;
import org.bukkit.event.Listener;
import org.bukkit.event.player.AsyncPlayerChatEvent;
import org.bukkit.plugin.java.JavaPlugin;

public class MsgReplace extends JavaPlugin implements Listener {
    
    public final String color(final String string) {
        return ChatColor.translateAlternateColorCodes('&', string);
    }
    public void onChat(AsyncPlayerChatEvent event){
        String msg = event.getMessage();
        msg = msg.replace("ez", "testmessage");
        event.setMessage(msg);
    }
}
sacred mountain
viscid ember
#

basically

#

before the three `` put java

sacred mountain
#

oop

viscid ember
#

and the hit enter

#

so `````(`)Java
Stuff and thigns

ancient plank
#

```java
// java stuff
```

#

like that

viscid ember
#

^^^

sacred mountain
#

ohhh ok

visual tide
#

```java
//code
```

viscid ember
#

'kick(net.kyori.adventure.text.@org.jetbrains.annotations.Nullable Component)' in 'org.bukkit.entity.Player' cannot be applied to '(net.md_5.bungee.api.chat.TextComponent)'

@ancient plank

sacred mountain
#

that is really cool i never knew discord could do that

#

:o

viscid ember
#

since they are depricating kickPlayer

ancient plank
viscid ember
#

im not using papers api

ancient plank
#

kickplayer isn't being deprecated in spigot, and there's no #kick() method on spigot

#

only paper

viscid ember
#

oh

#

im fairly new if i say some dumb shit excuse me lol

mortal hare
fast onyx
summer scroll
fast onyx
#

can you give me an example from how to send a title saying "hi" and subtitle "hello" per example

summer scroll
#

Titles.sendTitle("hi", "hello", fadeIn, stay, fadeOut)

mortal hare
#

Title API exists in spigot itself

fast onyx
#

that was more easy that i though, i was doing something wrong, thanks

mortal hare
#

why would you need separate api for that

fast onyx
#

multi-version plugin

mortal hare
#

mm

#

ok

fast onyx
#

p.getPlayer()?

summer scroll
#

oh yeah, just follow the params

fast onyx
#

oki

#

what is "config"?

#

after player

#

wtf

summer scroll
#

there are multiple method with the same name

fast onyx
#

it's title

#

xd

summer scroll
#

use the one that suits you

final fog
#

Can someone help me with disabling the spectator menu teleportation?

#

I've been stuck on it for about a day now

summer scroll
sacred mountain
#

anyone got some free time and can help me make a plugin, ive already got the cmds, main java, and the plugin yml

fast onyx
final fog
#

I mean that works, but what I'm doing is disabling it while a player has a spectator target (left click an entity while spectating)

#

@summer scroll

fast onyx
#

because it just stay like 1 second

final fog
#

^^

fast onyx
#

20 ticks

summer scroll
#

put it more then

final fog
#

if I do that it just kicks me out of the spectator target

summer scroll
fast onyx
final fog
summer scroll
fast onyx
summer scroll
sacred mountain
#

@ivory sleet sorry for ping, do you know how to code something that when a player sends a message in chat, it will change the message to any one of a random list of strings, e.g. 'inputmsg' --> 'changemsg' --> 'outputmsg'

fast onyx
#

oh i understand now

#

ty

ancient plank
sacred mountain
#

im not very experienced

#

could you explain in more depth

ancient plank
#

list object full of random strings -> get a random member of the list using Random/ThreadLocalRandom (iirc threadlocalrandom is better to use(?)) -> then replace it with the random string you got

fast onyx
#

why?

ivory sleet
#

why what?

#

the placeholder?

sacred mountain
#

/papi ecloud download player

sacred mountain
#

/papi reload

ivory sleet
#

You need to invoke replace on the string which is returned from the config

sacred mountain
#

huh

ivory sleet
#

config.getString("path").replace(โ€ฆ,โ€ฆ);

fast onyx
#

thanks

fast onyx
#

:XD:

sacred mountain
#

if you're using placeholderapi

fast onyx
#

you saw the code?

sacred mountain
#

oh no i didnt

#

its tiny what

manic furnace
#

When i send a message to an player, how can i center the text?

sacred mountain
#

sorry i have a discord theme on and it blended in

crimson terrace
#

or do you mean an actionbar

fast onyx
#

probably he means on chat but if you say how on action bar will be useful for me too

crimson terrace
#

ok one second

fast onyx
#

ty

crimson terrace
peak granite
#

how could i store balance of a player

crimson terrace
#

a yml file is ideal

peak granite
#

can u make a balance top with that

crimson terrace
#

a command to see who has the most money?

#

yeah

peak granite
#

yeah

#

like top 10

#

how would i format the yml file

crimson terrace
#

like a normal yml file

eternal night
#

A yaml file is definitely not the idea storage form for this what

crimson terrace
#

its the best I know of

eternal night
#

for a top command you'd have to read the entire yaml file and parse everything into your memory

#

tho actually

#

alisa is also just starting, so maybe yaml might be it

crimson terrace
#

lynx what would be a better way then

eternal night
#

I mean, an SQL db ?

#

that can properly index your stuff

peak granite
#

i don't want to use a db

crimson terrace
#

yml is pretty fast in reading tbh and im not sure why I would use a database for it

eternal night
#

because a single yaml file does not scale whatsoever

peak granite
#

wdym

eternal night
#

lets say you want to get the balance for a specific player

crimson terrace
#

I dont think its gonna be for a server with thousands of players

eternal night
#

oh

eternal night
#

Well, for any player you will have to read the entire file / keep it in your servers memory

crimson terrace
#

no

#

i think yml reading times are ideally O(1)

#

cuz its basically a hashmap

eternal night
#

yes then it is loaded and lives in your server memory

#

at which point, you are maintaining a map with an entry for every player that ever joined the server

peak granite
#

so how would i format it

#

have one balance.yml file or

crimson terrace
#

for a small server thats probably enough

peak granite
#

i won't be getting more than 100 players

#

that's a generous amount xD

#

50 i guess

eternal night
#

I mean the question isn't active players

peak granite
#

oh

eternal night
#

it is more, total players that will ever join the server

peak granite
#

doesn't essentials use yml?

eternal night
#

e.g. if after a year you have 50 active players

#

yes

peak granite
#

big servers use essentials

eternal night
#

they have individual yaml files for each player

peak granite
#

oh

#

so i can do that?

eternal night
#

yea, most likely the better decision anyway

peak granite
#

okay, ty

eternal night
#

your balance top is going to be harder however

#

as you will either a) have to loop over all files or b) keep some form of cache for the top

peak granite
#

a is easier

crimson terrace
eternal night
#

possible but again, less efficient, make sure to run it off the main thread (the file reading)

peak granite
#

how do u use threads

crimson terrace
peak granite
#

ty

fast onyx
#

why the sound isn't playing?
this condition is on playerJoinEvent, every other condition on the same event is working but this, not

paper viper
#

what is SoundName

#

you know SoundName has to be a valid sound too

#

it cant be just pig_oink

#

you know

fast onyx
#

it is, lol, its a string

crimson terrace
#

Sound.Somesound is the proper thing you need

paper viper
#

what is it set to currently?

paper viper
fast onyx
#

ORB_PICKUP

paper viper
#

specific sounds

fast onyx
#

im running 1.8 for test my plugin on that version

paper viper
#

You have to add the

fast onyx
#

but its 1.13 api

paper viper
#

minecraft:

#

part

#

behind it

#

then

fast onyx
#

no

#

i didn't

#

my /discord command has a sound with same code and is working

crimson terrace
#

oh i didnt see the sound.valueof() in front

paper viper
#

i have no idea what is going on still tho. just 3 lines of code isnt going to help man

fast onyx
#

you don't need more

paper viper
#

โ“ โ“ โ“

crimson terrace
#

honestly those lines of code look fine. if its not working the error is somewhere else

fast onyx
#

more lines won't help you on nothing, the next lines are another conditions on the same event working properly

fast onyx
#

:thonk:

#

maybe cause im running XSeries? idk?

crimson terrace
#

is the path for the config correct?

fast onyx
#

yep

paper viper
#
  1. We don't know the value of SoundIsEnabled, your configuration file either. Only we can assume.
  2. Can you show me your configuration file
  3. Why are you reluctant to show your other code?
mortal hare
fast onyx
#

it is correct shreb

crimson terrace
#

well its set to false

fast onyx
#

i just set now, when i joined it was on true

paper viper
#

when you ask for help, provide necessary information. we could only assume from that code

fast onyx
paper viper
#

???

#

Also

#

ORB_PICKUP isnt even a valid enum

#

...

#

theres that

fast onyx
#

it is

paper viper
#

If it is, then that means it may work for some legacy version

#

but will not work for future versions

fast onyx
#

well if you don't know what im talking about then don't try to help

fast onyx
#

it's fixed

#

wasn't any config or sound problem

paper viper
#

what was it then?

fast onyx
#

another string was using sound as name

paper viper
#

you see, this is why 3 lines isnt going to help...

fast onyx
#

those string wasn't even on the event

ancient plank
#

I just lost a brain cell

crimson terrace
#

just one? youre lucky

paper viper
#

Yeah lmfao

ancient plank
#

I only had 2 to begin with

peak granite
#

is there any event for entity being damaged as a whole

#

or nah

crimson terrace
peak granite
#

thanks

fast onyx
#

i have another question

#

i just saw a post on bukkit

#

to launch a firewall

#

i tried it and works on command but not on event

#

๐Ÿค”

#

This is on a command

#

and "onCommand" i have this

#

and works

#

works good

#

but

#

i have this on Main

#

and on player join event i have this

#

and is not throwing the firework and any error is shown

ancient plank
#

great use of casting

fast onyx
#

what?

late sonnet
# fast onyx what?

the method for spawn using a .class not need the cast because already return the instance in this .class

fast onyx
#

i understand

#

ty

peak granite
#

how do i get the number of dropped items

#

in all worlds

late sonnet
peak granite
#

yeah

#

dropped items

#

lol

hybrid spoke
#

loop through the worlds and then loop through the entities in those worlds. check if they are instanceof Item

#

or if you just want to have the number of items, use the stream api

late sonnet
#

only need know only works for chunks loaded.. if the item in a unload chunk then the method not return this entity

hybrid spoke
#

he could save the entities in that chunk on unloading

quaint mantle
#

I don't know how to start to make a command, that spawns a npc.

#

in 1.17.1

ancient plank
#

ok what im going to say next is gonna be mind boggling:
Step 1.) learn java ?learnjava
Step 2.) after learning java, learn spigotmc api
Step 3.) success

undone axleBOT
proud basin
mortal hare
#

how can i edit an error there

#

which made me suffer for 3+ hours

#

i don't want others to suffer

#

wtf is shield height

#

and the data in the table is incorrect

#

byte index of dye color for shulkers is 18 not 19

#

i've used protocollib to compare two different shulkers

young knoll
#

Probably how high the top part is

#

Since it moves

mortal hare
#

well its not in the byte field 18

#

it could be 17 tho

#

lemme try

#

this data is really either outdated or incorrect

misty current
#

This is why i prefer using nms

#

Check class, get field names and boom packets

late sonnet
peak granite
misty current
#

With protocol

#

And most of the times it took hours just to figure how it works

mortal hare
#

PacketDataSerializer and some Netty stackoverflow copy pasta taught me how to manipulate those bytes and how the minecraft's protocol works

misty current
#

I've started recently to learn how does it work

oblique wigeon
#

How can I check if a recipe is equal to my custom recipe? I've tried using

e.getRecipe().equals(Main.getHeartRecipe())``` but to no avail...
#

It seems that e.getRecipe() creates a new instance of recipe every time, so theres no real way to compare it

late sonnet
oblique wigeon
oblique wigeon
#

And the PrepareItemCraftEvent doesn't have anything like that either

young knoll
#

You need to check and cast to keyed

#

Iirc all crafting recipes should be keyed

#

But stuff like merchant recipes are not

oblique wigeon
oblique wigeon
# young knoll You need to check and cast to keyed

That would look something like this?

if(!(e.getRecipe() instanceof Keyed)){
            return;
        }
        Keyed recipe = (Keyed) e.getRecipe();
        CraftingInventory inv = e.getInventory();
        this.plugin.getLogger().info("Recipe result is: " + e.getRecipe().getResult().toString());
quaint mantle
#

yโ€™all think that using sb teams to edit a playerโ€™s username wonโ€™t mess up scoreboards?

hybrid spoke
mortal hare
#

yep

mortal hare
#

byte field 17

#

is shield height

oblique wigeon
mortal hare
#

im surprised that it can open that far

#

and the most interesting part is that the hitbox is dynamic

#

that means you can create custom block hitboxes

#

by utilising shulkers

#

neat

ancient plank
#

who would've thought that mojang would put effort into something and give it a dynamic hitbox

#

meanwhile they make it so that when cats sit on a fucking chest, you can't open the chest

mortal hare
#

by utilising this trick you can make armorstand furniture have some sort of simple collision, since shulkers act as blocks (they're fully solid in terms of movement)

torn oyster
#

if i included the spigot api as adependency in a plugin
and then added that plugin as a dependency in another maven project
would the spigot api be added to that maven project? or would i have to do something different to include it

misty current
#

Thats so cursed

#

How high can it go

mortal hare
#

lemme check

misty current
#

I wanna make a shulker force field

chrome beacon
misty current
#

Exactly

#

To block players

#

It's also client side so even better

mortal hare
#

oh hey

#

i made an minecraft invention

misty current
#

Or do u wanna make a pr

chrome beacon
#

Well SirBlobman is the main dev

#

I'm the main support member I do help out

misty current
#

Ah kk

#

Too bad shulkers are not in 1.8

chrome beacon
#

Maybe it's time to let it die

misty current
#

I'd have used them to do something similar for sure

crisp kiln
#

hey i need help with nms

#

so basically

#

i find that PathfinderGoalNearestAttackableTarget

#

makes the EntityWolf get the red eyes

#

but when i looked at the PathfinderGoal all I see is the setGoalTarget

fast onyx
#

Can I put the lore of an item using getStringList?

crisp kiln
#

but then I cant find anything that uses the .setAnger function

lavish hemlock
#

angreyBoi = true

ancient plank
#

angrey

#

cute

crisp kiln
#

i want to set a target without making the wolf angry

#

is that possible

mortal hare
#

seems the highest it can go is 160 units

#

a.k.a 2 meters

lavish hemlock
#

angreyBoi = false

mortal hare
#

2 blocks

chrome beacon
#

Ow

crisp kiln
mortal hare
#

since its a byte value

#

the range is max 255

crisp kiln
mortal hare
#

but some other values seems to be used for animations

#

going backwards

#

its weird

lavish hemlock
mortal hare
#

like whenever i set it to 200 its lower than 160

crisp kiln
#

theres a function in EntityWolf called .setAnger

lavish hemlock
#

just do it

crisp kiln
#

should i run it every tick and set it to 0? xD

#

sounds inefficient tho

mortal hare
chrome beacon
mortal hare
#

not sure about this field yet

#

maybe you can extend it even more

fast onyx
chrome beacon
#

Yes

crisp kiln
#

wdym

fast onyx
#

Thanks

mortal hare
#

wait a minute

#

you can change direction of a shulker too!

#

that means that the hitbox can go horizontally too

chrome beacon
#

Uhhh

#

This could be used for some cool stuff

golden turret
#

i want to automate a process

#
                Process process = runtime.exec("mvn install:install-file -DgroupId=" + groupId + " -DartifactId=" + name + " -Dversion=" + version + " -Dfile=" + file.getAbsolutePath() + " -Dpackaging=jar -DlocalRepositoryPath=" + repository.getAbsolutePath() + " -DcreateChecksum=true -DgeneratePom=true");
                process.waitFor();```
#

but it gives me this error: java.io.IOException: Cannot run program "mvn": CreateProcess error=2, O sistema nรฃo pode encontrar o arquivo especificado (The system cannot find the specified file)

chrome beacon
#

Is maven in your enviromental variables

#

Assuming you're on windows

torn oyster
#

if i included the spigot api as adependency in a plugin
and then added that plugin as a dependency in another maven project
would the spigot api be added to that maven project? or would i have to do something different to include it

grim ice
#

probably added too

chrome beacon
#

You would need to add spigot in the other project

grim ice
#

oh

#

so both of them need the spigot api dependency

chrome beacon
#

Assuming you want to use spigot methods yes

grim ice
#

that makes sense, thanks

chrome beacon
#

Otherwise only lib needs it

grim ice
#

what if u do smth like this

#

the dependency has a method like this:

#

public static ChatColor c(String cc){
return ChatColor.valueOf(cc);
}

#

and u use that method

#

will it work?

chrome beacon
#

Good question I have no idea

#

Try it and let me know ๐Ÿ‘€

grim ice
#

ill try it tmrw then

#

but it would be interesting if it works

chrome beacon
#

Ping me with results

grim ice
#

sure

golden turret
chrome beacon
#

Idk then

#

Try to do it like buildtools

#

It downloads maven in to a folder and launches that

#

So the mvn part will be the full path to the installed maven folder

golden turret
#

hmm

mortal hare
#

sadly this seems to be removed

#

16th byte index - Direction of shulker
17th byte index - Shield height of shulker
18th byte index - Color of the shulker (dye color)

chrome beacon
#

Ah

chrome beacon
mortal hare
#

DataWatcherItem[index=16, value=DOWN, dirty=true]
DataWatcherItem[index=17, value=160, dirty=true]
DataWatcherItem[index=18, value=16, dirty=true]]
^ output from protocollib debug

golden turret
chrome beacon
#

Just one thing that would bother me

#

I have a custom path for .m2

#

That would be ignored

#

Guess it doesn't matter much

mortal hare
#

yep horizontal hitboxes would also work

#

and the magic is that the packet entities have no collision

#

so they can be pushed inside blocks

#

for example you can have invisible slabs

chrome beacon
#

Cool

#

As I said above my plan was to block passable blocks

mortal hare
#

the only problem is that the invisible flag only persist for shulker shell only but not the mob inside it

chrome beacon
#

Yeah

torn oyster
#

if i included the spigot api as adependency in a plugin
and then added that plugin as a dependency in another maven project
would the spigot api be added to that maven project? or would i have to do something different to include it

viscid ember
#
public class BanCommand implements CommandExecutor {
    @Override
    public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {

        if (sender instanceof Player) {
            Player p = (Player) sender;
            if (p.hasPermission("punishments.ban")) {
                if(args.length == 2) {
                    if (Bukkit.getPlayer(args[0]).isOnline()){
                        Player target = Bukkit.getPlayer(args[0]);
                        target.banPlayer("reason");
                    } else {
                        p.sendMessage(ChatColor.GREEN + "Player is not online");
                    }
                } else if(args.length == 1){
                    p.sendMessage(ChatColor.GREEN + "Please provide a reason");
                } else {
                    p.sendMessage(ChatColor.GREEN + "Please provide a player");
                }

            } else {
                p.sendMessage("You do not have the required permission");
            }
        }

        return true;
    }
}```
#

This throws back the error

torn oyster
chrome beacon
#

?paste please

undone axleBOT
mortal hare
torn oyster
torn oyster
#

mk

viscid ember
mortal hare
#

or simply, no it wouldnt add spigot api inside another project

viscid ember
#

Thank you and sorry olivio ๐Ÿ˜„

mortal hare
#

Caused by: java.lang.NoSuchMethodError: 'org.bukkit.BanEntry org.bukkit.entity.Player.banPlayer(java.lang.String)'

#

check your spigot version

viscid ember
#

its 1.17.1

mortal hare
#

and the spigot api version?

chrome beacon
#

banPlayer doesn't exist

viscid ember
#

1.17.1-R0.1-SNAPSHOT this is it right?

mortal hare
#

this doesnt have any methods

#

with the name banPlayer

chrome beacon
#

Yeah Paper only API I'd assume

ornate heart
#

Any way to get a potion's base duration and base level?

viscid ember
viscid ember
#

yeah my bad

chrome beacon
#

It doesn't exist in Spigot

viscid ember
#

me <- ๐Ÿคก

grim ice
#

lol

upper niche
#

bump

grim ice
#

GITHUB IS DOWN

#

LMAO

chrome beacon
spare prism
#

really

upper niche
misty current
#

Nms

chrome beacon
misty current
#

Nbt is not supported by the api

#

For some reason

chrome beacon
#

If you don't know how to use NMS concider looking in to the adventure api

upper niche
#

never heard of nms before
I'm pretty new to plugin development

misty current
#

NbtApi is a fantastic lib for nbt

#

I'd suggest using

upper niche
#

noted

chrome beacon
misty current
#

If you have any issues or question s, the dev is pretty fast to reply

chrome beacon
#

If so use the adventure api it's already included

misty current
#

On his disc

upper niche
#

nope it's running spigot

#

is paper better?

chrome beacon
#

Alright then NBTAPI it is

chrome beacon
misty current
#

I prefer spigot for development

#

More compatible and no pointless deprecations

chrome beacon
#

Since you're on 1.8 you haven't seen the amount of api additions

#

Paper doesn't have pointless deprecations as far as I know

#

There's a good reason for things

misty current
#

I've also developed 1.16/17 plugins and i haven't seen many useful things tbf

ivory sleet
#

breh

misty current
#

They deprecated lore methods and put some that are more annoying imo

chrome beacon
#

Well yeah that's smart

ivory sleet
#

that was for very good reasons tho

chrome beacon
#

^

misty current
#

I like the components tho

ivory sleet
#

so why are you complaining thonk

misty current
#

They're useful

#

My wifi is dying

young knoll
#

The forbidden ๐Ÿ“„

chrome beacon
#

uwu wait...

#

When did they add this

misty current
#

Anyways i mainly prefer spigot for compatibility

#

So i try not to use paper stuff when i can

unreal quartz
lavish hemlock
ancient plank
#

UwU

fast onyx
#

how i can get the item on the first hand?
because player#getItemInHand() is deprecated

fast onyx
ancient plank
#

Get inventory get item in main hand

#

Iirc

fast onyx
#

ok ty

ancient plank
#

Believe it or not, in recent versions, aka the past 5 years, steve has had two hands

fast onyx
#

i know yep

#

Thanks

unreal quartz
#

and alex has 5 hands

ancient plank
#

fun fact, in the oncommand method there's a string[] object of the arguments

young knoll
#

Very fun

hybrid spoke
noble lantern
#

github down?

ancient plank
#

im so helpful today uwu, if my answer solved your question, please mark it with a โœ… reaction! UwU!

hybrid spoke
noble lantern
#

Stupid pc

#

Man that sucks i rly needed to code dive citizens

chrome beacon
#

Anything specific?

ancient plank
#

Time to decompile the jar and read

noble lantern
#

The most recent commit from last night

grim ice
#

its nostalgic seeing this chat ngl

idle grotto
ornate heart
#

How would i get an item stack's base potion effects? (Not the custom ones. I know about PotionMeta#getCustomEffects.)

noble lantern
#

hmm i wonder if jenkins lets me view sources

chrome beacon
#

Probably not

noble lantern
#

ayyy github back

chrome beacon
#

Ah nice

fast onyx
#
ItemStack ItemToRename = p.getInventory().getItemInMainHand();
ItemMeta ItemToRenameMeta = ItemToRename.getItemMeta();
ItemToRenameMeta.setDisplayName(ChatColor.translateAlternateColorCodes('&', args[0]));
#

this isn't renaming the item

#

am doing well?

#

PD: no error on console

chrome beacon
#

You forgot to set the meta again

noble lantern
#

^

chrome beacon
#

Also please lowerCamelCase your variable names

noble lantern
#

oop sorry for ping

chrome beacon
#

No worries

ancient plank
#

pascal_case when Kappa

lavish hemlock
#

popularize snake-case

#

or actually wait is this snake_case

#

and this is kebab-case

#

idfk

mortal hare
#

Minecraft's protocol really makes me cringe

noble lantern
#

Lets_Just_All_Get_Along_here

mortal hare
#

cmon

lavish hemlock
#

cases-dont-make-sense

mortal hare
#

there's A FUCKING FIRE flag in inherited Entity CLASS

#

why would I want another flag

#

for no reason

#

but no

#

i need to extend the class

#

and reimplement this

#

shit

fast onyx
#

and how i can set again the meta

young knoll
#

I imagine a blaze could technically be on fire and then not on fire

chrome beacon
mortal hare
#

damage is controlled by the server

young knoll
#

Yeah they could have just used the fire ticks

#

ยฏ_(ใƒ„)_/ยฏ

mortal hare
#

or this

#

Why not just one byte

#

with bitmasks

#

they do utilise bitmasks in other classes

#

but this madam is the exception

proud basin
chrome beacon
#

Show your build.gradle

proud basin
#

why there isn't a need?

chrome beacon
#

Also github down

proud basin
#

ah that's why then prob

#

I'm not able to load up the website

#

eta on it going back up?

eternal night
#

sadness

chrome beacon
ancient plank
#

madam

fast onyx
#

If args[0] are null, then this happens, what is te if statement for disable this? if(args[0] === null) ?

#

i mean, if there is no args[0]

lavish hemlock
#

check length

visual tide
#

check if the length is 0

young knoll
#

args.length

lavish hemlock
#

not indices

noble lantern
#

So apparently

#

This is a thing on github now...

lavish hemlock
#

github is down

noble lantern
#

i know, but that pony gives me the chills

lavish hemlock
#

that's a unicorn

#

actually wait

#

eh I guess unicorns can be ponies

noble lantern
#

yeah defo unicorn i was just too lazy to type it all out

#

i wish discord had tab completion features for texting

lavish hemlock
#

I mean

#

have you tried

#

a decent keyboard app?

fast onyx
lavish hemlock
#

Gboard gives me suggestions

lavish hemlock
young knoll
#

If the length is 0 then there is no args[0]

lavish hemlock
#

length is always 1 higher than the max index if it isn't 0 (as 0 means there is no valid indices)

fast onyx
#

if(args.length = 0)
dym that?

noble lantern
#

if args.length == 1 args[0] is almost never null

chrome beacon
#

Not really

#

Ow edited

noble lantern
#

You wouldnt get IndexOutOfBounds at least

#

but it can be null yeah

chrome beacon
#

An array can contain null values. The args won't though

quaint mantle
#

How would I iterate through blocks at around a player

mortal hare
#

thicc creeper

tardy delta
#

Sad boi

proud basin
#

Do you guys know if you can use ShadowJar with maven?

chrome beacon
#

Use the maven shade plugin

quaint mantle
#

He's not making a plugin I'm afraid

proud basin
#

^

chrome beacon
#

And?

quaint mantle
#

Oh no he's right Tony

proud basin
#

is he though

quaint mantle
#

you can just use the shade plugin, it's not just for spigot

proud basin
#

I have no clue how to do that

young knoll
#

Interwebs

ivory sleet
quaint mantle
#

also that

proud basin
#

well

#

its a bit late

young knoll
chrome beacon
#

Paperweight

ivory sleet
#

You can already convert!

proud basin
#

can I really though

ivory sleet
#

idk if its any good

noble lantern
#

yall it took 8 hours and asking the plugin authors for a feature addon

young knoll
#

But paperweight isnโ€™t spigotttttt

noble lantern
#

But You can finally trade with Citizens2 npcs

chrome beacon
#

:o github codespaces went down again

noble lantern
#

Im just lucky to view a page every few mins

young knoll
#

But if I use paperweight I might accidentally use paper API methods

noble lantern
quaint mantle
proud basin
chrome beacon
noble lantern
#

With NPC's i can just dump the villager trade data to the NPC and let minecraft handle the save data

chrome beacon
#

Making your own NPCs take time

noble lantern
#

I mean tbf

chrome beacon
#

Citizens makes it easy

noble lantern
#

Between havin to get Citizens fixed or making my own NPC

#

it would of taken about the same length of time

#

If the authors had the meta deta tag that allowed trading already i wouldnt of been through the whole shuffle xD

noble lantern
#

I wanted to make this whole plugin where i didnt need data files in my own plugin

quaint mantle
#

how long does it normally take to learn java?

young knoll
#

That varies greatly

chrome beacon
#

^

quaint mantle
#

without learning apis

noble lantern
#

if you have no previous programming knowledge, ide say more than a month for bare basics if you actually dedicate time to it

quaint mantle
#

just java

young knoll
#

Some people have prior knowledge of OOP, some donโ€™t

#

Some are just faster learners

noble lantern
#

^

#

Fast learning really is a huge factor, some people are just naturally good with java xD

quaint mantle
#

burch how long have u been learning java?

proud basin
#

๐Ÿ˜ฎ I got it wokring

noble lantern
quaint mantle
#

when u say bs do u mean u dont like it anymore?

fast onyx
#

can i set lore with a single string and not a stringlist?

eternal night
#

just wrap the single string in a list

#

๐Ÿ‘

chrome beacon
#

^

ivory sleet
#

Collections::singletonList or List::of could suit you

young knoll
#

Collections.singletonList iirc

#

Or arrays.asList

ivory sleet
#

yeah altho it creates an extra array

fast onyx
#

bu-

#

i want args[0]

#

make this a list

young knoll
#

Then use the aforementioned methods

fast onyx
#

Collections.singletonList(ChatColor.translateAlternateColorCodes('&', args[0])));

#

the IDE suggested me that

ivory sleet
#

looks good

young knoll
#

Sure

fast onyx
#

great

noble lantern
fast onyx
#

Thanks everybody

young knoll
#

Machine learning is gonna replace us all

noble lantern
#

Soon it will code for us

#

The people who make programs that code more programs will be richer than those who own the worlds oil reserves

chrome beacon
young knoll
#

It doesnโ€™t run on eclipse

#

So im safe

chrome beacon
#

But your code is on github

young knoll
#

Fuck gotta switch to stash

chrome beacon
#

So it's not safe from being put in to the copilot

young knoll
#

I wonder if an eclipse addon exists for it

chrome beacon
#

Maybe idk

#

I use Intellij

lavish hemlock
#

IDEA FOR THE WIN WOOOOOOOO

#

IT'S ALL ABOUT THE INTELLIJ

fast onyx
#

if(p.getInventory().getItemInMainHand() == null) {

#

this condition is not working for some reason..

#

๐Ÿ˜ฆ

chrome beacon
#

Show entire code and what line is the error on

ancient plank
#

I can't help but notice your class name is full lowercase

#

My head hurts

chrome beacon
#

If it's on that line p is null

fast onyx
#

it gives error on the line that change the lore, when the item is air
so the condition is not working

#

maybe i need to put return false;?

#

to stop executing code?

olive valve
fast onyx
#

yes

#

Line 48: ItemToReloreMeta.setLore(Collections.singletonList(ChatColor.translateAlternateColorCodes('&', args[0])));

#

It only happens when the item in hand is air

eternal night
#

air items do not have item meta

#

you need to null check this

fast onyx
#

i already did that but is not working

eternal night
#

additionally, variables being with a lowercase letter

olive valve
#

check if the item meta is null

fast onyx
#

if(p.getInventory().getItemInMainHand() == null) { p.sendMessage(ChatColor.translateAlternateColorCodes('&', config.getString(InvalidItem))); return false; } ItemStack ItemToRelore = p.getInventory().getItemInMainHand(); ItemMeta ItemToReloreMeta = ItemToRelore.getItemMeta(); ItemToReloreMeta.setLore(Collections.singletonList(ChatColor.translateAlternateColorCodes('&', args[0]))); ItemToRelore.setItemMeta(ItemToReloreMeta); p.sendMessage(ChatColor.translateAlternateColorCodes('&', config.getString(Relored)));

eternal night
#

if(p.getInventory().getItemInMainHand() == null) { is not null checking the item meta

#

you are null checking the item

fast onyx
#

mmm

#

understand

eternal night
#

also please follow java conventions

#

๐Ÿ™

fast onyx
#

variables doesn't matter if they are on upper or lowercase

#

or at least i think

eternal night
#

Yea but the conventions do not agree with you

chrome beacon
#

While both do work following conventions is best

eternal night
#

if you want to read through that

olive valve
#

it doesnโ€™t need to be followed but it is best

hollow spindle
#

Making threads is okay right? (For discord, not the NMS threads)

chrome beacon
#

Yes

fast onyx
chrome beacon
#

Threads are good

hollow spindle
#

Ah awesome

chrome beacon
ivory sleet
#

threads yummy :p

chrome beacon
#

You want the opposite

eternal night
#

you should store the itemmeta in a variable

#

besides olivios suggestion/fix

fast onyx
#

if null
sendmessage saying cant rename air and return false

#

?

chrome beacon
#

How was I supposed to know what what below

olive valve
fast onyx
#

don't worry is not your fault

hollow spindle
#

Dynamic listeners for classes?

golden turret
#

any way to change the actionbar height?

#

or can it be done with texture?

tardy delta
#

Textures maybe

golden turret
#

how

quaint mantle
#
FallingBlock b = world.spawnFallingBlock(block.getLocation().add(0, 2, 0), block.getType(), block.getData());
b.setDropItem(false);
Core.i().getServer().getScheduler().runTaskLater(Core.i(), () -> b.setVelocity(new Vector(0, 1, 0)), 2L);```Anyone got a clue as to why my falling block isn't being launched upwards?
olive valve
#

maybe itโ€™s the 1 in the Y axis maybe it should be -1

quaint mantle
#

The blocks spawn fine, i added 2 to the coordinates so I could see them fall down

#

and so it does, they just fall down & their velocity doesnt change to the one I set

eternal oxide
quaint mantle
#

Because since it didn't work when I didn't delay it, I thought maybe I had to delay it by a tick

#

Thought maybe it hadn't fully spawned yet or something

eternal oxide
#

this works fine ```java
public class BlockCannon implements Listener{

@EventHandler
public void onLeftClickAir(PlayerInteractEvent event) {
    
    if (event.getHand() != EquipmentSlot.HAND
            || event.getAction() != Action.LEFT_CLICK_AIR
            || event.getItem() == null
            || !event.getItem().getType().isBlock()) return;
    
    Player player = event.getPlayer();
    Location loc = player.getLocation();
    Vector direction = loc.getDirection();
    Material item = event.getItem().getType();

    FallingBlock entity = player.getWorld().spawnFallingBlock(loc.add(direction), Bukkit.createBlockData(item));
    entity.setVelocity(direction.multiply(2));
}

}```

#

a block cannon

somber hull
#

people have been telling me to use sql rather than just making a data.yml

#

can anyone point me in the direction on where to start on that?

ivory sleet
#

learning sql would be utterly crucial

fast onyx
#

how i can get all items reparables from the player inv?

somber hull
quaint mantle
# eternal oxide this works fine ```java public class BlockCannon implements Listener{ @Even...

https://gyazo.com/6d088ad65b6f80e492e8f77c2a3bab76

for (int x = radius; x >= -radius; x--) {
    for (int y = radius; y >= -radius; y--) {
        for (int z = radius; z >= -radius; z--) {
            Block block = bottomBlock.getRelative(x, y, z);
            if (block.getRelative(0, 1, 0).getType() == Material.AIR) {
                FallingBlock b = world.spawnFallingBlock(block.getLocation().add(0, 2, 0), block.getType(), block.getData());
                b.setDropItem(false);
                b.setVelocity(new Vector(0, 1, 0));
            }
        }
    }
}```
ivory sleet
#

once you've understood sql

#

go ahead and try to do something with sql using java

#

and ofc I'd suggest learning about concurrently dispatching code in Java

#

(async)

eternal oxide
ivory sleet
#

you see

#

operating with databases, where you need to rely on a connection

somber hull
#

Doesnt async just mean like at the same time as smthng

ivory sleet
#

and talking with io devices can be expensive

#

yes

somber hull
#

thanks elgar

#

the second one doesnt work tho

eternal oxide
#

fixed

quaint mantle
somber hull
#

ahh shit

#

i gtg

ivory sleet
#

Asynchronous -> things do not behave in a synchronized manner, can happen single threaded, the important part of asynchronous is that it disregards the linear code flow

Concurrent -> a bit more specific where things run on different threads

Parallel -> things can run on different threads, on top of that things might happen on different cores or cpus which means two things can be done truly at the same time

fast onyx
#

how i can get all items reparables from the player inv?

eternal oxide
quaint mantle
#

no i'm not

#

Here's the clip

eternal oxide
#

then attempt increasing yrou velocity. As you can see in teh code I provided it works perfectly

#

just add the class I gave you and register its listener. Its a clean example

#

The only thing that can stop your falling block is a collision or too weak a velocity

proud basin
quaint mantle
fast onyx
#

how i can get all repairable items from a player inv?

young knoll
#

Loop and check if their meta is repairable

fast onyx
#

example?

misty current
#

do a foreach with player's inventory contents

#

get meta

#

iirc you can check if the meta is instanceof Damageable

young knoll
#

Correct

fast onyx
#

i tried 40 ways and can't found the correct way

#
for(int i = 0; i < p.getInventory().getSize(); i++) {
            p.getInventory().getItem(i).setDurability((short) 0);
            if(i == p.getInventory().getSize()) break;
        }
#

this?

misty current
#

for(//player inventory contents){
if(item.getmeta instanceof Damageable){

#

isn't setdurability deprecated?

fast onyx
#

it is

misty current
#

then why do you use that

#

i told you

#

you need to check if the meta is instanceof Damageable

#

then cast the meta to Damageable

#

and use its methods

fast onyx
#
for(p.getInventory().getContents())
if(item.getMeta instanceof Damageable) {}
#

this?

misty current
#

that's not how you do a foreach

#

mine was pseudo code

fast onyx
misty current
#

learn java

fast onyx
#

i learn when people that know teach me

misty current
#

too bad im not teaching you

fast onyx
#

im not just coping and pasting

young knoll
#

There are resources for that

misty current
#

go google it

young knoll
#

?learnjava

undone axleBOT
misty current
#

what you said is one of the most entitled sentences i've ever read

#

why do you expect someone to teach you java?

fast onyx
#

help-development channel

  • asks for help *

learn java

#

very helpful

eternal night
#

๐Ÿ˜‚

misty current
#

dude

#

omg