#help-development

1 messages Β· Page 2250 of 1

limber owl
#

bruh

solid cargo
#

i think resources > some crap gamerule

limber owl
#

if youre not helping then shut up

glass mauve
#

I tried helping bro

limber owl
#

but saying 1.8 is crap is not helping

#

keep that to yourself

solid cargo
#

it works

#

thanks bro :)

buoyant viper
#

oh god not another discussion on changing weather in code

#

not mocking anyone just last time we delved tooooooo far into mc client and server code to see how weather worked

regal anchor
#

bump

mortal hare
#

man its so hard to make easily shadeable lib

#

when your lib uses bukkit api

#

i bet I can add doWeatherCycle gamerule in 1.8 with some NMS wizardry

vital trout
#

Someone knows how to modify the default Day/Night cycle length ? (in my case 1m30s instead of 10m)

smoky oak
golden turret
#

idk how

smoky oak
buoyant viper
#

thought ur username was fuckin

#

Morbius

#

i shoud go to bed

smoky oak
#

urgh

lost matrix
smoky oak
#

dont remind me. I'm fairly certain my name is older than that shitty movie

vital trout
#

setTime in world class would do the trick ?

buoyant viper
#

that movie was fantastic smh

vital trout
lost matrix
# regal anchor bump

This is probably a very specific issue with your setup.
Your copy method looks fine. Just a bit outdated. Using nio you could do something like this

  public static void copyDirectory(String rootSource, String rootDestination) throws IOException {
    Files.walk(Paths.get(rootSource)).forEach(source -> {
      Path destination = Paths.get(rootDestination, source.toString().substring(rootSource.length()));
      try {
        Files.copy(source, destination);
      } catch (IOException e) {
        e.printStackTrace();
      }
    });
  }

PS: Your code is a hit in the face for the java code style

chrome snow
#

What do you suggest is the best way to create an instance of a party? Best way to register the party inside java code? If someone can give me an example I would appreciate it.

lost matrix
left swift
#

Is there any way to chenge the gamemode of the fake player?

golden turret
#

yes

#

do you have any references to him?

lost matrix
# chrome snow Ah alright

Your data class

public class Party {

  @Getter
  private final UUID partyId = UUID.randomUUID();
  private final Set<UUID> participants = new HashSet<>();

  public void addMember(UUID memberId) {
    this.participants.add(memberId);
  }

  public void removeMember(UUID memberId) {
    this.participants.remove(memberId);
  }

  public Set<UUID> getMembers() {
    return new HashSet<>(participants);
  }

}

Your manager class for that data:

public class PartyManager {

  private final Map<UUID, Party> partyMap = new HashMap<>();

  public Party createParty() {
    Party party = new Party();
    partyMap.put(party.getPartyId(), party);
    return party;
  }

  public Party getPartyById(UUID partyId) {
    return partyMap.get(partyId);
  }

  public void deleteParty(UUID partyId) {
    partyMap.remove(partyId);
  }

}
left swift
#

yes, I'm creating a completely new server player / craft player object for fake players on the tab

#

And I want to set the tablist fake players to spectator

golden turret
#

i think there is a method in the EntityPlayrr

left swift
#

that's right, there is a setGamemode() method

#

but if noticed correctly, the gamemode does not change

golden turret
#

it does

#

maybe you just need to send the packet

left swift
#

