#help-development

1 messages ยท Page 1466 of 1

wet breach
#

so mojang obfuscates the client and server jars

queen dragonBOT
stuck kindle
#

Im coming into this with almost no knowledge on creating a minecraft client, should have mentioned it beforehand

wet breach
#

when you decompile, its pretty much going to decompile with random class names, method names etc

stuck kindle
#

yeah, I can see that lol

wet breach
#

the mappings, clears up some of this and maps some of the obfuscated parts back into something legible

stuck kindle
#

a.class

lofty mulch
weak mauve
#

line 130

wet breach
#

that step is called remapping

#

so before you decompile, you use the mappings file that mojang provides, use a tool that can use said mappings, and remap the jar first. This way when you decompile, some of the code is legible and makes sense

#

mojang doesn't release mappings for the entire code, just to code that is mostly relevant such as world classes, player classes etc

stuck kindle
#

use a tool that can use said mappings, and remap the jar first
Do you mean the ide(in my case intellij), or is there another tool for this?

lofty mulch
#

ProGuard

wet breach
#

there is another tool

stuck kindle
#

ah

wet breach
#

ProGuard doesn't remap @lofty mulch

stuck kindle
#

what tool then?

lofty mulch
#

no i meant

#

the lib obfuscate the code lol

#

sorry im typing fast

stuck kindle
wet breach
#

I use this one

#

mainly because it will download the mappings for you

lofty mulch
#

so what's about the decompiler?

wet breach
#

just have to put on the command line which version you want ๐Ÿ˜‰

stuck kindle
#

ah, and after I run that I can get the jar of the version, which I can then modify?

lofty mulch
#

not yet

wet breach
#

so after you use that tool, you are going to then decompile the jar

#

I personally use Fernflower

lofty mulch
#

y not forgeflower

wet breach
#

however there is other decompilers

stuck kindle
#

I can't use intellij's built in decompiler?

lofty mulch
#

intellij is fernflower

weak mauve
#

l

stuck kindle
#

oh

wet breach
#

modified fernflower

#

is intelliJ's

stuck kindle
lofty mulch
#

then compile

stuck kindle
#

then compile yeah

lofty mulch
#

put it into versions and run

wet breach
#

Well can't compile

lofty mulch
#

ah i forgot the lib things

stuck kindle
#

no recompiling?

wet breach
#

have to fix decompiler stuff before recompiling

lofty mulch
#

โ›„

wet breach
#

decompiled classes are not re-compilable

#

so have to fix them first

stuck kindle
#

jesus I've read the word compile so many times it doesn't seem like a word anymore XD

lofty mulch
#

well @wet breach just let him do 3 first steps first

stuck kindle
#

actually ye

#

let me do them real quick

lofty mulch
#

no it's not lol

wet breach
#

lol real quick XD

lofty mulch
#

decompiling took a lots of time

stuck kindle
#

that long?

wet breach
#

it takes a few minutes

lofty mulch
#

4-8mins

#

if auto

#

lol

wet breach
#

but its going to take you longer since you never done it before

#

and never messed with the various options of fernflower ๐Ÿ˜›

#

such as needing to kill LVT

lofty mulch
#

ah yes

#

โ›„

wet breach
#

to get rid of all the snowmen

#

XD

weak mauve
#
        Class.forName("me.superischroma.spectaculation.item.SMaterial"); // ensuring materials are loaded prior to this
        for (SMaterial material : SMaterial.values())

the complie mark this red

stuck kindle
#

bruh I've never really had to decompile except for a couple mods/plugins I wanted to look into

lofty mulch
#

class.forname?

wet breach
#

@stuck kindle yeah that is easy decompiling

mortal hare
#

yep

lofty mulch
wet breach
#

this is a bit more advanced then just decompiling plugins XD

mortal hare
#

Class.forName() throws exception if a class hasnt been found

#

great way to detect if the class is loaded by class loader

stuck kindle
#

alright, downloaded the git project

mortal hare
#

Fernflower is literally Intellij IDEA's built in java decompiler

lofty mulch
#

tbh I prefer using ForgeFlower lol

lofty mulch
wet breach
#

anyways, you have some information, just start playing around with it @stuck kindle ๐Ÿ™‚

#

and just know, that if things don't go right its fine

#

just start over and try again XD

stuck kindle
#

alright

lofty mulch
#

backup first

#

always

mortal hare
#

wdym

weak mauve
#

can anyone help me?

lofty mulch
queen dragonBOT
#

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.

wet breach
#

depends how far they get before they get to a spot where backing up is necessary @lofty mulch

lofty mulch
mortal hare
#

now that's a fatass enum class right here

lofty mulch
#

i think it's neccessary for the first time

wet breach
#

what I mean, is they could screw up the decompiling probably the first 6-8 times ๐Ÿ˜‰

lofty mulch
#

๐Ÿ˜

mortal hare
#

question is why would you include the every single item in the game

#

half of them aren't used

lofty mulch
#

multivers i suppose

mortal hare
#

oh

#

its some kind of enum adapter class

lofty mulch
#

it's not my project so @weak mauve

#

tbh i dont see anything wrong in dat enum class

stuck kindle
#

what does gradlew.bat do?

#

usually*

lofty mulch
#

uhhhhh

#

support building project

#

you dont have to install gradle

#

just use gradlew.bat <task>

#

it's going to use gradle wrapper to build

stuck kindle
#

I've used gradle like 3 times so uh

wet breach
#

gradle does what maven does just differently. So its another build system

#

use which ever you prefer

lofty mulch
#

prefer using gradle in my case โ™ฟ

mortal hare
#

gradle is better but im too lazy to adapt

#

it looks JSONy

wet breach
#

sometimes is better

lofty mulch
#

gradle isn't better most everytime lol

wet breach
#

for most projects you will see the exact same performance

lofty mulch
#

kotlin dsl is kinda slow

stuck kindle
#

idk I like maven

mortal hare
#

i dont state about performance

#

i state about usability

#

of the software

lofty mulch
#

maven is stable

wet breach
#

maven has the ability to compile concurrently as well as you can give it more resources, most people just don't bother to learn this

mortal hare
#

it seems more cleaner

lofty mulch
#

lol

mortal hare
#

than to deal with xml's

lofty mulch
#

uhhhhhhhh

#

not really

#

but it's good for custom scripts

#

without creating new plugin

paper viper
#

lol

lofty mulch
#

m4v3n is good

wet breach
#

what I like about maven, is the ability to create custom plugins super easily to do whatever it is you want

lofty mulch
#

gradle is good too

mortal hare
#

both are great

#

but i prefer gradle's cleanliness

#

of the config

lofty mulch
#

that's your choice lol

paper viper
#

