#help-development

1 messages Ā· Page 2140 of 1

tender shard
#

yeah you're right, first problem was probably mismatching name

#

but then they fixed the name but removed the "extend JavaPlugin" part lol

glossy venture
#

lmao

#

yeah

pastel quiver
#

help run-build?

glossy venture
#

bro im using a forge instance and its still not logging shit

#

at least the error is mapped

tender shard
#

they probably don't even know basic java so, if I was you, I'd send them ?learnjava instead, otherwise you're probably just wasting your time lol

#

yep

#

well

#

in 90% of cases

#

erm yeah sure

#

you mean for stuff like command completion or what?

glossy venture
#

do something like

tender shard
#

so you want the actual command executor to do async stuff?

crude loom
#

Is it possible to cancel all the scheduled tasks that were scheduled by my plugin? (without having to save the id)

tender shard
#

BukkitScheduler#cancelTasks(YourPlugin)

#

are you sure you didn't change anything else? show your code pls

glossy venture
#
final Player player = ...;

CompletableFuture<V> future = ...;
future.whenComplete(value -> {
  Bukkit.getScheduler().runTask(() -> {
    player.sendMessage(value);
  });
});
tender shard
#

?

glossy venture
#

and have whatever async shit ur doing return a completable future

crude loom
tardy delta
#

i was just going to say that you could work with futures or callbacks x)

tender shard
glossy venture
#

?

#

whats the issue

#

your async thread or the server thread

tardy delta
#

the main thread dies?

#

then youre probably doing it sync on the main thread

glossy venture
#

use a thread pool

#

and do the completable future shit i sent

tardy delta
#

completablefuture uses a threadpool internally x)

glossy venture
#

oh yeah

tardy delta
#

conclure once told me that i should use a ForkJoinPool for the database operations

glossy venture
#

@quaint mantle

public <V> CompletableFuture<V> getValueAsync(/* ... */) {
    return CompletableFuture.supplyAsync(() -> {
        // get value from database
        V val = null;

        return val;
    });
}

public void sendValueToPlayer(final Player player) {
    getValueAsync(/* ... */).whenComplete((val, err) -> {
        if (err != null) {
            // handle any error which occurred
            System.out.println("Error while retrieving value");
            err.printStackTrace();
            return;
        }

        // run synchronously (on the server thread)
        // required to use most of the bukkit api
        Bukkit.getScheduler().runTask(/* plugin */ this, () -> {
            // do whatever you want with the value
            player.sendMessage("Here is your value: " + val);
        });
    });
}
tardy delta
#

such clean code should be pinned šŸ˜

glossy venture
#

lmao

tardy delta
#

šŸ˜‚

crude loom
#

?paste

undone axleBOT
crude loom
#

Why am I getting an error: 'Variable might have not been initialized' when trying to schedule the generator task inside the method?
When I'm doing the same thing outside the method it works for some reason?
https://paste.md-5.net/mixoyekunu.java

tender shard
crude loom
#

Am I not doing the same outside the method though?

tender shard
#

?

crude loom
#

I mean, it works with 'ironGenerator', why is that?

tender shard
#

no that too won't work

#

if you move the ironGenerators thing above, it will probably be angry at that part instead

crude loom
#

It's only for the task inside the method, I have used the task outside the method and it works

#

For some reason it's a problem only inside a method

#

Wait nevermind I can just schedule a repeating task I don't know why am I overcomplicating thingsšŸ˜…

daring lark
#

why my plugin can't get vault?

    public void onEnable() {

        getCommand("shop").setExecutor(shopCommand);


        if (!setupEconomy() ) {
            getServer().getConsoleSender().sendMessage(ChatColor.RED + "Nie znaleziono Vault.");
            getServer().getPluginManager().disablePlugin(this);
            return;
        }
    }

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

    private boolean setupEconomy() {
        if (getServer().getPluginManager().getPlugin("Vault") == null) {
            return false;
        }
        RegisteredServiceProvider<Economy> rsp = getServer().getServicesManager().getRegistration(Economy.class);
        if (rsp == null) {
            return false;
        }
        econ = rsp.getProvider();
        return econ != null;
    }```
quaint mantle
#
package net.havana.havanatest;

import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;

public class Scoreboard implements Listener {

    @EventHandler
    public void setScoreBoard(Player player) {

    }

}

Why does it underline "Player" after the public void? Also "import org.bukkit.entity.Player;" gets dark gray

kind hatch
#

Or, pass an event instead

normal thicket
#

I will import script also that will ༼ つ ◕_◕ ༽つ your tokens

kind hatch
quaint mantle
#
package net.havana.havanatest;

import org.bukkit.Bukkit;
import org.bukkit.event.Listener;
import org.bukkit.scoreboard.ScoreboardManager;

public class TestScore implements Listener {

    ScoreboardManager manager = Bukkit.getScoreboardManager();

}

I got this code but "manager" after "ScoreboardManager" is dark gray

#

why?

river oracle
#

That sounds like a question from somebody who has no clue wtf they are doing

steel swan
#

so i have this code that sends a snowball

if(getMana(player.getUniqueId()) >= 40){
Snowball ball = player.getWorld().spawn(player.getEyeLocation(), Snowball.class);
ball.setShooter(player);
ball.setVelocity(player.getLocation().getDirection().multiply(1.5));
}

How can i check if it hit a player, and if yes get that player?

quaint mantle
#

i am new to Java

river oracle
#

Learn Java don't start with spigot if you can help it

crisp steeple
#

it’s your ide telling you you don’t use that field anywhere

river oracle
#

Also don't identify issues with syntax highlighting lol

#

Idfk what dark gray menas

quaint mantle
#

Imagine being toxic

#

ffs

steel swan
quaint mantle
#

It was just a question

crisp steeple
#

Lmao

steel swan
#

?learnjava

undone axleBOT
quaint mantle
#

@river oracle

river oracle
#

Learn java?

crisp steeple
#

Can’t tell if this is a troll or not

river oracle
#

Prob not

#

How knows tho

steel swan
# quaint mantle It was just a question

want an answer ?
WELL first, highlight depens on :
the what app ur using
what theme ur using
how ur writing
and a lot.
Like if u have an error, send the error, check the line, and try finding out whats wrong

crisp steeple
#

also like

#

no reason to come to a help channel just because something’s gray

#

just look it up or hover over it and it’ll probably say

#

i am pretty sure it’s just because it’s an unused field

steel swan
crisp steeple
#

well

#

you could add a metadata to the snowball with the player

#

then check entitydamageevent see if it’s a snowball and has the player metadata

#

i think getShooter works as well

river oracle
#

idk why but getShoiter is a funny method name

steel swan
crisp steeple
#

a fixedmetadatavalue i believe

river oracle
#

He's right

quaint mantle
#

Ayo! How would I get a object list with the configuration api?

things:
  - a: 1
    b: 2
  - a: 3
    b: 4

Is it getMapList?

#

Or does getConfigurationSection work somehow?

compact haven
#

you use getList

#

then cast it to a list of ConfigurationSection

quaint mantle
#

okay, thanks!

eternal oxide
#

setDropItems(false)

manic ice
#

Hey, I was making a command for downloading files in mc to the servers directory (weird reason dont ask why)
I got it working, but basically every website gets mad at its Java useragent and all the ways i could find to fix it used different methods to what i wanted, for example openConnection and not openStream, and i didn't really understand to how to actually implement it in my code, can someone explain how I would set a useragent in this scenario, or how to edit the code so I can set a useragent for it?

else if (args.length == 2){
            String fileurl = args[0];
            String filename = args[1];
            try (BufferedInputStream in = new BufferedInputStream(new URL(fileurl).openStream());
                 FileOutputStream fileOutputStream = new FileOutputStream(filename)) {
                byte[] dataBuffer = new byte[1024];
                int bytesRead;
                while ((bytesRead = in.read(dataBuffer, 0, 1024)) != -1) {
                    fileOutputStream.write(dataBuffer, 0, bytesRead);
                }
            } catch (IOException ex) {
                plr.sendMessage(Utils.chat("&aioexception"));
                ex.printStackTrace();
            }
        }
eternal oxide
#

a user agent is simply a text field in the header of your request

#

it tells the website what browser you are using

manic ice
#

yes i know, how do i specify it here though?
websites see that a useragent with just "Java/1.8.0_301" as its useragent is very weird so they just respond with a 403 forbidden

eternal oxide
# manic ice yes i know, how do i specify it here though? websites see that a useragent with ...
        try {
            URL url = new URL("http://sessionserver.mojang.com/session/minecraft/profile/2643e076-2434-4994-bd91-cb076d57f941?unsigned=false");
            
            HttpURLConnection conn = (HttpURLConnection) url.openConnection();
            conn.setReadTimeout(5000);
            conn.setInstanceFollowRedirects(true);
            conn.addRequestProperty("User-Agent", "Mozilla/4.0");
            conn.setDoOutput(false);

            try    (JsonReader reader = new JsonReader(new InputStreamReader(conn.getInputStream()))) {

                reader.setLenient(true);```
