#help-development

1 messages · Page 559 of 1

subtle folio
#

unless it’s pushed to maven central, you need to specify a <repository> tag

zenith gate
#

i dont have anything in there.

subtle folio
#

Is your library on maven central?

tardy delta
#

use jitpack or smth

eternal oxide
#

or at a minimum have it published in your local repo

subtle folio
zenith gate
tardy delta
#

?

eternal oxide
#

never import anything in the project when using maven

zenith gate
subtle folio
#

You need to upload your library somewhere, or do it locally.

eternal oxide
#

no you don;t

#

just mvn clean install

subtle folio
#

yes you do 😂 in order to access it?

#

that’s why i said do it locally

eternal oxide
#

builds it and installs to local maven

subtle folio
#

did you not read my sentence?

eternal oxide
#

didn;t see you said "or"

coarse finch
#

does the 1.20.1 update affect servers? i heard it only fixes a singleplayer bug

subtle folio
#

It adds all the new feature if that’s what you mean..?

zenith gate
eternal oxide
#

Never import

#

is the library your own creation?

zenith gate
#

yes

eternal oxide
#

so you built it using maven?

zenith gate
#

Yes

eternal oxide
#

then build it again using the install lifecycle

zenith gate
#

okay 1 min

#

alright that's done.

eternal oxide
#

now delete the manual import you did in your other project

zenith gate
#

Already did that.

eternal oxide
#

update your project fromyour pom

#

your lib should now be available to you

zenith gate
#

so the dependency is correct? I just need to add the repository?

eternal oxide
#

no

#

you don;t need a repository for local

zenith gate
#

ah okay

eternal oxide
#

there is a refresh/update button in your maven tab in InteliJ

#

if you use that

#

if Eclipse, right click pom and select maven -> update project

zenith gate
#
        <dependency>
            <groupId>toast.pine</groupId>
            <artifactId>Overhaul-Systems</artifactId>
            <version>1.0.1-a</version>
            <scope>compile</scope>
        </dependency>

So this is all I need?

eternal oxide
#

if all those are correct values

zenith gate
#

they are

eternal oxide
#

artifactId shoudl be all lower case

zenith gate
#

even if it is camal cased in the actual plugin?

#

i copied this directly from the Systems pom file

eternal oxide
#

names can be any case you want, specification says groupId and artifactId should be all lower case

zenith gate
#

alrighty

#
[WARNING] Overhaul-Systems-1.0.1-a.jar, OverhaulArmory-1.2.3.jar define 3 overlapping resources: 
[WARNING]   - META-INF/MANIFEST.MF
[WARNING]   - config.yml
[WARNING]   - plugin.yml
[WARNING] maven-shade-plugin has detected that some class files are
[WARNING] present in two or more JARs. When this happens, only one
[WARNING] single version of the class is copied to the uber jar.
[WARNING] Usually this is not harmful and you can skip these warnings,
[WARNING] otherwise try to manually exclude artifacts based on
[WARNING] mvn dependency:tree -Ddetail=true and the above output.
[WARNING] See http://maven.apache.org/plugins/maven-shade-plugin/
#

this warning, thats because i have multiple config files?

#

each plugin has a config called config

opal carbon
eternal oxide
#

your lib is not a lib, its a plugin

#

do not shade it

#

add a provided scope to the pom entry

#

<scope>provided</scope>

zenith gate
#

want that to replace the compile?

eternal oxide
#

yes

opal carbon
#

did it explicitly tell you to use compile

#

if so ignore elgar

eternal oxide
#

Ignore Cool he's talking ass

#

set it to provided

zenith gate
opal carbon
#

this wont cause any real problems

eternal oxide
#

Cooleg please read up in the conversation before trying to discredit another helper

opal carbon
#

and check

eternal oxide
#

yes it will cause issues as it will be in teh wrong classloader

#

his lib is a plugin not a library

zenith gate
#

the warning is now gone.

opal carbon
#

im just saying listen to the original dev of whatever you are using

eternal oxide
#

Cooleg you clearly didn;t read, it HIS plugin AND lib

zenith gate
#

the plugin is mine

opal carbon
#

didnt see that one then maybe km just blind though

eternal oxide
grave kayak
#

I'd like to check if an item has a specific nbt after this line if (e.getBlock().getType() == Material.OAK_SAPLING) { is it possible without addition plugins?

eternal oxide
#

Blocks can;t have any nbt tags unless they have a tilestate

grave kayak
#

we have a fruit trees plugin which gives like 'lemon saplings'

young knoll
#

Only the item form can have NBT

eternal oxide
#

it will just be data on teh ItemStack

young knoll
#

The block is probably using a database/chunk pdc

eternal oxide
#

once planted teh plugin will track it

opal carbon
#

what coll said

deft thistle
#

I made this Person class

public class Person {
    private int age;
    private String name;

    public Person(int age,String name) {
        this.age = age;
        this.name = name;
    }

    public int getAge() {
        return age;
    }

    public void setAge(int age) {
        this.age = age;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    @Override
    public String toString() {
        return "Person{" +
                "age=" + age +
                ", name='" + name + '\'' +
                '}';
    }
}

GSON isn't complaining about having issues to unserialize Person, like it used on my spigot plugin (asking to make a Person adapter like it used to ask me to make a Location adapter.). Why is that?
Here is the program class:

grave kayak
#

ok, thanks for answers !

deft thistle
#
import com.google.gson.Gson;
import com.google.gson.GsonBuilder;

import java.io.*;

public class Program {
    GsonBuilder gsonBuilder = new GsonBuilder();
    File file;
    public Program() {
        Person personFromFile;
        try {
            file = new File("person.json");
            if(file.createNewFile()) System.out.println("Created the file person.json!");
            else System.out.println("The file person.json already exists.");
        }catch(IOException exception) {
            exception.printStackTrace();
        }
        System.out.println("Writing to file...");
        write(file);

        System.out.println("Reading file...");
        personFromFile = read(file);
        System.out.println("And here is the output: " +personFromFile.toString());
    }
     void write(File file) {
        Person person = new Person(10,"John");
        Gson gson = gsonBuilder.create();
        String personSerialized = gson.toJson(person);
        try(BufferedWriter bufferedWriter = new BufferedWriter(new FileWriter(file))) {
            bufferedWriter.write(personSerialized);

        }catch( IOException exception ) {
            exception.printStackTrace();
         }
    }
    Person read(File file) {
        Person person = null;
        Gson gson = gsonBuilder.create();
        try(BufferedReader bufferedReader = new BufferedReader(new FileReader(file))) {
            person = gson.fromJson(bufferedReader,Person.class);
        }catch (IOException exception) {
            exception.printStackTrace();
        }
        return person;
    }
}
opal carbon
#

wait so theres no issue

#

you are asking us why you are having no issue

deft thistle
#

yes, because on Spigot it asked me to make a adapter.

#

becuase it did not know how to deserialize a Location, and i had to "teach" it how to do it , by making a adapter.

opal carbon
#

we would beed to compare the two classes that are being serialized

eternal oxide
#

Person is not teh same as Location

deft thistle
#

maybe it's because of World?

eternal oxide
#

yes

deft thistle
#

I also added another object into person, it still works without complaining

public class Person {
    private int age;
    private String name;

    private PhoneNumber phoneNumber;

    public Person(int age, String name, PhoneNumber phoneNumber) {
        this.age = age;
        this.name = name;
        this.phoneNumber = phoneNumber;
    }

    public int getAge() {
        return age;
    }

    public void setAge(int age) {
        this.age = age;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public PhoneNumber getPhoneNumber() {
        return phoneNumber;
    }

    public void setPhoneNumber(PhoneNumber phoneNumber) {
        this.phoneNumber = phoneNumber;
    }

    @Override
    public String toString() {
        return "Person{" +
                "age=" + age +
                ", name='" + name + '\'' +
                ", phoneNumber=" + this.getPhoneNumber().getNumber() +
                '}';
    }
}

Why is that?

#
public class PhoneNumber {
    private int number;

    public int getNumber() {
        return number;
    }

    public void setNumber(int number) {
        this.number = number;
    }