Ngl im not a big fan of xml structure because of how much unnecessary ending tags and beginning tags it creates tho

stuck kindle
#

Could not find tools.jar. Please check that C:\Program Files\Java\jre1.8.0_271 contains a valid JDK installation.
?

mortal hare
#

i couldn't imagine writing complex project pom xml by hand

weak mauve
#

Error occurred while enabling Spectaculation v1.0-SNAPSHOT (Is it up to date?)
java.lang.Error: Unresolved compilation problem:
Unhandled exception type ClassNotFoundException

at me.superischroma.spectaculation.Spectaculation.onEnable(Spectaculation.java:129) ~[?:?]
mortal hare
#

its like writing a static website

stuck kindle
#

invalid jdk installation? Do I need to use another version or something?

wet breach
lofty mulch
#

lol

wet breach
#

literally can make maven plugins do anything you want it to

mortal hare
#

in order to make maven plugin you need to code

#

code = code.

wet breach
#

I am pretty sure if you are using maven

stuck kindle
#

nvm found the solution

wet breach
#

odds are you are a developer

stuck kindle
#

im just dumb

lofty mulch
#

nonononono

#

just learn

mortal hare
#

i never developed a custom maven plugin

lofty mulch
#

learn more learn more

mortal hare
#

so i don't know actually

#

i mean yea

wet breach
#

super easy

mortal hare
#

there's plugins

stuck kindle
#

alr

mortal hare
#

like shading stuff

#

is pretty useful

#

or compiler plugin

#

apart from that i haven't used them much

#

im more interested in C langs right now than Java idk

wet breach
#

well, if you don't like maven's xml stuff all that much

#

you can just create a plugin to use whatever config style you want

mortal hare
#

i mean its not bad with autocomplete

#

most of the things are autocompleted anyways

#

since markup is pretty easily autocompletable

#

compared to other syntax languages

#

cmake is pretty powerful build system for C

wet breach
#

well either way, just like to point out mavens versatility since most forget that making custom plugins is a thing for maven >>

mortal hare
#

you literally have a separate "programming language"

#

with for loops

#

variables

#

and its cross platform

wet breach
#

can be

#

well cmake is cross platform yeah

#

your code on the other hand, not necessarily so

mortal hare
#

yep

wet breach
#

if I am making cross platform projects, I only worry about windows and some linux distro's

#

I don't care for apple

stuck kindle
#

how do I build with gradle? tried running gradlew build but keep on getting
Could not find tools.jar. Please check that C:\Program Files\Java\jre1.8.0_271 contains a valid JDK installation.

#

probably simple

wet breach
#

need JDK of java 1.8

#

or just install an updated version of java that is java 11 or higher

#

where the JDK and JRE are not separated

stuck kindle
#

I have java 8 and se dev kit 13

wet breach
#

ah, then its a path problem

#

you need to manually point gradle to the JDK directory instead

#

currently windows has the JRE set as the default java version on the path

stuck kindle
#

Tried using

SET JAVA_HOME=C:\Program Files\Java\jre1.8.0_271

#

in cmd prompt

#

apparently this worked for some

wet breach
#

even if that worked that directory is incorrect for the JDK version

#

the directory you have is for the JRE version, which is not the one you need

stuck kindle
#

ah

#

C:\Program Files\Java\jdk-13.0.2?

wet breach
#

there you go

#

that is the directory for java jdk 13

#

you can use that, or use the 1.8 jdk

#

personally I would stick with java 11 or higher

paper viper
#

Alright, I'm going to need some math help here because I just can't stand vectors. So I basically just literally want to spawn an X by Y wall in front of the user. Suppose the following examples:


P -> Player
W -> Wall

In the case the user wants a 5x5 wall:

W W W W W
    P

(birds-eye view. It is 5 blocks across, 5 blocks height, and 1 block thick)

For an even number like a 4x5 wall:

W W W W
    P

(birds-eye view. It is 4 blocks across, 5 blocks height, and 1 block thick)

stuck kindle
#

tried it, same error

#

Could not find tools.jar. Please check that C:\Program Files\Java\jre1.8.0_271 contains a valid JDK installation.

paper viper
#

here is the code I got so far:

  public void buildMapScreen(
      @NotNull final Material mat, final int width, final int height, final int startingMap) {

    final Vector direction = location.getDirection();
    final Location center = location.clone().add(direction);

    final Location rotate = location.clone();
    rotate.setPitch(0);
    rotate.setYaw(location.getYaw() - 90);
    final Vector rotation = rotate.getDirection();

    final Location blockLocation = center.clone().add(rotate).subtract(0, width / 2f, 0);
    rotate.multiply(-1);

    final int initialX = blockLocation.getBlockX();
    final int initialZ = blockLocation.getBlockZ();
    final World world = Objects.requireNonNull(location.getWorld());
    for (int x = 0; x < width; x++) {
      for (int y = 0; y < height; y++) {
        final int map = startingMap + x * y;
        final Block block = blockLocation.getBlock();
        block.setType(mat);
      }
      blockLocation.add(0, 1, 0);
      blockLocation.setX(initialX);
      blockLocation.setZ(initialZ);
    }
  }

(location -> player location)

#

(sry for interrupting)

stuck kindle
#

It's looking for C:\Program Files\Java\jre1.8.0_271, is there a place where I can change where it looks?

wet breach
#

@paper viper to get an even square it has to have odd numbers

stuck kindle
#

all good

wet breach
#

uh you should be able to set somewhere in the gradle file where to look

#

or you can mess with the windows path environment settings

#

which there are tutorials on doing that

lofty mulch
#

or just download adoptopenjdk

#

it has set JAVA_HOME option

wet breach
#

just google setting java environment variable for windows

stuck kindle
#

ok

wet breach
#

@paper viper ok, if you want to spawn a wall in front of the player why do you need vectors?

paper viper
#

Not sure

#

I saw a spigot tutorial about it

#

and they used vectors

wet breach
#

I mean you have the players location

#

and you already know how large you want the box

paper viper
#

I need to get the direction the player is looking at, get that direction location but 1 block in front of them

#

and spawn the blocks there

#

my english is shit

#

lmao

stuck kindle
#

ay it finally works

#

Nevermind...

#

right as i say it

#

ill figure it out tmr cause Im way too tired rn and my brain won't function properly, but ty everyone for the help

#

gn

wet breach
#

returns the cardinal direction, thus no need for vectors lol

paper viper
#

Ah

wet breach
#

vectors are handy, but not needed for most things. They come i handy when you don't have all the information and need to dynamically do stuff inside of a box

#

or if you need to figure out trajectories

#

but you pretty much have all the information, only thing you just need to obtain is the direction for the player and then put a wall where you want based on the players location ๐Ÿ™‚

