#help-development

1 messages · Page 12 of 1

noble lantern
#

i wanted to try a custom one, asked ollie when the values return null

#

making me static abuse

hybrid spoke
noble lantern
#

yeh the other day you said something different haha xD

hybrid spoke
#

pretty sure i didnt

#

but this method even confuses me

hasty obsidian
#

well yes but I do you know how to do it if there is no players near a warden then do something, sorry if im asking too much im just new to spigot

noble lantern
#

im pretty sure i understand it rn, im making it avoid cliffs

hybrid spoke
hasty obsidian
#

can you help me with the code im not really sure how to do that

hybrid spoke
#

maybe you can adjust it so they jump over little holes

noble lantern
hybrid spoke
hybrid spoke
hot wolf
#

Question, since I can't make Location serializable, should I either A: make a seperate class for a location, which is serializable (Prettier) or B: seperately save x y z coordinates and world name (probably more efficient)?

hybrid spoke
#

but for the most cases the latter will be enough

hot wolf
#

True, but meh. Idk it looks weird

#

I'll just flip a coin ig xD Thx

hybrid spoke
#

if you are saving to a database or web service i would go with a dto, otherwise just save the x,y,z and worldname

noble lantern
#

and if it fails ill use that

#

got this written out rn

#

orange sand = previous
sandstone = current

I essentially dont think i need previouser atm, just current and previous, kind of just tried to visualize this in my head as

#

so if my code is correct, i assume it would flag false for a cliff

#

gonna ?tryandsee

#

uhm

#

my client froze?

#

ok

compact haven
#

previouser

#

clearly an experienced developer wrote this code

hybrid spoke
opal juniper
#

I AM BEING ATTACKED

opal juniper
compact haven
#

heh, my comment came from the depths of my heart

#

only long-time developers could create such shotty names

opal juniper
#

lul

compact haven
#

do not worry I have refactored my own codebases several times to attempt and fix these poor names I have created

opal juniper
#

i mean it’s before previous, so previouser!!

opal juniper
#

that’s an IDE name lmao - i remember that

#

i’m not sure if y’all do it, but i like using the intellij “.var” autocomplete

hybrid spoke
#

tbh previouser sounds like some harry potter spell

compact haven
#

hm it must be from an AI taking into consideration your previous variable names

hybrid spoke
#

wingardium previouser!

compact haven
#

holy shit im levitating

opal juniper
#

i just looked it up and there is no word for before the previous

compact haven
#

