#help-development

1 messages · Page 1461 of 1

wraith rapids
#

what do you mean looks like this

coral sparrow
#

Inventory inv = Bukkit.createInventory(player, 72, ChatColor.AQUA + "Your Profile");

paper viper
#

Its cause you have 72 slots...

#

you cant have more than 54

wraith rapids
#

yeah sizes over 6 rows aren't supported properly

coral sparrow
#

rip

#

ok thanks

eternal night
#

And completely removed in newer versions :>

paper viper
#

that looks horrific

#

lol

#

just looking at it

#

the lines and stuff

wraith rapids
#

i remember when you used to be able to make 9 rowed chests by placing 3 chests in a row

#

you could only place the third chest if there was water in that block already

tired spoke
#

what is a minecraft plugin groupld and artifactld?

young knoll
#

I wish Mojang would fix the rendering for bigger inventories

wraith rapids
#

they are your group identifier

young knoll
#

Would be cool to have

wraith rapids
#

and your artifact identifier

#

the former identifies your group

#

the latter identifies your artifact, aka your plugin

tired spoke
#

to create a bedwars plugin what i need to set

wraith rapids
#

to what you want

#

within the conventions

tired spoke
#

i name them bedwars and bedwars or other?

coral sparrow
wraith rapids
#

is your group called bedwars?

#

are you called bedwars?

#

is your plugin called bedwars?

tired spoke
#

or other like it and bedwars

coral sparrow
#

lmaoa

#

speak english pls

tired spoke
wraith rapids
#

group id is the name of the people or group who made it

#

artifact id is the name of the thing that was made

quaint mantle
#

anyone can help make strenght potions 2 30s potion:increase_damage:3600:0 {CustomPotionColor:9643043,Potion:"minecraft:empty",CustomPotionEffects:[{Duration:3600,ShowIcon:1b,Ambient:1b,ShowParticles:1b,Id:5b,Amplifier:0b}]}

tired spoke
#

group id i can set the servername?

wraith rapids
#

it should be a domain

#

but yes, you can set it to your server's domain or whatever

wraith rapids
#

com.myserver

quaint mantle
quaint mantle
#

what is the command to edit

coral sparrow
coral sparrow
#

or the cmd to get effect?

quaint mantle
#

its in the config btw

wraith rapids
#

what

young knoll
coral sparrow
quaint mantle
#

but i dont know config stuff

coral sparrow
wraith rapids
#

this is not a "how to configure random plugin" channel

tired spoke
# wraith rapids com.myserver