quiet ice
#

I don't see why people block stuff based on user agents, they are easily spoofable

eternal oxide
#

mainly because they have to send slightly different responses depending on the agent

quiet ice
#

Ah right, stupid interop strikes again

steel swan
#

i didnt need to at that time because the entity was ALWAYS a player

#

ok so if i remember corresctly, i was calling that fonction and inside i was checking if the role wasnt null. OR only players had role

#

so i didnt need to

opal juniper
#

has anyone ever used spark as a web thing

#

am trying to deliver static html

midnight shore
#

how can i detect when a player throws a fishing hook?

#

the projectilefireevent seems to be more for arrows

steel swan
#

oops my bad i admit lmao

midnight shore
#

yeah but this would call also when the hook catches something

steel swan
#

but now i check it hehe

midnight shore
#

i only need when they throw

steel swan
#

doesnt it create an entity? maybe check when it does

midnight shore
#

because i need to set the hook persistent data container

steel swan
#

and if its the right entity

midnight shore
#

in order to make a custom fish mechanic

#

i thought this would cast a lot of time when the bobber is active

radiant cedar
#

i just got back to making plugins and already have error setting up IntelliJ can anyone help me on this

hasty prawn
#

?ask

undone axleBOT
#

If you have a question, please just ask it. Don't look for staff or topic experts. Don't ask to ask or ask if people are awake or available. Just ask the question to the channel straight out, and wait patiently for a reply. Make sure you use the right channel regarding the topic of your question. Create a thread in case the channel is already in use!

radiant cedar
#

I get error: Cannot resolve symbol 'JavaPlugin'

I mean I guess my spiggot jar i put in the modules is not working properly, or is there something else that I'm missing. I just made a java project and put the spiggot jar in the dependencies but seems to not work.

hasty prawn
#

Send a screenshot of what you did

radiant cedar
#

cant sned pics here

hasty prawn
#

You need to verify

radiant cedar
fossil lintel
#

I'd advice creating a maven / gradle project and let one of those handle your dependencies

radiant cedar
#

oh

#

it hought i just had to put it in

#

the dependencies

#

i guess not

fossil lintel
#

I'm not really familiar on how IntelliJ handles manually managing dependencies like that

radiant cedar
#

am I allowed to @ people

#

on server

opal juniper
#

depends on who

radiant cedar
#

can I @ dessieYT

#

cus he was helping

#

until i went to verify

opal juniper
#

if you want, but he doesnt have to reply

radiant cedar
#

ye

#

@hasty prawn I verified can u check it out pls

#

what i did wrong

hasty prawn
# radiant cedar what i did wrong

My only guess would be that you added the wrong JAR.

2 other notes though, you should be using Java 17 for 1.18.2, not 1.8, and your scope for the dependency should be Provided, not Compile

radiant cedar
#

is java 18 ok

hasty prawn
#

Uh probably

eternal oxide
#

?bootstrap

undone axleBOT
#

Bootstrap Jar
The main spigot-1.18.jar is now a bootstrap jar which contains all libraries. You cannot directly depend on this jar. You should depend on Spigot/Spigot-API/target/spigot-api-1.18-R0.1-SNAPSHOT-shaded.jar, or the entire contents of the bundler directory from your server, or use a dependency manager such as Maven or Gradle to handle this automatically.

Please read the release notes for further information: https://www.spigotmc.org/threads/9-years-of-spigotmc-spigot-bungeecord-1-18-1-18-1-release.534760/#post-4305163

opal juniper
#

NOOOOO

#

EW

hasty prawn
#

Oh yeah no dont do that

radiant cedar
#

oh

hasty prawn
#

?buildtools

#

?bt

undone axleBOT
hasty prawn
#

use that

quaint mantle
#

congratulations

radiant cedar
#

lmao

#

i was just following tutorial chill

quaint mantle
#

what tutorial

#

imma go dislike it

radiant cedar
#

Ever wanted to know how to make Minecraft plugins for Java edition? In this new series we'll be starting with the basics and eventually diving into the advanced details of plugin development.

I've been developing plugins and running my own servers since 2013, so expect to see step-by-step tutorials with plain English explanations.

šŸŽ“ Take my FR...

ā–¶ Play video
#

here so u can dislike it

quaint mantle
#

done

radiant cedar
#

i got so much stuff

#

which one do i actually

#

put in as dependency

quaint mantle
#

you dont even have to run buildtools for this stuff lol

#

if you have maven

#

its like 6 lines of text

radiant cedar
#

dont have should i do maven

quaint mantle
#

yeah

#

are you using intellij?

radiant cedar
#

yes

#

is this how to do

cyan compass
#

How might i get an enchanted based on a string or something? Cause i did it with chat colours before but can i do something similar with enchants?

#

Cause i see getByKey

#

But i'm not sure what i do there

#

Ah ok so i can do minecraft:flame?

#

I don't have to use stupid ARROW_FIRE?