Is there any packet for gamemode? (i'm sending player info packet)

left swift
# golden turret it does

hmm, no, it doesn't...
craftPlayer.setGameMode(GameMode.SPECTATOR);and test
[11:55:42 INFO]: SURVIVAL

golden turret
#

log code pls

chrome snow
left swift
#
    private @NotNull ServerPlayer createServerPlayer(ServerLevel serverLevel) {
        GameProfile gameProfile = new GameProfile(UUID.randomUUID(), "");
        gameProfile.getProperties().put("textures", this.DEFAULT_SKIN);
        ServerPlayer serverPlayer = new ServerPlayer(this.minecraftServer, serverLevel, gameProfile);
        CraftPlayer craftPlayer = new CraftPlayer(((CraftServer) Bukkit.getServer()), serverPlayer);
        craftPlayer.playerListName(Component.text("                            ")); // 28 spaces
        craftPlayer.getHandle().latency = 1000;
        craftPlayer.setGameMode(GameMode.SPECTATOR);
        System.out.println(craftPlayer.getGameMode());
        return craftPlayer.getHandle();
    }```
golden turret
#

hm

#

see what setGameMode does then

#

or

left swift
red sedge
#

so when i open a chest inventory to a bedrock player, there seems to be a chest above the player right not related to spigot

golden turret
#

as long it is related with programming

red sedge
#

ya but its probably an issue with the plugin making cross compability

hot eagle
#

if i do "@r" in a another multiverse world it sometimes tps another guy in a different multiverse world how fix :(

limber owl
#

anyone know how to make a if statement with random inside that make it do the inside with more than 60% chance

red sedge
golden turret
limber owl
red sedge
#

ok then use that

#

the idea is the same

limber owl
#

thanks

left swift
#

@golden turret ok, I solve that gamemode using this πŸ˜„

craftPlayer.getHandle().gameMode.changeGameModeForPlayer(GameType.SPECTATOR);``` works good!
red sedge
#

can i ask why?

#

like what r u doin?

#

npcs?

left swift
#

tablist, and when I change my gamemode I keep my sorted position on the tab

red sedge
#

ah

#

alright

golden turret
#

bruh

#

tablist like this is so ugly

red sedge
#

unless it has a purpose

golden turret
#

still ugly

red sedge
#

i believe hypixel skyblock also has a tablist like this

#

and if they tried to cram that information into a normal one

quasi hornet
golden turret
#

i dont play on hypixel

red sedge
#

it would look so much worse

left swift
#

I think it is a good solution, e.g. for mini-games, where you need to sort the teams in the right places, e.g. for columns

red sedge
#

like

quasi hornet
#

I think mcc also have that?

red sedge
#

if you need so much informatiobn on the tablist

#

first of all you probably have a big design issue

#

secondly, yeah you should go with a tablist like this

solid cargo
#

how can i disable the taking of items from an armorstand?

#

interact event?

eternal oxide
#

armorstands have their own events

regal anchor
#

guys my plugin doesn't load since I added LunarClientAPI to my pom.xml

#

I compile a jar with dependencies in it and the LunarClientAPI loads

#

there is no error but not the "Loaded plugin v1.0" either

#

any idea ?

lost matrix
regal anchor
#

no exception 😟

lost matrix
eternal oxide
#

?paste latest.log

undone axleBOT
warm dagger
#

is there a way to recognize the real-time voice and then do something with it in spigot

eternal night
#

πŸ‘€

lost matrix
warm dagger
regal anchor
#

the plugin name is 'AbadrochAPI' but nothing refers to it

#

I'm sending a screenshot of the plugins directory

eternal oxide
#

There are no plugins other than via on that server

regal anchor
#

LunarClientAPI loads via my plugin

eternal oxide
#

um, API?

regal anchor
#

I named it API because I put it on my lobby servers AND mini game servers

lost matrix
eternal oxide
#

so basically you shaded in the LunarClient API and it took teh place of your plugin

regal anchor
#

oh okay thanks for the help

summer scroll
#

@tender shard

chrome beacon
#

^

twilit roost
#

How do I send player Title using BaseComponent?

eternal oxide
#

Title takes a string not a BaseComponent

twilit roost
#

ye ikr
thats why im asking

tardy delta
#

not?

eternal oxide
#

Your question makes no sense

tardy delta
twilit roost
#

well no clue what does make sense on that but lemme recapitulate

I have BaseComponent ( I need to change the font , therefore its BaseComponent/TextComponent) and I want to display it as Title for the player

twilit roost
eternal oxide
#

You can not use a BaseComponent in a Title

twilit roost
#

not even using NMS?

tardy delta
#

why would you want to anyways?

eternal oxide
#

Fonts are client side

twilit roost
#

I have binded texture to Unicode Char

and its inside seperate font I made
therefore I need to set the font so it displays the texture over whole screen

river oracle
#

Just send the unicode char

#

Lol

eternal oxide
#

if your font is on the client in a pack you just send the unicode

twilit roost
#

I have lots of textures binded onto different unicodes
so in order to make it more organized, I have multiple fonts in one resource pack

eternal oxide
#

Client title will use whatever teh client has set as its font

twilit roost
#

ok but that doesn't help me at all :))
Since I need to adapt the font of title I send to player

eternal oxide
#

as I already told you. The Title uses whatever font is set on the client. you can;t change that in the title

twilit roost
eternal oxide
#

Yeah, not Spigot

#

I guess you could try sending straight json

twilit roost
#

that would have require modification of client ig

eternal oxide
#

probably not

#

most chat things on teh client translate json

#

a simple test, try setting the title to "{\"text\":\"test message\",\"color\":\"dark_red\",\"font\":\"minecraft:default\"}"

#

or whatever font

twilit roost
#

Im trying rn to send something into chat
but looks like it has size limit

eternal oxide
#

did the title work?

twilit roost
#

nvm it doesnt

twilit roost
twilit roost
acoustic pendant
#

Hey, does anyone know a free head database api I can use?

tardy delta
#

internet is a thing

viscid girder
#

I have 4 worlds: 3 normal worlds (overworld, nether, end) and a world called "lobby". It has all necessary files and even worked until today. From now on, when I try to get the world using Bukkit.getWorld("lobby") and try to teleport there, i get a error location.world

eternal oxide
#

litterally just send that text as a title and see if it displays

simple silo
#

Can I somehow make anvils apply overleveled enchants? (like sharpness VI)

eternal oxide
simple silo
eternal oxide
#

and how are you loading this world?

acoustic pendant
viscid girder
#

java.lang.IllegalArgumentException: location.world

pastel juniper
#

What should I do, in order to change player name tag???

eternal oxide
#

the full stack trace please

#

?paste

undone axleBOT
eternal oxide
#

nm, I know what your issue is. How are you loading teh world? Additional world have to be loaded before you can access them

tardy delta
#

CraftPlayer#teleport checks if the world of the location is notnull iirc

viscid girder
#

what do you mean with how i load it? do i have to add it somewhere?

eternal oxide
#

Bukkit by default only has teh default 3 worlds. Toi use extra you have to load them

viscid girder
#

Ok, how?

eternal oxide
#

If it was workgin before you must have been loading it somehow

#

a plugin or in your code

viscid girder
#

so Bukkit.loadWorld() or something?

eternal oxide
#

WorldCreator.name("lobby").createWorld();

stoic vigil
#

how to catch an event, if an itemframe breakes? i thought it's EntityDeath, but thats just for living entitys...

viscid girder
#

ill try that, thanks?

prime kraken
#

Hello, does anybody know how can i cancel when a player jump in PME ?

#

please*

eternal oxide
#

pme?

prime kraken
#

player move event

eternal oxide
#

not easily

prime kraken
#

i ask for that x)

eternal oxide
#

due to auto step

prime kraken
#

Yes..

eternal oxide
#

also stairs

prime kraken
#

In fact, i just want to disable the jump when player are sprinting

eternal oxide
#

you have to detect an increase in Y and not onGround() is probably the simplest way

prime kraken
#

Okay i will check that way

