#help-archived

1 messages · Page 87 of 1

naive goblet
#

I mean doing it the real way could use to store custom nbt data but that might be little tricky for you so maybe map the entities or similar.

tall pewter
#

Any ideas?

naive goblet
#

nimsy let me see

naive goblet
#

Are you coding the plugin?

tall pewter
#

no there's nothing to code

naive goblet
#

Just default scoreboard?

tall pewter
#

i'm not sure what's causing this

#

but i know it has to do with scoreboards

#

and whatever scoreboard-related plugins i have rn are not causing it

naive goblet
#

well it doesn't seem to be a plugin

tall pewter
#

Not directly at least

#

A plugin is causing this error though

inland depot
#

maybe i'll just use a pre-existing plugin

naive goblet
#

Still what plugins do you have in your bungee?

inland depot
#

thanks

tall pewter
#

On my proxy?

#

I have Luckperms and DepenizenBungee

naive goblet
#

yeah

#

DepenizenBungee

#

what is that

#

Ultra sure

tall pewter
#

When I'm not using java, I'm scripting with a plugin called Denizen. DepenizenBungee allows me to use Denizen throughout my servers

cloud crater
#

@tall pewter seems to be trying to add a new team to the scoreboard that’s already exist

tall pewter
#

exactly

#

perhaps the team that already exists is still stored in the server memory somehow

#

we just gotta find a way to get rid of it

#

I've tried deleting the scoreboard.dat file many many times

naive goblet
#

You sure it's not the DepenizenBungee plugin that might cause it?

#

Idk never heard of it but it seems suspicious

tall pewter
#

I mean i can delete it and see what'll happen

cloud crater
#

Delete scoreboard.dat

inland depot
#

iterate through all existing teams and delete them and start from scratch?

naive goblet
#

yeah try that and reset the data as well

cloud crater
#

And set it up again

naive goblet
#

Syxteen wouldn't help if the error keeps occuring

#

Ultra yes but if the error is by server side it will keep popping up unless you find out what causes it.

cloud crater
#

It’s the scoreboard itself conclure

naive goblet
#

API let's you interact with scoreboard

tall pewter
#

oo

#

i can check my PAPI installs

naive goblet
#

sure

#

everything that might interact with the scoreboard

tall pewter
#

these are the placeholde hooks i seem to have: bedwars, bungee, cc, denizen, gadgetsmenu, luckperms, ocm, player, tab

naive goblet
#

It might not even be an expansion

#

It's often the plugin to the expansion then

tall pewter
#

so what do you suppose i do?

naive goblet
#

I mean I still think denizen is suspicious

frigid ember
#
                    p.getInventory().setItem(1, Items.byName("ENDER_PEARL").getItemType(p));
``` so i am giving back the ender pearl (ender butt) after they use it but then it doesnt give it back ^
tall pewter
#

i've deleted denizen before and the same problem still occurs

brisk mango
#

dont use ur own methods then @frigid ember

signal yarrow
#

@frigid ember have you tried

p.updateInventory();
brisk mango
#

no need for that @signal yarrow

frigid ember
#

Its not my own method is the thing lmfao

brisk mango
#

?

#

pretty sure Items is ur own class

#

i mean

#

why dont u just do new ItemStack(Material.ENDER_PEARL))

frigid ember
#

it gives the player the item by the name ENDER_PEARL and the type is a pearl

#

reasons

#

its still gets the name then the type

#

that returns Material.ENDER_PEARL

brisk mango
#

i dont know whats your point

#

you need ItemStack constructor in order to give players items

frigid ember
#

?

torn pilot
#

*$

brisk mango
#

do player.getInventory().setItem(1, new ItemStack(Material.ENDER_PEARL)) @frigid ember

frigid ember
#

But i want the Name that is custom set in my EnderButt Class.

brisk mango
#

HUH

frigid ember
#

if i could i would send a ss

brisk mango
#

can you say a little more information

#

you never said that you want the pearl to have a custom name

frigid ember
#
package me.l3ilkojr.hubcore.Items.impl;


import me.l3ilkojr.hubcore.Items.Items;
import me.l3ilkojr.hubcore.Utils.StringUtil;
import org.bukkit.Material;
import org.bukkit.configuration.file.FileConfiguration;
import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.meta.ItemMeta;

import java.util.List;

public class EnderButt extends Items {

    public EnderButt() {
        super("ENDER_PEARL");
    }



    @Override
    public ItemStack getItemType(Player player) {

        ItemStack itemStack = new ItemStack(Material.ENDER_PEARL, 1);
        ItemMeta itemMeta = itemStack.getItemMeta();
        itemMeta.setDisplayName(StringUtil.format("&5EnderButt"));
        itemStack.setItemMeta(itemMeta);
        itemStack.setItemMeta(itemMeta);
        return itemStack;
    }

    @Override
    public String getItem() {
        return "ENDER_PEARL";
    }

    @Override
    public String getItemDisplayName() {
        return StringUtil.format("EnderButt");
    }

}``` ender butt class
brisk mango
#

why does a getItem return a string

frigid ember
#

get Item doesnt do anything atm

brisk mango
#

i mean

#

it returns a string

frigid ember
#

ok?

brisk mango
#

😂

frigid ember
#

if you think you can fix my problem go ahead if not stop laughing and gtfo

#

hi, i want to start my server with 10MB

this one only have 1MB
java -Xms1G -Xmx1G -jar Server_Spigot_1.15.2.jar -o true
pls help ?

inland depot
#

@frigid ember instead of setItem, try using

p.getInventory().addItem(ItemStack i);
torn pilot
#

Set -Xmx to 10G then

frigid ember
#

Does it allow me to set the slot is what i need to

#

not just to add an item to an inv

inland depot
#

so what exactly isnt working?

#

sorry i was too lazy to scroll

torn pilot
#

Or 1024

frigid ember
#

it doesnt give it back when i throw the pearl

naive goblet
#

Server_Spigot_1.15.2.jar Agam why this jar name :i

torn pilot
#

Without the G

inland depot
#

send the full method

frigid ember
#

but when i land the method works fine

#

@torn pilot like this ?
java -Xms10G -Xmx1G -jar Server_Spigot_1.15.2.jar -o true

torn pilot
#

No

frigid ember
#

like this ?
java -Xms1G -Xmx10G -jar Server_Spigot_1.15.2.jar -o true

#

p.getInventory().setItem(1, Items.byName("ENDER_PEARL").getItemType(p)); this it gets then name and what the material is then gives the item

#

it works on EntityDismount

#

but when thrown it just doesnt want to work

torn pilot
#

Xms = Minimum amount you want it to use.

Xmx = Max amount you want it to use

inland depot
#

send the method where you listen to the throw event

frigid ember
#

minimum ?

torn pilot
#

So yes, that would work if you like