quaint mantle
#

whatever the key's name is

cyan compass
#

So i have to use ARROW_FIRE?

quaint mantle
#

idfk

cyan compass
#

very helpful....

#

and tbh a bit rude

quiet ice
#

?jd-s

undone axleBOT
cyan compass
#

Already looked at the docs. They aren't helpful

quiet ice
#

?stash

undone axleBOT
mellow edge
#

how to boil an egg?

quiet ice
#

Wha

#

ok

tardy delta
#

with a pan

mellow edge
quiet ice
#

the magic -1

quaint mantle
mellow edge
#

yeah

#

it is probably fake anyway...m

#

dont have it, I found it in memes in a server xD

#

do u actally think that's real xD

eternal oxide
#

The user brie does exist with that icon on stackoverflow, but no thread of that name

tepid ore
#

How do I use a particle without it flying away? I have a way to make shapes out of particles and am trying different particle effects. However, some particles (like flame) just fuqs off in mach 2.

#

I've seen stuff online where the particles stay where they are spawned

eternal oxide
#

It depends on teh particle, but you can spawn stationary particles using teh correct method/data

tepid ore
#

Then flame for example, how do I make it stay?

eternal oxide
#

show the code you are using to spawn it now

grim ice
#

whats the solution

#

I say 0

tepid ore
eternal oxide
#

are all yoru offsets zero?

tepid ore
#

Indeed

#

private double[] offset = new double[] { 0, 0, 0 };

#

Unmodified

eternal oxide
#

and yoru location has no vector?

tepid ore
#

Wat?

eternal oxide
#

set the direction on the location to a new Vector()

tepid ore
#

They still fuq off

eternal oxide
#

what is yrou data component?

tepid ore
#

null

eternal oxide
#

then you should have no movement in teh particles

bold solstice
#

?paste

undone axleBOT
eternal oxide
#

You could try using a 0.0d instead of null

tepid ore
eternal oxide
#

its a slightly different method but applies to speed

#

yes

bold solstice
#

Hey everyone, so ive made a gui that is suppose to save whatevers in it into a hashmap, Soo Ive tried to make an event that if the inventory clicked is the gui and the slots are not bla bla bla then it cancels the event(to make it so the player can only interact with specific slots) but it doesn't work :(. please help me
code: https://paste.md-5.net/fokedirali.cs

tepid ore
# eternal oxide its a slightly different method but applies to speed

This is what I get btw, ```java
System.out.println("Offset: " + Arrays.toString(offset));
System.out.println("Location: " + location);
System.out.println("Direction: " + location.getDirection());
System.out.println("Data: " + data);
player.spawnParticle(particle, location, count, offset[0], offset[1], offset[2], data);

[22:47:32] [Server thread/INFO]: Offset: [0.0, 0.0, 0.0]
[22:47:32] [Server thread/INFO]: Location: Location{world=CraftWorld{name=world},x=8.455905032744974,y=246.39496591633343,z=-4.231074700814557,pitch=90.0,yaw=161.8615}
[22:47:32] [Server thread/INFO]: Direction: -1.9062553689038664E-17,-1.0,-5.818950509763047E-17
[22:47:32] [Server thread/INFO]: Data: null```

#

I'm gonna try 0.0d

tepid ore
bold solstice
#

ur right

tepid ore
#

:>

#

Also, this does not work as you want it to e.getClickedInventory() == e.getInventory()

#

You can't do == or .equals with inventories

#

You need to either save an NBT tag in an item and read that to identify your inventory, or just compare the items one by one (would not recommend the last option)

tardy delta
#

best thing is to compare the holder and then check items or something

#

so make your own InventoryHolder

tepid ore
tepid ore
radiant cedar
tepid ore
#

It only accepts Void.class for it

radiant cedar
#

i set up everything

#

its very clean setup rn

#

but my friend is having a problem

#

whenever he opens this

#

tab for mavne

#

it just closes

#

dissapears

quaint mantle
#

lol

#

thats weird

quaint mantle
#

int double double double double double

tepid ore
#

I just get this :/ java.lang.IllegalArgumentException: data should be class java.lang.Void got class java.lang.Double

eternal oxide
#

it take a primative double, not a wrapped Double

tepid ore
#

I used this data = data == null ? 0.0d : data;

#

So it is a primitive

#

I guess it wrapped itself?

eternal oxide
#

I guess

tepid ore
#

When I used it

#

Yeah...

eternal oxide
#

try hard coding it as a test

tepid ore
#

You mean data = data == null ? (double) 0.0d : data;?

#

Or?

eternal oxide
#

just put 0.0d in teh spawn method call

tepid ore
#

Ahh, yeah. Hold on

#

I mean

#

Sort of

#

The particles don't fly away

#

However

#

They spawn like, 50 blocks away

#

From the location I enter

eternal oxide
#

thats where your location is set then

tepid ore
#

Hmm

#

I guess I've done something stupid in my code

#

Well, the double seems to have done the trick

#

Thank you!

eternal oxide
#

np

cyan compass
#

can meta.addEnchant do "unsafe" enchant levels?

grave lagoon
#

how would i create blocks infront of the player with a command

cyan compass
cyan compass
grave lagoon
#

idk how to make the blocks though or make it into a shape

hybrid spoke
grave lagoon
#

no no like

#

spawn in the blokcs

#

like actraulyl crearte them

hybrid spoke
#

blocks are always there šŸ¤”

grave lagoon
#

im trying to make a funny command where if i do /penis it summons a bedrcok penis ik its weird but my friend wanted it

hybrid spoke
#

well, then listen for that command, get the shape and set the blocks

grave lagoon
#

how do i get the shape tho

hybrid spoke
#

either use some complicated unnecessary math

#

or just go with a midpoint and blockfaces

eternal oxide
#

or Schematics

hybrid spoke
#

or that

crisp steeple
#

i mean schematics probably aren’t worth it for like like 4-5 blocks

grave lagoon
#

i found this

crisp steeple
#

depends how big you’re trying to make it

grave lagoon
#

not anything special

#

5 blocks

grave lagoon
#

or this

#

?

ivory flume
#

thats the midpoint of 1 block

hybrid spoke
#

yes but you dont have to deal with offsets manually

#

you can actually just get the opposite block to face X

crisp steeple
#

get players direction -> add it to their location -> use the new location as the base point for your shape

#

i’m not sure what happens if you try to get a block at a non-whole number so you might need to round if it doesn’t already

hybrid spoke
#

0~1 = the same block

crisp steeple
#

yeah i figured

grave lagoon
crisp steeple
#

Player#getLocation, World#getBlockAt, Location#getDirection should be about all you need

grave lagoon
crisp steeple
#

you don’t place blocks

#

you set their type

grave lagoon
#

what if they dont exist

crisp steeple
#

they do

grave lagoon
#

its placing it like this:

#

oghhhh

#

so lijke

#

air

#

exists

crisp steeple
#

yes

grave lagoon
#

ogg

#

so

#

how do i

#

set their type

