#help-development

1 messages · Page 376 of 1

quaint mantle
#

I'm still confused on why the for loop is not looping still ```java
public Matrix filter(Matrix image) {
int rows = image.rows - kernel.rows + 1;
int columns = image.columns - kernel.columns + 1;
double outputImage[][] = new double[rows][columns];

    for (int r = 0; r < rows; r++) {
        for (int c = 0; c < columns; c++) {
            Matrix submatrix = image.subMatrix(r, c, kernel.rows, kernel.columns);
            Matrix result = submatrix.mult(kernel);
            outputImage[r][c] =    result.sum();
        }

    }
    return new Matrix(outputImage);
}
rapid topaz
#

how do i recompile jar file

river oracle
#

If you need a plugin modified or edited I'm sure services will help you

#

?services

undone axleBOT
rapid topaz
#

oh

#

ok thanks

storm scaffold
#

How do I find the dropped item entities spawned when a player (or entity) dies?
I can use .getDrops() to get the item stacks but I want to find the entities that are spawned

bleak comet
#

when i break a block with my pickaxe i don't want to lost durability, someone know how to do it pls ?

quaint mantle
#

So it seems like Matrix submatrix = image.subMatrix(r, c, kernel.rows, kernel.columns); is causing r to be set to 0

eternal oxide
#

cancel the break and do it yourself with breakNaturally

quaint mantle
#