young knoll
#

Weโ€™ll build a wall and make vectors pay for it

wet breach
#

lol

#

@young knoll there is a vector in the discord

#

so I assume you mean that

#

๐Ÿ˜‰

wicked shale
#

build a wall?

wet breach
#

@plush citrus

quaint mantle
#

Has anyone tried to make a better Roller Coaster plugin than Train Carts'

young knoll
#

Can minecarts actually be rotated like that

#

Looks very fancy

quaint mantle
wet breach
#

like upside down and sideways

#

otherwise, can't really have a decent roller coaster plugin XD

quaint mantle
#

the cart can but the player no

young knoll
#

Interesting

mystic ivy
#

I want to create a plugin where I need to store extra data with blocks in the world. To do this I thought I would implement my own data system whereby whenever a chunk loads I load the extra data and whenever it saves I save the data. ChunkLoadEvent works for the loading, I thought ChunkUnloadEvent where event.isSaveChunk() is true would world work for saving but it doesn't. When you stop the server and all the chunks are saved this event isn't fired. It also isn't fired with the /save-all command (I guess because the chunks are not being unloaded, only saved). How do I listen for chunks saves no matter what?

compact haven
#

@mystic ivy this has already been done for you

mystic ivy
#

With items it's like this itemStack.getItemMeta().getPersistentDataContainer(); but I didn't think you could do that with blocks because they don't have NBT data. (Or at least non-bockentity blocks don't)

sage swift
compact haven
#

ah ddint know persistentdatacontainer didnt have an interface for blocks, only entities and items

#

but yeah redlib has something like that

plush citrus
keen kelp
#

how do I get a Player object from AsyncPlayerPreLoginEvent

#

or is that not possible as the player doesn't exist yet or whatever

#

cause my hashmap uses Player objects and not uuid, if i can't get a Player out of it I'd have to rewrite lotta things

sage swift
#

player objects don't even stay the same between sessions

#

switch to uuid.

quaint mantle
#

any good title api for 1.8 to 1.16?

quaint mantle
# quaint mantle any good title api for 1.8 to 1.16?
public static void sendTitle(Player player, String mainTitle, String subTitle, int duration, int fadeInTime, int fadeOutTime) {
        PacketPlayOutTitle times = new PacketPlayOutTitle(PacketPlayOutTitle.EnumTitleAction.TIMES, null, fadeInTime, duration, fadeOutTime);
        PacketPlayOutTitle title = new PacketPlayOutTitle(PacketPlayOutTitle.EnumTitleAction.TITLE, IChatBaseComponent.ChatSerializer.a("{\"text\":\"" + ChatColor.translateAlternateColorCodes('&', mainTitle) + "\"}"), fadeInTime, duration, fadeOutTime);
        PacketPlayOutTitle sub = new PacketPlayOutTitle(PacketPlayOutTitle.EnumTitleAction.SUBTITLE, IChatBaseComponent.ChatSerializer.a("{\"text\":\"" + ChatColor.translateAlternateColorCodes('&', subTitle) + "\" }"), fadeInTime, duration, fadeOutTime);

        ((CraftPlayer) player).getHandle().playerConnection.sendPacket(times);
        ((CraftPlayer) player).getHandle().playerConnection.sendPacket(title);
        ((CraftPlayer) player).getHandle().playerConnection.sendPacket(sub);
    }
quaint mantle
#

ty

pliant copper
#

I'm using protocollib to cancel certain chat messages (from plugins), but how would I check if a message is sent from the server or a player chatting if the chatformat is changed? java ProtocolLibrary.getProtocolManager().addPacketListener(new PacketAdapter(ChatTest.getInstance(), Server.CHAT) { @Override public void onPacketSending(PacketEvent event) { // Determine if the message is from a player or a plugin using Player#SendMessage } }); @ me please <3

sage swift
#

@pliant copper

#

done.

pliant copper
sage swift
#

i thought you were Rayrnond

pliant copper
#

I am.

sage swift
#

but you just said you're serious

pliant copper
#

Iโ€™m very aware of that. Iโ€™m trying to check if the packet is sent from a player sending a chat message OR a plugin sending the player a message.

weak mauve
#
Connection connection = DriverManager.getConnection("jdbc:sqlite:" + file.getAbsolutePath());
#

i found this

#

i thought getConnection must be an URL

keen kelp
#

gradle or maven

maiden briar
#

module bungee reads package net.md_5.bungee.api from both bungeecord.api and bungeecord.chat, the chat and the api arctifact both have classes in the net.md_5.bungee.api package so this is impossible?

sage swift
#

simple log message when the packet is sent/received, tells you a lot about when it's being used

maiden briar
keen kelp
#

what happened here
Could not find method compileOnly() for arguments [org.spigotmc:spigot-api:1.16.5-R0.1-SNAPSHOT] on object of type org.gradle.api.internal.artifacts.dsl.dependencies.DefaultDependencyHandler.

sullen marlin
#

@maiden briar you cant use modules with bungee/spigot

maiden briar
#

Yes, but it's a feature from Java 9+

#

And if Minecraft goes over to 1.17, it will probably use this feature

coarse anvil
#

Hi does anyone know how to get the chunks of a pasted schematic and load them? I am using FAWE

sage swift
#

worldedit has a discord

keen kelp
#

I gave up using gradle for now

#

I tried it but it just built an empty jar

ivory sleet
keen kelp
#

Migrating from an exisiting project is too hard

ivory sleet
#

Depends, it can be confusing if never done before

keen kelp
#

yes

#

I have never done this before

ivory sleet
#

Ah yeah sad I got here too late then

keen kelp
#

and if I have any future projects I would def start with gradle

ivory sleet
#

๐Ÿ‘๐Ÿ‘

keen kelp
#

there is no easy way to migrate yes?

ivory sleet
#

It usually takes 2 seconds to do

keen kelp
#

oh?

#

Im using Intellij can you help me with moving to gradle?

maiden briar
#

I have a problem with my Maven multi-module project: If I have a distribution module which compiles the other 3 modules, I only get one module-info.java (distribution module), the others are away

keen kelp
#

it just sounds so useful

ivory sleet
#

Install gradle there first

#

Then we can go inside the terminal in your project and write gradle init

keen kelp
#

ok

#

apt would be fine yes?

#

or do you not use debian

#

or however you spell it

ivory sleet
#

I did it manually

#

But probably fine

keen kelp
#

cool

ivory sleet
#

I use windows btw ๐Ÿ˜›

keen kelp
#

ohhh

ivory sleet
#

Should be fine regardless

keen kelp
#

I'm on linux just cause the development server and the panel runs on linux so yeah

#

