#help-development
1 messages · Page 750 of 1
(I mean it makes sense, but basically eviction listener and removal listeners may not work desirably unless a scheduler is passed)
Wait... isnt that what i argued for in the first place?
yeah mhm to some degree
lazy eviction as in triggered by cache access?
thing is, there seem to be an inconsistency for the scheduler instance, in some versions its automatically assumed to be a valid one, in others its assumed to be the disabled scheduler singleton
yes
when u access, or modify it
just thought id let u in on the insight lol
Yeah ive had this issue. Thats the reason why i read up on it and discovered that i had to pass an executor for eager eviction 🙂
Executor isnt enough
thx 👍
Ofc needs to be a scheduler
(:
why does cancelling the inventoryclickevent make my items vanish on the client
i solved my problem with a global timer
public class TickProvider : MonoBehaviour
{
[SerializeField] MarchBehaviour marchBehaviour;
private bool goodInput, badInput;
private double time = 1.84;
private AudioSource audioSource;
public bool GoodInput()
{
return goodInput;
}
public bool BadInput()
{
return badInput;
}
public void Start()
{
audioSource = GetComponent<AudioSource>();
}
private void FixedUpdate()
{
time += Time.fixedDeltaTime;
time = Math.Round(time, 2);
if (time == 2.01)
{
time = 0.0;
}
if (time == 0.35 || time == 0.85 || time == 1.35 || time == 1.85)
{
badInput = true;
marchBehaviour.UpdateQuarter();
}
if (time == 0.15 || time == 0.65 || time == 1.15 || time == 1.65)
{
badInput = false;
}
if (time == 0.4 || time == 0.9 || time == 1.4 || time == 1.9)
{
goodInput = true;
}
if (time == 0.6 || time == 1.1 || time == 1.6 || time == 0.1)
{
goodInput = false;
}
if (time == 0.0 || time == 0.5 || time == 1.0 || time == 1.5)
{
audioSource.PlayOneShot(beat);
}
}
}```
now i have a perfect beat and my inputs are extra cool
HEY UR DOING UNITY RIGHT
This looks like you should either do soft constraints or simply dont use floating point numbers for this
yes
i wanted to start making games with unity too
Learn Godot. Unity is bloated af and their reputation is in the gutter for good reasons.
i tried to do my current game on godot
what language is that kotlin?
it looks like c++
c#*
c#
this isnt mc is it?
c# unity
o
it literally looks like java
except CamelCase is kinda different for methods
and [SerialzeField] stuff exists
i thought it was java at first
well i can rewrite it without c# CamelCase
and with all [serializefield] as public instead
the only difference would be audioSource = GetComponent<AudioSource>();
@SerializeField
cuz i don't think i can do this in java
well actually i can call my class GetComponent
and add Generics to it
but there would be no new keyword
yeah
looking for a dev for a large scale plugin
?services
If you wish to request or offer development/art/building/administration services, please do so at https://www.spigotmc.org/forums/services-recruitment-v2.54/
how i can adjust it?
public static boolean isPlayerLookingAtEntity(Player player, LivingEntity entity, double TOLERANCE, int DISTANCE_THRESHOLD) {
// Ottieni la direzione in cui il giocatore sta guardando
Vector playerDirection = player.getLocation().getDirection();
Vector entityDirection = entity.getLocation().toVector().subtract(player.getLocation().toVector());
playerDirection.normalize();
entityDirection.normalize();
double angle = Math.acos(playerDirection.dot(entityDirection));
double distance = player.getLocation().distance(entity.getLocation());
return angle < TOLERANCE && distance < DISTANCE_THRESHOLD;
}
return always true
there is a olther method?
shouldn't the acos be done between the player's direction and the difference between the player and target positions?
also instead of acos and dot there's.. Vector#angle
How to export the plugin right?
I made a new plugin project
and when I export it to a jar
my server doesnt reconize it as a jar
are you using maven
not so use vectors well. Could you advise me how to do it?
yes
conventions please!
what jars are there
If you are using spigot artifact with maven you cant use it from remote. Because it doesnt exists you need to manually compile the spigot artifact
I use java
yes it is
is coverted
whats the jar called
Vector difference = entityVec.subtract(playerVec);
double dot = playerDir.dot(difference.normalize()); // The dot ranges from -1 to 1, based on how "similar" the two vectors are
double angle = Math.acos(dot);
type deal
<project name>-1.0.jar
are you using maven shade or just maven compiler?
okay thats correct, do you have a plugin.yml is src/main/resources
yes
idk
?paste the error then
Are you actually using maven to compile the plugin?
But so you don't see if the 2 entities are looking at each other?
oh I didnt think to check the logs
yeah that what im asking myself haha
I know the cause now
You do, that's the dot
The angle part is a bit complicated because the dot doesn't account for rotation
my server is 1.19.2 and plugin is 1.20.2
It's just -1 if they're looking 180º apart
or 1 if you're looking straight
0 can be 90 or -90
my brain is exploding, are there any videos on yt that explain how vectors work?
Sign up with brilliant and get 20% off your annual subscription: https://brilliant.org/ZachStar/
STEMerch Store: https://stemerch.com/
Support the Channel: https://www.patreon.com/zachstar
PayPal(one time donation): https://www.paypal.me/ZachStarYT
►Follow me
Instagram: https://www.instagram.com/zachstar/
Twitter: https://twitter.com/ImZachSta...
ok
tnx
The home of Spigot a high performance, no lag customized CraftBukkit Minecraft server API, and BungeeCord, the cloud server proxy.
Hello, I'm desperate and need your help. Like code in a scoreboard that should update the values permanently, but it shouldn't flicker. Does anyone have something pls?
Can you post your code please
bim bim bam bam
In my cas e i prefer using scoreboard api already built on top of bukkit because if not i just lost time
who?
make sure you have 1 simple board / player and update it
Thats reason i use scoreboard libraries like Assamble to mention one. They provide already for just putting into usage instead of losting time implementing objectives, updation, etc
@echo basalt
public boolean doesPlayerTargetPlayer(Player p, Player target){
if(!target.getWorld().equals(p.getWorld())) return false;
Location head = p.getLocation().add(0, p.getEyeHeight(), 0);
Vector look = p.getLocation().getDirection().normalize();
Vector direction = head.subtract(target.getLocation()).toVector().normalize();
Vector cp = direction.crossProduct(look);
double length = cp.length();
return (length < 0.1);
}
``` this?
maybe
What's not good?
oh yeah I need to optimize this
i still have this issue, and using updateInventory does nothing (even if i delay it by 1 tick)
if(angle > fovRad) continue; (-2 line)
easy
your are a gigant brain in vector
can you help me tho lol
no
I almost failed alg 2, it was a rough year
if(isInVanish(player)) { e.setCancelled(true) }
(what)
the item not the player mate
Relatable
give code
event.setCancelled(true)
theres nothing to it
i check if its an egg in the hand, and cancel the event
?paste
Wtf is yield? Kotlin?
???
Can confirm
its for when u need logic in such a switch
usually u cant have logic there cuz it doesnt know what to return
That’s wack
i mean you can't switch over a boolean (and that'd still not be the valid syntax) but yeah, switch expressions are a thing
whats the point of yield
You dont need yield in this case
I mean it's not like that compiles anyway
paper 💀
WFT itdoesnt allow to react the emoji
is it possible to play custom sound effects in server?
you mean sounds? I dont think
sounds don't exist on the server
you can tell the client to play this or that sound, if the client has the sound it'll play it
if it doesn't nothing will happen
okay but can you make client have any other sound than the ones in game?
Yeah exactly that, sounds are not managed by the sever
sure, resource packs
Sure
would custom sounds override already existing ones or can they be added separately?
Nope, you can have additional sounds without overriding vanilla ones
okay thats pretty great
I have one more question about reading values from item description, if I added a line to diamond sword "Multiplies your damage by 2." then how could I read that integer value of 2 so that it could be utilized further into the code? (so that it would be rather an universal rule that would read whatever number is placed in here, if that's possible)
ay u sus, cant switch on boolean type
I would probably keep your description purely cosmetical and instead store a pdc tag with that 2 in there. Which is easily retrievable
?pdc
preach, my bois
would it be also possible to just make a database with said items and make code that would check if a player is holding said item to change values into whatever that item's description is saying (where those values would just be taken out of database)?
Im trying to visualize making a plugin that would allow to have unique statistics that would be used in certain ways and what way of storing data about such items would be efficient to make it as universal as possible
I think that would work in this case
okay so from what I can understand this allows to store additional data values in a certain entity, item or placed block, yes?
could it also tell apart wether such entity or item has custom name?
placed block is 3rd party lib but yeah
no need to use name for it anymore
with pdc you just have to check if it has a key or a key with the value you want
so I could spawn a diamond sword with assigned values and it would tell apart from other diamond swords because the key is assigned to that particular sword?
yeah
is it possible to have two items with assigned values and same key?
yeah
Hi, how can I get the namespaces of all recipes to then let a player discover all recipes?
Bukkit.recipeIterator
And then check if keyed I guees and get the keys
Is it faster then executing the minecraft command that does that?
is there a function that takes amount of experience and subtracts it from the player?
https://paste.md-5.net/wevuxohika.java
when i try running the command, it's giving me an unhandled exception error that Plugin can not be null any idea why?
have you tried player.giveExp() with a negative number? just my guess
set instance to this before you load commands
All of them should be keyed
What about MerchantRecipe
hello, can anyone tell me how can i get texture head player for Spigot GameProfile
url
@everyone
just fyi, attempting to ping everyone does not work
okay why u tell me that , if u didn't have answer
Spigot 1.18.1 added the new PlayerProfiles class, which finally allows us to use custom heads without needing any reflection! You can obtain them as normal items, or actually place them down into the world. I’ll show you how both works: Creating a new PlayerProfile First, we gotta create a new PlayerProfile object. To do so,...
Bru my project structre is so weird
Im not used to that
main->recources->archetype-recources->src->main.jjava->mainclass
gotta love alex's blogs
Should i just make a java file in the main
Are there rainbow tables for {OfflinePlayer:%s} md5 (minecraft offline player uuid)?
is it possible to check if entity is touched by particle?
no
Thank YOu very much ❤️
i mean yeah its possible, its just way more effort than its worth
Due to Mojang not making the server multi-threaded. Not really, no. It all has to be done on one thread. Unless a COMPLETELY custom solution is made - like MineStom for example.
folia
Some stuff in the MC server already does. For the most part its the OS that decides if a thread uses another core or not. There is some projects that attempt to change this, however I have not done any testing in regards to this in whether forcing it to use more cores vs letting the OS decide is better or not.
There is some stuff in the vanilla MC that is multi-threaded
I mean yeah, but the main stuff like worlds, block placing, breaking, etc.
One thing I hate - they have basically given up on optimizing the server code, and they just keep adding new features on top.
what would be more recommened if the data scale is quite large, i have a map of objects said object contains a region and the region has a check to see if a block is inside of it, to check it i have to loop over said map and call the method, would that be cheaper than making a second map that just uses bounding boxes, the region class is the world edit one
you probably exhausted your limit on threads
idk if it would be the same or cheaper to use bounding boxes
not entirely sure what you are doing to cause that
I assume you are not making use of JVM arguments
thus the GC not keeping up
?flags
Aikar's garbage collection flags: https://aikar.co/2018/07/02/tuning-the-jvm-g1gc-garbage-collector-flags-for-minecraft/
One of your plugins seems to be causing that (imo)
chunk generating always takes time depending on the size of the map you are pre-genning
yeah definitely a plugin, but it is also the GC not keeping up in removing objects, so they are hitting limits
link is above for JVM flags to use
give those a try
mhm
remove that max ram percentage, and in its place put those args
thats ptero
make sure Dterminal flags remain at the end
leave the ram percent
it needs the ram percent?
it runs with docker so yeah
of course >>
anyways, put it after the ram percent flag
but before the Dterminal ones
the jvm flags/args from the link
you asked where to put them
so I am telling you where
Oo those are bit outdated, no?
I mean yeah they are used pretty much everywhere but just realized
I am wondering how did hypixel made that one sword skill where it basically spews ring shaped particles to imitate dragon's breath and damage enemies when they touch them
math
was it some kind of check if there are any entities X tiles in front of player?
is server containerized ?
or however is that spelled
oh u are using ptero, so it is
you can try to increase cgroup limit, might be related to it
the issue your having is related to docker
then
since I am not a fan of using docker and really don't use it extensively I will let someone help with that that is more familiar
I am the fan of using more traditional VM's
can you do cat /proc/sys/kernel/threads-max for me first
Hey guys, I've got a fast question, what's faster?
vanilla filtering, or stream filtering?
no this isn't going to solve it
Pterodactyl is an open-source game server management panel built with PHP, React, and Go. Designed with security in mind, Pterodactyl runs all game servers in isolated Docker containers while exposing a beautiful and intuitive UI to end users.
check das
how do you not have perms if this is a dedicated server?
unless you mistake what a dedicated server really is
if that is normal high number, this etc, try thing lynx sent
that is a really low number for threads there Goksi
is it ?
i mean its default lol
ah that is why
you never bothered to change the IO settings to increase open file handles limit
thread limit is controlled by open file handles limit and the amount of memory you have
this is not inside the container is it
the minimum a thread consumes in ram, is approximately 1mb on average could get it slightly lower but this is the average
so most times people don't have the ram necessary to hit the thread limit 😛
unless thread limit is arbitrarily set low
Did you check your wings config
the issue is you are hitting the thread limit
it depends on your configs which is what lynx is trying to get you to check
Docker is a type of virtual environment
and the settings for the VM is what is going to dictate what is doable inside
like, anytime this issue comes up its pretty much a faulty plugin that shits out a trash ton of throwaway threads
and because wings default is like ~512 or something on the PID
you hit that after the server being alive for a bit longer
that is possible
Yea, sadly not the first time I saw a similar stacktrace 
that is a really low number for threads
Well
I easily can have a server with 1k threads or more depending what is going on XD
it should be fine for a server that isn't stupid
idk what you are doing with 1k threads
but yea like
its configurable but definitely, normal servers should be fine
I do love spinning up new threads in a for loop
for performance
well you are more of the expert in regards to docker then me lol
its always possible to hit thread limit max, which you are hitting. That is what your error says
it says, we can't make more threads because there is no more room to make threads
since it didn't throw an Out of memory error
this means you hit the thread limit and not the memory limit to make threads
you could always change out the plugin that pre-gens
if you want to see if its just the plugin
worldborder can pre-gen maps
I mean, whatever plugin that is, chunky should not be having that issue 
is there other pregen plugins ?
chunky and worldborder are the only two stable ones I know of that generally won't corrupt your worlds lmao

but also why I don't think its a plugin issue
unless they are using an outdated version
or have some version mismatch
yeah, normally you shouldn't encounter this and the only times I have is because the environment was set to arbitrarily limit threads
I wonder if the docker image they are using limits user threads
that would be hilarious if it had that XD
Ah
starts the container up with the configured pid limit of 512
some plugins fucks up
that stacktrace
the main difference between static and public methods/classes is that for static I need to make instance to call it and for public I can just call it?
No
Polar opposite
Static is bound to the class, non-static is bound to the instance
Public is separate, something can be public and static
so what is static and public
are classes non-static by default?
I believe top level classes can’t be static
They can't be static but nested classed can be static
whats the point of instances, like Main someName = new Main();
its the line of code i always dont get
Your creating a new object
and then its called with someName(args), why not just do Main(args) instead
there are concepts such as polymorphism where someObject.doSomething()
does something different depending on
what Type Type someObject = ... is
this becomes quite useful when we wanna avoid repeating code etc
and by static it means that I can just call it like Main(args) without need to create an object?
yes
Yes because it belongs to the class rather than the object
static can be associated to global, lifetimeless and objectless

so if I make a non-static class doStuff(args) and want to make an object I'd do doStuff name = new doStuff(); , and then if I want to use it, I'd go for name(args)?
now that I'm on my laptop I'll try my best to explain this
oh wait conclube is typing
phone
it was way easier in python, there were no classes, no methods, you just made def(args) and return a value if it was needed :|
python is a different type of programming concept
python < java
completely
not even true don't say something if you don't even know what you're talking about
nop python < java
yeah except python is slow, and only time its fast is when its not even coded in python but C or sum other language with a native link
proud python hatee
< = less than
mye
why is it the most popular language in that case?
only time python wins is when u just need something fast
bc people havent discovered java 😍❤️
I only want to learn java for stupid minecraft shenanigans
Doesn’t python have OOP these days
python wanna be java sooo baddd
python classes are required on my uni either way
so Id be learning it sooner or later
pretty fake oop
I dont want to be that guy but so far you've only been redundant on "java>python because yes"
thats awkward
python be like
import thing from things
do_thing()
( do_thing is implemented in c)
so true, python is so fast! (/s)
//comment
or:
// comment
fine w both, just use one exclusively tho
like consistency yk :)
Basically you can tihnk of top level classes (Which is all you should do for now) As always Non-static. Classes can contain constructors these constructors tell us what data we are associating with the the object when we create it.
for example
public class DoStuff {
private final String argument; // this field will hold our data
// constructor this is how we know what data we are associating with our object
public DoStuff(String argument) {
// this.argument refers to the field within DoStuff rather than the constructor argument
this.argument = argument;
}
public printOut() {
System.out.println(this.argument);
}
// this uses the data within our object and uses data of hte string method
public printOutWith(String otherStuff) {
System.out.println(this.argument + otherStuff);
}
// this static method is associated with a class rather than a specific
public static print(String content) {
System.out.println(this.argument);
}
}
Now we can use our Object like so
// new : this keyword means we are creating a new instance of DoStuff this instance is completely separated from other instances you create
final DoStuff doStuff = new DooStuff("This is Stuff");
final DoStuff doStuff2 = new DoStuff("This is other stuff);
// doStuff is not the same as doStuff2 they have different data associated with them
doStuff.printOut(); // calls the printOut method within doStuff
// DoStuff.printOut(); is not valid code because printOut() is not associated with the class DoStuff rather an instance of DoStuff
doStuff.printOut(" This is other Stuff);
DoStuff.print("This Stuff"); // this does work because the print method is associated with the class of DoStuff rather than a particular instance of DoStuff
You can think of objects as a sort of template if thats easier. They take data in and do a set amount of things with that data
i’m quirky and sometimes use /* comment */
thats fine :)
this is almost pin worthy lol
when in doubt, System.out
I dont really get any of that
when you care. System.err
My gf stole my laptop away!
imagine having those problems
Well that's all I can do for now code wise
I just remain single
something is inside something
hmm, but you do understand what variables are?
and in java when we create a variable we need to tell its type
yeah
fuck modifiers for now
but we have types and variables
like Int number = 5;
int
int number
wasnt it big
really?
String
yeah '
okay weird
java is quirky
yep
okay there are variables and types
whats a type whats a variable
yes and every variable must have a type, which is known at the time when we type the variable out
you store data inside variable that you can edit (or not, depends) and type defines what kind of data you can store, like adding integers will give you different result than adding numbers declared as strings (1+1=2, but "1"+"1"="11") etc.
you can turn strings into numbers and vice versa too
what does memory context mean
Accessibility:
- public (everyone can access this variable)
- protected (inheriting classes can access this variable)
- nothing (package-private, only classes in the same package can access this variable)
- private (only the current class can access this variable)
Memory context:
- static (this variable is statically allocated and doesn't belong to an object, a non-static inner class requires a parent object to be initialized, and can access the parent's fields)
- nothing (not statically allocated, object-bound)
Reassignment:
- final (this variable can't be reassigned to a new value)
- nothing (this variable can be reassigned)
Other niche ones:
- transient (when the object is serialized, this variable will be set as
null) - strictfp (works on floating-point numbers, makes behavior consistent, not spigot-applicable)
- volatile (works as a sort of
synchronizedfor variables, if you're reading this message you probably don't need it) - synchronized (applicable to static methods or code blocks, ensures only a single thread can process this at a time)
- native (indicates the implementation is done in C++, requires JNI)
If it's static, it basically belongs to the class and not to the object
Meaning you can access it without an object
But the object is never garbage collected because it may be accessed at any time
but only one instance ever exists
Unless you explicitly set it as null
we have some exceptions (u just have to memorize), types that start with small letters DONT have a class, (there are some quirks), for instance int, boolean and long
but then we have other types like String, List, Object
and when a class start with a big letter there is guaranteed a class ClassName {... somewhere
classes and types are pretty synonymous in java
primitives are always lowercase
(not identical tho)
boolean byte short int long
float double
char
are your primitives
char
okay but
char as well
Poor char
char always forgotten :(
But it’s unsigned!
They need to be constants, so static final
NAMED_LIKE_THIS
whats the point of this:
class Shit(args) {
stuff
}
and when I want to call Shit why do I have to do
Shit thing = new Shit();
thing(args);
instead of just
Shit(args);
umm
what
public class Whatever { // CLASS
private final int number; // FIELD
public Whatever(int number) { // CONSTRUCTOR
this.number = number;
}
public void setNumber(int number) { // METHOD
this.number = number;
]
public int getNumber() { // METHOD
return number;
}
}
Alright
So think of the constructor as a mandatory method that needs to be called when initializing an object
why cant you just do
public class Whatever {
number = 5;
}
for example
Whatever myObject = new Whatever();
will throw an error
because we dont know what number is
Because my constructor takes a parameter
thats possible
u cant just do that
So let's say I do
Whatever myObject = new Whatever(123);
Whatever myOtherObject = new Whatever(456);
number isnt a type
yes but conceptually it would work
not semantically... thats true
well int number whatever
you need a getter
Now we have two different objects, where the number value was passed through our constructor, by the code calling it
okay
We can then play with these objects
but couldnt you just do
int x = Whatever(123);
no
No, int and Whatever are different types
you’re trying to assign x (int) to a class (Whatever)
Whatever(...) is not a method if u thought that
Whatever is an object that happens to have an int as one of its fields
then int(Whatever(123))?
no
we dont have that in java
why
Whatever#getNumber() returns the number
because we have other ways of dealing with conversions of values
i just told you
he doesnt understand javadoc anchoring syntax
int x = <ur whatever instance>.getNumber();
public class Whatever { // CLASS
private final int number; // FIELD
public Whatever(int number) { // CONSTRUCTOR
this.number = number;
}
public void setNumber(int number) { // METHOD
this.number = number;
]
public int getNumber() { // METHOD
return number;
}
}
//THEN
Whatever myObject = new Whatever(123);
int x = myObject.getNumber();
Here's an example a bit closer to reality
public class PlayerData { // CLASS
private final UUID playerId; // FIELD, final
private String displayName; // FIELD, non-final
public PlayerData(UUID playerId) { // CONSTRUCTOR, UUID param
this.playerId = playerId;
this.displayName = "player-" + playerId;
}
public String getDisplayName() { // METHOD, return type String
return displayName;
}
public void setDisplayName(String displayName) { // METHOD, param type String, return type void
this.displayName = displayName;
}
}
We'd use it like this, for example
UUID randomPlayer = UUID.randomUUID();
PlayerData data = new PlayerData(randomPlayer);
data.setDisplayName("hi");
String displayName = data.getDisplayName();
this first and foremost I hope u imply
bit unrelated to this but to get a random material do i have to loop through the enum
cant you do
Whatever myObject = new Whatever();
int x = myObject.getNumber(123);
you can use the values() method and get an array of Material
no you cant because java public int getNumber() { // METHOD return number; }
i was thinkijg something along that thanks
and also because ```java
public Whatever(int number) { // CONSTRUCTOR
this.number = number;
}
As previously stated, the constructor is the mandatory method, and the one that has parameters.
The getNumber() method returns a number, it does not take one as a parameter
how familiar are you with python
not you
wrong person
how familiar are you with python
like would you say your intermediate level
I can send you my most recent program for you to see
anyway slokx just make sure u cache the values() array
just so i’m underdtanding right, like thsi?
private Material getRandomMaterial() {
Material[] materials = Material.values();
int randomIndex = (int) (Math.random() * materials.length);
return materials[randomIndex];
}
^
i = True
numbers = []
def pick(i):
if i == True:
try:
l = float(input("Pick a number: "))
except ValueError:
print("You didn't provide a number.")
return
numbers.append(l)
i = False
pick(i)
else:
j = input("Pick an operation (+, -, *, /, =): ")
if j == "+" or j == "-" or j == "*" or j == "/" or j == "=":
if j == "=":
i = True
count(numbers)
else:
numbers.append(j)
i = True
pick(i)
else:
print("You didn't provide an operator.")
return
def count(k):
j = 0
for k in numbers:
if k == "*":
numbers[j] = float(numbers[j-1]) * float(numbers[j+1])
del numbers[j-1]
del numbers[j]
elif k == "/":
numbers[j] = float(numbers[j-1]) / float(numbers[j+1])
del numbers[j-1]
del numbers[j]
j += 1
j = 0
for k in numbers:
if k == "+":
numbers[j] = float(numbers[j-1]) + float(numbers[j+1])
del numbers[j-1]
del numbers[j]
elif k == "-":
numbers[j] = float(numbers[j-1]) - float(numbers[j+1])
del numbers[j-1]
del numbers[j]
j += 1
return print(numbers[0])
pick(i)
its a calculator with order of operations and no limit of numbers to add
I'd use ThreadLocalRandom or something nicer than Math.random
I've had issues where Math.random caused performance issues in multi-threaded envs
works based on merging array spots
this is beginner
#! /usr/bin/env python3
class Whatever:
def __init__(self, number: int):
self.number = number
def print_number(self):
print(self.number)
Whatever(5).print_number()
The code here in python is the same as
public class Whatever {
private int number;
public Whatever(int number) {
this.number = number;
}
public void printNumber(){
System.out.println(this.number);
}
}
Whatever variable = new Whatever(5);
variable.printNumber();
that or SplittableRandom
Math.random uses a normal Random under the hood anyway
splittablerandom hot
yes
fair, lol
hows life going?
Good
vc?
touch some grass bro
cant gotta do college stuff
yeah I dont get even the python code
like why name it with _
ah gl gl
that's naming convention
also __init__ is the constructor in python
satisfiying
I dont get that whole constructor
@storm crystal https://www.codecademy.com/learn/learn-java there will be a lot of stuff you won't get initally just ignore it for now java is a lot less beginner friendly
codecademy < learn java in 14 minutes
constructor in java means __init(self,...)__ in py
i think every java developer has seen that video
they are a beginniner in python
ah
I tried making a relation but it seems they don't understand anything beyond the basics
which is fine, just means they gotta start from square one and not try to understand everything
yeah doing java doesnt seem to be good idea if I cant get basics
not me x) i learned java with old solo learn lol
well, u should learn the basics
dont give up, just bite the bullet
just stick with it
its hard
^
I used w3 schools and google
but few things will come easy in life more or less
my frist java project was a plugin too
im using w3schools but it doesnt seem to work
damn
same
same lol
try codeaccademy link I sent
i learnt java + spigot this may
any sources to learn about binary digit
granted I was already completely profficent in python before I started
learn what exactly
so I already understood how languages worked some really basic oop
what do you need to know
because binary number base involves modulo arithmetics, boolean algebra, sometimes set theory etc
ye lemme get it
01010111010000110101011101010101000111001110
do I watch entire 25 hour course
there is a lot of math around 0 and 1s
only if u want
thoes shitty youtube videos are horrible
don't use them
me personally would avoid any video course
SOME are good
not the 15 hour ones tho
its often better to have something where u can go back easily, read in ur own pace etc
thats what im talking about
@storm crystal if you want to learn java based on video tutorials check out TheNewBoston on youtube. Its old as hell luckily for you java hasn't really changed a ton
it wont actually take u 25 hours
well maybe it will for you
does that mean a bad thing
i’m jk 😭😭 i swear codecademy always bluffs about those
anyway DuskTaler, how u manage ur time is up to u, whether u watch 25h or if u write code 25h with trial and error, there are no shortcuts, just good time management
I wasnt talking about watching a 25hr video
I thought that that codeacademy course is set of videos
it’s interactive courses
¯_(ツ)_/¯
I just dont get why you make those instances instead of calling functions or whatever those things are with wanted parameters to be used
you can think of those instances as dictionaries in python
but dictionaries on steroids
what dictionaries
again beginner in python
ugh, u havent touched that in python either?
I didnt need it
maybe you should continue learning python, if u're still active with it? I mean you've come further in py than in java
I tried jetbrains academy and the content was decent
it was way too specific into core java but I guess you need that
or just watch those russian videos where the guy just goes "JAVA OKE INT BIM = 4 BLYAT SOUT BIM OP OP OPA BIM BIM BAM BAM"
lol
I mean, you showed me that I also dont get python because apparently further there are things that are as well in java
so I doubt ill get that either
you do you, gotta start somewhere, and make sure u dont do too much at the same time
I just need python to pass my classes
okay I think Im gonna fail they do have classes and methods as requirement for final exam
or mayhaps learn those things
yeah but it just doesnt work
@Override
public ItemStack[] getArmor() {
return new ArmorSetBuilder()
.setChestplate(
new ItemBuilder(Material.LEATHER_CHESTPLATE)
.setName("<red>Superman's Chestplate")
.setColor(Color.BLUE)
.setUnbreakable(true)
.build()
)
.setLeggings(
new ItemBuilder(Material.LEATHER_LEGGINGS)
.setName("<red>Superman's Leggings")
.setColor(Color.BLUE)
.setUnbreakable(true)
.build()
)
.setBoots(
new ItemBuilder(Material.LEATHER_BOOTS)
.setName("<red>Superman's Boots")
.setColor(Color.RED)
.setUnbreakable(true)
.build()
)
.build();
}
Is this visually appealing
Preference
A bit too spacey for me, I usually just single indent instead of two, but to each their own
ill indent you
basically the whole setup and installing drivers with gradle
could just be configurable
Can I skip making instances in plugin making?
Bit vague
No spend time to learn Java
You can't just skip oop and expect everything to be okay
Take the time and do it right
Also avoiding a concept because you don't understand it is niave if your struggling take a break and revisit it with a fresh mind
How do I setup sqlite driver with gradle?
i cant get past steup one :((
it's confusing me because usually my databases are all online and i connect to them through there
this time im trying to run database along plugin to save persistent data
spigot already includes sqlite
Yeah you shouldn't need to worry about it at all
does anyone know what's the equivalent of InventoryS2CPacket on protocollib is? i can't find it on wiki.vg
Measure once cut twice
Play.Server.INVENTORY or something
Yeah. The wiki.vg one will likely be "Open screen" or something
Assuming that's what that packet does
tried searching it on PacketType.java, found nothing
OPEN_WINDOW
the packet is sent when the server want to synchronize inventory of the player
Set container content, potentially?
wait so uh
how do i use it because all the spigot pages reccomend installing adriver
not that one, OPEN_WINDOW is sent when player tried to open an inventory
how do i create a sql database on runtime if none exist yet
String url = "jdbc:sqlite:/path/to/your/database.db";
try (Connection conn = DriverManager.getConnection(url)) {
if (conn != null) {
System.out.println("Connected to the database");
// If the database does not exist, it will be created
}
} catch (SQLException e) {
System.err.println("Error: " + e.getMessage());
}
would something like this work
try and see
That probably won't work if the file doesn't exist. You'll want to create the file manually
You can do this just with the regular Java file API
oh
Or NIO, whatever you want
wait what was up with all the driver stuff and shading to maven then
that i keep seeing
on the docs
You won't need to do that because CraftBukkit shades that driver for you already
You can ignore any resources suggesting that you shade the driver because they're probably not Bukkit tutorials
I was not aware of this
You will need to still call Class.forName("org.sqlite.JDBC") before you use the database though
That will actually load the driver
Depends on the jdk being used. Typically incorporating both methods is the standard practice
Doesn't hurt to invoke it anyways
That class needs to be loaded one way or another
That is why i said both methods to load it are used. you would attempt to load with the modern way and if it doesnt work fall back to legacy method
is there any way to get org.bukkit.structure.Structure from a structure saved in structure block? (for call getPalettes())
i didn't found any way to convert structure saved in structure blocks to org.bukkit.stucture.Structure.
interesting, i'll take a look thanks
never seen that function before actually
what's a good practice for database accesses? Should I have one manager or be opening and closing connections to the database when I want major changes to happen?
Right now for small changes im thinking of doing a timer and every so seconds updating while big changes will be updated immediately
Well.. It depends
Storing "small" changes in RAM helps with hitting the database less but can cause data loss
I'd go with what influxdb's driver does and "group" points and send them in batch over the span of 1 second
what does "points" refer to?
Influxdb works in "points" as it's a time-based database
You make a measurement "point" and say that it happened at a certain time and push it to influx
You can then use something like grafana to make graphs on how those points change over time
For example, you can send a point every 5 seconds measuring your server's TPS
And with Grafana you can make a tps graph of the last 6 hours
Or for example, you can make a phone app that sends a point with the user's location data to your database
You can then make a world heatmap
with google maps or something
Showing where your userbase is at
i have never heard of this database dang
ah i see
For example hypixel uses it to graph literally everything
how many concurrent games etc
ye that makes sense given the time based system
the other main one that's used is Prometheus
I like to split my databases into 3 categories at the moment
- Persistence
- Cache
- Metrics
Persistence is your usual mongo / mysql / sqlite / S3
Cache is your usual Redis / memcached
Metrics is your usual Influx / Prometheus
There's also the Messaging database
Which is usually your redis / rabbitmq
and kafka pretty sure
cassandra is persistence iirc
I always get them confused
I guess you can call me that?
I have a degree in systems programming and management
mostly just been doing plugins for uhh
7ish years now
And I wanted to get into hypixel a bit over a year ago and got rejected so I forced myself to learn all of this stuff because I wasn't that good at it
i see i see
yea im still getting to the degree part lol
plugin stuff is good learning for me right now
I just talk about the degree so I don't feel like I wasted my time there
The degree is not that big of a deal honestly
Don't get bummed if you don't have one
I'd not wanna work at hypixel tbh
pays a lot more than what I earn with boring mindless commissions and I get to actually learn something
like
applying all my scaling stuff in practice
But I don't like them in general
rather than assuming all the time
sure would I be working on legacy code? absolutely
If they've lasted this long they prob have some funky stuff going on
well gameplay and tech are two different things
The pvp is tech-faulted
did you know they use AI to rate chat reports and change their position in the queue?
it's laggy and buggy AS SHIT
it's about the money
Well yes and no
i want money
I'd expect that tbh
and stable money
their Atlas system is also p cool
i feel working at hypixel would give u stable money of some sort
Or how they use all these crazy methods to go from huge caches to like 32kb
this
Most devs that leave hypixel go into big tech
Usually Amazon
likely AWS
It may be well paying and interesting tech, but I would not work somewhere I do not enjoy playing at a lot
So not only do you have a well paying job for years, you leave becase you get an even better one
the background you can write and talk about, the millions of clients your product has brought entertainment to, that's pretty impressive
well you won't be playing there at all if you have the job
I don't enjoy playing minecraft anymore
haven't enjoyed it for years
honestly yea i tinker with it more than i play nowadays
I still like all the intricacies of exploring NMS
even more fun if it's obfuscated
(holy shit I haven't had fun in development in so long)
They are always the same
^^^^^^^^^^
Rarely something really innovative fun and big
Well
And if there is, the owner cannot afford to bring it to the market
So nobody plays it
And if nobody plays it, it won't grow
Even if it's the best game in existance, nobody will play it if they explore it alone
So you need to steal from the big players
I'll give you $15
ok
And good luck competing with that
thanks
Just become a dev and profit of all the kids trying to copy donutsmp
or hypixel skyblock
(my main project is literally a skyblock core)
I have always been dreaming of one huge system
Which is really a HUGE and innovative asf thing, but insanely insanely insanely stupid amounts of work and it requires hundreds of players at the same time to work properly
collab with mrbeast
Lmao sure
For example the main gimmick of my skyblock core is that it scales p much infinitely
well I still need to figure out matchmaking to not blow up your ram with < 10k servers running
but that's not realistic
Not possible
Thats smart
But if you don't care about scaling and all you want is to have it work for your small audience you just tweak the config and half the plugin just doesn't load
Thats actually the most realistic thing to do if I were to ever do it
it's meant to be modular
When it comes to db connections you want a connection pool so you are not waiting for the connection to open and you dont close it so as to not cause over head with contexts etc
I wonder if java has a ConnectionPool interface
I need to change my sql stuff to use a connection pool
Some of us could be classed as software engineers and good majority of those dont have degrees. Whether you should get a degree or not depends on your circumstances. Since you want money then you are better off not getting a degree and just getting hired for something basic at the bottom. you will make more from the start as well as get promoted and raises in about the same amount of time as it would take to get a degree. Experience trumps the degree and more so if you are currently employed in the field
Lol
I agree with Frost. Experience trumps qualifications. Often employers will take experience over a piece of paper.
And then while you have stable employment it probably wouldnt hurt to work towards the degree over time
shit tell that to everyone around me pressuring me to get a degree
That is some dedication to get a masters lol
The few times I went qualifications over experience I regretted it. Know it alls who could produce nothing.
pretty much sums up my brother
he went the masters route
failed classes so hard he stayed an extra year to get a bachelor's
Most employers view qualifications as lesser and know it's only an indication of determinations.
Told my mom I'm going to a tech conference by myself next month, she wants me to rizz the CEOs up so my brother gets a job
talk about unrealistic expectations
(I got free tickets because of their dev program)
IDK I feel like people with degrees are put on a pedestal type deal
Start at the bottom, get experience and you'll end up in the same place as those with degrees (in the same timespan), except you'll have money and they'll be in debt.
cardboard pedestal
This
I know about that, just having some weird thoughts that like
why the fuck am I expected to get a job for my brother given I worked for all my shit and he skipped class for 5 years
The irony here is that your brother has the degree but needs help to get employed lol
not by tech people
dude has a temporary job at a winery
Most people that I know IRL that have tech degrees work as like
mall cops
as long as it is 100% completely unrelated
i think it’s just a passion thing
passionate about cs -> degree
want money -> job
Programming is my hobby i dont have a degree. I even did satellite communications 
But i have no interest in working doing programming at least not in some office lol
right
Mostly because of the environment programmers are forced into and then mandatory overtimes bosses who have no clue how it works
nah lowkey that’s my biggest fear
cause i’ve got a lot of passion for the field but the actual field scares me
I still made money from programming though just did it on my terms is all
Not always easy to do though
yeah that’s what i wanna do but i think imma try that after i work at a company for a bit
i still have yet to gain any experience as i am a freshman in uni so i can’t really speak too much on it
Just remember that you dont have to find the right employer first. Its more important to be employed to begin with. You can find a better job after.
And always find another job while employed
And dont quit until you get that other job as well lol
but at my uni they have hella opportunities to try n gain internships with companies so hopefully i can land one 🙏🏽
Internships i dislike be careful to not get used through those
Some companies will use interns and then not hire you and bring in more interns
right
yk what this tells me
actually do what i told myself I'd do and start writing books lol
u cant find jobs in IT
do you think that a company will greater value personal projects that demonstrate the skills you need over internships or
I'd like to try out an office job
like it sounds boring as shit
but at least you're not bored and alone
it is boring
It depends. Internships still give you experience. And it depends what it is they are looking for. Personal projects you have done as well as with a group are valuable. As well as if you can show you have contributed to other projects better if they are some big project.
My internship at school last year was cool
plugin dev you can do anywhere
I live 20min away from the beach
20min walk
plugin dev for life
Unless they stick you in a cubicle lmao
no one fucking cares
about that part
I worked off my laptop at school
was about 1/3rd as productive as at home
I enjoyed office work but my job also included a lot of offsite visits
I can see myself working an IT job at a school or something boring
my school internship was nice
I dont mind office work either but i cant stand cramped cubicles though
was just cleaning computers, rewiring IT labs, cable managing stuff
for like a school group
This is basically what the school IT person does
Replacing projectors, dismantling those interactive boards
What is ironic about the school IT positions is they dont care about degrees. Just only if you can do it or not
walking around the exam block with an open knife in my hand during peak exam season lmao
was told to walk into the main administrative office and get the knife from the director's backpack while he was doing a speech
felt sketchy as fuck
Lmao
didn't know how to close it
it had a lock
flip knife
whateve
was quite big
sliced my finger like twice
I see so dont hand you sharp pointy things
in my defense I was cutting a tight zip tie while avoiding thin wires
standing on a school chair on top of a school desk
with a screwdriver on my other hand
they didn't give us ladders
at some point we had a chair on top of a desk on top of a desk
That whole scenario doesnt make it sound better lol
in my defense, again
I always carry bandages on me
both water-proof ones and regular ones
them peppa pig bandages always coming in clutch
Nice
but like yeah those were fun times
I made little scripts to do all our software stuff
and got to just go to the pool or to the movies
while the other teams were doing their work by hand
Lol
went to see the doctor strange movie after wiping ~150 computers under an hour
Let's talk about fiverr and the profit you can achieve during time
I wouldnt recommend fiverr
yeah same
hypercompetitive BS that takes 2 months to issue payouts
also no one looks for plugin devs on fiverr
I think if you haven't already good reviews you are just wasting time
Fiverr is only good if you dont mind doing like 50-100 jobs a day for next to nothing because some countries are doing it dirt cheap in comparison
fr
Like india for example where you got people bidding $5 on something that would cost like $100-$200
the problem are the competitors
