#help-development

1 messages · Page 169 of 1

fluid river
#

i guess spigot is not a mod

#

that's an entire platform

quiet ice
#

But you also need to make sure to not do excessive stuff

eternal night
#

You are certainly not allowed to Republish the entire client jar in most places

#

Even if you have modified it

quiet ice
#

The main reason spigot does not publish jars is because of a licensing error (if you can call it that - they absolutely knew what they were doing)

eternal night
#

Grey area is the best area

quiet ice
#

that is called a rewrite

eternal night
#

Yea like what ?

#

Ehhh

quiet ice
#

They certainly don't care all too much, but you still don't want to risk it

eternal night
#

Yeaaa

#

I mean get Bukkit shit is still up

vocal cloud
#

Playing on a companies apathy is a dangerous game

eternal night
#

But like

quiet ice
#

You don't want to get your mod taken down because of some error you did long time ago

frail gale
#

someone knows why I have access denied when I try to write into the AppData startup folder?

#

Also this is not for Spigot plugin

quiet ice
quiet ice
#

%appdata%?

vocal cloud
#

Might need to run as admin to access it

quiet ice
eternal night
#

Wtf XD

frail gale
eternal night
#

Who would download or from a third party XD

#

But like why

#

Whats the benefit

quiet ice
#

Again, PAPER

eternal night
#

Paper does not use build tools

#

That's the point

quiet ice
#

Paper uses paperclip

eternal night
#

We already ship you a single jae

#

That you just run

quiet ice
#

And the worst thing is that it was an outdated jar

eternal night
#

Hopefully at least the hashes matched

vocal cloud
#

I too enjoy my server mining crypto

torn shuttle
#

I hate this

untold jewel
#

Do you guys think it would be best with an Arena variation for duels?

west scarab
#

so in skript i do %{variable} ? 50% what'd the code for that be in java?

tardy delta
west scarab
#

in skript it auto checks if the variable ISN"T set, then if it isn't. It'll take the value i put after the ?

west scarab
chrome beacon
#

You check if it's null

west scarab
#

yea ik, but there has to be a faster way.

chrome beacon
#

?learnjava Highly recommended before starting with Spigot

undone axleBOT
west scarab
hazy parrot
#

Why is checking for null "slow"?

eternal night
#

Wat

eternal night
#

Oh

#

Kekw

#

You'd be surprised that Skript does the same under the hood XD

tardy delta
#

primitives cannot be null lol

torn shuttle
tardy delta
#

ah he was talking about vars in general

hazy parrot
#

I mean.. Noone is talking about primitives

chrome beacon
#

Well they did ask about double and int

tardy delta
#

cuz he said numbers i got confused

#

might aswell learn java instead of using skript

chrome beacon
#

They said they already know Java

#

x

torn shuttle
#

oh no olivo pressed x

worldly ingot
tardy delta
#

i see

torn shuttle
#

hm can configuration keys just be numbers?

#

would that actually register as an int?

molten hearth
#

does anyone know which packet is used for setting the amount of hearts a player has

worldly ingot
#

Probably entity metadata

#

afaik it's an attribute thing

#

Yeah, there's a separate packet for updating attributes

#

If I were to guess the naming, PacketPlayOutUpdateAttributes or ClientboundUpdateAttributesPacket

stoic osprey
#

Trying to save and load json using this:
https://www.spigotmc.org/threads/json-configuration-files.212794/
but theres an issue with line

map = gson.fromJson(new FileReader(configFile), new HashMap<String, Object>().getClass());

Intellij says there is a Unchecked assignment: '? extends java.util.HashMap' to 'java.util.Map<java.lang.String,java.lang.Object>' on part gson.fromJson

it also says Instantiating object to get Class object on part new HashMap<String, Object>().getClass(). Anyone got any idea what these warnings mean?

river oracle
#

Unchecked means you have no clue what types your casting too

#

You are likely fine ignoring it in this case

sharp heart
#

do someone know how to make a sapling grow into a tree ?

fluid river
#

?learnenglish

river oracle
#

Bro that's just mean

fluid river
#

basically just do @SuppressWarnings("all") and forget about warnings

stoic osprey
#

oki thanks

river oracle
#

If I got a dollar for everytime I have written @SuppressWarnings("unchecked") I'd be very very poor

molten hearth
#

right so now I have another issue that is more of a maths skill issue, I have this code ```java
class Main {
static int playerMaxHealth = 2000;
static int playerCurrentHealth = 1000;
static float vanillaHealth = 0;

public static void main(String[] args) {
int currentLoopPosition = playerCurrentHealth;
while(currentLoopPosition >= (playerMaxHealth/20)) {
vanillaHealth++;
currentLoopPosition -= (playerMaxHealth/20);
}
System.out.println(vanillaHealth);
}
}``` to have a custom health system, is there a more efficient way of doing what I'm doing right now?

fluid river
#

i guess

fluid river
molten hearth
#

I'm pretty sure there is I just dont know maths đź’€

sharp heart
fluid river
molten hearth
#

Basically I just need to display it in the healthbar if the player has 1000/2000 health in my system so for that im just gonna convert it to roughly the vanilla amount that's equivalent but I have the feeling a loop is not the best way of doing it

sharp heart
#

nobody talked about that

river oracle
#

Gogl3w I ber you I find something gimme a minute

molten hearth
#

(and no I cant divide it by 100 lmao)

fluid river
fluid river
molten hearth
#

its not always 2000

#

it changes per player

#

one could have 9847 or smth

river oracle
fluid river
#

just get the multiplier variable lol

#

vanillaHealth = currentHealth / (maxHealth / 20);

#

smth like this

#

how much hearts player has btw

#

10?

molten hearth
#

oh yes that works

#

I think its 10 hearts but since there's half-hearts I'm using 20

fluid river
#

each 100 would be half heart

molten hearth
#

yeah that worked lmao

#

I used such a weird solution

#

the things I do to not use maths 🙏

#

tyvm

fluid river
#

❤️

river oracle
#