I mean gradle is java so it should be 100% cross platform

ivory sleet
#

True

keen kelp
#

the only non-cross-platform java programs are badly made ones

ivory sleet
#

Indeed

#

Or I mean most of the times

keen kelp
#

I mean most java programs made without other OSes in mind works just fine

ivory sleet
#

Yeah

#

@paper viper ๐Ÿ‘€

#

Anyways go ahead and finish that guide on how to install gradle and then lmk

keen kelp
#

ok gradle init, then?

ivory sleet
#

Yeah

#

Like inside the project

keen kelp
#

mhm

#

I just opened up terminal in idea

#

and now I got the gradle files

#

what next

ivory sleet
#

Perfect

#

Did you finish the init?

#

It usually asks for a couple of setup questions

keen kelp
#

no?

#

eric@EricPC:~/IdeaProjects/gamemanager$ gradle init
Starting a Gradle Daemon (subsequent builds will be faster)

BUILD SUCCESSFUL in 1s
2 actionable tasks: 2 executed

ivory sleet
#

Oh

#

Wel did you get the files then?

keen kelp
#

yes

ivory sleet
#

Then it should be no problem

keen kelp
#

build.gradle and all the shebang

ivory sleet
#

Pog

keen kelp
#

now intellij is asking me if I want to load the gradle build scripts

ivory sleet
#

So do you know how to use gradle or no? I presume you do but yeah

#

Yeah

keen kelp
#

well a bit

ivory sleet
#

Do that

keen kelp
#

when I was making forge mods

ivory sleet
#

Oh yeah

keen kelp
#

but back then it was just download template, run a few setup commands

#

and gradlew.bat build

ivory sleet
#

Like maven the tasks can be found at a sidebar to the right

keen kelp
#

gradlew.bat runClient

#

breh

#

distributionUrl=https://services.gradle.org/distributions/gradle-4.4.1-bin.zip
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStorePath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME

#

4.4.1 nice

ivory sleet
#

Lol

#

I use 6.7

#

As of now

keen kelp
#

gonna make that 7.0.2 real quick

ivory sleet
#

Ah yeah

keen kelp
#

now I pressed the little button and what next

#

the refresh thing

#

I do know Im gonna need this button a lot

ivory sleet
#

This guy explains some usage of it quite good

keen kelp
#

ah yes helpchat

ivory sleet
#

Yeah

keen kelp
#

do I follow this?

ivory sleet
#

If you just wanna set the plugin up

keen kelp
#

Im tryna migrate

ivory sleet
#

Didnโ€™t you finish that?

keen kelp
#

oh so I do the set up thing now?

ivory sleet
#

Yeah the build.gradle

keen kelp
#

cool thanks

ivory sleet
keen kelp
#

ok I got a newest gradle on my PC

#

since it was like 4 or smth

#

now I do get a choice

#

which do I choose

#

I ran gradle init

#

@ivory sleet

ivory sleet
#

Uh what does it say

keen kelp
#

1 - 4

#

like project type

#

I suppose basic?

ivory sleet
#

Yes

keen kelp
#

Groovy or kotlin

ivory sleet
#

Groovy

keen kelp
#

ok

ivory sleet
#

More people use groovy so in the start I recommend groovy

keen kelp
#

in this guide

#

it said to add some lines to pom.xml

#

but I dont have that file?

#

do I create it

ivory sleet
#

Wait did you use maven before this?

keen kelp
#

no?

ivory sleet
#

Okay then skip that

keen kelp
#

kk

#

what do I make the group be

#

the first 2 layers on my package name?

#

hk.eric.plugin
and my group name would be hk.eric?

ivory sleet
#

Uh yeah you could go with that. Buts itโ€™s usually your domain in reverse

lost matrix
#

I personally think starting with maven as your dependency manager is more appealing in the Spigot environment.

keen kelp
#

I dont have a domain~~~

ivory sleet
#

It really doesnโ€™t matter tbf

#

Go with the package name lau

#

You can always change it later

keen kelp
#

that's just my username, Imma just make it hong kong

ivory sleet
#

Yeah, groupId becomes slightly more crucial when you publish your jars but yeah as of now itโ€™s quite insignificantly important

lost matrix
#

You have quite a bit more resources and more people will be able to help you.

#

But in the end it doesnt really matter that much

keen kelp
#

also iirc some ppl link the gradle version and the version in plugin.yml?

#

how do I do that

ivory sleet
#

Thereโ€™s a lot of people here whoโ€™s knowledgeable about gradle

#

processResources

eternal oxide
#

Most of those who actually help use Maven though. Only the odd couple of helpers use gGradle

paper falcon
#

there should be multiple help-development channels

keen kelp
#

to help multiple people at a time?

paper falcon
#

when multiple people ask for help, it makes mess in one chnanel

ivory sleet
#

So uh in your build.gradle