crisp steeple
#

World#getBlockAt(location).setType(Material.BEDROCK)

grave lagoon
#

thjank you

#

:d

#

:D

earnest forum
#

there's an instance of a block for every location in the world

#

the ones that don't have anything are just of type AIR

#

that's why you can't create a new block

grave lagoon
crisp steeple
#

in your case, the shape is small enough to where you can probably just hardcode the values on

#

ex: Location pos1 = new Location(world, loc.getX() + 1, loc.getY() + 2, loc.getZ() + 3)

#

etc

grave lagoon
#

alr

#

thx

crisp steeple
#

np

echo basalt
#

and depends on the axis too

dense geyser
#

I have 2 plugins, if Plugin B depends on a utility class in Plugin A, and then Plugin A is disabled/unloaded, is Plugin B still able to access that utility class in Plugin A or has all of the classes in Plugin A been removed on unload?

wary harness
#

IS END_PORTAL_FRAME tile entity or not

crisp steeple
#

yes

wary harness
#

got this error

#
12.05 22:54:52 [Server] INFO at net.beasteria.beasteriautilities.utils.nbtapi.NBTReflectionUtil.getTileEntityNBTTagCompound(NBTReflectionUtil.java:247) ~[BeasteriaUtilities.jar:?]
12.05 22:54:52 [Server] INFO at net.beasteria.beasteriautilities.utils.nbtapi.NBTTileEntity.getCompound(NBTTileEntity.java:36) ~[BeasteriaUtilities.jar:?]
12.05 22:54:52 [Server] INFO at net.beasteria.beasteriautilities.utils.nbtapi.NBTReflectionUtil.getData(NBTReflectionUtil.java:624) ~[BeasteriaUtilities.jar:?]
12.05 22:54:52 [Server] INFO at net.beasteria.beasteriautilities.utils.nbtapi.NBTCompound.hasKey(NBTCompound.java:513) ~[BeasteriaUtilities.jar:?]
12.05 22:54:52 [Server] INFO at net.beasteria.beasteriautilities.utils.nbtapi.NBTTileEntity.getPersistentDataContainer(NBTTileEntity.java:53) ~[BeasteriaUtilities.jar:?]
12.05 22:54:52 [Server] INFO at net.beasteria.beasteriautilities.listeners.TeleportPadsListener.onPlace(TeleportPadsListener.java:56) ~[BeasteriaUtilities.jar:?]
12.05 22:54:52 [Server] INFO at com.destroystokyo.paper.event.executor.asm.generated.GeneratedEventExecutor1655.execute(Unknown Source) ~[?:?]
12.05 22:54:52 [Server] INFO at org.bukkit.plugin.EventExecutor.lambda$create$1(EventExecutor.java:75) ~[paper-api-1.18.2-R0.1-SNAPSHOT.jar:?]
12.05 22:54:52 [Server] INFO at co.aikar.timings.TimedEventExecutor.execute(TimedEventExecutor.java:80) ~[paper-api-1.18.2-R0.1-SNAPSHOT.jar:git-Paper-317]
12.05 22:54:52 [Server] INFO at org.bukkit.plugin.RegisteredListener.callEvent(RegisteredListener.java:70) ~[paper-api-1.18.2-R0.1-SNAPSHOT.jar:?]
12.05 22:54:52 [Server] INFO at org.bukkit.plugin.SimplePluginManager.callEvent(SimplePluginManager.java:669) ~[paper-api-1.18.2-R0.1-SNAPSHOT.jar:?]```
crisp steeple
#

or wait

wary harness
#

line 56 throws error

crisp steeple
#

actually

#

i think im thinking of end portal

#

i dont think end portal FRAME is actually a tile entity

wary harness
#

Any one else can confirm this

crisp steeple
#

end portal frame isnt on here

worldly ingot
#

Yeah, it's a stated block

#

One with the eye of ender and one without

summer scroll
quasi stratus
#

How would one go about spawning in an entity with custom NBT data?

ivory flume
crisp steeple
#

i was looking at tile entities a while ago and i thought i remembered seeing end portal frame

#

but it turned out it was actually just end portal which is a tile entity for the particles for some reason

wind tulip
#

Does anyone know how to send a custom advancement like this?

quaint mantle
wind tulip
#

thanks

upper tendon
#

There a way to make a command that cancels all tasks of a certain type?

crisp steeple
#

type as in?

#

like the actual type of the object?

upper tendon
#

Yeah, in my case if have a spherical border that I initiate with a command, and then use the timer scheduler thing to execute a display() and changesize() method within the border object I created with the command.

Currently the only way I have to cancel the border is by letting it shrink to a radius of 0 then it'll cancel, but is there a way I could implement a command which just cancels these timers?

#

srry for the essay lol

valid bay
#

hi, does anyone know if there is a way to check an inventory for a specific item/stack (like a recipe basically) and if so remove it? I've managed to do this except it has to be the specific stack. Ie. 20 dirt wont be removed from a 64 stack but so it has to be exactly 20.

crisp steeple
upper tendon
dusk flicker
#

var

upper tendon
crisp steeple
upper tendon
#

should I just look into fields and maps in java

crisp steeple
#

probably

round agate
#

iirc each scheduler have their id
obtain the id
then cancel it

dusk flicker
#

I feel like if you arent 100% sure of fields and maps in Java you should really go over more of

#

?learnjava

undone axleBOT
dusk flicker
#

pretty big part of Java

valid bay
# upper tendon if itemstack.getAmount() == 20

how would that fit in here? I'm essentially checking the players inventory to whether it contains whatever swordstack is

if (e.getInventory().contains(swordstack)) {
player.getInventory().removeItem(swordstack);

upper tendon
#

o

wind tulip
upper tendon
upper tendon
round agate
# valid bay how would that fit in here? I'm essentially checking the players inventory to wh...
int mustHaveThisAmount = 20;
ItemStack stackIWantToCheck = new ItemStack(Material.DIAMOND_SWORD);
Inventory thePlayerInventory = player.getInventory();
for(int slot = 0; slot < thePlayerInventory.getSize(); ++slot) {
   ItemStack currentItem = thePlayerInventory().getItem(slot);
   if(currentItem.getMaterial() == stackIWantToCheck.getMaterial()
      && currentItem.getAmount == mustHaveThisAmount
   ) {
      // remove the item here by inventory
      // or set the currentItem type to AIR
   }
}
dusk flicker
#

?spoonfeed

#

that not exist anymore

#

welp

round agate
#

doesn't matter

dusk flicker
#

dont spoonfeed

#

?spoon

undone axleBOT
#

Spoonfeed a newbie for a day and they'll come back with more questions. Teach them to find their own answers and you'll both be better off: you won't get stuck answering the easy questions and they'll be much more productive than before.

dusk flicker
#

thats it

round agate
#

cool

valid bay
round agate
#

good luck!

valid bay
# dusk flicker dont spoonfeed

ig it is spoonfeeding but that is how I learn personally. Seeing this example will help me for future interpretations aswell. Also, this code isn't made for 1.14 spigot so it doesn't function so there is still some figuring out to do.

safe notch
dusk flicker
#

dear god you are running 1.14

#

isnt that legit the worst performing version of minecraft

valid bay
#

well- 1.15.2

#

but it uses the same as 1.14 doesnt it

dusk flicker
#

the code is always different in the backend, just generally the api implementation methods dont change

vocal cloud
#

1.13 imo is the worst performing

valid bay
vocal cloud
#

Is this a learn java moment or a learn MC moment? Lol

valid bay
#

not the latter I hope šŸ™ˆ

#

anyone know the alternative to getMaterial() for 1.14? 😩

#

oh wait getmaterial DOES work for 1.14. why do I see it as depreciated

worldly ingot
#

It never was deprecated as far as I'm aware.

#

Though you should be using matchMaterial() anyways

valid bay
#

not sure what matchMaterial does but probably worth a try bc

                    if (currentItem.getType() == Material.DIRT && currentItem.getAmount() == mustHaveThisAmount) {

throws a hissy fit error

worldly ingot
#

oh, you're doing a different thing

#

No reason for that not to work unless you're importing the wrong Material

valid bay
#

I dont think the for loop is working correctly

#

bc it will only count if it is a continuous line of dirt blocks

#

player.sendMessage(String.valueOf(slot)); i used this to test

#

and yeah idk how weird

#

It only counts if the slot is occupied by something

worldly ingot
#

Do you return anywhere?

#

Well, I should just ask for a snippet of the code you're using lol

ivory flume
#

can YAML configuration files handle record serialization and deserialization

#

I wanna serialize a list of data classes that are records into my config

#

and then get them back

worldly ingot
#

If it implements ConfigurationSerializable, I don't see why not. You're the one implementing the serialization/deserialization

ivory flume
#

oh

#

thanks

quaint mantle
#
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.OfflinePlayer;
import org.bukkit.Sound;
import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import org.bukkit.inventory.PlayerInventory;

public class WipeCommand implements CommandExecutor {
    private boolean success;

    @Override
    public boolean onCommand(CommandSender sender, Command command, String s, String[] args) {
        Player player = (Player) sender;
        if (s.equalsIgnoreCase("wipe")) {
            if (player.hasPermission("wipe.player")) {
                if (args.length == 0) {
                    player.sendMessage(ChatColor.RED + "Correct usage: /wipe <player>");
                } else {
                    PlayerInventory inventory = player.getInventory();
                    inventory.clear();
                }
            }
        }
        return true;
    }
}
#

is this correct?

waxen plinth
#

Get more specific

#

I do see problems with it

#

Like the unchecked cast to player

#

Lots of nested if statements instead of guard clauses

dark arrow
#

Why i am unable to use the pathfinderavoid target and pathfinderavoidplayer in villager class?(nms package)

sharp flare
#

nms changes on every major minecraft update

#

so you gotta handle those

earnest forum
#

after 1.17 it's different tho

#

the package doesn't have numbers anymore

trail oriole
#

Any way I could make a gui specific to a player?

#

I have a gui that the player can change, but if two players open it at the same time, they can change each other's

earnest forum
#

don't open the same inventory instance to both players

trail oriole
#

How would I do that?

earnest forum
#

don't open the same instance to both players lol

#

you have 1 inventory instance

#

for 1 player

#

1 inventory variable

#

per

trail oriole
#

Yeah but then how would I make my listener to work for each different inventory variables?

earnest forum
#

what's your listener

#

send the code

#

?paste

undone axleBOT
trail oriole
#

I can't send it sorry

#

But I have an OpenInventoryEvent

#

That checks the name of the listener

earnest forum
#

why not

#

how else do you want me to help you lol

long river
#

i have question how cna i do same thing? (dont mind the client plz)

#

not same but similar thing

quiet ice
#

You'd need to either fork the Server or intercept & modify SLPs

long river
#

Gotchu thanks <3

grim ice
#

no one will go through that pain

round agate
trail oriole
#

Alright thanks

long river
drowsy helm
#

can you show your code

long river
#

and for MOTD im using AdvancedNMOTD

chrome beacon
#

It does that to show the red X over ping

#

Disable that setting

sacred prairie
#

hi, is there a way to remove blockbreakanimation cracks

#

what i mean is that if a block is damaged then remove the damage

chrome beacon
#

You can try sending the animation packet

#

And keep reseting the animation state

sacred prairie
#

i send this package and try with this to remove it PacketPlayOutBlockBreakAnimation animation = new PacketPlayOutBlockBreakAnimation(1,new BlockPosition(block.getX(), block.getY(), block.getZ()), 0);

chrome beacon
#

It might or might not work since it is handled client side

sacred prairie
#

(and ofc send the package)

#

but there always remains a little damage

#

this bit is always remaining

#

nvm i just have to set the value to 10

#

PacketPlayOutBlockBreakAnimation animation = new PacketPlayOutBlockBreakAnimation(1,new BlockPosition(block.getX(), block.getY(), block.getZ()), 10);

#

still thank you for your time

crude loom
#

How do I cast an entity to an armorstand?

sacred prairie
tender shard
sacred prairie
#

ye

tender shard
#
ArmorStand armorStand = (ArmorStand) myEntity;
sacred prairie
#

just ad (ArmorStand)

tender shard
sacred prairie
#

ye

crude loom
sacred prairie
#

nope, its very simple

crude loom
#

Thanks :D

echo basalt
#

I'm surprised you're seeing the stage 1 crack with an id of 0

sacred prairie
#

0-9

#

PacketPlayOutBlockBreakAnimation animation = new PacketPlayOutBlockBreakAnimation(1,new BlockPosition(block.getX(), block.getY(), block.getZ()), 10); and this is my final code

echo basalt
#

Or that

sacred prairie
#

i just set to 10

echo basalt
#

Haven't touched that packet in years

sacred prairie
#

hapens

earnest forum
#

i dont think theres a 10 stage

#

its 0 to 9 no?

sacred prairie
#

this is why i am setting it to 10

#

because its reset on eny other number

#

and i wann reset it

earnest forum
#

so what are you trying to do

sacred prairie
#

ye

earnest forum
#

you want no block damage?

#

set it to -1

sacred prairie
#

or 10 or 100

#

or 69

#

every number out of 0-9

earnest forum
#

whats your problem

sacred prairie
#

no problem enymorwe

earnest forum
#

ok

#

you know u can just use spigot api now

#

for block damage

sacred prairie
#

ye, to late

#

naw i use packages

earnest forum
sacred prairie
#

now

earnest forum
#

method of player

sacred prairie
#

didnt saw that lol

earnest forum
#

its 0.0 to 1.0

summer scroll
#

Can you make armor stand visible to only players without packets?

earnest forum
#

specific players?

summer scroll
#

Yes I mean only specific players.

earnest forum
#

not really no

summer scroll
#

okay, thanks

tender shard
#

you'll have to hide it from everyone except for the player that should see it

#

it was added in 1.18.0

cerulean jasper
#

bump. here's code snippet for context. This works fine on local windows pc, but not on my Ubuntu VPS.

        String pythonFilePath = "plugins/Craft/end_game_data/algo/updated_classifier.py";

ProcessBuilder pb = new ProcessBuilder()
                .command("py", pythonFilePath, inputFilePath);

  Process p = pb.start();

Gives me "invalid directory or file" thingy error on ubuntu only.

tender shard
tender shard
cerulean jasper
#

Alright. is there a way to get current Spigot .jar location?

tender shard
#

there's an easy workaround

#

one sec

#

@cerulean jasper Bukkit.getWorldContainer()

#

that returns the directory where all the worlds are located

#

in 99.99999% of cases that's also where the spigot .jar is located

cerulean jasper
#

Great. will check it out now

tender shard
#

there are also some other alternative ways but I guess that's by far the easiest and as said, it's probably 99.9999% reliable šŸ˜„

#

e.g. you could get your plugin's .jar file and then just go one directory up

#

For example

myPlugin.getDataFolder().getParentFile().getParentFile()
cerulean jasper
#

And also is it possible to check current servers OS? (if its Ubuntu/Linux or Windows)

#

because on windows my current setup seems to just work šŸ¤”

cerulean jasper
#

thanks

#

myPlugin.getDataFolder() is the folder that is created in /plugins, right?

tender shard
cerulean jasper
#

Nice

tender shard
#

so if you get the parent file twice, it returns the actual server location

#

to get the OS:

#
System.getProperty("os.name")
cerulean jasper
#

šŸ‘

tender shard
#

btw

#

spigot includes apache commons

#

so you can also do stuff like this:

#
boolean isWindows = SystemUtils.IS_OS_WINDOWS;
#

they even have fields for every windwos version lol

cerulean jasper
#

ah great

#

yeah thats better

#

Does Paper inherit this? if you know

tender shard
#

yes

cerulean jasper
#

cool

tender shard
#

paper includes everything that spigot includes

#

oh wait @cerulean jasper

#

what's your spigot version?

cerulean jasper
#

Latest paper, I think

#

1.18.2

tender shard
#

oh okay, no problem then

cerulean jasper
#

alrighty

tender shard
#

iirc older versions like 1.8 include an older version of apache commons

cerulean jasper
#

Aha

tender shard
#

but on 1.16+ this definitely works

summer scroll
tender shard
quaint mantle
#

@tender shard LIGHT MODE

tender shard
#

I wonder why noone mocks md_5 or eclipse users for using "light mode"

#

eclipse users are famous?!

#

I doubt that lol

vocal cloud
#

Eclipse users are already getting mocked for eclipse. No need to twist the knife

tender shard
summer scroll
#

Will shading something in maven will copy all the shaded files but with different packages name?

civic dagger
#

how can i set target for a specific compass?

tender shard
#

it copies the classes with their original package name

#

but you can relocate them, and then it will indeed change the package names

#

it includes a part in the maven-shade-plugin to relocate the classes

#

if you don't add it, then all my lib's method would end up in com.jeff_media.morepersistentdatatypes

summer scroll
#

Ah yes, I meant relocating it.

summer scroll
tender shard
#

yep you have to add that part manually

summer scroll
#

I have add that

tender shard
#
            <configuration>
                <relocations>
                    <relocation>
                        <pattern>com.jeff_media.morepersistentdatatypes</pattern>
                        <shadedPattern>YOUR.PACKAGE.morepersistentdatatypes</shadedPattern>
                    </relocation>
                </relocations>
            </configuration>
summer scroll
tender shard
#

okay so your library is inside "me.aglerr.mclibs" right?

summer scroll
#

yes

tender shard
#

then it should get relocated to "com.muhammaddaffa...." when you run "mvn package"

summer scroll
summer scroll
#

It only change on compile

tender shard
#

no, in the IDE you see the "original" package name

#

it will only change it once you actually compile your stuff

summer scroll
#

Ah okay, for some reason it didn't got relocated and it throws ClassNotFoundException error.

#

Oh, one sec.

tender shard
#

the relocation thing will always, ever, only change the package names of the shaded classes when you actually compile stuff

#

in your IDE, it will always show you the original class names

#

everything else would also make no sense tbh

tender shard
undone axleBOT
summer scroll
#

I think it's because I use the libs on a modular project.

#

So I have a core module, basically it contains all of the code and another module for the cross-version support that depend on the core module , the core module has relocated the libs but not on the another module part.

quaint mantle
#

what's the easiest way to implement action bar in 1.8 spigot?

tender shard
quaint mantle
#

I would if performance was equal to 1.8

river oracle
#

Upgrade ur pc

#

If u can't run 1.18 what u doing wrong :P

#

Is ur using a 20 year old pc

quaint mantle
#

For large servers newer versions are not optimised enough to run smoothly with large player counts and advanced gamemodes

chrome beacon
#

Hm actionbar requires packets in 1.8 iirc

quaint mantle
#

Oh right PacketPlayOutChat, thank you

#

Found it šŸ™‚

tender shard
summer scroll
#

Um, how can I make armor stand follow player's cursor location and it should maintain the distance. This is my attempt and the distance is not maintained when player is looking up or down.

Vector vector = data.player().getEyeLocation().getDirection().multiply(3);
Location location = data.player().getLocation().add(vector.getX(), 0, vector.getZ());
tender shard
#

obviously not since you use 0 for the height

#

use vector.getY() instead of 0

summer scroll
#

Since it's multiplied, I thought the Y will be multiplied too so when I look straight the armor stand will be up several blocks.

summer scroll
echo basalt
#

I wonder if getDirection is normalized by default

glossy venture
#

i hope

#

you cant have a direction of 2 forward

#

so it wouldnt really make sense

tender shard
echo basalt
#

it isn't strictly normalized but the math seems to give a consistent result

faint harbor
#

Is there a way to save data from a ItemStack to a projectile fired from a dispenser?

#

I have custom arrows identified by lore, and am applying metadata to the projectiles using the EntityShootBowEvent

#

but the BlockDispenseEvent doesnt seem to provide the entity created so I cannot do this for a dispenser

#

That's a good idea, I'll play around with the two. Thanks!

grim ice
#

how can you speed up

#

a fishing rod

#

the casting part

#

not the part when ur waiting for fish. the part when u cast it

silver plover
#

Hello, anyone have ever used AsyncWorldEdit API?

midnight shore
#

how can i detect for when a player switches their offhand itemstack?

#

exactly!

arctic moth
#

what is the event for when an entity like a creeper or primedtnt starts its fuse

#

explosionprimeevent doesnt work

#

in the nms GameEvent there's PRIME_FUSE but its nms and probably will break smth

#

oh wait its not nms

crimson terrace
#

Hey, how do I make this into a clickable chat message for the player it was sent to? Not sure where to go from here...

#

oh, didnt realize sendMessage could take in a component

#

thanks

arctic moth
#

how do i put colors in permission-message of a command

#

the color character doesnt work

#

it like hides the character but applies no color

upper vale
#

Section separator or amperand?

arctic moth
#

it removes the characters for the color but adds no color

grim ice
#

Just use & and translate

arctic moth
#

ok

upper vale
#

iirc it doesn’t support colors

#

with section separator at least

#

so yeah better to handle permission check and message yourself

grim ice
#

ChatColor.translateAlternativeColorCodes('&', "&aHello");

arctic moth
#

lol

tepid ore
#

Demeng

#

How did you do the verification for your grantX?

#

I don't want code, just HOW you went about doing it

arctic moth
#

are villagers supposed to farm pumpkins?

#

i swear i heard a pumpkin break

upper vale
upper vale
tepid ore
#

Your plugins. To prevent piracy

#

I read on spigot that you are not allowed to use external databases

quiet ice
#

You cannot really do any anti-piracy measures

tepid ore
#

Why tho...

upper vale
#

I have my custom licensing servers

tepid ore
#

Is that allowed?

upper vale
#

It uses Spigot’s anti-piracy placeholders

quiet ice
#

The best thing you can do is obfuscate the jar, but since you must be able to run without internet access you can just iptable block the server

arctic moth
#

i know this sounds dumb, but is there a way to make something final after modifying it?

upper vale
#

^

quiet ice
arctic moth
quiet ice
#

And let's face it: Cracking java applications is incredibly easy

#

Even if obfuscated

tepid ore
#

Wait, so I could block Demengs verification server and use however many IPs I want for my plugin copy?

tepid ore
#

Is that what you are saying

upper vale
#

You can only delay piracy

quiet ice
#

Yeah, in theory that is

upper vale
#

Can’t prevent

tepid ore
#

Prevent -> Make it harder

worldly ingot
#

fwiw, those 12 year olds that received the plugin would not have paid for it at all

mighty pier
#

can i do like a while loop and execute the code every 1 second?

upper vale
#

Honestly it’s been a while since I’ve cared about anti piracy tbh

upper vale
mighty pier
#

i mean like

#

while something is true

upper vale
tepid ore
#

And just exit the runnable once the statement is false

upper vale
#

Cancel the task when the value turns false, or just add an if statement at the start of each execution

worldly ingot
#

runTaskTimer, but yes

mighty pier
#

k

tepid ore
#

Yeah, that. Sry ^

worldly ingot
#

If you intend on cancelling the task you'll have to either use the consumer, or make use of a BukkitRunnable

#
Bukkit.getScheduler().runTaskTimer(plugin, task -> {
    task.cancel(); // This will cancel the task
}, 0, 20);```
#

