#help-development

1 messages · Page 1478 of 1

chrome beacon
#

I mean the /kill command does 3.4×10^38 of void damage

ivory sleet
#

EnumSet

chrome beacon
#

Use == when comparing enums

#

Also make sure item is the Material and not the ItemStack

#

(or change the item variable)

eternal night
#

isn't there a tag for pickaxes ?

chrome beacon
#

That might throw a nullpointer just a heads up

eternal night
#

might just wanna make one yourself for this

#

or was that paper

ivory sleet
#

Probs paper

eternal night
#

sad

chrome beacon
#

and?

silk tusk
#

I usually see null items rather than air

chrome beacon
#

Yeah they are null 99% of the time

ivory sleet
#

Spigot is somewhat inconsistent with null and air

chrome beacon
#

You can

ivory sleet
#

Checking for both is probably best

chrome beacon
#

Not holding an item

#

xd

#

Yeah it is

#

Spigot really is inconsistent

#

Yeah

#

or use an EnumSet like Conclure said

#

getItemMeta can be null

#

Check if it a has item meta before calling

#

Yes

silk tusk
#

you can also use item.containsEnchantment(ench)

#

rather than getting meta

glossy scroll
#

Hey I'm confused on what I should put as the JsonSerializationContext for TextComponentSerializer

torn shuttle
#

anyone know how to add the proper javadoc documentation (comments) from the spigot api (or any api) to intellij assuming you're using gradle and not maven?

#

it used to work most of the time with maven but with gradle I'm guessing there's some specific setup step that is required

eternal night
#

I mean, the error message is rather clear. Movement is processed on the main thread of the server.

#

Incoming packets are not

#

so you are moving an entity around on a different thread which is somewhat fine until it crosses a chunk board, in which case the old chunk lets loose of the entity and the new chunk tracks it.

#

doing so on a non-main thread causes this error

untold rover
#

Hey, I am looking for a SignGUI for 1.16.4/5 that works without issues and is a standalone class, does anybody have one?

vast quest
#

how can I get the target block of a player?

tawdry plume
#

hey guys trying to create a list of entities but getting an error on Arrays. List<EntityType> list = Arrays.asList(EntityType.CREEPER, EntityType.ZOMBIE);

#

Anyone know why?

#
    - Arrays cannot be 
     resolved
    - List cannot be resolved 
     to a type```
eternal night
#

you'll have to move the movement logic onto the main thread

#

missing imports ?

drowsy helm
#

you need to declare the array

eternal night
#

?

#

idk what buoo is on, your code is perfectly fine for creating a list of entity types

#

just missing some imports I am guessing

drowsy helm
#

does asList take varargs aswell?

#

thought it didnt

eternal night
#

it does yea

drowsy helm
#

ah mb

tawdry plume
#

I'm a little confused but I think that may be simpler

drowsy helm
#

nah your code is fine, like lynx said it looks like imports

tawdry plume
#

i imported import java.util.ArrayList; but still nothing

drowsy helm
#

you want to import List

#

you are using a List not ArrayList

tawdry plume
drowsy helm
#

What ide are you using btw?

#

most should have an auto import feature

tawdry plume
#

now it's saying Array cannot be resolved

#

I'm using eclipse 🙂

drowsy helm
#

Ctrl + Shift + O

#

it will auto import your stuff

tawdry plume
#

that's cool it just did

#

this line just keeps throwing out error after error wtf

drowsy helm
#

lmao

#

should be all fixed now though?

tawdry plume
#
    - Line breakpoint:Listeners [line: 30] - creatureDmg
     (EntityDamageByEntityEvent)
    - The method asList(EntityType, EntityType) is undefined for the type 
     Array```
drowsy helm
#

show your code

#

did you change Arrays to Array?

tawdry plume
#
            String name = event.getEntityType().name();
            double damageTaken = event.getDamage();
            
            Location loc = event.getEntity().getLocation();
            
            List<EntityType> list = Array.asList(EntityType.CREEPER, EntityType.ZOMBIE);
drowsy helm
#

yeah Arrays, not Array

tawdry plume
#

RIP done

#

i changed it to import java.util.Arrays; too

#

that seemed to fix everything

#

now for the BEST part

#

if we can get this to work ill be friggin happy

drowsy helm
#

lmao

#

whats the plugin for

tawdry plume
#

spawning random mobs lol

opal sluice
#

I wouldn't recreate an array each time you damage an entity

#

you should cache it

drowsy helm
#

yeah, could be created outside of the method

tawdry plume
#

ty for bringing it up

drowsy helm
#

not a gigantic memory hog so its pretty negligible

tawdry plume
#

would it be a public method outside the method? and into the class

#

no it'll be a private variable*

drowsy helm
vast quest
#

how can I get the target block of the player

tawdry plume
#

private List<EntityType> list = Arrays.asList(EntityType.CREEPER, EntityType.ZOMBIE, EntityType.CHICKEN);

ivory sleet
#

can be final also

opal sluice
drowsy helm
#

final, also immutable if you really want

ivory sleet
#

Yeah List.of might be more suitable

tawdry plume
coral sparrow
#

yo guys i wan a crate bedwar plagin but i dont kno what is arrylist

#

by the way wut is car

drowsy helm
#

an arrayList is a collection of objects

coral sparrow
#

char i tink

coral sparrow
torn shuttle
coral sparrow
#

that was lame

tawdry plume
#

So this is what I'm using to spawn the random entity loc.getWorld().spawnEntity(loc, mobList.get(random.nextInt(mobList.size())));

coral sparrow
#

😔

tawdry plume
#

I'm getting the error The method spawnEntity(Location, EntityType) in the type World is not applicable for the arguments (Location, Object)

#

not understanding because i'm providing it a location and an entity type

opal sluice
#

Mmmh

drowsy helm
#

why is it being cast to obejct?

#

mobList is a collection or EntityType right

#

not Object

opal sluice
#

isn't your list named "list"

tawdry plume
#

private List<EntityType> mobList = Arrays.asList(EntityType.CREEPER, EntityType.ZOMBIE, EntityType.CHICKEN);

opal sluice
#