processResources {
  expand "pluginVersion": project.version 
}```
then in your plugin.yml
```yml
version: ${projectVersion}```
chrome beacon
#

At this point my DMs have become a help-development channel ;/

ivory sleet
#

๐Ÿ˜”

keen kelp
#

rip

keen kelp
#

hmmm

#

Could not find commons-lang:commons-lang:2.6.

ivory sleet
#

Uh howโ€™s your build.gradle looking

keen kelp
#

/*

  • This file was generated by the Gradle 'init' task.
  • This is a general purpose Gradle build.
  • Learn more about Gradle by exploring our samples at https://docs.gradle.org/7.0.2/samples
    */
    plugins {
    id 'java'
    }

group 'EE.ric'
version '1.0.0'

repositories {
maven { url 'https://oss.sonatype.org/content/repositories/snapshots' }
maven { url 'https://hub.spigotmc.org/nexus/content/repositories/snapshots/' }
}

dependencies {
compileOnly 'org.spigotmc:spigot-api:1.16.5-R0.1-SNAPSHOT'
}

processResources {
expand "pluginVersion": project.version
}

chrome beacon
#

?paste

queen dragonBOT
ivory sleet
#

add mavenCentral() in the repositories block

keen kelp
#

why is it cs lel

#

yep that fixed it

ivory sleet
#

Pog

keen kelp
#

now Ive done that

#

Tasks > build > jar?

ivory sleet
#

yeah

#

Just run build

#

Thatโ€™s enough

keen kelp
#

:/

#

still got a 261b file

#

like when I was attempting myself

ivory sleet
#

Oh

keen kelp
ivory sleet
#

Uh so where is your classes located

keen kelp
#

main is at hk.eric.main

ivory sleet
#

No like the folders

acoustic palm
keen kelp
#

${projectRoot}/src/hk/eric/main.java

ivory sleet
#

Thatโ€™s the issue

eternal oxide
ivory sleet
#

you will have to move them to
src/main/java/hk/eric/main.java

acoustic palm
#

that's what it looked like you were implying

keen kelp
#

can I not change it in gradle?

#

ok sure

ivory sleet
acoustic palm
#

also, Gradle has an entire official wiki with pretty much everything you'd ever need to know on it

eternal oxide
#

SO does Maven

acoustic palm
#

so they're both equal in terms of available support then

eternal oxide
#

No, in this channel/Spigot the majority use Maven so support is better for Maven

acoustic palm
#

true

eternal oxide
#

I was really just saying that he's likely going to find it harder to obtain support here for gradle then maven, but which he chooses is upto him, as alwasy

acoustic palm
#

ah fair enough

keen kelp
#

do I have to

acoustic palm
#

do you have to what?

keen kelp
#

include the plugin.yml and sutff

ivory sleet
#

I am here so new gradle users can live a pog life

acoustic palm
#

yes

keen kelp
#

in the java folder aswell

ivory sleet
#

No

acoustic palm
#

no

#

put it in resources

ivory sleet
#

src/java/resources/plugin.yml

acoustic palm
#

src/main/resources/plugin.yml

keen kelp
#

ok

ivory sleet
#

Ok

acoustic palm
#

Conclure wake up :kekw:

ivory sleet
#

Lol

#

Uh

#

Yeah do what Bbg said

acoustic palm
#

main is the name of the source set

eternal oxide
#

Nice of you to volunteer to be the official Gradle support for Spigot ๐Ÿ™‚

keen kelp
#

damn

#

intellij is pog

acoustic palm
#

yeah I came here too because Conclure told me people were hating on Gradle in the Spigot Discord again lol

#

which, as I found out, isn't true, but hey ho, I'm here now lol

keen kelp
#

it recommended me the directory name resources when I create new

acoustic palm
#

yeah it does that

#

it knows that folder is recognised as resources

#

and it can pick up from Gradle that main is the name of the source set

keen kelp
#

Missing property (projectVersion) for Groovy template expansion. Defined keys [pluginVersion, out]

acoustic palm
#

show build

keen kelp
#

Could not copy file '/home/eric/IdeaProjects/pluginname/src/main/resources/plugin.yml' to '/home/eric/IdeaProjects/pluginname/build/resources/main/plugin.yml'.
Missing property (projectVersion) for Groovy template expansion. Defined keys [pluginVersion, out].

acoustic palm
#

I said show build lol

#

I mean show me your build configuration

keen kelp
#

what build

acoustic palm
#

a.k.a your build file

ivory sleet
#

Did you add the processResources expand thing

acoustic palm
#

sorry if that wasn't immediately clear ๐Ÿ™‚

wraith rapids
#

processresources expand DONG

keen kelp
#

bruh

#

my discord crashed

acoustic palm
#

lol

ivory sleet
#

Lol

wraith rapids
#

typical pisscord

keen kelp
#

/*

  • This file was generated by the Gradle 'init' task.
  • This is a general purpose Gradle build.
  • Learn more about Gradle by exploring our samples at https://docs.gradle.org/7.0.2/samples
    */
    plugins {
    id 'java'
    }

group 'EE.ric'
version '1.0.0'

repositories {
mavenCentral()
maven { url 'https://oss.sonatype.org/content/repositories/snapshots' }
maven { url 'https://hub.spigotmc.org/nexus/content/repositories/snapshots/' }
}

dependencies {
compileOnly 'org.spigotmc:spigot-api:1.16.5-R0.1-SNAPSHOT'
}

processResources {
expand "pluginVersion": project.version
}

#

linux discord is the least maintained branch ever

#

change me mind

ivory sleet
#

Yeah and then did you reload the gradle project?

wraith rapids
#

linux discord is the same as windows discord

keen kelp
#

imma reload it again

#

no

wraith rapids
#

the electron binaries are just different

keen kelp
#

we get double back/forward

#

which is very pog

#

very :)

wraith rapids
#

the whole point of using electron is that they don't need to spend effort on actually making it work on different environments

keen kelp
#

yeah idk

wraith rapids
#

they just write a webpage and then bundle in a browser and call it an application

keen kelp
#

maybe electron on linux alr have a back/forward feature

#

and they just implemented it again

#

ik electron is a chromium

wraith rapids
#

ripcord also has back/forward

keen kelp
wraith rapids
#

and also tabs

keen kelp
#

no I mean 1 back/forward button triggers twice

wraith rapids
#

what is that supposed to mean

keen kelp
#

like when I press the mouse 4

#

it triggers once

#

and when I release mouse 4

#

it triggers again

wraith rapids
#

sounds gay

keen kelp
#

yes

#

very gay

#

@ivory sleet I reloaded gradle but still

ivory sleet
#

okay so what did you put in plugin yml

keen kelp
#

and plugin.yml is located in /src/main/java/resources/plugin.yml

ivory sleet
#

Send ur plugin yml

#

(:

keen kelp
#

name: PluginName
version: ${projectVersion}
author: EEric
main: hk.eric.pluginname.main
api-version: 1.16
load: STARTUP
commands:

ivory sleet
#

Change to pluginVersion

#

Since thatโ€™s what you defined in expand

keen kelp
#

wait is it

#

Im blind mann

#

bruhhh

ivory sleet
#

Lol

keen kelp
#

me si so blid

wraith rapids
#

why not just directly use project.version in plugin.yml

ivory sleet
#

I think this is like one of the gradle overheads

#

You would have to define those variables then if thatโ€™s possible

keen kelp
#

last thing

ivory sleet
#

It doesnโ€™t automatically interpolate variables like that

keen kelp
#

how do I make it auto-deploy

ivory sleet
#

Elaborate

wraith rapids
#

so its objectively worse then maven

#

good to know

keen kelp
#

like after I run, auto-copy it to a sftp server

#

run => Run pluginname[build]

#

and after it builds successfully

#

copy the result to a sftp

#

just make it deploy

ivory sleet
#

I think thereโ€™s a plugin for that

wraith rapids
keen kelp
#

sowwy me discord crashed

#

again

ivory sleet
#

Misscord

keen kelp
#

doesn't Intellij have their own deployment system

#

can I not use it?

ivory sleet
#

Sure they do

wraith rapids
#

not when you're building with gradle

keen kelp
#

ok

wraith rapids
#

or, well, maybe, i'm not totally sure how that goes

#

it's possible i'm sure

ivory sleet
#

You have configs but yeah using gradle is better

wraith rapids
#

but probably not ideal

ivory sleet
#

^

wraith rapids
#

i mean, you could use your os to mark the target directory as a remote directory and hook it up to the ftp serbur

keen kelp
#

aaaaaand another crash

wraith rapids
#

and that'd make it happen without an ide at all

keen kelp
#

Im starting to believe discord hates me

wraith rapids
#

discord hates all living things that aren't pedophiliac furfags

keen kelp
#

so furries that likes kids?

#

wait I just realized

#

why is there a text channel in voice channels

wraith rapids
#

there's usually a tts enabled text channel in the voice section

#

for the people without mics

keen kelp
#

I see

wraith prawn
#

Hi everyone. Using Bungeecord, if I set a permission from it to allow of using command /gamemode in servers, does it has to work? I ask because I added to me that permission, but it doesn't work.

sullen marlin
#

No

#

Bungee permissions are only for bungee commands

keen kelp
#

is there a way to tell apart fire tick damage from fire and fire aspect?

keen kelp
#

No I mean

#

Fire and lava also sets you on firr

#

Tell apart the fire tick damage from that and FA apart

young knoll
#

No

#

Itโ€™s all fire

wraith rapids
#

fire aspect and all other things that set you on fire all increase the same fire tick value

#

they're not tracked separately

sullen dome
#

you can do that by using the point, where it set's him on fire. so smt like

int cause = 0;

if(set on fire by lava/fire){
  cause = 0;
} else if(set on fire by fire-aspect){
  cause = 1;
}
//and so on

and later just check for that

#

if i am not too tired

wraith rapids
#

the player can be on fire from multiple causes at the same time

#

they could be punched with fire aspect and be standing one foot in fire and another in lava

sullen dome
#

you could update it then

wraith rapids
#

yes but standing in the fire would only add a few ticks

#

lava adds significantly more

#

if you only update based on the last damage cause, you could sit in lava and accumulate 5 minutes worth of fire ticks

#

and then walk through fire for a split second, and your plugin would consider all of the fire_tick to come from the fire, rather than the lava, where it actually came from

#

you'd have to record a linked list of 'timestamps' and then expire those away as they wear off

sullen dome
#

true. i'm too tired lol

wraith prawn
keen kelp
#

Is there an actually good client for discord on linux?

#

It's been freezing completely every time I open it and wait for an undetermined amount of time

#

Ever since I upgraded to 21.04

wraith rapids
#

just use your simplified design electron shitshow, goy

keen kelp
#

What

wraith rapids
#

you don't need well designed or well performing software

keen kelp
#

What do

paper viper
quaint mantle
#

1.8 version it works on 1.9+

chrome beacon
#

Which line is 62

solemn shoal
#

the one numbered 62

#

but we cant see it here because no line numbers\โ„ข๏ธ

chrome beacon
#

...

hybrid spoke
#

xD

#

he marked it e = getNMSClass("PacketPlayOutTitle").getDeclaredClasses()[0].getField("TIMES").get((Object) null); // 62 code

chrome beacon
#

Oh lol

#

Well there's only one array there

#

So that array is the problem

dense goblet
#

How can I copy a banner's pattern onto another banner without messing up extra NBT on the other item?

quaint mantle
#

Is there any packet wrappers for 1.16

chrome beacon
#

PacketWrapper is compatible with 1.16

quaint mantle
wraith rapids
#

it clearly says why

quaint mantle
#

i clearly dont know why it tells me array problem

wraith rapids
#

because the array index is out of bounds

quaint mantle
#

which array

wraith rapids
#

the only array involved

quaint mantle
#

the version?

wraith rapids
#

getNMSClass("PacketPlayOutTitle").getDeclaredClasses()[0].getField("TIMES").get((Object) null)

quaint mantle
wraith rapids
#

yes

quaint mantle
#

it does with getNMSClass("PacketPlayOutTitle")

wraith rapids
#

i don't know because I don't have line numbers

#

there is an array access on line 80

#

and it is out of bounds

quaint mantle
#

this is 80 instance.log(""+getNMSClass("PacketPlayOutTitle"));

wraith rapids
#

the code you're looking at and the code that is being executed aren't the same then

#

getNMSClass is not present in the stack trace

#

which means that the execution has either not reached that method call, or has already passed it

foggy igloo
#

I think there are a bug with the signs i cant get the lines or edit the lines when i get the sign with a location.

Code:

if (loc.getBlock().getState() instanceof Sign) {
                Sign sign = (Sign) loc.getBlock().getState();
                Bukkit.broadcastMessage(sign.getBlockData().getAsString());
                Bukkit.broadcastMessage(Arrays.toString(sign.getLines()));
                Bukkit.broadcastMessage(sign.getLine(0));
            }```