(20 being the interval in ticks)

tepid ore
daring lark
#
    public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
        if(sender instanceof Player) {
            Player player = (Player) sender;
            if("shop".equalsIgnoreCase(command.getName())) {
                if(args.length == 0) {
                    player.sendMessage(ChatColor.GREEN + "Lista komend:\n/shop create [ilość] [cena] [s/b] [admin]\n/shop remove");
                    return true;
                }
                if(Material.CHEST != player.getTargetBlock(null, 5).getType()) {
                    player.sendMessage(ChatColor.GREEN + "Musisz patrzeć się na skrzynkę na której chcesz założyć sklep.");
                    return true;
                }
                switch (args[0]) {
                    case "create":
                        if(args[1] == null) {
                            player.sendMessage(ChatColor.GREEN + "Podaj ilość.");
                            return true;
                        }
                        if(args[2] == null) {
                            player.sendMessage(ChatColor.GREEN + "Podaj cenę.");
                            return true;
                        }
                        if(args[3] == null) {
                            player.sendMessage(ChatColor.GREEN + "Podaj typ sklepu.");
                            return true;
                        }

                }
            }

        }
        return true;
    }```

why am i getting null error in this code when i type /shop create?
eternal oxide
#

test args.length not null

daring lark
upper vale
#

Why would args.length be null

daring lark
eternal oxide
#

thats not what I said

#

he is testing if each arg is null thinking if there is no arg it will be null

#

thats not how arrays work

upper vale
#

*test args.length size

daring lark
eternal oxide
#

no

#

he means, and I mean, test its SIZE

daring lark
#
                            player.sendMessage(ChatColor.GREEN + "Podaj ilość.");
                            return true;
                        }``` like this?
