#help-development

1 messages ยท Page 1963 of 1

mortal hare
#

its a bit more modular

#

you can make your guis act differently

tardy delta
#

hardcoded ๐Ÿ’€

mortal hare
#

it uses strategy design pattern

#

and has few handling impl available

#

you can make it simulate vanilla actions, excluding gui elements

sterile token
#

I hate that menus system you have to create extra classes

mortal hare
#

and make GUI elements which are not even in itemstack form

lost matrix
#

Animated inventory names ftw

tardy delta
#

packets?

mortal hare
#

that's not possible, you need to open new inventory in order to do that

#

or use packets to open one

sterile token
#

This is why i work with Intellij. Its consuming 4gb of ram. But i have 64gb so no problems

tardy delta
#

lmao

#

i got 8

mortal hare
#

64 gb of ram

#

dude you're ready

#

for windows 20

#

where 32 gb of ram would be a min requirement

tardy delta
#

then ill switch to linux

#

im switching anyways after i finished school

mortal hare
#

8gb was so laggy for me

#

so i bought cheap 20 euro ddr4 one

#

i mixed the ram

#

but i researched everything

#

to make it compatible

#

and it worked

#

i saved 80 euros

sterile token
#

I buy 64gb of ram. Cuz when i went to store they have 4 rams (4-16gb) that where chargeback by the buyer. So the shop have to resell it at a lower price. And i ask then to test it and see if they were working. And they worked so i bought them

#

I think i paid 90 dollars, when they should be more than 100 dollars

lost matrix
#

I got my 64gigs for minecraft renders...

sterile token
#

And its freaking amazing having 64gb cuz you can open more than 1000k google pages

lost matrix
#

*Chunky

lost matrix
#

on chrome

mortal hare
#

actually my gui system can support more than gui inventories

#

it can support holograms as ui elements too

#

due to extensive interface architecture

sterile token
#

holograms inside gui?

mortal hare
#

no

lost matrix
#

lol

mortal hare
#

Holograms as part of UI element

#

its like Adventure api

sterile token
#

holograms are iselft armor stand on air?

mortal hare
#

its packet based

sterile token
#

But holograms are simple armor stands entities on air right?

mortal hare
#

you register UI objects in the same registry

#

and the handlers would take care of it

#

you only need to implement action method

sterile token
#

Enough already stop humiliating me, I've only been in this for 1 year

mortal hare
sterile token
#

Haha

mortal hare
#

i'm highly sensitive person

sterile token
#

Oh sorry

tardy delta
#

lmao been modifying my code four two hours now and still cant find the bug

mortal hare
#

the best time ever

#

ITS DEBUG TIME

tardy delta
#

databases and concurrency yeah shut up

#

:o

mortal hare
#

๐Ÿ˜‚

sterile token
mortal hare
#

something's not thread safe

#

i can feel that

tardy delta
mortal hare
#

its a lib for unit testing of plugins

tardy delta
#

creating home and when the user leaves the home is gone while the data is saved :/

sterile token
#

Mock Bukkit, its a library used to make test and debugs

tardy delta
#

uhh

sterile token
#

Today im not stressed because i went to a bowling alley so i wil ltry to help you

tardy delta
#

the player is making a home and that gets immediately uploaded to the database

#

when they leave that data is cleared from the cache

sterile token
#

Oh bad idea for a sync designing

#

Ahh allrgith forgot my message

tardy delta
#

when they join back the homes dont load but the rest does

#

:/

#

i dont see any implementation fault

sterile token
#

Can i get connected to your ide?

tardy delta
#

no >_>

#

can show the github code

sterile token
sterile token
#

I just wanna see your implementation

#

I thought you where working directly over databases. But then i see that you mentioned you where using cache

tardy delta
#

heh gl

#

idk where to start? maybe from the command

sterile token
#

In these times, for multi server sync its highly recommend using cache system

#

Upload all plugin please

ivory sleet
#

uwu

tardy delta
#

owo

sterile token
tardy delta
#

conclure thinking no no no

ivory sleet
#

idk what u guys r talking 'bout but whenever multithreading comes into play it gets interesting

sterile token
#

Conclure

ivory sleet
#

Verano123

sterile token
#

For data catching (a cache) you would use async?

ivory sleet
#

more or less yes

#

well there's no "sync" really

sterile token
#

I would use async cache and databases query async

tardy delta
#

you probably want to see the impl of the database

ivory sleet
#

thats just that some code executed linearly in correlation to some other code depending on how it was declared

#

I mean

#

you don't need an "async" cache, but rather just a thread safe cache

sterile token
ivory sleet
#

for instance lets say you're fetching your persistence database and then want to store the result in some data structure

#

then its to your benefit if that data structure of yours is thread safe

#

such that you dont have to sync back to another thread

#

since that'd just be a waste of resources and complicate design

mortal hare
#

is there any reason to cache booleans

#

will it pre evaluate

#

and be faster

ivory sleet
#

A ConcurrentHashMap or ConcurrentSkipListMap or ConcurrentHashMap.newKeyView() or guavas Caffeine's caches or guava's caches, theres a lot of them

#

even reddisson got their own thread safe collections

#

I mean

tardy delta
#

only getting and no setting kekw

ivory sleet
#

ConcurrentHashMap.newKeyView() uses boolean values as dummy values

#

(might bew newKeySet idr)

ivory sleet
#

at some point you must?

tardy delta
#

nvm

sterile token
#

I think he only updates the cache, and on server join or quit he load/save the cache (May be not, that what i understand)

ivory sleet
#

:/

#

its not very smart to just have two points during an entire session in which you save/load

#

can I get more serious?

sterile token
#

I want to ask if it recommendable to have bukkit runnables inside custom data object?

ivory sleet
#

depends on the situation

#

but data objects generally only tansfer data between its dependencies

sterile token
#

I ask because Fourteen has one inside his user object (Not for criticing just to know )

ivory sleet
#

its not supposed to manage itself, then you violate single responsibility principle to some degree

tardy delta
#

its an actionbar

ivory sleet
#

hmm I would personally have that logic isolated in some other class

#

but I