    public PhoneNumber(int number) {
        this.number = number;
    }
}
eternal oxide
#

you havn;t told it whata PhoneNumber is

#

oh sorry

#

its not a complex object

deft thistle
#

Yeah, thats the thing. In spigot it complained to me that it did not know how to deserialize it and asks me to make a adapter.

#

but here it just works

#

world is a interface

#

hmm

eternal oxide
#

you can't instantiate World from a constructor

pseudo hazel
#

youll find that most api classes are interfaces

eternal oxide
#

so it can't reflectively create it

deft thistle
#

so if I remove phoneNumber from the constructor it'll complain then? (Yes, my issue is that it is not giving me a error):
I'll try it

deft thistle
#

Removing phoneNumber from constructor doesn't make it complain either.
I just want to know why, in spigot, it asks me to create a adapter.

tardy delta
#

spigot objects are more complex

deft thistle
#

alright I'll just take that as the reason

tardy delta
#

it doesnt know how to serialize a WeakReference<Location> or smth

#

or atomicref whatever

#

the error messages say alot, just try to create an adapter for the lowest amount of fields

deft thistle
#

alright

#

I'll make a faulty adapter in purpose setting all of persons phone numbers to 6666

tardy delta
#

dont call it a bug call it a feature

eternal oxide
#

a PhoneNumber will not break it

#

it's simple to serialize it

fresh timber
#

How can I check when a player stops breaking a block?

young knoll
#

BlockDamageAbortEvent

fresh timber
#

alr thx

#

also, how can I give players mining fatigue but have their hand move the same way it does if you dont have mining fatigue? (I looked it up and ppl said to use mining fatigue 255 but that still removes their arm or block they're holding from screen and when u try to break a block u can only barely see ur arm move)

eternal oxide
#

as far as I know, you can't

fresh timber
#

im pretty sure hypixel does it

eternal oxide
#

Thats not spigot

fresh timber
#

what is it

eternal oxide
#

custom everything

fresh timber
#

like custom api stuff

eternal oxide
#

no

#

the two can not be compared

chrome beacon
#

The effect is handled client side

#

so server side changes doesn't really matter here

fresh timber
#

im also pretty sure ive done it before

#

ive made a custom mining system like im doing rn before but I forgot how

eternal oxide
#

I doubt they woudl use fatigue

fresh timber
#

and im pretty sure ive done this

chrome beacon
#

I believe if you just set the mining fatigue high enough you get the effect

eternal oxide
#

mining duration depends on block hardness, which is baked into Material

chrome beacon
#

Yeah it's also hardcoded in to the client

eternal oxide
#

yes, you can however modify the baked in Server side to get extended mining durations.

cinder abyss
#

Hello, how can I listen to criticals packets ? I made this with ProtocolLib but it isn't working :```java
manager.addPacketListener(new PacketAdapter(this, ListenerPriority.NORMAL, PacketType.Play.Client.USE_ENTITY) {
@Override
public void onPacketReceiving(PacketEvent event) {
Player player = event.getPlayer();
PacketContainer packet = event.getPacket();

            if (packet.getModifier().read(0) instanceof EnumWrappers.EntityUseAction) {
                EnumWrappers.EntityUseAction action = packet.getEntityUseActions().read(0);

                if (action == EnumWrappers.EntityUseAction.ATTACK) {
                    player.sendMessage("Critical !");
                    if(!isCritical(player)){
                        player.sendMessage("Critical cheat !");
                    }
                }
            }
        }
    });```
eternal oxide
#

I believe alex had a lib for it

#

it was either alex or smile

cinder abyss
eternal oxide
#

mfnalex or 7smile7 created it

vital zinc
#

Hello. My code is stolen from spigot illegally, can I use ProGuard and how much can I use its functionality?

eternal oxide
#

no clue what its called, or if it's even released (as it's a little buggy in implementation)

#

they have posted it in here in teh past though

chrome beacon
eternal oxide
#

@tender shard Wakey wakey, did you do the Material hardless modifcation lib?

eternal oxide
chrome beacon
#

That doesn't look good

eternal oxide
#

same as it does for interactions on fake blocks

chrome beacon
#

Which why you use mining fatigue

#

to prevent the client from causing block damage

eternal oxide
#

make sense

tardy delta
#

always fun when your whole os freezes because of some stupid code bug

celest sonnet
#

Can someone explain what build tools is and why I would use it?

eternal oxide
#

to obtain spigot

#

?bt

undone axleBOT
celest sonnet
#

I read this page but I still don’t understand what the point of it is

silent steeple
#

he just said it

wet breach
#

it is the official method of obtaining the server jar as well

#

in regards to spigot

celest sonnet
#

Oh I see but why would you want to do such a thing

wet breach
#

because its the official method to know you get the official versions

remote swallow
#

Because of the dmca

celest sonnet
#

Ohh

remote swallow
#

?dmca

undone axleBOT
celest sonnet
#

Now I get it

wet breach
#

these other sites that provide jars you are taking a risk they haven't tampered with it

#

also yeah the DMCA plays a part in it too

#

but, since the jar can't be freely distributed we have buildtools for the people who are not familiar with how to compile java sources

#

so that means buildtools isn't strictly necessary but its the easiest method

celest sonnet
#

Easiest method to get it like legally I imagine

#

or safely

eternal oxide
#

both, but only legal way

eager jacinth
#

Guys, is using Bukkit.runTaskTimerAsynchronously a good idea to update data in the database? I just don't know how best to implement cache saving, because if I change the value of some field in a cached object, the data in the database will not update... Or should I just use PlayerQuitEvent and update the data when the player exits?

eternal oxide
#

what data are you needing to store about the player?

copper scaffold
#

I need help i want to make a custom enchanting gui with an Inventory but when i put the item in the slot where the item gets checked the enchantments will only apear when the item is put outside of the slot.
This is My Main.java code:
https://pastebin.com/zn860seR
And this the EnchantingTableGui code:
https://pastebin.com/6bEstggk

can someone say whats wrong/help me pls?

quaint mantle
#
java.lang.Throwable: null
        at org.spigotmc.AsyncCatcher.catchOp(AsyncCatcher.java:15) ~[purpur-1.20.jar:git-Purpur-1987]
        at org.bukkit.craftbukkit.v1_20_R1.scoreboard.CraftScoreboardManager.getNewScoreboard(CraftScoreboardManager.java:45) ~[purpur-1.20.jar:git-Purpur-1987]
        at org.bukkit.craftbukkit.v1_20_R1.scoreboard.CraftScoreboardManager.getNewScoreboard(CraftScoreboardManager.java:25) ~[purpur-1.20.jar:git-Purpur-1987]
        at dev.relismdev.rcore.utils.scoreboardBuilder.bundler(scoreboardBuilder.java:56) ~[RCore-1.0-shaded.jar:?]
        at dev.relismdev.rcore.utils.scoreboardBuilder$1.run(scoreboardBuilder.java:90) ~[RCore-1.0-shaded.jar:?]
        at java.util.TimerThread.mainLoop(Timer.java:566) ~[?:?]
        at java.util.TimerThread.run(Timer.java:516) ~[?:?]
[20:19:51 WARN]: Exception in thread "Timer-6" java.lang.IllegalStateException: Asynchronous scoreboard creation!
[20:19:51 WARN]:        at org.spigotmc.AsyncCatcher.catchOp(AsyncCatcher.java:16)
[20:19:51 WARN]:        at org.bukkit.craftbukkit.v1_20_R1.scoreboard.CraftScoreboardManager.getNewScoreboard(CraftScoreboardManager.java:45)
[20:19:51 WARN]:        at org.bukkit.craftbukkit.v1_20_R1.scoreboard.CraftScoreboardManager.getNewScoreboard(CraftScoreboardManager.java:25)
[20:19:51 WARN]:        at RCore-1.0-shaded.jar//dev.relismdev.rcore.utils.scoreboardBuilder.bundler(scoreboardBuilder.java:56)
[20:19:51 WARN]:        at RCore-1.0-shaded.jar//dev.relismdev.rcore.utils.scoreboardBuilder$1.run(scoreboardBuilder.java:90)
[20:19:51 WARN]:        at java.base/java.util.TimerThread.mainLoop(Timer.java:566)
[20:19:51 WARN]:        at java.base/java.util.TimerThread.run(Timer.java:516)
>```

hi, ive been coding a plugin that dynamically creates a scoreboard to display each n seconds, i dont think ive set it up to run any asynchronous scoreboard creation ?
fluid river
#

ig if you just enchant the item it won't be displayed in the inventory unless you pick it back with cursor

quaint mantle
#

for instance, here is my code for it :

public JSONObject frameExtractor(JSONObject rawconfig, int frame) {
        int frames = 0;
        for (String key : rawconfig.keySet()) {
            JSONArray array = rawconfig.getJSONArray(key);
            frames = Math.max(frames, array.length());
        }
        JSONObject config = sanitizeFrames(rawconfig, frames);

        JSONObject rebuiltConfig = new JSONObject();
        for (String key : config.keySet()) {
            JSONArray array = config.getJSONArray(key);
            rebuiltConfig.put(key, array.get(frame)); // Add only the common position element
        }

        return rebuiltConfig;
    }

    public int frameCalculator(JSONObject rawconfig){
        int frames = 0;
        for (String key : rawconfig.keySet()) {
            JSONArray array = rawconfig.getJSONArray(key);
            frames = Math.max(frames, array.length());
        }
        return frames;
    }

    public JSONObject parser(String scoreboardName){
        JSONObject configJson = new JSONObject(dh.configData.toString());
        JSONObject scoreboardsJson = configJson.getJSONObject("scoreboards");
        JSONObject scoreboard = (JSONObject) scoreboardsJson.get(scoreboardName);
        return scoreboard;
    }

    public Scoreboard bundler(JSONObject frame, Player player){
        ScoreboardManager manager = Bukkit.getScoreboardManager();
        Scoreboard scoreboard = manager.getNewScoreboard();

        Integer rows = 0;
        for (String key : frame.keySet()) {
            if(!key.equals("title")){
                rows++;
            }
        }

        String titleValue = msg.translateColorCodes(PlaceholderAPI.setPlaceholders(player, frame.getString("title")));
        Objective title = scoreboard.registerNewObjective("title", "dummy", titleValue);
        title.setDisplaySlot(DisplaySlot.SIDEBAR);

        for (String key : frame.keySet()) {
            if (!key.equals("title")) {
                String rowValue = msg.translateColorCodes(PlaceholderAPI.setPlaceholders(player, frame.getString(key)));
                Score row = title.getScore(rowValue);
                row.setScore(rows - Integer.parseInt(key));
            }
        }
        return scoreboard;
    }

    public void display(Player player, String scoreboardName) {
        JSONObject scoreboard = parser(scoreboardName);
        JSONObject animation = scoreboard.getJSONObject("animation");
        int frames = frameCalculator(animation);

        timer = new Timer();
        timer.scheduleAtFixedRate(new TimerTask() {
            int sb = 0;
            @Override
            public void run() {
                JSONObject frameObject = frameExtractor(animation, sb);
                Scoreboard frame = bundler(frameObject, player);
                player.setScoreboard(frame);
                sb = (sb + 1) % frames;
            }
        }, 0, 1000);
    }```
quaint mantle
fluid river
#

no, as i can see in your error

wet breach
#

you know we have a paste site for a reason -.-

fluid river
#

?paste

undone axleBOT
fluid river
quaint mantle
eternal oxide
#

?fork also

undone axleBOT
#

SpigotMC maintains the Spigot server. If you are using a fork of Spigot (such as Paper, Airplane, Purpur, or other derivative works), you should seek support in the appropriate Discord servers.

fluid river
#

there is literally Bukkit.getScheduler().runTaskTimer(plugin, () -> {}, delay * 20L, interval * 20L);

quaint mantle
# fluid river why

so that each second it bundles a new scoreboard and displays it to the player

molten cloak
#

idk why my crazyvouchers doesnt working still 😦

fluid river
#

i mean why are you using timer

eternal oxide
#

you will flicker switching scoreboards

molten cloak
#

is only red

fluid river
#

when bukkit provides own scheduling implementation

quaint mantle
fluid river
#

i guess

#

at least it won't throw async error anymore

quaint mantle
#
public void display(Player player, String scoreboardName) {
    JSONObject scoreboard = parser(scoreboardName);
    JSONObject animation = scoreboard.getJSONObject("animation");
    int frames = frameCalculator(animation);

    int taskId = Bukkit.getScheduler().runTaskTimer(plugin, new Runnable() {
        int sb = 0;
        @Override
        public void run() {
            JSONObject frameObject = frameExtractor(animation, sb);
            Scoreboard frame = bundler(frameObject, player);
            player.setScoreboard(frame);
            sb = (sb + 1) % frames;
        }
    }, 0L, 20L).getTaskId();
}```

so something like this ?
fluid river
#

like this

#

Now it's gonna update each second

molten cloak
#

idk why my crazyvouchers doesnt working still 😦

quaint mantle
#

i forgor how to import the plugin from the main class lol

fluid river
#

di

#

singleton

#

?di

undone axleBOT
quaint mantle
#

so basically in my main class instance a new scoreboardbuilder like this

public scoreboardBuilder sb = new scoreboardBuilder(this);

and then in my scoreboardBuilder class do this ?

public class scoreboardBuilder {
    private final RCore plugin;

    public scoreboardBuilder(RCore plugin) {
        this.plugin = plugin;
    }
}```
fluid river
#

yes

quaint mantle
#

but this way i have to pass in the plugin even if i instance a new scoreboardbuilder lets say in my "devStats" class

#

isnt it a bit annoying ? because i would need to instance devstats with the plugin aswell

fluid river
#

what

quaint mantle
#

in devStats i need a scoreboardBuilder

#

to instance it i am forced to pass in a new scoreboardBuilder(plugin); <--- a plugin

fluid river
#

yeah, you must provide every class with an instance of your main class through a constructor

quaint mantle
#

thats annoying af

eternal oxide
#

or use JavaPlugin.getPlugin

fluid river
#

yea

#

or JavaPlugin.getProvidingPlugin

eternal oxide
#

yep

fluid river
#

but anyways you would need to declare a variable and make a

static {
    myVar = JavaPlugin.getProvidingPlugin(DevStats.class);
}```
quaint mantle
#

what about

@NotNull Class<RCore> RCore = null;
Plugin plugin = JavaPlugin.getPlugin(RCore);
fluid river
#

i hate it

eternal oxide
#

no

quaint mantle
#

wont work ?

eternal oxide
#

just use RCore.class

quaint mantle
#

RCore.class is a class

#

how do i cast it to a Plugin ?

eternal oxide
#

you don;t

fluid river
#

bruh

eternal oxide
#

JavaPlugin.getPlugin(RCore.class)

quaint mantle
#
Plugin plugin = JavaPlugin.getPlugin(RCore.class);
fluid river
#

Yes

quaint mantle
#

so this works in every class ?

fluid river
#

yes

#

cuz bukkit plugin loader

quaint mantle
#

gosh thank yall

wet breach
#

is Rcore their plugin?

eternal oxide
#

yes

quaint mantle
#

love you guys

quaint mantle
fluid river
#

can also JavaPlugin.getProvidingPlugin(DevStats.class);

#

where the argument is your current class

wet breach
#

then why are they not just adding it to the constructor of the class if the instance is needed?

fluid river
#

just told the same thing

eternal oxide
#

although getProvidingPlugin can cause issues if some other noob tries to acces your class before you

wet breach
#

also, they can add a static method in their main class for obtaining the main class without resorting to going through the pluginmanager

fluid river
#

singleton user

quaint mantle
wet breach
#

you only need the plugin manager for other plugins

wet breach
#

but that isn't what I mean either

wet breach
fluid river
quaint mantle
#

i remember trying to do it and it would say that the main class is already instanced

wet breach
#

public class MainJavaPlugin extends JavaPlugin {

private static MainJavaPlugin instance;

public void onEnable() {
instance = this;
}


public static MainJavaPlugin getInstance() {
return instance;
}
quaint mantle
#

org.bukkit.plugin.InvalidPluginException: java.lang.IllegalStateException: Cannot get plugin for class dev.relismdev.rcore.RCore from a static initializer

when trying to access the plugin instance like this : java Plugin plugin = JavaPlugin.getPlugin(RCore.class);

wet breach
#

public class SomeOtherClass {

private MainJavaPlugin plugin = MainJavaPlugin.getInstance();
quaint mantle
#

ok i will try this now

chrome beacon
#

You can also use di

wet breach
#

yeah and is generally the preferred way, but since its the main class though its fine using the static method or the di way, up to you really

#

?di

undone axleBOT
quaint mantle
#

ok so in the main class :

public static RCore getInstance() {
        return plugin;
}```

and externally i can access it like this : 

```java
Plugin plugin = RCore.getInstance();```
wet breach
#

did you not look at my example?

quaint mantle
#

where plugin is defined as plugin = this; in the onEnable

quaint mantle
wet breach
#

I suppose you can change out the variable name

#

but its better if you just use instance in the main class to avoid confusion

#

but again up to you

quaint mantle
#

works like a charm now, thanks everybody :)

karmic mural
#

How can I update the spigot api library in my project like the Minecraft Development plugin does it?

karmic mural
quaint mantle
#
<dependency>
            <groupId>io.papermc.paper</groupId>
            <artifactId>paper-api</artifactId>
            <version>1.20-R0.1-SNAPSHOT</version>
            <scope>provided</scope>
        </dependency>```
tender shard
quaint mantle
karmic mural
#

I see, so it updates it but it doesn't change the name as I understand?

tender shard
quaint mantle
tender shard
quaint mantle
karmic mural
quaint mantle
#

in both cases you're welcome

wet breach
#

only in IntelliJ do you need to refresh maven

#

as far as I am aware

quaint mantle
wet breach
#

I am stating that in the event they wanted to use some other IDE

#

the other IDE's don't have that problem

livid dove
#

So ready yo start that code jam challenge tommorow night a bunch of us planned.

How the helk u go about even decently announcing thst?

karmic mural
wet breach
#

I personally use Netbeans, so things like refreshing maven or invalidating caches is not a thing for me XD

karmic mural
wet breach
#

IntelliJ isn't coded the same way or designed the same as Netbeans

stoic tiger
#

I don't know anything about coding or something, but I really need help with a rust Minecraft build system

stoic tiger
wet breach
#

so both have their ways of doing things. Netbeans detects external changes and changes to settings. Only times where I experienced issues is when beta testing netbeans in which case it could get stuck and the solution is to close the project and re-open it

karmic mural
stoic tiger
#

Hmmm

#

It's like

#

Wait I give video

wet breach
#

all entities can be set as passengers

#

not sure why it wouldn't let you set a creeper as a passenger

#

because it should

stoic tiger
#

I don't know how to make it

karmic mural
#

Ohh so the actual game "Rust" and the building system they have, but in Minecraft with larger than single-block structures

hazy parrot
#

?services

undone axleBOT
karmic mural
#

That's actually a really cool idea but you would need to either find an existing version, pay someone, or learn how to make it yourself like Goksi suggested

stoic tiger
#

Is hard to make it?

hazy parrot
#

If you have 0 experience in coding as you said yourself, absolutely yes

stoic tiger
#

Another question

stoic tiger
hard socket
#

https://paste.md-5.net/vadiwodojo.cs
I have this code to modify the result of a itemstck in the smithing table
everything works fine but when I try to collect to the result it just get placed back
like I can pick it up but it get instanly placed back

hazy parrot
stoic tiger
#

How can I learn it?

#

From 0

hazy parrot
#

?learnjava

chrome beacon
#

?learnjava

undone axleBOT
stoic tiger
#

Because I want to make plugins like in that video

hazy parrot
#

It would be quite a process, don't expect to do it in one week

stoic tiger
#

1 month then 😅

chrome beacon
#

Probably longer

stoic tiger
#

I am learning fast, If I see some coding videos

#

I am script now

#

Maybe coding is not so hard if I start learn and understand it

stoic tiger
hazy parrot
#

Same as everything, not hard if you know it lol

hazy parrot
#

You learn as long as you code

#

But I'm doing java for about 2 years

eternal oxide
#

also, sit in this channel and just read. You will pick up a lot

stoic tiger
#

I know some russians that make servers full rust

#

They make open map in game with custom keys

#

They add custom keys

#

They put 30 slots inventory

#

I don't know how, that's means they good coders

lethal coral
#
    @EventHandler
    public void onPlace(BlockPlaceEvent event) {
        System.out.println(event.isCancelled());
        event.setCancelled(!isInCreative(event.getPlayer()));
        System.out.println(event.isCancelled());
    }

Nothing is printed in the console and the rest of my events in the class work fine.

chrome beacon
#

Make sure you didn't forget to replace your old jar

lethal coral
#

I pressed the maven reload button not the package 🤦‍♂️

#

Wait no it still didn't do anything

wet breach
#

if you make a server that requires a custom client, the possibilities are endless at that point

lethal coral
wet breach
#

however, 30 slot inventories on vanilla client are not impossible though

stoic tiger
wet breach
#

are we talking about mc or another game? Because I am not sure how modifying another game has to do with mc?

stoic tiger
#

I don't know if this is a plugin but I see a video name like this: Vanilla ItemStack.
And in that video I see 1000 blocks stack

chrome beacon
#

That's not possible in vanilla

#

The maximum the client can see is 127

stoic tiger
#

If you don't know, searc on youtube: rustex remake

#

Is a server

wet breach
#

yeah isn't super difficult to do that

#

they combine client side textures and some tricks with the server. Otherwise as I stated earlier if you instead you make a custom client for the server it becomes even easier

stoic tiger
#

The owner say me that, all of this is make with plugins

#

☠️

chrome beacon
#

From I can see it's a mod

#

not a plugin

stoic tiger
#

No, it's not...

#

Because we don't install anything to join server

#

Just a launcher

chrome beacon
#

So you have to install a launcher?

stoic tiger
#

Yea

chrome beacon
#

Then that launcher contains the mod

hazy parrot
#

so its mod lol

stoic tiger
#

And that's all

lethal coral
#
    @EventHandler
    public void onPlace(BlockPlaceEvent event) {
        event.getPlayer().sendMessage("hello");
        Bukkit.getLogger().info(String.valueOf(event.isCancelled()));
        event.setCancelled(!isInCreative(event.getPlayer()));
        Bukkit.getLogger().info(String.valueOf(event.isCancelled()));
    }

why is this not working

#

nothing is sent to anybody or anything

fresh timber
lethal coral
#

and it's not cancelling properly

#

it's cancelling in any scenario

stoic tiger
#

all items crafts load & init from yml
skript - 2-5 minutes
java - 1 sec

lethal coral
#

Oh wait

#

Nevermind y'all I have another event overriding this one

#
    @EventHandler
    public void onRightClick(PlayerInteractEvent event) {
        if (event.getAction() == Action.RIGHT_CLICK_BLOCK) event.setCancelled(true);
    }
#

💀

wet breach
#

custom client makes things extremely easier

#

and would make the most sense

stoic tiger
#

He don't use forge

chrome beacon
#

Yeah that's a mod

wet breach
#

you don't need forge for mods

stoic tiger
#

Vanilla?

chrome beacon
#

It's not vanilla either since you're modifying the game

hazy parrot
#

vanilla usually means "no modifications to original client"

#

so its not vanilla

chrome beacon
#

I would call it a mod even if it's released in the form of a launcher

wet breach
#

well they said it isn't a custom client

#

so yeah a mod

tardy delta
#

bruh seemed like an endless loop in my app froze windows for 20 secs

#

that took a while to find out

wet breach
#

then stop endlessly looping

stoic tiger
#

He said me this:
im rewrote all mechanics to java with server core inject

rough ibex
#

oh no

chrome beacon
tardy delta
#

btw does that command palette in windows terminal actually work for anyone?

wet breach
#

I don't think we need more explanations we already stated its a mod

#

not a plugin

#

or not a plugin alone doing it

chrome beacon
#

Or they want you to make as close a possible with a plugin

wet breach
#

if that is what they are saying

chrome beacon
#

eitherway it will take a long time for you to make that

#

since you don't even know basic Java yet

stoic tiger
stoic tiger
chrome beacon
#

?

tardy delta
#

much to learn -_-

stoic tiger
#

OH WAIT

#

He said to me that he create own packet system

#

I understand

#

I need start easy

#

If I want to learn ,and make server like him

eternal oxide
#

you spend at least a year learning

#

dedicated daily learning

wet breach
tardy delta
#

ye i have no clue what this math is doing

#

its supposed to adapt the drawing of the world based on the camera zoom

#

some rendering stuff

quaint mantle
tardy delta
#

odin

quaint mantle
#

pushing to git after coding for like 8 hours

#
  • im seeing my homies in 15 minutes
#

best feeling ever

tardy delta
#

really need some better textures :C

river oracle
#

5 fps

young knoll
#

Best fps

worldly ingot
#

You really don't need more than that

celest sonnet
#

[ERROR] Number of foreign imports: 1
[ERROR] import: Entry[import from realm ClassRealm[maven.api, parent: null]]
[ERROR]
[ERROR] -----------------------------------------------------
[ERROR] : org.codehaus.plexus.compiler.manager.NoSuchCompilerException
[ERROR] -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/PluginContainerException
Error compiling Spigot. Please check the wiki for FAQs.
If this does not resolve your issue then please pastebin the entire BuildTools.log.txt file when seeking support.
java.lang.RuntimeException: Error running command, return status !=0: [C:\Users\jiggl\Downloads\build\apache-maven-3.6.0/bin/mvn.cmd, -Dbt.name=3763, clean, install]
at org.spigotmc.builder.Builder.runProcess0(Builder.java:1062)
at org.spigotmc.builder.Builder.runProcess(Builder.java:993)
at org.spigotmc.builder.Builder.runMaven0(Builder.java:962)
at org.spigotmc.builder.Builder.runMavenServer(Builder.java:931)
at org.spigotmc.builder.Builder.main(Builder.java:742)
at org.spigotmc.builder.Bootstrap.main(Bootstrap.java:27)

does anyone know why this is happening

#

buildtools

tardy delta
#

limited the fps to 5 for debugging

#

got around 2000 on builtin graphics

celest sonnet
#

no its in my downloads folder

#

cause for some reason everything on my desktop is in a one drive and im too lazy to try to fix it

#

one drive is literally like a virus it infects everything i own even if i delete

eternal oxide
#

I don;t use it, but I know it messes with buildtools

tardy delta
#

thats called a backup

celest sonnet
#

i dont want my shit on my computer to be backed up anywhere

eternal oxide
#

create a folder in the root of your dirve, put bt in there and run it.

celest sonnet
#

but thats besides the point, might there be a reason?

eternal oxide
#

?paste then upload teh buildtools.log if it fails

undone axleBOT
lethal coral
#

If I'm going to create a player wrapper to contain more information about a player should I make it a static wrap method with a private constructor or have the constructor with a player arg

public WrappedPlayer(Player player) {}
private WrappedPlayer(Player player) {}

public static WrappedPlayer wrapPlayer(Player player) {
  return new WrappedPlayer(player);
}
eternal oxide
#

Don;t use a Player object as a reference, use their UUID

lethal coral
#

why

eternal oxide
#

depending on the amount of data you can use their PDC

#

Player objects go stale when they relog

lethal coral
#

wait a minute you're a genius

#

I could use PDC

ember ridge
#

can I rely on the onChunkPopulate event to introduce some "custom ore"? I'm a beginner and don't know if it can have side effects, and I read that overriding the ChunkGenerator itself is a huge pain since you'd have to code that whole thing yourself.

lethal coral
young knoll
eternal oxide
#

just a utils class

ember ridge
tawdry canopy
#

Hi ! I wanted to use TextComponents in my plugin (1.19 Spigot plugin) but my IDE seems to tell me that those are deprecated. I didn't found any recent posts mentionning this. Can I still use them or is there an alternative to it ?

young knoll
#

You are depending on paper api

orchid gazelle
#

hi is this just 1.20-R0.1-SNAPSHOT?

#

with 1.20?

chrome beacon
#

Yeah just replace it

tardy delta
#

alright classical 1.0 / 0 problem

chrome beacon
#

Don't forget it to replace it in the other places as well

orchid gazelle
#

and recompile I guess

#

gotta run buildtools first for nms

orchid gazelle
#

is it R0.1 or 1.0?

thorny meadow
#

Hi all, I'm currently working on a custom application that allows me to download resources from spigot. Currently I have this working for the usual plugins but premium ones require authentication in order to download. I did have a look to see if I could get some sort of api key I can use but I'm not having much luck. Has anyone got any suggestions?

naive jolt
#

Okay after a year I finally have a question that shouldn't just be answered with "go learn java" umm so I'm tryna create a countdown for the player to respawn but they can just skip it by leaving the server and coming back

#

I don't know how to fix this

eternal oxide
#

add a dead flag to teh players PDC.

#

remove it when they respawn

#

check it onJoin

naive jolt
#

never used flags, but sounds like a great solution!

eternal oxide
#

?pdc

hard socket
#

https://paste.md-5.net/vadiwodojo.cs
I have this code to modify the result of a itemstck in the smithing table
everything works fine but when I try to collect to the result it just get placed back
like I can pick it up but it get instanly placed back

young knoll
#

Did you ever try registering a proper recipe

#

Like I suggested a week ago

hard socket
noble lantern
young knoll
#

They do for the output

#

But that’s beside the point, it’s just a base recipe so the game doesn’t freak out

tardy delta
#

took me 3 hours to figure out f32(max(1, camera.zoom)) needed to be 1 / max(1, camera.zoom) 💀

young knoll
#

You can still do all your checks in the event

noble lantern
#

and just cancel the event if its not to your standards

young knoll
#

You can still modify the result too afaik

noble lantern
#

eh result supports item stack so unless you want like a player placeholder :p

young knoll
#

Yes but smithing recipes are weird

noble lantern
young knoll
#

And the result meta will be wiped by default

naive jolt
noble lantern
#

alright then mojang

young knoll
#

It’s because the smithing table is meant to copy the meta of the input

#

So you don’t lose any enchantments or whatnot when making netherite

noble lantern
#

Are anvil recipes a thing yet then since smithing ones are? r_baby_cry

#

PrepareAnvilEvent is the bane of my existence

tardy delta
#

final code lookin clean

young knoll
#

Anvils don’t use recipes

#

So no

tawdry canopy
#

Is it bad if I use deprecated methods ? I don't see any alternatives to them (TextComponent)

young knoll
#

Like I said

#

You are depending on paper api

tawdry canopy
#

oops, my bad

young knoll
#

Paper api deprecates all the things

tawdry canopy
#

thanks

tardy delta
#

comments saying what

noble lantern
#

paper just prefers forces you to use them

Theyre still fine to use

tawdry canopy
#

Thanks ! I'll give it a try

fluid river
#

c++ indian edition

tardy delta
#

odin

fluid river
#

ind(ia)

tardy delta
#

?

fluid river
#

nothing

tardy delta
#

its very like C

fresh timber
#

I am trying to stop a player from mining a block before they even start to break it so I have a BlockDamageEvent and I cancel that even but it still lets them finish breaking it but it canceles the block break event once it breaks... is there a way to make it where they just cant mine it at all?

silent steeple
#

gamemode adventure

fresh timber
#

b r u h

#

its like conditional like if they dont have the right tool then they cant break it so i dont wanna be switching their gamemode over and over and over

#

that would be so messy

#

and weird

sick grove
#

Hi i am making my first java plugin and i can't seem to get my plugin loaded for my 1.20 sever. I am using the 1.20 api version, but when i start or reload the server i get an error that the plugin can not me loaded in because of an outdated api version.
My plugin.yml:

version: 0.1
main: me.emiel131517.wandcreater.WandCreator
api-version: 1.20
commands:
  wand:
    description: Get a pre-created wand
    aliases: gw
    usage: /<command> name
    permission: wc.wand
load: STARTUP```
The error i am getting: 

Could not load 'plugins\WandCreator.jar' in folder 'plugins'
org.bukkit.plugin.InvalidPluginException: Unsupported API version 1.2

silent steeple
#

pom.ex em el

#

just remove 1.20 in ur api version

#

why do you need it?

sick grove
remote swallow
#

do enable non legacy support simoon

silent steeple
#

yeah

#

what epic

remote swallow
#

@sick grove wrap it in apostrophes

silent steeple
#

shoutout to the minecraft version 1.7.10

remote swallow
silent steeple
#

#boycott 1.8+

remote swallow
#

api-version: '1.20'

silent steeple
#

oh yeah cuz it just reads 1.2

sick grove
remote swallow
#

?paste it

undone axleBOT
silent steeple
#

wow this website is amazing

#

you can paste stuff

#

since when was that a thing

remote swallow
#

a while probably

sick grove
#
org.bukkit.plugin.InvalidPluginException: Cannot find main class `me.emiel131517.WandCreator'```
#

me.emiel131517.wandcreater.WandCreator This doesn't work either. (this was the standard.)

remote swallow
#

show a screenshot of your file tree in ur ide

sick grove
silent steeple
remote swallow
#

me.emiel131517.wandcreator.WandCreator should work

silent steeple
#

when creating project

sick grove
remote swallow
#

try clean building after changing it

sick grove
#

ok

river oracle
fresh timber
#

already tried that too

river oracle
#

I feel like PlayerInteractEvent should work :

fresh timber
#

yea i tried i checked that the action was left click block and did same code as I have in the blockdamageevent event now and it still doesnt work

#

i mean it stops them from mining it yes but I wanna make sure they dont even start to damage it

river oracle
#

?eventapi

undone axleBOT
tawdry canopy
#

yep, exact

river oracle
#

oh

river oracle
tawdry canopy
#

i find it not rlly cool because its soo long to make a little text

fresh timber
#

i did 2

river oracle
#

did you cancel it?

fresh timber
#

yes

river oracle
#

show me your code

#

?paste

undone axleBOT
fresh timber
#

this is it currently

@EventHandler
    public static void blockBreakStart(BlockDamageEvent event) {
        Player player = event.getPlayer();
        UUID uuid = player.getUniqueId();
        Block block = event.getBlock();

        Skyquest.currentlyMining.put(uuid, block);

        if ((block.getType().equals(Material.DARK_OAK_LOG)) && (Skyquest.getPower(player.getInventory().getItemInMainHand()) < 2)) {
            event.setCancelled(true);
            player.sendMessage("§cYou do not have a powerful enough tool to break this!");
        } else if ((block.getType().equals(Material.DARK_OAK_LOG)) && (Skyquest.getSkill(player, "woodcutting") < 5)) {
            event.setCancelled(true);
            player.sendMessage("§cYou need at least woodcutting 5 to break this!");
        } else if ((block.getType().equals(Material.SPRUCE_LOG)) && (Skyquest.getPower(player.getInventory().getItemInMainHand()) < 3)) {
            event.setCancelled(true);
            player.sendMessage("§cYou do not have a powerful enough tool to break this!");
        } else if ((block.getType().equals(Material.SPRUCE_LOG)) && (Skyquest.getSkill(player, "woodcutting") < 10)) {
            event.setCancelled(true);
            player.sendMessage("§cYou need at least woodcutting 10 to break this!");
        }
    }

paste is bad

sick grove
# remote swallow try clean building after changing it

Did not work i builded clean and rebuilded. getting this error still: Could not load 'plugins\WandCreator.jar' in folder 'plugins' org.bukkit.plugin.InvalidPluginException: Cannot find main class `me.emiel131517.wandcreator.WandCreator'

river oracle
#

you could send a packet

#

to make it look nonbroken

#

but PlayerInteractEvent should work

fresh timber
#

yea I tried to use player.sendBlockDamage(block.getLocation(), 0); but that did nothing

#

is there a way to like make them stop mining

#

like force them to stop swinging their arm even if they keep holding down click and they would have to click again to swing again?

lethal coral
#

why can I not get the persistent data container of an offlineplayer? it should be accessible from the player data file and return null if they haven't played before

fresh timber
#

cus didnt u store the persistent data container to the online player so if u try to get it from the offline player it shouldnt work cus its a different thing?

lethal coral
#

persistentdatacontainer is just the player data file and contains the nbt of the player which is how the OfflinePlayer#hasPlayedBefore() method works I believe (checks if the file exists)

#

so why would it not use that

shy forge
#

Hey there, question for learning's sake, does anyone know how the event handler system works? Like I understand interfaces but surely there should be different interfaces for each event? How does the @EventHandler tag work and how does it know which methods the plugin class has?

noble lantern
pseudo hazel
#

i think so, but I think a big part comes down to the function signature, i.e. what it returns and what parameters it has

#

so if its like an event as a parameter, using the annotation the compiler can see that the event belongs to that method

#

thats just how I envision it anyways

shy forge
noble lantern
tardy delta
#

does spigot use an annotation processor or just regular reflection? 👀

noble lantern
#

There is something like Lombok, which is a compile-time annotation, meaning the annotations are processed by the compiler and never actually used during runtime

Or you make your own annotation processor at runtime via reflection ^

tardy delta
#

what am i with :agree:

noble lantern
#

i just wanted to say yes lol

#

couldnt find a yes emoji haha

tardy delta
#

is it this or that
yes

#

🤔

noble lantern
#

yes to regular reflection lmao

#

getClass().getAnnotatedMethods()

#

like 97% sure thats a method i used when i made mine

tardy delta
#

thought so

noble lantern
#

i forgot how ass this was to make fuck

#

reflection r_baby_cry

#

and that way is only just for the constructor/class annotations

tardy delta
#

thats why annotation processors are nice

noble lantern
#

well sometimes you rlllly want then during runtime, like with EventHandler

shy forge
#

Okay, so the idea is that it that it can search for classes or methods with a specified annotation?

#

And then call or change them somehow?

#

I suppose it makes sense, but the code examples I found online make it look SUPER complicated to set up

noble lantern
#

you need to have a good grasp on reflection

tardy delta
#

i somehow cant even figure out basic math

eternal oxide
#

theres a song to help with that

#

has a frog in it

tardy delta
#

only seems to work when zooming in

eternal oxide
#

ss teh code snipet. I can;t read it

tardy delta
#
drawTiles :: proc(texture: ^rl.Texture, camera: rl.Camera2D) {
    zoom := max(1, camera.zoom)
    rows := math.ceil(f32(rl.GetScreenHeight()) / f32(CUBE_SIZE) * 1 / zoom)
    cols := math.ceil(f32(rl.GetScreenWidth()) / f32(CUBE_SIZE) * 1 / zoom)
    
    for row in 0..<i32(rows) {
        for col in 0..<i32(cols) {
            rl.DrawTexture(texture^, col * CUBE_SIZE, row * CUBE_SIZE, rl.WHITE)
            tilesCount += 1
        }
    }
}
#

not java anyways but i think youll get it

#

i got it working today but then i fixed smth and now its broken again lol

shy forge
eternal oxide
#

should it not be +1 /zoom?

#

needs parenthesis too

#

you ned 1 more tile than will fit on screen

#

if its a fraction

tardy delta
#

thats why i did the ceil

eternal oxide
#

I don't know the language, whats f32?

tardy delta
#

32 bit float

eternal oxide
#

thought so

#

so the *1 is doing nothing

#

a float divided by a float

#

oh I see

#

you are making zoom a fraction

#

I thought * was before / in order

tardy delta
#

shouldnt i multiply the amount of rows or cols that i get by zoom /1?

#

zooming in means zoom getting bigger

eternal oxide
#

yes, so less tiles

tardy delta
#

this lang not having implicit cast sucks lol

silent steeple
#

use C++?

eternal oxide
#

what is your camera.zoom generally?

tardy delta
#

its standard 1, and reaching about 4 when zoomed in and zooming out is kinda limitless

#

lemme just do this whole math again lol

#

cant work in this heat

eternal oxide
#

so zooming out, increases zoom value, and as such shoudl increase the total row/col

tardy delta
#

no no zooming out decreases the zoom value

eternal oxide
#

I'd delete the * 1 and see

#

uh?

#

zooming out decreases zoom

#

but you are limiting it to 1

#

so 4 is max zoomed in

#

1 is max zoomed out

tardy delta
#
 mouseWheelMove := rl.GetMouseWheelMove()
        if mouseWheelMove > 0 do camera.zoom = min(4, camera.zoom + ZOOM_INCR) // zooming in
        else if mouseWheelMove < 0 do camera.zoom = max(-4, camera.zoom -ZOOM_INCR) // zooming out
eternal oxide
#

goes down to -4?

tardy delta
#

uh ye just some magic value

#

just doesnt seem to work somehow, zooming in has a max

#

ah seem to have integer division on that zoom variable too

#

the max(1, camera.zoom) is messing up ahh

#

ayy i fixed it, ty for helping

#
drawTiles :: proc(texture: ^rl.Texture, camera: rl.Camera2D) {
    zoom := camera.zoom
    if zoom == 0 do zoom = 1
    zoom = 1 / zoom
    rows := math.ceil(f32(rl.GetScreenHeight()) / f32(CUBE_SIZE) * zoom)
    cols := math.ceil(f32(rl.GetScreenWidth()) / f32(CUBE_SIZE) * zoom)
    title := rl.TextFormat("Zoom: %.2f Tiles count: %i Zoom fraction: %.2f", camera.zoom, tilesCount, zoom)
    rl.SetWindowTitle(title)
    
    
    for row in 0..<rows {
        for col in 0..<cols {
            rl.DrawTexture(texture^, i32(col * CUBE_SIZE), i32(row * CUBE_SIZE), rl.WHITE)
            tilesCount += 1
        }
    }
}
eternal oxide
#

yep

tardy delta
#

was stuck at 1

eternal oxide
#

teh DrawTexture looks much better too

tardy delta
#

gotta cleanup some things, it looks like a mess

#

anyways gn

eternal oxide
#

night

left pine
#

Hi, I have a question. Can you copy a folder with the spigot 1.17.1 api?

kind hatch
#

You can do that with normal java.

left pine
ivory sleet
#

Yea

kind hatch
#

You mean your resources folder? There's not an easy way to write all files contained within it with the API, but you can use JavaPlugin#saveResource() and then pass in the file name.

ivory sleet
#

Files.copy() iirc

#

And then you have Files.walkFileTree (i think)

young knoll
#

I just loop over the jar to save everything in it

kind hatch
#

I ended up writing something that would let me choose which subfolder I wanted to copy everything in. I only did this so I could control what time the files get copied onto the server during startup.

ivory sleet
grave kayak
#

https://www.spigotmc.org/wiki/bossshoppro-api/ im trying to use this api, when I add the jar to my library it allows me to use the methods. but when i go to complile the plugin it says the imports don't exist and i cant find a repository and dependency

quartz gull
#

lolololol

quartz gull
dusty swan
#

any way to reproduce the /clone command in spigot

young knoll
#

The simple method is just to loop over the source area and copy each block to the destination area

#

Copying the base block data is easy

#

But I don’t think spigot really has a good api to copy NBT data

eternal oxide
#

as nbt can only be on tileEntities does it not get copied when you getMeta?

young knoll
#

There’s no getMeta method on tile entities

#

If you mean getState, yes that does copy NBT data but there is no way to clone that state to a new location

eternal oxide
#

sorry yes.

hybrid spoke
#

what is the /clone command

minor aurora
#

Question about kotlin development; I'm following the tutorials the best I can.
You still inherit JavaPlugin and all that jazz, right?
Also, on the example I set Enable/disable to use the bukkit logger and send messages with a color using org.bukkit.ChatColor. Do I just toString() the colors before sending the message?

eternal oxide
#

it's a BlockState, however that data is surely in the BlockData?

young knoll
#

Clones an area of blocks to a new location

hybrid spoke
young knoll
#

No, BlockData only contains the type and the various states

minor aurora
hybrid spoke
#

its not it sucks

minor aurora
#

_ why?_

eternal oxide
#

shame

young knoll
#

There’s an open PR that has a method to clone block states

ivory sleet
young knoll
#

But it’s unfinished

ivory sleet
#

More semantic features but more bloated at the cost of it

#

And interoperability it gives sucks

#

Its atrocious in fact

#

Which is JB’s main so called selling point

minor aurora
#

Once compiled into a jar it shouldn't matter much, does it?

ivory sleet
#

I meant at compile time obv

young knoll
#

Don’t you still need to shade the Kotlin standard lib

#

Despite the fact that it’s meant to compile to the same bytecode

ivory sleet
#

Well u could just use the library thinngy thing

young knoll
#

Wonder if that works for this

#

I know it doesn’t work for everything

ivory sleet
#

Idk

minor aurora
hybrid spoke
#

i mean is it worth it to open this bottle again

ivory sleet
#

I think Java is better if the entire server runs with Java

young knoll
#

Spigot has a library feature in plugin.yml

hybrid spoke
#

he could just search for kotlin and java in this channel

minor aurora
#

Hm, I really think I'm missing some context. My naivity tells me it shouldn't make much of a difference

young knoll
#

:nokotlin:

ivory sleet
#

The only thing kotlin actually provided that was neat was coroutines, which rn is being added to java std

young knoll
#

Pretend I have nitro and that works

ivory sleet
#

Well

#

Kotlin and java share programming paradigms

ivory sleet
#

Which makes them by nature not so different

hybrid spoke
#

and yet kotlin is just a java clone off while also abusing java

minor aurora
#

And they both compile to bytecode for the jvm

ivory sleet
#

Mind specifying more exactly what you like about its syntax?

young knoll
#

What’s the dang uhh

hybrid spoke
#

the methods are fun

young knoll
#

variable?.whatever stuff called

ivory sleet
#

val var

#

Also have const

minor aurora
#

the way you make getters and setters 🤤

#

the way you iterate! ❤️

young knoll
#

Those are kinda nice

minor aurora
#

doing things like list.map {it => it.name} is just OUUUWWGHH

neon nymph
#

Hello! I have a general MySQL question...

Which is more efficient and less intensive, using INSERT INTO ON DUPLICATE KEY UPDATE
or
query if there's an existing record already and then inserting if there isn't and updating if there is?

neon nymph
#

Alright, thanks!

minor aurora
young knoll
#

Just be aware that it will still increment auto increment columns when you use ON DUPLICATE KEY

#

Which isn’t really an issue but it’s kinda annoying

ivory sleet
#

Sure it does provide less boilerplate, val and var is no different from final and non-final, higher ordered functions are cool but just functional interfaces (altho yes u dont gain the benefits of structural typing), do u mean operator overloading? That shit is mostly confusing, sure u have first class functions also but they bloat kotlin up (for example firstNonNullOrElseGetIfNot are things that pop up when I don’t want to) also first ordered functions are sometimes a pain because you have map, let, run etc and keeping track of their differences requires memory. Kotlin properties (getters and setters) are nice but the way its interoperable with Java makes it despicable to even touch. Null safety is nice.

#

Also yeah, verbosity is not always bad.

young knoll
#

I like how the one thing conclure likes is the null safety

ivory sleet
#

Cutting of too much boilerplate and reducing too much verbosity and u get languages like
d f rd :
( d 4 )@

young knoll
ivory sleet
#

I mean obv operator overloading can be nice with vectors or what not

#

And inline functions can be really nice

#

Extension functions, just another way of writing static methods ( I mean sure u have the receiver object being a bit more explicated)

young knoll
#

Player + Player

ivory sleet
#

Infix is just boilerplate removal

young knoll
#

Abusing operator overloading on objects where it makes no sense is wack

minor aurora
ivory sleet
#

I don’t like it

young knoll
#

Doesn’t java have var now

ivory sleet
#

And the industry hates it for reasons unignorable

minor aurora
ivory sleet
#

Yea

#

Yes they’re shorter to write out, and sure u can use optional type inference with them

minor aurora
#

Type inference 🤤

ivory sleet
#

Actually another good thing about kotlin is immutability by nature

#

But in a good engineered system, the java dev should be using other means of practices to address that design concern

wide steeple
ivory sleet
#

You can still do that

#

val x: Int = 3

minor aurora
ivory sleet
#

its just that the type x can be inferred

#

meaning
val x: Int = 3
and
val x = 3

Have the same type, in this case Int

wide steeple
#

I dunno… having machine decide object type sounds… unsafe

ivory sleet
#

Not the machine

#

The compiler understand it

#

java even has it with var keyword

#

typescript has it also

noble lantern
young knoll
#

Weak typing

minor aurora
#

So does C# ^ (has var)

#

And it's not like it's js or python in that you can change the type of the variable (unless you like being weird and declaring variables with the Object (Java) or Any (Kotlin) types)

young knoll
#

I find var can mess with readability

#

But it’s nice when you want to replace something long and annoying

ivory sleet
#

Yes

minor aurora
young knoll
#

Like Entry<UUID,MyCoolClass>

ivory sleet
#

Py is a good example of strongly, dynamically typed

wide steeple
minor aurora
#

If I could use Kotlin for web client dev that would be interesting.

ivory sleet
#

That’s possible

#

Ktor

#

Tho

wide steeple
#

Like, with a strong typed language, you can tell what a object’s type is, by, well, looking at the type

#

But with something weakly typed

#

You gotta look multiple lines of code

#

To figure out what it is

ivory sleet
#

Well JavaScript was almost replaced by TypeScript

#

Now tho, JS just steals stuff from TS (not rly but kinda)

#

I think a good example of when u don’t need strongly typed languages are if you only write some program to do math stuff

wide steeple
#

Wait… people still use pure JS…?

#

Why…

ivory sleet
#

Yeah that’s a great question

young knoll
#

I use node

#

||/s||

minor aurora
wide steeple
ivory sleet
#

TypeScript can be learnt just as easily

wide steeple
#

But for production…?

ivory sleet
#

Prototyping doesn’t make sense

#

Cuz any modern shit will provide u with a dev env where u have file watchers that monitor changes

#

And apply it directly with a hot reload

minor aurora
#

but you have to set all that up. That is not a quick prototype from scratch

ivory sleet
#

And yes debugging is generally not painful because these tools are good

ivory sleet
#

React has a sample project

minor aurora
#

which you have to download a couple MBs for

ivory sleet
#

Just ready to go in principle

#

Yes so what?

#

You do that once

minor aurora
#

That's slightly bigger than a "quick prototype"

#

I mean something like "oh I want to see how js can add two numbers" or "let's make a quick calculator for this algebraic problem"

ivory sleet
#

Go to a js playground then lol

minor aurora
#

point stands: it's pure JS

ivory sleet
#

But if a language mere existence is cause its useful for prototyping, that’s a pretty shit language

young knoll
#

Isn’t that just python

ivory sleet
#

Na

minor aurora
minor aurora
ivory sleet
#

Just ask any modern enterprise

#

Just because it is the language for the web doesn’t mean it’s what people wanna use for the web

ivory sleet
#

Same tbh

minor aurora
#

yet I've been on the field, and I've seen how people use js

ivory sleet
#

Fair enough

humble tulip
#

hi

minor aurora
#

so back to this. I haven't made a minecraft server hosted on my computer in a WHILE now, so, I got the server running, I got a lot of files and all.

Do I just drop my plugin jar on the plugins folder?

minor aurora
minor aurora
wide steeple
young knoll
#

Reloading is liable to break things

#

Avoid it

humble tulip
ivory sleet
minor aurora
humble tulip
#

But if it doesn't break your plugin, it's unlikely to break after restart

#

So if your plugin doesn't break with reload, you can use it

ivory sleet
#

Yeah reload kinda sucks because it allocates new classloaders and shit which can mess up stuff

humble tulip
#

Can also use PlugmanX but some ppl will disagree

ivory sleet
#

Plugwoman >>>

minor aurora
#

So, another question. How do I make plugin testing as seamless as possible?
Anyone got a gradle task for this? 😭 (so I don't have to write it myself)

young knoll
#

I still copy mine to the plugins folder manually

ivory sleet
#

I’d point you to paperweight userdev

young knoll
#

Like a peasant

ivory sleet
#

But it’d add paper api which u may not wanna do

young knoll
#

Userdev is just for remapping

humble tulip
#

Intellij debugger can hotswap classes no?

wide steeple
young knoll
#

Do you mean runpaper?

minor aurora
ivory sleet
young knoll
#

Iirc yes

ivory sleet
#

But the plugin dev thing

#

Idk lol

#

They have something for that

young knoll
#

Runpaper is a separate gradle plugin

ivory sleet
#

Ah ye

minor aurora
#

but maybe I'll still need some sort of permissions API or something.. or is that bukkit?
I got a lot to read

young knoll
#

Bukkit has api for checking perms

#

But not a complete api for setting them

wide steeple
#

I just have a script that copy my plug-in to the server plug-in folder then start the server…

minor aurora
#

Like, jar -> move jar -> stop server -> start server

ivory sleet
#

I did have a gradle script to do that

wide steeple
#

For this one, no.

ivory sleet
#

But I lost it among my 100 gh projects

noble lantern
young knoll
#

I don’t like hardcoding my server path into my project tho

noble lantern
#

edit config on pc -> push to sftp

young knoll
#

And then pushing it to git

minor aurora
young knoll
#

I guess I could use an environment variable

ivory sleet
#

Kiroto I assume you have gradle.build.kts?

minor aurora
ivory sleet
#

just define the tasks for urself

minor aurora
ivory sleet
#

yea, im sorry, I lost mine

ivory sleet
#

Yeaaa

#

That one

minor aurora
#

🤔 wait why doesn't spigot have, I don't know, a project boilerplate?

noble lantern
#

theres a plugin for it "Minecraft Development" for intellij

minor aurora
#

with common gradle tasks and all

eternal oxide
#

Spigot uses Maven

minor aurora
wide steeple
#

Do you prefer Maven or Gradle, and why?

eternal oxide
#

Everything spigot is maven based

ivory sleet
#

Gradle

noble lantern
young knoll
#

You can use either for plugins

#

But spigot itself is all maven

ivory sleet
#

Because you can add small code to ur build pipeline execution seamlessly perfanxiety

minor aurora
ivory sleet
#

Which maven cant do w/o plugins

wide steeple
#

Lmfao

eternal oxide
#

I've no use for Gradle so I only use Maven

ivory sleet
#

Groovy dsl is a fucking sin

#

Its worse than liking maven over gradle

young knoll
#

I feel attacked

ivory sleet
#

Im sorry coll

wide steeple
#

See? That’s how you start a war

ivory sleet
#

But its so bad

minor aurora
ivory sleet
#

The support idea gives is just lacking

noble lantern
#

i use maven when i need remapped or modules

Gradle when i dont

So mainly maven kek

young knoll
#

I tried changing 2 years ago but it was so hard to find documentation for Kotlin stuff

#

Probably better now

ivory sleet
#

Yea

wide steeple
#

Syntax wise I prefer maven, but I mainly use Gradle for the performance

noble lantern
#

Is there a gradle plugin for special source yet r_baby_cry

minor aurora
#

But... java documentation works for kotlin stuff~

ivory sleet
young knoll
#

Yeah

ivory sleet
#

And like support by browsing forums

noble lantern
#

doesnt that make my api also paper tho

young knoll
#

Yes

ivory sleet
#

Cuz ppl used to use groovy cuz that was default

noble lantern
#

yeah i wanna avoid that for now

minor aurora
young knoll
#

I have all my NMS stuff in side modules tho so I don’t have many issues

#

Main module uses spigot api

wide steeple
#

Lmfao

young knoll
#

?whereami

minor aurora
#

Every gradle page has a groovy and a kotlin example

eternal oxide
#

I always build for Spigot

ivory sleet
#

Yeaaa

wide steeple
#

Oh my

noble lantern
wide steeple
#

I think I just started a war

young knoll
#

Back in the day the shadow plugin had like nothing for Kotlin

ivory sleet
#

Paper has some cool events ngl

young knoll
#

I think it does now

ivory sleet
#

But spigot cool 😎

young knoll
#

Just uhh

#

Make a feature request 😉

ivory sleet
#

Almost invoked a pr at some point

#

😅

minor aurora
#

What is a good way to learn spigot/bukkit's api?

young knoll
#

Curious what events you are referring to

ivory sleet
#

Like any other api kiroto

ivory sleet