(from what you've sent before)

tawdry plume
#

i changed it to mobList

opal sluice
#

Mmmh why is that on private ?

drowsy helm
#

huh

opal sluice
#

Are you doing it outside the method ?

tawdry plume
#

because I don't want anyone outside of this class to access this?

#

yeah

#

    private List<EntityType> mobList = Arrays.asList(EntityType.CREEPER, EntityType.ZOMBIE, EntityType.CHICKEN);
    
    
    @EventHandler
    public void creatureDmg(EntityDamageByEntityEvent event, List mobList) {```
opal sluice
#

You shouldn't initialise a non static var outside a method

#

you should init it on the constructor

tawdry plume
#

damn taking me back

#

i haven't done that in a long time haha

#

ok time to google constructor

opal sluice
#

Just do, public Listeners() { mobList = Arrays.asList(EntityType.CREEPER, EntityType.ZOMBIE, EntityType.CHICKEN); }

#

and so your private would be

#

private List<EntityType> mobList;

tawdry plume
#

right

#

well it is static though? the list won't change

drowsy helm
#

it can be, yeah.

ivory sleet
#

dont think about static

#

it isnt needed there

opal sluice
#

I wouldn't do static since you're not going to use it without an actual instance of this listeners class

drowsy helm
#

its called in moveEvent, none for specifically jumping htough

tawdry plume
#

so i would have to keep it uninitialized and then create it under my Main class

#

i thought there was a constructor method that we could use within classes to do this

#

i haven't done this in a long time sorry guys

opal sluice
#

You have to register your listeners anyway

#

and create an instance of the listener in the onEnable method

tawdry plume
#

I am

#
        instance = this;
        getServer().getPluginManager().registerEvents(new Listeners(), this);
    }```
opal sluice
#

So, you have your instance

#

The constructor will be called at that call

tawdry plume
#

but I don't understand the one liner too much

#

not sure why i have to pass the main instance over

drowsy helm
#

use getFrom and compare to current location, if getFrom.y > loc.y its a jump

opal sluice
#

You don't have to

#

Why would you ?

tawdry plume
#

that's what confused me

#
    
    private static Main instance;    
    public static Main getInstance() { return instance; }

    @Override
    public void onEnable() {
        instance = this;
        getServer().getPluginManager().registerEvents(new Listeners(), this);
    }```
#

I thought it was needed to work

opal sluice
#

Well I never told you to pass the actual instance x)

ivory sleet
#

:I

tawdry plume
#

ill comment it out and see if it works

drowsy helm
#

try and avoid using static instance stuff like that

opal sluice
#

It's ok doing it here

#

Cause JavaPlugin is a singleton

ivory sleet
#

I mean I would argue not to do it if you wanna write loosely couple code and keep your code object oriented

opal sluice
#

Since it's a Singleton, doing it in a static way it's not bad, it's the purpose of the singleton so he can do it by injection or by static, here is the same tbh

tawdry plume
#

I'm going to have to start from scratch pretty much with this lol

drowsy helm
#

yep, looks good to me

#

might want to use getTo() instead of getLocation

opal sluice
#

You could also use event.getTo()

drowsy helm
#

location wouldn't be updated byh then

ivory sleet
drowsy helm
#

is it registered

opal sluice
#

that was 'or' missclick ^^'

coral sparrow
#

register the events

#

oh

#

is the plugin loaded?

#

lmao

ivory sleet
# opal sluice that was 'or' missclick ^^'

oh right I mean I couldn't care less if anyone decides to use a static singleton I'm pointing out this:

I mean I would argue not to do it if you wanna write loosely couple code and keep your code object oriented

coral sparrow
#

@last temple by the way, why did you define player in the first place

#

oh cool then

tawdry plume
#

@opal sluice how does this look:

  1. in main initialize the listeners class and assign a variable

Listeners x = getServer().getPluginManager().registerEvents(new Listeners());

  1. inside Listeners class create a constructor to intialize the private mobList.
        mobList = tmpMobs;
    return mobList;
    }```

3. back in main send the list over to setMobs constructor

```x.setMobs(Arrays.asList(EntityType.CREEPER, EntityType.ZOMBIE, EntityType.CHICKEN));```
tawdry plume
#

I thought i was on to something

opal sluice
#

So, you'll not be able to save an instance of that, and there are no reason to do it tbh

tawdry plume
#

but i thought you guys told me to get rid of this

opal sluice
#

Then, yeah, you forgot the plugin instance to pass

#

doing "this" has nothing to do with the instance you saved in the static var

tawdry plume
#

i was getting a lot of errors

#

ok one issue at a time then lol

#

ok i will

opal sluice
#

Then, you said "I create a constructor"

#

Those are not constructors, but methods

#

You don't need methods to do it

#

do it in the constructor

#

The constructor is a method called the same as the actual class file

#

and not having any return type

coral sparrow
#

Ig it does until you reach the ground

opal sluice
#
// For you it would be like that
private List<EntityType> mobsList;

public Listeners(List<EntityType> mobsList)
{
  this.mobsList = mobsList
}
torn shuttle
#

oh I was being half blind, figured out the doc issue

ivory sleet
#

🤡

vapid quest
#

Hi, is there a way to check if the blocks are connected to the ground?
My idea is to make it so that when a structure is completely "floating" in the air, it collapses. (Turn into falling blocks)

tawdry plume
#

getting this error though on this.moblist mobsList cannot be resolved or is not a field

ivory sleet
#

hows ur class looking

opal sluice
#

don't forget the

tawdry plume
#

    private List<EntityType> mobList; //Arrays.asList(EntityType.CREEPER, EntityType.ZOMBIE, EntityType.CHICKEN);
    
    public Listeners (List<EntityType> mobsList) {        
        this.mobsList = mobsList;
    }
    ```
opal sluice
#
private List<EntityType> mobsList;
#

you forgot an s

#

on mob

#

that's why x)

coral sparrow
#

yeah

tawdry plume
#

RIp problem exists between user and keyboard

#

lol

opal sluice
tawdry plume
#

you mean split them out into individual methods?

opal sluice
#

sorry I meant handle**

tawdry plume
#

for spawning a creature and etc after taking dmg

#

oh yeah

opal sluice
#

So you would have EntityDamageByEntityEvent in one class

tawdry plume
#

i wanted to make this work and then tidy up the code that's my approach to coding. it's ugly

opal sluice
#

then an other event in an other class

#

etc.

tawdry plume
#

right on!

#

I'm still getting The method spawnEntity(Location, EntityType) in the type World is not applicable for the arguments (Location, Object)

#
            loc.getWorld().spawnEntity(loc, mobList.get(random.nextInt(mobList.size())));```
opal sluice
#

Well, cast the object

tawdry plume
#

what does that mean

opal sluice
#

loc.getWorld().spawnEntity(loc, (EntityType) mobList.get(random.nextInt(mobList.size())));

tawdry plume
#

ohhh

#

it needed a type

#

ty for holding my hand thru this

opal sluice
#

Normally you wouldn't but idk why the list doesn't seem to pass the type when you get an item by index in your case

tawdry plume
#

oh ok

#

last question i have and it might be a logic one is..

#

every time a mob takes damage, i want it to retain the health. can i place a variable in a constructor that holds and refreshes the value of the mob(s) health being hit until it reaches 0?

#

what's currently happening is when a mob takes damage, I'm teleporting it outside the map to be killed and spawning a new mob in its place

#

i'd like for the new mob and future mobs to retain the health value and eventually die

quaint mantle
#

instead of getting him outside the map

tawdry plume
eternal night
#

isn't there Entity#remove

#

should skip the death animation

tawdry plume
#

ooooo

#

juicy information lynx

paper viper
#

?jd

queen dragonBOT
quaint mantle
#

LOL

tawdry plume
#

I don't see that

quaint mantle
#

well anyway does anyone have some ideas

tawdry plume
paper viper
#

what..

quaint mantle
tawdry plume
#

thanks 🙂

paper viper
#

no im implying it can be found in the docs

#

lmao

tawdry plume
#

so there doesn't seem to be a remove only damage or set health

eternal night
#

idk man

paper viper
#

for the Entity?

#

it def exists

eternal night
#

I can see it right there 😭

paper viper
#

unless you using some outdated ass version

tawdry plume
#

wtf

paper viper
#

¯_(ツ)_/¯

tawdry plume
#

this is my bookmarkhttps://hub.spigotmc.org/javadocs/spigot/index.html

#

looks like the same thing

#

and i just searched for entity ctrl+f for remove and nothing

#

RIP me

eternal night
#

don't ctr+f

#

there is a search bar for a reason

paper viper
#

yeah.. there is a search function

eternal night
#

ctr+f only looks at the currently loaded webpage

paper viper
#

methods arent in the main page

tawdry plume
#

lmao

paper viper
#

smh

eternal night
#

the javadocs are more than one webpage xD

hardy hornet
#

hello how can i create plugin?

tawdry plume
#

guys i loaded up the entity page and then searched that

#

lord

paper viper
tawdry plume
#

lmao deserved

eternal night
#

so many tutorials out there already

hardy hornet
#

so?

eternal night
#

why do you ask us xd

hardy hornet
#

then?

tawdry plume
paper viper
#
  1. Use google
hardy hornet
#

ok

hardy hornet
#

thanks

tawdry plume
#

so I just ran the new version of the code but nothing is spawning when an entity is taking damage now

#

loc.getWorld().spawnEntity(loc, (EntityType) mobsList.get(random.nextInt(mobsList.size())));

#

console says ShapeShift v0.1 attempted to register an invalid EventHandler method signature "public void com.cowagames.Listeners.creatureDmg(org.bukkit.event.entity.EntityDamageByEntityEvent,java.util.List)" in class com.cowagames.Listeners

eternal night
#

why is there a list argument to your event listener

#

blocks do not carry over information whether or not they were generated or placed

#

yeah blocks don't save this

tawdry plume
#

but it's saying the constructor is undefined now

#

ok i get it

#

the list object is to pass it a list of entities

#

getServer().getPluginManager().registerEvents(new Listeners(Arrays.asList(EntityType.CREEPER, EntityType.ZOMBIE, EntityType.CHICKEN)), this);

#
        this.mobsList = mobsList;
    }
    ```
#

that's how it's getting intialized

#

then we pass it over to the damageby event public void creatureDmg(EntityDamageByEntityEvent event, List mobsList) {

#

to spawn a new entity

fickle glen
#

How can I fill the chest I opened with random items?

        @EventHandler
        public void onPlayerInteract(PlayerInteractEvent e) {
            if (e.getClickedBlock().getType() == Material.CHEST) {
                Player pl = (Player) e.getPlayer();

                //xxxx
                pl.sendMessage("true");
            }

        }
tawdry plume
#

my question is why is it an invalid eventhandler hmm

quaint mantle
fickle glen
#

thankyou

paper viper
#

Make sure to please cache the material values

#

dont call .values() each time

tawdry plume
#

oh

#

why?

fickle glen
opal sluice
coral sparrow
opal sluice
#

Why are you even trying to pass the actual mobsList

coral sparrow
#

java tutorials online would be helpful

opal sluice
#

When you can just get it from the same class

#

It's a class variable

#

no need to pass it

tawdry plume
#

i got confused

opal sluice
#

not the constructor part

#

You can pass anything in the constructor

#

The problem here

#

is that you're trying to add a parameter

#

to an event method

#

and you can't do that

tawdry plume
#

ok fixed, that was an oversight sorry

#

the morphing works great now! and the remove element is beast

#

the only problem i have now is the HP

#

can i keep track of their HP somehow from the original mob?

opal sluice
#

What you can do

#

is

#

remove the entity

#

get the total damage

#

spawn the new entity

#

apply the total damage to new entity

tawdry plume
#

that's what I was doing before

opal sluice
#

or, get the max health of that entity - total damage

#

and set the health

tawdry plume
#

but would that be fair? what if we're fighting a cow then a dragon spawns

#

his health would be insane

keen kelp
#

how do I init a List?

paper viper
#

what type of List

keen kelp
#

string

paper viper
#

you cant initialize/instantiate a List

opal sluice
paper viper
#

List is an interface

keen kelp
#

thanks

paper viper
#

you can only use an ArrayList, and subclasses of List

tawdry plume
#

i tried to use set health at the end of loc.getWorld().spawnEntity(loc, (EntityType) mobsList.get(random.nextInt(mobsList.size()))) but it doesn't seem available

keen kelp
#

so this?
ArrayList<String> Lore = new ArrayList<String>();

tawdry plume
#

would i have to make an entity variable out of this line then set it?

opal sluice
#

List<String> lore = new ArrayList<>();

opal sluice
#

so you can do

keen kelp
#

that gets underlined

#

error

opal sluice
#

Entity spawnedMob = loc.getWorld().spawnEntity(loc, (EntityType) mobsList.get(random.nextInt(mobsList.size())));

paper viper
#

you didnt import the class

keen kelp
#

<String> get underlined with
Type 'java.awt.List' does not have type parameters

paper viper
#

please learn java

#

first

#

you imported the wrong class

#

smh

keen kelp
#

bruh

#

idk the package name so yeah :/

opal sluice
#

java.util.list

keen kelp
#

I figured that out

#

I meant when I first imported it

tawdry plume
#

Entity spawnedMob = loc.getWorld().spawnEntity(loc, (EntityType) mobsList.get(random.nextInt(mobsList.size())));

#

setHealth doesn't seem to be available for that

#

spawnedMob variable

opal sluice
#

lmck

hollow arch
#

Heya - Is there a way to send a message when a player logs onto the server w/ bungee? From what I can tell the client doesn't receive messages if I send them directly on PostLoginEvent

tawdry plume
eternal oxide
#

to what?

tawdry plume
#

Entity takes damage, we store the damage done to that entity and apply it to the new entity spawned

#
            double maxHealth = zombie.getAttribute(Attribute.GENERIC_MAX_HEALTH).getValue();                
            zombie.setHealth(maxHealth-damageTaken);```
#

I've done it this way before

#

but now that we're randomizing the entity spawned I can't

#

Entity spawnedMob = loc.getWorld().spawnEntity(loc, (EntityType) mobsList.get(random.nextInt(mobsList.size())));

#

i'm guessing it's because of the spawn vs spawnEntity difference?

eternal oxide
#

cast it to Damageable

tawdry plume
opal sluice
tawdry plume
#

not sure what you mean

eternal oxide
#

if the Entity is instanceof Damageable, cast it and then you'll have setHealth

tawdry plume
#

how would i cast it?

eternal oxide
#

Java

opal sluice
#

Damageable spawnedMob = (Damageable) loc.getWorld().spawnEntity(loc, (EntityType) mobsList.get(random.nextInt(mobsList.size())));

tawdry plume
#

oh wow

#

i didn't know an entity could be still be an entity but be under damageable

eternal oxide
tired spoke
#

Can i use Maven to add 1.8 support to a 1.12.2 plugin?

opal sluice
hollow arch
#

It sends before the player actually joins

opal sluice
#

It should be LivingEntity

#

and not damageable

#

So

#

LivingEntity spawnedMob = (LivingEntity) loc.getWorld().spawnEntity(loc, (EntityType) mobsList.get(random.nextInt(mobsList.size())));

eternal oxide
#

Either, LivingEntity inherits Damageable, but Damageable; is the interface that controls its health

opal sluice
#

Damageable is for items

#

Oh, ok ok mb

eternal night
#

There is two

tawdry plume
#

hmmm so would it be a damageable or living

opal sluice
opal sluice
tired spoke
#

Can i use Maven to add 1.8 support to a 1.12.2 plugin?

tired spoke
#

i need to recreate on 1.8?

tawdry plume
opal sluice
tired spoke
#

or what i need to do

tawdry plume
#

The method getAttribute(Attribute) is undefined for the type Damageable

eternal oxide
#

If you want to do other things, use LivingEntity

opal sluice
tired spoke
opal sluice
tired spoke
#

oh ok

tawdry plume
opal sluice
eternal oxide
opal sluice
#

So just remove the total damage from the actual health

tawdry plume
#

spawnedMob.setHealth(damageTaken - spawnedMob.getAttribute(Attribute.GENERIC_MAX_HEALTH).getValue());

#

yeah but how would i get the actual health

#

isn't that max health

#

oh nvm

#

derp

#

get health

opal sluice
#

spawnedMob.damage(totalDamage);

tawdry plume
#

cuz it's spawning with max

opal sluice
#

yup

eternal oxide
#

however, calling damage will trigger a damage event

tawdry plume
#

ok so now how do we carry this over to the next mob? cuz the next one will spawn and only get the dmage that was caused to the previous one

opal sluice
#

Oh lol that would make a damage machine 😂

tawdry plume
#
            String name = event.getEntityType().name();
            double damageTaken = event.getDamage();

            Location loc = event.getEntity().getLocation();
            
            //kill previous entity
            event.getEntity().remove();
            
            Random random = new Random();
            Damageable spawnedMob = (Damageable) loc.getWorld().spawnEntity(loc, (EntityType) mobsList.get(random.nextInt(mobsList.size())));
            
            spawnedMob.setHealth(damageTaken - spawnedMob.getHealth());
            ```
opal sluice
#

Well, then use LivingEntity to get the max health and set the health to not trigger a damage event

eternal oxide
tawdry plume
#

sure

#

i want mobs to change every time i hit them

#

but i want their health to eventually drop to 0 lol

eternal oxide
#

as in, it changes to a different type?

tawdry plume
#

correct, a totally diff. entity

eternal oxide
#

ok, that makes more sense

tawdry plume
#

so if it's a chicken it can become a zombie 🙂

#

I'm just not sure how to retain the hp and keep track of that now

#

that's the last hurdle

eternal oxide
#

Instead of casting it to Damageable, cast to LivingEntity

tawdry plume
#

I'm on it

#

why though

eternal oxide
#

LivingEntity has the arributes so you can read them,. It also implements Damageable

tranquil owl
#

Hi
What AWD (antiworlddownloader) do you recommend?

tired spoke
#

i probabbly do better by restarting to code because i found some problems

tawdry plume
eternal oxide
#

you would need to get the Max health of the entity you are killing. Set that max health on the entity you are spawning, then copy over its actual health

coral sparrow
tired spoke
eternal oxide
tired spoke
#

for now i am not using

coral sparrow
#

unless if it shows errors

topaz shale
#

Is there anyone that does development work?

tawdry plume
tired spoke
#

are errors internal the team system

tired spoke
#

i'll recode from 8th june

coral sparrow
#

?paste

queen dragonBOT
eternal oxide
#

Check its a LivingEntity and cast

quaint mantle
#

Hi i Have promble in using ArrayList

#

this is my code

coral sparrow
#

On the web

quaint mantle
#
public class MapManager {
    
    public List<Map> maps = new ArrayList<>();
    public MapManager MapManager() {
        return this;
    }
    
    public List<Map> Maps(){
        return maps;
    }
    
    public void addALine(Map e){
        Maps().add(e);
    }
    
    public boolean isInGame(Player player){
            Map m = Maps().get(1);
            for ( int j = 0 ; j <= m.getPlayers().size() ; j++ ){
                Player p = m.getPlayers().get(j);
                if ( p == player){
                    return true ;
            }
        }
        return false ;
    }
    
    public void setMap(Map m){
        if ( Maps().size() == 0 ){
            addALine(m);
        } else {
            if ( Maps().size() == 1 ){
                maps.clear();
                addALine(m);
            }
        }
    }```
#

i used setMap(new Map ... in a Class

#

it sayed added to arayy list

#

but i use list commad it sayed me 0 is size of array

#

and it not added

#

can help me pls ?

steep nova
#

that code looks mega confusing to me

tawdry plume
coral sparrow
#

/list command??

quaint mantle
#

yes

coral sparrow
#

can u show the command method

quaint mantle
#

yes wait

coral sparrow
#

btw /list is already a spigot command

tired spoke
tawdry plume
#

@eternal oxide I'm using EntityDamageByEntityEvent which is inherited from an entity it seems but entity doesn't have the get health method

quaint mantle
#
if ( e.getMessage().toLowerCase().equals("/ffaadmin list") ){
            e.getPlayer().sendMessage(" " +mm.maps.size()) ;
        }```
#

i test it in a onCommand

#

but are like this

eternal oxide
steep nova
opal sluice
quaint mantle
#

a

#

whats it ?

opal sluice
#

Well, I guess you are since you're doing e.getMessage()

eternal oxide
#
Entity entity = event.getEntity();
if (!(entity instanceof LivingEntity)) return;

LivingEntity mob = (LivingEntity) entity;```
opal sluice
#

Don't do that

#

Just implements CommandExecutor

quaint mantle
#

ik . but i add /ffaadmin list command on a onCommand() class

opal sluice
#

and make a new legit command

quaint mantle
#

but it similar returned

#

i make it beforce

opal sluice
#

you just need to register ffadmin

quaint mantle
#

tes

#

yes

opal sluice
#

and then you check for the args of the command

quaint mantle
#

i registed

opal sluice
#

Even in the plugin.yml ?

quaint mantle
#

yes

#

and main

opal sluice
#

You set the executor to the right class ?

quaint mantle
#

i added a object too maps Array on MapManager , and i use this for return size of this array . but it returned me 0

#

but i added a object

quaint mantle
#

yes *

tawdry plume
eternal oxide
#

()

#

fixed

opal sluice
quaint mantle
opal sluice
quaint mantle
#

do you want my full source code of my plugin ? i can send it

tawdry plume
#

now to the spawn method

opal sluice
quaint mantle
tawdry plume
#

first issue i've been encountering as soon as I change it to th spawn method from spawnEntity is that i receive an error stating The method spawn(Location, Class<T>) in the type World is not applicable for the arguments (Location, EntityType)

quaint mantle
tawdry plume
#

what class would I have to use then to spawn?

#

I'm confused

eternal oxide
tawdry plume
#

and not random entities

eternal oxide
#

you use whatever class you want to spawn

opal sluice
#

Just do

#

#getEntityClass

#

on your EntityType

eternal oxide
#

it has a Consumer

tawdry plume
#

so from LivingEntity spawnedMob = (LivingEntity) loc.getWorld().spawnEntity(loc, (EntityType) mobsList.get(random.nextInt(mobsList.size())));

#

to

#

LivingEntity spawnedMob = (LivingEntity) loc.getWorld().spawn(loc, (newMob) newMob;```
#

something similar to that?

eternal oxide
#

yes

#

no cast on newMob

opal sluice
tawdry plume
#
            LivingEntity spawnedMob = (LivingEntity) loc.getWorld().spawn(loc, (newMob.getEntityClass() newMob));```
tawdry plume
#

I like learning through examples. I should due my job and google/troubleshoot more

#

Was leaning too much on you guys since we're at the home stretch

#

but I came here with almost no knowledge and I've learned a lot so ty

#

I knew Java really well at one point but haven't touched it in years so I'm getting back into it

#

so no not rude and i can partially agree. You guys are helping a ton and that goes unsaid

eternal oxide
#
        double max = entity.getAttribute(Attribute.GENERIC_MAX_HEALTH).getBaseValue();
        double current = entity.getHealth();
        loc.getWorld().spawn(loc, newMob, e -> {
            
            e.getAttribute(Attribute.GENERIC_MAX_HEALTH).setBaseValue(max);
            e.setHealth(current);
        });```
tawdry plume
#

this is what I had prior to you sending that

eternal oxide
#

Thats how to set the max and current health before its spawned/

tawdry plume
#
            
            
            LivingEntity spawnedMob = (LivingEntity) loc.getWorld().spawn(loc, newMob.getEntityClass());            
            spawnedMob.setHealth(damageTaken-spawnedMob.getHealth());
            ```
tawdry plume
eternal oxide
#

Yours would work, but for a short moment the mob would spawn with its default health.

tawdry plume
#

right on

#

so the e-> {}

#

what is e?

#

just tell me the name and ill google the rest

eternal oxide
#

e is the mob that is about to be spawned

tawdry plume
#

oh ok

#

but in java terms what is this called

#

what are you doing

eternal oxide
#

its a Consumer method. Basically it runs that code before teh mob spawns.

tawdry plume
#

right on

#

btw getting errors on e.getattribute - The method getAttribute(Attribute) is undefined for the type capture#1-of ? extends Entity

eternal oxide
#

Its called an Lambda Consumer

#

ah, cast e to LivingEntity

tawdry plume
#

loc.getWorld().spawn(loc, newMob.getEntityClass(), (LivingEntity) e ->

#

like that?

#

The target type of this expression must be a functional interface

eternal oxide
#
((LivingEntity)e).getAttribute(Attribute.GENERIC_MAX_HEALTH).setBaseValue(max);
((LivingEntity)e).setHealth(current);```
tawdry plume
#

((LivingEntity)e).getAttribute(Attribute.GENERIC_MAX_HEALTH).setBaseValue(maxHealth-damageTaken);

#

that's the same logic in one line right?

#

i'm setting the max health the prior's max health - their damage taken

eternal oxide
#

no

#

you are reducing their max health

#

their max health has to be identical, its their currrent health you set lower

tawdry plume
#
((LivingEntity)e).setHealth(maxHealth - damageTaken);```
eternal oxide
#

just read their getHealth

#

unless you are needing to apply damage

tawdry plume
#

im a little confused

#

so get attribute max health set base value is getting their max health and setting it to the original mob we hit

eternal oxide
#

is this in a damage event where you need to apply more damage?

tawdry plume
#

then we aply the damage to set health right?

tawdry plume
eternal oxide
#

yes

tawdry plume
#

so he's getting damaged

#

or he was

eternal oxide
#

yep, so its damage to his health, not his max health

tawdry plume
#

so thinking logically one more time, will mobs eventually die like this?

eternal oxide
#

not with your current code

tawdry plume
#

oh

eternal oxide
#

you have to use the entities gethealth - damage

tawdry plume
#
            Entity entity = event.getEntity();
            if (!(entity instanceof LivingEntity)) return;
            
            LivingEntity mob = (LivingEntity) entity;
            double maxHealth = mob.getAttribute(Attribute.GENERIC_MAX_HEALTH).getValue();
            

            double damageTaken = event.getDamage();

            Location loc = event.getEntity().getLocation();
            
            //kill previous entity
            event.getEntity().remove();
            
            Random random = new Random();
            
            EntityType newMob = mobsList.get(random.nextInt(mobsList.size()));
            
            
            //LivingEntity spawnedMob = (LivingEntity) loc.getWorld().spawn(loc, newMob.getEntityClass());
            
            loc.getWorld().spawn(loc, newMob.getEntityClass(), e -> {
                
                ((LivingEntity)e).getAttribute(Attribute.GENERIC_MAX_HEALTH).setBaseValue(maxHealth);
                ((LivingEntity)e).setHealth(maxHealth - damageTaken);
            });```
#

thought we already had that above with the maxHealth variable? We're getting the original mobs health

#

and applying it to the new one below

#

sorry im a little confused

eternal oxide
#

use getFinalDamage over getDamage

#

else its not takign into account buffs and armor

#

and you need to get teh mobs health as well

tawdry plume
#
double maxHealth = mob.getAttribute(Attribute.GENERIC_MAX_HEALTH).getValue();```
eternal oxide
#
        LivingEntity entity = event.getEntity();
        Location loc = entity.getLocation();
        
        double max = entity.getAttribute(Attribute.GENERIC_MAX_HEALTH).getBaseValue();
        double current = entity.getHealth();
        double damage = event.getFinalDamage();
        
        Entity mob = loc.getWorld().spawn(loc, newMob, e -> {
            
            ((LivingEntity)e).getAttribute(Attribute.GENERIC_MAX_HEALTH).setBaseValue(max);
            ((LivingEntity)e).setHealth(current - damage);
        });```
opal sluice
#

I think that setting the new mob to the max health of the previous mob isn't that great, I would rather calculate a coefficient of max health between the two and then multiply the damages by the coefficient to match the new max health of the new mob

jagged badge
#

Is there a way to detect a right click in the void without item in the hand with the packets? It would seem that this is not possible with the PlayerInteractEvent

eternal oxide
opal sluice
tawdry plume
eternal oxide
#

no need to be super complex. You just start with the max health of the mob you first hit

eternal oxide
#

You are removing the old mob and applying the damage to the new

tawdry plume
#

isn't current health the health of the mob after its been dmged?

eternal oxide
#

when teh event fires no damage has been applied

tawdry plume
#

oooooooooo

eternal oxide
#

you should never be subtracting from Max. Always from current.

#

If you subtract from Max, you are always applying a single set of damage to full health mob

tawdry plume
#

thanks

#

going in to take this for a ride!

#

fingers crossed

#

worked! the only quick error i found was that if an entity hit me it became me and then the whole world froze lol

eternal oxide
#

lol

tawdry plume
#

going to need to put an exception in there somewhere

#

dude this thing is amazing

#

ty so much for all the help

#

and that goes to all of you

#

you guys pretty much have the plugin but if you want the final version just let me know and i can host it somewhere 🙂

eternal oxide
#

You'll have to early return if not instanceof Mob

#

same as you did for LivingEntity

tawdry plume
#

ok trying that now

quaint mantle
#

Hey.

eternal oxide
deep tiger
#

Hello everyone ! I'm trying to deal with packets with bungeecord and i've got this error when i send the packet to the player :

#
java.lang.IllegalArgumentException: Cannot get ID for packet class com.nolydia.bungee.api.protocol.packets.PacketPlayOutOpenWindow in phase GAME with direction TO_CLIENT
quaint mantle
#

https://pastebin.com/y888zxE8 <- I want my timer to add 1 second every second when i do /timer start. When i do /timer stop i want to set it to 0 and then stop adding. Why does it not work?

quaint mantle
#

How can i make one

chrome beacon
#

That will kill the server lmao

quaint mantle
#

I want to add 1 to time every second and display it over the hotbar

opal sluice
quaint mantle
opal sluice
#

that increment if a bool is on true

chrome beacon
opal sluice
#

BukkitRunnable#runTaskTimer

chrome beacon
#

A bit outdated but works

quaint mantle
#

So a BukkitRunnable?

opal sluice
#

y

tawdry plume
#

is it possible to obtain a list of items that's dropped by mob using entity's itemstack and assigning it to the new mob?

eternal oxide
#

or, you could just check if its going to die, remove it, spawn teh original type and kill it

#

you'd still have to do the PDC bit though

tawdry plume
#

hmmm

#

well after killing about 100 mobs

#

only the donkey dropped some leather

#

nobody else dropped anything

eternal oxide
#

in which case, you need to change your code a little

tawdry plume
#

getting food is going to be a b***

#

lol

#

i just find it weird that nobody is dropping anything

eternal oxide
#

you need to set health, set a flag so you don;t process the next damage event, then .damage the entity for the correct amount.

#

its because you are using setHealth and not damage

tawdry plume
#

oh

#

I went from this:

#
((LivingEntity)e).setHealth(currentHealth - damageTaken);```
#

to

#
((LivingEntity)e).setHealth(currentHealth);
((LivingEntity)e).damage(damageTaken);```
eternal oxide
#

you need to ```
if (ignoreEvent) {
set ignoreEvent false
return
}
Check if getHealth - damage <= 0
set a boolean ignoreEvent true

then return instead of spawning.```

deep tiger
eternal oxide
#

ignoreEvent would be a field

#

actually scrap all that

tawdry plume
#

lol ok

#

i'm listening

eternal oxide
#

before you do the spawning, check if current - damage <= 0 return

#

don;t kill the current mob, so before you remove the mob and spawn the new

#

by returning you are simply allowing the event to run and kill the mob.

slim kernel
#

Hello!
Does someone now how I could get the Player, a other Player is looking at?
You don't need to look at the other Player exactly tho and he should not be to far away...
Thank you!

tawdry plume
tawdry plume
#

so wouldn't it be

#

if current - damage !=0 then proceed with the rest of the code else just don't do anythign and the mob will die?

eternal oxide
#

Whatever the mob is that gets the killing blow you let die

eternal oxide
tawdry plume
#

kk

tawdry plume
#

got a ton of chicken and food now haha

slim kernel
eternal oxide
#

Location, would be the players eye location, getDirection for the vector, distance is in blocks, and predicate on Player

#

if you use raySize the javadoc tells you exactly what it does.

#

raySize - entity bounding boxes will be uniformly expanded (or shrinked) by this value before doing collision checks

slim kernel
#

okay thank you

eternal oxide
#

so a bigger value = you can be looking further away from the player and still detect it

slim kernel
#

oh okay thank you

snow bane
#

i have this file that retrieves a weapon from a hashmap

#

but when i try to get a scoped rifle it keeps returning null

#

even though the display name matches the key

slim kernel
compact haven
#

(entity) -> entity.getType() == EntityType.Player

#

something like that should be fine

eternal oxide
slim kernel
compact haven
#

its probably not that exactly

snow bane
compact haven
#

if theres no gettype or whatever then just instanceof check it, but thats more intensive

snow bane
#

ill try without color codes tho

compact haven
#

there literally is a getType

#

and its in all versions

slim kernel
#

yeah I know but its red haha

sharp bough
#

why is inv null there? i already built the inv by running the command

#
    public void onEnable() {
        instance = this;
        // Plugin startup logic
        getServer().getConsoleSender().sendMessage(ChatColor.GREEN + "starting");
        Objects.requireNonNull(getCommand("open")).setExecutor(new Command());
        getServer().getPluginManager().registerEvents(new InvClick(), this);
    }```
#

Main

#
    public boolean onCommand(@NotNull CommandSender sender, org.bukkit.command.@NotNull Command command, @NotNull String label, String[] args) {

        Player player = (Player) sender;

        new InvClick().open(player);

        return true;
    }```
command
slim kernel
eternal oxide
#

You are creating a New InvClick and your inv is not static

slim kernel
sharp bough
eternal oxide
sharp bough
#

yea in the code i sent

eternal oxide
#

and in your onCommand you create a new InvClick

#

use the listener you register not create a whole new instance just to access the Inv

#

Nowhere in the code you showed do you call build() before you try to access inv

sharp bough
#

what are you talking about lmao

#

on command open , i run open() that runs build()

eternal oxide
#

ah ok, SS is too small for me to read

compact haven
#

oh

#

ur creating a raytraceresult

slim kernel
compact haven
#

you dont create raytraceresults, you use the method

#

RaytraceResult is returned by the method, you dont create it

slim kernel
#

so no "new"

compact haven
#

no

#

are u new to java

slim kernel
#

kind of

#

yeah

compact haven
#

player.getWorld().rayTraceEntities(your parameters here)

slim kernel
#

ahhh okay thank you

#

it works thanks

kind coral
#

does signs line count start from 1?

severe folio
#

no, 0

eternal oxide
#

tells you in the javadocs

tawdry plume
#

Hey huge shout out to @eternal oxide who helped me with my first plug-in. Thank you so much!! 🙂

eternal oxide
#

np

tawdry plume
#

Can’t wait to play the game with it haha

eternal oxide
#

Its going to confuse people for sure

young shell
#

I want to send Particles only to Players that have set there visibility in a way that they see the Players from whom the Particles originate from. To do that I have a List that contains all the hidden Players.

if (!hideList.contains(player)) {
    loopPlayer.spawnParticle(Particle.HEART, player.getLocation(), 2, offsetX, offsetY, offsetZ);
    }

Thats the code i use
It doesn't work. Any idea why?
I know for sure that the List is working as it should

slim magnet
#
    public void update(int index, String text) {
        scoreboard.getObjective(DisplaySlot.SIDEBAR).getScore(text).setScore(index);
    }
#

is this how I should update a scoreboard line

lucid bane
#

is there a good way to pause a method few seconds?

young shell
#

wait()

lucid bane
#

no imports needed?

young shell
#

Nope

#

Its a standart java method

lucid bane
#

it says you cant cause it's static method

young shell
#

Get an Instance of you plugin and put the wait method onto that

eternal oxide
lucid bane
#

oh

eternal oxide
#

Do not use sleep(), unless its in a separate Thread.

#

If you wait or Sleep the main thread you lock up the server

lucid bane
#

i'm not sure what thread is or means 😭

#

so if i use those, a whole server waits for it?

eternal oxide
#

If you need to run some code later use teh Bukkit Scheduler

lucid bane
#

i'm trying

#

lots of scheduler methods have a 'task' parameter, is any examples of how to write it?

eternal oxide
#

use new BukkitTask

#

put yoru code in the run() method

#

then runTaskLater

lucid bane
#

new BukkitTask() { @Override public void run() {}} ?

eternal oxide
#

yep

lucid bane
#

thx

eternal oxide
#

if you .runTaskLater at the end you can schedule it to run

#

delay is in ticks, 20 ticks to a second

lucid bane
#

can it runTaskLater less than a single tick?

#

just in case

eternal oxide
#

no

lucid bane
#

thanks

#

sry last one

#

what's difference of Server.getScheduler() and Bukkit one?

eternal oxide
#

none

lucid bane
#

aha

lilac dagger
#

bukkit is a static wrapper of Server

#

using the Server one would be 1 ns faster i guess

lucid bane
#

if i want to put a plugin parameter, is it right that using my main(extends JavaPlugin)'s constructor?

weary geyser
#

huh

lucid bane
#

sry for my english i cant see huh is yes or no

eternal oxide
#

you pass an instance of your main this to any class that needs it.

#

so new YourListenerClass(this);

lucid bane
#

it's in command's onCommand(...) method

quaint mantle
#

?jd

proud basin
#

[ERROR] Could not pass event PlayerMoveEvent

#
@EventHandler
    public void onMove(PlayerMoveEvent e) {
        User user = Rusty.USERS.get(e.getPlayer().getUniqueId());
        Distance distance = new Distance(e);
        CheckResult speed = SpeedCheck.runCheck(distance, user);
        if (speed.failed()) {
            e.setTo(e.getFrom());
            Rusty.log(speed, user);
        }
    }
gleaming venture
#

hey guys, anyone know how to make an enchantment stay on a block even after it is placed?

quaint mantle
#
@EventHandler
    public void onWeatherChange(WeatherChangeEvent e) {
        e.setCancelled(false);
    }```
Can this stop the rain?
lilac dagger
#

no

#

the method represents weather

#

not rain

quaint mantle
#

e.setCancelled(e.toWeatherState()); ?

lilac dagger
#

you have to add a few functions first to make it stop raining

quaint mantle
#

i want to make it always sunny

lilac dagger
#

see to which weather it changes

#

and if it isn't sunny cancel it

gleaming venture
#

can anyone help?

austere cove
#

@gleaming venture blocks can't have enchantments, but you can add some metadata to it and retrieve it later

gleaming venture
#

@austere cove that might be exactly what I need! how can I go about doing that?

quaint mantle
#
if (p.getInventory().getItemInMainHand().getType() == Material.FLINT){
  if (target.getType() == Material.DIAMOND_ORE) {
    target.setType(Material.STONE);
    p.playSound(p.getLocation(), Sound.ENTITY_ITEM_PICKUP, 1.0f, 1.0f);
    p.getWorld().dropItem(p.getLocation(), new ItemStack(Material.DIAMOND, 1));
}
}
```i dont know whats wrong with this and i dont get any errors
#

p represents the player

eternal oxide
gleaming venture
#

would a chest be one of those blocks?

eternal oxide
#

yes

austere cove
#

yea I forgot not all blocks support it

#

chests do

#

TileState#getPersistentDataContainer()

austere cove
#

you need to send a lil more of your code sir

quaint mantle
#

i just have the diamond condition with more ores

#

everything is the same exxcept the materials

quaint mantle
# lilac dagger and if it isn't sunny cancel it
@EventHandler
    public void onWeatherChange(WeatherChangeEvent e) {
        World w = e.getWorld();
        if (e.toWeatherState()) {
            e.setCancelled(true);
            w.setThundering(false);
            w.setStorm(false);
            w.setWeatherDuration(0);
        }
    }```
Is this good?
lilac dagger
#

oh yes

#

this would work too

quaint mantle
#

:>

austere cove
#

what event are you using, what isn't working exactly and did you (properly) register your listener

quaint mantle
#

all the other code are working except this

coral sparrow
austere cove
#

yea if the other ones work and this one doesn't, it would be useful to show more code

coral sparrow
#

Like the method

#

whole event method

quaint mantle
#

its too long

coral sparrow
queen dragonBOT
coral sparrow
#

btw just the method

quaint mantle
#

hello?

coral sparrow
#

ye checkin

coral sparrow
quaint mantle
#

OOf

coral sparrow
#

lmao

quaint mantle
#

i checked the code

austere cove
#

you do

if (target.getType() == Material.STONE) {
    if (target.getType() == Material.DIAMOND_ORE) {
    }
}
quaint mantle
#

there isnt e.getTargetBlock wtf

austere cove
#

so it's actually unreachable code

coral sparrow
austere cove
#

also PlayerInteractEvent#getClickedBlock() is a thing

austere cove
#

you do

quaint mantle
#

i am not doing target.getType(), i am doing p.getInventory().getItemInMainHand().getType()

austere cove
quaint mantle
#

OH THE

#

OMFG

ancient plank
#

?services @topaz shale

queen dragonBOT
sharp bough
#

could someone join my server and help me with a few things?

quaint mantle
#

uh

opal juniper
#

is that ur home ip?

#

that is not a good idea to share

sharp bough
#

lol

#

its a server

#

but i already fixed what i needed

opal juniper
#

Ah, ok

kind coral
#

how could i make it so if i place a sign itemstack it will just set the lines?

#

but i can't seem to make it work

eternal oxide
#

set the lines in a runnable after the event is finished

kind coral
#

how could i do that?

sharp bough
#

with a delayed task

austere cove
#

use the BukkitScheduler

sharp bough
kind coral
sharp bough
#

do the delayed task didint work?

kind coral
#

i don't want to do that, also that would be not working completely? since it just gives time for the player to exit out of the sign GUI for the server to actually edit its data

#

as i understood

sharp bough
#

hm idk signs and editing signs is in my todo list

kind coral
#

ok i am stupid, i didn't register the event

#

lmao

sharp bough
#

lamo

limpid veldt
#

with commands.yml is there a way to set permissions for these custom commands

urban trout
#

what did i do wrong

quaint mantle
#

Well well well what do we have here

eternal oxide
#

if(p.getWorld().getName().equals("" + pWorld)); is never going to match. You are comparign a name to a world

urban trout
#

o

urban trout
#

huh?

eternal oxide
#

No need to register the command as its in his main class

quaint mantle
#

register the command?

glossy barn
#

It's in the main class. It's already registered

quaint mantle
glossy barn
#

the command is already in the main class. It does not need to be registered

urban trout
#

^

quaint mantle
#

I see

opal juniper
#

lmao

urban trout
#

i only want players in the senders world

eternal oxide
#

line 26 you should be using cmd not label. I think its cmd.getNane()

opal juniper
#

#getName() ?

eternal oxide
#

Just compare the world object

fair panther
#

Does anyone know how to make custom weapons? Like not weapons that are changed from the ace or shovel. Like weapons / tools that are brand new.

glossy barn
#

@eternal oxide cmd.getName and label are the same thing

eternal oxide
#

if p.getWorld().equals(pWorld)

urban trout
#

ok

#

thanks

eternal oxide
#

cmd is always the command thats in the plugin.yml

glossy barn
#

i c

#

i have been lied to 😠

eternal oxide
#

I always thought it was the other way around, for the longest time

urban trout
#

i changed it and it still doesnt work

coral sparrow
urban trout
#

Description Resource Path Location Type Command is a raw type. References to generic type Command<S> should be parameterized Main.java /tpworld/src/me/renndrew/tpworld line 24 Java Problem

eternal oxide
# urban trout thanks

You should also remove the suppression on raw types and instead fix any issue it shows

coral sparrow
#

if (sender.hasPermission("e.perm")) {}

eternal oxide
urban trout
#

o

coral sparrow
urban trout
#

aye

#

it worked

#

what was the brigadier import thing

eternal oxide
#

Thats minecraft stuff. Not Spigot

coral sparrow
#

yea

urban trout
#

o

#

the command teleports everyone

#

not just the players in my world

eternal oxide
#

?paste teh code you have now

queen dragonBOT
urban trout
coral sparrow
#

if(p.getWorld().equals(pWorld));
p.teleport(pLocation);
p.sendMessage("§a§lSMPcraft » §aYou've been teleported to: " + player.getName());
}\

eternal oxide
#

line 33 change the ; to a {

coral sparrow
#

nice if statement

eternal oxide
#

and add a close after the sendMessage line

coral sparrow
#
if(p.getWorld().equals(pWorld));{
    p.teleport(pLocation);
    p.sendMessage("§a§lSMPcraft » §aYou've been teleported to: " + player.getName());
            }```
eternal oxide
#

or you could change it to if (!p.getWorld().equals(pWorld)) continue;

eternal oxide
urban trout
#

ok i changed it and it didnt work

eternal oxide
#

show how you changed it

urban trout
#
                    if(p.getWorld().equals(pWorld)) {
                        p.teleport(pLocation);
                        p.sendMessage("§a§lSMPcraft » §aYou've been teleported to: " + player.getName());
                    }
                }```
coral sparrow
#

xD

eternal oxide
urban trout
#

o

#

it teleports players in other worlds

eternal oxide
#

It should not, you sure you compiled and uploaded the new jar?

urban trout
#

oh there we go

coral sparrow
#

weird

quaint mantle
# urban trout oh there we go
for(Player p : Bukkit.getOnlinePlayers()) {
    if(!p.getWorld().equals(pWorld)) continue;

    p.teleport(pLocation);
    p.sendMessage("§a§lSMPcraft » §aYou've been teleported to: " + player.getName());
}```
#

Use this

#

looks better 😎

#

the one ya sent is okay but this is cooler

urban trout
#

i forgot to reload 🤦‍♂️

quaint mantle
#

lol

chrome beacon
#

Reload kekwhyper

urban trout
#

lmfao

#

i always mess up on the simple bits

#

such as imports

#

or the most recent example: reloading 🤦‍♂️

slim kernel
#
player.sendMessage("2");

Location spawnLoc = new Location(player.getWorld(), player.getLocation().getX(), player.getLocation().getY() + 5 , player.getLocation().getZ());
RayTraceResult rayTraceResult = player.getWorld().rayTraceEntities(player.getLocation(), player.getLocation().getDirection(), 30, (entity) -> entity.getType() == EntityType.ZOMBIE);

spawnLoc.getBlock().setType(Material.GRAVEL);
FallingBlock fallingBlock = (FallingBlock) spawnLoc.getBlock();

player.sendMessage("3");
#

I get the first "2" but not the "3" something is wrong in between I cant find it tho

chrome beacon
#

Errors?

slim kernel
#

no it just does not get to 3

#

or anything after