If anyone knows why r not looping anymore here is the code ```java
public Matrix subMatrix(int startRow, int startColumn, int width, int height) {
double[][] sub = new double[width - startRow + 1][height - startColumn + 1];
for (int i = startRow; i <= width; i++) {
for (int k = startColumn; k <= height; k++) {
sub[i - startRow][k - startColumn] = array[i][k];
}
}
return new Matrix(sub);
}

bleak comet
eternal oxide
#

you can handle that too, the event tells you how much exp they will get

bleak comet
#

how bro ?

river oracle
#

Like you handle every other event

mortal hare
#

Can someone explain what ArrayMaps of fastutil stand for ?

#

is it an implementation of simple map with internal arrays

#

or what?

#
The main purpose of this implementation is that of wrapping cleanly the brute-force approach to the storage of a very small number of pairs
#

from what i understand its literally just a wrapped primitive array that is as big as the biggest key value?

lost matrix
#

Ah wait the r is further up. Lets see

lost matrix
#

Be aware that if you dont pad, your resulting image will be smaller (by one pixel in each direction if you have a 3x3 kernel)

lost matrix
lost matrix
lost matrix
# mortal hare Can someone explain what ArrayMaps of fastutil stand for ?

It creates 2 matching arrays. One for the keys and one for the values.
get() results in a linear scan of the keys and returns the value with the matching index.
With very few entries (i would approx say <= 10 elements)
this is faster and more memory efficient than a traditional hash table lookup.

mortal hare
#

yea but it would suck if the integer key is very big

#

lets say 1000

#

it would expand internal arrays it to 1000 length array

#

right?

lost matrix
#

Nope

#

Look at the image. Ive made an example with a key 99332 which is pretty big.
But the array has only 4 elements.

mortal hare
#

ok

#

but this is O(N)

#

for key lookup

#

but its still faster

#

than to hash

#

for small data sets

#

that is what youre trying to say?

lost matrix
#

Sure. It scales poorly. But as the javadocs state: For a very small amount of pairs its faster.

mortal hare
#

man i love fastutil

#

it seems so powerful

lost matrix
#

Doing 4 or 5 == checks on some ints is faster than a hash table lookup

mortal hare
#

it got everything from collections what i need

#

but why not just check the hashcodes of the objects instead?

#

oh nvm

#

its key value collection lol

#

and from what i see OpenHashMap is just a regular hashtable impl of map?

storm scaffold
#

Does this also prevent other players from picking up the item?

mortal hare
#

Players are entities

#

according to docs

#

they could not

bleak comet
lost matrix
mortal hare
#

so from what I understand ArrayMap is collisionless map which is not scalable

#

since keys are linearly searched

lost matrix
#

ArrayMap is an Array backed Map... thats basically it

#

And true: It scales poorly

#

But has benefits for tiny amount of elements

mortal hare
#

last question

#

do you prefer mutable classes (with setters and getters) or immutable ones

lost matrix
#

Highly depends on your design. But one thing is clear: Collections should always be strongly encapsulated
and you should never have getters/setters for them. Only mutators/accessors.

small hawk
#

Is Paper and NMS possible or only spigot ?

lost matrix
mortal hare
lost matrix
#

You can use NMS with both paper and spigot. But dont expect 100% compatability if you use NMS from either of those.

mortal hare
#

checkout paperweight-userdev plugin for gradle

#

i've been using it for couple of months

mortal hare
#

and cycling dependencies work differently on paper

small hawk
lost matrix
small hawk
lost matrix
#

Can both be done with just the PlayerProfile from Spigot

#

Player name im not 100% sure. You might even need packets for that.

eternal night
#

player name has 0 support in spigot, paper has API for completely replacing a players game profile

#

which might be more than you want

#

for a simple rename

small hawk
#

I asked the other day about player name, they said it's not possible

#

and for custom skull textures, you have any examples of code or some documentation?

eternal oxide
#

yes it is

eternal night
#

changed player name certainly is possible yea

lost matrix
quaint mantle
lost matrix
# quaint mantle what do you mean by pad my ends?

This means if you get outside of your image then you assume a value of 1.0 or 0.0 on the edge pixels (which dont actually exist).
This way the image size stays the same because you can then use your kernel on the edges.

small hawk
# lost matrix yes

Any hint how to start doing that, because I have no clue, where to start :/

lost matrix
# small hawk Any hint how to start doing that, because I have no clue, where to start :/
  private static final String BEACON_TEXTURE = "http://textures.minecraft.net/texture/e4006aa961668f3aea0dbfaf4b03f4104e03fee841d103e482be20fc937d4c70";

  ...  

  @SneakyThrows
  public ItemStack createHead(String texture) {
    PlayerProfile profile = Bukkit.createPlayerProfile(UUID.randomUUID());
    PlayerTextures textures = profile.getTextures();
    textures.setSkin(new URL(BEACON_TEXTURE));
    profile.setTextures(textures);
    ItemStack headItem = new ItemStack(Material.PLAYER_HEAD);
    SkullMeta meta = (SkullMeta) headItem.getItemMeta();
    meta.setOwnerProfile(profile);
    headItem.setItemMeta(meta);
    return headItem;
  }
small hawk
#

wow, that is clean

lost matrix
#

You see that the heads dont stack. You should absolutely create a Map<String, PlayerProfile> and only create one Profile for each texture.

small hawk
#

🫡

lost matrix
# small hawk 🫡
  private final Map<String, PlayerProfile> textureCache = new HashMap<>();

  public ItemStack createHead(String texture) {
    PlayerProfile cachedProfile = getProfileForTexture(texture);
    ItemStack headItem = new ItemStack(Material.PLAYER_HEAD);
    SkullMeta meta = (SkullMeta) headItem.getItemMeta();
    meta.setOwnerProfile(cachedProfile);
    headItem.setItemMeta(meta);
    return headItem;
  }

  private PlayerProfile getProfileForTexture(String texture) {
    return textureCache.computeIfAbsent(texture, key -> {
      PlayerProfile profile = Bukkit.createPlayerProfile(UUID.randomUUID());
      PlayerTextures textures = profile.getTextures();
      try {
        textures.setSkin(new URL(BEACON_TEXTURE));
      } catch (MalformedURLException e) {
        throw new RuntimeException(e);
      }
      profile.setTextures(textures);
      return profile;
    });
  }

Would look like this probably,

small hawk
#

and i guess @SneakyThrows is your funny function to test things ? 😄

lost matrix
#

Its an annotation from lombok. Shouldnt matter for you ^^

quaint mantle
#

Really they blocked numbers from being posted here...

worldly ingot
#

lol I mean that was flagged as spam for good reason

quaint mantle
#

How?

crimson relic
#

lol yeah

quaint mantle
#

It isn't really spam though

#

I was trying to show my grid

worldly ingot
#

A computer can't assume context

#

On its own it looks like number spam

#

It's better in a hastebin/pastebin anyways

crimson relic
#

itd take up like half my screen

lost matrix
quaint mantle
#

my grid thats being processed also known as the "image"

small hawk
worldly ingot
#

Yeah whatever that method is called

#

If it returns a PlayerProfile, it's probably the one you want

lost matrix
worldly ingot
#

They've got different API so ye. They might have deprecated Spigot's API

#

they tend to do that a lot ¯_(ツ)_/¯

lost matrix
#

Well... they deprecated half the universe by now. String methods for example.
So that i have to write a whole new method with 20 lines of code to replace 2 lines of String related code.

sacred mountain
#

does anyone know where i can get active help for general java like swing and graphics

mortal hare
#

I strongly dissagree that string methods are better than component ones

mortal hare
#

Components are ftw

#

translation keys, in-chat item lores

lost matrix
#

This was not a comparison. Components have their use case. But why deprecate the String methods?

mortal hare
#

because its a better alternative

#

sure it takes you more objects

#

to achieve the same

#

but at least its consistent

#

with other chat and text functionality

lost matrix
#

I still dont see the reason for String method deprecation

mortal hare
#

its not as flexible as chat nowadays is

#

even minecraft internally uses components

#

to parse chat data

#

why would an api do a downgrade

lost matrix
#

So what? Keep both and use components for more complex approaches.

mortal hare
#

it fragments the api

#

we dont want to have win32 api

#

with A,B,C,D, EX whatever the fuck

#

they call

#

function hell

eternal night
#

preferably we just get people away from legacy format to a better one

#

that was the goal there

#

string based approach is generally cool

quaint mantle
eternal night
#

easier to construct than components thats for sure

mortal hare
#

it depends

#

for simple chat messages sure

lost matrix
#

And now i see all the people doing this because they are confused by adventure:

Component.text("§9Cool colored Text");

Big win ^^

eternal night
mortal hare
#

😄

eternal night
#

adventure used to warn about that

lost matrix
#

I mean adventure is cool and all. Im just a grumpy dev that doesnt want to rewrite deprecated code.

eternal night
#

preferably we'd have a nice way for a plugin to define what types of format they want to use ¯_(ツ)_/¯

#

like

#

in my old code I have a single static method called static Component d(@NotNull final String text) that I wrap around my legacy stuff

#

until I find the time to migrate to mini message

#

and then d will just take mini message strings

#

beyond that, they are deprecated but not deprecated for removal

#

big difference here

lost matrix
#

My IDE begs to disagree. Deprecation means my project wont compile.

ivory sleet
#

lmao

eternal night
#

lol

#

an aggressive policy

lost matrix
#

I made that constraint and had to write some rules just to exclude draft API like ExactChoice

eternal night
#

@deprecated draft api blurtroll

#

iirc paper api removes those tho ?

#

I recall a patch that replaces those with @ApiStatus.Experimental

lost matrix
#

Hm. Could as well have used @Beta from guava

eternal night
#

¯_(ツ)_/¯

ivory sleet
#

well Contract is alr used

eternal night
#

generally ApiStatus has a few nice annotations

ivory sleet
#

so probably nicer to have everything from same lib

#

(if possible)

eternal night
#

yee

#

@OverrideOnly prayHalo

lost matrix
#

But at this point i feel like Beta is a permanent annotaion in guava. Never seen api get out of it...

eternal night
#

LOL

#

true that

#

mah byte streams

ivory sleet
#

ye still waiting for Ints.tryParse

lost matrix
#

Cries in RangeMap

quaint mantle
lost matrix
#

Let me take a closer look at the code first. One moment.

lost matrix
lost matrix
quaint mantle
#

Uni

#
public Matrix filter(Matrix image) {
        int rows = image.rows - kernel.rows + 1;
        int columns = image.columns - kernel.columns + 1;
        double outputImage[][] = new double[rows][columns];
        

        for (int r = 0; r < rows; r++) {
            for (int c = 0; c < columns; c++) {
                Matrix submatrix = image.subMatrix(r, c, kernel.rows, kernel.columns);
                Matrix result = submatrix.mult(kernel);
                outputImage[r][c] =    result.sum();
            }

        }
        return new Matrix(outputImage);
    }``` ```java
    public Matrix subMatrix(int startRow, int startColumn, int width, int height) {
        double[][] sub = new double[width - startRow + 1][height - startColumn + 1];
        for (int i = startRow; i <= width; i++) {
            for (int k = startColumn; k <= height; k++) {
                sub[i - startRow][k - startColumn] = array[i][k];
            }
        }
        return new Matrix(sub);
    }
swift sequoia
#

Hi, i was wondering how would one know if a method is thread safe or if it's not, i'am not for try catching and seeing if it "works" or "not", are there anything reliable to know that ?

hazy parrot
#

Well, method docs will usually say if method is not thread safe

#

In spigots case, you shouldn't really be calling any bukkit api async

worldly ingot
#

Alternatively, others say that they are explicitly thread safe

swift sequoia
hazy parrot
#

What

worldly ingot
#

Thing is, if it throws an exception, you shouldn't be calling it asynchronously because you can't. The general rule of thumb is that if it modifies the state of the world in any way shape or form, it's not safe

lost matrix
# quaint mantle ```java public Matrix filter(Matrix image) { int rows = image.rows - ker...
  private static final double PADDING = 1.0;
  
  public Matrix subMatrix(int startRow, int startColumn, int width, int height) {
    double[][] sub = new double[width - startRow + 1][height - startColumn + 1];
    for (int i = startRow; i <= width; i++) {
      for (int k = startColumn; k <= height; k++) {
        if(isWithinBounds(i, k)) {
          sub[i - startRow][k - startColumn] = array[i][k];
        } else {
          sub[i - startRow][k - startColumn] = PADDING;
        }
      }
    }
    return new Matrix(sub);
  }
  
  private boolean isWithinBounds(int x, int y) {
    return x < array.length && y < array[x].length;
  }

This is how you could pad your sub matrix

swift sequoia
swift sequoia
#

And i couldn't find the source where are the player stored for exemple to see if the container is thread safe

worldly ingot
#

Yeah, you're not modifying the world. You're querying the server. Generally fine. When you start to pull blocks asynchronously though that becomes a bit more problematic

#

Worst case, you run into a race condition or something. Though with online player status it's not all that huge of an issue

#

(clarifying that you can get blocks asynchronously, but it's iffy. ChunkSnapshots are ideal if you plan on grabbing multiple and want it to be consistent)

quaint mantle
worldly ingot
#

At the end of the day, async operations should be reserved for IO or web requests. Anything else should probably stay on the primary thread

lost matrix
# quaint mantle ```java public Matrix filter(Matrix image) { int rows = image.rows - ker...

PS: I would iterate over your matrix like this:

  public Matrix subMatrix(int startRow, int startColumn, int width, int height) {
    double[][] sub = new double[width][height];
    for (int subX = 0; subX < width; subX++) {
      for (int subY = 0; subY < height; subY++) {
        int absoluteX = startRow + subX;
        int absoluteY = startColumn + subY;
        if(isWithinBounds(absoluteX, absoluteY)) {
          sub[subX][subY] = array[absoluteX][absoluteY];
        } else {
          sub[subX][subY] = PADDING;
        }
      }
    }
    return new Matrix(sub);
  }
quaint mantle
#

although its at the multiplication part because its not equal

swift sequoia
#

With Spark i saw that some of my commands takes some time, which can be overlooked, but if i can try to improve i will

swift sequoia
worldly ingot
#

If your command is taking time, there's probably something specific in that command that's taking time that you can improve. Again, IO and web requests come to mind

lost matrix
#

Those are the classics

quaint mantle
#

Yea I'm issue is here java public Matrix mult(Matrix matrix) { if (this.rows != matrix.rows) { throw new IllegalArgumentException("Matrices are not compatible for multiplication."); } double[][] result = new double[this.rows][this.columns]; for (int i = 0; i < rows; i++) { for (int k = 0; k < columns; k++) { result[i][k] = array[i][k] * matrix.array[i][k]; } } return new Matrix(result); } result[i][k] = array[i][k] * matrix.array[i][k];

lost matrix
#

Another one: Implicitly loading chunks when accessing objects within them

swift sequoia
quaint mantle
#

r and c are not wanting to loop

swift sequoia
#

Oh that's actually @lost matrix post ahah

lost matrix
quaint mantle
#

In theory the matrices I have should be compatible

lost matrix
swift sequoia
lost matrix
# quaint mantle In theory the matrices I have should be compatible

Throw an exception if they are not. And add more info to your exception

throw new IllegalArgumentException("Incompatible row cardinality: Expected [%d] but got [%d]".formatted(this.rows, matrix.rows));

and

throw new IllegalArgumentException("Incompatible column cardinality: Expected [%d] but got [%d]".formatted(this.columns, matrix.columns));
quaint mantle
#

Exception in thread "main" java.lang.IllegalArgumentException: Incompatible row cardinality: Expected [4] but got [3]

lost matrix
# quaint mantle Exception in thread "main" java.lang.IllegalArgumentException: Incompatible row ...

Well then your submatrix has wrong dimensions.
Comment out your subMatrix method and try this one:

  public Matrix subMatrix(int startRow, int startColumn, int width, int height) {
    double[][] sub = new double[width][height];
    for (int subX = 0; subX < width; subX++) {
      for (int subY = 0; subY < height; subY++) {
        int absoluteX = startRow + subX;
        int absoluteY = startColumn + subY;
        if(isWithinBounds(absoluteX, absoluteY)) {
          sub[subX][subY] = array[absoluteX][absoluteY];
        } else {
          sub[subX][subY] = PADDING;
        }
      }
    }
    return new Matrix(sub);
  }
#

Or find out why your subMatrix method creates a matrix with wrong dimensions

quaint mantle
#

im making something that sends a message after a user sends a message but right now it shows it before in chat because of the chat formatter, even setting the priority to highest so it happens last it is still before. Is there any easy way to fix this besides adding an obv delay ig i could also check if the msg has been sent yet and wait too

eternal oxide
#

?scheduling

undone axleBOT
lost matrix
#

Yeah. Elgarl sniped me. Schedule it after one tick.

quaint mantle
#

figured thats whatd id have to do ty :D

#

Uhm now my console is just terminating whenever it runs lmao

#

So I want players to be able to run a command like /fw red and it will shoot a red firework. How do I allow color choosing in Java?

vocal cloud
#

A switch statement? Have a HashMap with color name to object?

quaint mantle
#

True, sorry. Still learning.

vocal cloud
#

Use a tabcompletable command

sterile token
vocal cloud
#

Could, but might not want to

sterile token
ancient jackal
#

I'm having an issue during the compilation where it's compiling with the wrong version. I'm not sure why or how to fix it. The cause is org.bukkit.plugin.InvalidPluginException: java.lang.UnsupportedClassVersionError: me/user/plugin/Plugin has been compiled by a more recent version of the Java Runtime (class file version 63.0), this version of the Java Runtime only recognizes class file versions up to 61.0

I didn't think it was a big deal at first. I had the pom.xml set to use java version 19 and the project SDK was set to JDK 19 as well. I set both to 17, recompiled, and it's still class file version 63. Set it to 1.8 and it's still version 63. What's going on? Why is it not compiling with the set JDK?

lost matrix
lost matrix
ancient jackal
#

Yeah

lost matrix
#

How do you compile?

ancient jackal
#

mvn package

lost matrix
#

try mvn clean install
And make sure your pom + the project sdk are both set to 17

brave sparrow
#

^

ancient jackal
#

I'll try that

brave sparrow
#

Or

#

mvn clean package

frank kettle
#

Happened to me too, cleaning it will fix

vocal cloud
#

Only install if you want to use it in another project

brave sparrow
#

The issue is just that it’s not recompiling with the older JDK since it’s already compiled those classes without you making any changes

quaint mantle
#

This statement is giving me an unreachable error.

            List<String> fwFColors = new ArrayList<>();
            fwFColors.add("red");
            fwFColors.add("orange");
            fwFColors.add("teal");
            fwFColors.add("lime");
            fwFColors.add("green");
            fwFColors.add("blue");
            fwFColors.add("yellow");
            fwFColors.add("white");
            fwFColors.add("purple");
            fwFColors.add("aqua");
            fwFColors.add("black");
            fwFColors.add("gray");
            return fwFColors;
        } else {
            return null;
        }```

In:

```package pro.digitalguardian.fwvouches.fwvouches.Commands;

import org.bukkit.Bukkit;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.command.TabCompleter;
import org.bukkit.entity.Player;

import java.util.ArrayList;
import java.util.List;

public class FWTabCompletion implements TabCompleter {
    @Override
    public List<String> onTabComplete(CommandSender sender, Command command, String label, String[] args) {
        if (args.length == 1) {
            List<String> playerNames = new ArrayList<>();
            Player[] players = new Player[Bukkit.getServer().getOnlinePlayers().size()];
            Bukkit.getServer().getOnlinePlayers().toArray(players);
            for (int i = 0; i < players.length; i++){
                playerNames.add(players[i].getName());
            }
        }
        if (args.length == 2) {
            List<String> fwColors = new ArrayList<>();
                fwColors.add("red");
                fwColors.add("orange");
                fwColors.add("teal");
                fwColors.add("lime");
                fwColors.add("green");
                fwColors.add("blue");
                fwColors.add("yellow");
                fwColors.add("white");
                fwColors.add("purple");
                fwColors.add("aqua");
                fwColors.add("black");
                fwColors.add("gray");
                return fwColors;
        } else {
            return null;
        }
        if (args.length == 3) {
            List<String> fwFColors = new ArrayList<>();
            fwFColors.add("red");
            fwFColors.add("orange");
            fwFColors.add("teal");
            fwFColors.add("lime");
            fwFColors.add("green");
            fwFColors.add("blue");
            fwFColors.add("yellow");
            fwFColors.add("white");
            fwFColors.add("purple");
            fwFColors.add("aqua");
            fwFColors.add("black");
            fwFColors.add("gray");
            return fwFColors;
        } else {
            return null;
        }
        if (args.length == 4) {
            List<String> fwShapes = new ArrayList<>();
            fwShapes.add("creeper");
            fwShapes.add("burst");
            fwShapes.add("star");
            fwShapes.add("ball");
            fwShapes.add("largeball");
        } else {
            return null;
        }
        return null;
    }
}```
ancient jackal
#

So always clean before continuing with a compilation after changing the version, got it 👍

river oracle
#

static constants

quaint mantle
#

Wym

#

it's for tab completion

brave sparrow
#

@quaint mantle you have if (args.length == 2) {} else {return null;}

#

Above it

#

So you’ll always have returned before you get to that block

#

Once the method returns it doesn’t continue executing code below it

sterile token
# quaint mantle Wym

They told you to put all color names inside a list and then loop over them, checking if the input color is there or not

quaint mantle
#

I swear I need lessons on this stuff. Java is harder than Rust for me for some reason

#

So I should do a break instead of a return null

sterile token
#

Not because you know how to code on one lang, is the same in the other langs, you must learn every new lang if not you wont success

brave sparrow
quaint mantle
#

But if they don't put the correct color in, I need it to not run the command.

ancient jackal
brave sparrow
#

You should probably be using else if to have all the different arg checks

sterile token
brave sparrow
#

if (args.length == 1) {
// stuff
} else if (args.length == 2) {
// stuff


} else {
return null;
}

quaint mantle
#

Rust is systems programming

ancient jackal
#

Rust is hard

quaint mantle
brave sparrow
#

That’s not nesting

#

This is nesting:

quaint mantle
#

if {
if {
}
}

ancient jackal
#

If x:
If y:
If z:

quaint mantle
#

that's nesting

brave sparrow
#

if (a) {
if (b) {
if (c) {
}
}
}

#

That’s nesting

#

Else if is not nesting

sterile token
#

I find if-elses really messing 😬

brave sparrow
sterile token
brave sparrow
#

These are all supposed to happen in one block and the others shouldn’t trigger if one is satisfied

#

Else if is not an oddity

#

It’s a perfectly valid thing to do

quaint mantle
#

import org.bukkit.Bukkit;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.command.TabCompleter;
import org.bukkit.entity.Player;

import java.util.ArrayList;
import java.util.List;

public class FWTabCompletion implements TabCompleter {
    @Override
    public List<String> onTabComplete(CommandSender sender, Command command, String label, String[] args) {
        if (args.length == 1) {
            List<String> playerNames = new ArrayList<>();
            Player[] players = new Player[Bukkit.getServer().getOnlinePlayers().size()];
            Bukkit.getServer().getOnlinePlayers().toArray(players);
            for (int i = 0; i < players.length; i++){
                playerNames.add(players[i].getName());
            }
        }
        if (args.length == 2) {
            List<String> fwColors = new ArrayList<>();
                fwColors.add("red");
                fwColors.add("orange");
                fwColors.add("teal");
                fwColors.add("lime");
                fwColors.add("green");
                fwColors.add("blue");
                fwColors.add("yellow");
                fwColors.add("white");
                fwColors.add("purple");
                fwColors.add("aqua");
                fwColors.add("black");
                fwColors.add("gray");
                return fwColors;
        } else if (args.length == 3) {
                List<String> fwFColors = new ArrayList<>();
                    fwFColors.add("red");
                    fwFColors.add("orange");
                    fwFColors.add("teal");
                    fwFColors.add("lime");
                    fwFColors.add("green");
                    fwFColors.add("blue");
                    fwFColors.add("yellow");
                    fwFColors.add("white");
                    fwFColors.add("purple");
                    fwFColors.add("aqua");
                    fwFColors.add("black");
                    fwFColors.add("gray");
                    return fwFColors;
        } else if (args.length == 4) {
                List<String> fwShapes = new ArrayList<>();
                    fwShapes.add("creeper");
                    fwShapes.add("burst");
                    fwShapes.add("star");
                    fwShapes.add("ball");
                    fwShapes.add("largeball");
        } else {
            return null;
        }
        return null;
    }
}```

So this should work?
sterile token
#

?paste

undone axleBOT
sterile token
#

PLease!!!

#

you flood the whole channel

#

Long code must be sent via paste

brave sparrow
#

You should do it for all the ifs, from 1-4 @quaint mantle

#

And you don’t need the return null after the ifs, since you already include it in that final else block

sterile token
brave sparrow
#

I’m not even on that point yet lol

#

I’m trying to clean up their branches first

#

Then we can talk about the contents of those branches

sterile token
#

rioght

#

What even should i use for my inventory api to allow custom inventory to get edited?

brave sparrow
#

What do you mean

sterile token
#

Im working with custom menus and i want to allow to add/change items on it

brave sparrow
#

But what do you mean what should you use

sterile token
#

What even i can i use? I currently listening to InventoryDragEvent and InventoryClickEvent but they seem not responding

#

Im really sure that its a coding issue but i cant realize where

brave sparrow
#

The inventory events aren’t being fired for your inventories?

sterile token
#

Because its not saving the items i add to it nor displaying the items i added

brave sparrow
sterile token
#

right

#

I will send ig

#

?paste

undone axleBOT
sterile token
#

Problem is that a ton of code

#

😬

#

I will have to send lot of urls

#

but if i can get help i dont care

#

ok

echo basalt
#

no need to be that aggressive, verano

wary topaz
#
        ItemStack speedcapsule = new ItemStack(Material.HONEY_BOTTLE);

        ItemMeta speedcapsulemeta = speedcapsule.getItemMeta();

        assert speedcapsulemeta != null;
        speedcapsulemeta.setDisplayName("Speed Capsule");
        speedcapsulemeta.setLore(Collections.singletonList("Rumor says it, this capsule was from 2000 BCE"));
        speedcapsule.setItemMeta(speedcapsulemeta);
        return speedcapsule;
    }