tardy delta
#

didnt know you were actually looking at it

ivory sleet
#

g

tardy delta
#

its a innerclass

#

i dont care about it

ivory sleet
#

yeah

#

then you technically dont break srp

sterile token
#

fourten your problem it was when saving or loading data?

#

And was on cache or database?

tardy delta
#

seems like the homes arent loaded

#

i think the issue is in the #loadHomes method so im debugging that now

sterile token
#

Allright let me take a look at code

#

pubkic record?

#

What thats?

warm light
#

I can't find setCape block

tardy delta
#

the Home record?

sterile token
#

A record its a new class type?

tardy delta
#

its newer java stuff

sterile token
#

A allrgitht hanks

#

I didnt know

ivory sleet
#

ye

#

basically a class which can carry some other objects

#

(not re-settable)

tardy delta
#

unfortunately

sterile token
#

I just remeber a friend told that was the same as an Enum and it can be initialized. Its correct?

ivory sleet
#

immutable data carrier

#

no

#

its quite different from enums

vital yacht
#

Records are good

tardy delta
#

they make my class one liners ._.

minor garnet
#

Make entity rotate to player direction

tardy delta
#

org.bukkit.plugin.InvalidPluginException: org.bukkit.plugin.IllegalPluginAccessException: Plugin attempted to register task while disabled wdym disabed i was starting a runnable in a constructor

ivory sleet
tardy delta
ivory sleet
#

owo

tardy delta
#

weird things happen

#

maybe i should wait

ivory sleet
#

you should start unit testing ๐Ÿ˜„

tardy delta
#

while (!plugin.isEnabled)

sterile token
tardy delta
#

how can i start a repeating runnable on enable?

ivory sleet
#

well

#

just ::runTaskTimer

#

however it'll start running post bootstrap

tardy delta
#

wait im instantiating this class before constructor

quiet ice
#

So by definition, it can never happen in the constructor

tardy delta
#

nvm im confusing some things

grim ice
#

Can someone

#

explain JUnit

#

what the heck is unit testing and shit

sterile token
grim ice
#

i dont get anything about that

sterile token
#

?junittestings

maiden thicket
#

hey @ivory sleet i saw you in the geckolib discord, can i dm u for some help if that's okay?

sterile token
#

?jUnitTestings

#

it was a command that used to sent a link about jUnit testings

ivory sleet
#

unit testing is the procedure of testing single functions of a class by writing test cases in code for it

sacred mountain
#

any ideas why sometimes the number has a ton of decimal places?

String s = configFile.getFireballDamageRange();
String[] parr = s.split(":");
int lowerquart = Integer.parseInt(parr[0]);
int higherquart = Integer.parseInt(parr[1]);

double rand = Math.random() * higherquart + lowerquart;
double truncatedrand = new BigDecimal(rand).setScale(1, RoundingMode.HALF_UP).doubleValue();
ivory sleet
#

its a way to make sure none of your functions are working incorrectly

grim ice
#

how

maiden thicket
#

thats one thing

#

idk why u are

ivory sleet
#

how?

#

well

sacred mountain
ivory sleet
#

junit is a java library that aims to make testing in java easy

grim ice
#

how does the thing work

tardy delta
grim ice
#

JUnit.makeItWork(method());? how would it happen

ivory sleet
#

tho should be said it was quite some time since I was in touch with the gecko lib and its devs @maiden thicket

grim ice
#

aka whats the logic behind it

maiden thicket
#

wow u have paldiu added i had no idea

naive bolt
#

ignore what i said here

maiden thicket
#

๐Ÿ˜…

ivory sleet
#

hmm yeah

#

I have known him for almost a year now probably x)

#

great guy

maiden thicket
#

ahh

#

yeah

grim ice
#

so uh

sterile token
naive bolt
#

basically when i add a command to plugin.yml it registers by itself. But i only want to make the command exist if the config says true

#

how can i do this

ivory sleet
#

Reflect the command map

#

And add the command yourself

naive bolt
sterile token
ivory sleet
#

Look at what verano got, will probably suffice for you

grim ice
#

if(!XPlugin.getStorage().get("commandName")){
return true;
}

#

where XPlugin is ur main class

sacred mountain
#

?

grim ice
#

getStorage is a getter for ur storage hashmap, that has each command name and its boolean, that u set on enable by reading the config

#

thats the simplest and probably a bad way to do it

#

but it works

#

since it prob breaks SRP, ur main class isnt supposed to have random fields on it, or is it ok?

tardy delta
ivory sleet
#

Well generally single respond principle states a class must only change for one major reason

#

Thatโ€™s it

grim ice
#

so it is ok?

ivory sleet
#

Well the entire thing of what one major reason is defined as, is hella subjective

#

So itโ€™s up to you to decide

grim ice
#

IC

#

anyways i still do not understand JUnit

#

and unit testing

#

and anything related to that

ivory sleet
#

Once I get home I might be able to give you a Ted talk

grim ice
#

wdym make sure a function is working

#

Alr :o

young knoll
#

A con talk

tardy delta
#

nice call none of them are speaking

#

._.

grim ice
#

now 4

tardy delta
#

heh 4 now

#

5

sacred mountain
#

5

opal juniper
#

hmmm i am trying to implement a way of checking if i could "walk" a certain path given 3 locations, the current one to eval and then the 2 previous but im not really sure how to impl it tbh. like uh i was thinking about the changes in Y value but what i have made doesnt work

#

i dont want to not allow changes in Y tho

#

and just glue the path to the floor

#

anyone got any pseudocode ideas

sacred mountain
#

like a pathfinder?

opal juniper
#

myeah thats what im doing

sacred mountain
#

around blocks or

opal juniper
#

yes, but it also has to be "walkable"

ashen radish
#

How I get a invisible itemframe in spigot 1.18.1?

valid solstice
#

Hi how would i put many materials in a shaded recipe?

#

Like i wanna put 10 items in one slot

#

Something like that

#

Thanks

sacred mountain
#

maybe try each direction and move forward 1 block. if there is a dead end then turn, repeat

#

id

#

k

#