tardy delta
#

args.length

eternal oxide
#

your code will throw an IndexOutOfBounds exception

tardy delta
#

if you try to access the second element of an empty array it will indeed do ^^

eternal oxide
daring lark
#

i'm still getting that error

eternal oxide
#

show the full error

#

?paste

undone axleBOT
arctic moth
#

worldgen plugin ???!?!?!?!??!?!?

daring lark
#

yes

lavish folio
#

hi, i have a problem: org.bikkit.craftbukkit.v1_12_R1.block.CraftBlockState cannot be cast to org.bukkit.block.Banner with code:
Banner b = (Banner) Settings.redFlag.getWorld().getBlockAt(Settings.blueFlag).getState();

tardy delta
#

the block isnt a banner i guess?

lavish folio
#

yes blockstate and .getstate returns block state

tardy delta
#

wdym they return block state?

#

are you checking if the block is a banner?

civic dagger
#

how can i compare 2 item metas which one of them is compassmeta but ignore its meta? like if i do compassmeta.setlodestone it changes its itemmeta so it no longer will return true if i compare it to a copy of its past(before using .setlodestone)
also please ignore the trash explanation lol

eternal oxide
#

FB is saying there is likely no banner at teh location of your Settings.blueFlag

lavish folio
agile marsh
#

