#help-development

1 messages · Page 2068 of 1

glossy venture
#

the model

#

so it has something to do with the way its saving the files

vocal cloud
#

Which is where

#

I want to avoid building all of this junk and get to the actual problem

#

I assume this?

glossy venture
#

thats the code for building all json files

#

so the mcmeta and models

#

in this case

vocal cloud
#

Which is what's causing the issue right?

glossy venture
#

i think so

#

i dont know for sure

#

because i dont even know what the issue is really

granite owl
#

yesterday ive been called out for asking about the Command api

#

so

vocal cloud
granite owl
#

how can i instantiate a new command instance from the PlayerCommandPreprocessEvent callback using only the string it provides(and yes im not tarded enough to ask for how to split a string, thats already done)

vocal cloud
#

It's in the MC logs

granite owl
#

so i can use the getAliases

glossy venture
granite owl
#

xD

vocal cloud
glossy venture
#

?

vocal cloud
#

Your dir looks like this

#

but everyone seems to have everything in the MC folder

#

That might not be the issue. However, I can't get this setup to work so shrug1

glossy venture
#

this guide uses it though

#

on 1.18.2

#

so it is possible

#

and it would make my life a lot easier

vocal cloud
#

Let me record a video

#

1s

glossy venture
#

k

granite owl
#

how can i cast the command into a org.bukkit.command.Command instance from the ```java
public void onPlayerCommand(PlayerCommandPreprocessEvent event)
{
}

#

with obviously ```java
String[] args = event.getMessage().split(" ");

vocal cloud
#

@glossy venture Hey

#

Dude you're gonna kill yourself over this one

#

Get a glass of water and take a seat

#

Please use the logger more often. Your folder is misnamed. You named it items it's supposed to be item

#

sigh.

glossy venture
#

what folder?

vocal cloud
#

try it

#

rename it from items to item

glossy venture
#

k

#

but thats not the problem

#

it doesnt load the model

vocal cloud
#

It is the problem?

#

Just do it

#

Unless you're saying that there is another problem in which case we're going in circles here

glossy venture
#

its already called item though

vocal cloud
#

The one you sent me wasnt

glossy venture
#

it should be

#

i committed that long ago

vocal cloud
#

So what exactly is the issue here then

glossy venture
#

pull new version

vocal cloud
#

send it

glossy venture
#

just git pull -f

vocal cloud
#

I'm not pulling the project I don't even know how to set it up

glossy venture
#

oh

vocal cloud
#

Just generate another one that's broken or w/e

glossy venture
#

k

vocal cloud
#

I checked this one

glossy venture
#

one sec

vocal cloud
#

Cause it doesn't help if you're sending me stuff that is out of date

glossy venture
#

yeah give me a sec

#

the gradle thing is taking long

vocal cloud
#

I'm gonna take a breather brb. IRL stuff is bleeding into my messages

tender shard
#

I'm using MiniMessage, by parsing the strings from the config into (Minimessage) Components. However, I also want to replace placeholders, etc. So I saw the followingpossible ways to do this:

  1. Only turn the String into a Comonent AFTER I have replaced placeholders. That however means I have to parse the message everytime I send it
  2. Using some kind of custom Tag Resolver for MiniMessage, but not sure if thats even possible or if that also only gets called at the beginning. Also placeholders would have to be inside <tags>
  3. Using a TextReplacementConfig, but that means I'll have to provide a Regex Pattern to placeholders which gets nasty when I have nested placeholders :/

Does anybody have any idea on how to efficiently use Placeholders with MiniMessage? 😦

glossy venture
vocal cloud
glossy venture
#

bruh filebin storage is full

#

like the whole websit

#

e

#

but here is new generated pack

vocal cloud
#

Alright and the issue is?

rough drift
#

can i check if a PDC has a key of ANY type

vocal cloud
grim ice
#