im sorta thinking like a maze, is yours for terrain?

opal juniper
#

yes

#

any terrain

sacred mountain
#

and no y change?

#

how would that work

#

oh i misread your msg nvm

naive bolt
#

why does it not think its a string

tardy delta
sacred mountain
#

walk in straight line to location
if block is higher y level than block standing on then jump
if 2 blocks in the way of player, turn, walk and turn back to previous vector in relation to the location

maiden thicket
#

it wants a component

naive bolt
#

oh yea

sacred mountain
#

is that just your ide displaying !=

naive bolt
#

yea

sacred mountain
#

hmm looks nice

opal juniper
#

ooh i did just find a bit on a bug where i wasnt cloning my custom location wrappers lemme check

opal juniper
sacred mountain
#

ye

opal juniper
#

and yea- it takes a component not a string

maiden thicket
#

many materials

opal juniper
valid solstice
#

32 in each slot

vale ember
#

you would probably need to listen to events and something like this, but you can't do that with plain crafting mechanics

valid solstice
#

Damn

valid solstice
vale ember
valid solstice
#

Alright thanks ๐Ÿ™๐Ÿผ

vale ember
#

np

sacred mountain
#

Is there an event for projectile deflection or redirection

#

in my case, ghast fireball deflection

tardy delta
#

what does deflection mean?

sacred mountain
#

as in

#

you know the return to sender achievement

#

when you hit the ghast fireball back to it

#

is there an event for when the player hits that fireball

tardy delta
#

an fireball is an entity right?

#

entitydamage event?

sacred mountain
#

can you even damage a fireball?

#

with a punch

midnight shore
#

Guys how does the persistent data holder for the players work? Does it save on quit and join? Cause I tried to set a value but when I rejoin something weird happensโ€ฆ I donโ€™t even know how to explain

tardy delta
#

ProjectileHitEvent i think

sacred mountain
#

thats when the projectile hits something

#

not when something hits the projectile

#

public class ProjectileHitEvent
extends org.bukkit.event.entity.EntityEvent
Called when a projectile hits an object

#

if its hit back it doesnt explode just changes trajectory i

tardy delta
#

conclure you know this owo

sacred mountain
#

owo

tardy delta
#

thats the spiwit

tardy delta
#

on reddit they say that you cant detect it

sacred mountain
#

is there anything that even changes on the fireball

#

like nms metadata nbt etc

tardy delta
#

the velocity when you hit it

sacred mountain
#

nms handler or something

sacred mountain
#

me *

#

im trying to send a message like

"You deflected player's Fireball!"

#

something like that

grim ice
#

OMFG IT MAKES IT WAY COOLER HOW

sacred mountain
#

PlayerInteractEntityEvent

#

found

#

i think that should work

tardy delta
#

n00b

sacred mountain
naive bolt
#

makes readablity nicer

tardy delta
#

lmao rainbow code

sacred mountain
sacred mountain
#

ia

#

qwertyuiop+

naive bolt
#

how do i put each event in its own file
do i need to make my own event manager

glossy venture
#

you mean listeners or events

naive bolt
#

listeners

glossy venture
#

oh nah you just need to register multiple listeners

naive bolt
#

oh yea i was using registerEvents but i will use registerEvent

glossy venture
#

registerEvents is fine

kind hatch
#

Use registerEvents

#

registerEvent is the old way of registering events. You can still use it, but it really only has certain use cases nowadays.

ivory sleet
#

Okay @grim ice ,

To begin with, programming software, whilst constantly trying to make things work can be synonymous to how science and physics works. In software it is difficult to prove that your code is correct. It might work to the extent of how you want it to behave, therefore it might not be incorrect, but that does not imply it is correct. In physics we can demonstrate that something is not incorrect by experiments, but it is really hard to prove something to be correct, for instance the quantum field theory. We have simply enclosed the set of formulas, principles and laws with counter arguments that we've collected such that there is no meaning in trying to further disprove them.

Conversely to mathematics where things can be proven correctly due it its abstractness mainly. For instance it is quite easy to prove 1 + 1 = 2 by using set theory, category theory and for instance group theory including normal calculus. This can be done by defining a binary operation of the sets the terms are contained in, and then define some other properties. Of course, it is possible to prove software mathematically, its just that the proofs get insanely colossal quickly, as an example it's possible to prove state by lining up a set of predicates using predicate calculus and category theory.

So instead of laying focus down to write mathematical proofs that justifies our code is correct, we can surround the production code with test code that demonstrates our code is not incorrect, yes double negation but that is the only way to phrase it.

Another reason why we unit test apart from proving our code to not be incorrect, is because it skips manual testing as that becomes incredibly error prone in professionalism. It is very easy to test just the smallest parts of our code, whereas when you test by manually following a set of instructions you often test a lot of irrelevant things also which may affect the output.

There is even a third argument that can be made, testing explains the production code you write, and over and above all unit testing (if used correctly) can lead to better design, as you have to write fine apis to make sure the unit is working.

Should be mentioned, unit testing and tdd are not the same, tdd (test driven development) always implies unit testing, but unit testing does not necessarily point towards tdd. Also, some of the arguments I made here are not specific to just unit tests, but also functional tests and other tests you may exercise in software.

tardy delta
#

here we go again ๐Ÿฅบ ๐Ÿ˜‚

grim ice
#

ty

#

lemme read that

ivory sleet
#

tried to structure it into paragraphs to make it a little bit more pleasing to read

tardy delta
#

lol

#

quantum theory

ivory sleet
#

myes

#

there are some unresolved issues concerning quantum theory and relativity theory iirc which goes under the quantum field theory

grim ice
#

but how does it prove that it's not incorrect

ivory sleet
#

we write code that tests some function

#

for instance

tardy delta
#

its also quite easy to prove that 1 == 2

#

'maths'

#

meh

ivory sleet
#
class Person {
  int age;
  boolean hasBaby;

  void setAge(int i) {
    age = i
  }

  int age() {
    return age
  }