Dm nuker fall for free java lessons

fluid river
#

feel free to ask mafs help

#

true

torn shuttle
#

always do meth math whenever you can kids

fluid river
#

FREE JAVA LESSONS

checkmybio

river oracle
molten hearth
#

I am mathless in the ways of math

fluid river
#

how to do that tho

#

line

remote swallow
#

~~ around stuff

river oracle
#

~x2

fluid river
#

moatherless

#

complicated

#

thanks

remote swallow
#

~~meth~~ math

grizzled ginkgo
#

@spring vine you scammed me you took my email

fluid river
#

sussy minus now

remote swallow
#

Come on discord

grizzled ginkgo
#

θ

river oracle
fluid river
#

0

river oracle
#

?support

undone axleBOT
fluid river
river oracle
#

What the

#

Fuck

fluid river
#

basically this text channel typical day

remote swallow
#

Would you like or not like this becoming a forum channel

tardy delta
#

tf is a forum channel

fluid river
#

who knows

#

help-development is definitely

harsh totem
#

wdym?

fluid river
#

real chads send achievement in chat lol

#

and store to text file or database

vast raven
#

I forgor how to inject a class, like I wanna inject the zombie class to change the stats

twilit roost
#

Im developing custom command framework
But I need custom TabCompleter logic
any ideas how to remake the Bukkit one?

crimson terrace
#

Well first you would need a reason to do that, then you would need an idea of how it should look

twilit roost
#

I have system of main command and subcommands
But some subcommands can be registered as separate commands

But when I tried modifying args I was passing to those subcommands, it didn't work at all
So I thought of custom TabCompletor which would detect if its completing for SubCommand or Separate command and modify those args using that information

#

so far thought of this

hazy parrot
#

tabcompletor is compliting any array you pass to it

#

you are returning empty list for some reason

twilit roost
#

well I tried shortening it by 1
aka removing args[0] but it just put instead of removing the argument

Imma send a snippet

hazy parrot
#

also, you want to use StringUtils class

#

to check what array to return

#

returning empty list will not tab complete anything

twilit roost
#

ikr

#

thats a go on custom tab completor

#

its currently set back to startAt 0

tardy delta
#

those fields are static if you didnt know

twilit roost
#

soo?

tardy delta
#

hopefully not overriding instance bound fields

#

acf

ivory sleet
#

brig is rly nice

#

but verbose

lost matrix
ivory sleet
#

well you do get pretty powerful tools once in a while

#

in exchange for verbosity

lost matrix
#

And i feel like it can get very cluttered if you use too many anonymous functions

twilit roost
#

does Brigadier use nms?
I haven't ever used it so idk where to find it and use it

#

brigadier allows you to do this stuff?

ivory sleet
#

yes

#

brig reads the cmd stucture and creates suggestions/completions from it (which nms fetches)

torn shuttle
#

hahahaha funiiiii I fucked up big time

#

I just spent several hours turning a system into a maplist only to realize that to make it translatable I need to make it keyed

fluid river
#

rip bozo

torn shuttle
#

this one really sucks

tardy delta
#

reflections

untold jewel
#

Wanting to make a ReportGUI system. Is it a good idea to just make IDs? So example:

ID:
Repoter: name
Reported: name
Reason: reason

#

Also I'm curious is to whether or not add online/offline status. How would I do that if? Just make a something that checks and updates every tick or

lost matrix
#

Updating something every tick is a very extreme approach to anything.
You always want to use events for that. Like the PlayerJoinEvent and the PlayerQuitEvent to determine if a player is online or not.

#

And what do you mean by "Is it a good idea to just make IDs?"
For what purpose? What is your reasoning? We need more context.

untold jewel
#

if you are getting this from a config and you dont want to store it under the players UUID since it can get confusing as to whos UUID that is I thought well maybe I can just make a random ID generator instead

lost matrix
#

Because a random ID is less confusing than a players UUID?

untold jewel
#

No, just so every report has an ID

lost matrix
#

This makes more sense. "Report" can be a data class which also implements ConfigurationSerializable.
This way you could have a Map<UUID, List<Report>> in a manager class to keep track of all reports
corresponding to a certain player.

untold jewel
#

That was a good idea, thanks! Will definitely look into that

#

Also one more thing, I have been trying to fork a project from GitHub because I like the API very much but there is this annoy bit where it automatically places an item inside the GUI. I have tried removing the item by setting the slot to air etc etc.

#

But it doesnt work

#

(Never done forking before)

lost matrix
untold jewel
#

Yeah but how do I replace the repo? Or would I just compile the jar and use that instead

#

Also, as I look more into the API I cannot seem to find the part with that specific item. It's really weird

lost matrix
#

fork it -> change it -> compile it

solid cargo
#

im trying to get the smallest divider and it returns bad values all the time, for example the -85918111 in the terminal output divided by 3 (the supposed smallest divisor ) equals -28,639,370.33333333333333333

#

you can ignore the bottom im just in a rush

noble forge
lost matrix
noble forge
#

by smallest divisor youre probably referring to the smallest prime divisor

#

since the smallest divisor for any integer is 1

noble forge
#

oh

#

scd?

solid cargo
solid cargo
#

wait

#

sorry

#

divisor is div

#

i messed up

#

its late

tardy delta
#

only 8pm

noble forge
#

so you want to get the smallest prime divisor between two numbers?

noble forge
solid cargo
#

between 5 numbers but yes

noble forge
#

there is no guaranteed smallest prime divisor for an arbitrary 5 numbers

solid cargo
#

well thats what i need to do. thats the task

#
Create code that finds the least and greatest common divisor of 5 random numbers (can also be entered into variables by hand).


create random numbers and output them;
while/do-while loop;
check if divides;
we increase/decrease the number to be checked or divided by.
#

i google translated it so please dont hurt me if something is translated wrongly

untold jewel
#

What language

solid cargo
#

latvian

noble forge
#

if you scale the problem down to two numbers, if you grab 2 prime numbers the least common divisor is 1, but your minimum is 2