if (Objects.requireNonNull(event.getItem().getItemMeta()) == Objects.requireNonNull(speedCapsule().getItemMeta())) {

Why arent they equal when they are?

echo basalt
#

Objects.requireNonNull is a clown method

sterile token
echo basalt
#

it's literally useless and supresses an IDE warning

wary topaz
#

i meant

#

@nullable

echo basalt
#

you can't follow naming conventions and you're the one telling me what's good or not?

wary topaz
#

cmon mate

echo basalt
#

anyways don't compare metas

#

specially with ==

#

As == compares object reference ids

wary topaz
#

so what do I do?

#

unique ids?

echo basalt
#

p much

sterile token
brave sparrow
wary topaz
#

alr ty

echo basalt
#

If you want to compare items

wary topaz
echo basalt
#

I'd associate a PDC / NBT tag

wary topaz
echo basalt
#

?pdc

wary topaz
#

alr

echo basalt
#

instead of doing any meta comparisons

wary topaz
#

cause I dont want players renaming the honey

#

ty for the help

shadow gazelle
#

Spigot will ignore jars in the plugins folder that don't have a valid plugin.yml, right?

sterile token
#

So comming back to my issue im using some simple menu class for managing custom inventories, but im trying to use it for adding items into the menu and then get saved. But they are not getting even saved, that why im wondering to know which events should i listen to? Im currently doing it via InventoryClick and InventoryDrag

shadow gazelle
#

Even if they don't have one at all?

quaint mantle
#

?paste

undone axleBOT
sterile token
quaint mantle
shadow gazelle
#

moment

brave sparrow
#

@shadow gazelle you’ll get errors because it sees the jar and tries to load it, then can’t

#

Array indexes start at 0

shadow gazelle
#

So I guess if I want jar loading for extensions I just need to do it from another directory, fun

sterile token
brave sparrow
#

@quaint mantle if the array is of length 2, that means the only valid indexes are 0 and 1

sterile token
eternal oxide
#

you never check toi see if args 1,2 or 3 exist

quaint mantle
#

No, if an array is length 2 then the only valid index is 1

#

Right?

shadow gazelle
#

No, valid indexes are 0 and 1 if the length is two

sterile token
quaint mantle
#

lengths start at 1

brave sparrow
#

Array of length n:
[0, 1, …, n - 1]

quaint mantle
#

ah

brave sparrow
#

The reason being that array indices are from memory offsets

sterile token
#

So? What events should i use for allowing people to add items into a custom inventory?

shadow gazelle
#

Anyway, anyone have a jar loading library they like, or should I just look at what Bukkit/Spigot does and make something similar to that?

quaint mantle
#

Well, I have all the indexes starting at 0

brave sparrow
#

The 0th element is the element at the array’s memory address

sterile token
brave sparrow
#

0 inclusive, length exclusive

shadow gazelle
#

I entirely forgot that PAPI has to load jars lol

#

thanks

sterile token
#

You are being too much pacient haha

sterile token
brave sparrow
quaint mantle
#

Like I really appreciate the help

#

But damn

sterile token
brave sparrow
sterile token
#

Also im not being toxic, i just said the truth, doesnt make sense. This an example taken from cooking, you cannot expect making an amazing and delicious cake, without even cooking nor learning basic cooking fundaments

golden turret
#

hi

#

did anyone here ever worked with physics?

#

I want to create a vehicle

#

it works almost fine

#

buuut

#

the rotation thing is not working properly

shadow gazelle
golden turret
#

like

#

when I start to accelerate/reverse

#

the rotation never changes after that

#

even if I change the vehicle rotation

#

it is never reflected in the actual acceleration

shadow gazelle
#

You probably need to set the acceleration after you set the rotation

golden turret
#

already doing that

brave sparrow
golden turret
#

1 sec, playing a little rocket league here

shadow gazelle
#

The actual rotation in the acceleration*

wary topaz
#

Is there a setstackable(False) option?

#

For itemmeta

#

or itemstack

#

cause i hate honeybottles

#

lul

brave sparrow
#

Not that I’m aware of

#

@golden turret it doesn’t seem like rotation ever gets set again

golden turret
#

it is

#

like

brave sparrow
#

Not in the code you sent over at least

wary topaz
#

wdym

brave sparrow
wary topaz
#

Nothin

#

There is .getMaxStackSize(); but not .setMaxStackSize();

shadow gazelle
#

Because that's not defined by the item stack

wary topaz
#

How do i define it?

eternal oxide
#

not easy and its messy

wary topaz
#

NMS?

eternal oxide
#

reflection and the client will mess up at times

wary topaz
#

or can I just add nbt and make em different

shadow gazelle
#

I was thinking NBT, but I don't think that's a tag

eternal oxide
#

I believe its in the Material

wary topaz
#

I have an idea, thank you fellas

brave sparrow
#

@wary topaz different NBT or item meta between two items will prevent them from stacking, correct

quaint mantle
golden turret
#

if the vehicle is at, for example, a yaw of 130

#

it will always have an acceleration at that

#

even if I change the yaw

ancient jackal
#

I'm changing the amount of hearts someone has but the HUD doesn't reflect it until after dying, healing back up to the max amount of hearts or rejoining, is there some way to do this?

lost matrix
quaint mantle
#

None

#

It just terminates

#

Tried restarting my device and that didn't fix it

lost matrix
#

What do you mean none? The jvm doesnt just exit...

shadow gazelle
#

^ It's not possible for it to have no exit code at all

quaint mantle
lost matrix
#

Unless there is a seg fault in the jvm itself (which i highly doubt)

shadow gazelle
#

Should still give you a C exit code at the very least

#

Unless the Minecraft client does something differently

quaint mantle
#

It gives me nothing

lost matrix
quaint mantle
#

No personal computer

lost matrix
#

What is this screenshot from?

quaint mantle
#

My computer

lost matrix
#

sigh I hope you dont study CS

eternal oxide
#

looks like he ran a main in Eclipse

lost matrix
#

Which application

#

Ok

quaint mantle
lost matrix
eternal oxide
#

if he looks in the console

lost matrix
golden turret
#

hi hi

#

still needing help with the physics

quaint mantle
#

Wait is that not what you meant C#?

golden turret
shadow gazelle
golden turret
quaint mantle
#

OH NVM

shadow gazelle
#

You aren't doing anything with the acceleration

lost matrix
quaint mantle
#

I was about to say

quaint mantle
#

No computer engineering

golden turret
#

the rotation is being updated and everything

ancient jackal
#

CS is far better than Java, CS is a hard topic to study though

#

There's a difference smh

lost matrix
brave sparrow
#

@golden turret print out debug information about the vehicle entity rotation prior to doing the rest of your computations

#

I’d be willing to bet the rotation isn’t changing

shadow gazelle
# golden turret i am

No you aren't, you're setting acceleration to newAcceleration then doing nothing with the new acceleration value

quaint mantle
#

At first I thought you meant C# when you said CS

ancient jackal
golden turret
ancient jackal
#

Your body and consciousness yearns for it

brave sparrow
lost matrix
golden turret
#

and I could see the entity rotating too

shadow gazelle
#

Because you still set the position of the entity

brave sparrow
golden turret
#

yes

quaint mantle
#

Usually it does though spit out one

brave sparrow
#

To be fair you are not using that acceleration variable you set at all

#

I saw that earlier too

golden turret
shadow gazelle
# golden turret yes

You're doing nothing with the acceleration variable

// Update acceleration, velocity, and position based on new acceleration
acceleration = newAcceleration;
position = position.clone().add(velocity);

setPos(position.getX(), position.getY(), position.getZ());
lost matrix
golden turret
#

bruh

#

really

#

I wasnt

quaint mantle
#

There is no exit code I showed you the screenshot of what I get

ancient jackal
golden turret
#

🤡

quaint mantle
#

A blank page that says terminated

shadow gazelle
#

what

ancient jackal
#

Also one other godsend is the Nullable type so not everything is nullable already like in Java

brave sparrow
#

I also realized you never set vehicleEntity to anything @golden turret

golden turret
#

I did

#

but it is not in that code specifcally

lost matrix
shadow gazelle
golden turret
quaint mantle
#

Where is Optic when you need him to fix things?

golden turret
#

the another class is not relevant for this problem

shadow gazelle
#

That's not what I asked

lost matrix
warped mauve
#

Hi, does anyone know how I can set the skin of a Citizens npc by url using Citizens API?

ancient jackal
wary topaz
#

For the player death event, how can I get the killer & the player themselves? And if the killer is not a player I want to see how to detect that.

#

The .getentity doesnt make any sense for me.

#

As I dont know if that is the killer or the player,.

lost matrix
#

Oh and dont get me started on properties... Or their approach to functional interfaces aka: delegate functions

lost matrix
#

They have 0 standardisation... Writing and reading production code in C# feels like
reading a whole new language every time you switch to another company.

shadow gazelle
#

Seems like you need something else to get who/what was the killer

brave sparrow
#

@wary topaz the killer isn’t tracked by the event

#

the player has a getKiller() method

ancient jackal
shadow gazelle
ancient jackal
#

But there are standards and often clearly stated in the documentation itself

wary topaz
wary topaz
shadow gazelle
#

Oh

shadow gazelle
#

LivingEntity, that's why I couldn't find it

quaint mantle
#

I just tried running the program in intellij and I get the same thing

eternal oxide
#

show the "program" you are running

#

?paste

undone axleBOT
lost matrix
lost matrix
#

2 languages with 2 use cases. (Even tho C# is Microsoft spawn which makes it automatically worse...)

wary topaz
#

How come this did not message me with I died?

brave sparrow
#

Why do you keep doing that require non null

lost matrix
wary topaz
#

Yes.

#

I require non null cause send message might be null

#

for this event

#

but I assert that the player is a player

lost matrix
wary topaz
#

But getentity is not a player? Is it?

shadow gazelle
#

It can only be a player

wary topaz
#

ohh

#

thank you

ancient jackal
wary topaz
#

wait is getplayer redundant?

shadow gazelle
#

Yes

wary topaz
#

or does it break it

#

oh

shadow gazelle
#

So is requirenonnull

#

it's going to throw an error either way

brave sparrow
#

^

wary topaz
#

I'll try it.

brave sparrow
#

requireNonNull changes nothing in that situation

#

Either way you get the null pointer exception

wary topaz
#

Did not message me.

#

And yes I tried with a different event and the events are being called

lost matrix
shadow gazelle
brave sparrow
lost matrix
wary topaz
#

Yes, I think it has something to do with a command, let me look this.

#

Give me a minute.

eternal oxide
#

you are not getting the file window?

ancient jackal
quaint mantle
lost matrix
wary topaz
wary topaz
#

idk why it's disabled.

#

the disable message aint showing shit

eternal oxide
brave sparrow
#

You have got to stop with the require non null lmao

wary topaz
#

god damn

#

what ayll up about non null

#

it saves my eyes

#

from REQUIRE NON NULL ONCOMMAND

quaint mantle
#

Oh my god I just realized its terminating because I don't have the grid file there lol

eternal oxide
#

They do require non null because it's the default fix in InteliJ when somethign can return null

brave sparrow
#

They should be checking to make sure it’s not null and handling that behavior though

#

Not just moving the exception

eternal oxide
#

correct

#

but when their IDE says many be null, they click teh first choice for a suggested fix

wary topaz
#

ill put that in paste

worldly ingot
#

Very carefully

shadow gazelle
brave sparrow
wary topaz
eternal oxide
#

plugin did not startup

#

Cannot execute command 'testbro' in plugin SpeedSMP v1.0-SNAPSHOT - plugin is disabled.

wary topaz
brave sparrow
#

Oh your plugin isn’t loading

#

Well the exception isn’t causing it at least

#

Just another symptom

wary topaz
#

wheres the error that I need to fix

eternal oxide
#

in your log

wary topaz
#

ohh

#

ohhh

#

my command

#

plugin.yml

#

tysm guys

#

sorry for the hassle

brave sparrow
#

Notice that require non null didn’t fix anything there by the way

#

Lol

#

Whereas an actual null check would have

ancient jackal
# lost matrix Oh yes. I always wanted a massive overhead on my primitives... lol So thats a de...

Also were you talking about the overhead of having to do boxing all the time in Java or alleged overhead of unmanaged/primitive types in C#? They're structs and one of the unmanaged types so they don't have any more overhead than any other language. Like any other language, an int is only 4 bytes in memory like all other structs/value types (that you can also make your own of). The point was that there is no need to stand the overhead of boxing and unboxing all the time because structs are accepted generics as well

worldly ingot
#

The IDE suggests a solution to the problem but can't fix poor programming practice or design

wary topaz
#

Heya again!

  public void onPlayerDeath(PlayerDeathEvent event) {
      event.getEntity().sendMessage("You just died! You lost 0.05 speed as a punishment! Go back to your loot to gain the speed back!");
      event.getEntity().getInventory().addItem(speedCapsule());
      event.getEntity().setWalkSpeed(event.getEntity().getWalkSpeed() - (float) .05);
  }

When I add the item to the event player inventory, they actually dont get it dropped or keep it, anyone know why?

#
        ItemStack speedcapsule = new ItemStack(Material.HONEY_BOTTLE);

        ItemMeta speedcapsulemeta = speedcapsule.getItemMeta();

        assert speedcapsulemeta != null;
        speedcapsulemeta.setUnbreakable(true);
        speedcapsulemeta.setDisplayName("Speed Capsule");
        speedcapsulemeta.setLore(Collections.singletonList("Rumor says it, this capsule was from 2000 BCE This item is the # " + (plugin.getConfig().getInt("AmountOfSpeedCapsules")) + " to exist."));
        plugin.getConfig().set("AmountOfSpeedCapsules",(plugin.getConfig().getInt("AmountOfSpeedCapsules") + 1));

        speedcapsule.setItemMeta(speedcapsulemeta);

        return speedcapsule;
    }```
sterile token
#

I would suggest following name conventions, atleast for variables

wary topaz
#

;-

#

thats not a answer thats a suggestrnio

sterile token
lost matrix
sterile token
wary topaz
#

I want the player to drop the item when they die though

lost matrix
#

event.getDrops().add(yourItem)

Javadocs are not clear on weather this list is mutable and changes the event outcome but i would give it a try

wary topaz
#

Is that for respawn event?

lost matrix
#

death event

wary topaz
#

It's not a thing for death

#

wait nvm

#

sorry

#

i'll try

#

it worked ty

sterile token
#

What can cause my event no getting triggered? I cant find any valid reason, because the debug message is getting sent

    @EventHandler(priority = EventPriority.HIGHEST)
    public void onInventoryDrag(InventoryDragEvent event) {
        Player player = (Player) event.getWhoClicked();
        Optional<Menu> optional = handler.getMenu(player.getUniqueId());
        if (!optional.isPresent()) return;
        Inventory inventory = event.getView().getTopInventory();
        if (inventory == null) return;
        Menu menu = optional.get();
        player.sendMessage("[MenuListener] Menu " + menu.getTitle() + " added " + event.getNewItems().size()  + " items");
        MenuEvent drag = new MenuDragEvent(player, menu, event.getNewItems());
        if (drag.isCancelled()) return;
        plugin.callEvent(drag);
    }
lost matrix
#

InventoryClickEvent being cancelled beforehand or Listener not registered

sterile token
#

click event?

lost matrix
#

Yes if click is cancelled then drag wont even fire

sterile token
#

right, im listening to it but its not cancelled

#

Im mainly wondering to be able to add items to the custom menu, like you would do with normal player inventory

lost matrix
#

Open it in edit mode and dont cancel anything in this case. Save the inventory when the player closes the editor

sterile token
#

yeah im doing that but something seems wrong, starting from that custom drag event is not being triggered

rare rover
#

Is there a github or link to give examples of improving your java code? I dont think my code is the best for performance and i wanna learn how to make it the best as possible

lost matrix
rare rover
#

Ty kind sir

jagged monolith
lost matrix
#

That too. Live code bashing review is always nice.

sterile token
#

Smile, so what can be?

#

Im not cancelling none of the click nor drag event

#

Maybe the priority can cause the issue?

lost matrix
#

No

#

Describe what is not working exactly

sterile token
#

Im doing what you described for editing the menu, but i realized that custom drag is not triggered

lost matrix
#

What do you mean its not triggered? Is the event not fired?

sterile token
#

For eample, this works perfect

sterile token
lost matrix
#

Then the code is not being reached

sterile token
#

I dont think so, because the debugg message is getting sent

lost matrix
#

Could be:

  • optional is empty
  • inventory is null
  • click event was cancelled beforehand
sterile token
#

If those were null, the debugg message wasnt getting sent, and im not cancelling click nor drag event

#

I will send full MenuListener code

#

?paste

undone axleBOT
lost matrix
#

Why dont you give us this information right away?
Then if (drag.isCancelled()) return; this blocks

#

Add another debug message after that line

ancient jackal
sterile token
#

right i will do, also im not cancelling the MenuDragEvent

wary topaz
#

Heyo again, how can I ban a player with the new api? I'm kinda slow 🦥

#

.setbanned aint a thing btw

lost matrix
ancient jackal
#

If he can't think of anything else to do what else is there to do?

lost matrix
#

I think this falls under micro optimization and has a real danger of making your code just worse

sterile token
#

Definitly, smile, custom drag is not getting fired. I just debugged it, just firing the custom click

lost matrix
#

Trust the compiler and JIT to rearrange branches on runtime

ancient jackal
lost matrix
sterile token
ancient jackal
#

You can still make it easier for the compiler though

lost matrix
#

Meh, it sounded to me like he wanted some low hanging fruits like using the right collections (e.g. Set isntead of List for contains)

sterile token
#

This happen when im adding items to the inventory, doesnt even fire my custom event

ancient jackal
#

I suppose

lost matrix
sterile token
lost matrix
#

Any errors in console?

sterile token
#

No, no error

#

it was first thing i checked

#

I can send full code

#

For MenuListener if you want to see

lost matrix
sterile token
#

right

#

Im feeling like an idiot right now, i think the was getting fired but issue was there

lost matrix
#

Wait show me your MenuDragEvent. Did you add the baked list?

sterile token
#

ignore lombok please, just using it for fast debug 😬

lost matrix
#

Is it working now?

sterile token
#

1m, im restarting server

lost matrix
#

I will never get over spigots event handling... This can not be the cleanest approach

sterile token
lost matrix
sterile token
#

Yes

#

The other 3, open, close and click, which are triggered/fired success

lost matrix
#

Make MenuEvent abstract and remove the handler list methods. Make only the top
events have a static getHandlerList() method

sterile token
#

ok

#

So, mainly put the handler list, on each event right?

lost matrix
#

Yes

sterile token
#

like that ght?

lost matrix
#

And a static method

sterile token
#

ok

#

doesnt make sense,. why 2 methods

#

🤔

#

It must have a reason. but im not sure

lost matrix
#

Look at the spigot source code and then cry.

#

?stash

undone axleBOT
sterile token
#

oh, its bad coded?

lost matrix
#

I would say its dated

#

A decision was made in the early days of bukkit

sterile token
#

Also smile does the static method be named the same?

#

Because that will cause method issue

wary topaz
#

plugin.getServer().banIP("" + playerIPS.get(Objects.requireNonNull(event.getEntity().getPlayer()).getUniqueId()));

    public static HashMap<UUID, InetSocketAddress> playerIPS = new HashMap<>();

playerIPS.put(event.getPlayer().getUniqueId(),event.getPlayer().getAddress());

How come it is not banning them?

#

also the reason im doing ips cause no one told me how to do it normal

lost matrix
sterile token
#

thats how all looks right now

lost matrix
sterile token
#

right

lost matrix
sterile token
#

Also he has kick to the player

worldly ingot
#

getHandlers() and static getHandlerList()

wary topaz
#

Uhhh it errored to my console, I'll upload that

sterile token
worldly ingot
#

Done intentionally but just a consequence of the event system we use

#

It's based on an existing framework

sterile token
#

But the event system is cursed

#

I wont lie haha

wary topaz
sterile token
#

Paper != Spigot 💀

wary topaz
#

yeah feather client doesnt have spigot

lost matrix
sterile token
#

okay smile, aparrently now drag event works

#

👏

wary topaz
#

How can I ban somebody on paper than

#

ig

sterile token
lost matrix
wary topaz
#

Oh i sent the wrong console lol

sterile token
wary topaz
#

theres no error they just dont get banned

sterile token
#

You have to kick the player and then cancel player connecting if they are in the map

wary topaz
#

so a custom event that bans players?

#

that seems FUN

#

okay bye

lost matrix
sterile token
#

what?

#

english-english pelase

#

hahaha

#

dont use those ass** slangs because i cant understand them

lost matrix
sterile token
#

Yeah haha

#

What i told him

wary topaz
#

ill just make a custom one

#

how do I cancel em from joining?

sterile token
wary topaz
#

Yes

sterile token
#

Idk im just asking

#

HAHA

wary topaz
#

lmfao

sterile token
#

I mean its basic spigot api

#

Not wondering to be rude

wary topaz
#

theres no event.setcancelled

#

for it

sterile token
wary topaz
#

oh

lost matrix
wary topaz
#

lol

sterile token
#

yeah i forgot it was an event part for that

wary topaz
#

event.disallow?

sterile token
wary topaz
#

?

sterile token
#

You have to read the docs

wary topaz
#

oh alr

#

brb

sterile token
#

I mean they expalin everything

#

We can help but bro, its too much i mean 😬

lost matrix
#

Something like that

  @EventHandler
  public void onPreLogin(AsyncPlayerPreLoginEvent event) {
    if(this.banManager.isBanned(event.getUniqueId())) {
      event.disallow(AsyncPlayerPreLoginEvent.Result.KICK_BANNED, "You have been banned.");
    }
  }
wary topaz
#

I found it.

#

ty.

sterile token
#

smile

#

I have another small question

lost matrix
#

Sure

sterile token
#

Im currently not cancelling none of inventory click nor drag right

lost matrix
#

Btw... Discord Helper status, when?

sterile token
#

But how would i cancel the event removing inventory

#

Because i will use same inventory for editing and seeing

wary topaz
#

Thank you guys.

sterile token
#

I have that 2 awesome methods which i coded

lost matrix
#

Looks expensive

sterile token
#

oh i know please dont mention about the Streams, i iwill use it all life haha

#

I know what people think about them but its a simple game and i wont care too much about them

lost matrix
#

I dont think the stream is the real issue here... Anyways

#

Whats your concern

sterile token
#

Just understand how would i cancel event taking and moving?

#

Because the inventory drag and click, are not cancelled cuz what you mentioned before

lost matrix
#

Im not sure i understand your question

#

Do you want to make your custom events cancellable?

sterile token
#

okay, 1m please i will rephrase it

sterile token
#

But i need for example to cancell the custom menu dragging and click for specifc reasons, mainly make them to be cancellable or not

lost matrix
#

Ok so you want the following:
If your event is cancelled -> Then the bukkit event should also be cancelled

sterile token
#

so, InventoryClickEvent#setCancelled(customClickEvent.isCancelled()) ?

lost matrix
#

That was a question from me...

sterile token
#

hmnn

lost matrix
#

But yeah you are right. If you want to propagate the cancellation like that, then your code is right

sterile token
#

ohh right my bad i catch it

#

So yeah i want to cancel the custom click, and them bukkit event cancel too

wary topaz
#

How can I get the unique id of a offline player?

sterile token
wary topaz
#

oh lol

sterile token
#

All that info can be found on the docs

#

I have told 2 times haha

#

?jd-s

undone axleBOT
wary topaz
#

https://paste.md-5.net/kijunidiqa.java
Hey again lmfao

So basically whenever the player is revivied by the admin, the player dosent get their speed reset, can somebody tell me why?
Important lines: 39, 132

sterile token
lost matrix
#

Well yeah. You cant drag something if you are not even allowed to click it.

sterile token
#

Hmn right but im thinking how to check that

#

I currently done that

#

But that will cause issues, because i have to cancel click event by default, because if not while you open the custom inventory you can take out the preview items

lost matrix
#

Im seeing a big design flaw here... but im out for today

#

Events should not be used like that. They are a pure api tool and listening to your own events is pretty dirty.

sterile token
#

yeah, you are right

#

I wiill re design, this

vocal cloud
#

Use a HashSet instead of an ArrayList

#

Capitalize the classname

#

with a hashset you can do .remove() and it will return a boolean if something was removed that way you don't need to do a .contains and a .remove

wary topaz
#

How can I convert itemstack to a material for a custom recipe?

vocal cloud
#

Also adding 0.05 is not making them 0.05% faster. I'm pretty sure that's blocks/tick

wary topaz
#

Ik.

#

I'm just asking about itemstack to material

wary topaz
#

oh hashSET

wary topaz
desert loom
quaint mantle
#

I'm thinking about making a mod that communicates with my plugin (Elemental Foods) to download custom textures and properly handle crafting recipes (https://bugs.mojang.com/browse/MC-153160 this issue is with trading, but it also affects crafting.)
Would this sort of thing be allowed for a Premium resource? If I'm going to put in the work to make an entire mod I'd probably want to profit from it.
If I do make this resource premium, would it be possible to have a free version with less features or would I have to commit to having the entire thing paid?

desert loom
#

you want the material of an ItemStack no?

wary topaz
#

I want to convert a itemstack to a material

desert loom
#

ItemStack has a getType method that returns the type

#

type being the material

wary topaz
#

But it removes the material data

#

which is useless

desert loom
#

I think you're looking for this then

wary topaz
#

Thank you!

wary topaz
#

Hey again! I'm doing the recipe but it wont work when I try it on the server ```@Deprecated
ShapedRecipe recipe = new ShapedRecipe(reviveToken());
recipe.shape("ABA","B B","ABA");

    recipe.setIngredient('A',new RecipeChoice.ExactChoice(speedCapsule()));
    recipe.setIngredient('B',Material.DIAMOND);
    plugin.getServer().addRecipe(recipe);```

The console is erroring but I do not understand it! Heres the console: https://paste.md-5.net/taqecefapa.md

#

A plugin is creating a recipe using a Deprecated method.
What else should I do?

desert loom
#

use the other constructor

delicate sluice
#

Sp I finally bought the spigot plugin development course on udemy

#

Im excited to start learning 😌

vocal cloud
#

Don't need a paid course Sadge

regal scaffold
#

With that logic you don't need to go to college or study at all. Pretty flawed

vocal cloud
#

There's not enough to be worth a paid course material wise

regal scaffold
#

It's like 9 bucks

vocal cloud
#

Not to mention the shear amount of free stuff out there

regal scaffold
#

There's free stuff for everything. Literally everything you would possibly want

vocal cloud
#

Correct

regal scaffold
#

That doesn't mean paid courses are bad tho

vocal cloud
#

If you can get the same quality of content for free

#

In reality a vast majority of these courses are learnjava in disguise

quaint mantle
regal scaffold
#

No matter how much experience you have. Having a degree will never be overlooked by an employer

quaint mantle
wet breach
# regal scaffold That doesn't mean paid courses are bad tho

The only advantage a paid course has that free doesnt is the one on one time with someone who is supposed to be pretty knowledgeable where they can teach you some of the pitfalls or some pretty niche stuff you just wont really learn from random guides. Kind of like how i know some things with the jvm at times you just really wouldnt find resources for

regal scaffold
#

I understand how it might look. especially entry level jobs. unfortunately the stats back up my statement, Degrees to matter if you want to progress

wet breach
#

But if the course doesnt offer this then the cost is whether you think it is quality enough to warrant buying the materials

regal scaffold
#

Oh yeah 100% frost, makes a lot of sense

quaint mantle
halcyon hemlock
#

let's go, it finally works

regal scaffold
#

Not what I said. I said for a starting position degrees matter less. It's not a guarantee either

#

But there will be a moment where you want to go from earning 40k a year to 80k a year. And a degree is gonna make a massive impact in achieving that

#

We're talking general stats. Not specific per person cases

quaint mantle
#

I think personally, I'd stick to not having student debt until I absolutely need the degree.

onyx fjord
#

U pay for school in US?

wet breach
#

You are better off getting experience first then you are to go with degree first in most things. The exception to this rule is specializing or the job you want is a specialty

lost matrix
#

US problems...

onyx fjord
#

Lol what if u fail for example

regal scaffold
#

There are indeed ways to study and get degrees for free

#

Don't fail?

quaint mantle
wet breach
#

Experience will earn you more and you will be ahead of peers by the time they make it to the work force

onyx fjord
#

2000 per year?

halcyon hemlock
regal scaffold
#

If you fail theres 2 options. You either not made for the job or you didn't put enough effort in

quaint mantle
onyx fjord
#

Lmao

regal scaffold
lost matrix
halcyon hemlock
onyx fjord
#

In Poland you get paid for doing courses

swift sequoia
halcyon hemlock
onyx fjord
#

But that's one time per year thing

quaint mantle
wet breach
#

There is some jobs in the us or employers i should say that have no problems paying you to go to school while employed and i mean where they pay all or most of the tuition costs

onyx fjord
#

They offered us paid English course, it was 25k for two weeks

lost matrix
regal scaffold
#

But that just makes my point stronger

onyx fjord
#

I'm like dude I can buy two cars for that

wary topaz
regal scaffold
#

Degrees to matter the further you wanna get into your career

regal scaffold
regal scaffold
wary topaz
#

?

wet breach
#

But what i said earlier in regards to being ahead of peers if you went into the workforce first before college. By the time someone got their bachelors and you have been doing pretty steady job wise. You should be in leadership management by the time they finally get to apply to a job with their degree

onyx fjord
#

Students also don't pay taxes

lost matrix
onyx fjord
#

So usually you study and work

regal scaffold
#

Of course frost

#

That is correct

regal scaffold
#

This

onyx fjord
#

Free tax evasion

regal scaffold
#

Is what smart people do

wary topaz
#

What even is a name spaced key(I looked at the docs and I just dont understand)

onyx fjord
#

Love it

#

I WILL evade taxes

wet breach
regal scaffold
lost matrix
regal scaffold
#

TLDR: Degrees do matter

wet breach
onyx fjord
#

What's a degree

regal scaffold
#

btw that paid course on udemy is like 9 bucks

#

I guarantee you will learn something to make those 9 bucks back lol

swift sequoia
lost matrix
onyx fjord
#

I hunt udemy 100% discounts

regal scaffold
#

Sure if you wanna live with little to no money and struggle a lot waiting for a chance to get lucky in life then having the ability to build on top of that luck. Yes

onyx fjord
#

Yesterday got a networking java course

wary topaz
#

NamespacedKey key = new NamespacedKey(1, 2)
What should I replace 1 & 2 with?

onyx fjord
#

Hover on it if in intellij

regal scaffold
#

fk

wary topaz
#

@NotNull String namespace, @NotNull String key

regal scaffold
#

smile

lost matrix
#

sniped

regal scaffold
#

0-1

wary topaz
#

What is a namespace?

wet breach
#

To get in the corporate world and progress in said world it isnt about what you know but who you know

quasi flint
lost matrix
quasi flint
#

That says for internal use only

wary topaz
#

@NotNull Plugin plugin, @NotNull String key

regal scaffold
#

You can figure that out for sure

wary topaz
#

this, "?"

regal scaffold
#

Do you want your key to be ?

wary topaz
#

key?

#

no like what should key be

#

my plugin name?

regal scaffold
#

A string, according to the javadocs

wet breach
#

Your identifier

quasi flint
#

A unique identifier for your recipe

regal scaffold
#

It's a identifier for the namespace you're making

wary topaz
#

I'll name it, "Revive Token"