  boolean hasBaby() {
    return age > 12 && hasBaby
  }
}```
#

here we can for instance test that the setAge function works

tardy delta
#

having a baby when 12 ๐Ÿค”

ivory sleet
#

lets say we want to test that the person's age actually gets changed (just a dummy test to explain)

#
void doesAgeReturnSameNumber_givenSetAgeInvocation() {
  Person person = new Person();
  person.setAge(13);

  assert person.age() == 13
}```
#

In junit we would use Assertions.isEqual(person.age(),13) iirc

grim ice
#

so yeah what did that even do

#

so is it like

#

comments?

ivory sleet
#

no?

grim ice
#

since u wont really use that method in ur code

#

will you

ivory sleet
#

no

#

thats just for testing

#

not production code

grim ice
#

and for stuff like spigot where u have to open up a server how can you even do it

ivory sleet
#

we have to emulate the entire server essentially

fervent gate
grim ice
#

also in ur example its supposed to be boolean not void, right?

ivory sleet
#

?

#

no not really

grim ice
#

like the method doesnt return any value

#

so how is it any use

ivory sleet
#

what does that have to do with testing?

grim ice
#

when you test, you want to know if the test works, right?

#

dont you need to return the value so u can later access it

tardy delta
#

it will throw an exception if its not equal

ivory sleet
#

no 2hex

#

we just throw if the test fails

#

(essentially)

grim ice
#

so what do i do if i want to test

#

which i dont see how will it even benefit mee

#

its just more lines of code

ivory sleet
#

yes you write a lot of code to test your actual code because you're testing your code against different cases and make sure the way your actual code handles all of those cases are according to your intentions

#

it benefits you because it avoids manual testing

#

it makes it very accessible to test single functions of yours

#

and makes it extremely easy if you just want to test something again

arctic moth
#

Is it a bad idea to use pdc to store player-specific config

ivory sleet
#

lets say you wanna test that a bedwars victory function goes accordingly

#

manually testing that everytime would be a pain

grim ice
#

RIGHT

#

damnnn

ivory sleet
#

moreover, how do you know that the bedwars victory function still works when some other code gets changed somewhere else?

#

with automated tests you can simply click a button to run that test again

#

but yes

tardy delta
ivory sleet
#

let me talk about the disadvantages

quiet ice
grim ice
#

so u can literally skip to the point where u win, and just throw an error if something goes wrong with ur checks

ivory sleet
#

yes

#

you can mock the players

#

mock a win situation

tardy delta
ivory sleet
#

and just run the test

grim ice
#

dammmmmmm

still verge
quiet ice
arctic moth
#

How do you make those little autocorrect option things in commands

#

Like in essentials, for example

#

They have those options that pop up

quiet ice
#

Since the proof that 1 == 2 requires a division by 0, it is not possible in Q and all subsets

still verge
sacred mountain
#

tabnine

#

good plugin

#

anyone know an event that can detect left clicking of entities? (hitting)

#

or a way to detect it

still verge
sacred mountain
#

ill give it a go ig

quiet ice
#

I think R doesn't allow for division by 0 either, so yeah 1 == 2 is also invalid in R

still verge
arctic moth
sacred mountain
#

deflect

ivory sleet
#

Disadvantages of testing:

  • You have to write a lot of test code
  • Additionally, you have to maintain all the test code, and fix it if you break it
  • It takes long time to get into the unit test exercise, especially to master it
  • Unit tests can also lead to rigid designs where when you refactor normal code, test code breaks easily (known as the fragile test problem)
  • Certain refactors will always break test code like extracting another class from a given class
  • Sometimes its hard to decide whether a unit should be tested or not, and which unit is the right one to test
#

@grim ice

still verge
grim ice
#

o

sacred mountain
#

o

#

so

sacred mountain
ivory sleet
#

Like everything, it comes with pros and cons

still verge
sacred mountain
ivory sleet
#

It does

still verge
sacred mountain
#

ill try it

grim ice
#

where u can make a command to just automate the win

ivory sleet
#

but even so its the best way for your stakeholders at the company to know that you are not shipping shit

grim ice
#

you can just

#

make a win command

ivory sleet
#

yes but that still requires you to manually test it

grim ice
#

unit testing isnt really necessary, is it

grim ice
ivory sleet
#

and as said you'd essentially have to keep testing it if some code change

#

well

grim ice
#

faster than writing all that code to do it

ivory sleet
#

manual tests are more time consuming than what you think

quiet ice
# ivory sleet Disadvantages of testing: - You have to write a lot of test code - Additionally,...
  • You have to write a lot of test code
    This is good, the more you use the software the better the software API becomes, thus reducing semver breakages
  • Additionally, you have to maintain all the test code, and fix it if you break it
    This results in the developer more caring about ABI, which is also good
  • It takes long time to get into the unit test exercise, especially to master it
    Valid
  • Unit tests can also lead to rigid designs where when you refactor normal code, test code breaks easily (known as the fragile test problem)
    This is the result of bad design and is likely to no be an issue if you have more experience with avoiding these problems
  • Certain refactors will always break test code like extracting another class from a given class
    Not sure
  • Sometimes its hard to decide whether a unit should be tested or not, and which unit is the right one to test
    Very Valid
sterile token
#

What a lovely shity. The dependency its not being relocated

ivory sleet
#

especially when code bases grow beyond 1 million lines of code

sacred mountain
quiet ice
#

I don't think anyone here writes enterprise software

#

At least I hope so

sacred mountain
#

yooo it worked

#

@still verge

#

ty lol

ivory sleet
#

and it does not always result in devs caring

#

because in reality devs get afraid of touching and refactoring code

#

because you are bound to break the code

sterile token
#

So?

grim ice
#

unit testing seems like pain

ivory sleet
#

thus youll have to go and clean it up which takes time

still verge
ivory sleet
#

and regards to those refactors that always break test code, for instance if you're breaking out a delegate

grim ice
#

imagine if u can do something like exec() in py

#

or is it called eval

#

either way run a method on fly

#

so like

#

u can code inside of minecraft

#

/run Bukkit.getPlayer("2Hex").sendMessage("ur mom");

sacred mountain
#

that would be cool

quiet ice
sacred mountain
#

can you inject code using a mc player input tho