eternal oxide
#
if (event.getFrom().getBlockY() < event.getTo().getBlockY() && !event.getPlayer().isOnGround()) {```Probably
golden turret
#

nop

eternal oxide
#

somethign close then

golden turret
#

player.getVelocity().getY() > 0

eternal oxide
#

no

#

you don;t want to test velocity, you want a full block movement up in Y

golden turret
#

i use that code to detect jumps

eternal oxide
#

Y will trigger for going up stairs or autostep

golden turret
#

in my plugin

#

nop

#

it does not

golden turret
#

i also thought that

#

but i tested

eternal oxide
#

Velocity is nto applied in Y when going up stairs?

golden turret
#

no

eternal oxide
#

oh thats nice then

golden turret
#

checking the velocity y is good

prime kraken
golden turret
#

but i think it is fired when you do it in mid air too

eternal oxide
prime kraken
agile anvil
prime kraken
eternal oxide
#
Player player = event.getPlayer();
if (player.getVelocity().getY() > 0 && !player.isOnGround()) {```
golden turret
#

remove !

agile anvil
#

I'm just saying that cause it will feel like if you're glitched. And I'm pretty sure that if you have some ping it won't reduce de speed

agile anvil
#

Stay me up to date please πŸ˜‰

eternal oxide
#

if that passes just set the event getTo to the getFrom

#

or cancel the event

simple silo
eternal oxide
#

no clue

simple silo
#

oh, maybe via AnvilInventory#setRepairCost

#

will try that

golden turret
#

on AnvilIntentory

simple silo
#

yeah, just saw that too, thanks will try

#

Yeah, worked thank you!

golden turret
#

i think you can ask to mfnalex himself

ivory sleet
#

ask away

tardy delta
#

!(a == b) wtf

eternal oxide
#

I've done that before πŸ™‚

tardy delta
#

me too but i was coding at night

#

edit

#

sleep for the weak lmao

#

just put them under the code lol

#

finally made that stupid stuff from yesterday and i came to the conclusion that it might not be so useful as i thought lmao

stoic vigil
#

how to get the nearest player of a location element?

tardy delta
#

you forgot the java part

#

whats even the problem lol

#

no its fine

stoic vigil
#

how to get the nearest player of a location element?

acoustic pendant
#

how can I get a player head by its value or url? I tried with meta.setOwner(); but didn't work

hybrid spoke
tardy delta
#

god im finished with that code from yesterday lmao

eternal oxide
tardy delta
#

and what does it print?

stoic vigil
eternal oxide
#

they could be miles apart

hybrid spoke
tardy delta
#

uhh

eternal oxide
tardy delta
#

me idiot

acoustic pendant
eternal oxide
acoustic pendant
#

What do you mean

eternal oxide
#

you got a texture not an owner

#

what spigot are you coding for?

tardy delta
#

the premium edition spigot

eternal oxide
#

?paste

undone axleBOT
eternal oxide
tardy delta
#

does it sound good to not save the user data when they quit the server, but instead save the data of all users periodically like every 10 minutes and when the server stops?

#

i wish java had destructors smh

quaint mantle
#

finalize

eternal night
#

finalize is deprecated and will be removed in the future

quaint mantle
#

No

#

#finalize is deprecated and is marked for removal

#

Get it right

tardy delta
#

πŸ€“

eternal night
#

you mean Object#finalize

quaint mantle
#

😠

eternal night
#

damnit get it right

quaint mantle
#

Hold on

#

im flying in my heli to find your bitches

#

No bitches here

tardy delta
#

ladies and getlemen intellij did it again

#

hmm yes ide errors

somber sequoia
#

Hey, yesterday someone helped me include VanishNoPacket's classes in my plugin. It all worked fine until I tried to compile the plugin, in the game the plugin gives a java.lang.ClassCastException: class org.kitteh.vanish.VanishPlugin cannot be cast to class org.kitteh.vanish.VanishPlugin so I tried to shade it in the jar but that just gives me a package org.kitteh.vanish does not exist error. Would anyone be able to help me with that? I have no idea what could be causing this issue nor why would it be generated, and im able to access the org.kitteh.vanish package in intellij

tardy delta
#

added the plugin to your plugins folder?

somber sequoia
#

Yep

tardy delta
#

you dont need to shade it as its a plugin

somber sequoia
#

idk what would i do then

#

it gives me java.lang.ClassCastException: class org.kitteh.vanish.VanishPlugin cannot be cast to class org.kitteh.vanish.VanishPlugin when its not shaded

eternal oxide
#

you didn;t set it scope provided. it included it in your jar

somber sequoia
#

that did it

#

Thank you so much

next stratus
#

o/ I has question about how to do something if someone could help? I wanna work out how much someone has earnt in the past x seconds / minutes. How to d oso?

tardy delta
#

depends on your economy lib

next stratus
#

that's when it becomes more fun

tardy delta
#

i'd just add a runnable

next stratus
#

it's custom πŸ₯²

stoic vigil
#

Collection<Entity> entities = location.getWorld().getNearbyEntities(location, 10, 10, 10);
how to loop through this? or if this isn't possible, how to cast to an array?

tardy delta
#

for loop lol

next stratus
#

what if i do it like
tokens = getTokensNow();
schedule delayed task for 60s or so
tokensNow = getTokensNow();
tokensNow - tokens?

tardy delta
#

learnjava moment

eternal oxide
#

if you only want players use a Predicate

next stratus
#

wait, i fixed it myself

#

πŸ₯²

tardy delta
#

actually mye

eternal oxide
#
    private Collection<Entity> getPlayersAround(Location loc, int i) {

        return loc.getWorld().getNearbyEntities(loc, i, i, i, entity -> {
            return entity.getType() == EntityType.PLAYER;
        });
    }```
tardy delta
#

im starting to use mye as conclure does πŸ˜”

#

Player.class::isAssignableFrom if you want to be fancy

eternal oxide
#

yep

stoic vigil
tardy delta
#

but we are not in a fancy mood today πŸ˜”

somber sequoia
#

how would I detect what player was right clicked with an item, for example if I were to right click a player with a stone block something would happen

subtle folio
#

listen for the playerinteractevent

#

and check if the player is holding said item

somber sequoia
#

yeah but how do i get the player on my crosshair

subtle folio
#

ah

#

playerinteractatentityevent

acoustic pendant
subtle folio
#

and get the entity

#

check if it’s a player etc

somber sequoia
#

alright thank you

sterile token
#

Its possible to create a custom multi Consumer for multiple things?

eternal oxide
#

what "things"?

sterile token
eternal oxide
#

No reason you can;t pass a class with those references

sterile token
#

Because i want to recreate something like this on my menu:

setButton(slot, new MenuButton(itemstack, (event) -> event.getPlayer() or event.getMenu()))

#

Do i explaine?

#

I have been told that i need an interface

eternal oxide
#

I'm not clear on what you want

sterile token
#

to ahive this:

MenuButton button = new MenuButton(slot, (event) -> );

And them with event be able to get the player, menu, etc

#

Its better explained now?

eternal oxide
#

No

sterile token
#

I have seen that they use a consumer for doing that

stoic vigil
#

how to create clickable text, define an action and react? (if possible not command reaction, but that i can react directly in the script somehow)

sterile token
#

Oh lmao i feeling like a noob trying to get help

sterile token
#
TextComponent component = new TextComponent("Text here");
component.setHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, new ComponentBuilder("Hover message").create()));
component.setClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/my anwsome command"));
stoic vigil
sterile token
#

1 second

#

What do you mean with react?

stoic vigil
sterile token
#

TextComponent its the same for spigot and bungeecord

eternal oxide
#

?jd-b

sterile token
#

?jd-bungeer

subtle folio
#

lmfao

sterile token
#

?jdb

#

?jd-bungee

#

?jd-bungeecord

eternal oxide
#

?jd

subtle folio
#

the struggle is real

sterile token
eternal oxide
#

Who didn't add jd-b as they did jd-s?

subtle folio
#

ping imagine

sterile token
sterile token
#

@quaint mantle sorry for ping but can you add the next command to the bot. so its easier to get bungeecord docs

?jd-b

sterile token
stoic vigil
#

thy

sterile token
#

Your welcome

#

And what do you mean by react?

quaint mantle
#

?jd-bc

quaint mantle
#

πŸ’€

tardy delta
#

lol

acoustic pendant
#

Is this a way to fill all empty slots in a gui?

eternal oxide
#

?jd-b

#

not good enough

dusk flicker
#

?jd-bc

tardy delta
worldly ingot
#

Yeah, what you're doing in that snippet is fine. I'd just check for air as well

#

I can never remember whether or not some inventory method is nullable

stoic vigil
acoustic pendant
tardy delta
#

bruh

#

if (item == null || item.getType() == Material.AIR)

acoustic pendant
#

oh

subtle folio
#

πŸ‘

acoustic pendant
#

that's right

tardy delta
#

and i dont care about equals on that enum

#

btw

tardy delta
#

oh there is such a thing

eternal oxide
#

Yep does cave and normal air

opal wedge
#

Hey, I have following event:

    @EventHandler
    public void onBlockInteract(PlayerInteractEvent event) {
        if (!Main.getChallenge().isRunning() || event.getClickedBlock() == null)
            return;

        boolean canSeeItem = ((RandomTextureChallenge) Main.getChallenge())
                .getTexturePackHandler()
                .canSeeItem(event.getPlayer().getUniqueId(), event.getPlayer().getLevel(), event.getClickedBlock().getType().name());

        if (!canSeeItem)
            event.setCancelled(true);
    }

I am trying to intercept any block interactions (open door/trapdoor) that cannot be seen, however this event also intercepts the block placements. Is there an event that does not intercept the placements or another method?

worldly ingot
#

In 1.14 you can do Material#isAir() :)

#

o imajin just exists

eternal oxide
#

not that you are going to find cave air in an inventory

tardy delta
#

never used it altho im on the 1.17 api

worldly ingot
#

Sometimes I ignore his messages

quaint mantle
#

Wow

tardy delta
#

rude

#

πŸ‘‰πŸ‘ˆ

eternal night
quaint mantle
quaint mantle
eternal oxide
#

true

tardy delta
eternal night
#

Well the enum -> registry PR still has not made it 😭

tardy delta
#

smh choco sniped me

worldly ingot
#

My method is a bit better ;p

tardy delta
#

looks like im outdated

worldly ingot
#

Can throw in that action check if you want though for good measure

opal wedge
#

thanks

subtle folio
#

== or .equals for itemstack enums?

glass mauve
#

enums use ==

#

and primitves use ==

#

else use .equals

sterile token
#

primitives are String , int, double, etc right?

#

Neither Set, List right?

subtle folio
#

primitives πŸ€“

glass mauve
#

String not

tardy delta
#

its not recommended to use == on enums that implement Keyed

quaint mantle
#

Why?

tardy delta
#

cuz that might change to a class instead of an enum

#

atleast that was in the post

quaint mantle
#

Spigot's fault cry about it

glass mauve
tardy delta
#

idc i keep using ==

quaint mantle
#

Same

#

doesnt matter

subtle folio
#

πŸ’€

tardy delta
#

if its an enum threat is as an enum

glass mauve
#

yea

quaint mantle
#

Threat it

sterile token
#

For enums i just use Enum.valueOf()

quaint mantle
#

How is that relevant

glass mauve
#

if you want to convert a String to enum I think

quaint mantle
#

"ENUM_VARIANT"

tardy delta
#

just use Material.matchMaterial(str)

subtle folio
#

best way of making a int into a string String a = 1973 + β€œβ€;

glass mauve
tardy delta
#

ik

glass mauve
quaint mantle
#

Bad

subtle folio
#

it’s 100% best practice wym

quaint mantle
#

😦

glass mauve
#

xD

quaint mantle
#

String.valueOf

subtle folio
#

ew

tardy delta
#

new String(new String(new char[] { 'a' }))

#

noone can beat that

glass mauve
#

I can

subtle folio
#

byte code when

glass mauve
#

new String(new String(new String(new char[]{'a'})))

tardy delta
#

damn

#

hmmmyes

sterile token
#

Never seen something like that

tardy delta
#

primitive generics when

glossy venture
#

yeah

sterile token
#

use void

tardy delta
#

no shit

glossy venture
#

but for that they need to remember the types passed in

#

and they dont want to do that or smth

sterile token
golden turret
subtle folio
#

you should use that

golden turret
#

no

#

i mean

subtle folio
#

that’s actually the best yk

golden turret
#

"" + Integer.toString(197)

subtle folio
#

yes ik

#

i’m being funny

sterile token
#

Oh shit i always use String.valueOf() to parse int into strings

mortal hare
#

cool bitwise hack

mortal hare
#
var % 3

is the same as

var & 3
sterile token
#

πŸ˜‚

mortal hare
#

that's a variable name

sterile token
#

ahh ok

golden turret
#

i was going to say your ip

mortal hare
#

second version is micro optimised

tardy delta
#

127.0.0.1

golden turret
#

wrong

#

his ip is 0.0.0.0

tardy delta
#

lets try to ddos that

#

πŸ’€

stoic vigil
#

is there a way to get the string name of an world object? (such as minecraft:overworld)

golden turret
#

guys, how can i ddos 127.0.0.1?

sterile token
#

Oh noo i just remember a friend want to ddos someone and i give his own ip just to troll

#

And get auto ddos himself

tardy delta
#

πŸ€” πŸ€” πŸ€”

sterile token
#

Imagine getting auto ddos

#

Hahaha

#

Also we shouldnt be talking about this because is baneable i think

golden turret
subtle folio
#

woah bro

sterile token
golden turret
#

random

#

bruh

subtle folio
#

@mod get

golden turret
#

i wanted to say ransom

sterile token
golden turret
#

randomware

stoic vigil
golden turret
subtle folio
#

WorldType enums right?

sterile token
stoic vigil
#

jap

eternal night
stoic vigil
#

wanna send it with a command

subtle folio
#

.valueOf()?

sterile token
undone axleBOT
golden turret
#

i mean

sterile token
#

Send your full code please

golden turret
#

if it is a namespace

golden turret
#

you can get it by using NamespacedKey#getKey()

#

aaa

#

location.getWorld().getName()

#

also

#

do you want an itemfram break confirmation?

stoic vigil
#

correct

#

is there an easyer way to do that?

golden turret
#

then why are you using getNearbyEntities?

subtle folio
#

easier*

sterile token
#

Why the heck shity Location doesnt use primitives lmao. Cuz of that shit mongo codec doesnt allow me to save/delete/update a location 😠

stoic vigil
mortal hare
# eternal night what
int var = 4;
int operation = var % 3;

operation would be set to 0

int var = 4; 
int operation = var & 3;

operation would be still set to 0 due to how AND bitmasking operation works. But its faster to compute since it computes in binary form

golden turret
#

?jd-s

undone axleBOT
eternal night
#

4 & 3 is literally 0

#

what are you talking about

mortal hare
#

sorry 0

quaint mantle
mortal hare
#

yea

#

but that's the main point

#

that it works the same as the modulus operator, my bad.

sterile token
quaint mantle
#

Store it yourself lol

sterile token
#

Yeah

eternal night
#

4 % 3 would not be 0

sterile token
#

My own vector object right?

quaint mantle
#

ObjectOutputStream or something

sterile token
#

I will use my own vector object

eternal night
#

4 % 3 is 1

mortal hare
#

3 % 3 will be 0

sterile token
#

Every number divided by 1, is 1

eternal night
#

bruh

#

that is modulo

ivory sleet
#

% is for modulo, not normal integer division

eternal night
#

not division

sterile token
#

oh

#

modulo

#

wft

tardy delta
#

1 * 1 is also 1

sterile token
#

Never heard about it

sterile token
mortal hare
#

but it works almost the same as modulo operator

sterile token
#

what means modulo?

mortal hare
#

remainder of the division

eternal night
#

rest after division

#

yea

sterile token
#

Oh ok

eternal night
#

but like, "almost the same" is useless

sterile token
#

yeah

#

It should be used specfici things

#

Like if it there its because it has a specific use

eternal night
#

not to even talk about negative numbers here πŸ˜…

subtle folio
#

0^0 is 1

river oracle
#

is there a method to get all blocks of one type from an inventory or am I just going to hvae to loop through

river oracle
#

LOOOOOOOOOOOp

#

looping time baby

subtle folio
#

or like .stream

sterile token
river oracle
#

ah yes stream

#

I will stream since its a new fancy thing I learned

mortal hare
#

i am calling this bitwise hack for myself as "exclusive modulo operator"

subtle folio
#

lmfaoo

sterile token
#

πŸ˜‹

#
List<UUID> members = Lists.of(uuid-1, uuid-2, uuid-3);

members.stream().filter(Bukkit::getOfflinePlayer).map(OfflinePlayer::getName).collect(Collectors.joining(", "));
#

Imagine seeing that

eternal night
#

filter(Bukkit::getOfflinePlayer) kekw

sterile token
#

Because if uuid is null?

eternal night
#

filter takes a predicate

tardy delta
#

lmao

sterile token
#

Hmn

#

Idk i tested and worked

eternal night
#

this does not even compile

#

it does ?!

glossy venture
#

just use map

sterile token
#

Oh ok just map?

#

Allright

tardy delta
#

someone didnt learn their lesson

eternal night
#

how the fuck does that compile

glossy venture
#

i mean if it works you could

sterile token
#

Atleast compiles

glossy venture
#

but use map

#

probably better

tardy delta
#

uuid-1 mmy yes

glossy venture
#

there is 0 way that compiled

sterile token
eternal night
#

Yea no, that shit does not compile

river oracle
#

can you use streams to compare with ItemStack#isSimilar? I'm assuming you can but I'm new to this shit doesn't make sense to me

sterile token
#

Lmao it compile

#

Im not trolling and or shocking

tardy delta
#

whats wrong with a stringbuiler

eternal night
#

unless you have a different bukkit api

#

that returns a boolean for Bukkit.getOfflinePlayer

#

this will not compile

sterile token
#

claim.getMembers().stream().map(Bukkit::getOfflinePlayer).map(OfflinePlayer::getName).collect(Collectors.toList())

#

Sorry i writed wrong

eternal night
#

lMaO iT cOmPilE

sterile token
#

YEs!!

#

ill send screenshot

eternal night
#

Well yes

#

the second thing you sent can compile

river oracle
#

does this look about right for what I wanted to do

        List<ItemStack> items = Stream.of(this.inventory.getContents())
                .filter(e -> e.isSimilar(item))
                .collect(Collectors.toList());```
tardy delta
#

fOr LoOP

sterile token
river oracle
#

tbh when do streams actually make sense isn't there massive overhead

eternal night
#

mate you literally sent the wrong code

sterile token
eternal night
#

Well, gg you wrote compiling java code xD

tardy delta
sterile token
#

The second code i sent was suggested by copilot imagine (full code)

eternal night
#

Streams are not that bad

tardy delta
#

not that

eternal night
#

unless you use them in application critical places, they are fine

tardy delta
#

i cant use them in the nasa launch code or the rocket crashes πŸ˜”

sterile token
#

yeah it a shity 3d blocks game it doesnt matter a lot

#

πŸ˜‚

eternal night
#

Well

river oracle
#

uhm

eternal night
#

you can still write pretty application critical code in your plugin

sterile token
#

Unless you are working for a global network there yes care

sterile token
#

I think i have improveed a 20% only because of your recommendations

tardy delta
#

i used to used

sterile token
#

Oh bruh you always shitting me

#

Dont be like that man

tardy delta
#

wait no that will break

#

also async in async is probably not a good idea

#

more ugh

stoic vigil
#

what could be the reason of this error? java.lang.NullPointerException: Cannot invoke "org.bukkit.command.PluginCommand.setExecutor(org.bukkit.command.CommandExecutor)" because the return value of "com.schwerthecht.postermaker.Main.getCommand(String)" is null

sterile token
tardy delta
#

how fast can you type lmao

sterile token
#

Im really fast

stoic vigil
sterile token
#

Check the plugin.yml docs on spigot

#

They explain all about registering commands

#

Good luck man

stoic vigil
sterile token
#

If need help we are here

sterile token
#

Or you can either register them from CommandMap which doesnt need to register them via plugin.yml

tardy delta
#

if you dont want to use a command framework

sterile token
#

You have 3 options:

  1. Registering via plugin.yml and getCommand()
  2. Using your own system which register them via CommandMap
  3. Use a command framework (as Fourteen suggested)
tardy delta
#

lets join a future on the async prelogin thread

#

dont give a shit

sterile token
tardy delta
#

yes if yu pay for it

sterile token
#

Hahaha

#

You are so troll

tardy delta
#

i was serius

sterile token
#

Okay?

#

Is your method loadUser a consumer?

tardy delta
#

ask ya question smh

#

CompletableFuture<KingdomPlayer>

sterile token
#

Oh allright

sterile token
#

Oh

#

I was looking for that many times

tardy delta
#

a promise that that user will be loaded at some time in the future

sterile token
#

😳

sterile token
tardy delta
#

there is so much outdated code there smh, lets do a push now

sterile token
#

Async wait until the task is done while i can process other tasks*

tardy delta
#

uh its just off the main thread

sterile token
tardy delta
#

its just the future impl which makes it wait

stoic vigil
#

how to check if an entity out of getnerbyentitys is an itemframe?

eternal night
#

instanceOf

stoic vigil
#

jee, but instanceof what? xD

eternal night
#

ItemFrame

stoic vigil
#

doesn't work

quaint mantle
eternal night
subtle folio
#

entity.getType() == EntityType.ITEM_FRAME?

#

or does that not work

quaint mantle
#

instanceof

eternal night
#

instanceOf should certainly work

stoic vigil
quaint mantle
#

Bruh

subtle folio
quaint mantle
#

use instanceof

stoic vigil
quaint mantle
#

Yes it does lol

eternal night
#

something else in your code is failing then

subtle folio
#

?paste

undone axleBOT
eternal night
#

^

subtle folio
#

^

quaint mantle
#

^

stoic vigil
warm galleon
#

Is there a way to disable the movement ai of an entity but keep it so it can still move? Im trying to make like a bat swarm kind of thing as an item you can use to like blind another player but when I try to disable ai the bats spawn, curl up, and are unable to be moved via velocity, heres my code (1.8.8)

public class SwarmEffect extends BukkitRunnable {

    public static String MATCHER = "swarm wand";
    private static HashMap<Player, List<Entity>> bats = new HashMap<>();

    public static void shoot(Player shooter) {
        if (!bats.containsKey(shooter)) {
            bats.put(shooter, new ArrayList<>());
        }
        Entity bat = shooter.getWorld().spawnEntity(shooter.getEyeLocation(), EntityType.BAT);
        net.minecraft.server.v1_8_R3.Entity nms = ((CraftEntity) bat).getHandle();
        NBTTagCompound nbt = new NBTTagCompound();
        nms.e(nbt);
        nbt.setInt("NoAI", 1);
        nms.f(nbt);
        bat.setVelocity(Util.calcVelocity(bat, shooter.getEyeLocation().getDirection().multiply(75).toLocation(shooter.getWorld())));
        bats.get(shooter).add(bat);
    }

    @Override
    public void run() {
        for (Map.Entry entry : bats.entrySet()) {
            Player shooter = (Player) entry.getKey();
            for (Entity bat : (List<Entity>) entry.getValue()) {
                bat.setVelocity(Util.calcVelocity(bat, shooter.getEyeLocation().getDirection().multiply(75).toLocation(shooter.getWorld())));
            }
        }
    }
}
#

(planning to apply blindness to the entity it hits but the bats dont move lol)

lost matrix
acoustic pendant
#

how can i get the host of a server by its name in the bungee config.yml?

#

and the port

warm galleon
#

plus that doesnt help me at all

quaint mantle
#

πŸ’€

lost matrix
quaint mantle
#

Hes telling you to update

sterile token
quaint mantle
#

You certainly arent getting 1.8 nms help here

#

Probably just get made fun of

warm galleon
#

i mean you couldve just told me that lmfao

quaint mantle
#

its just one statement, its fine

sterile token
acoustic pendant
lost matrix
tardy delta
#

whats the shortcut to comment code in ij?

vocal cloud
#

ctrl /

sterile token
vocal cloud
#

or for blocks ctrl shift /

tardy delta
#

nop

sterile token
vocal cloud
#

one line -> ctrl /
big pieces -> ctrl shift /

#

or highlight the code to comment and press ctrl shift /

tardy delta
#

lemme do it manually lol this shit aint doing anything

vocal cloud
#

RIP lol

acoustic pendant
sterile token
acoustic pendant
#

sure

sterile token
#

You can by ServerInfo i think

#

ServerInfo contains then each server info

lost matrix
acoustic pendant
#

uhm

#

I mean, to get it from a spigot plugin

sterile token
lost matrix
sterile token
#

If not code will continues execution

tardy delta
#

it needs to login in any case

sterile token
tardy delta
#

noob

sterile token
tardy delta
#

idk

#

parents are home are they annoy me

lost matrix
sterile token
#

Also why are you blocking the thread?

ivory sleet
#

Why not

tardy delta
#

cuz the asyncpreloginEvent

#

it runs already off the main thread

#

unlike smth like playerloginevent

sterile token
#

Blocking the thread doesnt freeze the server?

tardy delta
#

and i dont want players to be able to join before their data is loaded

ivory sleet
#

It doesn’t block the server thread

sterile token
ivory sleet
#

It blocks another thread

tardy delta
#

only blocking the main thread freeezes the server

limber marten
#

Is there any way to set a block that doesn't update? I tried to cancel the BlockPhysicsEvent but I can see the update during a tick.

lost matrix
lost matrix
limber marten
#

so apart from canceling the event there is no other solution ig

lost matrix
limber marten
#

i'm creating custom blocks using noteblock. I'm trying to stop the update of these note blocks

#

like Origin Realms did

limber marten
#

ahah

acoustic pendant
#

there are plugins for that

chrome beacon
#

Use Bungeeguard and/or a firewall to prevent outside connections to your server without the Bungee

lost matrix
chrome beacon
#

Uploads?

lost matrix
#
  1. There are plugins to prevent the crash
  2. Its possible to forbid direct connections with your hosts. (force proxy connection)
limber marten
#

hmm, custom blockstate implementation could be a way to achieve that. I'll try to find out more about it, ty ^^

lost matrix
eternal oxide
#

if its all on the same machine, all the servers connect via localhost. You can not connect to them except via bungee

lost matrix
wary axle
#

I had a question, I created a test plugin to modify the life of the players, except that instead of modifying their life Max I modified the scale of their life, how can I reset it? So 20 hearts as originally ?

tardy delta
#

get the attribute max health and set the base value to 20 iirc

#

wait 20 hearts i guess you mean 10 hearts so 20

tardy delta
#

ok im outdated for everything i said today

eternal oxide
#

lol

tardy delta
#

lets just cry and forget about my existence

#

whats wrong with a lambda grr

sterile token
#

No why doing getType to string?

lost matrix
#

I would most definitely create a dedicated class for this task.

#

Then create a Set<Material>
Thats much much faster than using Strings

sterile token
#

Yeah, do a set with all the materials

#

?notworking

undone axleBOT
#

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

lost matrix
#

Your problem is that this runnable does one full cycle up to 127 in the first tick and then never enters the while condition because 'i' is 127

#

exactly

#

What i was saying

#

good we figured this out πŸ‘

eternal oxide
#

Its important you understand the answers

lost matrix
#

Thats already the answer: Your logic is flawed

eternal oxide
#

7smile7 already gave you the correct answer

#

you mean you want a fix for that

tardy delta
#

πŸ˜΅β€πŸ’«

eternal oxide
#

your logic is flawed. Find the highest block at the very start of the code. then loop until you either find the block or you reach the lowest height of the world.

limber marten
lost matrix
#

After your while loop simply reset 'i'

tardy delta
#

using a lambda

#

cleaner

lost matrix
eternal oxide
#

requires an external value

tardy delta
#

if you use the scheduler instead of a bukkitrunnable smh

#

ah

lost matrix
tardy delta
#

sucks

lost matrix
#

First of all: Remove the i = 0; before your return.
It does exactly nothing besides decreasing the efficiency of your code.

#

Remove the "return" as well

#

Well now that i look at it, it doesnt really matter

eternal oxide
#

a few things you could do, use a Location variable. Currently you clone the player Location 24 times each loop for each player

lost matrix
#

Show us your timings

#

This is pretty much all you can do performance wise.

  public static int destory() {
    return new BukkitRunnable() {
      public void run() {
        int i = 0;
        for (Player onlinePlayer : Bukkit.getOnlinePlayers()) {
          Block block = onlinePlayer.getLocation().getBlock();
          while (i < 12) {
            Block relative = block.getRelative(0, i, 0);
            if (!destories.contains(relative.getType())) {
              ++i;
              continue;
            }
            BlockData blockData = relative.getBlockData();
            relative.setType(Material.AIR);
            onlinePlayer.getWorld().spawnFallingBlock(relative.getLocation().add(0.5, 0, 0.5), blockData);
          }
        }
      }
    }.runTaskTimer(MovingChannel.getInstance(), 0, 20).getTaskId();
  }

How often is this runnable being executed?

#

I hope destroy is only being run exactly once and then never again?
Because this does not look too heavy.

#

once every 10 ticks means you could do evenly distributed scheduling.
With 50 players instead of having one fat load every 10 ticks, you could
run schedule 5 players per tick for 10 lighter ticks.

#

?dis

#

?dist

tardy delta
#

is that from the workload thread?

#

it liked it very much

lost matrix
#

?workload

#

Ah... what was it...

lost matrix
#

@quaint mantle What was the command that links to my workload distribution thread again?

quaint mantle
#

?workload

lost matrix
#

F

quaint mantle
#

?workloads

tardy delta
#

?distribution

quaint mantle
#

?workdistrobution

#

?workdistribution

lost matrix
#

?workloaddistribution

desert loom
#

?workdistro

lost matrix
#

thx

quaint mantle
#

Bruh

#

As soon as i found it

lost matrix
#

Bit weird that name

tardy delta
#

i pasted the link in my code cuz i 'used' some code of it

#

ehe

quaint mantle
#

?workdistribution so we dont forget

lost matrix
tardy delta
#

ye i looked at that too

#

i like it

#

exactly what i was doing wrong

wooden fable
#

Is there a way to open a max level enchanting table without using nms?

lost matrix
wooden fable
#

But i'm trying to open an enchanting table

lost matrix
#

Like. Player#openInventory(Inventory)

tardy delta
lost matrix
tardy delta
#

never heard of those :D

#

πŸ€” πŸ€” 🀦

#

forgive me

lost matrix
#

ok

tardy delta
#

im not thinking when i say smth

lost matrix
#

I just was pointing out that the name of ValueSortedTreeSet is a bit redundant because they are already sorted by values.

tardy delta
#

im an idiot anyways

#

i wanted to do the valuesorted treemap not set

lost matrix
#

Ah ok. Makes a bit more sense then

tardy delta
#

🀦

#

hmm i have no access to the private stuff...

vital ridge
#

Can you cancel a bukkittask that has ended already?

tardy delta
#

i guess i could just write the whole treemap again πŸ‘‰πŸ‘ˆ

vital ridge
#

Like if i runTaskLater 10 sec and then try to cancel it after like 20 sec.

tardy delta
#

check the docs

#

?jd-s

undone axleBOT
shell wraith
#

I've been watching this chat the past few days and you all make me want to start developing because of how helpful/friendly you all are πŸ˜…

tardy delta
#

java code can be wonderful

lost matrix
vital ridge
#

Gotchu.

red sedge
#

how would i like push a mob towards the player? i know how i would do this in 2d but idk about 3d

tardy delta
#

That's alot of uwu

red sedge
tall dragon
#

i guess you would get the entity vector, subtract the player's location vector and normalize it. then apply the result to the entity

#

though im not too well versed in vectors either

red sedge
#

i think so yeah

#

cus that would get the distance between the 2 positions and when normalised

#

yeah

#

wait normalise isnt a built in function for vectors?

limber owl
#

does anyone know how to use splines?

river oracle
#

What is a good way to check if inventories are the same. My issue is with the current way I run events is that It checks if the inventories are equal like so

    /**
     * checks if two inventories are equal
     * 
     * @param view the inventory view
     * @return true if the inventories are equal
     */
    public final boolean isEqual(final InventoryView view) {
        return view.getTopInventory().equals(this.getInventory());
    }``` this works fine for the most part, but when working on my shop I realized I have a template for the confirmation menu and not every player can be fed the same inventory or it will cause issues I was curious what else I could do to check for the inventories in these events.
echo basalt
#

or a session id

ornate patio
#

is there an event for when an entity is killed by another entity

river oracle
#

EntityKilledByEntityEvent

#

is a thing iirc

rotund pond
river oracle
#

EntityDeathEvent

#

my bad

ornate patio
#

how do i get the killer though

river oracle
#

EntityDeathEvent#getKiller()

#

or wait

#

I think its getEntity#getKiller

ornate patio
#

thats the entity that died

ornate patio
#

or wait

#

thats only for a player

onyx fjord
#

does java have something similar to env on node?

ornate patio
#

can i just use EntityDamageByEntityEvent and check the if entity has 0 health

worldly ingot
humble tulip
#

Check if it's entitydamagbyentityevent

#

U can also just use entitydamagbyentityevent

worldly ingot
ornate patio
red sedge
#
for (Entity entity : player.getWorld().getNearbyEntities(player.getLocation(), 15, 15, 15)) {
            entity.setVelocity(
                    entity.getLocation().subtract(player.getLocation()).toVector().normalize().multiply(5)
            );
        }```
what am i doing wrong? it says "x is not finite"
ornate patio
#

but does the hp represent the amount of health after or before the event?

onyx fjord
humble tulip
#

Since events that are cqncellable are called before they take place on the server

worldly ingot
#

idk. It gets environment variables

ornate patio
#

damn

#

or wait

red sedge
lost matrix
red sedge
#

andd how would i go abt fixing it

ornate patio
#

can't i just check to see if event.getEntity().getHealth() - event.getDamage() is <= 0?

humble tulip
# red sedge setvelocity

The player is one of the entities in that area maybe so the distance is 0 when doing normalize

#

Check if the entity is player and skip

red sedge
#

alr

humble tulip
#

Like if it's the player

red sedge
#

if (player.equals(entity)) {
continue;
}

lost matrix
lost matrix
onyx fjord
#

thanks

ornate patio
#

@lost matrix have you optimized the block finding script btw

#

if not it's completely fine

ornate patio
#

alright thanks, i appreciate it a lot πŸ™‚

grim ice
pastel juniper
#

What is the packet for player name tag???

old sail
#

What's MetadataValue and how do I set it?

eternal night
#

usually: don't use metadata

#

unless you really need it over PDC

old sail
#

So how do I know that mob is my custom mob?

eternal night
#

you can apply a tag with the PDC

#

?pdc

old sail
#

It looks useful, tysm

red sedge
#

are there any good and fast particle apis anyone knows?

#

like preferably with its own algorithm for circular particles

waxen plinth
#

That's not a hard thing to do yourself

eternal night
#

EffectLib kekw

#

but yea, computing a circle is not too complex.

river oracle
#

computing circles πŸ’€

red sedge
#

but

#

im lazy

river oracle
#

what do you need to compute with a circle

red sedge
#

and theres probably someone who did it much faster than m e

river oracle
#

pir^2
2pi
r
uhm thinking of other formulas

red sedge
#

Ya but like idk

#

spawning a particle for points in that circle seems complex

lost matrix
#

You can literally just play around with some plotting app and write it up in code.