for(PersistentDataType type : PersistentDataType.values()) {
if(container.has(key, type) return true;
}

vocal cloud
grim ice
#

custom values?

rough drift
#

custom PDC types

grim ice
#

you mean custom PDTs?

#

o

#

you can check for that yourself then

rough drift
#

also

#

its not an enu

#

enum

grim ice
#

it is

glossy venture
rough drift
#

nope

glossy venture
#

then it has to be an issue with my minecraft

rough drift
#

well imma just check INTEGER

#

its fine

grim ice
#

OH RIGHT

#

ITS NOT AN ENUM

#

THEYRE STATIC FIELDS

#

BRUH

vocal cloud
rough drift
#

yeah, but why

grim ice
#

eh its fine

glossy venture
grim ice
#
Sets.of(PersistentDataType.BYTE, PersistentDataType.BYTE_ARRAY, PersistentDataType.DOUBLE, PersistentDataType.FLOAT, PersistentDataType.INTEGER, PersistentDataType.INTEGER_ARRAY, PersistentDataType.LONG, PersistentDataType.LONG_ARRAY, PersistentDataType.SHORT, PersistentDataType.STRING)```
#

@rough drift

glossy venture
grim ice
#

you can add your custom ones with them if u need to

glossy venture
#

did you just put in the resource pack i sent you?

#

without modifying it?

rough drift
#

I'll just check integer

#

all of the items will be created trough my method

#

so i can just add it as integer

#

I really just use PDC to store flags

glossy venture
#

uh oh

#

minecraft logs

chrome beacon
#

You were using Fabric, have you tried Vanilla

glossy venture
#

only 1.18.1

#

lemme try

vocal cloud
#

Now it's not. YanSigh

glossy venture
#

tf

#

im so confused

chrome beacon
#

Did it work?

granite owl
#

why does this only return icanhasbukkit

#
Map<String, String[]> Commands = Bukkit.getCommandAliases();
        
        for (String key : Commands.keySet())
        {
            Bukkit.getPlayer("TheTimeee").sendMessage(key);
        }
glossy venture
chrome beacon
glossy venture
#

nope

#

still doesnt work

granite owl
#

except for this Helper method

#

i guess

#

i mean i basically want this method but for all commands not just plugin registered ones Bukkit.getPluginCommand(null);

glossy venture
#

search the command map

#

if youre using paper i believe you can just do like Bukkit.getCommandMap()

#

otherwise you have to use reflection to get the field from craftserver

vocal cloud
#

How are you zipping the files?

glossy venture
#

bruh filebin stupid

granite owl
#

hm

vocal cloud
glossy venture
#

winrar reads it fine

#

wait lemme put the unzipped folder

vocal cloud
#

Java is zipping it poorly

glossy venture
#

and see

vocal cloud
#

Something it's doing makes it unreadable

glossy venture
#

oh it works

#

now

#

so the zipping doesnt work

#

bruh

vocal cloud
#

Yup

glossy venture
#

welp

#

time to rework the zipping

vocal cloud
#

kek

vocal cloud
# glossy venture time to rework the zipping
<dependency>
    <groupId>org.zeroturnaround</groupId>
    <artifactId>zt-zip</artifactId>
    <version>1.15</version>
    <type>jar</type>
</dependency>
ZipUtil.pack(new File("pack"), new File("pack.zip"));
glossy venture
#

ah

#

lemme try

glossy venture
vocal cloud
#

I tried this on the files and it zipped and it worked

glossy venture
#

nice

#

thanks

vocal cloud
#

you just zip the overall directory and it seems to work. Maybe it's because they've been unzipped idk

#

shrug1 try it and see moment

glossy venture
#

ok the library is kinda huge so ill see how they do it and base it off that

#

i dont need 99% of the features

glossy venture
#

i didnt have time then

#

but i did it now

#

and it works

#

thanks

vocal cloud
#

That's good

fervent gate
#

Using SQL, when executing a select statement and there is no record found, does it return null?

unique eagle
#

Hello i search to use multiple version of spigot in gradle 😢

#

i have some class with the name NMSHandler_1_18_R2 and the version

#

but is all version in this class like 1.13 to 1.18 not only 1.18

#

but how to add in my project ?

granite owl
#

ik prob dumb question but ive seen alot of ppl parse commands using if else if

#

isnt this much more efficient

#
public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args)
    {
        switch (cmd.getName().toLowerCase())
        {
        case "sudo":
            return Ranks.cmdSudo(sender, args);
        case "desudo":
            return Ranks.cmdDesudo(sender, args);
        case "rank-create":
            if (args.length == 1)
            {
                return Callbacks.getUUIDByName(sender, args[0]);
            }
            break;
        case "admin-uuid":
            if (args.length == 1)
            {
                return Callbacks.getUUIDByName(sender, args[0]);
            }
            break;
        case "admin-inv":
            if (args.length == 2)
            {
                return Callbacks.getInvByName(sender, args[0], args[1]);
            }
            break;
        }
        
        return false;
    }
#

since the strings get parsed into their sha-1 code by the JRE anyway

echo basalt
#

premature optimization

#

makes decompiling it a pain in the ass

#

Also if you really want to optimize things

#

a huge switch statement is far worst than looking by hashcode on a map

tardy delta
#

i use switch 👉👈🥲

young knoll
#

I mean this is a command

#

You can just give each one it’s own executor

glass solstice
#

please don't judge me with this lol, I am a complete beginner, I know nothing about spigot development, I barely know any java. I tried to make a very simple plugin that just gives players effects on join (night vision and speed) after a slight delay, this is what I copied from a guy on youtube and a random article lol:

import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.player.PlayerJoinEvent;
import org.bukkit.potion.PotionEffect;
import org.bukkit.potion.PotionEffectType;
import org.bukkit.plugin.java.JavaPlugin;

public class Main extends JavaPlugin {
    


    
    @EventHandler
    public void onPlayerJoin(PlayerJoinEvent event)
    
    
    {
        try {
            Thread.sleep(700);
        } catch (InterruptedException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }
        Player player = (Player) event.getPlayer();
        
        player.addPotionEffect(new PotionEffect(PotionEffectType.NIGHT_VISION, 999999999, 1));
       player.addPotionEffect(new PotionEffect(PotionEffectType.SPEED, 999999999, 1));
       }
}```
#

I probably have done something horribly wrong, please have mercy on me 😭

minor vapor
#

oh my, please do not sleep the main thread when a player joins

glass solstice
#

I'll take a look at that, thanks

young knoll
#

?scheduling

undone axleBOT
rough drift
#

I have a velocity plugin, i need to use JDBC driver, do i have to shade it in or can i use smt like spigot's libraries in plugin.yml?

granite owl
crisp steeple
#

and the class “main” isn’t even a listener so that eventhandler won’t ever trigger

river oracle
#

👀 if you wanna stop the main thread just use world builder atleast you get a new cool world out of it

glass solstice
solemn valley
#

Oof, okay

#

Thank you for you help 👍

#

Wonder why it works with commandblocks

#

NMS Manipulation wouldn't work either right?

worldly ingot
#

I don't think it does work with command blocks. Or at least it kicks off the passengers

#

Last I recall, at least. However this is like 7 year old 1.8 knowledge

solemn valley
#

Meaning it'll give you smooth movement

#

So it does work with Command blocks but I guess not with Spigot

#

Welp, back to the drawing board

kindred valley
#

how can i simply make kit system

glossy venture
#

think its just both 0

shrewd sentinel
#

I am not able to compile because of me using a jar dependency instead of maven dependency (Maven doesn't exist)

brave sparrow
#

Forward is relative

#

North and perpendicular to the ground is 0,0

glossy venture
#

oh

brave sparrow
#

There is no “forward”

#

Each yaw angle corresponds to a cardinal direction

#

What are you meaning by “forward” in this case @quaint mantle

kind coral
#

it can't find the artifact?

#

i want nms

brave sparrow
#

have you run buildtools?

#

like what

kind coral
brave sparrow
kind coral
#

is it mapped with mojang mappings tho?

brave sparrow
#

figure out what cardinal direction the head points in

#

the head is pointing in North, East, South, West, or some combination of two of those

#

then use the yaw corresponding to that direction

kind coral
visual tide
brave sparrow
#

both

visual tide
#

oH

#

and bukkit isnt affected at all?

brave sparrow
#

bukkit didn't get DMCA'd

#

lol

#

no

#

craftbukkit got DMCA'd

#

but bukkit doesn't rely on any mojang code, so there was nothing to DMCA

visual tide
#

i mean spigot is still distributing bukkit

fierce quail
#

When importing that code, maven doesnt recognize it and the owner of a 200+ star repo CANT EVEN PROVIDE A COMILED VERSION.

visual tide
fierce quail
#

WHY

fierce quail
# visual tide

No way, id didnt see that BECAUSE IM TOO STUPID TO READ THE README

visual tide
#

is that irony

#

i cant tell

fierce quail
#

YOU NEED MAVEN AND INTELLIJ DOESNT ALLOW IT IN AN FROM OTHER SOURCES IMPORTED CODESTUFF

fierce quail
visual tide
#

?paste your pom.xml

undone axleBOT
fierce quail
#

What POM? Just throw that stuff into IntelliJ

fierce quail
#

For real, Spigot/paper/Bukkit couldnt implement such a feature in 4+ years...

brave sparrow
#

maven?

fierce quail
visual tide
fierce quail
#

The plugin requres it

brave sparrow
#

you realize they use maven, right?

fierce quail
#

Yes

brave sparrow
#

add their repo and add their dependency

#

to your POM

fierce quail
#

You still need it as a plugin in the plugins folder afaik

visual tide
#

no

brave sparrow
#

naw

visual tide
#

shade it

brave sparrow
#

^

visual tide
#

but reLOcaTE

hasty prawn
#

or use the libraries feature thing

fierce quail
#

Thanks

visual tide
hasty prawn
#

oh maybe idk

#

I've never used it LOL

visual tide
#

anvilgui is on codemc

hasty prawn
#

well that's depressing

#

Shading it is

brave sparrow
#

libraries only works for central yeah

#

and you're supposed to use it for large non-minecraft APIs, not minecraft-specific stuff

visual tide
#

local :peepogrin:

hasty prawn
#

I think JDA is on maven central anyways

visual tide
#

it is

brave sparrow
#

that's the general idea, yeah

#

or something like okhttp or whatnot

glad shore
#

Is there a playerworldchange event, which is called before the player has changed its world?

modern vigil
#

PlayerTeleportEvent

fervent gate
#

How can an instance of a class that extends JavaPlugin be null if it is instantiated?

java.lang.NullPointerException: Cannot invoke "me.cosmic.farming.Farming.getConfig()" because "this.plugin" is null
undone axleBOT
fervent gate
#

ah shit

#

sorry

chrome beacon
#

Set your variables in the constructor

fervent gate
#

done, lemme test

quaint mantle
#
ItemStack playerHead = new ItemStack(Material.PLAYER_HEAD, 1);
ItemMeta meta = playerHead.getItemMeta();

meta.setDisplayName(list.get(i).getName());

why does this set the meta to the players display name

delicate cargo
#

how do i set an entities max and current hp

cinder karma
#

so, adding a listener for a PlayerTeleportEvent seems to fire the event 9 times for a basic /tp command...is there a reason for that? All 9 events seem to be identical, and I know from sending a message to the Logger about the event, and the message shows up 9 times

#

@EventHandler public void onPlayerTeleport(PlayerTeleportEvent event) { Bukkit.getLogger().info("Player " + event.getPlayer().getName() + " is in world " + event.getPlayer().getWorld() + " and is going to " + event.getTo()); }

#

I appreciate that, I'll likely use that instead...but is there still a reason I got 9 console messages?

crimson terrace
#

?learnjava

undone axleBOT
cinder karma
#

just to be clear, you're saying I need to be proficient at Java to understand why the message shows up 9 times?

#

oh, I was worried I was in over my head there

#

oh interesting...

#

well, as I'm going to use the other event anyway, I guess it's more an academic point now lol

#

but thank you for the assistance 🙂

fervent gate
#

Is there a way to get the Persistentdatacontainers of offline players?

sullen fox
#

Code:


package me.rudiemc.maintenance.Commands;

import me.rudiemc.maintenance.Maintenance;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import org.bukkit.plugin.Plugin;

public class ToggleMaintenance implements CommandExecutor {


    @Override
    public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {

        Plugin plugin = Maintenance.getPlugin(Maintenance.class);
        String prefix = ChatColor.translateAlternateColorCodes('&', plugin.getConfig().getString("Prefix"));
        Player p = (Player) sender;

}
}
undone axleBOT
delicate cargo
#

The method getAttribute() is undefined for the type Entity

#

i dont understand

crimson terrace
delicate cargo
#

how would i do that

crimson terrace
#

((Zombie)entity).getAttribute() I think

delicate cargo
#

no

#

i mean

crimson terrace
#

well obviously you would check before

delicate cargo
#

how do i use an entitytype to cast?

#

wym

crimson terrace
delicate cargo
#

spawnEntity

undone axleBOT
delicate cargo
#
public void spawn(Location spawnLocation) {
  Entity entity = spawnLocation.getWorld().spawnEntity(spawnLocation, mainMob);
}
#
EntityType mainMob = null;
crimson terrace
#

just wanted to be clear XD

delicate cargo
#

set when instanciated

#
public CustomEntity(String name, float maxHp, float damage) {
    this.name = name;
    this.maxHp = maxHp;
    this.damage = damage;
}
#

not random

#

but different

#

yes but how

#

k

#

...

#

thats a terrible way

crimson terrace
#

what you mean

delicate cargo
#

id have to hardcode each and every individual one

crimson terrace
#

not really

delicate cargo
#

copy and pasting over and over

tardy delta
#

?di

undone axleBOT
crimson terrace
#

EntityType.valueOf() exists

rough drift
#

Its an issue I am facing

#

so ye

cinder karma
#

When working with teams, it has the method addEntry(string Entry). What...is an entry? And how do you turn a Player into a string to add it to the Team? Is the String supposed to be the UUID or something? I'm not sure what an "entry" is

fervent gate
#

And if they're not?

cinder karma
delicate cargo
#

so anyway is there a better way than manually hardcoding?

rough drift
#

yes

delicate cargo
#

as hardcoding fans are clowns

fervent gate
#

What for example if I needed to open an offline player's inv?

crimson terrace
delicate cargo
#

morice

#

is there a possible softcoding method?

#

any

#

any entity which exists

crimson terrace
#

LivingEntity

#

that would fix it

#

that has the getAttribute() method

desert tinsel
#

how to get a player from a UUID?

crimson terrace
#

player.getUniqueID()

#

oh from a uuid, sorry

desert tinsel
#

ty

delicate cargo
#

okay ty

crimson terrace
#

you should always check wether it actually is a living entity tho

#

otherwise youll get tons of errors if it doesnt tell you its an unchecked cast before

#

item

#

dropped items arent

tall dragon
#

arrows

#

falling blocks

crimson terrace
#

lots of things

#

are zombies really alive? kek

#

aliven't

delicate cargo
#

question

crimson terrace
#

ask

delicate cargo
#

i dont need to re-set entity

#

do i?

crimson terrace
#

not sure what you mean

delicate cargo
#

entity = (Entity) livingEntity

#

example

crimson terrace
#

that works

delicate cargo
#

do i need to do it

crimson terrace
#

but why would you want ot

tall dragon
#

not sure why u would cast a living entity to an entity

crimson terrace
#

any living entity is an entity and thus has the same methods I think.

tall dragon
#

correct

crimson terrace
# delicate cargo i dont need to re-set entity

you could just cast it using entity = (LivingEntity) entity after checking wether it actually is a living entity. its still the same entity you have saved in that object, you just specified it

rough drift
#

minecarts arent iirc

rough drift
crimson terrace
#

huh

#

never seen that syntax before

#

ah thats why. I have to use java 11 for projects, its a pain XD

#

instanceof I know, just not the LivingEntity livingingEntity part

#

oh I see

crimson terrace
#

because its old enough for most bugs to have been ironed out

#

says my professor

crimson terrace
#

ik

rough drift
#

java does not add features and release

#

they do bug tests

#

they are really really cautious

crimson terrace
#

well, cant really argue with someone who grades your projects, can ya

rough drift
#

nah not really

#

they are pretty dum

#

they should use j17 rather than 11

#

or even j18 or j19

#

there are releases for them alr

crimson terrace
#

i dont really care, since I still do pretty good with coding projects, no matter the java version

rough drift
#

alr

smoky oak
#

What's this field for in 'Share Project On GitHub'?

drifting coral
#

Hi, anyone know how I'd need to go about making a player use the currently held item, I have gathered that I'll need to use packets but am not fully sure how to go about doing it

midnight shore
#

Hi! i have a question

#

Why are the "pods" non-water blocks still considered not-air blocks?

#

like why is this block considered a not-air block?

kindred valley
#

how can i make simple a simple kit class

kind hatch
frigid rock
#

yo, how do you cast a block into an itemstack?

#

like i want to turn a block into an itemstack, but if i cast it gives me an error

midnight shore
#

get the block material then create an itemstack with that material

kind hatch
frigid rock
#

oh yeah, thanks!

midnight shore
#

But why did they use CAVE_AIR instead of plain regular good old AIR?

#

why must they differentiate it?

drifting coral
#

i'd assume world generation

kind hatch
#

idk. Cave air is really just a relic of the past. It may have some internal use that no one is aware of, but it’s probably just one of those features that were going to be expanded upon but ultimately never were.

midnight shore
#

🤷🏻‍♂️

solar sable
#

how to get a location of a player and then write it in chat

kind hatch
#

My best guess would be that it revolves around the temperature values that exist for biomes. Second best guess is it’s an easy way to check if players are in caves so the game can play the spooky sounds.

midnight shore
kind hatch
solar sable
#

im trying to make it say the coords they died at but all i have right now is telling the player they are ded instead of "You died at X Y Z"

crisp steeple
solar sable
#

oh damn 3 answers

midnight shore
#

is that for damaging?

tall dragon
#

pretty sure mc uses cave_air to generate underwater caves

kind hatch
#

Honestly no clue about that one. Probably for damaging, but a simple integer comparison would be far more efficient.

midnight shore
kind hatch
#

Well, you could get the specifics from the other methods that exist.

midnight shore
#

you can even print the pitch and yaw angles if you want

kind hatch
#

I just didn’t want to write out Location#getX getY etc.

midnight shore
kind hatch
#

You wouldn’t need to cast if you used getBlockX

drifting coral
kind hatch
#

Yea. 😛

crisp steeple
kind hatch
#

getBlockX Y and Z return an integer.

midnight shore
#

i really don't like this casts i see everywhere. If i really want to get the integer value from a decimal number i would use Math.round();

midnight shore
midnight shore
#

😐

drifting coral
#

concatenation is the devil if used more than like twice

sullen fox
#

My plugin doesnt show up when I type /pl

#

Main class:

#
package me.rudiemc.maintenance;

import me.rudiemc.maintenance.Commands.AddPlayer;
import me.rudiemc.maintenance.Commands.RemovePlayer;
import me.rudiemc.maintenance.Commands.ToggleMaintenance;
import me.rudiemc.maintenance.Listeners.PlayerConnectEvent;
import org.bukkit.ChatColor;
import org.bukkit.event.Listener;
import org.bukkit.event.player.PlayerLoginEvent;
import org.bukkit.plugin.java.JavaPlugin;

public final class Maintenance extends JavaPlugin {

    static Maintenance plugin;
    public String prefix = ChatColor.translateAlternateColorCodes('&', getConfig().getString("Prefix"));

    @Override
    public void onEnable() {

        // Register Commands

        getCommand("togglemaintenance").setExecutor(new ToggleMaintenance());
        getCommand("addplayer").setExecutor(new AddPlayer());
        getCommand("removeplayer").setExecutor(new RemovePlayer());

        // Save Config

        getConfig().options().copyDefaults(true);
        this.saveDefaultConfig();

        // Register Listeners

        this.getServer().getPluginManager().registerEvents(new PlayerConnectEvent(), this);

        plugin = this;

    }


    @Override
    public void onDisable() {
        // Plugin shutdown logic
    }
}
#

and yes

#

i did build it

#

and add it into the plugins folder

#

but when i executed /plugins in the console

#

my plugin didnt show up

hasty prawn
#

Do you have a plugin.yml

sullen fox
#

yes

#

I do

hasty prawn
#

It probably spit out an error in the console when trying to load your plugin

#

So send that

sullen fox
#

sure

#

the error

#

or

#

the plugin.yml?

hasty prawn
#

the error

sullen fox
#

sure ok

#

@hasty prawn

#

if i have two extra lines

#

after the last line

#

of my plugin.yml

#

does it generate an error..?

hasty prawn
#

Probably not unless there's white space there like tabs

sullen fox
# hasty prawn Probably not unless there's white space there like tabs

package me.rudiemc.maintenance;

import me.rudiemc.maintenance.Commands.AddPlayer;
import me.rudiemc.maintenance.Commands.RemovePlayer;
import me.rudiemc.maintenance.Commands.ToggleMaintenance;
import me.rudiemc.maintenance.Listeners.PlayerConnectEvent;
import org.bukkit.ChatColor;
import org.bukkit.event.Listener;
import org.bukkit.event.player.PlayerLoginEvent;
import org.bukkit.plugin.java.JavaPlugin;

public final class Maintenance extends JavaPlugin {

    static Maintenance plugin;
    public String prefix = ChatColor.translateAlternateColorCodes('&', getConfig().getString("Prefix"));

    @Override
    public void onEnable() {

        // Register Commands

        getCommand("togglemaintenance").setExecutor(new ToggleMaintenance());
        getCommand("addplayer").setExecutor(new AddPlayer());
        getCommand("removeplayer").setExecutor(new RemovePlayer());

        // Save Config

        getConfig().options().copyDefaults(true);
        this.saveDefaultConfig();

        // Register Listeners

        this.getServer().getPluginManager().registerEvents(new PlayerConnectEvent(), this);

        plugin = this;

    }


    @Override
    public void onDisable() {
        // Plugin shutdown logic
    }
}


hasty prawn
#

Need the error

sullen fox
#

oh

#

wait

#

can I do it later

#

like

#

can i send the error later

#

I've to go somewhere

hasty prawn
#

Yes

sullen fox
#

sure ok

#

bro

#

I changed a boolean to a string

#

And

#

changed everything in my code

#

and the solution was so simple

#

😩

glad shore
#

Is there a way, that I say a zombie /... it should walk to a location?

sullen fox
#

Thanks I'll try it when I can and tell you if it works

#

but

#

the error was in config.yml

#

not the main class

hasty prawn
#

That will only work if the other classes are trying to access plugin.

#

Which, perhaps they are, so you should still do that. But I doubt that's the main cause.

glossy venture
#

can you use spongepowered mixins standalone?

sullen fox
glossy venture
#

without any minecraft environment

sullen fox
#

If the issue persists

#

I'll come back

frigid rock
#

does anybody know why this isn't working? it isn't giving me any errors too. java public static void addEnchant(ItemStack item, Enchantment enchantment, int lvl){ item.addUnsafeEnchantment(enchantment, lvl); List<String> lore = new ArrayList<String>(); ItemMeta meta = item.getItemMeta(); if(meta.hasLore()){ meta.getLore().add(enchantment.getName() + " " + lvl); }else{ meta.setLore(lore); lore.add(enchantment.getName() + " " + lvl); } item.setItemMeta(meta); }

crisp steeple
undone axleBOT
#

"Does not working" is a useless statement. Please describe what exactly is not working, what you expect it to do, and what actually happens. If you get any console errors, also ?paste the entire stacktrace.

glad shore
frigid rock
undone axleBOT
hasty prawn
glossy venture
#

idk but i think you have to call setLore(...) after modifying it

sullen fox
drifting coral
frigid rock
#

oh yeah bruh

#

dumb af haha thankyou

crisp steeple
sullen fox
#

like

glossy venture
#

yeah

sullen fox
#

string list lore does not have any changes made to it after it's defined

drifting coral
sullen fox
#

and at the end of the code

#

you set the item's lore

glossy venture
#

fuck

sullen fox
#

Not there

glossy venture
#

still need to modify

sullen fox
#

After that

crisp steeple
#

this won’t work

sullen fox
#

yes

glossy venture
#

i know

sullen fox
#

you forgot to modify lore

glossy venture
#

i sent it early

#

didnt mean to send yet

sullen fox
#

xD

crisp steeple
#

you could try to instance a playerinteractevent and then call it, but i don’t know if that would work

drifting coral
#

I am fairly certain it is possible with the use of packets

glossy venture
drifting coral
#

I've seen it mentioned before

frigid rock
#

like this right? java if(meta.hasLore()){ meta.getLore().add(enchantment.getName() + " " + lvl); }else{ lore.add(enchantment.getName() + " " + lvl); meta.setLore(lore);} item.setItemMeta(meta);

drifting coral
#

Very briefly

#

but mentioned

lavish hemlock
frigid rock
#

exactly

lavish hemlock
#

You'd just have to figure out how to apply it to a Minecraft-less environment.

frigid rock
#

so how?

lavish hemlock
#

Good luck, their API is fucking complicated as hell.

crisp steeple
#

instead of doing all of that, just set your lore list to meta.getLore()

#

then add your stuff to “lore” and set the lore on the item meta

#

then add the item meta on the item

frigid rock
#

but the lore can be null

crisp steeple
#

i don’t think it can

#

can it?

frigid rock
#

wait let me try

crisp steeple
#

you’re doing meta.getLore().add(), which won’t do anything since getlore just returns a copy

sullen fox
#

Shouldn't it be

#

meta.setLore()

sullen fox
#

or

frigid rock
#

yes lore can be null

#

Caused by: java.lang.NullPointerException: Cannot invoke "java.util.List.add(Object)" because the return value of "org.bukkit.inventory.meta.ItemMeta.getLore()" is null

sullen fox
#

List<String> = meta.getLore();
List.add(..);
meta.setLore(List);

#

can that work

crisp steeple
crisp steeple
frigid rock
sullen fox
#

since

#

at first, you set List's value to the old lore

#

then you add something to the List

#

and then you set the List as the item's lore

#

so it should have the old lore as well as the stuff you added

#

probably?

frigid rock
#

but the old lore can be null

sullen fox
#

that's why

#

the if statement

frigid rock
#

that's why i made the if statement

sullen fox
#

yes

frigid rock
#

but it isn't still working

crisp steeple
#

List<String> lore = meta.getLore() == null ? new ArrayList<>() : meta.getLore();

drifting coral
lavish hemlock
#

It's called the conditional operator

sullen fox
#

damn

lavish hemlock
#

condition ? if true : if false

sullen fox
#

oh

lavish hemlock
crisp steeple
#

more languages should have elvis operator

lavish hemlock
#

And yet people talk shit about it constantly for no good reason

#

It'S tOo DiFFeRent FroM jAvA

#

Maybe that's a good thing, you pricks

glossy venture
#

yo Maow do you know what the mixin dependency is

#

for gradle

lavish hemlock
#

Uhh yeah it's like

glossy venture
#

i cant seem to get it

lavish hemlock
#

org.spongepowered:mixin:<version>

glossy venture
#

i have org.spongepowered:mixin:0.8.5-SNAPSHOT right now

lavish hemlock
#

You need to use their repo

glossy venture
#

ah

#

can i add repositories to the spigot library loader?

frigid rock
#
 public static void addEnchant(ItemStack item, Enchantment enchantment, int lvl){
        item.addUnsafeEnchantment(enchantment, lvl);
        ItemMeta meta = item.getItemMeta();
        List<String> lore = meta.getLore() == null ? new ArrayList<>() : meta.getLore();
        lore.add(enchantment.getName() + " " + lvl);
        item.setItemMeta(meta);
    }``` like this right? This isn't working
glossy venture
#

do meta.setLore(lore) after adding it

frigid rock
#

opsies haha

crisp steeple
frigid rock
#

now it's working correctly! tysmmm

solar sable
#

uh guys i need help

#
if (p.getPlayer().isDead()) {
            p.sendMessage(ChatColor.translateAlternateColorCodes('&', "&aYou have died. &bLast location: ") + p.getLocation());
        }
``` it's not exactly how i expected it to be
frigid rock
#
if (p.getPlayer().isDead()) {
            p.sendMessage(ChatColor.translateAlternateColorCodes('&', "&aYou have died. &bLast location: " + p.getLocation());
        }```
#

this should be correct i think

solar sable
#

uh

#

what did you even change?

#

oh the )

#

well i mean the location

#

I thought it was going to like "X Y Z" but no its a lot more

#

it says yaw and stuff

crisp steeple
#

well yeah, a location includes that

#

you could just get the x y and z individually if that’s all you want

#

or a better option would be making a function that takes a location, and returns your formatted string

solar sable
#

brb

crisp steeple
#

you could, but i would recommend using the other way

solar sable
#

yup I did it

#

what i wrote is correct and exactly what i wanted

#

is the /reload even worth using?

#

most of the times it says it wont work

hasty prawn
#

You can use it on your test server

#

Just not on a production server

grim ice
#

YO DID DISCORD CHANGE FONT

quaint mantle
#

Resetting?

#

am I not doing that at meta.setDisplayName()

#

so how do I do that

#

oh

#

ok I know

#

I just checked my code and it does have the setItemMeta()

karmic grove
#

so i made a custom item but i was wondering how i can craft it with the custom lore

if (config.getBoolean("Bad_Omen_Potion")) {
            new RecipeManager("Bad_Omen_Potion", new ItemStack(Material.POTION))
                    .shape(
                            "L L",
                            " S ",
                            "L L")
                    .set('L', Material.EMERALD_BLOCK)
                    .set('S', Material.GOLD_INGOT)
                    .register();
        }```
#

do i change item stack orrr

crisp steeple
#

just modify the itemstack before you add that recipe probably

karmic grove
#

i have this

#
    public static ItemStack bad_omen;

    public static void init() {
        create_potion();
    }
        private static void create_potion() {
            ItemStack item = new ItemStack(Material.POTION, 1);
            ItemMeta meta = item.getItemMeta();
            meta.setDisplayName("Bad Omen potion");
            List<String> lore = new ArrayList<>();
            lore.add("Right click to get bad omen");
            meta.setLore(lore);
            meta.addEnchant(Enchantment.LUCK, 1, false);
            meta.addItemFlags(ItemFlag.HIDE_ENCHANTS);
            item.setItemMeta(meta);
            bad_omen = item;
        }

crisp steeple
#

is this a class?

#

why not just return the item from one of those methods instead of setting it to the field

#

also having a method that links to another one seems pretty pointless in this case

karmic grove
#

uhh wdym

#

oh i think new RecipeManager("Bad_Omen_Potion", new ItemStack(ItemManager.bad_omen))

#

would work

#

ill try it

crisp steeple
#

if you ever try using that itemstack again though it’ll break things

karmic grove
#

what will break?

crisp steeple
#

it doesn’t make sense to do that entire process where you make an item, set it to a field, and then clone it instead of just calling the method directly and returning the item

#

since you’re only ever creating one itemstack object, if that ever changes then everything else that uses that field will as well

solar sable
#

will this repeat the same thing over and over again?

Bukkit.getScheduler().runTaskAsynchronously(plugin, () -> p.setScoreboard(board));
crisp steeple
#

no

solar sable
#

then how do I repeat a task?

#

just making it send the same thing over and over again

crisp steeple
#

.getScheduler().runTaskTimerAsynchronously(plugin, <task>, <interval>);

#

syntax might be wrong since i’m on mobile

desert musk
#

Damageable damaged = (Damageable) item; damaged.setDamage(56); respawnItems.add((ItemStack)damaged);

This method does not work for setting the durability of a new item, it doesn't keep its damage when casted to an itemstack apparently

#

how do i do this properly?

crisp steeple
#

you don’t need to cast it

desert musk
#

wdym

crisp steeple
#

“item” is an itemstack right

desert musk
#

yep

#

the item.setDurability() function is deprecated

crisp steeple
#

then you don’t need to cast damaged back to an itemstack

#

just use it directly

desert musk
#

ok

#

but i'm not sure how to add a damageable to someone's inventory

crisp steeple
#

what

#

just remove the cast

#

that should work

desert musk
#

ok

#

it does not

crisp steeple
#

you removed the (ItemStack) cast and it doesn’t work?

solar sable
#

let me try fixing

crisp steeple
#

that doesn’t make much sense

#

is damageable an interface?

#

i don’t use later versions that much

solar sable
#
Bukkit.getScheduler().runTaskTimerAsynchronously(this, (p.setScoreboard(board)), 10, 10);
``` yeah I have no idea on how to use this thing.
noble forge
#

I am new to coding plugins. What would be the best way to implement 'gravity', so to say, for a NoGravity armor stand?

#

The first thing that comes to mind is simply just checking the block below the armor stand and moving it down, but perhaps there might be a better way I do not know of? I tried looking online, but my search results did not end up with anything useful

crisp steeple
#

() -> p.setScoreboard(board) should be it

ancient plank
#

?scheduling

undone axleBOT
ancient plank
#

good wiki on it

crisp steeple
#

^

solar sable
#

yes it did it

#

I was just dumb

#

XD

#

also how much is the delay and period

#

idk what are these

#

the delay is 20 = 1 tick right?

#

what is the period?

ancient plank
#

20 ticks is 1 second

#

schedulers are in ticks

solar sable
#

yes I know that

#

but what is the period

solar sable
#

#runTaskTimerAsynchronously(<plugin>, <task>, <delay>, <period> );

ancient plank
#

the docs explain it

solar sable
#

okay

#

ah i see

#

well i hope 6 seconds isnt that long lol

wary harness
#
public class LecternScreenMixin extends Screen {
    protected LecternScreenMixin(Text title) {
        super(title);
    }

    @Inject(at = @At("TAIL"), method = "init")
    public void init(CallbackInfo ci) {
        this.addDrawableChild(new ButtonWidget(10, 10, 160, 20, Text.of("Crash Server"), (button) -> {
            ScreenHandler screenHandler = client.player.currentScreenHandler;
            DefaultedList<Slot> defaultedList = screenHandler.slots;
            int i = defaultedList.size();
            List<ItemStack> list = Lists.newArrayListWithCapacity(i);

            for (Slot slot : defaultedList) {
                list.add(slot.getStack().copy());
            }

            Int2ObjectMap<ItemStack> int2ObjectMap = new Int2ObjectOpenHashMap<>();

            for(int slot = 0; slot < i; ++slot) {
                ItemStack itemStack = list.get(slot);
                ItemStack itemStack2 = (defaultedList.get(slot)).getStack();
                if (!ItemStack.areEqual(itemStack, itemStack2)) {
                    int2ObjectMap.put(slot, itemStack2.copy());
                }
            }

            ((ClientConnectionAccessor) client.getNetworkHandler().getConnection()).getChannel().writeAndFlush(new ClickSlotC2SPacket(client.player.currentScreenHandler.syncId, client.player.currentScreenHandler.getRevision(), 0, 0, SlotActionType.QUICK_MOVE, client.player.currentScreenHandler.getCursorStack().copy(), int2ObjectMap));
            client.player.sendMessage(Text.of("Crashing Server..."), false);
            button.active = false;
        }));
    }
}

any one cane tell what is this exploit doing ?
it crashes server
what packet is sent

hasty prawn
#

ClickSlotC2SPacket, what arguments is that taking?

wary harness
#

it is book glitch

eternal night
#

The server just doesn#t handle it correctly

#

both paper and spigot already patched this

wary harness
#

lectern glitch

eternal night
#

see their commit history and figure it out

wary harness
#

xd

worldly ingot
#

Update to latest CraftBukkit, fixed last night

crisp steeple
#

most the server crashes people find now are lame

#

just stressing a server until it times out

quaint mantle
#
        ArrayList<Player> list = new ArrayList<>(p.getServer().getOnlinePlayers());

        Inventory bangui = Bukkit.createInventory(p, 45, ChatColor.BLUE + "Player List");

        for (int i = 0; i < list.size(); i++) {

            ItemStack playerHead = new ItemStack(Material.PLAYER_HEAD, 1);
            ItemMeta meta = playerHead.getItemMeta();

            meta.setDisplayName(list.get(i).getName());
            ArrayList<String> lore = new ArrayList<>();
            lore.add(ChatColor.GOLD + "Player Health: " + ChatColor.RED + list.get(i).getHealth());
            lore.add(ChatColor.GOLD + "XP: " + ChatColor.AQUA + list.get(i).getExp());
            meta.setLore(lore);
            playerHead.setItemMeta(meta);

            bangui.addItem(playerHead);
        }
        p.openInventory(bangui);```
#

why does this code always show the player display name as the item meta?

hasty prawn
#

meta.setDisplayName(list.get(i).getName());

quaint mantle
hasty prawn
#

What are you talking about then

#

Display name as the item meta ?

low temple
quaint mantle
crisp steeple
#

that makes not a lot of sense

low temple
quaint mantle
#

it shows the display name

low temple
#

show screenshot

crisp steeple
#

which is?

quaint mantle
chrome beacon
#

Do you want the material name?

#

Like Diamond Sword

low temple
#

maybe Player#getPlayerListName()?

chrome beacon
#

Ah then getName should work

#

Everything can be modified

undone axleBOT
hasty prawn
#

well you gotta put stuff in it

#

How are we supposed to help if you remove code

vivid cave
#

without making or installing a bungee plugin, how could I make proxy restart automatically every day?
I do have the code on my spigot plugin (which I use on every of my servers by the way) to restart the server, so all servers can get auto restarted, but not proxy

#

no

#

i still want the proxy to close cleanly

#

plus i don't like pterodactyl

#

is there a way to execute /end from a spigot plugin (with plugin messaging for example) (without needing to put any additional code/plugin on proxy)

crisp steeple
#

doesn’t /end just stop it indefinitely

vivid cave
#

so whenever its stopped it restarts

#

(its a pretty standard design)

crisp steeple
#

you infinitely attempt to run the proxy?

vivid cave
#

yes

#

i mean

#

its blocking

crisp steeple
#

that sounds like a bad idea

vivid cave
#

no i swear this is used often

crisp steeple
#

like you aren’t even checking if it’s down?

vivid cave
#

because it cannot attempt to run it while its running

#

its in a syncchrnous logic

#

bro its just a standard restart file really

#

but i don't want that

#

to autorestart

#

😛

#

not to close down

#

i mean closing down restarts

#

so whatever either auto close or auto restart

#

both are equivalent in my case

crisp steeple
#

so you want to close your proxy from a spigot plugin

vivid cave
#

^^

#

(plugin which is part of the network ofc)

crisp steeple
#

should be accomplishable with plugin messages

vivid cave
#

because bungee sucks because i don't like bungee and it kinda breaks all my design;
I've been opting for a 1plugin per server instead of a centralized plugin for all servers
It has many advantages, more customizability over each server,
but disadvantage i guess,
But yeah making a central bungee plugin would kinda go against the philosophy i've been ^putting to my impl

crisp steeple
#

first time hearing of a philosophy against making bungeecord plugins

vivid cave
#

sure :p

crisp steeple
#

it doesn’t really make sense

vivid cave
#

at least it does to me

#

i didn't really came here to debate tho

crisp steeple
#

bungee plugins exist to be on a bungee proxy

#

not on every server in a plug-in message

tall dragon
#

im not sure what u want is possible without a bungee plugin

vivid cave
#

ok then thank you!

ivory sleet
#

That’ll do it for you much more sophisticatedly

vocal cloud
#
ivory sleet
#

Myeah well if you use sth like ptero then it’s pretty much already done for ya

tall dragon
#

well he doesnt like ptero

vivid cave
ivory sleet
#

Understandable, but having your own custom duct taped solution is error prone

#

Wouldn’t say abruptly

#

Like you can setup certain routines

tall dragon
#

btw conclure i managed to find a way for my player data sync issue. ended up making a standalone application that manages all the data & servers can request pieces of that data with redis pub/sub

#

its working pretty nicely

ivory sleet
#

That’s nice

vivid cave
fervent gate
#

How would I use an entity in a different class?

crisp steeple
fervent gate
#

Sure

#

haha yea

crisp steeple
#

you would set it as a field in that class

fervent gate
crisp steeple
#

no

#

in the listener class

#

also why are you defining what your plugin is in every class?

river oracle
fervent gate
#

I can't do that without the actual entity?

river oracle
#

Dependency Injection is a better practice than static access

crisp steeple
#

interesting

#

i see what you mean, i just don’t really use it

fervent gate
#

Thanks, never used it or seen it

river oracle
#

He's a static only guy

ivory sleet
fervent gate
#

lol

#

If you would ask me what it is, I would not be able to say lmao

ivory sleet
#

Like whenever you pass an object through a function/construction then that’s pretty much dependency injection

fervent gate
#

ah

crisp steeple
#

it doesn’t really change anything in his case though since it’s only applicable to his plugin

ivory sleet
#

The name is just a bit fancy for what it implies

fervent gate
#

Mk, yea I just need the exact entity I spawned

river oracle
#

Dependency injection is more portable

fervent gate
#

Alright, I'll try that

crisp steeple
#

good pun

ivory sleet
#

It always is

#

There’s no disadvantage with injecting your dependencies properly

river oracle
#

When is it not lmao

#

Please explain

ivory sleet
#

Mye, for spigot Idm whether you use a singleton or dependency injection I suppose at least as long as you’re not planning to scale your project

river oracle
#

What

#

Show an example

quaint mantle
#

whats the good mining plugin
when you mine, you instant get money for mining that.

crisp steeple
#

probably getting the air block that it got hit at

river oracle
crisp steeple
river oracle
#

get Entity refers to the projectile correct?

crisp steeple
#

not the actual block it hit

winged anvil
#

    @Override
    public void onEnable() {
        // Plugin startup logic
        SomeClass sc = new SomeClass(this);
    }

    @Override
    public void onDisable() {
        // Plugin shutdown logic
    }
}


-----------------------------
public class SomeClass {

    Plugin plugin;

    public SomeClass(Plugin plugin)
    {
        this.plugin = plugin;
    }

}
#

^ dependency injection

mild osprey
#

Hey! I have multiple of these layouts and I want to prevent anyone from going in the red area how would I do it?

ivory sleet
#

Myes altho if possible tho pretty much avoid passing your plugin type

crisp steeple
winged anvil
#

that up there is just a concept, not a copy paste thing

river oracle
#

For api

crisp steeple
ivory sleet
#

Also the name instance is probably something you wanna avoid as that is softly reserved for the singleton pattern

winged anvil
#

^

ivory sleet
#

Anyways I’d much rather see people pass their instances than rigorously enforcing static state over their design so noice

river oracle
#

Static pattern is awful for scalability

ivory sleet
#

Mye

#

Biggest culprit being static state in multithreading

winged anvil
#

I think people do that because if you go to youtube and look up spigot tutorial the youtubers create a static method to get the instance of the plugin

ivory sleet
river oracle
#

Yea I learned java alongside spigot so I knew that was a NoNo lol

#

I yelled at my friend for abusing static

ivory sleet
#

Hehe

winged anvil
#

yes DI is very clean

#

I remember the first time someone told me to do dependency injection it seemed like such a fancy term and I didnt know that I had already done it before, just didnt know what it was called

ivory sleet
#

Ye

winged anvil
#

never knew what the downsides of accessing something statically were though, what are the downsides?

lavish hemlock
#

I should make my own Spigot tutorial

ivory sleet
#

Oh yea

fervent gate
crisp steeple
#

just make it a field

ivory sleet
# winged anvil never knew what the downsides of accessing something statically were though, wha...

Atrociously maliciously impossible to maintain in any concurrent environment (static state) (why for example SimpleDateFormat is a sin), static generally provides no abstraction at all, static makes it extremely hard to unit test which most enterprise companies use heavily, static also couples code like crazy and decreases a component’s general reusability, nevertheless does static take away type usage as for instance the ability to use generics which depends on types.

#

But I mean for constants, for stateless data, for general helper functions that abstract away manual management of side effects as well as utility functions

winged anvil
#

Conclure how much math you got in you?

ivory sleet
#

Then static is fine

#

Uh a bit

winged anvil
#

ok

#

lemme draw

ivory sleet
#

Learning group theory and category theory rn lol

crisp steeple
#

i only really ever use static for plugin getting

winged anvil
#

its a basic trig question

quaint mantle
ivory sleet
#

Oh my expertise is definitely not trigonometry or well normal calculus in general, but sure ask away

winged anvil
#

this isnt for mc so im making a thread

#

trig

ivory sleet
#

👀

fervent gate
crisp steeple
#

if you want to use that specific armor stand in your other class, you would add a field for it along with getters and setters so you could use it

fervent gate
crisp steeple
#

looked at your old haste by accident

fervent gate
crisp steeple
#

you’re getting it, but you aren’t setting it anywhere

fervent gate
#

What do you mean anywhere? Where would you suggest setting it?

crisp steeple
#

it depends, are you planning on there being multiple cows? do you have a reference somewhere to this object you can use?

fervent gate
#
  1. I don't have a reference yet
crisp steeple
#

with what you have right now, you’ll only be able to access one cow

#

since you registered that listener at the start of your plugin presumably

fervent gate
#

Like for each entity that needs to be moved run that method

crisp steeple
#

you could use a map of the players uuid and the entities

#

also, don’t put a SpawnCommonCow field, use the actual entity

fervent gate
#

Mk, I'm assuming I should store the map in the javaplugin instance?

crisp steeple
#

put it in your listener if that’s where you’re intending on using it

fervent gate
crisp steeple
#

well then you could either make it static, or add a reference to the listener object it when you first initialize it that other classes will be able to access

fervent gate
#

Ok, I can give that a try

vale cradle
#

what's the correct way to apply a patch from another spigot branch into the main if the file to patch has been changed over time (I'm speaking about NMS patches from CraftBukkit)?

fierce glacier
#

I have an item that I retrieve from an inventoryClickEvent and I would like to retrieve its shorts
example: the orange wool shorts is 1 (the full id is 35:1)

Currently I'm doing an event.getCurrentItem(); to retrieve the item

fierce glacier
#

i don't know

eager turtle
#

Does anyone know how I could have players regain health regardless of their food level?

#

I want to use the hunger bar for showing when an ability is charged

#

maybe EntityRegainHealthEvent gets set to canceled when hunger is below certain amount?

#

i already am for a different ability

#

perhaps i could send packets for it so it wouldnt actually change it

remote gazelle
#

any way to get right eye location?

kind hatch
remote gazelle
#

yeah i know that

#

im spawning a entity in that location but it keeps covers the screen so i want to spawn it right side of the screen

kind hatch
#

Then just offset it a little bit. It won't be perfect for everyone as people have different FOV settings, but usually half a block would do.

#

You may need to do some calculations for which direction to add or subtract the x and z value from, but you can use the player direction to help with that.

remote gazelle
#

.... that is what i want to find

#

i think i have to use vector

#

but that is literally one thing i am weak at

kind hatch
#

You don't have to use vectors if you don't want to. There is a method that takes doubles in as the x,y, and z parameters and you can use that instead.
Something like Location#add(0.5D, 0, 0.5D) would suffice. If you wanted to move in a negative direction, you'd use Location#add(-0.5D, 0, -0.5D)

#

Yes, but you still need to register both of them with the proper methods.

#

As a class that contains both a command and a listener.

remote gazelle
kind hatch
remote gazelle
ebon siren
#

how would i get properties from my config file outside of the main class? i tried doing something like this private final Main pl = new Main(); but unsurprisingly it gave me an error

#

i cant make a static method that returns the config because the config is non-static

ebon siren
#

using hunger will probably cause some unnecessary complications

eager turtle
ebon siren
#

you can make more than one boss bar btw

#

if u want to use abilities then an item probably will be the best way

eager turtle
#

yeah im the boss bar for objectives not cooldown. unless i can reposition the boss bar

kind hatch
# remote gazelle <@!143004075435360256>

Well vector math isn't my specialty, but there is a method you can use to get the player's direction as a vector. Player#getLocation()#getDirection() which will return a vector based on their pitch and yaw values. You could then add a new vector on to this using Vector#add().

remote gazelle
#

well i know that because although im not best at it i just know some thing

kind hatch
remote gazelle
#

but how the frick can i change vector vertically

ebon siren
kind hatch
tender shard
#

why the heck is the last &0 in the green group D:

quasi patrol
vocal cloud
#

You get their profile. Do you have to set it again?

unreal quartz
#

Which bit are you trying to get

vocal cloud
#

Idk how to make it more clear shrug1

quasi patrol
lofty laurel
#

I'm new to plugin development and I was wondering why this isn't working, I'm getting no errors but it just doesn't work lol

public class BlockReset extends JavaPlugin implements Listener {

    @EventHandler
    public void OnBreakEvent (BlockBreakEvent e) {
        Player p = (Player) e.getPlayer();
        Block b = (Block) e.getBlock();

        if (b.getType() == Material.COAL_BLOCK) {
            e.setCancelled(true);
            b.setType(Material.BEDROCK);
            p.getInventory().addItem(new ItemStack(Material.COAL, 9));
            this.getServer().getScheduler().scheduleSyncDelayedTask(this, new Runnable() { public void run() { b.setType(Material.COAL_BLOCK); } }, 20 * 15);
        }
    }
}```
quasi patrol
lofty laurel
quasi patrol
#

Poggers.

restive mango
#

Hi

#

Anyone know any good resources for making custom classes for custom entities? I’m trying to make a custom projectile

inner lintel
#

so im having issues all of a sudden with creating new projects in intellij

#

keep getting this

#
 Cannot resolve org.spigotmc:spigot-api:pom:1.18.1-R0.1-SNAPSHOT failed to transfer from https://hub.spigotmc.org/nexus/content/repositories/snapshots/ during a previous attempt. This failure was cached in the local repository and resolution is not reattempted until the update interval of spigotmc-repo has elapsed or updates are forced. Original error: Could not transfer artifact org.spigotmc:spigot-api:pom:1.18.1-R0.1-SNAPSHOT from/to spigotmc-repo (https://hub.spigotmc.org/nexus/content/repositories/snapshots/): transfer failed for https://hub.spigotmc.org/nexus/content/repositories/snapshots/org/spigotmc/spigot-api/1.18.1-R0.1-SNAPSHOT/spigot-api-1.18.1-R0.1-SNAPSHOT.pom ```
hasty prawn
#

Try doing File -> Invalidate Caches

inner lintel
#

nope it wont register anything its acting dumb, even after a reset and import project back is t he same t hing

quasi patrol
#

Change Skin

ornate patio
#

what's the maximum length of an entry in a scoreboard

#

for sidebar

#

and how many entries can a scoreboard have