#

or run code whatever the word is

ivory sleet
#

yeah ๐Ÿ˜… not saying ur wrong

quiet ice
#

I think too much with the mind of an open source person

sacred mountain
#

i doubt its possible, but some sweat could probably do it

ivory sleet
#

becase what u said is the true intention

#

but sometimes everything doesnt play out fair and square

brave sparrow
brave sparrow
tardy delta
#

i should try unit testing.. already three hours trying to fix something

sterile token
quiet ice
#

I started doing unit testing and found multiple bugs thanks to it, one which I couldn't even reproduce in production and I had no idea how it didn't occur in production because it should by all accounts happen in production and not just during unit tests

fervent gate
quiet ice
#

Also unittests can act as a primitive benchmark

sterile token
#

How its possible that a premium Anticheat that cost 60 dollars, you can disable checks with a simple Sping-Poof

#

Its fucked amazing

quiet ice
#

Sping-poof?

sacred mountain
#

when you accidentally run /stop on your server instead of saying 'stop'

#

pain

sterile token
quiet ice
#

You mean ping-spoof?

sterile token
#

Yeah that

sacred mountain
#

lmao

#

sping poof

sterile token
#

I have disabled some checks from the anticheat doing ping-spoof

quiet ice
#

Just wanted to be safe, it could've been some form of mechanism I have never heard about

sacred mountain
#

i have finally completed

#

a plugin

#

:D

quiet ice
#

But yeah, anticheats are a bit sus in our days

sterile token
#

I will probably make a scam report on mc-market because i want my money back

#

With that money and an extra, i would pay for a good anticheat and custom

sacred mountain
quiet ice
#

I doubt that it is worth buying an anticheat

sacred mountain
#

wtfrick no

#

no ban

sterile token
#

Sorry

#

Wrong discord server

quiet ice
sterile token
#

Normal?

quiet ice
#

How do you send the component?

naive bolt
#

make it real

#

yea ig

quiet ice
#

And from what framework does the component come from? Bungee or Adventure (or something else entirely?)

sterile token
#
TextComponent component = new TextComponent();
player.spigot().sendMessage(component);
#

Yeah

quiet ice
#

Okay, then it's bungee chat

#

And how do you send it?

naive bolt
#

its a spigot plugin

quiet ice
#

It's virtually identical

#

?jd-spigot

undone axleBOT
naive bolt
#

thats why i use it

#

player.sendMessage(message.toString());

sterile token
#

Read my message

dusk flicker
#

thats not how it works with components

quiet ice
#

Yeah, don't use .toString()

#

.spigot().sendMessage

dusk flicker
#

VERANO gave you the exact code

sterile token
quiet ice
#

Or just use paper and have the wonderful ingenuity of adventure who's implementation sucks a bit less.

tardy delta
#

i officially declare the war to my database

#

smh

sterile token
quiet ice
#

flatfile is best

tardy delta
#

it doesnt make sense why it isnt working

naive bolt
#

what about when i do it on a command.
i get CommandSender do i need to get the player

dusk flicker
#

cast it

quiet ice
#

Cast it to player after an instanceof

dusk flicker
#

this is basic spigot

tardy delta
#

i updated all the stuff to the tables and now it can find everything except the stuff i need

sterile token
#

FlatFile best = one server instance
Database bast = multi server instance

dusk flicker
#

eh

brave sparrow
quiet ice
#

or better: if (sender instanceof Player player) {/* you now can use player as a player */}

dusk flicker
#

id still not run flatfile if it was just one server

tardy delta
#

im saving stuff to a table and it wont save idk

#

so my ResultSet#next is returning false ._.

brave sparrow
#

Show me how

tardy delta
#

i dont think you will understand it but ye

brave sparrow
#

I think Iโ€™ll be ok

#

Lol

tardy delta
#

not its not okay

#

if you take a look at the same the method #createHome i mean

brave sparrow
#

Iโ€™ll take a look

tardy delta
#

the records arrive at the database im 100% sure about that

#

but loading them fails or something

#

im loading them in the #loadUser method

#