solid cargo
#

ig the smallest positive div will always be 1

#

but i also gotta get the biggest

noble forge
#

thats just gcd

#

you can find dozens of code snippets online for that

noble forge
torn shuttle
#

oh my god java please

#

I can only do Map.of 10 times

#

what is this jank

#

also @echo basalt rate my lines

lost matrix
#

This line being like "Am i a joke to you?"

torn shuttle
#

sorry, it's terminal

glossy venture
opal juniper
#

Surely there is better design than this?

glossy venture
#
public static <K, V> HashMap<K, V> mapOf(Object... vals) {
  HashMap<K, V> map = new HashMap<>();
  K key;
  for (Object v : vals) {
    if (key == null) {
      key = (K) v;
    } else {
      map.put(key, (V) v);
      key = null;
    }
  }

  return map;
}
#

you can do it manually

#

using this

torn shuttle
#

go get hired by oracle and then fix this

opal juniper
glossy venture
#

yeah i get that

#

but just do runtime type checks

#

or smth

#

or dont at all

#

and wait for some ClassCastException

lost matrix
#

I would prefer a builder approach at this point. Let me do a quick mock uo

glossy venture
#

imo all collections should have a builder pattern

glossy venture
#

imagine

new HashMap<>()
  .put("a", a)
  .put("b", b)
  .put("c", c);
opal juniper
#

way to ruin it conclure

ivory sleet
#

shi mbmb

opal juniper
glossy venture
#

yeah but not as nice

#

also it creates an intern class right

opal juniper
#

yep lul

tardy delta
#