Output:```
[15:18:31] [Server thread/INFO]: minecraft:oak_sign[rotation=8,waterlogged=false]
[15:18:31] [Server thread/INFO]: [, , , ]
[15:18:31] [Server thread/INFO]: ```

Ant yes there are text on the sign
quaint mantle
#

okay

foggy igloo
#

after a SignChangeEvent

chrome beacon
#

That's why

wraith rapids
#

the data has not changed at the time of that event being fired

chrome beacon
#

^^

wraith rapids
#

it is cancellable, which most of the time means that the event is fired before the thing happens

chrome beacon
#

Use the event to get the sign lines

wraith rapids
#

in this case, the "thing" is the sign changing

foggy igloo
#

should do like runTaskLater

wraith rapids
#

no

#

use the event's accessor methods to get the changed state

chrome beacon
#

^^

wraith rapids
#

this applies to all other events of the same style

#

f.e playertogglesneakevent

foggy igloo
wraith rapids
#

then use the setter methods on the event if they are present

quaint mantle
#

can somebody help me create a title using nms i dont know whats with it

wraith rapids
#

imagine if there was api for it

quaint mantle
#

imagine if the all apis didnt work bcz of the array error :)

wraith rapids
#

the array error is coming from your code

quaint mantle
wraith rapids
#

and then we go back to the answer I gave you the first time around

#

subtitleConstructor = getNMSClass("PacketPlayOutTitle").getConstructor(new Class[]{getNMSClass("PacketPlayOutTitle").getDeclaredClasses()[0], getNMSClass("IChatBaseComponent")});

#

array index out of bounds would indicate that there are no declared classes

quaint mantle
#

u literally just told me thats an array problem

#

but not how to fix it

wraith rapids
#

again, imagine if there was some sort of api for this thing developed by a community

#

rather than a myriad of scattered and broken and dead libraries

#

imagine if in five fucking years the 1.8 community would have managed to, i don't know, fork the API and backported and added the missing things to it

quaint mantle
#

then link here the best api for it ever

wraith rapids
#

imagine developing software for an ecosystem that isn't dead

quaint mantle
#

imagine saying imagine all the time

#

literally i asked for help not for imagines

wraith rapids
#