i set it.<servername> (the name of mine server that i don't want to give for now) in groupld
and bedwars in artifactld

wraith rapids
#

good enough

coral sparrow
#

a good name xD

tired spoke
#

sD

paper viper
#

it has to be a valid domain

tired spoke
#

xD*

coral sparrow
paper viper
#

?

coral sparrow
wraith rapids
#

you should

paper viper
#

yeah lol

coral sparrow
paper viper
#

if it is someone else's domain you could get taken down

paper viper
wraith rapids
#

if you don't have a domain, use your github url or me.yourname

tired spoke
#

in authors i need: <author1>, <author2>, ...

paper viper
#

use io.github.[username on github]

#

you cant use com.github anymore

coral sparrow
#

EEEEEE

#

why

quaint mantle
#

need the link for myself

#

?paste

queen dragonBOT
quaint mantle
#

ok thx

tired spoke
#

it's a private plugin orobabbly i don't publish them

#

probabbly*

coral sparrow
young knoll
#

Git has private repos

coral sparrow
wraith rapids
#

i have one public project that is mostly an antisemitic joke

coral sparrow
#

Why dont you verify lol

wraith rapids
#

because fuck your standards

coral sparrow
paper viper
#

@wraith rapids why does it not show

#

ur typing

#

on discord

#

for me

wraith rapids
#

because I use ripcord and I disabled that

paper viper
#

o

tired spoke
#

i start coding

#

i start by on/off messages

wraith rapids
#

tell me more

quaint mantle
#

@tired spoke btw can u help with something

young knoll
#

Spigot already has those

quaint mantle
#

can i dm

tired spoke
#

yes

#

who wants to help me can dm me

wraith rapids
#

how much are you paying an hour

sharp bough
#

so if i do

replace Key with a number
Value with item stacks 
and then acces the Key 3 for example i would have the itemstack 3 linked to that number```?
#

so its like a link between things

#

an id

wraith rapids
#

this is what you have already

#

but instead of a number it's a string with a number in it

sage swift
#

didnt md_5 ban you the other day

wraith rapids
#

dunno

sharp bough
#

me?

#

no lol

wraith rapids
#

he keeps kicking me but I haven't noticed a ban

sharp bough
#

lol

sage swift
wraith rapids
#

i might just be on a different alt today though, i don't really keep track

sage swift
sharp bough
#

lmao

wraith rapids
#

i can't see message links

sage swift
#

you choose ignorance

wraith rapids
#

send a screenshot

sage swift
#

it's just md_5 and choco kicking you

wraith rapids
#

mmm

quaint mantle
#

anyone plugin support

wraith rapids
#

no

#

shoo

sharp bough
#

so accessing a map is faster and better than checking if the itemstack clicked is the one in the config file

wraith rapids
#

no, what you are doing right there is just as horrible as it was before

sharp bough
#

thats kinda cool

wraith rapids
#

a configurationsection is just a string -> object map

#

you have changed it to a number -> object map

coral sparrow
wraith rapids
#

nothing has changed

sharp bough
#

and this?

wraith rapids
#

i can't see replies

sharp bough
#

NNYaKNpGms0eUVpiSdHx — Today at 3:57 PM
use a map instead of iterating over a list

wraith rapids
#

yeah, you should use a map instead of iterating over shit

#

right now you are using a map and still iterating over shit

sharp bough
#

so the goal is to acces directly the value

#

instead of the for if

#

using the map

#

with the key

wraith rapids
#

itemstack equals, hashcode and issimilar are potentially catastrophically slow

#

you want to minimize the number of those calls as best as you can

bitter ridge
#

Hello! I have this recipe, it's working but I want it to craft when there are 16 ender eyes. How do I do that?

Code:

ShapedRecipe srAote = new ShapedRecipe(NamespacedKey.minecraft("aote"), item );
        srAote.shape(" E ", " E ", " D ");
        srAote.setIngredient('E', Material.ENDER_EYE);
        srAote.setIngredient('D', Material.DIAMOND);
        Bukkit.addRecipe(srAote);
paper viper
#

you have to do that manually using an event

#

not sure

#

if exact choice

#

supports the number

wraith rapids
#

it doesn't

paper viper
#

Yeah

wraith rapids
#

crafting just doesn't work that way

young knoll
#

I don't think ExactChoice supports stack size, so probably the event

paper viper
#

thats what i thought

#

Mhm preparecraftitemevent

#

i think

young knoll
#

mhm

bitter ridge
#

okay, thx

wraith rapids
#

yeah

paper viper
#

@young knoll is that a cat

#

in your pfp

vague mason
#

When you buy 1000€ worth of BTC and now waiting to receive it 😑

paper viper
#

is the dude behind the cat him?

wraith rapids
#

is the dude in your avatar you

paper viper
#

Maybe

wraith rapids
#

what do you think is the dude in my avatar me

tired spoke
#

how can i set the ON/OFF plugin message on console with a custom color (gold or orange)

paper viper
#

if you are dead

wraith rapids
#

the dark side of the force is a path to many abilities most would consider unnatural

#

or however that goes

paper viper
#

Lol

young knoll
#

Actually both creatures in my profile picture are cats

sharp bough
#
    do do do do break; while (false); while (false); while (false); while (false);
    return φ |= φ &= φ |= !/**/false;```
what the fuk is this
young knoll
#

Valid Java

#

It says so

wraith rapids
#

that's a generic array

#

that's not valid java

sharp bough
#

it looks c o m p l e x

eternal oxide
bitter nymph
#

I get the following exception if i deploy the plugin on the server. Have anyone anyone idea?

Caused by: java.lang.ClassNotFoundException: org.json.JSONArray
at java.net.URLClassLoader.findClass(URLClassLoader.java:382)
at org.bukkit.plugin.java.PluginClassLoader.findClass(PluginClassLoader.java:102)
at org.bukkit.plugin.java.PluginClassLoader.findClass(PluginClassLoader.java:87)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
... 8 more

worldly ingot
#

it just returns whatever that boolean is lol

wraith rapids
#

your runtime doesn't have org.json.JSONArray

worldly ingot
#

$validJava(true) returns true, $validJava(false) returns false. That's it

bitter nymph
#

how can i fix this?

worldly ingot
#

On what version? Because I'm almost certain JSONSimple is shaded into the server

young knoll
#

When do we get superposition booleans

bitter nymph
#

I use Spigot Version 1.8.9

worldly ingot
#

Oh, JSONSimple is shaded into the server. Though it's shaded under org.json.simple.JSONArray

sharp bough
#

you okay Choco? we are here for you

worldly ingot
#

So I don't know where you managed to import org.json.JSONArray

#

I'm fine 😛

#

I checked my stats. Apparently I committed 1,800 commits I think just this year alone

sharp bough
#

thats at least 3 posts every day for 2 months with 2 days off

worldly ingot
#

I enjoy what I do Sunglasses

young knoll
#

What is it you do

coral sparrow
#

btw is there a way to set a Skull owner to like /give @p minecraft:player_head{SkullOwner:{Id:[IDS}} these things

paper viper
#

i commited 1000 commits this year

#

lol

worldly ingot
#

Contemplate life

young knoll
#

I see

paper viper
#

🥲

sharp bough
#

bro i started 5 months ago and did 171 wtf

sharp bough
#

lol thats like reading the manual of a rocket and hoping you know how to make one

vague mason
#

what?

worldly ingot
#

Every bit of my code is documented ;p

wraith rapids
#

a rocket is a very simple thing

#

it's just a tube with explosive shit in it

worldly ingot
#

Its documentation will explain what anything in my code does better than I can explain it myself now

#

😄

worldly ingot
vague mason
#

ooo yeah I really wanted to buy it few days ago XD

paper viper
#

reminds me of ass

#

its a tube with explosive shit in it

wraith rapids
#

myes

foggy bough
#
public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {
        if(cmd.getName().equals("hello")) {
            if(sender instanceof Player) {
                Player player = (Player) sender;
                player.sendMessage(ChatColor.BLUE + "Hello, " + ChatColor.GREEN 
                        + player.getName() + ChatColor.AQUA + 
                        ". Your health has been restored!");
                
                player.setHealth(20.0);
                
                
            } else {
                System.out.println("You are not allowed to use this through console!");
            }
        }
        
        return false;
        }``` Can I increase the health that I give the player past 20?
paper viper
#

Health boost?

foggy bough
#

yes

wraith rapids
#

😐

paper viper
#

just give the player the effect

foggy bough
#

oh yeah

#

well

wraith rapids
#

diddling with attributes might be more robust

#

you can add an attribute modifier directly to an entity i think

#

effects are kind of shit

#

in every way

granite stirrup
royal hawk
#

Guys how use ChatColor.translateAlternateColorCodes('&', "message") - and back to symbols?

torn oyster
#

why am i getting this error

#

i dont even have bstats in my pom.xml

royal hawk
#
Guys how use ChatColor.translateAlternateColorCodes('&', "message") - and back to symbols?
quaint mantle
#

No clue what is going on, but whenever I build artifacts (intelliJ) my .jar file only has the plugin.yml in it...

#

I have no idea what's going wrong.

#

I don't know what to provide you guys to resolve it

royal hawk
#

Example i have:
&ctest and i want to convert to color: ChatColor.translateAlternateColorCodes('&', "message") okey
How back to &ctest

quaint mantle
#

I use .replace("&", "§")

#

That also fixes it

#

or just use § instead of &

tired spoke
#

can someone give me the colors id? for bw

#

for now i do
RED,
BLUE,
GREEN,
YELLOW,
AQUA,
WHITE,
PINK,
GRAY,

#

i need the missing 8

winged mica
tired spoke
#

for me i need:
DARK_GREEN,

winged mica
tired spoke
#

can i use orange?

rotund ravine
#

I saw a wild @worldly ingot

#

hehe tag

tired spoke
#

for magenta i need purple or dark_purple?

foggy bough
#

quick question is the "isHatching" method from the "PlayerEggThrowEvent" returning a true or false value if the egg changed into a chick when it was thrown or some other way?

#

ok thx I got confused because I was looking at the spigot docs so I didn't know

winged mica
#

dependes where you need to use the color

tired spoke
#

Scoreboard, chat and blocks

winged mica
#

for scoreboard I think you can use both ChatColor and Color. ChatColor allows bold , underline

#

that is more limited in color options

#

for metadata you can use Color. ..

young knoll
#

If you are in 1.16 you have full hex support for most text

winged mica
young knoll
#

ChatColor.of("#ffffff")

winged mica
#

ok I see

#

rgb

#

2 chars for each

#

cool, thanks

tired spoke
#

no, i use 1.12.2

ivory sleet
#

why

#

1.16.5 exists

tired spoke
#

because i am creating a bedwars plugin

#

and the reccomend version are 1.8-1.12.2

ivory sleet
#

wat

#

source

#

?

dusk flicker
#

?????

tired spoke
#

i am starting by 1.12.2

tired spoke
sage swift
#

lol

ivory sleet
#

when the facts are a lie

foggy bough
#

would this code print onto my console where I am running the plugin? ```java
@Override
public void onEnable() {
System.out.println("Plugin is enabled!");
Bukkit.getPluginManager().registerEvents(this, this);

}```

ivory sleet
#

indeed

sage swift
#

crazy stuff

ivory sleet
#

tho I suggest using the Logger

young knoll
#

I would advise using getLogger instead

#

Or just nothing because their is an enabled message by default

sage swift
#

I would advise to do Bukkit.shutdown();

foggy bough
#

are you ppl talking to me?

sage swift
#

yes

#

we are your biggest fans

foggy bough
#

so what can I use to print something onto console?

#

because system.out.println isn't working on the console for me

young knoll
tribal holly
#

Someone know if team prefix work with spigot ? can't find a way to make them work

chrome beacon
#

Depends on what you mean by work

tribal holly
#

like this line : java this.team.getTeam().setPrefix("test§6");

#

and nothing

#

and of course just after there is thisjava this.getTeamEnum().getTeam().setNameTagVisibility(NameTagVisibility.ALWAYS);

young knoll
#

Are they in the team

tribal holly
#

yep i print it

young knoll
#

And iirc the other player must be part of the same scoreboard

tribal holly
#

and tab change the player color name

tribal holly
#

maybe came from this

#

so i need to create a common team for every player ?

#

that show color name and prefix etc ?

young knoll
#

Not a common team

#

A common scoreboard

tribal holly
#

okay i see

#

thx for advise

#

i will test tomorrow

wraith rapids
#

the scoreboard assigned to a player defines what that player sees, not what is shown of that player to others

maiden cape
#

is there a way to get the current tick

quartz goblet
maiden cape
wraith rapids
#

use paper

#

Bukkit.getCurrentTick

maiden cape
wraith rapids
#

other than reflection or using paper, there is no reliable way of knowing the current tick

maiden cape
#

this is your answer to everything

wraith rapids
#

you could create a task that runs every tick and increments a number by 1

#

but that is not reliable

quartz goblet
#

i mean you could always run a program every tick and have it keep track

maiden cape
#

yeah that's the approach I'm taking

quartz goblet
#

just call it every tick

wraith rapids
#

whether or not it being unreliable matters to you depends on why you need the current tick

quartz goblet
#

with bukkittasktimer

young knoll
#

Curious what you need the current tick for

wraith rapids
#

yeah, kind of an xy question here

maiden cape
#

basically

#

I'm designing a loop trigger for these skills I have on my bosses

#

and to do this I have one bukkit runnable loop

#

then I just check what the period of the loop that skill wants is

#

and I use mod on the current tick

wraith rapids
#

for that a task that increments by 1 each tick is probably fine

maiden cape
#

yeah

quartz goblet
#

yeah just do another bukkitrunnable running every tick

wraith rapids
#

but, if you want to do it the proper way around, use paper or grab the current tick from the nms field via reflection

maiden cape
#

neither of those are really worth it

wraith rapids
#

probably not no

#

of course you should use paper anyway

quartz goblet
#

why

maiden cape
#

I'm developing for a spigot resource

wraith rapids
#

as the 60% of your userbase is going to be pissed at you for f.e causing synchronous chunk loads

maiden cape
#

if it was my private plugin I would be

#

trust 🤣

maiden cape
#

without losing spigot support

wraith rapids
#

myeah

maiden cape
#

if so required

wraith rapids
#

i suppose the most important things are doable through paperlib

#

not quite everything though

#

stuff like async tab completition comes to mind

young knoll
#

Maybe it should have that too

#

I’m still not willing to drop support for the other 40%

wraith rapids
#

well i guess you don't really need paper or paperlib for it as it's event based

#

but you do have to jump through some hoops to have your plugin not explode on spigot

#

since it's event based, doing it in the lib would be quite difficult

#

shade it in and you get issues because of duplicate classes, don't shade it in and you explode on spigot because of missing classes

wraith rapids
#

maybe some kind of a factory method for a listener that shits out a consumer for a wrapper event

#

not exactly clean but eh

#
  • it's not really a drop in replacement, as you'd have to account for it being async, so you'd need to impl both a sync completer and an async one
maiden cape
#

I think the async completer or whatevs just completes synchronously if on spigot

wraith rapids
#

it has that? how's that supposed to work

#

i'll have to take a look

#

doesn't seem to have it

#

since the async tab complete functionality is event driven, it would be pretty difficult to do with the lib

#

and since your code would be run asynchronously, it wouldn't be drop-in

#

you can't just take code that was written to be executed synchronously and then execute it asynchronously, and expect it to work

#

and doing it the other way around has plenty of risks as well

#

all of the other async related features in the lib queue work to be done by the server asynchronously

#

f.e getChunkAsync does the get asynchronously; your work with the chunk should still be sync

#

so what you do with it can just be dropped in after getting the future's result, it will execute with the same semantics whether it's paper or spigot

cold dove
#

guys how do I make a map of 0 0?

covert bluff
#

What are Persistent Data Containers?

wraith rapids
#

data containers

cold dove
wraith rapids
#

that are persistent

cold dove
#

I need to "render" it somehow

#

but I don't understand how

#

bruh I can't believe no one knows how to do this simple thing

dusk flicker
#

for Lainad

dusk flicker
#

Literally a 10 second google

covert bluff
#

what is a dependency injwectoin

sage swift
#

you pass your plugin instance to another class through the constructor

covert bluff
cold dove
dusk flicker
#

Create a Renderer and then add it using the MapView#addRenderer method

wraith rapids
#

dependency injection is when one object depends on another object

sage swift
wraith rapids
#

and the object (dependent) that depends on the other object (dependency) is given the dependency

#

the dependency is given, rather than retrieved

#

it is "injected" into the other object

cold dove
dusk flicker
#

It will render the map.

wraith rapids
#

for example your Listener object might depend on your config object

dusk flicker
#

It's the MapRenderer object

wraith rapids
#

therefore you would pass the dependency to the dependent, you'd inject the config into the listener

#

usually through the constructor

#

the intention of dependency injection is that the dependent doesn't need to care where the dependency comes from, nor does it have to have any logic to retrieve the dependency from anywhere

#

the dependent is simply given a suitable dependency

#

your listener doesn't need to care what the config is or where it comes from

#

only that it performs its intended function

dusk flicker
#

eyes

covert bluff
#

LOL

#

thank you i will repost that everywhere now

eternal night
#

ruining such a neat explanation of DI with something as useless 😦

wraith rapids
#

i'm a pretty neat guy

cold dove
wraith rapids
#

learn java

dusk flicker
#

👀

#

yeah thats basic java at this point

woven epoch
#
public class AmogusGremlin extends EntityZombie {
    public AmogusGremlin(Location location) {
        super(EntityTypes.ZOMBIE, ((CraftWorld) location.getWorld()).getHandle());
        this.setPosition(location.getX(), location.getY(), location.getZ());
        Zombie craftZombie = (Zombie) this.getBukkitEntity();
        this.setBaby(true);
        ItemStack itemStack = new ItemStack(Material.WOODEN_HOE);
        ItemMeta itemMeta = itemStack.getItemMeta();
        itemMeta.setCustomModelData(3);
        itemMeta.setUnbreakable(true);
        itemStack.setItemMeta(itemMeta);
        craftZombie.getEquipment().setHelmet(itemStack);
        craftZombie.addPotionEffect(new PotionEffect(PotionEffectType.INVISIBILITY, Integer.MAX_VALUE, 1));
        craftZombie.setSilent(true);
        craftZombie.setCustomName(ChatColor.translateAlternateColorCodes('&',"&4&lAmogus Gremlin"));
        craftZombie.setCustomNameVisible(true);
        this.getWorld().addEntity(this);
    }

    public void initPathfinder() {
        super.initPathfinder();
        this.goalSelector.a(1, new PathfinderGoalNearestAttackableTarget<EntityHuman>(this, EntityHuman.class, true));
    }

    @Override
    public void entityBaseTick() {
        super.entityBaseTick();
        this.pitch = 0;
        this.lastPitch = 0;
    }
}

Hi! I've got a custom entity working, but I can't figure out how to make the entity not change it's pitch

wraith rapids
#

amogus gremlin

#

i'm out

woven epoch
#

I tried overriding the entityBaseTick() function, but It doesn't seem to work

#

lmfao

dusk flicker
#

same NNY

wraith rapids
#

just setting the pitch won't update players about the changed pitch i'm guessing

woven epoch
#

aaaaahhh hmm

#

gotcha

cold dove
#

Please help

cold dove
#

and i doesn't seem like a trivial task

covert bluff
#
Inventory inv = Bukkit.createInventory(null, 9, "Choose a kit");

            //Make namespaced keys
            NamespacedKey OPkey = new NamespacedKey(KitDuels.instance, "OP");
            NamespacedKey Bowkey = new NamespacedKey(KitDuels.instance, "BOW");
            NamespacedKey Axekey = new NamespacedKey(KitDuels.instance, "AXE");

            //Make OP kit
            ItemStack OP = new ItemStack(Material.DIAMOND_SWORD);
            ItemMeta opMeta = OP.getItemMeta();
            opMeta.setDisplayName(ChatColor.AQUA + "OP 1v1");
            opMeta.getPersistentDataContainer().set(OPkey, PersistentDataType.DOUBLE, 4);
#

Honestly confused, there's an error on PersistentDataType.DOUBLE

wraith rapids
#

and what's the error

covert bluff
#

never mind

#

it was because persistentdataype was double instead of int

#

but why do i need the value though

wraith rapids
#

myes

covert bluff
#

what is the value for

#

really confused

wraith rapids
#

the value is the value you set

covert bluff
#

the number?

wraith rapids
#

the persistent data container contains data

#

the data is stored by key

#

the double is your data

#

the namespacedkey is your key

covert bluff
#

so if i only want to use the key, the value wont matter?

wraith rapids
#

ideally you would only use one key and change the value based on the item

#

the key could be myplugin:itemid, and the value might be "AXE" or "BOW"

covert bluff
#
 if (sender instanceof Player) {
            Player plr = (Player) sender;

            //Make the inventory
            Inventory inv = Bukkit.createInventory(null, 9, "Choose a kit");

            //Make namespaced keys
            NamespacedKey OPkey = new NamespacedKey(KitDuels.instance, "OP");
            NamespacedKey Bowkey = new NamespacedKey(KitDuels.instance, "BOW");
            NamespacedKey Axekey = new NamespacedKey(KitDuels.instance, "AXE");

            //Make OP kit
            ItemStack OP = new ItemStack(Material.DIAMOND_SWORD);
            ItemMeta opMeta = OP.getItemMeta();
            opMeta.setDisplayName(ChatColor.AQUA + "OP 1v1");
            opMeta.getPersistentDataContainer().set(OPkey, PersistentDataType.INTEGER, 1);
            OP.setItemMeta(opMeta);

            //Make Bow kit
            ItemStack bow = new ItemStack(Material.BOW);
            ItemMeta bowMeta = bow.getItemMeta();
            bowMeta.setDisplayName(ChatColor.AQUA + "Bow 1v1");
            opMeta.getPersistentDataContainer().set(Bowkey, PersistentDataType.INTEGER,2);
            bow.setItemMeta(bowMeta);

            //Make Axe Kit
            ItemStack axe = new ItemStack(Material.DIAMOND_AXE);
            ItemMeta axeMeta = bow.getItemMeta();
            axeMeta.setDisplayName(ChatColor.AQUA + "Axe 1v1");
            axeMeta.getPersistentDataContainer().set(Axekey,PersistentDataType.INTEGER,3);
            axe.setItemMeta(axeMeta);

what about this?

wraith rapids
#

that makes even less sense

covert bluff
#

wtf

wraith rapids
#

use a single key

#

use the data to represent the item's type, not the key

covert bluff
#

and use PersistentDataType.STRING?

wraith rapids
#

for example yes

sage swift
#

also you're adding the second one to the opMeta

covert bluff
#

what about this

#
if (sender instanceof Player) {
            Player plr = (Player) sender;

            //Make the inventory
            Inventory inv = Bukkit.createInventory(null, 9, "Choose a kit");

            //Make namespaced keys
            NamespacedKey key = new NamespacedKey(KitDuels.instance, "KitDuels");
            //Make OP kit
            ItemStack OP = new ItemStack(Material.DIAMOND_SWORD);
            ItemMeta opMeta = OP.getItemMeta();
            opMeta.setDisplayName(ChatColor.AQUA + "OP 1v1");
            opMeta.getPersistentDataContainer().set(key, PersistentDataType.STRING, "OP");
            OP.setItemMeta(opMeta);

            //Make Bow kit
            ItemStack bow = new ItemStack(Material.BOW);
            ItemMeta bowMeta = bow.getItemMeta();
            bowMeta.setDisplayName(ChatColor.AQUA + "Bow 1v1");
            opMeta.getPersistentDataContainer().set(key, PersistentDataType.STRING,"BOW");
            bow.setItemMeta(bowMeta);

            //Make Axe Kit
            ItemStack axe = new ItemStack(Material.DIAMOND_AXE);
            ItemMeta axeMeta = bow.getItemMeta();
            axeMeta.setDisplayName(ChatColor.AQUA + "Axe 1v1");
            axeMeta.getPersistentDataContainer().set(key,PersistentDataType.STRING,"AXE");
            axe.setItemMeta(axeMeta);
wraith rapids
#

that's better, but name the key better

covert bluff
#

then i can do .get() to check if it's OP, BOW, AXE etce tc

#

any suggestions for the key?

wraith rapids
#

kit-type or something

sage swift
#

use as many wacky characters as you can

#

backslashes, the whole lot

covert bluff
#

i'm trying to make a duel plugin where they do /duel <playername>, an inventory gui pops up with 3 kits to select from, then once they choose one, the duel is sent to the player

#

but here's the thing

#

how would i send the request to the specific player after inventory click

#

like how would the plugin know

#

or how would it pass it down

#

(please ignore the plenty amount of method call chains)

package me.notprankster.kitduels;

import me.notprankster.kitduels.data.KitDuelsMap;
import org.bukkit.ChatColor;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.inventory.InventoryClickEvent;

public class InventoryListener implements Listener {

    @EventHandler
    public void onInventoryClick(InventoryClickEvent event) {
        if (event.getView().getTitle().equals("Choose a kit")) {
            if (event.getCurrentItem().getItemMeta() != null) {

                //OP kit
                if (event.getCurrentItem().getItemMeta().getDisplayName().equals(ChatColor.AQUA + "OP 1v1")) {
                    Player p = (Player) event.getWhoClicked();
                    p.sendMessage(ChatColor.translateAlternateColorCodes('&',"&7Chose &cOP Kit"));
                    event.setCancelled(true);

                    p.closeInventory();
                    //bow kit
                } else if (event.getCurrentItem().getItemMeta().getDisplayName().equals(ChatColor.AQUA + "Bow 1v1")) {
                    Player p = (Player) event.getWhoClicked();
                    p.sendMessage(ChatColor.translateAlternateColorCodes('&',"&7Chose &cBow Kit"));
                    event.setCancelled(true);
                    p.closeInventory();
                } else if (event.getCurrentItem().getItemMeta().getDisplayName().equals(ChatColor.AQUA + "Axe 1v1")) {
                    Player p = (Player) event.getWhoClicked();
                    p.sendMessage(ChatColor.translateAlternateColorCodes('&',"&7Chose &cAxe Kit"));
                    event.setCancelled(true);
                    p.closeInventory();
                }
            }
        }
    }
}

wraith rapids
#

don't call getItemMeta repeatedly

#

each time you call it, the entire itemmeta is cloned

#

call it once and store it in a variable

covert bluff
#
  //OP kit
                if (itemMeta.getDisplayName().equals(ChatColor.AQUA + "OP 1v1")) {
                    Player p = (Player) event.getWhoClicked();
                    p.sendMessage(ChatColor.translateAlternateColorCodes('&',"&7Chose &cOP Kit"));
                    event.setCancelled(true);

                    p.closeInventory();
                    //bow kit
                } else if (itemMeta.getDisplayName().equals(ChatColor.AQUA + "Bow 1v1")) {
                    Player p = (Player) event.getWhoClicked();
                    p.sendMessage(ChatColor.translateAlternateColorCodes('&',"&7Chose &cBow Kit"));
                    event.setCancelled(true);
                    p.closeInventory();
                } else if (itemMeta.getDisplayName().equals(ChatColor.AQUA + "Axe 1v1")) {
                    Player p = (Player) event.getWhoClicked();
                    p.sendMessage(ChatColor.translateAlternateColorCodes('&',"&7Chose &cAxe Kit"));
                    event.setCancelled(true);
                    p.closeInventory();
                }
            }
        }
#

?

wraith apex
covert bluff
#

thats something close to pvplegacy, but the problem is how do i make it so that the plugin knows which kit

wraith apex
#

the raw slot number

covert bluff
#

?

#

hang on

#

let me check out docs of it rq

wraith apex
#

probably one of the easiest ways

#

InventoryClickEvent

#

has a getRawSlot()

#

returns an int

covert bluff
#

how would i use that to compare

wraith apex
#

is the inventory a standard 54 slot inventory?

covert bluff
#

9

#

9 slots

wraith apex
#

aight

#

so 1 row

covert bluff
#

        if (sender instanceof Player) {
            Player plr = (Player) sender;

            //Make the inventory
            Inventory inv = Bukkit.createInventory(null, 9, "Choose a kit");
wraith apex
#

9 slots

#

raw slots are 0 to 8

#

left to right

covert bluff
#

oh, just like in the index

wraith apex
#

yeah

covert bluff
#

but how do i use it to compare

#

like how do i pass that info down

#

when the player clicks on the text

wraith apex
#

Oh they both have to use the same kit?

covert bluff
#

ye

#

when duel is sent the target is sent a message saying

#

"<playername> wants to duel you on <kit name>, ACCEPT | DENY"

wraith apex
#

I'd create a Duel system whereby when a player requests a duel, their UUID along with kit is stored in a map,

Map<UUID,String> duelRequests = new HashMap<>();

When the player selects a kit in the inventory, that kit is added to the map, using his player UUID as the key. The second player can accept the duel by clicking ACCEPT, The click event of the ACCEPT text has player 1's UUID so his duel can be fetched from the map along with the kit to start the duel.

covert bluff
#

thats what i did for a certain class though which stores all requests

#
package me.notprankster.kitduels.data;

import java.util.HashMap;
import java.util.Map;
import java.util.UUID;

public class KitDuelsMap {
    public static Map<UUID, UUID> duelRequests = new HashMap<UUID, UUID>();
}

wraith apex
#

You don't technically need the other players UUID

covert bluff
#

oh

#

how do i make it so that the accept text would have player1's uuid though?

#

doesn't perssing it just make the player do a command?

wraith apex
#

yeah

#

you could just have a anonymous/unwritten command

#

or use the same duel command

#

so when they click ACCEPT, /duel is ran for that player

#

and a check will be performed on the map

#

for that UUID

#

/duel could accept a player name or a player UUID as argument 0
if a player name is used, create a new duel, if one doesn't already exist
if a player UUID is used, check for an existing duel

cold dove
#

none of you guys know how to write a script that draws a map around 0 0? 🥺

wraith rapids
#

we do

#

we told you how

cold dove
#

I do not understand

wraith rapids
#

yes

#

that is why we told you to learn java

cold dove
#

There is no deafult rendere tho

#

come on

wraith rapids
#

you clearly have zero clue of what you are doing or how to use the language

cold dove
#

dude

#

all I need is to gather data

#

come on

wraith rapids
#
MyRenderer = MapRenderer(); // https://hub.spigotmc.org/javadocs/bukkit/org/bukkit/map/MapRenderer.html#%3Cinit%3E()
map1.addRenderer(MyRenderer);

I don't understand

cold dove
#

...

wraith rapids
#

dude me all you want but this is a shining red flag of "i have no idea of what i'm doing"

#

1 that is not how you declare a variable

cold dove
#

i know

wraith rapids
#

2 that is not how you call a constructor

#

3 that is not how you should name a variable

cold dove
#

well

#

what is the solution then

wraith rapids
#

go read a java tutorial and come back after you are at least vaguely familiar with the language

#

that is the solution

covert bluff
#

learn java

cold dove
#

dude

#

i am tho

wraith rapids
#

clearly not

cold dove
#

i was just typing two lines

wraith rapids
#

two lines that are completely and thoroughly wrong in every way possible

cold dove
wraith rapids
#

write those two lines in a way that isn't ass backwards and I may consider it

cold dove
#

ok 1 sec

opal juniper
#

It’s not good code

#

You put ur commands and listeners in the same class

#

And you registered the listener from the class that is the listener

cold dove
opal juniper
#

Even though you registered it in main

cold dove
wraith apex
#

Can't declare a new instance MapRenderer

#

it's abstract

wraith rapids
#

he's creating an anonymous extending class there

#

to make it concrete

wraith apex
#

ah fairs

cold dove
#

well anyway

#

there is no "code" to render a map normally like minecraft does so

#

what do i do?

opal juniper
#

I have no experience with this but I imagine this is gonna be nms, right?

wraith apex
#

Nah

#

Spigot has classes for this

#

Have a look at this thread

opal juniper
#

Idk, I haven’t used this api

#

Ahh, there is a method under Bukkit to make a mapView, makes sense

#

That’s quite interesting - can you customise the contents of the map or does it take it from the world?

wraith rapids
#

you can implement your own renderers to do a bit of everything afaik

#

i haven't really diddled with maps though so idk how bothersome or robust the api is

opal juniper
#

Yeah - I haven’t either

#

I saw someone’s media player on here though and wondered if they probably used a custom renderer

wraith apex
#

Makes a webapp using maps

wraith rapids
#

it's probably on the protocol layer

opal juniper
#

Actually fair

#

I mean - it was like at least 15 FPS video

#

It looked quite cool

#

Ohh I found it

#

It’s the PulseBeat guy

#
  • conclure
cold dove
wraith rapids
#

"this"

cold dove
#

Implicit super constructor EntityHuman() is undefined. Must explicitly invoke another constructor
Constructor call must be the first statement in a constructor

wraith rapids
#

going back to the basics of java

opal juniper
#

Just move it up then

#

😂

wraith rapids
#

the super constructor call must be the first statement in a constructor

#

exactly as it says

#

you can't do anything before calling it

opal juniper
#

I mean, just remove the null check and don’t send it null 🤷‍♂️

#

As long as this isn’t an api that is

cold dove
#

this just weird

#

whats float anyways

wraith rapids
#

i don't think any mappings include param names

#

see the source and the mappings for what it's used I suppose

#

seems to have something to do with position and rotation

#

yaw :thonk:

quaint mantle
covert bluff
#

@wraith apex How do I go about finding the player ?

  if (event.getView().getTitle().equals("Choose a kit")) {
            if (itemMeta != null) {

                //OP kit
                if (itemMeta.getDisplayName().equals(ChatColor.AQUA + "OP 1v1")) {
                    Player p = (Player) event.getWhoClicked();
                    p.sendMessage(ChatColor.translateAlternateColorCodes('&',"&7Chose &cOP Kit"));
                    event.setCancelled(true);
                    KitDuelsMap.duelRequests.put(p.getUniqueId(),"OP");

                    Set<NamespacedKey> target = itemMeta.getPersistentDataContainer().getKeys();



                    p.closeInventory();
                    //bow kit
                } else if (itemMeta.getDisplayName().equals(ChatColor.AQUA + "Bow 1v1")) {
                    Player p = (Player) event.getWhoClicked();
                    p.sendMessage(ChatColor.translateAlternateColorCodes('&',"&7Chose &cBow Kit"));
                    event.setCancelled(true);
                    p.closeInventory();
                } else if (itemMeta.getDisplayName().equals(ChatColor.AQUA + "Axe 1v1")) {
                    Player p = (Player) event.getWhoClicked();
                    p.sendMessage(ChatColor.translateAlternateColorCodes('&',"&7Chose &cAxe Kit"));
                    event.setCancelled(true);
                    p.closeInventory();
                }
            }
sage swift
#

oh god please dont use the name of the inventory to find your inventory

#

come on

cold dove
#

ok this is it im running the code

sage swift
#

cause what if someone renames a chest to "Choose a kit"?

#

all broken.

covert bluff
#

i have been trying to find the issue for 12 hours

#

i am tired

sage swift
#

and your code is bad

#

but can be improved

wary harness
#

hey any one know how would I generate playerdata file uuid.dat
for player which never played before on server ?

#

I want to generate it from UUID

sage swift
#

this sounds very much like the wrong solution to your actual problem

#

?xy

queen dragonBOT
quaint mantle
sage swift
#

Bukkit.createBossBar takes barflags, or you can add them later

quaint mantle
#

ty, but should I apply bossbar to player?

granite stirrup
#

it takes forever to download stuff from gamebannana

#

lmao

#

gamebannana's servers are bad

#

it keeps stopping the downLoad

#

i have to keep resuming it

sage swift
#

and this is related to development in which way?

granite stirrup
#

nothing i just want to say my issues with it

cold dove
#

bruh the map images came up a bit croped 😦

quaint mantle
#

Hello, How can I remove bossbar from screen? but I want to keep barflag

#
        bar.addFlag(BarFlag.CREATE_FOG);
        bar.addPlayer(event.getPlayer());
    }```
#

its my bossbar

#

If i use bar.setVisible(false); barflag removes

#

also, hidebar() same

torn shuttle
#

that's really odd, are ender crystals really not living entities?

#

how come armor stands are living entities but not ender crystals?

wraith rapids
#

mojang

torn shuttle
#

smh

#

this is going to break so much shit

#

I had my entire system tuned for living entities

covert bluff
wraith rapids
#

armorstands can drown

#

there is no care or concern given to "should" at mojang

granite stirrup
torn shuttle
#

considering the point is to hit them I'm just surprised they're not living entities

young knoll
#

Neither are boats or minecarts

#

But they have "health"

quaint mantle
#

Also for the MapInitializeEvent I could only find on docs that it gets called 'when initialised' is that when its loaded (in a item frame, or held) or when it gets created or both

young knoll
#

Probably when it goes from a blank map to not a blank map

twilit rivet
#

Trying to play around with mySQL but, having problems. Is someone able to assist, my current code is ```java
public void createPlayer(Player player) {
try {
UUID uuid = player.getUniqueId();

        if (!exists(uuid)) {
            PreparedStatement ps2 = plugin.SQL.getConnection().prepareStatement("INSERT IGNORE INFO chatlogs"
                + " (NAME,UUID) VALUES (?,?)");
            ps2.setString(1, player.getName());
            ps2.setString(2, uuid.toString());
            ps2.executeUpdate();
        }

    } catch (SQLException e) {
        e.printStackTrace();
    }
}
    @EventHandler
    public void onJoin(PlayerJoinEvent event) {
        Player player = event.getPlayer();
        data.createPlayer(player);
    }
```However, it responds with...
dusk flicker
#

Im guessing 'INFO' is meant to be 'INTO'

#

everything else looks fine

twilit rivet
#

😢 I thought that was INTO lmao

#

Is it worth replacing all file written stuff, and using MySQL instead

young knoll
#

Depends

quaint mantle
dusk flicker
#

that looks like a .... well you knowe

quaint mantle
#

ignore the mickey mouse

twilit rivet
#

Nice cock bro

quaint mantle
#

:troll:

#

but yeah look at the amount of markers

#

place a of few of those maps, every player is at 0 fps

#

with enough it sends enough data to the server to lag it

#

internal ddos, I'd like to patch it 😄

twilit rivet
#

lol, I'm just trying to create a plugin that uses MySQL so that I can make a web dashboard for logging stuff

#

There's not really any up to date portals with good dependencies, so I'm just going to make one that works with a few plugins I use

weak mauve
#
    public void onAbilityUse(Player player, SItem sItem)
    {
        player.playSound(player.getLocation(), Sound.ENDERDRAGON_GROWL, 5f, 5f);
        for (Entity entity : player.getWorld().getNearbyEntities(player.getLocation().add(player.getLocation().getDirection().multiply(3.0)), 3.0, 3.0, 3.0))
        {
            if (!(entity instanceof LivingEntity)) continue;
            if (entity instanceof Player || entity instanceof EnderDragon || entity instanceof EnderDragonPart) continue;
            User user = User.getUser(player.getUniqueId());
            entity.setVelocity(player.getLocation().toVector().subtract(entity.getLocation().toVector()).normalize().multiply(-1.0).multiply(50.0));
            user.damageEntity((LivingEntity) entity, 12000.0);
        }
    }
#

can u help me a bit, i want this code to damage all entities expect villager

young knoll
#

Only continue if it’s a villager then?

weak mauve
#

no

#

i fixed it sry :l

quaint mantle
young knoll
#

Check the contributing instructions

paper viper
#

You need a gpg key right to get your group id with projects onto central

#

to sign artifacts

scarlet sand
#

How can I get a mapcanvas from a itemstack in 1.12

candid galleon
#

how would I go about letting zombies (and hostile mobs in general) spawn during the daytime?

young knoll
#

Write your own spawning system

#

Or modify the game code

#

Or simulate daytime with player.setTime

candid galleon
#

I'm planning on taking the game code route

#

is there like a "canSpawn" method that I could override to return true regardless of light level?

young knoll
#

Probably

tranquil viper
#

theres probably a mobspawnevent of some type

young knoll
#

Yes but how will that help

tranquil viper
candid galleon
#

right, that's called when a mob spawns

tranquil viper
#

you can check if the mob is hostile

young knoll
#

But it won’t be called

candid galleon
#

right, but that won't be called during the day

tranquil viper
#

if it is then you can try overriding its spawn conditions

young knoll
#

Since the mob never spawns

tranquil viper
#

oh true

candid galleon
#

but it's never called because the server never spawns it

tranquil viper
#

hm

#

theres probably a way of overriding spawn conditiosn

candid galleon
#

must be, i just need to find it

young knoll
#

Like I said

#

write a spigot patch

#

Or re-implement all entities with a custom class that overrides the spawn check method

candid galleon
#

i'll probably go the latter route

#

just gotta find the spawn check method

tranquil viper
#

anyone know a secure way to give someone a token through console that they can connect with my discord bot?

paper viper
#

Uhh like encryption?

tranquil viper
#

yea

paper viper
#

you probably cant encrypt the packet

#

but you can encrypt the token

tranquil viper
#

im just trying to figure out how to communicate with my bot and my minecraft plugin

#

i think i can but its kinda difficult

stone light
#

So I'm creating a survival games plugin but when I run a server with the plugin I get this error, can anyone help me?

#

[20:44:01] [Server thread/ERROR]: Could not load 'plugins\TerrorGamesTest4.jar' in folder 'plugins'
org.bukkit.plugin.InvalidPluginException: Cannot find main class `io.github.nightterror04.Main'
at org.bukkit.plugin.java.PluginClassLoader.<init>(PluginClassLoader.java:66) ~[craftbukkit.jar:2991-Bukkit-f3f3094]
at org.bukkit.plugin.java.JavaPluginLoader.loadPlugin(JavaPluginLoader.java:133) ~[craftbukkit.jar:2991-Bukkit-f3f3094]
at org.bukkit.plugin.SimplePluginManager.loadPlugin(SimplePluginManager.java:393) ~[craftbukkit.jar:2991-Bukkit-f3f3094]
at org.bukkit.plugin.SimplePluginManager.loadPlugins(SimplePluginManager.java:301) ~[craftbukkit.jar:2991-Bukkit-f3f3094]
at org.bukkit.craftbukkit.v1_16_R3.CraftServer.loadPlugins(CraftServer.java:381) ~[craftbukkit.jar:2991-Bukkit-f3f3094]
at net.minecraft.server.v1_16_R3.DedicatedServer.init(DedicatedServer.java:179) ~[craftbukkit.jar:2991-Bukkit-f3f3094]
at net.minecraft.server.v1_16_R3.MinecraftServer.w(MinecraftServer.java:787) ~[craftbukkit.jar:2991-Bukkit-f3f3094]
at net.minecraft.server.v1_16_R3.MinecraftServer.lambda$0(MinecraftServer.java:155) ~[craftbukkit.jar:2991-Bukkit-f3f3094]
at java.lang.Thread.run(Thread.java:832) [?:?]
Caused by: java.lang.ClassNotFoundException: io.github.nightterror04.Main
at java.net.URLClassLoader.findClass(URLClassLoader.java:435) ~[?:?]
at org.bukkit.plugin.java.PluginClassLoader.findClass(PluginClassLoader.java:167) ~[craftbukkit.jar:2991-Bukkit-f3f3094]
at org.bukkit.plugin.java.PluginClassLoader.findClass(PluginClassLoader.java:96) ~[craftbukkit.jar:2991-Bukkit-f3f3094]
at java.lang.ClassLoader.loadClass(ClassLoader.java:589) ~[?:?]
at java.lang.ClassLoader.loadClass(ClassLoader.java:522) ~[?:?]
at java.lang.Class.forName0(Native Method) ~[?:?]
at java.lang.Class.forName(Class.java:468) ~[?:?]
at org.bukkit.plugin.java.PluginClassLoader.<init>(PluginClassLoader.java:64) ~[craftbukkit.jar:2991-Bukkit-f3f3094]

paper viper
#

means that the class cant be found

#

whats your plugin.yml

#

and screenshot your whole package structure thing with the classes

stone light
#

okay

#

this is my plugin.yml
name: TerrorGames
main: io.github.nightterror04.Main
api-version: 1.16
version: 1.0
load: POSTWORLD
description: >
A Plugin By NightTerror
commands:
tg:
description: Main command.
vote:
description: Vote command.
votestart:
description: Vote command.

#

and heres all the classes

#

I'm kinda new to this so I really don't know what I'm doing lol

paper viper
#

what the fuck

young knoll
#

Your plugin.yml points to an entirely different class

paper viper
#

and also your..

#

like why are you..

young knoll
#

Also java 7?

paper viper
#

your classes

young knoll
#

And decompilation artifacts

stone light
#

I think I got it now

#

but I jusy have one question should my api version be 1.16 or 1.16.5

#

because I've had people tell me both

young knoll
#

1.16

#

1.16.5 isn’t valid

stone light
#

okay thanks

sage swift
#

you should set it to 1.12.2

stone light
#

why?

sage swift
#

because 1.12 best vershun no lag!

subtle kite
stone light
#

interesting

sage swift
#

yes i make best plugine no lag alll asycn

#

server owner love me

stone light
#

but why would I want a 1.12.2 plugin on a 1.16.5 server?

young knoll
#

You wouldn’t

#

He’s just being a poor troll

stone light
#

yeah I think so

#

I changed the java version to JavaSE 1.8 is that the correct java version?

sage swift
#

im a rich troll wym

#

just cause i live under a bridge doesnt mean im poor

young knoll
#

1.8 is fairly standard for plugins, yes

#

Until 1.17 that is

sage swift
#

he said it himself ladies and gentlemen 1.8 is the best version

young knoll
#

Java 1.8

sage swift
#

context is not applicable

stone light
#

yeah so I changed my main I figured out I had that wrong and now its pointing to the same place all my classes are in and so I'm gonna try to run the server again and hope it works

young knoll
#

For some reason Java has several names for their versions

#

Java 8, 1.8, class version 55

#

Although no one really uses class version in conversation

stone light
#

also everytime I export I get this warning does it mean anything?
JAR export finished with warnings. See details for additional information.
TerrorGames/META-INF/MANIFEST.MF was replaced by the generated MANIFEST.MF and is no longer in the JAR.
Problem writing TerrorGames/module-info.class to JAR: duplicate entry: module-info.class
duplicate entry: module-info.class

subtle kite
#

do you have your output of the new .jar in your plugin folder for the server

#

I think that is just telling you you are just overriding the new plugin.jar

#

?

stone light
#

no its in the spigot api folder

#

But now I'm getting an entirely different error
Fatal error trying to convert TerrorGames v1.0:me/TerrorGames/SurvivalGames/Main.class

#

should I just send the entire lastest.log for the server? Feel Free to ping me if you read it

#

Well its here now if someone wants to read it

sinful python
#

Simple question but if I want to add a text file for settings for my plugin, under which file would I create the text file?

young knoll
#

I would use the config API

#

Config files go in the same place as the plugin.yml

coral sparrow
young knoll
#

In this case, yes

summer scroll
#

Unrelated but, do you guys know any text generators that can do this?

______
(____ \\
 ____)  ) ___   ___  ___ 
|  __  ( / _ \\ /___)/___)
| |__)  ) |_| |___ |___ |
|______/ \\___/(___/(___/
bold parcel
#

is entity.hasLineOfSight(other) an method that can be called async without worries?

sage swift
#

probably

#

a lot of stuff can

#

🙊

#

hehe, monke

bold parcel
#

thx

silk mirage
#

What is the best way to check if the given item is a hoe?

coral sparrow
#

if (player.getInventory().contains(item,1){} ig

#

btw does getClickedBlock() exist in 1.8?

silk mirage
#

i don't mean that

#

I'll need to check for EVERY SINGLE Item if i do so, DIAMOND_HOE, IRON_HOE etc..

#

I just want to check if the item is hoe

covert bluff
#
EZAfkCommand afkCommand = new EZAfkCommand();

    Team afkTeam = afkCommand.getTeam();

    @EventHandler
    public void onEntityDamage(EntityDamageEvent event) {
        if (event.getEntity() instanceof Player) {

        }
#

since I can't access afkCommand.getTeam() without making it static and can't return the team in the afkCommand class without making it static and can't get the team without making it static

#

is it fine if i do this?

summer scroll
covert bluff
#

can anyone answer my question

covert bluff
#

I just want to make sure that this method is not a bad idea

#

I am doing the same for 2 more listener classes

summer scroll
covert bluff
#

basically making an afk plugin

summer scroll
#

and every afk player will be stored in that class?

covert bluff
#
package me.notprankster.ezafkplugin.events;

import me.notprankster.ezafkplugin.commands.EZAfkCommand;
import org.bukkit.ChatColor;
import org.bukkit.entity.Entity;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.entity.EntityDamageByEntityEvent;
import org.bukkit.event.entity.EntityDamageEvent;
import org.bukkit.scoreboard.Team;

public class PlayerDamageListener implements Listener {

    EZAfkCommand afkCommand = new EZAfkCommand();

    Team afkTeam = afkCommand.getTeam();

    @EventHandler
    public void onEntityDamage(EntityDamageEvent event) {
        EntityDamageByEntityEvent entityEvent = null;

        if (event.getCause().equals(EntityDamageEvent.DamageCause.ENTITY_ATTACK)) {
            entityEvent = (EntityDamageByEntityEvent) event;
        }


        if (event.getEntity() instanceof Player) {
            if (afkTeam.hasEntry(event.getEntity().getName())) {
                event.setCancelled(true);

                if (entityEvent != null) {
                    Entity damager = entityEvent.getDamager();

                    assert damager instanceof Player;

                    Player damager2 = (Player) damager;
                    damager2.sendMessage(ChatColor.RED + "" + ChatColor.BOLD + "That player is AFK!");

                }
            }
        }
    }
}

this is the code now for the code i sent earlier

covert bluff
#
package me.notprankster.ezafkplugin.commands;

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.scoreboard.Scoreboard;
import org.bukkit.scoreboard.ScoreboardManager;
import org.bukkit.scoreboard.Team;

public class EZAfkCommand implements CommandExecutor {

    ScoreboardManager sbManager = Bukkit.getScoreboardManager();
    Scoreboard sb = sbManager.getNewScoreboard();

    Team afkTeam = sb.getTeam("AFK");

    public Team getTeam() {
        return this.afkTeam;
    }


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

        if (sender instanceof Player) {
            Player p = (Player) sender;

            if (afkTeam == null) {
                afkTeam = sb.registerNewTeam("AFK");
                afkTeam.setSuffix(ChatColor.translateAlternateColorCodes('&'," &c&b*AFK*"));
            }

            if (afkTeam.hasEntry(p.getName())) {
                afkTeam.removeEntry(p.getName());
                p.sendMessage(ChatColor.GRAY + "You are no longer AFK.");

            } else {
                afkTeam.addEntry(p.getName());
                p.sendMessage(ChatColor.GRAY + "You are now AFK.");
            }
        } else {
            sender.sendMessage(ChatColor.RED + "The console can't be AFK, silly!");
            return false;
        }

        return true;
    }
}
#

this is the code for EZAfkCommand

summer scroll
#

okay, don't do that.

covert bluff
#

what should i do?

summer scroll
#

create like a manager class

covert bluff
#

manager class?

#

can you give an example

summer scroll
#

okay so create a class

#

and then do the same thing that you do on the EZAfkCommand class.

#

the scoreboard team

covert bluff
#

okay

#

then i can do new class() just fine?

#

or do i make it static

summer scroll
#

no, you will only do that once

#

on the main class.

#

and then you will use getter

covert bluff
#

i do new managerclass() on the main class

#

and then i make a getter method?

#

then that's how i will obtain the team?

summer scroll
#

create a getter for the team on the manager class

#

so

#

mainClass.getAFKManager().getTeam()

covert bluff
#

ok, i'll try that out

#

i will do new getAFKManager() on main class once only right?

summer scroll
#

yes.

covert bluff
#

then that's what i'll return on getAFKManager()

#

ok, thanks

quaint mantle
#

How do I get the block with the sign on it?

#

for example, i want to get this chest

eternal oxide
#

Do you have the sign as a reference?

quaint mantle
#

ye

quaint mantle
#

thanks you but Bukkit.broadcastMessage(((FaceAttachable) event.getBlock()).getAttachedFace() + ""); doesn't work

#

ah

#

uh getFace returns blockface

#

I want to get block with the sign

eternal oxide
#

use Directional#getFacing().getOppositeFace()

quaint mantle
#

ah

eternal oxide
#

yes, you do getRelative on the sign

#
Block signBlock = event.getBlock();
Block chestBlock = signBlock.getRelative( ((Directional) signBlock.getBlockData()).getFacing().getOppositeFace());```
quaint mantle
#

hm

#

SignBlock class doesn't exists

#

getRelative method doesn't exists in Sign class

eternal oxide
#

of course not, thats your sign

quaint mantle
#

ye

#

it doesn't exists

eternal oxide
#

teh Block that is the sign

quaint mantle
#

((Sign) event.getBlock()).getR

eternal oxide
#

getLocation().getRelative

#

um, no, getRelative is for Block

quaint mantle
#

.getRelative doesn't exists in location xD

eternal oxide
#

getRelative IS on Block

quaint mantle
#

okay sorry

quaint mantle
#

thanks you!

#

how to get BlockFace? ((Block) event.getBlock)).getBlockFace, event.getBlock().getBlockFace() doesn't exists

eternal oxide
#

I updated the code above

#

you don;t cast to block

covert bluff
#

Caused by: java.lang.NullPointerException
at me.notprankster.ezafkplugin.EZAfkManager.<init>(EZAfkManager.java:10) ~[?:?]
at me.notprankster.ezafkplugin.EZAfkPlugin.<clinit>(EZAfkPlugin.java:11) ~[?:?]
at java.lang.Class.forName0(Native Method) ~[?:1.8.0_291]
at java.lang.Class.forName(Unknown Source) ~[?:1.8.0_291]
at org.bukkit.plugin.java.PluginClassLoader.<init>(PluginClassLoader.java:79) ~[patched_1.16.5.jar:git-Paper-645]
at org.bukkit.plugin.java.JavaPluginLoader.loadPlugin(JavaPluginLoader.java:137) ~[patched_1.16.5.jar:git-Paper-645]
... 7 more

#

this is line 9-11 of ezafkmanger

public class EZAfkManager {
    ScoreboardManager sbManager = EZAfkPlugin.instance.getServer().getScoreboardManager();
    Scoreboard sb = sbManager.getMainScoreboard();
#

and line 10-15 of ezafk plugin

public final class EZAfkPlugin extends JavaPlugin {
    public static EZAfkManager AFKManager = new EZAfkManager();

    public static Team getTeam(){
        return AFKManager.getTeam();
    }
#

why is that error happening?

quaint mantle
#

ty!

eternal oxide
#

Your instance field is not set when you try to create your EZAfkManager.

covert bluff
#

what is instance field

eternal oxide
#

EZAfkPlugin.instance

covert bluff
#

the error happened

#

way before i did that

#

this is instance

#

    public static Plugin instance;

    @Override
    public void onEnable() {
        // Plugin startup logic
        instance = (Plugin) this;
        getCommand("afk").setExecutor(new EZAfkCommand());
        getServer().getPluginManager().registerEvents(new PlayerDamageListener(), this);
        getServer().getPluginManager().registerEvents(new PlayerMoveListener(), this);
    }
#

and the erorr happened before i added instance variable

#

so that's not the problem

eternal oxide
#

You are creating static fields which are created before onEnable ever runs

#

instance is null

covert bluff
#

how? iset its value to (Plugin) this inside of onEnable()

eternal oxide
#

are you not reading what I write?

#

ElgarL: You are creating static fields which are created before onEnable ever runs

covert bluff
#

yes but you specifically said instance is null

#

when i've done it before and there was no problem

eternal oxide
#

yes, you set instance IN your onEnable

#

that code has not yet been executed so your instance field is still null when you try to create your manager class.

covert bluff
#

ohhh

#

so does declaring the static fields below onEnable() and onDisable() make a difference

eternal oxide
#

no

covert bluff
#

or should i declare it inside onEnable()

#

actually

#

declare outside

#

but set value insinde onEnable()

eternal oxide
#

you can declare teh field, then initialize it in onEnable

covert bluff
#

like what i did with isntance

#

okay

eternal oxide
#

yes

covert bluff
#

?

#
[13:57:22 ERROR]: Error occurred while enabling EzAFK v1.0-SNAPSHOT (Is it up to date?)
java.lang.NullPointerException: null
        at me.notprankster.ezafkplugin.EZAfkPlugin.getTeam(EZAfkPlugin.java:14) ~[?:?]
        at me.notprankster.ezafkplugin.commands.EZAfkCommand.<init>(EZAfkCommand.java:17) ~[?:?]
        at me.notprankster.ezafkplugin.EZAfkPlugin.onEnable(EZAfkPlugin.java:22) ~[?:?]
        at org.bukkit.plugin.java.JavaPlugin.setEnabled(JavaPlugin.java:263) ~[patched_1.16.5.jar:git-Paper-645]
        at org.bukkit.plugin.java.JavaPluginLoader.enablePlugin(JavaPluginLoader.java:380) ~[patched_1.16.5.jar:git-Paper-645]
somber hull
#

Any idea why this doesnt reload the config

if (args[0].equalsIgnoreCase("reload")) {
  if (!(plr.hasPermission("safecheck.reload")) || !(plr.hasPermission("safecheck.admin")))
   return true;
plugin.reloadConfig();
plr.sendMessage(
    ChatColor.translateAlternateColorCodes('&', plugin.getConfig().getString("reloadmessage")));
   return true;

it sends the reload message
But anything i change in the config it doesnt change in-game

covert bluff
#

are you sure oyu have the perms

#

wait nvm

tacit drift
#

what is it

jolly hatch
#

Hey can somone help me troubleshoot GSON?

#
java.lang.NullPointerException: Cannot invoke "com.putopug.cmdui.config.Slots.getSlots()" because "com.putopug.cmdui.config.DeJsonizer.slts" is null
    at com.putopug.cmdui.Inventory.init(Inventory.java:17) ~[?:?]
    at com.putopug.cmdui.config.DeJsonizer.init(DeJsonizer.java:23) ~[?:?]
    at com.putopug.cmdui.CmdUI.onEnable(CmdUI.java:14) ~[?:?]
    at org.bukkit.plugin.java.JavaPlugin.setEnabled(JavaPlugin.java:263) ~[patched_1.16.5.jar:git-Paper-683]
    at org.bukkit.plugin.java.JavaPluginLoader.enablePlugin(JavaPluginLoader.java:364) ~[patched_1.16.5.jar:git-Paper-683]
    at org.bukkit.plugin.SimplePluginManager.enablePlugin(SimplePluginManager.java:483) ~[patched_1.16.5.jar:git-Paper-683]
    at org.bukkit.craftbukkit.v1_16_R3.CraftServer.enablePlugin(CraftServer.java:501) ~[patched_1.16.5.jar:git-Paper-683]
    at org.bukkit.craftbukkit.v1_16_R3.CraftServer.enablePlugins(CraftServer.java:415) ~[patched_1.16.5.jar:git-Paper-683]
    at net.minecraft.server.v1_16_R3.MinecraftServer.loadWorld(MinecraftServer.java:592) ~[patched_1.16.5.jar:git-Paper-683]
    at net.minecraft.server.v1_16_R3.DedicatedServer.init(DedicatedServer.java:281) ~[patched_1.16.5.jar:git-Paper-683]
    at net.minecraft.server.v1_16_R3.MinecraftServer.w(MinecraftServer.java:1066) ~[patched_1.16.5.jar:git-Paper-683]
    at net.minecraft.server.v1_16_R3.MinecraftServer.lambda$a$0(MinecraftServer.java:290) ~[patched_1.16.5.jar:git-Paper-683]
    at java.lang.Thread.run(Thread.java:831) [?:?]

is the NPE i get

#

and ive trieed literally everything

covert bluff
#

but then i ran into another problem

#
[14:11:38 ERROR]: Could not pass event PlayerMoveEvent to EzAFK v1.0-SNAPSHOT
java.lang.NullPointerException: null
        at me.notprankster.ezafkplugin.events.PlayerMoveListener.onPlayerMove(PlayerMoveListener.java:21) ~[?:?]
#

if (afkTeam.hasEntry(p.getName())) {

#

this is line 21

#

this is afkTeam Team afkTeam = EZAfkPlugin.afkTeam;

#

main class

public final class EZAfkPlugin extends JavaPlugin {
    public static EZAfkManager AFKManager;

    public static Team afkTeam;
    public static Plugin instance;

    @Override
    public void onEnable() {
        // Plugin startup logic
        instance = (Plugin) this;
        getCommand("afk").setExecutor(new EZAfkCommand());
        getServer().getPluginManager().registerEvents(new PlayerDamageListener(), this);
        getServer().getPluginManager().registerEvents(new PlayerMoveListener(), this);
        AFKManager = new EZAfkManager();
        afkTeam = AFKManager.getTeam();
    }
#

and afkmanager

#
public class EZAfkManager {
    ScoreboardManager sbManager = Bukkit.getServer().getScoreboardManager();
    Scoreboard sb = sbManager.getMainScoreboard();

    Team afkTeam = sb.getTeam("AFK");

    public Team getTeam() {
        if (afkTeam == null) {
            afkTeam = sb.registerNewTeam("AFK");
            afkTeam.setSuffix(ChatColor.RED + "" + ChatColor.BOLD + "*AFK*");
        }

        return afkTeam;
    }

quaint mantle
#

Hi I wanted to create a placeholder that removes commas from a number in a placeholder, short words, there is a placeholder and I want to remove the commas, you can do it in JavaScript, Thanks !!

covert bluff
candid galleon
#

do WeakHashMaps work with Spigot?

quaint mantle
candid galleon
#

like will a UUID, Long map be auto GCs'd?

quaint mantle
coral sparrow
#

How to check if player clicked an itemin the inventory

hybrid spoke
quaint mantle
#

InventoryClickEvent

covert bluff
candid galleon
#

no like entries inside of it

covert bluff
#

what xale said

hybrid spoke
hybrid spoke
#

and nothing refers to it

coral sparrow
#

like

#

getClickedBlock doesntexist in 1.8

hybrid spoke
hybrid spoke
#

its #getItem

hybrid spoke
covert bluff
#

nope, they are online

#

its me actually

#

i connected through localhost

#

does this have anything to do with the player being offline?

hybrid spoke
#

if he would be offline the name would be null

#

otherwise what is AFKManager.getTeam?

covert bluff
#

basically, i am making an afk plugin

#

this is afk manager

#
package me.notprankster.ezafkplugin;

import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.scoreboard.Scoreboard;
import org.bukkit.scoreboard.ScoreboardManager;
import org.bukkit.scoreboard.Team;

public class EZAfkManager {
    ScoreboardManager sbManager = Bukkit.getServer().getScoreboardManager();
    Scoreboard sb = sbManager.getMainScoreboard();

    Team afkTeam = sb.getTeam("AFK");

    public Team getTeam() {
        if (afkTeam == null) {
            afkTeam = sb.registerNewTeam("AFK");
            afkTeam.setSuffix(ChatColor.RED + "" + ChatColor.BOLD + "*AFK*");
        }

        return afkTeam;
    }
}

#

i was told earlier that i should do this, since my last method was just doing new class() every time i wnated to obtain the team

hybrid spoke
#

does a team named "AFK" exist?

covert bluff
#

Yes

#

i checked if afkTeam is null as well in the AFKManager class, and if it was, create it and then set afkTeam's value to it

#

and then return that

#

i've also done /team list

#

and it does exist

#

14:11:44 INFO]: llaFoTdiaL lost connection: Disconnected
[14:11:45 INFO]: llaFoTdiaL left the game

team list
[14:11:57 INFO]: There are 1 teams: [AFK]

hybrid spoke
#

how does your MoveListener look?

covert bluff
#
package me.notprankster.ezafkplugin.events;

import me.notprankster.ezafkplugin.EZAfkPlugin;
import me.notprankster.ezafkplugin.commands.EZAfkCommand;
import org.bukkit.ChatColor;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.player.PlayerMoveEvent;
import org.bukkit.scoreboard.Team;

public class PlayerMoveListener implements Listener {

    EZAfkCommand afkCommand = new EZAfkCommand();
    Team afkTeam = EZAfkPlugin.afkTeam;

    @EventHandler
    public void onPlayerMove(PlayerMoveEvent event) {
        Player p = event.getPlayer();

        if (afkTeam.hasEntry(p.getName())) {
            afkTeam.removeEntry(p.getName());
            p.sendMessage(ChatColor.GRAY + "You are no longer AFK.");
        }
    }
}

#

the error is at if (afkTeam.hasEntry(p.getName())))

hybrid spoke
#

try to use your nullsafe method

covert bluff
#

nullsafe method?

hybrid spoke
#

getTeam

covert bluff
#

i did that but it caused errors

#

so i had to make it a variable instead

hybrid spoke
#

instead of the var itself

covert bluff
#

i couldn't declare functions/methods and initiliase them somewhere

#

cause if i did declare and initiliase them way before plugin enables an error is caused

summer scroll
coral sparrow
#

will this work xd

summer scroll
#

@covert bluff

public class AFKManager{
  private Team team;
  
  // Call this method on startup
  public void initializeTeam(){
    ScoreboardManager sbManager = Bukkit.getServer().getScoreboardManager();
    Scoreboard sb = sbManager.getMainScoreboard();
    team = sb.getTeam("AFK");
  }

}
hybrid spoke
#

maybe you should also get away from using static @covert bluff

#

encapsulate instead

summer scroll
#

i told you to use getter, not static

covert bluff
#

without making the method static

summer scroll
#

and then create a getter for AFKManager in the main class.

covert bluff
#

i did

#

what next

summer scroll
#

do you know dependency injection?

covert bluff
#

i've heard of it, but i haven't learnt of it much

#

it's what was suggested to me back when i was trying to make a duels plugin

#

i don't really know much of it

summer scroll
#

it's basically passing an object thru class constructor.