#help-development

1 messages · Page 1786 of 1

neon storm
#

How do I convert from a DyeColor to a ChatColor?

west oxide
#

i made evil pigs

opal juniper
#

you dont...

#

or

#

use #valueOf

west oxide
stone sinew
tardy delta
west oxide
#

import org.bukkit.command.CommandExecutor;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.PigZombie;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.entity.EntityDamageByEntityEvent;

import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;

public class Pig implements Listener {



    @EventHandler
public static void onPigHit (EntityDamageByEntityEvent event){
        ArrayList<String> message = new ArrayList<>();
        message.add("fuck you!");
        message.add("you are stupid!");
        message.add("ok can you just leave me alone -.-");
        message.add("i hope you die!");
        message.add("i will destroy your life!");
        message.add("i hate you so much");
        Collections.shuffle(message);

        if(event.getDamager() instanceof Player){
                if(event.getEntityType() == EntityType.COW) {
                    message.add("I am Cow");
                    event.getDamager().sendMessage(message.get(1));
                }
                if(event.getEntityType() == EntityType.PIG) {
                    message.add("I am Pig");
                    event.getDamager().sendMessage(message.get(1));
                }
                else{
                    return;
                }
            }
        }

}
#

this is the code i used

quaint mantle
#

now make item attack players

tardy delta
#

I am cow

paper viper
#

Arrays.asList

tardy delta
#

says the pig

#

ah nvm

neon storm
# opal juniper use #valueOf

ok, this might work

ChatColor.valueOf(sign.getColor().toString())

But that's stupid; ChatColor#valueOf() is also depricated

west oxide
tardy delta
#

brrr

#

nap time

west oxide
#

gn(ap)

spare kestrel
#

Hello everyone i hope your all doing good, i have a little question : how can i change the color of the player name above the player head ? i read team will help but it doesn't ...

west oxide
spare kestrel
#

thanks

foggy estuary
#

?paste