point is that your life choices revolving around 1.8 were bad ones and 1.8 sucks

#

and the "community" around 1.8 sucks too and never gets anything done

quaint mantle
#

okay well then tell me how to fix it? Class<?> chatSerializer = getNMSClass("IChatBaseComponent").getDeclaredClasses()[0];

wraith rapids
#

the best move is not to play

#

use 1.16.5

quaint mantle
#

and the thing that will help me?

wraith rapids
#

yes, that is the thing that will help you

#

1.16.5 has API for sending titles

quaint mantle
#

i said the thing that will help me

wraith rapids
#

that is the thing that will help you

quaint mantle
#

for fixing the error rly

wraith rapids
#

if you use a modern version, you can delete all of that shit tier code

#

and the error disappears

quaint mantle
#

oh thanks that actually fixed my error ๐Ÿ‘

wraith rapids
#

you're welcome

warm galleon
#

What Material type is END CRYSTLA? im running 1.8.8 (1.8.9) AND DONT TELL ME IT DOESNT EXIST since this is what the website says:

wispy monolith
#

Can I change blocks drops?

wraith rapids
#

@warm galleon help your fellow 1.8 plebian

tardy delta
#

?paste

queen dragonBOT
wraith rapids
#

the other 1.8 plebian needs help

#

you should help him

tardy delta
wraith rapids
#

you need to pass it an additional parameter

#

probably the cause of the death, not sure

wispy monolith
#

y or n?

tardy delta
#

which parameter?

wraith rapids
#

the one it needs

tardy delta
#

for the statistic i see

#

uhh

wraith rapids
#

there are two overloads of the getStatistic method

#

one takes a Material

#

the other takes an EntityType

tardy delta
#

i just want to look how many ... a player has done

#

for example how many blocks he broke

wraith rapids
#

i don't think that is tracked

#

only on a per-material basis

#

also, follow the proper naming conventions

tardy delta
#

and btw the lock command you made better still gives me an error while trying to put a lock on a normal block for example dirt

wraith rapids
#

what is the exception and what is the code i wrote

tardy delta
#

org.bukkit.event.EventException: null

wraith rapids
#

that is not the exception

tardy delta
#

wanna see the whole error?

wraith rapids
#

EventException means that some exception was thrown in an event handler

#

null is the exception message, which doesn't exist

#

the actual exception is down below in a Caused by: block

#

EventException itself tells literally nothing

tardy delta
#

also CraftBlockState cannot be cast to org.bukkit.block.TileState

wraith rapids
#

ClassCastException: org.bukkit.craftbukkit.v1_16_R3.block.CraftBlockState cannot be cast to org.bukkit.block.TileState

#

this is the actual cause

#

now the code

tardy delta
#

^^

#

link

wraith rapids
#

give me the code

tardy delta
#

just scroll

wraith rapids
#

you should link code separately as doing this fucks the line numbers

tardy delta
#

._.

wraith rapids
#

at io.github.FourteenBrush.MagmaBuildNetwork.PlayerListener.onContainerClick(PlayerListener.java:65) ~[?:?]
means something happened on line 65

#

the first line of your code according to this paste is 70

#

if you insist on including them both in the same paste, place the code first and the stack trace later

tardy delta
#

65 is this: if (event.getAction() != Action.RIGHT_CLICK_BLOCK) return;

wraith rapids
#

well that can't possibly throw this exception

tardy delta
#

yea

wraith rapids
#

the material for end crystals was added only way later

#

so the answer you're looking for is "it doesn't exist"

#

you have changed something since you got this stack trace

sage swift
wraith rapids
#

kek get rekt

tardy delta
#

i think it would be fixed when i fix this

Caused by: java.lang.ClassCastException: org.bukkit.craftbukkit.v1_16_R3.block.CraftBlockState cannot be cast to org.bukkit.block.TileState
wraith rapids
#

yeah, but I want you to learn how to read an exception

#

so we're doing it the hard way around

warm galleon
wraith rapids
#

lmao

sage swift
#

update to 1.16.5

warm galleon
#

or id have to mak them right click something and spawn in a end crystal

tardy delta
#

ow wauw

sage swift
#

easy solution

warm galleon
wraith rapids
#

1.8 sucks

sage swift
#

and so do you for using it

#

and we refuse to elaborate

wraith rapids
#

replace if (!(blockState instanceof TileState) || (blockState instanceof Lockable)) return;
with if (!(blockState instanceof TileState && blockState instanceof Lockable)) return;

tardy delta
#

seems more logically

#

i havent tested it yesterday so i assumed it worked

#

until i saw the error

charred thorn
#

hey guys

#

i used vault api

#

but when i load it into mc

#

it says no vault found

#

even tho plugin is on server