(and well anything past the introduction of Java's var as well)

opal juniper
#

yuck

compact haven
#

wots yuck

opal juniper
#

java var sucks - i know that paper use it to minimise the diff on their patches but still

compact haven
#

ah

opal juniper
#

cause then they don’t need the import

#

but still

compact haven
#

why not just

torn shuttle
#

Hey quick question if I have two location objects but I generated these two differently at different times will they ever happen to be equal to one another when comparing them with location1.equals(location2) ?

compact haven
#

secondPrevious

hybrid spoke
#

beforePrevious

compact haven
#

yes

#

then 3rd previosu is

#

previousBeforePrevious

compact haven
torn shuttle
#

really?

compact haven
#

== then never, .equals() should be overridden for World or location to compare properly

#

of course

torn shuttle
#

hm

#

alright thanks for the info

compact haven
#

yep no problem

muted talon
#

I think I’m going to code my own discord-Minecraft interface

compact haven
#

please do not include any console input/output in any way shape or form

#

nor the ability to run unchecked commands, act as a superuser, etc etc

muted talon
#

what do you mean? I’m going to be starting from (almost) scratch here using the pinned tutorials and my former knowledge from other languages

compact haven
#

heh

#

that has nothing to do with coding

#

just keep it strictly chat communication, maybe rank sync from MC -> Discord (ensure ranks given have NO elevated perms), and perhaps a list command on the Discord

muted talon
#

I just want people to be able to see what people in Minecraft are saying, and for Minecraft people to see what people in #minecraft are saying

#

ah so people can’t execute commands from discord?

compact haven
#

right

#

incredibly insecure

muted talon
#

I wasn’t planning on allowing that

compact haven
#

good

#

some people think it's a good idea, keep the two separate!

muted talon
#

should be simple as automatically removing “/“ from any message, right?

compact haven
#

Don't even need to

#

as long as you just use the proper methods, it'd be impossible to run commands without you building in the ability to

muted talon
#

sorta like how dynmap web users can’t run commands, but their usernames still show up in chat?

compact haven
#

Not too familiar, but should be right

vocal cloud
#

If you're not firing a slash command you're not firing a slash command.

muted talon
#

basically if you send a chat message from within the Dynmap, it associates your IP with your username from the ip you use to connect to the server when playing, then prefixes “[WEB]”

muted talon
#

I mean, it makes sense

#

But

compact haven
#

Mike either you are I are confused

vocal cloud
#

If you send a message with a bot. Unless you're sending a slash command you're not sending a slash command.

compact haven
#

we're talking about using MC commands as a consoel user from discord

vocal cloud
compact haven
#

nothing to do with discord slash command interactions xd

vocal cloud
#

I thought it was the other way around

#

But it should go both ways?

compact haven
#

nope who in the world uses discord commands from minecraft

#

can bots even fire slash commands

vocal cloud
#

Yes

compact haven
#

🐳

#

do not lie, Mr. Taco

vocal cloud
muted talon
#

well.. considering the age of the version I’m using I might be better off using an IRC bot then an IRC to discord bridge

#

both of which are already made

compact haven
#

literally does not matter

muted talon
#

?

compact haven
#

the version of mc you're using

muted talon
#

it does, I don’t have to make something if it already exists

compact haven
#

well then just use DiscordSRV

muted talon
#

there’s no discord-Minecraft bridges for this version

compact haven
#

what version are you on

#

1.6.4?

#

wutf

muted talon
#

CB 1.1-R6

compact haven
#

ah well that's a major yikes

#

you seem to predate even dirt itself my friend

muted talon
#

(technically R5 but R6 stuff works with it)

tender shard
#

why don't you use beta 1.8 instead

#

it's even older

muted talon
#

wanted stuff like more advanced end, nether, apples from trees, etc..

tender shard
muted talon
#

also we decided we wanted the limitations of the older version. Pushes our creativity and forces us to think outside the box to solve problems, both inside the game and outside, as it seems to be going

tender shard
#

funny idea lol

#

at least better then using 1.8.8 lol

muted talon
#

or just get all my members to start using irc 😈

vocal cloud
#

Eclipse 👀

compact haven
#

have fun getting people to join on 1.1 tho xd

muted talon
tender shard
#

JDA is the most popular java library for discord. it's quite easy to use and if you havent used it, then it's a good thing if you wanna learn sth new 😛

compact haven
#

ehm

muted talon
#

already got like 10 ppl so far

compact haven
#

I feel like JDA is compiled with too new of a java for said craftbukkit

#

or am I just creating unnecessary problems

muted talon
#

I’m fine with using older stuff

compact haven
#

what version is CB 1.1 compiled on (JDK)

tender shard
compact haven
#

yeah that's what I mean

#

kekw

hasty obsidian
#

can anyone help me, I am working on a plugin where if a player is 6 blocks away from a player the warden starts healing, im not really sure how to do that, can anyone help?

tender shard
muted talon
#

almost my whole environment is Mac based and I’ve got PPC stuff if we need to go that old xD

hasty obsidian
muted talon
#

you can revive them, no?

tender shard
#

yes

#

I just replied to one of em

compact haven
#

okay so JDA is compiled with JDK 8, and CB is compiled with JDK 6

#

meaning no discord bridge without manually interacting with the Discord REST api

muted talon
#

oh boy that sounds complicated

compact haven
#

it definitely is

tender shard
#

just because CB is compiled with java 6 doesn't mean it cannot be run using java 8

muted talon
#

maybe I should get one of those SMS plugins lmao, just text everyone

compact haven
#

wait

#

this is true!

#

not the SMS

#

that's a lousy idea

muted talon
#

I was gonna say something but I know nothing

compact haven
#

too costly

muted talon
#

money is no object, we will also install a bank account stealing plug-in

compact haven
#

lovely

muted talon
#

I wonder…

compact haven
#

anyways Discord bridge should be fine

tender shard
#

ooga ooga

#

need idea for java project

#

ooga ooga

hybrid spoke
tender shard
#

nah fuck entities

hybrid spoke
#

not only entities

#

a regular one

tender shard
#

yeah okay but anyway, I need an idea on what to code, and not something that's already done 😄

hybrid spoke
#

still improvable

hybrid spoke
tender shard
#

ok

#

and it prints a funny message

rain mason
#

it's me again, how do I get the old position? PlayerChangedWorldEvent doesn't send the old Location, and e.getPlayer().getLocation() already returns the new teleport location

severe turret
#

give me a moment

tender shard
honest echo
#

java.lang.IllegalStateException: InventoryOpenEvent may only be triggered synchronously.

#

what causing this error ?

hybrid spoke
#

dont do that

honest echo
#

i just did player.openinventory(inv);

hybrid spoke
#

where

honest echo
#

in a another class

hybrid spoke
#

no shit sherlock

#

provide some code

#

?paste

undone axleBOT
tender shard
honest echo
#

yep

tender shard
#

if it says "may only be triggered synchronously", then you probably tried to use it asynchronously

honest echo
#

ig i fixed error lemme test it

tender shard
#

you gotta use the scheduler and schedule a synced task on the next tick

#
Bukkit.getScheduler().runTask(plugin, () -> { // yourCode
honest echo
#

ohk thanks

#

but weird have to use a schedular for sending a inventory

tender shard
#

no

#

you do not need the scheduler to send an inventory

#

you need it only when you are doing stuff async

#

but we don't know what you're doing since you haven't sent any code

#

you're probably using the AsyncPlayerChatEvent to send an inventory, or similar

#

and the AsyncPlayerChatEvent obviously gets executed asynchronously, hence its called like that

honest echo
#

thanks a lot it worked

tender shard
vocal cloud
#

Hate Oracle SQL

severe turret
#

i guess you can make it async but idk if its worth or good

mental nymph
#

how to unregister plugin command when its disabling?

vocal cloud
#

When the plugin is shutting down? You shouldn't need to unregister commands

vocal cloud
#

But why would you need to do that?

mental nymph
# mental nymph in onDisable() method

to avoid this [15:10:47 ERROR]: null org.bukkit.command.CommandException: Cannot execute command 'cd' in plugin CustomDiscs v0.5-b72 - plugin is disabled.

vocal cloud
#

Wack that you're disabling your plugin

mental nymph
vocal cloud
#

Personally don't recommend it

severe turret
#

just make a customdiscs on/off

#

and make everything depend on a boolean being true

#

💀

vocal cloud
#

Not sure you can even remove command executors without reflection

#

Only has get and set

hasty obsidian
#

Can anyone tell me what is wrong with my code

vivid cave
#

I need help to understand the MapPalette's algorithms
Those functions are deprecated because the color indexes of minecraft palette are magic values, meaning that they are subject to change in future updates. On a side note though, I've been actively using the MapPalette since at least 1.16 (now we are in 1.19) and I never experienced any color changes.

    private static double getDistance(@NotNull Color c1, @NotNull Color c2) {
        double rmean = (c1.getRed() + c2.getRed()) / 2.0;
        double r = c1.getRed() - c2.getRed();
        double g = c1.getGreen() - c2.getGreen();
        int b = c1.getBlue() - c2.getBlue();
        double weightR = 2 + rmean / 256.0;
        double weightG = 4.0;
        double weightB = 2 + (255 - rmean) / 256.0;
        return weightR * r * r + weightG * g * g + weightB * b * b;
    }```
What I don't understand in this algorithm is how the weights are determined. Does it base of a well known algorithm or something? The return value is pretty logical, what doesn't make sense for me is that the weightG is fixed to 4 while weightR and weightB values may vary between 2.0 and 3.0 according to the mean value of the red channel.
Secondly, what if we wanted to consider the alpha channel as well. I suppose we'd add `+ weightA * a` in the return value but what would be the value of weightA?
torn shuttle
#

can't really test rn, can someone tell me if looking north/south/east/west is determined by yaw? Or was it pitch?

torn shuttle
#

I keep mixing those up

vocal cloud
torn shuttle
#

thanks

#

I somehow always get it wrong

vocal cloud
#

Remember it as the ship pitched onto it's side

#

It doesn't yaw onto it's side

torn shuttle
#

of course how could I ever forget that

rain mason
vocal cloud
#

I think it's pitched up and down since it's front to end action

severe turret
#

whT

#

why would you completely remove the map..

#

🥲

noble lantern
#

hey guys

#

learnjava moment here but

#

How can i make a float decimal place always .50

#

i just want to always get dead center location of a Vector is why

vocal cloud
#

Is it going to be a string eventually or

eternal oxide
#

String.format

noble lantern
#

no its always a float

hybrid spoke
#

or DecimalFormat

vocal cloud
#

Doesn't math.round do that?

#

Could always round it then add .5

#

Floor it

noble lantern
vocal cloud
drowsy helm
little panther
#

Hello, i got this error on my plugin, how do figure out whats wrong? java.lang.NullPointerException: Cannot invoke "com.cradlenetwork.CradleAbilities.Main.getConfig()" because "com.cradlenetwork.CradleAbilities.Dranwen.DranwenEvents.plugin" is null"

wind tulip
#

(very useful ik)

little panther
#

yea 😄

formal bear
#

Somehow compiling this today does not wrong
pom.xml

        <repository>
            <id>iridiumdevelopment</id>
            <url>https://nexus.iridiumdevelopment.net/repository/maven-releases/</url>
        </repository>
...
        <dependency>
            <groupId>com.iridium</groupId>
            <artifactId>IridiumColorAPI</artifactId>
            <version>1.0.6</version>
            <scope>compile</scope>
        </dependency>

console

Caused by: java.lang.ClassNotFoundException: com.iridium.iridiumcolorapi.IridiumColorAPI
        at org.bukkit.plugin.java.PluginClassLoader.loadClass0(PluginClassLoader.java:151) ~[purpur-api-1.18.1-R0.1-SNAPSHOT.jar:?]
        at org.bukkit.plugin.java.PluginClassLoader.loadClass(PluginClassLoader.java:103) ~[purpur-api-1.18.1-R0.1-SNAPSHOT.jar:?]
        at java.lang.ClassLoader.loadClass(ClassLoader.java:520) ~[?:?]
        ... 12 more
little panther
wind tulip
rain mason
#

okay almost works

formal bear
rain mason
#

yeah, getUniqueId

little panther
wind tulip
little panther
#

no, how do i call it? is it just adding it into the onEnable

wind tulip
#

show me the code in the Main class

little panther
formal bear
supple elk
#

Does this work as a singleton?

little panther
#

i used plugman this time to quickly get it again, but ive tried restarting the server aswell and it still doesnt work

wind tulip
#

why are you setting a static field in a constructor lol

#

well whatever

#
this.getConfig().options().copyDefaults(true);

before this line

#

try putting

#
new DranwenEvents(this);
rain mason
#

oh my god it actually works

little panther
vast raven
#

How to get the opposite of a vector? Like I'm cancelling the push force of the moment you get damage

little panther
#

depend on where you mean with the static, but probably just because that how i was thought to do it

wind tulip
#

so like I'm a little confused

#

although I've never done config files before but this.getConfig states that getConfig should be in the Main class?

little panther
wind tulip
#

what

little panther
#

or did you get you wrong

wind tulip
#

oh

#

did u not paste the whole Main class?

little panther
#

i did

wind tulip
#

I mean ur calling getConfig from Main but I don't see a getConfig method

#

first of all you're doing "plugin.getConfig()"

#

that's bad because

  1. You never set plugin to anything, it's null
#
  1. there's no "getConfig" method in the Main class
little panther
wind tulip
#

plugin is supposed to be an instance of Main so

#

first of all just put a var of type DranwenEvents at the top of ur main class

#

in onEnable set it to new DranwenEvents(this)

#

that should fix the plugin field being null

#

but then again I have no idea why you didn't just make everything in the DranwenEvents class static

#

there's only one field iirc

#

nvm

#

there's not

#

I'm blind

desert loom
#

move the initialization of DranwenTpCooldown to the constructor of DranwenEvents.

#

plugin isn't set yet so you're getting null for plugin.getConfig()

wind tulip
#

also that

little panther
#

so its that the Cooldown class doesnt have to plugin set? Have i understood it correctly then

wind tulip
#

in ur DranwenEvents class you have a variable at the top of type Main

#

it's called plugin

#

that variable is not set to anything by default

#

so naturally it's null, until you call the constructor which is

    public DranwenEvents(Main main) {
        plugin = main;
    }
#

again, I don't know why ur using a constructor for this

little panther
#

yea

wind tulip
#

like

#

if ur only setting a static field

#

u could put it in a static method

little panther
#

fair, just how i got thought. Is there a better way to do it, please tell me

wind tulip
#

although this is not the case here since you also need to move

    DranwenTpCooldown TpCooldown = new DranwenTpCooldown(plugin.getConfig().getInt("Abilities.Dranwen.Teleport.cooldown"), TimeUnit.SECONDS);

to the constructor

#

which is not static

little panther
#

cuz ive understood that its not the best

wind tulip
#

well not the whole line

#

declare it first and then set its value

wind tulip
little panther
wind tulip
#

lemme try and explain how static vars work vs non-static

#

basically you should be familiar with the concept of classes by now so I'll skip that

#

when you make a new class, all of the stuff that is not static belongs to it

#

for example

#
public class Student{
  int age;
  int gpa;
  String name;
}```
#

all of those belong to an instance

#

so to access them you first need to make a new instance of the class Student

#

to do that you need a constructor first, which is basically a special method that can be used to make a new instance of a class

#
public class Student{
  int age;
  int gpa;
  String name;

  public Student(int studentAge, int studentGPA, String studentName)
      age = studentAge;
      gpa = studentGPA;
      name = studentName;
  }
}
#

so there's the constructor

#

to make a new instance you'd do something like

Student student = new Student(15, 4, "George");
#

and then you can access its properties and methods by doing

student.age
student.gpa
student.name
#

same for methods, if you had a method you'd do <instance>.<method>()

#

but for static variables, they don't belong to an instance

#

they belong to the class itself

#

so basically

#
public class Student{
  int age;
  int gpa;
  String name;
  static String species = "Human";

  public Student(int studentAge, int studentGPA, String studentName)
      age = studentAge;
      gpa = studentGPA;
      name = studentName;
  }
}```
#

to access species, you don't need to make an instance

#

you can just access it through the class itself

#

so, Student.species

#

in your case "plugin" is static, so setting it in the constructor doesn't make sense because you don't need to make a new instance of your class just to set a static field

#

instead you could make a method, such as

public static void setPlugin(Main plugin){
  this.plugin = plugin; //I'm doing "this.plugin" here because the parameter and the variable have the same name, so this will help the program differentiate
}
#

and then on your onEnable method u can just do <class>.setPlugin(this)

#

no need to make a new instance

sacred mountain
#

pro gaming

wind tulip
little panther
#

that makes sense, but you are still using a static in the setplugin? But i think i understand how im supposed to go about this

wind tulip
#

basically if you make a method static, you won't need to make a new instance of the class it belongs to in order to call it

#

u can just reference the class itself (not an instance of it)

#

so for example

#

DranwenEvents.setPlugin(this)

little panther
#

then i can just referance it in every other class, do i get it right then?

wind tulip
#

of DranwenEvents

#

and also other classes if the var is public ig

tender shard
wind tulip
#

I just remember it by thinking of a plane

#

the plane pitches up/down

#

makes sense

little panther
vocal cloud
#

which is turns left and right

tender shard
wind tulip
#

lmao what

vocal cloud
#

I mean the term pitch is used often in literature for ships pitching up and down

tender shard
vocal cloud
#

Because a ship doesn't yaw

ornate mantle
#

lets say i have a custom implementation of the player class that contains like a second inventory and some stats

wind tulip
ornate mantle
#

what would be the best way to efficiently store this?

tender shard
#

for example I am german, I dont even know what pitch or yaw means in german. Hence I for example cannot really remember which is which. that's why I came up with this weird yeeehaaaw thing lmao

drowsy helm
vocal cloud
#

I mean you can read a book or you can listen to Barrett's Privateers on repeat for a few hours and memorize it

tender shard
#

like, if someone knows that a ship yaws left/right, then they obviousoly already know what pitch and yaw is and dont have any problems rememering it, right?

vocal cloud
#

I mean the point is that you can remember all of them by just learning how a boat works. Yeah, if you can't remember that how can you remember a cowboy lol

little panther
drowsy helm
#

this doesnt work in static context

#

it refers to the instance

wind tulip
#

ye

#

this refers to the instance

#

it's hard coding without an IDE lmao

little panther
#

so what should i do instead do define the main?

wind tulip
#

just rename the param

#

and do plugin = <newName>

tender shard
tender shard
vocal cloud
#

Well if they have memory issues to the point they can't remember a ship pitching up and down.

little panther
wind tulip
#

what

#

parameters aren't static

undone axleBOT
wind tulip
#

the var has to be the static if ur gonna be accessing it from a static context

drowsy helm
#

shouldnt be using static for it pass by ref

tender shard
#

I love how people fight against static instance getters, claiming it prevents unit testing, while mockbukkit exists since years now

vast raven
#

PlayerJumpEvent is a paper event right?

eternal oxide
#

yes

vast raven
#

How would you use an event like that on Spigot?

eternal oxide
#

You would not

vast raven
#

like with PlayerMoveEvent?

vast raven
eternal oxide
#

you can check teh Y velocity. If its positive odds are you jumped

vast raven
#

in PlayerMoveEvent?

eternal oxide
#

yes

#

easy to test, just send a debug message any time event.getPlayer().getVelocity().getY() > 0

tender shard
#

there is a constant value that one can check. I have a playerjumpevent somewhere in my maven repo I think

vast raven
eternal oxide
#

I'd do a debug first

#

test it

vast raven
#

The problem is

#

that the PlayerMoveEvent is called actually when the player moves, but it can be fired even with another plugin.

tender shard
#

0.42 is the default jumping velocity IIRC, and every level of jump boost adds another 0.1 or so

vast raven
#

so since I want to cancel this event in a certain moment, maybe the push is made by another pl.

eternal oxide
#

yes, but you are only interested with positive Y velocity

#

There is no 100% accurate way to detect jump

vast raven
vast raven
#

Like it gets the packet?

eternal oxide
#

player can;t be pushed into a positive Y velocity

#

Knockback can do it

vast raven
#

My server is in papermc, but I should change the project in Paper.

eternal oxide
#

other plugins can do it

vast raven
eternal oxide
#

as in other plugins can cause a positive Y velocity

eternal oxide
#

Yes, however not accurately timed enough to prevent a jump

tender shard
eternal oxide
#

I don't believe so

#

I thought the statistics were quite lazy

#

I'll check though as you have me wondering now

rain mason
#

oh wait multiverse inventories exists right

tender shard
#

"|||"?

rain mason
#

i'm too lazy to learn how to do json stuff so I just parse it like this txt something|||foo|||bar idk|||stuff

eternal oxide
#

Lol it works```java
@EventHandler
public void onJump(PlayerStatisticIncrementEvent event) {

    if (event.getStatistic() == Statistic.JUMP) {
        Bukkit.broadcastMessage("Jumped!");
        event.getPlayer().setVelocity(event.getPlayer().getVelocity().setY(0));
    }
}```
bitter path
#

how do i make my first plugin?

eternal oxide
#

Which is yoru favorite IDE?

bitter path
#

ide?

rain mason
#

program used to code

bitter path
#

the eclipes

tardy delta
eternal oxide
#

@vast raven ^

rain mason
#

i recommend you know java first tho, (very similiar to javascript)

tardy delta
#

lol

bitter path
#

so i code in java? or what

tardy delta
#

yes

bitter path
#

any links?

rain mason
bitter path
#

ok

tardy delta
hybrid spoke
#

?learnjava

undone axleBOT
hybrid spoke
#

here are many links

bitter path
#

ok thanks

patent fox
#

how do i use remapped nms 1.19

#

i get this error:

cloud crane
#

it's the same ofc

rain mason
#

ikr exactly the same

tardy delta
#

java is to javascript as car is to carpet

rain mason
#

i mean all the languages I know feel almost the same to me

eternal oxide
#

no you didn;t

patent fox
#

yes i did

eternal oxide
#

Ok, its all working fine then?

patent fox
#

no

#

i get the error

eternal oxide
#

Then you didn;t do all the steps

patent fox
#

so what step am i missing? i ran build tools i updated classifier

#

and

eternal oxide
#

You downloaded Buildtools?

#

you ran this specific command?java -jar BuildTools.jar --rev 1.18.2 --remapped

patent fox
#

i ran 1.1.9

#

1.19

eternal oxide
#

You included specialsource plugin in your pom?

patent fox
#

yes

eternal oxide
#

you added a pom dependency with <classifier>remapped-mojang</classifier>

patent fox
#

yes

eternal oxide
#

?paste your pom

undone axleBOT
cloud crane
#

How can i share a variable between a command and an event listener?

patent fox
drowsy helm
#

depends on the context

vestal musk
cloud crane
eternal oxide
bitter path
patent fox
#

oh

#

sorry

#

thx so much

drowsy helm
rain mason
vestal musk
# bitter path ok

the community edition is free but if u have github pro then u have the ultimate

patent fox
cloud crane
drowsy helm
#

community just gets less stuff, like profiler etc

rain mason
vestal musk
vestal musk
drowsy helm
tender shard
#

I have the ultimate version and it's really not different at all unless you do database stuff

tardy delta
#

i was thinking about something this night :/ might it be a good idea to implement the /reload command of my plugin my implementing Reloadable interfaces for all the components that needs to be reloaded and register all those components in the main class or smth and on reload just do reloadableStuff.forEach(Reloadable::reload)?

vestal musk
#

I do db things so i needed the ultimate for the comfort

eternal oxide
#

Wierd, discord won;t let me respond to a message

patent fox
#

wdym

#

?

eternal oxide
#

I tried to reply to you and discord blocks it

eternal oxide
#
 Clyde: Your message could not be delivered. This is usually because you don't share a server with the recipient or the recipient is only accepting direct messages from friends. You can see the full list of reasons here: https://support.discord.com/hc/en-gb/articles/360060145013```
tardy delta
#

lol

patent fox
#

it happend to me a few days ago

vestal musk
#

XD

tender shard
eternal oxide
#

try replying to biscuit1307

tender shard
#

works for me lol

vestal musk
eternal oxide
#

ok, thats super wierd

tender shard
#

chicken wings > chicken nuggets

drowsy helm
cloud crane
#

@drowsy helm can't i just declare the hashmap as public static?

drowsy helm
#

i mean yes

#

but its not good practice

tardy delta
#

😳

cloud crane
#

if it works it works 👍

eternal oxide
#

Everyone will bitch at you if you do

eternal oxide
#

did you fix that error in your pom?

patent fox
#

yes

patent fox
tender shard
patent fox
#

ofc

eternal oxide
#

in my pom I add the spigot version as a property so its only one line to edit.<project.spigotVersion>1.19-R0.1-SNAPSHOT</project.spigotVersion>

patent fox
#

im not a loser

vestal musk
#

who said that? 😆

eternal oxide
#

maven tab click the M

patent fox
#

oh

eternal oxide
#

I don;t use IJ but in teh Maven tab there shoudl be a code execution section

tender shard
#

click that, enter "mvn clean package -U"

vestal musk
patent fox
#

yeah found it

#

did it

vestal musk
tender shard
#

cmd+shift+3, 4 or 5

patent fox
#

still getting the error

vestal musk
#

Thanks

#

Life saver

tender shard
#

cmd+shift+3 is the whole screen I think, cmd+shift+4 lets you choose, cmd+shift+5 is for recording or sth

#

I usually do cmd+shift+4

eternal oxide
#

did your buildtools run finish without errors?

tender shard
undone axleBOT
patent fox
#

yes

vestal musk
#

Yeah, im on a vacation so i brought my macbook and its still new for me sorry 😆

patent fox
#

its in hebrew

#

just

#

dont

vestal musk
#

XD

patent fox
#

its my pc lang

#

i will change it later

vestal musk
#

oh

tender shard
#

are you 100% sure that you ran java -jar BuildTools.jar --rev 1.19 --remapped ?

patent fox
#

yes

tender shard
#

go to C:\Users\Yourname\.m2

tender shard
patent fox
vestal musk
patent fox
chrome beacon
#

Is that all?

vestal musk
#

i wish that i could know hebrew language

tardy delta
#

is this a proper reload method for a fileconfig?

#

i could show yhe whole thing if youd like

eternal oxide
vestal musk
# tardy delta is this a proper reload method for a fileconfig?

import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.bukkit.Bukkit;
import org.bukkit.configuration.file.FileConfiguration;
import org.bukkit.configuration.file.YamlConfiguration;

import java.io.File;
import java.io.IOException;

public class YamlStorage {
    private static final Logger LOGGER = LogManager.getLogger("PrivateMessages");
    private static File file;
    private static FileConfiguration customFile;

    public static void setup() {
        file = new File(Bukkit.getServer().getPluginManager().getPlugin("PrivateMessages").getDataFolder(), "config.yml");

        if (!file.exists()) {
            try {
                file.createNewFile();
            } catch (IOException e) {
                e.printStackTrace();
            }
        }
        customFile = YamlConfiguration.loadConfiguration(file);
    }

    public static FileConfiguration get() {
        return customFile;
    }

    public static void save() {
        try {
            customFile.save(file);
        } catch (IOException e) {
            LOGGER.info("ERROR");
            e.printStackTrace();
        }
    }

    public static void reload() {
        customFile = YamlConfiguration.loadConfiguration(file);
    }
}
chrome beacon
eternal oxide
tardy delta
#

i smell static abuuse

chrome beacon
#

The code for the jump statistic isn't the best

patent fox
chrome beacon
#

Run BuildTools again

#

With the exact command that mfnalex sent

eternal oxide
patent fox
#

ok

vestal musk
patent fox
#

brb

tender shard
#

if you dont have all those files, then your buildtools didnt properly run

patent fox
#

yeah im running it again

vestal musk
#

that hebrew confuse me so much

patent fox
#

sorry

vestal musk
#

oh no its okay :d

tender shard
patent fox
#

its just "desk top"

vestal musk
#

😂

tardy delta
#

oh ye extending yamlconfig makes you dont have to delegate all the get methods?

tender shard
#

yep

#

I just call load in the constructor

#

so it's just new Config("custom.yml")

#

it also reads the default included custom.yml file

tardy delta
tender shard
#

and creates the file

#

merging is fun :3

tardy delta
#

breaks my stuff most of the time

vestal musk
#

xd

eternal oxide
#

The one thing I've always hated about multi dev projects

tender shard
#

well but thats not so good for configs, etc 😄

patent fox
#

yeah

#

i know

vestal musk
#

is t

#

is it work?

tardy delta
#

havent tested

vestal musk
#

try it if its work than u good. :p

#

the langkey isnt constants?

tardy delta
#

imma do my reload impl like this

noble lantern
#

if your save, reload, and load method isnt named reload

eternal oxide
noble lantern
#

are you rly programming at all

#

hell even few months

tardy delta
#

hehe thanks uwu

noble lantern
#

i took a few month break and mans is cranking 90s in intellij

tardy delta
#

always appreciate it

hasty obsidian
#

Can anyone tell me whats wrong with my code?

undone axleBOT
winged storm
#

how does the plugin work?

noble lantern
hybrid spoke
rough drift
#

I need to generate a world extremely quickly (No terrain generation, just the world but it's completely blank), and it's taking so long I am getting server timeout errors (Server hasn't responded in 15 seconds), how can I just make it generate the very basics for a world?

tardy delta
spiral light
tender shard
#

I fucking hate floating points

tender shard
#

the whole lib is in a maven repo and also has some NMS stuff, but also works without enabling NMS things

drowsy helm
#

i wish java had db api as easy as php does

tardy delta
#

imma change my config class to extends yamlconfig

tender shard
#

yeah

rough drift
#

Since I need multiple framework types, I'll make a framework for frameworks

#

smort

tender shard
#

Framework<?>

#

<T> FrameworkFramework<T> implements Framework<Framework<T>>

tardy delta
#

that looks like i move i would make

drowsy helm
tender shard
#

run buildtools

#

--rev 1.4.6

drowsy helm
#

buildtools?

#

you mean strange website with very outdated jar?

rough drift
#

I did a wopsie

noble lantern
bitter path
#

How do i import vault to my plugin?

drowsy helm
#

are you using maven?

bitter path
#

yes

drowsy helm
#

its on that readme

bitter path
#

k

tender shard
#

you should rather use that illegal website and download an outdated version there

vocal cloud
#

Gotta make one of those that's just a jar filled with fluff and when run starts sending the bee movie script

noble lantern
vocal cloud
#

Oh true. I should add a Bitcoin miner

tender shard
noble lantern
#

just check async

#

smh

#

new Thread()

#

god

#

in all seriousness though

#

why tf is there no PlayerJumpEvent??

drowsy helm
tender shard
drowsy helm
#

ez

noble lantern
#

yeh, i feel like spigot should have that tho

tender shard
noble lantern
#

its just cause im typing online

#

i could care less for my grammar over discord xD

tender shard
#

They're going to their home. Should have just taken the bus

#

lol

tender shard
noble lantern
#

Mostly because most native speakers learned by actually talking since the age of 12ish months

While most non-natives learned it in a classroom for many years

tender shard
#

yeah that makes sense

noble lantern
#

so its more engrained to properly use it all the time

tender shard
#

when I was young, I couldnt pronounce the "sch" sound... erm... let me try to find an english word that contains it

noble lantern
#

Schlatt

#

J Schlatt

tender shard
#

shadow

#

the first part

tardy delta
#

shrek

noble lantern
#

ohh

#

the shh

#

i used to have issues pronouncing ch

tender shard
#

I couldnt pronounce it and pronouned it as "sadow"

noble lantern
#

it was horrible lol

tender shard
#

I went to some "language doctor" and all we did was playing board games and then some day I could properly talk, lmao

#

no idea how she did that

spiral light
#

what ?? shadow is much better then the "th" in mother or smth xD

tender shard
#

with TH i never had probblems

spiral light
#

i still hate it xD

tender shard
#

many german people just use an "s" or "z" sound instead of th

spiral light
#

btw... isnt there a method like Location#getChunk ?

glass mauve
#

docs...

#

if you want to know

tardy delta
#

oh i hate this

spiral light
#

nah i was thinking of it because mfnalex used something way more complex to find out if the chunk is loaded

next stratus
#

Hey, how on earth do people make a system what loads external addons for plugins? 🤔

noble lantern
#

Chuink#isLoaded

noble lantern
#

sec

#

like BentoBox right

bitter path
#

How do i make a custom baltop?

noble lantern
#

your the guy who dmd me

#

on spigot ahaha

#

about this

crystal palm
#

hiya. i want to add an enchantment to an itemstack. however, i need to make it so that the player cannot add protection (or other unsafe enchants) onto a sword BUT can apply unsafe LEVELS of safe enchantments (like sharpness 7) onto a sword

noble lantern
#

your him right?

next stratus
#

more than likely yes 🥲

crystal palm
#

any idea how i can do that?

tender shard
next stratus
#

mhm, that's me aha!

noble lantern
#

not sure if you saw it

next stratus
#

someone I talk to knows how to do it but his big ego can't be hurt enough to explain how

noble lantern
#

i explained it in there

#

with links to my code that does it

#

Its a little complicated bc it uses a fuck ton of reflection

crystal palm
#

oh wait. i think ill use itemmeta for it

next stratus
#

ahh, my bad

noble lantern
#

but, overally its halfway simple

#

harest part is opening up the jars and getting files you need

next stratus
#

how you getting on with the lib by the way

noble lantern
#

but CLoudliteCoreLoader has it all

tender shard
opal juniper
noble lantern
#

its hard to abstract it

tender shard
opal juniper
#

seems like a weird wrapper but ok 👍

tender shard
#

maybe I'll add another event. CancellableJumpEvent, for the current stuff, andd a normal JumpEvent that just listens to the statistic thing

eternal oxide
next stratus
#

oh shoot i see you made the coreloader thing

tender shard
eternal oxide
#

I believe so...sec

spiral light
tender shard
#

uuugh

noble lantern
#

i have a few different forks of it

#

but that one has all the needed stuff

tender shard
noble lantern
#

and you can make it more advanced like a gui that lists all your addons

next stratus
#

i feel dumb not knowing how to do these simple things 😦

noble lantern
#

you could honestly just fork CloudliteCoreLoader and change code you need

noble lantern
spiral light
tender shard
#

no. if you get the chunk, you load it

noble lantern
#

most of the code is actually copy paste from stack overflow

For the jar reading

next stratus
#

I mean, I've only just got into java coding like full on not long ago if that makes sense?

spiral light
tender shard
#

I learnt this the hard way lol

opal juniper
#

getChunk#isChunkLoaded == true

noble lantern
#

and ive been at this for years

next stratus
#

I never really learnt "java" but I went head on and got my ass in gear and learn how to do it fully

tender shard
eternal oxide
tender shard
#

I'll try it out

next stratus
tender shard
noble lantern
eternal oxide
#

yep

noble lantern
next stratus
#

there's so many things that I wish had more examples

crystal palm
# crystal palm oh wait. i think ill use itemmeta for it

nope.. i can still add protection 4 to swords. anyone know how this can be fixed? i am taking stored enchantments from enchanted books and slapping them onto the mainhand item. as i said before, i want to make it so that unsafe levels can be applied but unsafe enchantments can't.

next stratus
#

I would advise not slapping enchants on, maybe try placing them?

crystal palm
#

lol

next stratus
#

enchants have feelings too 😔

noble lantern
crystal palm
#

oh i also need to prevent this from happening

noble lantern
#

youll have to handle that yourself i think

next stratus
#

136 bytes? 🤨

#

I've never seen that before

crystal palm
noble lantern
#

there might be some method somewhere that can check this

#

but it might be hidden in NMS

next stratus
#

NMS = my weakness.

#

so fucking complex

#

i can't even set it up lol

noble lantern
#

making your own would be too hard, just have a set list of enchants you want to allow on tools/armor

eternal oxide
#

NMS got so simple recently

noble lantern
#

^

#

i never touched nms until recently with remappings

next stratus
#

1.17+ right?

eternal oxide
#

Once we have full Mojang mappings it will be really nice

next stratus
#

I think what's hardest is there's no tutorials on how to do it

eternal oxide
#

currently its a mix of Mojang and spigot

noble lantern
#

there is

#

@tender shard

#

whats the special source article

#

you made for maven

next stratus
#

maven uh oh

noble lantern
#

?remappings

#

?remapped

#

hm

#

?remap

#

smh

next stratus
#

?spigotremappings

noble lantern
#

er

next stratus
#

?nms

#

🤔

noble lantern
#

you dont want spigot remappings lol

next stratus
#

why not?

next stratus
noble lantern
eternal oxide
#

No clue, I use darkreader plugin

next stratus
#

what's that

noble lantern
#

plus moj remaps are standard normally

#

gn ppls

next stratus
#

gn 2pm sleeper

tender shard
tender shard
# opal juniper seems like a weird wrapper but ok 👍
    public static class SpigotListener implements Listener {
        
        @EventHandler
        public void onJump(PlayerStatisticIncrementEvent statsEvent) {
            if(statsEvent.getStatistic() != Statistic.JUMP) return;
            Player player = statsEvent.getPlayer();
            Location from = player.getLocation();
            Location to = player.getLocation().add(player.getVelocity().add(new Vector(0, 0.42, 0)));
            PlayerJumpEvent ownEvent = new PlayerJumpEvent(statsEvent.getPlayer(), from, to);
            Bukkit.getPluginManager().callEvent(ownEvent);
            if(ownEvent.isCancelled()) {
                statsEvent.setCancelled(true);
                player.teleport(from);
            }
        }

I fear that when doing it like this, the "to" location isn't accurate

eternal oxide
#

Yep, it will be close but not accurate

#

Doesn;t teleport also cancel all velocity?

crystal palm
opal juniper
#

i find the “to” location a bit misleading but i’m not sure

eternal oxide
#

I'd likely just zero out teh Y so as to not stop a player moving forwards

crystal palm
#

tho i have no idea how i can check if inHand.addEnchantment(itemEnchantments, levels); ended up working or not

rare flicker
crystal palm
#

hmm yeah

rare flicker
#

could also retrieve the level

opal juniper
tender shard
tender shard
#

but I dont care because when cancelling paper's jump event, the velocity is also reset

rare flicker
#

I'm trying to have some persistant data be stored onto an itemstack without using the lore, is there an easy way to achieve that or do i have to consistently track every itemstack i wanna attach data to?

tender shard
#

you can just use the ItemMeta's PersistentDataContainer

rare flicker
#

wait

#

that's basically just a hashmap

#

@tender shard i love you thank you very much

tender shard
crystal palm
# rare flicker #ItemStack.hasEnchantment(foo)?

i had a try catch so it would tell the player that the enchantment isnt compatible. if a level ends up being too high, it will end up sending the exception message instead of setting the levels and enchantments.

crystal palm
#

the bruhs were just for debug

rare flicker
#

i had no idea this was a thing

tender shard
#

You can even abuse it to store stuff like lists, maps, collections etc

rare flicker
#

o-o

#

goodbye NBT tags, come here persistantDataContainer

tender shard
#

yeah it was added in 1.14.1 but somehow, most people didnt notice

#

I also only learnt about it in 1.16 IIRC

crystal palm
eternal oxide
#

I think PDC was quite an odd design pattern back then, It was difficult for some to get their heads around, me included

tender shard
#

well it works exactly like a Map<NamespacedKey,T>

eternal oxide
#

Yep, but Spigot/MC and NamespacedKeys was fairly new too

tender shard
#

I was so happy when I discovered that it existedd

#

everyone thank @eternal night for this awesome thing

eternal oxide
#

Unless you were knowledgeable of languages like VB.Net, namesdspaces were new.

tender shard
#

well in the end, a namespacedkey is just pluginname + key name 😄

tender shard
#

i dont really understand the question

eternal oxide
#

line 7 can throw an NPE if your hand is empty

tender shard
#

you could do stuff like

boolean failed = false;
// ...
try {
  // something
} catch (Exception e) {
  failed = true;
}
// ...
if(failed) {
  // Do stuff when it failed
}
#

if thats your question

tardy delta
#

finally block

crystal palm
#

yeah im aware

hybrid spoke
#

@tender shard is there an option to disable the automatic code suggestions and trigger them by pressing a specific key? -> github copilot

tender shard
#

seems possible

#

there's a shortcut to "show completions" and there's a setting to hide them in the editor

hybrid spoke
#

oh nice

#

now i only need to find free keys

tender shard
#

press shift twice, enter copilot, and then you see all options regarding that that are available

#

i never want to code without it again

hybrid spoke
#

i mean it somehow even completed my todo messages

tender shard
#

yeah it's scary how accurate it sometimes is

#

I tried tabnine and code4me too but they only suggested shit all the time

#

copilot is so much superior

hybrid spoke
#

well copilot has the advantage of 10000000 repos

tender shard
#

yeah well

#

tabnine etc could also scan every public repo

hybrid spoke
#

but im not sure how its so fast

#

with different solutions which all makes sense

#

even codebased things

tender shard
#

probably not. but I dont really care why copilot is better, I am just happy that it is, lol

hybrid spoke
#

like on the huge project at my work

#

but sometimes i get the same suggestion 4 times and can never press tab because otherwise it autocompletes it

regal dew
hybrid spoke
#

or if there already is code it still suggest something

regal dew
#

and idk why you are still shitting on code4me for a task it is not supposed to do

tender shard
#

we were talking about copilot and I said that I tried other AI completions and that copilot is better. That's not "shitting on" anything, it's merely describing my true experiences

regal dew
#

I am just happy that it is, lol
i call this shitting on

#

fyi copilot is 100x bigger than what code4me uses

tender shard
#

when I say "I am happy that Copilot works flawlessly", that's considered shitting on code4me?

regal dew
#

trained on a billion more repos too

tender shard
#

And that's why it's better

regal dew
#

no but i just searched back and you're shitting on a project of mine without any knowledge of the research or what it is about

tender shard
#

why do you take everything personally lol

#

Copilot is just better and I don't regret saying that

#

I don't care why it is better, I just wanna use a tool that works fine

regal dew
#

you made it personal after using the research out of context and not for the original purpose

#

then proceeding to shit on it left and right

tender shard
regal dew
#

for every mention of copilot you have to include code4me, just dont

tender shard
#

what is the original purpose of it? I thought it was to get AI code completions

regal dew
#

AI code completions for the python language, with in mind that it only has access to your current opened document

#

you were (1) expecting it to work for the bukkit api and (2) in the java language

tender shard
#

yeah, that's what people expect from "AI" - that it learns to use other APIs too

opal juniper
#

although sometimes it suggests some shit, i’m like “damm that would have been better api design”

tender shard
regal dew
#

it is not comparable to copilot, because it is not meant to be a replacement for it, it is an evaluation study with the aforementioned points in mind

ivory sleet
#

Sounds like a #general discussion

opal juniper
#

no

ivory sleet
#

Yes

hybrid spoke
hybrid spoke
opal juniper
#

until there is a question we can talk about what we want

tender shard
#

also if you claim "its only meant for python", maybe you should mention that on the website, ebcause the word "python" doesn't appear there at all, so how is one supposed to know that?

ivory sleet
#

There arent any questions here as far as I can read

hybrid spoke
#

how is a conversation about a coding tool a general discussion

ivory sleet
#

Yes, but this channel is intended for questions mostly

hybrid spoke
#

that discussion based on my question

#

so whats the problem

tender shard
#

lets just move to general, I mean who cares

#

doesnt hurt anyone if we go to #general

ivory sleet
#

Well you guys are just debating back and forth now

crystal palm
#

aha! apparently this thingy doesnt check if the enchantment level is too high

opal juniper
#

hence it’s unsafe

crystal palm
#

only levels, not enchantment ids.

torn shuttle
#

quick q if I have a version in plugin.yml is there any point in also having a version in build.gradle if I am not generating the plugin with build numbers?

mellow edge
#

hi

#

why doesn't that work?
Bukkit.getBanList(BanList.Type.NAME).addBan(p.getName(), ChatColor.GOLD + "...", new Date(System.currentTimeMillis()+ 60L*60*9999999), "...");

#

ohhhhh, thanks

tender shard
torn shuttle
#

not 100% sure

#

I just don't want to keep updating both plugin.yml and gradle at the same time, is there a way to get one to read the other?

crystal palm
#
                    Map<Enchantment, Integer> enchants = meta.getStoredEnchants();
                    for (Enchantment itemEnchantments : enchants.keySet()) {
                        int levels = meta.getStoredEnchantLevel(itemEnchantments);
                        enchants.get(1);

Would enchants.get(1); get the first/second enchantment name or no?

opal juniper
#

it would error

#

Integer cannot be cast to Enchantment

chrome beacon
#

^

glossy venture
#

because im pretty sure that minecraft stores the enchantments in order