@civic dagger trying to figure out what you're saying. if you mutate an item it will not be equivalent to the item it was before mutation

quaint mantle
#

anyone have a resource for glowing specific entities for specific players

#

i had one ages ago

#

but lost it

tardy delta
daring lark
#

how could i check if argument in command is null?

tepid ore
#

if(x < args.length)

eternal oxide
#

an argument in a command will NEVER be null

daring lark
agile marsh
#

@tepid ore isnt that a nullpointer

#

lmao

tepid ore
#

Nvm

#

That

tardy delta
#

i guess hes talking about whether or not an argument is given

tepid ore
#

me dum dum

agile marsh
#

big methinks moment

lavish folio
waxen plinth
#

On everything

tepid ore
agile marsh
#

yea basically its args.length

waxen plinth
#

What error are you getting

eternal oxide
waxen plinth
#

What behavior do you want

daring lark
lavish folio
rough drift
undone axleBOT
rough drift
#

go on

tardy delta
rough drift
#

send it there

tepid ore
rough drift
#

nobody will hurt you

waxen plinth
agile marsh
#

@daring lark not a null exception, a null pointer exception

waxen plinth
#

Show us the error

agile marsh
#

should figure out what that means

waxen plinth
#

Show us the FULL stack trace

waxen plinth
#

And the full class where that error occurs

rough drift
#

its abbreviated

waxen plinth
#