undone axleBOT
foggy estuary
#
final Score score = plugin.o.getScore(Bukkit.getOfflinePlayer(ChatColor.GREEN + "Time:"); //Making a offline player called "Time:" with a green name and adding it to the scoreboard
score.setScore(countdown); ```
#

if(Bukkit.getOnlinePlayers().length == 4) {

late sonnet
foggy estuary
#

i removed

#

what about the length

late sonnet
foggy estuary
#

its in red

young knoll
#

It's a collection

#

.size()

foggy estuary
#

ok ty

lean gull
#

can anyone help?

ember estuary
#

is there any shorter way to do this: Math.signum(-x)*(360-Math.abs(x))

late sonnet
# lean gull can anyone help?

you create the class GamerulesCommand and set the plugin instance.. but when register the command you create another instance of GamerulesCommand with not plugin instance set

ember estuary
late sonnet
#

try making a contructor in the command for pass the plugin instance

lean gull
#

wait is it supposed to work now then

#

oh ok it works now, thanks

west oxide
#

hey am still struggling to get this :

  test: testv12
  test2: test2
  test3: test3

i have this in a custom config file and i want to get the keys test test2 test3 and send them to player

#

o.o

#

idk how to do it

young knoll
#

YamlConfiguration#getConfigurationSection("Tags")#getKeys(false)

west oxide
#

ok i will try that thank you

#

:o IT WORKED

#

thank you

#

how can i store them in an array ?

young knoll
#

It returns a list iirc

#

You can toArray that list

lean gull
#

what's better for my server? having one method that checks for 30-ish different things, or having 30-ish methods

#

like which one would lag less

young knoll
#

Are they being run at the same time regardless

lean gull
#

wdym

young knoll
#

Is it 1 big method being run vs 30 methods being run at the same time

#

Or are the 30 methods spread out

west oxide
lean gull
#

basically i have this gui, in this gui there are toggleable things, to make them toggleable, i have to run a method of some sort to check if it's on or off, and act accordingly

#

so should i have 30 methods (1 per toggleable thing), or should i have 1 method where you can input text that will then run like 30 if statements and will find the one i need

young knoll
young knoll
#

The difference between the two is very minimal, do whichever is cleaner and easier to read

lean gull
#

i guess i'll do 30 methods then

#

wait, do you have a better way of doing it?

ember estuary
#

@lean gull just use an array or map

lean gull
#

wdym

ember estuary
#

in which you store the boolean for each button

lean gull
#

no it's with gamerules, i'm making a gamerules gui

#

so like announceAdvancements, that's toggleable

ember estuary
#

ah

lean gull
#

and then commandBlockOutput

#

so like each toggleable gamerule would have a true item, and a false item

ember estuary
#

two items per gamerule?

lean gull
#

well not exactly

ember estuary
#

why not just one boolean that says true or false?

#

for each gamerule

lean gull
#

wym

#

wdym*

#

i don't need to store whether the gamerules are true or false

ember estuary
#

wait wym with item

lean gull
#

all i need to do is have a gui that can toggle them

ember estuary
#

and you want to have two buttons, one for on and one for off?

lean gull
#

the storing whether it's true or false is already done by minecraft, i just set the gamerules

ember estuary
#

instead off a toggle

lean gull
#

no

#

if it's true, then you will have an off button

#

if it's false, you will have a true button

ember estuary
#

i see

#

is there a way to loop over gamerules?

lean gull
#

well each item is gonna have it's own lore, explaining what it does

#

so i think it's best if i just have like the lore, and then i create the item with 2 different items if it's true or false

ember estuary
#

So you basically then have a list of <your class that contains the gamerule name and the lore>

young knoll
#

If you only care about true/false ones I can think of an easy way to do it

lean gull
#

nvm i'll just do it my way, thanks tho

ember estuary
#

just loop over all gamerules and if true : red wool, if false: green wool

#

u dont need 30 ifs for that

lean gull
#

ye but i want it to look pretty

#

also i'm not gonna use 30 ifs, i'm gonna use 30 methods

crimson terrace
ember estuary
#

kind of the same xD

#

same level of badness

crimson terrace
#

use a switch case

#

its prettier

ember estuary
#

^

lean gull
#

wat dat

ember estuary
#

new feature

#

switch with method

crimson terrace
#

switch(){
}

lean gull
#

huh

young knoll
#

Make a list of gamerules and get the one you want to edit based on the index of the clicked slot

ember estuary
#

oh thats the problem?

#

xD

crimson terrace
#

let me look up the proper way to code it into the switch

ember estuary
#

just do it your way and then we can compact it, alright iDerpy?

lean gull
#

ok

#

i'll do like 3 for an example

crimson terrace
#

yeah

#

thats good

ember estuary
#

yeah

lean gull
#

thanks btw

ember estuary
#

no problem, thats what i'm here for

crimson terrace
#

same

ember estuary
#

(and to ask stupid questions myself)

#

xD

crimson terrace
#

give and take, isnt it

lean gull
#

u two are way better than the normal people around here

ember estuary
#

yeah

#

haha ty

crimson terrace
lean gull
crimson terrace
#

😄

ember estuary
#

true :D

#

but dont ask them on stackoverflow, they dislike the hell out of you

#

if ur a beginner

misty current
#

how does getNearbyEntities work? what parameters does it need?

#

the param names are not very explicative

lean gull
#

i just ask here, since u get answers quickly instead of having to refresh the page every 5 minutes

#

also i don't think many people even use forums and stuff

ember estuary
#

i think its the radius

misty current
#

i mean what do the parameters do

ember estuary
#

how far in each direction

crimson terrace
#

you give it an X, Y and Z and it will give you all the entities within that radius

misty current
#

ah so it's a cube

ember estuary
#

its like a cube around the entity

#

yea

crimson terrace
#

a cube if all the parameters are the same

ember estuary
#

i assume. never used it. xD

#

well yeah

misty current
#

yea i meant a cubic shape

ember estuary
#

a 3D rectangle or whatever u call it

misty current
#

can you get them in a circle?

lean gull
#

c u b e

crimson terrace
ember estuary
#

isnt a cube same length on all sied? xD

ember estuary
lean gull
#

o wait u said rectangle

#

i keep confusing squares and rectangles

crimson terrace
#

squares are rectangles

ember estuary
#

nvm, that function only exists in the client, not in server

misty current
#

:c

lean gull
#

ye but squares are rectangles that are even on all sides

ember estuary
#

want me to write u the function?

lean gull
#

so like a cube in this case can't be a 3d rectangle

misty current
#

i thought of looping every entity and checking the distance from location

crimson terrace
#

a rectangle is a shape with 4 sides which only has 90° angles

misty current
#

is there a better way?

lean gull
#

it is?

lean gull
#

i stand corrected then

ember estuary
#

yes there is

young knoll
#

Loop all entities in the world and use distanceSquared

ember estuary
#

loop every entity thats in the box

young knoll
#

Actually

ember estuary
#

less entities to loop over

crimson terrace
#

might wanna limit it to LivingEntities if your application allows it

misty current
#

oh ye

young knoll
#

Loop every entity in the box and then use distanceSquared

ember estuary
#

so first getNearbyEntities

crimson terrace
misty current
#

issue is i might need it around a location too

ember estuary
#

and then distancesquared

#

ah

young knoll
#

Location.getNearbyEntities exists

misty current
#

and it doesn't have that method

#

wait really

young knoll
#

Actually it may be world

#

Hol on

crimson terrace
misty current
#

yea

#

world

crimson terrace
young knoll
#

Yeah

#

location.getWorld()

crimson terrace
#

you can do location.getWorld().getNearbyEntities()

#

in case you need to match worlds with a certain entity

misty current
#

yea and then i check the distance to make it a circle

young knoll
#

mhm

ember estuary
#

yeah

misty current
#

aight tyy

ember estuary
#

np

#

How can i force someone to override a method when he extends a class

jade perch
#

Using circles in a square game is cursed

young knoll
#

Use an abstract class

quaint mantle
young knoll
#

And make the method abstract

ember estuary
#

ah thats what abstract is for

misty current
#

make class and method abstract

ember estuary
#

3 years of java and never used it

misty current
#

oh someone told already

lean gull
#

how does one make a field variable for a spesific method that deletes itself after it's used?

misty current
ember estuary
#

xD

crimson terrace
misty current
#

i don't need it that often tho

#

i usually just use interfaces

quaint mantle
#

you are you probably did something wrong if you never used them

ember estuary
#

:(

lean gull
#

the thing that actually creates it is in 2 if statements, so i need to make a field in the method, set it in one of the if statements, then return it

misty current
#

oh nvm i used it in my commandbuilder

ember estuary
#

show ur code so i can understand better xD

lean gull
#

me?

crimson terrace
ember estuary
#

yeah

ember estuary
lean gull
misty current
#

no

#

i cry

ember estuary
#

xD

misty current
#

:c

#

wanna see how my enchants work?

quaint mantle
#

rewrite your plugin from zero
rewrite your plugin from zero

misty current
#

all abstraction

#

^

misty current
# misty current wanna see how my enchants work?
public class Blaze implements AttackEnchant, ChanceEnchant {

    @Override
    public String getId() {
        return "blaze";
    }

    @Override
    public String getDisplayName() {
        return "Blaze";
    }

    @Override
    public String getDescription() {
        return "Chance to burn all enemies in an area of the victim.";
    }

    @Override
    public int getMaxLevel() {
        return 3;
    }

    @Override
    public EnchantRarity getRarity() {
        return EnchantRarity.ELITE;
    }

    @Override
    public EnchantType getType() {
        return EnchantType.AXE;
    }


    @Override
    public void onAttack(@NotNull AttackWrapper wrapper, int level) {

    }

    @Override
    public List<Double> getChances() {
        return Arrays.asList(2.0, 3.0, 4.0);
    }
}
``` very abstract
ivory sleet
#

static => global access => less lines of code => efficienancnecy? (/s)

crimson terrace
#

yuss

jade perch
#

If your 50 line classes don't turn into 1000 lines of bytecode it's not abstract enough

ember estuary
crimson terrace
quaint mantle
#

I oftenly use abstract classes to share common stuff between interface implementations

crimson terrace
#

because the announceAdvancementsItem goes into the trash collector after being used.

lean gull
#

i'm trying my best to not use a lot of storage, so what i want to do is make the item, return it, and then delete the variable of the item so it's not going to take up more storage

young knoll
#

My enchantments are abstracted out of Java code :p

ivory sleet
#

I rarely actually use abstract classes, mostly interfaces and then concrete classes with strategies

misty current
#

^

ember estuary
#

ah i see

lean gull
#

or well atleast delete the variable for the method, not for where i need it to be returned

misty current
#

sometimes tho i need abstract classes

crimson terrace
lean gull
#

so i should just use a normal field for every gamerule?

misty current
#

tho now that i discovered interfaces have default methods

ember estuary
#

iDerp, your variable is just a reference to a memory adress

misty current
#

i'd rather use them

ember estuary
#

no need to delete it

#

if you pass it on

misty current
#

well actually depends

ember estuary
#

its not a primitive

#

so its gotta be

lean gull
#

me no big brain help me no understanddd

quaint mantle
#

you cant have fields on interfaces though

young knoll
lean gull
#

a

ember estuary
#

u no need delete

lean gull
#

ok!

ember estuary
#

xD

crimson terrace
#

you are referencing a memory adress, the memory adress contains the value. when dereferenced (after the method is through) it will be used for something else

lean gull
#

so normal field outside a method?

ember estuary
#

when you return your arraylist, it doesnt get duplicated

#

so therefore no need to delete it in that method

#

what you actually return (under the hood) is just the memory adress the arraylist is saved at, and not a copy of the arraylist.

young knoll
#

This is the case for all Objects in java afaik

#

But not primitives

ember estuary
#

yea

misty current
#

found it very useful recently

crimson terrace
misty current
#

passing objects like events in parameters and cancelling them in the method

#

as an example

young knoll
#

If you pass an integer into a method, and then add 7 to it

#

The original integer you passed in will not change

ember estuary
crimson terrace
#

primitives dont have classes is what Im coming up with myself

quaint mantle
#

for Obejcts, you pass a reference to it. On primitives, you pass the actual value

candid galleon
#

and mutable and immutable

ember estuary
#

primitives dont extends the Object class

#

rest does

#

i think

quaint mantle
ember estuary
#

xD

crimson terrace
#

Integer.class

young knoll
#

Integer.class != int.class

crimson terrace
#

😛 basically the same lol

#

just Integer can be used in hashmaps

young knoll
#

Does primitive.class just return the wrapper class? I actually have no idea

ivory sleet
#

Nope

misty current
ivory sleet
#

it returns a special class instance representing the primitive data type

young knoll
#

Interesting

ivory sleet
#

ye

ember estuary
#

o.O

crimson terrace
visual tide
#

is there a way to check if a command from PlayerCommandPreprocessEvent actually is the command i want for /namespace:command and aliases?
or do i just have to check them manually

crimson terrace
#

lmao

misty current
#

primitive wrappers also have util methods and constants

#

like max and min values

ivory sleet
#

yuh

misty current
#

or methods like isNaN

#

and so on

lean gull
#

how 2 get opened gui of a player

quaint mantle
#

Integer is a wrapper around int that extends Object, so you can use ints in context where Object is required like hash maps

misty current
#

Player#getInventory()

lean gull
#

but dat is their inventory, not the top part

misty current
#

getcurrentinventory*

#

or something similar

young knoll
#

getOpenInventory iirc

visual tide
#

player.getOpenInventory().getTopInventory()

misty current
#

yea i went to check and was abt to say that

visual tide
#

or bottom for their actual inv

misty current
#

me too slow :c

young knoll
#

Iirc you have to do it manually

ember estuary
#

why the heck do you have to use e.getEntity() in the PLAYERDeathEvent

visual tide
young knoll
#

Because it extends EntityEvent

#

Because it is just an extension of EntityDeathEvent

ember estuary
#

oh

#

i see

misty current
#

are the params in getNearbyEntities the length of the cube? in that case i'd need to double the radius to make them

#

wouldn't I

ember estuary
#

i think radius

#

but im not sure

misty current
#

so no multiplying

crimson terrace
misty current
#

o ye

#

so no multiplying

crimson terrace
#

its not radius

#

or am I just misreading it

ember estuary
#

x - 1/2 the size of the box along x axis

#

its the radius

#

no multiplying by 2

misty current
#

it says the params are half the cuboid size

ember estuary
#

simply the radius

misty current
#

so if i input the radius it multiplies by 2 itself

#

and makes a full side of the cuboid

ember estuary
#

yeah, the side length will be radius*2

crimson terrace
#

because it goes into positive X AND negative X the same amount

#

and thats the same for the other 2 parameters too

#

so if you enter getNearbyEntities(5,3,10) you will get a box around the center with the size of 10, 6 and 20

misty current
#

yea that's what we are saying

#

so i need to input the radius

young knoll
#

mhm

crimson terrace
#

radius makes it sound like a circle

#

but yes

misty current
#

yea i mean i need to input the radius of my circle

crimson terrace
#

its a box

misty current
#

did you read what i'm tryna do

#

get the entities in a radius from a location

#

i get the entities in the box

#

and check if they are in a circle radius

crimson terrace
#

oh I seem to have missed that

misty current
#

that's why i was saying radius

crimson terrace
#

sadly getNearbyEntities is in a black box.... cant see the implementation or I could tell you wether its worth getting that first. might actually loop through all entities in the world and select the ones close enough to be inside

lean gull
#

ok i have finished one toggleable thingy

#

if anyone can help me make it better, and less laggy since i need to make a lot of methods simillar to this one then that would be great, thank you!
https://paste.md-5.net/torozeboze.cs

young knoll
#

I mean it isn't in a black box

#

Spigot is OS

#

Also this is java so you can decompile things

crimson terrace
#

didnt wanna do work but youre making me do work

misty current
#
    public Collection<Entity> getNearbyEntities(Location location, double x, double y, double z) {
        if (location != null && location.getWorld().equals(this)) {
            AxisAlignedBB bb = new AxisAlignedBB(location.getX() - x, location.getY() - y, location.getZ() - z, location.getX() + x, location.getY() + y, location.getZ() + z);
            List<net.minecraft.server.v1_8_R3.Entity> entityList = this.getHandle().a((net.minecraft.server.v1_8_R3.Entity)null, bb, (Predicate)null);
            List<Entity> bukkitEntityList = new ArrayList(entityList.size());
            Iterator var11 = entityList.iterator();

            while(var11.hasNext()) {
                Object entity = var11.next();
                bukkitEntityList.add(((net.minecraft.server.v1_8_R3.Entity)entity).getBukkitEntity());
            }

            return bukkitEntityList;
        } else {
            return Collections.emptyList();
        }
    }
#

here you go

#

it kinda looks like it goes through all the entities tho

crimson terrace
#

so its literally getting every entity and checking wether its close enough to you

#

yeah so only implementing the circle and going through every entity in the world to check if its close enough to you seems better

misty current
#

yeah i guess

#

i'll change it later

young knoll
#

Depends what this.getHandle().a does

misty current
#

i kinda need to study now :p

young knoll
#

It may be smart and use chunks

crimson terrace
misty current
#

it's in the world class

#

tho i don't see any filters in the iterator

crimson terrace
#

it does iterate through all the entities

young knoll
misty current
#

just go to the implementing class of world in intellij

#

ctrl + alt + b

young knoll
#

I'll go look what getHandle.a does

misty current
#
    public WorldServer getHandle() {
        return this.world;
    }
crimson terrace
#

imo something thats called entityList.iterator and is used on something that contains net.minecraft.server.v1_8_R3.Entity with no predicates will contain all entities

young knoll
#

It is not smart and does not use chunks

#

It loops all entities in said world

misty current
#
    protected void a() throws ExceptionWorldConflict {
        this.checkSession();
        this.worldData.a(this.getWorldBorder().getSize());
        this.worldData.d(this.getWorldBorder().getCenterX());
        this.worldData.c(this.getWorldBorder().getCenterZ());
        this.worldData.e(this.getWorldBorder().getDamageBuffer());
        this.worldData.f(this.getWorldBorder().getDamageAmount());
        this.worldData.j(this.getWorldBorder().getWarningDistance());
        this.worldData.k(this.getWorldBorder().getWarningTime());
        this.worldData.b(this.getWorldBorder().j());
        this.worldData.e(this.getWorldBorder().i());
        if (!(this instanceof SecondaryWorldServer)) {
            this.worldMaps.a();
        }

        this.dataManager.saveWorldData(this.worldData, this.server.getPlayerList().t());
    }
``` oh wtf
ember estuary
#

how can i make an abstract method always run another method?

young knoll
#
@Override
    public List<Entity> getEntities(@Nullable Entity entity, AxisAlignedBB axisalignedbb, Predicate<? super Entity> predicate) {
        this.getProfiler().incrementCounter("getEntities");
        List<Entity> list = Lists.newArrayList();

        this.getEntities().get(axisalignedbb, (entity1) -> {
            if (entity1 != entity && predicate.test(entity1)) {
                list.add(entity1);
            }

            if (entity1 instanceof EntityEnderDragon) {
                EntityComplexPart[] aentitycomplexpart = ((EntityEnderDragon) entity1).getSubEntities();
                int i = aentitycomplexpart.length;

                for (int j = 0; j < i; ++j) {
                    EntityComplexPart entitycomplexpart = aentitycomplexpart[j];

                    if (entity1 != entity && predicate.test(entitycomplexpart)) {
                        list.add(entitycomplexpart);
                    }
                }
            }

        });
        return list;
    }
misty current
ember estuary
#

:/

crimson terrace
#

yeah so you just have to for(Entity e: world.getEntities()) through it all and check for each wether its close enough...

ember estuary
#

any workaround?

young knoll
#

Make sure to use distanceSquared over distance

misty current
#

can't think of any, never needed that

misty current
#

wdym

young knoll
#

It's a method in location

#

It's faster than distance

misty current
#

a kk

young knoll
#

You just need to make sure to square your threshold

misty current
#

so range * range

young knoll
#

yep

misty current
#

i guess this is because computing multiplications is faster than sqrt?

#

or divisions

dusty herald
#

what's math

young knoll
#

Well the distance formula returns the squared location

crimson terrace
#

so you just do distanceSquared and it gets you the actual distance in blocks?

young knoll
#

And sqrt isn't the cheapest mathematical operation

crimson terrace
#

thats cool

young knoll
#

It gets you the squared distance in blocks

#

distance gets you the actual distance

crimson terrace
#

oh ok fair enough

young knoll
#

I believe it's Manhattan distance? not sure

crimson terrace
#

lol

young knoll
#

It doesn't say, so idk

#

Maybe it's Euclidian

crimson terrace
#

oh youre serious... i thought you were going on about how people in the US (specifically manhattan) like to measure distance in blocks

young knoll
#

Well you can't walk through solid objects

#

Like a building

crimson terrace
#

thats what someone who doesnt have enough dedication would say

tidal hollow
#

I was making mobs with Armor and when testing them they release their armor, how can I make that not happen?

ember estuary
#

I have the class Menu (which is abstract) and the class ChunkMenu, which extends Menu.
In Menu have the method onRender(), which is abstract, or in other words, ChunkMenu has to override it.
Now I want every onRender() call of a child (f.e. ChunkMenu) to also run a specific function (or some default code) in the Super-Class (Menu).
Is abstract wrong for this?
I dont want to have to call super(), it should be automatic
How do I do it?

crimson terrace
#

if so you can set the dropChance to 0

ivory sleet
tidal hollow
ember estuary
#

so no way without super?

#

sad

ivory sleet
#

?

#

No what I meant is that super() is always called

#

or the super constructor

ember estuary
#

oh

ivory sleet
#

if it’s a nullary one (no args) then you don’t have to declare it

ember estuary
#

can it be abstract tho?

ivory sleet
#

Constructors can’t be abstract

ember estuary
#

well i dont want it to be a constructor, onRender() should be a method

ivory sleet
#

Yeah then it can be abstract given that the class isn’t a concrete one

ember estuary
#

says Abstract methods cannot have a body

ivory sleet
#

Yeah because they’re abstract

#

The polar opposite of concrete

#

What you could do

crimson terrace
#

public abstract void abstractMethod();

#

thats an abstract method

ember estuary
#

no its not

#

public abstract void method()

#

that is

crimson terrace
#

sorry

#

forgot abstract

#

edited

ember estuary
#

xD

ivory sleet
#

Is
abstract class Blah {
protracted abstract void onRender();

public void render() {
//DO OTHER STUFF
this.onRender();
}
}

ember estuary
#

wait, ill send my code ok?

crimson terrace
#

its almost midnight forgive me tired

ivory sleet
#

Then derive Blah and override onRender

ember estuary
#

so then its gonna do the OTHER STUFF before running the onRender function?

ivory sleet
#

Idk

ember estuary
#

whenever i call onRender on a child

#

doesnt look like it, but idk

ivory sleet
#

It’s in case you wanna take full advantage of a concrete-abstract inheritance relationship

ember estuary
#

but idk how to connect it in the MapMenu class

#

i only know one can do super() in the children

ivory sleet
#

If you want that

#

You’d have a public function which runs defaultRenderStuff then onRender

#

Going back to Blah

#

in render

#

You’d have

#

public void render() {
this.defaultRenderStuff();
this.onRender();
}

ember estuary
#

and then call render() on the child?

ivory sleet
#

You override onRender in the child

#

But yeah

ember estuary
#

thats gonna work?

#

gotta try it

ivory sleet
#

You’d make the abstract method protected

ember estuary
#

doesnt rlly make sense

#

xD

ivory sleet
#

and make the renderDefaultStuff internal

#

Such that you enforce any users of MapMenu to use render()

ember estuary
#

internal = private?

ivory sleet
#

Yes

#

it should be inaccessible to outside classes, which have no tight relation to MapMenu or one of its subclasses

ember estuary
#

oh wow i see what your doing

#

thats great, thank you

ivory sleet
ember estuary
#

makes sense now :D

ivory sleet
#

🥲

ember estuary
#

:(

#

no beer for me

visual tide
#

is there a way to intercept when the console uses a command?

#

since it's PlayerCommandPreprocessEvent

ivory sleet
#

ServerCommandEvent perhaps?

visual tide
#

oH

#

oops didnt know that was a thing

ivory sleet
#

Unsure if its preprocessing but yeah

#

No worries

grave kite
#

Hi, how can I modify static final with a reflection on java 12+? I can't just change modifiers like in java 8

young knoll
#

Can't

#

Use Unsafe

sullen marlin
#

You can

young knoll
#

Can you?

sullen marlin
#

At least up till 16

young knoll
#

Ah right, with the runtime flag

sullen marlin
#

I had a bookmark for it, but not at mc pc

#

Basically use the new reflection API as it doesn't check

grave kite
young knoll
#

I have the ugly unsafe code somewhere, which should also work

ivory sleet
#

thus impossible to change at runtime

grave kite
young knoll
#

?paste

undone axleBOT
young knoll
#

Have some cursed code

grave kite
sullen marlin
#

I'd use that over unsafe

young knoll
#

Does it work in j17?

sullen marlin
#

Dunno, try

#

Works in 16

young knoll
#

"This approach may break at any time so best not to rely on it. In general, nobody should expect to be able to change a static final field. "

#

Yeah well, try being a mod dev

#

Actually this isn't an issue with forge/fabric so nvm

ivory sleet
#

mixins 😄

grave kite
young knoll
#

Not even mixins

#

ATs

ivory sleet
#

ATs as?

young knoll
#

Access Transformers

#

(Access Wideners on Fabric)

sullen marlin
#

Plugins 👏 are 👏 not 👏 mods 👏

young knoll
#

Not yet

#

The lines becomes more blurry each version

ivory sleet
#

wait can you remove final with access wideners?

#

\tranformers

young knoll
#

Yep

ivory sleet
#

interesting

sullen marlin
young knoll
#

public-f

#

I still need to figure out how to actually modify spigot properly, because am slow XD

ivory sleet
#

🌞

young knoll
#

I know how to make the changes in Bukkit/CB, but not how to build a jar with said changes

sullen marlin
#

just maven build

#

Lol

young knoll
#

In which project? Spigot I assume?

sullen marlin
#

Bukkit/CB

crystal magnet
#

Is the bungeecord plugin messaging api safe to use async (ie asyncplayerchatevent)?

young knoll
#

Ah, will that still output a spigot jar

sullen marlin
#

No but usually not necessary for simple testing

young knoll
#

Fair enough

#

I assume CB will have the changes from Bukkit as well

sullen marlin
#

If you want one, you would commit and then run BT with --dev --dont-update

young knoll
#

Ah I need both flags

#

That may be my issue

crystal magnet
#

Oops replied to wrong one

ember estuary
#

md_5, spelling mistake in MapPalette description

#

"These fields are hee base color ranges"

#

was wondering for 5 minutes what a "hee base color" is

#

xD

visual tide
#

hex

ember estuary
#

ahhh

#

ty

#

i thought the wrong word was supposed to be "the" xD

young knoll
#

HEE-HEE

ember estuary
#

hex makes sense yea

visual tide
#

well i assume hex since theres not a lotta other things that make sense

ember estuary
#

funny mistake

sullen marlin
#

Could be the?

#

Idk would need to look

ember estuary
#

xD

late sonnet
young knoll
#

--dont-update was yeeting my changes when I tried last

next plume
young knoll
#

Maybe because I hadn't committed them

#

It probably is the

#

I don't think you can add hex colors to maps

late sonnet
next plume
#

No, you're stuck with the 244 colors defined by the map palette.

ember estuary
#

isnt it all of them?

ivory sleet
#

Believe it tries to get the closest color to the passed argument with one of the methods, but yeah you’re stuck with those colors

next plume
#

And I don't think any of them are black.

quaint mantle
#

can someone help ,me with components, again pls

#

because my formatting is leaking into the other ones in my BaseComponent[] for seemingly no reason

ivory sleet
#

Adventure or bungee chat api?

#

Ah

quaint mantle
next plume
quaint mantle
#

usernameColored has a hover event, that leaks into the arrow, and chatmessage

#

mute also has both a click and hover event, but it stays in its own thing

ivory sleet
#

I believe you have to set the hover event to null again?

quaint mantle
#

well wait, how

#

i tried making a new HoverEvent() and making everytihng null for it, and then i tried (HoverEvent) null

#

neither worked

#

i can try again tho

next plume
#

An example:

ivory sleet
ivory sleet
#

?jd-bcc

quaint mantle
#

i'll do the same^

ivory sleet
#

Seems like you could specify format retention

quaint mantle
#

tried

#

i'll try another null HoverEvent, because for al i know it didnt save /shrug

ivory sleet
#

Hmm seems like format retention works fine for me

quaint mantle
#

FormatRetention.HOVER?

ivory sleet
#

NONE

quaint mantle
#

ah, tried NONE -- didnt work, trying the empty hover event now

quaint mantle
#

will it clear all of the formatting FOR arrow?

ivory sleet
#

Try applying it in every append maybe

quaint mantle
#

alr

#

yeah that didnt work @ivory sleet

#

here's my updated code, i could just be doing a dumb thing and not fully understanding

ember estuary
#

What event gets triggered when a creative player opens his inventory?

young knoll
#

Don't think any

#

Same with survival

ember estuary
#

In survival not, but in creative there should

#

cuz the inventory refreshes

#

all fake items dissapear

#

means it asks the server for the inventory

#

means event

young knoll
#

Try InventoryOpenEvent

ember estuary
#

might be it, ill try

quaint mantle
ember estuary
#

items that i created by sending a packet

quaint mantle
#

so its packet

ember estuary
#

client-side only items

#

yea

quaint mantle
#

therefore, its a client-side event

ember estuary
#

what

quaint mantle
#

if it doesnt exist to the server, how is the server going to remove the fake items

ember estuary
#

the client removes the fake items

#

but think about this: how does he know theyre fake

quaint mantle
#

so then how would triggering a server event activate that

ember estuary
#

when the player opens his inventory in creative, it sends a packet to the server. server sends back the real inventory. client sees the fake items arent there and removes them.

#

-> theres an event for creative inventory opening

#

in survival the fake items stay

quaint mantle
#

im not entirely sure thats how that works

ember estuary
#

packet stuff

#

xD

#

it is how it works

quaint mantle
#

but you dont know basic inventory events? 🤔

ember estuary
#

yea im new to spigot

#

xD

#

ive made clients tho

#

where i worked a lot with packets

#

so yea

quaint mantle
#

🤔

normal raven
#

I'm having an issue using Gson, ```json
{
"from": 1,
"to": 1,
"currentPage": 1,
"total": 1,
"totalPages": 1,
"queryTime": "0.020",
"totalTime": "0.025",
"partial": false,
"canonicalUrl": "/v1/products(sku=6453207)?format=json&apiKey=SECRET",
"products": [
{
"sku": 6453207,
"score": null,
"productId": null,
"name": "Sony - 75" Class X85J Series LED 4K UHD Smart Google TV",
"source": null,
"type": "HardGood",
"startDate": "2021-04-26",
"new": false,
"active": true,
"lowPriceGuarantee": true,
"activeUpdateDate": "2021-04-26T00:01:52",
"regularPrice": 1599.99,
"salePrice": 1299.99,
"clearance": false,
"onSale": true,
"planPrice": null,
"priceWithPlan": [

  ]``` is what I'm getting from my url, i'm trying to get "regularPrice", this is my java code: ```java

String jsonS = "";
URL url = new URL("https://api.bestbuy.com/v1/products(sku=6453207)?apiKey=SECRET&format=json");
URLConnection conn = url.openConnection();
conn.connect();
BufferedReader in = new BufferedReader(new InputStreamReader(conn.getInputStream()));
String inputLine;

    while ((inputLine = in.readLine()) != null) {
        jsonS += inputLine;
    }
    Gson gson = new Gson();
    JsonObject jsonObject = gson.fromJson(jsonS, JsonObject.class);
    String id = jsonObject.get("products").getAsString();

    in.close();
    System.out.println(id);```
#

how do i get "regularPrice"?

#

so far I can only get everything from before products (i'm new to Gson)

torn shuttle
#

I feel personally attacked

paper viper
#

lol

jade perch
ember estuary
#

But then how does the client suddenly know the items are fake

#

o.O

quaint mantle
#

because its all client side lol

ember estuary
#

well ofc, but how does it know they dont exist

jade perch
#

cause the server tells them

ember estuary
#

and theres no event catching it?

normal raven
ember estuary
#

(its about creative inventory opening btw)

ember estuary
jade perch
normal raven
#
Gson gson = new Gson();
        JsonObject jsonObject = gson.fromJson(jsonS, JsonObject.class);
        JsonObject id = jsonObject.getAsJsonObject("products");
        String rp = id.get("regularPrice").getAsString();
        

        in.close();
        System.out.println(rp);```
normal raven
jade perch
#

Where does it throw the exception

normal raven
normal raven
# jade perch Where does it throw the exception

this is the entire error Exception in thread "main" java.lang.ClassCastException: class com.google.gson.JsonArray cannot be cast to class com.google.gson.JsonObject (com.google.gson.JsonArray and com.google.gson.JsonObject are in unnamed module of loader 'app') at com.google.gson.JsonObject.getAsJsonObject(JsonObject.java:182) at d.cop.main(cop.java:27)

jade perch
#

oh my b

#

use getAsJsonArray

#

then get first element in the array and that's your jsonobject

normal raven
#

I am very confused lmao hold on let me try that

#

we're actually getting somewhere but now it says Exception in thread "main" java.lang.IllegalStateException: Not a JSON Object: [{"sku":6453207,"score":null,"productId":null,"name":"Sony - 75\" Class X85J Series LED 4K UHD Smart Google TV","source":null,"type":"HardGood","startDate":"2021- ........... at com.google.gson.JsonElement.getAsJsonObject(JsonElement.java:90) at d.cop.main(cop.java:29)

jade perch
#

jsonObject.getAsJsonArray("products").get(0).getAsJsonObject().get("regularPrice").getAsString()

normal raven
#

.get("regularPrice") has an error

#

not applicable

jade perch
#

I edited it make sure you have new version

normal raven
#

sheeeesh

#

i appreciate it, never willingly working with JSON again lol

jade perch
#

Ye that's like the shittiest way to work with GSON

#

DTOs are way easier

#

but I don't feel like explaining that

normal raven
#

heard

ember estuary
#

Ok, so opening the creative inventory does not trigger the OpenInventoryEvent, but it requests the inventory content from the server.
is there any event for that request?

#

or do i have to use nms

young knoll
#

I doubt it requests the content from the server

#

Creative inventory is fully client side

ember estuary
#

then how would it know the real item?

#

it definetly does

#

See how the leaf disappears exactly when i open the inventory?

#

the client thought theres a map in that slot. how would it suddently know there's actually a leaf-block

young knoll
#

What inventory, you are typing a command

ember estuary
#

on the right bottom?

young knoll
#

The bottom right of the screen isn't even in the gif

ember estuary
#

but the hotbar is

#

look at the hotbar, thats the important part

#

the selected slot

#

didnt wanna do fullscreen gif as thats like 60 MB

#

u can see everything important in that gif already

#

Yesss, i got it

#

it triggers InventoryCreativeEvent and InventoryClickEvent (even tho i didnt click a thing)

#

good to know

#

told ya it communicates with the server xD

granite burrow
#

how can I run a command from console in my plugin

ember estuary
#

ConsoleCommandSender console = Bukkit.getServer().getConsoleSender();
String command = "command";
Bukkit.dispatchCommand(console, command);

granite burrow
#

I saw that thread, does it matter if theres a slash or not?

ember estuary
#

better leave it away

#

as you do in the actualy console

granite burrow
#

alright, thank you 😄 hopefully it works cuz ive been trying to do it and it hasnt

ember estuary
#

np ^^

#

tell me if it worked then :D

granite burrow
#

hmm it worked, I guess there was a conflicting plugin

#

is there a way to send it as op?

#

nvm ill look it up

ember estuary
#

isnt console op by default?

granite burrow
#

yeah but some plugins dont let console run command so wouldn't running it as op make it so that the check for console not care since its still a player doing it

ember estuary
#

if you run it thru the console, you run it thru the console

#

xD

#

which is op by default, so cant check that

#

maybe you want Player#performCommand ?

granite burrow
#

ehh oh well if theres issues with that, thats a later issue to fix

ember estuary
#

yea

granite burrow
#

is there a way to hide that the console ran it? just so I don't spam console

ember estuary
#

idk, sry

vernal basalt
#

im making a team per player
team = board.registerNewTeam(player.getUniqueId().toString().substring(0,15));
i get no errors but in game the team isn't there

weary pagoda
#

would the floating writings be armor_stand?

#

how does each different player see their name or stats on the floating text?

young knoll
#

Generally they are client side entities made using packets

#

ArmorStands or AreaEffectClouds are the common used entities

proud basin
#

Coll why are you a nerd?

young knoll
#

Idk why are you smelly?

proud basin
#

Because you stole my soap

young knoll
#

Rekt

proud basin
#

aw

peak granite
#

does anyone know how i can push the victim to attacker at speed 3?

#

like i'm trying to get the vicitm pulled to the attacker

young knoll
#

setVelocity

#

You can get a vector between then with vector1.subtract(vector2) iirc

peak granite
#

event.getCaught().setVelocity();

#

what do i do next

young knoll
#

You supply a vector to the method

peak granite
#

what would be vector1

#

and vector2

young knoll
#

The location of the target and the user

#

Location has a toVector

peak granite
#

location 1 = entity being pulled or entity pulling

#

?

young knoll
#

Don't remember

#

Try both ways

peak granite
#

bruhh

#

how do i get the vector

young knoll
peak granite
#

event.getCaught().setVelocity(event.getCaught().getLocation().toVector().subtract(event.getPlayer().getLocation().toVector()));?

young knoll
#

You may have to delay it 1 tick

#

But yes

peak granite
#
        if(!(event.getCaught() == null)) {
            if(event.getCaught() instanceof Player) {
                Bukkit.broadcastMessage("debug");
                if(event.getPlayer().getInventory().getItemInHand().getItemMeta().getLore().contains(Color.translate("&3Grappling"))) {
                    Bukkit.broadcastMessage("debugxd");
                    event.getCaught().setVelocity(event.getCaught().getLocation().toVector().subtract(event.getPlayer().getLocation().toVector()));
                }
            }
        }
    }
}```
#

doesn't work

#

and none broadcast

young knoll
#

You don't need the null check btw

#

Also is it registered and @EventHandler

peak granite
#

yes

#

LOOOL

#

ok i added @eventhandler

#

@young knoll

#

put pushes them really far away

#

from me

#

not pulling them torwards

#

[02:29:22 WARN]: Excessive velocity set detected: tried to set velocity of entity #2750 to (0.4499006208195624,0.9361249792364532,5.40070935867368).
[02:29:22 WARN]: java.lang.Exception: Stack trace

young knoll
#

Then you probably want the inverse

#

May need to .multiply or .normalize as well

peak granite
#

pushes at me too quickly

young knoll
#

Like I said, normalize it

#

And then multiple it if you want to speed/slow it after that

peak granite
#

how do i normalize it

young knoll
#

.normalize

peak granite
#

where do i add

#

it

#

@young knoll

young knoll
#

At the end of the new vector

#

You may want to use some variables to clean that long line up

peak granite
#

event.getCaught().setVelocity(event.getPlayer().getLocation().toVector().subtract(event.getCaught().getLocation().toVector().normalize));

#

doesn't work

young knoll
#

You forgot the ()

#

Also your brackets are wrong

peak granite
#

event.getCaught().setVelocity(event.getPlayer().getLocation().toVector().subtract(event.getCaught().getLocation().toVector().normalize()));

#

?

young knoll
#
Vector velocity = event.getPlayer().getLocation().toVector().subtract(event.getCaught().getLocation().toVector());
event.getCaught().setVelocity(velocity.normalize());
peak granite
#
    public void onFish(final PlayerFishEvent event) {
        if(event.getCaught() instanceof Player) {
            if(event.getPlayer().getInventory().getItemInHand().getItemMeta().getLore().contains(Color.translate("&3Grappling"))) {
                Vector velocity = event.getPlayer().getLocation().toVector().subtract(event.getCaught().getLocation().toVector());
                event.getCaught().setVelocity(velocity.normalize());
                event.getCaught().setVelocity(velocity);
            }
        }
    }
}```
#

?

young knoll
#

Get rid of event.getCaught().setVelocity(velocity);

peak granite
#

why

young knoll
#

Because you already set it the very line above

peak granite
#

oh im blind

#

lmfao

sharp storm
#

what would i use to check if an item display name is italic

young knoll
#

Hmm

#

I guess you could check if it contains the italic code

sharp storm
#

using PlayerInteractEvent btw

young knoll
#

Event doesn't really matter

#

Check if the name contains §o

#

Actually using ChatColor.ITALIC is probably better

sharp storm
#

can i have en example?

young knoll
#

String#contains(ChatColor.ITALIC)

#

May need to do ChatColor.ITALIC.toString()

sharp storm
#
if(event.getItem().getItemMeta().getDisplayName().toLowerCase().contains(ChatColor.ITALIC.toString()))
young knoll
#

Several things can be null there

sharp storm
#

i already check if the item has an item name

#

and if they have an item

young knoll
#

Fair enough

#

Do you check if the item hasItemMeta

#

Otherwise you make a new meta instance for no reason, also getItemMeta returns null for air

hasty prawn
#

Is it normal for entities to still take knockback from a punch bow if their knockback resistance attribute is 1? Thonk

young knoll
#

What version

hasty prawn
#

1.17.1

#

Not sure what build of Spigot, could try upgrading I suppose

young knoll
#

The scale of horizontal knockback resisted from attacks and projectiles. Vertical knockback is not affected. Does not affect explosions.[3] 1.0 is 100% knockback resistance

#

I guess they still go up

hasty prawn
#

It moves horizontally though Thonk

#

The entity is in the air, wonder if that as anything to do with it

young knoll
#

Yeah I do when wearing the armor as well

#

Let met test sp

#

Still move horizontally in sp too

#

Weird

hasty prawn
#

So minecraft issue?

young knoll
#

Guess so?

hasty prawn
#

Interesting

young knoll
hasty prawn
#

I'll do more testing soon to see if I can find the exact cause/issue

frank bramble
#

Hey there! I was just wondering peoples' opinions on the best way to create a player shop. The way I was thinking approaching it was

// Page index, slot index, associated function
private static final Map<Integer, Map<Integer, Runnable>> pageFunctions = new HashMap<>();```
Thoughts on this approach?
#

I can just look up which page they're on, which slot they've clicked on, and execute the associated function

young knoll
#

You could use a table to avoid the nested map

quaint mantle
#

i.e; Page: 7 >, you could remove "Page" and "7" to see ">", which would go to page 8

#

etc.

vernal basalt
#
java.lang.NullPointerException: Cannot invoke "net.neednot.LastLife.getConfig()" because "this.plugin" is null
    at net.neednot.commands.Transfer.<init>(Transfer.java:18) ~[LastLife-1.0-SNAPSHOT.jar:?]
    at net.neednot.LastLife.onEnable(LastLife.java:15) ~[LastLife-1.0-SNAPSHOT.jar:?]
    at org.bukkit.plugin.java.JavaPlugin.setEnabled(JavaPlugin.java:264) ~[patched_1.17.1.jar:git-Paper-338]
    at org.bukkit.plugin.java.JavaPluginLoader.enablePlugin(JavaPluginLoader.java:370) ~[patched_1.17.1.jar:git-Paper-338]
    at org.bukkit.plugin.SimplePluginManager.enablePlugin(SimplePluginManager.java:500) ~[patched_1.17.1.jar:git-Paper-338]
    at org.bukkit.craftbukkit.v1_17_R1.CraftServer.enablePlugin(CraftServer.java:561) ~[patched_1.17.1.jar:git-Paper-338]
    at org.bukkit.craftbukkit.v1_17_R1.CraftServer.enablePlugins(CraftServer.java:475) ~[patched_1.17.1.jar:git-Paper-338]
    at net.minecraft.server.MinecraftServer.loadWorld(MinecraftServer.java:730) ~[patched_1.17.1.jar:git-Paper-338]
    at net.minecraft.server.dedicated.DedicatedServer.initServer(DedicatedServer.java:317) ~[patched_1.17.1.jar:git-Paper-338]
    at net.minecraft.server.MinecraftServer.runServer(MinecraftServer.java:1217) ~[patched_1.17.1.jar:git-Paper-338]
    at net.minecraft.server.MinecraftServer.lambda$spin$0(MinecraftServer.java:319) ~[patched_1.17.1.jar:git-Paper-338]
    at java.lang.Thread.run(Thread.java:831) ~[?:?]
#

i added commands and now it does this

#

this.getCommand("transfer").setExecutor(new Transfer(this));

#
    public Transfer(LastLife instance) {
        plugin = instance;
    }
    FileConfiguration config = plugin.getConfig();```
proud basin
#

Is there a way to get all the classes that have a certain annotation instead of grabbing each class manually?

vernal basalt
#

i do it the exact same in my other plugin but it wont work in this one

young knoll
#

You are instantiating config before the constructor is called

frank bramble
vernal basalt
#

same error

quaint mantle
#

send main class

vernal basalt
#
package net.neednot;

import org.bukkit.configuration.file.FileConfiguration;
import org.bukkit.plugin.java.JavaPlugin;
import net.neednot.listeners.Events;
import net.neednot.commands.Transfer;

public final class LastLife extends JavaPlugin {

    FileConfiguration config = getConfig();

    @Override
    public void onEnable() {
        getServer().getPluginManager().registerEvents(new Events(this), this);
        this.getCommand("transfer").setExecutor(new Transfer(this));
        config.addDefault("Random", true);
        config.addDefault("Min", 4);
        config.addDefault("Max", 7);
        config.addDefault("Set", 7);
        config.options().copyDefaults(true);
        saveConfig();
    }

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

Events and Names it works fine

quaint mantle
proud basin
# young knoll I do it per package

I havea custom interface that as things such ass String name() I got different classes using the annotation I want to be able to grab every class and display the variables without doing something like ```
SomethingModule anno = Class.class.getAnnotation(SomethingModule .class);

young knoll
#

See the code I sent

vernal basalt
# quaint mantle send main class

new error ```
java.lang.NullPointerException: Cannot invoke "org.bukkit.command.PluginCommand.setExecutor(org.bukkit.command.CommandExecutor)" because the return value of "net.neednot.LastLife.getCommand(String)" is null
at net.neednot.LastLife.onEnable(LastLife.java:15) ~[LastLife-1.0-SNAPSHOT.jar:?]
at org.bukkit.plugin.java.JavaPlugin.setEnabled(JavaPlugin.java:264) ~[patched_1.17.1.jar:git-Paper-338]
at org.bukkit.plugin.java.JavaPluginLoader.enablePlugin(JavaPluginLoader.java:370) ~[patched_1.17.1.jar:git-Paper-338]
at org.bukkit.plugin.SimplePluginManager.enablePlugin(SimplePluginManager.java:500) ~[patched_1.17.1.jar:git-Paper-338]
at org.bukkit.craftbukkit.v1_17_R1.CraftServer.enablePlugin(CraftServer.java:561) ~[patched_1.17.1.jar:git-Paper-338]
at org.bukkit.craftbukkit.v1_17_R1.CraftServer.enablePlugins(CraftServer.java:475) ~[patched_1.17.1.jar:git-Paper-338]
at net.minecraft.server.MinecraftServer.loadWorld(MinecraftServer.java:730) ~[patched_1.17.1.jar:git-Paper-338]
at net.minecraft.server.dedicated.DedicatedServer.initServer(DedicatedServer.java:317) ~[patched_1.17.1.jar:git-Paper-338]
at net.minecraft.server.MinecraftServer.runServer(MinecraftServer.java:1217) ~[patched_1.17.1.jar:git-Paper-338]
at net.minecraft.server.MinecraftServer.lambda$spin$0(MinecraftServer.java:319) ~[patched_1.17.1.jar:git-Paper-338]

quaint mantle
#

you need to put the command in your plugin.yml

vernal basalt
#

i did

quaint mantle
#

send plugin.yml

vernal basalt
#

oh wait the exact name

#

dhh

#

ima head out 🤦‍♀️

quaint mantle
#

Hello. when i try to use Bukkit.getWorld(name) for a multiverse world, the world will be null

young knoll
#

Make sure your plugin loads after multiverse

quaint mantle
proud basin
#

Coll where do you actually use it?

#

I just tried it and it's returning nothign

young knoll
#

I sent you the code that uses it too

#

There are 2 links

proud basin
#

yeah but when I try it returns it empty

young knoll
#

Weird

proud basin
#

im not using spigot btw

young knoll
#

Are you entering the package name correctly

proud basin
#

yea

young knoll
#

Don’t see why it would be any different outside of spigot

#

Unless you are giving it the wrong classloader

proud basin
#

I don't think I am

#
for (Class<?> clazz : ClassUtils.getAllClassesInSubpackages("me.jtx.nitrous.module.impl",
                this.getClass().getClassLoader())) {
            if (!TYPE_CLASS.isAssignableFrom(clazz))
                continue;

            for (DraggableModule annotation : clazz.getAnnotationsByType(DraggableModule.class)) {
                try {
                    DraggableModuleContainer moduleContainer = ((Class<? extends DraggableModuleContainer>) clazz)
                            .getDeclaredConstructor(Nitrous.class, String.class)
                            .newInstance(plugin, annotation.name());
                    name.add(moduleContainer.getName());
                } catch (ReflectiveOperationException | IllegalArgumentException e) {
                    e.printStackTrace();
                }
            }
        }
lucid bane
#

i'm trying to make plugin for catserver, but console says COULD NOT FIND MAIN CLASS.

#

plugin.yml is right under the src folder

#

can i get any way to solve this

noble lantern
lucid bane
#

..so?

noble lantern
#

yo wait guys holldup

lucid bane
#

k

#

?

noble lantern
#

Yall how long has this been around for

lavish hemlock
#

like since 1.16 I think

lucid bane
noble lantern
young knoll
#

We don’t support CatServer

#

Also you didn’t even share the entire error

lucid bane
#

<console>
[14:03:13] [Server thread/ERROR]: Could not load 'plugins\ping.jar' in folder 'plugins'
org.bukkit.plugin.InvalidPluginException: Cannot find main class `me.miro243.Main.Ping'

<plugin.yml>
main: me.miro243.Main.Ping
name: Ping
author: miro243
version: 0.0
description: YES

sry for that

#

several spigot plugins seems working in catserver but
why mine doesnt?

young knoll
#

Your main class isn’t at that location

#

Show your main class

#

?paste

undone axleBOT
lucid bane
#

hold on i cant use that to upload pngs

young knoll
#

🤔

lucid bane
young knoll
#

That does in fact look right

lucid bane
#

yeah

#

that drives me

final fog
#

when you left click on someone in spectator mode you can view their perspective, is there a way to do that in this api?

final fog
#

I already tried that

#

it just teleports me to the player

young knoll
#

Are you in spectator

final fog
#

Yeah

#

is that why

young knoll
#

No that’s how you should be

#

Weird

final fog
#

Well I’m just trying to make it so when you die you instantly spectate a player

#

With their perspective

young knoll
#

Let’s see the code

final fog
#

One second

#

My mc crashed for some reason

#

    public Files data;

    @EventHandler
    public void onDeath(EntityDamageEvent event) {
        this.data = new Files(Main.getInstance());
        if (event.getEntity() instanceof Player) {
            Player player = (Player) event.getEntity();
            if (((Player) event.getEntity()).getHealth() <= event.getDamage()) {
                event.setCancelled(true);
                if (!this.data.getConfig().contains("Players." + player.getUniqueId() + ".Banned")) {
                    this.data.getConfig().set("Players." + player.getUniqueId() + ".Banned", true);
                    long timeUnbanned = System.currentTimeMillis() + 10000;
                    this.data.getConfig().set("Players." + player.getUniqueId() + ".Time Unbanned", timeUnbanned);
                    data.saveConfig();
                    spectate(player);
                    Bukkit.broadcastMessage(ChatColor.translateAlternateColorCodes('&', "&c" + player.getName() + " &7has died."));
                }else {
                    this.data.getConfig().set("Players." + player.getUniqueId() + ".Banned", true);
                    long timeUnbanned = System.currentTimeMillis() + 10000;
                    this.data.getConfig().set("Players." + player.getUniqueId() + ".Time Unbanned", timeUnbanned);
                    data.saveConfig();
                    spectate(player);
                    Bukkit.broadcastMessage(ChatColor.translateAlternateColorCodes('&', "&c" + player.getName() + " &7has died."));
                }
            }
        }
    }

    public void spectate(Player player) {
        player.getInventory().clear();
        for (Player chosenPlayer : Bukkit.getOnlinePlayers()) {
            player.setSpectatorTarget(chosenPlayer);
            break;
        }
    }```
young knoll
#

Hmm

#

You aren’t using the death event, so I figured it would work

#

Use event.getFinalDamage btw

final fog
#

oh ty

lucid bane
#

did you make player spectre mode? @final fog

final fog
#

when I did that it just teleported me to the player

#

so I tried removing it

#

now I added it back and it doesn't do anything.

young knoll
#

You’ll get an error if they aren’t in spectator

final fog
#

oh wait I know why it's not doing anything, wrong player variable

young knoll
#

Perhaps it’s a distance thing, try teleporting then to the target and then setting the spectator target 1 tick later

lucid bane
#

sg

final fog
#

oh wait it works now

#

we good

#

tysm for the help though, much appreciated

lucid bane
#

and my main still hiding

#

console cant find it until now

#

does my exporting occurs error?

#

i have no idea about this checkboxes doing

tawdry scroll
#

is there anyway we can get the heads like spectator gui has in vanilla?

young knoll
#

Don’t think so

torpid parrot
#

when i import one world it says an internal error occured
in multiverse

tawdry scroll
#

Uhm i see
Origin realms was able to do it
I tried decompiling client jar and it seems to have a SpectatorMenuItem which i dont think is available to server

young knoll
#

OR has a resource pack

#

They may have done something with that

lucid bane
#
[15:06:35 ERROR]: Could not load 'plugins\ping.jar' in folder 'plugins'
org.bukkit.plugin.InvalidPluginException: java.lang.UnsupportedClassVersionError: 
me/Ping has been compiled by a more recent version of the Java Runtime (class file version 59.0), 
this version of the Java Runtime only recognizes class file versions up to 52.0

a first catserver plugin i made(me.miro243.Ping) has error in spigot too

young knoll
#

You are compiling with java 15

#

But you need to use java 8

restive tangle
#

It's been compiled by a more recent version of jaba runtime. What server version are you using?

lucid bane
#

1.12.2 spigot

tawdry scroll
restive tangle
#

Use java 8.

young knoll
#

Well you should be able to see what item they use

lucid bane
#

uninstall my current Java and
download Java SE dk 8?

young knoll
#

By using F3 H

tawdry scroll
#

Its player_head

young knoll
#

Might just have all player heads set to render as flat in the inventory

tawdry scroll
#

And it has normal texture and signature like a normal player_head

restive tangle
#

Go to settings in the ide and then go to java compiler and change the bytecode to 8.

#

Then to system preferences select java 8.

lucid bane
#

didnt I have to uninstall java

#

?