frigid ember
#
    public void onProjectileLaunch(final ProjectileLaunchEvent e) {
        if (e.getEntity().getShooter() instanceof Player) {
            final Player p = (Player)e.getEntity().getShooter();
            if (e.getEntity() instanceof EnderPearl) {
                if (Items.byName("ENDER_PEARL") != null) {
                    p.getInventory().setItem(1, Items.byName("ENDER_PEARL").getItemType(p));
                    p.updateInventory();
                    HubCore.getInstance().getServer().getConsoleSender().sendMessage("I have give pearl back yes");
                }```
torn pilot
#

Yes minimum

icy cosmos
#

Any idea why the below code only works when I am on creative mode T_T?

    public void launchPlayerTo(Player player, Vector vec) {
        player.sendMessage("1");
        Entity entity = player.getWorld().spawnEntity(player.getLocation(), EntityType.ARROW);
        player.sendMessage("2");
        entity.setPassenger(player);
        player.sendMessage("3");
        map.put(player, entity);
        player.sendMessage("4");
        ((CraftArrow) entity).getHandle().setInvisible(true);
        player.sendMessage("5");
        entity.setVelocity(vec.multiply(1.2).setY(vec.getBlockY() + 2));
        player.sendMessage("6");
    }

Also the arrow isn't invisible

frigid ember
#

dont worry about the missing }

inland depot
#

@frigid ember did you properly register the event?

frigid ember
#

yes its in my PlayerListener class with my other events

inland depot
#

ok

#

try removing the line java p.updateInventory();

frigid ember
#

already have

inland depot
#

try debugging after each if statement in the method and see where it stops sending a message

#

thats where it would cut off

brisk mango
#
public final class EnderPearlManager {

     private final Main instance;
     private final Map<UUID, ItemStack> pearls;

     public EnderPearlManager(Main instance) {
          this.instance = instance;
          this.pearls = new HashMap<>();
     }

       public void addPlayer(Player player, ItemStack stack) {  
           pearls.put(player.getUniqueId() + stack);
       }

       public void removePlayer(Player player) {
           pearls.remove(player.getUniqueId());
       }

       public boolean contains(Player player) {
          return pearls.containsKey(player.getUniqueId());
       }
}

now just do this


private EnderPearlManager manager;

public final class Main extends JavaPlugin {
@Override public void onEnable() {
manager = new EnderPearlManager(this);
Bukkit.getPluginManager().registerEvents(new Listener() {
void onThrow(ProjectileLaunchEvent event) {
if(event.getEntity().getShooter() instanceof Player) {
Player player = (Player) event.getEntity().getShooter();
if(event.getEntity() instanceof Enderpearl) {
manager.add(player, event.getEntity().getItemStack());
}
}
}
}, this);
}
}
#

@frigid ember

frigid ember
#

java -Xms1G -Xmx10G -jar Server_Spigot_1.15.2.jar -o true

this one is not working, @brisk mango E:\Windows\Desktop\LocalHosts\Minecraft 1.15.2>java -Xms1G -Xmx10G -jar Server_Spigot_1.15.2.jar -o true Invalid maximum heap size: -Xmx10G The specified size exceeds the maximum representable size. Error: Could not create the Java Virtual Machine. Error: A fatal exception has occurred. Program will exit. Press any key to continue . . .

brisk mango
#

@inland depot bruh youre not helping anyone stop

frigid ember
#

@inland depot i have debugged it tells me it has given the items but obv not

torn pilot
#

Do you have 10gbs available?

frigid ember
#

yes

brisk mango
#

@frigid ember bruh you can just copy the code i gave you that should work

frigid ember
#

io only have 3half tera

inland depot
#

@brisk mango stop being toxic please

frigid ember
#

no i am going to use my own method

brisk mango
#

and stop helping people if youre not pointing them in the right direction

torn pilot
#

Of memory yes? Not storage

brisk mango
#

then fuck off not gonna spoonfeed you no more

frigid ember
#

what's the difference

inland depot
#

i simply suggested for rbuh to debug his code and see where it stops

brisk mango
#

because it doesnt exist -Xmx10G

#

you need to do either 2

inland depot
#

idk why u think that's in the wrong direction

frigid ember
#

temedy you just a fucking dick

#

😳

brisk mango
#

ah really, i just wanted to help you and wasted 5 minutes of writing code that works and im a dick

#

fuck off

frigid ember
#

temedy

lilac wasp
#

@brisk mango you need to chill lmao

brisk mango
#

wasting time on retards

frigid ember
#

but obv you could of helped me instead of being a total cunt

lilac wasp
#

All I see you is being angry

frigid ember
#

how can i check my memory

lilac wasp
#

Then leave

brisk mango
#

"could helped me" what did i do?

torn pilot
#

@brisk mango Not to minimod, but the normal chat rules still apply heree so be careful

brisk mango
#

i mean the only one that is being toxic is rbuh

#

for no reason

inland depot
#

you also told me to stop giving useless suggestions when i was providing rbuh with a simple way to see what was wrong with his code....

finite crescent
#

<o/

torn pilot
#

Anyway!

brisk mango
#

but they were useless suggestions

torn pilot
#

No more arguinggg pleaseeeee c:

brisk mango
#

how could removing and adding p.updateInventory() help him

#

when that does not change nothing

frigid ember
#

@brisk mango pls help ? how can i check the memory

inland depot
#

i wasn't referring to that one

brisk mango
#

just type 2 instead of 10

inland depot
#

the one i was suggesting was the debug lmao

brisk mango
#

and i provided code that would work

inland depot
#

oh well

#

past is in the past lets just stop arguing

lilac wasp
#

Half of the questions asked in here could've just been googled and found in like 1 minute.

frigid ember
#

i need 5 or 10

naive goblet
#

Jesus this chat should calm down a little

frigid ember
#

@brisk mango

brisk mango
#

2

naive goblet
#

Everyone here should be helpful 🤔

brisk mango
#

why u need 5

frigid ember
#

my server will be of 20 players

#

this ?

torn pilot
#

I have a question thennnn. Does anyone know how to post unicode characters in Spigot.yml, such as in the joinmessage?

naive goblet
#

yes

#

key: "\escapingcodeandtheunistuffwithdoublequotes"

keen compass
#
20B9 is the unicode character point. \u is always needed
#

so, just find the unicode character point of the character you want to use, do \u(character point) in your spigot.yml and java should pick it up.

naive goblet
#

If it's a unicode yh

frigid ember
#

­

naive goblet
#

­

torn pilot
#

"&c\u2666" "&8&l\u00BB" &r&7Command not found, use &c&l/guide &r&7for useful commands.

#

Like that?

naive goblet
#

parse it through yaml parser or even a json one

#

should give you the valid code

keen compass
#

not sure what those extra numbers are, but if that is the character point number then yes that is the correct way

torn pilot
#

You said always use 20B9

keen compass
#

no, \u is always needed

#

it tells java its unicode

torn pilot
#

So I put 20B9 in front

keen compass
#

20B9 is a character point of a unicode character

#

specifically its the rupee symbol

naive goblet
#

\u = program will know it's a unicode character

#

and the other part is telling which one

torn pilot
#

And there has to be quotes?

naive goblet
#

double ones

#

i believe

torn pilot
#

Yeah but

keen compass
#

in yaml otherwise yaml does weird things

naive goblet
#

yaml is for readability mainly so no considerations it does

torn pilot
#

I'm the spigot yml the default message for unknown command has quotes in it and the quotes are visible

#

"/help" is in quotes and you see that in game

keen compass
#

We are saying, go ahead and use double quotes around your message

naive goblet
#
defaultunknowncommand: "\u00a79 <--example owo" #use " and " instead of ' and '
#

Idk whats so unclear to you

torn pilot
#

"&c\u2666 &8&l\u00BB &r&7Command not found, use &c&l/guide &r&7for useful commands."

naive goblet
#

should be working

torn pilot
#

It doesn't I'll show you

stoic sundial
#

how i can get rss link of resourse?

keen compass
#

?api

#

darn still not a command

#

@stoic sundial

stoic sundial
#

i wish to have resourse updates in rss

#

from description i just see general information

keen compass
#

not currently possible with the API currently

#

you can get information about a resource, but you can't use it to push updates

#

or download updates automatically

stoic sundial
#

i just want to have one discord channel where i could see all plugin updates

#

thats what i want to achieve

#

and rss would insta solve it

#

but sadly there is no rss

torn pilot
#

See!

#

Doesn't work

#

Er sec

#

xD

frigid ember
#

Has anyone worked with Bukkit scoreboards using NMS?

crimson sandal
#

Oh man I didn't realise @SerializableAs() was a thing until now, if you add it after configs already used the old name will it still pick them up?

torn pilot
#

Ooo now I see

#

thanks

brisk mango
#

Bukkit is something different than NMS @frigid ember

frigid ember
#

Yeah ik, I worded it poorly

#

I am using NMS to manage player scoreboards, because the current format that vanilla/spigot does things just does not make sense

brisk mango
#

im not an NMS expert

keen compass
#

@torn pilot have to escape the \

frigid ember
#

If I want to have players assigned to a team and show team data, as well as specific player data on that same scoreboard, you have to create a new scoreboard and create all the same teams and then add every player back to their respective teams for taht scoreboard.

keen compass
#

I just think the way scoreboards are implemented is dumb in general lol

naive goblet
#

Nms😳

brisk mango
#

I mean

#

the code of scoreboards is really shit

#

and it even throws exception in the client log

#

sometimes

#

poorly designed

tall pewter
#

okay im going to be deleting each of my plugins one by one and seeing which one's causing it

tiny dagger
#

tbh if they redesign it, it would be amazing

#

maybe they remove the static score

tall pewter
#

could my issue be... vault?

#

nope

keen compass
#

I would really like for them to re-design because the way they did it really makes no sense @tiny dagger

tiny dagger
#

it makes sense to me

#

but yeah a redesign would be so much better

#

and let's be honest their idea of scoreboards back then was different

icy cosmos
#

On projectilehit event how do I check if the projectile hit a block or an entity?

frigid ember
#

get its position

#

and check if an entity is there

#

id say get nearby entities in a radius

#

and check that

brisk mango
#

no wrong

keen compass
#

easy way for the entity one is that there is a second event that gets thrown for when an entity damages an entity fyi

frigid ember
#

ok

#

yea

brisk mango
#

ProjectileLaunchEvent#getHitBlock/Entity

#

theres litterly method

#

in the event

frigid ember
#

ok srry i just said whats off the top of my head on a mobile

#

bruh

#

check docs bro

#

javadocs nice

brisk mango
#

ProjectileHitEvent

#

not launch

#

why should i check docs

keen compass
#

probably not recommending you to do so

#

but for the other person

frigid ember
#

@fleet crane Why is there no setTeams(Map<String, Team> teamMap) method in the Scoreboard interface?

#

This could alleviate any number of problems when it comes to team assignment

naive goblet
#

Map<?>

icy cosmos
#

@brisk mango I am using 1.8

brisk mango
#

so what?

#

ProjectileHitEvent still exists

naive goblet
#

Mak pretty sure Map<?> would make chaos

icy cosmos
#

Yeah but getHitBlock/Entity doesn't

brisk mango
#

what is there then

#

in the event

frigid ember
#

@naive goblet you're probably right

#

Map<String, Team>

tiny dagger
#

it's an api tho

naive goblet
#

Set<Team> would be more appropriate approach then. I don’t know but Team has a name inside it?

tiny dagger
#

yup

frigid ember
#

You register teams through a String name

tiny dagger
#

this would still not make sense lol

naive goblet
#

^

tiny dagger
#

registerteam adds it into scoreboard already

frigid ember
#

Regardless of whether it makes sense or not, MC uses a map for reference in their source

#

Reflect into its fields & you will find a map

tiny dagger
#

so setteams makes no sense to me

frigid ember
#

How does that make no sense

naive goblet
#

Then reflect the map and cache it?

icy cosmos
frigid ember
#

No, theres only one final field net.minecraft.server.v1_15_R1.Scoreboard

#

with a security manager

brisk mango
#

then use EntityDamageByEntity

frigid ember
#

So what you're saying is not possible unless i go full-blown NMS & recode what has basically already been done

brisk mango
#

or dont use 1.8

frigid ember
#

Not worth the time

#

@naive goblet

twilit roost
#

So i still can't find anything that would kill mobs entering a region

naive goblet
#

Okay

icy cosmos
#

@brisk mango that wouldn't cover the case that the arrow hit ground though

frigid ember
#

@naive goblet But my question is - do you know of a simpler way to do this?

naive goblet
#

Than?

frigid ember
#

Honestly this would probably be best in voice

#

Any chance you'd join a vc for me to explain?

naive goblet
#

Not today

#

What are you acc trying to accomplish though?

tall pewter
#

yo i think the cause is NoteBlockMusicPlayer

wanton delta
#

not sure if this is a bug... but im getting confused

#

calling player.getHealth() after player.getAttribute(Attribute.GENERIC_MAX_HEALTH).setBaseValue(12); will return 20

subtle blade
#

Likely doesn't apply until a tick after

wanton delta
#

doesnt work even then

frigid ember
#

So here is my problem:

I have a gamemode in which I have multiple teams. These teams can control "checkpoints". I want to display the total number of checkpoints that a team controls. I want to display this on the same scoreboard for all teams. So something like:

Blue Team : 7
Red Team: 9
Yellow Team: 3

However, I also want to display individual user data as well:

Blue Team : 7
Red Team: 9
Yellow Team: 3

===========
kills: 5 <- only shows up for THAT PLAYER
xp: 700 <- only shows up for THAT PLAYER

#

If you have a single scoreboard that shows only team data, then you can't put individual player data on the scoreboard - if I change it to show my stats, then all players attached to that scoreboard will see my stats.

#

If I create a new scoreboard for each player, then I have to re-register the team for each player in the game, to where if I have 15 players in the game, 5 per team, there are really 5 yellow teams, 5 blue teams, and 5 red teams - this is because each player needs their own scoreboard and you must re-register the teams each time.

naive goblet
#

or maybe that doesn't make sense either

paper compass
#

How would I make a tool that teleports you to where you are looking, without being glitched inside a block if you are looking at a wall?

tiny dagger
#

well

#

you raytrace till you find a block

#

if you find one try to teleport on top

paper compass
#

Max 10 blocks range

#

Well if it’s in a wall

tiny dagger
#

if not teleport to the last free block

naive mountain
#

My question is is t possible to remove Kicked for clickspam.

paper compass
#

What if it’s a wall?? There’s 2 free spots

tiny dagger
#

do proper check then

#

you can offset it when you found a block

paper compass
#

Can I offset it 1 block towards the player if it hits a wall

tiny dagger
#

yes

paper compass
#

How would I do this

#

1.8.8

torn robin
#

@naive mountain yes

#

not too easily but yes

tiny dagger
#

so the way i would do it:
raytrace till block
if found check safe spot
if safe teleport else turn back until is safe or it same as the origin spot

paper compass
#

Uhhh

#

Hm

tiny dagger
#

there is no magic for 1 version only

#

its the same for all

#

time to work on that recursion btw 👀

keen compass
#

or incursion o.o

tiny dagger
#

what's that?

paper compass
#

Wait does WorldEdit use day tracing for their compass?

#

raytracing

tiny dagger
#

raytracing is not as complicated as you think

#

the bukkit api does it for you

#

p.geteyelocation getdirection

#

gives 1 the direction with the length of 1

#

so you can add it to a location yourself

paper compass
#

Would it teleport you on the side of the block?

tiny dagger
#

why would it

subtle blade
#

Raytracing is just a fancy name for the technic to iterate over a line lol

#

It's really not difficult whatsoever

keen compass
#

it is a ray, that is traced

#

basic words 😉

subtle blade
#

Exactly!

paper compass
#

Well I need it to, I don’t want it to teleport the player INSIDE a block

keen compass
#

think the server prevents teleporting into blocks doesn't it? o.O

tiny dagger
#

do the checks i mentioned

frigid ember
#
                    p.getInventory().setItem(1, Items.byName("ENDER_PEARL").getItemType(p));``` so i am doing this right ```
Items.byName("ENDER_PEARL").getItemType(p)``` returns ```ItemStack{ENDER_PEARL x 1, UNSPECIFIC_META:{meta-type=UNSPECIFIC, display-name=EnderButt}}``` but still wont give me back my pearl
radiant pollen
#

@paper compass ray trace let's you get the hit position which is the position on the block the player hit, AFAIK.

#

Wouldn't teleport you in a block

tiny dagger
#

he would have to do some bounding checks if he wants to not get tp in a hole or something

naive goblet
#

getString(path, def) would certainly only return null if def is null right?

brisk mango
#

@frigid ember if you would have listen to my advice then it would

frigid ember
#

i aint going to change everything i have just to add your enderbutts so it works i am using a Item manager so i can have different things like Cosmetics and other stuff

brisk mango
#

i mean

#

then its not gonna work

#

¯_(ツ)_/¯

radiant pollen
#

why does the getItemType() need the player?

frigid ember
#

hows your going to work anyways it looks just like my client lmfao

#

class*

#

i removed that

brisk mango
#

well mine would work

frigid ember
#

it has noting to give the player the item back

brisk mango
#

yours because its reallly poorly designed

#

u want to give it back

radiant pollen
#

What do you mean by it returns ItemStack{ENDER_PEARL x 1, UNSPECIFIC_META:{meta-type=UNSPECIFIC, display-name=EnderButt}}?

#

when you print it?

frigid ember
#

yes

brisk mango
#

just listen to ProjectileHitEvent and then give it back? lol

#

i mean if ur not able to do basic stuff then its the reason its not working

#

i g

frigid ember
#

what do you think i am doing obviously and its not working lmfao

#

if you think you know basic stuff fix it

brisk mango
#

ive send you code that does what exactly you need , but sure

#

show me your code

#

send it in bins

frigid ember
#

"in bins"

#

where the fuck is bins

#

lol

keen compass
#

?paste

worldly heathBOT
frigid ember
#

in md5s skidded hastebin site

#

lol

brisk mango
#

or

#

looks nicer

#

than paste.md_5

radiant pollen
#

doesn't matter lol

subtle blade
#

Dude

#

Just use a paste website

#

Fucks sake lol

#

Not everything has to be an argument

radiant pollen
#

^

keen compass
#

upside is it makes the chat appear lively 😄

frigid ember
#

which was copy and pasted

#

😃

crimson cairn
#

How to override EntityTrackerEntry?

#

wanting to move a player server-side without the server recognizing this position change and sending a teleport packet

subtle blade
#

oh my favourite. custom entity trackers

crimson cairn
#

and dont ask me what im trying to do because this is exactly what i want to do lol

#

ok well im trying to implement my own teleport system

brisk mango
#

@subtle blade are you 12 years old?

crimson cairn
#

one that doesn't reset fall distance

subtle blade
#

I'm twenty

brisk mango
#

mk

radiant pollen
#

@crimson cairn you can do that without what you're trying to do

crimson cairn
#

explain

radiant pollen
#

Get fall distance, teleport, set fall distance?

crimson cairn
#

no

#

i dont want to interfere with other teleports

radiant pollen
#

Why would that interfere with other teleports?

crimson cairn
#

other teleports reset fall distance

#

i dont want to intercept teleports and store and then set the fall distance again

radiant pollen
#

So just for a specific teleport you're doing?

crimson cairn
#

the thing is, I discovered that it may be possible to make a nofalldamage cheat by exploiting teleportation

radiant pollen
#

I'm confused.

tough viper
#

What is ThreadedAnvilChunkStorage

radiant pollen
#

If you don't want to interfere with other teleports, then just don't use an event for it.

crimson cairn
#

and I want to teleport players back that dont follow expected motion in air, yet without resetting fall distance

#

I'm writing an anticheat btw

radiant pollen
#

Well that's the easiest way to teleport without resetting fall distance.

#

Whether it interferes with other teleports is easy to change and I'm confused why you think it would interfere with all of them?

#

Surely you have checks

velvet halo
#

What's with people constantly arguing about the hastebin shit, it's just a domain and open source software lol

crimson cairn
#

If I'm intercepting teleports, how do I know that it was caused by me and not some other plugin

tough viper
#

Why do chests render as ender chests with protocol support?

radiant pollen
#

@crimson cairn make your own teleport method that bundles all of it together and use that one instead of the API one.

#

It's literally three lines???

frigid ember
#

lol rip

crimson cairn
#

not necessarily

#

I can send a teleport packet, but that won't update the position server-side

#

and if I update the position server-side, the server will catch the change and send its own teleport packet

radiant pollen
#

Why do you need to mess with packets at all?

crimson cairn
#

because it is necessary for accurate detection

#

actually

#

why haven't I thought of it before

#

I could just move the player server-side and AFAIK that doesn't reset fall distance

#

but I don't think that will work for distances less than 8 as the server sends relative move packets instead of teleport

velvet halo
#

What exactly are you trying to achieve

crimson cairn
#

a proper rubberbanding system

velvet halo
#

Then based on the goal you can alter how you implement the system

crimson cairn
#

my goal is to make a rubberband system

#

it will pretty much teleport the player

#

but with a custom impl

#

with these conditions:

  • teleport the player to the desired location
  • must not reset player fall distance
radiant pollen
#

i guess my brain is too small

#

don't understand why it must be done through packets

viral herald
#
org.bukkit.configuration.InvalidConfigurationException: mapping values are not allowed here
 in 'string', line 2, column 9:
    noPlayer: '&l&4 Must be a player to use  .``` Console error
``` package me.faintcamo.exhc;

import me.faintcamo.exhc.commands.HC;
import org.bukkit.configuration.file.FileConfiguration;
import org.bukkit.plugin.java.JavaPlugin;

public class ExclusionHC extends JavaPlugin {
    public static FileConfiguration config;

    @Override
    public void onEnable() {
        getLogger().info("[ExclusionHC] Enabled");;
        getConfig().options().copyDefaults(true);
        saveConfig();

        getCommand("hc").setExecutor(new HC());
    }

    @Override
    public void onDisable() {
        getLogger().info("[ExclusionHC] Disabled");
        config = null;

    }
    

}
//```
#
// If command sender is not a player
noPlayer: '&l&4 Must be a player to use this command!'```
velvet halo
#

Could you potentially do something with the playerteleportevent instead of using packets?

crimson cairn
#

maybe

#

but how do I know that the PlayerTeleportEven was caused by me and not some other plugin

radiant pollen
#

Like I said, teleporting without resetting fall damage is three lines of code.

velvet halo
#

I am not sure if that does the detection you want it Todo tho

#

Less than 3 lines

brisk mango
#

@viral herald bruh so many things wrong in your main class

viral herald
#

elaborate

brisk mango
#

and no need to set config = null; onDisable())

#

well first of all that static thing

#

why its static

#

why rather not make a

#
public final class DataFile {

    private final Main plugin;
    private final String name;

    private File file;
    private YamlConfiguration config;

    public DataFile(Main plugin, String name) {
        this.plugin = plugin;
        this.name = name;
    }

    public boolean setup() {
        file = new File(plugin.getDataFolder(), name);

        boolean succeded = false;

        if (!file.exists()) {
            try {
                succeded = file.createNewFile();
                config = YamlConfiguration.loadConfiguration(file);
            } catch (Throwable reason) {
                throw new RuntimeException(reason);
            }
        }

        return succeded;
    }

    public void save() {
        try {
            config.save(file);
        } catch (Throwable e) {
            throw new RuntimeException(e);
        }
    }

    public void reload() {
        config = YamlConfiguration.loadConfiguration(file);
    }

    public YamlConfiguration getConfig() {
        return config;
    }
}
#

and initialise onEnable() and then get the instance

#

lol

#

so much better than using static from your main class

velvet halo
#

There is no point in utilizing a custom config class if he just using the default configs.

brisk mango
#

he has a static FileConfiguration

viral herald
#

Its cuz i also have a utils class

brisk mango
#

whatever bruh

#

just use that if ur making custom YAML files

viral herald
#

what

brisk mango
#

nothing

viral herald
#

im not even gonna bother asking you

velvet halo
#

I am not gonna help people while you are here temedy I am tired of how you respond to people.

#

You are just so rude it's not even funny

viral herald
#

temedy just here to waste peoples time

brisk mango
#

more like im wasting my own time

subtle blade
#

config is never assigned but the error is because // is not a character in YAML

viral herald
#

just block him at this point

radiant pollen
#

the console error is because of config file

viral herald
#

@radiant pollen yea I realize

subtle blade
#

// This is not a comment

#

That's Java

radiant pollen
#

^

subtle blade
#

This is a YAML comment

radiant pollen
#

yaml comments are # this

viral herald
#

o

#
    at org.bukkit.command.PluginCommand.execute(PluginCommand.java:46) ~[server.jar:git-Spigot-db6de12-18fbb24]
    at org.bukkit.command.SimpleCommandMap.dispatch(SimpleCommandMap.java:141) ~[server.jar:git-Spigot-db6de12-18fbb24]
    at org.bukkit.craftbukkit.v1_8_R3.CraftServer.dispatchCommand(CraftServer.java:641) ~[server.jar:git-Spigot-db6de12-18fbb24]
    at org.bukkit.craftbukkit.v1_8_R3.CraftServer.dispatchServerCommand(CraftServer.java:627) [server.jar:git-Spigot-db6de12-18fbb24]
    at net.minecraft.server.v1_8_R3.DedicatedServer.aO(DedicatedServer.java:412) [server.jar:git-Spigot-db6de12-18fbb24]
    at net.minecraft.server.v1_8_R3.DedicatedServer.B(DedicatedServer.java:375) [server.jar:git-Spigot-db6de12-18fbb24]
    at net.minecraft.server.v1_8_R3.MinecraftServer.A(MinecraftServer.java:654) [server.jar:git-Spigot-db6de12-18fbb24]
    at net.minecraft.server.v1_8_R3.MinecraftServer.run(MinecraftServer.java:557) [server.jar:git-Spigot-db6de12-18fbb24]
    at java.base/java.lang.Thread.run(Thread.java:832) [?:?]
Caused by: java.lang.NullPointerException
    at me.faintcamo.exhc.commands.HC.onCommand(HC.java:16) ~[?:?]
    at org.bukkit.command.PluginCommand.execute(PluginCommand.java:44) ~[server.jar:git-Spigot-db6de12-18fbb24]
    ... 8 more```
#

now its that

#

import me.faintcamo.exhc.ExclusionUtil;
import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;

public class HC implements CommandExecutor {

    public ExclusionUtil util;

    @Override
    public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {
            if (!(sender instanceof Player)) {
                sender.sendMessage(util.noPlayer());
            } else {
                Player p = (Player) sender;
                if (cmd.getName().equalsIgnoreCase("hc")) {
                    if (p.hasPermission("hc.commands")) {
                        if (args.length == 0) {

                        }
                    }
            }
        }
        return false;
    }

}
#

Command class *

brisk mango
#

bruh learn java

#

before asking

radiant pollen
#

temedy stfu

brisk mango
#

how u expect us to help you when you know nothing about java

subtle blade
#

util is null. You have to assign it

viral herald
#

@brisk mango stfu? Im literally trying my best self teaching myself

velvet halo
#

Every declaration has to be assigned before you can manipulate it .

#

Alright everyone relax

subtle blade
#

You're welcome to ignore him. He's been nothing but an ass since he's joined

viral herald
#

alr

brisk mango
#

Lol

subtle blade
#

Genuinely surprised I've had as much patience as I've had not to ban you

tough viper
#

What is ThreadedAnvilChunkStorage and why do I see it when I stop my server

velvet halo
#

Chunks are stored as tags in regional Minecraft Anvil files, which are named in the form r.x.z.mca

#

It is a good read

#

AnvilChunkStorage is just a name for the method of storage for Minecraft Anvil files

tough viper
#

Thank you.

velvet halo
#

No problem 🙂

tough viper
#

Also why does my server difficulty get reset to Easy after I set it to hard with /difficulty Hard every restart?

velvet halo
#

I don't think it serializes the difficulty when you set it during the server session. It is something you have to update in the server.properties. I am not sure why they don't save it 😦

brisk mango
#

You need to stop the server and change it in server.properties

#

then save

#

and start server

tough viper
#

Oh, you're right

#

Thank you

velvet halo
#

There probably is a way to manually update it in game and then it stores it. However it would have to be done with a plugin.

#

So there is no point

#

¯_(ツ)_/¯

#

unless there is a command for it but I doubt it

grand aurora
#

Hello, can anyone help me figure out how to serialize and de-serialize my data with YamlConfiguration? I am currently doing it like this: this.game.config.set("BlueSpawns", this.game.BlueSpawns); this.game.config.set("RedSpawns", this.game.RedSpawns); this.game.config.set("Chests", this.game.chests); this.game.config.set("Flags", this.game.flags);

#

I've tried this: Map values = this.game.config.getValues(true); this.game.BlueSpawns = (ArrayList<Location>) values.get("BlueSpawns"); this.game.RedSpawns = (ArrayList<Location>) values.get("RedSpawns"); this.game.chests = (HashMap<Chest, Inventory>) values.get("Chests"); this.game.flags = (HashMap<Location, Flag>) values.get("Flags");

#

But it doesn't work. (Flag is just a custom class that holds a few data types)

celest light
#

So, I'm comparing material types, and surprised that some things (Stripped Jungle wood) compares to Air. I've got the air in a collection, and when I say collection.contains(material.Stripped_jungle_wood) it seems to return true.

#

Is this some backwards compatability material gotcha?

#

I went a better way by using .isSolid() but an explanation for why this is would be good.

tough viper
#

How do I toggle minecraft's block break animation?

#

I want to break a block in an amount of time (say 2 seconds) with the animation for each stage of breaking the block

#

That animation

#

And I'd like to do the sounds too

#

Is this possible?

#

(Server side with spigot)

grand aurora
#

getBlock().breakNatrually()?

#

I don't think you can specify a speed. It only plays the sounds and instantly breaks the block though

tough viper
#

huh

#

i'll use that then, thanks

velvet halo
#
PacketPlayOutBlockBreakAnimation (int a, BlockPosition blockposition, int c)
Where a is the id of the entity breaking the block, blockposition is the block (location), and c is the level of breaking (0 - 9).
``` Taken from -> https://www.spigotmc.org/threads/packet-for-block-digging-animation.385320/
tough viper
#

oh, that works too

grand aurora
#

You might be able to use a BukkitRunnable to change the animation state every x ticks and then run break naturally when you want to

#

Never mind

#

Above answer is much better

tough viper
#

@velvet halo does c being higher mean it's faster or slower?

velvet halo
#

no c is the state of how much the block is broken

tough viper
#

oh

#

how do I import that?

velvet halo
#

NMS

#

net.minecraft.server

tough viper
#

oh. is there a way to get an entity ID?

#

if I have entity being a spigot Entity

velvet halo
#

a is the entity

tough viper
#

yes, but it's an int ID

#

I don't know how to convert a spigot entity to that

#

is it something like entity.getHandle().getId()

velvet halo
#

yes I think so

tough viper
#

oh wait

#

I can do

#

entity.getHandle().getEntityId()

velvet halo
#

I haven't done much NMS

tough viper
#

thank you!

frigid ember
#

Hello

#

My whole server just crashed and I got these spigot errors

muted geode
#

So im attempting to cancel the grow event of sugarcane and / or cactus the problem seems to be that when the grow event is called the block type is air

#

how do i detect if it is sugarcane or cactus and still be able to cancel the event

frigid ember
#

Would anyone like to take a look at my latest.log and assist me please? :((

muted geode
#

i can attempt to help you send it my way

frigid ember
#

Thank you

grand aurora
#

Hello, can anyone help me figure out how to serialize and de-serialize my data with YamlConfiguration? I am currently doing it like this: this.game.config.set("BlueSpawns", this.game.BlueSpawns); this.game.config.set("RedSpawns", this.game.RedSpawns); this.game.config.set("Chests", this.game.chests); this.game.config.set("Flags", this.game.flags);
I've tried this:
Map values = this.game.config.getValues(true); this.game.BlueSpawns = (ArrayList<Location>) values.get("BlueSpawns"); this.game.RedSpawns = (ArrayList<Location>) values.get("RedSpawns"); this.game.chests = (HashMap<Chest, Inventory>) values.get("Chests"); this.game.flags = (HashMap<Location, Flag>) values.get("Flags");
But it doesn't work. (Flag is just a custom class that holds a few data types)

#

Also, Flag implements ConfigurationSerializable

muted geode
#

@frigid ember are you sending it...

#

@grand aurora what exactly is the problem

frigid ember
#

[20:42:41] [Async Chat Thread - #4/INFO]: [TC] Member RicheyTooTurnt: i love chicken
[20:42:46] [Async Chat Thread - #4/INFO]: [USA|papaete] Member Mr_GoldLlama OG: ah
[20:42:52] [User Authenticator #104/WARN]: [LuckPerms] Processing login for FrostyWolf775 took 5301ms.
[20:42:52] [User Authenticator #104/INFO]: UUID of player FrostyWolf775 is
[20:42:52] [Async Chat Thread - #4/INFO]: [USA|Austin] Member EmporerCheems BETA: Yea lmao its gooood
[20:42:52] [Async Chat Thread - #3/INFO]: [Jakarta] Member ThoilithMHG: Bruh I just found some emeralds and they are not appearing
[20:43:01] [Async Chat Thread - #3/INFO]: [USA|papaete] Member Mr_GoldLlama OG: this isnt good
[20:43:01] [Async Chat Thread - #4/INFO]: [USA|Austin] Member EmporerCheems BETA: ooof
[20:43:06] [Spigot Watchdog Thread/ERROR]: ------------------------------
[20:43:06] [Spigot Watchdog Thread/ERROR]: The server has stopped responding! This is (probably) not a Spigot bug.
[20:43:06] [Spigot Watchdog Thread/ERROR]: If you see a plugin in the Server thread dump below, then please report it to that author
[20:43:06] [Spigot Watchdog Thread/ERROR]: Especially if it looks like HTTP or MySQL operations are occurring
[20:43:06] [Spigot Watchdog Thread/ERROR]: If you see a world save or edit, then it means you did far more than your server can handle at once
[20:43:06] [Spigot Watchdog Thread/ERROR]: If this is the case, consider increasing timeout-time in spigot.yml but note that this will replace the crash with LARGE lag spikes
[20:43:06] [Spigot Watchdog Thread/ERROR]: If you are unsure or still think this is a Spigot bug, please report to https://www.spigotmc.org/
[20:43:06] [Spigot Watchdog Thread/ERROR]: Be sure to include ALL relevant console errors and Minecraft crash

muted geode
#

yeah thats not gonna help me...

frigid ember
#

The thread dump is huge I don't know if I can copy and paste it here

muted geode
#

do it, it will change it into a txt file

grand aurora
#

The problem is that I don't know how to serialize and retrieve these data types from a YamlConfiguration

muted geode
grand aurora
#

public ArrayList<Location> BlueSpawns = new ArrayList<Location>(); public ArrayList<Location> RedSpawns = new ArrayList<Location>(); public HashMap<Chest, Inventory> chests = new HashMap<Chest, Inventory>(); public HashMap<Location, Flag> flags = new HashMap<Location, Flag>();

#

I did, I just can't find an example to help with these data types

frigid ember
#

Could this be the problem

#

[20:43:07] [Spigot Watchdog Thread/INFO]: Startup script './start.sh' does not exist! Stopping server.
[20:43:07] [Spigot Watchdog Thread/INFO]: Stopping server

muted geode
#

no thats not the problem...

velvet halo
#

That is not the problem but it is a problem 😛

muted geode
#

basically the server said it crashed and it tries to restart it however cant find the file to restart

velvet halo
#

If you want simple serialization with encapsulation classes then I recommend using GSON

#

You can easily serialize any type, collection, object that you want.

#

Super simple to follow and straight to the point

#

better yet the tutorials are free

muted geode
#

So im attempting to cancel the grow event of sugarcane and / or cactus the problem seems to be that when the grow event is called the block type is air
how do i detect if it is sugarcane or cactus and still be able to cancel the event

pastel condor
#

how can I play a sound at a player without letting nearby players hear the sound too?

velvet halo
#

rather than specifying the world to play a sound you specify the player

#

player.playSound();

pastel condor
#

like this? player.playSound(player.getLocation(), Sound.ENTITY_EXPERIENCE_ORB_PICKUP, 1F, 0F);

velvet halo
#

Yes only the player will hear it

pastel condor
#

okay thanks

velvet halo
#

no problem

pastel condor
#

also how can I check if a player is in the recipients list of a chat message?

pastel condor
#

oh okay

#

thanks

velvet halo
#

On the async chat event you get a set of recipients

pastel condor
#

yes

#

though there might be a problem

#

I need to wait for another plugin to assign the recipents

#

then check for the list

#

because that plugin uses the async chat event too

velvet halo
#

Remember events have priorities

pastel condor
#

so if I set it to the lowest

#

it should work?

velvet halo
#

Yes then it should handle it after the other plugin chat event

pastel condor
#

okay thanks

velvet halo
#

No problem!

pastel condor
#

oh my bad it should be highest priority and ran last

velvet halo
#

That is ok, just keep trialing and erroring. You will get it eventually 🙂

pastel condor
#

🙂

grand aurora
#

I'm getting Memory Section is incompatible with HashMap

frigid ember
#

I've been notified that not having a "start.sh" is a problem

#

Can someone tell me how to create/enable it? 😄

velvet halo
#

Since you are with a hosting provider it is their responsibility to have a start.sh

#

You are better off talking to them

wanton delta
#

hi i forget

#

does anyone know how to get the materials from the minecraft:logs namespace

#

or minecraft:wood namespace

#

etc

velvet halo
#

what do you mean?

wanton delta
#

nvm i found it

#

are double slabs in spigot anymore?

#

as materials?

pastel condor
#

would this give me the chat color at the end of a text? lastColor = ChatColor.getByChar(ChatColor.getLastColors(tempArray[i]));

subtle blade
#

Doesn't getLastColours() return a ChatColor?

pastel condor
#

it returns a string

subtle blade
#

oh... the fuck? lol

pastel condor
#

yeah lol

subtle blade
#

That may include formatting

#

Not sure. Print out the result of getLastColors()

pastel condor
#

kk I'll do that in a sec

#

It seems like Bukkit.getPlayer() seems to auto complete the players name like if I put "hi" when the players name was "hihi" it would return the hihi player how can I make it so it doesn't auto complete?

#

because I'm checking if the player is online

#

and I don't want to find the auto completed player, I want to find the exact player

subtle blade
#

getPlayerExact()

#

;P

pastel condor
#

kk thanks 🙂

#

I'll test out the color thing now

frigid ember
#

My whole code is ruined by the existence of stripped wood

wanton delta
#

wdym

hallow surge
#

^

frigid ember
#

I've literally spent all day trying to serialize shapedrecipes
But it just won't work properly

wanton delta
#

why not

frigid ember
#

idk
I kind of got it to work but when nothing is in the crafting table stripped Dark Oak wood can be crafted and like all the recipes relating to stripped wood are broken so something must be wrong with that

sleek cape
#

hey guys can someone help me please? ive been messing around with plugins on my spigot server but recently discovered that death screen has been disabled. now ive discovered its the world itself not any plugin but i have no idea how to fix it? wouldreally appreciate it

keen compass
#

@sleek cape you need to modify the gamrule

#
/gamerule doImmediateRespawn false
sleek cape
#

lifesaver @keen compass

subtle blade
#

mfw didn’t even know that was a gamerule

#

I’m a fake Bukkit contributor

grand aurora
#

Is there anyway to loop over all the blocks in a worldguard region? Or get all blocks in the world with a specific metadata tag

frigid ember
#

turns out I just spent a day trying to fix a bug and all I needed to do was change the api-version in plugin.yml

keen compass
#

lol

#

isn't that always fun to learn

frigid ember
#

Ok so i am doing ```java
player.getInventory().setItem(8, enderButt);

opal bay
#

what happens?

frigid ember
#

Noting lmfao

opal bay
#

no errors? D:

frigid ember
#

no lol

#

i wish

#

so i could fix

#

also it gives it back to me when i throw a normal pearl

#

Ah ok so i just used the player move event checked if the player was riding the enderpearl then give them back the ender pearl

wheat birch
#

pls change the variable, enderButt is cursed

frigid ember
#

uh

#

endernut

#

ok

vagrant widget
#

does anyone know why this happens when u put a color in symbols?

#

the A thingy appears

keen compass
#

elaborate a bit more?

vagrant widget
#

actually let me try something

tough viper
#

what's the best way to find any nearby chest in a radius of 15 around a location

vagrant widget
#

when i do this

#

it shows up as this in game

#

adds an A behind it ;/

opal bay
#

minecraft doesn't like unicode iirc

vagrant widget
#

ok

latent rock
#

is there a way to prevent certain items from being put in shulkers

brisk mango
#

InventoryClickEvent

keen compass
#

@vagrant widget is that in yaml?

vagrant widget
#

mhm?

keen compass
#

if so it needs to be surrounded with double quotes

vagrant widget
#

yml

brisk mango
#

it doesnt @keen compass

#

' are enough

vagrant widget
#

the plugin's is "

#

oop

#

"'"

#

u get it

#

its ' not "

#

for the plugin

tough viper
#

how can I find the nearest chest in a radius of 15 blocks from a location without lagging my server?

brisk mango
#

Wdym without lagging the server

#

tell me a way how can u lag a server with doing that

keen compass
#

do you want to search on all three planes or just x and y @tough viper

tough viper
#

all three planes

night matrix
#

does anyone have any plugin recommendations to make your server look professional?

vagrant widget
#

depends on how u configure the plugins

tough viper
#

and @brisk mango I have to get every block in the radius to check if it's near

#

until I find one that's valid

night matrix
#

like any particular plugins

brisk mango
#

no you dont procez

tough viper
#

how so

brisk mango
#
for (int x = all.getLocation().getBlockX() - 15; x <= all.getLocation().getBlockX() + 15; x++) {
                            for (int y = all.getLocation().getBlockY() - 15; y <= all.getLocation().getBlockY() + 15; y++) {
                                for (int z = all.getLocation().getBlockZ() - 15; z <= all.getLocation().getBlockZ() + 15; z++) {
                                    Location loc = new Location(all.getWorld(), x, y, z);

if(loc.getBlock().getState() instanceof Chest) {

}
                                        }
                                    }
                                }
                            }
                        }
finite crescent
#

Is x86 = 32-bit?

brisk mango
#

fucking shit discord formatting

tough viper
#

that checks every block

#

until we find one

brisk mango
#

i mean

#

is there an other way?

#

i dont think so

#

you always have problem with everything

#

like "is using instanceof better than checking the type"????

tough viper
#

but is there any way to optimize this

brisk mango
#

bruh im just gonna ignore you

tough viper
#

and I didn't have a problem with that, seriously, I was just curious

#

it's lagging my server though?

brisk mango
#

you only have really dumb questions

#

🤦‍♂️

tough viper
#

thank you for your helpful feedback then

#

i appreciate your time spent helping me

brisk mango
#

bruh you only want everything to do with a "better way"

#

what do you expect

tough viper
#

I expect to find the nearby chest without lagging my server?

brisk mango
#

its annoying

#

well use your brain and ask yourself

#

maybe you can find a "better" solution

keen compass
#

give me a minute and I will provide some help

#

currently in a game at the moment

tough viper
#

alright, that's fine, thank you frostalf

#

temedy, i'm asking help for a reason, and i'm no experienced developer

brisk mango
#

but the questions that you ask make no sense

tough viper
#

i asked about instanceof vs checking materials because i wanted feedback from better developers

#

and maybe, but they do help me learn

#

and they help me improve

brisk mango
#

bruh why should you really care about that

#

there is almost like no difference

tough viper
#

because i'd like to become a better developer

brisk mango
#

between that shit

tough viper
#

and i'd like to optimize my code

brisk mango
#

"optimize" "optimize"

#

You arent really going to optimize if youre gonna change an instanceof check to type check

tough viper
#

then ok

velvet halo
#

@brisk mango seriously what is your problem?

brisk mango
#

my problem is that people ask dumb questions

velvet halo
#

They ask questions because they need help

#

Yet you call them out for it and talk shit back at them

brisk mango
#

"need help"

#

how is a question about if its better to use instanceof instead comparing the type about help

keen compass
#

instanceof is most times faster to do then manual checking

brisk mango
#

another dude with no brain

velvet halo
#

See you personally attack people

#

There is not need for this...

brisk mango
#

yes, but its not a visible difference @keen compass

#

so should it matter

keen compass
#

@brisk mango depends

velvet halo
#

What are you trying to achieve by saying that stuff to people temedy?

brisk mango
#

no it doesnt depend lol

#

its not a visible difference

keen compass
#

for small things won't matter, for hot code it really does

brisk mango
#

and it doesnt matter in the case of bukkit plugins

keen compass
#

got any source on that information of yours?

#

to back up your claims in no difference

brisk mango
#

bruh what is your point

#

using instanceof vs comparing an enum

#

is like using streams vs using for loops

#

most likely, no difference

velvet halo
#

There is a difference

brisk mango
#

but its not really a difference that you can notice

#

i dont know what people expect honestly

wanton delta
#

streams are like 2-3x as slow which stacks up

#

but yes for the most part

#

fairly unnoticable

brisk mango
#

and they have their advantages

wanton delta
#

yes

velvet halo
#

an instance operator is used for identifying if the object is the specific type of a class, subclass or interface.

brisk mango
#

nothing new

#

whyd u say that?

velvet halo
#

Doesn't mean it is the same if you do getType() it has a different purpose

brisk mango
#

🤦‍♂️

velvet halo
#

See now you pull this attitude again where you think people say stupid shit

brisk mango
#

I was talking specifically about bukkit plugins and specific cases, like


Events.listen(ProjectileLaunchEvent event -> {
if(event.getEntity() instanceof EnderPearl) {

} 

if(event.getEntity().getType() == EntityType.ENDER_PEARL) {

}
});
#

I was talking about cases like this

#

pretty much as you can see

#

there should be no difference

#

so its pretty dumb to ask a question like that

#

And yes, you did say stupid shit lol

velvet halo
#

Wow thanks for being rude again

opal bay
#

tbf why are we fighting over this

tough viper
#

because I asked how to optimize finding the nearest chest in a radius

velvet halo
#

I am fighting over this because he is insulting people

tough viper
#

and I got called stupid

#

and it escalated

opal bay
#

I'm sorry

tough viper
#

you're fine

velvet halo
#

I have the right to stand up for people who get insulted by people like temedy

keen compass
#

have yet to see Temedy provide proof that an instanceof check is equal to an Enum constant

velvet halo
#

Same here

#

I am waiting

brisk mango
#

it is, in that code i sent

tough viper
#

switching from i.getType() == Material.CHEST to i.getState() instanceof Chest seems to be a lot faster for the nearby chest thing

keen compass
#

In small scale applications you are correct you can do just about anything and probably won't notice a difference if you don't do any kind of optimizations. Large scale applications it does matter a lot.

opal bay
#

perhaps you could time the response time in MS? It wouldn't be much of a difference but it's a start

brisk mango
#

how do you know, did you do the response time in MS @tough viper

tough viper
#

no, but when I did the logged it it seemed a lot faster

#

should I time it to see the difference then?

brisk mango
#

yes

#

do long startTime = System.currentTimeMillis();

#

and then when its finished (the check)

#

long endTime = System.currentTimeMillis();

#

and do String result = (endTime - startTime) + "ms";

frigid ember
#

could i take a long or a int number and format for time then countdown?

crimson cairn
#

bad way to profile something tbh

brisk mango
#

Wdym format

frigid ember
#

format as time

#

like

#

HH:MM:SS

brisk mango
#

SimpleDateFormat

keen compass
#

@opal bay response time isn't always an accurate way to test such things. Instanceof is handled differently then an Enum constant is when it comes to compiled code

frigid ember
#

would it still be a int?

#

so i can countdown?

brisk mango
#

no

#

that would be the SimpleDateFormat

brisk mango
#

that would be a string you would display. and in code you would still use the long/int

#

String displayTime = new SimpleDateFormat("mm:ss").format(time);

frigid ember
#

then just countdown time?

#

like in a bukkit runnable

brisk mango
#

no lol

#

i mean

frigid ember
#

...

brisk mango
#

if its a countdown

#

like a timer

#

u can use BukkitScheduler

frigid ember
#

never used one.

brisk mango
#

Bukkit.getScheduler().runTaskLater(task -> {
task.cancel();
});

velvet halo
#

...

opal bay
#

oh okay, I didn't really know that thank you

velvet halo
#

@opal bay You can also make a class that implements a runnable btw

opal bay
#

I don't really have needs for runnables atm but thank you very much :)

#

though, I use one to post some messages as close as I can get to after the server is finally initiated

brisk mango
#

i mean its not worth making a custom runnable lol

opal bay
#

no harm 🤷

brisk mango
#

if you need to use something better than bukkit schedulers id recommend java executors

velvet halo
#

Depends on the situation, timestamps can be even better in some cases.

#

Especially for situations like checking when an ability has refreshed

brisk mango
#

i use timestamps most the time

frigid ember
#

what would i use to get the amount of players on the server?

#

nvm

brisk mango
#

Bukkit.getOnlinePlayers().size()

frigid ember
#

i said nvm for a reason

#

java: cannot find symbol
symbol: method size()
location: class org.bukkit.entity.Player[]?

brisk mango
#

what?

#

Bukkit.getOnlinePlayers().size() works

frigid ember
#

for some reason its giving me that?

brisk mango
#

screenshot IDE error

#

with the method

frigid ember
#

the line is just this

#
            s = s.replace("%ONLINE%", String.valueOf(Bukkit.getServer().getOnlinePlayers().size()));```
brisk mango
#

i mean

#

Bukkit.getOnlinePlayers() is a Collection<? extends Player>

#

so there has to be a .size() method

keen compass
#

@tough viper ok, had some time to think about the optimal way to do it. might as well increase your search to 16 as opposed to 15 so that it fits nicely with chunks. At the very most, you will be searching in 4 chunks. So what you should probably do is use chunksnapshot since that is thread safe, with chunksnapshot you can use getTileEntities() which chests should show up as one if I remember correctly. Anyways, just check at most from the location in each direction 16 blocks to get the chunks. use thread that you pass the location to, get the chests in the chunksnapshot and compare if they are a distance of 16 from that location, if not obviously don't care about it. If it is, pass it back to main thread of that location or block to do whatever it is you are wanting.

velvet halo
#

@brisk mango How would you do the scheduler with ExecutorService?

pastel condor
#

I see that ChatColor.getLastColors() returns a string, but when I try adding it to the end of a pice of text, it doesn't use that color. It just uses the current color.

frigid ember
pastel condor
#

😦

opal bay
#

i knew I recognized that playerid

pastel condor
#

anyone know how I can convert ChatColor.getLastColors(tempArray[i]) to a ColorCode enum?

#

as that returns a string

opal bay
#

valueOf​(String name) returns an enum

#

ChatColor.valueOf(String name)*

tiny dagger
#

why would you?

#

wait

#

it can and will return up to 3 colors

pastel condor
#

thanks

radiant pollen
#

getLastColors can have multiple colors, though.

#

Right?

pastel condor
#

oh?

tiny dagger
#

yeah

pastel condor
#

I just want the last one

radiant pollen
#

It can list the colors and the formatting.

hallow surge
#

are you able to put colors in plugin yml

tiny dagger
#

then do it manually

radiant pollen
#

getLastColors will list any colors/formats that apply to the last part of the string. So red underline, blue strikethrough, etc.

pastel condor
#

oh okay

opal bay
#

that's awesome

radiant pollen
#

You cant use valueOf with that because it's not a value actually in the enum

pastel condor
#

I see

#

then what could I do?

radiant pollen
#

No idea.

opal bay
#

I was thinking about using getLastColors but I didn't really understand it too well, but now I do thank you very much

#

what're you trying to do with it?

pastel condor
#

because I want to simply change the color of a pice of text in the middle then return it back to the original color code

radiant pollen
#

You can do that with getLastColors.

opal bay
#

maybe loop through what chatcolors returns and apply them to the remaining string?

radiant pollen
#

Just add the color string to the beginning of whatever other string you have.

pastel condor
#

yes, but then I want to apply it to the string

radiant pollen
#

Why, exactly, do you need the enums?

#

You shouldn't need them. Just prepend the text with the result from getLastColors.

pastel condor
opal bay
#

wait, what?

pastel condor
#

back to the color before the username

#

it like changes the color

radiant pollen
#

beginning_text + username + getLastColors(beginning_text) + ending_text

pastel condor
#

yes

#

thats what I'm trying to do

radiant pollen
#

Yeah... that will do it...?

pastel condor
#

here is the issue

#

this doesn't work lastColor = ChatColor.getLastColors(tempArray[i]); newMessageA[i] = ChatColor.AQUA+tempArray[i]+lastColor;

radiant pollen
#

Show more of the code

opal bay
#

just curious but why is the event async?

pastel condor
#

thats the default

radiant pollen
#

lastColor = ChatColor.getLastColors(tempArray[i-1])

pastel condor
#

the sync one is depreciated

radiant pollen
#

right?

#

wait no okay hold on

opal bay
#

PlayerChatEvent?

pastel condor
#

okay?

#

it's depreciated

#

the PlayerChatEvent

opal bay
#

oh crap I didn't even realize

pastel condor
#

yup

opal bay
#

I wonder why it was depreciated

tiny dagger
#

playerchat event was always deprecated tho haha

radiant pollen
#

@pastel condor What is in lastColor when you tested it?

pastel condor
#

then why have it?

tiny dagger
#

i dunno

opal bay
#

I haven't used playerchatevent in a long time so I didn't realize

tiny dagger
#

it just was to scare people from using it

pastel condor
tiny dagger
#

but it still has uses imo

opal bay
#

that's a channel link

radiant pollen
#

Yeah, that doesn't help.

#

Print it and see what's in it.

pastel condor
#

kk

#

one sec

#

I'm restarting the server rn

#

it just prints a blank line

grand aurora
#

Is there any way to debug a server in the same way console.log works in google chrome? I need to be able to see all of an objects properties, methods, etc without stopping the server. I know JVM remote debugging exists but it slows my server immensely.

hoary parcel
#

It doesn't slow your server, it halts it if you suspend the thread ^^

#

And no, that doesn't exist

#

Javas debugging is way more powerful anyways

grand aurora
#

Okay, thanks. Even when the thread isn't stopped, it slows down. When I do a server start/restart with it enabled it take five times as long to start ~5 minutes

radiant pollen
#

@pastel condor just had an epiphany

#

sorry it's late but

#

white is the default color and might not be given by getLastColors

#

try with another color and see if it works correctly

pastel condor
#

kk

#

nope same thing

hoary parcel
#

What kind of potato do you run? Lol

#

Or wait, do you do remote debugging over the network,m

#

?

grand aurora
#

We are remote debugging over the network, but even when nothing is connected it takes way too long to load

#

The VM is sitting at 70% usage and the memory at 30%

#

It gets hung after Loaded 6 recipes

#

I can't check the network usage or view the command line unfortunately. We are using a 3rd party minecraft-only host so we don't have VM access or physical access.

#

Also, I changed the timeout setting like in the guide but whenever I resume the server (regardless of how long the break has been) it crashes "due to WatchDog hard crash"

paper compass
#

How can I remove an area of blocks super fast? (without fawe)

vernal spruce
#

Changing type through nms async?

radiant pollen
#

What would be the best way to make an expandable player statistics database? I want to be able to make an API to add more statistics to track or whatever.

#

Should I just use an enum and alter sql tables to add new columns for each enum if a column for it doesn't already exist?