Map::of :(

#

ImmutableMap::builder

glossy venture
#

thats what were talking abt

ivory sleet
#

sadly immutable

#

but ye

tardy delta
#

mmh

glossy venture
#

but it has a limit

#

of 10

tardy delta
#

builder then

glossy venture
#

so they should use a varargs or builder pattern

ivory sleet
#

you have Map::ofEntries

#

or sth

tardy delta
#

oh

echo basalt
glossy venture
#

new Map.Entry<>(k, v) wont work right

ivory sleet
#

ye

torn shuttle
#

?paste

undone axleBOT
glossy venture
#

its an interface

tender shard
#

I hate that this doesnt work for anon classes

torn shuttle
lost matrix
#
public abstract class MapBuilder<K, V, M extends Map<K, V>> {

  public static <K, V> MapBuilder<K, V, HashMap<K, V>> hashed() {
    return new HashMapBuilder<>();
  }
  
  private final M map = construct();

  protected abstract M construct();

  public MapBuilder<K, V, M> append(K key, V value) {
    map.put(key, value);
    return this;
  }

  public M build() {
    return map;
  }

}
public class HashMapBuilder<K, V> extends MapBuilder<K, V, HashMap<K, V>> {
  @Override
  protected HashMap<K, V> construct() {
    return new HashMap<>();
  }
}
ivory sleet
torn shuttle
#

the elegant part of this is that it can be done in seconds using middle click

glossy venture
#

when its mutable

#

just replace the put method to return Map<K, V>

tardy delta
#

whenever 7smile7 enters this chat, some fancy things happen

glossy venture
#

it would be epic if the compiler just had some syntax sugar to do that automatically

#

so you dont have to return anything

#

it just acts like it does

lost matrix
#
HashMap<String, Integer> map = MapBuilder.<String, Integer>hashed().append("One", 1).append("Two", 2).build();
tardy delta
#

owo

glossy venture
#

yes

glossy venture
tardy delta
#

you said yes before

torn shuttle
#

super.customObjectives.put("Objective13", Map.of("objectiveType", "DIALOG", "filename", "unbinder.yml", "npcName", "Ulfric:", "location", "under the main building", "dialog", List.of("&8[&aUlfric&8]&f If you bring me a very special and rare item, I can unbind your Elite items.", "You don't yet look prepared to take this challenge on, but you can make killing the Binder of Worlds your ultimate goal, if you dare.")));
finally some good fucking code

glossy venture
tender shard
glossy venture
#

not to the "owo" - quoted from FourteenBrush

lost matrix
tender shard
#

why is there no way to reference the class of an anonymous class from within itself

torn shuttle
#

it's very anonymous

tender shard
#

yeah well obviously now it's not anymore

torn shuttle
#

sometimes I forget who I am when I turn on my vpn

tender shard
lost matrix
#

Oh you mean the class

tender shard
#

yeah

#

the receiver parameter

#

look at the @ Override method

lost matrix
#

Of an anonymous class

tender shard
#

yeah but I wonder, why do I even have to declare a type for a receiver parameter?

#

if you name the parameter "this", it HAS to be receiver parameter so it MUST refer to the same class

#

otherwise it wouldnt compile anyway

#

so javac knows what class I'm talking about even without name

lost matrix
#

Wait now i see the "this" param

opal juniper
torn shuttle
#

ayy lmao I nuked it

tender shard
#

this is what I mean

#

there should be a "placeholder" or keyword to refer to the anon class in this case

#

but there is none

ivory sleet
#

why do you need the receiver param in the first place if I may ask

tender shard
ivory sleet
torn shuttle
#

one of these days I will craft a line so long it goes over the discord character limit

tardy delta
#

is that (HashMap<String, String> this even valid?

tender shard
# tender shard this is what I mean

ez fix lmao

        new HashMap<String,String>() {
            {
                this.getClass().getMethods().add(new Method("put", this.getClass(), String.class, String.class));
            }
        };
ivory sleet
#

I mean the receiver param is a thing

tardy delta
#

never heard of it tho

ivory sleet
#

by the specs of java

ivory sleet
#

yeah its uncommon because it is rarely needed

sullen wharf
#

You need a real challenge

tender shard
ivory sleet
#

but essentially, methods are fake

tender shard
ivory sleet
#

they are just static functions where the caller object is just the first parameter

lost matrix
# solid cargo divisors are the a b c d e

PS: If you want to still use the brute force approach that has to use a while loop then here is a working example for orientation:

  public static int smallestCommonDiv(int... numbers) {
    boolean allEven = true;
    for(int i : numbers) {
      if(i % 2 != 0) {
        allEven = false;
        break;
      }
    }

    if(allEven) {
      return 2;
    }

    int largest = IntStream.of(numbers).max().orElseThrow();

    int smallestCommon = 2;

    div_loop:
    while (smallestCommon <= largest) {
      smallestCommon++;
      for(int i : numbers) {
        if(i % smallestCommon != 0) {
          continue div_loop;
        }
      }
      break;
    }

    if(smallestCommon > largest) {
      throw new IllegalArgumentException("No common divisor possible for " + Arrays.toString(numbers));
    }
    return smallestCommon;
  }
ivory sleet
#

with a null check ofc

tardy delta
#

hmm

tender shard
#

@tardy delta

#

the receiver param can ofc only be of the type of the enclosing class

ivory sleet
#

which in for instance python can be perceived more obvious

#

yk def f(self, x):

torn shuttle
#

well got it to work

#

fantastic

lost matrix
ivory sleet
#

yeah

#

well, it is mostly for annots I believe

#

actually, only for annots

tender shard
#

yeah that's also the only reason I see for them to exist

torn shuttle
#

ain't it a beaut

solid cargo
#

shouldnt be too hard i think

ivory sleet
#

đź’€

sullen wharf
torn shuttle
#

this puppy can fit so many objectives

solid cargo
#

yeah i know

echo basalt
#

As beautiful as it gets

solid cargo
#

and some method names will change but thats mostly it

torn shuttle
#

way better than the old crummy format

tender shard
#

this is also weird

sullen wharf
echo basalt
#

Mister magma..

sullen wharf
#

đź’€

torn shuttle
#

wait, that's illegal

echo basalt
#

Your code is so bad

tender shard
torn shuttle
echo basalt
#

Thinking your value, comes out from that

lost matrix
tender shard
sullen wharf
#

I came here to see some beautiful code and MagmaGuy ain't disappointing me

torn shuttle
#

so the new code automatically converts the hundreds of quest formats that already existed and selects only the translatable elements to be dumped into the translation file, and automatically reads from those entries for the selected language

sullen wharf
#

👌

torn shuttle
#

this is a coding technique I've invented which I call the gigachad technique

sullen wharf
#

Agreed

#

Do more

#

👍

#

Magma

#

If you continue like that, Illusion will be forever sleep deprived one day

#

Because of his nightmares

#

Just so you know

midnight shore
#

Hi, how can I wait a bit before continuing a for loop?

#

like every element it waits 2 ticks

torn shuttle
#

imillusion is evil and I will know my code shone brightly upon this wretched world the day he has a stroke reading my 1-line a* pathfinding algorithm

sullen wharf
#

Sheesh

torn shuttle
#

alright time to dump hundreds of quests on the system and see it work flawlessly first try

torn shuttle
#

hm

echo basalt
#

Main thread :)

torn shuttle
#

actually

#

ended at 19:48:50

untold jewel
undone axleBOT
echo basalt
#

19 hours to trace damn

torn shuttle
#

stated 19:48:50

#

that's 0ms babyyyyy

#

because I am not logging anything under seconds

echo basalt
#

Thats 0 seconds

torn shuttle
#

#winning

#

my only regret is not being able to have it take 10 minutes and have a compilation of messages explaining how cool my code is while it does it for everyone online to read

#

class cast exception? on my code? java must be bugged

lost matrix
#

Instant complaint straight to oracle

torn shuttle
#

I'm not even reading these logs, just sending them to oracle via priority mail

#

memory section can't be cast to map

tender shard
#

I love how copilot instantly realizes when I'm bored and just plays along

near valve
#

Does anyone know how I could roll back the variables from mysql back to a .csv file in a script? And what are the variables in mysql to be in the .csv file?

tender shard
#

what "variables"?

#

I sent you a link earlier that exports your tables / db into a csv file

untold jewel
#

baby mfnalex

tender shard
#

mysql does not save "variables" in tables but values

torn shuttle
#

I don't know why working with configuration sections gives me a headache

untold jewel
#

u got a gui api for me? :P

tender shard
#

still, no

#

lol

untold jewel
#

grrrrrrr

torn shuttle
#

I feel like I always end up getting stuck doing configuration section conversions to maps all the time

tardy delta
#

factoryfactory brrrrrt

near valve
#

Yes mfnalex, but the skript plugin doesn't read it

tender shard
tender shard
near valve
#

Plugin: Skript

tender shard
#

and what does it not read?

near valve
#

look

tender shard
#

lemme get my glasses so I can see better

#

ok I got them

torn shuttle
#

alright it's working now

#

finally

#

lmao

#

the translation file is now a mere 11655 lines, and I don't have all of the content on here

serene sigil
#

why does TextComponent not work?

tender shard
#

it does work

serene sigil
near valve
serene sigil
#

java.awt?

serene sigil
tender shard
serene sigil
#

i searched up how to make hoverable text and saw this:

                    message.setClickEvent(new ClickEvent(ClickEvent.Action.SUGGEST_COMMAND, "/msg XY "));
                    message.setHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, new Text(“send private message“)));
                    p.spigot().sendMessage(message);```
tender shard
#

and I also don't understand what this file has to do with mysql

tender shard
torn shuttle
#

boys, call me todd howard because it just works

tender shard
#

if you don'T see the bungee chat classes, then you'Re probably using bukkit instead of spigot

serene sigil
#

how to do it in bukkit?

tender shard
#

you don't

#

why would you? noone uses craftbukkit

#

java enterprise code be like

serene sigil
tender shard
#

spigot-api does include the bungee chat classes

serene sigil
#

ye

#

but why doesnt that worik???

#

work*

tender shard
#

?paste your pom.xml

undone axleBOT
lost matrix
serene sigil
tender shard
#

are you using gradle?

serene sigil
#

i dont use gradle

tender shard
#

then I cannot help you

serene sigil
#

i just added the file as module

lost matrix
#

DispatcherConfigurationMethodModelFilter
Actual class name

tender shard
#

manually adding dependencies is so 90's

serene sigil
tender shard
#

you should definitely look into switching to maven or gradle instead

#

it's annoying for 5 hours and after that you'll love it

serene sigil
#

yea but its the same thing...

tender shard
#

well I just add spigot-api as dependency to my pom and then everything works

#

I dont even need to have spigot-api.jar on my PC anywhere, maven handles all of this

serene sigil
tender shard
#

it just works automatically

serene sigil
#

ik

serene sigil
#

but it doesnt matter is u use gladle or not in this case...

#

cuz the module works

tender shard
#

well it does

serene sigil
#

the class is just missing

tender shard
#

it doesnt work for you because you're using the wrong dependency

serene sigil
#

somehow

tender shard
#

you are using the spigot-api jar instead of the shaded one

#

only the shaded api .jar includes all the dependencies you need

#

you wouldnt have this problem if you'D just use maven or gradle

serene sigil
#

can u send the link plz :3

tender shard
#

it's in spigot's maven repo

serene sigil
#

i dont really want to open another gradle project :3

tender shard
#

there is no other official source, except if you build it yourself using buildtools

tender shard
#

?bt

undone axleBOT
tender shard
#

if you run buildtools, you should have some "spigot-api-1.19.2-R0.1-SNAPSHOT-shaded.jar"

#

that's the one you need

chrome beacon
#

?bootstrap

undone axleBOT
#

Bootstrap Jar
The main spigot-1.18.jar is now a bootstrap jar which contains all libraries. You cannot directly depend on this jar. You should depend on Spigot/Spigot-API/target/spigot-api-1.18-R0.1-SNAPSHOT-shaded.jar, or the entire contents of the bundler directory from your server, or use a dependency manager such as Maven or Gradle to handle this automatically.

Please read the release notes for further information: https://www.spigotmc.org/threads/9-years-of-spigotmc-spigot-bungeecord-1-18-1-18-1-release.534760/#post-4305163

tender shard
#

no, they use spigot-api

#

oh it also says that

#

ok

serene sigil
#

lmao

tender shard
#

when you run buildtools, it is in YourBuildToolsDir/Spigot/Spigot-API/target/

#

and it should be around 4.5 MB

chrome beacon
#

NMS without Gradle or Maven is a pain to work with

tender shard
#

they dont need NMS

#

they only need the bungee chat classes

chrome beacon
#

I know

#

I'm just saying

tender shard
chrome beacon
#

True

tender shard
#

my photoshop skills are so good

quiet ice
#

There are a few circumstances where not using Gradle or Maven is a better choice, but in 99% of cases that is not the case

chrome beacon
#

Hm? Do you have an example?

#

Like when would you not use maven or gradle

fluid river
#

when you have old spigot jar and don't have internet

#

1%

quiet ice
#

Nah, that is the 0%

fluid river
#

0.0001%

#

me when i coded for 1.12

quiet ice
#

When you need to have rather fine control over something and when it is simply not worth to learn the gradle API

chrome beacon
quiet ice
#

The maven API is nice and all, but the IDE integration is lackluster once you start writing your own plugins

fluid river
chrome beacon
#

?

fluid river
#

when have the jar and don't have internet

#

you can just use jar

quiet ice
#

Gradle API takes ages to understand

chrome beacon
quiet ice
#

mvn install is a thing btw

fluid river
#

as a dependency

fluid river
chrome beacon
#

Yeah

fluid river
#

local dependency

quiet ice
#

And if you feel lazy, <scope>system</scope> and file://-repositories are a thing

chrome beacon
#

Yeah but that's a bad way to do it

quiet ice
#

It isn't bad per-se

#

I myself use file:// repos to work around Mixin's stupidity

chrome beacon
#

It's deprecated

#

Mixins stupidity?

quiet ice
#

Scope is deprecated, file shouldnt be

quiet ice
chrome beacon
#

Just exclude that dependency then?

quiet ice
#

Then JPMS would complain about missing modules

quaint mantle
#

Super weird question - Is it possible to make a spigot plugin in C/C++, but when compiled it gets compiled into a .jar?

#

I'm not that good with java

#

I know its possible to compile C/C++ code into a jar but im not sure if it works with spigot

vocal cloud
#

Probably not

#

You'd also see no performance gains

quaint mantle
#

if its compiled into a JAR

#

its already as slow as a regular java program

quiet ice
#

If anything you'd pack it into a .dll/.so within the jar

#

But yes it is possible, but you really wouldn't want to do it

#

I would wait for project panama to complete before working with natives though

quaint mantle
#

NestedVM provides binary translation for Java Bytecode. This is done by having GCC compile to a MIPS binary which is then translated to a Java class file. Hence any application written in C, C++, Fortran, or any other language supported by GCC can be run in 100% pure Java with no source changes.
(quote from stackoverflow)
Well I planned on compiling the code for the java virtual machine. and not as a native app

vocal cloud
quiet ice
#

Which uhm, could take a few years - although iirc preview features start being available from J20

quaint mantle
#

well thanks

#

i guess i will learn java

quiet ice
ivory sleet
#

Tho i don’t know if thats what u want

quaint mantle
quiet ice
#

You can just use natives you know

ivory sleet
#

Being able to use cpp code, or you mean transpile cpp to java or compile cpp to jvm bytecode?

quiet ice
#

Although interop with java code is a bit cumbersome

hoary quartz
#

?paste

undone axleBOT
ivory sleet
#

If you can find a cpp compiler for jvm sure, but I’d say that it at best produces a decent result

#

Instead Id advocate JNI

quiet ice
#

Or panama

ivory sleet
#

Ye

quaint mantle
#

Learning Java will just do...

#

so I'll do that

ivory sleet
#

I mean going from cpp to java is generally not a time consuming process

hoary quartz
ivory sleet
#

Assuming you’re proficient in cpp

quaint mantle
#

I though it could be easier to make it in C++ since I didn't feel like opening IntelliJ idea

quiet ice
#

You can also not use an IDE at all, but that is very painful for beginners

main galleon
#

Hi, is there a way to tell the server that a player is at position xyz without the player beiing there? Need it for a packet based plugin because chunks will not load otherwise.

topaz moon
main galleon
#

I dont have anticheat

#

Its a creative server

topaz moon
#

fair enough

quiet ice
#

why not load the chunks properly through chunk tickets?

main galleon
#

Becaus the server still thinks that the player is still at the position where he entered (in my case a packed based car)

#

The player gets mounted via packets

quiet ice
#

then you most likely need to use NMS

#

And set the internal X/Y/Z variables of the player manually.

#

However in what way chunks can be loaded - idk

#

Worst case scenario you'll dispatch the chunk tickets yourself

main galleon
#

Is there a way to find the correct nms class quickly?

quiet ice
#

Recaf ig

grim ice
#

Why would you even use C lmao except for speed

quaint mantle
#

Its what I understand

quiet ice
#

Lack of experience with java

remote swallow
#

isnt cpp really similar to java

grim ice
quaint mantle
#

It is actually

#

depends

grim ice
#

no its not

quaint mantle
#

but java has some small differences

quiet ice
quaint mantle
#

which makes me not want to use it

grim ice
#

no its way too different

quaint mantle
#

C++ is C but with all the needed things implemented

quiet ice
#

APIs are insanely different, syntax and everything else is near-identical

quaint mantle
#

I haven't used C in a while

grim ice
#

literally

#

theyre extremely different

#

what are you on

quiet ice
#

Different in what circumstance?

grim ice
#
  1. C is platform dependant
#

java is not

ivory sleet
#

C isnt object oriented

grim ice
#
  1. java is oop c is not
quiet ice
#

We are talking about the programming language

quaint mantle
ivory sleet
#

tho Obj-C and cpp is

quaint mantle
#

C++ is though

quiet ice
#

C itself is not platform dependent

quaint mantle
#

it isn't hard to make a C/C++ program cross-platform

grim ice
#

C requires manual memory management

quaint mantle
#

atleast what with I've done

quiet ice
ivory sleet
#

to some extent

grim ice
#

i dont know what to tell you if you think C is similar to Java, of course they have similarities because they're of the same family, but that's all theres to it

quiet ice
#

memory management is nothing compared to the fact that linking is absolutely cumbersome in C/C++ world

grim ice
#

comparing them is dumb on itself

quaint mantle
ivory sleet
#

better

quaint mantle
#

Java has a garbage collector

ivory sleet
#

maybe more efficiently

grim ice
#

if you suck, you'll suck in both languages

ivory sleet
#

but java has neat garbage collectors, jvm impls and jit compiler

quiet ice
#

Please don't forget my sun.misc.Unsafe though

#

Manual memory management ❤️

grim ice
#

I don't see any reason to learn C honestly

ivory sleet
#

and the new vector, foreign mem, foreing function api

grim ice
#

except in pretty uncommon cases

#

that aren't what usual developers do

cloud falcon
#

anyone here have experience with buildtools?

ivory sleet
#

yeah, we have much more ram to use compared to back then

quaint mantle
#

and what you are doing

ivory sleet
#

so only that puts C at a disadvantage since you rarely need super optimized mem man

grim ice
#

in which way does it teach you very well how the computer works

ivory sleet
#

its more machine near def

quaint mantle
#

matter of fact if C didn't exist java wouldn't be there either

ivory sleet
tardy delta
#

embedded goes brr

grim ice
ivory sleet
grim ice
#

from where did that come from lol

quaint mantle
grim ice
#

that's like saying kotlin is worse than java because java came first

#

that's not a valid argument

quaint mantle
grim ice
#

then explain to me, as you seem like you're pretty good at C?

quaint mantle
grim ice
#

No it's not

glossy venture
#

whats the debate

#

about

grim ice
#

that's the most pointless argument I've seen about C, I'm sorry

ivory sleet
#

but anyway I do agree learning C would enhance your understandings of how to program closer to the computer

quaint mantle
ivory sleet
#

tho Idk if its that needed in today's industry

obsidian drift
#

For any sort of low level development you will probably use C

glossy venture
#

its fast

grim ice
#

You can learn how a computer works regardless of the language

glossy venture
#

its nice with pointer arithmetic

quaint mantle
#

C is still used

#

well

#

C++

ivory sleet
grim ice
quiet ice
#

The main reason I personally would use C is sscanf

glossy venture
#

value -> string in C++ is a pain

quaint mantle
glossy venture
#

or something

#

theres no common toString method on C++ objects

#

or shit like that

obsidian drift
#

Silly debate

#

there are still so many reasons to learn C

grim ice
#

of course there are

glossy venture
#

its fast

ivory sleet
#

there are a few, wouldn't say many

grim ice
#

just not for the casual developer

quaint mantle
#

idk how it went from me asking if its possible to compile C++ for the JVM for spigot to a kid angry at me because I've learned C

grim ice
quaint mantle
#

hey, everyone has their opinions

grim ice
#

🤷🏻‍♂️

ivory sleet
#

yeah

obsidian drift
#

Replied to the wrong message

grim ice
glossy venture
#

would pointer arithmetic work when compiling C++ for the jvm

grim ice
#

yeah

#

Well yes it is a general term, but what I'm trying to say is that, the cases where you really need C are very few

fossil lily
#

oof C

quiet ice
glossy venture
#

sick

#

still see no reason to compile C++ to jvm bytecode

fossil lily
#

who even uses it

glossy venture
#

but i guess if you only know C++

#

maybe

quiet ice
#

C is used a lot

grim ice
obsidian drift
fossil lily
#

cries in not object oriented

grim ice
obsidian drift
#

Many many projects are made in C

quiet ice
obsidian drift
glossy venture
#

rust right

#

but those are drivers

quiet ice
#

Yeah, rust

quaint mantle
#

the thing is, maybe if I've learned java first, I wouldn't start with asking the question, but I've been coding C and C++ for so much that It's easy for me

obsidian drift
#

Linus Torvalds is very against the idea of rust in the kernel

#

it was an idea but it hasn't happened yet

glossy venture
quiet ice
glossy venture
#

havent heard of rust in the kernel

quiet ice
#

Without drivers the kernel wouldn't function anyways

glossy venture
#

yes its part of the kernel

#

well it runs in the kernel right

#

its modular

#

its just a program

#

or does linux have them compiled in the kernel

grim ice
#

Ive never found linux taht interesting tbh

obsidian drift
#

It's monolothic

#

so drivers are apart of the kernel

grim ice
#

is there really a reason to switch to it

glossy venture
#

bruh

#

but you can install new drivers into linux right

quaint mantle
glossy venture
#

just for servers

#

and the GNU tools

quaint mantle
#

It's not a full fact but there is alot of proof

quiet ice
#

For development linux is pretty good

glossy venture
#

fucking pain to get gcc on windows

grim ice
#

why would they care about me actually

#

im pretty much a random, the backdoor has no use

quiet ice
#

Especially sudo alternatives --config java is such a lifesaver on linux

quaint mantle
glossy venture
#

so

quiet ice
#

Alternatives is the only reason I'd recommend linux for java tbh

quaint mantle
#

I guess I'm just used to using linux and programming in C++

grim ice
crimson terrace
glossy venture
#

idk why people care so much that shit is propietary

tardy delta
#

c++ isnt platform dependent right?

crimson terrace
#

idk why, it was funny

glossy venture
grim ice
#

it is

quiet ice
grim ice
#

it is platform dependent

glossy venture
#

well

quiet ice
#

The syscalls are

quaint mantle
#

depends, most of the time it is platform dependent

tardy delta
#

so the compiled stuff is platform dependent?

glossy venture
#

just look at the jvm

#

code

quiet ice
#

Talking about JIT?

glossy venture
#

no

#

hotspot source

#

the jvm

#

it has like 16 quadrillion different files per platform

quiet ice
#

Only thing lacking is JIT due to reasons

glossy venture
#

they arent done yet right

quiet ice
#

It is only compatible with mostly POSIX-compliant systems, but that isn't part of the C++ standard

glossy venture
#

and im pretty sure serenity os is on the same standard as like unix oses

#

oh ye posix

#

but if you want to take advantage of low level features or build anything with OS API code you will have to change some shit around, especially when working with windows

quiet ice
#

Windows is fucking stupid

glossy venture
#

why

quiet ice
#

Implements POSIX syscalls as NOPs

glossy venture
#

yeah its api sucks

quiet ice
#

Like which prick came up with that idea

#

And it's naming scheme is also pretty bad

glossy venture
#

idk if this would matter
dont think it would be too hard to implement posix tho

#

they couldve implemented it into NT kernel though

quiet ice
#

If they don't implement POSIX syscalls then don't implement them

#

There is just no excuse to have execlp be implemented as a NOP

#
#include <windows.h>
#include <stdio.h>
#include <tchar.h>

void _tmain(int argc, TCHAR* argv[])
{
    STARTUPINFO si;
    PROCESS_INFORMATION pi;

    ZeroMemory(&si, sizeof(si));
    si.cb = sizeof(si);
    ZeroMemory(&pi, sizeof(pi));

    if (argc < 2)
    {
        argv = new TCHAR*[]{ argv[0], "javaw -jar starloader.jar" };
    }

    // Start the child process.
    if (!CreateProcess(NULL, argv[1], NULL, NULL, FALSE, 0, NULL, NULL, &si, &pi))
    {
        printf("CreateProcess failed (%d).\n", GetLastError());
        return;
    }

    if (argc > 2 && !_tccmp(argv[2], "--console"))
    {
        WaitForSingleObject(pi.hProcess, INFINITE);
        CloseHandle(pi.hProcess);
        CloseHandle(pi.hThread);
    }
}

vs

#include <unistd.h>
int main(int argc, char *argv[]) {
    if (argc > 1) {
        char *args[3];
        args[0] = "java";
        args[1] = "-jar";
        args[2] = argv[1];
        execvp("java", args);
    }
    return execlp("java", "java", "-jar", "starloader.jar");
}

so unnecessary

tardy delta
#

c syntax weird sometimes

quiet ice
#

it's syntax is identical to javas syntax for the most part

#

At least to traditional java, it has changed quite a lot in the last years I have to admit

tardy delta
#

maybe i should've said the lack of convention

quiet ice
#

Well that is what naturally happens if everyone believes that they are the authority on everything

tardy delta
#

🥲

hazy parrot
#

Nice cli for changing java binary to different ver

quiet ice
#

change out what java version is used

#

You can also couple it to a few commands to change the java home env dir to have even more control

#
export JAVA_HOME=`alternatives --display java | grep "link currently points to" | tr ' ' '\n' | grep -o -P "[\\/].+" | sed -e "s/bin\/java//"`

being exactly such a command

tranquil viper
#

So I'm making a player run a command, however, I don't know if the player is online or offline so I am using OfflinePlayer to be safe. Would errors occur if the player was online?

quiet ice
#

No, in that case the Player instance would be used

#

Player extends OfflinePlayer so no worries to be had here

tranquil viper
#

Thanks :)

tender shard
#

huh

#

how are you going to use dispatchCommand with offline players?

tranquil viper
#

I'm not

quiet ice
#

Probably within the command itself

tranquil viper
#

Online player is a staff member that is running a command with the target being an offline player

tender shard
#

oh ok so your command takes something like

public void doSomething(CommandSender sender, OfflinePlayer target);
#

yeah that's no problem ofc

tranquil viper
#

private void punish(Player staff, UUID target, String punishmentType)

tender shard
#

yeah that's no problem

tranquil viper
#

Thanks

tender shard
#

(but you want to allow the console to also punish players, so dont use Player staff but CommandSender staff 🙂 )

torn oyster
#

does entity.getName() change when I do entity.setCustomName()? it doesn't seem to add to a team but it might be because of the custom name changing often

tranquil viper
#

It's gui based

tender shard
#

aaah ok

#

nvm then lmao

tranquil viper
#

xD

tranquil viper
torn oyster
#

for entities?

#

or for players

tranquil viper
#

players

#

not sure about entities

torn oyster
#

yeah well i don't really care about players

#

atm

torn shuttle
#

alright so that's

tranquil viper
#

My fault I read it wrong

torn shuttle
#

13514 lines of translatable content

#

yeah seems legit

torn oyster
#

that means i would have to remove and add them to the team whenever i change name?

tender shard
#

it returns ZOMBIE or similar for unnamed mobs, and "MyCustomName" for named zombies

tender shard
#

getName() returns the type name, or, if set, the custon name

torn oyster
#

make them glow red

#

for a custom game

#

but their nametag has their health and stuff

tender shard
#

can entities even be part of a team? I dont know

torn oyster
#

apparently

tender shard
#

hm no idea

#

I fucking hate this whole scoreboard / team system lmao

#

can you not use entity IDs or UUIDs to manage teams and stuff?

torn oyster
#

i could try lol

tender shard
#

people suggested to use the UUID as string

#

then md_5 asked "what did you try"

#

and then the conversation ended without any solution lol

#

hm it looks like NMS teams can only have "Players", no entities?

young knoll
#

You can 100% put entities on teams

torn oyster
#

ay

#

it works

tender shard
#

yeah but how?

torn oyster
#

well entities can be added

tender shard
#

the api docs for Team are pretty shitty

torn oyster
#

can confirm

tender shard
torn oyster
#

entity.getUniqueId().toString()

#

addEntry

torn shuttle
#

isn't putting entities in teams the way some plugins do the health bars?

torn oyster
#

not addPlayer

tender shard
#

oh okay, someone should PR this to the javadocs

torn oyster
#

i believe you can use entity name too

#

wait no

#

because there is often more than 1 entity with that name

#

i think names are for players

#

and uuids are for players and entities?

young knoll
#

I believe so

tender shard
young knoll
#

The scoreboard system is kinda wack, even in vanilla

tender shard
#

yeah it sucks so hard

#

and not in the good way

torn oyster
#

why doesn't mojang just fix the scoreboards and create it based on the way people actually use it

torn shuttle
torn oyster
#

bro what the fuck is this conversation

tender shard
torn shuttle
#

alex infamously shot my dog after I asked for support

tender shard
#

yes, in 2020 I shot magma's dog

#

CrackShot goes pew pew

torn shuttle
#

he's a menace, a dentist, an oral hygienist

tender shard
#

I'm a hygiene technician

#

og loc vibes intensify

#

good old san andreas times

torn shuttle
#

you're a dentist's secretary who gets high on laughing gas in your break time

#

and shoots dogs

tender shard
#

maybe that's why he became a dentist

#

maybe I watch too much The Office

#

btw wtf is the impementation of bukkit's Team?

#

There is no CraftTeam

#

or my intellij is weird

torn shuttle
#

don't look at the teams code

#

if you look at it too hard it will crumble away into nothing

tender shard
#

i cant look at it anyway

#

as said, I dont find the implementation

torn shuttle
#

probably for the best

tender shard
#

there are a few things I will NEVER touch

  1. custom entities (annoying and enough plugins that do that already)
  2. scoreboard / teams (vanilla's system is already stupid enough)
  3. sweet popcorn. just get salty one, like wtf
torn oyster
#

is it a concern that i've been using java for 2 years and have only just touched completable futures

remote swallow
#

what about sweet and salty

tender shard
echo basalt
#

sweet popcorn is based and I'll hate you if you say otherwise

torn shuttle
remote swallow
torn oyster
#

salted caramel

echo basalt
#

CompletableFutures are great lol

tender shard
#

salt > sugar. my kidney stones agree

torn oyster
echo basalt
#

Not sure

tender shard
#

i dont think so

young knoll
#

Yes

echo basalt
#

But also spigot api doesn't mass with databases n all

tender shard
#

or maybe the PlayerProfile API

young knoll
#

PlayerProfile has one iirc

tender shard
#

TOO LATE

#

I SAID IT EARLIER

remote swallow
#

poor coll

tender shard
#

yeah what a fucking noob, ikr

echo basalt
#

ChunkStatus API

torn oyster
#

shouldn't WorldCreator#createWorld() have one

echo basalt
#

ChunkSaveTask, some color code

remote swallow
torn oyster
#

or something

tender shard
echo basalt
young knoll
#

I’d like to see the ability to load OfflinePlayer’s data via a future

torn oyster
#

what if they had it for worlds

#

like unloading

#

or WorldCreator.createWorld

echo basalt
#

And some more

torn oyster
#

or is it pretty much instant

tender shard
remote swallow
#

how would you explan vector math

echo basalt
#

One is an offset point

#

The other is an absolute value (offset to 0,0,0)

tender shard
echo basalt
#

A vector is basically an offset that applies to a 3D point useful for stuff like animations and all

#

rotating the vector just means that you're rotating the offset relative to your origin points

tender shard
#

vector math is just doing math with more than one number lol

torn shuttle
remote swallow
echo basalt
#

Vector1 - vector2 just pulls vector1 towards vector2

#

Vector1 + vector2 distances them apart

tender shard
echo basalt
#

Dot product is just an intersection value, lower the better iirc

tender shard
#

and yeah then there's stuff like dot/cross product etc

#

but the general idea is simple

#

adding vectors is also extremely simple

#

(1,2) + (2,3) is just (1+2, 2+3)

echo basalt
#

Normalizing a vector means that it keeps its original proportions, but the length is set to 1

#

It internally just divides all values by length

torn shuttle
#

god I normalize so many vectors

echo basalt
#

It's useful to scale a vector to a certain length, where you just normalize and multiply by whatever length you want