#
[18:38:18] [Server thread/WARN]: [Bot] Loaded class net.milkbowl.vault.economy.Economy from Vault v1.7.3-b131 which is not a depend, softdepend or loadbefore of this plugin.
[18:38:18] [Server thread/ERROR]: [Bot] - Disabled due to no Vault dependency found!
[18:38:18] [Server thread/INFO]: [Bot] Disabling Bot v1.0
[18:38:18] [Server thread/INFO]: [Bot] Disabled Version 1.0```
sage swift
#

add it as a depend

wraith rapids
#

your plugin probably enabled before vault, so the economy wasn't initialized properly yet

wraith rapids
#

read

charred thorn
#

hmm?

#

I still dont get it...

wraith rapids
#

add it as a depend

charred thorn
#

how?

wraith rapids
charred thorn
#

ohhh

#

soft depend or ?

wraith rapids
#

depends

charred thorn
#

it cant work without vault

#

as vault needs to give reward

wraith rapids
#

compare the descriptions of depend and softdepend

wispy monolith
#

Can I change blocks drops?

wraith rapids
#

with a datapack yes

charred thorn
#

imma change it to depend

wispy monolith
wraith rapids
#

listen to block break event or whatever and drop shit

charred thorn
#

no

#

datapack isnt plugin

wraith rapids
#

no good way of going about it without a datapack really

wispy monolith
wraith rapids
#

well, maybe with nms but i wouldn't necessarily qualify that as good

wispy monolith
wispy monolith
tardy delta
#

@wraith rapidsI figured out it gives me errors when right clicks a block that cannot be locked (even if i didnt execute /lock set)

sage swift
#

better yet use BlockDropItemEvent ๐Ÿ™Š

deep solstice
#

I'm using vault for checking permissions, and if I update a player's permissions while they are offline, it doesn't "register" until they log back in. Is this what's supposed to happen?

eternal oxide
#

Offline players have no permission attachment so can't have any permission sunless online

deep solstice
#

yeah but I thought if you used vault it would allow checking permissions of offlineplayers?

eternal oxide
#

You can via Vault, but it would also depend on your permission plugin.

deep solstice
#

that's what I am doing

#

(using vault and a perms plugin)

eternal oxide
#

Then your perms plugin doesn't support offline players, or you are doing something wrong

deep solstice
#

do you happen to know if pex doesn't support offline players?

maiden thicket
#

reject pex return to luckperms

deep solstice
#

idk why i just dont like luckperms lmao

#

but that's fine

eternal oxide
#

pex is a fucknuggery of reflection hell I'm surprised it supports anything still.

#

or GroupManager ๐Ÿ˜‰

deep solstice
#

it works if the player is offline, but if I was to update the player's permissions while they were offline then check it with my plugin, it doesn't work until they log back in

#

so yeah looks like im switching to luckperms, thanks lmao

maiden thicket
sinful python
#

I want to set a large area (like 100x100x100) to air, but I imagine if I do that all in a single tick it'll be terrible for performance. What would you guys recommend doing to minimize performance lag?

chrome beacon
#

oh no

eternal oxide
#

a queue and do x number of blocks per tick

chrome beacon
#

^^ this

maiden thicket
#

and async amirite

chrome beacon
#

no

eternal oxide
#

no need for async

glacial rampart
#
I have a question about command arguments. How to specify what type what arguments need to be? 
For example if I want a command /spawnmob <mob> [amount] - how do I say that the first argument needs to be a mob? (so that chat can autocomplete and show potential options). Or /god [player or @something] - how do I get the @something part automatically as a list of entities or players?
eternal oxide
#

you only async if you REALLY know what you are doing

sinful python
#

Guess I won't use async then LMFAO

sinful python
#

I'm such a noob

chrome beacon
#

Yeah async world write is bad

#

Don't do it

maiden thicket
#

check if args[0] is a entitytype by trying to parse it

#

if it null or whatever

#

then it isnt a mob

young knoll
#

You can't specify the argument,ent directly unless you hook into brigadier

#

But you can validate them in the onCommand method

maiden thicket
#

and for amount try to parse int in a try catch

young knoll
#

Or

#

Don't rely on exceptions

eternal oxide
#

You could fill in onTabComplete all mobs for the appropriate arg

glacial rampart
eternal oxide
#

You need a tutorial then

#

What IDE? InteliJ or Eclipse?

young knoll
#

What syntax

glacial rampart
glacial rampart
maiden thicket
#

if EntityType.valueOf(args[0].toUpperCase()) == null

#

or whatever

maiden thicket
#

xd

young knoll
#

Check if the argument starts with @

glacial rampart
chrome beacon
#

Aight Bukkit has a utility method for that

#

Let me find it real quick

glacial rampart
young knoll
#

Ah, those arguments

chrome beacon
#

No problem ๐Ÿ™‚

glacial rampart
chrome beacon
#

No

#

You will have to implement the tabCompleter yourself

glacial rampart
vestal dome
quaint mantle
#

there's a reason why pex doesn't get updated anymore

#

because it absolute dog shit

vestal dome
#

so I have these tmings,.

quaint mantle
#

well.....

vestal dome
#

but I check if the chunk is loaded, so I don't load chunks..

#

but it loads anyway.

quaint mantle
#

whats the difference between async and sync

chrome beacon
#

Async runs on a different thread

#

Let me get you a good link for it

quaint mantle
#

and not on the main?

#

alright

chrome beacon
vestal dome
young knoll
#

World.isChunkLoaded

vestal dome
#

o_o

#

oh ok

#

thx

#

but how would I make that? without using getChunk?

chrome beacon
vestal dome
#

yes

#

but getting x and y of the chunk

#

not y, z

chrome beacon
#

int x = loc.getBlockX() >> 4;
int y = loc.getBlockY() >> 4

#

Some bit shifting can convert your location to chunk cords

vestal dome
#

I was thinking on deviding by 16

chrome beacon
#

That works too

#

Bitshifting should be faster iirc

vestal dome
#

how would I do that lmfao

chrome beacon
#

I literally just send the code for it

young knoll
#

Dividing causes issues with negative coords iirc

chrome beacon
#

Yeah that too I guess

quaint mantle
#

I have a hashmap with integers (price) and itemstacks you can buy for that price. When I left click an item in a gui I want the previous item in the list to show & right click would be the next item in the list. What'd be the best approach for this

chrome beacon
#

Is integer the key or value

#

Hopefully value

quaint mantle
#

The integer is actually the key :smug

chrome beacon
#

oh no

#

That would mean 2 items can't have the same value

quaint mantle
#

I only just started so any chance is fine

#

OH, ur right.

#

Hadn't even considered that at all.

#

Anyway, that's switched now

#

That doesn't answer my question tho

chrome beacon
#

Well it depends on what you want the next entry to be

#

Any item or next sorted by price

quaint mantle
#

left click = previous item in list, right click = next in list

maiden thicket
#

if clicktype is left click

#

switch

chrome beacon
#

That's not what he's asking

maiden thicket
#

if right click

quaint mantle
#

Yeah no shit

maiden thicket
#

o

#

i'd say

#

store like

#

itemstacks maybe

chrome beacon
#

._.

maiden thicket
#

u ahve that

#

already

#

uh

#

then um

quaint mantle
#

Is this going somewhere

maiden thicket
#

store the item a player is on ig and then check for it when they do clicks

#

and when click just replace item in inventory ๐Ÿคท๐Ÿพโ€โ™‚๏ธ

chrome beacon
#

You're not helping

maiden thicket
#

he's asking what the best approach is that's what i'd do i mean

chrome beacon
quaint mantle
#

is there something like Player#setInventory(PlayerInventory)?

young knoll
#

There is setContents and getContents

quaint mantle
#

yeah i am getting this error Caused by: java.lang.IllegalArgumentException: Invalid inventory size; expected 36 or less

maiden thicket
vestal dome
#

ya?

young knoll
#

You are getting the contents of a larger inventory and trying to set it to a smaller one

quaint mantle
#
VariablesHandler.getPlayerInventories().put(player.getName(), player.getInventory());
chrome beacon
paper viper
#

what the hell... variables handler

vestal dome
#

Alright, thank you very much

paper viper
#

you shouldnt use global variables

quaint mantle
#
private static HashMap<String, PlayerInventory> playerInventories = new HashMap<>();
paper viper
#

no

#

that is static abuse

#

what the hell are you doing

pulsar zenith
#

dont abuse static

quaint mantle
#

wdym

vestal dome
quaint mantle
#

@vestal dome how did you do the about me?

vestal dome
#

idk? I just got permissions to use it..

#

idk?

#

breh

quaint mantle
#

just a question where is it? xd