Put it in a paste link

rough drift
#

NPE is even shorter

lavish folio
waxen plinth
#

Otherwise I can't help you

agile marsh
#

yea but saying null exception indicates u dont actually understand whats going on

rough drift
#

dude

#

its just shortening

#

the

#

error

#

name

#

now

#

shut

#

and

#

send

#

us

#

the

#

error

waxen plinth
#

Ike

rough drift
#

what

eternal oxide
#

?paste

undone axleBOT
waxen plinth
#

That's obnoxious

rough drift
#

Sorry

waxen plinth
#

It's alright it just floods chat

rough drift
#

Been annoyed at kids asking for help in my discord, so I am still annoyed

waxen plinth
#

Yeah I get it

rough drift
#

again, sorry

agile marsh
#

i was attempting to teach the man how arrays work in a computer and why he was getting an exception

agile marsh
#

wasn't trying to be a dick

#

sry

rough drift
#

oh wait

#

you are the wrong person

waxen plinth
#

People act like help is a thing they just get, not a collaborative process with the people trying to help them

rough drift
#

sorry to you too

eternal oxide
# daring lark null

I already told you how to check the args length, and I asked you for the full error. Either give us what we need to help you or stop asking

agile marsh
#

white name discrimination lmao

#

i think he figured it out

rough drift
#

nah I am just too tired to distinguish

lavish folio
# tardy delta what

i place banner in line 1 but banner instant break ( i place banner to air and block under banner is air )

civic dagger
waxen plinth
#

Well

#

You could make a method for it

tardy delta
undone axleBOT
civic dagger
#

wdym by skip it

waxen plinth
#

Write a method that sets the lodestone location of 2 compasses to null, then compares

civic dagger
#

BRUH WHY I DIDNT THINK OF IT

lavish folio
waxen plinth
#

BlockState#update? Block#setType?

#

Block#setBlockData?

tardy delta
#

why getData?

#

isnt getState enough to cast it to a banner?

waxen plinth
#

Ok you're doing setType

eternal oxide
waxen plinth
#

Call update(true, false) instead of just update()

agile marsh
#

could override .equals

#

I'm pretty sure

lavish folio
agile marsh
#

@civic dagger

waxen plinth
#

You imported the wrong Banner

agile marsh
#

might want to ask someone more familiar w spigot tho

waxen plinth
#

Or it's not a banner

agile marsh
#

but if you want .equals to only look at specific aspects of an item you have to override the function

#

when i say item i mean an object

eternal oxide
#

he didn;t call update() before getting a new state, so he's still getting the old block the second time

agile marsh
#

to clarify

civic dagger
#

i dont think i need to go that far

glass mauve
#

is there a different way of splitting a map image to 7x4 maps than using BufferedImage.getSubImage(...)

rough drift
#

it will draw only within that clip

civic dagger
#

@agile marsh just get a copy from both of them and then .setlodestone(null)

agile marsh
#

they're just never going to be equal to eachother

civic dagger
#

why?

agile marsh
#

bc you've changed one

civic dagger
#

well im changing both of them to null now

#

now they're same

agile marsh
#

i mean changing both to null and then comparing should send a null pointer?

#

I think?

#

but yea i mean if they're both null they're obv the same

waxen plinth
#

No

civic dagger
#

no the objects it self

waxen plinth
#

You're setting the lodestone location to null

#

Then comparing the items

civic dagger
#

yea

waxen plinth
#

That will work

agile marsh
#

@waxen plinth ty not very versed in spigot

civic dagger
#

but first i need to get a copy from both of them because setting to null will just break them in-game

eternal oxide
civic dagger
#

shouldnt be that hard

waxen plinth
#

Need to make sure to do that first

eternal oxide
#

yep I missed the setType on teh state

#

set type before

waxen plinth
#

Setting type on BlockState and then casting won't work either

#

You have to set it on the block before getting the BlockState

#

An object cannot change its type

eternal oxide
#

if you are working on a State it should work

waxen plinth
#
BlockState s;
s.setType(Material.BANNER);
Banner b = (Banner) s;```
#

This will not work

eternal oxide
#

a State is a snapshot so long as you keep that state it will work

waxen plinth
#

That's not the point

#

The point is that a BlockState is an object like any other

#

It has a type, and that type cannot change

#

A type in java

#

The class it is an instance of

#

Changing the material type will not change the class of the object

#

You have to change the material of the block and THEN get and cast the BlockState to Banner

eternal oxide
#

yep

tardy delta
#

Block#setState or something?

waxen plinth
#

No

#

BlockState#update

eternal oxide
#

won;t work as it updates at th eend of the tick

tardy delta
#

ah

waxen plinth
#

And ensure that you pass (true, false) to update

#

That will prevent physics checks, allowing you to set a banner midair

lavish folio
#

thanks

tepid ore
#

Which one of these is called first?

{

}

static {

}```
eternal night
#

the static block is evaluated on class load

tepid ore
#

Frick

tardy delta
#

never used normal {} lol

#

whats the difference with a constructor?

tepid ore
#

{} is called no matter the constructor iirc

#

So none really

eternal oxide
#

yes, static is at class load, {} is at class instantiation

eternal night
#

those blocks are called before constructor btw

tepid ore
#

Yeah and that ^

quaint mantle
#

anyone have a packet guide for 1.18.2

echo basalt
#

any recent packet guide will do

#

ProtocolLib or nms?

quaint mantle
#

i legit cant find a single one

#

uhh

#

protocolib is doing some weird error

#

i just wanna send a glowing packet to one player

echo basalt
#

just use my packet guide, which does cross-reference checks and all

quaint mantle
#

happy 2 learn off smth

#

ok

#

how do i find it

#

i dont have forums acc do i need one

echo basalt
#

For glowing, you want to send entity metadata

quaint mantle
#

yeah

#
        PacketPlayOutEntityEffect eff = new PacketPlayOutEntityEffect(e.getPlayer().getEntityId(), new MobEffect(MobEffectList.fromId(24), 1000, 1, true, true));
        ((CraftPlayer) e.getPlayer()).getHandle().playerConnection.sendPacket(eff);
#

like this is like

echo basalt
quaint mantle
#

before 1.18

#

whats the diff

#

ty

echo basalt
quaint mantle
#

oh

#

is there a diff way

echo basalt
#

entity metadata

lavish folio
#
Block block = Settings.greenFlag.getBlock();
            block.setType(Material.BANNER);
            BlockState state = block.getState();
            Banner banner = (Banner) state;
            banner.setBaseColor(DyeColor.GREEN);
            banner.update(true, false);```

org.bikkit.craftbukkit.v1_12_R1.block.CraftBlockState cannot be cast to org.bukkit.block.Banner how fix this
echo basalt
#

same packet that sends info like the entity name, isOnFire

echo basalt
quaint mantle
#

IS UR Guide for spawning players

tepid ore
tardy delta
#

dont you have to update it before casting it?

echo basalt
tardy delta
#

elgarl did

lavish folio
quaint mantle