while (ResultSet#next) doesnt seem to work in #loadHomes

#

debugged it

#

cant find why

sterile token
tardy delta
#

i know

#

if you're looking for the table setup, its in the constants class

#

no errors, only when i leave and i join back (so the user cache is cleared) and i create a new home, i get an error on the database that the record with that primary key pair does already exists

#

my man is gone i think lol

brave sparrow
#

im looking

tardy delta
#

hehe

brave sparrow
#

ok sorry had to help my girlfriend with something

#

now

#

i found the issue

#

lol

#

your LOAD_HOMES query is wrong

#

you have SELECT * FROM homes WHERE user=?, name=?;

#

when you want SELECT * FROM homes WHERE user=?;

waxen plinth
#

And to combine conditionals you use the keyword AND, not a comma

brave sparrow
#

yeah

waxen plinth
#

So it would be SELECT * FROM homes WHERE user=? AND name=?;

brave sparrow
#

not in this case

waxen plinth
#

If you wanted the and

brave sparrow
#

they want to load all the homes

#

if they want to load a specific home then yes, it would need an AND

#

@tardy delta ^

tardy delta
brave sparrow
#

then push your code to git lol

#

ah i see it on there now

#

ok now let me look

tardy delta
#

every commit has "local changes" as message lol

brave sparrow
#

hmmmm

#

i almost wonder if it's due to you trying to loadHomes inside the result set of a different query

blazing scarab
blazing scarab
#

it looks ugly and not necessary

brave sparrow
#

the semicolon is fine

tardy delta
#

:(

brave sparrow
#

lmfao

waxen plinth
#

I usually put semicolons

brave sparrow
#

^

#

especially if i'm doing a multiquery

#

anyway

brave sparrow
#

and see what happens

tardy delta
#

ye

brave sparrow
#

wait nvm

#

i figured it out

#

lmfao

#

@tardy delta

#

look at the fields of "homes"

#

then look at your queries to delete and load from that table

#

see the problem?

blazing scarab
#

you even can do multi queries with jdbc?

brave sparrow
tardy delta
#

wait lemme see

brave sparrow
#

if you can figure it out yourself that'd be preferable but if you need i will still tell you

tardy delta
#

wdym the fields of "homes"

brave sparrow
#

the columns

tardy delta
#

nah i dont see it

#

the names seems fine

#

and i have to go :(

brave sparrow
#

CREATE TABLE IF NOT EXISTS homes(name varchar(40), owner varchar(40), location_x DOUBLE, location_y DOUBLE, location_z DOUBLE, location_pitch FLOAT, location_yaw FLOAT, location_world VARCHAR(40), PRIMARY KEY(name, owner));

#

SELECT * FROM homes WHERE user=?;

#

what's missing

tardy delta
#

lmao

brave sparrow
#

you're loading where user=?

#

but the table doesn't have user

#

it has owner

tardy delta
#

im stupid

#

looked over it

brave sparrow
#

also your DELETE query is wrong

#

DELETE FROM homes WHERE user=?, name=?;

tardy delta
#

๐Ÿ‘

#

thank yo very much anyways

brave sparrow
#

needs to be DELETE FROM homes WHERE user=? AND name=?;

#

yeah no worries

tardy delta
#

๐Ÿ™‰

ivory sleet
#

@fervent gate

#

(sometimes powermocks is necessary)

lavish hemlock
ivory sleet
#

to mock dependencies?

lavish hemlock
#

But what is mocking

brave sparrow
#

"In object-oriented programming, mock objects are simulated objects that mimic the behavior of real objects in controlled ways, most often as part of a software testing initiative"

#

LMGTFY

ivory sleet
#

well essentially you're isolating actual dependencies to make sure you're just testing the unit itself, mocking is when you have an implementation of a dependency where you can make sure they are not affecting the test negatively

#

without mockito you'd need to create a new class for every dependency you want to mock

brave sparrow
#

for example, you don't want to have to spin up a real spigot server every time you test your plugin

ivory sleet
#

which can become quite tedious, and at some point might even have to test your mocks which is a pain

#

so mockito is to big help sometimes

fervent gate
ivory sleet
#

yes

#

well if you need the entire server running to perform a test

fervent gate
ivory sleet
#

then its not a good idea but the only idea thats decent

ancient jackal
ivory sleet
#

no

brave sparrow
#

Nope

#

Lmao

ivory sleet
#

lets say one of your classes depends on Plugin

#

you could just create an impl of Plugin and pass that

ancient jackal
#

no clue what that means so I should probably ?learnjava

ivory sleet
#

perhaps, unit testing is considered an advanced topic apparently

left swift
#

How can I detect Entity / Player collision with other entity?

brave sparrow
#

Understandably so to be fair

grim ice
#

maybe

quiet ice
#

usually you'd do extends JavaPlugin

brave sparrow
#

Nope

#

How are you sending the message

desert marten
naive bolt
#

player.spigot().sendMessage(message);

quiet ice
ancient jackal
ivory sleet
#

Well JavaPlugin cannot be mocked entirely with a mock of your own, with mockito you can

brave sparrow
naive bolt
#

yes

lone remnant
#

Some Error I dont know how it happened

eternal night
#

MockBukkit ๐Ÿ™

ancient jackal
#

so I'll get mockito for sure then

brave sparrow
ivory sleet
quiet ice
ivory sleet
#

I believe

#

tho it needs some love

eternal night
#

Cats sometimes have wild things to do

ivory sleet
#

lol

#

indeed

brave sparrow
grim ice
#

tbh any java topics i can learn

naive bolt
#

ffs im so dumb

grim ice
#

i wanna progress

#

ill learn a bit more about unit testing but not a ton since i dont need it atm

#

im open for any other use(ful/less) topics i can learn tho

ivory sleet
#

Reflection, MethodHandle, java.nio.channels and the concurrency classes, the executor api, java's module system, ClassLoaders (they are awful but extremely useful) and annotation processing api

brave sparrow
#

Bitwise operators are fun and not too hard to learn

grim ice
#

thats epic

sterile token
#

Does anyone need help? I see someone tag me but i cannot find it

grim ice
#

they explained those to me before

brave sparrow
#

Did they explain why HashMap uses bitwise rather than modulo in Java?

ivory sleet
#

like generally learning concurrency classes in java is extremely useful

brave sparrow
ivory sleet
#

indeed

grim ice
#

only XOR, ANDing and those stuff

midnight shore
#

"The member type PacketReader cannot be declared static; static types can only be declared in static or top level types" what is this error?

grim ice
#

ill start with reflection

ivory sleet
#

yeah

midnight shore
#

?paste

undone axleBOT
ivory sleet
#

master it

midnight shore
brave sparrow
#

You canโ€™t make it a static class if it isnโ€™t nested

#

Itโ€™s just protected class PacketReader

midnight shore
#

oh

#

ty

still verge
# still verge i have a problem players are able to bypass my event.cancel thing for inventory ...

i was able to fix this by doing:

if (event.getCurrentItem() != null && event.getCurrentItem().getItemMeta() != null) {
    boolean skeletonBow = event.getCurrentItem().isSimilar(MorphManager.skeletonBow());
    boolean skeletonArrow = event.getCurrentItem().isSimilar(MorphManager.skeletonArrow());
    if ((skeletonBow && slot == 0) || (skeletonArrow && (slot == 27 || event.getClick() == ClickType.NUMBER_KEY))) {
        event.setCancelled(true);
    }
}
if (event.getHotbarButton() == 0) {
    event.setCancelled(true);
}```focusing on this part:
```java
if (event.getHotbarButton() == 0) {
    event.setCancelled(true);
}```
sacred mountain
#

thats a third of my screenshot size

grim ice
#

Class cls = Class.forName("A");
will return the class named A in my project, but
Class cls = Class.forName("java.lang.Integer");

#

will return the integer class

#

how does it know that im specifying a package

#

or a classname

brave sparrow
#

โ€œ.โ€

grim ice
#

why didnt it assume that A is a package

#

does it use ways like that fr

brave sparrow
#

Because a class canโ€™t be a package

grim ice
#

it should just force u to specify a package

fervent gate
#

What is reflection actually used for? Watching a vid on it rn, but I don't really see the point.

brave sparrow
#

Java doesnโ€™t even force you to specify a package

#

So reflection wouldnโ€™t

grim ice
#

ig

quiet ice
#

internally reflections will do a name.replace('.', '/')

ivory sleet
#

can be used to dynamically invoke methods and fetch values from fields etc

quiet ice
#

Nowadays methodhandles and varhandles might be better, but they haven't fully caught on and most of the basics of reflections still stand

brave sparrow
brave sparrow
#

โ€œI'd group uses of reflection into three groups:

Instantiating arbitrary classes. For example, in a dependency injection framework, you probably declare that interface ThingDoer is implemented by the class NetworkThingDoer. The framework would then find the constructor of NetworkThingDoer and instantiate it.

Marshalling and unmarshalling to some other format. For example, mapping an object with getters and settings that follow the bean convention to JSON and back again. The code doesn't actually know the names of the fields or the methods, it just examines the class.

Wrapping a class in a layer of redirection (perhaps that List isn't actually loaded, but just a pointer to something that knows how to fetch it from the database) or faking a class entirely (jMock will create a synthetic class that implements an interface for testing purposes).โ€

sterile token
#

Any idea, i have look many times the code

ivory sleet
#

npe

#

hehe

#

something gotta be null yk

quaint mantle
#

imagine getting NPEs in your plugins

sterile token
#

But idk why, cuz i executed: "faction create test"

#

And no errors appears

#

So im like okay?

quiet ice
#

jetbrains annotations <3

grim ice
#

wait

ivory sleet
grim ice
#

it is possible to make like

#

an eval command with reflection

#

right

quiet ice
#

Technically yes, that is how skript works more or less

grim ice
#

SHIT

sterile token
#

Problem identifier

grim ice
#

if i get better at reflection

#

ill make a new ide

#

in minecraft! !!!111

#

lmao imagine writing code in mc that would be so cool

quiet ice
#

Eh. I'd rather want an IRC client than an IDE in minecraft

grim ice
#

lol

quiet ice
#

Though, perhaps I should create an IRC client for eclipse. AAAAAAAA, why can you turn everything into an IRC client?

quiet ice
# sterile token IRC?

Most people use doom as a proof-of-concept for portability. I use IRC Clients for that

sterile token
#

Idk what is IRC

#

And what you exaplained less

quiet ice
#

Internet relay chat. It was THE way to chat before discord came

grim ice
#

/eval C{System}->out->println(C{java.lang.Integer}(1)->intValue())

sterile token
grim ice
#

C{} used to declare that its a class

#

that will run System.out.println(new Integer(1).intValue());

#

imagine if u can do that

quiet ice
#

Well, it is a chatting protocol. That is just about it

arctic moth
grim ice
quiet ice
#

example of an IRC client

lapis lark
#

Only meaning i know is Original Poster

sterile token
#

Isnt OP used on Programming?

grim ice
#

overpowered

#

maybe

ivory sleet
#

operator

#

maybe

quiet ice
#

You mean OOP?

grim ice
#

Object Programming

sterile token
grim ice
#

Lel

quiet ice
#

But that is something else entirely

lapis lark
#

Minecraft op means admin access

grim ice
#

isnt a minecraft ide easy to make tho @ivory sleet

lapis lark
ivory sleet
#

is minecraft a programming language or what

lapis lark
grim ice
quiet ice
#

There aren't even many build tools outside of maven or gradle

grim ice
#

reflection

quiet ice
#

At best you'd have a raw text editor like VIM

grim ice
#

yeah ik

quiet ice
#

And you don't really need any reflections for that

grim ice
#

what

#

how would u get the classes and stuff then

quiet ice
#

Since System.exec() is a thing

grim ice
#

what the fuck

#

when did that come out

quiet ice
#

Java 1?

#

Well, it was probably before Java 1. Probably was there since the Oak days

sterile token
#

Yay i fixed the inssue

#

I was that yeath

dusty herald
#

weird question but is it possible to make a user highlight an item in their task bar? im thinking about having it in the middle slot when they log in for my server selector

young knoll
#

I think you can do Player.setSelectedSlot or something

dusty herald
#

sweet ty ill look it up

naive bolt
#

how do i check if a it is first time joining on join event

#

do i just check player.getFirstPlayed() against time now

dusty herald
#

can you rephrase the question

#

like the first time the player has joined the server?

naive bolt
#

on PlayerJoinEvent how do i check if its first time joining server

dusty herald
#

that is how

tall dragon
#

Player#hasPlayedBefore exists im pretty sure

dusty herald
#

yeah

naive bolt
dusty herald
#

thought getFirstPlayed was the function ๐Ÿ˜‚

#

havent used it in eons

tall dragon
#

yea me neither

pulsar vessel
#

hey im looking for a plugin wich allows me to add custom items into crates for example

Diamond Sword

Of The Dragon```

but all the crates plugin i try remove the lore. I dont mind paying for a plugin aswell as long as its good
and for some backstory it is for a factions 1.12.2 paper server
hasty prawn
pulsar vessel
#

yhe respond then

#

its in there

hasty prawn
#

Then wait for a response.

young knoll
#

Patience

tall dragon
#

we arent getting paid buddy

#

xD

young knoll
#

Itโ€™s been 1 minute

#

Also

#

Paper
1.12

hasty prawn
#

Outdated and fork NotLikeThis

pulsar vessel
tall dragon
#

cool

pulsar vessel
tall dragon
#

whats the name

hasty prawn
#

I'm guessing you'll get a response before Easter ๐Ÿ˜„

pulsar vessel
#

havoc-network

pulsar vessel
tall dragon
#

so do that first

hasty prawn
#

Then do that while you're waiting for a reply.

tall dragon
#

untill you get an answer?

pulsar vessel
#

i couldnt code a custom one

#

so

#

yhe

#

well later

quiet ice
#

Both are equally wrong

ivory sleet
#

Ye lol

quiet ice
#

I assume the person who used the word has issues spelling the usually less used words such as OOP or ping spoofing

grim ice
#

Non existent

quaint mantle
quiet ice
#

System is a bit wrapper around Runtime anyways

#

In non-paper minecraft world, it is bad

young knoll
#

Meh

#

It probably doesnโ€™t effect them looking for a plugin

quiet ice
#

At least, the people think so. It is a small wonder that paper even has so many forks. Though at the height of bukkit bukkit also had a ton of forks

young knoll
#

Hell, Spigot used to be a fork

blazing scarab
#

54% of minecraft servers moment

#

Bad

grim ice
#

java.io.IOException: Cannot run program "System.out.println("Hello,": error=2, No such file or directory
at java.base/java.lang.ProcessBuilder.start(ProcessBuilder.java:1128)
	at java.base/java.lang.ProcessBuilder.start(ProcessBuilder.java:1071)
	at java.base/java.lang.Runtime.exec(Runtime.java:592)
	at java.base/java.lang.Runtime.exec(Runtime.java:416)
at java.base/java.lang.Runtime.exec(Runtime.java:313)
at HelloWorld.main(HelloWorld.java:7)
Caused by: java.io.IOException: error=2, No such file or directory
at java.base/java.lang.ProcessImpl.forkAndExec(Native Method)
	at java.base/java.lang.ProcessImpl.<init>(ProcessImpl.java:340)
at java.base/java.lang.ProcessImpl.start(ProcessImpl.java:271)
	at java.base/java.lang.ProcessBuilder.start(ProcessBuilder.java:1107)
... 5 more```
#

Runtime.getRunTime().exec(input));

Input var is the simple print hello world thing

blazing scarab
#

no no

#

Not that simple

quiet ice
#

Well it could be

young knoll
#

Oh heck yeah time for java based scripting

blazing scarab
#

Java is not an interpreted language

quiet ice
#
Process process = Runtime.getRuntime().exec("jshell");
process.getOutputStream().write("System.out.println(\"Hello World!\");".toBytes(StandardCharsets.UTF_8));
process.getOutputStream().write('\n');
#

But it can be

#

I didn't test that code however, but in the core it should work

midnight shore
young knoll
#

Anything is interpreted if youโ€™re brave enough

quiet ice
#

well, the idea stands you might need to destroy the process and whatnot

arctic moth
#

how do you make it so portals in another world go to the nether/end in that world

quiet ice
#

At least that is what I have heard

young knoll
#

Isnโ€™t there a MultiverseNetherPortals

arctic moth
#

like if u have a world2, world2_nether, and world2_the_end how would u make them link instead of just going to the default

arctic moth
tall dragon
#

assign host,port all that stuff in your constructor instead

rough drift
#

So i am trying to create a temp restart script (if not found) to make the server restart, however i wanted to use the actual command used to launch the server in the first place, so far i have almost the entire cmd, tho i wanted to know if there was a way to check if the serer was launched with nogui or not

deft forum
blazing scarab
# naive bolt why

Code reusability! You can easily test your database code without setuping a config

tall dragon
# naive bolt why

because it will try to initialize your variables before the constructor iirc

#

so it will result in a nullpointer because plugin is still null at that point

wary harness
#

How can I get NMS block from Bukkit Block

naive bolt
#

i need to pass the variables in

tall dragon
#

you dont have to if you dont want to

naive bolt
#

but it errors lol

tall dragon
#
public class MySQL {
    DiscordPlaceholder plugin;

    private String host;
    private String port;
    private String database;
    private String username;
    private String password;

    public MySQL(DiscordPlaceholder plugin) {
        this.plugin = plugin;
        
        this.host = plugin.getConfig().getString("sql.db_host");
        this.port = "3306";   
        this.database = plugin.getConfig().getString("sql.db_name");
        this.username = plugin.getConfig().getString("sql.db_username");
        this.password = plugin.getConfig().getString("sql.db_password");
    }

}
#

like this

naive bolt
#

ty i will try it

#

my vaccine arm is hurting like a ยฃ$%^

tall dragon
#

i feel u

#

i got covid rn

naive bolt
#

im quite lucky ngl ive only had it once

#

only had to isolate from school once

#

others in my year had been isolated like 5 times

rough drift
#

question, can you restart a server from within the api?

naive bolt
#

getServer().shutdown(); might restart it

rough drift
#

thats... shutdown

#

i don't think it restarts it tbh

naive bolt
young knoll
#

It does if you have the kind of start script

rough drift
#

yeah the problem is some servers might not have it

young knoll
#

Not much you can do about that

rough drift
#

well there is

#

actually

young knoll
#

Iโ€™m listening

rough drift
#

checking to see if it works fully

#

gimme a sec

#

yep it works

quaint mantle
#

Hello, would anyone like to help me set up just the pom.xml for plugin development? I'm using MS VS Code and this guide https://www.spigotmc.org/wiki/creating-a-blank-spigot-plugin-in-vs-code/ but I don't know if I'm doing things right. The reason why I'm using MS VS Code is that my 170 euro second-hand laptop gets its disk usage to 100% when an IDE is launched.

rough drift
#

made an auto restart script generator

wet breach
sterile token
naive bolt
#

it wasnt for me

sterile token
#

Oh sorry

#

I get confused

quaint mantle
#

Would you help me with the pom.xml?

naive bolt
rough drift
#

yeah some don't have the restart script tho

naive bolt
#

smart

wet breach
#

but you won't stop the disk usage when it is launched and it is re-opening projects you never closed as well

#

not entirely sure why you are worried about this disk usage

#

everything you open uses 100% of the disk for a short period until the OS tells it can't

quaint mantle
#

But it was always 100% and it was very laggy. The experience was unpleasant. With VS MS Code the Disk usage stays at just 15% at max

sterile token
rough drift
#

yeah ik how to do it on linux

sterile token
#

So, then just run on your server /stop

rough drift
#

yeah no i need to make a one time restart

#

so yeah

sterile token
#

And it will automatically get tinitialized again

#

So you dont need to code nothing

quaint mantle
#

I just opened Eclipse and my Disk usage is very low on it. Why is that?

quaint mantle
#

the experience is very good

#

no lag